diff options
author | Lee Roberts <lee.roberts@hpe.com> | 2018-03-07 20:18:48 -0700 |
---|---|---|
committer | Damjan Marion <dmarion.lists@gmail.com> | 2018-03-09 19:46:27 +0000 |
commit | 03f47f1e738051db1412a93c2b90a7426f81f648 (patch) | |
tree | e795043ed30adef8c3a17495b0c6a9d88f9bdb94 | |
parent | 45a09462ad4f64251d1302fb6fdca5cfef1d2f24 (diff) |
Coordinate known Ethernet speeds with Linux kernel and DPDK
Linux kernel and DPDK recognize the following Ethernet speeds:
10M, 100M, 1G, 2.5G, 5G, 10G, 20G, 25G, 40G, 50G, 56G and 100G.
Add consistent Ethernet speeds to VPP.
Change-Id: I4cfcf378fb34425c1206db5aa2f6bdcc66e0a6ab
Signed-off-by: Lee Roberts <lee.roberts@hpe.com>
-rw-r--r-- | src/plugins/dpdk/device/dpdk.h | 4 | ||||
-rw-r--r-- | src/plugins/dpdk/device/format.c | 16 | ||||
-rwxr-xr-x | src/plugins/dpdk/device/init.c | 23 | ||||
-rw-r--r-- | src/vnet/interface.h | 22 | ||||
-rw-r--r-- | src/vpp/api/test_client.c | 18 |
5 files changed, 77 insertions, 6 deletions
diff --git a/src/plugins/dpdk/device/dpdk.h b/src/plugins/dpdk/device/dpdk.h index 4f4a2e590b2..1f43a484224 100644 --- a/src/plugins/dpdk/device/dpdk.h +++ b/src/plugins/dpdk/device/dpdk.h @@ -92,10 +92,14 @@ typedef enum typedef enum { VNET_DPDK_PORT_TYPE_ETH_1G, + VNET_DPDK_PORT_TYPE_ETH_2_5G, + VNET_DPDK_PORT_TYPE_ETH_5G, VNET_DPDK_PORT_TYPE_ETH_10G, + VNET_DPDK_PORT_TYPE_ETH_20G, VNET_DPDK_PORT_TYPE_ETH_25G, VNET_DPDK_PORT_TYPE_ETH_40G, VNET_DPDK_PORT_TYPE_ETH_50G, + VNET_DPDK_PORT_TYPE_ETH_56G, VNET_DPDK_PORT_TYPE_ETH_100G, VNET_DPDK_PORT_TYPE_ETH_BOND, VNET_DPDK_PORT_TYPE_ETH_SWITCH, diff --git a/src/plugins/dpdk/device/format.c b/src/plugins/dpdk/device/format.c index d661fa72f1c..36f921d598b 100644 --- a/src/plugins/dpdk/device/format.c +++ b/src/plugins/dpdk/device/format.c @@ -176,10 +176,22 @@ format_dpdk_device_name (u8 * s, va_list * args) device_name = "GigabitEthernet"; break; + case VNET_DPDK_PORT_TYPE_ETH_2_5G: + device_name = "Two_FiveGigabitEthernet"; + break; + + case VNET_DPDK_PORT_TYPE_ETH_5G: + device_name = "FiveGigabitEthernet"; + break; + case VNET_DPDK_PORT_TYPE_ETH_10G: device_name = "TenGigabitEthernet"; break; + case VNET_DPDK_PORT_TYPE_ETH_20G: + device_name = "TwentyGigabitEthernet"; + break; + case VNET_DPDK_PORT_TYPE_ETH_25G: device_name = "TwentyFiveGigabitEthernet"; break; @@ -192,6 +204,10 @@ format_dpdk_device_name (u8 * s, va_list * args) device_name = "FiftyGigabitEthernet"; break; + case VNET_DPDK_PORT_TYPE_ETH_56G: + device_name = "FiftySixGigabitEthernet"; + break; + case VNET_DPDK_PORT_TYPE_ETH_100G: device_name = "HundredGigabitEthernet"; break; diff --git a/src/plugins/dpdk/device/init.c b/src/plugins/dpdk/device/init.c index 95c5e5ccae8..a425c585dad 100755 --- a/src/plugins/dpdk/device/init.c +++ b/src/plugins/dpdk/device/init.c @@ -62,14 +62,22 @@ port_type_from_speed_capa (struct rte_eth_dev_info *dev_info) if (dev_info->speed_capa & ETH_LINK_SPEED_100G) return VNET_DPDK_PORT_TYPE_ETH_100G; + else if (dev_info->speed_capa & ETH_LINK_SPEED_56G) + return VNET_DPDK_PORT_TYPE_ETH_56G; else if (dev_info->speed_capa & ETH_LINK_SPEED_50G) return VNET_DPDK_PORT_TYPE_ETH_50G; else if (dev_info->speed_capa & ETH_LINK_SPEED_40G) return VNET_DPDK_PORT_TYPE_ETH_40G; else if (dev_info->speed_capa & ETH_LINK_SPEED_25G) return VNET_DPDK_PORT_TYPE_ETH_25G; + else if (dev_info->speed_capa & ETH_LINK_SPEED_20G) + return VNET_DPDK_PORT_TYPE_ETH_20G; else if (dev_info->speed_capa & ETH_LINK_SPEED_10G) return VNET_DPDK_PORT_TYPE_ETH_10G; + else if (dev_info->speed_capa & ETH_LINK_SPEED_5G) + return VNET_DPDK_PORT_TYPE_ETH_5G; + else if (dev_info->speed_capa & ETH_LINK_SPEED_2_5G) + return VNET_DPDK_PORT_TYPE_ETH_2_5G; else if (dev_info->speed_capa & ETH_LINK_SPEED_1G) return VNET_DPDK_PORT_TYPE_ETH_1G; @@ -1387,15 +1395,30 @@ dpdk_update_link_state (dpdk_device_t * xd, f64 now) case ETH_SPEED_NUM_1G: hw_flags |= VNET_HW_INTERFACE_FLAG_SPEED_1G; break; + case ETH_SPEED_NUM_2_5G: + hw_flags |= VNET_HW_INTERFACE_FLAG_SPEED_2_5G; + break; + case ETH_SPEED_NUM_5G: + hw_flags |= VNET_HW_INTERFACE_FLAG_SPEED_5G; + break; case ETH_SPEED_NUM_10G: hw_flags |= VNET_HW_INTERFACE_FLAG_SPEED_10G; break; + case ETH_SPEED_NUM_20G: + hw_flags |= VNET_HW_INTERFACE_FLAG_SPEED_20G; + break; case ETH_SPEED_NUM_25G: hw_flags |= VNET_HW_INTERFACE_FLAG_SPEED_25G; break; case ETH_SPEED_NUM_40G: hw_flags |= VNET_HW_INTERFACE_FLAG_SPEED_40G; break; + case ETH_SPEED_NUM_50G: + hw_flags |= VNET_HW_INTERFACE_FLAG_SPEED_50G; + break; + case ETH_SPEED_NUM_56G: + hw_flags |= VNET_HW_INTERFACE_FLAG_SPEED_56G; + break; case ETH_SPEED_NUM_100G: hw_flags |= VNET_HW_INTERFACE_FLAG_SPEED_100G; break; diff --git a/src/vnet/interface.h b/src/vnet/interface.h index d42f079f585..8988eb0e8aa 100644 --- a/src/vnet/interface.h +++ b/src/vnet/interface.h @@ -393,24 +393,34 @@ typedef struct vnet_hw_interface_t #define VNET_HW_INTERFACE_FLAG_SPEED_10M (1 << 3) #define VNET_HW_INTERFACE_FLAG_SPEED_100M (1 << 4) #define VNET_HW_INTERFACE_FLAG_SPEED_1G (1 << 5) -#define VNET_HW_INTERFACE_FLAG_SPEED_10G (1 << 6) -#define VNET_HW_INTERFACE_FLAG_SPEED_25G (1 << 7) -#define VNET_HW_INTERFACE_FLAG_SPEED_40G (1 << 8) -#define VNET_HW_INTERFACE_FLAG_SPEED_100G (1 << 9) +#define VNET_HW_INTERFACE_FLAG_SPEED_2_5G (1 << 6) +#define VNET_HW_INTERFACE_FLAG_SPEED_5G (1 << 7) +#define VNET_HW_INTERFACE_FLAG_SPEED_10G (1 << 8) +#define VNET_HW_INTERFACE_FLAG_SPEED_20G (1 << 9) +#define VNET_HW_INTERFACE_FLAG_SPEED_25G (1 << 10) +#define VNET_HW_INTERFACE_FLAG_SPEED_40G (1 << 11) +#define VNET_HW_INTERFACE_FLAG_SPEED_50G (1 << 12) +#define VNET_HW_INTERFACE_FLAG_SPEED_56G (1 << 13) +#define VNET_HW_INTERFACE_FLAG_SPEED_100G (1 << 14) #define VNET_HW_INTERFACE_FLAG_SPEED_MASK \ (VNET_HW_INTERFACE_FLAG_SPEED_10M | \ VNET_HW_INTERFACE_FLAG_SPEED_100M | \ VNET_HW_INTERFACE_FLAG_SPEED_1G | \ + VNET_HW_INTERFACE_FLAG_SPEED_2_5G | \ + VNET_HW_INTERFACE_FLAG_SPEED_5G | \ VNET_HW_INTERFACE_FLAG_SPEED_10G | \ + VNET_HW_INTERFACE_FLAG_SPEED_20G | \ VNET_HW_INTERFACE_FLAG_SPEED_25G | \ VNET_HW_INTERFACE_FLAG_SPEED_40G | \ + VNET_HW_INTERFACE_FLAG_SPEED_50G | \ + VNET_HW_INTERFACE_FLAG_SPEED_56G | \ VNET_HW_INTERFACE_FLAG_SPEED_100G) /* rx mode flags */ -#define VNET_HW_INTERFACE_FLAG_SUPPORTS_INT_MODE (1 << 10) +#define VNET_HW_INTERFACE_FLAG_SUPPORTS_INT_MODE (1 << 16) /* tx checksum offload */ -#define VNET_HW_INTERFACE_FLAG_SUPPORTS_TX_L4_CKSUM_OFFLOAD (1 << 11) +#define VNET_HW_INTERFACE_FLAG_SUPPORTS_TX_L4_CKSUM_OFFLOAD (1 << 17) /* Hardware address as vector. Zero (e.g. zero-length vector) if no address for this class (e.g. PPP). */ diff --git a/src/vpp/api/test_client.c b/src/vpp/api/test_client.c index cad9112680d..f0feee046e1 100644 --- a/src/vpp/api/test_client.c +++ b/src/vpp/api/test_client.c @@ -133,12 +133,30 @@ vl_api_sw_interface_details_t_handler (vl_api_sw_interface_details_t * mp) case VNET_HW_INTERFACE_FLAG_SPEED_1G: speed = "1Gbps"; break; + case VNET_HW_INTERFACE_FLAG_SPEED_2_5G: + speed = "2.5Gbps"; + break; + case VNET_HW_INTERFACE_FLAG_SPEED_5G: + speed = "5Gbps"; + break; case VNET_HW_INTERFACE_FLAG_SPEED_10G: speed = "10Gbps"; break; + case VNET_HW_INTERFACE_FLAG_SPEED_20G: + speed = "20Gbps"; + break; + case VNET_HW_INTERFACE_FLAG_SPEED_25G: + speed = "25Gbps"; + break; case VNET_HW_INTERFACE_FLAG_SPEED_40G: speed = "40Gbps"; break; + case VNET_HW_INTERFACE_FLAG_SPEED_50G: + speed = "50Gbps"; + break; + case VNET_HW_INTERFACE_FLAG_SPEED_56G: + speed = "56Gbps"; + break; case VNET_HW_INTERFACE_FLAG_SPEED_100G: speed = "100Gbps"; break; |