[ovs-dev] [PATCH 02/24] nx-match: Do not include NXM only matches when putting an OMX match

Simon Horman horms at verge.net.au
Mon Jul 23 06:16:31 UTC 2012


Suggested by Isaku Yamahata

Cc: Isaku Yamahata <yamahata at valinux.co.jp?
Signed-off-by: Simon Horman <horms at verge.net.au>

---

v7
* Initial post
---
 lib/nx-match.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/lib/nx-match.c b/lib/nx-match.c
index 0f67692..2498b9b 100644
--- a/lib/nx-match.c
+++ b/lib/nx-match.c
@@ -491,7 +491,6 @@ nx_put_match(struct ofpbuf *b, bool oxm, const struct cls_rule *cr,
     const struct flow *flow = &cr->flow;
     const size_t start_len = b->size;
     int match_len;
-    int i;
 
     BUILD_ASSERT_DECL(FLOW_WC_SEQ == 14);
 
@@ -574,12 +573,16 @@ nx_put_match(struct ofpbuf *b, bool oxm, const struct cls_rule *cr,
     }
 
     /* Tunnel ID. */
-    nxm_put_64m(b, NXM_NX_TUN_ID, flow->tun_id, cr->wc.tun_id_mask);
+    if (!oxm) {
+        int i;
+
+        nxm_put_64m(b, NXM_NX_TUN_ID, flow->tun_id, cr->wc.tun_id_mask);
 
-    /* Registers. */
-    for (i = 0; i < FLOW_N_REGS; i++) {
-        nxm_put_32m(b, NXM_NX_REG(i),
-                    htonl(flow->regs[i]), htonl(cr->wc.reg_masks[i]));
+        /* Registers. */
+        for (i = 0; i < FLOW_N_REGS; i++) {
+            nxm_put_32m(b, NXM_NX_REG(i),
+                        htonl(flow->regs[i]), htonl(cr->wc.reg_masks[i]));
+        }
     }
 
     /* OpenFlow 1.1+ Metadata. */
-- 
1.7.10.2.484.gcd07cc5




More information about the dev mailing list