- struct netdev *netdev;
- struct svec dev_list;
- size_t i;
-
- netdev_enumerate(&dev_list);
- for (i = 0; i < dev_list.n; i++) {
- const char *name = dev_list.names[i];
- struct in_addr dev_in4;
-
- if (!netdev_open(name, NETDEV_ETH_TYPE_NONE, &netdev)
- && !netdev_get_in4(netdev, &dev_in4, NULL)
- && dev_in4.s_addr == in4->s_addr) {
- goto exit;
+ struct netdev_qos_capabilities caps;
+ int retval;
+
+ retval = netdev_get_qos_capabilities(netdev, type, &caps);
+ *n_queuesp = caps.n_queues;
+ return retval;
+}
+
+/* Queries 'netdev' about its currently configured form of QoS. If successful,
+ * stores the name of the current form of QoS into '*typep', stores any details
+ * of configuration as string key-value pairs in 'details', and returns 0. On
+ * failure, sets '*typep' to NULL and returns a positive errno value.
+ *
+ * A '*typep' of "" indicates that QoS is currently disabled on 'netdev'.
+ *
+ * The caller must initialize 'details' as an empty shash (e.g. with
+ * shash_init()) before calling this function. The caller must free 'details',
+ * including 'data' members, when it is no longer needed (e.g. with
+ * shash_destroy_free_data()).
+ *
+ * The caller must not modify or free '*typep'.
+ *
+ * '*typep' will be one of the types returned by netdev_get_qos_types() for
+ * 'netdev'. The contents of 'details' should be documented as valid for
+ * '*typep' in the "other_config" column in the "QoS" table in
+ * vswitchd/vswitch.xml (which is built as ovs-vswitchd.conf.db(8)). */
+int
+netdev_get_qos(const struct netdev *netdev,
+ const char **typep, struct shash *details)
+{
+ const struct netdev_class *class = netdev_get_dev(netdev)->netdev_class;
+ int retval;
+
+ if (class->get_qos) {
+ retval = class->get_qos(netdev, typep, details);
+ if (retval) {
+ *typep = NULL;
+ shash_clear_free_data(details);