diff options
author | Ian Stokes <ian.stokes@intel.com> | 2016-03-18 17:14:16 +0000 |
---|---|---|
committer | Ben Pfaff <blp@ovn.org> | 2016-03-22 11:03:16 -0700 |
commit | 3d657a0aacd0027d6878cd97b549ab9848a1dd2c (patch) | |
tree | ecb07173328c4455357a9eb955e4a46396b9a505 /vswitchd/bridge.c | |
parent | c3b76f3ed19226557ffbf4fdbcea4c6e888ac1d7 (diff) | |
download | openvswitch-3d657a0aacd0027d6878cd97b549ab9848a1dd2c.tar.gz |
bridge: Dump configurable QoS types.
This commit adds a new command 'qos/show-types' for use with appctl.
This allows a user to query the types of QoS which are configurable via
Open vSwitch on a given interface.
Signed-off-by: Ian Stokes <ian.stokes@intel.com>
[blp@ovn.org made style and message changes]
Signed-off-by: Ben Pfaff <blp@ovn.org>
Diffstat (limited to 'vswitchd/bridge.c')
-rw-r--r-- | vswitchd/bridge.c | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/vswitchd/bridge.c b/vswitchd/bridge.c index 8d66c1d10..d6c360020 100644 --- a/vswitchd/bridge.c +++ b/vswitchd/bridge.c @@ -269,6 +269,7 @@ static bool bridge_has_bond_fake_iface(const struct bridge *, const char *name); static bool port_is_bond_fake_iface(const struct port *); +static unixctl_cb_func qos_unixctl_show_types; static unixctl_cb_func qos_unixctl_show; static struct port *port_create(struct bridge *, const struct ovsrec_port *); @@ -476,6 +477,8 @@ bridge_init(const char *remote) ovsdb_idl_omit(idl, &ovsrec_ssl_col_external_ids); /* Register unixctl commands. */ + unixctl_command_register("qos/show-types", "interface", 1, 1, + qos_unixctl_show_types, NULL); unixctl_command_register("qos/show", "interface", 1, 1, qos_unixctl_show, NULL); unixctl_command_register("bridge/dump-flows", "bridge", 1, 1, @@ -3122,6 +3125,44 @@ qos_unixctl_show_queue(unsigned int queue_id, } static void +qos_unixctl_show_types(struct unixctl_conn *conn, int argc OVS_UNUSED, + const char *argv[], void *aux OVS_UNUSED) +{ + struct ds ds = DS_EMPTY_INITIALIZER; + struct sset types = SSET_INITIALIZER(&types); + struct iface *iface; + const char * types_name; + int error; + + iface = iface_find(argv[1]); + if (!iface) { + unixctl_command_reply_error(conn, "no such interface"); + return; + } + + error = netdev_get_qos_types(iface->netdev, &types); + if (!error) { + if (!sset_is_empty(&types)) { + SSET_FOR_EACH (types_name, &types) { + ds_put_format(&ds, "QoS type: %s\n", types_name); + } + unixctl_command_reply(conn, ds_cstr(&ds)); + } else { + ds_put_format(&ds, "No QoS types supported for interface: %s\n", + iface->name); + unixctl_command_reply(conn, ds_cstr(&ds)); + } + } else { + ds_put_format(&ds, "%s: failed to retrieve supported QoS types (%s)", + iface->name, ovs_strerror(error)); + unixctl_command_reply_error(conn, ds_cstr(&ds)); + } + + sset_destroy(&types); + ds_destroy(&ds); +} + +static void qos_unixctl_show(struct unixctl_conn *conn, int argc OVS_UNUSED, const char *argv[], void *aux OVS_UNUSED) { |