diff options
author | Ben Pfaff <blp@nicira.com> | 2012-06-29 16:35:17 -0700 |
---|---|---|
committer | Ben Pfaff <blp@nicira.com> | 2012-07-12 14:12:57 -0700 |
commit | 5cc63216b1dba9be9ac243d9b47f65d3e23bcab6 (patch) | |
tree | f1d11eb81d5a8a09852d45f7f67c2fe37de26c81 | |
parent | e8fa940e4af32f904ff1958a36f95ad4153eac67 (diff) | |
download | openvswitch-5cc63216b1dba9be9ac243d9b47f65d3e23bcab6.tar.gz |
ofp-util: Make put_stats__() public as ofputil_put_stats_header().
An upcoming commit will introduce a user outside of ofp-util.c.
The change to put_stats_reply__() is larger than strictly necessary to
avoid making really ugly line breaks.
Signed-off-by: Ben Pfaff <blp@nicira.com>
-rw-r--r-- | lib/ofp-util.c | 25 | ||||
-rw-r--r-- | lib/ofp-util.h | 4 |
2 files changed, 18 insertions, 11 deletions
diff --git a/lib/ofp-util.c b/lib/ofp-util.c index 816a50a59..cd261439f 100644 --- a/lib/ofp-util.c +++ b/lib/ofp-util.c @@ -3268,10 +3268,10 @@ update_openflow_length(struct ofpbuf *buffer) oh->length = htons(buffer->size); } -static void -put_stats__(ovs_be32 xid, uint8_t ofp_type, - ovs_be16 ofpst_type, ovs_be32 nxst_subtype, - struct ofpbuf *msg) +void +ofputil_put_stats_header(ovs_be32 xid, uint8_t ofp_type, + ovs_be16 ofpst_type, ovs_be32 nxst_subtype, + struct ofpbuf *msg) { if (ofpst_type == htons(OFPST_VENDOR)) { struct nicira_stats_msg *nsm; @@ -3304,8 +3304,8 @@ ofputil_make_stats_request(size_t openflow_len, uint16_t ofpst_type, struct ofpbuf *msg; msg = *bufferp = ofpbuf_new(openflow_len); - put_stats__(alloc_xid(), OFPT10_STATS_REQUEST, - htons(ofpst_type), htonl(nxst_subtype), msg); + ofputil_put_stats_header(alloc_xid(), OFPT10_STATS_REQUEST, + htons(ofpst_type), htonl(nxst_subtype), msg); ofpbuf_padto(msg, openflow_len); return msg->data; @@ -3314,13 +3314,16 @@ ofputil_make_stats_request(size_t openflow_len, uint16_t ofpst_type, static void put_stats_reply__(const struct ofp_stats_msg *request, struct ofpbuf *msg) { + ovs_be32 nxst_subtype; + assert(request->header.type == OFPT10_STATS_REQUEST || request->header.type == OFPT10_STATS_REPLY); - put_stats__(request->header.xid, OFPT10_STATS_REPLY, request->type, - (request->type != htons(OFPST_VENDOR) - ? htonl(0) - : ((const struct nicira_stats_msg *) request)->subtype), - msg); + + nxst_subtype = (request->type != htons(OFPST_VENDOR) + ? htonl(0) + : ((const struct nicira_stats_msg *) request)->subtype); + ofputil_put_stats_header(request->header.xid, OFPT10_STATS_REPLY, + request->type, nxst_subtype, msg); } /* Creates a statistics reply message with total length 'openflow_len' diff --git a/lib/ofp-util.h b/lib/ofp-util.h index 703de501f..5b1e8edb9 100644 --- a/lib/ofp-util.h +++ b/lib/ofp-util.h @@ -531,6 +531,10 @@ void *ofputil_make_stats_reply(size_t openflow_len, const struct ofp_stats_msg *request, struct ofpbuf **); +void ofputil_put_stats_header(ovs_be32 xid, uint8_t ofp_type, + ovs_be16 ofpst_type, ovs_be32 nxst_subtype, + struct ofpbuf *); + void ofputil_start_stats_reply(const struct ofp_stats_msg *request, struct list *); struct ofpbuf *ofputil_reserve_stats_reply(size_t len, struct list *); |