2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 14:25:26 +00:00

Add functions to determine how port should be opened based on type.

Depending on the port and type of datapath, a port may need to be opened
as a different type of device than it's configured.  For example, an
"internal" port on a "dummy" datapath should opened as a "dummy" port.
This commit adds the ability for a dpif to provide this information to a
caller.  It will be used in a future commit.

Signed-off-by: Justin Pettit <jpettit@nicira.com>
This commit is contained in:
Justin Pettit
2012-11-14 15:50:20 -08:00
parent 78a2d59c1c
commit 0aeaabc8db
9 changed files with 85 additions and 3 deletions

View File

@@ -417,6 +417,23 @@ dpif_get_dp_stats(const struct dpif *dpif, struct dpif_dp_stats *stats)
return error;
}
const char *
dpif_port_open_type(const char *datapath_type, const char *port_type)
{
struct registered_dpif_class *registered_class;
datapath_type = dpif_normalize_type(datapath_type);
registered_class = shash_find_data(&dpif_classes, datapath_type);
if (!registered_class
|| !registered_class->dpif_class->port_open_type) {
return port_type;
}
return registered_class->dpif_class->port_open_type(
registered_class->dpif_class, port_type);
}
/* Attempts to add 'netdev' as a port on 'dpif'. If 'port_nop' is
* non-null and its value is not UINT32_MAX, then attempts to use the
* value as the port number.