nicira-ext: Bump number of registers to five from four.
authorJustin Pettit <jpettit@nicira.com>
Wed, 28 Sep 2011 20:53:59 +0000 (13:53 -0700)
committerJustin Pettit <jpettit@nicira.com>
Tue, 4 Oct 2011 16:44:20 +0000 (09:44 -0700)
Feature #7527

NEWS
include/openflow/nicira-ext.h
lib/flow.h
lib/meta-flow.c
lib/meta-flow.h
lib/nx-match.c
lib/nx-match.def

diff --git a/NEWS b/NEWS
index 5d7c522..ff3bc44 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,7 @@ Post-v1.2.0
       - Added an OpenFlow extension which allows the "output" action to accept
         NXM fields.
       - Added an OpenFlow extension for flexible learning.
+      - Bumped number of NXM registers from four to five.
     - ovs-appctl:
       - New "version" command to determine version of running daemon.
       - If no argument is provided for "cfm/show", displays detailed
index 8f7506e..51f21f0 100644 (file)
@@ -1439,6 +1439,8 @@ OFP_ASSERT(sizeof(struct nx_action_output_reg) == 24);
 #define NXM_NX_REG2_W     NXM_HEADER_W(0x0001, 2, 4)
 #define NXM_NX_REG3       NXM_HEADER  (0x0001, 3, 4)
 #define NXM_NX_REG3_W     NXM_HEADER_W(0x0001, 3, 4)
+#define NXM_NX_REG4       NXM_HEADER  (0x0001, 4, 4)
+#define NXM_NX_REG4_W     NXM_HEADER_W(0x0001, 4, 4)
 
 /* Tunnel ID.
  *
index 3f807c5..5cbfca5 100644 (file)
@@ -37,7 +37,7 @@ struct ofpbuf;
  * failures in places which likely need to be updated. */
 #define FLOW_WC_SEQ 1
 
-#define FLOW_N_REGS 4
+#define FLOW_N_REGS 5
 BUILD_ASSERT_DECL(FLOW_N_REGS <= NXM_NX_MAX_REGS);
 
 /* Used for struct flow's dl_type member for frames that have no Ethernet
@@ -75,7 +75,7 @@ BUILD_ASSERT_DECL(sizeof(((struct flow *)0)->nd_target) == 16);
 BUILD_ASSERT_DECL(sizeof(struct flow) == FLOW_SIG_SIZE + FLOW_PAD_SIZE);
 
 /* Remember to update FLOW_WC_SEQ when changing 'struct flow'. */
-BUILD_ASSERT_DECL(FLOW_SIG_SIZE == 116 && FLOW_WC_SEQ == 1);
+BUILD_ASSERT_DECL(FLOW_SIG_SIZE == 120 && FLOW_WC_SEQ == 1);
 
 int flow_extract(struct ofpbuf *, ovs_be64 tun_id, uint16_t in_port,
                  struct flow *);
@@ -155,7 +155,7 @@ struct flow_wildcards {
 };
 
 /* Remember to update FLOW_WC_SEQ when updating struct flow_wildcards. */
-BUILD_ASSERT_DECL(sizeof(struct flow_wildcards) == 72 && FLOW_WC_SEQ == 1);
+BUILD_ASSERT_DECL(sizeof(struct flow_wildcards) == 76 && FLOW_WC_SEQ == 1);
 
 void flow_wildcards_init_catchall(struct flow_wildcards *);
 void flow_wildcards_init_exact(struct flow_wildcards *);
