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

Simon Horman simon.horman at netronome.com
Thu Jan 16 09:38:50 UTC 2020


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.

Only the exact-match case is covered by this patch as it addresses the
Openstack use-case and seems most robust against feature evolution: f.e. in
future there may exist hardware offload scenarios where an operation, such
as a BPF offload, sets the SKB mark before proceeding tho the in-HW OVS.
datapath.

Signed-off-by: John Hurley <john.hurley at netronome.com>
Co-Authored: Simon Horman <simon.horman at netronome.com>
Signed-off-by: Simon Horman <simon.horman at netronome.com>

---
v0 [John Hurley]

v1 [Simon Horman]
* Check for exact rather than masked match on skb 0

v2 [Simon Horman]
* Add co-authored tag
  Add explanation of check against exact-match to changelog
---
 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 4988dadc3f50..5781d163e276 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;
+    }
+
     err = test_key_and_mask(match);
     if (err) {
         return err;
-- 
2.20.1



More information about the dev mailing list