From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id DC0A7A0C55; Sun, 15 Aug 2021 21:49:58 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7A79540395; Sun, 15 Aug 2021 21:49:58 +0200 (CEST) Received: from mail-lf1-f54.google.com (mail-lf1-f54.google.com [209.85.167.54]) by mails.dpdk.org (Postfix) with ESMTP id 81E754014F for ; Sun, 15 Aug 2021 21:49:57 +0200 (CEST) Received: by mail-lf1-f54.google.com with SMTP id x27so30370077lfu.5 for ; Sun, 15 Aug 2021 12:49:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=6ybMia+VcFFkEbPNuBL4gmZPBbS8+Iqjtrrmz60BXLI=; b=IDpOBHtovqAq0dEYe75dJ0FE8iOJUsetodPb9Dt7glJMiPilR4AXa83bGal9fWAL1Y CMczmICN214UtCcGmI9W4RI+Qkpr7imPb8sxYNF+pITuuIpSuRQ0WhqGTwijlkQ+Mamc 9ttAvX5tQheklovqcxE1HZJ5H3XDCTwNoTE5hwkSrrFAk0lAXQDluG8Q+dEO27QCWC20 Lzaf8ZPl0aXHat6NRaV01/TxG087klCiJznO4yRItR7l+RUalO22amBmIwThJvh/0CKE 65yP8EOFMvynYcvFae42r42hgI9CBN9DFYRS7nqwCvx32Agx+YQ49dzwpcChdWC6MBFG mprg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=6ybMia+VcFFkEbPNuBL4gmZPBbS8+Iqjtrrmz60BXLI=; b=lj0plUaGxIpxL+TLFyAwCjvgeVKy7P4W7UAl5Vtysotf4BvejW4LZ/I0MwnDYMDs44 5uxiQD494evoTf+KhpVhjO0LKzFGe541Z6J7RGyidyBodbBaur/JxqZmPOEpCtex8nOl 38Eh0GpYe7kEUpTwOW4WGpQtZ98cN983VvsjsGhZ2M0niyiU67jiw+WTAFl8lcRrxxH5 0/TkcQp8T3p1UUayioZBATrgKlgnHYudZDjWlHGmGnAt8MMpTiyNL+WqgC6AqsmYwIN3 XjAcynrxVJtU5Sp1h4p8T9FFl73Ks+NfsdAKkV7z7ACK7z/quS8fJ7CuW39lPl/AWJy6 4fHA== X-Gm-Message-State: AOAM530DIe+mEze6oRYeBVMw+VqHgjOeDpM3eecOhu5Swtvpjxr7+fQv IcSjan/TKrfs4MlM4GoN/Sg= X-Google-Smtp-Source: ABdhPJwjGM/0WQ70JVm40aHRrogPh1RdQHlZNJRK/U7MR5uX4mixaKJHHjVPWuRdS9rH35ygtHyUhA== X-Received: by 2002:a05:6512:2354:: with SMTP id p20mr9060368lfu.262.1629056996983; Sun, 15 Aug 2021 12:49:56 -0700 (PDT) Received: from sovereign (broadband-37-110-65-23.ip.moscow.rt.ru. [37.110.65.23]) by smtp.gmail.com with ESMTPSA id i23sm745968lfo.76.2021.08.15.12.49.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 15 Aug 2021 12:49:56 -0700 (PDT) Date: Sun, 15 Aug 2021 22:49:54 +0300 From: Dmitry Kozlyuk To: William Tu Cc: dev@dpdk.org, ranjit.menon@intel.com Message-ID: <20210815224954.0bfa9266@sovereign> In-Reply-To: <20210815145614.3826-1-u9012063@gmail.com> References: <20210815145614.3826-1-u9012063@gmail.com> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 > --- > 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,