DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 00/11] add FreeBSD support to VMBUS & NetVSC PMDs
@ 2021-09-27 13:42 Srikanth Kaka
  2021-09-27 13:42 ` [dpdk-dev] [PATCH 01/11] bus/vmbus: stub for FreeBSD support Srikanth Kaka
                   ` (12 more replies)
  0 siblings, 13 replies; 85+ messages in thread
From: Srikanth Kaka @ 2021-09-27 13:42 UTC (permalink / raw)
  To: Stephen Hemminger, Long Li
  Cc: dev, Vag Singh, Anand Thulasiram, Srikanth Kaka

This patch series adds support to VMBUS & NetVSC PMDs run on FreeBSD

Srikanth Kaka (11):
  bus/vmbus: stub for FreeBSD support
  bus/vmbus: scan and get the network device
  bus/vmbus: handle mapping of device resources
  bus/vmbus: get device resource values using sysctl
  bus/vmbus: open subchannels
  net/netvsc: request HV_UIO to open sub-channels
  bus/vmbus: map the subchannel resources
  net/netvsc: moving event monitoring support
  net/netvsc: moving hotplug retry to OS dir
  bus/vmbus: add meson suport for FreeBSD OS
  net/netvsc: add meson support for FreeBSD

 drivers/bus/vmbus/freebsd/vmbus_bus.c  | 296 +++++++++++++++
 drivers/bus/vmbus/freebsd/vmbus_uio.c  | 499 +++++++++++++++++++++++++
 drivers/bus/vmbus/linux/vmbus_uio.c    |   8 +
 drivers/bus/vmbus/meson.build          |   6 +-
 drivers/bus/vmbus/private.h            |   1 +
 drivers/bus/vmbus/rte_bus_vmbus.h      |  10 +
 drivers/bus/vmbus/version.map          |   1 +
 drivers/bus/vmbus/vmbus_channel.c      |   5 +
 drivers/net/netvsc/freebsd/hn_os.c     |  22 ++
 drivers/net/netvsc/freebsd/meson.build |   6 +
 drivers/net/netvsc/hn_ethdev.c         |  95 +----
 drivers/net/netvsc/hn_os.h             |   8 +
 drivers/net/netvsc/linux/hn_os.c       | 111 ++++++
 drivers/net/netvsc/linux/meson.build   |   6 +
 drivers/net/netvsc/meson.build         |   4 +
 15 files changed, 989 insertions(+), 89 deletions(-)
 create mode 100644 drivers/bus/vmbus/freebsd/vmbus_bus.c
 create mode 100644 drivers/bus/vmbus/freebsd/vmbus_uio.c
 create mode 100644 drivers/net/netvsc/freebsd/hn_os.c
 create mode 100644 drivers/net/netvsc/freebsd/meson.build
 create mode 100644 drivers/net/netvsc/hn_os.h
 create mode 100644 drivers/net/netvsc/linux/hn_os.c
 create mode 100644 drivers/net/netvsc/linux/meson.build

-- 
2.30.2


^ permalink raw reply	[flat|nested] 85+ messages in thread
* [dpdk-dev] [PATCH v2 05/11] bus/vmbus: open subchannels
@ 2021-10-08  9:17 Srikanth Kaka
  0 siblings, 0 replies; 85+ messages in thread
From: Srikanth Kaka @ 2021-10-08  9:17 UTC (permalink / raw)
  To: Stephen Hemminger, Long Li; +Cc: dev, Vag Singh, Anand Thulasiram, srikanth-oc

From: srikanth-oc <srikanth.k@oneconvergence.com>

In FreeBSD, unlike Linux there is no sub-channel open callback that
could be called by HV_UIO driver, upon their grant by the hypervisor.
Thus, the PMD makes an IOCTL to the HV_UIO to open the granted
sub-channels

v2 - Added comment in linux/vmbus_uio.c

