[v3,05/15] net/netvsc: make event monitor OS dependent

Message ID 20220217160613.70161-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 Feb. 17, 2022, 4:06 p.m. UTC
Event monitoring is not yet supported on FreeBSD, hence moving it
to the OS specific files

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/net/netvsc/freebsd/hn_os.c | 16 ++++++++++++++++
 drivers/net/netvsc/hn_ethdev.c     |  7 +++----
 drivers/net/netvsc/hn_os.h         |  6 ++++++
 drivers/net/netvsc/linux/hn_os.c   | 21 +++++++++++++++++++++
 4 files changed, 46 insertions(+), 4 deletions(-)
 create mode 100644 drivers/net/netvsc/freebsd/hn_os.c
 create mode 100644 drivers/net/netvsc/hn_os.h
 create mode 100644 drivers/net/netvsc/linux/hn_os.c
  

Patch

diff --git a/drivers/net/netvsc/freebsd/hn_os.c b/drivers/net/netvsc/freebsd/hn_os.c
new file mode 100644
index 0000000000..4c6a79872d
--- /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/hn_ethdev.c b/drivers/net/netvsc/hn_ethdev.c
index 8a950403ac..8b1e07b775 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 0000000000..618c53cdcd
--- /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 0000000000..1ea12ce928
--- /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;
+}