]> git.droids-corp.org - dpdk.git/commitdiff
bus/pci: introduce Windows support with stubs
authorTal Shnaiderman <talshn@mellanox.com>
Mon, 29 Jun 2020 12:37:39 +0000 (15:37 +0300)
committerThomas Monjalon <thomas@monjalon.net>
Mon, 29 Jun 2020 22:02:54 +0000 (00:02 +0200)
Addition of stub eal and bus/pci functions to compile
bus/pci for Windows.

Signed-off-by: Tal Shnaiderman <talshn@mellanox.com>
20 files changed:
drivers/baseband/meson.build
drivers/bus/ifpga/meson.build
drivers/bus/pci/meson.build
drivers/bus/pci/pci_common.c
drivers/bus/pci/windows/pci.c [new file with mode: 0644]
drivers/bus/vdev/meson.build
drivers/bus/vmbus/meson.build
drivers/common/meson.build
drivers/compress/meson.build
drivers/crypto/meson.build
drivers/event/meson.build
drivers/mempool/meson.build
drivers/meson.build
drivers/net/meson.build
drivers/raw/meson.build
drivers/vdpa/meson.build
lib/librte_eal/common/meson.build
lib/librte_eal/rte_eal_exports.def
lib/librte_eal/windows/eal.c
lib/librte_eal/windows/eal_mp.c

index 4d909f9a6274251d4012f61954b810017bb8d716..415b6724b14631df3aec226f866f118294c29bb3 100644 (file)
@@ -1,6 +1,10 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2018 Luca Boccassi <bluca@debian.org>
 
+if is_windows
+       subdir_done()
+endif
+
 drivers = ['null', 'turbo_sw', 'fpga_lte_fec', 'fpga_5gnr_fec']
 
 config_flag_fmt = 'RTE_LIBRTE_PMD_BBDEV_@0@'
index 4ea31f17415f63287f67b306f2f8be43de5c2837..3ff44d902a9c7896d90562786cb4738f51276c71 100644 (file)
@@ -1,6 +1,12 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2010-2018 Intel Corporation
 
+if is_windows
+       build = false
+       reason = 'not supported on Windows'
+       subdir_done()
+endif
+
 deps += ['pci', 'kvargs', 'rawdev']
 install_headers('rte_bus_ifpga.h')
 sources = files('ifpga_common.c', 'ifpga_bus.c')
index b520bdfc14dd65264d6f176174add855a35a90d5..b649a17c221b5c8b676589b68e06f5c8fae3ff92 100644 (file)
@@ -4,16 +4,22 @@
 deps += ['pci']
 install_headers('rte_bus_pci.h')
 sources = files('pci_common.c',
-       'pci_common_uio.c',
        'pci_params.c')
 if is_linux
