aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Hemminger <stephen@networkplumber.org>2018-10-15 17:50:46 -0700
committerDamjan Marion <dmarion@me.com>2018-10-20 18:48:19 +0000
commita9ded38b1f2d852ff231a305805e5f5c801b9c76 (patch)
tree56a232d61a31403432312f742ab02a3077048a61
parent939ce11cc9249fa15af61aaeb28e2247f1a71a9b (diff)
dpdk: add netvsc PMD
Teach DPDK plugin about the netvsc Poll Mode Driver. The speed of the Netvsc device matches the speed of the external port on the underlying vswitch. Therefore 1G, 10G, 25G, 56G and even 100G are possible. Change-Id: I14ab6907b7d8d350b63a083409d45fb9c348a364 Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
-rw-r--r--src/plugins/dpdk/device/dpdk.h4
-rw-r--r--src/plugins/dpdk/device/format.c4
-rw-r--r--src/plugins/dpdk/device/init.c33
3 files changed, 40 insertions, 1 deletions
diff --git a/src/plugins/dpdk/device/dpdk.h b/src/plugins/dpdk/device/dpdk.h
index cc9b644d23c..c4f908ea408 100644
--- a/src/plugins/dpdk/device/dpdk.h
+++ b/src/plugins/dpdk/device/dpdk.h
@@ -86,7 +86,8 @@ extern vlib_node_registration_t admin_up_down_process_node;
_ ("net_ena", ENA) \
_ ("net_failsafe", FAILSAFE) \
_ ("net_liovf", LIOVF_ETHER) \
- _ ("net_qede", QEDE)
+ _ ("net_qede", QEDE) \
+ _ ("net_netvsc", NETVSC)
typedef enum
{
@@ -116,6 +117,7 @@ typedef enum
VNET_DPDK_PORT_TYPE_VIRTIO_USER,
VNET_DPDK_PORT_TYPE_VHOST_ETHER,
VNET_DPDK_PORT_TYPE_FAILSAFE,
+ VNET_DPDK_PORT_TYPE_NETVSC,
VNET_DPDK_PORT_TYPE_UNKNOWN,
} dpdk_port_type_t;
diff --git a/src/plugins/dpdk/device/format.c b/src/plugins/dpdk/device/format.c
index 4494895f380..e173ebd5f84 100644
--- a/src/plugins/dpdk/device/format.c
+++ b/src/plugins/dpdk/device/format.c
@@ -370,6 +370,10 @@ format_dpdk_device_type (u8 * s, va_list * args)
dev_type = "Cavium QLogic FastLinQ QL4xxxx";
break;
+ case VNET_DPDK_PMD_NETVSC:
+ dev_type = "Microsoft Hyper-V Netvsc";
+ break;
+
default:
case VNET_DPDK_PMD_UNKNOWN:
dev_type = "### UNKNOWN ###";
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;
}