}
static int
-dpif_linux_enumerate(struct sset *all_dps)
+dpif_linux_enumerate(struct sset *all_dps,
+ const struct dpif_class *dpif_class OVS_UNUSED)
{
struct nl_dump dump;
uint64_t reply_stub[NL_DUMP_BUFSIZE / 8];
}
static int
-dpif_netdev_enumerate(struct sset *all_dps)
+dpif_netdev_enumerate(struct sset *all_dps,
+ const struct dpif_class *dpif_class)
{
struct shash_node *node;
ovs_mutex_lock(&dp_netdev_mutex);
SHASH_FOR_EACH(node, &dp_netdevs) {
+ struct dp_netdev *dp = node->data;
+ if (dpif_class != dp->class) {
+ /* 'dp_netdevs' contains both "netdev" and "dummy" dpifs.
+ * If the class doesn't match, skip this dpif. */
+ continue;
+ }
sset_add(all_dps, node->name);
}
ovs_mutex_unlock(&dp_netdev_mutex);
* the type assumed if no type is specified when opening a dpif. */
const char *type;
- /* Enumerates the names of all known created datapaths, if possible, into
- * 'all_dps'. The caller has already initialized 'all_dps' and other dpif
- * classes might already have added names to it.
+ /* Enumerates the names of all known created datapaths (of class
+ * 'dpif_class'), if possible, into 'all_dps'. The caller has already
+ * initialized 'all_dps' and other dpif classes might already have added
+ * names to it.
*
* This is used by the vswitch at startup, so that it can delete any
* datapaths that are not configured.
*
* Some kinds of datapaths might not be practically enumerable, in which
* case this function may be a null pointer. */
- int (*enumerate)(struct sset *all_dps);
+ int (*enumerate)(struct sset *all_dps, const struct dpif_class *dpif_class);
/* Returns the type to pass to netdev_open() when a dpif of class
* 'dpif_class' has a port of type 'type', for a few special cases
}
dpif_class = registered_class->dpif_class;
- error = dpif_class->enumerate ? dpif_class->enumerate(names) : 0;
+ error = (dpif_class->enumerate
+ ? dpif_class->enumerate(names, dpif_class)
+ : 0);
if (error) {
VLOG_WARN("failed to enumerate %s datapaths: %s", dpif_class->type,
ovs_strerror(error));