[ovs-dev] [PATCH 04/17] ofp-actions, nx-match: Use mf_oxm_header() instead of explicit constants.
Ben Pfaff
blp at nicira.com
Wed Sep 17 05:56:57 UTC 2014
Following this change, only meta-flow.c uses any explicit NXM_* or OXM_*
constants. An upcoming commit will actually remove the definitions of
these constants, hiding them behind a functional interface, for better
abstraction.
Signed-off-by: Ben Pfaff <blp at nicira.com>
---
lib/nx-match.c | 17 +++++++++--------
lib/ofp-actions.c | 4 ++--
2 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/lib/nx-match.c b/lib/nx-match.c
index c18e8ea..b896450 100644
--- a/lib/nx-match.c
+++ b/lib/nx-match.c
@@ -477,8 +477,9 @@ nxm_put_ipv6(struct ofpbuf *b, uint32_t header,
}
static void
-nxm_put_frag(struct ofpbuf *b, const struct match *match)
+nxm_put_frag(struct ofpbuf *b, const struct match *match, enum ofp_version oxm)
{
+ uint32_t header = mf_oxm_header(MFF_IP_FRAG, oxm);
uint8_t nw_frag = match->flow.nw_frag;
uint8_t nw_frag_mask = match->wc.masks.nw_frag;
@@ -487,12 +488,11 @@ nxm_put_frag(struct ofpbuf *b, const struct match *match)
break;
case FLOW_NW_FRAG_MASK:
- nxm_put_8(b, NXM_NX_IP_FRAG, nw_frag);
+ nxm_put_8(b, header, nw_frag);
break;
default:
- nxm_put_8m(b, NXM_NX_IP_FRAG, nw_frag,
- nw_frag_mask & FLOW_NW_FRAG_MASK);
+ nxm_put_8m(b, header, nw_frag, nw_frag_mask & FLOW_NW_FRAG_MASK);
break;
}
}
@@ -516,7 +516,7 @@ nxm_put_ip(struct ofpbuf *b, const struct match *match, enum ofp_version oxm)
&flow->ipv6_dst, &match->wc.masks.ipv6_dst);
}
- nxm_put_frag(b, match);
+ nxm_put_frag(b, match, oxm);
if (match->wc.masks.nw_tos & IP_DSCP_MASK) {
if (oxm) {
@@ -622,14 +622,15 @@ nx_put_raw(struct ofpbuf *b, enum ofp_version oxm, const struct match *match,
/* Metadata. */
if (match->wc.masks.dp_hash) {
if (!oxm) {
- nxm_put_32m(b, NXM_NX_DP_HASH, htonl(flow->dp_hash),
- htonl(match->wc.masks.dp_hash));
+ nxm_put_32m(b, mf_oxm_header(MFF_DP_HASH, oxm),
+ htonl(flow->dp_hash), htonl(match->wc.masks.dp_hash));
}
}
if (match->wc.masks.recirc_id) {
if (!oxm) {
- nxm_put_32(b, NXM_NX_RECIRC_ID, htonl(flow->recirc_id));
+ nxm_put_32(b, mf_oxm_header(MFF_RECIRC_ID, oxm),
+ htonl(flow->recirc_id));
}
}
diff --git a/lib/ofp-actions.c b/lib/ofp-actions.c
index 5df36a2..7322904 100644
--- a/lib/ofp-actions.c
+++ b/lib/ofp-actions.c
@@ -843,7 +843,7 @@ decode_bundle(bool load, const struct nx_action_bundle *nab,
} else if (bundle->algorithm != NX_BD_ALG_HRW
&& bundle->algorithm != NX_BD_ALG_ACTIVE_BACKUP) {
VLOG_WARN_RL(&rl, "unsupported algorithm %d", (int) bundle->algorithm);
- } else if (slave_type != NXM_OF_IN_PORT) {
+ } else if (slave_type != mf_oxm_header(MFF_IN_PORT, 0)) {
VLOG_WARN_RL(&rl, "unsupported slave type %"PRIu16, slave_type);
} else {
error = 0;
@@ -924,7 +924,7 @@ encode_BUNDLE(const struct ofpact_bundle *bundle,
nab->algorithm = htons(bundle->algorithm);
nab->fields = htons(bundle->fields);
nab->basis = htons(bundle->basis);
- nab->slave_type = htonl(NXM_OF_IN_PORT);
+ nab->slave_type = htonl(mf_oxm_header(MFF_IN_PORT, 0));
nab->n_slaves = htons(bundle->n_slaves);
if (bundle->dst.field) {
nab->ofs_nbits = nxm_encode_ofs_nbits(bundle->dst.ofs,
--
1.9.1
More information about the dev
mailing list