Add match_init_recirc() helper and use it in update_recirc_rules().

This is in preparation for using this value
in ofproto-dpif-xlate.c when composing recirculation
actions added as a result of processing (MPLS) actions.

Signed-off-by: Simon Horman <[email protected]>
---
 lib/match.c    | 9 +++++++++
 lib/match.h    | 1 +
 ofproto/bond.c | 5 +----
 3 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/lib/match.c b/lib/match.c
index 514e7f9..9a0ce1a 100644
--- a/lib/match.c
+++ b/lib/match.c
@@ -150,6 +150,15 @@ match_init_catchall(struct match *match)
     flow_wildcards_init_catchall(&match->wc);
 }
 
+void
+match_init_recirc(struct match *match, uint32_t id)
+{
+    match_init_catchall(match);
+    match_set_recirc_id(match, id);
+    /* recirc_id -> metadata to speed up look ups. */
+    match_set_metadata(match, htonll(id));
+}
+
 /* For each bit or field wildcarded in 'match', sets the corresponding bit or
  * field in 'flow' to all-0-bits.  It is important to maintain this invariant
  * in a match that might be inserted into a classifier.
diff --git a/lib/match.h b/lib/match.h
index 2422fb1..2367065 100644
--- a/lib/match.h
+++ b/lib/match.h
@@ -38,6 +38,7 @@ void match_init(struct match *,
                 const struct flow *, const struct flow_wildcards *);
 void match_wc_init(struct match *match, const struct flow *flow);
 void match_init_catchall(struct match *);
+void match_init_recirc(struct match *, uint32_t id);
 
 void match_zero_wildcarded_fields(struct match *);
 
diff --git a/ofproto/bond.c b/ofproto/bond.c
index 2991331..5ae6c71 100644
--- a/ofproto/bond.c
+++ b/ofproto/bond.c
@@ -336,10 +336,7 @@ update_recirc_rules(struct bond *bond)
         struct bond_slave *slave = bond->hash[i].slave;
 
         if (slave) {
-            match_init_catchall(&match);
-            match_set_recirc_id(&match, bond->recirc_id);
-            /* recirc_id -> metadata to speed up look ups. */
-            match_set_metadata(&match, htonll(bond->recirc_id));
+            match_init_recirc(&match, bond->recirc_id);
             match_set_dp_hash_masked(&match, i, BOND_MASK);
 
             add_pr_rule(bond, &match, slave->ofp_port,
-- 
1.8.5.2

_______________________________________________
dev mailing list
[email protected]
http://openvswitch.org/mailman/listinfo/dev

Reply via email to