[ovs-dev] [PATCH] datapath: Use DP_MAX_PORTS when no IN_PORT attribute is present.

Andy Zhou azhou at nicira.com
Tue Jul 9 22:16:15 UTC 2013


Thanks for the patch. It looks good.


On Tue, Jul 9, 2013 at 2:27 PM, Jesse Gross <jesse at nicira.com> wrote:

> To indicate that a flow is not associated with any particular in port,
> userspace may omit the IN_PORT attribute, which the kernel translates
> internally to the special value DP_MAX_PORTS. After the megaflows
> changes, this was no longer being done, resulting in it using port 0
> (the internal port).
>
> This also adopts a wildcarding scheme similar to 802.2 packets where
> a mask can be specified for this non-existent key attribute but it
> must either be completely wildcarded or completely exact match.
>
> CC: Andy Zhou <azhou at nicira.com>
> Signed-off-by: Jesse Gross <jesse at nicira.com>
> ---
>  datapath/flow.c | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/datapath/flow.c b/datapath/flow.c
> index adb918f..9ae94bc 100644
> --- a/datapath/flow.c
> +++ b/datapath/flow.c
> @@ -133,6 +133,10 @@ static bool ovs_match_validate(const struct
> sw_flow_match *match,
>                         | (1ULL << OVS_KEY_ATTR_ARP)
>                         | (1ULL << OVS_KEY_ATTR_ND));
>
> +       if (match->key->phy.in_port == DP_MAX_PORTS &&
> +           match->mask && (match->mask->key.phy.in_port == 0xffff))
> +               mask_allowed |= (1ULL << OVS_KEY_ATTR_IN_PORT);
> +
>         if (match->key->eth.type == htons(ETH_P_802_2) &&
>             match->mask && (match->mask->key.eth.type == htons(0xffff)))
>                 mask_allowed |= (1ULL << OVS_KEY_ATTR_ETHERTYPE);
> @@ -1314,6 +1318,8 @@ static int metadata_from_nlattrs(struct
> sw_flow_match *match,  u64 *attrs,
>                         return -EINVAL;
>                 SW_FLOW_KEY_PUT(match, phy.in_port, in_port, is_mask);
>                 *attrs &= ~(1ULL << OVS_KEY_ATTR_IN_PORT);
> +       } else if (!is_mask) {
> +               SW_FLOW_KEY_PUT(match, phy.in_port, DP_MAX_PORTS, is_mask);
>         }
>
>         if (*attrs & (1ULL << OVS_KEY_ATTR_SKB_MARK)) {
> --
> 1.8.1.2
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openvswitch.org/pipermail/ovs-dev/attachments/20130709/298c5456/attachment-0003.html>


More information about the dev mailing list