2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 06:15:47 +00:00

netdev-vport: Build on all platforms.

This patch removes the final bit of linux specific code which
prevents building netdev-vport everywhere.  With this, other
platforms automatically get access to patch ports, and (if their
datapath supports it), flow based tunneling.

Signed-off-by: Ethan Jackson <ethan@nicira.com>
This commit is contained in:
Ethan Jackson
2013-01-25 13:30:40 -08:00
parent 0f5383787d
commit c060c4cf83
9 changed files with 118 additions and 104 deletions

View File

@@ -455,6 +455,28 @@ get_vport_type(const struct dpif_linux_vport *vport)
return "unknown";
}
static enum ovs_vport_type
netdev_to_ovs_vport_type(const struct netdev *netdev)
{
const char *type = netdev_get_type(netdev);
if (!strcmp(type, "tap") || !strcmp(type, "system")) {
return OVS_VPORT_TYPE_NETDEV;
} else if (!strcmp(type, "internal")) {
return OVS_VPORT_TYPE_INTERNAL;
} else if (strstr(type, "gre64")) {
return OVS_VPORT_TYPE_GRE64;
} else if (strstr(type, "gre")) {
return OVS_VPORT_TYPE_GRE;
} else if (!strcmp(type, "capwap")) {
return OVS_VPORT_TYPE_CAPWAP;
} else if (!strcmp(type, "vxlan")) {
return OVS_VPORT_TYPE_VXLAN;
} else {
return OVS_VPORT_TYPE_UNSPEC;
}
}
static int
dpif_linux_port_add(struct dpif *dpif_, struct netdev *netdev,
uint32_t *port_nop)
@@ -478,7 +500,7 @@ dpif_linux_port_add(struct dpif *dpif_, struct netdev *netdev,
dpif_linux_vport_init(&request);
request.cmd = OVS_VPORT_CMD_NEW;
request.dp_ifindex = dpif->dp_ifindex;
request.type = netdev_vport_get_vport_type(netdev);
request.type = netdev_to_ovs_vport_type(netdev);
if (request.type == OVS_VPORT_TYPE_UNSPEC) {
VLOG_WARN_RL(&error_rl, "%s: cannot create port `%s' because it has "
"unsupported type `%s'",