]> git.proxmox.com Git - ovs.git/commitdiff
nx-match: Serialize standard xregs instead of Nicira registers, in OF1.5.
authorBen Pfaff <blp@nicira.com>
Thu, 21 Aug 2014 03:59:43 +0000 (20:59 -0700)
committerBen Pfaff <blp@nicira.com>
Thu, 4 Sep 2014 19:29:12 +0000 (12:29 -0700)
Commit 79fe0f4611b60 (meta-flow: Add 64-bit registers.) added support for
the OpenFlow 1.5 (draft) standardized registers, but neglected to cause
them to be serialized when Open vSwitch composes flow matches.  This meant
that they were always sent to a controller as pairs of Nicira extension
registers.  This commit fixes the problem.

Found by inspection.

ONF-JIRA: EXT-244
Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
lib/nx-match.c
tests/ovs-ofctl.at

index 54712ccce5abf4057c6f98e951c9204aafcd257f..05be3b52fc3f9cb56cae9d381765a402d9b37ced 100644 (file)
@@ -724,9 +724,17 @@ nx_put_raw(struct ofpbuf *b, enum ofp_version oxm, const struct match *match,
                 flow->tunnel.ip_dst, match->wc.masks.tunnel.ip_dst);
 
     /* Registers. */
-    for (i = 0; i < FLOW_N_REGS; i++) {
-        nxm_put_32m(b, mf_oxm_header(MFF_REG0 + i, oxm),
-                    htonl(flow->regs[i]), htonl(match->wc.masks.regs[i]));
+    if (oxm < OFP15_VERSION) {
+        for (i = 0; i < FLOW_N_REGS; i++) {
+            nxm_put_32m(b, mf_oxm_header(MFF_REG0 + i, oxm),
+                        htonl(flow->regs[i]), htonl(match->wc.masks.regs[i]));
+        }
+    } else {
+        for (i = 0; i < FLOW_N_XREGS; i++) {
+            nxm_put_64m(b, mf_oxm_header(MFF_XREG0 + i, oxm),
+                        htonll(flow_get_xreg(flow, i)),
+                        htonll(flow_get_xreg(&match->wc.masks, i)));
+        }
     }
 
     /* Mark. */
index 6e828372baf6a110d0ea875e7e7f8435eadf4cf7..8eca2956491d93efddd4dda2eed066803d4ea51e 100644 (file)
@@ -1681,7 +1681,7 @@ NXM_OF_IN_PORT(0001), NXM_OF_ETH_TYPE(0800)
 ])
 AT_CLEANUP
 
-AT_SETUP([ovs-ofctl parse-oxm])
+AT_SETUP([ovs-ofctl parse-oxm (OpenFlow 1.5)])
 AT_KEYWORDS([oxm])
 AT_DATA([oxm.txt], [dnl
 <any>
@@ -1895,6 +1895,27 @@ OXM_OF_ETH_TYPE(86dd) OXM_OF_IP_PROTO(3a) OXM_OF_ICMPV6_TYPE(87) OXM_OF_IPV6_ND_
 OXM_OF_ETH_TYPE(86dd) OXM_OF_IP_PROTO(3b) OXM_OF_ICMPV6_TYPE(87) OXM_OF_IPV6_ND_TARGET(20010db83c4d00010002000300040005) OXM_OF_IPV6_ND_TLL(0002e30f80a4)
 OXM_OF_ETH_TYPE(0800) OXM_OF_IP_PROTO(3a) OXM_OF_ICMPV6_TYPE(88) OXM_OF_IPV6_ND_TARGET(20010db83c4d00010002000300040005) OXM_OF_IPV6_ND_TLL(0002e30f80a4)
 
+# Registers 0, 1, and 2.
+NXM_NX_REG0(acebdf56)
+NXM_NX_REG0_W(a0e0d050/f0f0f0f0)
+NXM_NX_REG0(a0e0d050)
+NXM_NX_REG1(acebdf56)
+NXM_NX_REG0_W(a0e0d050/f0f0f0f0), NXM_NX_REG1_W(a0e0d050/f0f0f0f0)
+NXM_NX_REG0_W(a0e0d050/f0f0f0f0), NXM_NX_REG1(a0e0d050)
+NXM_NX_REG1_W(a0e0d050/f0f0f0f0), NXM_NX_REG2_W(a0e0d050/f0f0f0f0)
+NXM_NX_REG1_W(a0e0d050/f0f0f0f0), NXM_NX_REG2(a0e0d050)
+
+# Extended registers 0, 1, and 2.
+# (For OpenFlow 1.2, OVS transforms these into its extension registers.)
+OXM_OF_PKT_REG0_W(acebdf5600000000/ffffffff00000000)
+OXM_OF_PKT_REG0_W(a0e0d05000000000/f0f0f0f000000000)
+OXM_OF_PKT_REG0_W(a0e0d05000000000/ffffffff00000000)
+OXM_OF_PKT_REG0_W(00000000acebdf56/00000000ffffffff)
+OXM_OF_PKT_REG0_W(a0e0d050a0e0d050/f0f0f0f0f0f0f0f0)
+OXM_OF_PKT_REG0_W(a0e0d050a0e0d050/f0f0f0f0ffffffff)
+OXM_OF_PKT_REG0_W(00000000a0e0d050/00000000f0f0f0f0), OXM_OF_PKT_REG1_W(a0e0d05000000000/f0f0f0f000000000)
+OXM_OF_PKT_REG0_W(00000000a0e0d050/00000000f0f0f0f0), OXM_OF_PKT_REG1_W(a0e0d05000000000/ffffffff00000000)
+
 # Invalid field number.
 01020304(1111/2222)
 ])
