[ovs-dev,01/10] match: Add match_set_ct_zone_masked helper
diff mbox series

Message ID 20191030133724.43360-2-roid@mellanox.com
State New
Headers show
Series
  • Add support for offloading CT datapath rules to TC
Related show

Commit Message

Roi Dayan Oct. 30, 2019, 1:37 p.m. UTC
From: Paul Blakey <paulb@mellanox.com>

Sets zone in match.

Signed-off-by: Paul Blakey <paulb@mellanox.com>
Reviewed-by: Roi Dayan <roid@mellanox.com>
---
 include/openvswitch/match.h |  2 ++
 lib/match.c                 | 10 ++++++++--
 2 files changed, 10 insertions(+), 2 deletions(-)

Patch
diff mbox series

diff --git a/include/openvswitch/match.h b/include/openvswitch/match.h
index 05ecee7fc7cd..eeabd5f470a7 100644
--- a/include/openvswitch/match.h
+++ b/include/openvswitch/match.h
@@ -127,6 +127,8 @@  void match_set_pkt_mark_masked(struct match *, uint32_t pkt_mark, uint32_t mask)
 void match_set_ct_state(struct match *, uint32_t ct_state);
 void match_set_ct_state_masked(struct match *, uint32_t ct_state, uint32_t mask);
 void match_set_ct_zone(struct match *, uint16_t ct_zone);
+void match_set_ct_zone_masked(struct match *match, uint16_t ct_zone,
+                              uint16_t mask);
 void match_set_ct_mark(struct match *, uint32_t ct_mark);
 void match_set_ct_mark_masked(struct match *, uint32_t ct_mark, uint32_t mask);
 void match_set_ct_label(struct match *, ovs_u128 ct_label);
diff --git a/lib/match.c b/lib/match.c
index 052daee146f2..5415251741b4 100644
--- a/lib/match.c
+++ b/lib/match.c
@@ -417,8 +417,14 @@  match_set_ct_state_masked(struct match *match, uint32_t ct_state, uint32_t mask)
 void
 match_set_ct_zone(struct match *match, uint16_t ct_zone)
 {
-    match->flow.ct_zone = ct_zone;
-    match->wc.masks.ct_zone = UINT16_MAX;
+    match_set_ct_zone_masked(match, ct_zone, UINT16_MAX);
+}
+
+void
+match_set_ct_zone_masked(struct match *match, uint16_t ct_zone, uint16_t mask)
+{
+    match->flow.ct_zone = ct_zone & mask;
+    match->wc.masks.ct_zone = mask;
 }
 
 void