[ovs-dev] [PATCH] tc: handle packet mark of zero

Tonghao Zhang xiangxia.m.yue at gmail.com
Mon Jan 13 10:50:50 UTC 2020


On Mon, Jan 13, 2020 at 6:03 PM Simon Horman <simon.horman at netronome.com> wrote:
>
> Hi,
>
> On Mon, Jan 13, 2020 at 05:28:04PM +0800, Tonghao Zhang wrote:
> > On Fri, Jan 10, 2020 at 7:06 PM Simon Horman <simon.horman at netronome.com> wrote:
> > >
> > > From: John Hurley <john.hurley at netronome.com>
> > >
> > > Openstack may set an skb mark of 0 in tunnel rules. This is considered to
> > > be an unused/unset value. However, it prevents the rule from being
> > > offloaded.
> > >
> > > Check if the key value of the skb mark is 0 when it is in use (mask is
> > > set to all ones). If it is then ignore the field and continue with TC offload.
> > >
> > > Signed-off-by: John Hurley <john.hurley at netronome.com>
> > > [simon; check for exact-match rather than any match]
> > > Signed-off-by: Simon Horman <simon.horman at netronome.com>
> > > ---
> > >  lib/netdev-offload-tc.c | 5 +++++
> > >  1 file changed, 5 insertions(+)
> > >
> > > diff --git a/lib/netdev-offload-tc.c b/lib/netdev-offload-tc.c
> > > index 7453078d535f..daff8a379e97 100644
> > > --- a/lib/netdev-offload-tc.c
> > > +++ b/lib/netdev-offload-tc.c
> > > @@ -1619,6 +1619,11 @@ netdev_tc_flow_put(struct netdev *netdev, struct match *match,
> > >          mask->ct_label = OVS_U128_ZERO;
> > >      }
> > >
> > > +    /* ignore exact match on skb_mark of 0. */
> > > +    if (mask->pkt_mark == UINT32_MAX && !key->pkt_mark) {
> > > +        mask->pkt_mark = 0;
> > > +    }
> > Why not: if (!(mask->pkt_mark & key->pkt_mark))
>
> Its not clear to me that only returns true in the case
> where there is an exact match on pkt_mark 0. Which is the case
> that is considered to be an unused/unset value from a HW offload
> perspective.
if mask->pkt_mark & key->pkt_mark == 0, the HW offload will return error ?
if so, there is a case that key->pkt_mark != 0, but mask->pkt_mark &
key->pkt_mark == 0.
> >
> > >      err = test_key_and_mask(match);
> > >      if (err) {
> > >          return err;
> > > --
> > > 2.20.1
> > >
> > > _______________________________________________
> > > dev mailing list
> > > dev at openvswitch.org
> > > https://mail.openvswitch.org/mailman/listinfo/ovs-dev


More information about the dev mailing list