In preparation for supporting (draft) OpenFlow 1.5 group mod commands enhance the error logging of them.
EXT-350 Signed-off-by: Simon Horman <simon.hor...@netronome.com> --- lib/ofp-util.c | 48 ++++++++++++++++++++++++++++++++++++------------ 1 file changed, 36 insertions(+), 12 deletions(-) diff --git a/lib/ofp-util.c b/lib/ofp-util.c index 1b56bf4..e5a0289 100644 --- a/lib/ofp-util.c +++ b/lib/ofp-util.c @@ -7807,30 +7807,54 @@ err: return b; } +static void +bad_group_cmd(enum ofp15_group_mod_command cmd) { + static const char *cmd_str[] = { "add-group", "mod-group", "del-group", + "insert-bucket", NULL, "remove-bucket" }; + const char *version; + const char *opt_version; + + switch (cmd) { + case OFPGC15_ADD: + case OFPGC15_MODIFY: + case OFPGC15_DELETE: + version = "1.1"; + opt_version = "11"; + break; + + case OFPGC15_INSERT_BUCKET: + case OFPGC15_REMOVE_BUCKET: + version = "1.5"; + opt_version = "15"; + break; + + default: + OVS_NOT_REACHED(); + } + + ovs_fatal(0, "%s needs OpenFlow %s or later (\'-O OpenFlow%s\')", + cmd_str[cmd], version, opt_version); + +} + /* Converts abstract group mod 'gm' into a message for OpenFlow version * 'ofp_version' and returns the message. */ struct ofpbuf * ofputil_encode_group_mod(enum ofp_version ofp_version, const struct ofputil_group_mod *gm) { + switch (ofp_version) { - case OFP10_VERSION: { - if (gm->command == OFPGC11_ADD) { - ovs_fatal(0, "add-group needs OpenFlow 1.1 or later " - "(\'-O OpenFlow11\')"); - } else if (gm->command == OFPGC11_MODIFY) { - ovs_fatal(0, "mod-group needs OpenFlow 1.1 or later " - "(\'-O OpenFlow11\')"); - } else { - ovs_fatal(0, "del-groups needs OpenFlow 1.1 or later " - "(\'-O OpenFlow11\')"); - } - } + case OFP10_VERSION: + bad_group_cmd(gm->command); case OFP11_VERSION: case OFP12_VERSION: case OFP13_VERSION: case OFP14_VERSION: + if (gm->command > OFPGC11_DELETE) { + bad_group_cmd(gm->command); + } return ofputil_encode_ofp11_group_mod(ofp_version, gm); case OFP15_VERSION: -- 2.1.1 _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev