diff options
author | Ben Pfaff <blp@ovn.org> | 2018-02-15 14:38:28 -0800 |
---|---|---|
committer | Ben Pfaff <blp@ovn.org> | 2018-03-14 11:29:19 -0700 |
commit | 225c33ba64a4de1aa30b05f8549c0628fe7fe6e3 (patch) | |
tree | 1822c7bcd2e3421e5f819ecc25f5fd8e9a605fbf /lib/ofp-print.c | |
parent | 62bba609351a8c71319f80a59731a3810c873d27 (diff) | |
download | openvswitch-225c33ba64a4de1aa30b05f8549c0628fe7fe6e3.tar.gz |
ofp-protocol: Better abstract changing the protocol used for flow matches.
The previous interface here required the client to understand, to some
extent, the low-level NXFF_* values and the encoding format for the
NXT_SET_FLOW_FORMAT and NXT_SET_FLOW_MOD_TABLE_ID messages. This commit
changes the interface so that the client only has to understand the
ofputil_protocol type used elsewhere and none of the encoding otherwise.
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Justin Pettit <jpettit@ovn.org>
Diffstat (limited to 'lib/ofp-print.c')
-rw-r--r-- | lib/ofp-print.c | 27 |
1 files changed, 11 insertions, 16 deletions
diff --git a/lib/ofp-print.c b/lib/ofp-print.c index 2f96b1863..b13bc3803 100644 --- a/lib/ofp-print.c +++ b/lib/ofp-print.c @@ -2267,26 +2267,21 @@ ofp_print_role_status_message(struct ds *string, const struct ofp_header *oh) } static enum ofperr -ofp_print_nxt_flow_mod_table_id(struct ds *string, - const struct nx_flow_mod_table_id *nfmti) +ofp_print_nxt_flow_mod_table_id(struct ds *string, const struct ofp_header *oh) { - ds_put_format(string, " %s", nfmti->set ? "enable" : "disable"); + bool enable = ofputil_decode_nx_flow_mod_table_id(oh); + ds_put_format(string, " %s", enable ? "enable" : "disable"); return 0; } static enum ofperr -ofp_print_nxt_set_flow_format(struct ds *string, - const struct nx_set_flow_format *nsff) +ofp_print_nxt_set_flow_format(struct ds *string, const struct ofp_header *oh) { - uint32_t format = ntohl(nsff->format); - - ds_put_cstr(string, " format="); - if (ofputil_nx_flow_format_is_valid(format)) { - ds_put_cstr(string, ofputil_nx_flow_format_to_string(format)); - } else { - ds_put_format(string, "%"PRIu32, format); - } - + enum ofputil_protocol p = ofputil_decode_nx_set_flow_format(oh); + ds_put_format(string, " format=%s", + p == OFPUTIL_P_OF10_STD ? "openflow10" + : p == OFPUTIL_P_OF10_NXM ? "nxm" + : "(unknown)"); return 0; } @@ -3732,10 +3727,10 @@ ofp_to_string__(const struct ofp_header *oh, return ofp_print_ofpst_port_desc_reply(string, oh); case OFPTYPE_FLOW_MOD_TABLE_ID: - return ofp_print_nxt_flow_mod_table_id(string, ofpmsg_body(oh)); + return ofp_print_nxt_flow_mod_table_id(string, oh); case OFPTYPE_SET_FLOW_FORMAT: - return ofp_print_nxt_set_flow_format(string, ofpmsg_body(oh)); + return ofp_print_nxt_set_flow_format(string, oh); case OFPTYPE_SET_PACKET_IN_FORMAT: return ofp_print_nxt_set_packet_in_format(string, ofpmsg_body(oh)); |