- Event monitoring is not yet supported on FreeBSD, hence moving it
to the OS specific files
- Add meson support to OS environment

Signed-off-by: Srikanth Kaka <srikant...@oneconvergence.com>
Signed-off-by: Vag Singh <vag.si...@oneconvergence.com>
Signed-off-by: Anand Thulasiram <av...@juniper.net>
---
 drivers/net/netvsc/freebsd/hn_os.c     | 16 ++++++++++++++++
 drivers/net/netvsc/freebsd/meson.build |  6 ++++++
 drivers/net/netvsc/hn_ethdev.c         |  7 +++----
 drivers/net/netvsc/hn_os.h             |  6 ++++++
 drivers/net/netvsc/linux/hn_os.c       | 21 +++++++++++++++++++++
 drivers/net/netvsc/linux/meson.build   |  6 ++++++
 drivers/net/netvsc/meson.build         |  3 +++
 7 files changed, 61 insertions(+), 4 deletions(-)
 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

diff --git a/drivers/net/netvsc/freebsd/hn_os.c 
b/drivers/net/netvsc/freebsd/hn_os.c
new file mode 100644
index 0000000..4c6a798
--- /dev/null
+++ b/drivers/net/netvsc/freebsd/hn_os.c
@@ -0,0 +1,16 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2016-2021 Microsoft Corporation
+ */
+
+#include <stdio.h>
+
+#include <rte_common.h>
+
+#include "hn_logs.h"
+#include "hn_os.h"
+
+int eth_hn_os_dev_event(void)
+{
+       PMD_DRV_LOG(DEBUG, "rte_dev_event_monitor_start not supported on 
FreeBSD");
+       return 0;
+}
diff --git a/drivers/net/netvsc/freebsd/meson.build 
b/drivers/net/netvsc/freebsd/meson.build
new file mode 100644
index 0000000..78f824f
--- /dev/null
+++ b/drivers/net/netvsc/freebsd/meson.build
@@ -0,0 +1,6 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2018 Microsoft Corporation
+
+sources += files(
+       'hn_os.c',
+)
diff --git a/drivers/net/netvsc/hn_ethdev.c b/drivers/net/netvsc/hn_ethdev.c
index 8a95040..8b1e07b 100644
--- a/drivers/net/netvsc/hn_ethdev.c
+++ b/drivers/net/netvsc/hn_ethdev.c
@@ -39,6 +39,7 @@
 #include "hn_rndis.h"
 #include "hn_nvs.h"
 #include "ndis.h"
+#include "hn_os.h"
 
 #define HN_TX_OFFLOAD_CAPS (RTE_ETH_TX_OFFLOAD_IPV4_CKSUM | \
                            RTE_ETH_TX_OFFLOAD_TCP_CKSUM  | \
@@ -1240,11 +1241,9 @@ static int eth_hn_probe(struct rte_vmbus_driver *drv 
__rte_unused,
 
        PMD_INIT_FUNC_TRACE();
 
-       ret = rte_dev_event_monitor_start();
-       if (ret) {
-               PMD_DRV_LOG(ERR, "Failed to start device event monitoring");
+       ret = eth_hn_os_dev_event();
+       if (ret)
                return ret;
-       }
 
        eth_dev = eth_dev_vmbus_allocate(dev, sizeof(struct hn_data));
        if (!eth_dev)
diff --git a/drivers/net/netvsc/hn_os.h b/drivers/net/netvsc/hn_os.h
new file mode 100644
index 0000000..618c53c
--- /dev/null
+++ b/drivers/net/netvsc/hn_os.h
@@ -0,0 +1,6 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2009-2021 Microsoft Corp.
+ * All rights reserved.
+ */
+
+int eth_hn_os_dev_event(void);
diff --git a/drivers/net/netvsc/linux/hn_os.c b/drivers/net/netvsc/linux/hn_os.c
new file mode 100644
index 0000000..1ea12ce
--- /dev/null
+++ b/drivers/net/netvsc/linux/hn_os.c
@@ -0,0 +1,21 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2016-2021 Microsoft Corporation
+ */
+
+#include <unistd.h>
+
+#include <rte_ethdev.h>
+
+#include "hn_logs.h"
+#include "hn_os.h"
+
+int eth_hn_os_dev_event(void)
+{
+       int ret;
+
+       ret = rte_dev_event_monitor_start();
+       if (ret)
+               PMD_DRV_LOG(ERR, "Failed to start device event monitoring");
+
+       return ret;
+}
diff --git a/drivers/net/netvsc/linux/meson.build 
b/drivers/net/netvsc/linux/meson.build
new file mode 100644
index 0000000..78f824f
--- /dev/null
+++ b/drivers/net/netvsc/linux/meson.build
@@ -0,0 +1,6 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2018 Microsoft Corporation
+
+sources += files(
+       'hn_os.c',
+)
diff --git a/drivers/net/netvsc/meson.build b/drivers/net/netvsc/meson.build
index bb6225d..c50414d 100644
--- a/drivers/net/netvsc/meson.build
+++ b/drivers/net/netvsc/meson.build
@@ -8,6 +8,7 @@ if is_windows
 endif
 
 deps += 'bus_vmbus'
+includes += include_directories(exec_env)
 sources = files(
         'hn_ethdev.c',
         'hn_nvs.c',
@@ -15,3 +16,5 @@ sources = files(
         'hn_rxtx.c',
         'hn_vf.c',
 )
+
+subdir(exec_env)
-- 
1.8.3.1

Reply via email to