[ovs-dev] [PATCH 05/24] ofp-util: Allow decoder to use OFPT11_STATS_{REQUEST, REPLY} for OpenFlow 1.2
Ben Pfaff
blp at nicira.com
Tue Jul 24 20:29:03 UTC 2012
On Mon, Jul 23, 2012 at 03:16:34PM +0900, Simon Horman wrote:
> As the structures uses for encoding and decoding statistics request and
> reply messages are largely the same between OpenFlow 1.1 and 1.2 it seems
> to make sense to use OFPT11_STATS_{REQUEST,REPLY} for OpenFlow 1.2.
>
> This patch prepares the decode path.
>
> Signed-off-by: Simon Horman <horms at verge.net.au>
You're right, this doesn't need to be limited to OF1.1.
I don't expect that future OpenFlow versions will mess with this
numbering again, so I decided to fold the following into the first
patch of my of1.1 series instead:
diff --git a/lib/ofp-msgs.c b/lib/ofp-msgs.c
index 479f768..1d11e7f 100644
--- a/lib/ofp-msgs.c
+++ b/lib/ofp-msgs.c
@@ -207,7 +207,7 @@ ofphdrs_decode(struct ofphdrs *hdrs,
return OFPERR_OFPBRC_BAD_VENDOR;
}
}
- } else if (hdrs->version == OFP11_VERSION
+ } else if (hdrs->version != OFP10_VERSION
&& (hdrs->type == OFPT11_STATS_REQUEST ||
hdrs->type == OFPT11_STATS_REPLY)) {
const struct ofp11_stats_msg *osm;
@@ -280,7 +280,7 @@ ofphdrs_len(const struct ofphdrs *hdrs)
? sizeof(struct nicira10_stats_msg)
: sizeof(struct ofp_stats_msg));
}
- } else if (hdrs->version == OFP11_VERSION) {
+ } else {
if (hdrs->type == OFPT11_STATS_REQUEST ||
hdrs->type == OFPT11_STATS_REPLY) {
return (hdrs->stat == OFPST_VENDOR
@@ -637,7 +637,7 @@ ofpraw_put__(enum ofpraw raw, uint8_t version, ovs_be32 xid,
NOT_REACHED();
}
}
- } else if (version == OFP11_VERSION
+ } else if (version != OFP10_VERSION
&& (hdrs->type == OFPT11_STATS_REQUEST ||
hdrs->type == OFPT11_STATS_REPLY)) {
struct ofp11_stats_msg *osm = buf->l2;
More information about the dev
mailing list