index 6d2bfbd..7154426 100644 (file)
@@ -80,6 +80,9 @@ static const struct mf_field mf_fields[MFF_N_IDS] = {
     REGISTER(3),
 #endif
 #if FLOW_N_REGS > 4
+    REGISTER(4),
+#endif
+#if FLOW_N_REGS > 5
 #error
 #endif
 
@@ -376,6 +379,9 @@ mf_is_all_wild(const struct mf_field *mf, const struct flow_wildcards *wc)
     case MFF_REG3:
 #endif
 #if FLOW_N_REGS > 4
+    case MFF_REG4:
+#endif
+#if FLOW_N_REGS > 5
 #error
 #endif
         return !wc->reg_masks[mf->id - MFF_REG0];
@@ -461,6 +467,9 @@ mf_get_mask(const struct mf_field *mf, const struct flow_wildcards *wc,
     case MFF_REG3:
 #endif
 #if FLOW_N_REGS > 4
+    case MFF_REG4:
+#endif
+#if FLOW_N_REGS > 5
 #error
 #endif
         mask->be32 = htonl(wc->reg_masks[mf->id - MFF_REG0]);
@@ -627,6 +636,9 @@ mf_is_value_valid(const struct mf_field *mf, const union mf_value *value)
     case MFF_REG3:
 #endif
 #if FLOW_N_REGS > 4
+    case MFF_REG4:
+#endif
+#if FLOW_N_REGS > 5
 #error
 #endif
     case MFF_ETH_SRC:
@@ -699,6 +711,9 @@ mf_get_value(const struct mf_field *mf, const struct flow *flow,
     case MFF_REG3:
 #endif
 #if FLOW_N_REGS > 4
+    case MFF_REG4:
+#endif
+#if FLOW_N_REGS > 5
 #error
 #endif
         value->be32 = htonl(flow->regs[0]);
@@ -837,6 +852,9 @@ mf_set_value(const struct mf_field *mf,
     case MFF_REG3:
 #endif
 #if FLOW_N_REGS > 4
+    case MFF_REG4:
+#endif
+#if FLOW_N_REGS > 5
 #error
 #endif
 #if FLOW_N_REGS > 0
@@ -986,6 +1004,11 @@ mf_set_wild(const struct mf_field *mf, struct cls_rule *rule)
         break;
 #endif
 #if FLOW_N_REGS > 4
+    case MFF_REG4:
+        cls_rule_set_reg_masked(rule, 4, 0, 0);
+        break;
+#endif
+#if FLOW_N_REGS > 5
 #error
 #endif
 
@@ -1151,6 +1174,9 @@ mf_set(const struct mf_field *mf,
     case MFF_REG3:
 #endif
 #if FLOW_N_REGS > 4
+    case MFF_REG4:
+#endif
+#if FLOW_N_REGS > 5
 #error
 #endif
         cls_rule_set_reg_masked(rule, mf->id - MFF_REG0,
@@ -1302,6 +1328,9 @@ mf_random_value(const struct mf_field *mf, union mf_value *value)
     case MFF_REG3:
 #endif
 #if FLOW_N_REGS > 4
+    case MFF_REG4:
+#endif
+#if FLOW_N_REGS > 5
 #error
 #endif
     case MFF_ETH_SRC:
index 6aa4a1f..f2508d5 100644 (file)
@@ -44,6 +44,9 @@ enum mf_field_id {
     MFF_REG3,                   /* be32 */
 #endif
 #if FLOW_N_REGS > 4
+    MFF_REG4,                   /* be32 */
+#endif
+#if FLOW_N_REGS > 5
 #error
 #endif
 
index 486f392..0b9072b 100644 (file)
@@ -1046,7 +1046,10 @@ nxm_read_field(const struct nxm_field *src, const struct flow *flow)
 #if FLOW_N_REGS >= 4
     NXM_READ_REGISTER(3);
 #endif
-#if FLOW_N_REGS > 4
+#if FLOW_N_REGS >= 5
+    NXM_READ_REGISTER(4);
+#endif
+#if FLOW_N_REGS > 5
 #error
 #endif
 
@@ -1132,7 +1135,10 @@ nxm_write_field(const struct nxm_field *dst, struct flow *flow,
 #if FLOW_N_REGS >= 4
     NXM_WRITE_REGISTER(3);
 #endif
-#if FLOW_N_REGS > 4
+#if FLOW_N_REGS >= 5
+    NXM_WRITE_REGISTER(4);
+#endif
+#if FLOW_N_REGS > 5
 #error
 #endif
 
index 65f4667..3f2882c 100644 (file)
@@ -60,7 +60,10 @@ DEFINE_FIELD_M(NX_REG2,       MFF_REG2,       true)
 #if FLOW_N_REGS >= 4
 DEFINE_FIELD_M(NX_REG3,       MFF_REG3,       true)
 #endif
-#if FLOW_N_REGS > 4
+#if FLOW_N_REGS >= 5
+DEFINE_FIELD_M(NX_REG4,       MFF_REG4,       true)
+#endif
+#if FLOW_N_REGS > 5
 #error
 #endif