[dpdk-dev] [PATCH] eal: fix missing include
This patch adds the missing include and fixes the build error: /dpdk/build/include/rte_uuid.h: In function 'rte_uuid_copy': /dpdk/build/include/rte_uuid.h:58:2: error: implicit declaration of function 'memcpy' [-Werror=implicit-function-declaration] memcpy(dst, src, sizeof(rte_uuid_t)); ^~ Fixes: 6bc67c497a51 ("eal: add uuid API") Cc: sta...@dpdk.org Signed-off-by: Yunjian Wang --- lib/librte_eal/include/rte_uuid.h | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/librte_eal/include/rte_uuid.h b/lib/librte_eal/include/rte_uuid.h index 044afbdfa..dc86eb292 100644 --- a/lib/librte_eal/include/rte_uuid.h +++ b/lib/librte_eal/include/rte_uuid.h @@ -15,6 +15,7 @@ extern "C" { #endif #include +#include /** * Struct describing a Universal Unique Identifier -- 2.18.1
[dpdk-dev] [PATCH] vfio: fix resource leak when mapping fails
Currently, only the 'vfio_dev_fd' is closed in failure path, so some resources are not released(such as 'vfio_group_fd'). The rte_vfio_release_device() should be used to avoid this problem. Fixes: 33604c31354a ("vfio: refactor PCI BAR mapping") Cc: sta...@dpdk.org Signed-off-by: Yunjian Wang --- drivers/bus/pci/linux/pci_vfio.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/bus/pci/linux/pci_vfio.c b/drivers/bus/pci/linux/pci_vfio.c index 64cd84a68..c87373b90 100644 --- a/drivers/bus/pci/linux/pci_vfio.c +++ b/drivers/bus/pci/linux/pci_vfio.c @@ -789,7 +789,8 @@ pci_vfio_map_resource_primary(struct rte_pci_device *dev) err_vfio_res: rte_free(vfio_res); err_vfio_dev_fd: - close(vfio_dev_fd); + rte_vfio_release_device(rte_pci_get_sysfs_path(), + pci_addr, vfio_dev_fd); return -1; } @@ -857,7 +858,8 @@ pci_vfio_map_resource_secondary(struct rte_pci_device *dev) return 0; err_vfio_dev_fd: - close(vfio_dev_fd); + rte_vfio_release_device(rte_pci_get_sysfs_path(), + pci_addr, vfio_dev_fd); return -1; } -- 2.18.1
Re: [dpdk-dev] [PATCH 01/13] eal/log: introduce log register macro
On 17-Jun-20 12:00 PM, jer...@marvell.com wrote: From: Jerin Jacob Introducing the RTE_LOG_REGISTER macro to avoid the code duplication in the log registration process. It is a wrapper macro for declaring the logtype, register the log and sets it's level in the constructor context. Signed-off-by: Jerin Jacob --- lib/librte_eal/include/rte_log.h | 25 + 1 file changed, 25 insertions(+) diff --git a/lib/librte_eal/include/rte_log.h b/lib/librte_eal/include/rte_log.h index 1789ede56..4dc357074 100644 --- a/lib/librte_eal/include/rte_log.h +++ b/lib/librte_eal/include/rte_log.h @@ -376,6 +376,31 @@ int rte_vlog(uint32_t level, uint32_t logtype, const char *format, va_list ap) RTE_LOGTYPE_ ## t, # t ": " __VA_ARGS__) : \ 0) +/** + * @warning + * @b EXPERIMENTAL: this API may change without prior notice + * + * Register a dynamic log type in constructor context with its name and level. + * + * It is a wrapper macro for declaring the logtype, register the log and sets + * it's level in the constructor context. + * + * @param type + * The log type identifier + * @param name + *Name for the log type to be registered + * @param level + * Log level. A value between EMERG (1) and DEBUG (8). + */ +#define RTE_LOG_REGISTER(type, name, level)\ +int type; \ +RTE_INIT(__##type) \ +{ \ + type = rte_log_register(RTE_STR(name)); \ + if (type >= 0) \ + rte_log_set_level(type, RTE_LOG_##level); \ +} + #ifdef __cplusplus } #endif Do we like to add some way of notifying the driver (may be simple print) regarding failure case of "rte_log_*" API?
Re: [dpdk-dev] [PATCH 06/13] drivers/mempool: use log register macro
Acked-by: Sachin Saxena On 17-Jun-20 12:00 PM, jer...@marvell.com wrote: From: Jerin Jacob Use log register macro to avoid the code duplication in the log registration process. Signed-off-by: Jerin Jacob --- drivers/mempool/dpaa/dpaa_mempool.c | 10 ++ drivers/mempool/dpaa2/dpaa2_hw_mempool.c | 10 +- drivers/mempool/octeontx/octeontx_fpavf.c | 10 +- 3 files changed, 4 insertions(+), 26 deletions(-) diff --git a/drivers/mempool/dpaa/dpaa_mempool.c b/drivers/mempool/dpaa/dpaa_mempool.c index 451e2d5d5..8d1da8028 100644 --- a/drivers/mempool/dpaa/dpaa_mempool.c +++ b/drivers/mempool/dpaa/dpaa_mempool.c @@ -36,7 +36,8 @@ struct dpaa_memseg_list rte_dpaa_memsegs = TAILQ_HEAD_INITIALIZER(rte_dpaa_memsegs); struct dpaa_bp_info *rte_dpaa_bpid_info; -int dpaa_logtype_mempool; + +RTE_LOG_REGISTER(dpaa_logtype_mempool, mempool.dpaa, NOTICE); static int dpaa_mbuf_create_pool(struct rte_mempool *mp) @@ -357,10 +358,3 @@ static const struct rte_mempool_ops dpaa_mpool_ops = { }; MEMPOOL_REGISTER_OPS(dpaa_mpool_ops); - -RTE_INIT(dpaa_mp_init_log) -{ - dpaa_logtype_mempool = rte_log_register("mempool.dpaa"); - if (dpaa_logtype_mempool >= 0) - rte_log_set_level(dpaa_logtype_mempool, RTE_LOG_NOTICE); -} diff --git a/drivers/mempool/dpaa2/dpaa2_hw_mempool.c b/drivers/mempool/dpaa2/dpaa2_hw_mempool.c index fa9b53e64..97ce08d78 100644 --- a/drivers/mempool/dpaa2/dpaa2_hw_mempool.c +++ b/drivers/mempool/dpaa2/dpaa2_hw_mempool.c @@ -36,9 +36,6 @@ struct dpaa2_bp_info *rte_dpaa2_bpid_info; static struct dpaa2_bp_list *h_bp_list; -/* Dynamic logging identified for mempool */ -int dpaa2_logtype_mempool; - static int rte_hw_mbuf_create_pool(struct rte_mempool *mp) { @@ -454,9 +451,4 @@ static const struct rte_mempool_ops dpaa2_mpool_ops = { MEMPOOL_REGISTER_OPS(dpaa2_mpool_ops); -RTE_INIT(dpaa2_mempool_init_log) -{ - dpaa2_logtype_mempool = rte_log_register("mempool.dpaa2"); - if (dpaa2_logtype_mempool >= 0) - rte_log_set_level(dpaa2_logtype_mempool, RTE_LOG_NOTICE); -} +RTE_LOG_REGISTER(dpaa2_logtype_mempool, mempool.dpaa2, NOTICE); diff --git a/drivers/mempool/octeontx/octeontx_fpavf.c b/drivers/mempool/octeontx/octeontx_fpavf.c index 0ff234913..339da7824 100644 --- a/drivers/mempool/octeontx/octeontx_fpavf.c +++ b/drivers/mempool/octeontx/octeontx_fpavf.c @@ -105,15 +105,7 @@ struct octeontx_fpadev { static struct octeontx_fpadev fpadev; -int octeontx_logtype_fpavf; -int octeontx_logtype_fpavf_mbox; - -RTE_INIT(otx_pool_init_log) -{ - octeontx_logtype_fpavf = rte_log_register("pmd.mempool.octeontx"); - if (octeontx_logtype_fpavf >= 0) - rte_log_set_level(octeontx_logtype_fpavf, RTE_LOG_NOTICE); -} +RTE_LOG_REGISTER(octeontx_logtype_fpavf, pmd.mempool.octeontx, NOTICE); /* lock is taken by caller */ static int
Re: [dpdk-dev] [PATCH 10/13] drivers/common: use log register macro
Acked-by: Sachin Saxena On 17-Jun-20 12:00 PM, jer...@marvell.com wrote: From: Jerin Jacob Use log register macro to avoid the code duplication in the log registration process. Signed-off-by: Jerin Jacob --- drivers/common/dpaax/dpaax_iova_table.c | 10 +-- drivers/common/iavf/iavf_impl.c | 9 +-- drivers/common/octeontx/octeontx_mbox.c | 9 +-- drivers/common/octeontx2/otx2_common.c | 96 +++-- drivers/common/qat/qat_logs.c | 17 + 5 files changed, 15 insertions(+), 126 deletions(-) diff --git a/drivers/common/dpaax/dpaax_iova_table.c b/drivers/common/dpaax/dpaax_iova_table.c index 98b076e09..5ba8ed193 100644 --- a/drivers/common/dpaax/dpaax_iova_table.c +++ b/drivers/common/dpaax/dpaax_iova_table.c @@ -7,9 +7,6 @@ #include "dpaax_iova_table.h" #include "dpaax_logs.h" -/* Global dpaax logger identifier */ -int dpaax_logger; - /* Global table reference */ struct dpaax_iova_table *dpaax_iova_table_p; @@ -463,9 +460,4 @@ dpaax_handle_memevents(void) dpaax_memevent_cb, NULL); } -RTE_INIT(dpaax_log) -{ - dpaax_logger = rte_log_register("pmd.common.dpaax"); - if (dpaax_logger >= 0) - rte_log_set_level(dpaax_logger, RTE_LOG_ERR); -} +RTE_LOG_REGISTER(dpaax_logger, pmd.common.dpaax, ERR); diff --git a/drivers/common/iavf/iavf_impl.c b/drivers/common/iavf/iavf_impl.c index 6174a9144..fc0da3175 100644 --- a/drivers/common/iavf/iavf_impl.c +++ b/drivers/common/iavf/iavf_impl.c @@ -13,8 +13,6 @@ #include "iavf_type.h" #include "iavf_prototype.h" -int iavf_common_logger; - enum iavf_status iavf_allocate_dma_mem_d(__rte_unused struct iavf_hw *hw, struct iavf_dma_mem *mem, @@ -87,9 +85,4 @@ iavf_free_virt_mem_d(__rte_unused struct iavf_hw *hw, return IAVF_SUCCESS; } -RTE_INIT(iavf_common_init_log) -{ - iavf_common_logger = rte_log_register("pmd.common.iavf"); - if (iavf_common_logger >= 0) - rte_log_set_level(iavf_common_logger, RTE_LOG_NOTICE); -} +RTE_LOG_REGISTER(iavf_common_logger, pmd.common.iavf, NOTICE); diff --git a/drivers/common/octeontx/octeontx_mbox.c b/drivers/common/octeontx/octeontx_mbox.c index effe0b267..f414267e4 100644 --- a/drivers/common/octeontx/octeontx_mbox.c +++ b/drivers/common/octeontx/octeontx_mbox.c @@ -68,14 +68,7 @@ struct mbox_intf_ver { uint32_t minor:10; }; -int octeontx_logtype_mbox; - -RTE_INIT(otx_init_log) -{ - octeontx_logtype_mbox = rte_log_register("pmd.octeontx.mbox"); - if (octeontx_logtype_mbox >= 0) - rte_log_set_level(octeontx_logtype_mbox, RTE_LOG_NOTICE); -} +RTE_LOG_REGISTER(octeontx_logtype_mbox, pmd.octeontx.mbox, NOTICE); static inline void mbox_msgcpy(volatile uint8_t *d, volatile const uint8_t *s, uint16_t size) diff --git a/drivers/common/octeontx2/otx2_common.c b/drivers/common/octeontx2/otx2_common.c index 5e7272f69..b292e999a 100644 --- a/drivers/common/octeontx2/otx2_common.c +++ b/drivers/common/octeontx2/otx2_common.c @@ -203,89 +203,13 @@ void otx2_parse_common_devargs(struct rte_kvargs *kvlist) idev->npa_lock_mask = npa_lock_mask; } -/** - * @internal - */ -int otx2_logtype_base; -/** - * @internal - */ -int otx2_logtype_mbox; -/** - * @internal - */ -int otx2_logtype_npa; -/** - * @internal - */ -int otx2_logtype_nix; -/** - * @internal - */ -int otx2_logtype_npc; -/** - * @internal - */ -int otx2_logtype_tm; -/** - * @internal - */ -int otx2_logtype_sso; -/** - * @internal - */ -int otx2_logtype_tim; -/** - * @internal - */ -int otx2_logtype_dpi; -/** - * @internal - */ -int otx2_logtype_ep; - -RTE_INIT(otx2_log_init); -static void -otx2_log_init(void) -{ - otx2_logtype_base = rte_log_register("pmd.octeontx2.base"); - if (otx2_logtype_base >= 0) - rte_log_set_level(otx2_logtype_base, RTE_LOG_NOTICE); - - otx2_logtype_mbox = rte_log_register("pmd.octeontx2.mbox"); - if (otx2_logtype_mbox >= 0) - rte_log_set_level(otx2_logtype_mbox, RTE_LOG_NOTICE); - - otx2_logtype_npa = rte_log_register("pmd.mempool.octeontx2"); - if (otx2_logtype_npa >= 0) - rte_log_set_level(otx2_logtype_npa, RTE_LOG_NOTICE); - - otx2_logtype_nix = rte_log_register("pmd.net.octeontx2"); - if (otx2_logtype_nix >= 0) - rte_log_set_level(otx2_logtype_nix, RTE_LOG_NOTICE); - - otx2_logtype_npc = rte_log_register("pmd.net.octeontx2.flow"); - if (otx2_logtype_npc >= 0) - rte_log_set_level(otx2_logtype_npc, RTE_LOG_NOTICE); - - otx2_logtype_tm = rte_log_register("pmd.net.octeontx2.tm"); - if (otx2_logtype_tm >= 0) - rte_log_set_level(otx2_logtype_tm, RTE_LOG_NOTICE); - - otx2_logtype_sso = rte_log_register("pmd.event.octeontx2"); - if (otx2_logtype_sso >= 0) - rte_log_set_level(otx2_logtype_sso, RTE_LOG_NOTICE); - - ot
Re: [dpdk-dev] [PATCH 11/13] drivers/bus: use log register macro
Acked-by: Sachin Saxena On 17-Jun-20 12:00 PM, jer...@marvell.com wrote: From: Jerin Jacob Use log register macro to avoid the code duplication in the log registration process. Signed-off-by: Jerin Jacob --- drivers/bus/dpaa/dpaa_bus.c | 10 +- drivers/bus/fslmc/fslmc_bus.c| 11 +-- drivers/bus/ifpga/ifpga_bus.c| 9 + drivers/bus/vdev/vdev.c | 10 +- drivers/bus/vmbus/vmbus_common.c | 9 + 5 files changed, 5 insertions(+), 44 deletions(-) diff --git a/drivers/bus/dpaa/dpaa_bus.c b/drivers/bus/dpaa/dpaa_bus.c index d53fe6083..0d8b13e5f 100644 --- a/drivers/bus/dpaa/dpaa_bus.c +++ b/drivers/bus/dpaa/dpaa_bus.c @@ -42,8 +42,6 @@ #include #include -int dpaa_logtype_bus; - static struct rte_dpaa_bus rte_dpaa_bus; struct netcfg_info *dpaa_netcfg; @@ -749,10 +747,4 @@ static struct rte_dpaa_bus rte_dpaa_bus = { }; RTE_REGISTER_BUS(FSL_DPAA_BUS_NAME, rte_dpaa_bus.bus); - -RTE_INIT(dpaa_init_log) -{ - dpaa_logtype_bus = rte_log_register("bus.dpaa"); - if (dpaa_logtype_bus >= 0) - rte_log_set_level(dpaa_logtype_bus, RTE_LOG_NOTICE); -} +RTE_LOG_REGISTER(dpaa_logtype_bus, bus.dpaa, NOTICE); diff --git a/drivers/bus/fslmc/fslmc_bus.c b/drivers/bus/fslmc/fslmc_bus.c index afbd82e8d..d9f403bd9 100644 --- a/drivers/bus/fslmc/fslmc_bus.c +++ b/drivers/bus/fslmc/fslmc_bus.c @@ -21,8 +21,6 @@ #include -int dpaa2_logtype_bus; - #define VFIO_IOMMU_GROUP_PATH "/sys/kernel/iommu_groups" #define FSLMC_BUS_NAMEfslmc @@ -649,11 +647,4 @@ struct rte_fslmc_bus rte_fslmc_bus = { }; RTE_REGISTER_BUS(FSLMC_BUS_NAME, rte_fslmc_bus.bus); - -RTE_INIT(fslmc_init_log) -{ - /* Bus level logs */ - dpaa2_logtype_bus = rte_log_register("bus.fslmc"); - if (dpaa2_logtype_bus >= 0) - rte_log_set_level(dpaa2_logtype_bus, RTE_LOG_NOTICE); -} +RTE_LOG_REGISTER(dpaa2_logtype_bus, bus.fslmc, NOTICE); diff --git a/drivers/bus/ifpga/ifpga_bus.c b/drivers/bus/ifpga/ifpga_bus.c index addbc3e86..103915d43 100644 --- a/drivers/bus/ifpga/ifpga_bus.c +++ b/drivers/bus/ifpga/ifpga_bus.c @@ -32,7 +32,6 @@ #include "ifpga_logs.h" #include "ifpga_common.h" -int ifpga_bus_logtype; /* Forward declaration to access Intel FPGA bus * on which iFPGA devices are connected @@ -474,10 +473,4 @@ static struct rte_bus rte_ifpga_bus = { }; RTE_REGISTER_BUS(IFPGA_BUS_NAME, rte_ifpga_bus); - -RTE_INIT(ifpga_init_log) -{ - ifpga_bus_logtype = rte_log_register("bus.ifpga"); - if (ifpga_bus_logtype >= 0) - rte_log_set_level(ifpga_bus_logtype, RTE_LOG_NOTICE); -} +RTE_LOG_REGISTER(ifpga_bus_logtype, bus.ifpga, NOTICE); diff --git a/drivers/bus/vdev/vdev.c b/drivers/bus/vdev/vdev.c index a89ea2353..d746149a2 100644 --- a/drivers/bus/vdev/vdev.c +++ b/drivers/bus/vdev/vdev.c @@ -27,8 +27,6 @@ #define VDEV_MP_KEY "bus_vdev_mp" -int vdev_logtype_bus; - /* Forward declare to access virtual bus name */ static struct rte_bus rte_vdev_bus; @@ -557,10 +555,4 @@ static struct rte_bus rte_vdev_bus = { }; RTE_REGISTER_BUS(vdev, rte_vdev_bus); - -RTE_INIT(vdev_init_log) -{ - vdev_logtype_bus = rte_log_register("bus.vdev"); - if (vdev_logtype_bus >= 0) - rte_log_set_level(vdev_logtype_bus, RTE_LOG_NOTICE); -} +RTE_LOG_REGISTER(vdev_logtype_bus, bus.vdev, NOTICE); diff --git a/drivers/bus/vmbus/vmbus_common.c b/drivers/bus/vmbus/vmbus_common.c index 3adef01c9..4c9ac33ac 100644 --- a/drivers/bus/vmbus/vmbus_common.c +++ b/drivers/bus/vmbus/vmbus_common.c @@ -22,7 +22,6 @@ #include "private.h" -int vmbus_logtype_bus; extern struct rte_vmbus_bus rte_vmbus_bus; /* map a particular resource from a file */ @@ -298,10 +297,4 @@ struct rte_vmbus_bus rte_vmbus_bus = { }; RTE_REGISTER_BUS(vmbus, rte_vmbus_bus.bus); - -RTE_INIT(vmbus_init_log) -{ - vmbus_logtype_bus = rte_log_register("bus.vmbus"); - if (vmbus_logtype_bus >= 0) - rte_log_set_level(vmbus_logtype_bus, RTE_LOG_NOTICE); -} +RTE_LOG_REGISTER(vmbus_logtype_bus, bus.vmbus, NOTICE);
[dpdk-dev] [PATCH v7 0/9] Windows bus/pci support
From: Tal Shnaiderman This patchset implements the EAL and PCI functions needed for probing PMDs using RTE_KDRV_NONE on Windows. --- v7: * Remove Unneeded code from MinGW mapping script (DmitryK) * Fix error flow issues in pci.c (DmitryK) * Fix Unix build errors following unity of common functions. * Move strerror to rte_strerror (DmitryK) v6: * Fix duplication of exported functions for mingw by modifying the version.map in build (new commit) * Fix comments and move additional functions to eal_common_config (DavidM) * Fix cross-compilation in mingw (DmitryK) * Fix Warnings * Move off_t type to pci (ThomasM) v5: * Adjust mem-mapping functions to changes in latest memory management patchset. * Fix incorrect implib definition in drivers/meson.build v4: * Fixed various warnings and naming conventions(DmitryK). * Fixed broken mingw-64 build(DmitryK). * Improved logging(DmitryK). * Added patch to fix warnings on rte_pci_addr logging. * Fixed broken make on linux/freebsd. v3: * Changes in BDF and hardware ids retrieval(DmitryK). * Apply new generic MM to all pci unix callers(DmitryK). * Minor corrections in pci.c(DmitryK). v2: * fix style issues. * fix error handing flow in pci.c * change eal_config.c to eal_common_config.c --- Tal Shnaiderman (9): eal: move OS common functions to single file pci: use OS generic memory mapping functions pci: build on Windows pci: fix format warning on Windows drivers: ignore pmdinfogen generation for Windows drivers: fix incorrect meson import folder for Windows bus/pci: introduce Windows support with stubs bus/pci: support Windows with bifurcated drivers build: generate version.map file for MinGW on Windows buildtools/{map_to_def.py => map_to_win.py} | 11 +- buildtools/meson.build | 4 +- drivers/baseband/meson.build | 4 + drivers/bus/ifpga/meson.build| 6 + drivers/bus/pci/bsd/pci.c| 2 +- drivers/bus/pci/linux/pci_uio.c | 2 +- drivers/bus/pci/linux/pci_vfio.c | 9 +- drivers/bus/pci/meson.build | 14 +- drivers/bus/pci/pci_common.c | 2 - drivers/bus/pci/pci_common_uio.c | 2 +- drivers/bus/pci/windows/pci.c| 409 +++ drivers/bus/vdev/meson.build | 6 + drivers/bus/vmbus/meson.build| 7 + drivers/common/meson.build | 4 + drivers/compress/meson.build | 4 + drivers/crypto/meson.build | 4 + drivers/event/meson.build| 4 + drivers/mempool/meson.build | 4 + drivers/meson.build | 51 ++-- drivers/net/meson.build | 4 + drivers/raw/meson.build | 4 + drivers/vdpa/meson.build | 4 + lib/librte_eal/common/eal_common_config.c| 118 lib/librte_eal/common/eal_private.h | 1 + lib/librte_eal/common/meson.build| 3 + lib/librte_eal/freebsd/Makefile | 1 + lib/librte_eal/freebsd/eal.c | 231 ++- lib/librte_eal/include/rte_eal.h | 13 + lib/librte_eal/linux/Makefile| 1 + lib/librte_eal/linux/eal.c | 253 +++-- lib/librte_eal/rte_eal_exports.def | 11 + lib/librte_eal/windows/eal.c | 118 lib/librte_eal/windows/eal_mp.c | 15 + lib/librte_eal/windows/include/rte_windows.h | 1 + lib/librte_pci/rte_pci.c | 19 +- lib/librte_pci/rte_pci.h | 5 +- lib/meson.build | 24 +- 37 files changed, 962 insertions(+), 413 deletions(-) rename buildtools/{map_to_def.py => map_to_win.py} (69%) create mode 100644 drivers/bus/pci/windows/pci.c create mode 100644 lib/librte_eal/common/eal_common_config.c -- 2.16.1.windows.4
[dpdk-dev] [PATCH v7 6/9] drivers: fix incorrect meson import folder for Windows
From: Tal Shnaiderman import library (/IMPLIB) in meson.build should use the 'drivers' and not 'libs' folder. The error is: fatal error LNK1149: output filename matches input filename. The fix uses the correct folder. Fixes: 5ed3766981 ("drivers: process shared link dependencies as for libs") Signed-off-by: Tal Shnaiderman --- drivers/meson.build | 10 +++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/meson.build b/drivers/meson.build index f4b6cbf3a6..dea0ba2cca 100644 --- a/drivers/meson.build +++ b/drivers/meson.build @@ -153,7 +153,7 @@ foreach class:dpdk_driver_classes version_map = '@0@/@1@/@2@_version.map'.format( meson.current_source_dir(), drv_path, lib_name) - implib = dir_name + '.dll.a' + implib = 'lib' + lib_name + '.dll.a' def_file = custom_target(lib_name + '_def', command: [map_to_def_cmd, '@INPUT@', '@OUTPUT@'], @@ -161,8 +161,12 @@ foreach class:dpdk_driver_classes output: '@0@_exports.def'.format(lib_name)) lk_deps = [version_map, def_file] if is_windows - lk_args = ['-Wl,/def:' + def_file.full_path(), - '-Wl,/implib:lib\\' + implib] + if is_ms_linker + lk_args = ['-Wl,/def:' + def_file.full_path(), + '-Wl,/implib:drivers\\' + implib] + else + lk_args = [] + endif else lk_args = ['-Wl,--version-script=' + version_map] # on unix systems check the output of the -- 2.16.1.windows.4
[dpdk-dev] [PATCH v7 8/9] bus/pci: support Windows with bifurcated drivers
From: Tal Shnaiderman Uses SetupAPI.h functions to scan PCI tree. Uses DEVPKEY_Device_Numa_Node to get the PCI NUMA node. Uses SPDRP_BUSNUMBER and SPDRP_BUSNUMBER to get the BDF. scanning currently supports types RTE_KDRV_NONE. Signed-off-by: Tal Shnaiderman --- drivers/bus/pci/windows/pci.c| 246 ++- lib/librte_eal/rte_eal_exports.def | 1 + lib/librte_eal/windows/include/rte_windows.h | 1 + 3 files changed, 245 insertions(+), 3 deletions(-) diff --git a/drivers/bus/pci/windows/pci.c b/drivers/bus/pci/windows/pci.c index b1d34ae11c..ac92239520 100644 --- a/drivers/bus/pci/windows/pci.c +++ b/drivers/bus/pci/windows/pci.c @@ -1,14 +1,27 @@ /* SPDX-License-Identifier: BSD-3-Clause * Copyright 2020 Mellanox Technologies, Ltd */ +#include #include #include - -#include #include +#include #include "private.h" +#include + +#ifdef RTE_TOOLCHAIN_GCC +#include +DEFINE_DEVPROPKEY(DEVPKEY_Device_Numa_Node, 0x540b947e, 0x8b40, 0x45bc, + 0xa8, 0xa2, 0x6a, 0x0b, 0x89, 0x4c, 0xbd, 0xa2, 3); +#endif + +/* + * This code is used to simulate a PCI probe by parsing information in + * the registry hive for PCI devices. + */ + /* The functions below are not implemented on Windows, * but need to be defined for compilation purposes */ @@ -146,7 +159,6 @@ rte_pci_ioport_write(struct rte_pci_ioport *p __rte_unused, */ } - /* remap the PCI resource of a PCI device in anonymous virtual memory */ int pci_uio_remap_resource(struct rte_pci_device *dev __rte_unused) @@ -158,6 +170,195 @@ pci_uio_remap_resource(struct rte_pci_device *dev __rte_unused) */ return -1; } + +static int +get_device_pci_address(HDEVINFO dev_info, + PSP_DEVINFO_DATA device_info_data, struct rte_pci_addr *addr) +{ + BOOL res; + ULONG bus_num, dev_and_func; + + res = SetupDiGetDeviceRegistryProperty(dev_info, device_info_data, + SPDRP_BUSNUMBER, NULL, (PBYTE)&bus_num, sizeof(bus_num), NULL); + if (!res) { + RTE_LOG_WIN32_ERR( + "SetupDiGetDeviceRegistryProperty(SPDRP_BUSNUMBER)"); + return -1; + } + + res = SetupDiGetDeviceRegistryProperty(dev_info, device_info_data, + SPDRP_ADDRESS, NULL, (PBYTE)&dev_and_func, sizeof(dev_and_func), + NULL); + if (!res) { + RTE_LOG_WIN32_ERR( + "SetupDiGetDeviceRegistryProperty(SPDRP_ADDRESS)"); + return -1; + } + + addr->domain = 0; + addr->bus = bus_num; + addr->devid = dev_and_func >> 16; + addr->function = dev_and_func & 0x; + return 0; +} + +static int +get_device_resource_info(HDEVINFO dev_info, + PSP_DEVINFO_DATA dev_info_data, struct rte_pci_device *dev) +{ + DEVPROPTYPE property_type; + DWORD numa_node; + BOOL res; + + switch (dev->kdrv) { + case RTE_KDRV_NONE: + /* Get NUMA node using DEVPKEY_Device_Numa_Node */ + res = SetupDiGetDevicePropertyW(dev_info, dev_info_data, + &DEVPKEY_Device_Numa_Node, &property_type, + (BYTE *)&numa_node, sizeof(numa_node), NULL, 0); + if (!res) { + RTE_LOG_WIN32_ERR( + "SetupDiGetDevicePropertyW" + "(DEVPKEY_Device_Numa_Node)"); + return -1; + } + dev->device.numa_node = numa_node; + /* mem_resource - Unneeded for RTE_KDRV_NONE */ + dev->mem_resource[0].phys_addr = 0; + dev->mem_resource[0].len = 0; + dev->mem_resource[0].addr = NULL; + break; + default: + /* kernel driver type is unsupported */ + RTE_LOG(DEBUG, EAL, + "kernel driver type for PCI device " PCI_PRI_FMT "," + " is unsupported", + dev->addr.domain, dev->addr.bus, + dev->addr.devid, dev->addr.function); + return -1; + } + + return ERROR_SUCCESS; +} +/* + * get_pci_hardware_info from the SPDRP_HARDWAREID output + */ +static int +get_pci_hardware_info(const char *buf, struct rte_pci_id *pci_id) +{ + int ids = 0; + uint16_t vendor_id, device_id, subvendor_id = 0; + + ids = sscanf_s(buf, "PCI\\VEN_%x&DEV_%x&SUBSYS_%x", &vendor_id, + &device_id, &subvendor_id); + if (ids != 3) + return -1; + + pci_id->vendor_id = vendor_id; + pci_id->device_id = device_id; + pci_id->subsystem_vendor_id = subvendor_id >> 16; + pci_id->subsystem_device_id = subvendor_id & 0x; + return 0; +} + +static void +get_kernel_driver_type(struct rte_pci_device *dev) +{ + /* +* If another kernel driver is supported the relevant checking +* fu
[dpdk-dev] [PATCH v7 2/9] pci: use OS generic memory mapping functions
From: Tal Shnaiderman Changing all of PCIs Unix memory mapping to the new memory allocation API wrapper. Change all of PCI mapping function usage in bus/pci to support the new API. Signed-off-by: Tal Shnaiderman --- drivers/bus/pci/bsd/pci.c | 2 +- drivers/bus/pci/linux/pci_uio.c| 2 +- drivers/bus/pci/linux/pci_vfio.c | 9 + drivers/bus/pci/pci_common_uio.c | 2 +- lib/librte_eal/rte_eal_exports.def | 1 + lib/librte_pci/rte_pci.c | 19 ++- lib/librte_pci/rte_pci.h | 2 +- 7 files changed, 20 insertions(+), 17 deletions(-) diff --git a/drivers/bus/pci/bsd/pci.c b/drivers/bus/pci/bsd/pci.c index 6ec27b4b5b..8bc473eb9a 100644 --- a/drivers/bus/pci/bsd/pci.c +++ b/drivers/bus/pci/bsd/pci.c @@ -192,7 +192,7 @@ pci_uio_map_resource_by_index(struct rte_pci_device *dev, int res_idx, mapaddr = pci_map_resource(NULL, fd, (off_t)offset, (size_t)dev->mem_resource[res_idx].len, 0); close(fd); - if (mapaddr == MAP_FAILED) + if (mapaddr == NULL) goto error; maps[map_idx].phaddr = dev->mem_resource[res_idx].phys_addr; diff --git a/drivers/bus/pci/linux/pci_uio.c b/drivers/bus/pci/linux/pci_uio.c index 097dc19225..b622001539 100644 --- a/drivers/bus/pci/linux/pci_uio.c +++ b/drivers/bus/pci/linux/pci_uio.c @@ -345,7 +345,7 @@ pci_uio_map_resource_by_index(struct rte_pci_device *dev, int res_idx, mapaddr = pci_map_resource(pci_map_addr, fd, 0, (size_t)dev->mem_resource[res_idx].len, 0); close(fd); - if (mapaddr == MAP_FAILED) + if (mapaddr == NULL) goto error; pci_map_addr = RTE_PTR_ADD(mapaddr, diff --git a/drivers/bus/pci/linux/pci_vfio.c b/drivers/bus/pci/linux/pci_vfio.c index 64cd84a689..bde9ad56fd 100644 --- a/drivers/bus/pci/linux/pci_vfio.c +++ b/drivers/bus/pci/linux/pci_vfio.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -524,11 +525,11 @@ pci_vfio_mmap_bar(int vfio_dev_fd, struct mapped_pci_resource *vfio_res, map_addr = pci_map_resource(bar_addr, vfio_dev_fd, memreg[0].offset, memreg[0].size, - MAP_FIXED); + RTE_MAP_FORCE_ADDRESS); } /* if there's a second part, try to map it */ - if (map_addr != MAP_FAILED + if (map_addr != NULL && memreg[1].offset && memreg[1].size) { void *second_addr = RTE_PTR_ADD(bar_addr, (uintptr_t)(memreg[1].offset - @@ -537,10 +538,10 @@ pci_vfio_mmap_bar(int vfio_dev_fd, struct mapped_pci_resource *vfio_res, vfio_dev_fd, memreg[1].offset, memreg[1].size, - MAP_FIXED); + RTE_MAP_FORCE_ADDRESS); } - if (map_addr == MAP_FAILED || !map_addr) { + if (map_addr == NULL) { munmap(bar_addr, bar->size); bar_addr = MAP_FAILED; RTE_LOG(ERR, EAL, "Failed to map pci BAR%d\n", diff --git a/drivers/bus/pci/pci_common_uio.c b/drivers/bus/pci/pci_common_uio.c index f4dca9da91..793dfd0a7c 100644 --- a/drivers/bus/pci/pci_common_uio.c +++ b/drivers/bus/pci/pci_common_uio.c @@ -58,7 +58,7 @@ pci_uio_map_secondary(struct rte_pci_device *dev) "Cannot mmap device resource file %s to address: %p\n", uio_res->maps[i].path, uio_res->maps[i].addr); - if (mapaddr != MAP_FAILED) { + if (mapaddr != NULL) { /* unmap addrs correctly mapped */ for (j = 0; j < i; j++) pci_unmap_resource( diff --git a/lib/librte_eal/rte_eal_exports.def b/lib/librte_eal/rte_eal_exports.def index e2eb24f01b..7f0c8f5376 100644 --- a/lib/librte_eal/rte_eal_exports.def +++ b/lib/librte_eal/rte_eal_exports.def @@ -46,6 +46,7 @@ EXPORTS rte_memzone_reserve_aligned rte_memzone_reserve_bounded rte_memzone_walk + rte_strerror rte_vlog rte_realloc rte_zmalloc diff --git a/lib/librte_pci/rte_pci.c b/lib/librte_pci/rte_pci.c index 9c80c4b71d..2adee07aa4 100644 --- a/lib/librte_pci/rte_pci.c +++ b/lib/librte_pci/rte_pci.c @@ -9,1
[dpdk-dev] [PATCH v7 1/9] eal: move OS common functions to single file
From: Tal Shnaiderman Move common functions between Unix and Windows to eal_common_config.c. Those functions are getter functions for IOVA, configuration, Multi-process. Move rte_config, internal_config, early_mem_config and runtime_dir to be defined in a common file. Signed-off-by: Tal Shnaiderman --- lib/librte_eal/common/eal_common_config.c | 118 ++ lib/librte_eal/common/eal_private.h | 1 + lib/librte_eal/common/meson.build | 2 + lib/librte_eal/freebsd/Makefile | 1 + lib/librte_eal/freebsd/eal.c | 231 ++- lib/librte_eal/include/rte_eal.h | 13 ++ lib/librte_eal/linux/Makefile | 1 + lib/librte_eal/linux/eal.c| 253 +- lib/librte_eal/windows/eal.c | 90 +++ 9 files changed, 353 insertions(+), 357 deletions(-) create mode 100644 lib/librte_eal/common/eal_common_config.c diff --git a/lib/librte_eal/common/eal_common_config.c b/lib/librte_eal/common/eal_common_config.c new file mode 100644 index 00..4a61972539 --- /dev/null +++ b/lib/librte_eal/common/eal_common_config.c @@ -0,0 +1,118 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2020 Mellanox Technologies, Ltd + */ +#include + +#include + +#include +#include + +/* early configuration structure, when memory config is not mmapped */ +static struct rte_mem_config early_mem_config; + +/* Address of global and public configuration */ +static struct rte_config rte_config = { + .mem_config = &early_mem_config, +}; + +/* platform-specific runtime dir */ +static char runtime_dir[PATH_MAX]; + +/* internal configuration */ +struct internal_config internal_config; + +/* Allow the application to print its usage message too if set */ +static rte_usage_hook_trte_application_usage_hook = NULL; + +const char * +rte_eal_get_runtime_dir(void) +{ + return runtime_dir; +} + +void +rte_eal_set_runtime_dir(char *run_dir, size_t size) +{ + strncpy(runtime_dir, run_dir, size); +} + +/* Return a pointer to the configuration structure */ +struct rte_config * +rte_eal_get_configuration(void) +{ + return &rte_config; +} + +/* Return a pointer to theinternal configuration structure */ +struct internal_config * +rte_eal_get_internal_configuration(void) +{ + return &internal_config; +} + +/* Return a pointer to rte_usage_hook_t */ +rte_usage_hook_t * +rte_eal_get_application_usage_hook(void) +{ + return &rte_application_usage_hook; +} + +enum rte_iova_mode +rte_eal_iova_mode(void) +{ + return rte_eal_get_configuration()->iova_mode; +} + +enum rte_proc_type_t +rte_eal_process_type(void) +{ + return rte_config.process_type; +} + +void +rte_eal_config_remap(void *mem_cfg_addr) +{ + memcpy(mem_cfg_addr, &early_mem_config, sizeof(early_mem_config)); + rte_config.mem_config = mem_cfg_addr; + + /* store address of the config in the config itself so that secondary +* processes could later map the config into this exact location +*/ + rte_config.mem_config->mem_cfg_addr = (uintptr_t) mem_cfg_addr; + + rte_config.mem_config->dma_maskbits = 0; +} + +/* Return user provided mbuf pool ops name */ +const char * +rte_eal_mbuf_user_pool_ops(void) +{ + return internal_config.user_mbuf_pool_ops_name; +} + +/* Set a per-application usage message */ +rte_usage_hook_t +rte_set_application_usage_hook(rte_usage_hook_t usage_func) +{ + rte_usage_hook_told_func; + + /* Will be NULL on the first call to denote the last usage routine. */ + old_func = rte_application_usage_hook; + rte_application_usage_hook = usage_func; + + return old_func; +} + +/* return non-zero if hugepages are enabled. */ +int +rte_eal_has_hugepages(void) +{ + return !internal_config.no_hugetlbfs; +} + +int +rte_eal_has_pci(void) +{ + return !internal_config.no_pci; +} diff --git a/lib/librte_eal/common/eal_private.h b/lib/librte_eal/common/eal_private.h index 0592fcd694..97cfd6a325 100644 --- a/lib/librte_eal/common/eal_private.h +++ b/lib/librte_eal/common/eal_private.h @@ -62,6 +62,7 @@ struct rte_config { struct rte_mem_config *mem_config; } __rte_packed; + /** * Get the global configuration structure. * diff --git a/lib/librte_eal/common/meson.build b/lib/librte_eal/common/meson.build index 3108442697..a16f002a3e 100644 --- a/lib/librte_eal/common/meson.build +++ b/lib/librte_eal/common/meson.build @@ -7,6 +7,7 @@ if is_windows sources += files( 'eal_common_bus.c', 'eal_common_class.c', + 'eal_common_config.c', 'eal_common_devargs.c', 'eal_common_dynmem.c', 'eal_common_errno.c', @@ -34,6 +35,7 @@ sources += files( 'eal_common_bus.c', 'eal_common_cpuflags.c', 'eal_common_class.c', + 'eal_common_config.c', 'eal_common_de
[dpdk-dev] [PATCH v7 7/9] bus/pci: introduce Windows support with stubs
From: Tal Shnaiderman Addition of stub eal and bus/pci functions to compile bus/pci for Windows. Signed-off-by: Tal Shnaiderman --- drivers/baseband/meson.build | 4 + drivers/bus/ifpga/meson.build | 6 ++ drivers/bus/pci/meson.build| 14 ++- drivers/bus/pci/pci_common.c | 2 - drivers/bus/pci/windows/pci.c | 169 + drivers/bus/vdev/meson.build | 6 ++ drivers/bus/vmbus/meson.build | 7 ++ drivers/common/meson.build | 4 + drivers/compress/meson.build | 4 + drivers/crypto/meson.build | 4 + drivers/event/meson.build | 4 + drivers/mempool/meson.build| 4 + drivers/meson.build| 4 - drivers/net/meson.build| 4 + drivers/raw/meson.build| 4 + drivers/vdpa/meson.build | 4 + lib/librte_eal/common/meson.build | 1 + lib/librte_eal/rte_eal_exports.def | 8 ++ lib/librte_eal/windows/eal.c | 28 +- lib/librte_eal/windows/eal_mp.c| 15 20 files changed, 285 insertions(+), 11 deletions(-) create mode 100644 drivers/bus/pci/windows/pci.c diff --git a/drivers/baseband/meson.build b/drivers/baseband/meson.build index 4d909f9a62..b299c3a063 100644 --- a/drivers/baseband/meson.build +++ b/drivers/baseband/meson.build @@ -1,6 +1,10 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2018 Luca Boccassi +if host_machine.system() == 'windows' + subdir_done() +endif + drivers = ['null', 'turbo_sw', 'fpga_lte_fec', 'fpga_5gnr_fec'] config_flag_fmt = 'RTE_LIBRTE_PMD_BBDEV_@0@' diff --git a/drivers/bus/ifpga/meson.build b/drivers/bus/ifpga/meson.build index 4ea31f1741..15339e065c 100644 --- a/drivers/bus/ifpga/meson.build +++ b/drivers/bus/ifpga/meson.build @@ -1,6 +1,12 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2010-2018 Intel Corporation +if host_machine.system() == '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') diff --git a/drivers/bus/pci/meson.build b/drivers/bus/pci/meson.build index b520bdfc14..31c492021e 100644 --- a/drivers/bus/pci/meson.build +++ b/drivers/bus/pci/meson.build @@ -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 host_machine.system() == 'bsd' + sources += files('pci_common_uio.c', + 'bsd/pci.c') includes += include_directories('bsd') endif +if host_machine.system() == 'windows' + sources += files('windows/pci.c') + includes += include_directories('windows') +endif deps += ['kvargs'] diff --git a/drivers/bus/pci/pci_common.c b/drivers/bus/pci/pci_common.c index 245d94f59c..eb0231f403 100644 --- a/drivers/bus/pci/pci_common.c +++ b/drivers/bus/pci/pci_common.c @@ -10,8 +10,6 @@ #include #include #include -#include - #include #include #include diff --git a/drivers/bus/pci/windows/pci.c b/drivers/bus/pci/windows/pci.c new file mode 100644 index 00..b1d34ae11c --- /dev/null +++ b/drivers/bus/pci/windows/pci.c @@ -0,0 +1,169 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright 2020 Mellanox Technologies, Ltd + */ +#include +#include + +#include +#include + +#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_p
[dpdk-dev] [PATCH v7 4/9] pci: fix format warning on Windows
From: Tal Shnaiderman the struct rte_pci_addr defines domain as uint32_t variable however the PCI_PRI_FMT macro used for logging the struct sets the format of domain to uint16_t. The mismatch causes the following warning messages in Windows clang build: format specifies type 'unsigned short' but the argument has type 'uint32_t' (aka 'unsigned int') [-Wformat] Signed-off-by: Tal Shnaiderman --- lib/librte_pci/rte_pci.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/librte_pci/rte_pci.h b/lib/librte_pci/rte_pci.h index 9337079178..104b2bb858 100644 --- a/lib/librte_pci/rte_pci.h +++ b/lib/librte_pci/rte_pci.h @@ -23,7 +23,7 @@ extern "C" { #include /** Formatting string for PCI device identifier: Ex: :00:01.0 */ -#define PCI_PRI_FMT "%.4" PRIx16 ":%.2" PRIx8 ":%.2" PRIx8 ".%" PRIx8 +#define PCI_PRI_FMT "%.4" PRIx32 ":%.2" PRIx8 ":%.2" PRIx8 ".%" PRIx8 #define PCI_PRI_STR_SIZE sizeof(":XX:XX.X") /** Short formatting string, without domain, for PCI device: Ex: 00:01.0 */ -- 2.16.1.windows.4
[dpdk-dev] [PATCH v7 5/9] drivers: ignore pmdinfogen generation for Windows
From: Tal Shnaiderman pmdinfogen generation is currently unsupported for Windows. The relevant part in meson.build is skipped. Signed-off-by: Tal Shnaiderman --- drivers/meson.build | 27 ++- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/drivers/meson.build b/drivers/meson.build index cfb6a833c9..f4b6cbf3a6 100644 --- a/drivers/meson.build +++ b/drivers/meson.build @@ -111,19 +111,20 @@ foreach class:dpdk_driver_classes # lib and then running pmdinfogen on the contents of # that lib. The final lib reuses the object files and # adds in the new source file. - out_filename = lib_name + '.pmd.c' - tmp_lib = static_library('tmp_' + lib_name, - sources, - include_directories: includes, - dependencies: static_deps, - c_args: cflags) - objs += tmp_lib.extract_all_objects() - sources = custom_target(out_filename, - command: [pmdinfo, tmp_lib.full_path(), - '@OUTPUT@', pmdinfogen], - output: out_filename, - depends: [pmdinfogen, tmp_lib]) - + if host_machine.system() != 'windows' + out_filename = lib_name + '.pmd.c' + tmp_lib = static_library('tmp_' + lib_name, + sources, + include_directories: includes, + dependencies: static_deps, + c_args: cflags) + objs += tmp_lib.extract_all_objects() + sources = custom_target(out_filename, + command: [pmdinfo, tmp_lib.full_path(), + '@OUTPUT@', pmdinfogen], + output: out_filename, + depends: [pmdinfogen, tmp_lib]) + endif version_map = '@0@/@1@/@2@_version.map'.format( meson.current_source_dir(), drv_path, lib_name) -- 2.16.1.windows.4
[dpdk-dev] [PATCH v7 3/9] pci: build on Windows
From: Tal Shnaiderman Added in rte_pci header file to include off_t type since it is missing for Windows. Signed-off-by: Tal Shnaiderman --- lib/librte_eal/rte_eal_exports.def | 1 + lib/librte_pci/rte_pci.h | 1 + lib/meson.build| 5 - 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/librte_eal/rte_eal_exports.def b/lib/librte_eal/rte_eal_exports.def index 7f0c8f5376..61bcb8aca7 100644 --- a/lib/librte_eal/rte_eal_exports.def +++ b/lib/librte_eal/rte_eal_exports.def @@ -1,5 +1,6 @@ EXPORTS __rte_panic + per_lcore__rte_errno rte_calloc rte_calloc_socket rte_eal_get_configuration diff --git a/lib/librte_pci/rte_pci.h b/lib/librte_pci/rte_pci.h index b721bbf580..9337079178 100644 --- a/lib/librte_pci/rte_pci.h +++ b/lib/librte_pci/rte_pci.h @@ -20,6 +20,7 @@ extern "C" { #include #include #include +#include /** Formatting string for PCI device identifier: Ex: :00:01.0 */ #define PCI_PRI_FMT "%.4" PRIx16 ":%.2" PRIx8 ":%.2" PRIx8 ".%" PRIx8 diff --git a/lib/meson.build b/lib/meson.build index d190d84eff..a8fd317a18 100644 --- a/lib/meson.build +++ b/lib/meson.build @@ -36,7 +36,10 @@ libraries = [ 'flow_classify', 'bpf', 'graph', 'node'] if is_windows - libraries = ['kvargs','eal'] # only supported libraries for windows + libraries = [ + 'kvargs','eal', + 'pci', + ] # only supported libraries for windows endif default_cflags = machine_args -- 2.16.1.windows.4
[dpdk-dev] [PATCH v7 9/9] build: generate version.map file for MinGW on Windows
From: Tal Shnaiderman The MinGW build for Windows has special cases where exported function contain additional prefix: __emutls_v.per_lcore__* To avoid adding those prefixed functions to the version.map file the map_to_def.py script was modified to create a map file for MinGW with the needed changed. The file name was changed to map_to_win.py and lib/meson.build map output was unified with drivers/meson.build output Signed-off-by: Tal Shnaiderman --- buildtools/{map_to_def.py => map_to_win.py} | 11 ++- buildtools/meson.build | 4 ++-- drivers/meson.build | 12 +--- lib/meson.build | 19 ++- 4 files changed, 35 insertions(+), 11 deletions(-) rename buildtools/{map_to_def.py => map_to_win.py} (69%) diff --git a/buildtools/map_to_def.py b/buildtools/map_to_win.py similarity index 69% rename from buildtools/map_to_def.py rename to buildtools/map_to_win.py index 6775b54a9d..a539f2129c 100644 --- a/buildtools/map_to_def.py +++ b/buildtools/map_to_win.py @@ -10,12 +10,21 @@ def is_function_line(ln): return ln.startswith('\t') and ln.endswith(';\n') and ":" not in ln +# MinGW keeps the original .map file but replaces per_lcore__* to __emutls_v.per_lcore__* +def create_mingw_map_file(input_map, output_map): +with open(input_map) as f_in, open(output_map, 'w') as f_out: +f_out.writelines([lines.replace('per_lcore__', '__emutls_v.per_lcore__') for lines in f_in.readlines()]) def main(args): if not args[1].endswith('version.map') or \ -not args[2].endswith('exports.def'): +not args[2].endswith('exports.def') and \ +not args[2].endswith('mingw.map'): return 1 +if args[2].endswith('mingw.map'): +create_mingw_map_file(args[1], args[2]) +return 0 + # special case, allow override if an def file already exists alongside map file override_file = join(dirname(args[1]), basename(args[2])) if exists(override_file): diff --git a/buildtools/meson.build b/buildtools/meson.build index d5f8291beb..f9d2fdf74b 100644 --- a/buildtools/meson.build +++ b/buildtools/meson.build @@ -9,14 +9,14 @@ list_dir_globs = find_program('list-dir-globs.py') check_symbols = find_program('check-symbols.sh') ldflags_ibverbs_static = find_program('options-ibverbs-static.sh') -# set up map-to-def script using python, either built-in or external +# set up map-to-win script using python, either built-in or external python3 = import('python').find_installation(required: false) if python3.found() py3 = [python3] else py3 = ['meson', 'runpython'] endif -map_to_def_cmd = py3 + files('map_to_def.py') +map_to_win_cmd = py3 + files('map_to_win.py') sphinx_wrapper = py3 + files('call-sphinx-build.py') # stable ABI always starts with "DPDK_" diff --git a/drivers/meson.build b/drivers/meson.build index 646a7d5eb5..2cd8505d10 100644 --- a/drivers/meson.build +++ b/drivers/meson.build @@ -152,16 +152,22 @@ foreach class:dpdk_driver_classes implib = 'lib' + lib_name + '.dll.a' def_file = custom_target(lib_name + '_def', - command: [map_to_def_cmd, '@INPUT@', '@OUTPUT@'], + command: [map_to_win_cmd, '@INPUT@', '@OUTPUT@'], input: version_map, output: '@0@_exports.def'.format(lib_name)) - lk_deps = [version_map, def_file] + + mingw_map = custom_target(lib_name + '_mingw', + command: [map_to_win_cmd, '@INPUT@', '@OUTPUT@'], + input: version_map, + output: '@0@_mingw.map'.format(lib_name)) + + lk_deps = [version_map, def_file, mingw_map] if is_windows if is_ms_linker lk_args = ['-Wl,/def:' + def_file.full_path(), '-Wl,/implib:drivers\\' + implib] else - lk_args = [] + lk_args = ['-Wl,--version-script=' + mingw_map.full_path()] endif else lk_args = ['-Wl,--version-script=' + version_map] diff --git a/lib/meson.build b/lib/meson.build index a8fd317a18..af66610fcb 100644 --- a/lib/meson.build +++ b/lib/meson.build @@ -149,19 +149,28 @@ foreach l:libraries meson.current_source_dir(), dir_name, name) implib = dir_name + '.dll.a' - def_file = custom_target(name + '_def', - command: [map_to_def_cmd, '@INPUT@', '@OUTPUT@'], + def_
Re: [dpdk-dev] [PATCH v3 1/4] regexdev: introduce regexdev subsystem
Hi All, This is the only patch that is missing an ack, I plan to submit the PMD code next week, so please review and ack this patch. Thanks, Ori > -Original Message- > From: dev On Behalf Of Ori Kam > Sent: Thursday, May 7, 2020 12:46 PM > To: jer...@marvell.com; xiang.w.w...@intel.com > Cc: g...@marvell.com; dev@dpdk.org; pbhagavat...@marvell.com; Shahaf > Shuler ; hemant.agra...@nxp.com; Opher Reviv > ; Alex Rosenbaum ; > dov...@marvell.com; pkap...@marvell.com; nipun.gu...@nxp.com; > bruce.richard...@intel.com; yang.a.h...@intel.com; harry.ch...@intel.com; > gu.ji...@zte.com.cn; shanjia...@chinatelecom.cn; > zhangy@chinatelecom.cn; lixin...@huachentel.com; wush...@inspur.com; > yuying...@yxlink.com; fanchengg...@sunyainfo.com; > davidf...@tencent.com; liuzho...@chinaunicom.cn; > zhaoyon...@huawei.com; o...@yunify.com; j...@netgate.com; > hongjun...@intel.com; j.bromh...@titan-ic.com; d...@ntop.org; > f...@napatech.com; arthur...@lionic.com; Thomas Monjalon > ; Ori Kam > Subject: [dpdk-dev] [PATCH v3 1/4] regexdev: introduce regexdev subsystem > > From: Jerin Jacob > > As RegEx usage become more used by DPDK applications, for example: > * Next Generation Firewalls (NGFW) > * Deep Packet and Flow Inspection (DPI) > * Intrusion Prevention Systems (IPS) > * DDoS Mitigation > * Network Monitoring > * Data Loss Prevention (DLP) > * Smart NICs > * Grammar based content processing > * URL, spam and adware filtering > * Advanced auditing and policing of user/application security policies > * Financial data mining - parsing of streamed financial feeds > * Application recognition. > * Dmemory introspection. > * Natural Language Processing (NLP) > * Sentiment Analysis. > * Big data databse acceleration. > * Computational storage. > > Number of PMD providers started to work on HW implementation, > along side with SW implementations. > > This lib adds the support for those kind of devices. > > The RegEx Device API is composed of two parts: > - The application-oriented RegEx API that includes functions to setup > a RegEx device (configure it, setup its queue pairs and start it), > update the rule database and so on. > > - The driver-oriented RegEx API that exports a function allowing > a RegEx poll Mode Driver (PMD) to simultaneously register itself as > a RegEx device driver. > > RegEx device components and definitions: > > +-+ > | | > | o-+rte_regexdev_[en|de]queue_burst() > | PCRE basedo--+ | | > | RegEx pattern | | | ++ | > | matching engine o--+--+--o| |+--+ > | | | | | queue |<==o===>|Core 0| > | o+ | | | pair 0 || | > | || | | +++--+ > +-+| | | >^ | | | ++ >| | | | ||+--+ >| | +--+--o queue |<==>|Core 1| >Rule|Database || | pair 1 || | > +--+--+|| +++--+ > | Group 0 ||| > | +-+ ||| +++--+ > | | Rules 0..n | ||| |||Core 2| > | +-+ ||+--o queue |<==>| | > | Group 1 || | pair 2 |+--+ > | +-+ || ++ > | | Rules 0..n | || > | +-+ || ++ > | Group 2 || ||+--+ > | +-+ || | queue |<==>|Core n| > | | Rules 0..n | |+---o pair n || | > | +-+ |+++--+ > | Group n | > | +-+ |<---rte_regexdev_rule_db_update() > | | | |<---rte_regexdev_rule_db_compile_activate() > | | Rules 0..n | |<---rte_regexdev_rule_db_import() > | +-+ |--->rte_regexdev_rule_db_export() > +-+ > > RegEx: A regular expression is a concise and flexible means for matching > strings of text, such as particular characters, words, or patterns of > characters. A common abbreviation for this is â~@~\RegExâ~@~]. > > RegEx device: A hardware or software-based implementation of RegEx > device API for PCRE based pattern matching syntax and semantics. > > PCRE RegEx syntax and semantics specification: > https://eur03.safelinks.protection.outlook.com/?url=http%3A%2F%2Fregexkit.so > urceforge.net%2FDocumentation%2Fpcre%2Fpcrepattern.html&data=02% > 7C01%7Corika%40mellanox.com%7C39f5765e405c46b18ba308d7f26b8480%7C > a652971c7d2e4d9ba6a4d149256f461b%7C0%7C0%7C637244415961144968&a > mp;sdata=NWYja3g5nTerSe8vIFSHpTeK8ipKOhMnXmmNBuJtWqY%3D&res > erved=0 > > RegEx queue pair: Each RegEx devic
Re: [dpdk-dev] [PATCH v7 7/9] bus/pci: introduce Windows support with stubs
> diff --git a/lib/librte_eal/rte_eal_exports.def > b/lib/librte_eal/rte_eal_exports.def > index 61bcb8aca7..3b0c8b60a5 100644 > --- a/lib/librte_eal/rte_eal_exports.def > +++ b/lib/librte_eal/rte_eal_exports.def > @@ -3,6 +3,11 @@ EXPORTS > per_lcore__rte_errno > rte_calloc > rte_calloc_socket > + per_lcore__rte_errno per_lcore__rte_errno is already exported. > + 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 +53,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 Fady B.
[dpdk-dev] [PATCH v5] eal/windows: ring build on Windows
Building ring on Windows. Signed-off-by: Fady Bader --- Depends-on: series-10531 ("Windows bus/pci support") v5: rebase to current master and "Windows bus/pci support" v7. v4: rebase on "Windows basic memory management" v5. v3: Fix style issues. v2: Fix style issues. --- lib/meson.build | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/meson.build b/lib/meson.build index af66610fcb..9074cb58af 100644 --- a/lib/meson.build +++ b/lib/meson.build @@ -38,6 +38,7 @@ libraries = [ if is_windows libraries = [ 'kvargs','eal', + 'ring', 'pci', ] # only supported libraries for windows endif -- 2.16.1.windows.4
Re: [dpdk-dev] [PATCH] net/mlx5: remove redundant newline
Hi, > -Original Message- > From: dev On Behalf Of David Marchand > Sent: Wednesday, June 17, 2020 4:53 PM > To: dev@dpdk.org > Cc: sta...@dpdk.org; Matan Azrad ; Shahaf Shuler > ; Slava Ovsiienko ; > Bing Zhao ; Jack Min > Subject: [dpdk-dev] [PATCH] net/mlx5: remove redundant newline > > The DRV_LOG macro already appends a newline. > > Fixes: 46287eacc1b1 ("net/mlx5: introduce hash list") > Fixes: 860897d2895a ("net/mlx5: reorganize flow tables with hash list") > Fixes: e484e4032332 ("net/mlx5: optimize tag traversal with hash list") > Fixes: 6801116688fe ("net/mlx5: fix multiple flow table hash list") > Cc: sta...@dpdk.org > > Signed-off-by: David Marchand > --- > drivers/net/mlx5/mlx5.c | 6 +++--- > drivers/net/mlx5/mlx5_utils.c | 6 +++--- > 2 files changed, 6 insertions(+), 6 deletions(-) > > diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c > index 95a0f337fe..fe7ed4899a 100644 > --- a/drivers/net/mlx5/mlx5.c > +++ b/drivers/net/mlx5/mlx5.c > @@ -1062,7 +1062,7 @@ mlx5_alloc_table_hash_list(struct mlx5_priv *priv) > snprintf(s, sizeof(s), "%s_flow_table", priv->sh->ibdev_name); > sh->flow_tbls = mlx5_hlist_create(s, > MLX5_FLOW_TABLE_HLIST_ARRAY_SIZE); > if (!sh->flow_tbls) { > - DRV_LOG(ERR, "flow tables with hash creation failed.\n"); > + DRV_LOG(ERR, "flow tables with hash creation failed."); > err = ENOMEM; > return err; > } > @@ -1146,7 +1146,7 @@ mlx5_alloc_shared_dr(struct mlx5_priv *priv) > if (!sh->flow_tbls) > err = mlx5_alloc_table_hash_list(priv); > else > - DRV_LOG(DEBUG, "sh->flow_tbls[%p] already created, > reuse\n", > + DRV_LOG(DEBUG, "sh->flow_tbls[%p] already created, > reuse", > (void *)sh->flow_tbls); > if (err) > return err; > @@ -1154,7 +1154,7 @@ mlx5_alloc_shared_dr(struct mlx5_priv *priv) > snprintf(s, sizeof(s), "%s_tags", sh->ibdev_name); > sh->tag_table = mlx5_hlist_create(s, > MLX5_TAGS_HLIST_ARRAY_SIZE); > if (!sh->tag_table) { > - DRV_LOG(ERR, "tags with hash creation failed.\n"); > + DRV_LOG(ERR, "tags with hash creation failed."); > err = ENOMEM; > goto error; > } > diff --git a/drivers/net/mlx5/mlx5_utils.c b/drivers/net/mlx5/mlx5_utils.c > index d29fbcbc83..6f3ba7ca49 100644 > --- a/drivers/net/mlx5/mlx5_utils.c > +++ b/drivers/net/mlx5/mlx5_utils.c > @@ -20,7 +20,7 @@ mlx5_hlist_create(const char *name, uint32_t size) > if (!rte_is_power_of_2(size)) { > act_size = rte_align32pow2(size); > DRV_LOG(WARNING, "Size 0x%" PRIX32 " is not power of 2, > will " > - "be aligned to 0x%" PRIX32 ".\n", size, act_size); > + "be aligned to 0x%" PRIX32 ".", size, act_size); > } else { > act_size = size; > } > @@ -29,7 +29,7 @@ mlx5_hlist_create(const char *name, uint32_t size) > /* Using zmalloc, then no need to initialize the heads. */ > h = rte_zmalloc(name, alloc_size, RTE_CACHE_LINE_SIZE); > if (!h) { > - DRV_LOG(ERR, "No memory for hash list %s creation\n", > + DRV_LOG(ERR, "No memory for hash list %s creation", > name ? name : "None"); > return NULL; > } > @@ -37,7 +37,7 @@ mlx5_hlist_create(const char *name, uint32_t size) > snprintf(h->name, MLX5_HLIST_NAMESIZE, "%s", name); > h->table_sz = act_size; > h->mask = act_size - 1; > - DRV_LOG(DEBUG, "Hash list with %s size 0x%" PRIX32 " is > created.\n", > + DRV_LOG(DEBUG, "Hash list with %s size 0x%" PRIX32 " is created.", > h->name, act_size); > return h; > } > -- > 2.23.0 Patch rebased and applied to next-net-mlx, Kindest regards, Raslan Darawsheh
Re: [dpdk-dev] [PATCH] net/i40e: enable port filter by switch filter
hi, guinan On 6/11/2020 1:24 PM, Guinan Sun wrote: This patch enables the filter that supports to create following two rules for the same packet type: One is to select source port only as input set and the other is for destination port only. Signed-off-by: Guinan Sun --- doc/guides/rel_notes/release_20_08.rst | 7 + drivers/net/i40e/i40e_ethdev.c | 195 - drivers/net/i40e/i40e_ethdev.h | 17 ++ drivers/net/i40e/i40e_flow.c | 223 + 4 files changed, 441 insertions(+), 1 deletion(-) diff --git a/doc/guides/rel_notes/release_20_08.rst b/doc/guides/rel_notes/release_20_08.rst index 7a67c960c..16870100d 100644 --- a/doc/guides/rel_notes/release_20_08.rst +++ b/doc/guides/rel_notes/release_20_08.rst @@ -68,6 +68,13 @@ New Features * Added new PMD devarg ``reclaim_mem_mode``. +* **Updated Intel i40e driver.** + + Updated i40e PMD with new features and improvements, including: + + * Added a new type of cloud filter to support the coexistence of the +following two rules. One selects L4 destination as input set and +the other one selects L4 source port. Removed Items - diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c index 970a31cb2..97e6e948a 100644 --- a/drivers/net/i40e/i40e_ethdev.c +++ b/drivers/net/i40e/i40e_ethdev.c @@ -7956,6 +7956,13 @@ i40e_dev_tunnel_filter_set(struct i40e_pf *pf, #define I40E_TR_GRE_KEY_MASK 0x400 #define I40E_TR_GRE_KEY_WITH_XSUM_MASK0x800 #define I40E_TR_GRE_NO_KEY_MASK 0x8000 +#define I40E_AQC_REPLACE_CLOUD_CMD_INPUT_PORT_TR_WORD0 0x49 +#define I40E_AQC_REPLACE_CLOUD_CMD_INPUT_DIRECTION_WORD0 0x41 +#define I40E_AQC_REPLACE_CLOUD_CMD_INPUT_INGRESS_WORD0 0x80 +#define I40E_DIRECTION_INGRESS_KEY 0x8000 +#define I40E_TR_L4_TYPE_TCP0x2 +#define I40E_TR_L4_TYPE_UDP0x4 +#define I40E_TR_L4_TYPE_SCTP 0x8 static enum i40e_status_code i40e_replace_mpls_l1_filter(struct i40e_pf *pf) @@ -8254,6 +8261,131 @@ i40e_status_code i40e_replace_gtp_cloud_filter(struct i40e_pf *pf) return status; } +static enum i40e_status_code +i40e_replace_port_l1_filter(struct i40e_pf *pf, enum i40e_l4_port_type port_type) +{ + struct i40e_aqc_replace_cloud_filters_cmd_buf filter_replace_buf; + struct i40e_aqc_replace_cloud_filters_cmd filter_replace; + enum i40e_status_code status = I40E_SUCCESS; + struct i40e_hw *hw = I40E_PF_TO_HW(pf); + struct rte_eth_dev *dev = ((struct i40e_adapter *)hw->back)->eth_dev; + The Christmas tree would be look good? + if (pf->support_multi_driver) { + PMD_DRV_LOG(ERR, "Replace l1 filter is not supported."); + return I40E_NOT_SUPPORTED; + } + + memset(&filter_replace, 0, + sizeof(struct i40e_aqc_replace_cloud_filters_cmd)); + memset(&filter_replace_buf, 0, + sizeof(struct i40e_aqc_replace_cloud_filters_cmd_buf)); + + /* create L1 filter */ + if (port_type == I40E_L4_PORT_TYPE_SRC) { + filter_replace.old_filter_type = + I40E_AQC_REPLACE_CLOUD_CMD_INPUT_FV_TUNNLE_KEY; + filter_replace.new_filter_type = I40E_AQC_ADD_CLOUD_FILTER_0X11; + filter_replace_buf.data[8] = + I40E_AQC_REPLACE_CLOUD_CMD_INPUT_FV_SRC_PORT; + } else { + filter_replace.old_filter_type = + I40E_AQC_REPLACE_CLOUD_CMD_INPUT_FV_STAG_IVLAN; + filter_replace.new_filter_type = I40E_AQC_ADD_CLOUD_FILTER_0X10; + filter_replace_buf.data[8] = + I40E_AQC_REPLACE_CLOUD_CMD_INPUT_FV_DST_PORT; + } + + filter_replace.tr_bit = 0; + /* Prepare the buffer, 3 entries */ + filter_replace_buf.data[0] = + I40E_AQC_REPLACE_CLOUD_CMD_INPUT_DIRECTION_WORD0; + filter_replace_buf.data[0] |= + I40E_AQC_REPLACE_CLOUD_CMD_INPUT_VALIDATED; + filter_replace_buf.data[2] = 0x00; + filter_replace_buf.data[3] = + I40E_AQC_REPLACE_CLOUD_CMD_INPUT_INGRESS_WORD0; + filter_replace_buf.data[4] = + I40E_AQC_REPLACE_CLOUD_CMD_INPUT_PORT_TR_WORD0; + filter_replace_buf.data[4] |= + I40E_AQC_REPLACE_CLOUD_CMD_INPUT_VALIDATED; + filter_replace_buf.data[5] = 0x00; + filter_replace_buf.data[6] = I40E_TR_L4_TYPE_UDP | + I40E_TR_L4_TYPE_TCP | + I40E_TR_L4_TYPE_SCTP; + filter_replace_buf.data[7] = 0x00; + filter_replace_buf.data[8] |= + I40E_AQC_REPLACE_CLOUD_CMD_INPUT_VALIDATED; + filter_replace_buf.data[9] = 0x00; + filter_replace_buf.data[10] = 0xFF; + filter_replace_buf.data[11] = 0xFF; + + status = i40e_aq_replace_cloud_filters(hw, &filter_replace, +
[dpdk-dev] When .remove function (of struct rte_vdev_driver) is called
While working on applications(l2fwd, testpmd) with PMD(memif, Tun|Tap and some other) I have noticed that the .probe function of rte_vdev_driver structure is called in rte_eal_init() and .remove function of rte_vdev_driver structure is NEVER called, even after exiting the application. My Question is How/When .remove function of rte_vdev_driver structure is called. Thanks, M. Bilal
[dpdk-dev] [PATCH] dedicated queues: delete redundant check valid_bonded_port_id has include check_for_bonded_ethdev, no need to check again.
From: pandongyang <197020...@qq.com> Signed-off-by: pandongyang <197020...@qq.com> --- drivers/net/bonding/rte_eth_bond_8023ad.c | 6 -- 1 file changed, 6 deletions(-) diff --git a/drivers/net/bonding/rte_eth_bond_8023ad.c b/drivers/net/bonding/rte_eth_bond_8023ad.c index b77a37d..3393743 100644 --- a/drivers/net/bonding/rte_eth_bond_8023ad.c +++ b/drivers/net/bonding/rte_eth_bond_8023ad.c @@ -1675,9 +1675,6 @@ rte_eth_bond_8023ad_dedicated_queues_enable(uint16_t port) dev = &rte_eth_devices[port]; internals = dev->data->dev_private; - if (check_for_bonded_ethdev(dev) != 0) - return -1; - if (bond_8023ad_slow_pkt_hw_filter_supported(port) != 0) return -1; @@ -1704,9 +1701,6 @@ rte_eth_bond_8023ad_dedicated_queues_disable(uint16_t port) dev = &rte_eth_devices[port]; internals = dev->data->dev_private; - if (check_for_bonded_ethdev(dev) != 0) - return -1; - /* Device must be stopped to set up slow queue */ if (dev->data->dev_started) return -1; -- 2.23.0.windows.1
Re: [dpdk-dev] [PATCH] net/i40e: fix modifying the number of queues
hi, alvin On 6/10/2020 8:07 PM, alvinx.zh...@intel.com wrote: From: Alvin Zhang For the newly created VF, if the number of qps is greater than 4 at startup, it may fail to start. This patch updates the API `i40evf_dev_configure`. Could you explicit explain why it limit to 4 qps, and more detail about below code change with the purpose of the patch. Fixes: c48eb308ed13 ("net/i40e: support VF request more queues") Cc: sta...@dpdk.org Signed-off-by: Alvin Zhang --- drivers/net/i40e/i40e_ethdev_vf.c | 32 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c index bb5d28a..7500e0a 100644 --- a/drivers/net/i40e/i40e_ethdev_vf.c +++ b/drivers/net/i40e/i40e_ethdev_vf.c @@ -1082,13 +1082,10 @@ static int i40evf_dev_xstats_get(struct rte_eth_dev *dev, args.out_buffer = vf->aq_resp; args.out_size = I40E_AQ_BUF_SZ; - rte_eal_alarm_cancel(i40evf_dev_alarm_handler, dev); Why interrupt handler is no need to cancel here and more why this change is related with this patch according with the commit log? err = i40evf_execute_vf_cmd(dev, &args); if (err) PMD_DRV_LOG(ERR, "fail to execute command OP_REQUEST_QUEUES"); - rte_eal_alarm_set(I40EVF_ALARM_INTERVAL, - i40evf_dev_alarm_handler, dev); return err; } @@ -1516,7 +1513,7 @@ static int i40evf_dev_xstats_get(struct rte_eth_dev *dev, hw->bus.device = pci_dev->addr.devid; hw->bus.func = pci_dev->addr.function; hw->hw_addr = (void *)pci_dev->mem_resource[0].addr; - hw->adapter_stopped = 0; + hw->adapter_stopped = 1; Why it should be set stopped when init dev? hw->adapter_closed = 0; /* Pass the information to the rte_eth_dev_close() that it should also @@ -1612,16 +1609,35 @@ static int eth_i40evf_pci_remove(struct rte_pci_device *pci_dev) ad->tx_vec_allowed = true; if (num_queue_pairs > vf->vsi_res->num_queue_pairs) { - int ret = 0; + struct i40e_hw *hw; + int ret; + hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private); PMD_DRV_LOG(INFO, "change queue pairs from %u to %u", vf->vsi_res->num_queue_pairs, num_queue_pairs); + if (hw->adapter_stopped == 0) { + PMD_DRV_LOG(WARNING, "Device must be stopped first!"); + return -EINVAL; + } + + rte_eal_alarm_cancel(i40evf_dev_alarm_handler, dev); ret = i40evf_request_queues(dev, num_queue_pairs); - if (ret != 0) + if (ret) return ret; - ret = i40evf_dev_reset(dev); - if (ret != 0) + /* +* The device must be reinitiated after queue resources +* changed +*/ Should you check below part is reinitialize process according to exist dev_close and dev_init. + i40e_shutdown_adminq(hw); + i40evf_disable_irq0(hw); + rte_free(vf->vf_res); + vf->vf_res = NULL; + rte_free(vf->aq_resp); + vf->aq_resp = NULL; + + ret = i40evf_dev_init(dev); + if (ret) return ret; }
Re: [dpdk-dev] [PATCH v2 2/2] ethdev: fix VLAN offloads set if no relative capabilities
On 6/20/20 9:53 AM, Wei Hu (Xavier) wrote: > Currently, there is a potential problem that calling the API function > rte_eth_dev_set_vlan_offload to start VLAN hardware offloads which the > driver does not support. If the PMD driver does not support certain VLAN > hardware offloads and does not check for it, the hardware setting will > not change, but the VLAN offloads in dev->data->dev_conf.rxmode.offloads > will be turned on. > > It is supposed to check the hardware capabilities to decide whether the > relative callback needs to be called just like the behavior in the API > function named rte_eth_dev_configure. And it is also needed to cleanup > duplicated checks which are done in some PMDs. > > Fixes: a4996bd89c42 ("ethdev: new Rx/Tx offloads API") > Cc: sta...@dpdk.org > > Signed-off-by: Chengchang Tang > Signed-off-by: Wei Hu (Xavier) For ethdev part: Acked-by: Andrew Rybchenko I'd like to highlight that it is behaviour change for some PMDs which simply ignore (with error/warning log message) unsupported VLAN offloads, but now it will fail. We should very carefully consider backporting of these changes. I'd say we should, since it is rather a bug fix. IMHO, it is better to send v3 using --to-cmd ./devtools/get-maintainer.sh in order to have all driver maintainers in To. > --- > v1 -> v2: cleanup duplicated checks which are done in som PMDs. > --- > drivers/net/dpaa2/dpaa2_ethdev.c | 5 - > drivers/net/enic/enic_ethdev.c | 12 > drivers/net/fm10k/fm10k_ethdev.c | 20 > drivers/net/hinic/hinic_pmd_ethdev.c | 6 -- > drivers/net/i40e/i40e_ethdev.c | 5 - > drivers/net/nfp/nfp_net.c | 5 - > drivers/net/octeontx/octeontx_ethdev_ops.c | 10 -- > drivers/net/octeontx2/otx2_vlan.c | 5 - > drivers/net/qede/qede_ethdev.c | 3 --- > lib/librte_ethdev/rte_ethdev.c | 21 + > 10 files changed, 21 insertions(+), 71 deletions(-) > > diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c > b/drivers/net/dpaa2/dpaa2_ethdev.c > index 2f031ec..da5018f 100644 > --- a/drivers/net/dpaa2/dpaa2_ethdev.c > +++ b/drivers/net/dpaa2/dpaa2_ethdev.c > @@ -169,11 +169,6 @@ dpaa2_vlan_offload_set(struct rte_eth_dev *dev, int mask) > DPAA2_PMD_INFO("Unable to set vlan filter = %d", ret); > } > next_mask: > - if (mask & ETH_VLAN_EXTEND_MASK) { > - if (dev->data->dev_conf.rxmode.offloads & > - DEV_RX_OFFLOAD_VLAN_EXTEND) > - DPAA2_PMD_INFO("VLAN extend offload not supported"); > - } > > return 0; > } > diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c > index 32d5397..ef8900d 100644 > --- a/drivers/net/enic/enic_ethdev.c > +++ b/drivers/net/enic/enic_ethdev.c > @@ -374,18 +374,6 @@ static int enicpmd_vlan_offload_set(struct rte_eth_dev > *eth_dev, int mask) > enic->ig_vlan_strip_en = 0; > } > > - if ((mask & ETH_VLAN_FILTER_MASK) && > - (offloads & DEV_RX_OFFLOAD_VLAN_FILTER)) { > - dev_warning(enic, > - "Configuration of VLAN filter is not supported\n"); > - } > - > - if ((mask & ETH_VLAN_EXTEND_MASK) && > - (offloads & DEV_RX_OFFLOAD_VLAN_EXTEND)) { > - dev_warning(enic, > - "Configuration of extended VLAN is not supported\n"); > - } > - > return enic_set_vlan_strip(enic); > } > > diff --git a/drivers/net/fm10k/fm10k_ethdev.c > b/drivers/net/fm10k/fm10k_ethdev.c > index f537ab2..47f6f76 100644 > --- a/drivers/net/fm10k/fm10k_ethdev.c > +++ b/drivers/net/fm10k/fm10k_ethdev.c > @@ -1577,26 +1577,6 @@ fm10k_vlan_filter_set(struct rte_eth_dev *dev, > uint16_t vlan_id, int on) > static int > fm10k_vlan_offload_set(struct rte_eth_dev *dev, int mask) > { > - if (mask & ETH_VLAN_STRIP_MASK) { > - if (!(dev->data->dev_conf.rxmode.offloads & > - DEV_RX_OFFLOAD_VLAN_STRIP)) > - PMD_INIT_LOG(ERR, "VLAN stripping is " > - "always on in fm10k"); > - } > - > - if (mask & ETH_VLAN_EXTEND_MASK) { > - if (dev->data->dev_conf.rxmode.offloads & > - DEV_RX_OFFLOAD_VLAN_EXTEND) > - PMD_INIT_LOG(ERR, "VLAN QinQ is not " > - "supported in fm10k"); > - } > - > - if (mask & ETH_VLAN_FILTER_MASK) { > - if (!(dev->data->dev_conf.rxmode.offloads & > - DEV_RX_OFFLOAD_VLAN_FILTER)) > - PMD_INIT_LOG(ERR, "VLAN filter is always on in fm10k"); > - } > - > return 0; > } > > diff --git a/drivers/net/hinic/hinic_pmd_ethdev.c > b/drivers/net/hinic/hinic_pmd_ethdev.c > index 0c3e1c0..0009a61 100644 > --- a/drivers/net/hinic/hinic_pmd_ethdev.c > +++ b/drivers/net/hi
[dpdk-dev] [dpdk-dev v3] net/iavf: add inner 5 tuple hash for GTPU
Previous iavf only support inner ipv4 hash for GTPU, this patch aims to enable inner 5 tuple hash for GTPU, that involves inner ipv4 src/dst, tcp sport/dport, udp sport/dport and protocol id. Signed-off-by: Jeff Guo --- v3->v2: correct some typo and refine code --- drivers/net/iavf/iavf_hash.c | 1816 -- 1 file changed, 1299 insertions(+), 517 deletions(-) diff --git a/drivers/net/iavf/iavf_hash.c b/drivers/net/iavf/iavf_hash.c index a7691ef0c..16db38dcd 100644 --- a/drivers/net/iavf/iavf_hash.c +++ b/drivers/net/iavf/iavf_hash.c @@ -24,32 +24,34 @@ #include "iavf_generic_flow.h" enum iavf_pattern_hint_type { - IAVF_PATTERN_HINT_NONE, - IAVF_PATTERN_HINT_IPV4, - IAVF_PATTERN_HINT_IPV4_UDP, - IAVF_PATTERN_HINT_IPV4_TCP, - IAVF_PATTERN_HINT_IPV4_SCTP, - IAVF_PATTERN_HINT_IPV6, - IAVF_PATTERN_HINT_IPV6_UDP, - IAVF_PATTERN_HINT_IPV6_TCP, - IAVF_PATTERN_HINT_IPV6_SCTP, -}; - -enum iavf_gtpu_hint { - IAVF_GTPU_HINT_DOWNLINK, - IAVF_GTPU_HINT_UPLINK, - IAVF_GTPU_HINT_NONE, -}; + IAVF_PHINT_NONE = 0x, + IAVF_PHINT_IPV4 = 0x0001, + IAVF_PHINT_IPV4_UDP = 0x0002, + IAVF_PHINT_IPV4_TCP = 0x0004, + IAVF_PHINT_IPV4_SCTP= 0x0008, + IAVF_PHINT_IPV6 = 0x0010, + IAVF_PHINT_IPV6_UDP = 0x0020, + IAVF_PHINT_IPV6_TCP = 0x0040, + IAVF_PHINT_IPV6_SCTP= 0x0080, + IAVF_PHINT_C_VLAN = 0x0100, + IAVF_PHINT_S_VLAN = 0x0200, + IAVF_PHINT_IPV4_GTPU_IP = 0x0400, + IAVF_PHINT_IPV4_GTPU_EH = 0x0800, + IAVF_PHINT_IPV4_GTPU_EH_DWNLINK = 0x1000, + IAVF_PHINT_IPV4_GTPU_EH_UPLINK = 0x2000, +}; + +#define IAVF_GTPU_EH_DWNLINK 0 +#define IAVF_GTPU_EH_UPLINK1 struct iavf_pattern_match_type { - enum iavf_pattern_hint_type phint_type; + uint64_t pattern_hint; }; struct iavf_hash_match_type { - enum iavf_pattern_hint_type phint_type; uint64_t hash_type; struct virtchnl_proto_hdrs *proto_hdrs; - enum iavf_gtpu_hint gtpu_hint; + uint64_t pattern_hint; }; struct iavf_rss_meta { @@ -83,42 +85,56 @@ iavf_hash_parse_pattern_action(struct iavf_adapter *ad, void **meta, struct rte_flow_error *error); -struct iavf_pattern_match_type phint_empty = { - IAVF_PATTERN_HINT_NONE}; -struct iavf_pattern_match_type phint_eth_ipv4 = { - IAVF_PATTERN_HINT_IPV4}; -struct iavf_pattern_match_type phint_eth_ipv4_udp = { - IAVF_PATTERN_HINT_IPV4_UDP}; -struct iavf_pattern_match_type phint_eth_ipv4_tcp = { - IAVF_PATTERN_HINT_IPV4_TCP}; -struct iavf_pattern_match_type phint_eth_ipv4_sctp = { - IAVF_PATTERN_HINT_IPV4_SCTP}; -struct iavf_pattern_match_type phint_eth_ipv4_gtpu_eh = { - IAVF_PATTERN_HINT_IPV4_UDP}; -struct iavf_pattern_match_type phint_eth_ipv4_esp = { - IAVF_PATTERN_HINT_IPV4}; -struct iavf_pattern_match_type phint_eth_ipv4_ah = { - IAVF_PATTERN_HINT_IPV4}; -struct iavf_pattern_match_type phint_eth_ipv4_l2tpv3 = { - IAVF_PATTERN_HINT_IPV4}; -struct iavf_pattern_match_type phint_eth_ipv4_pfcp = { - IAVF_PATTERN_HINT_IPV4_UDP}; -struct iavf_pattern_match_type phint_eth_ipv6 = { - IAVF_PATTERN_HINT_IPV6}; -struct iavf_pattern_match_type phint_eth_ipv6_udp = { - IAVF_PATTERN_HINT_IPV6_UDP}; -struct iavf_pattern_match_type phint_eth_ipv6_tcp = { - IAVF_PATTERN_HINT_IPV6_TCP}; -struct iavf_pattern_match_type phint_eth_ipv6_sctp = { - IAVF_PATTERN_HINT_IPV6_SCTP}; -struct iavf_pattern_match_type phint_eth_ipv6_esp = { - IAVF_PATTERN_HINT_IPV6}; -struct iavf_pattern_match_type phint_eth_ipv6_ah = { - IAVF_PATTERN_HINT_IPV6}; -struct iavf_pattern_match_type phint_eth_ipv6_l2tpv3 = { - IAVF_PATTERN_HINT_IPV6}; -struct iavf_pattern_match_type phint_eth_ipv6_pfcp = { - IAVF_PATTERN_HINT_IPV6_UDP}; +static struct iavf_pattern_match_type phint_empty = { + IAVF_PHINT_NONE}; +static struct iavf_pattern_match_type phint_eth_ipv4 = { + IAVF_PHINT_IPV4}; +static struct iavf_pattern_match_type phint_eth_ipv4_udp = { + IAVF_PHINT_IPV4_UDP}; +static struct iavf_pattern_match_type phint_eth_ipv4_tcp = { + IAVF_PHINT_IPV4_TCP}; +static struct iavf_pattern_match_type phint_eth_ipv4_sctp = { + IAVF_PHINT_IPV4_SCTP}; +static struct iavf_pattern_match_type phint_eth_ipv4_gtpu_ipv4 = { + IAVF_PHINT_IPV4}; +static struct iavf_pattern_match_type phint_eth_ipv4_gtpu_eh_ipv4 = { + IAVF_PHINT_IPV4}; +static struct iavf_pattern_match_type phint_eth_ipv4_gtpu_eh_ipv4_udp = { + IA
[dpdk-dev] [dpdk-dev v3 2/2] net/ice: enable new input set for rss hash
PF could add or delete a RSS rule base on the PF's hash capability. Some new rss input set will be supported, the protocols as below: eth/vlan/l2tpv3/esp/ah/pfcp/gtpu. Signed-off-by: Jeff Guo --- v3->v2: refince code sturcture and fix simple xor issue fix some typos --- drivers/net/ice/ice_hash.c | 719 ++--- 1 file changed, 500 insertions(+), 219 deletions(-) diff --git a/drivers/net/ice/ice_hash.c b/drivers/net/ice/ice_hash.c index eaf6a35a1..d77c67f19 100644 --- a/drivers/net/ice/ice_hash.c +++ b/drivers/net/ice/ice_hash.c @@ -25,6 +25,9 @@ #include "ice_ethdev.h" #include "ice_generic_flow.h" +#define ICE_GTPU_EH_DWNLINK0 +#define ICE_GTPU_EH_UPLINK 1 + struct rss_type_match_hdr { uint32_t hdr_mask; uint64_t eth_rss_hint; @@ -76,91 +79,213 @@ ice_hash_parse_pattern_action(struct ice_adapter *ad, struct rte_flow_error *error); /* The first member is protocol header, the second member is ETH_RSS_*. */ -struct rss_type_match_hdr hint_0 = { +struct rss_type_match_hdr hint_empty = { ICE_FLOW_SEG_HDR_NONE, 0}; -struct rss_type_match_hdr hint_1 = { - ICE_FLOW_SEG_HDR_IPV4 | ICE_FLOW_SEG_HDR_IPV_OTHER, ETH_RSS_IPV4}; -struct rss_type_match_hdr hint_2 = { - ICE_FLOW_SEG_HDR_IPV4 | ICE_FLOW_SEG_HDR_UDP | - ICE_FLOW_SEG_HDR_IPV_OTHER, ETH_RSS_NONFRAG_IPV4_UDP}; -struct rss_type_match_hdr hint_3 = { - ICE_FLOW_SEG_HDR_IPV4 | ICE_FLOW_SEG_HDR_TCP | - ICE_FLOW_SEG_HDR_IPV_OTHER, ETH_RSS_NONFRAG_IPV4_TCP}; -struct rss_type_match_hdr hint_4 = { - ICE_FLOW_SEG_HDR_IPV4 | ICE_FLOW_SEG_HDR_SCTP | - ICE_FLOW_SEG_HDR_IPV_OTHER, ETH_RSS_NONFRAG_IPV4_SCTP}; -struct rss_type_match_hdr hint_5 = { - ICE_FLOW_SEG_HDR_IPV6 | ICE_FLOW_SEG_HDR_IPV_OTHER, ETH_RSS_IPV6}; -struct rss_type_match_hdr hint_6 = { - ICE_FLOW_SEG_HDR_IPV6 | ICE_FLOW_SEG_HDR_UDP | - ICE_FLOW_SEG_HDR_IPV_OTHER, ETH_RSS_NONFRAG_IPV6_UDP}; -struct rss_type_match_hdr hint_7 = { - ICE_FLOW_SEG_HDR_IPV6 | ICE_FLOW_SEG_HDR_TCP | - ICE_FLOW_SEG_HDR_IPV_OTHER, ETH_RSS_NONFRAG_IPV6_TCP}; -struct rss_type_match_hdr hint_8 = { - ICE_FLOW_SEG_HDR_IPV6 | ICE_FLOW_SEG_HDR_SCTP | - ICE_FLOW_SEG_HDR_IPV_OTHER, ETH_RSS_NONFRAG_IPV6_SCTP}; -struct rss_type_match_hdr hint_9 = { - ICE_FLOW_SEG_HDR_GTPU_EH, ETH_RSS_IPV4}; -struct rss_type_match_hdr hint_10 = { - ICE_FLOW_SEG_HDR_PPPOE, ETH_RSS_IPV4}; -struct rss_type_match_hdr hint_11 = { - ICE_FLOW_SEG_HDR_PPPOE, ETH_RSS_NONFRAG_IPV4_UDP}; -struct rss_type_match_hdr hint_12 = { - ICE_FLOW_SEG_HDR_PPPOE, ETH_RSS_NONFRAG_IPV4_TCP}; -struct rss_type_match_hdr hint_13 = { - ICE_FLOW_SEG_HDR_PPPOE, ETH_RSS_NONFRAG_IPV4_SCTP}; -struct rss_type_match_hdr hint_14 = { - ICE_FLOW_SEG_HDR_GTPU_EH, ETH_RSS_NONFRAG_IPV4_UDP}; -struct rss_type_match_hdr hint_15 = { - ICE_FLOW_SEG_HDR_GTPU_EH, ETH_RSS_NONFRAG_IPV4_TCP}; -struct rss_type_match_hdr hint_16 = { - ICE_FLOW_SEG_HDR_PPPOE, ETH_RSS_IPV6}; -struct rss_type_match_hdr hint_17 = { - ICE_FLOW_SEG_HDR_PPPOE, ETH_RSS_NONFRAG_IPV6_UDP}; -struct rss_type_match_hdr hint_18 = { - ICE_FLOW_SEG_HDR_PPPOE, ETH_RSS_NONFRAG_IPV6_TCP}; -struct rss_type_match_hdr hint_19 = { - ICE_FLOW_SEG_HDR_PPPOE, ETH_RSS_NONFRAG_IPV6_SCTP}; -struct rss_type_match_hdr hint_20 = { - ICE_FLOW_SEG_HDR_PPPOE, ETH_RSS_ETH | ETH_RSS_PPPOE}; +struct rss_type_match_hdr hint_eth_ipv4 = { + ICE_FLOW_SEG_HDR_IPV4 | ICE_FLOW_SEG_HDR_IPV_OTHER, + ETH_RSS_ETH | ETH_RSS_IPV4}; +struct rss_type_match_hdr hint_eth_ipv4_udp = { + ICE_FLOW_SEG_HDR_IPV4 | ICE_FLOW_SEG_HDR_IPV_OTHER | + ICE_FLOW_SEG_HDR_UDP, + ETH_RSS_ETH | ETH_RSS_NONFRAG_IPV4_UDP}; +struct rss_type_match_hdr hint_eth_ipv4_tcp = { + ICE_FLOW_SEG_HDR_IPV4 | ICE_FLOW_SEG_HDR_IPV_OTHER | + ICE_FLOW_SEG_HDR_TCP, + ETH_RSS_ETH | ETH_RSS_NONFRAG_IPV4_TCP}; +struct rss_type_match_hdr hint_eth_ipv4_sctp = { + ICE_FLOW_SEG_HDR_IPV4 | ICE_FLOW_SEG_HDR_IPV_OTHER | + ICE_FLOW_SEG_HDR_SCTP, + ETH_RSS_ETH | ETH_RSS_NONFRAG_IPV4_SCTP}; +struct rss_type_match_hdr hint_eth_ipv4_gtpu_ipv4 = { + ICE_FLOW_SEG_HDR_GTPU_IP | ICE_FLOW_SEG_HDR_IPV4 | + ICE_FLOW_SEG_HDR_IPV_OTHER, + ETH_RSS_GTPU | ETH_RSS_IPV4}; +struct rss_type_match_hdr hint_eth_ipv4_gtpu_eh_ipv4 = { + ICE_FLOW_SEG_HDR_GTPU_EH | ICE_FLOW_SEG_HDR_IPV4 | + ICE_FLOW_SEG_HDR_IPV_OTHER, + ETH_RSS_GTPU | ETH_RSS_IPV4}; +struct rss_type_match_hdr hint_eth_ipv4_gtpu_eh_ipv4_udp = { + ICE_FLOW_SEG_HDR_GTPU_EH | ICE_FLOW_SEG_HDR_IPV4 | + ICE_FLOW_SEG_HDR_IPV_OTHER | ICE_FLOW_SEG_HDR_UDP, + ETH_RSS_GTPU | ETH_RSS_NONFRAG_IPV4_UDP}; +struct rss_type_match_hdr hint_eth_ipv4_gtpu_eh_ipv4_tcp = { + ICE_FLOW_SEG_HDR_GTPU_EH | ICE_FLOW_SEG_HDR_IPV4 | + ICE_FLOW_SEG_HDR_IPV_OTHER | ICE_FLOW_SEG_HDR_TCP, + ETH_RSS_GTPU | ETH_RSS_NONFRAG_IPV4_TCP}; +struct
[dpdk-dev] [dpdk-dev v3 1/2] app/testpmd: add GTPU to RSS hash commands
Add testpmd cmdline support for GTPU, it could be used to configure gtpu teid hash. The commands as below: testpmd> flow create 0 ingress pattern eth / ipv4 / udp / gtpu / \ ipv4 / end actions rss types gtpu end key_len 0 queues end / end Signed-off-by: Jeff Guo --- v3->v2: add gtpu hash --- app/test-pmd/cmdline.c | 8 +--- app/test-pmd/config.c | 4 +++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c index 1ac0b89dd..81c87c8c3 100644 --- a/app/test-pmd/cmdline.c +++ b/app/test-pmd/cmdline.c @@ -2274,7 +2274,7 @@ cmd_config_rss_parsed(void *parsed_result, rss_conf.rss_hf = ETH_RSS_ETH | ETH_RSS_VLAN | ETH_RSS_IP | ETH_RSS_TCP | ETH_RSS_UDP | ETH_RSS_SCTP | ETH_RSS_L2_PAYLOAD | ETH_RSS_L2TPV3 | ETH_RSS_ESP | - ETH_RSS_AH | ETH_RSS_PFCP; + ETH_RSS_AH | ETH_RSS_PFCP | ETH_RSS_GTPU; else if (!strcmp(res->value, "eth")) rss_conf.rss_hf = ETH_RSS_ETH; else if (!strcmp(res->value, "vlan")) @@ -2319,6 +2319,8 @@ cmd_config_rss_parsed(void *parsed_result, rss_conf.rss_hf = ETH_RSS_PFCP; else if (!strcmp(res->value, "pppoe")) rss_conf.rss_hf = ETH_RSS_PPPOE; + else if (!strcmp(res->value, "gtpu")) + rss_conf.rss_hf = ETH_RSS_GTPU; else if (!strcmp(res->value, "none")) rss_conf.rss_hf = 0; else if (!strcmp(res->value, "default")) @@ -2492,7 +2494,7 @@ cmdline_parse_token_string_t cmd_config_rss_hash_key_rss_type = "ipv6-tcp-ex#ipv6-udp-ex#" "l3-src-only#l3-dst-only#l4-src-only#l4-dst-only#" "l2-src-only#l2-dst-only#s-vlan#c-vlan#" -"l2tpv3#esp#ah#pfcp#pppoe"); +"l2tpv3#esp#ah#pfcp#pppoe#gtpu"); cmdline_parse_token_string_t cmd_config_rss_hash_key_value = TOKEN_STRING_INITIALIZER(struct cmd_config_rss_hash_key, key, NULL); @@ -2505,7 +2507,7 @@ cmdline_parse_inst_t cmd_config_rss_hash_key = { "l2-payload|ipv6-ex|ipv6-tcp-ex|ipv6-udp-ex|" "l3-src-only|l3-dst-only|l4-src-only|l4-dst-only|" "l2-src-only|l2-dst-only|s-vlan|c-vlan|" - "l2tpv3|esp|ah|pfcp|pppoe " + "l2tpv3|esp|ah|pfcp|pppoe|gtpu " "", .tokens = { (void *)&cmd_config_rss_hash_key_port, diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index a0f8ea9f2..a79019f52 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -77,7 +77,8 @@ static const struct { const struct rss_type_info rss_type_table[] = { { "all", ETH_RSS_ETH | ETH_RSS_VLAN | ETH_RSS_IP | ETH_RSS_TCP | ETH_RSS_UDP | ETH_RSS_SCTP | ETH_RSS_L2_PAYLOAD | - ETH_RSS_L2TPV3 | ETH_RSS_ESP | ETH_RSS_AH | ETH_RSS_PFCP}, + ETH_RSS_L2TPV3 | ETH_RSS_ESP | ETH_RSS_AH | ETH_RSS_PFCP | + ETH_RSS_GTPU}, { "none", 0 }, { "eth", ETH_RSS_ETH }, { "l2-src-only", ETH_RSS_L2_SRC_ONLY }, @@ -119,6 +120,7 @@ const struct rss_type_info rss_type_table[] = { { "l2tpv3", ETH_RSS_L2TPV3 }, { "pfcp", ETH_RSS_PFCP }, { "pppoe", ETH_RSS_PPPOE }, + { "gtpu", ETH_RSS_GTPU }, { NULL, 0 }, }; -- 2.20.1
Re: [dpdk-dev] [PATCH 0/3] net/mlx5: optimize single counter allocate
Hi, > -Original Message- > From: Suanming Mou > Sent: Thursday, June 18, 2020 10:25 AM > To: Slava Ovsiienko ; Matan Azrad > > Cc: Raslan Darawsheh ; dev@dpdk.org > Subject: [PATCH 0/3] net/mlx5: optimize single counter allocate > > This patch set optimizes the DevX single counter allocate from two sides: > > 1. Add the multiple level table to have a quick look up while > allocate/search the single shared counter. > > 2. Optimize the pool look up for the new allocated single counter. > > Suanming Mou (3): > net/mlx5: add Three-Level table utility > net/mlx5: manage shared counters in Three-Level table > net/mlx5: optimize single counter pool search > > drivers/net/mlx5/mlx5.c | 16 +++ > drivers/net/mlx5/mlx5.h | 10 ++ > drivers/net/mlx5/mlx5_flow_dv.c | 115 +++-- > drivers/net/mlx5/mlx5_utils.c | 276 > > drivers/net/mlx5/mlx5_utils.h | 165 > 5 files changed, 545 insertions(+), 37 deletions(-) > > -- > 1.8.3.1 Series applied to next-net-mlx, Kindest regards, Raslan Darawsheh
Re: [dpdk-dev] [PATCH v2] net/mlx5: optimize free counter lookup
Hi, > -Original Message- > From: Suanming Mou > Sent: Thursday, June 18, 2020 11:13 AM > To: Matan Azrad ; Slava Ovsiienko > > Cc: dev@dpdk.org; Raslan Darawsheh > Subject: [PATCH v2] net/mlx5: optimize free counter lookup > > Currently, when allocate a new counter, it needs loop the whole > container pool list to get a free counter. > > In the case with millions of counters allocated, and all the pools > are empty, allocate the new counter will still need to loop the > whole container pool list first, then allocate a new pool to get a > free counter. It wastes the cycles during the pool list traversal. > > Add a global free counter list in the container helps to get the free > counters more efficiently. > > Signed-off-by: Suanming Mou > Acked-by: Matan Azrad > --- > > v2: update the commit title. > > This patch should be integrated after > https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpatch > es.dpdk.org%2Fcover%2F71716%2F&data=02%7C01%7Crasland%40mell > anox.com%7C6ee45fdcd79c4e70c9dd08d8135f67f0%7Ca652971c7d2e4d9ba6 > a4d149256f461b%7C0%7C0%7C637280647785241368&sdata=93W%2B7FJ > 8Z8zuoo2XsU%2B0YkHdVzTTo2xMXtrQx85N%2FCo%3D&reserved=0 > Patch applied to next-net-mlx, Kindest regards, Raslan Darawsheh
[dpdk-dev] [PATCH v1] bus/pci: fix VF bus error for memory access
To fix CVE-2020-12888, the linux vfio-pci module will invalidate mmaps and block MMIO access on disabled memory, it will send a SIGBUS to the application. In fact, vfio-pci will enable the memory command when openning the PCI device, but according to the PCIe specification, this enablement by real PCI write command doesn't have effect, it still has 0 value: Table 9-13 Command Register Changes Bit Location | PF and VF Register Differences | PF | VF | From Base | Attributes | Attributes -+++--- | Memory Space Enable - Does not || | apply to VFs. Must be hardwired| Base | 0b 1 | to 0b for VFs. VF Memory Space || | is controlled by the VF MSE bit|| | in the VF Control register.|| -+++--- So that when the vfio-pci initializes its own PCI configuration space data called 'vconfig' by reading the VF's real configuration space, it will have the memory command with 0b value, then, the vfio-pci finds the BAR memory is disabled by checking the its vconfig space, and the SIGBUS will be triggerred. So it needs to enable PCI bus memory command explicitly to avoid access on disabled memory, which will call vfio-pci ioctl to change the memory command in vconfig space to 1b. Fixes: 33604c31354a ("vfio: refactor PCI BAR mapping") Cc: sta...@dpdk.org Signed-off-by: Haiyue Wang --- Put the long link here, since the patch doesn't support to add so long line. https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=abafbc551fddede3e0a08dee1dcde08fc0eb8476 --- drivers/bus/pci/linux/pci_vfio.c | 37 1 file changed, 37 insertions(+) diff --git a/drivers/bus/pci/linux/pci_vfio.c b/drivers/bus/pci/linux/pci_vfio.c index 64cd84a68..9b6e45da5 100644 --- a/drivers/bus/pci/linux/pci_vfio.c +++ b/drivers/bus/pci/linux/pci_vfio.c @@ -149,6 +149,38 @@ pci_vfio_get_msix_bar(int fd, struct pci_msix_table *msix_table) return 0; } +/* enable PCI bus memory command */ +static int +pci_vfio_enable_bus_memory(int dev_fd) +{ + uint16_t cmd; + int ret; + + ret = pread64(dev_fd, &cmd, sizeof(cmd), + VFIO_GET_REGION_ADDR(VFIO_PCI_CONFIG_REGION_INDEX) + + PCI_COMMAND); + + if (ret != sizeof(cmd)) { + RTE_LOG(ERR, EAL, "Cannot read command from PCI config space!\n"); + return -1; + } + + if (cmd & PCI_COMMAND_MEMORY) + return 0; + + cmd |= PCI_COMMAND_MEMORY; + ret = pwrite64(dev_fd, &cmd, sizeof(cmd), + VFIO_GET_REGION_ADDR(VFIO_PCI_CONFIG_REGION_INDEX) + + PCI_COMMAND); + + if (ret != sizeof(cmd)) { + RTE_LOG(ERR, EAL, "Cannot write command to PCI config space!\n"); + return -1; + } + + return 0; +} + /* set PCI bus mastering */ static int pci_vfio_set_bus_master(int dev_fd, bool op) @@ -427,6 +459,11 @@ pci_rte_vfio_setup_device(struct rte_pci_device *dev, int vfio_dev_fd) return -1; } + if (pci_vfio_enable_bus_memory(vfio_dev_fd)) { + RTE_LOG(ERR, EAL, "Cannot enable bus memory command!\n"); + return -1; + } + /* set bus mastering for the device */ if (pci_vfio_set_bus_master(vfio_dev_fd, true)) { RTE_LOG(ERR, EAL, "Cannot set up bus mastering!\n"); -- 2.27.0
Re: [dpdk-dev] When .remove function (of struct rte_vdev_driver) is called
On Sun, 21 Jun 2020 18:17:09 +0500 Muhammad Bilal wrote: > While working on applications(l2fwd, testpmd) with PMD(memif, Tun|Tap > and some other) I have noticed that the .probe function of > rte_vdev_driver structure is called in rte_eal_init() and .remove > function of rte_vdev_driver structure is NEVER called, even after > exiting the application. > > My Question is How/When .remove function of rte_vdev_driver structure is > called. > > Thanks, > M. Bilal Does application call rte_eal_cleanup on exit?
Re: [dpdk-dev] When .remove function (of struct rte_vdev_driver) is called
Yes, I have used the rte_eal_cleanup() function when application exits. And still it does not call the .remove function of rte_vdev_driver structure, used in PMD. On Sun, Jun 21, 2020 at 11:11 PM Stephen Hemminger wrote: > > On Sun, 21 Jun 2020 18:17:09 +0500 > Muhammad Bilal wrote: > > > While working on applications(l2fwd, testpmd) with PMD(memif, Tun|Tap > > and some other) I have noticed that the .probe function of > > rte_vdev_driver structure is called in rte_eal_init() and .remove > > function of rte_vdev_driver structure is NEVER called, even after > > exiting the application. > > > > My Question is How/When .remove function of rte_vdev_driver structure is > > called. > > > > Thanks, > > M. Bilal > > Does application call rte_eal_cleanup on exit?
[dpdk-dev] [PATCH v2 1/6] eal: introduce macros for getting value for bit
There are several drivers which duplicate bit generation macro. Introduce a generic bit macros so that such drivers avoid redefining same in multiple drivers. Signed-off-by: Parav Pandit --- Changelog: v1->v2: - Addressed comments from Thomas and Gaten. - Avoided new file, added macro to rte_bitops.h --- lib/librte_eal/include/rte_bitops.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/librte_eal/include/rte_bitops.h b/lib/librte_eal/include/rte_bitops.h index 740927f3b..d72c7cd93 100644 --- a/lib/librte_eal/include/rte_bitops.h +++ b/lib/librte_eal/include/rte_bitops.h @@ -17,6 +17,8 @@ #include #include +#define RTE_BIT(bit_num) (1UL << (bit_num)) + /* 32-bit relaxed operations */ /** -- 2.25.4
[dpdk-dev] [PATCH v2 2/6] common/mlx5: change mlx5 class enum values as bits
mlx5 PCI Device supports multiple classes of devices such as net, vdpa, and/or regex. To support these multiple classes, change mlx5_class to a bitmap values so that if users asks to enable multiple of them, all supported classes can be parsed. Signed-off-by: Parav Pandit --- Changelog: v1->v2: - Rebasd due to removal previous patch --- drivers/common/mlx5/mlx5_common.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/common/mlx5/mlx5_common.h b/drivers/common/mlx5/mlx5_common.h index 77f10e676..6cc961e99 100644 --- a/drivers/common/mlx5/mlx5_common.h +++ b/drivers/common/mlx5/mlx5_common.h @@ -13,6 +13,7 @@ #include #include #include +#include #include "mlx5_prm.h" @@ -202,9 +203,9 @@ int mlx5_dev_to_pci_addr(const char *dev_path, struct rte_pci_addr *pci_addr); #define MLX5_CLASS_ARG_NAME "class" enum mlx5_class { - MLX5_CLASS_NET, - MLX5_CLASS_VDPA, MLX5_CLASS_INVALID, + MLX5_CLASS_NET = RTE_BIT(0), + MLX5_CLASS_VDPA = RTE_BIT(1), }; __rte_internal -- 2.25.4
[dpdk-dev] [PATCH v2 0/6] Improve mlx5 PMD common driver framework for multiple classes
This commit introduces mlx5 bus to support multiple class of devices for a single PCI device. Motivation and example -- mlx5 PCI device supports multiple class of devices such as net, vdpa and regex devices. Currently only one pmd (either net or vdpa) can bind to this device. This design limits use of PCI device only for single device class. To support multiple classes simultaneously for a mlx5 PCI device, a new mlx5 PCI bus is created. This bus allows binding multiple class drivers (such as net, vdpa, regex(future)) to bind to the mlx5 PCI bus driver. Change description -- Patch-1 prepares the code to have RTE_BIT() macro defined in a common header. Patch-2 Changes class value to a bit field Patch-3 Exposes mlx5_pci class driver registration APIs PAtch-4 Implements mlx5 PCI bus Patch-5 Migrates mlx5 net and vdpa driver to use mlx5 PCI bus API instead of rte PCI bus API Patch-6 Removed class check code as its already part of the bus now Design overview --- ---- | mlx5 || mlx5 || mlx5| | net pmd || vdpa pmd || regex pmd | ---- \ |/ \ | / \ - / \__| mlx5|_ / | pci bus | - | --- | mlx5 | | pci dev | --- - mlx5 pci bus driver binds to mlx5 PCI devices defined by PCI ID table of all related mlx5 PCI devices. - mlx5 class driver such as net, vdpa, regex PMD defines its specific PCI ID table and mlx5 bus driver probes matching class drivers. - mlx5 pci bus driver is cental place that validates supported class combinations. - In future as code evolves, more device setup/cleanup and resource creation code moves to mlx5 PCI bus driver. Alternatives considered --- 1. Instead of creating mlx5 pci bus, a common driver is implemented which exposes class registration API. However, bus model fits better with existing DPDK design similar to ifpga driver. Class registration API need to create a new callbacks and ID signature; instead it is better to utilize current well defined methods. 2. Enhance pci core to allow multiple driver binding to single rte PCI device. This approach is not taken, because peer drivers using one PCI device won't be aware of other's presence. This requires cross-driver syncronization of who initializes common resources (such as irq, eq and more). This also requires refcounting common objects etc among peer drivers. Instead of layered approach delivers and allows putting common resource sharing, setup code in common bus driver. It also eliminates peer blind zone problem as bottom pci bus layer provides necessary setup without any reference counting. 3. In future mlx5 prefers to use RDMA MR cache of the mbuf used between net and regex pmd so that same mbuf use across multiple device can be possible. Examples: A user who wish to use a specific class(es) provides list of classes at command line such as, ./testpmd -w ,class=net:vdpa ./testpmd -w ,class=vdpa In future, ./testpmd -w ,class=net:regex Changelog: v1->v2: - Addressed most comments from Thomas and Gaetan. - Symbols starting with prefix rte_bus_pci_mlx5 may be confusing as it may appear as it belong to rte_bus_pci module. Hence it is kept as rte_bus_mlx5_pci which matches with other modules as mlx5_vdpa, mlx5_net. - Dropped 2nd patch and replace with new 6th patch. - Avoided new file, added macro to rte_bitops.h - Inheriting ret_pci_driver instead of rte_driver - Added design and description of the mlx5_pci bus - Enhanced driver to honor RTE_PCI_DRV_PROBE_AGAIN drv_flag - Use anonymous structure for class search and code changes around it - Define static for class comination array - Use RTE_DIM to find array size - Added OOM check for strdup() - Renamed copy variable to nstr_orig - Returning negagive error code - Returning directly if match entry found - Use compat condition check - Avoided cutting error message string - USe uint32_t datatype instead of enum mlx5_class - Changed logic to parse device arguments only once during probe() - Added check to fail driver probe if multiple classes register with DMA ops - Renamed function to parse_class_options - Migreate API from rte_driver to rte_pci_driver Parav Pandit (6): eal: introduce macros for getting value for bit common/mlx5: change mlx5 class enum values as bits bus/mlx5_pci: add mlx5 PCI bus bus/mlx5_pci: register a PCI driver bus/mlx5_pci: enable net and vDPA to use mlx5 PCI bus driver common/mlx5: Remove class checks from individual driver config/common_base| 6 + config/defconfig_arm64-bluefield-linuxapp-gcc | 6 + drivers
[dpdk-dev] [PATCH v2 6/6] common/mlx5: Remove class checks from individual driver
Now that mlx5_pci bus does the check for enabled classes and performs probe(), remove() of associated classes, individual class driver doesn't need to check if other driver is enabled. Signed-off-by: Parav Pandit --- Changelog: v1->v2: - New patch --- drivers/common/mlx5/mlx5_common.c | 37 --- drivers/common/mlx5/mlx5_common.h | 2 - .../common/mlx5/rte_common_mlx5_version.map | 2 - drivers/net/mlx5/linux/mlx5_os.c | 5 --- drivers/vdpa/mlx5/mlx5_vdpa.c | 5 --- 5 files changed, 51 deletions(-) diff --git a/drivers/common/mlx5/mlx5_common.c b/drivers/common/mlx5/mlx5_common.c index db94d4aa8..ae7a0d6d6 100644 --- a/drivers/common/mlx5/mlx5_common.c +++ b/drivers/common/mlx5/mlx5_common.c @@ -19,43 +19,6 @@ const struct mlx5_glue *mlx5_glue; uint8_t haswell_broadwell_cpu; -static int -mlx5_class_check_handler(__rte_unused const char *key, const char *value, -void *opaque) -{ - enum mlx5_class *ret = opaque; - - if (strcmp(value, "vdpa") == 0) { - *ret = MLX5_CLASS_VDPA; - } else if (strcmp(value, "net") == 0) { - *ret = MLX5_CLASS_NET; - } else { - DRV_LOG(ERR, "Invalid mlx5 class %s. Maybe typo in device" - " class argument setting?", value); - *ret = MLX5_CLASS_INVALID; - } - return 0; -} - -enum mlx5_class -mlx5_class_get(struct rte_devargs *devargs) -{ - struct rte_kvargs *kvlist; - const char *key = MLX5_CLASS_ARG_NAME; - enum mlx5_class ret = MLX5_CLASS_NET; - - if (devargs == NULL) - return ret; - kvlist = rte_kvargs_parse(devargs->args, NULL); - if (kvlist == NULL) - return ret; - if (rte_kvargs_count(kvlist, key)) - rte_kvargs_process(kvlist, key, mlx5_class_check_handler, &ret); - rte_kvargs_free(kvlist); - return ret; -} - - /* In case this is an x86_64 intel processor to check if * we should use relaxed ordering. */ diff --git a/drivers/common/mlx5/mlx5_common.h b/drivers/common/mlx5/mlx5_common.h index 6cc961e99..fee988379 100644 --- a/drivers/common/mlx5/mlx5_common.h +++ b/drivers/common/mlx5/mlx5_common.h @@ -208,8 +208,6 @@ enum mlx5_class { MLX5_CLASS_VDPA = RTE_BIT(1), }; -__rte_internal -enum mlx5_class mlx5_class_get(struct rte_devargs *devargs); __rte_internal void mlx5_translate_port_name(const char *port_name_in, struct mlx5_switch_info *port_info_out); diff --git a/drivers/common/mlx5/rte_common_mlx5_version.map b/drivers/common/mlx5/rte_common_mlx5_version.map index 68f120712..236a7ef7b 100644 --- a/drivers/common/mlx5/rte_common_mlx5_version.map +++ b/drivers/common/mlx5/rte_common_mlx5_version.map @@ -1,8 +1,6 @@ INTERNAL { global: - mlx5_class_get; - mlx5_common_verbs_reg_mr; mlx5_common_verbs_dereg_mr; diff --git a/drivers/net/mlx5/linux/mlx5_os.c b/drivers/net/mlx5/linux/mlx5_os.c index 60f42c5d1..944c3bf66 100644 --- a/drivers/net/mlx5/linux/mlx5_os.c +++ b/drivers/net/mlx5/linux/mlx5_os.c @@ -1381,11 +1381,6 @@ mlx5_os_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, struct mlx5_dev_config dev_config; int ret; - if (mlx5_class_get(pci_dev->device.devargs) != MLX5_CLASS_NET) { - DRV_LOG(DEBUG, "Skip probing - should be probed by other mlx5" - " driver."); - return 1; - } if (rte_eal_process_type() == RTE_PROC_PRIMARY) mlx5_pmd_socket_init(); ret = mlx5_init_once(); diff --git a/drivers/vdpa/mlx5/mlx5_vdpa.c b/drivers/vdpa/mlx5/mlx5_vdpa.c index b223da7f2..30758f7b6 100644 --- a/drivers/vdpa/mlx5/mlx5_vdpa.c +++ b/drivers/vdpa/mlx5/mlx5_vdpa.c @@ -451,11 +451,6 @@ mlx5_vdpa_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, struct mlx5_hca_attr attr; int ret; - if (mlx5_class_get(pci_dev->device.devargs) != MLX5_CLASS_VDPA) { - DRV_LOG(DEBUG, "Skip probing - should be probed by other mlx5" - " driver."); - return 1; - } ibv = mlx5_vdpa_get_ib_device_match(&pci_dev->addr); if (!ibv) { DRV_LOG(ERR, "No matching IB device for PCI slot " -- 2.25.4
[dpdk-dev] [PATCH v2 4/6] bus/mlx5_pci: register a PCI driver
Create a mlx5 bus driver framework for invoking drivers of multiple classes who have registered with the mlx5_pci bus driver. Validate user class arguments for supported class combinations. Signed-off-by: Parav Pandit --- Changelog: v1->v2: - Address comments from Thomas and Gaetan - Enhanced driver to honor RTE_PCI_DRV_PROBE_AGAIN drv_flag - Use anonymous structure for class search and code changes around it - Define static for class comination array - Use RTE_DIM to find array size - Added OOM check for strdup() - Renamed copy variable to nstr_orig - Returning negagive error code - Returning directly if match entry found - Use compat condition check - Avoided cutting error message string - USe uint32_t datatype instead of enum mlx5_class - Changed logic to parse device arguments only once during probe() - Added check to fail driver probe if multiple classes register with DMA ops - Renamed function to parse_class_options --- drivers/bus/mlx5_pci/Makefile | 2 + drivers/bus/mlx5_pci/meson.build| 2 +- drivers/bus/mlx5_pci/mlx5_pci_bus.c | 290 drivers/bus/mlx5_pci/rte_bus_mlx5_pci.h | 1 + 4 files changed, 294 insertions(+), 1 deletion(-) diff --git a/drivers/bus/mlx5_pci/Makefile b/drivers/bus/mlx5_pci/Makefile index 7db977ba8..e53ed8856 100644 --- a/drivers/bus/mlx5_pci/Makefile +++ b/drivers/bus/mlx5_pci/Makefile @@ -13,7 +13,9 @@ CFLAGS += $(WERROR_FLAGS) CFLAGS += -I$(RTE_SDK)/drivers/common/mlx5 CFLAGS += -I$(BUILDDIR)/drivers/common/mlx5 CFLAGS += -I$(RTE_SDK)/drivers/bus/pci +CFLAGS += -D_DEFAULT_SOURCE LDLIBS += -lrte_eal +LDLIBS += -lrte_kvargs LDLIBS += -lrte_common_mlx5 LDLIBS += -lrte_pci -lrte_bus_pci diff --git a/drivers/bus/mlx5_pci/meson.build b/drivers/bus/mlx5_pci/meson.build index cc4a84e23..5111baa4e 100644 --- a/drivers/bus/mlx5_pci/meson.build +++ b/drivers/bus/mlx5_pci/meson.build @@ -1,6 +1,6 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2020 Mellanox Technologies Ltd -deps += ['pci', 'bus_pci', 'common_mlx5'] +deps += ['pci', 'bus_pci', 'common_mlx5', 'kvargs'] install_headers('rte_bus_mlx5_pci.h') sources = files('mlx5_pci_bus.c') diff --git a/drivers/bus/mlx5_pci/mlx5_pci_bus.c b/drivers/bus/mlx5_pci/mlx5_pci_bus.c index 66db3c7b0..e8f1649a3 100644 --- a/drivers/bus/mlx5_pci/mlx5_pci_bus.c +++ b/drivers/bus/mlx5_pci/mlx5_pci_bus.c @@ -3,12 +3,302 @@ */ #include "rte_bus_mlx5_pci.h" +#include static TAILQ_HEAD(mlx5_pci_bus_drv_head, rte_mlx5_pci_driver) drv_list = TAILQ_HEAD_INITIALIZER(drv_list); +static const struct { + const char *name; + unsigned int dev_class; +} mlx5_classes[] = { + { .name = "vdpa", .dev_class = MLX5_CLASS_VDPA }, + { .name = "net", .dev_class = MLX5_CLASS_NET }, +}; + +static const unsigned int mlx5_valid_class_combo[] = { + MLX5_CLASS_NET, + MLX5_CLASS_VDPA, + /* New class combination should be added here */ +}; + +static int class_name_to_val(const char *class_name) +{ + unsigned int i; + + for (i = 0; i < RTE_DIM(mlx5_classes); i++) { + if (strcmp(class_name, mlx5_classes[i].name) == 0) + return mlx5_classes[i].dev_class; + + } + return -EINVAL; +} + +static int +mlx5_bus_opt_handler(__rte_unused const char *key, const char *class_names, +void *opaque) +{ + int *ret = opaque; + char *nstr_org; + int class_val; + char *found; + char *nstr; + + *ret = 0; + nstr = strdup(class_names); + if (!nstr) { + *ret = -ENOMEM; + return *ret; + } + + nstr_org = nstr; + while (nstr) { + /* Extract each individual class name */ + found = strsep(&nstr, ":"); + if (!found) + continue; + + /* Check if its a valid class */ + class_val = class_name_to_val(found); + if (class_val < 0) { + *ret = -EINVAL; + goto err; + } + + *ret |= class_val; + } +err: + free(nstr_org); + if (*ret < 0) + DRV_LOG(ERR, "Invalid mlx5 class options %s. Maybe typo in device class argument setting?", + class_names); + return *ret; +} + +static int +parse_class_options(const struct rte_devargs *devargs) +{ + const char *key = MLX5_CLASS_ARG_NAME; + struct rte_kvargs *kvlist; + int ret = 0; + + if (devargs == NULL) + return 0; + kvlist = rte_kvargs_parse(devargs->args, NULL); + if (kvlist == NULL) + return 0; + if (rte_kvargs_count(kvlist, key)) + rte_kvargs_process(kvlist, key, mlx5_bus_opt_handler, &ret); + rte_kvargs_free(kvlist); + return ret; +} + void rte_mlx5_pci_driver_register(struct rte_mlx5_pci_driver
[dpdk-dev] [PATCH v2 5/6] bus/mlx5_pci: enable net and vDPA to use mlx5 PCI bus driver
Enable class driver to match with the mlx5 pci devices. Migrate mlx5 net PMD and vdpa PMD to start using mlx5 common class driver. Signed-off-by: Parav Pandit --- Changelog: v1->v2: - Migreate API from rte_driver to rte_pci_driver --- drivers/bus/Makefile| 3 ++ drivers/bus/mlx5_pci/mlx5_pci_bus.c | 60 + drivers/net/mlx5/Makefile | 3 +- drivers/net/mlx5/linux/mlx5_os.c| 1 - drivers/net/mlx5/linux/mlx5_os.h| 1 + drivers/net/mlx5/meson.build| 2 +- drivers/net/mlx5/mlx5.c | 24 +++- drivers/net/mlx5/mlx5.h | 1 - drivers/vdpa/mlx5/Makefile | 3 +- drivers/vdpa/mlx5/meson.build | 2 +- drivers/vdpa/mlx5/mlx5_vdpa.c | 23 ++- mk/rte.app.mk | 1 + 12 files changed, 98 insertions(+), 26 deletions(-) diff --git a/drivers/bus/Makefile b/drivers/bus/Makefile index cea3b55e6..3840ac51c 100644 --- a/drivers/bus/Makefile +++ b/drivers/bus/Makefile @@ -8,6 +8,9 @@ ifeq ($(CONFIG_RTE_EAL_VFIO),y) DIRS-$(CONFIG_RTE_LIBRTE_FSLMC_BUS) += fslmc endif DIRS-$(CONFIG_RTE_LIBRTE_IFPGA_BUS) += ifpga +ifeq ($(findstring y,$(CONFIG_RTE_LIBRTE_MLX5_PMD)$(CONFIG_RTE_LIBRTE_MLX5_VDPA_PMD)),y) +DIRS-y += mlx5_pci +endif DIRS-$(CONFIG_RTE_LIBRTE_PCI_BUS) += pci DIRS-$(CONFIG_RTE_LIBRTE_VDEV_BUS) += vdev DIRS-$(CONFIG_RTE_LIBRTE_VMBUS) += vmbus diff --git a/drivers/bus/mlx5_pci/mlx5_pci_bus.c b/drivers/bus/mlx5_pci/mlx5_pci_bus.c index e8f1649a3..6844c1961 100644 --- a/drivers/bus/mlx5_pci/mlx5_pci_bus.c +++ b/drivers/bus/mlx5_pci/mlx5_pci_bus.c @@ -282,6 +282,66 @@ mlx5_bus_pci_dma_unmap(struct rte_pci_device *dev, void *addr, } static const struct rte_pci_id mlx5_bus_pci_id_map[] = { + { + RTE_PCI_DEVICE(PCI_VENDOR_ID_MELLANOX, + PCI_DEVICE_ID_MELLANOX_CONNECTX4) + }, + { + RTE_PCI_DEVICE(PCI_VENDOR_ID_MELLANOX, + PCI_DEVICE_ID_MELLANOX_CONNECTX4VF) + }, + { + RTE_PCI_DEVICE(PCI_VENDOR_ID_MELLANOX, + PCI_DEVICE_ID_MELLANOX_CONNECTX4LX) + }, + { + RTE_PCI_DEVICE(PCI_VENDOR_ID_MELLANOX, + PCI_DEVICE_ID_MELLANOX_CONNECTX4LXVF) + }, + { + RTE_PCI_DEVICE(PCI_VENDOR_ID_MELLANOX, + PCI_DEVICE_ID_MELLANOX_CONNECTX5) + }, + { + RTE_PCI_DEVICE(PCI_VENDOR_ID_MELLANOX, + PCI_DEVICE_ID_MELLANOX_CONNECTX5VF) + }, + { + RTE_PCI_DEVICE(PCI_VENDOR_ID_MELLANOX, + PCI_DEVICE_ID_MELLANOX_CONNECTX5EX) + }, + { + RTE_PCI_DEVICE(PCI_VENDOR_ID_MELLANOX, + PCI_DEVICE_ID_MELLANOX_CONNECTX5EXVF) + }, + { + RTE_PCI_DEVICE(PCI_VENDOR_ID_MELLANOX, + PCI_DEVICE_ID_MELLANOX_CONNECTX5BF) + }, + { + RTE_PCI_DEVICE(PCI_VENDOR_ID_MELLANOX, + PCI_DEVICE_ID_MELLANOX_CONNECTX5BFVF) + }, + { + RTE_PCI_DEVICE(PCI_VENDOR_ID_MELLANOX, + PCI_DEVICE_ID_MELLANOX_CONNECTX6) + }, + { + RTE_PCI_DEVICE(PCI_VENDOR_ID_MELLANOX, + PCI_DEVICE_ID_MELLANOX_CONNECTX6VF) + }, + { + RTE_PCI_DEVICE(PCI_VENDOR_ID_MELLANOX, + PCI_DEVICE_ID_MELLANOX_CONNECTX6DX) + }, + { + RTE_PCI_DEVICE(PCI_VENDOR_ID_MELLANOX, + PCI_DEVICE_ID_MELLANOX_CONNECTX6DXVF) + }, + { + RTE_PCI_DEVICE(PCI_VENDOR_ID_MELLANOX, + PCI_DEVICE_ID_MELLANOX_CONNECTX6DXBF) + }, { .vendor_id = 0 } diff --git a/drivers/net/mlx5/Makefile b/drivers/net/mlx5/Makefile index a458402dc..1cea7cd07 100644 --- a/drivers/net/mlx5/Makefile +++ b/drivers/net/mlx5/Makefile @@ -45,16 +45,17 @@ CFLAGS += -I$(RTE_SDK)/drivers/common/mlx5/linux CFLAGS += -I$(RTE_SDK)/drivers/net/mlx5 CFLAGS += -I$(RTE_SDK)/drivers/net/mlx5/linux CFLAGS += -I$(BUILDDIR)/drivers/common/mlx5 +CFLAGS += -I$(RTE_SDK)/drivers/bus/mlx5_pci CFLAGS += -D_BSD_SOURCE CFLAGS += -D_DEFAULT_SOURCE CFLAGS += -D_XOPEN_SOURCE=600 CFLAGS += $(WERROR_FLAGS) CFLAGS += -Wno-strict-prototypes LDLIBS += -lrte_common_mlx5 +LDLIBS += -lrte_bus_mlx5_pci LDLIBS += -lm LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs -LDLIBS += -lrte_bus_pci # A few warnings cannot be avoided in external headers. CFLAGS += -Wno-error=cast-qual diff --git a/drivers/net/mlx5/linux/mlx5_os.c b/drivers/net/mlx5/linux/mlx5_os.c index 3792371c3..60f42c5d1 100644 --- a/drivers/net/mlx5/linux/mlx5_os.c +++ b/drivers/net/mlx5
[dpdk-dev] [PATCH v2 3/6] bus/mlx5_pci: add mlx5 PCI bus
Add mlx5 PCI bus which enables multiple mlx5 drivers to bind to single pci device. Signed-off-by: Parav Pandit --- Changelog: v1->v2: - Address comments from Thomas and Gaetan - Inheriting ret_pci_driver instead of rte_driver - Added design and description of the mlx5_pci bus --- config/common_base| 6 ++ config/defconfig_arm64-bluefield-linuxapp-gcc | 6 ++ drivers/bus/meson.build | 2 +- drivers/bus/mlx5_pci/Makefile | 47 +++ drivers/bus/mlx5_pci/meson.build | 6 ++ drivers/bus/mlx5_pci/mlx5_pci_bus.c | 14 drivers/bus/mlx5_pci/rte_bus_mlx5_pci.h | 84 +++ .../bus/mlx5_pci/rte_bus_mlx5_pci_version.map | 5 ++ 8 files changed, 169 insertions(+), 1 deletion(-) create mode 100644 drivers/bus/mlx5_pci/Makefile create mode 100644 drivers/bus/mlx5_pci/meson.build create mode 100644 drivers/bus/mlx5_pci/mlx5_pci_bus.c create mode 100644 drivers/bus/mlx5_pci/rte_bus_mlx5_pci.h create mode 100644 drivers/bus/mlx5_pci/rte_bus_mlx5_pci_version.map diff --git a/config/common_base b/config/common_base index c7d5c7321..f75b333f9 100644 --- a/config/common_base +++ b/config/common_base @@ -366,6 +366,12 @@ CONFIG_RTE_LIBRTE_IGC_DEBUG_TX=n CONFIG_RTE_LIBRTE_MLX4_PMD=n CONFIG_RTE_LIBRTE_MLX4_DEBUG=n +# +# Compile Mellanox PCI BUS for ConnectX-4, ConnectX-5, +# ConnectX-6 & BlueField (MLX5) PMD +# +CONFIG_RTE_LIBRTE_MLX5_PCI_BUS=n + # # Compile burst-oriented Mellanox ConnectX-4, ConnectX-5, # ConnectX-6 & BlueField (MLX5) PMD diff --git a/config/defconfig_arm64-bluefield-linuxapp-gcc b/config/defconfig_arm64-bluefield-linuxapp-gcc index b49653881..15ade7ebc 100644 --- a/config/defconfig_arm64-bluefield-linuxapp-gcc +++ b/config/defconfig_arm64-bluefield-linuxapp-gcc @@ -14,5 +14,11 @@ CONFIG_RTE_CACHE_LINE_SIZE=64 CONFIG_RTE_EAL_NUMA_AWARE_HUGEPAGES=n CONFIG_RTE_LIBRTE_VHOST_NUMA=n +# +# Compile Mellanox PCI BUS for ConnectX-4, ConnectX-5, +# ConnectX-6 & BlueField (MLX5) PMD +# +CONFIG_RTE_LIBRTE_MLX5_PCI_BUS=n + # PMD for ConnectX-5 CONFIG_RTE_LIBRTE_MLX5_PMD=y diff --git a/drivers/bus/meson.build b/drivers/bus/meson.build index 80de2d91d..b1381838d 100644 --- a/drivers/bus/meson.build +++ b/drivers/bus/meson.build @@ -1,7 +1,7 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2017 Intel Corporation -drivers = ['dpaa', 'fslmc', 'ifpga', 'pci', 'vdev', 'vmbus'] +drivers = ['dpaa', 'fslmc', 'ifpga', 'pci', 'mlx5_pci', 'vdev', 'vmbus'] std_deps = ['eal'] config_flag_fmt = 'RTE_LIBRTE_@0@_BUS' driver_name_fmt = 'rte_bus_@0@' diff --git a/drivers/bus/mlx5_pci/Makefile b/drivers/bus/mlx5_pci/Makefile new file mode 100644 index 0..7db977ba8 --- /dev/null +++ b/drivers/bus/mlx5_pci/Makefile @@ -0,0 +1,47 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright 2020 Mellanox Technologies, Ltd + +include $(RTE_SDK)/mk/rte.vars.mk + +# +# library name +# +LIB = librte_bus_mlx5_pci.a + +CFLAGS += -O3 +CFLAGS += $(WERROR_FLAGS) +CFLAGS += -I$(RTE_SDK)/drivers/common/mlx5 +CFLAGS += -I$(BUILDDIR)/drivers/common/mlx5 +CFLAGS += -I$(RTE_SDK)/drivers/bus/pci +LDLIBS += -lrte_eal +LDLIBS += -lrte_common_mlx5 +LDLIBS += -lrte_pci -lrte_bus_pci + +# versioning export map +EXPORT_MAP := rte_bus_mlx5_pci_version.map + +SRCS-y += mlx5_pci_bus.c + +# DEBUG which is usually provided on the command-line may enable +# CONFIG_RTE_LIBRTE_MLX5_DEBUG. +ifeq ($(DEBUG),1) +CONFIG_RTE_LIBRTE_MLX5_DEBUG := y +endif + +# User-defined CFLAGS. +ifeq ($(CONFIG_RTE_LIBRTE_MLX5_DEBUG),y) +CFLAGS += -pedantic +ifneq ($(CONFIG_RTE_TOOLCHAIN_ICC),y) +CFLAGS += -DPEDANTIC +endif +AUTO_CONFIG_CFLAGS += -Wno-pedantic +else +CFLAGS += -UPEDANTIC +endif + +# +# Export include files +# +SYMLINK-y-include += rte_bus_mlx5_pci.h + +include $(RTE_SDK)/mk/rte.lib.mk diff --git a/drivers/bus/mlx5_pci/meson.build b/drivers/bus/mlx5_pci/meson.build new file mode 100644 index 0..cc4a84e23 --- /dev/null +++ b/drivers/bus/mlx5_pci/meson.build @@ -0,0 +1,6 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright(c) 2020 Mellanox Technologies Ltd + +deps += ['pci', 'bus_pci', 'common_mlx5'] +install_headers('rte_bus_mlx5_pci.h') +sources = files('mlx5_pci_bus.c') diff --git a/drivers/bus/mlx5_pci/mlx5_pci_bus.c b/drivers/bus/mlx5_pci/mlx5_pci_bus.c new file mode 100644 index 0..66db3c7b0 --- /dev/null +++ b/drivers/bus/mlx5_pci/mlx5_pci_bus.c @@ -0,0 +1,14 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright 2020 Mellanox Technologies, Ltd + */ + +#include "rte_bus_mlx5_pci.h" + +static TAILQ_HEAD(mlx5_pci_bus_drv_head, rte_mlx5_pci_driver) drv_list = + TAILQ_HEAD_INITIALIZER(drv_list); + +void +rte_mlx5_pci_driver_register(struct rte_mlx5_pci_driver *driver) +{ + TAILQ_INSERT_TAIL(&drv_list, driver, next); +} diff --git a/drivers/bus/mlx5_pci/rte_bus_mlx5_pci.h b/drivers/bus/mlx5_pci/rte_bus_mlx5_pci.h new file mode 100644 index 0..571f7
[dpdk-dev] [RFC PATCH 1/2] pmdinfogen: prototype in Python
* No user-friendly error handling and no bounds checking yet. * No support for >65K sections case (is it needed?). * The order of definitions is reversed. Signed-off-by: Dmitry Kozlyuk --- buildtools/elf.py| 194 +++ buildtools/pmdinfogen.py | 144 + 2 files changed, 338 insertions(+) create mode 100644 buildtools/elf.py create mode 100755 buildtools/pmdinfogen.py diff --git a/buildtools/elf.py b/buildtools/elf.py new file mode 100644 index 0..4085d547b --- /dev/null +++ b/buildtools/elf.py @@ -0,0 +1,194 @@ +import ctypes + + +class ElfIdent(ctypes.Structure): +_pack_ = True +_fields_ = [ +("magic", ctypes.c_char * 4), +("class_", ctypes.c_uint8), +("data", ctypes.c_uint8), +("version", ctypes.c_uint8), +("os_abi", ctypes.c_uint8), +("abi_version", ctypes.c_uint8), +("pad", ctypes.c_uint8 * 7), +] + +@property +def is_magic_ok(self): +return self.magic.value == b"\x7fELF" + +@property +def is_32bit(self): +return self.class_ == 1 + +@property +def is_big_endian(self): +return self.data == 2 + +def define_structures(self): +base_type = ctypes.LittleEndianStructure +if self.is_big_endian: +base = ctypes.BigEndianStructure + +size_type = ctypes.c_uint64 +if self.is_32bit: +size_type = ctypes.c_uint32 + +class FileHeader(base_type): +_pack_ = True +_fields_ = [ +("e_ident", ElfIdent), +("e_type", ctypes.c_uint16), +("e_machine", ctypes.c_uint16), +("e_version", ctypes.c_uint32), +("e_entry", size_type), +("e_phoff", size_type), +("e_shoff", size_type), +("e_flags", ctypes.c_uint32), +("e_ehsize", ctypes.c_uint16), +("e_phentsize", ctypes.c_uint16), +("e_phnum", ctypes.c_uint16), +("e_shentsize", ctypes.c_uint16), +("e_shnum", ctypes.c_uint16), +("e_shstrndx", ctypes.c_uint16), +] + +class SectionHeader(base_type): +_pack_ = True +_fields_ = [ +("sh_name", ctypes.c_uint32), +("sh_type", ctypes.c_uint32), +("sh_flags", size_type), +("sh_addr", size_type), +("sh_offset", size_type), +("sh_size", size_type), +("sh_link", ctypes.c_uint32), +("sh_info", ctypes.c_uint32), +("sh_addralign", size_type), +("sh_entsize", size_type), +] + +class Symbol32(base_type): +_pack_ = True +_fields_ = [ +("st_name", ctypes.c_uint32), +("st_value", ctypes.c_uint32), +("st_size", ctypes.c_uint32), +("st_info", ctypes.c_uint8), +("st_other", ctypes.c_uint8), +("st_shndx", ctypes.c_uint16), +] + +class Symbol64(base_type): +_pack_ = True +_fields_ = [ +("st_name", ctypes.c_uint32), +("st_info", ctypes.c_uint8), +("st_other", ctypes.c_uint8), +("st_shndx", ctypes.c_uint16), +("st_value", ctypes.c_uint64), +("st_size", ctypes.c_uint64), +] + +Symbol = Symbol32 if self.is_32bit else Symbol64 + +return FileHeader, SectionHeader, Symbol + + +class Symbol: +def __init__(self, image, elf): +self._image = image +self._elf = elf + + +@property +def address(self): +base = self._image._sections[self._elf.st_shndx].sh_offset +offset = base + self._elf.st_value +memory = ctypes.c_char.from_buffer(self._image._data, offset) +return ctypes.addressof(memory) + + +class Image: +def __init__(self, data): +SHN_UNDEF = 0x +SHN_XINDEX = 0x + +ident = ElfIdent.from_buffer(data) +ElfFileHeader, ElfSectionHeader, ElfSymbol = ident.define_structures() + +header = ElfFileHeader.from_buffer(data) + +if header.e_shnum == SHN_UNDEF: +section = ElfSectionHeader.from_buffer(data, header.e_shoff) +sections_num = section.sh_size +else: +sections_num = header.e_shnum +sections_desc = ElfSectionHeader * sections_num +sections = sections_desc.from_buffer(data, header.e_shoff) + +if header.e_shstrndx == SHN_XINDEX: +strings_index = sections[0].sh_link +else: +strings_index = header.e_shstrndx + +symtab, strtab = Image._find_symbol_table(data, sections, ElfSymbol) + +self._data = data +self._header = header +self.
[dpdk-dev] [RFC PATCH 0/2] pmdinfogen: rewrite in Python
This is a PoC rewrite of pmdinfogen in Python with missing bits described below and in commits. Community input is desired. Pros: 1. Simpler build process without host apps. 2. Less build requirements (host libelf). 3. Easier debugging and maintenance with a high-level language. 4. Easier porting on Windows (only add new object format). Cons: 1. No standard ELF or COFF module for Python (amount of Python code without libelf on par with C code using it). 2. struct rte_pci_id must be synchronized with header file (it's a few lines that never change). There are no built-in or widely used Python libraries for ELF or COFF. Some ELF-parsing libraries exist on PyPI, but they're not very handy for the task and their installation would complicate build requirements. Thus, elf.py implements its own parsing. COFF support is underway, it's just not included in this RFC. Amount of code is similar to elf.py. Build is only tested on Linux x64_64. If the community deems this RFC worth finishing, there are a few opens: 1. Support for >65K section headers seems present in current pmdinfogen. However, the data it reads is not used after. Is it really needed? 2. How much error-handling is required? This is a build-time tool, and Python gives nice stacktraces. However, segfaults are possible in Python version due to pointer handling. IMO, error checking must be just sufficient to prevent silent segfaults. 3. On Unix, pmdinfogen is called for each object file extracted with ar from an .a library by a shell script. On Windows, other tools have to be used, shell script will not work. On the other hand, COFF library format is quite simple. Would it be appropriate for pmdinfogen to handle it to avoid intermediate script? --- Dmitry Kozlyuk (2): pmdinfogen: prototype in Python build: use Python pmdinfogen buildtools/elf.py| 194 +++ buildtools/meson.build | 3 +- buildtools/pmdinfogen.py | 144 + drivers/meson.build | 2 +- 4 files changed, 340 insertions(+), 3 deletions(-) create mode 100644 buildtools/elf.py create mode 100755 buildtools/pmdinfogen.py -- 2.25.4
[dpdk-dev] [RFC PATCH 2/2] build: use Python pmdinfogen
* C pmdinfogen not removed. * No Makefile support yet. Signed-off-by: Dmitry Kozlyuk --- buildtools/meson.build | 3 +-- drivers/meson.build| 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/buildtools/meson.build b/buildtools/meson.build index d5f8291be..1af835a9c 100644 --- a/buildtools/meson.build +++ b/buildtools/meson.build @@ -1,9 +1,8 @@ # SPDX-License-Identifier: BSD-3-Clause # Copyright(c) 2017-2019 Intel Corporation -subdir('pmdinfogen') - pkgconf = find_program('pkg-config', 'pkgconf', required: false) +pmdinfogen = find_program('pmdinfogen.py') pmdinfo = find_program('gen-pmdinfo-cfile.sh') list_dir_globs = find_program('list-dir-globs.py') check_symbols = find_program('check-symbols.sh') diff --git a/drivers/meson.build b/drivers/meson.build index cfb6a833c..be521398e 100644 --- a/drivers/meson.build +++ b/drivers/meson.build @@ -122,7 +122,7 @@ foreach class:dpdk_driver_classes command: [pmdinfo, tmp_lib.full_path(), '@OUTPUT@', pmdinfogen], output: out_filename, - depends: [pmdinfogen, tmp_lib]) + depends: [tmp_lib]) version_map = '@0@/@1@/@2@_version.map'.format( meson.current_source_dir(), -- 2.25.4
Re: [dpdk-dev] [PATCH 3/3] net/bnxt: add ARM64 vector support
> -Original Message- > From: Lance Richardson > Sent: Thursday, June 18, 2020 10:36 PM > To: dev@dpdk.org; Ajit Khaparde (ajit.khapa...@broadcom.com) > ; Ruifeng Wang > Subject: [PATCH 3/3] net/bnxt: add ARM64 vector support > > Add bnxt vector PMD support using NEON SIMD instructions. > > Signed-off-by: Lance Richardson > Reviewed-by: Ajit Kumar Khaparde > --- > v2: > - Use rte_vect.h instead of including arm_neon.h directly in > bnxt_rxtx_vec_neon.c. > > drivers/net/bnxt/Makefile | 3 + > drivers/net/bnxt/bnxt_ethdev.c | 10 +- > drivers/net/bnxt/bnxt_ring.c| 4 +- > drivers/net/bnxt/bnxt_rxq.h | 2 +- > drivers/net/bnxt/bnxt_rxr.c | 2 +- > drivers/net/bnxt/bnxt_rxr.h | 2 +- > drivers/net/bnxt/bnxt_rxtx_vec_common.h | 57 +++ > drivers/net/bnxt/bnxt_rxtx_vec_neon.c | 469 > > drivers/net/bnxt/bnxt_rxtx_vec_sse.c| 46 +-- > drivers/net/bnxt/bnxt_txr.h | 2 +- > drivers/net/bnxt/meson.build| 2 + > 11 files changed, 544 insertions(+), 55 deletions(-) create mode 100644 > drivers/net/bnxt/bnxt_rxtx_vec_common.h > create mode 100644 drivers/net/bnxt/bnxt_rxtx_vec_neon.c > Reviewed-by: Ruifeng Wang
Re: [dpdk-dev] [PATCH 00/21] update ixgbe base code
Reviewed-by: Wei Zhao > -Original Message- > From: dev On Behalf Of Guinan Sun > Sent: Friday, June 12, 2020 11:24 AM > To: dev@dpdk.org > Cc: Sun, GuinanX > Subject: [dpdk-dev] [PATCH 00/21] update ixgbe base code > > update ixgbe base code. > > Guinan Sun (21): > net/ixgbe/base: clear VFMBMEM and toggle VF's Tx queues > net/ixgbe/base: change in the condition for response HI > net/ixgbe/base: hange flow for "Apply Update" command > net/ixgbe/base: x550em 10G NIC driver issue > net/ixgbe/base: added API for NVM update > net/ixgbe/base: resolve infinite recursion on PCIe link down > net/ixgbe/base: added register definitions for NVM update > net/ixgbe/base: cleanup spelling mistakes in comments > net/ixgbe/base: remove whitespace in function comments > net/ixgbe/base: move increments after evaluations > net/ixgbe/base: modify loop accounting for retries > net/ixgbe/base: create dedicated func to restart auto nego > net/ixgbe/base: modify Klocwork hits for DDK 7.0 > net/ixgbe/base: add defines for min rollback revision fields > net/ixgbe/base: remove unnecessary log message FC autonego > net/ixgbe/base: initialize data field in struct buffer > net/ixgbe/base: improve log about autonego being disabled > net/ixgbe/base: ipv6 Mask for purpose FDIR VLAN Port Feature > net/ixgbe/base: remove default advertising for 2.5G and 5G > net/ixgbe/base: check Host Interface Return Status > net/ixgbe/base: update version > > drivers/net/ixgbe/base/README|2 +- > drivers/net/ixgbe/base/ixgbe_82598.c | 238 ++--- > drivers/net/ixgbe/base/ixgbe_82599.c | 397 > drivers/net/ixgbe/base/ixgbe_api.c | 892 - > drivers/net/ixgbe/base/ixgbe_api.h |1 + > drivers/net/ixgbe/base/ixgbe_common.c| 1102 -- > drivers/net/ixgbe/base/ixgbe_common.h|3 +- > drivers/net/ixgbe/base/ixgbe_dcb.c |6 +- > drivers/net/ixgbe/base/ixgbe_dcb_82598.c |2 +- > drivers/net/ixgbe/base/ixgbe_dcb_82599.c |2 +- > drivers/net/ixgbe/base/ixgbe_hv_vf.c | 20 +- > drivers/net/ixgbe/base/ixgbe_mbx.c | 285 +++--- > drivers/net/ixgbe/base/ixgbe_mbx.h |1 + > drivers/net/ixgbe/base/ixgbe_phy.c | 488 +- > drivers/net/ixgbe/base/ixgbe_phy.h |1 + > drivers/net/ixgbe/base/ixgbe_type.h | 67 ++ > drivers/net/ixgbe/base/ixgbe_vf.c| 166 ++-- > drivers/net/ixgbe/base/ixgbe_x540.c | 190 ++-- > drivers/net/ixgbe/base/ixgbe_x550.c | 505 +- > 19 files changed, 2282 insertions(+), 2086 deletions(-) > > -- > 2.17.1
[dpdk-dev] [PATCH v3 1/2] ethdev: fix data room size verification in Rx queue setup
In the rte_eth_rx_queue_setup API function, the local variable named mbp_buf_size, which is the data room size of the input parameter mp, is checked to guarantee that each memory chunck used for net device in the mbuf is bigger than the min_rx_bufsize. But if mbp_buf_size is less than RTE_PKTMBUF_HEADROOM, the value of the following statement will be a large number since the mbp_buf_size is a unsigned value. mbp_buf_size - RTE_PKTMBUF_HEADROOM As a result, it will cause a segment fault in this situation. This patch fixes it by modify the check condition to guarantee that the local varibale named mbp_buf_size is bigger than RTE_PKTMBUF_HEADROOM. Fixes: af75078fece3 ("first public release") Cc: sta...@dpdk.org Signed-off-by: Chengchang Tang Signed-off-by: Wei Hu (Xavier) Reviewed-by: Andrew Rybchenko --- v2 -> v3: No change. v1 -> v2: Simplify the check condition of mbp_buf_size according to Andrew Rybchenko's comment. --- lib/librte_ethdev/rte_ethdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c index 8e10a6f..b0b0474 100644 --- a/lib/librte_ethdev/rte_ethdev.c +++ b/lib/librte_ethdev/rte_ethdev.c @@ -1822,7 +1822,7 @@ rte_eth_rx_queue_setup(uint16_t port_id, uint16_t rx_queue_id, } mbp_buf_size = rte_pktmbuf_data_room_size(mp); - if ((mbp_buf_size - RTE_PKTMBUF_HEADROOM) < dev_info.min_rx_bufsize) { + if (mbp_buf_size < dev_info.min_rx_bufsize + RTE_PKTMBUF_HEADROOM) { RTE_ETHDEV_LOG(ERR, "%s mbuf_data_room_size %d < %d (RTE_PKTMBUF_HEADROOM=%d + min_rx_bufsize(dev)=%d)\n", mp->name, (int)mbp_buf_size, -- 2.7.4
[dpdk-dev] [PATCH v3 0/2] ethdev: minor bugfixes
This series are minor bugfixes for rte_ethdev.c. Wei Hu (Xavier) (2): ethdev: fix data room size verification in Rx queue setup ethdev: fix VLAN offloads set if no relative capabilities drivers/net/dpaa2/dpaa2_ethdev.c | 5 - drivers/net/enic/enic_ethdev.c | 12 drivers/net/fm10k/fm10k_ethdev.c | 23 ++- drivers/net/hinic/hinic_pmd_ethdev.c | 6 -- drivers/net/i40e/i40e_ethdev.c | 5 - drivers/net/nfp/nfp_net.c | 5 - drivers/net/octeontx/octeontx_ethdev_ops.c | 10 -- drivers/net/octeontx2/otx2_vlan.c | 5 - drivers/net/qede/qede_ethdev.c | 3 --- lib/librte_ethdev/rte_ethdev.c | 23 ++- 10 files changed, 24 insertions(+), 73 deletions(-) -- 2.7.4
[dpdk-dev] [PATCH v3 2/2] ethdev: fix VLAN offloads set if no relative capabilities
Currently, there is a potential problem that calling the API function rte_eth_dev_set_vlan_offload to start VLAN hardware offloads which the driver does not support. If the PMD driver does not support certain VLAN hardware offloads and does not check for it, the hardware setting will not change, but the VLAN offloads in dev->data->dev_conf.rxmode.offloads will be turned on. It is supposed to check the hardware capabilities to decide whether the relative callback needs to be called just like the behavior in the API function named rte_eth_dev_configure. And it is also needed to cleanup duplicated checks which are done in some PMDs. Also, note that it is behaviour change for some PMDs which simply ignore (with error/warning log message) unsupported VLAN offloads, but now it will fail. Fixes: a4996bd89c42 ("ethdev: new Rx/Tx offloads API") Cc: sta...@dpdk.org Signed-off-by: Chengchang Tang Signed-off-by: Wei Hu (Xavier) Acked-by: Andrew Rybchenko --- v2 -> v3: Add __rte_unused to avoid unused parameter 'dev' and 'mask' warning. v1 -> v2: cleanup duplicated checks which are done in some PMDs. --- drivers/net/dpaa2/dpaa2_ethdev.c | 5 - drivers/net/enic/enic_ethdev.c | 12 drivers/net/fm10k/fm10k_ethdev.c | 23 ++- drivers/net/hinic/hinic_pmd_ethdev.c | 6 -- drivers/net/i40e/i40e_ethdev.c | 5 - drivers/net/nfp/nfp_net.c | 5 - drivers/net/octeontx/octeontx_ethdev_ops.c | 10 -- drivers/net/octeontx2/otx2_vlan.c | 5 - drivers/net/qede/qede_ethdev.c | 3 --- lib/librte_ethdev/rte_ethdev.c | 21 + 10 files changed, 23 insertions(+), 72 deletions(-) diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c index 2f031ec..da5018f 100644 --- a/drivers/net/dpaa2/dpaa2_ethdev.c +++ b/drivers/net/dpaa2/dpaa2_ethdev.c @@ -169,11 +169,6 @@ dpaa2_vlan_offload_set(struct rte_eth_dev *dev, int mask) DPAA2_PMD_INFO("Unable to set vlan filter = %d", ret); } next_mask: - if (mask & ETH_VLAN_EXTEND_MASK) { - if (dev->data->dev_conf.rxmode.offloads & - DEV_RX_OFFLOAD_VLAN_EXTEND) - DPAA2_PMD_INFO("VLAN extend offload not supported"); - } return 0; } diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c index 32d5397..ef8900d 100644 --- a/drivers/net/enic/enic_ethdev.c +++ b/drivers/net/enic/enic_ethdev.c @@ -374,18 +374,6 @@ static int enicpmd_vlan_offload_set(struct rte_eth_dev *eth_dev, int mask) enic->ig_vlan_strip_en = 0; } - if ((mask & ETH_VLAN_FILTER_MASK) && - (offloads & DEV_RX_OFFLOAD_VLAN_FILTER)) { - dev_warning(enic, - "Configuration of VLAN filter is not supported\n"); - } - - if ((mask & ETH_VLAN_EXTEND_MASK) && - (offloads & DEV_RX_OFFLOAD_VLAN_EXTEND)) { - dev_warning(enic, - "Configuration of extended VLAN is not supported\n"); - } - return enic_set_vlan_strip(enic); } diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c index f537ab2..f5b854e 100644 --- a/drivers/net/fm10k/fm10k_ethdev.c +++ b/drivers/net/fm10k/fm10k_ethdev.c @@ -1575,28 +1575,9 @@ fm10k_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on) } static int -fm10k_vlan_offload_set(struct rte_eth_dev *dev, int mask) +fm10k_vlan_offload_set(struct rte_eth_dev *dev __rte_unused, + int mask __rte_unused) { - if (mask & ETH_VLAN_STRIP_MASK) { - if (!(dev->data->dev_conf.rxmode.offloads & - DEV_RX_OFFLOAD_VLAN_STRIP)) - PMD_INIT_LOG(ERR, "VLAN stripping is " - "always on in fm10k"); - } - - if (mask & ETH_VLAN_EXTEND_MASK) { - if (dev->data->dev_conf.rxmode.offloads & - DEV_RX_OFFLOAD_VLAN_EXTEND) - PMD_INIT_LOG(ERR, "VLAN QinQ is not " - "supported in fm10k"); - } - - if (mask & ETH_VLAN_FILTER_MASK) { - if (!(dev->data->dev_conf.rxmode.offloads & - DEV_RX_OFFLOAD_VLAN_FILTER)) - PMD_INIT_LOG(ERR, "VLAN filter is always on in fm10k"); - } - return 0; } diff --git a/drivers/net/hinic/hinic_pmd_ethdev.c b/drivers/net/hinic/hinic_pmd_ethdev.c index 0c3e1c0..0009a61 100644 --- a/drivers/net/hinic/hinic_pmd_ethdev.c +++ b/drivers/net/hinic/hinic_pmd_ethdev.c @@ -1701,12 +1701,6 @@ static int hinic_vlan_offload_set(struct rte_eth_dev *dev, int mask) nic_dev->proc_dev_name, dev->data->port_id); } - if (mask & ETH_VLAN_EXTEND_MASK) { -
Re: [dpdk-dev] [PATCH v2 2/2] ethdev: fix VLAN offloads set if no relative capabilities
Hi, Andrew Rybchenko On 2020/6/21 21:44, Andrew Rybchenko wrote: On 6/20/20 9:53 AM, Wei Hu (Xavier) wrote: Currently, there is a potential problem that calling the API function rte_eth_dev_set_vlan_offload to start VLAN hardware offloads which the driver does not support. If the PMD driver does not support certain VLAN hardware offloads and does not check for it, the hardware setting will not change, but the VLAN offloads in dev->data->dev_conf.rxmode.offloads will be turned on. It is supposed to check the hardware capabilities to decide whether the relative callback needs to be called just like the behavior in the API function named rte_eth_dev_configure. And it is also needed to cleanup duplicated checks which are done in some PMDs. Fixes: a4996bd89c42 ("ethdev: new Rx/Tx offloads API") Cc: sta...@dpdk.org Signed-off-by: Chengchang Tang Signed-off-by: Wei Hu (Xavier) For ethdev part: Acked-by: Andrew Rybchenko I'd like to highlight that it is behaviour change for some PMDs which simply ignore (with error/warning log message) unsupported VLAN offloads, but now it will fail. We should very carefully consider backporting of these changes. I'd say we should, since it is rather a bug fix. IMHO, it is better to send v3 using --to-cmd ./devtools/get-maintainer.sh in order to have all driver maintainers in To. OK, I will send V3. Thanks, Xavier --- v1 -> v2: cleanup duplicated checks which are done in som PMDs. --- drivers/net/dpaa2/dpaa2_ethdev.c | 5 - drivers/net/enic/enic_ethdev.c | 12 drivers/net/fm10k/fm10k_ethdev.c | 20 drivers/net/hinic/hinic_pmd_ethdev.c | 6 -- drivers/net/i40e/i40e_ethdev.c | 5 - drivers/net/nfp/nfp_net.c | 5 - drivers/net/octeontx/octeontx_ethdev_ops.c | 10 -- drivers/net/octeontx2/otx2_vlan.c | 5 - drivers/net/qede/qede_ethdev.c | 3 --- lib/librte_ethdev/rte_ethdev.c | 21 + 10 files changed, 21 insertions(+), 71 deletions(-) diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c index 2f031ec..da5018f 100644 --- a/drivers/net/dpaa2/dpaa2_ethdev.c +++ b/drivers/net/dpaa2/dpaa2_ethdev.c @@ -169,11 +169,6 @@ dpaa2_vlan_offload_set(struct rte_eth_dev *dev, int mask) DPAA2_PMD_INFO("Unable to set vlan filter = %d", ret); } next_mask: - if (mask & ETH_VLAN_EXTEND_MASK) { - if (dev->data->dev_conf.rxmode.offloads & - DEV_RX_OFFLOAD_VLAN_EXTEND) - DPAA2_PMD_INFO("VLAN extend offload not supported"); - } return 0; } diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c index 32d5397..ef8900d 100644 --- a/drivers/net/enic/enic_ethdev.c +++ b/drivers/net/enic/enic_ethdev.c @@ -374,18 +374,6 @@ static int enicpmd_vlan_offload_set(struct rte_eth_dev *eth_dev, int mask) enic->ig_vlan_strip_en = 0; } - if ((mask & ETH_VLAN_FILTER_MASK) && - (offloads & DEV_RX_OFFLOAD_VLAN_FILTER)) { - dev_warning(enic, - "Configuration of VLAN filter is not supported\n"); - } - - if ((mask & ETH_VLAN_EXTEND_MASK) && - (offloads & DEV_RX_OFFLOAD_VLAN_EXTEND)) { - dev_warning(enic, - "Configuration of extended VLAN is not supported\n"); - } - return enic_set_vlan_strip(enic); } diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c index f537ab2..47f6f76 100644 --- a/drivers/net/fm10k/fm10k_ethdev.c +++ b/drivers/net/fm10k/fm10k_ethdev.c @@ -1577,26 +1577,6 @@ fm10k_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on) static int fm10k_vlan_offload_set(struct rte_eth_dev *dev, int mask) { - if (mask & ETH_VLAN_STRIP_MASK) { - if (!(dev->data->dev_conf.rxmode.offloads & - DEV_RX_OFFLOAD_VLAN_STRIP)) - PMD_INIT_LOG(ERR, "VLAN stripping is " - "always on in fm10k"); - } - - if (mask & ETH_VLAN_EXTEND_MASK) { - if (dev->data->dev_conf.rxmode.offloads & - DEV_RX_OFFLOAD_VLAN_EXTEND) - PMD_INIT_LOG(ERR, "VLAN QinQ is not " - "supported in fm10k"); - } - - if (mask & ETH_VLAN_FILTER_MASK) { - if (!(dev->data->dev_conf.rxmode.offloads & - DEV_RX_OFFLOAD_VLAN_FILTER)) - PMD_INIT_LOG(ERR, "VLAN filter is always on in fm10k"); - } - return 0; } diff --git a/drivers/net/hinic/hinic_pmd_ethdev.c b/drivers/net/hinic/hinic_pmd_ethdev.c index 0c3e1c0..0009a61 100644 --- a/drivers/net/hinic/hinic_pmd_ethdev.c +++ b/drivers/net/hinic/hinic_pmd_ethdev.c @@
[dpdk-dev] [RFC] example/vhost: add support for vhost async data path
This patch makes vhost-vswitch be able to use vhost asynchronous api for enqueue operations. Demonstrated how the application leverage IOAT DMA channel with vhost async api. Since this is an early preview patch, the performance has not been fully optimized and it's not suggested to use this patch as a tool for benchmark. We introduce two parameters to enable DMA acceleration for Tx operations of queues: –async_vhost_driver Async vhost-user net driver which demonstrates how to use the async vhost APIs will be used when this option is given. It is disabled by default. -dmas This parameter is used to specify the assigned DMA device of a queue. This patch depends on following patch set: http://patches.dpdk.org/cover/71265/ Signed-off-by: Cheng Jiang --- examples/vhost/main.c | 246 +- examples/vhost/main.h | 1 + 2 files changed, 243 insertions(+), 4 deletions(-) diff --git a/examples/vhost/main.c b/examples/vhost/main.c index ab649bf14..46dd282e0 100644 --- a/examples/vhost/main.c +++ b/examples/vhost/main.c @@ -24,11 +24,15 @@ #include #include #include +#include +#include +#include +#include #include "main.h" #ifndef MAX_QUEUES -#define MAX_QUEUES 128 +#define MAX_QUEUES 512 #endif /* the maximum number of external ports supported */ @@ -58,6 +62,10 @@ /* Maximum long option length for option parsing. */ #define MAX_LONG_OPT_SZ 64 +#define IOAT_RING_SIZE 4096 + +#define MAX_ENQUEUED_SIZE 2048 + /* mask of enabled ports */ static uint32_t enabled_port_mask = 0; @@ -96,6 +104,20 @@ static int dequeue_zero_copy; static int builtin_net_driver; +static int async_vhost_driver; + +struct dma_info { + struct rte_pci_addr addr; + uint16_t dev_id; + bool is_valid; +}; + +struct dma_info_input { + struct dma_info dmas[RTE_MAX_QUEUES_PER_PORT * 2]; + uint16_t nr; +}; + +static struct dma_info_input dma_bind[20]; /* Specify timeout (in useconds) between retries on RX. */ static uint32_t burst_rx_delay_time = BURST_RX_WAIT_US; /* Specify the number of retries on RX. */ @@ -141,6 +163,61 @@ static struct rte_eth_conf vmdq_conf_default = { }, }; +static int +ioat_transfer_data_cb(int vid, uint16_t queue_id, struct dma_trans_desc *descs, + struct dma_trans_status *opaque_data, uint16_t count) +{ + int ret; + uint16_t i_desc; + + struct iov_it *src = NULL; + struct iov_it *dst = NULL; + unsigned long i_seg; + + int dev_id = dma_bind[vid].dmas[queue_id * 2 + VIRTIO_RXQ].dev_id; + if (likely(!opaque_data)) { + for (i_desc = 0; i_desc < count; i_desc++) { + src = descs[i_desc].src; + dst = descs[i_desc].dst; + i_seg = 0; + while (i_seg < src->nr_segs) { + ret = rte_ioat_enqueue_copy(dev_id, + (uintptr_t)(src->iov[i_seg].iov_base) + + src->offset, + (uintptr_t)(dst->iov[i_seg].iov_base) + + dst->offset, + src->iov[i_seg].iov_len, + 0, + 0, + 0); + if (ret != 1) + break; + i_seg++; + } + } + } else { + /* Opaque data is not supported */ + return -1; + } + /* ring the doolbell */ + rte_ioat_do_copies(dev_id); + return i_desc; +} + +static int +ioat_check_completed_copies_cb(int vid, uint16_t queue_id, + struct dma_trans_status *opaque_data, + uint16_t max_packets __rte_unused) +{ + if (!opaque_data) { + uintptr_t dump[255]; + return rte_ioat_completed_copies(dma_bind[vid].dmas[queue_id * 2 + + VIRTIO_RXQ].dev_id, 255, dump, dump); + } else { + /* Opaque data is not supported */ + return -1; + } +} static unsigned lcore_ids[RTE_MAX_LCORE]; static uint16_t ports[RTE_MAX_ETHPORTS]; @@ -186,6 +263,94 @@ struct mbuf_table lcore_tx_queue[RTE_MAX_LCORE]; * Builds up the correct configuration for VMDQ VLAN pool map * according to the pool & queue limits. */ + +static inline int +open_dma(const char *value, void *dma_bind_info) +{ + struct dma_info_input *dma_info = dma_bind_info; + char *input = strndup(value, strlen(value) + 1); + char *addrs = input; + char *ptrs[2]; + char *start, *end, *substr; + int64_t qid, vring_id; + struct rte_ioat_rawdev_config config; + struct rte_rawdev_info info = { .dev_private = &config }; + char name[32]; +
Re: [dpdk-dev] [PATCH v3 2/2] ethdev: fix VLAN offloads set if no relative capabilities
> -Original Message- > From: Wei Hu (Xavier) > Sent: Monday, June 22, 2020 11:47 AM > To: tho...@monjalon.net; ferruh.yi...@intel.com; > arybche...@solarflare.com; anatoly.bura...@intel.com; > hemant.agra...@nxp.com; sachin.sax...@nxp.com; John Daley (johndale) > ; Hyong Youb Kim (hyonkim) ; > qi.z.zh...@intel.com; xiao.w.w...@intel.com; xuanziya...@huawei.com; > cloud.wangxiao...@huawei.com; zhouguoy...@huawei.com; > beilei.x...@intel.com; jia@intel.com; heinrich.k...@netronome.com; > hka...@marvell.com; jer...@marvell.com; ndabilpu...@marvell.com; > kirankum...@marvell.com; rm...@marvell.com; shsha...@marvell.com > Cc: dev@dpdk.org; xavier.hu...@huawei.com > Subject: [PATCH v3 2/2] ethdev: fix VLAN offloads set if no relative > capabilities > > Currently, there is a potential problem that calling the API function > rte_eth_dev_set_vlan_offload to start VLAN hardware offloads which the > driver does not support. If the PMD driver does not support certain VLAN > hardware offloads and does not check for it, the hardware setting will > not change, but the VLAN offloads in dev->data->dev_conf.rxmode.offloads > will be turned on. > > It is supposed to check the hardware capabilities to decide whether the > relative callback needs to be called just like the behavior in the API > function named rte_eth_dev_configure. And it is also needed to cleanup > duplicated checks which are done in some PMDs. Also, note that it is > behaviour change for some PMDs which simply ignore (with error/warning > log > message) unsupported VLAN offloads, but now it will fail. > > Fixes: a4996bd89c42 ("ethdev: new Rx/Tx offloads API") > Cc: sta...@dpdk.org > > Signed-off-by: Chengchang Tang > Signed-off-by: Wei Hu (Xavier) > Acked-by: Andrew Rybchenko > --- > v2 -> v3: Add __rte_unused to avoid unused parameter 'dev' and 'mask' > warning. > v1 -> v2: cleanup duplicated checks which are done in some PMDs. > --- > drivers/net/dpaa2/dpaa2_ethdev.c | 5 - > drivers/net/enic/enic_ethdev.c | 12 > drivers/net/fm10k/fm10k_ethdev.c | 23 ++- > drivers/net/hinic/hinic_pmd_ethdev.c | 6 -- > drivers/net/i40e/i40e_ethdev.c | 5 - > drivers/net/nfp/nfp_net.c | 5 - > drivers/net/octeontx/octeontx_ethdev_ops.c | 10 -- > drivers/net/octeontx2/otx2_vlan.c | 5 - > drivers/net/qede/qede_ethdev.c | 3 --- > lib/librte_ethdev/rte_ethdev.c | 21 + > 10 files changed, 23 insertions(+), 72 deletions(-) > [...] > diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c > index 32d5397..ef8900d 100644 > --- a/drivers/net/enic/enic_ethdev.c > +++ b/drivers/net/enic/enic_ethdev.c > @@ -374,18 +374,6 @@ static int enicpmd_vlan_offload_set(struct > rte_eth_dev *eth_dev, int mask) > enic->ig_vlan_strip_en = 0; > } > > - if ((mask & ETH_VLAN_FILTER_MASK) && > - (offloads & DEV_RX_OFFLOAD_VLAN_FILTER)) { > - dev_warning(enic, > - "Configuration of VLAN filter is not supported\n"); > - } > - > - if ((mask & ETH_VLAN_EXTEND_MASK) && > - (offloads & DEV_RX_OFFLOAD_VLAN_EXTEND)) { > - dev_warning(enic, > - "Configuration of extended VLAN is not > supported\n"); > - } > - > return enic_set_vlan_strip(enic); > } > For enic, Acked-by: Hyong Youb Kim Thanks. -Hyong
Re: [dpdk-dev] [PATCH v2] app/testpmd: fix CPU cycles per pkt stats on transmit modes
> Subject: [PATCH v2] app/testpmd: fix CPU cycles per pkt stats on transmit > modes > > In txonly and flowgen forwarding mode, calculating CPU per packets with > total received packets is not accurate. Use total transmitted packets for > these cases. > > The error output under txonly mode: > testpmd> show fwd stats all > > -- Forward statistics for port 0 --- > RX-packets: 0 RX-dropped: 0 RX-total: 0 > TX-packets: 3582891927 TX-dropped: 401965824 TX-total: 3984857751 > TX-bursts : 86381636 [0% of 0 pkts + 85% of 64 pkts + 15% of 32 pkts] > - > > -- Forward statistics for port 1 --- > RX-packets: 1 RX-dropped: 394351696 RX-total: 394351697 > TX-packets: 3582890632 TX-dropped: 401965568 TX-total: 3984856200 > TX-bursts : 86381679 [0% of 0 pkts + 85% of 64 pkts + 15% of 32 pkts] > - > > +++ Accumulated forward statistics for all > +++ ports+ > RX-packets: 1 RX-dropped: 394351696 RX-total: 394351697 > TX-packets: 7165782559 TX-dropped: 803931392 TX-total: 7969713951 > +++ > ++ > > CPU cycles/packet=54984156291.00 \ > (total cycles=54984156291 / total RX packets=1) at 200 MHz Clock > > Signed-off-by: Phil Yang > Reviewed-by: Ruifeng Wang > Fixes: 53324971a14e ("app/testpmd: display/clear forwarding stats on > demand") > Cc: sta...@dpdk.org > Cc: david.march...@redhat.com > --- > v2: > Consolidate the output into a single printf. (Honnappa Nagarahalli) > > app/test-pmd/testpmd.c | 21 +++-- > 1 file changed, 15 insertions(+), 6 deletions(-) > > diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c index > 4989d22..826d7dd 100644 > --- a/app/test-pmd/testpmd.c > +++ b/app/test-pmd/testpmd.c > @@ -1961,13 +1961,22 @@ fwd_stats_display(void) > acc_stats_border, acc_stats_border); #ifdef > RTE_TEST_PMD_RECORD_CORE_CYCLES #define CYC_PER_MHZ 1E6 > - if (total_recv > 0) > + if (total_recv > 0 || total_xmit > 0) { > + uint8_t ingress; > + if (strcmp(cur_fwd_eng->fwd_mode_name, "txonly") == 0 || > + strcmp(cur_fwd_eng->fwd_mode_name, "flowgen") == 0) > + ingress = 0; This can be 'total_pkts = total_recv' > + else > + ingress = 1; This can be 'total_pkts = total_xmit' > + > printf("\n CPU cycles/packet=%.2F (total cycles=" > -"%"PRIu64" / total RX packets=%"PRIu64") at %"PRIu64 > -" MHz Clock\n", > -(double) fwd_cycles / total_recv, > -fwd_cycles, total_recv, > -(uint64_t)(rte_get_tsc_hz() / CYC_PER_MHZ)); > + "%"PRIu64" / total %s packets=%"PRIu64") at %" > + PRIu64" MHz Clock\n", ((double) fwd_cycles / > + (ingress ? total_recv : total_xmit)), Can be just 'total_pkts'. > + fwd_cycles, cur_fwd_eng->fwd_mode_name, > + (ingress ? total_recv : total_xmit), Can be just 'total_pkts'. > + (uint64_t)(rte_get_tsc_hz() / CYC_PER_MHZ)); > + } > #endif > } Otherwise, Reviewed-by: Honnappa Nagarahalli > > -- > 2.7.4
Re: [dpdk-dev] [PATCH 00/21] update ixgbe base code
> -Original Message- > From: dev On Behalf Of Zhao1, Wei > Sent: Monday, June 22, 2020 10:42 AM > To: Sun, GuinanX ; dev@dpdk.org > Cc: Sun, GuinanX > Subject: Re: [dpdk-dev] [PATCH 00/21] update ixgbe base code > > Reviewed-by: Wei Zhao > > > > -Original Message- > > From: dev On Behalf Of Guinan Sun > > Sent: Friday, June 12, 2020 11:24 AM > > To: dev@dpdk.org > > Cc: Sun, GuinanX > > Subject: [dpdk-dev] [PATCH 00/21] update ixgbe base code > > > > update ixgbe base code. > > > > Guinan Sun (21): > > net/ixgbe/base: clear VFMBMEM and toggle VF's Tx queues > > net/ixgbe/base: change in the condition for response HI > > net/ixgbe/base: hange flow for "Apply Update" command > > net/ixgbe/base: x550em 10G NIC driver issue > > net/ixgbe/base: added API for NVM update > > net/ixgbe/base: resolve infinite recursion on PCIe link down > > net/ixgbe/base: added register definitions for NVM update > > net/ixgbe/base: cleanup spelling mistakes in comments > > net/ixgbe/base: remove whitespace in function comments > > net/ixgbe/base: move increments after evaluations > > net/ixgbe/base: modify loop accounting for retries > > net/ixgbe/base: create dedicated func to restart auto nego > > net/ixgbe/base: modify Klocwork hits for DDK 7.0 > > net/ixgbe/base: add defines for min rollback revision fields > > net/ixgbe/base: remove unnecessary log message FC autonego > > net/ixgbe/base: initialize data field in struct buffer > > net/ixgbe/base: improve log about autonego being disabled > > net/ixgbe/base: ipv6 Mask for purpose FDIR VLAN Port Feature > > net/ixgbe/base: remove default advertising for 2.5G and 5G > > net/ixgbe/base: check Host Interface Return Status > > net/ixgbe/base: update version > > > > drivers/net/ixgbe/base/README|2 +- > > drivers/net/ixgbe/base/ixgbe_82598.c | 238 ++--- > > drivers/net/ixgbe/base/ixgbe_82599.c | 397 > > drivers/net/ixgbe/base/ixgbe_api.c | 892 - > > drivers/net/ixgbe/base/ixgbe_api.h |1 + > > drivers/net/ixgbe/base/ixgbe_common.c| 1102 -- > > drivers/net/ixgbe/base/ixgbe_common.h|3 +- > > drivers/net/ixgbe/base/ixgbe_dcb.c |6 +- > > drivers/net/ixgbe/base/ixgbe_dcb_82598.c |2 +- > > drivers/net/ixgbe/base/ixgbe_dcb_82599.c |2 +- > > drivers/net/ixgbe/base/ixgbe_hv_vf.c | 20 +- > > drivers/net/ixgbe/base/ixgbe_mbx.c | 285 +++--- > > drivers/net/ixgbe/base/ixgbe_mbx.h |1 + > > drivers/net/ixgbe/base/ixgbe_phy.c | 488 +- > > drivers/net/ixgbe/base/ixgbe_phy.h |1 + > > drivers/net/ixgbe/base/ixgbe_type.h | 67 ++ > > drivers/net/ixgbe/base/ixgbe_vf.c| 166 ++-- > > drivers/net/ixgbe/base/ixgbe_x540.c | 190 ++-- > > drivers/net/ixgbe/base/ixgbe_x550.c | 505 +- > > 19 files changed, 2282 insertions(+), 2086 deletions(-) > > > > -- > > 2.17.1 Applied to dpdk-next-net-intel after remove some unnecessary commit log in patch 6, 12, 19, 20 Thanks Qi
[dpdk-dev] L3fwd performance setup
Hi, I am new to this. I want to do the performance setup of 10Gig card. I want to use L3fwd app and pktgen . Could anyone help me with this? I have two setup machine each have one 10gig dpdk cards and centos 7. Thanks
Re: [dpdk-dev] [PATCH v4 12/12] doc: enable DCF datapath configuration
> -Original Message- > From: Xu, Ting > Sent: Friday, June 19, 2020 4:51 PM > To: dev@dpdk.org > Cc: Zhang, Qi Z ; Yang, Qiming > ; Wu, Jingjing ; Xing, Beilei > ; Kovacevic, Marko ; > Mcnamara, John ; Xu, Ting > Subject: [PATCH v4 12/12] doc: enable DCF datapath configuration > > Add doc for DCF datapath configuration in DPDK 20.08 release note. > > Signed-off-by: Ting Xu > --- > doc/guides/rel_notes/release_20_08.rst | 6 ++ > 1 file changed, 6 insertions(+) > > diff --git a/doc/guides/rel_notes/release_20_08.rst > b/doc/guides/rel_notes/release_20_08.rst > index dee4ccbb5..1a3a4cdb2 100644 > --- a/doc/guides/rel_notes/release_20_08.rst > +++ b/doc/guides/rel_notes/release_20_08.rst > @@ -56,6 +56,12 @@ New Features > Also, make sure to start the actual text at the margin. > = > > +* **Updated the Intel ice driver.** > + > + Updated the Intel ice driver with new features and improvements, > including: > + > + * Added support for DCF datapath configuration. > + > * **Updated Mellanox mlx5 driver.** > >Updated Mellanox mlx5 driver with new features and improvements, > including: > -- > 2.17.1 We might also need to add doc/nic/features/ice_dcf.ini as a new type of ethdev has been added.
Re: [dpdk-dev] [PATCH v3 2/2] ethdev: fix VLAN offloads set if no relative capabilities
On 22-Jun-20 8:17 AM, Wei Hu (Xavier) wrote: Currently, there is a potential problem that calling the API function rte_eth_dev_set_vlan_offload to start VLAN hardware offloads which the driver does not support. If the PMD driver does not support certain VLAN hardware offloads and does not check for it, the hardware setting will not change, but the VLAN offloads in dev->data->dev_conf.rxmode.offloads will be turned on. It is supposed to check the hardware capabilities to decide whether the relative callback needs to be called just like the behavior in the API function named rte_eth_dev_configure. And it is also needed to cleanup duplicated checks which are done in some PMDs. Also, note that it is behaviour change for some PMDs which simply ignore (with error/warning log message) unsupported VLAN offloads, but now it will fail. Fixes: a4996bd89c42 ("ethdev: new Rx/Tx offloads API") Cc: sta...@dpdk.org Signed-off-by: Chengchang Tang Signed-off-by: Wei Hu (Xavier) Acked-by: Andrew Rybchenko --- v2 -> v3: Add __rte_unused to avoid unused parameter 'dev' and 'mask' warning. v1 -> v2: cleanup duplicated checks which are done in some PMDs. --- drivers/net/dpaa2/dpaa2_ethdev.c | 5 - drivers/net/enic/enic_ethdev.c | 12 drivers/net/fm10k/fm10k_ethdev.c | 23 ++- drivers/net/hinic/hinic_pmd_ethdev.c | 6 -- drivers/net/i40e/i40e_ethdev.c | 5 - drivers/net/nfp/nfp_net.c | 5 - drivers/net/octeontx/octeontx_ethdev_ops.c | 10 -- drivers/net/octeontx2/otx2_vlan.c | 5 - drivers/net/qede/qede_ethdev.c | 3 --- lib/librte_ethdev/rte_ethdev.c | 21 + 10 files changed, 23 insertions(+), 72 deletions(-) diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c index 2f031ec..da5018f 100644 --- a/drivers/net/dpaa2/dpaa2_ethdev.c +++ b/drivers/net/dpaa2/dpaa2_ethdev.c @@ -169,11 +169,6 @@ dpaa2_vlan_offload_set(struct rte_eth_dev *dev, int mask) DPAA2_PMD_INFO("Unable to set vlan filter = %d", ret); } next_mask: The changes looks good but the label "next_mask" and its usage above should also be deleted/replaced. - if (mask & ETH_VLAN_EXTEND_MASK) { - if (dev->data->dev_conf.rxmode.offloads & - DEV_RX_OFFLOAD_VLAN_EXTEND) - DPAA2_PMD_INFO("VLAN extend offload not supported"); - } return 0; } diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c index 32d5397..ef8900d 100644 --- a/drivers/net/enic/enic_ethdev.c +++ b/drivers/net/enic/enic_ethdev.c @@ -374,18 +374,6 @@ static int enicpmd_vlan_offload_set(struct rte_eth_dev *eth_dev, int mask) enic->ig_vlan_strip_en = 0; } - if ((mask & ETH_VLAN_FILTER_MASK) && - (offloads & DEV_RX_OFFLOAD_VLAN_FILTER)) { - dev_warning(enic, - "Configuration of VLAN filter is not supported\n"); - } - - if ((mask & ETH_VLAN_EXTEND_MASK) && - (offloads & DEV_RX_OFFLOAD_VLAN_EXTEND)) { - dev_warning(enic, - "Configuration of extended VLAN is not supported\n"); - } - return enic_set_vlan_strip(enic); } diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c index f537ab2..f5b854e 100644 --- a/drivers/net/fm10k/fm10k_ethdev.c +++ b/drivers/net/fm10k/fm10k_ethdev.c @@ -1575,28 +1575,9 @@ fm10k_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on) } static int -fm10k_vlan_offload_set(struct rte_eth_dev *dev, int mask) +fm10k_vlan_offload_set(struct rte_eth_dev *dev __rte_unused, + int mask __rte_unused) { - if (mask & ETH_VLAN_STRIP_MASK) { - if (!(dev->data->dev_conf.rxmode.offloads & - DEV_RX_OFFLOAD_VLAN_STRIP)) - PMD_INIT_LOG(ERR, "VLAN stripping is " - "always on in fm10k"); - } - - if (mask & ETH_VLAN_EXTEND_MASK) { - if (dev->data->dev_conf.rxmode.offloads & - DEV_RX_OFFLOAD_VLAN_EXTEND) - PMD_INIT_LOG(ERR, "VLAN QinQ is not " - "supported in fm10k"); - } - - if (mask & ETH_VLAN_FILTER_MASK) { - if (!(dev->data->dev_conf.rxmode.offloads & - DEV_RX_OFFLOAD_VLAN_FILTER)) - PMD_INIT_LOG(ERR, "VLAN filter is always on in fm10k"); - } - return 0; } diff --git a/drivers/net/hinic/hinic_pmd_ethdev.c b/drivers/net/hinic/hinic_pmd_ethdev.c index 0c3e1c0..0009a61 100644 --- a/drivers/net/hinic/hinic_pmd_ethdev.c +++ b/drivers/net/hinic/hinic_pmd_ethdev.c @@ -1701,12 +1701,6 @@ static int hinic_vlan_offload
Re: [dpdk-dev] [PATCH v4 1/3] lib/lpm: integrate RCU QSBR
Hi Vladimir, > -Original Message- > From: Medvedkin, Vladimir > Sent: Friday, June 19, 2020 1:22 AM > To: Ruifeng Wang ; Bruce Richardson > ; John McNamara > ; Marko Kovacevic > ; Ray Kinsella ; Neil Horman > > Cc: dev@dpdk.org; konstantin.anan...@intel.com; Honnappa Nagarahalli > ; nd > Subject: Re: [PATCH v4 1/3] lib/lpm: integrate RCU QSBR > > Hi Ruifeng, > > Thanks for patches, see comments below Thanks for your review. > > > On 08/06/2020 06:16, Ruifeng Wang wrote: > > Currently, the tbl8 group is freed even though the readers might be > > using the tbl8 group entries. The freed tbl8 group can be reallocated > > quickly. This results in incorrect lookup results. > > > > RCU QSBR process is integrated for safe tbl8 group reclaim. > > Refer to RCU documentation to understand various aspects of > > integrating RCU library into other libraries. > > > > Signed-off-by: Ruifeng Wang > > Reviewed-by: Honnappa Nagarahalli > > --- > > doc/guides/prog_guide/lpm_lib.rst | 32 > > lib/librte_lpm/Makefile| 2 +- > > lib/librte_lpm/meson.build | 1 + > > lib/librte_lpm/rte_lpm.c | 123 ++--- > > lib/librte_lpm/rte_lpm.h | 59 ++ > > lib/librte_lpm/rte_lpm_version.map | 6 ++ > > 6 files changed, 211 insertions(+), 12 deletions(-) > > > > diff --git a/doc/guides/prog_guide/lpm_lib.rst > > b/doc/guides/prog_guide/lpm_lib.rst > > index 1609a57d0..7cc99044a 100644 > > --- a/doc/guides/prog_guide/lpm_lib.rst > > +++ b/doc/guides/prog_guide/lpm_lib.rst > > @@ -145,6 +145,38 @@ depending on whether we need to move to the > next table or not. > > Prefix expansion is one of the keys of this algorithm, > > since it improves the speed dramatically by adding redundancy. > > > > +Deletion > > + > > + > > +When deleting a rule, a replacement rule is searched for. Replacement > > +rule is an existing rule that has the longest prefix match with the rule > > to be > deleted, but has smaller depth. > > + > > +If a replacement rule is found, target tbl24 and tbl8 entries are > > +updated to have the same depth and next hop value with the > replacement rule. > > + > > +If no replacement rule can be found, target tbl24 and tbl8 entries will be > cleared. > > + > > +Prefix expansion is performed if the rule's depth is not exactly 24 bits or > 32 bits. > > + > > +After deleting a rule, a group of tbl8s that belongs to the same tbl24 > > entry > are freed in following cases: > > + > > +* All tbl8s in the group are empty . > > + > > +* All tbl8s in the group have the same values and with depth no greater > than 24. > > + > > +Free of tbl8s have different behaviors: > > + > > +* If RCU is not used, tbl8s are cleared and reclaimed immediately. > > + > > +* If RCU is used, tbl8s are reclaimed when readers are in quiescent > > state. > > + > > +When the LPM is not using RCU, tbl8 group can be freed immediately > > +even though the readers might be using the tbl8 group entries. This might > result in incorrect lookup results. > > + > > +RCU QSBR process is integrated for safe tbl8 group reclaimation. > > +Application has certain responsibilities while using this feature. > > +Please refer to resource reclaimation framework of :ref:`RCU library > ` for more details. > > + > > Lookup > > ~~ > > > > diff --git a/lib/librte_lpm/Makefile b/lib/librte_lpm/Makefile index > > d682785b6..6f06c5c03 100644 > > --- a/lib/librte_lpm/Makefile > > +++ b/lib/librte_lpm/Makefile > > @@ -8,7 +8,7 @@ LIB = librte_lpm.a > > > > CFLAGS += -O3 > > CFLAGS += $(WERROR_FLAGS) -I$(SRCDIR) -LDLIBS += -lrte_eal > > -lrte_hash > > +LDLIBS += -lrte_eal -lrte_hash -lrte_rcu > > > > EXPORT_MAP := rte_lpm_version.map > > > > diff --git a/lib/librte_lpm/meson.build b/lib/librte_lpm/meson.build > > index 021ac6d8d..6cfc083c5 100644 > > --- a/lib/librte_lpm/meson.build > > +++ b/lib/librte_lpm/meson.build > > @@ -7,3 +7,4 @@ headers = files('rte_lpm.h', 'rte_lpm6.h') > > # without worrying about which architecture we actually need > > headers += files('rte_lpm_altivec.h', 'rte_lpm_neon.h', 'rte_lpm_sse.h') > > deps += ['hash'] > > +deps += ['rcu'] > > diff --git a/lib/librte_lpm/rte_lpm.c b/lib/librte_lpm/rte_lpm.c index > > 38ab512a4..30f541179 100644 > > --- a/lib/librte_lpm/rte_lpm.c > > +++ b/lib/librte_lpm/rte_lpm.c > > @@ -1,5 +1,6 @@ > > /* SPDX-License-Identifier: BSD-3-Clause > >* Copyright(c) 2010-2014 Intel Corporation > > + * Copyright(c) 2020 Arm Limited > >*/ > > > > #include > > @@ -246,12 +247,85 @@ rte_lpm_free(struct rte_lpm *lpm) > > > > rte_mcfg_tailq_write_unlock(); > > > > + if (lpm->dq) > > + rte_rcu_qsbr_dq_delete(lpm->dq); > > rte_free(lpm->tbl8); > > rte_free(lpm->rules_tbl); > > rte_free(lpm); > > rte_free(te); > > } > > > > +static void > > +__lpm_rcu_qsbr_free_resource(void *p, void *data, unsigned int n) { > > + struct rte_lpm_tbl_entry zero_t
[dpdk-dev] [PATCH v2] net/ice: support based RSS configure
Enable/disable RSS for corresponding flow base on the user's requirement. Signed-off-by: Junyu Jiang --- v1->v2: remove gtpu and pppoe/pppod configuration from rss init --- drivers/net/ice/ice_ethdev.c | 162 +-- 1 file changed, 96 insertions(+), 66 deletions(-) diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c index 5a89a1955..cbe59a40e 100644 --- a/drivers/net/ice/ice_ethdev.c +++ b/drivers/net/ice/ice_ethdev.c @@ -2441,6 +2441,87 @@ ice_dev_uninit(struct rte_eth_dev *dev) return 0; } +static void +ice_rss_hash_set(struct ice_pf *pf, uint64_t rss_hf) +{ + struct ice_hw *hw = ICE_PF_TO_HW(pf); + struct ice_vsi *vsi = pf->main_vsi; + int ret; + + /** +* configure RSS for IPv4 with input set IPv4 src/dst +* configure RSS for IPv6 with input set IPv6 src/dst +*/ + if (rss_hf & ETH_RSS_IP) { + ret = ice_add_rss_cfg(hw, vsi->idx, ICE_FLOW_HASH_IPV4, + ICE_FLOW_SEG_HDR_IPV4, 0); + if (ret) + PMD_DRV_LOG(ERR, "%s IPV4 rss flow fail %d", + __func__, ret); + + ret = ice_add_rss_cfg(hw, vsi->idx, ICE_FLOW_HASH_IPV6, + ICE_FLOW_SEG_HDR_IPV6, 0); + if (ret) + PMD_DRV_LOG(ERR, "%s IPV6 rss flow fail %d", + __func__, ret); + } + /** +*configure RSS for udp6 with input set IPv6 src/dst, UDP src/dst +*configure RSS for udp4 with input set IP src/dst, UDP src/dst +*/ + if (rss_hf & ETH_RSS_UDP) { + ret = ice_add_rss_cfg(hw, vsi->idx, ICE_HASH_UDP_IPV6, + ICE_FLOW_SEG_HDR_UDP | + ICE_FLOW_SEG_HDR_IPV6, 0); + if (ret) + PMD_DRV_LOG(ERR, "%s UDP_IPV6 rss flow fail %d", + __func__, ret); + + ret = ice_add_rss_cfg(hw, vsi->idx, ICE_HASH_UDP_IPV4, + ICE_FLOW_SEG_HDR_UDP | + ICE_FLOW_SEG_HDR_IPV4, 0); + if (ret) + PMD_DRV_LOG(ERR, "%s UDP_IPV4 rss flow fail %d", + __func__, ret); + } + /** +* configure RSS for tcp6 with input set IPv6 src/dst, TCP src/dst +* configure RSS for tcp4 with input set IP src/dst, TCP src/dst +*/ + if (rss_hf & ETH_RSS_TCP) { + ret = ice_add_rss_cfg(hw, vsi->idx, ICE_HASH_TCP_IPV6, + ICE_FLOW_SEG_HDR_TCP | + ICE_FLOW_SEG_HDR_IPV6, 0); + if (ret) + PMD_DRV_LOG(ERR, "%s TCP_IPV6 rss flow fail %d", + __func__, ret); + ret = ice_add_rss_cfg(hw, vsi->idx, ICE_HASH_TCP_IPV4, + ICE_FLOW_SEG_HDR_TCP | + ICE_FLOW_SEG_HDR_IPV4, 0); + if (ret) + PMD_DRV_LOG(ERR, "%s TCP_IPV4 rss flow fail %d", + __func__, ret); + } + /** +* configure RSS for sctp6 with input set IPv6 src/dst +* configure RSS for sctp4 with input set IP src/dst +*/ + if (rss_hf & ETH_RSS_SCTP) { + ret = ice_add_rss_cfg(hw, vsi->idx, ICE_FLOW_HASH_IPV6, + ICE_FLOW_SEG_HDR_SCTP | + ICE_FLOW_SEG_HDR_IPV6, 0); + if (ret) + PMD_DRV_LOG(ERR, "%s SCTP_IPV6 rss flow fail %d", + __func__, ret); + ret = ice_add_rss_cfg(hw, vsi->idx, ICE_FLOW_HASH_IPV4, + ICE_FLOW_SEG_HDR_SCTP | + ICE_FLOW_SEG_HDR_IPV4, 0); + if (ret) + PMD_DRV_LOG(ERR, "%s SCTP_IPV4 rss flow fail %d", + __func__, ret); + } +} + static int ice_init_rss(struct ice_pf *pf) { struct ice_hw *hw = ICE_PF_TO_HW(pf); @@ -2501,72 +2582,9 @@ static int ice_init_rss(struct ice_pf *pf) (1 << VSIQF_HASH_CTL_HASH_SCHEME_S); ICE_WRITE_REG(hw, VSIQF_HASH_CTL(vsi->vsi_id), reg); - /* configure RSS for IPv4 with input set IPv4 src/dst */ - ret = ice_add_rss_cfg(hw, vsi->idx, ICE_FLOW_HASH_IPV4, - ICE_FLOW_SEG_HDR_IPV4, 0); - if (ret) - PMD_DRV_LOG(ERR, "%s IPV4 rss flow fail %d", __func__, ret); - - /* configure RSS for IPv6 with input set IPv6 src/dst */ - ret = ice_add_rss_cfg(hw, vsi->idx, ICE_FLOW_HASH_IPV6, - ICE_FLOW_SEG_HDR_IPV6, 0); - if (ret) -
[dpdk-dev] [PATCH v2] bus/pci: fix VF bus error for memory access
To fix CVE-2020-12888, the linux vfio-pci module will invalidate mmaps and block MMIO access on disabled memory, it will send a SIGBUS to the application: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=abafbc551fddede3e0a08dee1dcde08fc0eb8476 When the application opens the vfio PCI device, the vfio-pci module will enable the memory bus command through PCI read/write access. According to the PCIe specification, for VF, the 'Memory Space Enable' is always zero: Table 9-13 Command Register Changes Bit Location | PF and VF Register Differences | PF | VF | From Base | Attributes | Attributes -+++--- | Memory Space Enable - Does not || | apply to VFs. Must be hardwired| Base | 0b 1 | to 0b for VFs. VF Memory Space || | is controlled by the VF MSE bit|| | in the VF Control register.|| -+++--- Then the vfio-pci module initializes its own virtual PCI config space data ('vconfig') by reading the VF's physical PCI config space, so the 'Memory Space Enable' bit in vconfig will also have 0b value. This will make the vfio-pci find that the BAR memory is disabled, and the SIGBUS will be triggerred if access these BARs. So it needs to enable PCI bus memory command explicitly to avoid access on disabled memory, which will call vfio-pci virtual PCI read/write API to set the 'Memory Space Enable' in vconfig space to 1b. Fixes: 33604c31354a ("vfio: refactor PCI BAR mapping") Cc: sta...@dpdk.org Signed-off-by: Haiyue Wang --- v2: Rewrite the commit log, and put the link into it even it is long. --- drivers/bus/pci/linux/pci_vfio.c | 37 1 file changed, 37 insertions(+) diff --git a/drivers/bus/pci/linux/pci_vfio.c b/drivers/bus/pci/linux/pci_vfio.c index 64cd84a68..9b6e45da5 100644 --- a/drivers/bus/pci/linux/pci_vfio.c +++ b/drivers/bus/pci/linux/pci_vfio.c @@ -149,6 +149,38 @@ pci_vfio_get_msix_bar(int fd, struct pci_msix_table *msix_table) return 0; } +/* enable PCI bus memory command */ +static int +pci_vfio_enable_bus_memory(int dev_fd) +{ + uint16_t cmd; + int ret; + + ret = pread64(dev_fd, &cmd, sizeof(cmd), + VFIO_GET_REGION_ADDR(VFIO_PCI_CONFIG_REGION_INDEX) + + PCI_COMMAND); + + if (ret != sizeof(cmd)) { + RTE_LOG(ERR, EAL, "Cannot read command from PCI config space!\n"); + return -1; + } + + if (cmd & PCI_COMMAND_MEMORY) + return 0; + + cmd |= PCI_COMMAND_MEMORY; + ret = pwrite64(dev_fd, &cmd, sizeof(cmd), + VFIO_GET_REGION_ADDR(VFIO_PCI_CONFIG_REGION_INDEX) + + PCI_COMMAND); + + if (ret != sizeof(cmd)) { + RTE_LOG(ERR, EAL, "Cannot write command to PCI config space!\n"); + return -1; + } + + return 0; +} + /* set PCI bus mastering */ static int pci_vfio_set_bus_master(int dev_fd, bool op) @@ -427,6 +459,11 @@ pci_rte_vfio_setup_device(struct rte_pci_device *dev, int vfio_dev_fd) return -1; } + if (pci_vfio_enable_bus_memory(vfio_dev_fd)) { + RTE_LOG(ERR, EAL, "Cannot enable bus memory command!\n"); + return -1; + } + /* set bus mastering for the device */ if (pci_vfio_set_bus_master(vfio_dev_fd, true)) { RTE_LOG(ERR, EAL, "Cannot set up bus mastering!\n"); -- 2.27.0