[v4,05/14] bus/vmbus: handle mapping of device resources

Message ID 20220418042915.5765-6-srikanth.k@oneconvergence.com (mailing list archive)
State Superseded, archived
Headers
Series add FreeBSD support to VMBUS & NetVSC PMDs |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Srikanth Kaka April 18, 2022, 4:29 a.m. UTC
All resource values are published by HV_UIO driver as sysctl key
value pairs and they are read at a later point of the code flow

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_bus.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)
  

Patch

diff --git a/drivers/bus/vmbus/freebsd/vmbus_bus.c b/drivers/bus/vmbus/freebsd/vmbus_bus.c
index 8cf3bc5a6a..afa1e74976 100644
--- a/drivers/bus/vmbus/freebsd/vmbus_bus.c
+++ b/drivers/bus/vmbus/freebsd/vmbus_bus.c
@@ -28,6 +28,24 @@  parse_sysfs_uuid(const char *filename, rte_uuid_t uu)
 	return 0;
 }
 
+/* map the resources of a vmbus device in virtual memory */
+int
+rte_vmbus_map_device(struct rte_vmbus_device *dev)
+{
+	if (dev->uio_num < 0) {
+		VMBUS_LOG(DEBUG, "Not managed by UIO driver, skipped");
+		return 1;
+	}
+
+	return vmbus_uio_map_resource(dev);
+}
+
+void
+rte_vmbus_unmap_device(struct rte_vmbus_device *dev)
+{
+	vmbus_uio_unmap_resource(dev);
+}
+
 /* Scan one vmbus entry, and fill the devices list from it. */
 static int
 vmbus_scan_one(const char *name, unsigned int unit_num)