[ovs-discuss] mf_value and mf_subvalue size restrictions

Madhu Challa challa at noironetworks.com
Tue Nov 4 23:10:59 UTC 2014


I was playing increasing the size of these structures to be able to read
Geneve metadata. Currently they are limited to 16 bytes. I noticed that
some of the test cases fail when I do this. I guess I can read the oxms
directly without using these structures. But figured its less error prone
if done this way.

Here is the simple diff to see the failed test cases.

ovs-master1# git diff
diff --git a/lib/meta-flow.h b/lib/meta-flow.h
index 4607c7f..a90b87c 100644
--- a/lib/meta-flow.h
+++ b/lib/meta-flow.h
@@ -1482,10 +1482,11 @@ union mf_value {
     ovs_be32 be32;
     ovs_be16 be16;
     uint8_t u8;
+    uint8_t raw_oxm[256];
 };
-BUILD_ASSERT_DECL(sizeof(union mf_value) == 16);
+BUILD_ASSERT_DECL(sizeof(union mf_value) == 256);

-#define MF_EXACT_MASK_INITIALIZER { IN6ADDR_EXACT_INIT }
+#define MF_EXACT_MASK_INITIALIZER { .raw_oxm[0 ... 255] = 0xff }

 /* Part of a field. */
 struct mf_subfield {
@@ -1500,10 +1501,10 @@ struct mf_subfield {
  * value" contains NXM_OF_VLAN_TCI[0..11], then one could access the
  * corresponding data in value.be16[7] as the bits in the mask
htons(0xfff). */
 union mf_subvalue {
-    uint8_t u8[16];
-    ovs_be16 be16[8];
-    ovs_be32 be32[4];
-    ovs_be64 be64[2];
+    uint8_t u8[256];
+    ovs_be16 be16[128];
+    ovs_be32 be32[64];
+    ovs_be64 be64[32];
 };
 BUILD_ASSERT_DECL(sizeof(union mf_value) == sizeof (union mf_subvalue));


root at noiro-ucs06:~/ovs-master1/tests/testsuite.dir/0350# ./run
## ------------------------------ ##
## openvswitch 2.3.90 test suite. ##
## ------------------------------ ##
350. learn.at:3: testing learning action - parsing and formatting ...
./learn.at:12: ovs-ofctl parse-flows flows.txt
--- /dev/null 2014-10-16 15:12:29.301263000 -0700
+++ /home/mchalla/ovs-master1/tests/testsuite.dir/at-groups/350/stderr
2014-11-04
14:35:37.330059658 -0800
@@ -0,0 +1 @@
+ovs-ofctl: flows.txt:6: 10->NXM_NX_REG0[5..10]: value does not fit into 6
bits
--- - 2014-11-04 14:35:37.335015983 -0800
+++ /home/mchalla/ovs-master1/tests/testsuite.dir/at-groups/350/stdout
2014-11-04
14:35:37.330059658 -0800
@@ -1,9 +1 @@
-usable protocols: any
-chosen protocol: OpenFlow10-table_id
-OFPT_FLOW_MOD (xid=0x1): ADD actions=learn(table=1)
-OFPT_FLOW_MOD (xid=0x2): ADD actions=learn(table=1,send_flow_rem)
-OFPT_FLOW_MOD (xid=0x3): ADD actions=learn(table=1,delete_learned)
-OFPT_FLOW_MOD (xid=0x4): ADD
actions=learn(table=1,send_flow_rem,delete_learned)
-OFPT_FLOW_MOD (xid=0x5): ADD
actions=learn(table=1,NXM_OF_VLAN_TCI[0..11],NXM_OF_ETH_DST[]=NXM_OF_ETH_SRC[],output:NXM_OF_IN_PORT[],load:0xa->NXM_NX_REG0[5..10])
-OFPT_FLOW_MOD (xid=0x6): ADD
actions=learn(table=1,idle_timeout=10,hard_timeout=20,fin_idle_timeout=5,fin_hard_timeout=10,priority=10,cookie=0xfedcba9876543210,in_port=99,NXM_OF_ETH_DST[]=NXM_OF_ETH_SRC[],load:NXM_OF_IN_PORT[]->NXM_NX_REG1[16..31])

./learn.at:12: exit code was 1, expected 0
350. learn.at:3:  FAILED (learn.at:12)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://openvswitch.org/pipermail/ovs-discuss/attachments/20141104/8fe5da70/attachment-0002.html>


More information about the discuss mailing list