Skip to contentSkip to conversation

bus: add vmbus support

PATCH Superseded Stephen Hemminger 1 participant 1 message Nov 29, 2017

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 bus: add vmbus support

From: Stephen Hemminger <[email protected]>

This patch adds support for an additional bus type VMBUS. Virtual Machine BUS 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.

The bus support is generally useful for doing device detection such as TAP PMD and failsafe PMD. Doing user-mode PMD for Hyper-V requires this bus support as well the uio_hv_generic which is in upstream Linux already.

---
v2 -- get rid of some of obvious checkpatch warnings
there is still some left because checkpatch is too picky and vmbus_reg.h is direct copy from BSD.

 MAINTAINERS                                        |   3 +
 drivers/bus/Makefile                               |   3 +
 drivers/bus/vmbus/Makefile                         |  39 +++
 drivers/bus/vmbus/common/Makefile                  |   8 +
 drivers/bus/vmbus/common/common_bufring.c          | 237 +++++++++++++
 drivers/bus/vmbus/common/common_chan.c             | 309 ++++++++++++++++
 drivers/bus/vmbus/common/common_uio.c              | 261 ++++++++++++++
 drivers/bus/vmbus/common/common_vmbus.c            | 315 +++++++++++++++++
 drivers/bus/vmbus/common/include/rte_vmbus.h       | 389 +++++++++++++++++++++
 drivers/bus/vmbus/common/include/vmbus_logs.h      |  45 +++
 drivers/bus/vmbus/common/include/vmbus_reg.h       | 358 +++++++++++++++++++
 drivers/bus/vmbus/common/vmbus_private.h           | 144 ++++++++
 drivers/bus/vmbus/linuxapp/Makefile                |  51 +++
 .../bus/vmbus/linuxapp/rte_bus_vmbus_version.map   |  21 ++
 drivers/bus/vmbus/linuxapp/vmbus_bus.c             | 384 ++++++++++++++++++++
 drivers/bus/vmbus/linuxapp/vmbus_uio.c             | 216 ++++++++++++
 mk/rte.app.mk                                      |   2 +
 17 files changed, 2785 insertions(+)
 create mode 100644 drivers/bus/vmbus/Makefile
 create mode 100644 drivers/bus/vmbus/common/Makefile
 create mode 100644 drivers/bus/vmbus/common/common_bufring.c
 create mode 100644 drivers/bus/vmbus/common/common_chan.c
 create mode 100644 drivers/bus/vmbus/common/common_uio.c
 create mode 100644 drivers/bus/vmbus/common/common_vmbus.c
 create mode 100644 drivers/bus/vmbus/common/include/rte_vmbus.h
 create mode 100644 drivers/bus/vmbus/common/include/vmbus_logs.h
 create mode 100644 drivers/bus/vmbus/common/include/vmbus_reg.h
 create mode 100644 drivers/bus/vmbus/common/vmbus_private.h
 create mode 100644 drivers/bus/vmbus/linuxapp/Makefile
 create mode 100644 drivers/bus/vmbus/linuxapp/rte_bus_vmbus_version.map
 create mode 100644 drivers/bus/vmbus/linuxapp/vmbus_bus.c
 create mode 100644 drivers/bus/vmbus/linuxapp/vmbus_uio.c
MAINTAINERS +3 -0
index f0baeb4230c2..844373249f3a 100644
@@ -309,6 +309,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
 ------------------
drivers/bus/Makefile +3 -0
index c20beb438781..526218e3b6f1 100644
@@ -35,4 +35,7 @@ DIRS-$(CONFIG_RTE_LIBRTE_FSLMC_BUS) += fslmc
 DIRS-$(CONFIG_RTE_LIBRTE_PCI_BUS) += pci
 DIRS-$(CONFIG_RTE_LIBRTE_VDEV_BUS) += vdev
 
+DIRS-$(CONFIG_RTE_VMBUS) += vmbus
+DEPDIRS-vmbus = $(core-libs)
+
 include $(RTE_SDK)/mk/rte.subdir.mk
