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>
diff --git a/src/plugins/dpdk/device/dpdk.h b/src/plugins/dpdk/device/dpdk.h
index 4f4a2e5..1f43a48 100644
--- a/src/plugins/dpdk/device/dpdk.h
+++ b/src/plugins/dpdk/device/dpdk.h
@@ -92,10 +92,14 @@
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 d661fa7..36f921d 100644
--- a/src/plugins/dpdk/device/format.c
+++ b/src/plugins/dpdk/device/format.c
@@ -176,10 +176,22 @@
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 @@
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 95c5e5c..a425c58 100755
--- a/src/plugins/dpdk/device/init.c
+++ b/src/plugins/dpdk/device/init.c
@@ -62,14 +62,22 @@
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 @@
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 d42f079..8988eb0 100644
--- a/src/vnet/interface.h
+++ b/src/vnet/interface.h
@@ -393,24 +393,34 @@
#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 cad9112..f0feee0 100644
--- a/src/vpp/api/test_client.c
+++ b/src/vpp/api/test_client.c
@@ -133,12 +133,30 @@
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;