From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 527DEA0C53;
	Sun, 15 Aug 2021 16:56:33 +0200 (CEST)
Received: from [217.70.189.124] (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id CC20E40683;
	Sun, 15 Aug 2021 16:56:32 +0200 (CEST)
Received: from mail-pj1-f50.google.com (mail-pj1-f50.google.com
 [209.85.216.50]) by mails.dpdk.org (Postfix) with ESMTP id 5CABD40395
 for <dev@dpdk.org>; Sun, 15 Aug 2021 16:56:31 +0200 (CEST)
Received: by mail-pj1-f50.google.com with SMTP id
 n13-20020a17090a4e0d00b0017946980d8dso9460295pjh.5
 for <dev@dpdk.org>; Sun, 15 Aug 2021 07:56:31 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:date:message-id:mime-version
 :content-transfer-encoding;
 bh=q/tYHwSU7tKNEADcK97Evett/6blGSU3eln9WeG4B18=;
 b=Z9kf3RFfUFrcDz0B67LkdAmG3NKi8Xpl2//EzHBM0KKzGkcgrhGTPsJnZQ2bfVPLpO
 /uuAt+p75vD+otniaP3wwxrARQ1Y+NTkXNx0qRN2SU3MEXvzZcpF+t5qOWBE4PqIixDd
 E9ZwqtIu411wAqxFLoNxTUn+FJN2ABh7MTwSxUoib2QsnvNRQW2djd8o9hKNgfpG8y1Z
 4xU/2xE75kAG2rn6Au+KlotI9cWbe8t0T9Lzo7GQm+ChJkThmAf/r3O+xzuhTOTv5BTW
 1yquvWoWuiMr7+mavnjWizGeU55tGx7Ec1oQ3DoOvl330oMVYtuY1m1IQOLlS8GkOa3y
 khPA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version
 :content-transfer-encoding;
 bh=q/tYHwSU7tKNEADcK97Evett/6blGSU3eln9WeG4B18=;
 b=CrMuTbglbwcXsbZE8jcgzWXuF/DfAo6JAp+Xh4VuYEfzWLUlpurvTzFqBLa377N1Cx
 DYH0/C5ATA83fWPcKB+JOa+FfDuZPpMA7rCwIu/9kCvkR5BmNdygALvQFVOqPrq1I5nY
 bwWYODF3OUS660Wri7X3GTN/ZH9jbN0qx3r4vA9rOtiXZ+0JbT84eBuy56KUv6SlPSV7
 XWfc5W0cbPXhtEPCSua57ZsvZLGDHR1Ra8AJqiY1Fk+MGkmuZ6gw78VANKAlhjwLBG5o
 48pZgzr1mIrE+KEm6TmKEW1XfqqqZYnIo/lwPFqeRkpEfc8dAeM5iVswAaVkndr+AlnK
 Fu0Q==
X-Gm-Message-State: AOAM530uyNf1IekkznnRLQrWl8fX54FNQv7Nozb/szQCt82VIb7kPcZK
 YursDwAKC9ZQpUYCYrO3sFhR6CbZP8R/ZA==
X-Google-Smtp-Source: ABdhPJwxw2WDGJXXscf32y/7x4wiu7aD41IFFrtRX7QAJRksSzvL/f+nT+pCJioauzD8q9QfLv3w/g==
X-Received: by 2002:a17:90a:9cf:: with SMTP id
 73mr12391210pjo.136.1629039390029; 
 Sun, 15 Aug 2021 07:56:30 -0700 (PDT)
Received: from localhost.localdomain (c-67-185-44-206.hsd1.wa.comcast.net.
 [67.185.44.206])
 by smtp.gmail.com with ESMTPSA id t30sm10329724pgl.47.2021.08.15.07.56.28
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Sun, 15 Aug 2021 07:56:28 -0700 (PDT)
From: William Tu <u9012063@gmail.com>
To: dev@dpdk.org
Cc: dmitry.kozliuk@gmail.com,
	ranjit.menon@intel.com
Date: Sun, 15 Aug 2021 14:56:14 +0000
Message-Id: <20210815145614.3826-1-u9012063@gmail.com>
X-Mailer: git-send-email 2.30.2
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Subject: [dpdk-dev] [PATCH RFC] net/virtio: Add virtio support for Windows.
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

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