Skip to contentSkip to conversation

Hyper-V/Azure netvsc PMD and bus support

PATCH Superseded Stephen Hemminger 2 participants 6 messages Jun 12, 2018 – Jul 12, 2018

Subsystems (2)

v11 of 12 Superseded Latest is v12 →

lore
Share & tools
lore
#0 lore raw

v11 cover Hyper-V/Azure netvsc PMD and bus support

Latest version of the Hyper-V native bus (VMBus)
and network device (netvsc) drivers. This virtual device is used in Microsoft Hyper-V in Windows 10, Windows Server 2016 and Azure. Most of this code was extracted from FreeBSD and some of this is from earlier code donated by Brocade.

Only Linux is supported at present, but the code is split to allow future FreeBSD and Windows support.

This version works best with 4.17 kernel which has all the necessary patches for multi-queue support. It is possible to use with 4.16 but then only a single queue is supported.

Device binding is best done via driverctl; this required some additional fixes to kernel and driverctl to work correctly. Linux kernel vmbus support needed to support sysfs driver_override and driverctl needed to handle non-PCI bus from udev.
https://gitlab.com/driverctl/driverctl/merge_requests/3
http://driverdev.linuxdriverproject.org/pipermail/driverdev-devel/2018-April/118889.html

The remaining TODO's are:
- Performance testing
- Rx buffer copy avoidance (external mbuf)
- Transparent VF support

v11
- merge meson build into bus and netvsc patches
- fix docbook for rte_uuid
- fix a couple of checkpatch warnings
- reduce logging during debug for stats

v10
- resolve RSS setup
- add documentation about restart issue
- update documentation to refer to 4.17
- use same RSS key as MLX

v9
- fix places where still targeted at previous release
- add map entry for rte_uuid
- fix meson build dependencies

v8
- targeted for 18.08, move release notes
- use Ted's libuuid (not FreeBSD) because that is 3 clause BSD license versus 2 clause in FreeBSD
- minor checkpatch whitespace fixes

v7
- add EAL UUID functions from BSD to remove dependency on libuuid this means device can be enabled by default and eliminates build issues
- add support for latest NetVSP protocol (from hayaingz)
- add probe finish for compatability with 18.05
- rebase to 18.05-rc3

Stephen Hemminger (4):
eal: add rte_uuid support
bus/vmbus: add hyper-v virtual bus support
net/netvsc: add hyper-v netvsc network device
net/netvsc: add documentation

 MAINTAINERS                                   |   11 +
 config/common_base                            |   13 +
 config/common_linuxapp                        |    3 +
 doc/guides/nics/features/netvsc.ini           |   23 +
 doc/guides/nics/index.rst                     |    1 +
 doc/guides/nics/netvsc.rst                    |  101 ++
 doc/guides/rel_notes/known_issues.rst         |   20 +
 doc/guides/rel_notes/release_18_08.rst        |    6 +
 drivers/bus/Makefile                          |    1 +
 drivers/bus/meson.build                       |    2 +-
 drivers/bus/vmbus/Makefile                    |   36 +
 drivers/bus/vmbus/linux/Makefile              |    3 +
 drivers/bus/vmbus/linux/vmbus_bus.c           |  355 +++++
 drivers/bus/vmbus/linux/vmbus_uio.c           |  390 ++++++
 drivers/bus/vmbus/meson.build                 |   18 +
 drivers/bus/vmbus/private.h                   |  132 ++
 drivers/bus/vmbus/rte_bus_vmbus.h             |  396 ++++++
 drivers/bus/vmbus/rte_bus_vmbus_version.map   |   28 +
 drivers/bus/vmbus/rte_vmbus_reg.h             |  344 +++++
 drivers/bus/vmbus/vmbus_bufring.c             |  241 ++++
 drivers/bus/vmbus/vmbus_channel.c             |  406 ++++++
 drivers/bus/vmbus/vmbus_common.c              |  286 ++++
 drivers/bus/vmbus/vmbus_common_uio.c          |  232 ++++
 drivers/net/Makefile                          |    1 +
 drivers/net/meson.build                       |    2 +-
 drivers/net/netvsc/Makefile                   |   23 +
 drivers/net/netvsc/hn_ethdev.c                |  755 ++++++++++
 drivers/net/netvsc/hn_logs.h                  |   35 +
 drivers/net/netvsc/hn_nvs.c                   |  535 ++++++++
 drivers/net/netvsc/hn_nvs.h                   |  245 ++++
 drivers/net/netvsc/hn_rndis.c                 | 1097 +++++++++++++++
 drivers/net/netvsc/hn_rndis.h                 |   26 +
 drivers/net/netvsc/hn_rxtx.c                  | 1216 +++++++++++++++++
 drivers/net/netvsc/hn_var.h                   |  139 ++
 drivers/net/netvsc/meson.build                |    7 +
 drivers/net/netvsc/ndis.h                     |  378 +++++
 drivers/net/netvsc/rndis.h                    |  414 ++++++
 drivers/net/netvsc/rte_pmd_netvsc_version.map |    5 +
 lib/librte_eal/bsdapp/eal/Makefile            |    1 +
 lib/librte_eal/common/Makefile                |    2 +-
 lib/librte_eal/common/eal_common_uuid.c       |  193 +++
 lib/librte_eal/common/include/rte_uuid.h      |  129 ++
 lib/librte_eal/common/meson.build             |    2 +
 lib/librte_eal/linuxapp/eal/Makefile          |    1 +
 lib/librte_eal/rte_eal_version.map            |    9 +
 mk/rte.app.mk                                 |    2 +
 46 files changed, 8262 insertions(+), 3 deletions(-)
 create mode 100644 doc/guides/nics/features/netvsc.ini
 create mode 100644 doc/guides/nics/netvsc.rst
 create mode 100644 drivers/bus/vmbus/Makefile
 create mode 100644 drivers/bus/vmbus/linux/Makefile
 create mode 100644 drivers/bus/vmbus/linux/vmbus_bus.c
 create mode 100644 drivers/bus/vmbus/linux/vmbus_uio.c
 create mode 100644 drivers/bus/vmbus/meson.build
 create mode 100644 drivers/bus/vmbus/private.h
 create mode 100644 drivers/bus/vmbus/rte_bus_vmbus.h
 create mode 100644 drivers/bus/vmbus/rte_bus_vmbus_version.map
 create mode 100644 drivers/bus/vmbus/rte_vmbus_reg.h
 create mode 100644 drivers/bus/vmbus/vmbus_bufring.c
 create mode 100644 drivers/bus/vmbus/vmbus_channel.c
 create mode 100644 drivers/bus/vmbus/vmbus_common.c
 create mode 100644 drivers/bus/vmbus/vmbus_common_uio.c
 create mode 100644 drivers/net/netvsc/Makefile
 create mode 100644 drivers/net/netvsc/hn_ethdev.c
 create mode 100644 drivers/net/netvsc/hn_logs.h
 create mode 100644 drivers/net/netvsc/hn_nvs.c
 create mode 100644 drivers/net/netvsc/hn_nvs.h
 create mode 100644 drivers/net/netvsc/hn_rndis.c
 create mode 100644 drivers/net/netvsc/hn_rndis.h
 create mode 100644 drivers/net/netvsc/hn_rxtx.c
 create mode 100644 drivers/net/netvsc/hn_var.h
 create mode 100644 drivers/net/netvsc/meson.build
 create mode 100644 drivers/net/netvsc/ndis.h
 create mode 100644 drivers/net/netvsc/rndis.h
 create mode 100644 drivers/net/netvsc/rte_pmd_netvsc_version.map
 create mode 100644 lib/librte_eal/common/eal_common_uuid.c
 create mode 100644 lib/librte_eal/common/include/rte_uuid.h