drivers/bus/vmbus/Makefile new file +39 -0
new file mode 100644
index 000000000000..886fc7c0dff6
@@ -0,0 +1,39 @@
+#   BSD LICENSE
+#
+#   Copyright(c) 2017 Microsoft Corporation.
+#   All rights reserved.
+#
+#   Redistribution and use in source and binary forms, with or without
+#   modification, are permitted provided that the following conditions
+#   are met:
+#
+#     * Redistributions of source code must retain the above copyright
+#       notice, this list of conditions and the following disclaimer.
+#     * Redistributions in binary form must reproduce the above copyright
+#       notice, this list of conditions and the following disclaimer in
+#       the documentation and/or other materials provided with the
+#       distribution.
+#     * Neither the name of NXP nor the names of its
+#       contributors may be used to endorse or promote products derived
+#       from this software without specific prior written permission.
+#
+#   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+#   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+#   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+#   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+#   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+#   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+#   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+#   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+#   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+#   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+#   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+include $(RTE_SDK)/mk/rte.vars.mk
+
+DIRS-y += common
+DIRS-y += linuxapp
+
+DEPDIRS-linuxapp := common
+
+include $(RTE_SDK)/mk/rte.subdir.mk
drivers/bus/vmbus/common/Makefile new file +8 -0
new file mode 100644
index 000000000000..96dea90e67a2
@@ -0,0 +1,8 @@
+
+include $(RTE_SDK)/mk/rte.vars.mk
+
+INC += rte_vmbus.h vmbus_reg.h
+
+SYMLINK-$(CONFIG_RTE_LIBRTE_EAL)-include := $(addprefix include/,$(INC))
+
+include $(RTE_SDK)/mk/rte.install.mk
drivers/bus/vmbus/common/common_bufring.c new file +237 -0

237 lines not on this page · raw message

drivers/bus/vmbus/common/common_chan.c new file +309 -0

309 lines not on this page · raw message

drivers/bus/vmbus/common/common_uio.c new file +261 -0

261 lines not on this page · raw message

drivers/bus/vmbus/common/common_vmbus.c new file +315 -0

315 lines not on this page · raw message

drivers/bus/vmbus/common/include/rte_vmbus.h new file +389 -0

389 lines not on this page · raw message

drivers/bus/vmbus/common/include/vmbus_logs.h new file +45 -0

45 lines not on this page · raw message

drivers/bus/vmbus/common/include/vmbus_reg.h new file +358 -0

358 lines not on this page · raw message

drivers/bus/vmbus/common/vmbus_private.h new file +144 -0

144 lines not on this page · raw message

drivers/bus/vmbus/linuxapp/Makefile new file +51 -0

51 lines not on this page · raw message

drivers/bus/vmbus/linuxapp/rte_bus_vmbus_version.map new file +21 -0
new file mode 100644
index 000000000000..fc96bbbf6fe9
@@ -0,0 +1,21 @@
+DPDK_17.08 {
+	global:
+
+	rte_vmbus_chan_close;
+	rte_vmbus_chan_open;
+	rte_vmbus_chan_recv;
+	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/linuxapp/vmbus_bus.c new file +384 -0

384 lines not on this page · raw message

drivers/bus/vmbus/linuxapp/vmbus_uio.c new file +216 -0

216 lines not on this page · raw message

mk/rte.app.mk +2 -0
index 6a6a7452e2f9..203b7a8c95fe 100644
@@ -162,6 +162,8 @@ _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_VMBUS)		    += -lrte_bus_vmbus -luuid
+
 ifeq ($(CONFIG_RTE_LIBRTE_CRYPTODEV),y)
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_MB)    += -lrte_pmd_aesni_mb
 _LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_AESNI_MB)    += -L$(AESNI_MULTI_BUFFER_LIB_PATH) -lIPSec_MB
Signature · 1 line
2.11.0