[v4,07/14] net/netvsc: make event monitor OS dependent
Checks
Commit Message
- 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 <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/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
new file mode 100644
@@ -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;
+}
new file mode 100644
@@ -0,0 +1,6 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2018 Microsoft Corporation
+
+sources += files(
+ 'hn_os.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)
new file mode 100644
@@ -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);
new file mode 100644
@@ -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;
+}
new file mode 100644
@@ -0,0 +1,6 @@
+# SPDX-License-Identifier: BSD-3-Clause
+# Copyright(c) 2018 Microsoft Corporation
+
+sources += files(
+ 'hn_os.c',
+)
@@ -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)