From d9cea8f5f341a60f60cd2bf61d0122f3c6715ca1 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Thu, 15 Feb 2018 13:43:41 -0800 Subject: [PATCH] ofp-util: Use consistent naming convention. Most of the tree now uses "encode" as the verb for making an OpenFlow message, so adopt it here in this very old code as well. Signed-off-by: Ben Pfaff Acked-by: Justin Pettit --- include/openvswitch/ofp-util.h | 4 ++-- lib/learning-switch.c | 2 +- lib/ofp-util.c | 4 ++-- lib/rconn.c | 2 +- ofproto/ofproto.c | 2 +- ovn/controller/ofctrl.c | 2 +- ovn/controller/pinctrl.c | 2 +- utilities/ovs-ofctl.c | 4 ++-- 8 files changed, 11 insertions(+), 11 deletions(-) diff --git a/include/openvswitch/ofp-util.h b/include/openvswitch/ofp-util.h index f45877ba2..1f4b23eb5 100644 --- a/include/openvswitch/ofp-util.h +++ b/include/openvswitch/ofp-util.h @@ -31,8 +31,8 @@ bool ofputil_decode_hello(const struct ofp_header *, uint32_t *allowed_versions); struct ofpbuf *ofputil_encode_hello(uint32_t version_bitmap); -struct ofpbuf *make_echo_request(enum ofp_version); -struct ofpbuf *make_echo_reply(const struct ofp_header *); +struct ofpbuf *ofputil_encode_echo_request(enum ofp_version); +struct ofpbuf *ofputil_encode_echo_reply(const struct ofp_header *); struct ofpbuf *ofputil_encode_barrier_request(enum ofp_version); diff --git a/lib/learning-switch.c b/lib/learning-switch.c index db520325c..3a9e015bb 100644 --- a/lib/learning-switch.c +++ b/lib/learning-switch.c @@ -618,7 +618,7 @@ process_packet_in(struct lswitch *sw, const struct ofp_header *oh) static void process_echo_request(struct lswitch *sw, const struct ofp_header *rq) { - queue_tx(sw, make_echo_reply(rq)); + queue_tx(sw, ofputil_encode_echo_reply(rq)); } static ofp_port_t diff --git a/lib/ofp-util.c b/lib/ofp-util.c index df5a9dcb9..c78c856ea 100644 --- a/lib/ofp-util.c +++ b/lib/ofp-util.c @@ -176,7 +176,7 @@ ofputil_encode_hello(uint32_t allowed_versions) /* Creates and returns an OFPT_ECHO_REQUEST message with an empty payload. */ struct ofpbuf * -make_echo_request(enum ofp_version ofp_version) +ofputil_encode_echo_request(enum ofp_version ofp_version) { return ofpraw_alloc_xid(OFPRAW_OFPT_ECHO_REQUEST, ofp_version, htonl(0), 0); @@ -185,7 +185,7 @@ make_echo_request(enum ofp_version ofp_version) /* Creates and returns an OFPT_ECHO_REPLY message matching the * OFPT_ECHO_REQUEST message in 'rq'. */ struct ofpbuf * -make_echo_reply(const struct ofp_header *rq) +ofputil_encode_echo_reply(const struct ofp_header *rq) { struct ofpbuf rq_buf = ofpbuf_const_initializer(rq, ntohs(rq->length)); ofpraw_pull_assert(&rq_buf); diff --git a/lib/rconn.c b/lib/rconn.c index 2eebbff70..3cad259d0 100644 --- a/lib/rconn.c +++ b/lib/rconn.c @@ -581,7 +581,7 @@ run_ACTIVE(struct rconn *rc) * anything.) */ int version = rconn_get_version__(rc); if (version >= 0 && version <= 0xff) { - rconn_send__(rc, make_echo_request(version), NULL); + rconn_send__(rc, ofputil_encode_echo_request(version), NULL); } return; diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c index 0e73d4e82..0819d0de2 100644 --- a/ofproto/ofproto.c +++ b/ofproto/ofproto.c @@ -3193,7 +3193,7 @@ learned_cookies_flush(struct ofproto *ofproto, struct ovs_list *dead_cookies) static enum ofperr handle_echo_request(struct ofconn *ofconn, const struct ofp_header *oh) { - ofconn_send_reply(ofconn, make_echo_reply(oh)); + ofconn_send_reply(ofconn, ofputil_encode_echo_reply(oh)); return 0; } diff --git a/ovn/controller/ofctrl.c b/ovn/controller/ofctrl.c index 293b00f67..8d6d1b6ae 100644 --- a/ovn/controller/ofctrl.c +++ b/ovn/controller/ofctrl.c @@ -607,7 +607,7 @@ static void ofctrl_recv(const struct ofp_header *oh, enum ofptype type) { if (type == OFPTYPE_ECHO_REQUEST) { - queue_msg(make_echo_reply(oh)); + queue_msg(ofputil_encode_echo_reply(oh)); } else if (type == OFPTYPE_ERROR) { static struct vlog_rate_limit rl = VLOG_RATE_LIMIT_INIT(30, 300); log_openflow_rl(&rl, VLL_INFO, oh, "OpenFlow error"); diff --git a/ovn/controller/pinctrl.c b/ovn/controller/pinctrl.c index 95ccd54e4..2a3f7d3f3 100644 --- a/ovn/controller/pinctrl.c +++ b/ovn/controller/pinctrl.c @@ -1034,7 +1034,7 @@ pinctrl_recv(const struct ofp_header *oh, enum ofptype type, struct controller_ctx *ctx) { if (type == OFPTYPE_ECHO_REQUEST) { - queue_msg(make_echo_reply(oh)); + queue_msg(ofputil_encode_echo_reply(oh)); } else if (type == OFPTYPE_GET_CONFIG_REPLY) { /* Enable asynchronous messages */ struct ofputil_switch_config config; diff --git a/utilities/ovs-ofctl.c b/utilities/ovs-ofctl.c index d439677cd..358177ed5 100644 --- a/utilities/ovs-ofctl.c +++ b/utilities/ovs-ofctl.c @@ -2165,7 +2165,7 @@ monitor_vconn(struct vconn *vconn, bool reply_to_echo_requests, if (reply_to_echo_requests) { struct ofpbuf *reply; - reply = make_echo_reply(b->data); + reply = ofputil_encode_echo_reply(b->data); retval = vconn_send_block(vconn, reply); if (retval) { ovs_fatal(retval, "failed to send echo reply"); @@ -2363,7 +2363,7 @@ ofctl_probe(struct ovs_cmdl_context *ctx) struct ofpbuf *reply; open_vconn(ctx->argv[1], &vconn); - request = make_echo_request(vconn_get_version(vconn)); + request = ofputil_encode_echo_request(vconn_get_version(vconn)); run(vconn_transact(vconn, request, &reply), "talking to %s", ctx->argv[1]); if (reply->size != sizeof(struct ofp_header)) { ovs_fatal(0, "reply does not match request");