[v5,01/14] bus/vmbus: move independent code from Linux

Message ID 20220423042849.7718-2-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
Move the OS independent code from Linux dir in-order to be used
by FreeBSD

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/linux/vmbus_bus.c     | 13 +------------
 drivers/bus/vmbus/meson.build           |  5 +++++
 drivers/bus/vmbus/unix/vmbus_unix.h     | 11 +++++++++++
 drivers/bus/vmbus/unix/vmbus_unix_bus.c | 20 ++++++++++++++++++++
 4 files changed, 37 insertions(+), 12 deletions(-)
 create mode 100644 drivers/bus/vmbus/unix/vmbus_unix.h
 create mode 100644 drivers/bus/vmbus/unix/vmbus_unix_bus.c
  

Patch

diff --git a/drivers/bus/vmbus/linux/vmbus_bus.c b/drivers/bus/vmbus/linux/vmbus_bus.c
index f502783..e649537 100644
--- a/drivers/bus/vmbus/linux/vmbus_bus.c
+++ b/drivers/bus/vmbus/linux/vmbus_bus.c
@@ -21,22 +21,11 @@ 
 
 #include "eal_filesystem.h"
 #include "private.h"
+#include "vmbus_unix.h"
 
 /** Pathname of VMBUS devices directory. */
 #define SYSFS_VMBUS_DEVICES "/sys/bus/vmbus/devices"
 
-/*
- * GUID associated with network devices
- * {f8615163-df3e-46c5-913f-f2d2f965ed0e}
- */
-static const rte_uuid_t vmbus_nic_uuid = {
-	0xf8, 0x61, 0x51, 0x63,
-	0xdf, 0x3e,
-	0x46, 0xc5,
-	0x91, 0x3f,
-	0xf2, 0xd2, 0xf9, 0x65, 0xed, 0xe
-};
-
 extern struct rte_vmbus_bus rte_vmbus_bus;
 
 /* Read sysfs file to get UUID */
diff --git a/drivers/bus/vmbus/meson.build b/drivers/bus/vmbus/meson.build
index 3892cbf..01ef01f 100644
--- a/drivers/bus/vmbus/meson.build
+++ b/drivers/bus/vmbus/meson.build
@@ -16,6 +16,11 @@  sources = files(
         'vmbus_common_uio.c',
 )
 
+includes += include_directories('unix')
+sources += files(
+	'unix/vmbus_unix_bus.c'
+)
+
 if is_linux
     sources += files('linux/vmbus_bus.c',
             'linux/vmbus_uio.c')
diff --git a/drivers/bus/vmbus/unix/vmbus_unix.h b/drivers/bus/vmbus/unix/vmbus_unix.h
new file mode 100644
index 0000000..2db9399
--- /dev/null
+++ b/drivers/bus/vmbus/unix/vmbus_unix.h
@@ -0,0 +1,11 @@ 
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2018, Microsoft Corporation.
+ * All Rights Reserved.
+ */
+
+#ifndef _VMBUS_BUS_UNIX_H_
+#define _VMBUS_BUS_UNIX_H_
+
+extern const rte_uuid_t vmbus_nic_uuid;
+
+#endif /* _VMBUS_BUS_UNIX_H_ */
diff --git a/drivers/bus/vmbus/unix/vmbus_unix_bus.c b/drivers/bus/vmbus/unix/vmbus_unix_bus.c
new file mode 100644
index 0000000..f76a361
--- /dev/null
+++ b/drivers/bus/vmbus/unix/vmbus_unix_bus.c
@@ -0,0 +1,20 @@ 
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2018, Microsoft Corporation.
+ * All Rights Reserved.
+ */
+
+#include <rte_uuid.h>
+
+#include "vmbus_unix.h"
+
+/*
+ * GUID associated with network devices
+ * {f8615163-df3e-46c5-913f-f2d2f965ed0e}
+ */
+const rte_uuid_t vmbus_nic_uuid = {
+	0xf8, 0x61, 0x51, 0x63,
+	0xdf, 0x3e,
+	0x46, 0xc5,
+	0x91, 0x3f,
+	0xf2, 0xd2, 0xf9, 0x65, 0xed, 0xe
+};