Feature #7527
---
include/openflow/nicira-ext.h | 2 ++
lib/classifier.c | 4 ++--
lib/flow.c | 6 +++---
lib/flow.h | 10 +++++-----
lib/meta-flow.c | 29 +++++++++++++++++++++++++++++
lib/meta-flow.h | 3 +++
lib/nx-match.c | 12 +++++++++---
lib/nx-match.def | 5 ++++-
lib/ofp-util.c | 4 ++--
9 files changed, 59 insertions(+), 16 deletions(-)
diff --git a/include/openflow/nicira-ext.h b/include/openflow/nicira-ext.h
index 8f7506e..51f21f0 100644
--- a/include/openflow/nicira-ext.h
+++ b/include/openflow/nicira-ext.h
@@ -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.
*
diff --git a/lib/classifier.c b/lib/classifier.c
index 02011e0..1f58860 100644
--- a/lib/classifier.c
+++ b/lib/classifier.c
@@ -450,7 +450,7 @@ cls_rule_format(const struct cls_rule *rule, struct ds *s)
int i;
- BUILD_ASSERT_DECL(FLOW_WC_SEQ == 1);
+ BUILD_ASSERT_DECL(FLOW_WC_SEQ == 2);
if (rule->priority != OFP_DEFAULT_PRIORITY) {
ds_put_format(s, "priority=%d,", rule->priority);
@@ -1123,7 +1123,7 @@ flow_equal_except(const struct flow *a, const struct flow
*b,
const flow_wildcards_t wc = wildcards->wildcards;
int i;
- BUILD_ASSERT_DECL(FLOW_WC_SEQ == 1);
+ BUILD_ASSERT_DECL(FLOW_WC_SEQ == 2);
for (i = 0; i < FLOW_N_REGS; i++) {
if ((a->regs[i] ^ b->regs[i]) & wildcards->reg_masks[i]) {
diff --git a/lib/flow.c b/lib/flow.c
index 2d62a12..3f80d15 100644
--- a/lib/flow.c
+++ b/lib/flow.c
@@ -431,7 +431,7 @@ flow_zero_wildcards(struct flow *flow, const struct
flow_wildcards *wildcards)
const flow_wildcards_t wc = wildcards->wildcards;
int i;
- BUILD_ASSERT_DECL(FLOW_WC_SEQ == 1);
+ BUILD_ASSERT_DECL(FLOW_WC_SEQ == 2);
for (i = 0; i < FLOW_N_REGS; i++) {
flow->regs[i] &= wildcards->reg_masks[i];
@@ -584,7 +584,7 @@ flow_wildcards_is_exact(const struct flow_wildcards *wc)
{
int i;
- BUILD_ASSERT_DECL(FLOW_WC_SEQ == 1);
+ BUILD_ASSERT_DECL(FLOW_WC_SEQ == 2);
if (wc->wildcards
|| wc->tun_id_mask != htonll(UINT64_MAX)
@@ -612,7 +612,7 @@ flow_wildcards_is_catchall(const struct flow_wildcards *wc)
{
int i;
- BUILD_ASSERT_DECL(FLOW_WC_SEQ == 1);
+ BUILD_ASSERT_DECL(FLOW_WC_SEQ == 2);
if (wc->wildcards != FWW_ALL
|| wc->tun_id_mask != htonll(0)
diff --git a/lib/flow.h b/lib/flow.h
index 3f807c5..6ab9478 100644
--- a/lib/flow.h
+++ b/lib/flow.h
@@ -35,9 +35,9 @@ struct ofpbuf;
/* This sequence number should be incremented whenever anything involving flows
* or the wildcarding of flows changes. This will cause build assertion
* failures in places which likely need to be updated. */
-#define FLOW_WC_SEQ 1
+#define FLOW_WC_SEQ 2
-#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 == 2);
int flow_extract(struct ofpbuf *, ovs_be64 tun_id, uint16_t in_port,
struct flow *);
@@ -136,7 +136,7 @@ typedef unsigned int OVS_BITWISE flow_wildcards_t;
#define FWW_ALL ((OVS_FORCE flow_wildcards_t) (((1 << 12)) - 1))
/* Remember to update FLOW_WC_SEQ when adding or removing FWW_*. */
-BUILD_ASSERT_DECL(FWW_ALL == ((1 << 12) - 1) && FLOW_WC_SEQ == 1);
+BUILD_ASSERT_DECL(FWW_ALL == ((1 << 12) - 1) && FLOW_WC_SEQ == 2);
/* Information on wildcards for a flow, as a supplement to "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 == 2);
void flow_wildcards_init_catchall(struct flow_wildcards *);
void flow_wildcards_init_exact(struct flow_wildcards *);
diff --git a/lib/meta-flow.c b/lib/meta-flow.c
index 6d2bfbd..7154426 100644
--- a/lib/meta-flow.c
+++ b/lib/meta-flow.c
@@ -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:
diff --git a/lib/meta-flow.h b/lib/meta-flow.h
index 6aa4a1f..f2508d5 100644
--- a/lib/meta-flow.h
+++ b/lib/meta-flow.h
@@ -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
diff --git a/lib/nx-match.c b/lib/nx-match.c
index 486f392..beaed3d 100644
--- a/lib/nx-match.c
+++ b/lib/nx-match.c
@@ -419,7 +419,7 @@ nx_put_match(struct ofpbuf *b, const struct cls_rule *cr)
int match_len;
int i;
- BUILD_ASSERT_DECL(FLOW_WC_SEQ == 1);
+ BUILD_ASSERT_DECL(FLOW_WC_SEQ == 2);
/* Metadata. */
if (!(wc & FWW_IN_PORT)) {
@@ -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
diff --git a/lib/nx-match.def b/lib/nx-match.def
index 65f4667..3f2882c 100644
--- a/lib/nx-match.def
+++ b/lib/nx-match.def
@@ -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
diff --git a/lib/ofp-util.c b/lib/ofp-util.c
index 52a996a..b46219a 100644
--- a/lib/ofp-util.c
+++ b/lib/ofp-util.c
@@ -99,7 +99,7 @@ static const flow_wildcards_t WC_INVARIANTS = 0
void
ofputil_wildcard_from_openflow(uint32_t ofpfw, struct flow_wildcards *wc)
{
- BUILD_ASSERT_DECL(FLOW_WC_SEQ == 1);
+ BUILD_ASSERT_DECL(FLOW_WC_SEQ == 2);
/* Initialize most of rule->wc. */
flow_wildcards_init_catchall(wc);
@@ -790,7 +790,7 @@ ofputil_min_flow_format(const struct cls_rule *rule)
{
const struct flow_wildcards *wc = &rule->wc;
- BUILD_ASSERT_DECL(FLOW_WC_SEQ == 1);
+ BUILD_ASSERT_DECL(FLOW_WC_SEQ == 2);
/* Only NXM supports separately wildcards the Ethernet multicast bit. */
if (!(wc->wildcards & FWW_DL_DST) != !(wc->wildcards & FWW_ETH_MCAST)) {
--
1.7.1
_______________________________________________
dev mailing list
[email protected]
http://openvswitch.org/mailman/listinfo/dev