summaryrefslogtreecommitdiffstats
path: root/src/plugins/dpdk/device/init.c
diff options
context:
space:
mode:
authorDamjan Marion <damarion@cisco.com>2017-05-08 18:19:45 +0200
committerChris Luke <chris_luke@comcast.com>2017-05-08 20:29:40 +0000
commit1ea82dfe5dabb0f9bbfa5ba953ef31328c987b89 (patch)
treebfdab60f531e58813b71691cb0f8ca20d59247c9 /src/plugins/dpdk/device/init.c
parent3c785e09a039a20517dd9aab9c32d121a19f9d38 (diff)
dpdk: use speed_capa to detect i40e device speed
Change-Id: I1decca6fb5ce6de74ccbcd5a262ebd3db6f55cdc Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/plugins/dpdk/device/init.c')
-rwxr-xr-xsrc/plugins/dpdk/device/init.c27
1 files changed, 8 insertions, 19 deletions
diff --git a/src/plugins/dpdk/device/init.c b/src/plugins/dpdk/device/init.c
index 2d21bfd91ca..c45edc9ba63 100755
--- a/src/plugins/dpdk/device/init.c
+++ b/src/plugins/dpdk/device/init.c
@@ -444,25 +444,14 @@ dpdk_lib_init (dpdk_main_t * dm)
xd->flags |= DPDK_DEVICE_FLAG_PMD_SUPPORTS_PTYPE;
xd->port_type = VNET_DPDK_PORT_TYPE_ETH_40G;
- switch (dev_info.pci_dev->id.device_id)
- {
- case I40E_DEV_ID_10G_BASE_T:
- case I40E_DEV_ID_SFP_XL710:
- xd->port_type = VNET_DPDK_PORT_TYPE_ETH_10G;
- break;
- case I40E_DEV_ID_QSFP_A:
- case I40E_DEV_ID_QSFP_B:
- case I40E_DEV_ID_QSFP_C:
- xd->port_type = VNET_DPDK_PORT_TYPE_ETH_40G;
- break;
- case I40E_DEV_ID_VF:
- rte_eth_link_get_nowait (i, &l);
- xd->port_type = l.link_speed == 10000 ?
- VNET_DPDK_PORT_TYPE_ETH_10G : VNET_DPDK_PORT_TYPE_ETH_40G;
- break;
- default:
- xd->port_type = VNET_DPDK_PORT_TYPE_UNKNOWN;
- }
+ if (dev_info.speed_capa & ETH_LINK_SPEED_40G)
+ xd->port_type = VNET_DPDK_PORT_TYPE_ETH_40G;
+ else if (dev_info.speed_capa & ETH_LINK_SPEED_25G)
+ xd->port_type = VNET_DPDK_PORT_TYPE_ETH_25G;
+ else if (dev_info.speed_capa & ETH_LINK_SPEED_10G)
+ xd->port_type = VNET_DPDK_PORT_TYPE_ETH_10G;
+ else
+ xd->port_type = VNET_DPDK_PORT_TYPE_UNKNOWN;
break;
case VNET_DPDK_PMD_CXGBE: