DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH RFC] net/virtio: Add virtio support for Windows.
@ 2021-08-15 14:56 William Tu
  2021-08-15 19:49 ` Dmitry Kozlyuk
  0 siblings, 1 reply; 3+ messages in thread
From: William Tu @ 2021-08-15 14:56 UTC (permalink / raw)
  To: dev; +Cc: dmitry.kozliuk, ranjit.menon

I looked at Dmitry's patch [1] a while ago and found
that now it's not much work to enable the virtio support.
Pass build, but I haven't tested it yet. I plan to try it on GCP.

[1] http://inbox.dpdk.org/dev/20200228060727.192491-1-dmitry.kozliuk@gmail.com/

Signed-off-by: William Tu <u9012063@gmail.com>
---
 drivers/net/virtio/meson.build                   | 6 ------
 drivers/net/virtio/virtio_ethdev.c               | 4 ++--
 drivers/net/virtio/virtio_pci_ethdev.c           | 2 ++
 drivers/net/virtio/virtio_user/virtio_user_dev.h | 4 ++++
 4 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/net/virtio/meson.build b/drivers/net/virtio/meson.build
index 01a333ada2..14c02ee671 100644
--- a/drivers/net/virtio/meson.build
+++ b/drivers/net/virtio/meson.build
@@ -1,12 +1,6 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2018 Intel Corporation
 
-if is_windows
-    build = false
-    reason = 'not supported on Windows'
-    subdir_done()
-endif
-
 sources += files(
         'virtio.c',
         'virtio_ethdev.c',
diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index e58085a2c9..7dbf6d0ea7 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -198,7 +198,7 @@ virtio_send_command_packed(struct virtnet_ctl *cvq,
 	 * desc_is_used has a load-acquire or rte_io_rmb inside
 	 */
 	while (!desc_is_used(&desc[head], vq))
-		usleep(100);
+		rte_delay_us_sleep(100);
 
 	/* now get used descriptors */
 	vq->vq_free_cnt += nb_descs;
@@ -274,7 +274,7 @@ virtio_send_command_split(struct virtnet_ctl *cvq,
 	virtqueue_notify(vq);
 
 	while (virtqueue_nused(vq) == 0)
-		usleep(100);
+		rte_delay_us_sleep(100);
 
 	while (virtqueue_nused(vq)) {
 		uint32_t idx, desc_idx, used_idx;
diff --git a/drivers/net/virtio/virtio_pci_ethdev.c b/drivers/net/virtio/virtio_pci_ethdev.c
index 4083853c48..03e9dfab71 100644
--- a/drivers/net/virtio/virtio_pci_ethdev.c
+++ b/drivers/net/virtio/virtio_pci_ethdev.c
@@ -220,7 +220,9 @@ static struct rte_pci_driver rte_virtio_net_pci_pmd = {
 
 RTE_INIT(rte_virtio_net_pci_pmd_init)
 {
+#if !(defined(_WIN32) || defined(_WIN64))
 	rte_eal_iopl_init();
+#endif
 	rte_pci_register(&rte_virtio_net_pci_pmd);
 }
 
diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.h b/drivers/net/virtio/virtio_user/virtio_user_dev.h
index 819f6463ba..01cb962770 100644
--- a/drivers/net/virtio/virtio_user/virtio_user_dev.h
+++ b/drivers/net/virtio/virtio_user/virtio_user_dev.h
@@ -11,6 +11,10 @@
 #include "../virtio.h"
 #include "../virtio_ring.h"
 
+#if defined(_WIN32) || defined(_WIN64)
+#define PATH_MAX MAX_PATH
+#endif
+
 enum virtio_user_backend_type {
 	VIRTIO_USER_BACKEND_UNKNOWN,
 	VIRTIO_USER_BACKEND_VHOST_USER,
-- 
2.30.2


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH RFC] net/virtio: Add virtio support for Windows.
  2021-08-15 14:56 [dpdk-dev] [PATCH RFC] net/virtio: Add virtio support for Windows William Tu
@ 2021-08-15 19:49 ` Dmitry Kozlyuk
  2021-08-17  7:45   ` David Marchand
  0 siblings, 1 reply; 3+ messages in thread
From: Dmitry Kozlyuk @ 2021-08-15 19:49 UTC (permalink / raw)
  To: William Tu; +Cc: dev, ranjit.menon

2021-08-15 14:56 (UTC+0000), William Tu:
> I looked at Dmitry's patch [1] a while ago and found
> that now it's not much work to enable the virtio support.
> Pass build, but I haven't tested it yet. I plan to try it on GCP.

1. Build fails, the reason is `__rte_weak`: there are no weak symbols on
Windows. The best solution to this I came up with so far is to create a file
with stubs for weak functions. The `-fno-asynchronous-unwind-tables` flag
will also be required for MinGW to link SSE files.

2. I can say in advance it won't work without an ability to read
capabilities form PCI configuration space (`rte_pci_read_config`).
This requires adding support in bus/pci.

> 
> [1] http://inbox.dpdk.org/dev/20200228060727.192491-1-dmitry.kozliuk@gmail.com/
> 
> Signed-off-by: William Tu <u9012063@gmail.com>
> ---
>  drivers/net/virtio/meson.build                   | 6 ------
>  drivers/net/virtio/virtio_ethdev.c               | 4 ++--
>  drivers/net/virtio/virtio_pci_ethdev.c           | 2 ++
>  drivers/net/virtio/virtio_user/virtio_user_dev.h | 4 ++++
>  4 files changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/net/virtio/meson.build b/drivers/net/virtio/meson.build
> index 01a333ada2..14c02ee671 100644
> --- a/drivers/net/virtio/meson.build
> +++ b/drivers/net/virtio/meson.build
> @@ -1,12 +1,6 @@
>  # SPDX-License-Identifier: BSD-3-Clause
>  # Copyright(c) 2018 Intel Corporation
>  
> -if is_windows
> -    build = false
> -    reason = 'not supported on Windows'
> -    subdir_done()
> -endif
> -
>  sources += files(
>          'virtio.c',
>          'virtio_ethdev.c',
> diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
> index e58085a2c9..7dbf6d0ea7 100644
> --- a/drivers/net/virtio/virtio_ethdev.c
> +++ b/drivers/net/virtio/virtio_ethdev.c
> @@ -198,7 +198,7 @@ virtio_send_command_packed(struct virtnet_ctl *cvq,
>  	 * desc_is_used has a load-acquire or rte_io_rmb inside
>  	 */
>  	while (!desc_is_used(&desc[head], vq))
> -		usleep(100);
> +		rte_delay_us_sleep(100);
>  
>  	/* now get used descriptors */
>  	vq->vq_free_cnt += nb_descs;
> @@ -274,7 +274,7 @@ virtio_send_command_split(struct virtnet_ctl *cvq,
>  	virtqueue_notify(vq);
>  
>  	while (virtqueue_nused(vq) == 0)
> -		usleep(100);
> +		rte_delay_us_sleep(100);
>  
>  	while (virtqueue_nused(vq)) {
>  		uint32_t idx, desc_idx, used_idx;
> diff --git a/drivers/net/virtio/virtio_pci_ethdev.c b/drivers/net/virtio/virtio_pci_ethdev.c
> index 4083853c48..03e9dfab71 100644
> --- a/drivers/net/virtio/virtio_pci_ethdev.c
> +++ b/drivers/net/virtio/virtio_pci_ethdev.c
> @@ -220,7 +220,9 @@ static struct rte_pci_driver rte_virtio_net_pci_pmd = {
>  
>  RTE_INIT(rte_virtio_net_pci_pmd_init)
>  {
> +#if !(defined(_WIN32) || defined(_WIN64))
>  	rte_eal_iopl_init();
> +#endif

I think rte_eal_iopl_init() should not be called from this PMD at all,
because it is allready called by PCI bus driver before probing.

Also, DPDK code should use #ifdef RTE_EXEC_ENV_WINDOWS, etc. to test
if it is building for a specific execution environment.

>  	rte_pci_register(&rte_virtio_net_pci_pmd);
>  }
>  
> diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.h b/drivers/net/virtio/virtio_user/virtio_user_dev.h
> index 819f6463ba..01cb962770 100644
> --- a/drivers/net/virtio/virtio_user/virtio_user_dev.h
> +++ b/drivers/net/virtio/virtio_user/virtio_user_dev.h
> @@ -11,6 +11,10 @@
>  #include "../virtio.h"
>  #include "../virtio_ring.h"
>  
> +#if defined(_WIN32) || defined(_WIN64)
> +#define PATH_MAX MAX_PATH
> +#endif
> +

There's rte_os_shim.h for that.

>  enum virtio_user_backend_type {
>  	VIRTIO_USER_BACKEND_UNKNOWN,
>  	VIRTIO_USER_BACKEND_VHOST_USER,

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH RFC] net/virtio: Add virtio support for Windows.
  2021-08-15 19:49 ` Dmitry Kozlyuk
@ 2021-08-17  7:45   ` David Marchand
  0 siblings, 0 replies; 3+ messages in thread
From: David Marchand @ 2021-08-17  7:45 UTC (permalink / raw)
  To: Dmitry Kozlyuk; +Cc: William Tu, dev, Ranjit Menon

On Sun, Aug 15, 2021 at 9:50 PM Dmitry Kozlyuk <dmitry.kozliuk@gmail.com> wrote:
> > diff --git a/drivers/net/virtio/virtio_pci_ethdev.c b/drivers/net/virtio/virtio_pci_ethdev.c
> > index 4083853c48..03e9dfab71 100644
> > --- a/drivers/net/virtio/virtio_pci_ethdev.c
> > +++ b/drivers/net/virtio/virtio_pci_ethdev.c
> > @@ -220,7 +220,9 @@ static struct rte_pci_driver rte_virtio_net_pci_pmd = {
> >
> >  RTE_INIT(rte_virtio_net_pci_pmd_init)
> >  {
> > +#if !(defined(_WIN32) || defined(_WIN64))
> >       rte_eal_iopl_init();
> > +#endif
>
> I think rte_eal_iopl_init() should not be called from this PMD at all,
> because it is allready called by PCI bus driver before probing.

This call to iopl() must be kept in a pmd constructor (at least on
Linux) so that, for example, the interrupt thread inherits the IO
priviledge level.

>
> Also, DPDK code should use #ifdef RTE_EXEC_ENV_WINDOWS, etc. to test
> if it is building for a specific execution environment.
>
> >       rte_pci_register(&rte_virtio_net_pci_pmd);
> >  }
> >


-- 
David Marchand


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-08-17  7:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-15 14:56 [dpdk-dev] [PATCH RFC] net/virtio: Add virtio support for Windows William Tu
2021-08-15 19:49 ` Dmitry Kozlyuk
2021-08-17  7:45   ` David Marchand

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).