summaryrefslogtreecommitdiffstats
path: root/src/plugins/dpdk/device/init.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/dpdk/device/init.c')
-rw-r--r--src/plugins/dpdk/device/init.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/plugins/dpdk/device/init.c b/src/plugins/dpdk/device/init.c
index 086d322db18..dd2b405d7db 100644
--- a/src/plugins/dpdk/device/init.c
+++ b/src/plugins/dpdk/device/init.c
@@ -74,6 +74,35 @@ port_type_from_speed_capa (struct rte_eth_dev_info *dev_info)
return VNET_DPDK_PORT_TYPE_UNKNOWN;
}
+static dpdk_port_type_t
+port_type_from_link_speed (u32 link_speed)
+{
+ switch (link_speed)
+ {
+ case ETH_SPEED_NUM_1G:
+ return VNET_DPDK_PORT_TYPE_ETH_1G;
+ case ETH_SPEED_NUM_2_5G:
+ return VNET_DPDK_PORT_TYPE_ETH_2_5G;
+ case ETH_SPEED_NUM_5G:
+ return VNET_DPDK_PORT_TYPE_ETH_5G;
+ case ETH_SPEED_NUM_10G:
+ return VNET_DPDK_PORT_TYPE_ETH_10G;
+ case ETH_SPEED_NUM_20G:
+ return VNET_DPDK_PORT_TYPE_ETH_20G;
+ case ETH_SPEED_NUM_25G:
+ return VNET_DPDK_PORT_TYPE_ETH_25G;
+ case ETH_SPEED_NUM_40G:
+ return VNET_DPDK_PORT_TYPE_ETH_40G;
+ case ETH_SPEED_NUM_50G:
+ return VNET_DPDK_PORT_TYPE_ETH_50G;
+ case ETH_SPEED_NUM_56G:
+ return VNET_DPDK_PORT_TYPE_ETH_56G;
+ case ETH_SPEED_NUM_100G:
+ return VNET_DPDK_PORT_TYPE_ETH_100G;
+ default:
+ return VNET_DPDK_PORT_TYPE_UNKNOWN;
+ }
+}
static u32
dpdk_flag_change (vnet_main_t * vnm, vnet_hw_interface_t * hi, u32 flags)
@@ -548,6 +577,10 @@ dpdk_lib_init (dpdk_main_t * dm)
xd->port_conf.intr_conf.lsc = 1;
break;
+ case VNET_DPDK_PMD_NETVSC:
+ xd->port_type = port_type_from_link_speed (l.link_speed);
+ break;
+
default:
xd->port_type = VNET_DPDK_PORT_TYPE_UNKNOWN;
}