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

Message ID 20220423042849.7718-6-srikanth.k@oneconvergence.com (mailing list archive)
State Awaiting Upstream
Delegated to: Thomas Monjalon
Headers
Series add FreeBSD support to VMBUS & NetVSC PMDs |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Srikanth Kaka April 23, 2022, 4:28 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 c1a3a5f..28f5ff4 100644
--- a/drivers/bus/vmbus/freebsd/vmbus_bus.c
+++ b/drivers/bus/vmbus/freebsd/vmbus_bus.c
@@ -28,6 +28,24 @@ 
 	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)