[ovs-dev] [PATCH 2/3] datapath: Accept any in_port mask but override to be exact match

Jesse Gross jesse at nicira.com
Thu Aug 1 16:19:01 UTC 2013


On Wed, Jul 31, 2013 at 8:39 PM, Andy Zhou <azhou at nicira.com> wrote:
> diff --git a/datapath/flow.c b/datapath/flow.c
> index 84df4d3..a2111e7 100644
> --- a/datapath/flow.c
> +++ b/datapath/flow.c
> @@ -138,8 +138,7 @@ static bool ovs_match_validate(const struct sw_flow_match *match,
>         /* Tunnel mask is always allowed. */
>         mask_allowed |= (1ULL << OVS_KEY_ATTR_TUNNEL);
>
> -       if (match->key->phy.in_port == DP_MAX_PORTS &&
> -           match->mask && (match->mask->key.phy.in_port == 0xffff))
> +       if (match->mask && (match->mask->key.phy.in_port == 0xffff))
>                 mask_allowed |= (1ULL << OVS_KEY_ATTR_IN_PORT);

I'm not sure that there's really much need to check for the match
being exact at this point. We could just combine it with the above
line and then have a nice list of exception cases.

> @@ -1323,6 +1322,10 @@ static int metadata_from_nlattrs(struct sw_flow_match *match,  u64 *attrs,
>                 SW_FLOW_KEY_PUT(match, phy.in_port, DP_MAX_PORTS, is_mask);
>         }
>
> +       /* Always exact match in_port. */
> +       if (is_mask)
> +               SW_FLOW_KEY_PUT(match, phy.in_port, 0xffff, is_mask);

I think it should also be OK to also allow fully wildcarded matches.
If we just move this up into the main IN_PORT block then it should be
handled automatically.

To Ethan's point, it would also be nice to expand the commit message
some with a more descriptive rationale.



More information about the dev mailing list