From: Justin Pettit Date: Wed, 28 Sep 2011 20:53:59 +0000 (-0700) Subject: nicira-ext: Bump number of registers to five from four. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d2c0fed;p=openvswitch nicira-ext: Bump number of registers to five from four. Feature #7527 --- diff --git a/NEWS b/NEWS index 5d7c522e..ff3bc441 100644 --- 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 diff --git a/include/openflow/nicira-ext.h b/include/openflow/nicira-ext.h index 8f7506e3..51f21f00 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/flow.h b/lib/flow.h index 3f807c50..5cbfca58 100644 --- a/lib/flow.h +++ b/lib/flow.h @@ -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 *); diff --git a/lib/meta-flow.c b/lib/meta-flow.c index 6d2bfbd6..71544265 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 6aa4a1f5..f2508d52 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 486f3923..0b9072b0 100644 --- a/lib/nx-match.c +++ b/lib/nx-match.c @@ -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 65f4667c..3f2882c1 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