@@ -2111,6 +2132,27 @@ nx_pull_match() returned error OFPBMC_BAD_PREREQ
 nx_pull_match() returned error OFPBMC_BAD_PREREQ
 nx_pull_match() returned error OFPBMC_BAD_PREREQ
 
+# Registers 0, 1, and 2.
+NXM_NX_REG0(acebdf56)
+NXM_NX_REG0_W(a0e0d050/f0f0f0f0)
+NXM_NX_REG0(a0e0d050)
+NXM_NX_REG1(acebdf56)
+NXM_NX_REG0_W(a0e0d050/f0f0f0f0), NXM_NX_REG1_W(a0e0d050/f0f0f0f0)
+NXM_NX_REG0_W(a0e0d050/f0f0f0f0), NXM_NX_REG1(a0e0d050)
+NXM_NX_REG1_W(a0e0d050/f0f0f0f0), NXM_NX_REG2_W(a0e0d050/f0f0f0f0)
+NXM_NX_REG1_W(a0e0d050/f0f0f0f0), NXM_NX_REG2(a0e0d050)
+
+# Extended registers 0, 1, and 2.
+# (For OpenFlow 1.2, OVS transforms these into its extension registers.)
+NXM_NX_REG0(acebdf56)
+NXM_NX_REG0_W(a0e0d050/f0f0f0f0)
+NXM_NX_REG0(a0e0d050)
+NXM_NX_REG1(acebdf56)
+NXM_NX_REG0_W(a0e0d050/f0f0f0f0), NXM_NX_REG1_W(a0e0d050/f0f0f0f0)
+NXM_NX_REG0_W(a0e0d050/f0f0f0f0), NXM_NX_REG1(a0e0d050)
+NXM_NX_REG1_W(a0e0d050/f0f0f0f0), NXM_NX_REG2_W(a0e0d050/f0f0f0f0)
+NXM_NX_REG1_W(a0e0d050/f0f0f0f0), NXM_NX_REG2(a0e0d050)
+
 # Invalid field number.
 nx_pull_match() returned error OFPBMC_BAD_FIELD
 ], [stderr])
@@ -2125,6 +2167,55 @@ nx_match|WARN|NXM/OXM entry OXM_OF_METADATA_W(1234567890abcdef/ffff0000ffff0000)
 AT_CHECK([grep -v 'has 1-bits in value' stderr], [1])
 AT_CLEANUP
 
