[ovs-dev] [PATCH 22/41] ofp-util: New function ofputil_async_msg_type_to_string().
Jarno Rajahalme
jarno at ovn.org
Tue Jan 19 23:17:17 UTC 2016
Acked-by: Jarno Rajahalme <jarno at ovn.org>
> On Jan 18, 2016, at 11:27 PM, Ben Pfaff <blp at ovn.org> wrote:
>
> An upcoming commit will add another user.
>
> Signed-off-by: Ben Pfaff <blp at ovn.org>
> ---
> lib/ofp-print.c | 27 ++-------------------------
> lib/ofp-util.c | 17 +++++++++++++++++
> lib/ofp-util.h | 1 +
> 3 files changed, 20 insertions(+), 25 deletions(-)
>
> diff --git a/lib/ofp-print.c b/lib/ofp-print.c
> index 42e822b..bf97b04 100644
> --- a/lib/ofp-print.c
> +++ b/lib/ofp-print.c
> @@ -2151,31 +2151,8 @@ ofp_print_nxt_set_async_config(struct ds *string,
>
> ds_put_format(string, "\n %s:\n", i == 0 ? "master" : "slave");
> for (type = 0; type < OAM_N_TYPES; type++) {
> - switch (type) {
> - case OAM_PACKET_IN:
> - ds_put_cstr(string, " PACKET_IN:");
> - break;
> -
> - case OAM_PORT_STATUS:
> - ds_put_cstr(string, " PORT_STATUS:");
> - break;
> -
> - case OAM_FLOW_REMOVED:
> - ds_put_cstr(string, " FLOW_REMOVED:");
> - break;
> -
> - case OAM_ROLE_STATUS:
> - ds_put_cstr(string, " ROLE_STATUS:");
> - break;
> -
> - case OAM_TABLE_STATUS:
> - ds_put_cstr(string, " TABLE_STATUS:");
> - break;
> -
> - case OAM_REQUESTFORWARD:
> - ds_put_cstr(string, " REQUESTFORWARD:");
> - break;
> - }
> + ds_put_format(string, "%16s:",
> + ofputil_async_msg_type_to_string(type));
>
> for (j = 0; j < 32; j++) {
> if (role[i][type] & (1u << j)) {
> diff --git a/lib/ofp-util.c b/lib/ofp-util.c
> index 6f9aeb7..722f033 100644
> --- a/lib/ofp-util.c
> +++ b/lib/ofp-util.c
> @@ -9467,6 +9467,23 @@ ofputil_uninit_tlv_table(struct ovs_list *mappings)
> }
> }
>
> +const char *
> +ofputil_async_msg_type_to_string(enum ofputil_async_msg_type type)
> +{
> + switch (type) {
> + case OAM_PACKET_IN: return "PACKET_IN";
> + case OAM_PORT_STATUS: return "PORT_STATUS";
> + case OAM_FLOW_REMOVED: return "FLOW_REMOVED";
> + case OAM_ROLE_STATUS: return "ROLE_STATUS";
> + case OAM_TABLE_STATUS: return "TABLE_STATUS";
> + case OAM_REQUESTFORWARD: return "REQUESTFORWARD";
> +
> + case OAM_N_TYPES:
> + default:
> + OVS_NOT_REACHED();
> + }
> +}
> +
> /* Decodes the OpenFlow "set async config" request and "get async config
> * reply" message in '*oh' into an abstract form in 'master' and 'slave'.
> *
> diff --git a/lib/ofp-util.h b/lib/ofp-util.h
> index 89f3d95..1fd013d 100644
> --- a/lib/ofp-util.h
> +++ b/lib/ofp-util.h
> @@ -1323,6 +1323,7 @@ enum ofputil_async_msg_type {
> OAM_REQUESTFORWARD, /* OFPT_REQUESTFORWARD. */
> OAM_N_TYPES
> };
> +const char *ofputil_async_msg_type_to_string(enum ofputil_async_msg_type);
>
> enum ofperr ofputil_decode_set_async_config(const struct ofp_header *,
> uint32_t master[OAM_N_TYPES],
> --
> 2.1.3
>
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev
More information about the dev
mailing list