Signature · 1 line
2.17.1
#1 lore raw

PATCH v11 1/4 eal: add rte_uuid support

Since uuid functions may not be available everywhere, implement uuid functions in DPDK. These are based off the BSD licensed libuuid in util-link.

---
 lib/librte_eal/bsdapp/eal/Makefile       |   1 +
 lib/librte_eal/common/Makefile           |   2 +-
 lib/librte_eal/common/eal_common_uuid.c  | 193 +++++++++++++++++++++++
 lib/librte_eal/common/include/rte_uuid.h | 129 +++++++++++++++
 lib/librte_eal/common/meson.build        |   2 +
 lib/librte_eal/linuxapp/eal/Makefile     |   1 +
 lib/librte_eal/rte_eal_version.map       |   9 ++
 7 files changed, 336 insertions(+), 1 deletion(-)
 create mode 100644 lib/librte_eal/common/eal_common_uuid.c
 create mode 100644 lib/librte_eal/common/include/rte_uuid.h
lib/librte_eal/bsdapp/eal/Makefile +1 -0
index 3fd33f1e4318..13eafca61243 100644
@@ -58,6 +58,7 @@ SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_options.c
 SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_thread.c
 SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_proc.c
 SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_fbarray.c
+SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_uuid.c
 SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += rte_malloc.c
 SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += malloc_elem.c
 SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += malloc_heap.c
lib/librte_eal/common/Makefile +1 -1
index 48f870f24bef..68a680bcb934 100644
@@ -16,7 +16,7 @@ INC += rte_pci_dev_feature_defs.h rte_pci_dev_features.h
 INC += rte_malloc.h rte_keepalive.h rte_time.h
 INC += rte_service.h rte_service_component.h
 INC += rte_bitmap.h rte_vfio.h rte_hypervisor.h rte_test.h
-INC += rte_reciprocal.h rte_fbarray.h
+INC += rte_reciprocal.h rte_fbarray.h rte_uuid.h
 
 GENERIC_INC := rte_atomic.h rte_byteorder.h rte_cycles.h rte_prefetch.h
 GENERIC_INC += rte_spinlock.h rte_memcpy.h rte_cpuflags.h rte_rwlock.h
lib/librte_eal/common/eal_common_uuid.c new file +193 -0

193 lines not on this page · raw message

lib/librte_eal/common/include/rte_uuid.h new file +129 -0

129 lines not on this page · raw message

lib/librte_eal/common/meson.build +2 -0
index 8a3dcfee091b..e184e4d7413d 100644
@@ -25,6 +25,7 @@ common_sources = files(
 	'eal_common_tailqs.c',
 	'eal_common_thread.c',
 	'eal_common_timer.c',
+	'eal_common_uuid.c',
 	'malloc_elem.c',
 	'malloc_heap.c',
 	'malloc_mp.c',
@@ -75,6 +76,7 @@ common_headers = files(
 	'include/rte_string_fns.h',
 	'include/rte_tailq.h',
 	'include/rte_time.h',
+	'include/rte_uuid.h',
 	'include/rte_version.h')
 
 # special case install the generic headers, since they go in a subdir
lib/librte_eal/linuxapp/eal/Makefile +1 -0
index 3719ec9d7d53..927a80fec907 100644
@@ -66,6 +66,7 @@ SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_options.c
 SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_thread.c
 SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_proc.c
 SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_fbarray.c
+SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_uuid.c
 SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += rte_malloc.c
 SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += malloc_elem.c
 SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += malloc_heap.c
lib/librte_eal/rte_eal_version.map +9 -0
index f7dd0e7bcab6..fd45fea3ce4f 100644
@@ -241,6 +241,15 @@ DPDK_18.05 {
 
 } DPDK_18.02;
 
+DPDK_18.08 {
+	global:
+
+	rte_uuid_compare;
+	rte_uuid_is_null;
+	rte_uuid_parse;
+	rte_uuid_unparse;
+} DPDK_18.05;
+
 EXPERIMENTAL {
 	global:
 
Signature · 1 line
2.17.1
#2 lore raw

PATCH v11 2/4 bus/vmbus: add hyper-v virtual bus support

In reply to Stephen Hemminger

This patch adds support for an additional bus type Virtual Machine BUS (VMBUS) on Microsoft Hyper-V in Windows 10, Windows Server 2016 and Azure. Most of this code was extracted from FreeBSD and some of this is from earlier code donated by Brocade.

Only Linux is supported at present, but the code is split to allow future FreeBSD and Windows support.

The bus support relies on the uio_hv_generic driver from Linux kernel 4.16. Multiple queue support requires additional sysfs interfaces which is in kernel 5.0 (a.k.a 4.17).

---
 MAINTAINERS                                 |   3 +
 config/common_base                          |   5 +
 drivers/bus/Makefile                        |   1 +
 drivers/bus/meson.build                     |   2 +-
 drivers/bus/vmbus/Makefile                  |  36 ++
 drivers/bus/vmbus/linux/Makefile            |   3 +
 drivers/bus/vmbus/linux/vmbus_bus.c         | 355 +++++++++++++++++
 drivers/bus/vmbus/linux/vmbus_uio.c         | 390 +++++++++++++++++++
 drivers/bus/vmbus/meson.build               |  18 +
 drivers/bus/vmbus/private.h                 | 132 +++++++
 drivers/bus/vmbus/rte_bus_vmbus.h           | 396 +++++++++++++++++++
 drivers/bus/vmbus/rte_bus_vmbus_version.map |  28 ++
 drivers/bus/vmbus/rte_vmbus_reg.h           | 344 +++++++++++++++++
 drivers/bus/vmbus/vmbus_bufring.c           | 241 ++++++++++++
 drivers/bus/vmbus/vmbus_channel.c           | 406 ++++++++++++++++++++
 drivers/bus/vmbus/vmbus_common.c            | 286 ++++++++++++++
 drivers/bus/vmbus/vmbus_common_uio.c        | 232 +++++++++++
 mk/rte.app.mk                               |   1 +
 18 files changed, 2878 insertions(+), 1 deletion(-)
 create mode 100644 drivers/bus/vmbus/Makefile
 create mode 100644 drivers/bus/vmbus/linux/Makefile
 create mode 100644 drivers/bus/vmbus/linux/vmbus_bus.c
 create mode 100644 drivers/bus/vmbus/linux/vmbus_uio.c
 create mode 100644 drivers/bus/vmbus/meson.build
 create mode 100644 drivers/bus/vmbus/private.h
 create mode 100644 drivers/bus/vmbus/rte_bus_vmbus.h
 create mode 100644 drivers/bus/vmbus/rte_bus_vmbus_version.map
 create mode 100644 drivers/bus/vmbus/rte_vmbus_reg.h
 create mode 100644 drivers/bus/vmbus/vmbus_bufring.c
 create mode 100644 drivers/bus/vmbus/vmbus_channel.c
 create mode 100644 drivers/bus/vmbus/vmbus_common.c
 create mode 100644 drivers/bus/vmbus/vmbus_common_uio.c
MAINTAINERS +3 -0
index 4667fa7fbcb1..e9e0f9c188fe 100644
@@ -421,6 +421,9 @@ F: drivers/bus/pci/
 VDEV bus driver
 F: drivers/bus/vdev/
 
+VMBUS bus driver
+M: Stephen Hemminger <[email protected]>
+F: drivers/bus/vmbus/
 
 Networking Drivers
 ------------------
config/common_base +5 -0
index 6b0d1cbbb76c..e4e30ba50437 100644
@@ -402,6 +402,11 @@ CONFIG_RTE_LIBRTE_PMD_FAILSAFE=y
 CONFIG_RTE_LIBRTE_MVPP2_PMD=n
 
 #
+# Compile support for VMBus library
+#
+CONFIG_RTE_LIBRTE_VMBUS=n
+
+
 # Compile virtual device driver for NetVSC on Hyper-V/Azure
 #
 CONFIG_RTE_LIBRTE_VDEV_NETVSC_PMD=n
drivers/bus/Makefile +1 -0
index ef7f24751974..cea3b55e60c9 100644
@@ -10,5 +10,6 @@ endif
 DIRS-$(CONFIG_RTE_LIBRTE_IFPGA_BUS) += ifpga
 DIRS-$(CONFIG_RTE_LIBRTE_PCI_BUS) += pci
 DIRS-$(CONFIG_RTE_LIBRTE_VDEV_BUS) += vdev
+DIRS-$(CONFIG_RTE_LIBRTE_VMBUS) += vmbus
 
 include $(RTE_SDK)/mk/rte.subdir.mk
drivers/bus/meson.build +1 -1
index 52c755dcfd8e..80de2d91d52d 100644
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2017 Intel Corporation
 
-drivers = ['dpaa', 'fslmc', 'ifpga', 'pci', 'vdev']
+drivers = ['dpaa', 'fslmc', 'ifpga', 'pci', 'vdev', 'vmbus']
 std_deps = ['eal']
 config_flag_fmt = 'RTE_LIBRTE_@0@_BUS'
 driver_name_fmt = 'rte_bus_@0@'
drivers/bus/vmbus/Makefile new file +36 -0
new file mode 100644
index 000000000000..bd18a71154af
@@ -0,0 +1,36 @@
+# SPDX-License-Identifier: BSD-3-Clause
+
+include $(RTE_SDK)/mk/rte.vars.mk
+
+LIB = librte_bus_vmbus.a
+LIBABIVER := 1
+EXPORT_MAP := rte_bus_vmbus_version.map
+
+CFLAGS += -I$(SRCDIR)
+CFLAGS += -O3 $(WERROR_FLAGS)
+CFLAGS += -DALLOW_EXPERIMENTAL_API
+
+ifneq ($(CONFIG_RTE_EXEC_ENV_LINUXAPP),)
+SYSTEM := linux
+endif
+ifneq ($(CONFIG_RTE_EXEC_ENV_BSDAPP),)
+$(error "VMBUS not implemented for BSD yet")
+endif
+
+CFLAGS += -I$(RTE_SDK)/drivers/bus/vmbus/$(SYSTEM)
+CFLAGS += -I$(RTE_SDK)/lib/librte_eal/common
+CFLAGS += -I$(RTE_SDK)/lib/librte_eal/$(SYSTEM)app/eal
+
+LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
+LDLIBS += -lrte_ethdev -luuid
+
+include $(RTE_SDK)/drivers/bus/vmbus/$(SYSTEM)/Makefile
+SRCS-$(CONFIG_RTE_LIBRTE_VMBUS) := $(addprefix $(SYSTEM)/,$(SRCS))
+SRCS-$(CONFIG_RTE_LIBRTE_VMBUS) += vmbus_common.c
+SRCS-$(CONFIG_RTE_LIBRTE_VMBUS) += vmbus_channel.c vmbus_bufring.c
+SRCS-$(CONFIG_RTE_LIBRTE_VMBUS) += vmbus_common_uio.c
+
+SYMLINK-$(CONFIG_RTE_LIBRTE_VMBUS)-include += rte_bus_vmbus.h
+SYMLINK-$(CONFIG_RTE_LIBRTE_VMBUS)-include += rte_vmbus_reg.h
+
+include $(RTE_SDK)/mk/rte.lib.mk
drivers/bus/vmbus/linux/Makefile new file +3 -0
new file mode 100644
index 000000000000..ef0d30b2d3aa
@@ -0,0 +1,3 @@
+# SPDX-License-Identifier: BSD-3-Clause
+
+SRCS += vmbus_bus.c vmbus_uio.c
drivers/bus/vmbus/linux/vmbus_bus.c new file +355 -0

355 lines not on this page · raw message

drivers/bus/vmbus/linux/vmbus_uio.c new file +390 -0

390 lines not on this page · raw message

drivers/bus/vmbus/meson.build new file +18 -0
new file mode 100644
index 000000000000..18daabecc62d
@@ -0,0 +1,18 @@
+# SPDX-License-Identifier: BSD-3-Clause
+
+allow_experimental_apis = true
+
+install_headers('rte_bus_vmbus.h','rte_vmbus_reg.h')
+
+sources = files('vmbus_common.c',
+		'vmbus_channel.c',
+		'vmbus_bufring.c',
+		'vmbus_common_uio.c')
+
+if host_machine.system() == 'linux'
+	sources += files('linux/vmbus_bus.c',
+			'linux/vmbus_uio.c')
+	includes += include_directories('linux')
+else
+	build = false
+endif
drivers/bus/vmbus/private.h new file +132 -0

132 lines not on this page · raw message

drivers/bus/vmbus/rte_bus_vmbus.h new file +396 -0

396 lines not on this page · raw message

drivers/bus/vmbus/rte_bus_vmbus_version.map new file +28 -0
new file mode 100644
index 000000000000..620ced9bb348
@@ -0,0 +1,28 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
+DPDK_18.08 {
+	global:
+
+	rte_vmbus_chan_close;
+	rte_vmbus_chan_open;
+	rte_vmbus_chan_recv;
+	rte_vmbus_chan_recv_raw;
+	rte_vmbus_chan_rx_empty;
+	rte_vmbus_chan_send;
+	rte_vmbus_chan_send_sglist;
+	rte_vmbus_chan_signal_tx;
+	rte_vmbus_irq_mask;
+	rte_vmbus_irq_read;
+	rte_vmbus_irq_unmask;
+	rte_vmbus_map_device;
+	rte_vmbus_max_channels;
+	rte_vmbus_probe;
+	rte_vmbus_probe_one;
+	rte_vmbus_register;
+	rte_vmbus_scan;
+	rte_vmbus_sub_channel_index;
+	rte_vmbus_subchan_open;
+	rte_vmbus_unmap_device;
+	rte_vmbus_unregister;
+
+	local: *;
+};
drivers/bus/vmbus/rte_vmbus_reg.h new file +344 -0

344 lines not on this page · raw message

drivers/bus/vmbus/vmbus_bufring.c new file +241 -0

241 lines not on this page · raw message

drivers/bus/vmbus/vmbus_channel.c new file +406 -0

406 lines not on this page · raw message

drivers/bus/vmbus/vmbus_common.c new file +286 -0

286 lines not on this page · raw message

drivers/bus/vmbus/vmbus_common_uio.c new file +232 -0

232 lines not on this page · raw message

mk/rte.app.mk +1 -0
index 1e32c83e75e7..9fa82383ee8d 100644
@@ -169,6 +169,7 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_IFCVF_VDPA_PMD) += -lrte_ifcvf_vdpa
 endif # $(CONFIG_RTE_EAL_VFIO)
 endif # $(CONFIG_RTE_LIBRTE_VHOST)
 _LDLIBS-$(CONFIG_RTE_LIBRTE_VMXNET3_PMD)    += -lrte_pmd_vmxnet3_uio
+_LDLIBS-$(CONFIG_RTE_LIBRTE_VMBUS)	    += -lrte_bus_vmbus
 
 ifeq ($(CONFIG_RTE_LIBRTE_BBDEV),y)
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_BBDEV_NULL)     += -lrte_pmd_bbdev_null
Signature · 1 line
2.17.1
#3 lore raw

PATCH v11 3/4 net/netvsc: add hyper-v netvsc network device

In reply to Stephen Hemminger

The driver supports Hyper-V networking directly like virtio for KVM or vmxnet3 for VMware.

This code is based off of the FreeBSD driver. The file and variable names are kept the same to help with understanding (with most of the BSD style warts removed).

This version supports the latest NetVSP 6.1 version and older versions.

---
 MAINTAINERS                                   |    8 +
 config/common_base                            |    8 +
 config/common_linuxapp                        |    3 +
 drivers/net/Makefile                          |    1 +
 drivers/net/meson.build                       |    2 +-
 drivers/net/netvsc/Makefile                   |   23 +
 drivers/net/netvsc/hn_ethdev.c                |  755 ++++++++++
 drivers/net/netvsc/hn_logs.h                  |   35 +
 drivers/net/netvsc/hn_nvs.c                   |  535 ++++++++
 drivers/net/netvsc/hn_nvs.h                   |  245 ++++
 drivers/net/netvsc/hn_rndis.c                 | 1097 +++++++++++++++
 drivers/net/netvsc/hn_rndis.h                 |   26 +
 drivers/net/netvsc/hn_rxtx.c                  | 1216 +++++++++++++++++
 drivers/net/netvsc/hn_var.h                   |  139 ++
 drivers/net/netvsc/meson.build                |    7 +
 drivers/net/netvsc/ndis.h                     |  378 +++++
 drivers/net/netvsc/rndis.h                    |  414 ++++++
 drivers/net/netvsc/rte_pmd_netvsc_version.map |    5 +
 mk/rte.app.mk                                 |    1 +
 19 files changed, 4897 insertions(+), 1 deletion(-)
 create mode 100644 drivers/net/netvsc/Makefile
 create mode 100644 drivers/net/netvsc/hn_ethdev.c
 create mode 100644 drivers/net/netvsc/hn_logs.h
 create mode 100644 drivers/net/netvsc/hn_nvs.c
 create mode 100644 drivers/net/netvsc/hn_nvs.h
 create mode 100644 drivers/net/netvsc/hn_rndis.c
 create mode 100644 drivers/net/netvsc/hn_rndis.h
 create mode 100644 drivers/net/netvsc/hn_rxtx.c
 create mode 100644 drivers/net/netvsc/hn_var.h
 create mode 100644 drivers/net/netvsc/meson.build
 create mode 100644 drivers/net/netvsc/ndis.h
 create mode 100644 drivers/net/netvsc/rndis.h
 create mode 100644 drivers/net/netvsc/rte_pmd_netvsc_version.map
MAINTAINERS +8 -0
index e9e0f9c188fe..10bb5444561f 100644
@@ -600,6 +600,14 @@ F: drivers/net/vdev_netvsc/
 F: doc/guides/nics/vdev_netvsc.rst
 F: doc/guides/nics/features/vdev_netvsc.ini
 
+Microsoft Hyper-V netvsc - EXPERIMENTAL
+M: Stephen Hemminger <[email protected]>
+M: "K. Y. Srinivasan" <[email protected]>
+M: Haiyang Zhang <[email protected]>
+F: drivers/net/hyperv/
+F: doc/guides/nics/netvsc.rst
+F: doc/guides/nics/features/netvsc.ini
+
 Netcope szedata2
 M: Matej Vido <[email protected]>
 F: drivers/net/szedata2/
config/common_base +8 -0
index e4e30ba50437..7c825c7b250f 100644
@@ -406,7 +406,15 @@ CONFIG_RTE_LIBRTE_MVPP2_PMD=n
 #
 CONFIG_RTE_LIBRTE_VMBUS=n
 
+#
+# Compile native PMD for Hyper-V/Azure
+#
+CONFIG_RTE_LIBRTE_NETVSC_PMD=n
+CONFIG_RTE_LIBRTE_NETVSC_DEBUG_RX=n
+CONFIG_RTE_LIBRTE_NETVSC_DEBUG_TX=n
+CONFIG_RTE_LIBRTE_NETVSC_DEBUG_DUMP=n
 
+#
 # Compile virtual device driver for NetVSC on Hyper-V/Azure
 #
 CONFIG_RTE_LIBRTE_VDEV_NETVSC_PMD=n
config/common_linuxapp +3 -0
index 5c68cc0ff440..b452ccd87990 100644
@@ -25,6 +25,9 @@ CONFIG_RTE_LIBRTE_POWER=y
 CONFIG_RTE_VIRTIO_USER=y
 CONFIG_RTE_PROC_INFO=y
 
+CONFIG_RTE_LIBRTE_VMBUS=y
+CONFIG_RTE_LIBRTE_NETVSC_PMD=y
+
 # NXP DPAA BUS and drivers
 CONFIG_RTE_LIBRTE_DPAA_BUS=y
 CONFIG_RTE_LIBRTE_DPAA_MEMPOOL=y
drivers/net/Makefile +1 -0
index 9f9da665173a..7cfc08d6f340 100644
@@ -33,6 +33,7 @@ DIRS-$(CONFIG_RTE_LIBRTE_LIO_PMD) += liquidio
 DIRS-$(CONFIG_RTE_LIBRTE_MLX4_PMD) += mlx4
 DIRS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += mlx5
 DIRS-$(CONFIG_RTE_LIBRTE_MVPP2_PMD) += mvpp2
+DIRS-$(CONFIG_RTE_LIBRTE_NETVSC_PMD) += netvsc
 DIRS-$(CONFIG_RTE_LIBRTE_NFP_PMD) += nfp
 DIRS-$(CONFIG_RTE_LIBRTE_BNXT_PMD) += bnxt
 DIRS-$(CONFIG_RTE_LIBRTE_PMD_NULL) += null
drivers/net/meson.build +1 -1
index b7d00a04c8ef..74d6c0f7cabf 100644
@@ -3,7 +3,7 @@
 
 drivers = ['af_packet', 'axgbe', 'bonding', 'dpaa', 'dpaa2',
 	'e1000', 'enic', 'fm10k', 'i40e', 'ixgbe',
-	'mvpp2', 'null', 'octeontx', 'pcap', 'ring',
+	'mvpp2', 'netvsc', 'null', 'octeontx', 'pcap', 'ring',
 	'sfc', 'thunderx', 'virtio']
 std_deps = ['ethdev', 'kvargs'] # 'ethdev' also pulls in mbuf, net, eal etc
 std_deps += ['bus_pci']         # very many PMDs depend on PCI, so make std
drivers/net/netvsc/Makefile new file +23 -0
new file mode 100644
index 000000000000..3c713af3c8fc
@@ -0,0 +1,23 @@
+# SPDX-License-Identifier: BSD-3-Clause
+
+include $(RTE_SDK)/mk/rte.vars.mk
+
+LIB = librte_pmd_netvsc.a
+
+CFLAGS += -O3 $(WERROR_FLAGS)
+CFLAGS += -DALLOW_EXPERIMENTAL_API
+
+EXPORT_MAP := rte_pmd_netvsc_version.map
+
+LIBABIVER := 1
+
+SRCS-$(CONFIG_RTE_LIBRTE_NETVSC_PMD) += hn_ethdev.c
+SRCS-$(CONFIG_RTE_LIBRTE_NETVSC_PMD) += hn_rxtx.c
+SRCS-$(CONFIG_RTE_LIBRTE_NETVSC_PMD) += hn_rndis.c
+SRCS-$(CONFIG_RTE_LIBRTE_NETVSC_PMD) += hn_nvs.c
+
+LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
+LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs
+LDLIBS += -lrte_bus_vmbus
+
+include $(RTE_SDK)/mk/rte.lib.mk
drivers/net/netvsc/hn_ethdev.c new file +755 -0

755 lines not on this page · raw message

drivers/net/netvsc/hn_logs.h new file +35 -0
new file mode 100644
index 000000000000..f821655b83a6
@@ -0,0 +1,35 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
+
+#ifndef _HN_LOGS_H_
+#define _HN_LOGS_H_
+
+#include <rte_log.h>
+
+extern int hn_logtype_init;
+
+#define PMD_INIT_LOG(level, fmt, args...) \
+	rte_log(RTE_LOG_ ## level, hn_logtype_init, "%s(): " fmt "\n",\
+		__func__, ## args)
+#define PMD_INIT_FUNC_TRACE() PMD_INIT_LOG(DEBUG, " >>")
+
+#ifdef RTE_LIBRTE_NETVSC_DEBUG_RX
+#define PMD_RX_LOG(level, fmt, args...) \
+	RTE_LOG(level, PMD, "%s() rx: " fmt "\n", __func__, ## args)
+#else
+#define PMD_RX_LOG(level, fmt, args...) do { } while (0)
+#endif
+
+#ifdef RTE_LIBRTE_NETVSC_DEBUG_TX
+#define PMD_TX_LOG(level, fmt, args...) \
+	RTE_LOG(level, PMD, "%s() tx: " fmt "\n", __func__, ## args)
+#else
+#define PMD_TX_LOG(level, fmt, args...) do { } while (0)
+#endif
+
+
+extern int hn_logtype_driver;
+#define PMD_DRV_LOG(level, fmt, args...) \
+	rte_log(RTE_LOG_ ## level, hn_logtype_driver, "%s(): " fmt "\n", \
+		__func__, ## args)
+
+#endif /* _HN_LOGS_H_ */
drivers/net/netvsc/hn_nvs.c new file +535 -0

535 lines not on this page · raw message

drivers/net/netvsc/hn_nvs.h new file +245 -0

245 lines not on this page · raw message

drivers/net/netvsc/hn_rndis.c new file +1097 -0

1,097 lines not on this page · raw message

drivers/net/netvsc/hn_rndis.h new file +26 -0
new file mode 100644
index 000000000000..f82f6d69d490
@@ -0,0 +1,26 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
+
+#include "rndis.h"
+
+struct hn_data;
+
+void hn_rndis_receive_response(struct hn_data *hv,
+			      const void *data, uint32_t len);
+void	hn_rndis_link_status(struct hn_data *hv, const void *data);
+int	hn_rndis_attach(struct hn_data *hv);
+void	hn_rndis_detach(struct hn_data *hv);
+int	hn_rndis_get_eaddr(struct hn_data *hv, uint8_t *eaddr);
+int	hn_rndis_get_linkstatus(struct hn_data *hv);
+int	hn_rndis_get_linkspeed(struct hn_data *hv);
+int	hn_rndis_set_rxfilter(struct hn_data *hv, uint32_t filter);
+void	hn_rndis_rx_ctrl(struct hn_data *hv, const void *data,
+			 int dlen);
+int	hn_rndis_get_offload(struct hn_data *hv,
+			     struct rte_eth_dev_info *dev_info);
+int	hn_rndis_conf_offload(struct hn_data *hv,
+			      uint64_t tx_offloads,
+			      uint64_t rx_offloads);
+int	hn_rndis_query_rsscaps(struct hn_data *hv,
+			       unsigned int *rxr_cnt0);
+int	hn_rndis_conf_rss(struct hn_data *hv,
+			  const struct rte_eth_rss_conf *rss_conf);
drivers/net/netvsc/hn_rxtx.c new file +1216 -0

231 lines not on this page · raw message

drivers/net/netvsc/hn_var.h new file +139 -0

139 lines not on this page · raw message

drivers/net/netvsc/meson.build new file +7 -0
new file mode 100644
index 000000000000..68fe9b7e6b46

Lines of this file are not shown. View the raw message.

drivers/net/netvsc/ndis.h new file +378 -0

378 lines not on this page · raw message

drivers/net/netvsc/rndis.h new file +414 -0

414 lines not on this page · raw message

drivers/net/netvsc/rte_pmd_netvsc_version.map new file +5 -0
new file mode 100644
index 000000000000..d534019a6b53

Lines of this file are not shown. View the raw message.

mk/rte.app.mk +1 -0
index 9fa82383ee8d..c22b47569754 100644

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.17.1

Part of the diff is not shown here. View the raw message.

#4 lore raw

PATCH v11 4/4 net/netvsc: add documentation

In reply to Stephen Hemminger

From: Stephen Hemminger <[email protected]>

Matching documentation for new netvsc device.
Includes a brief note about the restart issue.

---
 doc/guides/nics/features/netvsc.ini    |  23 ++++++
 doc/guides/nics/index.rst              |   1 +
 doc/guides/nics/netvsc.rst             | 101 +++++++++++++++++++++++++
 doc/guides/rel_notes/known_issues.rst  |  20 +++++
 doc/guides/rel_notes/release_18_08.rst |   6 ++
 5 files changed, 151 insertions(+)
 create mode 100644 doc/guides/nics/features/netvsc.ini
 create mode 100644 doc/guides/nics/netvsc.rst
doc/guides/nics/features/netvsc.ini new file +23 -0
new file mode 100644
index 000000000000..2ff6042bf47b
@@ -0,0 +1,23 @@
+;
+; Supported features of the 'netvsc' network poll mode driver.
+;
+; Refer to default.ini for the full list of available PMD features.
+;
+[Features]
+Speed capabilities   = P
+Link status          = Y
+Queue start/stop     = Y
+Scattered Rx         = Y
+Promiscuous mode     = Y
+Allmulticast mode    = Y
+Basic stats          = Y
+Stats per queue      = Y
+Extended stats       = Y
+Multiprocess aware   = Y
+Other kdrv           = Y
+ARMv7                = Y
+ARMv8                = Y
+x86-32               = Y
+x86-64               = Y
+Usage doc            = Y
+MTU update           = Y
doc/guides/nics/index.rst +1 -0
index ddb9eb7a922e..d4eae2b8f046 100644
@@ -33,6 +33,7 @@ Network Interface Controller Drivers
     mlx4
     mlx5
     mvpp2
+    netvsc
     nfp
     octeontx
     qede
doc/guides/nics/netvsc.rst new file +101 -0

101 lines not on this page · raw message

doc/guides/rel_notes/known_issues.rst +20 -0
index 716bd7360949..95e4ce693e45 100644
@@ -739,3 +739,23 @@ Linux kernel 4.10.0 iommu attribute read error
 
 **Driver/Module**:
    ``vfio-pci`` module.
+
+Netvsc driver and application restart
+-------------------------------------
+
+**Description**:
+   The Linux kernel uio_hv_generic driver does not completely shutdown and clean up
+   resources properly if application using Netvsc PMD exits.
+
+**Implication**:
+   When application using Netvsc PMD is restarted it can not complete initialization
+   handshake sequence with the host.
+
+**Resolution/Workaround**:
+   Either reboot the guest or remove and reinsert the hv_uio_generic module.
+
+**Affected Environment/Platform**:
+   Linux Hyper-V.
+
+**Driver/Module**:
+   ``uio_hv_generic`` module.
doc/guides/rel_notes/release_18_08.rst +6 -0
index 5bc23c537371..41ad33e227f8 100644
@@ -41,6 +41,12 @@ New Features
      Also, make sure to start the actual text at the margin.
      =========================================================
 
+* **Added support for Hyper-V netvsc PMD.**
+
+  The new ``netvsc`` poll mode driver provides native support for
+  networking on Hyper-V. See the :doc:`../nics/netvsc` NIC driver guide
+  for more details on this new driver.
+
 
 API Changes
 -----------
Signature · 1 line
2.17.1
#5 lore raw
In reply to Stephen Hemminger

The old offload API has been removed.
Please could you adapt this PMD to the new API?

The errors are:
../drivers/net/netvsc/hn_ethdev.c:185:4: error: ‘struct rte_eth_txconf’ has no member named ‘txq_flags’ ../drivers/net/netvsc/hn_ethdev.c:185:16: error: ‘ETH_TXQ_FLAGS_NOXSUMS’ undeclared (first use in this function)
.txq_flags = ETH_TXQ_FLAGS_NOXSUMS,

Some checkpatches warnings are remaining:

### [dpdk-dev] [PATCH v11 2/4] bus/vmbus: add hyper-v virtual bus support

WARNING:AVOID_EXTERNS: externs should be avoided in .c files #353: FILE: drivers/bus/vmbus/linux/vmbus_bus.c:28:
+extern struct rte_vmbus_bus rte_vmbus_bus;

WARNING:AVOID_EXTERNS: externs should be avoided in .c files #2715: FILE: drivers/bus/vmbus/vmbus_common.c:26:
+extern struct rte_vmbus_bus rte_vmbus_bus;

### [dpdk-dev] [PATCH v11 3/4] net/netvsc: add hyper-v netvsc network device

CHECK:ASSIGNMENT_CONTINUATIONS: Assignment operator '=' should be on the previous line #519: FILE: drivers/net/netvsc/hn_ethdev.c:189:
+ dev_info->flow_type_rss_offloads
+ = ETH_RSS_IPV4 | ETH_RSS_IPV6 | ETH_RSS_TCP | ETH_RSS_UDP;

CHECK:ASSIGNMENT_CONTINUATIONS: Assignment operator '=' should be on the previous line #622: FILE: drivers/net/netvsc/hn_ethdev.c:292:
+ const struct rte_eth_rss_conf *rss_conf
+ = &dev_conf->rx_adv_conf.rss_conf;

CHECK:CAMELCASE: Avoid CamelCase: <PRIx64>
#632: FILE: drivers/net/netvsc/hn_ethdev.c:302:
+ "unsupported TX offload: %#" PRIx64,

CHECK:ASSIGNMENT_CONTINUATIONS: Assignment operator '=' should be on the previous line #788: FILE: drivers/net/netvsc/hn_ethdev.c:458:
+ const unsigned int nstats
+ = dev->data->nb_tx_queues * RTE_DIM(hn_stat_strings)

CHECK:CAMELCASE: Avoid CamelCase: <PRIx32>
#2644: FILE: drivers/net/netvsc/hn_rndis.c:720:
+ PMD_DRV_LOG(ERR, "exec RNDIS set %#" PRIx32 " failed",

CHECK:ASSIGNMENT_CONTINUATIONS: Assignment operator '=' should be on the previous line #3500: FILE: drivers/net/netvsc/hn_rxtx.c:441:
+ struct rte_eth_dev *dev
+ = &rte_eth_devices[rxq->port_id];