+AT_SETUP([ovs-ofctl parse-oxm (OpenFlow 1.5)])
+AT_KEYWORDS([oxm])
+AT_DATA([oxm.txt], [dnl
+# Extended registers 0 and 1.
+OXM_OF_PKT_REG0_W(acebdf5600000000/ffffffff00000000)
+OXM_OF_PKT_REG0_W(a0e0d05000000000/f0f0f0f000000000)
+OXM_OF_PKT_REG0_W(a0e0d05000000000/ffffffff00000000)
+OXM_OF_PKT_REG0_W(00000000acebdf56/00000000ffffffff)
+OXM_OF_PKT_REG0_W(a0e0d050a0e0d050/f0f0f0f0f0f0f0f0)
+OXM_OF_PKT_REG0_W(a0e0d050a0e0d050/f0f0f0f0ffffffff)
+OXM_OF_PKT_REG0_W(00000000a0e0d050/00000000f0f0f0f0), OXM_OF_PKT_REG1_W(a0e0d05000000000/f0f0f0f000000000)
+OXM_OF_PKT_REG0_W(00000000a0e0d050/00000000f0f0f0f0), OXM_OF_PKT_REG1_W(a0e0d05000000000/ffffffff00000000)
+
+# Registers 0, 1, and 2.
+# (OpenFlow 1.5 transforms these into the standard "xregs".)
+NXM_NX_REG0(acebdf56)
+NXM_NX_REG0_W(a0e0d050/f0f0f0f0)
+NXM_NX_REG0(a0e0d050)
+NXM_NX_REG1(acebdf56)
+NXM_NX_REG0_W(a0e0d050/f0f0f0f0), NXM_NX_REG1_W(a0e0d050/f0f0f0f0)
+NXM_NX_REG0_W(a0e0d050/f0f0f0f0), NXM_NX_REG1(a0e0d050)
+NXM_NX_REG1_W(a0e0d050/f0f0f0f0), NXM_NX_REG2_W(a0e0d050/f0f0f0f0)
+NXM_NX_REG1_W(a0e0d050/f0f0f0f0), NXM_NX_REG2(a0e0d050)
+])
+AT_CHECK([ovs-ofctl '-vPATTERN:console:%c|%p|%m' --strict parse-oxm OpenFlow15 < oxm.txt],
+  [0], [dnl
+# Extended registers 0 and 1.
+OXM_OF_PKT_REG0_W(acebdf5600000000/ffffffff00000000)
+OXM_OF_PKT_REG0_W(a0e0d05000000000/f0f0f0f000000000)
+OXM_OF_PKT_REG0_W(a0e0d05000000000/ffffffff00000000)
+OXM_OF_PKT_REG0_W(00000000acebdf56/00000000ffffffff)
+OXM_OF_PKT_REG0_W(a0e0d050a0e0d050/f0f0f0f0f0f0f0f0)
+OXM_OF_PKT_REG0_W(a0e0d050a0e0d050/f0f0f0f0ffffffff)
+OXM_OF_PKT_REG0_W(00000000a0e0d050/00000000f0f0f0f0), OXM_OF_PKT_REG1_W(a0e0d05000000000/f0f0f0f000000000)
+OXM_OF_PKT_REG0_W(00000000a0e0d050/00000000f0f0f0f0), OXM_OF_PKT_REG1_W(a0e0d05000000000/ffffffff00000000)
+
+# Registers 0, 1, and 2.
+# (OpenFlow 1.5 transforms these into the standard "xregs".)
+OXM_OF_PKT_REG0_W(acebdf5600000000/ffffffff00000000)
+OXM_OF_PKT_REG0_W(a0e0d05000000000/f0f0f0f000000000)
+OXM_OF_PKT_REG0_W(a0e0d05000000000/ffffffff00000000)
+OXM_OF_PKT_REG0_W(00000000acebdf56/00000000ffffffff)
+OXM_OF_PKT_REG0_W(a0e0d050a0e0d050/f0f0f0f0f0f0f0f0)
+OXM_OF_PKT_REG0_W(a0e0d050a0e0d050/f0f0f0f0ffffffff)
+OXM_OF_PKT_REG0_W(00000000a0e0d050/00000000f0f0f0f0), OXM_OF_PKT_REG1_W(a0e0d05000000000/f0f0f0f000000000)
+OXM_OF_PKT_REG0_W(00000000a0e0d050/00000000f0f0f0f0), OXM_OF_PKT_REG1_W(a0e0d05000000000/ffffffff00000000)
+], [])
+AT_CLEANUP
+
 AT_SETUP([ovs-ofctl parse-oxm loose])
 AT_KEYWORDS([oxm])
 AT_DATA([oxm.txt], [dnl