Signed-off-by: Srikanth Kaka <srikanth.k@oneconvergence.com>
Signed-off-by: Vag Singh <vag.singh@oneconvergence.com>
Signed-off-by: Anand Thulasiram <avelu@juniper.net>
---
 drivers/bus/vmbus/freebsd/vmbus_uio.c | 31 +++++++++++++++++++++++++++
 drivers/bus/vmbus/linux/vmbus_uio.c   | 12 +++++++++++
 drivers/bus/vmbus/private.h           |  1 +
 drivers/bus/vmbus/rte_bus_vmbus.h     | 10 +++++++++
 drivers/bus/vmbus/version.map         |  1 +
 drivers/bus/vmbus/vmbus_channel.c     |  5 +++++
 6 files changed, 60 insertions(+)

diff --git a/drivers/bus/vmbus/freebsd/vmbus_uio.c b/drivers/bus/vmbus/freebsd/vmbus_uio.c
index fdd37dac3a..022ac85302 100644
--- a/drivers/bus/vmbus/freebsd/vmbus_uio.c
+++ b/drivers/bus/vmbus/freebsd/vmbus_uio.c
@@ -12,6 +12,7 @@
 #include <sys/mman.h>
 #include <sys/types.h>
 #include <sys/sysctl.h>
+#include <sys/ioctl.h>
 
 #include <rte_log.h>
 #include <rte_bus.h>
@@ -26,6 +27,9 @@
 /** Pathname of VMBUS devices directory. */
 #define SYSFS_VMBUS_DEVICES "/sys/bus/vmbus/devices"
 
+/* ioctl */
+#define HVIOOPENSUBCHAN     _IOW('h', 14, uint32_t)
+
 const char *driver_name = "hv_uio";
 static void *vmbus_map_addr;
 
@@ -515,3 +519,30 @@ int vmbus_uio_get_subchan(struct vmbus_channel *primary,
 	closedir(chan_dir);
 	return err;
 }
+
+int vmbus_uio_subchan_open(struct rte_vmbus_device *dev, uint32_t subchan)
+{
+	struct mapped_vmbus_resource *uio_res;
+	int fd, err = 0;
+
+	uio_res = vmbus_uio_find_resource(dev);
+	if (!uio_res) {
+		VMBUS_LOG(ERR, "cannot find uio resource");
+		return -EINVAL;
+	}
+
+	fd = open(uio_res->path, O_RDWR);
+	if (fd < 0) {
+		VMBUS_LOG(ERR, "Cannot open %s: %s",
+				uio_res->path, strerror(errno));
+		return -1;
+	}
+
+	if (ioctl(fd, HVIOOPENSUBCHAN, &subchan)) {
+		VMBUS_LOG(ERR, "open subchan ioctl failed %s: %s",
+				uio_res->path, strerror(errno));
+		err = -1;
+	}
+	close(fd);
+	return err;
+}
diff --git a/drivers/bus/vmbus/linux/vmbus_uio.c b/drivers/bus/vmbus/linux/vmbus_uio.c
index b52ca5bf1d..29e889347a 100644
--- a/drivers/bus/vmbus/linux/vmbus_uio.c
+++ b/drivers/bus/vmbus/linux/vmbus_uio.c
@@ -451,3 +451,15 @@ int vmbus_uio_get_subchan(struct vmbus_channel *primary,
 	closedir(chan_dir);
 	return err;
 }
