diff options
author | Damjan Marion <damarion@cisco.com> | 2017-05-08 18:19:45 +0200 |
---|---|---|
committer | Chris Luke <chris_luke@comcast.com> | 2017-05-08 20:29:40 +0000 |
commit | 1ea82dfe5dabb0f9bbfa5ba953ef31328c987b89 (patch) | |
tree | bfdab60f531e58813b71691cb0f8ca20d59247c9 /src/plugins/dpdk | |
parent | 3c785e09a039a20517dd9aab9c32d121a19f9d38 (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')
-rw-r--r-- | src/plugins/dpdk/device/dpdk.h | 1 | ||||
-rw-r--r-- | src/plugins/dpdk/device/format.c | 4 | ||||
-rwxr-xr-x | src/plugins/dpdk/device/init.c | 27 |
3 files changed, 13 insertions, 19 deletions
diff --git a/src/plugins/dpdk/device/dpdk.h b/src/plugins/dpdk/device/dpdk.h index 53f79ff2..8dbc0915 100644 --- a/src/plugins/dpdk/device/dpdk.h +++ b/src/plugins/dpdk/device/dpdk.h @@ -108,6 +108,7 @@ typedef enum { VNET_DPDK_PORT_TYPE_ETH_1G, VNET_DPDK_PORT_TYPE_ETH_10G, + VNET_DPDK_PORT_TYPE_ETH_25G, VNET_DPDK_PORT_TYPE_ETH_40G, VNET_DPDK_PORT_TYPE_ETH_100G, VNET_DPDK_PORT_TYPE_ETH_BOND, diff --git a/src/plugins/dpdk/device/format.c b/src/plugins/dpdk/device/format.c index 93eca524..389cd8b6 100644 --- a/src/plugins/dpdk/device/format.c +++ b/src/plugins/dpdk/device/format.c @@ -168,6 +168,10 @@ format_dpdk_device_name (u8 * s, va_list * args) device_name = "TenGigabitEthernet"; break; + case VNET_DPDK_PORT_TYPE_ETH_25G: + device_name = "TwentyFiveGigabitEthernet"; + break; + case VNET_DPDK_PORT_TYPE_ETH_40G: device_name = "FortyGigabitEthernet"; break; diff --git a/src/plugins/dpdk/device/init.c b/src/plugins/dpdk/device/init.c index 2d21bfd9..c45edc9b 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: |