-       sources += files('linux/pci.c',
+       sources += files('pci_common_uio.c',
+                       'linux/pci.c',
                        'linux/pci_uio.c',
                        'linux/pci_vfio.c')
        includes += include_directories('linux')
-else
-       sources += files('bsd/pci.c')
+endif
+if is_freebsd
+       sources += files('pci_common_uio.c',
+                       'bsd/pci.c')
        includes += include_directories('bsd')
 endif
+if is_windows
+       sources += files('windows/pci.c')
+       includes += include_directories('windows')
+endif
 
 deps += ['kvargs']
index ed69ec2fe6f7f8cc82ee81c470773265b710203f..a8e5fd52c1d092e2c4e77eac45754904f7f8ef84 100644 (file)
@@ -10,8 +10,6 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <sys/queue.h>
-#include <sys/mman.h>
-
 #include <rte_errno.h>
 #include <rte_interrupts.h>
 #include <rte_log.h>
diff --git a/drivers/bus/pci/windows/pci.c b/drivers/bus/pci/windows/pci.c
new file mode 100644 (file)
index 0000000..b1d34ae
--- /dev/null
@@ -0,0 +1,169 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright 2020 Mellanox Technologies, Ltd
+ */
+#include <rte_errno.h>
+#include <rte_log.h>
+
+#include <rte_string_fns.h>
+#include <rte_eal_memconfig.h>
+
+#include "private.h"
+
+/* The functions below are not implemented on Windows,
+ * but need to be defined for compilation purposes
+ */
+
+/* Map pci device */
+int
+rte_pci_map_device(struct rte_pci_device *dev __rte_unused)
+{
+       /* This function is not implemented on Windows.
+        * We really should short-circuit the call to these functions by
+        * clearing the RTE_PCI_DRV_NEED_MAPPING flag
+        * in the rte_pci_driver flags.
+        */
+       return 0;
+}
+
+/* Unmap pci device */
+void
+rte_pci_unmap_device(struct rte_pci_device *dev __rte_unused)
+{
+       /* This function is not implemented on Windows.
+        * We really should short-circuit the call to these functions by
+        * clearing the RTE_PCI_DRV_NEED_MAPPING flag
+        * in the rte_pci_driver flags.
+        */
+}
+
+int
+pci_update_device(const struct rte_pci_addr *addr __rte_unused)
+{
+       /* This function is not implemented on Windows.
+        * We really should short-circuit the call to these functions by
+        * clearing the RTE_PCI_DRV_NEED_MAPPING flag
+        * in the rte_pci_driver flags.
+        */
+       return 0;
+}
+
+/* Read PCI config space. */
+int
+rte_pci_read_config(const struct rte_pci_device *dev __rte_unused,
+       void *buf __rte_unused, size_t len __rte_unused,
+       off_t offset __rte_unused)
+{
+       /* This function is not implemented on Windows.
+        * We really should short-circuit the call to these functions by
+        * clearing the RTE_PCI_DRV_NEED_MAPPING flag
+        * in the rte_pci_driver flags.
+        */
+       return 0;
+}
+
+/* Write PCI config space. */
+int
+rte_pci_write_config(const struct rte_pci_device *dev __rte_unused,
+       const void *buf __rte_unused, size_t len __rte_unused,
+       off_t offset __rte_unused)
+{
+       /* This function is not implemented on Windows.
+        * We really should short-circuit the call to these functions by
+        * clearing the RTE_PCI_DRV_NEED_MAPPING flag
+        * in the rte_pci_driver flags.
+        */
+       return 0;
+}
+
+enum rte_iova_mode
+pci_device_iova_mode(const struct rte_pci_driver *pdrv __rte_unused,
+               const struct rte_pci_device *pdev __rte_unused)
+{
+       /* This function is not implemented on Windows.
+        * We really should short-circuit the call to these functions by
+        * clearing the RTE_PCI_DRV_NEED_MAPPING flag
+        * in the rte_pci_driver flags.
+        */
+       return RTE_IOVA_DC;
+}
+
+int
+rte_pci_ioport_map(struct rte_pci_device *dev __rte_unused,
+       int bar __rte_unused, struct rte_pci_ioport *p __rte_unused)
+{
+       /* This function is not implemented on Windows.
+        * We really should short-circuit the call to these functions by
+        * clearing the RTE_PCI_DRV_NEED_MAPPING flag
+        * in the rte_pci_driver flags.
+        */
+       return -1;
+}
+
+
+void
+rte_pci_ioport_read(struct rte_pci_ioport *p __rte_unused,
+       void *data __rte_unused, size_t len __rte_unused,
+       off_t offset __rte_unused)
+{
+       /* This function is not implemented on Windows.
+        * We really should short-circuit the call to these functions by
+        * clearing the RTE_PCI_DRV_NEED_MAPPING flag
+        * in the rte_pci_driver flags.
+        */
+}
+
+int
+rte_pci_ioport_unmap(struct rte_pci_ioport *p __rte_unused)
+{
+       /* This function is not implemented on Windows.
+        * We really should short-circuit the call to these functions by
+        * clearing the RTE_PCI_DRV_NEED_MAPPING flag
+        * in the rte_pci_driver flags.
+        */
+       return -1;
+}
+
+bool
+pci_device_iommu_support_va(const struct rte_pci_device *dev __rte_unused)
+{
+       /* This function is not implemented on Windows.
+        * We really should short-circuit the call to these functions by
+        * clearing the RTE_PCI_DRV_NEED_MAPPING flag
+        * in the rte_pci_driver flags.
+        */
+       return false;
+}
+
+void
+rte_pci_ioport_write(struct rte_pci_ioport *p __rte_unused,
+               const void *data __rte_unused, size_t len __rte_unused,
+               off_t offset __rte_unused)
+{
+       /* This function is not implemented on Windows.
+        * We really should short-circuit the call to these functions by
+        * clearing the RTE_PCI_DRV_NEED_MAPPING flag
+        * in the rte_pci_driver flags.
+        */
+}
+
+
+/* remap the PCI resource of a PCI device in anonymous virtual memory */
+int
+pci_uio_remap_resource(struct rte_pci_device *dev __rte_unused)
+{
+       /* This function is not implemented on Windows.
+        * We really should short-circuit the call to these functions by
+        * clearing the RTE_PCI_DRV_NEED_MAPPING flag
+        * in the rte_pci_driver flags.
+        */
+       return -1;
+}
+/*
+ * Scan the contents of the PCI bus
+ * and add all network class devices into the devices list.
+ */
+int
+rte_pci_scan(void)
+{
+       return 0;
+}
index 967d54e4f800f81453c91d5ac62ed5afa63b9461..3a662b1075c0be2ae2f9962bbd7d6ba2d438ebb4 100644 (file)
@@ -1,6 +1,12 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2017 Intel Corporation
 
+if is_windows
+       build = false
+       reason = 'not supported on Windows'
+       subdir_done()
+endif
+
 sources = files('vdev.c',
        'vdev_params.c')
 install_headers('rte_bus_vdev.h')
index a68a1de9d5dd03fc02e8b3dad5f275c793532e5d..7e7b1dad53366f03e3ddafd10913c7bff10495cb 100644 (file)
@@ -1,5 +1,12 @@
 # SPDX-License-Identifier: BSD-3-Clause
 
+if is_windows
+       build = false
+       reason = 'not supported on Windows'
+       subdir_done()
+endif
+
+
 install_headers('rte_bus_vmbus.h','rte_vmbus_reg.h')
 
 sources = files('vmbus_common.c',
index ffd06e2c3cc2d3a1c1ff74e506319f1e9f105180..5db7e29b1d35d0860bd0f4019a3087b04a0b04bd 100644 (file)
@@ -1,6 +1,10 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2018 Cavium, Inc
 
+if is_windows
+       subdir_done()
+endif
+
 std_deps = ['eal']
 drivers = ['cpt', 'dpaax', 'iavf', 'mlx5', 'mvep', 'octeontx', 'octeontx2', 'qat']
 config_flag_fmt = 'RTE_LIBRTE_@0@_COMMON'
index 817ef3be42246116d2e113660c01d9b182e2a619..ee883c3f9fb624d8d45a890566aecd244fde530d 100644 (file)
@@ -1,6 +1,10 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2018 Intel Corporation
 
+if is_windows
+       subdir_done()
+endif
+
 drivers = ['isal', 'octeontx', 'qat', 'zlib']
 
 std_deps = ['compressdev'] # compressdev pulls in all other needed deps
index 7fa1fbe26956212eea80f8a91cb0ee1d1d9cb628..a2423507ad3272e727a0effea5e3ace301c77b80 100644 (file)
@@ -1,6 +1,10 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2017 Intel Corporation
 
+if is_windows
+       subdir_done()
+endif
+
 drivers = ['aesni_gcm',
           'aesni_mb',
           'armv8',
index 50d30c53fc9c30c4d04b91924b272be9a8e8b715..ebe76a75c4cc89070e7fd8076f785186dd57cc33 100644 (file)
@@ -1,6 +1,10 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2017 Intel Corporation
 
+if is_windows
+       subdir_done()
+endif
+
 drivers = ['dpaa', 'dpaa2', 'octeontx2', 'opdl', 'skeleton', 'sw', 'dsw']
 if not (toolchain == 'gcc' and cc.version().version_compare('<4.8.6') and
        dpdk_conf.has('RTE_ARCH_ARM64'))
index 7520e489f413e22335dfaef84ad1a1e0d8ca04f0..c9609f1453cb4d35b1f3b0493655d7c5685d2f14 100644 (file)
@@ -1,6 +1,10 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2017 Intel Corporation
 
+if is_windows
+       subdir_done()
+endif
+
 drivers = ['bucket', 'dpaa', 'dpaa2', 'octeontx', 'octeontx2', 'ring', 'stack']
 std_deps = ['mempool']
 config_flag_fmt = 'RTE_LIBRTE_@0@_MEMPOOL'
index 8878d5a42ca1b28dd36db97297d41426d001f916..01c860c0683375960241150fb88733cecabaa9c5 100644 (file)
@@ -1,10 +1,6 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2017-2019 Intel Corporation
 
-if is_windows
-       subdir_done()
-endif
-
 # Defines the order in which the drivers are buit.
 dpdk_driver_classes = ['common',
               'bus',
index 266448ff266fdbe2509afbaf7cfca0e5701925b2..d56b24051a94477655766298b2ac075069bf4ea6 100644 (file)
@@ -1,6 +1,10 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright(c) 2017 Intel Corporation
 
+if is_windows
+       subdir_done()
+endif
+
 drivers = ['af_packet',
        'af_xdp',
        'ark',
index bb57977606f7d73ad57e4ff05d6e4fd1caaaab71..2c1e65ec798652022ddbb6a341aa2b7493d08759 100644 (file)
@@ -1,6 +1,10 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright 2018 NXP
 
+if is_windows
+       subdir_done()
+endif
+
 drivers = ['dpaa2_cmdif', 'dpaa2_qdma',
        'ifpga', 'ioat', 'ntb',
        'octeontx2_dma',
index e3ed54a257e92816eb0e5b5582e6576d1f09a46a..798eb383050ad670f59d44ed805f33fd9cb282c7 100644 (file)
@@ -1,6 +1,10 @@
 # SPDX-License-Identifier: BSD-3-Clause
 # Copyright 2019 Mellanox Technologies, Ltd
 
+if is_windows
+       subdir_done()
+endif
+
 drivers = ['ifc',
           'mlx5',]
 std_deps = ['bus_pci', 'kvargs']
index 5f9032c6483701320d9a26dca16cdcba16521790..dc9b1d2feb7034ed39a9f469208eec3d4f4ef2c2 100644 (file)
@@ -9,6 +9,7 @@ if is_windows
                'eal_common_class.c',
                'eal_common_config.c',
                'eal_common_debug.c',
+               'eal_common_dev.c',
                'eal_common_devargs.c',
                'eal_common_dynmem.c',
                'eal_common_errno.c',
index 61bcb8aca7b6e25517f5718d822d50f461dd083d..919a92fba90e327c2b6c84d214aa31f9c33929ca 100644 (file)
@@ -3,6 +3,10 @@ EXPORTS
        per_lcore__rte_errno
        rte_calloc
        rte_calloc_socket
+       rte_bus_register
+       rte_dev_is_probed
+       rte_devargs_next
+       rte_devargs_remove
        rte_eal_get_configuration
        rte_eal_has_hugepages
        rte_eal_init
@@ -48,6 +52,9 @@ EXPORTS
        rte_memzone_reserve_bounded
        rte_memzone_walk
        rte_strerror
+       rte_strsplit
+       rte_vfio_container_dma_map
+       rte_vfio_container_dma_unmap
        rte_vlog
        rte_realloc
        rte_zmalloc
index 8333d5977e953e911bf23ea0de4104cb325469a8..eb10b4ef9689c9eb083c6fba1724151cd89baf7d 100644 (file)
@@ -18,6 +18,7 @@
 #include <eal_options.h>
 #include <eal_private.h>
 #include <rte_trace_point.h>
+#include <rte_vfio.h>
 
 #include "eal_hugepages.h"
 #include "eal_windows.h"
@@ -247,7 +248,7 @@ rte_eal_cleanup(void)
 int
 rte_eal_init(int argc, char **argv)
 {
-       int i, fctret;
+       int i, fctret, bscan;
        const struct rte_config *config = rte_eal_get_configuration();
        struct internal_config *internal_conf =
                eal_get_internal_configuration();
@@ -334,6 +335,13 @@ rte_eal_init(int argc, char **argv)
 
        eal_thread_init_master(config->master_lcore);
 
+       bscan = rte_bus_scan();
+       if (bscan < 0) {
+               rte_eal_init_alert("Cannot init PCI");
+               rte_errno = ENODEV;
+               return -1;
+       }
+
        RTE_LCORE_FOREACH_SLAVE(i) {
 
                /*
@@ -362,3 +370,21 @@ rte_eal_init(int argc, char **argv)
        rte_eal_mp_wait_lcore();
        return fctret;
 }
+
+int
+rte_vfio_container_dma_map(__rte_unused int container_fd,
+                       __rte_unused uint64_t vaddr,
+                       __rte_unused uint64_t iova,
+                       __rte_unused uint64_t len)
+{
+       return -1;
+}
+
+int
+rte_vfio_container_dma_unmap(__rte_unused int container_fd,
+                       __rte_unused uint64_t vaddr,
+                       __rte_unused uint64_t iova,
+                       __rte_unused uint64_t len)
+{
+       return -1;
+}
index 16a5e8ba03991a717a5ea70f26377896ca6b1bb6..f2fa9366f6687231aa2d5ea6c7d081fa85f603a4 100644 (file)
@@ -16,6 +16,7 @@
 #include "eal_private.h"
 #include "eal_windows.h"
 #include "malloc_mp.h"
+#include "hotplug_mp.h"
 
 void
 rte_mp_channel_cleanup(void)
@@ -101,3 +102,17 @@ request_sync(void)
        EAL_LOG_STUB();
        return 0;
 }
+
+int
+eal_dev_hotplug_request_to_primary(struct eal_dev_mp_req *req)
+{
+       RTE_SET_USED(req);
+       return 0;
+}
+
+int
+eal_dev_hotplug_request_to_secondary(struct eal_dev_mp_req *req)
+{
+       RTE_SET_USED(req);
+       return 0;
+}