[08/11] net/netvsc: moving event monitoring support

Message ID 20210927134231.11177-9-srikanth.k@oneconvergence.com (mailing list archive)
State Superseded, archived
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 Sept. 27, 2021, 1:42 p.m. UTC
  Event monitoring is not yet supported on FreeBSD, hence moving it
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 | 14 ++++++++++++++
 drivers/net/netvsc/hn_ethdev.c     |  7 +++----
 drivers/net/netvsc/hn_os.h         |  6 ++++++
 drivers/net/netvsc/linux/hn_os.c   | 19 +++++++++++++++++++
 4 files changed, 42 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
  

Comments

Long Li Nov. 6, 2021, 8:51 p.m. UTC | #1
> Subject: [PATCH 08/11] net/netvsc: moving event monitoring support
> 
> [You don't often get email from srikanth.k@oneconvergence.com. Learn why
> this is important at http://aka.ms/LearnAboutSenderIdentification.]
> 
> Event monitoring is not yet supported on FreeBSD, hence moving it 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>

Reviewed-by: Long Li <longli@microsoft.com>

> ---
>  drivers/net/netvsc/freebsd/hn_os.c | 14 ++++++++++++++
>  drivers/net/netvsc/hn_ethdev.c     |  7 +++----
>  drivers/net/netvsc/hn_os.h         |  6 ++++++
>  drivers/net/netvsc/linux/hn_os.c   | 19 +++++++++++++++++++
>  4 files changed, 42 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
> 
> diff --git a/drivers/net/netvsc/freebsd/hn_os.c
> b/drivers/net/netvsc/freebsd/hn_os.c
> new file mode 100644
> index 0000000000..3bd67e06c8
> --- /dev/null
> +++ b/drivers/net/netvsc/freebsd/hn_os.c
> @@ -0,0 +1,14 @@
> +/* SPDX-License-Identifier: BSD-3-Clause
> + * Copyright(c) 2016-2021 Microsoft Corporation  */
> +
> +#include <stdio.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 6f9053c4d5..61d7d3daeb 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 (DEV_TX_OFFLOAD_IPV4_CKSUM | \
>                             DEV_TX_OFFLOAD_TCP_CKSUM  | \ @@ -1244,11 +1245,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..862dc190c1
> --- /dev/null
> +++ b/drivers/net/netvsc/linux/hn_os.c
> @@ -0,0 +1,19 @@
> +/* SPDX-License-Identifier: BSD-3-Clause
> + * Copyright(c) 2016-2021 Microsoft Corporation  */
> +
> +#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;
> +}
> --
> 2.30.2
  

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..3bd67e06c8
--- /dev/null
+++ b/drivers/net/netvsc/freebsd/hn_os.c
@@ -0,0 +1,14 @@ 
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2016-2021 Microsoft Corporation
+ */
+
+#include <stdio.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 6f9053c4d5..61d7d3daeb 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 (DEV_TX_OFFLOAD_IPV4_CKSUM | \
 			    DEV_TX_OFFLOAD_TCP_CKSUM  | \
@@ -1244,11 +1245,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..862dc190c1
--- /dev/null
+++ b/drivers/net/netvsc/linux/hn_os.c
@@ -0,0 +1,19 @@ 
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2016-2021 Microsoft Corporation
+ */
+
+#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;
+}