Signed-off-by: Simon Horman <ho...@verge.net.au> ---
v4 * Initial post --- lib/ofp-util.c | 20 +++++++++++++++++--- lib/ofp-util.h | 2 +- lib/vconn.c | 2 +- utilities/ovs-ofctl.c | 2 +- 4 files changed, 20 insertions(+), 6 deletions(-) diff --git a/lib/ofp-util.c b/lib/ofp-util.c index 69fa0e2..1efa466 100644 --- a/lib/ofp-util.c +++ b/lib/ofp-util.c @@ -3508,12 +3508,26 @@ make_echo_reply(const struct ofp_header *rq) } struct ofpbuf * -ofputil_encode_barrier_request(void) +ofputil_encode_barrier_request(uint8_t ofp_version) { struct ofpbuf *msg; + uint8_t ofp_type; + + switch (ofp_version) { + case OFP12_VERSION: + case OFP11_VERSION: + ofp_type = OFPT11_BARRIER_REQUEST; + break; + + case OFP10_VERSION: + ofp_type = OFPT10_BARRIER_REQUEST; + break; + + default: + NOT_REACHED(); + } - make_openflow(sizeof(struct ofp_header), OFP10_VERSION, - OFPT10_BARRIER_REQUEST, &msg); + make_openflow(sizeof(struct ofp_header), ofp_version, ofp_type, &msg); return msg; } diff --git a/lib/ofp-util.h b/lib/ofp-util.h index b171cf0..a1a5150 100644 --- a/lib/ofp-util.h +++ b/lib/ofp-util.h @@ -573,7 +573,7 @@ uint16_t ofputil_decode_stats_msg_flags(const struct ofp_header *); struct ofpbuf *make_echo_request(void); struct ofpbuf *make_echo_reply(const struct ofp_header *rq); -struct ofpbuf *ofputil_encode_barrier_request(void); +struct ofpbuf *ofputil_encode_barrier_request(uint8_t ofp_version); const char *ofputil_frag_handling_to_string(enum ofp_config_flags); bool ofputil_frag_handling_from_string(const char *, enum ofp_config_flags *); diff --git a/lib/vconn.c b/lib/vconn.c index 676c4d3..ae6c8a2 100644 --- a/lib/vconn.c +++ b/lib/vconn.c @@ -744,7 +744,7 @@ vconn_transact_noreply(struct vconn *vconn, struct ofpbuf *request, } /* Send barrier. */ - barrier = ofputil_encode_barrier_request(); + barrier = ofputil_encode_barrier_request(vconn_get_version(vconn)); barrier_xid = ((struct ofp_header *) barrier->data)->xid; error = vconn_send_block(vconn, barrier); if (error) { diff --git a/utilities/ovs-ofctl.c b/utilities/ovs-ofctl.c index 3cbacda..ea58263 100644 --- a/utilities/ovs-ofctl.c +++ b/utilities/ovs-ofctl.c @@ -1050,7 +1050,7 @@ ofctl_barrier(struct unixctl_conn *conn, int argc OVS_UNUSED, return; } - msg = ofputil_encode_barrier_request(); + msg = ofputil_encode_barrier_request(vconn_get_version(aux->vconn)); error = vconn_send_block(aux->vconn, msg); if (error) { ofpbuf_delete(msg); -- 1.7.10.2.484.gcd07cc5 _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev