add Hyper-V bus and network driver
cover add Hyper-V bus and network driver
This is an experimental driver originally developed by Vyatta/Brocade/ATT to support DPDK on Hyper-V. It is a native DPDK driver (unlike the TAP solution) for VMBus. The driver relies on the version UIO for Hyper-V (uio_hv_generic) which is in upstream kernel next tree (char-misc-next).
It is not yet a full replacement for the failsafe/tap/vdev_netvsc solution since it does not support SR-IOV. The driver and bus interface are marked experimental until it is ready to replace them.
Stephen Hemminger (3):
bus/vmbus: add hyper-v virtual bus support
usertools: add hv_uio_setup script
net/netvsc: add hyper-v netvsc network device
MAINTAINERS | 10 + config/common_base | 13 + config/common_linuxapp | 4 + doc/guides/nics/index.rst | 1 + doc/guides/nics/netvsc.rst | 53 ++ drivers/bus/Makefile | 1 + drivers/bus/vmbus/Makefile | 36 + drivers/bus/vmbus/linux/Makefile | 3 + drivers/bus/vmbus/linux/vmbus_bus.c | 354 +++++++ drivers/bus/vmbus/linux/vmbus_uio.c | 340 +++++++ drivers/bus/vmbus/private.h | 125 +++ drivers/bus/vmbus/rte_bus_vmbus.h | 381 ++++++++ drivers/bus/vmbus/rte_bus_vmbus_version.map | 23 + drivers/bus/vmbus/rte_vmbus_reg.h | 344 +++++++ drivers/bus/vmbus/vmbus_bufring.c | 242 +++++ drivers/bus/vmbus/vmbus_channel.c | 351 +++++++ drivers/bus/vmbus/vmbus_common.c | 287 ++++++ drivers/bus/vmbus/vmbus_common_uio.c | 232 +++++ drivers/net/Makefile | 1 + drivers/net/netvsc/Makefile | 23 + drivers/net/netvsc/hn_ethdev.c | 751 +++++++++++++++ drivers/net/netvsc/hn_logs.h | 35 + drivers/net/netvsc/hn_nvs.c | 533 +++++++++++ drivers/net/netvsc/hn_nvs.h | 243 +++++ drivers/net/netvsc/hn_rndis.c | 1101 ++++++++++++++++++++++ drivers/net/netvsc/hn_rndis.h | 26 + drivers/net/netvsc/hn_rxtx.c | 1224 +++++++++++++++++++++++++ drivers/net/netvsc/hn_var.h | 140 +++ 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 | 2 + usertools/hv_uio_setup.sh | 40 + 33 files changed, 7716 insertions(+) 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/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/ndis.h create mode 100644 drivers/net/netvsc/rndis.h create mode 100644 drivers/net/netvsc/rte_pmd_netvsc_version.map create mode 100755 usertools/hv_uio_setup.sh
Signature · 1 line
2.16.3
PATCH 1/3 bus/vmbus: add hyper-v virtual bus support
From: Stephen Hemminger <[email protected]>
This patch adds support for an additional bus type Virtual Machine BUS (VMBUS)is used 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.
This version supports multiple channels per device and requires requires this bus support as well revised versio of uio_hv_generic which is has been submitted to upstream Linux.
--- MAINTAINERS | 3 + config/common_base | 5 + config/common_linuxapp | 4 + drivers/bus/Makefile | 1 + drivers/bus/vmbus/Makefile | 36 +++ drivers/bus/vmbus/linux/Makefile | 3 + drivers/bus/vmbus/linux/vmbus_bus.c | 354 ++++++++++++++++++++++++++ drivers/bus/vmbus/linux/vmbus_uio.c | 340 +++++++++++++++++++++++++ drivers/bus/vmbus/private.h | 125 +++++++++ drivers/bus/vmbus/rte_bus_vmbus.h | 381 ++++++++++++++++++++++++++++ drivers/bus/vmbus/rte_bus_vmbus_version.map | 23 ++ drivers/bus/vmbus/rte_vmbus_reg.h | 344 +++++++++++++++++++++++++ drivers/bus/vmbus/vmbus_bufring.c | 242 ++++++++++++++++++ drivers/bus/vmbus/vmbus_channel.c | 351 +++++++++++++++++++++++++ drivers/bus/vmbus/vmbus_common.c | 287 +++++++++++++++++++++ drivers/bus/vmbus/vmbus_common_uio.c | 232 +++++++++++++++++ mk/rte.app.mk | 1 + 17 files changed, 2732 insertions(+) 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/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
@@ -342,6 +342,9 @@ VDEV bus driver M: Jianfeng Tan <[email protected]> F: drivers/bus/vdev/ +VMBUS bus driver +M: Stephen Hemminger <[email protected]> +F: drivers/bus/vmbus/ Networking Drivers ------------------
config/common_base +5 -0
@@ -386,6 +386,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
config/common_linuxapp +4 -0
@@ -37,3 +37,7 @@ CONFIG_RTE_LIBRTE_DPAA2_MEMPOOL=y CONFIG_RTE_LIBRTE_DPAA2_PMD=y CONFIG_RTE_LIBRTE_PMD_DPAA2_EVENTDEV=y CONFIG_RTE_LIBRTE_PMD_DPAA2_SEC=y + +# Hyper-V Virtual Machine bus and drivers +CONFIG_RTE_LIBRTE_VMBUS=y +
drivers/bus/Makefile +1 -0
@@ -9,5 +9,6 @@ DIRS-$(CONFIG_RTE_LIBRTE_FSLMC_BUS) += fslmc endif 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/vmbus/Makefile new file +36 -0
@@ -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 -lrte_vmbus -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
@@ -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 +354 -0
354 lines not on this page · raw message
drivers/bus/vmbus/linux/vmbus_uio.c new file +340 -0
340 lines not on this page · raw message
drivers/bus/vmbus/private.h new file +125 -0
125 lines not on this page · raw message
drivers/bus/vmbus/rte_bus_vmbus.h new file +381 -0
381 lines not on this page · raw message
drivers/bus/vmbus/rte_bus_vmbus_version.map new file +23 -0
@@ -0,0 +1,23 @@ +/* SPDX-License-Identifier: BSD-3-Clause */ +DPDK_18.02 { + global: + + rte_vmbus_chan_close; + rte_vmbus_chan_open; + rte_vmbus_chan_recv; + rte_vmbus_chan_recv_raw; + rte_vmbus_chan_send; + rte_vmbus_chan_send_sglist; + rte_vmbus_irq_mask; + rte_vmbus_irq_read; + rte_vmbus_irq_unmask; + rte_vmbus_map_device; + rte_vmbus_probe; + rte_vmbus_probe_one; + rte_vmbus_register; + rte_vmbus_scan; + 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 +242 -0
242 lines not on this page · raw message
drivers/bus/vmbus/vmbus_channel.c new file +351 -0
351 lines not on this page · raw message
drivers/bus/vmbus/vmbus_common.c new file +287 -0
287 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
@@ -183,6 +183,7 @@ ifeq ($(CONFIG_RTE_LIBRTE_VHOST),y) _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_VHOST) += -lrte_pmd_vhost endif # $(CONFIG_RTE_LIBRTE_VHOST) _LDLIBS-$(CONFIG_RTE_LIBRTE_VMXNET3_PMD) += -lrte_pmd_vmxnet3_uio +_LDLIBS-$(CONFIG_RTE_LIBRTE_VMBUS) += -lrte_bus_vmbus -luuid ifeq ($(CONFIG_RTE_LIBRTE_BBDEV),y) _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_BBDEV_NULL) += -lrte_pmd_bbdev_null
Signature · 1 line
2.16.3
PATCH 2/3 usertools: add hv_uio_setup script
In reply to Stephen HemmingerSmall script to rebind netvsc kernel device to Hyper-V networking PMD. It could be integrated in dpdk-bind, but dpdk-bind is focused on PCI, and that would get messy.
Eventually, this functionality will be built into netvsc driver (see vdev_netvsc as an example).
--- usertools/hv_uio_setup.sh | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100755 usertools/hv_uio_setup.sh
usertools/hv_uio_setup.sh new file +40 -0
@@ -0,0 +1,40 @@ +#! /bin/bash +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2018 Microsoft Corporation + +module=uio_hv_generic +# Hyper-V network device GUID +net_guid="f8615163-df3e-46c5-913f-f2d2f965ed0e" + +if [ $# -ne 1 ]; then + echo "Usage: $0 ethN" + exit 1 +fi + +syspath=/sys/class/net/$1/device +devpath=$(readlink $syspath) +if [ $? -ne 0 ]; then + echo "$1 no device present" + exit 1 +fi +dev_guid=$(basename $devpath) + +driver=$(readlink $syspath/driver) +if [ $? -ne 0 ]; then + echo "$1 driver not found" + exit 1 +fi +existing=$(basename $driver) + +if [ "$existing" != "hv_netvsc" ]; then + echo "$1 controlled by $existing" + exit 1 +fi + +if [ ! -d /sys/module/$module ]; then + modprobe $module + echo $net_guid >/sys/bus/vmbus/drivers/uio_hv_generic/new_id +fi + +echo $dev_guid > /sys/bus/vmbus/drivers/$existing/unbind +echo $dev_guid > /sys/bus/vmbus/drivers/$module/bind
Signature · 1 line
2.16.3
Re: [PATCH 2/3] usertools: add hv_uio_setup script
05/04/2018 21:13, Stephen Hemminger:
Quoted 6 lines
Small script to rebind netvsc kernel device to Hyper-V networking PMD. It could be integrated in dpdk-bind, but dpdk-bind is focused on PCI, and that would get messy.
Eventually, this functionality will be built into netvsc driver (see
vdev_netvscas an example).
I believe we should avoid creating such script.
The direction to go, for hotplug, is to remove dpdk-devbind.py, and implement kernel binding in PMDs (with EAL helpers).
In order to make this change happen, we should not add this hv_uio_setup.sh script.
Re: [PATCH 2/3] usertools: add hv_uio_setup script
Quoted 8 lines · On Thu, 05 Apr 2018 22:43:39 +0200 Thomas Monjalon <[email protected]> wrote:
05/04/2018 21:13, Stephen Hemminger:
Quoted 6 lines
Small script to rebind netvsc kernel device to Hyper-V networking PMD. It could be integrated in dpdk-bind, but dpdk-bind is focused on PCI, and that would get messy.
Eventually, this functionality will be built into netvsc driver (see
vdev_netvscas an example).
Quoted 6 lines
I believe we should avoid creating such script.
The direction to go, for hotplug, is to removedpdk-devbind.py, and implement kernel binding in PMDs (with EAL helpers).In order to make this change happen, we should not add this
hv_uio_setup.shscript.
Yes, this is a temporary script like dpdk-bind, want to get rid of it and do everything inside driver. That is the next step.
Re: [PATCH 2/3] usertools: add hv_uio_setup script
05/04/2018 23:03, Stephen Hemminger:
Quoted 15 lines
Quoted 12 lines · On Thu, 05 Apr 2018 22:43:39 +0200 Thomas Monjalon <[email protected]> wrote:
05/04/2018 21:13, Stephen Hemminger:
Quoted 6 lines
Small script to rebind netvsc kernel device to Hyper-V networking PMD. It could be integrated in dpdk-bind, but dpdk-bind is focused on PCI, and that would get messy.
Eventually, this functionality will be built into netvsc driver (see
vdev_netvscas an example).I believe we should avoid creating such script.
The direction to go, for hotplug, is to removedpdk-devbind.py, and implement kernel binding in PMDs (with EAL helpers).
Quoted 5 lines
Quoted 2 lines
In order to make this change happen, we should not add this
hv_uio_setup.shscript.Yes, this is a temporary script like dpdk-bind, want to get rid of it and do everything inside driver. That is the next step.
If this is temporary, it is a step in the wrong direction which could confuse users.
If it becomes definitive (design discussion in progress), then it should be merged in dpdk-devbind.py.
Re: [PATCH 2/3] usertools: add hv_uio_setup script
Quoted 19 lines · On Thu, 05 Apr 2018 23:13:54 +0200 Thomas Monjalon <[email protected]> wrote:
05/04/2018 23:03, Stephen Hemminger:
Quoted 18 lines
Quoted 14 lines · On Thu, 05 Apr 2018 22:43:39 +0200 Thomas Monjalon <[email protected]> wrote:
05/04/2018 21:13, Stephen Hemminger:
Quoted 6 lines
Small script to rebind netvsc kernel device to Hyper-V networking PMD. It could be integrated in dpdk-bind, but dpdk-bind is focused on PCI, and that would get messy.
Eventually, this functionality will be built into netvsc driver (see
vdev_netvscas an example).I believe we should avoid creating such script.
The direction to go, for hotplug, is to removedpdk-devbind.py, and implement kernel binding in PMDs (with EAL helpers).In order to make this change happen, we should not add this
hv_uio_setup.shscript.
Quoted 10 lines
Quoted 2 lines
Yes, this is a temporary script like dpdk-bind, want to get rid of it and do everything inside driver. That is the next step.
If this is temporary, it is a step in the wrong direction which could confuse users.
If it becomes definitive (design discussion in progress), then it should be merged in
dpdk-devbind.py.
This is an experimental driver, if everyone waits until everything is done there would be no review or testing.
Re: [PATCH 2/3] usertools: add hv_uio_setup script
In reply to Thomas MonjalonQuoted 19 lines · On Thu, 05 Apr 2018 23:13:54 +0200 Thomas Monjalon <[email protected]> wrote:
05/04/2018 23:03, Stephen Hemminger:
Quoted 18 lines
Quoted 14 lines · On Thu, 05 Apr 2018 22:43:39 +0200 Thomas Monjalon <[email protected]> wrote:
05/04/2018 21:13, Stephen Hemminger:
Quoted 6 lines
Small script to rebind netvsc kernel device to Hyper-V networking PMD. It could be integrated in dpdk-bind, but dpdk-bind is focused on PCI, and that would get messy.
Eventually, this functionality will be built into netvsc driver (see
vdev_netvscas an example).I believe we should avoid creating such script.
The direction to go, for hotplug, is to removedpdk-devbind.py, and implement kernel binding in PMDs (with EAL helpers).In order to make this change happen, we should not add this
hv_uio_setup.shscript.
Quoted 8 lines
Quoted 2 lines
Yes, this is a temporary script like dpdk-bind, want to get rid of it and do everything inside driver. That is the next step.
If this is temporary, it is a step in the wrong direction which could confuse users.
If it becomes definitive (design discussion in progress), then it should be merged in
dpdk-devbind.py.
I looked into changing dpdk-devbind.py but it needed lots of work and to be honest the time for me to do it python was too much trouble and likely to break existing users.
Re: [PATCH 2/3] usertools: add hv_uio_setup script
In reply to Thomas MonjalonQuoted 19 lines · On Thu, 05 Apr 2018 23:13:54 +0200 Thomas Monjalon <[email protected]> wrote:
05/04/2018 23:03, Stephen Hemminger:
Quoted 18 lines
Quoted 14 lines · On Thu, 05 Apr 2018 22:43:39 +0200 Thomas Monjalon <[email protected]> wrote:
05/04/2018 21:13, Stephen Hemminger:
Quoted 6 lines
Small script to rebind netvsc kernel device to Hyper-V networking PMD. It could be integrated in dpdk-bind, but dpdk-bind is focused on PCI, and that would get messy.
Eventually, this functionality will be built into netvsc driver (see
vdev_netvscas an example).I believe we should avoid creating such script.
The direction to go, for hotplug, is to removedpdk-devbind.py, and implement kernel binding in PMDs (with EAL helpers).In order to make this change happen, we should not add this
hv_uio_setup.shscript.
Quoted 8 lines
Quoted 2 lines
Yes, this is a temporary script like dpdk-bind, want to get rid of it and do everything inside driver. That is the next step.
If this is temporary, it is a step in the wrong direction which could confuse users.
If it becomes definitive (design discussion in progress), then it should be merged in
dpdk-devbind.py.
Right now PCI does it the same way. It doesn't have a good cold plug interface. The whole PCI probe logic expects that the device will have a vfio/uio already bound.
When PCI is fixed, then VMBUS can be changed to the same thing.
Re: [PATCH 2/3] usertools: add hv_uio_setup script
In reply to Thomas MonjalonQuoted 5 lines · Thomas Monjalon
05/04/2018 21:13, Stephen Hemminger:
Quoted 4 lines
Small script to rebind netvsc kernel device to Hyper-V networking PMD. It could be integrated in dpdk-bind, but dpdk-bind is focused on PCI, and that would get messy.
Quoted 7 lines
Quoted 2 lines
Eventually, this functionality will be built into netvsc driver (see
vdev_netvscas an example).I believe we should avoid creating such script.
The direction to go, for hotplug, is to removedpdk-devbind.py, and implement kernel binding in PMDs (with EAL helpers).
I'm not convinced at all that that is the direction to go. I instead would prefer to see all binding happen outside DPDK. I believe having udev or similar manage bindings, set up via e.g driverctl[1], is a far better path.
Just my 2c.
/Bruce
Re: [PATCH 2/3] usertools: add hv_uio_setup script
05/04/2018 23:07, Bruce Richardson:
Quoted 9 lines · Thomas Monjalon
Quoted 8 lines
05/04/2018 21:13, Stephen Hemminger:
Quoted 6 lines
Small script to rebind netvsc kernel device to Hyper-V networking PMD. It could be integrated in dpdk-bind, but dpdk-bind is focused on PCI, and that would get messy.
Eventually, this functionality will be built into netvsc driver (see
vdev_netvscas an example).
Quoted 7 lines
Quoted 4 lines
I believe we should avoid creating such script.
The direction to go, for hotplug, is to removedpdk-devbind.py, and implement kernel binding in PMDs (with EAL helpers).I'm not convinced at all that that is the direction to go. I instead would prefer to see all binding happen outside DPDK. I believe having udev or similar manage bindings, set up via e.g driverctl[1], is a far better path.
This is a system admin tool, and only for Linux.
Having the binding logic inside DPDK, allows the application to control how hotplug behave.
Re: [PATCH 2/3] usertools: add hv_uio_setup script
Quoted 14 lines · On Thu, 05 Apr 2018 23:10:33 +0200 Thomas Monjalon <[email protected]> wrote:
05/04/2018 23:07, Bruce Richardson:
Quoted 13 lines · Thomas Monjalon
Quoted 12 lines
05/04/2018 21:13, Stephen Hemminger:
Quoted 6 lines
Small script to rebind netvsc kernel device to Hyper-V networking PMD. It could be integrated in dpdk-bind, but dpdk-bind is focused on PCI, and that would get messy.
Eventually, this functionality will be built into netvsc driver (see
vdev_netvscas an example).I believe we should avoid creating such script.
The direction to go, for hotplug, is to removedpdk-devbind.py, and implement kernel binding in PMDs (with EAL helpers).
Quoted 9 lines
Quoted 3 lines
I'm not convinced at all that that is the direction to go. I instead would prefer to see all binding happen outside DPDK. I believe having udev or similar manage bindings, set up via e.g driverctl[1], is a far better path.
This is a system admin tool, and only for Linux.
Having the binding logic inside DPDK, allows the application to control how hotplug behave.
What about using driverctl?
That solution would work for both PCI and VMBUS, but not sure how widely adopted it is by distributions.
Re: [PATCH 2/3] usertools: add hv_uio_setup script
In reply to Thomas MonjalonQuoted 23 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Thomas Monjalon
Sent: Thursday, April 5, 2018 10:11 PM
To: Richardson, Bruce <[email protected]>
Cc: Stephen Hemminger <[email protected]>; [email protected]; Stephen Hemminger <[email protected]>
Subject: Re: [dpdk-dev] [PATCH 2/3] usertools: addhv_uio_setupscript05/04/2018 23:07, Bruce Richardson:
Quoted 13 lines · Thomas Monjalon
Quoted 12 lines
05/04/2018 21:13, Stephen Hemminger:
Quoted 6 lines
Small script to rebind netvsc kernel device to Hyper-V networking PMD. It could be integrated in dpdk-bind, but dpdk-bind is focused on PCI, and that would get messy.
Eventually, this functionality will be built into netvsc driver (see
vdev_netvscas an example).I believe we should avoid creating such script.
The direction to go, for hotplug, is to removedpdk-devbind.py, and implement kernel binding in PMDs (with EAL helpers).
Quoted 7 lines
Quoted 3 lines
I'm not convinced at all that that is the direction to go. I instead would prefer to see all binding happen outside DPDK. I believe having udev or similar manage bindings, set up via e.g driverctl[1], is a far better path.
This is a system admin tool, and only for Linux.
Having the binding logic inside DPDK, allows the application to control how hotplug behave.
I also don't think that DPDK application should control hotplug behavior logic. It is clearly up to the system admin to make such decisions. Konstantin
Re: [PATCH 2/3] usertools: add hv_uio_setup script
Quoted 25 lines · Konstantin
Quoted 25 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Thomas Monjalon
Sent: Thursday, April 5, 2018 10:11 PM
To: Richardson, Bruce <[email protected]>
Cc: Stephen Hemminger <[email protected]>; [email protected]; Stephen Hemminger <[email protected]>
Subject: Re: [dpdk-dev] [PATCH 2/3] usertools: addhv_uio_setupscript05/04/2018 23:07, Bruce Richardson:
Quoted 16 lines · Thomas Monjalon
Quoted 5 lines
05/04/2018 21:13, Stephen Hemminger:
Quoted 4 lines
Small script to rebind netvsc kernel device to Hyper-V networking PMD. It could be integrated in dpdk-bind, but dpdk-bind is focused on PCI, and that would get messy.
Quoted 7 lines
Quoted 2 lines
Eventually, this functionality will be built into netvsc driver (see
vdev_netvscas an example).I believe we should avoid creating such script.
The direction to go, for hotplug, is to removedpdk-devbind.py, and implement kernel binding in PMDs (with EAL helpers).I'm not convinced at all that that is the direction to go. I instead would prefer to see all binding happen outside DPDK. I believe having udev or similar manage bindings, set up via e.g driverctl[1], is a far better path.
Quoted 7 lines
Quoted 3 lines
This is a system admin tool, and only for Linux.
Having the binding logic inside DPDK, allows the application to control how hotplug behave.I also don't think that DPDK application should control hotplug behavior logic. It is clearly up to the system admin to make such decisions. Konstantin
My preference would be to get driverctl working as a standard tool. But it requires kernel changes to work with vmbus.
Re: [PATCH 2/3] usertools: add hv_uio_setup script
Quoted 32 lines · Stephen Hemminger
Quoted 29 lines · Konstantin
Quoted 28 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Thomas Monjalon
Sent: Thursday, April 5, 2018 10:11 PM
To: Richardson, Bruce <[email protected]>
Cc: Stephen Hemminger <[email protected]>; [email protected]; Stephen Hemminger <[email protected]>
Subject: Re: [dpdk-dev] [PATCH 2/3] usertools: addhv_uio_setupscript05/04/2018 23:07, Bruce Richardson:
Quoted 9 lines · Thomas Monjalon
Quoted 8 lines
05/04/2018 21:13, Stephen Hemminger:
Quoted 6 lines
Small script to rebind netvsc kernel device to Hyper-V networking PMD. It could be integrated in dpdk-bind, but dpdk-bind is focused on PCI, and that would get messy.
Eventually, this functionality will be built into netvsc driver (see
vdev_netvscas an example).Quoted 7 lines
Quoted 4 lines
I believe we should avoid creating such script.
The direction to go, for hotplug, is to removedpdk-devbind.py, and implement kernel binding in PMDs (with EAL helpers).I'm not convinced at all that that is the direction to go. I instead would prefer to see all binding happen outside DPDK. I believe having udev or similar manage bindings, set up via e.g driverctl[1], is a far better path.
This is a system admin tool, and only for Linux.
Having the binding logic inside DPDK, allows the application to control how hotplug behave.
Quoted 7 lines
Quoted 3 lines
I also don't think that DPDK application should control hotplug behavior logic. It is clearly up to the system admin to make such decisions. Konstantin
My preference would be to get driverctl working as a standard tool. But it requires kernel changes to work with vmbus.
+1
I don't think that binding should be done by DPDK for a couple of reasons:
1. There are already daemons and kernel supports out there, such as udev, for managing devices on a system level. I'd rather not see DPDK duplicate functionality, when we can re-use what is there. Also there exists the possibility of conflict, e.g. what if udev has a rule for a device, and DPDK also tries to manage it at the same time.
2. I believe that the app is the wrong place to manage the binding of devices, since it's up to the system administrator not the app to determine the exact setup for the platform. If apps are to manage binding, then each app will have to expose to the user/sysadmin cmdline options to specify what devices should be hotplugged into the app or not, and what drivers they should be bound too. Not all NICs hotplugged to a platform are for DPDK use, and they won't all want to use the igb_uio or the vfio_pci drivers. Better that that is configured for each platform on the platform itself.
I really feel that the driverctl approach is the best one - yes it's linux only for now, but architecturally I think it's the proper solution.
/Bruce
PATCH 3/3 net/netvsc: add hyper-v netvsc network device
In reply to Stephen HemmingerFrom: Stephen Hemminger <[email protected]>
Add VMBUS network device PMD. 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).
--- MAINTAINERS | 7 + config/common_base | 8 + config/common_linuxapp | 2 +- doc/guides/nics/index.rst | 1 + doc/guides/nics/netvsc.rst | 53 ++ drivers/bus/vmbus/Makefile | 2 +- drivers/net/Makefile | 1 + drivers/net/netvsc/Makefile | 23 + drivers/net/netvsc/hn_ethdev.c | 751 +++++++++++++++ drivers/net/netvsc/hn_logs.h | 35 + drivers/net/netvsc/hn_nvs.c | 533 +++++++++++ drivers/net/netvsc/hn_nvs.h | 243 +++++ drivers/net/netvsc/hn_rndis.c | 1101 ++++++++++++++++++++++ drivers/net/netvsc/hn_rndis.h | 26 + drivers/net/netvsc/hn_rxtx.c | 1224 +++++++++++++++++++++++++ drivers/net/netvsc/hn_var.h | 140 +++ 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 + 20 files changed, 4946 insertions(+), 2 deletions(-) create mode 100644 doc/guides/nics/netvsc.rst 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/ndis.h create mode 100644 drivers/net/netvsc/rndis.h create mode 100644 drivers/net/netvsc/rte_pmd_netvsc_version.map
MAINTAINERS +7 -0
@@ -433,6 +433,13 @@ F: drivers/net/enic/ F: doc/guides/nics/enic.rst F: doc/guides/nics/features/enic.ini +Hyper-V netvsc +M: Stephen Hemminger <[email protected]> +M: K. Y. Srinivasan" <[email protected]> +M: Haiyang Zhang <[email protected]> +F: drivers/net/hyperv/ +F: doc/guides/nics/hyperv.rst + Intel e1000 M: Wenzhuo Lu <[email protected]> T: git://dpdk.org/next/dpdk-next-net-intel
config/common_base +8 -0
@@ -390,7 +390,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 +1 -1
@@ -40,4 +40,4 @@ CONFIG_RTE_LIBRTE_PMD_DPAA2_SEC=y # Hyper-V Virtual Machine bus and drivers CONFIG_RTE_LIBRTE_VMBUS=y - +CONFIG_RTE_LIBRTE_NETVSC_PMD=y
doc/guides/nics/index.rst +1 -0
@@ -22,6 +22,7 @@ Network Interface Controller Drivers ena enic fm10k + hyperv i40e igb ixgbe
doc/guides/nics/netvsc.rst new file +53 -0
53 lines not on this page · raw message
drivers/bus/vmbus/Makefile +1 -1
@@ -7,7 +7,7 @@ LIBABIVER := 1 EXPORT_MAP := rte_bus_vmbus_version.map CFLAGS += -I$(SRCDIR) -CFLAGS += -O3 $(WERROR_FLAGS) +CFLAGS += -O3 $(WERROR_FLAGS) -g CFLAGS += -DALLOW_EXPERIMENTAL_API ifneq ($(CONFIG_RTE_EXEC_ENV_LINUXAPP),)
drivers/net/Makefile +1 -0
@@ -46,6 +46,7 @@ DIRS-$(CONFIG_RTE_LIBRTE_THUNDERX_NICVF_PMD) += thunderx DIRS-$(CONFIG_RTE_LIBRTE_VDEV_NETVSC_PMD) += vdev_netvsc DIRS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += virtio DIRS-$(CONFIG_RTE_LIBRTE_VMXNET3_PMD) += vmxnet3 +DIRS-$(CONFIG_RTE_LIBRTE_NETVSC_PMD) += netvsc ifeq ($(CONFIG_RTE_LIBRTE_KNI),y) DIRS-$(CONFIG_RTE_LIBRTE_PMD_KNI) += kni
drivers/net/netvsc/Makefile new file +23 -0
@@ -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 +751 -0
751 lines not on this page · raw message
drivers/net/netvsc/hn_logs.h new file +35 -0
@@ -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 +533 -0
533 lines not on this page · raw message
drivers/net/netvsc/hn_nvs.h new file +243 -0
243 lines not on this page · raw message
drivers/net/netvsc/hn_rndis.c new file +1101 -0
1,101 lines not on this page · raw message
drivers/net/netvsc/hn_rndis.h new file +26 -0
@@ -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 +1224 -0
180 lines not on this page · raw message
drivers/net/netvsc/hn_var.h new file +140 -0
140 lines not on this page · 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
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.16.3
Part of the diff is not shown here. View the raw message.
Re: [PATCH 3/3] net/netvsc: add hyper-v netvsc network device
Hi Stephen,
Good to see there is a good progress.
This patch should add an entry in the release notes. But I guess it is not ready for 18.05?
05/04/2018 21:13, Stephen Hemminger:
config/common_base CONFIG_RTE_LIBRTE_MVPP2_PMD=n · line 399
Quoted 7 lines
config/common_base +7
-0+# +# 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
Please switch to the new dynamic logging.
[...]
Quoted 1 line
+the Data Plane Development Kit (DPDK), we provide a Netwwork Virtual
typo: Netwwork
doc/guides/nics/netvsc.rst line 51
Quoted 3 lines
doc/guides/nics/netvsc.rst new file +3
-0+The following prerequisites apply: + +* Linux kernel uio_hv_generic driver that supports subchannels. This should be present in 4.17 or later.
The DPDK policy is to wait for prerequisite be available for merging.
drivers/net/Makefile DIRS-$(CONFIG_RTE_LIBRTE_THUNDERX_NICVF_PMD) += thunderx · line 49
Quoted 7 lines
drivers/net/Makefile +1
-0@@ -46,6 +46,7 @@ DIRS-$(CONFIG_RTE_LIBRTE_THUNDERX_NICVF_PMD) += thunderx DIRS-$(CONFIG_RTE_LIBRTE_VDEV_NETVSC_PMD) += vdev_netvsc DIRS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += virtio DIRS-$(CONFIG_RTE_LIBRTE_VMXNET3_PMD) += vmxnet3 +DIRS-$(CONFIG_RTE_LIBRTE_NETVSC_PMD) += netvsc
Please keep the alphabetical order.
Re: [PATCH 3/3] net/netvsc: add hyper-v netvsc network device
Quoted 9 lines · On Thu, 05 Apr 2018 22:52:31 +0200 Thomas Monjalon <[email protected]> wrote:
Hi Stephen,
Good to see there is a good progress.
This patch should add an entry in the release notes. But I guess it is not ready for 18.05?
05/04/2018 21:13, Stephen Hemminger:
Quoted 9 lines
config/common_base CONFIG_RTE_LIBRTE_MVPP2_PMD=n · line 399
Quoted 7 lines
config/common_base +7
-0+# +# 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=nPlease switch to the new dynamic logging.
It does use dynamic logging for the normal driver logs. For debug the dump code is a config option (same as other current drivers).
Quoted 5 lines
[...]
Quoted 1 line
+the Data Plane Development Kit (DPDK), we provide a Netwwork Virtual
Quoted 8 lines
typo: Netwwork
doc/guides/nics/netvsc.rst line 51
Quoted 3 lines
doc/guides/nics/netvsc.rst new file +3
-0+The following prerequisites apply: + +* Linux kernel uio_hv_generic driver that supports subchannels. This should be present in 4.17 or later.The DPDK policy is to wait for prerequisite be available for merging.
Does linux-next count?
Quoted 11 lines
drivers/net/Makefile DIRS-$(CONFIG_RTE_LIBRTE_THUNDERX_NICVF_PMD) += thunderx · line 49
Quoted 9 lines
drivers/net/Makefile +1
-0@@ -46,6 +46,7 @@ DIRS-$(CONFIG_RTE_LIBRTE_THUNDERX_NICVF_PMD) += thunderx DIRS-$(CONFIG_RTE_LIBRTE_VDEV_NETVSC_PMD) += vdev_netvsc DIRS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += virtio DIRS-$(CONFIG_RTE_LIBRTE_VMXNET3_PMD) += vmxnet3 +DIRS-$(CONFIG_RTE_LIBRTE_NETVSC_PMD) += netvscPlease keep the alphabetical order.
Ok
Re: [PATCH 3/3] net/netvsc: add hyper-v netvsc network device
05/04/2018 22:59, Stephen Hemminger:
Quoted 9 lines
Quoted 6 lines · On Thu, 05 Apr 2018 22:52:31 +0200 Thomas Monjalon <[email protected]> wrote:
Hi Stephen,
Good to see there is a good progress.
This patch should add an entry in the release notes. But I guess it is not ready for 18.05?
[...]
Quoted 7 lines
Quoted 5 lines
doc/guides/nics/netvsc.rst line 51
Quoted 3 lines
doc/guides/nics/netvsc.rst new file +3
-0+The following prerequisites apply: + +* Linux kernel uio_hv_generic driver that supports subchannels. This should be present in 4.17 or later.The DPDK policy is to wait for prerequisite be available for merging.
Does linux-next count?
I would say no, but I could be convinced of the contrary. Can we have ABI breakage from linux-next to mainline? What is the benefit of pushing the PMD early?
Re: [PATCH 3/3] net/netvsc: add hyper-v netvsc network device
Quoted 18 lines · On Thu, 05 Apr 2018 23:07:45 +0200 Thomas Monjalon <[email protected]> wrote:
05/04/2018 22:59, Stephen Hemminger:
Quoted 9 lines
Quoted 6 lines · On Thu, 05 Apr 2018 22:52:31 +0200 Thomas Monjalon <[email protected]> wrote:
Hi Stephen,
Good to see there is a good progress.
This patch should add an entry in the release notes. But I guess it is not ready for 18.05?
[...]
Quoted 6 lines
Quoted 5 lines
doc/guides/nics/netvsc.rst line 51
Quoted 3 lines
doc/guides/nics/netvsc.rst new file +3
-0+The following prerequisites apply: + +* Linux kernel uio_hv_generic driver that supports subchannels. This should be present in 4.17 or later.The DPDK policy is to wait for prerequisite be available for merging.
Quoted 5 lines
Quoted 1 line
Does linux-next count?
I would say no, but I could be convinced of the contrary. Can we have ABI breakage from linux-next to mainline? What is the benefit of pushing the PMD early?
There are already people using earlier versions and sending feeback.