+
+/*
+ * This is a stub function and it should always succeed.
+ * The Linux UIO kernel driver opens the subchannels implicitly.
+ */
+int vmbus_uio_subchan_open(struct rte_vmbus_device *dev,
+			   uint32_t subchan)
+{
+	RTE_SET_USED(dev);
+	RTE_SET_USED(subchan);
+	return 0;
+}
diff --git a/drivers/bus/vmbus/private.h b/drivers/bus/vmbus/private.h
index 528d60a42f..968f0b6f23 100644
--- a/drivers/bus/vmbus/private.h
+++ b/drivers/bus/vmbus/private.h
@@ -107,6 +107,7 @@ int vmbus_uio_get_subchan(struct vmbus_channel *primary,
 int vmbus_uio_map_rings(struct vmbus_channel *chan);
 int vmbus_uio_map_secondary_subchan(const struct rte_vmbus_device *dev,
 				    const struct vmbus_channel *chan);
+int vmbus_uio_subchan_open(struct rte_vmbus_device *device, uint32_t subchan);
 
 void vmbus_br_setup(struct vmbus_br *br, void *buf, unsigned int blen);
 
diff --git a/drivers/bus/vmbus/rte_bus_vmbus.h b/drivers/bus/vmbus/rte_bus_vmbus.h
index 6bcff66468..60c5812706 100644
--- a/drivers/bus/vmbus/rte_bus_vmbus.h
+++ b/drivers/bus/vmbus/rte_bus_vmbus.h
@@ -404,6 +404,16 @@ void rte_vmbus_chan_dump(FILE *f, const struct vmbus_channel *chan);
  */
 void rte_vmbus_unregister(struct rte_vmbus_driver *driver);
 
+/**
+ * Perform IOCTL to VMBUS device
+ *
+ * @param device
+ *	A pointer to a rte_vmbus_device structure
+ * @param subchan
+ *	Count of subchannels to open
+ */
+int rte_vmbus_ioctl(struct rte_vmbus_device *device, uint32_t subchan);
+
 /** Helper for VMBUS device registration from driver instance */
 #define RTE_PMD_REGISTER_VMBUS(nm, vmbus_drv)		\
 	RTE_INIT(vmbusinitfn_ ##nm)			\
diff --git a/drivers/bus/vmbus/version.map b/drivers/bus/vmbus/version.map
index 3cadec7fae..3509d4fc14 100644
--- a/drivers/bus/vmbus/version.map
+++ b/drivers/bus/vmbus/version.map
@@ -23,6 +23,7 @@ DPDK_22 {
 	rte_vmbus_subchan_open;
 	rte_vmbus_unmap_device;
 	rte_vmbus_unregister;
+	rte_vmbus_ioctl;
 
 	local: *;
 };
diff --git a/drivers/bus/vmbus/vmbus_channel.c b/drivers/bus/vmbus/vmbus_channel.c
index f67f1c438a..f53a1b6511 100644
--- a/drivers/bus/vmbus/vmbus_channel.c
+++ b/drivers/bus/vmbus/vmbus_channel.c
@@ -367,6 +367,11 @@ int rte_vmbus_max_channels(const struct rte_vmbus_device *device)
 		return 1;
 }
 
+int rte_vmbus_ioctl(struct rte_vmbus_device *device, uint32_t subchan)
+{
+	return vmbus_uio_subchan_open(device, subchan);
+}
+
 /* Setup secondary channel */
 int rte_vmbus_subchan_open(struct vmbus_channel *primary,
 			   struct vmbus_channel **new_chan)
-- 
2.30.1


^ permalink raw reply	[flat|nested] 85+ messages in thread

end of thread, other threads:[~2023-08-10 15:44 UTC | newest]

Thread overview: 85+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-27 13:42 [dpdk-dev] [PATCH 00/11] add FreeBSD support to VMBUS & NetVSC PMDs Srikanth Kaka
2021-09-27 13:42 ` [dpdk-dev] [PATCH 01/11] bus/vmbus: stub for FreeBSD support Srikanth Kaka
2021-11-06 20:44   ` Long Li
2021-09-27 13:42 ` [dpdk-dev] [PATCH 02/11] bus/vmbus: scan and get the network device Srikanth Kaka
2021-10-08 11:39   ` [dpdk-dev] [PATCH v2 " Srikanth Kaka
2021-09-27 13:42 ` [dpdk-dev] [PATCH 03/11] bus/vmbus: handle mapping of device resources Srikanth Kaka
2021-09-27 13:42 ` [dpdk-dev] [PATCH 04/11] bus/vmbus: get device resource values using sysctl Srikanth Kaka
2021-09-27 13:42 ` [dpdk-dev] [PATCH 05/11] bus/vmbus: open subchannels Srikanth Kaka
2021-09-30 23:17   ` Long Li
2021-10-08 11:41   ` [dpdk-dev] [PATCH v2 " Srikanth Kaka
2021-11-06 20:49     ` Long Li
2022-02-08 16:35       ` Thomas Monjalon
2021-09-27 13:42 ` [dpdk-dev] [PATCH 06/11] net/netvsc: request HV_UIO to open sub-channels Srikanth Kaka
2021-09-30 23:19   ` Long Li
2021-10-01  5:31     ` Srikanth K
2021-09-27 13:42 ` [dpdk-dev] [PATCH 07/11] bus/vmbus: map the subchannel resources Srikanth Kaka
2021-09-27 13:42 ` [dpdk-dev] [PATCH 08/11] net/netvsc: moving event monitoring support Srikanth Kaka
2021-11-06 20:51   ` Long Li
2021-09-27 13:42 ` [dpdk-dev] [PATCH 09/11] net/netvsc: moving hotplug retry to OS dir Srikanth Kaka
2021-11-06 20:54   ` Long Li
2021-09-27 13:42 ` [dpdk-dev] [PATCH 10/11] bus/vmbus: add meson support for FreeBSD OS Srikanth Kaka
2021-11-06 20:54   ` Long Li
2021-09-27 13:42 ` [dpdk-dev] [PATCH 11/11] net/netvsc: add meson support for FreeBSD Srikanth Kaka
2021-10-08 11:42   ` [dpdk-dev] [PATCH v2 " Srikanth Kaka
2021-11-06 20:50     ` Long Li
2021-09-30 23:25 ` [dpdk-dev] [PATCH 00/11] add FreeBSD support to VMBUS & NetVSC PMDs Long Li
2022-02-17 16:05 ` [PATCH v3 00/15] " Srikanth Kaka
2022-02-17 16:05   ` [PATCH v3 01/15] bus/vmbus: scan and get the network device Srikanth Kaka
2022-02-17 16:29     ` Stephen Hemminger
2022-02-17 16:06   ` [PATCH v3 02/15] bus/vmbus: handle mapping of device resources Srikanth Kaka
2022-02-17 16:06   ` [PATCH v3 03/15] bus/vmbus: get device resource values using sysctl Srikanth Kaka
2022-02-17 16:06   ` [PATCH v3 04/15] bus/vmbus: add resource by index Srikanth Kaka
2022-02-17 16:06   ` [PATCH v3 05/15] net/netvsc: make event monitor OS dependent Srikanth Kaka
2022-02-17 16:06   ` [PATCH v3 06/15] bus/vmbus: add ring mapping APIs Srikanth Kaka
2022-02-17 16:06   ` [PATCH v3 07/15] bus/vmbus: add stub for subchannel support API Srikanth Kaka
2022-02-17 16:06   ` [PATCH v3 08/15] bus/vmbus: open subchannels Srikanth Kaka
2022-02-17 16:06   ` [PATCH v3 09/15] net/netvsc: make IOCTL call to " Srikanth Kaka
2022-02-17 16:06   ` [PATCH v3 10/15] bus/vmbus: get subchannel info Srikanth Kaka
2022-02-17 16:06   ` [PATCH v3 11/15] net/netvsc: moving hotplug retry to OS dir Srikanth Kaka
2022-02-17 16:06   ` [PATCH v3 12/15] bus/vmbus: add meson support for FreeBSD Srikanth Kaka
2022-02-17 16:06   ` [PATCH v3 13/15] net/netvsc: " Srikanth Kaka
2022-02-17 16:06   ` [PATCH v3 14/15] bus/vmbus: add APIs to mask/unmask IRQs Srikanth Kaka
2022-02-17 16:06   ` [PATCH v3 15/15] bus/vmbus: update MAINTAINERS and docs Srikanth Kaka
2022-04-18  4:29     ` [PATCH v4 00/14] add FreeBSD support to VMBUS & NetVSC PMDs Srikanth Kaka
2022-04-18  4:29       ` [PATCH v4 01/14] bus/vmbus: move independent code from Linux Srikanth Kaka
2022-04-19 14:49         ` Stephen Hemminger
2022-04-19 14:52           ` Srikanth K
2022-04-18  4:29       ` [PATCH v4 02/14] bus/vmbus: move independent bus functions Srikanth Kaka
2022-04-18  4:29       ` [PATCH v4 03/14] bus/vmbus: move OS independent UIO functions Srikanth Kaka
2022-04-18  4:29       ` [PATCH v4 04/14] bus/vmbus: scan and get the network device on FreeBSD Srikanth Kaka
2022-04-18  4:29       ` [PATCH v4 05/14] bus/vmbus: handle mapping of device resources Srikanth Kaka
2022-04-18  4:29       ` [PATCH v4 06/14] bus/vmbus: get device resource values using sysctl Srikanth Kaka
2022-04-18  4:29       ` [PATCH v4 07/14] net/netvsc: make event monitor OS dependent Srikanth Kaka
2022-04-18  4:29       ` [PATCH v4 08/14] bus/vmbus: add sub-channel mapping support Srikanth Kaka
2022-04-18  4:29       ` [PATCH v4 09/14] bus/vmbus: open subchannels Srikanth Kaka
2022-04-19 15:00         ` Stephen Hemminger
2022-04-18  4:29       ` [PATCH v4 10/14] net/netvsc: make IOCTL call to " Srikanth Kaka
2022-04-18  4:29       ` [PATCH v4 11/14] bus/vmbus: get subchannel info Srikanth Kaka
2022-04-19 14:51         ` Stephen Hemminger
2022-04-18  4:29       ` [PATCH v4 12/14] net/netvsc: moving hotplug retry to OS dir Srikanth Kaka
2022-04-18  4:29       ` [PATCH v4 13/14] bus/vmbus: add meson support for FreeBSD Srikanth Kaka
2022-04-18  4:29       ` [PATCH v4 14/14] bus/vmbus: update MAINTAINERS and docs Srikanth Kaka
2022-04-23  4:28       ` [PATCH v5 00/14] add FreeBSD support to VMBUS & NetVSC PMDs Srikanth Kaka
2022-04-23  4:28         ` [PATCH v5 01/14] bus/vmbus: move independent code from Linux Srikanth Kaka
2022-04-23  4:28         ` [PATCH v5 02/14] bus/vmbus: move independent bus functions Srikanth Kaka
2022-04-23  4:28         ` [PATCH v5 03/14] bus/vmbus: move OS independent UIO functions Srikanth Kaka
2022-04-23  4:28         ` [PATCH v5 04/14] bus/vmbus: scan and get the network device on FreeBSD Srikanth Kaka
2022-04-23  4:28         ` [PATCH v5 05/14] bus/vmbus: handle mapping of device resources Srikanth Kaka
2022-04-23  4:28         ` [PATCH v5 06/14] bus/vmbus: get device resource values using sysctl Srikanth Kaka
2022-04-23  4:28         ` [PATCH v5 07/14] net/netvsc: make event monitor OS dependent Srikanth Kaka
2022-04-23  4:28         ` [PATCH v5 08/14] bus/vmbus: add sub-channel mapping support Srikanth Kaka
2022-04-23  4:28         ` [PATCH v5 09/14] bus/vmbus: open subchannels Srikanth Kaka
2023-08-10 15:41           ` Stephen Hemminger
2022-04-23  4:28         ` [PATCH v5 10/14] net/netvsc: make IOCTL call to " Srikanth Kaka
2022-04-23  4:28         ` [PATCH v5 11/14] bus/vmbus: get subchannel info Srikanth Kaka
2022-04-23  4:28         ` [PATCH v5 12/14] net/netvsc: moving hotplug retry to OS dir Srikanth Kaka
2022-04-23  4:28         ` [PATCH v5 13/14] bus/vmbus: add meson support for FreeBSD Srikanth Kaka
2022-04-23  4:28         ` [PATCH v5 14/14] bus/vmbus: update MAINTAINERS and docs Srikanth Kaka
2023-08-10 15:44           ` Stephen Hemminger
2022-05-18  8:18         ` [PATCH v5 00/14] add FreeBSD support to VMBUS & NetVSC PMDs Thomas Monjalon
2022-10-06 14:58           ` Thomas Monjalon
2023-07-04  0:07             ` Stephen Hemminger
2022-04-14  8:54   ` [PATCH v3 00/15] " Thomas Monjalon
2022-04-14  9:01     ` Srikanth K
2021-10-08  9:17 [dpdk-dev] [PATCH v2 05/11] bus/vmbus: open subchannels Srikanth Kaka

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).