diff --git a/0001-add-igb-uio.patch b/0001-add-igb-uio.patch new file mode 100644 index 0000000000000000000000000000000000000000..3e318609faa987ffcfde6c9cabb38752f28a3e8d --- /dev/null +++ b/0001-add-igb-uio.patch @@ -0,0 +1,927 @@ +From b46793510b200c4120f03963252f7f54d23f6f8b Mon Sep 17 00:00:00 2001 +From: Changsheng Wu +Date: Sat, 18 Dec 2021 19:07:58 +0800 +Subject: [PATCH] add igb_uio + +--- + kernel/linux/igb_uio/Kbuild | 2 + + kernel/linux/igb_uio/compat.h | 154 +++++++ + kernel/linux/igb_uio/igb_uio.c | 674 +++++++++++++++++++++++++++++++ + kernel/linux/igb_uio/meson.build | 27 ++ + kernel/linux/meson.build | 2 +- + meson_options.txt | 2 +- + 6 files changed, 859 insertions(+), 2 deletions(-) + create mode 100644 kernel/linux/igb_uio/Kbuild + create mode 100644 kernel/linux/igb_uio/compat.h + create mode 100644 kernel/linux/igb_uio/igb_uio.c + create mode 100644 kernel/linux/igb_uio/meson.build + +diff --git a/kernel/linux/igb_uio/Kbuild b/kernel/linux/igb_uio/Kbuild +new file mode 100644 +index 0000000000..3ab85c4116 +--- /dev/null ++++ b/kernel/linux/igb_uio/Kbuild +@@ -0,0 +1,2 @@ ++ccflags-y := $(MODULE_CFLAGS) ++obj-m := igb_uio.o +diff --git a/kernel/linux/igb_uio/compat.h b/kernel/linux/igb_uio/compat.h +new file mode 100644 +index 0000000000..8dbb896ae1 +--- /dev/null ++++ b/kernel/linux/igb_uio/compat.h +@@ -0,0 +1,154 @@ ++/* SPDX-License-Identifier: GPL-2.0 */ ++/* ++ * Minimal wrappers to allow compiling igb_uio on older kernels. ++ */ ++ ++#ifndef RHEL_RELEASE_VERSION ++#define RHEL_RELEASE_VERSION(a, b) (((a) << 8) + (b)) ++#endif ++ ++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 3, 0) ++#define pci_cfg_access_lock pci_block_user_cfg_access ++#define pci_cfg_access_unlock pci_unblock_user_cfg_access ++#endif ++ ++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 18, 0) ++#define HAVE_PTE_MASK_PAGE_IOMAP ++#endif ++ ++#ifndef PCI_MSIX_ENTRY_SIZE ++#define PCI_MSIX_ENTRY_SIZE 16 ++#define PCI_MSIX_ENTRY_VECTOR_CTRL 12 ++#define PCI_MSIX_ENTRY_CTRL_MASKBIT 1 ++#endif ++ ++/* ++ * for kernels < 2.6.38 and backported patch that moves MSI-X entry definition ++ * to pci_regs.h Those kernels has PCI_MSIX_ENTRY_SIZE defined but not ++ * PCI_MSIX_ENTRY_CTRL_MASKBIT ++ */ ++#ifndef PCI_MSIX_ENTRY_CTRL_MASKBIT ++#define PCI_MSIX_ENTRY_CTRL_MASKBIT 1 ++#endif ++ ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 34) && \ ++ (!(defined(RHEL_RELEASE_CODE) && \ ++ RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(5, 9))) ++ ++static int pci_num_vf(struct pci_dev *dev) ++{ ++ struct iov { ++ int pos; ++ int nres; ++ u32 cap; ++ u16 ctrl; ++ u16 total; ++ u16 initial; ++ u16 nr_virtfn; ++ } *iov = (struct iov *)dev->sriov; ++ ++ if (!dev->is_physfn) ++ return 0; ++ ++ return iov->nr_virtfn; ++} ++ ++#endif /* < 2.6.34 */ ++ ++#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 39) && \ ++ (!(defined(RHEL_RELEASE_CODE) && \ ++ RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(6, 4))) ++ ++#define kstrtoul strict_strtoul ++ ++#endif /* < 2.6.39 */ ++ ++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 3, 0) && \ ++ (!(defined(RHEL_RELEASE_CODE) && \ ++ RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(6, 3))) ++ ++/* Check if INTX works to control irq's. ++ * Set's INTX_DISABLE flag and reads it back ++ */ ++static bool pci_intx_mask_supported(struct pci_dev *pdev) ++{ ++ bool mask_supported = false; ++ uint16_t orig, new; ++ ++ pci_block_user_cfg_access(pdev); ++ pci_read_config_word(pdev, PCI_COMMAND, &orig); ++ pci_write_config_word(pdev, PCI_COMMAND, ++ orig ^ PCI_COMMAND_INTX_DISABLE); ++ pci_read_config_word(pdev, PCI_COMMAND, &new); ++ ++ if ((new ^ orig) & ~PCI_COMMAND_INTX_DISABLE) { ++ dev_err(&pdev->dev, "Command register changed from " ++ "0x%x to 0x%x: driver or hardware bug?\n", orig, new); ++ } else if ((new ^ orig) & PCI_COMMAND_INTX_DISABLE) { ++ mask_supported = true; ++ pci_write_config_word(pdev, PCI_COMMAND, orig); ++ } ++ pci_unblock_user_cfg_access(pdev); ++ ++ return mask_supported; ++} ++ ++static bool pci_check_and_mask_intx(struct pci_dev *pdev) ++{ ++ bool pending; ++ uint32_t status; ++ ++ pci_block_user_cfg_access(pdev); ++ pci_read_config_dword(pdev, PCI_COMMAND, &status); ++ ++ /* interrupt is not ours, goes to out */ ++ pending = (((status >> 16) & PCI_STATUS_INTERRUPT) != 0); ++ if (pending) { ++ uint16_t old, new; ++ ++ old = status; ++ if (status != 0) ++ new = old & (~PCI_COMMAND_INTX_DISABLE); ++ else ++ new = old | PCI_COMMAND_INTX_DISABLE; ++ ++ if (old != new) ++ pci_write_config_word(pdev, PCI_COMMAND, new); ++ } ++ pci_unblock_user_cfg_access(pdev); ++ ++ return pending; ++} ++ ++#endif /* < 3.3.0 */ ++ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 16, 0) ++#define HAVE_PCI_IS_BRIDGE_API 1 ++#endif ++ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 3, 0) ++#define HAVE_MSI_LIST_IN_GENERIC_DEVICE 1 ++#endif ++ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 0) ++#define HAVE_PCI_MSI_MASK_IRQ 1 ++#endif ++ ++#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 8, 0) ++#define HAVE_ALLOC_IRQ_VECTORS 1 ++#endif ++ ++static inline bool igbuio_kernel_is_locked_down(void) ++{ ++#ifdef CONFIG_LOCK_DOWN_KERNEL ++#ifdef CONFIG_LOCK_DOWN_IN_EFI_SECURE_BOOT ++ return kernel_is_locked_down(NULL); ++#elif defined(CONFIG_EFI_SECURE_BOOT_LOCK_DOWN) ++ return kernel_is_locked_down(); ++#else ++ return false; ++#endif ++#else ++ return false; ++#endif ++} +diff --git a/kernel/linux/igb_uio/igb_uio.c b/kernel/linux/igb_uio/igb_uio.c +new file mode 100644 +index 0000000000..ea439d131d +--- /dev/null ++++ b/kernel/linux/igb_uio/igb_uio.c +@@ -0,0 +1,674 @@ ++// SPDX-License-Identifier: GPL-2.0 ++/*- ++ * Copyright(c) 2010-2017 Intel Corporation. All rights reserved. ++ */ ++ ++#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt ++ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++/** ++ * These enum and macro definitions are copied from the ++ * file rte_pci_dev_features.h ++ */ ++enum rte_intr_mode { ++ RTE_INTR_MODE_NONE = 0, ++ RTE_INTR_MODE_LEGACY, ++ RTE_INTR_MODE_MSI, ++ RTE_INTR_MODE_MSIX ++}; ++#define RTE_INTR_MODE_NONE_NAME "none" ++#define RTE_INTR_MODE_LEGACY_NAME "legacy" ++#define RTE_INTR_MODE_MSI_NAME "msi" ++#define RTE_INTR_MODE_MSIX_NAME "msix" ++ ++ ++#include "compat.h" ++ ++/** ++ * A structure describing the private information for a uio device. ++ */ ++struct rte_uio_pci_dev { ++ struct uio_info info; ++ struct pci_dev *pdev; ++ enum rte_intr_mode mode; ++ atomic_t refcnt; ++}; ++ ++static int wc_activate; ++static char *intr_mode; ++static enum rte_intr_mode igbuio_intr_mode_preferred = RTE_INTR_MODE_MSIX; ++/* sriov sysfs */ ++static ssize_t ++show_max_vfs(struct device *dev, struct device_attribute *attr, ++ char *buf) ++{ ++ return snprintf(buf, 10, "%u\n", dev_num_vf(dev)); ++} ++ ++static ssize_t ++store_max_vfs(struct device *dev, struct device_attribute *attr, ++ const char *buf, size_t count) ++{ ++ int err = 0; ++ unsigned long max_vfs; ++ struct pci_dev *pdev = to_pci_dev(dev); ++ ++ if (0 != kstrtoul(buf, 0, &max_vfs)) ++ return -EINVAL; ++ ++ if (0 == max_vfs) ++ pci_disable_sriov(pdev); ++ else if (0 == pci_num_vf(pdev)) ++ err = pci_enable_sriov(pdev, max_vfs); ++ else /* do nothing if change max_vfs number */ ++ err = -EINVAL; ++ ++ return err ? err : count; ++} ++ ++static DEVICE_ATTR(max_vfs, S_IRUGO | S_IWUSR, show_max_vfs, store_max_vfs); ++ ++static struct attribute *dev_attrs[] = { ++ &dev_attr_max_vfs.attr, ++ NULL, ++}; ++ ++static const struct attribute_group dev_attr_grp = { ++ .attrs = dev_attrs, ++}; ++ ++#ifndef HAVE_PCI_MSI_MASK_IRQ ++/* ++ * It masks the msix on/off of generating MSI-X messages. ++ */ ++static void ++igbuio_msix_mask_irq(struct msi_desc *desc, s32 state) ++{ ++ u32 mask_bits = desc->masked; ++ unsigned int offset = desc->msi_attrib.entry_nr * PCI_MSIX_ENTRY_SIZE + ++ PCI_MSIX_ENTRY_VECTOR_CTRL; ++ ++ if (state != 0) ++ mask_bits &= ~PCI_MSIX_ENTRY_CTRL_MASKBIT; ++ else ++ mask_bits |= PCI_MSIX_ENTRY_CTRL_MASKBIT; ++ ++ if (mask_bits != desc->masked) { ++ writel(mask_bits, desc->mask_base + offset); ++ readl(desc->mask_base); ++ desc->masked = mask_bits; ++ } ++} ++ ++/* ++ * It masks the msi on/off of generating MSI messages. ++ */ ++static void ++igbuio_msi_mask_irq(struct pci_dev *pdev, struct msi_desc *desc, int32_t state) ++{ ++ u32 mask_bits = desc->masked; ++ u32 offset = desc->irq - pdev->irq; ++ u32 mask = 1 << offset; ++ ++ if (!desc->msi_attrib.maskbit) ++ return; ++ ++ if (state != 0) ++ mask_bits &= ~mask; ++ else ++ mask_bits |= mask; ++ ++ if (mask_bits != desc->masked) { ++ pci_write_config_dword(pdev, desc->mask_pos, mask_bits); ++ desc->masked = mask_bits; ++ } ++} ++ ++static void ++igbuio_mask_irq(struct pci_dev *pdev, enum rte_intr_mode mode, s32 irq_state) ++{ ++ struct msi_desc *desc; ++ struct list_head *msi_list; ++ ++#ifdef HAVE_MSI_LIST_IN_GENERIC_DEVICE ++ msi_list = &pdev->dev.msi_list; ++#else ++ msi_list = &pdev->msi_list; ++#endif ++ ++ if (mode == RTE_INTR_MODE_MSIX) { ++ list_for_each_entry(desc, msi_list, list) ++ igbuio_msix_mask_irq(desc, irq_state); ++ } else if (mode == RTE_INTR_MODE_MSI) { ++ list_for_each_entry(desc, msi_list, list) ++ igbuio_msi_mask_irq(pdev, desc, irq_state); ++ } ++} ++#endif ++ ++/** ++ * This is the irqcontrol callback to be registered to uio_info. ++ * It can be used to disable/enable interrupt from user space processes. ++ * ++ * @param info ++ * pointer to uio_info. ++ * @param irq_state ++ * state value. 1 to enable interrupt, 0 to disable interrupt. ++ * ++ * @return ++ * - On success, 0. ++ * - On failure, a negative value. ++ */ ++static int ++igbuio_pci_irqcontrol(struct uio_info *info, s32 irq_state) ++{ ++ struct rte_uio_pci_dev *udev = info->priv; ++ struct pci_dev *pdev = udev->pdev; ++ ++#ifdef HAVE_PCI_MSI_MASK_IRQ ++ struct irq_data *irq = irq_get_irq_data(udev->info.irq); ++#endif ++ ++ pci_cfg_access_lock(pdev); ++ ++ if (udev->mode == RTE_INTR_MODE_MSIX || udev->mode == RTE_INTR_MODE_MSI) { ++#ifdef HAVE_PCI_MSI_MASK_IRQ ++ if (irq_state == 1) ++ pci_msi_unmask_irq(irq); ++ else ++ pci_msi_mask_irq(irq); ++#else ++ igbuio_mask_irq(pdev, udev->mode, irq_state); ++#endif ++ } ++ ++ if (udev->mode == RTE_INTR_MODE_LEGACY) ++ pci_intx(pdev, !!irq_state); ++ ++ pci_cfg_access_unlock(pdev); ++ ++ return 0; ++} ++ ++/** ++ * This is interrupt handler which will check if the interrupt is for the right device. ++ * If yes, disable it here and will be enable later. ++ */ ++static irqreturn_t ++igbuio_pci_irqhandler(int irq, void *dev_id) ++{ ++ struct rte_uio_pci_dev *udev = (struct rte_uio_pci_dev *)dev_id; ++ struct uio_info *info = &udev->info; ++ ++ /* Legacy mode need to mask in hardware */ ++ if (udev->mode == RTE_INTR_MODE_LEGACY && ++ !pci_check_and_mask_intx(udev->pdev)) ++ return IRQ_NONE; ++ ++ uio_event_notify(info); ++ ++ /* Message signal mode, no share IRQ and automasked */ ++ return IRQ_HANDLED; ++} ++ ++static int ++igbuio_pci_enable_interrupts(struct rte_uio_pci_dev *udev) ++{ ++ int err = 0; ++#ifndef HAVE_ALLOC_IRQ_VECTORS ++ struct msix_entry msix_entry; ++#endif ++ ++ switch (igbuio_intr_mode_preferred) { ++ case RTE_INTR_MODE_MSIX: ++ /* Only 1 msi-x vector needed */ ++#ifndef HAVE_ALLOC_IRQ_VECTORS ++ msix_entry.entry = 0; ++ if (pci_enable_msix(udev->pdev, &msix_entry, 1) == 0) { ++ dev_dbg(&udev->pdev->dev, "using MSI-X"); ++ udev->info.irq_flags = IRQF_NO_THREAD; ++ udev->info.irq = msix_entry.vector; ++ udev->mode = RTE_INTR_MODE_MSIX; ++ break; ++ } ++#else ++ if (pci_alloc_irq_vectors(udev->pdev, 1, 1, PCI_IRQ_MSIX) == 1) { ++ dev_dbg(&udev->pdev->dev, "using MSI-X"); ++ udev->info.irq_flags = IRQF_NO_THREAD; ++ udev->info.irq = pci_irq_vector(udev->pdev, 0); ++ udev->mode = RTE_INTR_MODE_MSIX; ++ break; ++ } ++#endif ++ ++ /* falls through - to MSI */ ++ case RTE_INTR_MODE_MSI: ++#ifndef HAVE_ALLOC_IRQ_VECTORS ++ if (pci_enable_msi(udev->pdev) == 0) { ++ dev_dbg(&udev->pdev->dev, "using MSI"); ++ udev->info.irq_flags = IRQF_NO_THREAD; ++ udev->info.irq = udev->pdev->irq; ++ udev->mode = RTE_INTR_MODE_MSI; ++ break; ++ } ++#else ++ if (pci_alloc_irq_vectors(udev->pdev, 1, 1, PCI_IRQ_MSI) == 1) { ++ dev_dbg(&udev->pdev->dev, "using MSI"); ++ udev->info.irq_flags = IRQF_NO_THREAD; ++ udev->info.irq = pci_irq_vector(udev->pdev, 0); ++ udev->mode = RTE_INTR_MODE_MSI; ++ break; ++ } ++#endif ++ /* falls through - to INTX */ ++ case RTE_INTR_MODE_LEGACY: ++ if (pci_intx_mask_supported(udev->pdev)) { ++ dev_dbg(&udev->pdev->dev, "using INTX"); ++ udev->info.irq_flags = IRQF_SHARED | IRQF_NO_THREAD; ++ udev->info.irq = udev->pdev->irq; ++ udev->mode = RTE_INTR_MODE_LEGACY; ++ break; ++ } ++ dev_notice(&udev->pdev->dev, "PCI INTX mask not supported\n"); ++ /* falls through - to no IRQ */ ++ case RTE_INTR_MODE_NONE: ++ udev->mode = RTE_INTR_MODE_NONE; ++ udev->info.irq = UIO_IRQ_NONE; ++ break; ++ ++ default: ++ dev_err(&udev->pdev->dev, "invalid IRQ mode %u", ++ igbuio_intr_mode_preferred); ++ udev->info.irq = UIO_IRQ_NONE; ++ err = -EINVAL; ++ } ++ ++ if (udev->info.irq != UIO_IRQ_NONE) ++ err = request_irq(udev->info.irq, igbuio_pci_irqhandler, ++ udev->info.irq_flags, udev->info.name, ++ udev); ++ dev_info(&udev->pdev->dev, "uio device registered with irq %ld\n", ++ udev->info.irq); ++ ++ return err; ++} ++ ++static void ++igbuio_pci_disable_interrupts(struct rte_uio_pci_dev *udev) ++{ ++ if (udev->info.irq) { ++ free_irq(udev->info.irq, udev); ++ udev->info.irq = 0; ++ } ++ ++#ifndef HAVE_ALLOC_IRQ_VECTORS ++ if (udev->mode == RTE_INTR_MODE_MSIX) ++ pci_disable_msix(udev->pdev); ++ if (udev->mode == RTE_INTR_MODE_MSI) ++ pci_disable_msi(udev->pdev); ++#else ++ if (udev->mode == RTE_INTR_MODE_MSIX || ++ udev->mode == RTE_INTR_MODE_MSI) ++ pci_free_irq_vectors(udev->pdev); ++#endif ++} ++ ++ ++/** ++ * This gets called while opening uio device file. ++ */ ++static int ++igbuio_pci_open(struct uio_info *info, struct inode *inode) ++{ ++ struct rte_uio_pci_dev *udev = info->priv; ++ struct pci_dev *dev = udev->pdev; ++ int err; ++ ++ if (atomic_inc_return(&udev->refcnt) != 1) ++ return 0; ++ ++ /* set bus master, which was cleared by the reset function */ ++ pci_set_master(dev); ++ ++ /* enable interrupts */ ++ err = igbuio_pci_enable_interrupts(udev); ++ if (err) { ++ atomic_dec(&udev->refcnt); ++ dev_err(&dev->dev, "Enable interrupt fails\n"); ++ } ++ return err; ++} ++ ++static int ++igbuio_pci_release(struct uio_info *info, struct inode *inode) ++{ ++ struct rte_uio_pci_dev *udev = info->priv; ++ struct pci_dev *dev = udev->pdev; ++ ++ if (atomic_dec_and_test(&udev->refcnt)) { ++ /* disable interrupts */ ++ igbuio_pci_disable_interrupts(udev); ++ ++ /* stop the device from further DMA */ ++ pci_clear_master(dev); ++ } ++ ++ return 0; ++} ++ ++/* Remap pci resources described by bar #pci_bar in uio resource n. */ ++static int ++igbuio_pci_setup_iomem(struct pci_dev *dev, struct uio_info *info, ++ int n, int pci_bar, const char *name) ++{ ++ unsigned long addr, len; ++ void *internal_addr; ++ ++ if (n >= ARRAY_SIZE(info->mem)) ++ return -EINVAL; ++ ++ addr = pci_resource_start(dev, pci_bar); ++ len = pci_resource_len(dev, pci_bar); ++ if (addr == 0 || len == 0) ++ return -1; ++ if (wc_activate == 0) { ++ internal_addr = ioremap(addr, len); ++ if (internal_addr == NULL) ++ return -1; ++ } else { ++ internal_addr = NULL; ++ } ++ info->mem[n].name = name; ++ info->mem[n].addr = addr; ++ info->mem[n].internal_addr = internal_addr; ++ info->mem[n].size = len; ++ info->mem[n].memtype = UIO_MEM_PHYS; ++ return 0; ++} ++ ++/* Get pci port io resources described by bar #pci_bar in uio resource n. */ ++static int ++igbuio_pci_setup_ioport(struct pci_dev *dev, struct uio_info *info, ++ int n, int pci_bar, const char *name) ++{ ++ unsigned long addr, len; ++ ++ if (n >= ARRAY_SIZE(info->port)) ++ return -EINVAL; ++ ++ addr = pci_resource_start(dev, pci_bar); ++ len = pci_resource_len(dev, pci_bar); ++ if (addr == 0 || len == 0) ++ return -EINVAL; ++ ++ info->port[n].name = name; ++ info->port[n].start = addr; ++ info->port[n].size = len; ++ info->port[n].porttype = UIO_PORT_X86; ++ ++ return 0; ++} ++ ++/* Unmap previously ioremap'd resources */ ++static void ++igbuio_pci_release_iomem(struct uio_info *info) ++{ ++ int i; ++ ++ for (i = 0; i < MAX_UIO_MAPS; i++) { ++ if (info->mem[i].internal_addr) ++ iounmap(info->mem[i].internal_addr); ++ } ++} ++ ++static int ++igbuio_setup_bars(struct pci_dev *dev, struct uio_info *info) ++{ ++ int i, iom, iop, ret; ++ unsigned long flags; ++ static const char *bar_names[PCI_STD_RESOURCE_END + 1] = { ++ "BAR0", ++ "BAR1", ++ "BAR2", ++ "BAR3", ++ "BAR4", ++ "BAR5", ++ }; ++ ++ iom = 0; ++ iop = 0; ++ ++ for (i = 0; i < ARRAY_SIZE(bar_names); i++) { ++ if (pci_resource_len(dev, i) != 0 && ++ pci_resource_start(dev, i) != 0) { ++ flags = pci_resource_flags(dev, i); ++ if (flags & IORESOURCE_MEM) { ++ ret = igbuio_pci_setup_iomem(dev, info, iom, ++ i, bar_names[i]); ++ if (ret != 0) ++ return ret; ++ iom++; ++ } else if (flags & IORESOURCE_IO) { ++ ret = igbuio_pci_setup_ioport(dev, info, iop, ++ i, bar_names[i]); ++ if (ret != 0) ++ return ret; ++ iop++; ++ } ++ } ++ } ++ ++ return (iom != 0 || iop != 0) ? ret : -ENOENT; ++} ++ ++#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 8, 0) ++static int __devinit ++#else ++static int ++#endif ++igbuio_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) ++{ ++ struct rte_uio_pci_dev *udev; ++ dma_addr_t map_dma_addr; ++ void *map_addr; ++ int err; ++ ++#ifdef HAVE_PCI_IS_BRIDGE_API ++ if (pci_is_bridge(dev)) { ++ dev_warn(&dev->dev, "Ignoring PCI bridge device\n"); ++ return -ENODEV; ++ } ++#endif ++ ++ udev = kzalloc(sizeof(struct rte_uio_pci_dev), GFP_KERNEL); ++ if (!udev) ++ return -ENOMEM; ++ ++ /* ++ * enable device: ask low-level code to enable I/O and ++ * memory ++ */ ++ err = pci_enable_device(dev); ++ if (err != 0) { ++ dev_err(&dev->dev, "Cannot enable PCI device\n"); ++ goto fail_free; ++ } ++ ++ /* enable bus mastering on the device */ ++ pci_set_master(dev); ++ ++ /* remap IO memory */ ++ err = igbuio_setup_bars(dev, &udev->info); ++ if (err != 0) ++ goto fail_release_iomem; ++ ++ /* set 64-bit DMA mask */ ++ err = pci_set_dma_mask(dev, DMA_BIT_MASK(64)); ++ if (err != 0) { ++ dev_err(&dev->dev, "Cannot set DMA mask\n"); ++ goto fail_release_iomem; ++ } ++ ++ err = pci_set_consistent_dma_mask(dev, DMA_BIT_MASK(64)); ++ if (err != 0) { ++ dev_err(&dev->dev, "Cannot set consistent DMA mask\n"); ++ goto fail_release_iomem; ++ } ++ ++ /* fill uio infos */ ++ udev->info.name = "igb_uio"; ++ udev->info.version = "0.1"; ++ udev->info.irqcontrol = igbuio_pci_irqcontrol; ++ udev->info.open = igbuio_pci_open; ++ udev->info.release = igbuio_pci_release; ++ udev->info.priv = udev; ++ udev->pdev = dev; ++ atomic_set(&udev->refcnt, 0); ++ ++ err = sysfs_create_group(&dev->dev.kobj, &dev_attr_grp); ++ if (err != 0) ++ goto fail_release_iomem; ++ ++ /* register uio driver */ ++ err = uio_register_device(&dev->dev, &udev->info); ++ if (err != 0) ++ goto fail_remove_group; ++ ++ pci_set_drvdata(dev, udev); ++ ++ /* ++ * Doing a harmless dma mapping for attaching the device to ++ * the iommu identity mapping if kernel boots with iommu=pt. ++ * Note this is not a problem if no IOMMU at all. ++ */ ++ map_addr = dma_alloc_coherent(&dev->dev, 1024, &map_dma_addr, ++ GFP_KERNEL); ++ if (map_addr) ++ memset(map_addr, 0, 1024); ++ ++ if (!map_addr) ++ dev_info(&dev->dev, "dma mapping failed\n"); ++ else { ++ dev_info(&dev->dev, "mapping 1K dma=%#llx host=%p\n", ++ (unsigned long long)map_dma_addr, map_addr); ++ ++ dma_free_coherent(&dev->dev, 1024, map_addr, map_dma_addr); ++ dev_info(&dev->dev, "unmapping 1K dma=%#llx host=%p\n", ++ (unsigned long long)map_dma_addr, map_addr); ++ } ++ ++ return 0; ++ ++fail_remove_group: ++ sysfs_remove_group(&dev->dev.kobj, &dev_attr_grp); ++fail_release_iomem: ++ igbuio_pci_release_iomem(&udev->info); ++ pci_disable_device(dev); ++fail_free: ++ kfree(udev); ++ ++ return err; ++} ++ ++static void ++igbuio_pci_remove(struct pci_dev *dev) ++{ ++ struct rte_uio_pci_dev *udev = pci_get_drvdata(dev); ++ ++ igbuio_pci_release(&udev->info, NULL); ++ ++ sysfs_remove_group(&dev->dev.kobj, &dev_attr_grp); ++ uio_unregister_device(&udev->info); ++ igbuio_pci_release_iomem(&udev->info); ++ pci_disable_device(dev); ++ pci_set_drvdata(dev, NULL); ++ kfree(udev); ++} ++ ++static int ++igbuio_config_intr_mode(char *intr_str) ++{ ++ if (!intr_str) { ++ pr_info("Use MSIX interrupt by default\n"); ++ return 0; ++ } ++ ++ if (!strcmp(intr_str, RTE_INTR_MODE_MSIX_NAME)) { ++ igbuio_intr_mode_preferred = RTE_INTR_MODE_MSIX; ++ pr_info("Use MSIX interrupt\n"); ++ } else if (!strcmp(intr_str, RTE_INTR_MODE_MSI_NAME)) { ++ igbuio_intr_mode_preferred = RTE_INTR_MODE_MSI; ++ pr_info("Use MSI interrupt\n"); ++ } else if (!strcmp(intr_str, RTE_INTR_MODE_LEGACY_NAME)) { ++ igbuio_intr_mode_preferred = RTE_INTR_MODE_LEGACY; ++ pr_info("Use legacy interrupt\n"); ++ } else { ++ pr_info("Error: bad parameter - %s\n", intr_str); ++ return -EINVAL; ++ } ++ ++ return 0; ++} ++ ++static struct pci_driver igbuio_pci_driver = { ++ .name = "igb_uio", ++ .id_table = NULL, ++ .probe = igbuio_pci_probe, ++ .remove = igbuio_pci_remove, ++}; ++ ++static int __init ++igbuio_pci_init_module(void) ++{ ++ int ret; ++ ++ if (igbuio_kernel_is_locked_down()) { ++ pr_err("Not able to use module, kernel lock down is enabled\n"); ++ return -EINVAL; ++ } ++ ++ if (wc_activate != 0) ++ pr_info("wc_activate is set\n"); ++ ++ ret = igbuio_config_intr_mode(intr_mode); ++ if (ret < 0) ++ return ret; ++ ++ return pci_register_driver(&igbuio_pci_driver); ++} ++ ++static void __exit ++igbuio_pci_exit_module(void) ++{ ++ pci_unregister_driver(&igbuio_pci_driver); ++} ++ ++module_init(igbuio_pci_init_module); ++module_exit(igbuio_pci_exit_module); ++ ++module_param(intr_mode, charp, S_IRUGO); ++MODULE_PARM_DESC(intr_mode, ++"igb_uio interrupt mode (default=msix):\n" ++" " RTE_INTR_MODE_MSIX_NAME " Use MSIX interrupt\n" ++" " RTE_INTR_MODE_MSI_NAME " Use MSI interrupt\n" ++" " RTE_INTR_MODE_LEGACY_NAME " Use Legacy interrupt\n" ++"\n"); ++ ++module_param(wc_activate, int, 0); ++MODULE_PARM_DESC(wc_activate, ++"Activate support for write combining (WC) (default=0)\n" ++" 0 - disable\n" ++" other - enable\n"); ++ ++MODULE_DESCRIPTION("UIO driver for Intel IGB PCI cards"); ++MODULE_LICENSE("GPL"); ++MODULE_AUTHOR("Intel Corporation"); +diff --git a/kernel/linux/igb_uio/meson.build b/kernel/linux/igb_uio/meson.build +new file mode 100644 +index 0000000000..ff8f97ca23 +--- /dev/null ++++ b/kernel/linux/igb_uio/meson.build +@@ -0,0 +1,27 @@ ++# SPDX-License-Identifier: BSD-3-Clause ++# Copyright(c) 2018 Luca Boccassi ++ ++# For SUSE build check function arguments of ndo_tx_timeout API ++# Ref: https://jira.devtools.intel.com/browse/DPDK-29263 ++kmod_cflags = '' ++ ++igb_uio_mkfile = custom_target('igb_uio_makefile', ++ output: 'Makefile', ++ command: ['touch', '@OUTPUT@']) ++ ++igb_uio_sources = files( ++ 'igb_uio.c', ++ 'Kbuild', ++) ++ ++custom_target('igb_uio', ++ input: igb_uio_sources, ++ output: 'igb_uio.ko', ++ command: ['make', '-j4', '-C', kernel_build_dir, ++ 'M=' + meson.current_build_dir(), ++ 'src=' + meson.current_source_dir(), ++ 'modules'] + cross_args, ++ depends: igb_uio_mkfile, ++ install: install, ++ install_dir: kernel_install_dir, ++ build_by_default: get_option('enable_kmods')) +diff --git a/kernel/linux/meson.build b/kernel/linux/meson.build +index 0637452e95..3230368f14 100644 +--- a/kernel/linux/meson.build ++++ b/kernel/linux/meson.build +@@ -1,7 +1,7 @@ + # SPDX-License-Identifier: BSD-3-Clause + # Copyright(c) 2018 Intel Corporation + +-subdirs = ['kni'] ++subdirs = ['kni', 'igb_uio'] + + kernel_build_dir = get_option('kernel_dir') + kernel_source_dir = get_option('kernel_dir') +diff --git a/meson_options.txt b/meson_options.txt +index 7c220ad68d..d2e172facd 100644 +--- a/meson_options.txt ++++ b/meson_options.txt +@@ -18,7 +18,7 @@ option('enable_drivers', type: 'string', value: '', description: + 'Comma-separated list of drivers to build. If unspecified, build all drivers.') + option('enable_driver_sdk', type: 'boolean', value: false, description: + 'Install headers to build drivers.') +-option('enable_kmods', type: 'boolean', value: false, description: ++option('enable_kmods', type: 'boolean', value: true, description: + 'build kernel modules') + option('examples', type: 'string', value: '', description: + 'Comma-separated list of examples to build by default') +-- +2.27.0 diff --git a/0001-net-hns3-adjust-MAC-address-logging.patch b/0001-net-hns3-adjust-MAC-address-logging.patch deleted file mode 100644 index 0258b34abd5864233f7d3e60746995e9e34b28d5..0000000000000000000000000000000000000000 --- a/0001-net-hns3-adjust-MAC-address-logging.patch +++ /dev/null @@ -1,396 +0,0 @@ -From 8124e9841e2563dc916d4c8b0fce83d1ae470b85 Mon Sep 17 00:00:00 2001 -From: Lijun Ou -Date: Thu, 10 Dec 2020 20:48:42 +0800 -Subject: [PATCH 001/189] net/hns3: adjust MAC address logging - -Here the printing of MAC addresses is adjusted. After the -modification, only some bytes of the MAC address are -displayed. - -Signed-off-by: Chengchang Tang -Signed-off-by: Lijun Ou ---- - drivers/net/hns3/hns3_ethdev.c | 53 +++++++++++++++++++++++---------------- - drivers/net/hns3/hns3_ethdev.h | 2 ++ - drivers/net/hns3/hns3_ethdev_vf.c | 32 +++++++++++------------ - 3 files changed, 49 insertions(+), 38 deletions(-) - -diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c -index 2011378..d6d3f03 100644 ---- a/drivers/net/hns3/hns3_ethdev.c -+++ b/drivers/net/hns3/hns3_ethdev.c -@@ -102,6 +102,15 @@ static int hns3_remove_mc_addr(struct hns3_hw *hw, - static int hns3_restore_fec(struct hns3_hw *hw); - static int hns3_query_dev_fec_info(struct rte_eth_dev *dev); - -+void hns3_ether_format_addr(char *buf, uint16_t size, -+ const struct rte_ether_addr *ether_addr) -+{ -+ snprintf(buf, size, "%02X:**:**:**:%02X:%02X", -+ ether_addr->addr_bytes[0], -+ ether_addr->addr_bytes[4], -+ ether_addr->addr_bytes[5]); -+} -+ - static void - hns3_pf_disable_irq0(struct hns3_hw *hw) - { -@@ -1449,7 +1458,7 @@ hns3_add_uc_addr_common(struct hns3_hw *hw, struct rte_ether_addr *mac_addr) - - /* check if mac addr is valid */ - if (!rte_is_valid_assigned_ether_addr(mac_addr)) { -- rte_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE, -+ hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE, - mac_addr); - hns3_err(hw, "Add unicast mac addr err! addr(%s) invalid", - mac_str); -@@ -1489,7 +1498,7 @@ hns3_add_uc_addr_common(struct hns3_hw *hw, struct rte_ether_addr *mac_addr) - return -ENOSPC; - } - -- rte_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE, mac_addr); -+ hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE, mac_addr); - - /* check if we just hit the duplicate */ - if (ret == 0) { -@@ -1515,7 +1524,7 @@ hns3_add_mc_addr_common(struct hns3_hw *hw, struct rte_ether_addr *mac_addr) - addr = &hw->mc_addrs[i]; - /* Check if there are duplicate addresses */ - if (rte_is_same_ether_addr(addr, mac_addr)) { -- rte_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE, -+ hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE, - addr); - hns3_err(hw, "failed to add mc mac addr, same addrs" - "(%s) is added by the set_mc_mac_addr_list " -@@ -1526,7 +1535,7 @@ hns3_add_mc_addr_common(struct hns3_hw *hw, struct rte_ether_addr *mac_addr) - - ret = hns3_add_mc_addr(hw, mac_addr); - if (ret) { -- rte_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE, -+ hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE, - mac_addr); - hns3_err(hw, "failed to add mc mac addr(%s), ret = %d", - mac_str, ret); -@@ -1542,7 +1551,7 @@ hns3_remove_mc_addr_common(struct hns3_hw *hw, struct rte_ether_addr *mac_addr) - - ret = hns3_remove_mc_addr(hw, mac_addr); - if (ret) { -- rte_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE, -+ hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE, - mac_addr); - hns3_err(hw, "failed to remove mc mac addr(%s), ret = %d", - mac_str, ret); -@@ -1576,7 +1585,7 @@ hns3_add_mac_addr(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr, - - if (ret) { - rte_spinlock_unlock(&hw->lock); -- rte_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE, -+ hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE, - mac_addr); - hns3_err(hw, "failed to add mac addr(%s), ret = %d", mac_str, - ret); -@@ -1599,7 +1608,7 @@ hns3_remove_uc_addr_common(struct hns3_hw *hw, struct rte_ether_addr *mac_addr) - - /* check if mac addr is valid */ - if (!rte_is_valid_assigned_ether_addr(mac_addr)) { -- rte_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE, -+ hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE, - mac_addr); - hns3_err(hw, "remove unicast mac addr err! addr(%s) invalid", - mac_str); -@@ -1635,7 +1644,7 @@ hns3_remove_mac_addr(struct rte_eth_dev *dev, uint32_t idx) - ret = hns3_remove_uc_addr_common(hw, mac_addr); - rte_spinlock_unlock(&hw->lock); - if (ret) { -- rte_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE, -+ hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE, - mac_addr); - hns3_err(hw, "failed to remove mac addr(%s), ret = %d", mac_str, - ret); -@@ -1666,7 +1675,7 @@ hns3_set_default_mac_addr(struct rte_eth_dev *dev, - if (default_addr_setted) { - ret = hns3_remove_uc_addr_common(hw, oaddr); - if (ret) { -- rte_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE, -+ hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE, - oaddr); - hns3_warn(hw, "Remove old uc mac address(%s) fail: %d", - mac_str, ret); -@@ -1677,7 +1686,7 @@ hns3_set_default_mac_addr(struct rte_eth_dev *dev, - - ret = hns3_add_uc_addr_common(hw, mac_addr); - if (ret) { -- rte_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE, -+ hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE, - mac_addr); - hns3_err(hw, "Failed to set mac addr(%s): %d", mac_str, ret); - goto err_add_uc_addr; -@@ -1699,7 +1708,7 @@ hns3_set_default_mac_addr(struct rte_eth_dev *dev, - err_pause_addr_cfg: - ret_val = hns3_remove_uc_addr_common(hw, mac_addr); - if (ret_val) { -- rte_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE, -+ hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE, - mac_addr); - hns3_warn(hw, - "Failed to roll back to del setted mac addr(%s): %d", -@@ -1710,7 +1719,7 @@ hns3_set_default_mac_addr(struct rte_eth_dev *dev, - if (rm_succes) { - ret_val = hns3_add_uc_addr_common(hw, oaddr); - if (ret_val) { -- rte_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE, -+ hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE, - oaddr); - hns3_warn(hw, - "Failed to restore old uc mac addr(%s): %d", -@@ -1746,7 +1755,7 @@ hns3_configure_all_mac_addr(struct hns3_adapter *hns, bool del) - - if (ret) { - err = ret; -- rte_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE, -+ hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE, - addr); - hns3_err(hw, "failed to %s mac addr(%s) index:%d " - "ret = %d.", del ? "remove" : "restore", -@@ -1795,7 +1804,7 @@ hns3_add_mc_addr(struct hns3_hw *hw, struct rte_ether_addr *mac_addr) - - /* Check if mac addr is valid */ - if (!rte_is_multicast_ether_addr(mac_addr)) { -- rte_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE, -+ hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE, - mac_addr); - hns3_err(hw, "failed to add mc mac addr, addr(%s) invalid", - mac_str); -@@ -1823,7 +1832,7 @@ hns3_add_mc_addr(struct hns3_hw *hw, struct rte_ether_addr *mac_addr) - if (ret) { - if (ret == -ENOSPC) - hns3_err(hw, "mc mac vlan table is full"); -- rte_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE, -+ hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE, - mac_addr); - hns3_err(hw, "failed to add mc mac addr(%s): %d", mac_str, ret); - } -@@ -1842,7 +1851,7 @@ hns3_remove_mc_addr(struct hns3_hw *hw, struct rte_ether_addr *mac_addr) - - /* Check if mac addr is valid */ - if (!rte_is_multicast_ether_addr(mac_addr)) { -- rte_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE, -+ hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE, - mac_addr); - hns3_err(hw, "Failed to rm mc mac addr, addr(%s) invalid", - mac_str); -@@ -1870,7 +1879,7 @@ hns3_remove_mc_addr(struct hns3_hw *hw, struct rte_ether_addr *mac_addr) - } - - if (ret) { -- rte_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE, -+ hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE, - mac_addr); - hns3_err(hw, "Failed to rm mc mac addr(%s): %d", mac_str, ret); - } -@@ -1899,7 +1908,7 @@ hns3_set_mc_addr_chk_param(struct hns3_hw *hw, - for (i = 0; i < nb_mc_addr; i++) { - addr = &mc_addr_set[i]; - if (!rte_is_multicast_ether_addr(addr)) { -- rte_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE, -+ hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE, - addr); - hns3_err(hw, - "failed to set mc mac addr, addr(%s) invalid.", -@@ -1910,7 +1919,7 @@ hns3_set_mc_addr_chk_param(struct hns3_hw *hw, - /* Check if there are duplicate addresses */ - for (j = i + 1; j < nb_mc_addr; j++) { - if (rte_is_same_ether_addr(addr, &mc_addr_set[j])) { -- rte_ether_format_addr(mac_str, -+ hns3_ether_format_addr(mac_str, - RTE_ETHER_ADDR_FMT_SIZE, - addr); - hns3_err(hw, "failed to set mc mac addr, " -@@ -1927,7 +1936,7 @@ hns3_set_mc_addr_chk_param(struct hns3_hw *hw, - for (j = 0; j < HNS3_UC_MACADDR_NUM; j++) { - if (rte_is_same_ether_addr(addr, - &hw->data->mac_addrs[j])) { -- rte_ether_format_addr(mac_str, -+ hns3_ether_format_addr(mac_str, - RTE_ETHER_ADDR_FMT_SIZE, - addr); - hns3_err(hw, "failed to set mc mac addr, " -@@ -2101,7 +2110,7 @@ hns3_configure_all_mc_mac_addr(struct hns3_adapter *hns, bool del) - ret = hns3_add_mc_addr(hw, addr); - if (ret) { - err = ret; -- rte_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE, -+ hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE, - addr); - hns3_dbg(hw, "%s mc mac addr: %s failed for pf: ret = %d", - del ? "Remove" : "Restore", mac_str, ret); -@@ -6160,7 +6169,7 @@ hns3_dev_init(struct rte_eth_dev *eth_dev) - eth_addr = (struct rte_ether_addr *)hw->mac.mac_addr; - if (!rte_is_valid_assigned_ether_addr(eth_addr)) { - rte_eth_random_addr(hw->mac.mac_addr); -- rte_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE, -+ hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE, - (struct rte_ether_addr *)hw->mac.mac_addr); - hns3_warn(hw, "default mac_addr from firmware is an invalid " - "unicast address, using random MAC address %s", -diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h -index 4c40df1..31f78a1 100644 ---- a/drivers/net/hns3/hns3_ethdev.h -+++ b/drivers/net/hns3/hns3_ethdev.h -@@ -935,6 +935,8 @@ int hns3_dev_filter_ctrl(struct rte_eth_dev *dev, - bool hns3_is_reset_pending(struct hns3_adapter *hns); - bool hns3vf_is_reset_pending(struct hns3_adapter *hns); - void hns3_update_link_status(struct hns3_hw *hw); -+void hns3_ether_format_addr(char *buf, uint16_t size, -+ const struct rte_ether_addr *ether_addr); - - static inline bool - is_reset_pending(struct hns3_adapter *hns) -diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c -index 0366b9d..f09cabc 100644 ---- a/drivers/net/hns3/hns3_ethdev_vf.c -+++ b/drivers/net/hns3/hns3_ethdev_vf.c -@@ -170,7 +170,7 @@ hns3vf_add_uc_mac_addr(struct hns3_hw *hw, struct rte_ether_addr *mac_addr) - HNS3_MBX_MAC_VLAN_UC_ADD, mac_addr->addr_bytes, - RTE_ETHER_ADDR_LEN, false, NULL, 0); - if (ret) { -- rte_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE, -+ hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE, - mac_addr); - hns3_err(hw, "failed to add uc mac addr(%s), ret = %d", - mac_str, ret); -@@ -190,7 +190,7 @@ hns3vf_remove_uc_mac_addr(struct hns3_hw *hw, struct rte_ether_addr *mac_addr) - mac_addr->addr_bytes, RTE_ETHER_ADDR_LEN, - false, NULL, 0); - if (ret) { -- rte_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE, -+ hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE, - mac_addr); - hns3_err(hw, "failed to add uc mac addr(%s), ret = %d", - mac_str, ret); -@@ -210,7 +210,7 @@ hns3vf_add_mc_addr_common(struct hns3_hw *hw, struct rte_ether_addr *mac_addr) - addr = &hw->mc_addrs[i]; - /* Check if there are duplicate addresses */ - if (rte_is_same_ether_addr(addr, mac_addr)) { -- rte_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE, -+ hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE, - addr); - hns3_err(hw, "failed to add mc mac addr, same addrs" - "(%s) is added by the set_mc_mac_addr_list " -@@ -221,7 +221,7 @@ hns3vf_add_mc_addr_common(struct hns3_hw *hw, struct rte_ether_addr *mac_addr) - - ret = hns3vf_add_mc_mac_addr(hw, mac_addr); - if (ret) { -- rte_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE, -+ hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE, - mac_addr); - hns3_err(hw, "failed to add mc mac addr(%s), ret = %d", - mac_str, ret); -@@ -256,7 +256,7 @@ hns3vf_add_mac_addr(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr, - - rte_spinlock_unlock(&hw->lock); - if (ret) { -- rte_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE, -+ hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE, - mac_addr); - hns3_err(hw, "failed to add mac addr(%s), ret = %d", mac_str, - ret); -@@ -283,7 +283,7 @@ hns3vf_remove_mac_addr(struct rte_eth_dev *dev, uint32_t idx) - - rte_spinlock_unlock(&hw->lock); - if (ret) { -- rte_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE, -+ hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE, - mac_addr); - hns3_err(hw, "failed to remove mac addr(%s), ret = %d", - mac_str, ret); -@@ -324,12 +324,12 @@ hns3vf_set_default_mac_addr(struct rte_eth_dev *dev, - * -EPREM to VF driver through mailbox. - */ - if (ret == -EPERM) { -- rte_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE, -+ hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE, - old_addr); - hns3_warn(hw, "Has permanet mac addr(%s) for vf", - mac_str); - } else { -- rte_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE, -+ hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE, - mac_addr); - hns3_err(hw, "Failed to set mac addr(%s) for vf: %d", - mac_str, ret); -@@ -366,7 +366,7 @@ hns3vf_configure_mac_addr(struct hns3_adapter *hns, bool del) - - if (ret) { - err = ret; -- rte_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE, -+ hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE, - addr); - hns3_err(hw, "failed to %s mac addr(%s) index:%d " - "ret = %d.", del ? "remove" : "restore", -@@ -388,7 +388,7 @@ hns3vf_add_mc_mac_addr(struct hns3_hw *hw, - mac_addr->addr_bytes, RTE_ETHER_ADDR_LEN, false, - NULL, 0); - if (ret) { -- rte_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE, -+ hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE, - mac_addr); - hns3_err(hw, "Failed to add mc mac addr(%s) for vf: %d", - mac_str, ret); -@@ -409,7 +409,7 @@ hns3vf_remove_mc_mac_addr(struct hns3_hw *hw, - mac_addr->addr_bytes, RTE_ETHER_ADDR_LEN, false, - NULL, 0); - if (ret) { -- rte_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE, -+ hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE, - mac_addr); - hns3_err(hw, "Failed to remove mc mac addr(%s) for vf: %d", - mac_str, ret); -@@ -439,7 +439,7 @@ hns3vf_set_mc_addr_chk_param(struct hns3_hw *hw, - for (i = 0; i < nb_mc_addr; i++) { - addr = &mc_addr_set[i]; - if (!rte_is_multicast_ether_addr(addr)) { -- rte_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE, -+ hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE, - addr); - hns3_err(hw, - "failed to set mc mac addr, addr(%s) invalid.", -@@ -450,7 +450,7 @@ hns3vf_set_mc_addr_chk_param(struct hns3_hw *hw, - /* Check if there are duplicate addresses */ - for (j = i + 1; j < nb_mc_addr; j++) { - if (rte_is_same_ether_addr(addr, &mc_addr_set[j])) { -- rte_ether_format_addr(mac_str, -+ hns3_ether_format_addr(mac_str, - RTE_ETHER_ADDR_FMT_SIZE, - addr); - hns3_err(hw, "failed to set mc mac addr, " -@@ -467,7 +467,7 @@ hns3vf_set_mc_addr_chk_param(struct hns3_hw *hw, - for (j = 0; j < HNS3_VF_UC_MACADDR_NUM; j++) { - if (rte_is_same_ether_addr(addr, - &hw->data->mac_addrs[j])) { -- rte_ether_format_addr(mac_str, -+ hns3_ether_format_addr(mac_str, - RTE_ETHER_ADDR_FMT_SIZE, - addr); - hns3_err(hw, "failed to set mc mac addr, " -@@ -550,7 +550,7 @@ hns3vf_configure_all_mc_mac_addr(struct hns3_adapter *hns, bool del) - ret = hns3vf_add_mc_mac_addr(hw, addr); - if (ret) { - err = ret; -- rte_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE, -+ hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE, - addr); - hns3_err(hw, "Failed to %s mc mac addr: %s for vf: %d", - del ? "Remove" : "Restore", mac_str, ret); -@@ -2468,7 +2468,7 @@ hns3vf_check_default_mac_change(struct hns3_hw *hw) - ret = rte_is_same_ether_addr(&hw->data->mac_addrs[0], hw_mac); - if (!ret) { - rte_ether_addr_copy(hw_mac, &hw->data->mac_addrs[0]); -- rte_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE, -+ hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE, - &hw->data->mac_addrs[0]); - hns3_warn(hw, "Default MAC address has been changed to:" - " %s by the host PF kernel ethdev driver", --- -2.7.4 - diff --git a/0002-dpdk-add-secure-compile-option-and-fPIC-option.patch b/0002-dpdk-add-secure-compile-option-and-fPIC-option.patch new file mode 100644 index 0000000000000000000000000000000000000000..4afcad19418f75b799642d9c196cfea3758584eb --- /dev/null +++ b/0002-dpdk-add-secure-compile-option-and-fPIC-option.patch @@ -0,0 +1,81 @@ +From a655c865fce412d7e661d866bde0df30607fb6a4 Mon Sep 17 00:00:00 2001 +From: Changsheng Wu +Date: Thu, 16 Dec 2021 20:35:09 +0800 +Subject: [PATCH] huawei-0001-dpdk-add-secure-compile-option-and-fPIC + +--- + app/meson.build | 2 ++ + buildtools/chkincs/meson.build | 2 ++ + drivers/meson.build | 2 ++ + examples/meson.build | 2 ++ + lib/meson.build | 2 ++ + 5 files changed, 10 insertions(+) + +diff --git a/app/meson.build b/app/meson.build +index 93d8c15032..68be53c92d 100644 +--- a/app/meson.build ++++ b/app/meson.build +@@ -21,6 +21,8 @@ apps = [ + ] + + default_cflags = machine_args + ['-DALLOW_EXPERIMENTAL_API'] ++default_cflags += ['-fPIE', '-pie', '-fPIC', '-fstack-protector-strong', '-D_FORTIFY_SOURCE=2', '-O2', '-Wall', '-Werror'] ++default_cflags += ['-Wl,-z,relro,-z,now,-z,noexecstack', '-Wtrampolines'] + default_ldflags = [] + if get_option('default_library') == 'static' and not is_windows + default_ldflags += ['-Wl,--export-dynamic'] +diff --git a/buildtools/chkincs/meson.build b/buildtools/chkincs/meson.build +index 5ffca89761..e3d13a691c 100644 +--- a/buildtools/chkincs/meson.build ++++ b/buildtools/chkincs/meson.build +@@ -13,6 +13,8 @@ gen_c_files = generator(gen_c_file_for_header, + + cflags = machine_args + cflags += '-DALLOW_EXPERIMENTAL_API' ++cflags += ['-fPIE', '-pie', '-fPIC', '-fstack-protector-strong', '-D_FORTIFY_SOURCE=2', '-O2', '-Wall', '-Werror'] ++cflags += ['-Wl,-z,relro,-z,now,-z,noexecstack', '-Wtrampolines'] + + sources = files('main.c') + sources += gen_c_files.process(dpdk_chkinc_headers) +diff --git a/drivers/meson.build b/drivers/meson.build +index d5f4e1c1f2..9e71057afb 100644 +--- a/drivers/meson.build ++++ b/drivers/meson.build +@@ -45,6 +45,8 @@ enable_drivers += always_enable + default_cflags = machine_args + default_cflags += ['-DALLOW_EXPERIMENTAL_API'] + default_cflags += ['-DALLOW_INTERNAL_API'] ++default_cflags += ['-fPIE', '-pie', '-fPIC', '-fstack-protector-strong', '-D_FORTIFY_SOURCE=2', '-O2', '-Wall', '-Werror'] ++default_cflags += ['-Wl,-z,relro,-z,now,-z,noexecstack', '-Wtrampolines'] + + if cc.has_argument('-Wno-format-truncation') + default_cflags += '-Wno-format-truncation' +diff --git a/examples/meson.build b/examples/meson.build +index bac9b76007..db8603542f 100644 +--- a/examples/meson.build ++++ b/examples/meson.build +@@ -90,6 +90,8 @@ default_ldflags = dpdk_extra_ldflags + if get_option('default_library') == 'static' and not is_windows + default_ldflags += ['-Wl,--export-dynamic'] + endif ++default_cflags += ['-fPIE', '-pie', '-fPIC', '-fstack-protector-strong', '-D_FORTIFY_SOURCE=2', '-O2', '-Wall', '-Werror'] ++default_cflags += ['-Wl,-z,relro,-z,now,-z,noexecstack', '-Wtrampolines'] + + foreach example: examples + name = example.split('/')[-1] +diff --git a/lib/meson.build b/lib/meson.build +index 018976df17..668050dcc7 100644 +--- a/lib/meson.build ++++ b/lib/meson.build +@@ -94,6 +94,8 @@ endforeach + default_cflags = machine_args + default_cflags += ['-DALLOW_EXPERIMENTAL_API'] + default_cflags += ['-DALLOW_INTERNAL_API'] ++default_cflags += ['-fPIE', '-pie', '-fPIC', '-fstack-protector-strong', '-D_FORTIFY_SOURCE=2', '-O2', '-Wall', '-Werror'] ++default_cflags += ['-Wl,-z,relro,-z,now,-z,noexecstack', '-Wtrampolines'] + + if cc.has_argument('-Wno-format-truncation') + default_cflags += '-Wno-format-truncation' +-- +2.27.0 + diff --git a/0002-net-hns3-fix-FEC-state-query.patch b/0002-net-hns3-fix-FEC-state-query.patch deleted file mode 100644 index 8c130cecc5b157626777cdaf8ae8976cd7d871ff..0000000000000000000000000000000000000000 --- a/0002-net-hns3-fix-FEC-state-query.patch +++ /dev/null @@ -1,128 +0,0 @@ -From e435d9efcb10bc24f528aacee20a25061a7fb70f Mon Sep 17 00:00:00 2001 -From: "Min Hu (Connor)" -Date: Thu, 10 Dec 2020 20:48:43 +0800 -Subject: [PATCH 002/189] net/hns3: fix FEC state query - -As FEC is not supported below 10 Gbps, -CMD(HNS3_OPC_CONFIG_FEC_MODE) offered from -Firmware read will return fail in 10 Gbps device. - -This patch will prevent read this CMD when below 10 Gbps, -as this is non-sense. - -Fixes: 9bf2ea8dbc65 ("net/hns3: support FEC") -Cc: stable@dpdk.org - -Signed-off-by: Min Hu (Connor) -Signed-off-by: Lijun Ou ---- - drivers/net/hns3/hns3_ethdev.c | 40 ++++++++++++++++++++++++++-------------- - drivers/net/hns3/hns3_ethdev.h | 2 ++ - 2 files changed, 28 insertions(+), 14 deletions(-) - -diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c -index d6d3f03..7c34e38 100644 ---- a/drivers/net/hns3/hns3_ethdev.c -+++ b/drivers/net/hns3/hns3_ethdev.c -@@ -100,7 +100,7 @@ static int hns3_add_mc_addr(struct hns3_hw *hw, - static int hns3_remove_mc_addr(struct hns3_hw *hw, - struct rte_ether_addr *mac_addr); - static int hns3_restore_fec(struct hns3_hw *hw); --static int hns3_query_dev_fec_info(struct rte_eth_dev *dev); -+static int hns3_query_dev_fec_info(struct hns3_hw *hw); - - void hns3_ether_format_addr(char *buf, uint16_t size, - const struct rte_ether_addr *ether_addr) -@@ -3010,13 +3010,6 @@ hns3_get_capability(struct hns3_hw *hw) - device_id == HNS3_DEV_ID_200G_RDMA) - hns3_set_bit(hw->capability, HNS3_DEV_SUPPORT_DCB_B, 1); - -- ret = hns3_query_dev_fec_info(eth_dev); -- if (ret) { -- PMD_INIT_LOG(ERR, -- "failed to query FEC information, ret = %d", ret); -- return ret; -- } -- - /* Get PCI revision id */ - ret = rte_pci_read_config(pci_dev, &revision, HNS3_PCI_REVISION_ID_LEN, - HNS3_PCI_REVISION_ID); -@@ -3148,8 +3141,15 @@ hns3_get_configuration(struct hns3_hw *hw) - } - - ret = hns3_get_board_configuration(hw); -- if (ret) -+ if (ret) { - PMD_INIT_LOG(ERR, "failed to get board configuration: %d", ret); -+ return ret; -+ } -+ -+ ret = hns3_query_dev_fec_info(hw); -+ if (ret) -+ PMD_INIT_LOG(ERR, -+ "failed to query FEC information, ret = %d", ret); - - return ret; - } -@@ -5797,6 +5797,16 @@ get_current_fec_auto_state(struct hns3_hw *hw, uint8_t *state) - struct hns3_cmd_desc desc; - int ret; - -+ /* -+ * CMD(HNS3_OPC_CONFIG_FEC_MODE) read is not supported -+ * in device of link speed -+ * below 10 Gbps. -+ */ -+ if (hw->mac.link_speed < ETH_SPEED_NUM_10G) { -+ *state = 0; -+ return 0; -+ } -+ - hns3_cmd_setup_basic_desc(&desc, HNS3_OPC_CONFIG_FEC_MODE, true); - req = (struct hns3_config_fec_cmd *)desc.data; - ret = hns3_cmd_send(hw, &desc, 1); -@@ -6003,14 +6013,14 @@ hns3_restore_fec(struct hns3_hw *hw) - } - - static int --hns3_query_dev_fec_info(struct rte_eth_dev *dev) -+hns3_query_dev_fec_info(struct hns3_hw *hw) - { -- struct hns3_adapter *hns = dev->data->dev_private; -- struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(hns); -- struct hns3_pf *pf = &hns->pf; -+ struct hns3_adapter *hns = HNS3_DEV_HW_TO_ADAPTER(hw); -+ struct hns3_pf *pf = HNS3_DEV_PRIVATE_TO_PF(hns); -+ struct rte_eth_dev *eth_dev = hns->eth_dev; - int ret; - -- ret = hns3_fec_get(dev, &pf->fec_mode); -+ ret = hns3_fec_get(eth_dev, &pf->fec_mode); - if (ret) - hns3_err(hw, "query device FEC info failed, ret = %d", ret); - -@@ -6096,6 +6106,8 @@ hns3_dev_init(struct rte_eth_dev *eth_dev) - - PMD_INIT_FUNC_TRACE(); - -+ hns->eth_dev = eth_dev; -+ - eth_dev->process_private = (struct hns3_process_private *) - rte_zmalloc_socket("hns3_filter_list", - sizeof(struct hns3_process_private), -diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h -index 31f78a1..8d6b8cd 100644 ---- a/drivers/net/hns3/hns3_ethdev.h -+++ b/drivers/net/hns3/hns3_ethdev.h -@@ -743,6 +743,8 @@ struct hns3_adapter { - struct hns3_vf vf; - }; - -+ struct rte_eth_dev *eth_dev; -+ - bool rx_simple_allowed; - bool rx_vec_allowed; - bool tx_simple_allowed; --- -2.7.4 - diff --git a/0003-dpdk-bugfix-the-deadlock-in-rte_eal_init.patch b/0003-dpdk-bugfix-the-deadlock-in-rte_eal_init.patch new file mode 100644 index 0000000000000000000000000000000000000000..a1e831e2bb55a103039cf8727776f0df90edf28c --- /dev/null +++ b/0003-dpdk-bugfix-the-deadlock-in-rte_eal_init.patch @@ -0,0 +1,70 @@ +From 5134068ace9870203f3e25d9f7b48281582fafbd Mon Sep 17 00:00:00 2001 +From: Changsheng Wu +Date: Fri, 12 Nov 2021 16:17:36 +0800 +Subject: [PATCH] huawei-0003-dpdk-bugfix-the-deadlock-in-rte_eal_init + +--- + lib/eal/linux/eal.c | 14 +++++++++----- + 1 file changed, 9 insertions(+), 5 deletions(-) + +diff --git a/lib/eal/linux/eal.c b/lib/eal/linux/eal.c +index 60b4924838..127b7f7b53 100644 +--- a/lib/eal/linux/eal.c ++++ b/lib/eal/linux/eal.c +@@ -1145,7 +1145,7 @@ rte_eal_init(int argc, char **argv) + rte_eal_init_alert("Cannot get hugepage information."); + rte_errno = EACCES; + __atomic_store_n(&run_once, 0, __ATOMIC_RELAXED); +- return -1; ++ goto out; + } + } + +@@ -1169,7 +1169,7 @@ rte_eal_init(int argc, char **argv) + rte_eal_init_alert("Cannot init logging."); + rte_errno = ENOMEM; + __atomic_store_n(&run_once, 0, __ATOMIC_RELAXED); +- return -1; ++ goto out; + } + + #ifdef VFIO_PRESENT +@@ -1177,7 +1177,7 @@ rte_eal_init(int argc, char **argv) + rte_eal_init_alert("Cannot init VFIO"); + rte_errno = EAGAIN; + __atomic_store_n(&run_once, 0, __ATOMIC_RELAXED); +- return -1; ++ goto out; + } + #endif + /* in secondary processes, memory init may allocate additional fbarrays +@@ -1187,13 +1187,13 @@ rte_eal_init(int argc, char **argv) + if (rte_eal_memzone_init() < 0) { + rte_eal_init_alert("Cannot init memzone"); + rte_errno = ENODEV; +- return -1; ++ goto out; + } + + if (rte_eal_memory_init() < 0) { + rte_eal_init_alert("Cannot init memory"); + rte_errno = ENOMEM; +- return -1; ++ goto out; + } + + /* the directories are locked during eal_hugepage_info_init */ +@@ -1332,6 +1332,10 @@ rte_eal_init(int argc, char **argv) + eal_mcfg_complete(); + + return fctret; ++ ++out: ++ eal_hugedirs_unlock(); ++ return -1; + } + + static int +-- +2.27.0 + diff --git a/0003-net-hns3-fix-build-with-SVE.patch b/0003-net-hns3-fix-build-with-SVE.patch deleted file mode 100644 index 3a28f6527e201fa161cd72dd12dca3703c741dea..0000000000000000000000000000000000000000 --- a/0003-net-hns3-fix-build-with-SVE.patch +++ /dev/null @@ -1,64 +0,0 @@ -From 0114915c86b2cadefe4c0323f28868c4f11be2f2 Mon Sep 17 00:00:00 2001 -From: Ruifeng Wang -Date: Tue, 12 Jan 2021 02:57:05 +0000 -Subject: [PATCH 003/189] net/hns3: fix build with SVE -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Building with SVE extension enabled stopped with error: - - error: ACLE function ‘svwhilelt_b64_s32’ requires ISA extension ‘sve’ - 18 | #define PG64_256BIT svwhilelt_b64(0, 4) - -This is caused by unintentional cflags reset. -Fixed the issue by not touching cflags, and using flags defined by -compiler. - -Fixes: 952ebacce4f2 ("net/hns3: support SVE Rx") -Cc: stable@dpdk.org - -Signed-off-by: Ruifeng Wang -Reviewed-by: Honnappa Nagarahalli ---- - drivers/net/hns3/hns3_rxtx.c | 4 ++-- - drivers/net/hns3/meson.build | 1 - - 2 files changed, 2 insertions(+), 3 deletions(-) - -diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c -index 88d3bab..5ac36b3 100644 ---- a/drivers/net/hns3/hns3_rxtx.c -+++ b/drivers/net/hns3/hns3_rxtx.c -@@ -10,7 +10,7 @@ - #include - #include - #include --#if defined(RTE_ARCH_ARM64) && defined(CC_SVE_SUPPORT) -+#if defined(RTE_ARCH_ARM64) && defined(__ARM_FEATURE_SVE) - #include - #endif - -@@ -2467,7 +2467,7 @@ hns3_rx_burst_mode_get(struct rte_eth_dev *dev, __rte_unused uint16_t queue_id, - static bool - hns3_check_sve_support(void) - { --#if defined(RTE_ARCH_ARM64) && defined(CC_SVE_SUPPORT) -+#if defined(RTE_ARCH_ARM64) && defined(__ARM_FEATURE_SVE) - if (rte_cpu_get_flag_enabled(RTE_CPUFLAG_SVE)) - return true; - #endif -diff --git a/drivers/net/hns3/meson.build b/drivers/net/hns3/meson.build -index 45cee34..5674d98 100644 ---- a/drivers/net/hns3/meson.build -+++ b/drivers/net/hns3/meson.build -@@ -32,7 +32,6 @@ deps += ['hash'] - if arch_subdir == 'arm' and dpdk_conf.get('RTE_ARCH_64') - sources += files('hns3_rxtx_vec.c') - if cc.get_define('__ARM_FEATURE_SVE', args: machine_args) != '' -- cflags = ['-DCC_SVE_SUPPORT'] - sources += files('hns3_rxtx_vec_sve.c') - endif - endif --- -2.7.4 - diff --git a/0004-dpdk-master-core-donot-set-affinity-in-libstorage.patch b/0004-dpdk-master-core-donot-set-affinity-in-libstorage.patch new file mode 100644 index 0000000000000000000000000000000000000000..07b72e022cb6b8657e942a7be176959c7cca9e9e --- /dev/null +++ b/0004-dpdk-master-core-donot-set-affinity-in-libstorage.patch @@ -0,0 +1,27 @@ +From 1d18079dea84bd368605f851738f8f14b917c98d Mon Sep 17 00:00:00 2001 +From: Changsheng Wu +Date: Thu, 16 Dec 2021 15:33:11 +0800 +Subject: [PATCH] huawei-0004-dpdk-master-core-donot-set-affinity-in-libstorage + +--- + lib/eal/linux/eal.c | 4 +++- + 1 file changed, 3 insertions(+), 1 deletion(-) + +diff --git a/lib/eal/linux/eal.c b/lib/eal/linux/eal.c +index 127b7f7b53..47c2186bee 100644 +--- a/lib/eal/linux/eal.c ++++ b/lib/eal/linux/eal.c +@@ -1219,7 +1219,9 @@ rte_eal_init(int argc, char **argv) + + eal_check_mem_on_local_socket(); + +- if (pthread_setaffinity_np(pthread_self(), sizeof(rte_cpuset_t), ++ /* Master thread don't set affinity in LibStorage application */ ++ if (strstr(logid, "LibStorage") != NULL && ++ pthread_setaffinity_np(pthread_self(), sizeof(rte_cpuset_t), + &lcore_config[config->main_lcore].cpuset) != 0) { + rte_eal_init_alert("Cannot set affinity"); + rte_errno = EINVAL; +-- +2.27.0 + diff --git a/0004-net-hns3-fix-interception-with-flow-director.patch b/0004-net-hns3-fix-interception-with-flow-director.patch deleted file mode 100644 index c651c934802e7860963657c427499f26eec9ad84..0000000000000000000000000000000000000000 --- a/0004-net-hns3-fix-interception-with-flow-director.patch +++ /dev/null @@ -1,37 +0,0 @@ -From 7a6944f354740866bc35cf716ce3979999b7396e Mon Sep 17 00:00:00 2001 -From: Lijun Ou -Date: Wed, 6 Jan 2021 11:46:27 +0800 -Subject: [PATCH 004/189] net/hns3: fix interception with flow director - -The rte_fdir_conf structure has deprecated and users need -to use the specified rule parameters of rte_flow structure -when configure a flow rule. As a result, it is incorrectly -used in the rte_flow API. - -Fixes: fcba820d9b9e ("net/hns3: support flow director") -Cc: stable@dpdk.org - -Signed-off-by: Lijun Ou ---- - drivers/net/hns3/hns3_flow.c | 5 ----- - 1 file changed, 5 deletions(-) - -diff --git a/drivers/net/hns3/hns3_flow.c b/drivers/net/hns3/hns3_flow.c -index ee6ec15..f303df4 100644 ---- a/drivers/net/hns3/hns3_flow.c -+++ b/drivers/net/hns3/hns3_flow.c -@@ -1208,11 +1208,6 @@ hns3_parse_fdir_filter(struct rte_eth_dev *dev, - RTE_FLOW_ERROR_TYPE_HANDLE, NULL, - "Fdir not supported in VF"); - -- if (dev->data->dev_conf.fdir_conf.mode != RTE_FDIR_MODE_PERFECT) -- return rte_flow_error_set(error, ENOTSUP, -- RTE_FLOW_ERROR_TYPE_HANDLE, NULL, -- "fdir_conf.mode isn't perfect"); -- - step_mngr.items = first_items; - step_mngr.count = ARRAY_SIZE(first_items); - for (item = pattern; item->type != RTE_FLOW_ITEM_TYPE_END; item++) { --- -2.7.4 - diff --git a/0005-dpdk-change-the-log-level-in-prepare_numa.patch b/0005-dpdk-change-the-log-level-in-prepare_numa.patch new file mode 100644 index 0000000000000000000000000000000000000000..0e26e8ac71e544612ed18c21b66df1b1cbc3c388 --- /dev/null +++ b/0005-dpdk-change-the-log-level-in-prepare_numa.patch @@ -0,0 +1,25 @@ +From e6009977b9ecb1136489b483e312a5e3e09a5497 Mon Sep 17 00:00:00 2001 +From: Changsheng Wu +Date: Fri, 12 Nov 2021 17:04:22 +0800 +Subject: [PATCH] huawei-0005-dpdk-change-the-log-level-in-prepare_numa + +--- + lib/eal/linux/eal_memalloc.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/lib/eal/linux/eal_memalloc.c b/lib/eal/linux/eal_memalloc.c +index 337f2bc739..fc354f4a17 100644 +--- a/lib/eal/linux/eal_memalloc.c ++++ b/lib/eal/linux/eal_memalloc.c +@@ -167,7 +167,7 @@ prepare_numa(int *oldpolicy, struct bitmask *oldmask, int socket_id) + RTE_LOG(DEBUG, EAL, "Trying to obtain current memory policy.\n"); + if (get_mempolicy(oldpolicy, oldmask->maskp, + oldmask->size + 1, 0, 0) < 0) { +- RTE_LOG(ERR, EAL, ++ RTE_LOG(DEBUG, EAL, + "Failed to get current mempolicy: %s. " + "Assuming MPOL_DEFAULT.\n", strerror(errno)); + *oldpolicy = MPOL_DEFAULT; +-- +2.27.0 + diff --git a/0005-net-hns3-fix-xstats-with-id-and-names.patch b/0005-net-hns3-fix-xstats-with-id-and-names.patch deleted file mode 100644 index 311f37f55669218b9b77e9579b25fdfdbd3d122e..0000000000000000000000000000000000000000 --- a/0005-net-hns3-fix-xstats-with-id-and-names.patch +++ /dev/null @@ -1,85 +0,0 @@ -From 094b7303b76507e93d4b8e1eaa7e0c819362b67a Mon Sep 17 00:00:00 2001 -From: Huisong Li -Date: Wed, 6 Jan 2021 11:46:28 +0800 -Subject: [PATCH 005/189] net/hns3: fix xstats with id and names - -Currently, validity check for ids and values in the -hns3_dev_xstats_get_by_id API is incorrect, which will -cause a problem. Namely, if the ID range of the xstats -stats item does not include the basic stats item, the -app can not obtain the corresponding xstats statistics -in hns3_dev_xstats_get_by_id. - -Similarly, the hns3_dev_xstats_get_names_by_id interface -also has a problem. - -Although the input parameter verification code cannot be -executed due to the implementation of the ethdev framework -interface, the driver needs to ensure the correctness of -the input parameters. - -Fixes: 8839c5e202f3 ("net/hns3: support device stats") -Cc: stable@dpdk.org - -Signed-off-by: Huisong Li -Signed-off-by: Lijun Ou ---- - drivers/net/hns3/hns3_stats.c | 24 ++++++++++++++++++++++-- - 1 file changed, 22 insertions(+), 2 deletions(-) - -diff --git a/drivers/net/hns3/hns3_stats.c b/drivers/net/hns3/hns3_stats.c -index 91168ac..1597af3 100644 ---- a/drivers/net/hns3/hns3_stats.c -+++ b/drivers/net/hns3/hns3_stats.c -@@ -933,9 +933,13 @@ hns3_dev_xstats_get_by_id(struct rte_eth_dev *dev, const uint64_t *ids, - uint32_t i; - int ret; - -- if (ids == NULL || size < cnt_stats) -+ if (ids == NULL && values == NULL) - return cnt_stats; - -+ if (ids == NULL) -+ if (size < cnt_stats) -+ return cnt_stats; -+ - /* Update tqp stats by read register */ - ret = hns3_update_tqp_stats(hw); - if (ret) { -@@ -957,6 +961,15 @@ hns3_dev_xstats_get_by_id(struct rte_eth_dev *dev, const uint64_t *ids, - return -EINVAL; - } - -+ if (ids == NULL && values != NULL) { -+ for (i = 0; i < cnt_stats; i++) -+ memcpy(&values[i], &values_copy[i].value, -+ sizeof(values[i])); -+ -+ rte_free(values_copy); -+ return cnt_stats; -+ } -+ - for (i = 0; i < size; i++) { - if (ids[i] >= cnt_stats) { - hns3_err(hw, "ids[%u] (%" PRIx64 ") is invalid, " -@@ -1005,9 +1018,16 @@ hns3_dev_xstats_get_names_by_id(struct rte_eth_dev *dev, - uint64_t len; - uint32_t i; - -- if (ids == NULL || xstats_names == NULL) -+ if (xstats_names == NULL) - return cnt_stats; - -+ if (ids == NULL) { -+ if (size < cnt_stats) -+ return cnt_stats; -+ -+ return hns3_dev_xstats_get_names(dev, xstats_names, cnt_stats); -+ } -+ - len = cnt_stats * sizeof(struct rte_eth_xstat_name); - names_copy = rte_zmalloc("hns3_xstats_names", len, 0); - if (names_copy == NULL) { --- -2.7.4 - diff --git a/0006-dpdk-fix-dpdk-coredump-problem.patch b/0006-dpdk-fix-dpdk-coredump-problem.patch new file mode 100644 index 0000000000000000000000000000000000000000..6f81b85734f696d567a4c286eafc0d22accee512 --- /dev/null +++ b/0006-dpdk-fix-dpdk-coredump-problem.patch @@ -0,0 +1,34 @@ +From a76d953f02beecc057c96159e32e292b847b2d63 Mon Sep 17 00:00:00 2001 +From: Changsheng Wu +Date: Fri, 12 Nov 2021 17:18:23 +0800 +Subject: [PATCH] huawei-0006-dpdk-fix-dpdk-coredump-problem + +--- + lib/eal/linux/eal_interrupts.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/lib/eal/linux/eal_interrupts.c b/lib/eal/linux/eal_interrupts.c +index 6e3925efd4..621e43626e 100644 +--- a/lib/eal/linux/eal_interrupts.c ++++ b/lib/eal/linux/eal_interrupts.c +@@ -1137,7 +1137,7 @@ eal_intr_thread_main(__rte_unused void *arg) + */ + if (epoll_ctl(pfd, EPOLL_CTL_ADD, intr_pipe.readfd, + &pipe_event) < 0) { +- rte_panic("Error adding fd to %d epoll_ctl, %s\n", ++ RTE_LOG(ERR, EAL, "Error adding fd to %d epoll_ctl, %s\n", + intr_pipe.readfd, strerror(errno)); + } + numfds++; +@@ -1159,7 +1159,7 @@ eal_intr_thread_main(__rte_unused void *arg) + */ + if (epoll_ctl(pfd, EPOLL_CTL_ADD, + rte_intr_fd_get(src->intr_handle), &ev) < 0) { +- rte_panic("Error adding fd %d epoll_ctl, %s\n", ++ RTE_LOG(ERR, EAL, "Error adding fd %d epoll_ctl, %s\n", + rte_intr_fd_get(src->intr_handle), + strerror(errno)); + } +-- +2.27.0 + diff --git a/0006-net-hns3-fix-error-code-in-xstats.patch b/0006-net-hns3-fix-error-code-in-xstats.patch deleted file mode 100644 index 0679b9fe978e7fff9173e178ede50884b97a0e35..0000000000000000000000000000000000000000 --- a/0006-net-hns3-fix-error-code-in-xstats.patch +++ /dev/null @@ -1,38 +0,0 @@ -From 8cbd6fc2895cdbb0a64c2d2a31e53ff4b0608752 Mon Sep 17 00:00:00 2001 -From: Huisong Li -Date: Wed, 6 Jan 2021 11:46:29 +0800 -Subject: [PATCH 006/189] net/hns3: fix error code in xstats - -The ethdev API has processed the failure to obtain -xstats statistics. Therefore, driver should return -an error code instead of 0 in 'hns3_dev_xstats_get' -API. - -Fixes: 8839c5e202f3 ("net/hns3: support device stats") -Cc: stable@dpdk.org - -Signed-off-by: Huisong Li -Signed-off-by: Lijun Ou ---- - drivers/net/hns3/hns3_stats.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/drivers/net/hns3/hns3_stats.c b/drivers/net/hns3/hns3_stats.c -index 1597af3..42ec9b8 100644 ---- a/drivers/net/hns3/hns3_stats.c -+++ b/drivers/net/hns3/hns3_stats.c -@@ -739,9 +739,9 @@ hns3_dev_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *xstats, - if (!hns->is_vf) { - /* Update Mac stats */ - ret = hns3_query_update_mac_stats(dev); -- if (ret) { -+ if (ret < 0) { - hns3_err(hw, "Update Mac stats fail : %d", ret); -- return 0; -+ return ret; - } - - /* Get MAC stats from hw->hw_xstats.mac_stats struct */ --- -2.7.4 - diff --git a/0007-dpdk-fix-cpu-flag-error-in-Intel-R-Xeon-R-CPU-E5-262.patch b/0007-dpdk-fix-cpu-flag-error-in-Intel-R-Xeon-R-CPU-E5-262.patch new file mode 100644 index 0000000000000000000000000000000000000000..41c4f5902099746b3384f2a0ea2aeca5d99ef67a --- /dev/null +++ b/0007-dpdk-fix-cpu-flag-error-in-Intel-R-Xeon-R-CPU-E5-262.patch @@ -0,0 +1,28 @@ +From d0f302751a57cea1ee64261c749f59c4026f7af7 Mon Sep 17 00:00:00 2001 +From: Changsheng Wu +Date: Thu, 16 Dec 2021 11:46:58 +0800 +Subject: [PATCH] + huawei-0008-dpdk-fix-cpu-flag-error-in-Intel-R-Xeon-R-CPU-E5-262 + +--- + config/meson.build | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/config/meson.build b/config/meson.build +index 17b5bec406..293703a90d 100644 +--- a/config/meson.build ++++ b/config/meson.build +@@ -121,6 +121,10 @@ if cpu_instruction_set == 'generic' + elif host_machine.cpu_family().startswith('ppc') + cpu_instruction_set = 'power8' + endif ++elif host_machine.cpu_family().startswith('x86') ++ if cc.get_define('__SSE4_2__', args:'-march=native') == '' ++ cpu_instruction_set = 'corei7' ++ endif + endif + + dpdk_conf.set('RTE_MACHINE', cpu_instruction_set) +-- +2.27.0 + diff --git a/0007-net-hns3-fix-Rx-Tx-errors-stats.patch b/0007-net-hns3-fix-Rx-Tx-errors-stats.patch deleted file mode 100644 index 7ff3cf305684a4d50d7f296f1339ddf447dd2020..0000000000000000000000000000000000000000 --- a/0007-net-hns3-fix-Rx-Tx-errors-stats.patch +++ /dev/null @@ -1,119 +0,0 @@ -From d799cf475d2d9b22264cef9c4447e48671e8d76a Mon Sep 17 00:00:00 2001 -From: Huisong Li -Date: Wed, 6 Jan 2021 11:46:30 +0800 -Subject: [PATCH 007/189] net/hns3: fix Rx/Tx errors stats - -Abnormal errors stats in Rx/Tx datapath are statistics -items in driver, and displayed in xstats. They should -be cleared by the rte_eth_xstats_reset api, instead of -the rte_eth_stats_reset. - -Fixes: c4b7d6761d01 ("net/hns3: get Tx abnormal errors in xstats") -Fixes: 521ab3e93361 ("net/hns3: add simple Rx path") -Fixes: bba636698316 ("net/hns3: support Rx/Tx and related operations") -Cc: stable@dpdk.org - -Signed-off-by: Huisong Li -Signed-off-by: Lijun Ou ---- - drivers/net/hns3/hns3_stats.c | 59 ++++++++++++++++++++++++++++--------------- - 1 file changed, 39 insertions(+), 20 deletions(-) - -diff --git a/drivers/net/hns3/hns3_stats.c b/drivers/net/hns3/hns3_stats.c -index 42ec9b8..62a712b 100644 ---- a/drivers/net/hns3/hns3_stats.c -+++ b/drivers/net/hns3/hns3_stats.c -@@ -551,7 +551,6 @@ hns3_stats_reset(struct rte_eth_dev *eth_dev) - struct hns3_hw *hw = &hns->hw; - struct hns3_cmd_desc desc_reset; - struct hns3_rx_queue *rxq; -- struct hns3_tx_queue *txq; - uint16_t i; - int ret; - -@@ -581,29 +580,15 @@ hns3_stats_reset(struct rte_eth_dev *eth_dev) - } - } - -- /* Clear the Rx BD errors stats */ -- for (i = 0; i != eth_dev->data->nb_rx_queues; ++i) { -+ /* -+ * Clear soft stats of rx error packet which will be dropped -+ * in driver. -+ */ -+ for (i = 0; i < eth_dev->data->nb_rx_queues; ++i) { - rxq = eth_dev->data->rx_queues[i]; - if (rxq) { - rxq->pkt_len_errors = 0; - rxq->l2_errors = 0; -- rxq->l3_csum_errors = 0; -- rxq->l4_csum_errors = 0; -- rxq->ol3_csum_errors = 0; -- rxq->ol4_csum_errors = 0; -- } -- } -- -- /* Clear the Tx errors stats */ -- for (i = 0; i != eth_dev->data->nb_tx_queues; ++i) { -- txq = eth_dev->data->tx_queues[i]; -- if (txq) { -- txq->over_length_pkt_cnt = 0; -- txq->exceed_limit_bd_pkt_cnt = 0; -- txq->exceed_limit_bd_reassem_fail = 0; -- txq->unsupported_tunnel_pkt_cnt = 0; -- txq->queue_full_cnt = 0; -- txq->pkt_padding_fail_cnt = 0; - } - } - -@@ -1053,6 +1038,38 @@ hns3_dev_xstats_get_names_by_id(struct rte_eth_dev *dev, - return size; - } - -+static void -+hns3_tqp_dfx_stats_clear(struct rte_eth_dev *dev) -+{ -+ struct hns3_rx_queue *rxq; -+ struct hns3_tx_queue *txq; -+ int i; -+ -+ /* Clear Rx dfx stats */ -+ for (i = 0; i < dev->data->nb_rx_queues; ++i) { -+ rxq = dev->data->rx_queues[i]; -+ if (rxq) { -+ rxq->l3_csum_errors = 0; -+ rxq->l4_csum_errors = 0; -+ rxq->ol3_csum_errors = 0; -+ rxq->ol4_csum_errors = 0; -+ } -+ } -+ -+ /* Clear Tx dfx stats */ -+ for (i = 0; i < dev->data->nb_tx_queues; ++i) { -+ txq = dev->data->tx_queues[i]; -+ if (txq) { -+ txq->over_length_pkt_cnt = 0; -+ txq->exceed_limit_bd_pkt_cnt = 0; -+ txq->exceed_limit_bd_reassem_fail = 0; -+ txq->unsupported_tunnel_pkt_cnt = 0; -+ txq->queue_full_cnt = 0; -+ txq->pkt_padding_fail_cnt = 0; -+ } -+ } -+} -+ - int - hns3_dev_xstats_reset(struct rte_eth_dev *dev) - { -@@ -1068,6 +1085,8 @@ hns3_dev_xstats_reset(struct rte_eth_dev *dev) - /* Clear reset stats */ - memset(&hns->hw.reset.stats, 0, sizeof(struct hns3_reset_stats)); - -+ hns3_tqp_dfx_stats_clear(dev); -+ - if (hns->is_vf) - return 0; - --- -2.7.4 - diff --git a/0008-dpdk-add-support-for-gazelle.patch b/0008-dpdk-add-support-for-gazelle.patch new file mode 100644 index 0000000000000000000000000000000000000000..287b79e6daed028d24ccd01802c49565d2fd37f5 --- /dev/null +++ b/0008-dpdk-add-support-for-gazelle.patch @@ -0,0 +1,2113 @@ +From 359d54d7a384c12e0b4d0514939d082138163905 Mon Sep 17 00:00:00 2001 +From: wuchangsheng +Date: Sat, 25 Dec 2021 15:54:12 +0800 +Subject: [PATCH] 7 + +--- + config/rte_config.h | 3 +- + lib/eal/common/eal_common_config.c | 43 +++++- + lib/eal/common/eal_common_dynmem.c | 67 +++++++- + lib/eal/common/eal_common_fbarray.c | 106 +++++++++++-- + lib/eal/common/eal_common_memory.c | 90 +++++++++-- + lib/eal/common/eal_common_options.c | 179 +++++++++++++--------- + lib/eal/common/eal_filesystem.h | 58 ++++++- + lib/eal/common/eal_internal_cfg.h | 4 +- + lib/eal/common/eal_memalloc.h | 7 + + lib/eal/common/eal_options.h | 11 +- + lib/eal/common/eal_private.h | 27 +++- + lib/eal/include/rte_eal.h | 10 +- + lib/eal/include/rte_fbarray.h | 6 + + lib/eal/include/rte_memory.h | 20 ++- + lib/eal/linux/eal.c | 230 +++++++++++++++++++++++++--- + lib/eal/linux/eal_hugepage_info.c | 2 +- + lib/eal/linux/eal_memalloc.c | 128 +++++++++++++--- + lib/eal/linux/eal_memory.c | 104 ++++++++++--- + lib/ring/rte_ring.h | 75 +++++++++ + 19 files changed, 978 insertions(+), 192 deletions(-) + +diff --git a/config/rte_config.h b/config/rte_config.h +index cab4390a97..d2f192ee9b 100644 +--- a/config/rte_config.h ++++ b/config/rte_config.h +@@ -34,7 +34,8 @@ + #define RTE_MAX_MEM_MB_PER_LIST 32768 + #define RTE_MAX_MEMSEG_PER_TYPE 32768 + #define RTE_MAX_MEM_MB_PER_TYPE 65536 +-#define RTE_MAX_MEMZONE 2560 ++#define RTE_MAX_MEMZONE 65535 ++#define RTE_MAX_SECONDARY 256 + #define RTE_MAX_TAILQ 32 + #define RTE_LOG_DP_LEVEL RTE_LOG_INFO + #define RTE_BACKTRACE 1 +diff --git a/lib/eal/common/eal_common_config.c b/lib/eal/common/eal_common_config.c +index 1c4c4dd585..fe3db184b7 100644 +--- a/lib/eal/common/eal_common_config.c ++++ b/lib/eal/common/eal_common_config.c +@@ -22,18 +22,29 @@ static char runtime_dir[PATH_MAX]; + /* internal configuration */ + static struct internal_config internal_config; + +-const char * ++/****** APIs for libnet ******/ ++static char sec_runtime_dir[RTE_MAX_SECONDARY][PATH_MAX]; ++static struct rte_config sec_rte_config[RTE_MAX_SECONDARY]; ++static struct internal_config sec_internal_config[RTE_MAX_SECONDARY]; ++ ++char * + rte_eal_get_runtime_dir(void) + { + return runtime_dir; + } + +-int +-eal_set_runtime_dir(char *run_dir, size_t size) ++char * ++rte_eal_sec_get_runtime_dir(const int sec_idx) ++{ ++ return sec_runtime_dir[sec_idx]; ++} ++ ++static int ++set_runtime_dir(char *dst_dir, char *src_dir, size_t size) + { + size_t str_size; + +- str_size = strlcpy(runtime_dir, run_dir, size); ++ str_size = strlcpy(dst_dir, src_dir, size); + if (str_size >= size) { + RTE_LOG(ERR, EAL, "Runtime directory string too long\n"); + return -1; +@@ -42,6 +53,18 @@ eal_set_runtime_dir(char *run_dir, size_t size) + return 0; + } + ++int ++eal_sec_set_runtime_dir(char *run_dir, size_t size, const int sec_idx) ++{ ++ return set_runtime_dir(sec_runtime_dir[sec_idx], run_dir, size); ++} ++ ++int ++eal_set_runtime_dir(char *run_dir, size_t size) ++{ ++ return set_runtime_dir(runtime_dir, run_dir, size); ++} ++ + /* Return a pointer to the configuration structure */ + struct rte_config * + rte_eal_get_configuration(void) +@@ -49,6 +72,18 @@ rte_eal_get_configuration(void) + return &rte_config; + } + ++struct rte_config * ++rte_eal_sec_get_configuration(const int sec_idx) ++{ ++ return &sec_rte_config[sec_idx]; ++} ++ ++struct internal_config * ++rte_eal_sec_get_internal_config(const int sec_idx) ++{ ++ return &sec_internal_config[sec_idx]; ++} ++ + /* Return a pointer to the internal configuration structure */ + struct internal_config * + eal_get_internal_configuration(void) +diff --git a/lib/eal/common/eal_common_dynmem.c b/lib/eal/common/eal_common_dynmem.c +index 7c5437ddfa..eff78c14d9 100644 +--- a/lib/eal/common/eal_common_dynmem.c ++++ b/lib/eal/common/eal_common_dynmem.c +@@ -16,6 +16,50 @@ + + /** @file Functions common to EALs that support dynamic memory allocation. */ + ++static int ++eal_sec_set_num_pages(struct internal_config *internal_conf, ++ struct hugepage_info *used_hp) ++{ ++ int ret; ++ int hp_sz_idx; ++ uint64_t memory[RTE_MAX_NUMA_NODES]; ++ ++ if (!internal_conf || !used_hp) { ++ return -1; ++ } ++ ++ for (hp_sz_idx = 0; ++ hp_sz_idx < (int) internal_conf->num_hugepage_sizes; ++ hp_sz_idx++) { ++ struct hugepage_info *hpi; ++ hpi = &internal_conf->hugepage_info[hp_sz_idx]; ++ used_hp[hp_sz_idx].hugepage_sz = hpi->hugepage_sz; ++ } ++ ++ for (hp_sz_idx = 0; hp_sz_idx < RTE_MAX_NUMA_NODES; hp_sz_idx++) ++ memory[hp_sz_idx] = internal_conf->socket_mem[hp_sz_idx]; ++ ++ ret = eal_dynmem_calc_num_pages_per_socket(memory, ++ internal_conf->hugepage_info, used_hp, ++ internal_conf->num_hugepage_sizes); ++ ++ return ret; ++} ++ ++static int ++eal_sec_get_num_pages(const struct hugepage_info *used_hp, ++ uint64_t hugepage_sz, int socket) ++{ ++ int hp_sz_idx; ++ ++ for (hp_sz_idx = 0; hp_sz_idx < MAX_HUGEPAGE_SIZES; hp_sz_idx++) { ++ if (used_hp[hp_sz_idx].hugepage_sz == hugepage_sz) ++ return used_hp[hp_sz_idx].num_pages[socket]; ++ } ++ ++ return 0; ++} ++ + int + eal_dynmem_memseg_lists_init(void) + { +@@ -29,6 +73,7 @@ eal_dynmem_memseg_lists_init(void) + uint64_t max_mem, max_mem_per_type; + unsigned int max_seglists_per_type; + unsigned int n_memtypes, cur_type; ++ struct hugepage_info used_hp[MAX_HUGEPAGE_SIZES]; + struct internal_config *internal_conf = + eal_get_internal_configuration(); + +@@ -36,6 +81,14 @@ eal_dynmem_memseg_lists_init(void) + if (internal_conf->no_hugetlbfs) + return 0; + ++ if (internal_conf->map_perfect) { ++ memset(used_hp, 0, sizeof(used_hp)); ++ ret = eal_sec_set_num_pages(internal_conf, used_hp); ++ if (ret == -1) { ++ RTE_LOG(ERR, EAL, "Cannot get num pages\n"); ++ } ++ } ++ + /* + * figuring out amount of memory we're going to have is a long and very + * involved process. the basic element we're operating with is a memory +@@ -132,6 +185,7 @@ eal_dynmem_memseg_lists_init(void) + struct memtype *type = &memtypes[cur_type]; + uint64_t max_mem_per_list, pagesz; + int socket_id; ++ unsigned int need_n_segs, cur_n_segs; + + pagesz = type->page_sz; + socket_id = type->socket_id; +@@ -175,8 +229,17 @@ eal_dynmem_memseg_lists_init(void) + "n_segs:%i socket_id:%i hugepage_sz:%" PRIu64 "\n", + n_seglists, n_segs, socket_id, pagesz); + ++ if (internal_conf->map_perfect) ++ need_n_segs = eal_sec_get_num_pages(used_hp, pagesz, socket_id); ++ else ++ need_n_segs = n_segs; ++ + /* create all segment lists */ +- for (cur_seglist = 0; cur_seglist < n_seglists; cur_seglist++) { ++ for (cur_seglist = 0; cur_seglist < n_seglists && need_n_segs > 0; cur_seglist++) { ++ cur_n_segs = RTE_MIN(need_n_segs, n_segs); ++ if (internal_conf->map_perfect) ++ need_n_segs -= cur_n_segs; ++ + if (msl_idx >= RTE_MAX_MEMSEG_LISTS) { + RTE_LOG(ERR, EAL, + "No more space in memseg lists, please increase %s\n", +@@ -185,7 +248,7 @@ eal_dynmem_memseg_lists_init(void) + } + msl = &mcfg->memsegs[msl_idx++]; + +- if (eal_memseg_list_init(msl, pagesz, n_segs, ++ if (eal_memseg_list_init(msl, pagesz, cur_n_segs, + socket_id, cur_seglist, true)) + goto out; + +diff --git a/lib/eal/common/eal_common_fbarray.c b/lib/eal/common/eal_common_fbarray.c +index 3a28a53247..9c125c104c 100644 +--- a/lib/eal/common/eal_common_fbarray.c ++++ b/lib/eal/common/eal_common_fbarray.c +@@ -9,6 +9,8 @@ + #include + #include + #include ++#include ++#include + + #include + #include +@@ -830,8 +832,9 @@ rte_fbarray_init(struct rte_fbarray *arr, const char *name, unsigned int len, + return -1; + } + +-int +-rte_fbarray_attach(struct rte_fbarray *arr) ++static int ++__rte_fbarray_attach(struct rte_fbarray *arr, const char *runtime_dir, ++ const struct internal_config *internal_conf) + { + struct mem_area *ma = NULL, *tmp = NULL; + size_t page_sz, mmap_len; +@@ -867,13 +870,15 @@ rte_fbarray_attach(struct rte_fbarray *arr) + + mmap_len = calc_data_size(page_sz, arr->elt_sz, arr->len); + +- /* check the tailq - maybe user has already mapped this address space */ +- rte_spinlock_lock(&mem_area_lock); ++ if (!internal_conf->pri_and_sec) { ++ /* check the tailq - maybe user has already mapped this address space */ ++ rte_spinlock_lock(&mem_area_lock); + +- TAILQ_FOREACH(tmp, &mem_area_tailq, next) { +- if (overlap(tmp, arr->data, mmap_len)) { +- rte_errno = EEXIST; +- goto fail; ++ TAILQ_FOREACH(tmp, &mem_area_tailq, next) { ++ if (overlap(tmp, arr->data, mmap_len)) { ++ rte_errno = EEXIST; ++ goto fail; ++ } + } + } + +@@ -883,7 +888,7 @@ rte_fbarray_attach(struct rte_fbarray *arr) + if (data == NULL) + goto fail; + +- eal_get_fbarray_path(path, sizeof(path), arr->name); ++ eal_sec_get_fbarray_path(path, sizeof(path), arr->name, runtime_dir); + + fd = eal_file_open(path, EAL_OPEN_READWRITE); + if (fd < 0) { +@@ -897,16 +902,27 @@ rte_fbarray_attach(struct rte_fbarray *arr) + if (resize_and_map(fd, path, data, mmap_len)) + goto fail; + ++ if (internal_conf->pri_and_sec) { ++ if (flock(fd, LOCK_UN)) { ++ rte_errno = errno; ++ goto fail; ++ } ++ close(fd); ++ fd = -1; ++ } ++ + /* store our new memory area */ + ma->addr = data; + ma->fd = fd; /* keep fd until detach/destroy */ + ma->len = mmap_len; + +- TAILQ_INSERT_TAIL(&mem_area_tailq, ma, next); ++ if (!internal_conf->pri_and_sec) { ++ TAILQ_INSERT_TAIL(&mem_area_tailq, ma, next); + +- /* we're done */ ++ /* we're done */ + +- rte_spinlock_unlock(&mem_area_lock); ++ rte_spinlock_unlock(&mem_area_lock); ++ } + return 0; + fail: + if (data) +@@ -918,6 +934,31 @@ rte_fbarray_attach(struct rte_fbarray *arr) + return -1; + } + ++int ++rte_fbarray_attach(struct rte_fbarray *arr) ++{ ++ const struct internal_config *internal_conf = eal_get_internal_configuration(); ++ return __rte_fbarray_attach(arr, rte_eal_get_runtime_dir(), internal_conf); ++} ++ ++int ++rte_sec_fbarray_attach(struct rte_fbarray *arr, ++ const int switch_pri_and_sec, const int sec_idx) ++{ ++ struct internal_config *internal_conf = NULL; ++ char *runtime_dir = NULL; ++ ++ if (!switch_pri_and_sec) { ++ runtime_dir = rte_eal_get_runtime_dir(); ++ internal_conf = eal_get_internal_configuration(); ++ } else { ++ runtime_dir = rte_eal_sec_get_runtime_dir(sec_idx); ++ internal_conf = rte_eal_sec_get_internal_config(sec_idx); ++ } ++ ++ return __rte_fbarray_attach(arr, runtime_dir, internal_conf); ++} ++ + int + rte_fbarray_detach(struct rte_fbarray *arr) + { +@@ -1057,6 +1098,47 @@ rte_fbarray_destroy(struct rte_fbarray *arr) + return ret; + } + ++int ++rte_sec_fbarray_destroy(struct rte_fbarray *arr, ++ const int sec_idx) ++{ ++ int fd, ret; ++ char path[PATH_MAX]; ++ ++ if (arr == NULL) { ++ rte_errno = EINVAL; ++ return -1; ++ } ++ ++ size_t page_sz = rte_mem_page_size(); ++ if (page_sz == (size_t)-1) ++ return -1; ++ ++ size_t mmap_len = calc_data_size(page_sz, arr->elt_sz, arr->len); ++ rte_mem_unmap(arr->data, mmap_len); ++ ++ /* try deleting the file */ ++ eal_sec_get_fbarray_path(path, sizeof(path), arr->name, rte_eal_sec_get_runtime_dir(sec_idx)); ++ ++ fd = open(path, O_RDONLY); ++ if (fd < 0) { ++ RTE_LOG(ERR, EAL, "Could not open fbarray file: %s\n", strerror(errno)); ++ return -1; ++ } ++ if (flock(fd, LOCK_EX | LOCK_NB)) { ++ RTE_LOG(DEBUG, EAL, "Cannot destroy fbarray - another process is using it\n"); ++ rte_errno = EBUSY; ++ ret = -1; ++ } else { ++ ret = 0; ++ unlink(path); ++ memset(arr, 0, sizeof(*arr)); ++ } ++ close(fd); ++ ++ return ret; ++} ++ + void * + rte_fbarray_get(const struct rte_fbarray *arr, unsigned int idx) + { +diff --git a/lib/eal/common/eal_common_memory.c b/lib/eal/common/eal_common_memory.c +index 616db5ce31..884996faf2 100644 +--- a/lib/eal/common/eal_common_memory.c ++++ b/lib/eal/common/eal_common_memory.c +@@ -307,9 +307,9 @@ virt2memseg(const void *addr, const struct rte_memseg_list *msl) + } + + static struct rte_memseg_list * +-virt2memseg_list(const void *addr) ++virt2memseg_list(const void *addr, const struct rte_config *rte_cfg) + { +- struct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config; ++ struct rte_mem_config *mcfg = rte_cfg->mem_config; + struct rte_memseg_list *msl; + int msl_idx; + +@@ -331,7 +331,13 @@ virt2memseg_list(const void *addr) + struct rte_memseg_list * + rte_mem_virt2memseg_list(const void *addr) + { +- return virt2memseg_list(addr); ++ return virt2memseg_list(addr, rte_eal_get_configuration()); ++} ++ ++struct rte_memseg_list * ++rte_sec_mem_virt2memseg_list(const void *addr, const struct rte_config *rte_cfg) ++{ ++ return virt2memseg_list(addr, rte_cfg); + } + + struct virtiova { +@@ -386,11 +392,25 @@ rte_mem_iova2virt(rte_iova_t iova) + return vi.virt; + } + ++static struct rte_memseg * ++__rte_mem_virt2memseg(const void *addr, const struct rte_memseg_list *msl, ++ const struct rte_config *rte_cfg) ++{ ++ return virt2memseg(addr, msl != NULL ? msl : ++ rte_sec_mem_virt2memseg_list(addr, rte_cfg)); ++} ++ + struct rte_memseg * + rte_mem_virt2memseg(const void *addr, const struct rte_memseg_list *msl) + { +- return virt2memseg(addr, msl != NULL ? msl : +- rte_mem_virt2memseg_list(addr)); ++ return __rte_mem_virt2memseg(addr, msl, rte_eal_get_configuration()); ++} ++ ++struct rte_memseg * ++rte_sec_mem_virt2memseg(const void *addr, const struct rte_memseg_list *msl, ++ const struct rte_config *rte_cfg) ++{ ++ return __rte_mem_virt2memseg(addr, msl, rte_cfg); + } + + static int +@@ -1069,12 +1089,14 @@ rte_eal_memory_detach(void) + } + + /* init memory subsystem */ +-int +-rte_eal_memory_init(void) ++static int ++__rte_eal_memory_init(__attribute__((__unused__)) const char *runtime_dir, ++ const struct internal_config *internal_conf, ++ struct rte_config *rte_cfg, ++ const int switch_pri_and_sec, ++ const int sec_idx) + { +- struct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config; +- const struct internal_config *internal_conf = +- eal_get_internal_configuration(); ++ struct rte_mem_config *mcfg = rte_cfg->mem_config; + + int retval; + RTE_LOG(DEBUG, EAL, "Setting up physically contiguous memory...\n"); +@@ -1083,17 +1105,18 @@ rte_eal_memory_init(void) + return -1; + + /* lock mem hotplug here, to prevent races while we init */ +- rte_mcfg_mem_read_lock(); ++ rte_rwlock_read_lock(&mcfg->memory_hotplug_lock); + +- if (rte_eal_memseg_init() < 0) ++ if (rte_eal_memseg_init(switch_pri_and_sec, sec_idx) < 0) + goto fail; + +- if (eal_memalloc_init() < 0) +- goto fail; ++ if (!internal_conf->pri_and_sec) ++ if (eal_memalloc_init() < 0) ++ goto fail; + +- retval = rte_eal_process_type() == RTE_PROC_PRIMARY ? ++ retval = rte_cfg->process_type == RTE_PROC_PRIMARY ? + rte_eal_hugepage_init() : +- rte_eal_hugepage_attach(); ++ rte_eal_hugepage_attach(switch_pri_and_sec, sec_idx); + if (retval < 0) + goto fail; + +@@ -1102,10 +1125,43 @@ rte_eal_memory_init(void) + + return 0; + fail: +- rte_mcfg_mem_read_unlock(); ++ rte_rwlock_read_unlock(&mcfg->memory_hotplug_lock); + return -1; + } + ++int ++rte_eal_memory_init(void) ++{ ++ const int unused_idx = -1; ++ const struct internal_config *internal_conf = ++ eal_get_internal_configuration(); ++ ++ return __rte_eal_memory_init(rte_eal_get_runtime_dir(), ++ internal_conf, rte_eal_get_configuration(), ++ false, unused_idx); ++} ++ ++int ++rte_eal_sec_memory_init(const int sec_idx) ++{ ++ int ret; ++ struct rte_config *rte_cfg = rte_eal_sec_get_configuration(sec_idx); ++ ++ ret = __rte_eal_memory_init(rte_eal_sec_get_runtime_dir(sec_idx), ++ rte_eal_sec_get_internal_config(sec_idx), rte_cfg, ++ true, sec_idx); ++ ++ rte_rwlock_read_unlock(&rte_cfg->mem_config->memory_hotplug_lock); ++ ++ return ret; ++} ++ ++int ++rte_eal_sec_memory_cleanup(const int sec_idx) ++{ ++ return eal_sec_memalloc_destroy(sec_idx); ++} ++ + #ifndef RTE_EXEC_ENV_WINDOWS + #define EAL_MEMZONE_LIST_REQ "/eal/memzone_list" + #define EAL_MEMZONE_INFO_REQ "/eal/memzone_info" +diff --git a/lib/eal/common/eal_common_options.c b/lib/eal/common/eal_common_options.c +index 1cfdd75f3b..ba3b19ee6e 100644 +--- a/lib/eal/common/eal_common_options.c ++++ b/lib/eal/common/eal_common_options.c +@@ -105,6 +105,7 @@ eal_long_options[] = { + {OPT_TELEMETRY, 0, NULL, OPT_TELEMETRY_NUM }, + {OPT_NO_TELEMETRY, 0, NULL, OPT_NO_TELEMETRY_NUM }, + {OPT_FORCE_MAX_SIMD_BITWIDTH, 1, NULL, OPT_FORCE_MAX_SIMD_BITWIDTH_NUM}, ++ {OPT_MAP_PERFECT, 0, NULL, OPT_MAP_PERFECT_NUM }, + + {0, 0, NULL, 0 } + }; +@@ -301,54 +302,66 @@ eal_get_hugefile_prefix(void) + return HUGEFILE_PREFIX_DEFAULT; + } + ++const char * ++eal_sec_get_hugefile_prefix(const int sec_idx) ++{ ++ struct internal_config *internal_conf = ++ rte_eal_sec_get_internal_config(sec_idx); ++ ++ if (internal_conf->hugefile_prefix != NULL) ++ return internal_conf->hugefile_prefix; ++ return HUGEFILE_PREFIX_DEFAULT; ++} ++ + void +-eal_reset_internal_config(struct internal_config *internal_cfg) ++eal_reset_internal_config(struct internal_config *internal_conf) + { + int i; + +- internal_cfg->memory = 0; +- internal_cfg->force_nrank = 0; +- internal_cfg->force_nchannel = 0; +- internal_cfg->hugefile_prefix = NULL; +- internal_cfg->hugepage_dir = NULL; +- internal_cfg->force_sockets = 0; ++ internal_conf->memory = 0; ++ internal_conf->force_nrank = 0; ++ internal_conf->force_nchannel = 0; ++ internal_conf->hugefile_prefix = NULL; ++ internal_conf->hugepage_dir = NULL; ++ internal_conf->force_sockets = 0; + /* zero out the NUMA config */ + for (i = 0; i < RTE_MAX_NUMA_NODES; i++) +- internal_cfg->socket_mem[i] = 0; +- internal_cfg->force_socket_limits = 0; ++ internal_conf->socket_mem[i] = 0; ++ internal_conf->force_socket_limits = 0; + /* zero out the NUMA limits config */ + for (i = 0; i < RTE_MAX_NUMA_NODES; i++) +- internal_cfg->socket_limit[i] = 0; ++ internal_conf->socket_limit[i] = 0; + /* zero out hugedir descriptors */ + for (i = 0; i < MAX_HUGEPAGE_SIZES; i++) { +- memset(&internal_cfg->hugepage_info[i], 0, +- sizeof(internal_cfg->hugepage_info[0])); +- internal_cfg->hugepage_info[i].lock_descriptor = -1; ++ memset(&internal_conf->hugepage_info[i], 0, ++ sizeof(internal_conf->hugepage_info[0])); ++ internal_conf->hugepage_info[i].lock_descriptor = -1; + } +- internal_cfg->base_virtaddr = 0; ++ internal_conf->base_virtaddr = 0; + + #ifdef LOG_DAEMON +- internal_cfg->syslog_facility = LOG_DAEMON; ++ internal_conf->syslog_facility = LOG_DAEMON; + #endif + + /* if set to NONE, interrupt mode is determined automatically */ +- internal_cfg->vfio_intr_mode = RTE_INTR_MODE_NONE; +- memset(internal_cfg->vfio_vf_token, 0, +- sizeof(internal_cfg->vfio_vf_token)); ++ internal_conf->vfio_intr_mode = RTE_INTR_MODE_NONE; ++ memset(internal_conf->vfio_vf_token, 0, ++ sizeof(internal_conf->vfio_vf_token)); + + #ifdef RTE_LIBEAL_USE_HPET +- internal_cfg->no_hpet = 0; ++ internal_conf->no_hpet = 0; + #else +- internal_cfg->no_hpet = 1; ++ internal_conf->no_hpet = 1; + #endif +- internal_cfg->vmware_tsc_map = 0; +- internal_cfg->create_uio_dev = 0; +- internal_cfg->iova_mode = RTE_IOVA_DC; +- internal_cfg->user_mbuf_pool_ops_name = NULL; +- CPU_ZERO(&internal_cfg->ctrl_cpuset); +- internal_cfg->init_complete = 0; +- internal_cfg->max_simd_bitwidth.bitwidth = RTE_VECT_DEFAULT_SIMD_BITWIDTH; +- internal_cfg->max_simd_bitwidth.forced = 0; ++ internal_conf->vmware_tsc_map = 0; ++ internal_conf->create_uio_dev = 0; ++ internal_conf->iova_mode = RTE_IOVA_DC; ++ internal_conf->user_mbuf_pool_ops_name = NULL; ++ CPU_ZERO(&internal_conf->ctrl_cpuset); ++ internal_conf->init_complete = 0; ++ internal_conf->map_perfect = 0; ++ internal_conf->max_simd_bitwidth.bitwidth = RTE_VECT_DEFAULT_SIMD_BITWIDTH; ++ internal_conf->max_simd_bitwidth.forced = 0; + } + + static int +@@ -1496,12 +1509,10 @@ eal_parse_simd_bitwidth(const char *arg) + } + + static int +-eal_parse_base_virtaddr(const char *arg) ++eal_parse_base_virtaddr(const char *arg, struct internal_config *conf) + { + char *end; + uint64_t addr; +- struct internal_config *internal_conf = +- eal_get_internal_configuration(); + + errno = 0; + addr = strtoull(arg, &end, 16); +@@ -1521,7 +1532,7 @@ eal_parse_base_virtaddr(const char *arg) + * it can align to 2MB for x86. So this alignment can also be used + * on x86 and other architectures. + */ +- internal_conf->base_virtaddr = ++ conf->base_virtaddr = + RTE_PTR_ALIGN_CEIL((uintptr_t)addr, (size_t)RTE_PGSIZE_16M); + + return 0; +@@ -1877,7 +1888,7 @@ eal_parse_common_option(int opt, const char *optarg, + } + break; + case OPT_BASE_VIRTADDR_NUM: +- if (eal_parse_base_virtaddr(optarg) < 0) { ++ if (eal_parse_base_virtaddr(optarg, conf) < 0) { + RTE_LOG(ERR, EAL, "invalid parameter for --" + OPT_BASE_VIRTADDR "\n"); + return -1; +@@ -1933,9 +1944,9 @@ eal_auto_detect_cores(struct rte_config *cfg) + } + + static void +-compute_ctrl_threads_cpuset(struct internal_config *internal_cfg) ++compute_ctrl_threads_cpuset(struct internal_config *internal_conf) + { +- rte_cpuset_t *cpuset = &internal_cfg->ctrl_cpuset; ++ rte_cpuset_t *cpuset = &internal_conf->ctrl_cpuset; + rte_cpuset_t default_set; + unsigned int lcore_id; + +@@ -1960,25 +1971,23 @@ compute_ctrl_threads_cpuset(struct internal_config *internal_cfg) + } + + int +-eal_cleanup_config(struct internal_config *internal_cfg) ++eal_cleanup_config(struct internal_config *internal_conf) + { +- if (internal_cfg->hugefile_prefix != NULL) +- free(internal_cfg->hugefile_prefix); +- if (internal_cfg->hugepage_dir != NULL) +- free(internal_cfg->hugepage_dir); +- if (internal_cfg->user_mbuf_pool_ops_name != NULL) +- free(internal_cfg->user_mbuf_pool_ops_name); ++ if (internal_conf->hugefile_prefix != NULL) ++ free(internal_conf->hugefile_prefix); ++ if (internal_conf->hugepage_dir != NULL) ++ free(internal_conf->hugepage_dir); ++ if (internal_conf->user_mbuf_pool_ops_name != NULL) ++ free(internal_conf->user_mbuf_pool_ops_name); + + return 0; + } + + int +-eal_adjust_config(struct internal_config *internal_cfg) ++eal_adjust_config(struct internal_config *internal_conf) + { + int i; + struct rte_config *cfg = rte_eal_get_configuration(); +- struct internal_config *internal_conf = +- eal_get_internal_configuration(); + + if (!core_parsed) + eal_auto_detect_cores(cfg); +@@ -1994,44 +2003,64 @@ eal_adjust_config(struct internal_config *internal_cfg) + lcore_config[cfg->main_lcore].core_role = ROLE_RTE; + } + +- compute_ctrl_threads_cpuset(internal_cfg); ++ compute_ctrl_threads_cpuset(internal_conf); + + /* if no memory amounts were requested, this will result in 0 and + * will be overridden later, right after eal_hugepage_info_init() */ + for (i = 0; i < RTE_MAX_NUMA_NODES; i++) +- internal_cfg->memory += internal_cfg->socket_mem[i]; ++ internal_conf->memory += internal_conf->socket_mem[i]; + + return 0; + } + + int +-eal_check_common_options(struct internal_config *internal_cfg) ++eal_sec_adjust_config(struct internal_config *internal_conf) + { +- struct rte_config *cfg = rte_eal_get_configuration(); +- const struct internal_config *internal_conf = +- eal_get_internal_configuration(); ++ struct internal_config *internal_conf_head; ++ internal_conf->process_type = RTE_PROC_SECONDARY; ++ ++ internal_conf_head = rte_eal_sec_get_internal_config(0); ++ for (int i = 0; i < RTE_MAX_SECONDARY; ++i) { ++ if (!internal_conf_head[i].pri_and_sec) ++ continue; ++ if (internal_conf == &internal_conf_head[i]) ++ continue; ++ if (!strcmp(internal_conf_head[i].hugefile_prefix, internal_conf->hugefile_prefix)) ++ return -EALREADY; ++ } ++ ++ for (int i = 0; i < RTE_MAX_NUMA_NODES; i++) ++ internal_conf->memory += internal_conf->socket_mem[i]; + +- if (cfg->lcore_role[cfg->main_lcore] != ROLE_RTE) { ++ return 0; ++} ++ ++int ++eal_check_common_options(struct internal_config *internal_conf, ++ struct rte_config *cfg) ++{ ++ if (!internal_conf->pri_and_sec && ++ cfg->lcore_role[cfg->main_lcore] != ROLE_RTE) { + RTE_LOG(ERR, EAL, "Main lcore is not enabled for DPDK\n"); + return -1; + } + +- if (internal_cfg->process_type == RTE_PROC_INVALID) { ++ if (internal_conf->process_type == RTE_PROC_INVALID) { + RTE_LOG(ERR, EAL, "Invalid process type specified\n"); + return -1; + } +- if (internal_cfg->hugefile_prefix != NULL && +- strlen(internal_cfg->hugefile_prefix) < 1) { ++ if (internal_conf->hugefile_prefix != NULL && ++ strlen(internal_conf->hugefile_prefix) < 1) { + RTE_LOG(ERR, EAL, "Invalid length of --" OPT_FILE_PREFIX " option\n"); + return -1; + } +- if (internal_cfg->hugepage_dir != NULL && +- strlen(internal_cfg->hugepage_dir) < 1) { ++ if (internal_conf->hugepage_dir != NULL && ++ strlen(internal_conf->hugepage_dir) < 1) { + RTE_LOG(ERR, EAL, "Invalid length of --" OPT_HUGE_DIR" option\n"); + return -1; + } +- if (internal_cfg->user_mbuf_pool_ops_name != NULL && +- strlen(internal_cfg->user_mbuf_pool_ops_name) < 1) { ++ if (internal_conf->user_mbuf_pool_ops_name != NULL && ++ strlen(internal_conf->user_mbuf_pool_ops_name) < 1) { + RTE_LOG(ERR, EAL, "Invalid length of --" OPT_MBUF_POOL_OPS_NAME" option\n"); + return -1; + } +@@ -2040,18 +2069,18 @@ eal_check_common_options(struct internal_config *internal_cfg) + "option\n"); + return -1; + } +- if (mem_parsed && internal_cfg->force_sockets == 1) { ++ if (mem_parsed && internal_conf->force_sockets == 1) { + RTE_LOG(ERR, EAL, "Options -m and --"OPT_SOCKET_MEM" cannot " + "be specified at the same time\n"); + return -1; + } +- if (internal_cfg->no_hugetlbfs && internal_cfg->force_sockets == 1) { ++ if (internal_conf->no_hugetlbfs && internal_conf->force_sockets == 1) { + RTE_LOG(ERR, EAL, "Option --"OPT_SOCKET_MEM" cannot " + "be specified together with --"OPT_NO_HUGE"\n"); + return -1; + } +- if (internal_cfg->no_hugetlbfs && internal_cfg->hugepage_unlink && +- !internal_cfg->in_memory) { ++ if (internal_conf->no_hugetlbfs && internal_conf->hugepage_unlink && ++ !internal_conf->in_memory) { + RTE_LOG(ERR, EAL, "Option --"OPT_HUGE_UNLINK" cannot " + "be specified together with --"OPT_NO_HUGE"\n"); + return -1; +@@ -2060,35 +2089,43 @@ eal_check_common_options(struct internal_config *internal_cfg) + RTE_LOG(ERR, EAL, "Option --"OPT_SOCKET_LIMIT + " is only supported in non-legacy memory mode\n"); + } +- if (internal_cfg->single_file_segments && +- internal_cfg->hugepage_unlink && +- !internal_cfg->in_memory) { ++ if (internal_conf->single_file_segments && ++ internal_conf->hugepage_unlink && ++ !internal_conf->in_memory) { + RTE_LOG(ERR, EAL, "Option --"OPT_SINGLE_FILE_SEGMENTS" is " + "not compatible with --"OPT_HUGE_UNLINK"\n"); + return -1; + } +- if (internal_cfg->legacy_mem && +- internal_cfg->in_memory) { ++ if (internal_conf->legacy_mem && ++ internal_conf->in_memory) { + RTE_LOG(ERR, EAL, "Option --"OPT_LEGACY_MEM" is not compatible " + "with --"OPT_IN_MEMORY"\n"); + return -1; + } +- if (internal_cfg->legacy_mem && internal_cfg->match_allocations) { ++ if (internal_conf->legacy_mem && internal_conf->match_allocations) { + RTE_LOG(ERR, EAL, "Option --"OPT_LEGACY_MEM" is not compatible " + "with --"OPT_MATCH_ALLOCATIONS"\n"); + return -1; + } +- if (internal_cfg->no_hugetlbfs && internal_cfg->match_allocations) { ++ if (internal_conf->no_hugetlbfs && internal_conf->match_allocations) { + RTE_LOG(ERR, EAL, "Option --"OPT_NO_HUGE" is not compatible " + "with --"OPT_MATCH_ALLOCATIONS"\n"); + return -1; + } +- if (internal_cfg->legacy_mem && internal_cfg->memory == 0) { ++ if (internal_conf->legacy_mem && internal_conf->memory == 0) { + RTE_LOG(NOTICE, EAL, "Static memory layout is selected, " + "amount of reserved memory can be adjusted with " + "-m or --"OPT_SOCKET_MEM"\n"); + } + ++ if (internal_conf->map_perfect || internal_conf->pri_and_sec) { ++ if (!internal_conf->legacy_mem || internal_conf->in_memory || internal_conf->no_hugetlbfs) { ++ RTE_LOG(ERR, EAL, "Option --"OPT_LEGACY_MEM" or "OPT_IN_MEMORY" or "OPT_NO_HUGE" " ++ "is not compatible with --"OPT_MAP_PERFECT" and "OPT_PRI_AND_SEC"\n"); ++ return -1; ++ } ++ } ++ + return 0; + } + +diff --git a/lib/eal/common/eal_filesystem.h b/lib/eal/common/eal_filesystem.h +index 5d21f07c20..719678772f 100644 +--- a/lib/eal/common/eal_filesystem.h ++++ b/lib/eal/common/eal_filesystem.h +@@ -23,7 +23,7 @@ + + /* sets up platform-specific runtime data dir */ + int +-eal_create_runtime_dir(void); ++eal_create_runtime_dir(const int sec_idx); + + int + eal_clean_runtime_dir(void); +@@ -32,17 +32,32 @@ eal_clean_runtime_dir(void); + const char * + eal_get_hugefile_prefix(void); + ++const char * ++eal_sec_get_hugefile_prefix(const int sec_idx); ++ + #define RUNTIME_CONFIG_FNAME "config" + static inline const char * +-eal_runtime_config_path(void) ++__eal_runtime_config_path(const char *runtime_dir) + { + static char buffer[PATH_MAX]; /* static so auto-zeroed */ + +- snprintf(buffer, sizeof(buffer), "%s/%s", rte_eal_get_runtime_dir(), ++ snprintf(buffer, sizeof(buffer), "%s/%s", runtime_dir, + RUNTIME_CONFIG_FNAME); + return buffer; + } + ++static inline const char * ++eal_runtime_config_path(void) ++{ ++ return __eal_runtime_config_path(rte_eal_get_runtime_dir()); ++} ++ ++static inline const char * ++eal_sec_runtime_config_path(const char *runtime_dir) ++{ ++ return __eal_runtime_config_path(runtime_dir); ++} ++ + /** Path of primary/secondary communication unix socket file. */ + #define MP_SOCKET_FNAME "mp_socket" + static inline const char * +@@ -57,12 +72,29 @@ eal_mp_socket_path(void) + + #define FBARRAY_NAME_FMT "%s/fbarray_%s" + static inline const char * +-eal_get_fbarray_path(char *buffer, size_t buflen, const char *name) { +- snprintf(buffer, buflen, FBARRAY_NAME_FMT, rte_eal_get_runtime_dir(), ++__eal_get_fbarray_path(char *buffer, size_t buflen, const char *name, ++ const char *runtime_dir) ++{ ++ snprintf(buffer, buflen, FBARRAY_NAME_FMT, runtime_dir, + name); + return buffer; + } + ++static inline const char * ++eal_get_fbarray_path(char *buffer, size_t buflen, const char *name) ++{ ++ return __eal_get_fbarray_path(buffer, buflen, name, ++ rte_eal_get_runtime_dir()); ++} ++ ++static inline const char * ++eal_sec_get_fbarray_path(char *buffer, size_t buflen, ++ const char *name, const char *runtime_dir) ++{ ++ return __eal_get_fbarray_path(buffer, buflen, name, ++ runtime_dir); ++} ++ + /** Path of hugepage info file. */ + #define HUGEPAGE_INFO_FNAME "hugepage_info" + static inline const char * +@@ -78,15 +110,27 @@ eal_hugepage_info_path(void) + /** Path of hugepage data file. */ + #define HUGEPAGE_DATA_FNAME "hugepage_data" + static inline const char * +-eal_hugepage_data_path(void) ++__eal_hugepage_data_path(const char *runtime_dir) + { + static char buffer[PATH_MAX]; /* static so auto-zeroed */ + +- snprintf(buffer, sizeof(buffer), "%s/%s", rte_eal_get_runtime_dir(), ++ snprintf(buffer, sizeof(buffer), "%s/%s", runtime_dir, + HUGEPAGE_DATA_FNAME); + return buffer; + } + ++static inline const char * ++eal_hugepage_data_path(void) ++{ ++ return __eal_hugepage_data_path(rte_eal_get_runtime_dir()); ++} ++ ++static inline const char * ++eal_sec_hugepage_data_path(const char *runtime_dir) ++{ ++ return __eal_hugepage_data_path(runtime_dir); ++} ++ + /** String format for hugepage map files. */ + #define HUGEFILE_FMT "%s/%smap_%d" + static inline const char * +diff --git a/lib/eal/common/eal_internal_cfg.h b/lib/eal/common/eal_internal_cfg.h +index d6c0470eb8..8c326f2f87 100644 +--- a/lib/eal/common/eal_internal_cfg.h ++++ b/lib/eal/common/eal_internal_cfg.h +@@ -94,8 +94,10 @@ struct internal_config { + unsigned int no_telemetry; /**< true to disable Telemetry */ + struct simd_bitwidth max_simd_bitwidth; + /**< max simd bitwidth path to use */ ++ volatile unsigned pri_and_sec; ++ volatile unsigned map_perfect; + }; + +-void eal_reset_internal_config(struct internal_config *internal_cfg); ++void eal_reset_internal_config(struct internal_config *internal_conf); + + #endif /* EAL_INTERNAL_CFG_H */ +diff --git a/lib/eal/common/eal_memalloc.h b/lib/eal/common/eal_memalloc.h +index ebc3a6f6c1..19ccee7891 100644 +--- a/lib/eal/common/eal_memalloc.h ++++ b/lib/eal/common/eal_memalloc.h +@@ -83,6 +83,10 @@ eal_memalloc_get_seg_fd(int list_idx, int seg_idx); + int + eal_memalloc_set_seg_fd(int list_idx, int seg_idx, int fd); + ++int ++eal_sec_memalloc_set_seg_fd(int list_idx, int seg_idx, int fd, ++ const int switch_pri_and_sec, const int sec_idx); ++ + /* returns 0 or -errno */ + int + eal_memalloc_set_seg_list_fd(int list_idx, int fd); +@@ -96,4 +100,7 @@ eal_memalloc_init(void); + int + eal_memalloc_cleanup(void); + ++int ++eal_sec_memalloc_destroy(const int sec_idx); ++ + #endif /* EAL_MEMALLOC_H */ +diff --git a/lib/eal/common/eal_options.h b/lib/eal/common/eal_options.h +index 8e4f7202a2..95625c4002 100644 +--- a/lib/eal/common/eal_options.h ++++ b/lib/eal/common/eal_options.h +@@ -87,6 +87,10 @@ enum { + OPT_NO_TELEMETRY_NUM, + #define OPT_FORCE_MAX_SIMD_BITWIDTH "force-max-simd-bitwidth" + OPT_FORCE_MAX_SIMD_BITWIDTH_NUM, ++#define OPT_PRI_AND_SEC "pri-and-sec" ++ OPT_PRI_AND_SEC_NUM, ++#define OPT_MAP_PERFECT "map-perfect" ++ OPT_MAP_PERFECT_NUM, + + OPT_LONG_MAX_NUM + }; +@@ -97,9 +101,10 @@ extern const struct option eal_long_options[]; + int eal_parse_common_option(int opt, const char *argv, + struct internal_config *conf); + int eal_option_device_parse(void); +-int eal_adjust_config(struct internal_config *internal_cfg); +-int eal_cleanup_config(struct internal_config *internal_cfg); +-int eal_check_common_options(struct internal_config *internal_cfg); ++int eal_adjust_config(struct internal_config *internal_conf); ++int eal_sec_adjust_config(struct internal_config *internal_conf); ++int eal_cleanup_config(struct internal_config *internal_conf); ++int eal_check_common_options(struct internal_config *internal_conf, struct rte_config *cfg); + void eal_common_usage(void); + enum rte_proc_type_t eal_proc_type_detect(void); + int eal_plugins_init(void); +diff --git a/lib/eal/common/eal_private.h b/lib/eal/common/eal_private.h +index 36bcc0b5a4..ac8af18773 100644 +--- a/lib/eal/common/eal_private.h ++++ b/lib/eal/common/eal_private.h +@@ -103,7 +103,8 @@ int rte_eal_cpu_init(void); + * @return + * 0 on success, negative on error + */ +-int rte_eal_memseg_init(void); ++//int rte_eal_memseg_init(void); ++int rte_eal_memseg_init(const int switch_pri_and_sec, const int sec_idx); + + /** + * Map memory +@@ -117,6 +118,9 @@ int rte_eal_memseg_init(void); + */ + int rte_eal_memory_init(void); + ++int rte_eal_sec_memory_init(const int sec_idx); ++int rte_eal_sec_memory_cleanup(const int sec_idx); ++ + /** + * Configure timers + * +@@ -413,7 +417,8 @@ int rte_eal_hugepage_init(void); + * + * This function is private to the EAL. + */ +-int rte_eal_hugepage_attach(void); ++//int rte_eal_hugepage_attach(void); ++int rte_eal_hugepage_attach(const int switch_pri_and_sec, const int sec_idx); + + /** + * Detaches all memory mappings from a process. +@@ -689,6 +694,9 @@ eal_mem_set_dump(void *virt, size_t size, bool dump); + int + eal_set_runtime_dir(char *run_dir, size_t size); + ++int ++eal_sec_set_runtime_dir(char *run_dir, size_t size, const int sec_idx); ++ + /** + * Get the internal configuration structure. + * +@@ -738,4 +746,19 @@ int eal_asprintf(char **buffer, const char *format, ...); + eal_asprintf(buffer, format, ##__VA_ARGS__) + #endif + ++ ++/****** APIs for libnet ******/ ++#include ++ ++struct rte_memseg * ++rte_sec_mem_virt2memseg(const void *addr, const struct rte_memseg_list *msl, ++ const struct rte_config *rte_cfg); ++ ++struct rte_memseg_list * ++rte_sec_mem_virt2memseg_list(const void *addr, const struct rte_config *rte_cfg); ++ ++int ++rte_sec_memseg_list_walk_thread_unsafe(rte_memseg_list_walk_t func, void *arg, ++ struct rte_config *rte_cfg); ++ + #endif /* _EAL_PRIVATE_H_ */ +diff --git a/lib/eal/include/rte_eal.h b/lib/eal/include/rte_eal.h +index 5a34a6acd9..c3259a4af3 100644 +--- a/lib/eal/include/rte_eal.h ++++ b/lib/eal/include/rte_eal.h +@@ -472,9 +472,17 @@ rte_eal_mbuf_user_pool_ops(void); + * @return + * The runtime directory path of DPDK + */ +-const char * ++char * + rte_eal_get_runtime_dir(void); + ++/****** APIs for libnet ******/ ++char *rte_eal_sec_get_runtime_dir(const int sec_idx); ++struct rte_config *rte_eal_sec_get_configuration(const int sec_idx); ++struct internal_config *rte_eal_sec_get_internal_config(const int sec_idx); ++ ++int rte_eal_sec_attach(int argc, char **argv); ++int rte_eal_sec_detach(const char *file_prefix, int length); ++ + #ifdef __cplusplus + } + #endif +diff --git a/lib/eal/include/rte_fbarray.h b/lib/eal/include/rte_fbarray.h +index c64868711e..e35a0cc0b4 100644 +--- a/lib/eal/include/rte_fbarray.h ++++ b/lib/eal/include/rte_fbarray.h +@@ -99,6 +99,10 @@ rte_fbarray_init(struct rte_fbarray *arr, const char *name, unsigned int len, + int + rte_fbarray_attach(struct rte_fbarray *arr); + ++int ++rte_sec_fbarray_attach(struct rte_fbarray *arr, ++ const int switch_pri_and_sec, const int sec_idx); ++ + + /** + * Deallocate resources for an already allocated and correctly set up +@@ -120,6 +124,8 @@ rte_fbarray_attach(struct rte_fbarray *arr); + int + rte_fbarray_destroy(struct rte_fbarray *arr); + ++int ++rte_sec_fbarray_destroy(struct rte_fbarray *arr, const int sec_idx); + + /** + * Deallocate resources for an already allocated and correctly set up +diff --git a/lib/eal/include/rte_memory.h b/lib/eal/include/rte_memory.h +index 6d018629ae..bf4c6098e3 100644 +--- a/lib/eal/include/rte_memory.h ++++ b/lib/eal/include/rte_memory.h +@@ -143,7 +143,12 @@ rte_mem_iova2virt(rte_iova_t iova); + */ + struct rte_memseg * + rte_mem_virt2memseg(const void *virt, const struct rte_memseg_list *msl); +- ++/* ++__rte_experimental ++struct rte_memseg * ++rte_sec_mem_virt2memseg(const void *addr, const struct rte_memseg_list *msl, ++ const struct rte_config *rte_cfg); ++*/ + /** + * Get memseg list corresponding to virtual memory address. + * +@@ -154,7 +159,11 @@ rte_mem_virt2memseg(const void *virt, const struct rte_memseg_list *msl); + */ + struct rte_memseg_list * + rte_mem_virt2memseg_list(const void *virt); +- ++/* ++__rte_experimental ++struct rte_memseg_list * ++rte_sec_mem_virt2memseg_list(const void *addr, const struct rte_config *rte_cfg); ++*/ + /** + * Memseg walk function prototype. + * +@@ -268,7 +277,12 @@ rte_memseg_list_walk(rte_memseg_list_walk_t func, void *arg); + */ + int + rte_memseg_walk_thread_unsafe(rte_memseg_walk_t func, void *arg); +- ++/* ++__rte_experimental ++int ++rte_sec_memseg_list_walk_thread_unsafe(rte_memseg_list_walk_t func, void *arg, ++ struct rte_config *rte_cfg); ++*/ + /** + * Walk each VA-contiguous area without performing any locking. + * +diff --git a/lib/eal/linux/eal.c b/lib/eal/linux/eal.c +index 47c2186bee..a3afa80d99 100644 +--- a/lib/eal/linux/eal.c ++++ b/lib/eal/linux/eal.c +@@ -88,8 +88,10 @@ int rte_cycles_vmware_tsc_map; + + static const char *default_runtime_dir = "/var/run"; + ++static unsigned int sec_count = 0; ++ + int +-eal_create_runtime_dir(void) ++eal_create_runtime_dir(const int sec_idx) + { + const char *directory = default_runtime_dir; + const char *xdg_runtime_dir = getenv("XDG_RUNTIME_DIR"); +@@ -113,8 +115,9 @@ eal_create_runtime_dir(void) + } + + /* create prefix-specific subdirectory under DPDK runtime dir */ +- ret = snprintf(run_dir, sizeof(run_dir), "%s/%s", +- tmp, eal_get_hugefile_prefix()); ++ const char *prefix = (sec_idx < 0) ? eal_get_hugefile_prefix() : ++ eal_sec_get_hugefile_prefix(sec_idx); ++ ret = snprintf(run_dir, sizeof(run_dir), "%s/%s", tmp, prefix); + if (ret < 0 || ret == sizeof(run_dir)) { + RTE_LOG(ERR, EAL, "Error creating prefix-specific runtime path name\n"); + return -1; +@@ -137,7 +140,9 @@ eal_create_runtime_dir(void) + return -1; + } + +- if (eal_set_runtime_dir(run_dir, sizeof(run_dir))) ++ ret = (sec_idx < 0) ? eal_set_runtime_dir(run_dir, sizeof(run_dir)) : ++ eal_sec_set_runtime_dir(run_dir, sizeof(run_dir), sec_idx); ++ if (ret) + return -1; + + return 0; +@@ -355,21 +360,22 @@ rte_eal_config_create(void) + + /* attach to an existing shared memory config */ + static int +-rte_eal_config_attach(void) ++__rte_eal_config_attach(const int mmap_flags, int *mem_cfg_fd, ++ const char *runtime_dir, ++ const struct internal_config *internal_conf, ++ struct rte_config *rte_cfg) + { +- struct rte_config *config = rte_eal_get_configuration(); + struct rte_mem_config *mem_config; +- const struct internal_config *internal_conf = +- eal_get_internal_configuration(); ++ int mcfg_fd = *mem_cfg_fd; + +- const char *pathname = eal_runtime_config_path(); ++ const char *pathname = eal_sec_runtime_config_path(runtime_dir); + + if (internal_conf->no_shconf) + return 0; + +- if (mem_cfg_fd < 0){ +- mem_cfg_fd = open(pathname, O_RDWR); +- if (mem_cfg_fd < 0) { ++ if (mcfg_fd < 0){ ++ mcfg_fd = open(pathname, O_RDWR); ++ if (mcfg_fd < 0) { + RTE_LOG(ERR, EAL, "Cannot open '%s' for rte_mem_config\n", + pathname); + return -1; +@@ -378,20 +384,32 @@ rte_eal_config_attach(void) + + /* map it as read-only first */ + mem_config = (struct rte_mem_config *) mmap(NULL, sizeof(*mem_config), +- PROT_READ, MAP_SHARED, mem_cfg_fd, 0); ++ mmap_flags, MAP_SHARED, mcfg_fd, 0); + if (mem_config == MAP_FAILED) { +- close(mem_cfg_fd); +- mem_cfg_fd = -1; ++ close(mcfg_fd); ++ mcfg_fd = -1; + RTE_LOG(ERR, EAL, "Cannot mmap memory for rte_config! error %i (%s)\n", + errno, strerror(errno)); + return -1; + } + +- config->mem_config = mem_config; ++ rte_cfg->mem_config = mem_config; ++ *mem_cfg_fd = mcfg_fd; + + return 0; + } + ++static int ++rte_eal_config_attach(void) ++{ ++ const struct internal_config *internal_conf = eal_get_internal_configuration(); ++ ++ return __rte_eal_config_attach(PROT_READ, &mem_cfg_fd, ++ rte_eal_get_runtime_dir(), internal_conf, ++ rte_eal_get_configuration()); ++} ++ ++ + /* reattach the shared config at exact memory location primary process has it */ + static int + rte_eal_config_reattach(void) +@@ -508,6 +526,45 @@ rte_config_init(void) + return 0; + } + ++static void ++rte_sec_config_init(const int sec_idx) ++{ ++ int mem_cfg_fd = -1; ++ int mmap_flags = PROT_READ | PROT_WRITE; ++ ++ struct rte_config *rte_cfg = rte_eal_sec_get_configuration(sec_idx); ++ struct internal_config *internal_conf = rte_eal_sec_get_internal_config(sec_idx); ++ ++ rte_cfg->process_type = internal_conf->process_type; ++ ++ __rte_eal_config_attach(mmap_flags, &mem_cfg_fd, ++ rte_eal_sec_get_runtime_dir(sec_idx), ++ internal_conf, rte_cfg); ++ ++ close(mem_cfg_fd); ++} ++ ++static int ++eal_sec_config_cleanup(const int sec_idx) ++{ ++ int ret; ++ struct rte_config *lc_rte_cfg = rte_eal_sec_get_configuration(sec_idx); ++ struct internal_config *lc_internal_cfg = rte_eal_sec_get_internal_config(sec_idx); ++ char *lc_runtime_dir = rte_eal_sec_get_runtime_dir(sec_idx); ++ ++ ret = munmap(lc_rte_cfg->mem_config, sizeof(*lc_rte_cfg->mem_config)); ++ if (ret < 0) { ++ RTE_LOG(ERR, EAL, "Failed to unmap config memory!\n"); ++ return -1; ++ } ++ ++ memset(lc_rte_cfg, 0, sizeof(*lc_rte_cfg)); ++ memset(lc_internal_cfg, 0, sizeof(*lc_internal_cfg)); ++ memset(lc_runtime_dir, 0, PATH_MAX); ++ ++ return 0; ++} ++ + /* Unlocks hugepage directories that were locked by eal_hugepage_info_init */ + static void + eal_hugedirs_unlock(void) +@@ -548,6 +605,7 @@ eal_usage(const char *prgname) + " --"OPT_LEGACY_MEM" Legacy memory mode (no dynamic allocation, contiguous segments)\n" + " --"OPT_SINGLE_FILE_SEGMENTS" Put all hugepage memory in single files\n" + " --"OPT_MATCH_ALLOCATIONS" Free hugepages exactly as allocated\n" ++ " --"OPT_MAP_PERFECT" Map virtual addresses according to configured hugepage size\n" + "\n"); + /* Allow the application to print its usage message too if hook is set */ + if (hook) { +@@ -678,7 +736,9 @@ eal_log_level_parse(int argc, char **argv) + + /* Parse the argument given in the command line of the application */ + static int +-eal_parse_args(int argc, char **argv) ++__eal_parse_args(int argc, char **argv, const int sec_idx, ++ struct internal_config *internal_conf, ++ struct rte_config *rte_cfg) + { + int opt, ret; + char **argvopt; +@@ -687,8 +747,6 @@ eal_parse_args(int argc, char **argv) + const int old_optind = optind; + const int old_optopt = optopt; + char * const old_optarg = optarg; +- struct internal_config *internal_conf = +- eal_get_internal_configuration(); + + argvopt = argv; + optind = 1; +@@ -816,6 +874,9 @@ eal_parse_args(int argc, char **argv) + case OPT_MATCH_ALLOCATIONS_NUM: + internal_conf->match_allocations = 1; + break; ++ case OPT_MAP_PERFECT_NUM: ++ internal_conf->map_perfect = 1; ++ break; + + default: + if (opt < OPT_LONG_MIN_NUM && isprint(opt)) { +@@ -837,7 +898,7 @@ eal_parse_args(int argc, char **argv) + } + + /* create runtime data directory. In no_shconf mode, skip any errors */ +- if (eal_create_runtime_dir() < 0) { ++ if (eal_create_runtime_dir(sec_idx) < 0) { + if (internal_conf->no_shconf == 0) { + RTE_LOG(ERR, EAL, "Cannot create runtime directory\n"); + ret = -1; +@@ -846,13 +907,18 @@ eal_parse_args(int argc, char **argv) + RTE_LOG(WARNING, EAL, "No DPDK runtime directory created\n"); + } + +- if (eal_adjust_config(internal_conf) != 0) { +- ret = -1; +- goto out; ++ if (!internal_conf->pri_and_sec) { ++ ret = eal_adjust_config(internal_conf); ++ if (ret != 0) ++ goto out; ++ } else { ++ ret = eal_sec_adjust_config(internal_conf); ++ if (ret != 0) ++ goto out; + } + + /* sanity checks */ +- if (eal_check_common_options(internal_conf) != 0) { ++ if (eal_check_common_options(internal_conf, rte_cfg) != 0) { + eal_usage(prgname); + ret = -1; + goto out; +@@ -871,6 +937,24 @@ eal_parse_args(int argc, char **argv) + return ret; + } + ++static int ++eal_parse_args(int argc, char **argv) ++{ ++ struct internal_config *internal_conf = eal_get_internal_configuration(); ++ ++ return __eal_parse_args(argc, argv, -1, ++ internal_conf, ++ rte_eal_get_configuration()); ++} ++ ++static int ++eal_sec_parse_args(int argc, char **argv, const int sec_idx) ++{ ++ return __eal_parse_args(argc, argv, sec_idx, ++ rte_eal_sec_get_internal_config(sec_idx), ++ rte_eal_sec_get_configuration(sec_idx)); ++} ++ + static int + check_socket(const struct rte_memseg_list *msl, void *arg) + { +@@ -1437,3 +1521,101 @@ rte_eal_check_module(const char *module_name) + /* Module has been found */ + return 1; + } ++ ++ ++/****** APIs for libnet ******/ ++int ++rte_eal_sec_attach(int argc, char **argv) ++{ ++ int ret; ++ int sec_idx = -1; ++ struct internal_config *lc_internal_conf = NULL; ++ ++ if (sec_count >= RTE_MAX_SECONDARY) { ++ RTE_LOG(ERR, EAL, "Too many secondary processes: %d.\n", sec_count); ++ rte_errno = EINVAL; ++ return -1; ++ } ++ ++ for (int i = 0; i < RTE_MAX_SECONDARY; ++i) { ++ lc_internal_conf = rte_eal_sec_get_internal_config(i); ++ if (lc_internal_conf->pri_and_sec == 0) { ++ lc_internal_conf->pri_and_sec = 1; ++ sec_idx = i; ++ break; ++ } ++ } ++ ++ eal_reset_internal_config(lc_internal_conf); ++ ++ ret = eal_sec_parse_args(argc, argv, sec_idx); ++ if (ret < 0) { ++ if (ret == -EALREADY) { ++ RTE_LOG(ERR, EAL, "file_refix %s already called initialization.\n", ++ lc_internal_conf->hugefile_prefix); ++ rte_errno = EALREADY; ++ } else { ++ RTE_LOG(ERR, EAL, "Invalid 'command line' arguments.\n"); ++ rte_errno = EINVAL; ++ } ++ return -1; ++ } ++ ++ rte_sec_config_init(sec_idx); ++ ++ ret = rte_eal_sec_memory_init(sec_idx); ++ if (ret < 0) { ++ RTE_LOG(ERR, EAL, "Cannot init memory\n"); ++ rte_errno = ENOMEM; ++ return -1; ++ } ++ ++ sec_count++; ++ return 0; ++} ++ ++int ++rte_eal_sec_detach(const char *file_prefix, int length) ++{ ++ int ret; ++ int sec_idx = -1; ++ struct internal_config *lc_internal_conf = NULL; ++ ++ if (!file_prefix || length <= 0) { ++ RTE_LOG(ERR, EAL, "Invalid 'file_prefix or length' arguments.\n"); ++ rte_errno = EINVAL; ++ return -1; ++ } ++ ++ for (int i = 0; i < RTE_MAX_SECONDARY; ++i) { ++ lc_internal_conf = rte_eal_sec_get_internal_config(i); ++ if (lc_internal_conf->pri_and_sec == 0) ++ continue; ++ if (!strncmp(lc_internal_conf->hugefile_prefix, file_prefix, length)) { ++ sec_idx = i; ++ break; ++ } ++ } ++ if (sec_idx == -1) { ++ RTE_LOG(ERR, EAL, "Cannot find file_prefix %s.\n", file_prefix); ++ rte_errno = EINVAL; ++ return -1; ++ } ++ ++ ret = rte_eal_sec_memory_cleanup(sec_idx); ++ if (ret < 0) { ++ RTE_LOG(ERR, EAL, "Cannot cleanup memory\n"); ++ rte_errno = ENOMEM; ++ return -1; ++ } ++ ++ ret = eal_sec_config_cleanup(sec_idx); ++ if (ret < 0) { ++ RTE_LOG(ERR, EAL, "Cannot cleanup hugepage sharefile.\n"); ++ rte_errno = EACCES; ++ return -1; ++ } ++ ++ sec_count--; ++ return 0; ++} +diff --git a/lib/eal/linux/eal_hugepage_info.c b/lib/eal/linux/eal_hugepage_info.c +index 9fb0e968db..41acf180ee 100644 +--- a/lib/eal/linux/eal_hugepage_info.c ++++ b/lib/eal/linux/eal_hugepage_info.c +@@ -389,7 +389,7 @@ calc_num_pages(struct hugepage_info *hpi, struct dirent *dirent) + */ + total_pages = 0; + /* we also don't want to do this for legacy init */ +- if (!internal_conf->legacy_mem) ++ if (!internal_conf->legacy_mem || internal_conf->map_perfect) + for (i = 0; i < rte_socket_count(); i++) { + int socket = rte_socket_id_by_idx(i); + unsigned int num_pages = +diff --git a/lib/eal/linux/eal_memalloc.c b/lib/eal/linux/eal_memalloc.c +index fc354f4a17..dac9098c8c 100644 +--- a/lib/eal/linux/eal_memalloc.c ++++ b/lib/eal/linux/eal_memalloc.c +@@ -39,6 +39,7 @@ + #include + #include + #include ++#include + + #include "eal_filesystem.h" + #include "eal_internal_cfg.h" +@@ -95,12 +96,14 @@ static int fallocate_supported = -1; /* unknown */ + * they will be initialized at startup, and filled as we allocate/deallocate + * segments. + */ +-static struct { ++struct fd_list{ + int *fds; /**< dynamically allocated array of segment lock fd's */ + int memseg_list_fd; /**< memseg list fd */ + int len; /**< total length of the array */ + int count; /**< entries used in an array */ +-} fd_list[RTE_MAX_MEMSEG_LISTS]; ++}; ++static struct fd_list fd_list[RTE_MAX_MEMSEG_LISTS]; ++static struct fd_list sec_fd_list[RTE_MAX_SECONDARY][RTE_MAX_MEMSEG_LISTS]; + + /** local copy of a memory map, used to synchronize memory hotplug in MP */ + static struct rte_memseg_list local_memsegs[RTE_MAX_MEMSEG_LISTS]; +@@ -1462,7 +1465,7 @@ secondary_msl_destroy_walk(const struct rte_memseg_list *msl, + } + + static int +-alloc_list(int list_idx, int len) ++__alloc_list(int list_idx, int len, struct fd_list *fd_ls) + { + int *data; + int i; +@@ -1470,7 +1473,7 @@ alloc_list(int list_idx, int len) + eal_get_internal_configuration(); + + /* single-file segments mode does not need fd list */ +- if (!internal_conf->single_file_segments) { ++ if (!internal_conf->single_file_segments) { // sec todo + /* ensure we have space to store fd per each possible segment */ + data = malloc(sizeof(int) * len); + if (data == NULL) { +@@ -1480,24 +1483,36 @@ alloc_list(int list_idx, int len) + /* set all fd's as invalid */ + for (i = 0; i < len; i++) + data[i] = -1; +- fd_list[list_idx].fds = data; +- fd_list[list_idx].len = len; ++ fd_ls[list_idx].fds = data; ++ fd_ls[list_idx].len = len; + } else { +- fd_list[list_idx].fds = NULL; +- fd_list[list_idx].len = 0; ++ fd_ls[list_idx].fds = NULL; ++ fd_ls[list_idx].len = 0; + } + +- fd_list[list_idx].count = 0; +- fd_list[list_idx].memseg_list_fd = -1; ++ fd_ls[list_idx].count = 0; ++ fd_ls[list_idx].memseg_list_fd = -1; + + return 0; + } + ++static int ++alloc_list(int list_idx, int len) ++{ ++ return __alloc_list(list_idx, len, fd_list); ++} ++ ++static int ++sec_alloc_list(int list_idx, int len, struct fd_list *fd_ls) ++{ ++ return __alloc_list(list_idx, len, fd_ls); ++} ++ + static int + destroy_list(int list_idx) + { + const struct internal_config *internal_conf = +- eal_get_internal_configuration(); ++ eal_get_internal_configuration(); + + /* single-file segments mode does not need fd list */ + if (!internal_conf->single_file_segments) { +@@ -1552,29 +1567,54 @@ fd_list_destroy_walk(const struct rte_memseg_list *msl, void *arg __rte_unused) + return destroy_list(msl_idx); + } + +-int +-eal_memalloc_set_seg_fd(int list_idx, int seg_idx, int fd) ++static int ++__eal_memalloc_set_seg_fd(int list_idx, int seg_idx, int fd, ++ const struct rte_config *rte_cfg, struct fd_list *fd_ls) + { +- struct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config; +- const struct internal_config *internal_conf = +- eal_get_internal_configuration(); +- ++ struct rte_mem_config *mcfg = rte_cfg->mem_config; ++ const struct internal_config *internal_conf = eal_get_internal_configuration(); ++ + /* single file segments mode doesn't support individual segment fd's */ +- if (internal_conf->single_file_segments) ++ if (internal_conf->single_file_segments) // sec todo + return -ENOTSUP; + + /* if list is not allocated, allocate it */ +- if (fd_list[list_idx].len == 0) { ++ if (fd_ls[list_idx].len == 0) { + int len = mcfg->memsegs[list_idx].memseg_arr.len; + +- if (alloc_list(list_idx, len) < 0) ++ if (sec_alloc_list(list_idx, len, fd_ls) < 0) + return -ENOMEM; + } +- fd_list[list_idx].fds[seg_idx] = fd; ++ fd_ls[list_idx].fds[seg_idx] = fd; + + return 0; + } + ++int ++eal_memalloc_set_seg_fd(int list_idx, int seg_idx, int fd) ++{ ++ return __eal_memalloc_set_seg_fd(list_idx, seg_idx, fd, ++ rte_eal_get_configuration(), fd_list); ++} ++ ++int ++eal_sec_memalloc_set_seg_fd(int list_idx, int seg_idx, int fd, ++ const int switch_pri_and_sec, const int sec_idx) ++{ ++ struct rte_config *rte_cfg = NULL; ++ struct fd_list *fd_ls = NULL; ++ ++ if (!switch_pri_and_sec) { ++ rte_cfg = rte_eal_get_configuration(); ++ fd_ls = &fd_list[0]; ++ } else { ++ rte_cfg = rte_eal_sec_get_configuration(sec_idx); ++ fd_ls = &sec_fd_list[sec_idx][0]; ++ } ++ ++ return __eal_memalloc_set_seg_fd(list_idx, seg_idx, fd, rte_cfg, fd_ls); ++} ++ + int + eal_memalloc_set_seg_list_fd(int list_idx, int fd) + { +@@ -1749,3 +1789,49 @@ eal_memalloc_init(void) + return -1; + return 0; + } ++ ++static int ++fd_sec_list_destroy_walk(const struct rte_memseg_list *msl, const int sec_idx) ++{ ++ struct rte_mem_config *mcfg = rte_eal_sec_get_configuration(sec_idx)->mem_config; ++ struct fd_list *fd_ls = sec_fd_list[sec_idx]; ++ int list_idx; ++ ++ list_idx = msl - mcfg->memsegs; ++ if (fd_ls[list_idx].len != 0) { ++ free(fd_ls[list_idx].fds); ++ /* We have closed fd, seeing in function of eal_legacy_hugepage_attach. */ ++ //close(fd_ls[list_idx].fds[seg_idx]); ++ } ++ memset(&fd_ls[list_idx], 0, sizeof(fd_ls[list_idx])); ++ ++ return 0; ++} ++ ++int ++eal_sec_memalloc_destroy(const int sec_idx) ++{ ++ struct rte_mem_config *mcfg = rte_eal_sec_get_configuration(sec_idx)->mem_config; ++ int i, ret = 0; ++ ++ for (i = 0; i < RTE_MAX_MEMSEG_LISTS; i++) { ++ struct rte_memseg_list *msl = &mcfg->memsegs[i]; ++ ++ if (msl->base_va == NULL) ++ continue; ++ ++ if (fd_sec_list_destroy_walk(msl, sec_idx)) { ++ RTE_LOG(ERR, EAL, "Failed to clear secondary fd_list.\n"); ++ return -1; ++ } ++ ++ ret = rte_sec_fbarray_destroy(&msl->memseg_arr, sec_idx); ++ if (ret) ++ return ret; ++ ++ rte_mem_unmap(msl->base_va, msl->len); ++ memset(msl, 0, sizeof(*msl)); ++ } ++ ++ return 0; ++} +diff --git a/lib/eal/linux/eal_memory.c b/lib/eal/linux/eal_memory.c +index 03a4f2dd2d..4d78a47e0a 100644 +--- a/lib/eal/linux/eal_memory.c ++++ b/lib/eal/linux/eal_memory.c +@@ -992,6 +992,7 @@ static int + remap_needed_hugepages(struct hugepage_file *hugepages, int n_pages) + { + int cur_page, seg_start_page, new_memseg, ret; ++ const struct internal_config *internal_conf = eal_get_internal_configuration(); + + seg_start_page = 0; + for (cur_page = 0; cur_page < n_pages; cur_page++) { +@@ -1017,10 +1018,10 @@ remap_needed_hugepages(struct hugepage_file *hugepages, int n_pages) + * address to lower address. Here, physical addresses are in + * descending order. + */ +- else if ((prev->physaddr - cur->physaddr) != cur->size) ++ else if (!internal_conf->map_perfect && (prev->physaddr - cur->physaddr) != cur->size) + new_memseg = 1; + #else +- else if ((cur->physaddr - prev->physaddr) != cur->size) ++ else if (!internal_conf->map_perfect && (cur->physaddr - prev->physaddr) != cur->size) + new_memseg = 1; + #endif + +@@ -1235,6 +1236,24 @@ eal_legacy_hugepage_init(void) + for (i = 0; i < (int) internal_conf->num_hugepage_sizes; i++) { + /* meanwhile, also initialize used_hp hugepage sizes in used_hp */ + used_hp[i].hugepage_sz = internal_conf->hugepage_info[i].hugepage_sz; ++ ++ if (internal_conf->map_perfect) { ++ int sys_num_pages = 0; ++ int need_num_pages = 0; ++ struct rte_memseg_list *msl; ++ ++ for (j = 0; j < RTE_MAX_NUMA_NODES; j++) { ++ sys_num_pages += internal_conf->hugepage_info[i].num_pages[j]; ++ } ++ ++ for (j = 0; j < RTE_MAX_MEMSEG_LISTS; j++) { ++ msl = &mcfg->memsegs[j]; ++ if (internal_conf->hugepage_info[i].hugepage_sz == msl->page_sz) ++ need_num_pages += msl->memseg_arr.len; ++ } ++ ++ internal_conf->hugepage_info[i].num_pages[0] = RTE_MIN(sys_num_pages, need_num_pages); ++ } + + nr_hugepages += internal_conf->hugepage_info[i].num_pages[0]; + } +@@ -1316,8 +1335,13 @@ eal_legacy_hugepage_init(void) + goto fail; + } + +- qsort(&tmp_hp[hp_offset], hpi->num_pages[0], +- sizeof(struct hugepage_file), cmp_physaddr); ++ /* continuous physical memory does not bring performance improvements, ++ * so no sorting is performed for quick startup. ++ */ ++ if (!internal_conf->map_perfect) { ++ qsort(&tmp_hp[hp_offset], hpi->num_pages[0], ++ sizeof(struct hugepage_file), cmp_physaddr); ++ } + + /* we have processed a num of hugepages of this size, so inc offset */ + hp_offset += hpi->num_pages[0]; +@@ -1502,9 +1526,9 @@ getFileSize(int fd) + * in order to form a contiguous block in the virtual memory space + */ + static int +-eal_legacy_hugepage_attach(void) ++eal_legacy_hugepage_attach(const int switch_pri_and_sec, const int sec_idx) + { +- struct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config; ++ struct rte_mem_config *mcfg = NULL; + struct hugepage_file *hp = NULL; + unsigned int num_hp = 0; + unsigned int i = 0; +@@ -1512,6 +1536,22 @@ eal_legacy_hugepage_attach(void) + off_t size = 0; + int fd, fd_hugepage = -1; + ++ struct rte_config *rte_cfg = NULL; ++ struct internal_config *internal_conf = NULL; ++ char *runtime_dir = NULL; ++ ++ if (!switch_pri_and_sec) { ++ runtime_dir = rte_eal_get_runtime_dir(); ++ rte_cfg = rte_eal_get_configuration(); ++ internal_conf = eal_get_internal_configuration(); ++ } else { ++ runtime_dir = rte_eal_sec_get_runtime_dir(sec_idx); ++ rte_cfg = rte_eal_sec_get_configuration(sec_idx); ++ internal_conf = rte_eal_sec_get_internal_config(sec_idx); ++ } ++ ++ mcfg = rte_cfg->mem_config; ++ + if (aslr_enabled() > 0) { + RTE_LOG(WARNING, EAL, "WARNING: Address Space Layout Randomization " + "(ASLR) is enabled in the kernel.\n"); +@@ -1519,10 +1559,10 @@ eal_legacy_hugepage_attach(void) + "into secondary processes\n"); + } + +- fd_hugepage = open(eal_hugepage_data_path(), O_RDONLY); ++ fd_hugepage = open(eal_sec_hugepage_data_path(runtime_dir), O_RDONLY); + if (fd_hugepage < 0) { + RTE_LOG(ERR, EAL, "Could not open %s\n", +- eal_hugepage_data_path()); ++ eal_sec_hugepage_data_path(runtime_dir)); + goto error; + } + +@@ -1530,7 +1570,7 @@ eal_legacy_hugepage_attach(void) + hp = mmap(NULL, size, PROT_READ, MAP_PRIVATE, fd_hugepage, 0); + if (hp == MAP_FAILED) { + RTE_LOG(ERR, EAL, "Could not mmap %s\n", +- eal_hugepage_data_path()); ++ eal_sec_hugepage_data_path(runtime_dir)); + goto error; + } + +@@ -1577,13 +1617,13 @@ eal_legacy_hugepage_attach(void) + } + + /* find segment data */ +- msl = rte_mem_virt2memseg_list(map_addr); ++ msl = rte_sec_mem_virt2memseg_list(map_addr, rte_cfg); + if (msl == NULL) { + RTE_LOG(DEBUG, EAL, "%s(): Cannot find memseg list\n", + __func__); + goto mmap_error; + } +- ms = rte_mem_virt2memseg(map_addr, msl); ++ ms = rte_sec_mem_virt2memseg(map_addr, msl, rte_cfg); + if (ms == NULL) { + RTE_LOG(DEBUG, EAL, "%s(): Cannot find memseg\n", + __func__); +@@ -1598,8 +1638,16 @@ eal_legacy_hugepage_attach(void) + goto mmap_error; + } + ++ /* No hugefile lock is required in PRI_AND_SEC mode, close it ++ * to avoid opening too much fd. ++ */ ++ if (internal_conf->pri_and_sec) { ++ close(fd); ++ fd = -1; ++ } ++ + /* store segment fd internally */ +- if (eal_memalloc_set_seg_fd(msl_idx, ms_idx, fd) < 0) ++ if (eal_sec_memalloc_set_seg_fd(msl_idx, ms_idx, fd, switch_pri_and_sec, sec_idx) < 0) + RTE_LOG(ERR, EAL, "Could not store segment fd: %s\n", + rte_strerror(rte_errno)); + } +@@ -1648,13 +1696,17 @@ rte_eal_hugepage_init(void) + } + + int +-rte_eal_hugepage_attach(void) ++rte_eal_hugepage_attach(const int switch_pri_and_sec, const int sec_idx) + { +- const struct internal_config *internal_conf = +- eal_get_internal_configuration(); ++ struct internal_config *internal_conf; ++ ++ if (!switch_pri_and_sec) ++ internal_conf = eal_get_internal_configuration(); ++ else ++ internal_conf = rte_eal_sec_get_internal_config(sec_idx); + + return internal_conf->legacy_mem ? +- eal_legacy_hugepage_attach() : ++ eal_legacy_hugepage_attach(switch_pri_and_sec, sec_idx) : + eal_hugepage_attach(); + } + +@@ -1873,9 +1925,10 @@ memseg_primary_init(void) + } + + static int +-memseg_secondary_init(void) ++memseg_secondary_init(struct rte_config *rte_cfg, ++ const int switch_pri_and_sec, const int sec_idx) + { +- struct rte_mem_config *mcfg = rte_eal_get_configuration()->mem_config; ++ struct rte_mem_config *mcfg = rte_cfg->mem_config; + int msl_idx = 0; + struct rte_memseg_list *msl; + +@@ -1887,7 +1940,7 @@ memseg_secondary_init(void) + if (msl->memseg_arr.len == 0) + continue; + +- if (rte_fbarray_attach(&msl->memseg_arr)) { ++ if (rte_sec_fbarray_attach(&msl->memseg_arr, switch_pri_and_sec, sec_idx)) { + RTE_LOG(ERR, EAL, "Cannot attach to primary process memseg lists\n"); + return -1; + } +@@ -1903,11 +1956,18 @@ memseg_secondary_init(void) + } + + int +-rte_eal_memseg_init(void) ++rte_eal_memseg_init(const int switch_pri_and_sec, const int sec_idx) + { + /* increase rlimit to maximum */ + struct rlimit lim; + ++ struct rte_config *rte_cfg = NULL; ++ if (!switch_pri_and_sec) { ++ rte_cfg = rte_eal_get_configuration(); ++ } else { ++ rte_cfg = rte_eal_sec_get_configuration(sec_idx); ++ } ++ + #ifndef RTE_EAL_NUMA_AWARE_HUGEPAGES + const struct internal_config *internal_conf = + eal_get_internal_configuration(); +@@ -1935,11 +1995,11 @@ rte_eal_memseg_init(void) + } + #endif + +- return rte_eal_process_type() == RTE_PROC_PRIMARY ? ++ return rte_cfg->process_type == RTE_PROC_PRIMARY ? + #ifndef RTE_ARCH_64 + memseg_primary_init_32() : + #else + memseg_primary_init() : + #endif +- memseg_secondary_init(); ++ memseg_secondary_init(rte_cfg, switch_pri_and_sec, sec_idx); + } +diff --git a/lib/ring/rte_ring.h b/lib/ring/rte_ring.h +index da17ed6d7c..ef18a2b39b 100644 +--- a/lib/ring/rte_ring.h ++++ b/lib/ring/rte_ring.h +@@ -802,6 +802,81 @@ rte_ring_dequeue_burst(struct rte_ring *r, void **obj_table, + n, available); + } + ++/****** APIs for libnet ******/ ++static __rte_always_inline unsigned ++rte_ring_cn_dequeue_burst(struct rte_ring *r, void **obj_table, unsigned int n) ++{ ++ const uint32_t old_head = r->prod.tail; ++ rte_smp_rmb(); ++ ++ const uint32_t entries = r->cons.head - old_head; ++ if (n > entries) { ++ n = entries; ++ } ++ if (unlikely(n == 0)) { ++ return 0; ++ } ++ ++ r->prod.head = old_head + n; ++ rte_smp_rmb(); ++ ++ __rte_ring_dequeue_elems(r, old_head, obj_table, sizeof(void *), n); ++ return n; ++} ++ ++static __rte_always_inline void ++rte_ring_cn_enqueue(struct rte_ring *r) ++{ ++ rte_smp_wmb(); ++ r->prod.tail = r->prod.head; ++} ++ ++static __rte_always_inline unsigned ++rte_ring_en_dequeue_burst(struct rte_ring *r, void **obj_table, unsigned int n) ++{ ++ const uint32_t old_tail = r->cons.tail; ++ rte_smp_rmb(); ++ ++ const uint32_t entries = r->prod.tail - old_tail; ++ if (n > entries) { ++ n = entries; ++ } ++ if (unlikely(n == 0)) { ++ return 0; ++ } ++ ++ const uint32_t new_tail = old_tail + n; ++ rte_smp_rmb(); ++ ++ __rte_ring_dequeue_elems(r, old_tail, obj_table, sizeof(void *), n); ++ rte_smp_rmb(); ++ ++ r->cons.tail = new_tail; ++ return n; ++} ++ ++static __rte_always_inline unsigned ++rte_ring_en_enqueue_bulk(struct rte_ring *r, void **obj_table, unsigned int n) ++{ ++ const uint32_t capacity = r->capacity; ++ const uint32_t old_head = r->cons.head; ++ rte_smp_rmb(); ++ ++ const uint32_t entries = capacity + r->cons.tail - old_head; ++ if (n > entries) { ++ return 0; ++ } ++ ++ const uint32_t new_head = old_head + n; ++ rte_smp_rmb(); ++ ++ __rte_ring_enqueue_elems(r, old_head, obj_table, sizeof(void *), n); ++ rte_smp_wmb(); ++ ++ r->cons.head = new_head; ++ return n; ++} ++ + #ifdef __cplusplus + } + #endif +-- +2.27.0 + diff --git a/0008-net-hns3-fix-crash-with-multi-process.patch b/0008-net-hns3-fix-crash-with-multi-process.patch deleted file mode 100644 index 8f2d50f1a8a53afbb0fbee5abc72f8372224a0d2..0000000000000000000000000000000000000000 --- a/0008-net-hns3-fix-crash-with-multi-process.patch +++ /dev/null @@ -1,102 +0,0 @@ -From 8e6c3a65eed79da35189319577235f43a7423612 Mon Sep 17 00:00:00 2001 -From: "Min Hu (Connor)" -Date: Wed, 6 Jan 2021 11:46:31 +0800 -Subject: [PATCH 008/189] net/hns3: fix crash with multi-process - -In current version, procedure of saving eth_dev in -hns3 PMD init will be called more than twice, one -for primary, the other for secondary. That will cause -segmentation fault in Multi-process as eth_dev will -be changed in secondary process, which is different -from one in primary process. - -The initial problem was access to 'rte_eth_devices' -global variable, which is wrong. But current approach -can cause problem for the secondaries, moving 'eth_dev' -to process private can work but before making things -more complex. - -This patch deserted the procedure of saving eth_dev in -hns3 PMD init. Instead, it creates an internal function -that gets "struct hns3_hw" as parameter and it can be -called internally without knowing 'eth_dev'and the -.dev_ops can be wrapper to this. - -Fixes: 2390bf217f4d ("net/hns3: fix FEC state query") -Cc: stable@dpdk.org - -Signed-off-by: Min Hu (Connor) -Signed-off-by: Lijun Ou ---- - drivers/net/hns3/hns3_ethdev.c | 16 ++++++++++------ - drivers/net/hns3/hns3_ethdev.h | 2 -- - 2 files changed, 10 insertions(+), 8 deletions(-) - -diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c -index 7c34e38..90544fe 100644 ---- a/drivers/net/hns3/hns3_ethdev.c -+++ b/drivers/net/hns3/hns3_ethdev.c -@@ -5821,10 +5821,9 @@ get_current_fec_auto_state(struct hns3_hw *hw, uint8_t *state) - } - - static int --hns3_fec_get(struct rte_eth_dev *dev, uint32_t *fec_capa) -+hns3_fec_get_internal(struct hns3_hw *hw, uint32_t *fec_capa) - { - #define QUERY_ACTIVE_SPEED 1 -- struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private); - struct hns3_sfp_speed_cmd *resp; - uint32_t tmp_fec_capa; - uint8_t auto_state; -@@ -5885,6 +5884,14 @@ hns3_fec_get(struct rte_eth_dev *dev, uint32_t *fec_capa) - } - - static int -+hns3_fec_get(struct rte_eth_dev *dev, uint32_t *fec_capa) -+{ -+ struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private); -+ -+ return hns3_fec_get_internal(hw, fec_capa); -+} -+ -+static int - hns3_set_fec_hw(struct hns3_hw *hw, uint32_t mode) - { - struct hns3_config_fec_cmd *req; -@@ -6017,10 +6024,9 @@ hns3_query_dev_fec_info(struct hns3_hw *hw) - { - struct hns3_adapter *hns = HNS3_DEV_HW_TO_ADAPTER(hw); - struct hns3_pf *pf = HNS3_DEV_PRIVATE_TO_PF(hns); -- struct rte_eth_dev *eth_dev = hns->eth_dev; - int ret; - -- ret = hns3_fec_get(eth_dev, &pf->fec_mode); -+ ret = hns3_fec_get_internal(hw, &pf->fec_mode); - if (ret) - hns3_err(hw, "query device FEC info failed, ret = %d", ret); - -@@ -6106,8 +6112,6 @@ hns3_dev_init(struct rte_eth_dev *eth_dev) - - PMD_INIT_FUNC_TRACE(); - -- hns->eth_dev = eth_dev; -- - eth_dev->process_private = (struct hns3_process_private *) - rte_zmalloc_socket("hns3_filter_list", - sizeof(struct hns3_process_private), -diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h -index 8d6b8cd..31f78a1 100644 ---- a/drivers/net/hns3/hns3_ethdev.h -+++ b/drivers/net/hns3/hns3_ethdev.h -@@ -743,8 +743,6 @@ struct hns3_adapter { - struct hns3_vf vf; - }; - -- struct rte_eth_dev *eth_dev; -- - bool rx_simple_allowed; - bool rx_vec_allowed; - bool tx_simple_allowed; --- -2.7.4 - diff --git a/0009-dpdk-fix-error-in-clearing-secondary-process-memseg-lists.patch b/0009-dpdk-fix-error-in-clearing-secondary-process-memseg-lists.patch new file mode 100644 index 0000000000000000000000000000000000000000..59f52959688b86a42ca5c2a620d25c013065799a --- /dev/null +++ b/0009-dpdk-fix-error-in-clearing-secondary-process-memseg-lists.patch @@ -0,0 +1,43 @@ +From 9a4c67c47896fb9aa0fd8935813f2016b543a9df Mon Sep 17 00:00:00 2001 +From: Changsheng Wu +Date: Sat, 18 Dec 2021 16:45:51 +0800 +Subject: [PATCH] + huawei-0008-dpdk-fix-error-in-clearing-secondary-process-memseg-lists + +--- + lib/eal/common/eal_common_fbarray.c | 6 ++---- + 1 file changed, 2 insertions(+), 4 deletions(-) + +diff --git a/lib/eal/common/eal_common_fbarray.c b/lib/eal/common/eal_common_fbarray.c +index 9c125c104c..d4a4cea7c1 100644 +--- a/lib/eal/common/eal_common_fbarray.c ++++ b/lib/eal/common/eal_common_fbarray.c +@@ -1102,7 +1102,7 @@ int + rte_sec_fbarray_destroy(struct rte_fbarray *arr, + const int sec_idx) + { +- int fd, ret; ++ int fd; + char path[PATH_MAX]; + + if (arr == NULL) { +@@ -1128,15 +1128,13 @@ rte_sec_fbarray_destroy(struct rte_fbarray *arr, + if (flock(fd, LOCK_EX | LOCK_NB)) { + RTE_LOG(DEBUG, EAL, "Cannot destroy fbarray - another process is using it\n"); + rte_errno = EBUSY; +- ret = -1; + } else { +- ret = 0; + unlink(path); + memset(arr, 0, sizeof(*arr)); + } + close(fd); + +- return ret; ++ return 0; + } + + void * +-- +2.27.0 + diff --git a/0009-net-hns3-remove-unnecessary-memset.patch b/0009-net-hns3-remove-unnecessary-memset.patch deleted file mode 100644 index bc0f3473bf892041d898be85c5c0522b36f5b573..0000000000000000000000000000000000000000 --- a/0009-net-hns3-remove-unnecessary-memset.patch +++ /dev/null @@ -1,37 +0,0 @@ -From c06b9cd500facfb6a10057490c1ec1090408ff12 Mon Sep 17 00:00:00 2001 -From: Lijun Ou -Date: Wed, 6 Jan 2021 11:46:32 +0800 -Subject: [PATCH 009/189] net/hns3: remove unnecessary memset - -The hns3_cmd_desc has memset when setup and the memset -for req is unnecessary. - -Signed-off-by: Lijun Ou ---- - drivers/net/hns3/hns3_rss.c | 5 ----- - 1 file changed, 5 deletions(-) - -diff --git a/drivers/net/hns3/hns3_rss.c b/drivers/net/hns3/hns3_rss.c -index e2f0468..b5df374 100644 ---- a/drivers/net/hns3/hns3_rss.c -+++ b/drivers/net/hns3/hns3_rss.c -@@ -633,16 +633,11 @@ hns3_set_rss_tc_mode(struct hns3_hw *hw) - static void - hns3_rss_tuple_uninit(struct hns3_hw *hw) - { -- struct hns3_rss_input_tuple_cmd *req; - struct hns3_cmd_desc desc; - int ret; - - hns3_cmd_setup_basic_desc(&desc, HNS3_OPC_RSS_INPUT_TUPLE, false); - -- req = (struct hns3_rss_input_tuple_cmd *)desc.data; -- -- memset(req, 0, sizeof(struct hns3_rss_tuple_cfg)); -- - ret = hns3_cmd_send(hw, &desc, 1); - if (ret) { - hns3_err(hw, "RSS uninit tuple failed %d", ret); --- -2.7.4 - diff --git a/0010-dpdk-fix-coredump-when-primary-process-attach-without-shared-file.patch b/0010-dpdk-fix-coredump-when-primary-process-attach-without-shared-file.patch new file mode 100644 index 0000000000000000000000000000000000000000..665e2139e47f232fe4a683930a0dc84b60773c30 --- /dev/null +++ b/0010-dpdk-fix-coredump-when-primary-process-attach-without-shared-file.patch @@ -0,0 +1,61 @@ +From 097d8acb68c7d7dbfd7800c7f69eaf171ce9da4b Mon Sep 17 00:00:00 2001 +From: Changsheng Wu +Date: Sat, 18 Dec 2021 16:49:16 +0800 +Subject: [PATCH] 0009 + +--- + lib/eal/linux/eal.c | 17 ++++++++++++++--- + 1 file changed, 14 insertions(+), 3 deletions(-) + +diff --git a/lib/eal/linux/eal.c b/lib/eal/linux/eal.c +index f269e67fae..2555043155 100644 +--- a/lib/eal/linux/eal.c ++++ b/lib/eal/linux/eal.c +@@ -524,22 +524,29 @@ rte_config_init(void) + return 0; + } + +-static void ++static int + rte_sec_config_init(const int sec_idx) + { + int mem_cfg_fd = -1; + int mmap_flags = PROT_READ | PROT_WRITE; ++ int ret = -1; + + struct rte_config *rte_cfg = rte_eal_sec_get_configuration(sec_idx); + struct internal_config *internal_conf = rte_eal_sec_get_internal_config(sec_idx); + + rte_cfg->process_type = internal_conf->process_type; + +- __rte_eal_config_attach(mmap_flags, &mem_cfg_fd, ++ ret = __rte_eal_config_attach(mmap_flags, &mem_cfg_fd, + rte_eal_sec_get_runtime_dir(sec_idx), + internal_conf, rte_cfg); ++ if (ret < 0) { ++ RTE_LOG(ERR, EAL, "Cannot attach shared memory\n"); ++ return -1; ++ } ++ + + close(mem_cfg_fd); ++ return 0; + } + + static int +@@ -1561,7 +1568,11 @@ rte_eal_sec_attach(int argc, char **argv) + return -1; + } + +- rte_sec_config_init(sec_idx); ++ ret = rte_sec_config_init(sec_idx); ++ if (ret < 0) { ++ RTE_LOG(ERR, EAL, "Cannot init sec config\n"); ++ return -1; ++ } + + ret = rte_eal_sec_memory_init(sec_idx); + if (ret < 0) { +-- +2.27.0 + diff --git a/0010-net-hns3-fix-jumbo-frame-flag-condition-for-MTU-set.patch b/0010-net-hns3-fix-jumbo-frame-flag-condition-for-MTU-set.patch deleted file mode 100644 index c2267dab32678867a740575b0e8d260880b32b7b..0000000000000000000000000000000000000000 --- a/0010-net-hns3-fix-jumbo-frame-flag-condition-for-MTU-set.patch +++ /dev/null @@ -1,53 +0,0 @@ -From 2a7fd245e7d1c752bd53df6e0e7967b1dadfe876 Mon Sep 17 00:00:00 2001 -From: Steve Yang -Date: Mon, 18 Jan 2021 07:04:12 +0000 -Subject: [PATCH 010/189] net/hns3: fix jumbo frame flag condition for MTU set - -The jumbo frame uses the 'RTE_ETHER_MAX_LEN' as boundary condition, -but the Ether overhead is larger than 18 when it supports dual VLAN tags. -That will cause the jumbo flag rx offload is wrong when MTU size is -'RTE_ETHER_MTU'. - -This fix will change the boundary condition with 'HSN3_DEFAULT_FRAME_LEN', -that perhaps impacts the cases of the jumbo frame related. - -Fixes: 1f5ca0b460cd ("net/hns3: support some device operations") -Fixes: a5475d61fa34 ("net/hns3: support VF") -Cc: stable@dpdk.org - -Signed-off-by: Steve Yang -Acked-by: Lijun Ou ---- - drivers/net/hns3/hns3_ethdev.c | 2 +- - drivers/net/hns3/hns3_ethdev_vf.c | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c -index 90544fe..bf633a3 100644 ---- a/drivers/net/hns3/hns3_ethdev.c -+++ b/drivers/net/hns3/hns3_ethdev.c -@@ -2467,7 +2467,7 @@ hns3_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) - } - - rte_spinlock_lock(&hw->lock); -- is_jumbo_frame = frame_size > RTE_ETHER_MAX_LEN ? true : false; -+ is_jumbo_frame = frame_size > HNS3_DEFAULT_FRAME_LEN ? true : false; - frame_size = RTE_MAX(frame_size, HNS3_DEFAULT_FRAME_LEN); - - /* -diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c -index f09cabc..ef03fb1 100644 ---- a/drivers/net/hns3/hns3_ethdev_vf.c -+++ b/drivers/net/hns3/hns3_ethdev_vf.c -@@ -928,7 +928,7 @@ hns3vf_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) - rte_spinlock_unlock(&hw->lock); - return ret; - } -- if (frame_size > RTE_ETHER_MAX_LEN) -+ if (mtu > RTE_ETHER_MTU) - dev->data->dev_conf.rxmode.offloads |= - DEV_RX_OFFLOAD_JUMBO_FRAME; - else --- -2.7.4 - diff --git a/0011-dpdk-fix-fbarray-memseg-destory-error-during-detach.patch b/0011-dpdk-fix-fbarray-memseg-destory-error-during-detach.patch new file mode 100644 index 0000000000000000000000000000000000000000..abd1d2d94b5b25d920e9e9a2d73a3ff73c6c110c --- /dev/null +++ b/0011-dpdk-fix-fbarray-memseg-destory-error-during-detach.patch @@ -0,0 +1,27 @@ +From dad8149d187448f85be497ce3bb6c34bf1ffde5e Mon Sep 17 00:00:00 2001 +From: Changsheng Wu +Date: Sat, 18 Dec 2021 16:54:03 +0800 +Subject: [PATCH] 0010 + +--- + lib/eal/common/eal_common_fbarray.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/lib/eal/common/eal_common_fbarray.c b/lib/eal/common/eal_common_fbarray.c +index d4a4cea7c1..fa726cd2f5 100644 +--- a/lib/eal/common/eal_common_fbarray.c ++++ b/lib/eal/common/eal_common_fbarray.c +@@ -1122,8 +1122,8 @@ rte_sec_fbarray_destroy(struct rte_fbarray *arr, + + fd = open(path, O_RDONLY); + if (fd < 0) { +- RTE_LOG(ERR, EAL, "Could not open fbarray file: %s\n", strerror(errno)); +- return -1; ++ RTE_LOG(WARNING, EAL, "Could not open %s: %s, and just skip it\n", path, strerror(errno)); ++ return 0; + } + if (flock(fd, LOCK_EX | LOCK_NB)) { + RTE_LOG(DEBUG, EAL, "Cannot destroy fbarray - another process is using it\n"); +-- +2.27.0 + diff --git a/0011-net-hns3-use-C11-atomics-builtins-for-resetting.patch b/0011-net-hns3-use-C11-atomics-builtins-for-resetting.patch deleted file mode 100644 index 46ccc2d34340074989db202a9a3958839ab0a3f5..0000000000000000000000000000000000000000 --- a/0011-net-hns3-use-C11-atomics-builtins-for-resetting.patch +++ /dev/null @@ -1,209 +0,0 @@ -From ec2a9e9b56f0bfd4d0926c9f59183d682de9670e Mon Sep 17 00:00:00 2001 -From: Lijun Ou -Date: Thu, 14 Jan 2021 21:33:30 +0800 -Subject: [PATCH 011/189] net/hns3: use C11 atomics builtins for resetting - -Use C11 atomic builtins with explicit ordering instead of -rte_atomic ops with the resetting member of hns3_reset_data -structure. - -Signed-off-by: Lijun Ou ---- - drivers/net/hns3/hns3_dcb.c | 5 +++-- - drivers/net/hns3/hns3_ethdev.c | 8 ++++---- - drivers/net/hns3/hns3_ethdev.h | 2 +- - drivers/net/hns3/hns3_ethdev_vf.c | 12 ++++++------ - drivers/net/hns3/hns3_intr.c | 8 ++++---- - drivers/net/hns3/hns3_rxtx.c | 2 +- - 6 files changed, 19 insertions(+), 18 deletions(-) - -diff --git a/drivers/net/hns3/hns3_dcb.c b/drivers/net/hns3/hns3_dcb.c -index fb50179..b32d5af 100644 ---- a/drivers/net/hns3/hns3_dcb.c -+++ b/drivers/net/hns3/hns3_dcb.c -@@ -633,7 +633,7 @@ hns3_set_rss_size(struct hns3_hw *hw, uint16_t nb_rx_q) - * and configured directly to the hardware in the RESET_STAGE_RESTORE - * stage of the reset process. - */ -- if (rte_atomic16_read(&hw->reset.resetting) == 0) { -+ if (__atomic_load_n(&hw->reset.resetting, __ATOMIC_RELAXED) == 0) { - for (i = 0; i < HNS3_RSS_IND_TBL_SIZE; i++) - rss_cfg->rss_indirection_tbl[i] = - i % hw->alloc_rss_size; -@@ -1562,7 +1562,8 @@ hns3_dcb_configure(struct hns3_adapter *hns) - int ret; - - hns3_dcb_cfg_validate(hns, &num_tc, &map_changed); -- if (map_changed || rte_atomic16_read(&hw->reset.resetting)) { -+ if (map_changed || -+ __atomic_load_n(&hw->reset.resetting, __ATOMIC_RELAXED)) { - ret = hns3_dcb_info_update(hns, num_tc); - if (ret) { - hns3_err(hw, "dcb info update failed: %d", ret); -diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c -index bf633a3..d0d1d3a 100644 ---- a/drivers/net/hns3/hns3_ethdev.c -+++ b/drivers/net/hns3/hns3_ethdev.c -@@ -1017,7 +1017,7 @@ hns3_init_vlan_config(struct hns3_adapter *hns) - * ensure that the hardware configuration remains unchanged before and - * after reset. - */ -- if (rte_atomic16_read(&hw->reset.resetting) == 0) { -+ if (__atomic_load_n(&hw->reset.resetting, __ATOMIC_RELAXED) == 0) { - hw->port_base_vlan_cfg.state = HNS3_PORT_BASE_VLAN_DISABLE; - hw->port_base_vlan_cfg.pvid = HNS3_INVALID_PVID; - } -@@ -1041,7 +1041,7 @@ hns3_init_vlan_config(struct hns3_adapter *hns) - * we will restore configurations to hardware in hns3_restore_vlan_table - * and hns3_restore_vlan_conf later. - */ -- if (rte_atomic16_read(&hw->reset.resetting) == 0) { -+ if (__atomic_load_n(&hw->reset.resetting, __ATOMIC_RELAXED) == 0) { - ret = hns3_vlan_pvid_configure(hns, HNS3_INVALID_PVID, 0); - if (ret) { - hns3_err(hw, "pvid set fail in pf, ret =%d", ret); -@@ -4872,7 +4872,7 @@ hns3_dev_start(struct rte_eth_dev *dev) - int ret; - - PMD_INIT_FUNC_TRACE(); -- if (rte_atomic16_read(&hw->reset.resetting)) -+ if (__atomic_load_n(&hw->reset.resetting, __ATOMIC_RELAXED)) - return -EBUSY; - - rte_spinlock_lock(&hw->lock); -@@ -5018,7 +5018,7 @@ hns3_dev_stop(struct rte_eth_dev *dev) - rte_delay_ms(hw->tqps_num); - - rte_spinlock_lock(&hw->lock); -- if (rte_atomic16_read(&hw->reset.resetting) == 0) { -+ if (__atomic_load_n(&hw->reset.resetting, __ATOMIC_RELAXED) == 0) { - hns3_stop_tqps(hw); - hns3_do_stop(hns); - hns3_unmap_rx_interrupt(dev); -diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h -index 31f78a1..0d86683 100644 ---- a/drivers/net/hns3/hns3_ethdev.h -+++ b/drivers/net/hns3/hns3_ethdev.h -@@ -350,7 +350,7 @@ struct hns3_reset_data { - enum hns3_reset_stage stage; - rte_atomic16_t schedule; - /* Reset flag, covering the entire reset process */ -- rte_atomic16_t resetting; -+ uint16_t resetting; - /* Used to disable sending cmds during reset */ - rte_atomic16_t disable_cmd; - /* The reset level being processed */ -diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c -index ef03fb1..c126384 100644 ---- a/drivers/net/hns3/hns3_ethdev_vf.c -+++ b/drivers/net/hns3/hns3_ethdev_vf.c -@@ -898,7 +898,7 @@ hns3vf_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) - * MTU value issued by hns3 VF PMD driver must be less than or equal to - * PF's MTU. - */ -- if (rte_atomic16_read(&hw->reset.resetting)) { -+ if (__atomic_load_n(&hw->reset.resetting, __ATOMIC_RELAXED)) { - hns3_err(hw, "Failed to set mtu during resetting"); - return -EIO; - } -@@ -1438,7 +1438,7 @@ hns3vf_request_link_info(struct hns3_hw *hw) - uint8_t resp_msg; - int ret; - -- if (rte_atomic16_read(&hw->reset.resetting)) -+ if (__atomic_load_n(&hw->reset.resetting, __ATOMIC_RELAXED)) - return; - ret = hns3_send_mbx_msg(hw, HNS3_MBX_GET_LINK_STATUS, 0, NULL, 0, false, - &resp_msg, sizeof(resp_msg)); -@@ -1471,7 +1471,7 @@ hns3vf_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on) - struct hns3_hw *hw = &hns->hw; - int ret; - -- if (rte_atomic16_read(&hw->reset.resetting)) { -+ if (__atomic_load_n(&hw->reset.resetting, __ATOMIC_RELAXED)) { - hns3_err(hw, - "vf set vlan id failed during resetting, vlan_id =%u", - vlan_id); -@@ -1510,7 +1510,7 @@ hns3vf_vlan_offload_set(struct rte_eth_dev *dev, int mask) - unsigned int tmp_mask; - int ret = 0; - -- if (rte_atomic16_read(&hw->reset.resetting)) { -+ if (__atomic_load_n(&hw->reset.resetting, __ATOMIC_RELAXED)) { - hns3_err(hw, "vf set vlan offload failed during resetting, " - "mask = 0x%x", mask); - return -EIO; -@@ -1957,7 +1957,7 @@ hns3vf_dev_stop(struct rte_eth_dev *dev) - rte_delay_ms(hw->tqps_num); - - rte_spinlock_lock(&hw->lock); -- if (rte_atomic16_read(&hw->reset.resetting) == 0) { -+ if (__atomic_load_n(&hw->reset.resetting, __ATOMIC_RELAXED) == 0) { - hns3_stop_tqps(hw); - hns3vf_do_stop(hns); - hns3vf_unmap_rx_interrupt(dev); -@@ -2188,7 +2188,7 @@ hns3vf_dev_start(struct rte_eth_dev *dev) - int ret; - - PMD_INIT_FUNC_TRACE(); -- if (rte_atomic16_read(&hw->reset.resetting)) -+ if (__atomic_load_n(&hw->reset.resetting, __ATOMIC_RELAXED)) - return -EBUSY; - - rte_spinlock_lock(&hw->lock); -diff --git a/drivers/net/hns3/hns3_intr.c b/drivers/net/hns3/hns3_intr.c -index 99c500d..51f19b4 100644 ---- a/drivers/net/hns3/hns3_intr.c -+++ b/drivers/net/hns3/hns3_intr.c -@@ -1761,7 +1761,7 @@ hns3_reset_init(struct hns3_hw *hw) - hw->reset.stage = RESET_STAGE_NONE; - hw->reset.request = 0; - hw->reset.pending = 0; -- rte_atomic16_init(&hw->reset.resetting); -+ hw->reset.resetting = 0; - rte_atomic16_init(&hw->reset.disable_cmd); - hw->reset.wait_data = rte_zmalloc("wait_data", - sizeof(struct hns3_wait_data), 0); -@@ -2011,7 +2011,7 @@ hns3_reset_pre(struct hns3_adapter *hns) - int ret; - - if (hw->reset.stage == RESET_STAGE_NONE) { -- rte_atomic16_set(&hns->hw.reset.resetting, 1); -+ __atomic_store_n(&hns->hw.reset.resetting, 1, __ATOMIC_RELAXED); - hw->reset.stage = RESET_STAGE_DOWN; - ret = hw->reset.ops->stop_service(hns); - gettimeofday(&tv, NULL); -@@ -2098,7 +2098,7 @@ hns3_reset_post(struct hns3_adapter *hns) - /* IMP will wait ready flag before reset */ - hns3_notify_reset_ready(hw, false); - hns3_clear_reset_level(hw, &hw->reset.pending); -- rte_atomic16_clear(&hns->hw.reset.resetting); -+ __atomic_store_n(&hns->hw.reset.resetting, 0, __ATOMIC_RELAXED); - hw->reset.attempts = 0; - hw->reset.stats.success_cnt++; - hw->reset.stage = RESET_STAGE_NONE; -@@ -2223,7 +2223,7 @@ hns3_reset_process(struct hns3_adapter *hns, enum hns3_reset_level new_level) - hw->reset.mbuf_deferred_free = false; - } - rte_spinlock_unlock(&hw->lock); -- rte_atomic16_clear(&hns->hw.reset.resetting); -+ __atomic_store_n(&hns->hw.reset.resetting, 0, __ATOMIC_RELAXED); - hw->reset.stage = RESET_STAGE_NONE; - gettimeofday(&tv, NULL); - timersub(&tv, &hw->reset.start_time, &tv_delta); -diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c -index 5ac36b3..0badfc9 100644 ---- a/drivers/net/hns3/hns3_rxtx.c -+++ b/drivers/net/hns3/hns3_rxtx.c -@@ -3744,7 +3744,7 @@ void hns3_set_rxtx_function(struct rte_eth_dev *eth_dev) - eth_tx_prep_t prep = NULL; - - if (hns->hw.adapter_state == HNS3_NIC_STARTED && -- rte_atomic16_read(&hns->hw.reset.resetting) == 0) { -+ __atomic_load_n(&hns->hw.reset.resetting, __ATOMIC_RELAXED) == 0) { - eth_dev->rx_pkt_burst = hns3_get_rx_function(eth_dev); - eth_dev->tx_pkt_burst = hns3_get_tx_function(eth_dev, &prep); - eth_dev->tx_pkt_prepare = prep; --- -2.7.4 - diff --git a/0012-fix-rte-eal-sec-detach-coredump-count-rollover.patch b/0012-fix-rte-eal-sec-detach-coredump-count-rollover.patch new file mode 100644 index 0000000000000000000000000000000000000000..b10f19043c4d9ec2c63790e66bb6095567f8aad9 --- /dev/null +++ b/0012-fix-rte-eal-sec-detach-coredump-count-rollover.patch @@ -0,0 +1,42 @@ +From 8ca5f1cfbea80f7524eb2f2dfa67760be80666c3 Mon Sep 17 00:00:00 2001 +From: Changsheng Wu +Date: Sat, 18 Dec 2021 16:57:31 +0800 +Subject: [PATCH] 0011 + +--- + lib/eal/linux/eal.c | 4 +++- + lib/eal/linux/eal_memalloc.c | 4 ++++ + 2 files changed, 7 insertions(+), 1 deletion(-) + +diff --git a/lib/eal/linux/eal.c b/lib/eal/linux/eal.c +index 2555043155..c833b46c36 100644 +--- a/lib/eal/linux/eal.c ++++ b/lib/eal/linux/eal.c +@@ -1627,6 +1627,8 @@ rte_eal_sec_detach(const char *file_prefix, int length) + return -1; + } + +- sec_count--; ++ if (sec_count) { ++ sec_count--; ++ } + return 0; + } +diff --git a/lib/eal/linux/eal_memalloc.c b/lib/eal/linux/eal_memalloc.c +index dac9098c8c..38543bf8c4 100644 +--- a/lib/eal/linux/eal_memalloc.c ++++ b/lib/eal/linux/eal_memalloc.c +@@ -1814,6 +1814,10 @@ eal_sec_memalloc_destroy(const int sec_idx) + struct rte_mem_config *mcfg = rte_eal_sec_get_configuration(sec_idx)->mem_config; + int i, ret = 0; + ++ if (mcfg == NULL) { ++ return 0; ++ } ++ + for (i = 0; i < RTE_MAX_MEMSEG_LISTS; i++) { + struct rte_memseg_list *msl = &mcfg->memsegs[i]; + +-- +2.27.0 + diff --git a/0012-net-hns3-support-traffic-management.patch b/0012-net-hns3-support-traffic-management.patch deleted file mode 100644 index fcd84869d2cee0c62f0c5420cd5e75b4b856361c..0000000000000000000000000000000000000000 --- a/0012-net-hns3-support-traffic-management.patch +++ /dev/null @@ -1,1885 +0,0 @@ -From f0523548580b29532793025e08a1b5bee8f682ff Mon Sep 17 00:00:00 2001 -From: Chengwen Feng -Date: Thu, 14 Jan 2021 21:33:31 +0800 -Subject: [PATCH 012/189] net/hns3: support traffic management - -This patch support RTE TM ops function for PF, which could -used to: -1. config port's peak rate. -2. config TC's peak rate. - -Signed-off-by: Chengwen Feng -Signed-off-by: Lijun Ou ---- - drivers/net/hns3/hns3_dcb.c | 216 ++++--- - drivers/net/hns3/hns3_dcb.h | 3 + - drivers/net/hns3/hns3_ethdev.c | 20 +- - drivers/net/hns3/hns3_ethdev.h | 14 + - drivers/net/hns3/hns3_tm.c | 1291 ++++++++++++++++++++++++++++++++++++++++ - drivers/net/hns3/hns3_tm.h | 103 ++++ - drivers/net/hns3/meson.build | 3 +- - 7 files changed, 1554 insertions(+), 96 deletions(-) - create mode 100644 drivers/net/hns3/hns3_tm.c - create mode 100644 drivers/net/hns3/hns3_tm.h - -diff --git a/drivers/net/hns3/hns3_dcb.c b/drivers/net/hns3/hns3_dcb.c -index b32d5af..5aa374c 100644 ---- a/drivers/net/hns3/hns3_dcb.c -+++ b/drivers/net/hns3/hns3_dcb.c -@@ -76,16 +76,13 @@ hns3_shaper_para_calc(struct hns3_hw *hw, uint32_t ir, uint8_t shaper_level, - shaper_para->ir_b = SHAPER_DEFAULT_IR_B; - } else if (ir_calc > ir) { - /* Increasing the denominator to select ir_s value */ -- do { -+ while (ir_calc >= ir && ir) { - ir_s_calc++; - ir_calc = DIVISOR_IR_B_126 / (tick * (1 << ir_s_calc)); -- } while (ir_calc > ir); -+ } - -- if (ir_calc == ir) -- shaper_para->ir_b = SHAPER_DEFAULT_IR_B; -- else -- shaper_para->ir_b = (ir * tick * (1 << ir_s_calc) + -- (DIVISOR_CLK >> 1)) / DIVISOR_CLK; -+ shaper_para->ir_b = (ir * tick * (1 << ir_s_calc) + -+ (DIVISOR_CLK >> 1)) / DIVISOR_CLK; - } else { - /* - * Increasing the numerator to select ir_u value. ir_u_calc will -@@ -320,6 +317,10 @@ hns3_dcb_get_shapping_para(uint8_t ir_b, uint8_t ir_u, uint8_t ir_s, - { - uint32_t shapping_para = 0; - -+ /* If ir_b is zero it means IR is 0Mbps, return zero of shapping_para */ -+ if (ir_b == 0) -+ return shapping_para; -+ - hns3_dcb_set_field(shapping_para, IR_B, ir_b); - hns3_dcb_set_field(shapping_para, IR_U, ir_u); - hns3_dcb_set_field(shapping_para, IR_S, ir_s); -@@ -402,14 +403,57 @@ hns3_dcb_pg_shapping_cfg(struct hns3_hw *hw, enum hns3_shap_bucket bucket, - return hns3_cmd_send(hw, &desc, 1); - } - --static int --hns3_dcb_pg_shaper_cfg(struct hns3_hw *hw) -+int -+hns3_pg_shaper_rate_cfg(struct hns3_hw *hw, uint8_t pg_id, uint32_t rate) - { -- struct hns3_adapter *hns = HNS3_DEV_HW_TO_ADAPTER(hw); - struct hns3_shaper_parameter shaper_parameter; -- struct hns3_pf *pf = &hns->pf; - uint32_t ir_u, ir_b, ir_s; - uint32_t shaper_para; -+ int ret; -+ -+ /* Calc shaper para */ -+ ret = hns3_shaper_para_calc(hw, rate, HNS3_SHAPER_LVL_PG, -+ &shaper_parameter); -+ if (ret) { -+ hns3_err(hw, "calculate shaper parameter fail, ret = %d.", -+ ret); -+ return ret; -+ } -+ -+ shaper_para = hns3_dcb_get_shapping_para(0, 0, 0, -+ HNS3_SHAPER_BS_U_DEF, -+ HNS3_SHAPER_BS_S_DEF); -+ -+ ret = hns3_dcb_pg_shapping_cfg(hw, HNS3_DCB_SHAP_C_BUCKET, pg_id, -+ shaper_para, rate); -+ if (ret) { -+ hns3_err(hw, "config PG CIR shaper parameter fail, ret = %d.", -+ ret); -+ return ret; -+ } -+ -+ ir_b = shaper_parameter.ir_b; -+ ir_u = shaper_parameter.ir_u; -+ ir_s = shaper_parameter.ir_s; -+ shaper_para = hns3_dcb_get_shapping_para(ir_b, ir_u, ir_s, -+ HNS3_SHAPER_BS_U_DEF, -+ HNS3_SHAPER_BS_S_DEF); -+ -+ ret = hns3_dcb_pg_shapping_cfg(hw, HNS3_DCB_SHAP_P_BUCKET, pg_id, -+ shaper_para, rate); -+ if (ret) { -+ hns3_err(hw, "config PG PIR shaper parameter fail, ret = %d.", -+ ret); -+ return ret; -+ } -+ -+ return 0; -+} -+ -+static int -+hns3_dcb_pg_shaper_cfg(struct hns3_hw *hw) -+{ -+ struct hns3_pf *pf = HNS3_DEV_HW_TO_PF(hw); - uint32_t rate; - uint8_t i; - int ret; -@@ -421,44 +465,9 @@ hns3_dcb_pg_shaper_cfg(struct hns3_hw *hw) - /* Pg to pri */ - for (i = 0; i < hw->dcb_info.num_pg; i++) { - rate = hw->dcb_info.pg_info[i].bw_limit; -- -- /* Calc shaper para */ -- ret = hns3_shaper_para_calc(hw, rate, HNS3_SHAPER_LVL_PG, -- &shaper_parameter); -- if (ret) { -- hns3_err(hw, "calculate shaper parameter failed: %d", -- ret); -- return ret; -- } -- -- shaper_para = hns3_dcb_get_shapping_para(0, 0, 0, -- HNS3_SHAPER_BS_U_DEF, -- HNS3_SHAPER_BS_S_DEF); -- -- ret = hns3_dcb_pg_shapping_cfg(hw, HNS3_DCB_SHAP_C_BUCKET, i, -- shaper_para, rate); -- if (ret) { -- hns3_err(hw, -- "config PG CIR shaper parameter failed: %d", -- ret); -- return ret; -- } -- -- ir_b = shaper_parameter.ir_b; -- ir_u = shaper_parameter.ir_u; -- ir_s = shaper_parameter.ir_s; -- shaper_para = hns3_dcb_get_shapping_para(ir_b, ir_u, ir_s, -- HNS3_SHAPER_BS_U_DEF, -- HNS3_SHAPER_BS_S_DEF); -- -- ret = hns3_dcb_pg_shapping_cfg(hw, HNS3_DCB_SHAP_P_BUCKET, i, -- shaper_para, rate); -- if (ret) { -- hns3_err(hw, -- "config PG PIR shaper parameter failed: %d", -- ret); -+ ret = hns3_pg_shaper_rate_cfg(hw, i, rate); -+ if (ret) - return ret; -- } - } - - return 0; -@@ -530,74 +539,75 @@ hns3_dcb_pri_shapping_cfg(struct hns3_hw *hw, enum hns3_shap_bucket bucket, - return hns3_cmd_send(hw, &desc, 1); - } - --static int --hns3_dcb_pri_tc_base_shaper_cfg(struct hns3_hw *hw) -+int -+hns3_pri_shaper_rate_cfg(struct hns3_hw *hw, uint8_t tc_no, uint32_t rate) - { - struct hns3_shaper_parameter shaper_parameter; - uint32_t ir_u, ir_b, ir_s; - uint32_t shaper_para; -- uint32_t rate; -- int ret, i; -+ int ret; - -- for (i = 0; i < hw->dcb_info.num_tc; i++) { -- rate = hw->dcb_info.tc_info[i].bw_limit; -- ret = hns3_shaper_para_calc(hw, rate, HNS3_SHAPER_LVL_PRI, -- &shaper_parameter); -- if (ret) { -- hns3_err(hw, "calculate shaper parameter failed: %d", -- ret); -- return ret; -- } -+ ret = hns3_shaper_para_calc(hw, rate, HNS3_SHAPER_LVL_PRI, -+ &shaper_parameter); -+ if (ret) { -+ hns3_err(hw, "calculate shaper parameter failed: %d.", -+ ret); -+ return ret; -+ } - -- shaper_para = hns3_dcb_get_shapping_para(0, 0, 0, -- HNS3_SHAPER_BS_U_DEF, -- HNS3_SHAPER_BS_S_DEF); -+ shaper_para = hns3_dcb_get_shapping_para(0, 0, 0, -+ HNS3_SHAPER_BS_U_DEF, -+ HNS3_SHAPER_BS_S_DEF); - -- ret = hns3_dcb_pri_shapping_cfg(hw, HNS3_DCB_SHAP_C_BUCKET, i, -- shaper_para, rate); -- if (ret) { -- hns3_err(hw, -- "config priority CIR shaper parameter failed: %d", -- ret); -- return ret; -- } -+ ret = hns3_dcb_pri_shapping_cfg(hw, HNS3_DCB_SHAP_C_BUCKET, tc_no, -+ shaper_para, rate); -+ if (ret) { -+ hns3_err(hw, -+ "config priority CIR shaper parameter failed: %d.", -+ ret); -+ return ret; -+ } - -- ir_b = shaper_parameter.ir_b; -- ir_u = shaper_parameter.ir_u; -- ir_s = shaper_parameter.ir_s; -- shaper_para = hns3_dcb_get_shapping_para(ir_b, ir_u, ir_s, -- HNS3_SHAPER_BS_U_DEF, -- HNS3_SHAPER_BS_S_DEF); -+ ir_b = shaper_parameter.ir_b; -+ ir_u = shaper_parameter.ir_u; -+ ir_s = shaper_parameter.ir_s; -+ shaper_para = hns3_dcb_get_shapping_para(ir_b, ir_u, ir_s, -+ HNS3_SHAPER_BS_U_DEF, -+ HNS3_SHAPER_BS_S_DEF); - -- ret = hns3_dcb_pri_shapping_cfg(hw, HNS3_DCB_SHAP_P_BUCKET, i, -- shaper_para, rate); -- if (ret) { -- hns3_err(hw, -- "config priority PIR shaper parameter failed: %d", -- ret); -- return ret; -- } -+ ret = hns3_dcb_pri_shapping_cfg(hw, HNS3_DCB_SHAP_P_BUCKET, tc_no, -+ shaper_para, rate); -+ if (ret) { -+ hns3_err(hw, -+ "config priority PIR shaper parameter failed: %d.", -+ ret); -+ return ret; - } - - return 0; - } - -- - static int - hns3_dcb_pri_shaper_cfg(struct hns3_hw *hw) - { -- struct hns3_adapter *hns = HNS3_DEV_HW_TO_ADAPTER(hw); -- struct hns3_pf *pf = &hns->pf; -+ struct hns3_pf *pf = HNS3_DEV_HW_TO_PF(hw); -+ uint32_t rate; -+ uint8_t i; - int ret; - - if (pf->tx_sch_mode != HNS3_FLAG_TC_BASE_SCH_MODE) - return -EINVAL; - -- ret = hns3_dcb_pri_tc_base_shaper_cfg(hw); -- if (ret) -- hns3_err(hw, "config port shaper failed: %d", ret); -+ for (i = 0; i < hw->dcb_info.num_tc; i++) { -+ rate = hw->dcb_info.tc_info[i].bw_limit; -+ ret = hns3_pri_shaper_rate_cfg(hw, i, rate); -+ if (ret) { -+ hns3_err(hw, "config pri shaper failed: %d.", ret); -+ return ret; -+ } -+ } - -- return ret; -+ return 0; - } - - static int -@@ -680,6 +690,26 @@ hns3_tc_queue_mapping_cfg(struct hns3_hw *hw, uint16_t nb_tx_q) - return 0; - } - -+uint8_t -+hns3_txq_mapped_tc_get(struct hns3_hw *hw, uint16_t txq_no) -+{ -+ struct hns3_tc_queue_info *tc_queue; -+ uint8_t i; -+ -+ for (i = 0; i < HNS3_MAX_TC_NUM; i++) { -+ tc_queue = &hw->tc_queue[i]; -+ if (!tc_queue->enable) -+ continue; -+ -+ if (txq_no >= tc_queue->tqp_offset && -+ txq_no < tc_queue->tqp_offset + tc_queue->tqp_count) -+ return i; -+ } -+ -+ /* return TC0 in default case */ -+ return 0; -+} -+ - int - hns3_queue_to_tc_mapping(struct hns3_hw *hw, uint16_t nb_rx_q, uint16_t nb_tx_q) - { -diff --git a/drivers/net/hns3/hns3_dcb.h b/drivers/net/hns3/hns3_dcb.h -index fee23d9..8248434 100644 ---- a/drivers/net/hns3/hns3_dcb.h -+++ b/drivers/net/hns3/hns3_dcb.h -@@ -209,5 +209,8 @@ int hns3_queue_to_tc_mapping(struct hns3_hw *hw, uint16_t nb_rx_q, - - int hns3_dcb_cfg_update(struct hns3_adapter *hns); - int hns3_dcb_port_shaper_cfg(struct hns3_hw *hw); -+int hns3_pg_shaper_rate_cfg(struct hns3_hw *hw, uint8_t pg_id, uint32_t rate); -+int hns3_pri_shaper_rate_cfg(struct hns3_hw *hw, uint8_t tc_no, uint32_t rate); -+uint8_t hns3_txq_mapped_tc_get(struct hns3_hw *hw, uint16_t txq_no); - - #endif /* _HNS3_DCB_H_ */ -diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c -index d0d1d3a..2bc28ef 100644 ---- a/drivers/net/hns3/hns3_ethdev.c -+++ b/drivers/net/hns3/hns3_ethdev.c -@@ -5,7 +5,6 @@ - #include - #include - #include --#include - #include - - #include "hns3_ethdev.h" -@@ -2494,7 +2493,7 @@ hns3_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) - return 0; - } - --static int -+int - hns3_dev_infos_get(struct rte_eth_dev *eth_dev, struct rte_eth_dev_info *info) - { - struct hns3_adapter *hns = eth_dev->data->dev_private; -@@ -4679,6 +4678,8 @@ hns3_init_pf(struct rte_eth_dev *eth_dev) - goto err_enable_intr; - } - -+ hns3_tm_conf_init(eth_dev); -+ - return 0; - - err_enable_intr: -@@ -4712,6 +4713,7 @@ hns3_uninit_pf(struct rte_eth_dev *eth_dev) - - PMD_INIT_FUNC_TRACE(); - -+ hns3_tm_conf_uninit(eth_dev); - hns3_enable_hw_error_intr(hns, false); - hns3_rss_uninit(hns); - (void)hns3_config_gro(hw, false); -@@ -4739,6 +4741,16 @@ hns3_do_start(struct hns3_adapter *hns, bool reset_queue) - if (ret) - return ret; - -+ /* -+ * The hns3_dcb_cfg_update may configure TM module, so -+ * hns3_tm_conf_update must called later. -+ */ -+ ret = hns3_tm_conf_update(hw); -+ if (ret) { -+ PMD_INIT_LOG(ERR, "failed to update tm conf, ret = %d.", ret); -+ return ret; -+ } -+ - ret = hns3_init_queues(hns, reset_queue); - if (ret) { - PMD_INIT_LOG(ERR, "failed to init queues, ret = %d.", ret); -@@ -4936,6 +4948,8 @@ hns3_dev_start(struct rte_eth_dev *dev) - */ - hns3_start_tqps(hw); - -+ hns3_tm_dev_start_proc(hw); -+ - hns3_info(hw, "hns3 dev start successful!"); - return 0; - } -@@ -5019,6 +5033,7 @@ hns3_dev_stop(struct rte_eth_dev *dev) - - rte_spinlock_lock(&hw->lock); - if (__atomic_load_n(&hw->reset.resetting, __ATOMIC_RELAXED) == 0) { -+ hns3_tm_dev_stop_proc(hw); - hns3_stop_tqps(hw); - hns3_do_stop(hns); - hns3_unmap_rx_interrupt(dev); -@@ -6089,6 +6104,7 @@ static const struct eth_dev_ops hns3_eth_dev_ops = { - .fec_get_capability = hns3_fec_get_capability, - .fec_get = hns3_fec_get, - .fec_set = hns3_fec_set, -+ .tm_ops_get = hns3_tm_ops_get, - }; - - static const struct hns3_reset_ops hns3_reset_ops = { -diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h -index 0d86683..0d17170 100644 ---- a/drivers/net/hns3/hns3_ethdev.h -+++ b/drivers/net/hns3/hns3_ethdev.h -@@ -7,12 +7,16 @@ - - #include - #include -+#include -+#include -+#include - - #include "hns3_cmd.h" - #include "hns3_mbx.h" - #include "hns3_rss.h" - #include "hns3_fdir.h" - #include "hns3_stats.h" -+#include "hns3_tm.h" - - /* Vendor ID */ - #define PCI_VENDOR_ID_HUAWEI 0x19e5 -@@ -727,6 +731,8 @@ struct hns3_pf { - - struct hns3_fdir_info fdir; /* flow director info */ - LIST_HEAD(counters, hns3_flow_counter) flow_counters; -+ -+ struct hns3_tm_conf tm_conf; - }; - - struct hns3_vf { -@@ -796,6 +802,12 @@ struct hns3_adapter { - #define HNS3_DEV_HW_TO_ADAPTER(hw) \ - container_of(hw, struct hns3_adapter, hw) - -+static inline struct hns3_pf *HNS3_DEV_HW_TO_PF(struct hns3_hw *hw) -+{ -+ struct hns3_adapter *adapter = HNS3_DEV_HW_TO_ADAPTER(hw); -+ return &adapter->pf; -+} -+ - #define hns3_set_field(origin, mask, shift, val) \ - do { \ - (origin) &= (~(mask)); \ -@@ -937,6 +949,8 @@ bool hns3vf_is_reset_pending(struct hns3_adapter *hns); - void hns3_update_link_status(struct hns3_hw *hw); - void hns3_ether_format_addr(char *buf, uint16_t size, - const struct rte_ether_addr *ether_addr); -+int hns3_dev_infos_get(struct rte_eth_dev *eth_dev, -+ struct rte_eth_dev_info *info); - - static inline bool - is_reset_pending(struct hns3_adapter *hns) -diff --git a/drivers/net/hns3/hns3_tm.c b/drivers/net/hns3/hns3_tm.c -new file mode 100644 -index 0000000..d1639d4 ---- /dev/null -+++ b/drivers/net/hns3/hns3_tm.c -@@ -0,0 +1,1291 @@ -+/* SPDX-License-Identifier: BSD-3-Clause -+ * Copyright(c) 2020-2020 Hisilicon Limited. -+ */ -+ -+#include -+ -+#include "hns3_ethdev.h" -+#include "hns3_dcb.h" -+#include "hns3_logs.h" -+#include "hns3_tm.h" -+ -+static inline uint32_t -+hns3_tm_max_tx_queues_get(struct rte_eth_dev *dev) -+{ -+ /* -+ * This API will called in pci device probe stage, we can't call -+ * rte_eth_dev_info_get to get max_tx_queues (due to rte_eth_devices -+ * not setup), so we call the hns3_dev_infos_get. -+ */ -+ struct rte_eth_dev_info dev_info; -+ -+ memset(&dev_info, 0, sizeof(dev_info)); -+ (void)hns3_dev_infos_get(dev, &dev_info); -+ return RTE_MIN(dev_info.max_tx_queues, RTE_MAX_QUEUES_PER_PORT); -+} -+ -+void -+hns3_tm_conf_init(struct rte_eth_dev *dev) -+{ -+ struct hns3_pf *pf = HNS3_DEV_PRIVATE_TO_PF(dev->data->dev_private); -+ uint32_t max_tx_queues = hns3_tm_max_tx_queues_get(dev); -+ -+ pf->tm_conf.nb_leaf_nodes_max = max_tx_queues; -+ pf->tm_conf.nb_nodes_max = 1 + HNS3_MAX_TC_NUM + max_tx_queues; -+ pf->tm_conf.nb_shaper_profile_max = 1 + HNS3_MAX_TC_NUM; -+ -+ TAILQ_INIT(&pf->tm_conf.shaper_profile_list); -+ pf->tm_conf.nb_shaper_profile = 0; -+ -+ pf->tm_conf.root = NULL; -+ TAILQ_INIT(&pf->tm_conf.tc_list); -+ TAILQ_INIT(&pf->tm_conf.queue_list); -+ pf->tm_conf.nb_tc_node = 0; -+ pf->tm_conf.nb_queue_node = 0; -+ -+ pf->tm_conf.committed = false; -+} -+ -+void -+hns3_tm_conf_uninit(struct rte_eth_dev *dev) -+{ -+ struct hns3_pf *pf = HNS3_DEV_PRIVATE_TO_PF(dev->data->dev_private); -+ struct hns3_tm_shaper_profile *shaper_profile; -+ struct hns3_tm_node *tm_node; -+ -+ if (pf->tm_conf.nb_queue_node > 0) { -+ while ((tm_node = TAILQ_FIRST(&pf->tm_conf.queue_list))) { -+ TAILQ_REMOVE(&pf->tm_conf.queue_list, tm_node, node); -+ rte_free(tm_node); -+ } -+ pf->tm_conf.nb_queue_node = 0; -+ } -+ -+ if (pf->tm_conf.nb_tc_node > 0) { -+ while ((tm_node = TAILQ_FIRST(&pf->tm_conf.tc_list))) { -+ TAILQ_REMOVE(&pf->tm_conf.tc_list, tm_node, node); -+ rte_free(tm_node); -+ } -+ pf->tm_conf.nb_tc_node = 0; -+ } -+ -+ if (pf->tm_conf.root != NULL) { -+ rte_free(pf->tm_conf.root); -+ pf->tm_conf.root = NULL; -+ } -+ -+ if (pf->tm_conf.nb_shaper_profile > 0) { -+ while ((shaper_profile = -+ TAILQ_FIRST(&pf->tm_conf.shaper_profile_list))) { -+ TAILQ_REMOVE(&pf->tm_conf.shaper_profile_list, -+ shaper_profile, node); -+ rte_free(shaper_profile); -+ } -+ pf->tm_conf.nb_shaper_profile = 0; -+ } -+ -+ pf->tm_conf.nb_leaf_nodes_max = 0; -+ pf->tm_conf.nb_nodes_max = 0; -+ pf->tm_conf.nb_shaper_profile_max = 0; -+} -+ -+static inline uint64_t -+hns3_tm_rate_convert_firmware2tm(uint32_t firmware_rate) -+{ -+#define FIRMWARE_TO_TM_RATE_SCALE 125000 -+ /* tm rate unit is Bps, firmware rate is Mbps */ -+ return ((uint64_t)firmware_rate) * FIRMWARE_TO_TM_RATE_SCALE; -+} -+ -+static inline uint32_t -+hns3_tm_rate_convert_tm2firmware(uint64_t tm_rate) -+{ -+#define TM_TO_FIRMWARE_RATE_SCALE 125000 -+ /* tm rate unit is Bps, firmware rate is Mbps */ -+ return (uint32_t)(tm_rate / TM_TO_FIRMWARE_RATE_SCALE); -+} -+ -+static int -+hns3_tm_capabilities_get(struct rte_eth_dev *dev, -+ struct rte_tm_capabilities *cap, -+ struct rte_tm_error *error) -+{ -+ struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private); -+ uint32_t max_tx_queues = hns3_tm_max_tx_queues_get(dev); -+ -+ if (cap == NULL || error == NULL) -+ return -EINVAL; -+ -+ error->type = RTE_TM_ERROR_TYPE_NONE; -+ -+ memset(cap, 0, sizeof(struct rte_tm_capabilities)); -+ -+ cap->n_nodes_max = 1 + HNS3_MAX_TC_NUM + max_tx_queues; -+ cap->n_levels_max = HNS3_TM_NODE_LEVEL_MAX; -+ cap->non_leaf_nodes_identical = 1; -+ cap->leaf_nodes_identical = 1; -+ cap->shaper_n_max = 1 + HNS3_MAX_TC_NUM; -+ cap->shaper_private_n_max = 1 + HNS3_MAX_TC_NUM; -+ cap->shaper_private_dual_rate_n_max = 0; -+ cap->shaper_private_rate_min = 0; -+ cap->shaper_private_rate_max = -+ hns3_tm_rate_convert_firmware2tm(hw->max_tm_rate); -+ cap->shaper_shared_n_max = 0; -+ cap->shaper_shared_n_nodes_per_shaper_max = 0; -+ cap->shaper_shared_n_shapers_per_node_max = 0; -+ cap->shaper_shared_dual_rate_n_max = 0; -+ cap->shaper_shared_rate_min = 0; -+ cap->shaper_shared_rate_max = 0; -+ -+ cap->sched_n_children_max = max_tx_queues; -+ cap->sched_sp_n_priorities_max = 1; -+ cap->sched_wfq_n_children_per_group_max = 0; -+ cap->sched_wfq_n_groups_max = 0; -+ cap->sched_wfq_weight_max = 1; -+ -+ cap->cman_head_drop_supported = 0; -+ cap->dynamic_update_mask = 0; -+ cap->shaper_pkt_length_adjust_min = RTE_TM_ETH_FRAMING_OVERHEAD; -+ cap->shaper_pkt_length_adjust_max = RTE_TM_ETH_FRAMING_OVERHEAD_FCS; -+ cap->cman_wred_context_n_max = 0; -+ cap->cman_wred_context_private_n_max = 0; -+ cap->cman_wred_context_shared_n_max = 0; -+ cap->cman_wred_context_shared_n_nodes_per_context_max = 0; -+ cap->cman_wred_context_shared_n_contexts_per_node_max = 0; -+ cap->stats_mask = 0; -+ -+ return 0; -+} -+ -+static struct hns3_tm_shaper_profile * -+hns3_tm_shaper_profile_search(struct rte_eth_dev *dev, -+ uint32_t shaper_profile_id) -+{ -+ struct hns3_pf *pf = HNS3_DEV_PRIVATE_TO_PF(dev->data->dev_private); -+ struct hns3_shaper_profile_list *shaper_profile_list = -+ &pf->tm_conf.shaper_profile_list; -+ struct hns3_tm_shaper_profile *shaper_profile; -+ -+ TAILQ_FOREACH(shaper_profile, shaper_profile_list, node) { -+ if (shaper_profile_id == shaper_profile->shaper_profile_id) -+ return shaper_profile; -+ } -+ -+ return NULL; -+} -+ -+static int -+hns3_tm_shaper_profile_param_check(struct rte_eth_dev *dev, -+ struct rte_tm_shaper_params *profile, -+ struct rte_tm_error *error) -+{ -+ struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private); -+ -+ if (profile->committed.rate) { -+ error->type = RTE_TM_ERROR_TYPE_SHAPER_PROFILE_COMMITTED_RATE; -+ error->message = "committed rate not supported"; -+ return -EINVAL; -+ } -+ -+ if (profile->committed.size) { -+ error->type = RTE_TM_ERROR_TYPE_SHAPER_PROFILE_COMMITTED_SIZE; -+ error->message = "committed bucket size not supported"; -+ return -EINVAL; -+ } -+ -+ if (profile->peak.rate > -+ hns3_tm_rate_convert_firmware2tm(hw->max_tm_rate)) { -+ error->type = RTE_TM_ERROR_TYPE_SHAPER_PROFILE_PEAK_RATE; -+ error->message = "peak rate too large"; -+ return -EINVAL; -+ } -+ -+ if (profile->peak.size) { -+ error->type = RTE_TM_ERROR_TYPE_SHAPER_PROFILE_PEAK_SIZE; -+ error->message = "peak bucket size not supported"; -+ return -EINVAL; -+ } -+ -+ if (profile->pkt_length_adjust) { -+ error->type = RTE_TM_ERROR_TYPE_SHAPER_PROFILE_PKT_ADJUST_LEN; -+ error->message = "packet length adjustment not supported"; -+ return -EINVAL; -+ } -+ -+ if (profile->packet_mode) { -+ error->type = RTE_TM_ERROR_TYPE_SHAPER_PROFILE_PACKET_MODE; -+ error->message = "packet mode not supported"; -+ return -EINVAL; -+ } -+ -+ return 0; -+} -+ -+static int -+hns3_tm_shaper_profile_add(struct rte_eth_dev *dev, -+ uint32_t shaper_profile_id, -+ struct rte_tm_shaper_params *profile, -+ struct rte_tm_error *error) -+{ -+ struct hns3_pf *pf = HNS3_DEV_PRIVATE_TO_PF(dev->data->dev_private); -+ struct hns3_tm_shaper_profile *shaper_profile; -+ int ret; -+ -+ if (profile == NULL || error == NULL) -+ return -EINVAL; -+ -+ if (pf->tm_conf.nb_shaper_profile >= -+ pf->tm_conf.nb_shaper_profile_max) { -+ error->type = RTE_TM_ERROR_TYPE_UNSPECIFIED; -+ error->message = "too much profiles"; -+ return -EINVAL; -+ } -+ -+ ret = hns3_tm_shaper_profile_param_check(dev, profile, error); -+ if (ret) -+ return ret; -+ -+ shaper_profile = hns3_tm_shaper_profile_search(dev, shaper_profile_id); -+ if (shaper_profile) { -+ error->type = RTE_TM_ERROR_TYPE_SHAPER_PROFILE_ID; -+ error->message = "profile ID exist"; -+ return -EINVAL; -+ } -+ -+ shaper_profile = rte_zmalloc("hns3_tm_shaper_profile", -+ sizeof(struct hns3_tm_shaper_profile), -+ 0); -+ if (shaper_profile == NULL) -+ return -ENOMEM; -+ -+ shaper_profile->shaper_profile_id = shaper_profile_id; -+ memcpy(&shaper_profile->profile, profile, -+ sizeof(struct rte_tm_shaper_params)); -+ TAILQ_INSERT_TAIL(&pf->tm_conf.shaper_profile_list, -+ shaper_profile, node); -+ pf->tm_conf.nb_shaper_profile++; -+ -+ return 0; -+} -+ -+static int -+hns3_tm_shaper_profile_del(struct rte_eth_dev *dev, -+ uint32_t shaper_profile_id, -+ struct rte_tm_error *error) -+{ -+ struct hns3_pf *pf = HNS3_DEV_PRIVATE_TO_PF(dev->data->dev_private); -+ struct hns3_tm_shaper_profile *shaper_profile; -+ -+ if (error == NULL) -+ return -EINVAL; -+ -+ shaper_profile = hns3_tm_shaper_profile_search(dev, shaper_profile_id); -+ if (shaper_profile == NULL) { -+ error->type = RTE_TM_ERROR_TYPE_SHAPER_PROFILE_ID; -+ error->message = "profile ID not exist"; -+ return -EINVAL; -+ } -+ -+ if (shaper_profile->reference_count) { -+ error->type = RTE_TM_ERROR_TYPE_SHAPER_PROFILE; -+ error->message = "profile in use"; -+ return -EINVAL; -+ } -+ -+ TAILQ_REMOVE(&pf->tm_conf.shaper_profile_list, shaper_profile, node); -+ rte_free(shaper_profile); -+ pf->tm_conf.nb_shaper_profile--; -+ -+ return 0; -+} -+ -+static struct hns3_tm_node * -+hns3_tm_node_search(struct rte_eth_dev *dev, -+ uint32_t node_id, -+ enum hns3_tm_node_type *node_type) -+{ -+ struct hns3_pf *pf = HNS3_DEV_PRIVATE_TO_PF(dev->data->dev_private); -+ struct hns3_tm_node_list *queue_list = &pf->tm_conf.queue_list; -+ struct hns3_tm_node_list *tc_list = &pf->tm_conf.tc_list; -+ struct hns3_tm_node *tm_node; -+ -+ if (pf->tm_conf.root && pf->tm_conf.root->id == node_id) { -+ *node_type = HNS3_TM_NODE_TYPE_PORT; -+ return pf->tm_conf.root; -+ } -+ -+ TAILQ_FOREACH(tm_node, tc_list, node) { -+ if (tm_node->id == node_id) { -+ *node_type = HNS3_TM_NODE_TYPE_TC; -+ return tm_node; -+ } -+ } -+ -+ TAILQ_FOREACH(tm_node, queue_list, node) { -+ if (tm_node->id == node_id) { -+ *node_type = HNS3_TM_NODE_TYPE_QUEUE; -+ return tm_node; -+ } -+ } -+ -+ return NULL; -+} -+ -+static int -+hns3_tm_nonleaf_node_param_check(struct rte_eth_dev *dev, -+ struct rte_tm_node_params *params, -+ struct rte_tm_error *error) -+{ -+ struct hns3_tm_shaper_profile *shaper_profile; -+ -+ if (params->shaper_profile_id != RTE_TM_SHAPER_PROFILE_ID_NONE) { -+ shaper_profile = hns3_tm_shaper_profile_search(dev, -+ params->shaper_profile_id); -+ if (shaper_profile == NULL) { -+ error->type = -+ RTE_TM_ERROR_TYPE_NODE_PARAMS_SHAPER_PROFILE_ID; -+ error->message = "shaper profile not exist"; -+ return -EINVAL; -+ } -+ } -+ -+ if (params->nonleaf.wfq_weight_mode) { -+ error->type = -+ RTE_TM_ERROR_TYPE_NODE_PARAMS_WFQ_WEIGHT_MODE; -+ error->message = "WFQ not supported"; -+ return -EINVAL; -+ } -+ -+ if (params->nonleaf.n_sp_priorities != 1) { -+ error->type = -+ RTE_TM_ERROR_TYPE_NODE_PARAMS_N_SP_PRIORITIES; -+ error->message = "SP priority not supported"; -+ return -EINVAL; -+ } -+ -+ return 0; -+} -+ -+static int -+hns3_tm_leaf_node_param_check(struct rte_eth_dev *dev __rte_unused, -+ struct rte_tm_node_params *params, -+ struct rte_tm_error *error) -+ -+{ -+ if (params->shaper_profile_id != RTE_TM_SHAPER_PROFILE_ID_NONE) { -+ error->type = -+ RTE_TM_ERROR_TYPE_NODE_PARAMS_SHAPER_PROFILE_ID; -+ error->message = "shaper not supported"; -+ return -EINVAL; -+ } -+ -+ if (params->leaf.cman) { -+ error->type = RTE_TM_ERROR_TYPE_NODE_PARAMS_CMAN; -+ error->message = "congestion management not supported"; -+ return -EINVAL; -+ } -+ -+ if (params->leaf.wred.wred_profile_id != RTE_TM_WRED_PROFILE_ID_NONE) { -+ error->type = -+ RTE_TM_ERROR_TYPE_NODE_PARAMS_WRED_PROFILE_ID; -+ error->message = "WRED not supported"; -+ return -EINVAL; -+ } -+ -+ if (params->leaf.wred.shared_wred_context_id) { -+ error->type = -+ RTE_TM_ERROR_TYPE_NODE_PARAMS_SHARED_WRED_CONTEXT_ID; -+ error->message = "WRED not supported"; -+ return -EINVAL; -+ } -+ -+ if (params->leaf.wred.n_shared_wred_contexts) { -+ error->type = -+ RTE_TM_ERROR_TYPE_NODE_PARAMS_N_SHARED_WRED_CONTEXTS; -+ error->message = "WRED not supported"; -+ return -EINVAL; -+ } -+ -+ return 0; -+} -+ -+static int -+hns3_tm_node_param_check(struct rte_eth_dev *dev, uint32_t node_id, -+ uint32_t priority, uint32_t weight, -+ struct rte_tm_node_params *params, -+ struct rte_tm_error *error) -+{ -+ struct hns3_pf *pf = HNS3_DEV_PRIVATE_TO_PF(dev->data->dev_private); -+ enum hns3_tm_node_type node_type = HNS3_TM_NODE_TYPE_MAX; -+ -+ if (node_id == RTE_TM_NODE_ID_NULL) { -+ error->type = RTE_TM_ERROR_TYPE_NODE_ID; -+ error->message = "invalid node id"; -+ return -EINVAL; -+ } -+ -+ if (hns3_tm_node_search(dev, node_id, &node_type)) { -+ error->type = RTE_TM_ERROR_TYPE_NODE_ID; -+ error->message = "node id already used"; -+ return -EINVAL; -+ } -+ -+ if (priority) { -+ error->type = RTE_TM_ERROR_TYPE_NODE_PRIORITY; -+ error->message = "priority should be 0"; -+ return -EINVAL; -+ } -+ -+ if (weight != 1) { -+ error->type = RTE_TM_ERROR_TYPE_NODE_WEIGHT; -+ error->message = "weight must be 1"; -+ return -EINVAL; -+ } -+ -+ if (params->shared_shaper_id) { -+ error->type = RTE_TM_ERROR_TYPE_NODE_PARAMS_SHARED_SHAPER_ID; -+ error->message = "shared shaper not supported"; -+ return -EINVAL; -+ } -+ if (params->n_shared_shapers) { -+ error->type = RTE_TM_ERROR_TYPE_NODE_PARAMS_N_SHARED_SHAPERS; -+ error->message = "shared shaper not supported"; -+ return -EINVAL; -+ } -+ -+ if (node_id >= pf->tm_conf.nb_leaf_nodes_max) -+ return hns3_tm_nonleaf_node_param_check(dev, params, error); -+ else -+ return hns3_tm_leaf_node_param_check(dev, params, error); -+} -+ -+static int -+hns3_tm_port_node_add(struct rte_eth_dev *dev, uint32_t node_id, -+ uint32_t level_id, struct rte_tm_node_params *params, -+ struct rte_tm_error *error) -+{ -+ struct hns3_pf *pf = HNS3_DEV_PRIVATE_TO_PF(dev->data->dev_private); -+ struct hns3_tm_node *tm_node; -+ -+ if (level_id != RTE_TM_NODE_LEVEL_ID_ANY && -+ level_id != HNS3_TM_NODE_LEVEL_PORT) { -+ error->type = RTE_TM_ERROR_TYPE_NODE_PARAMS; -+ error->message = "wrong level"; -+ return -EINVAL; -+ } -+ -+ if (node_id != pf->tm_conf.nb_nodes_max - 1) { -+ error->type = RTE_TM_ERROR_TYPE_NODE_ID; -+ error->message = "invalid port node ID"; -+ return -EINVAL; -+ } -+ -+ if (pf->tm_conf.root) { -+ error->type = RTE_TM_ERROR_TYPE_NODE_PARENT_NODE_ID; -+ error->message = "already have a root"; -+ return -EINVAL; -+ } -+ -+ tm_node = rte_zmalloc("hns3_tm_node", sizeof(struct hns3_tm_node), 0); -+ if (tm_node == NULL) -+ return -ENOMEM; -+ -+ tm_node->id = node_id; -+ tm_node->reference_count = 0; -+ tm_node->parent = NULL; -+ tm_node->shaper_profile = hns3_tm_shaper_profile_search(dev, -+ params->shaper_profile_id); -+ memcpy(&tm_node->params, params, sizeof(struct rte_tm_node_params)); -+ pf->tm_conf.root = tm_node; -+ -+ if (tm_node->shaper_profile) -+ tm_node->shaper_profile->reference_count++; -+ -+ return 0; -+} -+ -+static int -+hns3_tm_tc_node_add(struct rte_eth_dev *dev, uint32_t node_id, -+ uint32_t level_id, struct hns3_tm_node *parent_node, -+ struct rte_tm_node_params *params, -+ struct rte_tm_error *error) -+{ -+ struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private); -+ struct hns3_pf *pf = HNS3_DEV_PRIVATE_TO_PF(dev->data->dev_private); -+ struct hns3_tm_node *tm_node; -+ -+ if (level_id != RTE_TM_NODE_LEVEL_ID_ANY && -+ level_id != HNS3_TM_NODE_LEVEL_TC) { -+ error->type = RTE_TM_ERROR_TYPE_NODE_PARAMS; -+ error->message = "wrong level"; -+ return -EINVAL; -+ } -+ -+ if (node_id >= pf->tm_conf.nb_nodes_max - 1 || -+ node_id < pf->tm_conf.nb_leaf_nodes_max || -+ hns3_tm_calc_node_tc_no(&pf->tm_conf, node_id) >= hw->num_tc) { -+ error->type = RTE_TM_ERROR_TYPE_NODE_ID; -+ error->message = "invalid tc node ID"; -+ return -EINVAL; -+ } -+ -+ if (pf->tm_conf.nb_tc_node >= hw->num_tc) { -+ error->type = RTE_TM_ERROR_TYPE_NODE_ID; -+ error->message = "too many TCs"; -+ return -EINVAL; -+ } -+ -+ tm_node = rte_zmalloc("hns3_tm_node", sizeof(struct hns3_tm_node), 0); -+ if (tm_node == NULL) -+ return -ENOMEM; -+ -+ tm_node->id = node_id; -+ tm_node->reference_count = 0; -+ tm_node->parent = parent_node; -+ tm_node->shaper_profile = hns3_tm_shaper_profile_search(dev, -+ params->shaper_profile_id); -+ memcpy(&tm_node->params, params, sizeof(struct rte_tm_node_params)); -+ TAILQ_INSERT_TAIL(&pf->tm_conf.tc_list, tm_node, node); -+ pf->tm_conf.nb_tc_node++; -+ tm_node->parent->reference_count++; -+ -+ if (tm_node->shaper_profile) -+ tm_node->shaper_profile->reference_count++; -+ -+ return 0; -+} -+ -+static int -+hns3_tm_queue_node_add(struct rte_eth_dev *dev, uint32_t node_id, -+ uint32_t level_id, struct hns3_tm_node *parent_node, -+ struct rte_tm_node_params *params, -+ struct rte_tm_error *error) -+{ -+ struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private); -+ struct hns3_pf *pf = HNS3_DEV_PRIVATE_TO_PF(dev->data->dev_private); -+ struct hns3_tm_node *tm_node; -+ -+ if (level_id != RTE_TM_NODE_LEVEL_ID_ANY && -+ level_id != HNS3_TM_NODE_LEVEL_QUEUE) { -+ error->type = RTE_TM_ERROR_TYPE_NODE_PARAMS; -+ error->message = "wrong level"; -+ return -EINVAL; -+ } -+ -+ /* note: dev->data->nb_tx_queues <= max_tx_queues */ -+ if (node_id >= dev->data->nb_tx_queues) { -+ error->type = RTE_TM_ERROR_TYPE_NODE_ID; -+ error->message = "invalid queue node ID"; -+ return -EINVAL; -+ } -+ -+ if (hns3_txq_mapped_tc_get(hw, node_id) != -+ hns3_tm_calc_node_tc_no(&pf->tm_conf, parent_node->id)) { -+ error->type = RTE_TM_ERROR_TYPE_NODE_ID; -+ error->message = "queue's TC not match parent's TC"; -+ return -EINVAL; -+ } -+ -+ tm_node = rte_zmalloc("hns3_tm_node", sizeof(struct hns3_tm_node), 0); -+ if (tm_node == NULL) -+ return -ENOMEM; -+ -+ tm_node->id = node_id; -+ tm_node->reference_count = 0; -+ tm_node->parent = parent_node; -+ memcpy(&tm_node->params, params, sizeof(struct rte_tm_node_params)); -+ TAILQ_INSERT_TAIL(&pf->tm_conf.queue_list, tm_node, node); -+ pf->tm_conf.nb_queue_node++; -+ tm_node->parent->reference_count++; -+ -+ return 0; -+} -+ -+static int -+hns3_tm_node_add(struct rte_eth_dev *dev, uint32_t node_id, -+ uint32_t parent_node_id, uint32_t priority, -+ uint32_t weight, uint32_t level_id, -+ struct rte_tm_node_params *params, -+ struct rte_tm_error *error) -+{ -+ struct hns3_pf *pf = HNS3_DEV_PRIVATE_TO_PF(dev->data->dev_private); -+ enum hns3_tm_node_type parent_node_type = HNS3_TM_NODE_TYPE_MAX; -+ struct hns3_tm_node *parent_node; -+ int ret; -+ -+ if (params == NULL || error == NULL) -+ return -EINVAL; -+ -+ if (pf->tm_conf.committed) { -+ error->type = RTE_TM_ERROR_TYPE_UNSPECIFIED; -+ error->message = "already committed"; -+ return -EINVAL; -+ } -+ -+ ret = hns3_tm_node_param_check(dev, node_id, priority, weight, -+ params, error); -+ if (ret) -+ return ret; -+ -+ /* root node who don't have a parent */ -+ if (parent_node_id == RTE_TM_NODE_ID_NULL) -+ return hns3_tm_port_node_add(dev, node_id, level_id, -+ params, error); -+ -+ parent_node = hns3_tm_node_search(dev, parent_node_id, -+ &parent_node_type); -+ if (parent_node == NULL) { -+ error->type = RTE_TM_ERROR_TYPE_NODE_PARENT_NODE_ID; -+ error->message = "parent not exist"; -+ return -EINVAL; -+ } -+ -+ if (parent_node_type != HNS3_TM_NODE_TYPE_PORT && -+ parent_node_type != HNS3_TM_NODE_TYPE_TC) { -+ error->type = RTE_TM_ERROR_TYPE_NODE_PARENT_NODE_ID; -+ error->message = "parent is not port or TC"; -+ return -EINVAL; -+ } -+ -+ if (parent_node_type == HNS3_TM_NODE_TYPE_PORT) -+ return hns3_tm_tc_node_add(dev, node_id, level_id, -+ parent_node, params, error); -+ else -+ return hns3_tm_queue_node_add(dev, node_id, level_id, -+ parent_node, params, error); -+} -+ -+static void -+hns3_tm_node_do_delete(struct hns3_pf *pf, -+ enum hns3_tm_node_type node_type, -+ struct hns3_tm_node *tm_node) -+{ -+ if (node_type == HNS3_TM_NODE_TYPE_PORT) { -+ if (tm_node->shaper_profile) -+ tm_node->shaper_profile->reference_count--; -+ rte_free(tm_node); -+ pf->tm_conf.root = NULL; -+ return; -+ } -+ -+ if (tm_node->shaper_profile) -+ tm_node->shaper_profile->reference_count--; -+ tm_node->parent->reference_count--; -+ if (node_type == HNS3_TM_NODE_TYPE_TC) { -+ TAILQ_REMOVE(&pf->tm_conf.tc_list, tm_node, node); -+ pf->tm_conf.nb_tc_node--; -+ } else { -+ TAILQ_REMOVE(&pf->tm_conf.queue_list, tm_node, node); -+ pf->tm_conf.nb_queue_node--; -+ } -+ rte_free(tm_node); -+} -+ -+static int -+hns3_tm_node_delete(struct rte_eth_dev *dev, -+ uint32_t node_id, -+ struct rte_tm_error *error) -+{ -+ struct hns3_pf *pf = HNS3_DEV_PRIVATE_TO_PF(dev->data->dev_private); -+ enum hns3_tm_node_type node_type = HNS3_TM_NODE_TYPE_MAX; -+ struct hns3_tm_node *tm_node; -+ -+ if (error == NULL) -+ return -EINVAL; -+ -+ if (pf->tm_conf.committed) { -+ error->type = RTE_TM_ERROR_TYPE_UNSPECIFIED; -+ error->message = "already committed"; -+ return -EINVAL; -+ } -+ -+ tm_node = hns3_tm_node_search(dev, node_id, &node_type); -+ if (tm_node == NULL) { -+ error->type = RTE_TM_ERROR_TYPE_NODE_ID; -+ error->message = "no such node"; -+ return -EINVAL; -+ } -+ -+ if (tm_node->reference_count) { -+ error->type = RTE_TM_ERROR_TYPE_NODE_ID; -+ error->message = "cannot delete a node which has children"; -+ return -EINVAL; -+ } -+ -+ hns3_tm_node_do_delete(pf, node_type, tm_node); -+ -+ return 0; -+} -+ -+static int -+hns3_tm_node_type_get(struct rte_eth_dev *dev, uint32_t node_id, -+ int *is_leaf, struct rte_tm_error *error) -+{ -+ enum hns3_tm_node_type node_type = HNS3_TM_NODE_TYPE_MAX; -+ struct hns3_tm_node *tm_node; -+ -+ if (is_leaf == NULL || error == NULL) -+ return -EINVAL; -+ -+ tm_node = hns3_tm_node_search(dev, node_id, &node_type); -+ if (tm_node == NULL) { -+ error->type = RTE_TM_ERROR_TYPE_NODE_ID; -+ error->message = "no such node"; -+ return -EINVAL; -+ } -+ -+ if (node_type == HNS3_TM_NODE_TYPE_QUEUE) -+ *is_leaf = true; -+ else -+ *is_leaf = false; -+ -+ return 0; -+} -+ -+static void -+hns3_tm_nonleaf_level_capsbilities_get(struct rte_eth_dev *dev, -+ uint32_t level_id, -+ struct rte_tm_level_capabilities *cap) -+{ -+ struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private); -+ uint32_t max_tx_queues = hns3_tm_max_tx_queues_get(dev); -+ -+ if (level_id == HNS3_TM_NODE_LEVEL_PORT) { -+ cap->n_nodes_max = 1; -+ cap->n_nodes_nonleaf_max = 1; -+ cap->n_nodes_leaf_max = 0; -+ } else { -+ cap->n_nodes_max = HNS3_MAX_TC_NUM; -+ cap->n_nodes_nonleaf_max = HNS3_MAX_TC_NUM; -+ cap->n_nodes_leaf_max = 0; -+ } -+ -+ cap->non_leaf_nodes_identical = 1; -+ cap->leaf_nodes_identical = 1; -+ -+ cap->nonleaf.shaper_private_supported = true; -+ cap->nonleaf.shaper_private_dual_rate_supported = false; -+ cap->nonleaf.shaper_private_rate_min = 0; -+ cap->nonleaf.shaper_private_rate_max = -+ hns3_tm_rate_convert_firmware2tm(hw->max_tm_rate); -+ cap->nonleaf.shaper_shared_n_max = 0; -+ if (level_id == HNS3_TM_NODE_LEVEL_PORT) -+ cap->nonleaf.sched_n_children_max = HNS3_MAX_TC_NUM; -+ else -+ cap->nonleaf.sched_n_children_max = max_tx_queues; -+ cap->nonleaf.sched_sp_n_priorities_max = 1; -+ cap->nonleaf.sched_wfq_n_children_per_group_max = 0; -+ cap->nonleaf.sched_wfq_n_groups_max = 0; -+ cap->nonleaf.sched_wfq_weight_max = 1; -+ cap->nonleaf.stats_mask = 0; -+} -+ -+static void -+hns3_tm_leaf_level_capabilities_get(struct rte_eth_dev *dev, -+ struct rte_tm_level_capabilities *cap) -+{ -+ uint32_t max_tx_queues = hns3_tm_max_tx_queues_get(dev); -+ -+ cap->n_nodes_max = max_tx_queues; -+ cap->n_nodes_nonleaf_max = 0; -+ cap->n_nodes_leaf_max = max_tx_queues; -+ -+ cap->non_leaf_nodes_identical = 1; -+ cap->leaf_nodes_identical = 1; -+ -+ cap->leaf.shaper_private_supported = false; -+ cap->leaf.shaper_private_dual_rate_supported = false; -+ cap->leaf.shaper_private_rate_min = 0; -+ cap->leaf.shaper_private_rate_max = 0; -+ cap->leaf.shaper_shared_n_max = 0; -+ cap->leaf.cman_head_drop_supported = false; -+ cap->leaf.cman_wred_context_private_supported = false; -+ cap->leaf.cman_wred_context_shared_n_max = 0; -+ cap->leaf.stats_mask = 0; -+} -+ -+static int -+hns3_tm_level_capabilities_get(struct rte_eth_dev *dev, -+ uint32_t level_id, -+ struct rte_tm_level_capabilities *cap, -+ struct rte_tm_error *error) -+{ -+ if (cap == NULL || error == NULL) -+ return -EINVAL; -+ -+ if (level_id >= HNS3_TM_NODE_LEVEL_MAX) { -+ error->type = RTE_TM_ERROR_TYPE_LEVEL_ID; -+ error->message = "too deep level"; -+ return -EINVAL; -+ } -+ -+ memset(cap, 0, sizeof(struct rte_tm_level_capabilities)); -+ -+ if (level_id != HNS3_TM_NODE_LEVEL_QUEUE) -+ hns3_tm_nonleaf_level_capsbilities_get(dev, level_id, cap); -+ else -+ hns3_tm_leaf_level_capabilities_get(dev, cap); -+ -+ return 0; -+} -+ -+static void -+hns3_tm_nonleaf_node_capabilities_get(struct rte_eth_dev *dev, -+ enum hns3_tm_node_type node_type, -+ struct rte_tm_node_capabilities *cap) -+{ -+ struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private); -+ uint32_t max_tx_queues = hns3_tm_max_tx_queues_get(dev); -+ -+ cap->shaper_private_supported = true; -+ cap->shaper_private_dual_rate_supported = false; -+ cap->shaper_private_rate_min = 0; -+ cap->shaper_private_rate_max = -+ hns3_tm_rate_convert_firmware2tm(hw->max_tm_rate); -+ cap->shaper_shared_n_max = 0; -+ -+ if (node_type == HNS3_TM_NODE_TYPE_PORT) -+ cap->nonleaf.sched_n_children_max = HNS3_MAX_TC_NUM; -+ else -+ cap->nonleaf.sched_n_children_max = max_tx_queues; -+ cap->nonleaf.sched_sp_n_priorities_max = 1; -+ cap->nonleaf.sched_wfq_n_children_per_group_max = 0; -+ cap->nonleaf.sched_wfq_n_groups_max = 0; -+ cap->nonleaf.sched_wfq_weight_max = 1; -+ -+ cap->stats_mask = 0; -+} -+ -+static void -+hns3_tm_leaf_node_capabilities_get(struct rte_eth_dev *dev __rte_unused, -+ struct rte_tm_node_capabilities *cap) -+{ -+ cap->shaper_private_supported = false; -+ cap->shaper_private_dual_rate_supported = false; -+ cap->shaper_private_rate_min = 0; -+ cap->shaper_private_rate_max = 0; -+ cap->shaper_shared_n_max = 0; -+ -+ cap->leaf.cman_head_drop_supported = false; -+ cap->leaf.cman_wred_context_private_supported = false; -+ cap->leaf.cman_wred_context_shared_n_max = 0; -+ -+ cap->stats_mask = 0; -+} -+ -+static int -+hns3_tm_node_capabilities_get(struct rte_eth_dev *dev, -+ uint32_t node_id, -+ struct rte_tm_node_capabilities *cap, -+ struct rte_tm_error *error) -+{ -+ enum hns3_tm_node_type node_type; -+ struct hns3_tm_node *tm_node; -+ -+ if (cap == NULL || error == NULL) -+ return -EINVAL; -+ -+ tm_node = hns3_tm_node_search(dev, node_id, &node_type); -+ if (tm_node == NULL) { -+ error->type = RTE_TM_ERROR_TYPE_NODE_ID; -+ error->message = "no such node"; -+ return -EINVAL; -+ } -+ -+ memset(cap, 0, sizeof(struct rte_tm_node_capabilities)); -+ -+ if (node_type != HNS3_TM_NODE_TYPE_QUEUE) -+ hns3_tm_nonleaf_node_capabilities_get(dev, node_type, cap); -+ else -+ hns3_tm_leaf_node_capabilities_get(dev, cap); -+ -+ return 0; -+} -+ -+static int -+hns3_tm_config_port_rate(struct hns3_hw *hw, -+ struct hns3_tm_shaper_profile *shaper_profile) -+{ -+ uint32_t firmware_rate; -+ uint64_t rate; -+ -+ if (shaper_profile) { -+ rate = shaper_profile->profile.peak.rate; -+ firmware_rate = hns3_tm_rate_convert_tm2firmware(rate); -+ } else { -+ firmware_rate = hw->dcb_info.pg_info[0].bw_limit; -+ } -+ -+ /* -+ * The TM shaper topology after device inited: -+ * pri0 shaper --->| -+ * pri1 shaper --->| -+ * ... |----> pg0 shaper ----> port shaper -+ * ... | -+ * priX shaper --->| -+ * -+ * Because port shaper rate maybe changed by firmware, to avoid -+ * concurrent configure, driver use pg0 shaper to achieve the rate limit -+ * of port. -+ * -+ * The finally port rate = MIN(pg0 shaper rate, port shaper rate) -+ */ -+ return hns3_pg_shaper_rate_cfg(hw, 0, firmware_rate); -+} -+ -+static int -+hns3_tm_config_tc_rate(struct hns3_hw *hw, -+ uint8_t tc_no, -+ struct hns3_tm_shaper_profile *shaper_profile) -+{ -+ uint32_t firmware_rate; -+ uint64_t rate; -+ -+ if (shaper_profile) { -+ rate = shaper_profile->profile.peak.rate; -+ firmware_rate = hns3_tm_rate_convert_tm2firmware(rate); -+ } else { -+ firmware_rate = hw->dcb_info.tc_info[tc_no].bw_limit; -+ } -+ -+ return hns3_pri_shaper_rate_cfg(hw, tc_no, firmware_rate); -+} -+ -+static bool -+hns3_tm_configure_check(struct hns3_hw *hw, struct rte_tm_error *error) -+{ -+ struct hns3_pf *pf = HNS3_DEV_HW_TO_PF(hw); -+ struct hns3_tm_conf *tm_conf = &pf->tm_conf; -+ struct hns3_tm_node_list *tc_list = &tm_conf->tc_list; -+ struct hns3_tm_node_list *queue_list = &tm_conf->queue_list; -+ struct hns3_tm_node *tm_node; -+ -+ /* TC */ -+ TAILQ_FOREACH(tm_node, tc_list, node) { -+ if (!tm_node->reference_count) { -+ error->type = RTE_TM_ERROR_TYPE_NODE_PARAMS; -+ error->message = "TC without queue assigned"; -+ return false; -+ } -+ -+ if (hns3_tm_calc_node_tc_no(tm_conf, tm_node->id) >= -+ hw->num_tc) { -+ error->type = RTE_TM_ERROR_TYPE_NODE_ID; -+ error->message = "node's TC not exist"; -+ return false; -+ } -+ } -+ -+ /* Queue */ -+ TAILQ_FOREACH(tm_node, queue_list, node) { -+ if (tm_node->id >= hw->data->nb_tx_queues) { -+ error->type = RTE_TM_ERROR_TYPE_NODE_ID; -+ error->message = "node's queue invalid"; -+ return false; -+ } -+ -+ if (hns3_txq_mapped_tc_get(hw, tm_node->id) != -+ hns3_tm_calc_node_tc_no(tm_conf, tm_node->parent->id)) { -+ error->type = RTE_TM_ERROR_TYPE_NODE_ID; -+ error->message = "queue's TC not match parent's TC"; -+ return false; -+ } -+ } -+ -+ return true; -+} -+ -+static int -+hns3_tm_hierarchy_do_commit(struct hns3_hw *hw, -+ struct rte_tm_error *error) -+{ -+ struct hns3_pf *pf = HNS3_DEV_HW_TO_PF(hw); -+ struct hns3_tm_node_list *tc_list = &pf->tm_conf.tc_list; -+ struct hns3_tm_node *tm_node; -+ uint8_t tc_no; -+ int ret; -+ -+ /* port */ -+ tm_node = pf->tm_conf.root; -+ if (tm_node->shaper_profile) { -+ ret = hns3_tm_config_port_rate(hw, tm_node->shaper_profile); -+ if (ret) { -+ error->type = RTE_TM_ERROR_TYPE_SHAPER_PROFILE; -+ error->message = "fail to set port peak rate"; -+ return -EIO; -+ } -+ } -+ -+ /* TC */ -+ TAILQ_FOREACH(tm_node, tc_list, node) { -+ if (tm_node->shaper_profile == NULL) -+ continue; -+ -+ tc_no = hns3_tm_calc_node_tc_no(&pf->tm_conf, tm_node->id); -+ ret = hns3_tm_config_tc_rate(hw, tc_no, -+ tm_node->shaper_profile); -+ if (ret) { -+ error->type = RTE_TM_ERROR_TYPE_NODE_PARAMS; -+ error->message = "fail to set TC peak rate"; -+ return -EIO; -+ } -+ } -+ -+ return 0; -+} -+ -+static int -+hns3_tm_hierarchy_commit(struct rte_eth_dev *dev, -+ int clear_on_fail, -+ struct rte_tm_error *error) -+{ -+ struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private); -+ struct hns3_pf *pf = HNS3_DEV_PRIVATE_TO_PF(dev->data->dev_private); -+ int ret; -+ -+ if (error == NULL) -+ return -EINVAL; -+ -+ if (__atomic_load_n(&hw->reset.resetting, __ATOMIC_RELAXED)) { -+ error->type = RTE_TM_ERROR_TYPE_UNSPECIFIED; -+ error->message = "device is resetting"; -+ /* don't goto fail_clear, user may try later */ -+ return -EBUSY; -+ } -+ -+ if (pf->tm_conf.root == NULL) -+ goto done; -+ -+ /* check configure before commit make sure key configure not violated */ -+ if (!hns3_tm_configure_check(hw, error)) -+ goto fail_clear; -+ -+ ret = hns3_tm_hierarchy_do_commit(hw, error); -+ if (ret) -+ goto fail_clear; -+ -+done: -+ pf->tm_conf.committed = true; -+ return 0; -+ -+fail_clear: -+ if (clear_on_fail) { -+ hns3_tm_conf_uninit(dev); -+ hns3_tm_conf_init(dev); -+ } -+ return -EINVAL; -+} -+ -+static int -+hns3_tm_hierarchy_commit_wrap(struct rte_eth_dev *dev, -+ int clear_on_fail, -+ struct rte_tm_error *error) -+{ -+ struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private); -+ int ret; -+ -+ rte_spinlock_lock(&hw->lock); -+ ret = hns3_tm_hierarchy_commit(dev, clear_on_fail, error); -+ rte_spinlock_unlock(&hw->lock); -+ -+ return ret; -+} -+ -+static int -+hns3_tm_node_shaper_do_update(struct hns3_hw *hw, -+ uint32_t node_id, -+ enum hns3_tm_node_type node_type, -+ struct hns3_tm_shaper_profile *shaper_profile, -+ struct rte_tm_error *error) -+{ -+ struct hns3_pf *pf = HNS3_DEV_HW_TO_PF(hw); -+ uint8_t tc_no; -+ int ret; -+ -+ if (node_type == HNS3_TM_NODE_TYPE_QUEUE) { -+ if (shaper_profile != NULL) { -+ error->type = RTE_TM_ERROR_TYPE_SHAPER_PROFILE_ID; -+ error->message = "queue node shaper not supported"; -+ return -EINVAL; -+ } -+ return 0; -+ } -+ -+ if (!pf->tm_conf.committed) -+ return 0; -+ -+ if (node_type == HNS3_TM_NODE_TYPE_PORT) { -+ ret = hns3_tm_config_port_rate(hw, shaper_profile); -+ if (ret) { -+ error->type = RTE_TM_ERROR_TYPE_SHAPER_PROFILE; -+ error->message = "fail to update port peak rate"; -+ } -+ -+ return ret; -+ } -+ -+ /* -+ * update TC's shaper -+ */ -+ tc_no = hns3_tm_calc_node_tc_no(&pf->tm_conf, node_id); -+ ret = hns3_tm_config_tc_rate(hw, tc_no, shaper_profile); -+ if (ret) { -+ error->type = RTE_TM_ERROR_TYPE_SHAPER_PROFILE; -+ error->message = "fail to update TC peak rate"; -+ } -+ -+ return ret; -+} -+ -+static int -+hns3_tm_node_shaper_update(struct rte_eth_dev *dev, -+ uint32_t node_id, -+ uint32_t shaper_profile_id, -+ struct rte_tm_error *error) -+{ -+ struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private); -+ enum hns3_tm_node_type node_type = HNS3_TM_NODE_TYPE_MAX; -+ struct hns3_tm_shaper_profile *profile = NULL; -+ struct hns3_tm_node *tm_node; -+ -+ if (error == NULL) -+ return -EINVAL; -+ -+ if (__atomic_load_n(&hw->reset.resetting, __ATOMIC_RELAXED)) { -+ error->type = RTE_TM_ERROR_TYPE_UNSPECIFIED; -+ error->message = "device is resetting"; -+ return -EBUSY; -+ } -+ -+ tm_node = hns3_tm_node_search(dev, node_id, &node_type); -+ if (tm_node == NULL) { -+ error->type = RTE_TM_ERROR_TYPE_NODE_ID; -+ error->message = "no such node"; -+ return -EINVAL; -+ } -+ -+ if (shaper_profile_id == tm_node->params.shaper_profile_id) -+ return 0; -+ -+ if (shaper_profile_id != RTE_TM_SHAPER_PROFILE_ID_NONE) { -+ profile = hns3_tm_shaper_profile_search(dev, shaper_profile_id); -+ if (profile == NULL) { -+ error->type = RTE_TM_ERROR_TYPE_SHAPER_PROFILE_ID; -+ error->message = "profile ID not exist"; -+ return -EINVAL; -+ } -+ } -+ -+ if (hns3_tm_node_shaper_do_update(hw, node_id, node_type, -+ profile, error)) -+ return -EINVAL; -+ -+ if (tm_node->shaper_profile) -+ tm_node->shaper_profile->reference_count--; -+ tm_node->shaper_profile = profile; -+ tm_node->params.shaper_profile_id = shaper_profile_id; -+ if (profile != NULL) -+ profile->reference_count++; -+ -+ return 0; -+} -+ -+static int -+hns3_tm_node_shaper_update_wrap(struct rte_eth_dev *dev, -+ uint32_t node_id, -+ uint32_t shaper_profile_id, -+ struct rte_tm_error *error) -+{ -+ struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private); -+ int ret; -+ -+ rte_spinlock_lock(&hw->lock); -+ ret = hns3_tm_node_shaper_update(dev, node_id, -+ shaper_profile_id, error); -+ rte_spinlock_unlock(&hw->lock); -+ -+ return ret; -+} -+ -+static const struct rte_tm_ops hns3_tm_ops = { -+ .capabilities_get = hns3_tm_capabilities_get, -+ .shaper_profile_add = hns3_tm_shaper_profile_add, -+ .shaper_profile_delete = hns3_tm_shaper_profile_del, -+ .node_add = hns3_tm_node_add, -+ .node_delete = hns3_tm_node_delete, -+ .node_type_get = hns3_tm_node_type_get, -+ .level_capabilities_get = hns3_tm_level_capabilities_get, -+ .node_capabilities_get = hns3_tm_node_capabilities_get, -+ .hierarchy_commit = hns3_tm_hierarchy_commit_wrap, -+ .node_shaper_update = hns3_tm_node_shaper_update_wrap, -+}; -+ -+int -+hns3_tm_ops_get(struct rte_eth_dev *dev __rte_unused, -+ void *arg) -+{ -+ if (arg == NULL) -+ return -EINVAL; -+ -+ *(const void **)arg = &hns3_tm_ops; -+ -+ return 0; -+} -+ -+void -+hns3_tm_dev_start_proc(struct hns3_hw *hw) -+{ -+ struct hns3_pf *pf = HNS3_DEV_HW_TO_PF(hw); -+ -+ if (pf->tm_conf.root && !pf->tm_conf.committed) -+ hns3_warn(hw, -+ "please call hierarchy_commit() before starting the port."); -+} -+ -+/* -+ * We need clear tm_conf committed flag when device stop so that user can modify -+ * tm configuration (e.g. add or delete node). -+ * -+ * If user don't call hierarchy commit when device start later, the Port/TC's -+ * shaper rate still the same as previous committed. -+ * -+ * To avoid the above problem, we need recover Port/TC shaper rate when device -+ * stop. -+ */ -+void -+hns3_tm_dev_stop_proc(struct hns3_hw *hw) -+{ -+ struct hns3_pf *pf = HNS3_DEV_HW_TO_PF(hw); -+ struct hns3_tm_node_list *tc_list = &pf->tm_conf.tc_list; -+ struct hns3_tm_node *tm_node; -+ uint8_t tc_no; -+ -+ if (!pf->tm_conf.committed) -+ return; -+ -+ tm_node = pf->tm_conf.root; -+ if (tm_node != NULL && tm_node->shaper_profile) -+ (void)hns3_tm_config_port_rate(hw, NULL); -+ -+ TAILQ_FOREACH(tm_node, tc_list, node) { -+ if (tm_node->shaper_profile == NULL) -+ continue; -+ tc_no = hns3_tm_calc_node_tc_no(&pf->tm_conf, tm_node->id); -+ (void)hns3_tm_config_tc_rate(hw, tc_no, NULL); -+ } -+ -+ pf->tm_conf.committed = false; -+} -+ -+int -+hns3_tm_conf_update(struct hns3_hw *hw) -+{ -+ struct hns3_pf *pf = HNS3_DEV_HW_TO_PF(hw); -+ struct rte_tm_error error; -+ -+ if (pf->tm_conf.root == NULL || !pf->tm_conf.committed) -+ return 0; -+ -+ memset(&error, 0, sizeof(struct rte_tm_error)); -+ return hns3_tm_hierarchy_do_commit(hw, &error); -+} -diff --git a/drivers/net/hns3/hns3_tm.h b/drivers/net/hns3/hns3_tm.h -new file mode 100644 -index 0000000..d8de3e4 ---- /dev/null -+++ b/drivers/net/hns3/hns3_tm.h -@@ -0,0 +1,103 @@ -+/* SPDX-License-Identifier: BSD-3-Clause -+ * Copyright(c) 2020-2020 Hisilicon Limited. -+ */ -+ -+#ifndef _HNS3_TM_H_ -+#define _HNS3_TM_H_ -+ -+#include -+#include -+#include -+ -+enum hns3_tm_node_type { -+ HNS3_TM_NODE_TYPE_PORT, -+ HNS3_TM_NODE_TYPE_TC, -+ HNS3_TM_NODE_TYPE_QUEUE, -+ HNS3_TM_NODE_TYPE_MAX, -+}; -+ -+enum hns3_tm_node_level { -+ HNS3_TM_NODE_LEVEL_PORT, -+ HNS3_TM_NODE_LEVEL_TC, -+ HNS3_TM_NODE_LEVEL_QUEUE, -+ HNS3_TM_NODE_LEVEL_MAX, -+}; -+ -+struct hns3_tm_shaper_profile { -+ TAILQ_ENTRY(hns3_tm_shaper_profile) node; -+ uint32_t shaper_profile_id; -+ uint32_t reference_count; -+ struct rte_tm_shaper_params profile; -+}; -+ -+TAILQ_HEAD(hns3_shaper_profile_list, hns3_tm_shaper_profile); -+ -+struct hns3_tm_node { -+ TAILQ_ENTRY(hns3_tm_node) node; -+ uint32_t id; -+ uint32_t reference_count; -+ struct hns3_tm_node *parent; -+ struct hns3_tm_shaper_profile *shaper_profile; -+ struct rte_tm_node_params params; -+}; -+ -+TAILQ_HEAD(hns3_tm_node_list, hns3_tm_node); -+ -+struct hns3_tm_conf { -+ uint32_t nb_leaf_nodes_max; /* max numbers of leaf nodes */ -+ uint32_t nb_nodes_max; /* max numbers of nodes */ -+ uint32_t nb_shaper_profile_max; /* max numbers of shaper profile */ -+ -+ struct hns3_shaper_profile_list shaper_profile_list; -+ uint32_t nb_shaper_profile; /* number of shaper profile */ -+ -+ struct hns3_tm_node *root; -+ struct hns3_tm_node_list tc_list; -+ struct hns3_tm_node_list queue_list; -+ uint32_t nb_tc_node; /* number of added TC nodes */ -+ uint32_t nb_queue_node; /* number of added queue nodes */ -+ -+ /* -+ * This flag is used to check if APP can change the TM node -+ * configuration. -+ * When it's true, means the configuration is applied to HW, -+ * APP should not add/delete the TM node configuration. -+ * When starting the port, APP should call the hierarchy_commit API to -+ * set this flag to true. When stopping the port, this flag should be -+ * set to false. -+ */ -+ bool committed; -+}; -+ -+/* -+ * This API used to calc node TC no. User must make sure the node id is in the -+ * TC node id range. -+ * -+ * User could call rte_eth_dev_info_get API to get port's max_tx_queues, The TM -+ * id's assignment should following the below rules: -+ * [0, max_tx_queues-1]: correspond queues's node id -+ * max_tx_queues + 0 : correspond TC0's node id -+ * max_tx_queues + 1 : correspond TC1's node id -+ * ... -+ * max_tx_queues + 7 : correspond TC7's node id -+ * max_tx_queues + 8 : correspond port's node id -+ * -+ */ -+static inline uint8_t -+hns3_tm_calc_node_tc_no(struct hns3_tm_conf *conf, uint32_t node_id) -+{ -+ if (node_id >= conf->nb_leaf_nodes_max && -+ node_id < conf->nb_nodes_max - 1) -+ return node_id - conf->nb_leaf_nodes_max; -+ else -+ return 0; -+} -+ -+void hns3_tm_conf_init(struct rte_eth_dev *dev); -+void hns3_tm_conf_uninit(struct rte_eth_dev *dev); -+int hns3_tm_ops_get(struct rte_eth_dev *dev __rte_unused, void *arg); -+void hns3_tm_dev_start_proc(struct hns3_hw *hw); -+void hns3_tm_dev_stop_proc(struct hns3_hw *hw); -+int hns3_tm_conf_update(struct hns3_hw *hw); -+ -+#endif /* _HNS3_TM_H */ -diff --git a/drivers/net/hns3/meson.build b/drivers/net/hns3/meson.build -index 5674d98..f6aac69 100644 ---- a/drivers/net/hns3/meson.build -+++ b/drivers/net/hns3/meson.build -@@ -25,7 +25,8 @@ sources = files('hns3_cmd.c', - 'hns3_rss.c', - 'hns3_rxtx.c', - 'hns3_stats.c', -- 'hns3_mp.c') -+ 'hns3_mp.c', -+ 'hns3_tm.c') - - deps += ['hash'] - --- -2.7.4 - diff --git a/0013-fix-rte-eal-memory-init-double-unlock.patch b/0013-fix-rte-eal-memory-init-double-unlock.patch new file mode 100644 index 0000000000000000000000000000000000000000..3dcc04a63642be786893d3af64e5b522390c0036 --- /dev/null +++ b/0013-fix-rte-eal-memory-init-double-unlock.patch @@ -0,0 +1,29 @@ +From d9e578c64144bf35e3141d2a3f3ada2763534cb2 Mon Sep 17 00:00:00 2001 +From: Changsheng Wu +Date: Thu, 16 Dec 2021 19:26:51 +0800 +Subject: [PATCH] huawei-0015-fix-rte-eal-memory-init-double-unlock + +--- + lib/eal/common/eal_common_memory.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/lib/eal/common/eal_common_memory.c b/lib/eal/common/eal_common_memory.c +index 15ce4341b0..d983e37cc8 100644 +--- a/lib/eal/common/eal_common_memory.c ++++ b/lib/eal/common/eal_common_memory.c +@@ -1150,8 +1150,10 @@ rte_eal_sec_memory_init(const int sec_idx) + ret = __rte_eal_memory_init(rte_eal_sec_get_runtime_dir(sec_idx), + rte_eal_sec_get_internal_config(sec_idx), rte_cfg, + true, sec_idx); +- +- rte_rwlock_read_unlock(&rte_cfg->mem_config->memory_hotplug_lock); ++ if (ret == 0) { ++ /* when ret != 0 unlock in __rte_eal_memory_init */ ++ rte_rwlock_read_unlock(&rte_cfg->mem_config->memory_hotplug_lock); ++ } + + return ret; + } +-- +2.27.0 + diff --git a/0013-net-hns3-fix-VF-query-link-status-in-dev-init.patch b/0013-net-hns3-fix-VF-query-link-status-in-dev-init.patch deleted file mode 100644 index 93878c2b7ea169125c9b4ebc34a49714b84d59eb..0000000000000000000000000000000000000000 --- a/0013-net-hns3-fix-VF-query-link-status-in-dev-init.patch +++ /dev/null @@ -1,45 +0,0 @@ -From 92f474b6b5f954d20b81576549a25ce8b7bc2a2b Mon Sep 17 00:00:00 2001 -From: Chengwen Feng -Date: Thu, 14 Jan 2021 21:33:32 +0800 -Subject: [PATCH 013/189] net/hns3: fix VF query link status in dev init - -Current hns3vf queried link status in dev init stage, but the link -status should be maintained in dev start stage, this patch fix this. - -Also, in the dev start stage, we use quick query instead of delayed -query to make sure update the link status soon. - -Fixes: a5475d61fa34 ("net/hns3: support VF") -Fixes: 958edf6627d5 ("net/hns3: fix VF link status") -Cc: stable@dpdk.org - -Signed-off-by: Chengwen Feng -Signed-off-by: Lijun Ou ---- - drivers/net/hns3/hns3_ethdev_vf.c | 3 +-- - 1 file changed, 1 insertion(+), 2 deletions(-) - -diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c -index c126384..ee89505 100644 ---- a/drivers/net/hns3/hns3_ethdev_vf.c -+++ b/drivers/net/hns3/hns3_ethdev_vf.c -@@ -1749,7 +1749,6 @@ hns3vf_init_hardware(struct hns3_adapter *hns) - goto err_init_hardware; - } - -- hns3vf_request_link_info(hw); - return 0; - - err_init_hardware: -@@ -2238,7 +2237,7 @@ hns3vf_dev_start(struct rte_eth_dev *dev) - hns3_rx_scattered_calc(dev); - hns3_set_rxtx_function(dev); - hns3_mp_req_start_rxtx(dev); -- rte_eal_alarm_set(HNS3VF_SERVICE_INTERVAL, hns3vf_service_handler, dev); -+ hns3vf_service_handler(dev); - - hns3vf_restore_filter(dev); - --- -2.7.4 - diff --git a/0014-fix-last-argv-pointer-change-to-first.patch b/0014-fix-last-argv-pointer-change-to-first.patch new file mode 100644 index 0000000000000000000000000000000000000000..e30a4bb0186bdcdd45c55fac00ae9fc0940da6f3 --- /dev/null +++ b/0014-fix-last-argv-pointer-change-to-first.patch @@ -0,0 +1,25 @@ +From 23113e9f48414f534358274a732921cd3f5345cf Mon Sep 17 00:00:00 2001 +From: Changsheng Wu +Date: Thu, 16 Dec 2021 20:12:42 +0800 +Subject: [PATCH] huawei-0016-fix-last-argv-pointer-change-to-first + +--- + lib/eal/linux/eal.c | 2 -- + 1 file changed, 2 deletions(-) + +diff --git a/lib/eal/linux/eal.c b/lib/eal/linux/eal.c +index 16bb2b60cc..78c61a1979 100644 +--- a/lib/eal/linux/eal.c ++++ b/lib/eal/linux/eal.c +@@ -935,8 +935,6 @@ __eal_parse_args(int argc, char **argv, char *runtime_dir, const int buflen, + goto out; + } + +- if (optind >= 0) +- argv[optind-1] = prgname; + ret = optind-1; + + out: +-- +2.27.0 + diff --git a/0014-net-hns3-use-new-opcode-for-clearing-hardware-resour.patch b/0014-net-hns3-use-new-opcode-for-clearing-hardware-resour.patch deleted file mode 100644 index c524d96182536a8fba375b2201b4bdbe46e6192d..0000000000000000000000000000000000000000 --- a/0014-net-hns3-use-new-opcode-for-clearing-hardware-resour.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 1f68430b13d5aed1851c97761163b44b38d4f37d Mon Sep 17 00:00:00 2001 -From: Hongbo Zheng -Date: Thu, 14 Jan 2021 21:33:33 +0800 -Subject: [PATCH 014/189] net/hns3: use new opcode for clearing hardware - resource - -The original command opcode '0x700A' may cause firmware error, -so '0x700A' is deserted, now use '0x700B' to replace it. - -Fixes: 223d9eceaeee ("net/hns3: clear residual hardware configurations on init") -Cc: stable@dpdk.org - -Signed-off-by: Hongbo Zheng -Signed-off-by: Lijun Ou ---- - drivers/net/hns3/hns3_cmd.h | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/drivers/net/hns3/hns3_cmd.h b/drivers/net/hns3/hns3_cmd.h -index 194c3a7..e40293b 100644 ---- a/drivers/net/hns3/hns3_cmd.h -+++ b/drivers/net/hns3/hns3_cmd.h -@@ -203,7 +203,7 @@ enum hns3_opcode_type { - HNS3_OPC_FD_COUNTER_OP = 0x1205, - - /* Clear hardware state command */ -- HNS3_OPC_CLEAR_HW_STATE = 0x700A, -+ HNS3_OPC_CLEAR_HW_STATE = 0x700B, - - /* SFP command */ - HNS3_OPC_SFP_GET_SPEED = 0x7104, --- -2.7.4 - diff --git a/0015-fix-internal-cfg-and-fbarray-attach-mememory-leak.patch b/0015-fix-internal-cfg-and-fbarray-attach-mememory-leak.patch new file mode 100644 index 0000000000000000000000000000000000000000..0354da91112403fd00b08b6622b54883624dce49 --- /dev/null +++ b/0015-fix-internal-cfg-and-fbarray-attach-mememory-leak.patch @@ -0,0 +1,55 @@ +From 847cbe34e8e45a0c0613cf5cd96f06ee31ada0f9 Mon Sep 17 00:00:00 2001 +From: Changsheng Wu +Date: Sat, 18 Dec 2021 17:02:16 +0800 +Subject: [PATCH] 0014 + +--- + lib/eal/common/eal_common_fbarray.c | 13 ++++++++----- + lib/eal/linux/eal.c | 1 + + 2 files changed, 9 insertions(+), 5 deletions(-) + +diff --git a/lib/eal/common/eal_common_fbarray.c b/lib/eal/common/eal_common_fbarray.c +index fa726cd2f5..b809d3c669 100644 +--- a/lib/eal/common/eal_common_fbarray.c ++++ b/lib/eal/common/eal_common_fbarray.c +@@ -911,17 +911,20 @@ __rte_fbarray_attach(struct rte_fbarray *arr, const char *runtime_dir, + fd = -1; + } + +- /* store our new memory area */ +- ma->addr = data; +- ma->fd = fd; /* keep fd until detach/destroy */ +- ma->len = mmap_len; +- + if (!internal_conf->pri_and_sec) { ++ /* store our new memory area */ ++ ma->addr = data; ++ ma->fd = fd; /* keep fd until detach/destroy */ ++ ma->len = mmap_len; ++ + TAILQ_INSERT_TAIL(&mem_area_tailq, ma, next); + + /* we're done */ + + rte_spinlock_unlock(&mem_area_lock); ++ } else { ++ /* pri_and_sec don't use mem_area_tailq */ ++ free(ma); + } + return 0; + fail: +diff --git a/lib/eal/linux/eal.c b/lib/eal/linux/eal.c +index f70c4d55fa..2dee945be4 100644 +--- a/lib/eal/linux/eal.c ++++ b/lib/eal/linux/eal.c +@@ -564,6 +564,7 @@ eal_sec_config_cleanup(const int sec_idx) + } + + memset(lc_rte_cfg, 0, sizeof(*lc_rte_cfg)); ++ eal_cleanup_config(lc_internal_cfg); + memset(lc_internal_cfg, 0, sizeof(*lc_internal_cfg)); + memset(lc_runtime_dir, 0, PATH_MAX); + +-- +2.27.0 + diff --git a/0015-net-hns3-fix-register-length-when-dumping-registers.patch b/0015-net-hns3-fix-register-length-when-dumping-registers.patch deleted file mode 100644 index 28bba41ee0580d8f63bfe638c12e8825e4512747..0000000000000000000000000000000000000000 --- a/0015-net-hns3-fix-register-length-when-dumping-registers.patch +++ /dev/null @@ -1,59 +0,0 @@ -From 7fab993aa57ba5f2e4bce07949de602e1a40daf1 Mon Sep 17 00:00:00 2001 -From: Chengchang Tang -Date: Thu, 14 Jan 2021 21:33:34 +0800 -Subject: [PATCH 015/189] net/hns3: fix register length when dumping registers - -Currently, the reg length return by HNS3 is the total length of all the -registers. But for upper layer user, the total register length is the -length multiplied by width. This can lead to a waste of memory and print -some invalid information. - -This patch corrects the length and width of the register. - -Fixes: 936eda25e8da ("net/hns3: support dump register") -Cc: stable@dpdk.org - -Signed-off-by: Chengchang Tang -Signed-off-by: Lijun Ou ---- - drivers/net/hns3/hns3_regs.c | 10 +++++++--- - 1 file changed, 7 insertions(+), 3 deletions(-) - -diff --git a/drivers/net/hns3/hns3_regs.c b/drivers/net/hns3/hns3_regs.c -index b2cc599..32597fe 100644 ---- a/drivers/net/hns3/hns3_regs.c -+++ b/drivers/net/hns3/hns3_regs.c -@@ -104,6 +104,7 @@ hns3_get_regs_length(struct hns3_hw *hw, uint32_t *length) - struct hns3_adapter *hns = HNS3_DEV_HW_TO_ADAPTER(hw); - uint32_t cmdq_lines, common_lines, ring_lines, tqp_intr_lines; - uint32_t regs_num_32_bit, regs_num_64_bit; -+ uint32_t dfx_reg_lines; - uint32_t len; - int ret; - -@@ -117,7 +118,7 @@ hns3_get_regs_length(struct hns3_hw *hw, uint32_t *length) - tqp_intr_lines = sizeof(tqp_intr_reg_addrs) / REG_LEN_PER_LINE + 1; - - len = (cmdq_lines + common_lines + ring_lines * hw->tqps_num + -- tqp_intr_lines * hw->num_msi) * REG_LEN_PER_LINE; -+ tqp_intr_lines * hw->num_msi) * REG_NUM_PER_LINE; - - if (!hns->is_vf) { - ret = hns3_get_regs_num(hw, ®s_num_32_bit, ®s_num_64_bit); -@@ -126,8 +127,11 @@ hns3_get_regs_length(struct hns3_hw *hw, uint32_t *length) - ret); - return -ENOTSUP; - } -- len += regs_num_32_bit * sizeof(uint32_t) + -- regs_num_64_bit * sizeof(uint64_t); -+ dfx_reg_lines = regs_num_32_bit * sizeof(uint32_t) / -+ REG_LEN_PER_LINE + 1; -+ dfx_reg_lines += regs_num_64_bit * sizeof(uint64_t) / -+ REG_LEN_PER_LINE + 1; -+ len += dfx_reg_lines * REG_NUM_PER_LINE; - } - - *length = len; --- -2.7.4 - diff --git a/0016-fix-error-that-the-secondary-attach-fails-due-to-detach.patch b/0016-fix-error-that-the-secondary-attach-fails-due-to-detach.patch new file mode 100644 index 0000000000000000000000000000000000000000..ccba129705830c9fc72187eafcd7d6955a4d5b47 --- /dev/null +++ b/0016-fix-error-that-the-secondary-attach-fails-due-to-detach.patch @@ -0,0 +1,24 @@ +From e8466bb5c02192727a140688df0c8882ed35ca59 Mon Sep 17 00:00:00 2001 +From: Changsheng Wu +Date: Sat, 18 Dec 2021 17:09:27 +0800 +Subject: [PATCH] 15 + +--- + lib/eal/linux/eal_memalloc.c | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/lib/eal/linux/eal_memalloc.c b/lib/eal/linux/eal_memalloc.c +index d5fe856dd8..38543bf8c4 100644 +--- a/lib/eal/linux/eal_memalloc.c ++++ b/lib/eal/linux/eal_memalloc.c +@@ -1830,7 +1830,6 @@ eal_sec_memalloc_destroy(const int sec_idx) + return ret; + + rte_mem_unmap(msl->base_va, msl->len); +- memset(msl, 0, sizeof(*msl)); + } + + return 0; +-- +2.27.0 + diff --git a/0016-net-hns3-fix-data-overwriting-during-register-dump.patch b/0016-net-hns3-fix-data-overwriting-during-register-dump.patch deleted file mode 100644 index 7923fbf50a60e966b4eb7e08e400af4d9a0ce488..0000000000000000000000000000000000000000 --- a/0016-net-hns3-fix-data-overwriting-during-register-dump.patch +++ /dev/null @@ -1,152 +0,0 @@ -From 3c4b289d438451fa8e3c520bef4b1a32d68f4bea Mon Sep 17 00:00:00 2001 -From: Chengchang Tang -Date: Thu, 14 Jan 2021 21:33:35 +0800 -Subject: [PATCH 016/189] net/hns3: fix data overwriting during register dump - -The data pointer has not moved after BAR register dumped. This causes -the later register to overwrite the previous data. - -This patch fix the overwriting by move the pointer after every dump -function. And the missing separator between 32-bit register and the -64-bit register is also added to avoid a parsing error. - -Fixes: 936eda25e8da ("net/hns3: support dump register") -Cc: stable@dpdk.org - -Signed-off-by: Chengchang Tang -Signed-off-by: Lijun Ou ---- - drivers/net/hns3/hns3_regs.c | 70 +++++++++++++++++++++++++------------------- - 1 file changed, 40 insertions(+), 30 deletions(-) - -diff --git a/drivers/net/hns3/hns3_regs.c b/drivers/net/hns3/hns3_regs.c -index 32597fe..775e096 100644 ---- a/drivers/net/hns3/hns3_regs.c -+++ b/drivers/net/hns3/hns3_regs.c -@@ -252,63 +252,68 @@ hns3_get_64_bit_regs(struct hns3_hw *hw, uint32_t regs_num, void *data) - return 0; - } - --static void -+static int -+hns3_insert_reg_separator(int reg_num, uint32_t *data) -+{ -+ int separator_num; -+ int i; -+ -+ separator_num = MAX_SEPARATE_NUM - reg_num % REG_NUM_PER_LINE; -+ for (i = 0; i < separator_num; i++) -+ *data++ = SEPARATOR_VALUE; -+ return separator_num; -+} -+ -+static int - hns3_direct_access_regs(struct hns3_hw *hw, uint32_t *data) - { - struct hns3_adapter *hns = HNS3_DEV_HW_TO_ADAPTER(hw); -+ uint32_t *origin_data_ptr = data; - uint32_t reg_offset; -- int separator_num; -- int reg_um; -+ int reg_num; - int i, j; - - /* fetching per-PF registers values from PF PCIe register space */ -- reg_um = sizeof(cmdq_reg_addrs) / sizeof(uint32_t); -- separator_num = MAX_SEPARATE_NUM - reg_um % REG_NUM_PER_LINE; -- for (i = 0; i < reg_um; i++) -+ reg_num = sizeof(cmdq_reg_addrs) / sizeof(uint32_t); -+ for (i = 0; i < reg_num; i++) - *data++ = hns3_read_dev(hw, cmdq_reg_addrs[i]); -- for (i = 0; i < separator_num; i++) -- *data++ = SEPARATOR_VALUE; -+ data += hns3_insert_reg_separator(reg_num, data); - - if (hns->is_vf) -- reg_um = sizeof(common_vf_reg_addrs) / sizeof(uint32_t); -+ reg_num = sizeof(common_vf_reg_addrs) / sizeof(uint32_t); - else -- reg_um = sizeof(common_reg_addrs) / sizeof(uint32_t); -- separator_num = MAX_SEPARATE_NUM - reg_um % REG_NUM_PER_LINE; -- for (i = 0; i < reg_um; i++) -+ reg_num = sizeof(common_reg_addrs) / sizeof(uint32_t); -+ for (i = 0; i < reg_num; i++) - if (hns->is_vf) - *data++ = hns3_read_dev(hw, common_vf_reg_addrs[i]); - else - *data++ = hns3_read_dev(hw, common_reg_addrs[i]); -- for (i = 0; i < separator_num; i++) -- *data++ = SEPARATOR_VALUE; -+ data += hns3_insert_reg_separator(reg_num, data); - -- reg_um = sizeof(ring_reg_addrs) / sizeof(uint32_t); -- separator_num = MAX_SEPARATE_NUM - reg_um % REG_NUM_PER_LINE; -+ reg_num = sizeof(ring_reg_addrs) / sizeof(uint32_t); - for (j = 0; j < hw->tqps_num; j++) { - reg_offset = hns3_get_tqp_reg_offset(j); -- for (i = 0; i < reg_um; i++) -+ for (i = 0; i < reg_num; i++) - *data++ = hns3_read_dev(hw, - ring_reg_addrs[i] + reg_offset); -- for (i = 0; i < separator_num; i++) -- *data++ = SEPARATOR_VALUE; -+ data += hns3_insert_reg_separator(reg_num, data); - } - -- reg_um = sizeof(tqp_intr_reg_addrs) / sizeof(uint32_t); -- separator_num = MAX_SEPARATE_NUM - reg_um % REG_NUM_PER_LINE; -+ reg_num = sizeof(tqp_intr_reg_addrs) / sizeof(uint32_t); - for (j = 0; j < hw->num_msi; j++) { - reg_offset = HNS3_TQP_INTR_REG_SIZE * j; -- for (i = 0; i < reg_um; i++) -- *data++ = hns3_read_dev(hw, -- tqp_intr_reg_addrs[i] + -+ for (i = 0; i < reg_num; i++) -+ *data++ = hns3_read_dev(hw, tqp_intr_reg_addrs[i] + - reg_offset); -- for (i = 0; i < separator_num; i++) -- *data++ = SEPARATOR_VALUE; -+ data += hns3_insert_reg_separator(reg_num, data); - } -+ return data - origin_data_ptr; - } - - int - hns3_get_regs(struct rte_eth_dev *eth_dev, struct rte_dev_reg_info *regs) - { -+#define HNS3_64_BIT_REG_SIZE (sizeof(uint64_t) / sizeof(uint32_t)) - struct hns3_adapter *hns = eth_dev->data->dev_private; - struct hns3_hw *hw = &hns->hw; - uint32_t regs_num_32_bit; -@@ -338,7 +343,7 @@ hns3_get_regs(struct rte_eth_dev *eth_dev, struct rte_dev_reg_info *regs) - return -ENOTSUP; - - /* fetching per-PF registers values from PF PCIe register space */ -- hns3_direct_access_regs(hw, data); -+ data += hns3_direct_access_regs(hw, data); - - if (hns->is_vf) - return 0; -@@ -355,11 +360,16 @@ hns3_get_regs(struct rte_eth_dev *eth_dev, struct rte_dev_reg_info *regs) - hns3_err(hw, "Get 32 bit register failed, ret = %d", ret); - return ret; - } -- - data += regs_num_32_bit; -+ data += hns3_insert_reg_separator(regs_num_32_bit, data); -+ - ret = hns3_get_64_bit_regs(hw, regs_num_64_bit, data); -- if (ret) -+ if (ret) { - hns3_err(hw, "Get 64 bit register failed, ret = %d", ret); -- -+ return ret; -+ } -+ data += regs_num_64_bit * HNS3_64_BIT_REG_SIZE; -+ data += hns3_insert_reg_separator(regs_num_64_bit * -+ HNS3_64_BIT_REG_SIZE, data); - return ret; - } --- -2.7.4 - diff --git a/0017-fix-master-thread-not-set-affinity.patch b/0017-fix-master-thread-not-set-affinity.patch new file mode 100644 index 0000000000000000000000000000000000000000..1a5588e706592b5a5e2e6eb805d0bfbda1c95878 --- /dev/null +++ b/0017-fix-master-thread-not-set-affinity.patch @@ -0,0 +1,25 @@ +From 269be3f974c22f62892554dbb51fe859047058d7 Mon Sep 17 00:00:00 2001 +From: wuchangsheng +Date: Fri, 14 Jan 2022 11:11:08 +0800 +Subject: [PATCH] fix master thread not set affinity + +--- + lib/eal/linux/eal.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/lib/eal/linux/eal.c b/lib/eal/linux/eal.c +index 123a8e8..7ca8bb2 100644 +--- a/lib/eal/linux/eal.c ++++ b/lib/eal/linux/eal.c +@@ -1310,7 +1310,7 @@ rte_eal_init(int argc, char **argv) + eal_check_mem_on_local_socket(); + + /* Master thread don't set affinity in LibStorage application */ +- if (strstr(logid, "LibStorage") != NULL && ++ if (strstr(logid, "LibStorage") == NULL && + pthread_setaffinity_np(pthread_self(), sizeof(rte_cpuset_t), + &lcore_config[config->main_lcore].cpuset) != 0) { + rte_eal_init_alert("Cannot set affinity"); +-- +2.30.0 + diff --git a/0017-net-hns3-fix-dump-register-out-of-range.patch b/0017-net-hns3-fix-dump-register-out-of-range.patch deleted file mode 100644 index 7175809bb633de332912354af33adcc13b9e69a5..0000000000000000000000000000000000000000 --- a/0017-net-hns3-fix-dump-register-out-of-range.patch +++ /dev/null @@ -1,38 +0,0 @@ -From a69abf12f46295044e4e59b60e49e73bc66afe10 Mon Sep 17 00:00:00 2001 -From: Chengchang Tang -Date: Thu, 14 Jan 2021 21:33:36 +0800 -Subject: [PATCH 017/189] net/hns3: fix dump register out of range - -Currently, when dump the queue interrupt registers, the number of -registers that should be dumped is calculated from num_msi. But the -value of num_msi includes the number of misc interrupts. So, for some -hardware version, like kupeng930, it will lead to an illegal access. - -This patch replace num_msi with intr_tqps_num which indicate the -number of interrupts used by the tqps. - -Fixes: 936eda25e8da ("net/hns3: support dump register") -Cc: stable@dpdk.org - -Signed-off-by: Chengchang Tang -Signed-off-by: Lijun Ou ---- - drivers/net/hns3/hns3_regs.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/drivers/net/hns3/hns3_regs.c b/drivers/net/hns3/hns3_regs.c -index 775e096..f2cb465 100644 ---- a/drivers/net/hns3/hns3_regs.c -+++ b/drivers/net/hns3/hns3_regs.c -@@ -300,7 +300,7 @@ hns3_direct_access_regs(struct hns3_hw *hw, uint32_t *data) - } - - reg_num = sizeof(tqp_intr_reg_addrs) / sizeof(uint32_t); -- for (j = 0; j < hw->num_msi; j++) { -+ for (j = 0; j < hw->intr_tqps_num; j++) { - reg_offset = HNS3_TQP_INTR_REG_SIZE * j; - for (i = 0; i < reg_num; i++) - *data++ = hns3_read_dev(hw, tqp_intr_reg_addrs[i] + --- -2.7.4 - diff --git a/0018-net-bonding-fix-offloading-configuration.patch b/0018-net-bonding-fix-offloading-configuration.patch new file mode 100644 index 0000000000000000000000000000000000000000..5a61ab325dcdba301775c7ef43d9a8c1d36a0736 --- /dev/null +++ b/0018-net-bonding-fix-offloading-configuration.patch @@ -0,0 +1,71 @@ +From ef72dacdec6c5dca8773854906159f7bc75eeb5c Mon Sep 17 00:00:00 2001 +From: Chengchang Tang +Date: Tue, 9 Nov 2021 15:57:26 +0800 +Subject: [PATCH] net/bonding: fix offloading configuration + +Currently, part offloadings of the bonding device will not take effect +by using dev_configure(). Because the related configuration will not be +delivered to the slave devices in this way. + +The offloading capability of the bonding device is the intersection of +the capability of all slave devices. Based on this, the following +functions are added to the bonding driver: +1. If a Tx offloading is within the capability of the bonding device + (i.e, all the slave devices support this Tx offloading), the enabling + status of the offloading of all slave devices depends on the + configuration of the bonding device. + +2. For the Tx offloading that is not within the Tx offloading capability + of the bonding device, the enabling status of the offloading on the + slave devices is irrelevant to the bonding device configuration. And + it depends on the original configuration of the slave devices. + +Fixes: e8b3e1a9b1bb ("net/bonding: switch to new offloading API") +Cc: stable@dpdk.org + +Signed-off-by: Chengchang Tang +Signed-off-by: Min Hu (Connor) +--- + drivers/net/bonding/rte_eth_bond_pmd.c | 23 +++++++++++++++-------- + 1 file changed, 15 insertions(+), 8 deletions(-) + +diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c +index 84f4900ee5..0f11a2f5a8 100644 +--- a/drivers/net/bonding/rte_eth_bond_pmd.c ++++ b/drivers/net/bonding/rte_eth_bond_pmd.c +@@ -1713,17 +1713,24 @@ slave_configure(struct rte_eth_dev *bonded_eth_dev, + bonded_eth_dev->data->dev_conf.rxmode.mq_mode; + } + +- if (bonded_eth_dev->data->dev_conf.rxmode.offloads & +- RTE_ETH_RX_OFFLOAD_VLAN_FILTER) +- slave_eth_dev->data->dev_conf.rxmode.offloads |= +- RTE_ETH_RX_OFFLOAD_VLAN_FILTER; +- else +- slave_eth_dev->data->dev_conf.rxmode.offloads &= +- ~RTE_ETH_RX_OFFLOAD_VLAN_FILTER; +- + slave_eth_dev->data->dev_conf.rxmode.mtu = + bonded_eth_dev->data->dev_conf.rxmode.mtu; + ++ slave_eth_dev->data->dev_conf.txmode.offloads |= ++ bonded_eth_dev->data->dev_conf.txmode.offloads; ++ ++ slave_eth_dev->data->dev_conf.txmode.offloads &= ++ (bonded_eth_dev->data->dev_conf.txmode.offloads | ++ ~internals->tx_offload_capa); ++ ++ slave_eth_dev->data->dev_conf.rxmode.offloads |= ++ bonded_eth_dev->data->dev_conf.rxmode.offloads; ++ ++ slave_eth_dev->data->dev_conf.rxmode.offloads &= ++ (bonded_eth_dev->data->dev_conf.rxmode.offloads | ++ ~internals->rx_offload_capa); ++ ++ + nb_rx_queues = bonded_eth_dev->data->nb_rx_queues; + nb_tx_queues = bonded_eth_dev->data->nb_tx_queues; + +-- +2.33.0 + diff --git a/0018-net-hns3-remove-unused-assignment-for-RSS-key.patch b/0018-net-hns3-remove-unused-assignment-for-RSS-key.patch deleted file mode 100644 index c2fd704c11c7457bb6c5f3044a88149c416cff9a..0000000000000000000000000000000000000000 --- a/0018-net-hns3-remove-unused-assignment-for-RSS-key.patch +++ /dev/null @@ -1,74 +0,0 @@ -From 3405d3daec40b258341eeccc5e07c0a9cfd29e6e Mon Sep 17 00:00:00 2001 -From: Lijun Ou -Date: Thu, 14 Jan 2021 21:33:37 +0800 -Subject: [PATCH 018/189] net/hns3: remove unused assignment for RSS key - -The default RSS key does not need to be configured repeatedly -when call hns3_dev_configure function with the NULL RSS key -because the default RSS key has been configured when the PMD -driver run hns3_do_start function with starting device. - -Besides, it will not overwrite the initialized key if -rte_eth_dev_configure API will be called directly and RSS key is NULL -after init PMD driver. - -Therefore, the assignment for RSS key in hns3_dev_configure -function is unnecessary. - -Signed-off-by: Lijun Ou ---- - drivers/net/hns3/hns3_ethdev.c | 6 ------ - drivers/net/hns3/hns3_ethdev_vf.c | 6 ------ - 2 files changed, 12 deletions(-) - -diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c -index 2bc28ef..449d967 100644 ---- a/drivers/net/hns3/hns3_ethdev.c -+++ b/drivers/net/hns3/hns3_ethdev.c -@@ -2316,7 +2316,6 @@ hns3_dev_configure(struct rte_eth_dev *dev) - struct rte_eth_conf *conf = &dev->data->dev_conf; - enum rte_eth_rx_mq_mode mq_mode = conf->rxmode.mq_mode; - struct hns3_hw *hw = &hns->hw; -- struct hns3_rss_conf *rss_cfg = &hw->rss_info; - uint16_t nb_rx_q = dev->data->nb_rx_queues; - uint16_t nb_tx_q = dev->data->nb_tx_queues; - struct rte_eth_rss_conf rss_conf; -@@ -2363,11 +2362,6 @@ hns3_dev_configure(struct rte_eth_dev *dev) - conf->rxmode.offloads |= DEV_RX_OFFLOAD_RSS_HASH; - rss_conf = conf->rx_adv_conf.rss_conf; - hw->rss_dis_flag = false; -- if (rss_conf.rss_key == NULL) { -- rss_conf.rss_key = rss_cfg->key; -- rss_conf.rss_key_len = HNS3_RSS_KEY_SIZE; -- } -- - ret = hns3_dev_rss_hash_update(dev, &rss_conf); - if (ret) - goto cfg_err; -diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c -index ee89505..bb4ec6b 100644 ---- a/drivers/net/hns3/hns3_ethdev_vf.c -+++ b/drivers/net/hns3/hns3_ethdev_vf.c -@@ -773,7 +773,6 @@ hns3vf_dev_configure(struct rte_eth_dev *dev) - { - struct hns3_adapter *hns = dev->data->dev_private; - struct hns3_hw *hw = &hns->hw; -- struct hns3_rss_conf *rss_cfg = &hw->rss_info; - struct rte_eth_conf *conf = &dev->data->dev_conf; - enum rte_eth_rx_mq_mode mq_mode = conf->rxmode.mq_mode; - uint16_t nb_rx_q = dev->data->nb_rx_queues; -@@ -816,11 +815,6 @@ hns3vf_dev_configure(struct rte_eth_dev *dev) - conf->rxmode.offloads |= DEV_RX_OFFLOAD_RSS_HASH; - hw->rss_dis_flag = false; - rss_conf = conf->rx_adv_conf.rss_conf; -- if (rss_conf.rss_key == NULL) { -- rss_conf.rss_key = rss_cfg->key; -- rss_conf.rss_key_len = HNS3_RSS_KEY_SIZE; -- } -- - ret = hns3_dev_rss_hash_update(dev, &rss_conf); - if (ret) - goto cfg_err; --- -2.7.4 - diff --git a/0019-net-hns3-encapsulate-DFX-stats-in-datapath.patch b/0019-net-hns3-encapsulate-DFX-stats-in-datapath.patch deleted file mode 100644 index 0cbec6ea3011d04423a91a107023474879f23b4d..0000000000000000000000000000000000000000 --- a/0019-net-hns3-encapsulate-DFX-stats-in-datapath.patch +++ /dev/null @@ -1,704 +0,0 @@ -From e5d1fe93d832492bd12a0a01c37d2e326d2701f4 Mon Sep 17 00:00:00 2001 -From: Huisong Li -Date: Fri, 22 Jan 2021 18:18:39 +0800 -Subject: [PATCH 019/189] net/hns3: encapsulate DFX stats in datapath - -pkt_len_errors and l2_errors in Rx datapath indicate that driver -needs to discard received packets. And driver does not discard -packets for l3/l4/ol3/ol4_csum_errors in Rx datapath and others -stats in Tx datapath. Therefore, it is necessary for improving -code readability and maintainability to encapsulate error stats -and dfx stats. - -Signed-off-by: Huisong Li -Signed-off-by: Lijun Ou ---- - drivers/net/hns3/hns3_rxtx.c | 30 ++--- - drivers/net/hns3/hns3_rxtx.h | 134 ++++++++++--------- - drivers/net/hns3/hns3_rxtx_vec_neon.h | 2 +- - drivers/net/hns3/hns3_stats.c | 243 ++++++++++++++++++++++------------ - drivers/net/hns3/hns3_stats.h | 9 +- - 5 files changed, 251 insertions(+), 167 deletions(-) - -diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c -index 0badfc9..3d5f74f 100644 ---- a/drivers/net/hns3/hns3_rxtx.c -+++ b/drivers/net/hns3/hns3_rxtx.c -@@ -1792,12 +1792,8 @@ hns3_rx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t nb_desc, - rxq->io_head_reg = (volatile void *)((char *)rxq->io_base + - HNS3_RING_RX_HEAD_REG); - rxq->rx_buf_len = rx_buf_size; -- rxq->l2_errors = 0; -- rxq->pkt_len_errors = 0; -- rxq->l3_csum_errors = 0; -- rxq->l4_csum_errors = 0; -- rxq->ol3_csum_errors = 0; -- rxq->ol4_csum_errors = 0; -+ memset(&rxq->err_stats, 0, sizeof(struct hns3_rx_bd_errors_stats)); -+ memset(&rxq->dfx_stats, 0, sizeof(struct hns3_rx_dfx_stats)); - - /* CRC len set here is used for amending packet length */ - if (dev->data->dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_KEEP_CRC) -@@ -2622,12 +2618,8 @@ hns3_tx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t nb_desc, - HNS3_RING_TX_TAIL_REG); - txq->min_tx_pkt_len = hw->min_tx_pkt_len; - txq->tso_mode = hw->tso_mode; -- txq->over_length_pkt_cnt = 0; -- txq->exceed_limit_bd_pkt_cnt = 0; -- txq->exceed_limit_bd_reassem_fail = 0; -- txq->unsupported_tunnel_pkt_cnt = 0; -- txq->queue_full_cnt = 0; -- txq->pkt_padding_fail_cnt = 0; -+ memset(&txq->dfx_stats, 0, sizeof(struct hns3_tx_dfx_stats)); -+ - rte_spinlock_lock(&hw->lock); - dev->data->tx_queues[idx] = txq; - rte_spinlock_unlock(&hw->lock); -@@ -3350,7 +3342,7 @@ hns3_parse_cksum(struct hns3_tx_queue *txq, uint16_t tx_desc_id, - if (m->ol_flags & HNS3_TX_CKSUM_OFFLOAD_MASK) { - /* Fill in tunneling parameters if necessary */ - if (hns3_parse_tunneling_params(txq, m, tx_desc_id)) { -- txq->unsupported_tunnel_pkt_cnt++; -+ txq->dfx_stats.unsupported_tunnel_pkt_cnt++; - return -EINVAL; - } - -@@ -3380,17 +3372,17 @@ hns3_check_non_tso_pkt(uint16_t nb_buf, struct rte_mbuf **m_seg, - * driver support, the packet will be ignored. - */ - if (unlikely(rte_pktmbuf_pkt_len(tx_pkt) > HNS3_MAX_FRAME_LEN)) { -- txq->over_length_pkt_cnt++; -+ txq->dfx_stats.over_length_pkt_cnt++; - return -EINVAL; - } - - max_non_tso_bd_num = txq->max_non_tso_bd_num; - if (unlikely(nb_buf > max_non_tso_bd_num)) { -- txq->exceed_limit_bd_pkt_cnt++; -+ txq->dfx_stats.exceed_limit_bd_pkt_cnt++; - ret = hns3_reassemble_tx_pkts(tx_pkt, &new_pkt, - max_non_tso_bd_num); - if (ret) { -- txq->exceed_limit_bd_reassem_fail++; -+ txq->dfx_stats.exceed_limit_bd_reassem_fail++; - return ret; - } - *m_seg = new_pkt; -@@ -3528,7 +3520,7 @@ hns3_xmit_pkts_simple(void *tx_queue, - nb_pkts = RTE_MIN(txq->tx_bd_ready, nb_pkts); - if (unlikely(nb_pkts == 0)) { - if (txq->tx_bd_ready == 0) -- txq->queue_full_cnt++; -+ txq->dfx_stats.queue_full_cnt++; - return 0; - } - -@@ -3580,7 +3572,7 @@ hns3_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) - nb_buf = tx_pkt->nb_segs; - - if (nb_buf > txq->tx_bd_ready) { -- txq->queue_full_cnt++; -+ txq->dfx_stats.queue_full_cnt++; - if (nb_tx == 0) - return 0; - -@@ -3601,7 +3593,7 @@ hns3_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) - rte_pktmbuf_pkt_len(tx_pkt); - appended = rte_pktmbuf_append(tx_pkt, add_len); - if (appended == NULL) { -- txq->pkt_padding_fail_cnt++; -+ txq->dfx_stats.pkt_padding_fail_cnt++; - break; - } - -diff --git a/drivers/net/hns3/hns3_rxtx.h b/drivers/net/hns3/hns3_rxtx.h -index 6538848..8a0c981 100644 ---- a/drivers/net/hns3/hns3_rxtx.h -+++ b/drivers/net/hns3/hns3_rxtx.h -@@ -266,6 +266,18 @@ struct hns3_entry { - struct rte_mbuf *mbuf; - }; - -+struct hns3_rx_dfx_stats { -+ uint64_t l3_csum_errors; -+ uint64_t l4_csum_errors; -+ uint64_t ol3_csum_errors; -+ uint64_t ol4_csum_errors; -+}; -+ -+struct hns3_rx_bd_errors_stats { -+ uint64_t l2_errors; -+ uint64_t pkt_len_errors; -+}; -+ - struct hns3_rx_queue { - void *io_base; - volatile void *io_head_reg; -@@ -312,12 +324,10 @@ struct hns3_rx_queue { - bool pvid_sw_discard_en; - bool enabled; /* indicate if Rx queue has been enabled */ - -- uint64_t l2_errors; -- uint64_t pkt_len_errors; -- uint64_t l3_csum_errors; -- uint64_t l4_csum_errors; -- uint64_t ol3_csum_errors; -- uint64_t ol4_csum_errors; -+ /* DFX statistics that driver does not need to discard packets */ -+ struct hns3_rx_dfx_stats dfx_stats; -+ /* Error statistics that driver needs to discard packets */ -+ struct hns3_rx_bd_errors_stats err_stats; - - struct rte_mbuf *bulk_mbuf[HNS3_BULK_ALLOC_MBUF_NUM]; - uint16_t bulk_mbuf_num; -@@ -328,6 +338,57 @@ struct hns3_rx_queue { - struct rte_mbuf fake_mbuf; /* fake mbuf used with vector rx */ - }; - -+/* -+ * The following items are used for the abnormal errors statistics in -+ * the Tx datapath. When upper level application calls the -+ * rte_eth_tx_burst API function to send multiple packets at a time with -+ * burst mode based on hns3 network engine, there are some abnormal -+ * conditions that cause the driver to fail to operate the hardware to -+ * send packets correctly. -+ * Note: When using burst mode to call the rte_eth_tx_burst API function -+ * to send multiple packets at a time. When the first abnormal error is -+ * detected, add one to the relevant error statistics item, and then -+ * exit the loop of sending multiple packets of the function. That is to -+ * say, even if there are multiple packets in which abnormal errors may -+ * be detected in the burst, the relevant error statistics in the driver -+ * will only be increased by one. -+ * The detail description of the Tx abnormal errors statistic items as -+ * below: -+ * - over_length_pkt_cnt -+ * Total number of greater than HNS3_MAX_FRAME_LEN the driver -+ * supported. -+ * -+ * - exceed_limit_bd_pkt_cnt -+ * Total number of exceeding the hardware limited bd which process -+ * a packet needed bd numbers. -+ * -+ * - exceed_limit_bd_reassem_fail -+ * Total number of exceeding the hardware limited bd fail which -+ * process a packet needed bd numbers and reassemble fail. -+ * -+ * - unsupported_tunnel_pkt_cnt -+ * Total number of unsupported tunnel packet. The unsupported tunnel -+ * type: vxlan_gpe, gtp, ipip and MPLSINUDP, MPLSINUDP is a packet -+ * with MPLS-in-UDP RFC 7510 header. -+ * -+ * - queue_full_cnt -+ * Total count which the available bd numbers in current bd queue is -+ * less than the bd numbers with the pkt process needed. -+ * -+ * - pkt_padding_fail_cnt -+ * Total count which the packet length is less than minimum packet -+ * length(struct hns3_tx_queue::min_tx_pkt_len) supported by -+ * hardware in Tx direction and fail to be appended with 0. -+ */ -+struct hns3_tx_dfx_stats { -+ uint64_t over_length_pkt_cnt; -+ uint64_t exceed_limit_bd_pkt_cnt; -+ uint64_t exceed_limit_bd_reassem_fail; -+ uint64_t unsupported_tunnel_pkt_cnt; -+ uint64_t queue_full_cnt; -+ uint64_t pkt_padding_fail_cnt; -+}; -+ - struct hns3_tx_queue { - void *io_base; - volatile void *io_tail_reg; -@@ -411,54 +472,7 @@ struct hns3_tx_queue { - bool pvid_sw_shift_en; - bool enabled; /* indicate if Tx queue has been enabled */ - -- /* -- * The following items are used for the abnormal errors statistics in -- * the Tx datapath. When upper level application calls the -- * rte_eth_tx_burst API function to send multiple packets at a time with -- * burst mode based on hns3 network engine, there are some abnormal -- * conditions that cause the driver to fail to operate the hardware to -- * send packets correctly. -- * Note: When using burst mode to call the rte_eth_tx_burst API function -- * to send multiple packets at a time. When the first abnormal error is -- * detected, add one to the relevant error statistics item, and then -- * exit the loop of sending multiple packets of the function. That is to -- * say, even if there are multiple packets in which abnormal errors may -- * be detected in the burst, the relevant error statistics in the driver -- * will only be increased by one. -- * The detail description of the Tx abnormal errors statistic items as -- * below: -- * - over_length_pkt_cnt -- * Total number of greater than HNS3_MAX_FRAME_LEN the driver -- * supported. -- * -- * - exceed_limit_bd_pkt_cnt -- * Total number of exceeding the hardware limited bd which process -- * a packet needed bd numbers. -- * -- * - exceed_limit_bd_reassem_fail -- * Total number of exceeding the hardware limited bd fail which -- * process a packet needed bd numbers and reassemble fail. -- * -- * - unsupported_tunnel_pkt_cnt -- * Total number of unsupported tunnel packet. The unsupported tunnel -- * type: vxlan_gpe, gtp, ipip and MPLSINUDP, MPLSINUDP is a packet -- * with MPLS-in-UDP RFC 7510 header. -- * -- * - queue_full_cnt -- * Total count which the available bd numbers in current bd queue is -- * less than the bd numbers with the pkt process needed. -- * -- * - pkt_padding_fail_cnt -- * Total count which the packet length is less than minimum packet -- * length(struct hns3_tx_queue::min_tx_pkt_len) supported by -- * hardware in Tx direction and fail to be appended with 0. -- */ -- uint64_t over_length_pkt_cnt; -- uint64_t exceed_limit_bd_pkt_cnt; -- uint64_t exceed_limit_bd_reassem_fail; -- uint64_t unsupported_tunnel_pkt_cnt; -- uint64_t queue_full_cnt; -- uint64_t pkt_padding_fail_cnt; -+ struct hns3_tx_dfx_stats dfx_stats; - }; - - #define HNS3_GET_TX_QUEUE_PEND_BD_NUM(txq) \ -@@ -511,9 +525,9 @@ hns3_handle_bdinfo(struct hns3_rx_queue *rxq, struct rte_mbuf *rxm, - - if (unlikely((l234_info & L2E_TRUNC_ERR_FLAG) || rxm->pkt_len == 0)) { - if (l234_info & BIT(HNS3_RXD_L2E_B)) -- rxq->l2_errors++; -+ rxq->err_stats.l2_errors++; - else -- rxq->pkt_len_errors++; -+ rxq->err_stats.pkt_len_errors++; - return -EINVAL; - } - -@@ -525,24 +539,24 @@ hns3_handle_bdinfo(struct hns3_rx_queue *rxq, struct rte_mbuf *rxm, - - if (unlikely(l234_info & BIT(HNS3_RXD_L3E_B))) { - rxm->ol_flags |= PKT_RX_IP_CKSUM_BAD; -- rxq->l3_csum_errors++; -+ rxq->dfx_stats.l3_csum_errors++; - tmp |= HNS3_L3_CKSUM_ERR; - } - - if (unlikely(l234_info & BIT(HNS3_RXD_L4E_B))) { - rxm->ol_flags |= PKT_RX_L4_CKSUM_BAD; -- rxq->l4_csum_errors++; -+ rxq->dfx_stats.l4_csum_errors++; - tmp |= HNS3_L4_CKSUM_ERR; - } - - if (unlikely(l234_info & BIT(HNS3_RXD_OL3E_B))) { -- rxq->ol3_csum_errors++; -+ rxq->dfx_stats.ol3_csum_errors++; - tmp |= HNS3_OUTER_L3_CKSUM_ERR; - } - - if (unlikely(l234_info & BIT(HNS3_RXD_OL4E_B))) { - rxm->ol_flags |= PKT_RX_OUTER_L4_CKSUM_BAD; -- rxq->ol4_csum_errors++; -+ rxq->dfx_stats.ol4_csum_errors++; - tmp |= HNS3_OUTER_L4_CKSUM_ERR; - } - } -diff --git a/drivers/net/hns3/hns3_rxtx_vec_neon.h b/drivers/net/hns3/hns3_rxtx_vec_neon.h -index 54addbf..a693b4b 100644 ---- a/drivers/net/hns3/hns3_rxtx_vec_neon.h -+++ b/drivers/net/hns3/hns3_rxtx_vec_neon.h -@@ -42,7 +42,7 @@ hns3_xmit_fixed_burst_vec(void *__restrict tx_queue, - - nb_commit = RTE_MIN(txq->tx_bd_ready, nb_pkts); - if (unlikely(nb_commit == 0)) { -- txq->queue_full_cnt++; -+ txq->dfx_stats.queue_full_cnt++; - return 0; - } - nb_tx = nb_commit; -diff --git a/drivers/net/hns3/hns3_stats.c b/drivers/net/hns3/hns3_stats.c -index 62a712b..419d7e2 100644 ---- a/drivers/net/hns3/hns3_stats.c -+++ b/drivers/net/hns3/hns3_stats.c -@@ -262,34 +262,38 @@ static const struct hns3_xstats_name_offset hns3_reset_stats_strings[] = { - - /* The statistic of errors in Rx BD */ - static const struct hns3_xstats_name_offset hns3_rx_bd_error_strings[] = { -- {"RX_PKT_LEN_ERRORS", -+ {"PKT_LEN_ERRORS", - HNS3_RX_BD_ERROR_STATS_FIELD_OFFSET(pkt_len_errors)}, -- {"L2_RX_ERRORS", -- HNS3_RX_BD_ERROR_STATS_FIELD_OFFSET(l2_errors)}, -- {"RX_L3_CHECKSUM_ERRORS", -- HNS3_RX_BD_ERROR_STATS_FIELD_OFFSET(l3_csum_errors)}, -- {"RX_L4_CHECKSUM_ERRORS", -- HNS3_RX_BD_ERROR_STATS_FIELD_OFFSET(l4_csum_errors)}, -- {"RX_OL3_CHECKSUM_ERRORS", -- HNS3_RX_BD_ERROR_STATS_FIELD_OFFSET(ol3_csum_errors)}, -- {"RX_OL4_CHECKSUM_ERRORS", -- HNS3_RX_BD_ERROR_STATS_FIELD_OFFSET(ol4_csum_errors)} -+ {"L2_ERRORS", -+ HNS3_RX_BD_ERROR_STATS_FIELD_OFFSET(l2_errors)} - }; - --/* The statistic of the Tx errors */ --static const struct hns3_xstats_name_offset hns3_tx_errors_strings[] = { -- {"TX_OVER_LENGTH_PKT_CNT", -- HNS3_TX_ERROR_STATS_FIELD_OFFSET(over_length_pkt_cnt)}, -- {"TX_EXCEED_LIMITED_BD_PKT_CNT", -- HNS3_TX_ERROR_STATS_FIELD_OFFSET(exceed_limit_bd_pkt_cnt)}, -- {"TX_EXCEED_LIMITED_BD_PKT_REASSEMBLE_FAIL_CNT", -- HNS3_TX_ERROR_STATS_FIELD_OFFSET(exceed_limit_bd_reassem_fail)}, -- {"TX_UNSUPPORTED_TUNNEL_PKT_CNT", -- HNS3_TX_ERROR_STATS_FIELD_OFFSET(unsupported_tunnel_pkt_cnt)}, -- {"TX_QUEUE_FULL_CNT", -- HNS3_TX_ERROR_STATS_FIELD_OFFSET(queue_full_cnt)}, -- {"TX_SHORT_PKT_PAD_FAIL_CNT", -- HNS3_TX_ERROR_STATS_FIELD_OFFSET(pkt_padding_fail_cnt)} -+/* The dfx statistic in Rx datapath */ -+static const struct hns3_xstats_name_offset hns3_rxq_dfx_stats_strings[] = { -+ {"L3_CHECKSUM_ERRORS", -+ HNS3_RXQ_DFX_STATS_FIELD_OFFSET(l3_csum_errors)}, -+ {"L4_CHECKSUM_ERRORS", -+ HNS3_RXQ_DFX_STATS_FIELD_OFFSET(l4_csum_errors)}, -+ {"OL3_CHECKSUM_ERRORS", -+ HNS3_RXQ_DFX_STATS_FIELD_OFFSET(ol3_csum_errors)}, -+ {"OL4_CHECKSUM_ERRORS", -+ HNS3_RXQ_DFX_STATS_FIELD_OFFSET(ol4_csum_errors)} -+}; -+ -+/* The dfx statistic in Tx datapath */ -+static const struct hns3_xstats_name_offset hns3_txq_dfx_stats_strings[] = { -+ {"OVER_LENGTH_PKT_CNT", -+ HNS3_TXQ_DFX_STATS_FIELD_OFFSET(over_length_pkt_cnt)}, -+ {"EXCEED_LIMITED_BD_PKT_CNT", -+ HNS3_TXQ_DFX_STATS_FIELD_OFFSET(exceed_limit_bd_pkt_cnt)}, -+ {"EXCEED_LIMITED_BD_PKT_REASSEMBLE_FAIL_CNT", -+ HNS3_TXQ_DFX_STATS_FIELD_OFFSET(exceed_limit_bd_reassem_fail)}, -+ {"UNSUPPORTED_TUNNEL_PKT_CNT", -+ HNS3_TXQ_DFX_STATS_FIELD_OFFSET(unsupported_tunnel_pkt_cnt)}, -+ {"QUEUE_FULL_CNT", -+ HNS3_TXQ_DFX_STATS_FIELD_OFFSET(queue_full_cnt)}, -+ {"SHORT_PKT_PAD_FAIL_CNT", -+ HNS3_TXQ_DFX_STATS_FIELD_OFFSET(pkt_padding_fail_cnt)} - }; - - /* The statistic of rx queue */ -@@ -314,8 +318,11 @@ static const struct hns3_xstats_name_offset hns3_tx_queue_strings[] = { - #define HNS3_NUM_RX_BD_ERROR_XSTATS (sizeof(hns3_rx_bd_error_strings) / \ - sizeof(hns3_rx_bd_error_strings[0])) - --#define HNS3_NUM_TX_ERRORS_XSTATS (sizeof(hns3_tx_errors_strings) / \ -- sizeof(hns3_tx_errors_strings[0])) -+#define HNS3_NUM_RXQ_DFX_XSTATS (sizeof(hns3_rxq_dfx_stats_strings) / \ -+ sizeof(hns3_rxq_dfx_stats_strings[0])) -+ -+#define HNS3_NUM_TXQ_DFX_XSTATS (sizeof(hns3_txq_dfx_stats_strings) / \ -+ sizeof(hns3_txq_dfx_stats_strings[0])) - - #define HNS3_NUM_RX_QUEUE_STATS (sizeof(hns3_rx_queue_strings) / \ - sizeof(hns3_rx_queue_strings[0])) -@@ -519,7 +526,8 @@ hns3_stats_get(struct rte_eth_dev *eth_dev, struct rte_eth_stats *rte_stats) - for (i = 0; i != num; ++i) { - rxq = eth_dev->data->rx_queues[i]; - if (rxq) { -- cnt = rxq->l2_errors + rxq->pkt_len_errors; -+ cnt = rxq->err_stats.l2_errors + -+ rxq->err_stats.pkt_len_errors; - rte_stats->q_errors[i] = cnt; - rte_stats->q_ipackets[i] = - stats->rcb_rx_ring_pktnum[i] - cnt; -@@ -584,11 +592,11 @@ hns3_stats_reset(struct rte_eth_dev *eth_dev) - * Clear soft stats of rx error packet which will be dropped - * in driver. - */ -- for (i = 0; i < eth_dev->data->nb_rx_queues; ++i) { -+ for (i = 0; i < eth_dev->data->nb_rx_queues; i++) { - rxq = eth_dev->data->rx_queues[i]; - if (rxq) { -- rxq->pkt_len_errors = 0; -- rxq->l2_errors = 0; -+ rxq->err_stats.pkt_len_errors = 0; -+ rxq->err_stats.l2_errors = 0; - } - } - -@@ -621,21 +629,24 @@ static int - hns3_xstats_calc_num(struct rte_eth_dev *dev) - { - struct hns3_adapter *hns = dev->data->dev_private; -- int bderr_stats = dev->data->nb_rx_queues * HNS3_NUM_RX_BD_ERROR_XSTATS; -- int tx_err_stats = dev->data->nb_tx_queues * HNS3_NUM_TX_ERRORS_XSTATS; -- int rx_queue_stats = dev->data->nb_rx_queues * HNS3_NUM_RX_QUEUE_STATS; -- int tx_queue_stats = dev->data->nb_tx_queues * HNS3_NUM_TX_QUEUE_STATS; -+ uint16_t nb_rx_q = dev->data->nb_rx_queues; -+ uint16_t nb_tx_q = dev->data->nb_tx_queues; -+ int bderr_stats = nb_rx_q * HNS3_NUM_RX_BD_ERROR_XSTATS; -+ int rx_dfx_stats = nb_rx_q * HNS3_NUM_RXQ_DFX_XSTATS; -+ int tx_dfx_stats = nb_tx_q * HNS3_NUM_TXQ_DFX_XSTATS; -+ int rx_queue_stats = nb_rx_q * HNS3_NUM_RX_QUEUE_STATS; -+ int tx_queue_stats = nb_tx_q * HNS3_NUM_TX_QUEUE_STATS; - - if (hns->is_vf) -- return bderr_stats + tx_err_stats + rx_queue_stats + -- tx_queue_stats + HNS3_NUM_RESET_XSTATS; -+ return bderr_stats + rx_dfx_stats + tx_dfx_stats + -+ rx_queue_stats + tx_queue_stats + HNS3_NUM_RESET_XSTATS; - else -- return bderr_stats + tx_err_stats + rx_queue_stats + -- tx_queue_stats + HNS3_FIX_NUM_STATS; -+ return bderr_stats + rx_dfx_stats + tx_dfx_stats + -+ rx_queue_stats + tx_queue_stats + HNS3_FIX_NUM_STATS; - } - - static void --hns3_get_queue_stats(struct rte_eth_dev *dev, struct rte_eth_xstat *xstats, -+hns3_queue_stats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *xstats, - int *count) - { - struct hns3_adapter *hns = dev->data->dev_private; -@@ -683,6 +694,63 @@ hns3_error_int_stats_add(struct hns3_adapter *hns, const char *err) - } - } - -+static void -+hns3_rxq_dfx_stats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *xstats, -+ int *count) -+{ -+ struct hns3_rx_dfx_stats *dfx_stats; -+ struct hns3_rx_queue *rxq; -+ uint16_t i, j; -+ char *val; -+ -+ for (i = 0; i < dev->data->nb_rx_queues; i++) { -+ rxq = (struct hns3_rx_queue *)dev->data->rx_queues[i]; -+ if (rxq == NULL) -+ continue; -+ -+ dfx_stats = &rxq->dfx_stats; -+ for (j = 0; j < HNS3_NUM_RXQ_DFX_XSTATS; j++) { -+ val = (char *)dfx_stats + -+ hns3_rxq_dfx_stats_strings[j].offset; -+ xstats[*count].value = *(uint64_t *)val; -+ xstats[*count].id = *count; -+ (*count)++; -+ } -+ } -+} -+ -+static void -+hns3_txq_dfx_stats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *xstats, -+ int *count) -+{ -+ struct hns3_tx_dfx_stats *dfx_stats; -+ struct hns3_tx_queue *txq; -+ uint16_t i, j; -+ char *val; -+ -+ for (i = 0; i < dev->data->nb_tx_queues; i++) { -+ txq = (struct hns3_tx_queue *)dev->data->tx_queues[i]; -+ if (txq == NULL) -+ continue; -+ -+ dfx_stats = &txq->dfx_stats; -+ for (j = 0; j < HNS3_NUM_TXQ_DFX_XSTATS; j++) { -+ val = (char *)dfx_stats + -+ hns3_txq_dfx_stats_strings[j].offset; -+ xstats[*count].value = *(uint64_t *)val; -+ xstats[*count].id = *count; -+ (*count)++; -+ } -+ } -+} -+ -+static void -+hns3_tqp_dfx_stats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *xstats, -+ int *count) -+{ -+ hns3_rxq_dfx_stats_get(dev, xstats, count); -+ hns3_txq_dfx_stats_get(dev, xstats, count); -+} - /* - * Retrieve extended(tqp | Mac) statistics of an Ethernet device. - * @param dev -@@ -705,8 +773,8 @@ hns3_dev_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *xstats, - struct hns3_hw *hw = &hns->hw; - struct hns3_mac_stats *mac_stats = &hw->mac_stats; - struct hns3_reset_stats *reset_stats = &hw->reset.stats; -+ struct hns3_rx_bd_errors_stats *rx_err_stats; - struct hns3_rx_queue *rxq; -- struct hns3_tx_queue *txq; - uint16_t i, j; - char *addr; - int count; -@@ -758,26 +826,49 @@ hns3_dev_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *xstats, - for (j = 0; j < dev->data->nb_rx_queues; j++) { - for (i = 0; i < HNS3_NUM_RX_BD_ERROR_XSTATS; i++) { - rxq = dev->data->rx_queues[j]; -- addr = (char *)rxq + hns3_rx_bd_error_strings[i].offset; -- xstats[count].value = *(uint64_t *)addr; -- xstats[count].id = count; -- count++; -+ if (rxq) { -+ rx_err_stats = &rxq->err_stats; -+ addr = (char *)rx_err_stats + -+ hns3_rx_bd_error_strings[i].offset; -+ xstats[count].value = *(uint64_t *)addr; -+ xstats[count].id = count; -+ count++; -+ } - } - } - -- /* Get the Tx errors stats */ -- for (j = 0; j < dev->data->nb_tx_queues; j++) { -- for (i = 0; i < HNS3_NUM_TX_ERRORS_XSTATS; i++) { -- txq = dev->data->tx_queues[j]; -- addr = (char *)txq + hns3_tx_errors_strings[i].offset; -- xstats[count].value = *(uint64_t *)addr; -- xstats[count].id = count; -- count++; -+ hns3_tqp_dfx_stats_get(dev, xstats, &count); -+ hns3_queue_stats_get(dev, xstats, &count); -+ -+ return count; -+} -+ -+static void -+hns3_tqp_dfx_stats_name_get(struct rte_eth_dev *dev, -+ struct rte_eth_xstat_name *xstats_names, -+ uint32_t *count) -+{ -+ uint16_t i, j; -+ -+ for (j = 0; j < dev->data->nb_rx_queues; j++) { -+ for (i = 0; i < HNS3_NUM_RXQ_DFX_XSTATS; i++) { -+ snprintf(xstats_names[*count].name, -+ sizeof(xstats_names[*count].name), -+ "rx_q%u_%s", j, -+ hns3_rxq_dfx_stats_strings[i].name); -+ (*count)++; - } - } - -- hns3_get_queue_stats(dev, xstats, &count); -- return count; -+ for (j = 0; j < dev->data->nb_tx_queues; j++) { -+ for (i = 0; i < HNS3_NUM_TXQ_DFX_XSTATS; i++) { -+ snprintf(xstats_names[*count].name, -+ sizeof(xstats_names[*count].name), -+ "tx_q%u_%s", j, -+ hns3_txq_dfx_stats_strings[i].name); -+ (*count)++; -+ } -+ } - } - - /* -@@ -845,27 +936,19 @@ hns3_dev_xstats_get_names(struct rte_eth_dev *dev, - for (i = 0; i < HNS3_NUM_RX_BD_ERROR_XSTATS; i++) { - snprintf(xstats_names[count].name, - sizeof(xstats_names[count].name), -- "rx_q%u%s", j, -+ "rx_q%u_%s", j, - hns3_rx_bd_error_strings[i].name); - count++; - } - } - -- for (j = 0; j < dev->data->nb_tx_queues; j++) { -- for (i = 0; i < HNS3_NUM_TX_ERRORS_XSTATS; i++) { -- snprintf(xstats_names[count].name, -- sizeof(xstats_names[count].name), -- "tx_q%u%s", j, -- hns3_tx_errors_strings[i].name); -- count++; -- } -- } -+ hns3_tqp_dfx_stats_name_get(dev, xstats_names, &count); - - for (j = 0; j < dev->data->nb_rx_queues; j++) { - for (i = 0; i < HNS3_NUM_RX_QUEUE_STATS; i++) { - snprintf(xstats_names[count].name, - sizeof(xstats_names[count].name), -- "rx_q%u%s", j, hns3_rx_queue_strings[i].name); -+ "rx_q%u_%s", j, hns3_rx_queue_strings[i].name); - count++; - } - } -@@ -874,7 +957,7 @@ hns3_dev_xstats_get_names(struct rte_eth_dev *dev, - for (i = 0; i < HNS3_NUM_TX_QUEUE_STATS; i++) { - snprintf(xstats_names[count].name, - sizeof(xstats_names[count].name), -- "tx_q%u%s", j, hns3_tx_queue_strings[i].name); -+ "tx_q%u_%s", j, hns3_tx_queue_strings[i].name); - count++; - } - } -@@ -1043,30 +1126,22 @@ hns3_tqp_dfx_stats_clear(struct rte_eth_dev *dev) - { - struct hns3_rx_queue *rxq; - struct hns3_tx_queue *txq; -- int i; -+ uint16_t i; - - /* Clear Rx dfx stats */ -- for (i = 0; i < dev->data->nb_rx_queues; ++i) { -+ for (i = 0; i < dev->data->nb_rx_queues; i++) { - rxq = dev->data->rx_queues[i]; -- if (rxq) { -- rxq->l3_csum_errors = 0; -- rxq->l4_csum_errors = 0; -- rxq->ol3_csum_errors = 0; -- rxq->ol4_csum_errors = 0; -- } -+ if (rxq) -+ memset(&rxq->dfx_stats, 0, -+ sizeof(struct hns3_rx_dfx_stats)); - } - - /* Clear Tx dfx stats */ -- for (i = 0; i < dev->data->nb_tx_queues; ++i) { -+ for (i = 0; i < dev->data->nb_tx_queues; i++) { - txq = dev->data->tx_queues[i]; -- if (txq) { -- txq->over_length_pkt_cnt = 0; -- txq->exceed_limit_bd_pkt_cnt = 0; -- txq->exceed_limit_bd_reassem_fail = 0; -- txq->unsupported_tunnel_pkt_cnt = 0; -- txq->queue_full_cnt = 0; -- txq->pkt_padding_fail_cnt = 0; -- } -+ if (txq) -+ memset(&txq->dfx_stats, 0, -+ sizeof(struct hns3_tx_dfx_stats)); - } - } - -diff --git a/drivers/net/hns3/hns3_stats.h b/drivers/net/hns3/hns3_stats.h -index 9fcd5f9..12842cd 100644 ---- a/drivers/net/hns3/hns3_stats.h -+++ b/drivers/net/hns3/hns3_stats.h -@@ -127,10 +127,13 @@ struct hns3_reset_stats; - (offsetof(struct hns3_reset_stats, f)) - - #define HNS3_RX_BD_ERROR_STATS_FIELD_OFFSET(f) \ -- (offsetof(struct hns3_rx_queue, f)) -+ (offsetof(struct hns3_rx_bd_errors_stats, f)) - --#define HNS3_TX_ERROR_STATS_FIELD_OFFSET(f) \ -- (offsetof(struct hns3_tx_queue, f)) -+#define HNS3_RXQ_DFX_STATS_FIELD_OFFSET(f) \ -+ (offsetof(struct hns3_rx_dfx_stats, f)) -+ -+#define HNS3_TXQ_DFX_STATS_FIELD_OFFSET(f) \ -+ (offsetof(struct hns3_tx_dfx_stats, f)) - - int hns3_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *rte_stats); - int hns3_dev_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *xstats, --- -2.7.4 - diff --git a/0019-net-hns3-fix-Rx-Tx-when-fast-path-operation-introduc.patch b/0019-net-hns3-fix-Rx-Tx-when-fast-path-operation-introduc.patch new file mode 100644 index 0000000000000000000000000000000000000000..71adecfd99c1f65510ecc74bbb7223cbcd1b1be2 --- /dev/null +++ b/0019-net-hns3-fix-Rx-Tx-when-fast-path-operation-introduc.patch @@ -0,0 +1,114 @@ +From 7ae766e2863868698a26a17f40995bd5ba02356d Mon Sep 17 00:00:00 2001 +From: "Min Hu (Connor)" +Date: Mon, 17 Jan 2022 10:43:00 +0800 +Subject: [PATCH] net/hns3: fix Rx/Tx when fast path operation introduced + +When fast path operation is introduced, the Rx/Tx function is done by +object 'rte_eth_fp_ops'. So 'rte_eth_fp_ops' should be updated if +'fast-path functions' need to be changed, such as PMD receive function, +prepare function and so on. + +This patch fixed receiving packets bug when fast path operation is +introduced. + +Fixes: bba636698316 ("net/hns3: support Rx/Tx and related operations") +Fixes: 168b7d79dada ("net/hns3: support set link up/down for PF") +Cc: stable@dpdk.org + +Signed-off-by: Min Hu (Connor) +--- + drivers/net/hns3/hns3_mp.c | 7 ++----- + drivers/net/hns3/hns3_rxtx.c | 28 +++++++++++++++++++++++++++- + 2 files changed, 29 insertions(+), 6 deletions(-) + +diff --git a/drivers/net/hns3/hns3_mp.c b/drivers/net/hns3/hns3_mp.c +index 999b407f7d..e74ddea195 100644 +--- a/drivers/net/hns3/hns3_mp.c ++++ b/drivers/net/hns3/hns3_mp.c +@@ -74,7 +74,6 @@ mp_secondary_handle(const struct rte_mp_msg *mp_msg, const void *peer) + struct hns3_mp_param *res = (struct hns3_mp_param *)mp_res.param; + const struct hns3_mp_param *param = + (const struct hns3_mp_param *)mp_msg->param; +- eth_tx_prep_t prep = NULL; + struct rte_eth_dev *dev; + int ret; + +@@ -98,14 +97,12 @@ mp_secondary_handle(const struct rte_mp_msg *mp_msg, const void *peer) + case HNS3_MP_REQ_START_TX: + PMD_INIT_LOG(INFO, "port %u starting Tx datapath", + dev->data->port_id); +- dev->tx_pkt_burst = hns3_get_tx_function(dev, &prep); +- dev->tx_pkt_prepare = prep; ++ hns3_start_tx_datapath(dev); + break; + case HNS3_MP_REQ_STOP_TX: + PMD_INIT_LOG(INFO, "port %u stopping Tx datapath", + dev->data->port_id); +- dev->tx_pkt_burst = hns3_dummy_rxtx_burst; +- dev->tx_pkt_prepare = NULL; ++ hns3_stop_tx_datapath(dev); + break; + default: + rte_errno = EINVAL; +diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c +index d240e36e6a..c86aeb2366 100644 +--- a/drivers/net/hns3/hns3_rxtx.c ++++ b/drivers/net/hns3/hns3_rxtx.c +@@ -4408,7 +4408,21 @@ hns3_trace_rxtx_function(struct rte_eth_dev *dev) + rx_mode.info, tx_mode.info); + } + +-void hns3_set_rxtx_function(struct rte_eth_dev *eth_dev) ++static void ++hns3_eth_dev_fp_ops_config(const struct rte_eth_dev *dev) ++{ ++ struct rte_eth_fp_ops *fpo = rte_eth_fp_ops; ++ uint16_t port_id = dev->data->port_id; ++ ++ fpo[port_id].rx_pkt_burst = dev->rx_pkt_burst; ++ fpo[port_id].tx_pkt_burst = dev->tx_pkt_burst; ++ fpo[port_id].tx_pkt_prepare = dev->tx_pkt_prepare; ++ fpo[port_id].rx_descriptor_status = dev->rx_descriptor_status; ++ fpo[port_id].tx_descriptor_status = dev->tx_descriptor_status; ++} ++ ++void ++hns3_set_rxtx_function(struct rte_eth_dev *eth_dev) + { + struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private); + struct hns3_adapter *hns = eth_dev->data->dev_private; +@@ -4429,6 +4443,8 @@ void hns3_set_rxtx_function(struct rte_eth_dev *eth_dev) + eth_dev->tx_pkt_burst = hns3_dummy_rxtx_burst; + eth_dev->tx_pkt_prepare = NULL; + } ++ ++ hns3_eth_dev_fp_ops_config(eth_dev); + } + + void +@@ -4729,6 +4745,11 @@ hns3_stop_tx_datapath(struct rte_eth_dev *dev) + { + dev->tx_pkt_burst = hns3_dummy_rxtx_burst; + dev->tx_pkt_prepare = NULL; ++ hns3_eth_dev_fp_ops_config(dev); ++ ++ if (rte_eal_process_type() == RTE_PROC_SECONDARY) ++ return; ++ + rte_wmb(); + /* Disable tx datapath on secondary process. */ + hns3_mp_req_stop_tx(dev); +@@ -4743,5 +4764,10 @@ hns3_start_tx_datapath(struct rte_eth_dev *dev) + + dev->tx_pkt_burst = hns3_get_tx_function(dev, &prep); + dev->tx_pkt_prepare = prep; ++ hns3_eth_dev_fp_ops_config(dev); ++ ++ if (rte_eal_process_type() == RTE_PROC_SECONDARY) ++ return; ++ + hns3_mp_req_start_tx(dev); + } +-- +2.33.0 + diff --git a/0020-net-hns3-fix-mailbox-wait-time-uninitialization.patch b/0020-net-hns3-fix-mailbox-wait-time-uninitialization.patch new file mode 100644 index 0000000000000000000000000000000000000000..7cc0ba9f2ae2dfc0d9f92eafd5e6d887e225d7de --- /dev/null +++ b/0020-net-hns3-fix-mailbox-wait-time-uninitialization.patch @@ -0,0 +1,47 @@ +From b274c48fc01ed8fe854c285b02f1ac108bbf2721 Mon Sep 17 00:00:00 2001 +From: Huisong Li +Date: Mon, 17 Jan 2022 10:43:01 +0800 +Subject: [PATCH] net/hns3: fix mailbox wait time uninitialization + +The mailbox wait time can be specified at runtime. But the variable that +controls this time are not initialized when the variable isn't designated +or is specified as an invalid value, which will fail to initialize device +in the case where no device is bound to initialize the device. + +Fixes: 2fc3e696a7f1 ("net/hns3: add runtime config for mailbox limit time") +Cc: stable@dpdk.org + +Signed-off-by: Huisong Li +--- + drivers/net/hns3/hns3_common.c | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/drivers/net/hns3/hns3_common.c b/drivers/net/hns3/hns3_common.c +index 0bb552ea3e..78158401f2 100644 +--- a/drivers/net/hns3/hns3_common.c ++++ b/drivers/net/hns3/hns3_common.c +@@ -216,7 +216,7 @@ hns3_parse_mbx_time_limit(const char *key, const char *value, void *extra_args) + + /* + * 500ms is empirical value in process of mailbox communication. If +- * the delay value is set to one lower thanthe empirical value, mailbox ++ * the delay value is set to one lower than the empirical value, mailbox + * communication may fail. + */ + if (val > HNS3_MBX_DEF_TIME_LIMIT_MS && val <= UINT16_MAX) +@@ -236,6 +236,12 @@ hns3_parse_devargs(struct rte_eth_dev *dev) + uint64_t dev_caps_mask = 0; + struct rte_kvargs *kvlist; + ++ /* Set default value of runtime config parameters. */ ++ hns->rx_func_hint = HNS3_IO_FUNC_HINT_NONE; ++ hns->tx_func_hint = HNS3_IO_FUNC_HINT_NONE; ++ hns->dev_caps_mask = 0; ++ hns->mbx_time_limit_ms = HNS3_MBX_DEF_TIME_LIMIT_MS; ++ + if (dev->device->devargs == NULL) + return; + +-- +2.33.0 + diff --git a/0020-net-hns3-move-queue-stats-to-xstats.patch b/0020-net-hns3-move-queue-stats-to-xstats.patch deleted file mode 100644 index 0f244547d599cf2c6cb6dacf7c658af5ab574890..0000000000000000000000000000000000000000 --- a/0020-net-hns3-move-queue-stats-to-xstats.patch +++ /dev/null @@ -1,505 +0,0 @@ -From e658ac6ea47f304cb8b0c9e8e100dd1016bcac0b Mon Sep 17 00:00:00 2001 -From: Huisong Li -Date: Fri, 22 Jan 2021 18:18:40 +0800 -Subject: [PATCH 020/189] net/hns3: move queue stats to xstats - -One of the hot discussions in community recently was moving queue stats -to xstats. In this solution, a temporary -'RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS' device flag is created to implement -the smooth switch. And the first half of this work has been completed in -the ethdev framework. Now driver needs to remove the flag from the -driver initialization process and does the rest of work. - -For better readability and reasonability, per-queue stats also should be -cleared when rte_eth_stats is cleared. Otherwise, the sum of one item in -per-queue stats may be greater than corresponding item in rte_eth_stats. - -Signed-off-by: Huisong Li -Signed-off-by: Lijun Ou ---- - drivers/net/hns3/hns3_ethdev.c | 2 - - drivers/net/hns3/hns3_ethdev_vf.c | 2 - - drivers/net/hns3/hns3_rxtx.c | 2 + - drivers/net/hns3/hns3_rxtx.h | 13 ++ - drivers/net/hns3/hns3_stats.c | 241 +++++++++++++++++++++++++++++++------- - drivers/net/hns3/hns3_stats.h | 6 + - 6 files changed, 221 insertions(+), 45 deletions(-) - -diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c -index 449d967..7c51e83 100644 ---- a/drivers/net/hns3/hns3_ethdev.c -+++ b/drivers/net/hns3/hns3_ethdev.c -@@ -6148,8 +6148,6 @@ hns3_dev_init(struct rte_eth_dev *eth_dev) - return 0; - } - -- eth_dev->data->dev_flags |= RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS; -- - ret = hns3_mp_init_primary(); - if (ret) { - PMD_INIT_LOG(ERR, -diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c -index bb4ec6b..37135d7 100644 ---- a/drivers/net/hns3/hns3_ethdev_vf.c -+++ b/drivers/net/hns3/hns3_ethdev_vf.c -@@ -2746,8 +2746,6 @@ hns3vf_dev_init(struct rte_eth_dev *eth_dev) - return 0; - } - -- eth_dev->data->dev_flags |= RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS; -- - ret = hns3_mp_init_primary(); - if (ret) { - PMD_INIT_LOG(ERR, -diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c -index 3d5f74f..30f1e06 100644 ---- a/drivers/net/hns3/hns3_rxtx.c -+++ b/drivers/net/hns3/hns3_rxtx.c -@@ -1792,6 +1792,7 @@ hns3_rx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t nb_desc, - rxq->io_head_reg = (volatile void *)((char *)rxq->io_base + - HNS3_RING_RX_HEAD_REG); - rxq->rx_buf_len = rx_buf_size; -+ memset(&rxq->basic_stats, 0, sizeof(struct hns3_rx_basic_stats)); - memset(&rxq->err_stats, 0, sizeof(struct hns3_rx_bd_errors_stats)); - memset(&rxq->dfx_stats, 0, sizeof(struct hns3_rx_dfx_stats)); - -@@ -2618,6 +2619,7 @@ hns3_tx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t nb_desc, - HNS3_RING_TX_TAIL_REG); - txq->min_tx_pkt_len = hw->min_tx_pkt_len; - txq->tso_mode = hw->tso_mode; -+ memset(&txq->basic_stats, 0, sizeof(struct hns3_tx_basic_stats)); - memset(&txq->dfx_stats, 0, sizeof(struct hns3_tx_dfx_stats)); - - rte_spinlock_lock(&hw->lock); -diff --git a/drivers/net/hns3/hns3_rxtx.h b/drivers/net/hns3/hns3_rxtx.h -index 8a0c981..331b507 100644 ---- a/drivers/net/hns3/hns3_rxtx.h -+++ b/drivers/net/hns3/hns3_rxtx.h -@@ -266,6 +266,12 @@ struct hns3_entry { - struct rte_mbuf *mbuf; - }; - -+struct hns3_rx_basic_stats { -+ uint64_t packets; -+ uint64_t bytes; -+ uint64_t errors; -+}; -+ - struct hns3_rx_dfx_stats { - uint64_t l3_csum_errors; - uint64_t l4_csum_errors; -@@ -324,6 +330,7 @@ struct hns3_rx_queue { - bool pvid_sw_discard_en; - bool enabled; /* indicate if Rx queue has been enabled */ - -+ struct hns3_rx_basic_stats basic_stats; - /* DFX statistics that driver does not need to discard packets */ - struct hns3_rx_dfx_stats dfx_stats; - /* Error statistics that driver needs to discard packets */ -@@ -338,6 +345,11 @@ struct hns3_rx_queue { - struct rte_mbuf fake_mbuf; /* fake mbuf used with vector rx */ - }; - -+struct hns3_tx_basic_stats { -+ uint64_t packets; -+ uint64_t bytes; -+}; -+ - /* - * The following items are used for the abnormal errors statistics in - * the Tx datapath. When upper level application calls the -@@ -472,6 +484,7 @@ struct hns3_tx_queue { - bool pvid_sw_shift_en; - bool enabled; /* indicate if Tx queue has been enabled */ - -+ struct hns3_tx_basic_stats basic_stats; - struct hns3_tx_dfx_stats dfx_stats; - }; - -diff --git a/drivers/net/hns3/hns3_stats.c b/drivers/net/hns3/hns3_stats.c -index 419d7e2..3ba09e2 100644 ---- a/drivers/net/hns3/hns3_stats.c -+++ b/drivers/net/hns3/hns3_stats.c -@@ -11,6 +11,24 @@ - #include "hns3_logs.h" - #include "hns3_regs.h" - -+/* The statistics of the per-rxq basic stats */ -+static const struct hns3_xstats_name_offset hns3_rxq_basic_stats_strings[] = { -+ {"packets", -+ HNS3_RXQ_BASIC_STATS_FIELD_OFFSET(packets)}, -+ {"bytes", -+ HNS3_RXQ_BASIC_STATS_FIELD_OFFSET(bytes)}, -+ {"errors", -+ HNS3_RXQ_BASIC_STATS_FIELD_OFFSET(errors)} -+}; -+ -+/* The statistics of the per-txq basic stats */ -+static const struct hns3_xstats_name_offset hns3_txq_basic_stats_strings[] = { -+ {"packets", -+ HNS3_TXQ_BASIC_STATS_FIELD_OFFSET(packets)}, -+ {"bytes", -+ HNS3_TXQ_BASIC_STATS_FIELD_OFFSET(bytes)} -+}; -+ - /* MAC statistics */ - static const struct hns3_xstats_name_offset hns3_mac_strings[] = { - {"mac_tx_mac_pause_num", -@@ -330,6 +348,12 @@ static const struct hns3_xstats_name_offset hns3_tx_queue_strings[] = { - #define HNS3_NUM_TX_QUEUE_STATS (sizeof(hns3_tx_queue_strings) / \ - sizeof(hns3_tx_queue_strings[0])) - -+#define HNS3_NUM_RXQ_BASIC_STATS (sizeof(hns3_rxq_basic_stats_strings) / \ -+ sizeof(hns3_rxq_basic_stats_strings[0])) -+ -+#define HNS3_NUM_TXQ_BASIC_STATS (sizeof(hns3_txq_basic_stats_strings) / \ -+ sizeof(hns3_txq_basic_stats_strings[0])) -+ - #define HNS3_FIX_NUM_STATS (HNS3_NUM_MAC_STATS + HNS3_NUM_ERROR_INT_XSTATS + \ - HNS3_NUM_RESET_XSTATS) - -@@ -508,9 +532,7 @@ hns3_stats_get(struct rte_eth_dev *eth_dev, struct rte_eth_stats *rte_stats) - struct hns3_hw *hw = &hns->hw; - struct hns3_tqp_stats *stats = &hw->tqp_stats; - struct hns3_rx_queue *rxq; -- struct hns3_tx_queue *txq; - uint64_t cnt; -- uint64_t num; - uint16_t i; - int ret; - -@@ -522,25 +544,14 @@ hns3_stats_get(struct rte_eth_dev *eth_dev, struct rte_eth_stats *rte_stats) - } - - /* Get the error stats of received packets */ -- num = RTE_MIN(RTE_ETHDEV_QUEUE_STAT_CNTRS, eth_dev->data->nb_rx_queues); -- for (i = 0; i != num; ++i) { -+ for (i = 0; i < eth_dev->data->nb_rx_queues; i++) { - rxq = eth_dev->data->rx_queues[i]; - if (rxq) { - cnt = rxq->err_stats.l2_errors + - rxq->err_stats.pkt_len_errors; -- rte_stats->q_errors[i] = cnt; -- rte_stats->q_ipackets[i] = -- stats->rcb_rx_ring_pktnum[i] - cnt; - rte_stats->ierrors += cnt; - } - } -- /* Get the error stats of transmitted packets */ -- num = RTE_MIN(RTE_ETHDEV_QUEUE_STAT_CNTRS, eth_dev->data->nb_tx_queues); -- for (i = 0; i < num; i++) { -- txq = eth_dev->data->tx_queues[i]; -- if (txq) -- rte_stats->q_opackets[i] = stats->rcb_tx_ring_pktnum[i]; -- } - - rte_stats->oerrors = 0; - rte_stats->ipackets = stats->rcb_rx_ring_pktnum_rcd - -@@ -600,6 +611,11 @@ hns3_stats_reset(struct rte_eth_dev *eth_dev) - } - } - -+ /* -+ * 'packets' in hns3_tx_basic_stats and hns3_rx_basic_stats come -+ * from hw->tqp_stats. And clearing tqp stats is like clearing -+ * their source. -+ */ - hns3_tqp_stats_clear(hw); - - return 0; -@@ -628,21 +644,26 @@ hns3_mac_stats_reset(__rte_unused struct rte_eth_dev *dev) - static int - hns3_xstats_calc_num(struct rte_eth_dev *dev) - { -+#define HNS3_PF_VF_RX_COMM_STATS_NUM (HNS3_NUM_RX_BD_ERROR_XSTATS + \ -+ HNS3_NUM_RXQ_DFX_XSTATS + \ -+ HNS3_NUM_RX_QUEUE_STATS + \ -+ HNS3_NUM_RXQ_BASIC_STATS) -+#define HNS3_PF_VF_TX_COMM_STATS_NUM (HNS3_NUM_TXQ_DFX_XSTATS + \ -+ HNS3_NUM_TX_QUEUE_STATS + \ -+ HNS3_NUM_TXQ_BASIC_STATS) -+ - struct hns3_adapter *hns = dev->data->dev_private; - uint16_t nb_rx_q = dev->data->nb_rx_queues; - uint16_t nb_tx_q = dev->data->nb_tx_queues; -- int bderr_stats = nb_rx_q * HNS3_NUM_RX_BD_ERROR_XSTATS; -- int rx_dfx_stats = nb_rx_q * HNS3_NUM_RXQ_DFX_XSTATS; -- int tx_dfx_stats = nb_tx_q * HNS3_NUM_TXQ_DFX_XSTATS; -- int rx_queue_stats = nb_rx_q * HNS3_NUM_RX_QUEUE_STATS; -- int tx_queue_stats = nb_tx_q * HNS3_NUM_TX_QUEUE_STATS; -+ int rx_comm_stats_num = nb_rx_q * HNS3_PF_VF_RX_COMM_STATS_NUM; -+ int tx_comm_stats_num = nb_tx_q * HNS3_PF_VF_TX_COMM_STATS_NUM; - - if (hns->is_vf) -- return bderr_stats + rx_dfx_stats + tx_dfx_stats + -- rx_queue_stats + tx_queue_stats + HNS3_NUM_RESET_XSTATS; -+ return rx_comm_stats_num + tx_comm_stats_num + -+ HNS3_NUM_RESET_XSTATS; - else -- return bderr_stats + rx_dfx_stats + tx_dfx_stats + -- rx_queue_stats + tx_queue_stats + HNS3_FIX_NUM_STATS; -+ return rx_comm_stats_num + tx_comm_stats_num + -+ HNS3_FIX_NUM_STATS; - } - - static void -@@ -751,6 +772,118 @@ hns3_tqp_dfx_stats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *xstats, - hns3_rxq_dfx_stats_get(dev, xstats, count); - hns3_txq_dfx_stats_get(dev, xstats, count); - } -+ -+static void -+hns3_rxq_basic_stats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *xstats, -+ int *count) -+{ -+ struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private); -+ struct hns3_tqp_stats *stats = &hw->tqp_stats; -+ struct hns3_rx_basic_stats *rxq_stats; -+ struct hns3_rx_queue *rxq; -+ uint16_t i, j; -+ char *val; -+ -+ for (i = 0; i < dev->data->nb_rx_queues; i++) { -+ rxq = dev->data->rx_queues[i]; -+ if (rxq == NULL) -+ continue; -+ -+ rxq_stats = &rxq->basic_stats; -+ rxq_stats->errors = rxq->err_stats.l2_errors + -+ rxq->err_stats.pkt_len_errors; -+ rxq_stats->packets = stats->rcb_rx_ring_pktnum[i] - -+ rxq_stats->errors; -+ rxq_stats->bytes = 0; -+ for (j = 0; j < HNS3_NUM_RXQ_BASIC_STATS; j++) { -+ val = (char *)rxq_stats + -+ hns3_rxq_basic_stats_strings[j].offset; -+ xstats[*count].value = *(uint64_t *)val; -+ xstats[*count].id = *count; -+ (*count)++; -+ } -+ } -+} -+ -+static void -+hns3_txq_basic_stats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *xstats, -+ int *count) -+{ -+ struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private); -+ struct hns3_tqp_stats *stats = &hw->tqp_stats; -+ struct hns3_tx_basic_stats *txq_stats; -+ struct hns3_tx_queue *txq; -+ uint16_t i, j; -+ char *val; -+ -+ for (i = 0; i < dev->data->nb_tx_queues; i++) { -+ txq = dev->data->tx_queues[i]; -+ if (txq == NULL) -+ continue; -+ -+ txq_stats = &txq->basic_stats; -+ txq_stats->packets = stats->rcb_tx_ring_pktnum[i]; -+ txq_stats->bytes = 0; -+ for (j = 0; j < HNS3_NUM_TXQ_BASIC_STATS; j++) { -+ val = (char *)txq_stats + -+ hns3_txq_basic_stats_strings[j].offset; -+ xstats[*count].value = *(uint64_t *)val; -+ xstats[*count].id = *count; -+ (*count)++; -+ } -+ } -+} -+ -+static int -+hns3_tqp_basic_stats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *xstats, -+ int *count) -+{ -+ struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private); -+ int ret; -+ -+ /* Update tqp stats by read register */ -+ ret = hns3_update_tqp_stats(hw); -+ if (ret) { -+ hns3_err(hw, "Update tqp stats fail, ret = %d.", ret); -+ return ret; -+ } -+ -+ hns3_rxq_basic_stats_get(dev, xstats, count); -+ hns3_txq_basic_stats_get(dev, xstats, count); -+ -+ return 0; -+} -+ -+/* -+ * The function is only called by hns3_dev_xstats_reset to clear -+ * basic stats of per-queue. TQP stats are all cleared in hns3_stats_reset -+ * which is called before this function. -+ * -+ * @param dev -+ * Pointer to Ethernet device. -+ */ -+static void -+hns3_tqp_basic_stats_clear(struct rte_eth_dev *dev) -+{ -+ struct hns3_tx_queue *txq; -+ struct hns3_rx_queue *rxq; -+ uint16_t i; -+ -+ for (i = 0; i < dev->data->nb_rx_queues; i++) { -+ rxq = dev->data->rx_queues[i]; -+ if (rxq) -+ memset(&rxq->basic_stats, 0, -+ sizeof(struct hns3_rx_basic_stats)); -+ } -+ -+ for (i = 0; i < dev->data->nb_tx_queues; i++) { -+ txq = dev->data->tx_queues[i]; -+ if (txq) -+ memset(&txq->basic_stats, 0, -+ sizeof(struct hns3_tx_basic_stats)); -+ } -+} -+ - /* - * Retrieve extended(tqp | Mac) statistics of an Ethernet device. - * @param dev -@@ -789,6 +922,10 @@ hns3_dev_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *xstats, - - count = 0; - -+ ret = hns3_tqp_basic_stats_get(dev, xstats, &count); -+ if (ret < 0) -+ return ret; -+ - if (!hns->is_vf) { - /* Update Mac stats */ - ret = hns3_query_update_mac_stats(dev); -@@ -844,28 +981,55 @@ hns3_dev_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *xstats, - } - - static void -+hns3_tqp_basic_stats_name_get(struct rte_eth_dev *dev, -+ struct rte_eth_xstat_name *xstats_names, -+ uint32_t *count) -+{ -+ uint16_t i, j; -+ -+ for (i = 0; i < dev->data->nb_rx_queues; i++) { -+ for (j = 0; j < HNS3_NUM_RXQ_BASIC_STATS; j++) { -+ snprintf(xstats_names[*count].name, -+ sizeof(xstats_names[*count].name), -+ "rx_q%u_%s", i, -+ hns3_rxq_basic_stats_strings[j].name); -+ (*count)++; -+ } -+ } -+ for (i = 0; i < dev->data->nb_tx_queues; i++) { -+ for (j = 0; j < HNS3_NUM_TXQ_BASIC_STATS; j++) { -+ snprintf(xstats_names[*count].name, -+ sizeof(xstats_names[*count].name), -+ "tx_q%u_%s", i, -+ hns3_txq_basic_stats_strings[j].name); -+ (*count)++; -+ } -+ } -+} -+ -+static void - hns3_tqp_dfx_stats_name_get(struct rte_eth_dev *dev, - struct rte_eth_xstat_name *xstats_names, - uint32_t *count) - { - uint16_t i, j; - -- for (j = 0; j < dev->data->nb_rx_queues; j++) { -- for (i = 0; i < HNS3_NUM_RXQ_DFX_XSTATS; i++) { -+ for (i = 0; i < dev->data->nb_rx_queues; i++) { -+ for (j = 0; j < HNS3_NUM_RXQ_DFX_XSTATS; j++) { - snprintf(xstats_names[*count].name, - sizeof(xstats_names[*count].name), -- "rx_q%u_%s", j, -- hns3_rxq_dfx_stats_strings[i].name); -+ "rx_q%u_%s", i, -+ hns3_rxq_dfx_stats_strings[j].name); - (*count)++; - } - } - -- for (j = 0; j < dev->data->nb_tx_queues; j++) { -- for (i = 0; i < HNS3_NUM_TXQ_DFX_XSTATS; i++) { -+ for (i = 0; i < dev->data->nb_tx_queues; i++) { -+ for (j = 0; j < HNS3_NUM_TXQ_DFX_XSTATS; j++) { - snprintf(xstats_names[*count].name, - sizeof(xstats_names[*count].name), -- "tx_q%u_%s", j, -- hns3_txq_dfx_stats_strings[i].name); -+ "tx_q%u_%s", i, -+ hns3_txq_dfx_stats_strings[j].name); - (*count)++; - } - } -@@ -908,6 +1072,8 @@ hns3_dev_xstats_get_names(struct rte_eth_dev *dev, - if (xstats_names == NULL) - return cnt_stats; - -+ hns3_tqp_basic_stats_name_get(dev, xstats_names, &count); -+ - /* Note: size limited checked in rte_eth_xstats_get_names() */ - if (!hns->is_vf) { - /* Get MAC name from hw->hw_xstats.mac_stats struct */ -@@ -999,7 +1165,6 @@ hns3_dev_xstats_get_by_id(struct rte_eth_dev *dev, const uint64_t *ids, - uint32_t count_value; - uint64_t len; - uint32_t i; -- int ret; - - if (ids == NULL && values == NULL) - return cnt_stats; -@@ -1008,13 +1173,6 @@ hns3_dev_xstats_get_by_id(struct rte_eth_dev *dev, const uint64_t *ids, - if (size < cnt_stats) - return cnt_stats; - -- /* Update tqp stats by read register */ -- ret = hns3_update_tqp_stats(hw); -- if (ret) { -- hns3_err(hw, "Update tqp stats fail : %d", ret); -- return ret; -- } -- - len = cnt_stats * sizeof(struct rte_eth_xstat); - values_copy = rte_zmalloc("hns3_xstats_values", len, 0); - if (values_copy == NULL) { -@@ -1157,11 +1315,12 @@ hns3_dev_xstats_reset(struct rte_eth_dev *dev) - if (ret) - return ret; - -+ hns3_tqp_basic_stats_clear(dev); -+ hns3_tqp_dfx_stats_clear(dev); -+ - /* Clear reset stats */ - memset(&hns->hw.reset.stats, 0, sizeof(struct hns3_reset_stats)); - -- hns3_tqp_dfx_stats_clear(dev); -- - if (hns->is_vf) - return 0; - -diff --git a/drivers/net/hns3/hns3_stats.h b/drivers/net/hns3/hns3_stats.h -index 12842cd..d213be5 100644 ---- a/drivers/net/hns3/hns3_stats.h -+++ b/drivers/net/hns3/hns3_stats.h -@@ -135,6 +135,12 @@ struct hns3_reset_stats; - #define HNS3_TXQ_DFX_STATS_FIELD_OFFSET(f) \ - (offsetof(struct hns3_tx_dfx_stats, f)) - -+#define HNS3_RXQ_BASIC_STATS_FIELD_OFFSET(f) \ -+ (offsetof(struct hns3_rx_basic_stats, f)) -+ -+#define HNS3_TXQ_BASIC_STATS_FIELD_OFFSET(f) \ -+ (offsetof(struct hns3_tx_basic_stats, f)) -+ - int hns3_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *rte_stats); - int hns3_dev_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *xstats, - unsigned int n); --- -2.7.4 - diff --git a/0021-net-hns3-fix-vector-burst-when-PTP-enable.patch b/0021-net-hns3-fix-vector-burst-when-PTP-enable.patch new file mode 100644 index 0000000000000000000000000000000000000000..032609b6c0c9ba11bb854b7ee7a8a41c704e83b0 --- /dev/null +++ b/0021-net-hns3-fix-vector-burst-when-PTP-enable.patch @@ -0,0 +1,237 @@ +From 17efba586961886bd96033965f3ce4d5dcb3367a Mon Sep 17 00:00:00 2001 +From: "Min Hu (Connor)" +Date: Mon, 17 Jan 2022 10:43:02 +0800 +Subject: [PATCH] net/hns3: fix vector burst when PTP enable + +If hardware supports IEEE 1588 PTP, PTP capability will be set. +Currently, vec and sve burst is unsupported when PTP capability is set. + +For sake of Rx/Tx performance, IEEE 1588 PTP is not supported in sve or +vec burst mode. When enabling IEEE 1588 PTP, Rx/Tx burst mode should be +simple or common. Rx/Tx burst mode could be set like this, for example: +-a 0000:35:00.0,rx_func_hint=common,tx_func_hint=common + +This patch supports vec and sve burst when PTP is disabled. And only +support simple or common burst When PTP is enabled. + +Fixes: 38b539d96eb6 ("net/hns3: support IEEE 1588 PTP") +Cc: stable@dpdk.org + +Signed-off-by: Min Hu (Connor) +--- + doc/guides/nics/hns3.rst | 5 +++++ + drivers/net/hns3/hns3_ethdev.c | 8 +------- + drivers/net/hns3/hns3_ptp.c | 1 + + drivers/net/hns3/hns3_rxtx.c | 29 +++++++++++++++++------------ + drivers/net/hns3/hns3_rxtx_vec.c | 20 ++++++++++++-------- + 5 files changed, 36 insertions(+), 27 deletions(-) + +diff --git a/doc/guides/nics/hns3.rst b/doc/guides/nics/hns3.rst +index 5f68a10ecf..791c9cc2ed 100644 +--- a/doc/guides/nics/hns3.rst ++++ b/doc/guides/nics/hns3.rst +@@ -290,5 +290,10 @@ Currently, we only support VF device driven by DPDK driver when PF is driven + by kernel mode hns3 ethdev driver. VF is not supported when PF is driven by + DPDK driver. + ++For sake of Rx/Tx performance, IEEE 1588 is not supported when using vec or ++sve burst function. When enabling IEEE 1588, Rx/Tx burst mode should be ++simple or common. It is recommended that enable IEEE 1588 before ethdev ++start. In this way, the correct Rx/Tx burst function can be selected. ++ + Build with ICC is not supported yet. + X86-32, Power8, ARMv7 and BSD are not supported yet. +diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c +index 3b897492d3..ef13d31d19 100644 +--- a/drivers/net/hns3/hns3_ethdev.c ++++ b/drivers/net/hns3/hns3_ethdev.c +@@ -227,17 +227,11 @@ hns3_check_event_cause(struct hns3_adapter *hns, uint32_t *clearval) + return ret; + } + +-static bool +-hns3_is_1588_event_type(uint32_t event_type) +-{ +- return (event_type == HNS3_VECTOR0_EVENT_PTP); +-} +- + static void + hns3_clear_event_cause(struct hns3_hw *hw, uint32_t event_type, uint32_t regclr) + { + if (event_type == HNS3_VECTOR0_EVENT_RST || +- hns3_is_1588_event_type(event_type)) ++ event_type == HNS3_VECTOR0_EVENT_PTP) + hns3_write_dev(hw, HNS3_MISC_RESET_STS_REG, regclr); + else if (event_type == HNS3_VECTOR0_EVENT_MBX) + hns3_write_dev(hw, HNS3_VECTOR0_CMDQ_SRC_REG, regclr); +diff --git a/drivers/net/hns3/hns3_ptp.c b/drivers/net/hns3/hns3_ptp.c +index 9a829d7011..1442241a4e 100644 +--- a/drivers/net/hns3/hns3_ptp.c ++++ b/drivers/net/hns3/hns3_ptp.c +@@ -125,6 +125,7 @@ hns3_timesync_enable(struct rte_eth_dev *dev) + + if (pf->ptp_enable) + return 0; ++ hns3_warn(hw, "note: please ensure Rx/Tx burst mode is simple or common when enabling PTP!"); + + rte_spinlock_lock(&hw->lock); + ret = hns3_timesync_configure(hns, true); +diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c +index c86aeb2366..c43131cac6 100644 +--- a/drivers/net/hns3/hns3_rxtx.c ++++ b/drivers/net/hns3/hns3_rxtx.c +@@ -2388,14 +2388,14 @@ hns3_rx_alloc_buffer(struct hns3_rx_queue *rxq) + return rte_mbuf_raw_alloc(rxq->mb_pool); + } + +-static inline void ++static void + hns3_rx_ptp_timestamp_handle(struct hns3_rx_queue *rxq, struct rte_mbuf *mbuf, +- volatile struct hns3_desc *rxd) ++ uint64_t timestamp) + { + struct hns3_pf *pf = HNS3_DEV_PRIVATE_TO_PF(rxq->hns); +- uint64_t timestamp = rte_le_to_cpu_64(rxd->timestamp); + +- mbuf->ol_flags |= RTE_MBUF_F_RX_IEEE1588_PTP | RTE_MBUF_F_RX_IEEE1588_TMST; ++ mbuf->ol_flags |= RTE_MBUF_F_RX_IEEE1588_PTP | ++ RTE_MBUF_F_RX_IEEE1588_TMST; + if (hns3_timestamp_rx_dynflag > 0) { + *RTE_MBUF_DYNFIELD(mbuf, hns3_timestamp_dynfield_offset, + rte_mbuf_timestamp_t *) = timestamp; +@@ -2469,7 +2469,8 @@ hns3_recv_pkts_simple(void *rx_queue, + rxe->mbuf = nmb; + + if (unlikely(bd_base_info & BIT(HNS3_RXD_TS_VLD_B))) +- hns3_rx_ptp_timestamp_handle(rxq, rxm, rxdp); ++ hns3_rx_ptp_timestamp_handle(rxq, rxm, ++ rte_le_to_cpu_64(rxdp->timestamp)); + + dma_addr = rte_mbuf_data_iova_default(nmb); + rxdp->addr = rte_cpu_to_le_64(dma_addr); +@@ -2540,6 +2541,7 @@ hns3_recv_scattered_pkts(void *rx_queue, + struct rte_mbuf *rxm; + struct rte_eth_dev *dev; + uint32_t bd_base_info; ++ uint64_t timestamp; + uint32_t l234_info; + uint32_t gro_size; + uint32_t ol_info; +@@ -2649,6 +2651,9 @@ hns3_recv_scattered_pkts(void *rx_queue, + rxm = rxe->mbuf; + rxe->mbuf = nmb; + ++ if (unlikely(bd_base_info & BIT(HNS3_RXD_TS_VLD_B))) ++ timestamp = rte_le_to_cpu_64(rxdp->timestamp); ++ + dma_addr = rte_cpu_to_le_64(rte_mbuf_data_iova_default(nmb)); + rxdp->rx.bd_base_info = 0; + rxdp->addr = dma_addr; +@@ -2671,7 +2676,7 @@ hns3_recv_scattered_pkts(void *rx_queue, + } + + if (unlikely(bd_base_info & BIT(HNS3_RXD_TS_VLD_B))) +- hns3_rx_ptp_timestamp_handle(rxq, first_seg, rxdp); ++ hns3_rx_ptp_timestamp_handle(rxq, first_seg, timestamp); + + /* + * The last buffer of the received packet. packet len from +@@ -4044,7 +4049,7 @@ static inline void + hns3_tx_setup_4bd(struct hns3_desc *txdp, struct rte_mbuf **pkts) + { + #define PER_LOOP_NUM 4 +- const uint16_t bd_flag = BIT(HNS3_TXD_VLD_B) | BIT(HNS3_TXD_FE_B); ++ uint16_t bd_flag = BIT(HNS3_TXD_VLD_B) | BIT(HNS3_TXD_FE_B); + uint64_t dma_addr; + uint32_t i; + +@@ -4055,6 +4060,8 @@ hns3_tx_setup_4bd(struct hns3_desc *txdp, struct rte_mbuf **pkts) + txdp->tx.paylen_fd_dop_ol4cs = 0; + txdp->tx.type_cs_vlan_tso_len = 0; + txdp->tx.ol_type_vlan_len_msec = 0; ++ if (unlikely((*pkts)->ol_flags & RTE_MBUF_F_TX_IEEE1588_TMST)) ++ bd_flag |= BIT(HNS3_TXD_TSYN_B); + txdp->tx.tp_fe_sc_vld_ra_ri = rte_cpu_to_le_16(bd_flag); + } + } +@@ -4062,7 +4069,7 @@ hns3_tx_setup_4bd(struct hns3_desc *txdp, struct rte_mbuf **pkts) + static inline void + hns3_tx_setup_1bd(struct hns3_desc *txdp, struct rte_mbuf **pkts) + { +- const uint16_t bd_flag = BIT(HNS3_TXD_VLD_B) | BIT(HNS3_TXD_FE_B); ++ uint16_t bd_flag = BIT(HNS3_TXD_VLD_B) | BIT(HNS3_TXD_FE_B); + uint64_t dma_addr; + + dma_addr = rte_mbuf_data_iova(*pkts); +@@ -4071,6 +4078,8 @@ hns3_tx_setup_1bd(struct hns3_desc *txdp, struct rte_mbuf **pkts) + txdp->tx.paylen_fd_dop_ol4cs = 0; + txdp->tx.type_cs_vlan_tso_len = 0; + txdp->tx.ol_type_vlan_len_msec = 0; ++ if (unlikely((*pkts)->ol_flags & RTE_MBUF_F_TX_IEEE1588_TMST)) ++ bd_flag |= BIT(HNS3_TXD_TSYN_B); + txdp->tx.tp_fe_sc_vld_ra_ri = rte_cpu_to_le_16(bd_flag); + } + +@@ -4312,10 +4321,6 @@ hns3_tx_check_simple_support(struct rte_eth_dev *dev) + { + uint64_t offloads = dev->data->dev_conf.txmode.offloads; + +- struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private); +- if (hns3_dev_get_support(hw, PTP)) +- return false; +- + return (offloads == (offloads & RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE)); + } + +diff --git a/drivers/net/hns3/hns3_rxtx_vec.c b/drivers/net/hns3/hns3_rxtx_vec.c +index 455110361a..73f0ab6bc8 100644 +--- a/drivers/net/hns3/hns3_rxtx_vec.c ++++ b/drivers/net/hns3/hns3_rxtx_vec.c +@@ -17,15 +17,17 @@ int + hns3_tx_check_vec_support(struct rte_eth_dev *dev) + { + struct rte_eth_txmode *txmode = &dev->data->dev_conf.txmode; +- +- struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private); +- if (hns3_dev_get_support(hw, PTP)) +- return -ENOTSUP; ++ struct hns3_adapter *hns = dev->data->dev_private; ++ struct hns3_pf *pf = &hns->pf; + + /* Only support RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE */ + if (txmode->offloads != RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE) + return -ENOTSUP; + ++ /* Vec is not supported when PTP enabled */ ++ if (pf->ptp_enable) ++ return -ENOTSUP; ++ + return 0; + } + +@@ -232,10 +234,8 @@ hns3_rx_check_vec_support(struct rte_eth_dev *dev) + struct rte_eth_rxmode *rxmode = &dev->data->dev_conf.rxmode; + uint64_t offloads_mask = RTE_ETH_RX_OFFLOAD_TCP_LRO | + RTE_ETH_RX_OFFLOAD_VLAN; +- +- struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private); +- if (hns3_dev_get_support(hw, PTP)) +- return -ENOTSUP; ++ struct hns3_adapter *hns = dev->data->dev_private; ++ struct hns3_pf *pf = &hns->pf; + + if (dev->data->scattered_rx) + return -ENOTSUP; +@@ -249,5 +249,9 @@ hns3_rx_check_vec_support(struct rte_eth_dev *dev) + if (hns3_rxq_iterate(dev, hns3_rxq_vec_check, NULL) != 0) + return -ENOTSUP; + ++ /* Vec is not supported when PTP enabled */ ++ if (pf->ptp_enable) ++ return -ENOTSUP; ++ + return 0; + } +-- +2.33.0 + diff --git a/0021-net-hns3-refactor-converting-descriptor-error.patch b/0021-net-hns3-refactor-converting-descriptor-error.patch deleted file mode 100644 index f5693b437015b8365e049b88716741ecf8f470e3..0000000000000000000000000000000000000000 --- a/0021-net-hns3-refactor-converting-descriptor-error.patch +++ /dev/null @@ -1,97 +0,0 @@ -From 17327e444434b1062063a03060d6cc5a1876aa3f Mon Sep 17 00:00:00 2001 -From: Lijun Ou -Date: Fri, 22 Jan 2021 18:18:41 +0800 -Subject: [PATCH 021/189] net/hns3: refactor converting descriptor error - -Use errno array instead of switch-case for refactor -the hns3_cmd_convert_err_code function. - -Besides, we add a type for ROH(RDMA Over HCCS) check -cmdq return error in Kunpeng930 NIC hardware. - -Signed-off-by: Lijun Ou ---- - drivers/net/hns3/hns3_cmd.c | 54 ++++++++++++++++++++++----------------------- - drivers/net/hns3/hns3_cmd.h | 1 + - 2 files changed, 27 insertions(+), 28 deletions(-) - -diff --git a/drivers/net/hns3/hns3_cmd.c b/drivers/net/hns3/hns3_cmd.c -index f58f4f7..4c301cb 100644 ---- a/drivers/net/hns3/hns3_cmd.c -+++ b/drivers/net/hns3/hns3_cmd.c -@@ -247,34 +247,32 @@ hns3_is_special_opcode(uint16_t opcode) - static int - hns3_cmd_convert_err_code(uint16_t desc_ret) - { -- switch (desc_ret) { -- case HNS3_CMD_EXEC_SUCCESS: -- return 0; -- case HNS3_CMD_NO_AUTH: -- return -EPERM; -- case HNS3_CMD_NOT_SUPPORTED: -- return -EOPNOTSUPP; -- case HNS3_CMD_QUEUE_FULL: -- return -EXFULL; -- case HNS3_CMD_NEXT_ERR: -- return -ENOSR; -- case HNS3_CMD_UNEXE_ERR: -- return -ENOTBLK; -- case HNS3_CMD_PARA_ERR: -- return -EINVAL; -- case HNS3_CMD_RESULT_ERR: -- return -ERANGE; -- case HNS3_CMD_TIMEOUT: -- return -ETIME; -- case HNS3_CMD_HILINK_ERR: -- return -ENOLINK; -- case HNS3_CMD_QUEUE_ILLEGAL: -- return -ENXIO; -- case HNS3_CMD_INVALID: -- return -EBADR; -- default: -- return -EREMOTEIO; -- } -+ static const struct { -+ uint16_t imp_errcode; -+ int linux_errcode; -+ } hns3_cmdq_status[] = { -+ {HNS3_CMD_EXEC_SUCCESS, 0}, -+ {HNS3_CMD_NO_AUTH, -EPERM}, -+ {HNS3_CMD_NOT_SUPPORTED, -EOPNOTSUPP}, -+ {HNS3_CMD_QUEUE_FULL, -EXFULL}, -+ {HNS3_CMD_NEXT_ERR, -ENOSR}, -+ {HNS3_CMD_UNEXE_ERR, -ENOTBLK}, -+ {HNS3_CMD_PARA_ERR, -EINVAL}, -+ {HNS3_CMD_RESULT_ERR, -ERANGE}, -+ {HNS3_CMD_TIMEOUT, -ETIME}, -+ {HNS3_CMD_HILINK_ERR, -ENOLINK}, -+ {HNS3_CMD_QUEUE_ILLEGAL, -ENXIO}, -+ {HNS3_CMD_INVALID, -EBADR}, -+ {HNS3_CMD_ROH_CHECK_FAIL, -EINVAL} -+ }; -+ -+ uint32_t i; -+ -+ for (i = 0; i < ARRAY_SIZE(hns3_cmdq_status); i++) -+ if (hns3_cmdq_status[i].imp_errcode == desc_ret) -+ return hns3_cmdq_status[i].linux_errcode; -+ -+ return -EREMOTEIO; - } - - static int -diff --git a/drivers/net/hns3/hns3_cmd.h b/drivers/net/hns3/hns3_cmd.h -index e40293b..6152f6e 100644 ---- a/drivers/net/hns3/hns3_cmd.h -+++ b/drivers/net/hns3/hns3_cmd.h -@@ -52,6 +52,7 @@ enum hns3_cmd_return_status { - HNS3_CMD_HILINK_ERR = 9, - HNS3_CMD_QUEUE_ILLEGAL = 10, - HNS3_CMD_INVALID = 11, -+ HNS3_CMD_ROH_CHECK_FAIL = 12 - }; - - enum hns3_cmd_status { --- -2.7.4 - diff --git a/0022-net-hns3-refactor-flow-checks-into-own-functions.patch b/0022-net-hns3-refactor-flow-checks-into-own-functions.patch deleted file mode 100644 index 7b041c6d6d04b885d3f2de0caaeee96681ec6427..0000000000000000000000000000000000000000 --- a/0022-net-hns3-refactor-flow-checks-into-own-functions.patch +++ /dev/null @@ -1,134 +0,0 @@ -From 2d64078bc27c055bfeb486230ea64eebe1cb65cb Mon Sep 17 00:00:00 2001 -From: Lijun Ou -Date: Fri, 22 Jan 2021 18:18:42 +0800 -Subject: [PATCH 022/189] net/hns3: refactor flow checks into own functions - -Here moves some judgement conditions to a separated function -for parsing IPv4 hdr and TCP hdr in hns3_parse_normal function. -Also, move the check of the selected input tuple of RSS to a -separated functions named hns3_rss_input_tuple_supported -in order to enhance scalability and complexity. - -Signed-off-by: Lijun Ou ---- - drivers/net/hns3/hns3_flow.c | 69 ++++++++++++++++++++++++++++++-------------- - 1 file changed, 48 insertions(+), 21 deletions(-) - -diff --git a/drivers/net/hns3/hns3_flow.c b/drivers/net/hns3/hns3_flow.c -index f303df4..889fa2f 100644 ---- a/drivers/net/hns3/hns3_flow.c -+++ b/drivers/net/hns3/hns3_flow.c -@@ -525,6 +525,17 @@ hns3_parse_vlan(const struct rte_flow_item *item, struct hns3_fdir_rule *rule, - return 0; - } - -+static bool -+hns3_check_ipv4_mask_supported(const struct rte_flow_item_ipv4 *ipv4_mask) -+{ -+ if (ipv4_mask->hdr.total_length || ipv4_mask->hdr.packet_id || -+ ipv4_mask->hdr.fragment_offset || ipv4_mask->hdr.time_to_live || -+ ipv4_mask->hdr.hdr_checksum) -+ return false; -+ -+ return true; -+} -+ - static int - hns3_parse_ipv4(const struct rte_flow_item *item, struct hns3_fdir_rule *rule, - struct rte_flow_error *error) -@@ -546,11 +557,7 @@ hns3_parse_ipv4(const struct rte_flow_item *item, struct hns3_fdir_rule *rule, - - if (item->mask) { - ipv4_mask = item->mask; -- if (ipv4_mask->hdr.total_length || -- ipv4_mask->hdr.packet_id || -- ipv4_mask->hdr.fragment_offset || -- ipv4_mask->hdr.time_to_live || -- ipv4_mask->hdr.hdr_checksum) { -+ if (!hns3_check_ipv4_mask_supported(ipv4_mask)) { - return rte_flow_error_set(error, EINVAL, - RTE_FLOW_ERROR_TYPE_ITEM_MASK, - item, -@@ -648,6 +655,18 @@ hns3_parse_ipv6(const struct rte_flow_item *item, struct hns3_fdir_rule *rule, - return 0; - } - -+static bool -+hns3_check_tcp_mask_supported(const struct rte_flow_item_tcp *tcp_mask) -+{ -+ if (tcp_mask->hdr.sent_seq || tcp_mask->hdr.recv_ack || -+ tcp_mask->hdr.data_off || tcp_mask->hdr.tcp_flags || -+ tcp_mask->hdr.rx_win || tcp_mask->hdr.cksum || -+ tcp_mask->hdr.tcp_urp) -+ return false; -+ -+ return true; -+} -+ - static int - hns3_parse_tcp(const struct rte_flow_item *item, struct hns3_fdir_rule *rule, - struct rte_flow_error *error) -@@ -670,10 +689,7 @@ hns3_parse_tcp(const struct rte_flow_item *item, struct hns3_fdir_rule *rule, - - if (item->mask) { - tcp_mask = item->mask; -- if (tcp_mask->hdr.sent_seq || tcp_mask->hdr.recv_ack || -- tcp_mask->hdr.data_off || tcp_mask->hdr.tcp_flags || -- tcp_mask->hdr.rx_win || tcp_mask->hdr.cksum || -- tcp_mask->hdr.tcp_urp) { -+ if (!hns3_check_tcp_mask_supported(tcp_mask)) { - return rte_flow_error_set(error, EINVAL, - RTE_FLOW_ERROR_TYPE_ITEM_MASK, - item, -@@ -1328,6 +1344,28 @@ hns3_rss_conf_copy(struct hns3_rss_conf *out, - return 0; - } - -+static bool -+hns3_rss_input_tuple_supported(struct hns3_hw *hw, -+ const struct rte_flow_action_rss *rss) -+{ -+ /* -+ * For IP packet, it is not supported to use src/dst port fields to RSS -+ * hash for the following packet types. -+ * - IPV4 FRAG | IPV4 NONFRAG | IPV6 FRAG | IPV6 NONFRAG -+ * Besides, for Kunpeng920, the NIC HW is not supported to use src/dst -+ * port fields to RSS hash for IPV6 SCTP packet type. However, the -+ * Kunpeng930 and future kunpeng series support to use src/dst port -+ * fields to RSS hash for IPv6 SCTP packet type. -+ */ -+ if (rss->types & (ETH_RSS_L4_DST_ONLY | ETH_RSS_L4_SRC_ONLY) && -+ (rss->types & ETH_RSS_IP || -+ (!hw->rss_info.ipv6_sctp_offload_supported && -+ rss->types & ETH_RSS_NONFRAG_IPV6_SCTP))) -+ return false; -+ -+ return true; -+} -+ - /* - * This function is used to parse rss action validatation. - */ -@@ -1386,18 +1424,7 @@ hns3_parse_rss_filter(struct rte_eth_dev *dev, - RTE_FLOW_ERROR_TYPE_ACTION_CONF, act, - "RSS hash key must be exactly 40 bytes"); - -- /* -- * For Kunpeng920 and Kunpeng930 NIC hardware, it is not supported to -- * use dst port/src port fields to RSS hash for the following packet -- * types. -- * - IPV4 FRAG | IPV4 NONFRAG | IPV6 FRAG | IPV6 NONFRAG -- * Besides, for Kunpeng920, The NIC hardware is not supported to use -- * src/dst port fields to RSS hash for IPV6 SCTP packet type. -- */ -- if (rss->types & (ETH_RSS_L4_DST_ONLY | ETH_RSS_L4_SRC_ONLY) && -- (rss->types & ETH_RSS_IP || -- (!hw->rss_info.ipv6_sctp_offload_supported && -- rss->types & ETH_RSS_NONFRAG_IPV6_SCTP))) -+ if (!hns3_rss_input_tuple_supported(hw, rss)) - return rte_flow_error_set(error, EINVAL, - RTE_FLOW_ERROR_TYPE_ACTION_CONF, - &rss->types, --- -2.7.4 - diff --git a/0022-net-hns3-remove-unnecessary-assignment.patch b/0022-net-hns3-remove-unnecessary-assignment.patch new file mode 100644 index 0000000000000000000000000000000000000000..dd750979cd3d4c3f37010dbc21af2ceaf9f37d59 --- /dev/null +++ b/0022-net-hns3-remove-unnecessary-assignment.patch @@ -0,0 +1,28 @@ +From b70e96833a753239454c660b71cbab6e0dcbbeae Mon Sep 17 00:00:00 2001 +From: Huisong Li +Date: Sat, 22 Jan 2022 09:51:28 +0800 +Subject: [PATCH] net/hns3: remove unnecessary assignment + +Remove unnecessary assignment. + +Signed-off-by: Huisong Li +Acked-by: Min Hu (Connor) +--- + drivers/net/hns3/hns3_flow.c | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/drivers/net/hns3/hns3_flow.c b/drivers/net/hns3/hns3_flow.c +index 0dbc3f6502..5f2b279546 100644 +--- a/drivers/net/hns3/hns3_flow.c ++++ b/drivers/net/hns3/hns3_flow.c +@@ -1890,7 +1890,6 @@ hns3_flow_destroy(struct rte_eth_dev *dev, struct rte_flow *flow, + } + } + rte_free(flow); +- flow = NULL; + + return 0; + } +-- +2.33.0 + diff --git a/0023-net-hns3-fix-using-enum-as-boolean.patch b/0023-net-hns3-fix-using-enum-as-boolean.patch new file mode 100644 index 0000000000000000000000000000000000000000..80ee21dc97cfbf1557239dfa1bb7f335adc00be9 --- /dev/null +++ b/0023-net-hns3-fix-using-enum-as-boolean.patch @@ -0,0 +1,34 @@ +From 67d0b17947d6936147f4cbfff6ff938884f14776 Mon Sep 17 00:00:00 2001 +From: Huisong Li +Date: Sat, 22 Jan 2022 09:51:29 +0800 +Subject: [PATCH] net/hns3: fix using enum as boolean + +The enum type variables cannot be used as bool variables. This patch +fixes for "with->func" in hns3_action_rss_same(). + +Fixes: eb158fc756a5 ("net/hns3: fix config when creating RSS rule after flush") +Cc: stable@dpdk.org + +Signed-off-by: Huisong Li +Acked-by: Min Hu (Connor) +--- + drivers/net/hns3/hns3_flow.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/drivers/net/hns3/hns3_flow.c b/drivers/net/hns3/hns3_flow.c +index 5f2b279546..00084872ad 100644 +--- a/drivers/net/hns3/hns3_flow.c ++++ b/drivers/net/hns3/hns3_flow.c +@@ -1251,7 +1251,8 @@ hns3_action_rss_same(const struct rte_flow_action_rss *comp, + if (comp->func == RTE_ETH_HASH_FUNCTION_MAX) + func_is_same = false; + else +- func_is_same = with->func ? (comp->func == with->func) : true; ++ func_is_same = (with->func != RTE_ETH_HASH_FUNCTION_DEFAULT) ? ++ (comp->func == with->func) : true; + + return (func_is_same && + comp->types == (with->types & HNS3_ETH_RSS_SUPPORT) && +-- +2.33.0 + diff --git a/0023-net-hns3-reconstruct-Rx-interrupt-map.patch b/0023-net-hns3-reconstruct-Rx-interrupt-map.patch deleted file mode 100644 index e7850d9b714c21b5bc63e50f9d4a7e08a3189f64..0000000000000000000000000000000000000000 --- a/0023-net-hns3-reconstruct-Rx-interrupt-map.patch +++ /dev/null @@ -1,190 +0,0 @@ -From badcc5f38dcf223578f870574653fdd20e00c6f8 Mon Sep 17 00:00:00 2001 -From: Chengchang Tang -Date: Fri, 22 Jan 2021 18:18:43 +0800 -Subject: [PATCH 023/189] net/hns3: reconstruct Rx interrupt map - -This patch reconstruct the Rx interrupt map to reduce the cyclic -complexity and improve readability and maintainability. - -Signed-off-by: Chengchang Tang -Signed-off-by: Lijun Ou ---- - drivers/net/hns3/hns3_ethdev.c | 59 +++++++++++++++++++-------------------- - drivers/net/hns3/hns3_ethdev_vf.c | 55 ++++++++++++++++++------------------ - 2 files changed, 56 insertions(+), 58 deletions(-) - -diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c -index 7c51e83..f3ce639 100644 ---- a/drivers/net/hns3/hns3_ethdev.c -+++ b/drivers/net/hns3/hns3_ethdev.c -@@ -4782,27 +4782,28 @@ hns3_map_rx_interrupt(struct rte_eth_dev *dev) - uint16_t q_id; - int ret; - -- if (dev->data->dev_conf.intr_conf.rxq == 0) -+ /* -+ * hns3 needs a separate interrupt to be used as event interrupt which -+ * could not be shared with task queue pair, so KERNEL drivers need -+ * support multiple interrupt vectors. -+ */ -+ if (dev->data->dev_conf.intr_conf.rxq == 0 || -+ !rte_intr_cap_multiple(intr_handle)) - return 0; - -- /* disable uio/vfio intr/eventfd mapping */ - rte_intr_disable(intr_handle); -+ intr_vector = hw->used_rx_queues; -+ /* creates event fd for each intr vector when MSIX is used */ -+ if (rte_intr_efd_enable(intr_handle, intr_vector)) -+ return -EINVAL; - -- /* check and configure queue intr-vector mapping */ -- if (rte_intr_cap_multiple(intr_handle) || -- !RTE_ETH_DEV_SRIOV(dev).active) { -- intr_vector = hw->used_rx_queues; -- /* creates event fd for each intr vector when MSIX is used */ -- if (rte_intr_efd_enable(intr_handle, intr_vector)) -- return -EINVAL; -- } -- if (rte_intr_dp_is_en(intr_handle) && !intr_handle->intr_vec) { -+ if (intr_handle->intr_vec == NULL) { - intr_handle->intr_vec = - rte_zmalloc("intr_vec", - hw->used_rx_queues * sizeof(int), 0); - if (intr_handle->intr_vec == NULL) { -- hns3_err(hw, "Failed to allocate %u rx_queues" -- " intr_vec", hw->used_rx_queues); -+ hns3_err(hw, "failed to allocate %u rx_queues intr_vec", -+ hw->used_rx_queues); - ret = -ENOMEM; - goto alloc_intr_vec_error; - } -@@ -4812,28 +4813,26 @@ hns3_map_rx_interrupt(struct rte_eth_dev *dev) - vec = RTE_INTR_VEC_RXTX_OFFSET; - base = RTE_INTR_VEC_RXTX_OFFSET; - } -- if (rte_intr_dp_is_en(intr_handle)) { -- for (q_id = 0; q_id < hw->used_rx_queues; q_id++) { -- ret = hns3_bind_ring_with_vector(hw, vec, true, -- HNS3_RING_TYPE_RX, -- q_id); -- if (ret) -- goto bind_vector_error; -- intr_handle->intr_vec[q_id] = vec; -- if (vec < base + intr_handle->nb_efd - 1) -- vec++; -- } -+ -+ for (q_id = 0; q_id < hw->used_rx_queues; q_id++) { -+ ret = hns3_bind_ring_with_vector(hw, vec, true, -+ HNS3_RING_TYPE_RX, q_id); -+ if (ret) -+ goto bind_vector_error; -+ intr_handle->intr_vec[q_id] = vec; -+ /* -+ * If there are not enough efds (e.g. not enough interrupt), -+ * remaining queues will be bond to the last interrupt. -+ */ -+ if (vec < base + intr_handle->nb_efd - 1) -+ vec++; - } - rte_intr_enable(intr_handle); - return 0; - - bind_vector_error: -- rte_intr_efd_disable(intr_handle); -- if (intr_handle->intr_vec) { -- free(intr_handle->intr_vec); -- intr_handle->intr_vec = NULL; -- } -- return ret; -+ rte_free(intr_handle->intr_vec); -+ intr_handle->intr_vec = NULL; - alloc_intr_vec_error: - rte_intr_efd_disable(intr_handle); - return ret; -diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c -index 37135d7..3a1d4cb 100644 ---- a/drivers/net/hns3/hns3_ethdev_vf.c -+++ b/drivers/net/hns3/hns3_ethdev_vf.c -@@ -2085,21 +2085,22 @@ hns3vf_map_rx_interrupt(struct rte_eth_dev *dev) - uint16_t q_id; - int ret; - -- if (dev->data->dev_conf.intr_conf.rxq == 0) -+ /* -+ * hns3 needs a separate interrupt to be used as event interrupt which -+ * could not be shared with task queue pair, so KERNEL drivers need -+ * support multiple interrupt vectors. -+ */ -+ if (dev->data->dev_conf.intr_conf.rxq == 0 || -+ !rte_intr_cap_multiple(intr_handle)) - return 0; - -- /* disable uio/vfio intr/eventfd mapping */ - rte_intr_disable(intr_handle); -+ intr_vector = hw->used_rx_queues; -+ /* It creates event fd for each intr vector when MSIX is used */ -+ if (rte_intr_efd_enable(intr_handle, intr_vector)) -+ return -EINVAL; - -- /* check and configure queue intr-vector mapping */ -- if (rte_intr_cap_multiple(intr_handle) || -- !RTE_ETH_DEV_SRIOV(dev).active) { -- intr_vector = hw->used_rx_queues; -- /* It creates event fd for each intr vector when MSIX is used */ -- if (rte_intr_efd_enable(intr_handle, intr_vector)) -- return -EINVAL; -- } -- if (rte_intr_dp_is_en(intr_handle) && !intr_handle->intr_vec) { -+ if (intr_handle->intr_vec == NULL) { - intr_handle->intr_vec = - rte_zmalloc("intr_vec", - hw->used_rx_queues * sizeof(int), 0); -@@ -2115,28 +2116,26 @@ hns3vf_map_rx_interrupt(struct rte_eth_dev *dev) - vec = RTE_INTR_VEC_RXTX_OFFSET; - base = RTE_INTR_VEC_RXTX_OFFSET; - } -- if (rte_intr_dp_is_en(intr_handle)) { -- for (q_id = 0; q_id < hw->used_rx_queues; q_id++) { -- ret = hns3vf_bind_ring_with_vector(hw, vec, true, -- HNS3_RING_TYPE_RX, -- q_id); -- if (ret) -- goto vf_bind_vector_error; -- intr_handle->intr_vec[q_id] = vec; -- if (vec < base + intr_handle->nb_efd - 1) -- vec++; -- } -+ -+ for (q_id = 0; q_id < hw->used_rx_queues; q_id++) { -+ ret = hns3vf_bind_ring_with_vector(hw, vec, true, -+ HNS3_RING_TYPE_RX, q_id); -+ if (ret) -+ goto vf_bind_vector_error; -+ intr_handle->intr_vec[q_id] = vec; -+ /* -+ * If there are not enough efds (e.g. not enough interrupt), -+ * remaining queues will be bond to the last interrupt. -+ */ -+ if (vec < base + intr_handle->nb_efd - 1) -+ vec++; - } - rte_intr_enable(intr_handle); - return 0; - - vf_bind_vector_error: -- rte_intr_efd_disable(intr_handle); -- if (intr_handle->intr_vec) { -- free(intr_handle->intr_vec); -- intr_handle->intr_vec = NULL; -- } -- return ret; -+ free(intr_handle->intr_vec); -+ intr_handle->intr_vec = NULL; - vf_alloc_intr_vec_error: - rte_intr_efd_disable(intr_handle); - return ret; --- -2.7.4 - diff --git a/0024-net-hns3-extract-common-checks-for-flow-director.patch b/0024-net-hns3-extract-common-checks-for-flow-director.patch deleted file mode 100644 index df9ed911f44e2228dc113dfee88da5b10fc652e4..0000000000000000000000000000000000000000 --- a/0024-net-hns3-extract-common-checks-for-flow-director.patch +++ /dev/null @@ -1,197 +0,0 @@ -From ea7fb351ca32444916ea099c644d1f29295ffdeb Mon Sep 17 00:00:00 2001 -From: Lijun Ou -Date: Fri, 22 Jan 2021 18:18:44 +0800 -Subject: [PATCH 024/189] net/hns3: extract common checks for flow director - -When parse flow director with all types, it needs to judge the spec -of item and mask of item for all packet types. The judgement is the -same for all types. Therefore, we move it into the concentrated -location. - -Signed-off-by: Lijun Ou ---- - drivers/net/hns3/hns3_flow.c | 84 +++++++++++--------------------------------- - 1 file changed, 20 insertions(+), 64 deletions(-) - -diff --git a/drivers/net/hns3/hns3_flow.c b/drivers/net/hns3/hns3_flow.c -index 889fa2f..9b161f4 100644 ---- a/drivers/net/hns3/hns3_flow.c -+++ b/drivers/net/hns3/hns3_flow.c -@@ -433,17 +433,12 @@ hns3_check_attr(const struct rte_flow_attr *attr, struct rte_flow_error *error) - } - - static int --hns3_parse_eth(const struct rte_flow_item *item, -- struct hns3_fdir_rule *rule, struct rte_flow_error *error) -+hns3_parse_eth(const struct rte_flow_item *item, struct hns3_fdir_rule *rule, -+ struct rte_flow_error *error __rte_unused) - { - const struct rte_flow_item_eth *eth_spec; - const struct rte_flow_item_eth *eth_mask; - -- if (item->spec == NULL && item->mask) -- return rte_flow_error_set(error, EINVAL, -- RTE_FLOW_ERROR_TYPE_ITEM, item, -- "Can't configure FDIR with mask but without spec"); -- - /* Only used to describe the protocol stack. */ - if (item->spec == NULL && item->mask == NULL) - return 0; -@@ -483,11 +478,6 @@ hns3_parse_vlan(const struct rte_flow_item *item, struct hns3_fdir_rule *rule, - const struct rte_flow_item_vlan *vlan_spec; - const struct rte_flow_item_vlan *vlan_mask; - -- if (item->spec == NULL && item->mask) -- return rte_flow_error_set(error, EINVAL, -- RTE_FLOW_ERROR_TYPE_ITEM, item, -- "Can't configure FDIR with mask but without spec"); -- - rule->key_conf.vlan_num++; - if (rule->key_conf.vlan_num > VLAN_TAG_NUM_MAX) - return rte_flow_error_set(error, EINVAL, -@@ -543,14 +533,10 @@ hns3_parse_ipv4(const struct rte_flow_item *item, struct hns3_fdir_rule *rule, - const struct rte_flow_item_ipv4 *ipv4_spec; - const struct rte_flow_item_ipv4 *ipv4_mask; - -- if (item->spec == NULL && item->mask) -- return rte_flow_error_set(error, EINVAL, -- RTE_FLOW_ERROR_TYPE_ITEM, item, -- "Can't configure FDIR with mask but without spec"); -- - hns3_set_bit(rule->input_set, INNER_ETH_TYPE, 1); - rule->key_conf.spec.ether_type = RTE_ETHER_TYPE_IPV4; - rule->key_conf.mask.ether_type = ETHER_TYPE_MASK; -+ - /* Only used to describe the protocol stack. */ - if (item->spec == NULL && item->mask == NULL) - return 0; -@@ -606,11 +592,6 @@ hns3_parse_ipv6(const struct rte_flow_item *item, struct hns3_fdir_rule *rule, - const struct rte_flow_item_ipv6 *ipv6_spec; - const struct rte_flow_item_ipv6 *ipv6_mask; - -- if (item->spec == NULL && item->mask) -- return rte_flow_error_set(error, EINVAL, -- RTE_FLOW_ERROR_TYPE_ITEM, item, -- "Can't configure FDIR with mask but without spec"); -- - hns3_set_bit(rule->input_set, INNER_ETH_TYPE, 1); - rule->key_conf.spec.ether_type = RTE_ETHER_TYPE_IPV6; - rule->key_conf.mask.ether_type = ETHER_TYPE_MASK; -@@ -674,11 +655,6 @@ hns3_parse_tcp(const struct rte_flow_item *item, struct hns3_fdir_rule *rule, - const struct rte_flow_item_tcp *tcp_spec; - const struct rte_flow_item_tcp *tcp_mask; - -- if (item->spec == NULL && item->mask) -- return rte_flow_error_set(error, EINVAL, -- RTE_FLOW_ERROR_TYPE_ITEM, item, -- "Can't configure FDIR with mask but without spec"); -- - hns3_set_bit(rule->input_set, INNER_IP_PROTO, 1); - rule->key_conf.spec.ip_proto = IPPROTO_TCP; - rule->key_conf.mask.ip_proto = IPPROTO_MASK; -@@ -722,11 +698,6 @@ hns3_parse_udp(const struct rte_flow_item *item, struct hns3_fdir_rule *rule, - const struct rte_flow_item_udp *udp_spec; - const struct rte_flow_item_udp *udp_mask; - -- if (item->spec == NULL && item->mask) -- return rte_flow_error_set(error, EINVAL, -- RTE_FLOW_ERROR_TYPE_ITEM, item, -- "Can't configure FDIR with mask but without spec"); -- - hns3_set_bit(rule->input_set, INNER_IP_PROTO, 1); - rule->key_conf.spec.ip_proto = IPPROTO_UDP; - rule->key_conf.mask.ip_proto = IPPROTO_MASK; -@@ -768,11 +739,6 @@ hns3_parse_sctp(const struct rte_flow_item *item, struct hns3_fdir_rule *rule, - const struct rte_flow_item_sctp *sctp_spec; - const struct rte_flow_item_sctp *sctp_mask; - -- if (item->spec == NULL && item->mask) -- return rte_flow_error_set(error, EINVAL, -- RTE_FLOW_ERROR_TYPE_ITEM, item, -- "Can't configure FDIR with mask but without spec"); -- - hns3_set_bit(rule->input_set, INNER_IP_PROTO, 1); - rule->key_conf.spec.ip_proto = IPPROTO_SCTP; - rule->key_conf.mask.ip_proto = IPPROTO_MASK; -@@ -904,15 +870,6 @@ hns3_parse_vxlan(const struct rte_flow_item *item, struct hns3_fdir_rule *rule, - const struct rte_flow_item_vxlan *vxlan_spec; - const struct rte_flow_item_vxlan *vxlan_mask; - -- if (item->spec == NULL && item->mask) -- return rte_flow_error_set(error, EINVAL, -- RTE_FLOW_ERROR_TYPE_ITEM, item, -- "Can't configure FDIR with mask but without spec"); -- else if (item->spec && (item->mask == NULL)) -- return rte_flow_error_set(error, EINVAL, -- RTE_FLOW_ERROR_TYPE_ITEM, item, -- "Tunnel packets must configure with mask"); -- - hns3_set_bit(rule->input_set, OUTER_DST_PORT, 1); - rule->key_conf.mask.tunnel_type = TUNNEL_TYPE_MASK; - if (item->type == RTE_FLOW_ITEM_TYPE_VXLAN) -@@ -955,15 +912,6 @@ hns3_parse_nvgre(const struct rte_flow_item *item, struct hns3_fdir_rule *rule, - const struct rte_flow_item_nvgre *nvgre_spec; - const struct rte_flow_item_nvgre *nvgre_mask; - -- if (item->spec == NULL && item->mask) -- return rte_flow_error_set(error, EINVAL, -- RTE_FLOW_ERROR_TYPE_ITEM, item, -- "Can't configure FDIR with mask but without spec"); -- else if (item->spec && (item->mask == NULL)) -- return rte_flow_error_set(error, EINVAL, -- RTE_FLOW_ERROR_TYPE_ITEM, item, -- "Tunnel packets must configure with mask"); -- - hns3_set_bit(rule->input_set, OUTER_IP_PROTO, 1); - rule->key_conf.spec.outer_proto = IPPROTO_GRE; - rule->key_conf.mask.outer_proto = IPPROTO_MASK; -@@ -1013,15 +961,6 @@ hns3_parse_geneve(const struct rte_flow_item *item, struct hns3_fdir_rule *rule, - const struct rte_flow_item_geneve *geneve_spec; - const struct rte_flow_item_geneve *geneve_mask; - -- if (item->spec == NULL && item->mask) -- return rte_flow_error_set(error, EINVAL, -- RTE_FLOW_ERROR_TYPE_ITEM, item, -- "Can't configure FDIR with mask but without spec"); -- else if (item->spec && (item->mask == NULL)) -- return rte_flow_error_set(error, EINVAL, -- RTE_FLOW_ERROR_TYPE_ITEM, item, -- "Tunnel packets must configure with mask"); -- - hns3_set_bit(rule->input_set, OUTER_DST_PORT, 1); - rule->key_conf.spec.tunnel_type = HNS3_TUNNEL_TYPE_GENEVE; - rule->key_conf.mask.tunnel_type = TUNNEL_TYPE_MASK; -@@ -1058,6 +997,17 @@ hns3_parse_tunnel(const struct rte_flow_item *item, struct hns3_fdir_rule *rule, - { - int ret; - -+ if (item->spec == NULL && item->mask) -+ return rte_flow_error_set(error, EINVAL, -+ RTE_FLOW_ERROR_TYPE_ITEM, item, -+ "Can't configure FDIR with mask " -+ "but without spec"); -+ else if (item->spec && (item->mask == NULL)) -+ return rte_flow_error_set(error, EINVAL, -+ RTE_FLOW_ERROR_TYPE_ITEM, item, -+ "Tunnel packets must configure " -+ "with mask"); -+ - switch (item->type) { - case RTE_FLOW_ITEM_TYPE_VXLAN: - case RTE_FLOW_ITEM_TYPE_VXLAN_GPE: -@@ -1086,6 +1036,12 @@ hns3_parse_normal(const struct rte_flow_item *item, struct hns3_fdir_rule *rule, - { - int ret; - -+ if (item->spec == NULL && item->mask) -+ return rte_flow_error_set(error, EINVAL, -+ RTE_FLOW_ERROR_TYPE_ITEM, item, -+ "Can't configure FDIR with mask " -+ "but without spec"); -+ - switch (item->type) { - case RTE_FLOW_ITEM_TYPE_ETH: - ret = hns3_parse_eth(item, rule, error); --- -2.7.4 - diff --git a/0024-net-hns3-extract-common-function-to-initialize-MAC-a.patch b/0024-net-hns3-extract-common-function-to-initialize-MAC-a.patch new file mode 100644 index 0000000000000000000000000000000000000000..af051287a8908a6d50948b94d6895b39bbdf7ccf --- /dev/null +++ b/0024-net-hns3-extract-common-function-to-initialize-MAC-a.patch @@ -0,0 +1,205 @@ +From 2665a92054019bdb73cd2c43e5a581d081772915 Mon Sep 17 00:00:00 2001 +From: Huisong Li +Date: Sat, 22 Jan 2022 09:51:30 +0800 +Subject: [PATCH] net/hns3: extract common function to initialize MAC address + +The code logic to initialize "data->mac_addrs" for PF and VF is similar. +This patch extracts a common API to initialize it to improve code +maintainability. + +Signed-off-by: Huisong Li +Acked-by: Min Hu (Connor) +--- + drivers/net/hns3/hns3_common.c | 54 +++++++++++++++++++++++++++++++ + drivers/net/hns3/hns3_common.h | 1 + + drivers/net/hns3/hns3_ethdev.c | 31 +++--------------- + drivers/net/hns3/hns3_ethdev_vf.c | 33 +++---------------- + 4 files changed, 63 insertions(+), 56 deletions(-) + +diff --git a/drivers/net/hns3/hns3_common.c b/drivers/net/hns3/hns3_common.c +index 78158401f2..0f39d51a87 100644 +--- a/drivers/net/hns3/hns3_common.c ++++ b/drivers/net/hns3/hns3_common.c +@@ -587,6 +587,60 @@ hns3_remove_mac_addr(struct rte_eth_dev *dev, uint32_t idx) + } + } + ++int ++hns3_init_mac_addrs(struct rte_eth_dev *dev) ++{ ++ struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private); ++ struct hns3_adapter *hns = HNS3_DEV_HW_TO_ADAPTER(hw); ++ const char *memory_name = hns->is_vf ? "hns3vf-mac" : "hns3-mac"; ++ uint16_t mac_addrs_capa = hns->is_vf ? HNS3_VF_UC_MACADDR_NUM : ++ HNS3_UC_MACADDR_NUM; ++ char mac_str[RTE_ETHER_ADDR_FMT_SIZE]; ++ struct rte_ether_addr *eth_addr; ++ ++ /* Allocate memory for storing MAC addresses */ ++ dev->data->mac_addrs = rte_zmalloc(memory_name, ++ sizeof(struct rte_ether_addr) * mac_addrs_capa, ++ 0); ++ if (dev->data->mac_addrs == NULL) { ++ hns3_err(hw, "failed to allocate %zx bytes needed to store MAC addresses", ++ sizeof(struct rte_ether_addr) * mac_addrs_capa); ++ return -ENOMEM; ++ } ++ ++ eth_addr = (struct rte_ether_addr *)hw->mac.mac_addr; ++ if (!hns->is_vf) { ++ if (!rte_is_valid_assigned_ether_addr(eth_addr)) { ++ rte_eth_random_addr(hw->mac.mac_addr); ++ hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE, ++ (struct rte_ether_addr *)hw->mac.mac_addr); ++ hns3_warn(hw, "default mac_addr from firmware is an invalid " ++ "unicast address, using random MAC address %s", ++ mac_str); ++ } ++ } else { ++ /* ++ * The hns3 PF ethdev driver in kernel support setting VF MAC ++ * address on the host by "ip link set ..." command. To avoid ++ * some incorrect scenes, for example, hns3 VF PMD driver fails ++ * to receive and send packets after user configure the MAC ++ * address by using the "ip link set ..." command, hns3 VF PMD ++ * driver keep the same MAC address strategy as the hns3 kernel ++ * ethdev driver in the initialization. If user configure a MAC ++ * address by the ip command for VF device, then hns3 VF PMD ++ * driver will start with it, otherwise start with a random MAC ++ * address in the initialization. ++ */ ++ if (rte_is_zero_ether_addr(eth_addr)) ++ rte_eth_random_addr(hw->mac.mac_addr); ++ } ++ ++ rte_ether_addr_copy((struct rte_ether_addr *)hw->mac.mac_addr, ++ &dev->data->mac_addrs[0]); ++ ++ return 0; ++} ++ + int + hns3_init_ring_with_vector(struct hns3_hw *hw) + { +diff --git a/drivers/net/hns3/hns3_common.h b/drivers/net/hns3/hns3_common.h +index 0dbb1c0413..a9e8a9cccf 100644 +--- a/drivers/net/hns3/hns3_common.h ++++ b/drivers/net/hns3/hns3_common.h +@@ -52,6 +52,7 @@ int hns3_set_mc_mac_addr_list(struct rte_eth_dev *dev, + uint32_t nb_mc_addr); + void hns3_ether_format_addr(char *buf, uint16_t size, + const struct rte_ether_addr *ether_addr); ++int hns3_init_mac_addrs(struct rte_eth_dev *dev); + + int hns3_init_ring_with_vector(struct hns3_hw *hw); + int hns3_map_rx_interrupt(struct rte_eth_dev *dev); +diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c +index ef13d31d19..722660d0cc 100644 +--- a/drivers/net/hns3/hns3_ethdev.c ++++ b/drivers/net/hns3/hns3_ethdev.c +@@ -6617,8 +6617,6 @@ static int + hns3_dev_init(struct rte_eth_dev *eth_dev) + { + struct hns3_adapter *hns = eth_dev->data->dev_private; +- char mac_str[RTE_ETHER_ADDR_FMT_SIZE]; +- struct rte_ether_addr *eth_addr; + struct hns3_hw *hw = &hns->hw; + int ret; + +@@ -6661,30 +6659,9 @@ hns3_dev_init(struct rte_eth_dev *eth_dev) + goto err_init_pf; + } + +- /* Allocate memory for storing MAC addresses */ +- eth_dev->data->mac_addrs = rte_zmalloc("hns3-mac", +- sizeof(struct rte_ether_addr) * +- HNS3_UC_MACADDR_NUM, 0); +- if (eth_dev->data->mac_addrs == NULL) { +- PMD_INIT_LOG(ERR, "Failed to allocate %zx bytes needed " +- "to store MAC addresses", +- sizeof(struct rte_ether_addr) * +- HNS3_UC_MACADDR_NUM); +- ret = -ENOMEM; +- goto err_rte_zmalloc; +- } +- +- eth_addr = (struct rte_ether_addr *)hw->mac.mac_addr; +- if (!rte_is_valid_assigned_ether_addr(eth_addr)) { +- rte_eth_random_addr(hw->mac.mac_addr); +- hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE, +- (struct rte_ether_addr *)hw->mac.mac_addr); +- hns3_warn(hw, "default mac_addr from firmware is an invalid " +- "unicast address, using random MAC address %s", +- mac_str); +- } +- rte_ether_addr_copy((struct rte_ether_addr *)hw->mac.mac_addr, +- ð_dev->data->mac_addrs[0]); ++ ret = hns3_init_mac_addrs(eth_dev); ++ if (ret != 0) ++ goto err_init_mac_addrs; + + hw->adapter_state = HNS3_NIC_INITIALIZED; + +@@ -6700,7 +6677,7 @@ hns3_dev_init(struct rte_eth_dev *eth_dev) + hns3_info(hw, "hns3 dev initialization successful!"); + return 0; + +-err_rte_zmalloc: ++err_init_mac_addrs: + hns3_uninit_pf(eth_dev); + + err_init_pf: +diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c +index 5015fe0d5f..5a1286e17b 100644 +--- a/drivers/net/hns3/hns3_ethdev_vf.c ++++ b/drivers/net/hns3/hns3_ethdev_vf.c +@@ -2400,34 +2400,9 @@ hns3vf_dev_init(struct rte_eth_dev *eth_dev) + goto err_init_vf; + } + +- /* Allocate memory for storing MAC addresses */ +- eth_dev->data->mac_addrs = rte_zmalloc("hns3vf-mac", +- sizeof(struct rte_ether_addr) * +- HNS3_VF_UC_MACADDR_NUM, 0); +- if (eth_dev->data->mac_addrs == NULL) { +- PMD_INIT_LOG(ERR, "Failed to allocate %zx bytes needed " +- "to store MAC addresses", +- sizeof(struct rte_ether_addr) * +- HNS3_VF_UC_MACADDR_NUM); +- ret = -ENOMEM; +- goto err_rte_zmalloc; +- } +- +- /* +- * The hns3 PF ethdev driver in kernel support setting VF MAC address +- * on the host by "ip link set ..." command. To avoid some incorrect +- * scenes, for example, hns3 VF PMD fails to receive and send +- * packets after user configure the MAC address by using the +- * "ip link set ..." command, hns3 VF PMD keep the same MAC +- * address strategy as the hns3 kernel ethdev driver in the +- * initialization. If user configure a MAC address by the ip command +- * for VF device, then hns3 VF PMD will start with it, otherwise +- * start with a random MAC address in the initialization. +- */ +- if (rte_is_zero_ether_addr((struct rte_ether_addr *)hw->mac.mac_addr)) +- rte_eth_random_addr(hw->mac.mac_addr); +- rte_ether_addr_copy((struct rte_ether_addr *)hw->mac.mac_addr, +- ð_dev->data->mac_addrs[0]); ++ ret = hns3_init_mac_addrs(eth_dev); ++ if (ret != 0) ++ goto err_init_mac_addrs; + + hw->adapter_state = HNS3_NIC_INITIALIZED; + +@@ -2443,7 +2418,7 @@ hns3vf_dev_init(struct rte_eth_dev *eth_dev) + eth_dev); + return 0; + +-err_rte_zmalloc: ++err_init_mac_addrs: + hns3vf_uninit_vf(eth_dev); + + err_init_vf: +-- +2.33.0 + diff --git a/0025-net-hns3-make-control-plane-function-non-inline.patch b/0025-net-hns3-make-control-plane-function-non-inline.patch new file mode 100644 index 0000000000000000000000000000000000000000..4f658d1ae630226c22e76e247a3af85b790de6dc --- /dev/null +++ b/0025-net-hns3-make-control-plane-function-non-inline.patch @@ -0,0 +1,30 @@ +From 7be11baa6e5fd2143f5574403c44e45fc9c5e393 Mon Sep 17 00:00:00 2001 +From: Jie Hai +Date: Sat, 22 Jan 2022 09:51:31 +0800 +Subject: [PATCH] net/hns3: make control plane function non-inline + +This function is a control-plane interface and does +not need to use inline. + +Signed-off-by: Jie Hai +Acked-by: Min Hu (Connor) +--- + drivers/net/hns3/hns3_ethdev.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c +index 722660d0cc..f92832a4aa 100644 +--- a/drivers/net/hns3/hns3_ethdev.c ++++ b/drivers/net/hns3/hns3_ethdev.c +@@ -4853,7 +4853,7 @@ hns3_check_port_speed(struct hns3_hw *hw, uint32_t link_speeds) + return 0; + } + +-static inline uint32_t ++static uint32_t + hns3_get_link_speed(uint32_t link_speeds) + { + uint32_t speed = RTE_ETH_SPEED_NUM_NONE; +-- +2.33.0 + diff --git a/0025-net-hns3-refactor-reset-event-report-function.patch b/0025-net-hns3-refactor-reset-event-report-function.patch deleted file mode 100644 index f9478da5be56c45c7020c03033133cd0882c7976..0000000000000000000000000000000000000000 --- a/0025-net-hns3-refactor-reset-event-report-function.patch +++ /dev/null @@ -1,122 +0,0 @@ -From 2e88b488d2b8f3086b7d94179722066b9915a7b9 Mon Sep 17 00:00:00 2001 -From: Lijun Ou -Date: Fri, 22 Jan 2021 18:18:45 +0800 -Subject: [PATCH 025/189] net/hns3: refactor reset event report function - -Here encapsulate the process code of the imp reset report and -global reset report into function in order to reduce the -complexity of the hns3_check_event_cause function. - -Signed-off-by: Lijun Ou ---- - drivers/net/hns3/hns3_ethdev.c | 69 +++++++++++++++++++++++++++--------------- - 1 file changed, 45 insertions(+), 24 deletions(-) - -diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c -index f3ce639..817d1dc 100644 ---- a/drivers/net/hns3/hns3_ethdev.c -+++ b/drivers/net/hns3/hns3_ethdev.c -@@ -123,6 +123,47 @@ hns3_pf_enable_irq0(struct hns3_hw *hw) - } - - static enum hns3_evt_cause -+hns3_proc_imp_reset_event(struct hns3_adapter *hns, bool is_delay, -+ uint32_t *vec_val) -+{ -+ struct hns3_hw *hw = &hns->hw; -+ -+ rte_atomic16_set(&hw->reset.disable_cmd, 1); -+ hns3_atomic_set_bit(HNS3_IMP_RESET, &hw->reset.pending); -+ *vec_val = BIT(HNS3_VECTOR0_IMPRESET_INT_B); -+ if (!is_delay) { -+ hw->reset.stats.imp_cnt++; -+ hns3_warn(hw, "IMP reset detected, clear reset status"); -+ } else { -+ hns3_schedule_delayed_reset(hns); -+ hns3_warn(hw, "IMP reset detected, don't clear reset status"); -+ } -+ -+ return HNS3_VECTOR0_EVENT_RST; -+} -+ -+static enum hns3_evt_cause -+hns3_proc_global_reset_event(struct hns3_adapter *hns, bool is_delay, -+ uint32_t *vec_val) -+{ -+ struct hns3_hw *hw = &hns->hw; -+ -+ rte_atomic16_set(&hw->reset.disable_cmd, 1); -+ hns3_atomic_set_bit(HNS3_GLOBAL_RESET, &hw->reset.pending); -+ *vec_val = BIT(HNS3_VECTOR0_GLOBALRESET_INT_B); -+ if (!is_delay) { -+ hw->reset.stats.global_cnt++; -+ hns3_warn(hw, "Global reset detected, clear reset status"); -+ } else { -+ hns3_schedule_delayed_reset(hns); -+ hns3_warn(hw, -+ "Global reset detected, don't clear reset status"); -+ } -+ -+ return HNS3_VECTOR0_EVENT_RST; -+} -+ -+static enum hns3_evt_cause - hns3_check_event_cause(struct hns3_adapter *hns, uint32_t *clearval) - { - struct hns3_hw *hw = &hns->hw; -@@ -131,12 +172,14 @@ hns3_check_event_cause(struct hns3_adapter *hns, uint32_t *clearval) - uint32_t hw_err_src_reg; - uint32_t val; - enum hns3_evt_cause ret; -+ bool is_delay; - - /* fetch the events from their corresponding regs */ - vector0_int_stats = hns3_read_dev(hw, HNS3_VECTOR0_OTHER_INT_STS_REG); - cmdq_src_val = hns3_read_dev(hw, HNS3_VECTOR0_CMDQ_SRC_REG); - hw_err_src_reg = hns3_read_dev(hw, HNS3_RAS_PF_OTHER_INT_STS_REG); - -+ is_delay = clearval == NULL ? true : false; - /* - * Assumption: If by any chance reset and mailbox events are reported - * together then we will only process reset event and defer the -@@ -145,35 +188,13 @@ hns3_check_event_cause(struct hns3_adapter *hns, uint32_t *clearval) - * from H/W just for the mailbox. - */ - if (BIT(HNS3_VECTOR0_IMPRESET_INT_B) & vector0_int_stats) { /* IMP */ -- rte_atomic16_set(&hw->reset.disable_cmd, 1); -- hns3_atomic_set_bit(HNS3_IMP_RESET, &hw->reset.pending); -- val = BIT(HNS3_VECTOR0_IMPRESET_INT_B); -- if (clearval) { -- hw->reset.stats.imp_cnt++; -- hns3_warn(hw, "IMP reset detected, clear reset status"); -- } else { -- hns3_schedule_delayed_reset(hns); -- hns3_warn(hw, "IMP reset detected, don't clear reset status"); -- } -- -- ret = HNS3_VECTOR0_EVENT_RST; -+ ret = hns3_proc_imp_reset_event(hns, is_delay, &val); - goto out; - } - - /* Global reset */ - if (BIT(HNS3_VECTOR0_GLOBALRESET_INT_B) & vector0_int_stats) { -- rte_atomic16_set(&hw->reset.disable_cmd, 1); -- hns3_atomic_set_bit(HNS3_GLOBAL_RESET, &hw->reset.pending); -- val = BIT(HNS3_VECTOR0_GLOBALRESET_INT_B); -- if (clearval) { -- hw->reset.stats.global_cnt++; -- hns3_warn(hw, "Global reset detected, clear reset status"); -- } else { -- hns3_schedule_delayed_reset(hns); -- hns3_warn(hw, "Global reset detected, don't clear reset status"); -- } -- -- ret = HNS3_VECTOR0_EVENT_RST; -+ ret = hns3_proc_global_reset_event(hns, is_delay, &val); - goto out; - } - --- -2.7.4 - diff --git a/0026-net-hns3-fix-memory-leak-on-secondary-process-exit.patch b/0026-net-hns3-fix-memory-leak-on-secondary-process-exit.patch deleted file mode 100644 index 21402ee4702c1ad54c89898106eedfa8c4c92c08..0000000000000000000000000000000000000000 --- a/0026-net-hns3-fix-memory-leak-on-secondary-process-exit.patch +++ /dev/null @@ -1,70 +0,0 @@ -From 64c98e007bf57084bab1be0256d5d8cabf8e5b29 Mon Sep 17 00:00:00 2001 -From: Lijun Ou -Date: Fri, 22 Jan 2021 18:18:46 +0800 -Subject: [PATCH 026/189] net/hns3: fix memory leak on secondary process exit - -The secondary process is applied a memory for the process_private -during initialization. Therefore, the memory needs to be released -when exiting. - -Fixes: c203571b3602 ("net/hns3: register and add log interface") -Cc: stable@dpdk.org - -Signed-off-by: Lijun Ou ---- - drivers/net/hns3/hns3_ethdev.c | 7 +++++-- - drivers/net/hns3/hns3_ethdev_vf.c | 12 +++++++++--- - 2 files changed, 14 insertions(+), 5 deletions(-) - -diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c -index 817d1dc..2a5689c 100644 ---- a/drivers/net/hns3/hns3_ethdev.c -+++ b/drivers/net/hns3/hns3_ethdev.c -@@ -6263,8 +6263,11 @@ hns3_dev_uninit(struct rte_eth_dev *eth_dev) - - PMD_INIT_FUNC_TRACE(); - -- if (rte_eal_process_type() != RTE_PROC_PRIMARY) -- return -EPERM; -+ if (rte_eal_process_type() != RTE_PROC_PRIMARY) { -+ rte_free(eth_dev->process_private); -+ eth_dev->process_private = NULL; -+ return 0; -+ } - - if (hw->adapter_state < HNS3_NIC_CLOSING) - hns3_dev_close(eth_dev); -diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c -index 3a1d4cb..948d914 100644 ---- a/drivers/net/hns3/hns3_ethdev_vf.c -+++ b/drivers/net/hns3/hns3_ethdev_vf.c -@@ -1971,8 +1971,11 @@ hns3vf_dev_close(struct rte_eth_dev *eth_dev) - struct hns3_hw *hw = &hns->hw; - int ret = 0; - -- if (rte_eal_process_type() != RTE_PROC_PRIMARY) -+ if (rte_eal_process_type() != RTE_PROC_PRIMARY) { -+ rte_free(eth_dev->process_private); -+ eth_dev->process_private = NULL; - return 0; -+ } - - if (hw->adapter_state == HNS3_NIC_STARTED) - ret = hns3vf_dev_stop(eth_dev); -@@ -2839,8 +2842,11 @@ hns3vf_dev_uninit(struct rte_eth_dev *eth_dev) - - PMD_INIT_FUNC_TRACE(); - -- if (rte_eal_process_type() != RTE_PROC_PRIMARY) -- return -EPERM; -+ if (rte_eal_process_type() != RTE_PROC_PRIMARY) { -+ rte_free(eth_dev->process_private); -+ eth_dev->process_private = NULL; -+ return 0; -+ } - - if (hw->adapter_state < HNS3_NIC_CLOSING) - hns3vf_dev_close(eth_dev); --- -2.7.4 - diff --git a/0026-net-hns3-remove-unnecessary-blank-lines.patch b/0026-net-hns3-remove-unnecessary-blank-lines.patch new file mode 100644 index 0000000000000000000000000000000000000000..4cdecd0f407e8dfcb395f6c40203aa91de12fcde --- /dev/null +++ b/0026-net-hns3-remove-unnecessary-blank-lines.patch @@ -0,0 +1,49 @@ +From fbbcf80a9dc6d2f2d553b1c0b8762b5a35f4afc0 Mon Sep 17 00:00:00 2001 +From: Huisong Li +Date: Sat, 22 Jan 2022 09:51:32 +0800 +Subject: [PATCH] net/hns3: remove unnecessary blank lines + +Remove unnecessary blank lines. + +Signed-off-by: Huisong Li +Acked-by: Min Hu (Connor) +--- + drivers/net/hns3/hns3_ethdev.c | 1 - + drivers/net/hns3/hns3_rxtx.h | 2 -- + 2 files changed, 3 deletions(-) + +diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c +index f92832a4aa..0f6d238f6f 100644 +--- a/drivers/net/hns3/hns3_ethdev.c ++++ b/drivers/net/hns3/hns3_ethdev.c +@@ -6295,7 +6295,6 @@ hns3_fec_set(struct rte_eth_dev *dev, uint32_t mode) + struct hns3_adapter *hns = dev->data->dev_private; + struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(hns); + struct hns3_pf *pf = &hns->pf; +- + struct rte_eth_fec_capa fec_capa[FEC_CAPA_NUM]; + uint32_t cur_capa; + uint32_t num = FEC_CAPA_NUM; +diff --git a/drivers/net/hns3/hns3_rxtx.h b/drivers/net/hns3/hns3_rxtx.h +index e202eb9c30..094b65b7de 100644 +--- a/drivers/net/hns3/hns3_rxtx.h ++++ b/drivers/net/hns3/hns3_rxtx.h +@@ -344,7 +344,6 @@ struct hns3_rx_queue { + + struct rte_mbuf fake_mbuf; /* fake mbuf used with vector rx */ + +- + /* + * The following fields are not accessed in the I/O path, so they are + * placed at the end. +@@ -518,7 +517,6 @@ struct hns3_tx_queue { + struct hns3_tx_basic_stats basic_stats; + struct hns3_tx_dfx_stats dfx_stats; + +- + /* + * The following fields are not accessed in the I/O path, so they are + * placed at the end. +-- +2.33.0 + diff --git a/0027-net-hns3-extract-reset-failure-handling-to-function.patch b/0027-net-hns3-extract-reset-failure-handling-to-function.patch new file mode 100644 index 0000000000000000000000000000000000000000..0b685f5e773d7eca3f16d32646d6288e2534396a --- /dev/null +++ b/0027-net-hns3-extract-reset-failure-handling-to-function.patch @@ -0,0 +1,95 @@ +From f13c07a570fabe362b55d2e3643b5ff96513597f Mon Sep 17 00:00:00 2001 +From: Huisong Li +Date: Sat, 22 Jan 2022 09:51:33 +0800 +Subject: [PATCH] net/hns3: extract reset failure handling to function + +Extract a function to handle reset fail for clearer code logic. + +Signed-off-by: Huisong Li +Acked-by: Min Hu (Connor) +--- + drivers/net/hns3/hns3_intr.c | 54 +++++++++++++++++++++--------------- + 1 file changed, 32 insertions(+), 22 deletions(-) + +diff --git a/drivers/net/hns3/hns3_intr.c b/drivers/net/hns3/hns3_intr.c +index 66dc509086..3ca2e1e338 100644 +--- a/drivers/net/hns3/hns3_intr.c ++++ b/drivers/net/hns3/hns3_intr.c +@@ -2770,6 +2770,37 @@ hns3_reset_post(struct hns3_adapter *hns) + return -EIO; + } + ++static void ++hns3_reset_fail_handle(struct hns3_adapter *hns) ++{ ++ struct hns3_hw *hw = &hns->hw; ++ struct timeval tv_delta; ++ struct timeval tv; ++ ++ hns3_clear_reset_level(hw, &hw->reset.pending); ++ if (hns3_reset_err_handle(hns)) { ++ hw->reset.stage = RESET_STAGE_PREWAIT; ++ hns3_schedule_reset(hns); ++ return; ++ } ++ ++ rte_spinlock_lock(&hw->lock); ++ if (hw->reset.mbuf_deferred_free) { ++ hns3_dev_release_mbufs(hns); ++ hw->reset.mbuf_deferred_free = false; ++ } ++ rte_spinlock_unlock(&hw->lock); ++ __atomic_store_n(&hns->hw.reset.resetting, 0, __ATOMIC_RELAXED); ++ hw->reset.stage = RESET_STAGE_NONE; ++ hns3_clock_gettime(&tv); ++ timersub(&tv, &hw->reset.start_time, &tv_delta); ++ hns3_warn(hw, "%s reset fail delta %" PRIu64 " ms time=%ld.%.6ld", ++ reset_string[hw->reset.level], ++ hns3_clock_calctime_ms(&tv_delta), ++ tv.tv_sec, tv.tv_usec); ++ hw->reset.level = HNS3_NONE_RESET; ++} ++ + /* + * There are three scenarios as follows: + * When the reset is not in progress, the reset process starts. +@@ -2784,7 +2815,6 @@ int + hns3_reset_process(struct hns3_adapter *hns, enum hns3_reset_level new_level) + { + struct hns3_hw *hw = &hns->hw; +- struct timeval tv_delta; + struct timeval tv; + int ret; + +@@ -2843,27 +2873,7 @@ hns3_reset_process(struct hns3_adapter *hns, enum hns3_reset_level new_level) + if (ret == -EAGAIN) + return ret; + err: +- hns3_clear_reset_level(hw, &hw->reset.pending); +- if (hns3_reset_err_handle(hns)) { +- hw->reset.stage = RESET_STAGE_PREWAIT; +- hns3_schedule_reset(hns); +- } else { +- rte_spinlock_lock(&hw->lock); +- if (hw->reset.mbuf_deferred_free) { +- hns3_dev_release_mbufs(hns); +- hw->reset.mbuf_deferred_free = false; +- } +- rte_spinlock_unlock(&hw->lock); +- __atomic_store_n(&hns->hw.reset.resetting, 0, __ATOMIC_RELAXED); +- hw->reset.stage = RESET_STAGE_NONE; +- hns3_clock_gettime(&tv); +- timersub(&tv, &hw->reset.start_time, &tv_delta); +- hns3_warn(hw, "%s reset fail delta %" PRIu64 " ms time=%ld.%.6ld", +- reset_string[hw->reset.level], +- hns3_clock_calctime_ms(&tv_delta), +- tv.tv_sec, tv.tv_usec); +- hw->reset.level = HNS3_NONE_RESET; +- } ++ hns3_reset_fail_handle(hns); + + return -EIO; + } +-- +2.33.0 + diff --git a/0027-net-hns3-fix-interrupt-resources-in-Rx-interrupt-mod.patch b/0027-net-hns3-fix-interrupt-resources-in-Rx-interrupt-mod.patch deleted file mode 100644 index f37c77d53d192d4a6a1113461beef8254440c91e..0000000000000000000000000000000000000000 --- a/0027-net-hns3-fix-interrupt-resources-in-Rx-interrupt-mod.patch +++ /dev/null @@ -1,244 +0,0 @@ -From 30c133006d7929fafad11a379fc18f3d23dc0178 Mon Sep 17 00:00:00 2001 -From: Chengchang Tang -Date: Fri, 22 Jan 2021 18:18:47 +0800 -Subject: [PATCH 027/189] net/hns3: fix interrupt resources in Rx interrupt - mode - -For Kunpeng930, the NIC engine support 1280 tqps being taken over by -a PF. In this case, a maximum of 1281 interrupt resources are also -supported in this PF. To support the maximum number of queues, several -patches are made. But the interrupt related modification are missing. -So, in RX interrupt mode, a large number of queues will be aggregated -into one interrupt due to insufficient interrupts. It will lead to -waste of interrupt resources and reduces usability. - -To utilize all these interrupt resources, related IMP command has been -extended. And, the I/O address of the extended interrupt resources are -different from the existing ones. So, a function used for calculating -the address offset has been added. - -Fixes: 76d794566d43 ("net/hns3: maximize queue number") -Fixes: 27911a6e62e5 ("net/hns3: add Rx interrupts compatibility") -Cc: stable@dpdk.org - -Signed-off-by: Chengchang Tang ---- - drivers/net/hns3/hns3_cmd.h | 8 ++++++-- - drivers/net/hns3/hns3_ethdev.c | 17 +++++++++-------- - drivers/net/hns3/hns3_regs.c | 2 +- - drivers/net/hns3/hns3_regs.h | 24 +++++++++++++++--------- - drivers/net/hns3/hns3_rxtx.c | 28 +++++++++++++++++++++++----- - drivers/net/hns3/hns3_rxtx.h | 1 + - 6 files changed, 55 insertions(+), 25 deletions(-) - -diff --git a/drivers/net/hns3/hns3_cmd.h b/drivers/net/hns3/hns3_cmd.h -index 6152f6e..dc97a1a 100644 ---- a/drivers/net/hns3/hns3_cmd.h -+++ b/drivers/net/hns3/hns3_cmd.h -@@ -776,12 +776,16 @@ enum hns3_int_gl_idx { - #define HNS3_TQP_ID_M GENMASK(12, 2) - #define HNS3_INT_GL_IDX_S 13 - #define HNS3_INT_GL_IDX_M GENMASK(14, 13) -+#define HNS3_TQP_INT_ID_L_S 0 -+#define HNS3_TQP_INT_ID_L_M GENMASK(7, 0) -+#define HNS3_TQP_INT_ID_H_S 8 -+#define HNS3_TQP_INT_ID_H_M GENMASK(15, 8) - struct hns3_ctrl_vector_chain_cmd { -- uint8_t int_vector_id; -+ uint8_t int_vector_id; /* the low order of the interrupt id */ - uint8_t int_cause_num; - uint16_t tqp_type_and_id[HNS3_VECTOR_ELEMENTS_PER_CMD]; - uint8_t vfid; -- uint8_t rsv; -+ uint8_t int_vector_id_h; /* the high order of the interrupt id */ - }; - - struct hns3_config_max_frm_size_cmd { -diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c -index 2a5689c..4356860 100644 ---- a/drivers/net/hns3/hns3_ethdev.c -+++ b/drivers/net/hns3/hns3_ethdev.c -@@ -2232,7 +2232,7 @@ hns3_check_dcb_cfg(struct rte_eth_dev *dev) - } - - static int --hns3_bind_ring_with_vector(struct hns3_hw *hw, uint8_t vector_id, bool mmap, -+hns3_bind_ring_with_vector(struct hns3_hw *hw, uint16_t vector_id, bool en, - enum hns3_ring_type queue_type, uint16_t queue_id) - { - struct hns3_cmd_desc desc; -@@ -2241,13 +2241,15 @@ hns3_bind_ring_with_vector(struct hns3_hw *hw, uint8_t vector_id, bool mmap, - enum hns3_cmd_status status; - enum hns3_opcode_type op; - uint16_t tqp_type_and_id = 0; -- const char *op_str; - uint16_t type; - uint16_t gl; - -- op = mmap ? HNS3_OPC_ADD_RING_TO_VECTOR : HNS3_OPC_DEL_RING_TO_VECTOR; -+ op = en ? HNS3_OPC_ADD_RING_TO_VECTOR : HNS3_OPC_DEL_RING_TO_VECTOR; - hns3_cmd_setup_basic_desc(&desc, op, false); -- req->int_vector_id = vector_id; -+ req->int_vector_id = hns3_get_field(vector_id, HNS3_TQP_INT_ID_L_M, -+ HNS3_TQP_INT_ID_L_S); -+ req->int_vector_id_h = hns3_get_field(vector_id, HNS3_TQP_INT_ID_H_M, -+ HNS3_TQP_INT_ID_H_S); - - if (queue_type == HNS3_RING_TYPE_RX) - gl = HNS3_RING_GL_RX; -@@ -2263,11 +2265,10 @@ hns3_bind_ring_with_vector(struct hns3_hw *hw, uint8_t vector_id, bool mmap, - gl); - req->tqp_type_and_id[0] = rte_cpu_to_le_16(tqp_type_and_id); - req->int_cause_num = 1; -- op_str = mmap ? "Map" : "Unmap"; - status = hns3_cmd_send(hw, &desc, 1); - if (status) { - hns3_err(hw, "%s TQP %u fail, vector_id is %u, status is %d.", -- op_str, queue_id, req->int_vector_id, status); -+ en ? "Map" : "Unmap", queue_id, vector_id, status); - return status; - } - -@@ -4797,8 +4798,8 @@ hns3_map_rx_interrupt(struct rte_eth_dev *dev) - struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev); - struct rte_intr_handle *intr_handle = &pci_dev->intr_handle; - struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private); -- uint8_t base = RTE_INTR_VEC_ZERO_OFFSET; -- uint8_t vec = RTE_INTR_VEC_ZERO_OFFSET; -+ uint16_t base = RTE_INTR_VEC_ZERO_OFFSET; -+ uint16_t vec = RTE_INTR_VEC_ZERO_OFFSET; - uint32_t intr_vector; - uint16_t q_id; - int ret; -diff --git a/drivers/net/hns3/hns3_regs.c b/drivers/net/hns3/hns3_regs.c -index f2cb465..8afe132 100644 ---- a/drivers/net/hns3/hns3_regs.c -+++ b/drivers/net/hns3/hns3_regs.c -@@ -301,7 +301,7 @@ hns3_direct_access_regs(struct hns3_hw *hw, uint32_t *data) - - reg_num = sizeof(tqp_intr_reg_addrs) / sizeof(uint32_t); - for (j = 0; j < hw->intr_tqps_num; j++) { -- reg_offset = HNS3_TQP_INTR_REG_SIZE * j; -+ reg_offset = hns3_get_tqp_intr_reg_offset(j); - for (i = 0; i < reg_num; i++) - *data++ = hns3_read_dev(hw, tqp_intr_reg_addrs[i] + - reg_offset); -diff --git a/drivers/net/hns3/hns3_regs.h b/drivers/net/hns3/hns3_regs.h -index 81a0af5..39fc5d1 100644 ---- a/drivers/net/hns3/hns3_regs.h -+++ b/drivers/net/hns3/hns3_regs.h -@@ -95,15 +95,21 @@ - #define HNS3_MIN_EXTEND_QUEUE_ID 1024 - - /* bar registers for tqp interrupt */ --#define HNS3_TQP_INTR_CTRL_REG 0x20000 --#define HNS3_TQP_INTR_GL0_REG 0x20100 --#define HNS3_TQP_INTR_GL1_REG 0x20200 --#define HNS3_TQP_INTR_GL2_REG 0x20300 --#define HNS3_TQP_INTR_RL_REG 0x20900 --#define HNS3_TQP_INTR_TX_QL_REG 0x20e00 --#define HNS3_TQP_INTR_RX_QL_REG 0x20f00 -- --#define HNS3_TQP_INTR_REG_SIZE 4 -+#define HNS3_TQP_INTR_REG_BASE 0x20000 -+#define HNS3_TQP_INTR_EXT_REG_BASE 0x30000 -+#define HNS3_TQP_INTR_CTRL_REG 0 -+#define HNS3_TQP_INTR_GL0_REG 0x100 -+#define HNS3_TQP_INTR_GL1_REG 0x200 -+#define HNS3_TQP_INTR_GL2_REG 0x300 -+#define HNS3_TQP_INTR_RL_REG 0x900 -+#define HNS3_TQP_INTR_TX_QL_REG 0xe00 -+#define HNS3_TQP_INTR_RX_QL_REG 0xf00 -+#define HNS3_TQP_INTR_RL_EN_B 6 -+ -+#define HNS3_MIN_EXT_TQP_INTR_ID 64 -+#define HNS3_TQP_INTR_LOW_ORDER_OFFSET 0x4 -+#define HNS3_TQP_INTR_HIGH_ORDER_OFFSET 0x1000 -+ - #define HNS3_TQP_INTR_GL_MAX 0x1FE0 - #define HNS3_TQP_INTR_GL_DEFAULT 20 - #define HNS3_TQP_INTR_GL_UNIT_1US BIT(31) -diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c -index 30f1e06..1991b4e 100644 ---- a/drivers/net/hns3/hns3_rxtx.c -+++ b/drivers/net/hns3/hns3_rxtx.c -@@ -834,6 +834,24 @@ hns3_reset_queue(struct hns3_hw *hw, uint16_t queue_id, - return ret; - } - -+uint32_t -+hns3_get_tqp_intr_reg_offset(uint16_t tqp_intr_id) -+{ -+ uint32_t reg_offset; -+ -+ /* Need an extend offset to config queues > 64 */ -+ if (tqp_intr_id < HNS3_MIN_EXT_TQP_INTR_ID) -+ reg_offset = HNS3_TQP_INTR_REG_BASE + -+ tqp_intr_id * HNS3_TQP_INTR_LOW_ORDER_OFFSET; -+ else -+ reg_offset = HNS3_TQP_INTR_EXT_REG_BASE + -+ tqp_intr_id / HNS3_MIN_EXT_TQP_INTR_ID * -+ HNS3_TQP_INTR_HIGH_ORDER_OFFSET + -+ tqp_intr_id % HNS3_MIN_EXT_TQP_INTR_ID * -+ HNS3_TQP_INTR_LOW_ORDER_OFFSET; -+ -+ return reg_offset; -+} - - void - hns3_set_queue_intr_gl(struct hns3_hw *hw, uint16_t queue_id, -@@ -847,7 +865,7 @@ hns3_set_queue_intr_gl(struct hns3_hw *hw, uint16_t queue_id, - if (gl_idx >= RTE_DIM(offset) || gl_value > HNS3_TQP_INTR_GL_MAX) - return; - -- addr = offset[gl_idx] + queue_id * HNS3_TQP_INTR_REG_SIZE; -+ addr = offset[gl_idx] + hns3_get_tqp_intr_reg_offset(queue_id); - if (hw->intr.gl_unit == HNS3_INTR_COALESCE_GL_UINT_1US) - value = gl_value | HNS3_TQP_INTR_GL_UNIT_1US; - else -@@ -864,7 +882,7 @@ hns3_set_queue_intr_rl(struct hns3_hw *hw, uint16_t queue_id, uint16_t rl_value) - if (rl_value > HNS3_TQP_INTR_RL_MAX) - return; - -- addr = HNS3_TQP_INTR_RL_REG + queue_id * HNS3_TQP_INTR_REG_SIZE; -+ addr = HNS3_TQP_INTR_RL_REG + hns3_get_tqp_intr_reg_offset(queue_id); - value = HNS3_RL_USEC_TO_REG(rl_value); - if (value > 0) - value |= HNS3_TQP_INTR_RL_ENABLE_MASK; -@@ -885,10 +903,10 @@ hns3_set_queue_intr_ql(struct hns3_hw *hw, uint16_t queue_id, uint16_t ql_value) - if (hw->intr.int_ql_max == HNS3_INTR_QL_NONE) - return; - -- addr = HNS3_TQP_INTR_TX_QL_REG + queue_id * HNS3_TQP_INTR_REG_SIZE; -+ addr = HNS3_TQP_INTR_TX_QL_REG + hns3_get_tqp_intr_reg_offset(queue_id); - hns3_write_dev(hw, addr, ql_value); - -- addr = HNS3_TQP_INTR_RX_QL_REG + queue_id * HNS3_TQP_INTR_REG_SIZE; -+ addr = HNS3_TQP_INTR_RX_QL_REG + hns3_get_tqp_intr_reg_offset(queue_id); - hns3_write_dev(hw, addr, ql_value); - } - -@@ -897,7 +915,7 @@ hns3_queue_intr_enable(struct hns3_hw *hw, uint16_t queue_id, bool en) - { - uint32_t addr, value; - -- addr = HNS3_TQP_INTR_CTRL_REG + queue_id * HNS3_TQP_INTR_REG_SIZE; -+ addr = HNS3_TQP_INTR_CTRL_REG + hns3_get_tqp_intr_reg_offset(queue_id); - value = en ? 1 : 0; - - hns3_write_dev(hw, addr, value); -diff --git a/drivers/net/hns3/hns3_rxtx.h b/drivers/net/hns3/hns3_rxtx.h -index 331b507..8f5ae5c 100644 ---- a/drivers/net/hns3/hns3_rxtx.h -+++ b/drivers/net/hns3/hns3_rxtx.h -@@ -680,6 +680,7 @@ int hns3_tx_burst_mode_get(struct rte_eth_dev *dev, - const uint32_t *hns3_dev_supported_ptypes_get(struct rte_eth_dev *dev); - void hns3_init_rx_ptype_tble(struct rte_eth_dev *dev); - void hns3_set_rxtx_function(struct rte_eth_dev *eth_dev); -+uint32_t hns3_get_tqp_intr_reg_offset(uint16_t tqp_intr_id); - void hns3_set_queue_intr_gl(struct hns3_hw *hw, uint16_t queue_id, - uint8_t gl_idx, uint16_t gl_value); - void hns3_set_queue_intr_rl(struct hns3_hw *hw, uint16_t queue_id, --- -2.7.4 - diff --git a/0028-net-hns3-remove-unused-variables.patch b/0028-net-hns3-remove-unused-variables.patch new file mode 100644 index 0000000000000000000000000000000000000000..b913c6093c79e2698935f19b60b7534a08a93ed3 --- /dev/null +++ b/0028-net-hns3-remove-unused-variables.patch @@ -0,0 +1,77 @@ +From a65941e9c461bfc050778ed318a90e621d903163 Mon Sep 17 00:00:00 2001 +From: Huisong Li +Date: Sat, 22 Jan 2022 09:51:34 +0800 +Subject: [PATCH] net/hns3: remove unused variables + +Remove unused variables. + +Signed-off-by: Huisong Li +Acked-by: Min Hu (Connor) +--- + drivers/net/hns3/hns3_dcb.c | 12 +----------- + drivers/net/hns3/hns3_ethdev.c | 3 --- + drivers/net/hns3/hns3_ethdev.h | 2 -- + 3 files changed, 1 insertion(+), 16 deletions(-) + +diff --git a/drivers/net/hns3/hns3_dcb.c b/drivers/net/hns3/hns3_dcb.c +index e4417e87fd..73693786d1 100644 +--- a/drivers/net/hns3/hns3_dcb.c ++++ b/drivers/net/hns3/hns3_dcb.c +@@ -750,19 +750,9 @@ static int + hns3_dcb_update_tc_queue_mapping(struct hns3_hw *hw, uint16_t nb_rx_q, + uint16_t nb_tx_q) + { +- struct hns3_adapter *hns = HNS3_DEV_HW_TO_ADAPTER(hw); +- struct hns3_pf *pf = &hns->pf; +- int ret; +- + hw->num_tc = hw->dcb_info.num_tc; +- ret = hns3_queue_to_tc_mapping(hw, nb_rx_q, nb_tx_q); +- if (ret) +- return ret; + +- if (!hns->is_vf) +- memcpy(pf->prio_tc, hw->dcb_info.prio_tc, HNS3_MAX_USER_PRIO); +- +- return 0; ++ return hns3_queue_to_tc_mapping(hw, nb_rx_q, nb_tx_q); + } + + int +diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c +index 0f6d238f6f..90eb6340a9 100644 +--- a/drivers/net/hns3/hns3_ethdev.c ++++ b/drivers/net/hns3/hns3_ethdev.c +@@ -2546,9 +2546,6 @@ hns3_parse_cfg(struct hns3_cfg *cfg, struct hns3_cmd_desc *desc) + cfg->media_type = hns3_get_field(rte_le_to_cpu_32(req->param[1]), + HNS3_CFG_MEDIA_TP_M, + HNS3_CFG_MEDIA_TP_S); +- cfg->rx_buf_len = hns3_get_field(rte_le_to_cpu_32(req->param[1]), +- HNS3_CFG_RX_BUF_LEN_M, +- HNS3_CFG_RX_BUF_LEN_S); + /* get mac address */ + mac_addr_tmp = rte_le_to_cpu_32(req->param[2]); + mac_addr_tmp_high = hns3_get_field(rte_le_to_cpu_32(req->param[3]), +diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h +index 153e67337f..1dd388625b 100644 +--- a/drivers/net/hns3/hns3_ethdev.h ++++ b/drivers/net/hns3/hns3_ethdev.h +@@ -156,7 +156,6 @@ struct hns3_tc_queue_info { + struct hns3_cfg { + uint8_t tc_num; + uint16_t tqp_desc_num; +- uint16_t rx_buf_len; + uint16_t rss_size_max; + uint8_t phy_addr; + uint8_t media_type; +@@ -804,7 +803,6 @@ struct hns3_pf { + uint8_t tc_max; /* max number of tc driver supported */ + uint8_t local_max_tc; /* max number of local tc */ + uint8_t pfc_max; +- uint8_t prio_tc[HNS3_MAX_USER_PRIO]; /* TC indexed by prio */ + uint16_t pause_time; + bool support_fc_autoneg; /* support FC autonegotiate */ + bool support_multi_tc_pause; +-- +2.33.0 + diff --git a/0028-net-hns3-rename-RSS-functions.patch b/0028-net-hns3-rename-RSS-functions.patch deleted file mode 100644 index f971195d51c26e07ca14f3ea6bfb4c6497524c8b..0000000000000000000000000000000000000000 --- a/0028-net-hns3-rename-RSS-functions.patch +++ /dev/null @@ -1,137 +0,0 @@ -From 65ffb8730c023e703e90dfefde782d1b70e830bf Mon Sep 17 00:00:00 2001 -From: Lijun Ou -Date: Fri, 22 Jan 2021 18:18:48 +0800 -Subject: [PATCH 028/189] net/hns3: rename RSS functions - -Rename some function about RSS implement functions -in order to make the functions naming style more -reasonable and consistency. - -Signed-off-by: Lijun Ou ---- - drivers/net/hns3/hns3_ethdev.c | 2 +- - drivers/net/hns3/hns3_ethdev_vf.c | 2 +- - drivers/net/hns3/hns3_flow.c | 2 +- - drivers/net/hns3/hns3_rss.c | 12 ++++++------ - drivers/net/hns3/hns3_rss.h | 4 ++-- - 5 files changed, 11 insertions(+), 11 deletions(-) - -diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c -index 4356860..94b6e44 100644 ---- a/drivers/net/hns3/hns3_ethdev.c -+++ b/drivers/net/hns3/hns3_ethdev.c -@@ -4685,7 +4685,7 @@ hns3_init_pf(struct rte_eth_dev *eth_dev) - goto err_fdir; - } - -- hns3_set_default_rss_args(hw); -+ hns3_rss_set_default_args(hw); - - ret = hns3_enable_hw_error_intr(hns, true); - if (ret) { -diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c -index 948d914..7eb0b11 100644 ---- a/drivers/net/hns3/hns3_ethdev_vf.c -+++ b/drivers/net/hns3/hns3_ethdev_vf.c -@@ -1832,7 +1832,7 @@ hns3vf_init_vf(struct rte_eth_dev *eth_dev) - if (ret) - goto err_set_tc_queue; - -- hns3_set_default_rss_args(hw); -+ hns3_rss_set_default_args(hw); - - return 0; - -diff --git a/drivers/net/hns3/hns3_flow.c b/drivers/net/hns3/hns3_flow.c -index 9b161f4..8a5179d 100644 ---- a/drivers/net/hns3/hns3_flow.c -+++ b/drivers/net/hns3/hns3_flow.c -@@ -1469,7 +1469,7 @@ hns3_hw_rss_hash_set(struct hns3_hw *hw, struct rte_flow_action_rss *rss_config) - if (ret) - return ret; - -- ret = hns3_set_rss_algo_key(hw, rss_config->key); -+ ret = hns3_rss_set_algo_key(hw, rss_config->key); - if (ret) - return ret; - -diff --git a/drivers/net/hns3/hns3_rss.c b/drivers/net/hns3/hns3_rss.c -index b5df374..7d1a297 100644 ---- a/drivers/net/hns3/hns3_rss.c -+++ b/drivers/net/hns3/hns3_rss.c -@@ -193,7 +193,7 @@ static const struct { - * Used to set algorithm, key_offset and hash key of rss. - */ - int --hns3_set_rss_algo_key(struct hns3_hw *hw, const uint8_t *key) -+hns3_rss_set_algo_key(struct hns3_hw *hw, const uint8_t *key) - { - #define HNS3_KEY_OFFSET_MAX 3 - #define HNS3_SET_HASH_KEY_BYTE_FOUR 2 -@@ -245,7 +245,7 @@ hns3_set_rss_algo_key(struct hns3_hw *hw, const uint8_t *key) - * Used to configure the tuple selection for RSS hash input. - */ - static int --hns3_set_rss_input_tuple(struct hns3_hw *hw) -+hns3_rss_set_input_tuple(struct hns3_hw *hw) - { - struct hns3_rss_conf *rss_config = &hw->rss_info; - struct hns3_rss_input_tuple_cmd *req; -@@ -443,7 +443,7 @@ hns3_dev_rss_hash_update(struct rte_eth_dev *dev, - ret = -EINVAL; - goto conf_err; - } -- ret = hns3_set_rss_algo_key(hw, key); -+ ret = hns3_rss_set_algo_key(hw, key); - if (ret) - goto conf_err; - } -@@ -649,7 +649,7 @@ hns3_rss_tuple_uninit(struct hns3_hw *hw) - * Set the default rss configuration in the init of driver. - */ - void --hns3_set_default_rss_args(struct hns3_hw *hw) -+hns3_rss_set_default_args(struct hns3_hw *hw) - { - struct hns3_rss_conf *rss_cfg = &hw->rss_info; - uint16_t queue_num = hw->alloc_rss_size; -@@ -696,12 +696,12 @@ hns3_config_rss(struct hns3_adapter *hns) - hns3_rss_uninit(hns); - - /* Configure RSS hash algorithm and hash key offset */ -- ret = hns3_set_rss_algo_key(hw, hash_key); -+ ret = hns3_rss_set_algo_key(hw, hash_key); - if (ret) - return ret; - - /* Configure the tuple selection for RSS hash input */ -- ret = hns3_set_rss_input_tuple(hw); -+ ret = hns3_rss_set_input_tuple(hw); - if (ret) - return ret; - -diff --git a/drivers/net/hns3/hns3_rss.h b/drivers/net/hns3/hns3_rss.h -index 6d1d25f..05d5c26 100644 ---- a/drivers/net/hns3/hns3_rss.h -+++ b/drivers/net/hns3/hns3_rss.h -@@ -102,7 +102,7 @@ int hns3_dev_rss_reta_update(struct rte_eth_dev *dev, - int hns3_dev_rss_reta_query(struct rte_eth_dev *dev, - struct rte_eth_rss_reta_entry64 *reta_conf, - uint16_t reta_size); --void hns3_set_default_rss_args(struct hns3_hw *hw); -+void hns3_rss_set_default_args(struct hns3_hw *hw); - int hns3_set_rss_indir_table(struct hns3_hw *hw, uint16_t *indir, - uint16_t size); - int hns3_rss_reset_indir_table(struct hns3_hw *hw); -@@ -111,7 +111,7 @@ void hns3_rss_uninit(struct hns3_adapter *hns); - int hns3_set_rss_tuple_by_rss_hf(struct hns3_hw *hw, - struct hns3_rss_tuple_cfg *tuple, - uint64_t rss_hf); --int hns3_set_rss_algo_key(struct hns3_hw *hw, const uint8_t *key); -+int hns3_rss_set_algo_key(struct hns3_hw *hw, const uint8_t *key); - int hns3_restore_rss_filter(struct rte_eth_dev *dev); - - #endif /* _HNS3_RSS_H_ */ --- -2.7.4 - diff --git a/0029-net-hns3-adjust-some-comments.patch b/0029-net-hns3-adjust-some-comments.patch deleted file mode 100644 index 6a641230c368275317ba59cfa6bfc7b377bbb19d..0000000000000000000000000000000000000000 --- a/0029-net-hns3-adjust-some-comments.patch +++ /dev/null @@ -1,98 +0,0 @@ -From 2cfeae90323331be6a395bae314e170bfb3ff3b2 Mon Sep 17 00:00:00 2001 -From: Lijun Ou -Date: Fri, 22 Jan 2021 18:18:49 +0800 -Subject: [PATCH 029/189] net/hns3: adjust some comments - -Fix some error comments and remove some meaningless comments. - -Fixes: f8e7fcbfd0b8 ("net/hns3: support flow action of queue region") -Fixes: fcba820d9b9e ("net/hns3: support flow director") -Fixes: c37ca66f2b27 ("net/hns3: support RSS") -Fixes: ec674cb742e5 ("net/hns3: fix flushing RSS rule") -Cc: stable@dpdk.org - -Signed-off-by: Lijun Ou ---- - drivers/net/hns3/hns3_flow.c | 19 ++++++++----------- - 1 file changed, 8 insertions(+), 11 deletions(-) - -diff --git a/drivers/net/hns3/hns3_flow.c b/drivers/net/hns3/hns3_flow.c -index 8a5179d..f2bff1e 100644 ---- a/drivers/net/hns3/hns3_flow.c -+++ b/drivers/net/hns3/hns3_flow.c -@@ -91,9 +91,9 @@ net_addr_to_host(uint32_t *dst, const rte_be32_t *src, size_t len) - /* - * This function is used to find rss general action. - * 1. As we know RSS is used to spread packets among several queues, the flow -- * API provide the struct rte_flow_action_rss, user could config it's field -+ * API provide the struct rte_flow_action_rss, user could config its field - * sush as: func/level/types/key/queue to control RSS function. -- * 2. The flow API also support queue region configuration for hns3. It was -+ * 2. The flow API also supports queue region configuration for hns3. It was - * implemented by FDIR + RSS in hns3 hardware, user can create one FDIR rule - * which action is RSS queues region. - * 3. When action is RSS, we use the following rule to distinguish: -@@ -128,11 +128,11 @@ hns3_find_rss_general_action(const struct rte_flow_item pattern[], - rss = act->conf; - if (have_eth && rss->conf.queue_num) { - /* -- * Patter have ETH and action's queue_num > 0, indicate this is -+ * Pattern have ETH and action's queue_num > 0, indicate this is - * queue region configuration. - * Because queue region is implemented by FDIR + RSS in hns3 -- * hardware, it need enter FDIR process, so here return NULL to -- * avoid enter RSS process. -+ * hardware, it needs to enter FDIR process, so here return NULL -+ * to avoid enter RSS process. - */ - return NULL; - } -@@ -405,7 +405,6 @@ hns3_handle_actions(struct rte_eth_dev *dev, - return 0; - } - --/* Parse to get the attr and action info of flow director rule. */ - static int - hns3_check_attr(const struct rte_flow_attr *attr, struct rte_flow_error *error) - { -@@ -782,7 +781,7 @@ hns3_parse_sctp(const struct rte_flow_item *item, struct hns3_fdir_rule *rule, - } - - /* -- * Check items before tunnel, save inner configs to outer configs,and clear -+ * Check items before tunnel, save inner configs to outer configs, and clear - * inner configs. - * The key consists of two parts: meta_data and tuple keys. - * Meta data uses 15 bits, including vlan_num(2bit), des_port(12bit) and tunnel -@@ -1473,10 +1472,8 @@ hns3_hw_rss_hash_set(struct hns3_hw *hw, struct rte_flow_action_rss *rss_config) - if (ret) - return ret; - -- /* Update algorithm of hw */ - hw->rss_info.conf.func = rss_config->func; - -- /* Set flow type supported */ - tuple = &hw->rss_info.rss_tuple_sets; - ret = hns3_set_rss_tuple_by_rss_hf(hw, tuple, rss_config->types); - if (ret) -@@ -1561,7 +1558,7 @@ hns3_config_rss_filter(struct rte_eth_dev *dev, - if (rss_flow_conf.queue_num) { - /* - * Due the content of queue pointer have been reset to -- * 0, the rss_info->conf.queue should be set NULL -+ * 0, the rss_info->conf.queue should be set to NULL - */ - rss_info->conf.queue = NULL; - rss_info->conf.queue_num = 0; -@@ -1727,7 +1724,7 @@ hns3_flow_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, - /* - * Create or destroy a flow rule. - * Theorically one rule can match more than one filters. -- * We will let it use the filter which it hitt first. -+ * We will let it use the filter which it hit first. - * So, the sequence matters. - */ - static struct rte_flow * --- -2.7.4 - diff --git a/0029-net-hns3-remove-getting-number-of-queue-descriptors-.patch b/0029-net-hns3-remove-getting-number-of-queue-descriptors-.patch new file mode 100644 index 0000000000000000000000000000000000000000..ddb9a476ea535b6dfdd955f02040661d019a5bd8 --- /dev/null +++ b/0029-net-hns3-remove-getting-number-of-queue-descriptors-.patch @@ -0,0 +1,107 @@ +From af1f62b3d1e6bf12830facbb0161981bdce6685d Mon Sep 17 00:00:00 2001 +From: Huisong Li +Date: Sat, 22 Jan 2022 09:51:35 +0800 +Subject: [PATCH] net/hns3: remove getting number of queue descriptors from FW + +Application can specify the number of Rx/Tx queue descriptors in DPDK. +So driver does not obtain the default value from firmware and PF. + +Signed-off-by: Huisong Li +Acked-by: Min Hu (Connor) +--- + drivers/net/hns3/hns3_ethdev.c | 5 ----- + drivers/net/hns3/hns3_ethdev.h | 3 --- + drivers/net/hns3/hns3_ethdev_vf.c | 26 -------------------------- + 3 files changed, 34 deletions(-) + +diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c +index 90eb6340a9..aa9301c561 100644 +--- a/drivers/net/hns3/hns3_ethdev.c ++++ b/drivers/net/hns3/hns3_ethdev.c +@@ -2536,9 +2536,6 @@ hns3_parse_cfg(struct hns3_cfg *cfg, struct hns3_cmd_desc *desc) + /* get the configuration */ + cfg->tc_num = hns3_get_field(rte_le_to_cpu_32(req->param[0]), + HNS3_CFG_TC_NUM_M, HNS3_CFG_TC_NUM_S); +- cfg->tqp_desc_num = hns3_get_field(rte_le_to_cpu_32(req->param[0]), +- HNS3_CFG_TQP_DESC_N_M, +- HNS3_CFG_TQP_DESC_N_S); + + cfg->phy_addr = hns3_get_field(rte_le_to_cpu_32(req->param[1]), + HNS3_CFG_PHY_ADDR_M, +@@ -2849,8 +2846,6 @@ hns3_get_board_configuration(struct hns3_hw *hw) + hw->rss_dis_flag = false; + memcpy(hw->mac.mac_addr, cfg.mac_addr, RTE_ETHER_ADDR_LEN); + hw->mac.phy_addr = cfg.phy_addr; +- hw->num_tx_desc = cfg.tqp_desc_num; +- hw->num_rx_desc = cfg.tqp_desc_num; + hw->dcb_info.num_pg = 1; + hw->dcb_info.hw_pfc_map = 0; + +diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h +index 1dd388625b..cf6380ebb2 100644 +--- a/drivers/net/hns3/hns3_ethdev.h ++++ b/drivers/net/hns3/hns3_ethdev.h +@@ -155,7 +155,6 @@ struct hns3_tc_queue_info { + + struct hns3_cfg { + uint8_t tc_num; +- uint16_t tqp_desc_num; + uint16_t rss_size_max; + uint8_t phy_addr; + uint8_t media_type; +@@ -512,8 +511,6 @@ struct hns3_hw { + uint16_t intr_tqps_num; /* num queue pairs mapping interrupt */ + uint16_t rss_size_max; /* HW defined max RSS task queue */ + uint16_t rx_buf_len; /* hold min hardware rx buf len */ +- uint16_t num_tx_desc; /* desc num of per tx queue */ +- uint16_t num_rx_desc; /* desc num of per rx queue */ + uint32_t mng_entry_num; /* number of manager table entry */ + uint32_t mac_entry_num; /* number of mac-vlan table entry */ + +diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c +index 5a1286e17b..36d860d08a 100644 +--- a/drivers/net/hns3/hns3_ethdev_vf.c ++++ b/drivers/net/hns3/hns3_ethdev_vf.c +@@ -941,27 +941,6 @@ hns3vf_get_queue_info(struct hns3_hw *hw) + return hns3vf_check_tqp_info(hw); + } + +-static int +-hns3vf_get_queue_depth(struct hns3_hw *hw) +-{ +-#define HNS3VF_TQPS_DEPTH_INFO_LEN 4 +- uint8_t resp_msg[HNS3VF_TQPS_DEPTH_INFO_LEN]; +- int ret; +- +- ret = hns3_send_mbx_msg(hw, HNS3_MBX_GET_QDEPTH, 0, NULL, 0, true, +- resp_msg, HNS3VF_TQPS_DEPTH_INFO_LEN); +- if (ret) { +- PMD_INIT_LOG(ERR, "Failed to get tqp depth info from PF: %d", +- ret); +- return ret; +- } +- +- memcpy(&hw->num_tx_desc, &resp_msg[0], sizeof(uint16_t)); +- memcpy(&hw->num_rx_desc, &resp_msg[2], sizeof(uint16_t)); +- +- return 0; +-} +- + static void + hns3vf_update_caps(struct hns3_hw *hw, uint32_t caps) + { +@@ -1052,11 +1031,6 @@ hns3vf_get_configuration(struct hns3_hw *hw) + if (ret) + return ret; + +- /* Get queue depth info from PF */ +- ret = hns3vf_get_queue_depth(hw); +- if (ret) +- return ret; +- + /* Get user defined VF MAC addr from PF */ + ret = hns3vf_get_host_mac_addr(hw); + if (ret) +-- +2.33.0 + diff --git a/0030-net-hns3-remove-logging-memory-addresses.patch b/0030-net-hns3-remove-logging-memory-addresses.patch new file mode 100644 index 0000000000000000000000000000000000000000..533ba28e1ba3f3d9cd79a972c4932edd2a140f9a --- /dev/null +++ b/0030-net-hns3-remove-logging-memory-addresses.patch @@ -0,0 +1,79 @@ +From 5608b54756d91505e66e58c2562601b3f7e2fe80 Mon Sep 17 00:00:00 2001 +From: Huisong Li +Date: Sat, 22 Jan 2022 09:51:36 +0800 +Subject: [PATCH] net/hns3: remove logging memory addresses + +Remove the printing of memory addresses. + +Signed-off-by: Huisong Li +Acked-by: Min Hu (Connor) +--- + drivers/net/hns3/hns3_cmd.c | 12 ++++-------- + drivers/net/hns3/hns3_rxtx.c | 6 ------ + 2 files changed, 4 insertions(+), 14 deletions(-) + +diff --git a/drivers/net/hns3/hns3_cmd.c b/drivers/net/hns3/hns3_cmd.c +index 5b42d38aa5..5dc874fd7a 100644 +--- a/drivers/net/hns3/hns3_cmd.c ++++ b/drivers/net/hns3/hns3_cmd.c +@@ -60,18 +60,14 @@ hns3_allocate_dma_mem(struct hns3_hw *hw, struct hns3_cmq_ring *ring, + ring->desc = mz->addr; + ring->desc_dma_addr = mz->iova; + ring->zone = (const void *)mz; +- hns3_dbg(hw, "memzone %s allocated with physical address: %" PRIu64, +- mz->name, ring->desc_dma_addr); ++ hns3_dbg(hw, "cmd ring memzone name: %s", mz->name); + + return 0; + } + + static void +-hns3_free_dma_mem(struct hns3_hw *hw, struct hns3_cmq_ring *ring) ++hns3_free_dma_mem(struct hns3_cmq_ring *ring) + { +- hns3_dbg(hw, "memzone %s to be freed with physical address: %" PRIu64, +- ((const struct rte_memzone *)ring->zone)->name, +- ring->desc_dma_addr); + rte_memzone_free((const struct rte_memzone *)ring->zone); + ring->buf_size = 0; + ring->desc = NULL; +@@ -93,10 +89,10 @@ hns3_alloc_cmd_desc(struct hns3_hw *hw, struct hns3_cmq_ring *ring) + } + + static void +-hns3_free_cmd_desc(struct hns3_hw *hw, struct hns3_cmq_ring *ring) ++hns3_free_cmd_desc(__rte_unused struct hns3_hw *hw, struct hns3_cmq_ring *ring) + { + if (ring->desc) +- hns3_free_dma_mem(hw, ring); ++ hns3_free_dma_mem(ring); + } + + static int +diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c +index c43131cac6..3b72c2375a 100644 +--- a/drivers/net/hns3/hns3_rxtx.c ++++ b/drivers/net/hns3/hns3_rxtx.c +@@ -1382,9 +1382,6 @@ hns3_alloc_rxq_and_dma_zone(struct rte_eth_dev *dev, + rxq->rx_ring = (struct hns3_desc *)rx_mz->addr; + rxq->rx_ring_phys_addr = rx_mz->iova; + +- hns3_dbg(hw, "No.%u rx descriptors iova 0x%" PRIx64, q_info->idx, +- rxq->rx_ring_phys_addr); +- + return rxq; + } + +@@ -1469,9 +1466,6 @@ hns3_alloc_txq_and_dma_zone(struct rte_eth_dev *dev, + txq->tx_ring = (struct hns3_desc *)tx_mz->addr; + txq->tx_ring_phys_addr = tx_mz->iova; + +- hns3_dbg(hw, "No.%u tx descriptors iova 0x%" PRIx64, q_info->idx, +- txq->tx_ring_phys_addr); +- + /* Clear tx bd */ + desc = txq->tx_ring; + for (i = 0; i < txq->nb_tx_desc; i++) { +-- +2.33.0 + diff --git a/0030-net-hns3-remove-unnecessary-parentheses.patch b/0030-net-hns3-remove-unnecessary-parentheses.patch deleted file mode 100644 index 064dc97523fdf0e26d83a82e37db75af3529d8c6..0000000000000000000000000000000000000000 --- a/0030-net-hns3-remove-unnecessary-parentheses.patch +++ /dev/null @@ -1,45 +0,0 @@ -From d7fa7d59733c34f7d8083a6567ca8a0e3efb1fb6 Mon Sep 17 00:00:00 2001 -From: Lijun Ou -Date: Fri, 22 Jan 2021 18:18:50 +0800 -Subject: [PATCH 030/189] net/hns3: remove unnecessary parentheses - -Remove unnecessary parentheses as well as keep a reasonable -blank line. - -Signed-off-by: Lijun Ou ---- - drivers/net/hns3/hns3_flow.c | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - -diff --git a/drivers/net/hns3/hns3_flow.c b/drivers/net/hns3/hns3_flow.c -index f2bff1e..e9d0a0b 100644 ---- a/drivers/net/hns3/hns3_flow.c -+++ b/drivers/net/hns3/hns3_flow.c -@@ -700,6 +700,7 @@ hns3_parse_udp(const struct rte_flow_item *item, struct hns3_fdir_rule *rule, - hns3_set_bit(rule->input_set, INNER_IP_PROTO, 1); - rule->key_conf.spec.ip_proto = IPPROTO_UDP; - rule->key_conf.mask.ip_proto = IPPROTO_MASK; -+ - /* Only used to describe the protocol stack. */ - if (item->spec == NULL && item->mask == NULL) - return 0; -@@ -1264,7 +1265,7 @@ hns3_action_rss_same(const struct rte_flow_action_rss *comp, - if (comp->func == RTE_ETH_HASH_FUNCTION_MAX) - func_is_same = false; - else -- func_is_same = (with->func ? (comp->func == with->func) : true); -+ func_is_same = with->func ? (comp->func == with->func) : true; - - return (func_is_same && - comp->types == (with->types & HNS3_ETH_RSS_SUPPORT) && -@@ -1861,6 +1862,7 @@ hns3_flow_destroy(struct rte_eth_dev *dev, struct rte_flow *flow, - return rte_flow_error_set(error, EINVAL, - RTE_FLOW_ERROR_TYPE_HANDLE, - flow, "Flow is NULL"); -+ - filter_type = flow->filter_type; - switch (filter_type) { - case RTE_ETH_FILTER_FDIR: --- -2.7.4 - diff --git a/0031-net-hns3-adjust-format-specifier-for-enum.patch b/0031-net-hns3-adjust-format-specifier-for-enum.patch deleted file mode 100644 index 1409236741a7dc96efed7f2d891e5e652d1c354a..0000000000000000000000000000000000000000 --- a/0031-net-hns3-adjust-format-specifier-for-enum.patch +++ /dev/null @@ -1,31 +0,0 @@ -From dc8b97b9ef327bcb295bc7a2d2e4ffaaca6ba1f0 Mon Sep 17 00:00:00 2001 -From: Lijun Ou -Date: Fri, 22 Jan 2021 18:18:51 +0800 -Subject: [PATCH 031/189] net/hns3: adjust format specifier for enum - -Here uses %d as printing output for enumeration member. - -Fixes: c37ca66f2b27 ("net/hns3: support RSS") -Cc: stable@dpdk.org - -Signed-off-by: Lijun Ou ---- - drivers/net/hns3/hns3_flow.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/drivers/net/hns3/hns3_flow.c b/drivers/net/hns3/hns3_flow.c -index e9d0a0b..3e387ac 100644 ---- a/drivers/net/hns3/hns3_flow.c -+++ b/drivers/net/hns3/hns3_flow.c -@@ -1447,7 +1447,7 @@ hns3_parse_rss_algorithm(struct hns3_hw *hw, enum rte_eth_hash_function *func, - *hash_algo = HNS3_RSS_HASH_ALGO_SYMMETRIC_TOEP; - break; - default: -- hns3_err(hw, "Invalid RSS algorithm configuration(%u)", -+ hns3_err(hw, "Invalid RSS algorithm configuration(%d)", - algo_func); - return -EINVAL; - } --- -2.7.4 - diff --git a/0031-net-hns3-extract-common-function-to-obtain-revision-.patch b/0031-net-hns3-extract-common-function-to-obtain-revision-.patch new file mode 100644 index 0000000000000000000000000000000000000000..a6d6adca727bab5e7085f9096f23231f21549602 --- /dev/null +++ b/0031-net-hns3-extract-common-function-to-obtain-revision-.patch @@ -0,0 +1,145 @@ +From f5ed7d99cf45d550a69c1430b7c4a5623a9c774a Mon Sep 17 00:00:00 2001 +From: Huisong Li +Date: Sat, 22 Jan 2022 09:51:37 +0800 +Subject: [PATCH] net/hns3: extract common function to obtain revision ID + +The code logic of obtaining the revision ID of PCI device is the same +for PF and VF driver. This patch extracts a common interface to do it. + +Signed-off-by: Huisong Li +Acked-by: Min Hu (Connor) +--- + drivers/net/hns3/hns3_common.c | 22 ++++++++++++++++++++++ + drivers/net/hns3/hns3_common.h | 2 ++ + drivers/net/hns3/hns3_ethdev.c | 16 ++++------------ + drivers/net/hns3/hns3_ethdev_vf.c | 21 ++++----------------- + 4 files changed, 32 insertions(+), 29 deletions(-) + +diff --git a/drivers/net/hns3/hns3_common.c b/drivers/net/hns3/hns3_common.c +index 0f39d51a87..dcdc609654 100644 +--- a/drivers/net/hns3/hns3_common.c ++++ b/drivers/net/hns3/hns3_common.c +@@ -821,3 +821,25 @@ hns3_restore_rx_interrupt(struct hns3_hw *hw) + + return 0; + } ++ ++int ++hns3_get_pci_revision_id(struct hns3_hw *hw, uint8_t *revision_id) ++{ ++ struct rte_pci_device *pci_dev; ++ struct rte_eth_dev *eth_dev; ++ uint8_t revision; ++ int ret; ++ ++ eth_dev = &rte_eth_devices[hw->data->port_id]; ++ pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev); ++ ret = rte_pci_read_config(pci_dev, &revision, HNS3_PCI_REVISION_ID_LEN, ++ HNS3_PCI_REVISION_ID); ++ if (ret != HNS3_PCI_REVISION_ID_LEN) { ++ hns3_err(hw, "failed to read pci revision id, ret = %d", ret); ++ return -EIO; ++ } ++ ++ *revision_id = revision; ++ ++ return 0; ++} +diff --git a/drivers/net/hns3/hns3_common.h b/drivers/net/hns3/hns3_common.h +index a9e8a9cccf..2994e4a269 100644 +--- a/drivers/net/hns3/hns3_common.h ++++ b/drivers/net/hns3/hns3_common.h +@@ -59,4 +59,6 @@ int hns3_map_rx_interrupt(struct rte_eth_dev *dev); + void hns3_unmap_rx_interrupt(struct rte_eth_dev *dev); + int hns3_restore_rx_interrupt(struct hns3_hw *hw); + ++int hns3_get_pci_revision_id(struct hns3_hw *hw, uint8_t *revision_id); ++ + #endif /* _HNS3_COMMON_H_ */ +diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c +index aa9301c561..b417d55e10 100644 +--- a/drivers/net/hns3/hns3_ethdev.c ++++ b/drivers/net/hns3/hns3_ethdev.c +@@ -5,7 +5,6 @@ + #include + #include + #include +-#include + + #include "hns3_ethdev.h" + #include "hns3_common.h" +@@ -2732,7 +2731,6 @@ hns3_get_capability(struct hns3_hw *hw) + struct hns3_pf *pf = &hns->pf; + struct rte_eth_dev *eth_dev; + uint16_t device_id; +- uint8_t revision; + int ret; + + eth_dev = &rte_eth_devices[hw->data->port_id]; +@@ -2745,17 +2743,11 @@ hns3_get_capability(struct hns3_hw *hw) + device_id == HNS3_DEV_ID_200G_RDMA) + hns3_set_bit(hw->capability, HNS3_DEV_SUPPORT_DCB_B, 1); + +- /* Get PCI revision id */ +- ret = rte_pci_read_config(pci_dev, &revision, HNS3_PCI_REVISION_ID_LEN, +- HNS3_PCI_REVISION_ID); +- if (ret != HNS3_PCI_REVISION_ID_LEN) { +- PMD_INIT_LOG(ERR, "failed to read pci revision id, ret = %d", +- ret); +- return -EIO; +- } +- hw->revision = revision; ++ ret = hns3_get_pci_revision_id(hw, &hw->revision); ++ if (ret) ++ return ret; + +- if (revision < PCI_REVISION_ID_HIP09_A) { ++ if (hw->revision < PCI_REVISION_ID_HIP09_A) { + hns3_set_default_dev_specifications(hw); + hw->intr.mapping_mode = HNS3_INTR_MAPPING_VEC_RSV_ONE; + hw->intr.gl_unit = HNS3_INTR_COALESCE_GL_UINT_2US; +diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c +index 36d860d08a..a9e129288b 100644 +--- a/drivers/net/hns3/hns3_ethdev_vf.c ++++ b/drivers/net/hns3/hns3_ethdev_vf.c +@@ -6,7 +6,6 @@ + #include + #include + #include +-#include + #include + + #include "hns3_ethdev.h" +@@ -810,25 +809,13 @@ hns3vf_get_push_lsc_cap(struct hns3_hw *hw) + static int + hns3vf_get_capability(struct hns3_hw *hw) + { +- struct rte_pci_device *pci_dev; +- struct rte_eth_dev *eth_dev; +- uint8_t revision; + int ret; + +- eth_dev = &rte_eth_devices[hw->data->port_id]; +- pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev); +- +- /* Get PCI revision id */ +- ret = rte_pci_read_config(pci_dev, &revision, HNS3_PCI_REVISION_ID_LEN, +- HNS3_PCI_REVISION_ID); +- if (ret != HNS3_PCI_REVISION_ID_LEN) { +- PMD_INIT_LOG(ERR, "failed to read pci revision id, ret = %d", +- ret); +- return -EIO; +- } +- hw->revision = revision; ++ ret = hns3_get_pci_revision_id(hw, &hw->revision); ++ if (ret) ++ return ret; + +- if (revision < PCI_REVISION_ID_HIP09_A) { ++ if (hw->revision < PCI_REVISION_ID_HIP09_A) { + hns3vf_set_default_dev_specifications(hw); + hw->intr.mapping_mode = HNS3_INTR_MAPPING_VEC_RSV_ONE; + hw->intr.gl_unit = HNS3_INTR_COALESCE_GL_UINT_2US; +-- +2.33.0 + diff --git a/0032-net-hns3-replace-single-line-functions.patch b/0032-net-hns3-replace-single-line-functions.patch new file mode 100644 index 0000000000000000000000000000000000000000..d6d89ff4271eaa58153638a0e8c5100fb39d8338 --- /dev/null +++ b/0032-net-hns3-replace-single-line-functions.patch @@ -0,0 +1,114 @@ +From 3340aa9f50da68f20d2cdb6382a9ab6891e7363c Mon Sep 17 00:00:00 2001 +From: Chengwen Feng +Date: Sat, 22 Jan 2022 09:51:38 +0800 +Subject: [PATCH] net/hns3: replace single line functions + +This patch removes single functions with actual calls. + +Signed-off-by: Chengwen Feng +Acked-by: Min Hu (Connor) +--- + drivers/net/hns3/hns3_ethdev.c | 27 ++++++++------------------- + drivers/net/hns3/hns3_ethdev_vf.c | 13 ++----------- + 2 files changed, 10 insertions(+), 30 deletions(-) + +diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c +index b417d55e10..a5114662d2 100644 +--- a/drivers/net/hns3/hns3_ethdev.c ++++ b/drivers/net/hns3/hns3_ethdev.c +@@ -587,22 +587,6 @@ hns3_set_vlan_rx_offload_cfg(struct hns3_adapter *hns, + return ret; + } + +-static void +-hns3_update_rx_offload_cfg(struct hns3_adapter *hns, +- struct hns3_rx_vtag_cfg *vcfg) +-{ +- struct hns3_pf *pf = &hns->pf; +- memcpy(&pf->vtag_config.rx_vcfg, vcfg, sizeof(pf->vtag_config.rx_vcfg)); +-} +- +-static void +-hns3_update_tx_offload_cfg(struct hns3_adapter *hns, +- struct hns3_tx_vtag_cfg *vcfg) +-{ +- struct hns3_pf *pf = &hns->pf; +- memcpy(&pf->vtag_config.tx_vcfg, vcfg, sizeof(pf->vtag_config.tx_vcfg)); +-} +- + static int + hns3_en_hw_strip_rxvtag(struct hns3_adapter *hns, bool enable) + { +@@ -632,7 +616,8 @@ hns3_en_hw_strip_rxvtag(struct hns3_adapter *hns, bool enable) + return ret; + } + +- hns3_update_rx_offload_cfg(hns, &rxvlan_cfg); ++ memcpy(&hns->pf.vtag_config.rx_vcfg, &rxvlan_cfg, ++ sizeof(struct hns3_rx_vtag_cfg)); + + return ret; + } +@@ -830,7 +815,9 @@ hns3_vlan_txvlan_cfg(struct hns3_adapter *hns, uint16_t port_base_vlan_state, + return ret; + } + +- hns3_update_tx_offload_cfg(hns, &txvlan_cfg); ++ memcpy(&hns->pf.vtag_config.tx_vcfg, &txvlan_cfg, ++ sizeof(struct hns3_tx_vtag_cfg)); ++ + return ret; + } + +@@ -956,7 +943,9 @@ hns3_en_pvid_strip(struct hns3_adapter *hns, int on) + if (ret) + return ret; + +- hns3_update_rx_offload_cfg(hns, &rx_vlan_cfg); ++ memcpy(&hns->pf.vtag_config.rx_vcfg, &rx_vlan_cfg, ++ sizeof(struct hns3_rx_vtag_cfg)); ++ + return ret; + } + +diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c +index a9e129288b..1af2e07e81 100644 +--- a/drivers/net/hns3/hns3_ethdev_vf.c ++++ b/drivers/net/hns3/hns3_ethdev_vf.c +@@ -1026,15 +1026,6 @@ hns3vf_get_configuration(struct hns3_hw *hw) + return hns3vf_get_port_base_vlan_filter_state(hw); + } + +-static int +-hns3vf_set_tc_queue_mapping(struct hns3_adapter *hns, uint16_t nb_rx_q, +- uint16_t nb_tx_q) +-{ +- struct hns3_hw *hw = &hns->hw; +- +- return hns3_queue_to_tc_mapping(hw, nb_rx_q, nb_tx_q); +-} +- + static void + hns3vf_request_link_info(struct hns3_hw *hw) + { +@@ -1530,7 +1521,7 @@ hns3vf_init_vf(struct rte_eth_dev *eth_dev) + goto err_set_tc_queue; + } + +- ret = hns3vf_set_tc_queue_mapping(hns, hw->tqps_num, hw->tqps_num); ++ ret = hns3_queue_to_tc_mapping(hw, hw->tqps_num, hw->tqps_num); + if (ret) { + PMD_INIT_LOG(ERR, "failed to set tc info, ret = %d.", ret); + goto err_set_tc_queue; +@@ -1739,7 +1730,7 @@ hns3vf_do_start(struct hns3_adapter *hns, bool reset_queue) + uint16_t nb_tx_q = hw->data->nb_tx_queues; + int ret; + +- ret = hns3vf_set_tc_queue_mapping(hns, nb_rx_q, nb_tx_q); ++ ret = hns3_queue_to_tc_mapping(hw, nb_rx_q, nb_tx_q); + if (ret) + return ret; + +-- +2.33.0 + diff --git a/0032-net-hns3-support-LSC-event-report.patch b/0032-net-hns3-support-LSC-event-report.patch deleted file mode 100644 index 23df2bfc439b0e1ce7ec0117d9186c5b0b1cc90f..0000000000000000000000000000000000000000 --- a/0032-net-hns3-support-LSC-event-report.patch +++ /dev/null @@ -1,245 +0,0 @@ -From 0112993819b0a5ae9bf35f8a3adf45c6134d69bd Mon Sep 17 00:00:00 2001 -From: Chengwen Feng -Date: Fri, 22 Jan 2021 18:18:52 +0800 -Subject: [PATCH 032/189] net/hns3: support LSC event report - -This patch support LSC (Link Status Change) event report. - -Signed-off-by: Chengwen Feng -Signed-off-by: Lijun Ou ---- - drivers/net/hns3/hns3_ethdev.c | 52 +++++++++++++++++++++++++++++++++++---- - drivers/net/hns3/hns3_ethdev.h | 4 ++- - drivers/net/hns3/hns3_ethdev_vf.c | 40 +++++++++++++++++++++++++++++- - drivers/net/hns3/hns3_mbx.c | 14 ++++++----- - 4 files changed, 97 insertions(+), 13 deletions(-) - -diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c -index 94b6e44..bc77608 100644 ---- a/drivers/net/hns3/hns3_ethdev.c -+++ b/drivers/net/hns3/hns3_ethdev.c -@@ -19,6 +19,7 @@ - #define HNS3_DEFAULT_PORT_CONF_QUEUES_NUM 1 - - #define HNS3_SERVICE_INTERVAL 1000000 /* us */ -+#define HNS3_SERVICE_QUICK_INTERVAL 10 - #define HNS3_INVALID_PVID 0xFFFF - - #define HNS3_FILTER_TYPE_VF 0 -@@ -93,6 +94,7 @@ static int hns3_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu); - static int hns3_vlan_pvid_configure(struct hns3_adapter *hns, uint16_t pvid, - int on); - static int hns3_update_speed_duplex(struct rte_eth_dev *eth_dev); -+static bool hns3_update_link_status(struct hns3_hw *hw); - - static int hns3_add_mc_addr(struct hns3_hw *hw, - struct rte_ether_addr *mac_addr); -@@ -4458,7 +4460,7 @@ hns3_get_mac_link_status(struct hns3_hw *hw) - return !!link_status; - } - --void -+static bool - hns3_update_link_status(struct hns3_hw *hw) - { - int state; -@@ -4467,7 +4469,36 @@ hns3_update_link_status(struct hns3_hw *hw) - if (state != hw->mac.link_status) { - hw->mac.link_status = state; - hns3_warn(hw, "Link status change to %s!", state ? "up" : "down"); -+ return true; - } -+ -+ return false; -+} -+ -+/* -+ * Current, the PF driver get link status by two ways: -+ * 1) Periodic polling in the intr thread context, driver call -+ * hns3_update_link_status to update link status. -+ * 2) Firmware report async interrupt, driver process the event in the intr -+ * thread context, and call hns3_update_link_status to update link status. -+ * -+ * If detect link status changed, driver need report LSE. One method is add the -+ * report LSE logic in hns3_update_link_status. -+ * -+ * But the PF driver ops(link_update) also call hns3_update_link_status to -+ * update link status. -+ * If we report LSE in hns3_update_link_status, it may lead to deadlock in the -+ * bonding application. -+ * -+ * So add the one new API which used only in intr thread context. -+ */ -+void -+hns3_update_link_status_and_event(struct hns3_hw *hw) -+{ -+ struct rte_eth_dev *dev = &rte_eth_devices[hw->data->port_id]; -+ bool changed = hns3_update_link_status(hw); -+ if (changed) -+ rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL); - } - - static void -@@ -4479,9 +4510,10 @@ hns3_service_handler(void *param) - - if (!hns3_is_reset_pending(hns)) { - hns3_update_speed_duplex(eth_dev); -- hns3_update_link_status(hw); -- } else -+ hns3_update_link_status_and_event(hw); -+ } else { - hns3_warn(hw, "Cancel the query when reset is pending"); -+ } - - rte_eal_alarm_set(HNS3_SERVICE_INTERVAL, hns3_service_handler, eth_dev); - } -@@ -5557,8 +5589,10 @@ hns3_stop_service(struct hns3_adapter *hns) - struct rte_eth_dev *eth_dev; - - eth_dev = &rte_eth_devices[hw->data->port_id]; -- if (hw->adapter_state == HNS3_NIC_STARTED) -+ if (hw->adapter_state == HNS3_NIC_STARTED) { - rte_eal_alarm_cancel(hns3_service_handler, eth_dev); -+ hns3_update_link_status_and_event(hw); -+ } - hw->mac.link_status = ETH_LINK_DOWN; - - hns3_set_rxtx_function(eth_dev); -@@ -5601,7 +5635,15 @@ hns3_start_service(struct hns3_adapter *hns) - hns3_set_rxtx_function(eth_dev); - hns3_mp_req_start_rxtx(eth_dev); - if (hw->adapter_state == HNS3_NIC_STARTED) { -- hns3_service_handler(eth_dev); -+ /* -+ * This API parent function already hold the hns3_hw.lock, the -+ * hns3_service_handler may report lse, in bonding application -+ * it will call driver's ops which may acquire the hns3_hw.lock -+ * again, thus lead to deadlock. -+ * We defer calls hns3_service_handler to avoid the deadlock. -+ */ -+ rte_eal_alarm_set(HNS3_SERVICE_QUICK_INTERVAL, -+ hns3_service_handler, eth_dev); - - /* Enable interrupt of all rx queues before enabling queues */ - hns3_dev_all_rx_queue_intr_enable(hw, true); -diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h -index 0d17170..547e991 100644 ---- a/drivers/net/hns3/hns3_ethdev.h -+++ b/drivers/net/hns3/hns3_ethdev.h -@@ -946,11 +946,13 @@ int hns3_dev_filter_ctrl(struct rte_eth_dev *dev, - enum rte_filter_op filter_op, void *arg); - bool hns3_is_reset_pending(struct hns3_adapter *hns); - bool hns3vf_is_reset_pending(struct hns3_adapter *hns); --void hns3_update_link_status(struct hns3_hw *hw); -+void hns3_update_link_status_and_event(struct hns3_hw *hw); - void hns3_ether_format_addr(char *buf, uint16_t size, - const struct rte_ether_addr *ether_addr); - int hns3_dev_infos_get(struct rte_eth_dev *eth_dev, - struct rte_eth_dev_info *info); -+void hns3vf_update_link_status(struct hns3_hw *hw, uint8_t link_status, -+ uint32_t link_speed, uint8_t link_duplex); - - static inline bool - is_reset_pending(struct hns3_adapter *hns) -diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c -index 7eb0b11..3a682e5 100644 ---- a/drivers/net/hns3/hns3_ethdev_vf.c -+++ b/drivers/net/hns3/hns3_ethdev_vf.c -@@ -1440,6 +1440,41 @@ hns3vf_request_link_info(struct hns3_hw *hw) - hns3_err(hw, "Failed to fetch link status from PF: %d", ret); - } - -+void -+hns3vf_update_link_status(struct hns3_hw *hw, uint8_t link_status, -+ uint32_t link_speed, uint8_t link_duplex) -+{ -+ struct rte_eth_dev *dev = &rte_eth_devices[hw->data->port_id]; -+ struct hns3_mac *mac = &hw->mac; -+ bool report_lse; -+ bool changed; -+ -+ changed = mac->link_status != link_status || -+ mac->link_speed != link_speed || -+ mac->link_duplex != link_duplex; -+ if (!changed) -+ return; -+ -+ /* -+ * VF's link status/speed/duplex were updated by polling from PF driver, -+ * because the link status/speed/duplex may be changed in the polling -+ * interval, so driver will report lse (lsc event) once any of the above -+ * thress variables changed. -+ * But if the PF's link status is down and driver saved link status is -+ * also down, there are no need to report lse. -+ */ -+ report_lse = true; -+ if (link_status == ETH_LINK_DOWN && link_status == mac->link_status) -+ report_lse = false; -+ -+ mac->link_status = link_status; -+ mac->link_speed = link_speed; -+ mac->link_duplex = link_duplex; -+ -+ if (report_lse) -+ rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL); -+} -+ - static int - hns3vf_vlan_filter_configure(struct hns3_adapter *hns, uint16_t vlan_id, int on) - { -@@ -2373,8 +2408,11 @@ hns3vf_stop_service(struct hns3_adapter *hns) - struct rte_eth_dev *eth_dev; - - eth_dev = &rte_eth_devices[hw->data->port_id]; -- if (hw->adapter_state == HNS3_NIC_STARTED) -+ if (hw->adapter_state == HNS3_NIC_STARTED) { - rte_eal_alarm_cancel(hns3vf_service_handler, eth_dev); -+ hns3vf_update_link_status(hw, ETH_LINK_DOWN, hw->mac.link_speed, -+ hw->mac.link_duplex); -+ } - hw->mac.link_status = ETH_LINK_DOWN; - - hns3_set_rxtx_function(eth_dev); -diff --git a/drivers/net/hns3/hns3_mbx.c b/drivers/net/hns3/hns3_mbx.c -index d2a5db8..3e44e3b 100644 ---- a/drivers/net/hns3/hns3_mbx.c -+++ b/drivers/net/hns3/hns3_mbx.c -@@ -203,8 +203,9 @@ hns3_cmd_crq_empty(struct hns3_hw *hw) - static void - hns3_mbx_handler(struct hns3_hw *hw) - { -- struct hns3_mac *mac = &hw->mac; - enum hns3_reset_level reset_level; -+ uint8_t link_status, link_duplex; -+ uint32_t link_speed; - uint16_t *msg_q; - uint8_t opcode; - uint32_t tail; -@@ -218,10 +219,11 @@ hns3_mbx_handler(struct hns3_hw *hw) - opcode = msg_q[0] & 0xff; - switch (opcode) { - case HNS3_MBX_LINK_STAT_CHANGE: -- memcpy(&mac->link_speed, &msg_q[2], -- sizeof(mac->link_speed)); -- mac->link_status = rte_le_to_cpu_16(msg_q[1]); -- mac->link_duplex = (uint8_t)rte_le_to_cpu_16(msg_q[4]); -+ memcpy(&link_speed, &msg_q[2], sizeof(link_speed)); -+ link_status = rte_le_to_cpu_16(msg_q[1]); -+ link_duplex = (uint8_t)rte_le_to_cpu_16(msg_q[4]); -+ hns3vf_update_link_status(hw, link_status, link_speed, -+ link_duplex); - break; - case HNS3_MBX_ASSERTING_RESET: - /* PF has asserted reset hence VF should go in pending -@@ -310,7 +312,7 @@ hns3_handle_link_change_event(struct hns3_hw *hw, - if (!req->msg[LINK_STATUS_OFFSET]) - hns3_link_fail_parse(hw, req->msg[LINK_FAIL_CODE_OFFSET]); - -- hns3_update_link_status(hw); -+ hns3_update_link_status_and_event(hw); - } - - static void --- -2.7.4 - diff --git a/0033-net-hns3-fix-query-order-of-link-status-and-link-inf.patch b/0033-net-hns3-fix-query-order-of-link-status-and-link-inf.patch deleted file mode 100644 index 6e1bb966df72a38b2ebc8be408a3251d31063b1b..0000000000000000000000000000000000000000 --- a/0033-net-hns3-fix-query-order-of-link-status-and-link-inf.patch +++ /dev/null @@ -1,96 +0,0 @@ -From fd6de494db0d040ca42a6f57f202515f537a62b3 Mon Sep 17 00:00:00 2001 -From: Huisong Li -Date: Wed, 3 Feb 2021 20:23:47 +0800 -Subject: [PATCH 033/189] net/hns3: fix query order of link status and link - info - -When link information is updated in the firmware, the link information -is updated first and then the link status is updated. In a 1s periodic -task, PF driver queries the link information and then obtains link -status. -It may lead to a 1s time difference for obtaining valid link information -when the port is up. Therefore, the query order of driver should be -reversed to the order of firmware. - -Fixes: 109e4dd1bd7a ("net/hns3: get link state change through mailbox") -Fixes: 59fad0f32135 ("net/hns3: support link update operation") -Cc: stable@dpdk.org - -Signed-off-by: Huisong Li -Signed-off-by: Lijun Ou ---- - drivers/net/hns3/hns3_ethdev.c | 27 ++++++++++++++++++++------- - 1 file changed, 20 insertions(+), 7 deletions(-) - -diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c -index bc77608..b624fce 100644 ---- a/drivers/net/hns3/hns3_ethdev.c -+++ b/drivers/net/hns3/hns3_ethdev.c -@@ -93,7 +93,7 @@ static enum hns3_reset_level hns3_get_reset_level(struct hns3_adapter *hns, - static int hns3_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu); - static int hns3_vlan_pvid_configure(struct hns3_adapter *hns, uint16_t pvid, - int on); --static int hns3_update_speed_duplex(struct rte_eth_dev *eth_dev); -+static int hns3_update_link_info(struct rte_eth_dev *eth_dev); - static bool hns3_update_link_status(struct hns3_hw *hw); - - static int hns3_add_mc_addr(struct hns3_hw *hw, -@@ -2642,8 +2642,8 @@ hns3_dev_link_update(struct rte_eth_dev *eth_dev, - struct rte_eth_link new_link; - - if (!hns3_is_reset_pending(hns)) { -- hns3_update_speed_duplex(eth_dev); - hns3_update_link_status(hw); -+ hns3_update_link_info(eth_dev); - } - - memset(&new_link, 0, sizeof(new_link)); -@@ -4368,11 +4368,9 @@ hns3_cfg_mac_speed_dup(struct hns3_hw *hw, uint32_t speed, uint8_t duplex) - } - - static int --hns3_update_speed_duplex(struct rte_eth_dev *eth_dev) -+hns3_update_fiber_link_info(struct hns3_hw *hw) - { -- struct hns3_adapter *hns = eth_dev->data->dev_private; -- struct hns3_hw *hw = &hns->hw; -- struct hns3_pf *pf = &hns->pf; -+ struct hns3_pf *pf = HNS3_DEV_HW_TO_PF(hw); - uint32_t speed; - int ret; - -@@ -4395,6 +4393,21 @@ hns3_update_speed_duplex(struct rte_eth_dev *eth_dev) - } - - static int -+hns3_update_link_info(struct rte_eth_dev *eth_dev) -+{ -+ struct hns3_adapter *hns = eth_dev->data->dev_private; -+ struct hns3_hw *hw = &hns->hw; -+ int ret = 0; -+ -+ if (hw->mac.media_type == HNS3_MEDIA_TYPE_COPPER) -+ return 0; -+ else if (hw->mac.media_type == HNS3_MEDIA_TYPE_FIBER) -+ ret = hns3_update_fiber_link_info(hw); -+ -+ return ret; -+} -+ -+static int - hns3_cfg_mac_mode(struct hns3_hw *hw, bool enable) - { - struct hns3_config_mac_mode_cmd *req; -@@ -4509,8 +4522,8 @@ hns3_service_handler(void *param) - struct hns3_hw *hw = &hns->hw; - - if (!hns3_is_reset_pending(hns)) { -- hns3_update_speed_duplex(eth_dev); - hns3_update_link_status_and_event(hw); -+ hns3_update_link_info(eth_dev); - } else { - hns3_warn(hw, "Cancel the query when reset is pending"); - } --- -2.7.4 - diff --git a/0033-net-hns3-remove-non-re-entrant-strerror-call.patch b/0033-net-hns3-remove-non-re-entrant-strerror-call.patch new file mode 100644 index 0000000000000000000000000000000000000000..2d452171c2aff30a4a0d848461625e461d60db10 --- /dev/null +++ b/0033-net-hns3-remove-non-re-entrant-strerror-call.patch @@ -0,0 +1,30 @@ +From 2a1e7c4782ee21823eb37acbb073bcf9f73b173f Mon Sep 17 00:00:00 2001 +From: Chengwen Feng +Date: Sat, 22 Jan 2022 09:51:39 +0800 +Subject: [PATCH] net/hns3: remove non re-entrant strerror call + +This patch delete strerror invoke which was non re-entrant. + +Signed-off-by: Chengwen Feng +Acked-by: Min Hu (Connor) +--- + drivers/net/hns3/hns3_fdir.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/drivers/net/hns3/hns3_fdir.c b/drivers/net/hns3/hns3_fdir.c +index d043f5786d..2a7978ac07 100644 +--- a/drivers/net/hns3/hns3_fdir.c ++++ b/drivers/net/hns3/hns3_fdir.c +@@ -919,8 +919,7 @@ static int hns3_insert_fdir_filter(struct hns3_hw *hw, + sig = rte_hash_crc(key, sizeof(*key), 0); + ret = rte_hash_add_key_with_hash(fdir_info->hash_handle, key, sig); + if (ret < 0) { +- hns3_err(hw, "Hash table full? err:%d(%s)!", ret, +- strerror(-ret)); ++ hns3_err(hw, "Hash table full? err:%d!", ret); + return ret; + } + +-- +2.33.0 + diff --git a/0034-net-hns3-fix-link-status-change-from-firmware.patch b/0034-net-hns3-fix-link-status-change-from-firmware.patch deleted file mode 100644 index 4cf077b9e3a0af6a5c409d79c1987f4869f88056..0000000000000000000000000000000000000000 --- a/0034-net-hns3-fix-link-status-change-from-firmware.patch +++ /dev/null @@ -1,115 +0,0 @@ -From 721dce02ae8a5ca9da07849d9759310f1e3cafda Mon Sep 17 00:00:00 2001 -From: Huisong Li -Date: Wed, 3 Feb 2021 20:23:48 +0800 -Subject: [PATCH 034/189] net/hns3: fix link status change from firmware - -When the hardware link status changes, the firmware proactively -reports the link status change message, and then driver update -link status. This feature is lack of a switch to control in PF -driver. Otherwise, this feature does not take effect when the -kernel PF driver that supports the feature is not loaded. - -Fixes: 109e4dd1bd7a ("net/hns3: get link state change through mailbox") -Cc: stable@dpdk.org - -Signed-off-by: Huisong Li -Signed-off-by: Lijun Ou ---- - drivers/net/hns3/hns3_cmd.h | 10 ++++++++++ - drivers/net/hns3/hns3_ethdev.c | 31 +++++++++++++++++++++++++++++++ - 2 files changed, 41 insertions(+) - -diff --git a/drivers/net/hns3/hns3_cmd.h b/drivers/net/hns3/hns3_cmd.h -index dc97a1a..ad5e188 100644 ---- a/drivers/net/hns3/hns3_cmd.h -+++ b/drivers/net/hns3/hns3_cmd.h -@@ -206,6 +206,9 @@ enum hns3_opcode_type { - /* Clear hardware state command */ - HNS3_OPC_CLEAR_HW_STATE = 0x700B, - -+ /* Firmware stats command */ -+ HNS3_OPC_FIRMWARE_COMPAT_CFG = 0x701A, -+ - /* SFP command */ - HNS3_OPC_SFP_GET_SPEED = 0x7104, - -@@ -633,6 +636,13 @@ enum hns3_promisc_type { - HNS3_BROADCAST = 3, - }; - -+#define HNS3_LINK_EVENT_REPORT_EN_B 0 -+#define HNS3_NCSI_ERROR_REPORT_EN_B 1 -+struct hns3_firmware_compat_cmd { -+ uint32_t compat; -+ uint8_t rsv[20]; -+}; -+ - #define HNS3_MAC_TX_EN_B 6 - #define HNS3_MAC_RX_EN_B 7 - #define HNS3_MAC_PAD_TX_B 11 -diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c -index b624fce..30f09a7 100644 ---- a/drivers/net/hns3/hns3_ethdev.c -+++ b/drivers/net/hns3/hns3_ethdev.c -@@ -3919,6 +3919,26 @@ hns3_buffer_alloc(struct hns3_hw *hw) - } - - static int -+hns3_firmware_compat_config(struct hns3_hw *hw, bool is_init) -+{ -+ struct hns3_firmware_compat_cmd *req; -+ struct hns3_cmd_desc desc; -+ uint32_t compat = 0; -+ -+ hns3_cmd_setup_basic_desc(&desc, HNS3_OPC_FIRMWARE_COMPAT_CFG, false); -+ req = (struct hns3_firmware_compat_cmd *)desc.data; -+ -+ if (is_init) { -+ hns3_set_bit(compat, HNS3_LINK_EVENT_REPORT_EN_B, 1); -+ hns3_set_bit(compat, HNS3_NCSI_ERROR_REPORT_EN_B, 0); -+ } -+ -+ req->compat = rte_cpu_to_le_32(compat); -+ -+ return hns3_cmd_send(hw, &desc, 1); -+} -+ -+static int - hns3_mac_init(struct hns3_hw *hw) - { - struct hns3_adapter *hns = HNS3_DEV_HW_TO_ADAPTER(hw); -@@ -4610,6 +4630,15 @@ hns3_init_hardware(struct hns3_adapter *hns) - goto err_mac_init; - } - -+ /* -+ * Requiring firmware to enable some features, driver can -+ * still work without it. -+ */ -+ ret = hns3_firmware_compat_config(hw, true); -+ if (ret) -+ PMD_INIT_LOG(WARNING, "firmware compatible features not " -+ "supported, ret = %d.", ret); -+ - return 0; - - err_mac_init: -@@ -4746,6 +4775,7 @@ hns3_init_pf(struct rte_eth_dev *eth_dev) - err_enable_intr: - hns3_fdir_filter_uninit(hns); - err_fdir: -+ (void)hns3_firmware_compat_config(hw, false); - hns3_uninit_umv_space(hw); - err_init_hw: - hns3_tqp_stats_uninit(hw); -@@ -4780,6 +4810,7 @@ hns3_uninit_pf(struct rte_eth_dev *eth_dev) - (void)hns3_config_gro(hw, false); - hns3_promisc_uninit(hw); - hns3_fdir_filter_uninit(hns); -+ (void)hns3_firmware_compat_config(hw, false); - hns3_uninit_umv_space(hw); - hns3_tqp_stats_uninit(hw); - hns3_pf_disable_irq0(hw); --- -2.7.4 - diff --git a/0034-net-hns3-rename-function.patch b/0034-net-hns3-rename-function.patch new file mode 100644 index 0000000000000000000000000000000000000000..6f2e90e98247b3041b2c692d1350fcf4ade11072 --- /dev/null +++ b/0034-net-hns3-rename-function.patch @@ -0,0 +1,39 @@ +From 092ffe854dafe98f3e8e4c412211b80f6932315e Mon Sep 17 00:00:00 2001 +From: Chengwen Feng +Date: Sat, 22 Jan 2022 09:51:40 +0800 +Subject: [PATCH] net/hns3: rename function + +This patch rename hns3_parse_rss_key with hns3_adjust_rss_key to +improve readability. + +Signed-off-by: Chengwen Feng +Acked-by: Min Hu (Connor) +--- + drivers/net/hns3/hns3_flow.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/net/hns3/hns3_flow.c b/drivers/net/hns3/hns3_flow.c +index 00084872ad..72986abaff 100644 +--- a/drivers/net/hns3/hns3_flow.c ++++ b/drivers/net/hns3/hns3_flow.c +@@ -1405,7 +1405,7 @@ hns3_disable_rss(struct hns3_hw *hw) + } + + static void +-hns3_parse_rss_key(struct hns3_hw *hw, struct rte_flow_action_rss *rss_conf) ++hns3_adjust_rss_key(struct hns3_hw *hw, struct rte_flow_action_rss *rss_conf) + { + if (rss_conf->key == NULL || rss_conf->key_len < HNS3_RSS_KEY_SIZE) { + hns3_warn(hw, "Default RSS hash key to be set"); +@@ -1449,7 +1449,7 @@ hns3_hw_rss_hash_set(struct hns3_hw *hw, struct rte_flow_action_rss *rss_config) + struct hns3_rss_tuple_cfg *tuple; + int ret; + +- hns3_parse_rss_key(hw, rss_config); ++ hns3_adjust_rss_key(hw, rss_config); + + ret = hns3_parse_rss_algorithm(hw, &rss_config->func, + &hw->rss_info.hash_algo); +-- +2.33.0 + diff --git a/0035-net-hns3-extract-functions-to-create-RSS-and-FDIR-fl.patch b/0035-net-hns3-extract-functions-to-create-RSS-and-FDIR-fl.patch new file mode 100644 index 0000000000000000000000000000000000000000..6c656217a8b8aa742ce980a76c292e2e2f42874b --- /dev/null +++ b/0035-net-hns3-extract-functions-to-create-RSS-and-FDIR-fl.patch @@ -0,0 +1,225 @@ +From c48499171f5df62a71697dce517b9fa22bc30985 Mon Sep 17 00:00:00 2001 +From: Huisong Li +Date: Sat, 22 Jan 2022 09:51:41 +0800 +Subject: [PATCH] net/hns3: extract functions to create RSS and FDIR flow rule + +Extract two functions to create the RSS and FDIR flow rule for clearer +code logic. + +Signed-off-by: Huisong Li +Acked-by: Min Hu (Connor) +--- + drivers/net/hns3/hns3_flow.c | 173 +++++++++++++++++++++-------------- + 1 file changed, 106 insertions(+), 67 deletions(-) + +diff --git a/drivers/net/hns3/hns3_flow.c b/drivers/net/hns3/hns3_flow.c +index 72986abaff..4f271a32dd 100644 +--- a/drivers/net/hns3/hns3_flow.c ++++ b/drivers/net/hns3/hns3_flow.c +@@ -1706,6 +1706,105 @@ hns3_flow_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, + return hns3_parse_fdir_filter(dev, pattern, actions, &fdir_rule, error); + } + ++static int ++hns3_flow_create_rss_rule(struct rte_eth_dev *dev, ++ const struct rte_flow_action *act, ++ struct rte_flow *flow) ++{ ++ struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private); ++ struct hns3_rss_conf_ele *rss_filter_ptr; ++ const struct hns3_rss_conf *rss_conf; ++ int ret; ++ ++ rss_filter_ptr = rte_zmalloc("hns3 rss filter", ++ sizeof(struct hns3_rss_conf_ele), 0); ++ if (rss_filter_ptr == NULL) { ++ hns3_err(hw, "failed to allocate hns3_rss_filter memory"); ++ return -ENOMEM; ++ } ++ ++ /* ++ * After all the preceding tasks are successfully configured, configure ++ * rules to the hardware to simplify the rollback of rules in the ++ * hardware. ++ */ ++ rss_conf = (const struct hns3_rss_conf *)act->conf; ++ ret = hns3_flow_parse_rss(dev, rss_conf, true); ++ if (ret != 0) { ++ rte_free(rss_filter_ptr); ++ return ret; ++ } ++ ++ hns3_rss_conf_copy(&rss_filter_ptr->filter_info, &rss_conf->conf); ++ rss_filter_ptr->filter_info.valid = true; ++ TAILQ_INSERT_TAIL(&hw->flow_rss_list, rss_filter_ptr, entries); ++ flow->rule = rss_filter_ptr; ++ flow->filter_type = RTE_ETH_FILTER_HASH; ++ ++ return 0; ++} ++ ++static int ++hns3_flow_create_fdir_rule(struct rte_eth_dev *dev, ++ const struct rte_flow_item pattern[], ++ const struct rte_flow_action actions[], ++ struct rte_flow_error *error, ++ struct rte_flow *flow) ++{ ++ struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private); ++ struct hns3_adapter *hns = HNS3_DEV_HW_TO_ADAPTER(hw); ++ struct hns3_fdir_rule_ele *fdir_rule_ptr; ++ struct hns3_fdir_rule fdir_rule; ++ int ret; ++ ++ memset(&fdir_rule, 0, sizeof(struct hns3_fdir_rule)); ++ ret = hns3_parse_fdir_filter(dev, pattern, actions, &fdir_rule, error); ++ if (ret != 0) ++ return ret; ++ ++ if (fdir_rule.flags & HNS3_RULE_FLAG_COUNTER) { ++ ret = hns3_counter_new(dev, 0, ++ fdir_rule.act_cnt.id, error); ++ if (ret != 0) ++ return ret; ++ ++ flow->counter_id = fdir_rule.act_cnt.id; ++ } ++ ++ fdir_rule_ptr = rte_zmalloc("hns3 fdir rule", ++ sizeof(struct hns3_fdir_rule_ele), 0); ++ if (fdir_rule_ptr == NULL) { ++ hns3_err(hw, "failed to allocate fdir_rule memory."); ++ ret = -ENOMEM; ++ goto err_malloc; ++ } ++ ++ /* ++ * After all the preceding tasks are successfully configured, configure ++ * rules to the hardware to simplify the rollback of rules in the ++ * hardware. ++ */ ++ ret = hns3_fdir_filter_program(hns, &fdir_rule, false); ++ if (ret != 0) ++ goto err_fdir_filter; ++ ++ memcpy(&fdir_rule_ptr->fdir_conf, &fdir_rule, ++ sizeof(struct hns3_fdir_rule)); ++ TAILQ_INSERT_TAIL(&hw->flow_fdir_list, fdir_rule_ptr, entries); ++ flow->rule = fdir_rule_ptr; ++ flow->filter_type = RTE_ETH_FILTER_FDIR; ++ ++ return 0; ++ ++err_fdir_filter: ++ rte_free(fdir_rule_ptr); ++err_malloc: ++ if (fdir_rule.flags & HNS3_RULE_FLAG_COUNTER) ++ hns3_counter_release(dev, fdir_rule.act_cnt.id); ++ ++ return ret; ++} ++ + /* + * Create or destroy a flow rule. + * Theorically one rule can match more than one filters. +@@ -1720,13 +1819,9 @@ hns3_flow_create(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, + { + struct hns3_adapter *hns = dev->data->dev_private; + struct hns3_hw *hw = &hns->hw; +- const struct hns3_rss_conf *rss_conf; +- struct hns3_fdir_rule_ele *fdir_rule_ptr; +- struct hns3_rss_conf_ele *rss_filter_ptr; + struct hns3_flow_mem *flow_node; + const struct rte_flow_action *act; + struct rte_flow *flow; +- struct hns3_fdir_rule fdir_rule; + int ret; + + ret = hns3_flow_validate(dev, attr, pattern, actions, error); +@@ -1752,76 +1847,20 @@ hns3_flow_create(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, + TAILQ_INSERT_TAIL(&hw->flow_list, flow_node, entries); + + act = hns3_find_rss_general_action(pattern, actions); +- if (act) { +- rss_conf = act->conf; +- +- ret = hns3_flow_parse_rss(dev, rss_conf, true); +- if (ret) +- goto err; +- +- rss_filter_ptr = rte_zmalloc("hns3 rss filter", +- sizeof(struct hns3_rss_conf_ele), +- 0); +- if (rss_filter_ptr == NULL) { +- hns3_err(hw, +- "Failed to allocate hns3_rss_filter memory"); +- ret = -ENOMEM; +- goto err; +- } +- hns3_rss_conf_copy(&rss_filter_ptr->filter_info, +- &rss_conf->conf); +- rss_filter_ptr->filter_info.valid = true; +- TAILQ_INSERT_TAIL(&hw->flow_rss_list, rss_filter_ptr, entries); +- +- flow->rule = rss_filter_ptr; +- flow->filter_type = RTE_ETH_FILTER_HASH; +- return flow; +- } +- +- memset(&fdir_rule, 0, sizeof(struct hns3_fdir_rule)); +- ret = hns3_parse_fdir_filter(dev, pattern, actions, &fdir_rule, error); +- if (ret) +- goto out; +- +- if (fdir_rule.flags & HNS3_RULE_FLAG_COUNTER) { +- ret = hns3_counter_new(dev, 0, fdir_rule.act_cnt.id, error); +- if (ret) +- goto out; +- +- flow->counter_id = fdir_rule.act_cnt.id; +- } +- +- fdir_rule_ptr = rte_zmalloc("hns3 fdir rule", +- sizeof(struct hns3_fdir_rule_ele), +- 0); +- if (fdir_rule_ptr == NULL) { +- hns3_err(hw, "failed to allocate fdir_rule memory."); +- ret = -ENOMEM; +- goto err_fdir; +- } +- +- ret = hns3_fdir_filter_program(hns, &fdir_rule, false); +- if (!ret) { +- memcpy(&fdir_rule_ptr->fdir_conf, &fdir_rule, +- sizeof(struct hns3_fdir_rule)); +- TAILQ_INSERT_TAIL(&hw->flow_fdir_list, fdir_rule_ptr, entries); +- flow->rule = fdir_rule_ptr; +- flow->filter_type = RTE_ETH_FILTER_FDIR; +- ++ if (act) ++ ret = hns3_flow_create_rss_rule(dev, act, flow); ++ else ++ ret = hns3_flow_create_fdir_rule(dev, pattern, actions, ++ error, flow); ++ if (ret == 0) + return flow; +- } + +- rte_free(fdir_rule_ptr); +-err_fdir: +- if (fdir_rule.flags & HNS3_RULE_FLAG_COUNTER) +- hns3_counter_release(dev, fdir_rule.act_cnt.id); +-err: + rte_flow_error_set(error, -ret, RTE_FLOW_ERROR_TYPE_HANDLE, NULL, + "Failed to create flow"); +-out: + TAILQ_REMOVE(&hw->flow_list, flow_node, entries); + rte_free(flow_node); + rte_free(flow); ++ + return NULL; + } + +-- +2.33.0 + diff --git a/0035-net-hns3-fix-RSS-indirection-table-size.patch b/0035-net-hns3-fix-RSS-indirection-table-size.patch deleted file mode 100644 index 197876c0a2923fcbf86616e20eab7c46c8d16a7d..0000000000000000000000000000000000000000 --- a/0035-net-hns3-fix-RSS-indirection-table-size.patch +++ /dev/null @@ -1,334 +0,0 @@ -From 00cee658ee4db31787baecbaff321d14734f6494 Mon Sep 17 00:00:00 2001 -From: Lijun Ou -Date: Wed, 3 Feb 2021 20:23:49 +0800 -Subject: [PATCH 035/189] net/hns3: fix RSS indirection table size - -The driver should not use the fixed value as the validity check of -RSS indirection table size with HW supported. As a result, it will -cause misjudgment when the RSS RETA size with HW supported have -changed. - -Fixes: c37ca66f2b27 ("net/hns3: support RSS") -Cc: stable@dpdk.org - -Signed-off-by: Lijun Ou ---- - drivers/net/hns3/hns3_cmd.c | 11 +++++++++++ - drivers/net/hns3/hns3_cmd.h | 7 ++++++- - drivers/net/hns3/hns3_dcb.c | 2 +- - drivers/net/hns3/hns3_ethdev.c | 18 ++++++++++++++++-- - drivers/net/hns3/hns3_ethdev_vf.c | 18 ++++++++++++++++-- - drivers/net/hns3/hns3_flow.c | 6 +++--- - drivers/net/hns3/hns3_rss.c | 28 ++++++++++++++-------------- - drivers/net/hns3/hns3_rss.h | 5 ++--- - 8 files changed, 69 insertions(+), 26 deletions(-) - -diff --git a/drivers/net/hns3/hns3_cmd.c b/drivers/net/hns3/hns3_cmd.c -index 4c301cb..a6ea072 100644 ---- a/drivers/net/hns3/hns3_cmd.c -+++ b/drivers/net/hns3/hns3_cmd.c -@@ -430,6 +430,16 @@ static void hns3_parse_capability(struct hns3_hw *hw, - hns3_set_bit(hw->capability, HNS3_DEV_SUPPORT_STASH_B, 1); - } - -+static uint32_t -+hns3_build_api_caps(void) -+{ -+ uint32_t api_caps = 0; -+ -+ hns3_set_bit(api_caps, HNS3_API_CAP_FLEX_RSS_TBL_B, 1); -+ -+ return rte_cpu_to_le_32(api_caps); -+} -+ - static enum hns3_cmd_status - hns3_cmd_query_firmware_version_and_capability(struct hns3_hw *hw) - { -@@ -439,6 +449,7 @@ hns3_cmd_query_firmware_version_and_capability(struct hns3_hw *hw) - - hns3_cmd_setup_basic_desc(&desc, HNS3_OPC_QUERY_FW_VER, 1); - resp = (struct hns3_query_version_cmd *)desc.data; -+ resp->api_caps = hns3_build_api_caps(); - - /* Initialize the cmd function */ - ret = hns3_cmd_send(hw, &desc, 1); -diff --git a/drivers/net/hns3/hns3_cmd.h b/drivers/net/hns3/hns3_cmd.h -index ad5e188..5640fe4 100644 ---- a/drivers/net/hns3/hns3_cmd.h -+++ b/drivers/net/hns3/hns3_cmd.h -@@ -295,11 +295,16 @@ enum HNS3_CAPS_BITS { - HNS3_CAPS_HW_PAD_B, - HNS3_CAPS_STASH_B, - }; -+ -+enum HNS3_API_CAP_BITS { -+ HNS3_API_CAP_FLEX_RSS_TBL_B, -+}; -+ - #define HNS3_QUERY_CAP_LENGTH 3 - struct hns3_query_version_cmd { - uint32_t firmware; - uint32_t hardware; -- uint32_t rsv; -+ uint32_t api_caps; - uint32_t caps[HNS3_QUERY_CAP_LENGTH]; /* capabilities of device */ - }; - -diff --git a/drivers/net/hns3/hns3_dcb.c b/drivers/net/hns3/hns3_dcb.c -index 5aa374c..7fc6ac9 100644 ---- a/drivers/net/hns3/hns3_dcb.c -+++ b/drivers/net/hns3/hns3_dcb.c -@@ -644,7 +644,7 @@ hns3_set_rss_size(struct hns3_hw *hw, uint16_t nb_rx_q) - * stage of the reset process. - */ - if (__atomic_load_n(&hw->reset.resetting, __ATOMIC_RELAXED) == 0) { -- for (i = 0; i < HNS3_RSS_IND_TBL_SIZE; i++) -+ for (i = 0; i < hw->rss_ind_tbl_size; i++) - rss_cfg->rss_indirection_tbl[i] = - i % hw->alloc_rss_size; - } -diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c -index 30f09a7..df7220b 100644 ---- a/drivers/net/hns3/hns3_ethdev.c -+++ b/drivers/net/hns3/hns3_ethdev.c -@@ -2593,7 +2593,7 @@ hns3_dev_infos_get(struct rte_eth_dev *eth_dev, struct rte_eth_dev_info *info) - - info->vmdq_queue_num = 0; - -- info->reta_size = HNS3_RSS_IND_TBL_SIZE; -+ info->reta_size = hw->rss_ind_tbl_size; - info->hash_key_size = HNS3_RSS_KEY_SIZE; - info->flow_type_rss_offloads = HNS3_ETH_RSS_SUPPORT; - -@@ -2984,6 +2984,20 @@ hns3_parse_dev_specifications(struct hns3_hw *hw, struct hns3_cmd_desc *desc) - } - - static int -+hns3_check_dev_specifications(struct hns3_hw *hw) -+{ -+ if (hw->rss_ind_tbl_size == 0 || -+ hw->rss_ind_tbl_size > HNS3_RSS_IND_TBL_SIZE_MAX) { -+ hns3_err(hw, "the size of hash lookup table configured (%u)" -+ " exceeds the maximum(%u)", hw->rss_ind_tbl_size, -+ HNS3_RSS_IND_TBL_SIZE_MAX); -+ return -EINVAL; -+ } -+ -+ return 0; -+} -+ -+static int - hns3_query_dev_specifications(struct hns3_hw *hw) - { - struct hns3_cmd_desc desc[HNS3_QUERY_DEV_SPECS_BD_NUM]; -@@ -3003,7 +3017,7 @@ hns3_query_dev_specifications(struct hns3_hw *hw) - - hns3_parse_dev_specifications(hw, desc); - -- return 0; -+ return hns3_check_dev_specifications(hw); - } - - static int -diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c -index 3a682e5..1b1989e 100644 ---- a/drivers/net/hns3/hns3_ethdev_vf.c -+++ b/drivers/net/hns3/hns3_ethdev_vf.c -@@ -1016,7 +1016,7 @@ hns3vf_dev_infos_get(struct rte_eth_dev *eth_dev, struct rte_eth_dev_info *info) - - info->vmdq_queue_num = 0; - -- info->reta_size = HNS3_RSS_IND_TBL_SIZE; -+ info->reta_size = hw->rss_ind_tbl_size; - info->hash_key_size = HNS3_RSS_KEY_SIZE; - info->flow_type_rss_offloads = HNS3_ETH_RSS_SUPPORT; - info->default_rxportconf.ring_size = HNS3_DEFAULT_RING_DESC; -@@ -1149,6 +1149,20 @@ hns3vf_parse_dev_specifications(struct hns3_hw *hw, struct hns3_cmd_desc *desc) - } - - static int -+hns3vf_check_dev_specifications(struct hns3_hw *hw) -+{ -+ if (hw->rss_ind_tbl_size == 0 || -+ hw->rss_ind_tbl_size > HNS3_RSS_IND_TBL_SIZE_MAX) { -+ hns3_warn(hw, "the size of hash lookup table configured (%u)" -+ " exceeds the maximum(%u)", hw->rss_ind_tbl_size, -+ HNS3_RSS_IND_TBL_SIZE_MAX); -+ return -EINVAL; -+ } -+ -+ return 0; -+} -+ -+static int - hns3vf_query_dev_specifications(struct hns3_hw *hw) - { - struct hns3_cmd_desc desc[HNS3_QUERY_DEV_SPECS_BD_NUM]; -@@ -1168,7 +1182,7 @@ hns3vf_query_dev_specifications(struct hns3_hw *hw) - - hns3vf_parse_dev_specifications(hw, desc); - -- return 0; -+ return hns3vf_check_dev_specifications(hw); - } - - static int -diff --git a/drivers/net/hns3/hns3_flow.c b/drivers/net/hns3/hns3_flow.c -index 3e387ac..a601124 100644 ---- a/drivers/net/hns3/hns3_flow.c -+++ b/drivers/net/hns3/hns3_flow.c -@@ -1489,14 +1489,14 @@ hns3_update_indir_table(struct rte_eth_dev *dev, - { - struct hns3_adapter *hns = dev->data->dev_private; - struct hns3_hw *hw = &hns->hw; -- uint16_t indir_tbl[HNS3_RSS_IND_TBL_SIZE]; -+ uint16_t indir_tbl[HNS3_RSS_IND_TBL_SIZE_MAX]; - uint16_t j; - uint32_t i; - - /* Fill in redirection table */ - memcpy(indir_tbl, hw->rss_info.rss_indirection_tbl, - sizeof(hw->rss_info.rss_indirection_tbl)); -- for (i = 0, j = 0; i < HNS3_RSS_IND_TBL_SIZE; i++, j++) { -+ for (i = 0, j = 0; i < hw->rss_ind_tbl_size; i++, j++) { - j %= num; - if (conf->queue[j] >= hw->alloc_rss_size) { - hns3_err(hw, "queue id(%u) set to redirection table " -@@ -1507,7 +1507,7 @@ hns3_update_indir_table(struct rte_eth_dev *dev, - indir_tbl[i] = conf->queue[j]; - } - -- return hns3_set_rss_indir_table(hw, indir_tbl, HNS3_RSS_IND_TBL_SIZE); -+ return hns3_set_rss_indir_table(hw, indir_tbl, hw->rss_ind_tbl_size); - } - - static int -diff --git a/drivers/net/hns3/hns3_rss.c b/drivers/net/hns3/hns3_rss.c -index 7d1a297..858e31a 100644 ---- a/drivers/net/hns3/hns3_rss.c -+++ b/drivers/net/hns3/hns3_rss.c -@@ -312,7 +312,7 @@ hns3_set_rss_indir_table(struct hns3_hw *hw, uint16_t *indir, uint16_t size) - - /* Update redirection table of hw */ - memcpy(hw->rss_info.rss_indirection_tbl, indir, -- sizeof(hw->rss_info.rss_indirection_tbl)); -+ sizeof(uint16_t) * size); - - return 0; - } -@@ -324,13 +324,13 @@ hns3_rss_reset_indir_table(struct hns3_hw *hw) - int ret; - - lut = rte_zmalloc("hns3_rss_lut", -- HNS3_RSS_IND_TBL_SIZE * sizeof(uint16_t), 0); -+ hw->rss_ind_tbl_size * sizeof(uint16_t), 0); - if (lut == NULL) { - hns3_err(hw, "No hns3_rss_lut memory can be allocated"); - return -ENOMEM; - } - -- ret = hns3_set_rss_indir_table(hw, lut, HNS3_RSS_IND_TBL_SIZE); -+ ret = hns3_set_rss_indir_table(hw, lut, hw->rss_ind_tbl_size); - if (ret) - hns3_err(hw, "RSS uninit indir table failed: %d", ret); - rte_free(lut); -@@ -428,7 +428,7 @@ hns3_dev_rss_hash_update(struct rte_eth_dev *dev, - } else if (rss_hf && rss_cfg->conf.types == 0) { - /* Enable RSS, restore indirection table by hw's config */ - ret = hns3_set_rss_indir_table(hw, rss_cfg->rss_indirection_tbl, -- HNS3_RSS_IND_TBL_SIZE); -+ hw->rss_ind_tbl_size); - if (ret) - goto conf_err; - } -@@ -505,15 +505,15 @@ hns3_dev_rss_reta_update(struct rte_eth_dev *dev, - struct hns3_adapter *hns = dev->data->dev_private; - struct hns3_hw *hw = &hns->hw; - struct hns3_rss_conf *rss_cfg = &hw->rss_info; -- uint16_t i, indir_size = HNS3_RSS_IND_TBL_SIZE; /* Table size is 512 */ -- uint16_t indirection_tbl[HNS3_RSS_IND_TBL_SIZE]; -+ uint16_t indirection_tbl[HNS3_RSS_IND_TBL_SIZE_MAX]; - uint16_t idx, shift; -+ uint16_t i; - int ret; - -- if (reta_size != indir_size || reta_size > ETH_RSS_RETA_SIZE_512) { -+ if (reta_size != hw->rss_ind_tbl_size) { - hns3_err(hw, "The size of hash lookup table configured (%u)" - "doesn't match the number hardware can supported" -- "(%u)", reta_size, indir_size); -+ "(%u)", reta_size, hw->rss_ind_tbl_size); - return -EINVAL; - } - rte_spinlock_lock(&hw->lock); -@@ -536,7 +536,7 @@ hns3_dev_rss_reta_update(struct rte_eth_dev *dev, - } - - ret = hns3_set_rss_indir_table(hw, indirection_tbl, -- HNS3_RSS_IND_TBL_SIZE); -+ hw->rss_ind_tbl_size); - - rte_spinlock_unlock(&hw->lock); - return ret; -@@ -561,13 +561,13 @@ hns3_dev_rss_reta_query(struct rte_eth_dev *dev, - struct hns3_adapter *hns = dev->data->dev_private; - struct hns3_hw *hw = &hns->hw; - struct hns3_rss_conf *rss_cfg = &hw->rss_info; -- uint16_t i, indir_size = HNS3_RSS_IND_TBL_SIZE; /* Table size is 512 */ - uint16_t idx, shift; -+ uint16_t i; - -- if (reta_size != indir_size || reta_size > ETH_RSS_RETA_SIZE_512) { -+ if (reta_size != hw->rss_ind_tbl_size) { - hns3_err(hw, "The size of hash lookup table configured (%u)" - " doesn't match the number hardware can supported" -- "(%u)", reta_size, indir_size); -+ "(%u)", reta_size, hw->rss_ind_tbl_size); - return -EINVAL; - } - rte_spinlock_lock(&hw->lock); -@@ -662,7 +662,7 @@ hns3_rss_set_default_args(struct hns3_hw *hw) - memcpy(rss_cfg->key, hns3_hash_key, HNS3_RSS_KEY_SIZE); - - /* Initialize RSS indirection table */ -- for (i = 0; i < HNS3_RSS_IND_TBL_SIZE; i++) -+ for (i = 0; i < hw->rss_ind_tbl_size; i++) - rss_cfg->rss_indirection_tbl[i] = i % queue_num; - } - -@@ -711,7 +711,7 @@ hns3_config_rss(struct hns3_adapter *hns) - */ - if (((uint32_t)mq_mode & ETH_MQ_RX_RSS_FLAG)) { - ret = hns3_set_rss_indir_table(hw, rss_cfg->rss_indirection_tbl, -- HNS3_RSS_IND_TBL_SIZE); -+ hw->rss_ind_tbl_size); - if (ret) - goto rss_tuple_uninit; - } -diff --git a/drivers/net/hns3/hns3_rss.h b/drivers/net/hns3/hns3_rss.h -index 05d5c26..94668ed 100644 ---- a/drivers/net/hns3/hns3_rss.h -+++ b/drivers/net/hns3/hns3_rss.h -@@ -24,9 +24,8 @@ - ETH_RSS_L4_DST_ONLY) - - #define HNS3_RSS_IND_TBL_SIZE 512 /* The size of hash lookup table */ -+#define HNS3_RSS_IND_TBL_SIZE_MAX 2048 - #define HNS3_RSS_KEY_SIZE 40 --#define HNS3_RSS_CFG_TBL_NUM \ -- (HNS3_RSS_IND_TBL_SIZE / HNS3_RSS_CFG_TBL_SIZE) - #define HNS3_RSS_SET_BITMAP_MSK 0xffff - - #define HNS3_RSS_HASH_ALGO_TOEPLITZ 0 -@@ -45,7 +44,7 @@ struct hns3_rss_conf { - uint8_t hash_algo; /* hash function type definited by hardware */ - uint8_t key[HNS3_RSS_KEY_SIZE]; /* Hash key */ - struct hns3_rss_tuple_cfg rss_tuple_sets; -- uint16_t rss_indirection_tbl[HNS3_RSS_IND_TBL_SIZE]; /* Shadow table */ -+ uint16_t rss_indirection_tbl[HNS3_RSS_IND_TBL_SIZE_MAX]; - uint16_t queue[HNS3_RSS_QUEUES_BUFFER_NUM]; /* Queues indices to use */ - bool valid; /* check if RSS rule is valid */ - /* --- -2.7.4 - diff --git a/0036-net-hns3-constrain-TM-peak-rate.patch b/0036-net-hns3-constrain-TM-peak-rate.patch deleted file mode 100644 index 9b5fd766c7954c49bf93970c9b6a1de5639bb592..0000000000000000000000000000000000000000 --- a/0036-net-hns3-constrain-TM-peak-rate.patch +++ /dev/null @@ -1,37 +0,0 @@ -From aefb4f06db3a837b7e93f8088c1d4882aa9a5041 Mon Sep 17 00:00:00 2001 -From: Chengwen Feng -Date: Wed, 3 Feb 2021 20:23:50 +0800 -Subject: [PATCH 036/189] net/hns3: constrain TM peak rate - -User could config Port or TC's peak rate by TM ops, but hardware does -not support peak rate which lower than 1Mbps. So we constraint TM -peak rate must be at least 1Mbps. - -Fixes: c09c7847d892 ("net/hns3: support traffic management") - -Signed-off-by: Chengwen Feng -Signed-off-by: Lijun Ou ---- - drivers/net/hns3/hns3_tm.c | 6 ++++++ - 1 file changed, 6 insertions(+) - -diff --git a/drivers/net/hns3/hns3_tm.c b/drivers/net/hns3/hns3_tm.c -index d1639d4..bcae57a 100644 ---- a/drivers/net/hns3/hns3_tm.c -+++ b/drivers/net/hns3/hns3_tm.c -@@ -200,6 +200,12 @@ hns3_tm_shaper_profile_param_check(struct rte_eth_dev *dev, - return -EINVAL; - } - -+ if (profile->peak.rate < hns3_tm_rate_convert_firmware2tm(1)) { -+ error->type = RTE_TM_ERROR_TYPE_SHAPER_PROFILE_PEAK_RATE; -+ error->message = "peak rate must be at least 1Mbps"; -+ return -EINVAL; -+ } -+ - if (profile->peak.size) { - error->type = RTE_TM_ERROR_TYPE_SHAPER_PROFILE_PEAK_SIZE; - error->message = "peak bucket size not supported"; --- -2.7.4 - diff --git a/0036-net-hns3-support-indirect-counter-flow-action.patch b/0036-net-hns3-support-indirect-counter-flow-action.patch new file mode 100644 index 0000000000000000000000000000000000000000..7251d4d2b2c64b9175572858ffd2607a12db3a68 --- /dev/null +++ b/0036-net-hns3-support-indirect-counter-flow-action.patch @@ -0,0 +1,367 @@ +From fdfcb94d8fb32364a999108baf1e4b835cd807fc Mon Sep 17 00:00:00 2001 +From: Chengwen Feng +Date: Sat, 22 Jan 2022 09:51:42 +0800 +Subject: [PATCH] net/hns3: support indirect counter flow action + +This patch support indirect counter action because the shared counter +attribute has been deprecated in DPDK 21.11. + +Signed-off-by: Chengwen Feng +Acked-by: Min Hu (Connor) +--- + drivers/net/hns3/hns3_fdir.h | 1 + + drivers/net/hns3/hns3_flow.c | 222 +++++++++++++++++++++++++++++++++-- + drivers/net/hns3/hns3_flow.h | 11 +- + 3 files changed, 224 insertions(+), 10 deletions(-) + +diff --git a/drivers/net/hns3/hns3_fdir.h b/drivers/net/hns3/hns3_fdir.h +index 07b393393d..8d588ffef3 100644 +--- a/drivers/net/hns3/hns3_fdir.h ++++ b/drivers/net/hns3/hns3_fdir.h +@@ -125,6 +125,7 @@ struct hns3_fd_ad_data { + #define HNS3_RULE_FLAG_FDID 0x1 + #define HNS3_RULE_FLAG_VF_ID 0x2 + #define HNS3_RULE_FLAG_COUNTER 0x4 ++#define HNS3_RULE_FLAG_COUNTER_INDIR 0x8 + + struct hns3_fdir_key_conf { + struct hns3_fd_rule_tuples spec; +diff --git a/drivers/net/hns3/hns3_flow.c b/drivers/net/hns3/hns3_flow.c +index 4f271a32dd..56ef6f57b2 100644 +--- a/drivers/net/hns3/hns3_flow.c ++++ b/drivers/net/hns3/hns3_flow.c +@@ -154,7 +154,7 @@ hns3_counter_lookup(struct rte_eth_dev *dev, uint32_t id) + } + + static int +-hns3_counter_new(struct rte_eth_dev *dev, uint32_t shared, uint32_t id, ++hns3_counter_new(struct rte_eth_dev *dev, uint32_t indirect, uint32_t id, + struct rte_flow_error *error) + { + struct hns3_adapter *hns = dev->data->dev_private; +@@ -166,11 +166,14 @@ hns3_counter_new(struct rte_eth_dev *dev, uint32_t shared, uint32_t id, + + cnt = hns3_counter_lookup(dev, id); + if (cnt) { +- if (!cnt->shared || cnt->shared != shared) ++ if (!cnt->indirect || cnt->indirect != indirect) + return rte_flow_error_set(error, ENOTSUP, + RTE_FLOW_ERROR_TYPE_ACTION_CONF, + cnt, +- "Counter id is used, shared flag not match"); ++ "Counter id is used, indirect flag not match"); ++ /* Clear the indirect counter on first use. */ ++ if (cnt->indirect && cnt->ref_cnt == 1) ++ (void)hns3_get_count(hw, id, &value); + cnt->ref_cnt++; + return 0; + } +@@ -188,7 +191,7 @@ hns3_counter_new(struct rte_eth_dev *dev, uint32_t shared, uint32_t id, + RTE_FLOW_ERROR_TYPE_HANDLE, cnt, + "Alloc mem for counter failed"); + cnt->id = id; +- cnt->shared = shared; ++ cnt->indirect = indirect; + cnt->ref_cnt = 1; + cnt->hits = 0; + LIST_INSERT_HEAD(&pf->flow_counters, cnt, next); +@@ -253,16 +256,30 @@ hns3_counter_release(struct rte_eth_dev *dev, uint32_t id) + static void + hns3_counter_flush(struct rte_eth_dev *dev) + { +- struct hns3_adapter *hns = dev->data->dev_private; +- struct hns3_pf *pf = &hns->pf; ++ struct hns3_pf *pf = HNS3_DEV_PRIVATE_TO_PF(dev->data->dev_private); ++ LIST_HEAD(counters, hns3_flow_counter) indir_counters; + struct hns3_flow_counter *cnt_ptr; + ++ LIST_INIT(&indir_counters); + cnt_ptr = LIST_FIRST(&pf->flow_counters); + while (cnt_ptr) { + LIST_REMOVE(cnt_ptr, next); +- rte_free(cnt_ptr); ++ if (cnt_ptr->indirect) ++ LIST_INSERT_HEAD(&indir_counters, cnt_ptr, next); ++ else ++ rte_free(cnt_ptr); + cnt_ptr = LIST_FIRST(&pf->flow_counters); + } ++ ++ /* Reset the indirect action and add to pf->flow_counters list. */ ++ cnt_ptr = LIST_FIRST(&indir_counters); ++ while (cnt_ptr) { ++ LIST_REMOVE(cnt_ptr, next); ++ cnt_ptr->ref_cnt = 1; ++ cnt_ptr->hits = 0; ++ LIST_INSERT_HEAD(&pf->flow_counters, cnt_ptr, next); ++ cnt_ptr = LIST_FIRST(&indir_counters); ++ } + } + + static int +@@ -332,6 +349,30 @@ hns3_handle_action_queue_region(struct rte_eth_dev *dev, + return 0; + } + ++static int ++hns3_handle_action_indirect(struct rte_eth_dev *dev, ++ const struct rte_flow_action *action, ++ struct hns3_fdir_rule *rule, ++ struct rte_flow_error *error) ++{ ++ const struct rte_flow_action_handle *indir = action->conf; ++ ++ if (indir->indirect_type != HNS3_INDIRECT_ACTION_TYPE_COUNT) ++ return rte_flow_error_set(error, EINVAL, ++ RTE_FLOW_ERROR_TYPE_ACTION_CONF, ++ action, "Invalid indirect type"); ++ ++ if (hns3_counter_lookup(dev, indir->counter_id) == NULL) ++ return rte_flow_error_set(error, EINVAL, ++ RTE_FLOW_ERROR_TYPE_ACTION_CONF, ++ action, "Counter id not exist"); ++ ++ rule->act_cnt.id = indir->counter_id; ++ rule->flags |= (HNS3_RULE_FLAG_COUNTER | HNS3_RULE_FLAG_COUNTER_INDIR); ++ ++ return 0; ++} ++ + /* + * Parse actions structure from the provided pattern. + * The pattern is validated as the items are copied. +@@ -403,6 +444,13 @@ hns3_handle_actions(struct rte_eth_dev *dev, + "Invalid counter id"); + rule->act_cnt = *act_count; + rule->flags |= HNS3_RULE_FLAG_COUNTER; ++ rule->flags &= ~HNS3_RULE_FLAG_COUNTER_INDIR; ++ break; ++ case RTE_FLOW_ACTION_TYPE_INDIRECT: ++ ret = hns3_handle_action_indirect(dev, actions, rule, ++ error); ++ if (ret) ++ return ret; + break; + case RTE_FLOW_ACTION_TYPE_VOID: + break; +@@ -1755,6 +1803,7 @@ hns3_flow_create_fdir_rule(struct rte_eth_dev *dev, + struct hns3_adapter *hns = HNS3_DEV_HW_TO_ADAPTER(hw); + struct hns3_fdir_rule_ele *fdir_rule_ptr; + struct hns3_fdir_rule fdir_rule; ++ bool indir; + int ret; + + memset(&fdir_rule, 0, sizeof(struct hns3_fdir_rule)); +@@ -1762,9 +1811,10 @@ hns3_flow_create_fdir_rule(struct rte_eth_dev *dev, + if (ret != 0) + return ret; + ++ indir = !!(fdir_rule.flags & HNS3_RULE_FLAG_COUNTER_INDIR); + if (fdir_rule.flags & HNS3_RULE_FLAG_COUNTER) { +- ret = hns3_counter_new(dev, 0, +- fdir_rule.act_cnt.id, error); ++ ret = hns3_counter_new(dev, indir, fdir_rule.act_cnt.id, ++ error); + if (ret != 0) + return ret; + +@@ -2086,6 +2136,157 @@ hns3_flow_query_wrap(struct rte_eth_dev *dev, struct rte_flow *flow, + return ret; + } + ++static int ++hns3_check_indir_action(const struct rte_flow_indir_action_conf *conf, ++ const struct rte_flow_action *action, ++ struct rte_flow_error *error) ++{ ++ if (!conf->ingress) ++ return rte_flow_error_set(error, EINVAL, ++ RTE_FLOW_ERROR_TYPE_ACTION, ++ NULL, "Indir action ingress can't be zero"); ++ ++ if (conf->egress) ++ return rte_flow_error_set(error, EINVAL, ++ RTE_FLOW_ERROR_TYPE_ACTION, ++ NULL, "Indir action not support egress"); ++ ++ if (conf->transfer) ++ return rte_flow_error_set(error, EINVAL, ++ RTE_FLOW_ERROR_TYPE_ACTION, ++ NULL, "Indir action not support transfer"); ++ ++ if (action->type != RTE_FLOW_ACTION_TYPE_COUNT) ++ return rte_flow_error_set(error, EINVAL, ++ RTE_FLOW_ERROR_TYPE_ACTION, ++ NULL, "Indir action only support count"); ++ ++ return 0; ++} ++ ++static struct rte_flow_action_handle * ++hns3_flow_action_create(struct rte_eth_dev *dev, ++ const struct rte_flow_indir_action_conf *conf, ++ const struct rte_flow_action *action, ++ struct rte_flow_error *error) ++{ ++ struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private); ++ struct hns3_pf *pf = HNS3_DEV_PRIVATE_TO_PF(dev->data->dev_private); ++ const struct rte_flow_action_count *act_count; ++ struct rte_flow_action_handle *handle = NULL; ++ struct hns3_flow_counter *counter; ++ ++ if (hns3_check_indir_action(conf, action, error)) ++ return NULL; ++ ++ handle = rte_zmalloc("hns3 action handle", ++ sizeof(struct rte_flow_action_handle), 0); ++ if (handle == NULL) { ++ rte_flow_error_set(error, ENOMEM, RTE_FLOW_ERROR_TYPE_HANDLE, ++ NULL, "Failed to allocate action memory"); ++ return NULL; ++ } ++ ++ pthread_mutex_lock(&hw->flows_lock); ++ ++ act_count = (const struct rte_flow_action_count *)action->conf; ++ if (act_count->id >= pf->fdir.fd_cfg.cnt_num[HNS3_FD_STAGE_1]) { ++ rte_flow_error_set(error, EINVAL, ++ RTE_FLOW_ERROR_TYPE_ACTION_CONF, ++ action, "Invalid counter id"); ++ goto err_exit; ++ } ++ ++ if (hns3_counter_new(dev, false, act_count->id, error)) ++ goto err_exit; ++ ++ counter = hns3_counter_lookup(dev, act_count->id); ++ if (counter == NULL) { ++ rte_flow_error_set(error, EINVAL, ++ RTE_FLOW_ERROR_TYPE_ACTION_CONF, ++ action, "Counter id not found"); ++ goto err_exit; ++ } ++ ++ counter->indirect = true; ++ handle->indirect_type = HNS3_INDIRECT_ACTION_TYPE_COUNT; ++ handle->counter_id = counter->id; ++ ++ pthread_mutex_unlock(&hw->flows_lock); ++ return handle; ++ ++err_exit: ++ pthread_mutex_unlock(&hw->flows_lock); ++ rte_free(handle); ++ return NULL; ++} ++ ++static int ++hns3_flow_action_destroy(struct rte_eth_dev *dev, ++ struct rte_flow_action_handle *handle, ++ struct rte_flow_error *error) ++{ ++ struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private); ++ struct hns3_flow_counter *counter; ++ ++ pthread_mutex_lock(&hw->flows_lock); ++ ++ if (handle->indirect_type != HNS3_INDIRECT_ACTION_TYPE_COUNT) { ++ pthread_mutex_unlock(&hw->flows_lock); ++ return rte_flow_error_set(error, EINVAL, ++ RTE_FLOW_ERROR_TYPE_ACTION_CONF, ++ handle, "Invalid indirect type"); ++ } ++ ++ counter = hns3_counter_lookup(dev, handle->counter_id); ++ if (counter == NULL) { ++ pthread_mutex_unlock(&hw->flows_lock); ++ return rte_flow_error_set(error, EINVAL, ++ RTE_FLOW_ERROR_TYPE_ACTION_CONF, ++ handle, "Counter id not exist"); ++ } ++ ++ if (counter->ref_cnt > 1) { ++ pthread_mutex_unlock(&hw->flows_lock); ++ return rte_flow_error_set(error, EBUSY, ++ RTE_FLOW_ERROR_TYPE_HANDLE, ++ handle, "Counter id in use"); ++ } ++ ++ (void)hns3_counter_release(dev, handle->counter_id); ++ rte_free(handle); ++ ++ pthread_mutex_unlock(&hw->flows_lock); ++ return 0; ++} ++ ++static int ++hns3_flow_action_query(struct rte_eth_dev *dev, ++ const struct rte_flow_action_handle *handle, ++ void *data, ++ struct rte_flow_error *error) ++{ ++ struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private); ++ struct rte_flow flow; ++ int ret; ++ ++ pthread_mutex_lock(&hw->flows_lock); ++ ++ if (handle->indirect_type != HNS3_INDIRECT_ACTION_TYPE_COUNT) { ++ pthread_mutex_unlock(&hw->flows_lock); ++ return rte_flow_error_set(error, EINVAL, ++ RTE_FLOW_ERROR_TYPE_ACTION_CONF, ++ handle, "Invalid indirect type"); ++ } ++ ++ memset(&flow, 0, sizeof(flow)); ++ flow.counter_id = handle->counter_id; ++ ret = hns3_counter_query(dev, &flow, ++ (struct rte_flow_query_count *)data, error); ++ pthread_mutex_unlock(&hw->flows_lock); ++ return ret; ++} ++ + static const struct rte_flow_ops hns3_flow_ops = { + .validate = hns3_flow_validate_wrap, + .create = hns3_flow_create_wrap, +@@ -2093,6 +2294,9 @@ static const struct rte_flow_ops hns3_flow_ops = { + .flush = hns3_flow_flush_wrap, + .query = hns3_flow_query_wrap, + .isolate = NULL, ++ .action_handle_create = hns3_flow_action_create, ++ .action_handle_destroy = hns3_flow_action_destroy, ++ .action_handle_query = hns3_flow_action_query, + }; + + int +diff --git a/drivers/net/hns3/hns3_flow.h b/drivers/net/hns3/hns3_flow.h +index 2eb451b720..1ab3f9f5c6 100644 +--- a/drivers/net/hns3/hns3_flow.h ++++ b/drivers/net/hns3/hns3_flow.h +@@ -9,7 +9,7 @@ + + struct hns3_flow_counter { + LIST_ENTRY(hns3_flow_counter) next; /* Pointer to the next counter. */ +- uint32_t shared:1; /* Share counter ID with other flow rules. */ ++ uint32_t indirect:1; /* Indirect counter flag */ + uint32_t ref_cnt:31; /* Reference counter. */ + uint16_t id; /* Counter ID. */ + uint64_t hits; /* Number of packets matched by the rule. */ +@@ -33,6 +33,15 @@ struct hns3_flow_mem { + struct rte_flow *flow; + }; + ++enum { ++ HNS3_INDIRECT_ACTION_TYPE_COUNT = 1, ++}; ++ ++struct rte_flow_action_handle { ++ int indirect_type; ++ uint32_t counter_id; ++}; ++ + TAILQ_HEAD(hns3_rss_filter_list, hns3_rss_conf_ele); + TAILQ_HEAD(hns3_flow_mem_list, hns3_flow_mem); + +-- +2.33.0 + diff --git a/0037-net-hns3-fix-max-packet-size-rollback-in-PF.patch b/0037-net-hns3-fix-max-packet-size-rollback-in-PF.patch new file mode 100644 index 0000000000000000000000000000000000000000..c825a461ae79c660681dd442cd5702fadb1cfa67 --- /dev/null +++ b/0037-net-hns3-fix-max-packet-size-rollback-in-PF.patch @@ -0,0 +1,63 @@ +From dc55ce9c6253664160b881a1b83b2b4f1e90a587 Mon Sep 17 00:00:00 2001 +From: Huisong Li +Date: Fri, 28 Jan 2022 10:07:03 +0800 +Subject: [PATCH] net/hns3: fix max packet size rollback in PF + +HNS3 PF driver use the hns->pf.mps to restore the MTU when a reset +occurs. +If user fails to configure the MTU, the MPS of PF may not be restored to +the original value. + +Fixes: 25fb790f7868 ("net/hns3: fix HW buffer size on MTU update") +Fixes: 1f5ca0b460cd ("net/hns3: support some device operations") +Fixes: d51867db65c1 ("net/hns3: add initialization") +Cc: stable@dpdk.org + +Signed-off-by: Huisong Li +Signed-off-by: Min Hu (Connor) +--- + drivers/net/hns3/hns3_ethdev.c | 11 ++++------- + 1 file changed, 4 insertions(+), 7 deletions(-) + +diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c +index a5114662d2..73bf209717 100644 +--- a/drivers/net/hns3/hns3_ethdev.c ++++ b/drivers/net/hns3/hns3_ethdev.c +@@ -2075,7 +2075,6 @@ static int + hns3_config_mtu(struct hns3_hw *hw, uint16_t mps) + { + struct hns3_adapter *hns = HNS3_DEV_HW_TO_ADAPTER(hw); +- uint16_t original_mps = hns->pf.mps; + int err; + int ret; + +@@ -2085,22 +2084,20 @@ hns3_config_mtu(struct hns3_hw *hw, uint16_t mps) + return ret; + } + +- hns->pf.mps = mps; + ret = hns3_buffer_alloc(hw); + if (ret) { + hns3_err(hw, "failed to allocate buffer, ret = %d", ret); + goto rollback; + } + ++ hns->pf.mps = mps; ++ + return 0; + + rollback: +- err = hns3_set_mac_mtu(hw, original_mps); +- if (err) { ++ err = hns3_set_mac_mtu(hw, hns->pf.mps); ++ if (err) + hns3_err(hw, "fail to rollback MTU, err = %d", err); +- return ret; +- } +- hns->pf.mps = original_mps; + + return ret; + } +-- +2.33.0 + diff --git a/0037-net-hns3-remove-MPLS-from-supported-flow-items.patch b/0037-net-hns3-remove-MPLS-from-supported-flow-items.patch deleted file mode 100644 index 1f1525d15d1fbcf2052858ca4125850292472303..0000000000000000000000000000000000000000 --- a/0037-net-hns3-remove-MPLS-from-supported-flow-items.patch +++ /dev/null @@ -1,54 +0,0 @@ -From 93de9a96a68093772f0137a9899616cfd8cea0c6 Mon Sep 17 00:00:00 2001 -From: Chengwen Feng -Date: Wed, 3 Feb 2021 20:23:51 +0800 -Subject: [PATCH 037/189] net/hns3: remove MPLS from supported flow items - -The Kunpeng920 and Kunpeng930 don't support parse MPLS packet, so -remove the type from supported flow items. - -Fixes: fcba820d9b9e ("net/hns3: support flow director") -Cc: stable@dpdk.org - -Signed-off-by: Chengwen Feng -Signed-off-by: Lijun Ou ---- - drivers/net/hns3/hns3_flow.c | 9 +++------ - 1 file changed, 3 insertions(+), 6 deletions(-) - -diff --git a/drivers/net/hns3/hns3_flow.c b/drivers/net/hns3/hns3_flow.c -index a601124..c484114 100644 ---- a/drivers/net/hns3/hns3_flow.c -+++ b/drivers/net/hns3/hns3_flow.c -@@ -44,8 +44,7 @@ static enum rte_flow_item_type first_items[] = { - RTE_FLOW_ITEM_TYPE_NVGRE, - RTE_FLOW_ITEM_TYPE_VXLAN, - RTE_FLOW_ITEM_TYPE_GENEVE, -- RTE_FLOW_ITEM_TYPE_VXLAN_GPE, -- RTE_FLOW_ITEM_TYPE_MPLS -+ RTE_FLOW_ITEM_TYPE_VXLAN_GPE - }; - - static enum rte_flow_item_type L2_next_items[] = { -@@ -65,8 +64,7 @@ static enum rte_flow_item_type L3_next_items[] = { - static enum rte_flow_item_type L4_next_items[] = { - RTE_FLOW_ITEM_TYPE_VXLAN, - RTE_FLOW_ITEM_TYPE_GENEVE, -- RTE_FLOW_ITEM_TYPE_VXLAN_GPE, -- RTE_FLOW_ITEM_TYPE_MPLS -+ RTE_FLOW_ITEM_TYPE_VXLAN_GPE - }; - - static enum rte_flow_item_type tunnel_next_items[] = { -@@ -1118,8 +1116,7 @@ is_tunnel_packet(enum rte_flow_item_type type) - if (type == RTE_FLOW_ITEM_TYPE_VXLAN_GPE || - type == RTE_FLOW_ITEM_TYPE_VXLAN || - type == RTE_FLOW_ITEM_TYPE_NVGRE || -- type == RTE_FLOW_ITEM_TYPE_GENEVE || -- type == RTE_FLOW_ITEM_TYPE_MPLS) -+ type == RTE_FLOW_ITEM_TYPE_GENEVE) - return true; - return false; - } --- -2.7.4 - diff --git a/0038-net-hns3-fix-RSS-key-with-null.patch b/0038-net-hns3-fix-RSS-key-with-null.patch new file mode 100644 index 0000000000000000000000000000000000000000..e96ce2813afb292eea9a1a445ea13b9bc1f653f4 --- /dev/null +++ b/0038-net-hns3-fix-RSS-key-with-null.patch @@ -0,0 +1,57 @@ +From ca937bfe5f48de028c25312bcdb30ec1a6a4cd8e Mon Sep 17 00:00:00 2001 +From: Lijun Ou +Date: Fri, 28 Jan 2022 10:07:04 +0800 +Subject: [PATCH] net/hns3: fix RSS key with null + +Since the patch '1848b117' has initialized the variable 'key' in +'struct rte_flow_action_rss' with 'NULL', the PMD will use the +default RSS key when create the first RSS rule with NULL RSS key. +Then, if create a repeated RSS rule with the above, it will not +identify duplicate rules and return an error message. + +To solve the preceding problem, determine whether the current RSS keys +are the same based on whether the length of key_len of rss is 0. + +Fixes: 1848b117cca1 ("app/testpmd: fix RSS key for flow API RSS rule") +Cc: stable@dpdk.org + +Signed-off-by: Lijun Ou +--- + drivers/net/hns3/hns3_flow.c | 12 +++++++++--- + 1 file changed, 9 insertions(+), 3 deletions(-) + +diff --git a/drivers/net/hns3/hns3_flow.c b/drivers/net/hns3/hns3_flow.c +index 56ef6f57b2..aba07aaa6f 100644 +--- a/drivers/net/hns3/hns3_flow.c ++++ b/drivers/net/hns3/hns3_flow.c +@@ -1286,6 +1286,7 @@ static bool + hns3_action_rss_same(const struct rte_flow_action_rss *comp, + const struct rte_flow_action_rss *with) + { ++ bool rss_key_is_same; + bool func_is_same; + + /* +@@ -1302,11 +1303,16 @@ hns3_action_rss_same(const struct rte_flow_action_rss *comp, + func_is_same = (with->func != RTE_ETH_HASH_FUNCTION_DEFAULT) ? + (comp->func == with->func) : true; + +- return (func_is_same && ++ if (with->key_len == 0 || with->key == NULL) ++ rss_key_is_same = 1; ++ else ++ rss_key_is_same = comp->key_len == with->key_len && ++ !memcmp(comp->key, with->key, with->key_len); ++ ++ return (func_is_same && rss_key_is_same && + comp->types == (with->types & HNS3_ETH_RSS_SUPPORT) && +- comp->level == with->level && comp->key_len == with->key_len && ++ comp->level == with->level && + comp->queue_num == with->queue_num && +- !memcmp(comp->key, with->key, with->key_len) && + !memcmp(comp->queue, with->queue, + sizeof(*with->queue) * with->queue_num)); + } +-- +2.33.0 + diff --git a/0038-net-hns3-fix-stats-flip-overflow.patch b/0038-net-hns3-fix-stats-flip-overflow.patch deleted file mode 100644 index 9aa09acf92f757e2356218630457c64cb011a93d..0000000000000000000000000000000000000000 --- a/0038-net-hns3-fix-stats-flip-overflow.patch +++ /dev/null @@ -1,67 +0,0 @@ -From a2524d07bf2f71c925d363fbb7fcfc6d7def57c4 Mon Sep 17 00:00:00 2001 -From: Chengchang Tang -Date: Wed, 3 Feb 2021 20:23:52 +0800 -Subject: [PATCH 038/189] net/hns3: fix stats flip overflow - -Currently, statistics may overflow in some scenarios. - -For example, if HW statistics are reset by stats reset operation, -but there are still a lot of residual packets exist in the HW -queues and these packets are error packets, flip may occurred -because the ipacket is obtained by subtracting the number of -software error packets from the number of HW received packets. - -This patch verifies the calculation and returns 0 when overflow -may occur. - -Fixes: 8839c5e202f3 ("net/hns3: support device stats") -Cc: stable@dpdk.org - -Signed-off-by: Chengchang Tang -Signed-off-by: Lijun Ou ---- - drivers/net/hns3/hns3_stats.c | 21 +++++++++++++++++---- - 1 file changed, 17 insertions(+), 4 deletions(-) - -diff --git a/drivers/net/hns3/hns3_stats.c b/drivers/net/hns3/hns3_stats.c -index 3ba09e2..e0e40ca 100644 ---- a/drivers/net/hns3/hns3_stats.c -+++ b/drivers/net/hns3/hns3_stats.c -@@ -554,8 +554,14 @@ hns3_stats_get(struct rte_eth_dev *eth_dev, struct rte_eth_stats *rte_stats) - } - - rte_stats->oerrors = 0; -- rte_stats->ipackets = stats->rcb_rx_ring_pktnum_rcd - -- rte_stats->ierrors; -+ /* -+ * If HW statistics are reset by stats_reset, but a lot of residual -+ * packets exist in the hardware queue and these packets are error -+ * packets, flip overflow may occurred. So return 0 in this case. -+ */ -+ rte_stats->ipackets = -+ stats->rcb_rx_ring_pktnum_rcd > rte_stats->ierrors ? -+ stats->rcb_rx_ring_pktnum_rcd - rte_stats->ierrors : 0; - rte_stats->opackets = stats->rcb_tx_ring_pktnum_rcd - - rte_stats->oerrors; - rte_stats->rx_nombuf = eth_dev->data->rx_mbuf_alloc_failed; -@@ -792,8 +798,15 @@ hns3_rxq_basic_stats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *xstats, - rxq_stats = &rxq->basic_stats; - rxq_stats->errors = rxq->err_stats.l2_errors + - rxq->err_stats.pkt_len_errors; -- rxq_stats->packets = stats->rcb_rx_ring_pktnum[i] - -- rxq_stats->errors; -+ /* -+ * If HW statistics are reset by stats_reset, but a lot of -+ * residual packets exist in the hardware queue and these -+ * packets are error packets, flip overflow may occurred. -+ * So return 0 in this case. -+ */ -+ rxq_stats->packets = -+ stats->rcb_rx_ring_pktnum[i] > rxq_stats->errors ? -+ stats->rcb_rx_ring_pktnum[i] - rxq_stats->errors : 0; - rxq_stats->bytes = 0; - for (j = 0; j < HNS3_NUM_RXQ_BASIC_STATS; j++) { - val = (char *)rxq_stats + --- -2.7.4 - diff --git a/0039-net-hns3-fix-insecure-way-to-query-MAC-statistics.patch b/0039-net-hns3-fix-insecure-way-to-query-MAC-statistics.patch new file mode 100644 index 0000000000000000000000000000000000000000..da6c6f55b55a711906fadc360531ca1d1c7e2def --- /dev/null +++ b/0039-net-hns3-fix-insecure-way-to-query-MAC-statistics.patch @@ -0,0 +1,271 @@ +From a29f3b66f858a7e2fabcb6b557aea7bde17d41fb Mon Sep 17 00:00:00 2001 +From: Huisong Li +Date: Fri, 28 Jan 2022 10:07:05 +0800 +Subject: [PATCH] net/hns3: fix insecure way to query MAC statistics + +The query way of MAC statistics in HNS3 PF driver is as following: +1) get MAC statistics register number and calculate descriptor number. +2) use above descriptor number to send command to firmware to query all + MAC statistics and copy to hns3_mac_stats struct in driver. + +The preceding way does not verify the validity of the number of obtained +register, which may cause memory out-of-bounds. + +Fixes: 8839c5e202f3 ("net/hns3: support device stats") +Cc: stable@dpdk.org + +Signed-off-by: Huisong Li +Signed-off-by: Min Hu (Connor) +--- + drivers/net/hns3/hns3_ethdev.c | 4 ++ + drivers/net/hns3/hns3_ethdev.h | 1 + + drivers/net/hns3/hns3_stats.c | 116 ++++++++++++++++----------------- + drivers/net/hns3/hns3_stats.h | 11 ++-- + 4 files changed, 65 insertions(+), 67 deletions(-) + +diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c +index 73bf209717..57f1572340 100644 +--- a/drivers/net/hns3/hns3_ethdev.c ++++ b/drivers/net/hns3/hns3_ethdev.c +@@ -2733,6 +2733,10 @@ hns3_get_capability(struct hns3_hw *hw) + if (ret) + return ret; + ++ ret = hns3_query_mac_stats_reg_num(hw); ++ if (ret) ++ return ret; ++ + if (hw->revision < PCI_REVISION_ID_HIP09_A) { + hns3_set_default_dev_specifications(hw); + hw->intr.mapping_mode = HNS3_INTR_MAPPING_VEC_RSV_ONE; +diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h +index cf6380ebb2..ef028a7b2c 100644 +--- a/drivers/net/hns3/hns3_ethdev.h ++++ b/drivers/net/hns3/hns3_ethdev.h +@@ -500,6 +500,7 @@ struct hns3_hw { + struct hns3_tqp_stats tqp_stats; + /* Include Mac stats | Rx stats | Tx stats */ + struct hns3_mac_stats mac_stats; ++ uint32_t mac_stats_reg_num; + struct hns3_rx_missed_stats imissed_stats; + uint64_t oerror_stats; + uint32_t fw_version; +diff --git a/drivers/net/hns3/hns3_stats.c b/drivers/net/hns3/hns3_stats.c +index 606b72509a..806720faff 100644 +--- a/drivers/net/hns3/hns3_stats.c ++++ b/drivers/net/hns3/hns3_stats.c +@@ -307,24 +307,21 @@ static const struct hns3_xstats_name_offset hns3_imissed_stats_strings[] = { + + static void hns3_tqp_stats_clear(struct hns3_hw *hw); + +-/* +- * Query all the MAC statistics data of Network ICL command ,opcode id: 0x0034. +- * This command is used before send 'query_mac_stat command', the descriptor +- * number of 'query_mac_stat command' must match with reg_num in this command. +- * @praram hw +- * Pointer to structure hns3_hw. +- * @return +- * 0 on success. +- */ + static int +-hns3_update_mac_stats(struct hns3_hw *hw, const uint32_t desc_num) ++hns3_update_mac_stats(struct hns3_hw *hw) + { ++#define HNS3_MAC_STATS_REG_NUM_PER_DESC 4 ++ + uint64_t *data = (uint64_t *)(&hw->mac_stats); + struct hns3_cmd_desc *desc; ++ uint32_t stats_iterms; + uint64_t *desc_data; +- uint16_t i, k, n; ++ uint32_t desc_num; ++ uint16_t i; + int ret; + ++ /* The first desc has a 64-bit header, so need to consider it. */ ++ desc_num = hw->mac_stats_reg_num / HNS3_MAC_STATS_REG_NUM_PER_DESC + 1; + desc = rte_malloc("hns3_mac_desc", + desc_num * sizeof(struct hns3_cmd_desc), 0); + if (desc == NULL) { +@@ -340,65 +337,71 @@ hns3_update_mac_stats(struct hns3_hw *hw, const uint32_t desc_num) + return ret; + } + +- for (i = 0; i < desc_num; i++) { +- /* For special opcode 0034, only the first desc has the head */ +- if (i == 0) { +- desc_data = (uint64_t *)(&desc[i].data[0]); +- n = HNS3_RD_FIRST_STATS_NUM; +- } else { +- desc_data = (uint64_t *)(&desc[i]); +- n = HNS3_RD_OTHER_STATS_NUM; +- } +- +- for (k = 0; k < n; k++) { +- *data += rte_le_to_cpu_64(*desc_data); +- data++; +- desc_data++; +- } ++ stats_iterms = RTE_MIN(sizeof(hw->mac_stats) / sizeof(uint64_t), ++ hw->mac_stats_reg_num); ++ desc_data = (uint64_t *)(&desc[0].data[0]); ++ for (i = 0; i < stats_iterms; i++) { ++ /* ++ * Data memory is continuous and only the first descriptor has a ++ * header in this command. ++ */ ++ *data += rte_le_to_cpu_64(*desc_data); ++ data++; ++ desc_data++; + } + rte_free(desc); + + return 0; + } + +-/* +- * Query Mac stat reg num command ,opcode id: 0x0033. +- * This command is used before send 'query_mac_stat command', the descriptor +- * number of 'query_mac_stat command' must match with reg_num in this command. +- * @praram rte_stats +- * Pointer to structure rte_eth_stats. +- * @return +- * 0 on success. +- */ + static int +-hns3_mac_query_reg_num(struct rte_eth_dev *dev, uint32_t *desc_num) ++hns3_mac_query_reg_num(struct hns3_hw *hw, uint32_t *reg_num) + { +- struct hns3_adapter *hns = dev->data->dev_private; +- struct hns3_hw *hw = &hns->hw; ++#define HNS3_MAC_STATS_RSV_REG_NUM_ON_HIP08_B 3 + struct hns3_cmd_desc desc; +- uint32_t *desc_data; +- uint32_t reg_num; + int ret; + + hns3_cmd_setup_basic_desc(&desc, HNS3_OPC_QUERY_MAC_REG_NUM, true); + ret = hns3_cmd_send(hw, &desc, 1); +- if (ret) ++ if (ret) { ++ hns3_err(hw, "failed to query MAC statistic reg number, ret = %d", ++ ret); + return ret; ++ } + +- /* +- * The num of MAC statistics registers that are provided by IMP in this +- * version. +- */ +- desc_data = (uint32_t *)(&desc.data[0]); +- reg_num = rte_le_to_cpu_32(*desc_data); ++ /* The number of MAC statistics registers are provided by firmware. */ ++ *reg_num = rte_le_to_cpu_32(desc.data[0]); ++ if (*reg_num == 0) { ++ hns3_err(hw, "MAC statistic reg number is invalid!"); ++ return -ENODATA; ++ } + + /* +- * The descriptor number of 'query_additional_mac_stat command' is +- * '1 + (reg_num-3)/4 + ((reg_num-3)%4 !=0)'; +- * This value is 83 in this version ++ * If driver doesn't request the firmware to report more MAC statistics ++ * iterms and the total number of MAC statistics registers by using new ++ * method, firmware will only reports the number of valid statistics ++ * registers. However, structure hns3_mac_stats in driver contains valid ++ * and reserved statistics iterms. In this case, the total register ++ * number must be added to three reserved statistics registers. + */ +- *desc_num = 1 + ((reg_num - 3) >> 2) + +- (uint32_t)(((reg_num - 3) & 0x3) ? 1 : 0); ++ *reg_num += HNS3_MAC_STATS_RSV_REG_NUM_ON_HIP08_B; ++ ++ return 0; ++} ++ ++int ++hns3_query_mac_stats_reg_num(struct hns3_hw *hw) ++{ ++ uint32_t mac_stats_reg_num = 0; ++ int ret; ++ ++ ret = hns3_mac_query_reg_num(hw, &mac_stats_reg_num); ++ if (ret) ++ return ret; ++ ++ hw->mac_stats_reg_num = mac_stats_reg_num; ++ if (hw->mac_stats_reg_num > sizeof(hw->mac_stats) / sizeof(uint64_t)) ++ hns3_warn(hw, "MAC stats reg number from firmware is greater than stats iterms in driver."); + + return 0; + } +@@ -408,15 +411,8 @@ hns3_query_update_mac_stats(struct rte_eth_dev *dev) + { + struct hns3_adapter *hns = dev->data->dev_private; + struct hns3_hw *hw = &hns->hw; +- uint32_t desc_num; +- int ret; + +- ret = hns3_mac_query_reg_num(dev, &desc_num); +- if (ret == 0) +- ret = hns3_update_mac_stats(hw, desc_num); +- else +- hns3_err(hw, "Query mac reg num fail : %d", ret); +- return ret; ++ return hns3_update_mac_stats(hw); + } + + static int +diff --git a/drivers/net/hns3/hns3_stats.h b/drivers/net/hns3/hns3_stats.h +index d1230f94cb..c81d351082 100644 +--- a/drivers/net/hns3/hns3_stats.h ++++ b/drivers/net/hns3/hns3_stats.h +@@ -5,11 +5,6 @@ + #ifndef _HNS3_STATS_H_ + #define _HNS3_STATS_H_ + +-/* stats macro */ +-#define HNS3_MAC_CMD_NUM 21 +-#define HNS3_RD_FIRST_STATS_NUM 2 +-#define HNS3_RD_OTHER_STATS_NUM 4 +- + /* TQP stats */ + struct hns3_tqp_stats { + uint64_t rcb_tx_ring_pktnum_rcd; /* Total num of transmitted packets */ +@@ -22,6 +17,7 @@ struct hns3_tqp_stats { + struct hns3_mac_stats { + uint64_t mac_tx_mac_pause_num; + uint64_t mac_rx_mac_pause_num; ++ uint64_t rsv0; + uint64_t mac_tx_pfc_pri0_pkt_num; + uint64_t mac_tx_pfc_pri1_pkt_num; + uint64_t mac_tx_pfc_pri2_pkt_num; +@@ -58,7 +54,7 @@ struct hns3_mac_stats { + uint64_t mac_tx_1519_2047_oct_pkt_num; + uint64_t mac_tx_2048_4095_oct_pkt_num; + uint64_t mac_tx_4096_8191_oct_pkt_num; +- uint64_t rsv0; ++ uint64_t rsv1; + uint64_t mac_tx_8192_9216_oct_pkt_num; + uint64_t mac_tx_9217_12287_oct_pkt_num; + uint64_t mac_tx_12288_16383_oct_pkt_num; +@@ -85,7 +81,7 @@ struct hns3_mac_stats { + uint64_t mac_rx_1519_2047_oct_pkt_num; + uint64_t mac_rx_2048_4095_oct_pkt_num; + uint64_t mac_rx_4096_8191_oct_pkt_num; +- uint64_t rsv1; ++ uint64_t rsv2; + uint64_t mac_rx_8192_9216_oct_pkt_num; + uint64_t mac_rx_9217_12287_oct_pkt_num; + uint64_t mac_rx_12288_16383_oct_pkt_num; +@@ -168,5 +164,6 @@ int hns3_stats_reset(struct rte_eth_dev *dev); + int hns3_tqp_stats_init(struct hns3_hw *hw); + void hns3_tqp_stats_uninit(struct hns3_hw *hw); + int hns3_update_imissed_stats(struct hns3_hw *hw, bool is_clear); ++int hns3_query_mac_stats_reg_num(struct hns3_hw *hw); + + #endif /* _HNS3_STATS_H_ */ +-- +2.33.0 + diff --git a/0039-net-hns3-use-C11-atomics.patch b/0039-net-hns3-use-C11-atomics.patch deleted file mode 100644 index 804e5336f2f896a2d2ff6f78cb8cb2678395bd7b..0000000000000000000000000000000000000000 --- a/0039-net-hns3-use-C11-atomics.patch +++ /dev/null @@ -1,338 +0,0 @@ -From 458bb9377c72010ed41f4d2faedad2bd08562cd1 Mon Sep 17 00:00:00 2001 -From: Chengchang Tang -Date: Wed, 3 Feb 2021 20:23:53 +0800 -Subject: [PATCH 039/189] net/hns3: use C11 atomics - -Replace all the atomic type with C11 atomic builtins in hns3 -PMD. - -Signed-off-by: Chengchang Tang -Signed-off-by: Lijun Ou ---- - drivers/net/hns3/hns3_cmd.c | 13 +++++++------ - drivers/net/hns3/hns3_ethdev.c | 21 ++++++++++++--------- - drivers/net/hns3/hns3_ethdev.h | 4 ++-- - drivers/net/hns3/hns3_ethdev_vf.c | 19 +++++++++++-------- - drivers/net/hns3/hns3_intr.c | 22 ++++++++++++++-------- - drivers/net/hns3/hns3_mbx.c | 4 ++-- - 6 files changed, 48 insertions(+), 35 deletions(-) - -diff --git a/drivers/net/hns3/hns3_cmd.c b/drivers/net/hns3/hns3_cmd.c -index a6ea072..9393978 100644 ---- a/drivers/net/hns3/hns3_cmd.c -+++ b/drivers/net/hns3/hns3_cmd.c -@@ -202,7 +202,8 @@ hns3_cmd_csq_clean(struct hns3_hw *hw) - hns3_err(hw, "wrong cmd head (%u, %u-%u)", head, - csq->next_to_use, csq->next_to_clean); - if (rte_eal_process_type() == RTE_PROC_PRIMARY) { -- rte_atomic16_set(&hw->reset.disable_cmd, 1); -+ __atomic_store_n(&hw->reset.disable_cmd, 1, -+ __ATOMIC_RELAXED); - hns3_schedule_delayed_reset(HNS3_DEV_HW_TO_ADAPTER(hw)); - } - -@@ -311,7 +312,7 @@ static int hns3_cmd_poll_reply(struct hns3_hw *hw) - if (hns3_cmd_csq_done(hw)) - return 0; - -- if (rte_atomic16_read(&hw->reset.disable_cmd)) { -+ if (__atomic_load_n(&hw->reset.disable_cmd, __ATOMIC_RELAXED)) { - hns3_err(hw, - "Don't wait for reply because of disable_cmd"); - return -EBUSY; -@@ -358,7 +359,7 @@ hns3_cmd_send(struct hns3_hw *hw, struct hns3_cmd_desc *desc, int num) - int retval; - uint32_t ntc; - -- if (rte_atomic16_read(&hw->reset.disable_cmd)) -+ if (__atomic_load_n(&hw->reset.disable_cmd, __ATOMIC_RELAXED)) - return -EBUSY; - - rte_spinlock_lock(&hw->cmq.csq.lock); -@@ -535,7 +536,7 @@ hns3_cmd_init(struct hns3_hw *hw) - ret = -EBUSY; - goto err_cmd_init; - } -- rte_atomic16_clear(&hw->reset.disable_cmd); -+ __atomic_store_n(&hw->reset.disable_cmd, 0, __ATOMIC_RELAXED); - - ret = hns3_cmd_query_firmware_version_and_capability(hw); - if (ret) { -@@ -557,7 +558,7 @@ hns3_cmd_init(struct hns3_hw *hw) - return 0; - - err_cmd_init: -- rte_atomic16_set(&hw->reset.disable_cmd, 1); -+ __atomic_store_n(&hw->reset.disable_cmd, 1, __ATOMIC_RELAXED); - return ret; - } - -@@ -583,7 +584,7 @@ hns3_cmd_uninit(struct hns3_hw *hw) - { - rte_spinlock_lock(&hw->cmq.csq.lock); - rte_spinlock_lock(&hw->cmq.crq.lock); -- rte_atomic16_set(&hw->reset.disable_cmd, 1); -+ __atomic_store_n(&hw->reset.disable_cmd, 1, __ATOMIC_RELAXED); - hns3_cmd_clear_regs(hw); - rte_spinlock_unlock(&hw->cmq.crq.lock); - rte_spinlock_unlock(&hw->cmq.csq.lock); -diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c -index df7220b..f54b7c2 100644 ---- a/drivers/net/hns3/hns3_ethdev.c -+++ b/drivers/net/hns3/hns3_ethdev.c -@@ -130,7 +130,7 @@ hns3_proc_imp_reset_event(struct hns3_adapter *hns, bool is_delay, - { - struct hns3_hw *hw = &hns->hw; - -- rte_atomic16_set(&hw->reset.disable_cmd, 1); -+ __atomic_store_n(&hw->reset.disable_cmd, 1, __ATOMIC_RELAXED); - hns3_atomic_set_bit(HNS3_IMP_RESET, &hw->reset.pending); - *vec_val = BIT(HNS3_VECTOR0_IMPRESET_INT_B); - if (!is_delay) { -@@ -150,7 +150,7 @@ hns3_proc_global_reset_event(struct hns3_adapter *hns, bool is_delay, - { - struct hns3_hw *hw = &hns->hw; - -- rte_atomic16_set(&hw->reset.disable_cmd, 1); -+ __atomic_store_n(&hw->reset.disable_cmd, 1, __ATOMIC_RELAXED); - hns3_atomic_set_bit(HNS3_GLOBAL_RESET, &hw->reset.pending); - *vec_val = BIT(HNS3_VECTOR0_GLOBALRESET_INT_B); - if (!is_delay) { -@@ -5070,7 +5070,7 @@ hns3_do_stop(struct hns3_adapter *hns) - return ret; - hw->mac.link_status = ETH_LINK_DOWN; - -- if (rte_atomic16_read(&hw->reset.disable_cmd) == 0) { -+ if (__atomic_load_n(&hw->reset.disable_cmd, __ATOMIC_RELAXED) == 0) { - hns3_configure_all_mac_addr(hns, true); - ret = hns3_reset_all_tqps(hns); - if (ret) { -@@ -5613,7 +5613,7 @@ hns3_prepare_reset(struct hns3_adapter *hns) - * any mailbox handling or command to firmware is only valid - * after hns3_cmd_init is called. - */ -- rte_atomic16_set(&hw->reset.disable_cmd, 1); -+ __atomic_store_n(&hw->reset.disable_cmd, 1, __ATOMIC_RELAXED); - hw->reset.stats.request_cnt++; - break; - case HNS3_IMP_RESET: -@@ -5673,7 +5673,7 @@ hns3_stop_service(struct hns3_adapter *hns) - * from table space. Hence, for function reset software intervention is - * required to delete the entries - */ -- if (rte_atomic16_read(&hw->reset.disable_cmd) == 0) -+ if (__atomic_load_n(&hw->reset.disable_cmd, __ATOMIC_RELAXED) == 0) - hns3_configure_all_mc_mac_addr(hns, true); - rte_spinlock_unlock(&hw->lock); - -@@ -5795,8 +5795,10 @@ hns3_reset_service(void *param) - * The interrupt may have been lost. It is necessary to handle - * the interrupt to recover from the error. - */ -- if (rte_atomic16_read(&hns->hw.reset.schedule) == SCHEDULE_DEFERRED) { -- rte_atomic16_set(&hns->hw.reset.schedule, SCHEDULE_REQUESTED); -+ if (__atomic_load_n(&hw->reset.schedule, __ATOMIC_RELAXED) == -+ SCHEDULE_DEFERRED) { -+ __atomic_store_n(&hw->reset.schedule, SCHEDULE_REQUESTED, -+ __ATOMIC_RELAXED); - hns3_err(hw, "Handling interrupts in delayed tasks"); - hns3_interrupt_handler(&rte_eth_devices[hw->data->port_id]); - reset_level = hns3_get_reset_level(hns, &hw->reset.pending); -@@ -5805,7 +5807,7 @@ hns3_reset_service(void *param) - hns3_atomic_set_bit(HNS3_IMP_RESET, &hw->reset.pending); - } - } -- rte_atomic16_set(&hns->hw.reset.schedule, SCHEDULE_NONE); -+ __atomic_store_n(&hw->reset.schedule, SCHEDULE_NONE, __ATOMIC_RELAXED); - - /* - * Check if there is any ongoing reset in the hardware. This status can -@@ -6325,7 +6327,8 @@ hns3_dev_init(struct rte_eth_dev *eth_dev) - - hw->adapter_state = HNS3_NIC_INITIALIZED; - -- if (rte_atomic16_read(&hns->hw.reset.schedule) == SCHEDULE_PENDING) { -+ if (__atomic_load_n(&hw->reset.schedule, __ATOMIC_RELAXED) == -+ SCHEDULE_PENDING) { - hns3_err(hw, "Reschedule reset service after dev_init"); - hns3_schedule_reset(hns); - } else { -diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h -index 547e991..cf42ef1 100644 ---- a/drivers/net/hns3/hns3_ethdev.h -+++ b/drivers/net/hns3/hns3_ethdev.h -@@ -352,11 +352,11 @@ enum hns3_schedule { - - struct hns3_reset_data { - enum hns3_reset_stage stage; -- rte_atomic16_t schedule; -+ uint16_t schedule; - /* Reset flag, covering the entire reset process */ - uint16_t resetting; - /* Used to disable sending cmds during reset */ -- rte_atomic16_t disable_cmd; -+ uint16_t disable_cmd; - /* The reset level being processed */ - enum hns3_reset_level level; - /* Reset level set, each bit represents a reset level */ -diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c -index 1b1989e..42cee37 100644 ---- a/drivers/net/hns3/hns3_ethdev_vf.c -+++ b/drivers/net/hns3/hns3_ethdev_vf.c -@@ -1059,7 +1059,7 @@ hns3vf_check_event_cause(struct hns3_adapter *hns, uint32_t *clearval) - rst_ing_reg = hns3_read_dev(hw, HNS3_FUN_RST_ING); - hns3_warn(hw, "resetting reg: 0x%x", rst_ing_reg); - hns3_atomic_set_bit(HNS3_VF_RESET, &hw->reset.pending); -- rte_atomic16_set(&hw->reset.disable_cmd, 1); -+ __atomic_store_n(&hw->reset.disable_cmd, 1, __ATOMIC_RELAXED); - val = hns3_read_dev(hw, HNS3_VF_RST_ING); - hns3_write_dev(hw, HNS3_VF_RST_ING, val | HNS3_VF_RST_ING_BIT); - val = cmdq_stat_reg & ~BIT(HNS3_VECTOR0_RST_INT_B); -@@ -1934,7 +1934,7 @@ hns3vf_do_stop(struct hns3_adapter *hns) - - hw->mac.link_status = ETH_LINK_DOWN; - -- if (rte_atomic16_read(&hw->reset.disable_cmd) == 0) { -+ if (__atomic_load_n(&hw->reset.disable_cmd, __ATOMIC_RELAXED) == 0) { - hns3vf_configure_mac_addr(hns, true); - ret = hns3_reset_all_tqps(hns); - if (ret) { -@@ -2410,7 +2410,7 @@ hns3vf_prepare_reset(struct hns3_adapter *hns) - ret = hns3_send_mbx_msg(hw, HNS3_MBX_RESET, 0, NULL, - 0, true, NULL, 0); - } -- rte_atomic16_set(&hw->reset.disable_cmd, 1); -+ __atomic_store_n(&hw->reset.disable_cmd, 1, __ATOMIC_RELAXED); - - return ret; - } -@@ -2449,7 +2449,7 @@ hns3vf_stop_service(struct hns3_adapter *hns) - * from table space. Hence, for function reset software intervention is - * required to delete the entries. - */ -- if (rte_atomic16_read(&hw->reset.disable_cmd) == 0) -+ if (__atomic_load_n(&hw->reset.disable_cmd, __ATOMIC_RELAXED) == 0) - hns3vf_configure_all_mc_mac_addr(hns, true); - rte_spinlock_unlock(&hw->lock); - -@@ -2621,8 +2621,10 @@ hns3vf_reset_service(void *param) - * The interrupt may have been lost. It is necessary to handle - * the interrupt to recover from the error. - */ -- if (rte_atomic16_read(&hns->hw.reset.schedule) == SCHEDULE_DEFERRED) { -- rte_atomic16_set(&hns->hw.reset.schedule, SCHEDULE_REQUESTED); -+ if (__atomic_load_n(&hw->reset.schedule, __ATOMIC_RELAXED) == -+ SCHEDULE_DEFERRED) { -+ __atomic_store_n(&hw->reset.schedule, SCHEDULE_REQUESTED, -+ __ATOMIC_RELAXED); - hns3_err(hw, "Handling interrupts in delayed tasks"); - hns3vf_interrupt_handler(&rte_eth_devices[hw->data->port_id]); - reset_level = hns3vf_get_reset_level(hw, &hw->reset.pending); -@@ -2631,7 +2633,7 @@ hns3vf_reset_service(void *param) - hns3_atomic_set_bit(HNS3_VF_RESET, &hw->reset.pending); - } - } -- rte_atomic16_set(&hns->hw.reset.schedule, SCHEDULE_NONE); -+ __atomic_store_n(&hw->reset.schedule, SCHEDULE_NONE, __ATOMIC_RELAXED); - - /* - * Hardware reset has been notified, we now have to poll & check if -@@ -2854,7 +2856,8 @@ hns3vf_dev_init(struct rte_eth_dev *eth_dev) - - hw->adapter_state = HNS3_NIC_INITIALIZED; - -- if (rte_atomic16_read(&hns->hw.reset.schedule) == SCHEDULE_PENDING) { -+ if (__atomic_load_n(&hw->reset.schedule, __ATOMIC_RELAXED) == -+ SCHEDULE_PENDING) { - hns3_err(hw, "Reschedule reset service after dev_init"); - hns3_schedule_reset(hns); - } else { -diff --git a/drivers/net/hns3/hns3_intr.c b/drivers/net/hns3/hns3_intr.c -index 51f19b4..88ce4c6 100644 ---- a/drivers/net/hns3/hns3_intr.c -+++ b/drivers/net/hns3/hns3_intr.c -@@ -1762,7 +1762,7 @@ hns3_reset_init(struct hns3_hw *hw) - hw->reset.request = 0; - hw->reset.pending = 0; - hw->reset.resetting = 0; -- rte_atomic16_init(&hw->reset.disable_cmd); -+ __atomic_store_n(&hw->reset.disable_cmd, 0, __ATOMIC_RELAXED); - hw->reset.wait_data = rte_zmalloc("wait_data", - sizeof(struct hns3_wait_data), 0); - if (!hw->reset.wait_data) { -@@ -1779,7 +1779,8 @@ hns3_schedule_reset(struct hns3_adapter *hns) - - /* Reschedule the reset process after successful initialization */ - if (hw->adapter_state == HNS3_NIC_UNINITIALIZED) { -- rte_atomic16_set(&hns->hw.reset.schedule, SCHEDULE_PENDING); -+ __atomic_store_n(&hw->reset.schedule, SCHEDULE_PENDING, -+ __ATOMIC_RELAXED); - return; - } - -@@ -1787,11 +1788,14 @@ hns3_schedule_reset(struct hns3_adapter *hns) - return; - - /* Schedule restart alarm if it is not scheduled yet */ -- if (rte_atomic16_read(&hns->hw.reset.schedule) == SCHEDULE_REQUESTED) -+ if (__atomic_load_n(&hw->reset.schedule, __ATOMIC_RELAXED) == -+ SCHEDULE_REQUESTED) - return; -- if (rte_atomic16_read(&hns->hw.reset.schedule) == SCHEDULE_DEFERRED) -+ if (__atomic_load_n(&hw->reset.schedule, __ATOMIC_RELAXED) == -+ SCHEDULE_DEFERRED) - rte_eal_alarm_cancel(hw->reset.ops->reset_service, hns); -- rte_atomic16_set(&hns->hw.reset.schedule, SCHEDULE_REQUESTED); -+ __atomic_store_n(&hw->reset.schedule, SCHEDULE_REQUESTED, -+ __ATOMIC_RELAXED); - - rte_eal_alarm_set(SWITCH_CONTEXT_US, hw->reset.ops->reset_service, hns); - } -@@ -1808,9 +1812,11 @@ hns3_schedule_delayed_reset(struct hns3_adapter *hns) - return; - } - -- if (rte_atomic16_read(&hns->hw.reset.schedule) != SCHEDULE_NONE) -+ if (__atomic_load_n(&hw->reset.schedule, __ATOMIC_RELAXED) != -+ SCHEDULE_NONE) - return; -- rte_atomic16_set(&hns->hw.reset.schedule, SCHEDULE_DEFERRED); -+ __atomic_store_n(&hw->reset.schedule, SCHEDULE_DEFERRED, -+ __ATOMIC_RELAXED); - rte_eal_alarm_set(DEFERRED_SCHED_US, hw->reset.ops->reset_service, hns); - } - -@@ -1983,7 +1989,7 @@ hns3_reset_err_handle(struct hns3_adapter *hns) - * Regardless of whether the execution is successful or not, the - * flow after execution must be continued. - */ -- if (rte_atomic16_read(&hw->reset.disable_cmd)) -+ if (__atomic_load_n(&hw->reset.disable_cmd, __ATOMIC_RELAXED)) - (void)hns3_cmd_init(hw); - reset_fail: - hw->reset.attempts = 0; -diff --git a/drivers/net/hns3/hns3_mbx.c b/drivers/net/hns3/hns3_mbx.c -index 3e44e3b..e745843 100644 ---- a/drivers/net/hns3/hns3_mbx.c -+++ b/drivers/net/hns3/hns3_mbx.c -@@ -83,7 +83,7 @@ hns3_get_mbx_resp(struct hns3_hw *hw, uint16_t code0, uint16_t code1, - end = now + HNS3_MAX_RETRY_MS; - while ((hw->mbx_resp.head != hw->mbx_resp.tail + hw->mbx_resp.lost) && - (now < end)) { -- if (rte_atomic16_read(&hw->reset.disable_cmd)) { -+ if (__atomic_load_n(&hw->reset.disable_cmd, __ATOMIC_RELAXED)) { - hns3_err(hw, "Don't wait for mbx respone because of " - "disable_cmd"); - return -EBUSY; -@@ -369,7 +369,7 @@ hns3_dev_handle_mbx_msg(struct hns3_hw *hw) - int i; - - while (!hns3_cmd_crq_empty(hw)) { -- if (rte_atomic16_read(&hw->reset.disable_cmd)) -+ if (__atomic_load_n(&hw->reset.disable_cmd, __ATOMIC_RELAXED)) - return; - - desc = &crq->desc[crq->next_to_use]; --- -2.7.4 - diff --git a/0040-net-hns3-fix-double-decrement-of-secondary-count.patch b/0040-net-hns3-fix-double-decrement-of-secondary-count.patch new file mode 100644 index 0000000000000000000000000000000000000000..e6121907471b9e80b45cd728b03b8c582a9374b0 --- /dev/null +++ b/0040-net-hns3-fix-double-decrement-of-secondary-count.patch @@ -0,0 +1,33 @@ +From eb0bbc8fbec6bb10dfcfdca470dc413038e8608c Mon Sep 17 00:00:00 2001 +From: Huisong Li +Date: Fri, 28 Jan 2022 10:07:06 +0800 +Subject: [PATCH] net/hns3: fix double decrement of secondary count + +The "secondary_cnt" indicates the number of secondary processes on an +Ethernet device. But the variable is double subtracted when detach the +device in secondary processes. + +Fixes: ff6dc76e40b8 ("net/hns3: refactor multi-process initialization") +Cc: stable@dpdk.org + +Signed-off-by: Huisong Li +Signed-off-by: Min Hu (Connor) +--- + drivers/net/hns3/hns3_ethdev_vf.c | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c +index 1af2e07e81..dab1130dad 100644 +--- a/drivers/net/hns3/hns3_ethdev_vf.c ++++ b/drivers/net/hns3/hns3_ethdev_vf.c +@@ -2399,7 +2399,6 @@ hns3vf_dev_uninit(struct rte_eth_dev *eth_dev) + PMD_INIT_FUNC_TRACE(); + + if (rte_eal_process_type() != RTE_PROC_PRIMARY) { +- __atomic_fetch_sub(&hw->secondary_cnt, 1, __ATOMIC_RELAXED); + hns3_mp_uninit(eth_dev); + return 0; + } +-- +2.33.0 + diff --git a/0040-net-hns3-fix-flow-director-rule-residue-on-malloc-fa.patch b/0040-net-hns3-fix-flow-director-rule-residue-on-malloc-fa.patch deleted file mode 100644 index 8332e2f20c9c1b2df55f61c7c44af9895c78f3b4..0000000000000000000000000000000000000000 --- a/0040-net-hns3-fix-flow-director-rule-residue-on-malloc-fa.patch +++ /dev/null @@ -1,65 +0,0 @@ -From 2b24ee3f6acfaa8170a37022aab4b5b93d4dc0ae Mon Sep 17 00:00:00 2001 -From: Chengwen Feng -Date: Wed, 3 Feb 2021 20:23:54 +0800 -Subject: [PATCH 040/189] net/hns3: fix flow director rule residue on malloc - failure - -After FD rule config success, driver will malloc fdir_rule to hold the -rule info, if malloc fail the FD rule in hardware was not cleanup. - -Fixes: fcba820d9b9e ("net/hns3: support flow director") -Cc: stable@dpdk.org - -Signed-off-by: Chengwen Feng -Signed-off-by: Lijun Ou ---- - drivers/net/hns3/hns3_flow.c | 21 +++++++++++---------- - 1 file changed, 11 insertions(+), 10 deletions(-) - -diff --git a/drivers/net/hns3/hns3_flow.c b/drivers/net/hns3/hns3_flow.c -index c484114..a016857 100644 ---- a/drivers/net/hns3/hns3_flow.c -+++ b/drivers/net/hns3/hns3_flow.c -@@ -1806,17 +1806,18 @@ hns3_flow_create(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, - - flow->counter_id = fdir_rule.act_cnt.id; - } -+ -+ fdir_rule_ptr = rte_zmalloc("hns3 fdir rule", -+ sizeof(struct hns3_fdir_rule_ele), -+ 0); -+ if (fdir_rule_ptr == NULL) { -+ hns3_err(hw, "failed to allocate fdir_rule memory."); -+ ret = -ENOMEM; -+ goto err_fdir; -+ } -+ - ret = hns3_fdir_filter_program(hns, &fdir_rule, false); - if (!ret) { -- fdir_rule_ptr = rte_zmalloc("hns3 fdir rule", -- sizeof(struct hns3_fdir_rule_ele), -- 0); -- if (fdir_rule_ptr == NULL) { -- hns3_err(hw, "Failed to allocate fdir_rule memory"); -- ret = -ENOMEM; -- goto err_fdir; -- } -- - memcpy(&fdir_rule_ptr->fdir_conf, &fdir_rule, - sizeof(struct hns3_fdir_rule)); - TAILQ_INSERT_TAIL(&process_list->fdir_list, -@@ -1827,10 +1828,10 @@ hns3_flow_create(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, - return flow; - } - -+ rte_free(fdir_rule_ptr); - err_fdir: - if (fdir_rule.flags & HNS3_RULE_FLAG_COUNTER) - hns3_counter_release(dev, fdir_rule.act_cnt.id); -- - err: - rte_flow_error_set(error, -ret, RTE_FLOW_ERROR_TYPE_HANDLE, NULL, - "Failed to create flow"); --- -2.7.4 - diff --git a/0041-net-hns3-fix-firmware-exceptions-by-concurrent-comma.patch b/0041-net-hns3-fix-firmware-exceptions-by-concurrent-comma.patch deleted file mode 100644 index 0a053a8e74d44e95733e5ebe11871cf2e864e8e0..0000000000000000000000000000000000000000 --- a/0041-net-hns3-fix-firmware-exceptions-by-concurrent-comma.patch +++ /dev/null @@ -1,76 +0,0 @@ -From 50cb4151490c7814418be61cc54d45ad335c11aa Mon Sep 17 00:00:00 2001 -From: Chengchang Tang -Date: Wed, 3 Feb 2021 20:23:55 +0800 -Subject: [PATCH 041/189] net/hns3: fix firmware exceptions by concurrent - commands - -There are two scenarios that command queue uninit performed -concurrently with the firmware command: asynchronous command -and timeout command. - -For asynchronous command, if a large number of functions send -commands, these commands may need to be queued to wait for -firmware processing. If a function is uninited suddenly, CMDQ -clearing and firmware processing may be performed concurrently. - -For timeout command, if the command failed due to busy scheduling -of firmware, this command will be processed in the next scheduling. -And this may lead to concurrency. - -The preceding concurrency may lead to a firmware exceptions. - -This patch add a waiting time to ensure the firmware complete the -processing of left over command when PMD uninit. - -Fixes: 737f30e1c3ab ("net/hns3: support command interface with firmware") -Cc: stable@dpdk.org - -Signed-off-by: Chengchang Tang -Signed-off-by: Lijun Ou ---- - drivers/net/hns3/hns3_cmd.c | 14 +++++++++++++- - drivers/net/hns3/hns3_cmd.h | 1 + - 2 files changed, 14 insertions(+), 1 deletion(-) - -diff --git a/drivers/net/hns3/hns3_cmd.c b/drivers/net/hns3/hns3_cmd.c -index 9393978..0590898 100644 ---- a/drivers/net/hns3/hns3_cmd.c -+++ b/drivers/net/hns3/hns3_cmd.c -@@ -582,9 +582,21 @@ hns3_cmd_destroy_queue(struct hns3_hw *hw) - void - hns3_cmd_uninit(struct hns3_hw *hw) - { -+ __atomic_store_n(&hw->reset.disable_cmd, 1, __ATOMIC_RELAXED); -+ -+ /* -+ * A delay is added to ensure that the register cleanup operations -+ * will not be performed concurrently with the firmware command and -+ * ensure that all the reserved commands are executed. -+ * Concurrency may occur in two scenarios: asynchronous command and -+ * timeout command. If the command fails to be executed due to busy -+ * scheduling, the command will be processed in the next scheduling -+ * of the firmware. -+ */ -+ rte_delay_ms(HNS3_CMDQ_CLEAR_WAIT_TIME); -+ - rte_spinlock_lock(&hw->cmq.csq.lock); - rte_spinlock_lock(&hw->cmq.crq.lock); -- __atomic_store_n(&hw->reset.disable_cmd, 1, __ATOMIC_RELAXED); - hns3_cmd_clear_regs(hw); - rte_spinlock_unlock(&hw->cmq.crq.lock); - rte_spinlock_unlock(&hw->cmq.csq.lock); -diff --git a/drivers/net/hns3/hns3_cmd.h b/drivers/net/hns3/hns3_cmd.h -index 5640fe4..5010278 100644 ---- a/drivers/net/hns3/hns3_cmd.h -+++ b/drivers/net/hns3/hns3_cmd.h -@@ -8,6 +8,7 @@ - #include - - #define HNS3_CMDQ_TX_TIMEOUT 30000 -+#define HNS3_CMDQ_CLEAR_WAIT_TIME 200 - #define HNS3_CMDQ_RX_INVLD_B 0 - #define HNS3_CMDQ_RX_OUTVLD_B 1 - #define HNS3_CMD_DESC_ALIGNMENT 4096 --- -2.7.4 - diff --git a/0041-net-hns3-fix-operating-queue-when-TCAM-table-is-inva.patch b/0041-net-hns3-fix-operating-queue-when-TCAM-table-is-inva.patch new file mode 100644 index 0000000000000000000000000000000000000000..95b77f7c492b34ec9d1a677417a47fbce10c3c2b --- /dev/null +++ b/0041-net-hns3-fix-operating-queue-when-TCAM-table-is-inva.patch @@ -0,0 +1,57 @@ +From 1c73c33c5ff07ac2a369f0d796e5892ed504e0d3 Mon Sep 17 00:00:00 2001 +From: Huisong Li +Date: Fri, 28 Jan 2022 10:07:07 +0800 +Subject: [PATCH] net/hns3: fix operating queue when TCAM table is invalid + +Reset queues will query the TCAM table. The table is cleared after global +or imp reset. Currently, PF driver first resets Rx/Tx queues and then +restore the table during the reset recovery process, which will fail to +query the table and trigger a RAS error. + +Fixes: fa29fe45a7b4 ("net/hns3: support queue start and stop") +Cc: stable@dpdk.org + +Signed-off-by: Huisong Li +Signed-off-by: Min Hu (Connor) +--- + drivers/net/hns3/hns3_ethdev.c | 12 ++++++++---- + 1 file changed, 8 insertions(+), 4 deletions(-) + +diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c +index 57f1572340..2641b6f79b 100644 +--- a/drivers/net/hns3/hns3_ethdev.c ++++ b/drivers/net/hns3/hns3_ethdev.c +@@ -4378,6 +4378,10 @@ hns3_init_hardware(struct hns3_adapter *hns) + struct hns3_hw *hw = &hns->hw; + int ret; + ++ /* ++ * All queue-related HW operations must be performed after the TCAM ++ * table is configured. ++ */ + ret = hns3_map_tqp(hw); + if (ret) { + PMD_INIT_LOG(ERR, "Failed to map tqp: %d", ret); +@@ -5547,15 +5551,15 @@ hns3_reinit_dev(struct hns3_adapter *hns) + return ret; + } + +- ret = hns3_reset_all_tqps(hns); ++ ret = hns3_init_hardware(hns); + if (ret) { +- hns3_err(hw, "Failed to reset all queues: %d", ret); ++ hns3_err(hw, "Failed to init hardware: %d", ret); + return ret; + } + +- ret = hns3_init_hardware(hns); ++ ret = hns3_reset_all_tqps(hns); + if (ret) { +- hns3_err(hw, "Failed to init hardware: %d", ret); ++ hns3_err(hw, "Failed to reset all queues: %d", ret); + return ret; + } + +-- +2.33.0 + diff --git a/0042-net-hns3-delete-duplicated-RSS-type.patch b/0042-net-hns3-delete-duplicated-RSS-type.patch new file mode 100644 index 0000000000000000000000000000000000000000..3adec9379a0817f9e7b5a021fc45c65c19d6d60f --- /dev/null +++ b/0042-net-hns3-delete-duplicated-RSS-type.patch @@ -0,0 +1,35 @@ +From 6c3c017f980084daef4ddafd111e9ed9aa9619c3 Mon Sep 17 00:00:00 2001 +From: Chengwen Feng +Date: Fri, 28 Jan 2022 10:07:08 +0800 +Subject: [PATCH] net/hns3: delete duplicated RSS type + +The hns3_set_rss_types hold two IPV4_TCP items, this patch deletes +duplicate item. + +Fixes: 806f1d5ab0e3 ("net/hns3: set RSS hash type input configuration") +Cc: stable@dpdk.org + +Signed-off-by: Chengwen Feng +Signed-off-by: Min Hu (Connor) +--- + drivers/net/hns3/hns3_rss.c | 4 ---- + 1 file changed, 4 deletions(-) + +diff --git a/drivers/net/hns3/hns3_rss.c b/drivers/net/hns3/hns3_rss.c +index 3a4b699ae2..1782d63883 100644 +--- a/drivers/net/hns3/hns3_rss.c ++++ b/drivers/net/hns3/hns3_rss.c +@@ -152,10 +152,6 @@ static const struct { + BIT_ULL(HNS3_RSS_FIELD_IPV4_TCP_EN_IP_D) | + BIT_ULL(HNS3_RSS_FIELD_IPV4_TCP_EN_TCP_S) | + BIT_ULL(HNS3_RSS_FIELD_IPV4_TCP_EN_TCP_D) }, +- { RTE_ETH_RSS_NONFRAG_IPV4_TCP, BIT_ULL(HNS3_RSS_FIELD_IPV4_TCP_EN_IP_S) | +- BIT_ULL(HNS3_RSS_FIELD_IPV4_TCP_EN_IP_D) | +- BIT_ULL(HNS3_RSS_FIELD_IPV4_TCP_EN_TCP_S) | +- BIT_ULL(HNS3_RSS_FIELD_IPV4_TCP_EN_TCP_D) }, + { RTE_ETH_RSS_NONFRAG_IPV4_UDP, BIT_ULL(HNS3_RSS_FIELD_IPV4_UDP_EN_IP_S) | + BIT_ULL(HNS3_RSS_FIELD_IPV4_UDP_EN_IP_D) | + BIT_ULL(HNS3_RSS_FIELD_IPV4_UDP_EN_UDP_S) | +-- +2.33.0 + diff --git a/0042-net-hns3-fix-VF-reset-on-mailbox-failure.patch b/0042-net-hns3-fix-VF-reset-on-mailbox-failure.patch deleted file mode 100644 index 58533e7ca4ddcad4a1d9f3da5c4b646b63101dcf..0000000000000000000000000000000000000000 --- a/0042-net-hns3-fix-VF-reset-on-mailbox-failure.patch +++ /dev/null @@ -1,50 +0,0 @@ -From 6ceabcab7a4b103f854f338486c1d9fd08349e90 Mon Sep 17 00:00:00 2001 -From: Chengchang Tang -Date: Wed, 3 Feb 2021 20:23:56 +0800 -Subject: [PATCH 042/189] net/hns3: fix VF reset on mailbox failure - -Currently, during the VF reset, the VF will send a MBX to inform -PF to reset it and the disable command bit will be set whether -the MBX is successful. Generally, multiple reset attempts are made -after a failure. However, because the command is disabled, all -subsequent reset will all fail. - -This patch disable the command only after the MBX message is -successfully. - -Fixes: 2790c6464725 ("net/hns3: support device reset") -Cc: stable@dpdk.org - -Signed-off-by: Chengchang Tang -Signed-off-by: Lijun Ou ---- - drivers/net/hns3/hns3_ethdev_vf.c | 6 ++++-- - 1 file changed, 4 insertions(+), 2 deletions(-) - -diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c -index 42cee37..fc9f3c8 100644 ---- a/drivers/net/hns3/hns3_ethdev_vf.c -+++ b/drivers/net/hns3/hns3_ethdev_vf.c -@@ -2404,15 +2404,17 @@ static int - hns3vf_prepare_reset(struct hns3_adapter *hns) - { - struct hns3_hw *hw = &hns->hw; -- int ret = 0; -+ int ret; - - if (hw->reset.level == HNS3_VF_FUNC_RESET) { - ret = hns3_send_mbx_msg(hw, HNS3_MBX_RESET, 0, NULL, - 0, true, NULL, 0); -+ if (ret) -+ return ret; - } - __atomic_store_n(&hw->reset.disable_cmd, 1, __ATOMIC_RELAXED); - -- return ret; -+ return 0; - } - - static int --- -2.7.4 - diff --git a/0043-net-bonding-fix-promiscuous-and-allmulticast-state.patch b/0043-net-bonding-fix-promiscuous-and-allmulticast-state.patch new file mode 100644 index 0000000000000000000000000000000000000000..94183f77659bb25843237bd43c88ab9040678125 --- /dev/null +++ b/0043-net-bonding-fix-promiscuous-and-allmulticast-state.patch @@ -0,0 +1,130 @@ +From 905b76987bd194e1356e6fe79949b5119c30f842 Mon Sep 17 00:00:00 2001 +From: "Min Hu (Connor)" +Date: Fri, 28 Jan 2022 10:25:32 +0800 +Subject: [PATCH] net/bonding: fix promiscuous and allmulticast state + +Currently, promiscuous or allmulticast state of bonding port will not be +passed to the new primary slave when active/standby switch-over. It +causes bugs in some scenario. + +For example, promiscuous state of bonding port is off now, primary slave +(called A) is off but secondary slave(called B) is on. +Then active/standby switch-over, promiscuous state of the bonding port +is off, but the new primary slave turns to be B and its promiscuous +state is still on. +It is not consistent with bonding port. And this patch will fix it. + +Fixes: 2efb58cbab6e ("bond: new link bonding library") +Fixes: 68218b87c184 ("net/bonding: prefer allmulti to promiscuous for LACP") +Cc: stable@dpdk.org + +Signed-off-by: Min Hu (Connor) +--- + drivers/net/bonding/rte_eth_bond_pmd.c | 70 ++++++++++++++++++++++++++ + 1 file changed, 70 insertions(+) + +diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c +index e5abe90e07..d2fcfad676 100644 +--- a/drivers/net/bonding/rte_eth_bond_pmd.c ++++ b/drivers/net/bonding/rte_eth_bond_pmd.c +@@ -2691,6 +2691,39 @@ bond_ethdev_promiscuous_disable(struct rte_eth_dev *dev) + return ret; + } + ++static int ++bond_ethdev_promiscuous_update(struct rte_eth_dev *dev) ++{ ++ struct bond_dev_private *internals = dev->data->dev_private; ++ uint16_t port_id = internals->current_primary_port; ++ ++ switch (internals->mode) { ++ case BONDING_MODE_ROUND_ROBIN: ++ case BONDING_MODE_BALANCE: ++ case BONDING_MODE_BROADCAST: ++ case BONDING_MODE_8023AD: ++ /* As promiscuous mode is propagated to all slaves for these ++ * mode, no need to update for bonding device. ++ */ ++ break; ++ case BONDING_MODE_ACTIVE_BACKUP: ++ case BONDING_MODE_TLB: ++ case BONDING_MODE_ALB: ++ default: ++ /* As promiscuous mode is propagated only to primary slave ++ * for these mode. When active/standby switchover, promiscuous ++ * mode should be set to new primary slave according to bonding ++ * device. ++ */ ++ if (rte_eth_promiscuous_get(internals->port_id) == 1) ++ rte_eth_promiscuous_enable(port_id); ++ else ++ rte_eth_promiscuous_disable(port_id); ++ } ++ ++ return 0; ++} ++ + static int + bond_ethdev_allmulticast_enable(struct rte_eth_dev *eth_dev) + { +@@ -2804,6 +2837,39 @@ bond_ethdev_allmulticast_disable(struct rte_eth_dev *eth_dev) + return ret; + } + ++static int ++bond_ethdev_allmulticast_update(struct rte_eth_dev *dev) ++{ ++ struct bond_dev_private *internals = dev->data->dev_private; ++ uint16_t port_id = internals->current_primary_port; ++ ++ switch (internals->mode) { ++ case BONDING_MODE_ROUND_ROBIN: ++ case BONDING_MODE_BALANCE: ++ case BONDING_MODE_BROADCAST: ++ case BONDING_MODE_8023AD: ++ /* As allmulticast mode is propagated to all slaves for these ++ * mode, no need to update for bonding device. ++ */ ++ break; ++ case BONDING_MODE_ACTIVE_BACKUP: ++ case BONDING_MODE_TLB: ++ case BONDING_MODE_ALB: ++ default: ++ /* As allmulticast mode is propagated only to primary slave ++ * for these mode. When active/standby switchover, allmulticast ++ * mode should be set to new primary slave according to bonding ++ * device. ++ */ ++ if (rte_eth_allmulticast_get(internals->port_id) == 1) ++ rte_eth_allmulticast_enable(port_id); ++ else ++ rte_eth_allmulticast_disable(port_id); ++ } ++ ++ return 0; ++} ++ + static void + bond_ethdev_delayed_lsc_propagation(void *arg) + { +@@ -2893,6 +2959,8 @@ bond_ethdev_lsc_event_callback(uint16_t port_id, enum rte_eth_event_type type, + lsc_flag = 1; + + mac_address_slaves_update(bonded_eth_dev); ++ bond_ethdev_promiscuous_update(bonded_eth_dev); ++ bond_ethdev_allmulticast_update(bonded_eth_dev); + } + + activate_slave(bonded_eth_dev, port_id); +@@ -2922,6 +2990,8 @@ bond_ethdev_lsc_event_callback(uint16_t port_id, enum rte_eth_event_type type, + else + internals->current_primary_port = internals->primary_port; + mac_address_slaves_update(bonded_eth_dev); ++ bond_ethdev_promiscuous_update(bonded_eth_dev); ++ bond_ethdev_allmulticast_update(bonded_eth_dev); + } + } + +-- +2.33.0 + diff --git a/0043-net-hns3-validate-requested-maximum-Rx-frame-length.patch b/0043-net-hns3-validate-requested-maximum-Rx-frame-length.patch deleted file mode 100644 index a352dce3855403279853537f17ea91dfb79c1d52..0000000000000000000000000000000000000000 --- a/0043-net-hns3-validate-requested-maximum-Rx-frame-length.patch +++ /dev/null @@ -1,98 +0,0 @@ -From 835880a4bec5fc2fd64d199f3a899e2864c11252 Mon Sep 17 00:00:00 2001 -From: Huisong Li -Date: Wed, 3 Feb 2021 20:23:57 +0800 -Subject: [PATCH 043/189] net/hns3: validate requested maximum Rx frame length - -When jumbo frame is enabled, the MTU size needs to be modified -based on 'max_rx_pkt_len'. Driver needs to check the validity -of 'max_rx_pkt_len'. And it should be in the range of -HNS3_DEFAULT_FRAME_LEN and HNS3_MAX_FRAME_LEN. Otherwise, it may -cause that the MTU size is inconsistent with jumbo frame offload. - -Fixes: 19a3ca4c99cf ("net/hns3: add start/stop and configure operations") -Cc: stable@dpdk.org - -Signed-off-by: Huisong Li -Signed-off-by: Lijun Ou ---- - drivers/net/hns3/hns3_ethdev.c | 19 +++++++++++++------ - drivers/net/hns3/hns3_ethdev_vf.c | 19 +++++++++++++------ - 2 files changed, 26 insertions(+), 12 deletions(-) - -diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c -index f54b7c2..7ed55b1 100644 ---- a/drivers/net/hns3/hns3_ethdev.c -+++ b/drivers/net/hns3/hns3_ethdev.c -@@ -2343,6 +2343,7 @@ hns3_dev_configure(struct rte_eth_dev *dev) - uint16_t nb_rx_q = dev->data->nb_rx_queues; - uint16_t nb_tx_q = dev->data->nb_tx_queues; - struct rte_eth_rss_conf rss_conf; -+ uint32_t max_rx_pkt_len; - uint16_t mtu; - bool gro_en; - int ret; -@@ -2396,12 +2397,18 @@ hns3_dev_configure(struct rte_eth_dev *dev) - * according to the maximum RX packet length. - */ - if (conf->rxmode.offloads & DEV_RX_OFFLOAD_JUMBO_FRAME) { -- /* -- * Security of max_rx_pkt_len is guaranteed in dpdk frame. -- * Maximum value of max_rx_pkt_len is HNS3_MAX_FRAME_LEN, so it -- * can safely assign to "uint16_t" type variable. -- */ -- mtu = (uint16_t)HNS3_PKTLEN_TO_MTU(conf->rxmode.max_rx_pkt_len); -+ max_rx_pkt_len = conf->rxmode.max_rx_pkt_len; -+ if (max_rx_pkt_len > HNS3_MAX_FRAME_LEN || -+ max_rx_pkt_len <= HNS3_DEFAULT_FRAME_LEN) { -+ hns3_err(hw, "maximum Rx packet length must be greater " -+ "than %u and less than %u when jumbo frame enabled.", -+ (uint16_t)HNS3_DEFAULT_FRAME_LEN, -+ (uint16_t)HNS3_MAX_FRAME_LEN); -+ ret = -EINVAL; -+ goto cfg_err; -+ } -+ -+ mtu = (uint16_t)HNS3_PKTLEN_TO_MTU(max_rx_pkt_len); - ret = hns3_dev_mtu_set(dev, mtu); - if (ret) - goto cfg_err; -diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c -index fc9f3c8..d5157cf 100644 ---- a/drivers/net/hns3/hns3_ethdev_vf.c -+++ b/drivers/net/hns3/hns3_ethdev_vf.c -@@ -778,6 +778,7 @@ hns3vf_dev_configure(struct rte_eth_dev *dev) - uint16_t nb_rx_q = dev->data->nb_rx_queues; - uint16_t nb_tx_q = dev->data->nb_tx_queues; - struct rte_eth_rss_conf rss_conf; -+ uint32_t max_rx_pkt_len; - uint16_t mtu; - bool gro_en; - int ret; -@@ -825,12 +826,18 @@ hns3vf_dev_configure(struct rte_eth_dev *dev) - * according to the maximum RX packet length. - */ - if (conf->rxmode.offloads & DEV_RX_OFFLOAD_JUMBO_FRAME) { -- /* -- * Security of max_rx_pkt_len is guaranteed in dpdk frame. -- * Maximum value of max_rx_pkt_len is HNS3_MAX_FRAME_LEN, so it -- * can safely assign to "uint16_t" type variable. -- */ -- mtu = (uint16_t)HNS3_PKTLEN_TO_MTU(conf->rxmode.max_rx_pkt_len); -+ max_rx_pkt_len = conf->rxmode.max_rx_pkt_len; -+ if (max_rx_pkt_len > HNS3_MAX_FRAME_LEN || -+ max_rx_pkt_len <= HNS3_DEFAULT_FRAME_LEN) { -+ hns3_err(hw, "maximum Rx packet length must be greater " -+ "than %u and less than %u when jumbo frame enabled.", -+ (uint16_t)HNS3_DEFAULT_FRAME_LEN, -+ (uint16_t)HNS3_MAX_FRAME_LEN); -+ ret = -EINVAL; -+ goto cfg_err; -+ } -+ -+ mtu = (uint16_t)HNS3_PKTLEN_TO_MTU(max_rx_pkt_len); - ret = hns3vf_dev_mtu_set(dev, mtu); - if (ret) - goto cfg_err; --- -2.7.4 - diff --git a/0044-drivers-net-redefine-array-size-macros.patch b/0044-drivers-net-redefine-array-size-macros.patch deleted file mode 100644 index d6cd224baedc24c9f046dc5dea0d10f5c246756a..0000000000000000000000000000000000000000 --- a/0044-drivers-net-redefine-array-size-macros.patch +++ /dev/null @@ -1,156 +0,0 @@ -From 6b66b8fd3b82d5f7c7d35b5e1c52d2611abc4317 Mon Sep 17 00:00:00 2001 -From: Andrew Boyer -Date: Fri, 29 Jan 2021 14:44:32 -0800 -Subject: [PATCH 044/189] drivers/net: redefine array size macros - -Replace copies of size(arr)/size(arr[0]) with RTE_DIM(). -Eventually all of these macro definitions should be removed. - -Signed-off-by: Andrew Boyer -Reviewed-by: Ferruh Yigit ---- - drivers/net/atlantic/atl_hw_regs.h | 2 +- - drivers/net/axgbe/axgbe_common.h | 2 +- - drivers/net/bnx2x/bnx2x.h | 2 +- - drivers/net/bnx2x/elink.h | 2 +- - drivers/net/ena/ena_ethdev.c | 2 +- - drivers/net/enic/base/vnic_devcmd.h | 2 +- - drivers/net/hns3/hns3_ethdev.h | 2 +- - drivers/net/i40e/base/i40e_osdep.h | 2 +- - drivers/net/nfp/nfpcore/nfp-common/nfp_platform.h | 2 +- - drivers/net/thunderx/base/nicvf_hw.h | 2 +- - 10 files changed, 10 insertions(+), 10 deletions(-) - -diff --git a/drivers/net/atlantic/atl_hw_regs.h b/drivers/net/atlantic/atl_hw_regs.h -index a2d6ca8..4f6cd35 100644 ---- a/drivers/net/atlantic/atl_hw_regs.h -+++ b/drivers/net/atlantic/atl_hw_regs.h -@@ -26,7 +26,7 @@ - - #define mdelay rte_delay_ms - #define udelay rte_delay_us --#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) -+#define ARRAY_SIZE(arr) RTE_DIM(arr) - #define BIT(x) (1UL << (x)) - - #define AQ_HW_WAIT_FOR(_B_, _US_, _N_) \ -diff --git a/drivers/net/axgbe/axgbe_common.h b/drivers/net/axgbe/axgbe_common.h -index fb97f0b..799382a 100644 ---- a/drivers/net/axgbe/axgbe_common.h -+++ b/drivers/net/axgbe/axgbe_common.h -@@ -42,7 +42,7 @@ - - #define BIT(nr) (1 << (nr)) - #ifndef ARRAY_SIZE --#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) -+#define ARRAY_SIZE(arr) RTE_DIM(arr) - #endif - - #define AXGBE_HZ 250 -diff --git a/drivers/net/bnx2x/bnx2x.h b/drivers/net/bnx2x/bnx2x.h -index 69cc143..e13ab15 100644 ---- a/drivers/net/bnx2x/bnx2x.h -+++ b/drivers/net/bnx2x/bnx2x.h -@@ -81,7 +81,7 @@ - #endif - - #ifndef ARRAY_SIZE --#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) -+#define ARRAY_SIZE(arr) RTE_DIM(arr) - #endif - #ifndef DIV_ROUND_UP - #define DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d)) -diff --git a/drivers/net/bnx2x/elink.h b/drivers/net/bnx2x/elink.h -index dd70ac6..6b2e85f 100644 ---- a/drivers/net/bnx2x/elink.h -+++ b/drivers/net/bnx2x/elink.h -@@ -86,7 +86,7 @@ extern void elink_cb_notify_link_changed(struct bnx2x_softc *sc); - #define ELINK_EVENT_ID_SFP_UNQUALIFIED_MODULE 1 - #define ELINK_EVENT_ID_SFP_POWER_FAULT 2 - --#define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0])) -+#define ARRAY_SIZE(x) RTE_DIM(x) - /* Debug prints */ - #ifdef ELINK_DEBUG - -diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c -index 20ff365..b4b8794 100644 ---- a/drivers/net/ena/ena_ethdev.c -+++ b/drivers/net/ena/ena_ethdev.c -@@ -47,7 +47,7 @@ - #define ENA_HASH_KEY_SIZE 40 - #define ETH_GSTRING_LEN 32 - --#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) -+#define ARRAY_SIZE(x) RTE_DIM(x) - - #define ENA_MIN_RING_DESC 128 - -diff --git a/drivers/net/enic/base/vnic_devcmd.h b/drivers/net/enic/base/vnic_devcmd.h -index a2f577f..4675e5a 100644 ---- a/drivers/net/enic/base/vnic_devcmd.h -+++ b/drivers/net/enic/base/vnic_devcmd.h -@@ -63,7 +63,7 @@ - #define _CMD_VTYPE(cmd) (((cmd) >> _CMD_VTYPESHIFT) & _CMD_VTYPEMASK) - #define _CMD_N(cmd) (((cmd) >> _CMD_NSHIFT) & _CMD_NMASK) - --#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) -+#define ARRAY_SIZE(x) RTE_DIM(x) - - enum vnic_devcmd_cmd { - CMD_NONE = _CMDC(_CMD_DIR_NONE, _CMD_VTYPE_NONE, 0), -diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h -index cf42ef1..6178f0b 100644 ---- a/drivers/net/hns3/hns3_ethdev.h -+++ b/drivers/net/hns3/hns3_ethdev.h -@@ -887,7 +887,7 @@ static inline uint32_t hns3_read_reg(void *base, uint32_t reg) - #define hns3_read_dev(a, reg) \ - hns3_read_reg((a)->io_base, (reg)) - --#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) -+#define ARRAY_SIZE(x) RTE_DIM(x) - - #define NEXT_ITEM_OF_ACTION(act, actions, index) \ - do { \ -diff --git a/drivers/net/i40e/base/i40e_osdep.h b/drivers/net/i40e/base/i40e_osdep.h -index 9b50330..9b79ece 100644 ---- a/drivers/net/i40e/base/i40e_osdep.h -+++ b/drivers/net/i40e/base/i40e_osdep.h -@@ -155,7 +155,7 @@ static inline uint32_t i40e_read_addr(volatile void *addr) - I40E_PCI_REG_WRITE(I40E_PCI_REG_ADDR((a), (reg)), (value)) - #define flush(a) i40e_read_addr(I40E_PCI_REG_ADDR((a), (I40E_GLGEN_STAT))) - --#define ARRAY_SIZE(arr) (sizeof(arr)/sizeof(arr[0])) -+#define ARRAY_SIZE(arr) RTE_DIM(arr) - - /* memory allocation tracking */ - struct i40e_dma_mem { -diff --git a/drivers/net/nfp/nfpcore/nfp-common/nfp_platform.h b/drivers/net/nfp/nfpcore/nfp-common/nfp_platform.h -index d46574b..7b64e2d 100644 ---- a/drivers/net/nfp/nfpcore/nfp-common/nfp_platform.h -+++ b/drivers/net/nfp/nfpcore/nfp-common/nfp_platform.h -@@ -23,7 +23,7 @@ - #endif - - #ifndef ARRAY_SIZE --#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) -+#define ARRAY_SIZE(x) RTE_DIM(x) - #endif - - #define NFP_ERRNO(err) (errno = (err), -1) -diff --git a/drivers/net/thunderx/base/nicvf_hw.h b/drivers/net/thunderx/base/nicvf_hw.h -index fd13ea8..d6f3a57 100644 ---- a/drivers/net/thunderx/base/nicvf_hw.h -+++ b/drivers/net/thunderx/base/nicvf_hw.h -@@ -17,7 +17,7 @@ - #define PCI_SUB_DEVICE_ID_CN81XX_NICVF 0xA234 - #define PCI_SUB_DEVICE_ID_CN83XX_NICVF 0xA334 - --#define NICVF_ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) -+#define NICVF_ARRAY_SIZE(arr) RTE_DIM(arr) - - #define NICVF_GET_RX_STATS(reg) \ - nicvf_reg_read(nic, NIC_VNIC_RX_STAT_0_13 | (reg << 3)) --- -2.7.4 - diff --git a/0044-net-bonding-fix-reference-count-on-mbufs.patch b/0044-net-bonding-fix-reference-count-on-mbufs.patch new file mode 100644 index 0000000000000000000000000000000000000000..5085cc67372e523719e2fee77f48f00497764d18 --- /dev/null +++ b/0044-net-bonding-fix-reference-count-on-mbufs.patch @@ -0,0 +1,36 @@ +From 2c1857b46ec66643f127301b9466a3b93fa2d42b Mon Sep 17 00:00:00 2001 +From: "Min Hu (Connor)" +Date: Fri, 28 Jan 2022 10:25:33 +0800 +Subject: [PATCH] net/bonding: fix reference count on mbufs + +In bonding Tx broadcast mode, Packets should be sent by every slave, +but only one mbuf exits. The solution is to increment reference count +on mbufs, but it ignores multi segments. + +This patch fixed it by adding reference for every segment in multi +segments Tx scenario. + +Fixes: 2efb58cbab6e ("bond: new link bonding library") +Cc: stable@dpdk.org + +Signed-off-by: Min Hu (Connor) +--- + drivers/net/bonding/rte_eth_bond_pmd.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c +index d2fcfad676..bfa931098e 100644 +--- a/drivers/net/bonding/rte_eth_bond_pmd.c ++++ b/drivers/net/bonding/rte_eth_bond_pmd.c +@@ -1318,7 +1318,7 @@ bond_ethdev_tx_burst_broadcast(void *queue, struct rte_mbuf **bufs, + + /* Increment reference count on mbufs */ + for (i = 0; i < nb_pkts; i++) +- rte_mbuf_refcnt_update(bufs[i], num_of_slaves - 1); ++ rte_pktmbuf_refcnt_update(bufs[i], num_of_slaves - 1); + + /* Transmit burst on each active slave */ + for (i = 0; i < num_of_slaves; i++) { +-- +2.33.0 + diff --git a/0045-app-testpmd-fix-bonding-mode-set.patch b/0045-app-testpmd-fix-bonding-mode-set.patch new file mode 100644 index 0000000000000000000000000000000000000000..572f66625357b2f917710ce5763d507ecc5a3c5e --- /dev/null +++ b/0045-app-testpmd-fix-bonding-mode-set.patch @@ -0,0 +1,70 @@ +From 32d1817dbff6499dd1d126c466d0f7cb1c114713 Mon Sep 17 00:00:00 2001 +From: "Min Hu (Connor)" +Date: Fri, 28 Jan 2022 10:35:19 +0800 +Subject: [PATCH] app/testpmd: fix bonding mode set + +when start testpmd, and type command like this, it will lead to +Segmentation fault, like: + +testpmd> create bonded device 4 0 +testpmd> add bonding slave 0 2 +testpmd> add bonding slave 1 2 +testpmd> port start 2 +testpmd> set bonding mode 0 2 +testpmd> quit +Stopping port 0... +Stopping ports... +... +Bye... +Segmentation fault + +The reason to the bug is that rte timer do not be cancelled when quit. +That is, in 'bond_ethdev_start', resources are allocated according to +different bonding mode. In 'bond_ethdev_stop', resources are free by +the corresponding mode. + +For example, 'bond_ethdev_start' start bond_mode_8023ad_ext_periodic_cb +timer for bonding mode 4. and 'bond_ethdev_stop' cancel the timer only +when the current bonding mode is 4. If the bonding mode is changed, +and directly quit the process, the timer will still on, and freed memory +will be accessed, then segmentation fault. + +'bonding mode' changed means resources changed, reallocate resources for +different mode should be done, that is, device should be restarted. + +Fixes: 2950a769315e ("bond: testpmd support") +Cc: stable@dpdk.org + +Signed-off-by: Min Hu (Connor) +Tested-by: Ferruh Yigit +--- + app/test-pmd/cmdline.c | 13 +++++++++++++ + 1 file changed, 13 insertions(+) + +diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c +index e626b1c7d9..16ad4be005 100644 +--- a/app/test-pmd/cmdline.c ++++ b/app/test-pmd/cmdline.c +@@ -5915,6 +5915,19 @@ static void cmd_set_bonding_mode_parsed(void *parsed_result, + { + struct cmd_set_bonding_mode_result *res = parsed_result; + portid_t port_id = res->port_id; ++ struct rte_port *port = &ports[port_id]; ++ ++ /* ++ * Bonding mode changed means resources of device changed, like whether ++ * started rte timer or not. Device should be restarted when resources ++ * of device changed. ++ */ ++ if (port->port_status != RTE_PORT_STOPPED) { ++ fprintf(stderr, ++ "\t Error: Can't set bonding mode when port %d is not stopped\n", ++ port_id); ++ return; ++ } + + /* Set the bonding mode for the relevant port. */ + if (0 != rte_eth_bond_mode_set(port_id, res->value)) +-- +2.33.0 + diff --git a/0045-net-hns3-support-module-EEPROM-dump.patch b/0045-net-hns3-support-module-EEPROM-dump.patch deleted file mode 100644 index 2c756ef6f1beabbba77dd45c74a4e373afe8391e..0000000000000000000000000000000000000000 --- a/0045-net-hns3-support-module-EEPROM-dump.patch +++ /dev/null @@ -1,241 +0,0 @@ -From 4d36d14e1683f50904525e26fbf311c0aa677940 Mon Sep 17 00:00:00 2001 -From: Chengchang Tang -Date: Thu, 4 Mar 2021 15:44:41 +0800 -Subject: [PATCH 045/189] net/hns3: support module EEPROM dump - -This patch add support for dumping module EEPROM. - -Signed-off-by: Chengchang Tang -Signed-off-by: Lijun Ou ---- - doc/guides/nics/features/hns3.ini | 1 + - drivers/net/hns3/hns3_cmd.h | 16 ++++ - drivers/net/hns3/hns3_ethdev.c | 159 ++++++++++++++++++++++++++++++++++++++ - 3 files changed, 176 insertions(+) - -diff --git a/doc/guides/nics/features/hns3.ini b/doc/guides/nics/features/hns3.ini -index f0747e3..5ccaca5 100644 ---- a/doc/guides/nics/features/hns3.ini -+++ b/doc/guides/nics/features/hns3.ini -@@ -38,6 +38,7 @@ Extended stats = Y - Stats per queue = Y - FW version = Y - Registers dump = Y -+Module EEPROM dump = Y - Multiprocess aware = Y - Linux UIO = Y - Linux VFIO = Y -diff --git a/drivers/net/hns3/hns3_cmd.h b/drivers/net/hns3/hns3_cmd.h -index 5010278..ff424a0 100644 ---- a/drivers/net/hns3/hns3_cmd.h -+++ b/drivers/net/hns3/hns3_cmd.h -@@ -211,6 +211,8 @@ enum hns3_opcode_type { - HNS3_OPC_FIRMWARE_COMPAT_CFG = 0x701A, - - /* SFP command */ -+ HNS3_OPC_GET_SFP_EEPROM = 0x7100, -+ HNS3_OPC_GET_SFP_EXIST = 0x7101, - HNS3_OPC_SFP_GET_SPEED = 0x7104, - - /* Interrupts commands */ -@@ -714,6 +716,20 @@ struct hns3_config_auto_neg_cmd { - #define HNS3_MAC_FEC_BASER 1 - #define HNS3_MAC_FEC_RS 2 - -+#define HNS3_SFP_INFO_BD0_LEN 20UL -+#define HNS3_SFP_INFO_BDX_LEN 24UL -+ -+struct hns3_sfp_info_bd0_cmd { -+ uint16_t offset; -+ uint16_t read_len; -+ uint8_t data[HNS3_SFP_INFO_BD0_LEN]; -+}; -+ -+struct hns3_sfp_type { -+ uint8_t type; -+ uint8_t ext_type; -+}; -+ - struct hns3_sfp_speed_cmd { - uint32_t sfp_speed; - uint8_t query_type; /* 0: sfp speed, 1: active fec */ -diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c -index 7ed55b1..2a37fcc 100644 ---- a/drivers/net/hns3/hns3_ethdev.c -+++ b/drivers/net/hns3/hns3_ethdev.c -@@ -6172,6 +6172,163 @@ hns3_query_dev_fec_info(struct hns3_hw *hw) - return ret; - } - -+static bool -+hns3_optical_module_existed(struct hns3_hw *hw) -+{ -+ struct hns3_cmd_desc desc; -+ bool existed; -+ int ret; -+ -+ hns3_cmd_setup_basic_desc(&desc, HNS3_OPC_GET_SFP_EXIST, true); -+ ret = hns3_cmd_send(hw, &desc, 1); -+ if (ret) { -+ hns3_err(hw, -+ "fail to get optical module exist state, ret = %d.\n", -+ ret); -+ return false; -+ } -+ existed = !!desc.data[0]; -+ -+ return existed; -+} -+ -+static int -+hns3_get_module_eeprom_data(struct hns3_hw *hw, uint32_t offset, -+ uint32_t len, uint8_t *data) -+{ -+#define HNS3_SFP_INFO_CMD_NUM 6 -+#define HNS3_SFP_INFO_MAX_LEN \ -+ (HNS3_SFP_INFO_BD0_LEN + \ -+ (HNS3_SFP_INFO_CMD_NUM - 1) * HNS3_SFP_INFO_BDX_LEN) -+ struct hns3_cmd_desc desc[HNS3_SFP_INFO_CMD_NUM]; -+ struct hns3_sfp_info_bd0_cmd *sfp_info_bd0; -+ uint16_t read_len; -+ uint16_t copy_len; -+ int ret; -+ int i; -+ -+ for (i = 0; i < HNS3_SFP_INFO_CMD_NUM; i++) { -+ hns3_cmd_setup_basic_desc(&desc[i], HNS3_OPC_GET_SFP_EEPROM, -+ true); -+ if (i < HNS3_SFP_INFO_CMD_NUM - 1) -+ desc[i].flag |= rte_cpu_to_le_16(HNS3_CMD_FLAG_NEXT); -+ } -+ -+ sfp_info_bd0 = (struct hns3_sfp_info_bd0_cmd *)desc[0].data; -+ sfp_info_bd0->offset = rte_cpu_to_le_16((uint16_t)offset); -+ read_len = RTE_MIN(len, HNS3_SFP_INFO_MAX_LEN); -+ sfp_info_bd0->read_len = rte_cpu_to_le_16((uint16_t)read_len); -+ -+ ret = hns3_cmd_send(hw, desc, HNS3_SFP_INFO_CMD_NUM); -+ if (ret) { -+ hns3_err(hw, "fail to get module EEPROM info, ret = %d.\n", -+ ret); -+ return ret; -+ } -+ -+ /* The data format in BD0 is different with the others. */ -+ copy_len = RTE_MIN(len, HNS3_SFP_INFO_BD0_LEN); -+ memcpy(data, sfp_info_bd0->data, copy_len); -+ read_len = copy_len; -+ -+ for (i = 1; i < HNS3_SFP_INFO_CMD_NUM; i++) { -+ if (read_len >= len) -+ break; -+ -+ copy_len = RTE_MIN(len - read_len, HNS3_SFP_INFO_BDX_LEN); -+ memcpy(data + read_len, desc[i].data, copy_len); -+ read_len += copy_len; -+ } -+ -+ return (int)read_len; -+} -+ -+static int -+hns3_get_module_eeprom(struct rte_eth_dev *dev, -+ struct rte_dev_eeprom_info *info) -+{ -+ struct hns3_adapter *hns = dev->data->dev_private; -+ struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(hns); -+ uint32_t offset = info->offset; -+ uint32_t len = info->length; -+ uint8_t *data = info->data; -+ uint32_t read_len = 0; -+ -+ if (hw->mac.media_type != HNS3_MEDIA_TYPE_FIBER) -+ return -ENOTSUP; -+ -+ if (!hns3_optical_module_existed(hw)) { -+ hns3_err(hw, "fail to read module EEPROM: no module is connected.\n"); -+ return -EIO; -+ } -+ -+ while (read_len < len) { -+ int ret; -+ ret = hns3_get_module_eeprom_data(hw, offset + read_len, -+ len - read_len, -+ data + read_len); -+ if (ret < 0) -+ return -EIO; -+ read_len += ret; -+ } -+ -+ return 0; -+} -+ -+static int -+hns3_get_module_info(struct rte_eth_dev *dev, -+ struct rte_eth_dev_module_info *modinfo) -+{ -+#define HNS3_SFF8024_ID_SFP 0x03 -+#define HNS3_SFF8024_ID_QSFP_8438 0x0c -+#define HNS3_SFF8024_ID_QSFP_8436_8636 0x0d -+#define HNS3_SFF8024_ID_QSFP28_8636 0x11 -+#define HNS3_SFF_8636_V1_3 0x03 -+ struct hns3_adapter *hns = dev->data->dev_private; -+ struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(hns); -+ struct rte_dev_eeprom_info info; -+ struct hns3_sfp_type sfp_type; -+ int ret; -+ -+ memset(&sfp_type, 0, sizeof(sfp_type)); -+ memset(&info, 0, sizeof(info)); -+ info.data = (uint8_t *)&sfp_type; -+ info.length = sizeof(sfp_type); -+ ret = hns3_get_module_eeprom(dev, &info); -+ if (ret) -+ return ret; -+ -+ switch (sfp_type.type) { -+ case HNS3_SFF8024_ID_SFP: -+ modinfo->type = RTE_ETH_MODULE_SFF_8472; -+ modinfo->eeprom_len = RTE_ETH_MODULE_SFF_8472_LEN; -+ break; -+ case HNS3_SFF8024_ID_QSFP_8438: -+ modinfo->type = RTE_ETH_MODULE_SFF_8436; -+ modinfo->eeprom_len = RTE_ETH_MODULE_SFF_8436_MAX_LEN; -+ break; -+ case HNS3_SFF8024_ID_QSFP_8436_8636: -+ if (sfp_type.ext_type < HNS3_SFF_8636_V1_3) { -+ modinfo->type = RTE_ETH_MODULE_SFF_8436; -+ modinfo->eeprom_len = RTE_ETH_MODULE_SFF_8436_MAX_LEN; -+ } else { -+ modinfo->type = RTE_ETH_MODULE_SFF_8636; -+ modinfo->eeprom_len = RTE_ETH_MODULE_SFF_8636_MAX_LEN; -+ } -+ break; -+ case HNS3_SFF8024_ID_QSFP28_8636: -+ modinfo->type = RTE_ETH_MODULE_SFF_8636; -+ modinfo->eeprom_len = RTE_ETH_MODULE_SFF_8636_MAX_LEN; -+ break; -+ default: -+ hns3_err(hw, "unknown module, type = %u, extra_type = %u.\n", -+ sfp_type.type, sfp_type.ext_type); -+ return -EINVAL; -+ } -+ -+ return 0; -+} -+ - static const struct eth_dev_ops hns3_eth_dev_ops = { - .dev_configure = hns3_dev_configure, - .dev_start = hns3_dev_start, -@@ -6223,6 +6380,8 @@ static const struct eth_dev_ops hns3_eth_dev_ops = { - .vlan_offload_set = hns3_vlan_offload_set, - .vlan_pvid_set = hns3_vlan_pvid_set, - .get_reg = hns3_get_regs, -+ .get_module_info = hns3_get_module_info, -+ .get_module_eeprom = hns3_get_module_eeprom, - .get_dcb_info = hns3_get_dcb_info, - .dev_supported_ptypes_get = hns3_dev_supported_ptypes_get, - .fec_get_capability = hns3_fec_get_capability, --- -2.7.4 - diff --git a/0046-ethdev-introduce-dump-API.patch b/0046-ethdev-introduce-dump-API.patch new file mode 100644 index 0000000000000000000000000000000000000000..1fd481b40513344666d14c5df65c540c51919a63 --- /dev/null +++ b/0046-ethdev-introduce-dump-API.patch @@ -0,0 +1,129 @@ +From 42a26d7136b259ee7ff1b39325e19ef5ef9fe0e3 Mon Sep 17 00:00:00 2001 +From: "Min Hu (Connor)" +Date: Fri, 11 Feb 2022 12:49:22 +0800 +Subject: [PATCH 01/13] ethdev: introduce dump API +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Added the ethdev dump API which provides querying private info from device. +There exists many private properties in different PMD drivers, such as +adapter state, Rx/Tx func algorithm in hns3 PMD. The information of these +properties is important for debug. As the information is private, the new +API is introduced. + +Signed-off-by: Min Hu (Connor) +Acked-by: Morten Brørup +Acked-by: Ray Kinsella +Acked-by: Ajit Khaparde +Acked-by: Ferruh Yigit +--- + lib/ethdev/ethdev_driver.h | 23 +++++++++++++++++++++++ + lib/ethdev/rte_ethdev.c | 17 +++++++++++++++++ + lib/ethdev/rte_ethdev.h | 21 +++++++++++++++++++++ + 3 files changed, 61 insertions(+) + +diff --git a/lib/ethdev/ethdev_driver.h b/lib/ethdev/ethdev_driver.h +index d95605a355..e24ff7064c 100644 +--- a/lib/ethdev/ethdev_driver.h ++++ b/lib/ethdev/ethdev_driver.h +@@ -990,6 +990,26 @@ typedef int (*eth_representor_info_get_t)(struct rte_eth_dev *dev, + typedef int (*eth_rx_metadata_negotiate_t)(struct rte_eth_dev *dev, + uint64_t *features); + ++/** ++ ++ * @internal ++ * Dump private info from device to a file. ++ * ++ * @param dev ++ * Port (ethdev) handle. ++ * @param file ++ * A pointer to a file for output. ++ * ++ * @return ++ * Negative value on error, 0 on success. ++ * ++ * @retval 0 ++ * Success ++ * @retval -EINVAL ++ * Invalid file ++ */ ++typedef int (*eth_dev_priv_dump_t)(struct rte_eth_dev *dev, FILE *file); ++ + /** + * @internal A structure containing the functions exported by an Ethernet driver. + */ +@@ -1186,6 +1206,9 @@ struct eth_dev_ops { + * kinds of metadata to the PMD + */ + eth_rx_metadata_negotiate_t rx_metadata_negotiate; ++ ++ /** Dump private info from device */ ++ eth_dev_priv_dump_t eth_dev_priv_dump; + }; + + /** +diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c +index a1d475a292..b9a452107f 100644 +--- a/lib/ethdev/rte_ethdev.c ++++ b/lib/ethdev/rte_ethdev.c +@@ -6472,6 +6472,23 @@ rte_eth_rx_metadata_negotiate(uint16_t port_id, uint64_t *features) + (*dev->dev_ops->rx_metadata_negotiate)(dev, features)); + } + ++int ++rte_eth_dev_priv_dump(uint16_t port_id, FILE *file) ++{ ++ struct rte_eth_dev *dev; ++ ++ RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); ++ dev = &rte_eth_devices[port_id]; ++ ++ if (file == NULL) { ++ RTE_ETHDEV_LOG(ERR, "Invalid file (NULL)\n"); ++ return -EINVAL; ++ } ++ ++ RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->eth_dev_priv_dump, -ENOTSUP); ++ return eth_err(port_id, (*dev->dev_ops->eth_dev_priv_dump)(dev, file)); ++} ++ + RTE_LOG_REGISTER_DEFAULT(rte_eth_dev_logtype, INFO); + + RTE_INIT(ethdev_init_telemetry) +diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h +index fa299c8ad7..b8f135ba3f 100644 +--- a/lib/ethdev/rte_ethdev.h ++++ b/lib/ethdev/rte_ethdev.h +@@ -5188,6 +5188,27 @@ int rte_eth_representor_info_get(uint16_t port_id, + __rte_experimental + int rte_eth_rx_metadata_negotiate(uint16_t port_id, uint64_t *features); + ++/** ++ * @warning ++ * @b EXPERIMENTAL: this API may change, or be removed, without prior notice ++ * ++ * Dump private info from device to a file. Provided data and the order depends ++ * on the PMD. ++ * ++ * @param port_id ++ * The port identifier of the Ethernet device. ++ * @param file ++ * A pointer to a file for output. ++ * @return ++ * - (0) on success. ++ * - (-ENODEV) if *port_id* is invalid. ++ * - (-EINVAL) if null file. ++ * - (-ENOTSUP) if the device does not support this function. ++ * - (-EIO) if device is removed. ++ */ ++__rte_experimental ++int rte_eth_dev_priv_dump(uint16_t port_id, FILE *file); ++ + #include + + /** +-- +2.30.0 + diff --git a/0046-net-hns3-add-more-registers-to-dump.patch b/0046-net-hns3-add-more-registers-to-dump.patch deleted file mode 100644 index 54ff5d957806a1e30d8fe19ee1f0fc3def37b8a1..0000000000000000000000000000000000000000 --- a/0046-net-hns3-add-more-registers-to-dump.patch +++ /dev/null @@ -1,255 +0,0 @@ -From b7995f87e190e4ab83ff6a5faea584a4ea4c2198 Mon Sep 17 00:00:00 2001 -From: Chengchang Tang -Date: Thu, 4 Mar 2021 15:44:42 +0800 -Subject: [PATCH 046/189] net/hns3: add more registers to dump - -This patch makes more registers dumped in the dump_reg API to help -locate the fault. - -Signed-off-by: Chengchang Tang -Signed-off-by: Lijun Ou ---- - drivers/net/hns3/hns3_cmd.h | 13 ++++ - drivers/net/hns3/hns3_regs.c | 171 ++++++++++++++++++++++++++++++++++++++++++- - 2 files changed, 180 insertions(+), 4 deletions(-) - -diff --git a/drivers/net/hns3/hns3_cmd.h b/drivers/net/hns3/hns3_cmd.h -index ff424a0..2e23f99 100644 ---- a/drivers/net/hns3/hns3_cmd.h -+++ b/drivers/net/hns3/hns3_cmd.h -@@ -95,6 +95,19 @@ enum hns3_opcode_type { - HNS3_OPC_QUERY_REG_NUM = 0x0040, - HNS3_OPC_QUERY_32_BIT_REG = 0x0041, - HNS3_OPC_QUERY_64_BIT_REG = 0x0042, -+ HNS3_OPC_DFX_BD_NUM = 0x0043, -+ HNS3_OPC_DFX_BIOS_COMMON_REG = 0x0044, -+ HNS3_OPC_DFX_SSU_REG_0 = 0x0045, -+ HNS3_OPC_DFX_SSU_REG_1 = 0x0046, -+ HNS3_OPC_DFX_IGU_EGU_REG = 0x0047, -+ HNS3_OPC_DFX_RPU_REG_0 = 0x0048, -+ HNS3_OPC_DFX_RPU_REG_1 = 0x0049, -+ HNS3_OPC_DFX_NCSI_REG = 0x004A, -+ HNS3_OPC_DFX_RTC_REG = 0x004B, -+ HNS3_OPC_DFX_PPP_REG = 0x004C, -+ HNS3_OPC_DFX_RCB_REG = 0x004D, -+ HNS3_OPC_DFX_TQP_REG = 0x004E, -+ HNS3_OPC_DFX_SSU_REG_2 = 0x004F, - - HNS3_OPC_QUERY_DEV_SPECS = 0x0050, - -diff --git a/drivers/net/hns3/hns3_regs.c b/drivers/net/hns3/hns3_regs.c -index 8afe132..5b14727 100644 ---- a/drivers/net/hns3/hns3_regs.c -+++ b/drivers/net/hns3/hns3_regs.c -@@ -15,6 +15,8 @@ - #define REG_NUM_PER_LINE 4 - #define REG_LEN_PER_LINE (REG_NUM_PER_LINE * sizeof(uint32_t)) - -+static int hns3_get_dfx_reg_line(struct hns3_hw *hw, uint32_t *length); -+ - static const uint32_t cmdq_reg_addrs[] = {HNS3_CMDQ_TX_ADDR_L_REG, - HNS3_CMDQ_TX_ADDR_H_REG, - HNS3_CMDQ_TX_DEPTH_REG, -@@ -77,6 +79,21 @@ static const uint32_t tqp_intr_reg_addrs[] = {HNS3_TQP_INTR_CTRL_REG, - HNS3_TQP_INTR_GL2_REG, - HNS3_TQP_INTR_RL_REG}; - -+static const uint32_t hns3_dfx_reg_opcode_list[] = { -+ HNS3_OPC_DFX_BIOS_COMMON_REG, -+ HNS3_OPC_DFX_SSU_REG_0, -+ HNS3_OPC_DFX_SSU_REG_1, -+ HNS3_OPC_DFX_IGU_EGU_REG, -+ HNS3_OPC_DFX_RPU_REG_0, -+ HNS3_OPC_DFX_RPU_REG_1, -+ HNS3_OPC_DFX_NCSI_REG, -+ HNS3_OPC_DFX_RTC_REG, -+ HNS3_OPC_DFX_PPP_REG, -+ HNS3_OPC_DFX_RCB_REG, -+ HNS3_OPC_DFX_TQP_REG, -+ HNS3_OPC_DFX_SSU_REG_2 -+}; -+ - static int - hns3_get_regs_num(struct hns3_hw *hw, uint32_t *regs_num_32_bit, - uint32_t *regs_num_64_bit) -@@ -123,14 +140,21 @@ hns3_get_regs_length(struct hns3_hw *hw, uint32_t *length) - if (!hns->is_vf) { - ret = hns3_get_regs_num(hw, ®s_num_32_bit, ®s_num_64_bit); - if (ret) { -- hns3_err(hw, "Get register number failed, ret = %d.", -- ret); -- return -ENOTSUP; -+ hns3_err(hw, "fail to get the number of registers, " -+ "ret = %d.", ret); -+ return ret; - } - dfx_reg_lines = regs_num_32_bit * sizeof(uint32_t) / - REG_LEN_PER_LINE + 1; - dfx_reg_lines += regs_num_64_bit * sizeof(uint64_t) / - REG_LEN_PER_LINE + 1; -+ -+ ret = hns3_get_dfx_reg_line(hw, &dfx_reg_lines); -+ if (ret) { -+ hns3_err(hw, "fail to get the number of dfx registers, " -+ "ret = %d.", ret); -+ return ret; -+ } - len += dfx_reg_lines * REG_NUM_PER_LINE; - } - -@@ -310,6 +334,144 @@ hns3_direct_access_regs(struct hns3_hw *hw, uint32_t *data) - return data - origin_data_ptr; - } - -+static int -+hns3_get_dfx_reg_bd_num(struct hns3_hw *hw, uint32_t *bd_num_list, -+ uint32_t list_size) -+{ -+#define HNS3_GET_DFX_REG_BD_NUM_SIZE 4 -+ struct hns3_cmd_desc desc[HNS3_GET_DFX_REG_BD_NUM_SIZE]; -+ uint32_t index, desc_index; -+ uint32_t bd_num; -+ uint32_t i; -+ int ret; -+ -+ for (i = 0; i < HNS3_GET_DFX_REG_BD_NUM_SIZE - 1; i++) { -+ hns3_cmd_setup_basic_desc(&desc[i], HNS3_OPC_DFX_BD_NUM, true); -+ desc[i].flag |= rte_cpu_to_le_16(HNS3_CMD_FLAG_NEXT); -+ } -+ /* The last BD does not need a next flag */ -+ hns3_cmd_setup_basic_desc(&desc[i], HNS3_OPC_DFX_BD_NUM, true); -+ -+ ret = hns3_cmd_send(hw, desc, HNS3_GET_DFX_REG_BD_NUM_SIZE); -+ if (ret) { -+ hns3_err(hw, "fail to get dfx bd num, ret = %d.\n", ret); -+ return ret; -+ } -+ -+ /* The first data in the first BD is a reserved field */ -+ for (i = 1; i <= list_size; i++) { -+ desc_index = i / HNS3_CMD_DESC_DATA_NUM; -+ index = i % HNS3_CMD_DESC_DATA_NUM; -+ bd_num = rte_le_to_cpu_32(desc[desc_index].data[index]); -+ bd_num_list[i - 1] = bd_num; -+ } -+ -+ return 0; -+} -+ -+static int -+hns3_dfx_reg_cmd_send(struct hns3_hw *hw, struct hns3_cmd_desc *desc, -+ int bd_num, uint32_t opcode) -+{ -+ int ret; -+ int i; -+ -+ for (i = 0; i < bd_num - 1; i++) { -+ hns3_cmd_setup_basic_desc(&desc[i], opcode, true); -+ desc[i].flag |= rte_cpu_to_le_16(HNS3_CMD_FLAG_NEXT); -+ } -+ /* The last BD does not need a next flag */ -+ hns3_cmd_setup_basic_desc(&desc[i], opcode, true); -+ -+ ret = hns3_cmd_send(hw, desc, bd_num); -+ if (ret) { -+ hns3_err(hw, "fail to query dfx registers, opcode = 0x%04X, " -+ "ret = %d.\n", opcode, ret); -+ } -+ -+ return ret; -+} -+ -+static int -+hns3_dfx_reg_fetch_data(struct hns3_cmd_desc *desc, int bd_num, uint32_t *reg) -+{ -+ int desc_index; -+ int reg_num; -+ int index; -+ int i; -+ -+ reg_num = bd_num * HNS3_CMD_DESC_DATA_NUM; -+ for (i = 0; i < reg_num; i++) { -+ desc_index = i / HNS3_CMD_DESC_DATA_NUM; -+ index = i % HNS3_CMD_DESC_DATA_NUM; -+ *reg++ = desc[desc_index].data[index]; -+ } -+ reg_num += hns3_insert_reg_separator(reg_num, reg); -+ -+ return reg_num; -+} -+ -+static int -+hns3_get_dfx_reg_line(struct hns3_hw *hw, uint32_t *lines) -+{ -+ int opcode_num = RTE_DIM(hns3_dfx_reg_opcode_list); -+ uint32_t bd_num_list[opcode_num]; -+ uint32_t bd_num, data_len; -+ int ret; -+ int i; -+ -+ ret = hns3_get_dfx_reg_bd_num(hw, bd_num_list, opcode_num); -+ if (ret) -+ return ret; -+ -+ for (i = 0; i < opcode_num; i++) { -+ bd_num = bd_num_list[i]; -+ data_len = bd_num * HNS3_CMD_DESC_DATA_NUM * sizeof(uint32_t); -+ *lines += data_len / REG_LEN_PER_LINE + 1; -+ } -+ -+ return 0; -+} -+ -+static int -+hns3_get_dfx_regs(struct hns3_hw *hw, void **data) -+{ -+ int opcode_num = RTE_DIM(hns3_dfx_reg_opcode_list); -+ uint32_t max_bd_num, bd_num, opcode; -+ uint32_t bd_num_list[opcode_num]; -+ struct hns3_cmd_desc *cmd_descs; -+ uint32_t *reg_val = (uint32_t *)*data; -+ int ret; -+ int i; -+ -+ ret = hns3_get_dfx_reg_bd_num(hw, bd_num_list, opcode_num); -+ if (ret) -+ return ret; -+ -+ max_bd_num = 0; -+ for (i = 0; i < opcode_num; i++) -+ max_bd_num = RTE_MAX(bd_num_list[i], max_bd_num); -+ -+ cmd_descs = rte_zmalloc(NULL, sizeof(*cmd_descs) * max_bd_num, 0); -+ if (cmd_descs == NULL) -+ return -ENOMEM; -+ -+ for (i = 0; i < opcode_num; i++) { -+ opcode = hns3_dfx_reg_opcode_list[i]; -+ bd_num = bd_num_list[i]; -+ if (bd_num == 0) -+ continue; -+ ret = hns3_dfx_reg_cmd_send(hw, cmd_descs, bd_num, opcode); -+ if (ret) -+ break; -+ reg_val += hns3_dfx_reg_fetch_data(cmd_descs, bd_num, reg_val); -+ } -+ rte_free(cmd_descs); -+ *data = (void *)reg_val; -+ -+ return ret; -+} -+ - int - hns3_get_regs(struct rte_eth_dev *eth_dev, struct rte_dev_reg_info *regs) - { -@@ -371,5 +533,6 @@ hns3_get_regs(struct rte_eth_dev *eth_dev, struct rte_dev_reg_info *regs) - data += regs_num_64_bit * HNS3_64_BIT_REG_SIZE; - data += hns3_insert_reg_separator(regs_num_64_bit * - HNS3_64_BIT_REG_SIZE, data); -- return ret; -+ -+ return hns3_get_dfx_regs(hw, (void **)&data); - } --- -2.7.4 - diff --git a/0047-app-procinfo-add-device-private-info-dump.patch b/0047-app-procinfo-add-device-private-info-dump.patch new file mode 100644 index 0000000000000000000000000000000000000000..7df98b8c331bf48aa88f1933149bcbe6913788c1 --- /dev/null +++ b/0047-app-procinfo-add-device-private-info-dump.patch @@ -0,0 +1,90 @@ +From a91c0f253dd9b31cbe30bf5470a818aa0a909e26 Mon Sep 17 00:00:00 2001 +From: "Min Hu (Connor)" +Date: Sat, 19 Feb 2022 09:37:46 +0800 +Subject: [PATCH 02/13] app/procinfo: add device private info dump + +This patch adds support for dump the device private info from a running +application. It can help developers locate the problem. + +Signed-off-by: Min Hu (Connor) +--- + app/proc-info/main.c | 28 ++++++++++++++++++++++++++++ + 1 file changed, 28 insertions(+) + +diff --git a/app/proc-info/main.c b/app/proc-info/main.c +index ce140aaf84..fbc1715ce9 100644 +--- a/app/proc-info/main.c ++++ b/app/proc-info/main.c +@@ -84,6 +84,8 @@ static char bdr_str[MAX_STRING_LEN]; + + /**< Enable show port. */ + static uint32_t enable_shw_port; ++/**< Enable show port private info. */ ++static uint32_t enable_shw_port_priv; + /**< Enable show tm. */ + static uint32_t enable_shw_tm; + /**< Enable show crypto. */ +@@ -123,6 +125,7 @@ proc_info_usage(const char *prgname) + " --collectd-format: to print statistics to STDOUT in expected by collectd format\n" + " --host-id STRING: host id used to identify the system process is running on\n" + " --show-port: to display ports information\n" ++ " --show-port-private: to display ports private information\n" + " --show-tm: to display traffic manager information for ports\n" + " --show-crypto: to display crypto information\n" + " --show-ring[=name]: to display ring information\n" +@@ -232,6 +235,7 @@ proc_info_parse_args(int argc, char **argv) + {"xstats-ids", 1, NULL, 1}, + {"host-id", 0, NULL, 0}, + {"show-port", 0, NULL, 0}, ++ {"show-port-private", 0, NULL, 0}, + {"show-tm", 0, NULL, 0}, + {"show-crypto", 0, NULL, 0}, + {"show-ring", optional_argument, NULL, 0}, +@@ -284,6 +288,9 @@ proc_info_parse_args(int argc, char **argv) + else if (!strncmp(long_option[option_index].name, + "show-port", MAX_LONG_OPT_SZ)) + enable_shw_port = 1; ++ else if (!strncmp(long_option[option_index].name, ++ "show-port-private", MAX_LONG_OPT_SZ)) ++ enable_shw_port_priv = 1; + else if (!strncmp(long_option[option_index].name, + "show-tm", MAX_LONG_OPT_SZ)) + enable_shw_tm = 1; +@@ -887,6 +894,25 @@ show_port(void) + } + } + ++static void ++show_port_private_info(void) ++{ ++ int i; ++ ++ snprintf(bdr_str, MAX_STRING_LEN, " show - Port PMD Private "); ++ STATS_BDR_STR(10, bdr_str); ++ ++ RTE_ETH_FOREACH_DEV(i) { ++ /* Skip if port is not in mask */ ++ if ((enabled_port_mask & (1ul << i)) == 0) ++ continue; ++ ++ snprintf(bdr_str, MAX_STRING_LEN, " Port %u ", i); ++ STATS_BDR_STR(5, bdr_str); ++ rte_eth_dev_priv_dump(i, stdout); ++ } ++} ++ + static void + display_nodecap_info(int is_leaf, struct rte_tm_node_capabilities *cap) + { +@@ -1549,6 +1575,8 @@ main(int argc, char **argv) + /* show information for PMD */ + if (enable_shw_port) + show_port(); ++ if (enable_shw_port_priv) ++ show_port_private_info(); + if (enable_shw_tm) + show_tm(); + if (enable_shw_crypto) +-- +2.30.0 + diff --git a/0047-net-hns3-implement-Tx-mbuf-free-on-demand.patch b/0047-net-hns3-implement-Tx-mbuf-free-on-demand.patch deleted file mode 100644 index 17fcd7f9aaa5372954658a0701f99fa4dce18b01..0000000000000000000000000000000000000000 --- a/0047-net-hns3-implement-Tx-mbuf-free-on-demand.patch +++ /dev/null @@ -1,151 +0,0 @@ -From f789787f6d1f096a04d39e3de46e5292a7bde3fe Mon Sep 17 00:00:00 2001 -From: Chengwen Feng -Date: Thu, 4 Mar 2021 15:44:43 +0800 -Subject: [PATCH 047/189] net/hns3: implement Tx mbuf free on demand - -This patch add support tx_done_cleanup ops, which could support for -the API rte_eth_tx_done_cleanup to free consumed mbufs on Tx ring. - -Signed-off-by: Chengwen Feng -Signed-off-by: Lijun Ou ---- - doc/guides/nics/features/hns3.ini | 1 + - doc/guides/nics/features/hns3_vf.ini | 1 + - drivers/net/hns3/hns3_ethdev.c | 1 + - drivers/net/hns3/hns3_ethdev_vf.c | 1 + - drivers/net/hns3/hns3_rxtx.c | 59 ++++++++++++++++++++++++++++++++++++ - drivers/net/hns3/hns3_rxtx.h | 1 + - 6 files changed, 64 insertions(+) - -diff --git a/doc/guides/nics/features/hns3.ini b/doc/guides/nics/features/hns3.ini -index 5ccaca5..00a26cd 100644 ---- a/doc/guides/nics/features/hns3.ini -+++ b/doc/guides/nics/features/hns3.ini -@@ -10,6 +10,7 @@ Queue start/stop = Y - Runtime Rx queue setup = Y - Runtime Tx queue setup = Y - Burst mode info = Y -+Free Tx mbuf on demand = Y - MTU update = Y - Jumbo frame = Y - Scattered Rx = Y -diff --git a/doc/guides/nics/features/hns3_vf.ini b/doc/guides/nics/features/hns3_vf.ini -index 3128b63..f3dd239 100644 ---- a/doc/guides/nics/features/hns3_vf.ini -+++ b/doc/guides/nics/features/hns3_vf.ini -@@ -10,6 +10,7 @@ Queue start/stop = Y - Runtime Rx queue setup = Y - Runtime Tx queue setup = Y - Burst mode info = Y -+Free Tx mbuf on demand = Y - MTU update = Y - Jumbo frame = Y - Scattered Rx = Y -diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c -index 2a37fcc..6e0f3b1 100644 ---- a/drivers/net/hns3/hns3_ethdev.c -+++ b/drivers/net/hns3/hns3_ethdev.c -@@ -6388,6 +6388,7 @@ static const struct eth_dev_ops hns3_eth_dev_ops = { - .fec_get = hns3_fec_get, - .fec_set = hns3_fec_set, - .tm_ops_get = hns3_tm_ops_get, -+ .tx_done_cleanup = hns3_tx_done_cleanup, - }; - - static const struct hns3_reset_ops hns3_reset_ops = { -diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c -index d5157cf..5b4c587 100644 ---- a/drivers/net/hns3/hns3_ethdev_vf.c -+++ b/drivers/net/hns3/hns3_ethdev_vf.c -@@ -2763,6 +2763,7 @@ static const struct eth_dev_ops hns3vf_eth_dev_ops = { - .vlan_offload_set = hns3vf_vlan_offload_set, - .get_reg = hns3_get_regs, - .dev_supported_ptypes_get = hns3_dev_supported_ptypes_get, -+ .tx_done_cleanup = hns3_tx_done_cleanup, - }; - - static const struct hns3_reset_ops hns3vf_reset_ops = { -diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c -index 1991b4e..df97018 100644 ---- a/drivers/net/hns3/hns3_rxtx.c -+++ b/drivers/net/hns3/hns3_rxtx.c -@@ -3913,6 +3913,65 @@ hns3_dev_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id) - return 0; - } - -+static int -+hns3_tx_done_cleanup_full(struct hns3_tx_queue *txq, uint32_t free_cnt) -+{ -+ uint16_t next_to_clean = txq->next_to_clean; -+ uint16_t next_to_use = txq->next_to_use; -+ uint16_t tx_bd_ready = txq->tx_bd_ready; -+ struct hns3_entry *tx_pkt = &txq->sw_ring[next_to_clean]; -+ struct hns3_desc *desc = &txq->tx_ring[next_to_clean]; -+ uint32_t idx; -+ -+ if (free_cnt == 0 || free_cnt > txq->nb_tx_desc) -+ free_cnt = txq->nb_tx_desc; -+ -+ for (idx = 0; idx < free_cnt; idx++) { -+ if (next_to_clean == next_to_use) -+ break; -+ -+ if (desc->tx.tp_fe_sc_vld_ra_ri & -+ rte_cpu_to_le_16(BIT(HNS3_TXD_VLD_B))) -+ break; -+ -+ if (tx_pkt->mbuf != NULL) { -+ rte_pktmbuf_free_seg(tx_pkt->mbuf); -+ tx_pkt->mbuf = NULL; -+ } -+ -+ next_to_clean++; -+ tx_bd_ready++; -+ tx_pkt++; -+ desc++; -+ if (next_to_clean == txq->nb_tx_desc) { -+ tx_pkt = txq->sw_ring; -+ desc = txq->tx_ring; -+ next_to_clean = 0; -+ } -+ } -+ -+ if (idx > 0) { -+ txq->next_to_clean = next_to_clean; -+ txq->tx_bd_ready = tx_bd_ready; -+ } -+ -+ return (int)idx; -+} -+ -+int -+hns3_tx_done_cleanup(void *txq, uint32_t free_cnt) -+{ -+ struct hns3_tx_queue *q = (struct hns3_tx_queue *)txq; -+ struct rte_eth_dev *dev = &rte_eth_devices[q->port_id]; -+ -+ if (dev->tx_pkt_burst == hns3_xmit_pkts) -+ return hns3_tx_done_cleanup_full(q, free_cnt); -+ else if (dev->tx_pkt_burst == hns3_dummy_rxtx_burst) -+ return 0; -+ else -+ return -ENOTSUP; -+} -+ - uint32_t - hns3_rx_queue_count(struct rte_eth_dev *dev, uint16_t rx_queue_id) - { -diff --git a/drivers/net/hns3/hns3_rxtx.h b/drivers/net/hns3/hns3_rxtx.h -index 8f5ae5c..7118bd4 100644 ---- a/drivers/net/hns3/hns3_rxtx.h -+++ b/drivers/net/hns3/hns3_rxtx.h -@@ -706,5 +706,6 @@ int hns3_start_all_txqs(struct rte_eth_dev *dev); - int hns3_start_all_rxqs(struct rte_eth_dev *dev); - void hns3_stop_all_txqs(struct rte_eth_dev *dev); - void hns3_restore_tqp_enable_state(struct hns3_hw *hw); -+int hns3_tx_done_cleanup(void *txq, uint32_t free_cnt); - - #endif /* _HNS3_RXTX_H_ */ --- -2.7.4 - diff --git a/0048-net-hns3-add-bytes-stats.patch b/0048-net-hns3-add-bytes-stats.patch deleted file mode 100644 index 062040ec2c6a007f2bd133650f540b61aded25c6..0000000000000000000000000000000000000000 --- a/0048-net-hns3-add-bytes-stats.patch +++ /dev/null @@ -1,210 +0,0 @@ -From e5b9ec998c2de659f177332bcdb4868116063b17 Mon Sep 17 00:00:00 2001 -From: "Min Hu (Connor)" -Date: Thu, 4 Mar 2021 15:44:44 +0800 -Subject: [PATCH 048/189] net/hns3: add bytes stats - -In current HNS3 PMD, Rx/Tx bytes from packet stats are not -implemented. - -This patch implemented Rx/Tx bytes using soft counters. - -Signed-off-by: Min Hu (Connor) -Signed-off-by: Lijun Ou ---- - drivers/net/hns3/hns3_rxtx.c | 16 ++++++++++++++++ - drivers/net/hns3/hns3_rxtx_vec_neon.h | 9 +++++++++ - drivers/net/hns3/hns3_rxtx_vec_sve.c | 8 ++++++++ - drivers/net/hns3/hns3_stats.c | 18 ++++++++++++++---- - 4 files changed, 47 insertions(+), 4 deletions(-) - -diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c -index df97018..897e5fa 100644 ---- a/drivers/net/hns3/hns3_rxtx.c -+++ b/drivers/net/hns3/hns3_rxtx.c -@@ -2181,6 +2181,9 @@ hns3_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) - cksum_err); - hns3_rxd_to_vlan_tci(rxq, rxm, l234_info, &rxd); - -+ /* Increment bytes counter */ -+ rxq->basic_stats.bytes += rxm->pkt_len; -+ - rx_pkts[nb_rx++] = rxm; - continue; - pkt_err: -@@ -2401,6 +2404,9 @@ hns3_recv_scattered_pkts(void *rx_queue, - cksum_err); - hns3_rxd_to_vlan_tci(rxq, first_seg, l234_info, &rxd); - -+ /* Increment bytes counter */ -+ rxq->basic_stats.bytes += first_seg->pkt_len; -+ - rx_pkts[nb_rx++] = first_seg; - first_seg = NULL; - continue; -@@ -3516,6 +3522,11 @@ hns3_tx_fill_hw_ring(struct hns3_tx_queue *txq, - for (i = 0; i < mainpart; i += PER_LOOP_NUM) { - hns3_tx_backup_4mbuf(tx_entry + i, pkts + i); - hns3_tx_setup_4bd(txdp + i, pkts + i); -+ -+ /* Increment bytes counter */ -+ uint32_t j; -+ for (j = 0; j < PER_LOOP_NUM; j++) -+ txq->basic_stats.bytes += pkts[i + j]->pkt_len; - } - if (unlikely(leftover > 0)) { - for (i = 0; i < leftover; i++) { -@@ -3523,6 +3534,9 @@ hns3_tx_fill_hw_ring(struct hns3_tx_queue *txq, - pkts + mainpart + i); - hns3_tx_setup_1bd(txdp + mainpart + i, - pkts + mainpart + i); -+ -+ /* Increment bytes counter */ -+ txq->basic_stats.bytes += pkts[mainpart + i]->pkt_len; - } - } - } -@@ -3661,6 +3675,8 @@ hns3_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) - desc->tx.tp_fe_sc_vld_ra_ri |= - rte_cpu_to_le_16(BIT(HNS3_TXD_FE_B)); - -+ /* Increment bytes counter */ -+ txq->basic_stats.bytes += tx_pkt->pkt_len; - nb_hold += i; - txq->next_to_use = tx_next_use; - txq->tx_bd_ready -= i; -diff --git a/drivers/net/hns3/hns3_rxtx_vec_neon.h b/drivers/net/hns3/hns3_rxtx_vec_neon.h -index a693b4b..68f098f 100644 ---- a/drivers/net/hns3/hns3_rxtx_vec_neon.h -+++ b/drivers/net/hns3/hns3_rxtx_vec_neon.h -@@ -61,6 +61,9 @@ hns3_xmit_fixed_burst_vec(void *__restrict tx_queue, - for (i = 0; i < n; i++, tx_pkts++, tx_desc++) { - hns3_vec_tx(tx_desc, *tx_pkts); - tx_entry[i].mbuf = *tx_pkts; -+ -+ /* Increment bytes counter */ -+ txq->basic_stats.bytes += (*tx_pkts)->pkt_len; - } - - nb_commit -= n; -@@ -72,6 +75,9 @@ hns3_xmit_fixed_burst_vec(void *__restrict tx_queue, - for (i = 0; i < nb_commit; i++, tx_pkts++, tx_desc++) { - hns3_vec_tx(tx_desc, *tx_pkts); - tx_entry[i].mbuf = *tx_pkts; -+ -+ /* Increment bytes counter */ -+ txq->basic_stats.bytes += (*tx_pkts)->pkt_len; - } - - next_to_use += nb_commit; -@@ -116,6 +122,9 @@ hns3_desc_parse_field(struct hns3_rx_queue *rxq, - if (likely(bd_base_info & BIT(HNS3_RXD_L3L4P_B))) - hns3_rx_set_cksum_flag(pkt, pkt->packet_type, - cksum_err); -+ -+ /* Increment bytes counter */ -+ rxq->basic_stats.bytes += pkt->pkt_len; - } - - return retcode; -diff --git a/drivers/net/hns3/hns3_rxtx_vec_sve.c b/drivers/net/hns3/hns3_rxtx_vec_sve.c -index 8c2c8f6..947c19f 100644 ---- a/drivers/net/hns3/hns3_rxtx_vec_sve.c -+++ b/drivers/net/hns3/hns3_rxtx_vec_sve.c -@@ -58,6 +58,9 @@ hns3_desc_parse_field_sve(struct hns3_rx_queue *rxq, - if (likely(key->bd_base_info[i] & BIT(HNS3_RXD_L3L4P_B))) - hns3_rx_set_cksum_flag(rx_pkts[i], - rx_pkts[i]->packet_type, cksum_err); -+ -+ /* Increment bytes counter */ -+ rxq->basic_stats.bytes += rx_pkts[i]->pkt_len; - } - - return retcode; -@@ -408,6 +411,11 @@ hns3_tx_fill_hw_ring_sve(struct hns3_tx_queue *txq, - svst1_scatter_u64offset_u64(pg, (uint64_t *)&txdp->tx.paylen, - offsets, svdup_n_u64(valid_bit)); - -+ /* Increment bytes counter */ -+ uint32_t idx; -+ for (idx = 0; idx < svcntd(); idx++) -+ txq->basic_stats.bytes += pkts[idx]->pkt_len; -+ - /* update index for next loop */ - i += svcntd(); - pkts += svcntd(); -diff --git a/drivers/net/hns3/hns3_stats.c b/drivers/net/hns3/hns3_stats.c -index e0e40ca..777d36a 100644 ---- a/drivers/net/hns3/hns3_stats.c -+++ b/drivers/net/hns3/hns3_stats.c -@@ -358,6 +358,7 @@ static const struct hns3_xstats_name_offset hns3_tx_queue_strings[] = { - HNS3_NUM_RESET_XSTATS) - - static void hns3_tqp_stats_clear(struct hns3_hw *hw); -+static void hns3_tqp_basic_stats_clear(struct rte_eth_dev *dev); - - /* - * Query all the MAC statistics data of Network ICL command ,opcode id: 0x0034. -@@ -543,16 +544,26 @@ hns3_stats_get(struct rte_eth_dev *eth_dev, struct rte_eth_stats *rte_stats) - return ret; - } - -- /* Get the error stats of received packets */ -+ /* Get the error stats and bytes of received packets */ - for (i = 0; i < eth_dev->data->nb_rx_queues; i++) { - rxq = eth_dev->data->rx_queues[i]; - if (rxq) { - cnt = rxq->err_stats.l2_errors + - rxq->err_stats.pkt_len_errors; - rte_stats->ierrors += cnt; -+ -+ rte_stats->ibytes += rxq->basic_stats.bytes; - } - } - -+ /* Get the bytes of received packets */ -+ struct hns3_tx_queue *txq; -+ for (i = 0; i < eth_dev->data->nb_tx_queues; i++) { -+ txq = eth_dev->data->tx_queues[i]; -+ if (txq) -+ rte_stats->obytes += txq->basic_stats.bytes; -+ } -+ - rte_stats->oerrors = 0; - /* - * If HW statistics are reset by stats_reset, but a lot of residual -@@ -623,6 +634,7 @@ hns3_stats_reset(struct rte_eth_dev *eth_dev) - * their source. - */ - hns3_tqp_stats_clear(hw); -+ hns3_tqp_basic_stats_clear(eth_dev); - - return 0; - } -@@ -807,7 +819,6 @@ hns3_rxq_basic_stats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *xstats, - rxq_stats->packets = - stats->rcb_rx_ring_pktnum[i] > rxq_stats->errors ? - stats->rcb_rx_ring_pktnum[i] - rxq_stats->errors : 0; -- rxq_stats->bytes = 0; - for (j = 0; j < HNS3_NUM_RXQ_BASIC_STATS; j++) { - val = (char *)rxq_stats + - hns3_rxq_basic_stats_strings[j].offset; -@@ -836,7 +847,7 @@ hns3_txq_basic_stats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *xstats, - - txq_stats = &txq->basic_stats; - txq_stats->packets = stats->rcb_tx_ring_pktnum[i]; -- txq_stats->bytes = 0; -+ - for (j = 0; j < HNS3_NUM_TXQ_BASIC_STATS; j++) { - val = (char *)txq_stats + - hns3_txq_basic_stats_strings[j].offset; -@@ -1328,7 +1339,6 @@ hns3_dev_xstats_reset(struct rte_eth_dev *dev) - if (ret) - return ret; - -- hns3_tqp_basic_stats_clear(dev); - hns3_tqp_dfx_stats_clear(dev); - - /* Clear reset stats */ --- -2.7.4 - diff --git a/0048-net-hns3-dump-device-basic-info.patch b/0048-net-hns3-dump-device-basic-info.patch new file mode 100644 index 0000000000000000000000000000000000000000..bad71a69c0cd8dd28fcacf74f5ec6b61ab79dfae --- /dev/null +++ b/0048-net-hns3-dump-device-basic-info.patch @@ -0,0 +1,174 @@ +From c79d78f63ba993a7fb45b7c842cfcfefb38ba5b6 Mon Sep 17 00:00:00 2001 +From: "Min Hu (Connor)" +Date: Fri, 11 Feb 2022 10:42:46 +0800 +Subject: [PATCH 03/13] net/hns3: dump device basic info + +This patch dumps device basic info such as device name, adapter state +for debug. + +Signed-off-by: Min Hu (Connor) +--- + drivers/net/hns3/hns3_ethdev.c | 1 + + drivers/net/hns3/hns3_ethdev.h | 1 + + drivers/net/hns3/hns3_ethdev_dump.c | 99 +++++++++++++++++++++++++++++ + drivers/net/hns3/hns3_ethdev_vf.c | 1 + + drivers/net/hns3/meson.build | 1 + + 5 files changed, 103 insertions(+) + create mode 100644 drivers/net/hns3/hns3_ethdev_dump.c + +diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c +index 13ebcde002..a9394eeeff 100644 +--- a/drivers/net/hns3/hns3_ethdev.c ++++ b/drivers/net/hns3/hns3_ethdev.c +@@ -6568,6 +6568,7 @@ static const struct eth_dev_ops hns3_eth_dev_ops = { + .timesync_adjust_time = hns3_timesync_adjust_time, + .timesync_read_time = hns3_timesync_read_time, + .timesync_write_time = hns3_timesync_write_time, ++ .eth_dev_priv_dump = hns3_eth_dev_priv_dump, + }; + + static const struct hns3_reset_ops hns3_reset_ops = { +diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h +index d62884cd9b..412626c053 100644 +--- a/drivers/net/hns3/hns3_ethdev.h ++++ b/drivers/net/hns3/hns3_ethdev.h +@@ -1055,6 +1055,7 @@ int hns3_timesync_read_time(struct rte_eth_dev *dev, struct timespec *ts); + int hns3_timesync_write_time(struct rte_eth_dev *dev, + const struct timespec *ts); + int hns3_timesync_adjust_time(struct rte_eth_dev *dev, int64_t delta); ++int hns3_eth_dev_priv_dump(struct rte_eth_dev *dev, FILE *file); + + static inline bool + is_reset_pending(struct hns3_adapter *hns) +diff --git a/drivers/net/hns3/hns3_ethdev_dump.c b/drivers/net/hns3/hns3_ethdev_dump.c +new file mode 100644 +index 0000000000..bd95184b02 +--- /dev/null ++++ b/drivers/net/hns3/hns3_ethdev_dump.c +@@ -0,0 +1,99 @@ ++/* SPDX-License-Identifier: BSD-3-Clause ++ * Copyright(C) 2022 HiSilicon Limited ++ */ ++ ++#include ++#include ++#include ++#include ++ ++#include "hns3_common.h" ++#include "hns3_logs.h" ++#include "hns3_regs.h" ++#include "hns3_rxtx.h" ++ ++static const char * ++hns3_get_adapter_state_name(uint32_t state) ++{ ++ static const char * const state_name[] = { ++ "UNINITIALIZED", ++ "INITIALIZED", ++ "CONFIGURING", ++ "CONFIGURED", ++ "STARTING", ++ "STARTED", ++ "STOPPING", ++ "CLOSING", ++ "CLOSED", ++ "REMOVED", ++ "NSTATES" ++ }; ++ ++ if (state < RTE_DIM(state_name)) ++ return state_name[state]; ++ else ++ return "unknown"; ++} ++ ++static const char * ++hns3_get_io_func_hint_name(uint32_t hint) ++{ ++ switch (hint) { ++ case HNS3_IO_FUNC_HINT_NONE: ++ return "none"; ++ case HNS3_IO_FUNC_HINT_VEC: ++ return "vec"; ++ case HNS3_IO_FUNC_HINT_SVE: ++ return "sve"; ++ case HNS3_IO_FUNC_HINT_SIMPLE: ++ return "simple"; ++ case HNS3_IO_FUNC_HINT_COMMON: ++ return "common"; ++ default: ++ return "unknown"; ++ } ++} ++ ++static void ++hns3_get_device_basic_info(FILE *file, struct rte_eth_dev *dev) ++{ ++ struct hns3_adapter *hns = dev->data->dev_private; ++ struct hns3_hw *hw = &hns->hw; ++ ++ fprintf(file, ++ " - Device Base Info:\n" ++ "\t -- name: %s\n" ++ "\t -- adapter_state=%s\n" ++ "\t -- nb_rx_queues=%u nb_tx_queues=%u\n" ++ "\t -- total_tqps_num=%u tqps_num=%u intr_tqps_num=%u\n" ++ "\t -- rss_size_max=%u alloc_rss_size=%u tx_qnum_per_tc=%u\n" ++ "\t -- min_tx_pkt_len=%u intr_mapping_mode=%u vlan_mode=%u\n" ++ "\t -- tso_mode=%u max_non_tso_bd_num=%u\n" ++ "\t -- max_tm_rate=%u Mbps\n" ++ "\t -- set link down: %s\n" ++ "\t -- rx_func_hint=%s tx_func_hint=%s\n" ++ "\t -- dev_flags: lsc=%d\n" ++ "\t -- intr_conf: lsc=%u rxq=%u\n", ++ dev->data->name, ++ hns3_get_adapter_state_name(hw->adapter_state), ++ dev->data->nb_rx_queues, dev->data->nb_tx_queues, ++ hw->total_tqps_num, hw->tqps_num, hw->intr_tqps_num, ++ hw->rss_size_max, hw->alloc_rss_size, hw->tx_qnum_per_tc, ++ hw->min_tx_pkt_len, hw->intr.mapping_mode, hw->vlan_mode, ++ hw->tso_mode, hw->max_non_tso_bd_num, ++ hw->max_tm_rate, ++ hw->set_link_down ? "Yes" : "No", ++ hns3_get_io_func_hint_name(hns->rx_func_hint), ++ hns3_get_io_func_hint_name(hns->tx_func_hint), ++ !!(dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC), ++ dev->data->dev_conf.intr_conf.lsc, ++ dev->data->dev_conf.intr_conf.rxq); ++} ++ ++int ++hns3_eth_dev_priv_dump(struct rte_eth_dev *dev, FILE *file) ++{ ++ hns3_get_device_basic_info(file, dev); ++ ++ return 0; ++} +diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c +index 5f905c515c..aee0c36360 100644 +--- a/drivers/net/hns3/hns3_ethdev_vf.c ++++ b/drivers/net/hns3/hns3_ethdev_vf.c +@@ -2290,6 +2290,7 @@ static const struct eth_dev_ops hns3vf_eth_dev_ops = { + .get_reg = hns3_get_regs, + .dev_supported_ptypes_get = hns3_dev_supported_ptypes_get, + .tx_done_cleanup = hns3_tx_done_cleanup, ++ .eth_dev_priv_dump = hns3_eth_dev_priv_dump, + }; + + static const struct hns3_reset_ops hns3vf_reset_ops = { +diff --git a/drivers/net/hns3/meson.build b/drivers/net/hns3/meson.build +index 8a4c7cc100..665b2afedf 100644 +--- a/drivers/net/hns3/meson.build ++++ b/drivers/net/hns3/meson.build +@@ -30,6 +30,7 @@ sources = files( + 'hns3_tm.c', + 'hns3_ptp.c', + 'hns3_common.c', ++ 'hns3_ethdev_dump.c', + ) + + deps += ['hash'] +-- +2.30.0 + diff --git a/0049-net-hns3-add-imissed-packet-stats.patch b/0049-net-hns3-add-imissed-packet-stats.patch deleted file mode 100644 index 222d3fa63a924665f9addc2a618840e5c74e35d6..0000000000000000000000000000000000000000 --- a/0049-net-hns3-add-imissed-packet-stats.patch +++ /dev/null @@ -1,274 +0,0 @@ -From 682546e9b26cf26a4b82a0c022f5c8dd4a7aa7ed Mon Sep 17 00:00:00 2001 -From: "Min Hu (Connor)" -Date: Thu, 4 Mar 2021 15:44:45 +0800 -Subject: [PATCH 049/189] net/hns3: add imissed packet stats - -This patch implement Rx imissed stats by querying cmdq. - -Signed-off-by: Min Hu (Connor) -Signed-off-by: Lijun Ou ---- - drivers/net/hns3/hns3_cmd.h | 7 +++ - drivers/net/hns3/hns3_ethdev.c | 7 +++ - drivers/net/hns3/hns3_ethdev.h | 1 + - drivers/net/hns3/hns3_stats.c | 106 ++++++++++++++++++++++++++++++++++++++++- - drivers/net/hns3/hns3_stats.h | 8 ++++ - 5 files changed, 128 insertions(+), 1 deletion(-) - -diff --git a/drivers/net/hns3/hns3_cmd.h b/drivers/net/hns3/hns3_cmd.h -index 2e23f99..93bfa74 100644 ---- a/drivers/net/hns3/hns3_cmd.h -+++ b/drivers/net/hns3/hns3_cmd.h -@@ -905,6 +905,13 @@ struct hns3_dev_specs_0_cmd { - uint32_t max_tm_rate; - }; - -+struct hns3_query_rpu_cmd { -+ uint32_t tc_queue_num; -+ uint32_t rsv1[2]; -+ uint32_t rpu_rx_pkt_drop_cnt; -+ uint32_t rsv2[2]; -+}; -+ - #define HNS3_MAX_TQP_NUM_HIP08_PF 64 - #define HNS3_DEFAULT_TX_BUF 0x4000 /* 16k bytes */ - #define HNS3_TOTAL_PKT_BUF 0x108000 /* 1.03125M bytes */ -diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c -index 6e0f3b1..96ad9b0 100644 ---- a/drivers/net/hns3/hns3_ethdev.c -+++ b/drivers/net/hns3/hns3_ethdev.c -@@ -4742,6 +4742,13 @@ hns3_init_pf(struct rte_eth_dev *eth_dev) - goto err_cmd_init; - } - -+ /* Hardware statistics of imissed registers cleared. */ -+ ret = hns3_update_imissed_stats(hw, true); -+ if (ret) { -+ hns3_err(hw, "clear imissed stats failed, ret = %d", ret); -+ return ret; -+ } -+ - hns3_config_all_msix_error(hw, true); - - ret = rte_intr_callback_register(&pci_dev->intr_handle, -diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h -index 6178f0b..2954422 100644 ---- a/drivers/net/hns3/hns3_ethdev.h -+++ b/drivers/net/hns3/hns3_ethdev.h -@@ -434,6 +434,7 @@ struct hns3_hw { - struct hns3_tqp_stats tqp_stats; - /* Include Mac stats | Rx stats | Tx stats */ - struct hns3_mac_stats mac_stats; -+ struct hns3_rx_missed_stats imissed_stats; - uint32_t fw_version; - - uint16_t num_msi; -diff --git a/drivers/net/hns3/hns3_stats.c b/drivers/net/hns3/hns3_stats.c -index 777d36a..87035e3 100644 ---- a/drivers/net/hns3/hns3_stats.c -+++ b/drivers/net/hns3/hns3_stats.c -@@ -324,6 +324,12 @@ static const struct hns3_xstats_name_offset hns3_tx_queue_strings[] = { - {"TX_QUEUE_FBD", HNS3_RING_TX_FBDNUM_REG} - }; - -+/* The statistic of imissed packet */ -+static const struct hns3_xstats_name_offset hns3_imissed_stats_strings[] = { -+ {"RPU_DROP_CNT", -+ HNS3_IMISSED_STATS_FIELD_OFFSET(rpu_rx_drop_cnt)}, -+}; -+ - #define HNS3_NUM_MAC_STATS (sizeof(hns3_mac_strings) / \ - sizeof(hns3_mac_strings[0])) - -@@ -354,8 +360,11 @@ static const struct hns3_xstats_name_offset hns3_tx_queue_strings[] = { - #define HNS3_NUM_TXQ_BASIC_STATS (sizeof(hns3_txq_basic_stats_strings) / \ - sizeof(hns3_txq_basic_stats_strings[0])) - -+#define HNS3_NUM_IMISSED_XSTATS (sizeof(hns3_imissed_stats_strings) / \ -+ sizeof(hns3_imissed_stats_strings[0])) -+ - #define HNS3_FIX_NUM_STATS (HNS3_NUM_MAC_STATS + HNS3_NUM_ERROR_INT_XSTATS + \ -- HNS3_NUM_RESET_XSTATS) -+ HNS3_NUM_RESET_XSTATS + HNS3_NUM_IMISSED_XSTATS) - - static void hns3_tqp_stats_clear(struct hns3_hw *hw); - static void hns3_tqp_basic_stats_clear(struct rte_eth_dev *dev); -@@ -515,6 +524,52 @@ hns3_update_tqp_stats(struct hns3_hw *hw) - return 0; - } - -+static int -+hns3_update_rpu_drop_stats(struct hns3_hw *hw) -+{ -+ struct hns3_rx_missed_stats *stats = &hw->imissed_stats; -+ struct hns3_query_rpu_cmd *req; -+ struct hns3_cmd_desc desc; -+ uint64_t cnt; -+ uint32_t tc_num; -+ int ret; -+ -+ hns3_cmd_setup_basic_desc(&desc, HNS3_OPC_DFX_RPU_REG_0, true); -+ req = (struct hns3_query_rpu_cmd *)desc.data; -+ -+ /* -+ * tc_num is 0, means rpu stats of all TC channels will be -+ * get from firmware -+ */ -+ tc_num = 0; -+ req->tc_queue_num = rte_cpu_to_le_32(tc_num); -+ ret = hns3_cmd_send(hw, &desc, 1); -+ if (ret) { -+ hns3_err(hw, "failed to query RPU stats: %d", ret); -+ return ret; -+ } -+ -+ cnt = rte_le_to_cpu_32(req->rpu_rx_pkt_drop_cnt); -+ stats->rpu_rx_drop_cnt += cnt; -+ -+ return 0; -+} -+ -+int -+hns3_update_imissed_stats(struct hns3_hw *hw, bool is_clear) -+{ -+ int ret; -+ -+ ret = hns3_update_rpu_drop_stats(hw); -+ if (ret) -+ return ret; -+ -+ if (is_clear) -+ memset(&hw->imissed_stats, 0, sizeof(hw->imissed_stats)); -+ -+ return 0; -+} -+ - /* - * Query tqp tx queue statistics ,opcode id: 0x0B03. - * Query tqp rx queue statistics ,opcode id: 0x0B13. -@@ -531,6 +586,7 @@ hns3_stats_get(struct rte_eth_dev *eth_dev, struct rte_eth_stats *rte_stats) - { - struct hns3_adapter *hns = eth_dev->data->dev_private; - struct hns3_hw *hw = &hns->hw; -+ struct hns3_rx_missed_stats *imissed_stats = &hw->imissed_stats; - struct hns3_tqp_stats *stats = &hw->tqp_stats; - struct hns3_rx_queue *rxq; - uint64_t cnt; -@@ -544,6 +600,18 @@ hns3_stats_get(struct rte_eth_dev *eth_dev, struct rte_eth_stats *rte_stats) - return ret; - } - -+ if (!hns->is_vf) { -+ /* Update imissed stats */ -+ ret = hns3_update_imissed_stats(hw, false); -+ if (ret) { -+ hns3_err(hw, "update imissed stats failed, ret = %d", -+ ret); -+ return ret; -+ } -+ -+ rte_stats->imissed = imissed_stats->rpu_rx_drop_cnt; -+ } -+ - /* Get the error stats and bytes of received packets */ - for (i = 0; i < eth_dev->data->nb_rx_queues; i++) { - rxq = eth_dev->data->rx_queues[i]; -@@ -616,6 +684,19 @@ hns3_stats_reset(struct rte_eth_dev *eth_dev) - } - } - -+ if (!hns->is_vf) { -+ /* -+ * Note: Reading hardware statistics of imissed registers will -+ * clear them. -+ */ -+ ret = hns3_update_imissed_stats(hw, true); -+ if (ret) { -+ hns3_err(hw, "clear imissed stats failed, ret = %d", -+ ret); -+ return ret; -+ } -+ } -+ - /* - * Clear soft stats of rx error packet which will be dropped - * in driver. -@@ -928,6 +1009,7 @@ hns3_dev_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *xstats, - struct hns3_adapter *hns = dev->data->dev_private; - struct hns3_pf *pf = &hns->pf; - struct hns3_hw *hw = &hns->hw; -+ struct hns3_rx_missed_stats *imissed_stats = &hw->imissed_stats; - struct hns3_mac_stats *mac_stats = &hw->mac_stats; - struct hns3_reset_stats *reset_stats = &hw->reset.stats; - struct hns3_rx_bd_errors_stats *rx_err_stats; -@@ -966,6 +1048,21 @@ hns3_dev_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *xstats, - count++; - } - -+ ret = hns3_update_imissed_stats(hw, false); -+ if (ret) { -+ hns3_err(hw, "update imissed stats failed, ret = %d", -+ ret); -+ return ret; -+ } -+ -+ for (i = 0; i < HNS3_NUM_IMISSED_XSTATS; i++) { -+ addr = (char *)imissed_stats + -+ hns3_imissed_stats_strings[i].offset; -+ xstats[count].value = *(uint64_t *)addr; -+ xstats[count].id = count; -+ count++; -+ } -+ - for (i = 0; i < HNS3_NUM_ERROR_INT_XSTATS; i++) { - addr = (char *)&pf->abn_int_stats + - hns3_error_int_stats_strings[i].offset; -@@ -1108,6 +1205,13 @@ hns3_dev_xstats_get_names(struct rte_eth_dev *dev, - count++; - } - -+ for (i = 0; i < HNS3_NUM_IMISSED_XSTATS; i++) { -+ snprintf(xstats_names[count].name, -+ sizeof(xstats_names[count].name), -+ "%s", hns3_imissed_stats_strings[i].name); -+ count++; -+ } -+ - for (i = 0; i < HNS3_NUM_ERROR_INT_XSTATS; i++) { - snprintf(xstats_names[count].name, - sizeof(xstats_names[count].name), -diff --git a/drivers/net/hns3/hns3_stats.h b/drivers/net/hns3/hns3_stats.h -index d213be5..01b4f36 100644 ---- a/drivers/net/hns3/hns3_stats.h -+++ b/drivers/net/hns3/hns3_stats.h -@@ -110,6 +110,10 @@ struct hns3_mac_stats { - uint64_t mac_rx_ctrl_pkt_num; - }; - -+struct hns3_rx_missed_stats { -+ uint64_t rpu_rx_drop_cnt; -+}; -+ - /* store statistics names and its offset in stats structure */ - struct hns3_xstats_name_offset { - char name[RTE_ETH_XSTATS_NAME_SIZE]; -@@ -141,6 +145,9 @@ struct hns3_reset_stats; - #define HNS3_TXQ_BASIC_STATS_FIELD_OFFSET(f) \ - (offsetof(struct hns3_tx_basic_stats, f)) - -+#define HNS3_IMISSED_STATS_FIELD_OFFSET(f) \ -+ (offsetof(struct hns3_rx_missed_stats, f)) -+ - int hns3_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *rte_stats); - int hns3_dev_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *xstats, - unsigned int n); -@@ -160,5 +167,6 @@ int hns3_stats_reset(struct rte_eth_dev *dev); - void hns3_error_int_stats_add(struct hns3_adapter *hns, const char *err); - int hns3_tqp_stats_init(struct hns3_hw *hw); - void hns3_tqp_stats_uninit(struct hns3_hw *hw); -+int hns3_update_imissed_stats(struct hns3_hw *hw, bool is_clear); - - #endif /* _HNS3_STATS_H_ */ --- -2.7.4 - diff --git a/0049-net-hns3-dump-device-feature-capability.patch b/0049-net-hns3-dump-device-feature-capability.patch new file mode 100644 index 0000000000000000000000000000000000000000..60a66c18aae8898da06e53036451c41a4d1c4434 --- /dev/null +++ b/0049-net-hns3-dump-device-feature-capability.patch @@ -0,0 +1,63 @@ +From 9bbea26d3c903f5741447a1b1a943d02b275af56 Mon Sep 17 00:00:00 2001 +From: "Min Hu (Connor)" +Date: Fri, 11 Feb 2022 10:52:06 +0800 +Subject: [PATCH 04/13] net/hns3: dump device feature capability + +Kunpeng 920 and Kunpeng 930 support different feature capability. +This patch dumps feature capability Current device supports. + +Signed-off-by: Min Hu (Connor) +--- + drivers/net/hns3/hns3_ethdev_dump.c | 28 ++++++++++++++++++++++++++++ + 1 file changed, 28 insertions(+) + +diff --git a/drivers/net/hns3/hns3_ethdev_dump.c b/drivers/net/hns3/hns3_ethdev_dump.c +index bd95184b02..a0fa0a3584 100644 +--- a/drivers/net/hns3/hns3_ethdev_dump.c ++++ b/drivers/net/hns3/hns3_ethdev_dump.c +@@ -55,6 +55,30 @@ hns3_get_io_func_hint_name(uint32_t hint) + } + + static void ++hns3_get_dev_feature_capability(FILE *file, struct hns3_hw *hw) ++{ ++ const char * const caps_name[] = { ++ "DCB", ++ "COPPER", ++ "FD QUEUE REGION", ++ "PTP", ++ "TX PUSH", ++ "INDEP TXRX", ++ "STASH", ++ "SIMPLE BD", ++ "RXD Advanced Layout", ++ "OUTER UDP CKSUM", ++ "RAS IMP", ++ "TM", ++ }; ++ uint32_t i; ++ ++ fprintf(file, " - Dev Capability:\n"); ++ for (i = 0; i < RTE_DIM(caps_name); i++) ++ fprintf(file, "\t -- support %s: %s\n", caps_name[i], ++ hw->capability & BIT(i) ? "yes" : "no"); ++} ++ + hns3_get_device_basic_info(FILE *file, struct rte_eth_dev *dev) + { + struct hns3_adapter *hns = dev->data->dev_private; +@@ -93,7 +117,11 @@ hns3_get_device_basic_info(FILE *file, struct rte_eth_dev *dev) + int + hns3_eth_dev_priv_dump(struct rte_eth_dev *dev, FILE *file) + { ++ struct hns3_adapter *hns = dev->data->dev_private; ++ struct hns3_hw *hw = &hns->hw; ++ + hns3_get_device_basic_info(file, dev); ++ hns3_get_dev_feature_capability(file, hw); + + return 0; + } +-- +2.30.0 + diff --git a/0050-net-hns3-dump-device-MAC-info.patch b/0050-net-hns3-dump-device-MAC-info.patch new file mode 100644 index 0000000000000000000000000000000000000000..e644a1c4eb2503e65b12ac1ad4e7facf21ef9c46 --- /dev/null +++ b/0050-net-hns3-dump-device-MAC-info.patch @@ -0,0 +1,63 @@ +From 7041258cda77065d991d6ee8913edf110bd12531 Mon Sep 17 00:00:00 2001 +From: "Min Hu (Connor)" +Date: Fri, 11 Feb 2022 10:56:54 +0800 +Subject: [PATCH 05/13] net/hns3: dump device MAC info + +This patch dumps device MAC info which hns3 PMD private info offers. + +Signed-off-by: Min Hu (Connor) +--- + drivers/net/hns3/hns3_ethdev_dump.c | 31 +++++++++++++++++++++++++++++ + 1 file changed, 31 insertions(+) + +diff --git a/drivers/net/hns3/hns3_ethdev_dump.c b/drivers/net/hns3/hns3_ethdev_dump.c +index a0fa0a3584..83601d9bda 100644 +--- a/drivers/net/hns3/hns3_ethdev_dump.c ++++ b/drivers/net/hns3/hns3_ethdev_dump.c +@@ -54,6 +54,28 @@ hns3_get_io_func_hint_name(uint32_t hint) + } + } + ++static void ++hns3_get_dev_mac_info(FILE *file, struct hns3_adapter *hns) ++{ ++ struct hns3_hw *hw = &hns->hw; ++ struct hns3_pf *pf = &hns->pf; ++ ++ fprintf(file, " - MAC Info:\n"); ++ fprintf(file, ++ "\t -- query_type=%u\n" ++ "\t -- supported_speed=0x%x\n" ++ "\t -- advertising=0x%x\n" ++ "\t -- lp_advertising=0x%x\n" ++ "\t -- support_autoneg=%s\n" ++ "\t -- support_fc_autoneg=%s\n", ++ hw->mac.query_type, ++ hw->mac.supported_speed, ++ hw->mac.advertising, ++ hw->mac.lp_advertising, ++ hw->mac.support_autoneg != 0 ? "Yes" : "No", ++ pf->support_fc_autoneg ? "Yes" : "No"); ++} ++ + static void + hns3_get_dev_feature_capability(FILE *file, struct hns3_hw *hw) + { +@@ -123,5 +145,14 @@ hns3_eth_dev_priv_dump(struct rte_eth_dev *dev, FILE *file) + hns3_get_device_basic_info(file, dev); + hns3_get_dev_feature_capability(file, hw); + ++ /* ++ * VF only supports dumping basic info, feaure capability and queue ++ * info. ++ */ ++ if (hns->is_vf) ++ return 0; ++ ++ hns3_get_dev_mac_info(file, hns); ++ + return 0; + } +-- +2.30.0 + diff --git a/0050-net-hns3-encapsulate-port-shaping-interface.patch b/0050-net-hns3-encapsulate-port-shaping-interface.patch deleted file mode 100644 index 50ef1f97d871bfcd3605a8feea0645321e4e5926..0000000000000000000000000000000000000000 --- a/0050-net-hns3-encapsulate-port-shaping-interface.patch +++ /dev/null @@ -1,122 +0,0 @@ -From 73f3a8aa0b5926083482f5e1f9999e246856a2ae Mon Sep 17 00:00:00 2001 -From: Huisong Li -Date: Thu, 4 Mar 2021 15:44:46 +0800 -Subject: [PATCH 050/189] net/hns3: encapsulate port shaping interface - -When rate of port changes, the rate limit of the port needs to -be updated. So it is necessary to encapsulate an interface that -configures the rate limit based on the rate. - -Signed-off-by: Huisong Li -Signed-off-by: Lijun Ou ---- - drivers/net/hns3/hns3_dcb.c | 22 +++++++++++++++++----- - drivers/net/hns3/hns3_dcb.h | 2 +- - drivers/net/hns3/hns3_ethdev.c | 10 +++------- - 3 files changed, 21 insertions(+), 13 deletions(-) - -diff --git a/drivers/net/hns3/hns3_dcb.c b/drivers/net/hns3/hns3_dcb.c -index 7fc6ac9..ebfc240 100644 ---- a/drivers/net/hns3/hns3_dcb.c -+++ b/drivers/net/hns3/hns3_dcb.c -@@ -330,8 +330,8 @@ hns3_dcb_get_shapping_para(uint8_t ir_b, uint8_t ir_u, uint8_t ir_s, - return shapping_para; - } - --int --hns3_dcb_port_shaper_cfg(struct hns3_hw *hw) -+static int -+hns3_dcb_port_shaper_cfg(struct hns3_hw *hw, uint32_t speed) - { - struct hns3_port_shapping_cmd *shap_cfg_cmd; - struct hns3_shaper_parameter shaper_parameter; -@@ -340,7 +340,7 @@ hns3_dcb_port_shaper_cfg(struct hns3_hw *hw) - struct hns3_cmd_desc desc; - int ret; - -- ret = hns3_shaper_para_calc(hw, hw->mac.link_speed, -+ ret = hns3_shaper_para_calc(hw, speed, - HNS3_SHAPER_LVL_PORT, &shaper_parameter); - if (ret) { - hns3_err(hw, "calculate shaper parameter failed: %d", ret); -@@ -366,12 +366,24 @@ hns3_dcb_port_shaper_cfg(struct hns3_hw *hw) - * depends on the firmware version. But driver still needs to - * calculate it and configure to firmware for better compatibility. - */ -- shap_cfg_cmd->port_rate = rte_cpu_to_le_32(hw->mac.link_speed); -+ shap_cfg_cmd->port_rate = rte_cpu_to_le_32(speed); - hns3_set_bit(shap_cfg_cmd->flag, HNS3_TM_RATE_VLD_B, 1); - - return hns3_cmd_send(hw, &desc, 1); - } - -+int -+hns3_port_shaper_update(struct hns3_hw *hw, uint32_t speed) -+{ -+ int ret; -+ -+ ret = hns3_dcb_port_shaper_cfg(hw, speed); -+ if (ret) -+ hns3_err(hw, "configure port shappering failed: ret = %d", ret); -+ -+ return ret; -+} -+ - static int - hns3_dcb_pg_shapping_cfg(struct hns3_hw *hw, enum hns3_shap_bucket bucket, - uint8_t pg_id, uint32_t shapping_para, uint32_t rate) -@@ -961,7 +973,7 @@ hns3_dcb_shaper_cfg(struct hns3_hw *hw) - { - int ret; - -- ret = hns3_dcb_port_shaper_cfg(hw); -+ ret = hns3_dcb_port_shaper_cfg(hw, hw->mac.link_speed); - if (ret) { - hns3_err(hw, "config port shaper failed: %d", ret); - return ret; -diff --git a/drivers/net/hns3/hns3_dcb.h b/drivers/net/hns3/hns3_dcb.h -index 8248434..0d25d3b 100644 ---- a/drivers/net/hns3/hns3_dcb.h -+++ b/drivers/net/hns3/hns3_dcb.h -@@ -208,7 +208,7 @@ int hns3_queue_to_tc_mapping(struct hns3_hw *hw, uint16_t nb_rx_q, - uint16_t nb_tx_q); - - int hns3_dcb_cfg_update(struct hns3_adapter *hns); --int hns3_dcb_port_shaper_cfg(struct hns3_hw *hw); -+int hns3_port_shaper_update(struct hns3_hw *hw, uint32_t speed); - int hns3_pg_shaper_rate_cfg(struct hns3_hw *hw, uint8_t pg_id, uint32_t rate); - int hns3_pri_shaper_rate_cfg(struct hns3_hw *hw, uint8_t tc_no, uint32_t rate); - uint8_t hns3_txq_mapped_tc_get(struct hns3_hw *hw, uint16_t txq_no); -diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c -index 96ad9b0..94c08e8 100644 ---- a/drivers/net/hns3/hns3_ethdev.c -+++ b/drivers/net/hns3/hns3_ethdev.c -@@ -4384,7 +4384,6 @@ static int - hns3_cfg_mac_speed_dup(struct hns3_hw *hw, uint32_t speed, uint8_t duplex) - { - struct hns3_mac *mac = &hw->mac; -- uint32_t cur_speed = mac->link_speed; - int ret; - - duplex = hns3_check_speed_dup(duplex, speed); -@@ -4395,14 +4394,11 @@ hns3_cfg_mac_speed_dup(struct hns3_hw *hw, uint32_t speed, uint8_t duplex) - if (ret) - return ret; - -- mac->link_speed = speed; -- ret = hns3_dcb_port_shaper_cfg(hw); -- if (ret) { -- hns3_err(hw, "failed to configure port shaper, ret = %d.", ret); -- mac->link_speed = cur_speed; -+ ret = hns3_port_shaper_update(hw, speed); -+ if (ret) - return ret; -- } - -+ mac->link_speed = speed; - mac->link_duplex = duplex; - - return 0; --- -2.7.4 - diff --git a/0051-net-hns3-dump-queue-info.patch b/0051-net-hns3-dump-queue-info.patch new file mode 100644 index 0000000000000000000000000000000000000000..58bcfb5882e39e73e924b1b42c57ae8ed601de2a --- /dev/null +++ b/0051-net-hns3-dump-queue-info.patch @@ -0,0 +1,254 @@ +From 698e42cb7ca963e34b2f8c7e1f9be98a7793bed3 Mon Sep 17 00:00:00 2001 +From: "Min Hu (Connor)" +Date: Fri, 11 Feb 2022 11:03:05 +0800 +Subject: [PATCH 06/13] net/hns3: dump queue info + +This patch dumps Rx/Tx queue info, such as queue numbers, queue enable +state for debug. + +Signed-off-by: Min Hu (Connor) +--- + drivers/net/hns3/hns3_ethdev_dump.c | 220 ++++++++++++++++++++++++++++ + 1 file changed, 220 insertions(+) + +diff --git a/drivers/net/hns3/hns3_ethdev_dump.c b/drivers/net/hns3/hns3_ethdev_dump.c +index 83601d9bda..face41e4a7 100644 +--- a/drivers/net/hns3/hns3_ethdev_dump.c ++++ b/drivers/net/hns3/hns3_ethdev_dump.c +@@ -136,6 +136,225 @@ hns3_get_device_basic_info(FILE *file, struct rte_eth_dev *dev) + dev->data->dev_conf.intr_conf.rxq); + } + ++/* ++ * Note: caller must make sure queue_id < nb_queues ++ * nb_queues = RTE_MAX(eth_dev->data->nb_rx_queues, ++ * eth_dev->data->nb_tx_queues) ++ */ ++static struct hns3_rx_queue * ++hns3_get_rx_queue(struct rte_eth_dev *dev, uint32_t queue_id) ++{ ++ struct hns3_adapter *hns = dev->data->dev_private; ++ struct hns3_hw *hw = &hns->hw; ++ uint32_t offset; ++ void **rx_queues; ++ ++ if (queue_id < dev->data->nb_rx_queues) { ++ rx_queues = dev->data->rx_queues; ++ offset = queue_id; ++ } else { ++ /* ++ * For kunpeng930, fake queue is not exist. But since the queues ++ * are usually accessd in pairs, this branch may still exist. ++ */ ++ if (hns3_dev_get_support(hw, INDEP_TXRX)) ++ return NULL; ++ ++ rx_queues = hw->fkq_data.rx_queues; ++ offset = queue_id - dev->data->nb_rx_queues; ++ } ++ ++ if (rx_queues != NULL && rx_queues[offset] != NULL) ++ return rx_queues[offset]; ++ ++ hns3_err(hw, "Detect rx_queues is NULL!\n"); ++ return NULL; ++} ++ ++/* ++ * Note: caller must make sure queue_id < nb_queues ++ * nb_queues = RTE_MAX(eth_dev->data->nb_rx_queues, ++ * eth_dev->data->nb_tx_queues) ++ */ ++static struct hns3_tx_queue * ++hns3_get_tx_queue(struct rte_eth_dev *dev, uint32_t queue_id) ++{ ++ struct hns3_adapter *hns = dev->data->dev_private; ++ struct hns3_hw *hw = &hns->hw; ++ uint32_t offset; ++ void **tx_queues; ++ ++ if (queue_id < dev->data->nb_tx_queues) { ++ tx_queues = dev->data->tx_queues; ++ offset = queue_id; ++ } else { ++ /* ++ * For kunpeng930, fake queue is not exist. But since the queues ++ * are usually accessd in pairs, this branch may still exist. ++ */ ++ if (hns3_dev_get_support(hw, INDEP_TXRX)) ++ return NULL; ++ tx_queues = hw->fkq_data.tx_queues; ++ offset = queue_id - dev->data->nb_tx_queues; ++ } ++ ++ if (tx_queues != NULL && tx_queues[offset] != NULL) ++ return tx_queues[offset]; ++ ++ hns3_err(hw, "Detect tx_queues is NULL!\n"); ++ return NULL; ++} ++ ++static void ++hns3_get_rxtx_fake_queue_info(FILE *file, struct rte_eth_dev *dev) ++{ ++ struct hns3_adapter *hns = dev->data->dev_private; ++ struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(hns); ++ struct hns3_rx_queue *rxq; ++ struct hns3_tx_queue *txq; ++ uint32_t queue_id; ++ ++ if (dev->data->nb_rx_queues != dev->data->nb_tx_queues && ++ !hns3_dev_get_support(hw, INDEP_TXRX)) { ++ queue_id = RTE_MIN(dev->data->nb_rx_queues, ++ dev->data->nb_tx_queues); ++ rxq = hns3_get_rx_queue(dev, queue_id); ++ if (rxq == NULL) ++ return; ++ txq = hns3_get_tx_queue(dev, queue_id); ++ if (txq == NULL) ++ return; ++ fprintf(file, ++ "\t -- first fake_queue rxtx info:\n" ++ "\t Rx: port=%u nb_desc=%u free_thresh=%u\n" ++ "\t Tx: port=%u nb_desc=%u\n", ++ rxq->port_id, rxq->nb_rx_desc, rxq->rx_free_thresh, ++ txq->port_id, txq->nb_tx_desc); ++ } ++} ++ ++static void ++hns3_get_queue_enable_state(struct hns3_hw *hw, uint32_t *queue_state, ++ uint32_t nb_queues, bool is_rxq) ++{ ++#define STATE_SIZE (sizeof(*queue_state) * CHAR_BIT) ++ uint32_t queue_en_reg; ++ uint32_t reg_offset; ++ uint32_t state; ++ uint32_t i; ++ ++ queue_en_reg = is_rxq ? HNS3_RING_RX_EN_REG : HNS3_RING_TX_EN_REG; ++ for (i = 0; i < nb_queues; i++) { ++ reg_offset = hns3_get_tqp_reg_offset(i); ++ state = hns3_read_dev(hw, reg_offset + HNS3_RING_EN_REG); ++ if (hns3_dev_get_support(hw, INDEP_TXRX)) ++ state = state && hns3_read_dev(hw, reg_offset + ++ queue_en_reg); ++ hns3_set_bit(queue_state[i / STATE_SIZE], ++ i % STATE_SIZE, state); ++ } ++} ++ ++static void ++hns3_print_queue_state_perline(FILE *file, const uint32_t *queue_state, ++ uint32_t nb_queues, uint32_t line_num) ++{ ++#define NUM_QUEUE_PER_LINE (sizeof(*queue_state) * CHAR_BIT) ++ uint32_t qid = line_num * NUM_QUEUE_PER_LINE; ++ uint32_t j; ++ ++ for (j = 0; j < NUM_QUEUE_PER_LINE; j++) { ++ fprintf(file, "%1lx", hns3_get_bit(queue_state[line_num], j)); ++ ++ if (qid % CHAR_BIT == CHAR_BIT - 1) { ++ fprintf(file, "%s", ++ j == NUM_QUEUE_PER_LINE - 1 ? "\n" : ":"); ++ } ++ qid++; ++ if (qid >= nb_queues) { ++ fprintf(file, "\n"); ++ break; ++ } ++ } ++} ++ ++static void ++hns3_display_queue_enable_state(FILE *file, const uint32_t *queue_state, ++ uint32_t nb_queues, bool is_rxq) ++{ ++#define NUM_QUEUE_PER_LINE (sizeof(*queue_state) * CHAR_BIT) ++ uint32_t i; ++ ++ if (nb_queues == 0) { ++ fprintf(file, "\t %s queue number is 0\n", ++ is_rxq ? "Rx" : "Tx"); ++ return; ++ } ++ ++ fprintf(file, "\t %s queue id | enable state bitMap\n", ++ is_rxq ? "Rx" : "Tx"); ++ ++ for (i = 0; i < (nb_queues - 1) / NUM_QUEUE_PER_LINE + 1; i++) { ++ uint32_t line_end = (i + 1) * NUM_QUEUE_PER_LINE - 1; ++ uint32_t line_start = i * NUM_QUEUE_PER_LINE; ++ fprintf(file, "\t %04u - %04u | ", line_start, ++ nb_queues - 1 > line_end ? line_end : nb_queues - 1); ++ ++ hns3_print_queue_state_perline(file, queue_state, nb_queues, i); ++ } ++} ++ ++static void ++hns3_get_rxtx_queue_enable_state(FILE *file, struct rte_eth_dev *dev) ++{ ++#define MAX_TQP_NUM 1280 ++#define QUEUE_BITMAP_SIZE (MAX_TQP_NUM / 32) ++ struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private); ++ uint32_t rx_queue_state[QUEUE_BITMAP_SIZE] = {0}; ++ uint32_t tx_queue_state[QUEUE_BITMAP_SIZE] = {0}; ++ uint32_t nb_rx_queues; ++ uint32_t nb_tx_queues; ++ ++ nb_rx_queues = dev->data->nb_rx_queues; ++ nb_tx_queues = dev->data->nb_tx_queues; ++ ++ fprintf(file, "\t -- enable state:\n"); ++ hns3_get_queue_enable_state(hw, rx_queue_state, nb_rx_queues, true); ++ hns3_display_queue_enable_state(file, rx_queue_state, nb_rx_queues, ++ true); ++ ++ hns3_get_queue_enable_state(hw, tx_queue_state, nb_tx_queues, false); ++ hns3_display_queue_enable_state(file, tx_queue_state, nb_tx_queues, ++ false); ++} ++ ++static void ++hns3_get_rxtx_queue_info(FILE *file, struct rte_eth_dev *dev) ++{ ++ struct hns3_rx_queue *rxq; ++ struct hns3_tx_queue *txq; ++ uint32_t queue_id = 0; ++ ++ rxq = hns3_get_rx_queue(dev, queue_id); ++ if (rxq == NULL) ++ return; ++ txq = hns3_get_tx_queue(dev, queue_id); ++ if (txq == NULL) ++ return; ++ fprintf(file, " - Rx/Tx Queue Info:\n"); ++ fprintf(file, ++ "\t -- first queue rxtx info:\n" ++ "\t Rx: port=%u nb_desc=%u free_thresh=%u\n" ++ "\t Tx: port=%u nb_desc=%u\n" ++ "\t -- tx push: %s\n", ++ rxq->port_id, rxq->nb_rx_desc, rxq->rx_free_thresh, ++ txq->port_id, txq->nb_tx_desc, ++ txq->tx_push_enable ? "enabled" : "disabled"); ++ ++ hns3_get_rxtx_fake_queue_info(file, dev); ++ hns3_get_rxtx_queue_enable_state(file, dev); ++} ++ + int + hns3_eth_dev_priv_dump(struct rte_eth_dev *dev, FILE *file) + { +@@ -144,6 +363,7 @@ hns3_eth_dev_priv_dump(struct rte_eth_dev *dev, FILE *file) + + hns3_get_device_basic_info(file, dev); + hns3_get_dev_feature_capability(file, hw); ++ hns3_get_rxtx_queue_info(file, dev); + + /* + * VF only supports dumping basic info, feaure capability and queue +-- +2.30.0 + diff --git a/0051-net-hns3-fix-device-capabilities-for-copper-media-ty.patch b/0051-net-hns3-fix-device-capabilities-for-copper-media-ty.patch deleted file mode 100644 index 1457ab45a736af4c17c9e202571c52a3151d6a5c..0000000000000000000000000000000000000000 --- a/0051-net-hns3-fix-device-capabilities-for-copper-media-ty.patch +++ /dev/null @@ -1,48 +0,0 @@ -From 35469e7e3c26afc79f340b8477bf7ce1dc65746e Mon Sep 17 00:00:00 2001 -From: Huisong Li -Date: Thu, 4 Mar 2021 15:44:47 +0800 -Subject: [PATCH 051/189] net/hns3: fix device capabilities for copper media - type - -The configuration operation for PHY is implemented by firmware. And -a capability flag will be report to driver, which means the firmware -supports the PHY driver. However, the current implementation only -supports obtaining the capability bit, but some basic functions of -copper ports in driver, such as, the query of link status and link -info, are not supported. - -Therefore, it is necessary for driver to set the copper capability -bit to zero when the firmware supports the configuration of the PHY. - -Fixes: 438752358158 ("net/hns3: get device capability from firmware") -Fixes: 95e50325864c ("net/hns3: support copper media type") -Cc: stable@dpdk.org - -Signed-off-by: Huisong Li ---- - drivers/net/hns3/hns3_cmd.c | 8 +++++++- - 1 file changed, 7 insertions(+), 1 deletion(-) - -diff --git a/drivers/net/hns3/hns3_cmd.c b/drivers/net/hns3/hns3_cmd.c -index 0590898..f0bc177 100644 ---- a/drivers/net/hns3/hns3_cmd.c -+++ b/drivers/net/hns3/hns3_cmd.c -@@ -423,8 +423,14 @@ static void hns3_parse_capability(struct hns3_hw *hw, - hns3_set_bit(hw->capability, HNS3_DEV_SUPPORT_PTP_B, 1); - if (hns3_get_bit(caps, HNS3_CAPS_TX_PUSH_B)) - hns3_set_bit(hw->capability, HNS3_DEV_SUPPORT_TX_PUSH_B, 1); -+ /* -+ * Currently, the query of link status and link info on copper ports -+ * are not supported. So it is necessary for driver to set the copper -+ * capability bit to zero when the firmware supports the configuration -+ * of the PHY. -+ */ - if (hns3_get_bit(caps, HNS3_CAPS_PHY_IMP_B)) -- hns3_set_bit(hw->capability, HNS3_DEV_SUPPORT_COPPER_B, 1); -+ hns3_set_bit(hw->capability, HNS3_DEV_SUPPORT_COPPER_B, 0); - if (hns3_get_bit(caps, HNS3_CAPS_TQP_TXRX_INDEP_B)) - hns3_set_bit(hw->capability, HNS3_DEV_SUPPORT_INDEP_TXRX_B, 1); - if (hns3_get_bit(caps, HNS3_CAPS_STASH_B)) --- -2.7.4 - diff --git a/0052-net-hns3-dump-VLAN-configuration-info.patch b/0052-net-hns3-dump-VLAN-configuration-info.patch new file mode 100644 index 0000000000000000000000000000000000000000..03f3bf88c7113eeb7ec389552864c66d641c2472 --- /dev/null +++ b/0052-net-hns3-dump-VLAN-configuration-info.patch @@ -0,0 +1,180 @@ +From 05e415e929a404187f6b595a0b0f1ea958c1ca12 Mon Sep 17 00:00:00 2001 +From: "Min Hu (Connor)" +Date: Fri, 11 Feb 2022 11:06:55 +0800 +Subject: [PATCH 07/13] net/hns3: dump VLAN configuration info + +This patch dump VLAN filter, strip related info and Pvid info for debug. + +Signed-off-by: Min Hu (Connor) +--- + drivers/net/hns3/hns3_ethdev_dump.c | 147 ++++++++++++++++++++++++++++ + 1 file changed, 147 insertions(+) + +diff --git a/drivers/net/hns3/hns3_ethdev_dump.c b/drivers/net/hns3/hns3_ethdev_dump.c +index face41e4a7..d017e66e69 100644 +--- a/drivers/net/hns3/hns3_ethdev_dump.c ++++ b/drivers/net/hns3/hns3_ethdev_dump.c +@@ -355,6 +355,152 @@ hns3_get_rxtx_queue_info(FILE *file, struct rte_eth_dev *dev) + hns3_get_rxtx_queue_enable_state(file, dev); + } + ++static int ++hns3_get_vlan_rx_offload_cfg(FILE *file, struct hns3_hw *hw) ++{ ++ struct hns3_vport_vtag_rx_cfg_cmd *req; ++ struct hns3_cmd_desc desc; ++ uint16_t vport_id; ++ uint8_t bitmap; ++ int ret; ++ ++ hns3_cmd_setup_basic_desc(&desc, HNS3_OPC_VLAN_PORT_RX_CFG, true); ++ req = (struct hns3_vport_vtag_rx_cfg_cmd *)desc.data; ++ vport_id = HNS3_PF_FUNC_ID; ++ req->vf_offset = vport_id / HNS3_VF_NUM_PER_CMD; ++ bitmap = 1 << (vport_id % HNS3_VF_NUM_PER_BYTE); ++ req->vf_bitmap[req->vf_offset] = bitmap; ++ ++ /* ++ * current version VF is not supported when PF is driven by DPDK driver, ++ * just need to configure rx parameters for PF vport. ++ */ ++ ret = hns3_cmd_send(hw, &desc, 1); ++ if (ret != 0) { ++ hns3_err(hw, ++ "NIC IMP exec ret=%d desc_num=%d optcode=0x%x!", ++ ret, 1, rte_le_to_cpu_16(desc.opcode)); ++ return ret; ++ } ++ ++ fprintf(file, ++ "\t -- RX VLAN configuration\n" ++ "\t vlan1_strip_en :%s\n" ++ "\t vlan2_strip_en :%s\n" ++ "\t vlan1_vlan_prionly :%s\n" ++ "\t vlan2_vlan_prionly :%s\n" ++ "\t vlan1_strip_discard :%s\n" ++ "\t vlan2_strip_discard :%s\n", ++ hns3_get_bit(req->vport_vlan_cfg, ++ HNS3_REM_TAG1_EN_B) ? "Enable" : "Disable", ++ hns3_get_bit(req->vport_vlan_cfg, ++ HNS3_REM_TAG2_EN_B) ? "Enable" : "Disable", ++ hns3_get_bit(req->vport_vlan_cfg, ++ HNS3_SHOW_TAG1_EN_B) ? "Enable" : "Disable", ++ hns3_get_bit(req->vport_vlan_cfg, ++ HNS3_SHOW_TAG2_EN_B) ? "Enable" : "Disable", ++ hns3_get_bit(req->vport_vlan_cfg, ++ HNS3_DISCARD_TAG1_EN_B) ? "Enable" : "Disable", ++ hns3_get_bit(req->vport_vlan_cfg, ++ HNS3_DISCARD_TAG2_EN_B) ? "Enable" : "Disable"); ++ ++ return 0; ++} ++ ++static void ++hns3_parse_tx_vlan_cfg(FILE *file, struct hns3_vport_vtag_tx_cfg_cmd *req) ++{ ++#define VLAN_VID_MASK 0x0fff ++#define VLAN_PRIO_SHIFT 13 ++ ++ fprintf(file, ++ "\t -- TX VLAN configuration\n" ++ "\t accept_tag1 :%s\n" ++ "\t accept_untag1 :%s\n" ++ "\t insert_tag1_en :%s\n" ++ "\t default_vlan_tag1 = %d, qos = %d\n" ++ "\t accept_tag2 :%s\n" ++ "\t accept_untag2 :%s\n" ++ "\t insert_tag2_en :%s\n" ++ "\t default_vlan_tag2 = %d, qos = %d\n" ++ "\t vlan_shift_mode :%s\n", ++ hns3_get_bit(req->vport_vlan_cfg, ++ HNS3_ACCEPT_TAG1_B) ? "Enable" : "Disable", ++ hns3_get_bit(req->vport_vlan_cfg, ++ HNS3_ACCEPT_UNTAG1_B) ? "Enable" : "Disable", ++ hns3_get_bit(req->vport_vlan_cfg, ++ HNS3_PORT_INS_TAG1_EN_B) ? "Enable" : "Disable", ++ req->def_vlan_tag1 & VLAN_VID_MASK, ++ req->def_vlan_tag1 >> VLAN_PRIO_SHIFT, ++ hns3_get_bit(req->vport_vlan_cfg, ++ HNS3_ACCEPT_TAG2_B) ? "Enable" : "Disable", ++ hns3_get_bit(req->vport_vlan_cfg, ++ HNS3_ACCEPT_UNTAG2_B) ? "Enable" : "Disable", ++ hns3_get_bit(req->vport_vlan_cfg, ++ HNS3_PORT_INS_TAG2_EN_B) ? "Enable" : "Disable", ++ req->def_vlan_tag2 & VLAN_VID_MASK, ++ req->def_vlan_tag2 >> VLAN_PRIO_SHIFT, ++ hns3_get_bit(req->vport_vlan_cfg, ++ HNS3_TAG_SHIFT_MODE_EN_B) ? "Enable" : ++ "Disable"); ++} ++ ++static int ++hns3_get_vlan_tx_offload_cfg(FILE *file, struct hns3_hw *hw) ++{ ++ struct hns3_vport_vtag_tx_cfg_cmd *req; ++ struct hns3_cmd_desc desc; ++ uint16_t vport_id; ++ uint8_t bitmap; ++ int ret; ++ ++ hns3_cmd_setup_basic_desc(&desc, HNS3_OPC_VLAN_PORT_TX_CFG, true); ++ req = (struct hns3_vport_vtag_tx_cfg_cmd *)desc.data; ++ vport_id = HNS3_PF_FUNC_ID; ++ req->vf_offset = vport_id / HNS3_VF_NUM_PER_CMD; ++ bitmap = 1 << (vport_id % HNS3_VF_NUM_PER_BYTE); ++ req->vf_bitmap[req->vf_offset] = bitmap; ++ /* ++ * current version VF is not supported when PF is driven by DPDK driver, ++ * just need to configure tx parameters for PF vport. ++ */ ++ ret = hns3_cmd_send(hw, &desc, 1); ++ if (ret != 0) { ++ hns3_err(hw, ++ "NIC IMP exec ret=%d desc_num=%d optcode=0x%x!", ++ ret, 1, rte_le_to_cpu_16(desc.opcode)); ++ return ret; ++ } ++ ++ hns3_parse_tx_vlan_cfg(file, req); ++ ++ return 0; ++} ++ ++static void ++hns3_get_port_pvid_info(FILE *file, struct hns3_hw *hw) ++{ ++ fprintf(file, "\t -- pvid status: %s\n", ++ hw->port_base_vlan_cfg.state ? "on" : "off"); ++} ++ ++static void ++hns3_get_vlan_config_info(FILE *file, struct hns3_hw *hw) ++{ ++ int ret; ++ ++ fprintf(file, " - VLAN Config Info:\n"); ++ ret = hns3_get_vlan_rx_offload_cfg(file, hw); ++ if (ret < 0) ++ return; ++ ++ ret = hns3_get_vlan_tx_offload_cfg(file, hw); ++ if (ret < 0) ++ return; ++ ++ hns3_get_port_pvid_info(file, hw); ++} ++ + int + hns3_eth_dev_priv_dump(struct rte_eth_dev *dev, FILE *file) + { +@@ -373,6 +519,7 @@ hns3_eth_dev_priv_dump(struct rte_eth_dev *dev, FILE *file) + return 0; + + hns3_get_dev_mac_info(file, hns); ++ hns3_get_vlan_config_info(file, hw); + + return 0; + } +-- +2.30.0 + diff --git a/0052-net-hns3-support-PF-device-with-copper-PHYs.patch b/0052-net-hns3-support-PF-device-with-copper-PHYs.patch deleted file mode 100644 index 5a766a386e596f5517d028cdd67514b4cc4a7b4b..0000000000000000000000000000000000000000 --- a/0052-net-hns3-support-PF-device-with-copper-PHYs.patch +++ /dev/null @@ -1,279 +0,0 @@ -From ed40b1477365a3c581f487ba3c8261c53dcdc255 Mon Sep 17 00:00:00 2001 -From: Huisong Li -Date: Thu, 4 Mar 2021 15:44:48 +0800 -Subject: [PATCH 052/189] net/hns3: support PF device with copper PHYs - -The normal operation of devices with copper phys depends on the -initialization and configuration of the PHY chip. The task of -driving the PHY chip is implemented in some firmware versions. -If firmware supports the phy driver, it will report a capability -flag to driver in probing process. The driver determines whether -to support PF device with copper phys based on the capability bit. -If supported, the driver set a flag indicating that the firmware -takes over the PHY, and then the firmware initializes the PHY. - -This patch supports the query of link status and link info, and -existing basic features for PF device with copper phys. - -Signed-off-by: Huisong Li -Signed-off-by: Lijun Ou ---- - drivers/net/hns3/hns3_cmd.c | 8 +-- - drivers/net/hns3/hns3_cmd.h | 37 +++++++++++++ - drivers/net/hns3/hns3_ethdev.c | 115 ++++++++++++++++++++++++++++++++++++++--- - drivers/net/hns3/hns3_ethdev.h | 5 ++ - 4 files changed, 152 insertions(+), 13 deletions(-) - -diff --git a/drivers/net/hns3/hns3_cmd.c b/drivers/net/hns3/hns3_cmd.c -index f0bc177..0590898 100644 ---- a/drivers/net/hns3/hns3_cmd.c -+++ b/drivers/net/hns3/hns3_cmd.c -@@ -423,14 +423,8 @@ static void hns3_parse_capability(struct hns3_hw *hw, - hns3_set_bit(hw->capability, HNS3_DEV_SUPPORT_PTP_B, 1); - if (hns3_get_bit(caps, HNS3_CAPS_TX_PUSH_B)) - hns3_set_bit(hw->capability, HNS3_DEV_SUPPORT_TX_PUSH_B, 1); -- /* -- * Currently, the query of link status and link info on copper ports -- * are not supported. So it is necessary for driver to set the copper -- * capability bit to zero when the firmware supports the configuration -- * of the PHY. -- */ - if (hns3_get_bit(caps, HNS3_CAPS_PHY_IMP_B)) -- hns3_set_bit(hw->capability, HNS3_DEV_SUPPORT_COPPER_B, 0); -+ hns3_set_bit(hw->capability, HNS3_DEV_SUPPORT_COPPER_B, 1); - if (hns3_get_bit(caps, HNS3_CAPS_TQP_TXRX_INDEP_B)) - hns3_set_bit(hw->capability, HNS3_DEV_SUPPORT_INDEP_TXRX_B, 1); - if (hns3_get_bit(caps, HNS3_CAPS_STASH_B)) -diff --git a/drivers/net/hns3/hns3_cmd.h b/drivers/net/hns3/hns3_cmd.h -index 93bfa74..7f567cb 100644 ---- a/drivers/net/hns3/hns3_cmd.h -+++ b/drivers/net/hns3/hns3_cmd.h -@@ -222,6 +222,8 @@ enum hns3_opcode_type { - - /* Firmware stats command */ - HNS3_OPC_FIRMWARE_COMPAT_CFG = 0x701A, -+ /* Firmware control phy command */ -+ HNS3_OPC_PHY_PARAM_CFG = 0x7025, - - /* SFP command */ - HNS3_OPC_GET_SFP_EEPROM = 0x7100, -@@ -659,11 +661,46 @@ enum hns3_promisc_type { - - #define HNS3_LINK_EVENT_REPORT_EN_B 0 - #define HNS3_NCSI_ERROR_REPORT_EN_B 1 -+#define HNS3_FIRMWARE_PHY_DRIVER_EN_B 2 - struct hns3_firmware_compat_cmd { - uint32_t compat; - uint8_t rsv[20]; - }; - -+/* Bitmap flags in supported, advertising and lp_advertising */ -+#define HNS3_PHY_LINK_SPEED_10M_HD_BIT BIT(0) -+#define HNS3_PHY_LINK_SPEED_10M_BIT BIT(1) -+#define HNS3_PHY_LINK_SPEED_100M_HD_BIT BIT(2) -+#define HNS3_PHY_LINK_SPEED_100M_BIT BIT(3) -+#define HNS3_PHY_LINK_MODE_AUTONEG_BIT BIT(6) -+#define HNS3_PHY_LINK_MODE_PAUSE_BIT BIT(13) -+#define HNS3_PHY_LINK_MODE_ASYM_PAUSE_BIT BIT(14) -+ -+#define HNS3_PHY_PARAM_CFG_BD_NUM 2 -+struct hns3_phy_params_bd0_cmd { -+ uint32_t speed; -+#define HNS3_PHY_DUPLEX_CFG_B 0 -+ uint8_t duplex; -+#define HNS3_PHY_AUTONEG_CFG_B 0 -+ uint8_t autoneg; -+ uint8_t eth_tp_mdix; -+ uint8_t eth_tp_mdix_ctrl; -+ uint8_t port; -+ uint8_t transceiver; -+ uint8_t phy_address; -+ uint8_t rsv; -+ uint32_t supported; -+ uint32_t advertising; -+ uint32_t lp_advertising; -+}; -+ -+struct hns3_phy_params_bd1_cmd { -+ uint8_t master_slave_cfg; -+ uint8_t master_slave_state; -+ uint8_t rsv1[2]; -+ uint32_t rsv2[5]; -+}; -+ - #define HNS3_MAC_TX_EN_B 6 - #define HNS3_MAC_RX_EN_B 7 - #define HNS3_MAC_PAD_TX_B 11 -diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c -index 94c08e8..6cb6bec 100644 ---- a/drivers/net/hns3/hns3_ethdev.c -+++ b/drivers/net/hns3/hns3_ethdev.c -@@ -3090,6 +3090,37 @@ hns3_get_capability(struct hns3_hw *hw) - } - - static int -+hns3_check_media_type(struct hns3_hw *hw, uint8_t media_type) -+{ -+ int ret; -+ -+ switch (media_type) { -+ case HNS3_MEDIA_TYPE_COPPER: -+ if (!hns3_dev_copper_supported(hw)) { -+ PMD_INIT_LOG(ERR, -+ "Media type is copper, not supported."); -+ ret = -EOPNOTSUPP; -+ } else { -+ ret = 0; -+ } -+ break; -+ case HNS3_MEDIA_TYPE_FIBER: -+ ret = 0; -+ break; -+ case HNS3_MEDIA_TYPE_BACKPLANE: -+ PMD_INIT_LOG(ERR, "Media type is Backplane, not supported."); -+ ret = -EOPNOTSUPP; -+ break; -+ default: -+ PMD_INIT_LOG(ERR, "Unknown media type = %u!", media_type); -+ ret = -EINVAL; -+ break; -+ } -+ -+ return ret; -+} -+ -+static int - hns3_get_board_configuration(struct hns3_hw *hw) - { - struct hns3_adapter *hns = HNS3_DEV_HW_TO_ADAPTER(hw); -@@ -3103,11 +3134,9 @@ hns3_get_board_configuration(struct hns3_hw *hw) - return ret; - } - -- if (cfg.media_type == HNS3_MEDIA_TYPE_COPPER && -- !hns3_dev_copper_supported(hw)) { -- PMD_INIT_LOG(ERR, "media type is copper, not supported."); -- return -EOPNOTSUPP; -- } -+ ret = hns3_check_media_type(hw, cfg.media_type); -+ if (ret) -+ return ret; - - hw->mac.media_type = cfg.media_type; - hw->rss_size_max = cfg.rss_size_max; -@@ -3952,6 +3981,8 @@ hns3_firmware_compat_config(struct hns3_hw *hw, bool is_init) - if (is_init) { - hns3_set_bit(compat, HNS3_LINK_EVENT_REPORT_EN_B, 1); - hns3_set_bit(compat, HNS3_NCSI_ERROR_REPORT_EN_B, 0); -+ if (hw->mac.media_type == HNS3_MEDIA_TYPE_COPPER) -+ hns3_set_bit(compat, HNS3_FIRMWARE_PHY_DRIVER_EN_B, 1); - } - - req->compat = rte_cpu_to_le_32(compat); -@@ -4429,6 +4460,78 @@ hns3_update_fiber_link_info(struct hns3_hw *hw) - return hns3_cfg_mac_speed_dup(hw, speed, ETH_LINK_FULL_DUPLEX); - } - -+static void -+hns3_parse_phy_params(struct hns3_cmd_desc *desc, struct hns3_mac *mac) -+{ -+ struct hns3_phy_params_bd0_cmd *req; -+ -+ req = (struct hns3_phy_params_bd0_cmd *)desc[0].data; -+ mac->link_speed = rte_le_to_cpu_32(req->speed); -+ mac->link_duplex = hns3_get_bit(req->duplex, -+ HNS3_PHY_DUPLEX_CFG_B); -+ mac->link_autoneg = hns3_get_bit(req->autoneg, -+ HNS3_PHY_AUTONEG_CFG_B); -+ mac->supported_capa = rte_le_to_cpu_32(req->supported); -+ mac->advertising = rte_le_to_cpu_32(req->advertising); -+ mac->lp_advertising = rte_le_to_cpu_32(req->lp_advertising); -+ mac->support_autoneg = !!(mac->supported_capa & -+ HNS3_PHY_LINK_MODE_AUTONEG_BIT); -+} -+ -+static int -+hns3_get_phy_params(struct hns3_hw *hw, struct hns3_mac *mac) -+{ -+ struct hns3_cmd_desc desc[HNS3_PHY_PARAM_CFG_BD_NUM]; -+ uint16_t i; -+ int ret; -+ -+ for (i = 0; i < HNS3_PHY_PARAM_CFG_BD_NUM - 1; i++) { -+ hns3_cmd_setup_basic_desc(&desc[i], HNS3_OPC_PHY_PARAM_CFG, -+ true); -+ desc[i].flag |= rte_cpu_to_le_16(HNS3_CMD_FLAG_NEXT); -+ } -+ hns3_cmd_setup_basic_desc(&desc[i], HNS3_OPC_PHY_PARAM_CFG, true); -+ -+ ret = hns3_cmd_send(hw, desc, HNS3_PHY_PARAM_CFG_BD_NUM); -+ if (ret) { -+ hns3_err(hw, "get phy parameters failed, ret = %d.", ret); -+ return ret; -+ } -+ -+ hns3_parse_phy_params(desc, mac); -+ -+ return 0; -+} -+ -+static int -+hns3_update_phy_link_info(struct hns3_hw *hw) -+{ -+ struct hns3_mac *mac = &hw->mac; -+ struct hns3_mac mac_info; -+ int ret; -+ -+ memset(&mac_info, 0, sizeof(struct hns3_mac)); -+ ret = hns3_get_phy_params(hw, &mac_info); -+ if (ret) -+ return ret; -+ -+ if (mac_info.link_speed != mac->link_speed) { -+ ret = hns3_port_shaper_update(hw, mac_info.link_speed); -+ if (ret) -+ return ret; -+ } -+ -+ mac->link_speed = mac_info.link_speed; -+ mac->link_duplex = mac_info.link_duplex; -+ mac->link_autoneg = mac_info.link_autoneg; -+ mac->supported_capa = mac_info.supported_capa; -+ mac->advertising = mac_info.advertising; -+ mac->lp_advertising = mac_info.lp_advertising; -+ mac->support_autoneg = mac_info.support_autoneg; -+ -+ return 0; -+} -+ - static int - hns3_update_link_info(struct rte_eth_dev *eth_dev) - { -@@ -4437,7 +4540,7 @@ hns3_update_link_info(struct rte_eth_dev *eth_dev) - int ret = 0; - - if (hw->mac.media_type == HNS3_MEDIA_TYPE_COPPER) -- return 0; -+ ret = hns3_update_phy_link_info(hw); - else if (hw->mac.media_type == HNS3_MEDIA_TYPE_FIBER) - ret = hns3_update_fiber_link_info(hw); - -diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h -index 2954422..3cbc2f2 100644 ---- a/drivers/net/hns3/hns3_ethdev.h -+++ b/drivers/net/hns3/hns3_ethdev.h -@@ -180,6 +180,11 @@ struct hns3_mac { - uint8_t link_autoneg : 1; /* ETH_LINK_[AUTONEG/FIXED] */ - uint8_t link_status : 1; /* ETH_LINK_[DOWN/UP] */ - uint32_t link_speed; /* ETH_SPEED_NUM_ */ -+ uint32_t supported_capa; /* supported capability for current media */ -+ uint32_t advertising; /* advertised capability in the local part */ -+ /* advertised capability in the link partner */ -+ uint32_t lp_advertising; -+ uint8_t support_autoneg; - }; - - struct hns3_fake_queue_data { --- -2.7.4 - diff --git a/0053-net-hns3-dump-flow-director-basic-info.patch b/0053-net-hns3-dump-flow-director-basic-info.patch new file mode 100644 index 0000000000000000000000000000000000000000..186d8fb94aa96b5975249251f91fd89db0b026a0 --- /dev/null +++ b/0053-net-hns3-dump-flow-director-basic-info.patch @@ -0,0 +1,119 @@ +From ca1080fde102a1b9de5781e0919a5342b6151bd3 Mon Sep 17 00:00:00 2001 +From: "Min Hu (Connor)" +Date: Fri, 11 Feb 2022 11:10:28 +0800 +Subject: [PATCH 08/13] net/hns3: dump flow director basic info + +This patch dumps flow director basic info such rule numbers, hit counts +for debug. + +Signed-off-by: Min Hu (Connor) +--- + drivers/net/hns3/hns3_ethdev_dump.c | 85 +++++++++++++++++++++++++++++ + 1 file changed, 85 insertions(+) + +diff --git a/drivers/net/hns3/hns3_ethdev_dump.c b/drivers/net/hns3/hns3_ethdev_dump.c +index d017e66e69..792ef99b81 100644 +--- a/drivers/net/hns3/hns3_ethdev_dump.c ++++ b/drivers/net/hns3/hns3_ethdev_dump.c +@@ -101,6 +101,90 @@ hns3_get_dev_feature_capability(FILE *file, struct hns3_hw *hw) + hw->capability & BIT(i) ? "yes" : "no"); + } + ++static const char * ++hns3_get_fdir_tuple_name(uint32_t index) ++{ ++ static const char * const tuple_name[] = { ++ "outer_dst_mac", ++ "outer_src_mac", ++ "outer_vlan_1st_tag", ++ "outer_vlan_2nd_tag", ++ "outer_eth_type", ++ "outer_l2_rsv", ++ "outer_ip_tos", ++ "outer_ip_proto", ++ "outer_src_ip", ++ "outer_dst_ip", ++ "outer_l3_rsv", ++ "outer_src_port", ++ "outer_dst_port", ++ "outer_l4_rsv", ++ "outer_tun_vni", ++ "outer_tun_flow_id", ++ "inner_dst_mac", ++ "inner_src_mac", ++ "inner_vlan_tag1", ++ "inner_vlan_tag2", ++ "inner_eth_type", ++ "inner_l2_rsv", ++ "inner_ip_tos", ++ "inner_ip_proto", ++ "inner_src_ip", ++ "inner_dst_ip", ++ "inner_l3_rsv", ++ "inner_src_port", ++ "inner_dst_port", ++ "inner_sctp_tag", ++ }; ++ if (index < RTE_DIM(tuple_name)) ++ return tuple_name[index]; ++ else ++ return "unknown"; ++} ++ ++static void ++hns3_get_fdir_basic_info(FILE *file, struct hns3_pf *pf) ++{ ++#define TMPBUF_SIZE 2048 ++#define PERLINE_TUPLE_NAMES 4 ++ struct hns3_fd_cfg *fdcfg = &pf->fdir.fd_cfg; ++ char tmpbuf[TMPBUF_SIZE] = {0}; ++ uint32_t i, count = 0; ++ ++ fprintf(file, " - Fdir Info:\n"); ++ fprintf(file, ++ "\t -- mode=%u max_key_len=%u rule_num:%u cnt_num:%u\n" ++ "\t -- key_sel=%u tuple_active=0x%x meta_data_active=0x%x\n" ++ "\t -- ipv6_word_en: in_s=%u in_d=%u out_s=%u out_d=%u\n" ++ "\t -- active_tuples:\n", ++ fdcfg->fd_mode, fdcfg->max_key_length, ++ fdcfg->rule_num[HNS3_FD_STAGE_1], ++ fdcfg->cnt_num[HNS3_FD_STAGE_1], ++ fdcfg->key_cfg[HNS3_FD_STAGE_1].key_sel, ++ fdcfg->key_cfg[HNS3_FD_STAGE_1].tuple_active, ++ fdcfg->key_cfg[HNS3_FD_STAGE_1].meta_data_active, ++ fdcfg->key_cfg[HNS3_FD_STAGE_1].inner_sipv6_word_en, ++ fdcfg->key_cfg[HNS3_FD_STAGE_1].inner_dipv6_word_en, ++ fdcfg->key_cfg[HNS3_FD_STAGE_1].outer_sipv6_word_en, ++ fdcfg->key_cfg[HNS3_FD_STAGE_1].outer_dipv6_word_en); ++ ++ for (i = 0; i < MAX_TUPLE; i++) { ++ if (!(fdcfg->key_cfg[HNS3_FD_STAGE_1].tuple_active & BIT(i))) ++ continue; ++ if (count % PERLINE_TUPLE_NAMES == 0) ++ fprintf(file, "\t "); ++ fprintf(file, " %s", hns3_get_fdir_tuple_name(i)); ++ count++; ++ if (count % PERLINE_TUPLE_NAMES == 0) ++ fprintf(file, "\n"); ++ } ++ if (count % PERLINE_TUPLE_NAMES) ++ fprintf(file, "\n"); ++ ++ fprintf(file, "%s", tmpbuf); ++} ++ ++static void + hns3_get_device_basic_info(FILE *file, struct rte_eth_dev *dev) + { + struct hns3_adapter *hns = dev->data->dev_private; +@@ -520,6 +604,7 @@ hns3_eth_dev_priv_dump(struct rte_eth_dev *dev, FILE *file) + + hns3_get_dev_mac_info(file, hns); + hns3_get_vlan_config_info(file, hw); ++ hns3_get_fdir_basic_info(file, &hns->pf); + + return 0; + } +-- +2.30.0 + diff --git a/0053-net-hns3-support-Rx-descriptor-advanced-layout.patch b/0053-net-hns3-support-Rx-descriptor-advanced-layout.patch deleted file mode 100644 index 14a81dae6de13adc7c69c27e74949fd05575faa3..0000000000000000000000000000000000000000 --- a/0053-net-hns3-support-Rx-descriptor-advanced-layout.patch +++ /dev/null @@ -1,442 +0,0 @@ -From dd8dbf370b25e67e3ffaa845960c41c67775baa8 Mon Sep 17 00:00:00 2001 -From: Chengwen Feng -Date: Thu, 4 Mar 2021 15:44:49 +0800 -Subject: [PATCH 053/189] net/hns3: support Rx descriptor advanced layout - -Currently, the driver get packet type by parse the -L3_ID/L4_ID/OL3_ID/OL4_ID from Rx descriptor and then lookup multiple -tables, it's time consuming. - -Now Kunpeng930 support advanced RXD layout, which: -1. Combine OL3_ID/OL4_ID to 8bit PTYPE filed, so the driver get packet - type by lookup only one table. Note: L3_ID/L4_ID become reserved - fields. -2. The 1588 timestamp located at Rx descriptor instead of query from - firmware. -3. The L3E/L4E/OL3E/OL4E will be zero when L3L4P is zero, so driver - could optimize the good checksum calculations (when L3E/L4E is zero - then mark PKT_RX_IP_CKSUM_GOOD/PKT_RX_L4_CKSUM_GOOD). - -Considering compatibility, the firmware will report capability of -RXD advanced layout, the driver will identify and enable it by default. - -This patch only provides basic function: identify and enable the RXD -advanced layout, and lookup ptype table if supported. - -Signed-off-by: Chengwen Feng -Signed-off-by: Lijun Ou ---- - drivers/net/hns3/hns3_cmd.c | 8 +- - drivers/net/hns3/hns3_cmd.h | 5 + - drivers/net/hns3/hns3_ethdev.c | 2 + - drivers/net/hns3/hns3_ethdev.h | 16 +++ - drivers/net/hns3/hns3_ethdev_vf.c | 2 + - drivers/net/hns3/hns3_regs.h | 1 + - drivers/net/hns3/hns3_rxtx.c | 200 ++++++++++++++++++++++++++++++++++++++ - drivers/net/hns3/hns3_rxtx.h | 11 +++ - 8 files changed, 243 insertions(+), 2 deletions(-) - -diff --git a/drivers/net/hns3/hns3_cmd.c b/drivers/net/hns3/hns3_cmd.c -index 0590898..8a2cc2d 100644 ---- a/drivers/net/hns3/hns3_cmd.c -+++ b/drivers/net/hns3/hns3_cmd.c -@@ -409,8 +409,9 @@ hns3_cmd_send(struct hns3_hw *hw, struct hns3_cmd_desc *desc, int num) - return retval; - } - --static void hns3_parse_capability(struct hns3_hw *hw, -- struct hns3_query_version_cmd *cmd) -+static void -+hns3_parse_capability(struct hns3_hw *hw, -+ struct hns3_query_version_cmd *cmd) - { - uint32_t caps = rte_le_to_cpu_32(cmd->caps[0]); - -@@ -429,6 +430,9 @@ static void hns3_parse_capability(struct hns3_hw *hw, - hns3_set_bit(hw->capability, HNS3_DEV_SUPPORT_INDEP_TXRX_B, 1); - if (hns3_get_bit(caps, HNS3_CAPS_STASH_B)) - hns3_set_bit(hw->capability, HNS3_DEV_SUPPORT_STASH_B, 1); -+ if (hns3_get_bit(caps, HNS3_CAPS_RXD_ADV_LAYOUT_B)) -+ hns3_set_bit(hw->capability, HNS3_DEV_SUPPORT_RXD_ADV_LAYOUT_B, -+ 1); - } - - static uint32_t -diff --git a/drivers/net/hns3/hns3_cmd.h b/drivers/net/hns3/hns3_cmd.h -index 7f567cb..6ceb655 100644 ---- a/drivers/net/hns3/hns3_cmd.h -+++ b/drivers/net/hns3/hns3_cmd.h -@@ -312,6 +312,11 @@ enum HNS3_CAPS_BITS { - HNS3_CAPS_TQP_TXRX_INDEP_B, - HNS3_CAPS_HW_PAD_B, - HNS3_CAPS_STASH_B, -+ HNS3_CAPS_UDP_TUNNEL_CSUM_B, -+ HNS3_CAPS_RAS_IMP_B, -+ HNS3_CAPS_FEC_B, -+ HNS3_CAPS_PAUSE_B, -+ HNS3_CAPS_RXD_ADV_LAYOUT_B, - }; - - enum HNS3_API_CAP_BITS { -diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c -index 6cb6bec..7993d2d 100644 ---- a/drivers/net/hns3/hns3_ethdev.c -+++ b/drivers/net/hns3/hns3_ethdev.c -@@ -4970,6 +4970,8 @@ hns3_do_start(struct hns3_adapter *hns, bool reset_queue) - return ret; - } - -+ hns3_enable_rxd_adv_layout(hw); -+ - ret = hns3_init_queues(hns, reset_queue); - if (ret) { - PMD_INIT_LOG(ERR, "failed to init queues, ret = %d.", ret); -diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h -index 3cbc2f2..52e6c49 100644 ---- a/drivers/net/hns3/hns3_ethdev.h -+++ b/drivers/net/hns3/hns3_ethdev.h -@@ -667,8 +667,13 @@ struct hns3_mp_param { - #define HNS3_OL2TBL_NUM 4 - #define HNS3_OL3TBL_NUM 16 - #define HNS3_OL4TBL_NUM 16 -+#define HNS3_PTYPE_NUM 256 - - struct hns3_ptype_table { -+ /* -+ * The next fields used to calc packet-type by the -+ * L3_ID/L4_ID/OL3_ID/OL4_ID from the Rx descriptor. -+ */ - uint32_t l2l3table[HNS3_L2TBL_NUM][HNS3_L3TBL_NUM]; - uint32_t l4table[HNS3_L4TBL_NUM]; - uint32_t inner_l2table[HNS3_L2TBL_NUM]; -@@ -677,6 +682,13 @@ struct hns3_ptype_table { - uint32_t ol2table[HNS3_OL2TBL_NUM]; - uint32_t ol3table[HNS3_OL3TBL_NUM]; - uint32_t ol4table[HNS3_OL4TBL_NUM]; -+ -+ /* -+ * The next field used to calc packet-type by the PTYPE from the Rx -+ * descriptor, it functions only when firmware report the capability of -+ * HNS3_CAPS_RXD_ADV_LAYOUT_B and driver enabled it. -+ */ -+ uint32_t ptype[HNS3_PTYPE_NUM] __rte_cache_min_aligned; - }; - - #define HNS3_FIXED_MAX_TQP_NUM_MODE 0 -@@ -771,6 +783,7 @@ struct hns3_adapter { - #define HNS3_DEV_SUPPORT_TX_PUSH_B 0x5 - #define HNS3_DEV_SUPPORT_INDEP_TXRX_B 0x6 - #define HNS3_DEV_SUPPORT_STASH_B 0x7 -+#define HNS3_DEV_SUPPORT_RXD_ADV_LAYOUT_B 0x9 - - #define hns3_dev_dcb_supported(hw) \ - hns3_get_bit((hw)->capability, HNS3_DEV_SUPPORT_DCB_B) -@@ -801,6 +814,9 @@ struct hns3_adapter { - #define hns3_dev_stash_supported(hw) \ - hns3_get_bit((hw)->capability, HNS3_DEV_SUPPORT_STASH_B) - -+#define hns3_dev_rxd_adv_layout_supported(hw) \ -+ hns3_get_bit((hw)->capability, HNS3_DEV_SUPPORT_RXD_ADV_LAYOUT_B) -+ - #define HNS3_DEV_PRIVATE_TO_HW(adapter) \ - (&((struct hns3_adapter *)adapter)->hw) - #define HNS3_DEV_PRIVATE_TO_PF(adapter) \ -diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c -index 5b4c587..90951df 100644 ---- a/drivers/net/hns3/hns3_ethdev_vf.c -+++ b/drivers/net/hns3/hns3_ethdev_vf.c -@@ -2125,6 +2125,8 @@ hns3vf_do_start(struct hns3_adapter *hns, bool reset_queue) - if (ret) - return ret; - -+ hns3_enable_rxd_adv_layout(hw); -+ - ret = hns3_init_queues(hns, reset_queue); - if (ret) - hns3_err(hw, "failed to init queues, ret = %d.", ret); -diff --git a/drivers/net/hns3/hns3_regs.h b/drivers/net/hns3/hns3_regs.h -index 39fc5d1..0540554 100644 ---- a/drivers/net/hns3/hns3_regs.h -+++ b/drivers/net/hns3/hns3_regs.h -@@ -36,6 +36,7 @@ - #define HNS3_GLOBAL_RESET_REG 0x20A00 - #define HNS3_FUN_RST_ING 0x20C00 - #define HNS3_GRO_EN_REG 0x28000 -+#define HNS3_RXD_ADV_LAYOUT_EN_REG 0x28008 - - /* Vector0 register bits for reset */ - #define HNS3_VECTOR0_FUNCRESET_INT_B 0 -diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c -index 897e5fa..09b38d4 100644 ---- a/drivers/net/hns3/hns3_rxtx.c -+++ b/drivers/net/hns3/hns3_rxtx.c -@@ -1802,6 +1802,7 @@ hns3_rx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t nb_desc, - HNS3_PORT_BASE_VLAN_ENABLE; - else - rxq->pvid_sw_discard_en = false; -+ rxq->ptype_en = hns3_dev_rxd_adv_layout_supported(hw) ? true : false; - rxq->configured = true; - rxq->io_base = (void *)((char *)hw->io_base + HNS3_TQP_REG_OFFSET + - idx * HNS3_TQP_REG_SIZE); -@@ -1987,6 +1988,193 @@ hns3_init_tunnel_ptype_tbl(struct hns3_ptype_table *tbl) - tbl->ol4table[2] = RTE_PTYPE_TUNNEL_NVGRE; - } - -+static void -+hns3_init_adv_layout_ptype(struct hns3_ptype_table *tbl) -+{ -+ uint32_t *ptype = tbl->ptype; -+ -+ /* Non-tunnel L2 */ -+ ptype[1] = RTE_PTYPE_L2_ETHER_ARP; -+ ptype[3] = RTE_PTYPE_L2_ETHER_LLDP; -+ ptype[8] = RTE_PTYPE_L2_ETHER_TIMESYNC; -+ -+ /* Non-tunnel IPv4 */ -+ ptype[17] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN | -+ RTE_PTYPE_L4_FRAG; -+ ptype[18] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN | -+ RTE_PTYPE_L4_NONFRAG; -+ ptype[19] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN | -+ RTE_PTYPE_L4_UDP; -+ ptype[20] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN | -+ RTE_PTYPE_L4_TCP; -+ /* The next ptype is GRE over IPv4 */ -+ ptype[21] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN; -+ ptype[22] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN | -+ RTE_PTYPE_L4_SCTP; -+ ptype[23] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN | -+ RTE_PTYPE_L4_IGMP; -+ ptype[24] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN | -+ RTE_PTYPE_L4_ICMP; -+ /* The next ptype is PTP over IPv4 + UDP */ -+ ptype[25] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN | -+ RTE_PTYPE_L4_UDP; -+ -+ /* IPv4 --> GRE/Teredo/VXLAN */ -+ ptype[29] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN | -+ RTE_PTYPE_TUNNEL_GRENAT; -+ /* IPv4 --> GRE/Teredo/VXLAN --> MAC */ -+ ptype[30] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN | -+ RTE_PTYPE_TUNNEL_GRENAT | RTE_PTYPE_INNER_L2_ETHER; -+ -+ /* IPv4 --> GRE/Teredo/VXLAN --> MAC --> IPv4 */ -+ ptype[31] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN | -+ RTE_PTYPE_TUNNEL_GRENAT | RTE_PTYPE_INNER_L2_ETHER | -+ RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN | -+ RTE_PTYPE_INNER_L4_FRAG; -+ ptype[32] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN | -+ RTE_PTYPE_TUNNEL_GRENAT | RTE_PTYPE_INNER_L2_ETHER | -+ RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN | -+ RTE_PTYPE_INNER_L4_NONFRAG; -+ ptype[33] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN | -+ RTE_PTYPE_TUNNEL_GRENAT | RTE_PTYPE_INNER_L2_ETHER | -+ RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN | -+ RTE_PTYPE_INNER_L4_UDP; -+ ptype[34] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN | -+ RTE_PTYPE_TUNNEL_GRENAT | RTE_PTYPE_INNER_L2_ETHER | -+ RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN | -+ RTE_PTYPE_INNER_L4_TCP; -+ ptype[35] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN | -+ RTE_PTYPE_TUNNEL_GRENAT | RTE_PTYPE_INNER_L2_ETHER | -+ RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN | -+ RTE_PTYPE_INNER_L4_SCTP; -+ /* The next ptype's inner L4 is IGMP */ -+ ptype[36] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN | -+ RTE_PTYPE_TUNNEL_GRENAT | RTE_PTYPE_INNER_L2_ETHER | -+ RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN; -+ ptype[37] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN | -+ RTE_PTYPE_TUNNEL_GRENAT | RTE_PTYPE_INNER_L2_ETHER | -+ RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN | -+ RTE_PTYPE_INNER_L4_ICMP; -+ -+ /* IPv4 --> GRE/Teredo/VXLAN --> MAC --> IPv6 */ -+ ptype[39] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN | -+ RTE_PTYPE_TUNNEL_GRENAT | RTE_PTYPE_INNER_L2_ETHER | -+ RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN | -+ RTE_PTYPE_INNER_L4_FRAG; -+ ptype[40] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN | -+ RTE_PTYPE_TUNNEL_GRENAT | RTE_PTYPE_INNER_L2_ETHER | -+ RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN | -+ RTE_PTYPE_INNER_L4_NONFRAG; -+ ptype[41] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN | -+ RTE_PTYPE_TUNNEL_GRENAT | RTE_PTYPE_INNER_L2_ETHER | -+ RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN | -+ RTE_PTYPE_INNER_L4_UDP; -+ ptype[42] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN | -+ RTE_PTYPE_TUNNEL_GRENAT | RTE_PTYPE_INNER_L2_ETHER | -+ RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN | -+ RTE_PTYPE_INNER_L4_TCP; -+ ptype[43] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN | -+ RTE_PTYPE_TUNNEL_GRENAT | RTE_PTYPE_INNER_L2_ETHER | -+ RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN | -+ RTE_PTYPE_INNER_L4_SCTP; -+ /* The next ptype's inner L4 is IGMP */ -+ ptype[44] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN | -+ RTE_PTYPE_TUNNEL_GRENAT | RTE_PTYPE_INNER_L2_ETHER | -+ RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN; -+ ptype[45] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN | -+ RTE_PTYPE_TUNNEL_GRENAT | RTE_PTYPE_INNER_L2_ETHER | -+ RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN | -+ RTE_PTYPE_INNER_L4_ICMP; -+ -+ /* Non-tunnel IPv6 */ -+ ptype[111] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN | -+ RTE_PTYPE_L4_FRAG; -+ ptype[112] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN | -+ RTE_PTYPE_L4_NONFRAG; -+ ptype[113] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN | -+ RTE_PTYPE_L4_UDP; -+ ptype[114] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN | -+ RTE_PTYPE_L4_TCP; -+ /* The next ptype is GRE over IPv6 */ -+ ptype[115] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN; -+ ptype[116] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN | -+ RTE_PTYPE_L4_SCTP; -+ ptype[117] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN | -+ RTE_PTYPE_L4_IGMP; -+ ptype[118] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN | -+ RTE_PTYPE_L4_ICMP; -+ /* Special for PTP over IPv6 + UDP */ -+ ptype[119] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN | -+ RTE_PTYPE_L4_UDP; -+ -+ /* IPv6 --> GRE/Teredo/VXLAN */ -+ ptype[123] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN | -+ RTE_PTYPE_TUNNEL_GRENAT; -+ /* IPv6 --> GRE/Teredo/VXLAN --> MAC */ -+ ptype[124] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN | -+ RTE_PTYPE_TUNNEL_GRENAT | RTE_PTYPE_INNER_L2_ETHER; -+ -+ /* IPv6 --> GRE/Teredo/VXLAN --> MAC --> IPv4 */ -+ ptype[125] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN | -+ RTE_PTYPE_TUNNEL_GRENAT | RTE_PTYPE_INNER_L2_ETHER | -+ RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN | -+ RTE_PTYPE_INNER_L4_FRAG; -+ ptype[126] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN | -+ RTE_PTYPE_TUNNEL_GRENAT | RTE_PTYPE_INNER_L2_ETHER | -+ RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN | -+ RTE_PTYPE_INNER_L4_NONFRAG; -+ ptype[127] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN | -+ RTE_PTYPE_TUNNEL_GRENAT | RTE_PTYPE_INNER_L2_ETHER | -+ RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN | -+ RTE_PTYPE_INNER_L4_UDP; -+ ptype[128] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN | -+ RTE_PTYPE_TUNNEL_GRENAT | RTE_PTYPE_INNER_L2_ETHER | -+ RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN | -+ RTE_PTYPE_INNER_L4_TCP; -+ ptype[129] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN | -+ RTE_PTYPE_TUNNEL_GRENAT | RTE_PTYPE_INNER_L2_ETHER | -+ RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN | -+ RTE_PTYPE_INNER_L4_SCTP; -+ /* The next ptype's inner L4 is IGMP */ -+ ptype[130] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN | -+ RTE_PTYPE_TUNNEL_GRENAT | RTE_PTYPE_INNER_L2_ETHER | -+ RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN; -+ ptype[131] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN | -+ RTE_PTYPE_TUNNEL_GRENAT | RTE_PTYPE_INNER_L2_ETHER | -+ RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN | -+ RTE_PTYPE_INNER_L4_ICMP; -+ -+ /* IPv6 --> GRE/Teredo/VXLAN --> MAC --> IPv6 */ -+ ptype[133] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN | -+ RTE_PTYPE_TUNNEL_GRENAT | RTE_PTYPE_INNER_L2_ETHER | -+ RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN | -+ RTE_PTYPE_INNER_L4_FRAG; -+ ptype[134] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN | -+ RTE_PTYPE_TUNNEL_GRENAT | RTE_PTYPE_INNER_L2_ETHER | -+ RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN | -+ RTE_PTYPE_INNER_L4_NONFRAG; -+ ptype[135] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN | -+ RTE_PTYPE_TUNNEL_GRENAT | RTE_PTYPE_INNER_L2_ETHER | -+ RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN | -+ RTE_PTYPE_INNER_L4_UDP; -+ ptype[136] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN | -+ RTE_PTYPE_TUNNEL_GRENAT | RTE_PTYPE_INNER_L2_ETHER | -+ RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN | -+ RTE_PTYPE_INNER_L4_TCP; -+ ptype[137] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN | -+ RTE_PTYPE_TUNNEL_GRENAT | RTE_PTYPE_INNER_L2_ETHER | -+ RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN | -+ RTE_PTYPE_INNER_L4_SCTP; -+ /* The next ptype's inner L4 is IGMP */ -+ ptype[138] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN | -+ RTE_PTYPE_TUNNEL_GRENAT | RTE_PTYPE_INNER_L2_ETHER | -+ RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN; -+ ptype[139] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN | -+ RTE_PTYPE_TUNNEL_GRENAT | RTE_PTYPE_INNER_L2_ETHER | -+ RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN | -+ RTE_PTYPE_INNER_L4_ICMP; -+} -+ - void - hns3_init_rx_ptype_tble(struct rte_eth_dev *dev) - { -@@ -1997,6 +2185,7 @@ hns3_init_rx_ptype_tble(struct rte_eth_dev *dev) - - hns3_init_non_tunnel_ptype_tbl(tbl); - hns3_init_tunnel_ptype_tbl(tbl); -+ hns3_init_adv_layout_ptype(tbl); - } - - static inline void -@@ -4012,3 +4201,14 @@ hns3_rx_queue_count(struct rte_eth_dev *dev, uint16_t rx_queue_id) - else - return fbd_num - driver_hold_bd_num; - } -+ -+void -+hns3_enable_rxd_adv_layout(struct hns3_hw *hw) -+{ -+ /* -+ * If the hardware support rxd advanced layout, then driver enable it -+ * default. -+ */ -+ if (hns3_dev_rxd_adv_layout_supported(hw)) -+ hns3_write_dev(hw, HNS3_RXD_ADV_LAYOUT_EN_REG, 1); -+} -diff --git a/drivers/net/hns3/hns3_rxtx.h b/drivers/net/hns3/hns3_rxtx.h -index 7118bd4..9adeb24 100644 ---- a/drivers/net/hns3/hns3_rxtx.h -+++ b/drivers/net/hns3/hns3_rxtx.h -@@ -88,6 +88,8 @@ - #define HNS3_RXD_OL3ID_M (0xf << HNS3_RXD_OL3ID_S) - #define HNS3_RXD_OL4ID_S 8 - #define HNS3_RXD_OL4ID_M (0xf << HNS3_RXD_OL4ID_S) -+#define HNS3_RXD_PTYPE_S 4 -+#define HNS3_RXD_PTYPE_M (0xff << HNS3_RXD_PTYPE_S) - #define HNS3_RXD_FBHI_S 12 - #define HNS3_RXD_FBHI_M (0x3 << HNS3_RXD_FBHI_S) - #define HNS3_RXD_FBLI_S 14 -@@ -328,6 +330,7 @@ struct hns3_rx_queue { - * point, the pvid_sw_discard_en will be false. - */ - bool pvid_sw_discard_en; -+ bool ptype_en; /* indicate if the ptype field enabled */ - bool enabled; /* indicate if Rx queue has been enabled */ - - struct hns3_rx_basic_stats basic_stats; -@@ -609,6 +612,13 @@ hns3_rx_calc_ptype(struct hns3_rx_queue *rxq, const uint32_t l234_info, - const struct hns3_ptype_table * const ptype_tbl = rxq->ptype_tbl; - uint32_t l2id, l3id, l4id; - uint32_t ol3id, ol4id, ol2id; -+ uint32_t ptype; -+ -+ if (rxq->ptype_en) { -+ ptype = hns3_get_field(ol_info, HNS3_RXD_PTYPE_M, -+ HNS3_RXD_PTYPE_S); -+ return ptype_tbl->ptype[ptype]; -+ } - - ol4id = hns3_get_field(ol_info, HNS3_RXD_OL4ID_M, HNS3_RXD_OL4ID_S); - ol3id = hns3_get_field(ol_info, HNS3_RXD_OL3ID_M, HNS3_RXD_OL3ID_S); -@@ -707,5 +717,6 @@ int hns3_start_all_rxqs(struct rte_eth_dev *dev); - void hns3_stop_all_txqs(struct rte_eth_dev *dev); - void hns3_restore_tqp_enable_state(struct hns3_hw *hw); - int hns3_tx_done_cleanup(void *txq, uint32_t free_cnt); -+void hns3_enable_rxd_adv_layout(struct hns3_hw *hw); - - #endif /* _HNS3_RXTX_H_ */ --- -2.7.4 - diff --git a/0054-net-hns3-dump-TM-configuration-info.patch b/0054-net-hns3-dump-TM-configuration-info.patch new file mode 100644 index 0000000000000000000000000000000000000000..9100422cdc80c5ba5a29b1631f3ccbe19698b9b3 --- /dev/null +++ b/0054-net-hns3-dump-TM-configuration-info.patch @@ -0,0 +1,188 @@ +From f612c76b724c499f870026ec3deda07f0de13543 Mon Sep 17 00:00:00 2001 +From: "Min Hu (Connor)" +Date: Fri, 11 Feb 2022 11:22:23 +0800 +Subject: [PATCH 09/13] net/hns3: dump TM configuration info + +This patch dumps TM configuration info about shaper, port node, TC node, +queue node related info. + +Signed-off-by: Min Hu (Connor) +--- + drivers/net/hns3/hns3_ethdev_dump.c | 154 ++++++++++++++++++++++++++++ + 1 file changed, 154 insertions(+) + +diff --git a/drivers/net/hns3/hns3_ethdev_dump.c b/drivers/net/hns3/hns3_ethdev_dump.c +index 792ef99b81..c0fc55b290 100644 +--- a/drivers/net/hns3/hns3_ethdev_dump.c ++++ b/drivers/net/hns3/hns3_ethdev_dump.c +@@ -585,6 +585,159 @@ hns3_get_vlan_config_info(FILE *file, struct hns3_hw *hw) + hns3_get_port_pvid_info(file, hw); + } + ++static void ++hns3_get_tm_conf_shaper_info(FILE *file, struct hns3_tm_conf *conf) ++{ ++ struct hns3_shaper_profile_list *shaper_profile_list = ++ &conf->shaper_profile_list; ++ struct hns3_tm_shaper_profile *shaper_profile; ++ ++ if (!conf->nb_shaper_profile) ++ return; ++ ++ fprintf(file, " shaper_profile:\n"); ++ TAILQ_FOREACH(shaper_profile, shaper_profile_list, node) { ++ fprintf(file, ++ " id=%u reference_count=%u peak_rate=%" PRIu64 "Bps\n", ++ shaper_profile->shaper_profile_id, ++ shaper_profile->reference_count, ++ shaper_profile->profile.peak.rate); ++ } ++} ++ ++static void ++hns3_get_tm_conf_port_node_info(FILE *file, struct hns3_tm_conf *conf) ++{ ++ if (!conf->root) ++ return; ++ ++ fprintf(file, ++ " port_node: \n" ++ " node_id=%u reference_count=%u shaper_profile_id=%d\n", ++ conf->root->id, conf->root->reference_count, ++ conf->root->shaper_profile ? ++ (int)conf->root->shaper_profile->shaper_profile_id : -1); ++} ++ ++static void ++hns3_get_tm_conf_tc_node_info(FILE *file, struct hns3_tm_conf *conf) ++{ ++ struct hns3_tm_node_list *tc_list = &conf->tc_list; ++ struct hns3_tm_node *tc_node[HNS3_MAX_TC_NUM]; ++ struct hns3_tm_node *tm_node; ++ uint32_t tidx; ++ ++ if (!conf->nb_tc_node) ++ return; ++ ++ fprintf(file, " tc_node: \n"); ++ memset(tc_node, 0, sizeof(tc_node)); ++ TAILQ_FOREACH(tm_node, tc_list, node) { ++ tidx = hns3_tm_calc_node_tc_no(conf, tm_node->id); ++ if (tidx < HNS3_MAX_TC_NUM) ++ tc_node[tidx] = tm_node; ++ } ++ ++ for (tidx = 0; tidx < HNS3_MAX_TC_NUM; tidx++) { ++ tm_node = tc_node[tidx]; ++ if (tm_node == NULL) ++ continue; ++ fprintf(file, ++ " id=%u TC%u reference_count=%u parent_id=%d " ++ "shaper_profile_id=%d\n", ++ tm_node->id, hns3_tm_calc_node_tc_no(conf, tm_node->id), ++ tm_node->reference_count, ++ tm_node->parent ? (int)tm_node->parent->id : -1, ++ tm_node->shaper_profile ? ++ (int)tm_node->shaper_profile->shaper_profile_id : -1); ++ } ++} ++ ++static void ++hns3_get_tm_conf_queue_format_info(FILE *file, struct hns3_tm_node **queue_node, ++ uint32_t *queue_node_tc, ++ uint32_t nb_tx_queues) ++{ ++#define PERLINE_QUEUES 32 ++#define PERLINE_STRIDE 8 ++#define LINE_BUF_SIZE 1024 ++ uint32_t i, j, line_num, start_queue, end_queue; ++ char tmpbuf[LINE_BUF_SIZE] = {0}; ++ ++ line_num = (nb_tx_queues + PERLINE_QUEUES - 1) / PERLINE_QUEUES; ++ for (i = 0; i < line_num; i++) { ++ start_queue = i * PERLINE_QUEUES; ++ end_queue = (i + 1) * PERLINE_QUEUES - 1; ++ if (end_queue > nb_tx_queues - 1) ++ end_queue = nb_tx_queues - 1; ++ fprintf(file, " %04u - %04u | ", start_queue, end_queue); ++ for (j = start_queue; j < nb_tx_queues; j++) { ++ if (j >= end_queue + 1) ++ break; ++ if (j > start_queue && j % PERLINE_STRIDE == 0) ++ fprintf(file, ":"); ++ fprintf(file, "%u", ++ queue_node[j] ? queue_node_tc[j] : ++ HNS3_MAX_TC_NUM); ++ } ++ fprintf(file, "%s\n", tmpbuf); ++ } ++} ++ ++static void ++hns3_get_tm_conf_queue_node_info(FILE *file, struct hns3_tm_conf *conf, ++ uint32_t nb_tx_queues) ++{ ++ struct hns3_tm_node_list *queue_list = &conf->queue_list; ++ uint32_t nb_queue_node = conf->nb_leaf_nodes_max + 1; ++ struct hns3_tm_node *queue_node[nb_queue_node]; ++ uint32_t queue_node_tc[nb_queue_node]; ++ struct hns3_tm_node *tm_node; ++ ++ if (!conf->nb_queue_node) ++ return; ++ ++ fprintf(file, ++ " queue_node: \n" ++ " tx queue id | mapped tc (8 mean node not exist)\n"); ++ ++ memset(queue_node, 0, sizeof(queue_node)); ++ memset(queue_node_tc, 0, sizeof(queue_node_tc)); ++ nb_tx_queues = RTE_MIN(nb_tx_queues, nb_queue_node); ++ TAILQ_FOREACH(tm_node, queue_list, node) { ++ if (tm_node->id >= nb_queue_node) ++ continue; ++ queue_node[tm_node->id] = tm_node; ++ queue_node_tc[tm_node->id] = tm_node->parent ? ++ hns3_tm_calc_node_tc_no(conf, tm_node->parent->id) : 0; ++ nb_tx_queues = RTE_MAX(nb_tx_queues, tm_node->id + 1); ++ } ++ ++ hns3_get_tm_conf_queue_format_info(file, queue_node, queue_node_tc, ++ nb_tx_queues); ++} ++ ++static void ++hns3_get_tm_conf_info(FILE *file, struct rte_eth_dev *dev) ++{ ++ struct hns3_pf *pf = HNS3_DEV_PRIVATE_TO_PF(dev->data->dev_private); ++ struct hns3_tm_conf *conf = &pf->tm_conf; ++ ++ fprintf(file, " - TM config info:\n"); ++ fprintf(file, ++ "\t -- nb_leaf_nodes_max=%u nb_nodes_max=%u\n" ++ "\t -- nb_shaper_profile=%u nb_tc_node=%u nb_queue_node=%u\n" ++ "\t -- committed=%u\n", ++ conf->nb_leaf_nodes_max, conf->nb_nodes_max, ++ conf->nb_shaper_profile, conf->nb_tc_node, conf->nb_queue_node, ++ conf->committed); ++ ++ hns3_get_tm_conf_shaper_info(file, conf); ++ hns3_get_tm_conf_port_node_info(file, conf); ++ hns3_get_tm_conf_tc_node_info(file, conf); ++ hns3_get_tm_conf_queue_node_info(file, conf, dev->data->nb_tx_queues); ++} ++ + int + hns3_eth_dev_priv_dump(struct rte_eth_dev *dev, FILE *file) + { +@@ -605,6 +758,7 @@ hns3_eth_dev_priv_dump(struct rte_eth_dev *dev, FILE *file) + hns3_get_dev_mac_info(file, hns); + hns3_get_vlan_config_info(file, hw); + hns3_get_fdir_basic_info(file, &hns->pf); ++ hns3_get_tm_conf_info(file, dev); + + return 0; + } +-- +2.30.0 + diff --git a/0054-net-hns3-fix-HW-buffer-size-on-MTU-update.patch b/0054-net-hns3-fix-HW-buffer-size-on-MTU-update.patch deleted file mode 100644 index a77fe4ab553a7fbb6759ec6b737d86e3ad766287..0000000000000000000000000000000000000000 --- a/0054-net-hns3-fix-HW-buffer-size-on-MTU-update.patch +++ /dev/null @@ -1,78 +0,0 @@ -From 7e76a11ae316966bb1094e3797a7f7c8fe4e3213 Mon Sep 17 00:00:00 2001 -From: Chengchang Tang -Date: Thu, 4 Mar 2021 15:44:50 +0800 -Subject: [PATCH 054/189] net/hns3: fix HW buffer size on MTU update - -After MTU changed, the buffer used to store packets in HW should be -reallocated. And buffer size is allocated based on the maximum frame -size in the PF struct. However, the value of maximum frame size is -not updated in time when MTU is changed. This would lead to a packet -loss for not enough buffer. - -This patch update the maximum frame size before reallocating the HW -buffer. And a rollback operation is added to avoid the side effects -of buffer reallocation failures. - -Fixes: 1f5ca0b460cd ("net/hns3: support some device operations") -Fixes: d51867db65c1 ("net/hns3: add initialization") -Cc: stable@dpdk.org - -Signed-off-by: Chengchang Tang -Signed-off-by: Lijun Ou ---- - drivers/net/hns3/hns3_ethdev.c | 24 ++++++++++++++++++++---- - 1 file changed, 20 insertions(+), 4 deletions(-) - -diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c -index 7993d2d..6a56a05 100644 ---- a/drivers/net/hns3/hns3_ethdev.c -+++ b/drivers/net/hns3/hns3_ethdev.c -@@ -2460,17 +2460,33 @@ hns3_set_mac_mtu(struct hns3_hw *hw, uint16_t new_mps) - static int - hns3_config_mtu(struct hns3_hw *hw, uint16_t mps) - { -+ struct hns3_adapter *hns = HNS3_DEV_HW_TO_ADAPTER(hw); -+ uint16_t original_mps = hns->pf.mps; -+ int err; - int ret; - - ret = hns3_set_mac_mtu(hw, mps); - if (ret) { -- hns3_err(hw, "Failed to set mtu, ret = %d", ret); -+ hns3_err(hw, "failed to set mtu, ret = %d", ret); - return ret; - } - -+ hns->pf.mps = mps; - ret = hns3_buffer_alloc(hw); -- if (ret) -- hns3_err(hw, "Failed to allocate buffer, ret = %d", ret); -+ if (ret) { -+ hns3_err(hw, "failed to allocate buffer, ret = %d", ret); -+ goto rollback; -+ } -+ -+ return 0; -+ -+rollback: -+ err = hns3_set_mac_mtu(hw, original_mps); -+ if (err) { -+ hns3_err(hw, "fail to rollback MTU, err = %d", err); -+ return ret; -+ } -+ hns->pf.mps = original_mps; - - return ret; - } -@@ -2505,7 +2521,7 @@ hns3_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) - dev->data->port_id, mtu, ret); - return ret; - } -- hns->pf.mps = (uint16_t)frame_size; -+ - if (is_jumbo_frame) - dev->data->dev_conf.rxmode.offloads |= - DEV_RX_OFFLOAD_JUMBO_FRAME; --- -2.7.4 - diff --git a/0055-net-hns3-dump-flow-control-info.patch b/0055-net-hns3-dump-flow-control-info.patch new file mode 100644 index 0000000000000000000000000000000000000000..0d67770fca1058aa359b2148a2857d41fd64d439 --- /dev/null +++ b/0055-net-hns3-dump-flow-control-info.patch @@ -0,0 +1,165 @@ +From e5e64a038775d3c7bd8f412fe9d814c8dfe795eb Mon Sep 17 00:00:00 2001 +From: "Min Hu (Connor)" +Date: Fri, 11 Feb 2022 11:27:04 +0800 +Subject: [PATCH 10/13] net/hns3: dump flow control info + +This patch dumps flow control info such as flow control mode +for debug. + +Signed-off-by: Min Hu (Connor) +--- + drivers/net/hns3/hns3_ethdev.c | 2 +- + drivers/net/hns3/hns3_ethdev.h | 2 + + drivers/net/hns3/hns3_ethdev_dump.c | 103 ++++++++++++++++++++++++++++ + 3 files changed, 106 insertions(+), 1 deletion(-) + +diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c +index a9394eeeff..cac6dd7755 100644 +--- a/drivers/net/hns3/hns3_ethdev.c ++++ b/drivers/net/hns3/hns3_ethdev.c +@@ -5350,7 +5350,7 @@ hns3_get_current_fc_mode(struct rte_eth_dev *dev) + return hns3_get_autoneg_fc_mode(hw); + } + +-static int ++int + hns3_flow_ctrl_get(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf) + { + struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private); +diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h +index 412626c053..fd83bb7109 100644 +--- a/drivers/net/hns3/hns3_ethdev.h ++++ b/drivers/net/hns3/hns3_ethdev.h +@@ -1030,6 +1030,8 @@ hns3_test_and_clear_bit(unsigned int nr, volatile uint64_t *addr) + return __atomic_fetch_and(addr, ~mask, __ATOMIC_RELAXED) & mask; + } + ++int ++hns3_flow_ctrl_get(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf); + uint32_t hns3_get_speed_capa(struct hns3_hw *hw); + + int hns3_buffer_alloc(struct hns3_hw *hw); +diff --git a/drivers/net/hns3/hns3_ethdev_dump.c b/drivers/net/hns3/hns3_ethdev_dump.c +index c0fc55b290..d9c1879f74 100644 +--- a/drivers/net/hns3/hns3_ethdev_dump.c ++++ b/drivers/net/hns3/hns3_ethdev_dump.c +@@ -738,6 +738,108 @@ hns3_get_tm_conf_info(FILE *file, struct rte_eth_dev *dev) + hns3_get_tm_conf_queue_node_info(file, conf, dev->data->nb_tx_queues); + } + ++static void ++hns3_fc_mode_to_rxtx_pause(enum hns3_fc_mode fc_mode, bool *rx_pause, ++ bool *tx_pause) ++{ ++ switch (fc_mode) { ++ case HNS3_FC_NONE: ++ *tx_pause = false; ++ *rx_pause = false; ++ break; ++ case HNS3_FC_RX_PAUSE: ++ *rx_pause = true; ++ *tx_pause = false; ++ break; ++ case HNS3_FC_TX_PAUSE: ++ *rx_pause = false; ++ *tx_pause = true; ++ break; ++ case HNS3_FC_FULL: ++ *rx_pause = true; ++ *tx_pause = true; ++ break; ++ default: ++ *rx_pause = false; ++ *tx_pause = false; ++ break; ++ } ++} ++ ++static bool ++hns3_is_link_fc_mode(struct hns3_adapter *hns) ++{ ++ struct hns3_hw *hw = &hns->hw; ++ struct hns3_pf *pf = &hns->pf; ++ ++ if (hw->current_fc_status == HNS3_FC_STATUS_PFC) ++ return false; ++ ++ if (hw->num_tc > 1 && !pf->support_multi_tc_pause) ++ return false; ++ ++ return true; ++} ++ ++static void ++hns3_get_link_fc_info(FILE *file, struct rte_eth_dev *dev) ++{ ++ struct hns3_adapter *hns = dev->data->dev_private; ++ struct hns3_hw *hw = &hns->hw; ++ struct rte_eth_fc_conf cur_fc_conf; ++ bool rx_pause1; ++ bool tx_pause1; ++ bool rx_pause2; ++ bool tx_pause2; ++ int ret; ++ ++ if (!hns3_is_link_fc_mode(hns)) ++ return; ++ ++ ret = hns3_flow_ctrl_get(dev, &cur_fc_conf); ++ if (ret) { ++ fprintf(file, "get device flow control info fail!\n"); ++ return; ++ } ++ ++ hns3_fc_mode_to_rxtx_pause(hw->requested_fc_mode, ++ &rx_pause1, &tx_pause1); ++ hns3_fc_mode_to_rxtx_pause((enum hns3_fc_mode)cur_fc_conf.mode, ++ &rx_pause2, &tx_pause2); ++ ++ fprintf(file, ++ "\t -- link_fc_info:\n" ++ "\t Requested fc:\n" ++ "\t Rx: %s\n" ++ "\t Tx: %s\n" ++ "\t Current fc:\n" ++ "\t Rx: %s\n" ++ "\t Tx: %s\n" ++ "\t Autonegotiate: %s\n" ++ "\t Pause time: 0x%x\n", ++ rx_pause1 ? "On" : "Off", tx_pause1 ? "On" : "Off", ++ rx_pause2 ? "On" : "Off", tx_pause2 ? "On" : "Off", ++ cur_fc_conf.autoneg == RTE_ETH_LINK_AUTONEG ? "On" : "Off", ++ cur_fc_conf.pause_time); ++} ++ ++static void ++hns3_get_flow_ctrl_info(FILE *file, struct rte_eth_dev *dev) ++{ ++ struct hns3_adapter *hns = dev->data->dev_private; ++ struct hns3_hw *hw = &hns->hw; ++ ++ fprintf(file, " - Flow Ctrl Info:\n"); ++ fprintf(file, ++ "\t -- fc_common_info:\n" ++ "\t current_fc_status=%u\n" ++ "\t requested_fc_mode=%u\n", ++ hw->current_fc_status, ++ hw->requested_fc_mode); ++ ++ hns3_get_link_fc_info(file, dev); ++} ++ + int + hns3_eth_dev_priv_dump(struct rte_eth_dev *dev, FILE *file) + { +@@ -759,6 +861,7 @@ hns3_eth_dev_priv_dump(struct rte_eth_dev *dev, FILE *file) + hns3_get_vlan_config_info(file, hw); + hns3_get_fdir_basic_info(file, &hns->pf); + hns3_get_tm_conf_info(file, dev); ++ hns3_get_flow_ctrl_info(file, dev); + + return 0; + } +-- +2.30.0 + diff --git a/0055-net-hns3-remove-unused-parameter-markers.patch b/0055-net-hns3-remove-unused-parameter-markers.patch deleted file mode 100644 index b1b95ca630cfd98a6d7938936192340535cd13fa..0000000000000000000000000000000000000000 --- a/0055-net-hns3-remove-unused-parameter-markers.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 82c54c157d1cb684ef41a0ccdec0be4ecfa64a31 Mon Sep 17 00:00:00 2001 -From: Huisong Li -Date: Thu, 4 Mar 2021 15:44:51 +0800 -Subject: [PATCH 055/189] net/hns3: remove unused parameter markers - -All input parameters in the "hns3_dev_xstats_get_by_id" API are used, -so the rte_unused flag of some variables should be deleted. - -Fixes: 3213d584b698 ("net/hns3: fix xstats with id and names") -Cc: stable@dpdk.org - -Signed-off-by: Huisong Li -Signed-off-by: Lijun Ou ---- - drivers/net/hns3/hns3_stats.h | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/drivers/net/hns3/hns3_stats.h b/drivers/net/hns3/hns3_stats.h -index 01b4f36..70a9c5b 100644 ---- a/drivers/net/hns3/hns3_stats.h -+++ b/drivers/net/hns3/hns3_stats.h -@@ -156,8 +156,8 @@ int hns3_dev_xstats_get_names(struct rte_eth_dev *dev, - struct rte_eth_xstat_name *xstats_names, - __rte_unused unsigned int size); - int hns3_dev_xstats_get_by_id(struct rte_eth_dev *dev, -- __rte_unused const uint64_t *ids, -- __rte_unused uint64_t *values, -+ const uint64_t *ids, -+ uint64_t *values, - uint32_t size); - int hns3_dev_xstats_get_names_by_id(struct rte_eth_dev *dev, - struct rte_eth_xstat_name *xstats_names, --- -2.7.4 - diff --git a/0056-net-hns3-change-dump-file-name.patch b/0056-net-hns3-change-dump-file-name.patch new file mode 100644 index 0000000000000000000000000000000000000000..bfead0aadfced19150e2471ea78dd3d24e002b88 --- /dev/null +++ b/0056-net-hns3-change-dump-file-name.patch @@ -0,0 +1,35 @@ +From 297a29aa8a27e93b2fa1fdc40a4964f0fbbaa4ec Mon Sep 17 00:00:00 2001 +From: "Min Hu (Connor)" +Date: Thu, 31 Mar 2022 14:20:42 +0800 +Subject: [PATCH 11/13] net/hns3: change dump file name + +change dump file name 'hns3_ethdev_dump.c' to 'hns3_dump.c', as it +is more simple. + +Signed-off-by: Min Hu (Connor) +--- + drivers/net/hns3/{hns3_ethdev_dump.c => hns3_dump.c} | 0 + drivers/net/hns3/meson.build | 2 +- + 2 files changed, 1 insertion(+), 1 deletion(-) + rename drivers/net/hns3/{hns3_ethdev_dump.c => hns3_dump.c} (100%) + +diff --git a/drivers/net/hns3/hns3_ethdev_dump.c b/drivers/net/hns3/hns3_dump.c +similarity index 100% +rename from drivers/net/hns3/hns3_ethdev_dump.c +rename to drivers/net/hns3/hns3_dump.c +diff --git a/drivers/net/hns3/meson.build b/drivers/net/hns3/meson.build +index 665b2afedf..9f30f6b7af 100644 +--- a/drivers/net/hns3/meson.build ++++ b/drivers/net/hns3/meson.build +@@ -30,7 +30,7 @@ sources = files( + 'hns3_tm.c', + 'hns3_ptp.c', + 'hns3_common.c', +- 'hns3_ethdev_dump.c', ++ 'hns3_dump.c', + ) + + deps += ['hash'] +-- +2.30.0 + diff --git a/0056-net-hns3-fix-mbuf-leakage.patch b/0056-net-hns3-fix-mbuf-leakage.patch deleted file mode 100644 index 31a3424d7782d8262cc39d3b276607de1011c7e5..0000000000000000000000000000000000000000 --- a/0056-net-hns3-fix-mbuf-leakage.patch +++ /dev/null @@ -1,200 +0,0 @@ -From bd503f5817a2597e8431e02675a8c3847a31992e Mon Sep 17 00:00:00 2001 -From: Huisong Li -Date: Thu, 4 Mar 2021 15:44:52 +0800 -Subject: [PATCH 056/189] net/hns3: fix mbuf leakage - -The mbufs of rx queue will be allocated in "hns3_do_start" function. -But these mbufs are not released when "hns3_dev_start" executes -failed. - -Fixes: c4ae39b2cfc5 ("net/hns3: fix Rx interrupt after reset") -Cc: stable@dpdk.org - -Signed-off-by: Huisong Li -Signed-off-by: Lijun Ou ---- - drivers/net/hns3/hns3_ethdev.c | 45 ++++++++++++++++++++++++--------------- - drivers/net/hns3/hns3_ethdev_vf.c | 43 ++++++++++++++++++++++--------------- - 2 files changed, 54 insertions(+), 34 deletions(-) - -diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c -index 6a56a05..1d56916 100644 ---- a/drivers/net/hns3/hns3_ethdev.c -+++ b/drivers/net/hns3/hns3_ethdev.c -@@ -102,6 +102,7 @@ static int hns3_remove_mc_addr(struct hns3_hw *hw, - struct rte_ether_addr *mac_addr); - static int hns3_restore_fec(struct hns3_hw *hw); - static int hns3_query_dev_fec_info(struct hns3_hw *hw); -+static int hns3_do_stop(struct hns3_adapter *hns); - - void hns3_ether_format_addr(char *buf, uint16_t size, - const struct rte_ether_addr *ether_addr) -@@ -5133,11 +5134,8 @@ hns3_dev_start(struct rte_eth_dev *dev) - return ret; - } - ret = hns3_map_rx_interrupt(dev); -- if (ret) { -- hw->adapter_state = HNS3_NIC_CONFIGURED; -- rte_spinlock_unlock(&hw->lock); -- return ret; -- } -+ if (ret) -+ goto map_rx_inter_err; - - /* - * There are three register used to control the status of a TQP -@@ -5151,19 +5149,12 @@ hns3_dev_start(struct rte_eth_dev *dev) - * status of queue in the dpdk framework. - */ - ret = hns3_start_all_txqs(dev); -- if (ret) { -- hw->adapter_state = HNS3_NIC_CONFIGURED; -- rte_spinlock_unlock(&hw->lock); -- return ret; -- } -+ if (ret) -+ goto map_rx_inter_err; - - ret = hns3_start_all_rxqs(dev); -- if (ret) { -- hns3_stop_all_txqs(dev); -- hw->adapter_state = HNS3_NIC_CONFIGURED; -- rte_spinlock_unlock(&hw->lock); -- return ret; -- } -+ if (ret) -+ goto start_all_rxqs_fail; - - hw->adapter_state = HNS3_NIC_STARTED; - rte_spinlock_unlock(&hw->lock); -@@ -5187,7 +5178,17 @@ hns3_dev_start(struct rte_eth_dev *dev) - hns3_tm_dev_start_proc(hw); - - hns3_info(hw, "hns3 dev start successful!"); -+ - return 0; -+ -+start_all_rxqs_fail: -+ hns3_stop_all_txqs(dev); -+map_rx_inter_err: -+ (void)hns3_do_stop(hns); -+ hw->adapter_state = HNS3_NIC_CONFIGURED; -+ rte_spinlock_unlock(&hw->lock); -+ -+ return ret; - } - - static int -@@ -5196,6 +5197,17 @@ hns3_do_stop(struct hns3_adapter *hns) - struct hns3_hw *hw = &hns->hw; - int ret; - -+ /* -+ * The "hns3_do_stop" function will also be called by .stop_service to -+ * prepare reset. At the time of global or IMP reset, the command cannot -+ * be sent to stop the tx/rx queues. The mbuf in Tx/Rx queues may be -+ * accessed during the reset process. So the mbuf can not be released -+ * during reset and is required to be released after the reset is -+ * completed. -+ */ -+ if (__atomic_load_n(&hw->reset.resetting, __ATOMIC_RELAXED) == 0) -+ hns3_dev_release_mbufs(hns); -+ - ret = hns3_cfg_mac_mode(hw, false); - if (ret) - return ret; -@@ -5273,7 +5285,6 @@ hns3_dev_stop(struct rte_eth_dev *dev) - hns3_stop_tqps(hw); - hns3_do_stop(hns); - hns3_unmap_rx_interrupt(dev); -- hns3_dev_release_mbufs(hns); - hw->adapter_state = HNS3_NIC_CONFIGURED; - } - hns3_rx_scattered_reset(dev); -diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c -index 90951df..12af105 100644 ---- a/drivers/net/hns3/hns3_ethdev_vf.c -+++ b/drivers/net/hns3/hns3_ethdev_vf.c -@@ -1941,6 +1941,17 @@ hns3vf_do_stop(struct hns3_adapter *hns) - - hw->mac.link_status = ETH_LINK_DOWN; - -+ /* -+ * The "hns3vf_do_stop" function will also be called by .stop_service to -+ * prepare reset. At the time of global or IMP reset, the command cannot -+ * be sent to stop the tx/rx queues. The mbuf in Tx/Rx queues may be -+ * accessed during the reset process. So the mbuf can not be released -+ * during reset and is required to be released after the reset is -+ * completed. -+ */ -+ if (__atomic_load_n(&hw->reset.resetting, __ATOMIC_RELAXED) == 0) -+ hns3_dev_release_mbufs(hns); -+ - if (__atomic_load_n(&hw->reset.disable_cmd, __ATOMIC_RELAXED) == 0) { - hns3vf_configure_mac_addr(hns, true); - ret = hns3_reset_all_tqps(hns); -@@ -2010,7 +2021,6 @@ hns3vf_dev_stop(struct rte_eth_dev *dev) - hns3_stop_tqps(hw); - hns3vf_do_stop(hns); - hns3vf_unmap_rx_interrupt(dev); -- hns3_dev_release_mbufs(hns); - hw->adapter_state = HNS3_NIC_CONFIGURED; - } - hns3_rx_scattered_reset(dev); -@@ -2253,11 +2263,8 @@ hns3vf_dev_start(struct rte_eth_dev *dev) - return ret; - } - ret = hns3vf_map_rx_interrupt(dev); -- if (ret) { -- hw->adapter_state = HNS3_NIC_CONFIGURED; -- rte_spinlock_unlock(&hw->lock); -- return ret; -- } -+ if (ret) -+ goto map_rx_inter_err; - - /* - * There are three register used to control the status of a TQP -@@ -2271,19 +2278,12 @@ hns3vf_dev_start(struct rte_eth_dev *dev) - * status of queue in the dpdk framework. - */ - ret = hns3_start_all_txqs(dev); -- if (ret) { -- hw->adapter_state = HNS3_NIC_CONFIGURED; -- rte_spinlock_unlock(&hw->lock); -- return ret; -- } -+ if (ret) -+ goto map_rx_inter_err; - - ret = hns3_start_all_rxqs(dev); -- if (ret) { -- hns3_stop_all_txqs(dev); -- hw->adapter_state = HNS3_NIC_CONFIGURED; -- rte_spinlock_unlock(&hw->lock); -- return ret; -- } -+ if (ret) -+ goto start_all_rxqs_fail; - - hw->adapter_state = HNS3_NIC_STARTED; - rte_spinlock_unlock(&hw->lock); -@@ -2305,6 +2305,15 @@ hns3vf_dev_start(struct rte_eth_dev *dev) - hns3_start_tqps(hw); - - return ret; -+ -+start_all_rxqs_fail: -+ hns3_stop_all_txqs(dev); -+map_rx_inter_err: -+ (void)hns3vf_do_stop(hns); -+ hw->adapter_state = HNS3_NIC_CONFIGURED; -+ rte_spinlock_unlock(&hw->lock); -+ -+ return ret; - } - - static bool --- -2.7.4 - diff --git a/0057-net-hns3-fix-code-check-for-dump.patch b/0057-net-hns3-fix-code-check-for-dump.patch new file mode 100644 index 0000000000000000000000000000000000000000..cf4687d366e221f37ec8fc58fdcbe7868ee0381e --- /dev/null +++ b/0057-net-hns3-fix-code-check-for-dump.patch @@ -0,0 +1,680 @@ +From d2c737bb909c52de76246d9c74944d96c5e7792f Mon Sep 17 00:00:00 2001 +From: "Min Hu (Connor)" +Date: Thu, 31 Mar 2022 15:59:51 +0800 +Subject: [PATCH 12/13] net/hns3: fix code check for dump + +This patch fix code check for dump, making it more readable. + +Signed-off-by: Min Hu (Connor) +--- + drivers/net/hns3/hns3_dump.c | 341 +++++++++++++++--------------- + drivers/net/hns3/hns3_dump.h | 10 + + drivers/net/hns3/hns3_ethdev.c | 1 + + drivers/net/hns3/hns3_ethdev.h | 3 +- + drivers/net/hns3/hns3_ethdev_vf.c | 1 + + 5 files changed, 187 insertions(+), 169 deletions(-) + create mode 100644 drivers/net/hns3/hns3_dump.h + +diff --git a/drivers/net/hns3/hns3_dump.c b/drivers/net/hns3/hns3_dump.c +index d9c1879f74..3a30a585c5 100644 +--- a/drivers/net/hns3/hns3_dump.c ++++ b/drivers/net/hns3/hns3_dump.c +@@ -2,37 +2,41 @@ + * Copyright(C) 2022 HiSilicon Limited + */ + +-#include +-#include +-#include +-#include ++#include + ++#include "hns3_ethdev.h" + #include "hns3_common.h" +-#include "hns3_logs.h" +-#include "hns3_regs.h" + #include "hns3_rxtx.h" ++#include "hns3_regs.h" ++#include "hns3_logs.h" ++#include "hns3_dump.h" + + static const char * +-hns3_get_adapter_state_name(uint32_t state) ++hns3_get_adapter_state_name(enum hns3_adapter_state state) + { +- static const char * const state_name[] = { +- "UNINITIALIZED", +- "INITIALIZED", +- "CONFIGURING", +- "CONFIGURED", +- "STARTING", +- "STARTED", +- "STOPPING", +- "CLOSING", +- "CLOSED", +- "REMOVED", +- "NSTATES" ++ const struct { ++ enum hns3_adapter_state state; ++ const char *name; ++ } adapter_state_name[] = { ++ {HNS3_NIC_UNINITIALIZED, "UNINITIALIZED"}, ++ {HNS3_NIC_INITIALIZED, "INITIALIZED"}, ++ {HNS3_NIC_CONFIGURING, "CONFIGURING"}, ++ {HNS3_NIC_CONFIGURED, "CONFIGURED"}, ++ {HNS3_NIC_STARTING, "STARTING"}, ++ {HNS3_NIC_STARTED, "STARTED"}, ++ {HNS3_NIC_STOPPING, "STOPPING"}, ++ {HNS3_NIC_CLOSING, "CLOSING"}, ++ {HNS3_NIC_CLOSED, "CLOSED"}, ++ {HNS3_NIC_REMOVED, "REMOVED"}, ++ {HNS3_NIC_NSTATES, "NSTATES"}, + }; ++ uint32_t i; + +- if (state < RTE_DIM(state_name)) +- return state_name[state]; +- else +- return "unknown"; ++ for (i = 0; i < RTE_DIM(adapter_state_name); i++) ++ if (state == adapter_state_name[i].state) ++ return adapter_state_name[i].name; ++ ++ return "Unknown"; + } + + static const char * +@@ -79,32 +83,36 @@ hns3_get_dev_mac_info(FILE *file, struct hns3_adapter *hns) + static void + hns3_get_dev_feature_capability(FILE *file, struct hns3_hw *hw) + { +- const char * const caps_name[] = { +- "DCB", +- "COPPER", +- "FD QUEUE REGION", +- "PTP", +- "TX PUSH", +- "INDEP TXRX", +- "STASH", +- "SIMPLE BD", +- "RXD Advanced Layout", +- "OUTER UDP CKSUM", +- "RAS IMP", +- "TM", ++ const struct { ++ enum hns3_dev_cap cap; ++ const char *name; ++ } caps_name[] = { ++ {HNS3_DEV_SUPPORT_DCB_B, "DCB"}, ++ {HNS3_DEV_SUPPORT_COPPER_B, "COPPER"}, ++ {HNS3_DEV_SUPPORT_FD_QUEUE_REGION_B, "FD QUEUE REGION"}, ++ {HNS3_DEV_SUPPORT_PTP_B, "PTP"}, ++ {HNS3_DEV_SUPPORT_TX_PUSH_B, "TX PUSH"}, ++ {HNS3_DEV_SUPPORT_INDEP_TXRX_B, "INDEP TXRX"}, ++ {HNS3_DEV_SUPPORT_STASH_B, "STASH"}, ++ {HNS3_DEV_SUPPORT_SIMPLE_BD_B, "SIMPLE BD"}, ++ {HNS3_DEV_SUPPORT_RXD_ADV_LAYOUT_B, "RXD Advanced Layout"}, ++ {HNS3_DEV_SUPPORT_OUTER_UDP_CKSUM_B, "OUTER UDP CKSUM"}, ++ {HNS3_DEV_SUPPORT_RAS_IMP_B, "RAS IMP"}, ++ {HNS3_DEV_SUPPORT_TM_B, "TM"}, + }; + uint32_t i; + + fprintf(file, " - Dev Capability:\n"); + for (i = 0; i < RTE_DIM(caps_name); i++) +- fprintf(file, "\t -- support %s: %s\n", caps_name[i], +- hw->capability & BIT(i) ? "yes" : "no"); ++ fprintf(file, "\t -- support %s: %s\n", caps_name[i].name, ++ hns3_get_bit(hw->capability, caps_name[i].cap) ? "Yes" : ++ "No"); + } + + static const char * + hns3_get_fdir_tuple_name(uint32_t index) + { +- static const char * const tuple_name[] = { ++ const char * const tuple_name[] = { + "outer_dst_mac", + "outer_src_mac", + "outer_vlan_1st_tag", +@@ -145,10 +153,8 @@ hns3_get_fdir_tuple_name(uint32_t index) + static void + hns3_get_fdir_basic_info(FILE *file, struct hns3_pf *pf) + { +-#define TMPBUF_SIZE 2048 +-#define PERLINE_TUPLE_NAMES 4 ++#define HNS3_PERLINE_TUPLE_NAME_LEN 4 + struct hns3_fd_cfg *fdcfg = &pf->fdir.fd_cfg; +- char tmpbuf[TMPBUF_SIZE] = {0}; + uint32_t i, count = 0; + + fprintf(file, " - Fdir Info:\n"); +@@ -171,17 +177,15 @@ hns3_get_fdir_basic_info(FILE *file, struct hns3_pf *pf) + for (i = 0; i < MAX_TUPLE; i++) { + if (!(fdcfg->key_cfg[HNS3_FD_STAGE_1].tuple_active & BIT(i))) + continue; +- if (count % PERLINE_TUPLE_NAMES == 0) ++ if (count % HNS3_PERLINE_TUPLE_NAME_LEN == 0) + fprintf(file, "\t "); + fprintf(file, " %s", hns3_get_fdir_tuple_name(i)); + count++; +- if (count % PERLINE_TUPLE_NAMES == 0) ++ if (count % HNS3_PERLINE_TUPLE_NAME_LEN == 0) + fprintf(file, "\n"); + } +- if (count % PERLINE_TUPLE_NAMES) ++ if (count % HNS3_PERLINE_TUPLE_NAME_LEN) + fprintf(file, "\n"); +- +- fprintf(file, "%s", tmpbuf); + } + + static void +@@ -220,99 +224,94 @@ hns3_get_device_basic_info(FILE *file, struct rte_eth_dev *dev) + dev->data->dev_conf.intr_conf.rxq); + } + +-/* +- * Note: caller must make sure queue_id < nb_queues +- * nb_queues = RTE_MAX(eth_dev->data->nb_rx_queues, +- * eth_dev->data->nb_tx_queues) +- */ + static struct hns3_rx_queue * +-hns3_get_rx_queue(struct rte_eth_dev *dev, uint32_t queue_id) ++hns3_get_rx_queue(struct rte_eth_dev *dev) + { +- struct hns3_adapter *hns = dev->data->dev_private; +- struct hns3_hw *hw = &hns->hw; +- uint32_t offset; ++ struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private); ++ struct hns3_rx_queue *rxq; ++ uint32_t queue_id; + void **rx_queues; + +- if (queue_id < dev->data->nb_rx_queues) { ++ for (queue_id = 0; queue_id < dev->data->nb_rx_queues; queue_id++) { + rx_queues = dev->data->rx_queues; +- offset = queue_id; +- } else { +- /* +- * For kunpeng930, fake queue is not exist. But since the queues +- * are usually accessd in pairs, this branch may still exist. +- */ +- if (hns3_dev_get_support(hw, INDEP_TXRX)) ++ if (rx_queues == NULL || rx_queues[queue_id] == NULL) { ++ hns3_err(hw, "detect rx_queues is NULL!\n"); + return NULL; ++ } + +- rx_queues = hw->fkq_data.rx_queues; +- offset = queue_id - dev->data->nb_rx_queues; +- } ++ rxq = (struct hns3_rx_queue *)rx_queues[queue_id]; ++ if (rxq->rx_deferred_start) ++ continue; + +- if (rx_queues != NULL && rx_queues[offset] != NULL) +- return rx_queues[offset]; ++ return rx_queues[queue_id]; ++ } + +- hns3_err(hw, "Detect rx_queues is NULL!\n"); + return NULL; + } + +-/* +- * Note: caller must make sure queue_id < nb_queues +- * nb_queues = RTE_MAX(eth_dev->data->nb_rx_queues, +- * eth_dev->data->nb_tx_queues) +- */ + static struct hns3_tx_queue * +-hns3_get_tx_queue(struct rte_eth_dev *dev, uint32_t queue_id) ++hns3_get_tx_queue(struct rte_eth_dev *dev) + { +- struct hns3_adapter *hns = dev->data->dev_private; +- struct hns3_hw *hw = &hns->hw; +- uint32_t offset; ++ struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private); ++ struct hns3_tx_queue *txq; ++ uint32_t queue_id; + void **tx_queues; + +- if (queue_id < dev->data->nb_tx_queues) { ++ for (queue_id = 0; queue_id < dev->data->nb_tx_queues; queue_id++) { + tx_queues = dev->data->tx_queues; +- offset = queue_id; +- } else { +- /* +- * For kunpeng930, fake queue is not exist. But since the queues +- * are usually accessd in pairs, this branch may still exist. +- */ +- if (hns3_dev_get_support(hw, INDEP_TXRX)) ++ if (tx_queues == NULL || tx_queues[queue_id] == NULL) { ++ hns3_err(hw, "detect tx_queues is NULL!\n"); + return NULL; +- tx_queues = hw->fkq_data.tx_queues; +- offset = queue_id - dev->data->nb_tx_queues; +- } ++ } + +- if (tx_queues != NULL && tx_queues[offset] != NULL) +- return tx_queues[offset]; ++ txq = (struct hns3_tx_queue *)tx_queues[queue_id]; ++ if (txq->tx_deferred_start) ++ continue; ++ ++ return tx_queues[queue_id]; ++ } + +- hns3_err(hw, "Detect tx_queues is NULL!\n"); + return NULL; + } + + static void + hns3_get_rxtx_fake_queue_info(FILE *file, struct rte_eth_dev *dev) + { +- struct hns3_adapter *hns = dev->data->dev_private; +- struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(hns); ++ struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private); + struct hns3_rx_queue *rxq; + struct hns3_tx_queue *txq; +- uint32_t queue_id; ++ uint32_t queue_id = 0; ++ void **rx_queues; ++ void **tx_queues; + +- if (dev->data->nb_rx_queues != dev->data->nb_tx_queues && +- !hns3_dev_get_support(hw, INDEP_TXRX)) { +- queue_id = RTE_MIN(dev->data->nb_rx_queues, +- dev->data->nb_tx_queues); +- rxq = hns3_get_rx_queue(dev, queue_id); +- if (rxq == NULL) ++ if (hns3_dev_get_support(hw, INDEP_TXRX)) ++ return; ++ ++ if (dev->data->nb_rx_queues < dev->data->nb_tx_queues) { ++ rx_queues = hw->fkq_data.rx_queues; ++ if (rx_queues == NULL || rx_queues[queue_id] == NULL) { ++ hns3_err(hw, "detect rx_queues is NULL!\n"); + return; +- txq = hns3_get_tx_queue(dev, queue_id); +- if (txq == NULL) ++ } ++ rxq = (struct hns3_rx_queue *)rx_queues[queue_id]; ++ ++ fprintf(file, ++ "\t -- first fake_queue info:\n" ++ "\t Rx: port=%u nb_desc=%u free_thresh=%u\n", ++ rxq->port_id, rxq->nb_rx_desc, rxq->rx_free_thresh); ++ } else if (dev->data->nb_rx_queues > dev->data->nb_tx_queues) { ++ tx_queues = hw->fkq_data.tx_queues; ++ queue_id = 0; ++ ++ if (tx_queues == NULL || tx_queues[queue_id] == NULL) { ++ hns3_err(hw, "detect tx_queues is NULL!\n"); + return; ++ } ++ txq = (struct hns3_tx_queue *)tx_queues[queue_id]; ++ + fprintf(file, +- "\t -- first fake_queue rxtx info:\n" +- "\t Rx: port=%u nb_desc=%u free_thresh=%u\n" +- "\t Tx: port=%u nb_desc=%u\n", +- rxq->port_id, rxq->nb_rx_desc, rxq->rx_free_thresh, ++ "\t -- first fake_queue info:\n" ++ "\t Tx: port=%u nb_desc=%u\n", + txq->port_id, txq->nb_tx_desc); + } + } +@@ -321,7 +320,7 @@ static void + hns3_get_queue_enable_state(struct hns3_hw *hw, uint32_t *queue_state, + uint32_t nb_queues, bool is_rxq) + { +-#define STATE_SIZE (sizeof(*queue_state) * CHAR_BIT) ++#define HNS3_QUEUE_NUM_PER_STATS (sizeof(*queue_state) * HNS3_UINT8_BIT) + uint32_t queue_en_reg; + uint32_t reg_offset; + uint32_t state; +@@ -334,28 +333,28 @@ hns3_get_queue_enable_state(struct hns3_hw *hw, uint32_t *queue_state, + if (hns3_dev_get_support(hw, INDEP_TXRX)) + state = state && hns3_read_dev(hw, reg_offset + + queue_en_reg); +- hns3_set_bit(queue_state[i / STATE_SIZE], +- i % STATE_SIZE, state); ++ hns3_set_bit(queue_state[i / HNS3_QUEUE_NUM_PER_STATS], ++ i % HNS3_QUEUE_NUM_PER_STATS, state); + } + } + + static void + hns3_print_queue_state_perline(FILE *file, const uint32_t *queue_state, +- uint32_t nb_queues, uint32_t line_num) ++ uint32_t nb_queues, uint32_t line_num) + { +-#define NUM_QUEUE_PER_LINE (sizeof(*queue_state) * CHAR_BIT) +- uint32_t qid = line_num * NUM_QUEUE_PER_LINE; +- uint32_t j; ++#define HNS3_NUM_QUEUE_PER_LINE (sizeof(*queue_state) * HNS3_UINT8_BIT) ++ uint32_t id = line_num * HNS3_NUM_QUEUE_PER_LINE; ++ uint32_t i; + +- for (j = 0; j < NUM_QUEUE_PER_LINE; j++) { +- fprintf(file, "%1lx", hns3_get_bit(queue_state[line_num], j)); ++ for (i = 0; i < HNS3_NUM_QUEUE_PER_LINE; i++) { ++ fprintf(file, "%1lx", hns3_get_bit(queue_state[line_num], i)); + +- if (qid % CHAR_BIT == CHAR_BIT - 1) { ++ if (id % HNS3_UINT8_BIT == HNS3_UINT8_BIT - 1) { + fprintf(file, "%s", +- j == NUM_QUEUE_PER_LINE - 1 ? "\n" : ":"); ++ i == HNS3_NUM_QUEUE_PER_LINE - 1 ? "\n" : ":"); + } +- qid++; +- if (qid >= nb_queues) { ++ id++; ++ if (id >= nb_queues) { + fprintf(file, "\n"); + break; + } +@@ -364,23 +363,17 @@ hns3_print_queue_state_perline(FILE *file, const uint32_t *queue_state, + + static void + hns3_display_queue_enable_state(FILE *file, const uint32_t *queue_state, +- uint32_t nb_queues, bool is_rxq) ++ uint32_t nb_queues, bool is_rxq) + { +-#define NUM_QUEUE_PER_LINE (sizeof(*queue_state) * CHAR_BIT) ++#define HNS3_NUM_QUEUE_PER_LINE (sizeof(*queue_state) * HNS3_UINT8_BIT) + uint32_t i; + +- if (nb_queues == 0) { +- fprintf(file, "\t %s queue number is 0\n", +- is_rxq ? "Rx" : "Tx"); +- return; +- } +- + fprintf(file, "\t %s queue id | enable state bitMap\n", + is_rxq ? "Rx" : "Tx"); + +- for (i = 0; i < (nb_queues - 1) / NUM_QUEUE_PER_LINE + 1; i++) { +- uint32_t line_end = (i + 1) * NUM_QUEUE_PER_LINE - 1; +- uint32_t line_start = i * NUM_QUEUE_PER_LINE; ++ for (i = 0; i < (nb_queues - 1) / HNS3_NUM_QUEUE_PER_LINE + 1; i++) { ++ uint32_t line_end = (i + 1) * HNS3_NUM_QUEUE_PER_LINE - 1; ++ uint32_t line_start = i * HNS3_NUM_QUEUE_PER_LINE; + fprintf(file, "\t %04u - %04u | ", line_start, + nb_queues - 1 > line_end ? line_end : nb_queues - 1); + +@@ -391,16 +384,28 @@ hns3_display_queue_enable_state(FILE *file, const uint32_t *queue_state, + static void + hns3_get_rxtx_queue_enable_state(FILE *file, struct rte_eth_dev *dev) + { +-#define MAX_TQP_NUM 1280 +-#define QUEUE_BITMAP_SIZE (MAX_TQP_NUM / 32) + struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private); +- uint32_t rx_queue_state[QUEUE_BITMAP_SIZE] = {0}; +- uint32_t tx_queue_state[QUEUE_BITMAP_SIZE] = {0}; ++ uint32_t *rx_queue_state; ++ uint32_t *tx_queue_state; + uint32_t nb_rx_queues; + uint32_t nb_tx_queues; ++ uint32_t bitmap_size; ++ ++ bitmap_size = (hw->tqps_num * sizeof(uint32_t) + HNS3_UINT32_BIT) / ++ HNS3_UINT32_BIT; ++ rx_queue_state = (uint32_t *)rte_zmalloc(NULL, bitmap_size, 0); ++ tx_queue_state = (uint32_t *)rte_zmalloc(NULL, bitmap_size, 0); + + nb_rx_queues = dev->data->nb_rx_queues; + nb_tx_queues = dev->data->nb_tx_queues; ++ if (nb_rx_queues == 0) { ++ fprintf(file, "\t -- Rx queue number is 0\n"); ++ return; ++ } ++ if (nb_tx_queues == 0) { ++ fprintf(file, "\t -- Tx queue number is 0\n"); ++ return; ++ } + + fprintf(file, "\t -- enable state:\n"); + hns3_get_queue_enable_state(hw, rx_queue_state, nb_rx_queues, true); +@@ -410,6 +415,8 @@ hns3_get_rxtx_queue_enable_state(FILE *file, struct rte_eth_dev *dev) + hns3_get_queue_enable_state(hw, tx_queue_state, nb_tx_queues, false); + hns3_display_queue_enable_state(file, tx_queue_state, nb_tx_queues, + false); ++ rte_free(rx_queue_state); ++ rte_free(tx_queue_state); + } + + static void +@@ -417,12 +424,11 @@ hns3_get_rxtx_queue_info(FILE *file, struct rte_eth_dev *dev) + { + struct hns3_rx_queue *rxq; + struct hns3_tx_queue *txq; +- uint32_t queue_id = 0; + +- rxq = hns3_get_rx_queue(dev, queue_id); ++ rxq = hns3_get_rx_queue(dev); + if (rxq == NULL) + return; +- txq = hns3_get_tx_queue(dev, queue_id); ++ txq = hns3_get_tx_queue(dev); + if (txq == NULL) + return; + fprintf(file, " - Rx/Tx Queue Info:\n"); +@@ -462,8 +468,8 @@ hns3_get_vlan_rx_offload_cfg(FILE *file, struct hns3_hw *hw) + ret = hns3_cmd_send(hw, &desc, 1); + if (ret != 0) { + hns3_err(hw, +- "NIC IMP exec ret=%d desc_num=%d optcode=0x%x!", +- ret, 1, rte_le_to_cpu_16(desc.opcode)); ++ "NIC firmware exec ret=%d optcode=0x%x!", ret, ++ rte_le_to_cpu_16(desc.opcode)); + return ret; + } + +@@ -551,7 +557,7 @@ hns3_get_vlan_tx_offload_cfg(FILE *file, struct hns3_hw *hw) + ret = hns3_cmd_send(hw, &desc, 1); + if (ret != 0) { + hns3_err(hw, +- "NIC IMP exec ret=%d desc_num=%d optcode=0x%x!", ++ "NIC firmware exec ret=%d desc_num=%d optcode=0x%x!", + ret, 1, rte_le_to_cpu_16(desc.opcode)); + return ret; + } +@@ -564,8 +570,8 @@ hns3_get_vlan_tx_offload_cfg(FILE *file, struct hns3_hw *hw) + static void + hns3_get_port_pvid_info(FILE *file, struct hns3_hw *hw) + { +- fprintf(file, "\t -- pvid status: %s\n", +- hw->port_base_vlan_cfg.state ? "on" : "off"); ++ fprintf(file, " - pvid status: %s\n", ++ hw->port_base_vlan_cfg.state ? "On" : "Off"); + } + + static void +@@ -581,8 +587,6 @@ hns3_get_vlan_config_info(FILE *file, struct hns3_hw *hw) + ret = hns3_get_vlan_tx_offload_cfg(file, hw); + if (ret < 0) + return; +- +- hns3_get_port_pvid_info(file, hw); + } + + static void +@@ -592,7 +596,7 @@ hns3_get_tm_conf_shaper_info(FILE *file, struct hns3_tm_conf *conf) + &conf->shaper_profile_list; + struct hns3_tm_shaper_profile *shaper_profile; + +- if (!conf->nb_shaper_profile) ++ if (conf->nb_shaper_profile == 0) + return; + + fprintf(file, " shaper_profile:\n"); +@@ -608,7 +612,7 @@ hns3_get_tm_conf_shaper_info(FILE *file, struct hns3_tm_conf *conf) + static void + hns3_get_tm_conf_port_node_info(FILE *file, struct hns3_tm_conf *conf) + { +- if (!conf->root) ++ if (conf->root == NULL) + return; + + fprintf(file, +@@ -627,7 +631,7 @@ hns3_get_tm_conf_tc_node_info(FILE *file, struct hns3_tm_conf *conf) + struct hns3_tm_node *tm_node; + uint32_t tidx; + +- if (!conf->nb_tc_node) ++ if (conf->nb_tc_node == 0) + return; + + fprintf(file, " tc_node: \n"); +@@ -658,29 +662,28 @@ hns3_get_tm_conf_queue_format_info(FILE *file, struct hns3_tm_node **queue_node, + uint32_t *queue_node_tc, + uint32_t nb_tx_queues) + { +-#define PERLINE_QUEUES 32 +-#define PERLINE_STRIDE 8 +-#define LINE_BUF_SIZE 1024 +- uint32_t i, j, line_num, start_queue, end_queue; +- char tmpbuf[LINE_BUF_SIZE] = {0}; ++#define HNS3_PERLINE_QUEUES 32 ++#define HNS3_PERLINE_STRIDE 8 ++ uint32_t i, j, line_num, start_queue_id, end_queue_id; + +- line_num = (nb_tx_queues + PERLINE_QUEUES - 1) / PERLINE_QUEUES; ++ line_num = (nb_tx_queues + HNS3_PERLINE_QUEUES - 1) / ++ HNS3_PERLINE_QUEUES; + for (i = 0; i < line_num; i++) { +- start_queue = i * PERLINE_QUEUES; +- end_queue = (i + 1) * PERLINE_QUEUES - 1; +- if (end_queue > nb_tx_queues - 1) +- end_queue = nb_tx_queues - 1; +- fprintf(file, " %04u - %04u | ", start_queue, end_queue); +- for (j = start_queue; j < nb_tx_queues; j++) { +- if (j >= end_queue + 1) ++ start_queue_id = i * HNS3_PERLINE_QUEUES; ++ end_queue_id = (i + 1) * HNS3_PERLINE_QUEUES - 1; ++ if (end_queue_id > nb_tx_queues - 1) ++ end_queue_id = nb_tx_queues - 1; ++ fprintf(file, " %04u - %04u | ", start_queue_id, ++ end_queue_id); ++ for (j = start_queue_id; j < nb_tx_queues; j++) { ++ if (j >= end_queue_id + 1) + break; +- if (j > start_queue && j % PERLINE_STRIDE == 0) ++ if (j > start_queue_id && j % HNS3_PERLINE_STRIDE == 0) + fprintf(file, ":"); + fprintf(file, "%u", + queue_node[j] ? queue_node_tc[j] : + HNS3_MAX_TC_NUM); + } +- fprintf(file, "%s\n", tmpbuf); + } + } + +@@ -694,7 +697,7 @@ hns3_get_tm_conf_queue_node_info(FILE *file, struct hns3_tm_conf *conf, + uint32_t queue_node_tc[nb_queue_node]; + struct hns3_tm_node *tm_node; + +- if (!conf->nb_queue_node) ++ if (conf->nb_queue_node == 0) + return; + + fprintf(file, +@@ -720,9 +723,13 @@ hns3_get_tm_conf_queue_node_info(FILE *file, struct hns3_tm_conf *conf, + static void + hns3_get_tm_conf_info(FILE *file, struct rte_eth_dev *dev) + { ++ struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private); + struct hns3_pf *pf = HNS3_DEV_PRIVATE_TO_PF(dev->data->dev_private); + struct hns3_tm_conf *conf = &pf->tm_conf; + ++ if (!hns3_dev_get_support(hw, TM)) ++ return; ++ + fprintf(file, " - TM config info:\n"); + fprintf(file, + "\t -- nb_leaf_nodes_max=%u nb_nodes_max=%u\n" +@@ -826,8 +833,7 @@ hns3_get_link_fc_info(FILE *file, struct rte_eth_dev *dev) + static void + hns3_get_flow_ctrl_info(FILE *file, struct rte_eth_dev *dev) + { +- struct hns3_adapter *hns = dev->data->dev_private; +- struct hns3_hw *hw = &hns->hw; ++ struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private); + + fprintf(file, " - Flow Ctrl Info:\n"); + fprintf(file, +@@ -849,6 +855,7 @@ hns3_eth_dev_priv_dump(struct rte_eth_dev *dev, FILE *file) + hns3_get_device_basic_info(file, dev); + hns3_get_dev_feature_capability(file, hw); + hns3_get_rxtx_queue_info(file, dev); ++ hns3_get_port_pvid_info(file, hw); + + /* + * VF only supports dumping basic info, feaure capability and queue +diff --git a/drivers/net/hns3/hns3_dump.h b/drivers/net/hns3/hns3_dump.h +new file mode 100644 +index 0000000000..8ba7ee866a +--- /dev/null ++++ b/drivers/net/hns3/hns3_dump.h +@@ -0,0 +1,10 @@ ++/* SPDX-License-Identifier: BSD-3-Clause ++ * Copyright(C) 2022 HiSilicon Limited ++ */ ++ ++#ifndef _HNS3_DUMP_H_ ++#define _HNS3_DUMP_H_ ++ ++int hns3_eth_dev_priv_dump(struct rte_eth_dev *dev, FILE *file); ++ ++#endif /* _HNS3_DUMP_H_ */ +diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c +index cac6dd7755..dfc41d2a05 100644 +--- a/drivers/net/hns3/hns3_ethdev.c ++++ b/drivers/net/hns3/hns3_ethdev.c +@@ -8,6 +8,7 @@ + + #include "hns3_ethdev.h" + #include "hns3_common.h" ++#include "hns3_dump.h" + #include "hns3_logs.h" + #include "hns3_rxtx.h" + #include "hns3_intr.h" +diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h +index fd83bb7109..d6d82c55f9 100644 +--- a/drivers/net/hns3/hns3_ethdev.h ++++ b/drivers/net/hns3/hns3_ethdev.h +@@ -874,7 +874,7 @@ struct hns3_adapter { + + #define HNS3_DEVARG_MBX_TIME_LIMIT_MS "mbx_time_limit_ms" + +-enum { ++enum hns3_dev_cap { + HNS3_DEV_SUPPORT_DCB_B, + HNS3_DEV_SUPPORT_COPPER_B, + HNS3_DEV_SUPPORT_FD_QUEUE_REGION_B, +@@ -1057,7 +1057,6 @@ int hns3_timesync_read_time(struct rte_eth_dev *dev, struct timespec *ts); + int hns3_timesync_write_time(struct rte_eth_dev *dev, + const struct timespec *ts); + int hns3_timesync_adjust_time(struct rte_eth_dev *dev, int64_t delta); +-int hns3_eth_dev_priv_dump(struct rte_eth_dev *dev, FILE *file); + + static inline bool + is_reset_pending(struct hns3_adapter *hns) +diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c +index aee0c36360..92fbdb90cd 100644 +--- a/drivers/net/hns3/hns3_ethdev_vf.c ++++ b/drivers/net/hns3/hns3_ethdev_vf.c +@@ -10,6 +10,7 @@ + + #include "hns3_ethdev.h" + #include "hns3_common.h" ++#include "hns3_dump.h" + #include "hns3_logs.h" + #include "hns3_rxtx.h" + #include "hns3_regs.h" +-- +2.30.0 + diff --git a/0057-net-hns3-process-MAC-interrupt.patch b/0057-net-hns3-process-MAC-interrupt.patch deleted file mode 100644 index d02fa9165d3e24d72749ca70b32a0a9979df6293..0000000000000000000000000000000000000000 --- a/0057-net-hns3-process-MAC-interrupt.patch +++ /dev/null @@ -1,211 +0,0 @@ -From b9fbefb52b791730d5720946713e6cb187337652 Mon Sep 17 00:00:00 2001 -From: Hongbo Zheng -Date: Thu, 4 Mar 2021 15:44:53 +0800 -Subject: [PATCH 057/189] net/hns3: process MAC interrupt - -TNL is the abbreviation of tunnel, which means port -here. MAC TNL interrupt indicates the MAC status -report of the network port, which will be generated -when the MAC status changes. - -This patch enables MAC TNL interrupt reporting, and -queries and prints the corresponding MAC status when -the interrupt is received, then clear the MAC interrupt -status. Because this interrupt uses the same interrupt -as RAS, the interrupt log is adjusted. - -Signed-off-by: Hongbo Zheng -Signed-off-by: Lijun Ou ---- - drivers/net/hns3/hns3_cmd.h | 3 +++ - drivers/net/hns3/hns3_ethdev.c | 57 ++++++++++++++++++++++++++++++++++++------ - drivers/net/hns3/hns3_intr.c | 20 +++++++++++++++ - drivers/net/hns3/hns3_intr.h | 4 +++ - 4 files changed, 76 insertions(+), 8 deletions(-) - -diff --git a/drivers/net/hns3/hns3_cmd.h b/drivers/net/hns3/hns3_cmd.h -index 6ceb655..094bf7e 100644 ---- a/drivers/net/hns3/hns3_cmd.h -+++ b/drivers/net/hns3/hns3_cmd.h -@@ -116,6 +116,9 @@ enum hns3_opcode_type { - HNS3_OPC_QUERY_LINK_STATUS = 0x0307, - HNS3_OPC_CONFIG_MAX_FRM_SIZE = 0x0308, - HNS3_OPC_CONFIG_SPEED_DUP = 0x0309, -+ HNS3_OPC_QUERY_MAC_TNL_INT = 0x0310, -+ HNS3_OPC_MAC_TNL_INT_EN = 0x0311, -+ HNS3_OPC_CLEAR_MAC_TNL_INT = 0x0312, - HNS3_OPC_CONFIG_FEC_MODE = 0x031A, - - /* PFC/Pause commands */ -diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c -index 1d56916..80f91a7 100644 ---- a/drivers/net/hns3/hns3_ethdev.c -+++ b/drivers/net/hns3/hns3_ethdev.c -@@ -217,9 +217,6 @@ hns3_check_event_cause(struct hns3_adapter *hns, uint32_t *clearval) - goto out; - } - -- if (clearval && (vector0_int_stats || cmdq_src_val || hw_err_src_reg)) -- hns3_warn(hw, "vector0_int_stats:0x%x cmdq_src_val:0x%x hw_err_src_reg:0x%x", -- vector0_int_stats, cmdq_src_val, hw_err_src_reg); - val = vector0_int_stats; - ret = HNS3_VECTOR0_EVENT_OTHER; - out: -@@ -258,6 +255,34 @@ hns3_clear_all_event_cause(struct hns3_hw *hw) - } - - static void -+hns3_handle_mac_tnl(struct hns3_hw *hw) -+{ -+ struct hns3_cmd_desc desc; -+ uint32_t status; -+ int ret; -+ -+ /* query and clear mac tnl interruptions */ -+ hns3_cmd_setup_basic_desc(&desc, HNS3_OPC_QUERY_MAC_TNL_INT, true); -+ ret = hns3_cmd_send(hw, &desc, 1); -+ if (ret) { -+ hns3_err(hw, "failed to query mac tnl int, ret = %d.", ret); -+ return; -+ } -+ -+ status = rte_le_to_cpu_32(desc.data[0]); -+ if (status) { -+ hns3_warn(hw, "mac tnl int occurs, status = 0x%x.", status); -+ hns3_cmd_setup_basic_desc(&desc, HNS3_OPC_CLEAR_MAC_TNL_INT, -+ false); -+ desc.data[0] = rte_cpu_to_le_32(HNS3_MAC_TNL_INT_CLR); -+ ret = hns3_cmd_send(hw, &desc, 1); -+ if (ret) -+ hns3_err(hw, "failed to clear mac tnl int, ret = %d.", -+ ret); -+ } -+} -+ -+static void - hns3_interrupt_handler(void *param) - { - struct rte_eth_dev *dev = (struct rte_eth_dev *)param; -@@ -265,24 +290,36 @@ hns3_interrupt_handler(void *param) - struct hns3_hw *hw = &hns->hw; - enum hns3_evt_cause event_cause; - uint32_t clearval = 0; -+ uint32_t vector0_int; -+ uint32_t ras_int; -+ uint32_t cmdq_int; - - /* Disable interrupt */ - hns3_pf_disable_irq0(hw); - - event_cause = hns3_check_event_cause(hns, &clearval); -+ vector0_int = hns3_read_dev(hw, HNS3_VECTOR0_OTHER_INT_STS_REG); -+ ras_int = hns3_read_dev(hw, HNS3_RAS_PF_OTHER_INT_STS_REG); -+ cmdq_int = hns3_read_dev(hw, HNS3_VECTOR0_CMDQ_SRC_REG); - /* vector 0 interrupt is shared with reset and mailbox source events. */ - if (event_cause == HNS3_VECTOR0_EVENT_ERR) { -- hns3_warn(hw, "Received err interrupt"); -+ hns3_warn(hw, "received interrupt: vector0_int_stat:0x%x " -+ "ras_int_stat:0x%x cmdq_int_stat:0x%x", -+ vector0_int, ras_int, cmdq_int); - hns3_handle_msix_error(hns, &hw->reset.request); - hns3_handle_ras_error(hns, &hw->reset.request); -+ hns3_handle_mac_tnl(hw); - hns3_schedule_reset(hns); - } else if (event_cause == HNS3_VECTOR0_EVENT_RST) { -- hns3_warn(hw, "Received reset interrupt"); -+ hns3_warn(hw, "received reset interrupt"); - hns3_schedule_reset(hns); -- } else if (event_cause == HNS3_VECTOR0_EVENT_MBX) -+ } else if (event_cause == HNS3_VECTOR0_EVENT_MBX) { - hns3_dev_handle_mbx_msg(hw); -- else -- hns3_err(hw, "Received unknown event"); -+ } else { -+ hns3_warn(hw, "received unknown event: vector0_int_stat:0x%x " -+ "ras_int_stat:0x%x cmdq_int_stat:0x%x", -+ vector0_int, ras_int, cmdq_int); -+ } - - hns3_clear_event_cause(hw, event_cause, clearval); - /* Enable interrupt if it is not cause by reset */ -@@ -4639,6 +4676,8 @@ hns3_update_link_status(struct hns3_hw *hw) - if (state != hw->mac.link_status) { - hw->mac.link_status = state; - hns3_warn(hw, "Link status change to %s!", state ? "up" : "down"); -+ hns3_config_mac_tnl_int(hw, -+ state == ETH_LINK_UP ? true : false); - return true; - } - -@@ -4957,6 +4996,7 @@ hns3_uninit_pf(struct rte_eth_dev *eth_dev) - (void)hns3_firmware_compat_config(hw, false); - hns3_uninit_umv_space(hw); - hns3_tqp_stats_uninit(hw); -+ hns3_config_mac_tnl_int(hw, false); - hns3_pf_disable_irq0(hw); - rte_intr_disable(&pci_dev->intr_handle); - hns3_intr_unregister(&pci_dev->intr_handle, hns3_interrupt_handler, -@@ -5282,6 +5322,7 @@ hns3_dev_stop(struct rte_eth_dev *dev) - rte_spinlock_lock(&hw->lock); - if (__atomic_load_n(&hw->reset.resetting, __ATOMIC_RELAXED) == 0) { - hns3_tm_dev_stop_proc(hw); -+ hns3_config_mac_tnl_int(hw, false); - hns3_stop_tqps(hw); - hns3_do_stop(hns); - hns3_unmap_rx_interrupt(dev); -diff --git a/drivers/net/hns3/hns3_intr.c b/drivers/net/hns3/hns3_intr.c -index 88ce4c6..2563504 100644 ---- a/drivers/net/hns3/hns3_intr.c -+++ b/drivers/net/hns3/hns3_intr.c -@@ -1248,6 +1248,26 @@ enable_ssu_err_intr(struct hns3_adapter *hns, bool en) - return ret; - } - -+void -+hns3_config_mac_tnl_int(struct hns3_hw *hw, bool en) -+{ -+ struct hns3_cmd_desc desc; -+ int ret; -+ -+ hns3_cmd_setup_basic_desc(&desc, HNS3_OPC_MAC_TNL_INT_EN, false); -+ if (en) -+ desc.data[0] = rte_cpu_to_le_32(HNS3_MAC_TNL_INT_EN); -+ else -+ desc.data[0] = 0; -+ -+ desc.data[1] = rte_cpu_to_le_32(HNS3_MAC_TNL_INT_EN_MASK); -+ -+ ret = hns3_cmd_send(hw, &desc, 1); -+ if (ret) -+ hns3_err(hw, "fail to %s mac tnl intr, ret = %d", -+ en ? "enable" : "disable", ret); -+} -+ - static int - config_ppu_err_intrs(struct hns3_adapter *hns, uint32_t cmd, bool en) - { -diff --git a/drivers/net/hns3/hns3_intr.h b/drivers/net/hns3/hns3_intr.h -index 19de1aa..c569a9d 100644 ---- a/drivers/net/hns3/hns3_intr.h -+++ b/drivers/net/hns3/hns3_intr.h -@@ -22,6 +22,9 @@ - - #define HNS3_MAC_COMMON_ERR_INT_EN 0x107FF - #define HNS3_MAC_COMMON_ERR_INT_EN_MASK 0x107FF -+#define HNS3_MAC_TNL_INT_EN GENMASK(9, 0) -+#define HNS3_MAC_TNL_INT_EN_MASK GENMASK(9, 0) -+#define HNS3_MAC_TNL_INT_CLR GENMASK(9, 0) - - #define HNS3_IMP_TCM_ECC_ERR_INT_EN 0xFFFF0000 - #define HNS3_IMP_TCM_ECC_ERR_INT_EN_MASK 0xFFFF0000 -@@ -99,6 +102,7 @@ struct hns3_hw_error_desc { - int hns3_enable_hw_error_intr(struct hns3_adapter *hns, bool state); - void hns3_handle_msix_error(struct hns3_adapter *hns, uint64_t *levels); - void hns3_handle_ras_error(struct hns3_adapter *hns, uint64_t *levels); -+void hns3_config_mac_tnl_int(struct hns3_hw *hw, bool en); - - void hns3_intr_unregister(const struct rte_intr_handle *hdl, - rte_intr_callback_fn cb_fn, void *cb_arg); --- -2.7.4 - diff --git a/0058-ethdev-fix-ethdev-version-map.patch b/0058-ethdev-fix-ethdev-version-map.patch new file mode 100644 index 0000000000000000000000000000000000000000..05f1f9e3c53ff83499de060a3e0b76541eda0f33 --- /dev/null +++ b/0058-ethdev-fix-ethdev-version-map.patch @@ -0,0 +1,31 @@ +From fe0c1c3ea1023ecece4bf5f5ef99a014fcb182b8 Mon Sep 17 00:00:00 2001 +From: "Min Hu (Connor)" +Date: Wed, 6 Apr 2022 09:29:30 +0800 +Subject: [PATCH 13/13] ethdev: fix ethdev version map + +This patch fix ethdev version map as new API introduced. + +Fixes: 2d2aea5495d1 ("ethdev: introduce dump API") + +Signed-off-by: Min Hu (Connor) +--- + lib/ethdev/version.map | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/lib/ethdev/version.map b/lib/ethdev/version.map +index c2fb0669a4..f29c60eda4 100644 +--- a/lib/ethdev/version.map ++++ b/lib/ethdev/version.map +@@ -256,6 +256,9 @@ EXPERIMENTAL { + rte_flow_flex_item_create; + rte_flow_flex_item_release; + rte_flow_pick_transfer_proxy; ++ ++ # added in 22.03 ++ rte_eth_dev_priv_dump; + }; + + INTERNAL { +-- +2.30.0 + diff --git a/0058-net-hns3-fix-imprecise-statistics.patch b/0058-net-hns3-fix-imprecise-statistics.patch deleted file mode 100644 index e6347f460961734d9009a5937afe05b3c1c3130f..0000000000000000000000000000000000000000 --- a/0058-net-hns3-fix-imprecise-statistics.patch +++ /dev/null @@ -1,376 +0,0 @@ -From 7905cce75947b36dc0d955234d0930367e86bc17 Mon Sep 17 00:00:00 2001 -From: Chengchang Tang -Date: Thu, 4 Mar 2021 15:44:54 +0800 -Subject: [PATCH 058/189] net/hns3: fix imprecise statistics - -Currently, the hns3 statistics may be inaccurate due to the -following two problems: - -1. Queue-level statistics are read from the firmware, and only one Rx or - Tx can be read at a time. This results in a large time interval - between reading multiple queues statistics in a stress scenario, such - as 1280 queues used by a PF or 256 functions used at the same time. - Especially when the 256 functions are used at the same time, the - interval between every two firmware commands in a function can be - huge, because the scheduling mechanism of the firmware is similar to - RR. - -2. The current statistics are read by type. The HW statistics are read - first, and then the software statistics are read. Due to preceding - reasons, HW reading may be time-consuming, which cause a - synchronization problem between SW and HW statistics of the same - queue. - -In this patch, queue-level statistics are directly read from the bar -instead of the firmware, and all the statistics of a queue include HW -and SW are read at a time to reduce inconsistency. - -Fixes: 8839c5e202f3 ("net/hns3: support device stats") -Cc: stable@dpdk.org - -Signed-off-by: Chengchang Tang -Signed-off-by: Lijun Ou ---- - drivers/net/hns3/hns3_stats.c | 221 ++++++++++++++---------------------------- - 1 file changed, 72 insertions(+), 149 deletions(-) - -diff --git a/drivers/net/hns3/hns3_stats.c b/drivers/net/hns3/hns3_stats.c -index 87035e3..941c75f 100644 ---- a/drivers/net/hns3/hns3_stats.c -+++ b/drivers/net/hns3/hns3_stats.c -@@ -367,7 +367,6 @@ static const struct hns3_xstats_name_offset hns3_imissed_stats_strings[] = { - HNS3_NUM_RESET_XSTATS + HNS3_NUM_IMISSED_XSTATS) - - static void hns3_tqp_stats_clear(struct hns3_hw *hw); --static void hns3_tqp_basic_stats_clear(struct rte_eth_dev *dev); - - /* - * Query all the MAC statistics data of Network ICL command ,opcode id: 0x0034. -@@ -481,49 +480,6 @@ hns3_query_update_mac_stats(struct rte_eth_dev *dev) - return ret; - } - --/* Get tqp stats from register */ --static int --hns3_update_tqp_stats(struct hns3_hw *hw) --{ -- struct hns3_tqp_stats *stats = &hw->tqp_stats; -- struct hns3_cmd_desc desc; -- uint64_t cnt; -- uint16_t i; -- int ret; -- -- for (i = 0; i < hw->tqps_num; i++) { -- hns3_cmd_setup_basic_desc(&desc, HNS3_OPC_QUERY_RX_STATUS, -- true); -- -- desc.data[0] = rte_cpu_to_le_32((uint32_t)i); -- ret = hns3_cmd_send(hw, &desc, 1); -- if (ret) { -- hns3_err(hw, "Failed to query RX No.%u queue stat: %d", -- i, ret); -- return ret; -- } -- cnt = rte_le_to_cpu_32(desc.data[1]); -- stats->rcb_rx_ring_pktnum_rcd += cnt; -- stats->rcb_rx_ring_pktnum[i] += cnt; -- -- hns3_cmd_setup_basic_desc(&desc, HNS3_OPC_QUERY_TX_STATUS, -- true); -- -- desc.data[0] = rte_cpu_to_le_32((uint32_t)i); -- ret = hns3_cmd_send(hw, &desc, 1); -- if (ret) { -- hns3_err(hw, "Failed to query TX No.%u queue stat: %d", -- i, ret); -- return ret; -- } -- cnt = rte_le_to_cpu_32(desc.data[1]); -- stats->rcb_tx_ring_pktnum_rcd += cnt; -- stats->rcb_tx_ring_pktnum[i] += cnt; -- } -- -- return 0; --} -- - static int - hns3_update_rpu_drop_stats(struct hns3_hw *hw) - { -@@ -589,17 +545,11 @@ hns3_stats_get(struct rte_eth_dev *eth_dev, struct rte_eth_stats *rte_stats) - struct hns3_rx_missed_stats *imissed_stats = &hw->imissed_stats; - struct hns3_tqp_stats *stats = &hw->tqp_stats; - struct hns3_rx_queue *rxq; -+ struct hns3_tx_queue *txq; - uint64_t cnt; - uint16_t i; - int ret; - -- /* Update tqp stats by read register */ -- ret = hns3_update_tqp_stats(hw); -- if (ret) { -- hns3_err(hw, "Update tqp stats fail : %d", ret); -- return ret; -- } -- - if (!hns->is_vf) { - /* Update imissed stats */ - ret = hns3_update_imissed_stats(hw, false); -@@ -612,24 +562,34 @@ hns3_stats_get(struct rte_eth_dev *eth_dev, struct rte_eth_stats *rte_stats) - rte_stats->imissed = imissed_stats->rpu_rx_drop_cnt; - } - -- /* Get the error stats and bytes of received packets */ -+ /* Reads all the stats of a rxq in a loop to keep them synchronized */ - for (i = 0; i < eth_dev->data->nb_rx_queues; i++) { - rxq = eth_dev->data->rx_queues[i]; -- if (rxq) { -- cnt = rxq->err_stats.l2_errors + -- rxq->err_stats.pkt_len_errors; -- rte_stats->ierrors += cnt; -+ if (rxq == NULL) -+ continue; - -- rte_stats->ibytes += rxq->basic_stats.bytes; -- } -+ cnt = hns3_read_dev(rxq, HNS3_RING_RX_PKTNUM_RECORD_REG); -+ /* -+ * Read hardware and software in adjacent positions to minumize -+ * the timing variance. -+ */ -+ rte_stats->ierrors += rxq->err_stats.l2_errors + -+ rxq->err_stats.pkt_len_errors; -+ stats->rcb_rx_ring_pktnum_rcd += cnt; -+ stats->rcb_rx_ring_pktnum[i] += cnt; -+ rte_stats->ibytes += rxq->basic_stats.bytes; - } - -- /* Get the bytes of received packets */ -- struct hns3_tx_queue *txq; -+ /* Reads all the stats of a txq in a loop to keep them synchronized */ - for (i = 0; i < eth_dev->data->nb_tx_queues; i++) { - txq = eth_dev->data->tx_queues[i]; -- if (txq) -- rte_stats->obytes += txq->basic_stats.bytes; -+ if (txq == NULL) -+ continue; -+ -+ cnt = hns3_read_dev(txq, HNS3_RING_TX_PKTNUM_RECORD_REG); -+ stats->rcb_tx_ring_pktnum_rcd += cnt; -+ stats->rcb_tx_ring_pktnum[i] += cnt; -+ rte_stats->obytes += txq->basic_stats.bytes; - } - - rte_stats->oerrors = 0; -@@ -653,37 +613,11 @@ hns3_stats_reset(struct rte_eth_dev *eth_dev) - { - struct hns3_adapter *hns = eth_dev->data->dev_private; - struct hns3_hw *hw = &hns->hw; -- struct hns3_cmd_desc desc_reset; - struct hns3_rx_queue *rxq; -+ struct hns3_tx_queue *txq; - uint16_t i; - int ret; - -- /* -- * Note: Reading hardware statistics of rx/tx queue packet number -- * will clear them. -- */ -- for (i = 0; i < hw->tqps_num; i++) { -- hns3_cmd_setup_basic_desc(&desc_reset, HNS3_OPC_QUERY_RX_STATUS, -- true); -- desc_reset.data[0] = rte_cpu_to_le_32((uint32_t)i); -- ret = hns3_cmd_send(hw, &desc_reset, 1); -- if (ret) { -- hns3_err(hw, "Failed to reset RX No.%u queue stat: %d", -- i, ret); -- return ret; -- } -- -- hns3_cmd_setup_basic_desc(&desc_reset, HNS3_OPC_QUERY_TX_STATUS, -- true); -- desc_reset.data[0] = rte_cpu_to_le_32((uint32_t)i); -- ret = hns3_cmd_send(hw, &desc_reset, 1); -- if (ret) { -- hns3_err(hw, "Failed to reset TX No.%u queue stat: %d", -- i, ret); -- return ret; -- } -- } -- - if (!hns->is_vf) { - /* - * Note: Reading hardware statistics of imissed registers will -@@ -697,25 +631,44 @@ hns3_stats_reset(struct rte_eth_dev *eth_dev) - } - } - -- /* -- * Clear soft stats of rx error packet which will be dropped -- * in driver. -- */ - for (i = 0; i < eth_dev->data->nb_rx_queues; i++) { - rxq = eth_dev->data->rx_queues[i]; -- if (rxq) { -- rxq->err_stats.pkt_len_errors = 0; -- rxq->err_stats.l2_errors = 0; -- } -+ if (rxq == NULL) -+ continue; -+ -+ rxq->err_stats.pkt_len_errors = 0; -+ rxq->err_stats.l2_errors = 0; -+ } -+ -+ /* Clear all the stats of a rxq in a loop to keep them synchronized */ -+ for (i = 0; i < eth_dev->data->nb_rx_queues; i++) { -+ rxq = eth_dev->data->rx_queues[i]; -+ if (rxq == NULL) -+ continue; -+ -+ memset(&rxq->basic_stats, 0, -+ sizeof(struct hns3_rx_basic_stats)); -+ -+ /* This register is read-clear */ -+ (void)hns3_read_dev(rxq, HNS3_RING_RX_PKTNUM_RECORD_REG); -+ rxq->err_stats.pkt_len_errors = 0; -+ rxq->err_stats.l2_errors = 0; -+ } -+ -+ /* Clear all the stats of a txq in a loop to keep them synchronized */ -+ for (i = 0; i < eth_dev->data->nb_tx_queues; i++) { -+ txq = eth_dev->data->tx_queues[i]; -+ if (txq == NULL) -+ continue; -+ -+ memset(&txq->basic_stats, 0, -+ sizeof(struct hns3_tx_basic_stats)); -+ -+ /* This register is read-clear */ -+ (void)hns3_read_dev(txq, HNS3_RING_TX_PKTNUM_RECORD_REG); - } - -- /* -- * 'packets' in hns3_tx_basic_stats and hns3_rx_basic_stats come -- * from hw->tqp_stats. And clearing tqp stats is like clearing -- * their source. -- */ - hns3_tqp_stats_clear(hw); -- hns3_tqp_basic_stats_clear(eth_dev); - - return 0; - } -@@ -881,6 +834,7 @@ hns3_rxq_basic_stats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *xstats, - struct hns3_rx_basic_stats *rxq_stats; - struct hns3_rx_queue *rxq; - uint16_t i, j; -+ uint32_t cnt; - char *val; - - for (i = 0; i < dev->data->nb_rx_queues; i++) { -@@ -888,9 +842,17 @@ hns3_rxq_basic_stats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *xstats, - if (rxq == NULL) - continue; - -+ cnt = hns3_read_dev(rxq, HNS3_RING_RX_PKTNUM_RECORD_REG); -+ /* -+ * Read hardware and software in adjacent positions to minimize -+ * the time difference. -+ */ - rxq_stats = &rxq->basic_stats; - rxq_stats->errors = rxq->err_stats.l2_errors + - rxq->err_stats.pkt_len_errors; -+ stats->rcb_rx_ring_pktnum_rcd += cnt; -+ stats->rcb_rx_ring_pktnum[i] += cnt; -+ - /* - * If HW statistics are reset by stats_reset, but a lot of - * residual packets exist in the hardware queue and these -@@ -919,6 +881,7 @@ hns3_txq_basic_stats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *xstats, - struct hns3_tx_basic_stats *txq_stats; - struct hns3_tx_queue *txq; - uint16_t i, j; -+ uint32_t cnt; - char *val; - - for (i = 0; i < dev->data->nb_tx_queues; i++) { -@@ -926,6 +889,10 @@ hns3_txq_basic_stats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *xstats, - if (txq == NULL) - continue; - -+ cnt = hns3_read_dev(txq, HNS3_RING_TX_PKTNUM_RECORD_REG); -+ stats->rcb_tx_ring_pktnum_rcd += cnt; -+ stats->rcb_tx_ring_pktnum[i] += cnt; -+ - txq_stats = &txq->basic_stats; - txq_stats->packets = stats->rcb_tx_ring_pktnum[i]; - -@@ -939,54 +906,12 @@ hns3_txq_basic_stats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *xstats, - } - } - --static int -+static void - hns3_tqp_basic_stats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *xstats, - int *count) - { -- struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private); -- int ret; -- -- /* Update tqp stats by read register */ -- ret = hns3_update_tqp_stats(hw); -- if (ret) { -- hns3_err(hw, "Update tqp stats fail, ret = %d.", ret); -- return ret; -- } -- - hns3_rxq_basic_stats_get(dev, xstats, count); - hns3_txq_basic_stats_get(dev, xstats, count); -- -- return 0; --} -- --/* -- * The function is only called by hns3_dev_xstats_reset to clear -- * basic stats of per-queue. TQP stats are all cleared in hns3_stats_reset -- * which is called before this function. -- * -- * @param dev -- * Pointer to Ethernet device. -- */ --static void --hns3_tqp_basic_stats_clear(struct rte_eth_dev *dev) --{ -- struct hns3_tx_queue *txq; -- struct hns3_rx_queue *rxq; -- uint16_t i; -- -- for (i = 0; i < dev->data->nb_rx_queues; i++) { -- rxq = dev->data->rx_queues[i]; -- if (rxq) -- memset(&rxq->basic_stats, 0, -- sizeof(struct hns3_rx_basic_stats)); -- } -- -- for (i = 0; i < dev->data->nb_tx_queues; i++) { -- txq = dev->data->tx_queues[i]; -- if (txq) -- memset(&txq->basic_stats, 0, -- sizeof(struct hns3_tx_basic_stats)); -- } - } - - /* -@@ -1028,9 +953,7 @@ hns3_dev_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *xstats, - - count = 0; - -- ret = hns3_tqp_basic_stats_get(dev, xstats, &count); -- if (ret < 0) -- return ret; -+ hns3_tqp_basic_stats_get(dev, xstats, &count); - - if (!hns->is_vf) { - /* Update Mac stats */ --- -2.7.4 - diff --git a/0059-net-hns3-add-runtime-config-to-select-IO-burst-funct.patch b/0059-net-hns3-add-runtime-config-to-select-IO-burst-funct.patch deleted file mode 100644 index 05a1b0ef41c57ae599192a21adaf87e8ec38ac1b..0000000000000000000000000000000000000000 --- a/0059-net-hns3-add-runtime-config-to-select-IO-burst-funct.patch +++ /dev/null @@ -1,341 +0,0 @@ -From 20570791fbb46112707b5ddb21da9446da8a938d Mon Sep 17 00:00:00 2001 -From: Chengwen Feng -Date: Tue, 23 Mar 2021 19:21:00 +0800 -Subject: [PATCH 059/189] net/hns3: add runtime config to select IO burst - function - -Currently, the driver support multiple IO burst function and auto -selection of the most appropriate function based on offload -configuration. - -Most applications such as l2fwd/l3fwd don't provide the means to -change offload configuration, so it will use the auto selection's io -burst function. - -This patch support runtime config to select io burst function, which -add two config: rx_func_hint and tx_func_hint, both could assign -vec/sve/simple/common. - -The driver will use the following rules to select io burst func: -a. if hint equal vec and meet the vec Rx/Tx usage condition then use the - neon function. -b. if hint equal sve and meet the sve Rx/Tx usage condition then use the - sve function. -c. if hint equal simple and meet the simple Rx/Tx usage condition then - use the simple function. -d. if hint equal common then use the common function. -e. if hint not set then: -e.1. if meet the vec Rx/Tx usage condition then use the neon function. -e.2. if meet the simple Rx/Tx usage condition then use the simple - function. -e.3. else use the common function. - -Note: the sve Rx/Tx usage condition based on the vec Rx/Tx usage -condition and runtime environment (which must support SVE). - -In the previous versions, driver will preferred use the sve function -when meet the sve Rx/Tx usage condition, but in this case driver could -get better performance if use the neon function. - -Signed-off-by: Chengwen Feng -Signed-off-by: Min Hu (Connor) ---- - doc/guides/nics/hns3.rst | 37 +++++++++++++++++++ - drivers/net/hns3/hns3_ethdev.c | 77 +++++++++++++++++++++++++++++++++++++++ - drivers/net/hns3/hns3_ethdev.h | 15 ++++++++ - drivers/net/hns3/hns3_ethdev_vf.c | 4 ++ - drivers/net/hns3/hns3_rxtx.c | 54 ++++++++++++++++++++------- - 5 files changed, 173 insertions(+), 14 deletions(-) - -diff --git a/doc/guides/nics/hns3.rst b/doc/guides/nics/hns3.rst -index 8db8867..e8abd07 100644 ---- a/doc/guides/nics/hns3.rst -+++ b/doc/guides/nics/hns3.rst -@@ -46,6 +46,43 @@ Prerequisites - - Follow the DPDK :ref:`Getting Started Guide for Linux ` to setup the basic DPDK environment. - - -+Runtime Config Options -+---------------------- -+ -+- ``rx_func_hint`` (default ``none``) -+ -+ Used to select Rx burst function, supported value are ``vec``, ``sve``, -+ ``simple``, ``common``. -+ ``vec``, if supported use the ``vec`` Rx function which indicates the -+ default vector algorithm, neon for Kunpeng Arm platform. -+ ``sve``, if supported use the ``sve`` Rx function which indicates the -+ sve algorithm. -+ ``simple``, if supported use the ``simple`` Rx function which indicates -+ the scalar algorithm. -+ ``common``, if supported use the ``common`` Rx function which indicates -+ the scalar scattered algorithm. -+ -+ When provided parameter is not supported, ``vec`` usage condition will -+ be first checked, if meets, use the ``vec``. Then, ``simple``, at last -+ ``common``. -+ -+- ``tx_func_hint`` (default ``none``) -+ -+ Used to select Tx burst function, supported value are ``vec``, ``sve``, -+ ``simple``, ``common``. -+ ``vec``, if supported use the ``vec`` Tx function which indicates the -+ default vector algorithm, neon for Kunpeng Arm platform. -+ ``sve``, if supported use the ``sve`` Tx function which indicates the -+ sve algorithm. -+ ``simple``, if supported use the ``simple`` Tx function which indicates -+ the scalar simple algorithm. -+ ``common``, if supported use the ``common`` Tx function which indicates -+ the scalar algorithm. -+ -+ When provided parameter is not supported, ``vec`` usage condition will -+ be first checked, if meets, use the ``vec``. Then, ``simple``, at last -+ ``common``. -+ - Driver compilation and testing - ------------------------------ - -diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c -index 80f91a7..f6ec8ac 100644 ---- a/drivers/net/hns3/hns3_ethdev.c -+++ b/drivers/net/hns3/hns3_ethdev.c -@@ -6,6 +6,7 @@ - #include - #include - #include -+#include - - #include "hns3_ethdev.h" - #include "hns3_logs.h" -@@ -6505,6 +6506,78 @@ hns3_get_module_info(struct rte_eth_dev *dev, - return 0; - } - -+static int -+hns3_parse_io_hint_func(const char *key, const char *value, void *extra_args) -+{ -+ uint32_t hint = HNS3_IO_FUNC_HINT_NONE; -+ -+ RTE_SET_USED(key); -+ -+ if (strcmp(value, "vec") == 0) -+ hint = HNS3_IO_FUNC_HINT_VEC; -+ else if (strcmp(value, "sve") == 0) -+ hint = HNS3_IO_FUNC_HINT_SVE; -+ else if (strcmp(value, "simple") == 0) -+ hint = HNS3_IO_FUNC_HINT_SIMPLE; -+ else if (strcmp(value, "common") == 0) -+ hint = HNS3_IO_FUNC_HINT_COMMON; -+ -+ /* If the hint is valid then update output parameters */ -+ if (hint != HNS3_IO_FUNC_HINT_NONE) -+ *(uint32_t *)extra_args = hint; -+ -+ return 0; -+} -+ -+static const char * -+hns3_get_io_hint_func_name(uint32_t hint) -+{ -+ switch (hint) { -+ case HNS3_IO_FUNC_HINT_VEC: -+ return "vec"; -+ case HNS3_IO_FUNC_HINT_SVE: -+ return "sve"; -+ case HNS3_IO_FUNC_HINT_SIMPLE: -+ return "simple"; -+ case HNS3_IO_FUNC_HINT_COMMON: -+ return "common"; -+ default: -+ return "none"; -+ } -+} -+ -+void -+hns3_parse_devargs(struct rte_eth_dev *dev) -+{ -+ struct hns3_adapter *hns = dev->data->dev_private; -+ uint32_t rx_func_hint = HNS3_IO_FUNC_HINT_NONE; -+ uint32_t tx_func_hint = HNS3_IO_FUNC_HINT_NONE; -+ struct hns3_hw *hw = &hns->hw; -+ struct rte_kvargs *kvlist; -+ -+ if (dev->device->devargs == NULL) -+ return; -+ -+ kvlist = rte_kvargs_parse(dev->device->devargs->args, NULL); -+ if (!kvlist) -+ return; -+ -+ rte_kvargs_process(kvlist, HNS3_DEVARG_RX_FUNC_HINT, -+ &hns3_parse_io_hint_func, &rx_func_hint); -+ rte_kvargs_process(kvlist, HNS3_DEVARG_TX_FUNC_HINT, -+ &hns3_parse_io_hint_func, &tx_func_hint); -+ rte_kvargs_free(kvlist); -+ -+ if (rx_func_hint != HNS3_IO_FUNC_HINT_NONE) -+ hns3_warn(hw, "parsed %s = %s.", HNS3_DEVARG_RX_FUNC_HINT, -+ hns3_get_io_hint_func_name(rx_func_hint)); -+ hns->rx_func_hint = rx_func_hint; -+ if (tx_func_hint != HNS3_IO_FUNC_HINT_NONE) -+ hns3_warn(hw, "parsed %s = %s.", HNS3_DEVARG_TX_FUNC_HINT, -+ hns3_get_io_hint_func_name(tx_func_hint)); -+ hns->tx_func_hint = tx_func_hint; -+} -+ - static const struct eth_dev_ops hns3_eth_dev_ops = { - .dev_configure = hns3_dev_configure, - .dev_start = hns3_dev_start, -@@ -6625,6 +6698,7 @@ hns3_dev_init(struct rte_eth_dev *eth_dev) - hw->adapter_state = HNS3_NIC_UNINITIALIZED; - hns->is_vf = false; - hw->data = eth_dev->data; -+ hns3_parse_devargs(eth_dev); - - /* - * Set default max packet size according to the mtu -@@ -6758,5 +6832,8 @@ static struct rte_pci_driver rte_hns3_pmd = { - RTE_PMD_REGISTER_PCI(net_hns3, rte_hns3_pmd); - RTE_PMD_REGISTER_PCI_TABLE(net_hns3, pci_id_hns3_map); - RTE_PMD_REGISTER_KMOD_DEP(net_hns3, "* igb_uio | vfio-pci"); -+RTE_PMD_REGISTER_PARAM_STRING(net_hns3, -+ HNS3_DEVARG_RX_FUNC_HINT "=vec|sve|simple|common " -+ HNS3_DEVARG_TX_FUNC_HINT "=vec|sve|simple|common "); - RTE_LOG_REGISTER(hns3_logtype_init, pmd.net.hns3.init, NOTICE); - RTE_LOG_REGISTER(hns3_logtype_driver, pmd.net.hns3.driver, NOTICE); -diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h -index 52e6c49..67a69ba 100644 ---- a/drivers/net/hns3/hns3_ethdev.h -+++ b/drivers/net/hns3/hns3_ethdev.h -@@ -772,9 +772,23 @@ struct hns3_adapter { - bool tx_simple_allowed; - bool tx_vec_allowed; - -+ uint32_t rx_func_hint; -+ uint32_t tx_func_hint; -+ - struct hns3_ptype_table ptype_tbl __rte_cache_min_aligned; - }; - -+enum { -+ HNS3_IO_FUNC_HINT_NONE = 0, -+ HNS3_IO_FUNC_HINT_VEC, -+ HNS3_IO_FUNC_HINT_SVE, -+ HNS3_IO_FUNC_HINT_SIMPLE, -+ HNS3_IO_FUNC_HINT_COMMON -+}; -+ -+#define HNS3_DEVARG_RX_FUNC_HINT "rx_func_hint" -+#define HNS3_DEVARG_TX_FUNC_HINT "tx_func_hint" -+ - #define HNS3_DEV_SUPPORT_DCB_B 0x0 - #define HNS3_DEV_SUPPORT_COPPER_B 0x1 - #define HNS3_DEV_SUPPORT_UDP_GSO_B 0x2 -@@ -975,6 +989,7 @@ int hns3_dev_infos_get(struct rte_eth_dev *eth_dev, - struct rte_eth_dev_info *info); - void hns3vf_update_link_status(struct hns3_hw *hw, uint8_t link_status, - uint32_t link_speed, uint8_t link_duplex); -+void hns3_parse_devargs(struct rte_eth_dev *dev); - - static inline bool - is_reset_pending(struct hns3_adapter *hns) -diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c -index 12af105..a4fd8ca 100644 ---- a/drivers/net/hns3/hns3_ethdev_vf.c -+++ b/drivers/net/hns3/hns3_ethdev_vf.c -@@ -2834,6 +2834,7 @@ hns3vf_dev_init(struct rte_eth_dev *eth_dev) - hw->adapter_state = HNS3_NIC_UNINITIALIZED; - hns->is_vf = true; - hw->data = eth_dev->data; -+ hns3_parse_devargs(eth_dev); - - ret = hns3_reset_init(hw); - if (ret) -@@ -2962,3 +2963,6 @@ static struct rte_pci_driver rte_hns3vf_pmd = { - RTE_PMD_REGISTER_PCI(net_hns3_vf, rte_hns3vf_pmd); - RTE_PMD_REGISTER_PCI_TABLE(net_hns3_vf, pci_id_hns3vf_map); - RTE_PMD_REGISTER_KMOD_DEP(net_hns3_vf, "* igb_uio | vfio-pci"); -+RTE_PMD_REGISTER_PARAM_STRING(net_hns3_vf, -+ HNS3_DEVARG_RX_FUNC_HINT "=vec|sve|simple|common " -+ HNS3_DEVARG_TX_FUNC_HINT "=vec|sve|simple|common "); -diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c -index 09b38d4..8e927f1 100644 ---- a/drivers/net/hns3/hns3_rxtx.c -+++ b/drivers/net/hns3/hns3_rxtx.c -@@ -2689,13 +2689,26 @@ hns3_get_rx_function(struct rte_eth_dev *dev) - { - struct hns3_adapter *hns = dev->data->dev_private; - uint64_t offloads = dev->data->dev_conf.rxmode.offloads; -+ bool vec_allowed, sve_allowed, simple_allowed; -+ -+ vec_allowed = hns->rx_vec_allowed && -+ hns3_rx_check_vec_support(dev) == 0; -+ sve_allowed = vec_allowed && hns3_check_sve_support(); -+ simple_allowed = hns->rx_simple_allowed && !dev->data->scattered_rx && -+ (offloads & DEV_RX_OFFLOAD_TCP_LRO) == 0; -+ -+ if (hns->rx_func_hint == HNS3_IO_FUNC_HINT_VEC && vec_allowed) -+ return hns3_recv_pkts_vec; -+ if (hns->rx_func_hint == HNS3_IO_FUNC_HINT_SVE && sve_allowed) -+ return hns3_recv_pkts_vec_sve; -+ if (hns->rx_func_hint == HNS3_IO_FUNC_HINT_SIMPLE && simple_allowed) -+ return hns3_recv_pkts; -+ if (hns->rx_func_hint == HNS3_IO_FUNC_HINT_COMMON) -+ return hns3_recv_scattered_pkts; - -- if (hns->rx_vec_allowed && hns3_rx_check_vec_support(dev) == 0) -- return hns3_check_sve_support() ? hns3_recv_pkts_vec_sve : -- hns3_recv_pkts_vec; -- -- if (hns->rx_simple_allowed && !dev->data->scattered_rx && -- (offloads & DEV_RX_OFFLOAD_TCP_LRO) == 0) -+ if (vec_allowed) -+ return hns3_recv_pkts_vec; -+ if (simple_allowed) - return hns3_recv_pkts; - - return hns3_recv_scattered_pkts; -@@ -3930,19 +3943,32 @@ hns3_get_tx_function(struct rte_eth_dev *dev, eth_tx_prep_t *prep) - { - uint64_t offloads = dev->data->dev_conf.txmode.offloads; - struct hns3_adapter *hns = dev->data->dev_private; -+ bool vec_allowed, sve_allowed, simple_allowed; - -- if (hns->tx_vec_allowed && hns3_tx_check_vec_support(dev) == 0) { -- *prep = NULL; -- return hns3_check_sve_support() ? hns3_xmit_pkts_vec_sve : -- hns3_xmit_pkts_vec; -- } -+ vec_allowed = hns->tx_vec_allowed && -+ hns3_tx_check_vec_support(dev) == 0; -+ sve_allowed = vec_allowed && hns3_check_sve_support(); -+ simple_allowed = hns->tx_simple_allowed && -+ offloads == (offloads & DEV_TX_OFFLOAD_MBUF_FAST_FREE); - -- if (hns->tx_simple_allowed && -- offloads == (offloads & DEV_TX_OFFLOAD_MBUF_FAST_FREE)) { -- *prep = NULL; -+ *prep = NULL; -+ -+ if (hns->tx_func_hint == HNS3_IO_FUNC_HINT_VEC && vec_allowed) -+ return hns3_xmit_pkts_vec; -+ if (hns->tx_func_hint == HNS3_IO_FUNC_HINT_SVE && sve_allowed) -+ return hns3_xmit_pkts_vec_sve; -+ if (hns->tx_func_hint == HNS3_IO_FUNC_HINT_SIMPLE && simple_allowed) - return hns3_xmit_pkts_simple; -+ if (hns->tx_func_hint == HNS3_IO_FUNC_HINT_COMMON) { -+ *prep = hns3_prep_pkts; -+ return hns3_xmit_pkts; - } - -+ if (vec_allowed) -+ return hns3_xmit_pkts_vec; -+ if (simple_allowed) -+ return hns3_xmit_pkts_simple; -+ - *prep = hns3_prep_pkts; - return hns3_xmit_pkts; - } --- -2.7.4 - diff --git a/0059-net-hns3-delete-simple-bd-cap.patch b/0059-net-hns3-delete-simple-bd-cap.patch new file mode 100644 index 0000000000000000000000000000000000000000..db030f303382dbfd0d6c05e85ff4d9e8e17f615d --- /dev/null +++ b/0059-net-hns3-delete-simple-bd-cap.patch @@ -0,0 +1,28 @@ +From b757a6bf3bef31517f3799fa5a0426e38da04a71 Mon Sep 17 00:00:00 2001 +From: Min Hu +Date: Wed, 6 Apr 2022 11:56:06 +0800 +Subject: [PATCH] net/hns3: delete simple bd cap + +This patch delete simple bd cap for dump as it has not been merged +in community. + +Signed-off-by: Min Hu +--- + drivers/net/hns3/hns3_dump.c | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/drivers/net/hns3/hns3_dump.c b/drivers/net/hns3/hns3_dump.c +index 3a30a585c5..4b18bb647c 100644 +--- a/drivers/net/hns3/hns3_dump.c ++++ b/drivers/net/hns3/hns3_dump.c +@@ -94,7 +94,6 @@ hns3_get_dev_feature_capability(FILE *file, struct hns3_hw *hw) + {HNS3_DEV_SUPPORT_TX_PUSH_B, "TX PUSH"}, + {HNS3_DEV_SUPPORT_INDEP_TXRX_B, "INDEP TXRX"}, + {HNS3_DEV_SUPPORT_STASH_B, "STASH"}, +- {HNS3_DEV_SUPPORT_SIMPLE_BD_B, "SIMPLE BD"}, + {HNS3_DEV_SUPPORT_RXD_ADV_LAYOUT_B, "RXD Advanced Layout"}, + {HNS3_DEV_SUPPORT_OUTER_UDP_CKSUM_B, "OUTER UDP CKSUM"}, + {HNS3_DEV_SUPPORT_RAS_IMP_B, "RAS IMP"}, +-- +2.30.0 + diff --git a/0060-net-hns3-fix-TM-info-dump.patch b/0060-net-hns3-fix-TM-info-dump.patch new file mode 100644 index 0000000000000000000000000000000000000000..6ed03816bb90a5d2530a80c333955262f272bae6 --- /dev/null +++ b/0060-net-hns3-fix-TM-info-dump.patch @@ -0,0 +1,29 @@ +From 288da934034f84ab87b9e0d087db7e1e3c88bc8a Mon Sep 17 00:00:00 2001 +From: "Min Hu (Connor)" +Date: Fri, 8 Apr 2022 11:27:04 +0800 +Subject: [PATCH] net/hns3: fix TM info dump + +This patch add newline characterat the end of TM info dump. + +Fixes: 761dfa44be2f ("net/hns3: dump TM configuration info") + +Signed-off-by: Min Hu (Connor) +--- + drivers/net/hns3/hns3_dump.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/net/hns3/hns3_dump.c b/drivers/net/hns3/hns3_dump.c +index 3a30a585c5..6ec3125b10 100644 +--- a/drivers/net/hns3/hns3_dump.c ++++ b/drivers/net/hns3/hns3_dump.c +@@ -684,6 +684,7 @@ hns3_get_tm_conf_queue_format_info(FILE *file, struct hns3_tm_node **queue_node, + queue_node[j] ? queue_node_tc[j] : + HNS3_MAX_TC_NUM); + } ++ fprintf(file, "\n"); + } + } + +-- +2.33.0 + diff --git a/0060-net-hns3-support-outer-UDP-checksum.patch b/0060-net-hns3-support-outer-UDP-checksum.patch deleted file mode 100644 index 98bf5c0b881b8ddc709faa72c7901bfe8d41b646..0000000000000000000000000000000000000000 --- a/0060-net-hns3-support-outer-UDP-checksum.patch +++ /dev/null @@ -1,292 +0,0 @@ -From a9ababcfe9b34d979359f023833fbaebbb04e9d0 Mon Sep 17 00:00:00 2001 -From: Chengchang Tang -Date: Tue, 23 Mar 2021 19:21:01 +0800 -Subject: [PATCH 060/189] net/hns3: support outer UDP checksum - -Kunpeng930 support outer UDP cksum, this patch add support for it. - -Signed-off-by: Chengchang Tang -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_cmd.c | 3 ++ - drivers/net/hns3/hns3_ethdev.c | 3 ++ - drivers/net/hns3/hns3_ethdev.h | 4 ++ - drivers/net/hns3/hns3_ethdev_vf.c | 3 ++ - drivers/net/hns3/hns3_rxtx.c | 85 +++++++++++++++++++++++++++++------- - drivers/net/hns3/hns3_rxtx.h | 4 +- - drivers/net/hns3/hns3_rxtx_vec_sve.c | 5 ++- - 7 files changed, 88 insertions(+), 19 deletions(-) - -diff --git a/drivers/net/hns3/hns3_cmd.c b/drivers/net/hns3/hns3_cmd.c -index 8a2cc2d..f8d8b0a 100644 ---- a/drivers/net/hns3/hns3_cmd.c -+++ b/drivers/net/hns3/hns3_cmd.c -@@ -433,6 +433,9 @@ hns3_parse_capability(struct hns3_hw *hw, - if (hns3_get_bit(caps, HNS3_CAPS_RXD_ADV_LAYOUT_B)) - hns3_set_bit(hw->capability, HNS3_DEV_SUPPORT_RXD_ADV_LAYOUT_B, - 1); -+ if (hns3_get_bit(caps, HNS3_CAPS_UDP_TUNNEL_CSUM_B)) -+ hns3_set_bit(hw->capability, -+ HNS3_DEV_SUPPORT_OUTER_UDP_CKSUM_B, 1); - } - - static uint32_t -diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c -index f6ec8ac..5da00b3 100644 ---- a/drivers/net/hns3/hns3_ethdev.c -+++ b/drivers/net/hns3/hns3_ethdev.c -@@ -2620,6 +2620,9 @@ hns3_dev_infos_get(struct rte_eth_dev *eth_dev, struct rte_eth_dev_info *info) - DEV_TX_OFFLOAD_MBUF_FAST_FREE | - hns3_txvlan_cap_get(hw)); - -+ if (hns3_dev_outer_udp_cksum_supported(hw)) -+ info->tx_offload_capa |= DEV_TX_OFFLOAD_OUTER_UDP_CKSUM; -+ - if (hns3_dev_indep_txrx_supported(hw)) - info->dev_capa = RTE_ETH_DEV_CAPA_RUNTIME_RX_QUEUE_SETUP | - RTE_ETH_DEV_CAPA_RUNTIME_TX_QUEUE_SETUP; -diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h -index 67a69ba..dc27bb1 100644 ---- a/drivers/net/hns3/hns3_ethdev.h -+++ b/drivers/net/hns3/hns3_ethdev.h -@@ -798,6 +798,7 @@ enum { - #define HNS3_DEV_SUPPORT_INDEP_TXRX_B 0x6 - #define HNS3_DEV_SUPPORT_STASH_B 0x7 - #define HNS3_DEV_SUPPORT_RXD_ADV_LAYOUT_B 0x9 -+#define HNS3_DEV_SUPPORT_OUTER_UDP_CKSUM_B 0xA - - #define hns3_dev_dcb_supported(hw) \ - hns3_get_bit((hw)->capability, HNS3_DEV_SUPPORT_DCB_B) -@@ -831,6 +832,9 @@ enum { - #define hns3_dev_rxd_adv_layout_supported(hw) \ - hns3_get_bit((hw)->capability, HNS3_DEV_SUPPORT_RXD_ADV_LAYOUT_B) - -+#define hns3_dev_outer_udp_cksum_supported(hw) \ -+ hns3_get_bit((hw)->capability, HNS3_DEV_SUPPORT_OUTER_UDP_CKSUM_B) -+ - #define HNS3_DEV_PRIVATE_TO_HW(adapter) \ - (&((struct hns3_adapter *)adapter)->hw) - #define HNS3_DEV_PRIVATE_TO_PF(adapter) \ -diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c -index a4fd8ca..35c42ca 100644 ---- a/drivers/net/hns3/hns3_ethdev_vf.c -+++ b/drivers/net/hns3/hns3_ethdev_vf.c -@@ -988,6 +988,9 @@ hns3vf_dev_infos_get(struct rte_eth_dev *eth_dev, struct rte_eth_dev_info *info) - DEV_TX_OFFLOAD_MBUF_FAST_FREE | - hns3_txvlan_cap_get(hw)); - -+ if (hns3_dev_outer_udp_cksum_supported(hw)) -+ info->tx_offload_capa |= DEV_TX_OFFLOAD_OUTER_UDP_CKSUM; -+ - if (hns3_dev_indep_txrx_supported(hw)) - info->dev_capa = RTE_ETH_DEV_CAPA_RUNTIME_RX_QUEUE_SETUP | - RTE_ETH_DEV_CAPA_RUNTIME_TX_QUEUE_SETUP; -diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c -index 8e927f1..404c403 100644 ---- a/drivers/net/hns3/hns3_rxtx.c -+++ b/drivers/net/hns3/hns3_rxtx.c -@@ -2967,7 +2967,7 @@ hns3_fill_first_desc(struct hns3_tx_queue *txq, struct hns3_desc *desc, - hdr_len += (ol_flags & PKT_TX_TUNNEL_MASK) ? - rxm->outer_l2_len + rxm->outer_l3_len : 0; - paylen = rxm->pkt_len - hdr_len; -- desc->tx.paylen = rte_cpu_to_le_32(paylen); -+ desc->tx.paylen_fd_dop_ol4cs |= rte_cpu_to_le_32(paylen); - hns3_set_tso(desc, paylen, rxm); - - /* -@@ -3204,8 +3204,10 @@ hns3_parse_tunneling_params(struct hns3_tx_queue *txq, struct rte_mbuf *m, - { - struct hns3_desc *tx_ring = txq->tx_ring; - struct hns3_desc *desc = &tx_ring[tx_desc_id]; -+ uint64_t ol_flags = m->ol_flags; - uint32_t tmp_outer = 0; - uint32_t tmp_inner = 0; -+ uint32_t tmp_ol4cs; - int ret; - - /* -@@ -3215,7 +3217,7 @@ hns3_parse_tunneling_params(struct hns3_tx_queue *txq, struct rte_mbuf *m, - * calculations, the length of the L2 header include the outer and - * inner, will be filled during the parsing of tunnel packects. - */ -- if (!(m->ol_flags & PKT_TX_TUNNEL_MASK)) { -+ if (!(ol_flags & PKT_TX_TUNNEL_MASK)) { - /* - * For non tunnel type the tunnel type id is 0, so no need to - * assign a value to it. Only the inner(normal) L2 header length -@@ -3230,7 +3232,8 @@ hns3_parse_tunneling_params(struct hns3_tx_queue *txq, struct rte_mbuf *m, - * inner l2_len. It would lead a cksum error. So driver has to - * calculate the header length. - */ -- if (unlikely(!(m->ol_flags & PKT_TX_OUTER_IP_CKSUM) && -+ if (unlikely(!(ol_flags & -+ (PKT_TX_OUTER_IP_CKSUM | PKT_TX_OUTER_UDP_CKSUM)) && - m->outer_l2_len == 0)) { - struct rte_net_hdr_lens hdr_len; - (void)rte_net_get_ptype(m, &hdr_len, -@@ -3247,6 +3250,9 @@ hns3_parse_tunneling_params(struct hns3_tx_queue *txq, struct rte_mbuf *m, - - desc->tx.ol_type_vlan_len_msec = rte_cpu_to_le_32(tmp_outer); - desc->tx.type_cs_vlan_tso_len = rte_cpu_to_le_32(tmp_inner); -+ tmp_ol4cs = ol_flags & PKT_TX_OUTER_UDP_CKSUM ? -+ BIT(HNS3_TXD_OL4CS_B) : 0; -+ desc->tx.paylen_fd_dop_ol4cs = rte_cpu_to_le_32(tmp_ol4cs); - - return 0; - } -@@ -3376,31 +3382,78 @@ hns3_pkt_need_linearized(struct rte_mbuf *tx_pkts, uint32_t bd_num, - return false; - } - -+static bool -+hns3_outer_ipv4_cksum_prepared(struct rte_mbuf *m, uint64_t ol_flags, -+ uint32_t *l4_proto) -+{ -+ struct rte_ipv4_hdr *ipv4_hdr; -+ ipv4_hdr = rte_pktmbuf_mtod_offset(m, struct rte_ipv4_hdr *, -+ m->outer_l2_len); -+ if (ol_flags & PKT_TX_OUTER_IP_CKSUM) -+ ipv4_hdr->hdr_checksum = 0; -+ if (ol_flags & PKT_TX_OUTER_UDP_CKSUM) { -+ struct rte_udp_hdr *udp_hdr; -+ /* -+ * If OUTER_UDP_CKSUM is support, HW can caclulate the pseudo -+ * header for TSO packets -+ */ -+ if (ol_flags & PKT_TX_TCP_SEG) -+ return true; -+ udp_hdr = rte_pktmbuf_mtod_offset(m, struct rte_udp_hdr *, -+ m->outer_l2_len + m->outer_l3_len); -+ udp_hdr->dgram_cksum = rte_ipv4_phdr_cksum(ipv4_hdr, ol_flags); -+ -+ return true; -+ } -+ *l4_proto = ipv4_hdr->next_proto_id; -+ return false; -+} -+ -+static bool -+hns3_outer_ipv6_cksum_prepared(struct rte_mbuf *m, uint64_t ol_flags, -+ uint32_t *l4_proto) -+{ -+ struct rte_ipv6_hdr *ipv6_hdr; -+ ipv6_hdr = rte_pktmbuf_mtod_offset(m, struct rte_ipv6_hdr *, -+ m->outer_l2_len); -+ if (ol_flags & PKT_TX_OUTER_UDP_CKSUM) { -+ struct rte_udp_hdr *udp_hdr; -+ /* -+ * If OUTER_UDP_CKSUM is support, HW can caclulate the pseudo -+ * header for TSO packets -+ */ -+ if (ol_flags & PKT_TX_TCP_SEG) -+ return true; -+ udp_hdr = rte_pktmbuf_mtod_offset(m, struct rte_udp_hdr *, -+ m->outer_l2_len + m->outer_l3_len); -+ udp_hdr->dgram_cksum = rte_ipv6_phdr_cksum(ipv6_hdr, ol_flags); -+ -+ return true; -+ } -+ *l4_proto = ipv6_hdr->proto; -+ return false; -+} -+ - static void - hns3_outer_header_cksum_prepare(struct rte_mbuf *m) - { - uint64_t ol_flags = m->ol_flags; - uint32_t paylen, hdr_len, l4_proto; -+ struct rte_udp_hdr *udp_hdr; - - if (!(ol_flags & (PKT_TX_OUTER_IPV4 | PKT_TX_OUTER_IPV6))) - return; - - if (ol_flags & PKT_TX_OUTER_IPV4) { -- struct rte_ipv4_hdr *ipv4_hdr; -- ipv4_hdr = rte_pktmbuf_mtod_offset(m, struct rte_ipv4_hdr *, -- m->outer_l2_len); -- l4_proto = ipv4_hdr->next_proto_id; -- if (ol_flags & PKT_TX_OUTER_IP_CKSUM) -- ipv4_hdr->hdr_checksum = 0; -+ if (hns3_outer_ipv4_cksum_prepared(m, ol_flags, &l4_proto)) -+ return; - } else { -- struct rte_ipv6_hdr *ipv6_hdr; -- ipv6_hdr = rte_pktmbuf_mtod_offset(m, struct rte_ipv6_hdr *, -- m->outer_l2_len); -- l4_proto = ipv6_hdr->proto; -+ if (hns3_outer_ipv6_cksum_prepared(m, ol_flags, &l4_proto)) -+ return; - } -+ - /* driver should ensure the outer udp cksum is 0 for TUNNEL TSO */ - if (l4_proto == IPPROTO_UDP && (ol_flags & PKT_TX_TCP_SEG)) { -- struct rte_udp_hdr *udp_hdr; - hdr_len = m->l2_len + m->l3_len + m->l4_len; - hdr_len += m->outer_l2_len + m->outer_l3_len; - paylen = m->pkt_len - hdr_len; -@@ -3686,7 +3739,7 @@ hns3_tx_setup_4bd(struct hns3_desc *txdp, struct rte_mbuf **pkts) - dma_addr = rte_mbuf_data_iova(*pkts); - txdp->addr = rte_cpu_to_le_64(dma_addr); - txdp->tx.send_size = rte_cpu_to_le_16((*pkts)->data_len); -- txdp->tx.paylen = 0; -+ txdp->tx.paylen_fd_dop_ol4cs = 0; - txdp->tx.type_cs_vlan_tso_len = 0; - txdp->tx.ol_type_vlan_len_msec = 0; - txdp->tx.tp_fe_sc_vld_ra_ri = rte_cpu_to_le_16(bd_flag); -@@ -3702,7 +3755,7 @@ hns3_tx_setup_1bd(struct hns3_desc *txdp, struct rte_mbuf **pkts) - dma_addr = rte_mbuf_data_iova(*pkts); - txdp->addr = rte_cpu_to_le_64(dma_addr); - txdp->tx.send_size = rte_cpu_to_le_16((*pkts)->data_len); -- txdp->tx.paylen = 0; -+ txdp->tx.paylen_fd_dop_ol4cs = 0; - txdp->tx.type_cs_vlan_tso_len = 0; - txdp->tx.ol_type_vlan_len_msec = 0; - txdp->tx.tp_fe_sc_vld_ra_ri = rte_cpu_to_le_16(bd_flag); -diff --git a/drivers/net/hns3/hns3_rxtx.h b/drivers/net/hns3/hns3_rxtx.h -index 9adeb24..cd04200 100644 ---- a/drivers/net/hns3/hns3_rxtx.h -+++ b/drivers/net/hns3/hns3_rxtx.h -@@ -149,6 +149,7 @@ - #define HNS3_TXD_MSS_S 0 - #define HNS3_TXD_MSS_M (0x3fff << HNS3_TXD_MSS_S) - -+#define HNS3_TXD_OL4CS_B 22 - #define HNS3_L2_LEN_UNIT 1UL - #define HNS3_L3_LEN_UNIT 2UL - #define HNS3_L4_LEN_UNIT 2UL -@@ -234,7 +235,7 @@ struct hns3_desc { - }; - }; - -- uint32_t paylen; -+ uint32_t paylen_fd_dop_ol4cs; - uint16_t tp_fe_sc_vld_ra_ri; - uint16_t mss; - } tx; -@@ -503,6 +504,7 @@ struct hns3_queue_info { - }; - - #define HNS3_TX_CKSUM_OFFLOAD_MASK ( \ -+ PKT_TX_OUTER_UDP_CKSUM | \ - PKT_TX_OUTER_IP_CKSUM | \ - PKT_TX_IP_CKSUM | \ - PKT_TX_TCP_SEG | \ -diff --git a/drivers/net/hns3/hns3_rxtx_vec_sve.c b/drivers/net/hns3/hns3_rxtx_vec_sve.c -index 947c19f..f6c6f52 100644 ---- a/drivers/net/hns3/hns3_rxtx_vec_sve.c -+++ b/drivers/net/hns3/hns3_rxtx_vec_sve.c -@@ -408,8 +408,9 @@ hns3_tx_fill_hw_ring_sve(struct hns3_tx_queue *txq, - (uint64_t *)&txdp->tx.outer_vlan_tag, - offsets, svdup_n_u64(0)); - /* save offset 24~31byte of every BD */ -- svst1_scatter_u64offset_u64(pg, (uint64_t *)&txdp->tx.paylen, -- offsets, svdup_n_u64(valid_bit)); -+ svst1_scatter_u64offset_u64(pg, -+ (uint64_t *)&txdp->tx.paylen_fd_dop_ol4cs, -+ offsets, svdup_n_u64(valid_bit)); - - /* Increment bytes counter */ - uint32_t idx; --- -2.7.4 - diff --git a/0061-dma-hisilicon-support-Kunpeng-930.patch b/0061-dma-hisilicon-support-Kunpeng-930.patch new file mode 100644 index 0000000000000000000000000000000000000000..4427fa91da7a8deb33e2bb7a942dd79145774a10 --- /dev/null +++ b/0061-dma-hisilicon-support-Kunpeng-930.patch @@ -0,0 +1,182 @@ +From 0ac9cae2d0e1763cf884f0b5d735e4b57b6acb27 Mon Sep 17 00:00:00 2001 +From: Chengwen Feng +Date: Thu, 17 Feb 2022 10:59:07 +0800 +Subject: [PATCH 01/25] dma/hisilicon: support Kunpeng 930 + +The Kunpeng930 DMA devices have the same PCI device id with Kunpeng920, +but with different PCI revision and register layout. This patch +introduces the basic initialization for Kunpeng930 DMA devices. + +Signed-off-by: Chengwen Feng +--- + doc/guides/dmadevs/hisilicon.rst | 1 + + drivers/dma/hisilicon/hisi_dmadev.c | 34 ++++++++++++++++++++++++++--- + drivers/dma/hisilicon/hisi_dmadev.h | 28 +++++++++++++++++++----- + 3 files changed, 54 insertions(+), 9 deletions(-) + +diff --git a/doc/guides/dmadevs/hisilicon.rst b/doc/guides/dmadevs/hisilicon.rst +index 191e56f2f7..81bf090311 100644 +--- a/doc/guides/dmadevs/hisilicon.rst ++++ b/doc/guides/dmadevs/hisilicon.rst +@@ -13,6 +13,7 @@ Supported Kunpeng SoCs + ---------------------- + + * Kunpeng 920 ++* Kunpeng 930 + + + Device Setup +diff --git a/drivers/dma/hisilicon/hisi_dmadev.c b/drivers/dma/hisilicon/hisi_dmadev.c +index 05066b4d0e..d4e08994a8 100644 +--- a/drivers/dma/hisilicon/hisi_dmadev.c ++++ b/drivers/dma/hisilicon/hisi_dmadev.c +@@ -39,6 +39,8 @@ hisi_dma_queue_base(struct hisi_dma_dev *hw) + { + if (hw->reg_layout == HISI_DMA_REG_LAYOUT_HIP08) + return HISI_DMA_HIP08_QUEUE_BASE; ++ else if (hw->reg_layout == HISI_DMA_REG_LAYOUT_HIP09) ++ return HISI_DMA_HIP09_QUEUE_BASE; + else + return 0; + } +@@ -174,7 +176,7 @@ hisi_dma_reset_hw(struct hisi_dma_dev *hw) + } + + static void +-hisi_dma_init_hw(struct hisi_dma_dev *hw) ++hisi_dma_init_common(struct hisi_dma_dev *hw) + { + hisi_dma_write_queue(hw, HISI_DMA_QUEUE_SQ_BASE_L_REG, + lower_32_bits(hw->sqe_iova)); +@@ -192,6 +194,12 @@ hisi_dma_init_hw(struct hisi_dma_dev *hw) + hisi_dma_write_queue(hw, HISI_DMA_QUEUE_ERR_INT_NUM0_REG, 0); + hisi_dma_write_queue(hw, HISI_DMA_QUEUE_ERR_INT_NUM1_REG, 0); + hisi_dma_write_queue(hw, HISI_DMA_QUEUE_ERR_INT_NUM2_REG, 0); ++} ++ ++static void ++hisi_dma_init_hw(struct hisi_dma_dev *hw) ++{ ++ hisi_dma_init_common(hw); + + if (hw->reg_layout == HISI_DMA_REG_LAYOUT_HIP08) { + hisi_dma_write_queue(hw, HISI_DMA_HIP08_QUEUE_ERR_INT_NUM3_REG, +@@ -206,9 +214,27 @@ hisi_dma_init_hw(struct hisi_dma_dev *hw) + HISI_DMA_HIP08_QUEUE_CTRL0_ERR_ABORT_B, false); + hisi_dma_update_queue_mbit(hw, HISI_DMA_QUEUE_INT_STATUS_REG, + HISI_DMA_HIP08_QUEUE_INT_MASK_M, true); +- hisi_dma_update_queue_mbit(hw, +- HISI_DMA_HIP08_QUEUE_INT_MASK_REG, ++ hisi_dma_update_queue_mbit(hw, HISI_DMA_QUEUE_INT_MASK_REG, + HISI_DMA_HIP08_QUEUE_INT_MASK_M, true); ++ } else if (hw->reg_layout == HISI_DMA_REG_LAYOUT_HIP09) { ++ hisi_dma_update_queue_mbit(hw, HISI_DMA_QUEUE_CTRL0_REG, ++ HISI_DMA_HIP09_QUEUE_CTRL0_ERR_ABORT_M, false); ++ hisi_dma_update_queue_mbit(hw, HISI_DMA_QUEUE_INT_STATUS_REG, ++ HISI_DMA_HIP09_QUEUE_INT_MASK_M, true); ++ hisi_dma_update_queue_mbit(hw, HISI_DMA_QUEUE_INT_MASK_REG, ++ HISI_DMA_HIP09_QUEUE_INT_MASK_M, true); ++ hisi_dma_update_queue_mbit(hw, ++ HISI_DMA_HIP09_QUEUE_ERR_INT_STATUS_REG, ++ HISI_DMA_HIP09_QUEUE_ERR_INT_MASK_M, true); ++ hisi_dma_update_queue_mbit(hw, ++ HISI_DMA_HIP09_QUEUE_ERR_INT_MASK_REG, ++ HISI_DMA_HIP09_QUEUE_ERR_INT_MASK_M, true); ++ hisi_dma_update_queue_bit(hw, HISI_DMA_QUEUE_CTRL1_REG, ++ HISI_DMA_HIP09_QUEUE_CTRL1_VA_ENABLE_B, true); ++ hisi_dma_update_bit(hw, ++ HISI_DMA_HIP09_QUEUE_CFG_REG(hw->queue_id), ++ HISI_DMA_HIP09_QUEUE_CFG_LINK_DOWN_MASK_B, ++ true); + } + } + +@@ -230,6 +256,8 @@ hisi_dma_reg_layout(uint8_t revision) + { + if (revision == HISI_DMA_REVISION_HIP08B) + return HISI_DMA_REG_LAYOUT_HIP08; ++ else if (revision >= HISI_DMA_REVISION_HIP09A) ++ return HISI_DMA_REG_LAYOUT_HIP09; + else + return HISI_DMA_REG_LAYOUT_INVALID; + } +diff --git a/drivers/dma/hisilicon/hisi_dmadev.h b/drivers/dma/hisilicon/hisi_dmadev.h +index 12e209c86e..591aec0b32 100644 +--- a/drivers/dma/hisilicon/hisi_dmadev.h ++++ b/drivers/dma/hisilicon/hisi_dmadev.h +@@ -23,20 +23,22 @@ + #define HISI_DMA_DEVICE_ID 0xA122 + #define HISI_DMA_PCI_REVISION_ID_REG 0x08 + #define HISI_DMA_REVISION_HIP08B 0x21 ++#define HISI_DMA_REVISION_HIP09A 0x30 + + #define HISI_DMA_MAX_HW_QUEUES 4 + #define HISI_DMA_MAX_DESC_NUM 8192 + #define HISI_DMA_MIN_DESC_NUM 32 + + /** +- * The HIP08B(HiSilicon IP08) and later Chip(e.g. HiSilicon IP09) are DMA iEPs, +- * they have the same pci device id but with different pci revision. +- * Unfortunately, they have different register layouts, so the layout ++ * The HIP08B(HiSilicon IP08) and HIP09B(HiSilicon IP09) are DMA iEPs, they ++ * have the same pci device id but different pci revision. ++ * Unfortunately, they have different register layouts, so two layout + * enumerations are defined. + */ + enum { + HISI_DMA_REG_LAYOUT_INVALID = 0, +- HISI_DMA_REG_LAYOUT_HIP08 ++ HISI_DMA_REG_LAYOUT_HIP08, ++ HISI_DMA_REG_LAYOUT_HIP09 + }; + + /** +@@ -66,7 +68,7 @@ enum { + * calculated by: + * offset = queue-base + (queue-id * queue-region) + reg-offset-in-region. + * +- * The first part of queue region is basically the same for HIP08 and later chip ++ * The first part of queue region is basically the same for HIP08 and HIP09 + * register layouts, therefore, HISI_QUEUE_* registers are defined for it. + */ + #define HISI_DMA_QUEUE_SQ_BASE_L_REG 0x0 +@@ -85,6 +87,7 @@ enum { + #define HISI_DMA_QUEUE_FSM_REG 0x30 + #define HISI_DMA_QUEUE_FSM_STS_M GENMASK(3, 0) + #define HISI_DMA_QUEUE_INT_STATUS_REG 0x40 ++#define HISI_DMA_QUEUE_INT_MASK_REG 0x44 + #define HISI_DMA_QUEUE_ERR_INT_NUM0_REG 0x84 + #define HISI_DMA_QUEUE_ERR_INT_NUM1_REG 0x88 + #define HISI_DMA_QUEUE_ERR_INT_NUM2_REG 0x8C +@@ -95,7 +98,6 @@ enum { + */ + #define HISI_DMA_HIP08_QUEUE_BASE 0x0 + #define HISI_DMA_HIP08_QUEUE_CTRL0_ERR_ABORT_B 2 +-#define HISI_DMA_HIP08_QUEUE_INT_MASK_REG 0x44 + #define HISI_DMA_HIP08_QUEUE_INT_MASK_M GENMASK(14, 0) + #define HISI_DMA_HIP08_QUEUE_ERR_INT_NUM3_REG 0x90 + #define HISI_DMA_HIP08_QUEUE_ERR_INT_NUM4_REG 0x94 +@@ -106,6 +108,20 @@ enum { + #define HISI_DMA_HIP08_DUMP_START_REG 0x2000 + #define HISI_DMA_HIP08_DUMP_END_REG 0x2280 + ++/** ++ * HiSilicon IP09 DMA register and field define: ++ */ ++#define HISI_DMA_HIP09_QUEUE_BASE 0x2000 ++#define HISI_DMA_HIP09_QUEUE_CTRL0_ERR_ABORT_M GENMASK(31, 28) ++#define HISI_DMA_HIP09_QUEUE_CTRL1_VA_ENABLE_B 2 ++#define HISI_DMA_HIP09_QUEUE_INT_MASK_M 0x1 ++#define HISI_DMA_HIP09_QUEUE_ERR_INT_STATUS_REG 0x48 ++#define HISI_DMA_HIP09_QUEUE_ERR_INT_MASK_REG 0x4C ++#define HISI_DMA_HIP09_QUEUE_ERR_INT_MASK_M GENMASK(18, 1) ++#define HISI_DMA_HIP09_QUEUE_CFG_REG(queue_id) (0x800 + \ ++ (queue_id) * 0x20) ++#define HISI_DMA_HIP09_QUEUE_CFG_LINK_DOWN_MASK_B 16 ++ + /** + * In fact, there are multiple states, but it need to pay attention to + * the following two states for the driver: +-- +2.30.0 + diff --git a/0061-net-hns3-adjust-format-of-RAS-related-structures.patch b/0061-net-hns3-adjust-format-of-RAS-related-structures.patch deleted file mode 100644 index c7ff1b7541439e55ae9b53b76266fd3449f15b20..0000000000000000000000000000000000000000 --- a/0061-net-hns3-adjust-format-of-RAS-related-structures.patch +++ /dev/null @@ -1,2251 +0,0 @@ -From 8d96829c74a9177cd4958c25946ae7ccf3db1957 Mon Sep 17 00:00:00 2001 -From: Hongbo Zheng -Date: Tue, 23 Mar 2021 19:21:02 +0800 -Subject: [PATCH 061/189] net/hns3: adjust format of RAS related structures - -Adjust the format of hns3 RAS related structures to resolve -the static check warnings. - -Signed-off-by: Hongbo Zheng -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_intr.c | 2126 ++++++++++++++++++++++++------------------ - 1 file changed, 1224 insertions(+), 902 deletions(-) - -diff --git a/drivers/net/hns3/hns3_intr.c b/drivers/net/hns3/hns3_intr.c -index 2563504..265dae8 100644 ---- a/drivers/net/hns3/hns3_intr.c -+++ b/drivers/net/hns3/hns3_intr.c -@@ -28,282 +28,375 @@ static const char *reset_string[HNS3_MAX_RESET] = { - }; - - static const struct hns3_hw_error mac_afifo_tnl_int[] = { -- { .int_msk = BIT(0), -- .msg = "egu_cge_afifo_ecc_1bit_err", -- .reset_level = HNS3_NONE_RESET }, -- { .int_msk = BIT(1), -- .msg = "egu_cge_afifo_ecc_mbit_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(2), -- .msg = "egu_lge_afifo_ecc_1bit_err", -- .reset_level = HNS3_NONE_RESET }, -- { .int_msk = BIT(3), -- .msg = "egu_lge_afifo_ecc_mbit_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(4), -- .msg = "cge_igu_afifo_ecc_1bit_err", -- .reset_level = HNS3_NONE_RESET }, -- { .int_msk = BIT(5), -- .msg = "cge_igu_afifo_ecc_mbit_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(6), -- .msg = "lge_igu_afifo_ecc_1bit_err", -- .reset_level = HNS3_NONE_RESET }, -- { .int_msk = BIT(7), -- .msg = "lge_igu_afifo_ecc_mbit_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(8), -- .msg = "cge_igu_afifo_overflow_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(9), -- .msg = "lge_igu_afifo_overflow_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(10), -- .msg = "egu_cge_afifo_underrun_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(11), -- .msg = "egu_lge_afifo_underrun_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(12), -- .msg = "egu_ge_afifo_underrun_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(13), -- .msg = "ge_igu_afifo_overflow_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = 0, -- .msg = NULL, -- .reset_level = HNS3_NONE_RESET} -+ { -+ .int_msk = BIT(0), -+ .msg = "egu_cge_afifo_ecc_1bit_err", -+ .reset_level = HNS3_NONE_RESET -+ }, { -+ .int_msk = BIT(1), -+ .msg = "egu_cge_afifo_ecc_mbit_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(2), -+ .msg = "egu_lge_afifo_ecc_1bit_err", -+ .reset_level = HNS3_NONE_RESET -+ }, { -+ .int_msk = BIT(3), -+ .msg = "egu_lge_afifo_ecc_mbit_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(4), -+ .msg = "cge_igu_afifo_ecc_1bit_err", -+ .reset_level = HNS3_NONE_RESET -+ }, { -+ .int_msk = BIT(5), -+ .msg = "cge_igu_afifo_ecc_mbit_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(6), -+ .msg = "lge_igu_afifo_ecc_1bit_err", -+ .reset_level = HNS3_NONE_RESET -+ }, { -+ .int_msk = BIT(7), -+ .msg = "lge_igu_afifo_ecc_mbit_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(8), -+ .msg = "cge_igu_afifo_overflow_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(9), -+ .msg = "lge_igu_afifo_overflow_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(10), -+ .msg = "egu_cge_afifo_underrun_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(11), -+ .msg = "egu_lge_afifo_underrun_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(12), -+ .msg = "egu_ge_afifo_underrun_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(13), -+ .msg = "ge_igu_afifo_overflow_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = 0, -+ .msg = NULL, -+ .reset_level = HNS3_NONE_RESET -+ } - }; - - static const struct hns3_hw_error ppu_mpf_abnormal_int_st1[] = { -- { .int_msk = 0xFFFFFFFF, -- .msg = "rpu_rx_pkt_ecc_mbit_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = 0, -- .msg = NULL, -- .reset_level = HNS3_NONE_RESET} -+ { -+ .int_msk = 0xFFFFFFFF, -+ .msg = "rpu_rx_pkt_ecc_mbit_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = 0, -+ .msg = NULL, -+ .reset_level = HNS3_NONE_RESET -+ } - }; - - static const struct hns3_hw_error ppu_mpf_abnormal_int_st2_ras[] = { -- { .int_msk = BIT(13), -- .msg = "rpu_rx_pkt_bit32_ecc_mbit_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(14), -- .msg = "rpu_rx_pkt_bit33_ecc_mbit_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(15), -- .msg = "rpu_rx_pkt_bit34_ecc_mbit_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(16), -- .msg = "rpu_rx_pkt_bit35_ecc_mbit_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(17), -- .msg = "rcb_tx_ring_ecc_mbit_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(18), -- .msg = "rcb_rx_ring_ecc_mbit_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(19), -- .msg = "rcb_tx_fbd_ecc_mbit_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(20), -- .msg = "rcb_rx_ebd_ecc_mbit_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(21), -- .msg = "rcb_tso_info_ecc_mbit_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(22), -- .msg = "rcb_tx_int_info_ecc_mbit_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(23), -- .msg = "rcb_rx_int_info_ecc_mbit_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(24), -- .msg = "tpu_tx_pkt_0_ecc_mbit_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(25), -- .msg = "tpu_tx_pkt_1_ecc_mbit_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(26), -- .msg = "rd_bus_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(27), -- .msg = "wr_bus_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(30), -- .msg = "ooo_ecc_err_detect", -- .reset_level = HNS3_NONE_RESET }, -- { .int_msk = BIT(31), -- .msg = "ooo_ecc_err_multpl", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = 0, -- .msg = NULL, -- .reset_level = HNS3_NONE_RESET} -+ { -+ .int_msk = BIT(13), -+ .msg = "rpu_rx_pkt_bit32_ecc_mbit_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(14), -+ .msg = "rpu_rx_pkt_bit33_ecc_mbit_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(15), -+ .msg = "rpu_rx_pkt_bit34_ecc_mbit_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(16), -+ .msg = "rpu_rx_pkt_bit35_ecc_mbit_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(17), -+ .msg = "rcb_tx_ring_ecc_mbit_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(18), -+ .msg = "rcb_rx_ring_ecc_mbit_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(19), -+ .msg = "rcb_tx_fbd_ecc_mbit_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(20), -+ .msg = "rcb_rx_ebd_ecc_mbit_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(21), -+ .msg = "rcb_tso_info_ecc_mbit_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(22), -+ .msg = "rcb_tx_int_info_ecc_mbit_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(23), -+ .msg = "rcb_rx_int_info_ecc_mbit_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(24), -+ .msg = "tpu_tx_pkt_0_ecc_mbit_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(25), -+ .msg = "tpu_tx_pkt_1_ecc_mbit_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(26), -+ .msg = "rd_bus_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(27), -+ .msg = "wr_bus_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(30), -+ .msg = "ooo_ecc_err_detect", -+ .reset_level = HNS3_NONE_RESET -+ }, { -+ .int_msk = BIT(31), -+ .msg = "ooo_ecc_err_multpl", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = 0, -+ .msg = NULL, -+ .reset_level = HNS3_NONE_RESET -+ } - }; - - static const struct hns3_hw_error ppu_mpf_abnormal_int_st2_msix[] = { -- { .int_msk = BIT(29), -- .msg = "rx_q_search_miss", -- .reset_level = HNS3_NONE_RESET }, -- { .int_msk = 0, -- .msg = NULL, -- .reset_level = HNS3_NONE_RESET} -+ { -+ .int_msk = BIT(29), -+ .msg = "rx_q_search_miss", -+ .reset_level = HNS3_NONE_RESET -+ }, { -+ .int_msk = 0, -+ .msg = NULL, -+ .reset_level = HNS3_NONE_RESET -+ } - }; - - static const struct hns3_hw_error ssu_port_based_pf_int[] = { -- { .int_msk = BIT(0), -- .msg = "roc_pkt_without_key_port", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(9), -- .msg = "low_water_line_err_port", -- .reset_level = HNS3_NONE_RESET }, -- { .int_msk = 0, -- .msg = NULL, -- .reset_level = HNS3_NONE_RESET} -+ { -+ .int_msk = BIT(0), -+ .msg = "roc_pkt_without_key_port", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(9), -+ .msg = "low_water_line_err_port", -+ .reset_level = HNS3_NONE_RESET -+ }, { -+ .int_msk = 0, -+ .msg = NULL, -+ .reset_level = HNS3_NONE_RESET -+ } - }; - - static const struct hns3_hw_error ppp_pf_abnormal_int[] = { -- { .int_msk = BIT(0), -- .msg = "tx_vlan_tag_err", -- .reset_level = HNS3_NONE_RESET }, -- { .int_msk = BIT(1), -- .msg = "rss_list_tc_unassigned_queue_err", -- .reset_level = HNS3_NONE_RESET }, -- { .int_msk = 0, -- .msg = NULL, -- .reset_level = HNS3_NONE_RESET} -+ { -+ .int_msk = BIT(0), -+ .msg = "tx_vlan_tag_err", -+ .reset_level = HNS3_NONE_RESET -+ }, { -+ .int_msk = BIT(1), -+ .msg = "rss_list_tc_unassigned_queue_err", -+ .reset_level = HNS3_NONE_RESET -+ }, { -+ .int_msk = 0, -+ .msg = NULL, -+ .reset_level = HNS3_NONE_RESET -+ } - }; - - static const struct hns3_hw_error ppu_pf_abnormal_int_ras[] = { -- { .int_msk = BIT(3), -- .msg = "tx_rd_fbd_poison", -- .reset_level = HNS3_FUNC_RESET }, -- { .int_msk = BIT(4), -- .msg = "rx_rd_ebd_poison", -- .reset_level = HNS3_FUNC_RESET }, -- { .int_msk = 0, -- .msg = NULL, -- .reset_level = HNS3_NONE_RESET} -+ { -+ .int_msk = BIT(3), -+ .msg = "tx_rd_fbd_poison", -+ .reset_level = HNS3_FUNC_RESET -+ }, { -+ .int_msk = BIT(4), -+ .msg = "rx_rd_ebd_poison", -+ .reset_level = HNS3_FUNC_RESET -+ }, { -+ .int_msk = 0, -+ .msg = NULL, -+ .reset_level = HNS3_NONE_RESET -+ } - }; - - static const struct hns3_hw_error ppu_pf_abnormal_int_msix[] = { -- { .int_msk = BIT(0), -- .msg = "over_8bd_no_fe", -- .reset_level = HNS3_FUNC_RESET }, -- { .int_msk = BIT(1), -- .msg = "tso_mss_cmp_min_err", -- .reset_level = HNS3_NONE_RESET }, -- { .int_msk = BIT(2), -- .msg = "tso_mss_cmp_max_err", -- .reset_level = HNS3_NONE_RESET }, -- { .int_msk = BIT(5), -- .msg = "buf_wait_timeout", -- .reset_level = HNS3_NONE_RESET }, -- { .int_msk = 0, -- .msg = NULL, -- .reset_level = HNS3_NONE_RESET} -+ { -+ .int_msk = BIT(0), -+ .msg = "over_8bd_no_fe", -+ .reset_level = HNS3_FUNC_RESET -+ }, { -+ .int_msk = BIT(1), -+ .msg = "tso_mss_cmp_min_err", -+ .reset_level = HNS3_NONE_RESET -+ }, { -+ .int_msk = BIT(2), -+ .msg = "tso_mss_cmp_max_err", -+ .reset_level = HNS3_NONE_RESET -+ }, { -+ .int_msk = BIT(5), -+ .msg = "buf_wait_timeout", -+ .reset_level = HNS3_NONE_RESET -+ }, { -+ .int_msk = 0, -+ .msg = NULL, -+ .reset_level = HNS3_NONE_RESET -+ } - }; - - static const struct hns3_hw_error imp_tcm_ecc_int[] = { -- { .int_msk = BIT(1), -- .msg = "imp_itcm0_ecc_mbit_err", -- .reset_level = HNS3_NONE_RESET }, -- { .int_msk = BIT(3), -- .msg = "imp_itcm1_ecc_mbit_err", -- .reset_level = HNS3_NONE_RESET }, -- { .int_msk = BIT(5), -- .msg = "imp_itcm2_ecc_mbit_err", -- .reset_level = HNS3_NONE_RESET }, -- { .int_msk = BIT(7), -- .msg = "imp_itcm3_ecc_mbit_err", -- .reset_level = HNS3_NONE_RESET }, -- { .int_msk = BIT(9), -- .msg = "imp_dtcm0_mem0_ecc_mbit_err", -- .reset_level = HNS3_NONE_RESET }, -- { .int_msk = BIT(11), -- .msg = "imp_dtcm0_mem1_ecc_mbit_err", -- .reset_level = HNS3_NONE_RESET }, -- { .int_msk = BIT(13), -- .msg = "imp_dtcm1_mem0_ecc_mbit_err", -- .reset_level = HNS3_NONE_RESET }, -- { .int_msk = BIT(15), -- .msg = "imp_dtcm1_mem1_ecc_mbit_err", -- .reset_level = HNS3_NONE_RESET }, -- { .int_msk = BIT(17), -- .msg = "imp_itcm4_ecc_mbit_err", -- .reset_level = HNS3_NONE_RESET }, -- { .int_msk = 0, -- .msg = NULL, -- .reset_level = HNS3_NONE_RESET} -+ { -+ .int_msk = BIT(1), -+ .msg = "imp_itcm0_ecc_mbit_err", -+ .reset_level = HNS3_NONE_RESET -+ }, { -+ .int_msk = BIT(3), -+ .msg = "imp_itcm1_ecc_mbit_err", -+ .reset_level = HNS3_NONE_RESET -+ }, { -+ .int_msk = BIT(5), -+ .msg = "imp_itcm2_ecc_mbit_err", -+ .reset_level = HNS3_NONE_RESET -+ }, { -+ .int_msk = BIT(7), -+ .msg = "imp_itcm3_ecc_mbit_err", -+ .reset_level = HNS3_NONE_RESET -+ }, { -+ .int_msk = BIT(9), -+ .msg = "imp_dtcm0_mem0_ecc_mbit_err", -+ .reset_level = HNS3_NONE_RESET -+ }, { -+ .int_msk = BIT(11), -+ .msg = "imp_dtcm0_mem1_ecc_mbit_err", -+ .reset_level = HNS3_NONE_RESET -+ }, { -+ .int_msk = BIT(13), -+ .msg = "imp_dtcm1_mem0_ecc_mbit_err", -+ .reset_level = HNS3_NONE_RESET -+ }, { -+ .int_msk = BIT(15), -+ .msg = "imp_dtcm1_mem1_ecc_mbit_err", -+ .reset_level = HNS3_NONE_RESET -+ }, { -+ .int_msk = BIT(17), -+ .msg = "imp_itcm4_ecc_mbit_err", -+ .reset_level = HNS3_NONE_RESET -+ }, { -+ .int_msk = 0, -+ .msg = NULL, -+ .reset_level = HNS3_NONE_RESET -+ } - }; - - static const struct hns3_hw_error cmdq_mem_ecc_int[] = { -- { .int_msk = BIT(1), -- .msg = "cmdq_nic_rx_depth_ecc_mbit_err", -- .reset_level = HNS3_NONE_RESET }, -- { .int_msk = BIT(3), -- .msg = "cmdq_nic_tx_depth_ecc_mbit_err", -- .reset_level = HNS3_NONE_RESET }, -- { .int_msk = BIT(5), -- .msg = "cmdq_nic_rx_tail_ecc_mbit_err", -- .reset_level = HNS3_NONE_RESET }, -- { .int_msk = BIT(7), -- .msg = "cmdq_nic_tx_tail_ecc_mbit_err", -- .reset_level = HNS3_NONE_RESET }, -- { .int_msk = BIT(9), -- .msg = "cmdq_nic_rx_head_ecc_mbit_err", -- .reset_level = HNS3_NONE_RESET }, -- { .int_msk = BIT(11), -- .msg = "cmdq_nic_tx_head_ecc_mbit_err", -- .reset_level = HNS3_NONE_RESET }, -- { .int_msk = BIT(13), -- .msg = "cmdq_nic_rx_addr_ecc_mbit_err", -- .reset_level = HNS3_NONE_RESET }, -- { .int_msk = BIT(15), -- .msg = "cmdq_nic_tx_addr_ecc_mbit_err", -- .reset_level = HNS3_NONE_RESET }, -- { .int_msk = 0, -- .msg = NULL, -- .reset_level = HNS3_NONE_RESET} -+ { -+ .int_msk = BIT(1), -+ .msg = "cmdq_nic_rx_depth_ecc_mbit_err", -+ .reset_level = HNS3_NONE_RESET -+ }, { -+ .int_msk = BIT(3), -+ .msg = "cmdq_nic_tx_depth_ecc_mbit_err", -+ .reset_level = HNS3_NONE_RESET -+ }, { -+ .int_msk = BIT(5), -+ .msg = "cmdq_nic_rx_tail_ecc_mbit_err", -+ .reset_level = HNS3_NONE_RESET -+ }, { -+ .int_msk = BIT(7), -+ .msg = "cmdq_nic_tx_tail_ecc_mbit_err", -+ .reset_level = HNS3_NONE_RESET -+ }, { -+ .int_msk = BIT(9), -+ .msg = "cmdq_nic_rx_head_ecc_mbit_err", -+ .reset_level = HNS3_NONE_RESET -+ }, { -+ .int_msk = BIT(11), -+ .msg = "cmdq_nic_tx_head_ecc_mbit_err", -+ .reset_level = HNS3_NONE_RESET -+ }, { -+ .int_msk = BIT(13), -+ .msg = "cmdq_nic_rx_addr_ecc_mbit_err", -+ .reset_level = HNS3_NONE_RESET -+ }, { -+ .int_msk = BIT(15), -+ .msg = "cmdq_nic_tx_addr_ecc_mbit_err", -+ .reset_level = HNS3_NONE_RESET -+ }, { -+ .int_msk = 0, -+ .msg = NULL, -+ .reset_level = HNS3_NONE_RESET -+ } - }; - - static const struct hns3_hw_error tqp_int_ecc_int[] = { -- { .int_msk = BIT(6), -- .msg = "tqp_int_cfg_even_ecc_mbit_err", -- .reset_level = HNS3_NONE_RESET }, -- { .int_msk = BIT(7), -- .msg = "tqp_int_cfg_odd_ecc_mbit_err", -- .reset_level = HNS3_NONE_RESET }, -- { .int_msk = BIT(8), -- .msg = "tqp_int_ctrl_even_ecc_mbit_err", -- .reset_level = HNS3_NONE_RESET }, -- { .int_msk = BIT(9), -- .msg = "tqp_int_ctrl_odd_ecc_mbit_err", -- .reset_level = HNS3_NONE_RESET }, -- { .int_msk = BIT(10), -- .msg = "tx_queue_scan_int_ecc_mbit_err", -- .reset_level = HNS3_NONE_RESET }, -- { .int_msk = BIT(11), -- .msg = "rx_queue_scan_int_ecc_mbit_err", -- .reset_level = HNS3_NONE_RESET }, -- { .int_msk = 0, -- .msg = NULL, -- .reset_level = HNS3_NONE_RESET} -+ { -+ .int_msk = BIT(6), -+ .msg = "tqp_int_cfg_even_ecc_mbit_err", -+ .reset_level = HNS3_NONE_RESET -+ }, { -+ .int_msk = BIT(7), -+ .msg = "tqp_int_cfg_odd_ecc_mbit_err", -+ .reset_level = HNS3_NONE_RESET -+ }, { -+ .int_msk = BIT(8), -+ .msg = "tqp_int_ctrl_even_ecc_mbit_err", -+ .reset_level = HNS3_NONE_RESET -+ }, { -+ .int_msk = BIT(9), -+ .msg = "tqp_int_ctrl_odd_ecc_mbit_err", -+ .reset_level = HNS3_NONE_RESET -+ }, { -+ .int_msk = BIT(10), -+ .msg = "tx_queue_scan_int_ecc_mbit_err", -+ .reset_level = HNS3_NONE_RESET -+ }, { -+ .int_msk = BIT(11), -+ .msg = "rx_queue_scan_int_ecc_mbit_err", -+ .reset_level = HNS3_NONE_RESET -+ }, { -+ .int_msk = 0, -+ .msg = NULL, -+ .reset_level = HNS3_NONE_RESET -+ } - }; - - static const struct hns3_hw_error imp_rd_poison_int[] = { -- { .int_msk = BIT(0), -- .msg = "imp_rd_poison_int", -- .reset_level = HNS3_NONE_RESET }, -- { .int_msk = 0, -- .msg = NULL, -- .reset_level = HNS3_NONE_RESET} -+ { -+ .int_msk = BIT(0), -+ .msg = "imp_rd_poison_int", -+ .reset_level = HNS3_NONE_RESET -+ }, { -+ .int_msk = 0, -+ .msg = NULL, -+ .reset_level = HNS3_NONE_RESET -+ } - }; - - #define HNS3_SSU_MEM_ECC_ERR(x) \ -- { .int_msk = BIT(x), \ -- .msg = "ssu_mem" #x "_ecc_mbit_err", \ -- .reset_level = HNS3_GLOBAL_RESET } -+{ \ -+ .int_msk = BIT(x), \ -+ .msg = "ssu_mem" #x "_ecc_mbit_err", \ -+ .reset_level = HNS3_GLOBAL_RESET \ -+} - - static const struct hns3_hw_error ssu_ecc_multi_bit_int_0[] = { - HNS3_SSU_MEM_ECC_ERR(0), -@@ -344,722 +437,951 @@ static const struct hns3_hw_error ssu_ecc_multi_bit_int_0[] = { - }; - - static const struct hns3_hw_error ssu_ecc_multi_bit_int_1[] = { -- { .int_msk = BIT(0), -- .msg = "ssu_mem32_ecc_mbit_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = 0, -- .msg = NULL, -- .reset_level = HNS3_NONE_RESET} -+ { -+ .int_msk = BIT(0), -+ .msg = "ssu_mem32_ecc_mbit_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = 0, -+ .msg = NULL, -+ .reset_level = HNS3_NONE_RESET -+ } - }; - - static const struct hns3_hw_error ssu_common_ecc_int[] = { -- { .int_msk = BIT(0), -- .msg = "buf_sum_err", -- .reset_level = HNS3_NONE_RESET }, -- { .int_msk = BIT(1), -- .msg = "ppp_mb_num_err", -- .reset_level = HNS3_NONE_RESET }, -- { .int_msk = BIT(2), -- .msg = "ppp_mbid_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(3), -- .msg = "ppp_rlt_mac_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(4), -- .msg = "ppp_rlt_host_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(5), -- .msg = "cks_edit_position_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(6), -- .msg = "cks_edit_condition_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(7), -- .msg = "vlan_edit_condition_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(8), -- .msg = "vlan_num_ot_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(9), -- .msg = "vlan_num_in_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = 0, -- .msg = NULL, -- .reset_level = HNS3_NONE_RESET} -+ { -+ .int_msk = BIT(0), -+ .msg = "buf_sum_err", -+ .reset_level = HNS3_NONE_RESET -+ }, { -+ .int_msk = BIT(1), -+ .msg = "ppp_mb_num_err", -+ .reset_level = HNS3_NONE_RESET -+ }, { -+ .int_msk = BIT(2), -+ .msg = "ppp_mbid_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(3), -+ .msg = "ppp_rlt_mac_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(4), -+ .msg = "ppp_rlt_host_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(5), -+ .msg = "cks_edit_position_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(6), -+ .msg = "cks_edit_condition_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(7), -+ .msg = "vlan_edit_condition_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(8), -+ .msg = "vlan_num_ot_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(9), -+ .msg = "vlan_num_in_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = 0, -+ .msg = NULL, -+ .reset_level = HNS3_NONE_RESET -+ } - }; - - static const struct hns3_hw_error igu_int[] = { -- { .int_msk = BIT(0), -- .msg = "igu_rx_buf0_ecc_mbit_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(2), -- .msg = "igu_rx_buf1_ecc_mbit_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = 0, -- .msg = NULL, -- .reset_level = HNS3_NONE_RESET} -+ { -+ .int_msk = BIT(0), -+ .msg = "igu_rx_buf0_ecc_mbit_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(2), -+ .msg = "igu_rx_buf1_ecc_mbit_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = 0, -+ .msg = NULL, -+ .reset_level = HNS3_NONE_RESET -+ } - }; - - static const struct hns3_hw_error msix_ecc_int[] = { -- { .int_msk = BIT(1), -- .msg = "msix_nic_ecc_mbit_err", -- .reset_level = HNS3_NONE_RESET }, -- { .int_msk = 0, -- .msg = NULL, -- .reset_level = HNS3_NONE_RESET} -+ { -+ .int_msk = BIT(1), -+ .msg = "msix_nic_ecc_mbit_err", -+ .reset_level = HNS3_NONE_RESET -+ }, { -+ .int_msk = 0, -+ .msg = NULL, -+ .reset_level = HNS3_NONE_RESET -+ } - }; - - static const struct hns3_hw_error ppp_mpf_abnormal_int_st1[] = { -- { .int_msk = BIT(0), -- .msg = "vf_vlan_ad_mem_ecc_mbit_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(1), -- .msg = "umv_mcast_group_mem_ecc_mbit_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(2), -- .msg = "umv_key_mem0_ecc_mbit_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(3), -- .msg = "umv_key_mem1_ecc_mbit_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(4), -- .msg = "umv_key_mem2_ecc_mbit_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(5), -- .msg = "umv_key_mem3_ecc_mbit_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(6), -- .msg = "umv_ad_mem_ecc_mbit_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(7), -- .msg = "rss_tc_mode_mem_ecc_mbit_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(8), -- .msg = "rss_idt_mem0_ecc_mbit_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(9), -- .msg = "rss_idt_mem1_ecc_mbit_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(10), -- .msg = "rss_idt_mem2_ecc_mbit_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(11), -- .msg = "rss_idt_mem3_ecc_mbit_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(12), -- .msg = "rss_idt_mem4_ecc_mbit_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(13), -- .msg = "rss_idt_mem5_ecc_mbit_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(14), -- .msg = "rss_idt_mem6_ecc_mbit_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(15), -- .msg = "rss_idt_mem7_ecc_mbit_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(16), -- .msg = "rss_idt_mem8_ecc_mbit_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(17), -- .msg = "rss_idt_mem9_ecc_mbit_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(18), -- .msg = "rss_idt_mem10_ecc_m1bit_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(19), -- .msg = "rss_idt_mem11_ecc_mbit_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(20), -- .msg = "rss_idt_mem12_ecc_mbit_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(21), -- .msg = "rss_idt_mem13_ecc_mbit_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(22), -- .msg = "rss_idt_mem14_ecc_mbit_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(23), -- .msg = "rss_idt_mem15_ecc_mbit_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(24), -- .msg = "port_vlan_mem_ecc_mbit_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(25), -- .msg = "mcast_linear_table_mem_ecc_mbit_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(26), -- .msg = "mcast_result_mem_ecc_mbit_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(27), -- .msg = "flow_director_ad_mem0_ecc_mbit_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(28), -- .msg = "flow_director_ad_mem1_ecc_mbit_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(29), -- .msg = "rx_vlan_tag_memory_ecc_mbit_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(30), -- .msg = "Tx_UP_mapping_config_mem_ecc_mbit_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = 0, -- .msg = NULL, -- .reset_level = HNS3_NONE_RESET} -+ { -+ .int_msk = BIT(0), -+ .msg = "vf_vlan_ad_mem_ecc_mbit_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(1), -+ .msg = "umv_mcast_group_mem_ecc_mbit_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(2), -+ .msg = "umv_key_mem0_ecc_mbit_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(3), -+ .msg = "umv_key_mem1_ecc_mbit_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(4), -+ .msg = "umv_key_mem2_ecc_mbit_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(5), -+ .msg = "umv_key_mem3_ecc_mbit_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(6), -+ .msg = "umv_ad_mem_ecc_mbit_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(7), -+ .msg = "rss_tc_mode_mem_ecc_mbit_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(8), -+ .msg = "rss_idt_mem0_ecc_mbit_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(9), -+ .msg = "rss_idt_mem1_ecc_mbit_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(10), -+ .msg = "rss_idt_mem2_ecc_mbit_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(11), -+ .msg = "rss_idt_mem3_ecc_mbit_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(12), -+ .msg = "rss_idt_mem4_ecc_mbit_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(13), -+ .msg = "rss_idt_mem5_ecc_mbit_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(14), -+ .msg = "rss_idt_mem6_ecc_mbit_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(15), -+ .msg = "rss_idt_mem7_ecc_mbit_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(16), -+ .msg = "rss_idt_mem8_ecc_mbit_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(17), -+ .msg = "rss_idt_mem9_ecc_mbit_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(18), -+ .msg = "rss_idt_mem10_ecc_m1bit_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(19), -+ .msg = "rss_idt_mem11_ecc_mbit_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(20), -+ .msg = "rss_idt_mem12_ecc_mbit_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(21), -+ .msg = "rss_idt_mem13_ecc_mbit_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(22), -+ .msg = "rss_idt_mem14_ecc_mbit_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(23), -+ .msg = "rss_idt_mem15_ecc_mbit_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(24), -+ .msg = "port_vlan_mem_ecc_mbit_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(25), -+ .msg = "mcast_linear_table_mem_ecc_mbit_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(26), -+ .msg = "mcast_result_mem_ecc_mbit_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(27), -+ .msg = "flow_director_ad_mem0_ecc_mbit_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(28), -+ .msg = "flow_director_ad_mem1_ecc_mbit_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(29), -+ .msg = "rx_vlan_tag_memory_ecc_mbit_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(30), -+ .msg = "Tx_UP_mapping_config_mem_ecc_mbit_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = 0, -+ .msg = NULL, -+ .reset_level = HNS3_NONE_RESET -+ } - }; - - static const struct hns3_hw_error ppp_mpf_abnormal_int_st3[] = { -- { .int_msk = BIT(0), -- .msg = "hfs_fifo_mem_ecc_mbit_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(1), -- .msg = "rslt_descr_fifo_mem_ecc_mbit_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(2), -- .msg = "tx_vlan_tag_mem_ecc_mbit_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(3), -- .msg = "FD_CN0_memory_ecc_mbit_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(4), -- .msg = "FD_CN1_memory_ecc_mbit_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(5), -- .msg = "GRO_AD_memory_ecc_mbit_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = 0, -- .msg = NULL, -- .reset_level = HNS3_NONE_RESET} -+ { -+ .int_msk = BIT(0), -+ .msg = "hfs_fifo_mem_ecc_mbit_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(1), -+ .msg = "rslt_descr_fifo_mem_ecc_mbit_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(2), -+ .msg = "tx_vlan_tag_mem_ecc_mbit_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(3), -+ .msg = "FD_CN0_memory_ecc_mbit_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(4), -+ .msg = "FD_CN1_memory_ecc_mbit_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(5), -+ .msg = "GRO_AD_memory_ecc_mbit_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = 0, -+ .msg = NULL, -+ .reset_level = HNS3_NONE_RESET -+ } - }; - - static const struct hns3_hw_error ppu_mpf_abnormal_int_st3[] = { -- { .int_msk = BIT(4), -- .msg = "gro_bd_ecc_mbit_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(5), -- .msg = "gro_context_ecc_mbit_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(6), -- .msg = "rx_stash_cfg_ecc_mbit_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(7), -- .msg = "axi_rd_fbd_ecc_mbit_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = 0, -- .msg = NULL, -- .reset_level = HNS3_NONE_RESET} -+ { -+ .int_msk = BIT(4), -+ .msg = "gro_bd_ecc_mbit_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(5), -+ .msg = "gro_context_ecc_mbit_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(6), -+ .msg = "rx_stash_cfg_ecc_mbit_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(7), -+ .msg = "axi_rd_fbd_ecc_mbit_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = 0, -+ .msg = NULL, -+ .reset_level = HNS3_NONE_RESET -+ } - }; - - static const struct hns3_hw_error tm_sch_int[] = { -- { .int_msk = BIT(1), -- .msg = "tm_sch_ecc_mbit_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(2), -- .msg = "tm_sch_port_shap_sub_fifo_wr_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(3), -- .msg = "tm_sch_port_shap_sub_fifo_rd_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(4), -- .msg = "tm_sch_pg_pshap_sub_fifo_wr_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(5), -- .msg = "tm_sch_pg_pshap_sub_fifo_rd_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(6), -- .msg = "tm_sch_pg_cshap_sub_fifo_wr_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(7), -- .msg = "tm_sch_pg_cshap_sub_fifo_rd_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(8), -- .msg = "tm_sch_pri_pshap_sub_fifo_wr_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(9), -- .msg = "tm_sch_pri_pshap_sub_fifo_rd_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(10), -- .msg = "tm_sch_pri_cshap_sub_fifo_wr_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(11), -- .msg = "tm_sch_pri_cshap_sub_fifo_rd_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(12), -- .msg = "tm_sch_port_shap_offset_fifo_wr_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(13), -- .msg = "tm_sch_port_shap_offset_fifo_rd_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(14), -- .msg = "tm_sch_pg_pshap_offset_fifo_wr_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(15), -- .msg = "tm_sch_pg_pshap_offset_fifo_rd_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(16), -- .msg = "tm_sch_pg_cshap_offset_fifo_wr_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(17), -- .msg = "tm_sch_pg_cshap_offset_fifo_rd_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(18), -- .msg = "tm_sch_pri_pshap_offset_fifo_wr_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(19), -- .msg = "tm_sch_pri_pshap_offset_fifo_rd_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(20), -- .msg = "tm_sch_pri_cshap_offset_fifo_wr_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(21), -- .msg = "tm_sch_pri_cshap_offset_fifo_rd_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(22), -- .msg = "tm_sch_rq_fifo_wr_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(23), -- .msg = "tm_sch_rq_fifo_rd_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(24), -- .msg = "tm_sch_nq_fifo_wr_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(25), -- .msg = "tm_sch_nq_fifo_rd_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(26), -- .msg = "tm_sch_roce_up_fifo_wr_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(27), -- .msg = "tm_sch_roce_up_fifo_rd_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(28), -- .msg = "tm_sch_rcb_byte_fifo_wr_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(29), -- .msg = "tm_sch_rcb_byte_fifo_rd_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(30), -- .msg = "tm_sch_ssu_byte_fifo_wr_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(31), -- .msg = "tm_sch_ssu_byte_fifo_rd_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = 0, -- .msg = NULL, -- .reset_level = HNS3_NONE_RESET} -+ { -+ .int_msk = BIT(1), -+ .msg = "tm_sch_ecc_mbit_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(2), -+ .msg = "tm_sch_port_shap_sub_fifo_wr_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(3), -+ .msg = "tm_sch_port_shap_sub_fifo_rd_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(4), -+ .msg = "tm_sch_pg_pshap_sub_fifo_wr_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(5), -+ .msg = "tm_sch_pg_pshap_sub_fifo_rd_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(6), -+ .msg = "tm_sch_pg_cshap_sub_fifo_wr_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(7), -+ .msg = "tm_sch_pg_cshap_sub_fifo_rd_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(8), -+ .msg = "tm_sch_pri_pshap_sub_fifo_wr_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(9), -+ .msg = "tm_sch_pri_pshap_sub_fifo_rd_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(10), -+ .msg = "tm_sch_pri_cshap_sub_fifo_wr_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(11), -+ .msg = "tm_sch_pri_cshap_sub_fifo_rd_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(12), -+ .msg = "tm_sch_port_shap_offset_fifo_wr_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(13), -+ .msg = "tm_sch_port_shap_offset_fifo_rd_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(14), -+ .msg = "tm_sch_pg_pshap_offset_fifo_wr_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(15), -+ .msg = "tm_sch_pg_pshap_offset_fifo_rd_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(16), -+ .msg = "tm_sch_pg_cshap_offset_fifo_wr_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(17), -+ .msg = "tm_sch_pg_cshap_offset_fifo_rd_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(18), -+ .msg = "tm_sch_pri_pshap_offset_fifo_wr_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(19), -+ .msg = "tm_sch_pri_pshap_offset_fifo_rd_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(20), -+ .msg = "tm_sch_pri_cshap_offset_fifo_wr_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(21), -+ .msg = "tm_sch_pri_cshap_offset_fifo_rd_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(22), -+ .msg = "tm_sch_rq_fifo_wr_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(23), -+ .msg = "tm_sch_rq_fifo_rd_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(24), -+ .msg = "tm_sch_nq_fifo_wr_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(25), -+ .msg = "tm_sch_nq_fifo_rd_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(26), -+ .msg = "tm_sch_roce_up_fifo_wr_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(27), -+ .msg = "tm_sch_roce_up_fifo_rd_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(28), -+ .msg = "tm_sch_rcb_byte_fifo_wr_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(29), -+ .msg = "tm_sch_rcb_byte_fifo_rd_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(30), -+ .msg = "tm_sch_ssu_byte_fifo_wr_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(31), -+ .msg = "tm_sch_ssu_byte_fifo_rd_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = 0, -+ .msg = NULL, -+ .reset_level = HNS3_NONE_RESET -+ } - }; - - static const struct hns3_hw_error qcn_fifo_int[] = { -- { .int_msk = BIT(0), -- .msg = "qcn_shap_gp0_sch_fifo_rd_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(1), -- .msg = "qcn_shap_gp0_sch_fifo_wr_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(2), -- .msg = "qcn_shap_gp1_sch_fifo_rd_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(3), -- .msg = "qcn_shap_gp1_sch_fifo_wr_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(4), -- .msg = "qcn_shap_gp2_sch_fifo_rd_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(5), -- .msg = "qcn_shap_gp2_sch_fifo_wr_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(6), -- .msg = "qcn_shap_gp3_sch_fifo_rd_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(7), -- .msg = "qcn_shap_gp3_sch_fifo_wr_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(8), -- .msg = "qcn_shap_gp0_offset_fifo_rd_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(9), -- .msg = "qcn_shap_gp0_offset_fifo_wr_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(10), -- .msg = "qcn_shap_gp1_offset_fifo_rd_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(11), -- .msg = "qcn_shap_gp1_offset_fifo_wr_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(12), -- .msg = "qcn_shap_gp2_offset_fifo_rd_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(13), -- .msg = "qcn_shap_gp2_offset_fifo_wr_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(14), -- .msg = "qcn_shap_gp3_offset_fifo_rd_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(15), -- .msg = "qcn_shap_gp3_offset_fifo_wr_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(16), -- .msg = "qcn_byte_info_fifo_rd_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(17), -- .msg = "qcn_byte_info_fifo_wr_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = 0, -- .msg = NULL, -- .reset_level = HNS3_NONE_RESET} -+ { -+ .int_msk = BIT(0), -+ .msg = "qcn_shap_gp0_sch_fifo_rd_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(1), -+ .msg = "qcn_shap_gp0_sch_fifo_wr_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(2), -+ .msg = "qcn_shap_gp1_sch_fifo_rd_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(3), -+ .msg = "qcn_shap_gp1_sch_fifo_wr_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(4), -+ .msg = "qcn_shap_gp2_sch_fifo_rd_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(5), -+ .msg = "qcn_shap_gp2_sch_fifo_wr_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(6), -+ .msg = "qcn_shap_gp3_sch_fifo_rd_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(7), -+ .msg = "qcn_shap_gp3_sch_fifo_wr_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(8), -+ .msg = "qcn_shap_gp0_offset_fifo_rd_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(9), -+ .msg = "qcn_shap_gp0_offset_fifo_wr_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(10), -+ .msg = "qcn_shap_gp1_offset_fifo_rd_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(11), -+ .msg = "qcn_shap_gp1_offset_fifo_wr_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(12), -+ .msg = "qcn_shap_gp2_offset_fifo_rd_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(13), -+ .msg = "qcn_shap_gp2_offset_fifo_wr_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(14), -+ .msg = "qcn_shap_gp3_offset_fifo_rd_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(15), -+ .msg = "qcn_shap_gp3_offset_fifo_wr_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(16), -+ .msg = "qcn_byte_info_fifo_rd_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(17), -+ .msg = "qcn_byte_info_fifo_wr_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = 0, -+ .msg = NULL, -+ .reset_level = HNS3_NONE_RESET -+ } - }; - - static const struct hns3_hw_error qcn_ecc_int[] = { -- { .int_msk = BIT(1), -- .msg = "qcn_byte_mem_ecc_mbit_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(3), -- .msg = "qcn_time_mem_ecc_mbit_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(5), -- .msg = "qcn_fb_mem_ecc_mbit_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(7), -- .msg = "qcn_link_mem_ecc_mbit_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(9), -- .msg = "qcn_rate_mem_ecc_mbit_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(11), -- .msg = "qcn_tmplt_mem_ecc_mbit_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(13), -- .msg = "qcn_shap_cfg_mem_ecc_mbit_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(15), -- .msg = "qcn_gp0_barrel_mem_ecc_mbit_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(17), -- .msg = "qcn_gp1_barrel_mem_ecc_mbit_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(19), -- .msg = "qcn_gp2_barrel_mem_ecc_mbit_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(21), -- .msg = "qcn_gp3_barral_mem_ecc_mbit_err", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = 0, -- .msg = NULL, -- .reset_level = HNS3_NONE_RESET} -+ { -+ .int_msk = BIT(1), -+ .msg = "qcn_byte_mem_ecc_mbit_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(3), -+ .msg = "qcn_time_mem_ecc_mbit_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(5), -+ .msg = "qcn_fb_mem_ecc_mbit_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(7), -+ .msg = "qcn_link_mem_ecc_mbit_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(9), -+ .msg = "qcn_rate_mem_ecc_mbit_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(11), -+ .msg = "qcn_tmplt_mem_ecc_mbit_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(13), -+ .msg = "qcn_shap_cfg_mem_ecc_mbit_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(15), -+ .msg = "qcn_gp0_barrel_mem_ecc_mbit_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(17), -+ .msg = "qcn_gp1_barrel_mem_ecc_mbit_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(19), -+ .msg = "qcn_gp2_barrel_mem_ecc_mbit_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(21), -+ .msg = "qcn_gp3_barral_mem_ecc_mbit_err", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = 0, -+ .msg = NULL, -+ .reset_level = HNS3_NONE_RESET -+ } - }; - - static const struct hns3_hw_error ncsi_ecc_int[] = { -- { .int_msk = BIT(1), -- .msg = "ncsi_tx_ecc_mbit_err", -- .reset_level = HNS3_NONE_RESET }, -- { .int_msk = 0, -- .msg = NULL, -- .reset_level = HNS3_NONE_RESET} -+ { -+ .int_msk = BIT(1), -+ .msg = "ncsi_tx_ecc_mbit_err", -+ .reset_level = HNS3_NONE_RESET -+ }, { -+ .int_msk = 0, -+ .msg = NULL, -+ .reset_level = HNS3_NONE_RESET -+ } - }; - - static const struct hns3_hw_error ssu_fifo_overflow_int[] = { -- { .int_msk = BIT(0), -- .msg = "ig_mac_inf_int", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(1), -- .msg = "ig_host_inf_int", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(2), -- .msg = "ig_roc_buf_int", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(3), -- .msg = "ig_host_data_fifo_int", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(4), -- .msg = "ig_host_key_fifo_int", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(5), -- .msg = "tx_qcn_fifo_int", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(6), -- .msg = "rx_qcn_fifo_int", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(7), -- .msg = "tx_pf_rd_fifo_int", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(8), -- .msg = "rx_pf_rd_fifo_int", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(9), -- .msg = "qm_eof_fifo_int", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(10), -- .msg = "mb_rlt_fifo_int", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(11), -- .msg = "dup_uncopy_fifo_int", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(12), -- .msg = "dup_cnt_rd_fifo_int", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(13), -- .msg = "dup_cnt_drop_fifo_int", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(14), -- .msg = "dup_cnt_wrb_fifo_int", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(15), -- .msg = "host_cmd_fifo_int", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(16), -- .msg = "mac_cmd_fifo_int", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(17), -- .msg = "host_cmd_bitmap_empty_int", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(18), -- .msg = "mac_cmd_bitmap_empty_int", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(19), -- .msg = "dup_bitmap_empty_int", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(20), -- .msg = "out_queue_bitmap_empty_int", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(21), -- .msg = "bank2_bitmap_empty_int", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(22), -- .msg = "bank1_bitmap_empty_int", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(23), -- .msg = "bank0_bitmap_empty_int", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = 0, -- .msg = NULL, -- .reset_level = HNS3_NONE_RESET} -+ { -+ .int_msk = BIT(0), -+ .msg = "ig_mac_inf_int", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(1), -+ .msg = "ig_host_inf_int", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(2), -+ .msg = "ig_roc_buf_int", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(3), -+ .msg = "ig_host_data_fifo_int", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(4), -+ .msg = "ig_host_key_fifo_int", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(5), -+ .msg = "tx_qcn_fifo_int", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(6), -+ .msg = "rx_qcn_fifo_int", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(7), -+ .msg = "tx_pf_rd_fifo_int", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(8), -+ .msg = "rx_pf_rd_fifo_int", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(9), -+ .msg = "qm_eof_fifo_int", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(10), -+ .msg = "mb_rlt_fifo_int", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(11), -+ .msg = "dup_uncopy_fifo_int", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(12), -+ .msg = "dup_cnt_rd_fifo_int", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(13), -+ .msg = "dup_cnt_drop_fifo_int", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(14), -+ .msg = "dup_cnt_wrb_fifo_int", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(15), -+ .msg = "host_cmd_fifo_int", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(16), -+ .msg = "mac_cmd_fifo_int", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(17), -+ .msg = "host_cmd_bitmap_empty_int", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(18), -+ .msg = "mac_cmd_bitmap_empty_int", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(19), -+ .msg = "dup_bitmap_empty_int", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(20), -+ .msg = "out_queue_bitmap_empty_int", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(21), -+ .msg = "bank2_bitmap_empty_int", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(22), -+ .msg = "bank1_bitmap_empty_int", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(23), -+ .msg = "bank0_bitmap_empty_int", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = 0, -+ .msg = NULL, -+ .reset_level = HNS3_NONE_RESET -+ } - }; - - static const struct hns3_hw_error ssu_ets_tcg_int[] = { -- { .int_msk = BIT(0), -- .msg = "ets_rd_int_rx_tcg", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(1), -- .msg = "ets_wr_int_rx_tcg", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(2), -- .msg = "ets_rd_int_tx_tcg", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(3), -- .msg = "ets_wr_int_tx_tcg", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = 0, -- .msg = NULL, -- .reset_level = HNS3_NONE_RESET} -+ { -+ .int_msk = BIT(0), -+ .msg = "ets_rd_int_rx_tcg", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(1), -+ .msg = "ets_wr_int_rx_tcg", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(2), -+ .msg = "ets_rd_int_tx_tcg", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(3), -+ .msg = "ets_wr_int_tx_tcg", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = 0, -+ .msg = NULL, -+ .reset_level = HNS3_NONE_RESET -+ } - }; - - static const struct hns3_hw_error igu_egu_tnl_int[] = { -- { .int_msk = BIT(0), -- .msg = "rx_buf_overflow", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(1), -- .msg = "rx_stp_fifo_overflow", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(2), -- .msg = "rx_stp_fifo_underflow", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(3), -- .msg = "tx_buf_overflow", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(4), -- .msg = "tx_buf_underrun", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(5), -- .msg = "rx_stp_buf_overflow", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = 0, -- .msg = NULL, -- .reset_level = HNS3_NONE_RESET} -+ { -+ .int_msk = BIT(0), -+ .msg = "rx_buf_overflow", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(1), -+ .msg = "rx_stp_fifo_overflow", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(2), -+ .msg = "rx_stp_fifo_underflow", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(3), -+ .msg = "tx_buf_overflow", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(4), -+ .msg = "tx_buf_underrun", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(5), -+ .msg = "rx_stp_buf_overflow", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = 0, -+ .msg = NULL, -+ .reset_level = HNS3_NONE_RESET -+ } - }; - - static const struct hns3_hw_error ssu_port_based_err_int[] = { -- { .int_msk = BIT(0), -- .msg = "roc_pkt_without_key_port", -- .reset_level = HNS3_FUNC_RESET }, -- { .int_msk = BIT(1), -- .msg = "tpu_pkt_without_key_port", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(2), -- .msg = "igu_pkt_without_key_port", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(3), -- .msg = "roc_eof_mis_match_port", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(4), -- .msg = "tpu_eof_mis_match_port", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(5), -- .msg = "igu_eof_mis_match_port", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(6), -- .msg = "roc_sof_mis_match_port", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(7), -- .msg = "tpu_sof_mis_match_port", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(8), -- .msg = "igu_sof_mis_match_port", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(11), -- .msg = "ets_rd_int_rx_port", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(12), -- .msg = "ets_wr_int_rx_port", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(13), -- .msg = "ets_rd_int_tx_port", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = BIT(14), -- .msg = "ets_wr_int_tx_port", -- .reset_level = HNS3_GLOBAL_RESET }, -- { .int_msk = 0, -- .msg = NULL, -- .reset_level = HNS3_NONE_RESET} -+ { -+ .int_msk = BIT(0), -+ .msg = "roc_pkt_without_key_port", -+ .reset_level = HNS3_FUNC_RESET -+ }, { -+ .int_msk = BIT(1), -+ .msg = "tpu_pkt_without_key_port", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(2), -+ .msg = "igu_pkt_without_key_port", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(3), -+ .msg = "roc_eof_mis_match_port", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(4), -+ .msg = "tpu_eof_mis_match_port", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(5), -+ .msg = "igu_eof_mis_match_port", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(6), -+ .msg = "roc_sof_mis_match_port", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(7), -+ .msg = "tpu_sof_mis_match_port", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(8), -+ .msg = "igu_sof_mis_match_port", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(11), -+ .msg = "ets_rd_int_rx_port", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(12), -+ .msg = "ets_wr_int_rx_port", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(13), -+ .msg = "ets_rd_int_tx_port", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = BIT(14), -+ .msg = "ets_wr_int_tx_port", -+ .reset_level = HNS3_GLOBAL_RESET -+ }, { -+ .int_msk = 0, -+ .msg = NULL, -+ .reset_level = HNS3_NONE_RESET -+ } - }; - - static const struct hns3_hw_error_desc mpf_ras_err_tbl[] = { -- { .desc_offset = 0, -- .data_offset = 0, -- .msg = "IMP_TCM_ECC_INT_STS", -- .hw_err = imp_tcm_ecc_int }, -- { .desc_offset = 0, -- .data_offset = 1, -- .msg = "CMDQ_MEM_ECC_INT_STS", -- .hw_err = cmdq_mem_ecc_int }, -- { .desc_offset = 0, -- .data_offset = 2, -- .msg = "IMP_RD_POISON_INT_STS", -- .hw_err = imp_rd_poison_int }, -- { .desc_offset = 0, -- .data_offset = 3, -- .msg = "TQP_INT_ECC_INT_STS", -- .hw_err = tqp_int_ecc_int }, -- { .desc_offset = 0, -- .data_offset = 4, -- .msg = "MSIX_ECC_INT_STS", -- .hw_err = msix_ecc_int }, -- { .desc_offset = 2, -- .data_offset = 2, -- .msg = "SSU_ECC_MULTI_BIT_INT_0", -- .hw_err = ssu_ecc_multi_bit_int_0 }, -- { .desc_offset = 2, -- .data_offset = 3, -- .msg = "SSU_ECC_MULTI_BIT_INT_1", -- .hw_err = ssu_ecc_multi_bit_int_1 }, -- { .desc_offset = 2, -- .data_offset = 4, -- .msg = "SSU_COMMON_ERR_INT", -- .hw_err = ssu_common_ecc_int }, -- { .desc_offset = 3, -- .data_offset = 0, -- .msg = "IGU_INT_STS", -- .hw_err = igu_int }, -- { .desc_offset = 4, -- .data_offset = 1, -- .msg = "PPP_MPF_ABNORMAL_INT_ST1", -- .hw_err = ppp_mpf_abnormal_int_st1 }, -- { .desc_offset = 4, -- .data_offset = 3, -- .msg = "PPP_MPF_ABNORMAL_INT_ST3", -- .hw_err = ppp_mpf_abnormal_int_st3 }, -- { .desc_offset = 5, -- .data_offset = 1, -- .msg = "PPU_MPF_ABNORMAL_INT_ST1", -- .hw_err = ppu_mpf_abnormal_int_st1 }, -- { .desc_offset = 5, -- .data_offset = 2, -- .msg = "PPU_MPF_ABNORMAL_INT_ST2_RAS", -- .hw_err = ppu_mpf_abnormal_int_st2_ras }, -- { .desc_offset = 5, -- .data_offset = 3, -- .msg = "PPU_MPF_ABNORMAL_INT_ST3", -- .hw_err = ppu_mpf_abnormal_int_st3 }, -- { .desc_offset = 6, -- .data_offset = 0, -- .msg = "TM_SCH_RINT", -- .hw_err = tm_sch_int }, -- { .desc_offset = 7, -- .data_offset = 0, -- .msg = "QCN_FIFO_RINT", -- .hw_err = qcn_fifo_int }, -- { .desc_offset = 7, -- .data_offset = 1, -- .msg = "QCN_ECC_RINT", -- .hw_err = qcn_ecc_int }, -- { .desc_offset = 9, -- .data_offset = 0, -- .msg = "NCSI_ECC_INT_RPT", -- .hw_err = ncsi_ecc_int }, -- { .desc_offset = 0, -- .data_offset = 0, -- .msg = NULL, -- .hw_err = NULL } -+ { -+ .desc_offset = 0, -+ .data_offset = 0, -+ .msg = "IMP_TCM_ECC_INT_STS", -+ .hw_err = imp_tcm_ecc_int -+ }, { -+ .desc_offset = 0, -+ .data_offset = 1, -+ .msg = "CMDQ_MEM_ECC_INT_STS", -+ .hw_err = cmdq_mem_ecc_int -+ }, { -+ .desc_offset = 0, -+ .data_offset = 2, -+ .msg = "IMP_RD_POISON_INT_STS", -+ .hw_err = imp_rd_poison_int -+ }, { -+ .desc_offset = 0, -+ .data_offset = 3, -+ .msg = "TQP_INT_ECC_INT_STS", -+ .hw_err = tqp_int_ecc_int -+ }, { -+ .desc_offset = 0, -+ .data_offset = 4, -+ .msg = "MSIX_ECC_INT_STS", -+ .hw_err = msix_ecc_int -+ }, { -+ .desc_offset = 2, -+ .data_offset = 2, -+ .msg = "SSU_ECC_MULTI_BIT_INT_0", -+ .hw_err = ssu_ecc_multi_bit_int_0 -+ }, { -+ .desc_offset = 2, -+ .data_offset = 3, -+ .msg = "SSU_ECC_MULTI_BIT_INT_1", -+ .hw_err = ssu_ecc_multi_bit_int_1 -+ }, { -+ .desc_offset = 2, -+ .data_offset = 4, -+ .msg = "SSU_COMMON_ERR_INT", -+ .hw_err = ssu_common_ecc_int -+ }, { -+ .desc_offset = 3, -+ .data_offset = 0, -+ .msg = "IGU_INT_STS", -+ .hw_err = igu_int -+ }, { -+ .desc_offset = 4, -+ .data_offset = 1, -+ .msg = "PPP_MPF_ABNORMAL_INT_ST1", -+ .hw_err = ppp_mpf_abnormal_int_st1 -+ }, { -+ .desc_offset = 4, -+ .data_offset = 3, -+ .msg = "PPP_MPF_ABNORMAL_INT_ST3", -+ .hw_err = ppp_mpf_abnormal_int_st3 -+ }, { -+ .desc_offset = 5, -+ .data_offset = 1, -+ .msg = "PPU_MPF_ABNORMAL_INT_ST1", -+ .hw_err = ppu_mpf_abnormal_int_st1 -+ }, { -+ .desc_offset = 5, -+ .data_offset = 2, -+ .msg = "PPU_MPF_ABNORMAL_INT_ST2_RAS", -+ .hw_err = ppu_mpf_abnormal_int_st2_ras -+ }, { -+ .desc_offset = 5, -+ .data_offset = 3, -+ .msg = "PPU_MPF_ABNORMAL_INT_ST3", -+ .hw_err = ppu_mpf_abnormal_int_st3 -+ }, { -+ .desc_offset = 6, -+ .data_offset = 0, -+ .msg = "TM_SCH_RINT", -+ .hw_err = tm_sch_int -+ }, { -+ .desc_offset = 7, -+ .data_offset = 0, -+ .msg = "QCN_FIFO_RINT", -+ .hw_err = qcn_fifo_int -+ }, { -+ .desc_offset = 7, -+ .data_offset = 1, -+ .msg = "QCN_ECC_RINT", -+ .hw_err = qcn_ecc_int -+ }, { -+ .desc_offset = 9, -+ .data_offset = 0, -+ .msg = "NCSI_ECC_INT_RPT", -+ .hw_err = ncsi_ecc_int -+ }, { -+ .desc_offset = 0, -+ .data_offset = 0, -+ .msg = NULL, -+ .hw_err = NULL -+ } - }; - - static const struct hns3_hw_error_desc pf_ras_err_tbl[] = { -- { .desc_offset = 0, -- .data_offset = 0, -- .msg = "SSU_PORT_BASED_ERR_INT_RAS", -- .hw_err = ssu_port_based_err_int }, -- { .desc_offset = 0, -- .data_offset = 1, -- .msg = "SSU_FIFO_OVERFLOW_INT", -- .hw_err = ssu_fifo_overflow_int }, -- { .desc_offset = 0, -- .data_offset = 2, -- .msg = "SSU_ETS_TCG_INT", -- .hw_err = ssu_ets_tcg_int }, -- { .desc_offset = 1, -- .data_offset = 0, -- .msg = "IGU_EGU_TNL_INT_STS", -- .hw_err = igu_egu_tnl_int }, -- { .desc_offset = 3, -- .data_offset = 0, -- .msg = "PPU_PF_ABNORMAL_INT_ST_RAS", -- .hw_err = ppu_pf_abnormal_int_ras }, -- { .desc_offset = 0, -- .data_offset = 0, -- .msg = NULL, -- .hw_err = NULL } -+ { -+ .desc_offset = 0, -+ .data_offset = 0, -+ .msg = "SSU_PORT_BASED_ERR_INT_RAS", -+ .hw_err = ssu_port_based_err_int -+ }, { -+ .desc_offset = 0, -+ .data_offset = 1, -+ .msg = "SSU_FIFO_OVERFLOW_INT", -+ .hw_err = ssu_fifo_overflow_int -+ }, { -+ .desc_offset = 0, -+ .data_offset = 2, -+ .msg = "SSU_ETS_TCG_INT", -+ .hw_err = ssu_ets_tcg_int -+ }, { -+ .desc_offset = 1, -+ .data_offset = 0, -+ .msg = "IGU_EGU_TNL_INT_STS", -+ .hw_err = igu_egu_tnl_int -+ }, { -+ .desc_offset = 3, -+ .data_offset = 0, -+ .msg = "PPU_PF_ABNORMAL_INT_ST_RAS", -+ .hw_err = ppu_pf_abnormal_int_ras -+ }, { -+ .desc_offset = 0, -+ .data_offset = 0, -+ .msg = NULL, -+ .hw_err = NULL -+ } - }; - - static const struct hns3_hw_error_desc mpf_msix_err_tbl[] = { -- { .desc_offset = 1, -- .data_offset = 0, -- .msg = "MAC_AFIFO_TNL_INT_R", -- .hw_err = mac_afifo_tnl_int }, -- { .desc_offset = 5, -- .data_offset = 2, -- .msg = "PPU_MPF_ABNORMAL_INT_ST2_MSIX", -- .hw_err = ppu_mpf_abnormal_int_st2_msix }, -- { .desc_offset = 0, -- .data_offset = 0, -- .msg = NULL, -- .hw_err = NULL } -+ { -+ .desc_offset = 1, -+ .data_offset = 0, -+ .msg = "MAC_AFIFO_TNL_INT_R", -+ .hw_err = mac_afifo_tnl_int -+ }, { -+ .desc_offset = 5, -+ .data_offset = 2, -+ .msg = "PPU_MPF_ABNORMAL_INT_ST2_MSIX", -+ .hw_err = ppu_mpf_abnormal_int_st2_msix -+ }, { -+ .desc_offset = 0, -+ .data_offset = 0, -+ .msg = NULL, -+ .hw_err = NULL -+ } - }; - - static const struct hns3_hw_error_desc pf_msix_err_tbl[] = { -- { .desc_offset = 0, -- .data_offset = 0, -- .msg = "SSU_PORT_BASED_ERR_INT_MSIX", -- .hw_err = ssu_port_based_pf_int }, -- { .desc_offset = 2, -- .data_offset = 0, -- .msg = "PPP_PF_ABNORMAL_INT_ST0", -- .hw_err = ppp_pf_abnormal_int }, -- { .desc_offset = 3, -- .data_offset = 0, -- .msg = "PPU_PF_ABNORMAL_INT_ST_MSIX", -- .hw_err = ppu_pf_abnormal_int_msix }, -- { .desc_offset = 0, -- .data_offset = 0, -- .msg = NULL, -- .hw_err = NULL } -+ { -+ .desc_offset = 0, -+ .data_offset = 0, -+ .msg = "SSU_PORT_BASED_ERR_INT_MSIX", -+ .hw_err = ssu_port_based_pf_int -+ }, { -+ .desc_offset = 2, -+ .data_offset = 0, -+ .msg = "PPP_PF_ABNORMAL_INT_ST0", -+ .hw_err = ppp_pf_abnormal_int -+ }, { -+ .desc_offset = 3, -+ .data_offset = 0, -+ .msg = "PPU_PF_ABNORMAL_INT_ST_MSIX", -+ .hw_err = ppu_pf_abnormal_int_msix -+ }, { -+ .desc_offset = 0, -+ .data_offset = 0, -+ .msg = NULL, -+ .hw_err = NULL -+ } - }; - - enum hns3_hw_err_type { --- -2.7.4 - diff --git a/0062-dma-hisilicon-support-error-handling-with-Kunpeng-93.patch b/0062-dma-hisilicon-support-error-handling-with-Kunpeng-93.patch new file mode 100644 index 0000000000000000000000000000000000000000..3eefdcbc637258ea9bd33ca10488f40ced076bd1 --- /dev/null +++ b/0062-dma-hisilicon-support-error-handling-with-Kunpeng-93.patch @@ -0,0 +1,35 @@ +From 2265601837805a2fc70dd5935ffe3f2ccaec17d1 Mon Sep 17 00:00:00 2001 +From: Chengwen Feng +Date: Thu, 17 Feb 2022 10:59:08 +0800 +Subject: [PATCH] dma/hisilicon: support error handling with Kunpeng 930 + +The Kunpeng930 DMA supports the capability of handles errors. + +Signed-off-by: Chengwen Feng +--- + drivers/dma/hisilicon/hisi_dmadev.c | 5 ++++- + 1 file changed, 4 insertions(+), 1 deletion(-) + +diff --git a/drivers/dma/hisilicon/hisi_dmadev.c b/drivers/dma/hisilicon/hisi_dmadev.c +index d4e08994a8..b99a9bce6c 100644 +--- a/drivers/dma/hisilicon/hisi_dmadev.c ++++ b/drivers/dma/hisilicon/hisi_dmadev.c +@@ -328,11 +328,14 @@ hisi_dma_info_get(const struct rte_dma_dev *dev, + struct rte_dma_info *dev_info, + uint32_t info_sz) + { +- RTE_SET_USED(dev); ++ struct hisi_dma_dev *hw = dev->data->dev_private; + RTE_SET_USED(info_sz); + + dev_info->dev_capa = RTE_DMA_CAPA_MEM_TO_MEM | + RTE_DMA_CAPA_OPS_COPY; ++ if (hw->reg_layout == HISI_DMA_REG_LAYOUT_HIP09) ++ dev_info->dev_capa |= RTE_DMA_CAPA_HANDLES_ERRORS; ++ + dev_info->max_vchans = 1; + dev_info->max_desc = HISI_DMA_MAX_DESC_NUM; + dev_info->min_desc = HISI_DMA_MIN_DESC_NUM; +-- +2.33.0 + diff --git a/0062-net-hns3-delete-redundant-xstats-RAS-statistics.patch b/0062-net-hns3-delete-redundant-xstats-RAS-statistics.patch deleted file mode 100644 index d2cc6aded1e9d972a04ec527e0fd2642e55ee234..0000000000000000000000000000000000000000 --- a/0062-net-hns3-delete-redundant-xstats-RAS-statistics.patch +++ /dev/null @@ -1,287 +0,0 @@ -From 95824ab5efc3996a682c57af118571fdccc5f677 Mon Sep 17 00:00:00 2001 -From: Hongbo Zheng -Date: Tue, 23 Mar 2021 19:21:03 +0800 -Subject: [PATCH 062/189] net/hns3: delete redundant xstats RAS statistics - -The current RAS code stores the reported RAS statistics in xstats. -This part of statistics is of little use in practice, and because -of the change of RAS scheme on Kunpeng930, the driver can not -obtain the RAS information any more, so this patch delete these -redundant RAS statistics. - -Signed-off-by: Hongbo Zheng -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_ethdev.c | 2 - - drivers/net/hns3/hns3_ethdev.h | 35 --------------- - drivers/net/hns3/hns3_intr.c | 1 - - drivers/net/hns3/hns3_stats.c | 100 +---------------------------------------- - drivers/net/hns3/hns3_stats.h | 1 - - 5 files changed, 1 insertion(+), 138 deletions(-) - -diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c -index 5da00b3..7bdc6f7 100644 ---- a/drivers/net/hns3/hns3_ethdev.c -+++ b/drivers/net/hns3/hns3_ethdev.c -@@ -5768,14 +5768,12 @@ hns3_record_imp_error(struct hns3_adapter *hns) - reg_val = hns3_read_dev(hw, HNS3_VECTOR0_OTER_EN_REG); - if (hns3_get_bit(reg_val, HNS3_VECTOR0_IMP_RD_POISON_B)) { - hns3_warn(hw, "Detected IMP RD poison!"); -- hns3_error_int_stats_add(hns, "IMP_RD_POISON_INT_STS"); - hns3_set_bit(reg_val, HNS3_VECTOR0_IMP_RD_POISON_B, 0); - hns3_write_dev(hw, HNS3_VECTOR0_OTER_EN_REG, reg_val); - } - - if (hns3_get_bit(reg_val, HNS3_VECTOR0_IMP_CMDQ_ERR_B)) { - hns3_warn(hw, "Detected IMP CMDQ error!"); -- hns3_error_int_stats_add(hns, "CMDQ_MEM_ECC_INT_STS"); - hns3_set_bit(reg_val, HNS3_VECTOR0_IMP_CMDQ_ERR_B, 0); - hns3_write_dev(hw, HNS3_VECTOR0_OTER_EN_REG, reg_val); - } -diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h -index dc27bb1..dfe0c59 100644 ---- a/drivers/net/hns3/hns3_ethdev.h -+++ b/drivers/net/hns3/hns3_ethdev.h -@@ -561,38 +561,6 @@ struct hns3_hw { - #define HNS3_FLAG_TC_BASE_SCH_MODE 1 - #define HNS3_FLAG_VNET_BASE_SCH_MODE 2 - --struct hns3_err_msix_intr_stats { -- uint64_t mac_afifo_tnl_int_cnt; -- uint64_t ppu_mpf_abn_int_st2_msix_cnt; -- uint64_t ssu_port_based_pf_int_cnt; -- uint64_t ppp_pf_abnormal_int_cnt; -- uint64_t ppu_pf_abnormal_int_msix_cnt; -- -- uint64_t imp_tcm_ecc_int_cnt; -- uint64_t cmdq_mem_ecc_int_cnt; -- uint64_t imp_rd_poison_int_cnt; -- uint64_t tqp_int_ecc_int_cnt; -- uint64_t msix_ecc_int_cnt; -- uint64_t ssu_ecc_multi_bit_int_0_cnt; -- uint64_t ssu_ecc_multi_bit_int_1_cnt; -- uint64_t ssu_common_ecc_int_cnt; -- uint64_t igu_int_cnt; -- uint64_t ppp_mpf_abnormal_int_st1_cnt; -- uint64_t ppp_mpf_abnormal_int_st3_cnt; -- uint64_t ppu_mpf_abnormal_int_st1_cnt; -- uint64_t ppu_mpf_abn_int_st2_ras_cnt; -- uint64_t ppu_mpf_abnormal_int_st3_cnt; -- uint64_t tm_sch_int_cnt; -- uint64_t qcn_fifo_int_cnt; -- uint64_t qcn_ecc_int_cnt; -- uint64_t ncsi_ecc_int_cnt; -- uint64_t ssu_port_based_err_int_cnt; -- uint64_t ssu_fifo_overflow_int_cnt; -- uint64_t ssu_ets_tcg_int_cnt; -- uint64_t igu_egu_tnl_int_cnt; -- uint64_t ppu_pf_abnormal_int_ras_cnt; --}; -- - /* vlan entry information. */ - struct hns3_user_vlan_table { - LIST_ENTRY(hns3_user_vlan_table) next; -@@ -738,9 +706,6 @@ struct hns3_pf { - uint16_t max_umv_size; - uint16_t used_umv_size; - -- /* Statistics information for abnormal interrupt */ -- struct hns3_err_msix_intr_stats abn_int_stats; -- - bool support_sfp_query; - uint32_t fec_mode; /* current FEC mode for ethdev */ - -diff --git a/drivers/net/hns3/hns3_intr.c b/drivers/net/hns3/hns3_intr.c -index 265dae8..c259f2e 100644 ---- a/drivers/net/hns3/hns3_intr.c -+++ b/drivers/net/hns3/hns3_intr.c -@@ -1838,7 +1838,6 @@ hns3_find_highest_level(struct hns3_adapter *hns, const char *reg, - reset_level = err->reset_level; - need_reset = true; - } -- hns3_error_int_stats_add(hns, reg); - } - err++; - } -diff --git a/drivers/net/hns3/hns3_stats.c b/drivers/net/hns3/hns3_stats.c -index 941c75f..7cda36c 100644 ---- a/drivers/net/hns3/hns3_stats.c -+++ b/drivers/net/hns3/hns3_stats.c -@@ -201,65 +201,6 @@ static const struct hns3_xstats_name_offset hns3_mac_strings[] = { - HNS3_MAC_STATS_OFFSET(mac_rx_send_app_bad_pkt_num)} - }; - --static const struct hns3_xstats_name_offset hns3_error_int_stats_strings[] = { -- {"MAC_AFIFO_TNL_INT_R", -- HNS3_ERR_INT_STATS_FIELD_OFFSET(mac_afifo_tnl_int_cnt)}, -- {"PPU_MPF_ABNORMAL_INT_ST2_MSIX", -- HNS3_ERR_INT_STATS_FIELD_OFFSET(ppu_mpf_abn_int_st2_msix_cnt)}, -- {"SSU_PORT_BASED_ERR_INT_MSIX", -- HNS3_ERR_INT_STATS_FIELD_OFFSET(ssu_port_based_pf_int_cnt)}, -- {"PPP_PF_ABNORMAL_INT_ST0", -- HNS3_ERR_INT_STATS_FIELD_OFFSET(ppp_pf_abnormal_int_cnt)}, -- {"PPU_PF_ABNORMAL_INT_ST_MSIX", -- HNS3_ERR_INT_STATS_FIELD_OFFSET(ppu_pf_abnormal_int_msix_cnt)}, -- {"IMP_TCM_ECC_INT_STS", -- HNS3_ERR_INT_STATS_FIELD_OFFSET(imp_tcm_ecc_int_cnt)}, -- {"CMDQ_MEM_ECC_INT_STS", -- HNS3_ERR_INT_STATS_FIELD_OFFSET(cmdq_mem_ecc_int_cnt)}, -- {"IMP_RD_POISON_INT_STS", -- HNS3_ERR_INT_STATS_FIELD_OFFSET(imp_rd_poison_int_cnt)}, -- {"TQP_INT_ECC_INT_STS", -- HNS3_ERR_INT_STATS_FIELD_OFFSET(tqp_int_ecc_int_cnt)}, -- {"MSIX_ECC_INT_STS", -- HNS3_ERR_INT_STATS_FIELD_OFFSET(msix_ecc_int_cnt)}, -- {"SSU_ECC_MULTI_BIT_INT_0", -- HNS3_ERR_INT_STATS_FIELD_OFFSET(ssu_ecc_multi_bit_int_0_cnt)}, -- {"SSU_ECC_MULTI_BIT_INT_1", -- HNS3_ERR_INT_STATS_FIELD_OFFSET(ssu_ecc_multi_bit_int_1_cnt)}, -- {"SSU_COMMON_ERR_INT", -- HNS3_ERR_INT_STATS_FIELD_OFFSET(ssu_common_ecc_int_cnt)}, -- {"IGU_INT_STS", -- HNS3_ERR_INT_STATS_FIELD_OFFSET(igu_int_cnt)}, -- {"PPP_MPF_ABNORMAL_INT_ST1", -- HNS3_ERR_INT_STATS_FIELD_OFFSET(ppp_mpf_abnormal_int_st1_cnt)}, -- {"PPP_MPF_ABNORMAL_INT_ST3", -- HNS3_ERR_INT_STATS_FIELD_OFFSET(ppp_mpf_abnormal_int_st3_cnt)}, -- {"PPU_MPF_ABNORMAL_INT_ST1", -- HNS3_ERR_INT_STATS_FIELD_OFFSET(ppu_mpf_abnormal_int_st1_cnt)}, -- {"PPU_MPF_ABNORMAL_INT_ST2_RAS", -- HNS3_ERR_INT_STATS_FIELD_OFFSET(ppu_mpf_abn_int_st2_ras_cnt)}, -- {"PPU_MPF_ABNORMAL_INT_ST3", -- HNS3_ERR_INT_STATS_FIELD_OFFSET(ppu_mpf_abnormal_int_st3_cnt)}, -- {"TM_SCH_RINT", -- HNS3_ERR_INT_STATS_FIELD_OFFSET(tm_sch_int_cnt)}, -- {"QCN_FIFO_RINT", -- HNS3_ERR_INT_STATS_FIELD_OFFSET(qcn_fifo_int_cnt)}, -- {"QCN_ECC_RINT", -- HNS3_ERR_INT_STATS_FIELD_OFFSET(qcn_ecc_int_cnt)}, -- {"NCSI_ECC_INT_RPT", -- HNS3_ERR_INT_STATS_FIELD_OFFSET(ncsi_ecc_int_cnt)}, -- {"SSU_PORT_BASED_ERR_INT_RAS", -- HNS3_ERR_INT_STATS_FIELD_OFFSET(ssu_port_based_err_int_cnt)}, -- {"SSU_FIFO_OVERFLOW_INT", -- HNS3_ERR_INT_STATS_FIELD_OFFSET(ssu_fifo_overflow_int_cnt)}, -- {"SSU_ETS_TCG_INT", -- HNS3_ERR_INT_STATS_FIELD_OFFSET(ssu_ets_tcg_int_cnt)}, -- {"IGU_EGU_TNL_INT_STS", -- HNS3_ERR_INT_STATS_FIELD_OFFSET(igu_egu_tnl_int_cnt)}, -- {"PPU_PF_ABNORMAL_INT_ST_RAS", -- HNS3_ERR_INT_STATS_FIELD_OFFSET(ppu_pf_abnormal_int_ras_cnt)}, --}; -- - /* The statistic of reset */ - static const struct hns3_xstats_name_offset hns3_reset_stats_strings[] = { - {"REQ_RESET_CNT", -@@ -333,9 +274,6 @@ static const struct hns3_xstats_name_offset hns3_imissed_stats_strings[] = { - #define HNS3_NUM_MAC_STATS (sizeof(hns3_mac_strings) / \ - sizeof(hns3_mac_strings[0])) - --#define HNS3_NUM_ERROR_INT_XSTATS (sizeof(hns3_error_int_stats_strings) / \ -- sizeof(hns3_error_int_stats_strings[0])) -- - #define HNS3_NUM_RESET_XSTATS (sizeof(hns3_reset_stats_strings) / \ - sizeof(hns3_reset_stats_strings[0])) - -@@ -363,7 +301,7 @@ static const struct hns3_xstats_name_offset hns3_imissed_stats_strings[] = { - #define HNS3_NUM_IMISSED_XSTATS (sizeof(hns3_imissed_stats_strings) / \ - sizeof(hns3_imissed_stats_strings[0])) - --#define HNS3_FIX_NUM_STATS (HNS3_NUM_MAC_STATS + HNS3_NUM_ERROR_INT_XSTATS + \ -+#define HNS3_FIX_NUM_STATS (HNS3_NUM_MAC_STATS + \ - HNS3_NUM_RESET_XSTATS + HNS3_NUM_IMISSED_XSTATS) - - static void hns3_tqp_stats_clear(struct hns3_hw *hw); -@@ -750,23 +688,6 @@ hns3_queue_stats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *xstats, - } - } - --void --hns3_error_int_stats_add(struct hns3_adapter *hns, const char *err) --{ -- struct hns3_pf *pf = &hns->pf; -- uint16_t i; -- char *addr; -- -- for (i = 0; i < HNS3_NUM_ERROR_INT_XSTATS; i++) { -- if (strcmp(hns3_error_int_stats_strings[i].name, err) == 0) { -- addr = (char *)&pf->abn_int_stats + -- hns3_error_int_stats_strings[i].offset; -- *(uint64_t *)addr += 1; -- break; -- } -- } --} -- - static void - hns3_rxq_dfx_stats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *xstats, - int *count) -@@ -932,7 +853,6 @@ hns3_dev_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *xstats, - unsigned int n) - { - struct hns3_adapter *hns = dev->data->dev_private; -- struct hns3_pf *pf = &hns->pf; - struct hns3_hw *hw = &hns->hw; - struct hns3_rx_missed_stats *imissed_stats = &hw->imissed_stats; - struct hns3_mac_stats *mac_stats = &hw->mac_stats; -@@ -986,13 +906,6 @@ hns3_dev_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *xstats, - count++; - } - -- for (i = 0; i < HNS3_NUM_ERROR_INT_XSTATS; i++) { -- addr = (char *)&pf->abn_int_stats + -- hns3_error_int_stats_strings[i].offset; -- xstats[count].value = *(uint64_t *)addr; -- xstats[count].id = count; -- count++; -- } - } - - /* Get the reset stat */ -@@ -1134,13 +1047,6 @@ hns3_dev_xstats_get_names(struct rte_eth_dev *dev, - "%s", hns3_imissed_stats_strings[i].name); - count++; - } -- -- for (i = 0; i < HNS3_NUM_ERROR_INT_XSTATS; i++) { -- snprintf(xstats_names[count].name, -- sizeof(xstats_names[count].name), -- "%s", hns3_error_int_stats_strings[i].name); -- count++; -- } - } - for (i = 0; i < HNS3_NUM_RESET_XSTATS; i++) { - snprintf(xstats_names[count].name, -@@ -1358,7 +1264,6 @@ int - hns3_dev_xstats_reset(struct rte_eth_dev *dev) - { - struct hns3_adapter *hns = dev->data->dev_private; -- struct hns3_pf *pf = &hns->pf; - int ret; - - /* Clear tqp stats */ -@@ -1379,9 +1284,6 @@ hns3_dev_xstats_reset(struct rte_eth_dev *dev) - if (ret) - return ret; - -- /* Clear error stats */ -- memset(&pf->abn_int_stats, 0, sizeof(struct hns3_err_msix_intr_stats)); -- - return 0; - } - -diff --git a/drivers/net/hns3/hns3_stats.h b/drivers/net/hns3/hns3_stats.h -index 70a9c5b..8ea69b4 100644 ---- a/drivers/net/hns3/hns3_stats.h -+++ b/drivers/net/hns3/hns3_stats.h -@@ -164,7 +164,6 @@ int hns3_dev_xstats_get_names_by_id(struct rte_eth_dev *dev, - const uint64_t *ids, - uint32_t size); - int hns3_stats_reset(struct rte_eth_dev *dev); --void hns3_error_int_stats_add(struct hns3_adapter *hns, const char *err); - int hns3_tqp_stats_init(struct hns3_hw *hw); - void hns3_tqp_stats_uninit(struct hns3_hw *hw); - int hns3_update_imissed_stats(struct hns3_hw *hw, bool is_clear); --- -2.7.4 - diff --git a/0063-dma-hisilicon-support-registers-dump-for-Kunpeng-930.patch b/0063-dma-hisilicon-support-registers-dump-for-Kunpeng-930.patch new file mode 100644 index 0000000000000000000000000000000000000000..6ff5fea8e559da9c00d87bc7bffdf218d73fce96 --- /dev/null +++ b/0063-dma-hisilicon-support-registers-dump-for-Kunpeng-930.patch @@ -0,0 +1,112 @@ +From dd69081182fae0a65606e8d8b509aa46795b7cfa Mon Sep 17 00:00:00 2001 +From: Chengwen Feng +Date: Thu, 17 Feb 2022 10:59:09 +0800 +Subject: [PATCH] dma/hisilicon: support registers dump for Kunpeng 930 + +This patch supports dump Kunpeng930 DMA registers. + +Signed-off-by: Chengwen Feng +--- + drivers/dma/hisilicon/hisi_dmadev.c | 54 +++++++++++++++++++---------- + drivers/dma/hisilicon/hisi_dmadev.h | 8 +++++ + 2 files changed, 44 insertions(+), 18 deletions(-) + +diff --git a/drivers/dma/hisilicon/hisi_dmadev.c b/drivers/dma/hisilicon/hisi_dmadev.c +index b99a9bce6c..3917db38b7 100644 +--- a/drivers/dma/hisilicon/hisi_dmadev.c ++++ b/drivers/dma/hisilicon/hisi_dmadev.c +@@ -460,29 +460,13 @@ hisi_dma_stats_reset(struct rte_dma_dev *dev, uint16_t vchan) + } + + static void +-hisi_dma_get_dump_range(struct hisi_dma_dev *hw, uint32_t *start, uint32_t *end) +-{ +- if (hw->reg_layout == HISI_DMA_REG_LAYOUT_HIP08) { +- *start = HISI_DMA_HIP08_DUMP_START_REG; +- *end = HISI_DMA_HIP08_DUMP_END_REG; +- } else { +- *start = 0; +- *end = 0; +- } +-} +- +-static void +-hisi_dma_dump_common(struct hisi_dma_dev *hw, FILE *f) ++hisi_dma_dump_range(struct hisi_dma_dev *hw, FILE *f, uint32_t start, ++ uint32_t end) + { + #define DUMP_REGNUM_PER_LINE 4 + +- uint32_t start, end; + uint32_t cnt, i; + +- hisi_dma_get_dump_range(hw, &start, &end); +- +- (void)fprintf(f, " common-register:\n"); +- + cnt = 0; + for (i = start; i <= end; i += sizeof(uint32_t)) { + if (cnt % DUMP_REGNUM_PER_LINE == 0) +@@ -496,6 +480,40 @@ hisi_dma_dump_common(struct hisi_dma_dev *hw, FILE *f) + (void)fprintf(f, "\n"); + } + ++static void ++hisi_dma_dump_common(struct hisi_dma_dev *hw, FILE *f) ++{ ++ struct { ++ uint8_t reg_layout; ++ uint32_t start; ++ uint32_t end; ++ } reg_info[] = { ++ { HISI_DMA_REG_LAYOUT_HIP08, ++ HISI_DMA_HIP08_DUMP_START_REG, ++ HISI_DMA_HIP08_DUMP_END_REG }, ++ { HISI_DMA_REG_LAYOUT_HIP09, ++ HISI_DMA_HIP09_DUMP_REGION_A_START_REG, ++ HISI_DMA_HIP09_DUMP_REGION_A_END_REG }, ++ { HISI_DMA_REG_LAYOUT_HIP09, ++ HISI_DMA_HIP09_DUMP_REGION_B_START_REG, ++ HISI_DMA_HIP09_DUMP_REGION_B_END_REG }, ++ { HISI_DMA_REG_LAYOUT_HIP09, ++ HISI_DMA_HIP09_DUMP_REGION_C_START_REG, ++ HISI_DMA_HIP09_DUMP_REGION_C_END_REG }, ++ { HISI_DMA_REG_LAYOUT_HIP09, ++ HISI_DMA_HIP09_DUMP_REGION_D_START_REG, ++ HISI_DMA_HIP09_DUMP_REGION_D_END_REG }, ++ }; ++ uint32_t i; ++ ++ (void)fprintf(f, " common-register:\n"); ++ for (i = 0; i < RTE_DIM(reg_info); i++) { ++ if (hw->reg_layout != reg_info[i].reg_layout) ++ continue; ++ hisi_dma_dump_range(hw, f, reg_info[i].start, reg_info[i].end); ++ } ++} ++ + static void + hisi_dma_dump_read_queue(struct hisi_dma_dev *hw, uint32_t qoff, + char *buffer, int max_sz) +diff --git a/drivers/dma/hisilicon/hisi_dmadev.h b/drivers/dma/hisilicon/hisi_dmadev.h +index 591aec0b32..1eaa822db1 100644 +--- a/drivers/dma/hisilicon/hisi_dmadev.h ++++ b/drivers/dma/hisilicon/hisi_dmadev.h +@@ -121,6 +121,14 @@ enum { + #define HISI_DMA_HIP09_QUEUE_CFG_REG(queue_id) (0x800 + \ + (queue_id) * 0x20) + #define HISI_DMA_HIP09_QUEUE_CFG_LINK_DOWN_MASK_B 16 ++#define HISI_DMA_HIP09_DUMP_REGION_A_START_REG 0x0 ++#define HISI_DMA_HIP09_DUMP_REGION_A_END_REG 0x368 ++#define HISI_DMA_HIP09_DUMP_REGION_B_START_REG 0x800 ++#define HISI_DMA_HIP09_DUMP_REGION_B_END_REG 0xA08 ++#define HISI_DMA_HIP09_DUMP_REGION_C_START_REG 0x1800 ++#define HISI_DMA_HIP09_DUMP_REGION_C_END_REG 0x1A4C ++#define HISI_DMA_HIP09_DUMP_REGION_D_START_REG 0x1C00 ++#define HISI_DMA_HIP09_DUMP_REGION_D_END_REG 0x1CC4 + + /** + * In fact, there are multiple states, but it need to pay attention to +-- +2.33.0 + diff --git a/0063-net-hns3-support-imissed-stats-for-PF-VF.patch b/0063-net-hns3-support-imissed-stats-for-PF-VF.patch deleted file mode 100644 index 510283cafe0265fd79e66168c2c89d3636d21bf4..0000000000000000000000000000000000000000 --- a/0063-net-hns3-support-imissed-stats-for-PF-VF.patch +++ /dev/null @@ -1,516 +0,0 @@ -From e8d6fcbfdb76309172f36de8b046c5543a4f4cf1 Mon Sep 17 00:00:00 2001 -From: "Min Hu (Connor)" -Date: Tue, 23 Mar 2021 19:21:04 +0800 -Subject: [PATCH 063/189] net/hns3: support imissed stats for PF/VF - -This patch added function level imissed stats for PF and VF. In -Kunpeng920, imissed is supported, only including RPU drop stats in PF. -In kunpeng930, imissed is supported,including RPU drop stats and SSU -drop stats in PF. - -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_cmd.h | 13 +++ - drivers/net/hns3/hns3_ethdev.c | 2 + - drivers/net/hns3/hns3_ethdev.h | 21 ++++ - drivers/net/hns3/hns3_ethdev_vf.c | 9 ++ - drivers/net/hns3/hns3_regs.h | 2 + - drivers/net/hns3/hns3_stats.c | 234 +++++++++++++++++++++++++++++--------- - drivers/net/hns3/hns3_stats.h | 1 + - 7 files changed, 230 insertions(+), 52 deletions(-) - -diff --git a/drivers/net/hns3/hns3_cmd.h b/drivers/net/hns3/hns3_cmd.h -index 094bf7e..e704d0c 100644 ---- a/drivers/net/hns3/hns3_cmd.h -+++ b/drivers/net/hns3/hns3_cmd.h -@@ -111,6 +111,8 @@ enum hns3_opcode_type { - - HNS3_OPC_QUERY_DEV_SPECS = 0x0050, - -+ HNS3_OPC_SSU_DROP_REG = 0x0065, -+ - /* MAC command */ - HNS3_OPC_CONFIG_MAC_MODE = 0x0301, - HNS3_OPC_QUERY_LINK_STATUS = 0x0307, -@@ -957,6 +959,17 @@ struct hns3_query_rpu_cmd { - uint32_t rsv2[2]; - }; - -+#define HNS3_OPC_SSU_DROP_REG_NUM 2 -+ -+struct hns3_query_ssu_cmd { -+ uint8_t rxtx; -+ uint8_t rsv[3]; -+ uint32_t full_drop_cnt; -+ uint32_t part_drop_cnt; -+ uint32_t oq_drop_cnt; -+ uint32_t rev1[2]; -+}; -+ - #define HNS3_MAX_TQP_NUM_HIP08_PF 64 - #define HNS3_DEFAULT_TX_BUF 0x4000 /* 16k bytes */ - #define HNS3_TOTAL_PKT_BUF 0x108000 /* 1.03125M bytes */ -diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c -index 7bdc6f7..b5057da 100644 ---- a/drivers/net/hns3/hns3_ethdev.c -+++ b/drivers/net/hns3/hns3_ethdev.c -@@ -3122,6 +3122,7 @@ hns3_get_capability(struct hns3_hw *hw) - hw->intr.gl_unit = HNS3_INTR_COALESCE_GL_UINT_2US; - hw->tso_mode = HNS3_TSO_SW_CAL_PSEUDO_H_CSUM; - hw->vlan_mode = HNS3_SW_SHIFT_AND_DISCARD_MODE; -+ hw->drop_stats_mode = HNS3_PKTS_DROP_STATS_MODE1; - hw->min_tx_pkt_len = HNS3_HIP08_MIN_TX_PKT_LEN; - pf->tqp_config_mode = HNS3_FIXED_MAX_TQP_NUM_MODE; - hw->rss_info.ipv6_sctp_offload_supported = false; -@@ -3140,6 +3141,7 @@ hns3_get_capability(struct hns3_hw *hw) - hw->intr.gl_unit = HNS3_INTR_COALESCE_GL_UINT_1US; - hw->tso_mode = HNS3_TSO_HW_CAL_PSEUDO_H_CSUM; - hw->vlan_mode = HNS3_HW_SHIFT_AND_DISCARD_MODE; -+ hw->drop_stats_mode = HNS3_PKTS_DROP_STATS_MODE2; - hw->min_tx_pkt_len = HNS3_HIP09_MIN_TX_PKT_LEN; - pf->tqp_config_mode = HNS3_FLEX_MAX_TQP_NUM_MODE; - hw->rss_info.ipv6_sctp_offload_supported = true; -diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h -index dfe0c59..01561cc 100644 ---- a/drivers/net/hns3/hns3_ethdev.h -+++ b/drivers/net/hns3/hns3_ethdev.h -@@ -426,6 +426,9 @@ struct hns3_queue_intr { - #define HNS3_TSO_SW_CAL_PSEUDO_H_CSUM 0 - #define HNS3_TSO_HW_CAL_PSEUDO_H_CSUM 1 - -+#define HNS3_PKTS_DROP_STATS_MODE1 0 -+#define HNS3_PKTS_DROP_STATS_MODE2 1 -+ - struct hns3_hw { - struct rte_eth_dev_data *data; - void *io_base; -@@ -544,6 +547,24 @@ struct hns3_hw { - * port won't be copied to the function which has set promisc mode. - */ - uint8_t promisc_mode; -+ -+ /* -+ * drop_stats_mode mode. -+ * value range: -+ * HNS3_PKTS_DROP_STATS_MODE1/HNS3_PKTS_DROP_STATS_MODE2 -+ * -+ * - HNS3_PKTS_DROP_STATS_MODE1 -+ * This mode for kunpeng920. In this mode, port level imissed stats -+ * is supported. It only includes RPU drop stats. -+ * -+ * - HNS3_PKTS_DROP_STATS_MODE2 -+ * This mode for kunpeng930. In this mode, imissed stats and oerrors -+ * stats is supported. Function level imissed stats is supported. It -+ * includes RPU drop stats in VF, and includes both RPU drop stats -+ * and SSU drop stats in PF. Oerror stats is also supported in PF. -+ */ -+ uint8_t drop_stats_mode; -+ - uint8_t max_non_tso_bd_num; /* max BD number of one non-TSO packet */ - - struct hns3_port_base_vlan_config port_base_vlan_cfg; -diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c -index 35c42ca..c567dff 100644 ---- a/drivers/net/hns3/hns3_ethdev_vf.c -+++ b/drivers/net/hns3/hns3_ethdev_vf.c -@@ -1221,6 +1221,7 @@ hns3vf_get_capability(struct hns3_hw *hw) - hw->intr.mapping_mode = HNS3_INTR_MAPPING_VEC_RSV_ONE; - hw->intr.gl_unit = HNS3_INTR_COALESCE_GL_UINT_2US; - hw->tso_mode = HNS3_TSO_SW_CAL_PSEUDO_H_CSUM; -+ hw->drop_stats_mode = HNS3_PKTS_DROP_STATS_MODE1; - hw->min_tx_pkt_len = HNS3_HIP08_MIN_TX_PKT_LEN; - hw->rss_info.ipv6_sctp_offload_supported = false; - hw->promisc_mode = HNS3_UNLIMIT_PROMISC_MODE; -@@ -1238,6 +1239,7 @@ hns3vf_get_capability(struct hns3_hw *hw) - hw->intr.mapping_mode = HNS3_INTR_MAPPING_VEC_ALL; - hw->intr.gl_unit = HNS3_INTR_COALESCE_GL_UINT_1US; - hw->tso_mode = HNS3_TSO_HW_CAL_PSEUDO_H_CSUM; -+ hw->drop_stats_mode = HNS3_PKTS_DROP_STATS_MODE2; - hw->min_tx_pkt_len = HNS3_HIP09_MIN_TX_PKT_LEN; - hw->rss_info.ipv6_sctp_offload_supported = true; - hw->promisc_mode = HNS3_LIMIT_PROMISC_MODE; -@@ -1875,6 +1877,13 @@ hns3vf_init_vf(struct rte_eth_dev *eth_dev) - if (ret) - goto err_get_config; - -+ /* Hardware statistics of imissed registers cleared. */ -+ ret = hns3_update_imissed_stats(hw, true); -+ if (ret) { -+ hns3_err(hw, "clear imissed stats failed, ret = %d", ret); -+ goto err_set_tc_queue; -+ } -+ - ret = hns3vf_set_tc_queue_mapping(hns, hw->tqps_num, hw->tqps_num); - if (ret) { - PMD_INIT_LOG(ERR, "failed to set tc info, ret = %d.", ret); -diff --git a/drivers/net/hns3/hns3_regs.h b/drivers/net/hns3/hns3_regs.h -index 0540554..e141fe1 100644 ---- a/drivers/net/hns3/hns3_regs.h -+++ b/drivers/net/hns3/hns3_regs.h -@@ -36,6 +36,8 @@ - #define HNS3_GLOBAL_RESET_REG 0x20A00 - #define HNS3_FUN_RST_ING 0x20C00 - #define HNS3_GRO_EN_REG 0x28000 -+ -+#define HNS3_RPU_DROP_CNT_REG 0x28004 - #define HNS3_RXD_ADV_LAYOUT_EN_REG 0x28008 - - /* Vector0 register bits for reset */ -diff --git a/drivers/net/hns3/hns3_stats.c b/drivers/net/hns3/hns3_stats.c -index 7cda36c..e802c0b 100644 ---- a/drivers/net/hns3/hns3_stats.c -+++ b/drivers/net/hns3/hns3_stats.c -@@ -269,6 +269,8 @@ static const struct hns3_xstats_name_offset hns3_tx_queue_strings[] = { - static const struct hns3_xstats_name_offset hns3_imissed_stats_strings[] = { - {"RPU_DROP_CNT", - HNS3_IMISSED_STATS_FIELD_OFFSET(rpu_rx_drop_cnt)}, -+ {"SSU_DROP_CNT", -+ HNS3_IMISSED_STATS_FIELD_OFFSET(ssu_rx_drop_cnt)}, - }; - - #define HNS3_NUM_MAC_STATS (sizeof(hns3_mac_strings) / \ -@@ -301,8 +303,7 @@ static const struct hns3_xstats_name_offset hns3_imissed_stats_strings[] = { - #define HNS3_NUM_IMISSED_XSTATS (sizeof(hns3_imissed_stats_strings) / \ - sizeof(hns3_imissed_stats_strings[0])) - --#define HNS3_FIX_NUM_STATS (HNS3_NUM_MAC_STATS + \ -- HNS3_NUM_RESET_XSTATS + HNS3_NUM_IMISSED_XSTATS) -+#define HNS3_FIX_NUM_STATS (HNS3_NUM_MAC_STATS + HNS3_NUM_RESET_XSTATS) - - static void hns3_tqp_stats_clear(struct hns3_hw *hw); - -@@ -419,7 +420,7 @@ hns3_query_update_mac_stats(struct rte_eth_dev *dev) - } - - static int --hns3_update_rpu_drop_stats(struct hns3_hw *hw) -+hns3_update_port_rpu_drop_stats(struct hns3_hw *hw) - { - struct hns3_rx_missed_stats *stats = &hw->imissed_stats; - struct hns3_query_rpu_cmd *req; -@@ -449,11 +450,90 @@ hns3_update_rpu_drop_stats(struct hns3_hw *hw) - return 0; - } - -+static void -+hns3_update_function_rpu_drop_stats(struct hns3_hw *hw) -+{ -+ struct hns3_rx_missed_stats *stats = &hw->imissed_stats; -+ -+ stats->rpu_rx_drop_cnt += hns3_read_dev(hw, HNS3_RPU_DROP_CNT_REG); -+} -+ -+static int -+hns3_update_rpu_drop_stats(struct hns3_hw *hw) -+{ -+ struct hns3_adapter *hns = HNS3_DEV_HW_TO_ADAPTER(hw); -+ int ret = 0; -+ -+ if (hw->drop_stats_mode == HNS3_PKTS_DROP_STATS_MODE1 && !hns->is_vf) -+ ret = hns3_update_port_rpu_drop_stats(hw); -+ else if (hw->drop_stats_mode == HNS3_PKTS_DROP_STATS_MODE2) -+ hns3_update_function_rpu_drop_stats(hw); -+ -+ return ret; -+} -+ -+static int -+hns3_get_ssu_drop_stats(struct hns3_hw *hw, struct hns3_cmd_desc *desc, -+ int bd_num, bool is_rx) -+{ -+ struct hns3_query_ssu_cmd *req; -+ int ret; -+ int i; -+ -+ for (i = 0; i < bd_num - 1; i++) { -+ hns3_cmd_setup_basic_desc(&desc[i], -+ HNS3_OPC_SSU_DROP_REG, true); -+ desc[i].flag |= rte_cpu_to_le_16(HNS3_CMD_FLAG_NEXT); -+ } -+ hns3_cmd_setup_basic_desc(&desc[i], HNS3_OPC_SSU_DROP_REG, true); -+ req = (struct hns3_query_ssu_cmd *)desc[0].data; -+ req->rxtx = is_rx ? 0 : 1; -+ ret = hns3_cmd_send(hw, desc, bd_num); -+ -+ return ret; -+} -+ -+static int -+hns3_update_port_rx_ssu_drop_stats(struct hns3_hw *hw) -+{ -+ struct hns3_rx_missed_stats *stats = &hw->imissed_stats; -+ struct hns3_cmd_desc desc[HNS3_OPC_SSU_DROP_REG_NUM]; -+ struct hns3_query_ssu_cmd *req; -+ uint64_t cnt; -+ int ret; -+ -+ ret = hns3_get_ssu_drop_stats(hw, desc, HNS3_OPC_SSU_DROP_REG_NUM, -+ true); -+ if (ret) { -+ hns3_err(hw, "failed to get Rx SSU drop stats, ret = %d", ret); -+ return ret; -+ } -+ -+ req = (struct hns3_query_ssu_cmd *)desc[0].data; -+ cnt = rte_le_to_cpu_32(req->oq_drop_cnt) + -+ rte_le_to_cpu_32(req->full_drop_cnt) + -+ rte_le_to_cpu_32(req->part_drop_cnt); -+ -+ stats->ssu_rx_drop_cnt += cnt; -+ -+ return 0; -+} -+ - int - hns3_update_imissed_stats(struct hns3_hw *hw, bool is_clear) - { -+ struct hns3_adapter *hns = HNS3_DEV_HW_TO_ADAPTER(hw); - int ret; - -+ if (hw->drop_stats_mode == HNS3_PKTS_DROP_STATS_MODE1 && hns->is_vf) -+ return 0; -+ -+ if (hw->drop_stats_mode == HNS3_PKTS_DROP_STATS_MODE2 && !hns->is_vf) { -+ ret = hns3_update_port_rx_ssu_drop_stats(hw); -+ if (ret) -+ return ret; -+ } -+ - ret = hns3_update_rpu_drop_stats(hw); - if (ret) - return ret; -@@ -488,19 +568,17 @@ hns3_stats_get(struct rte_eth_dev *eth_dev, struct rte_eth_stats *rte_stats) - uint16_t i; - int ret; - -- if (!hns->is_vf) { -- /* Update imissed stats */ -- ret = hns3_update_imissed_stats(hw, false); -- if (ret) { -- hns3_err(hw, "update imissed stats failed, ret = %d", -- ret); -- return ret; -- } -- -- rte_stats->imissed = imissed_stats->rpu_rx_drop_cnt; -+ /* Update imissed stats */ -+ ret = hns3_update_imissed_stats(hw, false); -+ if (ret) { -+ hns3_err(hw, "update imissed stats failed, ret = %d", -+ ret); -+ return ret; - } -+ rte_stats->imissed = imissed_stats->rpu_rx_drop_cnt + -+ imissed_stats->ssu_rx_drop_cnt; - -- /* Reads all the stats of a rxq in a loop to keep them synchronized */ -+ /* Get the error stats and bytes of received packets */ - for (i = 0; i < eth_dev->data->nb_rx_queues; i++) { - rxq = eth_dev->data->rx_queues[i]; - if (rxq == NULL) -@@ -556,17 +634,14 @@ hns3_stats_reset(struct rte_eth_dev *eth_dev) - uint16_t i; - int ret; - -- if (!hns->is_vf) { -- /* -- * Note: Reading hardware statistics of imissed registers will -- * clear them. -- */ -- ret = hns3_update_imissed_stats(hw, true); -- if (ret) { -- hns3_err(hw, "clear imissed stats failed, ret = %d", -- ret); -- return ret; -- } -+ /* -+ * Note: Reading hardware statistics of imissed registers will -+ * clear them. -+ */ -+ ret = hns3_update_imissed_stats(hw, true); -+ if (ret) { -+ hns3_err(hw, "clear imissed stats failed, ret = %d", ret); -+ return ret; - } - - for (i = 0; i < eth_dev->data->nb_rx_queues; i++) { -@@ -630,6 +705,22 @@ hns3_mac_stats_reset(__rte_unused struct rte_eth_dev *dev) - return 0; - } - -+static int -+hns3_get_imissed_stats_num(struct hns3_adapter *hns) -+{ -+#define NO_IMISSED_STATS_NUM 0 -+#define RPU_STATS_ITEM_NUM 1 -+ struct hns3_hw *hw = &hns->hw; -+ -+ if (hw->drop_stats_mode == HNS3_PKTS_DROP_STATS_MODE1 && hns->is_vf) -+ return NO_IMISSED_STATS_NUM; -+ -+ if (hw->drop_stats_mode == HNS3_PKTS_DROP_STATS_MODE2 && !hns->is_vf) -+ return HNS3_NUM_IMISSED_XSTATS; -+ -+ return RPU_STATS_ITEM_NUM; -+} -+ - /* This function calculates the number of xstats based on the current config */ - static int - hns3_xstats_calc_num(struct rte_eth_dev *dev) -@@ -647,13 +738,17 @@ hns3_xstats_calc_num(struct rte_eth_dev *dev) - uint16_t nb_tx_q = dev->data->nb_tx_queues; - int rx_comm_stats_num = nb_rx_q * HNS3_PF_VF_RX_COMM_STATS_NUM; - int tx_comm_stats_num = nb_tx_q * HNS3_PF_VF_TX_COMM_STATS_NUM; -+ int stats_num; -+ -+ stats_num = rx_comm_stats_num + tx_comm_stats_num; -+ stats_num += hns3_get_imissed_stats_num(hns); - - if (hns->is_vf) -- return rx_comm_stats_num + tx_comm_stats_num + -- HNS3_NUM_RESET_XSTATS; -+ stats_num += HNS3_NUM_RESET_XSTATS; - else -- return rx_comm_stats_num + tx_comm_stats_num + -- HNS3_FIX_NUM_STATS; -+ stats_num += HNS3_FIX_NUM_STATS; -+ -+ return stats_num; - } - - static void -@@ -835,6 +930,31 @@ hns3_tqp_basic_stats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *xstats, - hns3_txq_basic_stats_get(dev, xstats, count); - } - -+static void -+hns3_imissed_stats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *xstats, -+ int *count) -+{ -+ struct hns3_adapter *hns = dev->data->dev_private; -+ struct hns3_hw *hw = &hns->hw; -+ struct hns3_rx_missed_stats *imissed_stats = &hw->imissed_stats; -+ int imissed_stats_num; -+ int cnt = *count; -+ char *addr; -+ uint16_t i; -+ -+ imissed_stats_num = hns3_get_imissed_stats_num(hns); -+ -+ for (i = 0; i < imissed_stats_num; i++) { -+ addr = (char *)imissed_stats + -+ hns3_imissed_stats_strings[i].offset; -+ xstats[cnt].value = *(uint64_t *)addr; -+ xstats[cnt].id = cnt; -+ cnt++; -+ } -+ -+ *count = cnt; -+} -+ - /* - * Retrieve extended(tqp | Mac) statistics of an Ethernet device. - * @param dev -@@ -854,7 +974,6 @@ hns3_dev_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *xstats, - { - struct hns3_adapter *hns = dev->data->dev_private; - struct hns3_hw *hw = &hns->hw; -- struct hns3_rx_missed_stats *imissed_stats = &hw->imissed_stats; - struct hns3_mac_stats *mac_stats = &hw->mac_stats; - struct hns3_reset_stats *reset_stats = &hw->reset.stats; - struct hns3_rx_bd_errors_stats *rx_err_stats; -@@ -890,24 +1009,17 @@ hns3_dev_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *xstats, - xstats[count].id = count; - count++; - } -+ } - -- ret = hns3_update_imissed_stats(hw, false); -- if (ret) { -- hns3_err(hw, "update imissed stats failed, ret = %d", -- ret); -- return ret; -- } -- -- for (i = 0; i < HNS3_NUM_IMISSED_XSTATS; i++) { -- addr = (char *)imissed_stats + -- hns3_imissed_stats_strings[i].offset; -- xstats[count].value = *(uint64_t *)addr; -- xstats[count].id = count; -- count++; -- } -- -+ ret = hns3_update_imissed_stats(hw, false); -+ if (ret) { -+ hns3_err(hw, "update imissed stats failed, ret = %d", -+ ret); -+ return ret; - } - -+ hns3_imissed_stats_get(dev, xstats, &count); -+ - /* Get the reset stat */ - for (i = 0; i < HNS3_NUM_RESET_XSTATS; i++) { - addr = (char *)reset_stats + hns3_reset_stats_strings[i].offset; -@@ -992,6 +1104,28 @@ hns3_tqp_dfx_stats_name_get(struct rte_eth_dev *dev, - } - } - -+static void -+hns3_imissed_stats_name_get(struct rte_eth_dev *dev, -+ struct rte_eth_xstat_name *xstats_names, -+ uint32_t *count) -+{ -+ struct hns3_adapter *hns = dev->data->dev_private; -+ uint32_t cnt = *count; -+ int imissed_stats_num; -+ uint16_t i; -+ -+ imissed_stats_num = hns3_get_imissed_stats_num(hns); -+ -+ for (i = 0; i < imissed_stats_num; i++) { -+ snprintf(xstats_names[cnt].name, -+ sizeof(xstats_names[cnt].name), -+ "%s", hns3_imissed_stats_strings[i].name); -+ cnt++; -+ } -+ -+ *count = cnt; -+} -+ - /* - * Retrieve names of extended statistics of an Ethernet device. - * -@@ -1040,14 +1174,10 @@ hns3_dev_xstats_get_names(struct rte_eth_dev *dev, - "%s", hns3_mac_strings[i].name); - count++; - } -- -- for (i = 0; i < HNS3_NUM_IMISSED_XSTATS; i++) { -- snprintf(xstats_names[count].name, -- sizeof(xstats_names[count].name), -- "%s", hns3_imissed_stats_strings[i].name); -- count++; -- } - } -+ -+ hns3_imissed_stats_name_get(dev, xstats_names, &count); -+ - for (i = 0; i < HNS3_NUM_RESET_XSTATS; i++) { - snprintf(xstats_names[count].name, - sizeof(xstats_names[count].name), -diff --git a/drivers/net/hns3/hns3_stats.h b/drivers/net/hns3/hns3_stats.h -index 8ea69b4..273be42 100644 ---- a/drivers/net/hns3/hns3_stats.h -+++ b/drivers/net/hns3/hns3_stats.h -@@ -112,6 +112,7 @@ struct hns3_mac_stats { - - struct hns3_rx_missed_stats { - uint64_t rpu_rx_drop_cnt; -+ uint64_t ssu_rx_drop_cnt; - }; - - /* store statistics names and its offset in stats structure */ --- -2.7.4 - diff --git a/0064-dma-hisilicon-add-queue-full-statistics.patch b/0064-dma-hisilicon-add-queue-full-statistics.patch new file mode 100644 index 0000000000000000000000000000000000000000..8ef63afb486c3a3d0fbfe462efb60f46eebec60b --- /dev/null +++ b/0064-dma-hisilicon-add-queue-full-statistics.patch @@ -0,0 +1,78 @@ +From 410c9bc8354b4cccc3ae56608ca5f89f03e53cb3 Mon Sep 17 00:00:00 2001 +From: Chengwen Feng +Date: Thu, 17 Feb 2022 10:59:10 +0800 +Subject: [PATCH] dma/hisilicon: add queue full statistics + +This patch adds queue full statistics for HiSilicon DMA PMD. + +Signed-off-by: Chengwen Feng +--- + drivers/dma/hisilicon/hisi_dmadev.c | 12 ++++++++---- + drivers/dma/hisilicon/hisi_dmadev.h | 1 + + 2 files changed, 9 insertions(+), 4 deletions(-) + +diff --git a/drivers/dma/hisilicon/hisi_dmadev.c b/drivers/dma/hisilicon/hisi_dmadev.c +index 3917db38b7..c36acf01be 100644 +--- a/drivers/dma/hisilicon/hisi_dmadev.c ++++ b/drivers/dma/hisilicon/hisi_dmadev.c +@@ -407,6 +407,7 @@ hisi_dma_start(struct rte_dma_dev *dev) + hw->submitted = 0; + hw->completed = 0; + hw->errors = 0; ++ hw->qfulls = 0; + + hisi_dma_update_queue_bit(hw, HISI_DMA_QUEUE_CTRL0_REG, + HISI_DMA_QUEUE_CTRL0_EN_B, true); +@@ -455,6 +456,7 @@ hisi_dma_stats_reset(struct rte_dma_dev *dev, uint16_t vchan) + hw->submitted = 0; + hw->completed = 0; + hw->errors = 0; ++ hw->qfulls = 0; + + return 0; + } +@@ -566,14 +568,14 @@ hisi_dma_dump(const struct rte_dma_dev *dev, FILE *f) + " ridx: %u cridx: %u\n" + " sq_head: %u sq_tail: %u cq_sq_head: %u\n" + " cq_head: %u cqs_completed: %u cqe_vld: %u\n" +- " submitted: %" PRIu64 " completed: %" PRIu64 " errors %" +- PRIu64"\n", ++ " submitted: %" PRIu64 " completed: %" PRIu64 " errors: %" ++ PRIu64 " qfulls: %" PRIu64 "\n", + hw->revision, hw->queue_id, + hw->sq_depth_mask > 0 ? hw->sq_depth_mask + 1 : 0, + hw->ridx, hw->cridx, + hw->sq_head, hw->sq_tail, hw->cq_sq_head, + hw->cq_head, hw->cqs_completed, hw->cqe_vld, +- hw->submitted, hw->completed, hw->errors); ++ hw->submitted, hw->completed, hw->errors, hw->qfulls); + hisi_dma_dump_queue(hw, f); + hisi_dma_dump_common(hw, f); + +@@ -590,8 +592,10 @@ hisi_dma_copy(void *dev_private, uint16_t vchan, + + RTE_SET_USED(vchan); + +- if (((hw->sq_tail + 1) & hw->sq_depth_mask) == hw->sq_head) ++ if (((hw->sq_tail + 1) & hw->sq_depth_mask) == hw->sq_head) { ++ hw->qfulls++; + return -ENOSPC; ++ } + + sqe->dw0 = rte_cpu_to_le_32(SQE_OPCODE_M2M); + sqe->dw1 = 0; +diff --git a/drivers/dma/hisilicon/hisi_dmadev.h b/drivers/dma/hisilicon/hisi_dmadev.h +index 1eaa822db1..90b85322ca 100644 +--- a/drivers/dma/hisilicon/hisi_dmadev.h ++++ b/drivers/dma/hisilicon/hisi_dmadev.h +@@ -241,6 +241,7 @@ struct hisi_dma_dev { + uint64_t submitted; + uint64_t completed; + uint64_t errors; ++ uint64_t qfulls; + + /** + * The following fields are not accessed in the I/O path, so they are +-- +2.33.0 + diff --git a/0064-net-hns3-support-oerrors-stats-in-PF.patch b/0064-net-hns3-support-oerrors-stats-in-PF.patch deleted file mode 100644 index d92c24d6e6f46330890bdd163f3cb668610dc49e..0000000000000000000000000000000000000000 --- a/0064-net-hns3-support-oerrors-stats-in-PF.patch +++ /dev/null @@ -1,124 +0,0 @@ -From afd493a7e66236c538bf9ab7feb332200cbd2e76 Mon Sep 17 00:00:00 2001 -From: "Min Hu (Connor)" -Date: Tue, 23 Mar 2021 19:21:05 +0800 -Subject: [PATCH 064/189] net/hns3: support oerrors stats in PF - -This patch added oerrors stats for PF in kunpeng930. - -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_ethdev.h | 1 + - drivers/net/hns3/hns3_stats.c | 64 +++++++++++++++++++++++++++++++++++++++++- - 2 files changed, 64 insertions(+), 1 deletion(-) - -diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h -index 01561cc..6800ee0 100644 ---- a/drivers/net/hns3/hns3_ethdev.h -+++ b/drivers/net/hns3/hns3_ethdev.h -@@ -443,6 +443,7 @@ struct hns3_hw { - /* Include Mac stats | Rx stats | Tx stats */ - struct hns3_mac_stats mac_stats; - struct hns3_rx_missed_stats imissed_stats; -+ uint64_t oerror_stats; - uint32_t fw_version; - - uint16_t num_msi; -diff --git a/drivers/net/hns3/hns3_stats.c b/drivers/net/hns3/hns3_stats.c -index e802c0b..1af689f 100644 ---- a/drivers/net/hns3/hns3_stats.c -+++ b/drivers/net/hns3/hns3_stats.c -@@ -519,6 +519,31 @@ hns3_update_port_rx_ssu_drop_stats(struct hns3_hw *hw) - return 0; - } - -+static int -+hns3_update_port_tx_ssu_drop_stats(struct hns3_hw *hw) -+{ -+ struct hns3_cmd_desc desc[HNS3_OPC_SSU_DROP_REG_NUM]; -+ struct hns3_query_ssu_cmd *req; -+ uint64_t cnt; -+ int ret; -+ -+ ret = hns3_get_ssu_drop_stats(hw, desc, HNS3_OPC_SSU_DROP_REG_NUM, -+ false); -+ if (ret) { -+ hns3_err(hw, "failed to get Tx SSU drop stats, ret = %d", ret); -+ return ret; -+ } -+ -+ req = (struct hns3_query_ssu_cmd *)desc[0].data; -+ cnt = rte_le_to_cpu_32(req->oq_drop_cnt) + -+ rte_le_to_cpu_32(req->full_drop_cnt) + -+ rte_le_to_cpu_32(req->part_drop_cnt); -+ -+ hw->oerror_stats += cnt; -+ -+ return 0; -+} -+ - int - hns3_update_imissed_stats(struct hns3_hw *hw, bool is_clear) - { -@@ -544,6 +569,25 @@ hns3_update_imissed_stats(struct hns3_hw *hw, bool is_clear) - return 0; - } - -+static int -+hns3_update_oerror_stats(struct hns3_hw *hw, bool is_clear) -+{ -+ struct hns3_adapter *hns = HNS3_DEV_HW_TO_ADAPTER(hw); -+ int ret; -+ -+ if (hw->drop_stats_mode == HNS3_PKTS_DROP_STATS_MODE1 || hns->is_vf) -+ return 0; -+ -+ ret = hns3_update_port_tx_ssu_drop_stats(hw); -+ if (ret) -+ return ret; -+ -+ if (is_clear) -+ hw->oerror_stats = 0; -+ -+ return 0; -+} -+ - /* - * Query tqp tx queue statistics ,opcode id: 0x0B03. - * Query tqp rx queue statistics ,opcode id: 0x0B13. -@@ -608,7 +652,14 @@ hns3_stats_get(struct rte_eth_dev *eth_dev, struct rte_eth_stats *rte_stats) - rte_stats->obytes += txq->basic_stats.bytes; - } - -- rte_stats->oerrors = 0; -+ ret = hns3_update_oerror_stats(hw, false); -+ if (ret) { -+ hns3_err(hw, "update oerror stats failed, ret = %d", -+ ret); -+ return ret; -+ } -+ rte_stats->oerrors = hw->oerror_stats; -+ - /* - * If HW statistics are reset by stats_reset, but a lot of residual - * packets exist in the hardware queue and these packets are error -@@ -644,6 +695,17 @@ hns3_stats_reset(struct rte_eth_dev *eth_dev) - return ret; - } - -+ /* -+ * Note: Reading hardware statistics of oerror registers will -+ * clear them. -+ */ -+ ret = hns3_update_oerror_stats(hw, true); -+ if (ret) { -+ hns3_err(hw, "clear oerror stats failed, ret = %d", -+ ret); -+ return ret; -+ } -+ - for (i = 0; i < eth_dev->data->nb_rx_queues; i++) { - rxq = eth_dev->data->rx_queues[i]; - if (rxq == NULL) --- -2.7.4 - diff --git a/0065-dma-hisilicon-use-common-PCI-device-naming.patch b/0065-dma-hisilicon-use-common-PCI-device-naming.patch new file mode 100644 index 0000000000000000000000000000000000000000..7dffe6f389e50f2ba0a7a4a9ac111744d4c3ba7e --- /dev/null +++ b/0065-dma-hisilicon-use-common-PCI-device-naming.patch @@ -0,0 +1,79 @@ +From 033904450b1d52fd3d09e2bb53e529e3ba0ecf77 Mon Sep 17 00:00:00 2001 +From: Chengwen Feng +Date: Thu, 17 Feb 2022 10:59:11 +0800 +Subject: [PATCH] dma/hisilicon: use common PCI device naming + +For DMA device 0000:7d:0.0, the original generated dmadev name starts +with the "7d:0.0", which is not expected. +This patch uses rte_pci_device_name API to generates the dmadev name. + +Cc: stable@dpdk.org + +Signed-off-by: Chengwen Feng +--- + doc/guides/dmadevs/hisilicon.rst | 4 ++-- + drivers/dma/hisilicon/hisi_dmadev.c | 23 +++++++---------------- + 2 files changed, 9 insertions(+), 18 deletions(-) + +diff --git a/doc/guides/dmadevs/hisilicon.rst b/doc/guides/dmadevs/hisilicon.rst +index 81bf090311..8c1f0f8886 100644 +--- a/doc/guides/dmadevs/hisilicon.rst ++++ b/doc/guides/dmadevs/hisilicon.rst +@@ -30,8 +30,8 @@ which can be accessed using API from the ``rte_dmadev`` library. + + The name of the ``dmadev`` created is like "B:D.F-chX", e.g. DMA 0000:7b:00.0 + will create four ``dmadev``, +-the 1st ``dmadev`` name is "7b:00.0-ch0", +-and the 2nd ``dmadev`` name is "7b:00.0-ch1". ++the 1st ``dmadev`` name is "0000:7b:00.0-ch0", ++and the 2nd ``dmadev`` name is "0000:7b:00.0-ch1". + + Device Configuration + ~~~~~~~~~~~~~~~~~~~~~ +diff --git a/drivers/dma/hisilicon/hisi_dmadev.c b/drivers/dma/hisilicon/hisi_dmadev.c +index c36acf01be..9cef2cbfbe 100644 +--- a/drivers/dma/hisilicon/hisi_dmadev.c ++++ b/drivers/dma/hisilicon/hisi_dmadev.c +@@ -784,24 +784,15 @@ hisi_dma_burst_capacity(const void *dev_private, uint16_t vchan) + sq_head - 1 - sq_tail; + } + +-static void +-hisi_dma_gen_pci_device_name(const struct rte_pci_device *pci_dev, +- char *name, size_t size) +-{ +- memset(name, 0, size); +- (void)snprintf(name, size, "%x:%x.%x", +- pci_dev->addr.bus, pci_dev->addr.devid, +- pci_dev->addr.function); +-} +- + static void + hisi_dma_gen_dev_name(const struct rte_pci_device *pci_dev, +- uint8_t queue_id, char *name, size_t size) ++ uint8_t queue_id, char *dev_name, size_t size) + { +- memset(name, 0, size); +- (void)snprintf(name, size, "%x:%x.%x-ch%u", +- pci_dev->addr.bus, pci_dev->addr.devid, +- pci_dev->addr.function, queue_id); ++ char name[RTE_DEV_NAME_MAX_LEN] = { 0 }; ++ ++ memset(dev_name, 0, size); ++ rte_pci_device_name(&pci_dev->addr, name, sizeof(name)); ++ (void)snprintf(dev_name, size, "%s-ch%u", name, queue_id); + } + + /** +@@ -917,7 +908,7 @@ hisi_dma_probe(struct rte_pci_driver *pci_drv __rte_unused, + uint8_t i; + int ret; + +- hisi_dma_gen_pci_device_name(pci_dev, name, sizeof(name)); ++ rte_pci_device_name(&pci_dev->addr, name, sizeof(name)); + + if (pci_dev->mem_resource[2].addr == NULL) { + HISI_DMA_LOG(ERR, "%s BAR2 is NULL!\n", name); +-- +2.33.0 + diff --git a/0065-net-hns3-support-Tx-descriptor-status-query.patch b/0065-net-hns3-support-Tx-descriptor-status-query.patch deleted file mode 100644 index 6ca2ecbc3c37ba5d941eb090e0962097af3842c8..0000000000000000000000000000000000000000 --- a/0065-net-hns3-support-Tx-descriptor-status-query.patch +++ /dev/null @@ -1,128 +0,0 @@ -From 71c308ebc61180d6f7a65c9f4dfdfc5e6d1fb782 Mon Sep 17 00:00:00 2001 -From: Hongbo Zheng -Date: Tue, 23 Mar 2021 19:21:06 +0800 -Subject: [PATCH 065/189] net/hns3: support Tx descriptor status query - -Add support for query Tx descriptor status in hns3 driver. Check the -descriptor specified and provide the status information of the -corresponding descriptor. - -Signed-off-by: Hongbo Zheng -Signed-off-by: Min Hu (Connor) ---- - doc/guides/nics/features/hns3.ini | 1 + - doc/guides/nics/features/hns3_vf.ini | 1 + - drivers/net/hns3/hns3_ethdev.c | 1 + - drivers/net/hns3/hns3_ethdev_vf.c | 1 + - drivers/net/hns3/hns3_rxtx.c | 28 ++++++++++++++++++++++++++++ - drivers/net/hns3/hns3_rxtx.h | 1 + - 6 files changed, 33 insertions(+) - -diff --git a/doc/guides/nics/features/hns3.ini b/doc/guides/nics/features/hns3.ini -index 00a26cd..445d391 100644 ---- a/doc/guides/nics/features/hns3.ini -+++ b/doc/guides/nics/features/hns3.ini -@@ -34,6 +34,7 @@ L4 checksum offload = Y - Inner L3 checksum = Y - Inner L4 checksum = Y - Packet type parsing = Y -+Tx descriptor status = Y - Basic stats = Y - Extended stats = Y - Stats per queue = Y -diff --git a/doc/guides/nics/features/hns3_vf.ini b/doc/guides/nics/features/hns3_vf.ini -index f3dd239..eb55b4f 100644 ---- a/doc/guides/nics/features/hns3_vf.ini -+++ b/doc/guides/nics/features/hns3_vf.ini -@@ -32,6 +32,7 @@ L4 checksum offload = Y - Inner L3 checksum = Y - Inner L4 checksum = Y - Packet type parsing = Y -+Tx descriptor status = Y - Basic stats = Y - Extended stats = Y - Stats per queue = Y -diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c -index b5057da..5b07183 100644 ---- a/drivers/net/hns3/hns3_ethdev.c -+++ b/drivers/net/hns3/hns3_ethdev.c -@@ -6774,6 +6774,7 @@ hns3_dev_init(struct rte_eth_dev *eth_dev) - eth_dev->rx_pkt_burst = NULL; - eth_dev->tx_pkt_burst = NULL; - eth_dev->tx_pkt_prepare = NULL; -+ eth_dev->tx_descriptor_status = NULL; - rte_free(eth_dev->process_private); - eth_dev->process_private = NULL; - return ret; -diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c -index c567dff..2688c19 100644 ---- a/drivers/net/hns3/hns3_ethdev_vf.c -+++ b/drivers/net/hns3/hns3_ethdev_vf.c -@@ -2917,6 +2917,7 @@ hns3vf_dev_init(struct rte_eth_dev *eth_dev) - eth_dev->rx_pkt_burst = NULL; - eth_dev->tx_pkt_burst = NULL; - eth_dev->tx_pkt_prepare = NULL; -+ eth_dev->tx_descriptor_status = NULL; - rte_free(eth_dev->process_private); - eth_dev->process_private = NULL; - -diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c -index 404c403..efdb49a 100644 ---- a/drivers/net/hns3/hns3_rxtx.c -+++ b/drivers/net/hns3/hns3_rxtx.c -@@ -4044,6 +4044,7 @@ void hns3_set_rxtx_function(struct rte_eth_dev *eth_dev) - eth_dev->rx_pkt_burst = hns3_get_rx_function(eth_dev); - eth_dev->tx_pkt_burst = hns3_get_tx_function(eth_dev, &prep); - eth_dev->tx_pkt_prepare = prep; -+ eth_dev->tx_descriptor_status = hns3_dev_tx_descriptor_status; - } else { - eth_dev->rx_pkt_burst = hns3_dummy_rxtx_burst; - eth_dev->tx_pkt_burst = hns3_dummy_rxtx_burst; -@@ -4256,6 +4257,33 @@ hns3_tx_done_cleanup(void *txq, uint32_t free_cnt) - return -ENOTSUP; - } - -+int -+hns3_dev_tx_descriptor_status(void *tx_queue, uint16_t offset) -+{ -+ volatile struct hns3_desc *txdp; -+ struct hns3_tx_queue *txq; -+ struct rte_eth_dev *dev; -+ uint16_t desc_id; -+ -+ txq = (struct hns3_tx_queue *)tx_queue; -+ if (offset >= txq->nb_tx_desc) -+ return -EINVAL; -+ -+ dev = &rte_eth_devices[txq->port_id]; -+ if (dev->tx_pkt_burst != hns3_xmit_pkts_simple && -+ dev->tx_pkt_burst != hns3_xmit_pkts && -+ dev->tx_pkt_burst != hns3_xmit_pkts_vec_sve && -+ dev->tx_pkt_burst != hns3_xmit_pkts_vec) -+ return RTE_ETH_TX_DESC_UNAVAIL; -+ -+ desc_id = (txq->next_to_use + offset) % txq->nb_tx_desc; -+ txdp = &txq->tx_ring[desc_id]; -+ if (txdp->tx.tp_fe_sc_vld_ra_ri & rte_cpu_to_le_16(BIT(HNS3_TXD_VLD_B))) -+ return RTE_ETH_TX_DESC_FULL; -+ else -+ return RTE_ETH_TX_DESC_DONE; -+} -+ - uint32_t - hns3_rx_queue_count(struct rte_eth_dev *dev, uint16_t rx_queue_id) - { -diff --git a/drivers/net/hns3/hns3_rxtx.h b/drivers/net/hns3/hns3_rxtx.h -index cd04200..82d5aa0 100644 ---- a/drivers/net/hns3/hns3_rxtx.h -+++ b/drivers/net/hns3/hns3_rxtx.h -@@ -720,5 +720,6 @@ void hns3_stop_all_txqs(struct rte_eth_dev *dev); - void hns3_restore_tqp_enable_state(struct hns3_hw *hw); - int hns3_tx_done_cleanup(void *txq, uint32_t free_cnt); - void hns3_enable_rxd_adv_layout(struct hns3_hw *hw); -+int hns3_dev_tx_descriptor_status(void *tx_queue, uint16_t offset); - - #endif /* _HNS3_RXTX_H_ */ --- -2.7.4 - diff --git a/0066-app-testpmd-check-starting-port-is-not-in-bonding.patch b/0066-app-testpmd-check-starting-port-is-not-in-bonding.patch new file mode 100644 index 0000000000000000000000000000000000000000..a9f5f5360040e5ba54bbc2bc5605d6e1f7b01af4 --- /dev/null +++ b/0066-app-testpmd-check-starting-port-is-not-in-bonding.patch @@ -0,0 +1,38 @@ +From d8c079a572f3b76ca22fbfe665fb2e5e578ba881 Mon Sep 17 00:00:00 2001 +From: "Min Hu (Connor)" +Date: Thu, 17 Feb 2022 19:36:55 +0800 +Subject: [PATCH] app/testpmd: check starting port is not in bonding + +In bond, start or stop slave port should be operated by bonding port. +This patch add port_is_bonding_slave in start_port function. + +Fixes: 0e545d3047fe ("app/testpmd: check stopping port is not in bonding") +Cc: stable@dpdk.org + +Signed-off-by: Min Hu (Connor) +Reviewed-by: Ferruh Yigit +--- + app/test-pmd/testpmd.c | 7 +++++++ + 1 file changed, 7 insertions(+) + +diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c +index 6d2e52c790..fe2ce19f99 100644 +--- a/app/test-pmd/testpmd.c ++++ b/app/test-pmd/testpmd.c +@@ -2726,6 +2726,13 @@ start_port(portid_t pid) + if (pid != pi && pid != (portid_t)RTE_PORT_ALL) + continue; + ++ if (port_is_bonding_slave(pi)) { ++ fprintf(stderr, ++ "Please remove port %d from bonded device.\n", ++ pi); ++ continue; ++ } ++ + need_check_link_status = 0; + port = &ports[pi]; + if (port->port_status == RTE_PORT_STOPPED) +-- +2.33.0 + diff --git a/0066-net-hns3-support-Rx-descriptor-status-query.patch b/0066-net-hns3-support-Rx-descriptor-status-query.patch deleted file mode 100644 index 792e8466b5cb809ef3e6485ba3b8c026d1e5404d..0000000000000000000000000000000000000000 --- a/0066-net-hns3-support-Rx-descriptor-status-query.patch +++ /dev/null @@ -1,137 +0,0 @@ -From d29daf59b08c1314190c6d1cab0e22ee176b6c0f Mon Sep 17 00:00:00 2001 -From: Hongbo Zheng -Date: Tue, 23 Mar 2021 19:21:07 +0800 -Subject: [PATCH 066/189] net/hns3: support Rx descriptor status query - -Add support for query Rx descriptor status in hns3 driver. Check the -descriptor specified and provide the status information of the -corresponding descriptor. - -Signed-off-by: Hongbo Zheng -Signed-off-by: Min Hu (Connor) ---- - doc/guides/nics/features/hns3.ini | 1 + - doc/guides/nics/features/hns3_vf.ini | 1 + - drivers/net/hns3/hns3_ethdev.c | 1 + - drivers/net/hns3/hns3_ethdev_vf.c | 1 + - drivers/net/hns3/hns3_rxtx.c | 36 ++++++++++++++++++++++++++++++++++++ - drivers/net/hns3/hns3_rxtx.h | 1 + - 6 files changed, 41 insertions(+) - -diff --git a/doc/guides/nics/features/hns3.ini b/doc/guides/nics/features/hns3.ini -index 445d391..d407b2f 100644 ---- a/doc/guides/nics/features/hns3.ini -+++ b/doc/guides/nics/features/hns3.ini -@@ -34,6 +34,7 @@ L4 checksum offload = Y - Inner L3 checksum = Y - Inner L4 checksum = Y - Packet type parsing = Y -+Rx descriptor status = Y - Tx descriptor status = Y - Basic stats = Y - Extended stats = Y -diff --git a/doc/guides/nics/features/hns3_vf.ini b/doc/guides/nics/features/hns3_vf.ini -index eb55b4f..a0fd56d 100644 ---- a/doc/guides/nics/features/hns3_vf.ini -+++ b/doc/guides/nics/features/hns3_vf.ini -@@ -33,6 +33,7 @@ Inner L3 checksum = Y - Inner L4 checksum = Y - Packet type parsing = Y - Tx descriptor status = Y -+Rx descriptor status = Y - Basic stats = Y - Extended stats = Y - Stats per queue = Y -diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c -index 5b07183..12cc3ac 100644 ---- a/drivers/net/hns3/hns3_ethdev.c -+++ b/drivers/net/hns3/hns3_ethdev.c -@@ -6772,6 +6772,7 @@ hns3_dev_init(struct rte_eth_dev *eth_dev) - err_mp_init_secondary: - eth_dev->dev_ops = NULL; - eth_dev->rx_pkt_burst = NULL; -+ eth_dev->rx_descriptor_status = NULL; - eth_dev->tx_pkt_burst = NULL; - eth_dev->tx_pkt_prepare = NULL; - eth_dev->tx_descriptor_status = NULL; -diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c -index 2688c19..6404264 100644 ---- a/drivers/net/hns3/hns3_ethdev_vf.c -+++ b/drivers/net/hns3/hns3_ethdev_vf.c -@@ -2915,6 +2915,7 @@ hns3vf_dev_init(struct rte_eth_dev *eth_dev) - err_mp_init_secondary: - eth_dev->dev_ops = NULL; - eth_dev->rx_pkt_burst = NULL; -+ eth_dev->rx_descriptor_status = NULL; - eth_dev->tx_pkt_burst = NULL; - eth_dev->tx_pkt_prepare = NULL; - eth_dev->tx_descriptor_status = NULL; -diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c -index efdb49a..6a7c360 100644 ---- a/drivers/net/hns3/hns3_rxtx.c -+++ b/drivers/net/hns3/hns3_rxtx.c -@@ -4042,6 +4042,7 @@ void hns3_set_rxtx_function(struct rte_eth_dev *eth_dev) - if (hns->hw.adapter_state == HNS3_NIC_STARTED && - __atomic_load_n(&hns->hw.reset.resetting, __ATOMIC_RELAXED) == 0) { - eth_dev->rx_pkt_burst = hns3_get_rx_function(eth_dev); -+ eth_dev->rx_descriptor_status = hns3_dev_rx_descriptor_status; - eth_dev->tx_pkt_burst = hns3_get_tx_function(eth_dev, &prep); - eth_dev->tx_pkt_prepare = prep; - eth_dev->tx_descriptor_status = hns3_dev_tx_descriptor_status; -@@ -4258,6 +4259,41 @@ hns3_tx_done_cleanup(void *txq, uint32_t free_cnt) - } - - int -+hns3_dev_rx_descriptor_status(void *rx_queue, uint16_t offset) -+{ -+ volatile struct hns3_desc *rxdp; -+ struct hns3_rx_queue *rxq; -+ struct rte_eth_dev *dev; -+ uint32_t bd_base_info; -+ uint16_t desc_id; -+ -+ rxq = (struct hns3_rx_queue *)rx_queue; -+ if (offset >= rxq->nb_rx_desc) -+ return -EINVAL; -+ -+ desc_id = (rxq->next_to_use + offset) % rxq->nb_rx_desc; -+ rxdp = &rxq->rx_ring[desc_id]; -+ bd_base_info = rte_le_to_cpu_32(rxdp->rx.bd_base_info); -+ dev = &rte_eth_devices[rxq->port_id]; -+ if (dev->rx_pkt_burst == hns3_recv_pkts || -+ dev->rx_pkt_burst == hns3_recv_scattered_pkts) { -+ if (offset >= rxq->nb_rx_desc - rxq->rx_free_hold) -+ return RTE_ETH_RX_DESC_UNAVAIL; -+ } else if (dev->rx_pkt_burst == hns3_recv_pkts_vec || -+ dev->rx_pkt_burst == hns3_recv_pkts_vec_sve){ -+ if (offset >= rxq->nb_rx_desc - rxq->rx_rearm_nb) -+ return RTE_ETH_RX_DESC_UNAVAIL; -+ } else { -+ return RTE_ETH_RX_DESC_UNAVAIL; -+ } -+ -+ if (!(bd_base_info & BIT(HNS3_RXD_VLD_B))) -+ return RTE_ETH_RX_DESC_AVAIL; -+ else -+ return RTE_ETH_RX_DESC_DONE; -+} -+ -+int - hns3_dev_tx_descriptor_status(void *tx_queue, uint16_t offset) - { - volatile struct hns3_desc *txdp; -diff --git a/drivers/net/hns3/hns3_rxtx.h b/drivers/net/hns3/hns3_rxtx.h -index 82d5aa0..f9b3048 100644 ---- a/drivers/net/hns3/hns3_rxtx.h -+++ b/drivers/net/hns3/hns3_rxtx.h -@@ -720,6 +720,7 @@ void hns3_stop_all_txqs(struct rte_eth_dev *dev); - void hns3_restore_tqp_enable_state(struct hns3_hw *hw); - int hns3_tx_done_cleanup(void *txq, uint32_t free_cnt); - void hns3_enable_rxd_adv_layout(struct hns3_hw *hw); -+int hns3_dev_rx_descriptor_status(void *rx_queue, uint16_t offset); - int hns3_dev_tx_descriptor_status(void *tx_queue, uint16_t offset); - - #endif /* _HNS3_RXTX_H_ */ --- -2.7.4 - diff --git a/0067-examples-vhost-remove-DMA-type-option-help-info.patch b/0067-examples-vhost-remove-DMA-type-option-help-info.patch new file mode 100644 index 0000000000000000000000000000000000000000..42606cc742e6a7f28764b0f3af998fdfbf8b91b8 --- /dev/null +++ b/0067-examples-vhost-remove-DMA-type-option-help-info.patch @@ -0,0 +1,32 @@ +From 73d16d660b866aa209dcdc44a698427dac5f2eb7 Mon Sep 17 00:00:00 2001 +From: Chengwen Feng +Date: Thu, 17 Feb 2022 11:24:51 +0800 +Subject: [PATCH] examples/vhost: remove DMA type option help info + +The dma-type parameter was not supported when dmadev was +integrated in vhost, but the help info still exists. This +patch deletes it. + +Fixes: 53d3f4778c1d ("vhost: integrate dmadev in asynchronous data-path") + +Signed-off-by: Chengwen Feng +Reviewed-by: Chenbo Xia +--- + examples/vhost/main.c | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/examples/vhost/main.c b/examples/vhost/main.c +index 3e784f5c6f..68afd398bb 100644 +--- a/examples/vhost/main.c ++++ b/examples/vhost/main.c +@@ -608,7 +608,6 @@ us_vhost_usage(const char *prgname) + " --tx-csum [0|1] disable/enable TX checksum offload.\n" + " --tso [0|1] disable/enable TCP segment offload.\n" + " --client register a vhost-user socket as client mode.\n" +- " --dma-type register dma type for your vhost async driver. For example \"ioat\" for now.\n" + " --dmas register dma channel for specific vhost device.\n", + prgname); + } +-- +2.33.0 + diff --git a/0067-net-hns3-fix-reporting-undefined-speed.patch b/0067-net-hns3-fix-reporting-undefined-speed.patch deleted file mode 100644 index 7a9d92deba43160f9b58fc03c2e2c1c9d3103f03..0000000000000000000000000000000000000000 --- a/0067-net-hns3-fix-reporting-undefined-speed.patch +++ /dev/null @@ -1,57 +0,0 @@ -From 3a77c6eecf9089843c3f4452139c07ffe5c6823d Mon Sep 17 00:00:00 2001 -From: Huisong Li -Date: Tue, 23 Mar 2021 21:45:51 +0800 -Subject: [PATCH 067/189] net/hns3: fix reporting undefined speed - -There may be a case in future that the speed obtained from firmware -is undefined (such as, 400G or other rate), and link status of device is -up. At this case, PMD driver will reports 100Mbps to the user in the -"hns3_dev_link_update" API, which is unreasonable. Besides, if the -speed from firmware is zero, driver should report zero instead of -100Mbps. - -Fixes: 59fad0f32135 ("net/hns3: support link update operation") -Cc: stable@dpdk.org - -Signed-off-by: Huisong Li -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_ethdev.c | 5 ++++- - drivers/net/hns3/hns3_ethdev_vf.c | 5 ++++- - 2 files changed, 8 insertions(+), 2 deletions(-) - -diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c -index 12cc3ac..55e2f07 100644 ---- a/drivers/net/hns3/hns3_ethdev.c -+++ b/drivers/net/hns3/hns3_ethdev.c -@@ -2725,7 +2725,10 @@ hns3_dev_link_update(struct rte_eth_dev *eth_dev, - new_link.link_speed = mac->link_speed; - break; - default: -- new_link.link_speed = ETH_SPEED_NUM_100M; -+ if (mac->link_status) -+ new_link.link_speed = ETH_SPEED_NUM_UNKNOWN; -+ else -+ new_link.link_speed = ETH_SPEED_NUM_NONE; - break; - } - -diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c -index 6404264..26f0698 100644 ---- a/drivers/net/hns3/hns3_ethdev_vf.c -+++ b/drivers/net/hns3/hns3_ethdev_vf.c -@@ -2123,7 +2123,10 @@ hns3vf_dev_link_update(struct rte_eth_dev *eth_dev, - new_link.link_speed = mac->link_speed; - break; - default: -- new_link.link_speed = ETH_SPEED_NUM_100M; -+ if (mac->link_status) -+ new_link.link_speed = ETH_SPEED_NUM_UNKNOWN; -+ else -+ new_link.link_speed = ETH_SPEED_NUM_NONE; - break; - } - --- -2.7.4 - diff --git a/0068-kni-fix-freeing-order-in-device-release.patch b/0068-kni-fix-freeing-order-in-device-release.patch new file mode 100644 index 0000000000000000000000000000000000000000..c237f6525c5260a6ebfc2500742786c06333554f --- /dev/null +++ b/0068-kni-fix-freeing-order-in-device-release.patch @@ -0,0 +1,169 @@ +From d57f2899e29a74fffeb876863e1f570084d6437b Mon Sep 17 00:00:00 2001 +From: Huisong Li +Date: Wed, 9 Feb 2022 15:35:25 +0800 +Subject: [PATCH] kni: fix freeing order in device release + +The "kni_dev" is the private data of the "net_device" in kni, and allocated +with the "net_device" by calling "alloc_netdev()". The "net_device" is +freed by calling "free_netdev()" when kni release. The freed memory +includes the "kni_dev". So after "kni_dev" should not be accessed after +"net_device" is released. + +Fixes: e77fec694936 ("kni: fix possible mbuf leaks and speed up port release") +Cc: stable@dpdk.org + +KASAN trace: + +[ 85.263717] ========================================================== +[ 85.264418] BUG: KASAN: use-after-free in kni_net_release_fifo_phy+ + 0x30/0x84 [rte_kni] +[ 85.265139] Read of size 8 at addr ffff000260668d60 by task kni/341 +[ 85.265703] +[ 85.265857] CPU: 0 PID: 341 Comm: kni Tainted: G U O + 5.15.0-rc4+ #1 +[ 85.266525] Hardware name: linux,dummy-virt (DT) +[ 85.266968] Call trace: +[ 85.267220] dump_backtrace+0x0/0x2d0 +[ 85.267591] show_stack+0x24/0x30 +[ 85.267924] dump_stack_lvl+0x8c/0xb8 +[ 85.268294] print_address_description.constprop.0+0x74/0x2b8 +[ 85.268855] kasan_report+0x1e4/0x200 +[ 85.269224] __asan_load8+0x98/0xd4 +[ 85.269577] kni_net_release_fifo_phy+0x30/0x84 [rte_kni] +[ 85.270116] kni_dev_remove.isra.0+0x50/0x64 [rte_kni] +[ 85.270630] kni_ioctl_release+0x254/0x320 [rte_kni] +[ 85.271136] kni_ioctl+0x64/0xb0 [rte_kni] +[ 85.271553] __arm64_sys_ioctl+0xdc/0x120 +[ 85.271955] invoke_syscall+0x68/0x1a0 +[ 85.272332] el0_svc_common.constprop.0+0x90/0x200 +[ 85.272807] do_el0_svc+0x94/0xa4 +[ 85.273144] el0_svc+0x78/0x240 +[ 85.273463] el0t_64_sync_handler+0x1a8/0x1b0 +[ 85.273895] el0t_64_sync+0x1a0/0x1a4 +[ 85.274264] +[ 85.274427] Allocated by task 341: +[ 85.274767] kasan_save_stack+0x2c/0x60 +[ 85.275157] __kasan_kmalloc+0x90/0xb4 +[ 85.275533] __kmalloc_node+0x230/0x594 +[ 85.275917] kvmalloc_node+0x8c/0x190 +[ 85.276286] alloc_netdev_mqs+0x70/0x6b0 +[ 85.276678] kni_ioctl_create+0x224/0xf40 [rte_kni] +[ 85.277166] kni_ioctl+0x9c/0xb0 [rte_kni] +[ 85.277581] __arm64_sys_ioctl+0xdc/0x120 +[ 85.277980] invoke_syscall+0x68/0x1a0 +[ 85.278357] el0_svc_common.constprop.0+0x90/0x200 +[ 85.278830] do_el0_svc+0x94/0xa4 +[ 85.279172] el0_svc+0x78/0x240 +[ 85.279491] el0t_64_sync_handler+0x1a8/0x1b0 +[ 85.279925] el0t_64_sync+0x1a0/0x1a4 +[ 85.280292] +[ 85.280454] Freed by task 341: +[ 85.280763] kasan_save_stack+0x2c/0x60 +[ 85.281147] kasan_set_track+0x2c/0x40 +[ 85.281522] kasan_set_free_info+0x2c/0x50 +[ 85.281930] __kasan_slab_free+0xdc/0x140 +[ 85.282331] slab_free_freelist_hook+0x90/0x250 +[ 85.282782] kfree+0x128/0x580 +[ 85.283099] kvfree+0x48/0x60 +[ 85.283402] netdev_freemem+0x34/0x44 +[ 85.283770] netdev_release+0x50/0x64 +[ 85.284138] device_release+0xa0/0x120 +[ 85.284516] kobject_put+0xf8/0x160 +[ 85.284867] put_device+0x20/0x30 +[ 85.285204] free_netdev+0x22c/0x310 +[ 85.285562] kni_dev_remove.isra.0+0x48/0x64 [rte_kni] +[ 85.286076] kni_ioctl_release+0x254/0x320 [rte_kni] +[ 85.286573] kni_ioctl+0x64/0xb0 [rte_kni] +[ 85.286992] __arm64_sys_ioctl+0xdc/0x120 +[ 85.287392] invoke_syscall+0x68/0x1a0 +[ 85.287769] el0_svc_common.constprop.0+0x90/0x200 +[ 85.288243] do_el0_svc+0x94/0xa4 +[ 85.288579] el0_svc+0x78/0x240 +[ 85.288899] el0t_64_sync_handler+0x1a8/0x1b0 +[ 85.289332] el0t_64_sync+0x1a0/0x1a4 +[ 85.289699] +[ 85.289862] The buggy address belongs to the object at ffff000260668000 +[ 85.289862] which belongs to the cache kmalloc-cg-8k of size 8192 +[ 85.291079] The buggy address is located 3424 bytes inside of +[ 85.291079] 8192-byte region [ffff000260668000, ffff00026066a000) +[ 85.292213] The buggy address belongs to the page: +[ 85.292684] page:(____ptrval____) refcount:1 mapcount:0 mapping: + 0000000000000000 index:0x0 pfn:0x2a0668 +[ 85.293585] head:(____ptrval____) order:3 compound_mapcount:0 + compound_pincount:0 +[ 85.294305] flags: 0xbfff80000010200(slab|head|node=0|zone=2| + lastcpupid=0x7fff) +[ 85.295020] raw: 0bfff80000010200 0000000000000000 dead000000000122 + ffff0000c000d680 +[ 85.295767] raw: 0000000000000000 0000000080020002 00000001ffffffff + 0000000000000000 +[ 85.296512] page dumped because: kasan: bad access detected +[ 85.297054] +[ 85.297217] Memory state around the buggy address: +[ 85.297688] ffff000260668c00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb + fb fb +[ 85.298384] ffff000260668c80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb + fb fb +[ 85.299088] >ffff000260668d00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb + fb fb +[ 85.299781] ^ +[ 85.300396] ffff000260668d80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb + fb fb +[ 85.301092] ffff000260668e00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb + fb fb +[ 85.301787] =========================================================== + +Signed-off-by: Huisong Li +Signed-off-by: Min Hu (Connor) +Acked-by: Ferruh Yigit +--- + kernel/linux/kni/kni_misc.c | 12 ++++++++---- + 1 file changed, 8 insertions(+), 4 deletions(-) + +diff --git a/kernel/linux/kni/kni_misc.c b/kernel/linux/kni/kni_misc.c +index ec70190042..780187d8bf 100644 +--- a/kernel/linux/kni/kni_misc.c ++++ b/kernel/linux/kni/kni_misc.c +@@ -182,13 +182,17 @@ kni_dev_remove(struct kni_dev *dev) + if (!dev) + return -ENODEV; + ++ /* ++ * The memory of kni device is allocated and released together ++ * with net device. Release mbuf before freeing net device. ++ */ ++ kni_net_release_fifo_phy(dev); ++ + if (dev->net_dev) { + unregister_netdev(dev->net_dev); + free_netdev(dev->net_dev); + } + +- kni_net_release_fifo_phy(dev); +- + return 0; + } + +@@ -218,8 +222,8 @@ kni_release(struct inode *inode, struct file *file) + dev->pthread = NULL; + } + +- kni_dev_remove(dev); + list_del(&dev->list); ++ kni_dev_remove(dev); + } + up_write(&knet->kni_list_lock); + +@@ -468,8 +472,8 @@ kni_ioctl_release(struct net *net, uint32_t ioctl_num, + dev->pthread = NULL; + } + +- kni_dev_remove(dev); + list_del(&dev->list); ++ kni_dev_remove(dev); + ret = 0; + break; + } +-- +2.33.0 + diff --git a/0068-net-hns3-fix-build-for-SVE-path.patch b/0068-net-hns3-fix-build-for-SVE-path.patch deleted file mode 100644 index 3bd842348ecaaa9b46c79330d22f8daefe043146..0000000000000000000000000000000000000000 --- a/0068-net-hns3-fix-build-for-SVE-path.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 2043f4bf46fe0403c6015da614d0bb3f9f9f4344 Mon Sep 17 00:00:00 2001 -From: Huisong Li -Date: Tue, 23 Mar 2021 21:45:52 +0800 -Subject: [PATCH 068/189] net/hns3: fix build for SVE path - -The 'queue_full_cnt' stats have been encapsulated in 'dfx_stats'. -However, the modification in the SVE algorithm is omitted. -As a result, the driver fails to be compiled when the SVE -algorithm is used. - -Fixes: 9b77f1fe303f ("net/hns3: encapsulate DFX stats in datapath") -Cc: stable@dpdk.org - -Signed-off-by: Huisong Li -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_rxtx_vec_sve.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/drivers/net/hns3/hns3_rxtx_vec_sve.c b/drivers/net/hns3/hns3_rxtx_vec_sve.c -index f6c6f52..2700e6e 100644 ---- a/drivers/net/hns3/hns3_rxtx_vec_sve.c -+++ b/drivers/net/hns3/hns3_rxtx_vec_sve.c -@@ -439,7 +439,7 @@ hns3_xmit_fixed_burst_vec_sve(void *__restrict tx_queue, - - nb_pkts = RTE_MIN(txq->tx_bd_ready, nb_pkts); - if (unlikely(nb_pkts == 0)) { -- txq->queue_full_cnt++; -+ txq->dfx_stats.queue_full_cnt++; - return 0; - } - --- -2.7.4 - diff --git a/0069-net-hns3-fix-processing-Tx-offload-flags.patch b/0069-net-hns3-fix-processing-Tx-offload-flags.patch deleted file mode 100644 index 96b187df90e2ca2e522f450056d9d2e1267abc94..0000000000000000000000000000000000000000 --- a/0069-net-hns3-fix-processing-Tx-offload-flags.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 5233a6a3449ff374def3469b79d98a85e6cfd6f1 Mon Sep 17 00:00:00 2001 -From: Chengchang Tang -Date: Tue, 23 Mar 2021 21:45:53 +0800 -Subject: [PATCH 069/189] net/hns3: fix processing Tx offload flags - -Currently, if the PKT_TX_TCP_SEG and PKT_TX_TCP_CKSUM offload flags set -in the same time, hns3 PMD can not process the descriptors correctly. - -This patch fixes it by adding the processing of this situation. - -Fixes: fb6eb9009f41 ("net/hns3: fix Tx checksum with fixed header length") -Cc: stable@dpdk.org - -Signed-off-by: Chengchang Tang -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_rxtx.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c -index 6a7c360..62c56f6 100644 ---- a/drivers/net/hns3/hns3_rxtx.c -+++ b/drivers/net/hns3/hns3_rxtx.c -@@ -3291,6 +3291,7 @@ hns3_parse_l4_cksum_params(struct rte_mbuf *m, uint32_t *type_cs_vlan_tso_len) - uint32_t tmp; - /* Enable L4 checksum offloads */ - switch (ol_flags & (PKT_TX_L4_MASK | PKT_TX_TCP_SEG)) { -+ case PKT_TX_TCP_CKSUM | PKT_TX_TCP_SEG: - case PKT_TX_TCP_CKSUM: - case PKT_TX_TCP_SEG: - tmp = *type_cs_vlan_tso_len; --- -2.7.4 - diff --git a/0069-net-hns3-remove-duplicate-macro-definition.patch b/0069-net-hns3-remove-duplicate-macro-definition.patch new file mode 100644 index 0000000000000000000000000000000000000000..96dcbb833f76ddba1b2c9fe93aebecce8af1c73f --- /dev/null +++ b/0069-net-hns3-remove-duplicate-macro-definition.patch @@ -0,0 +1,31 @@ +From 0983cdc1870f52a360eadb40eab84b34c20b464d Mon Sep 17 00:00:00 2001 +From: Jie Hai +Date: Mon, 28 Feb 2022 11:21:41 +0800 +Subject: [PATCH] net/hns3: remove duplicate macro definition + +This patch fixes duplicate macro definition of HNS3_RSS_CFG_TBL_SIZE. + +Fixes: 737f30e1c3ab ("net/hns3: support command interface with firmware") +Cc: stable@dpdk.org + +Signed-off-by: Jie Hai +Acked-by: Min Hu (Connor) +--- + drivers/net/hns3/hns3_cmd.h | 1 - + 1 file changed, 1 deletion(-) + +diff --git a/drivers/net/hns3/hns3_cmd.h b/drivers/net/hns3/hns3_cmd.h +index 81bc9e9d98..f9addc6069 100644 +--- a/drivers/net/hns3/hns3_cmd.h ++++ b/drivers/net/hns3/hns3_cmd.h +@@ -603,7 +603,6 @@ struct hns3_cfg_gro_status_cmd { + + #define HNS3_RSS_HASH_KEY_OFFSET_B 4 + +-#define HNS3_RSS_CFG_TBL_SIZE 16 + #define HNS3_RSS_HASH_KEY_NUM 16 + /* Configure the algorithm mode and Hash Key, opcode:0x0D01 */ + struct hns3_rss_generic_config_cmd { +-- +2.33.0 + diff --git a/0070-net-hns3-fix-RSS-TC-mode-entry.patch b/0070-net-hns3-fix-RSS-TC-mode-entry.patch new file mode 100644 index 0000000000000000000000000000000000000000..bf53c8040b4b08a2b02dfe1651f8dc9d37c66cb4 --- /dev/null +++ b/0070-net-hns3-fix-RSS-TC-mode-entry.patch @@ -0,0 +1,35 @@ +From cdb9a7ae5f8f3b59b6de9dc2b52387636245e3a5 Mon Sep 17 00:00:00 2001 +From: Huisong Li +Date: Mon, 28 Feb 2022 11:21:45 +0800 +Subject: [PATCH] net/hns3: fix RSS TC mode entry + +The driver allocates queues only to valid TCs. But the driver also +configure queues for invalid TCs, which is unreasonable. + +Fixes: c37ca66f2b27 ("net/hns3: support RSS") +Cc: stable@dpdk.org + +Signed-off-by: Huisong Li +Acked-by: Min Hu (Connor) +--- + drivers/net/hns3/hns3_rss.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/net/hns3/hns3_rss.c b/drivers/net/hns3/hns3_rss.c +index 1782d63883..ebf3c60f07 100644 +--- a/drivers/net/hns3/hns3_rss.c ++++ b/drivers/net/hns3/hns3_rss.c +@@ -601,8 +601,8 @@ hns3_set_rss_tc_mode(struct hns3_hw *hw) + + for (i = 0; i < HNS3_MAX_TC_NUM; i++) { + tc_valid[i] = !!(hw->hw_tc_map & BIT(i)); +- tc_size[i] = roundup_size; +- tc_offset[i] = rss_size * i; ++ tc_size[i] = tc_valid[i] ? roundup_size : 0; ++ tc_offset[i] = tc_valid[i] ? rss_size * i : 0; + } + + hns3_cmd_setup_basic_desc(&desc, HNS3_OPC_RSS_TC_MODE, false); +-- +2.33.0 + diff --git a/0070-net-hns3-fix-Tx-checksum-for-UDP-packets-with-specia.patch b/0070-net-hns3-fix-Tx-checksum-for-UDP-packets-with-specia.patch deleted file mode 100644 index 16e83a986ac28da1f1ead0e388c3f5ceb625035c..0000000000000000000000000000000000000000 --- a/0070-net-hns3-fix-Tx-checksum-for-UDP-packets-with-specia.patch +++ /dev/null @@ -1,225 +0,0 @@ -From 77d2a11852ab27e6ac367cc3bf2146b9e1aa2d0c Mon Sep 17 00:00:00 2001 -From: Chengchang Tang -Date: Tue, 23 Mar 2021 21:45:54 +0800 -Subject: [PATCH 070/189] net/hns3: fix Tx checksum for UDP packets with - special port - -For Kunpeng920 network engine, UDP packets with destination port 6081, -4789 or 4790 will be identified as tunnel packets. If the UDP CKSUM -offload is set in the mbuf, and the TX tunnel mask is not set, the -CKSUM of these packets will be wrong. In this case, the upper layer -user may not identify the packet as a tunnel packet, and processes it -as non-tunnel packet, and expect to offload the outer UDP CKSUM, so -they may not fill the outer L2/L3 length to mbuf. However, the HW -identifies these packet as tunnel packets and therefore offload the -inner UDP CKSUM. As a result, the inner and outer UDP CKSUM are -incorrect. And for non-tunnel UDP packets with preceding special -destination port will also exist similar checksum error. - -For the new generation Kunpeng930 network engine, the above errata -have been fixed. Therefore, the concept of udp_cksum_mode is -introduced. There are two udp_cksum_mode for hns3 PMD, -HNS3_SPECIAL_PORT_HW_CKSUM_MODE means HW could solve the above -problem. And in HNS3_SPECIAL_PORT_SW_CKSUM_MODE, hns3 PMD will check -packets in the Tx prepare and perform the UDP CKSUM for such packets -to avoid a checksum error. - -Fixes: bba636698316 ("net/hns3: support Rx/Tx and related operations") -Cc: stable@dpdk.org - -Signed-off-by: Chengchang Tang -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_ethdev.c | 2 ++ - drivers/net/hns3/hns3_ethdev.h | 19 ++++++++++++ - drivers/net/hns3/hns3_rxtx.c | 68 ++++++++++++++++++++++++++++++++++++++++++ - drivers/net/hns3/hns3_rxtx.h | 16 ++++++++++ - 4 files changed, 105 insertions(+) - -diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c -index 55e2f07..3e0b28a 100644 ---- a/drivers/net/hns3/hns3_ethdev.c -+++ b/drivers/net/hns3/hns3_ethdev.c -@@ -3129,6 +3129,7 @@ hns3_get_capability(struct hns3_hw *hw) - hw->min_tx_pkt_len = HNS3_HIP08_MIN_TX_PKT_LEN; - pf->tqp_config_mode = HNS3_FIXED_MAX_TQP_NUM_MODE; - hw->rss_info.ipv6_sctp_offload_supported = false; -+ hw->udp_cksum_mode = HNS3_SPECIAL_PORT_SW_CKSUM_MODE; - return 0; - } - -@@ -3148,6 +3149,7 @@ hns3_get_capability(struct hns3_hw *hw) - hw->min_tx_pkt_len = HNS3_HIP09_MIN_TX_PKT_LEN; - pf->tqp_config_mode = HNS3_FLEX_MAX_TQP_NUM_MODE; - hw->rss_info.ipv6_sctp_offload_supported = true; -+ hw->udp_cksum_mode = HNS3_SPECIAL_PORT_HW_CKSUM_MODE; - - return 0; - } -diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h -index 6800ee0..eb2203c 100644 ---- a/drivers/net/hns3/hns3_ethdev.h -+++ b/drivers/net/hns3/hns3_ethdev.h -@@ -47,6 +47,9 @@ - #define HNS3_UNLIMIT_PROMISC_MODE 0 - #define HNS3_LIMIT_PROMISC_MODE 1 - -+#define HNS3_SPECIAL_PORT_SW_CKSUM_MODE 0 -+#define HNS3_SPECIAL_PORT_HW_CKSUM_MODE 1 -+ - #define HNS3_UC_MACADDR_NUM 128 - #define HNS3_VF_UC_MACADDR_NUM 48 - #define HNS3_MC_MACADDR_NUM 128 -@@ -567,6 +570,22 @@ struct hns3_hw { - uint8_t drop_stats_mode; - - uint8_t max_non_tso_bd_num; /* max BD number of one non-TSO packet */ -+ /* -+ * udp checksum mode. -+ * value range: -+ * HNS3_SPECIAL_PORT_HW_CKSUM_MODE/HNS3_SPECIAL_PORT_SW_CKSUM_MODE -+ * -+ * - HNS3_SPECIAL_PORT_SW_CKSUM_MODE -+ * In this mode, HW can not do checksum for special UDP port like -+ * 4789, 4790, 6081 for non-tunnel UDP packets and UDP tunnel -+ * packets without the PKT_TX_TUNEL_MASK in the mbuf. So, PMD need -+ * do the checksum for these packets to avoid a checksum error. -+ * -+ * - HNS3_SPECIAL_PORT_HW_CKSUM_MODE -+ * In this mode, HW does not have the preceding problems and can -+ * directly calculate the checksum of these UDP packets. -+ */ -+ uint8_t udp_cksum_mode; - - struct hns3_port_base_vlan_config port_base_vlan_cfg; - /* -diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c -index 62c56f6..626f91f 100644 ---- a/drivers/net/hns3/hns3_rxtx.c -+++ b/drivers/net/hns3/hns3_rxtx.c -@@ -5,6 +5,7 @@ - #include - #include - #include -+#include - #include - #include - #include -@@ -2845,6 +2846,7 @@ hns3_tx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t nb_desc, - HNS3_RING_TX_TAIL_REG); - txq->min_tx_pkt_len = hw->min_tx_pkt_len; - txq->tso_mode = hw->tso_mode; -+ txq->udp_cksum_mode = hw->udp_cksum_mode; - memset(&txq->basic_stats, 0, sizeof(struct hns3_tx_basic_stats)); - memset(&txq->dfx_stats, 0, sizeof(struct hns3_tx_dfx_stats)); - -@@ -3548,6 +3550,69 @@ hns3_vld_vlan_chk(struct hns3_tx_queue *txq, struct rte_mbuf *m) - } - #endif - -+static uint16_t -+hns3_udp_cksum_help(struct rte_mbuf *m) -+{ -+ uint64_t ol_flags = m->ol_flags; -+ uint16_t cksum = 0; -+ uint32_t l4_len; -+ -+ if (ol_flags & PKT_TX_IPV4) { -+ struct rte_ipv4_hdr *ipv4_hdr = rte_pktmbuf_mtod_offset(m, -+ struct rte_ipv4_hdr *, m->l2_len); -+ l4_len = rte_be_to_cpu_16(ipv4_hdr->total_length) - m->l3_len; -+ } else { -+ struct rte_ipv6_hdr *ipv6_hdr = rte_pktmbuf_mtod_offset(m, -+ struct rte_ipv6_hdr *, m->l2_len); -+ l4_len = rte_be_to_cpu_16(ipv6_hdr->payload_len); -+ } -+ -+ rte_raw_cksum_mbuf(m, m->l2_len + m->l3_len, l4_len, &cksum); -+ -+ cksum = ~cksum; -+ /* -+ * RFC 768:If the computed checksum is zero for UDP, it is transmitted -+ * as all ones -+ */ -+ if (cksum == 0) -+ cksum = 0xffff; -+ -+ return (uint16_t)cksum; -+} -+ -+static bool -+hns3_validate_tunnel_cksum(struct hns3_tx_queue *tx_queue, struct rte_mbuf *m) -+{ -+ uint64_t ol_flags = m->ol_flags; -+ struct rte_udp_hdr *udp_hdr; -+ uint16_t dst_port; -+ -+ if (tx_queue->udp_cksum_mode == HNS3_SPECIAL_PORT_HW_CKSUM_MODE || -+ ol_flags & PKT_TX_TUNNEL_MASK || -+ (ol_flags & PKT_TX_L4_MASK) != PKT_TX_UDP_CKSUM) -+ return true; -+ /* -+ * A UDP packet with the same dst_port as VXLAN\VXLAN_GPE\GENEVE will -+ * be recognized as a tunnel packet in HW. In this case, if UDP CKSUM -+ * offload is set and the tunnel mask has not been set, the CKSUM will -+ * be wrong since the header length is wrong and driver should complete -+ * the CKSUM to avoid CKSUM error. -+ */ -+ udp_hdr = rte_pktmbuf_mtod_offset(m, struct rte_udp_hdr *, -+ m->l2_len + m->l3_len); -+ dst_port = rte_be_to_cpu_16(udp_hdr->dst_port); -+ switch (dst_port) { -+ case RTE_VXLAN_DEFAULT_PORT: -+ case RTE_VXLAN_GPE_DEFAULT_PORT: -+ case RTE_GENEVE_DEFAULT_PORT: -+ udp_hdr->dgram_cksum = hns3_udp_cksum_help(m); -+ m->ol_flags = ol_flags & ~PKT_TX_L4_MASK; -+ return false; -+ default: -+ return true; -+ } -+} -+ - static int - hns3_prep_pkt_proc(struct hns3_tx_queue *tx_queue, struct rte_mbuf *m) - { -@@ -3592,6 +3657,9 @@ hns3_prep_pkt_proc(struct hns3_tx_queue *tx_queue, struct rte_mbuf *m) - return ret; - } - -+ if (!hns3_validate_tunnel_cksum(tx_queue, m)) -+ return 0; -+ - hns3_outer_header_cksum_prepare(m); - - return 0; -diff --git a/drivers/net/hns3/hns3_rxtx.h b/drivers/net/hns3/hns3_rxtx.h -index f9b3048..6689397 100644 ---- a/drivers/net/hns3/hns3_rxtx.h -+++ b/drivers/net/hns3/hns3_rxtx.h -@@ -465,6 +465,22 @@ struct hns3_tx_queue { - */ - uint8_t tso_mode; - /* -+ * udp checksum mode. -+ * value range: -+ * HNS3_SPECIAL_PORT_HW_CKSUM_MODE/HNS3_SPECIAL_PORT_SW_CKSUM_MODE -+ * -+ * - HNS3_SPECIAL_PORT_SW_CKSUM_MODE -+ * In this mode, HW can not do checksum for special UDP port like -+ * 4789, 4790, 6081 for non-tunnel UDP packets and UDP tunnel -+ * packets without the PKT_TX_TUNEL_MASK in the mbuf. So, PMD need -+ * do the checksum for these packets to avoid a checksum error. -+ * -+ * - HNS3_SPECIAL_PORT_HW_CKSUM_MODE -+ * In this mode, HW does not have the preceding problems and can -+ * directly calculate the checksum of these UDP packets. -+ */ -+ uint8_t udp_cksum_mode; -+ /* - * The minimum length of the packet supported by hardware in the Tx - * direction. - */ --- -2.7.4 - diff --git a/0071-net-hns3-fix-VF-RSS-TC-mode-entry.patch b/0071-net-hns3-fix-VF-RSS-TC-mode-entry.patch new file mode 100644 index 0000000000000000000000000000000000000000..cb318b5938b4e6ffb76df5516454a406857d63c8 --- /dev/null +++ b/0071-net-hns3-fix-VF-RSS-TC-mode-entry.patch @@ -0,0 +1,103 @@ +From 87f9628e2c786dff500139baf59720693e46b0bc Mon Sep 17 00:00:00 2001 +From: Huisong Li +Date: Mon, 28 Feb 2022 11:21:46 +0800 +Subject: [PATCH] net/hns3: fix VF RSS TC mode entry + +For packets with VLAN priorities destined for the VF, hardware still +assign Rx queue based on the Up-to-TC mapping PF configured. But VF has +only one TC. If other TC don't enable, it causes that the priority +packets that aren't destined for TC0 aren't received by RSS hash but is +destined for queue 0. So driver has to enable the unused TC by using TC0 +queue mapping configuration. + +Fixes: c37ca66f2b27 ("net/hns3: support RSS") +Cc: stable@dpdk.org + +Signed-off-by: Huisong Li +Acked-by: Min Hu (Connor) +--- + drivers/net/hns3/hns3_rss.c | 56 +++++++++++++++++++++++++++---------- + 1 file changed, 41 insertions(+), 15 deletions(-) + +diff --git a/drivers/net/hns3/hns3_rss.c b/drivers/net/hns3/hns3_rss.c +index ebf3c60f07..1493b10f96 100644 +--- a/drivers/net/hns3/hns3_rss.c ++++ b/drivers/net/hns3/hns3_rss.c +@@ -578,33 +578,59 @@ hns3_dev_rss_reta_query(struct rte_eth_dev *dev, + return 0; + } + +-/* +- * Used to configure the tc_size and tc_offset. +- */ ++static void ++hns3_set_rss_tc_mode_entry(struct hns3_hw *hw, uint8_t *tc_valid, ++ uint16_t *tc_size, uint16_t *tc_offset, ++ uint8_t tc_num) ++{ ++ struct hns3_adapter *hns = HNS3_DEV_HW_TO_ADAPTER(hw); ++ uint16_t rss_size = hw->alloc_rss_size; ++ uint16_t roundup_size; ++ uint16_t i; ++ ++ roundup_size = roundup_pow_of_two(rss_size); ++ roundup_size = ilog2(roundup_size); ++ ++ for (i = 0; i < tc_num; i++) { ++ if (hns->is_vf) { ++ /* ++ * For packets with VLAN priorities destined for the VF, ++ * hardware still assign Rx queue based on the Up-to-TC ++ * mapping PF configured. But VF has only one TC. If ++ * other TC don't enable, it causes that the priority ++ * packets that aren't destined for TC0 aren't received ++ * by RSS hash but is destined for queue 0. So driver ++ * has to enable the unused TC by using TC0 queue ++ * mapping configuration. ++ */ ++ tc_valid[i] = (hw->hw_tc_map & BIT(i)) ? ++ !!(hw->hw_tc_map & BIT(i)) : 1; ++ tc_size[i] = roundup_size; ++ tc_offset[i] = (hw->hw_tc_map & BIT(i)) ? ++ rss_size * i : 0; ++ } else { ++ tc_valid[i] = !!(hw->hw_tc_map & BIT(i)); ++ tc_size[i] = tc_valid[i] ? roundup_size : 0; ++ tc_offset[i] = tc_valid[i] ? rss_size * i : 0; ++ } ++ } ++} ++ + static int + hns3_set_rss_tc_mode(struct hns3_hw *hw) + { +- uint16_t rss_size = hw->alloc_rss_size; + struct hns3_rss_tc_mode_cmd *req; + uint16_t tc_offset[HNS3_MAX_TC_NUM]; + uint8_t tc_valid[HNS3_MAX_TC_NUM]; + uint16_t tc_size[HNS3_MAX_TC_NUM]; + struct hns3_cmd_desc desc; +- uint16_t roundup_size; + uint16_t i; + int ret; + +- req = (struct hns3_rss_tc_mode_cmd *)desc.data; +- +- roundup_size = roundup_pow_of_two(rss_size); +- roundup_size = ilog2(roundup_size); +- +- for (i = 0; i < HNS3_MAX_TC_NUM; i++) { +- tc_valid[i] = !!(hw->hw_tc_map & BIT(i)); +- tc_size[i] = tc_valid[i] ? roundup_size : 0; +- tc_offset[i] = tc_valid[i] ? rss_size * i : 0; +- } ++ hns3_set_rss_tc_mode_entry(hw, tc_valid, tc_size, ++ tc_offset, HNS3_MAX_TC_NUM); + ++ req = (struct hns3_rss_tc_mode_cmd *)desc.data; + hns3_cmd_setup_basic_desc(&desc, HNS3_OPC_RSS_TC_MODE, false); + for (i = 0; i < HNS3_MAX_TC_NUM; i++) { + uint16_t mode = 0; +-- +2.33.0 + diff --git a/0071-net-hns3-fix-link-update-when-failed-to-get-link-inf.patch b/0071-net-hns3-fix-link-update-when-failed-to-get-link-inf.patch deleted file mode 100644 index 04b24de2efb9bf7b8c740e8135cfd9c5b0eb7764..0000000000000000000000000000000000000000 --- a/0071-net-hns3-fix-link-update-when-failed-to-get-link-inf.patch +++ /dev/null @@ -1,112 +0,0 @@ -From 46602854722b87761da2e56e6bd95461ddd7b6ea Mon Sep 17 00:00:00 2001 -From: Huisong Li -Date: Tue, 23 Mar 2021 21:45:55 +0800 -Subject: [PATCH 071/189] net/hns3: fix link update when failed to get link - info - -In the "hns3_dev_link_update" API, the link information of the port is -obtained first, and then 'dev_link' in dev->data is updated. When the -driver is resetting or fails to obtain link info, the current driver -still reports the previous link info to the user. This may cause that -the dev->data->dev_link may be inconsistent with the hw link status. - -Therefore, the link status consistency between the hardware, driver, -and framework can be ensured in this interface regardless of whether -the driver is normal or abnormal. - -Fixes: 109e4dd1bd7a ("net/hns3: get link state change through mailbox") -Cc: stable@dpdk.org - -Signed-off-by: Huisong Li -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_ethdev.c | 55 +++++++++++++++++++++++++++++------------- - 1 file changed, 38 insertions(+), 17 deletions(-) - -diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c -index 3e0b28a..356c52a 100644 ---- a/drivers/net/hns3/hns3_ethdev.c -+++ b/drivers/net/hns3/hns3_ethdev.c -@@ -2698,20 +2698,22 @@ hns3_fw_version_get(struct rte_eth_dev *eth_dev, char *fw_version, - } - - static int --hns3_dev_link_update(struct rte_eth_dev *eth_dev, -- __rte_unused int wait_to_complete) -+hns3_update_port_link_info(struct rte_eth_dev *eth_dev) - { -- struct hns3_adapter *hns = eth_dev->data->dev_private; -- struct hns3_hw *hw = &hns->hw; -- struct hns3_mac *mac = &hw->mac; -- struct rte_eth_link new_link; -+ struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private); - -- if (!hns3_is_reset_pending(hns)) { -- hns3_update_link_status(hw); -- hns3_update_link_info(eth_dev); -- } -+ (void)hns3_update_link_status(hw); -+ -+ return hns3_update_link_info(eth_dev); -+} -+ -+static void -+hns3_setup_linkstatus(struct rte_eth_dev *eth_dev, -+ struct rte_eth_link *new_link) -+{ -+ struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private); -+ struct hns3_mac *mac = &hw->mac; - -- memset(&new_link, 0, sizeof(new_link)); - switch (mac->link_speed) { - case ETH_SPEED_NUM_10M: - case ETH_SPEED_NUM_100M: -@@ -2722,20 +2724,39 @@ hns3_dev_link_update(struct rte_eth_dev *eth_dev, - case ETH_SPEED_NUM_50G: - case ETH_SPEED_NUM_100G: - case ETH_SPEED_NUM_200G: -- new_link.link_speed = mac->link_speed; -+ new_link->link_speed = mac->link_speed; - break; - default: - if (mac->link_status) -- new_link.link_speed = ETH_SPEED_NUM_UNKNOWN; -+ new_link->link_speed = ETH_SPEED_NUM_UNKNOWN; - else -- new_link.link_speed = ETH_SPEED_NUM_NONE; -+ new_link->link_speed = ETH_SPEED_NUM_NONE; - break; - } - -- new_link.link_duplex = mac->link_duplex; -- new_link.link_status = mac->link_status ? ETH_LINK_UP : ETH_LINK_DOWN; -- new_link.link_autoneg = -+ new_link->link_duplex = mac->link_duplex; -+ new_link->link_status = mac->link_status ? ETH_LINK_UP : ETH_LINK_DOWN; -+ new_link->link_autoneg = - !(eth_dev->data->dev_conf.link_speeds & ETH_LINK_SPEED_FIXED); -+} -+ -+static int -+hns3_dev_link_update(struct rte_eth_dev *eth_dev, -+ __rte_unused int wait_to_complete) -+{ -+ struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private); -+ struct hns3_mac *mac = &hw->mac; -+ struct rte_eth_link new_link; -+ int ret; -+ -+ ret = hns3_update_port_link_info(eth_dev); -+ if (ret) { -+ mac->link_status = ETH_LINK_DOWN; -+ hns3_err(hw, "failed to get port link info, ret = %d.", ret); -+ } -+ -+ memset(&new_link, 0, sizeof(new_link)); -+ hns3_setup_linkstatus(eth_dev, &new_link); - - return rte_eth_linkstatus_set(eth_dev, &new_link); - } --- -2.7.4 - diff --git a/0072-net-hns3-fix-long-task-queue-pairs-reset-time.patch b/0072-net-hns3-fix-long-task-queue-pairs-reset-time.patch deleted file mode 100644 index 4fb6c5a1bdf2eb012621c3f05c973b22c4644c3b..0000000000000000000000000000000000000000 --- a/0072-net-hns3-fix-long-task-queue-pairs-reset-time.patch +++ /dev/null @@ -1,211 +0,0 @@ -From 081a3335ccdc6cce70ab9cde9e5df87e2dcd591f Mon Sep 17 00:00:00 2001 -From: Chengchang Tang -Date: Tue, 23 Mar 2021 21:45:56 +0800 -Subject: [PATCH 072/189] net/hns3: fix long task queue pairs reset time - -Currently, the queue reset process needs to be performed one by one, -which is inefficient. However, the queues reset in the same function is -almost at the same stage. To optimize the queue reset process, a new -function has been added to the firmware command HNS3_OPC_CFG_RST_TRIGGER -to reset all queues in the same function at a time. And the related -queue reset MBX message is adjusted in the same way too. - -Fixes: bba636698316 ("net/hns3: support Rx/Tx and related operations") -Cc: stable@dpdk.org - -Signed-off-by: Chengchang Tang -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_cmd.h | 8 ++- - drivers/net/hns3/hns3_rxtx.c | 125 ++++++++++++++++++++++++++++++++++++------- - 2 files changed, 114 insertions(+), 19 deletions(-) - -diff --git a/drivers/net/hns3/hns3_cmd.h b/drivers/net/hns3/hns3_cmd.h -index e704d0c..30aca82 100644 ---- a/drivers/net/hns3/hns3_cmd.h -+++ b/drivers/net/hns3/hns3_cmd.h -@@ -933,10 +933,16 @@ struct hns3_reset_tqp_queue_cmd { - - #define HNS3_CFG_RESET_MAC_B 3 - #define HNS3_CFG_RESET_FUNC_B 7 -+#define HNS3_CFG_RESET_RCB_B 1 - struct hns3_reset_cmd { - uint8_t mac_func_reset; - uint8_t fun_reset_vfid; -- uint8_t rsv[22]; -+ uint8_t fun_reset_rcb; -+ uint8_t rsv1; -+ uint16_t fun_reset_rcb_vqid_start; -+ uint16_t fun_reset_rcb_vqid_num; -+ uint8_t fun_reset_rcb_return_status; -+ uint8_t rsv2[15]; - }; - - #define HNS3_QUERY_DEV_SPECS_BD_NUM 4 -diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c -index 626f91f..0596c9c 100644 ---- a/drivers/net/hns3/hns3_rxtx.c -+++ b/drivers/net/hns3/hns3_rxtx.c -@@ -629,10 +629,6 @@ hns3pf_reset_tqp(struct hns3_hw *hw, uint16_t queue_id) - uint64_t end; - int ret; - -- ret = hns3_tqp_enable(hw, queue_id, false); -- if (ret) -- return ret; -- - /* - * In current version VF is not supported when PF is driven by DPDK - * driver, all task queue pairs are mapped to PF function, so PF's queue -@@ -679,11 +675,6 @@ hns3vf_reset_tqp(struct hns3_hw *hw, uint16_t queue_id) - uint8_t msg_data[2]; - int ret; - -- /* Disable VF's queue before send queue reset msg to PF */ -- ret = hns3_tqp_enable(hw, queue_id, false); -- if (ret) -- return ret; -- - memcpy(msg_data, &queue_id, sizeof(uint16_t)); - - ret = hns3_send_mbx_msg(hw, HNS3_MBX_QUEUE_RESET, 0, msg_data, -@@ -695,14 +686,105 @@ hns3vf_reset_tqp(struct hns3_hw *hw, uint16_t queue_id) - } - - static int --hns3_reset_tqp(struct hns3_adapter *hns, uint16_t queue_id) -+hns3_reset_rcb_cmd(struct hns3_hw *hw, uint8_t *reset_status) - { -- struct hns3_hw *hw = &hns->hw; -+ struct hns3_reset_cmd *req; -+ struct hns3_cmd_desc desc; -+ int ret; - -- if (hns->is_vf) -- return hns3vf_reset_tqp(hw, queue_id); -- else -- return hns3pf_reset_tqp(hw, queue_id); -+ hns3_cmd_setup_basic_desc(&desc, HNS3_OPC_CFG_RST_TRIGGER, false); -+ req = (struct hns3_reset_cmd *)desc.data; -+ hns3_set_bit(req->mac_func_reset, HNS3_CFG_RESET_RCB_B, 1); -+ -+ /* -+ * The start qid should be the global qid of the first tqp of the -+ * function which should be reset in this port. Since our PF not -+ * support take over of VFs, so we only need to reset function 0, -+ * and its start qid is always 0. -+ */ -+ req->fun_reset_rcb_vqid_start = rte_cpu_to_le_16(0); -+ req->fun_reset_rcb_vqid_num = rte_cpu_to_le_16(hw->cfg_max_queues); -+ -+ ret = hns3_cmd_send(hw, &desc, 1); -+ if (ret) { -+ hns3_err(hw, "fail to send rcb reset cmd, ret = %d.", ret); -+ return ret; -+ } -+ -+ *reset_status = req->fun_reset_rcb_return_status; -+ return 0; -+} -+ -+static int -+hns3pf_reset_all_tqps(struct hns3_hw *hw) -+{ -+#define HNS3_RESET_RCB_NOT_SUPPORT 0U -+#define HNS3_RESET_ALL_TQP_SUCCESS 1U -+ uint8_t reset_status; -+ int ret; -+ int i; -+ -+ ret = hns3_reset_rcb_cmd(hw, &reset_status); -+ if (ret) -+ return ret; -+ -+ /* -+ * If the firmware version is low, it may not support the rcb reset -+ * which means reset all the tqps at a time. In this case, we should -+ * reset tqps one by one. -+ */ -+ if (reset_status == HNS3_RESET_RCB_NOT_SUPPORT) { -+ for (i = 0; i < hw->cfg_max_queues; i++) { -+ ret = hns3pf_reset_tqp(hw, i); -+ if (ret) { -+ hns3_err(hw, -+ "fail to reset tqp, queue_id = %d, ret = %d.", -+ i, ret); -+ return ret; -+ } -+ } -+ } else if (reset_status != HNS3_RESET_ALL_TQP_SUCCESS) { -+ hns3_err(hw, "fail to reset all tqps, reset_status = %u.", -+ reset_status); -+ return -EIO; -+ } -+ -+ return 0; -+} -+ -+static int -+hns3vf_reset_all_tqps(struct hns3_hw *hw) -+{ -+#define HNS3VF_RESET_ALL_TQP_DONE 1U -+ uint8_t reset_status; -+ uint8_t msg_data[2]; -+ int ret; -+ int i; -+ -+ memset(msg_data, 0, sizeof(uint16_t)); -+ ret = hns3_send_mbx_msg(hw, HNS3_MBX_QUEUE_RESET, 0, msg_data, -+ sizeof(msg_data), true, &reset_status, -+ sizeof(reset_status)); -+ if (ret) { -+ hns3_err(hw, "fail to send rcb reset mbx, ret = %d.", ret); -+ return ret; -+ } -+ -+ if (reset_status == HNS3VF_RESET_ALL_TQP_DONE) -+ return 0; -+ -+ /* -+ * If the firmware version or kernel PF version is low, it may not -+ * support the rcb reset which means reset all the tqps at a time. -+ * In this case, we should reset tqps one by one. -+ */ -+ for (i = 1; i < hw->cfg_max_queues; i++) { -+ ret = hns3vf_reset_tqp(hw, i); -+ if (ret) -+ return ret; -+ } -+ -+ return 0; - } - - int -@@ -711,14 +793,21 @@ hns3_reset_all_tqps(struct hns3_adapter *hns) - struct hns3_hw *hw = &hns->hw; - int ret, i; - -+ /* Disable all queues before reset all queues */ - for (i = 0; i < hw->cfg_max_queues; i++) { -- ret = hns3_reset_tqp(hns, i); -+ ret = hns3_tqp_enable(hw, i, false); - if (ret) { -- hns3_err(hw, "Failed to reset No.%d queue: %d", i, ret); -+ hns3_err(hw, -+ "fail to disable tqps before tqps reset, ret = %d.", -+ ret); - return ret; - } - } -- return 0; -+ -+ if (hns->is_vf) -+ return hns3vf_reset_all_tqps(hw); -+ else -+ return hns3pf_reset_all_tqps(hw); - } - - static int --- -2.7.4 - diff --git a/0072-net-hns3-increase-time-waiting-for-PF-reset-completi.patch b/0072-net-hns3-increase-time-waiting-for-PF-reset-completi.patch new file mode 100644 index 0000000000000000000000000000000000000000..462c7fd1a953c0e33f9ababc5ec4e315ab24d0df --- /dev/null +++ b/0072-net-hns3-increase-time-waiting-for-PF-reset-completi.patch @@ -0,0 +1,51 @@ +From d6a9f8fb26b8d6adaac20d6a303faa5c5ba4d5bc Mon Sep 17 00:00:00 2001 +From: Huisong Li +Date: Wed, 2 Mar 2022 08:35:01 +0800 +Subject: [PATCH] net/hns3: increase time waiting for PF reset completion + +On the case that PF and VF need to be reset, after the hardware reset is +complete, VF needs wait for 1 second to restore the configuration so +that VF does not fail to recover because PF reset isn't complete. But +the estimated time is not sufficient. This patch fixes it to 5 seconds. + +Fixes: 2790c6464725 ("net/hns3: support device reset") +Cc: stable@dpdk.org + +Signed-off-by: Huisong Li +Acked-by: Min Hu (Connor) +--- + drivers/net/hns3/hns3_ethdev_vf.c | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c +index 06ddf64184..9091706fe5 100644 +--- a/drivers/net/hns3/hns3_ethdev_vf.c ++++ b/drivers/net/hns3/hns3_ethdev_vf.c +@@ -1877,6 +1877,7 @@ hns3vf_is_reset_pending(struct hns3_adapter *hns) + static int + hns3vf_wait_hardware_ready(struct hns3_adapter *hns) + { ++#define HNS3_WAIT_PF_RESET_READY_TIME 5 + struct hns3_hw *hw = &hns->hw; + struct hns3_wait_data *wait_data = hw->reset.wait_data; + struct timeval tv; +@@ -1897,12 +1898,14 @@ hns3vf_wait_hardware_ready(struct hns3_adapter *hns) + return 0; + + wait_data->check_completion = NULL; +- wait_data->interval = 1 * MSEC_PER_SEC * USEC_PER_MSEC; ++ wait_data->interval = HNS3_WAIT_PF_RESET_READY_TIME * ++ MSEC_PER_SEC * USEC_PER_MSEC; + wait_data->count = 1; + wait_data->result = HNS3_WAIT_REQUEST; + rte_eal_alarm_set(wait_data->interval, hns3_wait_callback, + wait_data); +- hns3_warn(hw, "hardware is ready, delay 1 sec for PF reset complete"); ++ hns3_warn(hw, "hardware is ready, delay %d sec for PF reset complete", ++ HNS3_WAIT_PF_RESET_READY_TIME); + return -EAGAIN; + } else if (wait_data->result == HNS3_WAIT_TIMEOUT) { + hns3_clock_gettime(&tv); +-- +2.33.0 + diff --git a/0073-net-bonding-fix-stopping-non-active-slaves.patch b/0073-net-bonding-fix-stopping-non-active-slaves.patch new file mode 100644 index 0000000000000000000000000000000000000000..f29bb400b386e50351d5c85d8fe722d8bacbdc49 --- /dev/null +++ b/0073-net-bonding-fix-stopping-non-active-slaves.patch @@ -0,0 +1,56 @@ +From f5e72e8e8d57b331baf1a86d15eb7fae921f57fb Mon Sep 17 00:00:00 2001 +From: Huisong Li +Date: Tue, 3 May 2022 18:02:13 +0800 +Subject: [PATCH] net/bonding: fix stopping non-active slaves + +When stopping a bonded port, all slaves should be stopped. But only +active slaves are stopped. +So fix by stopping all slave ports and later do "deactivate_slave()" for +active slaves. + +Fixes: 0911d4ec0183 ("net/bonding: fix crash when stopping mode 4 port") +Cc: stable@dpdk.org + +Signed-off-by: Huisong Li +Signed-off-by: Min Hu (Connor) +--- + drivers/net/bonding/rte_eth_bond_pmd.c | 20 +++++++++++--------- + 1 file changed, 11 insertions(+), 9 deletions(-) + +diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c +index 5cbe89031b..605fc2ffb5 100644 +--- a/drivers/net/bonding/rte_eth_bond_pmd.c ++++ b/drivers/net/bonding/rte_eth_bond_pmd.c +@@ -2118,18 +2118,20 @@ bond_ethdev_stop(struct rte_eth_dev *eth_dev) + internals->link_status_polling_enabled = 0; + for (i = 0; i < internals->slave_count; i++) { + uint16_t slave_id = internals->slaves[i].port_id; ++ ++ internals->slaves[i].last_link_status = 0; ++ ret = rte_eth_dev_stop(slave_id); ++ if (ret != 0) { ++ RTE_BOND_LOG(ERR, "Failed to stop device on port %u", ++ slave_id); ++ return ret; ++ } ++ ++ /* active slaves need to be deactivated. */ + if (find_slave_by_id(internals->active_slaves, + internals->active_slave_count, slave_id) != +- internals->active_slave_count) { +- internals->slaves[i].last_link_status = 0; +- ret = rte_eth_dev_stop(slave_id); +- if (ret != 0) { +- RTE_BOND_LOG(ERR, "Failed to stop device on port %u", +- slave_id); +- return ret; +- } ++ internals->active_slave_count) + deactivate_slave(eth_dev, slave_id); +- } + } + + return 0; +-- +2.33.0 + diff --git a/0073-net-hns3-fix-MTU-config-complexity.patch b/0073-net-hns3-fix-MTU-config-complexity.patch deleted file mode 100644 index de928dd45a416442b33757d8d750145ad338e8cf..0000000000000000000000000000000000000000 --- a/0073-net-hns3-fix-MTU-config-complexity.patch +++ /dev/null @@ -1,106 +0,0 @@ -From 85c88060616e97d475df4b2321843a57218b80d9 Mon Sep 17 00:00:00 2001 -From: "Min Hu (Connor)" -Date: Thu, 1 Apr 2021 21:38:03 +0800 -Subject: [PATCH 073/189] net/hns3: fix MTU config complexity - -This patch fixed cyclomatic complexity about MTU -in device configure process. - -Fixes: 1f5ca0b460cd ("net/hns3: support some device operations") -Cc: stable@dpdk.org - -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_ethdev.c | 62 ++++++++++++++++++++++++++---------------- - 1 file changed, 38 insertions(+), 24 deletions(-) - -diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c -index 356c52a..ffdf019 100644 ---- a/drivers/net/hns3/hns3_ethdev.c -+++ b/drivers/net/hns3/hns3_ethdev.c -@@ -2373,6 +2373,41 @@ hns3_init_ring_with_vector(struct hns3_hw *hw) - } - - static int -+hns3_refresh_mtu(struct rte_eth_dev *dev, struct rte_eth_conf *conf) -+{ -+ struct hns3_adapter *hns = dev->data->dev_private; -+ struct hns3_hw *hw = &hns->hw; -+ uint32_t max_rx_pkt_len; -+ uint16_t mtu; -+ int ret; -+ -+ if (!(conf->rxmode.offloads & DEV_RX_OFFLOAD_JUMBO_FRAME)) -+ return 0; -+ -+ /* -+ * If jumbo frames are enabled, MTU needs to be refreshed -+ * according to the maximum RX packet length. -+ */ -+ max_rx_pkt_len = conf->rxmode.max_rx_pkt_len; -+ if (max_rx_pkt_len > HNS3_MAX_FRAME_LEN || -+ max_rx_pkt_len <= HNS3_DEFAULT_FRAME_LEN) { -+ hns3_err(hw, "maximum Rx packet length must be greater than %u " -+ "and no more than %u when jumbo frame enabled.", -+ (uint16_t)HNS3_DEFAULT_FRAME_LEN, -+ (uint16_t)HNS3_MAX_FRAME_LEN); -+ return -EINVAL; -+ } -+ -+ mtu = (uint16_t)HNS3_PKTLEN_TO_MTU(max_rx_pkt_len); -+ ret = hns3_dev_mtu_set(dev, mtu); -+ if (ret) -+ return ret; -+ dev->data->mtu = mtu; -+ -+ return 0; -+} -+ -+static int - hns3_dev_configure(struct rte_eth_dev *dev) - { - struct hns3_adapter *hns = dev->data->dev_private; -@@ -2382,8 +2417,6 @@ hns3_dev_configure(struct rte_eth_dev *dev) - uint16_t nb_rx_q = dev->data->nb_rx_queues; - uint16_t nb_tx_q = dev->data->nb_tx_queues; - struct rte_eth_rss_conf rss_conf; -- uint32_t max_rx_pkt_len; -- uint16_t mtu; - bool gro_en; - int ret; - -@@ -2431,28 +2464,9 @@ hns3_dev_configure(struct rte_eth_dev *dev) - goto cfg_err; - } - -- /* -- * If jumbo frames are enabled, MTU needs to be refreshed -- * according to the maximum RX packet length. -- */ -- if (conf->rxmode.offloads & DEV_RX_OFFLOAD_JUMBO_FRAME) { -- max_rx_pkt_len = conf->rxmode.max_rx_pkt_len; -- if (max_rx_pkt_len > HNS3_MAX_FRAME_LEN || -- max_rx_pkt_len <= HNS3_DEFAULT_FRAME_LEN) { -- hns3_err(hw, "maximum Rx packet length must be greater " -- "than %u and less than %u when jumbo frame enabled.", -- (uint16_t)HNS3_DEFAULT_FRAME_LEN, -- (uint16_t)HNS3_MAX_FRAME_LEN); -- ret = -EINVAL; -- goto cfg_err; -- } -- -- mtu = (uint16_t)HNS3_PKTLEN_TO_MTU(max_rx_pkt_len); -- ret = hns3_dev_mtu_set(dev, mtu); -- if (ret) -- goto cfg_err; -- dev->data->mtu = mtu; -- } -+ ret = hns3_refresh_mtu(dev, conf); -+ if (ret) -+ goto cfg_err; - - ret = hns3_dev_configure_vlan(dev); - if (ret) --- -2.7.4 - diff --git a/0074-net-bonding-fix-slave-stop-and-remove-on-port-close.patch b/0074-net-bonding-fix-slave-stop-and-remove-on-port-close.patch new file mode 100644 index 0000000000000000000000000000000000000000..8e20027567159fec52a020b888877a3b7dc46631 --- /dev/null +++ b/0074-net-bonding-fix-slave-stop-and-remove-on-port-close.patch @@ -0,0 +1,37 @@ +From 1c5c6cd85f8cab2af92d265b6c7671df0b82e6fb Mon Sep 17 00:00:00 2001 +From: Huisong Li +Date: Tue, 3 May 2022 18:02:14 +0800 +Subject: [PATCH] net/bonding: fix slave stop and remove on port close + +All slaves will be stopped and removed when closing a bonded port. +But the while loop can not end if both rte_eth_dev_stop and +rte_eth_bond_slave_remove fails, runs infinitely. +This is because the skipped slave port counted in both function failures +but it should be counted only one. + +Fixing by not continue to process in the loop after first failure. + +Fixes: fb0379bc5db3 ("net/bonding: check stop call status") +Cc: stable@dpdk.org + +Signed-off-by: Huisong Li +Signed-off-by: Min Hu (Connor) +--- + drivers/net/bonding/rte_eth_bond_pmd.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c +index 605fc2ffb5..f0668a636f 100644 +--- a/drivers/net/bonding/rte_eth_bond_pmd.c ++++ b/drivers/net/bonding/rte_eth_bond_pmd.c +@@ -2156,6 +2156,7 @@ bond_ethdev_close(struct rte_eth_dev *dev) + RTE_BOND_LOG(ERR, "Failed to stop device on port %u", + port_id); + skipped++; ++ continue; + } + + if (rte_eth_bond_slave_remove(bond_port_id, port_id) != 0) { +-- +2.33.0 + diff --git a/0074-net-hns3-support-IEEE-1588-PTP.patch b/0074-net-hns3-support-IEEE-1588-PTP.patch deleted file mode 100644 index 7e227f10cc921a42bf4270ba23c8787a8106b128..0000000000000000000000000000000000000000 --- a/0074-net-hns3-support-IEEE-1588-PTP.patch +++ /dev/null @@ -1,793 +0,0 @@ -From 95a068d7af10549d1a084b94b86fbffd03c0e3bd Mon Sep 17 00:00:00 2001 -From: "Min Hu (Connor)" -Date: Thu, 1 Apr 2021 21:38:04 +0800 -Subject: [PATCH 074/189] net/hns3: support IEEE 1588 PTP - -Add hns3 support for new ethdev APIs to enable and read IEEE1588/ -802.1AS PTP timestamps. - -Signed-off-by: Min Hu (Connor) ---- - doc/guides/nics/features/hns3.ini | 2 + - doc/guides/nics/hns3.rst | 1 + - drivers/net/hns3/hns3_cmd.h | 30 ++++ - drivers/net/hns3/hns3_ethdev.c | 41 +++++- - drivers/net/hns3/hns3_ethdev.h | 20 +++ - drivers/net/hns3/hns3_ptp.c | 292 ++++++++++++++++++++++++++++++++++++++ - drivers/net/hns3/hns3_regs.h | 23 +++ - drivers/net/hns3/hns3_rxtx.c | 47 +++++- - drivers/net/hns3/hns3_rxtx.h | 7 + - drivers/net/hns3/hns3_rxtx_vec.c | 15 +- - drivers/net/hns3/meson.build | 3 +- - 11 files changed, 468 insertions(+), 13 deletions(-) - create mode 100644 drivers/net/hns3/hns3_ptp.c - -diff --git a/doc/guides/nics/features/hns3.ini b/doc/guides/nics/features/hns3.ini -index d407b2f..cc1ad0f 100644 ---- a/doc/guides/nics/features/hns3.ini -+++ b/doc/guides/nics/features/hns3.ini -@@ -42,6 +42,8 @@ Stats per queue = Y - FW version = Y - Registers dump = Y - Module EEPROM dump = Y -+Timesync = Y -+Timestamp offload = Y - Multiprocess aware = Y - Linux UIO = Y - Linux VFIO = Y -diff --git a/doc/guides/nics/hns3.rst b/doc/guides/nics/hns3.rst -index e8abd07..d722509 100644 ---- a/doc/guides/nics/hns3.rst -+++ b/doc/guides/nics/hns3.rst -@@ -37,6 +37,7 @@ Features of the HNS3 PMD are: - - MTU update - - NUMA support - - Generic flow API -+- IEEE1588/802.1AS timestamping - - Prerequisites - ------------- -diff --git a/drivers/net/hns3/hns3_cmd.h b/drivers/net/hns3/hns3_cmd.h -index 30aca82..5d1fb67 100644 ---- a/drivers/net/hns3/hns3_cmd.h -+++ b/drivers/net/hns3/hns3_cmd.h -@@ -123,6 +123,10 @@ enum hns3_opcode_type { - HNS3_OPC_CLEAR_MAC_TNL_INT = 0x0312, - HNS3_OPC_CONFIG_FEC_MODE = 0x031A, - -+ /* PTP command */ -+ HNS3_OPC_PTP_INT_EN = 0x0501, -+ HNS3_OPC_CFG_PTP_MODE = 0x0507, -+ - /* PFC/Pause commands */ - HNS3_OPC_CFG_MAC_PAUSE_EN = 0x0701, - HNS3_OPC_CFG_PFC_PAUSE_EN = 0x0702, -@@ -976,6 +980,32 @@ struct hns3_query_ssu_cmd { - uint32_t rev1[2]; - }; - -+#define HNS3_PTP_ENABLE_B 0 -+#define HNS3_PTP_TX_ENABLE_B 1 -+#define HNS3_PTP_RX_ENABLE_B 2 -+ -+#define HNS3_PTP_TYPE_S 0 -+#define HNS3_PTP_TYPE_M (0x3 << HNS3_PTP_TYPE_S) -+ -+#define ALL_PTP_V2_TYPE 0xF -+#define HNS3_PTP_MESSAGE_TYPE_S 0 -+#define HNS3_PTP_MESSAGE_TYPE_M (0xF << HNS3_PTP_MESSAGE_TYPE_S) -+ -+#define PTP_TYPE_L2_V2_TYPE 0 -+ -+struct hns3_ptp_mode_cfg_cmd { -+ uint8_t enable; -+ uint8_t ptp_type; -+ uint8_t v2_message_type_1; -+ uint8_t v2_message_type_0; -+ uint8_t rsv[20]; -+}; -+ -+struct hns3_ptp_int_cmd { -+ uint8_t int_en; -+ uint8_t rsvd[23]; -+}; -+ - #define HNS3_MAX_TQP_NUM_HIP08_PF 64 - #define HNS3_DEFAULT_TX_BUF 0x4000 /* 16k bytes */ - #define HNS3_TOTAL_PKT_BUF 0x108000 /* 1.03125M bytes */ -diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c -index ffdf019..aef1ebf 100644 ---- a/drivers/net/hns3/hns3_ethdev.c -+++ b/drivers/net/hns3/hns3_ethdev.c -@@ -58,6 +58,7 @@ enum hns3_evt_cause { - HNS3_VECTOR0_EVENT_RST, - HNS3_VECTOR0_EVENT_MBX, - HNS3_VECTOR0_EVENT_ERR, -+ HNS3_VECTOR0_EVENT_PTP, - HNS3_VECTOR0_EVENT_OTHER, - }; - -@@ -202,6 +203,13 @@ hns3_check_event_cause(struct hns3_adapter *hns, uint32_t *clearval) - goto out; - } - -+ /* Check for vector0 1588 event source */ -+ if (BIT(HNS3_VECTOR0_1588_INT_B) & vector0_int_stats) { -+ val = BIT(HNS3_VECTOR0_1588_INT_B); -+ ret = HNS3_VECTOR0_EVENT_PTP; -+ goto out; -+ } -+ - /* check for vector0 msix event source */ - if (vector0_int_stats & HNS3_VECTOR0_REG_MSIX_MASK || - hw_err_src_reg & HNS3_RAS_REG_NFE_MASK) { -@@ -227,10 +235,17 @@ hns3_check_event_cause(struct hns3_adapter *hns, uint32_t *clearval) - return ret; - } - -+static bool -+hns3_is_1588_event_type(uint32_t event_type) -+{ -+ return (event_type == HNS3_VECTOR0_EVENT_PTP); -+} -+ - static void - hns3_clear_event_cause(struct hns3_hw *hw, uint32_t event_type, uint32_t regclr) - { -- if (event_type == HNS3_VECTOR0_EVENT_RST) -+ if (event_type == HNS3_VECTOR0_EVENT_RST || -+ hns3_is_1588_event_type(event_type)) - hns3_write_dev(hw, HNS3_MISC_RESET_STS_REG, regclr); - else if (event_type == HNS3_VECTOR0_EVENT_MBX) - hns3_write_dev(hw, HNS3_VECTOR0_CMDQ_SRC_REG, regclr); -@@ -253,6 +268,8 @@ hns3_clear_all_event_cause(struct hns3_hw *hw) - BIT(HNS3_VECTOR0_GLOBALRESET_INT_B) | - BIT(HNS3_VECTOR0_CORERESET_INT_B)); - hns3_clear_event_cause(hw, HNS3_VECTOR0_EVENT_MBX, 0); -+ hns3_clear_event_cause(hw, HNS3_VECTOR0_EVENT_PTP, -+ BIT(HNS3_VECTOR0_1588_INT_B)); - } - - static void -@@ -2468,6 +2485,10 @@ hns3_dev_configure(struct rte_eth_dev *dev) - if (ret) - goto cfg_err; - -+ ret = hns3_mbuf_dyn_rx_timestamp_register(dev, conf); -+ if (ret) -+ goto cfg_err; -+ - ret = hns3_dev_configure_vlan(dev); - if (ret) - goto cfg_err; -@@ -2641,6 +2662,9 @@ hns3_dev_infos_get(struct rte_eth_dev *eth_dev, struct rte_eth_dev_info *info) - info->dev_capa = RTE_ETH_DEV_CAPA_RUNTIME_RX_QUEUE_SETUP | - RTE_ETH_DEV_CAPA_RUNTIME_TX_QUEUE_SETUP; - -+ if (hns3_dev_ptp_supported(hw)) -+ info->rx_offload_capa |= DEV_RX_OFFLOAD_TIMESTAMP; -+ - info->rx_desc_lim = (struct rte_eth_desc_lim) { - .nb_max = HNS3_MAX_RING_DESC, - .nb_min = HNS3_MIN_RING_DESC, -@@ -4960,6 +4984,10 @@ hns3_init_pf(struct rte_eth_dev *eth_dev) - goto err_intr_callback_register; - } - -+ ret = hns3_ptp_init(hw); -+ if (ret) -+ goto err_get_config; -+ - /* Enable interrupt */ - rte_intr_enable(&pci_dev->intr_handle); - hns3_pf_enable_irq0(hw); -@@ -5977,6 +6005,10 @@ hns3_restore_conf(struct hns3_adapter *hns) - if (ret) - goto err_promisc; - -+ ret = hns3_restore_ptp(hns); -+ if (ret) -+ goto err_promisc; -+ - ret = hns3_restore_rx_interrupt(hw); - if (ret) - goto err_promisc; -@@ -6681,6 +6713,13 @@ static const struct eth_dev_ops hns3_eth_dev_ops = { - .fec_set = hns3_fec_set, - .tm_ops_get = hns3_tm_ops_get, - .tx_done_cleanup = hns3_tx_done_cleanup, -+ .timesync_enable = hns3_timesync_enable, -+ .timesync_disable = hns3_timesync_disable, -+ .timesync_read_rx_timestamp = hns3_timesync_read_rx_timestamp, -+ .timesync_read_tx_timestamp = hns3_timesync_read_tx_timestamp, -+ .timesync_adjust_time = hns3_timesync_adjust_time, -+ .timesync_read_time = hns3_timesync_read_time, -+ .timesync_write_time = hns3_timesync_write_time, - }; - - static const struct hns3_reset_ops hns3_reset_ops = { -diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h -index eb2203c..25cb5e2 100644 ---- a/drivers/net/hns3/hns3_ethdev.h -+++ b/drivers/net/hns3/hns3_ethdev.h -@@ -750,6 +750,11 @@ struct hns3_pf { - bool support_sfp_query; - uint32_t fec_mode; /* current FEC mode for ethdev */ - -+ bool ptp_enable; -+ -+ /* Stores timestamp of last received packet on dev */ -+ uint64_t rx_timestamp; -+ - struct hns3_vtag_cfg vtag_config; - LIST_HEAD(vlan_tbl, hns3_user_vlan_table) vlan_list; - -@@ -1000,6 +1005,21 @@ int hns3_dev_infos_get(struct rte_eth_dev *eth_dev, - void hns3vf_update_link_status(struct hns3_hw *hw, uint8_t link_status, - uint32_t link_speed, uint8_t link_duplex); - void hns3_parse_devargs(struct rte_eth_dev *dev); -+int hns3_restore_ptp(struct hns3_adapter *hns); -+int hns3_mbuf_dyn_rx_timestamp_register(struct rte_eth_dev *dev, -+ struct rte_eth_conf *conf); -+int hns3_ptp_init(struct hns3_hw *hw); -+int hns3_timesync_enable(struct rte_eth_dev *dev); -+int hns3_timesync_disable(struct rte_eth_dev *dev); -+int hns3_timesync_read_rx_timestamp(struct rte_eth_dev *dev, -+ struct timespec *timestamp, -+ uint32_t flags __rte_unused); -+int hns3_timesync_read_tx_timestamp(struct rte_eth_dev *dev, -+ struct timespec *timestamp); -+int hns3_timesync_read_time(struct rte_eth_dev *dev, struct timespec *ts); -+int hns3_timesync_write_time(struct rte_eth_dev *dev, -+ const struct timespec *ts); -+int hns3_timesync_adjust_time(struct rte_eth_dev *dev, int64_t delta); - - static inline bool - is_reset_pending(struct hns3_adapter *hns) -diff --git a/drivers/net/hns3/hns3_ptp.c b/drivers/net/hns3/hns3_ptp.c -new file mode 100644 -index 0000000..146b69d ---- /dev/null -+++ b/drivers/net/hns3/hns3_ptp.c -@@ -0,0 +1,292 @@ -+/* SPDX-License-Identifier: BSD-3-Clause -+ * Copyright(c) 2021-2021 Hisilicon Limited. -+ */ -+ -+#include -+#include -+#include -+ -+#include "hns3_ethdev.h" -+#include "hns3_regs.h" -+#include "hns3_logs.h" -+ -+uint64_t hns3_timestamp_rx_dynflag; -+int hns3_timestamp_dynfield_offset = -1; -+ -+int -+hns3_mbuf_dyn_rx_timestamp_register(struct rte_eth_dev *dev, -+ struct rte_eth_conf *conf) -+{ -+ struct hns3_adapter *hns = dev->data->dev_private; -+ struct hns3_hw *hw = &hns->hw; -+ int ret; -+ -+ if (!(conf->rxmode.offloads & DEV_RX_OFFLOAD_TIMESTAMP)) -+ return 0; -+ -+ ret = rte_mbuf_dyn_rx_timestamp_register -+ (&hns3_timestamp_dynfield_offset, -+ &hns3_timestamp_rx_dynflag); -+ if (ret) { -+ hns3_err(hw, -+ "failed to register Rx timestamp field/flag"); -+ return ret; -+ } -+ -+ return 0; -+} -+ -+static int -+hns3_ptp_int_en(struct hns3_hw *hw, bool en) -+{ -+ struct hns3_ptp_int_cmd *req; -+ struct hns3_cmd_desc desc; -+ int ret; -+ -+ req = (struct hns3_ptp_int_cmd *)desc.data; -+ hns3_cmd_setup_basic_desc(&desc, HNS3_OPC_PTP_INT_EN, false); -+ req->int_en = en ? 1 : 0; -+ -+ ret = hns3_cmd_send(hw, &desc, 1); -+ if (ret) -+ hns3_err(hw, -+ "failed to %s ptp interrupt, ret = %d\n", -+ en ? "enable" : "disable", ret); -+ -+ return ret; -+} -+ -+int -+hns3_ptp_init(struct hns3_hw *hw) -+{ -+ int ret; -+ -+ if (!hns3_dev_ptp_supported(hw)) -+ return 0; -+ -+ ret = hns3_ptp_int_en(hw, true); -+ if (ret) -+ return ret; -+ -+ /* Start PTP timer */ -+ hns3_write_dev(hw, HNS3_CFG_TIME_CYC_EN, 1); -+ -+ return 0; -+} -+ -+static int -+hns3_timesync_configure(struct hns3_adapter *hns, bool en) -+{ -+ struct hns3_ptp_mode_cfg_cmd *req; -+ struct hns3_hw *hw = &hns->hw; -+ struct hns3_pf *pf = &hns->pf; -+ struct hns3_cmd_desc desc; -+ int val; -+ int ret; -+ -+ hns3_cmd_setup_basic_desc(&desc, HNS3_OPC_CFG_PTP_MODE, false); -+ -+ req = (struct hns3_ptp_mode_cfg_cmd *)desc.data; -+ -+ val = en ? 1 : 0; -+ hns3_set_bit(req->enable, HNS3_PTP_ENABLE_B, val); -+ hns3_set_bit(req->enable, HNS3_PTP_TX_ENABLE_B, val); -+ hns3_set_bit(req->enable, HNS3_PTP_RX_ENABLE_B, val); -+ -+ if (en) { -+ hns3_set_field(req->ptp_type, HNS3_PTP_TYPE_M, HNS3_PTP_TYPE_S, -+ PTP_TYPE_L2_V2_TYPE); -+ hns3_set_field(req->v2_message_type_1, HNS3_PTP_MESSAGE_TYPE_M, -+ HNS3_PTP_MESSAGE_TYPE_S, ALL_PTP_V2_TYPE); -+ } -+ -+ ret = hns3_cmd_send(hw, &desc, 1); -+ if (ret) { -+ hns3_err(hw, "configure PTP time failed, en = %d, ret = %d", -+ en, ret); -+ return ret; -+ } -+ -+ pf->ptp_enable = en; -+ -+ return 0; -+} -+ -+int -+hns3_timesync_enable(struct rte_eth_dev *dev) -+{ -+ struct hns3_adapter *hns = dev->data->dev_private; -+ struct hns3_hw *hw = &hns->hw; -+ struct hns3_pf *pf = &hns->pf; -+ int ret; -+ -+ if (!hns3_dev_ptp_supported(hw)) -+ return -ENOTSUP; -+ -+ if (pf->ptp_enable) -+ return 0; -+ -+ rte_spinlock_lock(&hw->lock); -+ ret = hns3_timesync_configure(hns, true); -+ rte_spinlock_unlock(&hw->lock); -+ return ret; -+} -+ -+int -+hns3_timesync_disable(struct rte_eth_dev *dev) -+{ -+ struct hns3_adapter *hns = dev->data->dev_private; -+ struct hns3_hw *hw = &hns->hw; -+ struct hns3_pf *pf = &hns->pf; -+ int ret; -+ -+ if (!hns3_dev_ptp_supported(hw)) -+ return -ENOTSUP; -+ -+ if (!pf->ptp_enable) -+ return 0; -+ -+ rte_spinlock_lock(&hw->lock); -+ ret = hns3_timesync_configure(hns, false); -+ rte_spinlock_unlock(&hw->lock); -+ -+ return ret; -+} -+ -+int -+hns3_timesync_read_rx_timestamp(struct rte_eth_dev *dev, -+ struct timespec *timestamp, -+ uint32_t flags __rte_unused) -+{ -+#define TIME_RX_STAMP_NS_MASK 0x3FFFFFFF -+ struct hns3_adapter *hns = dev->data->dev_private; -+ struct hns3_hw *hw = &hns->hw; -+ struct hns3_pf *pf = &hns->pf; -+ uint64_t ns, sec; -+ -+ if (!hns3_dev_ptp_supported(hw)) -+ return -ENOTSUP; -+ -+ ns = pf->rx_timestamp & TIME_RX_STAMP_NS_MASK; -+ sec = upper_32_bits(pf->rx_timestamp); -+ -+ ns += sec * NSEC_PER_SEC; -+ *timestamp = rte_ns_to_timespec(ns); -+ -+ return 0; -+} -+ -+int -+hns3_timesync_read_tx_timestamp(struct rte_eth_dev *dev, -+ struct timespec *timestamp) -+{ -+#define TIME_TX_STAMP_NS_MASK 0x3FFFFFFF -+#define TIME_TX_STAMP_VALID 24 -+#define TIME_TX_STAMP_CNT_MASK 0x7 -+ struct hns3_adapter *hns = dev->data->dev_private; -+ struct hns3_hw *hw = &hns->hw; -+ uint64_t sec; -+ uint64_t tmp; -+ uint64_t ns; -+ int ts_cnt; -+ -+ if (!hns3_dev_ptp_supported(hw)) -+ return -ENOTSUP; -+ -+ ts_cnt = hns3_read_dev(hw, HNS3_TX_1588_BACK_TSP_CNT) & -+ TIME_TX_STAMP_CNT_MASK; -+ if (ts_cnt == 0) -+ return -EINVAL; -+ -+ ns = hns3_read_dev(hw, HNS3_TX_1588_TSP_BACK_0) & TIME_TX_STAMP_NS_MASK; -+ sec = hns3_read_dev(hw, HNS3_TX_1588_TSP_BACK_1); -+ tmp = hns3_read_dev(hw, HNS3_TX_1588_TSP_BACK_2) & 0xFFFF; -+ sec = (tmp << 32) | sec; -+ -+ ns += sec * NSEC_PER_SEC; -+ -+ *timestamp = rte_ns_to_timespec(ns); -+ -+ /* Clear current timestamp hardware stores */ -+ hns3_read_dev(hw, HNS3_TX_1588_SEQID_BACK); -+ -+ return 0; -+} -+ -+int -+hns3_timesync_read_time(struct rte_eth_dev *dev, struct timespec *ts) -+{ -+ struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private); -+ uint64_t ns, sec; -+ -+ if (!hns3_dev_ptp_supported(hw)) -+ return -ENOTSUP; -+ -+ sec = hns3_read_dev(hw, HNS3_CURR_TIME_OUT_L); -+ sec |= (uint64_t)(hns3_read_dev(hw, HNS3_CURR_TIME_OUT_H) & 0xFFFF) -+ << 32; -+ -+ ns = hns3_read_dev(hw, HNS3_CURR_TIME_OUT_NS); -+ ns += sec * NSEC_PER_SEC; -+ *ts = rte_ns_to_timespec(ns); -+ -+ return 0; -+} -+ -+int -+hns3_timesync_write_time(struct rte_eth_dev *dev, const struct timespec *ts) -+{ -+ struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private); -+ uint64_t sec = ts->tv_sec; -+ uint64_t ns = ts->tv_nsec; -+ -+ if (!hns3_dev_ptp_supported(hw)) -+ return -ENOTSUP; -+ -+ /* Set the timecounters to a new value. */ -+ hns3_write_dev(hw, HNS3_CFG_TIME_SYNC_H, upper_32_bits(sec)); -+ hns3_write_dev(hw, HNS3_CFG_TIME_SYNC_M, lower_32_bits(sec)); -+ hns3_write_dev(hw, HNS3_CFG_TIME_SYNC_L, lower_32_bits(ns)); -+ hns3_write_dev(hw, HNS3_CFG_TIME_SYNC_RDY, 1); -+ -+ return 0; -+} -+ -+int -+hns3_timesync_adjust_time(struct rte_eth_dev *dev, int64_t delta) -+{ -+#define TIME_SYNC_L_MASK 0x7FFFFFFF -+#define SYMBOL_BIT_OFFSET 31 -+ struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private); -+ struct timespec cur_time; -+ uint64_t ns; -+ -+ if (!hns3_dev_ptp_supported(hw)) -+ return -ENOTSUP; -+ -+ (void)hns3_timesync_read_time(dev, &cur_time); -+ ns = rte_timespec_to_ns((const struct timespec *)&cur_time); -+ cur_time = rte_ns_to_timespec(ns + delta); -+ (void)hns3_timesync_write_time(dev, (const struct timespec *)&cur_time); -+ -+ return 0; -+} -+ -+int -+hns3_restore_ptp(struct hns3_adapter *hns) -+{ -+ struct hns3_pf *pf = &hns->pf; -+ struct hns3_hw *hw = &hns->hw; -+ bool en = pf->ptp_enable; -+ int ret; -+ -+ if (!hns3_dev_ptp_supported(hw)) -+ return 0; -+ -+ ret = hns3_timesync_configure(hns, en); -+ if (ret) -+ hns3_err(hw, "restore PTP enable state(%d) failed, ret = %d", -+ en, ret); -+ -+ return ret; -+} -diff --git a/drivers/net/hns3/hns3_regs.h b/drivers/net/hns3/hns3_regs.h -index e141fe1..c9e10be 100644 ---- a/drivers/net/hns3/hns3_regs.h -+++ b/drivers/net/hns3/hns3_regs.h -@@ -121,6 +121,29 @@ - #define HNS3_TQP_INTR_RL_DEFAULT 0 - #define HNS3_TQP_INTR_QL_DEFAULT 0 - -+/* Register bit for 1588 event */ -+#define HNS3_VECTOR0_1588_INT_B 0 -+ -+#define HNS3_PTP_BASE_ADDRESS 0x29000 -+ -+#define HNS3_TX_1588_SEQID_BACK (HNS3_PTP_BASE_ADDRESS + 0x0) -+#define HNS3_TX_1588_TSP_BACK_0 (HNS3_PTP_BASE_ADDRESS + 0x4) -+#define HNS3_TX_1588_TSP_BACK_1 (HNS3_PTP_BASE_ADDRESS + 0x8) -+#define HNS3_TX_1588_TSP_BACK_2 (HNS3_PTP_BASE_ADDRESS + 0xc) -+ -+#define HNS3_TX_1588_BACK_TSP_CNT (HNS3_PTP_BASE_ADDRESS + 0x30) -+ -+#define HNS3_CFG_TIME_SYNC_H (HNS3_PTP_BASE_ADDRESS + 0x50) -+#define HNS3_CFG_TIME_SYNC_M (HNS3_PTP_BASE_ADDRESS + 0x54) -+#define HNS3_CFG_TIME_SYNC_L (HNS3_PTP_BASE_ADDRESS + 0x58) -+#define HNS3_CFG_TIME_SYNC_RDY (HNS3_PTP_BASE_ADDRESS + 0x5c) -+ -+#define HNS3_CFG_TIME_CYC_EN (HNS3_PTP_BASE_ADDRESS + 0x70) -+ -+#define HNS3_CURR_TIME_OUT_H (HNS3_PTP_BASE_ADDRESS + 0x74) -+#define HNS3_CURR_TIME_OUT_L (HNS3_PTP_BASE_ADDRESS + 0x78) -+#define HNS3_CURR_TIME_OUT_NS (HNS3_PTP_BASE_ADDRESS + 0x7c) -+ - /* gl_usec convert to hardware count, as writing each 1 represents 2us */ - #define HNS3_GL_USEC_TO_REG(gl_usec) ((gl_usec) >> 1) - /* rl_usec convert to hardware count, as writing each 1 represents 4us */ -diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c -index 0596c9c..c41cccb 100644 ---- a/drivers/net/hns3/hns3_rxtx.c -+++ b/drivers/net/hns3/hns3_rxtx.c -@@ -2365,6 +2365,23 @@ hns3_rx_alloc_buffer(struct hns3_rx_queue *rxq) - return rte_mbuf_raw_alloc(rxq->mb_pool); - } - -+static inline void -+hns3_rx_ptp_timestamp_handle(struct hns3_rx_queue *rxq, struct rte_mbuf *mbuf, -+ volatile struct hns3_desc *rxd) -+{ -+ struct hns3_pf *pf = HNS3_DEV_PRIVATE_TO_PF(rxq->hns); -+ uint64_t timestamp = rte_le_to_cpu_64(rxd->timestamp); -+ -+ mbuf->ol_flags |= PKT_RX_IEEE1588_PTP | PKT_RX_IEEE1588_TMST; -+ if (hns3_timestamp_rx_dynflag > 0) { -+ *RTE_MBUF_DYNFIELD(mbuf, hns3_timestamp_dynfield_offset, -+ rte_mbuf_timestamp_t *) = timestamp; -+ mbuf->ol_flags |= hns3_timestamp_rx_dynflag; -+ } -+ -+ pf->rx_timestamp = timestamp; -+} -+ - uint16_t - hns3_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) - { -@@ -2424,8 +2441,12 @@ hns3_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) - } - - rxm = rxe->mbuf; -+ rxm->ol_flags = 0; - rxe->mbuf = nmb; - -+ if (unlikely(bd_base_info & BIT(HNS3_RXD_TS_VLD_B))) -+ hns3_rx_ptp_timestamp_handle(rxq, rxm, rxdp); -+ - dma_addr = rte_mbuf_data_iova_default(nmb); - rxdp->addr = rte_cpu_to_le_64(dma_addr); - rxdp->rx.bd_base_info = 0; -@@ -2436,7 +2457,7 @@ hns3_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) - rxm->data_len = rxm->pkt_len; - rxm->port = rxq->port_id; - rxm->hash.rss = rte_le_to_cpu_32(rxd.rx.rss_hash); -- rxm->ol_flags = PKT_RX_RSS_HASH; -+ rxm->ol_flags |= PKT_RX_RSS_HASH; - if (unlikely(bd_base_info & BIT(HNS3_RXD_LUM_B))) { - rxm->hash.fdir.hi = - rte_le_to_cpu_16(rxd.rx.fd_id); -@@ -2455,6 +2476,9 @@ hns3_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) - - rxm->packet_type = hns3_rx_calc_ptype(rxq, l234_info, ol_info); - -+ if (rxm->packet_type == RTE_PTYPE_L2_ETHER_TIMESYNC) -+ rxm->ol_flags |= PKT_RX_IEEE1588_PTP; -+ - if (likely(bd_base_info & BIT(HNS3_RXD_L3L4P_B))) - hns3_rx_set_cksum_flag(rxm, rxm->packet_type, - cksum_err); -@@ -3043,7 +3067,7 @@ hns3_fill_per_desc(struct hns3_desc *desc, struct rte_mbuf *rxm) - { - desc->addr = rte_mbuf_data_iova(rxm); - desc->tx.send_size = rte_cpu_to_le_16(rte_pktmbuf_data_len(rxm)); -- desc->tx.tp_fe_sc_vld_ra_ri = rte_cpu_to_le_16(BIT(HNS3_TXD_VLD_B)); -+ desc->tx.tp_fe_sc_vld_ra_ri |= rte_cpu_to_le_16(BIT(HNS3_TXD_VLD_B)); - } - - static void -@@ -3091,6 +3115,10 @@ hns3_fill_first_desc(struct hns3_tx_queue *txq, struct hns3_desc *desc, - rte_cpu_to_le_32(BIT(HNS3_TXD_VLAN_B)); - desc->tx.vlan_tag = rte_cpu_to_le_16(rxm->vlan_tci); - } -+ -+ if (ol_flags & PKT_TX_IEEE1588_TMST) -+ desc->tx.tp_fe_sc_vld_ra_ri |= -+ rte_cpu_to_le_16(BIT(HNS3_TXD_TSYN_B)); - } - - static inline int -@@ -4149,10 +4177,21 @@ hns3_tx_burst_mode_get(struct rte_eth_dev *dev, __rte_unused uint16_t queue_id, - return 0; - } - -+static bool -+hns3_tx_check_simple_support(struct rte_eth_dev *dev) -+{ -+ uint64_t offloads = dev->data->dev_conf.txmode.offloads; -+ -+ struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private); -+ if (hns3_dev_ptp_supported(hw)) -+ return false; -+ -+ return (offloads == (offloads & DEV_TX_OFFLOAD_MBUF_FAST_FREE)); -+} -+ - static eth_tx_burst_t - hns3_get_tx_function(struct rte_eth_dev *dev, eth_tx_prep_t *prep) - { -- uint64_t offloads = dev->data->dev_conf.txmode.offloads; - struct hns3_adapter *hns = dev->data->dev_private; - bool vec_allowed, sve_allowed, simple_allowed; - -@@ -4160,7 +4199,7 @@ hns3_get_tx_function(struct rte_eth_dev *dev, eth_tx_prep_t *prep) - hns3_tx_check_vec_support(dev) == 0; - sve_allowed = vec_allowed && hns3_check_sve_support(); - simple_allowed = hns->tx_simple_allowed && -- offloads == (offloads & DEV_TX_OFFLOAD_MBUF_FAST_FREE); -+ hns3_tx_check_simple_support(dev); - - *prep = NULL; - -diff --git a/drivers/net/hns3/hns3_rxtx.h b/drivers/net/hns3/hns3_rxtx.h -index 6689397..eebbebf 100644 ---- a/drivers/net/hns3/hns3_rxtx.h -+++ b/drivers/net/hns3/hns3_rxtx.h -@@ -106,6 +106,8 @@ - #define HNS3_RXD_L3L4P_B 11 - #define HNS3_RXD_TSIND_S 12 - #define HNS3_RXD_TSIND_M (0x7 << HNS3_RXD_TSIND_S) -+ -+#define HNS3_RXD_TS_VLD_B 14 - #define HNS3_RXD_LKBK_B 15 - #define HNS3_RXD_GRO_SIZE_S 16 - #define HNS3_RXD_GRO_SIZE_M (0x3fff << HNS3_RXD_GRO_SIZE_S) -@@ -200,6 +202,8 @@ enum hns3_pkt_tun_type { - struct hns3_desc { - union { - uint64_t addr; -+ uint64_t timestamp; -+ - struct { - uint32_t addr0; - uint32_t addr1; -@@ -534,6 +538,9 @@ enum hns3_cksum_status { - HNS3_OUTER_L4_CKSUM_ERR = 8 - }; - -+extern uint64_t hns3_timestamp_rx_dynflag; -+extern int hns3_timestamp_dynfield_offset; -+ - static inline int - hns3_handle_bdinfo(struct hns3_rx_queue *rxq, struct rte_mbuf *rxm, - uint32_t bd_base_info, uint32_t l234_info, -diff --git a/drivers/net/hns3/hns3_rxtx_vec.c b/drivers/net/hns3/hns3_rxtx_vec.c -index a26c83d..fd7b272 100644 ---- a/drivers/net/hns3/hns3_rxtx_vec.c -+++ b/drivers/net/hns3/hns3_rxtx_vec.c -@@ -18,6 +18,10 @@ hns3_tx_check_vec_support(struct rte_eth_dev *dev) - { - struct rte_eth_txmode *txmode = &dev->data->dev_conf.txmode; - -+ struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private); -+ if (hns3_dev_ptp_supported(hw)) -+ return -ENOTSUP; -+ - /* Only support DEV_TX_OFFLOAD_MBUF_FAST_FREE */ - if (txmode->offloads != DEV_TX_OFFLOAD_MBUF_FAST_FREE) - return -ENOTSUP; -@@ -167,7 +171,6 @@ hns3_rxq_vec_setup(struct hns3_rx_queue *rxq) - memset(rxq->offset_table, 0, sizeof(rxq->offset_table)); - } - --#ifndef RTE_LIBRTE_IEEE1588 - static int - hns3_rxq_vec_check(struct hns3_rx_queue *rxq, void *arg) - { -@@ -183,17 +186,19 @@ hns3_rxq_vec_check(struct hns3_rx_queue *rxq, void *arg) - RTE_SET_USED(arg); - return 0; - } --#endif - - int - hns3_rx_check_vec_support(struct rte_eth_dev *dev) - { --#ifndef RTE_LIBRTE_IEEE1588 - struct rte_fdir_conf *fconf = &dev->data->dev_conf.fdir_conf; - struct rte_eth_rxmode *rxmode = &dev->data->dev_conf.rxmode; - uint64_t offloads_mask = DEV_RX_OFFLOAD_TCP_LRO | - DEV_RX_OFFLOAD_VLAN; - -+ struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private); -+ if (hns3_dev_ptp_supported(hw)) -+ return -ENOTSUP; -+ - if (dev->data->scattered_rx) - return -ENOTSUP; - -@@ -207,8 +212,4 @@ hns3_rx_check_vec_support(struct rte_eth_dev *dev) - return -ENOTSUP; - - return 0; --#else -- RTE_SET_USED(dev); -- return -ENOTSUP; --#endif - } -diff --git a/drivers/net/hns3/meson.build b/drivers/net/hns3/meson.build -index f6aac69..6d78c33 100644 ---- a/drivers/net/hns3/meson.build -+++ b/drivers/net/hns3/meson.build -@@ -26,7 +26,8 @@ sources = files('hns3_cmd.c', - 'hns3_rxtx.c', - 'hns3_stats.c', - 'hns3_mp.c', -- 'hns3_tm.c') -+ 'hns3_tm.c', -+ 'hns3_ptp.c') - - deps += ['hash'] - --- -2.7.4 - diff --git a/0075-ethdev-validate-input-in-register-info.patch b/0075-ethdev-validate-input-in-register-info.patch deleted file mode 100644 index 98edcae487226e7451ce83bc7aed6397ffd51b41..0000000000000000000000000000000000000000 --- a/0075-ethdev-validate-input-in-register-info.patch +++ /dev/null @@ -1,64 +0,0 @@ -From 94240428064fc641a78c2189329094acb4059eb8 Mon Sep 17 00:00:00 2001 -From: Chengchang Tang -Date: Fri, 2 Apr 2021 10:58:49 +0800 -Subject: [PATCH 075/189] ethdev: validate input in register info - -This patch adds validity check of input pointer in regs dump API. - -Fixes: 7a3f27cbf59b ("ethdev: add access to specific device info") -Fixes: 936eda25e8da ("net/hns3: support dump register") -Cc: stable@dpdk.org - -Signed-off-by: Chengchang Tang -Signed-off-by: Min Hu (Connor) -Reviewed-by: Ferruh Yigit ---- - drivers/net/hns3/hns3_regs.c | 5 ----- - lib/librte_ethdev/rte_ethdev.c | 2 ++ - lib/librte_ethdev/rte_ethdev.h | 1 + - 3 files changed, 3 insertions(+), 5 deletions(-) - -diff --git a/drivers/net/hns3/hns3_regs.c b/drivers/net/hns3/hns3_regs.c -index 5b14727..93055a4 100644 ---- a/drivers/net/hns3/hns3_regs.c -+++ b/drivers/net/hns3/hns3_regs.c -@@ -484,11 +484,6 @@ hns3_get_regs(struct rte_eth_dev *eth_dev, struct rte_dev_reg_info *regs) - uint32_t *data; - int ret; - -- if (regs == NULL) { -- hns3_err(hw, "the input parameter regs is NULL!"); -- return -EINVAL; -- } -- - ret = hns3_get_regs_length(hw, &length); - if (ret) - return ret; -diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c -index 17ddacc..f311868 100644 ---- a/lib/librte_ethdev/rte_ethdev.c -+++ b/lib/librte_ethdev/rte_ethdev.c -@@ -5239,6 +5239,8 @@ rte_eth_dev_get_reg_info(uint16_t port_id, struct rte_dev_reg_info *info) - struct rte_eth_dev *dev; - - RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); -+ if (info == NULL) -+ return -EINVAL; - - dev = &rte_eth_devices[port_id]; - RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->get_reg, -ENOTSUP); -diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h -index f5f8919..e89fc50 100644 ---- a/lib/librte_ethdev/rte_ethdev.h -+++ b/lib/librte_ethdev/rte_ethdev.h -@@ -4395,6 +4395,7 @@ int rte_eth_dev_get_eeprom(uint16_t port_id, struct rte_dev_eeprom_info *info); - * @return - * - (0) if successful. - * - (-ENOTSUP) if hardware doesn't support. -+ * - (-EINVAL) if bad parameter. - * - (-ENODEV) if *port_id* invalid. - * - (-EIO) if device is removed. - * - others depends on the specific operations implementation. --- -2.7.4 - diff --git a/0075-net-hns3-fix-order-of-clearing-imissed-register-in-P.patch b/0075-net-hns3-fix-order-of-clearing-imissed-register-in-P.patch new file mode 100644 index 0000000000000000000000000000000000000000..d22e487474a5a909bfd4a35da40ad685a20ffb3c --- /dev/null +++ b/0075-net-hns3-fix-order-of-clearing-imissed-register-in-P.patch @@ -0,0 +1,186 @@ +From 1a1de9879f58b4fd202ecd481c56ae9777207fe9 Mon Sep 17 00:00:00 2001 +From: Huisong Li +Date: Thu, 5 May 2022 20:27:01 +0800 +Subject: [PATCH] net/hns3: fix order of clearing imissed register in PF + +Clearing imissed registers in PF hardware depends on the +'drop_stats_mode' in struct hns3_hw. The variable is initialized after +the "hns3_get_configuration". But, in current code, the clearing +operation runs before the function. +So this patch fixes this order. In addition, this patch extracts a +public function to initialize and uninitialize statistics to improve the +maintainability of these codes. + +Fixes: 3e9f3042d7c8 ("net/hns3: add imissed packet stats") +Cc: stable@dpdk.org + +Signed-off-by: Huisong Li +Signed-off-by: Min Hu (Connor) +--- + drivers/net/hns3/hns3_ethdev.c | 13 +++---------- + drivers/net/hns3/hns3_ethdev_vf.c | 13 +++---------- + drivers/net/hns3/hns3_stats.c | 27 ++++++++++++++++++++++++--- + drivers/net/hns3/hns3_stats.h | 5 ++--- + 4 files changed, 32 insertions(+), 26 deletions(-) + +diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c +index 4e089e682f..5aed7046d8 100644 +--- a/drivers/net/hns3/hns3_ethdev.c ++++ b/drivers/net/hns3/hns3_ethdev.c +@@ -4622,13 +4622,6 @@ hns3_init_pf(struct rte_eth_dev *eth_dev) + goto err_cmd_init; + } + +- /* Hardware statistics of imissed registers cleared. */ +- ret = hns3_update_imissed_stats(hw, true); +- if (ret) { +- hns3_err(hw, "clear imissed stats failed, ret = %d", ret); +- goto err_cmd_init; +- } +- + hns3_config_all_msix_error(hw, true); + + ret = rte_intr_callback_register(pci_dev->intr_handle, +@@ -4654,7 +4647,7 @@ hns3_init_pf(struct rte_eth_dev *eth_dev) + goto err_get_config; + } + +- ret = hns3_tqp_stats_init(hw); ++ ret = hns3_stats_init(hw); + if (ret) + goto err_get_config; + +@@ -4700,7 +4693,7 @@ hns3_init_pf(struct rte_eth_dev *eth_dev) + err_fdir: + hns3_uninit_umv_space(hw); + err_init_hw: +- hns3_tqp_stats_uninit(hw); ++ hns3_stats_uninit(hw); + err_get_config: + hns3_pf_disable_irq0(hw); + rte_intr_disable(pci_dev->intr_handle); +@@ -4734,7 +4727,7 @@ hns3_uninit_pf(struct rte_eth_dev *eth_dev) + hns3_flow_uninit(eth_dev); + hns3_fdir_filter_uninit(hns); + hns3_uninit_umv_space(hw); +- hns3_tqp_stats_uninit(hw); ++ hns3_stats_uninit(hw); + hns3_config_mac_tnl_int(hw, false); + hns3_pf_disable_irq0(hw); + rte_intr_disable(pci_dev->intr_handle); +diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c +index 9091706fe5..9e9fdc4144 100644 +--- a/drivers/net/hns3/hns3_ethdev_vf.c ++++ b/drivers/net/hns3/hns3_ethdev_vf.c +@@ -1510,17 +1510,10 @@ hns3vf_init_vf(struct rte_eth_dev *eth_dev) + goto err_get_config; + } + +- ret = hns3_tqp_stats_init(hw); ++ ret = hns3_stats_init(hw); + if (ret) + goto err_get_config; + +- /* Hardware statistics of imissed registers cleared. */ +- ret = hns3_update_imissed_stats(hw, true); +- if (ret) { +- hns3_err(hw, "clear imissed stats failed, ret = %d", ret); +- goto err_set_tc_queue; +- } +- + ret = hns3_queue_to_tc_mapping(hw, hw->tqps_num, hw->tqps_num); + if (ret) { + PMD_INIT_LOG(ERR, "failed to set tc info, ret = %d.", ret); +@@ -1548,7 +1541,7 @@ hns3vf_init_vf(struct rte_eth_dev *eth_dev) + return 0; + + err_set_tc_queue: +- hns3_tqp_stats_uninit(hw); ++ hns3_stats_uninit(hw); + + err_get_config: + hns3vf_disable_irq0(hw); +@@ -1579,7 +1572,7 @@ hns3vf_uninit_vf(struct rte_eth_dev *eth_dev) + (void)hns3vf_set_alive(hw, false); + (void)hns3vf_set_promisc_mode(hw, false, false, false); + hns3_flow_uninit(eth_dev); +- hns3_tqp_stats_uninit(hw); ++ hns3_stats_uninit(hw); + hns3vf_disable_irq0(hw); + rte_intr_disable(pci_dev->intr_handle); + hns3_intr_unregister(pci_dev->intr_handle, hns3vf_interrupt_handler, +diff --git a/drivers/net/hns3/hns3_stats.c b/drivers/net/hns3/hns3_stats.c +index 806720faff..e4a5dcf2f8 100644 +--- a/drivers/net/hns3/hns3_stats.c ++++ b/drivers/net/hns3/hns3_stats.c +@@ -540,7 +540,7 @@ hns3_update_port_tx_ssu_drop_stats(struct hns3_hw *hw) + return 0; + } + +-int ++static int + hns3_update_imissed_stats(struct hns3_hw *hw, bool is_clear) + { + struct hns3_adapter *hns = HNS3_DEV_HW_TO_ADAPTER(hw); +@@ -1476,7 +1476,7 @@ hns3_dev_xstats_reset(struct rte_eth_dev *dev) + return 0; + } + +-int ++static int + hns3_tqp_stats_init(struct hns3_hw *hw) + { + struct hns3_tqp_stats *tqp_stats = &hw->tqp_stats; +@@ -1500,7 +1500,7 @@ hns3_tqp_stats_init(struct hns3_hw *hw) + return 0; + } + +-void ++static void + hns3_tqp_stats_uninit(struct hns3_hw *hw) + { + struct hns3_tqp_stats *tqp_stats = &hw->tqp_stats; +@@ -1521,3 +1521,24 @@ hns3_tqp_stats_clear(struct hns3_hw *hw) + memset(stats->rcb_rx_ring_pktnum, 0, sizeof(uint64_t) * hw->tqps_num); + memset(stats->rcb_tx_ring_pktnum, 0, sizeof(uint64_t) * hw->tqps_num); + } ++ ++int ++hns3_stats_init(struct hns3_hw *hw) ++{ ++ int ret; ++ ++ /* Hardware statistics of imissed registers cleared. */ ++ ret = hns3_update_imissed_stats(hw, true); ++ if (ret) { ++ hns3_err(hw, "clear imissed stats failed, ret = %d", ret); ++ return ret; ++ } ++ ++ return hns3_tqp_stats_init(hw); ++} ++ ++void ++hns3_stats_uninit(struct hns3_hw *hw) ++{ ++ hns3_tqp_stats_uninit(hw); ++} +diff --git a/drivers/net/hns3/hns3_stats.h b/drivers/net/hns3/hns3_stats.h +index c81d351082..e89dc97632 100644 +--- a/drivers/net/hns3/hns3_stats.h ++++ b/drivers/net/hns3/hns3_stats.h +@@ -161,9 +161,8 @@ int hns3_dev_xstats_get_names_by_id(struct rte_eth_dev *dev, + struct rte_eth_xstat_name *xstats_names, + uint32_t size); + int hns3_stats_reset(struct rte_eth_dev *dev); +-int hns3_tqp_stats_init(struct hns3_hw *hw); +-void hns3_tqp_stats_uninit(struct hns3_hw *hw); +-int hns3_update_imissed_stats(struct hns3_hw *hw, bool is_clear); ++int hns3_stats_init(struct hns3_hw *hw); ++void hns3_stats_uninit(struct hns3_hw *hw); + int hns3_query_mac_stats_reg_num(struct hns3_hw *hw); + + #endif /* _HNS3_STATS_H_ */ +-- +2.33.0 + diff --git a/0076-net-hns3-fix-MAC-and-queues-HW-statistics-overflow.patch b/0076-net-hns3-fix-MAC-and-queues-HW-statistics-overflow.patch new file mode 100644 index 0000000000000000000000000000000000000000..2326d59e9c5de3f273ef6eaac9fe8cf4df861041 --- /dev/null +++ b/0076-net-hns3-fix-MAC-and-queues-HW-statistics-overflow.patch @@ -0,0 +1,432 @@ +From dd4cf775f6c2f7dc18c6845983bc84c6351326c4 Mon Sep 17 00:00:00 2001 +From: Huisong Li +Date: Thu, 5 May 2022 20:27:02 +0800 +Subject: [PATCH 16/25] net/hns3: fix MAC and queues HW statistics overflow + +The MAC and queues statistics are 32-bit registers in hardware. If +hardware statistics are not obtained for a long time, these statistics +will be overflow. +So PF and VF driver have to periodically obtain and save these +statistics. Since the periodical task and the stats API are in different +threads, we introduce a statistics lock to protect the statistics. + +Fixes: 8839c5e202f3 ("net/hns3: support device stats") +Cc: stable@dpdk.org + +Signed-off-by: Huisong Li +Signed-off-by: Min Hu (Connor) +--- + drivers/net/hns3/hns3_ethdev.c | 6 +- + drivers/net/hns3/hns3_ethdev.h | 6 ++ + drivers/net/hns3/hns3_ethdev_vf.c | 6 +- + drivers/net/hns3/hns3_stats.c | 144 +++++++++++++++++++++--------- + drivers/net/hns3/hns3_stats.h | 1 + + 5 files changed, 116 insertions(+), 47 deletions(-) + +diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c +index dc37914aea..af317a8c47 100644 +--- a/drivers/net/hns3/hns3_ethdev.c ++++ b/drivers/net/hns3/hns3_ethdev.c +@@ -4365,10 +4365,12 @@ hns3_service_handler(void *param) + struct hns3_adapter *hns = eth_dev->data->dev_private; + struct hns3_hw *hw = &hns->hw; + +- if (!hns3_is_reset_pending(hns)) ++ if (!hns3_is_reset_pending(hns)) { + hns3_update_linkstatus_and_event(hw, true); +- else ++ hns3_update_hw_stats(hw); ++ } else { + hns3_warn(hw, "Cancel the query when reset is pending"); ++ } + + rte_eal_alarm_set(HNS3_SERVICE_INTERVAL, hns3_service_handler, eth_dev); + } +diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h +index d6d82c55f9..889220237c 100644 +--- a/drivers/net/hns3/hns3_ethdev.h ++++ b/drivers/net/hns3/hns3_ethdev.h +@@ -503,6 +503,12 @@ struct hns3_hw { + uint32_t mac_stats_reg_num; + struct hns3_rx_missed_stats imissed_stats; + uint64_t oerror_stats; ++ /* ++ * The lock is used to protect statistics update in stats APIs and ++ * periodic task. ++ */ ++ rte_spinlock_t stats_lock; ++ + uint32_t fw_version; + uint16_t pf_vf_if_version; /* version of communication interface */ + +diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c +index b66047c09f..70b773cfe9 100644 +--- a/drivers/net/hns3/hns3_ethdev_vf.c ++++ b/drivers/net/hns3/hns3_ethdev_vf.c +@@ -1338,10 +1338,12 @@ hns3vf_service_handler(void *param) + * Before querying the link status, check whether there is a reset + * pending, and if so, abandon the query. + */ +- if (!hns3vf_is_reset_pending(hns)) ++ if (!hns3vf_is_reset_pending(hns)) { + hns3vf_request_link_info(hw); +- else ++ hns3_update_hw_stats(hw); ++ } else { + hns3_warn(hw, "Cancel the query when reset is pending"); ++ } + + rte_eal_alarm_set(HNS3VF_SERVICE_INTERVAL, hns3vf_service_handler, + eth_dev); +diff --git a/drivers/net/hns3/hns3_stats.c b/drivers/net/hns3/hns3_stats.c +index 03719cd014..9b7ad067aa 100644 +--- a/drivers/net/hns3/hns3_stats.c ++++ b/drivers/net/hns3/hns3_stats.c +@@ -584,6 +584,28 @@ hns3_update_oerror_stats(struct hns3_hw *hw, bool is_clear) + return 0; + } + ++static void ++hns3_rcb_rx_ring_stats_get(struct hns3_rx_queue *rxq, ++ struct hns3_tqp_stats *stats) ++{ ++ uint32_t cnt; ++ ++ cnt = hns3_read_dev(rxq, HNS3_RING_RX_PKTNUM_RECORD_REG); ++ stats->rcb_rx_ring_pktnum_rcd += cnt; ++ stats->rcb_rx_ring_pktnum[rxq->queue_id] += cnt; ++} ++ ++static void ++hns3_rcb_tx_ring_stats_get(struct hns3_tx_queue *txq, ++ struct hns3_tqp_stats *stats) ++{ ++ uint32_t cnt; ++ ++ cnt = hns3_read_dev(txq, HNS3_RING_TX_PKTNUM_RECORD_REG); ++ stats->rcb_tx_ring_pktnum_rcd += cnt; ++ stats->rcb_tx_ring_pktnum[txq->queue_id] += cnt; ++} ++ + /* + * Query tqp tx queue statistics ,opcode id: 0x0B03. + * Query tqp rx queue statistics ,opcode id: 0x0B13. +@@ -604,16 +626,14 @@ hns3_stats_get(struct rte_eth_dev *eth_dev, struct rte_eth_stats *rte_stats) + struct hns3_tqp_stats *stats = &hw->tqp_stats; + struct hns3_rx_queue *rxq; + struct hns3_tx_queue *txq; +- uint64_t cnt; + uint16_t i; + int ret; + + /* Update imissed stats */ + ret = hns3_update_imissed_stats(hw, false); + if (ret) { +- hns3_err(hw, "update imissed stats failed, ret = %d", +- ret); +- return ret; ++ hns3_err(hw, "update imissed stats failed, ret = %d", ret); ++ goto out; + } + rte_stats->imissed = imissed_stats->rpu_rx_drop_cnt + + imissed_stats->ssu_rx_drop_cnt; +@@ -624,15 +644,12 @@ hns3_stats_get(struct rte_eth_dev *eth_dev, struct rte_eth_stats *rte_stats) + if (rxq == NULL) + continue; + +- cnt = hns3_read_dev(rxq, HNS3_RING_RX_PKTNUM_RECORD_REG); +- /* +- * Read hardware and software in adjacent positions to minumize +- * the timing variance. +- */ ++ rte_spinlock_lock(&hw->stats_lock); ++ hns3_rcb_rx_ring_stats_get(rxq, stats); ++ rte_spinlock_unlock(&hw->stats_lock); ++ + rte_stats->ierrors += rxq->err_stats.l2_errors + + rxq->err_stats.pkt_len_errors; +- stats->rcb_rx_ring_pktnum_rcd += cnt; +- stats->rcb_rx_ring_pktnum[i] += cnt; + rte_stats->ibytes += rxq->basic_stats.bytes; + } + +@@ -642,17 +659,16 @@ hns3_stats_get(struct rte_eth_dev *eth_dev, struct rte_eth_stats *rte_stats) + if (txq == NULL) + continue; + +- cnt = hns3_read_dev(txq, HNS3_RING_TX_PKTNUM_RECORD_REG); +- stats->rcb_tx_ring_pktnum_rcd += cnt; +- stats->rcb_tx_ring_pktnum[i] += cnt; ++ rte_spinlock_lock(&hw->stats_lock); ++ hns3_rcb_tx_ring_stats_get(txq, stats); ++ rte_spinlock_unlock(&hw->stats_lock); + rte_stats->obytes += txq->basic_stats.bytes; + } + + ret = hns3_update_oerror_stats(hw, false); + if (ret) { +- hns3_err(hw, "update oerror stats failed, ret = %d", +- ret); +- return ret; ++ hns3_err(hw, "update oerror stats failed, ret = %d", ret); ++ goto out; + } + rte_stats->oerrors = hw->oerror_stats; + +@@ -667,8 +683,8 @@ hns3_stats_get(struct rte_eth_dev *eth_dev, struct rte_eth_stats *rte_stats) + rte_stats->opackets = stats->rcb_tx_ring_pktnum_rcd - + rte_stats->oerrors; + rte_stats->rx_nombuf = eth_dev->data->rx_mbuf_alloc_failed; +- +- return 0; ++out: ++ return ret; + } + + int +@@ -688,7 +704,7 @@ hns3_stats_reset(struct rte_eth_dev *eth_dev) + ret = hns3_update_imissed_stats(hw, true); + if (ret) { + hns3_err(hw, "clear imissed stats failed, ret = %d", ret); +- return ret; ++ goto out; + } + + /* +@@ -697,9 +713,8 @@ hns3_stats_reset(struct rte_eth_dev *eth_dev) + */ + ret = hns3_update_oerror_stats(hw, true); + if (ret) { +- hns3_err(hw, "clear oerror stats failed, ret = %d", +- ret); +- return ret; ++ hns3_err(hw, "clear oerror stats failed, ret = %d", ret); ++ goto out; + } + + for (i = 0; i < eth_dev->data->nb_rx_queues; i++) { +@@ -717,6 +732,7 @@ hns3_stats_reset(struct rte_eth_dev *eth_dev) + if (rxq == NULL) + continue; + ++ rte_spinlock_lock(&hw->stats_lock); + memset(&rxq->basic_stats, 0, + sizeof(struct hns3_rx_basic_stats)); + +@@ -724,6 +740,7 @@ hns3_stats_reset(struct rte_eth_dev *eth_dev) + (void)hns3_read_dev(rxq, HNS3_RING_RX_PKTNUM_RECORD_REG); + rxq->err_stats.pkt_len_errors = 0; + rxq->err_stats.l2_errors = 0; ++ rte_spinlock_unlock(&hw->stats_lock); + } + + /* Clear all the stats of a txq in a loop to keep them synchronized */ +@@ -732,16 +749,20 @@ hns3_stats_reset(struct rte_eth_dev *eth_dev) + if (txq == NULL) + continue; + ++ rte_spinlock_lock(&hw->stats_lock); + memset(&txq->basic_stats, 0, + sizeof(struct hns3_tx_basic_stats)); + + /* This register is read-clear */ + (void)hns3_read_dev(txq, HNS3_RING_TX_PKTNUM_RECORD_REG); ++ rte_spinlock_unlock(&hw->stats_lock); + } + ++ rte_spinlock_lock(&hw->stats_lock); + hns3_tqp_stats_clear(hw); +- +- return 0; ++ rte_spinlock_unlock(&hw->stats_lock); ++out: ++ return ret; + } + + static int +@@ -908,7 +929,6 @@ hns3_rxq_basic_stats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *xstats, + struct hns3_rx_basic_stats *rxq_stats; + struct hns3_rx_queue *rxq; + uint16_t i, j; +- uint32_t cnt; + char *val; + + for (i = 0; i < dev->data->nb_rx_queues; i++) { +@@ -916,16 +936,10 @@ hns3_rxq_basic_stats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *xstats, + if (rxq == NULL) + continue; + +- cnt = hns3_read_dev(rxq, HNS3_RING_RX_PKTNUM_RECORD_REG); +- /* +- * Read hardware and software in adjacent positions to minimize +- * the time difference. +- */ ++ hns3_rcb_rx_ring_stats_get(rxq, stats); + rxq_stats = &rxq->basic_stats; + rxq_stats->errors = rxq->err_stats.l2_errors + + rxq->err_stats.pkt_len_errors; +- stats->rcb_rx_ring_pktnum_rcd += cnt; +- stats->rcb_rx_ring_pktnum[i] += cnt; + + /* + * If HW statistics are reset by stats_reset, but a lot of +@@ -955,7 +969,6 @@ hns3_txq_basic_stats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *xstats, + struct hns3_tx_basic_stats *txq_stats; + struct hns3_tx_queue *txq; + uint16_t i, j; +- uint32_t cnt; + char *val; + + for (i = 0; i < dev->data->nb_tx_queues; i++) { +@@ -963,9 +976,7 @@ hns3_txq_basic_stats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *xstats, + if (txq == NULL) + continue; + +- cnt = hns3_read_dev(txq, HNS3_RING_TX_PKTNUM_RECORD_REG); +- stats->rcb_tx_ring_pktnum_rcd += cnt; +- stats->rcb_tx_ring_pktnum[i] += cnt; ++ hns3_rcb_tx_ring_stats_get(txq, stats); + + txq_stats = &txq->basic_stats; + txq_stats->packets = stats->rcb_tx_ring_pktnum[i]; +@@ -1050,6 +1061,7 @@ hns3_dev_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *xstats, + + count = 0; + ++ rte_spinlock_lock(&hw->stats_lock); + hns3_tqp_basic_stats_get(dev, xstats, &count); + + if (!hns->is_vf) { +@@ -1057,6 +1069,7 @@ hns3_dev_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *xstats, + ret = hns3_query_update_mac_stats(dev); + if (ret < 0) { + hns3_err(hw, "Update Mac stats fail : %d", ret); ++ rte_spinlock_unlock(&hw->stats_lock); + return ret; + } + +@@ -1068,11 +1081,11 @@ hns3_dev_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *xstats, + count++; + } + } ++ rte_spinlock_unlock(&hw->stats_lock); + + ret = hns3_update_imissed_stats(hw, false); + if (ret) { +- hns3_err(hw, "update imissed stats failed, ret = %d", +- ret); ++ hns3_err(hw, "update imissed stats failed, ret = %d", ret); + return ret; + } + +@@ -1101,8 +1114,10 @@ hns3_dev_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *xstats, + } + } + ++ rte_spinlock_lock(&hw->stats_lock); + hns3_tqp_dfx_stats_get(dev, xstats, &count); + hns3_queue_stats_get(dev, xstats, &count); ++ rte_spinlock_unlock(&hw->stats_lock); + + return count; + } +@@ -1453,6 +1468,7 @@ int + hns3_dev_xstats_reset(struct rte_eth_dev *dev) + { + struct hns3_adapter *hns = dev->data->dev_private; ++ struct hns3_hw *hw = &hns->hw; + int ret; + + /* Clear tqp stats */ +@@ -1460,20 +1476,22 @@ hns3_dev_xstats_reset(struct rte_eth_dev *dev) + if (ret) + return ret; + ++ rte_spinlock_lock(&hw->stats_lock); + hns3_tqp_dfx_stats_clear(dev); + + /* Clear reset stats */ + memset(&hns->hw.reset.stats, 0, sizeof(struct hns3_reset_stats)); + + if (hns->is_vf) +- return 0; ++ goto out; + + /* HW registers are cleared on read */ + ret = hns3_mac_stats_reset(dev); +- if (ret) +- return ret; + +- return 0; ++out: ++ rte_spinlock_unlock(&hw->stats_lock); ++ ++ return ret; + } + + static int +@@ -1527,6 +1545,7 @@ hns3_stats_init(struct hns3_hw *hw) + { + int ret; + ++ rte_spinlock_init(&hw->stats_lock); + /* Hardware statistics of imissed registers cleared. */ + ret = hns3_update_imissed_stats(hw, true); + if (ret) { +@@ -1542,3 +1561,42 @@ hns3_stats_uninit(struct hns3_hw *hw) + { + hns3_tqp_stats_uninit(hw); + } ++ ++static void ++hns3_update_queues_stats(struct hns3_hw *hw) ++{ ++ struct rte_eth_dev_data *data = hw->data; ++ struct hns3_rx_queue *rxq; ++ struct hns3_tx_queue *txq; ++ uint16_t i; ++ ++ for (i = 0; i < data->nb_rx_queues; i++) { ++ rxq = data->rx_queues[i]; ++ if (rxq != NULL) ++ hns3_rcb_rx_ring_stats_get(rxq, &hw->tqp_stats); ++ } ++ ++ for (i = 0; i < data->nb_tx_queues; i++) { ++ txq = data->tx_queues[i]; ++ if (txq != NULL) ++ hns3_rcb_tx_ring_stats_get(txq, &hw->tqp_stats); ++ } ++} ++ ++/* ++ * Some hardware statistics registers are not 64-bit. If hardware statistics are ++ * not obtained for a long time, these statistics may be reversed. This function ++ * is used to update these hardware statistics in periodic task. ++ */ ++void ++hns3_update_hw_stats(struct hns3_hw *hw) ++{ ++ struct hns3_adapter *hns = HNS3_DEV_HW_TO_ADAPTER(hw); ++ ++ rte_spinlock_lock(&hw->stats_lock); ++ if (!hns->is_vf) ++ hns3_update_mac_stats(hw); ++ ++ hns3_update_queues_stats(hw); ++ rte_spinlock_unlock(&hw->stats_lock); ++} +diff --git a/drivers/net/hns3/hns3_stats.h b/drivers/net/hns3/hns3_stats.h +index e89dc97632..b5cd6188b4 100644 +--- a/drivers/net/hns3/hns3_stats.h ++++ b/drivers/net/hns3/hns3_stats.h +@@ -164,5 +164,6 @@ int hns3_stats_reset(struct rte_eth_dev *dev); + int hns3_stats_init(struct hns3_hw *hw); + void hns3_stats_uninit(struct hns3_hw *hw); + int hns3_query_mac_stats_reg_num(struct hns3_hw *hw); ++void hns3_update_hw_stats(struct hns3_hw *hw); + + #endif /* _HNS3_STATS_H_ */ +-- +2.30.0 + diff --git a/0076-net-hns3-support-wait-in-link-update.patch b/0076-net-hns3-support-wait-in-link-update.patch deleted file mode 100644 index 91ec8bae322cce2e0a4a7cb1fee32f35ab3d83ea..0000000000000000000000000000000000000000 --- a/0076-net-hns3-support-wait-in-link-update.patch +++ /dev/null @@ -1,64 +0,0 @@ -From ee9d7f7372170853e7538256c5e764bf154f3132 Mon Sep 17 00:00:00 2001 -From: Huisong Li -Date: Tue, 30 Mar 2021 20:53:25 +0800 -Subject: [PATCH 076/189] net/hns3: support wait in link update - -There are two APIs in ethdev layer to get link status of device, namely, -"rte_eth_link_get" and "rte_eth_link_get_nowait". When the device link -is unstable or auto-negotiation is in progress, the first API supports -the function of waiting for the NIC to link up, and the maximum waiting -time is 9 seconds based on DPDK Documentation. For the hns3 PMD driver, -the link can be established within 2 seconds. - -Signed-off-by: Huisong Li -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_ethdev.c | 26 +++++++++++++++++++------- - 1 file changed, 19 insertions(+), 7 deletions(-) - -diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c -index aef1ebf..05f199e 100644 ---- a/drivers/net/hns3/hns3_ethdev.c -+++ b/drivers/net/hns3/hns3_ethdev.c -@@ -2779,19 +2779,31 @@ hns3_setup_linkstatus(struct rte_eth_dev *eth_dev, - } - - static int --hns3_dev_link_update(struct rte_eth_dev *eth_dev, -- __rte_unused int wait_to_complete) -+hns3_dev_link_update(struct rte_eth_dev *eth_dev, int wait_to_complete) - { -+#define HNS3_LINK_CHECK_INTERVAL 100 /* 100ms */ -+#define HNS3_MAX_LINK_CHECK_TIMES 20 /* 2s (100 * 20ms) in total */ -+ - struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private); -+ uint32_t retry_cnt = HNS3_MAX_LINK_CHECK_TIMES; - struct hns3_mac *mac = &hw->mac; - struct rte_eth_link new_link; - int ret; - -- ret = hns3_update_port_link_info(eth_dev); -- if (ret) { -- mac->link_status = ETH_LINK_DOWN; -- hns3_err(hw, "failed to get port link info, ret = %d.", ret); -- } -+ do { -+ ret = hns3_update_port_link_info(eth_dev); -+ if (ret) { -+ mac->link_status = ETH_LINK_DOWN; -+ hns3_err(hw, "failed to get port link info, ret = %d.", -+ ret); -+ break; -+ } -+ -+ if (!wait_to_complete || mac->link_status == ETH_LINK_UP) -+ break; -+ -+ rte_delay_ms(HNS3_LINK_CHECK_INTERVAL); -+ } while (retry_cnt--); - - memset(&new_link, 0, sizeof(new_link)); - hns3_setup_linkstatus(eth_dev, &new_link); --- -2.7.4 - diff --git a/0077-net-hns3-fix-pseudo-sharing-between-threads.patch b/0077-net-hns3-fix-pseudo-sharing-between-threads.patch new file mode 100644 index 0000000000000000000000000000000000000000..b191828f0f9fbd1c4f60f1b4a520831049417b01 --- /dev/null +++ b/0077-net-hns3-fix-pseudo-sharing-between-threads.patch @@ -0,0 +1,45 @@ +From ec0147b5690e6cae2cc4555f78b87defee59c946 Mon Sep 17 00:00:00 2001 +From: Huisong Li +Date: Thu, 5 May 2022 20:27:03 +0800 +Subject: [PATCH] net/hns3: fix pseudo-sharing between threads + +Some fields in the end of 'struct hns3_rx_queue' and +'struct hns3_tx_queue' are not accessed in the I/O path. +But these fields may be accessed in other threads, which may lead to the +problem of cache pseudo-sharing of IO threads. This patch add a +cacheline alignment to avoid it. + +Fixes: 9261fd3caf1f ("net/hns3: improve IO path data cache usage") +Cc: stable@dpdk.org + +Signed-off-by: Huisong Li +Signed-off-by: Min Hu (Connor) +--- + drivers/net/hns3/hns3_rxtx.h | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/net/hns3/hns3_rxtx.h b/drivers/net/hns3/hns3_rxtx.h +index a000318357..62efc854e4 100644 +--- a/drivers/net/hns3/hns3_rxtx.h ++++ b/drivers/net/hns3/hns3_rxtx.h +@@ -348,7 +348,7 @@ struct hns3_rx_queue { + * The following fields are not accessed in the I/O path, so they are + * placed at the end. + */ +- void *io_base; ++ void *io_base __rte_cache_aligned; + struct hns3_adapter *hns; + uint64_t rx_ring_phys_addr; /* RX ring DMA address */ + const struct rte_memzone *mz; +@@ -521,7 +521,7 @@ struct hns3_tx_queue { + * The following fields are not accessed in the I/O path, so they are + * placed at the end. + */ +- void *io_base; ++ void *io_base __rte_cache_aligned; + struct hns3_adapter *hns; + uint64_t tx_ring_phys_addr; /* TX ring DMA address */ + const struct rte_memzone *mz; +-- +2.33.0 + diff --git a/0077-net-hns3-fix-some-function-names-for-copper-media-ty.patch b/0077-net-hns3-fix-some-function-names-for-copper-media-ty.patch deleted file mode 100644 index d1e58a2dc1bb35dce496f12100eb5c48d994522f..0000000000000000000000000000000000000000 --- a/0077-net-hns3-fix-some-function-names-for-copper-media-ty.patch +++ /dev/null @@ -1,76 +0,0 @@ -From 45da720c44c7a7758cc811bea609116088168f25 Mon Sep 17 00:00:00 2001 -From: Huisong Li -Date: Wed, 31 Mar 2021 18:01:35 +0800 -Subject: [PATCH 077/189] net/hns3: fix some function names for copper media - type - -PHY is a common concept for the copper and optical media type interface. -There are some inappropriate function names for copper ports, which -needs to be adjusted. - -Fixes: 2e4859f3b362 ("net/hns3: support PF device with copper PHYs") - -Signed-off-by: Huisong Li -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_ethdev.c | 12 ++++++------ - 1 file changed, 6 insertions(+), 6 deletions(-) - -diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c -index 05f199e..4dff016 100644 ---- a/drivers/net/hns3/hns3_ethdev.c -+++ b/drivers/net/hns3/hns3_ethdev.c -@@ -4597,7 +4597,7 @@ hns3_update_fiber_link_info(struct hns3_hw *hw) - } - - static void --hns3_parse_phy_params(struct hns3_cmd_desc *desc, struct hns3_mac *mac) -+hns3_parse_copper_phy_params(struct hns3_cmd_desc *desc, struct hns3_mac *mac) - { - struct hns3_phy_params_bd0_cmd *req; - -@@ -4615,7 +4615,7 @@ hns3_parse_phy_params(struct hns3_cmd_desc *desc, struct hns3_mac *mac) - } - - static int --hns3_get_phy_params(struct hns3_hw *hw, struct hns3_mac *mac) -+hns3_get_copper_phy_params(struct hns3_hw *hw, struct hns3_mac *mac) - { - struct hns3_cmd_desc desc[HNS3_PHY_PARAM_CFG_BD_NUM]; - uint16_t i; -@@ -4634,20 +4634,20 @@ hns3_get_phy_params(struct hns3_hw *hw, struct hns3_mac *mac) - return ret; - } - -- hns3_parse_phy_params(desc, mac); -+ hns3_parse_copper_phy_params(desc, mac); - - return 0; - } - - static int --hns3_update_phy_link_info(struct hns3_hw *hw) -+hns3_update_copper_link_info(struct hns3_hw *hw) - { - struct hns3_mac *mac = &hw->mac; - struct hns3_mac mac_info; - int ret; - - memset(&mac_info, 0, sizeof(struct hns3_mac)); -- ret = hns3_get_phy_params(hw, &mac_info); -+ ret = hns3_get_copper_phy_params(hw, &mac_info); - if (ret) - return ret; - -@@ -4676,7 +4676,7 @@ hns3_update_link_info(struct rte_eth_dev *eth_dev) - int ret = 0; - - if (hw->mac.media_type == HNS3_MEDIA_TYPE_COPPER) -- ret = hns3_update_phy_link_info(hw); -+ ret = hns3_update_copper_link_info(hw); - else if (hw->mac.media_type == HNS3_MEDIA_TYPE_FIBER) - ret = hns3_update_fiber_link_info(hw); - --- -2.7.4 - diff --git a/0078-net-hns3-fix-mbuf-free-on-Tx-done-cleanup.patch b/0078-net-hns3-fix-mbuf-free-on-Tx-done-cleanup.patch new file mode 100644 index 0000000000000000000000000000000000000000..46b2c9b6e279bbf24de38c935a1568b33d1f5ba8 --- /dev/null +++ b/0078-net-hns3-fix-mbuf-free-on-Tx-done-cleanup.patch @@ -0,0 +1,50 @@ +From 2d287ea3c2301219c201617df15efa161deabf76 Mon Sep 17 00:00:00 2001 +From: Chengwen Feng +Date: Thu, 5 May 2022 20:27:04 +0800 +Subject: [PATCH] net/hns3: fix mbuf free on Tx done cleanup + +Currently, the hns3 PMD may free more mbufs than free_cnt parameter, +this is an incorrect implementation. This patch fixes it. + +Fixes: 0b77e8f3d364 ("net/hns3: optimize Tx performance") +Cc: stable@dpdk.org + +Signed-off-by: Chengwen Feng +Signed-off-by: Min Hu (Connor) +--- + drivers/net/hns3/hns3_rxtx.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c +index a28de06dfd..0c91e4721e 100644 +--- a/drivers/net/hns3/hns3_rxtx.c ++++ b/drivers/net/hns3/hns3_rxtx.c +@@ -4595,7 +4595,7 @@ hns3_dev_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id) + static int + hns3_tx_done_cleanup_full(struct hns3_tx_queue *txq, uint32_t free_cnt) + { +- uint16_t round_free_cnt; ++ uint16_t round_cnt; + uint32_t idx; + + if (free_cnt == 0 || free_cnt > txq->nb_tx_desc) +@@ -4604,13 +4604,13 @@ hns3_tx_done_cleanup_full(struct hns3_tx_queue *txq, uint32_t free_cnt) + if (txq->tx_rs_thresh == 0) + return 0; + +- round_free_cnt = roundup(free_cnt, txq->tx_rs_thresh); +- for (idx = 0; idx < round_free_cnt; idx += txq->tx_rs_thresh) { ++ round_cnt = rounddown(free_cnt, txq->tx_rs_thresh); ++ for (idx = 0; idx < round_cnt; idx += txq->tx_rs_thresh) { + if (hns3_tx_free_useless_buffer(txq) != 0) + break; + } + +- return RTE_MIN(idx, free_cnt); ++ return idx; + } + + int +-- +2.33.0 + diff --git a/0078-net-hns3-fix-setting-default-MAC-address-in-bonding-.patch b/0078-net-hns3-fix-setting-default-MAC-address-in-bonding-.patch deleted file mode 100644 index 6d5ee19abd2efa7817b1ee024e1e572d299440a8..0000000000000000000000000000000000000000 --- a/0078-net-hns3-fix-setting-default-MAC-address-in-bonding-.patch +++ /dev/null @@ -1,187 +0,0 @@ -From 3429fe6859a5524353d748e4011f4610aeea781c Mon Sep 17 00:00:00 2001 -From: Chengwen Feng -Date: Wed, 31 Mar 2021 18:01:36 +0800 -Subject: [PATCH 078/189] net/hns3: fix setting default MAC address in bonding - of VF - -When start testpmd with two hns3 VFs(0000:bd:01.0, 0000:bd:01.7), and -then execute the following commands: - testpmd> create bonded device 1 0 - testpmd> set bonding mac_addr 2 3c:12:34:56:78:9a - testpmd> add bonding slave 0 2 - testpmd> add bonding slave 1 2 - testpmd> set portmask 0x4 - testpmd> port start 2 - -It will occurs the following error in a low probability: - 0000:bd:01.0 hns3_get_mbx_resp(): VF could not get mbx(3,0) - head(16) tail(15) lost(1) from PF in_irq:0 - 0000:bd:01.0 hns3vf_set_default_mac_addr(): Failed to set mac - addr(3C:**:**:**:78:9A) for vf: -62 - mac_address_slaves_update(1541) - Failed to update port Id 0 - MAC address - -The problem replay: -1. The 'port start 2' command will start slave ports and then set slave - mac address, the function call flow: bond_ethdev_start -> - mac_address_slaves_update. -2. There are also a monitor task which running in intr thread will check - slave ports link status and update slave ports mac address, the - function call flow: bond_ethdev_slave_link_status_change_monitor -> - bond_ethdev_lsc_event_callback -> mac_address_slaves_update. -3. Because the above step1&2 running on different threads, they may both - call drivers ops mac_addr_set which is hns3vf_set_default_mac_addr. -4. hns3vf_set_default_mac_addr will first acquire hw.lock and then send - mailbox to PF and wait PF's response message. Note: the PF's - response is an independent message which will received in hw.cmq.crq, - the receiving operation can only performed in intr thread. -5. So if the step1 operation hold the hw.lock and try get response - message, and step2 operation try acquire the hw.lock and so it can't - process the response message, this will lead to step1 fail. - -The solution: -1. make all threads could process the mailbox response message, which - protected by the hw.cmq.crq.lock. -2. use the following rules to avoid deadlock: -2.1. ensure use the correct locking sequence: hw.lock > - hw.mbx_resp.lock > hw.cmq.crq.lock. -2.2. make sure don't acquire such as hw.lock & hw.mbx_resp.lock again - when process mailbox response message. - -Fixes: 463e748964f5 ("net/hns3: support mailbox") -Cc: stable@dpdk.org - -Signed-off-by: Chengwen Feng -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_ethdev.h | 1 - - drivers/net/hns3/hns3_ethdev_vf.c | 3 --- - drivers/net/hns3/hns3_mbx.c | 51 +++++++++++---------------------------- - 3 files changed, 14 insertions(+), 41 deletions(-) - -diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h -index 25cb5e2..fc0dc37 100644 ---- a/drivers/net/hns3/hns3_ethdev.h -+++ b/drivers/net/hns3/hns3_ethdev.h -@@ -439,7 +439,6 @@ struct hns3_hw { - struct hns3_cmq cmq; - struct hns3_mbx_resp_status mbx_resp; /* mailbox response */ - struct hns3_mbx_arq_ring arq; /* mailbox async rx queue */ -- pthread_t irq_thread_id; - struct hns3_mac mac; - unsigned int secondary_cnt; /* Number of secondary processes init'd. */ - struct hns3_tqp_stats tqp_stats; -diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c -index 26f0698..22281c8 100644 ---- a/drivers/net/hns3/hns3_ethdev_vf.c -+++ b/drivers/net/hns3/hns3_ethdev_vf.c -@@ -1109,9 +1109,6 @@ hns3vf_interrupt_handler(void *param) - enum hns3vf_evt_cause event_cause; - uint32_t clearval; - -- if (hw->irq_thread_id == 0) -- hw->irq_thread_id = pthread_self(); -- - /* Disable interrupt */ - hns3vf_disable_irq0(hw); - -diff --git a/drivers/net/hns3/hns3_mbx.c b/drivers/net/hns3/hns3_mbx.c -index e745843..b9190a1 100644 ---- a/drivers/net/hns3/hns3_mbx.c -+++ b/drivers/net/hns3/hns3_mbx.c -@@ -40,36 +40,14 @@ hns3_resp_to_errno(uint16_t resp_code) - return -EIO; - } - --static void --hns3_poll_all_sync_msg(void) --{ -- struct rte_eth_dev *eth_dev; -- struct hns3_adapter *adapter; -- const char *name; -- uint16_t port_id; -- -- RTE_ETH_FOREACH_DEV(port_id) { -- eth_dev = &rte_eth_devices[port_id]; -- name = eth_dev->device->driver->name; -- if (strcmp(name, "net_hns3") && strcmp(name, "net_hns3_vf")) -- continue; -- adapter = eth_dev->data->dev_private; -- if (!adapter || adapter->hw.adapter_state == HNS3_NIC_CLOSED) -- continue; -- /* Synchronous msg, the mbx_resp.req_msg_data is non-zero */ -- if (adapter->hw.mbx_resp.req_msg_data) -- hns3_dev_handle_mbx_msg(&adapter->hw); -- } --} -- - static int - hns3_get_mbx_resp(struct hns3_hw *hw, uint16_t code0, uint16_t code1, - uint8_t *resp_data, uint16_t resp_len) - { - #define HNS3_MAX_RETRY_MS 500 -+#define HNS3_WAIT_RESP_US 100 - struct hns3_adapter *hns = HNS3_DEV_HW_TO_ADAPTER(hw); - struct hns3_mbx_resp_status *mbx_resp; -- bool in_irq = false; - uint64_t now; - uint64_t end; - -@@ -96,26 +74,19 @@ hns3_get_mbx_resp(struct hns3_hw *hw, uint16_t code0, uint16_t code1, - return -EIO; - } - -- /* -- * The mbox response is running on the interrupt thread. -- * Sending mbox in the interrupt thread cannot wait for the -- * response, so polling the mbox response on the irq thread. -- */ -- if (pthread_equal(hw->irq_thread_id, pthread_self())) { -- in_irq = true; -- hns3_poll_all_sync_msg(); -- } else { -- rte_delay_ms(HNS3_POLL_RESPONE_MS); -- } -+ hns3_dev_handle_mbx_msg(hw); -+ rte_delay_us(HNS3_WAIT_RESP_US); -+ - now = get_timeofday_ms(); - } - hw->mbx_resp.req_msg_data = 0; - if (now >= end) { - hw->mbx_resp.lost++; - hns3_err(hw, -- "VF could not get mbx(%u,%u) head(%u) tail(%u) lost(%u) from PF in_irq:%d", -+ "VF could not get mbx(%u,%u) head(%u) tail(%u) " -+ "lost(%u) from PF", - code0, code1, hw->mbx_resp.head, hw->mbx_resp.tail, -- hw->mbx_resp.lost, in_irq); -+ hw->mbx_resp.lost); - return -ETIME; - } - rte_io_rmb(); -@@ -368,9 +339,13 @@ hns3_dev_handle_mbx_msg(struct hns3_hw *hw) - uint8_t *temp; - int i; - -+ rte_spinlock_lock(&hw->cmq.crq.lock); -+ - while (!hns3_cmd_crq_empty(hw)) { -- if (__atomic_load_n(&hw->reset.disable_cmd, __ATOMIC_RELAXED)) -+ if (__atomic_load_n(&hw->reset.disable_cmd, __ATOMIC_RELAXED)) { -+ rte_spinlock_unlock(&hw->cmq.crq.lock); - return; -+ } - - desc = &crq->desc[crq->next_to_use]; - req = (struct hns3_mbx_pf_to_vf_cmd *)desc->data; -@@ -441,4 +416,6 @@ hns3_dev_handle_mbx_msg(struct hns3_hw *hw) - - /* Write back CMDQ_RQ header pointer, IMP need this pointer */ - hns3_write_dev(hw, HNS3_CMDQ_RX_HEAD_REG, crq->next_to_use); -+ -+ rte_spinlock_unlock(&hw->cmq.crq.lock); - } --- -2.7.4 - diff --git a/0079-net-hns3-fix-FLR-miss-detection.patch b/0079-net-hns3-fix-FLR-miss-detection.patch deleted file mode 100644 index 22aba55ff37e20a3d5ddb689c3ca05f534be5524..0000000000000000000000000000000000000000 --- a/0079-net-hns3-fix-FLR-miss-detection.patch +++ /dev/null @@ -1,57 +0,0 @@ -From f66e027f9088852b8047f3e6c0e6ff3535c4c172 Mon Sep 17 00:00:00 2001 -From: Hongbo Zheng -Date: Wed, 31 Mar 2021 18:01:37 +0800 -Subject: [PATCH 079/189] net/hns3: fix FLR miss detection - -When FLR occurs, the head pointer register of -the command queue will be cleared, resulting in -abnormal detection of the head pointer register -of the command queue. At present, FLR is detected -in this way, and the reset recovery process is -executed. - -However, when FLR occurs, the header pointer -register of the command queue is not necessarily -abnormal. For example, when the driver runs -normally, the value of the header pointer register -of the command queue may also be 0, which will -lead to the miss detection of FLR. - -Therefore, the judgment that whether the base -address register of command queue is 0 is added -to ensure that FLR not miss detection. - -Fixes: 2790c6464725 ("net/hns3: support device reset") -Cc: stable@dpdk.org - -Signed-off-by: Hongbo Zheng -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_cmd.c | 8 +++++--- - 1 file changed, 5 insertions(+), 3 deletions(-) - -diff --git a/drivers/net/hns3/hns3_cmd.c b/drivers/net/hns3/hns3_cmd.c -index f8d8b0a..1bf1c32 100644 ---- a/drivers/net/hns3/hns3_cmd.c -+++ b/drivers/net/hns3/hns3_cmd.c -@@ -195,12 +195,14 @@ hns3_cmd_csq_clean(struct hns3_hw *hw) - { - struct hns3_cmq_ring *csq = &hw->cmq.csq; - uint32_t head; -+ uint32_t addr; - int clean; - - head = hns3_read_dev(hw, HNS3_CMDQ_TX_HEAD_REG); -- if (!is_valid_csq_clean_head(csq, head)) { -- hns3_err(hw, "wrong cmd head (%u, %u-%u)", head, -- csq->next_to_use, csq->next_to_clean); -+ addr = hns3_read_dev(hw, HNS3_CMDQ_TX_ADDR_L_REG); -+ if (!is_valid_csq_clean_head(csq, head) || addr == 0) { -+ hns3_err(hw, "wrong cmd addr(%0x) head (%u, %u-%u)", addr, head, -+ csq->next_to_use, csq->next_to_clean); - if (rte_eal_process_type() == RTE_PROC_PRIMARY) { - __atomic_store_n(&hw->reset.disable_cmd, 1, - __ATOMIC_RELAXED); --- -2.7.4 - diff --git a/0079-net-hns3-fix-RSS-disable.patch b/0079-net-hns3-fix-RSS-disable.patch new file mode 100644 index 0000000000000000000000000000000000000000..ebb61a1f58fb0e942f3f5ff36cc993cd78b987f6 --- /dev/null +++ b/0079-net-hns3-fix-RSS-disable.patch @@ -0,0 +1,214 @@ +From 75ccc3f3d7fa06901d5b768448be4dc9f31f550a Mon Sep 17 00:00:00 2001 +From: Huisong Li +Date: Thu, 5 May 2022 20:27:05 +0800 +Subject: [PATCH] net/hns3: fix RSS disable + +Currently, hns3 PMD disable RSS by resetting redirection table when user +set rss_hf to 0 so as to all packets go to queue 0. The implementation +may cause following problems: +1) the same type packet may go to different queue on the case of + disabling all tuples and partial tuples. The problem is determined by + hardware design. +2) affect the configuration of redirection table and user experience. + +For hns3 hardware, the packets with RSS disabled are always go to the +queue corresponding to first entry of the redirection table. Generally, +disable RSS should be implemented by disabling all tuples, This patch +fix the implementation. + +Fixes: c37ca66f2b27 ("net/hns3: support RSS") +Cc: stable@dpdk.org + +Signed-off-by: Huisong Li +Signed-off-by: Min Hu (Connor) +--- + drivers/net/hns3/hns3_ethdev.c | 1 - + drivers/net/hns3/hns3_flow.c | 6 +-- + drivers/net/hns3/hns3_rss.c | 93 +++++++--------------------------- + 3 files changed, 18 insertions(+), 82 deletions(-) + +diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c +index 1d9b19d83e..4d5a595aab 100644 +--- a/drivers/net/hns3/hns3_ethdev.c ++++ b/drivers/net/hns3/hns3_ethdev.c +@@ -2015,7 +2015,6 @@ hns3_dev_configure(struct rte_eth_dev *dev) + goto cfg_err; + } + +- /* When RSS is not configured, redirect the packet queue 0 */ + if ((uint32_t)mq_mode & RTE_ETH_MQ_RX_RSS_FLAG) { + conf->rxmode.offloads |= RTE_ETH_RX_OFFLOAD_RSS_HASH; + rss_conf = conf->rx_adv_conf.rss_conf; +diff --git a/drivers/net/hns3/hns3_flow.c b/drivers/net/hns3/hns3_flow.c +index aba07aaa6f..feabac9f41 100644 +--- a/drivers/net/hns3/hns3_flow.c ++++ b/drivers/net/hns3/hns3_flow.c +@@ -1446,13 +1446,9 @@ hns3_disable_rss(struct hns3_hw *hw) + { + int ret; + +- /* Redirected the redirection table to queue 0 */ +- ret = hns3_rss_reset_indir_table(hw); ++ ret = hns3_set_rss_tuple_by_rss_hf(hw, &hw->rss_info.rss_tuple_sets, 0); + if (ret) + return ret; +- +- /* Disable RSS */ +- hw->rss_info.conf.types = 0; + hw->rss_dis_flag = true; + + return 0; +diff --git a/drivers/net/hns3/hns3_rss.c b/drivers/net/hns3/hns3_rss.c +index 1493b10f96..1c703952b9 100644 +--- a/drivers/net/hns3/hns3_rss.c ++++ b/drivers/net/hns3/hns3_rss.c +@@ -237,31 +237,6 @@ hns3_rss_set_algo_key(struct hns3_hw *hw, const uint8_t *key) + return 0; + } + +-/* +- * Used to configure the tuple selection for RSS hash input. +- */ +-static int +-hns3_rss_set_input_tuple(struct hns3_hw *hw) +-{ +- struct hns3_rss_conf *rss_config = &hw->rss_info; +- struct hns3_rss_input_tuple_cmd *req; +- struct hns3_cmd_desc desc_tuple; +- int ret; +- +- hns3_cmd_setup_basic_desc(&desc_tuple, HNS3_OPC_RSS_INPUT_TUPLE, false); +- +- req = (struct hns3_rss_input_tuple_cmd *)desc_tuple.data; +- +- req->tuple_field = +- rte_cpu_to_le_64(rss_config->rss_tuple_sets.rss_tuple_fields); +- +- ret = hns3_cmd_send(hw, &desc_tuple, 1); +- if (ret) +- hns3_err(hw, "Configure RSS input tuple mode failed %d", ret); +- +- return ret; +-} +- + /* + * rss_indirection_table command function, opcode:0x0D07. + * Used to configure the indirection table of rss. +@@ -382,6 +357,8 @@ hns3_set_rss_tuple_by_rss_hf(struct hns3_hw *hw, + } + + tuple->rss_tuple_fields = rte_le_to_cpu_64(req->tuple_field); ++ /* Update supported flow types when set tuple success */ ++ hw->rss_info.conf.types = rss_hf; + + return 0; + } +@@ -402,7 +379,6 @@ hns3_dev_rss_hash_update(struct rte_eth_dev *dev, + struct hns3_adapter *hns = dev->data->dev_private; + struct hns3_hw *hw = &hns->hw; + struct hns3_rss_tuple_cfg *tuple = &hw->rss_info.rss_tuple_sets; +- struct hns3_rss_conf *rss_cfg = &hw->rss_info; + uint8_t key_len = rss_conf->rss_key_len; + uint64_t rss_hf = rss_conf->rss_hf; + uint8_t *key = rss_conf->rss_key; +@@ -416,22 +392,6 @@ hns3_dev_rss_hash_update(struct rte_eth_dev *dev, + if (ret) + goto conf_err; + +- if (rss_cfg->conf.types && rss_hf == 0) { +- /* Disable RSS, reset indirection table by local variable */ +- ret = hns3_rss_reset_indir_table(hw); +- if (ret) +- goto conf_err; +- } else if (rss_hf && rss_cfg->conf.types == 0) { +- /* Enable RSS, restore indirection table by hw's config */ +- ret = hns3_set_rss_indir_table(hw, rss_cfg->rss_indirection_tbl, +- hw->rss_ind_tbl_size); +- if (ret) +- goto conf_err; +- } +- +- /* Update supported flow types when set tuple success */ +- rss_cfg->conf.types = rss_hf; +- + if (key) { + if (key_len != HNS3_RSS_KEY_SIZE) { + hns3_err(hw, "The hash key len(%u) is invalid", +@@ -697,7 +657,8 @@ hns3_config_rss(struct hns3_adapter *hns) + struct hns3_hw *hw = &hns->hw; + struct hns3_rss_conf *rss_cfg = &hw->rss_info; + uint8_t *hash_key = rss_cfg->key; +- int ret, ret1; ++ uint64_t rss_hf; ++ int ret; + + enum rte_eth_rx_mq_mode mq_mode = hw->data->dev_conf.rxmode.mq_mode; + +@@ -713,51 +674,31 @@ hns3_config_rss(struct hns3_adapter *hns) + break; + } + +- /* When RSS is off, redirect the packet queue 0 */ +- if (((uint32_t)mq_mode & RTE_ETH_MQ_RX_RSS_FLAG) == 0) +- hns3_rss_uninit(hns); +- + /* Configure RSS hash algorithm and hash key offset */ + ret = hns3_rss_set_algo_key(hw, hash_key); + if (ret) + return ret; + +- /* Configure the tuple selection for RSS hash input */ +- ret = hns3_rss_set_input_tuple(hw); ++ ret = hns3_set_rss_indir_table(hw, rss_cfg->rss_indirection_tbl, ++ hw->rss_ind_tbl_size); + if (ret) + return ret; + +- /* +- * When RSS is off, it doesn't need to configure rss redirection table +- * to hardware. +- */ +- if (((uint32_t)mq_mode & RTE_ETH_MQ_RX_RSS_FLAG)) { +- ret = hns3_set_rss_indir_table(hw, rss_cfg->rss_indirection_tbl, +- hw->rss_ind_tbl_size); +- if (ret) +- goto rss_tuple_uninit; +- } +- + ret = hns3_set_rss_tc_mode(hw); + if (ret) +- goto rss_indir_table_uninit; +- +- return ret; +- +-rss_indir_table_uninit: +- if (((uint32_t)mq_mode & RTE_ETH_MQ_RX_RSS_FLAG)) { +- ret1 = hns3_rss_reset_indir_table(hw); +- if (ret1 != 0) +- return ret; +- } +- +-rss_tuple_uninit: +- hns3_rss_tuple_uninit(hw); ++ return ret; + +- /* Disable RSS */ +- hw->rss_info.conf.types = 0; ++ /* ++ * When muli-queue RSS mode flag is not set or unsupported tuples are ++ * set, disable all tuples. ++ */ ++ rss_hf = hw->rss_info.conf.types; ++ if (!((uint32_t)mq_mode & RTE_ETH_MQ_RX_RSS_FLAG) || ++ !(rss_hf & HNS3_ETH_RSS_SUPPORT)) ++ rss_hf = 0; + +- return ret; ++ return hns3_set_rss_tuple_by_rss_hf(hw, &hw->rss_info.rss_tuple_sets, ++ rss_hf); + } + + /* +-- +2.33.0 + diff --git a/0080-net-hns3-fix-rollback-after-setting-PVID-failure.patch b/0080-net-hns3-fix-rollback-after-setting-PVID-failure.patch deleted file mode 100644 index 5e0b4103cdcaf36f952e33d2e9a875f3a061abb7..0000000000000000000000000000000000000000 --- a/0080-net-hns3-fix-rollback-after-setting-PVID-failure.patch +++ /dev/null @@ -1,75 +0,0 @@ -From cb332ad8f8abb2973606f877024867deba6a6ec3 Mon Sep 17 00:00:00 2001 -From: Chengchang Tang -Date: Wed, 31 Mar 2021 18:01:38 +0800 -Subject: [PATCH 080/189] net/hns3: fix rollback after setting PVID failure - -Currently, three hardware operations are involved in setting the PVID. -If any operation fails, a failure will be returned. And there may be -residual hardware configurations because no rollback is performed. - -This patch adds rollback operation for setting PVID to avoid residual -hardware configuration after the PVID fails to be configured. - -Fixes: 411d23b9eafb ("net/hns3: support VLAN") -Cc: stable@dpdk.org - -Signed-off-by: Chengchang Tang -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_ethdev.c | 20 +++++++++++++++++--- - 1 file changed, 17 insertions(+), 3 deletions(-) - -diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c -index 4dff016..4984ff9 100644 ---- a/drivers/net/hns3/hns3_ethdev.c -+++ b/drivers/net/hns3/hns3_ethdev.c -@@ -981,7 +981,7 @@ hns3_vlan_pvid_configure(struct hns3_adapter *hns, uint16_t pvid, int on) - { - struct hns3_hw *hw = &hns->hw; - uint16_t port_base_vlan_state; -- int ret; -+ int ret, err; - - if (on == 0 && pvid != hw->port_base_vlan_cfg.pvid) { - if (hw->port_base_vlan_cfg.pvid != HNS3_INVALID_PVID) -@@ -1004,7 +1004,7 @@ hns3_vlan_pvid_configure(struct hns3_adapter *hns, uint16_t pvid, int on) - if (ret) { - hns3_err(hw, "failed to config rx vlan strip for pvid, " - "ret = %d", ret); -- return ret; -+ goto pvid_vlan_strip_fail; - } - - if (pvid == HNS3_INVALID_PVID) -@@ -1013,13 +1013,27 @@ hns3_vlan_pvid_configure(struct hns3_adapter *hns, uint16_t pvid, int on) - if (ret) { - hns3_err(hw, "failed to update vlan filter entries, ret = %d", - ret); -- return ret; -+ goto vlan_filter_set_fail; - } - - out: - hw->port_base_vlan_cfg.state = port_base_vlan_state; - hw->port_base_vlan_cfg.pvid = on ? pvid : HNS3_INVALID_PVID; - return ret; -+ -+vlan_filter_set_fail: -+ err = hns3_en_pvid_strip(hns, hw->port_base_vlan_cfg.state == -+ HNS3_PORT_BASE_VLAN_ENABLE); -+ if (err) -+ hns3_err(hw, "fail to rollback pvid strip, ret = %d", err); -+ -+pvid_vlan_strip_fail: -+ err = hns3_vlan_txvlan_cfg(hns, hw->port_base_vlan_cfg.state, -+ hw->port_base_vlan_cfg.pvid); -+ if (err) -+ hns3_err(hw, "fail to rollback txvlan status, ret = %d", err); -+ -+ return ret; - } - - static int --- -2.7.4 - diff --git a/0080-net-hns3-fix-rollback-on-RSS-hash-update.patch b/0080-net-hns3-fix-rollback-on-RSS-hash-update.patch new file mode 100644 index 0000000000000000000000000000000000000000..7e3e8b42992859d9ffd0a1978632327b1ea2d44c --- /dev/null +++ b/0080-net-hns3-fix-rollback-on-RSS-hash-update.patch @@ -0,0 +1,75 @@ +From 07f64b5f576a779c8c3df4ba45ad70c306dcb562 Mon Sep 17 00:00:00 2001 +From: Huisong Li +Date: Thu, 5 May 2022 20:27:06 +0800 +Subject: [PATCH] net/hns3: fix rollback on RSS hash update + +The RSS tuple isn't restored when RSS key length is invalid or setting +algo key failed. This patch fixes it. + +Fixes: c37ca66f2b27 ("net/hns3: support RSS") +Cc: stable@dpdk.org + +Signed-off-by: Huisong Li +Signed-off-by: Min Hu (Connor) +--- + drivers/net/hns3/hns3_rss.c | 24 +++++++++++++----------- + 1 file changed, 13 insertions(+), 11 deletions(-) + +diff --git a/drivers/net/hns3/hns3_rss.c b/drivers/net/hns3/hns3_rss.c +index 1c703952b9..4b2c24ace4 100644 +--- a/drivers/net/hns3/hns3_rss.c ++++ b/drivers/net/hns3/hns3_rss.c +@@ -376,9 +376,9 @@ int + hns3_dev_rss_hash_update(struct rte_eth_dev *dev, + struct rte_eth_rss_conf *rss_conf) + { +- struct hns3_adapter *hns = dev->data->dev_private; +- struct hns3_hw *hw = &hns->hw; ++ struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private); + struct hns3_rss_tuple_cfg *tuple = &hw->rss_info.rss_tuple_sets; ++ uint64_t rss_hf_bk = hw->rss_info.conf.types; + uint8_t key_len = rss_conf->rss_key_len; + uint64_t rss_hf = rss_conf->rss_hf; + uint8_t *key = rss_conf->rss_key; +@@ -387,27 +387,29 @@ hns3_dev_rss_hash_update(struct rte_eth_dev *dev, + if (hw->rss_dis_flag) + return -EINVAL; + ++ if (key && key_len != HNS3_RSS_KEY_SIZE) { ++ hns3_err(hw, "the hash key len(%u) is invalid, must be %u", ++ key_len, HNS3_RSS_KEY_SIZE); ++ return -EINVAL; ++ } ++ + rte_spinlock_lock(&hw->lock); + ret = hns3_set_rss_tuple_by_rss_hf(hw, tuple, rss_hf); + if (ret) +- goto conf_err; ++ goto set_tuple_fail; + + if (key) { +- if (key_len != HNS3_RSS_KEY_SIZE) { +- hns3_err(hw, "The hash key len(%u) is invalid", +- key_len); +- ret = -EINVAL; +- goto conf_err; +- } + ret = hns3_rss_set_algo_key(hw, key); + if (ret) +- goto conf_err; ++ goto set_algo_key_fail; + } + rte_spinlock_unlock(&hw->lock); + + return 0; + +-conf_err: ++set_algo_key_fail: ++ (void)hns3_set_rss_tuple_by_rss_hf(hw, tuple, rss_hf_bk); ++set_tuple_fail: + rte_spinlock_unlock(&hw->lock); + return ret; + } +-- +2.33.0 + diff --git a/0081-net-hns3-fix-flow-control-exception.patch b/0081-net-hns3-fix-flow-control-exception.patch deleted file mode 100644 index e26359c969752aa1b34f2a2075288ac3a85b1492..0000000000000000000000000000000000000000 --- a/0081-net-hns3-fix-flow-control-exception.patch +++ /dev/null @@ -1,37 +0,0 @@ -From 21b64900224a9d81aee3ee20349073f18c5c927f Mon Sep 17 00:00:00 2001 -From: Huisong Li -Date: Wed, 31 Mar 2021 18:01:39 +0800 -Subject: [PATCH 081/189] net/hns3: fix flow control exception - -In multi-TC scenarios, MAC pause is not supported. Otherwise, only -TC0 can trigger pause frames, and other TCs cannot trigger pause -frames. In this case, flow control does not meet the expectation. - -Fixes: 62e3ccc2b94c ("net/hns3: support flow control") -Cc: stable@dpdk.org - -Signed-off-by: Huisong Li -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_ethdev.c | 5 +++++ - 1 file changed, 5 insertions(+) - -diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c -index 4984ff9..6f3502f 100644 ---- a/drivers/net/hns3/hns3_ethdev.c -+++ b/drivers/net/hns3/hns3_ethdev.c -@@ -5554,6 +5554,11 @@ hns3_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf) - return -EOPNOTSUPP; - } - -+ if (hw->num_tc > 1) { -+ hns3_err(hw, "in multi-TC scenarios, MAC pause is not supported."); -+ return -EOPNOTSUPP; -+ } -+ - hns3_get_fc_mode(hw, fc_conf->mode); - if (hw->requested_mode == hw->current_mode && - pf->pause_time == fc_conf->pause_time) --- -2.7.4 - diff --git a/0081-net-hns3-remove-redundant-RSS-tuple-field.patch b/0081-net-hns3-remove-redundant-RSS-tuple-field.patch new file mode 100644 index 0000000000000000000000000000000000000000..462d1987eb84f0987f4e4a9b03a230dc36200362 --- /dev/null +++ b/0081-net-hns3-remove-redundant-RSS-tuple-field.patch @@ -0,0 +1,136 @@ +From 7a036b213b972e2c90e349f1eb90a30b98a740b4 Mon Sep 17 00:00:00 2001 +From: Huisong Li +Date: Thu, 5 May 2022 20:27:07 +0800 +Subject: [PATCH 21/25] net/hns3: remove redundant RSS tuple field + +The 'rss_tuple_fields' in struct struct hns3_rss_conf::rss_tuple_sets is +redundant. Because the enabled RSS tuple in PMD is already managed by +the 'types' in struct hns3_rss_conf::conf. This patch removes this +redundant variable. + +Fixes: c37ca66f2b27 ("net/hns3: support RSS") +Cc: stable@dpdk.org + +Signed-off-by: Huisong Li +Signed-off-by: Min Hu (Connor) +--- + drivers/net/hns3/hns3_flow.c | 6 ++---- + drivers/net/hns3/hns3_rss.c | 12 ++++-------- + drivers/net/hns3/hns3_rss.h | 5 +---- + 3 files changed, 7 insertions(+), 16 deletions(-) + +diff --git a/drivers/net/hns3/hns3_flow.c b/drivers/net/hns3/hns3_flow.c +index a74b140563..65f8ee3ae1 100644 +--- a/drivers/net/hns3/hns3_flow.c ++++ b/drivers/net/hns3/hns3_flow.c +@@ -1446,7 +1446,7 @@ hns3_disable_rss(struct hns3_hw *hw) + { + int ret; + +- ret = hns3_set_rss_tuple_by_rss_hf(hw, &hw->rss_info.rss_tuple_sets, 0); ++ ret = hns3_set_rss_tuple_by_rss_hf(hw, 0); + if (ret) + return ret; + hw->rss_dis_flag = true; +@@ -1496,7 +1496,6 @@ hns3_parse_rss_algorithm(struct hns3_hw *hw, enum rte_eth_hash_function *func, + static int + hns3_hw_rss_hash_set(struct hns3_hw *hw, struct rte_flow_action_rss *rss_config) + { +- struct hns3_rss_tuple_cfg *tuple; + int ret; + + hns3_adjust_rss_key(hw, rss_config); +@@ -1512,8 +1511,7 @@ hns3_hw_rss_hash_set(struct hns3_hw *hw, struct rte_flow_action_rss *rss_config) + + hw->rss_info.conf.func = rss_config->func; + +- tuple = &hw->rss_info.rss_tuple_sets; +- ret = hns3_set_rss_tuple_by_rss_hf(hw, tuple, rss_config->types); ++ ret = hns3_set_rss_tuple_by_rss_hf(hw, rss_config->types); + if (ret) + hns3_err(hw, "Update RSS tuples by rss hf failed %d", ret); + +diff --git a/drivers/net/hns3/hns3_rss.c b/drivers/net/hns3/hns3_rss.c +index 4b2c24ace4..e149c16bfe 100644 +--- a/drivers/net/hns3/hns3_rss.c ++++ b/drivers/net/hns3/hns3_rss.c +@@ -310,8 +310,7 @@ hns3_rss_reset_indir_table(struct hns3_hw *hw) + } + + int +-hns3_set_rss_tuple_by_rss_hf(struct hns3_hw *hw, +- struct hns3_rss_tuple_cfg *tuple, uint64_t rss_hf) ++hns3_set_rss_tuple_by_rss_hf(struct hns3_hw *hw, uint64_t rss_hf) + { + struct hns3_rss_input_tuple_cmd *req; + struct hns3_cmd_desc desc; +@@ -356,7 +355,6 @@ hns3_set_rss_tuple_by_rss_hf(struct hns3_hw *hw, + return ret; + } + +- tuple->rss_tuple_fields = rte_le_to_cpu_64(req->tuple_field); + /* Update supported flow types when set tuple success */ + hw->rss_info.conf.types = rss_hf; + +@@ -377,7 +375,6 @@ hns3_dev_rss_hash_update(struct rte_eth_dev *dev, + struct rte_eth_rss_conf *rss_conf) + { + struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private); +- struct hns3_rss_tuple_cfg *tuple = &hw->rss_info.rss_tuple_sets; + uint64_t rss_hf_bk = hw->rss_info.conf.types; + uint8_t key_len = rss_conf->rss_key_len; + uint64_t rss_hf = rss_conf->rss_hf; +@@ -394,7 +391,7 @@ hns3_dev_rss_hash_update(struct rte_eth_dev *dev, + } + + rte_spinlock_lock(&hw->lock); +- ret = hns3_set_rss_tuple_by_rss_hf(hw, tuple, rss_hf); ++ ret = hns3_set_rss_tuple_by_rss_hf(hw, rss_hf); + if (ret) + goto set_tuple_fail; + +@@ -408,7 +405,7 @@ hns3_dev_rss_hash_update(struct rte_eth_dev *dev, + return 0; + + set_algo_key_fail: +- (void)hns3_set_rss_tuple_by_rss_hf(hw, tuple, rss_hf_bk); ++ (void)hns3_set_rss_tuple_by_rss_hf(hw, rss_hf_bk); + set_tuple_fail: + rte_spinlock_unlock(&hw->lock); + return ret; +@@ -699,8 +696,7 @@ hns3_config_rss(struct hns3_adapter *hns) + !(rss_hf & HNS3_ETH_RSS_SUPPORT)) + rss_hf = 0; + +- return hns3_set_rss_tuple_by_rss_hf(hw, &hw->rss_info.rss_tuple_sets, +- rss_hf); ++ return hns3_set_rss_tuple_by_rss_hf(hw, rss_hf); + } + + /* +diff --git a/drivers/net/hns3/hns3_rss.h b/drivers/net/hns3/hns3_rss.h +index 6f153a1b7b..7789f02a08 100644 +--- a/drivers/net/hns3/hns3_rss.h ++++ b/drivers/net/hns3/hns3_rss.h +@@ -43,7 +43,6 @@ struct hns3_rss_conf { + struct rte_flow_action_rss conf; + uint8_t hash_algo; /* hash function type definited by hardware */ + uint8_t key[HNS3_RSS_KEY_SIZE]; /* Hash key */ +- struct hns3_rss_tuple_cfg rss_tuple_sets; + uint16_t rss_indirection_tbl[HNS3_RSS_IND_TBL_SIZE_MAX]; + uint16_t queue[HNS3_RSS_QUEUES_BUFFER_NUM]; /* Queues indices to use */ + bool valid; /* check if RSS rule is valid */ +@@ -107,9 +106,7 @@ int hns3_set_rss_indir_table(struct hns3_hw *hw, uint16_t *indir, + int hns3_rss_reset_indir_table(struct hns3_hw *hw); + int hns3_config_rss(struct hns3_adapter *hns); + void hns3_rss_uninit(struct hns3_adapter *hns); +-int hns3_set_rss_tuple_by_rss_hf(struct hns3_hw *hw, +- struct hns3_rss_tuple_cfg *tuple, +- uint64_t rss_hf); ++int hns3_set_rss_tuple_by_rss_hf(struct hns3_hw *hw, uint64_t rss_hf); + int hns3_rss_set_algo_key(struct hns3_hw *hw, const uint8_t *key); + int hns3_restore_rss_filter(struct rte_eth_dev *dev); + +-- +2.30.0 + diff --git a/0082-ethdev-fix-RSS-update-when-RSS-is-disabled.patch b/0082-ethdev-fix-RSS-update-when-RSS-is-disabled.patch new file mode 100644 index 0000000000000000000000000000000000000000..0ff17c45971da645939a05cfdbb79559dd03952b --- /dev/null +++ b/0082-ethdev-fix-RSS-update-when-RSS-is-disabled.patch @@ -0,0 +1,70 @@ +From 93e1ea6dfa99dea359b8d66123576a395c2c0acd Mon Sep 17 00:00:00 2001 +From: Huisong Li +Date: Wed, 6 Apr 2022 14:57:00 +0800 +Subject: [PATCH] ethdev: fix RSS update when RSS is disabled + +The RTE_ETH_MQ_RX_RSS_FLAG flag is a switch to enable RSS. If the flag +is not set in dev_configure, RSS will be not configured and enabled. +However, RSS hash and reta can still be configured by ethdev ops to +enable RSS if the flag isn't set. The behavior is inconsistent. + +Fixes: 99a2dd955fba ("lib: remove librte_ prefix from directory names") +Cc: stable@dpdk.org + +Signed-off-by: Huisong Li +Signed-off-by: Min Hu (Connor) +Reviewed-by: Ferruh Yigit +--- + lib/ethdev/rte_ethdev.c | 15 +++++++++++++++ + 1 file changed, 15 insertions(+) + +diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c +index 29a3d80466..8520aec561 100644 +--- a/lib/ethdev/rte_ethdev.c ++++ b/lib/ethdev/rte_ethdev.c +@@ -3867,6 +3867,7 @@ rte_eth_dev_rss_reta_update(uint16_t port_id, + struct rte_eth_rss_reta_entry64 *reta_conf, + uint16_t reta_size) + { ++ enum rte_eth_rx_mq_mode mq_mode; + struct rte_eth_dev *dev; + int ret; + +@@ -3898,6 +3899,12 @@ rte_eth_dev_rss_reta_update(uint16_t port_id, + if (ret < 0) + return ret; + ++ mq_mode = dev->data->dev_conf.rxmode.mq_mode; ++ if (!(mq_mode & RTE_ETH_MQ_RX_RSS_FLAG)) { ++ RTE_ETHDEV_LOG(ERR, "Multi-queue RSS mode isn't enabled.\n"); ++ return -ENOTSUP; ++ } ++ + RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->reta_update, -ENOTSUP); + return eth_err(port_id, (*dev->dev_ops->reta_update)(dev, reta_conf, + reta_size)); +@@ -3937,6 +3944,7 @@ rte_eth_dev_rss_hash_update(uint16_t port_id, + { + struct rte_eth_dev *dev; + struct rte_eth_dev_info dev_info = { .flow_type_rss_offloads = 0, }; ++ enum rte_eth_rx_mq_mode mq_mode; + int ret; + + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); +@@ -3962,6 +3970,13 @@ rte_eth_dev_rss_hash_update(uint16_t port_id, + dev_info.flow_type_rss_offloads); + return -EINVAL; + } ++ ++ mq_mode = dev->data->dev_conf.rxmode.mq_mode; ++ if (!(mq_mode & RTE_ETH_MQ_RX_RSS_FLAG)) { ++ RTE_ETHDEV_LOG(ERR, "Multi-queue RSS mode isn't enabled.\n"); ++ return -ENOTSUP; ++ } ++ + RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->rss_hash_update, -ENOTSUP); + return eth_err(port_id, (*dev->dev_ops->rss_hash_update)(dev, + rss_conf)); +-- +2.33.0 + diff --git a/0082-net-hns3-fix-flow-counter-value.patch b/0082-net-hns3-fix-flow-counter-value.patch deleted file mode 100644 index eb18115235c86ec765c6474aa61d78400a1ef48d..0000000000000000000000000000000000000000 --- a/0082-net-hns3-fix-flow-counter-value.patch +++ /dev/null @@ -1,53 +0,0 @@ -From c75bc1ba60e3af6a8751048a912a01175d940833 Mon Sep 17 00:00:00 2001 -From: Chengwen Feng -Date: Wed, 31 Mar 2021 18:01:40 +0800 -Subject: [PATCH 082/189] net/hns3: fix flow counter value - -User could create flow rules with specified counter by the action of -RTE_FLOW_ACTION_TYPE_COUNT, but the counter may retain the original -value when create. - -This patch fix the bug by read the counter when creating the rule -because the counter is read-clear. - -Fixes: fcba820d9b9e ("net/hns3: support flow director") -Cc: stable@dpdk.org - -Signed-off-by: Chengwen Feng -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_flow.c | 10 ++++++++++ - 1 file changed, 10 insertions(+) - -diff --git a/drivers/net/hns3/hns3_flow.c b/drivers/net/hns3/hns3_flow.c -index a016857..3cca416 100644 ---- a/drivers/net/hns3/hns3_flow.c -+++ b/drivers/net/hns3/hns3_flow.c -@@ -158,7 +158,10 @@ hns3_counter_new(struct rte_eth_dev *dev, uint32_t shared, uint32_t id, - { - struct hns3_adapter *hns = dev->data->dev_private; - struct hns3_pf *pf = &hns->pf; -+ struct hns3_hw *hw = &hns->hw; - struct hns3_flow_counter *cnt; -+ uint64_t value; -+ int ret; - - cnt = hns3_counter_lookup(dev, id); - if (cnt) { -@@ -171,6 +174,13 @@ hns3_counter_new(struct rte_eth_dev *dev, uint32_t shared, uint32_t id, - return 0; - } - -+ /* Clear the counter by read ops because the counter is read-clear */ -+ ret = hns3_get_count(hw, id, &value); -+ if (ret) -+ return rte_flow_error_set(error, EIO, -+ RTE_FLOW_ERROR_TYPE_HANDLE, NULL, -+ "Clear counter failed!"); -+ - cnt = rte_zmalloc("hns3 counter", sizeof(*cnt), 0); - if (cnt == NULL) - return rte_flow_error_set(error, ENOMEM, --- -2.7.4 - diff --git a/0083-net-hns3-fix-VF-mailbox-head-field.patch b/0083-net-hns3-fix-VF-mailbox-head-field.patch deleted file mode 100644 index 3e1642d24f46e6c63aaebb6fcccdabf3ccfc4c78..0000000000000000000000000000000000000000 --- a/0083-net-hns3-fix-VF-mailbox-head-field.patch +++ /dev/null @@ -1,39 +0,0 @@ -From 4c2dcb5bd22a65d3b30ca64e5c96f67c3b9f5e7e Mon Sep 17 00:00:00 2001 -From: Chengwen Feng -Date: Wed, 31 Mar 2021 18:01:41 +0800 -Subject: [PATCH 083/189] net/hns3: fix VF mailbox head field - -Currently, the VF mailbox synchronization communication is based on -three fields: head/tail/lost, when head equals tail plus lost, it -means the response is received successfully. - -The head field indicates the number of requests that are successfully -sent. If the request sending fails, it should not be updated. - -This patch fix the above bug by roll back updates when the sending -fails. - -Fixes: 463e748964f5 ("net/hns3: support mailbox") -Cc: stable@dpdk.org - -Signed-off-by: Chengwen Feng -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_mbx.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/drivers/net/hns3/hns3_mbx.c b/drivers/net/hns3/hns3_mbx.c -index b9190a1..7357d7f 100644 ---- a/drivers/net/hns3/hns3_mbx.c -+++ b/drivers/net/hns3/hns3_mbx.c -@@ -142,6 +142,7 @@ hns3_send_mbx_msg(struct hns3_hw *hw, uint16_t code, uint16_t subcode, - hw->mbx_resp.head++; - ret = hns3_cmd_send(hw, &desc, 1); - if (ret) { -+ hw->mbx_resp.head--; - rte_spinlock_unlock(&hw->mbx_resp.lock); - hns3_err(hw, "VF failed(=%d) to send mbx message to PF", - ret); --- -2.7.4 - diff --git a/0083-net-hns3-remove-unnecessary-RSS-switch.patch b/0083-net-hns3-remove-unnecessary-RSS-switch.patch new file mode 100644 index 0000000000000000000000000000000000000000..18f7e2659e5f0c8ad98abea4bdfec34fff113756 --- /dev/null +++ b/0083-net-hns3-remove-unnecessary-RSS-switch.patch @@ -0,0 +1,103 @@ +From ec1691494273ef4f9cb60ed24099196de1ce0cc4 Mon Sep 17 00:00:00 2001 +From: Huisong Li +Date: Wed, 6 Apr 2022 14:57:01 +0800 +Subject: [PATCH] net/hns3: remove unnecessary RSS switch + +Whether the RSS is enabled depends on RTE_ETH_MQ_RX_RSS_FLAG and packet +tuple are enabled. So the RSS switch is unnecessary. + +Fixes: 5e782bc2570c ("net/hns3: fix configuring RSS hash when rules are flushed") +Fixes: fd8196838763 ("net/hns3: fix configuring device with RSS enabled") +Cc: stable@dpdk.org + +Signed-off-by: Huisong Li +Signed-off-by: Min Hu (Connor) +--- + drivers/net/hns3/hns3_ethdev.c | 2 -- + drivers/net/hns3/hns3_ethdev.h | 1 - + drivers/net/hns3/hns3_ethdev_vf.c | 2 -- + drivers/net/hns3/hns3_flow.c | 1 - + drivers/net/hns3/hns3_rss.c | 3 --- + 5 files changed, 9 deletions(-) + +diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c +index 4d5a595aab..0b565a5614 100644 +--- a/drivers/net/hns3/hns3_ethdev.c ++++ b/drivers/net/hns3/hns3_ethdev.c +@@ -2018,7 +2018,6 @@ hns3_dev_configure(struct rte_eth_dev *dev) + if ((uint32_t)mq_mode & RTE_ETH_MQ_RX_RSS_FLAG) { + conf->rxmode.offloads |= RTE_ETH_RX_OFFLOAD_RSS_HASH; + rss_conf = conf->rx_adv_conf.rss_conf; +- hw->rss_dis_flag = false; + ret = hns3_dev_rss_hash_update(dev, &rss_conf); + if (ret) + goto cfg_err; +@@ -2824,7 +2823,6 @@ hns3_get_board_configuration(struct hns3_hw *hw) + + hw->mac.media_type = cfg.media_type; + hw->rss_size_max = cfg.rss_size_max; +- hw->rss_dis_flag = false; + memcpy(hw->mac.mac_addr, cfg.mac_addr, RTE_ETHER_ADDR_LEN); + hw->mac.phy_addr = cfg.phy_addr; + hw->dcb_info.num_pg = 1; +diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h +index bb6ddd97ba..5e8a746514 100644 +--- a/drivers/net/hns3/hns3_ethdev.h ++++ b/drivers/net/hns3/hns3_ethdev.h +@@ -526,7 +526,6 @@ struct hns3_hw { + + /* The configuration info of RSS */ + struct hns3_rss_conf rss_info; +- bool rss_dis_flag; /* disable rss flag. true: disable, false: enable */ + uint16_t rss_ind_tbl_size; + uint16_t rss_key_size; + +diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c +index f641e0dc36..589de0ab3a 100644 +--- a/drivers/net/hns3/hns3_ethdev_vf.c ++++ b/drivers/net/hns3/hns3_ethdev_vf.c +@@ -495,7 +495,6 @@ hns3vf_dev_configure(struct rte_eth_dev *dev) + /* When RSS is not configured, redirect the packet queue 0 */ + if ((uint32_t)mq_mode & RTE_ETH_MQ_RX_RSS_FLAG) { + conf->rxmode.offloads |= RTE_ETH_RX_OFFLOAD_RSS_HASH; +- hw->rss_dis_flag = false; + rss_conf = conf->rx_adv_conf.rss_conf; + ret = hns3_dev_rss_hash_update(dev, &rss_conf); + if (ret) +@@ -997,7 +996,6 @@ hns3vf_get_configuration(struct hns3_hw *hw) + int ret; + + hw->mac.media_type = HNS3_MEDIA_TYPE_NONE; +- hw->rss_dis_flag = false; + + /* Get device capability */ + ret = hns3vf_get_capability(hw); +diff --git a/drivers/net/hns3/hns3_flow.c b/drivers/net/hns3/hns3_flow.c +index 317f91fc71..86ebbf69b6 100644 +--- a/drivers/net/hns3/hns3_flow.c ++++ b/drivers/net/hns3/hns3_flow.c +@@ -1449,7 +1449,6 @@ hns3_disable_rss(struct hns3_hw *hw) + ret = hns3_set_rss_tuple_by_rss_hf(hw, 0); + if (ret) + return ret; +- hw->rss_dis_flag = true; + + return 0; + } +diff --git a/drivers/net/hns3/hns3_rss.c b/drivers/net/hns3/hns3_rss.c +index e149c16bfe..d376486a1d 100644 +--- a/drivers/net/hns3/hns3_rss.c ++++ b/drivers/net/hns3/hns3_rss.c +@@ -381,9 +381,6 @@ hns3_dev_rss_hash_update(struct rte_eth_dev *dev, + uint8_t *key = rss_conf->rss_key; + int ret; + +- if (hw->rss_dis_flag) +- return -EINVAL; +- + if (key && key_len != HNS3_RSS_KEY_SIZE) { + hns3_err(hw, "the hash key len(%u) is invalid, must be %u", + key_len, HNS3_RSS_KEY_SIZE); +-- +2.33.0 + diff --git a/0084-app-testpmd-check-statistics-query-before-printing.patch b/0084-app-testpmd-check-statistics-query-before-printing.patch new file mode 100644 index 0000000000000000000000000000000000000000..871ecc85ec4ae969e96408a513f9abb8870fefdb --- /dev/null +++ b/0084-app-testpmd-check-statistics-query-before-printing.patch @@ -0,0 +1,96 @@ +From baef6bbfad1b9596c7051f5c1fcc308310296342 Mon Sep 17 00:00:00 2001 +From: "Min Hu (Connor)" +Date: Wed, 6 Apr 2022 16:45:36 +0800 +Subject: [PATCH] app/testpmd: check statistics query before printing + +In function 'fwd_stats_display', if function 'rte_eth_stats_get' fails, +'stats' is uncertainty value. The display result will be abnormal. + +This patch check the return value of 'rte_eth_stats_get' to avoid +display abnormal stats. + +Fixes: 53324971a14e ("app/testpmd: display/clear forwarding stats on demand") +Cc: stable@dpdk.org + +Signed-off-by: Min Hu (Connor) +Acked-by: Aman Singh +--- + app/test-pmd/config.c | 10 ++++++++-- + app/test-pmd/testpmd.c | 16 ++++++++++++++-- + 2 files changed, 22 insertions(+), 4 deletions(-) + +diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c +index cc8e7aa138..bd689f9f86 100644 +--- a/app/test-pmd/config.c ++++ b/app/test-pmd/config.c +@@ -249,14 +249,20 @@ nic_stats_display(portid_t port_id) + diff_ns; + uint64_t mpps_rx, mpps_tx, mbps_rx, mbps_tx; + struct rte_eth_stats stats; +- + static const char *nic_stats_border = "########################"; ++ int ret; + + if (port_id_is_invalid(port_id, ENABLED_WARN)) { + print_valid_ports(); + return; + } +- rte_eth_stats_get(port_id, &stats); ++ ret = rte_eth_stats_get(port_id, &stats); ++ if (ret != 0) { ++ fprintf(stderr, ++ "%s: Error: failed to get stats (port %u): %d", ++ __func__, port_id, ret); ++ return; ++ } + printf("\n %s NIC statistics for port %-2d %s\n", + nic_stats_border, port_id, nic_stats_border); + +diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c +index fe2ce19f99..79bb23264b 100644 +--- a/app/test-pmd/testpmd.c ++++ b/app/test-pmd/testpmd.c +@@ -1982,6 +1982,7 @@ fwd_stats_display(void) + struct rte_port *port; + streamid_t sm_id; + portid_t pt_id; ++ int ret; + int i; + + memset(ports_stats, 0, sizeof(ports_stats)); +@@ -2013,7 +2014,13 @@ fwd_stats_display(void) + pt_id = fwd_ports_ids[i]; + port = &ports[pt_id]; + +- rte_eth_stats_get(pt_id, &stats); ++ ret = rte_eth_stats_get(pt_id, &stats); ++ if (ret != 0) { ++ fprintf(stderr, ++ "%s: Error: failed to get stats (port %u): %d", ++ __func__, pt_id, ret); ++ continue; ++ } + stats.ipackets -= port->stats.ipackets; + stats.opackets -= port->stats.opackets; + stats.ibytes -= port->stats.ibytes; +@@ -2108,11 +2115,16 @@ fwd_stats_reset(void) + { + streamid_t sm_id; + portid_t pt_id; ++ int ret; + int i; + + for (i = 0; i < cur_fwd_config.nb_fwd_ports; i++) { + pt_id = fwd_ports_ids[i]; +- rte_eth_stats_get(pt_id, &ports[pt_id].stats); ++ ret = rte_eth_stats_get(pt_id, &ports[pt_id].stats); ++ if (ret != 0) ++ fprintf(stderr, ++ "%s: Error: failed to clear stats (port %u):%d", ++ __func__, pt_id, ret); + } + for (sm_id = 0; sm_id < cur_fwd_config.nb_fwd_streams; sm_id++) { + struct fwd_stream *fs = fwd_streams[sm_id]; +-- +2.33.0 + diff --git a/0084-net-hns3-support-get-device-version-when-dump-regist.patch b/0084-net-hns3-support-get-device-version-when-dump-regist.patch deleted file mode 100644 index 074bdd7791b1c5af2bd2fc7865131b2c2c314a57..0000000000000000000000000000000000000000 --- a/0084-net-hns3-support-get-device-version-when-dump-regist.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 07e64207da01090076fc5066fed401caf89fc20e Mon Sep 17 00:00:00 2001 -From: Chengwen Feng -Date: Wed, 31 Mar 2021 18:01:42 +0800 -Subject: [PATCH 084/189] net/hns3: support get device version when dump - register - -Support get device version which is equal to the firmware version -when dump register. - -Fixes: 936eda25e8da ("net/hns3: support dump register") -Cc: stable@dpdk.org - -Signed-off-by: Chengwen Feng -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_regs.c | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/drivers/net/hns3/hns3_regs.c b/drivers/net/hns3/hns3_regs.c -index 93055a4..374b9ea 100644 ---- a/drivers/net/hns3/hns3_regs.c -+++ b/drivers/net/hns3/hns3_regs.c -@@ -499,6 +499,8 @@ hns3_get_regs(struct rte_eth_dev *eth_dev, struct rte_dev_reg_info *regs) - if (regs->length && regs->length != length) - return -ENOTSUP; - -+ regs->version = hw->fw_version; -+ - /* fetching per-PF registers values from PF PCIe register space */ - data += hns3_direct_access_regs(hw, data); - --- -2.7.4 - diff --git a/0085-app-testpmd-fix-MTU-verification.patch b/0085-app-testpmd-fix-MTU-verification.patch new file mode 100644 index 0000000000000000000000000000000000000000..4a04ea8ec2e8b6c6ccff495ba7f51fa22de7d271 --- /dev/null +++ b/0085-app-testpmd-fix-MTU-verification.patch @@ -0,0 +1,110 @@ +From f0b3966a5072bd0a6c7f7e8652aef793afa4f4d0 Mon Sep 17 00:00:00 2001 +From: Huisong Li +Date: Wed, 6 Apr 2022 16:45:37 +0800 +Subject: [PATCH] app/testpmd: fix MTU verification + +The macro RTE_ETHER_MIN_LEN isn't the minimum value of MTU. But testpmd +used it when execute 'port config mtu 0 xx' cmd. This patch fixes it. + +Fixes: 1bb4a528c41f ("ethdev: fix max Rx packet length") +Cc: stable@dpdk.org + +Signed-off-by: Huisong Li +Signed-off-by: Min Hu (Connor) +Acked-by: Ferruh Yigit +--- + app/test-pmd/cmdline.c | 4 --- + app/test-pmd/config.c | 55 ++++++++++++++++++++++++++++++++++++++++++ + 2 files changed, 55 insertions(+), 4 deletions(-) + +diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c +index 6ffea8e21a..91e4090582 100644 +--- a/app/test-pmd/cmdline.c ++++ b/app/test-pmd/cmdline.c +@@ -2050,10 +2050,6 @@ cmd_config_mtu_parsed(void *parsed_result, + { + struct cmd_config_mtu_result *res = parsed_result; + +- if (res->value < RTE_ETHER_MIN_LEN) { +- fprintf(stderr, "mtu cannot be less than %d\n", RTE_ETHER_MIN_LEN); +- return; +- } + port_mtu_set(res->port_id, res->value); + } + +diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c +index bd689f9f86..1b1e738f83 100644 +--- a/app/test-pmd/config.c ++++ b/app/test-pmd/config.c +@@ -1254,6 +1254,57 @@ port_reg_set(portid_t port_id, uint32_t reg_off, uint32_t reg_v) + display_port_reg_value(port_id, reg_off, reg_v); + } + ++static uint32_t ++eth_dev_get_overhead_len(uint32_t max_rx_pktlen, uint16_t max_mtu) ++{ ++ uint32_t overhead_len; ++ ++ if (max_mtu != UINT16_MAX && max_rx_pktlen > max_mtu) ++ overhead_len = max_rx_pktlen - max_mtu; ++ else ++ overhead_len = RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN; ++ ++ return overhead_len; ++} ++ ++static int ++eth_dev_validate_mtu(uint16_t port_id, uint16_t mtu) ++{ ++ struct rte_eth_dev_info dev_info; ++ uint32_t overhead_len; ++ uint32_t frame_size; ++ int ret; ++ ++ ret = rte_eth_dev_info_get(port_id, &dev_info); ++ if (ret != 0) ++ return ret; ++ ++ if (mtu < dev_info.min_mtu) { ++ fprintf(stderr, ++ "MTU (%u) < device min MTU (%u) for port_id %u\n", ++ mtu, dev_info.min_mtu, port_id); ++ return -EINVAL; ++ } ++ if (mtu > dev_info.max_mtu) { ++ fprintf(stderr, ++ "MTU (%u) > device max MTU (%u) for port_id %u\n", ++ mtu, dev_info.max_mtu, port_id); ++ return -EINVAL; ++ } ++ ++ overhead_len = eth_dev_get_overhead_len(dev_info.max_rx_pktlen, ++ dev_info.max_mtu); ++ frame_size = mtu + overhead_len; ++ if (frame_size > dev_info.max_rx_pktlen) { ++ fprintf(stderr, ++ "Frame size (%u) > device max frame size (%u) for port_id %u\n", ++ frame_size, dev_info.max_rx_pktlen, port_id); ++ return -EINVAL; ++ } ++ ++ return 0; ++} ++ + void + port_mtu_set(portid_t port_id, uint16_t mtu) + { +@@ -1263,6 +1314,10 @@ port_mtu_set(portid_t port_id, uint16_t mtu) + if (port_id_is_invalid(port_id, ENABLED_WARN)) + return; + ++ diag = eth_dev_validate_mtu(port_id, mtu); ++ if (diag != 0) ++ return; ++ + if (port->need_reconfig == 0) { + diag = rte_eth_dev_set_mtu(port_id, mtu); + if (diag != 0) { +-- +2.33.0 + diff --git a/0085-net-hns3-delete-redundant-blank-line.patch b/0085-net-hns3-delete-redundant-blank-line.patch deleted file mode 100644 index 1c2ebaba7de17514a37f24473a8aee375d8f7c0c..0000000000000000000000000000000000000000 --- a/0085-net-hns3-delete-redundant-blank-line.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 59aed028f457ad2f029b85d48bcdf9c9678b3b07 Mon Sep 17 00:00:00 2001 -From: Hongbo Zheng -Date: Wed, 31 Mar 2021 18:01:43 +0800 -Subject: [PATCH 085/189] net/hns3: delete redundant blank line - -Delete redundant blank line in "hns3vf_check_event_cause" to -solve the static warning. - -Fixes: a5475d61fa34 ("net/hns3: support VF") -Cc: stable@dpdk.org - -Signed-off-by: Hongbo Zheng -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_ethdev_vf.c | 1 - - 1 file changed, 1 deletion(-) - -diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c -index 22281c8..2a302e5 100644 ---- a/drivers/net/hns3/hns3_ethdev_vf.c -+++ b/drivers/net/hns3/hns3_ethdev_vf.c -@@ -1064,7 +1064,6 @@ hns3vf_check_event_cause(struct hns3_adapter *hns, uint32_t *clearval) - - /* Fetch the events from their corresponding regs */ - cmdq_stat_reg = hns3_read_dev(hw, HNS3_VECTOR0_CMDQ_STAT_REG); -- - if (BIT(HNS3_VECTOR0_RST_INT_B) & cmdq_stat_reg) { - rst_ing_reg = hns3_read_dev(hw, HNS3_FUN_RST_ING); - hns3_warn(hw, "resetting reg: 0x%x", rst_ing_reg); --- -2.7.4 - diff --git a/0086-app-testpmd-fix-port-status-of-bonding-slave-device.patch b/0086-app-testpmd-fix-port-status-of-bonding-slave-device.patch new file mode 100644 index 0000000000000000000000000000000000000000..170317a220a559aec0b5eb25e639657de411aefb --- /dev/null +++ b/0086-app-testpmd-fix-port-status-of-bonding-slave-device.patch @@ -0,0 +1,152 @@ +From 82a85bc3c90744e171e0a16330685c4fd8c86a4a Mon Sep 17 00:00:00 2001 +From: Huisong Li +Date: Wed, 11 May 2022 10:14:34 +0800 +Subject: [PATCH 086/122] app/testpmd: fix port status of bonding slave device + +Starting or stopping a bonded port also starts or stops all active slaves +under the bonded port. If this port is a bonded device, we need to modify +the port status of all slaves. + +Fixes: 0e545d3047fe ("app/testpmd: check stopping port is not in bonding") +Cc: stable@dpdk.org + +Signed-off-by: Huisong Li +Signed-off-by: Min Hu (Connor) +Acked-by: Aman Singh +Acked-by: Konstantin Ananyev +--- + app/test-pmd/cmdline.c | 1 + + app/test-pmd/testpmd.c | 73 +++++++++++++++++++++++++++++++++++++++--- + app/test-pmd/testpmd.h | 3 +- + 3 files changed, 72 insertions(+), 5 deletions(-) + +diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c +index 969a333c93..1991ee3446 100644 +--- a/app/test-pmd/cmdline.c ++++ b/app/test-pmd/cmdline.c +@@ -6660,6 +6660,7 @@ static void cmd_create_bonded_device_parsed(void *parsed_result, + "Failed to enable promiscuous mode for port %u: %s - ignore\n", + port_id, rte_strerror(-ret)); + ++ ports[port_id].bond_flag = 1; + ports[port_id].need_setup = 0; + ports[port_id].port_status = RTE_PORT_STOPPED; + } +diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c +index f9c025f97e..c4be9abe73 100644 +--- a/app/test-pmd/testpmd.c ++++ b/app/test-pmd/testpmd.c +@@ -66,6 +66,9 @@ + #ifdef RTE_EXEC_ENV_WINDOWS + #include + #endif ++#ifdef RTE_NET_BOND ++#include ++#endif + + #include "testpmd.h" + +@@ -591,11 +594,58 @@ eth_dev_configure_mp(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q, + return 0; + } + ++static int ++change_bonding_slave_port_status(portid_t bond_pid, bool is_stop) ++{ ++#ifdef RTE_NET_BOND ++ ++ portid_t slave_pids[RTE_MAX_ETHPORTS]; ++ struct rte_port *port; ++ int num_slaves; ++ portid_t slave_pid; ++ int i; ++ ++ num_slaves = rte_eth_bond_slaves_get(bond_pid, slave_pids, ++ RTE_MAX_ETHPORTS); ++ if (num_slaves < 0) { ++ fprintf(stderr, "Failed to get slave list for port = %u\n", ++ bond_pid); ++ return num_slaves; ++ } ++ ++ for (i = 0; i < num_slaves; i++) { ++ slave_pid = slave_pids[i]; ++ port = &ports[slave_pid]; ++ port->port_status = ++ is_stop ? RTE_PORT_STOPPED : RTE_PORT_STARTED; ++ } ++#else ++ RTE_SET_USED(bond_pid); ++ RTE_SET_USED(is_stop); ++#endif ++ return 0; ++} ++ + static int + eth_dev_start_mp(uint16_t port_id) + { +- if (is_proc_primary()) +- return rte_eth_dev_start(port_id); ++ int ret; ++ ++ if (is_proc_primary()) { ++ ret = rte_eth_dev_start(port_id); ++ if (ret != 0) ++ return ret; ++ ++ struct rte_port *port = &ports[port_id]; ++ ++ /* ++ * Starting a bonded port also starts all slaves under the bonded ++ * device. So if this port is bond device, we need to modify the ++ * port status of these slaves. ++ */ ++ if (port->bond_flag == 1) ++ return change_bonding_slave_port_status(port_id, false); ++ } + + return 0; + } +@@ -603,8 +653,23 @@ eth_dev_start_mp(uint16_t port_id) + static int + eth_dev_stop_mp(uint16_t port_id) + { +- if (is_proc_primary()) +- return rte_eth_dev_stop(port_id); ++ int ret; ++ ++ if (is_proc_primary()) { ++ ret = rte_eth_dev_stop(port_id); ++ if (ret != 0) ++ return ret; ++ ++ struct rte_port *port = &ports[port_id]; ++ ++ /* ++ * Stopping a bonded port also stops all slaves under the bonded ++ * device. So if this port is bond device, we need to modify the ++ * port status of these slaves. ++ */ ++ if (port->bond_flag == 1) ++ return change_bonding_slave_port_status(port_id, true); ++ } + + return 0; + } +diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h +index 2149ecd93a..9c24cb07e0 100644 +--- a/app/test-pmd/testpmd.h ++++ b/app/test-pmd/testpmd.h +@@ -242,7 +242,8 @@ struct rte_port { + struct rte_eth_txconf tx_conf[RTE_MAX_QUEUES_PER_PORT+1]; /**< per queue tx configuration */ + struct rte_ether_addr *mc_addr_pool; /**< pool of multicast addrs */ + uint32_t mc_addr_nb; /**< nb. of addr. in mc_addr_pool */ +- uint8_t slave_flag; /**< bonding slave port */ ++ uint8_t slave_flag : 1, /**< bonding slave port */ ++ bond_flag : 1; /**< port is bond device */ + struct port_flow *flow_list; /**< Associated flows. */ + struct port_indirect_action *actions_list; + /**< Associated indirect actions. */ +-- +2.22.0 + diff --git a/0086-net-hns3-fix-code-style.patch b/0086-net-hns3-fix-code-style.patch deleted file mode 100644 index 1f215e6ab3106055ac43aa4e56362cfede8dd7bc..0000000000000000000000000000000000000000 --- a/0086-net-hns3-fix-code-style.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 65df0c1e556bfcbb39382da267141676a894decd Mon Sep 17 00:00:00 2001 -From: Hongbo Zheng -Date: Wed, 31 Mar 2021 18:01:44 +0800 -Subject: [PATCH 086/189] net/hns3: fix code style - -Add one space before the left brace to solve the static warning. - -Fixes: 63e05f19b82b ("net/hns3: support Rx descriptor status query") - -Signed-off-by: Hongbo Zheng -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_rxtx.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c -index c41cccb..b06b723 100644 ---- a/drivers/net/hns3/hns3_rxtx.c -+++ b/drivers/net/hns3/hns3_rxtx.c -@@ -4477,7 +4477,7 @@ hns3_dev_rx_descriptor_status(void *rx_queue, uint16_t offset) - if (offset >= rxq->nb_rx_desc - rxq->rx_free_hold) - return RTE_ETH_RX_DESC_UNAVAIL; - } else if (dev->rx_pkt_burst == hns3_recv_pkts_vec || -- dev->rx_pkt_burst == hns3_recv_pkts_vec_sve){ -+ dev->rx_pkt_burst == hns3_recv_pkts_vec_sve) { - if (offset >= rxq->nb_rx_desc - rxq->rx_rearm_nb) - return RTE_ETH_RX_DESC_UNAVAIL; - } else { --- -2.7.4 - diff --git a/0087-ethdev-clarify-null-location-case-in-xstats-get.patch b/0087-ethdev-clarify-null-location-case-in-xstats-get.patch new file mode 100644 index 0000000000000000000000000000000000000000..e2b5f9733a8fb50af15d615ac0f367ff58e9ee12 --- /dev/null +++ b/0087-ethdev-clarify-null-location-case-in-xstats-get.patch @@ -0,0 +1,79 @@ +From 21658b863d246055c225286d9bce8a0a884fc9d9 Mon Sep 17 00:00:00 2001 +From: Chengwen Feng +Date: Fri, 13 May 2022 10:53:49 +0800 +Subject: [PATCH 087/122] ethdev: clarify null location case in xstats get +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +When xstats location is null in rte_eth_xstats_get() the return value +is not clearly specified. Some PMDs (eg. hns3/ipn3ke/mvpp2/axgbe) return +zero while others return the required number of elements. + +In this patch, special parameter combinations are restricted: + 1. highlight that xstats location may be null if and only if n is 0. + 2. amend n parameter description to specify that if n is lower than + the required number of elements, the function returns the required + number of elements. + 3. specify that if n is zero, the xstats must be NULL, the function + returns the required number of elements (a duplicate which should + help to not very attentive readers). + +Add sanity check for null xstats and non-zero n case on API level to +make it unnecessary to care about it in drivers. + +Fixes: ce757f5c9a4d ("ethdev: new method to retrieve extended statistics") +Cc: stable@dpdk.org + +Signed-off-by: Chengwen Feng +Acked-by: Morten Brørup +Reviewed-by: Andrew Rybchenko +--- + lib/ethdev/rte_ethdev.c | 4 +++- + lib/ethdev/rte_ethdev.h | 6 +++++- + 2 files changed, 8 insertions(+), 2 deletions(-) + +diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c +index cea2f0b498..b4a331b671 100644 +--- a/lib/ethdev/rte_ethdev.c ++++ b/lib/ethdev/rte_ethdev.c +@@ -3319,6 +3319,8 @@ rte_eth_xstats_get(uint16_t port_id, struct rte_eth_xstat *xstats, + int ret; + + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); ++ if (xstats == NULL && n > 0) ++ return -EINVAL; + dev = &rte_eth_devices[port_id]; + + nb_rxqs = RTE_MIN(dev->data->nb_rx_queues, RTE_ETHDEV_QUEUE_STAT_CNTRS); +@@ -3335,7 +3337,7 @@ rte_eth_xstats_get(uint16_t port_id, struct rte_eth_xstat *xstats, + * xstats struct. + */ + xcount = (*dev->dev_ops->xstats_get)(dev, +- xstats ? xstats + count : NULL, ++ (n > count) ? xstats + count : NULL, + (n > count) ? n - count : 0); + + if (xcount < 0) +diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h +index b8f135ba3f..082166ed42 100644 +--- a/lib/ethdev/rte_ethdev.h ++++ b/lib/ethdev/rte_ethdev.h +@@ -3105,9 +3105,13 @@ int rte_eth_xstats_get_names(uint16_t port_id, + * @param xstats + * A pointer to a table of structure of type *rte_eth_xstat* + * to be filled with device statistics ids and values. +- * This parameter can be set to NULL if n is 0. ++ * This parameter can be set to NULL if and only if n is 0. + * @param n + * The size of the xstats array (number of elements). ++ * If lower than the required number of elements, the function returns ++ * the required number of elements. ++ * If equal to zero, the xstats must be NULL, the function returns the ++ * required number of elements. + * @return + * - A positive value lower or equal to n: success. The return value + * is the number of entries filled in the stats table. +-- +2.22.0 + diff --git a/0087-net-hns3-refactor-VF-LSC-event-report.patch b/0087-net-hns3-refactor-VF-LSC-event-report.patch deleted file mode 100644 index 7dd6c79d498c0dca6a8df68b1f57fa9c75ee135d..0000000000000000000000000000000000000000 --- a/0087-net-hns3-refactor-VF-LSC-event-report.patch +++ /dev/null @@ -1,464 +0,0 @@ -From 053fca7a826300094e247e01c6376ba72f611673 Mon Sep 17 00:00:00 2001 -From: Chengwen Feng -Date: Fri, 9 Apr 2021 12:45:21 +0800 -Subject: [PATCH 087/189] net/hns3: refactor VF LSC event report - -Currently, VF driver periodically obtains link status from PF kernel -driver, and reports lsc event when detects link status change. Because -the period is 1 second, it's probably too late to report especially -in such as bonding scenario. - -To solve this problem we use the following scheme: -1. PF kernel driver support immediate push link status to all VFs when - it detects the link status changes. -2. VF driver will detect PF kernel driver whether support push link - status in device init stage by sending request link info mailbox - message to PF, PF then tell VF the push capability by extend - HNS3_MBX_LINK_STAT_CHANGE mailbox message. -3. VF driver marks RTE_PCI_DRV_INTR_LSC in rte_pci_driver by default, - when it detects PF doesn't support push link status then it will clear - RTE_ETH_DEV_INTR_LSC flag. - -So if PF kernel driver supports push link status to VF, then VF driver -will have RTE_ETH_DEV_INTR_LSC capability. - -Signed-off-by: Chengwen Feng -Signed-off-by: Min Hu (Connor) ---- - doc/guides/nics/features/hns3_vf.ini | 1 + - drivers/net/hns3/hns3_ethdev.h | 27 ++++++ - drivers/net/hns3/hns3_ethdev_vf.c | 171 ++++++++++++++++++++++++++++------- - drivers/net/hns3/hns3_intr.c | 30 ++++++ - drivers/net/hns3/hns3_intr.h | 2 + - drivers/net/hns3/hns3_mbx.c | 3 + - 6 files changed, 199 insertions(+), 35 deletions(-) - -diff --git a/doc/guides/nics/features/hns3_vf.ini b/doc/guides/nics/features/hns3_vf.ini -index a0fd56d..22bb890 100644 ---- a/doc/guides/nics/features/hns3_vf.ini -+++ b/doc/guides/nics/features/hns3_vf.ini -@@ -5,6 +5,7 @@ - ; - [Features] - Link status = Y -+Link status event = Y - Rx interrupt = Y - Queue start/stop = Y - Runtime Rx queue setup = Y -diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h -index fc0dc37..dcf14d6 100644 ---- a/drivers/net/hns3/hns3_ethdev.h -+++ b/drivers/net/hns3/hns3_ethdev.h -@@ -763,8 +763,26 @@ struct hns3_pf { - struct hns3_tm_conf tm_conf; - }; - -+enum { -+ HNS3_PF_PUSH_LSC_CAP_NOT_SUPPORTED, -+ HNS3_PF_PUSH_LSC_CAP_SUPPORTED, -+ HNS3_PF_PUSH_LSC_CAP_UNKNOWN -+}; -+ - struct hns3_vf { - struct hns3_adapter *adapter; -+ -+ /* Whether PF support push link status change to VF */ -+ uint16_t pf_push_lsc_cap; -+ -+ /* -+ * If PF support push link status change, VF still need send request to -+ * get link status in some cases (such as reset recover stage), so use -+ * the req_link_info_cnt to control max request count. -+ */ -+ uint16_t req_link_info_cnt; -+ -+ uint16_t poll_job_started; /* whether poll job is started */ - }; - - struct hns3_adapter { -@@ -849,6 +867,8 @@ enum { - (&((struct hns3_adapter *)adapter)->hw) - #define HNS3_DEV_PRIVATE_TO_PF(adapter) \ - (&((struct hns3_adapter *)adapter)->pf) -+#define HNS3_DEV_PRIVATE_TO_VF(adapter) \ -+ (&((struct hns3_adapter *)adapter)->vf) - #define HNS3_DEV_HW_TO_ADAPTER(hw) \ - container_of(hw, struct hns3_adapter, hw) - -@@ -858,6 +878,12 @@ static inline struct hns3_pf *HNS3_DEV_HW_TO_PF(struct hns3_hw *hw) - return &adapter->pf; - } - -+static inline struct hns3_vf *HNS3_DEV_HW_TO_VF(struct hns3_hw *hw) -+{ -+ struct hns3_adapter *adapter = HNS3_DEV_HW_TO_ADAPTER(hw); -+ return &adapter->vf; -+} -+ - #define hns3_set_field(origin, mask, shift, val) \ - do { \ - (origin) &= (~(mask)); \ -@@ -1004,6 +1030,7 @@ int hns3_dev_infos_get(struct rte_eth_dev *eth_dev, - void hns3vf_update_link_status(struct hns3_hw *hw, uint8_t link_status, - uint32_t link_speed, uint8_t link_duplex); - void hns3_parse_devargs(struct rte_eth_dev *dev); -+void hns3vf_update_push_lsc_cap(struct hns3_hw *hw, bool supported); - int hns3_restore_ptp(struct hns3_adapter *hns); - int hns3_mbuf_dyn_rx_timestamp_register(struct rte_eth_dev *dev, - struct rte_eth_conf *conf); -diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c -index 2a302e5..13f92da 100644 ---- a/drivers/net/hns3/hns3_ethdev_vf.c -+++ b/drivers/net/hns3/hns3_ethdev_vf.c -@@ -44,6 +44,9 @@ static int hns3vf_add_mc_mac_addr(struct hns3_hw *hw, - struct rte_ether_addr *mac_addr); - static int hns3vf_remove_mc_mac_addr(struct hns3_hw *hw, - struct rte_ether_addr *mac_addr); -+static int hns3vf_dev_link_update(struct rte_eth_dev *eth_dev, -+ __rte_unused int wait_to_complete); -+ - /* set PCI bus mastering */ - static int - hns3vf_set_bus_master(const struct rte_pci_device *device, bool op) -@@ -1191,6 +1194,65 @@ hns3vf_query_dev_specifications(struct hns3_hw *hw) - return hns3vf_check_dev_specifications(hw); - } - -+void -+hns3vf_update_push_lsc_cap(struct hns3_hw *hw, bool supported) -+{ -+ uint16_t val = supported ? HNS3_PF_PUSH_LSC_CAP_SUPPORTED : -+ HNS3_PF_PUSH_LSC_CAP_NOT_SUPPORTED; -+ uint16_t exp = HNS3_PF_PUSH_LSC_CAP_UNKNOWN; -+ struct hns3_vf *vf = HNS3_DEV_HW_TO_VF(hw); -+ -+ if (vf->pf_push_lsc_cap == HNS3_PF_PUSH_LSC_CAP_UNKNOWN) -+ __atomic_compare_exchange(&vf->pf_push_lsc_cap, &exp, &val, 0, -+ __ATOMIC_ACQUIRE, __ATOMIC_ACQUIRE); -+} -+ -+static void -+hns3vf_get_push_lsc_cap(struct hns3_hw *hw) -+{ -+#define HNS3_CHECK_PUSH_LSC_CAP_TIMEOUT_MS 500 -+ -+ struct rte_eth_dev *dev = &rte_eth_devices[hw->data->port_id]; -+ int32_t remain_ms = HNS3_CHECK_PUSH_LSC_CAP_TIMEOUT_MS; -+ uint16_t val = HNS3_PF_PUSH_LSC_CAP_NOT_SUPPORTED; -+ uint16_t exp = HNS3_PF_PUSH_LSC_CAP_UNKNOWN; -+ struct hns3_vf *vf = HNS3_DEV_HW_TO_VF(hw); -+ -+ __atomic_store_n(&vf->pf_push_lsc_cap, HNS3_PF_PUSH_LSC_CAP_UNKNOWN, -+ __ATOMIC_RELEASE); -+ -+ (void)hns3_send_mbx_msg(hw, HNS3_MBX_GET_LINK_STATUS, 0, NULL, 0, false, -+ NULL, 0); -+ -+ while (remain_ms > 0) { -+ rte_delay_ms(HNS3_POLL_RESPONE_MS); -+ if (__atomic_load_n(&vf->pf_push_lsc_cap, __ATOMIC_ACQUIRE) != -+ HNS3_PF_PUSH_LSC_CAP_UNKNOWN) -+ break; -+ remain_ms--; -+ } -+ -+ /* -+ * When exit above loop, the pf_push_lsc_cap could be one of the three -+ * state: unknown (means pf not ack), not_supported, supported. -+ * Here config it as 'not_supported' when it's 'unknown' state. -+ */ -+ __atomic_compare_exchange(&vf->pf_push_lsc_cap, &exp, &val, 0, -+ __ATOMIC_ACQUIRE, __ATOMIC_ACQUIRE); -+ -+ if (__atomic_load_n(&vf->pf_push_lsc_cap, __ATOMIC_ACQUIRE) == -+ HNS3_PF_PUSH_LSC_CAP_SUPPORTED) { -+ hns3_info(hw, "detect PF support push link status change!"); -+ } else { -+ /* -+ * Framework already set RTE_ETH_DEV_INTR_LSC bit because driver -+ * declared RTE_PCI_DRV_INTR_LSC in drv_flags. So here cleared -+ * the RTE_ETH_DEV_INTR_LSC capability. -+ */ -+ dev->data->dev_flags &= ~RTE_ETH_DEV_INTR_LSC; -+ } -+} -+ - static int - hns3vf_get_capability(struct hns3_hw *hw) - { -@@ -1404,6 +1466,8 @@ hns3vf_get_configuration(struct hns3_hw *hw) - return ret; - } - -+ hns3vf_get_push_lsc_cap(hw); -+ - /* Get queue configuration from PF */ - ret = hns3vf_get_queue_info(hw); - if (ret) -@@ -1451,15 +1515,28 @@ hns3vf_set_tc_queue_mapping(struct hns3_adapter *hns, uint16_t nb_rx_q, - static void - hns3vf_request_link_info(struct hns3_hw *hw) - { -+ struct hns3_vf *vf = HNS3_DEV_HW_TO_VF(hw); - uint8_t resp_msg; -+ bool send_req; - int ret; - - if (__atomic_load_n(&hw->reset.resetting, __ATOMIC_RELAXED)) - return; -+ -+ send_req = vf->pf_push_lsc_cap == HNS3_PF_PUSH_LSC_CAP_NOT_SUPPORTED || -+ vf->req_link_info_cnt > 0; -+ if (!send_req) -+ return; -+ - ret = hns3_send_mbx_msg(hw, HNS3_MBX_GET_LINK_STATUS, 0, NULL, 0, false, - &resp_msg, sizeof(resp_msg)); -- if (ret) -- hns3_err(hw, "Failed to fetch link status from PF: %d", ret); -+ if (ret) { -+ hns3_err(hw, "failed to fetch link status, ret = %d", ret); -+ return; -+ } -+ -+ if (vf->req_link_info_cnt > 0) -+ vf->req_link_info_cnt--; - } - - void -@@ -1467,34 +1544,30 @@ hns3vf_update_link_status(struct hns3_hw *hw, uint8_t link_status, - uint32_t link_speed, uint8_t link_duplex) - { - struct rte_eth_dev *dev = &rte_eth_devices[hw->data->port_id]; -+ struct hns3_vf *vf = HNS3_DEV_HW_TO_VF(hw); - struct hns3_mac *mac = &hw->mac; -- bool report_lse; -- bool changed; -- -- changed = mac->link_status != link_status || -- mac->link_speed != link_speed || -- mac->link_duplex != link_duplex; -- if (!changed) -- return; -+ int ret; - - /* -- * VF's link status/speed/duplex were updated by polling from PF driver, -- * because the link status/speed/duplex may be changed in the polling -- * interval, so driver will report lse (lsc event) once any of the above -- * thress variables changed. -- * But if the PF's link status is down and driver saved link status is -- * also down, there are no need to report lse. -+ * PF kernel driver may push link status when VF driver is in resetting, -+ * driver will stop polling job in this case, after resetting done -+ * driver will start polling job again. -+ * When polling job started, driver will get initial link status by -+ * sending request to PF kernel driver, then could update link status by -+ * process PF kernel driver's link status mailbox message. - */ -- report_lse = true; -- if (link_status == ETH_LINK_DOWN && link_status == mac->link_status) -- report_lse = false; -+ if (!__atomic_load_n(&vf->poll_job_started, __ATOMIC_RELAXED)) -+ return; -+ -+ if (hw->adapter_state != HNS3_NIC_STARTED) -+ return; - - mac->link_status = link_status; - mac->link_speed = link_speed; - mac->link_duplex = link_duplex; -- -- if (report_lse) -- rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL); -+ ret = hns3vf_dev_link_update(dev, 0); -+ if (ret == 0 && dev->data->dev_conf.intr_conf.lsc != 0) -+ hns3_start_report_lse(dev); - } - - static int -@@ -1710,8 +1783,8 @@ hns3vf_service_handler(void *param) - - /* - * The query link status and reset processing are executed in the -- * interrupt thread.When the IMP reset occurs, IMP will not respond, -- * and the query operation will time out after 30ms. In the case of -+ * interrupt thread. When the IMP reset occurs, IMP will not respond, -+ * and the query operation will timeout after 30ms. In the case of - * multiple PF/VFs, each query failure timeout causes the IMP reset - * interrupt to fail to respond within 100ms. - * Before querying the link status, check whether there is a reset -@@ -1726,6 +1799,31 @@ hns3vf_service_handler(void *param) - eth_dev); - } - -+static void -+hns3vf_start_poll_job(struct rte_eth_dev *dev) -+{ -+#define HNS3_REQUEST_LINK_INFO_REMAINS_CNT 3 -+ -+ struct hns3_vf *vf = HNS3_DEV_PRIVATE_TO_VF(dev->data->dev_private); -+ -+ if (vf->pf_push_lsc_cap == HNS3_PF_PUSH_LSC_CAP_SUPPORTED) -+ vf->req_link_info_cnt = HNS3_REQUEST_LINK_INFO_REMAINS_CNT; -+ -+ __atomic_store_n(&vf->poll_job_started, 1, __ATOMIC_RELAXED); -+ -+ hns3vf_service_handler(dev); -+} -+ -+static void -+hns3vf_stop_poll_job(struct rte_eth_dev *dev) -+{ -+ struct hns3_vf *vf = HNS3_DEV_PRIVATE_TO_VF(dev->data->dev_private); -+ -+ rte_eal_alarm_cancel(hns3vf_service_handler, dev); -+ -+ __atomic_store_n(&vf->poll_job_started, 0, __ATOMIC_RELAXED); -+} -+ - static int - hns3_query_vf_resource(struct hns3_hw *hw) - { -@@ -2032,7 +2130,8 @@ hns3vf_dev_stop(struct rte_eth_dev *dev) - hw->adapter_state = HNS3_NIC_CONFIGURED; - } - hns3_rx_scattered_reset(dev); -- rte_eal_alarm_cancel(hns3vf_service_handler, dev); -+ hns3vf_stop_poll_job(dev); -+ hns3_stop_report_lse(dev); - rte_spinlock_unlock(&hw->lock); - - return 0; -@@ -2302,19 +2401,17 @@ hns3vf_dev_start(struct rte_eth_dev *dev) - hns3_rx_scattered_calc(dev); - hns3_set_rxtx_function(dev); - hns3_mp_req_start_rxtx(dev); -- hns3vf_service_handler(dev); - - hns3vf_restore_filter(dev); - - /* Enable interrupt of all rx queues before enabling queues */ - hns3_dev_all_rx_queue_intr_enable(hw, true); -- -- /* -- * After finished the initialization, start all tqps to receive/transmit -- * packets and refresh all queue status. -- */ - hns3_start_tqps(hw); - -+ if (dev->data->dev_conf.intr_conf.lsc != 0) -+ hns3vf_dev_link_update(dev, 0); -+ hns3vf_start_poll_job(dev); -+ - return ret; - - start_all_rxqs_fail: -@@ -2454,9 +2551,13 @@ hns3vf_stop_service(struct hns3_adapter *hns) - - eth_dev = &rte_eth_devices[hw->data->port_id]; - if (hw->adapter_state == HNS3_NIC_STARTED) { -- rte_eal_alarm_cancel(hns3vf_service_handler, eth_dev); -+ /* -+ * Make sure call update link status before hns3vf_stop_poll_job -+ * because update link status depend on polling job exist. -+ */ - hns3vf_update_link_status(hw, ETH_LINK_DOWN, hw->mac.link_speed, -- hw->mac.link_duplex); -+ hw->mac.link_duplex); -+ hns3vf_stop_poll_job(eth_dev); - } - hw->mac.link_status = ETH_LINK_DOWN; - -@@ -2497,7 +2598,7 @@ hns3vf_start_service(struct hns3_adapter *hns) - hns3_set_rxtx_function(eth_dev); - hns3_mp_req_start_rxtx(eth_dev); - if (hw->adapter_state == HNS3_NIC_STARTED) { -- hns3vf_service_handler(eth_dev); -+ hns3vf_start_poll_job(eth_dev); - - /* Enable interrupt of all rx queues before enabling queues */ - hns3_dev_all_rx_queue_intr_enable(hw, true); -@@ -2968,7 +3069,7 @@ static const struct rte_pci_id pci_id_hns3vf_map[] = { - - static struct rte_pci_driver rte_hns3vf_pmd = { - .id_table = pci_id_hns3vf_map, -- .drv_flags = RTE_PCI_DRV_NEED_MAPPING, -+ .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC, - .probe = eth_hns3vf_pci_probe, - .remove = eth_hns3vf_pci_remove, - }; -diff --git a/drivers/net/hns3/hns3_intr.c b/drivers/net/hns3/hns3_intr.c -index c259f2e..6250c36 100644 ---- a/drivers/net/hns3/hns3_intr.c -+++ b/drivers/net/hns3/hns3_intr.c -@@ -2614,3 +2614,33 @@ hns3_reset_abort(struct hns3_adapter *hns) - reset_string[hw->reset.level], tv.tv_sec, tv.tv_usec); - } - } -+ -+static void -+hns3_report_lse(void *arg) -+{ -+ struct rte_eth_dev *dev = (struct rte_eth_dev *)arg; -+ struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private); -+ -+ if (hw->adapter_state == HNS3_NIC_STARTED) -+ rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL); -+} -+ -+void -+hns3_start_report_lse(struct rte_eth_dev *dev) -+{ -+#define DELAY_REPORT_LSE_US 1 -+ /* -+ * When this function called, the context may hold hns3_hw.lock, if -+ * report lse right now, in some application such as bonding, it will -+ * trigger call driver's ops which may acquire hns3_hw.lock again, so -+ * lead to deadlock. -+ * Here we use delay report to avoid the deadlock. -+ */ -+ rte_eal_alarm_set(DELAY_REPORT_LSE_US, hns3_report_lse, dev); -+} -+ -+void -+hns3_stop_report_lse(struct rte_eth_dev *dev) -+{ -+ rte_eal_alarm_cancel(hns3_report_lse, dev); -+} -diff --git a/drivers/net/hns3/hns3_intr.h b/drivers/net/hns3/hns3_intr.h -index c569a9d..4a0a731 100644 ---- a/drivers/net/hns3/hns3_intr.h -+++ b/drivers/net/hns3/hns3_intr.h -@@ -115,5 +115,7 @@ int hns3_reset_req_hw_reset(struct hns3_adapter *hns); - int hns3_reset_process(struct hns3_adapter *hns, - enum hns3_reset_level reset_level); - void hns3_reset_abort(struct hns3_adapter *hns); -+void hns3_start_report_lse(struct rte_eth_dev *dev); -+void hns3_stop_report_lse(struct rte_eth_dev *dev); - - #endif /* _HNS3_INTR_H_ */ -diff --git a/drivers/net/hns3/hns3_mbx.c b/drivers/net/hns3/hns3_mbx.c -index 7357d7f..ea2953e 100644 ---- a/drivers/net/hns3/hns3_mbx.c -+++ b/drivers/net/hns3/hns3_mbx.c -@@ -177,6 +177,7 @@ hns3_mbx_handler(struct hns3_hw *hw) - { - enum hns3_reset_level reset_level; - uint8_t link_status, link_duplex; -+ uint8_t support_push_lsc; - uint32_t link_speed; - uint16_t *msg_q; - uint8_t opcode; -@@ -196,6 +197,8 @@ hns3_mbx_handler(struct hns3_hw *hw) - link_duplex = (uint8_t)rte_le_to_cpu_16(msg_q[4]); - hns3vf_update_link_status(hw, link_status, link_speed, - link_duplex); -+ support_push_lsc = (*(uint8_t *)&msg_q[5]) & 1u; -+ hns3vf_update_push_lsc_cap(hw, support_push_lsc); - break; - case HNS3_MBX_ASSERTING_RESET: - /* PF has asserted reset hence VF should go in pending --- -2.7.4 - diff --git a/0088-ethdev-simplify-xstats-get-implementation.patch b/0088-ethdev-simplify-xstats-get-implementation.patch new file mode 100644 index 0000000000000000000000000000000000000000..aa8c1976bb8bb96fc16f44ca5b1052b8a2de93b0 --- /dev/null +++ b/0088-ethdev-simplify-xstats-get-implementation.patch @@ -0,0 +1,50 @@ +From a6cce2fd3fb2eda175989fd4a6dbfdd470a08189 Mon Sep 17 00:00:00 2001 +From: Chengwen Feng +Date: Fri, 13 May 2022 10:53:50 +0800 +Subject: [PATCH 088/122] ethdev: simplify xstats get implementation +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Use eth_dev_get_xstats_basic_count() to retrieve generic statistics count. + +Signed-off-by: Chengwen Feng +Acked-by: Morten Brørup +Reviewed-by: Andrew Rybchenko +--- + lib/ethdev/rte_ethdev.c | 11 ++--------- + 1 file changed, 2 insertions(+), 9 deletions(-) + +diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c +index b4a331b671..6110cd1893 100644 +--- a/lib/ethdev/rte_ethdev.c ++++ b/lib/ethdev/rte_ethdev.c +@@ -3313,9 +3313,8 @@ rte_eth_xstats_get(uint16_t port_id, struct rte_eth_xstat *xstats, + unsigned int n) + { + struct rte_eth_dev *dev; +- unsigned int count = 0, i; ++ unsigned int count, i; + signed int xcount = 0; +- uint16_t nb_rxqs, nb_txqs; + int ret; + + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); +@@ -3323,13 +3322,7 @@ rte_eth_xstats_get(uint16_t port_id, struct rte_eth_xstat *xstats, + return -EINVAL; + dev = &rte_eth_devices[port_id]; + +- nb_rxqs = RTE_MIN(dev->data->nb_rx_queues, RTE_ETHDEV_QUEUE_STAT_CNTRS); +- nb_txqs = RTE_MIN(dev->data->nb_tx_queues, RTE_ETHDEV_QUEUE_STAT_CNTRS); +- +- /* Return generic statistics */ +- count = RTE_NB_STATS; +- if (dev->data->dev_flags & RTE_ETH_DEV_AUTOFILL_QUEUE_XSTATS) +- count += (nb_rxqs * RTE_NB_RXQ_STATS) + (nb_txqs * RTE_NB_TXQ_STATS); ++ count = eth_dev_get_xstats_basic_count(dev); + + /* implemented by the driver */ + if (dev->dev_ops->xstats_get != NULL) { +-- +2.22.0 + diff --git a/0088-net-hns3-refactor-PF-LSC-event-report.patch b/0088-net-hns3-refactor-PF-LSC-event-report.patch deleted file mode 100644 index dea3358ad52244065e717b9f5afb22dddebf36a9..0000000000000000000000000000000000000000 --- a/0088-net-hns3-refactor-PF-LSC-event-report.patch +++ /dev/null @@ -1,242 +0,0 @@ -From 4190f95f69d9dde53221a65d44672bc61e100419 Mon Sep 17 00:00:00 2001 -From: Chengwen Feng -Date: Fri, 9 Apr 2021 12:45:22 +0800 -Subject: [PATCH 088/189] net/hns3: refactor PF LSC event report - -Currently, PF driver will report lsc when it detects the link status -change, it's not a generic implementation. - -We refactor PF lsc event report by following scheme: -1. PF driver marks RTE_PCI_DRV_INTR_LSC in rte_pci_driver by default. -2. In the init stage, PF driver will detect whether firmware supports - lsc interrupt or not, driver will clear RTE_ETH_DEV_INTR_LSC flag if - firmware doesn't support lsc interrupt. -3. PF driver will report lsc event only when dev_conf.intr_conf.lsc is - set. - -Note: If the firmware supports lsc interrupt, we also keep periodic -polling to deal with the interrupt loss. - -Signed-off-by: Chengwen Feng -Signed-off-by: Min Hu (Connor) ---- - doc/guides/nics/features/hns3.ini | 1 + - drivers/net/hns3/hns3_ethdev.c | 85 ++++++++++++++++++++++++--------------- - drivers/net/hns3/hns3_ethdev.h | 2 +- - drivers/net/hns3/hns3_mbx.c | 2 +- - 4 files changed, 56 insertions(+), 34 deletions(-) - -diff --git a/doc/guides/nics/features/hns3.ini b/doc/guides/nics/features/hns3.ini -index cc1ad0f..d1a493b 100644 ---- a/doc/guides/nics/features/hns3.ini -+++ b/doc/guides/nics/features/hns3.ini -@@ -5,6 +5,7 @@ - ; - [Features] - Link status = Y -+Link status event = Y - Rx interrupt = Y - Queue start/stop = Y - Runtime Rx queue setup = Y -diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c -index 6f3502f..54c72e9 100644 ---- a/drivers/net/hns3/hns3_ethdev.c -+++ b/drivers/net/hns3/hns3_ethdev.c -@@ -2753,10 +2753,15 @@ static int - hns3_update_port_link_info(struct rte_eth_dev *eth_dev) - { - struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private); -+ int ret; - - (void)hns3_update_link_status(hw); - -- return hns3_update_link_info(eth_dev); -+ ret = hns3_update_link_info(eth_dev); -+ if (ret) -+ hw->mac.link_status = ETH_LINK_DOWN; -+ -+ return ret; - } - - static void -@@ -2807,7 +2812,6 @@ hns3_dev_link_update(struct rte_eth_dev *eth_dev, int wait_to_complete) - do { - ret = hns3_update_port_link_info(eth_dev); - if (ret) { -- mac->link_status = ETH_LINK_DOWN; - hns3_err(hw, "failed to get port link info, ret = %d.", - ret); - break; -@@ -4780,30 +4784,22 @@ hns3_update_link_status(struct hns3_hw *hw) - return false; - } - --/* -- * Current, the PF driver get link status by two ways: -- * 1) Periodic polling in the intr thread context, driver call -- * hns3_update_link_status to update link status. -- * 2) Firmware report async interrupt, driver process the event in the intr -- * thread context, and call hns3_update_link_status to update link status. -- * -- * If detect link status changed, driver need report LSE. One method is add the -- * report LSE logic in hns3_update_link_status. -- * -- * But the PF driver ops(link_update) also call hns3_update_link_status to -- * update link status. -- * If we report LSE in hns3_update_link_status, it may lead to deadlock in the -- * bonding application. -- * -- * So add the one new API which used only in intr thread context. -- */ - void --hns3_update_link_status_and_event(struct hns3_hw *hw) -+hns3_update_linkstatus_and_event(struct hns3_hw *hw, bool query) - { - struct rte_eth_dev *dev = &rte_eth_devices[hw->data->port_id]; -- bool changed = hns3_update_link_status(hw); -- if (changed) -- rte_eth_dev_callback_process(dev, RTE_ETH_EVENT_INTR_LSC, NULL); -+ struct rte_eth_link new_link; -+ int ret; -+ -+ if (query) -+ hns3_update_port_link_info(dev); -+ -+ memset(&new_link, 0, sizeof(new_link)); -+ hns3_setup_linkstatus(dev, &new_link); -+ -+ ret = rte_eth_linkstatus_set(dev, &new_link); -+ if (ret == 0 && dev->data->dev_conf.intr_conf.lsc != 0) -+ hns3_start_report_lse(dev); - } - - static void -@@ -4813,16 +4809,36 @@ hns3_service_handler(void *param) - struct hns3_adapter *hns = eth_dev->data->dev_private; - struct hns3_hw *hw = &hns->hw; - -- if (!hns3_is_reset_pending(hns)) { -- hns3_update_link_status_and_event(hw); -- hns3_update_link_info(eth_dev); -- } else { -+ if (!hns3_is_reset_pending(hns)) -+ hns3_update_linkstatus_and_event(hw, true); -+ else - hns3_warn(hw, "Cancel the query when reset is pending"); -- } - - rte_eal_alarm_set(HNS3_SERVICE_INTERVAL, hns3_service_handler, eth_dev); - } - -+static void -+hns3_update_dev_lsc_cap(struct hns3_hw *hw, -+ int fw_compact_cmd_result) -+{ -+ struct rte_eth_dev *dev = &rte_eth_devices[hw->data->port_id]; -+ -+ if (hw->adapter_state != HNS3_NIC_UNINITIALIZED) -+ return; -+ -+ if (fw_compact_cmd_result != 0) { -+ /* -+ * If fw_compact_cmd_result is not zero, it means firmware don't -+ * support link status change interrupt. -+ * Framework already set RTE_ETH_DEV_INTR_LSC bit because driver -+ * declared RTE_PCI_DRV_INTR_LSC in drv_flags. It need to clear -+ * the RTE_ETH_DEV_INTR_LSC capability when detect firmware -+ * don't support link status change interrupt. -+ */ -+ dev->data->dev_flags &= ~RTE_ETH_DEV_INTR_LSC; -+ } -+} -+ - static int - hns3_init_hardware(struct hns3_adapter *hns) - { -@@ -4910,6 +4926,7 @@ hns3_init_hardware(struct hns3_adapter *hns) - if (ret) - PMD_INIT_LOG(WARNING, "firmware compatible features not " - "supported, ret = %d.", ret); -+ hns3_update_dev_lsc_cap(hw, ret); - - return 0; - -@@ -5302,7 +5319,6 @@ hns3_dev_start(struct rte_eth_dev *dev) - hns3_rx_scattered_calc(dev); - hns3_set_rxtx_function(dev); - hns3_mp_req_start_rxtx(dev); -- rte_eal_alarm_set(HNS3_SERVICE_INTERVAL, hns3_service_handler, dev); - - hns3_restore_filter(dev); - -@@ -5317,6 +5333,10 @@ hns3_dev_start(struct rte_eth_dev *dev) - - hns3_tm_dev_start_proc(hw); - -+ if (dev->data->dev_conf.intr_conf.lsc != 0) -+ hns3_dev_link_update(dev, 0); -+ rte_eal_alarm_set(HNS3_SERVICE_INTERVAL, hns3_service_handler, dev); -+ - hns3_info(hw, "hns3 dev start successful!"); - - return 0; -@@ -5430,6 +5450,7 @@ hns3_dev_stop(struct rte_eth_dev *dev) - } - hns3_rx_scattered_reset(dev); - rte_eal_alarm_cancel(hns3_service_handler, dev); -+ hns3_stop_report_lse(dev); - rte_spinlock_unlock(&hw->lock); - - return 0; -@@ -5933,11 +5954,11 @@ hns3_stop_service(struct hns3_adapter *hns) - struct rte_eth_dev *eth_dev; - - eth_dev = &rte_eth_devices[hw->data->port_id]; -+ hw->mac.link_status = ETH_LINK_DOWN; - if (hw->adapter_state == HNS3_NIC_STARTED) { - rte_eal_alarm_cancel(hns3_service_handler, eth_dev); -- hns3_update_link_status_and_event(hw); -+ hns3_update_linkstatus_and_event(hw, false); - } -- hw->mac.link_status = ETH_LINK_DOWN; - - hns3_set_rxtx_function(eth_dev); - rte_wmb(); -@@ -6939,7 +6960,7 @@ static const struct rte_pci_id pci_id_hns3_map[] = { - - static struct rte_pci_driver rte_hns3_pmd = { - .id_table = pci_id_hns3_map, -- .drv_flags = RTE_PCI_DRV_NEED_MAPPING, -+ .drv_flags = RTE_PCI_DRV_NEED_MAPPING | RTE_PCI_DRV_INTR_LSC, - .probe = eth_hns3_pci_probe, - .remove = eth_hns3_pci_remove, - }; -diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h -index dcf14d6..585eeaf 100644 ---- a/drivers/net/hns3/hns3_ethdev.h -+++ b/drivers/net/hns3/hns3_ethdev.h -@@ -1022,7 +1022,7 @@ int hns3_dev_filter_ctrl(struct rte_eth_dev *dev, - enum rte_filter_op filter_op, void *arg); - bool hns3_is_reset_pending(struct hns3_adapter *hns); - bool hns3vf_is_reset_pending(struct hns3_adapter *hns); --void hns3_update_link_status_and_event(struct hns3_hw *hw); -+void hns3_update_linkstatus_and_event(struct hns3_hw *hw, bool query); - void hns3_ether_format_addr(char *buf, uint16_t size, - const struct rte_ether_addr *ether_addr); - int hns3_dev_infos_get(struct rte_eth_dev *eth_dev, -diff --git a/drivers/net/hns3/hns3_mbx.c b/drivers/net/hns3/hns3_mbx.c -index ea2953e..2a96f6c 100644 ---- a/drivers/net/hns3/hns3_mbx.c -+++ b/drivers/net/hns3/hns3_mbx.c -@@ -287,7 +287,7 @@ hns3_handle_link_change_event(struct hns3_hw *hw, - if (!req->msg[LINK_STATUS_OFFSET]) - hns3_link_fail_parse(hw, req->msg[LINK_FAIL_CODE_OFFSET]); - -- hns3_update_link_status_and_event(hw); -+ hns3_update_linkstatus_and_event(hw, true); - } - - static void --- -2.7.4 - diff --git a/0089-net-hns3-fix-xstats-get-return-if-xstats-is-null.patch b/0089-net-hns3-fix-xstats-get-return-if-xstats-is-null.patch new file mode 100644 index 0000000000000000000000000000000000000000..4060a22ece94ec49822c63bed60ff8c801629499 --- /dev/null +++ b/0089-net-hns3-fix-xstats-get-return-if-xstats-is-null.patch @@ -0,0 +1,58 @@ +From ae08d50d862073a8c53ed7ab4159f3125595667b Mon Sep 17 00:00:00 2001 +From: Chengwen Feng +Date: Fri, 13 May 2022 10:53:51 +0800 +Subject: [PATCH 089/122] net/hns3: fix xstats get return if xstats is null +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Many user (e.g. telemetry) invokes rte_eth_xstats_get(port_id, NULL, 0) +to retrieve the required number of elements, but currently hns3 PMD +returns zero when xstats is null. + +Dedicated check for xstats vs null is not required, since ethdev layer +guarantees that it may be null only if number of entries n is 0 (which +is definitely smaller than total xstats count). + +Fixes: 8839c5e202f3 ("net/hns3: support device stats") +Cc: stable@dpdk.org + +Signed-off-by: Chengwen Feng +Acked-by: Morten Brørup +Reviewed-by: Andrew Rybchenko +--- + drivers/net/hns3/hns3_stats.c | 9 +++++---- + 1 file changed, 5 insertions(+), 4 deletions(-) + +diff --git a/drivers/net/hns3/hns3_stats.c b/drivers/net/hns3/hns3_stats.c +index 9b7ad067aa..e69761c8b3 100644 +--- a/drivers/net/hns3/hns3_stats.c ++++ b/drivers/net/hns3/hns3_stats.c +@@ -1031,9 +1031,13 @@ hns3_imissed_stats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *xstats, + * @praram xstats + * A pointer to a table of structure of type *rte_eth_xstat* + * to be filled with device statistics ids and values. +- * This parameter can be set to NULL if n is 0. ++ * This parameter can be set to NULL if and only if n is 0. + * @param n + * The size of the xstats array (number of elements). ++ * If lower than the required number of elements, the function returns the ++ * required number of elements. ++ * If equal to zero, the xstats parameter must be NULL, the function returns ++ * the required number of elements. + * @return + * 0 on fail, count(The size of the statistics elements) on success. + */ +@@ -1052,9 +1056,6 @@ hns3_dev_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *xstats, + int count; + int ret; + +- if (xstats == NULL) +- return 0; +- + count = hns3_xstats_calc_num(dev); + if ((int)n < count) + return count; +-- +2.22.0 + diff --git a/0089-net-hns3-log-selected-datapath.patch b/0089-net-hns3-log-selected-datapath.patch deleted file mode 100644 index 6f9bb8be2210a85db609d3736dabaa98afccea1b..0000000000000000000000000000000000000000 --- a/0089-net-hns3-log-selected-datapath.patch +++ /dev/null @@ -1,51 +0,0 @@ -From b9cd59d3f64c7a594fa9b7cbaa3907788fe4696f Mon Sep 17 00:00:00 2001 -From: Chengwen Feng -Date: Fri, 9 Apr 2021 18:26:43 +0800 -Subject: [PATCH 089/189] net/hns3: log selected datapath - -This patch adds debug info for Rx/Tx burst function which was choosing. - -Signed-off-by: Chengwen Feng -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_rxtx.c | 17 +++++++++++++++++ - 1 file changed, 17 insertions(+) - -diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c -index b06b723..e81344c 100644 ---- a/drivers/net/hns3/hns3_rxtx.c -+++ b/drivers/net/hns3/hns3_rxtx.c -@@ -4231,6 +4231,22 @@ hns3_dummy_rxtx_burst(void *dpdk_txq __rte_unused, - return 0; - } - -+static void -+hns3_trace_rxtx_function(struct rte_eth_dev *dev) -+{ -+ struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private); -+ struct rte_eth_burst_mode rx_mode; -+ struct rte_eth_burst_mode tx_mode; -+ -+ memset(&rx_mode, 0, sizeof(rx_mode)); -+ memset(&tx_mode, 0, sizeof(tx_mode)); -+ (void)hns3_rx_burst_mode_get(dev, 0, &rx_mode); -+ (void)hns3_tx_burst_mode_get(dev, 0, &tx_mode); -+ -+ hns3_dbg(hw, "using rx_pkt_burst: %s, tx_pkt_burst: %s.", -+ rx_mode.info, tx_mode.info); -+} -+ - void hns3_set_rxtx_function(struct rte_eth_dev *eth_dev) - { - struct hns3_adapter *hns = eth_dev->data->dev_private; -@@ -4243,6 +4259,7 @@ void hns3_set_rxtx_function(struct rte_eth_dev *eth_dev) - eth_dev->tx_pkt_burst = hns3_get_tx_function(eth_dev, &prep); - eth_dev->tx_pkt_prepare = prep; - eth_dev->tx_descriptor_status = hns3_dev_tx_descriptor_status; -+ hns3_trace_rxtx_function(eth_dev); - } else { - eth_dev->rx_pkt_burst = hns3_dummy_rxtx_burst; - eth_dev->tx_pkt_burst = hns3_dummy_rxtx_burst; --- -2.7.4 - diff --git a/0090-net-hns3-simplify-selecting-Rx-Tx-function.patch b/0090-net-hns3-simplify-selecting-Rx-Tx-function.patch deleted file mode 100644 index 9b3dabec43af5e30696e1bbeedec29bd737550b5..0000000000000000000000000000000000000000 --- a/0090-net-hns3-simplify-selecting-Rx-Tx-function.patch +++ /dev/null @@ -1,109 +0,0 @@ -From 2633d60f38e8ce132379c3af0dda026e1812a7a2 Mon Sep 17 00:00:00 2001 -From: Chengwen Feng -Date: Sat, 10 Apr 2021 09:11:14 +0800 -Subject: [PATCH 090/189] net/hns3: simplify selecting Rx/Tx function - -Currently, there are four control variables (rx_simple_allowed, -rx_vec_allowed, tx_simple_allowed and tx_vec_allowed) which are used -to impact the selection of Rx/Tx burst function. - -The purpose of the design is to provide a way to control the selection -of Rx/Tx burst function by modifying it's values, but these variables -have no entry to modify unless make intrusive modifications. - -Now we already support runtime config to select Rx/Tx function, these -variables could be removed. - -Fixes: a124f9e9591b ("net/hns3: add runtime config to select IO burst function") - -Signed-off-by: Chengwen Feng -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_ethdev.c | 5 ----- - drivers/net/hns3/hns3_ethdev.h | 5 ----- - drivers/net/hns3/hns3_ethdev_vf.c | 5 ----- - drivers/net/hns3/hns3_rxtx.c | 11 ++++------- - 4 files changed, 4 insertions(+), 22 deletions(-) - -diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c -index 54c72e9..40af6b8 100644 ---- a/drivers/net/hns3/hns3_ethdev.c -+++ b/drivers/net/hns3/hns3_ethdev.c -@@ -2513,11 +2513,6 @@ hns3_dev_configure(struct rte_eth_dev *dev) - if (ret) - goto cfg_err; - -- hns->rx_simple_allowed = true; -- hns->rx_vec_allowed = true; -- hns->tx_simple_allowed = true; -- hns->tx_vec_allowed = true; -- - hns3_init_rx_ptype_tble(dev); - hw->adapter_state = HNS3_NIC_CONFIGURED; - -diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h -index 585eeaf..cd15bf3 100644 ---- a/drivers/net/hns3/hns3_ethdev.h -+++ b/drivers/net/hns3/hns3_ethdev.h -@@ -795,11 +795,6 @@ struct hns3_adapter { - struct hns3_vf vf; - }; - -- bool rx_simple_allowed; -- bool rx_vec_allowed; -- bool tx_simple_allowed; -- bool tx_vec_allowed; -- - uint32_t rx_func_hint; - uint32_t tx_func_hint; - -diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c -index 13f92da..dd8f248 100644 ---- a/drivers/net/hns3/hns3_ethdev_vf.c -+++ b/drivers/net/hns3/hns3_ethdev_vf.c -@@ -857,11 +857,6 @@ hns3vf_dev_configure(struct rte_eth_dev *dev) - if (ret) - goto cfg_err; - -- hns->rx_simple_allowed = true; -- hns->rx_vec_allowed = true; -- hns->tx_simple_allowed = true; -- hns->tx_vec_allowed = true; -- - hns3_init_rx_ptype_tble(dev); - - hw->adapter_state = HNS3_NIC_CONFIGURED; -diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c -index e81344c..4ea6b8b 100644 ---- a/drivers/net/hns3/hns3_rxtx.c -+++ b/drivers/net/hns3/hns3_rxtx.c -@@ -2805,10 +2805,9 @@ hns3_get_rx_function(struct rte_eth_dev *dev) - uint64_t offloads = dev->data->dev_conf.rxmode.offloads; - bool vec_allowed, sve_allowed, simple_allowed; - -- vec_allowed = hns->rx_vec_allowed && -- hns3_rx_check_vec_support(dev) == 0; -+ vec_allowed = hns3_rx_check_vec_support(dev) == 0; - sve_allowed = vec_allowed && hns3_check_sve_support(); -- simple_allowed = hns->rx_simple_allowed && !dev->data->scattered_rx && -+ simple_allowed = !dev->data->scattered_rx && - (offloads & DEV_RX_OFFLOAD_TCP_LRO) == 0; - - if (hns->rx_func_hint == HNS3_IO_FUNC_HINT_VEC && vec_allowed) -@@ -4195,11 +4194,9 @@ hns3_get_tx_function(struct rte_eth_dev *dev, eth_tx_prep_t *prep) - struct hns3_adapter *hns = dev->data->dev_private; - bool vec_allowed, sve_allowed, simple_allowed; - -- vec_allowed = hns->tx_vec_allowed && -- hns3_tx_check_vec_support(dev) == 0; -+ vec_allowed = hns3_tx_check_vec_support(dev) == 0; - sve_allowed = vec_allowed && hns3_check_sve_support(); -- simple_allowed = hns->tx_simple_allowed && -- hns3_tx_check_simple_support(dev); -+ simple_allowed = hns3_tx_check_simple_support(dev); - - *prep = NULL; - --- -2.7.4 - diff --git a/0090-net-ipn3ke-fix-xstats-get-return-if-xstats-is-null.patch b/0090-net-ipn3ke-fix-xstats-get-return-if-xstats-is-null.patch new file mode 100644 index 0000000000000000000000000000000000000000..c2c40e8677c2a4313168c80aed7d2333fb220d92 --- /dev/null +++ b/0090-net-ipn3ke-fix-xstats-get-return-if-xstats-is-null.patch @@ -0,0 +1,43 @@ +From 15b2772cfbdc62631556222a1c15491125b14e2f Mon Sep 17 00:00:00 2001 +From: Chengwen Feng +Date: Fri, 13 May 2022 10:53:52 +0800 +Subject: [PATCH 090/122] net/ipn3ke: fix xstats get return if xstats is null +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Many user (e.g. telemetry) invokes rte_eth_xstats_get(port_id, NULL, 0) +to retrieve the required number of elements, but currently ipn3ke PMD +returns zero when xstats is null. + +Dedicated check for xstats vs null is not required, since ethdev layer +guarantees that it may be null only if number of entries n is 0 (which +is definitely smaller than total xstats count). + +Fixes: 5a6d883878db ("net/ipn3ke: implement statistics") +Cc: stable@dpdk.org + +Signed-off-by: Chengwen Feng +Acked-by: Morten Brørup +Reviewed-by: Andrew Rybchenko +--- + drivers/net/ipn3ke/ipn3ke_representor.c | 3 --- + 1 file changed, 3 deletions(-) + +diff --git a/drivers/net/ipn3ke/ipn3ke_representor.c b/drivers/net/ipn3ke/ipn3ke_representor.c +index de325c7d29..8139e13a23 100644 +--- a/drivers/net/ipn3ke/ipn3ke_representor.c ++++ b/drivers/net/ipn3ke/ipn3ke_representor.c +@@ -2218,9 +2218,6 @@ ipn3ke_rpst_xstats_get + struct ipn3ke_rpst_hw_port_stats hw_stats; + struct rte_eth_stats stats; + +- if (!xstats) +- return 0; +- + if (!ethdev) { + IPN3KE_AFU_PMD_ERR("ethernet device to get statistics is NULL"); + return -EINVAL; +-- +2.22.0 + diff --git a/0091-net-hns3-fix-rollback-in-PF-init.patch b/0091-net-hns3-fix-rollback-in-PF-init.patch deleted file mode 100644 index c43415d717b003cd75b981d9b512f2247fb63b95..0000000000000000000000000000000000000000 --- a/0091-net-hns3-fix-rollback-in-PF-init.patch +++ /dev/null @@ -1,31 +0,0 @@ -From 396d7c32a45fd944587cec3424a948f0e1b51e2d Mon Sep 17 00:00:00 2001 -From: "Min Hu (Connor)" -Date: Sat, 10 Apr 2021 09:11:15 +0800 -Subject: [PATCH 091/189] net/hns3: fix rollback in PF init - -This patch adds rollback processing when updating imissed -stats failed in PF init. - -Fixes: 3e9f3042d7c8 ("net/hns3: add imissed packet stats") - -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_ethdev.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c -index 40af6b8..c67486c 100644 ---- a/drivers/net/hns3/hns3_ethdev.c -+++ b/drivers/net/hns3/hns3_ethdev.c -@@ -5009,7 +5009,7 @@ hns3_init_pf(struct rte_eth_dev *eth_dev) - ret = hns3_update_imissed_stats(hw, true); - if (ret) { - hns3_err(hw, "clear imissed stats failed, ret = %d", ret); -- return ret; -+ goto err_cmd_init; - } - - hns3_config_all_msix_error(hw, true); --- -2.7.4 - diff --git a/0091-net-mvpp2-fix-xstats-get-return-if-xstats-is-null.patch b/0091-net-mvpp2-fix-xstats-get-return-if-xstats-is-null.patch new file mode 100644 index 0000000000000000000000000000000000000000..43011cf35c53c409840e104423e7375173074956 --- /dev/null +++ b/0091-net-mvpp2-fix-xstats-get-return-if-xstats-is-null.patch @@ -0,0 +1,61 @@ +From ae30c4a7b550e0ac12857279c0a337d80f73261c Mon Sep 17 00:00:00 2001 +From: Chengwen Feng +Date: Fri, 13 May 2022 10:53:53 +0800 +Subject: [PATCH 091/122] net/mvpp2: fix xstats get return if xstats is null +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Many user (e.g. telemetry) invokes rte_eth_xstats_get(port_id, NULL, 0) +to retrieve the required number of elements, but currently mvpp2 PMD +returns zero when xstats is null. + +Remove the logic of "return zero when xstats is NULL", and add the logic +of "return the required number of entries when n is lower than the +required number of entries". + +Fixes: a77b5378cd41 ("net/mrvl: add extended statistics") +Cc: stable@dpdk.org + +Signed-off-by: Chengwen Feng +Acked-by: Morten Brørup +Reviewed-by: Andrew Rybchenko +--- + drivers/net/mvpp2/mrvl_ethdev.c | 11 ++++++----- + 1 file changed, 6 insertions(+), 5 deletions(-) + +diff --git a/drivers/net/mvpp2/mrvl_ethdev.c b/drivers/net/mvpp2/mrvl_ethdev.c +index 9c7fe13f7f..2a8fb6cbce 100644 +--- a/drivers/net/mvpp2/mrvl_ethdev.c ++++ b/drivers/net/mvpp2/mrvl_ethdev.c +@@ -1626,13 +1626,14 @@ mrvl_xstats_get(struct rte_eth_dev *dev, + { + struct mrvl_priv *priv = dev->data->dev_private; + struct pp2_ppio_statistics ppio_stats; +- unsigned int i; ++ unsigned int i, count; + +- if (!stats) +- return 0; ++ count = RTE_DIM(mrvl_xstats_tbl); ++ if (n < count) ++ return count; + + pp2_ppio_get_statistics(priv->ppio, &ppio_stats, 0); +- for (i = 0; i < n && i < RTE_DIM(mrvl_xstats_tbl); i++) { ++ for (i = 0; i < count; i++) { + uint64_t val; + + if (mrvl_xstats_tbl[i].size == sizeof(uint32_t)) +@@ -1648,7 +1649,7 @@ mrvl_xstats_get(struct rte_eth_dev *dev, + stats[i].value = val; + } + +- return n; ++ return count; + } + + /** +-- +2.22.0 + diff --git a/0092-net-axgbe-fix-xstats-get-return-if-xstats-is-null.patch b/0092-net-axgbe-fix-xstats-get-return-if-xstats-is-null.patch new file mode 100644 index 0000000000000000000000000000000000000000..1b1084812c2f9b3b7d3bc65afd8e892db9161d41 --- /dev/null +++ b/0092-net-axgbe-fix-xstats-get-return-if-xstats-is-null.patch @@ -0,0 +1,56 @@ +From fc8702a84b7e794ab95aac021aa2cc3b4c92c5cd Mon Sep 17 00:00:00 2001 +From: Chengwen Feng +Date: Fri, 13 May 2022 10:53:54 +0800 +Subject: [PATCH 092/122] net/axgbe: fix xstats get return if xstats is null +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Many user (e.g. telemetry) invokes rte_eth_xstats_get(port_id, NULL, 0) +to retrieve the required number of elements, but currently axgbe PMD +returns zero when xstats is null. + +Remove the logic of "return zero when xstats is NULL", and add the logic +of "return the required number of entries when n is lower than the +required number of entries". + +Fixes: 9d1ef6b2e731 ("net/axgbe: add xstats") +Cc: stable@dpdk.org + +Signed-off-by: Chengwen Feng +Acked-by: Morten Brørup +Reviewed-by: Andrew Rybchenko +--- + drivers/net/axgbe/axgbe_ethdev.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/drivers/net/axgbe/axgbe_ethdev.c b/drivers/net/axgbe/axgbe_ethdev.c +index 7d40c18a86..b209ab67cf 100644 +--- a/drivers/net/axgbe/axgbe_ethdev.c ++++ b/drivers/net/axgbe/axgbe_ethdev.c +@@ -1009,18 +1009,18 @@ axgbe_dev_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *stats, + struct axgbe_port *pdata = dev->data->dev_private; + unsigned int i; + +- if (!stats) +- return 0; ++ if (n < AXGBE_XSTATS_COUNT) ++ return AXGBE_XSTATS_COUNT; + + axgbe_read_mmc_stats(pdata); + +- for (i = 0; i < n && i < AXGBE_XSTATS_COUNT; i++) { ++ for (i = 0; i < AXGBE_XSTATS_COUNT; i++) { + stats[i].id = i; + stats[i].value = *(u64 *)((uint8_t *)&pdata->mmc_stats + + axgbe_xstats_strings[i].offset); + } + +- return i; ++ return AXGBE_XSTATS_COUNT; + } + + static int +-- +2.22.0 + diff --git a/0092-net-hns3-fix-concurrent-interrupt-handling.patch b/0092-net-hns3-fix-concurrent-interrupt-handling.patch deleted file mode 100644 index 7921d20b0fa7d4da8968b016b91e231d9477f8b7..0000000000000000000000000000000000000000 --- a/0092-net-hns3-fix-concurrent-interrupt-handling.patch +++ /dev/null @@ -1,42 +0,0 @@ -From c7b459449995a35bdb5eac512ce8fb65a28cfe7f Mon Sep 17 00:00:00 2001 -From: Hongbo Zheng -Date: Sat, 10 Apr 2021 09:11:16 +0800 -Subject: [PATCH 092/189] net/hns3: fix concurrent interrupt handling - -Currently, if RAS interrupt and FLR occurred at the same time, FLR will -be detected and corresponding schedule state will be set during RAS -interrupt processing. However, the schedule state value will be -overridden in subsequent RAS processing, resulting in FLR processing -failure. This patch solves this problem. - -Fixes: 2790c6464725 ("net/hns3: support device reset") -Cc: stable@dpdk.org - -Signed-off-by: Hongbo Zheng -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_intr.c | 7 ++++--- - 1 file changed, 4 insertions(+), 3 deletions(-) - -diff --git a/drivers/net/hns3/hns3_intr.c b/drivers/net/hns3/hns3_intr.c -index 6250c36..ccc90c5 100644 ---- a/drivers/net/hns3/hns3_intr.c -+++ b/drivers/net/hns3/hns3_intr.c -@@ -2133,10 +2133,11 @@ hns3_schedule_reset(struct hns3_adapter *hns) - SCHEDULE_REQUESTED) - return; - if (__atomic_load_n(&hw->reset.schedule, __ATOMIC_RELAXED) == -- SCHEDULE_DEFERRED) -+ SCHEDULE_DEFERRED) - rte_eal_alarm_cancel(hw->reset.ops->reset_service, hns); -- __atomic_store_n(&hw->reset.schedule, SCHEDULE_REQUESTED, -- __ATOMIC_RELAXED); -+ else -+ __atomic_store_n(&hw->reset.schedule, SCHEDULE_REQUESTED, -+ __ATOMIC_RELAXED); - - rte_eal_alarm_set(SWITCH_CONTEXT_US, hw->reset.ops->reset_service, hns); - } --- -2.7.4 - diff --git a/0093-ethdev-fix-memory-leak-in-xstats-telemetry.patch b/0093-ethdev-fix-memory-leak-in-xstats-telemetry.patch new file mode 100644 index 0000000000000000000000000000000000000000..0cff404543f410620c918b94021e429e881f9da6 --- /dev/null +++ b/0093-ethdev-fix-memory-leak-in-xstats-telemetry.patch @@ -0,0 +1,35 @@ +From 30aa792dda9b9e361f1d00012304ee78472c80f6 Mon Sep 17 00:00:00 2001 +From: Chengwen Feng +Date: Fri, 13 May 2022 10:53:55 +0800 +Subject: [PATCH 093/122] ethdev: fix memory leak in xstats telemetry +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +The 'eth_xstats' should be freed after telemetry dictionary setup. + +Fixes: c190daedb9b1 ("ethdev: add telemetry callbacks") +Cc: stable@dpdk.org + +Signed-off-by: Chengwen Feng +Acked-by: Morten Brørup +Reviewed-by: Andrew Rybchenko +--- + lib/ethdev/rte_ethdev.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c +index 6110cd1893..1db59d3a0e 100644 +--- a/lib/ethdev/rte_ethdev.c ++++ b/lib/ethdev/rte_ethdev.c +@@ -6259,6 +6259,7 @@ eth_dev_handle_port_xstats(const char *cmd __rte_unused, + for (i = 0; i < num_xstats; i++) + rte_tel_data_add_dict_u64(d, xstat_names[i].name, + eth_xstats[i].value); ++ free(eth_xstats); + return 0; + } + +-- +2.22.0 + diff --git a/0093-net-hns3-fix-some-packet-types.patch b/0093-net-hns3-fix-some-packet-types.patch deleted file mode 100644 index b97d78432fd7003fe297f212837e4392182544cf..0000000000000000000000000000000000000000 --- a/0093-net-hns3-fix-some-packet-types.patch +++ /dev/null @@ -1,177 +0,0 @@ -From 4d90ba638f71a610da429d136fec5f3ebc076f97 Mon Sep 17 00:00:00 2001 -From: Chengwen Feng -Date: Sat, 10 Apr 2021 09:11:17 +0800 -Subject: [PATCH 093/189] net/hns3: fix some packet types - -Currently, the packet type calculated by -vlan/ovlan/l3id/l4id/ol3id/ol4id fields have the following problems: -1) Identify error when exist VLAN strip which will lead to the data - buffer has non VLAN header but mbuf's ptype have L2_ETHER_VLAN flag. -2) Some packet identifies error, eg: hardware report it's RARP or - unknown packet, but ptype will marked with L2_ETHER . - -So driver will calculate packet type only by l3id/l4id/ol3id/ol4id -fields. - -Fixes: 0e98d5e6d9c3 ("net/hns3: fix packet type report in Rx") -Fixes: bba636698316 ("net/hns3: support Rx/Tx and related operations") -Cc: stable@dpdk.org - -Signed-off-by: Chengwen Feng -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_ethdev.h | 4 +-- - drivers/net/hns3/hns3_rxtx.c | 60 +++++++++++++----------------------------- - drivers/net/hns3/hns3_rxtx.h | 14 ++++------ - 3 files changed, 24 insertions(+), 54 deletions(-) - -diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h -index cd15bf3..47d998d 100644 ---- a/drivers/net/hns3/hns3_ethdev.h -+++ b/drivers/net/hns3/hns3_ethdev.h -@@ -682,12 +682,10 @@ struct hns3_ptype_table { - * The next fields used to calc packet-type by the - * L3_ID/L4_ID/OL3_ID/OL4_ID from the Rx descriptor. - */ -- uint32_t l2l3table[HNS3_L2TBL_NUM][HNS3_L3TBL_NUM]; -+ uint32_t l3table[HNS3_L3TBL_NUM]; - uint32_t l4table[HNS3_L4TBL_NUM]; -- uint32_t inner_l2table[HNS3_L2TBL_NUM]; - uint32_t inner_l3table[HNS3_L3TBL_NUM]; - uint32_t inner_l4table[HNS3_L4TBL_NUM]; -- uint32_t ol2table[HNS3_OL2TBL_NUM]; - uint32_t ol3table[HNS3_OL3TBL_NUM]; - uint32_t ol4table[HNS3_OL4TBL_NUM]; - -diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c -index 4ea6b8b..46d6943 100644 ---- a/drivers/net/hns3/hns3_rxtx.c -+++ b/drivers/net/hns3/hns3_rxtx.c -@@ -2003,32 +2003,12 @@ hns3_dev_supported_ptypes_get(struct rte_eth_dev *dev) - static void - hns3_init_non_tunnel_ptype_tbl(struct hns3_ptype_table *tbl) - { -- tbl->l2l3table[0][0] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4; -- tbl->l2l3table[0][1] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6; -- tbl->l2l3table[0][2] = RTE_PTYPE_L2_ETHER_ARP; -- tbl->l2l3table[0][3] = RTE_PTYPE_L2_ETHER; -- tbl->l2l3table[0][4] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT; -- tbl->l2l3table[0][5] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT; -- tbl->l2l3table[0][6] = RTE_PTYPE_L2_ETHER_LLDP; -- tbl->l2l3table[0][15] = RTE_PTYPE_L2_ETHER; -- -- tbl->l2l3table[1][0] = RTE_PTYPE_L2_ETHER_VLAN | RTE_PTYPE_L3_IPV4; -- tbl->l2l3table[1][1] = RTE_PTYPE_L2_ETHER_VLAN | RTE_PTYPE_L3_IPV6; -- tbl->l2l3table[1][2] = RTE_PTYPE_L2_ETHER_ARP; -- tbl->l2l3table[1][3] = RTE_PTYPE_L2_ETHER_VLAN; -- tbl->l2l3table[1][4] = RTE_PTYPE_L2_ETHER_VLAN | RTE_PTYPE_L3_IPV4_EXT; -- tbl->l2l3table[1][5] = RTE_PTYPE_L2_ETHER_VLAN | RTE_PTYPE_L3_IPV6_EXT; -- tbl->l2l3table[1][6] = RTE_PTYPE_L2_ETHER_LLDP; -- tbl->l2l3table[1][15] = RTE_PTYPE_L2_ETHER_VLAN; -- -- tbl->l2l3table[2][0] = RTE_PTYPE_L2_ETHER_QINQ | RTE_PTYPE_L3_IPV4; -- tbl->l2l3table[2][1] = RTE_PTYPE_L2_ETHER_QINQ | RTE_PTYPE_L3_IPV6; -- tbl->l2l3table[2][2] = RTE_PTYPE_L2_ETHER_ARP; -- tbl->l2l3table[2][3] = RTE_PTYPE_L2_ETHER_QINQ; -- tbl->l2l3table[2][4] = RTE_PTYPE_L2_ETHER_QINQ | RTE_PTYPE_L3_IPV4_EXT; -- tbl->l2l3table[2][5] = RTE_PTYPE_L2_ETHER_QINQ | RTE_PTYPE_L3_IPV6_EXT; -- tbl->l2l3table[2][6] = RTE_PTYPE_L2_ETHER_LLDP; -- tbl->l2l3table[2][15] = RTE_PTYPE_L2_ETHER_QINQ; -+ tbl->l3table[0] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4; -+ tbl->l3table[1] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6; -+ tbl->l3table[2] = RTE_PTYPE_L2_ETHER_ARP; -+ tbl->l3table[4] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT; -+ tbl->l3table[5] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT; -+ tbl->l3table[6] = RTE_PTYPE_L2_ETHER_LLDP; - - tbl->l4table[0] = RTE_PTYPE_L4_UDP; - tbl->l4table[1] = RTE_PTYPE_L4_TCP; -@@ -2041,17 +2021,17 @@ hns3_init_non_tunnel_ptype_tbl(struct hns3_ptype_table *tbl) - static void - hns3_init_tunnel_ptype_tbl(struct hns3_ptype_table *tbl) - { -- tbl->inner_l2table[0] = RTE_PTYPE_INNER_L2_ETHER; -- tbl->inner_l2table[1] = RTE_PTYPE_INNER_L2_ETHER_VLAN; -- tbl->inner_l2table[2] = RTE_PTYPE_INNER_L2_ETHER_QINQ; -- -- tbl->inner_l3table[0] = RTE_PTYPE_INNER_L3_IPV4; -- tbl->inner_l3table[1] = RTE_PTYPE_INNER_L3_IPV6; -+ tbl->inner_l3table[0] = RTE_PTYPE_INNER_L2_ETHER | -+ RTE_PTYPE_INNER_L3_IPV4; -+ tbl->inner_l3table[1] = RTE_PTYPE_INNER_L2_ETHER | -+ RTE_PTYPE_INNER_L3_IPV6; - /* There is not a ptype for inner ARP/RARP */ - tbl->inner_l3table[2] = RTE_PTYPE_UNKNOWN; - tbl->inner_l3table[3] = RTE_PTYPE_UNKNOWN; -- tbl->inner_l3table[4] = RTE_PTYPE_INNER_L3_IPV4_EXT; -- tbl->inner_l3table[5] = RTE_PTYPE_INNER_L3_IPV6_EXT; -+ tbl->inner_l3table[4] = RTE_PTYPE_INNER_L2_ETHER | -+ RTE_PTYPE_INNER_L3_IPV4_EXT; -+ tbl->inner_l3table[5] = RTE_PTYPE_INNER_L2_ETHER | -+ RTE_PTYPE_INNER_L3_IPV6_EXT; - - tbl->inner_l4table[0] = RTE_PTYPE_INNER_L4_UDP; - tbl->inner_l4table[1] = RTE_PTYPE_INNER_L4_TCP; -@@ -2062,16 +2042,12 @@ hns3_init_tunnel_ptype_tbl(struct hns3_ptype_table *tbl) - tbl->inner_l4table[4] = RTE_PTYPE_UNKNOWN; - tbl->inner_l4table[5] = RTE_PTYPE_INNER_L4_ICMP; - -- tbl->ol2table[0] = RTE_PTYPE_L2_ETHER; -- tbl->ol2table[1] = RTE_PTYPE_L2_ETHER_VLAN; -- tbl->ol2table[2] = RTE_PTYPE_L2_ETHER_QINQ; -- -- tbl->ol3table[0] = RTE_PTYPE_L3_IPV4; -- tbl->ol3table[1] = RTE_PTYPE_L3_IPV6; -+ tbl->ol3table[0] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4; -+ tbl->ol3table[1] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6; - tbl->ol3table[2] = RTE_PTYPE_UNKNOWN; - tbl->ol3table[3] = RTE_PTYPE_UNKNOWN; -- tbl->ol3table[4] = RTE_PTYPE_L3_IPV4_EXT; -- tbl->ol3table[5] = RTE_PTYPE_L3_IPV6_EXT; -+ tbl->ol3table[4] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT; -+ tbl->ol3table[5] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT; - - tbl->ol4table[0] = RTE_PTYPE_UNKNOWN; - tbl->ol4table[1] = RTE_PTYPE_TUNNEL_VXLAN; -diff --git a/drivers/net/hns3/hns3_rxtx.h b/drivers/net/hns3/hns3_rxtx.h -index eebbebf..44d0ca7 100644 ---- a/drivers/net/hns3/hns3_rxtx.h -+++ b/drivers/net/hns3/hns3_rxtx.h -@@ -635,8 +635,8 @@ hns3_rx_calc_ptype(struct hns3_rx_queue *rxq, const uint32_t l234_info, - const uint32_t ol_info) - { - const struct hns3_ptype_table * const ptype_tbl = rxq->ptype_tbl; -- uint32_t l2id, l3id, l4id; -- uint32_t ol3id, ol4id, ol2id; -+ uint32_t ol3id, ol4id; -+ uint32_t l3id, l4id; - uint32_t ptype; - - if (rxq->ptype_en) { -@@ -647,20 +647,16 @@ hns3_rx_calc_ptype(struct hns3_rx_queue *rxq, const uint32_t l234_info, - - ol4id = hns3_get_field(ol_info, HNS3_RXD_OL4ID_M, HNS3_RXD_OL4ID_S); - ol3id = hns3_get_field(ol_info, HNS3_RXD_OL3ID_M, HNS3_RXD_OL3ID_S); -- ol2id = hns3_get_field(ol_info, HNS3_RXD_OVLAN_M, HNS3_RXD_OVLAN_S); -- l2id = hns3_get_field(l234_info, HNS3_RXD_VLAN_M, HNS3_RXD_VLAN_S); - l3id = hns3_get_field(l234_info, HNS3_RXD_L3ID_M, HNS3_RXD_L3ID_S); - l4id = hns3_get_field(l234_info, HNS3_RXD_L4ID_M, HNS3_RXD_L4ID_S); - - if (unlikely(ptype_tbl->ol4table[ol4id])) -- return ptype_tbl->inner_l2table[l2id] | -- ptype_tbl->inner_l3table[l3id] | -+ return ptype_tbl->inner_l3table[l3id] | - ptype_tbl->inner_l4table[l4id] | - ptype_tbl->ol3table[ol3id] | -- ptype_tbl->ol4table[ol4id] | ptype_tbl->ol2table[ol2id]; -+ ptype_tbl->ol4table[ol4id]; - else -- return ptype_tbl->l2l3table[l2id][l3id] | -- ptype_tbl->l4table[l4id]; -+ return ptype_tbl->l3table[l3id] | ptype_tbl->l4table[l4id]; - } - - void hns3_dev_rx_queue_release(void *queue); --- -2.7.4 - diff --git a/0094-ethdev-fix-possible-null-pointer-access.patch b/0094-ethdev-fix-possible-null-pointer-access.patch new file mode 100644 index 0000000000000000000000000000000000000000..977060cadea5524d335bead120b8237098653e53 --- /dev/null +++ b/0094-ethdev-fix-possible-null-pointer-access.patch @@ -0,0 +1,37 @@ +From bfe03dd331bcfda1ab9fcbe32305eb515b5d7e32 Mon Sep 17 00:00:00 2001 +From: Chengwen Feng +Date: Fri, 13 May 2022 10:53:56 +0800 +Subject: [PATCH 094/122] ethdev: fix possible null pointer access +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +The rte_tel_data_alloc() may return NULL, so the caller should add +judgement for it. + +Fixes: 083b0b310b19 ("ethdev: add common stats for telemetry") +Cc: stable@dpdk.org + +Signed-off-by: Chengwen Feng +Acked-by: Morten Brørup +Reviewed-by: Andrew Rybchenko +--- + lib/ethdev/rte_ethdev.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c +index 1db59d3a0e..e55d11937e 100644 +--- a/lib/ethdev/rte_ethdev.c ++++ b/lib/ethdev/rte_ethdev.c +@@ -6166,6 +6166,8 @@ eth_dev_add_port_queue_stats(struct rte_tel_data *d, uint64_t *q_stats, + { + int q; + struct rte_tel_data *q_data = rte_tel_data_alloc(); ++ if (q_data == NULL) ++ return; + rte_tel_data_start_array(q_data, RTE_TEL_U64_VAL); + for (q = 0; q < RTE_ETHDEV_QUEUE_STAT_CNTRS; q++) + rte_tel_data_add_array_u64(q_data, q_stats[q]); +-- +2.22.0 + diff --git a/0094-net-hns3-fix-timing-in-resetting-queues.patch b/0094-net-hns3-fix-timing-in-resetting-queues.patch deleted file mode 100644 index 21cf73d4b6313904212bd4863786c7d9f2ea57d5..0000000000000000000000000000000000000000 --- a/0094-net-hns3-fix-timing-in-resetting-queues.patch +++ /dev/null @@ -1,63 +0,0 @@ -From b4cc7885926cc27da1934c457e4d3ebb43926056 Mon Sep 17 00:00:00 2001 -From: Chengchang Tang -Date: Sat, 10 Apr 2021 09:11:18 +0800 -Subject: [PATCH 094/189] net/hns3: fix timing in resetting queues - -During the task queue pairs reset, the getimeofday is used to obtain the -timestamp to determine whether the command execution times out. But -gettimeofday is not monotonous, it can be modified by system -administrators, so the timing may not be accurate or even cause the loop -to wait consistently. -And actually, in this scenario, it is not necessary to obtain the -timestamp. - -This patch removes the operation of obtaining the timestamp from the task -queue pairs reset function. - -Fixes: bba636698316 ("net/hns3: support Rx/Tx and related operations") -Cc: stable@dpdk.org - -Signed-off-by: Chengchang Tang -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_rxtx.c | 7 ++++--- - 1 file changed, 4 insertions(+), 3 deletions(-) - -diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c -index 46d6943..b864350 100644 ---- a/drivers/net/hns3/hns3_rxtx.c -+++ b/drivers/net/hns3/hns3_rxtx.c -@@ -625,8 +625,8 @@ static int - hns3pf_reset_tqp(struct hns3_hw *hw, uint16_t queue_id) - { - #define HNS3_TQP_RESET_TRY_MS 200 -+ uint16_t wait_time = 0; - uint8_t reset_status; -- uint64_t end; - int ret; - - /* -@@ -639,17 +639,18 @@ hns3pf_reset_tqp(struct hns3_hw *hw, uint16_t queue_id) - hns3_err(hw, "Send reset tqp cmd fail, ret = %d", ret); - return ret; - } -- end = get_timeofday_ms() + HNS3_TQP_RESET_TRY_MS; -+ - do { - /* Wait for tqp hw reset */ - rte_delay_ms(HNS3_POLL_RESPONE_MS); -+ wait_time += HNS3_POLL_RESPONE_MS; - ret = hns3_get_tqp_reset_status(hw, queue_id, &reset_status); - if (ret) - goto tqp_reset_fail; - - if (reset_status) - break; -- } while (get_timeofday_ms() < end); -+ } while (wait_time < HNS3_TQP_RESET_TRY_MS); - - if (!reset_status) { - ret = -ETIMEDOUT; --- -2.7.4 - diff --git a/0095-net-cnxk-fix-possible-null-dereference-in-telemetry.patch b/0095-net-cnxk-fix-possible-null-dereference-in-telemetry.patch new file mode 100644 index 0000000000000000000000000000000000000000..6147c58d9fdee631380c713a38492c640eb93d9b --- /dev/null +++ b/0095-net-cnxk-fix-possible-null-dereference-in-telemetry.patch @@ -0,0 +1,37 @@ +From d3078f7a0fe21d94fa8d6027f2541311a990585a Mon Sep 17 00:00:00 2001 +From: Chengwen Feng +Date: Fri, 13 May 2022 10:53:57 +0800 +Subject: [PATCH 095/122] net/cnxk: fix possible null dereference in telemetry +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +The return value of rte_tel_data_alloc() may be null pointer. +Add missing check vs null. + +Fixes: 5ea354a1f2cc ("net/cnxk: support telemetry") +Cc: stable@dpdk.org + +Signed-off-by: Chengwen Feng +Acked-by: Morten Brørup +Reviewed-by: Andrew Rybchenko +--- + drivers/net/cnxk/cnxk_ethdev_telemetry.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/net/cnxk/cnxk_ethdev_telemetry.c b/drivers/net/cnxk/cnxk_ethdev_telemetry.c +index 83bc65848c..4fd9048643 100644 +--- a/drivers/net/cnxk/cnxk_ethdev_telemetry.c ++++ b/drivers/net/cnxk/cnxk_ethdev_telemetry.c +@@ -49,6 +49,8 @@ ethdev_tel_handle_info(const char *cmd __rte_unused, + rte_tel_data_add_dict_int(d, "n_ports", n_ports); + + i_data = rte_tel_data_alloc(); ++ if (i_data == NULL) ++ return -ENOMEM; + rte_tel_data_start_array(i_data, RTE_TEL_U64_VAL); + + for (i = 0; i < RTE_MAX_ETHPORTS; i++) { +-- +2.22.0 + diff --git a/0095-net-hns3-fix-queue-state-when-concurrent-with-reset.patch b/0095-net-hns3-fix-queue-state-when-concurrent-with-reset.patch deleted file mode 100644 index f2917977fee1b776b3bae7ca603730b5f00ec9b9..0000000000000000000000000000000000000000 --- a/0095-net-hns3-fix-queue-state-when-concurrent-with-reset.patch +++ /dev/null @@ -1,108 +0,0 @@ -From 94765554f123475e03c5900686b19c2227ce05ad Mon Sep 17 00:00:00 2001 -From: Chengchang Tang -Date: Sat, 10 Apr 2021 09:11:19 +0800 -Subject: [PATCH 095/189] net/hns3: fix queue state when concurrent with reset - -At the end of the reset, the state of queues need to be restored -according to the states saved in the driver. If the start and stop -operations of the queues are concurrent at this time, it may cause the -final status to be uncertain. - -This patch requires queues to acquire the hw lock before starting and -stopping. If the device is being restored due to reset at this time, it -will block until the reset is completed. - -Fixes: fa29fe45a7b4 ("net/hns3: support queue start and stop") -Cc: stable@dpdk.org - -Signed-off-by: Chengchang Tang -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_rxtx.c | 11 +++++++++++ - 1 file changed, 11 insertions(+) - -diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c -index b864350..cbcfb0b 100644 ---- a/drivers/net/hns3/hns3_rxtx.c -+++ b/drivers/net/hns3/hns3_rxtx.c -@@ -4287,10 +4287,12 @@ hns3_dev_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id) - if (!hns3_dev_indep_txrx_supported(hw)) - return -ENOTSUP; - -+ rte_spinlock_lock(&hw->lock); - ret = hns3_reset_queue(hw, rx_queue_id, HNS3_RING_TYPE_RX); - if (ret) { - hns3_err(hw, "fail to reset Rx queue %u, ret = %d.", - rx_queue_id, ret); -+ rte_spinlock_unlock(&hw->lock); - return ret; - } - -@@ -4298,11 +4300,13 @@ hns3_dev_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id) - if (ret) { - hns3_err(hw, "fail to init Rx queue %u, ret = %d.", - rx_queue_id, ret); -+ rte_spinlock_unlock(&hw->lock); - return ret; - } - - hns3_enable_rxq(rxq, true); - dev->data->rx_queue_state[rx_queue_id] = RTE_ETH_QUEUE_STATE_STARTED; -+ rte_spinlock_unlock(&hw->lock); - - return ret; - } -@@ -4329,12 +4333,14 @@ hns3_dev_rx_queue_stop(struct rte_eth_dev *dev, uint16_t rx_queue_id) - if (!hns3_dev_indep_txrx_supported(hw)) - return -ENOTSUP; - -+ rte_spinlock_lock(&hw->lock); - hns3_enable_rxq(rxq, false); - - hns3_rx_queue_release_mbufs(rxq); - - hns3_reset_sw_rxq(rxq); - dev->data->rx_queue_state[rx_queue_id] = RTE_ETH_QUEUE_STATE_STOPPED; -+ rte_spinlock_unlock(&hw->lock); - - return 0; - } -@@ -4349,16 +4355,19 @@ hns3_dev_tx_queue_start(struct rte_eth_dev *dev, uint16_t tx_queue_id) - if (!hns3_dev_indep_txrx_supported(hw)) - return -ENOTSUP; - -+ rte_spinlock_lock(&hw->lock); - ret = hns3_reset_queue(hw, tx_queue_id, HNS3_RING_TYPE_TX); - if (ret) { - hns3_err(hw, "fail to reset Tx queue %u, ret = %d.", - tx_queue_id, ret); -+ rte_spinlock_unlock(&hw->lock); - return ret; - } - - hns3_init_txq(txq); - hns3_enable_txq(txq, true); - dev->data->tx_queue_state[tx_queue_id] = RTE_ETH_QUEUE_STATE_STARTED; -+ rte_spinlock_unlock(&hw->lock); - - return ret; - } -@@ -4372,6 +4381,7 @@ hns3_dev_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id) - if (!hns3_dev_indep_txrx_supported(hw)) - return -ENOTSUP; - -+ rte_spinlock_lock(&hw->lock); - hns3_enable_txq(txq, false); - hns3_tx_queue_release_mbufs(txq); - /* -@@ -4383,6 +4393,7 @@ hns3_dev_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id) - */ - hns3_init_txq(txq); - dev->data->tx_queue_state[tx_queue_id] = RTE_ETH_QUEUE_STATE_STOPPED; -+ rte_spinlock_unlock(&hw->lock); - - return 0; - } --- -2.7.4 - diff --git a/0096-net-bonding-fix-mbuf-fast-free-usage.patch b/0096-net-bonding-fix-mbuf-fast-free-usage.patch new file mode 100644 index 0000000000000000000000000000000000000000..5c76dd74db33e42d4cffcc76ce5621acbb424032 --- /dev/null +++ b/0096-net-bonding-fix-mbuf-fast-free-usage.patch @@ -0,0 +1,57 @@ +From 77eaa2e2b5ae1651abdaa0fb885bc3971e9e0587 Mon Sep 17 00:00:00 2001 +From: "Min Hu (Connor)" +Date: Wed, 25 May 2022 09:08:28 +0800 +Subject: [PATCH 096/122] net/bonding: fix mbuf fast free usage + +Usage of 'RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE' offload has two +constraints: per-queue all mbufs comes from the same mempool and +has refcnt = 1. + +Bonding mode Broadcast, Tx mbuf has more than one refcnt. +Bonding mode 8023AD, It contains two mempools separately for LACP +packets and other packets. In Tx or Rx, Fast mbuf free will operate +mbuf from different mempool. + +This patch will prevent 'RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE' offload +when in bonding mode Broadcast and mode 8023AD. + +Fixes: 78aecefed955 ("bond: move param parsing in configure step") +Cc: stable@dpdk.org + +Signed-off-by: Min Hu (Connor) +--- + drivers/net/bonding/rte_eth_bond_pmd.c | 11 +++++++++++ + 1 file changed, 11 insertions(+) + +diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c +index c929b55768..0d6f0a30d1 100644 +--- a/drivers/net/bonding/rte_eth_bond_pmd.c ++++ b/drivers/net/bonding/rte_eth_bond_pmd.c +@@ -3563,6 +3563,7 @@ bond_ethdev_configure(struct rte_eth_dev *dev) + const char *name = dev->device->name; + struct bond_dev_private *internals = dev->data->dev_private; + struct rte_kvargs *kvlist = internals->kvlist; ++ uint64_t offloads; + int arg_count; + uint16_t port_id = dev - rte_eth_devices; + uint8_t agg_mode; +@@ -3613,6 +3614,16 @@ bond_ethdev_configure(struct rte_eth_dev *dev) + } + } + ++ offloads = dev->data->dev_conf.txmode.offloads; ++ if ((offloads & RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE) && ++ (internals->mode == BONDING_MODE_8023AD || ++ internals->mode == BONDING_MODE_BROADCAST)) { ++ RTE_BOND_LOG(WARNING, ++ "bond mode broadcast & 8023AD don't support MBUF_FAST_FREE offload, force disable it."); ++ offloads &= ~RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE; ++ dev->data->dev_conf.txmode.offloads = offloads; ++ } ++ + /* set the max_rx_pktlen */ + internals->max_rx_pktlen = internals->candidate_max_rx_pktlen; + +-- +2.22.0 + diff --git a/0096-net-hns3-fix-configure-FEC-when-concurrent-with-rese.patch b/0096-net-hns3-fix-configure-FEC-when-concurrent-with-rese.patch deleted file mode 100644 index 06ed0bd7a5df1a87e83609fbf388e28b37f6ac33..0000000000000000000000000000000000000000 --- a/0096-net-hns3-fix-configure-FEC-when-concurrent-with-rese.patch +++ /dev/null @@ -1,48 +0,0 @@ -From 755d92e8a3c3327632dc9e6f74fb7f07b4073a3e Mon Sep 17 00:00:00 2001 -From: Chengchang Tang -Date: Sat, 10 Apr 2021 09:11:20 +0800 -Subject: [PATCH 096/189] net/hns3: fix configure FEC when concurrent with - reset - -Currently, after the reset is complete, the PMD restores the FEC -according to the FEC configuration reserved in the driver. If there is a -concurrency between the FEC setup operation and the restore operation -after a reset, the FEC status of the last hardware may be unknown. - -This patch adds the step of obtaining the lock when setting the FEC to -avoid concurrency between restore operation and setting operation. - -Fixes: 9bf2ea8dbc65 ("net/hns3: support FEC") -Cc: stable@dpdk.org - -Signed-off-by: Chengchang Tang -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_ethdev.c | 7 ++++++- - 1 file changed, 6 insertions(+), 1 deletion(-) - -diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c -index c67486c..85e54ae 100644 ---- a/drivers/net/hns3/hns3_ethdev.c -+++ b/drivers/net/hns3/hns3_ethdev.c -@@ -6433,11 +6433,16 @@ hns3_fec_set(struct rte_eth_dev *dev, uint32_t mode) - return -EINVAL; - } - -+ rte_spinlock_lock(&hw->lock); - ret = hns3_set_fec_hw(hw, mode); -- if (ret) -+ if (ret) { -+ rte_spinlock_unlock(&hw->lock); - return ret; -+ } - - pf->fec_mode = mode; -+ rte_spinlock_unlock(&hw->lock); -+ - return 0; - } - --- -2.7.4 - diff --git a/0097-ethdev-fix-port-state-when-stop.patch b/0097-ethdev-fix-port-state-when-stop.patch new file mode 100644 index 0000000000000000000000000000000000000000..6e952a7db3db0988abdc1deab2791be459b17fb9 --- /dev/null +++ b/0097-ethdev-fix-port-state-when-stop.patch @@ -0,0 +1,36 @@ +From df393a512efe98bffa9b872844ea999507e51fba Mon Sep 17 00:00:00 2001 +From: "Min Hu (Connor)" +Date: Tue, 3 May 2022 18:02:17 +0800 +Subject: [PATCH 097/122] ethdev: fix port state when stop + +Currently, 'dev_started' is always set to be 0 when dev stop, whether +it succeeded or failed. This is unreasonable and this patch fixed it. + +Fixes: 62024eb82756 ("ethdev: change stop operation callback to return int") +Cc: stable@dpdk.org + +Signed-off-by: Min Hu (Connor) +Acked-by: Thomas Monjalon +Acked-by: Ferruh Yigit +--- + lib/ethdev/rte_ethdev.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c +index e55d11937e..2671f47738 100644 +--- a/lib/ethdev/rte_ethdev.c ++++ b/lib/ethdev/rte_ethdev.c +@@ -1879,8 +1879,9 @@ rte_eth_dev_stop(uint16_t port_id) + /* point fast-path functions to dummy ones */ + eth_dev_fp_ops_reset(rte_eth_fp_ops + port_id); + +- dev->data->dev_started = 0; + ret = (*dev->dev_ops->dev_stop)(dev); ++ if (ret == 0) ++ dev->data->dev_started = 0; + rte_ethdev_trace_stop(port_id, ret); + + return ret; +-- +2.22.0 + diff --git a/0097-net-hns3-delete-mailbox-arq-ring.patch b/0097-net-hns3-delete-mailbox-arq-ring.patch deleted file mode 100644 index ad2550cc41272089ed904ad463052b58aa447a91..0000000000000000000000000000000000000000 --- a/0097-net-hns3-delete-mailbox-arq-ring.patch +++ /dev/null @@ -1,197 +0,0 @@ -From b46465d9deb6c1e0ef26cc53f4050cb7f6322d56 Mon Sep 17 00:00:00 2001 -From: Chengwen Feng -Date: Tue, 13 Apr 2021 19:50:00 +0800 -Subject: [PATCH 097/189] net/hns3: delete mailbox arq ring - -Currently, driver will copy mailbox messages body into arq ring when -process HNS3_MBX_LINK_STAT_CHANGE and HNS3_MBX_LINK_STAT_CHANGE -message, and then call hns3_mbx_handler API which will direct process -pre-copy messages. In the whole process, the arq ring don't have a -substantial effect. - -Note: The arq ring is designed for kernel environment which could not -do much job in interrupt context, but for DPDK it's not required. - -Also we rename hns3_handle_link_change_event to -hns3pf_handle_link_change_event which add 'pf' suffix to make it -better to distinguish. - -Fixes: 463e748964f5 ("net/hns3: support mailbox") -Cc: stable@dpdk.org - -Signed-off-by: Chengwen Feng -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_ethdev.h | 1 - - drivers/net/hns3/hns3_mbx.c | 83 +++++++++++++++++------------------------- - drivers/net/hns3/hns3_mbx.h | 14 ------- - 3 files changed, 33 insertions(+), 65 deletions(-) - -diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h -index 47d998d..1763cc9 100644 ---- a/drivers/net/hns3/hns3_ethdev.h -+++ b/drivers/net/hns3/hns3_ethdev.h -@@ -438,7 +438,6 @@ struct hns3_hw { - uint8_t revision; /* PCI revision, low byte of class word */ - struct hns3_cmq cmq; - struct hns3_mbx_resp_status mbx_resp; /* mailbox response */ -- struct hns3_mbx_arq_ring arq; /* mailbox async rx queue */ - struct hns3_mac mac; - unsigned int secondary_cnt; /* Number of secondary processes init'd. */ - struct hns3_tqp_stats tqp_stats; -diff --git a/drivers/net/hns3/hns3_mbx.c b/drivers/net/hns3/hns3_mbx.c -index 2a96f6c..6768207 100644 ---- a/drivers/net/hns3/hns3_mbx.c -+++ b/drivers/net/hns3/hns3_mbx.c -@@ -173,55 +173,42 @@ hns3_cmd_crq_empty(struct hns3_hw *hw) - } - - static void --hns3_mbx_handler(struct hns3_hw *hw) -+hns3vf_handle_link_change_event(struct hns3_hw *hw, -+ struct hns3_mbx_pf_to_vf_cmd *req) - { -- enum hns3_reset_level reset_level; - uint8_t link_status, link_duplex; -+ uint16_t *msg_q = req->msg; - uint8_t support_push_lsc; - uint32_t link_speed; -- uint16_t *msg_q; -- uint8_t opcode; -- uint32_t tail; - -- tail = hw->arq.tail; -- -- /* process all the async queue messages */ -- while (tail != hw->arq.head) { -- msg_q = hw->arq.msg_q[hw->arq.head]; -+ memcpy(&link_speed, &msg_q[2], sizeof(link_speed)); -+ link_status = rte_le_to_cpu_16(msg_q[1]); -+ link_duplex = (uint8_t)rte_le_to_cpu_16(msg_q[4]); -+ hns3vf_update_link_status(hw, link_status, link_speed, -+ link_duplex); -+ support_push_lsc = (*(uint8_t *)&msg_q[5]) & 1u; -+ hns3vf_update_push_lsc_cap(hw, support_push_lsc); -+} - -- opcode = msg_q[0] & 0xff; -- switch (opcode) { -- case HNS3_MBX_LINK_STAT_CHANGE: -- memcpy(&link_speed, &msg_q[2], sizeof(link_speed)); -- link_status = rte_le_to_cpu_16(msg_q[1]); -- link_duplex = (uint8_t)rte_le_to_cpu_16(msg_q[4]); -- hns3vf_update_link_status(hw, link_status, link_speed, -- link_duplex); -- support_push_lsc = (*(uint8_t *)&msg_q[5]) & 1u; -- hns3vf_update_push_lsc_cap(hw, support_push_lsc); -- break; -- case HNS3_MBX_ASSERTING_RESET: -- /* PF has asserted reset hence VF should go in pending -- * state and poll for the hardware reset status till it -- * has been completely reset. After this stack should -- * eventually be re-initialized. -- */ -- reset_level = rte_le_to_cpu_16(msg_q[1]); -- hns3_atomic_set_bit(reset_level, &hw->reset.pending); -+static void -+hns3_handle_asserting_reset(struct hns3_hw *hw, -+ struct hns3_mbx_pf_to_vf_cmd *req) -+{ -+ enum hns3_reset_level reset_level; -+ uint16_t *msg_q = req->msg; - -- hns3_warn(hw, "PF inform reset level %d", reset_level); -- hw->reset.stats.request_cnt++; -- hns3_schedule_reset(HNS3_DEV_HW_TO_ADAPTER(hw)); -- break; -- default: -- hns3_err(hw, "Fetched unsupported(%u) message from arq", -- opcode); -- break; -- } -+ /* -+ * PF has asserted reset hence VF should go in pending -+ * state and poll for the hardware reset status till it -+ * has been completely reset. After this stack should -+ * eventually be re-initialized. -+ */ -+ reset_level = rte_le_to_cpu_16(msg_q[1]); -+ hns3_atomic_set_bit(reset_level, &hw->reset.pending); - -- hns3_mbx_head_ptr_move_arq(hw->arq); -- msg_q = hw->arq.msg_q[hw->arq.head]; -- } -+ hns3_warn(hw, "PF inform reset level %d", reset_level); -+ hw->reset.stats.request_cnt++; -+ hns3_schedule_reset(HNS3_DEV_HW_TO_ADAPTER(hw)); - } - - /* -@@ -278,7 +265,7 @@ hns3_link_fail_parse(struct hns3_hw *hw, uint8_t link_fail_code) - } - - static void --hns3_handle_link_change_event(struct hns3_hw *hw, -+hns3pf_handle_link_change_event(struct hns3_hw *hw, - struct hns3_mbx_pf_to_vf_cmd *req) - { - #define LINK_STATUS_OFFSET 1 -@@ -337,7 +324,6 @@ hns3_dev_handle_mbx_msg(struct hns3_hw *hw) - struct hns3_mbx_pf_to_vf_cmd *req; - struct hns3_cmd_desc *desc; - uint32_t msg_data; -- uint16_t *msg_q; - uint8_t opcode; - uint16_t flag; - uint8_t *temp; -@@ -380,16 +366,13 @@ hns3_dev_handle_mbx_msg(struct hns3_hw *hw) - hns3_update_resp_position(hw, msg_data); - break; - case HNS3_MBX_LINK_STAT_CHANGE: -+ hns3vf_handle_link_change_event(hw, req); -+ break; - case HNS3_MBX_ASSERTING_RESET: -- msg_q = hw->arq.msg_q[hw->arq.tail]; -- memcpy(&msg_q[0], req->msg, -- HNS3_MBX_MAX_ARQ_MSG_SIZE * sizeof(uint16_t)); -- hns3_mbx_tail_ptr_move_arq(hw->arq); -- -- hns3_mbx_handler(hw); -+ hns3_handle_asserting_reset(hw, req); - break; - case HNS3_MBX_PUSH_LINK_STATUS: -- hns3_handle_link_change_event(hw, req); -+ hns3pf_handle_link_change_event(hw, req); - break; - case HNS3_MBX_PUSH_VLAN_INFO: - /* -diff --git a/drivers/net/hns3/hns3_mbx.h b/drivers/net/hns3/hns3_mbx.h -index 7f7ade1..adb77b5 100644 ---- a/drivers/net/hns3/hns3_mbx.h -+++ b/drivers/net/hns3/hns3_mbx.h -@@ -144,22 +144,8 @@ struct hns3_pf_rst_done_cmd { - - #define HNS3_PF_RESET_DONE_BIT BIT(0) - --/* used by VF to store the received Async responses from PF */ --struct hns3_mbx_arq_ring { --#define HNS3_MBX_MAX_ARQ_MSG_SIZE 8 --#define HNS3_MBX_MAX_ARQ_MSG_NUM 1024 -- uint32_t head; -- uint32_t tail; -- uint32_t count; -- uint16_t msg_q[HNS3_MBX_MAX_ARQ_MSG_NUM][HNS3_MBX_MAX_ARQ_MSG_SIZE]; --}; -- - #define hns3_mbx_ring_ptr_move_crq(crq) \ - ((crq)->next_to_use = ((crq)->next_to_use + 1) % (crq)->desc_num) --#define hns3_mbx_tail_ptr_move_arq(arq) \ -- ((arq).tail = ((arq).tail + 1) % HNS3_MBX_MAX_ARQ_MSG_SIZE) --#define hns3_mbx_head_ptr_move_arq(arq) \ -- ((arq).head = ((arq).head + 1) % HNS3_MBX_MAX_ARQ_MSG_SIZE) - - struct hns3_hw; - void hns3_dev_handle_mbx_msg(struct hns3_hw *hw); --- -2.7.4 - diff --git a/0098-ethdev-fix-port-close-in-secondary-process.patch b/0098-ethdev-fix-port-close-in-secondary-process.patch new file mode 100644 index 0000000000000000000000000000000000000000..9dcc92e6c1264bbd99d9dfbb47cc20cc5f5b1e3f --- /dev/null +++ b/0098-ethdev-fix-port-close-in-secondary-process.patch @@ -0,0 +1,40 @@ +From 8c0618338ca0b8a540980b4a475322f2cf48d9a6 Mon Sep 17 00:00:00 2001 +From: "Min Hu (Connor)" +Date: Wed, 1 Jun 2022 11:15:13 +0800 +Subject: [PATCH 098/122] ethdev: fix port close in secondary process + +Secondary process needs to close device to release process private +resources. But secondary process should not be obliged to wait for +device stop before closing ethdev. + +Fixes: febc855b358e ("ethdev: forbid closing started device") +Cc: stable@dpdk.org + +Signed-off-by: Min Hu (Connor) +Reviewed-by: Andrew Rybchenko +--- + lib/ethdev/rte_ethdev.c | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c +index 2671f47738..25c9f0c123 100644 +--- a/lib/ethdev/rte_ethdev.c ++++ b/lib/ethdev/rte_ethdev.c +@@ -1921,7 +1921,13 @@ rte_eth_dev_close(uint16_t port_id) + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); + dev = &rte_eth_devices[port_id]; + +- if (dev->data->dev_started) { ++ /* ++ * Secondary process needs to close device to release process private ++ * resources. But secondary process should not be obliged to wait ++ * for device stop before closing ethdev. ++ */ ++ if (rte_eal_process_type() == RTE_PROC_PRIMARY && ++ dev->data->dev_started) { + RTE_ETHDEV_LOG(ERR, "Cannot close started device (port %u)\n", + port_id); + return -EINVAL; +-- +2.22.0 + diff --git a/0098-net-hns3-fix-possible-mismatched-response-of-mailbox.patch b/0098-net-hns3-fix-possible-mismatched-response-of-mailbox.patch deleted file mode 100644 index 0ebe1a83aefc7f8d3d6375c7136056f4f7bd6b38..0000000000000000000000000000000000000000 --- a/0098-net-hns3-fix-possible-mismatched-response-of-mailbox.patch +++ /dev/null @@ -1,298 +0,0 @@ -From a996a465d332ce155ff5a98c451a824516d85e73 Mon Sep 17 00:00:00 2001 -From: Chengwen Feng -Date: Tue, 13 Apr 2021 19:50:01 +0800 -Subject: [PATCH 098/189] net/hns3: fix possible mismatched response of mailbox - -Currently, the mailbox synchronous communication between VF and PF use -the following fields to maintain communication: -1. Req_msg_data which was combined by message code and subcode, used to - match request and response. -2. Head which means the number of requests successfully sent by VF. -3. Tail which means the number of responses successfully received by VF. -4. Lost which means the number of requests which are timeout. - -There may possible mismatches of the following situation: -1. VF sends message A with code=1 subcode=1. - Then head=1, tail=0, lost=0. -2. PF was blocked about 500ms when processing the message A. -3. VF will detect message A timeout because it can't get the response -within 500ms. - Then head=1, tail=0, lost=1. -4. VF sends message B with code=1 subcode=1 which equal message A. - Then head=2, tail=0, lost=1. -5. PF processes the first message A and send the response message to VF. -6. VF will update tail field to 1, but the lost field will remain - unchanged because the code/subcode equal message B's, so driver will - return success because now the head(2) equals tail(1) plus lost(1). - This will lead to mismatch of request and response. - -To fix the above bug, we use the following scheme: -1. The message sent from VF was labelled with match_id which was a - unique 16-bit non-zero value. -2. The response sent from PF will label with match_id which got from the - request. -3. The VF uses the match_id to match request and response message. - -This scheme depends on the PF driver, if the PF driver don't support -then VF will uses the original scheme. - -Fixes: 463e748964f5 ("net/hns3: support mailbox") -Cc: stable@dpdk.org - -Signed-off-by: Chengwen Feng -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_mbx.c | 120 +++++++++++++++++++++++++++++++++++--------- - drivers/net/hns3/hns3_mbx.h | 20 +++++++- - 2 files changed, 114 insertions(+), 26 deletions(-) - -diff --git a/drivers/net/hns3/hns3_mbx.c b/drivers/net/hns3/hns3_mbx.c -index 6768207..7a69b63 100644 ---- a/drivers/net/hns3/hns3_mbx.c -+++ b/drivers/net/hns3/hns3_mbx.c -@@ -40,14 +40,32 @@ hns3_resp_to_errno(uint16_t resp_code) - return -EIO; - } - -+static void -+hns3_mbx_proc_timeout(struct hns3_hw *hw, uint16_t code, uint16_t subcode) -+{ -+ if (hw->mbx_resp.matching_scheme == -+ HNS3_MBX_RESP_MATCHING_SCHEME_OF_ORIGINAL) { -+ hw->mbx_resp.lost++; -+ hns3_err(hw, -+ "VF could not get mbx(%u,%u) head(%u) tail(%u) " -+ "lost(%u) from PF", -+ code, subcode, hw->mbx_resp.head, hw->mbx_resp.tail, -+ hw->mbx_resp.lost); -+ return; -+ } -+ -+ hns3_err(hw, "VF could not get mbx(%u,%u) from PF", code, subcode); -+} -+ - static int --hns3_get_mbx_resp(struct hns3_hw *hw, uint16_t code0, uint16_t code1, -+hns3_get_mbx_resp(struct hns3_hw *hw, uint16_t code, uint16_t subcode, - uint8_t *resp_data, uint16_t resp_len) - { - #define HNS3_MAX_RETRY_MS 500 - #define HNS3_WAIT_RESP_US 100 - struct hns3_adapter *hns = HNS3_DEV_HW_TO_ADAPTER(hw); - struct hns3_mbx_resp_status *mbx_resp; -+ bool received; - uint64_t now; - uint64_t end; - -@@ -59,8 +77,7 @@ hns3_get_mbx_resp(struct hns3_hw *hw, uint16_t code0, uint16_t code1, - - now = get_timeofday_ms(); - end = now + HNS3_MAX_RETRY_MS; -- while ((hw->mbx_resp.head != hw->mbx_resp.tail + hw->mbx_resp.lost) && -- (now < end)) { -+ while (now < end) { - if (__atomic_load_n(&hw->reset.disable_cmd, __ATOMIC_RELAXED)) { - hns3_err(hw, "Don't wait for mbx respone because of " - "disable_cmd"); -@@ -77,16 +94,20 @@ hns3_get_mbx_resp(struct hns3_hw *hw, uint16_t code0, uint16_t code1, - hns3_dev_handle_mbx_msg(hw); - rte_delay_us(HNS3_WAIT_RESP_US); - -+ if (hw->mbx_resp.matching_scheme == -+ HNS3_MBX_RESP_MATCHING_SCHEME_OF_ORIGINAL) -+ received = (hw->mbx_resp.head == -+ hw->mbx_resp.tail + hw->mbx_resp.lost); -+ else -+ received = hw->mbx_resp.received_match_resp; -+ if (received) -+ break; -+ - now = get_timeofday_ms(); - } - hw->mbx_resp.req_msg_data = 0; - if (now >= end) { -- hw->mbx_resp.lost++; -- hns3_err(hw, -- "VF could not get mbx(%u,%u) head(%u) tail(%u) " -- "lost(%u) from PF", -- code0, code1, hw->mbx_resp.head, hw->mbx_resp.tail, -- hw->mbx_resp.lost); -+ hns3_mbx_proc_timeout(hw, code, subcode); - return -ETIME; - } - rte_io_rmb(); -@@ -101,6 +122,29 @@ hns3_get_mbx_resp(struct hns3_hw *hw, uint16_t code0, uint16_t code1, - return 0; - } - -+static void -+hns3_mbx_prepare_resp(struct hns3_hw *hw, uint16_t code, uint16_t subcode) -+{ -+ /* -+ * Init both matching scheme fields because we may not know the exact -+ * scheme will be used when in the initial phase. -+ * -+ * Also, there are OK to init both matching scheme fields even though -+ * we get the exact scheme which is used. -+ */ -+ hw->mbx_resp.req_msg_data = (uint32_t)code << 16 | subcode; -+ hw->mbx_resp.head++; -+ -+ /* Update match_id and ensure the value of match_id is not zero */ -+ hw->mbx_resp.match_id++; -+ if (hw->mbx_resp.match_id == 0) -+ hw->mbx_resp.match_id = 1; -+ hw->mbx_resp.received_match_resp = false; -+ -+ hw->mbx_resp.resp_status = 0; -+ memset(hw->mbx_resp.additional_info, 0, HNS3_MBX_MAX_RESP_DATA_SIZE); -+} -+ - int - hns3_send_mbx_msg(struct hns3_hw *hw, uint16_t code, uint16_t subcode, - const uint8_t *msg_data, uint8_t msg_len, bool need_resp, -@@ -138,8 +182,8 @@ hns3_send_mbx_msg(struct hns3_hw *hw, uint16_t code, uint16_t subcode, - if (need_resp) { - req->mbx_need_resp |= HNS3_MBX_NEED_RESP_BIT; - rte_spinlock_lock(&hw->mbx_resp.lock); -- hw->mbx_resp.req_msg_data = (uint32_t)code << 16 | subcode; -- hw->mbx_resp.head++; -+ hns3_mbx_prepare_resp(hw, code, subcode); -+ req->match_id = hw->mbx_resp.match_id; - ret = hns3_cmd_send(hw, &desc, 1); - if (ret) { - hw->mbx_resp.head--; -@@ -244,6 +288,46 @@ hns3_update_resp_position(struct hns3_hw *hw, uint32_t resp_msg) - } - - static void -+hns3_handle_mbx_response(struct hns3_hw *hw, struct hns3_mbx_pf_to_vf_cmd *req) -+{ -+ struct hns3_mbx_resp_status *resp = &hw->mbx_resp; -+ uint32_t msg_data; -+ -+ if (req->match_id != 0) { -+ /* -+ * If match_id is not zero, it means PF support copy request's -+ * match_id to its response. So VF could use the match_id -+ * to match the request. -+ */ -+ if (resp->matching_scheme != -+ HNS3_MBX_RESP_MATCHING_SCHEME_OF_MATCH_ID) { -+ resp->matching_scheme = -+ HNS3_MBX_RESP_MATCHING_SCHEME_OF_MATCH_ID; -+ hns3_info(hw, "detect mailbox support match id!"); -+ } -+ if (req->match_id == resp->match_id) { -+ resp->resp_status = hns3_resp_to_errno(req->msg[3]); -+ memcpy(resp->additional_info, &req->msg[4], -+ HNS3_MBX_MAX_RESP_DATA_SIZE); -+ rte_io_wmb(); -+ resp->received_match_resp = true; -+ } -+ return; -+ } -+ -+ /* -+ * If the below instructions can be executed, it means PF does not -+ * support copy request's match_id to its response. So VF follows the -+ * original scheme to process. -+ */ -+ resp->resp_status = hns3_resp_to_errno(req->msg[3]); -+ memcpy(resp->additional_info, &req->msg[4], -+ HNS3_MBX_MAX_RESP_DATA_SIZE); -+ msg_data = (uint32_t)req->msg[1] << 16 | req->msg[2]; -+ hns3_update_resp_position(hw, msg_data); -+} -+ -+static void - hns3_link_fail_parse(struct hns3_hw *hw, uint8_t link_fail_code) - { - switch (link_fail_code) { -@@ -319,15 +403,11 @@ hns3_handle_promisc_info(struct hns3_hw *hw, uint16_t promisc_en) - void - hns3_dev_handle_mbx_msg(struct hns3_hw *hw) - { -- struct hns3_mbx_resp_status *resp = &hw->mbx_resp; - struct hns3_cmq_ring *crq = &hw->cmq.crq; - struct hns3_mbx_pf_to_vf_cmd *req; - struct hns3_cmd_desc *desc; -- uint32_t msg_data; - uint8_t opcode; - uint16_t flag; -- uint8_t *temp; -- int i; - - rte_spinlock_lock(&hw->cmq.crq.lock); - -@@ -355,15 +435,7 @@ hns3_dev_handle_mbx_msg(struct hns3_hw *hw) - - switch (opcode) { - case HNS3_MBX_PF_VF_RESP: -- resp->resp_status = hns3_resp_to_errno(req->msg[3]); -- -- temp = (uint8_t *)&req->msg[4]; -- for (i = 0; i < HNS3_MBX_MAX_RESP_DATA_SIZE; i++) { -- resp->additional_info[i] = *temp; -- temp++; -- } -- msg_data = (uint32_t)req->msg[1] << 16 | req->msg[2]; -- hns3_update_resp_position(hw, msg_data); -+ hns3_handle_mbx_response(hw, req); - break; - case HNS3_MBX_LINK_STAT_CHANGE: - hns3vf_handle_link_change_event(hw, req); -diff --git a/drivers/net/hns3/hns3_mbx.h b/drivers/net/hns3/hns3_mbx.h -index adb77b5..338c2c2 100644 ---- a/drivers/net/hns3/hns3_mbx.h -+++ b/drivers/net/hns3/hns3_mbx.h -@@ -83,12 +83,26 @@ enum hns3_mbx_link_fail_subcode { - #define HNS3_MBX_RING_MAP_BASIC_MSG_NUM 3 - #define HNS3_MBX_RING_NODE_VARIABLE_NUM 3 - -+enum { -+ HNS3_MBX_RESP_MATCHING_SCHEME_OF_ORIGINAL = 0, -+ HNS3_MBX_RESP_MATCHING_SCHEME_OF_MATCH_ID -+}; -+ - struct hns3_mbx_resp_status { - rte_spinlock_t lock; /* protects against contending sync cmd resp */ -+ -+ uint8_t matching_scheme; -+ -+ /* The following fields used in the matching scheme for original */ - uint32_t req_msg_data; - uint32_t head; - uint32_t tail; - uint32_t lost; -+ -+ /* The following fields used in the matching scheme for match_id */ -+ uint16_t match_id; -+ bool received_match_resp; -+ - int resp_status; - uint8_t additional_info[HNS3_MBX_MAX_RESP_DATA_SIZE]; - }; -@@ -106,7 +120,8 @@ struct hns3_mbx_vf_to_pf_cmd { - uint8_t mbx_need_resp; - uint8_t rsv1; - uint8_t msg_len; -- uint8_t rsv2[3]; -+ uint8_t rsv2; -+ uint16_t match_id; - uint8_t msg[HNS3_MBX_MAX_MSG_SIZE]; - }; - -@@ -114,7 +129,8 @@ struct hns3_mbx_pf_to_vf_cmd { - uint8_t dest_vfid; - uint8_t rsv[3]; - uint8_t msg_len; -- uint8_t rsv1[3]; -+ uint8_t rsv1; -+ uint16_t match_id; - uint16_t msg[8]; - }; - --- -2.7.4 - diff --git a/0099-examples-dma-fix-MTU-configuration.patch b/0099-examples-dma-fix-MTU-configuration.patch new file mode 100644 index 0000000000000000000000000000000000000000..6b6ecf3e315a6018a6b10d492d8041d09293fd87 --- /dev/null +++ b/0099-examples-dma-fix-MTU-configuration.patch @@ -0,0 +1,95 @@ +From f5e60c8f1d74d2a01f91fad546003eef876d71f1 Mon Sep 17 00:00:00 2001 +From: Huisong Li +Date: Sun, 24 Apr 2022 14:07:39 +0800 +Subject: [PATCH 099/122] examples/dma: fix MTU configuration + +The MTU in dma App can be configured by 'max_frame_size' parameters which +have a default value(1518). It's not reasonable to use it directly as MTU. +This patch fix it. + +Fixes: 1bb4a528c41f ("ethdev: fix max Rx packet length") +Cc: stable@dpdk.org + +Signed-off-by: Huisong Li +--- + examples/dma/dmafwd.c | 43 +++++++++++++++++++++++++++++++++++++++---- + 1 file changed, 39 insertions(+), 4 deletions(-) + +diff --git a/examples/dma/dmafwd.c b/examples/dma/dmafwd.c +index d074acc905..cfd978ec6c 100644 +--- a/examples/dma/dmafwd.c ++++ b/examples/dma/dmafwd.c +@@ -117,7 +117,7 @@ static uint16_t nb_txd = TX_DEFAULT_RINGSIZE; + static volatile bool force_quit; + + static uint32_t dma_batch_sz = MAX_PKT_BURST; +-static uint32_t max_frame_size = RTE_ETHER_MAX_LEN; ++static uint32_t max_frame_size; + + /* ethernet addresses of ports */ + static struct rte_ether_addr dma_ports_eth_addr[RTE_MAX_ETHPORTS]; +@@ -851,6 +851,38 @@ assign_rings(void) + } + /* >8 End of assigning ring structures for packet exchanging. */ + ++static uint32_t ++eth_dev_get_overhead_len(uint32_t max_rx_pktlen, uint16_t max_mtu) ++{ ++ uint32_t overhead_len; ++ ++ if (max_mtu != UINT16_MAX && max_rx_pktlen > max_mtu) ++ overhead_len = max_rx_pktlen - max_mtu; ++ else ++ overhead_len = RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN; ++ ++ return overhead_len; ++} ++ ++static int ++config_port_max_pkt_len(struct rte_eth_conf *conf, ++ struct rte_eth_dev_info *dev_info) ++{ ++ uint32_t overhead_len; ++ ++ if (max_frame_size == 0) ++ return 0; ++ ++ if (max_frame_size < RTE_ETHER_MIN_LEN) ++ return -1; ++ ++ overhead_len = eth_dev_get_overhead_len(dev_info->max_rx_pktlen, ++ dev_info->max_mtu); ++ conf->rxmode.mtu = max_frame_size - overhead_len; ++ ++ return 0; ++} ++ + /* + * Initializes a given port using global settings and with the RX buffers + * coming from the mbuf_pool passed as a parameter. +@@ -878,9 +910,6 @@ port_init(uint16_t portid, struct rte_mempool *mbuf_pool, uint16_t nb_queues) + struct rte_eth_dev_info dev_info; + int ret, i; + +- if (max_frame_size > local_port_conf.rxmode.mtu) +- local_port_conf.rxmode.mtu = max_frame_size; +- + /* Skip ports that are not enabled */ + if ((dma_enabled_port_mask & (1 << portid)) == 0) { + printf("Skipping disabled port %u\n", portid); +@@ -895,6 +924,12 @@ port_init(uint16_t portid, struct rte_mempool *mbuf_pool, uint16_t nb_queues) + rte_exit(EXIT_FAILURE, "Cannot get device info: %s, port=%u\n", + rte_strerror(-ret), portid); + ++ ret = config_port_max_pkt_len(&local_port_conf, &dev_info); ++ if (ret != 0) ++ rte_exit(EXIT_FAILURE, ++ "Invalid max frame size: %u (port %u)\n", ++ max_frame_size, portid); ++ + local_port_conf.rx_adv_conf.rss_conf.rss_hf &= + dev_info.flow_type_rss_offloads; + ret = rte_eth_dev_configure(portid, nb_queues, 1, &local_port_conf); +-- +2.22.0 + diff --git a/0099-net-hns3-fix-VF-handling-LSC-event-in-secondary-proc.patch b/0099-net-hns3-fix-VF-handling-LSC-event-in-secondary-proc.patch deleted file mode 100644 index e4b80695fc8a7e9a39d5c8e14d723ab349f64778..0000000000000000000000000000000000000000 --- a/0099-net-hns3-fix-VF-handling-LSC-event-in-secondary-proc.patch +++ /dev/null @@ -1,135 +0,0 @@ -From 454906f37a15048b7ed19934382234c762842ef0 Mon Sep 17 00:00:00 2001 -From: Chengwen Feng -Date: Tue, 13 Apr 2021 19:50:02 +0800 -Subject: [PATCH 099/189] net/hns3: fix VF handling LSC event in secondary - process - -VF will build two queues (csq: command send queue, crq: command receive -queue) with firmware, the crq may contain the following messages: -1) mailbox response message which was the ack of mailbox sync request. -2) PF's link status change message which may send by PF at anytime; - -Currently, any threads in the primary and secondary processes could -send mailbox sync request, so it will need to process the crq messages -in there own thread context. - -If the crq hold two messages: a) PF's link status change message, b) -mailbox response message when secondary process deals with the crq -messages, it will lead to report lsc event in secondary process -because it uses the policy of processing all pending messages at once. - -We use the following scheme to solve it: -1) threads in secondary process could only process specifics messages - (eg. mailbox response message) in crq, if the message processed, its - opcode will rewrite with zero, then the intr thread in primary - process will not process again. -2) threads other than intr thread in the primary process use the same - processing logic as the threads in secondary process. -3) intr thread in the primary process could process all messages. - -Fixes: 76a3836b98c4 ("net/hns3: fix setting default MAC address in bonding of VF") -Fixes: 463e748964f5 ("net/hns3: support mailbox") -Cc: stable@dpdk.org - -Signed-off-by: Chengwen Feng -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_mbx.c | 68 +++++++++++++++++++++++++++++++++++++++++++++ - 1 file changed, 68 insertions(+) - -diff --git a/drivers/net/hns3/hns3_mbx.c b/drivers/net/hns3/hns3_mbx.c -index 7a69b63..5a88fe2 100644 ---- a/drivers/net/hns3/hns3_mbx.c -+++ b/drivers/net/hns3/hns3_mbx.c -@@ -400,6 +400,44 @@ hns3_handle_promisc_info(struct hns3_hw *hw, uint16_t promisc_en) - } - } - -+static void -+hns3_handle_mbx_msg_out_intr(struct hns3_hw *hw) -+{ -+ struct hns3_cmq_ring *crq = &hw->cmq.crq; -+ struct hns3_mbx_pf_to_vf_cmd *req; -+ struct hns3_cmd_desc *desc; -+ uint32_t tail, next_to_use; -+ uint8_t opcode; -+ uint16_t flag; -+ -+ tail = hns3_read_dev(hw, HNS3_CMDQ_RX_TAIL_REG); -+ next_to_use = crq->next_to_use; -+ while (next_to_use != tail) { -+ desc = &crq->desc[next_to_use]; -+ req = (struct hns3_mbx_pf_to_vf_cmd *)desc->data; -+ opcode = req->msg[0] & 0xff; -+ -+ flag = rte_le_to_cpu_16(crq->desc[next_to_use].flag); -+ if (!hns3_get_bit(flag, HNS3_CMDQ_RX_OUTVLD_B)) -+ goto scan_next; -+ -+ if (crq->desc[next_to_use].opcode == 0) -+ goto scan_next; -+ -+ if (opcode == HNS3_MBX_PF_VF_RESP) { -+ hns3_handle_mbx_response(hw, req); -+ /* -+ * Clear opcode to inform intr thread don't process -+ * again. -+ */ -+ crq->desc[crq->next_to_use].opcode = 0; -+ } -+ -+scan_next: -+ next_to_use = (next_to_use + 1) % hw->cmq.crq.desc_num; -+ } -+} -+ - void - hns3_dev_handle_mbx_msg(struct hns3_hw *hw) - { -@@ -411,6 +449,29 @@ hns3_dev_handle_mbx_msg(struct hns3_hw *hw) - - rte_spinlock_lock(&hw->cmq.crq.lock); - -+ if (rte_eal_process_type() != RTE_PROC_PRIMARY || -+ !rte_thread_is_intr()) { -+ /* -+ * Currently, any threads in the primary and secondary processes -+ * could send mailbox sync request, so it will need to process -+ * the crq message (which is the HNS3_MBX_PF_VF_RESP) in there -+ * own thread context. It may also process other messages -+ * because it uses the policy of processing all pending messages -+ * at once. -+ * But some messages such as HNS3_MBX_PUSH_LINK_STATUS could -+ * only process within the intr thread in primary process, -+ * otherwise it may lead to report lsc event in secondary -+ * process. -+ * So the threads other than intr thread in primary process -+ * could only process HNS3_MBX_PF_VF_RESP message, if the -+ * message processed, its opcode will rewrite with zero, then -+ * the intr thread in primary process will not process again. -+ */ -+ hns3_handle_mbx_msg_out_intr(hw); -+ rte_spinlock_unlock(&hw->cmq.crq.lock); -+ return; -+ } -+ - while (!hns3_cmd_crq_empty(hw)) { - if (__atomic_load_n(&hw->reset.disable_cmd, __ATOMIC_RELAXED)) { - rte_spinlock_unlock(&hw->cmq.crq.lock); -@@ -433,6 +494,13 @@ hns3_dev_handle_mbx_msg(struct hns3_hw *hw) - continue; - } - -+ if (desc->opcode == 0) { -+ /* Message already processed by other thread */ -+ crq->desc[crq->next_to_use].flag = 0; -+ hns3_mbx_ring_ptr_move_crq(crq); -+ continue; -+ } -+ - switch (opcode) { - case HNS3_MBX_PF_VF_RESP: - hns3_handle_mbx_response(hw, req); --- -2.7.4 - diff --git a/0100-examples-dma-fix-Tx-drop-statistics.patch b/0100-examples-dma-fix-Tx-drop-statistics.patch new file mode 100644 index 0000000000000000000000000000000000000000..b82c3d439a85936a27f8f3fd103e16072b80a532 --- /dev/null +++ b/0100-examples-dma-fix-Tx-drop-statistics.patch @@ -0,0 +1,79 @@ +From 5059d5fd27626e1d34b6dcaa2e74c7a5f1c7ee1f Mon Sep 17 00:00:00 2001 +From: Chengwen Feng +Date: Sun, 24 Apr 2022 14:07:40 +0800 +Subject: [PATCH 100/122] examples/dma: fix Tx drop statistics + +The Tx drop statistic was designed to be collected by +rte_eth_dev_tx_buffer mechanism, but the application uses +rte_eth_tx_burst to send packets and this lead the Tx drop statistic +was not collected. + +This patch removes rte_eth_dev_tx_buffer mechanism to fix the problem. + +Fixes: 632bcd9b5d4f ("examples/ioat: print statistics") +Cc: stable@dpdk.org + +Signed-off-by: Chengwen Feng +Acked-by: Bruce Richardson +Acked-by: Kevin Laatz +--- + examples/dma/dmafwd.c | 27 +++++---------------------- + 1 file changed, 5 insertions(+), 22 deletions(-) + +diff --git a/examples/dma/dmafwd.c b/examples/dma/dmafwd.c +index cfd978ec6c..d7d39b6a14 100644 +--- a/examples/dma/dmafwd.c ++++ b/examples/dma/dmafwd.c +@@ -122,7 +122,6 @@ static uint32_t max_frame_size; + /* ethernet addresses of ports */ + static struct rte_ether_addr dma_ports_eth_addr[RTE_MAX_ETHPORTS]; + +-static struct rte_eth_dev_tx_buffer *tx_buffer[RTE_MAX_ETHPORTS]; + struct rte_mempool *dma_pktmbuf_pool; + + /* Print out statistics for one port. */ +@@ -484,10 +483,13 @@ dma_tx_port(struct rxtx_port_config *tx_config) + + port_statistics.tx[tx_config->rxtx_port] += nb_tx; + +- /* Free any unsent packets. */ +- if (unlikely(nb_tx < nb_dq)) ++ if (unlikely(nb_tx < nb_dq)) { ++ port_statistics.tx_dropped[tx_config->rxtx_port] += ++ (nb_dq - nb_tx); ++ /* Free any unsent packets. */ + rte_mempool_put_bulk(dma_pktmbuf_pool, + (void *)&mbufs[nb_tx], nb_dq - nb_tx); ++ } + } + } + /* >8 End of transmitting packets from dmadev. */ +@@ -970,25 +972,6 @@ port_init(uint16_t portid, struct rte_mempool *mbuf_pool, uint16_t nb_queues) + "rte_eth_tx_queue_setup:err=%d,port=%u\n", + ret, portid); + +- /* Initialize TX buffers */ +- tx_buffer[portid] = rte_zmalloc_socket("tx_buffer", +- RTE_ETH_TX_BUFFER_SIZE(MAX_PKT_BURST), 0, +- rte_eth_dev_socket_id(portid)); +- if (tx_buffer[portid] == NULL) +- rte_exit(EXIT_FAILURE, +- "Cannot allocate buffer for tx on port %u\n", +- portid); +- +- rte_eth_tx_buffer_init(tx_buffer[portid], MAX_PKT_BURST); +- +- ret = rte_eth_tx_buffer_set_err_callback(tx_buffer[portid], +- rte_eth_tx_buffer_count_callback, +- &port_statistics.tx_dropped[portid]); +- if (ret < 0) +- rte_exit(EXIT_FAILURE, +- "Cannot set error callback for tx buffer on port %u\n", +- portid); +- + /* Start device. 8< */ + ret = rte_eth_dev_start(portid); + if (ret < 0) +-- +2.22.0 + diff --git a/0100-net-hns3-fix-timing-in-mailbox.patch b/0100-net-hns3-fix-timing-in-mailbox.patch deleted file mode 100644 index ec549fa44b85d5746f0811e20cfd147db90ff7e7..0000000000000000000000000000000000000000 --- a/0100-net-hns3-fix-timing-in-mailbox.patch +++ /dev/null @@ -1,70 +0,0 @@ -From bfcf3af1b6ccb9eb022ceabcc6d41f3985445c3f Mon Sep 17 00:00:00 2001 -From: Chengchang Tang -Date: Tue, 13 Apr 2021 19:50:03 +0800 -Subject: [PATCH 100/189] net/hns3: fix timing in mailbox - -Currently, when processing MBX messages, the system timestamp is obtained -to determine whether timeout occurs. However, the gettimeofday function -is not monotonically increasing. Therefore, this may lead to incorrect -judgment or difficulty exiting the loop. And actually, in this scenario, -it is not necessary to obtain the timestamp. - -This patch deletes the call to the gettimeofday function during MBX -message processing. - -Fixes: 463e748964f5 ("net/hns3: support mailbox") -Cc: stable@dpdk.org - -Signed-off-by: Chengchang Tang -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_mbx.c | 13 +++++-------- - 1 file changed, 5 insertions(+), 8 deletions(-) - -diff --git a/drivers/net/hns3/hns3_mbx.c b/drivers/net/hns3/hns3_mbx.c -index 5a88fe2..9955f27 100644 ---- a/drivers/net/hns3/hns3_mbx.c -+++ b/drivers/net/hns3/hns3_mbx.c -@@ -61,13 +61,12 @@ static int - hns3_get_mbx_resp(struct hns3_hw *hw, uint16_t code, uint16_t subcode, - uint8_t *resp_data, uint16_t resp_len) - { --#define HNS3_MAX_RETRY_MS 500 -+#define HNS3_MAX_RETRY_US 500000 - #define HNS3_WAIT_RESP_US 100 - struct hns3_adapter *hns = HNS3_DEV_HW_TO_ADAPTER(hw); - struct hns3_mbx_resp_status *mbx_resp; -+ uint32_t wait_time = 0; - bool received; -- uint64_t now; -- uint64_t end; - - if (resp_len > HNS3_MBX_MAX_RESP_DATA_SIZE) { - hns3_err(hw, "VF mbx response len(=%u) exceeds maximum(=%d)", -@@ -75,9 +74,7 @@ hns3_get_mbx_resp(struct hns3_hw *hw, uint16_t code, uint16_t subcode, - return -EINVAL; - } - -- now = get_timeofday_ms(); -- end = now + HNS3_MAX_RETRY_MS; -- while (now < end) { -+ while (wait_time < HNS3_MAX_RETRY_US) { - if (__atomic_load_n(&hw->reset.disable_cmd, __ATOMIC_RELAXED)) { - hns3_err(hw, "Don't wait for mbx respone because of " - "disable_cmd"); -@@ -103,10 +100,10 @@ hns3_get_mbx_resp(struct hns3_hw *hw, uint16_t code, uint16_t subcode, - if (received) - break; - -- now = get_timeofday_ms(); -+ wait_time += HNS3_WAIT_RESP_US; - } - hw->mbx_resp.req_msg_data = 0; -- if (now >= end) { -+ if (wait_time >= HNS3_MAX_RETRY_US) { - hns3_mbx_proc_timeout(hw, code, subcode); - return -ETIME; - } --- -2.7.4 - diff --git a/0101-examples-dma-add-force-minimal-copy-size-parameter.patch b/0101-examples-dma-add-force-minimal-copy-size-parameter.patch new file mode 100644 index 0000000000000000000000000000000000000000..b0c08c95ddd47e80949cf7fa202c3a4e43d9dacd --- /dev/null +++ b/0101-examples-dma-add-force-minimal-copy-size-parameter.patch @@ -0,0 +1,127 @@ +From abc65cadf4b5ef0f898cb4851a100af26fbc55a6 Mon Sep 17 00:00:00 2001 +From: Chengwen Feng +Date: Sun, 24 Apr 2022 14:07:41 +0800 +Subject: [PATCH 101/122] examples/dma: add force minimal copy size parameter + +This patch adds force minimal copy size parameter +(-m/--force-min-copy-size), so when do copy by CPU or DMA, the real copy +size will be the maximum of mbuf's data_len and this parameter. + +This parameter was designed to compare the performance between CPU copy +and DMA copy. User could send small packets with a high rate to drive +the performance test. + +Signed-off-by: Chengwen Feng +Acked-by: Bruce Richardson +Acked-by: Kevin Laatz +--- + examples/dma/dmafwd.c | 30 +++++++++++++++++++++++++++--- + 1 file changed, 27 insertions(+), 3 deletions(-) + +diff --git a/examples/dma/dmafwd.c b/examples/dma/dmafwd.c +index d7d39b6a14..9b17b40dbf 100644 +--- a/examples/dma/dmafwd.c ++++ b/examples/dma/dmafwd.c +@@ -25,6 +25,7 @@ + #define CMD_LINE_OPT_RING_SIZE "ring-size" + #define CMD_LINE_OPT_BATCH_SIZE "dma-batch-size" + #define CMD_LINE_OPT_FRAME_SIZE "max-frame-size" ++#define CMD_LINE_OPT_FORCE_COPY_SIZE "force-min-copy-size" + #define CMD_LINE_OPT_STATS_INTERVAL "stats-interval" + + /* configurable number of RX/TX ring descriptors */ +@@ -118,6 +119,7 @@ static volatile bool force_quit; + + static uint32_t dma_batch_sz = MAX_PKT_BURST; + static uint32_t max_frame_size; ++static uint32_t force_min_copy_size; + + /* ethernet addresses of ports */ + static struct rte_ether_addr dma_ports_eth_addr[RTE_MAX_ETHPORTS]; +@@ -205,7 +207,13 @@ print_stats(char *prgname) + "Rx Queues = %d, ", nb_queues); + status_strlen += snprintf(status_string + status_strlen, + sizeof(status_string) - status_strlen, +- "Ring Size = %d", ring_size); ++ "Ring Size = %d\n", ring_size); ++ status_strlen += snprintf(status_string + status_strlen, ++ sizeof(status_string) - status_strlen, ++ "Force Min Copy Size = %u Packet Data Room Size = %u", ++ force_min_copy_size, ++ rte_pktmbuf_data_room_size(dma_pktmbuf_pool) - ++ RTE_PKTMBUF_HEADROOM); + + memset(&ts, 0, sizeof(struct total_statistics)); + +@@ -303,7 +311,8 @@ static inline void + pktmbuf_sw_copy(struct rte_mbuf *src, struct rte_mbuf *dst) + { + rte_memcpy(rte_pktmbuf_mtod(dst, char *), +- rte_pktmbuf_mtod(src, char *), src->data_len); ++ rte_pktmbuf_mtod(src, char *), ++ RTE_MAX(src->data_len, force_min_copy_size)); + } + /* >8 End of perform packet copy there is a user-defined function. */ + +@@ -320,7 +329,9 @@ dma_enqueue_packets(struct rte_mbuf *pkts[], struct rte_mbuf *pkts_copy[], + ret = rte_dma_copy(dev_id, 0, + rte_pktmbuf_iova(pkts[i]), + rte_pktmbuf_iova(pkts_copy[i]), +- rte_pktmbuf_data_len(pkts[i]), 0); ++ RTE_MAX(rte_pktmbuf_data_len(pkts[i]), ++ force_min_copy_size), ++ 0); + + if (ret < 0) + break; +@@ -572,6 +583,7 @@ dma_usage(const char *prgname) + printf("%s [EAL options] -- -p PORTMASK [-q NQ]\n" + " -b --dma-batch-size: number of requests per DMA batch\n" + " -f --max-frame-size: max frame size\n" ++ " -m --force-min-copy-size: force a minimum copy length, even for smaller packets\n" + " -p --portmask: hexadecimal bitmask of ports to configure\n" + " -q NQ: number of RX queues per port (default is 1)\n" + " --[no-]mac-updating: Enable or disable MAC addresses updating (enabled by default)\n" +@@ -617,6 +629,7 @@ dma_parse_args(int argc, char **argv, unsigned int nb_ports) + "b:" /* dma batch size */ + "c:" /* copy type (sw|hw) */ + "f:" /* max frame size */ ++ "m:" /* force min copy size */ + "p:" /* portmask */ + "q:" /* number of RX queues per port */ + "s:" /* ring size */ +@@ -632,6 +645,7 @@ dma_parse_args(int argc, char **argv, unsigned int nb_ports) + {CMD_LINE_OPT_RING_SIZE, required_argument, NULL, 's'}, + {CMD_LINE_OPT_BATCH_SIZE, required_argument, NULL, 'b'}, + {CMD_LINE_OPT_FRAME_SIZE, required_argument, NULL, 'f'}, ++ {CMD_LINE_OPT_FORCE_COPY_SIZE, required_argument, NULL, 'm'}, + {CMD_LINE_OPT_STATS_INTERVAL, required_argument, NULL, 'i'}, + {NULL, 0, 0, 0} + }; +@@ -666,6 +680,10 @@ dma_parse_args(int argc, char **argv, unsigned int nb_ports) + } + break; + ++ case 'm': ++ force_min_copy_size = atoi(optarg); ++ break; ++ + /* portmask */ + case 'p': + dma_enabled_port_mask = dma_parse_portmask(optarg); +@@ -1064,6 +1082,12 @@ main(int argc, char **argv) + rte_exit(EXIT_FAILURE, "Cannot init mbuf pool\n"); + /* >8 End of allocates mempool to hold the mbufs. */ + ++ if (force_min_copy_size > ++ (uint32_t)(rte_pktmbuf_data_room_size(dma_pktmbuf_pool) - ++ RTE_PKTMBUF_HEADROOM)) ++ rte_exit(EXIT_FAILURE, ++ "Force min copy size > packet mbuf size\n"); ++ + /* Initialize each port. 8< */ + cfg.nb_ports = 0; + RTE_ETH_FOREACH_DEV(portid) +-- +2.22.0 + diff --git a/0101-net-hns3-fix-use-of-command-status-enumeration.patch b/0101-net-hns3-fix-use-of-command-status-enumeration.patch deleted file mode 100644 index 1af67a00f0741479cd87c17722505c14104a984f..0000000000000000000000000000000000000000 --- a/0101-net-hns3-fix-use-of-command-status-enumeration.patch +++ /dev/null @@ -1,99 +0,0 @@ -From 1e3415f3ba207dfb012e5f4fab96bb5760419fae Mon Sep 17 00:00:00 2001 -From: Chengchang Tang -Date: Tue, 13 Apr 2021 19:50:04 +0800 -Subject: [PATCH 101/189] net/hns3: fix use of command status enumeration - -The type of return value of hns3_cmd_send is int, some function declare -the return value as hns3_cmd_status. - -This patch fix the incorrect use of the enum hns3_cmd_status. - -Fixes: 737f30e1c3ab ("net/hns3: support command interface with firmware") -Fixes: 02a7b55657b2 ("net/hns3: support Rx interrupt") -Cc: stable@dpdk.org - -Signed-off-by: Chengchang Tang -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_cmd.c | 2 +- - drivers/net/hns3/hns3_cmd.h | 9 +-------- - drivers/net/hns3/hns3_ethdev.c | 12 ++++++------ - 3 files changed, 8 insertions(+), 15 deletions(-) - -diff --git a/drivers/net/hns3/hns3_cmd.c b/drivers/net/hns3/hns3_cmd.c -index 1bf1c32..58833ce 100644 ---- a/drivers/net/hns3/hns3_cmd.c -+++ b/drivers/net/hns3/hns3_cmd.c -@@ -450,7 +450,7 @@ hns3_build_api_caps(void) - return rte_cpu_to_le_32(api_caps); - } - --static enum hns3_cmd_status -+static int - hns3_cmd_query_firmware_version_and_capability(struct hns3_hw *hw) - { - struct hns3_query_version_cmd *resp; -diff --git a/drivers/net/hns3/hns3_cmd.h b/drivers/net/hns3/hns3_cmd.h -index 5d1fb67..9a975b8 100644 ---- a/drivers/net/hns3/hns3_cmd.h -+++ b/drivers/net/hns3/hns3_cmd.h -@@ -56,13 +56,6 @@ enum hns3_cmd_return_status { - HNS3_CMD_ROH_CHECK_FAIL = 12 - }; - --enum hns3_cmd_status { -- HNS3_STATUS_SUCCESS = 0, -- HNS3_ERR_CSQ_FULL = -1, -- HNS3_ERR_CSQ_TIMEOUT = -2, -- HNS3_ERR_CSQ_ERROR = -3, --}; -- - struct hns3_misc_vector { - uint8_t *addr; - int vector_irq; -@@ -72,7 +65,7 @@ struct hns3_cmq { - struct hns3_cmq_ring csq; - struct hns3_cmq_ring crq; - uint16_t tx_timeout; -- enum hns3_cmd_status last_status; -+ enum hns3_cmd_return_status last_status; - }; - - enum hns3_opcode_type { -diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c -index 85e54ae..a06fdc9 100644 ---- a/drivers/net/hns3/hns3_ethdev.c -+++ b/drivers/net/hns3/hns3_ethdev.c -@@ -2310,11 +2310,11 @@ hns3_bind_ring_with_vector(struct hns3_hw *hw, uint16_t vector_id, bool en, - struct hns3_cmd_desc desc; - struct hns3_ctrl_vector_chain_cmd *req = - (struct hns3_ctrl_vector_chain_cmd *)desc.data; -- enum hns3_cmd_status status; - enum hns3_opcode_type op; - uint16_t tqp_type_and_id = 0; - uint16_t type; - uint16_t gl; -+ int ret; - - op = en ? HNS3_OPC_ADD_RING_TO_VECTOR : HNS3_OPC_DEL_RING_TO_VECTOR; - hns3_cmd_setup_basic_desc(&desc, op, false); -@@ -2337,11 +2337,11 @@ hns3_bind_ring_with_vector(struct hns3_hw *hw, uint16_t vector_id, bool en, - gl); - req->tqp_type_and_id[0] = rte_cpu_to_le_16(tqp_type_and_id); - req->int_cause_num = 1; -- status = hns3_cmd_send(hw, &desc, 1); -- if (status) { -- hns3_err(hw, "%s TQP %u fail, vector_id is %u, status is %d.", -- en ? "Map" : "Unmap", queue_id, vector_id, status); -- return status; -+ ret = hns3_cmd_send(hw, &desc, 1); -+ if (ret) { -+ hns3_err(hw, "%s TQP %u fail, vector_id = %u, ret = %d.", -+ en ? "Map" : "Unmap", queue_id, vector_id, ret); -+ return ret; - } - - return 0; --- -2.7.4 - diff --git a/0102-dma-hisilicon-fix-index-returned-when-no-DMA-complet.patch b/0102-dma-hisilicon-fix-index-returned-when-no-DMA-complet.patch new file mode 100644 index 0000000000000000000000000000000000000000..0924a01648730b7c51935b69580b6d961477aa43 --- /dev/null +++ b/0102-dma-hisilicon-fix-index-returned-when-no-DMA-complet.patch @@ -0,0 +1,54 @@ +From efe4049f48dd09ea069354f7e515bf7d81aa0f92 Mon Sep 17 00:00:00 2001 +From: Chengwen Feng +Date: Fri, 27 May 2022 11:40:52 +0800 +Subject: [PATCH 102/122] dma/hisilicon: fix index returned when no DMA + completed + +If no DMA request is completed, the ring_idx of the last completed +operation need returned by last_idx parameter. This patch fixes it. + +Fixes: 2db4f0b82360 ("dma/hisilicon: add data path") +Cc: stable@dpdk.org + +Signed-off-by: Chengwen Feng +--- + drivers/dma/hisilicon/hisi_dmadev.c | 8 ++++---- + 1 file changed, 4 insertions(+), 4 deletions(-) + +diff --git a/drivers/dma/hisilicon/hisi_dmadev.c b/drivers/dma/hisilicon/hisi_dmadev.c +index 9cef2cbfbe..f5c3cd914d 100644 +--- a/drivers/dma/hisilicon/hisi_dmadev.c ++++ b/drivers/dma/hisilicon/hisi_dmadev.c +@@ -702,12 +702,12 @@ hisi_dma_completed(void *dev_private, + } + sq_head = (sq_head + 1) & hw->sq_depth_mask; + } ++ *last_idx = hw->cridx + i - 1; + if (i > 0) { + hw->cridx += i; +- *last_idx = hw->cridx - 1; + hw->sq_head = sq_head; ++ hw->completed += i; + } +- hw->completed += i; + + return i; + } +@@ -761,12 +761,12 @@ hisi_dma_completed_status(void *dev_private, + hw->status[sq_head] = HISI_DMA_STATUS_SUCCESS; + sq_head = (sq_head + 1) & hw->sq_depth_mask; + } ++ *last_idx = hw->cridx + cpl_num - 1; + if (likely(cpl_num > 0)) { + hw->cridx += cpl_num; +- *last_idx = hw->cridx - 1; + hw->sq_head = sq_head; ++ hw->completed += cpl_num; + } +- hw->completed += cpl_num; + + return cpl_num; + } +-- +2.22.0 + diff --git a/0102-net-hns3-fix-verification-of-NEON-support.patch b/0102-net-hns3-fix-verification-of-NEON-support.patch deleted file mode 100644 index f964b7cca6bedcea54e6c82eeaf70efdfe152162..0000000000000000000000000000000000000000 --- a/0102-net-hns3-fix-verification-of-NEON-support.patch +++ /dev/null @@ -1,80 +0,0 @@ -From 0be6bd46ca0352c7308a9bdb04d2f1a9d9ccd888 Mon Sep 17 00:00:00 2001 -From: Chengwen Feng -Date: Tue, 13 Apr 2021 19:50:05 +0800 -Subject: [PATCH 102/189] net/hns3: fix verification of NEON support - -This patch adds verification of whether NEON supported. - -Fixes: a3d4f4d291d7 ("net/hns3: support NEON Rx") -Fixes: e31f123db06b ("net/hns3: support NEON Tx") -Cc: stable@dpdk.org - -Signed-off-by: Chengwen Feng -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_rxtx.c | 26 ++++++++++++++++++++------ - 1 file changed, 20 insertions(+), 6 deletions(-) - -diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c -index cbcfb0b..f3ced19 100644 ---- a/drivers/net/hns3/hns3_rxtx.c -+++ b/drivers/net/hns3/hns3_rxtx.c -@@ -11,7 +11,7 @@ - #include - #include - #include --#if defined(RTE_ARCH_ARM64) && defined(__ARM_FEATURE_SVE) -+#if defined(RTE_ARCH_ARM64) - #include - #endif - -@@ -2766,7 +2766,17 @@ hns3_rx_burst_mode_get(struct rte_eth_dev *dev, __rte_unused uint16_t queue_id, - } - - static bool --hns3_check_sve_support(void) -+hns3_get_default_vec_support(void) -+{ -+#if defined(RTE_ARCH_ARM64) -+ if (rte_cpu_get_flag_enabled(RTE_CPUFLAG_NEON)) -+ return true; -+#endif -+ return false; -+} -+ -+static bool -+hns3_get_sve_support(void) - { - #if defined(RTE_ARCH_ARM64) && defined(__ARM_FEATURE_SVE) - if (rte_cpu_get_flag_enabled(RTE_CPUFLAG_SVE)) -@@ -2781,9 +2791,11 @@ hns3_get_rx_function(struct rte_eth_dev *dev) - struct hns3_adapter *hns = dev->data->dev_private; - uint64_t offloads = dev->data->dev_conf.rxmode.offloads; - bool vec_allowed, sve_allowed, simple_allowed; -+ bool vec_support; - -- vec_allowed = hns3_rx_check_vec_support(dev) == 0; -- sve_allowed = vec_allowed && hns3_check_sve_support(); -+ vec_support = hns3_rx_check_vec_support(dev) == 0; -+ vec_allowed = vec_support && hns3_get_default_vec_support(); -+ sve_allowed = vec_support && hns3_get_sve_support(); - simple_allowed = !dev->data->scattered_rx && - (offloads & DEV_RX_OFFLOAD_TCP_LRO) == 0; - -@@ -4170,9 +4182,11 @@ hns3_get_tx_function(struct rte_eth_dev *dev, eth_tx_prep_t *prep) - { - struct hns3_adapter *hns = dev->data->dev_private; - bool vec_allowed, sve_allowed, simple_allowed; -+ bool vec_support; - -- vec_allowed = hns3_tx_check_vec_support(dev) == 0; -- sve_allowed = vec_allowed && hns3_check_sve_support(); -+ vec_support = hns3_tx_check_vec_support(dev) == 0; -+ vec_allowed = vec_support && hns3_get_default_vec_support(); -+ sve_allowed = vec_support && hns3_get_sve_support(); - simple_allowed = hns3_tx_check_simple_support(dev); - - *prep = NULL; --- -2.7.4 - diff --git a/0103-test-dma-check-index-when-no-DMA-completed.patch b/0103-test-dma-check-index-when-no-DMA-completed.patch new file mode 100644 index 0000000000000000000000000000000000000000..35b0e1f75602ae1a1d54b1326f16659394ce249a --- /dev/null +++ b/0103-test-dma-check-index-when-no-DMA-completed.patch @@ -0,0 +1,51 @@ +From 33e515de3d5d00094f934e10b2d15af8e52511b5 Mon Sep 17 00:00:00 2001 +From: Chengwen Feng +Date: Fri, 27 May 2022 11:40:53 +0800 +Subject: [PATCH 103/122] test/dma: check index when no DMA completed + +If no DMA request is completed, the ring_idx of the last completed +operation need returned by last_idx parameter. This patch adds +testcase for it. + +Signed-off-by: Chengwen Feng +Tested-by: Kevin Laatz +--- + app/test/test_dmadev.c | 15 +++++++++++++++ + 1 file changed, 15 insertions(+) + +diff --git a/app/test/test_dmadev.c b/app/test/test_dmadev.c +index b206db27ae..d9e8f6d8c3 100644 +--- a/app/test/test_dmadev.c ++++ b/app/test/test_dmadev.c +@@ -177,6 +177,7 @@ do_multi_copies(int16_t dev_id, uint16_t vchan, + static int + test_enqueue_copies(int16_t dev_id, uint16_t vchan) + { ++ enum rte_dma_status_code status; + unsigned int i; + uint16_t id; + +@@ -215,6 +216,20 @@ test_enqueue_copies(int16_t dev_id, uint16_t vchan) + ERR_RETURN("Error:incorrect job id received, %u [expected %u]\n", + id, id_count); + ++ /* check for completed and id when no job done */ ++ if (rte_dma_completed(dev_id, vchan, 1, &id, NULL) != 0) ++ ERR_RETURN("Error with rte_dma_completed when no job done\n"); ++ if (id != id_count) ++ ERR_RETURN("Error:incorrect job id received when no job done, %u [expected %u]\n", ++ id, id_count); ++ ++ /* check for completed_status and id when no job done */ ++ if (rte_dma_completed_status(dev_id, vchan, 1, &id, &status) != 0) ++ ERR_RETURN("Error with rte_dma_completed_status when no job done\n"); ++ if (id != id_count) ++ ERR_RETURN("Error:incorrect job id received when no job done, %u [expected %u]\n", ++ id, id_count); ++ + rte_pktmbuf_free(src); + rte_pktmbuf_free(dst); + +-- +2.22.0 + diff --git a/0104-dma-hisilicon-enhance-CQ-scan-robustness.patch b/0104-dma-hisilicon-enhance-CQ-scan-robustness.patch new file mode 100644 index 0000000000000000000000000000000000000000..d4da26d679a44f030f4b4d281b388d4e705373fa --- /dev/null +++ b/0104-dma-hisilicon-enhance-CQ-scan-robustness.patch @@ -0,0 +1,54 @@ +From 5b84cc2a652f2646d2d4b4cdc1e6b00c13f4d790 Mon Sep 17 00:00:00 2001 +From: Chengwen Feng +Date: Fri, 27 May 2022 11:40:54 +0800 +Subject: [PATCH 104/122] dma/hisilicon: enhance CQ scan robustness + +The CQ (completion queue) descriptors were updated by hardware, and then +scanned by driver to retrieve hardware completion status. + +This patch enhances robustness by following: +1. replace while (true) with a finite loop to avoid potential dead loop. +2. check the csq_head field in CQ descriptor to avoid status array +overflows. + +Fixes: 2db4f0b82360 ("dma/hisilicon: add data path") +Cc: stable@dpdk.org + +Signed-off-by: Chengwen Feng +--- + drivers/dma/hisilicon/hisi_dmadev.c | 12 +++++++++++- + 1 file changed, 11 insertions(+), 1 deletion(-) + +diff --git a/drivers/dma/hisilicon/hisi_dmadev.c b/drivers/dma/hisilicon/hisi_dmadev.c +index f5c3cd914d..fbe09284ed 100644 +--- a/drivers/dma/hisilicon/hisi_dmadev.c ++++ b/drivers/dma/hisilicon/hisi_dmadev.c +@@ -634,7 +634,7 @@ hisi_dma_scan_cq(struct hisi_dma_dev *hw) + uint16_t count = 0; + uint64_t misc; + +- while (true) { ++ while (count < hw->cq_depth) { + cqe = &hw->cqe[cq_head]; + misc = cqe->misc; + misc = rte_le_to_cpu_64(misc); +@@ -642,6 +642,16 @@ hisi_dma_scan_cq(struct hisi_dma_dev *hw) + break; + + csq_head = FIELD_GET(CQE_SQ_HEAD_MASK, misc); ++ if (unlikely(csq_head > hw->sq_depth_mask)) { ++ /** ++ * Defensive programming to prevent overflow of the ++ * status array indexed by csq_head. Only error logs ++ * are used for prompting. ++ */ ++ HISI_DMA_ERR(hw, "invalid csq_head:%u!\n", csq_head); ++ count = 0; ++ break; ++ } + if (unlikely(misc & CQE_STATUS_MASK)) + hw->status[csq_head] = FIELD_GET(CQE_STATUS_MASK, + misc); +-- +2.22.0 + diff --git a/0104-net-hns3-add-reporting-tunnel-GRE-packet-type.patch b/0104-net-hns3-add-reporting-tunnel-GRE-packet-type.patch deleted file mode 100644 index 7583553e6bcc6fd58341551bdcfc8134e3ab9419..0000000000000000000000000000000000000000 --- a/0104-net-hns3-add-reporting-tunnel-GRE-packet-type.patch +++ /dev/null @@ -1,45 +0,0 @@ -From a501cc13ee7b3047e81233c9488a5782108ede68 Mon Sep 17 00:00:00 2001 -From: Chengwen Feng -Date: Tue, 13 Apr 2021 19:50:07 +0800 -Subject: [PATCH 104/189] net/hns3: add reporting tunnel GRE packet type - -This patch supports reporting TUNNEL GRE packet type when rxd advanced -layout enabled. - -Fixes: fb5e90694022 ("net/hns3: support Rx descriptor advanced layout") - -Signed-off-by: Chengwen Feng -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_rxtx.c | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - -diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c -index 7e9b762..db64578 100644 ---- a/drivers/net/hns3/hns3_rxtx.c -+++ b/drivers/net/hns3/hns3_rxtx.c -@@ -2074,8 +2074,8 @@ hns3_init_adv_layout_ptype(struct hns3_ptype_table *tbl) - RTE_PTYPE_L4_UDP; - ptype[20] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN | - RTE_PTYPE_L4_TCP; -- /* The next ptype is GRE over IPv4 */ -- ptype[21] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN; -+ ptype[21] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN | -+ RTE_PTYPE_TUNNEL_GRE; - ptype[22] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN | - RTE_PTYPE_L4_SCTP; - ptype[23] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV4_EXT_UNKNOWN | -@@ -2162,8 +2162,8 @@ hns3_init_adv_layout_ptype(struct hns3_ptype_table *tbl) - RTE_PTYPE_L4_UDP; - ptype[114] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN | - RTE_PTYPE_L4_TCP; -- /* The next ptype is GRE over IPv6 */ -- ptype[115] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN; -+ ptype[115] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN | -+ RTE_PTYPE_TUNNEL_GRE; - ptype[116] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN | - RTE_PTYPE_L4_SCTP; - ptype[117] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT_UNKNOWN | --- -2.7.4 - diff --git a/0105-net-failsafe-fix-device-freeing.patch b/0105-net-failsafe-fix-device-freeing.patch new file mode 100644 index 0000000000000000000000000000000000000000..8579b7c0229f1f952763a5cda019154dd060b4c6 --- /dev/null +++ b/0105-net-failsafe-fix-device-freeing.patch @@ -0,0 +1,37 @@ +From f74659ac42dca5d47b03de3b22010a0f45434137 Mon Sep 17 00:00:00 2001 +From: Yunjian Wang +Date: Tue, 7 Jun 2022 14:50:49 +0800 +Subject: [PATCH 105/122] net/failsafe: fix device freeing + +The PMD destroy function was calling the release function, which frees +dev->data->dev_private, and then tries to free PRIV(dev)->intr_handle, +which causes the heap use after free issue. + +The free can be moved to before the release function is called. + +Fixes: d61138d4f0e ("drivers: remove direct access to interrupt handle") +Cc: stable@dpdk.org + +Signed-off-by: Yunjian Wang +Reviewed-by: Andrew Rybchenko +--- + drivers/net/failsafe/failsafe.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/net/failsafe/failsafe.c b/drivers/net/failsafe/failsafe.c +index 3c754a5f66..05cf533896 100644 +--- a/drivers/net/failsafe/failsafe.c ++++ b/drivers/net/failsafe/failsafe.c +@@ -308,8 +308,8 @@ fs_rte_eth_free(const char *name) + if (dev == NULL) + return 0; /* port already released */ + ret = failsafe_eth_dev_close(dev); +- rte_eth_dev_release_port(dev); + rte_intr_instance_free(PRIV(dev)->intr_handle); ++ rte_eth_dev_release_port(dev); + return ret; + } + +-- +2.22.0 + diff --git a/0105-net-hns3-fix-PTP-capability-report.patch b/0105-net-hns3-fix-PTP-capability-report.patch deleted file mode 100644 index 14de7cce6aba96746b1332fdc12f562115152fc9..0000000000000000000000000000000000000000 --- a/0105-net-hns3-fix-PTP-capability-report.patch +++ /dev/null @@ -1,47 +0,0 @@ -From de73577fd9d4db0ea444cd88ab32b03f7d67e81f Mon Sep 17 00:00:00 2001 -From: Chengwen Feng -Date: Tue, 13 Apr 2021 19:50:08 +0800 -Subject: [PATCH 105/189] net/hns3: fix PTP capability report - -The PTP depends on special packet type reported by hardware which -enabled rxd advanced layout, so if the hardware doesn't support rxd -advanced layout, driver should ignore the PTP capability. - -Fixes: 438752358158 ("net/hns3: get device capability from firmware") -Cc: stable@dpdk.org - -Signed-off-by: Chengwen Feng -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_cmd.c | 15 +++++++++++++-- - 1 file changed, 13 insertions(+), 2 deletions(-) - -diff --git a/drivers/net/hns3/hns3_cmd.c b/drivers/net/hns3/hns3_cmd.c -index 58833ce..41e2caa 100644 ---- a/drivers/net/hns3/hns3_cmd.c -+++ b/drivers/net/hns3/hns3_cmd.c -@@ -422,8 +422,19 @@ hns3_parse_capability(struct hns3_hw *hw, - if (hns3_get_bit(caps, HNS3_CAPS_FD_QUEUE_REGION_B)) - hns3_set_bit(hw->capability, HNS3_DEV_SUPPORT_FD_QUEUE_REGION_B, - 1); -- if (hns3_get_bit(caps, HNS3_CAPS_PTP_B)) -- hns3_set_bit(hw->capability, HNS3_DEV_SUPPORT_PTP_B, 1); -+ if (hns3_get_bit(caps, HNS3_CAPS_PTP_B)) { -+ /* -+ * PTP depends on special packet type reported by hardware which -+ * enabled rxd advanced layout, so if the hardware doesn't -+ * support rxd advanced layout, driver should ignore the PTP -+ * capability. -+ */ -+ if (hns3_get_bit(caps, HNS3_CAPS_RXD_ADV_LAYOUT_B)) -+ hns3_set_bit(hw->capability, HNS3_DEV_SUPPORT_PTP_B, 1); -+ else -+ hns3_warn(hw, "ignore PTP capability due to lack of " -+ "rxd advanced layout capability."); -+ } - if (hns3_get_bit(caps, HNS3_CAPS_TX_PUSH_B)) - hns3_set_bit(hw->capability, HNS3_DEV_SUPPORT_TX_PUSH_B, 1); - if (hns3_get_bit(caps, HNS3_CAPS_PHY_IMP_B)) --- -2.7.4 - diff --git a/0106-net-hns3-list-supported-ptypes-for-advanced-Rx-descr.patch b/0106-net-hns3-list-supported-ptypes-for-advanced-Rx-descr.patch deleted file mode 100644 index 53475f736d74b2de1e676e5f3ebab2371ab79e88..0000000000000000000000000000000000000000 --- a/0106-net-hns3-list-supported-ptypes-for-advanced-Rx-descr.patch +++ /dev/null @@ -1,74 +0,0 @@ -From 80f567aff0391603b59243ef493730ec360caaba Mon Sep 17 00:00:00 2001 -From: Chengwen Feng -Date: Tue, 13 Apr 2021 19:50:10 +0800 -Subject: [PATCH 106/189] net/hns3: list supported ptypes for advanced Rx - descriptor - -Kunpeng 930 supports RXD advanced layout. If enabled the layout, the -hardware will report packet type by 8-bit PTYPE filed in the Rx -descriptor, and the supported ptypes are different from original -scheme. So this patch adds supported list for RXD advanced layout. - -Fixes: fb5e90694022 ("net/hns3: support Rx descriptor advanced layout") - -Signed-off-by: Chengwen Feng -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_rxtx.c | 37 +++++++++++++++++++++++++++++++++++-- - 1 file changed, 35 insertions(+), 2 deletions(-) - -diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c -index db64578..a37c3c1 100644 ---- a/drivers/net/hns3/hns3_rxtx.c -+++ b/drivers/net/hns3/hns3_rxtx.c -@@ -1991,12 +1991,45 @@ hns3_dev_supported_ptypes_get(struct rte_eth_dev *dev) - RTE_PTYPE_TUNNEL_NVGRE, - RTE_PTYPE_UNKNOWN - }; -+ static const uint32_t adv_layout_ptypes[] = { -+ RTE_PTYPE_L2_ETHER, -+ RTE_PTYPE_L2_ETHER_TIMESYNC, -+ RTE_PTYPE_L2_ETHER_LLDP, -+ RTE_PTYPE_L2_ETHER_ARP, -+ RTE_PTYPE_L3_IPV4_EXT_UNKNOWN, -+ RTE_PTYPE_L3_IPV6_EXT_UNKNOWN, -+ RTE_PTYPE_L4_FRAG, -+ RTE_PTYPE_L4_NONFRAG, -+ RTE_PTYPE_L4_UDP, -+ RTE_PTYPE_L4_TCP, -+ RTE_PTYPE_L4_SCTP, -+ RTE_PTYPE_L4_IGMP, -+ RTE_PTYPE_L4_ICMP, -+ RTE_PTYPE_TUNNEL_GRE, -+ RTE_PTYPE_TUNNEL_GRENAT, -+ RTE_PTYPE_INNER_L2_ETHER, -+ RTE_PTYPE_INNER_L3_IPV4_EXT_UNKNOWN, -+ RTE_PTYPE_INNER_L3_IPV6_EXT_UNKNOWN, -+ RTE_PTYPE_INNER_L4_FRAG, -+ RTE_PTYPE_INNER_L4_ICMP, -+ RTE_PTYPE_INNER_L4_NONFRAG, -+ RTE_PTYPE_INNER_L4_UDP, -+ RTE_PTYPE_INNER_L4_TCP, -+ RTE_PTYPE_INNER_L4_SCTP, -+ RTE_PTYPE_INNER_L4_ICMP, -+ RTE_PTYPE_UNKNOWN -+ }; -+ struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private); - - if (dev->rx_pkt_burst == hns3_recv_pkts || - dev->rx_pkt_burst == hns3_recv_scattered_pkts || - dev->rx_pkt_burst == hns3_recv_pkts_vec || -- dev->rx_pkt_burst == hns3_recv_pkts_vec_sve) -- return ptypes; -+ dev->rx_pkt_burst == hns3_recv_pkts_vec_sve) { -+ if (hns3_dev_rxd_adv_layout_supported(hw)) -+ return adv_layout_ptypes; -+ else -+ return ptypes; -+ } - - return NULL; - } --- -2.7.4 - diff --git a/0106-net-tap-fix-device-freeing.patch b/0106-net-tap-fix-device-freeing.patch new file mode 100644 index 0000000000000000000000000000000000000000..1468924e9b8a968bc4066fe6fee2592b572dc387 --- /dev/null +++ b/0106-net-tap-fix-device-freeing.patch @@ -0,0 +1,38 @@ +From 601f63e2f591a0b191c0ab0d4b39e826b15a0226 Mon Sep 17 00:00:00 2001 +From: Yunjian Wang +Date: Tue, 7 Jun 2022 14:50:57 +0800 +Subject: [PATCH 106/122] net/tap: fix device freeing + +The error path was calling rte_eth_dev_release_port() function, +which frees eth_dev->data->dev_private, and then tries to free +pmd->intr_handle, which causes the use after free issue. + +The free can be moved to before the release function is called. + +Fixes: d61138d4f0e ("drivers: remove direct access to interrupt handle") +Cc: stable@dpdk.org + +Signed-off-by: Xiangjun Meng +Signed-off-by: Yunjian Wang +Reviewed-by: Andrew Rybchenko +--- + drivers/net/tap/rte_eth_tap.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c +index f1b48cae82..ddca630574 100644 +--- a/drivers/net/tap/rte_eth_tap.c ++++ b/drivers/net/tap/rte_eth_tap.c +@@ -2099,8 +2099,8 @@ eth_dev_tap_create(struct rte_vdev_device *vdev, const char *tap_name, + close(pmd->ioctl_sock); + /* mac_addrs must not be freed alone because part of dev_private */ + dev->data->mac_addrs = NULL; +- rte_eth_dev_release_port(dev); + rte_intr_instance_free(pmd->intr_handle); ++ rte_eth_dev_release_port(dev); + + error_exit_nodev: + TAP_LOG(ERR, "%s Unable to initialize %s", +-- +2.22.0 + diff --git a/0107-net-bonding-fix-RSS-inconsistent-between-bonded-and-.patch b/0107-net-bonding-fix-RSS-inconsistent-between-bonded-and-.patch new file mode 100644 index 0000000000000000000000000000000000000000..08130dfbdacb65cb6048df834ff7e1fef626c1d1 --- /dev/null +++ b/0107-net-bonding-fix-RSS-inconsistent-between-bonded-and-.patch @@ -0,0 +1,43 @@ +From 440f7e8f67673b8482d1b8e779ea93603f37c21f Mon Sep 17 00:00:00 2001 +From: Huisong Li +Date: Wed, 8 Jun 2022 19:45:47 +0800 +Subject: [PATCH 107/122] net/bonding: fix RSS inconsistent between bonded and + slaves + +Currently, RSS configuration of slave is set only when RSS is enabled for +bonded port. If RSS is enabled for the slaves port before adding to the +bonded port with disabling RSS, it will run into that the RSS enabled state +of bonded and slaves port is inconsistent after starting bonded port. +So the RSS configuration of slave should also be set when RSS is disabled +for bonded port. + +Fixes: 734ce47f71e0 ("bonding: support RSS dynamic configuration") +Cc: stable@dpdk.org + +Signed-off-by: Huisong Li +Signed-off-by: Dongdong Liu +Reviewed-by: Andrew Rybchenko +--- + drivers/net/bonding/rte_eth_bond_pmd.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c +index 0d6f0a30d1..09636321cd 100644 +--- a/drivers/net/bonding/rte_eth_bond_pmd.c ++++ b/drivers/net/bonding/rte_eth_bond_pmd.c +@@ -1711,6 +1711,12 @@ slave_configure(struct rte_eth_dev *bonded_eth_dev, + bonded_eth_dev->data->dev_conf.rx_adv_conf.rss_conf.rss_hf; + slave_eth_dev->data->dev_conf.rxmode.mq_mode = + bonded_eth_dev->data->dev_conf.rxmode.mq_mode; ++ } else { ++ slave_eth_dev->data->dev_conf.rx_adv_conf.rss_conf.rss_key_len = 0; ++ slave_eth_dev->data->dev_conf.rx_adv_conf.rss_conf.rss_key = NULL; ++ slave_eth_dev->data->dev_conf.rx_adv_conf.rss_conf.rss_hf = 0; ++ slave_eth_dev->data->dev_conf.rxmode.mq_mode = ++ bonded_eth_dev->data->dev_conf.rxmode.mq_mode; + } + + slave_eth_dev->data->dev_conf.rxmode.mtu = +-- +2.22.0 + diff --git a/0107-net-hns3-remove-VLAN-QinQ-ptypes-from-support-list.patch b/0107-net-hns3-remove-VLAN-QinQ-ptypes-from-support-list.patch deleted file mode 100644 index 5df13d59fc85e0ec84d22e2399104eb4cc223d8b..0000000000000000000000000000000000000000 --- a/0107-net-hns3-remove-VLAN-QinQ-ptypes-from-support-list.patch +++ /dev/null @@ -1,49 +0,0 @@ -From e535bf3131e855ad973c309ec6c5b35e627751aa Mon Sep 17 00:00:00 2001 -From: Chengwen Feng -Date: Tue, 13 Apr 2021 19:50:11 +0800 -Subject: [PATCH 107/189] net/hns3: remove VLAN/QinQ ptypes from support list - -In the previous patch, driver will calculate packet type by ignoring -VLAN information because the packet type may calculate error when -exist VLAN and VLAN strip. - -So here remove the following ptypes from support list: -1) RTE_PTYPE_L2_ETHER_VLAN -2) RTE_PTYPE_L2_ETHER_QINQ -3) RTE_PTYPE_INNER_L2_ETHER_VLAN -4) RTE_PTYPE_INNER_L2_ETHER_QINQ - -Fixes: bba636698316 ("net/hns3: support Rx/Tx and related operations") -Cc: stable@dpdk.org - -Signed-off-by: Chengwen Feng -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_rxtx.c | 4 ---- - 1 file changed, 4 deletions(-) - -diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c -index a37c3c1..43f8c64 100644 ---- a/drivers/net/hns3/hns3_rxtx.c -+++ b/drivers/net/hns3/hns3_rxtx.c -@@ -1962,8 +1962,6 @@ hns3_dev_supported_ptypes_get(struct rte_eth_dev *dev) - { - static const uint32_t ptypes[] = { - RTE_PTYPE_L2_ETHER, -- RTE_PTYPE_L2_ETHER_VLAN, -- RTE_PTYPE_L2_ETHER_QINQ, - RTE_PTYPE_L2_ETHER_LLDP, - RTE_PTYPE_L2_ETHER_ARP, - RTE_PTYPE_L3_IPV4, -@@ -1977,8 +1975,6 @@ hns3_dev_supported_ptypes_get(struct rte_eth_dev *dev) - RTE_PTYPE_L4_UDP, - RTE_PTYPE_TUNNEL_GRE, - RTE_PTYPE_INNER_L2_ETHER, -- RTE_PTYPE_INNER_L2_ETHER_VLAN, -- RTE_PTYPE_INNER_L2_ETHER_QINQ, - RTE_PTYPE_INNER_L3_IPV4, - RTE_PTYPE_INNER_L3_IPV6, - RTE_PTYPE_INNER_L3_IPV4_EXT, --- -2.7.4 - diff --git a/0108-app-test-fix-bonding-RSS-test-when-disable-RSS.patch b/0108-app-test-fix-bonding-RSS-test-when-disable-RSS.patch new file mode 100644 index 0000000000000000000000000000000000000000..435cc1836e9a8dfee21abd892a571446d2a59a7a --- /dev/null +++ b/0108-app-test-fix-bonding-RSS-test-when-disable-RSS.patch @@ -0,0 +1,129 @@ +From 36c97bb881ddd7caaf8d9e3885a747880024c3fd Mon Sep 17 00:00:00 2001 +From: Huisong Li +Date: Wed, 8 Jun 2022 19:45:48 +0800 +Subject: [PATCH 108/122] app/test: fix bonding RSS test when disable RSS + +The "test_rss_lazy" test is used for testing bonding RSS functions +when bonded port disable RSS. Currently, this test case can update +RSS functions of bonded and slave port if bonded port turns off RSS. +It is unreasonable and has been adjusted to be non-updateable in +following patch: +"93e1ea6dfa99 ethdev: fix RSS update when RSS is disabled" + +So this patch fixes this test code. + +Fixes: 43b630244e7e ("app/test: add dynamic bonding RSS configuration") +Cc: stable@dpdk.org + +Signed-off-by: Huisong Li +Signed-off-by: Dongdong Liu +--- + app/test/test_link_bonding_rssconf.c | 78 ++++++++++++++++++++++++++-- + 1 file changed, 73 insertions(+), 5 deletions(-) + +diff --git a/app/test/test_link_bonding_rssconf.c b/app/test/test_link_bonding_rssconf.c +index f9eae93973..a5aba6b2b9 100644 +--- a/app/test/test_link_bonding_rssconf.c ++++ b/app/test/test_link_bonding_rssconf.c +@@ -464,15 +464,85 @@ test_rss(void) + + TEST_ASSERT_SUCCESS(test_propagate(), "Propagation test failed"); + +- TEST_ASSERT(slave_remove_and_add() == 1, "New slave should be synced"); ++ TEST_ASSERT(slave_remove_and_add() == 1, "remove and add slaves success."); + + remove_slaves_and_stop_bonded_device(); + + return TEST_SUCCESS; + } + ++ ++/** ++ * Test RSS configuration over bonded and slaves. ++ */ ++static int ++test_rss_config_lazy(void) ++{ ++ struct rte_eth_rss_conf bond_rss_conf = {0}; ++ struct slave_conf *port; ++ uint8_t rss_key[40]; ++ uint64_t rss_hf; ++ int retval; ++ uint16_t i; ++ uint8_t n; ++ ++ retval = rte_eth_dev_info_get(test_params.bond_port_id, ++ &test_params.bond_dev_info); ++ TEST_ASSERT((retval == 0), "Error during getting device (port %u) info: %s\n", ++ test_params.bond_port_id, strerror(-retval)); ++ ++ rss_hf = test_params.bond_dev_info.flow_type_rss_offloads; ++ if (rss_hf != 0) { ++ bond_rss_conf.rss_key = NULL; ++ bond_rss_conf.rss_hf = rss_hf; ++ retval = rte_eth_dev_rss_hash_update(test_params.bond_port_id, ++ &bond_rss_conf); ++ TEST_ASSERT(retval != 0, "Succeeded in setting bonded port hash function"); ++ } ++ ++ /* Set all keys to zero for all slaves */ ++ FOR_EACH_PORT(n, port) { ++ port = &test_params.slave_ports[n]; ++ retval = rte_eth_dev_rss_hash_conf_get(port->port_id, ++ &port->rss_conf); ++ TEST_ASSERT_SUCCESS(retval, "Cannot get slaves RSS configuration"); ++ memset(port->rss_key, 0, sizeof(port->rss_key)); ++ port->rss_conf.rss_key = port->rss_key; ++ port->rss_conf.rss_key_len = sizeof(port->rss_key); ++ retval = rte_eth_dev_rss_hash_update(port->port_id, ++ &port->rss_conf); ++ TEST_ASSERT(retval != 0, "Succeeded in setting slaves RSS keys"); ++ } ++ ++ /* Set RSS keys for bonded port */ ++ memset(rss_key, 1, sizeof(rss_key)); ++ bond_rss_conf.rss_hf = rss_hf; ++ bond_rss_conf.rss_key = rss_key; ++ bond_rss_conf.rss_key_len = sizeof(rss_key); ++ ++ retval = rte_eth_dev_rss_hash_update(test_params.bond_port_id, ++ &bond_rss_conf); ++ TEST_ASSERT(retval != 0, "Succeeded in setting bonded port RSS keys"); ++ ++ /* Test RETA propagation */ ++ for (i = 0; i < RXTX_QUEUE_COUNT; i++) { ++ FOR_EACH_PORT(n, port) { ++ port = &test_params.slave_ports[n]; ++ retval = reta_set(port->port_id, (i + 1) % RXTX_QUEUE_COUNT, ++ port->dev_info.reta_size); ++ TEST_ASSERT(retval != 0, "Succeeded in setting slaves RETA"); ++ } ++ ++ retval = reta_set(test_params.bond_port_id, i % RXTX_QUEUE_COUNT, ++ test_params.bond_dev_info.reta_size); ++ TEST_ASSERT(retval != 0, "Succeeded in setting bonded port RETA"); ++ } ++ ++ return TEST_SUCCESS; ++} ++ + /** +- * Test propagation logic, when RX_RSS mq_mode is turned off for bonding port ++ * Test RSS function logic, when RX_RSS mq_mode is turned off for bonding port + */ + static int + test_rss_lazy(void) +@@ -493,9 +563,7 @@ test_rss_lazy(void) + TEST_ASSERT_SUCCESS(rte_eth_dev_start(test_params.bond_port_id), + "Failed to start bonding port (%d).", test_params.bond_port_id); + +- TEST_ASSERT_SUCCESS(test_propagate(), "Propagation test failed"); +- +- TEST_ASSERT(slave_remove_and_add() == 0, "New slave shouldn't be synced"); ++ TEST_ASSERT_SUCCESS(test_rss_config_lazy(), "Succeeded in setting RSS hash when RX_RSS mq_mode is turned off"); + + remove_slaves_and_stop_bonded_device(); + +-- +2.22.0 + diff --git a/0108-net-hns3-fix-supported-speed-of-copper-ports.patch b/0108-net-hns3-fix-supported-speed-of-copper-ports.patch deleted file mode 100644 index 692973d17195d58a5af778141e4d75ab5e4a4eb1..0000000000000000000000000000000000000000 --- a/0108-net-hns3-fix-supported-speed-of-copper-ports.patch +++ /dev/null @@ -1,75 +0,0 @@ -From aab52c0cbdfbd5c05a8589d08bcdbaa6f34739be Mon Sep 17 00:00:00 2001 -From: Huisong Li -Date: Tue, 13 Apr 2021 21:47:11 +0800 -Subject: [PATCH 108/189] net/hns3: fix supported speed of copper ports - -The "supported capability" obtained from firmware on copper ports -includes the speed capability, auto-negotiation capability, and flow -control capability. Therefore, this patch changes "supported_capa" to -"supported_speed" and parses the speed capability supported by the -driver from the "supported capability". - -Fixes: 2e4859f3b362 ("net/hns3: support PF device with copper PHYs") - -Signed-off-by: Huisong Li -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_ethdev.c | 11 +++++++---- - drivers/net/hns3/hns3_ethdev.h | 2 +- - 2 files changed, 8 insertions(+), 5 deletions(-) - -diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c -index a06fdc9..e57163b 100644 ---- a/drivers/net/hns3/hns3_ethdev.c -+++ b/drivers/net/hns3/hns3_ethdev.c -@@ -4612,7 +4612,10 @@ hns3_update_fiber_link_info(struct hns3_hw *hw) - static void - hns3_parse_copper_phy_params(struct hns3_cmd_desc *desc, struct hns3_mac *mac) - { -+#define HNS3_PHY_SUPPORTED_SPEED_MASK 0x2f -+ - struct hns3_phy_params_bd0_cmd *req; -+ uint32_t supported; - - req = (struct hns3_phy_params_bd0_cmd *)desc[0].data; - mac->link_speed = rte_le_to_cpu_32(req->speed); -@@ -4620,11 +4623,11 @@ hns3_parse_copper_phy_params(struct hns3_cmd_desc *desc, struct hns3_mac *mac) - HNS3_PHY_DUPLEX_CFG_B); - mac->link_autoneg = hns3_get_bit(req->autoneg, - HNS3_PHY_AUTONEG_CFG_B); -- mac->supported_capa = rte_le_to_cpu_32(req->supported); - mac->advertising = rte_le_to_cpu_32(req->advertising); - mac->lp_advertising = rte_le_to_cpu_32(req->lp_advertising); -- mac->support_autoneg = !!(mac->supported_capa & -- HNS3_PHY_LINK_MODE_AUTONEG_BIT); -+ supported = rte_le_to_cpu_32(req->supported); -+ mac->supported_speed = supported & HNS3_PHY_SUPPORTED_SPEED_MASK; -+ mac->support_autoneg = !!(supported & HNS3_PHY_LINK_MODE_AUTONEG_BIT); - } - - static int -@@ -4673,7 +4676,7 @@ hns3_update_copper_link_info(struct hns3_hw *hw) - mac->link_speed = mac_info.link_speed; - mac->link_duplex = mac_info.link_duplex; - mac->link_autoneg = mac_info.link_autoneg; -- mac->supported_capa = mac_info.supported_capa; -+ mac->supported_speed = mac_info.supported_speed; - mac->advertising = mac_info.advertising; - mac->lp_advertising = mac_info.lp_advertising; - mac->support_autoneg = mac_info.support_autoneg; -diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h -index 1763cc9..986bf26 100644 ---- a/drivers/net/hns3/hns3_ethdev.h -+++ b/drivers/net/hns3/hns3_ethdev.h -@@ -183,7 +183,7 @@ struct hns3_mac { - uint8_t link_autoneg : 1; /* ETH_LINK_[AUTONEG/FIXED] */ - uint8_t link_status : 1; /* ETH_LINK_[DOWN/UP] */ - uint32_t link_speed; /* ETH_SPEED_NUM_ */ -- uint32_t supported_capa; /* supported capability for current media */ -+ uint32_t supported_speed; /* supported speed for current media type */ - uint32_t advertising; /* advertised capability in the local part */ - /* advertised capability in the link partner */ - uint32_t lp_advertising; --- -2.7.4 - diff --git a/0109-net-hns3-add-1000M-speed-bit-for-copper-PHYs.patch b/0109-net-hns3-add-1000M-speed-bit-for-copper-PHYs.patch deleted file mode 100644 index 07e60e73da94ec9c419c5cda02ec7297036a8399..0000000000000000000000000000000000000000 --- a/0109-net-hns3-add-1000M-speed-bit-for-copper-PHYs.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 8000e1aa7b8666b401153b6e31519b62d1423aa3 Mon Sep 17 00:00:00 2001 -From: Huisong Li -Date: Tue, 13 Apr 2021 21:47:12 +0800 -Subject: [PATCH 109/189] net/hns3: add 1000M speed bit for copper PHYs - -The bit(5) of supported, advertising and lp_advertising for copper -PHYs obtained from the firmware indicates 1000M full-duplex. This -speed capability bit is missing in the current codes. - -Fixes: 2e4859f3b362 ("net/hns3: support PF device with copper PHYs") - -Signed-off-by: Huisong Li -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_cmd.h | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/drivers/net/hns3/hns3_cmd.h b/drivers/net/hns3/hns3_cmd.h -index 9a975b8..a7dd2b5 100644 ---- a/drivers/net/hns3/hns3_cmd.h -+++ b/drivers/net/hns3/hns3_cmd.h -@@ -679,6 +679,7 @@ struct hns3_firmware_compat_cmd { - #define HNS3_PHY_LINK_SPEED_10M_BIT BIT(1) - #define HNS3_PHY_LINK_SPEED_100M_HD_BIT BIT(2) - #define HNS3_PHY_LINK_SPEED_100M_BIT BIT(3) -+#define HNS3_PHY_LINK_SPEED_1000M_BIT BIT(5) - #define HNS3_PHY_LINK_MODE_AUTONEG_BIT BIT(6) - #define HNS3_PHY_LINK_MODE_PAUSE_BIT BIT(13) - #define HNS3_PHY_LINK_MODE_ASYM_PAUSE_BIT BIT(14) --- -2.7.4 - diff --git a/0109-net-hns3-add-check-for-deferred-start-queue-when-rol.patch b/0109-net-hns3-add-check-for-deferred-start-queue-when-rol.patch new file mode 100644 index 0000000000000000000000000000000000000000..bf17159205ae52268a9c6b58970bbb63a5713a9b --- /dev/null +++ b/0109-net-hns3-add-check-for-deferred-start-queue-when-rol.patch @@ -0,0 +1,32 @@ +From 256f7ae943d4c15cca9cdf11ce84d4c8b536ad20 Mon Sep 17 00:00:00 2001 +From: Huisong Li +Date: Wed, 1 Jun 2022 11:52:41 +0800 +Subject: [PATCH 109/122] net/hns3: add check for deferred start queue when + rollback + +Driver doesn't allocate mbufs for the deferred start queues, so no need to +free it when rollback. + +Signed-off-by: Huisong Li +Signed-off-by: Min Hu (Connor) +--- + drivers/net/hns3/hns3_rxtx.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c +index d3fa4889d2..a9b997d32e 100644 +--- a/drivers/net/hns3/hns3_rxtx.c ++++ b/drivers/net/hns3/hns3_rxtx.c +@@ -1202,6 +1202,9 @@ hns3_init_rx_queues(struct hns3_adapter *hns) + out: + for (j = 0; j < i; j++) { + rxq = (struct hns3_rx_queue *)hw->data->rx_queues[j]; ++ if (rxq->rx_deferred_start) ++ continue; ++ + hns3_rx_queue_release_mbufs(rxq); + } + +-- +2.22.0 + diff --git a/0110-net-hns3-fix-flow-control-mode.patch b/0110-net-hns3-fix-flow-control-mode.patch deleted file mode 100644 index 785897c376f317219cae54522024ae48f79fdfcc..0000000000000000000000000000000000000000 --- a/0110-net-hns3-fix-flow-control-mode.patch +++ /dev/null @@ -1,245 +0,0 @@ -From ad7b090b87b90f4348cc257b22f4253e466e46f3 Mon Sep 17 00:00:00 2001 -From: Huisong Li -Date: Tue, 13 Apr 2021 21:47:13 +0800 -Subject: [PATCH 110/189] net/hns3: fix flow control mode - -Currently, hns3 driver doesn't support to flow control auto-negotiation. -The FC mode requested by user is the same as the current FC mode. It is -not necessary to maintain the current FC mode. We only report the current -FC mode based on actual flow control mode in hns3_flow_ctrl_get(). - -This patch removes this redundant field. In addition, "requested_mode" in -hns3_hw struct indicates the FC mode requested by user, and the name is -unreasonable. It needs to be modified to "requested_fc_mode". - -Fixes: 62e3ccc2b94c ("net/hns3: support flow control") -Cc: stable@dpdk.org - -Signed-off-by: Huisong Li -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_dcb.c | 23 ++++++++--------------- - drivers/net/hns3/hns3_ethdev.c | 28 ++++++++++------------------ - drivers/net/hns3/hns3_ethdev.h | 3 +-- - 3 files changed, 19 insertions(+), 35 deletions(-) - -diff --git a/drivers/net/hns3/hns3_dcb.c b/drivers/net/hns3/hns3_dcb.c -index ebfc240..49b8be7 100644 ---- a/drivers/net/hns3/hns3_dcb.c -+++ b/drivers/net/hns3/hns3_dcb.c -@@ -1238,7 +1238,7 @@ hns3_qs_bp_cfg(struct hns3_hw *hw, uint8_t tc, uint8_t grp_id, uint32_t bit_map) - static void - hns3_get_rx_tx_en_status(struct hns3_hw *hw, bool *tx_en, bool *rx_en) - { -- switch (hw->current_mode) { -+ switch (hw->requested_fc_mode) { - case HNS3_FC_NONE: - *tx_en = false; - *rx_en = false; -@@ -1415,7 +1415,7 @@ hns3_dcb_cfg_validate(struct hns3_adapter *hns, uint8_t *tc, bool *changed) - * We ensure that dcb information can be reconfigured - * after the hns3_priority_flow_ctrl_set function called. - */ -- if (hw->current_mode != HNS3_FC_FULL) -+ if (hw->requested_fc_mode != HNS3_FC_FULL) - *changed = true; - pfc_en = RTE_LEN2MASK((uint8_t)dcb_rx_conf->nb_tcs, uint8_t); - if (hw->dcb_info.pfc_en != pfc_en) -@@ -1529,7 +1529,7 @@ hns3_dcb_hw_configure(struct hns3_adapter *hns) - struct hns3_pf *pf = &hns->pf; - struct hns3_hw *hw = &hns->hw; - enum hns3_fc_status fc_status = hw->current_fc_status; -- enum hns3_fc_mode current_mode = hw->current_mode; -+ enum hns3_fc_mode requested_fc_mode = hw->requested_fc_mode; - uint8_t hw_pfc_map = hw->dcb_info.hw_pfc_map; - int ret, status; - -@@ -1559,7 +1559,7 @@ hns3_dcb_hw_configure(struct hns3_adapter *hns) - return ret; - - hw->current_fc_status = HNS3_FC_STATUS_PFC; -- hw->current_mode = HNS3_FC_FULL; -+ hw->requested_fc_mode = HNS3_FC_FULL; - ret = hns3_dcb_pause_setup_hw(hw); - if (ret) { - hns3_err(hw, "setup pfc failed! ret = %d", ret); -@@ -1580,7 +1580,7 @@ hns3_dcb_hw_configure(struct hns3_adapter *hns) - return 0; - - pfc_setup_fail: -- hw->current_mode = current_mode; -+ hw->requested_fc_mode = requested_fc_mode; - hw->current_fc_status = fc_status; - hw->dcb_info.hw_pfc_map = hw_pfc_map; - status = hns3_buffer_alloc(hw); -@@ -1659,8 +1659,7 @@ hns3_dcb_init(struct hns3_hw *hw) - * will be changed. - */ - if (hw->adapter_state == HNS3_NIC_UNINITIALIZED) { -- hw->requested_mode = HNS3_FC_NONE; -- hw->current_mode = hw->requested_mode; -+ hw->requested_fc_mode = HNS3_FC_NONE; - pf->pause_time = HNS3_DEFAULT_PAUSE_TRANS_TIME; - hw->current_fc_status = HNS3_FC_STATUS_NONE; - -@@ -1761,7 +1760,6 @@ hns3_dcb_pfc_enable(struct rte_eth_dev *dev, struct rte_eth_pfc_conf *pfc_conf) - struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private); - struct hns3_pf *pf = HNS3_DEV_PRIVATE_TO_PF(dev->data->dev_private); - enum hns3_fc_status fc_status = hw->current_fc_status; -- enum hns3_fc_mode current_mode = hw->current_mode; - uint8_t hw_pfc_map = hw->dcb_info.hw_pfc_map; - uint8_t pfc_en = hw->dcb_info.pfc_en; - uint8_t priority = pfc_conf->priority; -@@ -1769,7 +1767,6 @@ hns3_dcb_pfc_enable(struct rte_eth_dev *dev, struct rte_eth_pfc_conf *pfc_conf) - int ret, status; - - pf->pause_time = pfc_conf->fc.pause_time; -- hw->current_mode = hw->requested_mode; - hw->current_fc_status = HNS3_FC_STATUS_PFC; - hw->dcb_info.pfc_en |= BIT(priority); - hw->dcb_info.hw_pfc_map = -@@ -1780,7 +1777,7 @@ hns3_dcb_pfc_enable(struct rte_eth_dev *dev, struct rte_eth_pfc_conf *pfc_conf) - - /* - * The flow control mode of all UPs will be changed based on -- * current_mode coming from user. -+ * requested_fc_mode coming from user. - */ - ret = hns3_dcb_pause_setup_hw(hw); - if (ret) { -@@ -1791,7 +1788,6 @@ hns3_dcb_pfc_enable(struct rte_eth_dev *dev, struct rte_eth_pfc_conf *pfc_conf) - return 0; - - pfc_setup_fail: -- hw->current_mode = current_mode; - hw->current_fc_status = fc_status; - pf->pause_time = pause_time; - hw->dcb_info.pfc_en = pfc_en; -@@ -1815,18 +1811,16 @@ hns3_fc_enable(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf) - struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private); - struct hns3_pf *pf = HNS3_DEV_PRIVATE_TO_PF(dev->data->dev_private); - enum hns3_fc_status fc_status = hw->current_fc_status; -- enum hns3_fc_mode current_mode = hw->current_mode; - uint16_t pause_time = pf->pause_time; - int ret; - - pf->pause_time = fc_conf->pause_time; -- hw->current_mode = hw->requested_mode; - - /* - * In fact, current_fc_status is HNS3_FC_STATUS_NONE when mode - * of flow control is configured to be HNS3_FC_NONE. - */ -- if (hw->current_mode == HNS3_FC_NONE) -+ if (hw->requested_fc_mode == HNS3_FC_NONE) - hw->current_fc_status = HNS3_FC_STATUS_NONE; - else - hw->current_fc_status = HNS3_FC_STATUS_MAC_PAUSE; -@@ -1840,7 +1834,6 @@ hns3_fc_enable(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf) - return 0; - - setup_fc_fail: -- hw->current_mode = current_mode; - hw->current_fc_status = fc_status; - pf->pause_time = pause_time; - -diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c -index e57163b..5e7ac54 100644 ---- a/drivers/net/hns3/hns3_ethdev.c -+++ b/drivers/net/hns3/hns3_ethdev.c -@@ -5496,8 +5496,11 @@ hns3_flow_ctrl_get(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf) - - fc_conf->pause_time = pf->pause_time; - -- /* return fc current mode */ -- switch (hw->current_mode) { -+ /* -+ * If fc auto-negotiation is not supported, the configured fc mode -+ * from user is the current fc mode. -+ */ -+ switch (hw->requested_fc_mode) { - case HNS3_FC_FULL: - fc_conf->mode = RTE_FC_FULL; - break; -@@ -5521,19 +5524,19 @@ hns3_get_fc_mode(struct hns3_hw *hw, enum rte_eth_fc_mode mode) - { - switch (mode) { - case RTE_FC_NONE: -- hw->requested_mode = HNS3_FC_NONE; -+ hw->requested_fc_mode = HNS3_FC_NONE; - break; - case RTE_FC_RX_PAUSE: -- hw->requested_mode = HNS3_FC_RX_PAUSE; -+ hw->requested_fc_mode = HNS3_FC_RX_PAUSE; - break; - case RTE_FC_TX_PAUSE: -- hw->requested_mode = HNS3_FC_TX_PAUSE; -+ hw->requested_fc_mode = HNS3_FC_TX_PAUSE; - break; - case RTE_FC_FULL: -- hw->requested_mode = HNS3_FC_FULL; -+ hw->requested_fc_mode = HNS3_FC_FULL; - break; - default: -- hw->requested_mode = HNS3_FC_NONE; -+ hw->requested_fc_mode = HNS3_FC_NONE; - hns3_warn(hw, "fc_mode(%u) exceeds member scope and is " - "configured to RTE_FC_NONE", mode); - break; -@@ -5544,7 +5547,6 @@ static int - hns3_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf) - { - struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private); -- struct hns3_pf *pf = HNS3_DEV_PRIVATE_TO_PF(dev->data->dev_private); - int ret; - - if (fc_conf->high_water || fc_conf->low_water || -@@ -5579,9 +5581,6 @@ hns3_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf) - } - - hns3_get_fc_mode(hw, fc_conf->mode); -- if (hw->requested_mode == hw->current_mode && -- pf->pause_time == fc_conf->pause_time) -- return 0; - - rte_spinlock_lock(&hw->lock); - ret = hns3_fc_enable(dev, fc_conf); -@@ -5595,8 +5594,6 @@ hns3_priority_flow_ctrl_set(struct rte_eth_dev *dev, - struct rte_eth_pfc_conf *pfc_conf) - { - struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private); -- struct hns3_pf *pf = HNS3_DEV_PRIVATE_TO_PF(dev->data->dev_private); -- uint8_t priority; - int ret; - - if (!hns3_dev_dcb_supported(hw)) { -@@ -5631,12 +5628,7 @@ hns3_priority_flow_ctrl_set(struct rte_eth_dev *dev, - return -EOPNOTSUPP; - } - -- priority = pfc_conf->priority; - hns3_get_fc_mode(hw, pfc_conf->fc.mode); -- if (hw->dcb_info.pfc_en & BIT(priority) && -- hw->requested_mode == hw->current_mode && -- pfc_conf->fc.pause_time == pf->pause_time) -- return 0; - - rte_spinlock_lock(&hw->lock); - ret = hns3_dcb_pfc_enable(dev, pfc_conf); -diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h -index 986bf26..03bb783 100644 ---- a/drivers/net/hns3/hns3_ethdev.h -+++ b/drivers/net/hns3/hns3_ethdev.h -@@ -469,8 +469,7 @@ struct hns3_hw { - - uint8_t num_tc; /* Total number of enabled TCs */ - uint8_t hw_tc_map; -- enum hns3_fc_mode current_mode; -- enum hns3_fc_mode requested_mode; -+ enum hns3_fc_mode requested_fc_mode; /* FC mode requested by user */ - struct hns3_dcb_info dcb_info; - enum hns3_fc_status current_fc_status; /* current flow control status */ - struct hns3_tc_queue_info tc_queue[HNS3_MAX_TC_NUM]; --- -2.7.4 - diff --git a/0110-net-hns3-remove-redundant-parentheses.patch b/0110-net-hns3-remove-redundant-parentheses.patch new file mode 100644 index 0000000000000000000000000000000000000000..dd641e0e2aecc00c8a1f643a5653c97effab8314 --- /dev/null +++ b/0110-net-hns3-remove-redundant-parentheses.patch @@ -0,0 +1,38 @@ +From e4fd147156e0b915ff6787824889bb552965ebfd Mon Sep 17 00:00:00 2001 +From: Huisong Li +Date: Wed, 1 Jun 2022 11:52:42 +0800 +Subject: [PATCH 110/122] net/hns3: remove redundant parentheses + +Remove redundant parentheses. + +Signed-off-by: Huisong Li +Signed-off-by: Min Hu (Connor) +--- + drivers/net/hns3/hns3_rxtx.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c +index a9b997d32e..ee0aaaf7fc 100644 +--- a/drivers/net/hns3/hns3_rxtx.c ++++ b/drivers/net/hns3/hns3_rxtx.c +@@ -170,7 +170,7 @@ hns3_fake_rx_queue_release(struct hns3_rx_queue *queue) + } + + /* free fake rx queue arrays */ +- if (idx == (hw->fkq_data.nb_fake_rx_queues - 1)) { ++ if (idx == hw->fkq_data.nb_fake_rx_queues - 1) { + hw->fkq_data.nb_fake_rx_queues = 0; + rte_free(hw->fkq_data.rx_queues); + hw->fkq_data.rx_queues = NULL; +@@ -197,7 +197,7 @@ hns3_fake_tx_queue_release(struct hns3_tx_queue *queue) + } + + /* free fake tx queue arrays */ +- if (idx == (hw->fkq_data.nb_fake_tx_queues - 1)) { ++ if (idx == hw->fkq_data.nb_fake_tx_queues - 1) { + hw->fkq_data.nb_fake_tx_queues = 0; + rte_free(hw->fkq_data.tx_queues); + hw->fkq_data.tx_queues = NULL; +-- +2.22.0 + diff --git a/0111-net-hns3-adjust-the-data-type-of-some-variables.patch b/0111-net-hns3-adjust-the-data-type-of-some-variables.patch new file mode 100644 index 0000000000000000000000000000000000000000..061bda51483288c654d42988829a450be57b19b3 --- /dev/null +++ b/0111-net-hns3-adjust-the-data-type-of-some-variables.patch @@ -0,0 +1,227 @@ +From ca3ada1984f4c159ae2c7e94c82f38d0f239ba84 Mon Sep 17 00:00:00 2001 +From: Huisong Li +Date: Wed, 1 Jun 2022 11:52:43 +0800 +Subject: [PATCH 111/122] net/hns3: adjust the data type of some variables + +Using the 'int' type and 'uint16_t' type to compare is insecure. +Make them consistent. + +Signed-off-by: Huisong Li +Signed-off-by: Min Hu (Connor) +--- + drivers/net/hns3/hns3_common.c | 4 ++-- + drivers/net/hns3/hns3_dcb.c | 2 +- + drivers/net/hns3/hns3_ethdev.c | 2 +- + drivers/net/hns3/hns3_regs.c | 2 +- + drivers/net/hns3/hns3_rss.c | 2 +- + drivers/net/hns3/hns3_rxtx.c | 23 ++++++++++++----------- + drivers/net/hns3/hns3_rxtx_vec.h | 4 ++-- + 7 files changed, 20 insertions(+), 19 deletions(-) + +diff --git a/drivers/net/hns3/hns3_common.c b/drivers/net/hns3/hns3_common.c +index 9c86c00a04..edd16d8076 100644 +--- a/drivers/net/hns3/hns3_common.c ++++ b/drivers/net/hns3/hns3_common.c +@@ -475,7 +475,7 @@ hns3_configure_all_mac_addr(struct hns3_adapter *hns, bool del) + struct rte_ether_addr *addr; + uint16_t mac_addrs_capa; + int ret = 0; +- int i; ++ uint16_t i; + + mac_addrs_capa = + hns->is_vf ? HNS3_VF_UC_MACADDR_NUM : HNS3_UC_MACADDR_NUM; +@@ -645,8 +645,8 @@ int + hns3_init_ring_with_vector(struct hns3_hw *hw) + { + uint16_t vec; ++ uint16_t i; + int ret; +- int i; + + /* + * In hns3 network engine, vector 0 is always the misc interrupt of this +diff --git a/drivers/net/hns3/hns3_dcb.c b/drivers/net/hns3/hns3_dcb.c +index 136ada626b..d88757611c 100644 +--- a/drivers/net/hns3/hns3_dcb.c ++++ b/drivers/net/hns3/hns3_dcb.c +@@ -628,7 +628,7 @@ hns3_set_rss_size(struct hns3_hw *hw, uint16_t nb_rx_q) + struct hns3_rss_conf *rss_cfg = &hw->rss_info; + uint16_t rx_qnum_per_tc; + uint16_t used_rx_queues; +- int i; ++ uint16_t i; + + rx_qnum_per_tc = nb_rx_q / hw->num_tc; + if (rx_qnum_per_tc > hw->rss_size_max) { +diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c +index 29c9f96c05..97cf27d2a1 100644 +--- a/drivers/net/hns3/hns3_ethdev.c ++++ b/drivers/net/hns3/hns3_ethdev.c +@@ -2929,8 +2929,8 @@ hns3_map_tqps_to_func(struct hns3_hw *hw, uint16_t func_id, uint16_t tqp_pid, + static int + hns3_map_tqp(struct hns3_hw *hw) + { ++ uint16_t i; + int ret; +- int i; + + /* + * In current version, VF is not supported when PF is driven by DPDK +diff --git a/drivers/net/hns3/hns3_regs.c b/drivers/net/hns3/hns3_regs.c +index 86a4cf74d5..6778e4cfc2 100644 +--- a/drivers/net/hns3/hns3_regs.c ++++ b/drivers/net/hns3/hns3_regs.c +@@ -294,8 +294,8 @@ hns3_direct_access_regs(struct hns3_hw *hw, uint32_t *data) + struct hns3_adapter *hns = HNS3_DEV_HW_TO_ADAPTER(hw); + uint32_t *origin_data_ptr = data; + uint32_t reg_offset; ++ uint16_t i, j; + int reg_num; +- int i, j; + + /* fetching per-PF registers values from PF PCIe register space */ + reg_num = sizeof(cmdq_reg_addrs) / sizeof(uint32_t); +diff --git a/drivers/net/hns3/hns3_rss.c b/drivers/net/hns3/hns3_rss.c +index d376486a1d..4c546c9363 100644 +--- a/drivers/net/hns3/hns3_rss.c ++++ b/drivers/net/hns3/hns3_rss.c +@@ -631,7 +631,7 @@ hns3_rss_set_default_args(struct hns3_hw *hw) + { + struct hns3_rss_conf *rss_cfg = &hw->rss_info; + uint16_t queue_num = hw->alloc_rss_size; +- int i; ++ uint16_t i; + + /* Default hash algorithm */ + rss_cfg->conf.func = RTE_ETH_HASH_FUNCTION_TOEPLITZ; +diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c +index ee0aaaf7fc..510802be05 100644 +--- a/drivers/net/hns3/hns3_rxtx.c ++++ b/drivers/net/hns3/hns3_rxtx.c +@@ -390,7 +390,7 @@ hns3_enable_all_queues(struct hns3_hw *hw, bool en) + struct hns3_tx_queue *txq; + uint32_t rcb_reg; + void *tqp_base; +- int i; ++ uint16_t i; + + for (i = 0; i < hw->cfg_max_queues; i++) { + if (hns3_dev_get_support(hw, INDEP_TXRX)) { +@@ -736,8 +736,8 @@ hns3pf_reset_all_tqps(struct hns3_hw *hw) + #define HNS3_RESET_RCB_NOT_SUPPORT 0U + #define HNS3_RESET_ALL_TQP_SUCCESS 1U + uint8_t reset_status; ++ uint16_t i; + int ret; +- int i; + + ret = hns3_reset_rcb_cmd(hw, &reset_status); + if (ret) +@@ -774,7 +774,7 @@ hns3vf_reset_all_tqps(struct hns3_hw *hw) + uint8_t reset_status; + uint8_t msg_data[2]; + int ret; +- int i; ++ uint16_t i; + + memset(msg_data, 0, sizeof(uint16_t)); + ret = hns3_send_mbx_msg(hw, HNS3_MBX_QUEUE_RESET, 0, msg_data, +@@ -806,7 +806,8 @@ int + hns3_reset_all_tqps(struct hns3_adapter *hns) + { + struct hns3_hw *hw = &hns->hw; +- int ret, i; ++ uint16_t i; ++ int ret; + + /* Disable all queues before reset all queues */ + for (i = 0; i < hw->cfg_max_queues; i++) { +@@ -1037,7 +1038,7 @@ hns3_dev_all_rx_queue_intr_enable(struct hns3_hw *hw, bool en) + { + struct rte_eth_dev *dev = &rte_eth_devices[hw->data->port_id]; + uint16_t nb_rx_q = hw->data->nb_rx_queues; +- int i; ++ uint16_t i; + + if (dev->data->dev_conf.intr_conf.rxq == 0) + return; +@@ -1121,7 +1122,7 @@ static void + hns3_init_txq(struct hns3_tx_queue *txq) + { + struct hns3_desc *desc; +- int i; ++ uint16_t i; + + /* Clear tx bd */ + desc = txq->tx_ring; +@@ -1145,7 +1146,7 @@ hns3_init_tx_ring_tc(struct hns3_adapter *hns) + + for (i = 0; i < HNS3_MAX_TC_NUM; i++) { + struct hns3_tc_queue_info *tc_queue = &hw->tc_queue[i]; +- int j; ++ uint16_t j; + + if (!tc_queue->enable) + continue; +@@ -1442,7 +1443,7 @@ hns3_alloc_txq_and_dma_zone(struct rte_eth_dev *dev, + struct hns3_tx_queue *txq; + struct hns3_desc *desc; + unsigned int tx_desc; +- int i; ++ uint16_t i; + + txq = rte_zmalloc_socket(q_info->type, sizeof(struct hns3_tx_queue), + RTE_CACHE_LINE_SIZE, q_info->socket_id); +@@ -1679,7 +1680,7 @@ hns3_dev_release_mbufs(struct hns3_adapter *hns) + struct rte_eth_dev_data *dev_data = hns->hw.data; + struct hns3_rx_queue *rxq; + struct hns3_tx_queue *txq; +- int i; ++ uint16_t i; + + if (dev_data->rx_queues) + for (i = 0; i < dev_data->nb_rx_queues; i++) { +@@ -3086,7 +3087,7 @@ hns3_tx_free_useless_buffer(struct hns3_tx_queue *txq) + uint16_t tx_next_use = txq->next_to_use; + struct hns3_entry *tx_entry = &txq->sw_ring[tx_next_clean]; + struct hns3_desc *desc = &txq->tx_ring[tx_next_clean]; +- int i; ++ uint16_t i; + + if (tx_next_use >= tx_next_clean && + tx_next_use < tx_next_clean + txq->tx_rs_thresh) +@@ -3984,7 +3985,7 @@ hns3_tx_free_buffer_simple(struct hns3_tx_queue *txq) + struct hns3_entry *tx_entry; + struct hns3_desc *desc; + uint16_t tx_next_clean; +- int i; ++ uint16_t i; + + while (1) { + if (HNS3_GET_TX_QUEUE_PEND_BD_NUM(txq) < txq->tx_rs_thresh) +diff --git a/drivers/net/hns3/hns3_rxtx_vec.h b/drivers/net/hns3/hns3_rxtx_vec.h +index 4985a7cae8..d13f18627d 100644 +--- a/drivers/net/hns3/hns3_rxtx_vec.h ++++ b/drivers/net/hns3/hns3_rxtx_vec.h +@@ -15,7 +15,7 @@ hns3_tx_bulk_free_buffers(struct hns3_tx_queue *txq) + struct hns3_entry *tx_entry; + struct rte_mbuf *m; + int nb_free = 0; +- int i; ++ uint16_t i; + + tx_entry = &txq->sw_ring[txq->next_to_clean]; + if (txq->mbuf_fast_free_en) { +@@ -56,7 +56,7 @@ static inline void + hns3_tx_free_buffers(struct hns3_tx_queue *txq) + { + struct hns3_desc *tx_desc; +- int i; ++ uint16_t i; + + /* + * All mbufs can be released only when the VLD bits of all +-- +2.22.0 + diff --git a/0111-net-hns3-fix-firmware-compatibility-configuration.patch b/0111-net-hns3-fix-firmware-compatibility-configuration.patch deleted file mode 100644 index 1c01a121da95d64a43e7b20f5c75624ad3d3fecb..0000000000000000000000000000000000000000 --- a/0111-net-hns3-fix-firmware-compatibility-configuration.patch +++ /dev/null @@ -1,278 +0,0 @@ -From a74108b0e8f10b207b2b253c5511efd519d071a3 Mon Sep 17 00:00:00 2001 -From: Huisong Li -Date: Tue, 13 Apr 2021 21:47:14 +0800 -Subject: [PATCH 111/189] net/hns3: fix firmware compatibility configuration - -The firmware compatibility configuration in PF driver is used to -maintain the compatibility of some features of the driver and -firmware, and requires firmware to enable these features. Currently, -the configuration is in hns3_init_hardware(), which is a little back. -Because firmware may clear some configurations (such as, MAC related) -after receiving the command. And firmware can not be aware of some -default initializations (such as, flow control) before executing the -command to set the copper PHY when the PHY is controlled by firmware. -Therefore, it is recommended that no other hardware resources are -configured before the compatibility configuration. And it should be -moved to hns3_cmd_init(), which is responsible for the firmware -command initialization of driver. - -In addition, the driver needs to perform corresponding processing -if the command fails to be sent. -1) If firmware fails to take over the copper PHY, the copper port fails - to initialize. -2) If fails to enable the report of link events, the device does not - support the LSC capability. - -Fixes: bff6ebfe30d4 ("net/hns3: refactor PF LSC event report") -Fixes: bac6a0644121 ("net/hns3: fix link status change from firmware") -Cc: stable@dpdk.org - -Signed-off-by: Huisong Li -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_cmd.c | 116 +++++++++++++++++++++++++++++++++++++++++ - drivers/net/hns3/hns3_ethdev.c | 56 -------------------- - 2 files changed, 116 insertions(+), 56 deletions(-) - -diff --git a/drivers/net/hns3/hns3_cmd.c b/drivers/net/hns3/hns3_cmd.c -index 41e2caa..15bf781 100644 ---- a/drivers/net/hns3/hns3_cmd.c -+++ b/drivers/net/hns3/hns3_cmd.c -@@ -526,9 +526,99 @@ hns3_cmd_init_queue(struct hns3_hw *hw) - return ret; - } - -+static void -+hns3_update_dev_lsc_cap(struct hns3_hw *hw, int fw_compact_cmd_result) -+{ -+ struct rte_eth_dev *dev = &rte_eth_devices[hw->data->port_id]; -+ -+ if (hw->adapter_state != HNS3_NIC_UNINITIALIZED) -+ return; -+ -+ if (fw_compact_cmd_result != 0) { -+ /* -+ * If fw_compact_cmd_result is not zero, it means firmware don't -+ * support link status change interrupt. -+ * Framework already set RTE_ETH_DEV_INTR_LSC bit because driver -+ * declared RTE_PCI_DRV_INTR_LSC in drv_flags. It need to clear -+ * the RTE_ETH_DEV_INTR_LSC capability when detect firmware -+ * don't support link status change interrupt. -+ */ -+ dev->data->dev_flags &= ~RTE_ETH_DEV_INTR_LSC; -+ } -+} -+ -+static int -+hns3_apply_fw_compat_cmd_result(struct hns3_hw *hw, int result) -+{ -+ if (result != 0 && hns3_dev_copper_supported(hw)) { -+ hns3_err(hw, "firmware fails to initialize the PHY, ret = %d.", -+ result); -+ return result; -+ } -+ -+ hns3_update_dev_lsc_cap(hw, result); -+ -+ return 0; -+} -+ -+static int -+hns3_firmware_compat_config(struct hns3_hw *hw, bool is_init) -+{ -+ struct hns3_firmware_compat_cmd *req; -+ struct hns3_cmd_desc desc; -+ uint32_t compat = 0; -+ -+#if defined(RTE_HNS3_ONLY_1630_FPGA) -+ /* If resv reg enabled phy driver of imp is not configured, driver -+ * will use temporary phy driver. -+ */ -+ struct rte_pci_device *pci_dev; -+ struct rte_eth_dev *eth_dev; -+ uint8_t revision; -+ int ret; -+ -+ eth_dev = &rte_eth_devices[hw->data->port_id]; -+ pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev); -+ /* Get PCI revision id */ -+ ret = rte_pci_read_config(pci_dev, &revision, HNS3_PCI_REVISION_ID_LEN, -+ HNS3_PCI_REVISION_ID); -+ if (ret != HNS3_PCI_REVISION_ID_LEN) { -+ PMD_INIT_LOG(ERR, "failed to read pci revision id, ret = %d", -+ ret); -+ return -EIO; -+ } -+ if (revision == PCI_REVISION_ID_HIP09_A) { -+ struct hns3_pf *pf = HNS3_DEV_HW_TO_PF(hw); -+ if (hns3_dev_copper_supported(hw) == 0 || pf->is_tmp_phy) { -+ PMD_INIT_LOG(ERR, "***use temp phy driver in dpdk***"); -+ pf->is_tmp_phy = true; -+ hns3_set_bit(hw->capability, -+ HNS3_DEV_SUPPORT_COPPER_B, 1); -+ return 0; -+ } -+ -+ PMD_INIT_LOG(ERR, "***use phy driver in imp***"); -+ } -+#endif -+ -+ hns3_cmd_setup_basic_desc(&desc, HNS3_OPC_FIRMWARE_COMPAT_CFG, false); -+ req = (struct hns3_firmware_compat_cmd *)desc.data; -+ -+ if (is_init) { -+ hns3_set_bit(compat, HNS3_LINK_EVENT_REPORT_EN_B, 1); -+ hns3_set_bit(compat, HNS3_NCSI_ERROR_REPORT_EN_B, 0); -+ if (hns3_dev_copper_supported(hw)) -+ hns3_set_bit(compat, HNS3_FIRMWARE_PHY_DRIVER_EN_B, 1); -+ } -+ req->compat = rte_cpu_to_le_32(compat); -+ -+ return hns3_cmd_send(hw, &desc, 1); -+} -+ - int - hns3_cmd_init(struct hns3_hw *hw) - { -+ struct hns3_adapter *hns = HNS3_DEV_HW_TO_ADAPTER(hw); - uint32_t version; - int ret; - -@@ -575,6 +665,27 @@ hns3_cmd_init(struct hns3_hw *hw) - hns3_get_field(version, HNS3_FW_VERSION_BYTE0_M, - HNS3_FW_VERSION_BYTE0_S)); - -+ if (hns->is_vf) -+ return 0; -+ -+ /* -+ * Requiring firmware to enable some features, firber port can still -+ * work without it, but copper port can't work because the firmware -+ * fails to take over the PHY. -+ */ -+ ret = hns3_firmware_compat_config(hw, true); -+ if (ret) -+ PMD_INIT_LOG(WARNING, "firmware compatible features not " -+ "supported, ret = %d.", ret); -+ -+ /* -+ * Perform some corresponding operations based on the firmware -+ * compatibility configuration result. -+ */ -+ ret = hns3_apply_fw_compat_cmd_result(hw, ret); -+ if (ret) -+ goto err_cmd_init; -+ - return 0; - - err_cmd_init: -@@ -602,6 +713,11 @@ hns3_cmd_destroy_queue(struct hns3_hw *hw) - void - hns3_cmd_uninit(struct hns3_hw *hw) - { -+ struct hns3_adapter *hns = HNS3_DEV_HW_TO_ADAPTER(hw); -+ -+ if (!hns->is_vf) -+ (void)hns3_firmware_compat_config(hw, false); -+ - __atomic_store_n(&hw->reset.disable_cmd, 1, __ATOMIC_RELAXED); - - /* -diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c -index 5e7ac54..7bae923 100644 ---- a/drivers/net/hns3/hns3_ethdev.c -+++ b/drivers/net/hns3/hns3_ethdev.c -@@ -4118,28 +4118,6 @@ hns3_buffer_alloc(struct hns3_hw *hw) - } - - static int --hns3_firmware_compat_config(struct hns3_hw *hw, bool is_init) --{ -- struct hns3_firmware_compat_cmd *req; -- struct hns3_cmd_desc desc; -- uint32_t compat = 0; -- -- hns3_cmd_setup_basic_desc(&desc, HNS3_OPC_FIRMWARE_COMPAT_CFG, false); -- req = (struct hns3_firmware_compat_cmd *)desc.data; -- -- if (is_init) { -- hns3_set_bit(compat, HNS3_LINK_EVENT_REPORT_EN_B, 1); -- hns3_set_bit(compat, HNS3_NCSI_ERROR_REPORT_EN_B, 0); -- if (hw->mac.media_type == HNS3_MEDIA_TYPE_COPPER) -- hns3_set_bit(compat, HNS3_FIRMWARE_PHY_DRIVER_EN_B, 1); -- } -- -- req->compat = rte_cpu_to_le_32(compat); -- -- return hns3_cmd_send(hw, &desc, 1); --} -- --static int - hns3_mac_init(struct hns3_hw *hw) - { - struct hns3_adapter *hns = HNS3_DEV_HW_TO_ADAPTER(hw); -@@ -4815,28 +4793,6 @@ hns3_service_handler(void *param) - rte_eal_alarm_set(HNS3_SERVICE_INTERVAL, hns3_service_handler, eth_dev); - } - --static void --hns3_update_dev_lsc_cap(struct hns3_hw *hw, -- int fw_compact_cmd_result) --{ -- struct rte_eth_dev *dev = &rte_eth_devices[hw->data->port_id]; -- -- if (hw->adapter_state != HNS3_NIC_UNINITIALIZED) -- return; -- -- if (fw_compact_cmd_result != 0) { -- /* -- * If fw_compact_cmd_result is not zero, it means firmware don't -- * support link status change interrupt. -- * Framework already set RTE_ETH_DEV_INTR_LSC bit because driver -- * declared RTE_PCI_DRV_INTR_LSC in drv_flags. It need to clear -- * the RTE_ETH_DEV_INTR_LSC capability when detect firmware -- * don't support link status change interrupt. -- */ -- dev->data->dev_flags &= ~RTE_ETH_DEV_INTR_LSC; -- } --} -- - static int - hns3_init_hardware(struct hns3_adapter *hns) - { -@@ -4916,16 +4872,6 @@ hns3_init_hardware(struct hns3_adapter *hns) - goto err_mac_init; - } - -- /* -- * Requiring firmware to enable some features, driver can -- * still work without it. -- */ -- ret = hns3_firmware_compat_config(hw, true); -- if (ret) -- PMD_INIT_LOG(WARNING, "firmware compatible features not " -- "supported, ret = %d.", ret); -- hns3_update_dev_lsc_cap(hw, ret); -- - return 0; - - err_mac_init: -@@ -5073,7 +5019,6 @@ hns3_init_pf(struct rte_eth_dev *eth_dev) - err_enable_intr: - hns3_fdir_filter_uninit(hns); - err_fdir: -- (void)hns3_firmware_compat_config(hw, false); - hns3_uninit_umv_space(hw); - err_init_hw: - hns3_tqp_stats_uninit(hw); -@@ -5108,7 +5053,6 @@ hns3_uninit_pf(struct rte_eth_dev *eth_dev) - (void)hns3_config_gro(hw, false); - hns3_promisc_uninit(hw); - hns3_fdir_filter_uninit(hns); -- (void)hns3_firmware_compat_config(hw, false); - hns3_uninit_umv_space(hw); - hns3_tqp_stats_uninit(hw); - hns3_config_mac_tnl_int(hw, false); --- -2.7.4 - diff --git a/0103-net-hns3-fix-missing-outer-L4-UDP-flag-for-VXLAN.patch b/0112-net-hns3-fix-an-unreasonable-memset.patch similarity index 35% rename from 0103-net-hns3-fix-missing-outer-L4-UDP-flag-for-VXLAN.patch rename to 0112-net-hns3-fix-an-unreasonable-memset.patch index 8529f3fd4936174e9ebf731eccd7a8d88f645d11..4f93c185dae288b32f2c70699c42b2f12d72db2d 100644 --- a/0103-net-hns3-fix-missing-outer-L4-UDP-flag-for-VXLAN.patch +++ b/0112-net-hns3-fix-an-unreasonable-memset.patch @@ -1,32 +1,30 @@ -From e8eb8b70d1d9cf8c1fd6ece253d4195e49208a21 Mon Sep 17 00:00:00 2001 -From: Chengwen Feng -Date: Tue, 13 Apr 2021 19:50:06 +0800 -Subject: [PATCH 103/189] net/hns3: fix missing outer L4 UDP flag for VXLAN - -This patch adds RTE_PTYPE_L4_UDP flag when parsed tunnel vxlan packet. +From d3b39f5bca72e2ecd16527d3c63e1b2e620830bc Mon Sep 17 00:00:00 2001 +From: Huisong Li +Date: Wed, 1 Jun 2022 11:52:44 +0800 +Subject: [PATCH 112/122] net/hns3: fix an unreasonable memset Fixes: bba636698316 ("net/hns3: support Rx/Tx and related operations") Cc: stable@dpdk.org -Signed-off-by: Chengwen Feng +Signed-off-by: Huisong Li Signed-off-by: Min Hu (Connor) --- drivers/net/hns3/hns3_rxtx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c -index f3ced19..7e9b762 100644 +index 510802be05..5a2cfe5a54 100644 --- a/drivers/net/hns3/hns3_rxtx.c +++ b/drivers/net/hns3/hns3_rxtx.c -@@ -2051,7 +2051,7 @@ hns3_init_tunnel_ptype_tbl(struct hns3_ptype_table *tbl) - tbl->ol3table[5] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT; - - tbl->ol4table[0] = RTE_PTYPE_UNKNOWN; -- tbl->ol4table[1] = RTE_PTYPE_TUNNEL_VXLAN; -+ tbl->ol4table[1] = RTE_PTYPE_L4_UDP | RTE_PTYPE_TUNNEL_VXLAN; - tbl->ol4table[2] = RTE_PTYPE_TUNNEL_NVGRE; - } +@@ -776,7 +776,7 @@ hns3vf_reset_all_tqps(struct hns3_hw *hw) + int ret; + uint16_t i; +- memset(msg_data, 0, sizeof(uint16_t)); ++ memset(msg_data, 0, sizeof(msg_data)); + ret = hns3_send_mbx_msg(hw, HNS3_MBX_QUEUE_RESET, 0, msg_data, + sizeof(msg_data), true, &reset_status, + sizeof(reset_status)); -- -2.7.4 +2.22.0 diff --git a/0112-net-hns3-obtain-supported-speed-for-fiber-port.patch b/0112-net-hns3-obtain-supported-speed-for-fiber-port.patch deleted file mode 100644 index 6aa88f48bf2a9de374aca4dbdd66d86c8ecea666..0000000000000000000000000000000000000000 --- a/0112-net-hns3-obtain-supported-speed-for-fiber-port.patch +++ /dev/null @@ -1,275 +0,0 @@ -From 984fd9914cfd3f9d24eb9b6c0914595dba9f3575 Mon Sep 17 00:00:00 2001 -From: Huisong Li -Date: Tue, 13 Apr 2021 21:47:15 +0800 -Subject: [PATCH 112/189] net/hns3: obtain supported speed for fiber port - -Currently, the speed of fiber port is obtained by using the default -query type of HNS3_OPC_GET_SFP_INFO opcode. In this way, only -the speed of the optical module can be obtained. In fact, the opcode -also supports an active query type, which is a channel for obtaining -information such as the speed, the supported speed, auto-negotiation -capability, and FEC mode. This patch changes the query type of the -opcode from the default query type to the active query type to obtain -the supported speed of fiber port. - -Signed-off-by: Huisong Li -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_cmd.h | 41 ++++++++++++++-------- - drivers/net/hns3/hns3_ethdev.c | 80 ++++++++++++++++++++++++++++++++---------- - drivers/net/hns3/hns3_ethdev.h | 26 ++++++++++++-- - 3 files changed, 113 insertions(+), 34 deletions(-) - -diff --git a/drivers/net/hns3/hns3_cmd.h b/drivers/net/hns3/hns3_cmd.h -index a7dd2b5..4c25c43 100644 ---- a/drivers/net/hns3/hns3_cmd.h -+++ b/drivers/net/hns3/hns3_cmd.h -@@ -230,7 +230,7 @@ enum hns3_opcode_type { - /* SFP command */ - HNS3_OPC_GET_SFP_EEPROM = 0x7100, - HNS3_OPC_GET_SFP_EXIST = 0x7101, -- HNS3_OPC_SFP_GET_SPEED = 0x7104, -+ HNS3_OPC_GET_SFP_INFO = 0x7104, - - /* Interrupts commands */ - HNS3_OPC_ADD_RING_TO_VECTOR = 0x1503, -@@ -767,13 +767,6 @@ struct hns3_config_auto_neg_cmd { - uint8_t rsv[20]; - }; - --#define HNS3_MAC_CFG_FEC_AUTO_EN_B 0 --#define HNS3_MAC_CFG_FEC_MODE_S 1 --#define HNS3_MAC_CFG_FEC_MODE_M GENMASK(3, 1) --#define HNS3_MAC_FEC_OFF 0 --#define HNS3_MAC_FEC_BASER 1 --#define HNS3_MAC_FEC_RS 2 -- - #define HNS3_SFP_INFO_BD0_LEN 20UL - #define HNS3_SFP_INFO_BDX_LEN 24UL - -@@ -788,14 +781,34 @@ struct hns3_sfp_type { - uint8_t ext_type; - }; - --struct hns3_sfp_speed_cmd { -- uint32_t sfp_speed; -- uint8_t query_type; /* 0: sfp speed, 1: active fec */ -- uint8_t active_fec; /* current FEC mode */ -- uint16_t rsv1; -- uint32_t rsv2[4]; -+/* Bitmap flags in supported_speed */ -+#define HNS3_FIBER_LINK_SPEED_1G_BIT BIT(0) -+#define HNS3_FIBER_LINK_SPEED_10G_BIT BIT(1) -+#define HNS3_FIBER_LINK_SPEED_25G_BIT BIT(2) -+#define HNS3_FIBER_LINK_SPEED_50G_BIT BIT(3) -+#define HNS3_FIBER_LINK_SPEED_100G_BIT BIT(4) -+#define HNS3_FIBER_LINK_SPEED_40G_BIT BIT(5) -+#define HNS3_FIBER_LINK_SPEED_100M_BIT BIT(6) -+#define HNS3_FIBER_LINK_SPEED_10M_BIT BIT(7) -+#define HNS3_FIBER_LINK_SPEED_200G_BIT BIT(8) -+ -+struct hns3_sfp_info_cmd { -+ uint32_t sfp_speed; -+ uint8_t query_type; /* 0: sfp speed, 1: active */ -+ uint8_t active_fec; /* current FEC mode */ -+ uint16_t rsv; -+ uint32_t supported_speed; /* speed supported by current media */ -+ uint32_t module_type; -+ uint8_t rsv1[8]; - }; - -+#define HNS3_MAC_CFG_FEC_AUTO_EN_B 0 -+#define HNS3_MAC_CFG_FEC_MODE_S 1 -+#define HNS3_MAC_CFG_FEC_MODE_M GENMASK(3, 1) -+#define HNS3_MAC_FEC_OFF 0 -+#define HNS3_MAC_FEC_BASER 1 -+#define HNS3_MAC_FEC_RS 2 -+ - /* Configure FEC mode, opcode:0x031A */ - struct hns3_config_fec_cmd { - uint8_t fec_mode; -diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c -index 7bae923..5f629e7 100644 ---- a/drivers/net/hns3/hns3_ethdev.c -+++ b/drivers/net/hns3/hns3_ethdev.c -@@ -4507,24 +4507,45 @@ hns3_dev_promisc_restore(struct hns3_adapter *hns) - } - - static int --hns3_get_sfp_speed(struct hns3_hw *hw, uint32_t *speed) -+hns3_get_sfp_info(struct hns3_hw *hw, struct hns3_mac *mac_info) - { -- struct hns3_sfp_speed_cmd *resp; -+ struct hns3_sfp_info_cmd *resp; - struct hns3_cmd_desc desc; - int ret; - -- hns3_cmd_setup_basic_desc(&desc, HNS3_OPC_SFP_GET_SPEED, true); -- resp = (struct hns3_sfp_speed_cmd *)desc.data; -+ hns3_cmd_setup_basic_desc(&desc, HNS3_OPC_GET_SFP_INFO, true); -+ resp = (struct hns3_sfp_info_cmd *)desc.data; -+ resp->query_type = HNS3_ACTIVE_QUERY; -+ - ret = hns3_cmd_send(hw, &desc, 1); - if (ret == -EOPNOTSUPP) { -- hns3_err(hw, "IMP do not support get SFP speed %d", ret); -+ hns3_warn(hw, "firmware does not support get SFP info," -+ " ret = %d.", ret); - return ret; - } else if (ret) { -- hns3_err(hw, "get sfp speed failed %d", ret); -+ hns3_err(hw, "get sfp info failed, ret = %d.", ret); - return ret; - } - -- *speed = resp->sfp_speed; -+ /* -+ * In some case, the speed of MAC obtained from firmware may be 0, it -+ * shouldn't be set to mac->speed. -+ */ -+ if (!rte_le_to_cpu_32(resp->sfp_speed)) -+ return 0; -+ -+ mac_info->link_speed = rte_le_to_cpu_32(resp->sfp_speed); -+ /* -+ * if resp->supported_speed is 0, it means it's an old version -+ * firmware, do not update these params. -+ */ -+ if (resp->supported_speed) { -+ mac_info->query_type = HNS3_ACTIVE_QUERY; -+ mac_info->supported_speed = -+ rte_le_to_cpu_32(resp->supported_speed); -+ } else { -+ mac_info->query_type = HNS3_DEFAULT_QUERY; -+ } - - return 0; - } -@@ -4566,25 +4587,49 @@ static int - hns3_update_fiber_link_info(struct hns3_hw *hw) - { - struct hns3_pf *pf = HNS3_DEV_HW_TO_PF(hw); -- uint32_t speed; -+ struct hns3_mac *mac = &hw->mac; -+ struct hns3_mac mac_info; - int ret; - -- /* If IMP do not support get SFP/qSFP speed, return directly */ -+ /* If firmware do not support get SFP/qSFP speed, return directly */ - if (!pf->support_sfp_query) - return 0; - -- ret = hns3_get_sfp_speed(hw, &speed); -+ memset(&mac_info, 0, sizeof(struct hns3_mac)); -+ ret = hns3_get_sfp_info(hw, &mac_info); - if (ret == -EOPNOTSUPP) { - pf->support_sfp_query = false; - return ret; - } else if (ret) - return ret; - -- if (speed == ETH_SPEED_NUM_NONE) -- return 0; /* do nothing if no SFP */ -+ /* Do nothing if no SFP */ -+ if (mac_info.link_speed == ETH_SPEED_NUM_NONE) -+ return 0; -+ -+ /* -+ * If query_type is HNS3_ACTIVE_QUERY, it is no need -+ * to reconfigure the speed of MAC. Otherwise, it indicates -+ * that the current firmware only supports to obtain the -+ * speed of the SFP, and the speed of MAC needs to reconfigure. -+ */ -+ mac->query_type = mac_info.query_type; -+ if (mac->query_type == HNS3_ACTIVE_QUERY) { -+ if (mac_info.link_speed != mac->link_speed) { -+ ret = hns3_port_shaper_update(hw, mac_info.link_speed); -+ if (ret) -+ return ret; -+ } -+ -+ mac->link_speed = mac_info.link_speed; -+ mac->supported_speed = mac_info.supported_speed; -+ -+ return 0; -+ } - - /* Config full duplex for SFP */ -- return hns3_cfg_mac_speed_dup(hw, speed, ETH_LINK_FULL_DUPLEX); -+ return hns3_cfg_mac_speed_dup(hw, mac_info.link_speed, -+ ETH_LINK_FULL_DUPLEX); - } - - static void -@@ -6200,8 +6245,7 @@ get_current_fec_auto_state(struct hns3_hw *hw, uint8_t *state) - static int - hns3_fec_get_internal(struct hns3_hw *hw, uint32_t *fec_capa) - { --#define QUERY_ACTIVE_SPEED 1 -- struct hns3_sfp_speed_cmd *resp; -+ struct hns3_sfp_info_cmd *resp; - uint32_t tmp_fec_capa; - uint8_t auto_state; - struct hns3_cmd_desc desc; -@@ -6223,9 +6267,9 @@ hns3_fec_get_internal(struct hns3_hw *hw, uint32_t *fec_capa) - } - } - -- hns3_cmd_setup_basic_desc(&desc, HNS3_OPC_SFP_GET_SPEED, true); -- resp = (struct hns3_sfp_speed_cmd *)desc.data; -- resp->query_type = QUERY_ACTIVE_SPEED; -+ hns3_cmd_setup_basic_desc(&desc, HNS3_OPC_GET_SFP_INFO, true); -+ resp = (struct hns3_sfp_info_cmd *)desc.data; -+ resp->query_type = HNS3_ACTIVE_QUERY; - - ret = hns3_cmd_send(hw, &desc, 1); - if (ret == -EOPNOTSUPP) { -diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h -index 03bb783..a677ddc 100644 ---- a/drivers/net/hns3/hns3_ethdev.h -+++ b/drivers/net/hns3/hns3_ethdev.h -@@ -174,6 +174,9 @@ enum hns3_media_type { - HNS3_MEDIA_TYPE_NONE, - }; - -+#define HNS3_DEFAULT_QUERY 0 -+#define HNS3_ACTIVE_QUERY 1 -+ - struct hns3_mac { - uint8_t mac_addr[RTE_ETHER_ADDR_LEN]; - bool default_addr_setted; /* whether default addr(mac_addr) is set */ -@@ -183,10 +186,29 @@ struct hns3_mac { - uint8_t link_autoneg : 1; /* ETH_LINK_[AUTONEG/FIXED] */ - uint8_t link_status : 1; /* ETH_LINK_[DOWN/UP] */ - uint32_t link_speed; /* ETH_SPEED_NUM_ */ -+ /* -+ * Some firmware versions support only the SFP speed query. In addition -+ * to the SFP speed query, some firmware supports the query of the speed -+ * capability, auto-negotiation capability, and FEC mode, which can be -+ * selected by the 'query_type' filed in the HNS3_OPC_GET_SFP_INFO CMD. -+ * This field is used to record the SFP information query mode. -+ * Value range: -+ * HNS3_DEFAULT_QUERY/HNS3_ACTIVE_QUERY -+ * -+ * - HNS3_DEFAULT_QUERY -+ * Speed obtained is from SFP. When the queried speed changes, the MAC -+ * speed needs to be reconfigured. -+ * -+ * - HNS3_ACTIVE_QUERY -+ * Speed obtained is from MAC. At this time, it is unnecessary for -+ * driver to reconfigured the MAC speed. In addition, more information, -+ * such as, the speed capability, auto-negotiation capability and FEC -+ * mode, can be obtained by the HNS3_OPC_GET_SFP_INFO CMD. -+ */ -+ uint8_t query_type; - uint32_t supported_speed; /* supported speed for current media type */ - uint32_t advertising; /* advertised capability in the local part */ -- /* advertised capability in the link partner */ -- uint32_t lp_advertising; -+ uint32_t lp_advertising; /* advertised capability in the link partner */ - uint8_t support_autoneg; - }; - --- -2.7.4 - diff --git a/0113-net-hns3-remove-duplicate-definition.patch b/0113-net-hns3-remove-duplicate-definition.patch new file mode 100644 index 0000000000000000000000000000000000000000..68289f132d3abcea135872f4a38b0de3d3665a63 --- /dev/null +++ b/0113-net-hns3-remove-duplicate-definition.patch @@ -0,0 +1,71 @@ +From 1650e90eef5c7be334b29d276479c8f4d997ba02 Mon Sep 17 00:00:00 2001 +From: Huisong Li +Date: Wed, 1 Jun 2022 11:52:45 +0800 +Subject: [PATCH 113/122] net/hns3: remove duplicate definition + +The default hash key array is defined twice. Remove the extra one. + +Fixes: c37ca66f2b27 ("net/hns3: support RSS") +Cc: stable@dpdk.org + +Signed-off-by: Huisong Li +Signed-off-by: Min Hu (Connor) +--- + drivers/net/hns3/hns3_flow.c | 9 --------- + drivers/net/hns3/hns3_rss.c | 6 ++---- + drivers/net/hns3/hns3_rss.h | 2 ++ + 3 files changed, 4 insertions(+), 13 deletions(-) + +diff --git a/drivers/net/hns3/hns3_flow.c b/drivers/net/hns3/hns3_flow.c +index 12afc24910..e994cac314 100644 +--- a/drivers/net/hns3/hns3_flow.c ++++ b/drivers/net/hns3/hns3_flow.c +@@ -10,15 +10,6 @@ + #include "hns3_logs.h" + #include "hns3_flow.h" + +-/* Default default keys */ +-static uint8_t hns3_hash_key[] = { +- 0x6D, 0x5A, 0x56, 0xDA, 0x25, 0x5B, 0x0E, 0xC2, +- 0x41, 0x67, 0x25, 0x3D, 0x43, 0xA3, 0x8F, 0xB0, +- 0xD0, 0xCA, 0x2B, 0xCB, 0xAE, 0x7B, 0x30, 0xB4, +- 0x77, 0xCB, 0x2D, 0xA3, 0x80, 0x30, 0xF2, 0x0C, +- 0x6A, 0x42, 0xB7, 0x3B, 0xBE, 0xAC, 0x01, 0xFA +-}; +- + static const uint8_t full_mask[VNI_OR_TNI_LEN] = { 0xFF, 0xFF, 0xFF }; + static const uint8_t zero_mask[VNI_OR_TNI_LEN] = { 0x00, 0x00, 0x00 }; + +diff --git a/drivers/net/hns3/hns3_rss.c b/drivers/net/hns3/hns3_rss.c +index 4c546c9363..1003daf03e 100644 +--- a/drivers/net/hns3/hns3_rss.c ++++ b/drivers/net/hns3/hns3_rss.c +@@ -9,10 +9,8 @@ + #include "hns3_ethdev.h" + #include "hns3_logs.h" + +-/* +- * The hash key used for rss initialization. +- */ +-static const uint8_t hns3_hash_key[] = { ++/* Default hash keys */ ++const uint8_t hns3_hash_key[] = { + 0x6D, 0x5A, 0x56, 0xDA, 0x25, 0x5B, 0x0E, 0xC2, + 0x41, 0x67, 0x25, 0x3D, 0x43, 0xA3, 0x8F, 0xB0, + 0xD0, 0xCA, 0x2B, 0xCB, 0xAE, 0x7B, 0x30, 0xB4, +diff --git a/drivers/net/hns3/hns3_rss.h b/drivers/net/hns3/hns3_rss.h +index 7789f02a08..5b90d3a628 100644 +--- a/drivers/net/hns3/hns3_rss.h ++++ b/drivers/net/hns3/hns3_rss.h +@@ -88,6 +88,8 @@ static inline uint32_t roundup_pow_of_two(uint32_t x) + return 1UL << fls(x - 1); + } + ++extern const uint8_t hns3_hash_key[]; ++ + struct hns3_adapter; + + int hns3_dev_rss_hash_update(struct rte_eth_dev *dev, +-- +2.22.0 + diff --git a/0113-net-hns3-report-speed-capability-for-PF.patch b/0113-net-hns3-report-speed-capability-for-PF.patch deleted file mode 100644 index 477715fac91d1444f5326425f62257fd49f194c9..0000000000000000000000000000000000000000 --- a/0113-net-hns3-report-speed-capability-for-PF.patch +++ /dev/null @@ -1,206 +0,0 @@ -From 52ae922fdca38de506df971337fcbd0a0cefcd78 Mon Sep 17 00:00:00 2001 -From: Huisong Li -Date: Tue, 13 Apr 2021 21:47:16 +0800 -Subject: [PATCH 113/189] net/hns3: report speed capability for PF - -The speed capability of the device can be reported to the upper-layer app -in rte_eth_dev_info_get API. In this API, the speed capability is derived -from the 'supported_speed', which is the speed capability actually -supported by the NIC. The value of the 'supported_speed' is obtained -once in the probe stage and may be updated in the scheduled task to deal -with the change of the transmission interface. - -Signed-off-by: Huisong Li -Signed-off-by: Min Hu (Connor) ---- - doc/guides/nics/features/hns3.ini | 1 + - drivers/net/hns3/hns3_ethdev.c | 136 ++++++++++++++++++++++++++++++++++++++ - 2 files changed, 137 insertions(+) - -diff --git a/doc/guides/nics/features/hns3.ini b/doc/guides/nics/features/hns3.ini -index d1a493b..4685cc1 100644 ---- a/doc/guides/nics/features/hns3.ini -+++ b/doc/guides/nics/features/hns3.ini -@@ -4,6 +4,7 @@ - ; Refer to default.ini for the full list of available PMD features. - ; - [Features] -+Speed capabilities = Y - Link status = Y - Link status event = Y - Rx interrupt = Y -diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c -index 5f629e7..aa9f140 100644 ---- a/drivers/net/hns3/hns3_ethdev.c -+++ b/drivers/net/hns3/hns3_ethdev.c -@@ -2617,6 +2617,67 @@ hns3_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) - return 0; - } - -+static uint32_t -+hns3_get_copper_port_speed_capa(uint32_t supported_speed) -+{ -+ uint32_t speed_capa = 0; -+ -+ if (supported_speed & HNS3_PHY_LINK_SPEED_10M_HD_BIT) -+ speed_capa |= ETH_LINK_SPEED_10M_HD; -+ if (supported_speed & HNS3_PHY_LINK_SPEED_10M_BIT) -+ speed_capa |= ETH_LINK_SPEED_10M; -+ if (supported_speed & HNS3_PHY_LINK_SPEED_100M_HD_BIT) -+ speed_capa |= ETH_LINK_SPEED_100M_HD; -+ if (supported_speed & HNS3_PHY_LINK_SPEED_100M_BIT) -+ speed_capa |= ETH_LINK_SPEED_100M; -+ if (supported_speed & HNS3_PHY_LINK_SPEED_1000M_BIT) -+ speed_capa |= ETH_LINK_SPEED_1G; -+ -+ return speed_capa; -+} -+ -+static uint32_t -+hns3_get_firber_port_speed_capa(uint32_t supported_speed) -+{ -+ uint32_t speed_capa = 0; -+ -+ if (supported_speed & HNS3_FIBER_LINK_SPEED_1G_BIT) -+ speed_capa |= ETH_LINK_SPEED_1G; -+ if (supported_speed & HNS3_FIBER_LINK_SPEED_10G_BIT) -+ speed_capa |= ETH_LINK_SPEED_10G; -+ if (supported_speed & HNS3_FIBER_LINK_SPEED_25G_BIT) -+ speed_capa |= ETH_LINK_SPEED_25G; -+ if (supported_speed & HNS3_FIBER_LINK_SPEED_40G_BIT) -+ speed_capa |= ETH_LINK_SPEED_40G; -+ if (supported_speed & HNS3_FIBER_LINK_SPEED_50G_BIT) -+ speed_capa |= ETH_LINK_SPEED_50G; -+ if (supported_speed & HNS3_FIBER_LINK_SPEED_100G_BIT) -+ speed_capa |= ETH_LINK_SPEED_100G; -+ if (supported_speed & HNS3_FIBER_LINK_SPEED_200G_BIT) -+ speed_capa |= ETH_LINK_SPEED_200G; -+ -+ return speed_capa; -+} -+ -+static uint32_t -+hns3_get_speed_capa(struct hns3_hw *hw) -+{ -+ struct hns3_mac *mac = &hw->mac; -+ uint32_t speed_capa; -+ -+ if (mac->media_type == HNS3_MEDIA_TYPE_COPPER) -+ speed_capa = -+ hns3_get_copper_port_speed_capa(mac->supported_speed); -+ else -+ speed_capa = -+ hns3_get_firber_port_speed_capa(mac->supported_speed); -+ -+ if (mac->support_autoneg == 0) -+ speed_capa |= ETH_LINK_SPEED_FIXED; -+ -+ return speed_capa; -+} -+ - int - hns3_dev_infos_get(struct rte_eth_dev *eth_dev, struct rte_eth_dev_info *info) - { -@@ -2688,6 +2749,7 @@ hns3_dev_infos_get(struct rte_eth_dev *eth_dev, struct rte_eth_dev_info *info) - .nb_mtu_seg_max = hw->max_non_tso_bd_num, - }; - -+ info->speed_capa = hns3_get_speed_capa(hw); - info->default_rxconf = (struct rte_eth_rxconf) { - .rx_free_thresh = HNS3_DEFAULT_RX_FREE_THRESH, - /* -@@ -4957,6 +5019,71 @@ hns3_config_all_msix_error(struct hns3_hw *hw, bool enable) - hns3_write_dev(hw, HNS3_VECTOR0_OTER_EN_REG, val); - } - -+static uint32_t -+hns3_set_firber_default_support_speed(struct hns3_hw *hw) -+{ -+ struct hns3_mac *mac = &hw->mac; -+ -+ switch (mac->link_speed) { -+ case ETH_SPEED_NUM_1G: -+ return HNS3_FIBER_LINK_SPEED_1G_BIT; -+ case ETH_SPEED_NUM_10G: -+ return HNS3_FIBER_LINK_SPEED_10G_BIT; -+ case ETH_SPEED_NUM_25G: -+ return HNS3_FIBER_LINK_SPEED_25G_BIT; -+ case ETH_SPEED_NUM_40G: -+ return HNS3_FIBER_LINK_SPEED_40G_BIT; -+ case ETH_SPEED_NUM_50G: -+ return HNS3_FIBER_LINK_SPEED_50G_BIT; -+ case ETH_SPEED_NUM_100G: -+ return HNS3_FIBER_LINK_SPEED_100G_BIT; -+ case ETH_SPEED_NUM_200G: -+ return HNS3_FIBER_LINK_SPEED_200G_BIT; -+ default: -+ hns3_warn(hw, "invalid speed %u Mbps.", mac->link_speed); -+ return 0; -+ } -+} -+ -+/* -+ * Validity of supported_speed for firber and copper media type can be -+ * guaranteed by the following policy: -+ * Copper: -+ * Although the initialization of the phy in the firmware may not be -+ * completed, the firmware can guarantees that the supported_speed is -+ * an valid value. -+ * Firber: -+ * If the version of firmware supports the acitive query way of the -+ * HNS3_OPC_GET_SFP_INFO opcode, the supported_speed can be obtained -+ * through it. If unsupported, use the SFP's speed as the value of the -+ * supported_speed. -+ */ -+static int -+hns3_get_port_supported_speed(struct rte_eth_dev *eth_dev) -+{ -+ struct hns3_adapter *hns = eth_dev->data->dev_private; -+ struct hns3_hw *hw = &hns->hw; -+ struct hns3_mac *mac = &hw->mac; -+ int ret; -+ -+ ret = hns3_update_link_info(eth_dev); -+ if (ret) -+ return ret; -+ -+ if (mac->media_type == HNS3_MEDIA_TYPE_FIBER) { -+ /* -+ * Some firmware does not support the report of supported_speed, -+ * and only report the effective speed of SFP. In this case, it -+ * is necessary to use the SFP's speed as the supported_speed. -+ */ -+ if (mac->supported_speed == 0) -+ mac->supported_speed = -+ hns3_set_firber_default_support_speed(hw); -+ } -+ -+ return 0; -+} -+ - static int - hns3_init_pf(struct rte_eth_dev *eth_dev) - { -@@ -5057,10 +5184,19 @@ hns3_init_pf(struct rte_eth_dev *eth_dev) - goto err_enable_intr; - } - -+ ret = hns3_get_port_supported_speed(eth_dev); -+ if (ret) { -+ PMD_INIT_LOG(ERR, "failed to get speed capabilities supported " -+ "by device, ret = %d.", ret); -+ goto err_supported_speed; -+ } -+ - hns3_tm_conf_init(eth_dev); - - return 0; - -+err_supported_speed: -+ (void)hns3_enable_hw_error_intr(hns, false); - err_enable_intr: - hns3_fdir_filter_uninit(hns); - err_fdir: --- -2.7.4 - diff --git a/0114-net-hns3-fix-code-check-warning.patch b/0114-net-hns3-fix-code-check-warning.patch new file mode 100644 index 0000000000000000000000000000000000000000..2ea529d339c01991e21bc3b4bb92de8064c272e0 --- /dev/null +++ b/0114-net-hns3-fix-code-check-warning.patch @@ -0,0 +1,31 @@ +From 1c88a050b04c9dc12458d4127052f542a0919739 Mon Sep 17 00:00:00 2001 +From: "Min Hu (Connor)" +Date: Wed, 1 Jun 2022 11:52:46 +0800 +Subject: [PATCH 114/122] net/hns3: fix code check warning + +In bitwise operation, "val" should be an unsigned type. + +Fixes: 38b539d96eb6 ("net/hns3: support IEEE 1588 PTP") +Cc: stable@dpdk.org + +Signed-off-by: Min Hu (Connor) +--- + drivers/net/hns3/hns3_ptp.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/net/hns3/hns3_ptp.c b/drivers/net/hns3/hns3_ptp.c +index 1442241a4e..0b0061bba5 100644 +--- a/drivers/net/hns3/hns3_ptp.c ++++ b/drivers/net/hns3/hns3_ptp.c +@@ -81,7 +81,7 @@ hns3_timesync_configure(struct hns3_adapter *hns, bool en) + struct hns3_hw *hw = &hns->hw; + struct hns3_pf *pf = &hns->pf; + struct hns3_cmd_desc desc; +- int val; ++ uint32_t val; + int ret; + + hns3_cmd_setup_basic_desc(&desc, HNS3_OPC_CFG_PTP_MODE, false); +-- +2.22.0 + diff --git a/0114-net-hns3-support-link-speed-autoneg-for-PF.patch b/0114-net-hns3-support-link-speed-autoneg-for-PF.patch deleted file mode 100644 index e86ad81245ce2a0535f758d164984d732135f907..0000000000000000000000000000000000000000 --- a/0114-net-hns3-support-link-speed-autoneg-for-PF.patch +++ /dev/null @@ -1,254 +0,0 @@ -From 80276e4e599abc03596ab80ebbb4637282299474 Mon Sep 17 00:00:00 2001 -From: Huisong Li -Date: Tue, 13 Apr 2021 21:47:17 +0800 -Subject: [PATCH 114/189] net/hns3: support link speed autoneg for PF - -This patch supports link speed auto-negotiation for PF. If the -device supports auto-negotiation, the device negotiates with -the link partner at all speeds supported by the device. - -Signed-off-by: Huisong Li -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_cmd.h | 5 +- - drivers/net/hns3/hns3_ethdev.c | 152 ++++++++++++++++++++++++++++++++++++++++- - drivers/net/hns3/hns3_ethdev.h | 6 ++ - 3 files changed, 160 insertions(+), 3 deletions(-) - -diff --git a/drivers/net/hns3/hns3_cmd.h b/drivers/net/hns3/hns3_cmd.h -index 4c25c43..a24063b 100644 ---- a/drivers/net/hns3/hns3_cmd.h -+++ b/drivers/net/hns3/hns3_cmd.h -@@ -108,6 +108,7 @@ enum hns3_opcode_type { - - /* MAC command */ - HNS3_OPC_CONFIG_MAC_MODE = 0x0301, -+ HNS3_OPC_CONFIG_AN_MODE = 0x0304, - HNS3_OPC_QUERY_LINK_STATUS = 0x0307, - HNS3_OPC_CONFIG_MAX_FRM_SIZE = 0x0308, - HNS3_OPC_CONFIG_SPEED_DUP = 0x0309, -@@ -796,7 +797,9 @@ struct hns3_sfp_info_cmd { - uint32_t sfp_speed; - uint8_t query_type; /* 0: sfp speed, 1: active */ - uint8_t active_fec; /* current FEC mode */ -- uint16_t rsv; -+ uint8_t autoneg; /* current autoneg state */ -+ /* 0: not support autoneg, 1: support autoneg */ -+ uint8_t autoneg_ability; - uint32_t supported_speed; /* speed supported by current media */ - uint32_t module_type; - uint8_t rsv1[8]; -diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c -index aa9f140..019d9fe 100644 ---- a/drivers/net/hns3/hns3_ethdev.c -+++ b/drivers/net/hns3/hns3_ethdev.c -@@ -2850,8 +2850,7 @@ hns3_setup_linkstatus(struct rte_eth_dev *eth_dev, - - new_link->link_duplex = mac->link_duplex; - new_link->link_status = mac->link_status ? ETH_LINK_UP : ETH_LINK_DOWN; -- new_link->link_autoneg = -- !(eth_dev->data->dev_conf.link_speeds & ETH_LINK_SPEED_FIXED); -+ new_link->link_autoneg = mac->link_autoneg; - } - - static int -@@ -4605,6 +4604,9 @@ hns3_get_sfp_info(struct hns3_hw *hw, struct hns3_mac *mac_info) - mac_info->query_type = HNS3_ACTIVE_QUERY; - mac_info->supported_speed = - rte_le_to_cpu_32(resp->supported_speed); -+ mac_info->support_autoneg = resp->autoneg_ability; -+ mac_info->link_autoneg = (resp->autoneg == 0) ? ETH_LINK_FIXED -+ : ETH_LINK_AUTONEG; - } else { - mac_info->query_type = HNS3_DEFAULT_QUERY; - } -@@ -4685,6 +4687,8 @@ hns3_update_fiber_link_info(struct hns3_hw *hw) - - mac->link_speed = mac_info.link_speed; - mac->supported_speed = mac_info.supported_speed; -+ mac->support_autoneg = mac_info.support_autoneg; -+ mac->link_autoneg = mac_info.link_autoneg; - - return 0; - } -@@ -5248,6 +5252,144 @@ hns3_uninit_pf(struct rte_eth_dev *eth_dev) - } - - static int -+hns3_set_copper_port_link_speed(struct hns3_hw *hw, -+ struct hns3_set_link_speed_cfg *cfg) -+{ -+ struct hns3_cmd_desc desc[HNS3_PHY_PARAM_CFG_BD_NUM]; -+ struct hns3_phy_params_bd0_cmd *req; -+ uint16_t i; -+ -+ for (i = 0; i < HNS3_PHY_PARAM_CFG_BD_NUM - 1; i++) { -+ hns3_cmd_setup_basic_desc(&desc[i], HNS3_OPC_PHY_PARAM_CFG, -+ false); -+ desc[i].flag |= rte_cpu_to_le_16(HNS3_CMD_FLAG_NEXT); -+ } -+ hns3_cmd_setup_basic_desc(&desc[i], HNS3_OPC_PHY_PARAM_CFG, false); -+ req = (struct hns3_phy_params_bd0_cmd *)desc[0].data; -+ req->autoneg = cfg->autoneg; -+ -+ /* -+ * The full speed capability is used to negotiate when -+ * auto-negotiation is enabled. -+ */ -+ if (cfg->autoneg) { -+ req->advertising = HNS3_PHY_LINK_SPEED_10M_BIT | -+ HNS3_PHY_LINK_SPEED_10M_HD_BIT | -+ HNS3_PHY_LINK_SPEED_100M_BIT | -+ HNS3_PHY_LINK_SPEED_100M_HD_BIT | -+ HNS3_PHY_LINK_SPEED_1000M_BIT; -+ } -+ -+ return hns3_cmd_send(hw, desc, HNS3_PHY_PARAM_CFG_BD_NUM); -+} -+ -+static int -+hns3_set_autoneg(struct hns3_hw *hw, bool enable) -+{ -+ struct hns3_config_auto_neg_cmd *req; -+ struct hns3_cmd_desc desc; -+ uint32_t flag = 0; -+ int ret; -+ -+ hns3_cmd_setup_basic_desc(&desc, HNS3_OPC_CONFIG_AN_MODE, false); -+ -+ req = (struct hns3_config_auto_neg_cmd *)desc.data; -+ if (enable) -+ hns3_set_bit(flag, HNS3_MAC_CFG_AN_EN_B, 1); -+ req->cfg_an_cmd_flag = rte_cpu_to_le_32(flag); -+ -+ ret = hns3_cmd_send(hw, &desc, 1); -+ if (ret) -+ hns3_err(hw, "autoneg set cmd failed, ret = %d.", ret); -+ -+ return ret; -+} -+ -+static int -+hns3_set_fiber_port_link_speed(struct hns3_hw *hw, -+ struct hns3_set_link_speed_cfg *cfg) -+{ -+ int ret; -+ -+ if (hw->mac.support_autoneg) { -+ ret = hns3_set_autoneg(hw, cfg->autoneg); -+ if (ret) { -+ hns3_err(hw, "failed to configure auto-negotiation."); -+ return ret; -+ } -+ -+ /* -+ * To enable auto-negotiation, we only need to open the switch -+ * of auto-negotiation, then firmware sets all speed -+ * capabilities. -+ */ -+ if (cfg->autoneg) -+ return 0; -+ } -+ -+ /* -+ * Some hardware doesn't support auto-negotiation, but users may not -+ * configure link_speeds (default 0), which means auto-negotiation -+ * In this case, a warning message need to be printed, instead of -+ * an error. -+ */ -+ if (cfg->autoneg) { -+ hns3_warn(hw, "auto-negotiation is not supported."); -+ return 0; -+ } -+ -+ return 0; -+} -+ -+static int -+hns3_set_port_link_speed(struct hns3_hw *hw, -+ struct hns3_set_link_speed_cfg *cfg) -+{ -+ int ret; -+ -+ if (hw->mac.media_type == HNS3_MEDIA_TYPE_COPPER) { -+#if defined(RTE_HNS3_ONLY_1630_FPGA) -+ struct hns3_pf *pf = HNS3_DEV_HW_TO_PF(hw); -+ if (pf->is_tmp_phy) -+ return 0; -+#endif -+ -+ ret = hns3_set_copper_port_link_speed(hw, cfg); -+ if (ret) { -+ hns3_err(hw, "failed to set copper port link speed," -+ "ret = %d.", ret); -+ return ret; -+ } -+ } else if (hw->mac.media_type == HNS3_MEDIA_TYPE_FIBER) { -+ ret = hns3_set_fiber_port_link_speed(hw, cfg); -+ if (ret) { -+ hns3_err(hw, "failed to set fiber port link speed," -+ "ret = %d.", ret); -+ return ret; -+ } -+ } -+ -+ return 0; -+} -+ -+static int -+hns3_apply_link_speed(struct hns3_hw *hw) -+{ -+ struct rte_eth_conf *conf = &hw->data->dev_conf; -+ struct hns3_set_link_speed_cfg cfg; -+ -+ memset(&cfg, 0, sizeof(struct hns3_set_link_speed_cfg)); -+ cfg.autoneg = (conf->link_speeds == ETH_LINK_SPEED_AUTONEG) ? -+ ETH_LINK_AUTONEG : ETH_LINK_FIXED; -+ if (cfg.autoneg != ETH_LINK_AUTONEG) { -+ hns3_err(hw, "device doesn't support to force link speed."); -+ return -EOPNOTSUPP; -+ } -+ -+ return hns3_set_port_link_speed(hw, &cfg); -+} -+ -+static int - hns3_do_start(struct hns3_adapter *hns, bool reset_queue) - { - struct hns3_hw *hw = &hns->hw; -@@ -5280,9 +5422,15 @@ hns3_do_start(struct hns3_adapter *hns, bool reset_queue) - PMD_INIT_LOG(ERR, "failed to enable MAC, ret = %d", ret); - goto err_config_mac_mode; - } -+ -+ ret = hns3_apply_link_speed(hw); -+ if (ret) -+ goto err_config_mac_mode; -+ - return 0; - - err_config_mac_mode: -+ (void)hns3_cfg_mac_mode(hw, false); - hns3_dev_release_mbufs(hns); - /* - * Here is exception handling, hns3_reset_all_tqps will have the -diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h -index a677ddc..8b6c0d2 100644 ---- a/drivers/net/hns3/hns3_ethdev.h -+++ b/drivers/net/hns3/hns3_ethdev.h -@@ -165,6 +165,12 @@ struct hns3_cfg { - uint16_t umv_space; - }; - -+struct hns3_set_link_speed_cfg { -+ uint32_t speed; -+ uint8_t duplex : 1; -+ uint8_t autoneg : 1; -+}; -+ - /* mac media type */ - enum hns3_media_type { - HNS3_MEDIA_TYPE_UNKNOWN, --- -2.7.4 - diff --git a/0115-net-hns3-fix-return-value-for-unsupported-tuple.patch b/0115-net-hns3-fix-return-value-for-unsupported-tuple.patch new file mode 100644 index 0000000000000000000000000000000000000000..3cef72173207a6edf3d1c9e85ff1bfb1def13ad1 --- /dev/null +++ b/0115-net-hns3-fix-return-value-for-unsupported-tuple.patch @@ -0,0 +1,32 @@ +From a0077b01d8ba2b5310ca6fdee7c61e40ae6eeca3 Mon Sep 17 00:00:00 2001 +From: Huisong Li +Date: Wed, 1 Jun 2022 11:52:47 +0800 +Subject: [PATCH 115/122] net/hns3: fix return value for unsupported tuple + +Driver should return false for unsupported tuple. + +Fixes: 18a4b4c3fa80 ("net/hns3: add default to switch when parsing fd tuple") +Cc: stable@dpdk.org + +Signed-off-by: Huisong Li +Signed-off-by: Min Hu (Connor) +--- + drivers/net/hns3/hns3_fdir.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/net/hns3/hns3_fdir.c b/drivers/net/hns3/hns3_fdir.c +index 2a7978ac07..a0d6598e57 100644 +--- a/drivers/net/hns3/hns3_fdir.c ++++ b/drivers/net/hns3/hns3_fdir.c +@@ -631,7 +631,7 @@ static bool hns3_fd_convert_tuple(struct hns3_hw *hw, + break; + default: + hns3_warn(hw, "not support tuple of (%u)", tuple); +- break; ++ return false; + } + return true; + } +-- +2.22.0 + diff --git a/0115-net-hns3-support-flow-control-autoneg-for-copper-por.patch b/0115-net-hns3-support-flow-control-autoneg-for-copper-por.patch deleted file mode 100644 index 706f60d152681f5230596a2f98b8bb2109ebbaaa..0000000000000000000000000000000000000000 --- a/0115-net-hns3-support-flow-control-autoneg-for-copper-por.patch +++ /dev/null @@ -1,239 +0,0 @@ -From d2f7bc262f17f8f640e279706f6b3bc99a4dbb0f Mon Sep 17 00:00:00 2001 -From: Huisong Li -Date: Tue, 13 Apr 2021 21:47:18 +0800 -Subject: [PATCH 115/189] net/hns3: support flow control autoneg for copper - port - -If the flow control auto-negotiation is not supported and the flow -control modes on the local and link partner is asymmetric, the flow -control on the NIC does not take effect. The support of the -auto-negotiation capability requires the cooperation of the firmware -and driver. - -This patch supports the flow control auto-negotiation only for copper -port. For optical ports, the forced flow control mode is still used. - -Signed-off-by: Huisong Li -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_ethdev.c | 162 ++++++++++++++++++++++++++++++++++++++--- - 1 file changed, 152 insertions(+), 10 deletions(-) - -diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c -index 019d9fe..1ee1651 100644 ---- a/drivers/net/hns3/hns3_ethdev.c -+++ b/drivers/net/hns3/hns3_ethdev.c -@@ -5088,6 +5088,24 @@ hns3_get_port_supported_speed(struct rte_eth_dev *eth_dev) - return 0; - } - -+static void -+hns3_get_fc_autoneg_capability(struct hns3_adapter *hns) -+{ -+ struct hns3_mac *mac = &hns->hw.mac; -+ -+ if (mac->media_type == HNS3_MEDIA_TYPE_COPPER) { -+ hns->pf.support_fc_autoneg = true; -+ return; -+ } -+ -+ /* -+ * Flow control auto-negotiation requires the cooperation of the driver -+ * and firmware. Currently, the optical port does not support flow -+ * control auto-negotiation. -+ */ -+ hns->pf.support_fc_autoneg = false; -+} -+ - static int - hns3_init_pf(struct rte_eth_dev *eth_dev) - { -@@ -5195,6 +5213,8 @@ hns3_init_pf(struct rte_eth_dev *eth_dev) - goto err_supported_speed; - } - -+ hns3_get_fc_autoneg_capability(hns); -+ - hns3_tm_conf_init(eth_dev); - - return 0; -@@ -5761,19 +5781,102 @@ hns3_dev_close(struct rte_eth_dev *eth_dev) - return ret; - } - --static int --hns3_flow_ctrl_get(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf) -+static void -+hns3_get_autoneg_rxtx_pause_copper(struct hns3_hw *hw, bool *rx_pause, -+ bool *tx_pause) -+{ -+ struct hns3_mac *mac = &hw->mac; -+ uint32_t advertising = mac->advertising; -+ uint32_t lp_advertising = mac->lp_advertising; -+ *rx_pause = false; -+ *tx_pause = false; -+ -+ if (advertising & lp_advertising & HNS3_PHY_LINK_MODE_PAUSE_BIT) { -+ *rx_pause = true; -+ *tx_pause = true; -+ } else if (advertising & lp_advertising & -+ HNS3_PHY_LINK_MODE_ASYM_PAUSE_BIT) { -+ if (advertising & HNS3_PHY_LINK_MODE_PAUSE_BIT) -+ *rx_pause = true; -+ else if (lp_advertising & HNS3_PHY_LINK_MODE_PAUSE_BIT) -+ *tx_pause = true; -+ } -+} -+ -+static enum hns3_fc_mode -+hns3_get_autoneg_fc_mode(struct hns3_hw *hw) -+{ -+ enum hns3_fc_mode current_mode; -+ bool rx_pause = false; -+ bool tx_pause = false; -+ -+ switch (hw->mac.media_type) { -+ case HNS3_MEDIA_TYPE_COPPER: -+ hns3_get_autoneg_rxtx_pause_copper(hw, &rx_pause, &tx_pause); -+ break; -+ -+ /* -+ * Flow control auto-negotiation is not supported for fiber and -+ * backpalne media type. -+ */ -+ case HNS3_MEDIA_TYPE_FIBER: -+ case HNS3_MEDIA_TYPE_BACKPLANE: -+ hns3_err(hw, "autoneg FC mode can't be obtained, but flow control auto-negotiation is enabled."); -+ current_mode = hw->requested_fc_mode; -+ goto out; -+ default: -+ hns3_err(hw, "autoneg FC mode can't be obtained for unknown media type(%u).", -+ hw->mac.media_type); -+ current_mode = HNS3_FC_NONE; -+ goto out; -+ } -+ -+ if (rx_pause && tx_pause) -+ current_mode = HNS3_FC_FULL; -+ else if (rx_pause) -+ current_mode = HNS3_FC_RX_PAUSE; -+ else if (tx_pause) -+ current_mode = HNS3_FC_TX_PAUSE; -+ else -+ current_mode = HNS3_FC_NONE; -+ -+out: -+ return current_mode; -+} -+ -+static enum hns3_fc_mode -+hns3_get_current_fc_mode(struct rte_eth_dev *dev) - { - struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private); - struct hns3_pf *pf = HNS3_DEV_PRIVATE_TO_PF(dev->data->dev_private); -+ struct hns3_mac *mac = &hw->mac; - -- fc_conf->pause_time = pf->pause_time; -+ /* -+ * When the flow control mode is obtained, the device may not complete -+ * auto-negotiation. It is necessary to wait for link establishment. -+ */ -+ (void)hns3_dev_link_update(dev, 1); - - /* -- * If fc auto-negotiation is not supported, the configured fc mode -- * from user is the current fc mode. -+ * If the link auto-negotiation of the nic is disabled, or the flow -+ * control auto-negotiation is not supported, the forced flow control -+ * mode is used. - */ -- switch (hw->requested_fc_mode) { -+ if (mac->link_autoneg == 0 || !pf->support_fc_autoneg) -+ return hw->requested_fc_mode; -+ -+ return hns3_get_autoneg_fc_mode(hw); -+} -+ -+static int -+hns3_flow_ctrl_get(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf) -+{ -+ struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private); -+ struct hns3_pf *pf = HNS3_DEV_PRIVATE_TO_PF(dev->data->dev_private); -+ enum hns3_fc_mode current_mode; -+ -+ current_mode = hns3_get_current_fc_mode(dev); -+ switch (current_mode) { - case HNS3_FC_FULL: - fc_conf->mode = RTE_FC_FULL; - break; -@@ -5789,6 +5892,9 @@ hns3_flow_ctrl_get(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf) - break; - } - -+ fc_conf->pause_time = pf->pause_time; -+ fc_conf->autoneg = pf->support_fc_autoneg ? hw->mac.link_autoneg : 0; -+ - return 0; - } - -@@ -5817,6 +5923,41 @@ hns3_get_fc_mode(struct hns3_hw *hw, enum rte_eth_fc_mode mode) - } - - static int -+hns3_check_fc_autoneg_valid(struct hns3_hw *hw, uint8_t autoneg) -+{ -+ struct hns3_pf *pf = HNS3_DEV_HW_TO_PF(hw); -+ -+ if (!pf->support_fc_autoneg) { -+ if (autoneg != 0) { -+ hns3_err(hw, "unsupported fc auto-negotiation setting."); -+ return -EOPNOTSUPP; -+ } -+ -+ /* -+ * Flow control auto-negotiation of the NIC is not supported, -+ * but other auto-negotiation features may be supported. -+ */ -+ if (autoneg != hw->mac.link_autoneg) { -+ hns3_err(hw, "please use 'link_speeds' in struct rte_eth_conf to disable autoneg!"); -+ return -EOPNOTSUPP; -+ } -+ -+ return 0; -+ } -+ -+ /* -+ * If flow control auto-negotiation of the NIC is supported, all -+ * auto-negotiation features are supported. -+ */ -+ if (autoneg != hw->mac.link_autoneg) { -+ hns3_err(hw, "please use 'link_speeds' in struct rte_eth_conf to change autoneg!"); -+ return -EOPNOTSUPP; -+ } -+ -+ return 0; -+} -+ -+static int - hns3_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf) - { - struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private); -@@ -5831,10 +5972,11 @@ hns3_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf) - fc_conf->send_xon, fc_conf->mac_ctrl_frame_fwd); - return -EINVAL; - } -- if (fc_conf->autoneg) { -- hns3_err(hw, "Unsupported fc auto-negotiation setting."); -- return -EINVAL; -- } -+ -+ ret = hns3_check_fc_autoneg_valid(hw, fc_conf->autoneg); -+ if (ret) -+ return ret; -+ - if (!fc_conf->pause_time) { - hns3_err(hw, "Invalid pause time %u setting.", - fc_conf->pause_time); --- -2.7.4 - diff --git a/0116-net-hns3-modify-a-function-name.patch b/0116-net-hns3-modify-a-function-name.patch new file mode 100644 index 0000000000000000000000000000000000000000..464012acd8f43d373ff7d405529d7b553bdab926 --- /dev/null +++ b/0116-net-hns3-modify-a-function-name.patch @@ -0,0 +1,74 @@ +From 25cd4e3af8f0c5e86bff599ea31a0e4024cf03d2 Mon Sep 17 00:00:00 2001 +From: Huisong Li +Date: Wed, 1 Jun 2022 11:52:48 +0800 +Subject: [PATCH 116/122] net/hns3: modify a function name + +The meaning of the "hns3_get_count" function is not precise enough. +Change from "hns3_get_count" to "hns3_fd_get_count". + +Signed-off-by: Huisong Li +Signed-off-by: Min Hu (Connor) +--- + drivers/net/hns3/hns3_fdir.c | 2 +- + drivers/net/hns3/hns3_fdir.h | 2 +- + drivers/net/hns3/hns3_flow.c | 6 +++--- + 3 files changed, 5 insertions(+), 5 deletions(-) + +diff --git a/drivers/net/hns3/hns3_fdir.c b/drivers/net/hns3/hns3_fdir.c +index a0d6598e57..762b89a51e 100644 +--- a/drivers/net/hns3/hns3_fdir.c ++++ b/drivers/net/hns3/hns3_fdir.c +@@ -1099,7 +1099,7 @@ int hns3_restore_all_fdir_filter(struct hns3_adapter *hns) + return 0; + } + +-int hns3_get_count(struct hns3_hw *hw, uint32_t id, uint64_t *value) ++int hns3_fd_get_count(struct hns3_hw *hw, uint32_t id, uint64_t *value) + { + struct hns3_fd_get_cnt_cmd *req; + struct hns3_cmd_desc desc; +diff --git a/drivers/net/hns3/hns3_fdir.h b/drivers/net/hns3/hns3_fdir.h +index 3376c40c8e..4d18759160 100644 +--- a/drivers/net/hns3/hns3_fdir.h ++++ b/drivers/net/hns3/hns3_fdir.h +@@ -184,7 +184,7 @@ void hns3_fdir_filter_uninit(struct hns3_adapter *hns); + int hns3_fdir_filter_program(struct hns3_adapter *hns, + struct hns3_fdir_rule *rule, bool del); + int hns3_clear_all_fdir_filter(struct hns3_adapter *hns); +-int hns3_get_count(struct hns3_hw *hw, uint32_t id, uint64_t *value); ++int hns3_fd_get_count(struct hns3_hw *hw, uint32_t id, uint64_t *value); + int hns3_restore_all_fdir_filter(struct hns3_adapter *hns); + + #endif /* _HNS3_FDIR_H_ */ +diff --git a/drivers/net/hns3/hns3_flow.c b/drivers/net/hns3/hns3_flow.c +index e994cac314..b60ad596dc 100644 +--- a/drivers/net/hns3/hns3_flow.c ++++ b/drivers/net/hns3/hns3_flow.c +@@ -164,13 +164,13 @@ hns3_counter_new(struct rte_eth_dev *dev, uint32_t indirect, uint32_t id, + "Counter id is used, indirect flag not match"); + /* Clear the indirect counter on first use. */ + if (cnt->indirect && cnt->ref_cnt == 1) +- (void)hns3_get_count(hw, id, &value); ++ (void)hns3_fd_get_count(hw, id, &value); + cnt->ref_cnt++; + return 0; + } + + /* Clear the counter by read ops because the counter is read-clear */ +- ret = hns3_get_count(hw, id, &value); ++ ret = hns3_fd_get_count(hw, id, &value); + if (ret) + return rte_flow_error_set(error, EIO, + RTE_FLOW_ERROR_TYPE_HANDLE, NULL, +@@ -210,7 +210,7 @@ hns3_counter_query(struct rte_eth_dev *dev, struct rte_flow *flow, + RTE_FLOW_ERROR_TYPE_HANDLE, NULL, + "Can't find counter id"); + +- ret = hns3_get_count(&hns->hw, flow->counter_id, &value); ++ ret = hns3_fd_get_count(&hns->hw, flow->counter_id, &value); + if (ret) { + rte_flow_error_set(error, -ret, RTE_FLOW_ERROR_TYPE_HANDLE, + NULL, "Read counter fail."); +-- +2.22.0 + diff --git a/0116-net-hns3-support-fixed-link-speed.patch b/0116-net-hns3-support-fixed-link-speed.patch deleted file mode 100644 index 47e3ab6f609328589fe242f2733db9b3d1d670da..0000000000000000000000000000000000000000 --- a/0116-net-hns3-support-fixed-link-speed.patch +++ /dev/null @@ -1,204 +0,0 @@ -From 50d4bb519096de30035d48d3a8a2246bd4b09469 Mon Sep 17 00:00:00 2001 -From: Huisong Li -Date: Tue, 13 Apr 2021 21:47:19 +0800 -Subject: [PATCH 116/189] net/hns3: support fixed link speed - -This patch adds the configuration of fixed speed for the PF device. - -Signed-off-by: Huisong Li -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_ethdev.c | 144 ++++++++++++++++++++++++++++++++++++++--- - 1 file changed, 135 insertions(+), 9 deletions(-) - -diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c -index 1ee1651..1d09b5b 100644 ---- a/drivers/net/hns3/hns3_ethdev.c -+++ b/drivers/net/hns3/hns3_ethdev.c -@@ -2473,12 +2473,6 @@ hns3_dev_configure(struct rte_eth_dev *dev) - } - - hw->adapter_state = HNS3_NIC_CONFIGURING; -- if (conf->link_speeds & ETH_LINK_SPEED_FIXED) { -- hns3_err(hw, "setting link speed/duplex not supported"); -- ret = -EINVAL; -- goto cfg_err; -- } -- - if ((uint32_t)mq_mode & ETH_MQ_RX_DCB_FLAG) { - ret = hns3_check_dcb_cfg(dev); - if (ret) -@@ -5271,6 +5265,130 @@ hns3_uninit_pf(struct rte_eth_dev *eth_dev) - hw->io_base = NULL; - } - -+static uint32_t -+hns3_convert_link_speeds2bitmap_copper(uint32_t link_speeds) -+{ -+ uint32_t speed_bit; -+ -+ switch (link_speeds & ~ETH_LINK_SPEED_FIXED) { -+ case ETH_LINK_SPEED_10M: -+ speed_bit = HNS3_PHY_LINK_SPEED_10M_BIT; -+ break; -+ case ETH_LINK_SPEED_10M_HD: -+ speed_bit = HNS3_PHY_LINK_SPEED_10M_HD_BIT; -+ break; -+ case ETH_LINK_SPEED_100M: -+ speed_bit = HNS3_PHY_LINK_SPEED_100M_BIT; -+ break; -+ case ETH_LINK_SPEED_100M_HD: -+ speed_bit = HNS3_PHY_LINK_SPEED_100M_HD_BIT; -+ break; -+ case ETH_LINK_SPEED_1G: -+ speed_bit = HNS3_PHY_LINK_SPEED_1000M_BIT; -+ break; -+ default: -+ speed_bit = 0; -+ break; -+ } -+ -+ return speed_bit; -+} -+ -+static uint32_t -+hns3_convert_link_speeds2bitmap_fiber(uint32_t link_speeds) -+{ -+ uint32_t speed_bit; -+ -+ switch (link_speeds & ~ETH_LINK_SPEED_FIXED) { -+ case ETH_LINK_SPEED_1G: -+ speed_bit = HNS3_FIBER_LINK_SPEED_1G_BIT; -+ break; -+ case ETH_LINK_SPEED_10G: -+ speed_bit = HNS3_FIBER_LINK_SPEED_10G_BIT; -+ break; -+ case ETH_LINK_SPEED_25G: -+ speed_bit = HNS3_FIBER_LINK_SPEED_25G_BIT; -+ break; -+ case ETH_LINK_SPEED_40G: -+ speed_bit = HNS3_FIBER_LINK_SPEED_40G_BIT; -+ break; -+ case ETH_LINK_SPEED_50G: -+ speed_bit = HNS3_FIBER_LINK_SPEED_50G_BIT; -+ break; -+ case ETH_LINK_SPEED_100G: -+ speed_bit = HNS3_FIBER_LINK_SPEED_100G_BIT; -+ break; -+ case ETH_LINK_SPEED_200G: -+ speed_bit = HNS3_FIBER_LINK_SPEED_200G_BIT; -+ break; -+ default: -+ speed_bit = 0; -+ break; -+ } -+ -+ return speed_bit; -+} -+ -+static int -+hns3_check_port_speed(struct hns3_hw *hw, uint32_t link_speeds) -+{ -+ struct hns3_mac *mac = &hw->mac; -+ uint32_t supported_speed = mac->supported_speed; -+ uint32_t speed_bit = 0; -+ -+ if (mac->media_type == HNS3_MEDIA_TYPE_COPPER) -+ speed_bit = hns3_convert_link_speeds2bitmap_copper(link_speeds); -+ else if (mac->media_type == HNS3_MEDIA_TYPE_FIBER) -+ speed_bit = hns3_convert_link_speeds2bitmap_fiber(link_speeds); -+ -+ if (!(speed_bit & supported_speed)) { -+ hns3_err(hw, "link_speeds(0x%x) exceeds the supported speed capability or is incorrect.", -+ link_speeds); -+ return -EINVAL; -+ } -+ -+ return 0; -+} -+ -+static inline uint32_t -+hns3_get_link_speed(uint32_t link_speeds) -+{ -+ uint32_t speed = ETH_SPEED_NUM_NONE; -+ -+ if (link_speeds & ETH_LINK_SPEED_10M || -+ link_speeds & ETH_LINK_SPEED_10M_HD) -+ speed = ETH_SPEED_NUM_10M; -+ if (link_speeds & ETH_LINK_SPEED_100M || -+ link_speeds & ETH_LINK_SPEED_100M_HD) -+ speed = ETH_SPEED_NUM_100M; -+ if (link_speeds & ETH_LINK_SPEED_1G) -+ speed = ETH_SPEED_NUM_1G; -+ if (link_speeds & ETH_LINK_SPEED_10G) -+ speed = ETH_SPEED_NUM_10G; -+ if (link_speeds & ETH_LINK_SPEED_25G) -+ speed = ETH_SPEED_NUM_25G; -+ if (link_speeds & ETH_LINK_SPEED_40G) -+ speed = ETH_SPEED_NUM_40G; -+ if (link_speeds & ETH_LINK_SPEED_50G) -+ speed = ETH_SPEED_NUM_50G; -+ if (link_speeds & ETH_LINK_SPEED_100G) -+ speed = ETH_SPEED_NUM_100G; -+ if (link_speeds & ETH_LINK_SPEED_200G) -+ speed = ETH_SPEED_NUM_200G; -+ -+ return speed; -+} -+ -+static uint8_t -+hns3_get_link_duplex(uint32_t link_speeds) -+{ -+ if ((link_speeds & ETH_LINK_SPEED_10M_HD) || -+ (link_speeds & ETH_LINK_SPEED_100M_HD)) -+ return ETH_LINK_HALF_DUPLEX; -+ else -+ return ETH_LINK_FULL_DUPLEX; -+} -+ - static int - hns3_set_copper_port_link_speed(struct hns3_hw *hw, - struct hns3_set_link_speed_cfg *cfg) -@@ -5298,6 +5416,9 @@ hns3_set_copper_port_link_speed(struct hns3_hw *hw, - HNS3_PHY_LINK_SPEED_100M_BIT | - HNS3_PHY_LINK_SPEED_100M_HD_BIT | - HNS3_PHY_LINK_SPEED_1000M_BIT; -+ } else { -+ req->speed = cfg->speed; -+ req->duplex = cfg->duplex; - } - - return hns3_cmd_send(hw, desc, HNS3_PHY_PARAM_CFG_BD_NUM); -@@ -5358,7 +5479,7 @@ hns3_set_fiber_port_link_speed(struct hns3_hw *hw, - return 0; - } - -- return 0; -+ return hns3_cfg_mac_speed_dup(hw, cfg->speed, cfg->duplex); - } - - static int -@@ -5397,13 +5518,18 @@ hns3_apply_link_speed(struct hns3_hw *hw) - { - struct rte_eth_conf *conf = &hw->data->dev_conf; - struct hns3_set_link_speed_cfg cfg; -+ int ret; - - memset(&cfg, 0, sizeof(struct hns3_set_link_speed_cfg)); - cfg.autoneg = (conf->link_speeds == ETH_LINK_SPEED_AUTONEG) ? - ETH_LINK_AUTONEG : ETH_LINK_FIXED; - if (cfg.autoneg != ETH_LINK_AUTONEG) { -- hns3_err(hw, "device doesn't support to force link speed."); -- return -EOPNOTSUPP; -+ ret = hns3_check_port_speed(hw, conf->link_speeds); -+ if (ret) -+ return ret; -+ -+ cfg.speed = hns3_get_link_speed(conf->link_speeds); -+ cfg.duplex = hns3_get_link_duplex(conf->link_speeds); - } - - return hns3_set_port_link_speed(hw, &cfg); --- -2.7.4 - diff --git a/0117-net-hns3-rename-Rx-burst-function.patch b/0117-net-hns3-rename-Rx-burst-function.patch deleted file mode 100644 index 58d4024cedab6a4bfd617b6937d34f9fd968d91a..0000000000000000000000000000000000000000 --- a/0117-net-hns3-rename-Rx-burst-function.patch +++ /dev/null @@ -1,106 +0,0 @@ -From a9baef6c5022ca2b1c78822076ea7a00a1fe4733 Mon Sep 17 00:00:00 2001 -From: Chengwen Feng -Date: Thu, 15 Apr 2021 16:35:21 +0800 -Subject: [PATCH 117/189] net/hns3: rename Rx burst function - -Currently, user could use runtime config "rx_func_hint=simple" to -select the hns3_recv_pkts API, but the API's name get from -rte_eth_rx_burst_mode_get is "Scalar" which has not reflected "simple". - -So this patch renames hns3_recv_pkts to hns3_recv_pkts_simple, and -also change it's name which gets from rte_eth_rx_burst_mode_get to -"Scalar Simple" to maintain conceptual consistency. - -Fixes: 521ab3e93361 ("net/hns3: add simple Rx path") -Cc: stable@dpdk.org - -Signed-off-by: Chengwen Feng -Signed-off-by: Min Hu (Connor) -Acked-by: Ferruh Yigit ---- - drivers/net/hns3/hns3_rxtx.c | 18 ++++++++++-------- - drivers/net/hns3/hns3_rxtx.h | 4 ++-- - 2 files changed, 12 insertions(+), 10 deletions(-) - -diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c -index 43f8c64..4873c9c 100644 ---- a/drivers/net/hns3/hns3_rxtx.c -+++ b/drivers/net/hns3/hns3_rxtx.c -@@ -2017,7 +2017,7 @@ hns3_dev_supported_ptypes_get(struct rte_eth_dev *dev) - }; - struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private); - -- if (dev->rx_pkt_burst == hns3_recv_pkts || -+ if (dev->rx_pkt_burst == hns3_recv_pkts_simple || - dev->rx_pkt_burst == hns3_recv_scattered_pkts || - dev->rx_pkt_burst == hns3_recv_pkts_vec || - dev->rx_pkt_burst == hns3_recv_pkts_vec_sve) { -@@ -2389,7 +2389,9 @@ hns3_rx_ptp_timestamp_handle(struct hns3_rx_queue *rxq, struct rte_mbuf *mbuf, - } - - uint16_t --hns3_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) -+hns3_recv_pkts_simple(void *rx_queue, -+ struct rte_mbuf **rx_pkts, -+ uint16_t nb_pkts) - { - volatile struct hns3_desc *rx_ring; /* RX ring (desc) */ - volatile struct hns3_desc *rxdp; /* pointer of the current desc */ -@@ -2772,10 +2774,10 @@ hns3_rx_burst_mode_get(struct rte_eth_dev *dev, __rte_unused uint16_t queue_id, - eth_rx_burst_t pkt_burst; - const char *info; - } burst_infos[] = { -- { hns3_recv_pkts, "Scalar" }, -+ { hns3_recv_pkts_simple, "Scalar Simple" }, - { hns3_recv_scattered_pkts, "Scalar Scattered" }, -- { hns3_recv_pkts_vec, "Vector Neon" }, -- { hns3_recv_pkts_vec_sve, "Vector Sve" }, -+ { hns3_recv_pkts_vec, "Vector Neon" }, -+ { hns3_recv_pkts_vec_sve, "Vector Sve" }, - }; - - eth_rx_burst_t pkt_burst = dev->rx_pkt_burst; -@@ -2833,14 +2835,14 @@ hns3_get_rx_function(struct rte_eth_dev *dev) - if (hns->rx_func_hint == HNS3_IO_FUNC_HINT_SVE && sve_allowed) - return hns3_recv_pkts_vec_sve; - if (hns->rx_func_hint == HNS3_IO_FUNC_HINT_SIMPLE && simple_allowed) -- return hns3_recv_pkts; -+ return hns3_recv_pkts_simple; - if (hns->rx_func_hint == HNS3_IO_FUNC_HINT_COMMON) - return hns3_recv_scattered_pkts; - - if (vec_allowed) - return hns3_recv_pkts_vec; - if (simple_allowed) -- return hns3_recv_pkts; -+ return hns3_recv_pkts_simple; - - return hns3_recv_scattered_pkts; - } -@@ -4517,7 +4519,7 @@ hns3_dev_rx_descriptor_status(void *rx_queue, uint16_t offset) - rxdp = &rxq->rx_ring[desc_id]; - bd_base_info = rte_le_to_cpu_32(rxdp->rx.bd_base_info); - dev = &rte_eth_devices[rxq->port_id]; -- if (dev->rx_pkt_burst == hns3_recv_pkts || -+ if (dev->rx_pkt_burst == hns3_recv_pkts_simple || - dev->rx_pkt_burst == hns3_recv_scattered_pkts) { - if (offset >= rxq->nb_rx_desc - rxq->rx_free_hold) - return RTE_ETH_RX_DESC_UNAVAIL; -diff --git a/drivers/net/hns3/hns3_rxtx.h b/drivers/net/hns3/hns3_rxtx.h -index 44d0ca7..5067c92 100644 ---- a/drivers/net/hns3/hns3_rxtx.h -+++ b/drivers/net/hns3/hns3_rxtx.h -@@ -683,8 +683,8 @@ int hns3_dev_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id); - int hns3_dev_rx_queue_stop(struct rte_eth_dev *dev, uint16_t rx_queue_id); - int hns3_dev_tx_queue_start(struct rte_eth_dev *dev, uint16_t tx_queue_id); - int hns3_dev_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id); --uint16_t hns3_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, -- uint16_t nb_pkts); -+uint16_t hns3_recv_pkts_simple(void *rx_queue, struct rte_mbuf **rx_pkts, -+ uint16_t nb_pkts); - uint16_t hns3_recv_scattered_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, - uint16_t nb_pkts); - uint16_t hns3_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts, --- -2.7.4 - diff --git a/0117-net-hns3-unify-the-code-wrap-style.patch b/0117-net-hns3-unify-the-code-wrap-style.patch new file mode 100644 index 0000000000000000000000000000000000000000..3a0dbd462702a19852d9610fe2a0b4bea6861275 --- /dev/null +++ b/0117-net-hns3-unify-the-code-wrap-style.patch @@ -0,0 +1,516 @@ +From 9a1166d20bc7b1b07207ec2f8c1964f59053570b Mon Sep 17 00:00:00 2001 +From: Huisong Li +Date: Wed, 1 Jun 2022 11:52:49 +0800 +Subject: [PATCH 117/122] net/hns3: unify the code wrap style + +Signed-off-by: Huisong Li +Signed-off-by: Min Hu (Connor) +--- + drivers/net/hns3/hns3_cmd.c | 2 +- + drivers/net/hns3/hns3_common.c | 10 +++++----- + drivers/net/hns3/hns3_dcb.c | 5 ++--- + drivers/net/hns3/hns3_ethdev.c | 18 ++++++++---------- + drivers/net/hns3/hns3_ethdev_vf.c | 23 +++++++++++------------ + drivers/net/hns3/hns3_fdir.c | 26 +++++++++++++------------- + drivers/net/hns3/hns3_flow.c | 10 ++++------ + drivers/net/hns3/hns3_rxtx.c | 28 +++++++++++++--------------- + drivers/net/hns3/hns3_stats.c | 28 ++++++++++++++-------------- + 9 files changed, 71 insertions(+), 79 deletions(-) + +diff --git a/drivers/net/hns3/hns3_cmd.c b/drivers/net/hns3/hns3_cmd.c +index 96f8f38cbb..e3d096d9cb 100644 +--- a/drivers/net/hns3/hns3_cmd.c ++++ b/drivers/net/hns3/hns3_cmd.c +@@ -108,7 +108,7 @@ hns3_alloc_cmd_queue(struct hns3_hw *hw, int ring_type) + ret = hns3_alloc_cmd_desc(hw, ring); + if (ret) + hns3_err(hw, "descriptor %s alloc error %d", +- (ring_type == HNS3_TYPE_CSQ) ? "CSQ" : "CRQ", ret); ++ (ring_type == HNS3_TYPE_CSQ) ? "CSQ" : "CRQ", ret); + + return ret; + } +diff --git a/drivers/net/hns3/hns3_common.c b/drivers/net/hns3/hns3_common.c +index edd16d8076..7a65db907e 100644 +--- a/drivers/net/hns3/hns3_common.c ++++ b/drivers/net/hns3/hns3_common.c +@@ -604,7 +604,7 @@ hns3_init_mac_addrs(struct rte_eth_dev *dev) + 0); + if (dev->data->mac_addrs == NULL) { + hns3_err(hw, "failed to allocate %zx bytes needed to store MAC addresses", +- sizeof(struct rte_ether_addr) * mac_addrs_capa); ++ sizeof(struct rte_ether_addr) * mac_addrs_capa); + return -ENOMEM; + } + +@@ -680,16 +680,16 @@ hns3_init_ring_with_vector(struct hns3_hw *hw) + ret = hw->ops.bind_ring_with_vector(hw, vec, false, + HNS3_RING_TYPE_TX, i); + if (ret) { +- PMD_INIT_LOG(ERR, "fail to unbind TX ring(%d) with " +- "vector: %u, ret=%d", i, vec, ret); ++ PMD_INIT_LOG(ERR, "fail to unbind TX ring(%d) with vector: %u, ret=%d", ++ i, vec, ret); + return ret; + } + + ret = hw->ops.bind_ring_with_vector(hw, vec, false, + HNS3_RING_TYPE_RX, i); + if (ret) { +- PMD_INIT_LOG(ERR, "fail to unbind RX ring(%d) with " +- "vector: %u, ret=%d", i, vec, ret); ++ PMD_INIT_LOG(ERR, "fail to unbind RX ring(%d) with vector: %u, ret=%d", ++ i, vec, ret); + return ret; + } + } +diff --git a/drivers/net/hns3/hns3_dcb.c b/drivers/net/hns3/hns3_dcb.c +index d88757611c..b22f618e0a 100644 +--- a/drivers/net/hns3/hns3_dcb.c ++++ b/drivers/net/hns3/hns3_dcb.c +@@ -876,9 +876,8 @@ hns3_dcb_pri_tc_base_dwrr_cfg(struct hns3_hw *hw) + + ret = hns3_dcb_pri_weight_cfg(hw, i, dwrr); + if (ret) { +- hns3_err(hw, +- "fail to send priority weight cmd: %d, ret = %d", +- i, ret); ++ hns3_err(hw, "fail to send priority weight cmd: %d, ret = %d", ++ i, ret); + return ret; + } + +diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c +index 97cf27d2a1..8a8f3f1950 100644 +--- a/drivers/net/hns3/hns3_ethdev.c ++++ b/drivers/net/hns3/hns3_ethdev.c +@@ -1627,7 +1627,7 @@ hns3_set_default_mac_addr(struct rte_eth_dev *dev, + ret = hw->ops.del_uc_mac_addr(hw, oaddr); + if (ret) { + hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE, +- oaddr); ++ oaddr); + hns3_warn(hw, "Remove old uc mac address(%s) fail: %d", + mac_str, ret); + +@@ -1659,7 +1659,7 @@ hns3_set_default_mac_addr(struct rte_eth_dev *dev, + ret_val = hw->ops.del_uc_mac_addr(hw, mac_addr); + if (ret_val) { + hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE, +- mac_addr); ++ mac_addr); + hns3_warn(hw, + "Failed to roll back to del setted mac addr(%s): %d", + mac_str, ret_val); +@@ -1670,7 +1670,7 @@ hns3_set_default_mac_addr(struct rte_eth_dev *dev, + if (ret_val) { + hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE, oaddr); + hns3_warn(hw, "Failed to restore old uc mac addr(%s): %d", +- mac_str, ret_val); ++ mac_str, ret_val); + } + rte_spinlock_unlock(&hw->lock); + +@@ -1747,7 +1747,7 @@ hns3_add_mc_mac_addr(struct hns3_hw *hw, struct rte_ether_addr *mac_addr) + if (ret == -ENOSPC) + hns3_err(hw, "mc mac vlan table is full"); + hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE, +- mac_addr); ++ mac_addr); + hns3_err(hw, "failed to add mc mac addr(%s): %d", mac_str, ret); + } + +@@ -2676,9 +2676,8 @@ hns3_check_dev_specifications(struct hns3_hw *hw) + { + if (hw->rss_ind_tbl_size == 0 || + hw->rss_ind_tbl_size > HNS3_RSS_IND_TBL_SIZE_MAX) { +- hns3_err(hw, "the size of hash lookup table configured (%u)" +- " exceeds the maximum(%u)", hw->rss_ind_tbl_size, +- HNS3_RSS_IND_TBL_SIZE_MAX); ++ hns3_err(hw, "the size of hash lookup table configured (%u) exceeds the maximum(%u)", ++ hw->rss_ind_tbl_size, HNS3_RSS_IND_TBL_SIZE_MAX); + return -EINVAL; + } + +@@ -3916,7 +3915,7 @@ hns3_dev_promiscuous_enable(struct rte_eth_dev *dev) + ret = hns3_enable_vlan_filter(hns, false); + if (ret) { + hns3_err(hw, "failed to enable promiscuous mode due to " +- "failure to disable vlan filter, ret = %d", ++ "failure to disable vlan filter, ret = %d", + ret); + err = hns3_set_promisc_mode(hw, false, allmulti); + if (err) +@@ -5993,8 +5992,7 @@ hns3_reset_service(void *param) + timersub(&tv, &tv_start, &tv_delta); + msec = hns3_clock_calctime_ms(&tv_delta); + if (msec > HNS3_RESET_PROCESS_MS) +- hns3_err(hw, "%d handle long time delta %" PRIu64 +- " ms time=%ld.%.6ld", ++ hns3_err(hw, "%d handle long time delta %" PRIu64 " ms time=%ld.%.6ld", + hw->reset.level, msec, + tv.tv_sec, tv.tv_usec); + if (ret == -EAGAIN) +diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c +index 0c170797f4..7323e47f15 100644 +--- a/drivers/net/hns3/hns3_ethdev_vf.c ++++ b/drivers/net/hns3/hns3_ethdev_vf.c +@@ -142,7 +142,7 @@ hns3vf_enable_msix(const struct rte_pci_device *device, bool op) + pos = hns3vf_find_pci_capability(device, PCI_CAP_ID_MSIX); + if (pos) { + ret = rte_pci_read_config(device, &control, sizeof(control), +- (pos + PCI_MSIX_FLAGS)); ++ (pos + PCI_MSIX_FLAGS)); + if (ret < 0) { + PMD_INIT_LOG(ERR, "Failed to read PCI offset 0x%x", + (pos + PCI_MSIX_FLAGS)); +@@ -154,10 +154,10 @@ hns3vf_enable_msix(const struct rte_pci_device *device, bool op) + else + control &= ~PCI_MSIX_FLAGS_ENABLE; + ret = rte_pci_write_config(device, &control, sizeof(control), +- (pos + PCI_MSIX_FLAGS)); ++ (pos + PCI_MSIX_FLAGS)); + if (ret < 0) { + PMD_INIT_LOG(ERR, "failed to write PCI offset 0x%x", +- (pos + PCI_MSIX_FLAGS)); ++ (pos + PCI_MSIX_FLAGS)); + return -ENXIO; + } + +@@ -199,7 +199,7 @@ hns3vf_remove_uc_mac_addr(struct hns3_hw *hw, struct rte_ether_addr *mac_addr) + false, NULL, 0); + if (ret) { + hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE, +- mac_addr); ++ mac_addr); + hns3_err(hw, "failed to add uc mac addr(%s), ret = %d", + mac_str, ret); + } +@@ -242,11 +242,11 @@ hns3vf_set_default_mac_addr(struct rte_eth_dev *dev, + if (ret == -EPERM) { + hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE, + old_addr); +- hns3_warn(hw, "Has permanet mac addr(%s) for vf", ++ hns3_warn(hw, "Has permanent mac addr(%s) for vf", + mac_str); + } else { + hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE, +- mac_addr); ++ mac_addr); + hns3_err(hw, "Failed to set mac addr(%s) for vf: %d", + mac_str, ret); + } +@@ -293,7 +293,7 @@ hns3vf_remove_mc_mac_addr(struct hns3_hw *hw, + NULL, 0); + if (ret) { + hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE, +- mac_addr); ++ mac_addr); + hns3_err(hw, "Failed to remove mc mac addr(%s) for vf: %d", + mac_str, ret); + } +@@ -715,9 +715,8 @@ hns3vf_check_dev_specifications(struct hns3_hw *hw) + { + if (hw->rss_ind_tbl_size == 0 || + hw->rss_ind_tbl_size > HNS3_RSS_IND_TBL_SIZE_MAX) { +- hns3_warn(hw, "the size of hash lookup table configured (%u)" +- " exceeds the maximum(%u)", hw->rss_ind_tbl_size, +- HNS3_RSS_IND_TBL_SIZE_MAX); ++ hns3_warn(hw, "the size of hash lookup table configured (%u) exceeds the maximum(%u)", ++ hw->rss_ind_tbl_size, HNS3_RSS_IND_TBL_SIZE_MAX); + return -EINVAL; + } + +@@ -1168,8 +1167,8 @@ hns3vf_vlan_offload_set(struct rte_eth_dev *dev, int mask) + int ret = 0; + + if (__atomic_load_n(&hw->reset.resetting, __ATOMIC_RELAXED)) { +- hns3_err(hw, "vf set vlan offload failed during resetting, " +- "mask = 0x%x", mask); ++ hns3_err(hw, "vf set vlan offload failed during resetting, mask = 0x%x", ++ mask); + return -EIO; + } + +diff --git a/drivers/net/hns3/hns3_fdir.c b/drivers/net/hns3/hns3_fdir.c +index 762b89a51e..30e5e66772 100644 +--- a/drivers/net/hns3/hns3_fdir.c ++++ b/drivers/net/hns3/hns3_fdir.c +@@ -321,7 +321,7 @@ int hns3_init_fd_config(struct hns3_adapter *hns) + break; + default: + hns3_err(hw, "Unsupported flow director mode %u", +- pf->fdir.fd_cfg.fd_mode); ++ pf->fdir.fd_cfg.fd_mode); + return -EOPNOTSUPP; + } + +@@ -337,7 +337,7 @@ int hns3_init_fd_config(struct hns3_adapter *hns) + BIT(INNER_SRC_IP) | BIT(INNER_DST_IP) | + BIT(INNER_SRC_PORT) | BIT(INNER_DST_PORT); + hns3_dbg(hw, "fdir tuple: inner"); ++ "ip_proto ip_tos l4_src_port l4_dst_port>"); + + /* If use max 400bit key, we can support tuples for ether type */ + if (pf->fdir.fd_cfg.max_key_length == MAX_KEY_LENGTH) { +@@ -348,8 +348,8 @@ int hns3_init_fd_config(struct hns3_adapter *hns) + BIT(OUTER_TUN_VNI) | BIT(OUTER_TUN_FLOW_ID) | + BIT(OUTER_ETH_TYPE) | BIT(OUTER_IP_PROTO); + hns3_dbg(hw, "fdir tuple more: inner outer"); ++ "vlan_tag2 sctp_tag> outer"); + } + + /* roce_type is used to filter roce frames +@@ -367,12 +367,11 @@ int hns3_init_fd_config(struct hns3_adapter *hns) + if (ret) + return ret; + +- hns3_dbg(hw, "fdir: stage1 stage2", +- pf->fdir.fd_cfg.rule_num[HNS3_FD_STAGE_1], +- pf->fdir.fd_cfg.cnt_num[HNS3_FD_STAGE_1], +- pf->fdir.fd_cfg.rule_num[HNS3_FD_STAGE_2], +- pf->fdir.fd_cfg.cnt_num[HNS3_FD_STAGE_2]); ++ hns3_dbg(hw, "fdir: stage1 stage2", ++ pf->fdir.fd_cfg.rule_num[HNS3_FD_STAGE_1], ++ pf->fdir.fd_cfg.cnt_num[HNS3_FD_STAGE_1], ++ pf->fdir.fd_cfg.rule_num[HNS3_FD_STAGE_2], ++ pf->fdir.fd_cfg.cnt_num[HNS3_FD_STAGE_2]); + + return hns3_set_fd_key_config(hns); + } +@@ -420,7 +419,7 @@ static int hns3_fd_tcam_config(struct hns3_hw *hw, bool sel_x, int loc, + ret = hns3_cmd_send(hw, desc, FD_TCAM_CMD_NUM); + if (ret) + hns3_err(hw, "Config tcam key fail, ret=%d loc=%d add=%d", +- ret, loc, is_add); ++ ret, loc, is_add); + return ret; + } + +@@ -673,6 +672,7 @@ static void hns3_fd_convert_meta_data(struct hns3_fd_key_cfg *cfg, + } else if (i == VLAN_NUMBER) { + uint32_t vlan_tag; + uint8_t vlan_num; ++ + if (rule->key_conf.spec.tunnel_type == 0) + vlan_num = rule->key_conf.vlan_num; + else +@@ -758,14 +758,14 @@ static int hns3_config_key(struct hns3_adapter *hns, + ret = hns3_fd_tcam_config(hw, false, rule->location, key_y, true); + if (ret) { + hns3_err(hw, "Config fd key_y fail, loc=%u, ret=%d", +- rule->queue_id, ret); ++ rule->queue_id, ret); + return ret; + } + + ret = hns3_fd_tcam_config(hw, true, rule->location, key_x, true); + if (ret) + hns3_err(hw, "Config fd key_x fail, loc=%u, ret=%d", +- rule->queue_id, ret); ++ rule->queue_id, ret); + return ret; + } + +diff --git a/drivers/net/hns3/hns3_flow.c b/drivers/net/hns3/hns3_flow.c +index b60ad596dc..5e0a9bc93f 100644 +--- a/drivers/net/hns3/hns3_flow.c ++++ b/drivers/net/hns3/hns3_flow.c +@@ -285,9 +285,8 @@ hns3_handle_action_queue(struct rte_eth_dev *dev, + + queue = (const struct rte_flow_action_queue *)action->conf; + if (queue->index >= hw->data->nb_rx_queues) { +- hns3_err(hw, "queue ID(%u) is greater than number of " +- "available queue (%u) in driver.", +- queue->index, hw->data->nb_rx_queues); ++ hns3_err(hw, "queue ID(%u) is greater than number of available queue (%u) in driver.", ++ queue->index, hw->data->nb_rx_queues); + return rte_flow_error_set(error, EINVAL, + RTE_FLOW_ERROR_TYPE_ACTION_CONF, + action, "Invalid queue ID in PF"); +@@ -1656,9 +1655,8 @@ hns3_clear_rss_filter(struct rte_eth_dev *dev) + } + + if (rss_rule_fail_cnt) { +- hns3_err(hw, "fail to delete all RSS filters, success num = %d " +- "fail num = %d", rss_rule_succ_cnt, +- rss_rule_fail_cnt); ++ hns3_err(hw, "fail to delete all RSS filters, success num = %d fail num = %d", ++ rss_rule_succ_cnt, rss_rule_fail_cnt); + ret = -EIO; + } + +diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c +index 5a2cfe5a54..3f576fbf4b 100644 +--- a/drivers/net/hns3/hns3_rxtx.c ++++ b/drivers/net/hns3/hns3_rxtx.c +@@ -606,8 +606,8 @@ hns3_send_reset_tqp_cmd(struct hns3_hw *hw, uint16_t queue_id, bool enable) + hns3_set_bit(req->reset_req, HNS3_TQP_RESET_B, enable ? 1 : 0); + ret = hns3_cmd_send(hw, &desc, 1); + if (ret) +- hns3_err(hw, "send tqp reset cmd error, queue_id = %u, " +- "ret = %d", queue_id, ret); ++ hns3_err(hw, "send tqp reset cmd error, queue_id = %u, ret = %d", ++ queue_id, ret); + + return ret; + } +@@ -627,8 +627,8 @@ hns3_get_tqp_reset_status(struct hns3_hw *hw, uint16_t queue_id, + + ret = hns3_cmd_send(hw, &desc, 1); + if (ret) { +- hns3_err(hw, "get tqp reset status error, queue_id = %u, " +- "ret = %d.", queue_id, ret); ++ hns3_err(hw, "get tqp reset status error, queue_id = %u, ret = %d.", ++ queue_id, ret); + return ret; + } + *reset_status = hns3_get_bit(req->ready_to_reset, HNS3_TQP_RESET_B); +@@ -669,7 +669,7 @@ hns3pf_reset_tqp(struct hns3_hw *hw, uint16_t queue_id) + if (!reset_status) { + ret = -ETIMEDOUT; + hns3_err(hw, "reset tqp timeout, queue_id = %u, ret = %d", +- queue_id, ret); ++ queue_id, ret); + goto tqp_reset_fail; + } + +@@ -752,15 +752,14 @@ hns3pf_reset_all_tqps(struct hns3_hw *hw) + for (i = 0; i < hw->cfg_max_queues; i++) { + ret = hns3pf_reset_tqp(hw, i); + if (ret) { +- hns3_err(hw, +- "fail to reset tqp, queue_id = %d, ret = %d.", +- i, ret); ++ hns3_err(hw, "fail to reset tqp, queue_id = %d, ret = %d.", ++ i, ret); + return ret; + } + } + } else if (reset_status != HNS3_RESET_ALL_TQP_SUCCESS) { + hns3_err(hw, "fail to reset all tqps, reset_status = %u.", +- reset_status); ++ reset_status); + return -EIO; + } + +@@ -813,9 +812,8 @@ hns3_reset_all_tqps(struct hns3_adapter *hns) + for (i = 0; i < hw->cfg_max_queues; i++) { + ret = hns3_tqp_enable(hw, i, false); + if (ret) { +- hns3_err(hw, +- "fail to disable tqps before tqps reset, ret = %d.", +- ret); ++ hns3_err(hw, "fail to disable tqps before tqps reset, ret = %d.", ++ ret); + return ret; + } + } +@@ -922,9 +920,9 @@ hns3_reset_queue(struct hns3_hw *hw, uint16_t queue_id, + } + + if (!reset_status) { +- hns3_err(hw, "reset queue timeout, queue_id = %u, " +- "queue_type = %s", queue_id, +- queue_type == HNS3_RING_TYPE_TX ? "Tx" : "Rx"); ++ hns3_err(hw, "reset queue timeout, queue_id = %u, queue_type = %s", ++ queue_id, ++ queue_type == HNS3_RING_TYPE_TX ? "Tx" : "Rx"); + ret = -ETIMEDOUT; + goto queue_reset_fail; + } +diff --git a/drivers/net/hns3/hns3_stats.c b/drivers/net/hns3/hns3_stats.c +index e69761c8b3..bf8af4531f 100644 +--- a/drivers/net/hns3/hns3_stats.c ++++ b/drivers/net/hns3/hns3_stats.c +@@ -507,8 +507,8 @@ hns3_update_port_rx_ssu_drop_stats(struct hns3_hw *hw) + + req = (struct hns3_query_ssu_cmd *)desc[0].data; + cnt = rte_le_to_cpu_32(req->oq_drop_cnt) + +- rte_le_to_cpu_32(req->full_drop_cnt) + +- rte_le_to_cpu_32(req->part_drop_cnt); ++ rte_le_to_cpu_32(req->full_drop_cnt) + ++ rte_le_to_cpu_32(req->part_drop_cnt); + + stats->ssu_rx_drop_cnt += cnt; + +@@ -532,8 +532,8 @@ hns3_update_port_tx_ssu_drop_stats(struct hns3_hw *hw) + + req = (struct hns3_query_ssu_cmd *)desc[0].data; + cnt = rte_le_to_cpu_32(req->oq_drop_cnt) + +- rte_le_to_cpu_32(req->full_drop_cnt) + +- rte_le_to_cpu_32(req->part_drop_cnt); ++ rte_le_to_cpu_32(req->full_drop_cnt) + ++ rte_le_to_cpu_32(req->part_drop_cnt); + + hw->oerror_stats += cnt; + +@@ -1337,8 +1337,8 @@ hns3_dev_xstats_get_by_id(struct rte_eth_dev *dev, const uint64_t *ids, + len = cnt_stats * sizeof(struct rte_eth_xstat); + values_copy = rte_zmalloc("hns3_xstats_values", len, 0); + if (values_copy == NULL) { +- hns3_err(hw, "Failed to allocate 0x%" PRIx64 " bytes needed " +- "to store statistics values", len); ++ hns3_err(hw, "Failed to allocate 0x%" PRIx64 " bytes needed to store statistics values", ++ len); + return -ENOMEM; + } + +@@ -1359,8 +1359,8 @@ hns3_dev_xstats_get_by_id(struct rte_eth_dev *dev, const uint64_t *ids, + + for (i = 0; i < size; i++) { + if (ids[i] >= cnt_stats) { +- hns3_err(hw, "ids[%u] (%" PRIu64 ") is invalid, " +- "should < %u", i, ids[i], cnt_stats); ++ hns3_err(hw, "ids[%u] (%" PRIu64 ") is invalid, should < %u", ++ i, ids[i], cnt_stats); + rte_free(values_copy); + return -EINVAL; + } +@@ -1419,8 +1419,8 @@ hns3_dev_xstats_get_names_by_id(struct rte_eth_dev *dev, + len = cnt_stats * sizeof(struct rte_eth_xstat_name); + names_copy = rte_zmalloc("hns3_xstats_names", len, 0); + if (names_copy == NULL) { +- hns3_err(hw, "Failed to allocate 0x%" PRIx64 " bytes needed " +- "to store statistics names", len); ++ hns3_err(hw, "Failed to allocate 0x%" PRIx64 " bytes needed to store statistics names", ++ len); + return -ENOMEM; + } + +@@ -1428,8 +1428,8 @@ hns3_dev_xstats_get_names_by_id(struct rte_eth_dev *dev, + + for (i = 0; i < size; i++) { + if (ids[i] >= cnt_stats) { +- hns3_err(hw, "ids[%u] (%" PRIu64 ") is invalid, " +- "should < %u", i, ids[i], cnt_stats); ++ hns3_err(hw, "ids[%u] (%" PRIu64 ") is invalid, should < %u", ++ i, ids[i], cnt_stats); + rte_free(names_copy); + return -EINVAL; + } +@@ -1501,14 +1501,14 @@ hns3_tqp_stats_init(struct hns3_hw *hw) + struct hns3_tqp_stats *tqp_stats = &hw->tqp_stats; + + tqp_stats->rcb_rx_ring_pktnum = rte_zmalloc("hns3_rx_ring_pkt_num", +- sizeof(uint64_t) * hw->tqps_num, 0); ++ sizeof(uint64_t) * hw->tqps_num, 0); + if (tqp_stats->rcb_rx_ring_pktnum == NULL) { + hns3_err(hw, "failed to allocate rx_ring pkt_num."); + return -ENOMEM; + } + + tqp_stats->rcb_tx_ring_pktnum = rte_zmalloc("hns3_tx_ring_pkt_num", +- sizeof(uint64_t) * hw->tqps_num, 0); ++ sizeof(uint64_t) * hw->tqps_num, 0); + if (tqp_stats->rcb_tx_ring_pktnum == NULL) { + hns3_err(hw, "failed to allocate tx_ring pkt_num."); + rte_free(tqp_stats->rcb_rx_ring_pktnum); +-- +2.22.0 + diff --git a/0118-net-hns3-fix-a-segfault-from-secondary-process.patch b/0118-net-hns3-fix-a-segfault-from-secondary-process.patch new file mode 100644 index 0000000000000000000000000000000000000000..89bcf9de400a5065fe29d0eda9fc9f753b0661e6 --- /dev/null +++ b/0118-net-hns3-fix-a-segfault-from-secondary-process.patch @@ -0,0 +1,39 @@ +From 0526fc076a0e45de04597722128d4a2b87a44255 Mon Sep 17 00:00:00 2001 +From: Huisong Li +Date: Wed, 1 Jun 2022 11:52:50 +0800 +Subject: [PATCH 118/122] net/hns3: fix a segfault from secondary process + +If a hns3 device in the secondary process is attached to do probing +operation, 'rx_queues' and 'tx_queues' in dev->data are null in +eth_dev_fp_ops_setup when calling rte_eth_dev_probing_finish. The primary +process calls dev_start to re-setup their fp_ops. But the secondary process +can't call dev_start and has no chance to do it. If the application sends +and receives packets at this time, a segfault will occur. So this patch +uses the MP communication of the PMD to update the fp_ops of the device in +the secondary process. + +Fixes: 96c33cfb06cf ("net/hns3: fix Rx/Tx functions update") +Cc: stable@dpdk.org + +Signed-off-by: Huisong Li +Signed-off-by: Min Hu (Connor) +--- + drivers/net/hns3/hns3_rxtx.c | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c +index 3f576fbf4b..0dc1d8cb60 100644 +--- a/drivers/net/hns3/hns3_rxtx.c ++++ b/drivers/net/hns3/hns3_rxtx.c +@@ -4420,6 +4420,8 @@ hns3_eth_dev_fp_ops_config(const struct rte_eth_dev *dev) + fpo[port_id].tx_pkt_prepare = dev->tx_pkt_prepare; + fpo[port_id].rx_descriptor_status = dev->rx_descriptor_status; + fpo[port_id].tx_descriptor_status = dev->tx_descriptor_status; ++ fpo[port_id].rxq.data = dev->data->rx_queues; ++ fpo[port_id].txq.data = dev->data->tx_queues; + } + + void +-- +2.22.0 + diff --git a/0118-net-hns3-remove-unused-macros.patch b/0118-net-hns3-remove-unused-macros.patch deleted file mode 100644 index b0c564597733ac9c800fbafe951c18a78377c6d0..0000000000000000000000000000000000000000 --- a/0118-net-hns3-remove-unused-macros.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 9db649c5eb45a4739fc76e5613b8d5c5cd9f9275 Mon Sep 17 00:00:00 2001 -From: "Min Hu (Connor)" -Date: Mon, 19 Apr 2021 16:13:31 +0800 -Subject: [PATCH 118/189] net/hns3: remove unused macros - -'HNS3_RXD_TSIND_S' and 'HNS3_RXD_TSIND_M' is unused, which should -be deleted. - -This patch fixed it. - -Fixes: bba636698316 ("net/hns3: support Rx/Tx and related operations") -Cc: stable@dpdk.org - -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_rxtx.h | 2 -- - 1 file changed, 2 deletions(-) - -diff --git a/drivers/net/hns3/hns3_rxtx.h b/drivers/net/hns3/hns3_rxtx.h -index 5067c92..d25edc4 100644 ---- a/drivers/net/hns3/hns3_rxtx.h -+++ b/drivers/net/hns3/hns3_rxtx.h -@@ -104,8 +104,6 @@ - #define HNS3_RXD_LUM_B 9 - #define HNS3_RXD_CRCP_B 10 - #define HNS3_RXD_L3L4P_B 11 --#define HNS3_RXD_TSIND_S 12 --#define HNS3_RXD_TSIND_M (0x7 << HNS3_RXD_TSIND_S) - - #define HNS3_RXD_TS_VLD_B 14 - #define HNS3_RXD_LKBK_B 15 --- -2.7.4 - diff --git a/0119-net-hns3-fix-TM-capability-incorrectly-defined.patch b/0119-net-hns3-fix-TM-capability-incorrectly-defined.patch new file mode 100644 index 0000000000000000000000000000000000000000..6796c87ca85ac5934d67ab4d43cc63a2006bd425 --- /dev/null +++ b/0119-net-hns3-fix-TM-capability-incorrectly-defined.patch @@ -0,0 +1,33 @@ +From 40df3e3ffa8c645ce7e5c0ff6e698c5bd7cf1ff8 Mon Sep 17 00:00:00 2001 +From: Chengwen Feng +Date: Wed, 1 Jun 2022 11:52:51 +0800 +Subject: [PATCH 119/122] net/hns3: fix TM capability incorrectly defined + +The TM capability should be bit-19 according to the user manual of +firmware. + +Fixes: fc18d1b4b85f ("net/hns3: fix traffic management") +Cc: stable@dpdk.org + +Signed-off-by: Chengwen Feng +Signed-off-by: Min Hu (Connor) +--- + drivers/net/hns3/hns3_cmd.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/net/hns3/hns3_cmd.h b/drivers/net/hns3/hns3_cmd.h +index f9addc6069..82c999061d 100644 +--- a/drivers/net/hns3/hns3_cmd.h ++++ b/drivers/net/hns3/hns3_cmd.h +@@ -323,7 +323,7 @@ enum HNS3_CAPS_BITS { + HNS3_CAPS_UDP_TUNNEL_CSUM_B, + HNS3_CAPS_RAS_IMP_B, + HNS3_CAPS_RXD_ADV_LAYOUT_B = 15, +- HNS3_CAPS_TM_B = 17, ++ HNS3_CAPS_TM_B = 19, + }; + + /* Capabilities of VF dependent on the PF */ +-- +2.22.0 + diff --git a/0119-net-hns3-support-RAS-process-in-Kunpeng-930.patch b/0119-net-hns3-support-RAS-process-in-Kunpeng-930.patch deleted file mode 100644 index fdeb45ffae6466de34882b43b1e3c7bd41d7e58b..0000000000000000000000000000000000000000 --- a/0119-net-hns3-support-RAS-process-in-Kunpeng-930.patch +++ /dev/null @@ -1,603 +0,0 @@ -From 9a12486ffd05e3940cd533ac5ba03ba641c864f2 Mon Sep 17 00:00:00 2001 -From: Hongbo Zheng -Date: Mon, 19 Apr 2021 15:36:44 +0800 -Subject: [PATCH 119/189] net/hns3: support RAS process in Kunpeng 930 - -Kunpeng 930 uses a new RAS exception reporting solution. -The reset type and exception status are reported through -firmware. The driver modifies the corresponding code to -adapt to the new solution. - -Signed-off-by: Hongbo Zheng -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_cmd.c | 9 +- - drivers/net/hns3/hns3_cmd.h | 2 + - drivers/net/hns3/hns3_ethdev.c | 11 +- - drivers/net/hns3/hns3_ethdev.h | 23 ++- - drivers/net/hns3/hns3_ethdev_vf.c | 3 +- - drivers/net/hns3/hns3_intr.c | 296 +++++++++++++++++++++++++++++++++++++- - drivers/net/hns3/hns3_intr.h | 70 +++++++++ - 7 files changed, 399 insertions(+), 15 deletions(-) - -diff --git a/drivers/net/hns3/hns3_cmd.c b/drivers/net/hns3/hns3_cmd.c -index 15bf781..f3588ab 100644 ---- a/drivers/net/hns3/hns3_cmd.c -+++ b/drivers/net/hns3/hns3_cmd.c -@@ -237,7 +237,12 @@ hns3_is_special_opcode(uint16_t opcode) - HNS3_OPC_STATS_MAC, - HNS3_OPC_STATS_MAC_ALL, - HNS3_OPC_QUERY_32_BIT_REG, -- HNS3_OPC_QUERY_64_BIT_REG}; -+ HNS3_OPC_QUERY_64_BIT_REG, -+ HNS3_OPC_QUERY_CLEAR_MPF_RAS_INT, -+ HNS3_OPC_QUERY_CLEAR_PF_RAS_INT, -+ HNS3_OPC_QUERY_CLEAR_ALL_MPF_MSIX_INT, -+ HNS3_OPC_QUERY_CLEAR_ALL_PF_MSIX_INT, -+ HNS3_OPC_QUERY_ALL_ERR_INFO,}; - uint32_t i; - - for (i = 0; i < ARRAY_SIZE(spec_opcode); i++) -@@ -449,6 +454,8 @@ hns3_parse_capability(struct hns3_hw *hw, - if (hns3_get_bit(caps, HNS3_CAPS_UDP_TUNNEL_CSUM_B)) - hns3_set_bit(hw->capability, - HNS3_DEV_SUPPORT_OUTER_UDP_CKSUM_B, 1); -+ if (hns3_get_bit(caps, HNS3_CAPS_RAS_IMP_B)) -+ hns3_set_bit(hw->capability, HNS3_DEV_SUPPORT_RAS_IMP_B, 1); - } - - static uint32_t -diff --git a/drivers/net/hns3/hns3_cmd.h b/drivers/net/hns3/hns3_cmd.h -index a24063b..70aed7b 100644 ---- a/drivers/net/hns3/hns3_cmd.h -+++ b/drivers/net/hns3/hns3_cmd.h -@@ -252,6 +252,8 @@ enum hns3_opcode_type { - HNS3_OPC_QUERY_MSIX_INT_STS_BD_NUM = 0x1513, - HNS3_OPC_QUERY_CLEAR_ALL_MPF_MSIX_INT = 0x1514, - HNS3_OPC_QUERY_CLEAR_ALL_PF_MSIX_INT = 0x1515, -+ HNS3_OPC_QUERY_ALL_ERR_BD_NUM = 0x1516, -+ HNS3_OPC_QUERY_ALL_ERR_INFO = 0x1517, - HNS3_OPC_IGU_EGU_TNL_INT_EN = 0x1803, - HNS3_OPC_IGU_COMMON_INT_EN = 0x1806, - HNS3_OPC_TM_QCN_MEM_INT_CFG = 0x1A14, -diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c -index 1d09b5b..893b357 100644 ---- a/drivers/net/hns3/hns3_ethdev.c -+++ b/drivers/net/hns3/hns3_ethdev.c -@@ -324,10 +324,8 @@ hns3_interrupt_handler(void *param) - hns3_warn(hw, "received interrupt: vector0_int_stat:0x%x " - "ras_int_stat:0x%x cmdq_int_stat:0x%x", - vector0_int, ras_int, cmdq_int); -- hns3_handle_msix_error(hns, &hw->reset.request); -- hns3_handle_ras_error(hns, &hw->reset.request); - hns3_handle_mac_tnl(hw); -- hns3_schedule_reset(hns); -+ hns3_handle_error(hns); - } else if (event_cause == HNS3_VECTOR0_EVENT_RST) { - hns3_warn(hw, "received reset interrupt"); - hns3_schedule_reset(hns); -@@ -6284,12 +6282,15 @@ hns3_is_reset_pending(struct hns3_adapter *hns) - - hns3_check_event_cause(hns, NULL); - reset = hns3_get_reset_level(hns, &hw->reset.pending); -- if (hw->reset.level != HNS3_NONE_RESET && hw->reset.level < reset) { -+ -+ if (reset != HNS3_NONE_RESET && hw->reset.level != HNS3_NONE_RESET && -+ hw->reset.level < reset) { - hns3_warn(hw, "High level reset %d is pending", reset); - return true; - } - reset = hns3_get_reset_level(hns, &hw->reset.request); -- if (hw->reset.level != HNS3_NONE_RESET && hw->reset.level < reset) { -+ if (reset != HNS3_NONE_RESET && hw->reset.level != HNS3_NONE_RESET && -+ hw->reset.level < reset) { - hns3_warn(hw, "High level reset %d is request", reset); - return true; - } -diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h -index 8b6c0d2..4a855de 100644 ---- a/drivers/net/hns3/hns3_ethdev.h -+++ b/drivers/net/hns3/hns3_ethdev.h -@@ -306,8 +306,9 @@ enum hns3_reset_stage { - }; - - enum hns3_reset_level { -- HNS3_NONE_RESET, -+ HNS3_FLR_RESET, /* A VF perform FLR reset */ - HNS3_VF_FUNC_RESET, /* A VF function reset */ -+ - /* - * All VFs under a PF perform function reset. - * Kernel PF driver use mailbox to inform DPDK VF to do reset, the value -@@ -315,6 +316,7 @@ enum hns3_reset_level { - * same. - */ - HNS3_VF_PF_FUNC_RESET = 2, -+ - /* - * All VFs under a PF perform FLR reset. - * Kernel PF driver use mailbox to inform DPDK VF to do reset, the value -@@ -328,14 +330,23 @@ enum hns3_reset_level { - * In PF FLR, the register state of VF is not reliable, VF's driver - * should not access the registers of the VF device. - */ -- HNS3_VF_FULL_RESET = 3, -- HNS3_FLR_RESET, /* A VF perform FLR reset */ -+ HNS3_VF_FULL_RESET, -+ - /* All VFs under the rootport perform a global or IMP reset */ - HNS3_VF_RESET, -- HNS3_FUNC_RESET, /* A PF function reset */ -+ -+ /* -+ * The enumeration value of HNS3_FUNC_RESET/HNS3_GLOBAL_RESET/ -+ * HNS3_IMP_RESET/HNS3_NONE_RESET are also used by firmware, and -+ * can not be changed. -+ */ -+ -+ HNS3_FUNC_RESET = 5, /* A PF function reset */ -+ - /* All PFs under the rootport perform a global reset */ - HNS3_GLOBAL_RESET, - HNS3_IMP_RESET, /* All PFs under the rootport perform a IMP reset */ -+ HNS3_NONE_RESET, - HNS3_MAX_RESET - }; - -@@ -846,6 +857,7 @@ enum { - #define HNS3_DEV_SUPPORT_STASH_B 0x7 - #define HNS3_DEV_SUPPORT_RXD_ADV_LAYOUT_B 0x9 - #define HNS3_DEV_SUPPORT_OUTER_UDP_CKSUM_B 0xA -+#define HNS3_DEV_SUPPORT_RAS_IMP_B 0xB - - #define hns3_dev_dcb_supported(hw) \ - hns3_get_bit((hw)->capability, HNS3_DEV_SUPPORT_DCB_B) -@@ -882,6 +894,9 @@ enum { - #define hns3_dev_outer_udp_cksum_supported(hw) \ - hns3_get_bit((hw)->capability, HNS3_DEV_SUPPORT_OUTER_UDP_CKSUM_B) - -+#define hns3_dev_ras_imp_supported(hw) \ -+ hns3_get_bit((hw)->capability, HNS3_DEV_SUPPORT_RAS_IMP_B) -+ - #define HNS3_DEV_PRIVATE_TO_HW(adapter) \ - (&((struct hns3_adapter *)adapter)->hw) - #define HNS3_DEV_PRIVATE_TO_PF(adapter) \ -diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c -index dd8f248..efc614b 100644 ---- a/drivers/net/hns3/hns3_ethdev_vf.c -+++ b/drivers/net/hns3/hns3_ethdev_vf.c -@@ -2465,7 +2465,8 @@ hns3vf_is_reset_pending(struct hns3_adapter *hns) - /* Check the registers to confirm whether there is reset pending */ - hns3vf_check_event_cause(hns, NULL); - reset = hns3vf_get_reset_level(hw, &hw->reset.pending); -- if (hw->reset.level != HNS3_NONE_RESET && hw->reset.level < reset) { -+ if (hw->reset.level != HNS3_NONE_RESET && reset != HNS3_NONE_RESET && -+ hw->reset.level < reset) { - hns3_warn(hw, "High level reset %d is pending", reset); - return true; - } -diff --git a/drivers/net/hns3/hns3_intr.c b/drivers/net/hns3/hns3_intr.c -index ccc90c5..7385c7b 100644 ---- a/drivers/net/hns3/hns3_intr.c -+++ b/drivers/net/hns3/hns3_intr.c -@@ -23,8 +23,8 @@ - } while (0) - - static const char *reset_string[HNS3_MAX_RESET] = { -- "none", "vf_func", "vf_pf_func", "vf_full", "flr", -- "vf_global", "pf_func", "global", "IMP", -+ "flr", "vf_func", "vf_pf_func", "vf_full", "vf_global", -+ "pf_func", "global", "IMP", "none", - }; - - static const struct hns3_hw_error mac_afifo_tnl_int[] = { -@@ -1384,13 +1384,108 @@ static const struct hns3_hw_error_desc pf_msix_err_tbl[] = { - } - }; - --enum hns3_hw_err_type { -+enum hns3_hw_err_report_type { - MPF_MSIX_ERR, - PF_MSIX_ERR, - MPF_RAS_ERR, - PF_RAS_ERR, - }; - -+static const struct hns3_hw_mod_name hns3_hw_module_name[] = { -+ { -+ .module_name = MODULE_NONE, -+ .msg = "MODULE_NONE" -+ }, { -+ .module_name = MODULE_BIOS_COMMON, -+ .msg = "MODULE_BIOS_COMMON" -+ }, { -+ .module_name = MODULE_GE, -+ .msg = "MODULE_GE" -+ }, { -+ .module_name = MODULE_IGU_EGU, -+ .msg = "MODULE_IGU_EGU" -+ }, { -+ .module_name = MODULE_LGE, -+ .msg = "MODULE_LGE" -+ }, { -+ .module_name = MODULE_NCSI, -+ .msg = "MODULE_NCSI" -+ }, { -+ .module_name = MODULE_PPP, -+ .msg = "MODULE_PPP" -+ }, { -+ .module_name = MODULE_QCN, -+ .msg = "MODULE_QCN" -+ }, { -+ .module_name = MODULE_RCB_RX, -+ .msg = "MODULE_RCB_RX" -+ }, { -+ .module_name = MODULE_RTC, -+ .msg = "MODULE_RTC" -+ }, { -+ .module_name = MODULE_SSU, -+ .msg = "MODULE_SSU" -+ }, { -+ .module_name = MODULE_TM, -+ .msg = "MODULE_TM" -+ }, { -+ .module_name = MODULE_RCB_TX, -+ .msg = "MODULE_RCB_TX" -+ }, { -+ .module_name = MODULE_TXDMA, -+ .msg = "MODULE_TXDMA" -+ }, { -+ .module_name = MODULE_MASTER, -+ .msg = "MODULE_MASTER" -+ }, { -+ .module_name = MODULE_ROH_MAC, -+ .msg = "MODULE_ROH_MAC" -+ } -+}; -+ -+static const struct hns3_hw_err_type hns3_hw_error_type[] = { -+ { -+ .error_type = NONE_ERROR, -+ .msg = "none_error" -+ }, { -+ .error_type = FIFO_ERROR, -+ .msg = "fifo_error" -+ }, { -+ .error_type = MEMORY_ERROR, -+ .msg = "memory_error" -+ }, { -+ .error_type = POISION_ERROR, -+ .msg = "poision_error" -+ }, { -+ .error_type = MSIX_ECC_ERROR, -+ .msg = "msix_ecc_error" -+ }, { -+ .error_type = TQP_INT_ECC_ERROR, -+ .msg = "tqp_int_ecc_error" -+ }, { -+ .error_type = PF_ABNORMAL_INT_ERROR, -+ .msg = "pf_abnormal_int_error" -+ }, { -+ .error_type = MPF_ABNORMAL_INT_ERROR, -+ .msg = "mpf_abnormal_int_error" -+ }, { -+ .error_type = COMMON_ERROR, -+ .msg = "common_error" -+ }, { -+ .error_type = PORT_ERROR, -+ .msg = "port_error" -+ }, { -+ .error_type = ETS_ERROR, -+ .msg = "ets_error" -+ }, { -+ .error_type = NCSI_ERROR, -+ .msg = "ncsi_error" -+ }, { -+ .error_type = GLB_ERROR, -+ .msg = "glb_error" -+ } -+}; -+ - static int - hns3_config_ncsi_hw_err_int(struct hns3_adapter *hns, bool en) - { -@@ -1927,7 +2022,8 @@ hns3_get_hw_error_status(struct hns3_cmd_desc *desc, uint8_t desc_offset, - - static int - hns3_handle_hw_error(struct hns3_adapter *hns, struct hns3_cmd_desc *desc, -- int num, uint64_t *levels, enum hns3_hw_err_type err_type) -+ int num, uint64_t *levels, -+ enum hns3_hw_err_report_type err_type) - { - const struct hns3_hw_error_desc *err = pf_ras_err_tbl; - enum hns3_opcode_type opcode; -@@ -2094,6 +2190,198 @@ hns3_handle_ras_error(struct hns3_adapter *hns, uint64_t *levels) - rte_free(desc); - } - -+static void -+hns3_handle_type_reg_error_data(struct hns3_hw *hw, -+ struct hns3_mod_err_info *mod_err_info, -+ struct hns3_type_reg_err_info *err_info) -+{ -+#define HNS3_ERR_TYPE_MASK 0x7F -+#define HNS3_ERR_TYPE_IS_RAS_OFFSET 7 -+ -+ uint8_t mod_id, total_module, type_id, total_type; -+ uint8_t is_ras; -+ uint8_t i; -+ -+ mod_id = mod_err_info->mod_id; -+ type_id = err_info->type_id & HNS3_ERR_TYPE_MASK; -+ is_ras = err_info->type_id >> HNS3_ERR_TYPE_IS_RAS_OFFSET; -+ -+ total_module = ARRAY_SIZE(hns3_hw_module_name); -+ total_type = ARRAY_SIZE(hns3_hw_error_type); -+ -+ hns3_err(hw, "total_module:%u, total_type:%u", -+ total_module, total_type); -+ -+ if (mod_id < total_module && type_id < total_type) -+ hns3_err(hw, "found %s %s, is %s error.", -+ hns3_hw_module_name[mod_id].msg, -+ hns3_hw_error_type[type_id].msg, -+ is_ras ? "ras" : "msix"); -+ else -+ hns3_err(hw, "unknown module[%u] or type[%u].", -+ mod_id, type_id); -+ -+ hns3_err(hw, "reg_value:"); -+ for (i = 0; i < err_info->reg_num; i++) -+ hns3_err(hw, "0x%08x", err_info->reg[i]); -+} -+ -+static void -+hns3_handle_module_error_data(struct hns3_hw *hw, uint32_t *buf, -+ uint32_t buf_size) -+{ -+ struct hns3_type_reg_err_info *type_reg_err_info; -+ struct hns3_mod_err_info *mod_err_info; -+ struct hns3_sum_err_info *sum_err_info; -+ uint8_t mod_num, reset_type; -+ uint32_t offset = 0; -+ uint8_t err_num; -+ uint8_t i; -+ -+ sum_err_info = (struct hns3_sum_err_info *)&buf[offset++]; -+ mod_num = sum_err_info->mod_num; -+ reset_type = sum_err_info->reset_type; -+ if (reset_type && reset_type != HNS3_NONE_RESET) -+ hns3_atomic_set_bit(reset_type, &hw->reset.request); -+ -+ hns3_err(hw, "reset_type = %s, mod_num = %u.", -+ reset_string[reset_type], mod_num); -+ -+ while (mod_num--) { -+ if (offset >= buf_size) { -+ hns3_err(hw, "offset(%u) exceeds buf's size(%u).", -+ offset, buf_size); -+ return; -+ } -+ mod_err_info = (struct hns3_mod_err_info *)&buf[offset++]; -+ err_num = mod_err_info->err_num; -+ for (i = 0; i < err_num; i++) { -+ if (offset >= buf_size) { -+ hns3_err(hw, -+ "offset(%u) exceeds buf size(%u).", -+ offset, buf_size); -+ return; -+ } -+ -+ type_reg_err_info = (struct hns3_type_reg_err_info *) -+ &buf[offset++]; -+ hns3_handle_type_reg_error_data(hw, mod_err_info, -+ type_reg_err_info); -+ -+ offset += type_reg_err_info->reg_num; -+ } -+ } -+} -+ -+static int -+hns3_query_all_err_bd_num(struct hns3_hw *hw, uint32_t *bd_num) -+{ -+ struct hns3_cmd_desc desc; -+ uint32_t bd_num_data; -+ int ret; -+ -+ hns3_cmd_setup_basic_desc(&desc, HNS3_OPC_QUERY_ALL_ERR_BD_NUM, true); -+ ret = hns3_cmd_send(hw, &desc, 1); -+ if (ret) { -+ hns3_err(hw, "failed to query error bd_num, ret = %d.", ret); -+ return ret; -+ } -+ -+ bd_num_data = rte_le_to_cpu_32(desc.data[0]); -+ *bd_num = bd_num_data; -+ if (bd_num_data == 0) { -+ hns3_err(hw, "the value of bd_num is 0!"); -+ return -EINVAL; -+ } -+ -+ return 0; -+} -+ -+static int -+hns3_query_all_err_info(struct hns3_hw *hw, struct hns3_cmd_desc *desc, -+ uint32_t bd_num) -+{ -+ int ret; -+ -+ hns3_cmd_setup_basic_desc(desc, HNS3_OPC_QUERY_ALL_ERR_INFO, true); -+ ret = hns3_cmd_send(hw, desc, bd_num); -+ if (ret) { -+ hns3_err(hw, "failed to query error info, ret = %d.", ret); -+ return ret; -+ } -+ -+ return ret; -+} -+ -+static void -+hns3_handle_hw_error_v2(struct hns3_hw *hw) -+{ -+ uint32_t bd_num, buf_len, i, buf_size; -+ struct hns3_cmd_desc *desc; -+ uint32_t *desc_data; -+ uint32_t *buf; -+ int ret; -+ -+ ret = hns3_query_all_err_bd_num(hw, &bd_num); -+ if (ret) -+ goto out; -+ -+ desc = rte_zmalloc("hns3_ras", bd_num * sizeof(struct hns3_cmd_desc), -+ 0); -+ if (desc == NULL) { -+ hns3_err(hw, "failed to malloc hns3 ras cmd desc."); -+ goto out; -+ } -+ -+ ret = hns3_query_all_err_info(hw, desc, bd_num); -+ if (ret) -+ goto err_desc; -+ -+ buf_len = bd_num * sizeof(struct hns3_cmd_desc) - HNS3_DESC_NO_DATA_LEN; -+ buf_size = buf_len / HNS3_DESC_DATA_UNIT_SIZE; -+ -+ desc_data = rte_zmalloc("hns3_ras", buf_len, 0); -+ if (desc_data == NULL) { -+ hns3_err(hw, "failed to malloc hns3 ras desc data."); -+ goto err_desc; -+ } -+ -+ buf = rte_zmalloc("hns3_ras", buf_len, 0); -+ if (buf == NULL) { -+ hns3_err(hw, "failed to malloc hns3 ras buf data."); -+ goto err_buf_alloc; -+ } -+ -+ memcpy(desc_data, &desc[0].data[0], buf_len); -+ for (i = 0; i < buf_size; i++) -+ buf[i] = rte_le_to_cpu_32(desc_data[i]); -+ -+ hns3_handle_module_error_data(hw, buf, buf_size); -+ rte_free(buf); -+ -+err_buf_alloc: -+ rte_free(desc_data); -+err_desc: -+ rte_free(desc); -+out: -+ return; -+} -+ -+void -+hns3_handle_error(struct hns3_adapter *hns) -+{ -+ struct hns3_hw *hw = &hns->hw; -+ -+ if (hns3_dev_ras_imp_supported(hw)) { -+ hns3_handle_hw_error_v2(hw); -+ hns3_schedule_reset(hns); -+ } else { -+ hns3_handle_msix_error(hns, &hw->reset.request); -+ hns3_handle_ras_error(hns, &hw->reset.request); -+ hns3_schedule_reset(hns); -+ } -+} -+ - int - hns3_reset_init(struct hns3_hw *hw) - { -diff --git a/drivers/net/hns3/hns3_intr.h b/drivers/net/hns3/hns3_intr.h -index 4a0a731..a140ca1 100644 ---- a/drivers/net/hns3/hns3_intr.h -+++ b/drivers/net/hns3/hns3_intr.h -@@ -81,6 +81,75 @@ - - #define HNS3_RESET_PROCESS_MS 200 - -+#define HNS3_DESC_DATA_MAX 8 -+#define HNS3_REG_NUM_MAX 256 -+#define HNS3_DESC_NO_DATA_LEN 8 -+#define HNS3_DESC_DATA_UNIT_SIZE 4 -+ -+enum hns3_mod_name_list { -+ MODULE_NONE, -+ MODULE_BIOS_COMMON, -+ MODULE_GE, -+ MODULE_IGU_EGU, -+ MODULE_LGE, -+ MODULE_NCSI, -+ MODULE_PPP, -+ MODULE_QCN, -+ MODULE_RCB_RX, -+ MODULE_RTC, -+ MODULE_SSU, -+ MODULE_TM, -+ MODULE_RCB_TX, -+ MODULE_TXDMA, -+ MODULE_MASTER, -+ MODULE_ROH_MAC, -+}; -+ -+enum hns3_err_type_list { -+ NONE_ERROR, -+ FIFO_ERROR, -+ MEMORY_ERROR, -+ POISION_ERROR, -+ MSIX_ECC_ERROR, -+ TQP_INT_ECC_ERROR, -+ PF_ABNORMAL_INT_ERROR, -+ MPF_ABNORMAL_INT_ERROR, -+ COMMON_ERROR, -+ PORT_ERROR, -+ ETS_ERROR, -+ NCSI_ERROR, -+ GLB_ERROR, -+}; -+ -+struct hns3_hw_mod_name { -+ enum hns3_mod_name_list module_name; -+ const char *msg; -+}; -+ -+struct hns3_hw_err_type { -+ enum hns3_err_type_list error_type; -+ const char *msg; -+}; -+ -+struct hns3_sum_err_info { -+ uint8_t reset_type; /* the total reset type */ -+ uint8_t mod_num; /* the modules num encounter error */ -+ uint8_t rsv[2]; -+}; -+ -+struct hns3_mod_err_info { -+ uint8_t mod_id; /* the error module id */ -+ uint8_t err_num; /* the errors num in module */ -+ uint8_t rsv[2]; -+}; -+ -+struct hns3_type_reg_err_info { -+ uint8_t type_id; /* the type id of error */ -+ uint8_t reg_num; /* the related registers num of this error */ -+ uint8_t rsv[2]; -+ uint32_t reg[HNS3_REG_NUM_MAX]; /* the registers value */ -+}; -+ - struct hns3_hw_blk { - const char *name; - int (*enable_err_intr)(struct hns3_adapter *hns, bool en); -@@ -103,6 +172,7 @@ int hns3_enable_hw_error_intr(struct hns3_adapter *hns, bool state); - void hns3_handle_msix_error(struct hns3_adapter *hns, uint64_t *levels); - void hns3_handle_ras_error(struct hns3_adapter *hns, uint64_t *levels); - void hns3_config_mac_tnl_int(struct hns3_hw *hw, bool en); -+void hns3_handle_error(struct hns3_adapter *hns); - - void hns3_intr_unregister(const struct rte_intr_handle *hdl, - rte_intr_callback_fn cb_fn, void *cb_arg); --- -2.7.4 - diff --git a/0120-app-testpmd-add-help-messages-for-multi-process.patch b/0120-app-testpmd-add-help-messages-for-multi-process.patch new file mode 100644 index 0000000000000000000000000000000000000000..6c87ec4ebb4e7269c5d109733dc09cb075c20594 --- /dev/null +++ b/0120-app-testpmd-add-help-messages-for-multi-process.patch @@ -0,0 +1,38 @@ +From 519b373d853909d953ff0c0fc6b15199be516fdd Mon Sep 17 00:00:00 2001 +From: Huisong Li +Date: Thu, 9 Jun 2022 16:52:34 +0800 +Subject: [PATCH 120/122] app/testpmd: add help messages for multi-process + +This patch adds help messages for multi-process. +--num-procs=N: set the total number of multi-process instances. +--proc-id=id: set the id of the current process from multi-process +instances(0 <= id < num-procs). + +Fixes: a550baf24af9 ("app/testpmd: support multi-process") +Cc: stable@dpdk.org + +Signed-off-by: Huisong Li +Signed-off-by: Min Hu (Connor) +Signed-off-by: Dongdong Liu +Acked-by: Ferruh Yigit +--- + app/test-pmd/parameters.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c +index f9185065af..24e03e769c 100644 +--- a/app/test-pmd/parameters.c ++++ b/app/test-pmd/parameters.c +@@ -61,6 +61,9 @@ usage(char* progname) + "extended statistics to show. Used with --stats-period " + "specified or interactive commands that show Rx/Tx statistics " + "(i.e. 'show port stats').\n"); ++ printf(" --num-procs=N: set the total number of multi-process instances.\n"); ++ printf(" --proc-id=id: set the id of the current process from " ++ "multi-process instances (0 <= id < num-procs).\n"); + printf(" --nb-cores=N: set the number of forwarding cores " + "(1 <= N <= %d).\n", nb_lcores); + printf(" --nb-ports=N: set the number of forwarding ports " +-- +2.22.0 + diff --git a/0120-net-hns3-support-masking-device-capability.patch b/0120-net-hns3-support-masking-device-capability.patch deleted file mode 100644 index 34899b4e4b663362a27eb847d470ac9027d0abac..0000000000000000000000000000000000000000 --- a/0120-net-hns3-support-masking-device-capability.patch +++ /dev/null @@ -1,226 +0,0 @@ -From e0e251dbada5ce120c8f7a6d1b517865fcbc29ce Mon Sep 17 00:00:00 2001 -From: Chengwen Feng -Date: Thu, 15 Apr 2021 11:52:00 +0800 -Subject: [PATCH 120/189] net/hns3: support masking device capability - -This patch supports runtime config of mask device capability, it was -used to mask the capability which queried from firmware. - -The device argument key is "dev_caps_mask" which takes hexadecimal -bitmask where each bit represents whether mask corresponding capability. - -Its main purpose is to debug and avoid problems. - -Signed-off-by: Chengwen Feng -Signed-off-by: Min Hu (Connor) ---- - doc/guides/nics/hns3.rst | 9 ++++++ - drivers/net/hns3/hns3_cmd.c | 67 +++++++++++++++++++++++++++++++++++++++ - drivers/net/hns3/hns3_ethdev.c | 24 +++++++++++++- - drivers/net/hns3/hns3_ethdev.h | 4 +++ - drivers/net/hns3/hns3_ethdev_vf.c | 3 +- - 5 files changed, 105 insertions(+), 2 deletions(-) - -diff --git a/doc/guides/nics/hns3.rst b/doc/guides/nics/hns3.rst -index d722509..477f03c 100644 ---- a/doc/guides/nics/hns3.rst -+++ b/doc/guides/nics/hns3.rst -@@ -84,6 +84,15 @@ Runtime Config Options - be first checked, if meets, use the ``vec``. Then, ``simple``, at last - ``common``. - -+- ``dev_caps_mask`` (default ``0``) -+ -+ Used to mask the capability which queried from firmware. -+ This args take hexadecimal bitmask where each bit represents whether mask -+ corresponding capability. eg. If the capability is 0xFFFF queried from -+ firmware, and the args value is 0xF which means the bit0~bit3 should be -+ masked off, then the capability will be 0xFFF0. -+ Its main purpose is to debug and avoid problems. -+ - Driver compilation and testing - ------------------------------ - -diff --git a/drivers/net/hns3/hns3_cmd.c b/drivers/net/hns3/hns3_cmd.c -index f3588ab..5eb8789 100644 ---- a/drivers/net/hns3/hns3_cmd.c -+++ b/drivers/net/hns3/hns3_cmd.c -@@ -416,6 +416,68 @@ hns3_cmd_send(struct hns3_hw *hw, struct hns3_cmd_desc *desc, int num) - return retval; - } - -+static const char * -+hns3_get_caps_name(uint32_t caps_id) -+{ -+ const struct { -+ enum HNS3_CAPS_BITS caps; -+ const char *name; -+ } dev_caps[] = { -+ { HNS3_CAPS_UDP_GSO_B, "udp_gso" }, -+ { HNS3_CAPS_ATR_B, "atr" }, -+ { HNS3_CAPS_FD_QUEUE_REGION_B, "fd_queue_region" }, -+ { HNS3_CAPS_PTP_B, "ptp" }, -+ { HNS3_CAPS_INT_QL_B, "int_ql" }, -+ { HNS3_CAPS_SIMPLE_BD_B, "simple_bd" }, -+ { HNS3_CAPS_TX_PUSH_B, "tx_push" }, -+ { HNS3_CAPS_PHY_IMP_B, "phy_imp" }, -+ { HNS3_CAPS_TQP_TXRX_INDEP_B, "tqp_txrx_indep" }, -+ { HNS3_CAPS_HW_PAD_B, "hw_pad" }, -+ { HNS3_CAPS_STASH_B, "stash" }, -+ { HNS3_CAPS_UDP_TUNNEL_CSUM_B, "udp_tunnel_csum" }, -+ { HNS3_CAPS_RAS_IMP_B, "ras_imp" }, -+ { HNS3_CAPS_FEC_B, "fec" }, -+ { HNS3_CAPS_PAUSE_B, "pause" }, -+ { HNS3_CAPS_RXD_ADV_LAYOUT_B, "rxd_adv_layout" } -+ }; -+ uint32_t i; -+ -+ for (i = 0; i < RTE_DIM(dev_caps); i++) { -+ if (dev_caps[i].caps == caps_id) -+ return dev_caps[i].name; -+ } -+ -+ return "unknown"; -+} -+ -+static void -+hns3_mask_capability(struct hns3_hw *hw, -+ struct hns3_query_version_cmd *cmd) -+{ -+#define MAX_CAPS_BIT 64 -+ -+ struct hns3_adapter *hns = HNS3_DEV_HW_TO_ADAPTER(hw); -+ uint64_t caps_org, caps_new, caps_masked; -+ uint32_t i; -+ -+ if (hns->dev_caps_mask == 0) -+ return; -+ -+ memcpy(&caps_org, &cmd->caps[0], sizeof(caps_org)); -+ caps_org = rte_le_to_cpu_64(caps_org); -+ caps_new = caps_org ^ (caps_org & hns->dev_caps_mask); -+ caps_masked = caps_org ^ caps_new; -+ caps_new = rte_cpu_to_le_64(caps_new); -+ memcpy(&cmd->caps[0], &caps_new, sizeof(caps_new)); -+ -+ for (i = 0; i < MAX_CAPS_BIT; i++) { -+ if (!(caps_masked & BIT_ULL(i))) -+ continue; -+ hns3_info(hw, "mask capabiliy: id-%u, name-%s.", -+ i, hns3_get_caps_name(i)); -+ } -+} -+ - static void - hns3_parse_capability(struct hns3_hw *hw, - struct hns3_query_version_cmd *cmd) -@@ -485,6 +547,11 @@ hns3_cmd_query_firmware_version_and_capability(struct hns3_hw *hw) - return ret; - - hw->fw_version = rte_le_to_cpu_32(resp->firmware); -+ /* -+ * Make sure mask the capability before parse capability because it -+ * may overwrite resp's data. -+ */ -+ hns3_mask_capability(hw, resp); - hns3_parse_capability(hw, resp); - - return 0; -diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c -index 893b357..c75aa9c 100644 ---- a/drivers/net/hns3/hns3_ethdev.c -+++ b/drivers/net/hns3/hns3_ethdev.c -@@ -7209,6 +7209,19 @@ hns3_get_io_hint_func_name(uint32_t hint) - } - } - -+static int -+hns3_parse_dev_caps_mask(const char *key, const char *value, void *extra_args) -+{ -+ uint64_t val; -+ -+ RTE_SET_USED(key); -+ -+ val = strtoull(value, NULL, 16); -+ *(uint64_t *)extra_args = val; -+ -+ return 0; -+} -+ - void - hns3_parse_devargs(struct rte_eth_dev *dev) - { -@@ -7216,6 +7229,7 @@ hns3_parse_devargs(struct rte_eth_dev *dev) - uint32_t rx_func_hint = HNS3_IO_FUNC_HINT_NONE; - uint32_t tx_func_hint = HNS3_IO_FUNC_HINT_NONE; - struct hns3_hw *hw = &hns->hw; -+ uint64_t dev_caps_mask = 0; - struct rte_kvargs *kvlist; - - if (dev->device->devargs == NULL) -@@ -7229,6 +7243,8 @@ hns3_parse_devargs(struct rte_eth_dev *dev) - &hns3_parse_io_hint_func, &rx_func_hint); - rte_kvargs_process(kvlist, HNS3_DEVARG_TX_FUNC_HINT, - &hns3_parse_io_hint_func, &tx_func_hint); -+ rte_kvargs_process(kvlist, HNS3_DEVARG_DEV_CAPS_MASK, -+ &hns3_parse_dev_caps_mask, &dev_caps_mask); - rte_kvargs_free(kvlist); - - if (rx_func_hint != HNS3_IO_FUNC_HINT_NONE) -@@ -7239,6 +7255,11 @@ hns3_parse_devargs(struct rte_eth_dev *dev) - hns3_warn(hw, "parsed %s = %s.", HNS3_DEVARG_TX_FUNC_HINT, - hns3_get_io_hint_func_name(tx_func_hint)); - hns->tx_func_hint = tx_func_hint; -+ -+ if (dev_caps_mask != 0) -+ hns3_warn(hw, "parsed %s = 0x%" PRIx64 ".", -+ HNS3_DEVARG_DEV_CAPS_MASK, dev_caps_mask); -+ hns->dev_caps_mask = dev_caps_mask; - } - - static const struct eth_dev_ops hns3_eth_dev_ops = { -@@ -7506,6 +7527,7 @@ RTE_PMD_REGISTER_PCI_TABLE(net_hns3, pci_id_hns3_map); - RTE_PMD_REGISTER_KMOD_DEP(net_hns3, "* igb_uio | vfio-pci"); - RTE_PMD_REGISTER_PARAM_STRING(net_hns3, - HNS3_DEVARG_RX_FUNC_HINT "=vec|sve|simple|common " -- HNS3_DEVARG_TX_FUNC_HINT "=vec|sve|simple|common "); -+ HNS3_DEVARG_TX_FUNC_HINT "=vec|sve|simple|common " -+ HNS3_DEVARG_DEV_CAPS_MASK "=<1-65535> "); - RTE_LOG_REGISTER(hns3_logtype_init, pmd.net.hns3.init, NOTICE); - RTE_LOG_REGISTER(hns3_logtype_driver, pmd.net.hns3.driver, NOTICE); -diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h -index 4a855de..271eadb 100644 ---- a/drivers/net/hns3/hns3_ethdev.h -+++ b/drivers/net/hns3/hns3_ethdev.h -@@ -833,6 +833,8 @@ struct hns3_adapter { - uint32_t rx_func_hint; - uint32_t tx_func_hint; - -+ uint64_t dev_caps_mask; -+ - struct hns3_ptype_table ptype_tbl __rte_cache_min_aligned; - }; - -@@ -847,6 +849,8 @@ enum { - #define HNS3_DEVARG_RX_FUNC_HINT "rx_func_hint" - #define HNS3_DEVARG_TX_FUNC_HINT "tx_func_hint" - -+#define HNS3_DEVARG_DEV_CAPS_MASK "dev_caps_mask" -+ - #define HNS3_DEV_SUPPORT_DCB_B 0x0 - #define HNS3_DEV_SUPPORT_COPPER_B 0x1 - #define HNS3_DEV_SUPPORT_UDP_GSO_B 0x2 -diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c -index efc614b..16cc111 100644 ---- a/drivers/net/hns3/hns3_ethdev_vf.c -+++ b/drivers/net/hns3/hns3_ethdev_vf.c -@@ -3075,4 +3075,5 @@ RTE_PMD_REGISTER_PCI_TABLE(net_hns3_vf, pci_id_hns3vf_map); - RTE_PMD_REGISTER_KMOD_DEP(net_hns3_vf, "* igb_uio | vfio-pci"); - RTE_PMD_REGISTER_PARAM_STRING(net_hns3_vf, - HNS3_DEVARG_RX_FUNC_HINT "=vec|sve|simple|common " -- HNS3_DEVARG_TX_FUNC_HINT "=vec|sve|simple|common "); -+ HNS3_DEVARG_TX_FUNC_HINT "=vec|sve|simple|common " -+ HNS3_DEVARG_DEV_CAPS_MASK "=<1-65535> "); --- -2.7.4 - diff --git a/0121-app-testpmd-fix-use-of-indirect-action-after-port-cl.patch b/0121-app-testpmd-fix-use-of-indirect-action-after-port-cl.patch new file mode 100644 index 0000000000000000000000000000000000000000..d080e931d8c77bf8afd04ebaa9ec6ffb3024b3f7 --- /dev/null +++ b/0121-app-testpmd-fix-use-of-indirect-action-after-port-cl.patch @@ -0,0 +1,94 @@ +From 83d21ff84152f5912ce3e53ecb577216243fb4e4 Mon Sep 17 00:00:00 2001 +From: Dmitry Kozlyuk +Date: Mon, 7 Mar 2022 18:48:21 +0200 +Subject: [PATCH 121/122] app/testpmd: fix use of indirect action after port + close + +When a port was closed, indirect actions could remain +with their handles no longer valid. +If a newly attached device was assigned the same ID as the closed port, +those indirect actions became accessible again. +Any attempt to use them resulted in an undefined behavior. +Automatically flush indirect actions when a port is closed. + +Fixes: 4b61b8774be9 ("ethdev: introduce indirect flow action") +Cc: stable@dpdk.org + +Signed-off-by: Dmitry Kozlyuk +Acked-by: Matan Azrad +Acked-by: Aman Singh +--- + app/test-pmd/config.c | 31 +++++++++++++++++++++++++++++++ + app/test-pmd/testpmd.c | 1 + + app/test-pmd/testpmd.h | 1 + + 3 files changed, 33 insertions(+) + +diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c +index 496e787edd..a7fffc3d1d 100644 +--- a/app/test-pmd/config.c ++++ b/app/test-pmd/config.c +@@ -1743,6 +1743,37 @@ port_action_handle_destroy(portid_t port_id, + return ret; + } + ++int ++port_action_handle_flush(portid_t port_id) ++{ ++ struct rte_port *port; ++ struct port_indirect_action **tmp; ++ int ret = 0; ++ ++ if (port_id_is_invalid(port_id, ENABLED_WARN) || ++ port_id == (portid_t)RTE_PORT_ALL) ++ return -EINVAL; ++ port = &ports[port_id]; ++ tmp = &port->actions_list; ++ while (*tmp != NULL) { ++ struct rte_flow_error error; ++ struct port_indirect_action *pia = *tmp; ++ ++ /* Poisoning to make sure PMDs update it in case of error. */ ++ memset(&error, 0x44, sizeof(error)); ++ if (pia->handle != NULL && ++ rte_flow_action_handle_destroy ++ (port_id, pia->handle, &error) != 0) { ++ printf("Indirect action #%u not destroyed\n", pia->id); ++ ret = port_flow_complain(&error); ++ tmp = &pia->next; ++ } else { ++ *tmp = pia->next; ++ free(pia); ++ } ++ } ++ return ret; ++} + + /** Get indirect action by port + id */ + struct rte_flow_action_handle * +diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c +index c4be9abe73..ac090bde06 100644 +--- a/app/test-pmd/testpmd.c ++++ b/app/test-pmd/testpmd.c +@@ -3212,6 +3212,7 @@ close_port(portid_t pid) + if (is_proc_primary()) { + port_flow_flush(pi); + port_flex_item_flush(pi); ++ port_action_handle_flush(pi); + rte_eth_dev_close(pi); + } + +diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h +index 9c24cb07e0..042802b205 100644 +--- a/app/test-pmd/testpmd.h ++++ b/app/test-pmd/testpmd.h +@@ -881,6 +881,7 @@ int port_action_handle_create(portid_t port_id, uint32_t id, + const struct rte_flow_action *action); + int port_action_handle_destroy(portid_t port_id, + uint32_t n, const uint32_t *action); ++int port_action_handle_flush(portid_t port_id); + struct rte_flow_action_handle *port_action_handle_get_by_id(portid_t port_id, + uint32_t id); + int port_action_handle_update(portid_t port_id, uint32_t id, +-- +2.22.0 + diff --git a/0121-net-hns3-simplify-Rx-checksum.patch b/0121-net-hns3-simplify-Rx-checksum.patch deleted file mode 100644 index 1f1b83b3af2323d72705416153c04e65de229be9..0000000000000000000000000000000000000000 --- a/0121-net-hns3-simplify-Rx-checksum.patch +++ /dev/null @@ -1,302 +0,0 @@ -From d31202d8067fd92a390fc67db148e45f2b719894 Mon Sep 17 00:00:00 2001 -From: Chengwen Feng -Date: Thu, 15 Apr 2021 11:52:01 +0800 -Subject: [PATCH 121/189] net/hns3: simplify Rx checksum - -Currently, the L3L4P/L3E/L4E/OL3E/OL4E fields in Rx descriptor used to -indicate hardware checksum result: -1. L3L4P: indicates hardware has processed L3L4 checksum for this - packet, if this bit is 1 then L3E/L4E/OL3E/OL4E is trustable. -2. L3E: L3 checksum error indication, 1 means with error. -3. L4E: L4 checksum error indication, 1 means with error. -4. OL3E: outer L3 checksum error indication, 1 means with error. -5. OL4E: outer L4 checksum error indication, 1 means with error. - -Driver will set the good checksum flag through packet type and -L3E/L4E/OL3E/OL4E when L3L4P is 1, it runs as follows: -1. If packet type indicates it's tunnel packet: -1.1. If packet type indicates it has inner L3 and L3E is zero, then -mark the IP checksum good. -1.2. If packet type indicates it has inner L4 and L4E is zero, then -mark the L4 checksum good. -1.3. If packet type indicates it has outer L4 and OL4E is zero, then -mark the outer L4 checksum good. -2. If packet type indicates it's not tunnel packet: -2.1. If packet type indicates it has L3 and L3E is zero, then mark the -IP checksum good. -2.2. If packet type indicates it has L4 and L4E is zero, then mark the -L4 checksum good. - -As described above, the good checksum calculation is time consuming, -it impacts the Rx performance. - -By balancing performance and functionality, driver uses the following -scheme to set good checksum flag when L3L4P is 1: -1. If L3E is zero, then mark the IP checksum good. -2. If L4E is zero, then mark the L4 checksum good. - -The performance gains are 3% in small packet iofwd scenarios. - -Signed-off-by: Chengwen Feng -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_rxtx.c | 14 +---- - drivers/net/hns3/hns3_rxtx.h | 103 ++++++++++++++-------------------- - drivers/net/hns3/hns3_rxtx_vec_neon.h | 7 +-- - drivers/net/hns3/hns3_rxtx_vec_sve.c | 6 +- - 4 files changed, 45 insertions(+), 85 deletions(-) - -diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c -index 4873c9c..87416a1 100644 ---- a/drivers/net/hns3/hns3_rxtx.c -+++ b/drivers/net/hns3/hns3_rxtx.c -@@ -2402,7 +2402,6 @@ hns3_recv_pkts_simple(void *rx_queue, - struct rte_mbuf *nmb; /* pointer of the new mbuf */ - struct rte_mbuf *rxm; - uint32_t bd_base_info; -- uint32_t cksum_err; - uint32_t l234_info; - uint32_t ol_info; - uint64_t dma_addr; -@@ -2477,8 +2476,7 @@ hns3_recv_pkts_simple(void *rx_queue, - /* Load remained descriptor data and extract necessary fields */ - l234_info = rte_le_to_cpu_32(rxd.rx.l234_info); - ol_info = rte_le_to_cpu_32(rxd.rx.ol_info); -- ret = hns3_handle_bdinfo(rxq, rxm, bd_base_info, -- l234_info, &cksum_err); -+ ret = hns3_handle_bdinfo(rxq, rxm, bd_base_info, l234_info); - if (unlikely(ret)) - goto pkt_err; - -@@ -2487,9 +2485,6 @@ hns3_recv_pkts_simple(void *rx_queue, - if (rxm->packet_type == RTE_PTYPE_L2_ETHER_TIMESYNC) - rxm->ol_flags |= PKT_RX_IEEE1588_PTP; - -- if (likely(bd_base_info & BIT(HNS3_RXD_L3L4P_B))) -- hns3_rx_set_cksum_flag(rxm, rxm->packet_type, -- cksum_err); - hns3_rxd_to_vlan_tci(rxq, rxm, l234_info, &rxd); - - /* Increment bytes counter */ -@@ -2528,7 +2523,6 @@ hns3_recv_scattered_pkts(void *rx_queue, - struct rte_mbuf *rxm; - struct rte_eth_dev *dev; - uint32_t bd_base_info; -- uint32_t cksum_err; - uint32_t l234_info; - uint32_t gro_size; - uint32_t ol_info; -@@ -2702,17 +2696,13 @@ hns3_recv_scattered_pkts(void *rx_queue, - l234_info = rte_le_to_cpu_32(rxd.rx.l234_info); - ol_info = rte_le_to_cpu_32(rxd.rx.ol_info); - ret = hns3_handle_bdinfo(rxq, first_seg, bd_base_info, -- l234_info, &cksum_err); -+ l234_info); - if (unlikely(ret)) - goto pkt_err; - - first_seg->packet_type = hns3_rx_calc_ptype(rxq, - l234_info, ol_info); - -- if (bd_base_info & BIT(HNS3_RXD_L3L4P_B)) -- hns3_rx_set_cksum_flag(first_seg, -- first_seg->packet_type, -- cksum_err); - hns3_rxd_to_vlan_tci(rxq, first_seg, l234_info, &rxd); - - /* Increment bytes counter */ -diff --git a/drivers/net/hns3/hns3_rxtx.h b/drivers/net/hns3/hns3_rxtx.h -index d25edc4..ac14802 100644 ---- a/drivers/net/hns3/hns3_rxtx.h -+++ b/drivers/net/hns3/hns3_rxtx.h -@@ -539,19 +539,50 @@ enum hns3_cksum_status { - extern uint64_t hns3_timestamp_rx_dynflag; - extern int hns3_timestamp_dynfield_offset; - --static inline int --hns3_handle_bdinfo(struct hns3_rx_queue *rxq, struct rte_mbuf *rxm, -- uint32_t bd_base_info, uint32_t l234_info, -- uint32_t *cksum_err) -+static inline void -+hns3_rx_set_cksum_flag(struct hns3_rx_queue *rxq, -+ struct rte_mbuf *rxm, -+ uint32_t l234_info) - { --#define L2E_TRUNC_ERR_FLAG (BIT(HNS3_RXD_L2E_B) | \ -- BIT(HNS3_RXD_TRUNCATE_B)) --#define CHECKSUM_ERR_FLAG (BIT(HNS3_RXD_L3E_B) | \ -+#define HNS3_RXD_CKSUM_ERR_MASK (BIT(HNS3_RXD_L3E_B) | \ - BIT(HNS3_RXD_L4E_B) | \ - BIT(HNS3_RXD_OL3E_B) | \ - BIT(HNS3_RXD_OL4E_B)) - -- uint32_t tmp = 0; -+ if (likely((l234_info & HNS3_RXD_CKSUM_ERR_MASK) == 0)) { -+ rxm->ol_flags |= (PKT_RX_IP_CKSUM_GOOD | PKT_RX_L4_CKSUM_GOOD); -+ return; -+ } -+ -+ if (unlikely(l234_info & BIT(HNS3_RXD_L3E_B))) { -+ rxm->ol_flags |= PKT_RX_IP_CKSUM_BAD; -+ rxq->dfx_stats.l3_csum_errors++; -+ } else { -+ rxm->ol_flags |= PKT_RX_IP_CKSUM_GOOD; -+ } -+ -+ if (unlikely(l234_info & BIT(HNS3_RXD_L4E_B))) { -+ rxm->ol_flags |= PKT_RX_L4_CKSUM_BAD; -+ rxq->dfx_stats.l4_csum_errors++; -+ } else { -+ rxm->ol_flags |= PKT_RX_L4_CKSUM_GOOD; -+ } -+ -+ if (unlikely(l234_info & BIT(HNS3_RXD_OL3E_B))) -+ rxq->dfx_stats.ol3_csum_errors++; -+ -+ if (unlikely(l234_info & BIT(HNS3_RXD_OL4E_B))) { -+ rxm->ol_flags |= PKT_RX_OUTER_L4_CKSUM_BAD; -+ rxq->dfx_stats.ol4_csum_errors++; -+ } -+} -+ -+static inline int -+hns3_handle_bdinfo(struct hns3_rx_queue *rxq, struct rte_mbuf *rxm, -+ uint32_t bd_base_info, uint32_t l234_info) -+{ -+#define L2E_TRUNC_ERR_FLAG (BIT(HNS3_RXD_L2E_B) | \ -+ BIT(HNS3_RXD_TRUNCATE_B)) - - /* - * If packet len bigger than mtu when recv with no-scattered algorithm, -@@ -570,64 +601,12 @@ hns3_handle_bdinfo(struct hns3_rx_queue *rxq, struct rte_mbuf *rxm, - return -EINVAL; - } - -- if (bd_base_info & BIT(HNS3_RXD_L3L4P_B)) { -- if (likely((l234_info & CHECKSUM_ERR_FLAG) == 0)) { -- *cksum_err = 0; -- return 0; -- } -- -- if (unlikely(l234_info & BIT(HNS3_RXD_L3E_B))) { -- rxm->ol_flags |= PKT_RX_IP_CKSUM_BAD; -- rxq->dfx_stats.l3_csum_errors++; -- tmp |= HNS3_L3_CKSUM_ERR; -- } -- -- if (unlikely(l234_info & BIT(HNS3_RXD_L4E_B))) { -- rxm->ol_flags |= PKT_RX_L4_CKSUM_BAD; -- rxq->dfx_stats.l4_csum_errors++; -- tmp |= HNS3_L4_CKSUM_ERR; -- } -- -- if (unlikely(l234_info & BIT(HNS3_RXD_OL3E_B))) { -- rxq->dfx_stats.ol3_csum_errors++; -- tmp |= HNS3_OUTER_L3_CKSUM_ERR; -- } -- -- if (unlikely(l234_info & BIT(HNS3_RXD_OL4E_B))) { -- rxm->ol_flags |= PKT_RX_OUTER_L4_CKSUM_BAD; -- rxq->dfx_stats.ol4_csum_errors++; -- tmp |= HNS3_OUTER_L4_CKSUM_ERR; -- } -- } -- *cksum_err = tmp; -+ if (bd_base_info & BIT(HNS3_RXD_L3L4P_B)) -+ hns3_rx_set_cksum_flag(rxq, rxm, l234_info); - - return 0; - } - --static inline void --hns3_rx_set_cksum_flag(struct rte_mbuf *rxm, const uint64_t packet_type, -- const uint32_t cksum_err) --{ -- if (unlikely((packet_type & RTE_PTYPE_TUNNEL_MASK))) { -- if (likely(packet_type & RTE_PTYPE_INNER_L3_MASK) && -- (cksum_err & HNS3_L3_CKSUM_ERR) == 0) -- rxm->ol_flags |= PKT_RX_IP_CKSUM_GOOD; -- if (likely(packet_type & RTE_PTYPE_INNER_L4_MASK) && -- (cksum_err & HNS3_L4_CKSUM_ERR) == 0) -- rxm->ol_flags |= PKT_RX_L4_CKSUM_GOOD; -- if (likely(packet_type & RTE_PTYPE_L4_MASK) && -- (cksum_err & HNS3_OUTER_L4_CKSUM_ERR) == 0) -- rxm->ol_flags |= PKT_RX_OUTER_L4_CKSUM_GOOD; -- } else { -- if (likely(packet_type & RTE_PTYPE_L3_MASK) && -- (cksum_err & HNS3_L3_CKSUM_ERR) == 0) -- rxm->ol_flags |= PKT_RX_IP_CKSUM_GOOD; -- if (likely(packet_type & RTE_PTYPE_L4_MASK) && -- (cksum_err & HNS3_L4_CKSUM_ERR) == 0) -- rxm->ol_flags |= PKT_RX_L4_CKSUM_GOOD; -- } --} -- - static inline uint32_t - hns3_rx_calc_ptype(struct hns3_rx_queue *rxq, const uint32_t l234_info, - const uint32_t ol_info) -diff --git a/drivers/net/hns3/hns3_rxtx_vec_neon.h b/drivers/net/hns3/hns3_rxtx_vec_neon.h -index 68f098f..4699a62 100644 ---- a/drivers/net/hns3/hns3_rxtx_vec_neon.h -+++ b/drivers/net/hns3/hns3_rxtx_vec_neon.h -@@ -98,7 +98,6 @@ hns3_desc_parse_field(struct hns3_rx_queue *rxq, - uint32_t l234_info, ol_info, bd_base_info; - struct rte_mbuf *pkt; - uint32_t retcode = 0; -- uint32_t cksum_err; - uint32_t i; - int ret; - -@@ -111,17 +110,13 @@ hns3_desc_parse_field(struct hns3_rx_queue *rxq, - l234_info = rxdp[i].rx.l234_info; - ol_info = rxdp[i].rx.ol_info; - bd_base_info = rxdp[i].rx.bd_base_info; -- ret = hns3_handle_bdinfo(rxq, pkt, bd_base_info, -- l234_info, &cksum_err); -+ ret = hns3_handle_bdinfo(rxq, pkt, bd_base_info, l234_info); - if (unlikely(ret)) { - retcode |= 1u << i; - continue; - } - - pkt->packet_type = hns3_rx_calc_ptype(rxq, l234_info, ol_info); -- if (likely(bd_base_info & BIT(HNS3_RXD_L3L4P_B))) -- hns3_rx_set_cksum_flag(pkt, pkt->packet_type, -- cksum_err); - - /* Increment bytes counter */ - rxq->basic_stats.bytes += pkt->pkt_len; -diff --git a/drivers/net/hns3/hns3_rxtx_vec_sve.c b/drivers/net/hns3/hns3_rxtx_vec_sve.c -index 2700e6e..bc5577b 100644 ---- a/drivers/net/hns3/hns3_rxtx_vec_sve.c -+++ b/drivers/net/hns3/hns3_rxtx_vec_sve.c -@@ -39,7 +39,6 @@ hns3_desc_parse_field_sve(struct hns3_rx_queue *rxq, - uint32_t bd_vld_num) - { - uint32_t retcode = 0; -- uint32_t cksum_err; - int ret, i; - - for (i = 0; i < (int)bd_vld_num; i++) { -@@ -47,7 +46,7 @@ hns3_desc_parse_field_sve(struct hns3_rx_queue *rxq, - rx_pkts[i]->ol_flags = PKT_RX_RSS_HASH; - - ret = hns3_handle_bdinfo(rxq, rx_pkts[i], key->bd_base_info[i], -- key->l234_info[i], &cksum_err); -+ key->l234_info[i]); - if (unlikely(ret)) { - retcode |= 1u << i; - continue; -@@ -55,9 +54,6 @@ hns3_desc_parse_field_sve(struct hns3_rx_queue *rxq, - - rx_pkts[i]->packet_type = hns3_rx_calc_ptype(rxq, - key->l234_info[i], key->ol_info[i]); -- if (likely(key->bd_base_info[i] & BIT(HNS3_RXD_L3L4P_B))) -- hns3_rx_set_cksum_flag(rx_pkts[i], -- rx_pkts[i]->packet_type, cksum_err); - - /* Increment bytes counter */ - rxq->basic_stats.bytes += rx_pkts[i]->pkt_len; --- -2.7.4 - diff --git a/0122-app-testpmd-fix-bonding-slave-devices-not-released.patch b/0122-app-testpmd-fix-bonding-slave-devices-not-released.patch new file mode 100644 index 0000000000000000000000000000000000000000..4d1c23ee4ebff6ae57c6501b0c79080531c70e6b --- /dev/null +++ b/0122-app-testpmd-fix-bonding-slave-devices-not-released.patch @@ -0,0 +1,122 @@ +From f53f8218cfe85b78779cee5d499e7b32f26c4769 Mon Sep 17 00:00:00 2001 +From: Huisong Li +Date: Thu, 9 Jun 2022 19:49:21 +0800 +Subject: [PATCH 122/122] app/testpmd: fix bonding slave devices not released + +Currently, some eth devices are added to bond device, these devices are +not released when the quit command is executed in testpmd. This patch +adds the release operation for all active slaves under a bond device. + +Fixes: 0e545d3047fe ("app/testpmd: check stopping port is not in bonding") +Cc: stable@dpdk.org + +Signed-off-by: Huisong Li +Signed-off-by: Min Hu (Connor) +Signed-off-by: Dongdong Liu +Acked-by: Ferruh Yigit +--- + app/test-pmd/cmdline.c | 1 + + app/test-pmd/testpmd.c | 41 +++++++++++++++++++++++++++++++++++++++++ + app/test-pmd/testpmd.h | 2 ++ + 3 files changed, 44 insertions(+) + +diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c +index 1991ee3446..1f9fd61394 100644 +--- a/app/test-pmd/cmdline.c ++++ b/app/test-pmd/cmdline.c +@@ -8764,6 +8764,7 @@ static void cmd_quit_parsed(__rte_unused void *parsed_result, + __rte_unused void *data) + { + cmdline_quit(cl); ++ cl_quit = 1; + } + + cmdline_parse_token_string_t cmd_quit_quit = +diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c +index ac090bde06..66d5167f57 100644 +--- a/app/test-pmd/testpmd.c ++++ b/app/test-pmd/testpmd.c +@@ -223,6 +223,7 @@ unsigned int xstats_display_num; /**< Size of extended statistics to show */ + * option. Set flag to exit stats period loop after received SIGINT/SIGTERM. + */ + uint8_t f_quit; ++uint8_t cl_quit; /* Quit testpmd from cmdline. */ + + /* + * Max Rx frame size, set by '--max-pkt-len' parameter. +@@ -3174,11 +3175,39 @@ remove_invalid_ports(void) + nb_cfg_ports = nb_fwd_ports; + } + ++static void ++clear_bonding_slave_device(portid_t *slave_pids, uint16_t num_slaves) ++{ ++ struct rte_port *port; ++ portid_t slave_pid; ++ uint16_t i; ++ ++ for (i = 0; i < num_slaves; i++) { ++ slave_pid = slave_pids[i]; ++ if (port_is_started(slave_pid) == 1) { ++ if (rte_eth_dev_stop(slave_pid) != 0) ++ fprintf(stderr, "rte_eth_dev_stop failed for port %u\n", ++ slave_pid); ++ ++ port = &ports[slave_pid]; ++ port->port_status = RTE_PORT_STOPPED; ++ } ++ ++ clear_port_slave_flag(slave_pid); ++ ++ /* Close slave device when testpmd quit or is killed. */ ++ if (cl_quit == 1 || f_quit == 1) ++ rte_eth_dev_close(slave_pid); ++ } ++} ++ + void + close_port(portid_t pid) + { + portid_t pi; + struct rte_port *port; ++ portid_t slave_pids[RTE_MAX_ETHPORTS]; ++ int num_slaves = 0; + + if (port_id_is_invalid(pid, ENABLED_WARN)) + return; +@@ -3213,7 +3242,19 @@ close_port(portid_t pid) + port_flow_flush(pi); + port_flex_item_flush(pi); + port_action_handle_flush(pi); ++#ifdef RTE_NET_BOND ++ if (port->bond_flag == 1) ++ num_slaves = rte_eth_bond_slaves_get(pi, ++ slave_pids, RTE_MAX_ETHPORTS); ++#endif + rte_eth_dev_close(pi); ++ /* ++ * If this port is bonded device, all slaves under the ++ * device need to be removed or closed. ++ */ ++ if (port->bond_flag == 1 && num_slaves > 0) ++ clear_bonding_slave_device(slave_pids, ++ num_slaves); + } + + free_xstats_display_info(pi); +diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h +index 042802b205..569b4300cf 100644 +--- a/app/test-pmd/testpmd.h ++++ b/app/test-pmd/testpmd.h +@@ -32,6 +32,8 @@ + #define RTE_PORT_CLOSED (uint16_t)2 + #define RTE_PORT_HANDLING (uint16_t)3 + ++extern uint8_t cl_quit; ++ + /* + * It is used to allocate the memory for hash key. + * The hash key size is NIC dependent. +-- +2.22.0 + diff --git a/0122-net-hns3-check-max-SIMD-bitwidth.patch b/0122-net-hns3-check-max-SIMD-bitwidth.patch deleted file mode 100644 index 9421f25a1c99b17c56dc998cfa3e4ae1dd5b3e4f..0000000000000000000000000000000000000000 --- a/0122-net-hns3-check-max-SIMD-bitwidth.patch +++ /dev/null @@ -1,47 +0,0 @@ -From 65e9bf664b7758d9e0e722ce0b4b15869a177f19 Mon Sep 17 00:00:00 2001 -From: Chengwen Feng -Date: Thu, 15 Apr 2021 11:52:02 +0800 -Subject: [PATCH 122/189] net/hns3: check max SIMD bitwidth - -This patch supports check max SIMD bitwidth when choosing NEON and SVE -vector path. - -Signed-off-by: Chengwen Feng -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_rxtx.c | 5 +++++ - 1 file changed, 5 insertions(+) - -diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c -index 87416a1..92d377b 100644 ---- a/drivers/net/hns3/hns3_rxtx.c -+++ b/drivers/net/hns3/hns3_rxtx.c -@@ -13,6 +13,7 @@ - #include - #if defined(RTE_ARCH_ARM64) - #include -+#include - #endif - - #include "hns3_ethdev.h" -@@ -2790,6 +2791,8 @@ static bool - hns3_get_default_vec_support(void) - { - #if defined(RTE_ARCH_ARM64) -+ if (rte_vect_get_max_simd_bitwidth() < RTE_VECT_SIMD_128) -+ return false; - if (rte_cpu_get_flag_enabled(RTE_CPUFLAG_NEON)) - return true; - #endif -@@ -2800,6 +2803,8 @@ static bool - hns3_get_sve_support(void) - { - #if defined(RTE_ARCH_ARM64) && defined(__ARM_FEATURE_SVE) -+ if (rte_vect_get_max_simd_bitwidth() < RTE_VECT_SIMD_256) -+ return false; - if (rte_cpu_get_flag_enabled(RTE_CPUFLAG_SVE)) - return true; - #endif --- -2.7.4 - diff --git a/0123-net-hns3-add-compile-time-verification-on-Rx-vector.patch b/0123-net-hns3-add-compile-time-verification-on-Rx-vector.patch deleted file mode 100644 index 97b09355555cfe1e2de224692a14f796a19bf8f7..0000000000000000000000000000000000000000 --- a/0123-net-hns3-add-compile-time-verification-on-Rx-vector.patch +++ /dev/null @@ -1,89 +0,0 @@ -From 81ac96b3d326444b3ec1dc5e72819056a94b9e2f Mon Sep 17 00:00:00 2001 -From: Chengwen Feng -Date: Sat, 17 Apr 2021 17:54:54 +0800 -Subject: [PATCH 123/189] net/hns3: add compile-time verification on Rx vector - -Rx vector implementation depends on the mbuf fields -(such as rearm_data/rx_descriptor_fields1) layout, this patch adds -compile-time verification for this. - -Signed-off-by: Chengwen Feng -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_rxtx_vec.c | 22 ++++++++++++++++++++++ - drivers/net/hns3/hns3_rxtx_vec_neon.h | 8 ++++++++ - drivers/net/hns3/hns3_rxtx_vec_sve.c | 6 ++++++ - 3 files changed, 36 insertions(+) - -diff --git a/drivers/net/hns3/hns3_rxtx_vec.c b/drivers/net/hns3/hns3_rxtx_vec.c -index fd7b272..d6636df 100644 ---- a/drivers/net/hns3/hns3_rxtx_vec.c -+++ b/drivers/net/hns3/hns3_rxtx_vec.c -@@ -147,6 +147,28 @@ hns3_rxq_vec_setup_rearm_data(struct hns3_rx_queue *rxq) - mb_def.port = rxq->port_id; - rte_mbuf_refcnt_set(&mb_def, 1); - -+ /* compile-time verifies the rearm_data first 8bytes */ -+ RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, data_off) < -+ offsetof(struct rte_mbuf, rearm_data)); -+ RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, refcnt) < -+ offsetof(struct rte_mbuf, rearm_data)); -+ RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, refcnt) < -+ offsetof(struct rte_mbuf, rearm_data)); -+ RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, nb_segs) < -+ offsetof(struct rte_mbuf, rearm_data)); -+ RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, port) < -+ offsetof(struct rte_mbuf, rearm_data)); -+ RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, data_off) - -+ offsetof(struct rte_mbuf, rearm_data) > 6); -+ RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, refcnt) - -+ offsetof(struct rte_mbuf, rearm_data) > 6); -+ RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, refcnt) - -+ offsetof(struct rte_mbuf, rearm_data) > 6); -+ RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, nb_segs) - -+ offsetof(struct rte_mbuf, rearm_data) > 6); -+ RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, port) - -+ offsetof(struct rte_mbuf, rearm_data) > 6); -+ - /* prevent compiler reordering: rearm_data covers previous fields */ - rte_compiler_barrier(); - p = (uintptr_t)&mb_def.rearm_data; -diff --git a/drivers/net/hns3/hns3_rxtx_vec_neon.h b/drivers/net/hns3/hns3_rxtx_vec_neon.h -index 4699a62..35fef12 100644 ---- a/drivers/net/hns3/hns3_rxtx_vec_neon.h -+++ b/drivers/net/hns3/hns3_rxtx_vec_neon.h -@@ -156,6 +156,14 @@ hns3_recv_burst_vec(struct hns3_rx_queue *__restrict rxq, - 0, 0, 0, /* ignore non-length fields */ - }; - -+ /* compile-time verifies the shuffle mask */ -+ RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, pkt_len) != -+ offsetof(struct rte_mbuf, rx_descriptor_fields1) + 4); -+ RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, data_len) != -+ offsetof(struct rte_mbuf, rx_descriptor_fields1) + 8); -+ RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, hash.rss) != -+ offsetof(struct rte_mbuf, rx_descriptor_fields1) + 12); -+ - for (pos = 0; pos < nb_pkts; pos += HNS3_DEFAULT_DESCS_PER_LOOP, - rxdp += HNS3_DEFAULT_DESCS_PER_LOOP) { - uint64x2x2_t descs[HNS3_DEFAULT_DESCS_PER_LOOP]; -diff --git a/drivers/net/hns3/hns3_rxtx_vec_sve.c b/drivers/net/hns3/hns3_rxtx_vec_sve.c -index bc5577b..e15fd7a 100644 ---- a/drivers/net/hns3/hns3_rxtx_vec_sve.c -+++ b/drivers/net/hns3/hns3_rxtx_vec_sve.c -@@ -118,6 +118,12 @@ hns3_recv_burst_vec_sve(struct hns3_rx_queue *__restrict rxq, - svuint32_t rss_tbl1 = svld1_u32(PG32_256BIT, rss_adjust); - svuint32_t rss_tbl2 = svld1_u32(PG32_256BIT, &rss_adjust[8]); - -+ /* compile-time verifies the xlen_adjust mask */ -+ RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, data_len) != -+ offsetof(struct rte_mbuf, pkt_len) + 4); -+ RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, vlan_tci) != -+ offsetof(struct rte_mbuf, data_len) + 2); -+ - for (pos = 0; pos < nb_pkts; pos += HNS3_SVE_DEFAULT_DESCS_PER_LOOP, - rxdp += HNS3_SVE_DEFAULT_DESCS_PER_LOOP) { - svuint64_t vld_clz, mbp1st, mbp2st, mbuf_init; --- -2.7.4 - diff --git a/0123-secure-complilation-options-rpath.patch b/0123-secure-complilation-options-rpath.patch new file mode 100644 index 0000000000000000000000000000000000000000..f3aae0b7c0bf70ebfb9f010a44a630d3e0e66712 --- /dev/null +++ b/0123-secure-complilation-options-rpath.patch @@ -0,0 +1,38 @@ +From 620b54f7d1c4bbf99d894ac3c8ddf3e73c29071f Mon Sep 17 00:00:00 2001 +From: wu-changsheng +Date: Tue, 13 Sep 2022 22:33:48 +0800 +Subject: [PATCH] delete rpath + +--- + app/meson.build | 1 - + app/test/meson.build | 2 -- + 2 files changed, 3 deletions(-) + +diff --git a/app/meson.build b/app/meson.build +index 885dfe3..d1c6b25 100644 +--- a/app/meson.build ++++ b/app/meson.build +@@ -74,7 +74,6 @@ foreach app:apps + link_whole: link_libs, + dependencies: ext_deps + dep_objs, + include_directories: includes, +- install_rpath: join_paths(get_option('prefix'), driver_install_path), + install: true) + endforeach + +diff --git a/app/test/meson.build b/app/test/meson.build +index 2b480ad..51d09ec 100644 +--- a/app/test/meson.build ++++ b/app/test/meson.build +@@ -488,8 +488,6 @@ dpdk_test = executable('dpdk-test', + link_whole: link_libs, + dependencies: test_dep_objs + ext_deps, + c_args: cflags, +- install_rpath: join_paths(get_option('prefix'), +- driver_install_path), + install: true) + + has_hugepage = run_command('has-hugepage.sh').stdout().strip() != '0' +-- +2.23.0 + diff --git a/0124-net-hns3-remove-redundant-mailbox-response.patch b/0124-net-hns3-remove-redundant-mailbox-response.patch deleted file mode 100644 index 690cb5b648fefde3c932b23cf7a40027d5fe74e2..0000000000000000000000000000000000000000 --- a/0124-net-hns3-remove-redundant-mailbox-response.patch +++ /dev/null @@ -1,58 +0,0 @@ -From 9450e23dc1f006db7bcc28b7452a838a171453a2 Mon Sep 17 00:00:00 2001 -From: Huisong Li -Date: Sat, 17 Apr 2021 17:54:55 +0800 -Subject: [PATCH 124/189] net/hns3: remove redundant mailbox response - -Some mbx messages do not need to reply with data. In this case, -it is no need to set the response data address and the response -length. - -This patch removes these redundant codes from mbx messages that do -not need be replied. - -Fixes: a5475d61fa34 ("net/hns3: support VF") -Cc: stable@dpdk.org - -Signed-off-by: Huisong Li -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_ethdev_vf.c | 6 ++---- - 1 file changed, 2 insertions(+), 4 deletions(-) - -diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c -index 16cc111..a4577de 100644 ---- a/drivers/net/hns3/hns3_ethdev_vf.c -+++ b/drivers/net/hns3/hns3_ethdev_vf.c -@@ -1511,7 +1511,6 @@ static void - hns3vf_request_link_info(struct hns3_hw *hw) - { - struct hns3_vf *vf = HNS3_DEV_HW_TO_VF(hw); -- uint8_t resp_msg; - bool send_req; - int ret; - -@@ -1524,7 +1523,7 @@ hns3vf_request_link_info(struct hns3_hw *hw) - return; - - ret = hns3_send_mbx_msg(hw, HNS3_MBX_GET_LINK_STATUS, 0, NULL, 0, false, -- &resp_msg, sizeof(resp_msg)); -+ NULL, 0); - if (ret) { - hns3_err(hw, "failed to fetch link status, ret = %d", ret); - return; -@@ -1756,11 +1755,10 @@ hns3vf_keep_alive_handler(void *param) - struct rte_eth_dev *eth_dev = (struct rte_eth_dev *)param; - struct hns3_adapter *hns = eth_dev->data->dev_private; - struct hns3_hw *hw = &hns->hw; -- uint8_t respmsg; - int ret; - - ret = hns3_send_mbx_msg(hw, HNS3_MBX_KEEP_ALIVE, 0, NULL, 0, -- false, &respmsg, sizeof(uint8_t)); -+ false, NULL, 0); - if (ret) - hns3_err(hw, "VF sends keeping alive cmd failed(=%d)", - ret); --- -2.7.4 - diff --git a/0124-reinit-support-return-ok.patch b/0124-reinit-support-return-ok.patch new file mode 100644 index 0000000000000000000000000000000000000000..5105741c734d7313fd80fc8abd3a5662c4e83da4 --- /dev/null +++ b/0124-reinit-support-return-ok.patch @@ -0,0 +1,40 @@ +From 12a22b874a4852996dcec56ae30c7a17551bfeeb Mon Sep 17 00:00:00 2001 +From: wuchangsheng +Date: Thu, 6 Oct 2022 16:35:16 +0800 +Subject: [PATCH] reinit support return ok + +--- + lib/eal/linux/eal.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/lib/eal/linux/eal.c b/lib/eal/linux/eal.c +index 7ca8bb2..fc2a7fd 100644 +--- a/lib/eal/linux/eal.c ++++ b/lib/eal/linux/eal.c +@@ -1055,6 +1055,7 @@ rte_eal_init(int argc, char **argv) + int i, fctret, ret; + pthread_t thread_id; + static uint32_t run_once; ++ static uint32_t reinit_ok = 0; + uint32_t has_run = 0; + const char *p; + static char logid[PATH_MAX]; +@@ -1072,8 +1073,15 @@ rte_eal_init(int argc, char **argv) + return -1; + } + ++ if (argc > 1 && !strncmp(argv[1], "reinit-ok", strlen("reinit-ok"))) { ++ reinit_ok = 1; ++ } ++ + if (!__atomic_compare_exchange_n(&run_once, &has_run, 1, 0, + __ATOMIC_RELAXED, __ATOMIC_RELAXED)) { ++ if (reinit_ok) { ++ return 0; ++ } + rte_eal_init_alert("already called initialization."); + rte_errno = EALREADY; + return -1; +-- +2.27.0 + diff --git a/0125-net-hns3-fix-DCB-mode-check.patch b/0125-net-hns3-fix-DCB-mode-check.patch deleted file mode 100644 index 39008245a764e18d07811f50069bb484defce24e..0000000000000000000000000000000000000000 --- a/0125-net-hns3-fix-DCB-mode-check.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 276b4938cbe55ec5deba5d140a6a53f46ea4f399 Mon Sep 17 00:00:00 2001 -From: Huisong Li -Date: Sat, 17 Apr 2021 17:54:56 +0800 -Subject: [PATCH 125/189] net/hns3: fix DCB mode check - -Currently, "ONLY DCB" and "DCB+RSS" mode are both supported by HNS3 -PF driver. But the driver verifies only the "DCB+RSS" multiple queues -mode. - -Fixes: 62e3ccc2b94c ("net/hns3: support flow control") -Cc: stable@dpdk.org - -Signed-off-by: Huisong Li -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_ethdev.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c -index c75aa9c..7492708 100644 ---- a/drivers/net/hns3/hns3_ethdev.c -+++ b/drivers/net/hns3/hns3_ethdev.c -@@ -2239,7 +2239,7 @@ hns3_check_mq_mode(struct rte_eth_dev *dev) - return -EINVAL; - } - -- if (rx_mq_mode == ETH_MQ_RX_DCB_RSS) { -+ if (rx_mq_mode & ETH_MQ_RX_DCB_FLAG) { - if (dcb_rx_conf->nb_tcs > pf->tc_max) { - hns3_err(hw, "nb_tcs(%u) > max_tc(%u) driver supported.", - dcb_rx_conf->nb_tcs, pf->tc_max); --- -2.7.4 - diff --git a/0125-net-hns3-fix-link-status-capability-query-from-VF.patch b/0125-net-hns3-fix-link-status-capability-query-from-VF.patch new file mode 100644 index 0000000000000000000000000000000000000000..8ce11a5e66d37c660bbd77dcc9e0881f38b6405e --- /dev/null +++ b/0125-net-hns3-fix-link-status-capability-query-from-VF.patch @@ -0,0 +1,52 @@ +From fe5e02e38e96e0b6ac33fd56a0f0b8cbad30b66f Mon Sep 17 00:00:00 2001 +From: Huisong Li +Date: Fri, 21 Oct 2022 15:36:01 +0800 +Subject: [PATCH 125/189] net/hns3: fix link status capability query from VF + +Currently, the VF LSC capability is obtained from PF driver in +the interrupt mailbox interrupt thread, it is asynchronous. +The VF driver waits for 500ms to get this capability in probe +process. + +The primary process will receive a message and do probe in the +interrupt thread context when attach a device in the secondary +process. At this case, VF driver never obtains this capability +from PF. + +The root cause is that 'vf->pf_push_lsc_cap' is not updated by +the handling mailbox thread until finishing probe. The reason +this update wouldn't be done is that the handling mailbox interrupt +thread and the probe alarm thread are both in epool thread, and +the probe alarm thread is before the mailbox interrupt thread. + +Fixes: 9bc2289fe5ea ("net/hns3: refactor VF LSC event report") +Cc: stable@dpdk.org + +Signed-off-by: Huisong Li +Signed-off-by: Dongdong Liu +--- + drivers/net/hns3/hns3_ethdev_vf.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c +index 7323e47f15..b85f68cb1d 100644 +--- a/drivers/net/hns3/hns3_ethdev_vf.c ++++ b/drivers/net/hns3/hns3_ethdev_vf.c +@@ -778,6 +778,14 @@ hns3vf_get_push_lsc_cap(struct hns3_hw *hw) + + while (remain_ms > 0) { + rte_delay_ms(HNS3_POLL_RESPONE_MS); ++ /* ++ * The probe process may perform in interrupt thread context. ++ * For example, users attach a device in the secondary process. ++ * At the moment, the handling mailbox task will be blocked. So ++ * driver has to actively handle the HNS3_MBX_LINK_STAT_CHANGE ++ * mailbox from PF driver to get this capability. ++ */ ++ hns3_dev_handle_mbx_msg(hw); + if (__atomic_load_n(&vf->pf_push_lsc_cap, __ATOMIC_ACQUIRE) != + HNS3_PF_PUSH_LSC_CAP_UNKNOWN) + break; +-- +2.23.0 + diff --git a/0126-net-hns3-fix-VMDq-mode-check.patch b/0126-net-hns3-fix-VMDq-mode-check.patch deleted file mode 100644 index ac449681b1d476bc2ac7c575de1748689bb9ba7b..0000000000000000000000000000000000000000 --- a/0126-net-hns3-fix-VMDq-mode-check.patch +++ /dev/null @@ -1,77 +0,0 @@ -From 8732064d03a6d0f46f3120549b31f97990aa81ce Mon Sep 17 00:00:00 2001 -From: Huisong Li -Date: Sat, 17 Apr 2021 17:54:57 +0800 -Subject: [PATCH 126/189] net/hns3: fix VMDq mode check - -HNS3 PF driver only supports RSS, DCB or NONE multiple queues mode. -Currently, driver doesn't verify the VMDq multi-queue mode completely. -This patch fixes the verification for VMDq mode. - -Fixes: 62e3ccc2b94c ("net/hns3: support flow control") -Cc: stable@dpdk.org - -Signed-off-by: Huisong Li -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_ethdev.c | 28 ++++++++++++---------------- - 1 file changed, 12 insertions(+), 16 deletions(-) - -diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c -index 7492708..4d63d12 100644 ---- a/drivers/net/hns3/hns3_ethdev.c -+++ b/drivers/net/hns3/hns3_ethdev.c -@@ -2222,23 +2222,16 @@ hns3_check_mq_mode(struct rte_eth_dev *dev) - int max_tc = 0; - int i; - -- dcb_rx_conf = &dev->data->dev_conf.rx_adv_conf.dcb_rx_conf; -- dcb_tx_conf = &dev->data->dev_conf.tx_adv_conf.dcb_tx_conf; -- -- if (rx_mq_mode == ETH_MQ_RX_VMDQ_DCB_RSS) { -- hns3_err(hw, "ETH_MQ_RX_VMDQ_DCB_RSS is not supported. " -- "rx_mq_mode = %d", rx_mq_mode); -- return -EINVAL; -- } -- -- if (rx_mq_mode == ETH_MQ_RX_VMDQ_DCB || -- tx_mq_mode == ETH_MQ_TX_VMDQ_DCB) { -- hns3_err(hw, "ETH_MQ_RX_VMDQ_DCB and ETH_MQ_TX_VMDQ_DCB " -- "is not supported. rx_mq_mode = %d, tx_mq_mode = %d", -+ if ((rx_mq_mode & ETH_MQ_RX_VMDQ_FLAG) || -+ (tx_mq_mode == ETH_MQ_TX_VMDQ_DCB || -+ tx_mq_mode == ETH_MQ_TX_VMDQ_ONLY)) { -+ hns3_err(hw, "VMDQ is not supported, rx_mq_mode = %d, tx_mq_mode = %d.", - rx_mq_mode, tx_mq_mode); -- return -EINVAL; -+ return -EOPNOTSUPP; - } - -+ dcb_rx_conf = &dev->data->dev_conf.rx_adv_conf.dcb_rx_conf; -+ dcb_tx_conf = &dev->data->dev_conf.tx_adv_conf.dcb_tx_conf; - if (rx_mq_mode & ETH_MQ_RX_DCB_FLAG) { - if (dcb_rx_conf->nb_tcs > pf->tc_max) { - hns3_err(hw, "nb_tcs(%u) > max_tc(%u) driver supported.", -@@ -2297,8 +2290,7 @@ hns3_check_dcb_cfg(struct rte_eth_dev *dev) - return -EOPNOTSUPP; - } - -- /* Check multiple queue mode */ -- return hns3_check_mq_mode(dev); -+ return 0; - } - - static int -@@ -2471,6 +2463,10 @@ hns3_dev_configure(struct rte_eth_dev *dev) - } - - hw->adapter_state = HNS3_NIC_CONFIGURING; -+ ret = hns3_check_mq_mode(dev); -+ if (ret) -+ goto cfg_err; -+ - if ((uint32_t)mq_mode & ETH_MQ_RX_DCB_FLAG) { - ret = hns3_check_dcb_cfg(dev); - if (ret) --- -2.7.4 - diff --git a/0126-net-hns3-support-backplane-media-type.patch b/0126-net-hns3-support-backplane-media-type.patch new file mode 100644 index 0000000000000000000000000000000000000000..1b9564cfe69130eb919f89ffd29b7e278b8bd540 --- /dev/null +++ b/0126-net-hns3-support-backplane-media-type.patch @@ -0,0 +1,131 @@ +From 0e4f6eceec1c0cd0cae67504b90eb6a4f0451307 Mon Sep 17 00:00:00 2001 +From: Chengwen Feng +Date: Fri, 21 Oct 2022 15:36:02 +0800 +Subject: [PATCH 126/189] net/hns3: support backplane media type + +The 802.11 physical PMA sub-layer defines three media: copper, fiber and +backplane. For PMD, the backplane is similar to the fiber, the main +differences are that backplane doesn't have optical module. + +Because the interface of firmware fiber is also applicable to the +backplane, this patch supports the backplane only through simple +extension. + +Cc: stable@dpdk.org + +Signed-off-by: Chengwen Feng +Signed-off-by: Dongdong Liu +--- + drivers/net/hns3/hns3_ethdev.c | 54 +++++++++++++++++++--------------- + 1 file changed, 30 insertions(+), 24 deletions(-) + +diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c +index 8a8f3f1950..5632b82078 100644 +--- a/drivers/net/hns3/hns3_ethdev.c ++++ b/drivers/net/hns3/hns3_ethdev.c +@@ -2788,11 +2788,8 @@ hns3_check_media_type(struct hns3_hw *hw, uint8_t media_type) + } + break; + case HNS3_MEDIA_TYPE_FIBER: +- ret = 0; +- break; + case HNS3_MEDIA_TYPE_BACKPLANE: +- PMD_INIT_LOG(ERR, "Media type is Backplane, not supported."); +- ret = -EOPNOTSUPP; ++ ret = 0; + break; + default: + PMD_INIT_LOG(ERR, "Unknown media type = %u!", media_type); +@@ -4245,14 +4242,11 @@ hns3_update_link_info(struct rte_eth_dev *eth_dev) + { + struct hns3_adapter *hns = eth_dev->data->dev_private; + struct hns3_hw *hw = &hns->hw; +- int ret = 0; + + if (hw->mac.media_type == HNS3_MEDIA_TYPE_COPPER) +- ret = hns3_update_copper_link_info(hw); +- else if (hw->mac.media_type == HNS3_MEDIA_TYPE_FIBER) +- ret = hns3_update_fiber_link_info(hw); ++ return hns3_update_copper_link_info(hw); + +- return ret; ++ return hns3_update_fiber_link_info(hw); + } + + static int +@@ -4545,11 +4539,13 @@ hns3_get_port_supported_speed(struct rte_eth_dev *eth_dev) + if (ret) + return ret; + +- if (mac->media_type == HNS3_MEDIA_TYPE_FIBER) { ++ if (mac->media_type == HNS3_MEDIA_TYPE_FIBER || ++ mac->media_type == HNS3_MEDIA_TYPE_BACKPLANE) { + /* + * Some firmware does not support the report of supported_speed, +- * and only report the effective speed of SFP. In this case, it +- * is necessary to use the SFP's speed as the supported_speed. ++ * and only report the effective speed of SFP/backplane. In this ++ * case, it is necessary to use the SFP/backplane's speed as the ++ * supported_speed. + */ + if (mac->supported_speed == 0) + mac->supported_speed = +@@ -4811,7 +4807,7 @@ hns3_check_port_speed(struct hns3_hw *hw, uint32_t link_speeds) + + if (mac->media_type == HNS3_MEDIA_TYPE_COPPER) + speed_bit = hns3_convert_link_speeds2bitmap_copper(link_speeds); +- else if (mac->media_type == HNS3_MEDIA_TYPE_FIBER) ++ else + speed_bit = hns3_convert_link_speeds2bitmap_fiber(link_speeds); + + if (!(speed_bit & supported_speed)) { +@@ -4955,6 +4951,19 @@ hns3_set_fiber_port_link_speed(struct hns3_hw *hw, + return hns3_cfg_mac_speed_dup(hw, cfg->speed, cfg->duplex); + } + ++static const char * ++hns3_get_media_type_name(uint8_t media_type) ++{ ++ if (media_type == HNS3_MEDIA_TYPE_FIBER) ++ return "fiber"; ++ else if (media_type == HNS3_MEDIA_TYPE_COPPER) ++ return "copper"; ++ else if (media_type == HNS3_MEDIA_TYPE_BACKPLANE) ++ return "backplane"; ++ else ++ return "unknown"; ++} ++ + static int + hns3_set_port_link_speed(struct hns3_hw *hw, + struct hns3_set_link_speed_cfg *cfg) +@@ -4969,18 +4978,15 @@ hns3_set_port_link_speed(struct hns3_hw *hw, + #endif + + ret = hns3_set_copper_port_link_speed(hw, cfg); +- if (ret) { +- hns3_err(hw, "failed to set copper port link speed," +- "ret = %d.", ret); +- return ret; +- } +- } else if (hw->mac.media_type == HNS3_MEDIA_TYPE_FIBER) { ++ } else { + ret = hns3_set_fiber_port_link_speed(hw, cfg); +- if (ret) { +- hns3_err(hw, "failed to set fiber port link speed," +- "ret = %d.", ret); +- return ret; +- } ++ } ++ ++ if (ret) { ++ hns3_err(hw, "failed to set %s port link speed, ret = %d.", ++ hns3_get_media_type_name(hw->mac.media_type), ++ ret); ++ return ret; + } + + return 0; +-- +2.23.0 + diff --git a/0127-net-hns3-cancel-heartbeat-alarm-when-VF-reset.patch b/0127-net-hns3-cancel-heartbeat-alarm-when-VF-reset.patch new file mode 100644 index 0000000000000000000000000000000000000000..80022d07e2ddf237f7f0002c4e1955e2e0687619 --- /dev/null +++ b/0127-net-hns3-cancel-heartbeat-alarm-when-VF-reset.patch @@ -0,0 +1,46 @@ +From 9a640a6c9cfbf7b5dea307209dc6f20cbfc871c0 Mon Sep 17 00:00:00 2001 +From: Huisong Li +Date: Fri, 21 Oct 2022 15:36:03 +0800 +Subject: [PATCH 127/189] net/hns3: cancel heartbeat alarm when VF reset + +The purpose of the heartbeat alarm is to keep alive for VF. The mailbox +channel is disabled when VF is reset, and the heartbeat mailbox message +will fail to send. If the reset is not complete, the error information +about the heartbeat sending failure will be printed continuously. +In fact, VF does set alive when VF restore its configuration. So the +heartbeat alarm can be canceled to prepare to start reset and start the +alarm when start service. + +Signed-off-by: Huisong Li +Signed-off-by: Dongdong Liu +--- + drivers/net/hns3/hns3_ethdev_vf.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c +index b85f68cb1d..0dea63e8be 100644 +--- a/drivers/net/hns3/hns3_ethdev_vf.c ++++ b/drivers/net/hns3/hns3_ethdev_vf.c +@@ -1977,6 +1977,8 @@ hns3vf_stop_service(struct hns3_adapter *hns) + } else + hw->reset.mbuf_deferred_free = false; + ++ rte_eal_alarm_cancel(hns3vf_keep_alive_handler, eth_dev); ++ + /* + * It is cumbersome for hardware to pick-and-choose entries for deletion + * from table space. Hence, for function reset software intervention is +@@ -1998,6 +2000,10 @@ hns3vf_start_service(struct hns3_adapter *hns) + eth_dev = &rte_eth_devices[hw->data->port_id]; + hns3_set_rxtx_function(eth_dev); + hns3_mp_req_start_rxtx(eth_dev); ++ ++ rte_eal_alarm_set(HNS3VF_KEEP_ALIVE_INTERVAL, hns3vf_keep_alive_handler, ++ eth_dev); ++ + if (hw->adapter_state == HNS3_NIC_STARTED) { + hns3vf_start_poll_job(eth_dev); + +-- +2.23.0 + diff --git a/0127-net-hns3-fix-flow-director-lock.patch b/0127-net-hns3-fix-flow-director-lock.patch deleted file mode 100644 index c2d75c6ee46a1ebd20e107230d8e778a7980ebf0..0000000000000000000000000000000000000000 --- a/0127-net-hns3-fix-flow-director-lock.patch +++ /dev/null @@ -1,350 +0,0 @@ -From bdd72afbcc9fbd25812b4ba873875eca26f14b4b Mon Sep 17 00:00:00 2001 -From: Chengwen Feng -Date: Sat, 17 Apr 2021 17:54:58 +0800 -Subject: [PATCH 127/189] net/hns3: fix flow director lock - -Currently, the fdir lock was used to protect concurrent access in -multiple processes, it has the following problems: -1) Lack of protection for fdir reset recover. -2) Only part of data is protected, eg. the filterlist is not protected. - -We use the following scheme: -1) Del the fdir lock. -2) Add a flow lock and provides rte flow driver ops API-level - protection. -3) Declare support RTE_ETH_DEV_FLOW_OPS_THREAD_SAFE. - -Fixes: fcba820d9b9e ("net/hns3: support flow director") -Cc: stable@dpdk.org - -Signed-off-by: Chengwen Feng -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_ethdev.c | 4 +- - drivers/net/hns3/hns3_ethdev.h | 4 ++ - drivers/net/hns3/hns3_ethdev_vf.c | 3 +- - drivers/net/hns3/hns3_fdir.c | 28 ++++++------ - drivers/net/hns3/hns3_fdir.h | 3 +- - drivers/net/hns3/hns3_flow.c | 96 ++++++++++++++++++++++++++++++++++++--- - 6 files changed, 111 insertions(+), 27 deletions(-) - -diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c -index 4d63d12..ccafe60 100644 ---- a/drivers/net/hns3/hns3_ethdev.c -+++ b/drivers/net/hns3/hns3_ethdev.c -@@ -7356,8 +7356,8 @@ hns3_dev_init(struct rte_eth_dev *eth_dev) - PMD_INIT_LOG(ERR, "Failed to alloc memory for process private"); - return -ENOMEM; - } -- /* initialize flow filter lists */ -- hns3_filterlist_init(eth_dev); -+ -+ hns3_flow_init(eth_dev); - - hns3_set_rxtx_function(eth_dev); - eth_dev->dev_ops = &hns3_eth_dev_ops; -diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h -index 271eadb..8191c53 100644 ---- a/drivers/net/hns3/hns3_ethdev.h -+++ b/drivers/net/hns3/hns3_ethdev.h -@@ -5,6 +5,7 @@ - #ifndef _HNS3_ETHDEV_H_ - #define _HNS3_ETHDEV_H_ - -+#include - #include - #include - #include -@@ -624,6 +625,9 @@ struct hns3_hw { - uint8_t udp_cksum_mode; - - struct hns3_port_base_vlan_config port_base_vlan_cfg; -+ -+ pthread_mutex_t flows_lock; /* rte_flow ops lock */ -+ - /* - * PMD setup and configuration is not thread safe. Since it is not - * performance sensitive, it is better to guarantee thread-safety -diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c -index a4577de..a278146 100644 ---- a/drivers/net/hns3/hns3_ethdev_vf.c -+++ b/drivers/net/hns3/hns3_ethdev_vf.c -@@ -2911,8 +2911,7 @@ hns3vf_dev_init(struct rte_eth_dev *eth_dev) - return -ENOMEM; - } - -- /* initialize flow filter lists */ -- hns3_filterlist_init(eth_dev); -+ hns3_flow_init(eth_dev); - - hns3_set_rxtx_function(eth_dev); - eth_dev->dev_ops = &hns3vf_eth_dev_ops; -diff --git a/drivers/net/hns3/hns3_fdir.c b/drivers/net/hns3/hns3_fdir.c -index 857cc94..06c9a94 100644 ---- a/drivers/net/hns3/hns3_fdir.c -+++ b/drivers/net/hns3/hns3_fdir.c -@@ -830,7 +830,6 @@ int hns3_fdir_filter_init(struct hns3_adapter *hns) - - fdir_hash_params.socket_id = rte_socket_id(); - TAILQ_INIT(&fdir_info->fdir_list); -- rte_spinlock_init(&fdir_info->flows_lock); - snprintf(fdir_hash_name, RTE_HASH_NAMESIZE, "%s", hns->hw.data->name); - fdir_info->hash_handle = rte_hash_create(&fdir_hash_params); - if (fdir_info->hash_handle == NULL) { -@@ -856,7 +855,6 @@ void hns3_fdir_filter_uninit(struct hns3_adapter *hns) - struct hns3_fdir_info *fdir_info = &pf->fdir; - struct hns3_fdir_rule_ele *fdir_filter; - -- rte_spinlock_lock(&fdir_info->flows_lock); - if (fdir_info->hash_map) { - rte_free(fdir_info->hash_map); - fdir_info->hash_map = NULL; -@@ -865,7 +863,6 @@ void hns3_fdir_filter_uninit(struct hns3_adapter *hns) - rte_hash_free(fdir_info->hash_handle); - fdir_info->hash_handle = NULL; - } -- rte_spinlock_unlock(&fdir_info->flows_lock); - - fdir_filter = TAILQ_FIRST(&fdir_info->fdir_list); - while (fdir_filter) { -@@ -891,10 +888,8 @@ static int hns3_fdir_filter_lookup(struct hns3_fdir_info *fdir_info, - hash_sig_t sig; - int ret; - -- rte_spinlock_lock(&fdir_info->flows_lock); - sig = rte_hash_crc(key, sizeof(*key), 0); - ret = rte_hash_lookup_with_hash(fdir_info->hash_handle, key, sig); -- rte_spinlock_unlock(&fdir_info->flows_lock); - - return ret; - } -@@ -908,11 +903,9 @@ static int hns3_insert_fdir_filter(struct hns3_hw *hw, - int ret; - - key = &fdir_filter->fdir_conf.key_conf; -- rte_spinlock_lock(&fdir_info->flows_lock); - sig = rte_hash_crc(key, sizeof(*key), 0); - ret = rte_hash_add_key_with_hash(fdir_info->hash_handle, key, sig); - if (ret < 0) { -- rte_spinlock_unlock(&fdir_info->flows_lock); - hns3_err(hw, "Hash table full? err:%d(%s)!", ret, - strerror(-ret)); - return ret; -@@ -920,7 +913,6 @@ static int hns3_insert_fdir_filter(struct hns3_hw *hw, - - fdir_info->hash_map[ret] = fdir_filter; - TAILQ_INSERT_TAIL(&fdir_info->fdir_list, fdir_filter, entries); -- rte_spinlock_unlock(&fdir_info->flows_lock); - - return ret; - } -@@ -933,11 +925,9 @@ static int hns3_remove_fdir_filter(struct hns3_hw *hw, - hash_sig_t sig; - int ret; - -- rte_spinlock_lock(&fdir_info->flows_lock); - sig = rte_hash_crc(key, sizeof(*key), 0); - ret = rte_hash_del_key_with_hash(fdir_info->hash_handle, key, sig); - if (ret < 0) { -- rte_spinlock_unlock(&fdir_info->flows_lock); - hns3_err(hw, "Delete hash key fail ret=%d", ret); - return ret; - } -@@ -945,7 +935,6 @@ static int hns3_remove_fdir_filter(struct hns3_hw *hw, - fdir_filter = fdir_info->hash_map[ret]; - fdir_info->hash_map[ret] = NULL; - TAILQ_REMOVE(&fdir_info->fdir_list, fdir_filter, entries); -- rte_spinlock_unlock(&fdir_info->flows_lock); - - rte_free(fdir_filter); - -@@ -1000,11 +989,9 @@ int hns3_fdir_filter_program(struct hns3_adapter *hns, - rule->location = ret; - node->fdir_conf.location = ret; - -- rte_spinlock_lock(&fdir_info->flows_lock); - ret = hns3_config_action(hw, rule); - if (!ret) - ret = hns3_config_key(hns, rule); -- rte_spinlock_unlock(&fdir_info->flows_lock); - if (ret) { - hns3_err(hw, "Failed to config fdir: %u src_ip:%x dst_ip:%x " - "src_port:%u dst_port:%u ret = %d", -@@ -1029,9 +1016,7 @@ int hns3_clear_all_fdir_filter(struct hns3_adapter *hns) - int ret = 0; - - /* flush flow director */ -- rte_spinlock_lock(&fdir_info->flows_lock); - rte_hash_reset(fdir_info->hash_handle); -- rte_spinlock_unlock(&fdir_info->flows_lock); - - fdir_filter = TAILQ_FIRST(&fdir_info->fdir_list); - while (fdir_filter) { -@@ -1059,6 +1044,17 @@ int hns3_restore_all_fdir_filter(struct hns3_adapter *hns) - bool err = false; - int ret; - -+ /* -+ * This API is called in the reset recovery process, the parent function -+ * must hold hw->lock. -+ * There maybe deadlock if acquire hw->flows_lock directly because rte -+ * flow driver ops first acquire hw->flows_lock and then may acquire -+ * hw->lock. -+ * So here first release the hw->lock and then acquire the -+ * hw->flows_lock to avoid deadlock. -+ */ -+ rte_spinlock_unlock(&hw->lock); -+ pthread_mutex_lock(&hw->flows_lock); - TAILQ_FOREACH(fdir_filter, &fdir_info->fdir_list, entries) { - ret = hns3_config_action(hw, &fdir_filter->fdir_conf); - if (!ret) -@@ -1069,6 +1065,8 @@ int hns3_restore_all_fdir_filter(struct hns3_adapter *hns) - break; - } - } -+ pthread_mutex_unlock(&hw->flows_lock); -+ rte_spinlock_lock(&hw->lock); - - if (err) { - hns3_err(hw, "Fail to restore FDIR filter, ret = %d", ret); -diff --git a/drivers/net/hns3/hns3_fdir.h b/drivers/net/hns3/hns3_fdir.h -index a5760a3..d64af85 100644 ---- a/drivers/net/hns3/hns3_fdir.h -+++ b/drivers/net/hns3/hns3_fdir.h -@@ -199,7 +199,6 @@ struct hns3_process_private { - * A structure used to define fields of a FDIR related info. - */ - struct hns3_fdir_info { -- rte_spinlock_t flows_lock; - struct hns3_fdir_rule_list fdir_list; - struct hns3_fdir_rule_ele **hash_map; - struct rte_hash *hash_handle; -@@ -220,7 +219,7 @@ int hns3_fdir_filter_program(struct hns3_adapter *hns, - struct hns3_fdir_rule *rule, bool del); - int hns3_clear_all_fdir_filter(struct hns3_adapter *hns); - int hns3_get_count(struct hns3_hw *hw, uint32_t id, uint64_t *value); --void hns3_filterlist_init(struct rte_eth_dev *dev); -+void hns3_flow_init(struct rte_eth_dev *dev); - int hns3_restore_all_fdir_filter(struct hns3_adapter *hns); - - #endif /* _HNS3_FDIR_H_ */ -diff --git a/drivers/net/hns3/hns3_flow.c b/drivers/net/hns3/hns3_flow.c -index 3cca416..c07929f 100644 ---- a/drivers/net/hns3/hns3_flow.c -+++ b/drivers/net/hns3/hns3_flow.c -@@ -1214,9 +1214,18 @@ hns3_parse_fdir_filter(struct rte_eth_dev *dev, - } - - void --hns3_filterlist_init(struct rte_eth_dev *dev) -+hns3_flow_init(struct rte_eth_dev *dev) - { -+ struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private); - struct hns3_process_private *process_list = dev->process_private; -+ pthread_mutexattr_t attr; -+ -+ if (rte_eal_process_type() == RTE_PROC_PRIMARY) { -+ pthread_mutexattr_init(&attr); -+ pthread_mutexattr_setpshared(&attr, PTHREAD_PROCESS_SHARED); -+ pthread_mutex_init(&hw->flows_lock, &attr); -+ dev->data->dev_flags |= RTE_ETH_DEV_FLOW_OPS_THREAD_SAFE; -+ } - - TAILQ_INIT(&process_list->fdir_list); - TAILQ_INIT(&process_list->filter_rss_list); -@@ -2002,12 +2011,87 @@ hns3_flow_query(struct rte_eth_dev *dev, struct rte_flow *flow, - return 0; - } - -+static int -+hns3_flow_validate_wrap(struct rte_eth_dev *dev, -+ const struct rte_flow_attr *attr, -+ const struct rte_flow_item pattern[], -+ const struct rte_flow_action actions[], -+ struct rte_flow_error *error) -+{ -+ struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private); -+ int ret; -+ -+ pthread_mutex_lock(&hw->flows_lock); -+ ret = hns3_flow_validate(dev, attr, pattern, actions, error); -+ pthread_mutex_unlock(&hw->flows_lock); -+ -+ return ret; -+} -+ -+static struct rte_flow * -+hns3_flow_create_wrap(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, -+ const struct rte_flow_item pattern[], -+ const struct rte_flow_action actions[], -+ struct rte_flow_error *error) -+{ -+ struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private); -+ struct rte_flow *flow; -+ -+ pthread_mutex_lock(&hw->flows_lock); -+ flow = hns3_flow_create(dev, attr, pattern, actions, error); -+ pthread_mutex_unlock(&hw->flows_lock); -+ -+ return flow; -+} -+ -+static int -+hns3_flow_destroy_wrap(struct rte_eth_dev *dev, struct rte_flow *flow, -+ struct rte_flow_error *error) -+{ -+ struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private); -+ int ret; -+ -+ pthread_mutex_lock(&hw->flows_lock); -+ ret = hns3_flow_destroy(dev, flow, error); -+ pthread_mutex_unlock(&hw->flows_lock); -+ -+ return ret; -+} -+ -+static int -+hns3_flow_flush_wrap(struct rte_eth_dev *dev, struct rte_flow_error *error) -+{ -+ struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private); -+ int ret; -+ -+ pthread_mutex_lock(&hw->flows_lock); -+ ret = hns3_flow_flush(dev, error); -+ pthread_mutex_unlock(&hw->flows_lock); -+ -+ return ret; -+} -+ -+static int -+hns3_flow_query_wrap(struct rte_eth_dev *dev, struct rte_flow *flow, -+ const struct rte_flow_action *actions, void *data, -+ struct rte_flow_error *error) -+{ -+ struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private); -+ int ret; -+ -+ pthread_mutex_lock(&hw->flows_lock); -+ ret = hns3_flow_query(dev, flow, actions, data, error); -+ pthread_mutex_unlock(&hw->flows_lock); -+ -+ return ret; -+} -+ - static const struct rte_flow_ops hns3_flow_ops = { -- .validate = hns3_flow_validate, -- .create = hns3_flow_create, -- .destroy = hns3_flow_destroy, -- .flush = hns3_flow_flush, -- .query = hns3_flow_query, -+ .validate = hns3_flow_validate_wrap, -+ .create = hns3_flow_create_wrap, -+ .destroy = hns3_flow_destroy_wrap, -+ .flush = hns3_flow_flush_wrap, -+ .query = hns3_flow_query_wrap, - .isolate = NULL, - }; - --- -2.7.4 - diff --git a/0128-net-hns3-fix-PTP-interrupt-logging.patch b/0128-net-hns3-fix-PTP-interrupt-logging.patch new file mode 100644 index 0000000000000000000000000000000000000000..fd02fb72ab734b4ffffaac28ca6b7fec2f3428a5 --- /dev/null +++ b/0128-net-hns3-fix-PTP-interrupt-logging.patch @@ -0,0 +1,35 @@ +From f4039f8c809b290e1031023c6dc680af7e8dbe11 Mon Sep 17 00:00:00 2001 +From: Huisong Li +Date: Fri, 21 Oct 2022 15:36:04 +0800 +Subject: [PATCH 128/189] net/hns3: fix PTP interrupt logging + +PMD driver will receive a PTP interrupt when receive a PTP packet. +But driver doesn't distinguish it. As a result, many unknown events +are printed when many PTP packets are received on the link. The PTP +interrupt is normal, so this patch doesn't log and ignores it. + +Fixes: 38b539d96eb6 ("net/hns3: support IEEE 1588 PTP") +Cc: stable@dpdk.org + +Signed-off-by: Huisong Li +Signed-off-by: Dongdong Liu +--- + drivers/net/hns3/hns3_ethdev.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c +index 5632b82078..7c9938b96e 100644 +--- a/drivers/net/hns3/hns3_ethdev.c ++++ b/drivers/net/hns3/hns3_ethdev.c +@@ -318,7 +318,7 @@ hns3_interrupt_handler(void *param) + hns3_schedule_reset(hns); + } else if (event_cause == HNS3_VECTOR0_EVENT_MBX) { + hns3_dev_handle_mbx_msg(hw); +- } else { ++ } else if (event_cause != HNS3_VECTOR0_EVENT_PTP) { + hns3_warn(hw, "received unknown event: vector0_int_stat:0x%x " + "ras_int_stat:0x%x cmdq_int_stat:0x%x", + vector0_int, ras_int, cmdq_int); +-- +2.23.0 + diff --git a/0128-net-hns3-move-link-speeds-check-to-configure.patch b/0128-net-hns3-move-link-speeds-check-to-configure.patch deleted file mode 100644 index 32d25486bdb2dde88435b7361690a227175a5c50..0000000000000000000000000000000000000000 --- a/0128-net-hns3-move-link-speeds-check-to-configure.patch +++ /dev/null @@ -1,124 +0,0 @@ -From 96ea5f9a0b53ec1f701d3aec5342cd363871bb15 Mon Sep 17 00:00:00 2001 -From: Huisong Li -Date: Sat, 17 Apr 2021 17:54:59 +0800 -Subject: [PATCH 128/189] net/hns3: move link speeds check to configure - -This patch moves the check for "link_speeds" in dev_conf to -dev_configure, so that users know whether "link_speeds" is valid in -advance. - -Fixes: bdaf190f8235 ("net/hns3: support link speed autoneg for PF") -Fixes: 400d307e1a60 ("net/hns3: support fixed link speed") - -Signed-off-by: Huisong Li -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_ethdev.c | 57 +++++++++++++++++++++++++++++++++--------- - 1 file changed, 45 insertions(+), 12 deletions(-) - -diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c -index ccafe60..e2a96c1 100644 ---- a/drivers/net/hns3/hns3_ethdev.c -+++ b/drivers/net/hns3/hns3_ethdev.c -@@ -105,6 +105,7 @@ static int hns3_remove_mc_addr(struct hns3_hw *hw, - static int hns3_restore_fec(struct hns3_hw *hw); - static int hns3_query_dev_fec_info(struct hns3_hw *hw); - static int hns3_do_stop(struct hns3_adapter *hns); -+static int hns3_check_port_speed(struct hns3_hw *hw, uint32_t link_speeds); - - void hns3_ether_format_addr(char *buf, uint16_t size, - const struct rte_ether_addr *ether_addr) -@@ -2429,6 +2430,46 @@ hns3_refresh_mtu(struct rte_eth_dev *dev, struct rte_eth_conf *conf) - } - - static int -+hns3_check_link_speed(struct hns3_hw *hw, uint32_t link_speeds) -+{ -+ int ret; -+ -+ /* -+ * Some hardware doesn't support auto-negotiation, but users may not -+ * configure link_speeds (default 0), which means auto-negotiation. -+ * In this case, a warning message need to be printed, instead of -+ * an error. -+ */ -+ if (link_speeds == ETH_LINK_SPEED_AUTONEG && -+ hw->mac.support_autoneg == 0) { -+ hns3_warn(hw, "auto-negotiation is not supported, use default fixed speed!"); -+ return 0; -+ } -+ -+ if (link_speeds != ETH_LINK_SPEED_AUTONEG) { -+ ret = hns3_check_port_speed(hw, link_speeds); -+ if (ret) -+ return ret; -+ } -+ -+ return 0; -+} -+ -+static int -+hns3_check_dev_conf(struct rte_eth_dev *dev) -+{ -+ struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private); -+ struct rte_eth_conf *conf = &dev->data->dev_conf; -+ int ret; -+ -+ ret = hns3_check_mq_mode(dev); -+ if (ret) -+ return ret; -+ -+ return hns3_check_link_speed(hw, conf->link_speeds); -+} -+ -+static int - hns3_dev_configure(struct rte_eth_dev *dev) - { - struct hns3_adapter *hns = dev->data->dev_private; -@@ -2463,7 +2504,7 @@ hns3_dev_configure(struct rte_eth_dev *dev) - } - - hw->adapter_state = HNS3_NIC_CONFIGURING; -- ret = hns3_check_mq_mode(dev); -+ ret = hns3_check_dev_conf(dev); - if (ret) - goto cfg_err; - -@@ -5464,14 +5505,11 @@ hns3_set_fiber_port_link_speed(struct hns3_hw *hw, - - /* - * Some hardware doesn't support auto-negotiation, but users may not -- * configure link_speeds (default 0), which means auto-negotiation -- * In this case, a warning message need to be printed, instead of -- * an error. -+ * configure link_speeds (default 0), which means auto-negotiation. -+ * In this case, it should return success. - */ -- if (cfg->autoneg) { -- hns3_warn(hw, "auto-negotiation is not supported."); -+ if (cfg->autoneg) - return 0; -- } - - return hns3_cfg_mac_speed_dup(hw, cfg->speed, cfg->duplex); - } -@@ -5512,16 +5550,11 @@ hns3_apply_link_speed(struct hns3_hw *hw) - { - struct rte_eth_conf *conf = &hw->data->dev_conf; - struct hns3_set_link_speed_cfg cfg; -- int ret; - - memset(&cfg, 0, sizeof(struct hns3_set_link_speed_cfg)); - cfg.autoneg = (conf->link_speeds == ETH_LINK_SPEED_AUTONEG) ? - ETH_LINK_AUTONEG : ETH_LINK_FIXED; - if (cfg.autoneg != ETH_LINK_AUTONEG) { -- ret = hns3_check_port_speed(hw, conf->link_speeds); -- if (ret) -- return ret; -- - cfg.speed = hns3_get_link_speed(conf->link_speeds); - cfg.duplex = hns3_get_link_duplex(conf->link_speeds); - } --- -2.7.4 - diff --git a/0129-net-hns3-fix-statistics-locking.patch b/0129-net-hns3-fix-statistics-locking.patch new file mode 100644 index 0000000000000000000000000000000000000000..4c1349ff34b5ca711e3ce19a4de7fcb76d3394bc --- /dev/null +++ b/0129-net-hns3-fix-statistics-locking.patch @@ -0,0 +1,132 @@ +From 8626a054e516796e942019ce4a1e22d6d8fcd3ee Mon Sep 17 00:00:00 2001 +From: Huisong Li +Date: Fri, 21 Oct 2022 15:36:05 +0800 +Subject: [PATCH 129/189] net/hns3: fix statistics locking + +The stats_lock is used to protect statistics update in stats APIs and +periodic task, but current code only protect queue related statistics. + +Fixes: a65342d9d5d2 ("net/hns3: fix MAC and queues HW statistics overflow") +Cc: stable@dpdk.org + +Signed-off-by: Huisong Li +Signed-off-by: Dongdong Liu +--- + drivers/net/hns3/hns3_stats.c | 22 +++++++++------------- + 1 file changed, 9 insertions(+), 13 deletions(-) + +diff --git a/drivers/net/hns3/hns3_stats.c b/drivers/net/hns3/hns3_stats.c +index bf8af4531f..d56d3ec174 100644 +--- a/drivers/net/hns3/hns3_stats.c ++++ b/drivers/net/hns3/hns3_stats.c +@@ -629,6 +629,7 @@ hns3_stats_get(struct rte_eth_dev *eth_dev, struct rte_eth_stats *rte_stats) + uint16_t i; + int ret; + ++ rte_spinlock_lock(&hw->stats_lock); + /* Update imissed stats */ + ret = hns3_update_imissed_stats(hw, false); + if (ret) { +@@ -644,10 +645,7 @@ hns3_stats_get(struct rte_eth_dev *eth_dev, struct rte_eth_stats *rte_stats) + if (rxq == NULL) + continue; + +- rte_spinlock_lock(&hw->stats_lock); + hns3_rcb_rx_ring_stats_get(rxq, stats); +- rte_spinlock_unlock(&hw->stats_lock); +- + rte_stats->ierrors += rxq->err_stats.l2_errors + + rxq->err_stats.pkt_len_errors; + rte_stats->ibytes += rxq->basic_stats.bytes; +@@ -659,9 +657,7 @@ hns3_stats_get(struct rte_eth_dev *eth_dev, struct rte_eth_stats *rte_stats) + if (txq == NULL) + continue; + +- rte_spinlock_lock(&hw->stats_lock); + hns3_rcb_tx_ring_stats_get(txq, stats); +- rte_spinlock_unlock(&hw->stats_lock); + rte_stats->obytes += txq->basic_stats.bytes; + } + +@@ -683,7 +679,10 @@ hns3_stats_get(struct rte_eth_dev *eth_dev, struct rte_eth_stats *rte_stats) + rte_stats->opackets = stats->rcb_tx_ring_pktnum_rcd - + rte_stats->oerrors; + rte_stats->rx_nombuf = eth_dev->data->rx_mbuf_alloc_failed; ++ + out: ++ rte_spinlock_unlock(&hw->stats_lock); ++ + return ret; + } + +@@ -697,6 +696,7 @@ hns3_stats_reset(struct rte_eth_dev *eth_dev) + uint16_t i; + int ret; + ++ rte_spinlock_lock(&hw->stats_lock); + /* + * Note: Reading hardware statistics of imissed registers will + * clear them. +@@ -732,7 +732,6 @@ hns3_stats_reset(struct rte_eth_dev *eth_dev) + if (rxq == NULL) + continue; + +- rte_spinlock_lock(&hw->stats_lock); + memset(&rxq->basic_stats, 0, + sizeof(struct hns3_rx_basic_stats)); + +@@ -740,7 +739,6 @@ hns3_stats_reset(struct rte_eth_dev *eth_dev) + (void)hns3_read_dev(rxq, HNS3_RING_RX_PKTNUM_RECORD_REG); + rxq->err_stats.pkt_len_errors = 0; + rxq->err_stats.l2_errors = 0; +- rte_spinlock_unlock(&hw->stats_lock); + } + + /* Clear all the stats of a txq in a loop to keep them synchronized */ +@@ -749,19 +747,18 @@ hns3_stats_reset(struct rte_eth_dev *eth_dev) + if (txq == NULL) + continue; + +- rte_spinlock_lock(&hw->stats_lock); + memset(&txq->basic_stats, 0, + sizeof(struct hns3_tx_basic_stats)); + + /* This register is read-clear */ + (void)hns3_read_dev(txq, HNS3_RING_TX_PKTNUM_RECORD_REG); +- rte_spinlock_unlock(&hw->stats_lock); + } + +- rte_spinlock_lock(&hw->stats_lock); + hns3_tqp_stats_clear(hw); +- rte_spinlock_unlock(&hw->stats_lock); ++ + out: ++ rte_spinlock_unlock(&hw->stats_lock); ++ + return ret; + } + +@@ -1082,11 +1079,11 @@ hns3_dev_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *xstats, + count++; + } + } +- rte_spinlock_unlock(&hw->stats_lock); + + ret = hns3_update_imissed_stats(hw, false); + if (ret) { + hns3_err(hw, "update imissed stats failed, ret = %d", ret); ++ rte_spinlock_unlock(&hw->stats_lock); + return ret; + } + +@@ -1115,7 +1112,6 @@ hns3_dev_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *xstats, + } + } + +- rte_spinlock_lock(&hw->stats_lock); + hns3_tqp_dfx_stats_get(dev, xstats, &count); + hns3_queue_stats_get(dev, xstats, &count); + rte_spinlock_unlock(&hw->stats_lock); +-- +2.23.0 + diff --git a/0129-net-hns3-remove-unused-macro.patch b/0129-net-hns3-remove-unused-macro.patch deleted file mode 100644 index 929ea93c0ebbb0ce08f53677a31cbac9e078277c..0000000000000000000000000000000000000000 --- a/0129-net-hns3-remove-unused-macro.patch +++ /dev/null @@ -1,31 +0,0 @@ -From fc5b336c4006b92193b36b61363e39a776bad5cb Mon Sep 17 00:00:00 2001 -From: "Min Hu (Connor)" -Date: Tue, 20 Apr 2021 16:59:48 +0800 -Subject: [PATCH 129/189] net/hns3: remove unused macro - -'HNS3_RXD_LKBK_B' was defined in previous versions but no used. -This patch deleted it. - -Fixes: bba636698316 ("net/hns3: support Rx/Tx and related operations") -Cc: stable@dpdk.org - -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_rxtx.h | 1 - - 1 file changed, 1 deletion(-) - -diff --git a/drivers/net/hns3/hns3_rxtx.h b/drivers/net/hns3/hns3_rxtx.h -index ac14802..92f01ed 100644 ---- a/drivers/net/hns3/hns3_rxtx.h -+++ b/drivers/net/hns3/hns3_rxtx.h -@@ -106,7 +106,6 @@ - #define HNS3_RXD_L3L4P_B 11 - - #define HNS3_RXD_TS_VLD_B 14 --#define HNS3_RXD_LKBK_B 15 - #define HNS3_RXD_GRO_SIZE_S 16 - #define HNS3_RXD_GRO_SIZE_M (0x3fff << HNS3_RXD_GRO_SIZE_S) - --- -2.7.4 - diff --git a/0130-net-hns3-fix-descriptors-check-with-SVE.patch b/0130-net-hns3-fix-descriptors-check-with-SVE.patch new file mode 100644 index 0000000000000000000000000000000000000000..e41221a2bd3094eea63e1bc64fa3de0cdd6aae5a --- /dev/null +++ b/0130-net-hns3-fix-descriptors-check-with-SVE.patch @@ -0,0 +1,34 @@ +From 07210d18c368b27539218d9c3a907f30447c2a1e Mon Sep 17 00:00:00 2001 +From: Chengwen Feng +Date: Fri, 21 Oct 2022 15:36:06 +0800 +Subject: [PATCH 130/189] net/hns3: fix descriptors check with SVE + +The SVE algorithm and NEON algorithm have the same requirements for +nb-desc, but the nb-desc is verified only when using NEON. + +Fixes: fa29fe45a7b4 ("net/hns3: support queue start and stop") +Cc: stable@dpdk.org + +Signed-off-by: Chengwen Feng +Signed-off-by: Dongdong Liu +--- + drivers/net/hns3/hns3_rxtx.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c +index 0dc1d8cb60..b7fe2352a1 100644 +--- a/drivers/net/hns3/hns3_rxtx.c ++++ b/drivers/net/hns3/hns3_rxtx.c +@@ -1759,7 +1759,8 @@ hns3_rxq_conf_runtime_check(struct hns3_hw *hw, uint16_t buf_size, + return -EINVAL; + } + +- if (pkt_burst == hns3_recv_pkts_vec) { ++ if (pkt_burst == hns3_recv_pkts_vec || ++ pkt_burst == hns3_recv_pkts_vec_sve) { + min_vec_bds = HNS3_DEFAULT_RXQ_REARM_THRESH + + HNS3_DEFAULT_RX_BURST; + if (nb_desc < min_vec_bds || +-- +2.23.0 + diff --git a/0130-net-hns3-fix-traffic-management-support-check.patch b/0130-net-hns3-fix-traffic-management-support-check.patch deleted file mode 100644 index 053f14cb60f1ebe2785123b95c008edb1d985eef..0000000000000000000000000000000000000000 --- a/0130-net-hns3-fix-traffic-management-support-check.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 67137c61da758dd22b8a5f9cda9e32fcd9034892 Mon Sep 17 00:00:00 2001 -From: "Min Hu (Connor)" -Date: Tue, 20 Apr 2021 16:59:49 +0800 -Subject: [PATCH 130/189] net/hns3: fix traffic management support check - -params->leaf.cman has enum type which is not isomorphic with boolean -type, however it is used as a boolean expression. - -This patch fixed it. - -Fixes: c09c7847d892 ("net/hns3: support traffic management") -Cc: stable@dpdk.org - -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_tm.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/drivers/net/hns3/hns3_tm.c b/drivers/net/hns3/hns3_tm.c -index bcae57a..f7bfc25 100644 ---- a/drivers/net/hns3/hns3_tm.c -+++ b/drivers/net/hns3/hns3_tm.c -@@ -385,7 +385,7 @@ hns3_tm_leaf_node_param_check(struct rte_eth_dev *dev __rte_unused, - return -EINVAL; - } - -- if (params->leaf.cman) { -+ if (params->leaf.cman != RTE_TM_CMAN_TAIL_DROP) { - error->type = RTE_TM_ERROR_TYPE_NODE_PARAMS_CMAN; - error->message = "congestion management not supported"; - return -EINVAL; --- -2.7.4 - diff --git a/0131-net-hns3-clean-some-functions.patch b/0131-net-hns3-clean-some-functions.patch new file mode 100644 index 0000000000000000000000000000000000000000..412cc7de91cc6209691296a48acc73ffb709b390 --- /dev/null +++ b/0131-net-hns3-clean-some-functions.patch @@ -0,0 +1,50 @@ +From 3a1871f1dfbba831c9c6a65081d22e6021d78ffe Mon Sep 17 00:00:00 2001 +From: Dongdong Liu +Date: Fri, 21 Oct 2022 15:36:07 +0800 +Subject: [PATCH 131/189] net/hns3: clean some functions + +Delete unnecessary code and adjust code to make code more clean. + +Signed-off-by: Dongdong Liu +--- + drivers/net/hns3/hns3_rxtx.c | 10 +++------- + 1 file changed, 3 insertions(+), 7 deletions(-) + +diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c +index b7fe2352a1..840ca384ce 100644 +--- a/drivers/net/hns3/hns3_rxtx.c ++++ b/drivers/net/hns3/hns3_rxtx.c +@@ -1909,8 +1909,6 @@ hns3_rx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t nb_desc, + rxq->pvid_sw_discard_en = false; + rxq->ptype_en = hns3_dev_get_support(hw, RXD_ADV_LAYOUT) ? true : false; + rxq->configured = true; +- rxq->io_base = (void *)((char *)hw->io_base + HNS3_TQP_REG_OFFSET + +- idx * HNS3_TQP_REG_SIZE); + rxq->io_base = (void *)((char *)hw->io_base + + hns3_get_tqp_reg_offset(idx)); + rxq->io_head_reg = (volatile void *)((char *)rxq->io_base + +@@ -2442,10 +2440,8 @@ hns3_recv_pkts_simple(void *rx_queue, + + nmb = hns3_rx_alloc_buffer(rxq); + if (unlikely(nmb == NULL)) { +- uint16_t port_id; +- +- port_id = rxq->port_id; +- rte_eth_devices[port_id].data->rx_mbuf_alloc_failed++; ++ rte_eth_devices[rxq->port_id].data-> ++ rx_mbuf_alloc_failed++; + break; + } + +@@ -3870,7 +3866,7 @@ hns3_prep_pkt_proc(struct hns3_tx_queue *tx_queue, struct rte_mbuf *m) + #endif + if (hns3_pkt_is_tso(m)) { + if (hns3_pkt_need_linearized(m, m->nb_segs, +- tx_queue->max_non_tso_bd_num) || ++ tx_queue->max_non_tso_bd_num) || + hns3_check_tso_pkt_valid(m)) { + rte_errno = EINVAL; + return -EINVAL; +-- +2.23.0 + diff --git a/0131-net-hns3-ignore-devargs-parsing-return.patch b/0131-net-hns3-ignore-devargs-parsing-return.patch deleted file mode 100644 index 379f1f735205a640137a735a86ef9d4eded578d5..0000000000000000000000000000000000000000 --- a/0131-net-hns3-ignore-devargs-parsing-return.patch +++ /dev/null @@ -1,39 +0,0 @@ -From 395f4bf89616e096fc6fd95d7baed7dd3219525b Mon Sep 17 00:00:00 2001 -From: "Min Hu (Connor)" -Date: Tue, 20 Apr 2021 16:59:50 +0800 -Subject: [PATCH 131/189] net/hns3: ignore devargs parsing return - -In hns3 PMD, as the handler always return 0, the return value -of a function 'rte_kvargs_process' no need to be checked. But -the API definition has return value, so 'void' could be used -to ignore that. - -Fixes: a124f9e9591b ("net/hns3: add runtime config to select IO burst function") - -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_ethdev.c | 6 +++--- - 1 file changed, 3 insertions(+), 3 deletions(-) - -diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c -index e2a96c1..81c67e2 100644 ---- a/drivers/net/hns3/hns3_ethdev.c -+++ b/drivers/net/hns3/hns3_ethdev.c -@@ -7268,11 +7268,11 @@ hns3_parse_devargs(struct rte_eth_dev *dev) - if (!kvlist) - return; - -- rte_kvargs_process(kvlist, HNS3_DEVARG_RX_FUNC_HINT, -+ (void)rte_kvargs_process(kvlist, HNS3_DEVARG_RX_FUNC_HINT, - &hns3_parse_io_hint_func, &rx_func_hint); -- rte_kvargs_process(kvlist, HNS3_DEVARG_TX_FUNC_HINT, -+ (void)rte_kvargs_process(kvlist, HNS3_DEVARG_TX_FUNC_HINT, - &hns3_parse_io_hint_func, &tx_func_hint); -- rte_kvargs_process(kvlist, HNS3_DEVARG_DEV_CAPS_MASK, -+ (void)rte_kvargs_process(kvlist, HNS3_DEVARG_DEV_CAPS_MASK, - &hns3_parse_dev_caps_mask, &dev_caps_mask); - rte_kvargs_free(kvlist); - --- -2.7.4 - diff --git a/0132-net-hns3-delete-unused-code.patch b/0132-net-hns3-delete-unused-code.patch new file mode 100644 index 0000000000000000000000000000000000000000..d94497174b13a84df9f758d24c10b1be5825f738 --- /dev/null +++ b/0132-net-hns3-delete-unused-code.patch @@ -0,0 +1,88 @@ +From a8c847f28e885f7ef07b3fd3fc415e2ce4113ee8 Mon Sep 17 00:00:00 2001 +From: Dongdong Liu +Date: Fri, 21 Oct 2022 15:36:08 +0800 +Subject: [PATCH 132/189] net/hns3: delete unused code + +The RTE_HNS3_ONLY_1630_FPGA macro is not in use, so delete the code. + +Fixes: 2192c428f9a6 ("net/hns3: fix firmware compatibility configuration") +Fixes: bdaf190f8235 ("net/hns3: support link speed autoneg for PF") +Cc: stable@dpdk.org + +Signed-off-by: Dongdong Liu +--- + drivers/net/hns3/hns3_cmd.c | 33 --------------------------------- + drivers/net/hns3/hns3_ethdev.c | 11 ++--------- + 2 files changed, 2 insertions(+), 42 deletions(-) + +diff --git a/drivers/net/hns3/hns3_cmd.c b/drivers/net/hns3/hns3_cmd.c +index e3d096d9cb..50cb3eabb1 100644 +--- a/drivers/net/hns3/hns3_cmd.c ++++ b/drivers/net/hns3/hns3_cmd.c +@@ -631,39 +631,6 @@ hns3_firmware_compat_config(struct hns3_hw *hw, bool is_init) + struct hns3_cmd_desc desc; + uint32_t compat = 0; + +-#if defined(RTE_HNS3_ONLY_1630_FPGA) +- /* If resv reg enabled phy driver of imp is not configured, driver +- * will use temporary phy driver. +- */ +- struct rte_pci_device *pci_dev; +- struct rte_eth_dev *eth_dev; +- uint8_t revision; +- int ret; +- +- eth_dev = &rte_eth_devices[hw->data->port_id]; +- pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev); +- /* Get PCI revision id */ +- ret = rte_pci_read_config(pci_dev, &revision, HNS3_PCI_REVISION_ID_LEN, +- HNS3_PCI_REVISION_ID); +- if (ret != HNS3_PCI_REVISION_ID_LEN) { +- PMD_INIT_LOG(ERR, "failed to read pci revision id, ret = %d", +- ret); +- return -EIO; +- } +- if (revision == PCI_REVISION_ID_HIP09_A) { +- struct hns3_pf *pf = HNS3_DEV_HW_TO_PF(hw); +- if (hns3_dev_get_support(hw, COPPER) == 0 || pf->is_tmp_phy) { +- PMD_INIT_LOG(ERR, "***use temp phy driver in dpdk***"); +- pf->is_tmp_phy = true; +- hns3_set_bit(hw->capability, +- HNS3_DEV_SUPPORT_COPPER_B, 1); +- return 0; +- } +- +- PMD_INIT_LOG(ERR, "***use phy driver in imp***"); +- } +-#endif +- + hns3_cmd_setup_basic_desc(&desc, HNS3_OPC_FIRMWARE_COMPAT_CFG, false); + req = (struct hns3_firmware_compat_cmd *)desc.data; + +diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c +index 7c9938b96e..401736f5a6 100644 +--- a/drivers/net/hns3/hns3_ethdev.c ++++ b/drivers/net/hns3/hns3_ethdev.c +@@ -4970,17 +4970,10 @@ hns3_set_port_link_speed(struct hns3_hw *hw, + { + int ret; + +- if (hw->mac.media_type == HNS3_MEDIA_TYPE_COPPER) { +-#if defined(RTE_HNS3_ONLY_1630_FPGA) +- struct hns3_pf *pf = HNS3_DEV_HW_TO_PF(hw); +- if (pf->is_tmp_phy) +- return 0; +-#endif +- ++ if (hw->mac.media_type == HNS3_MEDIA_TYPE_COPPER) + ret = hns3_set_copper_port_link_speed(hw, cfg); +- } else { ++ else + ret = hns3_set_fiber_port_link_speed(hw, cfg); +- } + + if (ret) { + hns3_err(hw, "failed to set %s port link speed, ret = %d.", +-- +2.23.0 + diff --git a/0132-net-hns3-fix-mailbox-error-message.patch b/0132-net-hns3-fix-mailbox-error-message.patch deleted file mode 100644 index c4210f66e6bfc4140706687d68a3a33613d068d7..0000000000000000000000000000000000000000 --- a/0132-net-hns3-fix-mailbox-error-message.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 4cdaa8769ca9aa1aa558637606de0434bdd343fb Mon Sep 17 00:00:00 2001 -From: Chengwen Feng -Date: Thu, 22 Apr 2021 09:55:49 +0800 -Subject: [PATCH 132/189] net/hns3: fix mailbox error message - -The hns3_dev_handle_mbx_msg() could be called under both PF and VF, -but the error messages show VF. - -Fixes: 109e4dd1bd7a ("net/hns3: get link state change through mailbox") -Cc: stable@dpdk.org - -Signed-off-by: Chengwen Feng -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_mbx.c | 3 +-- - 1 file changed, 1 insertion(+), 2 deletions(-) - -diff --git a/drivers/net/hns3/hns3_mbx.c b/drivers/net/hns3/hns3_mbx.c -index 9955f27..6203af5 100644 ---- a/drivers/net/hns3/hns3_mbx.c -+++ b/drivers/net/hns3/hns3_mbx.c -@@ -528,8 +528,7 @@ hns3_dev_handle_mbx_msg(struct hns3_hw *hw) - hns3_handle_promisc_info(hw, req->msg[1]); - break; - default: -- hns3_err(hw, -- "VF received unsupported(%u) mbx msg from PF", -+ hns3_err(hw, "received unsupported(%u) mbx msg", - req->msg[0]); - break; - } --- -2.7.4 - diff --git a/0133-examples-dma-support-dequeue-when-no-packet-received.patch b/0133-examples-dma-support-dequeue-when-no-packet-received.patch new file mode 100644 index 0000000000000000000000000000000000000000..4cf6fab87f4ab24eda82302893bc6204b0a484a5 --- /dev/null +++ b/0133-examples-dma-support-dequeue-when-no-packet-received.patch @@ -0,0 +1,62 @@ +From ab50c70fe965fb931156eddfbde0ead68323849a Mon Sep 17 00:00:00 2001 +From: Chengwen Feng +Date: Fri, 21 Oct 2022 15:36:09 +0800 +Subject: [PATCH 133/189] examples/dma: support dequeue when no packet received + +Currently the example using DMA in asynchronous mode, which are: + nb_rx = rte_eth_rx_burst(); + if (nb_rx == 0) + continue; + ... + dma_enqueue(); // enqueue the received packets copy request + nb_cpl = dma_dequeue(); // get copy completed packets + ... + +There are no waiting inside dma_dequeue(), and this is why it's called +asynchronus. If there are no packet received, it won't call +dma_dequeue(), but some packets may still in the DMA queue which +enqueued in last cycle. As a result, when the traffic is stopped, the +sent packets and received packets are unbalanced from the perspective +of the traffic generator. + +The patch supports DMA dequeue when no packet received, it helps to +judge the test result by comparing the sent packets with the received +packets on traffic generator sides. + +Signed-off-by: Chengwen Feng +Acked-by: Bruce Richardson +Acked-by: Kevin Laatz +--- + examples/dma/dmafwd.c | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/examples/dma/dmafwd.c b/examples/dma/dmafwd.c +index 9b17b40dbf..b06042e5fe 100644 +--- a/examples/dma/dmafwd.c ++++ b/examples/dma/dmafwd.c +@@ -408,8 +408,13 @@ dma_rx_port(struct rxtx_port_config *rx_config) + nb_rx = rte_eth_rx_burst(rx_config->rxtx_port, i, + pkts_burst, MAX_PKT_BURST); + +- if (nb_rx == 0) ++ if (nb_rx == 0) { ++ if (copy_mode == COPY_MODE_DMA_NUM && ++ (nb_rx = dma_dequeue(pkts_burst, pkts_burst_copy, ++ MAX_PKT_BURST, rx_config->dmadev_ids[i])) > 0) ++ goto handle_tx; + continue; ++ } + + port_statistics.rx[rx_config->rxtx_port] += nb_rx; + +@@ -450,6 +455,7 @@ dma_rx_port(struct rxtx_port_config *rx_config) + pkts_burst_copy[j]); + } + ++handle_tx: + rte_mempool_put_bulk(dma_pktmbuf_pool, + (void *)pkts_burst, nb_rx); + +-- +2.23.0 + diff --git a/0133-net-hns3-fix-processing-link-status-message-on-PF.patch b/0133-net-hns3-fix-processing-link-status-message-on-PF.patch deleted file mode 100644 index 730ef9eac81d5556eca0abb8ce7d370ed3f68317..0000000000000000000000000000000000000000 --- a/0133-net-hns3-fix-processing-link-status-message-on-PF.patch +++ /dev/null @@ -1,61 +0,0 @@ -From 34cf459a8af7788e68e9614c82a1cbcd38d5f55c Mon Sep 17 00:00:00 2001 -From: Chengwen Feng -Date: Thu, 22 Apr 2021 09:55:50 +0800 -Subject: [PATCH 133/189] net/hns3: fix processing link status message on PF - -The opcode of the link status notification message reported by the -firmware is zero, it will be filtered out because driver treats it as -already processed message. As a result, the PF can't update the link -status in a timely manner. - -Because only VF can set opcode to zero when processing mailbox message, -we add a judgment to make sure the PF messages will not be filtered out. - -Fixes: dbbbad23e380 ("net/hns3: fix VF handling LSC event in secondary process") -Cc: stable@dpdk.org - -Signed-off-by: Chengwen Feng -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_mbx.c | 10 +++++++--- - 1 file changed, 7 insertions(+), 3 deletions(-) - -diff --git a/drivers/net/hns3/hns3_mbx.c b/drivers/net/hns3/hns3_mbx.c -index 6203af5..ea6c0c3 100644 ---- a/drivers/net/hns3/hns3_mbx.c -+++ b/drivers/net/hns3/hns3_mbx.c -@@ -438,16 +438,19 @@ hns3_handle_mbx_msg_out_intr(struct hns3_hw *hw) - void - hns3_dev_handle_mbx_msg(struct hns3_hw *hw) - { -+ struct hns3_adapter *hns = HNS3_DEV_HW_TO_ADAPTER(hw); - struct hns3_cmq_ring *crq = &hw->cmq.crq; - struct hns3_mbx_pf_to_vf_cmd *req; - struct hns3_cmd_desc *desc; -+ bool handle_out; - uint8_t opcode; - uint16_t flag; - - rte_spinlock_lock(&hw->cmq.crq.lock); - -- if (rte_eal_process_type() != RTE_PROC_PRIMARY || -- !rte_thread_is_intr()) { -+ handle_out = (rte_eal_process_type() != RTE_PROC_PRIMARY || -+ !rte_thread_is_intr()) && hns->is_vf; -+ if (handle_out) { - /* - * Currently, any threads in the primary and secondary processes - * could send mailbox sync request, so it will need to process -@@ -491,7 +494,8 @@ hns3_dev_handle_mbx_msg(struct hns3_hw *hw) - continue; - } - -- if (desc->opcode == 0) { -+ handle_out = hns->is_vf && desc->opcode == 0; -+ if (handle_out) { - /* Message already processed by other thread */ - crq->desc[crq->next_to_use].flag = 0; - hns3_mbx_ring_ptr_move_crq(crq); --- -2.7.4 - diff --git a/0134-net-hns3-add-dump-of-VF-VLAN-filter-modify-capabilit.patch b/0134-net-hns3-add-dump-of-VF-VLAN-filter-modify-capabilit.patch new file mode 100644 index 0000000000000000000000000000000000000000..b5d1ac41a235c73d7d77283aba8f210f87087fc5 --- /dev/null +++ b/0134-net-hns3-add-dump-of-VF-VLAN-filter-modify-capabilit.patch @@ -0,0 +1,31 @@ +From 29cb11b1bfafa7a4cefaffbbd5b05afab32957ba Mon Sep 17 00:00:00 2001 +From: Jie Hai +Date: Fri, 21 Oct 2022 15:36:10 +0800 +Subject: [PATCH 134/189] net/hns3: add dump of VF VLAN filter modify + capability + +Show whether support modifying VF VLAN filter or not. +Sample output changes: ++ -- support VF VLAN FILTER MOD: Yes + +Signed-off-by: Jie Hai +Signed-off-by: Dongdong Liu +--- + drivers/net/hns3/hns3_dump.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/net/hns3/hns3_dump.c b/drivers/net/hns3/hns3_dump.c +index ef3e5c0fb4..646e93d8e6 100644 +--- a/drivers/net/hns3/hns3_dump.c ++++ b/drivers/net/hns3/hns3_dump.c +@@ -98,6 +98,7 @@ hns3_get_dev_feature_capability(FILE *file, struct hns3_hw *hw) + {HNS3_DEV_SUPPORT_OUTER_UDP_CKSUM_B, "OUTER UDP CKSUM"}, + {HNS3_DEV_SUPPORT_RAS_IMP_B, "RAS IMP"}, + {HNS3_DEV_SUPPORT_TM_B, "TM"}, ++ {HNS3_DEV_SUPPORT_VF_VLAN_FLT_MOD_B, "VF VLAN FILTER MOD"}, + }; + uint32_t i; + +-- +2.23.0 + diff --git a/0134-net-hns3-remove-unused-mailbox-macro-and-struct.patch b/0134-net-hns3-remove-unused-mailbox-macro-and-struct.patch deleted file mode 100644 index c478ffa6a02f021417c116e89fd520c13531d9fe..0000000000000000000000000000000000000000 --- a/0134-net-hns3-remove-unused-mailbox-macro-and-struct.patch +++ /dev/null @@ -1,55 +0,0 @@ -From 0a74fe6f54d39e5e09e875266efc365d51a4de68 Mon Sep 17 00:00:00 2001 -From: Chengwen Feng -Date: Thu, 22 Apr 2021 09:55:52 +0800 -Subject: [PATCH 134/189] net/hns3: remove unused mailbox macro and struct - -In hns3_mbx.h, some macro and structure were defined in previous -versions but never used. - -Fixes: 463e748964f5 ("net/hns3: support mailbox") -Cc: stable@dpdk.org - -Signed-off-by: Chengwen Feng -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_mbx.h | 10 ---------- - 1 file changed, 10 deletions(-) - -diff --git a/drivers/net/hns3/hns3_mbx.h b/drivers/net/hns3/hns3_mbx.h -index 338c2c2..e84ef6d 100644 ---- a/drivers/net/hns3/hns3_mbx.h -+++ b/drivers/net/hns3/hns3_mbx.h -@@ -5,8 +5,6 @@ - #ifndef _HNS3_MBX_H_ - #define _HNS3_MBX_H_ - --#define HNS3_MBX_VF_MSG_DATA_NUM 16 -- - enum HNS3_MBX_OPCODE { - HNS3_MBX_RESET = 0x01, /* (VF -> PF) assert reset */ - HNS3_MBX_ASSERTING_RESET, /* (PF -> VF) PF is asserting reset */ -@@ -80,8 +78,6 @@ enum hns3_mbx_link_fail_subcode { - - #define HNS3_MBX_MAX_MSG_SIZE 16 - #define HNS3_MBX_MAX_RESP_DATA_SIZE 8 --#define HNS3_MBX_RING_MAP_BASIC_MSG_NUM 3 --#define HNS3_MBX_RING_NODE_VARIABLE_NUM 3 - - enum { - HNS3_MBX_RESP_MATCHING_SCHEME_OF_ORIGINAL = 0, -@@ -147,12 +143,6 @@ struct hns3_vf_bind_vector_msg { - struct hns3_ring_chain_param param[HNS3_MBX_MAX_RING_CHAIN_PARAM_NUM]; - }; - --struct hns3_vf_rst_cmd { -- uint8_t dest_vfid; -- uint8_t vf_rst; -- uint8_t rsv[22]; --}; -- - struct hns3_pf_rst_done_cmd { - uint8_t pf_rst_done; - uint8_t rsv[23]; --- -2.7.4 - diff --git a/0135-net-hns3-fix-Rx-with-PTP.patch b/0135-net-hns3-fix-Rx-with-PTP.patch new file mode 100644 index 0000000000000000000000000000000000000000..4afa8cbdb07c8a50efe86abea82bd853c92c5b21 --- /dev/null +++ b/0135-net-hns3-fix-Rx-with-PTP.patch @@ -0,0 +1,89 @@ +From 9fd76879f458693e1cf368aeeb08238c579c8ff3 Mon Sep 17 00:00:00 2001 +From: Huisong Li +Date: Fri, 21 Oct 2022 15:36:11 +0800 +Subject: [PATCH 135/189] net/hns3: fix Rx with PTP + +The Rx and Tx vector algorithm of hns3 PMD don't support PTP +function. Currently, hns3 driver uses 'pf->ptp_enable' to check +whether PTP is enabled so as to not select Rx and Tx vector +algorithm. And the variable is set when call rte_eth_timesync_enable(). +Namely, it may not be set before selecting Rx/Tx function, let's say +the case: set PTP offload in dev_configure(), do dev_start() and then +call rte_eth_timesync_enable(). In this case, all PTP packets can not +be received to application. So this patch fixes the check based on the +RTE_ETH_RX_OFFLOAD_TIMESTAMP flag. + +Fixes: 3ca3dcd65101 ("net/hns3: fix vector Rx/Tx when PTP enabled") +Cc: stable@dpdk.org + +Signed-off-by: Huisong Li +Signed-off-by: Dongdong Liu +--- + drivers/net/hns3/hns3_ptp.c | 1 - + drivers/net/hns3/hns3_rxtx_vec.c | 20 +++++++++----------- + 2 files changed, 9 insertions(+), 12 deletions(-) + +diff --git a/drivers/net/hns3/hns3_ptp.c b/drivers/net/hns3/hns3_ptp.c +index 0b0061bba5..6bbd85ba23 100644 +--- a/drivers/net/hns3/hns3_ptp.c ++++ b/drivers/net/hns3/hns3_ptp.c +@@ -125,7 +125,6 @@ hns3_timesync_enable(struct rte_eth_dev *dev) + + if (pf->ptp_enable) + return 0; +- hns3_warn(hw, "note: please ensure Rx/Tx burst mode is simple or common when enabling PTP!"); + + rte_spinlock_lock(&hw->lock); + ret = hns3_timesync_configure(hns, true); +diff --git a/drivers/net/hns3/hns3_rxtx_vec.c b/drivers/net/hns3/hns3_rxtx_vec.c +index 73f0ab6bc8..153866cf03 100644 +--- a/drivers/net/hns3/hns3_rxtx_vec.c ++++ b/drivers/net/hns3/hns3_rxtx_vec.c +@@ -17,15 +17,18 @@ int + hns3_tx_check_vec_support(struct rte_eth_dev *dev) + { + struct rte_eth_txmode *txmode = &dev->data->dev_conf.txmode; +- struct hns3_adapter *hns = dev->data->dev_private; +- struct hns3_pf *pf = &hns->pf; ++ struct rte_eth_rxmode *rxmode = &dev->data->dev_conf.rxmode; + + /* Only support RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE */ + if (txmode->offloads != RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE) + return -ENOTSUP; + +- /* Vec is not supported when PTP enabled */ +- if (pf->ptp_enable) ++ /* ++ * PTP function requires the cooperation of Rx and Tx. ++ * Tx vector isn't supported if RTE_ETH_RX_OFFLOAD_TIMESTAMP is set ++ * in Rx offloads. ++ */ ++ if (rxmode->offloads & RTE_ETH_RX_OFFLOAD_TIMESTAMP) + return -ENOTSUP; + + return 0; +@@ -233,9 +236,8 @@ hns3_rx_check_vec_support(struct rte_eth_dev *dev) + struct rte_eth_fdir_conf *fconf = &dev->data->dev_conf.fdir_conf; + struct rte_eth_rxmode *rxmode = &dev->data->dev_conf.rxmode; + uint64_t offloads_mask = RTE_ETH_RX_OFFLOAD_TCP_LRO | +- RTE_ETH_RX_OFFLOAD_VLAN; +- struct hns3_adapter *hns = dev->data->dev_private; +- struct hns3_pf *pf = &hns->pf; ++ RTE_ETH_RX_OFFLOAD_VLAN | ++ RTE_ETH_RX_OFFLOAD_TIMESTAMP; + + if (dev->data->scattered_rx) + return -ENOTSUP; +@@ -249,9 +251,5 @@ hns3_rx_check_vec_support(struct rte_eth_dev *dev) + if (hns3_rxq_iterate(dev, hns3_rxq_vec_check, NULL) != 0) + return -ENOTSUP; + +- /* Vec is not supported when PTP enabled */ +- if (pf->ptp_enable) +- return -ENOTSUP; +- + return 0; + } +-- +2.23.0 + diff --git a/0135-net-hns3-fix-typos-on-comments.patch b/0135-net-hns3-fix-typos-on-comments.patch deleted file mode 100644 index 6245b798fdde17ab97216f3b474ee6006b33d759..0000000000000000000000000000000000000000 --- a/0135-net-hns3-fix-typos-on-comments.patch +++ /dev/null @@ -1,63 +0,0 @@ -From ccfb6795b2b2336ea29836d1ac8bdadcf6e635be Mon Sep 17 00:00:00 2001 -From: "Min Hu (Connor)" -Date: Fri, 23 Apr 2021 17:27:38 +0800 -Subject: [PATCH 135/189] net/hns3: fix typos on comments - -This patch fixed wrong word in comments. - -Fixes: f53a793bb7c2 ("net/hns3: add more hardware error types") -Fixes: d51867db65c1 ("net/hns3: add initialization") -Fixes: 411d23b9eafb ("net/hns3: support VLAN") -Fixes: 5f8845f4ba8f ("net/hns3: process MAC interrupt") -Cc: stable@dpdk.org - -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_ethdev.c | 10 +++++----- - 1 file changed, 5 insertions(+), 5 deletions(-) - -diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c -index 81c67e2..887c008 100644 ---- a/drivers/net/hns3/hns3_ethdev.c -+++ b/drivers/net/hns3/hns3_ethdev.c -@@ -280,7 +280,7 @@ hns3_handle_mac_tnl(struct hns3_hw *hw) - uint32_t status; - int ret; - -- /* query and clear mac tnl interruptions */ -+ /* query and clear mac tnl interrupt */ - hns3_cmd_setup_basic_desc(&desc, HNS3_OPC_QUERY_MAC_TNL_INT, true); - ret = hns3_cmd_send(hw, &desc, 1); - if (ret) { -@@ -462,7 +462,7 @@ hns3_vlan_filter_configure(struct hns3_adapter *hns, uint16_t vlan_id, int on) - * When port base vlan enabled, we use port base vlan as the vlan - * filter condition. In this case, we don't update vlan filter table - * when user add new vlan or remove exist vlan, just update the -- * vlan list. The vlan id in vlan list will be writen in vlan filter -+ * vlan list. The vlan id in vlan list will be written in vlan filter - * table until port base vlan disabled - */ - if (hw->port_base_vlan_cfg.state == HNS3_PORT_BASE_VLAN_DISABLE) { -@@ -3983,8 +3983,8 @@ hns3_rx_buffer_calc(struct hns3_hw *hw, struct hns3_pkt_buf_alloc *buf_alloc) - * For different application scenes, the enabled port number, TC number - * and no_drop TC number are different. In order to obtain the better - * performance, software could allocate the buffer size and configure -- * the waterline by tring to decrease the private buffer size according -- * to the order, namely, waterline of valided tc, pfc disabled tc, pfc -+ * the waterline by trying to decrease the private buffer size according -+ * to the order, namely, waterline of valid tc, pfc disabled tc, pfc - * enabled tc. - */ - if (hns3_rx_buf_calc_all(hw, false, buf_alloc)) -@@ -5045,7 +5045,7 @@ hns3_config_all_msix_error(struct hns3_hw *hw, bool enable) - * and belong to a different type from the MSI-x errors processed - * by the network driver. - * -- * Network driver should open the new error report on initialition -+ * Network driver should open the new error report on initialization. - */ - val = hns3_read_dev(hw, HNS3_VECTOR0_OTER_EN_REG); - hns3_set_bit(val, HNS3_VECTOR0_ALL_MSIX_ERR_B, enable ? 1 : 0); --- -2.7.4 - diff --git a/0136-net-hns3-disable-MAC-status-report-interrupt.patch b/0136-net-hns3-disable-MAC-status-report-interrupt.patch deleted file mode 100644 index 231bd23fa2d8a96f1501be25c81052a9e6bde076..0000000000000000000000000000000000000000 --- a/0136-net-hns3-disable-MAC-status-report-interrupt.patch +++ /dev/null @@ -1,33 +0,0 @@ -From 6f262eb7e4f7682a34b53d5c4328fee1a4d817de Mon Sep 17 00:00:00 2001 -From: Hongbo Zheng -Date: Fri, 23 Apr 2021 17:56:34 +0800 -Subject: [PATCH 136/189] net/hns3: disable MAC status report interrupt - -Disable the MAC status report interrupt which hns3 driver not concern -currently. - -Fixes: 5f8845f4ba8f ("net/hns3: process MAC interrupt") -Cc: stable@dpdk.org - -Signed-off-by: Hongbo Zheng -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_ethdev.c | 2 -- - 1 file changed, 2 deletions(-) - -diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c -index 887c008..cea7926 100644 ---- a/drivers/net/hns3/hns3_ethdev.c -+++ b/drivers/net/hns3/hns3_ethdev.c -@@ -4892,8 +4892,6 @@ hns3_update_link_status(struct hns3_hw *hw) - if (state != hw->mac.link_status) { - hw->mac.link_status = state; - hns3_warn(hw, "Link status change to %s!", state ? "up" : "down"); -- hns3_config_mac_tnl_int(hw, -- state == ETH_LINK_UP ? true : false); - return true; - } - --- -2.7.4 - diff --git a/0136-net-hns3-fix-crash-in-SVE-Tx.patch b/0136-net-hns3-fix-crash-in-SVE-Tx.patch new file mode 100644 index 0000000000000000000000000000000000000000..c08d28200c20a49d95fd51d1bdcb216674aae48a --- /dev/null +++ b/0136-net-hns3-fix-crash-in-SVE-Tx.patch @@ -0,0 +1,44 @@ +From eaab0561c2effa2f60f27c10d27c099d819fdd1f Mon Sep 17 00:00:00 2001 +From: Chengwen Feng +Date: Fri, 21 Oct 2022 15:36:12 +0800 +Subject: [PATCH 136/189] net/hns3: fix crash in SVE Tx + +Currently, the number of Tx send bytes is obtained by accumulating the +length of the batch 'mbuf' packets of the current loop cycle. +Unfortunately, it uses svcntd (which means all lane, regardless of +whether the corresponding lane is valid) which may lead to overflow, +and thus refers to an invalid mbuf. + +Because the SVE xmit algorithm applies only to a single mbuf, the +mbuf's data_len is equal pkt_len, so this patch fixes it by using +svaddv_u64(svbool_t pg, svuint64_t data_len) which only adds valid +lanes. + +Fixes: fdcd6a3e0246 ("net/hns3: add bytes stats") +Cc: stable@dpdk.org + +Signed-off-by: Chengwen Feng +Signed-off-by: Dongdong Liu +--- + drivers/net/hns3/hns3_rxtx_vec_sve.c | 5 ++--- + 1 file changed, 2 insertions(+), 3 deletions(-) + +diff --git a/drivers/net/hns3/hns3_rxtx_vec_sve.c b/drivers/net/hns3/hns3_rxtx_vec_sve.c +index be1fdbcdf0..b0dfb052bb 100644 +--- a/drivers/net/hns3/hns3_rxtx_vec_sve.c ++++ b/drivers/net/hns3/hns3_rxtx_vec_sve.c +@@ -435,9 +435,8 @@ hns3_tx_fill_hw_ring_sve(struct hns3_tx_queue *txq, + offsets, svdup_n_u64(valid_bit)); + + /* Increment bytes counter */ +- uint32_t idx; +- for (idx = 0; idx < svcntd(); idx++) +- txq->basic_stats.bytes += pkts[idx]->pkt_len; ++ txq->basic_stats.bytes += ++ (svaddv_u64(pg, data_len) >> HNS3_UINT16_BIT); + + /* update index for next loop */ + i += svcntd(); +-- +2.23.0 + diff --git a/0137-net-hns3-fix-handling-link-update.patch b/0137-net-hns3-fix-handling-link-update.patch deleted file mode 100644 index 6dc3f6e7b4cba1b06f7d171a65b879dc89351507..0000000000000000000000000000000000000000 --- a/0137-net-hns3-fix-handling-link-update.patch +++ /dev/null @@ -1,49 +0,0 @@ -From 2f19fbb0dd817a21194fc0764621fe0ad67b90a7 Mon Sep 17 00:00:00 2001 -From: Chengwen Feng -Date: Tue, 27 Apr 2021 20:17:39 +0800 -Subject: [PATCH 137/189] net/hns3: fix handling link update - -The link fails code should be parsed using the structure -hns3_mbx_vf_to_pf_cmd, else it will parse fail. - -Fixes: 109e4dd1bd7a ("net/hns3: get link state change through mailbox") -Cc: stable@dpdk.org - -Signed-off-by: Chengwen Feng -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_mbx.c | 11 +++++++++-- - 1 file changed, 9 insertions(+), 2 deletions(-) - -diff --git a/drivers/net/hns3/hns3_mbx.c b/drivers/net/hns3/hns3_mbx.c -index ea6c0c3..3d019b9 100644 ---- a/drivers/net/hns3/hns3_mbx.c -+++ b/drivers/net/hns3/hns3_mbx.c -@@ -347,7 +347,7 @@ hns3_link_fail_parse(struct hns3_hw *hw, uint8_t link_fail_code) - - static void - hns3pf_handle_link_change_event(struct hns3_hw *hw, -- struct hns3_mbx_pf_to_vf_cmd *req) -+ struct hns3_mbx_vf_to_pf_cmd *req) - { - #define LINK_STATUS_OFFSET 1 - #define LINK_FAIL_CODE_OFFSET 2 -@@ -513,7 +513,14 @@ hns3_dev_handle_mbx_msg(struct hns3_hw *hw) - hns3_handle_asserting_reset(hw, req); - break; - case HNS3_MBX_PUSH_LINK_STATUS: -- hns3pf_handle_link_change_event(hw, req); -+ /* -+ * This message is reported by the firmware and is -+ * reported in 'struct hns3_mbx_vf_to_pf_cmd' format. -+ * Therefore, we should cast the req variable to -+ * 'struct hns3_mbx_vf_to_pf_cmd' and then process it. -+ */ -+ hns3pf_handle_link_change_event(hw, -+ (struct hns3_mbx_vf_to_pf_cmd *)req); - break; - case HNS3_MBX_PUSH_VLAN_INFO: - /* --- -2.7.4 - diff --git a/0137-net-hns3-fix-next-to-use-overflow-in-SVE-Tx.patch b/0137-net-hns3-fix-next-to-use-overflow-in-SVE-Tx.patch new file mode 100644 index 0000000000000000000000000000000000000000..cf96059d5336d2c4723ef8c010e12d9252cbd282 --- /dev/null +++ b/0137-net-hns3-fix-next-to-use-overflow-in-SVE-Tx.patch @@ -0,0 +1,46 @@ +From e95f25b7cda1108b4e0579dd70f1bf90516b7e2c Mon Sep 17 00:00:00 2001 +From: Chengwen Feng +Date: Fri, 21 Oct 2022 15:36:13 +0800 +Subject: [PATCH 137/189] net/hns3: fix next-to-use overflow in SVE Tx + +If txq's next-to-use plus nb_pkts equal txq's nb_tx_desc when using +SVE xmit algorithm, the txq's next-to-use will equal nb_tx_desc after +the xmit, this does not cause Tx exceptions, but may affect other ops +that depend on this field, such as tx_descriptor_status. + +Fixes: f0c243a6cb6f ("net/hns3: support SVE Tx") +Cc: stable@dpdk.org + +Signed-off-by: Chengwen Feng +Signed-off-by: Dongdong Liu +--- + drivers/net/hns3/hns3_rxtx_vec_sve.c | 8 +++++--- + 1 file changed, 5 insertions(+), 3 deletions(-) + +diff --git a/drivers/net/hns3/hns3_rxtx_vec_sve.c b/drivers/net/hns3/hns3_rxtx_vec_sve.c +index b0dfb052bb..f09a81dbd5 100644 +--- a/drivers/net/hns3/hns3_rxtx_vec_sve.c ++++ b/drivers/net/hns3/hns3_rxtx_vec_sve.c +@@ -464,14 +464,16 @@ hns3_xmit_fixed_burst_vec_sve(void *__restrict tx_queue, + return 0; + } + +- if (txq->next_to_use + nb_pkts > txq->nb_tx_desc) { ++ if (txq->next_to_use + nb_pkts >= txq->nb_tx_desc) { + nb_tx = txq->nb_tx_desc - txq->next_to_use; + hns3_tx_fill_hw_ring_sve(txq, tx_pkts, nb_tx); + txq->next_to_use = 0; + } + +- hns3_tx_fill_hw_ring_sve(txq, tx_pkts + nb_tx, nb_pkts - nb_tx); +- txq->next_to_use += nb_pkts - nb_tx; ++ if (nb_pkts > nb_tx) { ++ hns3_tx_fill_hw_ring_sve(txq, tx_pkts + nb_tx, nb_pkts - nb_tx); ++ txq->next_to_use += nb_pkts - nb_tx; ++ } + + txq->tx_bd_ready -= nb_pkts; + hns3_write_txq_tail_reg(txq, nb_pkts); +-- +2.23.0 + diff --git a/0138-net-hns3-fix-link-status-when-port-is-stopped.patch b/0138-net-hns3-fix-link-status-when-port-is-stopped.patch deleted file mode 100644 index 393bef4d31a470d7758d521b6172dccae6e57a7e..0000000000000000000000000000000000000000 --- a/0138-net-hns3-fix-link-status-when-port-is-stopped.patch +++ /dev/null @@ -1,51 +0,0 @@ -From d2fe85e2b088b99decbd4d394071fffbb6d80ff2 Mon Sep 17 00:00:00 2001 -From: Huisong Li -Date: Sun, 25 Apr 2021 20:06:28 +0800 -Subject: [PATCH 138/189] net/hns3: fix link status when port is stopped - -When port is stopped, link down should be reported to user. For HNS3 -PF driver, link status comes from link status of hardware. If the port -supports NCSI feature, hardware MAC will not be disabled. At this case, -even if the port is stopped, the link status is still Up. So driver -should set link down when the port is stopped. - -Fixes: 59fad0f32135 ("net/hns3: support link update operation") -Cc: stable@dpdk.org - -Signed-off-by: Huisong Li -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_ethdev.c | 10 ++++++++++ - 1 file changed, 10 insertions(+) - -diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c -index cea7926..eed1a37 100644 ---- a/drivers/net/hns3/hns3_ethdev.c -+++ b/drivers/net/hns3/hns3_ethdev.c -@@ -2894,6 +2894,15 @@ hns3_dev_link_update(struct rte_eth_dev *eth_dev, int wait_to_complete) - struct rte_eth_link new_link; - int ret; - -+ /* When port is stopped, report link down. */ -+ if (eth_dev->data->dev_started == 0) { -+ new_link.link_autoneg = mac->link_autoneg; -+ new_link.link_duplex = mac->link_duplex; -+ new_link.link_speed = ETH_SPEED_NUM_NONE; -+ new_link.link_status = ETH_LINK_DOWN; -+ goto out; -+ } -+ - do { - ret = hns3_update_port_link_info(eth_dev); - if (ret) { -@@ -2911,6 +2920,7 @@ hns3_dev_link_update(struct rte_eth_dev *eth_dev, int wait_to_complete) - memset(&new_link, 0, sizeof(new_link)); - hns3_setup_linkstatus(eth_dev, &new_link); - -+out: - return rte_eth_linkstatus_set(eth_dev, &new_link); - } - --- -2.7.4 - diff --git a/0138-net-hns3-fix-next-to-use-overflow-in-simple-Tx.patch b/0138-net-hns3-fix-next-to-use-overflow-in-simple-Tx.patch new file mode 100644 index 0000000000000000000000000000000000000000..8310dfaefb8ad9d3ff178343b3c0f9ff12e3613a --- /dev/null +++ b/0138-net-hns3-fix-next-to-use-overflow-in-simple-Tx.patch @@ -0,0 +1,46 @@ +From 982c9eabe68c6d5a0e8328df8dc11c5f315eddf0 Mon Sep 17 00:00:00 2001 +From: Chengwen Feng +Date: Fri, 21 Oct 2022 15:36:14 +0800 +Subject: [PATCH 138/189] net/hns3: fix next-to-use overflow in simple Tx + +If txq's next-to-use plus nb_pkts equal txq's nb_tx_desc when using +simple xmit algorithm, the txq's next-to-use will equal nb_tx_desc +fter the xmit, this does not cause Tx exceptions, but may affect other +ops that depend on this field, such as tx_descriptor_status. + +Fixes: 7ef933908f04 ("net/hns3: add simple Tx path") +Cc: stable@dpdk.org + +Signed-off-by: Chengwen Feng +Signed-off-by: Dongdong Liu +--- + drivers/net/hns3/hns3_rxtx.c | 8 +++++--- + 1 file changed, 5 insertions(+), 3 deletions(-) + +diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c +index 840ca384ce..93cc70477d 100644 +--- a/drivers/net/hns3/hns3_rxtx.c ++++ b/drivers/net/hns3/hns3_rxtx.c +@@ -4129,14 +4129,16 @@ hns3_xmit_pkts_simple(void *tx_queue, + } + + txq->tx_bd_ready -= nb_pkts; +- if (txq->next_to_use + nb_pkts > txq->nb_tx_desc) { ++ if (txq->next_to_use + nb_pkts >= txq->nb_tx_desc) { + nb_tx = txq->nb_tx_desc - txq->next_to_use; + hns3_tx_fill_hw_ring(txq, tx_pkts, nb_tx); + txq->next_to_use = 0; + } + +- hns3_tx_fill_hw_ring(txq, tx_pkts + nb_tx, nb_pkts - nb_tx); +- txq->next_to_use += nb_pkts - nb_tx; ++ if (nb_pkts > nb_tx) { ++ hns3_tx_fill_hw_ring(txq, tx_pkts + nb_tx, nb_pkts - nb_tx); ++ txq->next_to_use += nb_pkts - nb_tx; ++ } + + hns3_write_txq_tail_reg(txq, nb_pkts); + +-- +2.23.0 + diff --git a/0139-net-hns3-fix-link-speed-when-port-is-down.patch b/0139-net-hns3-fix-link-speed-when-port-is-down.patch deleted file mode 100644 index b266e7dddd0c9aa27b136598ce5b10cd90082ccf..0000000000000000000000000000000000000000 --- a/0139-net-hns3-fix-link-speed-when-port-is-down.patch +++ /dev/null @@ -1,46 +0,0 @@ -From 5ebfd9debffcadd8410f92089b4103e888b859b0 Mon Sep 17 00:00:00 2001 -From: Huisong Li -Date: Sun, 25 Apr 2021 20:06:29 +0800 -Subject: [PATCH 139/189] net/hns3: fix link speed when port is down - -When the port is link down state, it is meaningless to display the -port link speed. It should be an undefined state. - -Fixes: 59fad0f32135 ("net/hns3: support link update operation") -Cc: stable@dpdk.org - -Signed-off-by: Huisong Li -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_ethdev.c | 8 +++++--- - 1 file changed, 5 insertions(+), 3 deletions(-) - -diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c -index eed1a37..8dc9dbe 100644 ---- a/drivers/net/hns3/hns3_ethdev.c -+++ b/drivers/net/hns3/hns3_ethdev.c -@@ -2867,16 +2867,18 @@ hns3_setup_linkstatus(struct rte_eth_dev *eth_dev, - case ETH_SPEED_NUM_50G: - case ETH_SPEED_NUM_100G: - case ETH_SPEED_NUM_200G: -- new_link->link_speed = mac->link_speed; -+ if (mac->link_status) -+ new_link->link_speed = mac->link_speed; - break; - default: - if (mac->link_status) - new_link->link_speed = ETH_SPEED_NUM_UNKNOWN; -- else -- new_link->link_speed = ETH_SPEED_NUM_NONE; - break; - } - -+ if (!mac->link_status) -+ new_link->link_speed = ETH_SPEED_NUM_NONE; -+ - new_link->link_duplex = mac->link_duplex; - new_link->link_status = mac->link_status ? ETH_LINK_UP : ETH_LINK_DOWN; - new_link->link_autoneg = mac->link_autoneg; --- -2.7.4 - diff --git a/0139-net-hns3-optimize-SVE-Tx-performance.patch b/0139-net-hns3-optimize-SVE-Tx-performance.patch new file mode 100644 index 0000000000000000000000000000000000000000..df5df6e47a9f02e379268935ea2141ff8dbcac3f --- /dev/null +++ b/0139-net-hns3-optimize-SVE-Tx-performance.patch @@ -0,0 +1,56 @@ +From c4f3e4cf9404434d8062c523c8b6bc55df136140 Mon Sep 17 00:00:00 2001 +From: Chengwen Feng +Date: Fri, 21 Oct 2022 15:36:15 +0800 +Subject: [PATCH 139/189] net/hns3: optimize SVE Tx performance + +Optimize SVE xmit algorithm performance, will get about 1%+ +performance gain under 64B macfwd. + +Cc: stable@dpdk.org + +Signed-off-by: Chengwen Feng +--- + drivers/net/hns3/hns3_rxtx_vec_sve.c | 19 ++++++++++--------- + 1 file changed, 10 insertions(+), 9 deletions(-) + +diff --git a/drivers/net/hns3/hns3_rxtx_vec_sve.c b/drivers/net/hns3/hns3_rxtx_vec_sve.c +index f09a81dbd5..6f23ba674d 100644 +--- a/drivers/net/hns3/hns3_rxtx_vec_sve.c ++++ b/drivers/net/hns3/hns3_rxtx_vec_sve.c +@@ -389,10 +389,12 @@ hns3_tx_fill_hw_ring_sve(struct hns3_tx_queue *txq, + HNS3_UINT32_BIT; + svuint64_t base_addr, buf_iova, data_off, data_len, addr; + svuint64_t offsets = svindex_u64(0, BD_SIZE); +- uint32_t i = 0; +- svbool_t pg = svwhilelt_b64_u32(i, nb_pkts); ++ uint32_t cnt = svcntd(); ++ svbool_t pg; ++ uint32_t i; + +- do { ++ for (i = 0; i < nb_pkts; /* i is updated in the inner loop */) { ++ pg = svwhilelt_b64_u32(i, nb_pkts); + base_addr = svld1_u64(pg, (uint64_t *)pkts); + /* calc mbuf's field buf_iova address */ + buf_iova = svadd_n_u64_z(pg, base_addr, +@@ -439,12 +441,11 @@ hns3_tx_fill_hw_ring_sve(struct hns3_tx_queue *txq, + (svaddv_u64(pg, data_len) >> HNS3_UINT16_BIT); + + /* update index for next loop */ +- i += svcntd(); +- pkts += svcntd(); +- txdp += svcntd(); +- tx_entry += svcntd(); +- pg = svwhilelt_b64_u32(i, nb_pkts); +- } while (svptest_any(svptrue_b64(), pg)); ++ i += cnt; ++ pkts += cnt; ++ txdp += cnt; ++ tx_entry += cnt; ++ } + } + + static uint16_t +-- +2.23.0 + diff --git a/0140-net-hns3-fix-crash-when-secondary-process-access-FW.patch b/0140-net-hns3-fix-crash-when-secondary-process-access-FW.patch new file mode 100644 index 0000000000000000000000000000000000000000..51599825ce8d2aa6ab982ceb57cc26524279342a --- /dev/null +++ b/0140-net-hns3-fix-crash-when-secondary-process-access-FW.patch @@ -0,0 +1,75 @@ +From aa31e13f290fb82b43dac134f6b2b0332b3ffd45 Mon Sep 17 00:00:00 2001 +From: Chengwen Feng +Date: Fri, 21 Oct 2022 15:36:16 +0800 +Subject: [PATCH 140/189] net/hns3: fix crash when secondary process access FW + +Currently, to prevent missing reporting of reset interrupts and quickly +identify reset interrupts, the following logic is designed in the +FW (firmware) command interface hns3_cmd_send: if an unprocessed +interrupt exist (by checking reset registers), related reset task is +scheduled. + +The secondary process may invoke the hns3_cmd_send interface (e.g. using +proc-info query some stats). Unfortunately, the secondary process +does not support reset processing, and a segment fault may occur if it +schedules reset task. + +Fix it by limit the checking and scheduling of reset under only primary +process. + +Fixes: 2790c6464725 ("net/hns3: support device reset") +Cc: stable@dpdk.org + +Signed-off-by: Chengwen Feng +Signed-off-by: Dongdong Liu +--- + drivers/net/hns3/hns3_ethdev.c | 10 +++++++++- + drivers/net/hns3/hns3_ethdev_vf.c | 11 +++++++++-- + 2 files changed, 18 insertions(+), 3 deletions(-) + +diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c +index 401736f5a6..24ee9df332 100644 +--- a/drivers/net/hns3/hns3_ethdev.c ++++ b/drivers/net/hns3/hns3_ethdev.c +@@ -5602,7 +5602,15 @@ hns3_is_reset_pending(struct hns3_adapter *hns) + struct hns3_hw *hw = &hns->hw; + enum hns3_reset_level reset; + +- hns3_check_event_cause(hns, NULL); ++ /* ++ * Check the registers to confirm whether there is reset pending. ++ * Note: This check may lead to schedule reset task, but only primary ++ * process can process the reset event. Therefore, limit the ++ * checking under only primary process. ++ */ ++ if (rte_eal_process_type() == RTE_PROC_PRIMARY) ++ hns3_check_event_cause(hns, NULL); ++ + reset = hns3_get_reset_level(hns, &hw->reset.pending); + if (reset != HNS3_NONE_RESET && hw->reset.level != HNS3_NONE_RESET && + hw->reset.level < reset) { +diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c +index 0dea63e8be..db2f15abe2 100644 +--- a/drivers/net/hns3/hns3_ethdev_vf.c ++++ b/drivers/net/hns3/hns3_ethdev_vf.c +@@ -1864,8 +1864,15 @@ hns3vf_is_reset_pending(struct hns3_adapter *hns) + if (hw->reset.level == HNS3_VF_FULL_RESET) + return false; + +- /* Check the registers to confirm whether there is reset pending */ +- hns3vf_check_event_cause(hns, NULL); ++ /* ++ * Check the registers to confirm whether there is reset pending. ++ * Note: This check may lead to schedule reset task, but only primary ++ * process can process the reset event. Therefore, limit the ++ * checking under only primary process. ++ */ ++ if (rte_eal_process_type() == RTE_PROC_PRIMARY) ++ hns3vf_check_event_cause(hns, NULL); ++ + reset = hns3vf_get_reset_level(hw, &hw->reset.pending); + if (hw->reset.level != HNS3_NONE_RESET && reset != HNS3_NONE_RESET && + hw->reset.level < reset) { +-- +2.23.0 + diff --git a/0140-net-hns3-support-preferred-burst-size-and-queues-in-.patch b/0140-net-hns3-support-preferred-burst-size-and-queues-in-.patch deleted file mode 100644 index 34fe05926f854fb2ba1efb578e88aad768e4a321..0000000000000000000000000000000000000000 --- a/0140-net-hns3-support-preferred-burst-size-and-queues-in-.patch +++ /dev/null @@ -1,64 +0,0 @@ -From 8ca8c0a70500b13e25d292994ba403729f8671fd Mon Sep 17 00:00:00 2001 -From: Chengwen Feng -Date: Wed, 28 Apr 2021 15:20:51 +0800 -Subject: [PATCH 140/189] net/hns3: support preferred burst size and queues in - VF - -This patch supports get preferred burst size and queues when call -rte_eth_dev_info_get() API with VF. - -Signed-off-by: Chengwen Feng -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_ethdev.c | 3 --- - drivers/net/hns3/hns3_ethdev.h | 3 +++ - drivers/net/hns3/hns3_ethdev_vf.c | 5 +++++ - 3 files changed, 8 insertions(+), 3 deletions(-) - -diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c -index 8dc9dbe..f532284 100644 ---- a/drivers/net/hns3/hns3_ethdev.c -+++ b/drivers/net/hns3/hns3_ethdev.c -@@ -16,9 +16,6 @@ - #include "hns3_dcb.h" - #include "hns3_mp.h" - --#define HNS3_DEFAULT_PORT_CONF_BURST_SIZE 32 --#define HNS3_DEFAULT_PORT_CONF_QUEUES_NUM 1 -- - #define HNS3_SERVICE_INTERVAL 1000000 /* us */ - #define HNS3_SERVICE_QUICK_INTERVAL 10 - #define HNS3_INVALID_PVID 0xFFFF -diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h -index 8191c53..29737c6 100644 ---- a/drivers/net/hns3/hns3_ethdev.h -+++ b/drivers/net/hns3/hns3_ethdev.h -@@ -42,6 +42,9 @@ - #define HNS3_PF_FUNC_ID 0 - #define HNS3_1ST_VF_FUNC_ID 1 - -+#define HNS3_DEFAULT_PORT_CONF_BURST_SIZE 32 -+#define HNS3_DEFAULT_PORT_CONF_QUEUES_NUM 1 -+ - #define HNS3_SW_SHIFT_AND_DISCARD_MODE 0 - #define HNS3_HW_SHIFT_AND_DISCARD_MODE 1 - -diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c -index a278146..324c6b1 100644 ---- a/drivers/net/hns3/hns3_ethdev_vf.c -+++ b/drivers/net/hns3/hns3_ethdev_vf.c -@@ -1027,6 +1027,11 @@ hns3vf_dev_infos_get(struct rte_eth_dev *eth_dev, struct rte_eth_dev_info *info) - info->reta_size = hw->rss_ind_tbl_size; - info->hash_key_size = HNS3_RSS_KEY_SIZE; - info->flow_type_rss_offloads = HNS3_ETH_RSS_SUPPORT; -+ -+ info->default_rxportconf.burst_size = HNS3_DEFAULT_PORT_CONF_BURST_SIZE; -+ info->default_txportconf.burst_size = HNS3_DEFAULT_PORT_CONF_BURST_SIZE; -+ info->default_rxportconf.nb_queues = HNS3_DEFAULT_PORT_CONF_QUEUES_NUM; -+ info->default_txportconf.nb_queues = HNS3_DEFAULT_PORT_CONF_QUEUES_NUM; - info->default_rxportconf.ring_size = HNS3_DEFAULT_RING_DESC; - info->default_txportconf.ring_size = HNS3_DEFAULT_RING_DESC; - --- -2.7.4 - diff --git a/0141-net-hns3-delete-unused-markup.patch b/0141-net-hns3-delete-unused-markup.patch new file mode 100644 index 0000000000000000000000000000000000000000..ac54d7e9412529550dcb0e1cceba1399e6fcb079 --- /dev/null +++ b/0141-net-hns3-delete-unused-markup.patch @@ -0,0 +1,81 @@ +From a3cc39e81492da62dc98146c33f8f5dbb632e746 Mon Sep 17 00:00:00 2001 +From: Huisong Li +Date: Fri, 21 Oct 2022 15:36:17 +0800 +Subject: [PATCH 141/189] net/hns3: delete unused markup + +The '__rte_unused' tag in the input parameter of 'hns3_mac_stats_reset' +is redundant. This patch remove this tag. In addition, this function is +aimed to clear MAC statics. So using 'struct hns3_hw' as input parameter +is better than 'struct rte_eth_dev', and it also facilitates the call of +this function. + +Fixes: 8839c5e202f3 ("net/hns3: support device stats") +Cc: stable@dpdk.org + +Signed-off-by: Huisong Li +Signed-off-by: Dongdong Liu +--- + drivers/net/hns3/hns3_stats.c | 22 +++++----------------- + 1 file changed, 5 insertions(+), 17 deletions(-) + +diff --git a/drivers/net/hns3/hns3_stats.c b/drivers/net/hns3/hns3_stats.c +index d56d3ec174..c2af3bd231 100644 +--- a/drivers/net/hns3/hns3_stats.c ++++ b/drivers/net/hns3/hns3_stats.c +@@ -406,15 +406,6 @@ hns3_query_mac_stats_reg_num(struct hns3_hw *hw) + return 0; + } + +-static int +-hns3_query_update_mac_stats(struct rte_eth_dev *dev) +-{ +- struct hns3_adapter *hns = dev->data->dev_private; +- struct hns3_hw *hw = &hns->hw; +- +- return hns3_update_mac_stats(hw); +-} +- + static int + hns3_update_port_rpu_drop_stats(struct hns3_hw *hw) + { +@@ -763,14 +754,13 @@ hns3_stats_reset(struct rte_eth_dev *eth_dev) + } + + static int +-hns3_mac_stats_reset(__rte_unused struct rte_eth_dev *dev) ++hns3_mac_stats_reset(struct hns3_hw *hw) + { +- struct hns3_adapter *hns = dev->data->dev_private; +- struct hns3_hw *hw = &hns->hw; + struct hns3_mac_stats *mac_stats = &hw->mac_stats; + int ret; + +- ret = hns3_query_update_mac_stats(dev); ++ /* Clear hardware MAC statistics by reading it. */ ++ ret = hns3_update_mac_stats(hw); + if (ret) { + hns3_err(hw, "Clear Mac stats fail : %d", ret); + return ret; +@@ -1063,8 +1053,7 @@ hns3_dev_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *xstats, + hns3_tqp_basic_stats_get(dev, xstats, &count); + + if (!hns->is_vf) { +- /* Update Mac stats */ +- ret = hns3_query_update_mac_stats(dev); ++ ret = hns3_update_mac_stats(hw); + if (ret < 0) { + hns3_err(hw, "Update Mac stats fail : %d", ret); + rte_spinlock_unlock(&hw->stats_lock); +@@ -1482,8 +1471,7 @@ hns3_dev_xstats_reset(struct rte_eth_dev *dev) + if (hns->is_vf) + goto out; + +- /* HW registers are cleared on read */ +- ret = hns3_mac_stats_reset(dev); ++ ret = hns3_mac_stats_reset(hw); + + out: + rte_spinlock_unlock(&hw->stats_lock); +-- +2.23.0 + diff --git a/0141-net-hns3-log-time-delta-in-decimal-format.patch b/0141-net-hns3-log-time-delta-in-decimal-format.patch deleted file mode 100644 index fe551815c46832f10ff70ad799fe4acf3957be51..0000000000000000000000000000000000000000 --- a/0141-net-hns3-log-time-delta-in-decimal-format.patch +++ /dev/null @@ -1,50 +0,0 @@ -From 8d44b2b715e6fba4454cfbd754eb155b81060a2a Mon Sep 17 00:00:00 2001 -From: Chengwen Feng -Date: Wed, 28 Apr 2021 15:20:52 +0800 -Subject: [PATCH 141/189] net/hns3: log time delta in decimal format - -If the reset process cost too much time, driver will log one error -message which formats the time delta, but the formatting is using -hexadecimal which was not readable. - -This patch fixes it by formatting in decimal format. - -Fixes: 2790c6464725 ("net/hns3: support device reset") -Cc: stable@dpdk.org - -Signed-off-by: Chengwen Feng -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_ethdev.c | 2 +- - drivers/net/hns3/hns3_ethdev_vf.c | 2 +- - 2 files changed, 2 insertions(+), 2 deletions(-) - -diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c -index f532284..f6f1b3b 100644 ---- a/drivers/net/hns3/hns3_ethdev.c -+++ b/drivers/net/hns3/hns3_ethdev.c -@@ -6707,7 +6707,7 @@ hns3_reset_service(void *param) - msec = tv_delta.tv_sec * MSEC_PER_SEC + - tv_delta.tv_usec / USEC_PER_MSEC; - if (msec > HNS3_RESET_PROCESS_MS) -- hns3_err(hw, "%d handle long time delta %" PRIx64 -+ hns3_err(hw, "%d handle long time delta %" PRIu64 - " ms time=%ld.%.6ld", - hw->reset.level, msec, - tv.tv_sec, tv.tv_usec); -diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c -index 324c6b1..8ab3732 100644 ---- a/drivers/net/hns3/hns3_ethdev_vf.c -+++ b/drivers/net/hns3/hns3_ethdev_vf.c -@@ -2779,7 +2779,7 @@ hns3vf_reset_service(void *param) - msec = tv_delta.tv_sec * MSEC_PER_SEC + - tv_delta.tv_usec / USEC_PER_MSEC; - if (msec > HNS3_RESET_PROCESS_MS) -- hns3_err(hw, "%d handle long time delta %" PRIx64 -+ hns3_err(hw, "%d handle long time delta %" PRIu64 - " ms time=%ld.%.6ld", - hw->reset.level, msec, tv.tv_sec, tv.tv_usec); - } --- -2.7.4 - diff --git a/0142-net-hns3-fix-clearing-hardware-MAC-statistics.patch b/0142-net-hns3-fix-clearing-hardware-MAC-statistics.patch new file mode 100644 index 0000000000000000000000000000000000000000..9b7706b4d3482824fcd0ba6a24ae5443bd3ca334 --- /dev/null +++ b/0142-net-hns3-fix-clearing-hardware-MAC-statistics.patch @@ -0,0 +1,44 @@ +From 70cecb90da490a7f0d484ab9cd8bd481c17f20a3 Mon Sep 17 00:00:00 2001 +From: Huisong Li +Date: Fri, 21 Oct 2022 15:36:18 +0800 +Subject: [PATCH 142/189] net/hns3: fix clearing hardware MAC statistics + +In the situation that the driver hns3 exits abnormally during packets +sending and receiving, the hardware statistics are not cleared when the +driver hns3 is reloaded. It need to be cleared during driver hns3 +initialization that hardware MAC statistics. + +Fixes: 8839c5e202f3 ("net/hns3: support device stats") +Cc: stable@dpdk.org + +Signed-off-by: Huisong Li +Signed-off-by: Dongdong Liu +--- + drivers/net/hns3/hns3_stats.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/drivers/net/hns3/hns3_stats.c b/drivers/net/hns3/hns3_stats.c +index c2af3bd231..552ae9d30c 100644 +--- a/drivers/net/hns3/hns3_stats.c ++++ b/drivers/net/hns3/hns3_stats.c +@@ -1528,6 +1528,7 @@ hns3_tqp_stats_clear(struct hns3_hw *hw) + int + hns3_stats_init(struct hns3_hw *hw) + { ++ struct hns3_adapter *hns = HNS3_DEV_HW_TO_ADAPTER(hw); + int ret; + + rte_spinlock_init(&hw->stats_lock); +@@ -1538,6 +1539,9 @@ hns3_stats_init(struct hns3_hw *hw) + return ret; + } + ++ if (!hns->is_vf) ++ hns3_mac_stats_reset(hw); ++ + return hns3_tqp_stats_init(hw); + } + +-- +2.23.0 + diff --git a/0142-net-hns3-fix-time-delta-calculation.patch b/0142-net-hns3-fix-time-delta-calculation.patch deleted file mode 100644 index baac952076fba21ea15dc149bdb0f1940ee4266c..0000000000000000000000000000000000000000 --- a/0142-net-hns3-fix-time-delta-calculation.patch +++ /dev/null @@ -1,315 +0,0 @@ -From 4664bc17d0b90fa8935d6e5e6d0ec41a59c7e955 Mon Sep 17 00:00:00 2001 -From: Chengwen Feng -Date: Wed, 28 Apr 2021 15:20:53 +0800 -Subject: [PATCH 142/189] net/hns3: fix time delta calculation - -Currently, driver uses gettimeofday() API to get the time, and -then calculate the time delta, the delta will be used mainly in -judging timeout process. - -But the time which gets from gettimeofday() API isn't monotonically -increasing. The process may fail if the system time is changed. - -We use the following scheme to fix it: -1. Add hns3_clock_gettime() API which will get the monotonically - increasing time. -2. Add hns3_clock_calctime_ms() API which will get the milliseconds of - the monotonically increasing time. -3. Add hns3_clock_calctime_ms() API which will calc the milliseconds of - a given time. - -Fixes: 2790c6464725 ("net/hns3: support device reset") -Cc: stable@dpdk.org - -Signed-off-by: Chengwen Feng -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_ethdev.c | 46 +++++++++++++++++++++++++++++++++------ - drivers/net/hns3/hns3_ethdev.h | 12 +++------- - drivers/net/hns3/hns3_ethdev_vf.c | 11 +++++----- - drivers/net/hns3/hns3_intr.c | 34 ++++++++++++++--------------- - 4 files changed, 63 insertions(+), 40 deletions(-) - -diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c -index f6f1b3b..bba4d0f 100644 ---- a/drivers/net/hns3/hns3_ethdev.c -+++ b/drivers/net/hns3/hns3_ethdev.c -@@ -6343,7 +6343,7 @@ hns3_wait_hardware_ready(struct hns3_adapter *hns) - if (wait_data->result == HNS3_WAIT_SUCCESS) - return 0; - else if (wait_data->result == HNS3_WAIT_TIMEOUT) { -- gettimeofday(&tv, NULL); -+ hns3_clock_gettime(&tv); - hns3_warn(hw, "Reset step4 hardware not ready after reset time=%ld.%.6ld", - tv.tv_sec, tv.tv_usec); - return -ETIME; -@@ -6353,7 +6353,7 @@ hns3_wait_hardware_ready(struct hns3_adapter *hns) - wait_data->hns = hns; - wait_data->check_completion = is_pf_reset_done; - wait_data->end_ms = (uint64_t)HNS3_RESET_WAIT_CNT * -- HNS3_RESET_WAIT_MS + get_timeofday_ms(); -+ HNS3_RESET_WAIT_MS + hns3_clock_gettime_ms(); - wait_data->interval = HNS3_RESET_WAIT_MS * USEC_PER_MSEC; - wait_data->count = HNS3_RESET_WAIT_CNT; - wait_data->result = HNS3_WAIT_REQUEST; -@@ -6392,7 +6392,7 @@ hns3_msix_process(struct hns3_adapter *hns, enum hns3_reset_level reset_level) - struct timeval tv; - uint32_t val; - -- gettimeofday(&tv, NULL); -+ hns3_clock_gettime(&tv); - if (hns3_read_dev(hw, HNS3_GLOBAL_RESET_REG) || - hns3_read_dev(hw, HNS3_FUN_RST_ING)) { - hns3_warn(hw, "Don't process msix during resetting time=%ld.%.6ld", -@@ -6700,12 +6700,11 @@ hns3_reset_service(void *param) - */ - reset_level = hns3_get_reset_level(hns, &hw->reset.pending); - if (reset_level != HNS3_NONE_RESET) { -- gettimeofday(&tv_start, NULL); -+ hns3_clock_gettime(&tv_start); - ret = hns3_reset_process(hns, reset_level); -- gettimeofday(&tv, NULL); -+ hns3_clock_gettime(&tv); - timersub(&tv, &tv_start, &tv_delta); -- msec = tv_delta.tv_sec * MSEC_PER_SEC + -- tv_delta.tv_usec / USEC_PER_MSEC; -+ msec = hns3_clock_calctime_ms(&tv_delta); - if (msec > HNS3_RESET_PROCESS_MS) - hns3_err(hw, "%d handle long time delta %" PRIu64 - " ms time=%ld.%.6ld", -@@ -7205,6 +7204,39 @@ hns3_get_module_info(struct rte_eth_dev *dev, - return 0; - } - -+void -+hns3_clock_gettime(struct timeval *tv) -+{ -+#ifdef CLOCK_MONOTONIC_RAW /* Defined in glibc bits/time.h */ -+#define CLOCK_TYPE CLOCK_MONOTONIC_RAW -+#else -+#define CLOCK_TYPE CLOCK_MONOTONIC -+#endif -+#define NSEC_TO_USEC_DIV 1000 -+ -+ struct timespec spec; -+ (void)clock_gettime(CLOCK_TYPE, &spec); -+ -+ tv->tv_sec = spec.tv_sec; -+ tv->tv_usec = spec.tv_nsec / NSEC_TO_USEC_DIV; -+} -+ -+uint64_t -+hns3_clock_calctime_ms(struct timeval *tv) -+{ -+ return (uint64_t)tv->tv_sec * MSEC_PER_SEC + -+ tv->tv_usec / USEC_PER_MSEC; -+} -+ -+uint64_t -+hns3_clock_gettime_ms(void) -+{ -+ struct timeval tv; -+ -+ hns3_clock_gettime(&tv); -+ return hns3_clock_calctime_ms(&tv); -+} -+ - static int - hns3_parse_io_hint_func(const char *key, const char *value, void *extra_args) - { -diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h -index 29737c6..b65fb39 100644 ---- a/drivers/net/hns3/hns3_ethdev.h -+++ b/drivers/net/hns3/hns3_ethdev.h -@@ -1022,15 +1022,9 @@ static inline uint32_t hns3_read_reg(void *base, uint32_t reg) - #define MSEC_PER_SEC 1000L - #define USEC_PER_MSEC 1000L - --static inline uint64_t --get_timeofday_ms(void) --{ -- struct timeval tv; -- -- (void)gettimeofday(&tv, NULL); -- -- return (uint64_t)tv.tv_sec * MSEC_PER_SEC + tv.tv_usec / USEC_PER_MSEC; --} -+void hns3_clock_gettime(struct timeval *tv); -+uint64_t hns3_clock_calctime_ms(struct timeval *tv); -+uint64_t hns3_clock_gettime_ms(void); - - static inline uint64_t - hns3_atomic_test_bit(unsigned int nr, volatile uint64_t *addr) -diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c -index 8ab3732..f4d2a9f 100644 ---- a/drivers/net/hns3/hns3_ethdev_vf.c -+++ b/drivers/net/hns3/hns3_ethdev_vf.c -@@ -2507,7 +2507,7 @@ hns3vf_wait_hardware_ready(struct hns3_adapter *hns) - hns3_warn(hw, "hardware is ready, delay 1 sec for PF reset complete"); - return -EAGAIN; - } else if (wait_data->result == HNS3_WAIT_TIMEOUT) { -- gettimeofday(&tv, NULL); -+ hns3_clock_gettime(&tv); - hns3_warn(hw, "Reset step4 hardware not ready after reset time=%ld.%.6ld", - tv.tv_sec, tv.tv_usec); - return -ETIME; -@@ -2517,7 +2517,7 @@ hns3vf_wait_hardware_ready(struct hns3_adapter *hns) - wait_data->hns = hns; - wait_data->check_completion = is_vf_reset_done; - wait_data->end_ms = (uint64_t)HNS3VF_RESET_WAIT_CNT * -- HNS3VF_RESET_WAIT_MS + get_timeofday_ms(); -+ HNS3VF_RESET_WAIT_MS + hns3_clock_gettime_ms(); - wait_data->interval = HNS3VF_RESET_WAIT_MS * USEC_PER_MSEC; - wait_data->count = HNS3VF_RESET_WAIT_CNT; - wait_data->result = HNS3_WAIT_REQUEST; -@@ -2772,12 +2772,11 @@ hns3vf_reset_service(void *param) - */ - reset_level = hns3vf_get_reset_level(hw, &hw->reset.pending); - if (reset_level != HNS3_NONE_RESET) { -- gettimeofday(&tv_start, NULL); -+ hns3_clock_gettime(&tv_start); - hns3_reset_process(hns, reset_level); -- gettimeofday(&tv, NULL); -+ hns3_clock_gettime(&tv); - timersub(&tv, &tv_start, &tv_delta); -- msec = tv_delta.tv_sec * MSEC_PER_SEC + -- tv_delta.tv_usec / USEC_PER_MSEC; -+ msec = hns3_clock_calctime_ms(&tv_delta); - if (msec > HNS3_RESET_PROCESS_MS) - hns3_err(hw, "%d handle long time delta %" PRIu64 - " ms time=%ld.%.6ld", -diff --git a/drivers/net/hns3/hns3_intr.c b/drivers/net/hns3/hns3_intr.c -index 7385c7b..482541b 100644 ---- a/drivers/net/hns3/hns3_intr.c -+++ b/drivers/net/hns3/hns3_intr.c -@@ -2465,7 +2465,7 @@ hns3_wait_callback(void *param) - * Check if the current time exceeds the deadline - * or a pending reset coming, or reset during close. - */ -- msec = get_timeofday_ms(); -+ msec = hns3_clock_gettime_ms(); - if (msec > data->end_ms || is_reset_pending(hns) || - hw->adapter_state == HNS3_NIC_CLOSING) { - done = false; -@@ -2650,7 +2650,7 @@ hns3_reset_pre(struct hns3_adapter *hns) - __atomic_store_n(&hns->hw.reset.resetting, 1, __ATOMIC_RELAXED); - hw->reset.stage = RESET_STAGE_DOWN; - ret = hw->reset.ops->stop_service(hns); -- gettimeofday(&tv, NULL); -+ hns3_clock_gettime(&tv); - if (ret) { - hns3_warn(hw, "Reset step1 down fail=%d time=%ld.%.6ld", - ret, tv.tv_sec, tv.tv_usec); -@@ -2662,7 +2662,7 @@ hns3_reset_pre(struct hns3_adapter *hns) - } - if (hw->reset.stage == RESET_STAGE_PREWAIT) { - ret = hw->reset.ops->prepare_reset(hns); -- gettimeofday(&tv, NULL); -+ hns3_clock_gettime(&tv); - if (ret) { - hns3_warn(hw, - "Reset step2 prepare wait fail=%d time=%ld.%.6ld", -@@ -2700,7 +2700,7 @@ hns3_reset_post(struct hns3_adapter *hns) - } - ret = hw->reset.ops->reinit_dev(hns); - rte_spinlock_unlock(&hw->lock); -- gettimeofday(&tv, NULL); -+ hns3_clock_gettime(&tv); - if (ret) { - hns3_warn(hw, "Reset step5 devinit fail=%d retries=%d", - ret, hw->reset.retries); -@@ -2718,7 +2718,7 @@ hns3_reset_post(struct hns3_adapter *hns) - rte_spinlock_lock(&hw->lock); - ret = hw->reset.ops->restore_conf(hns); - rte_spinlock_unlock(&hw->lock); -- gettimeofday(&tv, NULL); -+ hns3_clock_gettime(&tv); - if (ret) { - hns3_warn(hw, - "Reset step6 restore fail=%d retries=%d", -@@ -2741,7 +2741,7 @@ hns3_reset_post(struct hns3_adapter *hns) - rte_spinlock_lock(&hw->lock); - hw->reset.ops->start_service(hns); - rte_spinlock_unlock(&hw->lock); -- gettimeofday(&tv, NULL); -+ hns3_clock_gettime(&tv); - timersub(&tv, &hw->reset.start_time, &tv_delta); - hns3_warn(hw, "%s reset done fail_cnt:%" PRIx64 - " success_cnt:%" PRIx64 " global_cnt:%" PRIx64 -@@ -2753,10 +2753,9 @@ hns3_reset_post(struct hns3_adapter *hns) - hw->reset.stats.request_cnt, hw->reset.stats.exec_cnt, - hw->reset.stats.merge_cnt); - hns3_warn(hw, -- "%s reset done delta %ld ms time=%ld.%.6ld", -+ "%s reset done delta %" PRIu64 " ms time=%ld.%.6ld", - reset_string[hw->reset.level], -- tv_delta.tv_sec * MSEC_PER_SEC + -- tv_delta.tv_usec / USEC_PER_MSEC, -+ hns3_clock_calctime_ms(&tv_delta), - tv.tv_sec, tv.tv_usec); - hw->reset.level = HNS3_NONE_RESET; - } -@@ -2796,7 +2795,7 @@ hns3_reset_process(struct hns3_adapter *hns, enum hns3_reset_level new_level) - if (hw->reset.level == HNS3_NONE_RESET) { - hw->reset.level = new_level; - hw->reset.stats.exec_cnt++; -- gettimeofday(&hw->reset.start_time, NULL); -+ hns3_clock_gettime(&hw->reset.start_time); - hns3_warn(hw, "Start %s reset time=%ld.%.6ld", - reset_string[hw->reset.level], - hw->reset.start_time.tv_sec, -@@ -2804,7 +2803,7 @@ hns3_reset_process(struct hns3_adapter *hns, enum hns3_reset_level new_level) - } - - if (is_reset_pending(hns)) { -- gettimeofday(&tv, NULL); -+ hns3_clock_gettime(&tv); - hns3_warn(hw, - "%s reset is aborted by high level time=%ld.%.6ld", - reset_string[hw->reset.level], tv.tv_sec, tv.tv_usec); -@@ -2822,7 +2821,7 @@ hns3_reset_process(struct hns3_adapter *hns, enum hns3_reset_level new_level) - ret = hns3_reset_req_hw_reset(hns); - if (ret == -EAGAIN) - return ret; -- gettimeofday(&tv, NULL); -+ hns3_clock_gettime(&tv); - hns3_warn(hw, - "Reset step3 request IMP reset success time=%ld.%.6ld", - tv.tv_sec, tv.tv_usec); -@@ -2833,7 +2832,7 @@ hns3_reset_process(struct hns3_adapter *hns, enum hns3_reset_level new_level) - ret = hw->reset.ops->wait_hardware_ready(hns); - if (ret) - goto retry; -- gettimeofday(&tv, NULL); -+ hns3_clock_gettime(&tv); - hns3_warn(hw, "Reset step4 reset wait success time=%ld.%.6ld", - tv.tv_sec, tv.tv_usec); - hw->reset.stage = RESET_STAGE_DEV_INIT; -@@ -2861,12 +2860,11 @@ hns3_reset_process(struct hns3_adapter *hns, enum hns3_reset_level new_level) - rte_spinlock_unlock(&hw->lock); - __atomic_store_n(&hns->hw.reset.resetting, 0, __ATOMIC_RELAXED); - hw->reset.stage = RESET_STAGE_NONE; -- gettimeofday(&tv, NULL); -+ hns3_clock_gettime(&tv); - timersub(&tv, &hw->reset.start_time, &tv_delta); -- hns3_warn(hw, "%s reset fail delta %ld ms time=%ld.%.6ld", -+ hns3_warn(hw, "%s reset fail delta %" PRIu64 " ms time=%ld.%.6ld", - reset_string[hw->reset.level], -- tv_delta.tv_sec * MSEC_PER_SEC + -- tv_delta.tv_usec / USEC_PER_MSEC, -+ hns3_clock_calctime_ms(&tv_delta), - tv.tv_sec, tv.tv_usec); - hw->reset.level = HNS3_NONE_RESET; - } -@@ -2898,7 +2896,7 @@ hns3_reset_abort(struct hns3_adapter *hns) - rte_eal_alarm_cancel(hns3_wait_callback, hw->reset.wait_data); - - if (hw->reset.level != HNS3_NONE_RESET) { -- gettimeofday(&tv, NULL); -+ hns3_clock_gettime(&tv); - hns3_err(hw, "Failed to terminate reset: %s time=%ld.%.6ld", - reset_string[hw->reset.level], tv.tv_sec, tv.tv_usec); - } --- -2.7.4 - diff --git a/0143-net-hns3-revert-Tx-performance-optimization.patch b/0143-net-hns3-revert-Tx-performance-optimization.patch new file mode 100644 index 0000000000000000000000000000000000000000..41fb7b0ce89895b39245df54bd65d7d1509588a0 --- /dev/null +++ b/0143-net-hns3-revert-Tx-performance-optimization.patch @@ -0,0 +1,185 @@ +From 39caf6f8ce22bb3d8af12ab16b1182fe1679698d Mon Sep 17 00:00:00 2001 +From: Chengwen Feng +Date: Fri, 21 Oct 2022 15:36:19 +0800 +Subject: [PATCH 143/189] net/hns3: revert Tx performance optimization + +The Tx performance deteriorates in the case of larger packets size and +larger burst. It may take a long time to optimize in these scenarios, +so this commit reverts +commit 0b77e8f3d364 ("net/hns3: optimize Tx performance") + +Fixes: 0b77e8f3d364 ("net/hns3: optimize Tx performance") +Cc: stable@dpdk.org + +Signed-off-by: Chengwen Feng +Signed-off-by: Dongdong Liu +--- + drivers/net/hns3/hns3_rxtx.c | 115 ++++++++++++++++++----------------- + 1 file changed, 60 insertions(+), 55 deletions(-) + +diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c +index 93cc70477d..21c3ef72b1 100644 +--- a/drivers/net/hns3/hns3_rxtx.c ++++ b/drivers/net/hns3/hns3_rxtx.c +@@ -3075,51 +3075,40 @@ hns3_tx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t nb_desc, + return 0; + } + +-static int ++static void + hns3_tx_free_useless_buffer(struct hns3_tx_queue *txq) + { + uint16_t tx_next_clean = txq->next_to_clean; +- uint16_t tx_next_use = txq->next_to_use; +- struct hns3_entry *tx_entry = &txq->sw_ring[tx_next_clean]; ++ uint16_t tx_next_use = txq->next_to_use; ++ uint16_t tx_bd_ready = txq->tx_bd_ready; ++ uint16_t tx_bd_max = txq->nb_tx_desc; ++ struct hns3_entry *tx_bak_pkt = &txq->sw_ring[tx_next_clean]; + struct hns3_desc *desc = &txq->tx_ring[tx_next_clean]; +- uint16_t i; +- +- if (tx_next_use >= tx_next_clean && +- tx_next_use < tx_next_clean + txq->tx_rs_thresh) +- return -1; ++ struct rte_mbuf *mbuf; + +- /* +- * All mbufs can be released only when the VLD bits of all +- * descriptors in a batch are cleared. +- */ +- for (i = 0; i < txq->tx_rs_thresh; i++) { +- if (desc[i].tx.tp_fe_sc_vld_ra_ri & +- rte_le_to_cpu_16(BIT(HNS3_TXD_VLD_B))) +- return -1; +- } ++ while ((!(desc->tx.tp_fe_sc_vld_ra_ri & ++ rte_cpu_to_le_16(BIT(HNS3_TXD_VLD_B)))) && ++ tx_next_use != tx_next_clean) { ++ mbuf = tx_bak_pkt->mbuf; ++ if (mbuf) { ++ rte_pktmbuf_free_seg(mbuf); ++ tx_bak_pkt->mbuf = NULL; ++ } + +- for (i = 0; i < txq->tx_rs_thresh; i++) { +- rte_pktmbuf_free_seg(tx_entry[i].mbuf); +- tx_entry[i].mbuf = NULL; ++ desc++; ++ tx_bak_pkt++; ++ tx_next_clean++; ++ tx_bd_ready++; ++ ++ if (tx_next_clean >= tx_bd_max) { ++ tx_next_clean = 0; ++ desc = txq->tx_ring; ++ tx_bak_pkt = txq->sw_ring; ++ } + } + +- /* Update numbers of available descriptor due to buffer freed */ +- txq->tx_bd_ready += txq->tx_rs_thresh; +- txq->next_to_clean += txq->tx_rs_thresh; +- if (txq->next_to_clean >= txq->nb_tx_desc) +- txq->next_to_clean = 0; +- +- return 0; +-} +- +-static inline int +-hns3_tx_free_required_buffer(struct hns3_tx_queue *txq, uint16_t required_bds) +-{ +- while (required_bds > txq->tx_bd_ready) { +- if (hns3_tx_free_useless_buffer(txq) != 0) +- return -1; +- } +- return 0; ++ txq->next_to_clean = tx_next_clean; ++ txq->tx_bd_ready = tx_bd_ready; + } + + int +@@ -4162,8 +4151,7 @@ hns3_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) + uint16_t nb_tx; + uint16_t i; + +- if (txq->tx_bd_ready < txq->tx_free_thresh) +- (void)hns3_tx_free_useless_buffer(txq); ++ hns3_tx_free_useless_buffer(txq); + + tx_next_use = txq->next_to_use; + tx_bd_max = txq->nb_tx_desc; +@@ -4178,14 +4166,10 @@ hns3_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) + nb_buf = tx_pkt->nb_segs; + + if (nb_buf > txq->tx_bd_ready) { +- /* Try to release the required MBUF, but avoid releasing +- * all MBUFs, otherwise, the MBUFs will be released for +- * a long time and may cause jitter. +- */ +- if (hns3_tx_free_required_buffer(txq, nb_buf) != 0) { +- txq->dfx_stats.queue_full_cnt++; +- goto end_of_tx; +- } ++ txq->dfx_stats.queue_full_cnt++; ++ if (nb_tx == 0) ++ return 0; ++ goto end_of_tx; + } + + /* +@@ -4609,22 +4593,43 @@ hns3_dev_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id) + static int + hns3_tx_done_cleanup_full(struct hns3_tx_queue *txq, uint32_t free_cnt) + { +- uint16_t round_cnt; ++ uint16_t next_to_clean = txq->next_to_clean; ++ uint16_t next_to_use = txq->next_to_use; ++ uint16_t tx_bd_ready = txq->tx_bd_ready; ++ struct hns3_entry *tx_pkt = &txq->sw_ring[next_to_clean]; ++ struct hns3_desc *desc = &txq->tx_ring[next_to_clean]; + uint32_t idx; + + if (free_cnt == 0 || free_cnt > txq->nb_tx_desc) + free_cnt = txq->nb_tx_desc; + +- if (txq->tx_rs_thresh == 0) +- return 0; +- +- round_cnt = rounddown(free_cnt, txq->tx_rs_thresh); +- for (idx = 0; idx < round_cnt; idx += txq->tx_rs_thresh) { +- if (hns3_tx_free_useless_buffer(txq) != 0) ++ for (idx = 0; idx < free_cnt; idx++) { ++ if (next_to_clean == next_to_use) ++ break; ++ if (desc->tx.tp_fe_sc_vld_ra_ri & ++ rte_cpu_to_le_16(BIT(HNS3_TXD_VLD_B))) + break; ++ if (tx_pkt->mbuf != NULL) { ++ rte_pktmbuf_free_seg(tx_pkt->mbuf); ++ tx_pkt->mbuf = NULL; ++ } ++ next_to_clean++; ++ tx_bd_ready++; ++ tx_pkt++; ++ desc++; ++ if (next_to_clean == txq->nb_tx_desc) { ++ tx_pkt = txq->sw_ring; ++ desc = txq->tx_ring; ++ next_to_clean = 0; ++ } ++ } ++ ++ if (idx > 0) { ++ txq->next_to_clean = next_to_clean; ++ txq->tx_bd_ready = tx_bd_ready; + } + +- return idx; ++ return (int)idx; + } + + int +-- +2.23.0 + diff --git a/0143-net-hns3-select-Tx-prepare-based-on-Tx-offload.patch b/0143-net-hns3-select-Tx-prepare-based-on-Tx-offload.patch deleted file mode 100644 index 0de4aca94434b72468886c279c5c8be40b8ba9b5..0000000000000000000000000000000000000000 --- a/0143-net-hns3-select-Tx-prepare-based-on-Tx-offload.patch +++ /dev/null @@ -1,110 +0,0 @@ -From 9392190f55c0eeef207370b4fcbc7f7249ee5231 Mon Sep 17 00:00:00 2001 -From: Chengchang Tang -Date: Wed, 28 Apr 2021 15:20:55 +0800 -Subject: [PATCH 143/189] net/hns3: select Tx prepare based on Tx offload - -Tx prepare should be called only when necessary to reduce the impact on -performance. - -For partial TX offload, users need to call rte_eth_tx_prepare() to -invoke the tx_prepare callback of PMDs. In this callback, the PMDs -adjust the packet based on the offloading used by the user. (e.g. For -some PMDs, pseudo-headers need to be calculated when the TX cksum is -offloaded.) - -However, for the users, they cannot grasp all the hardware and PMDs -characteristics. As a result, users cannot decide when they need to -actually call tx_prepare. Therefore, we should assume that the user -calls rte_eth_tx_prepare() when using any Tx offloading to ensure that -related functions work properly. Whether packets need to be adjusted -should be determined by PMDs. They can make judgments in the -dev_configure or queue_setup phase. When the related function is not -used, the pointer of tx_prepare should be set to NULL to reduce the -performance loss caused by invoking rte_eth_tx_repare(). - -In this patch, if tx_prepare is not required for the offloading used by -the users, the tx_prepare pointer will be set to NULL. - -Fixes: bba636698316 ("net/hns3: support Rx/Tx and related operations") -Cc: stable@dpdk.org - -Signed-off-by: Chengchang Tang -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_rxtx.c | 36 +++++++++++++++++++++++++++++++++--- - 1 file changed, 33 insertions(+), 3 deletions(-) - -diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c -index 92d377b..f4df3e2 100644 ---- a/drivers/net/hns3/hns3_rxtx.c -+++ b/drivers/net/hns3/hns3_rxtx.c -@@ -4203,17 +4203,45 @@ hns3_tx_check_simple_support(struct rte_eth_dev *dev) - return (offloads == (offloads & DEV_TX_OFFLOAD_MBUF_FAST_FREE)); - } - -+static bool -+hns3_get_tx_prep_needed(struct rte_eth_dev *dev) -+{ -+#ifdef RTE_LIBRTE_ETHDEV_DEBUG -+ /* always perform tx_prepare when debug */ -+ return true; -+#else -+#define HNS3_DEV_TX_CSKUM_TSO_OFFLOAD_MASK (\ -+ DEV_TX_OFFLOAD_IPV4_CKSUM | \ -+ DEV_TX_OFFLOAD_TCP_CKSUM | \ -+ DEV_TX_OFFLOAD_UDP_CKSUM | \ -+ DEV_TX_OFFLOAD_SCTP_CKSUM | \ -+ DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM | \ -+ DEV_TX_OFFLOAD_OUTER_UDP_CKSUM | \ -+ DEV_TX_OFFLOAD_TCP_TSO | \ -+ DEV_TX_OFFLOAD_VXLAN_TNL_TSO | \ -+ DEV_TX_OFFLOAD_GRE_TNL_TSO | \ -+ DEV_TX_OFFLOAD_GENEVE_TNL_TSO) -+ -+ uint64_t tx_offload = dev->data->dev_conf.txmode.offloads; -+ if (tx_offload & HNS3_DEV_TX_CSKUM_TSO_OFFLOAD_MASK) -+ return true; -+ -+ return false; -+#endif -+} -+ - static eth_tx_burst_t - hns3_get_tx_function(struct rte_eth_dev *dev, eth_tx_prep_t *prep) - { - struct hns3_adapter *hns = dev->data->dev_private; - bool vec_allowed, sve_allowed, simple_allowed; -- bool vec_support; -+ bool vec_support, tx_prepare_needed; - - vec_support = hns3_tx_check_vec_support(dev) == 0; - vec_allowed = vec_support && hns3_get_default_vec_support(); - sve_allowed = vec_support && hns3_get_sve_support(); - simple_allowed = hns3_tx_check_simple_support(dev); -+ tx_prepare_needed = hns3_get_tx_prep_needed(dev); - - *prep = NULL; - -@@ -4224,7 +4252,8 @@ hns3_get_tx_function(struct rte_eth_dev *dev, eth_tx_prep_t *prep) - if (hns->tx_func_hint == HNS3_IO_FUNC_HINT_SIMPLE && simple_allowed) - return hns3_xmit_pkts_simple; - if (hns->tx_func_hint == HNS3_IO_FUNC_HINT_COMMON) { -- *prep = hns3_prep_pkts; -+ if (tx_prepare_needed) -+ *prep = hns3_prep_pkts; - return hns3_xmit_pkts; - } - -@@ -4233,7 +4262,8 @@ hns3_get_tx_function(struct rte_eth_dev *dev, eth_tx_prep_t *prep) - if (simple_allowed) - return hns3_xmit_pkts_simple; - -- *prep = hns3_prep_pkts; -+ if (tx_prepare_needed) -+ *prep = hns3_prep_pkts; - return hns3_xmit_pkts; - } - --- -2.7.4 - diff --git a/0144-net-hns3-fix-MAC-enable-failure-rollback.patch b/0144-net-hns3-fix-MAC-enable-failure-rollback.patch deleted file mode 100644 index 6409e63074a1071853a24ce8d4a69b9abfa97cac..0000000000000000000000000000000000000000 --- a/0144-net-hns3-fix-MAC-enable-failure-rollback.patch +++ /dev/null @@ -1,40 +0,0 @@ -From 16635e5c21b02e649d7babe0db6364bfaba71bc3 Mon Sep 17 00:00:00 2001 -From: Huisong Li -Date: Thu, 29 Apr 2021 17:03:59 +0800 -Subject: [PATCH 144/189] net/hns3: fix MAC enable failure rollback - -If driver fails to enable MAC, it does not need to rollback the MAC -configuration. This patch fixes it. - -Fixes: bdaf190f8235 ("net/hns3: support link speed autoneg for PF") - -Signed-off-by: Huisong Li -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_ethdev.c | 6 ++++-- - 1 file changed, 4 insertions(+), 2 deletions(-) - -diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c -index bba4d0f..f5160ed 100644 ---- a/drivers/net/hns3/hns3_ethdev.c -+++ b/drivers/net/hns3/hns3_ethdev.c -@@ -5605,12 +5605,14 @@ hns3_do_start(struct hns3_adapter *hns, bool reset_queue) - - ret = hns3_apply_link_speed(hw); - if (ret) -- goto err_config_mac_mode; -+ goto err_set_link_speed; - - return 0; - --err_config_mac_mode: -+err_set_link_speed: - (void)hns3_cfg_mac_mode(hw, false); -+ -+err_config_mac_mode: - hns3_dev_release_mbufs(hns); - /* - * Here is exception handling, hns3_reset_all_tqps will have the --- -2.7.4 - diff --git a/0144-net-hns3-fix-RSS-rule-restore.patch b/0144-net-hns3-fix-RSS-rule-restore.patch new file mode 100644 index 0000000000000000000000000000000000000000..2eca942fe6ded2951c5955d6f4c50ed213570997 --- /dev/null +++ b/0144-net-hns3-fix-RSS-rule-restore.patch @@ -0,0 +1,71 @@ +From 85b5d5a0807856f276bb382af7a443e030975cce Mon Sep 17 00:00:00 2001 +From: Huisong Li +Date: Fri, 21 Oct 2022 15:36:20 +0800 +Subject: [PATCH 144/189] net/hns3: fix RSS rule restore + +The 'hns3_restore_rss_filter' function is used to restore RSS rule. +But this function calls the 'hns3_config_rss_filter' which sets the +last to invalid in flow RSS list. This causes the flow RSS list has +no valid rule. + +Fixes: ec674cb742e5 ("net/hns3: fix flushing RSS rule") +Cc: stable@dpdk.org + +Signed-off-by: Huisong Li +Signed-off-by: Dongdong Liu +--- + drivers/net/hns3/hns3_flow.c | 17 +++++++++-------- + 1 file changed, 9 insertions(+), 8 deletions(-) + +diff --git a/drivers/net/hns3/hns3_flow.c b/drivers/net/hns3/hns3_flow.c +index 5e0a9bc93f..8b9bfe4880 100644 +--- a/drivers/net/hns3/hns3_flow.c ++++ b/drivers/net/hns3/hns3_flow.c +@@ -1539,7 +1539,6 @@ hns3_config_rss_filter(struct rte_eth_dev *dev, + const struct hns3_rss_conf *conf, bool add) + { + struct hns3_adapter *hns = dev->data->dev_private; +- struct hns3_rss_conf_ele *rss_filter_ptr; + struct hns3_hw *hw = &hns->hw; + struct hns3_rss_conf *rss_info; + uint64_t flow_types; +@@ -1618,13 +1617,6 @@ hns3_config_rss_filter(struct rte_eth_dev *dev, + goto rss_config_err; + } + +- /* +- * When create a new RSS rule, the old rule will be overlaid and set +- * invalid. +- */ +- TAILQ_FOREACH(rss_filter_ptr, &hw->flow_rss_list, entries) +- rss_filter_ptr->filter_info.valid = false; +- + rss_config_err: + rte_spinlock_unlock(&hw->lock); + +@@ -1749,6 +1741,7 @@ hns3_flow_create_rss_rule(struct rte_eth_dev *dev, + { + struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private); + struct hns3_rss_conf_ele *rss_filter_ptr; ++ struct hns3_rss_conf_ele *filter_ptr; + const struct hns3_rss_conf *rss_conf; + int ret; + +@@ -1773,6 +1766,14 @@ hns3_flow_create_rss_rule(struct rte_eth_dev *dev, + + hns3_rss_conf_copy(&rss_filter_ptr->filter_info, &rss_conf->conf); + rss_filter_ptr->filter_info.valid = true; ++ ++ /* ++ * When create a new RSS rule, the old rule will be overlaid and set ++ * invalid. ++ */ ++ TAILQ_FOREACH(filter_ptr, &hw->flow_rss_list, entries) ++ filter_ptr->filter_info.valid = false; ++ + TAILQ_INSERT_TAIL(&hw->flow_rss_list, rss_filter_ptr, entries); + flow->rule = rss_filter_ptr; + flow->filter_type = RTE_ETH_FILTER_HASH; +-- +2.23.0 + diff --git a/0145-net-hns3-fix-IEEE-1588-PTP-for-scalar-scattered-Rx.patch b/0145-net-hns3-fix-IEEE-1588-PTP-for-scalar-scattered-Rx.patch deleted file mode 100644 index 1969daf0d3af3e1d4b3375e6e03028db05c94d0b..0000000000000000000000000000000000000000 --- a/0145-net-hns3-fix-IEEE-1588-PTP-for-scalar-scattered-Rx.patch +++ /dev/null @@ -1,45 +0,0 @@ -From 3ac46c2a0e35e79fd2e9f9a8c0b05c71e944caae Mon Sep 17 00:00:00 2001 -From: "Min Hu (Connor)" -Date: Thu, 29 Apr 2021 17:19:03 +0800 -Subject: [PATCH 145/189] net/hns3: fix IEEE 1588 PTP for scalar scattered Rx - -When jumbo frame is enabled, Rx function will choose 'Scalar Scattered' -function which has no PTP handling. - -This patch fixes it by adding PTP handling in 'Scalar Scattered' -function. - -Fixes: 38b539d96eb6 ("net/hns3: support IEEE 1588 PTP") - -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_rxtx.c | 6 ++++++ - 1 file changed, 6 insertions(+) - -diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c -index f4df3e2..bc4a9a5 100644 ---- a/drivers/net/hns3/hns3_rxtx.c -+++ b/drivers/net/hns3/hns3_rxtx.c -@@ -2654,6 +2654,9 @@ hns3_recv_scattered_pkts(void *rx_queue, - continue; - } - -+ if (unlikely(bd_base_info & BIT(HNS3_RXD_TS_VLD_B))) -+ hns3_rx_ptp_timestamp_handle(rxq, first_seg, rxdp); -+ - /* - * The last buffer of the received packet. packet len from - * buffer description may contains CRC len, packet len should -@@ -2704,6 +2707,9 @@ hns3_recv_scattered_pkts(void *rx_queue, - first_seg->packet_type = hns3_rx_calc_ptype(rxq, - l234_info, ol_info); - -+ if (first_seg->packet_type == RTE_PTYPE_L2_ETHER_TIMESYNC) -+ rxm->ol_flags |= PKT_RX_IEEE1588_PTP; -+ - hns3_rxd_to_vlan_tci(rxq, first_seg, l234_info, &rxd); - - /* Increment bytes counter */ --- -2.7.4 - diff --git a/0145-net-hns3-fix-RSS-filter-restore.patch b/0145-net-hns3-fix-RSS-filter-restore.patch new file mode 100644 index 0000000000000000000000000000000000000000..6860ca51f99ed181013d50f2c41e89d30fe59832 --- /dev/null +++ b/0145-net-hns3-fix-RSS-filter-restore.patch @@ -0,0 +1,65 @@ +From 2e78798fe932e9064677c6f2d1ea14542c503202 Mon Sep 17 00:00:00 2001 +From: Huisong Li +Date: Fri, 21 Oct 2022 15:36:21 +0800 +Subject: [PATCH 145/189] net/hns3: fix RSS filter restore + +Currently, driver sets RSS function to 'RTE_ETH_HASH_FUNCTION_MAX' +when user flush all rules in order to judge whether driver needs +to restore RSS rules. In fact, all rules are saved in flow RSS list. +So there is no need to modify RSS function to this macro. And this +list can be used to restore. The modification of RSS function may +introduce new problem. + +Fixes: eb158fc756a5 ("net/hns3: fix config when creating RSS rule after flush") +Cc: stable@dpdk.org + +Signed-off-by: Huisong Li +Signed-off-by: Dongdong Liu +--- + drivers/net/hns3/hns3_flow.c | 20 ++++++++++++++------ + 1 file changed, 14 insertions(+), 6 deletions(-) + +diff --git a/drivers/net/hns3/hns3_flow.c b/drivers/net/hns3/hns3_flow.c +index 8b9bfe4880..82ead96854 100644 +--- a/drivers/net/hns3/hns3_flow.c ++++ b/drivers/net/hns3/hns3_flow.c +@@ -1587,8 +1587,6 @@ hns3_config_rss_filter(struct rte_eth_dev *dev, + rss_info->conf.queue_num = 0; + } + +- /* set RSS func invalid after flushed */ +- rss_info->conf.func = RTE_ETH_HASH_FUNCTION_MAX; + return 0; + } + +@@ -1659,13 +1657,23 @@ int + hns3_restore_rss_filter(struct rte_eth_dev *dev) + { + struct hns3_adapter *hns = dev->data->dev_private; ++ struct hns3_rss_conf_ele *filter; + struct hns3_hw *hw = &hns->hw; ++ int ret = 0; + +- /* When user flush all rules, it doesn't need to restore RSS rule */ +- if (hw->rss_info.conf.func == RTE_ETH_HASH_FUNCTION_MAX) +- return 0; ++ TAILQ_FOREACH(filter, &hw->flow_rss_list, entries) { ++ if (!filter->filter_info.valid) ++ continue; + +- return hns3_config_rss_filter(dev, &hw->rss_info, true); ++ ret = hns3_config_rss_filter(dev, &filter->filter_info, true); ++ if (ret != 0) { ++ hns3_err(hw, "restore RSS filter failed, ret=%d", ret); ++ goto out; ++ } ++ } ++ ++out: ++ return ret; + } + + static int +-- +2.23.0 + diff --git a/0146-net-hns3-fix-lock-protection-of-RSS-flow-rule.patch b/0146-net-hns3-fix-lock-protection-of-RSS-flow-rule.patch new file mode 100644 index 0000000000000000000000000000000000000000..e2b0e4b9679891688a5db80a3946fd75acd3cc6a --- /dev/null +++ b/0146-net-hns3-fix-lock-protection-of-RSS-flow-rule.patch @@ -0,0 +1,74 @@ +From baa250c283ba4180f3ac55b42c74f98d85860598 Mon Sep 17 00:00:00 2001 +From: Huisong Li +Date: Fri, 21 Oct 2022 15:36:22 +0800 +Subject: [PATCH 146/189] net/hns3: fix lock protection of RSS flow rule + +RSS flow rules are saved in RSS filter linked list. The linked +list is modified by rte_flow API and is used to restore RSS rules +during reset process. So this patch uses 'hw->flows_lock' to protect +the configuration and recovery of RSS rule. + +Fixes: c37ca66f2b27 ("net/hns3: support RSS") +Cc: stable@dpdk.org + +Signed-off-by: Huisong Li +Signed-off-by: Dongdong Liu +--- + drivers/net/hns3/hns3_flow.c | 16 ++++++---------- + 1 file changed, 6 insertions(+), 10 deletions(-) + +diff --git a/drivers/net/hns3/hns3_flow.c b/drivers/net/hns3/hns3_flow.c +index 82ead96854..301a4a56b3 100644 +--- a/drivers/net/hns3/hns3_flow.c ++++ b/drivers/net/hns3/hns3_flow.c +@@ -1596,27 +1596,20 @@ hns3_config_rss_filter(struct rte_eth_dev *dev, + hns3_warn(hw, "Config queue numbers %u are beyond the scope of truncated", + rss_flow_conf.queue_num); + hns3_info(hw, "Max of contiguous %u PF queues are configured", num); +- +- rte_spinlock_lock(&hw->lock); + if (num) { + ret = hns3_update_indir_table(dev, &rss_flow_conf, num); + if (ret) +- goto rss_config_err; ++ return ret; + } + + /* Set hash algorithm and flow types by the user's config */ + ret = hns3_hw_rss_hash_set(hw, &rss_flow_conf); + if (ret) +- goto rss_config_err; ++ return ret; + + ret = hns3_rss_conf_copy(rss_info, &rss_flow_conf); +- if (ret) { ++ if (ret) + hns3_err(hw, "RSS config init fail(%d)", ret); +- goto rss_config_err; +- } +- +-rss_config_err: +- rte_spinlock_unlock(&hw->lock); + + return ret; + } +@@ -1661,6 +1654,7 @@ hns3_restore_rss_filter(struct rte_eth_dev *dev) + struct hns3_hw *hw = &hns->hw; + int ret = 0; + ++ pthread_mutex_lock(&hw->flows_lock); + TAILQ_FOREACH(filter, &hw->flow_rss_list, entries) { + if (!filter->filter_info.valid) + continue; +@@ -1673,6 +1667,8 @@ hns3_restore_rss_filter(struct rte_eth_dev *dev) + } + + out: ++ pthread_mutex_unlock(&hw->flows_lock); ++ + return ret; + } + +-- +2.23.0 + diff --git a/0146-net-hns3-remove-some-unused-capabilities.patch b/0146-net-hns3-remove-some-unused-capabilities.patch deleted file mode 100644 index 08825389492cb04644834923669cb47cc9b380e1..0000000000000000000000000000000000000000 --- a/0146-net-hns3-remove-some-unused-capabilities.patch +++ /dev/null @@ -1,157 +0,0 @@ -From f92b61b4be62100b35e5d3fb7513c12ef1148409 Mon Sep 17 00:00:00 2001 -From: Chengwen Feng -Date: Fri, 30 Apr 2021 14:28:45 +0800 -Subject: [PATCH 146/189] net/hns3: remove some unused capabilities - -This patch deletes some unused capabilities, include: -1. Delete some unused firmware capabilities definition, which are: - UDP_GSO, ATR, INT_QL, SIMPLE_BD, TX_PUSH, FEC and PAUSE. -2. Delete some unused driver capabilities definition, which are: - UDP_GSO, TX_PUSH. -3. Also redefine HNS3_DEV_SUPPORT_* as enum type, and change some of - the values. Note: the HNS3_DEV_SUPPORT_* values is used only inside - the driver, so it's safe to change the values. - -Signed-off-by: Chengwen Feng -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_cmd.c | 11 ----------- - drivers/net/hns3/hns3_cmd.h | 17 +++++++---------- - drivers/net/hns3/hns3_ethdev.h | 29 +++++++++++------------------ - 3 files changed, 18 insertions(+), 39 deletions(-) - -diff --git a/drivers/net/hns3/hns3_cmd.c b/drivers/net/hns3/hns3_cmd.c -index 5eb8789..a43385b 100644 ---- a/drivers/net/hns3/hns3_cmd.c -+++ b/drivers/net/hns3/hns3_cmd.c -@@ -423,21 +423,14 @@ hns3_get_caps_name(uint32_t caps_id) - enum HNS3_CAPS_BITS caps; - const char *name; - } dev_caps[] = { -- { HNS3_CAPS_UDP_GSO_B, "udp_gso" }, -- { HNS3_CAPS_ATR_B, "atr" }, - { HNS3_CAPS_FD_QUEUE_REGION_B, "fd_queue_region" }, - { HNS3_CAPS_PTP_B, "ptp" }, -- { HNS3_CAPS_INT_QL_B, "int_ql" }, -- { HNS3_CAPS_SIMPLE_BD_B, "simple_bd" }, -- { HNS3_CAPS_TX_PUSH_B, "tx_push" }, - { HNS3_CAPS_PHY_IMP_B, "phy_imp" }, - { HNS3_CAPS_TQP_TXRX_INDEP_B, "tqp_txrx_indep" }, - { HNS3_CAPS_HW_PAD_B, "hw_pad" }, - { HNS3_CAPS_STASH_B, "stash" }, - { HNS3_CAPS_UDP_TUNNEL_CSUM_B, "udp_tunnel_csum" }, - { HNS3_CAPS_RAS_IMP_B, "ras_imp" }, -- { HNS3_CAPS_FEC_B, "fec" }, -- { HNS3_CAPS_PAUSE_B, "pause" }, - { HNS3_CAPS_RXD_ADV_LAYOUT_B, "rxd_adv_layout" } - }; - uint32_t i; -@@ -484,8 +477,6 @@ hns3_parse_capability(struct hns3_hw *hw, - { - uint32_t caps = rte_le_to_cpu_32(cmd->caps[0]); - -- if (hns3_get_bit(caps, HNS3_CAPS_UDP_GSO_B)) -- hns3_set_bit(hw->capability, HNS3_DEV_SUPPORT_UDP_GSO_B, 1); - if (hns3_get_bit(caps, HNS3_CAPS_FD_QUEUE_REGION_B)) - hns3_set_bit(hw->capability, HNS3_DEV_SUPPORT_FD_QUEUE_REGION_B, - 1); -@@ -502,8 +493,6 @@ hns3_parse_capability(struct hns3_hw *hw, - hns3_warn(hw, "ignore PTP capability due to lack of " - "rxd advanced layout capability."); - } -- if (hns3_get_bit(caps, HNS3_CAPS_TX_PUSH_B)) -- hns3_set_bit(hw->capability, HNS3_DEV_SUPPORT_TX_PUSH_B, 1); - if (hns3_get_bit(caps, HNS3_CAPS_PHY_IMP_B)) - hns3_set_bit(hw->capability, HNS3_DEV_SUPPORT_COPPER_B, 1); - if (hns3_get_bit(caps, HNS3_CAPS_TQP_TXRX_INDEP_B)) -diff --git a/drivers/net/hns3/hns3_cmd.h b/drivers/net/hns3/hns3_cmd.h -index 70aed7b..ac74e4d 100644 ---- a/drivers/net/hns3/hns3_cmd.h -+++ b/drivers/net/hns3/hns3_cmd.h -@@ -306,22 +306,19 @@ struct hns3_rx_priv_buff_cmd { - #define HNS3_FW_VERSION_BYTE0_M GENMASK(7, 0) - - enum HNS3_CAPS_BITS { -- HNS3_CAPS_UDP_GSO_B, -- HNS3_CAPS_ATR_B, -- HNS3_CAPS_FD_QUEUE_REGION_B, -+ /* -+ * The following capability index definitions must be the same as those -+ * of the firmware. -+ */ -+ HNS3_CAPS_FD_QUEUE_REGION_B = 2, - HNS3_CAPS_PTP_B, -- HNS3_CAPS_INT_QL_B, -- HNS3_CAPS_SIMPLE_BD_B, -- HNS3_CAPS_TX_PUSH_B, -- HNS3_CAPS_PHY_IMP_B, -+ HNS3_CAPS_PHY_IMP_B = 7, - HNS3_CAPS_TQP_TXRX_INDEP_B, - HNS3_CAPS_HW_PAD_B, - HNS3_CAPS_STASH_B, - HNS3_CAPS_UDP_TUNNEL_CSUM_B, - HNS3_CAPS_RAS_IMP_B, -- HNS3_CAPS_FEC_B, -- HNS3_CAPS_PAUSE_B, -- HNS3_CAPS_RXD_ADV_LAYOUT_B, -+ HNS3_CAPS_RXD_ADV_LAYOUT_B = 15, - }; - - enum HNS3_API_CAP_BITS { -diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h -index b65fb39..a57b20f 100644 ---- a/drivers/net/hns3/hns3_ethdev.h -+++ b/drivers/net/hns3/hns3_ethdev.h -@@ -858,17 +858,17 @@ enum { - - #define HNS3_DEVARG_DEV_CAPS_MASK "dev_caps_mask" - --#define HNS3_DEV_SUPPORT_DCB_B 0x0 --#define HNS3_DEV_SUPPORT_COPPER_B 0x1 --#define HNS3_DEV_SUPPORT_UDP_GSO_B 0x2 --#define HNS3_DEV_SUPPORT_FD_QUEUE_REGION_B 0x3 --#define HNS3_DEV_SUPPORT_PTP_B 0x4 --#define HNS3_DEV_SUPPORT_TX_PUSH_B 0x5 --#define HNS3_DEV_SUPPORT_INDEP_TXRX_B 0x6 --#define HNS3_DEV_SUPPORT_STASH_B 0x7 --#define HNS3_DEV_SUPPORT_RXD_ADV_LAYOUT_B 0x9 --#define HNS3_DEV_SUPPORT_OUTER_UDP_CKSUM_B 0xA --#define HNS3_DEV_SUPPORT_RAS_IMP_B 0xB -+enum { -+ HNS3_DEV_SUPPORT_DCB_B, -+ HNS3_DEV_SUPPORT_COPPER_B, -+ HNS3_DEV_SUPPORT_FD_QUEUE_REGION_B, -+ HNS3_DEV_SUPPORT_PTP_B, -+ HNS3_DEV_SUPPORT_INDEP_TXRX_B, -+ HNS3_DEV_SUPPORT_STASH_B, -+ HNS3_DEV_SUPPORT_RXD_ADV_LAYOUT_B, -+ HNS3_DEV_SUPPORT_OUTER_UDP_CKSUM_B, -+ HNS3_DEV_SUPPORT_RAS_IMP_B, -+}; - - #define hns3_dev_dcb_supported(hw) \ - hns3_get_bit((hw)->capability, HNS3_DEV_SUPPORT_DCB_B) -@@ -877,10 +877,6 @@ enum { - #define hns3_dev_copper_supported(hw) \ - hns3_get_bit((hw)->capability, HNS3_DEV_SUPPORT_COPPER_B) - --/* Support UDP GSO offload */ --#define hns3_dev_udp_gso_supported(hw) \ -- hns3_get_bit((hw)->capability, HNS3_DEV_SUPPORT_UDP_GSO_B) -- - /* Support the queue region action rule of flow directory */ - #define hns3_dev_fd_queue_region_supported(hw) \ - hns3_get_bit((hw)->capability, HNS3_DEV_SUPPORT_FD_QUEUE_REGION_B) -@@ -889,9 +885,6 @@ enum { - #define hns3_dev_ptp_supported(hw) \ - hns3_get_bit((hw)->capability, HNS3_DEV_SUPPORT_PTP_B) - --#define hns3_dev_tx_push_supported(hw) \ -- hns3_get_bit((hw)->capability, HNS3_DEV_SUPPORT_TX_PUSH_B) -- - /* Support to Independently enable/disable/reset Tx or Rx queues */ - #define hns3_dev_indep_txrx_supported(hw) \ - hns3_get_bit((hw)->capability, HNS3_DEV_SUPPORT_INDEP_TXRX_B) --- -2.7.4 - diff --git a/0147-net-hns3-fix-RSS-flow-rule-restore.patch b/0147-net-hns3-fix-RSS-flow-rule-restore.patch new file mode 100644 index 0000000000000000000000000000000000000000..da815ee1e6af35e9053a32a130ae198322b030d8 --- /dev/null +++ b/0147-net-hns3-fix-RSS-flow-rule-restore.patch @@ -0,0 +1,159 @@ +From c05520ce0dfe94fd8a676a4d69502f6abc67df08 Mon Sep 17 00:00:00 2001 +From: Huisong Li +Date: Fri, 21 Oct 2022 15:36:23 +0800 +Subject: [PATCH 147/189] net/hns3: fix RSS flow rule restore + +After reset process, types of RSS flow rule cannot be restored when +load driver without RTE_ETH_MQ_RX_RSS_FLAG flag. This is because the +restoration for RSS flow rule is done in the 'hns3_config_rss()'. But +this function is also used to configure and restore RSS configuration +from ethdev ops, and doesn't configure RSS types if 'rxmode.mq_mode' +has not the flag. As a result, RSS types configured by rte flow API +can't be restored in this case when encounter reset. Actually, all +RSS rules are saved to a global link list. + +Use the linked list to restore RSS flow rule. + +Fixes: 920be799dbc3 ("net/hns3: fix RSS indirection table configuration") +Cc: stable@dpdk.org + +Signed-off-by: Huisong Li +Signed-off-by: Dongdong Liu +--- + drivers/net/hns3/hns3_ethdev.c | 11 ++--------- + drivers/net/hns3/hns3_ethdev_vf.c | 11 ++--------- + drivers/net/hns3/hns3_flow.c | 8 +++++++- + drivers/net/hns3/hns3_flow.h | 1 + + drivers/net/hns3/hns3_rss.h | 1 - + 5 files changed, 12 insertions(+), 20 deletions(-) + +diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c +index 24ee9df332..fc3fc76a40 100644 +--- a/drivers/net/hns3/hns3_ethdev.c ++++ b/drivers/net/hns3/hns3_ethdev.c +@@ -5006,6 +5006,7 @@ static int + hns3_do_start(struct hns3_adapter *hns, bool reset_queue) + { + struct hns3_hw *hw = &hns->hw; ++ struct rte_eth_dev *dev = &rte_eth_devices[hw->data->port_id]; + bool link_en; + int ret; + +@@ -5042,7 +5043,7 @@ hns3_do_start(struct hns3_adapter *hns, bool reset_queue) + if (ret) + goto err_set_link_speed; + +- return 0; ++ return hns3_restore_filter(dev); + + err_set_link_speed: + (void)hns3_cfg_mac_mode(hw, false); +@@ -5059,12 +5060,6 @@ hns3_do_start(struct hns3_adapter *hns, bool reset_queue) + return ret; + } + +-static void +-hns3_restore_filter(struct rte_eth_dev *dev) +-{ +- hns3_restore_rss_filter(dev); +-} +- + static int + hns3_dev_start(struct rte_eth_dev *dev) + { +@@ -5121,8 +5116,6 @@ hns3_dev_start(struct rte_eth_dev *dev) + hns3_set_rxtx_function(dev); + hns3_mp_req_start_rxtx(dev); + +- hns3_restore_filter(dev); +- + /* Enable interrupt of all rx queues before enabling queues */ + hns3_dev_all_rx_queue_intr_enable(hw, true); + +diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c +index db2f15abe2..13f1cba0e6 100644 +--- a/drivers/net/hns3/hns3_ethdev_vf.c ++++ b/drivers/net/hns3/hns3_ethdev_vf.c +@@ -1727,6 +1727,7 @@ static int + hns3vf_do_start(struct hns3_adapter *hns, bool reset_queue) + { + struct hns3_hw *hw = &hns->hw; ++ struct rte_eth_dev *dev = &rte_eth_devices[hw->data->port_id]; + uint16_t nb_rx_q = hw->data->nb_rx_queues; + uint16_t nb_tx_q = hw->data->nb_tx_queues; + int ret; +@@ -1741,13 +1742,7 @@ hns3vf_do_start(struct hns3_adapter *hns, bool reset_queue) + if (ret) + hns3_err(hw, "failed to init queues, ret = %d.", ret); + +- return ret; +-} +- +-static void +-hns3vf_restore_filter(struct rte_eth_dev *dev) +-{ +- hns3_restore_rss_filter(dev); ++ return hns3_restore_filter(dev); + } + + static int +@@ -1799,8 +1794,6 @@ hns3vf_dev_start(struct rte_eth_dev *dev) + hns3_set_rxtx_function(dev); + hns3_mp_req_start_rxtx(dev); + +- hns3vf_restore_filter(dev); +- + /* Enable interrupt of all rx queues before enabling queues */ + hns3_dev_all_rx_queue_intr_enable(hw, true); + hns3_start_tqps(hw); +diff --git a/drivers/net/hns3/hns3_flow.c b/drivers/net/hns3/hns3_flow.c +index 301a4a56b3..7bd2f0bf7a 100644 +--- a/drivers/net/hns3/hns3_flow.c ++++ b/drivers/net/hns3/hns3_flow.c +@@ -1646,7 +1646,7 @@ hns3_clear_rss_filter(struct rte_eth_dev *dev) + return ret; + } + +-int ++static int + hns3_restore_rss_filter(struct rte_eth_dev *dev) + { + struct hns3_adapter *hns = dev->data->dev_private; +@@ -1672,6 +1672,12 @@ hns3_restore_rss_filter(struct rte_eth_dev *dev) + return ret; + } + ++int ++hns3_restore_filter(struct rte_eth_dev *dev) ++{ ++ return hns3_restore_rss_filter(dev); ++} ++ + static int + hns3_flow_parse_rss(struct rte_eth_dev *dev, + const struct hns3_rss_conf *conf, bool add) +diff --git a/drivers/net/hns3/hns3_flow.h b/drivers/net/hns3/hns3_flow.h +index 1ab3f9f5c6..0f5de129a3 100644 +--- a/drivers/net/hns3/hns3_flow.h ++++ b/drivers/net/hns3/hns3_flow.h +@@ -49,5 +49,6 @@ int hns3_dev_flow_ops_get(struct rte_eth_dev *dev, + const struct rte_flow_ops **ops); + void hns3_flow_init(struct rte_eth_dev *dev); + void hns3_flow_uninit(struct rte_eth_dev *dev); ++int hns3_restore_filter(struct rte_eth_dev *dev); + + #endif /* _HNS3_FLOW_H_ */ +diff --git a/drivers/net/hns3/hns3_rss.h b/drivers/net/hns3/hns3_rss.h +index 5b90d3a628..78c9eff827 100644 +--- a/drivers/net/hns3/hns3_rss.h ++++ b/drivers/net/hns3/hns3_rss.h +@@ -110,6 +110,5 @@ int hns3_config_rss(struct hns3_adapter *hns); + void hns3_rss_uninit(struct hns3_adapter *hns); + int hns3_set_rss_tuple_by_rss_hf(struct hns3_hw *hw, uint64_t rss_hf); + int hns3_rss_set_algo_key(struct hns3_hw *hw, const uint8_t *key); +-int hns3_restore_rss_filter(struct rte_eth_dev *dev); + + #endif /* _HNS3_RSS_H_ */ +-- +2.23.0 + diff --git a/0147-net-hns3-refactor-optimised-register-write.patch b/0147-net-hns3-refactor-optimised-register-write.patch deleted file mode 100644 index b3a0390445a790ad4463054ee86177b71672a0fc..0000000000000000000000000000000000000000 --- a/0147-net-hns3-refactor-optimised-register-write.patch +++ /dev/null @@ -1,39 +0,0 @@ -From b1c34695f2af22dfea670f424d35eb4d65376678 Mon Sep 17 00:00:00 2001 -From: Chengwen Feng -Date: Fri, 30 Apr 2021 14:28:46 +0800 -Subject: [PATCH 147/189] net/hns3: refactor optimised register write - -This patch modifies hns3_write_reg_opt() API implementation because -the rte_write32() already uses rte_io_wmb(). - -Signed-off-by: Chengwen Feng -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_ethdev.h | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - -diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h -index a57b20f..091512e 100644 ---- a/drivers/net/hns3/hns3_ethdev.h -+++ b/drivers/net/hns3/hns3_ethdev.h -@@ -980,13 +980,13 @@ static inline void hns3_write_reg(void *base, uint32_t reg, uint32_t value) - } - - /* -- * The optimized function for writing registers used in the '.rx_pkt_burst' and -- * '.tx_pkt_burst' ops implementation function. -+ * The optimized function for writing registers reduces one address addition -+ * calculation, it was used in the '.rx_pkt_burst' and '.tx_pkt_burst' ops -+ * implementation function. - */ - static inline void hns3_write_reg_opt(volatile void *addr, uint32_t value) - { -- rte_io_wmb(); -- rte_write32_relaxed(rte_cpu_to_le_32(value), addr); -+ rte_write32(rte_cpu_to_le_32(value), addr); - } - - static inline uint32_t hns3_read_reg(void *base, uint32_t reg) --- -2.7.4 - diff --git a/0148-net-hns3-move-flow-direction-rule-recovery.patch b/0148-net-hns3-move-flow-direction-rule-recovery.patch new file mode 100644 index 0000000000000000000000000000000000000000..1428150aca618b6c829a19c8bb41a4d0765de230 --- /dev/null +++ b/0148-net-hns3-move-flow-direction-rule-recovery.patch @@ -0,0 +1,71 @@ +From d982e1518b7fc217dbf14816b0b929079d742137 Mon Sep 17 00:00:00 2001 +From: Huisong Li +Date: Fri, 21 Oct 2022 15:36:24 +0800 +Subject: [PATCH 148/189] net/hns3: move flow direction rule recovery + +The 'hns3_restore_filter' is used to restore flow rules from +rte_flow API during the reset process. This patch moves the +recovery of flow direction rule to this function to improve +code maintainability. + +Fixes: fcba820d9b9e ("net/hns3: support flow director") +Cc: stable@dpdk.org + +Signed-off-by: Huisong Li +Signed-off-by: Dongdong Liu +--- + drivers/net/hns3/hns3_ethdev.c | 4 ---- + drivers/net/hns3/hns3_fdir.c | 3 +++ + drivers/net/hns3/hns3_flow.c | 7 +++++++ + 3 files changed, 10 insertions(+), 4 deletions(-) + +diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c +index fc3fc76a40..01c13f8d70 100644 +--- a/drivers/net/hns3/hns3_ethdev.c ++++ b/drivers/net/hns3/hns3_ethdev.c +@@ -5907,10 +5907,6 @@ hns3_restore_conf(struct hns3_adapter *hns) + if (ret) + goto err_promisc; + +- ret = hns3_restore_all_fdir_filter(hns); +- if (ret) +- goto err_promisc; +- + ret = hns3_restore_ptp(hns); + if (ret) + goto err_promisc; +diff --git a/drivers/net/hns3/hns3_fdir.c b/drivers/net/hns3/hns3_fdir.c +index 30e5e66772..48a91fb517 100644 +--- a/drivers/net/hns3/hns3_fdir.c ++++ b/drivers/net/hns3/hns3_fdir.c +@@ -1068,6 +1068,9 @@ int hns3_restore_all_fdir_filter(struct hns3_adapter *hns) + bool err = false; + int ret; + ++ if (hns->is_vf) ++ return 0; ++ + /* + * This API is called in the reset recovery process, the parent function + * must hold hw->lock. +diff --git a/drivers/net/hns3/hns3_flow.c b/drivers/net/hns3/hns3_flow.c +index 7bd2f0bf7a..17c4274123 100644 +--- a/drivers/net/hns3/hns3_flow.c ++++ b/drivers/net/hns3/hns3_flow.c +@@ -1675,6 +1675,13 @@ hns3_restore_rss_filter(struct rte_eth_dev *dev) + int + hns3_restore_filter(struct rte_eth_dev *dev) + { ++ struct hns3_adapter *hns = dev->data->dev_private; ++ int ret; ++ ++ ret = hns3_restore_all_fdir_filter(hns); ++ if (ret != 0) ++ return ret; ++ + return hns3_restore_rss_filter(dev); + } + +-- +2.23.0 + diff --git a/0148-net-hns3-use-existing-macro-to-get-array-size.patch b/0148-net-hns3-use-existing-macro-to-get-array-size.patch deleted file mode 100644 index d137cb5620ede5fe457d929e4ec72bb7c218a1fd..0000000000000000000000000000000000000000 --- a/0148-net-hns3-use-existing-macro-to-get-array-size.patch +++ /dev/null @@ -1,136 +0,0 @@ -From 89b2b315c94308c77bdd662fa564c9d4a43bd647 Mon Sep 17 00:00:00 2001 -From: Chengwen Feng -Date: Fri, 30 Apr 2021 14:28:47 +0800 -Subject: [PATCH 148/189] net/hns3: use existing macro to get array size - -This patch uses RTE_DIM() instead of ARRAY_SIZE(). - -Signed-off-by: Chengwen Feng -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_cmd.c | 4 ++-- - drivers/net/hns3/hns3_ethdev.h | 2 -- - drivers/net/hns3/hns3_flow.c | 18 +++++++++--------- - drivers/net/hns3/hns3_intr.c | 4 ++-- - 4 files changed, 13 insertions(+), 15 deletions(-) - -diff --git a/drivers/net/hns3/hns3_cmd.c b/drivers/net/hns3/hns3_cmd.c -index a43385b..5f4d74d 100644 ---- a/drivers/net/hns3/hns3_cmd.c -+++ b/drivers/net/hns3/hns3_cmd.c -@@ -245,7 +245,7 @@ hns3_is_special_opcode(uint16_t opcode) - HNS3_OPC_QUERY_ALL_ERR_INFO,}; - uint32_t i; - -- for (i = 0; i < ARRAY_SIZE(spec_opcode); i++) -+ for (i = 0; i < RTE_DIM(spec_opcode); i++) - if (spec_opcode[i] == opcode) - return true; - -@@ -276,7 +276,7 @@ hns3_cmd_convert_err_code(uint16_t desc_ret) - - uint32_t i; - -- for (i = 0; i < ARRAY_SIZE(hns3_cmdq_status); i++) -+ for (i = 0; i < RTE_DIM(hns3_cmdq_status); i++) - if (hns3_cmdq_status[i].imp_errcode == desc_ret) - return hns3_cmdq_status[i].linux_errcode; - -diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h -index 091512e..00fedf0 100644 ---- a/drivers/net/hns3/hns3_ethdev.h -+++ b/drivers/net/hns3/hns3_ethdev.h -@@ -1001,8 +1001,6 @@ static inline uint32_t hns3_read_reg(void *base, uint32_t reg) - #define hns3_read_dev(a, reg) \ - hns3_read_reg((a)->io_base, (reg)) - --#define ARRAY_SIZE(x) RTE_DIM(x) -- - #define NEXT_ITEM_OF_ACTION(act, actions, index) \ - do { \ - act = (actions) + (index); \ -diff --git a/drivers/net/hns3/hns3_flow.c b/drivers/net/hns3/hns3_flow.c -index c07929f..1513992 100644 ---- a/drivers/net/hns3/hns3_flow.c -+++ b/drivers/net/hns3/hns3_flow.c -@@ -1054,37 +1054,37 @@ hns3_parse_normal(const struct rte_flow_item *item, struct hns3_fdir_rule *rule, - case RTE_FLOW_ITEM_TYPE_ETH: - ret = hns3_parse_eth(item, rule, error); - step_mngr->items = L2_next_items; -- step_mngr->count = ARRAY_SIZE(L2_next_items); -+ step_mngr->count = RTE_DIM(L2_next_items); - break; - case RTE_FLOW_ITEM_TYPE_VLAN: - ret = hns3_parse_vlan(item, rule, error); - step_mngr->items = L2_next_items; -- step_mngr->count = ARRAY_SIZE(L2_next_items); -+ step_mngr->count = RTE_DIM(L2_next_items); - break; - case RTE_FLOW_ITEM_TYPE_IPV4: - ret = hns3_parse_ipv4(item, rule, error); - step_mngr->items = L3_next_items; -- step_mngr->count = ARRAY_SIZE(L3_next_items); -+ step_mngr->count = RTE_DIM(L3_next_items); - break; - case RTE_FLOW_ITEM_TYPE_IPV6: - ret = hns3_parse_ipv6(item, rule, error); - step_mngr->items = L3_next_items; -- step_mngr->count = ARRAY_SIZE(L3_next_items); -+ step_mngr->count = RTE_DIM(L3_next_items); - break; - case RTE_FLOW_ITEM_TYPE_TCP: - ret = hns3_parse_tcp(item, rule, error); - step_mngr->items = L4_next_items; -- step_mngr->count = ARRAY_SIZE(L4_next_items); -+ step_mngr->count = RTE_DIM(L4_next_items); - break; - case RTE_FLOW_ITEM_TYPE_UDP: - ret = hns3_parse_udp(item, rule, error); - step_mngr->items = L4_next_items; -- step_mngr->count = ARRAY_SIZE(L4_next_items); -+ step_mngr->count = RTE_DIM(L4_next_items); - break; - case RTE_FLOW_ITEM_TYPE_SCTP: - ret = hns3_parse_sctp(item, rule, error); - step_mngr->items = L4_next_items; -- step_mngr->count = ARRAY_SIZE(L4_next_items); -+ step_mngr->count = RTE_DIM(L4_next_items); - break; - default: - return rte_flow_error_set(error, ENOTSUP, -@@ -1188,7 +1188,7 @@ hns3_parse_fdir_filter(struct rte_eth_dev *dev, - "Fdir not supported in VF"); - - step_mngr.items = first_items; -- step_mngr.count = ARRAY_SIZE(first_items); -+ step_mngr.count = RTE_DIM(first_items); - for (item = pattern; item->type != RTE_FLOW_ITEM_TYPE_END; item++) { - if (item->type == RTE_FLOW_ITEM_TYPE_VOID) - continue; -@@ -1202,7 +1202,7 @@ hns3_parse_fdir_filter(struct rte_eth_dev *dev, - if (ret) - return ret; - step_mngr.items = tunnel_next_items; -- step_mngr.count = ARRAY_SIZE(tunnel_next_items); -+ step_mngr.count = RTE_DIM(tunnel_next_items); - } else { - ret = hns3_parse_normal(item, rule, &step_mngr, error); - if (ret) -diff --git a/drivers/net/hns3/hns3_intr.c b/drivers/net/hns3/hns3_intr.c -index 482541b..e216788 100644 ---- a/drivers/net/hns3/hns3_intr.c -+++ b/drivers/net/hns3/hns3_intr.c -@@ -2206,8 +2206,8 @@ hns3_handle_type_reg_error_data(struct hns3_hw *hw, - type_id = err_info->type_id & HNS3_ERR_TYPE_MASK; - is_ras = err_info->type_id >> HNS3_ERR_TYPE_IS_RAS_OFFSET; - -- total_module = ARRAY_SIZE(hns3_hw_module_name); -- total_type = ARRAY_SIZE(hns3_hw_error_type); -+ total_module = RTE_DIM(hns3_hw_module_name); -+ total_type = RTE_DIM(hns3_hw_error_type); - - hns3_err(hw, "total_module:%u, total_type:%u", - total_module, total_type); --- -2.7.4 - diff --git a/0149-net-hns3-fix-restore-filter-function-input.patch b/0149-net-hns3-fix-restore-filter-function-input.patch new file mode 100644 index 0000000000000000000000000000000000000000..2d680118e812c2f84a0baa271b1f4613b96e8362 --- /dev/null +++ b/0149-net-hns3-fix-restore-filter-function-input.patch @@ -0,0 +1,195 @@ +From 470e1b242046d7968ce039428201cc6c9595e114 Mon Sep 17 00:00:00 2001 +From: Huisong Li +Date: Fri, 21 Oct 2022 15:36:25 +0800 +Subject: [PATCH 149/189] net/hns3: fix restore filter function input + +This 'hns3_restore_filter' is an internal interface of driver. +Currently, it uses 'struct rte_eth_dev *dev' as input parameter, +This is inconvenient for the function to call in driver because +caller has to obtain its device address by global variable +'rte_eth_devices[]'. Fix the input of this function. + +Fixes: 920be799dbc3 ("net/hns3: fix RSS indirection table configuration") +Cc: stable@dpdk.org + +Signed-off-by: Huisong Li +Signed-off-by: Dongdong Liu +--- + drivers/net/hns3/hns3_ethdev.c | 3 +-- + drivers/net/hns3/hns3_ethdev_vf.c | 3 +-- + drivers/net/hns3/hns3_flow.c | 30 ++++++++++++------------------ + drivers/net/hns3/hns3_flow.h | 2 +- + 4 files changed, 15 insertions(+), 23 deletions(-) + +diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c +index 01c13f8d70..c59543ef5b 100644 +--- a/drivers/net/hns3/hns3_ethdev.c ++++ b/drivers/net/hns3/hns3_ethdev.c +@@ -5006,7 +5006,6 @@ static int + hns3_do_start(struct hns3_adapter *hns, bool reset_queue) + { + struct hns3_hw *hw = &hns->hw; +- struct rte_eth_dev *dev = &rte_eth_devices[hw->data->port_id]; + bool link_en; + int ret; + +@@ -5043,7 +5042,7 @@ hns3_do_start(struct hns3_adapter *hns, bool reset_queue) + if (ret) + goto err_set_link_speed; + +- return hns3_restore_filter(dev); ++ return hns3_restore_filter(hns); + + err_set_link_speed: + (void)hns3_cfg_mac_mode(hw, false); +diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c +index 13f1cba0e6..72d60191ab 100644 +--- a/drivers/net/hns3/hns3_ethdev_vf.c ++++ b/drivers/net/hns3/hns3_ethdev_vf.c +@@ -1727,7 +1727,6 @@ static int + hns3vf_do_start(struct hns3_adapter *hns, bool reset_queue) + { + struct hns3_hw *hw = &hns->hw; +- struct rte_eth_dev *dev = &rte_eth_devices[hw->data->port_id]; + uint16_t nb_rx_q = hw->data->nb_rx_queues; + uint16_t nb_tx_q = hw->data->nb_tx_queues; + int ret; +@@ -1742,7 +1741,7 @@ hns3vf_do_start(struct hns3_adapter *hns, bool reset_queue) + if (ret) + hns3_err(hw, "failed to init queues, ret = %d.", ret); + +- return hns3_restore_filter(dev); ++ return hns3_restore_filter(hns); + } + + static int +diff --git a/drivers/net/hns3/hns3_flow.c b/drivers/net/hns3/hns3_flow.c +index 17c4274123..2b4286d46d 100644 +--- a/drivers/net/hns3/hns3_flow.c ++++ b/drivers/net/hns3/hns3_flow.c +@@ -1508,11 +1508,9 @@ hns3_hw_rss_hash_set(struct hns3_hw *hw, struct rte_flow_action_rss *rss_config) + } + + static int +-hns3_update_indir_table(struct rte_eth_dev *dev, ++hns3_update_indir_table(struct hns3_hw *hw, + const struct rte_flow_action_rss *conf, uint16_t num) + { +- struct hns3_adapter *hns = dev->data->dev_private; +- struct hns3_hw *hw = &hns->hw; + uint16_t indir_tbl[HNS3_RSS_IND_TBL_SIZE_MAX]; + uint16_t j; + uint32_t i; +@@ -1535,11 +1533,9 @@ hns3_update_indir_table(struct rte_eth_dev *dev, + } + + static int +-hns3_config_rss_filter(struct rte_eth_dev *dev, ++hns3_config_rss_filter(struct hns3_hw *hw, + const struct hns3_rss_conf *conf, bool add) + { +- struct hns3_adapter *hns = dev->data->dev_private; +- struct hns3_hw *hw = &hns->hw; + struct hns3_rss_conf *rss_info; + uint64_t flow_types; + uint16_t num; +@@ -1591,13 +1587,13 @@ hns3_config_rss_filter(struct rte_eth_dev *dev, + } + + /* Set rx queues to use */ +- num = RTE_MIN(dev->data->nb_rx_queues, rss_flow_conf.queue_num); ++ num = RTE_MIN(hw->data->nb_rx_queues, rss_flow_conf.queue_num); + if (rss_flow_conf.queue_num > num) + hns3_warn(hw, "Config queue numbers %u are beyond the scope of truncated", + rss_flow_conf.queue_num); + hns3_info(hw, "Max of contiguous %u PF queues are configured", num); + if (num) { +- ret = hns3_update_indir_table(dev, &rss_flow_conf, num); ++ ret = hns3_update_indir_table(hw, &rss_flow_conf, num); + if (ret) + return ret; + } +@@ -1627,7 +1623,7 @@ hns3_clear_rss_filter(struct rte_eth_dev *dev) + rss_filter_ptr = TAILQ_FIRST(&hw->flow_rss_list); + while (rss_filter_ptr) { + TAILQ_REMOVE(&hw->flow_rss_list, rss_filter_ptr, entries); +- ret = hns3_config_rss_filter(dev, &rss_filter_ptr->filter_info, ++ ret = hns3_config_rss_filter(hw, &rss_filter_ptr->filter_info, + false); + if (ret) + rss_rule_fail_cnt++; +@@ -1647,11 +1643,9 @@ hns3_clear_rss_filter(struct rte_eth_dev *dev) + } + + static int +-hns3_restore_rss_filter(struct rte_eth_dev *dev) ++hns3_restore_rss_filter(struct hns3_hw *hw) + { +- struct hns3_adapter *hns = dev->data->dev_private; + struct hns3_rss_conf_ele *filter; +- struct hns3_hw *hw = &hns->hw; + int ret = 0; + + pthread_mutex_lock(&hw->flows_lock); +@@ -1659,7 +1653,7 @@ hns3_restore_rss_filter(struct rte_eth_dev *dev) + if (!filter->filter_info.valid) + continue; + +- ret = hns3_config_rss_filter(dev, &filter->filter_info, true); ++ ret = hns3_config_rss_filter(hw, &filter->filter_info, true); + if (ret != 0) { + hns3_err(hw, "restore RSS filter failed, ret=%d", ret); + goto out; +@@ -1673,16 +1667,16 @@ hns3_restore_rss_filter(struct rte_eth_dev *dev) + } + + int +-hns3_restore_filter(struct rte_eth_dev *dev) ++hns3_restore_filter(struct hns3_adapter *hns) + { +- struct hns3_adapter *hns = dev->data->dev_private; ++ struct hns3_hw *hw = &hns->hw; + int ret; + + ret = hns3_restore_all_fdir_filter(hns); + if (ret != 0) + return ret; + +- return hns3_restore_rss_filter(dev); ++ return hns3_restore_rss_filter(hw); + } + + static int +@@ -1699,7 +1693,7 @@ hns3_flow_parse_rss(struct rte_eth_dev *dev, + return -EINVAL; + } + +- return hns3_config_rss_filter(dev, conf, add); ++ return hns3_config_rss_filter(hw, conf, add); + } + + static int +@@ -1960,7 +1954,7 @@ hns3_flow_destroy(struct rte_eth_dev *dev, struct rte_flow *flow, + break; + case RTE_ETH_FILTER_HASH: + rss_filter_ptr = (struct hns3_rss_conf_ele *)flow->rule; +- ret = hns3_config_rss_filter(dev, &rss_filter_ptr->filter_info, ++ ret = hns3_config_rss_filter(hw, &rss_filter_ptr->filter_info, + false); + if (ret) + return rte_flow_error_set(error, EIO, +diff --git a/drivers/net/hns3/hns3_flow.h b/drivers/net/hns3/hns3_flow.h +index 0f5de129a3..854fbb7ff0 100644 +--- a/drivers/net/hns3/hns3_flow.h ++++ b/drivers/net/hns3/hns3_flow.h +@@ -49,6 +49,6 @@ int hns3_dev_flow_ops_get(struct rte_eth_dev *dev, + const struct rte_flow_ops **ops); + void hns3_flow_init(struct rte_eth_dev *dev); + void hns3_flow_uninit(struct rte_eth_dev *dev); +-int hns3_restore_filter(struct rte_eth_dev *dev); ++int hns3_restore_filter(struct hns3_adapter *hns); + + #endif /* _HNS3_FLOW_H_ */ +-- +2.23.0 + diff --git a/0149-net-hns3-improve-IO-path-data-cache-usage.patch b/0149-net-hns3-improve-IO-path-data-cache-usage.patch deleted file mode 100644 index 4b8d03390f01558836d39092e9fc6e960383dfdf..0000000000000000000000000000000000000000 --- a/0149-net-hns3-improve-IO-path-data-cache-usage.patch +++ /dev/null @@ -1,259 +0,0 @@ -From 73fce35c11863c8cccc5444f054e5820f303e9bd Mon Sep 17 00:00:00 2001 -From: Chengwen Feng -Date: Fri, 30 Apr 2021 14:28:48 +0800 -Subject: [PATCH 149/189] net/hns3: improve IO path data cache usage - -This patch improves data cache usage by: -1. Rearrange the rxq frequency accessed fields in the IO path to the - first 128B. -2. Rearrange the txq frequency accessed fields in the IO path to the - first 64B. -3. Make sure ptype table align cacheline size which is 128B instead of - min cacheline size which is 64B because the L1/L2 is 64B and L3 is - 128B on Kunpeng ARM platform. - -The performance gains are 1.5% in 64B packet macfwd scenarios. - -Signed-off-by: Chengwen Feng -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_ethdev.h | 4 +- - drivers/net/hns3/hns3_rxtx.h | 126 ++++++++++++++++++++++++----------------- - 2 files changed, 77 insertions(+), 53 deletions(-) - -diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h -index 00fedf0..c70950a 100644 ---- a/drivers/net/hns3/hns3_ethdev.h -+++ b/drivers/net/hns3/hns3_ethdev.h -@@ -738,7 +738,7 @@ struct hns3_ptype_table { - * descriptor, it functions only when firmware report the capability of - * HNS3_CAPS_RXD_ADV_LAYOUT_B and driver enabled it. - */ -- uint32_t ptype[HNS3_PTYPE_NUM] __rte_cache_min_aligned; -+ uint32_t ptype[HNS3_PTYPE_NUM] __rte_cache_aligned; - }; - - #define HNS3_FIXED_MAX_TQP_NUM_MODE 0 -@@ -842,7 +842,7 @@ struct hns3_adapter { - - uint64_t dev_caps_mask; - -- struct hns3_ptype_table ptype_tbl __rte_cache_min_aligned; -+ struct hns3_ptype_table ptype_tbl __rte_cache_aligned; - }; - - enum { -diff --git a/drivers/net/hns3/hns3_rxtx.h b/drivers/net/hns3/hns3_rxtx.h -index 92f01ed..811be96 100644 ---- a/drivers/net/hns3/hns3_rxtx.h -+++ b/drivers/net/hns3/hns3_rxtx.h -@@ -289,22 +289,14 @@ struct hns3_rx_bd_errors_stats { - }; - - struct hns3_rx_queue { -- void *io_base; - volatile void *io_head_reg; -- struct hns3_adapter *hns; - struct hns3_ptype_table *ptype_tbl; - struct rte_mempool *mb_pool; - struct hns3_desc *rx_ring; -- uint64_t rx_ring_phys_addr; /* RX ring DMA address */ -- const struct rte_memzone *mz; - struct hns3_entry *sw_ring; -- struct rte_mbuf *pkt_first_seg; -- struct rte_mbuf *pkt_last_seg; - -- uint16_t queue_id; - uint16_t port_id; - uint16_t nb_rx_desc; -- uint16_t rx_buf_len; - /* - * threshold for the number of BDs waited to passed to hardware. If the - * number exceeds the threshold, driver will pass these BDs to hardware. -@@ -318,8 +310,6 @@ struct hns3_rx_queue { - /* 4 if DEV_RX_OFFLOAD_KEEP_CRC offload set, 0 otherwise */ - uint8_t crc_len; - -- bool rx_deferred_start; /* don't start this queue in dev start */ -- bool configured; /* indicate if rx queue has been configured */ - /* - * Indicate whether ignore the outer VLAN field in the Rx BD reported - * by the Hardware. Because the outer VLAN is the PVID if the PVID is -@@ -331,23 +321,45 @@ struct hns3_rx_queue { - * driver does not need to perform PVID-related operation in Rx. At this - * point, the pvid_sw_discard_en will be false. - */ -- bool pvid_sw_discard_en; -- bool ptype_en; /* indicate if the ptype field enabled */ -- bool enabled; /* indicate if Rx queue has been enabled */ -+ uint8_t pvid_sw_discard_en:1; -+ uint8_t ptype_en:1; /* indicate if the ptype field enabled */ -+ -+ uint64_t mbuf_initializer; /* value to init mbufs used with vector rx */ -+ /* offset_table: used for vector, to solve execute re-order problem */ -+ uint8_t offset_table[HNS3_VECTOR_RX_OFFSET_TABLE_LEN + 1]; -+ -+ uint16_t bulk_mbuf_num; /* indicate bulk_mbuf valid nums */ - - struct hns3_rx_basic_stats basic_stats; -+ -+ struct rte_mbuf *pkt_first_seg; -+ struct rte_mbuf *pkt_last_seg; -+ -+ struct rte_mbuf *bulk_mbuf[HNS3_BULK_ALLOC_MBUF_NUM]; -+ - /* DFX statistics that driver does not need to discard packets */ - struct hns3_rx_dfx_stats dfx_stats; - /* Error statistics that driver needs to discard packets */ - struct hns3_rx_bd_errors_stats err_stats; - -- struct rte_mbuf *bulk_mbuf[HNS3_BULK_ALLOC_MBUF_NUM]; -- uint16_t bulk_mbuf_num; -- -- /* offset_table: used for vector, to solve execute re-order problem */ -- uint8_t offset_table[HNS3_VECTOR_RX_OFFSET_TABLE_LEN + 1]; -- uint64_t mbuf_initializer; /* value to init mbufs used with vector rx */ - struct rte_mbuf fake_mbuf; /* fake mbuf used with vector rx */ -+ -+ -+ /* -+ * The following fields are not accessed in the I/O path, so they are -+ * placed at the end. -+ */ -+ void *io_base; -+ struct hns3_adapter *hns; -+ uint64_t rx_ring_phys_addr; /* RX ring DMA address */ -+ const struct rte_memzone *mz; -+ -+ uint16_t queue_id; -+ uint16_t rx_buf_len; -+ -+ bool configured; /* indicate if rx queue has been configured */ -+ bool rx_deferred_start; /* don't start this queue in dev start */ -+ bool enabled; /* indicate if Rx queue has been enabled */ - }; - - struct hns3_tx_basic_stats { -@@ -407,16 +419,10 @@ struct hns3_tx_dfx_stats { - }; - - struct hns3_tx_queue { -- void *io_base; - volatile void *io_tail_reg; -- struct hns3_adapter *hns; - struct hns3_desc *tx_ring; -- uint64_t tx_ring_phys_addr; /* TX ring DMA address */ -- const struct rte_memzone *mz; - struct hns3_entry *sw_ring; - -- uint16_t queue_id; -- uint16_t port_id; - uint16_t nb_tx_desc; - /* - * index of next BD whose corresponding rte_mbuf can be released by -@@ -432,21 +438,12 @@ struct hns3_tx_queue { - uint16_t tx_free_thresh; - - /* -- * For better performance in tx datapath, releasing mbuf in batches is -- * required. -- * Only checking the VLD bit of the last descriptor in a batch of the -- * thresh descriptors does not mean that these descriptors are all sent -- * by hardware successfully. So we need to check that the VLD bits of -- * all descriptors are cleared. and then free all mbufs in the batch. -- * - tx_rs_thresh -- * Number of mbufs released at a time. -- * -- * - free -- * Tx mbuf free array used for preserving temporarily address of mbuf -- * released back to mempool, when releasing mbuf in batches. -+ * The minimum length of the packet supported by hardware in the Tx -+ * direction. - */ -- uint16_t tx_rs_thresh; -- struct rte_mbuf **free; -+ uint8_t min_tx_pkt_len; -+ -+ uint8_t max_non_tso_bd_num; /* max BD number of one non-TSO packet */ - - /* - * tso mode. -@@ -464,7 +461,7 @@ struct hns3_tx_queue { - * checksum of packets that need TSO, so network driver software - * not need to recalculate it. - */ -- uint8_t tso_mode; -+ uint16_t tso_mode:1; - /* - * udp checksum mode. - * value range: -@@ -480,16 +477,10 @@ struct hns3_tx_queue { - * In this mode, HW does not have the preceding problems and can - * directly calculate the checksum of these UDP packets. - */ -- uint8_t udp_cksum_mode; -- /* -- * The minimum length of the packet supported by hardware in the Tx -- * direction. -- */ -- uint32_t min_tx_pkt_len; -+ uint16_t udp_cksum_mode:1; - -- uint8_t max_non_tso_bd_num; /* max BD number of one non-TSO packet */ -- bool tx_deferred_start; /* don't start this queue in dev start */ -- bool configured; /* indicate if tx queue has been configured */ -+ uint16_t simple_bd_enable:1; -+ uint16_t tx_push_enable:1; /* check whether the tx push is enabled */ - /* - * Indicate whether add the vlan_tci of the mbuf to the inner VLAN field - * of Tx BD. Because the outer VLAN will always be the PVID when the -@@ -502,11 +493,44 @@ struct hns3_tx_queue { - * PVID-related operations in Tx. And pvid_sw_shift_en will be false at - * this point. - */ -- bool pvid_sw_shift_en; -- bool enabled; /* indicate if Tx queue has been enabled */ -+ uint16_t pvid_sw_shift_en:1; -+ -+ /* -+ * For better performance in tx datapath, releasing mbuf in batches is -+ * required. -+ * Only checking the VLD bit of the last descriptor in a batch of the -+ * thresh descriptors does not mean that these descriptors are all sent -+ * by hardware successfully. So we need to check that the VLD bits of -+ * all descriptors are cleared. and then free all mbufs in the batch. -+ * - tx_rs_thresh -+ * Number of mbufs released at a time. -+ * -+ * - free -+ * Tx mbuf free array used for preserving temporarily address of mbuf -+ * released back to mempool, when releasing mbuf in batches. -+ */ -+ uint16_t tx_rs_thresh; -+ struct rte_mbuf **free; - - struct hns3_tx_basic_stats basic_stats; - struct hns3_tx_dfx_stats dfx_stats; -+ -+ -+ /* -+ * The following fields are not accessed in the I/O path, so they are -+ * placed at the end. -+ */ -+ void *io_base; -+ struct hns3_adapter *hns; -+ uint64_t tx_ring_phys_addr; /* TX ring DMA address */ -+ const struct rte_memzone *mz; -+ -+ uint16_t port_id; -+ uint16_t queue_id; -+ -+ bool configured; /* indicate if tx queue has been configured */ -+ bool tx_deferred_start; /* don't start this queue in dev start */ -+ bool enabled; /* indicate if Tx queue has been enabled */ - }; - - #define HNS3_GET_TX_QUEUE_PEND_BD_NUM(txq) \ --- -2.7.4 - diff --git a/0150-net-hns3-fix-build-with-gcov.patch b/0150-net-hns3-fix-build-with-gcov.patch new file mode 100644 index 0000000000000000000000000000000000000000..02187954e25b9acbc97eb11dab83d70a60f12db5 --- /dev/null +++ b/0150-net-hns3-fix-build-with-gcov.patch @@ -0,0 +1,37 @@ +From 0acb77e818a7a0e71126667f0624c19c2706f59c Mon Sep 17 00:00:00 2001 +From: Dongdong Liu +Date: Fri, 21 Oct 2022 15:36:26 +0800 +Subject: [PATCH 150/189] net/hns3: fix build with gcov +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +meson build -Db_coverage=true +ninja -C build + +../drivers/net/hns3/hns3_ethdev.c:2856:22: warning: ‘cfg.umv_space’ may be +used uninitialized in this function [-Wmaybe-uninitialized] + 2856 | pf->wanted_umv_size = cfg.umv_space; + +Fix compiling warnings using gcc 10.3.1. + +Signed-off-by: Dongdong Liu +--- + drivers/net/hns3/hns3_ethdev.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c +index c59543ef5b..45b5d699b4 100644 +--- a/drivers/net/hns3/hns3_ethdev.c ++++ b/drivers/net/hns3/hns3_ethdev.c +@@ -2808,6 +2808,7 @@ hns3_get_board_configuration(struct hns3_hw *hw) + struct hns3_cfg cfg; + int ret; + ++ memset(&cfg, 0, sizeof(cfg)); + ret = hns3_get_board_cfg(hw, &cfg); + if (ret) { + PMD_INIT_LOG(ERR, "get board config failed %d", ret); +-- +2.23.0 + diff --git a/0150-net-hns3-log-flow-director-configuration.patch b/0150-net-hns3-log-flow-director-configuration.patch deleted file mode 100644 index dc5d53e806775ef627f19994bd5942fef8580d34..0000000000000000000000000000000000000000 --- a/0150-net-hns3-log-flow-director-configuration.patch +++ /dev/null @@ -1,63 +0,0 @@ -From e1dc71a6850185aef917b37495c41a6da8017cee Mon Sep 17 00:00:00 2001 -From: Chengwen Feng -Date: Fri, 30 Apr 2021 14:28:49 +0800 -Subject: [PATCH 150/189] net/hns3: log flow director configuration - -The rte flow interface does not support the API of the capability -set. Therefore, fdir configuration logs are added to facilitate -debugging. - -Signed-off-by: Chengwen Feng -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_fdir.c | 13 +++++++++++++ - 1 file changed, 13 insertions(+) - -diff --git a/drivers/net/hns3/hns3_fdir.c b/drivers/net/hns3/hns3_fdir.c -index 06c9a94..06dd51b 100644 ---- a/drivers/net/hns3/hns3_fdir.c -+++ b/drivers/net/hns3/hns3_fdir.c -@@ -336,6 +336,8 @@ int hns3_init_fd_config(struct hns3_adapter *hns) - BIT(INNER_IP_PROTO) | BIT(INNER_IP_TOS) | - BIT(INNER_SRC_IP) | BIT(INNER_DST_IP) | - BIT(INNER_SRC_PORT) | BIT(INNER_DST_PORT); -+ hns3_dbg(hw, "fdir tuple: inner"); - - /* If use max 400bit key, we can support tuples for ether type */ - if (pf->fdir.fd_cfg.max_key_length == MAX_KEY_LENGTH) { -@@ -345,6 +347,9 @@ int hns3_init_fd_config(struct hns3_adapter *hns) - BIT(OUTER_DST_PORT) | BIT(INNER_VLAN_TAG2) | - BIT(OUTER_TUN_VNI) | BIT(OUTER_TUN_FLOW_ID) | - BIT(OUTER_ETH_TYPE) | BIT(OUTER_IP_PROTO); -+ hns3_dbg(hw, "fdir tuple more: inner outer"); - } - - /* roce_type is used to filter roce frames -@@ -352,6 +357,7 @@ int hns3_init_fd_config(struct hns3_adapter *hns) - */ - key_cfg->meta_data_active = BIT(DST_VPORT) | BIT(TUNNEL_PACKET) | - BIT(VLAN_NUMBER); -+ hns3_dbg(hw, "fdir meta data: dst_vport tunnel_packet vlan_number"); - - ret = hns3_get_fd_allocation(hw, - &pf->fdir.fd_cfg.rule_num[HNS3_FD_STAGE_1], -@@ -361,6 +367,13 @@ int hns3_init_fd_config(struct hns3_adapter *hns) - if (ret) - return ret; - -+ hns3_dbg(hw, "fdir: stage1 stage2", -+ pf->fdir.fd_cfg.rule_num[HNS3_FD_STAGE_1], -+ pf->fdir.fd_cfg.cnt_num[HNS3_FD_STAGE_1], -+ pf->fdir.fd_cfg.rule_num[HNS3_FD_STAGE_2], -+ pf->fdir.fd_cfg.cnt_num[HNS3_FD_STAGE_2]); -+ - return hns3_set_fd_key_config(hns); - } - --- -2.7.4 - diff --git a/0151-net-hns3-fix-packet-type-for-GENEVE.patch b/0151-net-hns3-fix-packet-type-for-GENEVE.patch new file mode 100644 index 0000000000000000000000000000000000000000..c86ef9b09dc5086cd2e8ebe2b5c27f3eb6e4f016 --- /dev/null +++ b/0151-net-hns3-fix-packet-type-for-GENEVE.patch @@ -0,0 +1,44 @@ +From c2fd801565933c744bc6342f9dad56de644d68a3 Mon Sep 17 00:00:00 2001 +From: Huisong Li +Date: Fri, 21 Oct 2022 15:36:27 +0800 +Subject: [PATCH 151/189] net/hns3: fix packet type for GENEVE + +Currently, hns3 reports VXLAN tunnel packet type for GENEVE, +which is misleading to user. In fact, hns3 hardware cannot +distinguish between VXLAN and GENEVE packet. So this patch +uses RTE_PTYPE_TUNNEL_GRENAT packet type to report. + +Fixes: 7d6df32cf742 ("net/hns3: fix missing outer L4 UDP flag for VXLAN") +Cc: stable@dpdk.org + +Signed-off-by: Huisong Li +Signed-off-by: Dongdong Liu +--- + drivers/net/hns3/hns3_rxtx.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c +index 21c3ef72b1..089caccd7f 100644 +--- a/drivers/net/hns3/hns3_rxtx.c ++++ b/drivers/net/hns3/hns3_rxtx.c +@@ -1995,7 +1995,7 @@ hns3_dev_supported_ptypes_get(struct rte_eth_dev *dev) + RTE_PTYPE_INNER_L4_TCP, + RTE_PTYPE_INNER_L4_SCTP, + RTE_PTYPE_INNER_L4_ICMP, +- RTE_PTYPE_TUNNEL_VXLAN, ++ RTE_PTYPE_TUNNEL_GRENAT, + RTE_PTYPE_TUNNEL_NVGRE, + RTE_PTYPE_UNKNOWN + }; +@@ -2092,7 +2092,7 @@ hns3_init_tunnel_ptype_tbl(struct hns3_ptype_table *tbl) + tbl->ol3table[5] = RTE_PTYPE_L2_ETHER | RTE_PTYPE_L3_IPV6_EXT; + + tbl->ol4table[0] = RTE_PTYPE_UNKNOWN; +- tbl->ol4table[1] = RTE_PTYPE_L4_UDP | RTE_PTYPE_TUNNEL_VXLAN; ++ tbl->ol4table[1] = RTE_PTYPE_L4_UDP | RTE_PTYPE_TUNNEL_GRENAT; + tbl->ol4table[2] = RTE_PTYPE_TUNNEL_NVGRE; + } + +-- +2.23.0 + diff --git a/0151-net-hns3-fix-vector-Rx-burst-limitation.patch b/0151-net-hns3-fix-vector-Rx-burst-limitation.patch deleted file mode 100644 index e59039c422c12326ef6f6facbca854e83fde3b53..0000000000000000000000000000000000000000 --- a/0151-net-hns3-fix-vector-Rx-burst-limitation.patch +++ /dev/null @@ -1,167 +0,0 @@ -From 2cd4eb1717633e841cb1e20ba123a20adf550638 Mon Sep 17 00:00:00 2001 -From: Chengwen Feng -Date: Fri, 30 Apr 2021 14:28:50 +0800 -Subject: [PATCH 151/189] net/hns3: fix vector Rx burst limitation - -Currently, driver uses the macro HNS3_DEFAULT_RX_BURST whose value is -32 to limit the vector Rx burst size, as a result, the burst size -can't exceed 32. - -This patch fixes this problem by support big burst size. -Also adjust HNS3_DEFAULT_RX_BURST to 64 as it performs better than 32. - -Fixes: a3d4f4d291d7 ("net/hns3: support NEON Rx") -Fixes: 952ebacce4f2 ("net/hns3: support SVE Rx") -Cc: stable@dpdk.org - -Signed-off-by: Chengwen Feng -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_rxtx.h | 2 +- - drivers/net/hns3/hns3_rxtx_vec.c | 36 ++++++++++++++++++++++++++++-------- - drivers/net/hns3/hns3_rxtx_vec.h | 3 +++ - drivers/net/hns3/hns3_rxtx_vec_sve.c | 32 ++++++++++++++++++++++++++------ - 4 files changed, 58 insertions(+), 15 deletions(-) - -diff --git a/drivers/net/hns3/hns3_rxtx.h b/drivers/net/hns3/hns3_rxtx.h -index 811be96..a42ab71 100644 ---- a/drivers/net/hns3/hns3_rxtx.h -+++ b/drivers/net/hns3/hns3_rxtx.h -@@ -20,7 +20,7 @@ - #define HNS3_DEFAULT_TX_RS_THRESH 32 - #define HNS3_TX_FAST_FREE_AHEAD 64 - --#define HNS3_DEFAULT_RX_BURST 32 -+#define HNS3_DEFAULT_RX_BURST 64 - #if (HNS3_DEFAULT_RX_BURST > 64) - #error "PMD HNS3: HNS3_DEFAULT_RX_BURST must <= 64\n" - #endif -diff --git a/drivers/net/hns3/hns3_rxtx_vec.c b/drivers/net/hns3/hns3_rxtx_vec.c -index d6636df..5fdc1d5 100644 ---- a/drivers/net/hns3/hns3_rxtx_vec.c -+++ b/drivers/net/hns3/hns3_rxtx_vec.c -@@ -108,14 +108,13 @@ hns3_recv_pkts_vec(void *__restrict rx_queue, - { - struct hns3_rx_queue *rxq = rx_queue; - struct hns3_desc *rxdp = &rxq->rx_ring[rxq->next_to_use]; -- uint64_t bd_err_mask; /* bit mask indicate whick pkts is error */ -+ uint64_t pkt_err_mask; /* bit mask indicate whick pkts is error */ - uint16_t nb_rx; - -- nb_pkts = RTE_MIN(nb_pkts, HNS3_DEFAULT_RX_BURST); -- nb_pkts = RTE_ALIGN_FLOOR(nb_pkts, HNS3_DEFAULT_DESCS_PER_LOOP); -- - rte_prefetch_non_temporal(rxdp); - -+ nb_pkts = RTE_ALIGN_FLOOR(nb_pkts, HNS3_DEFAULT_DESCS_PER_LOOP); -+ - if (rxq->rx_rearm_nb > HNS3_DEFAULT_RXQ_REARM_THRESH) - hns3_rxq_rearm_mbuf(rxq); - -@@ -128,10 +127,31 @@ hns3_recv_pkts_vec(void *__restrict rx_queue, - rte_prefetch0(rxq->sw_ring[rxq->next_to_use + 2].mbuf); - rte_prefetch0(rxq->sw_ring[rxq->next_to_use + 3].mbuf); - -- bd_err_mask = 0; -- nb_rx = hns3_recv_burst_vec(rxq, rx_pkts, nb_pkts, &bd_err_mask); -- if (unlikely(bd_err_mask)) -- nb_rx = hns3_rx_reassemble_pkts(rx_pkts, nb_rx, bd_err_mask); -+ if (likely(nb_pkts <= HNS3_DEFAULT_RX_BURST)) { -+ pkt_err_mask = 0; -+ nb_rx = hns3_recv_burst_vec(rxq, rx_pkts, nb_pkts, -+ &pkt_err_mask); -+ nb_rx = hns3_rx_reassemble_pkts(rx_pkts, nb_rx, pkt_err_mask); -+ return nb_rx; -+ } -+ -+ nb_rx = 0; -+ while (nb_pkts > 0) { -+ uint16_t ret, n; -+ -+ n = RTE_MIN(nb_pkts, HNS3_DEFAULT_RX_BURST); -+ pkt_err_mask = 0; -+ ret = hns3_recv_burst_vec(rxq, &rx_pkts[nb_rx], n, -+ &pkt_err_mask); -+ nb_pkts -= ret; -+ nb_rx += hns3_rx_reassemble_pkts(&rx_pkts[nb_rx], ret, -+ pkt_err_mask); -+ if (ret < n) -+ break; -+ -+ if (rxq->rx_rearm_nb > HNS3_DEFAULT_RXQ_REARM_THRESH) -+ hns3_rxq_rearm_mbuf(rxq); -+ } - - return nb_rx; - } -diff --git a/drivers/net/hns3/hns3_rxtx_vec.h b/drivers/net/hns3/hns3_rxtx_vec.h -index 35d9903..872ba22 100644 ---- a/drivers/net/hns3/hns3_rxtx_vec.h -+++ b/drivers/net/hns3/hns3_rxtx_vec.h -@@ -71,6 +71,9 @@ hns3_rx_reassemble_pkts(struct rte_mbuf **rx_pkts, - uint16_t count, i; - uint64_t mask; - -+ if (likely(pkt_err_mask == 0)) -+ return nb_pkts; -+ - count = 0; - for (i = 0; i < nb_pkts; i++) { - mask = ((uint64_t)1u) << i; -diff --git a/drivers/net/hns3/hns3_rxtx_vec_sve.c b/drivers/net/hns3/hns3_rxtx_vec_sve.c -index e15fd7a..be9a4ff 100644 ---- a/drivers/net/hns3/hns3_rxtx_vec_sve.c -+++ b/drivers/net/hns3/hns3_rxtx_vec_sve.c -@@ -292,12 +292,11 @@ hns3_recv_pkts_vec_sve(void *__restrict rx_queue, - { - struct hns3_rx_queue *rxq = rx_queue; - struct hns3_desc *rxdp = &rxq->rx_ring[rxq->next_to_use]; -- uint64_t bd_err_mask; /* bit mask indicate whick pkts is error */ -+ uint64_t pkt_err_mask; /* bit mask indicate whick pkts is error */ - uint16_t nb_rx; - - rte_prefetch_non_temporal(rxdp); - -- nb_pkts = RTE_MIN(nb_pkts, HNS3_DEFAULT_RX_BURST); - nb_pkts = RTE_ALIGN_FLOOR(nb_pkts, HNS3_SVE_DEFAULT_DESCS_PER_LOOP); - - if (rxq->rx_rearm_nb > HNS3_DEFAULT_RXQ_REARM_THRESH) -@@ -309,10 +308,31 @@ hns3_recv_pkts_vec_sve(void *__restrict rx_queue, - - hns3_rx_prefetch_mbuf_sve(&rxq->sw_ring[rxq->next_to_use]); - -- bd_err_mask = 0; -- nb_rx = hns3_recv_burst_vec_sve(rxq, rx_pkts, nb_pkts, &bd_err_mask); -- if (unlikely(bd_err_mask)) -- nb_rx = hns3_rx_reassemble_pkts(rx_pkts, nb_rx, bd_err_mask); -+ if (likely(nb_pkts <= HNS3_DEFAULT_RX_BURST)) { -+ pkt_err_mask = 0; -+ nb_rx = hns3_recv_burst_vec_sve(rxq, rx_pkts, nb_pkts, -+ &pkt_err_mask); -+ nb_rx = hns3_rx_reassemble_pkts(rx_pkts, nb_rx, pkt_err_mask); -+ return nb_rx; -+ } -+ -+ nb_rx = 0; -+ while (nb_pkts > 0) { -+ uint16_t ret, n; -+ -+ n = RTE_MIN(nb_pkts, HNS3_DEFAULT_RX_BURST); -+ pkt_err_mask = 0; -+ ret = hns3_recv_burst_vec_sve(rxq, &rx_pkts[nb_rx], n, -+ &pkt_err_mask); -+ nb_pkts -= ret; -+ nb_rx += hns3_rx_reassemble_pkts(&rx_pkts[nb_rx], ret, -+ pkt_err_mask); -+ if (ret < n) -+ break; -+ -+ if (rxq->rx_rearm_nb > HNS3_DEFAULT_RXQ_REARM_THRESH) -+ hns3_rxq_rearm_mbuf_sve(rxq); -+ } - - return nb_rx; - } --- -2.7.4 - diff --git a/0152-net-hns3-remove-magic-numbers-for-MAC-address.patch b/0152-net-hns3-remove-magic-numbers-for-MAC-address.patch new file mode 100644 index 0000000000000000000000000000000000000000..68fd0c9c3befc05a357c229717e953fde9a902e7 --- /dev/null +++ b/0152-net-hns3-remove-magic-numbers-for-MAC-address.patch @@ -0,0 +1,40 @@ +From 36416b8c0fd1918ed0f89cca83b8c21e22a529c7 Mon Sep 17 00:00:00 2001 +From: Jie Hai +Date: Fri, 21 Oct 2022 15:36:28 +0800 +Subject: [PATCH 152/189] net/hns3: remove magic numbers for MAC address + +Removing magic numbers with macros. + +Signed-off-by: Jie Hai +Signed-off-by: Dongdong Liu +--- + drivers/net/hns3/hns3_ethdev.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c +index 45b5d699b4..adc47d815d 100644 +--- a/drivers/net/hns3/hns3_ethdev.c ++++ b/drivers/net/hns3/hns3_ethdev.c +@@ -1713,6 +1713,7 @@ hns3_add_mc_mac_addr(struct hns3_hw *hw, struct rte_ether_addr *mac_addr) + char mac_str[RTE_ETHER_ADDR_FMT_SIZE]; + uint8_t vf_id; + int ret; ++ int idx; + + /* Check if mac addr is valid */ + if (!rte_is_multicast_ether_addr(mac_addr)) { +@@ -1730,9 +1731,8 @@ hns3_add_mc_mac_addr(struct hns3_hw *hw, struct rte_ether_addr *mac_addr) + HNS3_MC_MAC_VLAN_OPS_DESC_NUM); + if (ret) { + /* This mac addr do not exist, add new entry for it */ +- memset(desc[0].data, 0, sizeof(desc[0].data)); +- memset(desc[1].data, 0, sizeof(desc[0].data)); +- memset(desc[2].data, 0, sizeof(desc[0].data)); ++ for (idx = 0; idx < HNS3_MC_MAC_VLAN_OPS_DESC_NUM; idx++) ++ memset(desc[idx].data, 0, sizeof(desc[idx].data)); + } + + /* +-- +2.23.0 + diff --git a/0152-net-hns3-remove-read-when-enabling-TM-QCN-error-even.patch b/0152-net-hns3-remove-read-when-enabling-TM-QCN-error-even.patch deleted file mode 100644 index ef7023a3e3ed26d48959fd7e10201e734ae69ad6..0000000000000000000000000000000000000000 --- a/0152-net-hns3-remove-read-when-enabling-TM-QCN-error-even.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 44d86d6218b9da9d8218a629011ddd432a27a67c Mon Sep 17 00:00:00 2001 -From: Chengwen Feng -Date: Fri, 30 Apr 2021 17:04:02 +0800 -Subject: [PATCH 152/189] net/hns3: remove read when enabling TM QCN error - event - -According to the HW manual, the read operation is unnecessary when -enabling TM QCN error event, so remove it. - -Fixes: f53a793bb7c2 ("net/hns3: add more hardware error types") -Cc: stable@dpdk.org - -Signed-off-by: Chengwen Feng -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_intr.c | 9 +-------- - 1 file changed, 1 insertion(+), 8 deletions(-) - -diff --git a/drivers/net/hns3/hns3_intr.c b/drivers/net/hns3/hns3_intr.c -index e216788..87afce2 100644 ---- a/drivers/net/hns3/hns3_intr.c -+++ b/drivers/net/hns3/hns3_intr.c -@@ -1782,14 +1782,7 @@ enable_tm_err_intr(struct hns3_adapter *hns, bool en) - } - - /* configure TM QCN hw errors */ -- hns3_cmd_setup_basic_desc(&desc, HNS3_OPC_TM_QCN_MEM_INT_CFG, true); -- ret = hns3_cmd_send(hw, &desc, 1); -- if (ret) { -- hns3_err(hw, "fail to read TM QCN CFG status, ret = %d\n", ret); -- return ret; -- } -- -- hns3_cmd_reuse_desc(&desc, false); -+ hns3_cmd_setup_basic_desc(&desc, HNS3_OPC_TM_QCN_MEM_INT_CFG, false); - if (en) - desc.data[1] = rte_cpu_to_le_32(HNS3_TM_QCN_MEM_ERR_INT_EN); - --- -2.7.4 - diff --git a/0153-net-hns3-fix-code-check-warnings.patch b/0153-net-hns3-fix-code-check-warnings.patch new file mode 100644 index 0000000000000000000000000000000000000000..564a862ac6b13a1013e0113920e382a2df0f5443 --- /dev/null +++ b/0153-net-hns3-fix-code-check-warnings.patch @@ -0,0 +1,379 @@ +From 308a29f8342797bedb8005b7061a9b10be36cc6c Mon Sep 17 00:00:00 2001 +From: "Min Hu (Connor)" +Date: Fri, 21 Oct 2022 15:36:29 +0800 +Subject: [PATCH 153/189] net/hns3: fix code check warnings + +Fix code check warnings according to: + - function should have same name with previous declaration; + - local variable should no be referenced in macro referenced; + - macro argument 'adapter' should be enclosed in parentheses. + +Signed-off-by: Min Hu (Connor) +Signed-off-by: Dongdong Liu +--- + drivers/net/hns3/hns3_common.c | 4 ++-- + drivers/net/hns3/hns3_dump.c | 4 ++-- + drivers/net/hns3/hns3_ethdev.h | 14 +++++++------- + drivers/net/hns3/hns3_flow.c | 4 ++-- + drivers/net/hns3/hns3_intr.c | 27 ++++++++++++--------------- + drivers/net/hns3/hns3_intr.h | 4 ++-- + drivers/net/hns3/hns3_regs.c | 4 ++-- + drivers/net/hns3/hns3_rss.c | 2 +- + drivers/net/hns3/hns3_rss.h | 2 +- + drivers/net/hns3/hns3_rxtx.c | 4 ++-- + drivers/net/hns3/hns3_rxtx.h | 14 +++++++++----- + drivers/net/hns3/hns3_stats.h | 5 +++-- + 12 files changed, 45 insertions(+), 43 deletions(-) + +diff --git a/drivers/net/hns3/hns3_common.c b/drivers/net/hns3/hns3_common.c +index 7a65db907e..1a1a016aa6 100644 +--- a/drivers/net/hns3/hns3_common.c ++++ b/drivers/net/hns3/hns3_common.c +@@ -493,7 +493,7 @@ hns3_configure_all_mac_addr(struct hns3_adapter *hns, bool del) + if (ret) { + hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE, + addr); +- hns3_err(hw, "failed to %s mac addr(%s) index:%d ret = %d.", ++ hns3_err(hw, "failed to %s mac addr(%s) index:%u ret = %d.", + del ? "remove" : "restore", mac_str, i, ret); + } + } +@@ -680,7 +680,7 @@ hns3_init_ring_with_vector(struct hns3_hw *hw) + ret = hw->ops.bind_ring_with_vector(hw, vec, false, + HNS3_RING_TYPE_TX, i); + if (ret) { +- PMD_INIT_LOG(ERR, "fail to unbind TX ring(%d) with vector: %u, ret=%d", ++ PMD_INIT_LOG(ERR, "fail to unbind TX ring(%u) with vector: %u, ret=%d", + i, vec, ret); + return ret; + } +diff --git a/drivers/net/hns3/hns3_dump.c b/drivers/net/hns3/hns3_dump.c +index 646e93d8e6..cf5b500be1 100644 +--- a/drivers/net/hns3/hns3_dump.c ++++ b/drivers/net/hns3/hns3_dump.c +@@ -342,7 +342,7 @@ static void + hns3_print_queue_state_perline(FILE *file, const uint32_t *queue_state, + uint32_t nb_queues, uint32_t line_num) + { +-#define HNS3_NUM_QUEUE_PER_LINE (sizeof(*queue_state) * HNS3_UINT8_BIT) ++#define HNS3_NUM_QUEUE_PER_LINE (sizeof(uint32_t) * HNS3_UINT8_BIT) + uint32_t id = line_num * HNS3_NUM_QUEUE_PER_LINE; + uint32_t i; + +@@ -365,7 +365,7 @@ static void + hns3_display_queue_enable_state(FILE *file, const uint32_t *queue_state, + uint32_t nb_queues, bool is_rxq) + { +-#define HNS3_NUM_QUEUE_PER_LINE (sizeof(*queue_state) * HNS3_UINT8_BIT) ++#define HNS3_NUM_QUEUE_PER_LINE (sizeof(uint32_t) * HNS3_UINT8_BIT) + uint32_t i; + + fprintf(file, "\t %s queue id | enable state bitMap\n", +diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h +index eb8ca1e60f..aad779e949 100644 +--- a/drivers/net/hns3/hns3_ethdev.h ++++ b/drivers/net/hns3/hns3_ethdev.h +@@ -898,11 +898,11 @@ enum hns3_dev_cap { + hns3_get_bit((hw)->capability, HNS3_DEV_SUPPORT_##_name##_B) + + #define HNS3_DEV_PRIVATE_TO_HW(adapter) \ +- (&((struct hns3_adapter *)adapter)->hw) ++ (&((struct hns3_adapter *)(adapter))->hw) + #define HNS3_DEV_PRIVATE_TO_PF(adapter) \ +- (&((struct hns3_adapter *)adapter)->pf) ++ (&((struct hns3_adapter *)(adapter))->pf) + #define HNS3_DEV_PRIVATE_TO_VF(adapter) \ +- (&((struct hns3_adapter *)adapter)->vf) ++ (&((struct hns3_adapter *)(adapter))->vf) + #define HNS3_DEV_HW_TO_ADAPTER(hw) \ + container_of(hw, struct hns3_adapter, hw) + +@@ -999,10 +999,10 @@ static inline uint32_t hns3_read_reg(void *base, uint32_t reg) + + #define NEXT_ITEM_OF_ACTION(act, actions, index) \ + do { \ +- act = (actions) + (index); \ +- while (act->type == RTE_FLOW_ACTION_TYPE_VOID) { \ ++ (act) = (actions) + (index); \ ++ while ((act)->type == RTE_FLOW_ACTION_TYPE_VOID) { \ + (index)++; \ +- act = actions + index; \ ++ (act) = (actions) + (index); \ + } \ + } while (0) + +@@ -1027,7 +1027,7 @@ hns3_atomic_clear_bit(unsigned int nr, volatile uint64_t *addr) + __atomic_fetch_and(addr, ~(1UL << nr), __ATOMIC_RELAXED); + } + +-static inline int64_t ++static inline uint64_t + hns3_test_and_clear_bit(unsigned int nr, volatile uint64_t *addr) + { + uint64_t mask = (1UL << nr); +diff --git a/drivers/net/hns3/hns3_flow.c b/drivers/net/hns3/hns3_flow.c +index 2b4286d46d..1aee965e4a 100644 +--- a/drivers/net/hns3/hns3_flow.c ++++ b/drivers/net/hns3/hns3_flow.c +@@ -66,7 +66,7 @@ static enum rte_flow_item_type tunnel_next_items[] = { + + struct items_step_mngr { + enum rte_flow_item_type *items; +- int count; ++ size_t count; + }; + + static inline void +@@ -1141,7 +1141,7 @@ hns3_validate_item(const struct rte_flow_item *item, + struct items_step_mngr step_mngr, + struct rte_flow_error *error) + { +- int i; ++ uint32_t i; + + if (item->last) + return rte_flow_error_set(error, ENOTSUP, +diff --git a/drivers/net/hns3/hns3_intr.c b/drivers/net/hns3/hns3_intr.c +index 3ca2e1e338..4bdcd6070b 100644 +--- a/drivers/net/hns3/hns3_intr.c ++++ b/drivers/net/hns3/hns3_intr.c +@@ -16,12 +16,6 @@ + + #define SWITCH_CONTEXT_US 10 + +-#define HNS3_CHECK_MERGE_CNT(val) \ +- do { \ +- if (val) \ +- hw->reset.stats.merge_cnt++; \ +- } while (0) +- + static const char *reset_string[HNS3_MAX_RESET] = { + "flr", "vf_func", "vf_pf_func", "vf_full", "vf_global", + "pf_func", "global", "IMP", "none", +@@ -2525,20 +2519,20 @@ static void + hns3_clear_reset_level(struct hns3_hw *hw, uint64_t *levels) + { + uint64_t merge_cnt = hw->reset.stats.merge_cnt; +- int64_t tmp; ++ uint64_t tmp; + + switch (hw->reset.level) { + case HNS3_IMP_RESET: + hns3_atomic_clear_bit(HNS3_IMP_RESET, levels); + tmp = hns3_test_and_clear_bit(HNS3_GLOBAL_RESET, levels); +- HNS3_CHECK_MERGE_CNT(tmp); ++ merge_cnt = tmp > 0 ? merge_cnt + 1 : merge_cnt; + tmp = hns3_test_and_clear_bit(HNS3_FUNC_RESET, levels); +- HNS3_CHECK_MERGE_CNT(tmp); ++ merge_cnt = tmp > 0 ? merge_cnt + 1 : merge_cnt; + break; + case HNS3_GLOBAL_RESET: + hns3_atomic_clear_bit(HNS3_GLOBAL_RESET, levels); + tmp = hns3_test_and_clear_bit(HNS3_FUNC_RESET, levels); +- HNS3_CHECK_MERGE_CNT(tmp); ++ merge_cnt = tmp > 0 ? merge_cnt + 1 : merge_cnt; + break; + case HNS3_FUNC_RESET: + hns3_atomic_clear_bit(HNS3_FUNC_RESET, levels); +@@ -2546,19 +2540,19 @@ hns3_clear_reset_level(struct hns3_hw *hw, uint64_t *levels) + case HNS3_VF_RESET: + hns3_atomic_clear_bit(HNS3_VF_RESET, levels); + tmp = hns3_test_and_clear_bit(HNS3_VF_PF_FUNC_RESET, levels); +- HNS3_CHECK_MERGE_CNT(tmp); ++ merge_cnt = tmp > 0 ? merge_cnt + 1 : merge_cnt; + tmp = hns3_test_and_clear_bit(HNS3_VF_FUNC_RESET, levels); +- HNS3_CHECK_MERGE_CNT(tmp); ++ merge_cnt = tmp > 0 ? merge_cnt + 1 : merge_cnt; + break; + case HNS3_VF_FULL_RESET: + hns3_atomic_clear_bit(HNS3_VF_FULL_RESET, levels); + tmp = hns3_test_and_clear_bit(HNS3_VF_FUNC_RESET, levels); +- HNS3_CHECK_MERGE_CNT(tmp); ++ merge_cnt = tmp > 0 ? merge_cnt + 1 : merge_cnt; + break; + case HNS3_VF_PF_FUNC_RESET: + hns3_atomic_clear_bit(HNS3_VF_PF_FUNC_RESET, levels); + tmp = hns3_test_and_clear_bit(HNS3_VF_FUNC_RESET, levels); +- HNS3_CHECK_MERGE_CNT(tmp); ++ merge_cnt = tmp > 0 ? merge_cnt + 1 : merge_cnt; + break; + case HNS3_VF_FUNC_RESET: + hns3_atomic_clear_bit(HNS3_VF_FUNC_RESET, levels); +@@ -2570,13 +2564,16 @@ hns3_clear_reset_level(struct hns3_hw *hw, uint64_t *levels) + default: + return; + }; +- if (merge_cnt != hw->reset.stats.merge_cnt) ++ ++ if (merge_cnt != hw->reset.stats.merge_cnt) { + hns3_warn(hw, + "No need to do low-level reset after %s reset. " + "merge cnt: %" PRIu64 " total merge cnt: %" PRIu64, + reset_string[hw->reset.level], + hw->reset.stats.merge_cnt - merge_cnt, + hw->reset.stats.merge_cnt); ++ hw->reset.stats.merge_cnt = merge_cnt; ++ } + } + + static bool +diff --git a/drivers/net/hns3/hns3_intr.h b/drivers/net/hns3/hns3_intr.h +index 1a0f196614..1490a5e387 100644 +--- a/drivers/net/hns3/hns3_intr.h ++++ b/drivers/net/hns3/hns3_intr.h +@@ -170,7 +170,7 @@ struct hns3_hw_error_desc { + const struct hns3_hw_error *hw_err; + }; + +-int hns3_enable_hw_error_intr(struct hns3_adapter *hns, bool state); ++int hns3_enable_hw_error_intr(struct hns3_adapter *hns, bool en); + void hns3_handle_msix_error(struct hns3_adapter *hns, uint64_t *levels); + void hns3_handle_ras_error(struct hns3_adapter *hns, uint64_t *levels); + void hns3_config_mac_tnl_int(struct hns3_hw *hw, bool en); +@@ -185,7 +185,7 @@ void hns3_schedule_reset(struct hns3_adapter *hns); + void hns3_schedule_delayed_reset(struct hns3_adapter *hns); + int hns3_reset_req_hw_reset(struct hns3_adapter *hns); + int hns3_reset_process(struct hns3_adapter *hns, +- enum hns3_reset_level reset_level); ++ enum hns3_reset_level new_level); + void hns3_reset_abort(struct hns3_adapter *hns); + void hns3_start_report_lse(struct rte_eth_dev *dev); + void hns3_stop_report_lse(struct rte_eth_dev *dev); +diff --git a/drivers/net/hns3/hns3_regs.c b/drivers/net/hns3/hns3_regs.c +index 6778e4cfc2..33392fd1f0 100644 +--- a/drivers/net/hns3/hns3_regs.c ++++ b/drivers/net/hns3/hns3_regs.c +@@ -15,7 +15,7 @@ + #define REG_NUM_PER_LINE 4 + #define REG_LEN_PER_LINE (REG_NUM_PER_LINE * sizeof(uint32_t)) + +-static int hns3_get_dfx_reg_line(struct hns3_hw *hw, uint32_t *length); ++static int hns3_get_dfx_reg_line(struct hns3_hw *hw, uint32_t *lines); + + static const uint32_t cmdq_reg_addrs[] = {HNS3_CMDQ_TX_ADDR_L_REG, + HNS3_CMDQ_TX_ADDR_H_REG, +@@ -295,7 +295,7 @@ hns3_direct_access_regs(struct hns3_hw *hw, uint32_t *data) + uint32_t *origin_data_ptr = data; + uint32_t reg_offset; + uint16_t i, j; +- int reg_num; ++ size_t reg_num; + + /* fetching per-PF registers values from PF PCIe register space */ + reg_num = sizeof(cmdq_reg_addrs) / sizeof(uint32_t); +diff --git a/drivers/net/hns3/hns3_rss.c b/drivers/net/hns3/hns3_rss.c +index 1003daf03e..fc912ed2e8 100644 +--- a/drivers/net/hns3/hns3_rss.c ++++ b/drivers/net/hns3/hns3_rss.c +@@ -10,7 +10,7 @@ + #include "hns3_logs.h" + + /* Default hash keys */ +-const uint8_t hns3_hash_key[] = { ++const uint8_t hns3_hash_key[HNS3_RSS_KEY_SIZE] = { + 0x6D, 0x5A, 0x56, 0xDA, 0x25, 0x5B, 0x0E, 0xC2, + 0x41, 0x67, 0x25, 0x3D, 0x43, 0xA3, 0x8F, 0xB0, + 0xD0, 0xCA, 0x2B, 0xCB, 0xAE, 0x7B, 0x30, 0xB4, +diff --git a/drivers/net/hns3/hns3_rss.h b/drivers/net/hns3/hns3_rss.h +index 78c9eff827..a12f8b7034 100644 +--- a/drivers/net/hns3/hns3_rss.h ++++ b/drivers/net/hns3/hns3_rss.h +@@ -88,7 +88,7 @@ static inline uint32_t roundup_pow_of_two(uint32_t x) + return 1UL << fls(x - 1); + } + +-extern const uint8_t hns3_hash_key[]; ++extern const uint8_t hns3_hash_key[HNS3_RSS_KEY_SIZE]; + + struct hns3_adapter; + +diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c +index 089caccd7f..f7641b1309 100644 +--- a/drivers/net/hns3/hns3_rxtx.c ++++ b/drivers/net/hns3/hns3_rxtx.c +@@ -2762,7 +2762,7 @@ hns3_rx_check_vec_support(__rte_unused struct rte_eth_dev *dev) + } + + uint16_t __rte_weak +-hns3_recv_pkts_vec(__rte_unused void *tx_queue, ++hns3_recv_pkts_vec(__rte_unused void *rx_queue, + __rte_unused struct rte_mbuf **rx_pkts, + __rte_unused uint16_t nb_pkts) + { +@@ -2770,7 +2770,7 @@ hns3_recv_pkts_vec(__rte_unused void *tx_queue, + } + + uint16_t __rte_weak +-hns3_recv_pkts_vec_sve(__rte_unused void *tx_queue, ++hns3_recv_pkts_vec_sve(__rte_unused void *rx_queue, + __rte_unused struct rte_mbuf **rx_pkts, + __rte_unused uint16_t nb_pkts) + { +diff --git a/drivers/net/hns3/hns3_rxtx.h b/drivers/net/hns3/hns3_rxtx.h +index 803e805a5b..87c7c115a1 100644 +--- a/drivers/net/hns3/hns3_rxtx.h ++++ b/drivers/net/hns3/hns3_rxtx.h +@@ -691,10 +691,12 @@ int hns3_rxq_iterate(struct rte_eth_dev *dev, + int (*callback)(struct hns3_rx_queue *, void *), void *arg); + void hns3_dev_release_mbufs(struct hns3_adapter *hns); + int hns3_rx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t nb_desc, +- unsigned int socket, const struct rte_eth_rxconf *conf, ++ unsigned int socket_id, ++ const struct rte_eth_rxconf *conf, + struct rte_mempool *mp); + int hns3_tx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t nb_desc, +- unsigned int socket, const struct rte_eth_txconf *conf); ++ unsigned int socket_id, ++ const struct rte_eth_txconf *conf); + uint32_t hns3_rx_queue_count(void *rx_queue); + int hns3_dev_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id); + int hns3_dev_rx_queue_stop(struct rte_eth_dev *dev, uint16_t rx_queue_id); +@@ -704,9 +706,11 @@ uint16_t hns3_recv_pkts_simple(void *rx_queue, struct rte_mbuf **rx_pkts, + uint16_t nb_pkts); + uint16_t hns3_recv_scattered_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, + uint16_t nb_pkts); +-uint16_t hns3_recv_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts, ++uint16_t hns3_recv_pkts_vec(void *__restrict rx_queue, ++ struct rte_mbuf **__restrict rx_pkts, + uint16_t nb_pkts); +-uint16_t hns3_recv_pkts_vec_sve(void *rx_queue, struct rte_mbuf **rx_pkts, ++uint16_t hns3_recv_pkts_vec_sve(void *__restrict rx_queue, ++ struct rte_mbuf **__restrict rx_pkts, + uint16_t nb_pkts); + int hns3_rx_burst_mode_get(struct rte_eth_dev *dev, + __rte_unused uint16_t queue_id, +@@ -754,7 +758,7 @@ void hns3_rxq_info_get(struct rte_eth_dev *dev, uint16_t queue_id, + struct rte_eth_rxq_info *qinfo); + void hns3_txq_info_get(struct rte_eth_dev *dev, uint16_t queue_id, + struct rte_eth_txq_info *qinfo); +-uint32_t hns3_get_tqp_reg_offset(uint16_t idx); ++uint32_t hns3_get_tqp_reg_offset(uint16_t queue_id); + int hns3_start_all_txqs(struct rte_eth_dev *dev); + int hns3_start_all_rxqs(struct rte_eth_dev *dev); + void hns3_stop_all_txqs(struct rte_eth_dev *dev); +diff --git a/drivers/net/hns3/hns3_stats.h b/drivers/net/hns3/hns3_stats.h +index b5cd6188b4..9d84072205 100644 +--- a/drivers/net/hns3/hns3_stats.h ++++ b/drivers/net/hns3/hns3_stats.h +@@ -145,7 +145,8 @@ struct hns3_reset_stats; + #define HNS3_IMISSED_STATS_FIELD_OFFSET(f) \ + (offsetof(struct hns3_rx_missed_stats, f)) + +-int hns3_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *rte_stats); ++int hns3_stats_get(struct rte_eth_dev *eth_dev, ++ struct rte_eth_stats *rte_stats); + int hns3_dev_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *xstats, + unsigned int n); + int hns3_dev_xstats_reset(struct rte_eth_dev *dev); +@@ -160,7 +161,7 @@ int hns3_dev_xstats_get_names_by_id(struct rte_eth_dev *dev, + const uint64_t *ids, + struct rte_eth_xstat_name *xstats_names, + uint32_t size); +-int hns3_stats_reset(struct rte_eth_dev *dev); ++int hns3_stats_reset(struct rte_eth_dev *eth_dev); + int hns3_stats_init(struct hns3_hw *hw); + void hns3_stats_uninit(struct hns3_hw *hw); + int hns3_query_mac_stats_reg_num(struct hns3_hw *hw); +-- +2.23.0 + diff --git a/0153-net-hns3-remove-unused-VMDq-code.patch b/0153-net-hns3-remove-unused-VMDq-code.patch deleted file mode 100644 index 91e8b183eb174314bd1604c236b1d094c276effc..0000000000000000000000000000000000000000 --- a/0153-net-hns3-remove-unused-VMDq-code.patch +++ /dev/null @@ -1,83 +0,0 @@ -From 4a924045f23a81a07b59233f7bc12c1e38daa234 Mon Sep 17 00:00:00 2001 -From: Chengwen Feng -Date: Fri, 30 Apr 2021 17:04:03 +0800 -Subject: [PATCH 153/189] net/hns3: remove unused VMDq code - -VMDq is not supported yet, so remove the unused code. - -Fixes: d51867db65c1 ("net/hns3: add initialization") -Fixes: 1265b5372d9d ("net/hns3: add some definitions for data structure and macro") -Cc: stable@dpdk.org - -Signed-off-by: Chengwen Feng -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_cmd.h | 2 -- - drivers/net/hns3/hns3_ethdev.c | 4 ---- - drivers/net/hns3/hns3_ethdev.h | 1 - - drivers/net/hns3/hns3_ethdev_vf.c | 2 -- - 4 files changed, 9 deletions(-) - -diff --git a/drivers/net/hns3/hns3_cmd.h b/drivers/net/hns3/hns3_cmd.h -index ac74e4d..a249a7a 100644 ---- a/drivers/net/hns3/hns3_cmd.h -+++ b/drivers/net/hns3/hns3_cmd.h -@@ -457,8 +457,6 @@ struct hns3_umv_spc_alc_cmd { - #define HNS3_CFG_RD_LEN_BYTES 16 - #define HNS3_CFG_RD_LEN_UNIT 4 - --#define HNS3_CFG_VMDQ_S 0 --#define HNS3_CFG_VMDQ_M GENMASK(7, 0) - #define HNS3_CFG_TC_NUM_S 8 - #define HNS3_CFG_TC_NUM_M GENMASK(15, 8) - #define HNS3_CFG_TQP_DESC_N_S 16 -diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c -index f5160ed..44e6c5b 100644 ---- a/drivers/net/hns3/hns3_ethdev.c -+++ b/drivers/net/hns3/hns3_ethdev.c -@@ -2791,8 +2791,6 @@ hns3_dev_infos_get(struct rte_eth_dev *eth_dev, struct rte_eth_dev_info *info) - .offloads = 0, - }; - -- info->vmdq_queue_num = 0; -- - info->reta_size = hw->rss_ind_tbl_size; - info->hash_key_size = HNS3_RSS_KEY_SIZE; - info->flow_type_rss_offloads = HNS3_ETH_RSS_SUPPORT; -@@ -3072,8 +3070,6 @@ hns3_parse_cfg(struct hns3_cfg *cfg, struct hns3_cmd_desc *desc) - req = (struct hns3_cfg_param_cmd *)desc[0].data; - - /* get the configuration */ -- cfg->vmdq_vport_num = hns3_get_field(rte_le_to_cpu_32(req->param[0]), -- HNS3_CFG_VMDQ_M, HNS3_CFG_VMDQ_S); - cfg->tc_num = hns3_get_field(rte_le_to_cpu_32(req->param[0]), - HNS3_CFG_TC_NUM_M, HNS3_CFG_TC_NUM_S); - cfg->tqp_desc_num = hns3_get_field(rte_le_to_cpu_32(req->param[0]), -diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h -index c70950a..53dc498 100644 ---- a/drivers/net/hns3/hns3_ethdev.h -+++ b/drivers/net/hns3/hns3_ethdev.h -@@ -155,7 +155,6 @@ struct hns3_tc_queue_info { - }; - - struct hns3_cfg { -- uint8_t vmdq_vport_num; - uint8_t tc_num; - uint16_t tqp_desc_num; - uint16_t rx_buf_len; -diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c -index f4d2a9f..c4419fb 100644 ---- a/drivers/net/hns3/hns3_ethdev_vf.c -+++ b/drivers/net/hns3/hns3_ethdev_vf.c -@@ -1022,8 +1022,6 @@ hns3vf_dev_infos_get(struct rte_eth_dev *eth_dev, struct rte_eth_dev_info *info) - .offloads = 0, - }; - -- info->vmdq_queue_num = 0; -- - info->reta_size = hw->rss_ind_tbl_size; - info->hash_key_size = HNS3_RSS_KEY_SIZE; - info->flow_type_rss_offloads = HNS3_ETH_RSS_SUPPORT; --- -2.7.4 - diff --git a/0154-net-hns3-fix-header-files-includes.patch b/0154-net-hns3-fix-header-files-includes.patch new file mode 100644 index 0000000000000000000000000000000000000000..938a6dd78a659e148a6ede29874dc1ae3634fb09 --- /dev/null +++ b/0154-net-hns3-fix-header-files-includes.patch @@ -0,0 +1,285 @@ +From 0dcac22b697cc9585a91793d4b632cff11391ec3 Mon Sep 17 00:00:00 2001 +From: Chengwen Feng +Date: Fri, 21 Oct 2022 15:36:30 +0800 +Subject: [PATCH 154/189] net/hns3: fix header files includes + +Header files should be self contained and should not be cyclically +dependent. + +Signed-off-by: Chengwen Feng +Signed-off-by: Min Hu (Connor) +Signed-off-by: Dongdong Liu +--- + drivers/net/hns3/hns3_cmd.h | 3 +++ + drivers/net/hns3/hns3_common.c | 2 +- + drivers/net/hns3/hns3_dcb.h | 4 ++++ + drivers/net/hns3/hns3_ethdev.c | 2 +- + drivers/net/hns3/hns3_fdir.h | 5 +++++ + drivers/net/hns3/hns3_flow.h | 3 +++ + drivers/net/hns3/hns3_intr.c | 2 +- + drivers/net/hns3/hns3_mbx.h | 4 ++++ + drivers/net/hns3/hns3_mp.h | 2 ++ + drivers/net/hns3/hns3_regs.h | 3 +++ + drivers/net/hns3/hns3_rss.h | 2 ++ + drivers/net/hns3/hns3_rxtx.c | 2 +- + drivers/net/hns3/hns3_rxtx.h | 9 +++++++++ + drivers/net/hns3/hns3_stats.h | 5 +++++ + drivers/net/hns3/hns3_tm.h | 2 ++ + 15 files changed, 46 insertions(+), 4 deletions(-) + +diff --git a/drivers/net/hns3/hns3_cmd.h b/drivers/net/hns3/hns3_cmd.h +index 82c999061d..bee96c1e46 100644 +--- a/drivers/net/hns3/hns3_cmd.h ++++ b/drivers/net/hns3/hns3_cmd.h +@@ -7,6 +7,9 @@ + + #include + ++#include ++#include ++ + #define HNS3_CMDQ_TX_TIMEOUT 30000 + #define HNS3_CMDQ_CLEAR_WAIT_TIME 200 + #define HNS3_CMDQ_RX_INVLD_B 0 +diff --git a/drivers/net/hns3/hns3_common.c b/drivers/net/hns3/hns3_common.c +index 1a1a016aa6..716cebbcec 100644 +--- a/drivers/net/hns3/hns3_common.c ++++ b/drivers/net/hns3/hns3_common.c +@@ -7,10 +7,10 @@ + #include + #include + +-#include "hns3_common.h" + #include "hns3_logs.h" + #include "hns3_regs.h" + #include "hns3_rxtx.h" ++#include "hns3_common.h" + + int + hns3_fw_version_get(struct rte_eth_dev *eth_dev, char *fw_version, +diff --git a/drivers/net/hns3/hns3_dcb.h b/drivers/net/hns3/hns3_dcb.h +index e06ec177c8..9d9e7684c1 100644 +--- a/drivers/net/hns3/hns3_dcb.h ++++ b/drivers/net/hns3/hns3_dcb.h +@@ -7,7 +7,11 @@ + + #include + ++#include ++#include ++ + #include "hns3_cmd.h" ++#include "hns3_ethdev.h" + + #define HNS3_ETHER_MAX_RATE 100000 + +diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c +index adc47d815d..7b0e8fc77d 100644 +--- a/drivers/net/hns3/hns3_ethdev.c ++++ b/drivers/net/hns3/hns3_ethdev.c +@@ -6,7 +6,6 @@ + #include + #include + +-#include "hns3_ethdev.h" + #include "hns3_common.h" + #include "hns3_dump.h" + #include "hns3_logs.h" +@@ -16,6 +15,7 @@ + #include "hns3_dcb.h" + #include "hns3_mp.h" + #include "hns3_flow.h" ++#include "hns3_ethdev.h" + + #define HNS3_SERVICE_INTERVAL 1000000 /* us */ + #define HNS3_SERVICE_QUICK_INTERVAL 10 +diff --git a/drivers/net/hns3/hns3_fdir.h b/drivers/net/hns3/hns3_fdir.h +index 4d18759160..7be1c0a248 100644 +--- a/drivers/net/hns3/hns3_fdir.h ++++ b/drivers/net/hns3/hns3_fdir.h +@@ -5,6 +5,10 @@ + #ifndef _HNS3_FDIR_H_ + #define _HNS3_FDIR_H_ + ++#include ++ ++#include ++ + struct hns3_fd_key_cfg { + uint8_t key_sel; + uint8_t inner_sipv6_word_en; +@@ -177,6 +181,7 @@ struct hns3_fdir_info { + }; + + struct hns3_adapter; ++struct hns3_hw; + + int hns3_init_fd_config(struct hns3_adapter *hns); + int hns3_fdir_filter_init(struct hns3_adapter *hns); +diff --git a/drivers/net/hns3/hns3_flow.h b/drivers/net/hns3/hns3_flow.h +index 854fbb7ff0..ec94510152 100644 +--- a/drivers/net/hns3/hns3_flow.h ++++ b/drivers/net/hns3/hns3_flow.h +@@ -6,6 +6,9 @@ + #define _HNS3_FLOW_H_ + + #include ++#include ++ ++#include "hns3_rss.h" + + struct hns3_flow_counter { + LIST_ENTRY(hns3_flow_counter) next; /* Pointer to the next counter. */ +diff --git a/drivers/net/hns3/hns3_intr.c b/drivers/net/hns3/hns3_intr.c +index 4bdcd6070b..57679254ee 100644 +--- a/drivers/net/hns3/hns3_intr.c ++++ b/drivers/net/hns3/hns3_intr.c +@@ -10,9 +10,9 @@ + + #include "hns3_common.h" + #include "hns3_logs.h" +-#include "hns3_intr.h" + #include "hns3_regs.h" + #include "hns3_rxtx.h" ++#include "hns3_intr.h" + + #define SWITCH_CONTEXT_US 10 + +diff --git a/drivers/net/hns3/hns3_mbx.h b/drivers/net/hns3/hns3_mbx.h +index d637bd2b23..b6ccd9ff8c 100644 +--- a/drivers/net/hns3/hns3_mbx.h ++++ b/drivers/net/hns3/hns3_mbx.h +@@ -5,6 +5,10 @@ + #ifndef _HNS3_MBX_H_ + #define _HNS3_MBX_H_ + ++#include ++ ++#include ++ + enum HNS3_MBX_OPCODE { + HNS3_MBX_RESET = 0x01, /* (VF -> PF) assert reset */ + HNS3_MBX_ASSERTING_RESET, /* (PF -> VF) PF is asserting reset */ +diff --git a/drivers/net/hns3/hns3_mp.h b/drivers/net/hns3/hns3_mp.h +index a74221d086..230230bbfe 100644 +--- a/drivers/net/hns3/hns3_mp.h ++++ b/drivers/net/hns3/hns3_mp.h +@@ -5,6 +5,8 @@ + #ifndef _HNS3_MP_H_ + #define _HNS3_MP_H_ + ++#include ++ + /* Local data for primary or secondary process. */ + struct hns3_process_local_data { + bool init_done; /* Process action register completed flag. */ +diff --git a/drivers/net/hns3/hns3_regs.h b/drivers/net/hns3/hns3_regs.h +index 5812eb39db..2636429844 100644 +--- a/drivers/net/hns3/hns3_regs.h ++++ b/drivers/net/hns3/hns3_regs.h +@@ -5,6 +5,9 @@ + #ifndef _HNS3_REGS_H_ + #define _HNS3_REGS_H_ + ++#include ++#include ++ + /* bar registers for cmdq */ + #define HNS3_CMDQ_TX_ADDR_L_REG 0x27000 + #define HNS3_CMDQ_TX_ADDR_H_REG 0x27004 +diff --git a/drivers/net/hns3/hns3_rss.h b/drivers/net/hns3/hns3_rss.h +index a12f8b7034..ebb51b4c66 100644 +--- a/drivers/net/hns3/hns3_rss.h ++++ b/drivers/net/hns3/hns3_rss.h +@@ -4,6 +4,7 @@ + + #ifndef _HNS3_RSS_H_ + #define _HNS3_RSS_H_ ++ + #include + #include + +@@ -91,6 +92,7 @@ static inline uint32_t roundup_pow_of_two(uint32_t x) + extern const uint8_t hns3_hash_key[HNS3_RSS_KEY_SIZE]; + + struct hns3_adapter; ++struct hns3_hw; + + int hns3_dev_rss_hash_update(struct rte_eth_dev *dev, + struct rte_eth_rss_conf *rss_conf); +diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c +index f7641b1309..8ad40a49c7 100644 +--- a/drivers/net/hns3/hns3_rxtx.c ++++ b/drivers/net/hns3/hns3_rxtx.c +@@ -17,10 +17,10 @@ + #endif + + #include "hns3_common.h" +-#include "hns3_rxtx.h" + #include "hns3_regs.h" + #include "hns3_logs.h" + #include "hns3_mp.h" ++#include "hns3_rxtx.h" + + #define HNS3_CFG_DESC_NUM(num) ((num) / 8 - 1) + #define HNS3_RX_RING_PREFETCTH_MASK 3 +diff --git a/drivers/net/hns3/hns3_rxtx.h b/drivers/net/hns3/hns3_rxtx.h +index 87c7c115a1..f619d6d466 100644 +--- a/drivers/net/hns3/hns3_rxtx.h ++++ b/drivers/net/hns3/hns3_rxtx.h +@@ -6,7 +6,16 @@ + #define _HNS3_RXTX_H_ + + #include ++ ++#include + #include ++#include ++#include ++#include ++#include ++#include ++ ++#include "hns3_ethdev.h" + + #define HNS3_MIN_RING_DESC 64 + #define HNS3_MAX_RING_DESC 32768 +diff --git a/drivers/net/hns3/hns3_stats.h b/drivers/net/hns3/hns3_stats.h +index 9d84072205..9a360f8870 100644 +--- a/drivers/net/hns3/hns3_stats.h ++++ b/drivers/net/hns3/hns3_stats.h +@@ -5,6 +5,9 @@ + #ifndef _HNS3_STATS_H_ + #define _HNS3_STATS_H_ + ++#include ++#include ++ + /* TQP stats */ + struct hns3_tqp_stats { + uint64_t rcb_tx_ring_pktnum_rcd; /* Total num of transmitted packets */ +@@ -145,6 +148,8 @@ struct hns3_reset_stats; + #define HNS3_IMISSED_STATS_FIELD_OFFSET(f) \ + (offsetof(struct hns3_rx_missed_stats, f)) + ++struct hns3_hw; ++ + int hns3_stats_get(struct rte_eth_dev *eth_dev, + struct rte_eth_stats *rte_stats); + int hns3_dev_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *xstats, +diff --git a/drivers/net/hns3/hns3_tm.h b/drivers/net/hns3/hns3_tm.h +index 83e9cc8ba9..47345eeed1 100644 +--- a/drivers/net/hns3/hns3_tm.h ++++ b/drivers/net/hns3/hns3_tm.h +@@ -105,6 +105,8 @@ hns3_tm_calc_node_tc_no(struct hns3_tm_conf *conf, uint32_t node_id) + return 0; + } + ++struct hns3_hw; ++ + void hns3_tm_conf_init(struct rte_eth_dev *dev); + void hns3_tm_conf_uninit(struct rte_eth_dev *dev); + int hns3_tm_ops_get(struct rte_eth_dev *dev __rte_unused, void *arg); +-- +2.23.0 + diff --git a/0154-net-hns3-increase-readability-in-logs.patch b/0154-net-hns3-increase-readability-in-logs.patch deleted file mode 100644 index 7a0ec42949397a5322425ec06f3d03c543bcdf27..0000000000000000000000000000000000000000 --- a/0154-net-hns3-increase-readability-in-logs.patch +++ /dev/null @@ -1,131 +0,0 @@ -From c693525d0f4a24e9717d80d13a9690ae1b4dc01d Mon Sep 17 00:00:00 2001 -From: Chengwen Feng -Date: Fri, 30 Apr 2021 17:04:04 +0800 -Subject: [PATCH 154/189] net/hns3: increase readability in logs - -Some logs format u64 variables, mostly using hexadecimal which was not -readable. -This patch formats most u64 variables in decimal, and add '0x' prefix -to the ones that are not adjusted. - -Fixes: c37ca66f2b27 ("net/hns3: support RSS") -Fixes: 2790c6464725 ("net/hns3: support device reset") -Fixes: 8839c5e202f3 ("net/hns3: support device stats") -Cc: stable@dpdk.org - -Signed-off-by: Chengwen Feng -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_flow.c | 2 +- - drivers/net/hns3/hns3_intr.c | 20 ++++++++++---------- - drivers/net/hns3/hns3_stats.c | 8 ++++---- - 3 files changed, 15 insertions(+), 15 deletions(-) - -diff --git a/drivers/net/hns3/hns3_flow.c b/drivers/net/hns3/hns3_flow.c -index 1513992..15ecaf4 100644 ---- a/drivers/net/hns3/hns3_flow.c -+++ b/drivers/net/hns3/hns3_flow.c -@@ -1556,7 +1556,7 @@ hns3_config_rss_filter(struct rte_eth_dev *dev, - hw->rss_info.conf.types; - if (flow_types != rss_flow_conf.types) - hns3_warn(hw, "modified RSS types based on hardware support, " -- "requested:%" PRIx64 " configured:%" PRIx64, -+ "requested:0x%" PRIx64 " configured:0x%" PRIx64, - rss_flow_conf.types, flow_types); - /* Update the useful flow types */ - rss_flow_conf.types = flow_types; -diff --git a/drivers/net/hns3/hns3_intr.c b/drivers/net/hns3/hns3_intr.c -index 87afce2..0140260 100644 ---- a/drivers/net/hns3/hns3_intr.c -+++ b/drivers/net/hns3/hns3_intr.c -@@ -2570,7 +2570,7 @@ hns3_clear_reset_level(struct hns3_hw *hw, uint64_t *levels) - if (merge_cnt != hw->reset.stats.merge_cnt) - hns3_warn(hw, - "No need to do low-level reset after %s reset. " -- "merge cnt: %" PRIx64 " total merge cnt: %" PRIx64, -+ "merge cnt: %" PRIu64 " total merge cnt: %" PRIu64, - reset_string[hw->reset.level], - hw->reset.stats.merge_cnt - merge_cnt, - hw->reset.stats.merge_cnt); -@@ -2590,7 +2590,7 @@ hns3_reset_err_handle(struct hns3_adapter *hns) - hw->reset.attempts = 0; - hw->reset.stats.fail_cnt++; - hns3_warn(hw, "%s reset fail because new Reset is pending " -- "attempts:%" PRIx64, -+ "attempts:%" PRIu64, - reset_string[hw->reset.level], - hw->reset.stats.fail_cnt); - hw->reset.level = HNS3_NONE_RESET; -@@ -2617,10 +2617,10 @@ hns3_reset_err_handle(struct hns3_adapter *hns) - reset_fail: - hw->reset.attempts = 0; - hw->reset.stats.fail_cnt++; -- hns3_warn(hw, "%s reset fail fail_cnt:%" PRIx64 " success_cnt:%" PRIx64 -- " global_cnt:%" PRIx64 " imp_cnt:%" PRIx64 -- " request_cnt:%" PRIx64 " exec_cnt:%" PRIx64 -- " merge_cnt:%" PRIx64 "adapter_state:%d", -+ hns3_warn(hw, "%s reset fail fail_cnt:%" PRIu64 " success_cnt:%" PRIu64 -+ " global_cnt:%" PRIu64 " imp_cnt:%" PRIu64 -+ " request_cnt:%" PRIu64 " exec_cnt:%" PRIu64 -+ " merge_cnt:%" PRIu64 "adapter_state:%d", - reset_string[hw->reset.level], hw->reset.stats.fail_cnt, - hw->reset.stats.success_cnt, hw->reset.stats.global_cnt, - hw->reset.stats.imp_cnt, hw->reset.stats.request_cnt, -@@ -2736,10 +2736,10 @@ hns3_reset_post(struct hns3_adapter *hns) - rte_spinlock_unlock(&hw->lock); - hns3_clock_gettime(&tv); - timersub(&tv, &hw->reset.start_time, &tv_delta); -- hns3_warn(hw, "%s reset done fail_cnt:%" PRIx64 -- " success_cnt:%" PRIx64 " global_cnt:%" PRIx64 -- " imp_cnt:%" PRIx64 " request_cnt:%" PRIx64 -- " exec_cnt:%" PRIx64 " merge_cnt:%" PRIx64, -+ hns3_warn(hw, "%s reset done fail_cnt:%" PRIu64 -+ " success_cnt:%" PRIu64 " global_cnt:%" PRIu64 -+ " imp_cnt:%" PRIu64 " request_cnt:%" PRIu64 -+ " exec_cnt:%" PRIu64 " merge_cnt:%" PRIu64, - reset_string[hw->reset.level], - hw->reset.stats.fail_cnt, hw->reset.stats.success_cnt, - hw->reset.stats.global_cnt, hw->reset.stats.imp_cnt, -diff --git a/drivers/net/hns3/hns3_stats.c b/drivers/net/hns3/hns3_stats.c -index 1af689f..464a33d 100644 ---- a/drivers/net/hns3/hns3_stats.c -+++ b/drivers/net/hns3/hns3_stats.c -@@ -1325,7 +1325,7 @@ hns3_dev_xstats_get_by_id(struct rte_eth_dev *dev, const uint64_t *ids, - len = cnt_stats * sizeof(struct rte_eth_xstat); - values_copy = rte_zmalloc("hns3_xstats_values", len, 0); - if (values_copy == NULL) { -- hns3_err(hw, "Failed to allocate %" PRIx64 " bytes needed " -+ hns3_err(hw, "Failed to allocate 0x%" PRIx64 " bytes needed " - "to store statistics values", len); - return -ENOMEM; - } -@@ -1347,7 +1347,7 @@ hns3_dev_xstats_get_by_id(struct rte_eth_dev *dev, const uint64_t *ids, - - for (i = 0; i < size; i++) { - if (ids[i] >= cnt_stats) { -- hns3_err(hw, "ids[%u] (%" PRIx64 ") is invalid, " -+ hns3_err(hw, "ids[%u] (%" PRIu64 ") is invalid, " - "should < %u", i, ids[i], cnt_stats); - rte_free(values_copy); - return -EINVAL; -@@ -1406,7 +1406,7 @@ hns3_dev_xstats_get_names_by_id(struct rte_eth_dev *dev, - len = cnt_stats * sizeof(struct rte_eth_xstat_name); - names_copy = rte_zmalloc("hns3_xstats_names", len, 0); - if (names_copy == NULL) { -- hns3_err(hw, "Failed to allocate %" PRIx64 " bytes needed " -+ hns3_err(hw, "Failed to allocate 0x%" PRIx64 " bytes needed " - "to store statistics names", len); - return -ENOMEM; - } -@@ -1415,7 +1415,7 @@ hns3_dev_xstats_get_names_by_id(struct rte_eth_dev *dev, - - for (i = 0; i < size; i++) { - if (ids[i] >= cnt_stats) { -- hns3_err(hw, "ids[%u] (%" PRIx64 ") is invalid, " -+ hns3_err(hw, "ids[%u] (%" PRIu64 ") is invalid, " - "should < %u", i, ids[i], cnt_stats); - rte_free(names_copy); - return -EINVAL; --- -2.7.4 - diff --git a/0155-net-hns3-fix-debug-build.patch b/0155-net-hns3-fix-debug-build.patch deleted file mode 100644 index 858297d2e9ef0a8c95d667b66f61adcef9ae0e65..0000000000000000000000000000000000000000 --- a/0155-net-hns3-fix-debug-build.patch +++ /dev/null @@ -1,37 +0,0 @@ -From 9b2deee4ca9c9e1e8b2249bf2c8d4d606aff3669 Mon Sep 17 00:00:00 2001 -From: Thomas Monjalon -Date: Fri, 7 May 2021 14:14:13 +0200 -Subject: [PATCH 155/189] net/hns3: fix debug build -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -The variable "dev" is not used in hns3_get_tx_prep_needed() -in the case of RTE_LIBRTE_ETHDEV_DEBUG: -drivers/net/hns3/hns3_rxtx.c:4213:45: error: unused parameter ‘dev’ - -Fixes: d7ec2c076579 ("net/hns3: select Tx prepare based on Tx offload") -Cc: stable@dpdk.org - -Reported-by: David Marchand -Signed-off-by: Thomas Monjalon -Acked-by: David Marchand ---- - drivers/net/hns3/hns3_rxtx.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c -index bc4a9a5..6aa2887 100644 ---- a/drivers/net/hns3/hns3_rxtx.c -+++ b/drivers/net/hns3/hns3_rxtx.c -@@ -4213,6 +4213,7 @@ static bool - hns3_get_tx_prep_needed(struct rte_eth_dev *dev) - { - #ifdef RTE_LIBRTE_ETHDEV_DEBUG -+ RTE_SET_USED(dev); - /* always perform tx_prepare when debug */ - return true; - #else --- -2.7.4 - diff --git a/0155-net-hns3-remove-unused-structures.patch b/0155-net-hns3-remove-unused-structures.patch new file mode 100644 index 0000000000000000000000000000000000000000..17a164643466969fe8ac2f69749595d51dae9b9e --- /dev/null +++ b/0155-net-hns3-remove-unused-structures.patch @@ -0,0 +1,67 @@ +From b099debb4a0b3d33ef2c8f5defbaba29c775657b Mon Sep 17 00:00:00 2001 +From: Chengwen Feng +Date: Fri, 21 Oct 2022 15:36:31 +0800 +Subject: [PATCH 155/189] net/hns3: remove unused structures + +Signed-off-by: Chengwen Feng +Signed-off-by: Dongdong Liu +--- + drivers/net/hns3/hns3_cmd.h | 19 ------------------- + drivers/net/hns3/hns3_rss.h | 4 ---- + 2 files changed, 23 deletions(-) + +diff --git a/drivers/net/hns3/hns3_cmd.h b/drivers/net/hns3/hns3_cmd.h +index bee96c1e46..902638ba99 100644 +--- a/drivers/net/hns3/hns3_cmd.h ++++ b/drivers/net/hns3/hns3_cmd.h +@@ -59,11 +59,6 @@ enum hns3_cmd_return_status { + HNS3_CMD_ROH_CHECK_FAIL = 12 + }; + +-struct hns3_misc_vector { +- uint8_t *addr; +- int vector_irq; +-}; +- + struct hns3_cmq { + struct hns3_cmq_ring csq; + struct hns3_cmq_ring crq; +@@ -397,20 +392,6 @@ struct hns3_pkt_buf_alloc { + struct hns3_shared_buf s_buf; + }; + +-#define HNS3_RX_COM_WL_EN_B 15 +-struct hns3_rx_com_wl_buf_cmd { +- uint16_t high_wl; +- uint16_t low_wl; +- uint8_t rsv[20]; +-}; +- +-#define HNS3_RX_PKT_EN_B 15 +-struct hns3_rx_pkt_buf_cmd { +- uint16_t high_pkt; +- uint16_t low_pkt; +- uint8_t rsv[20]; +-}; +- + #define HNS3_PF_STATE_DONE_B 0 + #define HNS3_PF_STATE_MAIN_B 1 + #define HNS3_PF_STATE_BOND_B 2 +diff --git a/drivers/net/hns3/hns3_rss.h b/drivers/net/hns3/hns3_rss.h +index ebb51b4c66..0d24436cbe 100644 +--- a/drivers/net/hns3/hns3_rss.h ++++ b/drivers/net/hns3/hns3_rss.h +@@ -34,10 +34,6 @@ + #define HNS3_RSS_HASH_ALGO_SYMMETRIC_TOEP 2 + #define HNS3_RSS_HASH_ALGO_MASK 0xf + +-struct hns3_rss_tuple_cfg { +- uint64_t rss_tuple_fields; +-}; +- + #define HNS3_RSS_QUEUES_BUFFER_NUM 64 /* Same as the Max rx/tx queue num */ + struct hns3_rss_conf { + /* RSS parameters :algorithm, flow_types, key, queue */ +-- +2.23.0 + diff --git a/0156-net-hns3-rename-header-guards.patch b/0156-net-hns3-rename-header-guards.patch new file mode 100644 index 0000000000000000000000000000000000000000..28e0a6cb7ba55583ddd5e3aae8db5c1bcf31c536 --- /dev/null +++ b/0156-net-hns3-rename-header-guards.patch @@ -0,0 +1,410 @@ +From 73da6c3b6da30cc03c4a36f0d71d4ffd220f4026 Mon Sep 17 00:00:00 2001 +From: Chengwen Feng +Date: Fri, 21 Oct 2022 15:36:32 +0800 +Subject: [PATCH 156/189] net/hns3: rename header guards + +Currently, the hns3 driver uses _HNS3_XXX conditional compilation +macros to prevent duplicate header files. But in the C11 standard, all +identifiers starting with an underscore plus an uppercase letter are +always reserved. So this patch fixes it. + +Signed-off-by: Chengwen Feng +Signed-off-by: Dongdong Liu +--- + drivers/net/hns3/hns3_cmd.h | 6 +++--- + drivers/net/hns3/hns3_common.h | 6 +++--- + drivers/net/hns3/hns3_dcb.h | 6 +++--- + drivers/net/hns3/hns3_dump.h | 6 +++--- + drivers/net/hns3/hns3_ethdev.h | 6 +++--- + drivers/net/hns3/hns3_fdir.h | 6 +++--- + drivers/net/hns3/hns3_flow.h | 6 +++--- + drivers/net/hns3/hns3_intr.h | 6 +++--- + drivers/net/hns3/hns3_logs.h | 6 +++--- + drivers/net/hns3/hns3_mbx.h | 6 +++--- + drivers/net/hns3/hns3_mp.h | 6 +++--- + drivers/net/hns3/hns3_regs.h | 6 +++--- + drivers/net/hns3/hns3_rss.h | 6 +++--- + drivers/net/hns3/hns3_rxtx.h | 6 +++--- + drivers/net/hns3/hns3_rxtx_vec.h | 6 +++--- + drivers/net/hns3/hns3_rxtx_vec_neon.h | 6 +++--- + drivers/net/hns3/hns3_stats.h | 6 +++--- + drivers/net/hns3/hns3_tm.h | 6 +++--- + 18 files changed, 54 insertions(+), 54 deletions(-) + +diff --git a/drivers/net/hns3/hns3_cmd.h b/drivers/net/hns3/hns3_cmd.h +index 902638ba99..8ac8b45819 100644 +--- a/drivers/net/hns3/hns3_cmd.h ++++ b/drivers/net/hns3/hns3_cmd.h +@@ -2,8 +2,8 @@ + * Copyright(c) 2018-2021 HiSilicon Limited. + */ + +-#ifndef _HNS3_CMD_H_ +-#define _HNS3_CMD_H_ ++#ifndef HNS3_CMD_H ++#define HNS3_CMD_H + + #include + +@@ -1038,4 +1038,4 @@ int hns3_cmd_init(struct hns3_hw *hw); + void hns3_cmd_destroy_queue(struct hns3_hw *hw); + void hns3_cmd_uninit(struct hns3_hw *hw); + +-#endif /* _HNS3_CMD_H_ */ ++#endif /* HNS3_CMD_H */ +diff --git a/drivers/net/hns3/hns3_common.h b/drivers/net/hns3/hns3_common.h +index 2994e4a269..5aa001f0cc 100644 +--- a/drivers/net/hns3/hns3_common.h ++++ b/drivers/net/hns3/hns3_common.h +@@ -2,8 +2,8 @@ + * Copyright(C) 2021 HiSilicon Limited + */ + +-#ifndef _HNS3_COMMON_H_ +-#define _HNS3_COMMON_H_ ++#ifndef HNS3_COMMON_H ++#define HNS3_COMMON_H + + #include + +@@ -61,4 +61,4 @@ int hns3_restore_rx_interrupt(struct hns3_hw *hw); + + int hns3_get_pci_revision_id(struct hns3_hw *hw, uint8_t *revision_id); + +-#endif /* _HNS3_COMMON_H_ */ ++#endif /* HNS3_COMMON_H */ +diff --git a/drivers/net/hns3/hns3_dcb.h b/drivers/net/hns3/hns3_dcb.h +index 9d9e7684c1..d5bb5edf4d 100644 +--- a/drivers/net/hns3/hns3_dcb.h ++++ b/drivers/net/hns3/hns3_dcb.h +@@ -2,8 +2,8 @@ + * Copyright(c) 2018-2021 HiSilicon Limited. + */ + +-#ifndef _HNS3_DCB_H_ +-#define _HNS3_DCB_H_ ++#ifndef HNS3_DCB_H ++#define HNS3_DCB_H + + #include + +@@ -215,4 +215,4 @@ int hns3_update_queue_map_configure(struct hns3_adapter *hns); + int hns3_port_shaper_update(struct hns3_hw *hw, uint32_t speed); + uint8_t hns3_txq_mapped_tc_get(struct hns3_hw *hw, uint16_t txq_no); + +-#endif /* _HNS3_DCB_H_ */ ++#endif /* HNS3_DCB_H */ +diff --git a/drivers/net/hns3/hns3_dump.h b/drivers/net/hns3/hns3_dump.h +index 8ba7ee866a..616cb70d6e 100644 +--- a/drivers/net/hns3/hns3_dump.h ++++ b/drivers/net/hns3/hns3_dump.h +@@ -2,9 +2,9 @@ + * Copyright(C) 2022 HiSilicon Limited + */ + +-#ifndef _HNS3_DUMP_H_ +-#define _HNS3_DUMP_H_ ++#ifndef HNS3_DUMP_H ++#define HNS3_DUMP_H + + int hns3_eth_dev_priv_dump(struct rte_eth_dev *dev, FILE *file); + +-#endif /* _HNS3_DUMP_H_ */ ++#endif /* HNS3_DUMP_H */ +diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h +index aad779e949..40476bf882 100644 +--- a/drivers/net/hns3/hns3_ethdev.h ++++ b/drivers/net/hns3/hns3_ethdev.h +@@ -2,8 +2,8 @@ + * Copyright(c) 2018-2021 HiSilicon Limited. + */ + +-#ifndef _HNS3_ETHDEV_H_ +-#define _HNS3_ETHDEV_H_ ++#ifndef HNS3_ETHDEV_H ++#define HNS3_ETHDEV_H + + #include + #include +@@ -1074,4 +1074,4 @@ is_reset_pending(struct hns3_adapter *hns) + return ret; + } + +-#endif /* _HNS3_ETHDEV_H_ */ ++#endif /* HNS3_ETHDEV_H */ +diff --git a/drivers/net/hns3/hns3_fdir.h b/drivers/net/hns3/hns3_fdir.h +index 7be1c0a248..de2422e12f 100644 +--- a/drivers/net/hns3/hns3_fdir.h ++++ b/drivers/net/hns3/hns3_fdir.h +@@ -2,8 +2,8 @@ + * Copyright(c) 2018-2021 HiSilicon Limited. + */ + +-#ifndef _HNS3_FDIR_H_ +-#define _HNS3_FDIR_H_ ++#ifndef HNS3_FDIR_H ++#define HNS3_FDIR_H + + #include + +@@ -192,4 +192,4 @@ int hns3_clear_all_fdir_filter(struct hns3_adapter *hns); + int hns3_fd_get_count(struct hns3_hw *hw, uint32_t id, uint64_t *value); + int hns3_restore_all_fdir_filter(struct hns3_adapter *hns); + +-#endif /* _HNS3_FDIR_H_ */ ++#endif /* HNS3_FDIR_H */ +diff --git a/drivers/net/hns3/hns3_flow.h b/drivers/net/hns3/hns3_flow.h +index ec94510152..e4b2fdf2e6 100644 +--- a/drivers/net/hns3/hns3_flow.h ++++ b/drivers/net/hns3/hns3_flow.h +@@ -2,8 +2,8 @@ + * Copyright(C) 2021 HiSilicon Limited + */ + +-#ifndef _HNS3_FLOW_H_ +-#define _HNS3_FLOW_H_ ++#ifndef HNS3_FLOW_H ++#define HNS3_FLOW_H + + #include + #include +@@ -54,4 +54,4 @@ void hns3_flow_init(struct rte_eth_dev *dev); + void hns3_flow_uninit(struct rte_eth_dev *dev); + int hns3_restore_filter(struct hns3_adapter *hns); + +-#endif /* _HNS3_FLOW_H_ */ ++#endif /* HNS3_FLOW_H */ +diff --git a/drivers/net/hns3/hns3_intr.h b/drivers/net/hns3/hns3_intr.h +index 1490a5e387..aca1c0722c 100644 +--- a/drivers/net/hns3/hns3_intr.h ++++ b/drivers/net/hns3/hns3_intr.h +@@ -2,8 +2,8 @@ + * Copyright(c) 2018-2021 HiSilicon Limited. + */ + +-#ifndef _HNS3_INTR_H_ +-#define _HNS3_INTR_H_ ++#ifndef HNS3_INTR_H ++#define HNS3_INTR_H + + #include + +@@ -190,4 +190,4 @@ void hns3_reset_abort(struct hns3_adapter *hns); + void hns3_start_report_lse(struct rte_eth_dev *dev); + void hns3_stop_report_lse(struct rte_eth_dev *dev); + +-#endif /* _HNS3_INTR_H_ */ ++#endif /* HNS3_INTR_H */ +diff --git a/drivers/net/hns3/hns3_logs.h b/drivers/net/hns3/hns3_logs.h +index 072a53bd69..c880f752ab 100644 +--- a/drivers/net/hns3/hns3_logs.h ++++ b/drivers/net/hns3/hns3_logs.h +@@ -2,8 +2,8 @@ + * Copyright(c) 2018-2021 HiSilicon Limited. + */ + +-#ifndef _HNS3_LOGS_H_ +-#define _HNS3_LOGS_H_ ++#ifndef HNS3_LOGS_H ++#define HNS3_LOGS_H + + extern int hns3_logtype_init; + #define PMD_INIT_LOG(level, fmt, args...) \ +@@ -31,4 +31,4 @@ extern int hns3_logtype_driver; + #define hns3_dbg(hw, fmt, args...) \ + PMD_DRV_LOG_RAW(hw, RTE_LOG_DEBUG, fmt "\n", ## args) + +-#endif /* _HNS3_LOGS_H_ */ ++#endif /* HNS3_LOGS_H */ +diff --git a/drivers/net/hns3/hns3_mbx.h b/drivers/net/hns3/hns3_mbx.h +index b6ccd9ff8c..c71f43238c 100644 +--- a/drivers/net/hns3/hns3_mbx.h ++++ b/drivers/net/hns3/hns3_mbx.h +@@ -2,8 +2,8 @@ + * Copyright(c) 2018-2021 HiSilicon Limited. + */ + +-#ifndef _HNS3_MBX_H_ +-#define _HNS3_MBX_H_ ++#ifndef HNS3_MBX_H ++#define HNS3_MBX_H + + #include + +@@ -172,4 +172,4 @@ void hns3_dev_handle_mbx_msg(struct hns3_hw *hw); + int hns3_send_mbx_msg(struct hns3_hw *hw, uint16_t code, uint16_t subcode, + const uint8_t *msg_data, uint8_t msg_len, bool need_resp, + uint8_t *resp_data, uint16_t resp_len); +-#endif /* _HNS3_MBX_H_ */ ++#endif /* HNS3_MBX_H */ +diff --git a/drivers/net/hns3/hns3_mp.h b/drivers/net/hns3/hns3_mp.h +index 230230bbfe..5dc32a41d4 100644 +--- a/drivers/net/hns3/hns3_mp.h ++++ b/drivers/net/hns3/hns3_mp.h +@@ -2,8 +2,8 @@ + * Copyright(c) 2018-2021 HiSilicon Limited. + */ + +-#ifndef _HNS3_MP_H_ +-#define _HNS3_MP_H_ ++#ifndef HNS3_MP_H ++#define HNS3_MP_H + + #include + +@@ -21,4 +21,4 @@ void hns3_mp_req_stop_tx(struct rte_eth_dev *dev); + int hns3_mp_init(struct rte_eth_dev *dev); + void hns3_mp_uninit(struct rte_eth_dev *dev); + +-#endif /* _HNS3_MP_H_ */ ++#endif /* HNS3_MP_H */ +diff --git a/drivers/net/hns3/hns3_regs.h b/drivers/net/hns3/hns3_regs.h +index 2636429844..459bbaf773 100644 +--- a/drivers/net/hns3/hns3_regs.h ++++ b/drivers/net/hns3/hns3_regs.h +@@ -2,8 +2,8 @@ + * Copyright(c) 2018-2021 HiSilicon Limited. + */ + +-#ifndef _HNS3_REGS_H_ +-#define _HNS3_REGS_H_ ++#ifndef HNS3_REGS_H ++#define HNS3_REGS_H + + #include + #include +@@ -153,4 +153,4 @@ + #define HNS3_RL_USEC_TO_REG(rl_usec) ((rl_usec) >> 2) + + int hns3_get_regs(struct rte_eth_dev *eth_dev, struct rte_dev_reg_info *regs); +-#endif /* _HNS3_REGS_H_ */ ++#endif /* HNS3_REGS_H */ +diff --git a/drivers/net/hns3/hns3_rss.h b/drivers/net/hns3/hns3_rss.h +index 0d24436cbe..5c288c8bb2 100644 +--- a/drivers/net/hns3/hns3_rss.h ++++ b/drivers/net/hns3/hns3_rss.h +@@ -2,8 +2,8 @@ + * Copyright(c) 2018-2021 HiSilicon Limited. + */ + +-#ifndef _HNS3_RSS_H_ +-#define _HNS3_RSS_H_ ++#ifndef HNS3_RSS_H ++#define HNS3_RSS_H + + #include + #include +@@ -109,4 +109,4 @@ void hns3_rss_uninit(struct hns3_adapter *hns); + int hns3_set_rss_tuple_by_rss_hf(struct hns3_hw *hw, uint64_t rss_hf); + int hns3_rss_set_algo_key(struct hns3_hw *hw, const uint8_t *key); + +-#endif /* _HNS3_RSS_H_ */ ++#endif /* HNS3_RSS_H */ +diff --git a/drivers/net/hns3/hns3_rxtx.h b/drivers/net/hns3/hns3_rxtx.h +index f619d6d466..ed40621b3a 100644 +--- a/drivers/net/hns3/hns3_rxtx.h ++++ b/drivers/net/hns3/hns3_rxtx.h +@@ -2,8 +2,8 @@ + * Copyright(c) 2018-2021 HiSilicon Limited. + */ + +-#ifndef _HNS3_RXTX_H_ +-#define _HNS3_RXTX_H_ ++#ifndef HNS3_RXTX_H ++#define HNS3_RXTX_H + + #include + +@@ -780,4 +780,4 @@ void hns3_tx_push_init(struct rte_eth_dev *dev); + void hns3_stop_tx_datapath(struct rte_eth_dev *dev); + void hns3_start_tx_datapath(struct rte_eth_dev *dev); + +-#endif /* _HNS3_RXTX_H_ */ ++#endif /* HNS3_RXTX_H */ +diff --git a/drivers/net/hns3/hns3_rxtx_vec.h b/drivers/net/hns3/hns3_rxtx_vec.h +index d13f18627d..2c8a91921e 100644 +--- a/drivers/net/hns3/hns3_rxtx_vec.h ++++ b/drivers/net/hns3/hns3_rxtx_vec.h +@@ -2,8 +2,8 @@ + * Copyright(c) 2020-2021 HiSilicon Limited. + */ + +-#ifndef _HNS3_RXTX_VEC_H_ +-#define _HNS3_RXTX_VEC_H_ ++#ifndef HNS3_RXTX_VEC_H ++#define HNS3_RXTX_VEC_H + + #include "hns3_rxtx.h" + #include "hns3_ethdev.h" +@@ -94,4 +94,4 @@ hns3_rx_reassemble_pkts(struct rte_mbuf **rx_pkts, + + return count; + } +-#endif /* _HNS3_RXTX_VEC_H_ */ ++#endif /* HNS3_RXTX_VEC_H */ +diff --git a/drivers/net/hns3/hns3_rxtx_vec_neon.h b/drivers/net/hns3/hns3_rxtx_vec_neon.h +index 0edd4756f1..55d9bf817d 100644 +--- a/drivers/net/hns3/hns3_rxtx_vec_neon.h ++++ b/drivers/net/hns3/hns3_rxtx_vec_neon.h +@@ -2,8 +2,8 @@ + * Copyright(c) 2020-2021 HiSilicon Limited. + */ + +-#ifndef _HNS3_RXTX_VEC_NEON_H_ +-#define _HNS3_RXTX_VEC_NEON_H_ ++#ifndef HNS3_RXTX_VEC_NEON_H ++#define HNS3_RXTX_VEC_NEON_H + + #include + +@@ -299,4 +299,4 @@ hns3_recv_burst_vec(struct hns3_rx_queue *__restrict rxq, + + return nb_rx; + } +-#endif /* _HNS3_RXTX_VEC_NEON_H_ */ ++#endif /* HNS3_RXTX_VEC_NEON_H */ +diff --git a/drivers/net/hns3/hns3_stats.h b/drivers/net/hns3/hns3_stats.h +index 9a360f8870..74bc4173cc 100644 +--- a/drivers/net/hns3/hns3_stats.h ++++ b/drivers/net/hns3/hns3_stats.h +@@ -2,8 +2,8 @@ + * Copyright(c) 2018-2021 HiSilicon Limited. + */ + +-#ifndef _HNS3_STATS_H_ +-#define _HNS3_STATS_H_ ++#ifndef HNS3_STATS_H ++#define HNS3_STATS_H + + #include + #include +@@ -172,4 +172,4 @@ void hns3_stats_uninit(struct hns3_hw *hw); + int hns3_query_mac_stats_reg_num(struct hns3_hw *hw); + void hns3_update_hw_stats(struct hns3_hw *hw); + +-#endif /* _HNS3_STATS_H_ */ ++#endif /* HNS3_STATS_H */ +diff --git a/drivers/net/hns3/hns3_tm.h b/drivers/net/hns3/hns3_tm.h +index 47345eeed1..0cac1a5bb2 100644 +--- a/drivers/net/hns3/hns3_tm.h ++++ b/drivers/net/hns3/hns3_tm.h +@@ -2,8 +2,8 @@ + * Copyright(c) 2020-2021 HiSilicon Limited. + */ + +-#ifndef _HNS3_TM_H_ +-#define _HNS3_TM_H_ ++#ifndef HNS3_TM_H ++#define HNS3_TM_H + + #include + #include +@@ -114,4 +114,4 @@ void hns3_tm_dev_start_proc(struct hns3_hw *hw); + void hns3_tm_dev_stop_proc(struct hns3_hw *hw); + int hns3_tm_conf_update(struct hns3_hw *hw); + +-#endif /* _HNS3_TM_H */ ++#endif /* HNS3_TM_H */ +-- +2.23.0 + diff --git a/0156-net-hns3-return-error-on-PCI-config-write-failure.patch b/0156-net-hns3-return-error-on-PCI-config-write-failure.patch deleted file mode 100644 index 6deb162119c38933d3f8e209005c7afa469699d3..0000000000000000000000000000000000000000 --- a/0156-net-hns3-return-error-on-PCI-config-write-failure.patch +++ /dev/null @@ -1,36 +0,0 @@ -From e04c10fe75d5a5015fdb84387eb952fc1c05301f Mon Sep 17 00:00:00 2001 -From: Chengwen Feng -Date: Fri, 7 May 2021 17:08:14 +0800 -Subject: [PATCH 156/189] net/hns3: return error on PCI config write failure - -This patch returns error code when calling rte_pci_write_config() API. - -Fixes: 6dd32ded17d8 ("net/hns3: check PCI config space write") -Cc: stable@dpdk.org - -Signed-off-by: Chengwen Feng -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_ethdev_vf.c | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c -index c4419fb..182e83b 100644 ---- a/drivers/net/hns3/hns3_ethdev_vf.c -+++ b/drivers/net/hns3/hns3_ethdev_vf.c -@@ -156,9 +156,12 @@ hns3vf_enable_msix(const struct rte_pci_device *device, bool op) - if (ret < 0) { - PMD_INIT_LOG(ERR, "failed to write PCI offset 0x%x", - (pos + PCI_MSIX_FLAGS)); -+ return -ENXIO; - } -+ - return 0; - } -+ - return -ENXIO; - } - --- -2.7.4 - diff --git a/0157-net-hns3-fix-IPv4-and-IPv6-RSS.patch b/0157-net-hns3-fix-IPv4-and-IPv6-RSS.patch new file mode 100644 index 0000000000000000000000000000000000000000..ed89f2553362e74315947852076db77f311c39ec --- /dev/null +++ b/0157-net-hns3-fix-IPv4-and-IPv6-RSS.patch @@ -0,0 +1,87 @@ +From e11bff8abbbe9cacc59fa64d3d2046b150c45a6d Mon Sep 17 00:00:00 2001 +From: Huisong Li +Date: Fri, 21 Oct 2022 15:36:33 +0800 +Subject: [PATCH 157/189] net/hns3: fix IPv4 and IPv6 RSS + +Currently, hns3 driver use 'ipv4-other' and 'ipv6-other' as the flag +of IP packets to judge if enable RSS tuple field. But user may use +'RTE_ETH_RSS_IPV4' or 'RTE_ETH_RSS_IPV6' as the flag. So this patch +adds the processing of these macros. + +Fixes: 806f1d5ab0e3 ("net/hns3: set RSS hash type input configuration") +Cc: stable@dpdk.org + +Signed-off-by: Huisong Li +Signed-off-by: Dongdong Liu +--- + drivers/net/hns3/hns3_rss.c | 14 ++++++++++++++ + drivers/net/hns3/hns3_rss.h | 2 ++ + 2 files changed, 16 insertions(+) + +diff --git a/drivers/net/hns3/hns3_rss.c b/drivers/net/hns3/hns3_rss.c +index fc912ed2e8..e7e114727f 100644 +--- a/drivers/net/hns3/hns3_rss.c ++++ b/drivers/net/hns3/hns3_rss.c +@@ -102,6 +102,10 @@ static const struct { + BIT_ULL(HNS3_RSS_FIELD_IPV4_SCTP_EN_SCTP_S) }, + { RTE_ETH_RSS_NONFRAG_IPV4_SCTP | RTE_ETH_RSS_L4_DST_ONLY, + BIT_ULL(HNS3_RSS_FIELD_IPV4_SCTP_EN_SCTP_D) }, ++ { RTE_ETH_RSS_IPV4 | RTE_ETH_RSS_L3_SRC_ONLY, ++ BIT_ULL(HNS3_RSS_FIELD_IPV4_EN_NONFRAG_IP_S) }, ++ { RTE_ETH_RSS_IPV4 | RTE_ETH_RSS_L3_DST_ONLY, ++ BIT_ULL(HNS3_RSS_FIELD_IPV4_EN_NONFRAG_IP_D) }, + { RTE_ETH_RSS_NONFRAG_IPV4_OTHER | RTE_ETH_RSS_L3_SRC_ONLY, + BIT_ULL(HNS3_RSS_FIELD_IPV4_EN_NONFRAG_IP_S) }, + { RTE_ETH_RSS_NONFRAG_IPV4_OTHER | RTE_ETH_RSS_L3_DST_ONLY, +@@ -134,6 +138,10 @@ static const struct { + BIT_ULL(HNS3_RSS_FILED_IPV6_SCTP_EN_SCTP_S) }, + { RTE_ETH_RSS_NONFRAG_IPV6_SCTP | RTE_ETH_RSS_L4_DST_ONLY, + BIT_ULL(HNS3_RSS_FILED_IPV6_SCTP_EN_SCTP_D) }, ++ { RTE_ETH_RSS_IPV6 | RTE_ETH_RSS_L3_SRC_ONLY, ++ BIT_ULL(HNS3_RSS_FIELD_IPV6_NONFRAG_IP_S) }, ++ { RTE_ETH_RSS_IPV6 | RTE_ETH_RSS_L3_DST_ONLY, ++ BIT_ULL(HNS3_RSS_FIELD_IPV6_NONFRAG_IP_D) }, + { RTE_ETH_RSS_NONFRAG_IPV6_OTHER | RTE_ETH_RSS_L3_SRC_ONLY, + BIT_ULL(HNS3_RSS_FIELD_IPV6_NONFRAG_IP_S) }, + { RTE_ETH_RSS_NONFRAG_IPV6_OTHER | RTE_ETH_RSS_L3_DST_ONLY, +@@ -159,6 +167,9 @@ static const struct { + BIT_ULL(HNS3_RSS_FIELD_IPV4_SCTP_EN_SCTP_S) | + BIT_ULL(HNS3_RSS_FIELD_IPV4_SCTP_EN_SCTP_D) | + BIT_ULL(HNS3_RSS_FIELD_IPV4_SCTP_EN_SCTP_VER) }, ++ { RTE_ETH_RSS_IPV4, ++ BIT_ULL(HNS3_RSS_FIELD_IPV4_EN_NONFRAG_IP_S) | ++ BIT_ULL(HNS3_RSS_FIELD_IPV4_EN_NONFRAG_IP_D) }, + { RTE_ETH_RSS_NONFRAG_IPV4_OTHER, + BIT_ULL(HNS3_RSS_FIELD_IPV4_EN_NONFRAG_IP_S) | + BIT_ULL(HNS3_RSS_FIELD_IPV4_EN_NONFRAG_IP_D) }, +@@ -177,6 +188,9 @@ static const struct { + BIT_ULL(HNS3_RSS_FILED_IPV6_SCTP_EN_SCTP_D) | + BIT_ULL(HNS3_RSS_FILED_IPV6_SCTP_EN_SCTP_S) | + BIT_ULL(HNS3_RSS_FIELD_IPV6_SCTP_EN_SCTP_VER) }, ++ { RTE_ETH_RSS_IPV6, ++ BIT_ULL(HNS3_RSS_FIELD_IPV6_NONFRAG_IP_S) | ++ BIT_ULL(HNS3_RSS_FIELD_IPV6_NONFRAG_IP_D) }, + { RTE_ETH_RSS_NONFRAG_IPV6_OTHER, + BIT_ULL(HNS3_RSS_FIELD_IPV6_NONFRAG_IP_S) | + BIT_ULL(HNS3_RSS_FIELD_IPV6_NONFRAG_IP_D) } +diff --git a/drivers/net/hns3/hns3_rss.h b/drivers/net/hns3/hns3_rss.h +index 5c288c8bb2..9471e7039d 100644 +--- a/drivers/net/hns3/hns3_rss.h ++++ b/drivers/net/hns3/hns3_rss.h +@@ -9,11 +9,13 @@ + #include + + #define HNS3_ETH_RSS_SUPPORT ( \ ++ RTE_ETH_RSS_IPV4 | \ + RTE_ETH_RSS_FRAG_IPV4 | \ + RTE_ETH_RSS_NONFRAG_IPV4_TCP | \ + RTE_ETH_RSS_NONFRAG_IPV4_UDP | \ + RTE_ETH_RSS_NONFRAG_IPV4_SCTP | \ + RTE_ETH_RSS_NONFRAG_IPV4_OTHER | \ ++ RTE_ETH_RSS_IPV6 | \ + RTE_ETH_RSS_FRAG_IPV6 | \ + RTE_ETH_RSS_NONFRAG_IPV6_TCP | \ + RTE_ETH_RSS_NONFRAG_IPV6_UDP | \ +-- +2.23.0 + diff --git a/0157-net-hns3-fix-log-on-flow-director-clear.patch b/0157-net-hns3-fix-log-on-flow-director-clear.patch deleted file mode 100644 index 000c16214c9e3e5e3887c2b9ad6a786325e65de0..0000000000000000000000000000000000000000 --- a/0157-net-hns3-fix-log-on-flow-director-clear.patch +++ /dev/null @@ -1,65 +0,0 @@ -From f3a62e370e72558eb1fe41b540b9aad7036b9679 Mon Sep 17 00:00:00 2001 -From: Chengwen Feng -Date: Fri, 7 May 2021 17:08:15 +0800 -Subject: [PATCH 157/189] net/hns3: fix log on flow director clear - -If clear FDIR rules fail, the error code was logged, but the error code -was useless because it was the sum of all fail code. - -This patch fixes it by log the success cnt and fail cnt. - -Fixes: fcba820d9b9e ("net/hns3: support flow director") -Fixes: 8eed8acc812e ("net/hns3: add error code to some logs") -Cc: stable@dpdk.org - -Signed-off-by: Chengwen Feng -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_fdir.c | 18 +++++++++++++----- - 1 file changed, 13 insertions(+), 5 deletions(-) - -diff --git a/drivers/net/hns3/hns3_fdir.c b/drivers/net/hns3/hns3_fdir.c -index 06dd51b..e87e064 100644 ---- a/drivers/net/hns3/hns3_fdir.c -+++ b/drivers/net/hns3/hns3_fdir.c -@@ -1026,6 +1026,8 @@ int hns3_clear_all_fdir_filter(struct hns3_adapter *hns) - struct hns3_fdir_info *fdir_info = &pf->fdir; - struct hns3_fdir_rule_ele *fdir_filter; - struct hns3_hw *hw = &hns->hw; -+ int succ_cnt = 0; -+ int fail_cnt = 0; - int ret = 0; - - /* flush flow director */ -@@ -1034,17 +1036,23 @@ int hns3_clear_all_fdir_filter(struct hns3_adapter *hns) - fdir_filter = TAILQ_FIRST(&fdir_info->fdir_list); - while (fdir_filter) { - TAILQ_REMOVE(&fdir_info->fdir_list, fdir_filter, entries); -- ret += hns3_fd_tcam_config(hw, true, -- fdir_filter->fdir_conf.location, -- NULL, false); -+ ret = hns3_fd_tcam_config(hw, true, -+ fdir_filter->fdir_conf.location, -+ NULL, false); -+ if (ret == 0) -+ succ_cnt++; -+ else -+ fail_cnt++; - rte_free(fdir_filter); - fdir_filter = TAILQ_FIRST(&fdir_info->fdir_list); - } - -- if (ret) { -- hns3_err(hw, "Fail to delete FDIR filter, ret = %d", ret); -+ if (fail_cnt > 0) { -+ hns3_err(hw, "fail to delete all FDIR filter, success num = %d " -+ "fail num = %d", succ_cnt, fail_cnt); - ret = -EIO; - } -+ - return ret; - } - --- -2.7.4 - diff --git a/0158-net-hns3-clear-hash-map-on-flow-director-clear.patch b/0158-net-hns3-clear-hash-map-on-flow-director-clear.patch deleted file mode 100644 index 2d6e78b20e2985b43e0b2d8453a23a04fa53abb7..0000000000000000000000000000000000000000 --- a/0158-net-hns3-clear-hash-map-on-flow-director-clear.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 72f412363f33c14750b3d5250315f67a06259033 Mon Sep 17 00:00:00 2001 -From: Chengwen Feng -Date: Fri, 7 May 2021 17:08:16 +0800 -Subject: [PATCH 158/189] net/hns3: clear hash map on flow director clear - -The fdir hash map hold the pointers of fdir rule elements, it needs to -be set to NULL when clear all fdir rules. - -Fixes: fcba820d9b9e ("net/hns3: support flow director") -Cc: stable@dpdk.org - -Signed-off-by: Chengwen Feng -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_fdir.c | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/drivers/net/hns3/hns3_fdir.c b/drivers/net/hns3/hns3_fdir.c -index e87e064..8ab5fd6 100644 ---- a/drivers/net/hns3/hns3_fdir.c -+++ b/drivers/net/hns3/hns3_fdir.c -@@ -1033,6 +1033,10 @@ int hns3_clear_all_fdir_filter(struct hns3_adapter *hns) - /* flush flow director */ - rte_hash_reset(fdir_info->hash_handle); - -+ memset(fdir_info->hash_map, 0, -+ sizeof(struct hns3_fdir_rule_ele *) * -+ fdir_info->fd_cfg.rule_num[HNS3_FD_STAGE_1]); -+ - fdir_filter = TAILQ_FIRST(&fdir_info->fdir_list); - while (fdir_filter) { - TAILQ_REMOVE(&fdir_info->fdir_list, fdir_filter, entries); --- -2.7.4 - diff --git a/0158-net-hns3-fix-types-in-IPv6-SCTP-fields.patch b/0158-net-hns3-fix-types-in-IPv6-SCTP-fields.patch new file mode 100644 index 0000000000000000000000000000000000000000..7229a334c0e1e695d8145870850082df7278fb2c --- /dev/null +++ b/0158-net-hns3-fix-types-in-IPv6-SCTP-fields.patch @@ -0,0 +1,57 @@ +From 3907f30765bd5ca0d973c0b828de210b3d87713a Mon Sep 17 00:00:00 2001 +From: Huisong Li +Date: Fri, 21 Oct 2022 15:36:34 +0800 +Subject: [PATCH 158/189] net/hns3: fix types in IPv6 SCTP fields + +Fix spelling errors about IPV6-SCTP macro. + +Fixes: 1bc633c34008 ("net/hns3: enable RSS for IPv6-SCTP dst/src port fields") +Cc: stable@dpdk.org + +Signed-off-by: Huisong Li +Signed-off-by: Dongdong Liu +--- + drivers/net/hns3/hns3_rss.c | 12 ++++++------ + 1 file changed, 6 insertions(+), 6 deletions(-) + +diff --git a/drivers/net/hns3/hns3_rss.c b/drivers/net/hns3/hns3_rss.c +index e7e114727f..6d71ee94a9 100644 +--- a/drivers/net/hns3/hns3_rss.c ++++ b/drivers/net/hns3/hns3_rss.c +@@ -57,8 +57,8 @@ enum hns3_tuple_field { + HNS3_RSS_FIELD_IPV6_UDP_EN_IP_S, + + /* IPV6_SCTP ENABLE FIELD */ +- HNS3_RSS_FILED_IPV6_SCTP_EN_SCTP_D = 48, +- HNS3_RSS_FILED_IPV6_SCTP_EN_SCTP_S, ++ HNS3_RSS_FIELD_IPV6_SCTP_EN_SCTP_D = 48, ++ HNS3_RSS_FIELD_IPV6_SCTP_EN_SCTP_S, + HNS3_RSS_FIELD_IPV6_SCTP_EN_IP_D, + HNS3_RSS_FIELD_IPV6_SCTP_EN_IP_S, + HNS3_RSS_FIELD_IPV6_SCTP_EN_SCTP_VER, +@@ -135,9 +135,9 @@ static const struct { + { RTE_ETH_RSS_NONFRAG_IPV6_SCTP | RTE_ETH_RSS_L3_DST_ONLY, + BIT_ULL(HNS3_RSS_FIELD_IPV6_SCTP_EN_IP_D) }, + { RTE_ETH_RSS_NONFRAG_IPV6_SCTP | RTE_ETH_RSS_L4_SRC_ONLY, +- BIT_ULL(HNS3_RSS_FILED_IPV6_SCTP_EN_SCTP_S) }, ++ BIT_ULL(HNS3_RSS_FIELD_IPV6_SCTP_EN_SCTP_S) }, + { RTE_ETH_RSS_NONFRAG_IPV6_SCTP | RTE_ETH_RSS_L4_DST_ONLY, +- BIT_ULL(HNS3_RSS_FILED_IPV6_SCTP_EN_SCTP_D) }, ++ BIT_ULL(HNS3_RSS_FIELD_IPV6_SCTP_EN_SCTP_D) }, + { RTE_ETH_RSS_IPV6 | RTE_ETH_RSS_L3_SRC_ONLY, + BIT_ULL(HNS3_RSS_FIELD_IPV6_NONFRAG_IP_S) }, + { RTE_ETH_RSS_IPV6 | RTE_ETH_RSS_L3_DST_ONLY, +@@ -185,8 +185,8 @@ static const struct { + BIT_ULL(HNS3_RSS_FIELD_IPV6_UDP_EN_UDP_D) }, + { RTE_ETH_RSS_NONFRAG_IPV6_SCTP, BIT_ULL(HNS3_RSS_FIELD_IPV6_SCTP_EN_IP_S) | + BIT_ULL(HNS3_RSS_FIELD_IPV6_SCTP_EN_IP_D) | +- BIT_ULL(HNS3_RSS_FILED_IPV6_SCTP_EN_SCTP_D) | +- BIT_ULL(HNS3_RSS_FILED_IPV6_SCTP_EN_SCTP_S) | ++ BIT_ULL(HNS3_RSS_FIELD_IPV6_SCTP_EN_SCTP_D) | ++ BIT_ULL(HNS3_RSS_FIELD_IPV6_SCTP_EN_SCTP_S) | + BIT_ULL(HNS3_RSS_FIELD_IPV6_SCTP_EN_SCTP_VER) }, + { RTE_ETH_RSS_IPV6, + BIT_ULL(HNS3_RSS_FIELD_IPV6_NONFRAG_IP_S) | +-- +2.23.0 + diff --git a/0159-net-hns3-fix-IPv4-RSS.patch b/0159-net-hns3-fix-IPv4-RSS.patch new file mode 100644 index 0000000000000000000000000000000000000000..4654d2d0e062a5ab10e7271854393172c04de315 --- /dev/null +++ b/0159-net-hns3-fix-IPv4-RSS.patch @@ -0,0 +1,380 @@ +From c300374b7ef19f05acaa6501093610fbe25bc187 Mon Sep 17 00:00:00 2001 +From: Huisong Li +Date: Fri, 21 Oct 2022 15:36:35 +0800 +Subject: [PATCH 159/189] net/hns3: fix IPv4 RSS + +When user only use 'ipv4' to set 'rss_hf', hns3 will enable +all tuple fields for 'ipv4' flow. But if user use 'ipv4-tcp' +, 'ipv4' and 'l4-src-only' to set 'rss_hf', driver does not +enable all tuple fields for 'ipv4' flow. + +Fixes: 806f1d5ab0e3 ("net/hns3: set RSS hash type input configuration") +Cc: stable@dpdk.org + +Signed-off-by: Huisong Li +Signed-off-by: Dongdong Liu +--- + drivers/net/hns3/hns3_rss.c | 266 ++++++++++++++++++++++++------------ + 1 file changed, 176 insertions(+), 90 deletions(-) + +diff --git a/drivers/net/hns3/hns3_rss.c b/drivers/net/hns3/hns3_rss.c +index 6d71ee94a9..ea745c791f 100644 +--- a/drivers/net/hns3/hns3_rss.c ++++ b/drivers/net/hns3/hns3_rss.c +@@ -70,130 +70,209 @@ enum hns3_tuple_field { + HNS3_RSS_FIELD_IPV6_FRAG_IP_S + }; + ++enum hns3_rss_tuple_type { ++ HNS3_RSS_IP_TUPLE, ++ HNS3_RSS_IP_L4_TUPLE, ++}; ++ + static const struct { + uint64_t rss_types; ++ uint16_t tuple_type; + uint64_t rss_field; + } hns3_set_tuple_table[] = { ++ /* IPV4-FRAG */ + { RTE_ETH_RSS_FRAG_IPV4 | RTE_ETH_RSS_L3_SRC_ONLY, ++ HNS3_RSS_IP_TUPLE, + BIT_ULL(HNS3_RSS_FIELD_IPV4_EN_FRAG_IP_S) }, + { RTE_ETH_RSS_FRAG_IPV4 | RTE_ETH_RSS_L3_DST_ONLY, ++ HNS3_RSS_IP_TUPLE, ++ BIT_ULL(HNS3_RSS_FIELD_IPV4_EN_FRAG_IP_D) }, ++ { RTE_ETH_RSS_FRAG_IPV4, ++ HNS3_RSS_IP_TUPLE, ++ BIT_ULL(HNS3_RSS_FIELD_IPV4_EN_FRAG_IP_S) | + BIT_ULL(HNS3_RSS_FIELD_IPV4_EN_FRAG_IP_D) }, ++ ++ /* IPV4 */ ++ { RTE_ETH_RSS_IPV4 | RTE_ETH_RSS_L3_SRC_ONLY, ++ HNS3_RSS_IP_TUPLE, ++ BIT_ULL(HNS3_RSS_FIELD_IPV4_EN_NONFRAG_IP_S) }, ++ { RTE_ETH_RSS_IPV4 | RTE_ETH_RSS_L3_DST_ONLY, ++ HNS3_RSS_IP_TUPLE, ++ BIT_ULL(HNS3_RSS_FIELD_IPV4_EN_NONFRAG_IP_D) }, ++ { RTE_ETH_RSS_IPV4, ++ HNS3_RSS_IP_TUPLE, ++ BIT_ULL(HNS3_RSS_FIELD_IPV4_EN_NONFRAG_IP_S) | ++ BIT_ULL(HNS3_RSS_FIELD_IPV4_EN_NONFRAG_IP_D) }, ++ ++ /* IPV4-OTHER */ ++ { RTE_ETH_RSS_NONFRAG_IPV4_OTHER | RTE_ETH_RSS_L3_SRC_ONLY, ++ HNS3_RSS_IP_TUPLE, ++ BIT_ULL(HNS3_RSS_FIELD_IPV4_EN_NONFRAG_IP_S) }, ++ { RTE_ETH_RSS_NONFRAG_IPV4_OTHER | RTE_ETH_RSS_L3_DST_ONLY, ++ HNS3_RSS_IP_TUPLE, ++ BIT_ULL(HNS3_RSS_FIELD_IPV4_EN_NONFRAG_IP_D) }, ++ { RTE_ETH_RSS_NONFRAG_IPV4_OTHER, ++ HNS3_RSS_IP_TUPLE, ++ BIT_ULL(HNS3_RSS_FIELD_IPV4_EN_NONFRAG_IP_S) | ++ BIT_ULL(HNS3_RSS_FIELD_IPV4_EN_NONFRAG_IP_D) }, ++ ++ /* IPV4-TCP */ + { RTE_ETH_RSS_NONFRAG_IPV4_TCP | RTE_ETH_RSS_L3_SRC_ONLY, ++ HNS3_RSS_IP_L4_TUPLE, + BIT_ULL(HNS3_RSS_FIELD_IPV4_TCP_EN_IP_S) }, + { RTE_ETH_RSS_NONFRAG_IPV4_TCP | RTE_ETH_RSS_L3_DST_ONLY, ++ HNS3_RSS_IP_L4_TUPLE, + BIT_ULL(HNS3_RSS_FIELD_IPV4_TCP_EN_IP_D) }, + { RTE_ETH_RSS_NONFRAG_IPV4_TCP | RTE_ETH_RSS_L4_SRC_ONLY, ++ HNS3_RSS_IP_L4_TUPLE, + BIT_ULL(HNS3_RSS_FIELD_IPV4_TCP_EN_TCP_S) }, + { RTE_ETH_RSS_NONFRAG_IPV4_TCP | RTE_ETH_RSS_L4_DST_ONLY, ++ HNS3_RSS_IP_L4_TUPLE, ++ BIT_ULL(HNS3_RSS_FIELD_IPV4_TCP_EN_TCP_D) }, ++ { RTE_ETH_RSS_NONFRAG_IPV4_TCP, ++ HNS3_RSS_IP_L4_TUPLE, ++ BIT_ULL(HNS3_RSS_FIELD_IPV4_TCP_EN_IP_S) | ++ BIT_ULL(HNS3_RSS_FIELD_IPV4_TCP_EN_IP_D) | ++ BIT_ULL(HNS3_RSS_FIELD_IPV4_TCP_EN_TCP_S) | + BIT_ULL(HNS3_RSS_FIELD_IPV4_TCP_EN_TCP_D) }, ++ ++ /* IPV4-UDP */ + { RTE_ETH_RSS_NONFRAG_IPV4_UDP | RTE_ETH_RSS_L3_SRC_ONLY, ++ HNS3_RSS_IP_L4_TUPLE, + BIT_ULL(HNS3_RSS_FIELD_IPV4_UDP_EN_IP_S) }, + { RTE_ETH_RSS_NONFRAG_IPV4_UDP | RTE_ETH_RSS_L3_DST_ONLY, ++ HNS3_RSS_IP_L4_TUPLE, + BIT_ULL(HNS3_RSS_FIELD_IPV4_UDP_EN_IP_D) }, + { RTE_ETH_RSS_NONFRAG_IPV4_UDP | RTE_ETH_RSS_L4_SRC_ONLY, ++ HNS3_RSS_IP_L4_TUPLE, + BIT_ULL(HNS3_RSS_FIELD_IPV4_UDP_EN_UDP_S) }, + { RTE_ETH_RSS_NONFRAG_IPV4_UDP | RTE_ETH_RSS_L4_DST_ONLY, ++ HNS3_RSS_IP_L4_TUPLE, ++ BIT_ULL(HNS3_RSS_FIELD_IPV4_UDP_EN_UDP_D) }, ++ { RTE_ETH_RSS_NONFRAG_IPV4_UDP, ++ HNS3_RSS_IP_L4_TUPLE, ++ BIT_ULL(HNS3_RSS_FIELD_IPV4_UDP_EN_IP_S) | ++ BIT_ULL(HNS3_RSS_FIELD_IPV4_UDP_EN_IP_D) | ++ BIT_ULL(HNS3_RSS_FIELD_IPV4_UDP_EN_UDP_S) | + BIT_ULL(HNS3_RSS_FIELD_IPV4_UDP_EN_UDP_D) }, ++ ++ /* IPV4-SCTP */ + { RTE_ETH_RSS_NONFRAG_IPV4_SCTP | RTE_ETH_RSS_L3_SRC_ONLY, ++ HNS3_RSS_IP_L4_TUPLE, + BIT_ULL(HNS3_RSS_FIELD_IPV4_SCTP_EN_IP_S) }, + { RTE_ETH_RSS_NONFRAG_IPV4_SCTP | RTE_ETH_RSS_L3_DST_ONLY, ++ HNS3_RSS_IP_L4_TUPLE, + BIT_ULL(HNS3_RSS_FIELD_IPV4_SCTP_EN_IP_D) }, + { RTE_ETH_RSS_NONFRAG_IPV4_SCTP | RTE_ETH_RSS_L4_SRC_ONLY, ++ HNS3_RSS_IP_L4_TUPLE, + BIT_ULL(HNS3_RSS_FIELD_IPV4_SCTP_EN_SCTP_S) }, + { RTE_ETH_RSS_NONFRAG_IPV4_SCTP | RTE_ETH_RSS_L4_DST_ONLY, ++ HNS3_RSS_IP_L4_TUPLE, + BIT_ULL(HNS3_RSS_FIELD_IPV4_SCTP_EN_SCTP_D) }, +- { RTE_ETH_RSS_IPV4 | RTE_ETH_RSS_L3_SRC_ONLY, +- BIT_ULL(HNS3_RSS_FIELD_IPV4_EN_NONFRAG_IP_S) }, +- { RTE_ETH_RSS_IPV4 | RTE_ETH_RSS_L3_DST_ONLY, +- BIT_ULL(HNS3_RSS_FIELD_IPV4_EN_NONFRAG_IP_D) }, +- { RTE_ETH_RSS_NONFRAG_IPV4_OTHER | RTE_ETH_RSS_L3_SRC_ONLY, +- BIT_ULL(HNS3_RSS_FIELD_IPV4_EN_NONFRAG_IP_S) }, +- { RTE_ETH_RSS_NONFRAG_IPV4_OTHER | RTE_ETH_RSS_L3_DST_ONLY, +- BIT_ULL(HNS3_RSS_FIELD_IPV4_EN_NONFRAG_IP_D) }, ++ { RTE_ETH_RSS_NONFRAG_IPV4_SCTP, ++ HNS3_RSS_IP_L4_TUPLE, ++ BIT_ULL(HNS3_RSS_FIELD_IPV4_SCTP_EN_IP_S) | ++ BIT_ULL(HNS3_RSS_FIELD_IPV4_SCTP_EN_IP_D) | ++ BIT_ULL(HNS3_RSS_FIELD_IPV4_SCTP_EN_SCTP_S) | ++ BIT_ULL(HNS3_RSS_FIELD_IPV4_SCTP_EN_SCTP_D) | ++ BIT_ULL(HNS3_RSS_FIELD_IPV4_SCTP_EN_SCTP_VER) }, ++ ++ /* IPV6-FRAG */ + { RTE_ETH_RSS_FRAG_IPV6 | RTE_ETH_RSS_L3_SRC_ONLY, ++ HNS3_RSS_IP_TUPLE, + BIT_ULL(HNS3_RSS_FIELD_IPV6_FRAG_IP_S) }, + { RTE_ETH_RSS_FRAG_IPV6 | RTE_ETH_RSS_L3_DST_ONLY, ++ HNS3_RSS_IP_TUPLE, + BIT_ULL(HNS3_RSS_FIELD_IPV6_FRAG_IP_D) }, ++ { RTE_ETH_RSS_FRAG_IPV6, ++ HNS3_RSS_IP_TUPLE, ++ BIT_ULL(HNS3_RSS_FIELD_IPV6_FRAG_IP_S) | ++ BIT_ULL(HNS3_RSS_FIELD_IPV6_FRAG_IP_D) }, ++ ++ /* IPV6 */ ++ { RTE_ETH_RSS_IPV6 | RTE_ETH_RSS_L3_SRC_ONLY, ++ HNS3_RSS_IP_TUPLE, ++ BIT_ULL(HNS3_RSS_FIELD_IPV6_NONFRAG_IP_S) }, ++ { RTE_ETH_RSS_IPV6 | RTE_ETH_RSS_L3_DST_ONLY, ++ HNS3_RSS_IP_TUPLE, ++ BIT_ULL(HNS3_RSS_FIELD_IPV6_NONFRAG_IP_D) }, ++ { RTE_ETH_RSS_IPV6, ++ HNS3_RSS_IP_TUPLE, ++ BIT_ULL(HNS3_RSS_FIELD_IPV6_NONFRAG_IP_S) | ++ BIT_ULL(HNS3_RSS_FIELD_IPV6_NONFRAG_IP_D) }, ++ ++ /* IPV6-OTHER */ ++ { RTE_ETH_RSS_NONFRAG_IPV6_OTHER | RTE_ETH_RSS_L3_SRC_ONLY, ++ HNS3_RSS_IP_TUPLE, ++ BIT_ULL(HNS3_RSS_FIELD_IPV6_NONFRAG_IP_S) }, ++ { RTE_ETH_RSS_NONFRAG_IPV6_OTHER | RTE_ETH_RSS_L3_DST_ONLY, ++ HNS3_RSS_IP_TUPLE, ++ BIT_ULL(HNS3_RSS_FIELD_IPV6_NONFRAG_IP_D) }, ++ { RTE_ETH_RSS_NONFRAG_IPV6_OTHER, ++ HNS3_RSS_IP_TUPLE, ++ BIT_ULL(HNS3_RSS_FIELD_IPV6_NONFRAG_IP_S) | ++ BIT_ULL(HNS3_RSS_FIELD_IPV6_NONFRAG_IP_D) }, ++ ++ /* IPV6-TCP */ + { RTE_ETH_RSS_NONFRAG_IPV6_TCP | RTE_ETH_RSS_L3_SRC_ONLY, ++ HNS3_RSS_IP_L4_TUPLE, + BIT_ULL(HNS3_RSS_FIELD_IPV6_TCP_EN_IP_S) }, + { RTE_ETH_RSS_NONFRAG_IPV6_TCP | RTE_ETH_RSS_L3_DST_ONLY, ++ HNS3_RSS_IP_L4_TUPLE, + BIT_ULL(HNS3_RSS_FIELD_IPV6_TCP_EN_IP_D) }, + { RTE_ETH_RSS_NONFRAG_IPV6_TCP | RTE_ETH_RSS_L4_SRC_ONLY, ++ HNS3_RSS_IP_L4_TUPLE, + BIT_ULL(HNS3_RSS_FIELD_IPV6_TCP_EN_TCP_S) }, + { RTE_ETH_RSS_NONFRAG_IPV6_TCP | RTE_ETH_RSS_L4_DST_ONLY, ++ HNS3_RSS_IP_L4_TUPLE, ++ BIT_ULL(HNS3_RSS_FIELD_IPV6_TCP_EN_TCP_D) }, ++ { RTE_ETH_RSS_NONFRAG_IPV6_TCP, ++ HNS3_RSS_IP_L4_TUPLE, ++ BIT_ULL(HNS3_RSS_FIELD_IPV6_TCP_EN_IP_S) | ++ BIT_ULL(HNS3_RSS_FIELD_IPV6_TCP_EN_IP_D) | ++ BIT_ULL(HNS3_RSS_FIELD_IPV6_TCP_EN_TCP_S) | + BIT_ULL(HNS3_RSS_FIELD_IPV6_TCP_EN_TCP_D) }, ++ ++ /* IPV6-UDP */ + { RTE_ETH_RSS_NONFRAG_IPV6_UDP | RTE_ETH_RSS_L3_SRC_ONLY, ++ HNS3_RSS_IP_L4_TUPLE, + BIT_ULL(HNS3_RSS_FIELD_IPV6_UDP_EN_IP_S) }, + { RTE_ETH_RSS_NONFRAG_IPV6_UDP | RTE_ETH_RSS_L3_DST_ONLY, ++ HNS3_RSS_IP_L4_TUPLE, + BIT_ULL(HNS3_RSS_FIELD_IPV6_UDP_EN_IP_D) }, + { RTE_ETH_RSS_NONFRAG_IPV6_UDP | RTE_ETH_RSS_L4_SRC_ONLY, ++ HNS3_RSS_IP_L4_TUPLE, + BIT_ULL(HNS3_RSS_FIELD_IPV6_UDP_EN_UDP_S) }, + { RTE_ETH_RSS_NONFRAG_IPV6_UDP | RTE_ETH_RSS_L4_DST_ONLY, ++ HNS3_RSS_IP_L4_TUPLE, ++ BIT_ULL(HNS3_RSS_FIELD_IPV6_UDP_EN_UDP_D) }, ++ { RTE_ETH_RSS_NONFRAG_IPV6_UDP, ++ HNS3_RSS_IP_L4_TUPLE, ++ BIT_ULL(HNS3_RSS_FIELD_IPV6_UDP_EN_IP_S) | ++ BIT_ULL(HNS3_RSS_FIELD_IPV6_UDP_EN_IP_D) | ++ BIT_ULL(HNS3_RSS_FIELD_IPV6_UDP_EN_UDP_S) | + BIT_ULL(HNS3_RSS_FIELD_IPV6_UDP_EN_UDP_D) }, ++ ++ /* IPV6-SCTP */ + { RTE_ETH_RSS_NONFRAG_IPV6_SCTP | RTE_ETH_RSS_L3_SRC_ONLY, ++ HNS3_RSS_IP_L4_TUPLE, + BIT_ULL(HNS3_RSS_FIELD_IPV6_SCTP_EN_IP_S) }, + { RTE_ETH_RSS_NONFRAG_IPV6_SCTP | RTE_ETH_RSS_L3_DST_ONLY, ++ HNS3_RSS_IP_L4_TUPLE, + BIT_ULL(HNS3_RSS_FIELD_IPV6_SCTP_EN_IP_D) }, + { RTE_ETH_RSS_NONFRAG_IPV6_SCTP | RTE_ETH_RSS_L4_SRC_ONLY, ++ HNS3_RSS_IP_L4_TUPLE, + BIT_ULL(HNS3_RSS_FIELD_IPV6_SCTP_EN_SCTP_S) }, + { RTE_ETH_RSS_NONFRAG_IPV6_SCTP | RTE_ETH_RSS_L4_DST_ONLY, ++ HNS3_RSS_IP_L4_TUPLE, + BIT_ULL(HNS3_RSS_FIELD_IPV6_SCTP_EN_SCTP_D) }, +- { RTE_ETH_RSS_IPV6 | RTE_ETH_RSS_L3_SRC_ONLY, +- BIT_ULL(HNS3_RSS_FIELD_IPV6_NONFRAG_IP_S) }, +- { RTE_ETH_RSS_IPV6 | RTE_ETH_RSS_L3_DST_ONLY, +- BIT_ULL(HNS3_RSS_FIELD_IPV6_NONFRAG_IP_D) }, +- { RTE_ETH_RSS_NONFRAG_IPV6_OTHER | RTE_ETH_RSS_L3_SRC_ONLY, +- BIT_ULL(HNS3_RSS_FIELD_IPV6_NONFRAG_IP_S) }, +- { RTE_ETH_RSS_NONFRAG_IPV6_OTHER | RTE_ETH_RSS_L3_DST_ONLY, +- BIT_ULL(HNS3_RSS_FIELD_IPV6_NONFRAG_IP_D) }, +-}; +- +-static const struct { +- uint64_t rss_types; +- uint64_t rss_field; +-} hns3_set_rss_types[] = { +- { RTE_ETH_RSS_FRAG_IPV4, BIT_ULL(HNS3_RSS_FIELD_IPV4_EN_FRAG_IP_D) | +- BIT_ULL(HNS3_RSS_FIELD_IPV4_EN_FRAG_IP_S) }, +- { RTE_ETH_RSS_NONFRAG_IPV4_TCP, BIT_ULL(HNS3_RSS_FIELD_IPV4_TCP_EN_IP_S) | +- BIT_ULL(HNS3_RSS_FIELD_IPV4_TCP_EN_IP_D) | +- BIT_ULL(HNS3_RSS_FIELD_IPV4_TCP_EN_TCP_S) | +- BIT_ULL(HNS3_RSS_FIELD_IPV4_TCP_EN_TCP_D) }, +- { RTE_ETH_RSS_NONFRAG_IPV4_UDP, BIT_ULL(HNS3_RSS_FIELD_IPV4_UDP_EN_IP_S) | +- BIT_ULL(HNS3_RSS_FIELD_IPV4_UDP_EN_IP_D) | +- BIT_ULL(HNS3_RSS_FIELD_IPV4_UDP_EN_UDP_S) | +- BIT_ULL(HNS3_RSS_FIELD_IPV4_UDP_EN_UDP_D) }, +- { RTE_ETH_RSS_NONFRAG_IPV4_SCTP, BIT_ULL(HNS3_RSS_FIELD_IPV4_SCTP_EN_IP_S) | +- BIT_ULL(HNS3_RSS_FIELD_IPV4_SCTP_EN_IP_D) | +- BIT_ULL(HNS3_RSS_FIELD_IPV4_SCTP_EN_SCTP_S) | +- BIT_ULL(HNS3_RSS_FIELD_IPV4_SCTP_EN_SCTP_D) | +- BIT_ULL(HNS3_RSS_FIELD_IPV4_SCTP_EN_SCTP_VER) }, +- { RTE_ETH_RSS_IPV4, +- BIT_ULL(HNS3_RSS_FIELD_IPV4_EN_NONFRAG_IP_S) | +- BIT_ULL(HNS3_RSS_FIELD_IPV4_EN_NONFRAG_IP_D) }, +- { RTE_ETH_RSS_NONFRAG_IPV4_OTHER, +- BIT_ULL(HNS3_RSS_FIELD_IPV4_EN_NONFRAG_IP_S) | +- BIT_ULL(HNS3_RSS_FIELD_IPV4_EN_NONFRAG_IP_D) }, +- { RTE_ETH_RSS_FRAG_IPV6, BIT_ULL(HNS3_RSS_FIELD_IPV6_FRAG_IP_S) | +- BIT_ULL(HNS3_RSS_FIELD_IPV6_FRAG_IP_D) }, +- { RTE_ETH_RSS_NONFRAG_IPV6_TCP, BIT_ULL(HNS3_RSS_FIELD_IPV6_TCP_EN_IP_S) | +- BIT_ULL(HNS3_RSS_FIELD_IPV6_TCP_EN_IP_D) | +- BIT_ULL(HNS3_RSS_FIELD_IPV6_TCP_EN_TCP_S) | +- BIT_ULL(HNS3_RSS_FIELD_IPV6_TCP_EN_TCP_D) }, +- { RTE_ETH_RSS_NONFRAG_IPV6_UDP, BIT_ULL(HNS3_RSS_FIELD_IPV6_UDP_EN_IP_S) | +- BIT_ULL(HNS3_RSS_FIELD_IPV6_UDP_EN_IP_D) | +- BIT_ULL(HNS3_RSS_FIELD_IPV6_UDP_EN_UDP_S) | +- BIT_ULL(HNS3_RSS_FIELD_IPV6_UDP_EN_UDP_D) }, +- { RTE_ETH_RSS_NONFRAG_IPV6_SCTP, BIT_ULL(HNS3_RSS_FIELD_IPV6_SCTP_EN_IP_S) | ++ { RTE_ETH_RSS_NONFRAG_IPV6_SCTP, ++ HNS3_RSS_IP_L4_TUPLE, ++ BIT_ULL(HNS3_RSS_FIELD_IPV6_SCTP_EN_IP_S) | + BIT_ULL(HNS3_RSS_FIELD_IPV6_SCTP_EN_IP_D) | + BIT_ULL(HNS3_RSS_FIELD_IPV6_SCTP_EN_SCTP_D) | + BIT_ULL(HNS3_RSS_FIELD_IPV6_SCTP_EN_SCTP_S) | + BIT_ULL(HNS3_RSS_FIELD_IPV6_SCTP_EN_SCTP_VER) }, +- { RTE_ETH_RSS_IPV6, +- BIT_ULL(HNS3_RSS_FIELD_IPV6_NONFRAG_IP_S) | +- BIT_ULL(HNS3_RSS_FIELD_IPV6_NONFRAG_IP_D) }, +- { RTE_ETH_RSS_NONFRAG_IPV6_OTHER, +- BIT_ULL(HNS3_RSS_FIELD_IPV6_NONFRAG_IP_S) | +- BIT_ULL(HNS3_RSS_FIELD_IPV6_NONFRAG_IP_D) } + }; + + /* +@@ -321,46 +400,53 @@ hns3_rss_reset_indir_table(struct hns3_hw *hw) + return ret; + } + ++static uint64_t ++hns3_rss_calc_tuple_filed(uint64_t rss_hf) ++{ ++ uint64_t l3_only_mask = RTE_ETH_RSS_L3_SRC_ONLY | ++ RTE_ETH_RSS_L3_DST_ONLY; ++ uint64_t l4_only_mask = RTE_ETH_RSS_L4_SRC_ONLY | ++ RTE_ETH_RSS_L4_DST_ONLY; ++ uint64_t l3_l4_only_mask = l3_only_mask | l4_only_mask; ++ bool has_l3_l4_only = !!(rss_hf & l3_l4_only_mask); ++ bool has_l3_only = !!(rss_hf & l3_only_mask); ++ uint64_t tuple = 0; ++ uint32_t i; ++ ++ for (i = 0; i < RTE_DIM(hns3_set_tuple_table); i++) { ++ if ((rss_hf & hns3_set_tuple_table[i].rss_types) != ++ hns3_set_tuple_table[i].rss_types) ++ continue; ++ ++ if (hns3_set_tuple_table[i].tuple_type == HNS3_RSS_IP_TUPLE) { ++ if (hns3_set_tuple_table[i].rss_types & l3_only_mask || ++ !has_l3_only) ++ tuple |= hns3_set_tuple_table[i].rss_field; ++ continue; ++ } ++ ++ /* For IP types with L4, we need check both L3 and L4 */ ++ if (hns3_set_tuple_table[i].rss_types & l3_l4_only_mask || ++ !has_l3_l4_only) ++ tuple |= hns3_set_tuple_table[i].rss_field; ++ } ++ ++ return tuple; ++} ++ + int + hns3_set_rss_tuple_by_rss_hf(struct hns3_hw *hw, uint64_t rss_hf) + { + struct hns3_rss_input_tuple_cmd *req; + struct hns3_cmd_desc desc; +- uint32_t fields_count = 0; /* count times for setting tuple fields */ +- uint32_t i; ++ uint64_t tuple_field; + int ret; + + hns3_cmd_setup_basic_desc(&desc, HNS3_OPC_RSS_INPUT_TUPLE, false); +- + req = (struct hns3_rss_input_tuple_cmd *)desc.data; + +- for (i = 0; i < RTE_DIM(hns3_set_tuple_table); i++) { +- if ((rss_hf & hns3_set_tuple_table[i].rss_types) == +- hns3_set_tuple_table[i].rss_types) { +- req->tuple_field |= +- rte_cpu_to_le_64(hns3_set_tuple_table[i].rss_field); +- fields_count++; +- } +- } +- +- /* +- * When user does not specify the following types or a combination of +- * the following types, it enables all fields for the supported RSS +- * types. the following types as: +- * - RTE_ETH_RSS_L3_SRC_ONLY +- * - RTE_ETH_RSS_L3_DST_ONLY +- * - RTE_ETH_RSS_L4_SRC_ONLY +- * - RTE_ETH_RSS_L4_DST_ONLY +- */ +- if (fields_count == 0) { +- for (i = 0; i < RTE_DIM(hns3_set_rss_types); i++) { +- if ((rss_hf & hns3_set_rss_types[i].rss_types) == +- hns3_set_rss_types[i].rss_types) +- req->tuple_field |= rte_cpu_to_le_64( +- hns3_set_rss_types[i].rss_field); +- } +- } +- ++ tuple_field = hns3_rss_calc_tuple_filed(rss_hf); ++ req->tuple_field = rte_cpu_to_le_64(tuple_field); + ret = hns3_cmd_send(hw, &desc, 1); + if (ret) { + hns3_err(hw, "Update RSS flow types tuples failed %d", ret); +-- +2.23.0 + diff --git a/0159-net-hns3-fix-VF-alive-notification-after-config-rest.patch b/0159-net-hns3-fix-VF-alive-notification-after-config-rest.patch deleted file mode 100644 index 40209510aad4f189b60e20bd7f4c1a7d58f24196..0000000000000000000000000000000000000000 --- a/0159-net-hns3-fix-VF-alive-notification-after-config-rest.patch +++ /dev/null @@ -1,69 +0,0 @@ -From 6950c0629725d5659a0e74960ae7ca71865bf32e Mon Sep 17 00:00:00 2001 -From: Hongbo Zheng -Date: Fri, 7 May 2021 17:08:17 +0800 -Subject: [PATCH 159/189] net/hns3: fix VF alive notification after config - restore - -Currently in the VF reset scenario, the VF performs the set -alive operation before restoring the configuration completed, -which may cause the hardware to work in an abnormal state. - -This patch fix this problem by set VF alive after restoring -the configuration is completed. - -Fixes: a5475d61fa34 ("net/hns3: support VF") -Cc: stable@dpdk.org - -Signed-off-by: Hongbo Zheng -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_ethdev_vf.c | 19 +++++++++++++------ - 1 file changed, 13 insertions(+), 6 deletions(-) - -diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c -index 182e83b..dbd823f 100644 ---- a/drivers/net/hns3/hns3_ethdev_vf.c -+++ b/drivers/net/hns3/hns3_ethdev_vf.c -@@ -1891,12 +1891,6 @@ hns3vf_init_hardware(struct hns3_adapter *hns) - goto err_init_hardware; - } - -- ret = hns3vf_set_alive(hw, true); -- if (ret) { -- PMD_INIT_LOG(ERR, "Failed to VF send alive to PF: %d", ret); -- goto err_init_hardware; -- } -- - return 0; - - err_init_hardware: -@@ -1995,6 +1989,12 @@ hns3vf_init_vf(struct rte_eth_dev *eth_dev) - - hns3_rss_set_default_args(hw); - -+ ret = hns3vf_set_alive(hw, true); -+ if (ret) { -+ PMD_INIT_LOG(ERR, "Failed to VF send alive to PF: %d", ret); -+ goto err_set_tc_queue; -+ } -+ - return 0; - - err_set_tc_queue: -@@ -2703,6 +2703,13 @@ hns3vf_restore_conf(struct hns3_adapter *hns) - hns3_info(hw, "hns3vf dev restart successful!"); - } else if (hw->adapter_state == HNS3_NIC_STOPPING) - hw->adapter_state = HNS3_NIC_CONFIGURED; -+ -+ ret = hns3vf_set_alive(hw, true); -+ if (ret) { -+ hns3_err(hw, "failed to VF send alive to PF: %d", ret); -+ goto err_vlan_table; -+ } -+ - return 0; - - err_vlan_table: --- -2.7.4 - diff --git a/0160-net-hns3-add-check-for-L3-and-L4-type.patch b/0160-net-hns3-add-check-for-L3-and-L4-type.patch new file mode 100644 index 0000000000000000000000000000000000000000..0c5498262a6fe1af46d78f9c1e163bdef0fe2392 --- /dev/null +++ b/0160-net-hns3-add-check-for-L3-and-L4-type.patch @@ -0,0 +1,77 @@ +From 3406502c1af41be568561d74b39417dd2a3a771a Mon Sep 17 00:00:00 2001 +From: Huisong Li +Date: Fri, 21 Oct 2022 15:36:36 +0800 +Subject: [PATCH 160/189] net/hns3: add check for L3 and L4 type + +When user set 'L3_SRC/DST_ONLY' or 'L4_SRC/DST_ONLY' to 'rss_hf' and +do not specify the packet type, these types will be not set to hardware. +So this patch adds a check for them. + +Fixes: 806f1d5ab0e3 ("net/hns3: set RSS hash type input configuration") +Cc: stable@dpdk.org + +Signed-off-by: Huisong Li +--- + drivers/net/hns3/hns3_rss.c | 31 +++++++++++++++++++++++++++++-- + 1 file changed, 29 insertions(+), 2 deletions(-) + +diff --git a/drivers/net/hns3/hns3_rss.c b/drivers/net/hns3/hns3_rss.c +index ea745c791f..ca5a129234 100644 +--- a/drivers/net/hns3/hns3_rss.c ++++ b/drivers/net/hns3/hns3_rss.c +@@ -400,8 +400,34 @@ hns3_rss_reset_indir_table(struct hns3_hw *hw) + return ret; + } + ++static void ++hns3_rss_check_l3l4_types(struct hns3_hw *hw, uint64_t rss_hf) ++{ ++ uint64_t ip_mask = RTE_ETH_RSS_IPV4 | RTE_ETH_RSS_FRAG_IPV4 | ++ RTE_ETH_RSS_NONFRAG_IPV4_OTHER | ++ RTE_ETH_RSS_IPV6 | RTE_ETH_RSS_FRAG_IPV6 | ++ RTE_ETH_RSS_NONFRAG_IPV6_OTHER; ++ uint64_t l4_mask = RTE_ETH_RSS_NONFRAG_IPV4_TCP | ++ RTE_ETH_RSS_NONFRAG_IPV4_UDP | ++ RTE_ETH_RSS_NONFRAG_IPV4_SCTP | ++ RTE_ETH_RSS_NONFRAG_IPV6_TCP | ++ RTE_ETH_RSS_NONFRAG_IPV6_UDP | ++ RTE_ETH_RSS_NONFRAG_IPV6_SCTP; ++ uint64_t l3_src_dst_mask = RTE_ETH_RSS_L3_SRC_ONLY | ++ RTE_ETH_RSS_L3_DST_ONLY; ++ uint64_t l4_src_dst_mask = RTE_ETH_RSS_L4_SRC_ONLY | ++ RTE_ETH_RSS_L4_DST_ONLY; ++ ++ if (rss_hf & l3_src_dst_mask && ++ !(rss_hf & ip_mask || rss_hf & l4_mask)) ++ hns3_warn(hw, "packet type isn't specified, L3_SRC/DST_ONLY is ignored."); ++ ++ if (rss_hf & l4_src_dst_mask && !(rss_hf & l4_mask)) ++ hns3_warn(hw, "packet type isn't specified, L4_SRC/DST_ONLY is ignored."); ++} ++ + static uint64_t +-hns3_rss_calc_tuple_filed(uint64_t rss_hf) ++hns3_rss_calc_tuple_filed(struct hns3_hw *hw, uint64_t rss_hf) + { + uint64_t l3_only_mask = RTE_ETH_RSS_L3_SRC_ONLY | + RTE_ETH_RSS_L3_DST_ONLY; +@@ -430,6 +456,7 @@ hns3_rss_calc_tuple_filed(uint64_t rss_hf) + !has_l3_l4_only) + tuple |= hns3_set_tuple_table[i].rss_field; + } ++ hns3_rss_check_l3l4_types(hw, rss_hf); + + return tuple; + } +@@ -445,7 +472,7 @@ hns3_set_rss_tuple_by_rss_hf(struct hns3_hw *hw, uint64_t rss_hf) + hns3_cmd_setup_basic_desc(&desc, HNS3_OPC_RSS_INPUT_TUPLE, false); + req = (struct hns3_rss_input_tuple_cmd *)desc.data; + +- tuple_field = hns3_rss_calc_tuple_filed(rss_hf); ++ tuple_field = hns3_rss_calc_tuple_filed(hw, rss_hf); + req->tuple_field = rte_cpu_to_le_64(tuple_field); + ret = hns3_cmd_send(hw, &desc, 1); + if (ret) { +-- +2.23.0 + diff --git a/0160-net-hns3-fix-querying-flow-director-counter-for-out-.patch b/0160-net-hns3-fix-querying-flow-director-counter-for-out-.patch deleted file mode 100644 index b9fb8c3150c4776cce267aafa8b04a463a58e5f1..0000000000000000000000000000000000000000 --- a/0160-net-hns3-fix-querying-flow-director-counter-for-out-.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 738c66f157c398ce78f3ba7c25f4e096d755ce7f Mon Sep 17 00:00:00 2001 -From: Chengwen Feng -Date: Fri, 7 May 2021 17:08:18 +0800 -Subject: [PATCH 160/189] net/hns3: fix querying flow director counter for out - param - -The hardware doesn't support counting the number of bytes that through -the fdir rule. Therefore, the corresponding out parameters (e.g. -bytes_set/bytes) is set to zero. - -Fixes: fcba820d9b9e ("net/hns3: support flow director") -Cc: stable@dpdk.org - -Signed-off-by: Chengwen Feng -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_flow.c | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/drivers/net/hns3/hns3_flow.c b/drivers/net/hns3/hns3_flow.c -index 15ecaf4..d405820 100644 ---- a/drivers/net/hns3/hns3_flow.c -+++ b/drivers/net/hns3/hns3_flow.c -@@ -223,6 +223,8 @@ hns3_counter_query(struct rte_eth_dev *dev, struct rte_flow *flow, - } - qc->hits_set = 1; - qc->hits = value; -+ qc->bytes_set = 0; -+ qc->bytes = 0; - - return 0; - } --- -2.7.4 - diff --git a/0161-net-hns3-fix-TM-QCN-error-event-report-by-MSI-X.patch b/0161-net-hns3-fix-TM-QCN-error-event-report-by-MSI-X.patch deleted file mode 100644 index ab6175556ba4077fcb390bee9935bda5f8c5b4e9..0000000000000000000000000000000000000000 --- a/0161-net-hns3-fix-TM-QCN-error-event-report-by-MSI-X.patch +++ /dev/null @@ -1,54 +0,0 @@ -From dbeadbf0ac1368fa07822b025a3f1bf10a450b43 Mon Sep 17 00:00:00 2001 -From: Chengwen Feng -Date: Sat, 8 May 2021 15:40:57 +0800 -Subject: [PATCH 161/189] net/hns3: fix TM QCN error event report by MSI-X - -The TM QCN error event should report by RAS other than MSIX. - -Also this patch adds fifo int enable configuration before the TM QCN -error event is enabled. - -Fixes: f53a793bb7c2 ("net/hns3: add more hardware error types") -Fixes: 3903c05382c5 ("net/hns3: remove read when enabling TM QCN error event") -Cc: stable@dpdk.org - -Signed-off-by: Chengwen Feng -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_intr.c | 5 ++++- - drivers/net/hns3/hns3_intr.h | 2 ++ - 2 files changed, 6 insertions(+), 1 deletion(-) - -diff --git a/drivers/net/hns3/hns3_intr.c b/drivers/net/hns3/hns3_intr.c -index 0140260..854cb1d 100644 ---- a/drivers/net/hns3/hns3_intr.c -+++ b/drivers/net/hns3/hns3_intr.c -@@ -1783,8 +1783,11 @@ enable_tm_err_intr(struct hns3_adapter *hns, bool en) - - /* configure TM QCN hw errors */ - hns3_cmd_setup_basic_desc(&desc, HNS3_OPC_TM_QCN_MEM_INT_CFG, false); -- if (en) -+ desc.data[0] = rte_cpu_to_le_32(HNS3_TM_QCN_ERR_INT_TYPE); -+ if (en) { -+ desc.data[0] |= rte_cpu_to_le_32(HNS3_TM_QCN_FIFO_INT_EN); - desc.data[1] = rte_cpu_to_le_32(HNS3_TM_QCN_MEM_ERR_INT_EN); -+ } - - ret = hns3_cmd_send(hw, &desc, 1); - if (ret) -diff --git a/drivers/net/hns3/hns3_intr.h b/drivers/net/hns3/hns3_intr.h -index a140ca1..4dfc807 100644 ---- a/drivers/net/hns3/hns3_intr.h -+++ b/drivers/net/hns3/hns3_intr.h -@@ -77,6 +77,8 @@ - #define HNS3_NCSI_ERR_INT_EN 0x3 - - #define HNS3_TM_SCH_ECC_ERR_INT_EN 0x3 -+#define HNS3_TM_QCN_ERR_INT_TYPE 0x29 -+#define HNS3_TM_QCN_FIFO_INT_EN 0xFFFF00 - #define HNS3_TM_QCN_MEM_ERR_INT_EN 0xFFFFFF - - #define HNS3_RESET_PROCESS_MS 200 --- -2.7.4 - diff --git a/0161-net-hns3-revert-fix-mailbox-communication-with-HW.patch b/0161-net-hns3-revert-fix-mailbox-communication-with-HW.patch new file mode 100644 index 0000000000000000000000000000000000000000..a33b40c76b558b47df0a263a28b884cab99e1180 --- /dev/null +++ b/0161-net-hns3-revert-fix-mailbox-communication-with-HW.patch @@ -0,0 +1,58 @@ +From e438ad9ab2897ec33b94ee5f31bd1b2fbfc4e36e Mon Sep 17 00:00:00 2001 +From: Chengwen Feng +Date: Fri, 21 Oct 2022 15:36:37 +0800 +Subject: [PATCH 161/189] net/hns3: revert fix mailbox communication with HW + +VF's command receive queue was mainly used to receive mailbox messages +from PF. There are two type mailbox messages: request response message +and message pushed by PF. + +There are two types of threads that can handle these messages: +1) the interrupt thread of the main process: it could handle both types +of messages. +2) other threads: it could only handle request response messages. + +The collaboration mechanism between the two type threads is that other +threads set the opcode of processed messages to zero so that the +interrupt thread of the main process does not process these messages +again. Because other threads can only process part of the messages, +after the processing is complete, the next-to-use pointer of the +command receive queue should not be updated. Otherwise, some messages +(e.g. messages pushed by PF) maybe discarded. + +Unfortunately, the patch to be reverted updates next-to-use pointer of +the command receive queue in other threads context, and this will lead +to discard some mailbox message. + +So this commit reverts +commit 599ef84add7e ("net/hns3: fix mailbox communication with HW") + +Fixes: 599ef84add7e ("net/hns3: fix mailbox communication with HW") +Cc: stable@dpdk.org + +Signed-off-by: Chengwen Feng +Signed-off-by: Dongdong Liu +--- + drivers/net/hns3/hns3_mbx.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/drivers/net/hns3/hns3_mbx.c b/drivers/net/hns3/hns3_mbx.c +index b3563d4694..2de55a6417 100644 +--- a/drivers/net/hns3/hns3_mbx.c ++++ b/drivers/net/hns3/hns3_mbx.c +@@ -436,8 +436,10 @@ hns3_handle_mbx_msg_out_intr(struct hns3_hw *hw) + next_to_use = (next_to_use + 1) % hw->cmq.crq.desc_num; + } + +- crq->next_to_use = next_to_use; +- hns3_write_dev(hw, HNS3_CMDQ_RX_HEAD_REG, crq->next_to_use); ++ /* ++ * Note: the crq->next_to_use field should not updated, otherwise, ++ * mailbox messages may be discarded. ++ */ + } + + void +-- +2.23.0 + diff --git a/0162-net-hns3-fix-VF-mailbox-message-handling.patch b/0162-net-hns3-fix-VF-mailbox-message-handling.patch new file mode 100644 index 0000000000000000000000000000000000000000..b018883982e5fa5d1d3a6e19e02388ca3256885c --- /dev/null +++ b/0162-net-hns3-fix-VF-mailbox-message-handling.patch @@ -0,0 +1,48 @@ +From 33814ad89cd618df8c596f7b138150cd4b71a8c3 Mon Sep 17 00:00:00 2001 +From: Chengwen Feng +Date: Fri, 21 Oct 2022 15:36:38 +0800 +Subject: [PATCH 162/189] net/hns3: fix VF mailbox message handling + +VF's command receive queue was mainly used to receive mailbox messages +from PF. There are two type mailbox messages: request response message +and message pushed by PF. + +There are two types of threads that can handle these messages: +1) the interrupt thread of the main process: it could handle both types +of messages. +2) other threads: it could only handle request response messages. + +The collaboration mechanism between the two type threads is that other +threads set the opcode of processed messages to zero so that the +interrupt thread of the main process does not process these messages +again. + +Unfortunately, the other threads mark the message pointed to by the +crq->next-to-use variable which is fixed in the loop, not the message +pointed to by the next-to-use variable. + +Fixes: dbbbad23e380 ("net/hns3: fix VF handling LSC event in secondary process") +Cc: stable@dpdk.org + +Signed-off-by: Chengwen Feng +Signed-off-by: Dongdong Liu +--- + drivers/net/hns3/hns3_mbx.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/net/hns3/hns3_mbx.c b/drivers/net/hns3/hns3_mbx.c +index 2de55a6417..9a05f0d1ee 100644 +--- a/drivers/net/hns3/hns3_mbx.c ++++ b/drivers/net/hns3/hns3_mbx.c +@@ -429,7 +429,7 @@ hns3_handle_mbx_msg_out_intr(struct hns3_hw *hw) + * Clear opcode to inform intr thread don't process + * again. + */ +- crq->desc[crq->next_to_use].opcode = 0; ++ crq->desc[next_to_use].opcode = 0; + } + + scan_next: +-- +2.23.0 + diff --git a/0162-net-hns3-fix-mailbox-message-ID-in-log.patch b/0162-net-hns3-fix-mailbox-message-ID-in-log.patch deleted file mode 100644 index 6b722504ff4d7e64a9486ee180864a9c09aeea24..0000000000000000000000000000000000000000 --- a/0162-net-hns3-fix-mailbox-message-ID-in-log.patch +++ /dev/null @@ -1,33 +0,0 @@ -From e1cf907216bf8fdb15a94a7c9918b1f6772afebb Mon Sep 17 00:00:00 2001 -From: Chengwen Feng -Date: Mon, 10 May 2021 21:38:10 +0800 -Subject: [PATCH 162/189] net/hns3: fix mailbox message ID in log - -The mailbox message id is uint8_t, but the unsupported mailbox message -id was logged by uint16. - -Fixes: 463e748964f5 ("net/hns3: support mailbox") -Cc: stable@dpdk.org - -Signed-off-by: Chengwen Feng -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_mbx.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/drivers/net/hns3/hns3_mbx.c b/drivers/net/hns3/hns3_mbx.c -index 3d019b9..0c2e03b 100644 ---- a/drivers/net/hns3/hns3_mbx.c -+++ b/drivers/net/hns3/hns3_mbx.c -@@ -540,7 +540,7 @@ hns3_dev_handle_mbx_msg(struct hns3_hw *hw) - break; - default: - hns3_err(hw, "received unsupported(%u) mbx msg", -- req->msg[0]); -+ opcode); - break; - } - --- -2.7.4 - diff --git a/0163-net-hns3-fix-minimum-Tx-frame-length.patch b/0163-net-hns3-fix-minimum-Tx-frame-length.patch new file mode 100644 index 0000000000000000000000000000000000000000..af4c901e256e7fd02dc26a01c21074db6d6a4b79 --- /dev/null +++ b/0163-net-hns3-fix-minimum-Tx-frame-length.patch @@ -0,0 +1,123 @@ +From ac646ee28e8c9780d02ec685b7581486c13f6961 Mon Sep 17 00:00:00 2001 +From: Jie Hai +Date: Fri, 21 Oct 2022 15:36:39 +0800 +Subject: [PATCH 163/189] net/hns3: fix minimum Tx frame length + +When packet length in Tx is less than length hardware supported, +the minimum frame length in hns3 is used to do padding to avoid +hardware error. Currently, this length is fixed by macro, which +is very unfavorable for subsequent hardware evolution. So fix it +as firmware report. + +Fixes: 395b5e08ef8d ("net/hns3: add Tx short frame padding compatibility") +Cc: stable@dpdk.org + +Signed-off-by: Jie Hai +Signed-off-by: Dongdong Liu +--- + drivers/net/hns3/hns3_cmd.h | 6 ++++++ + drivers/net/hns3/hns3_ethdev.c | 4 +++- + drivers/net/hns3/hns3_ethdev.h | 3 +-- + drivers/net/hns3/hns3_ethdev_vf.c | 4 +++- + 4 files changed, 13 insertions(+), 4 deletions(-) + +diff --git a/drivers/net/hns3/hns3_cmd.h b/drivers/net/hns3/hns3_cmd.h +index 8ac8b45819..994dfc48cc 100644 +--- a/drivers/net/hns3/hns3_cmd.h ++++ b/drivers/net/hns3/hns3_cmd.h +@@ -967,6 +967,12 @@ struct hns3_dev_specs_0_cmd { + uint32_t max_tm_rate; + }; + ++struct hns3_dev_specs_1_cmd { ++ uint8_t rsv0[12]; ++ uint8_t min_tx_pkt_len; ++ uint8_t rsv1[11]; ++}; ++ + struct hns3_query_rpu_cmd { + uint32_t tc_queue_num; + uint32_t rsv1[2]; +diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c +index 7b0e8fc77d..7330515535 100644 +--- a/drivers/net/hns3/hns3_ethdev.c ++++ b/drivers/net/hns3/hns3_ethdev.c +@@ -2661,14 +2661,17 @@ static void + hns3_parse_dev_specifications(struct hns3_hw *hw, struct hns3_cmd_desc *desc) + { + struct hns3_dev_specs_0_cmd *req0; ++ struct hns3_dev_specs_1_cmd *req1; + + req0 = (struct hns3_dev_specs_0_cmd *)desc[0].data; ++ req1 = (struct hns3_dev_specs_1_cmd *)desc[1].data; + + hw->max_non_tso_bd_num = req0->max_non_tso_bd_num; + hw->rss_ind_tbl_size = rte_le_to_cpu_16(req0->rss_ind_tbl_size); + hw->rss_key_size = rte_le_to_cpu_16(req0->rss_key_size); + hw->max_tm_rate = rte_le_to_cpu_32(req0->max_tm_rate); + hw->intr.int_ql_max = rte_le_to_cpu_16(req0->intr_ql_max); ++ hw->min_tx_pkt_len = req1->min_tx_pkt_len; + } + + static int +@@ -2763,7 +2766,6 @@ hns3_get_capability(struct hns3_hw *hw) + hw->tso_mode = HNS3_TSO_HW_CAL_PSEUDO_H_CSUM; + hw->vlan_mode = HNS3_HW_SHIFT_AND_DISCARD_MODE; + hw->drop_stats_mode = HNS3_PKTS_DROP_STATS_MODE2; +- hw->min_tx_pkt_len = HNS3_HIP09_MIN_TX_PKT_LEN; + pf->tqp_config_mode = HNS3_FLEX_MAX_TQP_NUM_MODE; + hw->rss_info.ipv6_sctp_offload_supported = true; + hw->udp_cksum_mode = HNS3_SPECIAL_PORT_HW_CKSUM_MODE; +diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h +index 40476bf882..4406611fe9 100644 +--- a/drivers/net/hns3/hns3_ethdev.h ++++ b/drivers/net/hns3/hns3_ethdev.h +@@ -75,7 +75,6 @@ + #define HNS3_DEFAULT_MTU 1500UL + #define HNS3_DEFAULT_FRAME_LEN (HNS3_DEFAULT_MTU + HNS3_ETH_OVERHEAD) + #define HNS3_HIP08_MIN_TX_PKT_LEN 33 +-#define HNS3_HIP09_MIN_TX_PKT_LEN 9 + + #define HNS3_BITS_PER_BYTE 8 + +@@ -550,7 +549,7 @@ struct hns3_hw { + * The minimum length of the packet supported by hardware in the Tx + * direction. + */ +- uint32_t min_tx_pkt_len; ++ uint8_t min_tx_pkt_len; + + struct hns3_queue_intr intr; + /* +diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c +index 72d60191ab..6976a9f23d 100644 +--- a/drivers/net/hns3/hns3_ethdev_vf.c ++++ b/drivers/net/hns3/hns3_ethdev_vf.c +@@ -701,13 +701,16 @@ static void + hns3vf_parse_dev_specifications(struct hns3_hw *hw, struct hns3_cmd_desc *desc) + { + struct hns3_dev_specs_0_cmd *req0; ++ struct hns3_dev_specs_1_cmd *req1; + + req0 = (struct hns3_dev_specs_0_cmd *)desc[0].data; ++ req1 = (struct hns3_dev_specs_1_cmd *)desc[1].data; + + hw->max_non_tso_bd_num = req0->max_non_tso_bd_num; + hw->rss_ind_tbl_size = rte_le_to_cpu_16(req0->rss_ind_tbl_size); + hw->rss_key_size = rte_le_to_cpu_16(req0->rss_key_size); + hw->intr.int_ql_max = rte_le_to_cpu_16(req0->intr_ql_max); ++ hw->min_tx_pkt_len = req1->min_tx_pkt_len; + } + + static int +@@ -846,7 +849,6 @@ hns3vf_get_capability(struct hns3_hw *hw) + hw->intr.gl_unit = HNS3_INTR_COALESCE_GL_UINT_1US; + hw->tso_mode = HNS3_TSO_HW_CAL_PSEUDO_H_CSUM; + hw->drop_stats_mode = HNS3_PKTS_DROP_STATS_MODE2; +- hw->min_tx_pkt_len = HNS3_HIP09_MIN_TX_PKT_LEN; + hw->rss_info.ipv6_sctp_offload_supported = true; + hw->promisc_mode = HNS3_LIMIT_PROMISC_MODE; + +-- +2.23.0 + diff --git a/0163-net-hns3-fix-secondary-process-request-start-stop-Rx.patch b/0163-net-hns3-fix-secondary-process-request-start-stop-Rx.patch deleted file mode 100644 index 12dec23b7fa5fda9de35b588e9e7eaf9234254f9..0000000000000000000000000000000000000000 --- a/0163-net-hns3-fix-secondary-process-request-start-stop-Rx.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 8f2285bfc5a77da72ddaec4faccfbbdef91cd4a8 Mon Sep 17 00:00:00 2001 -From: Chengwen Feng -Date: Mon, 10 May 2021 21:38:11 +0800 -Subject: [PATCH 163/189] net/hns3: fix secondary process request start/stop - Rx/Tx - -This secondary process should not send request to start/stop Rx/Tx, -this patch fixes it. - -Fixes: 23d4b61fee5d ("net/hns3: support multiple process") -Cc: stable@dpdk.org - -Signed-off-by: Chengwen Feng -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_mp.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/drivers/net/hns3/hns3_mp.c b/drivers/net/hns3/hns3_mp.c -index ed2567a..7d85de3 100644 ---- a/drivers/net/hns3/hns3_mp.c -+++ b/drivers/net/hns3/hns3_mp.c -@@ -130,7 +130,7 @@ mp_req_on_rxtx(struct rte_eth_dev *dev, enum hns3_mp_req_type type) - int ret; - int i; - -- if (!hw->secondary_cnt) -+ if (rte_eal_process_type() == RTE_PROC_SECONDARY || !hw->secondary_cnt) - return; - if (type != HNS3_MP_REQ_START_RXTX && type != HNS3_MP_REQ_STOP_RXTX) { - hns3_err(hw, "port %u unknown request (req_type %d)", --- -2.7.4 - diff --git a/0164-ethdev-introduce-Rx-Tx-descriptor-dump-API.patch b/0164-ethdev-introduce-Rx-Tx-descriptor-dump-API.patch new file mode 100644 index 0000000000000000000000000000000000000000..82be665e931e7b6806c50a4ac5cef8a536bf45c1 --- /dev/null +++ b/0164-ethdev-introduce-Rx-Tx-descriptor-dump-API.patch @@ -0,0 +1,238 @@ +From e4f2f2e047f123e5aff0a9a5699bf2d4ece4ebb8 Mon Sep 17 00:00:00 2001 +From: "Min Hu (Connor)" +Date: Fri, 21 Oct 2022 15:36:40 +0800 +Subject: [PATCH 164/189] ethdev: introduce Rx/Tx descriptor dump API + +Added the ethdev Rx/Tx desc dump API which provides functions for query +descriptor from device. HW descriptor info differs in different NICs. +The information demonstrates I/O process which is important for debug. +As the information is different between NICs, the new API is introduced. + +Signed-off-by: Min Hu (Connor) +Signed-off-by: Dongdong Liu +Reviewed-by: Ferruh Yigit +--- + lib/ethdev/ethdev_driver.h | 53 ++++++++++++++++++++++++++++++++++++ + lib/ethdev/rte_ethdev.c | 52 +++++++++++++++++++++++++++++++++++ + lib/ethdev/rte_ethdev.h | 55 ++++++++++++++++++++++++++++++++++++++ + lib/ethdev/version.map | 4 +++ + 4 files changed, 164 insertions(+) + +diff --git a/lib/ethdev/ethdev_driver.h b/lib/ethdev/ethdev_driver.h +index e24ff7064c..41f67f2740 100644 +--- a/lib/ethdev/ethdev_driver.h ++++ b/lib/ethdev/ethdev_driver.h +@@ -1010,6 +1010,54 @@ typedef int (*eth_rx_metadata_negotiate_t)(struct rte_eth_dev *dev, + */ + typedef int (*eth_dev_priv_dump_t)(struct rte_eth_dev *dev, FILE *file); + ++/** ++ * @internal ++ * Dump Rx descriptor info to a file. ++ * ++ * It is used for debugging, not a dataplane API. ++ * ++ * @param dev ++ * Port (ethdev) handle. ++ * @param queue_id ++ * A Rx queue identifier on this port. ++ * @param offset ++ * The offset of the descriptor starting from tail. (0 is the next ++ * packet to be received by the driver). ++ * @param num ++ * The number of the descriptors to dump. ++ * @param file ++ * A pointer to a file for output. ++ * @return ++ * Negative errno value on error, zero on success. ++ */ ++typedef int (*eth_rx_descriptor_dump_t)(const struct rte_eth_dev *dev, ++ uint16_t queue_id, uint16_t offset, ++ uint16_t num, FILE *file); ++ ++/** ++ * @internal ++ * Dump Tx descriptor info to a file. ++ * ++ * This API is used for debugging, not a dataplane API. ++ * ++ * @param dev ++ * Port (ethdev) handle. ++ * @param queue_id ++ * A Tx queue identifier on this port. ++ * @param offset ++ * The offset of the descriptor starting from tail. (0 is the place where ++ * the next packet will be send). ++ * @param num ++ * The number of the descriptors to dump. ++ * @param file ++ * A pointer to a file for output. ++ * @return ++ * Negative errno value on error, zero on success. ++ */ ++typedef int (*eth_tx_descriptor_dump_t)(const struct rte_eth_dev *dev, ++ uint16_t queue_id, uint16_t offset, ++ uint16_t num, FILE *file); ++ + /** + * @internal A structure containing the functions exported by an Ethernet driver. + */ +@@ -1209,6 +1257,11 @@ struct eth_dev_ops { + + /** Dump private info from device */ + eth_dev_priv_dump_t eth_dev_priv_dump; ++ ++ /** Dump Rx descriptor info */ ++ eth_rx_descriptor_dump_t eth_rx_descriptor_dump; ++ /** Dump Tx descriptor info */ ++ eth_tx_descriptor_dump_t eth_tx_descriptor_dump; + }; + + /** +diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c +index 25c9f0c123..b95f501b51 100644 +--- a/lib/ethdev/rte_ethdev.c ++++ b/lib/ethdev/rte_ethdev.c +@@ -6509,6 +6509,58 @@ rte_eth_dev_priv_dump(uint16_t port_id, FILE *file) + return eth_err(port_id, (*dev->dev_ops->eth_dev_priv_dump)(dev, file)); + } + ++int ++rte_eth_rx_descriptor_dump(uint16_t port_id, uint16_t queue_id, ++ uint16_t offset, uint16_t num, FILE *file) ++{ ++ struct rte_eth_dev *dev; ++ ++ RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); ++ dev = &rte_eth_devices[port_id]; ++ ++ if (queue_id >= dev->data->nb_rx_queues) { ++ RTE_ETHDEV_LOG(ERR, "Invalid Rx queue_id=%u\n", queue_id); ++ return -EINVAL; ++ } ++ ++ if (file == NULL) { ++ RTE_ETHDEV_LOG(ERR, "Invalid file (NULL)\n"); ++ return -EINVAL; ++ } ++ ++ if (*dev->dev_ops->eth_rx_descriptor_dump == NULL) ++ return -ENOTSUP; ++ ++ return eth_err(port_id, (*dev->dev_ops->eth_rx_descriptor_dump)(dev, ++ queue_id, offset, num, file)); ++} ++ ++int ++rte_eth_tx_descriptor_dump(uint16_t port_id, uint16_t queue_id, ++ uint16_t offset, uint16_t num, FILE *file) ++{ ++ struct rte_eth_dev *dev; ++ ++ RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); ++ dev = &rte_eth_devices[port_id]; ++ ++ if (queue_id >= dev->data->nb_tx_queues) { ++ RTE_ETHDEV_LOG(ERR, "Invalid Tx queue_id=%u\n", queue_id); ++ return -EINVAL; ++ } ++ ++ if (file == NULL) { ++ RTE_ETHDEV_LOG(ERR, "Invalid file (NULL)\n"); ++ return -EINVAL; ++ } ++ ++ if (*dev->dev_ops->eth_tx_descriptor_dump == NULL) ++ return -ENOTSUP; ++ ++ return eth_err(port_id, (*dev->dev_ops->eth_tx_descriptor_dump)(dev, ++ queue_id, offset, num, file)); ++} ++ + RTE_LOG_REGISTER_DEFAULT(rte_eth_dev_logtype, INFO); + + RTE_INIT(ethdev_init_telemetry) +diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h +index 082166ed42..8c894e090d 100644 +--- a/lib/ethdev/rte_ethdev.h ++++ b/lib/ethdev/rte_ethdev.h +@@ -5213,6 +5213,61 @@ int rte_eth_rx_metadata_negotiate(uint16_t port_id, uint64_t *features); + __rte_experimental + int rte_eth_dev_priv_dump(uint16_t port_id, FILE *file); + ++/** ++ * @warning ++ * @b EXPERIMENTAL: this API may change, or be removed, without prior notice ++ * ++ * Dump ethdev Rx descriptor info to a file. ++ * ++ * This API is used for debugging, not a dataplane API. ++ * ++ * @param port_id ++ * The port identifier of the Ethernet device. ++ * @param queue_id ++ * A Rx queue identifier on this port. ++ * @param offset ++ * The offset of the descriptor starting from tail. (0 is the next ++ * packet to be received by the driver). ++ * @param num ++ * The number of the descriptors to dump. ++ * @param file ++ * A pointer to a file for output. ++ * @return ++ * - On success, zero. ++ * - On failure, a negative value. ++ */ ++__rte_experimental ++int rte_eth_rx_descriptor_dump(uint16_t port_id, uint16_t queue_id, ++ uint16_t offset, uint16_t num, FILE *file); ++ ++/** ++ * @warning ++ * @b EXPERIMENTAL: this API may change, or be removed, without prior notice ++ * ++ * Dump ethdev Tx descriptor info to a file. ++ * ++ * This API is used for debugging, not a dataplane API. ++ * ++ * @param port_id ++ * The port identifier of the Ethernet device. ++ * @param queue_id ++ * A Tx queue identifier on this port. ++ * @param offset ++ * The offset of the descriptor starting from tail. (0 is the place where ++ * the next packet will be send). ++ * @param num ++ * The number of the descriptors to dump. ++ * @param file ++ * A pointer to a file for output. ++ * @return ++ * - On success, zero. ++ * - On failure, a negative value. ++ */ ++__rte_experimental ++int rte_eth_tx_descriptor_dump(uint16_t port_id, uint16_t queue_id, ++ uint16_t offset, uint16_t num, FILE *file); ++ ++ + #include + + /** +diff --git a/lib/ethdev/version.map b/lib/ethdev/version.map +index f29c60eda4..09dba86bee 100644 +--- a/lib/ethdev/version.map ++++ b/lib/ethdev/version.map +@@ -259,6 +259,10 @@ EXPERIMENTAL { + + # added in 22.03 + rte_eth_dev_priv_dump; ++ ++ # added in 22.11 ++ rte_eth_rx_descriptor_dump; ++ rte_eth_tx_descriptor_dump; + }; + + INTERNAL { +-- +2.23.0 + diff --git a/0164-net-hns3-fix-ordering-in-secondary-process-initializ.patch b/0164-net-hns3-fix-ordering-in-secondary-process-initializ.patch deleted file mode 100644 index 44e1183d7a4f81839434bc288287df5721fb972c..0000000000000000000000000000000000000000 --- a/0164-net-hns3-fix-ordering-in-secondary-process-initializ.patch +++ /dev/null @@ -1,36 +0,0 @@ -From 0bfe64c5063855fb27785c2f73e98cc8f2893e0b Mon Sep 17 00:00:00 2001 -From: Chengwen Feng -Date: Mon, 10 May 2021 21:38:12 +0800 -Subject: [PATCH 164/189] net/hns3: fix ordering in secondary process - initialization - -The memory barrier is used to ensure that the response is returned -only after the Tx/Rx function is set, it should place after the Rx/Tx -function is set. - -Fixes: 23d4b61fee5d ("net/hns3: support multiple process") -Cc: stable@dpdk.org - -Signed-off-by: Chengwen Feng -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_mp.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/drivers/net/hns3/hns3_mp.c b/drivers/net/hns3/hns3_mp.c -index 7d85de3..b5cd5b0 100644 ---- a/drivers/net/hns3/hns3_mp.c -+++ b/drivers/net/hns3/hns3_mp.c -@@ -86,8 +86,8 @@ mp_secondary_handle(const struct rte_mp_msg *mp_msg, const void *peer) - case HNS3_MP_REQ_START_RXTX: - PMD_INIT_LOG(INFO, "port %u starting datapath", - dev->data->port_id); -- rte_mb(); - hns3_set_rxtx_function(dev); -+ rte_mb(); - mp_init_msg(dev, &mp_res, param->type); - res->result = 0; - ret = rte_mp_reply(&mp_res, peer); --- -2.7.4 - diff --git a/0165-net-hns3-fail-setting-FEC-if-one-bit-mode-is-not-sup.patch b/0165-net-hns3-fail-setting-FEC-if-one-bit-mode-is-not-sup.patch deleted file mode 100644 index 09b3d96811715d3007f407459fcd0b85fa7b99da..0000000000000000000000000000000000000000 --- a/0165-net-hns3-fail-setting-FEC-if-one-bit-mode-is-not-sup.patch +++ /dev/null @@ -1,40 +0,0 @@ -From 6c80dd7d227149ba1e2a06be8a87a2295e5b2e5f Mon Sep 17 00:00:00 2001 -From: Chengwen Feng -Date: Mon, 10 May 2021 21:38:13 +0800 -Subject: [PATCH 165/189] net/hns3: fail setting FEC if one bit mode is not - supported - -If the FEC mode was not supported, it should return error code. - -This patch also adds a space when log error info. - -Fixes: 9bf2ea8dbc65 ("net/hns3: support FEC") -Cc: stable@dpdk.org - -Signed-off-by: Chengwen Feng -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_ethdev.c | 6 ++++-- - 1 file changed, 4 insertions(+), 2 deletions(-) - -diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c -index 44e6c5b..7ecd15b 100644 ---- a/drivers/net/hns3/hns3_ethdev.c -+++ b/drivers/net/hns3/hns3_ethdev.c -@@ -6988,9 +6988,11 @@ hns3_fec_set(struct rte_eth_dev *dev, uint32_t mode) - return ret; - - /* HNS3 PMD driver only support one bit set mode, e.g. 0x1, 0x4 */ -- if (!is_fec_mode_one_bit_set(mode)) -- hns3_err(hw, "FEC mode(0x%x) not supported in HNS3 PMD," -+ if (!is_fec_mode_one_bit_set(mode)) { -+ hns3_err(hw, "FEC mode(0x%x) not supported in HNS3 PMD, " - "FEC mode should be only one bit set", mode); -+ return -EINVAL; -+ } - - /* - * Check whether the configured mode is within the FEC capability. --- -2.7.4 - diff --git a/0165-net-hns3-support-Rx-Tx-descriptor-dump.patch b/0165-net-hns3-support-Rx-Tx-descriptor-dump.patch new file mode 100644 index 0000000000000000000000000000000000000000..a2fbe3ba412a374b5765d3e43b44b1e78d9e6c99 --- /dev/null +++ b/0165-net-hns3-support-Rx-Tx-descriptor-dump.patch @@ -0,0 +1,164 @@ +From 450591abedaabee32a21d53a50cb5b65440ce971 Mon Sep 17 00:00:00 2001 +From: "Min Hu (Connor)" +Date: Fri, 21 Oct 2022 15:36:41 +0800 +Subject: [PATCH 165/189] net/hns3: support Rx/Tx descriptor dump + +This patch support query HW descriptor from hns3 device. HW descriptor +is also called BD (buffer description) which is shared memory between +software and hardware. + +Signed-off-by: Min Hu (Connor) +Signed-off-by: Dongdong Liu +Acked-by: Ferruh Yigit +--- + drivers/net/hns3/hns3_dump.c | 88 +++++++++++++++++++++++++++++++ + drivers/net/hns3/hns3_dump.h | 4 ++ + drivers/net/hns3/hns3_ethdev.c | 2 + + drivers/net/hns3/hns3_ethdev_vf.c | 2 + + 4 files changed, 96 insertions(+) + +diff --git a/drivers/net/hns3/hns3_dump.c b/drivers/net/hns3/hns3_dump.c +index cf5b500be1..1007b09bd2 100644 +--- a/drivers/net/hns3/hns3_dump.c ++++ b/drivers/net/hns3/hns3_dump.c +@@ -11,6 +11,9 @@ + #include "hns3_logs.h" + #include "hns3_dump.h" + ++#define HNS3_BD_DW_NUM 8 ++#define HNS3_BD_ADDRESS_LAST_DW 2 ++ + static const char * + hns3_get_adapter_state_name(enum hns3_adapter_state state) + { +@@ -873,3 +876,88 @@ hns3_eth_dev_priv_dump(struct rte_eth_dev *dev, FILE *file) + + return 0; + } ++ ++int ++hns3_rx_descriptor_dump(const struct rte_eth_dev *dev, uint16_t queue_id, ++ uint16_t offset, uint16_t num, FILE *file) ++{ ++ struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private); ++ struct hns3_rx_queue *rxq = dev->data->rx_queues[queue_id]; ++ uint32_t *bd_data; ++ uint16_t count = 0; ++ uint16_t desc_id; ++ int i; ++ ++ if (offset >= rxq->nb_rx_desc) ++ return -EINVAL; ++ ++ if (num > rxq->nb_rx_desc) { ++ hns3_err(hw, "Invalid BD num=%u\n", num); ++ return -EINVAL; ++ } ++ ++ while (count < num) { ++ desc_id = (rxq->next_to_use + offset + count) % rxq->nb_rx_desc; ++ bd_data = (uint32_t *)(&rxq->rx_ring[desc_id]); ++ fprintf(file, "Rx queue id:%u BD id:%u\n", queue_id, desc_id); ++ for (i = 0; i < HNS3_BD_DW_NUM; i++) { ++ /* ++ * For the sake of security, first 8 bytes of BD which ++ * stands for physical address of packet should not be ++ * shown. ++ */ ++ if (i < HNS3_BD_ADDRESS_LAST_DW) { ++ fprintf(file, "RX BD WORD[%d]:0x%08x\n", i, 0); ++ continue; ++ } ++ fprintf(file, "RX BD WORD[%d]:0x%08x\n", i, ++ *(bd_data + i)); ++ } ++ count++; ++ } ++ ++ return 0; ++} ++ ++int ++hns3_tx_descriptor_dump(const struct rte_eth_dev *dev, uint16_t queue_id, ++ uint16_t offset, uint16_t num, FILE *file) ++{ ++ struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private); ++ struct hns3_tx_queue *txq = dev->data->tx_queues[queue_id]; ++ uint32_t *bd_data; ++ uint16_t count = 0; ++ uint16_t desc_id; ++ int i; ++ ++ if (offset >= txq->nb_tx_desc) ++ return -EINVAL; ++ ++ if (num > txq->nb_tx_desc) { ++ hns3_err(hw, "Invalid BD num=%u\n", num); ++ return -EINVAL; ++ } ++ ++ while (count < num) { ++ desc_id = (txq->next_to_use + offset + count) % txq->nb_tx_desc; ++ bd_data = (uint32_t *)(&txq->tx_ring[desc_id]); ++ fprintf(file, "Tx queue id:%u BD id:%u\n", queue_id, desc_id); ++ for (i = 0; i < HNS3_BD_DW_NUM; i++) { ++ /* ++ * For the sake of security, first 8 bytes of BD which ++ * stands for physical address of packet should not be ++ * shown. ++ */ ++ if (i < HNS3_BD_ADDRESS_LAST_DW) { ++ fprintf(file, "TX BD WORD[%d]:0x%08x\n", i, 0); ++ continue; ++ } ++ ++ fprintf(file, "Tx BD WORD[%d]:0x%08x\n", i, ++ *(bd_data + i)); ++ } ++ count++; ++ } ++ ++ return 0; ++} +diff --git a/drivers/net/hns3/hns3_dump.h b/drivers/net/hns3/hns3_dump.h +index 616cb70d6e..021ce1bbdb 100644 +--- a/drivers/net/hns3/hns3_dump.h ++++ b/drivers/net/hns3/hns3_dump.h +@@ -7,4 +7,8 @@ + + int hns3_eth_dev_priv_dump(struct rte_eth_dev *dev, FILE *file); + ++int hns3_rx_descriptor_dump(const struct rte_eth_dev *dev, uint16_t queue_id, ++ uint16_t offset, uint16_t num, FILE *file); ++int hns3_tx_descriptor_dump(const struct rte_eth_dev *dev, uint16_t queue_id, ++ uint16_t offset, uint16_t num, FILE *file); + #endif /* HNS3_DUMP_H */ +diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c +index 7330515535..f83cff4d98 100644 +--- a/drivers/net/hns3/hns3_ethdev.c ++++ b/drivers/net/hns3/hns3_ethdev.c +@@ -6558,6 +6558,8 @@ static const struct eth_dev_ops hns3_eth_dev_ops = { + .timesync_read_time = hns3_timesync_read_time, + .timesync_write_time = hns3_timesync_write_time, + .eth_dev_priv_dump = hns3_eth_dev_priv_dump, ++ .eth_rx_descriptor_dump = hns3_rx_descriptor_dump, ++ .eth_tx_descriptor_dump = hns3_tx_descriptor_dump, + }; + + static const struct hns3_reset_ops hns3_reset_ops = { +diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c +index 6976a9f23d..1022b02697 100644 +--- a/drivers/net/hns3/hns3_ethdev_vf.c ++++ b/drivers/net/hns3/hns3_ethdev_vf.c +@@ -2302,6 +2302,8 @@ static const struct eth_dev_ops hns3vf_eth_dev_ops = { + .dev_supported_ptypes_get = hns3_dev_supported_ptypes_get, + .tx_done_cleanup = hns3_tx_done_cleanup, + .eth_dev_priv_dump = hns3_eth_dev_priv_dump, ++ .eth_rx_descriptor_dump = hns3_rx_descriptor_dump, ++ .eth_tx_descriptor_dump = hns3_tx_descriptor_dump, + }; + + static const struct hns3_reset_ops hns3vf_reset_ops = { +-- +2.23.0 + diff --git a/0166-net-hns3-fix-Rx-Tx-queue-numbers-check.patch b/0166-net-hns3-fix-Rx-Tx-queue-numbers-check.patch deleted file mode 100644 index 63bbecb1a91965d450b1b93238b1b5c5e47cce88..0000000000000000000000000000000000000000 --- a/0166-net-hns3-fix-Rx-Tx-queue-numbers-check.patch +++ /dev/null @@ -1,68 +0,0 @@ -From cecc7bbcaf74f28a947f653069809bab67be42fe Mon Sep 17 00:00:00 2001 -From: Huisong Li -Date: Sat, 15 May 2021 08:52:33 +0800 -Subject: [PATCH 166/189] net/hns3: fix Rx/Tx queue numbers check - -The Rx/Tx queue numbers should be greater than TC number, this patch adds -this check for PF before updating the mapping between TC and queue. - -Fixes: a951c1ed3ab5 ("net/hns3: support different numbers of Rx and Tx queues") -Fixes: 76d794566d43 ("net/hns3: maximize queue number") -Cc: stable@dpdk.org - -Signed-off-by: Huisong Li -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_dcb.c | 12 ++++++++++++ - drivers/net/hns3/hns3_ethdev_vf.c | 12 ------------ - 2 files changed, 12 insertions(+), 12 deletions(-) - -diff --git a/drivers/net/hns3/hns3_dcb.c b/drivers/net/hns3/hns3_dcb.c -index 49b8be7..f44e2f0 100644 ---- a/drivers/net/hns3/hns3_dcb.c -+++ b/drivers/net/hns3/hns3_dcb.c -@@ -727,6 +727,18 @@ hns3_queue_to_tc_mapping(struct hns3_hw *hw, uint16_t nb_rx_q, uint16_t nb_tx_q) - { - int ret; - -+ if (nb_rx_q < hw->num_tc) { -+ hns3_err(hw, "number of Rx queues(%u) is less than number of TC(%u).", -+ nb_rx_q, hw->num_tc); -+ return -EINVAL; -+ } -+ -+ if (nb_tx_q < hw->num_tc) { -+ hns3_err(hw, "number of Tx queues(%u) is less than number of TC(%u).", -+ nb_tx_q, hw->num_tc); -+ return -EINVAL; -+ } -+ - ret = hns3_set_rss_size(hw, nb_rx_q); - if (ret) - return ret; -diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c -index dbd823f..7f7da18 100644 ---- a/drivers/net/hns3/hns3_ethdev_vf.c -+++ b/drivers/net/hns3/hns3_ethdev_vf.c -@@ -1498,18 +1498,6 @@ hns3vf_set_tc_queue_mapping(struct hns3_adapter *hns, uint16_t nb_rx_q, - { - struct hns3_hw *hw = &hns->hw; - -- if (nb_rx_q < hw->num_tc) { -- hns3_err(hw, "number of Rx queues(%u) is less than tcs(%u).", -- nb_rx_q, hw->num_tc); -- return -EINVAL; -- } -- -- if (nb_tx_q < hw->num_tc) { -- hns3_err(hw, "number of Tx queues(%u) is less than tcs(%u).", -- nb_tx_q, hw->num_tc); -- return -EINVAL; -- } -- - return hns3_queue_to_tc_mapping(hw, nb_rx_q, nb_tx_q); - } - --- -2.7.4 - diff --git a/0166-remove-unnecessary-null-checks.patch b/0166-remove-unnecessary-null-checks.patch new file mode 100644 index 0000000000000000000000000000000000000000..9ffc90388fb1fa0aee859537dc567c55614b57a5 --- /dev/null +++ b/0166-remove-unnecessary-null-checks.patch @@ -0,0 +1,50 @@ +From ea171dea8f8417fe0715620a3de77e0cf3054916 Mon Sep 17 00:00:00 2001 +From: Stephen Hemminger +Date: Fri, 21 Oct 2022 15:36:42 +0800 +Subject: [PATCH 166/189] remove unnecessary null checks + +Functions like free, rte_free, and rte_mempool_free +already handle NULL pointer so the checks here are not necessary. + +Remove redundant NULL pointer checks before free functions +found by nullfree.cocci + +Note: This patch only captures some hns3 modification from the +following patch: +Fixes: 06c047b68061 ("remove unnecessary null checks") + +Signed-off-by: Stephen Hemminger +--- + drivers/net/hns3/hns3_rxtx.c | 9 +++------ + 1 file changed, 3 insertions(+), 6 deletions(-) + +diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c +index 8ad40a49c7..29caaeafbd 100644 +--- a/drivers/net/hns3/hns3_rxtx.c ++++ b/drivers/net/hns3/hns3_rxtx.c +@@ -86,8 +86,7 @@ hns3_rx_queue_release(void *queue) + hns3_rx_queue_release_mbufs(rxq); + if (rxq->mz) + rte_memzone_free(rxq->mz); +- if (rxq->sw_ring) +- rte_free(rxq->sw_ring); ++ rte_free(rxq->sw_ring); + rte_free(rxq); + } + } +@@ -100,10 +99,8 @@ hns3_tx_queue_release(void *queue) + hns3_tx_queue_release_mbufs(txq); + if (txq->mz) + rte_memzone_free(txq->mz); +- if (txq->sw_ring) +- rte_free(txq->sw_ring); +- if (txq->free) +- rte_free(txq->free); ++ rte_free(txq->sw_ring); ++ rte_free(txq->free); + rte_free(txq); + } + } +-- +2.23.0 + diff --git a/0167-ethdev-introduce-generic-dummy-packet-burst-function.patch b/0167-ethdev-introduce-generic-dummy-packet-burst-function.patch new file mode 100644 index 0000000000000000000000000000000000000000..ffcd0a79eb880e570ffd32ae268544dd802239d4 --- /dev/null +++ b/0167-ethdev-introduce-generic-dummy-packet-burst-function.patch @@ -0,0 +1,175 @@ +From 93df9193174fc6190ec793a0fdfc7bf2ee105669 Mon Sep 17 00:00:00 2001 +From: Ferruh Yigit +Date: Fri, 21 Oct 2022 15:36:43 +0800 +Subject: [PATCH 167/189] ethdev: introduce generic dummy packet burst function +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Multiple PMDs have dummy/noop Rx/Tx packet burst functions. +These dummy functions are very simple, introduce a common function in +the ethdev and update drivers to use it instead of each driver having +its own functions. + +Note: +Note: This patch only captures some hns3 modification from the +following patch: +Fixes: a41f593f1bce ("ethdev: introduce generic dummy packet burst function") + +Signed-off-by: Ferruh Yigit +Acked-by: Morten Brørup +Acked-by: Viacheslav Ovsiienko +Acked-by: Thomas Monjalon +--- + drivers/net/hns3/hns3_rxtx.c | 18 +++++------------- + drivers/net/hns3/hns3_rxtx.h | 3 --- + lib/ethdev/ethdev_driver.c | 13 +++++++++++++ + lib/ethdev/ethdev_driver.h | 17 +++++++++++++++++ + lib/ethdev/meson.build | 1 + + lib/ethdev/version.map | 1 + + 6 files changed, 37 insertions(+), 16 deletions(-) + create mode 100644 lib/ethdev/ethdev_driver.c + +diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c +index 29caaeafbd..3c02fd54e1 100644 +--- a/drivers/net/hns3/hns3_rxtx.c ++++ b/drivers/net/hns3/hns3_rxtx.c +@@ -4365,14 +4365,6 @@ hns3_get_tx_function(struct rte_eth_dev *dev, eth_tx_prep_t *prep) + return hns3_xmit_pkts; + } + +-uint16_t +-hns3_dummy_rxtx_burst(void *dpdk_txq __rte_unused, +- struct rte_mbuf **pkts __rte_unused, +- uint16_t pkts_n __rte_unused) +-{ +- return 0; +-} +- + static void + hns3_trace_rxtx_function(struct rte_eth_dev *dev) + { +@@ -4416,14 +4408,14 @@ hns3_set_rxtx_function(struct rte_eth_dev *eth_dev) + eth_dev->rx_pkt_burst = hns3_get_rx_function(eth_dev); + eth_dev->rx_descriptor_status = hns3_dev_rx_descriptor_status; + eth_dev->tx_pkt_burst = hw->set_link_down ? +- hns3_dummy_rxtx_burst : ++ rte_eth_pkt_burst_dummy : + hns3_get_tx_function(eth_dev, &prep); + eth_dev->tx_pkt_prepare = prep; + eth_dev->tx_descriptor_status = hns3_dev_tx_descriptor_status; + hns3_trace_rxtx_function(eth_dev); + } else { +- eth_dev->rx_pkt_burst = hns3_dummy_rxtx_burst; +- eth_dev->tx_pkt_burst = hns3_dummy_rxtx_burst; ++ eth_dev->rx_pkt_burst = rte_eth_pkt_burst_dummy; ++ eth_dev->tx_pkt_burst = rte_eth_pkt_burst_dummy; + eth_dev->tx_pkt_prepare = NULL; + } + +@@ -4637,7 +4629,7 @@ hns3_tx_done_cleanup(void *txq, uint32_t free_cnt) + + if (dev->tx_pkt_burst == hns3_xmit_pkts) + return hns3_tx_done_cleanup_full(q, free_cnt); +- else if (dev->tx_pkt_burst == hns3_dummy_rxtx_burst) ++ else if (dev->tx_pkt_burst == rte_eth_pkt_burst_dummy) + return 0; + else + return -ENOTSUP; +@@ -4747,7 +4739,7 @@ hns3_enable_rxd_adv_layout(struct hns3_hw *hw) + void + hns3_stop_tx_datapath(struct rte_eth_dev *dev) + { +- dev->tx_pkt_burst = hns3_dummy_rxtx_burst; ++ dev->tx_pkt_burst = rte_eth_pkt_burst_dummy; + dev->tx_pkt_prepare = NULL; + hns3_eth_dev_fp_ops_config(dev); + +diff --git a/drivers/net/hns3/hns3_rxtx.h b/drivers/net/hns3/hns3_rxtx.h +index ed40621b3a..e633b336b1 100644 +--- a/drivers/net/hns3/hns3_rxtx.h ++++ b/drivers/net/hns3/hns3_rxtx.h +@@ -742,9 +742,6 @@ void hns3_init_rx_ptype_tble(struct rte_eth_dev *dev); + void hns3_set_rxtx_function(struct rte_eth_dev *eth_dev); + eth_tx_burst_t hns3_get_tx_function(struct rte_eth_dev *dev, + eth_tx_prep_t *prep); +-uint16_t hns3_dummy_rxtx_burst(void *dpdk_txq __rte_unused, +- struct rte_mbuf **pkts __rte_unused, +- uint16_t pkts_n __rte_unused); + + uint32_t hns3_get_tqp_intr_reg_offset(uint16_t tqp_intr_id); + void hns3_set_queue_intr_gl(struct hns3_hw *hw, uint16_t queue_id, +diff --git a/lib/ethdev/ethdev_driver.c b/lib/ethdev/ethdev_driver.c +new file mode 100644 +index 0000000000..fb7323f4d3 +--- /dev/null ++++ b/lib/ethdev/ethdev_driver.c +@@ -0,0 +1,13 @@ ++/* SPDX-License-Identifier: BSD-3-Clause ++ * Copyright(c) 2022 Intel Corporation ++ */ ++ ++#include "ethdev_driver.h" ++ ++uint16_t ++rte_eth_pkt_burst_dummy(void *queue __rte_unused, ++ struct rte_mbuf **pkts __rte_unused, ++ uint16_t nb_pkts __rte_unused) ++{ ++ return 0; ++} +diff --git a/lib/ethdev/ethdev_driver.h b/lib/ethdev/ethdev_driver.h +index 41f67f2740..d3de203d7a 100644 +--- a/lib/ethdev/ethdev_driver.h ++++ b/lib/ethdev/ethdev_driver.h +@@ -1497,6 +1497,23 @@ rte_eth_linkstatus_get(const struct rte_eth_dev *dev, + *dst = __atomic_load_n(src, __ATOMIC_SEQ_CST); + } + ++/** ++ * @internal ++ * Dummy DPDK callback for Rx/Tx packet burst. ++ * ++ * @param queue ++ * Pointer to Rx/Tx queue ++ * @param pkts ++ * Packet array ++ * @param nb_pkts ++ * Number of packets in packet array ++ */ ++__rte_internal ++uint16_t ++rte_eth_pkt_burst_dummy(void *queue __rte_unused, ++ struct rte_mbuf **pkts __rte_unused, ++ uint16_t nb_pkts __rte_unused); ++ + /** + * Allocate an unique switch domain identifier. + * +diff --git a/lib/ethdev/meson.build b/lib/ethdev/meson.build +index 0205c853df..a094585bf7 100644 +--- a/lib/ethdev/meson.build ++++ b/lib/ethdev/meson.build +@@ -2,6 +2,7 @@ + # Copyright(c) 2017 Intel Corporation + + sources = files( ++ 'ethdev_driver.c', + 'ethdev_private.c', + 'ethdev_profile.c', + 'ethdev_trace_points.c', +diff --git a/lib/ethdev/version.map b/lib/ethdev/version.map +index 09dba86bee..590aa5a0a6 100644 +--- a/lib/ethdev/version.map ++++ b/lib/ethdev/version.map +@@ -286,6 +286,7 @@ INTERNAL { + rte_eth_hairpin_queue_peer_bind; + rte_eth_hairpin_queue_peer_unbind; + rte_eth_hairpin_queue_peer_update; ++ rte_eth_pkt_burst_dummy; + rte_eth_representor_id_get; + rte_eth_switch_domain_alloc; + rte_eth_switch_domain_free; +-- +2.23.0 + diff --git a/0167-net-hns3-fix-requested-FC-mode-rollback.patch b/0167-net-hns3-fix-requested-FC-mode-rollback.patch deleted file mode 100644 index 9614aff45249a65984bcbe7208b96d5a681b2c23..0000000000000000000000000000000000000000 --- a/0167-net-hns3-fix-requested-FC-mode-rollback.patch +++ /dev/null @@ -1,157 +0,0 @@ -From ce08c5f9d37133ef2e984acb46d0fdf49fed9128 Mon Sep 17 00:00:00 2001 -From: Huisong Li -Date: Sat, 15 May 2021 08:52:34 +0800 -Subject: [PATCH 167/189] net/hns3: fix requested FC mode rollback - -Currently, the "requested_fc_mode" lacks rollback when enabling link -FC or PFC fails. -For example, this may result an incorrect FC mode after a reset. - -Fixes: d4fdb71a0e7b ("net/hns3: fix flow control mode") -Fixes: 62e3ccc2b94c ("net/hns3: support flow control") -Cc: stable@dpdk.org - -Signed-off-by: Huisong Li -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_dcb.c | 30 ++++++++++++++++++++++++++++++ - drivers/net/hns3/hns3_ethdev.c | 28 ---------------------------- - 2 files changed, 30 insertions(+), 28 deletions(-) - -diff --git a/drivers/net/hns3/hns3_dcb.c b/drivers/net/hns3/hns3_dcb.c -index f44e2f0..3efc2cd 100644 ---- a/drivers/net/hns3/hns3_dcb.c -+++ b/drivers/net/hns3/hns3_dcb.c -@@ -1760,6 +1760,30 @@ hns3_dcb_cfg_update(struct hns3_adapter *hns) - return ret; - } - -+static void -+hns3_get_fc_mode(struct hns3_hw *hw, enum rte_eth_fc_mode mode) -+{ -+ switch (mode) { -+ case RTE_FC_NONE: -+ hw->requested_fc_mode = HNS3_FC_NONE; -+ break; -+ case RTE_FC_RX_PAUSE: -+ hw->requested_fc_mode = HNS3_FC_RX_PAUSE; -+ break; -+ case RTE_FC_TX_PAUSE: -+ hw->requested_fc_mode = HNS3_FC_TX_PAUSE; -+ break; -+ case RTE_FC_FULL: -+ hw->requested_fc_mode = HNS3_FC_FULL; -+ break; -+ default: -+ hw->requested_fc_mode = HNS3_FC_NONE; -+ hns3_warn(hw, "fc_mode(%u) exceeds member scope and is " -+ "configured to RTE_FC_NONE", mode); -+ break; -+ } -+} -+ - /* - * hns3_dcb_pfc_enable - Enable priority flow control - * @dev: pointer to ethernet device -@@ -1772,6 +1796,7 @@ hns3_dcb_pfc_enable(struct rte_eth_dev *dev, struct rte_eth_pfc_conf *pfc_conf) - struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private); - struct hns3_pf *pf = HNS3_DEV_PRIVATE_TO_PF(dev->data->dev_private); - enum hns3_fc_status fc_status = hw->current_fc_status; -+ enum hns3_fc_mode old_fc_mode = hw->requested_fc_mode; - uint8_t hw_pfc_map = hw->dcb_info.hw_pfc_map; - uint8_t pfc_en = hw->dcb_info.pfc_en; - uint8_t priority = pfc_conf->priority; -@@ -1779,6 +1804,7 @@ hns3_dcb_pfc_enable(struct rte_eth_dev *dev, struct rte_eth_pfc_conf *pfc_conf) - int ret, status; - - pf->pause_time = pfc_conf->fc.pause_time; -+ hns3_get_fc_mode(hw, pfc_conf->fc.mode); - hw->current_fc_status = HNS3_FC_STATUS_PFC; - hw->dcb_info.pfc_en |= BIT(priority); - hw->dcb_info.hw_pfc_map = -@@ -1800,6 +1826,7 @@ hns3_dcb_pfc_enable(struct rte_eth_dev *dev, struct rte_eth_pfc_conf *pfc_conf) - return 0; - - pfc_setup_fail: -+ hw->requested_fc_mode = old_fc_mode; - hw->current_fc_status = fc_status; - pf->pause_time = pause_time; - hw->dcb_info.pfc_en = pfc_en; -@@ -1822,11 +1849,13 @@ hns3_fc_enable(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf) - { - struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private); - struct hns3_pf *pf = HNS3_DEV_PRIVATE_TO_PF(dev->data->dev_private); -+ enum hns3_fc_mode old_fc_mode = hw->requested_fc_mode; - enum hns3_fc_status fc_status = hw->current_fc_status; - uint16_t pause_time = pf->pause_time; - int ret; - - pf->pause_time = fc_conf->pause_time; -+ hns3_get_fc_mode(hw, fc_conf->mode); - - /* - * In fact, current_fc_status is HNS3_FC_STATUS_NONE when mode -@@ -1846,6 +1875,7 @@ hns3_fc_enable(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf) - return 0; - - setup_fc_fail: -+ hw->requested_fc_mode = old_fc_mode; - hw->current_fc_status = fc_status; - pf->pause_time = pause_time; - -diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c -index 7ecd15b..88b2cfd 100644 ---- a/drivers/net/hns3/hns3_ethdev.c -+++ b/drivers/net/hns3/hns3_ethdev.c -@@ -6056,30 +6056,6 @@ hns3_flow_ctrl_get(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf) - return 0; - } - --static void --hns3_get_fc_mode(struct hns3_hw *hw, enum rte_eth_fc_mode mode) --{ -- switch (mode) { -- case RTE_FC_NONE: -- hw->requested_fc_mode = HNS3_FC_NONE; -- break; -- case RTE_FC_RX_PAUSE: -- hw->requested_fc_mode = HNS3_FC_RX_PAUSE; -- break; -- case RTE_FC_TX_PAUSE: -- hw->requested_fc_mode = HNS3_FC_TX_PAUSE; -- break; -- case RTE_FC_FULL: -- hw->requested_fc_mode = HNS3_FC_FULL; -- break; -- default: -- hw->requested_fc_mode = HNS3_FC_NONE; -- hns3_warn(hw, "fc_mode(%u) exceeds member scope and is " -- "configured to RTE_FC_NONE", mode); -- break; -- } --} -- - static int - hns3_check_fc_autoneg_valid(struct hns3_hw *hw, uint8_t autoneg) - { -@@ -6153,8 +6129,6 @@ hns3_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf) - return -EOPNOTSUPP; - } - -- hns3_get_fc_mode(hw, fc_conf->mode); -- - rte_spinlock_lock(&hw->lock); - ret = hns3_fc_enable(dev, fc_conf); - rte_spinlock_unlock(&hw->lock); -@@ -6201,8 +6175,6 @@ hns3_priority_flow_ctrl_set(struct rte_eth_dev *dev, - return -EOPNOTSUPP; - } - -- hns3_get_fc_mode(hw, pfc_conf->fc.mode); -- - rte_spinlock_lock(&hw->lock); - ret = hns3_dcb_pfc_enable(dev, pfc_conf); - rte_spinlock_unlock(&hw->lock); --- -2.7.4 - diff --git a/0168-fix-spelling-in-comments-and-strings.patch b/0168-fix-spelling-in-comments-and-strings.patch new file mode 100644 index 0000000000000000000000000000000000000000..96827ab36a37df2719c507c0fae2dbea253f12c4 --- /dev/null +++ b/0168-fix-spelling-in-comments-and-strings.patch @@ -0,0 +1,9689 @@ +From bf14a018352f534ffdd3586745f362e4a2deb772 Mon Sep 17 00:00:00 2001 +From: Josh Soref +Date: Fri, 21 Oct 2022 15:36:44 +0800 +Subject: [PATCH 168/189] fix spelling in comments and strings + +The tool comes from https://github.com/jsoref + +Signed-off-by: Josh Soref +Signed-off-by: Thomas Monjalon +--- + app/proc-info/main.c | 6 +-- + app/test-acl/main.c | 6 +-- + .../comp_perf_test_cyclecount.c | 2 +- + .../comp_perf_test_throughput.c | 2 +- + .../comp_perf_test_verify.c | 2 +- + app/test-compress-perf/main.c | 2 +- + .../cperf_test_pmd_cyclecount.c | 2 +- + app/test-eventdev/evt_options.c | 2 +- + app/test-eventdev/test_order_common.c | 2 +- + app/test-fib/main.c | 4 +- + app/test-flow-perf/config.h | 2 +- + app/test-flow-perf/main.c | 2 +- + app/test-pmd/cmdline.c | 2 +- + app/test-pmd/cmdline_flow.c | 6 +-- + app/test-pmd/cmdline_tm.c | 4 +- + app/test-pmd/csumonly.c | 2 +- + app/test-pmd/parameters.c | 2 +- + app/test-pmd/testpmd.c | 2 +- + app/test-pmd/txonly.c | 4 +- + app/test/test_barrier.c | 2 +- + app/test/test_bpf.c | 4 +- + app/test/test_compressdev.c | 2 +- + app/test/test_cryptodev.c | 2 +- + app/test/test_fib_perf.c | 2 +- + app/test/test_kni.c | 4 +- + app/test/test_kvargs.c | 16 ++++---- + app/test/test_lpm6_data.h | 2 +- + app/test/test_member.c | 2 +- + app/test/test_mempool.c | 4 +- + app/test/test_memzone.c | 6 +-- + app/test/test_metrics.c | 2 +- + app/test/test_pcapng.c | 2 +- + app/test/test_power_cpufreq.c | 2 +- + app/test/test_rcu_qsbr.c | 4 +- + app/test/test_red.c | 8 ++-- + app/test/test_security.c | 2 +- + app/test/test_table_pipeline.c | 2 +- + app/test/test_thash.c | 2 +- + buildtools/binutils-avx512-check.py | 2 +- + devtools/check-symbol-change.sh | 6 +-- + .../virtio_user_for_container_networking.svg | 2 +- + doc/guides/nics/af_packet.rst | 2 +- + doc/guides/nics/mlx4.rst | 2 +- + doc/guides/nics/mlx5.rst | 6 +-- + doc/guides/prog_guide/cryptodev_lib.rst | 2 +- + .../prog_guide/env_abstraction_layer.rst | 4 +- + doc/guides/prog_guide/img/turbo_tb_decode.svg | 2 +- + doc/guides/prog_guide/img/turbo_tb_encode.svg | 2 +- + doc/guides/prog_guide/qos_framework.rst | 6 +-- + doc/guides/prog_guide/rte_flow.rst | 2 +- + doc/guides/rawdevs/cnxk_bphy.rst | 2 +- + doc/guides/regexdevs/features_overview.rst | 2 +- + doc/guides/rel_notes/release_16_07.rst | 2 +- + doc/guides/rel_notes/release_17_08.rst | 2 +- + doc/guides/rel_notes/release_2_1.rst | 2 +- + doc/guides/sample_app_ug/ip_reassembly.rst | 4 +- + doc/guides/sample_app_ug/l2_forward_cat.rst | 2 +- + doc/guides/sample_app_ug/server_node_efd.rst | 2 +- + doc/guides/sample_app_ug/skeleton.rst | 2 +- + .../sample_app_ug/vm_power_management.rst | 2 +- + doc/guides/testpmd_app_ug/testpmd_funcs.rst | 2 +- + drivers/baseband/fpga_lte_fec/fpga_lte_fec.c | 8 ++-- + drivers/baseband/null/bbdev_null.c | 2 +- + .../baseband/turbo_sw/bbdev_turbo_software.c | 2 +- + drivers/bus/dpaa/dpaa_bus.c | 2 +- + drivers/bus/dpaa/include/fsl_qman.h | 6 +-- + drivers/bus/dpaa/include/fsl_usd.h | 2 +- + drivers/bus/dpaa/include/process.h | 2 +- + drivers/bus/fslmc/fslmc_bus.c | 2 +- + drivers/bus/fslmc/portal/dpaa2_hw_dpio.c | 2 +- + drivers/bus/fslmc/portal/dpaa2_hw_pvt.h | 2 +- + .../fslmc/qbman/include/fsl_qbman_portal.h | 20 +++++----- + drivers/bus/pci/linux/pci_vfio.c | 2 +- + drivers/bus/vdev/rte_bus_vdev.h | 2 +- + drivers/bus/vmbus/vmbus_common.c | 2 +- + drivers/common/cnxk/roc_bphy_cgx.c | 2 +- + drivers/common/cnxk/roc_nix_bpf.c | 2 +- + drivers/common/cnxk/roc_nix_tm_ops.c | 2 +- + drivers/common/cnxk/roc_npc_mcam.c | 2 +- + drivers/common/cnxk/roc_npc_priv.h | 2 +- + drivers/common/cpt/cpt_ucode.h | 4 +- + drivers/common/cpt/cpt_ucode_asym.h | 2 +- + drivers/common/dpaax/caamflib/desc/algo.h | 2 +- + drivers/common/dpaax/caamflib/desc/sdap.h | 6 +-- + drivers/common/dpaax/dpaax_iova_table.c | 2 +- + drivers/common/iavf/iavf_type.h | 2 +- + drivers/common/iavf/virtchnl.h | 2 +- + drivers/common/mlx5/mlx5_common.c | 2 +- + drivers/common/mlx5/mlx5_common_mr.c | 2 +- + drivers/common/mlx5/mlx5_devx_cmds.c | 2 +- + drivers/common/mlx5/mlx5_malloc.c | 4 +- + drivers/common/mlx5/mlx5_malloc.h | 2 +- + drivers/common/mlx5/mlx5_prm.h | 2 +- + drivers/common/mlx5/windows/mlx5_common_os.c | 4 +- + drivers/common/mlx5/windows/mlx5_common_os.h | 2 +- + .../qat/qat_adf/adf_transport_access_macros.h | 2 +- + drivers/common/sfc_efx/efsys.h | 2 +- + drivers/compress/octeontx/include/zip_regs.h | 4 +- + drivers/compress/octeontx/otx_zip.h | 2 +- + drivers/compress/qat/qat_comp_pmd.c | 2 +- + drivers/crypto/bcmfs/bcmfs_device.h | 2 +- + drivers/crypto/bcmfs/bcmfs_qp.c | 2 +- + drivers/crypto/bcmfs/bcmfs_sym_defs.h | 6 +-- + drivers/crypto/bcmfs/bcmfs_sym_engine.h | 2 +- + drivers/crypto/bcmfs/hw/bcmfs5_rm.c | 2 +- + drivers/crypto/caam_jr/caam_jr_hw_specific.h | 4 +- + drivers/crypto/caam_jr/caam_jr_pvt.h | 4 +- + drivers/crypto/caam_jr/caam_jr_uio.c | 2 +- + drivers/crypto/ccp/ccp_crypto.c | 2 +- + drivers/crypto/ccp/ccp_crypto.h | 2 +- + drivers/crypto/ccp/ccp_dev.h | 2 +- + drivers/crypto/dpaa_sec/dpaa_sec.c | 2 +- + .../crypto/octeontx/otx_cryptodev_hw_access.c | 2 +- + drivers/crypto/octeontx/otx_cryptodev_mbox.h | 2 +- + drivers/crypto/octeontx/otx_cryptodev_ops.c | 2 +- + drivers/crypto/qat/qat_asym.c | 2 +- + drivers/crypto/qat/qat_sym.c | 2 +- + drivers/crypto/virtio/virtqueue.h | 2 +- + drivers/dma/skeleton/skeleton_dmadev.c | 2 +- + drivers/event/cnxk/cnxk_eventdev_selftest.c | 4 +- + drivers/event/dlb2/dlb2.c | 2 +- + drivers/event/dlb2/dlb2_priv.h | 2 +- + drivers/event/dlb2/dlb2_selftest.c | 2 +- + drivers/event/dlb2/rte_pmd_dlb2.h | 2 +- + drivers/event/dpaa2/dpaa2_eventdev_selftest.c | 2 +- + drivers/event/dsw/dsw_evdev.h | 4 +- + drivers/event/dsw/dsw_event.c | 4 +- + drivers/event/octeontx/ssovf_evdev.h | 2 +- + drivers/event/octeontx/ssovf_evdev_selftest.c | 2 +- + drivers/event/octeontx2/otx2_evdev_selftest.c | 2 +- + drivers/event/octeontx2/otx2_worker_dual.h | 2 +- + drivers/event/opdl/opdl_evdev.c | 2 +- + drivers/event/opdl/opdl_test.c | 2 +- + drivers/event/sw/sw_evdev.h | 2 +- + drivers/event/sw/sw_evdev_selftest.c | 2 +- + drivers/mempool/dpaa/dpaa_mempool.c | 2 +- + drivers/mempool/octeontx/octeontx_fpavf.c | 4 +- + drivers/net/ark/ark_global.h | 2 +- + drivers/net/atlantic/atl_ethdev.c | 2 +- + drivers/net/atlantic/atl_rxtx.c | 2 +- + drivers/net/atlantic/hw_atl/hw_atl_b0.c | 2 +- + drivers/net/axgbe/axgbe_dev.c | 2 +- + drivers/net/axgbe/axgbe_ethdev.c | 2 +- + drivers/net/axgbe/axgbe_ethdev.h | 2 +- + drivers/net/axgbe/axgbe_phy_impl.c | 4 +- + drivers/net/axgbe/axgbe_rxtx_vec_sse.c | 2 +- + drivers/net/bnx2x/bnx2x.c | 38 +++++++++---------- + drivers/net/bnx2x/bnx2x.h | 10 ++--- + drivers/net/bnx2x/bnx2x_stats.c | 2 +- + drivers/net/bnx2x/bnx2x_stats.h | 4 +- + drivers/net/bnx2x/bnx2x_vfpf.c | 2 +- + drivers/net/bnx2x/bnx2x_vfpf.h | 2 +- + drivers/net/bnx2x/ecore_fw_defs.h | 2 +- + drivers/net/bnx2x/ecore_hsi.h | 26 ++++++------- + drivers/net/bnx2x/ecore_init_ops.h | 6 +-- + drivers/net/bnx2x/ecore_reg.h | 28 +++++++------- + drivers/net/bnx2x/ecore_sp.c | 6 +-- + drivers/net/bnx2x/ecore_sp.h | 6 +-- + drivers/net/bnx2x/elink.c | 20 +++++----- + drivers/net/bnxt/bnxt_hwrm.c | 2 +- + drivers/net/bnxt/tf_core/tfp.c | 2 +- + drivers/net/bnxt/tf_core/tfp.h | 2 +- + drivers/net/bonding/eth_bond_8023ad_private.h | 2 +- + drivers/net/bonding/eth_bond_private.h | 2 +- + drivers/net/bonding/rte_eth_bond_8023ad.c | 20 +++++----- + drivers/net/bonding/rte_eth_bond_8023ad.h | 4 +- + drivers/net/bonding/rte_eth_bond_alb.h | 2 +- + drivers/net/bonding/rte_eth_bond_api.c | 4 +- + drivers/net/cnxk/cn10k_ethdev.h | 2 +- + drivers/net/cnxk/cn10k_tx.h | 6 +-- + drivers/net/cnxk/cn9k_tx.h | 6 +-- + drivers/net/cnxk/cnxk_ptp.c | 2 +- + drivers/net/cxgbe/cxgbe_flow.c | 2 +- + drivers/net/cxgbe/cxgbevf_main.c | 2 +- + drivers/net/cxgbe/sge.c | 8 ++-- + drivers/net/dpaa/dpaa_ethdev.c | 6 +-- + drivers/net/dpaa/dpaa_rxtx.c | 4 +- + drivers/net/dpaa/fmlib/fm_ext.h | 2 +- + drivers/net/dpaa/fmlib/fm_pcd_ext.h | 8 ++-- + drivers/net/dpaa/fmlib/fm_port_ext.h | 14 +++---- + drivers/net/dpaa2/dpaa2_ethdev.c | 14 +++---- + drivers/net/dpaa2/dpaa2_ethdev.h | 2 +- + drivers/net/dpaa2/dpaa2_flow.c | 8 ++-- + drivers/net/dpaa2/dpaa2_mux.c | 2 +- + drivers/net/dpaa2/dpaa2_rxtx.c | 6 +-- + drivers/net/dpaa2/mc/fsl_dpni.h | 10 ++--- + drivers/net/e1000/e1000_ethdev.h | 4 +- + drivers/net/e1000/em_ethdev.c | 10 ++--- + drivers/net/e1000/em_rxtx.c | 6 +-- + drivers/net/e1000/igb_ethdev.c | 18 ++++----- + drivers/net/e1000/igb_flow.c | 4 +- + drivers/net/e1000/igb_pf.c | 2 +- + drivers/net/e1000/igb_rxtx.c | 14 +++---- + drivers/net/ena/ena_ethdev.c | 2 +- + drivers/net/ena/ena_ethdev.h | 2 +- + drivers/net/enetfec/enet_regs.h | 2 +- + drivers/net/enic/enic_flow.c | 18 ++++----- + drivers/net/enic/enic_fm_flow.c | 10 ++--- + drivers/net/enic/enic_main.c | 2 +- + drivers/net/enic/enic_rxtx.c | 2 +- + drivers/net/fm10k/fm10k.h | 2 +- + drivers/net/fm10k/fm10k_ethdev.c | 12 +++--- + drivers/net/fm10k/fm10k_rxtx_vec.c | 10 ++--- + drivers/net/hinic/hinic_pmd_ethdev.c | 4 +- + drivers/net/hinic/hinic_pmd_ethdev.h | 2 +- + drivers/net/hinic/hinic_pmd_flow.c | 4 +- + drivers/net/hinic/hinic_pmd_tx.c | 2 +- + drivers/net/hns3/hns3_cmd.c | 4 +- + drivers/net/hns3/hns3_common.c | 2 +- + drivers/net/hns3/hns3_dcb.c | 10 ++--- + drivers/net/hns3/hns3_ethdev.c | 14 +++---- + drivers/net/hns3/hns3_ethdev.h | 8 ++-- + drivers/net/hns3/hns3_ethdev_vf.c | 4 +- + drivers/net/hns3/hns3_fdir.h | 2 +- + drivers/net/hns3/hns3_flow.c | 12 +++--- + drivers/net/hns3/hns3_mbx.c | 4 +- + drivers/net/hns3/hns3_mbx.h | 2 +- + drivers/net/hns3/hns3_rss.h | 2 +- + drivers/net/hns3/hns3_rxtx.c | 16 ++++---- + drivers/net/hns3/hns3_rxtx.h | 2 +- + drivers/net/hns3/hns3_stats.c | 2 +- + drivers/net/i40e/i40e_ethdev.c | 12 +++--- + drivers/net/i40e/i40e_ethdev.h | 10 ++--- + drivers/net/i40e/i40e_fdir.c | 10 ++--- + drivers/net/i40e/i40e_flow.c | 2 +- + drivers/net/i40e/i40e_pf.c | 4 +- + drivers/net/i40e/i40e_rxtx.c | 20 +++++----- + drivers/net/i40e/i40e_rxtx_vec_altivec.c | 2 +- + drivers/net/i40e/i40e_rxtx_vec_neon.c | 4 +- + drivers/net/i40e/i40e_rxtx_vec_sse.c | 6 +-- + drivers/net/i40e/rte_pmd_i40e.c | 2 +- + drivers/net/iavf/iavf_ethdev.c | 6 +-- + drivers/net/iavf/iavf_ipsec_crypto.c | 14 +++---- + drivers/net/iavf/iavf_ipsec_crypto.h | 2 +- + drivers/net/iavf/iavf_rxtx.c | 4 +- + drivers/net/iavf/iavf_rxtx_vec_sse.c | 4 +- + drivers/net/iavf/iavf_vchnl.c | 4 +- + drivers/net/ice/ice_dcf.c | 2 +- + drivers/net/ice/ice_dcf_ethdev.c | 2 +- + drivers/net/ice/ice_ethdev.c | 12 +++--- + drivers/net/ice/ice_rxtx.c | 10 ++--- + drivers/net/ice/ice_rxtx_vec_sse.c | 4 +- + drivers/net/igc/igc_filter.c | 2 +- + drivers/net/igc/igc_txrx.c | 4 +- + drivers/net/ionic/ionic_if.h | 6 +-- + drivers/net/ipn3ke/ipn3ke_ethdev.c | 2 +- + drivers/net/ipn3ke/ipn3ke_ethdev.h | 4 +- + drivers/net/ipn3ke/ipn3ke_flow.c | 2 +- + drivers/net/ipn3ke/ipn3ke_representor.c | 12 +++--- + drivers/net/ipn3ke/meson.build | 2 +- + drivers/net/ixgbe/ixgbe_bypass.c | 2 +- + drivers/net/ixgbe/ixgbe_bypass_api.h | 4 +- + drivers/net/ixgbe/ixgbe_ethdev.c | 18 ++++----- + drivers/net/ixgbe/ixgbe_ethdev.h | 2 +- + drivers/net/ixgbe/ixgbe_fdir.c | 2 +- + drivers/net/ixgbe/ixgbe_flow.c | 4 +- + drivers/net/ixgbe/ixgbe_ipsec.c | 2 +- + drivers/net/ixgbe/ixgbe_pf.c | 2 +- + drivers/net/ixgbe/ixgbe_rxtx.c | 10 ++--- + drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c | 2 +- + drivers/net/memif/memif_socket.c | 2 +- + drivers/net/memif/rte_eth_memif.c | 2 +- + drivers/net/mlx4/mlx4.h | 2 +- + drivers/net/mlx4/mlx4_ethdev.c | 2 +- + drivers/net/mlx5/linux/mlx5_os.c | 8 ++-- + drivers/net/mlx5/mlx5.c | 10 ++--- + drivers/net/mlx5/mlx5.h | 8 ++-- + drivers/net/mlx5/mlx5_flow.c | 20 +++++----- + drivers/net/mlx5/mlx5_flow.h | 6 +-- + drivers/net/mlx5/mlx5_flow_dv.c | 14 +++---- + drivers/net/mlx5/mlx5_flow_flex.c | 4 +- + drivers/net/mlx5/mlx5_flow_meter.c | 10 ++--- + drivers/net/mlx5/mlx5_rx.c | 2 +- + drivers/net/mlx5/mlx5_rxq.c | 4 +- + drivers/net/mlx5/mlx5_rxtx_vec_altivec.h | 2 +- + drivers/net/mlx5/mlx5_rxtx_vec_neon.h | 2 +- + drivers/net/mlx5/mlx5_rxtx_vec_sse.h | 2 +- + drivers/net/mlx5/mlx5_tx.c | 2 +- + drivers/net/mlx5/mlx5_utils.h | 2 +- + drivers/net/mlx5/windows/mlx5_flow_os.c | 2 +- + drivers/net/mlx5/windows/mlx5_os.c | 2 +- + drivers/net/mvneta/mvneta_ethdev.c | 2 +- + drivers/net/mvpp2/mrvl_ethdev.c | 2 +- + drivers/net/mvpp2/mrvl_qos.c | 4 +- + drivers/net/netvsc/hn_nvs.c | 2 +- + drivers/net/netvsc/hn_rxtx.c | 4 +- + drivers/net/netvsc/hn_vf.c | 2 +- + .../net/nfp/nfpcore/nfp-common/nfp_resid.h | 6 +-- + drivers/net/nfp/nfpcore/nfp_cppcore.c | 2 +- + drivers/net/nfp/nfpcore/nfp_nsp.h | 2 +- + drivers/net/nfp/nfpcore/nfp_resource.c | 2 +- + drivers/net/nfp/nfpcore/nfp_rtsym.c | 2 +- + drivers/net/ngbe/ngbe_ethdev.c | 6 +-- + drivers/net/ngbe/ngbe_pf.c | 2 +- + drivers/net/octeontx/octeontx_ethdev.c | 2 +- + drivers/net/octeontx2/otx2_ethdev_irq.c | 2 +- + drivers/net/octeontx2/otx2_ptp.c | 2 +- + drivers/net/octeontx2/otx2_tx.h | 4 +- + drivers/net/octeontx2/otx2_vlan.c | 2 +- + drivers/net/octeontx_ep/otx2_ep_vf.c | 2 +- + drivers/net/octeontx_ep/otx_ep_vf.c | 2 +- + drivers/net/pfe/pfe_ethdev.c | 2 +- + drivers/net/pfe/pfe_hal.c | 2 +- + drivers/net/pfe/pfe_hif.c | 4 +- + drivers/net/pfe/pfe_hif.h | 2 +- + drivers/net/pfe/pfe_hif_lib.c | 8 ++-- + drivers/net/qede/qede_debug.c | 4 +- + drivers/net/qede/qede_ethdev.c | 2 +- + drivers/net/qede/qede_rxtx.c | 12 +++--- + drivers/net/qede/qede_rxtx.h | 2 +- + drivers/net/sfc/sfc.c | 2 +- + drivers/net/sfc/sfc_dp.c | 2 +- + drivers/net/sfc/sfc_dp_rx.h | 4 +- + drivers/net/sfc/sfc_ef100.h | 2 +- + drivers/net/sfc/sfc_ef100_rx.c | 2 +- + drivers/net/sfc/sfc_ef10_essb_rx.c | 2 +- + drivers/net/sfc/sfc_ef10_rx_ev.h | 2 +- + drivers/net/sfc/sfc_intr.c | 2 +- + drivers/net/sfc/sfc_rx.c | 6 +-- + drivers/net/sfc/sfc_tx.c | 2 +- + drivers/net/softnic/rte_eth_softnic_flow.c | 2 +- + drivers/net/tap/rte_eth_tap.c | 2 +- + drivers/net/tap/tap_bpf_api.c | 4 +- + drivers/net/tap/tap_flow.c | 4 +- + drivers/net/thunderx/nicvf_svf.c | 2 +- + drivers/net/txgbe/txgbe_ethdev.c | 6 +-- + drivers/net/txgbe/txgbe_ethdev_vf.c | 6 +-- + drivers/net/txgbe/txgbe_ipsec.c | 2 +- + drivers/net/txgbe/txgbe_pf.c | 2 +- + drivers/net/virtio/virtio_ethdev.c | 4 +- + drivers/net/virtio/virtio_pci.c | 2 +- + drivers/net/virtio/virtio_rxtx.c | 2 +- + drivers/net/virtio/virtio_rxtx_packed_avx.h | 2 +- + drivers/net/virtio/virtqueue.c | 2 +- + drivers/net/virtio/virtqueue.h | 4 +- + drivers/raw/dpaa2_qdma/dpaa2_qdma.c | 2 +- + drivers/raw/dpaa2_qdma/dpaa2_qdma.h | 4 +- + drivers/raw/ifpga/ifpga_rawdev.c | 10 ++--- + drivers/raw/ntb/ntb.h | 2 +- + drivers/vdpa/mlx5/mlx5_vdpa_mem.c | 2 +- + drivers/vdpa/mlx5/mlx5_vdpa_virtq.c | 2 +- + examples/bbdev_app/main.c | 2 +- + examples/bond/main.c | 4 +- + examples/dma/dmafwd.c | 2 +- + examples/ethtool/lib/rte_ethtool.c | 2 +- + examples/ethtool/lib/rte_ethtool.h | 4 +- + examples/ip_reassembly/main.c | 8 ++-- + examples/ipsec-secgw/event_helper.c | 2 +- + examples/ipsec-secgw/ipsec-secgw.c | 14 +++---- + examples/ipsec-secgw/sa.c | 6 +-- + examples/ipsec-secgw/sp4.c | 2 +- + examples/ipsec-secgw/sp6.c | 2 +- + examples/ipsec-secgw/test/common_defs.sh | 4 +- + examples/kni/main.c | 2 +- + examples/l2fwd-cat/l2fwd-cat.c | 2 +- + examples/l2fwd-event/l2fwd_event_generic.c | 2 +- + .../l2fwd-event/l2fwd_event_internal_port.c | 2 +- + examples/l2fwd-jobstats/main.c | 2 +- + examples/l3fwd-acl/main.c | 6 +-- + examples/l3fwd-power/main.c | 4 +- + examples/l3fwd/l3fwd_common.h | 4 +- + examples/l3fwd/l3fwd_neon.h | 2 +- + examples/l3fwd/l3fwd_sse.h | 2 +- + examples/multi_process/hotplug_mp/commands.c | 2 +- + examples/multi_process/simple_mp/main.c | 2 +- + examples/multi_process/symmetric_mp/main.c | 2 +- + examples/ntb/ntb_fwd.c | 2 +- + examples/packet_ordering/main.c | 2 +- + examples/performance-thread/common/lthread.c | 6 +-- + .../performance-thread/common/lthread_diag.c | 2 +- + .../performance-thread/common/lthread_int.h | 2 +- + .../performance-thread/common/lthread_tls.c | 2 +- + .../performance-thread/l3fwd-thread/main.c | 12 +++--- + .../pthread_shim/pthread_shim.h | 2 +- + examples/pipeline/examples/registers.spec | 2 +- + examples/qos_sched/cmdline.c | 2 +- + examples/server_node_efd/node/node.c | 2 +- + examples/skeleton/basicfwd.c | 2 +- + examples/vhost/main.c | 10 ++--- + examples/vm_power_manager/channel_monitor.c | 2 +- + examples/vm_power_manager/power_manager.h | 2 +- + examples/vmdq/main.c | 2 +- + kernel/linux/kni/kni_fifo.h | 2 +- + lib/acl/acl_bld.c | 2 +- + lib/acl/acl_run_altivec.h | 2 +- + lib/acl/acl_run_avx512.c | 2 +- + lib/acl/acl_run_avx512x16.h | 14 +++---- + lib/acl/acl_run_avx512x8.h | 12 +++--- + lib/bpf/bpf_convert.c | 4 +- + lib/dmadev/rte_dmadev.h | 4 +- + lib/eal/arm/include/rte_cycles_32.h | 2 +- + lib/eal/freebsd/eal_interrupts.c | 4 +- + lib/eal/include/generic/rte_pflock.h | 2 +- + lib/eal/include/rte_malloc.h | 4 +- + lib/eal/linux/eal_interrupts.c | 4 +- + lib/eal/linux/eal_vfio.h | 2 +- + lib/eal/windows/eal_windows.h | 2 +- + lib/eal/windows/include/dirent.h | 4 +- + lib/eal/windows/include/fnmatch.h | 4 +- + lib/eal/x86/include/rte_atomic.h | 2 +- + lib/eventdev/rte_event_eth_rx_adapter.c | 6 +-- + lib/fib/rte_fib.c | 6 +-- + lib/fib/rte_fib.h | 4 +- + lib/fib/rte_fib6.c | 6 +-- + lib/fib/rte_fib6.h | 4 +- + lib/ipsec/ipsec_telemetry.c | 2 +- + lib/ipsec/rte_ipsec_sad.h | 2 +- + lib/ipsec/sa.c | 2 +- + lib/mbuf/rte_mbuf_core.h | 2 +- + lib/meson.build | 2 +- + lib/net/rte_l2tpv2.h | 4 +- + lib/pipeline/rte_swx_ctl.h | 4 +- + lib/pipeline/rte_swx_pipeline_internal.h | 4 +- + lib/pipeline/rte_swx_pipeline_spec.c | 2 +- + lib/power/power_cppc_cpufreq.c | 2 +- + lib/regexdev/rte_regexdev.h | 6 +-- + lib/ring/rte_ring_core.h | 2 +- + lib/sched/rte_pie.h | 6 +-- + lib/sched/rte_red.h | 4 +- + lib/sched/rte_sched.c | 2 +- + lib/sched/rte_sched.h | 2 +- + lib/table/rte_swx_table.h | 2 +- + lib/table/rte_swx_table_selector.h | 2 +- + lib/telemetry/telemetry.c | 2 +- + lib/telemetry/telemetry_json.h | 2 +- + lib/vhost/vhost_user.c | 4 +- + 426 files changed, 869 insertions(+), 869 deletions(-) + +diff --git a/app/proc-info/main.c b/app/proc-info/main.c +index fbc1715ce9..accb5e716d 100644 +--- a/app/proc-info/main.c ++++ b/app/proc-info/main.c +@@ -637,7 +637,7 @@ metrics_display(int port_id) + + names = rte_malloc(NULL, sizeof(struct rte_metric_name) * len, 0); + if (names == NULL) { +- printf("Cannot allocate memory for metrcis names\n"); ++ printf("Cannot allocate memory for metrics names\n"); + rte_free(metrics); + return; + } +@@ -1135,7 +1135,7 @@ show_tm(void) + caplevel.n_nodes_max, + caplevel.n_nodes_nonleaf_max, + caplevel.n_nodes_leaf_max); +- printf("\t -- indetical: non leaf %u leaf %u\n", ++ printf("\t -- identical: non leaf %u leaf %u\n", + caplevel.non_leaf_nodes_identical, + caplevel.leaf_nodes_identical); + +@@ -1289,7 +1289,7 @@ show_ring(char *name) + printf(" - Name (%s) on socket (%d)\n" + " - flags:\n" + "\t -- Single Producer Enqueue (%u)\n" +- "\t -- Single Consmer Dequeue (%u)\n", ++ "\t -- Single Consumer Dequeue (%u)\n", + ptr->name, + ptr->memzone->socket_id, + ptr->flags & RING_F_SP_ENQ, +diff --git a/app/test-acl/main.c b/app/test-acl/main.c +index c2de18770d..06e3847ab9 100644 +--- a/app/test-acl/main.c ++++ b/app/test-acl/main.c +@@ -386,8 +386,8 @@ parse_cb_ipv4_trace(char *str, struct ipv4_5tuple *v) + } + + /* +- * Parses IPV6 address, exepcts the following format: +- * XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX (where X - is a hexedecimal digit). ++ * Parse IPv6 address, expects the following format: ++ * XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX (where X is a hexadecimal digit). + */ + static int + parse_ipv6_addr(const char *in, const char **end, uint32_t v[IPV6_ADDR_U32], +@@ -994,7 +994,7 @@ print_usage(const char *prgname) + "should be either 1 or multiple of %zu, " + "but not greater then %u]\n" + "[--" OPT_MAX_SIZE +- "= " ++ "= " + "leave 0 for default behaviour]\n" + "[--" OPT_ITER_NUM "=]\n" + "[--" OPT_VERBOSE "=]\n" +diff --git a/app/test-compress-perf/comp_perf_test_cyclecount.c b/app/test-compress-perf/comp_perf_test_cyclecount.c +index da55b02b74..1d8e5fe6c2 100644 +--- a/app/test-compress-perf/comp_perf_test_cyclecount.c ++++ b/app/test-compress-perf/comp_perf_test_cyclecount.c +@@ -180,7 +180,7 @@ main_loop(struct cperf_cyclecount_ctx *ctx, enum rte_comp_xform_type type) + + if (ops == NULL) { + RTE_LOG(ERR, USER1, +- "Can't allocate memory for ops strucures\n"); ++ "Can't allocate memory for ops structures\n"); + return -1; + } + +diff --git a/app/test-compress-perf/comp_perf_test_throughput.c b/app/test-compress-perf/comp_perf_test_throughput.c +index d3dff070b0..4569599eb9 100644 +--- a/app/test-compress-perf/comp_perf_test_throughput.c ++++ b/app/test-compress-perf/comp_perf_test_throughput.c +@@ -72,7 +72,7 @@ main_loop(struct cperf_benchmark_ctx *ctx, enum rte_comp_xform_type type) + + if (ops == NULL) { + RTE_LOG(ERR, USER1, +- "Can't allocate memory for ops strucures\n"); ++ "Can't allocate memory for ops structures\n"); + return -1; + } + +diff --git a/app/test-compress-perf/comp_perf_test_verify.c b/app/test-compress-perf/comp_perf_test_verify.c +index f6e21368e8..7d06029488 100644 +--- a/app/test-compress-perf/comp_perf_test_verify.c ++++ b/app/test-compress-perf/comp_perf_test_verify.c +@@ -75,7 +75,7 @@ main_loop(struct cperf_verify_ctx *ctx, enum rte_comp_xform_type type) + + if (ops == NULL) { + RTE_LOG(ERR, USER1, +- "Can't allocate memory for ops strucures\n"); ++ "Can't allocate memory for ops structures\n"); + return -1; + } + +diff --git a/app/test-compress-perf/main.c b/app/test-compress-perf/main.c +index cc9951a9b1..6ff6a2f04a 100644 +--- a/app/test-compress-perf/main.c ++++ b/app/test-compress-perf/main.c +@@ -67,7 +67,7 @@ comp_perf_check_capabilities(struct comp_test_data *test_data, uint8_t cdev_id) + + uint64_t comp_flags = cap->comp_feature_flags; + +- /* Huffman enconding */ ++ /* Huffman encoding */ + if (test_data->huffman_enc == RTE_COMP_HUFFMAN_FIXED && + (comp_flags & RTE_COMP_FF_HUFFMAN_FIXED) == 0) { + RTE_LOG(ERR, USER1, +diff --git a/app/test-crypto-perf/cperf_test_pmd_cyclecount.c b/app/test-crypto-perf/cperf_test_pmd_cyclecount.c +index ba1f104f72..5842f29d43 100644 +--- a/app/test-crypto-perf/cperf_test_pmd_cyclecount.c ++++ b/app/test-crypto-perf/cperf_test_pmd_cyclecount.c +@@ -334,7 +334,7 @@ pmd_cyclecount_bench_burst_sz( + * queue, so we never get any failed enqs unless the driver won't accept + * the exact number of descriptors we requested, or the driver won't + * wrap around the end of the TX ring. However, since we're only +- * dequeueing once we've filled up the queue, we have to benchmark it ++ * dequeuing once we've filled up the queue, we have to benchmark it + * piecemeal and then average out the results. + */ + cur_op = 0; +diff --git a/app/test-eventdev/evt_options.c b/app/test-eventdev/evt_options.c +index 753a7dbd7d..4ae44801da 100644 +--- a/app/test-eventdev/evt_options.c ++++ b/app/test-eventdev/evt_options.c +@@ -336,7 +336,7 @@ usage(char *program) + "\t--deq_tmo_nsec : global dequeue timeout\n" + "\t--prod_type_ethdev : use ethernet device as producer.\n" + "\t--prod_type_timerdev : use event timer device as producer.\n" +- "\t expity_nsec would be the timeout\n" ++ "\t expiry_nsec would be the timeout\n" + "\t in ns.\n" + "\t--prod_type_timerdev_burst : use timer device as producer\n" + "\t burst mode.\n" +diff --git a/app/test-eventdev/test_order_common.c b/app/test-eventdev/test_order_common.c +index ff7813f9c2..603e7c9178 100644 +--- a/app/test-eventdev/test_order_common.c ++++ b/app/test-eventdev/test_order_common.c +@@ -253,7 +253,7 @@ void + order_opt_dump(struct evt_options *opt) + { + evt_dump_producer_lcores(opt); +- evt_dump("nb_wrker_lcores", "%d", evt_nr_active_lcores(opt->wlcores)); ++ evt_dump("nb_worker_lcores", "%d", evt_nr_active_lcores(opt->wlcores)); + evt_dump_worker_lcores(opt); + evt_dump("nb_evdev_ports", "%d", order_nb_event_ports(opt)); + } +diff --git a/app/test-fib/main.c b/app/test-fib/main.c +index ecd420116a..622703dce8 100644 +--- a/app/test-fib/main.c ++++ b/app/test-fib/main.c +@@ -624,7 +624,7 @@ print_usage(void) + "(if -f is not specified)>]\n" + "[-r ]\n" +- "[-c ]\n" ++ "[-c ]\n" + "[-6 ]\n" + "[-s ]\n" + "[-a ]\n" + "[-w ]\n" + "[-u ]\n" +- "[-v ]\n", +diff --git a/app/test-flow-perf/config.h b/app/test-flow-perf/config.h +index 0db2254bd1..29b63298e0 100644 +--- a/app/test-flow-perf/config.h ++++ b/app/test-flow-perf/config.h +@@ -28,7 +28,7 @@ + #define PORT_ID_DST 1 + #define TEID_VALUE 1 + +-/* Flow items/acctions max size */ ++/* Flow items/actions max size */ + #define MAX_ITEMS_NUM 32 + #define MAX_ACTIONS_NUM 32 + #define MAX_ATTRS_NUM 16 +diff --git a/app/test-flow-perf/main.c b/app/test-flow-perf/main.c +index 11f1ee0e1e..56d43734e3 100644 +--- a/app/test-flow-perf/main.c ++++ b/app/test-flow-perf/main.c +@@ -1519,7 +1519,7 @@ dump_used_cpu_time(const char *item, + * threads time. + * + * Throughput: total count of rte rules divided +- * over the average of the time cosumed by all ++ * over the average of the time consumed by all + * threads time. + */ + double insertion_latency_time; +diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c +index 1f9fd61394..26d95e64e0 100644 +--- a/app/test-pmd/cmdline.c ++++ b/app/test-pmd/cmdline.c +@@ -561,7 +561,7 @@ static void cmd_help_long_parsed(void *parsed_result, + " Set the option to enable display of RX and TX bursts.\n" + + "set port (port_id) vf (vf_id) rx|tx on|off\n" +- " Enable/Disable a VF receive/tranmit from a port\n\n" ++ " Enable/Disable a VF receive/transmit from a port\n\n" + + "set port (port_id) vf (vf_id) rxmode (AUPE|ROPE|BAM" + "|MPE) (on|off)\n" +diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c +index bbe3dc0115..5c2bba48ad 100644 +--- a/app/test-pmd/cmdline_flow.c ++++ b/app/test-pmd/cmdline_flow.c +@@ -2162,7 +2162,7 @@ static const struct token token_list[] = { + }, + [COMMON_POLICY_ID] = { + .name = "{policy_id}", +- .type = "POLCIY_ID", ++ .type = "POLICY_ID", + .help = "policy id", + .call = parse_int, + .comp = comp_none, +@@ -2370,7 +2370,7 @@ static const struct token token_list[] = { + }, + [TUNNEL_DESTROY] = { + .name = "destroy", +- .help = "destroy tunel", ++ .help = "destroy tunnel", + .next = NEXT(NEXT_ENTRY(TUNNEL_DESTROY_ID), + NEXT_ENTRY(COMMON_PORT_ID)), + .args = ARGS(ARGS_ENTRY(struct buffer, port)), +@@ -2378,7 +2378,7 @@ static const struct token token_list[] = { + }, + [TUNNEL_DESTROY_ID] = { + .name = "id", +- .help = "tunnel identifier to testroy", ++ .help = "tunnel identifier to destroy", + .next = NEXT(NEXT_ENTRY(COMMON_UNSIGNED)), + .args = ARGS(ARGS_ENTRY(struct tunnel_ops, id)), + .call = parse_tunnel, +diff --git a/app/test-pmd/cmdline_tm.c b/app/test-pmd/cmdline_tm.c +index bfbd43ca9b..c058b8946e 100644 +--- a/app/test-pmd/cmdline_tm.c ++++ b/app/test-pmd/cmdline_tm.c +@@ -69,7 +69,7 @@ print_err_msg(struct rte_tm_error *error) + [RTE_TM_ERROR_TYPE_NODE_PARAMS_N_SHARED_SHAPERS] + = "num shared shapers field (node params)", + [RTE_TM_ERROR_TYPE_NODE_PARAMS_WFQ_WEIGHT_MODE] +- = "wfq weght mode field (node params)", ++ = "wfq weight mode field (node params)", + [RTE_TM_ERROR_TYPE_NODE_PARAMS_N_SP_PRIORITIES] + = "num strict priorities field (node params)", + [RTE_TM_ERROR_TYPE_NODE_PARAMS_CMAN] +@@ -479,7 +479,7 @@ static void cmd_show_port_tm_level_cap_parsed(void *parsed_result, + cmdline_parse_inst_t cmd_show_port_tm_level_cap = { + .f = cmd_show_port_tm_level_cap_parsed, + .data = NULL, +- .help_str = "Show Port TM Hierarhical level Capabilities", ++ .help_str = "Show port TM hierarchical level capabilities", + .tokens = { + (void *)&cmd_show_port_tm_level_cap_show, + (void *)&cmd_show_port_tm_level_cap_port, +diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c +index 2aeea243b6..0177284d9c 100644 +--- a/app/test-pmd/csumonly.c ++++ b/app/test-pmd/csumonly.c +@@ -796,7 +796,7 @@ pkt_copy_split(const struct rte_mbuf *pkt) + * + * The testpmd command line for this forward engine sets the flags + * TESTPMD_TX_OFFLOAD_* in ports[tx_port].tx_ol_flags. They control +- * wether a checksum must be calculated in software or in hardware. The ++ * whether a checksum must be calculated in software or in hardware. The + * IP, UDP, TCP and SCTP flags always concern the inner layer. The + * OUTER_IP is only useful for tunnel packets. + */ +diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c +index 24e03e769c..435687fa6d 100644 +--- a/app/test-pmd/parameters.c ++++ b/app/test-pmd/parameters.c +@@ -113,7 +113,7 @@ usage(char* progname) + "If the drop-queue doesn't exist, the packet is dropped. " + "By default drop-queue=127.\n"); + #ifdef RTE_LIB_LATENCYSTATS +- printf(" --latencystats=N: enable latency and jitter statistcs " ++ printf(" --latencystats=N: enable latency and jitter statistics " + "monitoring on forwarding lcore id N.\n"); + #endif + printf(" --disable-crc-strip: disable CRC stripping by hardware.\n"); +diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c +index 66d5167f57..2be92af9f8 100644 +--- a/app/test-pmd/testpmd.c ++++ b/app/test-pmd/testpmd.c +@@ -453,7 +453,7 @@ uint32_t bypass_timeout = RTE_PMD_IXGBE_BYPASS_TMT_OFF; + uint8_t latencystats_enabled; + + /* +- * Lcore ID to serive latency statistics. ++ * Lcore ID to service latency statistics. + */ + lcoreid_t latencystats_lcore_id = -1; + +diff --git a/app/test-pmd/txonly.c b/app/test-pmd/txonly.c +index b8497e733d..e8c0c7b926 100644 +--- a/app/test-pmd/txonly.c ++++ b/app/test-pmd/txonly.c +@@ -174,14 +174,14 @@ update_pkt_header(struct rte_mbuf *pkt, uint32_t total_pkt_len) + sizeof(struct rte_ether_hdr) + + sizeof(struct rte_ipv4_hdr) + + sizeof(struct rte_udp_hdr))); +- /* updata udp pkt length */ ++ /* update UDP packet length */ + udp_hdr = rte_pktmbuf_mtod_offset(pkt, struct rte_udp_hdr *, + sizeof(struct rte_ether_hdr) + + sizeof(struct rte_ipv4_hdr)); + pkt_len = (uint16_t) (pkt_data_len + sizeof(struct rte_udp_hdr)); + udp_hdr->dgram_len = RTE_CPU_TO_BE_16(pkt_len); + +- /* updata ip pkt length and csum */ ++ /* update IP packet length and checksum */ + ip_hdr = rte_pktmbuf_mtod_offset(pkt, struct rte_ipv4_hdr *, + sizeof(struct rte_ether_hdr)); + ip_hdr->hdr_checksum = 0; +diff --git a/app/test/test_barrier.c b/app/test/test_barrier.c +index 6d6d48749c..ec69af25bf 100644 +--- a/app/test/test_barrier.c ++++ b/app/test/test_barrier.c +@@ -11,7 +11,7 @@ + * (https://en.wikipedia.org/wiki/Peterson%27s_algorithm) + * for two execution units to make sure that rte_smp_mb() prevents + * store-load reordering to happen. +- * Also when executed on a single lcore could be used as a approxiamate ++ * Also when executed on a single lcore could be used as a approximate + * estimation of number of cycles particular implementation of rte_smp_mb() + * will take. + */ +diff --git a/app/test/test_bpf.c b/app/test/test_bpf.c +index 46bcb51f86..2d755a872f 100644 +--- a/app/test/test_bpf.c ++++ b/app/test/test_bpf.c +@@ -23,7 +23,7 @@ + /* + * Basic functional tests for librte_bpf. + * The main procedure - load eBPF program, execute it and +- * compare restuls with expected values. ++ * compare results with expected values. + */ + + struct dummy_offset { +@@ -2707,7 +2707,7 @@ test_ld_mbuf1_check(uint64_t rc, const void *arg) + } + + /* +- * same as ld_mbuf1, but then trancate the mbuf by 1B, ++ * same as ld_mbuf1, but then truncate the mbuf by 1B, + * so load of last 4B fail. + */ + static void +diff --git a/app/test/test_compressdev.c b/app/test/test_compressdev.c +index c63b5b6737..57c566aa92 100644 +--- a/app/test/test_compressdev.c ++++ b/app/test/test_compressdev.c +@@ -1256,7 +1256,7 @@ test_deflate_comp_run(const struct interim_data_params *int_data, + /* + * Store original operation index in private data, + * since ordering does not have to be maintained, +- * when dequeueing from compressdev, so a comparison ++ * when dequeuing from compressdev, so a comparison + * at the end of the test can be done. + */ + priv_data = (struct priv_op_data *) (ops[i] + 1); +diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c +index 10b48cdadb..6c949605b8 100644 +--- a/app/test/test_cryptodev.c ++++ b/app/test/test_cryptodev.c +@@ -6870,7 +6870,7 @@ test_snow3g_decryption_with_digest_test_case_1(void) + } + + /* +- * Function prepare data for hash veryfication test case. ++ * Function prepare data for hash verification test case. + * Digest is allocated in 4 last bytes in plaintext, pattern. + */ + snow3g_hash_test_vector_setup(&snow3g_test_case_7, &snow3g_hash_data); +diff --git a/app/test/test_fib_perf.c b/app/test/test_fib_perf.c +index 86b2f832b8..7a25fe8df7 100644 +--- a/app/test/test_fib_perf.c ++++ b/app/test/test_fib_perf.c +@@ -346,7 +346,7 @@ test_fib_perf(void) + fib = rte_fib_create(__func__, SOCKET_ID_ANY, &config); + TEST_FIB_ASSERT(fib != NULL); + +- /* Measue add. */ ++ /* Measure add. */ + begin = rte_rdtsc(); + + for (i = 0; i < NUM_ROUTE_ENTRIES; i++) { +diff --git a/app/test/test_kni.c b/app/test/test_kni.c +index 40ab0d5c4c..2761de9b07 100644 +--- a/app/test/test_kni.c ++++ b/app/test/test_kni.c +@@ -326,7 +326,7 @@ test_kni_register_handler_mp(void) + + /* Check with the invalid parameters */ + if (rte_kni_register_handlers(kni, NULL) == 0) { +- printf("Unexpectedly register successuflly " ++ printf("Unexpectedly register successfully " + "with NULL ops pointer\n"); + exit(-1); + } +@@ -475,7 +475,7 @@ test_kni_processing(uint16_t port_id, struct rte_mempool *mp) + + /** + * Check multiple processes support on +- * registerring/unregisterring handlers. ++ * registering/unregistering handlers. + */ + if (test_kni_register_handler_mp() < 0) { + printf("fail to check multiple process support\n"); +diff --git a/app/test/test_kvargs.c b/app/test/test_kvargs.c +index a91ea8dc47..b7b97a0dd9 100644 +--- a/app/test/test_kvargs.c ++++ b/app/test/test_kvargs.c +@@ -11,7 +11,7 @@ + + #include "test.h" + +-/* incrementd in handler, to check it is properly called once per ++/* incremented in handler, to check it is properly called once per + * key/value association */ + static unsigned count; + +@@ -107,14 +107,14 @@ static int test_valid_kvargs(void) + goto fail; + } + count = 0; +- /* call check_handler() for all entries with key="unexistant_key" */ +- if (rte_kvargs_process(kvlist, "unexistant_key", check_handler, NULL) < 0) { ++ /* call check_handler() for all entries with key="nonexistent_key" */ ++ if (rte_kvargs_process(kvlist, "nonexistent_key", check_handler, NULL) < 0) { + printf("rte_kvargs_process() error\n"); + rte_kvargs_free(kvlist); + goto fail; + } + if (count != 0) { +- printf("invalid count value %d after rte_kvargs_process(unexistant_key)\n", ++ printf("invalid count value %d after rte_kvargs_process(nonexistent_key)\n", + count); + rte_kvargs_free(kvlist); + goto fail; +@@ -135,10 +135,10 @@ static int test_valid_kvargs(void) + rte_kvargs_free(kvlist); + goto fail; + } +- /* count all entries with key="unexistant_key" */ +- count = rte_kvargs_count(kvlist, "unexistant_key"); ++ /* count all entries with key="nonexistent_key" */ ++ count = rte_kvargs_count(kvlist, "nonexistent_key"); + if (count != 0) { +- printf("invalid count value %d after rte_kvargs_count(unexistant_key)\n", ++ printf("invalid count value %d after rte_kvargs_count(nonexistent_key)\n", + count); + rte_kvargs_free(kvlist); + goto fail; +@@ -156,7 +156,7 @@ static int test_valid_kvargs(void) + /* call check_handler() on all entries with key="check", it + * should fail as the value is not recognized by the handler */ + if (rte_kvargs_process(kvlist, "check", check_handler, NULL) == 0) { +- printf("rte_kvargs_process() is success bu should not\n"); ++ printf("rte_kvargs_process() is success but should not\n"); + rte_kvargs_free(kvlist); + goto fail; + } +diff --git a/app/test/test_lpm6_data.h b/app/test/test_lpm6_data.h +index c3894f730e..da9b161f20 100644 +--- a/app/test/test_lpm6_data.h ++++ b/app/test/test_lpm6_data.h +@@ -22,7 +22,7 @@ struct ips_tbl_entry { + * in previous test_lpm6_routes.h . Because this table has only 1000 + * lines, keeping it doesn't make LPM6 test case so large and also + * make the algorithm to generate rule table unnecessary and the +- * algorithm to genertate test input IPv6 and associated expected ++ * algorithm to generate test input IPv6 and associated expected + * next_hop much simple. + */ + +diff --git a/app/test/test_member.c b/app/test/test_member.c +index 40aa4c8627..af9d50915c 100644 +--- a/app/test/test_member.c ++++ b/app/test/test_member.c +@@ -459,7 +459,7 @@ static int test_member_multimatch(void) + MAX_MATCH, set_ids_cache); + /* + * For cache mode, keys overwrite when signature same. +- * the mutimatch should work like single match. ++ * the multimatch should work like single match. + */ + TEST_ASSERT(ret_ht == M_MATCH_CNT && ret_vbf == M_MATCH_CNT && + ret_cache == 1, +diff --git a/app/test/test_mempool.c b/app/test/test_mempool.c +index f6c650d11f..8e493eda47 100644 +--- a/app/test/test_mempool.c ++++ b/app/test/test_mempool.c +@@ -304,7 +304,7 @@ static int test_mempool_single_consumer(void) + } + + /* +- * test function for mempool test based on singple consumer and single producer, ++ * test function for mempool test based on single consumer and single producer, + * can run on one lcore only + */ + static int +@@ -322,7 +322,7 @@ my_mp_init(struct rte_mempool *mp, __rte_unused void *arg) + } + + /* +- * it tests the mempool operations based on singple producer and single consumer ++ * it tests the mempool operations based on single producer and single consumer + */ + static int + test_mempool_sp_sc(void) +diff --git a/app/test/test_memzone.c b/app/test/test_memzone.c +index 6ddd0fbab5..c9255e5763 100644 +--- a/app/test/test_memzone.c ++++ b/app/test/test_memzone.c +@@ -543,7 +543,7 @@ test_memzone_reserve_max(void) + } + + if (mz->len != maxlen) { +- printf("Memzone reserve with 0 size did not return bigest block\n"); ++ printf("Memzone reserve with 0 size did not return biggest block\n"); + printf("Expected size = %zu, actual size = %zu\n", + maxlen, mz->len); + rte_dump_physmem_layout(stdout); +@@ -606,7 +606,7 @@ test_memzone_reserve_max_aligned(void) + + if (mz->len < minlen || mz->len > maxlen) { + printf("Memzone reserve with 0 size and alignment %u did not return" +- " bigest block\n", align); ++ " biggest block\n", align); + printf("Expected size = %zu-%zu, actual size = %zu\n", + minlen, maxlen, mz->len); + rte_dump_physmem_layout(stdout); +@@ -1054,7 +1054,7 @@ test_memzone_basic(void) + if (mz != memzone1) + return -1; + +- printf("test duplcate zone name\n"); ++ printf("test duplicate zone name\n"); + mz = rte_memzone_reserve(TEST_MEMZONE_NAME("testzone1"), 100, + SOCKET_ID_ANY, 0); + if (mz != NULL) +diff --git a/app/test/test_metrics.c b/app/test/test_metrics.c +index e736019ae4..11222133d0 100644 +--- a/app/test/test_metrics.c ++++ b/app/test/test_metrics.c +@@ -121,7 +121,7 @@ test_metrics_update_value(void) + err = rte_metrics_update_value(RTE_METRICS_GLOBAL, KEY, VALUE); + TEST_ASSERT(err >= 0, "%s, %d", __func__, __LINE__); + +- /* Successful Test: Valid port_id otherthan RTE_METRICS_GLOBAL, key ++ /* Successful Test: Valid port_id other than RTE_METRICS_GLOBAL, key + * and value + */ + err = rte_metrics_update_value(9, KEY, VALUE); +diff --git a/app/test/test_pcapng.c b/app/test/test_pcapng.c +index c2dbeaf603..34c5e12346 100644 +--- a/app/test/test_pcapng.c ++++ b/app/test/test_pcapng.c +@@ -109,7 +109,7 @@ test_setup(void) + return -1; + } + +- /* Make a pool for cloned packeets */ ++ /* Make a pool for cloned packets */ + mp = rte_pktmbuf_pool_create_by_ops("pcapng_test_pool", NUM_PACKETS, + 0, 0, + rte_pcapng_mbuf_size(pkt_len), +diff --git a/app/test/test_power_cpufreq.c b/app/test/test_power_cpufreq.c +index 1a9549527e..4d013cd7bb 100644 +--- a/app/test/test_power_cpufreq.c ++++ b/app/test/test_power_cpufreq.c +@@ -659,7 +659,7 @@ test_power_cpufreq(void) + /* test of exit power management for an invalid lcore */ + ret = rte_power_exit(TEST_POWER_LCORE_INVALID); + if (ret == 0) { +- printf("Unpectedly exit power management successfully for " ++ printf("Unexpectedly exit power management successfully for " + "lcore %u\n", TEST_POWER_LCORE_INVALID); + rte_power_unset_env(); + return -1; +diff --git a/app/test/test_rcu_qsbr.c b/app/test/test_rcu_qsbr.c +index ab37a068cd..70404e89e6 100644 +--- a/app/test/test_rcu_qsbr.c ++++ b/app/test/test_rcu_qsbr.c +@@ -408,7 +408,7 @@ test_rcu_qsbr_synchronize_reader(void *arg) + + /* + * rte_rcu_qsbr_synchronize: Wait till all the reader threads have entered +- * the queiscent state. ++ * the quiescent state. + */ + static int + test_rcu_qsbr_synchronize(void) +@@ -443,7 +443,7 @@ test_rcu_qsbr_synchronize(void) + rte_rcu_qsbr_synchronize(t[0], RTE_MAX_LCORE - 1); + rte_rcu_qsbr_thread_offline(t[0], RTE_MAX_LCORE - 1); + +- /* Test if the API returns after unregisterng all the threads */ ++ /* Test if the API returns after unregistering all the threads */ + for (i = 0; i < RTE_MAX_LCORE; i++) + rte_rcu_qsbr_thread_unregister(t[0], i); + rte_rcu_qsbr_synchronize(t[0], RTE_QSBR_THRID_INVALID); +diff --git a/app/test/test_red.c b/app/test/test_red.c +index 05936cfee8..33a9f4ebb7 100644 +--- a/app/test/test_red.c ++++ b/app/test/test_red.c +@@ -1566,10 +1566,10 @@ static void ovfl_check_avg(uint32_t avg) + } + + static struct test_config ovfl_test1_config = { +- .ifname = "queue avergage overflow test interface", ++ .ifname = "queue average overflow test interface", + .msg = "overflow test 1 : use one RED configuration,\n" + " increase average queue size to target level,\n" +- " check maximum number of bits requirte_red to represent avg_s\n\n", ++ " check maximum number of bits required to represent avg_s\n\n", + .htxt = "avg queue size " + "wq_log2 " + "fraction bits " +@@ -1757,12 +1757,12 @@ test_invalid_parameters(void) + printf("%i: rte_red_config_init should have failed!\n", __LINE__); + return -1; + } +- /* min_treshold == max_treshold */ ++ /* min_threshold == max_threshold */ + if (rte_red_config_init(&config, 0, 1, 1, 0) == 0) { + printf("%i: rte_red_config_init should have failed!\n", __LINE__); + return -1; + } +- /* min_treshold > max_treshold */ ++ /* min_threshold > max_threshold */ + if (rte_red_config_init(&config, 0, 2, 1, 0) == 0) { + printf("%i: rte_red_config_init should have failed!\n", __LINE__); + return -1; +diff --git a/app/test/test_security.c b/app/test/test_security.c +index 060cf1ffa8..059731b65d 100644 +--- a/app/test/test_security.c ++++ b/app/test/test_security.c +@@ -237,7 +237,7 @@ + * increases .called counter. Function returns value stored in .ret field + * of the structure. + * In case of some parameters in some functions the expected value is unknown +- * and cannot be detrmined prior to call. Such parameters are stored ++ * and cannot be determined prior to call. Such parameters are stored + * in structure and can be compared or analyzed later in test case code. + * + * Below structures and functions follow the rules just described. +diff --git a/app/test/test_table_pipeline.c b/app/test/test_table_pipeline.c +index aabf4375db..915c451fed 100644 +--- a/app/test/test_table_pipeline.c ++++ b/app/test/test_table_pipeline.c +@@ -364,7 +364,7 @@ setup_pipeline(int test_type) + .action = RTE_PIPELINE_ACTION_PORT, + {.port_id = port_out_id[i^1]}, + }; +- printf("Setting secont table to output to port\n"); ++ printf("Setting second table to output to port\n"); + + /* Add the default action for the table. */ + ret = rte_pipeline_table_default_entry_add(p, +diff --git a/app/test/test_thash.c b/app/test/test_thash.c +index a62530673f..62ba4a9528 100644 +--- a/app/test/test_thash.c ++++ b/app/test/test_thash.c +@@ -684,7 +684,7 @@ test_predictable_rss_multirange(void) + + /* + * calculate hashes, complements, then adjust keys with +- * complements and recalsulate hashes ++ * complements and recalculate hashes + */ + for (i = 0; i < RTE_DIM(rng_arr); i++) { + for (k = 0; k < 100; k++) { +diff --git a/buildtools/binutils-avx512-check.py b/buildtools/binutils-avx512-check.py +index a4e14f3593..57392ecdc8 100644 +--- a/buildtools/binutils-avx512-check.py ++++ b/buildtools/binutils-avx512-check.py +@@ -1,5 +1,5 @@ + #! /usr/bin/env python3 +-# SPDX-License-Identitifer: BSD-3-Clause ++# SPDX-License-Identifier: BSD-3-Clause + # Copyright(c) 2020 Intel Corporation + + import subprocess +diff --git a/devtools/check-symbol-change.sh b/devtools/check-symbol-change.sh +index 8fcd0ce1a1..8992214ac8 100755 +--- a/devtools/check-symbol-change.sh ++++ b/devtools/check-symbol-change.sh +@@ -25,7 +25,7 @@ build_map_changes() + + # Triggering this rule, which starts a line and ends it + # with a { identifies a versioned section. The section name is +- # the rest of the line with the + and { symbols remvoed. ++ # the rest of the line with the + and { symbols removed. + # Triggering this rule sets in_sec to 1, which actives the + # symbol rule below + /^.*{/ { +@@ -35,7 +35,7 @@ build_map_changes() + } + } + +- # This rule idenfies the end of a section, and disables the ++ # This rule identifies the end of a section, and disables the + # symbol rule + /.*}/ {in_sec=0} + +@@ -100,7 +100,7 @@ check_for_rule_violations() + # Just inform the user of this occurrence, but + # don't flag it as an error + echo -n "INFO: symbol $symname is added but " +- echo -n "patch has insuficient context " ++ echo -n "patch has insufficient context " + echo -n "to determine the section name " + echo -n "please ensure the version is " + echo "EXPERIMENTAL" +diff --git a/doc/guides/howto/img/virtio_user_for_container_networking.svg b/doc/guides/howto/img/virtio_user_for_container_networking.svg +index de80806649..dc9b318e7e 100644 +--- a/doc/guides/howto/img/virtio_user_for_container_networking.svg ++++ b/doc/guides/howto/img/virtio_user_for_container_networking.svg +@@ -465,7 +465,7 @@ + v:mID="63" + id="shape63-63">Sheet.63Contanier/AppContainer/Appoffse offset offse offset = 4.5.** + +- The mmaping of the iomem range of the PCI device fails for kernels that ++ The mmapping of the iomem range of the PCI device fails for kernels that + enabled the ``CONFIG_IO_STRICT_DEVMEM`` option. The error seen by the + user is as similar to the following:: + +diff --git a/doc/guides/rel_notes/release_17_08.rst b/doc/guides/rel_notes/release_17_08.rst +index 25439dad45..1fd1755858 100644 +--- a/doc/guides/rel_notes/release_17_08.rst ++++ b/doc/guides/rel_notes/release_17_08.rst +@@ -232,7 +232,7 @@ API Changes + * The ``rte_cryptodev_configure()`` function does not create the session + mempool for the device anymore. + * The ``rte_cryptodev_queue_pair_attach_sym_session()`` and +- ``rte_cryptodev_queue_pair_dettach_sym_session()`` functions require ++ ``rte_cryptodev_queue_pair_detach_sym_session()`` functions require + the new parameter ``device id``. + * Parameters of ``rte_cryptodev_sym_session_create()`` were modified to + accept ``mempool``, instead of ``device id`` and ``rte_crypto_sym_xform``. +diff --git a/doc/guides/rel_notes/release_2_1.rst b/doc/guides/rel_notes/release_2_1.rst +index 35e6c88884..d0ad99ebce 100644 +--- a/doc/guides/rel_notes/release_2_1.rst ++++ b/doc/guides/rel_notes/release_2_1.rst +@@ -671,7 +671,7 @@ Resolved Issues + value 0. + + +- Fixes: 40b966a211ab ("ivshmem: library changes for mmaping using ivshmem") ++ Fixes: 40b966a211ab ("ivshmem: library changes for mmapping using ivshmem") + + + * **ixgbe/base: Fix SFP probing.** +diff --git a/doc/guides/sample_app_ug/ip_reassembly.rst b/doc/guides/sample_app_ug/ip_reassembly.rst +index 06289c2248..5280bf4ea0 100644 +--- a/doc/guides/sample_app_ug/ip_reassembly.rst ++++ b/doc/guides/sample_app_ug/ip_reassembly.rst +@@ -154,8 +154,8 @@ each RX queue uses its own mempool. + + .. literalinclude:: ../../../examples/ip_reassembly/main.c + :language: c +- :start-after: mbufs stored int the gragment table. 8< +- :end-before: >8 End of mbufs stored int the fragmentation table. ++ :start-after: mbufs stored in the fragment table. 8< ++ :end-before: >8 End of mbufs stored in the fragmentation table. + :dedent: 1 + + Packet Reassembly and Forwarding +diff --git a/doc/guides/sample_app_ug/l2_forward_cat.rst b/doc/guides/sample_app_ug/l2_forward_cat.rst +index 440642ef7c..3ada3575ba 100644 +--- a/doc/guides/sample_app_ug/l2_forward_cat.rst ++++ b/doc/guides/sample_app_ug/l2_forward_cat.rst +@@ -176,7 +176,7 @@ function. The value returned is the number of parsed arguments: + .. literalinclude:: ../../../examples/l2fwd-cat/l2fwd-cat.c + :language: c + :start-after: Initialize the Environment Abstraction Layer (EAL). 8< +- :end-before: >8 End of initializion the Environment Abstraction Layer (EAL). ++ :end-before: >8 End of initialization the Environment Abstraction Layer (EAL). + :dedent: 1 + + The next task is to initialize the PQoS library and configure CAT. The +diff --git a/doc/guides/sample_app_ug/server_node_efd.rst b/doc/guides/sample_app_ug/server_node_efd.rst +index 605eb09a61..c6cbc3def6 100644 +--- a/doc/guides/sample_app_ug/server_node_efd.rst ++++ b/doc/guides/sample_app_ug/server_node_efd.rst +@@ -191,7 +191,7 @@ flow is not handled by the node. + .. literalinclude:: ../../../examples/server_node_efd/node/node.c + :language: c + :start-after: Packets dequeued from the shared ring. 8< +- :end-before: >8 End of packets dequeueing. ++ :end-before: >8 End of packets dequeuing. + + Finally, note that both processes updates statistics, such as transmitted, received + and dropped packets, which are shown and refreshed by the server app. +diff --git a/doc/guides/sample_app_ug/skeleton.rst b/doc/guides/sample_app_ug/skeleton.rst +index 6d0de64401..08ddd7aa59 100644 +--- a/doc/guides/sample_app_ug/skeleton.rst ++++ b/doc/guides/sample_app_ug/skeleton.rst +@@ -54,7 +54,7 @@ function. The value returned is the number of parsed arguments: + .. literalinclude:: ../../../examples/skeleton/basicfwd.c + :language: c + :start-after: Initializion the Environment Abstraction Layer (EAL). 8< +- :end-before: >8 End of initializion the Environment Abstraction Layer (EAL). ++ :end-before: >8 End of initialization the Environment Abstraction Layer (EAL). + :dedent: 1 + + +diff --git a/doc/guides/sample_app_ug/vm_power_management.rst b/doc/guides/sample_app_ug/vm_power_management.rst +index 7160b6a63a..9ce87956c9 100644 +--- a/doc/guides/sample_app_ug/vm_power_management.rst ++++ b/doc/guides/sample_app_ug/vm_power_management.rst +@@ -681,7 +681,7 @@ The following is an example JSON string for a power management request. + "resource_id": 10 + }} + +-To query the available frequences of an lcore, use the query_cpu_freq command. ++To query the available frequencies of an lcore, use the query_cpu_freq command. + Where {core_num} is the lcore to query. + Before using this command, please enable responses via the set_query command on the host. + +diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst +index 44228cd7d2..94792d88cc 100644 +--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst ++++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst +@@ -3510,7 +3510,7 @@ Tunnel offload + Indicate tunnel offload rule type + + - ``tunnel_set {tunnel_id}``: mark rule as tunnel offload decap_set type. +-- ``tunnel_match {tunnel_id}``: mark rule as tunel offload match type. ++- ``tunnel_match {tunnel_id}``: mark rule as tunnel offload match type. + + Matching pattern + ^^^^^^^^^^^^^^^^ +diff --git a/drivers/baseband/fpga_lte_fec/fpga_lte_fec.c b/drivers/baseband/fpga_lte_fec/fpga_lte_fec.c +index 92decc3e05..21d35292a3 100644 +--- a/drivers/baseband/fpga_lte_fec/fpga_lte_fec.c ++++ b/drivers/baseband/fpga_lte_fec/fpga_lte_fec.c +@@ -2097,7 +2097,7 @@ dequeue_enc_one_op_cb(struct fpga_queue *q, struct rte_bbdev_enc_op **op, + rte_bbdev_log_debug("DMA response desc %p", desc); + + *op = desc->enc_req.op_addr; +- /* Check the decriptor error field, return 1 on error */ ++ /* Check the descriptor error field, return 1 on error */ + desc_error = check_desc_error(desc->enc_req.error); + (*op)->status = desc_error << RTE_BBDEV_DATA_ERROR; + +@@ -2139,7 +2139,7 @@ dequeue_enc_one_op_tb(struct fpga_queue *q, struct rte_bbdev_enc_op **op, + for (cb_idx = 0; cb_idx < cbs_in_op; ++cb_idx) { + desc = q->ring_addr + ((q->head_free_desc + desc_offset + + cb_idx) & q->sw_ring_wrap_mask); +- /* Check the decriptor error field, return 1 on error */ ++ /* Check the descriptor error field, return 1 on error */ + desc_error = check_desc_error(desc->enc_req.error); + status |= desc_error << RTE_BBDEV_DATA_ERROR; + rte_bbdev_log_debug("DMA response desc %p", desc); +@@ -2177,7 +2177,7 @@ dequeue_dec_one_op_cb(struct fpga_queue *q, struct rte_bbdev_dec_op **op, + (*op)->turbo_dec.iter_count = (desc->dec_req.iter + 2) >> 1; + /* crc_pass = 0 when decoder fails */ + (*op)->status = !(desc->dec_req.crc_pass) << RTE_BBDEV_CRC_ERROR; +- /* Check the decriptor error field, return 1 on error */ ++ /* Check the descriptor error field, return 1 on error */ + desc_error = check_desc_error(desc->enc_req.error); + (*op)->status |= desc_error << RTE_BBDEV_DATA_ERROR; + return 1; +@@ -2221,7 +2221,7 @@ dequeue_dec_one_op_tb(struct fpga_queue *q, struct rte_bbdev_dec_op **op, + iter_count = RTE_MAX(iter_count, (uint8_t) desc->dec_req.iter); + /* crc_pass = 0 when decoder fails, one fails all */ + status |= !(desc->dec_req.crc_pass) << RTE_BBDEV_CRC_ERROR; +- /* Check the decriptor error field, return 1 on error */ ++ /* Check the descriptor error field, return 1 on error */ + desc_error = check_desc_error(desc->enc_req.error); + status |= desc_error << RTE_BBDEV_DATA_ERROR; + rte_bbdev_log_debug("DMA response desc %p", desc); +diff --git a/drivers/baseband/null/bbdev_null.c b/drivers/baseband/null/bbdev_null.c +index 753d920e18..08cff582b9 100644 +--- a/drivers/baseband/null/bbdev_null.c ++++ b/drivers/baseband/null/bbdev_null.c +@@ -31,7 +31,7 @@ struct bbdev_null_params { + uint16_t queues_num; /*< Null BBDEV queues number */ + }; + +-/* Accecptable params for null BBDEV devices */ ++/* Acceptable params for null BBDEV devices */ + #define BBDEV_NULL_MAX_NB_QUEUES_ARG "max_nb_queues" + #define BBDEV_NULL_SOCKET_ID_ARG "socket_id" + +diff --git a/drivers/baseband/turbo_sw/bbdev_turbo_software.c b/drivers/baseband/turbo_sw/bbdev_turbo_software.c +index b234bb751a..c6b1eb8679 100644 +--- a/drivers/baseband/turbo_sw/bbdev_turbo_software.c ++++ b/drivers/baseband/turbo_sw/bbdev_turbo_software.c +@@ -61,7 +61,7 @@ struct turbo_sw_params { + uint16_t queues_num; /*< Turbo SW device queues number */ + }; + +-/* Accecptable params for Turbo SW devices */ ++/* Acceptable params for Turbo SW devices */ + #define TURBO_SW_MAX_NB_QUEUES_ARG "max_nb_queues" + #define TURBO_SW_SOCKET_ID_ARG "socket_id" + +diff --git a/drivers/bus/dpaa/dpaa_bus.c b/drivers/bus/dpaa/dpaa_bus.c +index 737ac8d8c5..5546a9cb8d 100644 +--- a/drivers/bus/dpaa/dpaa_bus.c ++++ b/drivers/bus/dpaa/dpaa_bus.c +@@ -70,7 +70,7 @@ compare_dpaa_devices(struct rte_dpaa_device *dev1, + { + int comp = 0; + +- /* Segragating ETH from SEC devices */ ++ /* Segregating ETH from SEC devices */ + if (dev1->device_type > dev2->device_type) + comp = 1; + else if (dev1->device_type < dev2->device_type) +diff --git a/drivers/bus/dpaa/include/fsl_qman.h b/drivers/bus/dpaa/include/fsl_qman.h +index 7ef2f3b2e3..9b63e559bc 100644 +--- a/drivers/bus/dpaa/include/fsl_qman.h ++++ b/drivers/bus/dpaa/include/fsl_qman.h +@@ -1353,7 +1353,7 @@ __rte_internal + int qman_irqsource_add(u32 bits); + + /** +- * qman_fq_portal_irqsource_add - samilar to qman_irqsource_add, but it ++ * qman_fq_portal_irqsource_add - similar to qman_irqsource_add, but it + * takes portal (fq specific) as input rather than using the thread affined + * portal. + */ +@@ -1416,7 +1416,7 @@ __rte_internal + struct qm_dqrr_entry *qman_dequeue(struct qman_fq *fq); + + /** +- * qman_dqrr_consume - Consume the DQRR entriy after volatile dequeue ++ * qman_dqrr_consume - Consume the DQRR entry after volatile dequeue + * @fq: Frame Queue on which the volatile dequeue command is issued + * @dq: DQRR entry to consume. This is the one which is provided by the + * 'qbman_dequeue' command. +@@ -2017,7 +2017,7 @@ int qman_create_cgr_to_dcp(struct qman_cgr *cgr, u32 flags, u16 dcp_portal, + * @cgr: the 'cgr' object to deregister + * + * "Unplugs" this CGR object from the portal affine to the cpu on which this API +- * is executed. This must be excuted on the same affine portal on which it was ++ * is executed. This must be executed on the same affine portal on which it was + * created. + */ + __rte_internal +diff --git a/drivers/bus/dpaa/include/fsl_usd.h b/drivers/bus/dpaa/include/fsl_usd.h +index dcf35e4adb..97279421ad 100644 +--- a/drivers/bus/dpaa/include/fsl_usd.h ++++ b/drivers/bus/dpaa/include/fsl_usd.h +@@ -40,7 +40,7 @@ struct dpaa_raw_portal { + /* Specifies the stash request queue this portal should use */ + uint8_t sdest; + +- /* Specifes a specific portal index to map or QBMAN_ANY_PORTAL_IDX ++ /* Specifies a specific portal index to map or QBMAN_ANY_PORTAL_IDX + * for don't care. The portal index will be populated by the + * driver when the ioctl() successfully completes. + */ +diff --git a/drivers/bus/dpaa/include/process.h b/drivers/bus/dpaa/include/process.h +index a922988607..48d6b5693f 100644 +--- a/drivers/bus/dpaa/include/process.h ++++ b/drivers/bus/dpaa/include/process.h +@@ -49,7 +49,7 @@ struct dpaa_portal_map { + struct dpaa_ioctl_portal_map { + /* Input parameter, is a qman or bman portal required. */ + enum dpaa_portal_type type; +- /* Specifes a specific portal index to map or 0xffffffff ++ /* Specifies a specific portal index to map or 0xffffffff + * for don't care. + */ + uint32_t index; +diff --git a/drivers/bus/fslmc/fslmc_bus.c b/drivers/bus/fslmc/fslmc_bus.c +index a0ef24cdc8..53fd75539e 100644 +--- a/drivers/bus/fslmc/fslmc_bus.c ++++ b/drivers/bus/fslmc/fslmc_bus.c +@@ -539,7 +539,7 @@ rte_fslmc_driver_unregister(struct rte_dpaa2_driver *driver) + + fslmc_bus = driver->fslmc_bus; + +- /* Cleanup the PA->VA Translation table; From whereever this function ++ /* Cleanup the PA->VA Translation table; From wherever this function + * is called from. + */ + if (rte_eal_iova_mode() == RTE_IOVA_PA) +diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c +index 2210a0fa4a..52605ea2c3 100644 +--- a/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c ++++ b/drivers/bus/fslmc/portal/dpaa2_hw_dpio.c +@@ -178,7 +178,7 @@ static int dpaa2_dpio_intr_init(struct dpaa2_dpio_dev *dpio_dev) + dpio_epoll_fd = epoll_create(1); + ret = rte_dpaa2_intr_enable(dpio_dev->intr_handle, 0); + if (ret) { +- DPAA2_BUS_ERR("Interrupt registeration failed"); ++ DPAA2_BUS_ERR("Interrupt registration failed"); + return -1; + } + +diff --git a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h +index b1bba1ac36..957fc62d4c 100644 +--- a/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h ++++ b/drivers/bus/fslmc/portal/dpaa2_hw_pvt.h +@@ -156,7 +156,7 @@ struct dpaa2_queue { + struct rte_cryptodev_data *crypto_data; + }; + uint32_t fqid; /*!< Unique ID of this queue */ +- uint16_t flow_id; /*!< To be used by DPAA2 frmework */ ++ uint16_t flow_id; /*!< To be used by DPAA2 framework */ + uint8_t tc_index; /*!< traffic class identifier */ + uint8_t cgid; /*! < Congestion Group id for this queue */ + uint64_t rx_pkts; +diff --git a/drivers/bus/fslmc/qbman/include/fsl_qbman_portal.h b/drivers/bus/fslmc/qbman/include/fsl_qbman_portal.h +index eb68c9cab5..5375ea386d 100644 +--- a/drivers/bus/fslmc/qbman/include/fsl_qbman_portal.h ++++ b/drivers/bus/fslmc/qbman/include/fsl_qbman_portal.h +@@ -510,7 +510,7 @@ int qbman_result_has_new_result(struct qbman_swp *s, + struct qbman_result *dq); + + /** +- * qbman_check_command_complete() - Check if the previous issued dq commnd ++ * qbman_check_command_complete() - Check if the previous issued dq command + * is completed and results are available in memory. + * @s: the software portal object. + * @dq: the dequeue result read from the memory. +@@ -687,7 +687,7 @@ uint16_t qbman_result_DQ_seqnum(const struct qbman_result *dq); + + /** + * qbman_result_DQ_odpid() - Get the seqnum field in dequeue response +- * odpid is valid only if ODPVAILD flag is TRUE. ++ * odpid is valid only if ODPVALID flag is TRUE. + * @dq: the dequeue result. + * + * Return odpid. +@@ -743,7 +743,7 @@ const struct qbman_fd *qbman_result_DQ_fd(const struct qbman_result *dq); + * qbman_result_SCN_state() - Get the state field in State-change notification + * @scn: the state change notification. + * +- * Return the state in the notifiation. ++ * Return the state in the notification. + */ + __rte_internal + uint8_t qbman_result_SCN_state(const struct qbman_result *scn); +@@ -825,7 +825,7 @@ uint64_t qbman_result_bpscn_ctx(const struct qbman_result *scn); + + /* Parsing CGCU */ + /** +- * qbman_result_cgcu_cgid() - Check CGCU resouce id, i.e. cgid ++ * qbman_result_cgcu_cgid() - Check CGCU resource id, i.e. cgid + * @scn: the state change notification. + * + * Return the CGCU resource id. +@@ -903,14 +903,14 @@ void qbman_eq_desc_clear(struct qbman_eq_desc *d); + __rte_internal + void qbman_eq_desc_set_no_orp(struct qbman_eq_desc *d, int respond_success); + /** +- * qbman_eq_desc_set_orp() - Set order-resotration in the enqueue descriptor ++ * qbman_eq_desc_set_orp() - Set order-restoration in the enqueue descriptor + * @d: the enqueue descriptor. + * @response_success: 1 = enqueue with response always; 0 = enqueue with + * rejections returned on a FQ. + * @opr_id: the order point record id. + * @seqnum: the order restoration sequence number. +- * @incomplete: indiates whether this is the last fragments using the same +- * sequeue number. ++ * @incomplete: indicates whether this is the last fragments using the same ++ * sequence number. + */ + __rte_internal + void qbman_eq_desc_set_orp(struct qbman_eq_desc *d, int respond_success, +@@ -1052,10 +1052,10 @@ __rte_internal + uint8_t qbman_result_eqresp_rspid(struct qbman_result *eqresp); + + /** +- * qbman_result_eqresp_rc() - determines if enqueue command is sucessful. ++ * qbman_result_eqresp_rc() - determines if enqueue command is successful. + * @eqresp: enqueue response. + * +- * Return 0 when command is sucessful. ++ * Return 0 when command is successful. + */ + __rte_internal + uint8_t qbman_result_eqresp_rc(struct qbman_result *eqresp); +@@ -1250,7 +1250,7 @@ int qbman_swp_fq_force(struct qbman_swp *s, uint32_t fqid); + /** + * These functions change the FQ flow-control stuff between XON/XOFF. (The + * default is XON.) This setting doesn't affect enqueues to the FQ, just +- * dequeues. XOFF FQs will remain in the tenatively-scheduled state, even when ++ * dequeues. XOFF FQs will remain in the tentatively-scheduled state, even when + * non-empty, meaning they won't be selected for scheduled dequeuing. If a FQ is + * changed to XOFF after it had already become truly-scheduled to a channel, and + * a pull dequeue of that channel occurs that selects that FQ for dequeuing, +diff --git a/drivers/bus/pci/linux/pci_vfio.c b/drivers/bus/pci/linux/pci_vfio.c +index 1a5e7c2d2a..cd0d0b1670 100644 +--- a/drivers/bus/pci/linux/pci_vfio.c ++++ b/drivers/bus/pci/linux/pci_vfio.c +@@ -815,7 +815,7 @@ pci_vfio_map_resource_primary(struct rte_pci_device *dev) + continue; + } + +- /* skip non-mmapable BARs */ ++ /* skip non-mmappable BARs */ + if ((reg->flags & VFIO_REGION_INFO_FLAG_MMAP) == 0) { + free(reg); + continue; +diff --git a/drivers/bus/vdev/rte_bus_vdev.h b/drivers/bus/vdev/rte_bus_vdev.h +index 2856799953..5af6be009f 100644 +--- a/drivers/bus/vdev/rte_bus_vdev.h ++++ b/drivers/bus/vdev/rte_bus_vdev.h +@@ -197,7 +197,7 @@ rte_vdev_remove_custom_scan(rte_vdev_scan_callback callback, void *user_arg); + int rte_vdev_init(const char *name, const char *args); + + /** +- * Uninitalize a driver specified by name. ++ * Uninitialize a driver specified by name. + * + * @param name + * The pointer to a driver name to be uninitialized. +diff --git a/drivers/bus/vmbus/vmbus_common.c b/drivers/bus/vmbus/vmbus_common.c +index 519ca9c6fe..367727367e 100644 +--- a/drivers/bus/vmbus/vmbus_common.c ++++ b/drivers/bus/vmbus/vmbus_common.c +@@ -134,7 +134,7 @@ vmbus_probe_one_driver(struct rte_vmbus_driver *dr, + + /* + * If device class GUID matches, call the probe function of +- * registere drivers for the vmbus device. ++ * register drivers for the vmbus device. + * Return -1 if initialization failed, + * and 1 if no driver found for this device. + */ +diff --git a/drivers/common/cnxk/roc_bphy_cgx.c b/drivers/common/cnxk/roc_bphy_cgx.c +index 7449cbe77a..c3be3c9041 100644 +--- a/drivers/common/cnxk/roc_bphy_cgx.c ++++ b/drivers/common/cnxk/roc_bphy_cgx.c +@@ -14,7 +14,7 @@ + #define CGX_CMRX_INT_OVERFLW BIT_ULL(1) + /* + * CN10K stores number of lmacs in 4 bit filed +- * in contraty to CN9K which uses only 3 bits. ++ * in contrary to CN9K which uses only 3 bits. + * + * In theory masks should differ yet on CN9K + * bits beyond specified range contain zeros. +diff --git a/drivers/common/cnxk/roc_nix_bpf.c b/drivers/common/cnxk/roc_nix_bpf.c +index 6996a54be0..4941f62995 100644 +--- a/drivers/common/cnxk/roc_nix_bpf.c ++++ b/drivers/common/cnxk/roc_nix_bpf.c +@@ -138,7 +138,7 @@ nix_lf_bpf_dump(__io struct nix_band_prof_s *bpf) + { + plt_dump("W0: cir_mantissa \t\t\t%d\nW0: pebs_mantissa \t\t\t0x%03x", + bpf->cir_mantissa, bpf->pebs_mantissa); +- plt_dump("W0: peir_matissa \t\t\t\t%d\nW0: cbs_exponent \t\t\t%d", ++ plt_dump("W0: peir_mantissa \t\t\t\t%d\nW0: cbs_exponent \t\t\t%d", + bpf->peir_mantissa, bpf->cbs_exponent); + plt_dump("W0: cir_exponent \t\t\t%d\nW0: pebs_exponent \t\t\t%d", + bpf->cir_exponent, bpf->pebs_exponent); +diff --git a/drivers/common/cnxk/roc_nix_tm_ops.c b/drivers/common/cnxk/roc_nix_tm_ops.c +index 3257fa67c7..3d81247a12 100644 +--- a/drivers/common/cnxk/roc_nix_tm_ops.c ++++ b/drivers/common/cnxk/roc_nix_tm_ops.c +@@ -107,7 +107,7 @@ nix_tm_adjust_shaper_pps_rate(struct nix_tm_shaper_profile *profile) + if (profile->peak.rate && min_rate > profile->peak.rate) + min_rate = profile->peak.rate; + +- /* Each packet accomulate single count, whereas HW ++ /* Each packet accumulate single count, whereas HW + * considers each unit as Byte, so we need convert + * user pps to bps + */ +diff --git a/drivers/common/cnxk/roc_npc_mcam.c b/drivers/common/cnxk/roc_npc_mcam.c +index ba7f89b45b..82014a2ca0 100644 +--- a/drivers/common/cnxk/roc_npc_mcam.c ++++ b/drivers/common/cnxk/roc_npc_mcam.c +@@ -234,7 +234,7 @@ npc_get_kex_capability(struct npc *npc) + /* Ethtype: Offset 12B, len 2B */ + kex_cap.bit.ethtype_0 = npc_is_kex_enabled( + npc, NPC_LID_LA, NPC_LT_LA_ETHER, 12 * 8, 2 * 8); +- /* QINQ VLAN Ethtype: ofset 8B, len 2B */ ++ /* QINQ VLAN Ethtype: offset 8B, len 2B */ + kex_cap.bit.ethtype_x = npc_is_kex_enabled( + npc, NPC_LID_LB, NPC_LT_LB_STAG_QINQ, 8 * 8, 2 * 8); + /* VLAN ID0 : Outer VLAN: Offset 2B, len 2B */ +diff --git a/drivers/common/cnxk/roc_npc_priv.h b/drivers/common/cnxk/roc_npc_priv.h +index 712302bc5c..74e0fb2ece 100644 +--- a/drivers/common/cnxk/roc_npc_priv.h ++++ b/drivers/common/cnxk/roc_npc_priv.h +@@ -363,7 +363,7 @@ struct npc { + uint32_t rss_grps; /* rss groups supported */ + uint16_t flow_prealloc_size; /* Pre allocated mcam size */ + uint16_t flow_max_priority; /* Max priority for flow */ +- uint16_t switch_header_type; /* Suppprted switch header type */ ++ uint16_t switch_header_type; /* Supported switch header type */ + uint32_t mark_actions; /* Number of mark actions */ + uint32_t vtag_strip_actions; /* vtag insert/strip actions */ + uint16_t pf_func; /* pf_func of device */ +diff --git a/drivers/common/cpt/cpt_ucode.h b/drivers/common/cpt/cpt_ucode.h +index e015cf66a1..e1f2f6005d 100644 +--- a/drivers/common/cpt/cpt_ucode.h ++++ b/drivers/common/cpt/cpt_ucode.h +@@ -246,7 +246,7 @@ cpt_fc_ciph_set_key(struct cpt_ctx *cpt_ctx, cipher_type_t type, + if (cpt_ctx->fc_type == FC_GEN) { + /* + * We need to always say IV is from DPTR as user can +- * sometimes iverride IV per operation. ++ * sometimes override IV per operation. + */ + fctx->enc.iv_source = CPT_FROM_DPTR; + +@@ -3035,7 +3035,7 @@ prepare_iov_from_pkt_inplace(struct rte_mbuf *pkt, + tailroom = rte_pktmbuf_tailroom(pkt); + if (likely((headroom >= 24) && + (tailroom >= 8))) { +- /* In 83XX this is prerequivisit for Direct mode */ ++ /* In 83XX this is prerequisite for Direct mode */ + *flags |= SINGLE_BUF_HEADTAILROOM; + } + param->bufs[0].vaddr = seg_data; +diff --git a/drivers/common/cpt/cpt_ucode_asym.h b/drivers/common/cpt/cpt_ucode_asym.h +index a67ded642a..f0b5dddd8c 100644 +--- a/drivers/common/cpt/cpt_ucode_asym.h ++++ b/drivers/common/cpt/cpt_ucode_asym.h +@@ -779,7 +779,7 @@ cpt_ecdsa_verify_prep(struct rte_crypto_ecdsa_op_param *ecdsa, + * Set dlen = sum(sizeof(fpm address), ROUNDUP8(message len), + * ROUNDUP8(sign len(r and s), public key len(x and y coordinates), + * prime len, order len)). +- * Please note sign, public key and order can not excede prime length ++ * Please note sign, public key and order can not exceed prime length + * i.e. 6 * p_align + */ + dlen = sizeof(fpm_table_iova) + m_align + (8 * p_align); +diff --git a/drivers/common/dpaax/caamflib/desc/algo.h b/drivers/common/dpaax/caamflib/desc/algo.h +index 6bb915054a..e0848f0940 100644 +--- a/drivers/common/dpaax/caamflib/desc/algo.h ++++ b/drivers/common/dpaax/caamflib/desc/algo.h +@@ -67,7 +67,7 @@ cnstr_shdsc_zuce(uint32_t *descbuf, bool ps, bool swap, + * @authlen: size of digest + * + * The IV prepended before hmac payload must be 8 bytes consisting +- * of COUNT||BEAERER||DIR. The COUNT is of 32-bits, bearer is of 5 bits and ++ * of COUNT||BEARER||DIR. The COUNT is of 32-bits, bearer is of 5 bits and + * direction is of 1 bit - totalling to 38 bits. + * + * Return: size of descriptor written in words or negative number on error +diff --git a/drivers/common/dpaax/caamflib/desc/sdap.h b/drivers/common/dpaax/caamflib/desc/sdap.h +index b2497a5424..07f55b5b40 100644 +--- a/drivers/common/dpaax/caamflib/desc/sdap.h ++++ b/drivers/common/dpaax/caamflib/desc/sdap.h +@@ -492,10 +492,10 @@ pdcp_sdap_insert_snoop_op(struct program *p, bool swap __maybe_unused, + + /* Set the variable size of data the register will write */ + if (dir == OP_TYPE_ENCAP_PROTOCOL) { +- /* We will add the interity data so add its length */ ++ /* We will add the integrity data so add its length */ + MATHI(p, SEQINSZ, ADD, PDCP_MAC_I_LEN, VSEQOUTSZ, 4, IMMED2); + } else { +- /* We will check the interity data so remove its length */ ++ /* We will check the integrity data so remove its length */ + MATHI(p, SEQINSZ, SUB, PDCP_MAC_I_LEN, VSEQOUTSZ, 4, IMMED2); + /* Do not take the ICV in the out-snooping configuration */ + MATHI(p, SEQINSZ, SUB, PDCP_MAC_I_LEN, VSEQINSZ, 4, IMMED2); +@@ -803,7 +803,7 @@ static inline int pdcp_sdap_insert_no_snoop_op( + CLRW_CLR_C1MODE, + CLRW, 0, 4, IMMED); + +- /* Load the key for authentcation */ ++ /* Load the key for authentication */ + KEY(p, KEY1, authdata->key_enc_flags, authdata->key, + authdata->keylen, INLINE_KEY(authdata)); + +diff --git a/drivers/common/dpaax/dpaax_iova_table.c b/drivers/common/dpaax/dpaax_iova_table.c +index 3d661102cc..9daac4bc03 100644 +--- a/drivers/common/dpaax/dpaax_iova_table.c ++++ b/drivers/common/dpaax/dpaax_iova_table.c +@@ -261,7 +261,7 @@ dpaax_iova_table_depopulate(void) + rte_free(dpaax_iova_table_p->entries); + dpaax_iova_table_p = NULL; + +- DPAAX_DEBUG("IOVA Table cleanedup"); ++ DPAAX_DEBUG("IOVA Table cleaned"); + } + + int +diff --git a/drivers/common/iavf/iavf_type.h b/drivers/common/iavf/iavf_type.h +index 51267ca3b3..1cd87587d6 100644 +--- a/drivers/common/iavf/iavf_type.h ++++ b/drivers/common/iavf/iavf_type.h +@@ -1006,7 +1006,7 @@ struct iavf_profile_tlv_section_record { + u8 data[12]; + }; + +-/* Generic AQ section in proflie */ ++/* Generic AQ section in profile */ + struct iavf_profile_aq_section { + u16 opcode; + u16 flags; +diff --git a/drivers/common/iavf/virtchnl.h b/drivers/common/iavf/virtchnl.h +index 269578f7c0..80e754a1b2 100644 +--- a/drivers/common/iavf/virtchnl.h ++++ b/drivers/common/iavf/virtchnl.h +@@ -233,7 +233,7 @@ static inline const char *virtchnl_op_str(enum virtchnl_ops v_opcode) + case VIRTCHNL_OP_DCF_CMD_DESC: + return "VIRTCHNL_OP_DCF_CMD_DESC"; + case VIRTCHNL_OP_DCF_CMD_BUFF: +- return "VIRTCHHNL_OP_DCF_CMD_BUFF"; ++ return "VIRTCHNL_OP_DCF_CMD_BUFF"; + case VIRTCHNL_OP_DCF_DISABLE: + return "VIRTCHNL_OP_DCF_DISABLE"; + case VIRTCHNL_OP_DCF_GET_VSI_MAP: +diff --git a/drivers/common/mlx5/mlx5_common.c b/drivers/common/mlx5/mlx5_common.c +index f1650f94c6..cc13022150 100644 +--- a/drivers/common/mlx5/mlx5_common.c ++++ b/drivers/common/mlx5/mlx5_common.c +@@ -854,7 +854,7 @@ static void mlx5_common_driver_init(void) + static bool mlx5_common_initialized; + + /** +- * One time innitialization routine for run-time dependency on glue library ++ * One time initialization routine for run-time dependency on glue library + * for multiple PMDs. Each mlx5 PMD that depends on mlx5_common module, + * must invoke in its constructor. + */ +diff --git a/drivers/common/mlx5/mlx5_common_mr.c b/drivers/common/mlx5/mlx5_common_mr.c +index c694aaf28c..1537b5d428 100644 +--- a/drivers/common/mlx5/mlx5_common_mr.c ++++ b/drivers/common/mlx5/mlx5_common_mr.c +@@ -1541,7 +1541,7 @@ mlx5_mempool_reg_create(struct rte_mempool *mp, unsigned int mrs_n, + * Destroy a mempool registration object. + * + * @param standalone +- * Whether @p mpr owns its MRs excludively, i.e. they are not shared. ++ * Whether @p mpr owns its MRs exclusively, i.e. they are not shared. + */ + static void + mlx5_mempool_reg_destroy(struct mlx5_mr_share_cache *share_cache, +diff --git a/drivers/common/mlx5/mlx5_devx_cmds.c b/drivers/common/mlx5/mlx5_devx_cmds.c +index e52b995ee3..7cd3d4fa98 100644 +--- a/drivers/common/mlx5/mlx5_devx_cmds.c ++++ b/drivers/common/mlx5/mlx5_devx_cmds.c +@@ -1822,7 +1822,7 @@ mlx5_devx_cmd_create_td(void *ctx) + * Pointer to file stream. + * + * @return +- * 0 on success, a nagative value otherwise. ++ * 0 on success, a negative value otherwise. + */ + int + mlx5_devx_cmd_flow_dump(void *fdb_domain __rte_unused, +diff --git a/drivers/common/mlx5/mlx5_malloc.c b/drivers/common/mlx5/mlx5_malloc.c +index b19501e1bc..cef3b88e11 100644 +--- a/drivers/common/mlx5/mlx5_malloc.c ++++ b/drivers/common/mlx5/mlx5_malloc.c +@@ -58,7 +58,7 @@ static struct mlx5_sys_mem mlx5_sys_mem = { + * Check if the address belongs to memory seg list. + * + * @param addr +- * Memory address to be ckeced. ++ * Memory address to be checked. + * @param msl + * Memory seg list. + * +@@ -109,7 +109,7 @@ mlx5_mem_update_msl(void *addr) + * Check if the address belongs to rte memory. + * + * @param addr +- * Memory address to be ckeced. ++ * Memory address to be checked. + * + * @return + * True if it belongs, false otherwise. +diff --git a/drivers/common/mlx5/mlx5_malloc.h b/drivers/common/mlx5/mlx5_malloc.h +index 74b7eeb26e..92149f7b92 100644 +--- a/drivers/common/mlx5/mlx5_malloc.h ++++ b/drivers/common/mlx5/mlx5_malloc.h +@@ -19,7 +19,7 @@ extern "C" { + + enum mlx5_mem_flags { + MLX5_MEM_ANY = 0, +- /* Memory will be allocated dpends on sys_mem_en. */ ++ /* Memory will be allocated depends on sys_mem_en. */ + MLX5_MEM_SYS = 1 << 0, + /* Memory should be allocated from system. */ + MLX5_MEM_RTE = 1 << 1, +diff --git a/drivers/common/mlx5/mlx5_prm.h b/drivers/common/mlx5/mlx5_prm.h +index 2ded67e85e..982a53ffbe 100644 +--- a/drivers/common/mlx5/mlx5_prm.h ++++ b/drivers/common/mlx5/mlx5_prm.h +@@ -4172,7 +4172,7 @@ mlx5_flow_mark_get(uint32_t val) + * timestamp format supported by the queue. + * + * @return +- * Converted timstamp format settings. ++ * Converted timestamp format settings. + */ + static inline uint32_t + mlx5_ts_format_conv(uint32_t ts_format) +diff --git a/drivers/common/mlx5/windows/mlx5_common_os.c b/drivers/common/mlx5/windows/mlx5_common_os.c +index 162c7476cc..c3cfc315f2 100644 +--- a/drivers/common/mlx5/windows/mlx5_common_os.c ++++ b/drivers/common/mlx5/windows/mlx5_common_os.c +@@ -302,7 +302,7 @@ mlx5_os_umem_dereg(void *pumem) + } + + /** +- * Register mr. Given protection doamin pointer, pointer to addr and length ++ * Register mr. Given protection domain pointer, pointer to addr and length + * register the memory region. + * + * @param[in] pd +@@ -310,7 +310,7 @@ mlx5_os_umem_dereg(void *pumem) + * @param[in] addr + * Pointer to memory start address (type devx_device_ctx). + * @param[in] length +- * Lengtoh of the memory to register. ++ * Length of the memory to register. + * @param[out] pmd_mr + * pmd_mr struct set with lkey, address, length, pointer to mr object, mkey + * +diff --git a/drivers/common/mlx5/windows/mlx5_common_os.h b/drivers/common/mlx5/windows/mlx5_common_os.h +index 3afce56cd9..61fc8dd761 100644 +--- a/drivers/common/mlx5/windows/mlx5_common_os.h ++++ b/drivers/common/mlx5/windows/mlx5_common_os.h +@@ -21,7 +21,7 @@ + /** + * This API allocates aligned or non-aligned memory. The free can be on either + * aligned or nonaligned memory. To be protected - even though there may be no +- * alignment - in Windows this API will unconditioanlly call _aligned_malloc() ++ * alignment - in Windows this API will unconditionally call _aligned_malloc() + * with at least a minimal alignment size. + * + * @param[in] align +diff --git a/drivers/common/qat/qat_adf/adf_transport_access_macros.h b/drivers/common/qat/qat_adf/adf_transport_access_macros.h +index a6d403fac3..12a7258c60 100644 +--- a/drivers/common/qat/qat_adf/adf_transport_access_macros.h ++++ b/drivers/common/qat/qat_adf/adf_transport_access_macros.h +@@ -72,7 +72,7 @@ + #define ADF_SIZE_TO_RING_SIZE_IN_BYTES(SIZE) ((1 << (SIZE - 1)) << 7) + #define ADF_RING_SIZE_IN_BYTES_TO_SIZE(SIZE) ((1 << (SIZE - 1)) >> 7) + +-/* Minimum ring bufer size for memory allocation */ ++/* Minimum ring buffer size for memory allocation */ + #define ADF_RING_SIZE_BYTES_MIN(SIZE) ((SIZE < ADF_RING_SIZE_4K) ? \ + ADF_RING_SIZE_4K : SIZE) + #define ADF_RING_SIZE_MODULO(SIZE) (SIZE + 0x6) +diff --git a/drivers/common/sfc_efx/efsys.h b/drivers/common/sfc_efx/efsys.h +index 3860c2835a..224254bee7 100644 +--- a/drivers/common/sfc_efx/efsys.h ++++ b/drivers/common/sfc_efx/efsys.h +@@ -616,7 +616,7 @@ typedef struct efsys_bar_s { + + #define EFSYS_DMA_SYNC_FOR_KERNEL(_esmp, _offset, _size) ((void)0) + +-/* Just avoid store and compiler (impliciltly) reordering */ ++/* Just avoid store and compiler (implicitly) reordering */ + #define EFSYS_DMA_SYNC_FOR_DEVICE(_esmp, _offset, _size) rte_wmb() + + /* TIMESTAMP */ +diff --git a/drivers/compress/octeontx/include/zip_regs.h b/drivers/compress/octeontx/include/zip_regs.h +index 96e538bb75..94a48cde66 100644 +--- a/drivers/compress/octeontx/include/zip_regs.h ++++ b/drivers/compress/octeontx/include/zip_regs.h +@@ -195,7 +195,7 @@ union zip_inst_s { + uint64_t bf : 1; + /** Comp/decomp operation */ + uint64_t op : 2; +- /** Data sactter */ ++ /** Data scatter */ + uint64_t ds : 1; + /** Data gather */ + uint64_t dg : 1; +@@ -376,7 +376,7 @@ union zip_inst_s { + uint64_t bf : 1; + /** Comp/decomp operation */ + uint64_t op : 2; +- /** Data sactter */ ++ /** Data scatter */ + uint64_t ds : 1; + /** Data gather */ + uint64_t dg : 1; +diff --git a/drivers/compress/octeontx/otx_zip.h b/drivers/compress/octeontx/otx_zip.h +index e43f7f5c3e..118a95d738 100644 +--- a/drivers/compress/octeontx/otx_zip.h ++++ b/drivers/compress/octeontx/otx_zip.h +@@ -31,7 +31,7 @@ extern int octtx_zip_logtype_driver; + /**< PCI device id of ZIP VF */ + #define PCI_DEVICE_ID_OCTEONTX_ZIPVF 0xA037 + +-/* maxmum number of zip vf devices */ ++/* maximum number of zip vf devices */ + #define ZIP_MAX_VFS 8 + + /* max size of one chunk */ +diff --git a/drivers/compress/qat/qat_comp_pmd.c b/drivers/compress/qat/qat_comp_pmd.c +index 9b24d46e97..da6404c017 100644 +--- a/drivers/compress/qat/qat_comp_pmd.c ++++ b/drivers/compress/qat/qat_comp_pmd.c +@@ -463,7 +463,7 @@ qat_comp_create_stream_pool(struct qat_comp_dev_private *comp_dev, + } else if (info.error) { + rte_mempool_obj_iter(mp, qat_comp_stream_destroy, NULL); + QAT_LOG(ERR, +- "Destoying mempool %s as at least one element failed initialisation", ++ "Destroying mempool %s as at least one element failed initialisation", + stream_pool_name); + rte_mempool_free(mp); + mp = NULL; +diff --git a/drivers/crypto/bcmfs/bcmfs_device.h b/drivers/crypto/bcmfs/bcmfs_device.h +index e5ca866977..4901a6cfd9 100644 +--- a/drivers/crypto/bcmfs/bcmfs_device.h ++++ b/drivers/crypto/bcmfs/bcmfs_device.h +@@ -32,7 +32,7 @@ enum bcmfs_device_type { + BCMFS_UNKNOWN + }; + +-/* A table to store registered queue pair opertations */ ++/* A table to store registered queue pair operations */ + struct bcmfs_hw_queue_pair_ops_table { + rte_spinlock_t tl; + /* Number of used ops structs in the table. */ +diff --git a/drivers/crypto/bcmfs/bcmfs_qp.c b/drivers/crypto/bcmfs/bcmfs_qp.c +index cb5ff6c61b..61d457f4e0 100644 +--- a/drivers/crypto/bcmfs/bcmfs_qp.c ++++ b/drivers/crypto/bcmfs/bcmfs_qp.c +@@ -212,7 +212,7 @@ bcmfs_qp_setup(struct bcmfs_qp **qp_addr, + nb_descriptors = FS_RM_MAX_REQS; + + if (qp_conf->iobase == NULL) { +- BCMFS_LOG(ERR, "IO onfig space null"); ++ BCMFS_LOG(ERR, "IO config space null"); + return -EINVAL; + } + +diff --git a/drivers/crypto/bcmfs/bcmfs_sym_defs.h b/drivers/crypto/bcmfs/bcmfs_sym_defs.h +index eaefe97e26..9bb8a695a0 100644 +--- a/drivers/crypto/bcmfs/bcmfs_sym_defs.h ++++ b/drivers/crypto/bcmfs/bcmfs_sym_defs.h +@@ -20,11 +20,11 @@ struct bcmfs_sym_request; + + /** Crypto Request processing successful. */ + #define BCMFS_SYM_RESPONSE_SUCCESS (0) +-/** Crypot Request processing protocol failure. */ ++/** Crypto Request processing protocol failure. */ + #define BCMFS_SYM_RESPONSE_PROTO_FAILURE (1) +-/** Crypot Request processing completion failure. */ ++/** Crypto Request processing completion failure. */ + #define BCMFS_SYM_RESPONSE_COMPL_ERROR (2) +-/** Crypot Request processing hash tag check error. */ ++/** Crypto Request processing hash tag check error. */ + #define BCMFS_SYM_RESPONSE_HASH_TAG_ERROR (3) + + /** Maximum threshold length to adjust AAD in continuation +diff --git a/drivers/crypto/bcmfs/bcmfs_sym_engine.h b/drivers/crypto/bcmfs/bcmfs_sym_engine.h +index d9594246b5..51ff9f75ed 100644 +--- a/drivers/crypto/bcmfs/bcmfs_sym_engine.h ++++ b/drivers/crypto/bcmfs/bcmfs_sym_engine.h +@@ -12,7 +12,7 @@ + #include "bcmfs_sym_defs.h" + #include "bcmfs_sym_req.h" + +-/* structure to hold element's arrtibutes */ ++/* structure to hold element's attributes */ + struct fsattr { + void *va; + uint64_t pa; +diff --git a/drivers/crypto/bcmfs/hw/bcmfs5_rm.c b/drivers/crypto/bcmfs/hw/bcmfs5_rm.c +index 86e53051dd..c677c0cd9b 100644 +--- a/drivers/crypto/bcmfs/hw/bcmfs5_rm.c ++++ b/drivers/crypto/bcmfs/hw/bcmfs5_rm.c +@@ -441,7 +441,7 @@ static void bcmfs5_write_doorbell(struct bcmfs_qp *qp) + { + struct bcmfs_queue *txq = &qp->tx_q; + +- /* sync in bfeore ringing the door-bell */ ++ /* sync in before ringing the door-bell */ + rte_wmb(); + + FS_MMIO_WRITE32(txq->descs_inflight, +diff --git a/drivers/crypto/caam_jr/caam_jr_hw_specific.h b/drivers/crypto/caam_jr/caam_jr_hw_specific.h +index bbe8bc3f90..6ee7f7cef3 100644 +--- a/drivers/crypto/caam_jr/caam_jr_hw_specific.h ++++ b/drivers/crypto/caam_jr/caam_jr_hw_specific.h +@@ -376,7 +376,7 @@ struct sec_job_ring_t { + void *register_base_addr; /* Base address for SEC's + * register memory for this job ring. + */ +- uint8_t coalescing_en; /* notifies if coelescing is ++ uint8_t coalescing_en; /* notifies if coalescing is + * enabled for the job ring + */ + sec_job_ring_state_t jr_state; /* The state of this job ring */ +@@ -479,7 +479,7 @@ void hw_job_ring_error_print(struct sec_job_ring_t *job_ring, int code); + + /* @brief Set interrupt coalescing parameters on the Job Ring. + * @param [in] job_ring The job ring +- * @param [in] irq_coalesing_timer Interrupt coalescing timer threshold. ++ * @param [in] irq_coalescing_timer Interrupt coalescing timer threshold. + * This value determines the maximum + * amount of time after processing a + * descriptor before raising an interrupt. +diff --git a/drivers/crypto/caam_jr/caam_jr_pvt.h b/drivers/crypto/caam_jr/caam_jr_pvt.h +index 552d6b9b1b..52f872bcd0 100644 +--- a/drivers/crypto/caam_jr/caam_jr_pvt.h ++++ b/drivers/crypto/caam_jr/caam_jr_pvt.h +@@ -169,7 +169,7 @@ struct sec4_sg_entry { + + /* Structure encompassing a job descriptor which is to be processed + * by SEC. User should also initialise this structure with the callback +- * function pointer which will be called by driver after recieving proccessed ++ * function pointer which will be called by driver after receiving processed + * descriptor from SEC. User data is also passed in this data structure which + * will be sent as an argument to the user callback function. + */ +@@ -288,7 +288,7 @@ int caam_jr_enable_irqs(int uio_fd); + * value that indicates an IRQ disable action into UIO file descriptor + * of this job ring. + * +- * @param [in] uio_fd UIO File descripto ++ * @param [in] uio_fd UIO File descriptor + * @retval 0 for success + * @retval -1 value for error + * +diff --git a/drivers/crypto/caam_jr/caam_jr_uio.c b/drivers/crypto/caam_jr/caam_jr_uio.c +index e4ee102344..583ba3b523 100644 +--- a/drivers/crypto/caam_jr/caam_jr_uio.c ++++ b/drivers/crypto/caam_jr/caam_jr_uio.c +@@ -227,7 +227,7 @@ caam_jr_enable_irqs(int uio_fd) + * value that indicates an IRQ disable action into UIO file descriptor + * of this job ring. + * +- * @param [in] uio_fd UIO File descripto ++ * @param [in] uio_fd UIO File descriptor + * @retval 0 for success + * @retval -1 value for error + * +diff --git a/drivers/crypto/ccp/ccp_crypto.c b/drivers/crypto/ccp/ccp_crypto.c +index 70daed791e..4ed91a7436 100644 +--- a/drivers/crypto/ccp/ccp_crypto.c ++++ b/drivers/crypto/ccp/ccp_crypto.c +@@ -1299,7 +1299,7 @@ ccp_auth_slot(struct ccp_session *session) + case CCP_AUTH_ALGO_SHA512_HMAC: + /** + * 1. Load PHash1 = H(k ^ ipad); to LSB +- * 2. generate IHash = H(hash on meassage with PHash1 ++ * 2. generate IHash = H(hash on message with PHash1 + * as init values); + * 3. Retrieve IHash 2 slots for 384/512 + * 4. Load Phash2 = H(k ^ opad); to LSB +diff --git a/drivers/crypto/ccp/ccp_crypto.h b/drivers/crypto/ccp/ccp_crypto.h +index 8e6d03efc8..d307f73ee4 100644 +--- a/drivers/crypto/ccp/ccp_crypto.h ++++ b/drivers/crypto/ccp/ccp_crypto.h +@@ -70,7 +70,7 @@ + /* Maximum length for digest */ + #define DIGEST_LENGTH_MAX 64 + +-/* SHA LSB intialiazation values */ ++/* SHA LSB initialization values */ + + #define SHA1_H0 0x67452301UL + #define SHA1_H1 0xefcdab89UL +diff --git a/drivers/crypto/ccp/ccp_dev.h b/drivers/crypto/ccp/ccp_dev.h +index 85c8fc47a2..2a205cd446 100644 +--- a/drivers/crypto/ccp/ccp_dev.h ++++ b/drivers/crypto/ccp/ccp_dev.h +@@ -19,7 +19,7 @@ + #include + #include + +-/**< CCP sspecific */ ++/**< CCP specific */ + #define MAX_HW_QUEUES 5 + #define CCP_MAX_TRNG_RETRIES 10 + #define CCP_ALIGN(x, y) ((((x) + (y - 1)) / y) * y) +diff --git a/drivers/crypto/dpaa_sec/dpaa_sec.c b/drivers/crypto/dpaa_sec/dpaa_sec.c +index a552e64506..f20acdd123 100644 +--- a/drivers/crypto/dpaa_sec/dpaa_sec.c ++++ b/drivers/crypto/dpaa_sec/dpaa_sec.c +@@ -723,7 +723,7 @@ dpaa_sec_deq(struct dpaa_sec_qp *qp, struct rte_crypto_op **ops, int nb_ops) + } + ops[pkts++] = op; + +- /* report op status to sym->op and then free the ctx memeory */ ++ /* report op status to sym->op and then free the ctx memory */ + rte_mempool_put(ctx->ctx_pool, (void *)ctx); + + qman_dqrr_consume(fq, dq); +diff --git a/drivers/crypto/octeontx/otx_cryptodev_hw_access.c b/drivers/crypto/octeontx/otx_cryptodev_hw_access.c +index 20b288334a..27604459e4 100644 +--- a/drivers/crypto/octeontx/otx_cryptodev_hw_access.c ++++ b/drivers/crypto/octeontx/otx_cryptodev_hw_access.c +@@ -296,7 +296,7 @@ cpt_vq_init(struct cpt_vf *cptvf, uint8_t group) + /* CPT VF device initialization */ + otx_cpt_vfvq_init(cptvf); + +- /* Send msg to PF to assign currnet Q to required group */ ++ /* Send msg to PF to assign current Q to required group */ + cptvf->vfgrp = group; + err = otx_cpt_send_vf_grp_msg(cptvf, group); + if (err) { +diff --git a/drivers/crypto/octeontx/otx_cryptodev_mbox.h b/drivers/crypto/octeontx/otx_cryptodev_mbox.h +index 508f3afd47..c1eedc1b9e 100644 +--- a/drivers/crypto/octeontx/otx_cryptodev_mbox.h ++++ b/drivers/crypto/octeontx/otx_cryptodev_mbox.h +@@ -70,7 +70,7 @@ void + otx_cpt_handle_mbox_intr(struct cpt_vf *cptvf); + + /* +- * Checks if VF is able to comminicate with PF ++ * Checks if VF is able to communicate with PF + * and also gets the CPT number this VF is associated to. + */ + int +diff --git a/drivers/crypto/octeontx/otx_cryptodev_ops.c b/drivers/crypto/octeontx/otx_cryptodev_ops.c +index 9e8fd495cf..f7ca8a8a8e 100644 +--- a/drivers/crypto/octeontx/otx_cryptodev_ops.c ++++ b/drivers/crypto/octeontx/otx_cryptodev_ops.c +@@ -558,7 +558,7 @@ otx_cpt_enq_single_sym(struct cpt_instance *instance, + &mdata, (void **)&prep_req); + + if (unlikely(ret)) { +- CPT_LOG_DP_ERR("prep cryto req : op %p, cpt_op 0x%x " ++ CPT_LOG_DP_ERR("prep crypto req : op %p, cpt_op 0x%x " + "ret 0x%x", op, (unsigned int)cpt_op, ret); + return NULL; + } +diff --git a/drivers/crypto/qat/qat_asym.c b/drivers/crypto/qat/qat_asym.c +index f893508030..09d8761c5f 100644 +--- a/drivers/crypto/qat/qat_asym.c ++++ b/drivers/crypto/qat/qat_asym.c +@@ -109,7 +109,7 @@ static void qat_clear_arrays_by_alg(struct qat_asym_op_cookie *cookie, + static int qat_asym_check_nonzero(rte_crypto_param n) + { + if (n.length < 8) { +- /* Not a case for any cryptograpic function except for DH ++ /* Not a case for any cryptographic function except for DH + * generator which very often can be of one byte length + */ + size_t i; +diff --git a/drivers/crypto/qat/qat_sym.c b/drivers/crypto/qat/qat_sym.c +index 93b257522b..00ec703754 100644 +--- a/drivers/crypto/qat/qat_sym.c ++++ b/drivers/crypto/qat/qat_sym.c +@@ -419,7 +419,7 @@ qat_sym_build_request(void *in_op, uint8_t *out_msg, + ICP_QAT_HW_AUTH_ALGO_AES_CBC_MAC) { + + /* In case of AES-CCM this may point to user selected +- * memory or iv offset in cypto_op ++ * memory or iv offset in crypto_op + */ + uint8_t *aad_data = op->sym->aead.aad.data; + /* This is true AAD length, it not includes 18 bytes of +diff --git a/drivers/crypto/virtio/virtqueue.h b/drivers/crypto/virtio/virtqueue.h +index bf10c6579b..c96ca62992 100644 +--- a/drivers/crypto/virtio/virtqueue.h ++++ b/drivers/crypto/virtio/virtqueue.h +@@ -145,7 +145,7 @@ virtqueue_notify(struct virtqueue *vq) + { + /* + * Ensure updated avail->idx is visible to host. +- * For virtio on IA, the notificaiton is through io port operation ++ * For virtio on IA, the notification is through io port operation + * which is a serialization instruction itself. + */ + VTPCI_OPS(vq->hw)->notify_queue(vq->hw, vq); +diff --git a/drivers/dma/skeleton/skeleton_dmadev.c b/drivers/dma/skeleton/skeleton_dmadev.c +index d9e4f731d7..81cbdd286e 100644 +--- a/drivers/dma/skeleton/skeleton_dmadev.c ++++ b/drivers/dma/skeleton/skeleton_dmadev.c +@@ -169,7 +169,7 @@ vchan_setup(struct skeldma_hw *hw, uint16_t nb_desc) + struct rte_ring *completed; + uint16_t i; + +- desc = rte_zmalloc_socket("dma_skelteon_desc", ++ desc = rte_zmalloc_socket("dma_skeleton_desc", + nb_desc * sizeof(struct skeldma_desc), + RTE_CACHE_LINE_SIZE, hw->socket_id); + if (desc == NULL) { +diff --git a/drivers/event/cnxk/cnxk_eventdev_selftest.c b/drivers/event/cnxk/cnxk_eventdev_selftest.c +index 69c15b1d0a..2fe6467f88 100644 +--- a/drivers/event/cnxk/cnxk_eventdev_selftest.c ++++ b/drivers/event/cnxk/cnxk_eventdev_selftest.c +@@ -140,7 +140,7 @@ _eventdev_setup(int mode) + struct rte_event_dev_info info; + int i, ret; + +- /* Create and destrory pool for each test case to make it standalone */ ++ /* Create and destroy pool for each test case to make it standalone */ + eventdev_test_mempool = rte_pktmbuf_pool_create( + pool_name, MAX_EVENTS, 0, 0, 512, rte_socket_id()); + if (!eventdev_test_mempool) { +@@ -1543,7 +1543,7 @@ cnxk_sso_selftest(const char *dev_name) + cn9k_sso_set_rsrc(dev); + if (cnxk_sso_testsuite_run(dev_name)) + return rc; +- /* Verift dual ws mode. */ ++ /* Verify dual ws mode. */ + printf("Verifying CN9K Dual workslot mode\n"); + dev->dual_ws = 1; + cn9k_sso_set_rsrc(dev); +diff --git a/drivers/event/dlb2/dlb2.c b/drivers/event/dlb2/dlb2.c +index 16e9764dbf..d75f12e382 100644 +--- a/drivers/event/dlb2/dlb2.c ++++ b/drivers/event/dlb2/dlb2.c +@@ -2145,7 +2145,7 @@ dlb2_event_queue_detach_ldb(struct dlb2_eventdev *dlb2, + } + + /* This is expected with eventdev API! +- * It blindly attemmpts to unmap all queues. ++ * It blindly attempts to unmap all queues. + */ + if (i == DLB2_MAX_NUM_QIDS_PER_LDB_CQ) { + DLB2_LOG_DBG("dlb2: ignoring LB QID %d not mapped for qm_port %d.\n", +diff --git a/drivers/event/dlb2/dlb2_priv.h b/drivers/event/dlb2/dlb2_priv.h +index a5e2f8e46b..7837ae8733 100644 +--- a/drivers/event/dlb2/dlb2_priv.h ++++ b/drivers/event/dlb2/dlb2_priv.h +@@ -519,7 +519,7 @@ struct dlb2_eventdev_port { + bool setup_done; + /* enq_configured is set when the qm port is created */ + bool enq_configured; +- uint8_t implicit_release; /* release events before dequeueing */ ++ uint8_t implicit_release; /* release events before dequeuing */ + } __rte_cache_aligned; + + struct dlb2_queue { +diff --git a/drivers/event/dlb2/dlb2_selftest.c b/drivers/event/dlb2/dlb2_selftest.c +index 2113bc2c99..1863ffe049 100644 +--- a/drivers/event/dlb2/dlb2_selftest.c ++++ b/drivers/event/dlb2/dlb2_selftest.c +@@ -223,7 +223,7 @@ test_stop_flush(struct test *t) /* test to check we can properly flush events */ + 0, + RTE_EVENT_PORT_ATTR_DEQ_DEPTH, + &dequeue_depth)) { +- printf("%d: Error retrieveing dequeue depth\n", __LINE__); ++ printf("%d: Error retrieving dequeue depth\n", __LINE__); + goto err; + } + +diff --git a/drivers/event/dlb2/rte_pmd_dlb2.h b/drivers/event/dlb2/rte_pmd_dlb2.h +index 74399db018..1dbd885a16 100644 +--- a/drivers/event/dlb2/rte_pmd_dlb2.h ++++ b/drivers/event/dlb2/rte_pmd_dlb2.h +@@ -24,7 +24,7 @@ extern "C" { + * Selects the token pop mode for a DLB2 port. + */ + enum dlb2_token_pop_mode { +- /* Pop the CQ tokens immediately after dequeueing. */ ++ /* Pop the CQ tokens immediately after dequeuing. */ + AUTO_POP, + /* Pop CQ tokens after (dequeue_depth - 1) events are released. + * Supported on load-balanced ports only. +diff --git a/drivers/event/dpaa2/dpaa2_eventdev_selftest.c b/drivers/event/dpaa2/dpaa2_eventdev_selftest.c +index bbbd20951f..b549bdfcbb 100644 +--- a/drivers/event/dpaa2/dpaa2_eventdev_selftest.c ++++ b/drivers/event/dpaa2/dpaa2_eventdev_selftest.c +@@ -118,7 +118,7 @@ _eventdev_setup(int mode) + struct rte_event_dev_info info; + const char *pool_name = "evdev_dpaa2_test_pool"; + +- /* Create and destrory pool for each test case to make it standalone */ ++ /* Create and destroy pool for each test case to make it standalone */ + eventdev_test_mempool = rte_pktmbuf_pool_create(pool_name, + MAX_EVENTS, + 0 /*MBUF_CACHE_SIZE*/, +diff --git a/drivers/event/dsw/dsw_evdev.h b/drivers/event/dsw/dsw_evdev.h +index e64ae26f6e..c907c00c78 100644 +--- a/drivers/event/dsw/dsw_evdev.h ++++ b/drivers/event/dsw/dsw_evdev.h +@@ -24,7 +24,7 @@ + /* Multiple 24-bit flow ids will map to the same DSW-level flow. The + * number of DSW flows should be high enough make it unlikely that + * flow ids of several large flows hash to the same DSW-level flow. +- * Such collisions will limit parallism and thus the number of cores ++ * Such collisions will limit parallelism and thus the number of cores + * that may be utilized. However, configuring a large number of DSW + * flows might potentially, depending on traffic and actual + * application flow id value range, result in each such DSW-level flow +@@ -104,7 +104,7 @@ + /* Only one outstanding migration per port is allowed */ + #define DSW_MAX_PAUSED_FLOWS (DSW_MAX_PORTS*DSW_MAX_FLOWS_PER_MIGRATION) + +-/* Enough room for paus request/confirm and unpaus request/confirm for ++/* Enough room for pause request/confirm and unpaus request/confirm for + * all possible senders. + */ + #define DSW_CTL_IN_RING_SIZE ((DSW_MAX_PORTS-1)*4) +diff --git a/drivers/event/dsw/dsw_event.c b/drivers/event/dsw/dsw_event.c +index c6ed470286..e209cd5b00 100644 +--- a/drivers/event/dsw/dsw_event.c ++++ b/drivers/event/dsw/dsw_event.c +@@ -1096,7 +1096,7 @@ dsw_port_ctl_process(struct dsw_evdev *dsw, struct dsw_port *port) + static void + dsw_port_note_op(struct dsw_port *port, uint16_t num_events) + { +- /* To pull the control ring reasonbly often on busy ports, ++ /* To pull the control ring reasonably often on busy ports, + * each dequeued/enqueued event is considered an 'op' too. + */ + port->ops_since_bg_task += (num_events+1); +@@ -1180,7 +1180,7 @@ dsw_event_enqueue_burst_generic(struct dsw_port *source_port, + * addition, a port cannot be left "unattended" (e.g. unused) + * for long periods of time, since that would stall + * migration. Eventdev API extensions to provide a cleaner way +- * to archieve both of these functions should be ++ * to archive both of these functions should be + * considered. + */ + if (unlikely(events_len == 0)) { +diff --git a/drivers/event/octeontx/ssovf_evdev.h b/drivers/event/octeontx/ssovf_evdev.h +index bb1056a955..e46dc055eb 100644 +--- a/drivers/event/octeontx/ssovf_evdev.h ++++ b/drivers/event/octeontx/ssovf_evdev.h +@@ -88,7 +88,7 @@ + + /* + * In Cavium OCTEON TX SoC, all accesses to the device registers are +- * implictly strongly ordered. So, The relaxed version of IO operation is ++ * implicitly strongly ordered. So, The relaxed version of IO operation is + * safe to use with out any IO memory barriers. + */ + #define ssovf_read64 rte_read64_relaxed +diff --git a/drivers/event/octeontx/ssovf_evdev_selftest.c b/drivers/event/octeontx/ssovf_evdev_selftest.c +index d7b0d22111..b55523632a 100644 +--- a/drivers/event/octeontx/ssovf_evdev_selftest.c ++++ b/drivers/event/octeontx/ssovf_evdev_selftest.c +@@ -151,7 +151,7 @@ _eventdev_setup(int mode) + struct rte_event_dev_info info; + const char *pool_name = "evdev_octeontx_test_pool"; + +- /* Create and destrory pool for each test case to make it standalone */ ++ /* Create and destroy pool for each test case to make it standalone */ + eventdev_test_mempool = rte_pktmbuf_pool_create(pool_name, + MAX_EVENTS, + 0 /*MBUF_CACHE_SIZE*/, +diff --git a/drivers/event/octeontx2/otx2_evdev_selftest.c b/drivers/event/octeontx2/otx2_evdev_selftest.c +index 48bfaf893d..a89637d60f 100644 +--- a/drivers/event/octeontx2/otx2_evdev_selftest.c ++++ b/drivers/event/octeontx2/otx2_evdev_selftest.c +@@ -139,7 +139,7 @@ _eventdev_setup(int mode) + struct rte_event_dev_info info; + int i, ret; + +- /* Create and destrory pool for each test case to make it standalone */ ++ /* Create and destroy pool for each test case to make it standalone */ + eventdev_test_mempool = rte_pktmbuf_pool_create(pool_name, MAX_EVENTS, + 0, 0, 512, + rte_socket_id()); +diff --git a/drivers/event/octeontx2/otx2_worker_dual.h b/drivers/event/octeontx2/otx2_worker_dual.h +index 36ae4dd88f..ca06d51c8a 100644 +--- a/drivers/event/octeontx2/otx2_worker_dual.h ++++ b/drivers/event/octeontx2/otx2_worker_dual.h +@@ -74,7 +74,7 @@ otx2_ssogws_dual_get_work(struct otx2_ssogws_state *ws, + event.flow_id, flags, lookup_mem); + /* Extracting tstamp, if PTP enabled. CGX will prepend + * the timestamp at starting of packet data and it can +- * be derieved from WQE 9 dword which corresponds to SG ++ * be derived from WQE 9 dword which corresponds to SG + * iova. + * rte_pktmbuf_mtod_offset can be used for this purpose + * but it brings down the performance as it reads +diff --git a/drivers/event/opdl/opdl_evdev.c b/drivers/event/opdl/opdl_evdev.c +index 15c10240b0..8b6890b220 100644 +--- a/drivers/event/opdl/opdl_evdev.c ++++ b/drivers/event/opdl/opdl_evdev.c +@@ -703,7 +703,7 @@ opdl_probe(struct rte_vdev_device *vdev) + } + + PMD_DRV_LOG(INFO, "DEV_ID:[%02d] : " +- "Success - creating eventdev device %s, numa_node:[%d], do_valdation:[%s]" ++ "Success - creating eventdev device %s, numa_node:[%d], do_validation:[%s]" + " , self_test:[%s]\n", + dev->data->dev_id, + name, +diff --git a/drivers/event/opdl/opdl_test.c b/drivers/event/opdl/opdl_test.c +index e4fc70a440..24b92df476 100644 +--- a/drivers/event/opdl/opdl_test.c ++++ b/drivers/event/opdl/opdl_test.c +@@ -864,7 +864,7 @@ qid_basic(struct test *t) + } + + +- /* Start the devicea */ ++ /* Start the device */ + if (!err) { + if (rte_event_dev_start(evdev) < 0) { + PMD_DRV_LOG(ERR, "%s:%d: Error with start call\n", +diff --git a/drivers/event/sw/sw_evdev.h b/drivers/event/sw/sw_evdev.h +index 33645bd1df..4fd1054470 100644 +--- a/drivers/event/sw/sw_evdev.h ++++ b/drivers/event/sw/sw_evdev.h +@@ -180,7 +180,7 @@ struct sw_port { + uint16_t outstanding_releases __rte_cache_aligned; + uint16_t inflight_max; /* app requested max inflights for this port */ + uint16_t inflight_credits; /* num credits this port has right now */ +- uint8_t implicit_release; /* release events before dequeueing */ ++ uint8_t implicit_release; /* release events before dequeuing */ + + uint16_t last_dequeue_burst_sz; /* how big the burst was */ + uint64_t last_dequeue_ticks; /* used to track burst processing time */ +diff --git a/drivers/event/sw/sw_evdev_selftest.c b/drivers/event/sw/sw_evdev_selftest.c +index 9768d3a0c7..cb97a4d615 100644 +--- a/drivers/event/sw/sw_evdev_selftest.c ++++ b/drivers/event/sw/sw_evdev_selftest.c +@@ -1109,7 +1109,7 @@ xstats_tests(struct test *t) + NULL, + 0); + +- /* Verify that the resetable stats are reset, and others are not */ ++ /* Verify that the resettable stats are reset, and others are not */ + static const uint64_t queue_expected_zero[] = { + 0 /* rx */, + 0 /* tx */, +diff --git a/drivers/mempool/dpaa/dpaa_mempool.c b/drivers/mempool/dpaa/dpaa_mempool.c +index f17aff9655..32639a3bfd 100644 +--- a/drivers/mempool/dpaa/dpaa_mempool.c ++++ b/drivers/mempool/dpaa/dpaa_mempool.c +@@ -258,7 +258,7 @@ dpaa_mbuf_alloc_bulk(struct rte_mempool *pool, + } + /* assigning mbuf from the acquired objects */ + for (i = 0; (i < ret) && bufs[i].addr; i++) { +- /* TODO-errata - objerved that bufs may be null ++ /* TODO-errata - observed that bufs may be null + * i.e. first buffer is valid, remaining 6 buffers + * may be null. + */ +diff --git a/drivers/mempool/octeontx/octeontx_fpavf.c b/drivers/mempool/octeontx/octeontx_fpavf.c +index 94dc5cd815..8fd9edced2 100644 +--- a/drivers/mempool/octeontx/octeontx_fpavf.c ++++ b/drivers/mempool/octeontx/octeontx_fpavf.c +@@ -669,7 +669,7 @@ octeontx_fpa_bufpool_destroy(uintptr_t handle, int node_id) + break; + } + +- /* Imsert it into an ordered linked list */ ++ /* Insert it into an ordered linked list */ + for (curr = &head; curr[0] != NULL; curr = curr[0]) { + if ((uintptr_t)node <= (uintptr_t)curr[0]) + break; +@@ -705,7 +705,7 @@ octeontx_fpa_bufpool_destroy(uintptr_t handle, int node_id) + + ret = octeontx_fpapf_aura_detach(gpool); + if (ret) { +- fpavf_log_err("Failed to dettach gaura %u. error code=%d\n", ++ fpavf_log_err("Failed to detach gaura %u. error code=%d\n", + gpool, ret); + } + +diff --git a/drivers/net/ark/ark_global.h b/drivers/net/ark/ark_global.h +index 6f9b3013d8..49193ac5b3 100644 +--- a/drivers/net/ark/ark_global.h ++++ b/drivers/net/ark/ark_global.h +@@ -67,7 +67,7 @@ + typedef void (*rx_user_meta_hook_fn)(struct rte_mbuf *mbuf, + const uint32_t *meta, + void *ext_user_data); +-/* TX hook poplulate *meta, with up to 20 bytes. meta_cnt ++/* TX hook populate *meta, with up to 20 bytes. meta_cnt + * returns the number of uint32_t words populated, 0 to 5 + */ + typedef void (*tx_user_meta_hook_fn)(const struct rte_mbuf *mbuf, +diff --git a/drivers/net/atlantic/atl_ethdev.c b/drivers/net/atlantic/atl_ethdev.c +index 1c03e8bfa1..3a028f4290 100644 +--- a/drivers/net/atlantic/atl_ethdev.c ++++ b/drivers/net/atlantic/atl_ethdev.c +@@ -1423,7 +1423,7 @@ atl_dev_interrupt_action(struct rte_eth_dev *dev, + * @param handle + * Pointer to interrupt handle. + * @param param +- * The address of parameter (struct rte_eth_dev *) regsitered before. ++ * The address of parameter (struct rte_eth_dev *) registered before. + * + * @return + * void +diff --git a/drivers/net/atlantic/atl_rxtx.c b/drivers/net/atlantic/atl_rxtx.c +index e3f57ded73..aeb79bf5a2 100644 +--- a/drivers/net/atlantic/atl_rxtx.c ++++ b/drivers/net/atlantic/atl_rxtx.c +@@ -1094,7 +1094,7 @@ atl_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) + * register. + * Update the RDT with the value of the last processed RX descriptor + * minus 1, to guarantee that the RDT register is never equal to the +- * RDH register, which creates a "full" ring situtation from the ++ * RDH register, which creates a "full" ring situation from the + * hardware point of view... + */ + nb_hold = (uint16_t)(nb_hold + rxq->nb_rx_hold); +diff --git a/drivers/net/atlantic/hw_atl/hw_atl_b0.c b/drivers/net/atlantic/hw_atl/hw_atl_b0.c +index 7d0e724019..d0eb4af928 100644 +--- a/drivers/net/atlantic/hw_atl/hw_atl_b0.c ++++ b/drivers/net/atlantic/hw_atl/hw_atl_b0.c +@@ -281,7 +281,7 @@ int hw_atl_b0_hw_init_rx_path(struct aq_hw_s *self) + hw_atl_rpf_vlan_outer_etht_set(self, 0x88A8U); + hw_atl_rpf_vlan_inner_etht_set(self, 0x8100U); + +- /* VLAN proimisc bu defauld */ ++ /* VLAN promisc by default */ + hw_atl_rpf_vlan_prom_mode_en_set(self, 1); + + /* Rx Interrupts */ +diff --git a/drivers/net/axgbe/axgbe_dev.c b/drivers/net/axgbe/axgbe_dev.c +index daeb3308f4..6a7fddffca 100644 +--- a/drivers/net/axgbe/axgbe_dev.c ++++ b/drivers/net/axgbe/axgbe_dev.c +@@ -1046,7 +1046,7 @@ static int axgbe_config_rx_threshold(struct axgbe_port *pdata, + return 0; + } + +-/*Distrubting fifo size */ ++/* Distributing FIFO size */ + static void axgbe_config_rx_fifo_size(struct axgbe_port *pdata) + { + unsigned int fifo_size; +diff --git a/drivers/net/axgbe/axgbe_ethdev.c b/drivers/net/axgbe/axgbe_ethdev.c +index b209ab67cf..f6c49bbbda 100644 +--- a/drivers/net/axgbe/axgbe_ethdev.c ++++ b/drivers/net/axgbe/axgbe_ethdev.c +@@ -284,7 +284,7 @@ static int axgbe_phy_reset(struct axgbe_port *pdata) + * @param handle + * Pointer to interrupt handle. + * @param param +- * The address of parameter (struct rte_eth_dev *) regsitered before. ++ * The address of parameter (struct rte_eth_dev *) registered before. + * + * @return + * void +diff --git a/drivers/net/axgbe/axgbe_ethdev.h b/drivers/net/axgbe/axgbe_ethdev.h +index a207f2ae1b..e06d40f9eb 100644 +--- a/drivers/net/axgbe/axgbe_ethdev.h ++++ b/drivers/net/axgbe/axgbe_ethdev.h +@@ -641,7 +641,7 @@ struct axgbe_port { + + unsigned int kr_redrv; + +- /* Auto-negotiation atate machine support */ ++ /* Auto-negotiation state machine support */ + unsigned int an_int; + unsigned int an_status; + enum axgbe_an an_result; +diff --git a/drivers/net/axgbe/axgbe_phy_impl.c b/drivers/net/axgbe/axgbe_phy_impl.c +index 02236ec192..72104f8a3f 100644 +--- a/drivers/net/axgbe/axgbe_phy_impl.c ++++ b/drivers/net/axgbe/axgbe_phy_impl.c +@@ -347,7 +347,7 @@ static int axgbe_phy_i2c_read(struct axgbe_port *pdata, unsigned int target, + + retry = 1; + again2: +- /* Read the specfied register */ ++ /* Read the specified register */ + i2c_op.cmd = AXGBE_I2C_CMD_READ; + i2c_op.target = target; + i2c_op.len = val_len; +@@ -1093,7 +1093,7 @@ static int axgbe_phy_an_config(struct axgbe_port *pdata __rte_unused) + { + return 0; + /* Dummy API since there is no case to support +- * external phy devices registred through kerenl apis ++ * external phy devices registered through kernel APIs + */ + } + +diff --git a/drivers/net/axgbe/axgbe_rxtx_vec_sse.c b/drivers/net/axgbe/axgbe_rxtx_vec_sse.c +index 816371cd79..d95a446bef 100644 +--- a/drivers/net/axgbe/axgbe_rxtx_vec_sse.c ++++ b/drivers/net/axgbe/axgbe_rxtx_vec_sse.c +@@ -11,7 +11,7 @@ + #include + #include + +-/* Useful to avoid shifting for every descriptor prepration*/ ++/* Useful to avoid shifting for every descriptor preparation */ + #define TX_DESC_CTRL_FLAGS 0xb000000000000000 + #define TX_DESC_CTRL_FLAG_TMST 0x40000000 + #define TX_FREE_BULK 8 +diff --git a/drivers/net/bnx2x/bnx2x.c b/drivers/net/bnx2x/bnx2x.c +index f67db015b5..74e3018eab 100644 +--- a/drivers/net/bnx2x/bnx2x.c ++++ b/drivers/net/bnx2x/bnx2x.c +@@ -926,7 +926,7 @@ storm_memset_eq_prod(struct bnx2x_softc *sc, uint16_t eq_prod, uint16_t pfid) + * block. + * + * RAMROD_CMD_ID_ETH_UPDATE +- * Used to update the state of the leading connection, usually to udpate ++ * Used to update the state of the leading connection, usually to update + * the RSS indirection table. Completes on the RCQ of the leading + * connection. (Not currently used under FreeBSD until OS support becomes + * available.) +@@ -941,7 +941,7 @@ storm_memset_eq_prod(struct bnx2x_softc *sc, uint16_t eq_prod, uint16_t pfid) + * the RCQ of the leading connection. + * + * RAMROD_CMD_ID_ETH_CFC_DEL +- * Used when tearing down a conneciton prior to driver unload. Completes ++ * Used when tearing down a connection prior to driver unload. Completes + * on the RCQ of the leading connection (since the current connection + * has been completely removed from controller memory). + * +@@ -1072,7 +1072,7 @@ bnx2x_sp_post(struct bnx2x_softc *sc, int command, int cid, uint32_t data_hi, + + /* + * It's ok if the actual decrement is issued towards the memory +- * somewhere between the lock and unlock. Thus no more explict ++ * somewhere between the lock and unlock. Thus no more explicit + * memory barrier is needed. + */ + if (common) { +@@ -1190,7 +1190,7 @@ bnx2x_sp_event(struct bnx2x_softc *sc, struct bnx2x_fastpath *fp, + break; + + case (RAMROD_CMD_ID_ETH_TERMINATE): +- PMD_DRV_LOG(DEBUG, sc, "got MULTI[%d] teminate ramrod", cid); ++ PMD_DRV_LOG(DEBUG, sc, "got MULTI[%d] terminate ramrod", cid); + drv_cmd = ECORE_Q_CMD_TERMINATE; + break; + +@@ -1476,7 +1476,7 @@ bnx2x_fill_accept_flags(struct bnx2x_softc *sc, uint32_t rx_mode, + case BNX2X_RX_MODE_ALLMULTI_PROMISC: + case BNX2X_RX_MODE_PROMISC: + /* +- * According to deffinition of SI mode, iface in promisc mode ++ * According to definition of SI mode, iface in promisc mode + * should receive matched and unmatched (in resolution of port) + * unicast packets. + */ +@@ -1944,7 +1944,7 @@ static void bnx2x_disable_close_the_gate(struct bnx2x_softc *sc) + + /* + * Cleans the object that have internal lists without sending +- * ramrods. Should be run when interrutps are disabled. ++ * ramrods. Should be run when interrupts are disabled. + */ + static void bnx2x_squeeze_objects(struct bnx2x_softc *sc) + { +@@ -2043,7 +2043,7 @@ bnx2x_nic_unload(struct bnx2x_softc *sc, uint32_t unload_mode, uint8_t keep_link + + /* + * Nothing to do during unload if previous bnx2x_nic_load() +- * did not completed successfully - all resourses are released. ++ * did not complete successfully - all resources are released. + */ + if ((sc->state == BNX2X_STATE_CLOSED) || (sc->state == BNX2X_STATE_ERROR)) { + return 0; +@@ -2084,7 +2084,7 @@ bnx2x_nic_unload(struct bnx2x_softc *sc, uint32_t unload_mode, uint8_t keep_link + /* + * Prevent transactions to host from the functions on the + * engine that doesn't reset global blocks in case of global +- * attention once gloabl blocks are reset and gates are opened ++ * attention once global blocks are reset and gates are opened + * (the engine which leader will perform the recovery + * last). + */ +@@ -2101,7 +2101,7 @@ bnx2x_nic_unload(struct bnx2x_softc *sc, uint32_t unload_mode, uint8_t keep_link + + /* + * At this stage no more interrupts will arrive so we may safely clean +- * the queue'able objects here in case they failed to get cleaned so far. ++ * the queueable objects here in case they failed to get cleaned so far. + */ + if (IS_PF(sc)) { + bnx2x_squeeze_objects(sc); +@@ -2151,7 +2151,7 @@ bnx2x_nic_unload(struct bnx2x_softc *sc, uint32_t unload_mode, uint8_t keep_link + } + + /* +- * Encapsulte an mbuf cluster into the tx bd chain and makes the memory ++ * Encapsulate an mbuf cluster into the Tx BD chain and makes the memory + * visible to the controller. + * + * If an mbuf is submitted to this routine and cannot be given to the +@@ -2719,7 +2719,7 @@ static uint8_t bnx2x_clear_pf_load(struct bnx2x_softc *sc) + return val1 != 0; + } + +-/* send load requrest to mcp and analyze response */ ++/* send load request to MCP and analyze response */ + static int bnx2x_nic_load_request(struct bnx2x_softc *sc, uint32_t * load_code) + { + PMD_INIT_FUNC_TRACE(sc); +@@ -5325,7 +5325,7 @@ static void bnx2x_func_init(struct bnx2x_softc *sc, struct bnx2x_func_init_param + * sum of vn_min_rates. + * or + * 0 - if all the min_rates are 0. +- * In the later case fainess algorithm should be deactivated. ++ * In the later case fairness algorithm should be deactivated. + * If all min rates are not zero then those that are zeroes will be set to 1. + */ + static void bnx2x_calc_vn_min(struct bnx2x_softc *sc, struct cmng_init_input *input) +@@ -6564,7 +6564,7 @@ bnx2x_pf_tx_q_prep(struct bnx2x_softc *sc, struct bnx2x_fastpath *fp, + txq_init->fw_sb_id = fp->fw_sb_id; + + /* +- * set the TSS leading client id for TX classfication to the ++ * set the TSS leading client id for Tx classification to the + * leading RSS client id + */ + txq_init->tss_leading_cl_id = BNX2X_FP(sc, 0, cl_id); +@@ -7634,8 +7634,8 @@ static uint8_t bnx2x_is_pcie_pending(struct bnx2x_softc *sc) + } + + /* +-* Walk the PCI capabiites list for the device to find what features are +-* supported. These capabilites may be enabled/disabled by firmware so it's ++* Walk the PCI capabilities list for the device to find what features are ++* supported. These capabilities may be enabled/disabled by firmware so it's + * best to walk the list rather than make assumptions. + */ + static void bnx2x_probe_pci_caps(struct bnx2x_softc *sc) +@@ -8425,7 +8425,7 @@ static int bnx2x_get_device_info(struct bnx2x_softc *sc) + } else { + sc->devinfo.int_block = INT_BLOCK_IGU; + +-/* do not allow device reset during IGU info preocessing */ ++/* do not allow device reset during IGU info processing */ + bnx2x_acquire_hw_lock(sc, HW_LOCK_RESOURCE_RESET); + + val = REG_RD(sc, IGU_REG_BLOCK_CONFIGURATION); +@@ -9765,7 +9765,7 @@ int bnx2x_attach(struct bnx2x_softc *sc) + + sc->igu_base_addr = IS_VF(sc) ? PXP_VF_ADDR_IGU_START : BAR_IGU_INTMEM; + +- /* get PCI capabilites */ ++ /* get PCI capabilities */ + bnx2x_probe_pci_caps(sc); + + if (sc->devinfo.pcie_msix_cap_reg != 0) { +@@ -10284,7 +10284,7 @@ static int bnx2x_init_hw_common(struct bnx2x_softc *sc) + * stay set) + * f. If this is VNIC 3 of a port then also init + * first_timers_ilt_entry to zero and last_timers_ilt_entry +- * to the last enrty in the ILT. ++ * to the last entry in the ILT. + * + * Notes: + * Currently the PF error in the PGLC is non recoverable. +@@ -11090,7 +11090,7 @@ static void bnx2x_hw_enable_status(struct bnx2x_softc *sc) + /** + * bnx2x_pf_flr_clnup + * a. re-enable target read on the PF +- * b. poll cfc per function usgae counter ++ * b. poll cfc per function usage counter + * c. poll the qm perfunction usage counter + * d. poll the tm per function usage counter + * e. poll the tm per function scan-done indication +diff --git a/drivers/net/bnx2x/bnx2x.h b/drivers/net/bnx2x/bnx2x.h +index 80d19cbfd6..d7e1729e68 100644 +--- a/drivers/net/bnx2x/bnx2x.h ++++ b/drivers/net/bnx2x/bnx2x.h +@@ -681,13 +681,13 @@ struct bnx2x_slowpath { + }; /* struct bnx2x_slowpath */ + + /* +- * Port specifc data structure. ++ * Port specific data structure. + */ + struct bnx2x_port { + /* + * Port Management Function (for 57711E only). + * When this field is set the driver instance is +- * responsible for managing port specifc ++ * responsible for managing port specific + * configurations such as handling link attentions. + */ + uint32_t pmf; +@@ -732,7 +732,7 @@ struct bnx2x_port { + + /* + * MCP scratchpad address for port specific statistics. +- * The device is responsible for writing statistcss ++ * The device is responsible for writing statistics + * back to the MCP for use with management firmware such + * as UMP/NC-SI. + */ +@@ -937,8 +937,8 @@ struct bnx2x_devinfo { + * already registered for this port (which means that the user wants storage + * services). + * 2. During cnic-related load, to know if offload mode is already configured +- * in the HW or needs to be configrued. Since the transition from nic-mode to +- * offload-mode in HW causes traffic coruption, nic-mode is configured only ++ * in the HW or needs to be configured. Since the transition from nic-mode to ++ * offload-mode in HW causes traffic corruption, nic-mode is configured only + * in ports on which storage services where never requested. + */ + #define CONFIGURE_NIC_MODE(sc) (!CHIP_IS_E1x(sc) && !CNIC_ENABLED(sc)) +diff --git a/drivers/net/bnx2x/bnx2x_stats.c b/drivers/net/bnx2x/bnx2x_stats.c +index 1cd972591a..c07b01510a 100644 +--- a/drivers/net/bnx2x/bnx2x_stats.c ++++ b/drivers/net/bnx2x/bnx2x_stats.c +@@ -1358,7 +1358,7 @@ bnx2x_prep_fw_stats_req(struct bnx2x_softc *sc) + + /* + * Prepare the first stats ramrod (will be completed with +- * the counters equal to zero) - init counters to somethig different. ++ * the counters equal to zero) - init counters to something different. + */ + memset(&sc->fw_stats_data->storm_counters, 0xff, + sizeof(struct stats_counter)); +diff --git a/drivers/net/bnx2x/bnx2x_stats.h b/drivers/net/bnx2x/bnx2x_stats.h +index 635412bdd3..11ddab5039 100644 +--- a/drivers/net/bnx2x/bnx2x_stats.h ++++ b/drivers/net/bnx2x/bnx2x_stats.h +@@ -314,7 +314,7 @@ struct bnx2x_eth_stats_old { + }; + + struct bnx2x_eth_q_stats_old { +- /* Fields to perserve over fw reset*/ ++ /* Fields to preserve over FW reset */ + uint32_t total_unicast_bytes_received_hi; + uint32_t total_unicast_bytes_received_lo; + uint32_t total_broadcast_bytes_received_hi; +@@ -328,7 +328,7 @@ struct bnx2x_eth_q_stats_old { + uint32_t total_multicast_bytes_transmitted_hi; + uint32_t total_multicast_bytes_transmitted_lo; + +- /* Fields to perserve last of */ ++ /* Fields to preserve last of */ + uint32_t total_bytes_received_hi; + uint32_t total_bytes_received_lo; + uint32_t total_bytes_transmitted_hi; +diff --git a/drivers/net/bnx2x/bnx2x_vfpf.c b/drivers/net/bnx2x/bnx2x_vfpf.c +index 945e3df84f..63953c2979 100644 +--- a/drivers/net/bnx2x/bnx2x_vfpf.c ++++ b/drivers/net/bnx2x/bnx2x_vfpf.c +@@ -73,7 +73,7 @@ bnx2x_add_tlv(__rte_unused struct bnx2x_softc *sc, void *tlvs_list, + tl->length = length; + } + +-/* Initiliaze header of the first tlv and clear mailbox*/ ++/* Initialize header of the first TLV and clear mailbox */ + static void + bnx2x_vf_prep(struct bnx2x_softc *sc, struct vf_first_tlv *first_tlv, + uint16_t type, uint16_t length) +diff --git a/drivers/net/bnx2x/bnx2x_vfpf.h b/drivers/net/bnx2x/bnx2x_vfpf.h +index 9577341266..d71e81c005 100644 +--- a/drivers/net/bnx2x/bnx2x_vfpf.h ++++ b/drivers/net/bnx2x/bnx2x_vfpf.h +@@ -241,7 +241,7 @@ struct vf_close_tlv { + uint8_t pad[2]; + }; + +-/* rlease the VF's acquired resources */ ++/* release the VF's acquired resources */ + struct vf_release_tlv { + struct vf_first_tlv first_tlv; + uint16_t vf_id; /* for debug */ +diff --git a/drivers/net/bnx2x/ecore_fw_defs.h b/drivers/net/bnx2x/ecore_fw_defs.h +index 93bca8ad33..6fc1fce7e2 100644 +--- a/drivers/net/bnx2x/ecore_fw_defs.h ++++ b/drivers/net/bnx2x/ecore_fw_defs.h +@@ -379,7 +379,7 @@ + /* temporarily used for RTT */ + #define XSEMI_CLK1_RESUL_CHIP (1e-3) + +-/* used for Host Coallescing */ ++/* used for Host Coalescing */ + #define SDM_TIMER_TICK_RESUL_CHIP (4 * (1e-6)) + #define TSDM_TIMER_TICK_RESUL_CHIP (1 * (1e-6)) + +diff --git a/drivers/net/bnx2x/ecore_hsi.h b/drivers/net/bnx2x/ecore_hsi.h +index 5508c53639..eda79408e9 100644 +--- a/drivers/net/bnx2x/ecore_hsi.h ++++ b/drivers/net/bnx2x/ecore_hsi.h +@@ -1062,7 +1062,7 @@ struct port_feat_cfg { /* port 0: 0x454 port 1: 0x4c8 */ + #define PORT_FEATURE_MBA_LINK_SPEED_20G 0x20000000 + + /* Secondary MBA configuration, +- * see mba_config for the fileds defination. ++ * see mba_config for the fields definition. + */ + uint32_t mba_config2; + +@@ -1075,7 +1075,7 @@ struct port_feat_cfg { /* port 0: 0x454 port 1: 0x4c8 */ + #define PORT_FEATURE_BOFM_CFGD_VEN 0x00080000 + + /* Secondary MBA configuration, +- * see mba_vlan_cfg for the fileds defination. ++ * see mba_vlan_cfg for the fields definition. + */ + uint32_t mba_vlan_cfg2; + +@@ -1429,7 +1429,7 @@ struct extended_dev_info_shared_cfg { /* NVRAM OFFSET */ + #define EXTENDED_DEV_INFO_SHARED_CFG_DBG_GEN3_COMPLI_ENA 0x00080000 + + /* Override Rx signal detect threshold when enabled the threshold +- * will be set staticaly ++ * will be set statically + */ + #define EXTENDED_DEV_INFO_SHARED_CFG_OVERRIDE_RX_SIG_MASK 0x00100000 + #define EXTENDED_DEV_INFO_SHARED_CFG_OVERRIDE_RX_SIG_SHIFT 20 +@@ -2189,9 +2189,9 @@ struct eee_remote_vals { + * elements on a per byte or word boundary. + * + * example: an array with 8 entries each 4 bit wide. This array will fit into +- * a single dword. The diagrmas below show the array order of the nibbles. ++ * a single dword. The diagrams below show the array order of the nibbles. + * +- * SHMEM_ARRAY_BITPOS(i, 4, 4) defines the stadard ordering: ++ * SHMEM_ARRAY_BITPOS(i, 4, 4) defines the standard ordering: + * + * | | | | + * 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | +@@ -2519,17 +2519,17 @@ struct shmem_lfa { + }; + + /* +- * Used to suppoert NSCI get OS driver version ++ * Used to support NSCI get OS driver version + * On driver load the version value will be set + * On driver unload driver value of 0x0 will be set + */ + struct os_drv_ver { + #define DRV_VER_NOT_LOADED 0 +- /*personalites orrder is importent */ ++ /* personalities order is important */ + #define DRV_PERS_ETHERNET 0 + #define DRV_PERS_ISCSI 1 + #define DRV_PERS_FCOE 2 +- /*shmem2 struct is constatnt can't add more personalites here*/ ++ /* shmem2 struct is constant can't add more personalities here */ + #define MAX_DRV_PERS 3 + uint32_t versions[MAX_DRV_PERS]; + }; +@@ -2821,7 +2821,7 @@ struct shmem2_region { + /* Flag to the driver that PF's drv_info_host_addr buffer was read */ + uint32_t mfw_drv_indication; /* Offset 0x19c */ + +- /* We use inidcation for each PF (0..3) */ ++ /* We use indication for each PF (0..3) */ + #define MFW_DRV_IND_READ_DONE_OFFSET(_pf_) (1 << (_pf_)) + + union { /* For various OEMs */ /* Offset 0x1a0 */ +@@ -6195,7 +6195,7 @@ struct hc_sb_data { + + + /* +- * Segment types for host coaslescing ++ * Segment types for host coalescing + */ + enum hc_segment { + HC_REGULAR_SEGMENT, +@@ -6242,7 +6242,7 @@ struct hc_status_block_data_e2 { + + + /* +- * IGU block operartion modes (in Everest2) ++ * IGU block operation modes (in Everest2) + */ + enum igu_mode { + HC_IGU_BC_MODE, +@@ -6508,7 +6508,7 @@ struct stats_query_header { + + + /* +- * Types of statistcis query entry ++ * Types of statistics query entry + */ + enum stats_query_type { + STATS_TYPE_QUEUE, +@@ -6542,7 +6542,7 @@ enum storm_id { + + + /* +- * Taffic types used in ETS and flow control algorithms ++ * Traffic types used in ETS and flow control algorithms + */ + enum traffic_type { + LLFC_TRAFFIC_TYPE_NW, +diff --git a/drivers/net/bnx2x/ecore_init_ops.h b/drivers/net/bnx2x/ecore_init_ops.h +index 0945e79993..4ed811fdd4 100644 +--- a/drivers/net/bnx2x/ecore_init_ops.h ++++ b/drivers/net/bnx2x/ecore_init_ops.h +@@ -534,7 +534,7 @@ static void ecore_init_pxp_arb(struct bnx2x_softc *sc, int r_order, + REG_WR(sc, PXP2_REG_WR_CDU_MPS, val); + } + +- /* Validate number of tags suppoted by device */ ++ /* Validate number of tags supported by device */ + #define PCIE_REG_PCIER_TL_HDR_FC_ST 0x2980 + val = REG_RD(sc, PCIE_REG_PCIER_TL_HDR_FC_ST); + val &= 0xFF; +@@ -714,7 +714,7 @@ static void ecore_ilt_client_init_op_ilt(struct bnx2x_softc *sc, + for (i = ilt_cli->start; i <= ilt_cli->end; i++) + ecore_ilt_line_init_op(sc, ilt, i, initop); + +- /* init/clear the ILT boundries */ ++ /* init/clear the ILT boundaries */ + ecore_ilt_boundary_init_op(sc, ilt_cli, ilt->start_line, initop); + } + +@@ -765,7 +765,7 @@ static void ecore_ilt_init_client_psz(struct bnx2x_softc *sc, int cli_num, + + /* + * called during init common stage, ilt clients should be initialized +- * prioir to calling this function ++ * prior to calling this function + */ + static void ecore_ilt_init_page_size(struct bnx2x_softc *sc, uint8_t initop) + { +diff --git a/drivers/net/bnx2x/ecore_reg.h b/drivers/net/bnx2x/ecore_reg.h +index bb92d131f8..6f7b0522f2 100644 +--- a/drivers/net/bnx2x/ecore_reg.h ++++ b/drivers/net/bnx2x/ecore_reg.h +@@ -19,7 +19,7 @@ + #define ATC_ATC_INT_STS_REG_ATC_RCPL_TO_EMPTY_CNT (0x1 << 3) + #define ATC_ATC_INT_STS_REG_ATC_TCPL_ERROR (0x1 << 4) + #define ATC_ATC_INT_STS_REG_ATC_TCPL_TO_NOT_PEND (0x1 << 1) +-/* [R 1] ATC initalization done */ ++/* [R 1] ATC initialization done */ + #define ATC_REG_ATC_INIT_DONE 0x1100bc + /* [RW 6] Interrupt mask register #0 read/write */ + #define ATC_REG_ATC_INT_MASK 0x1101c8 +@@ -56,7 +56,7 @@ + #define BRB1_REG_PAUSE_HIGH_THRESHOLD_0 0x60078 + /* [RW 10] Write client 0: Assert pause threshold. Not Functional */ + #define BRB1_REG_PAUSE_LOW_THRESHOLD_0 0x60068 +-/* [R 24] The number of full blocks occpied by port. */ ++/* [R 24] The number of full blocks occupied by port. */ + #define BRB1_REG_PORT_NUM_OCC_BLOCKS_0 0x60094 + /* [R 5] Used to read the value of the XX protection CAM occupancy counter. */ + #define CCM_REG_CAM_OCCUP 0xd0188 +@@ -456,7 +456,7 @@ + #define IGU_REG_PCI_PF_MSIX_FUNC_MASK 0x130148 + #define IGU_REG_PCI_PF_MSI_EN 0x130140 + /* [WB_R 32] Each bit represent the pending bits status for that SB. 0 = no +- * pending; 1 = pending. Pendings means interrupt was asserted; and write ++ * pending; 1 = pending. Pending means interrupt was asserted; and write + * done was not received. Data valid only in addresses 0-4. all the rest are + * zero. + */ +@@ -1059,14 +1059,14 @@ + /* [R 28] this field hold the last information that caused reserved + * attention. bits [19:0] - address; [22:20] function; [23] reserved; + * [27:24] the master that caused the attention - according to the following +- * encodeing:1 = pxp; 2 = mcp; 3 = usdm; 4 = tsdm; 5 = xsdm; 6 = csdm; 7 = ++ * encoding:1 = pxp; 2 = mcp; 3 = usdm; 4 = tsdm; 5 = xsdm; 6 = csdm; 7 = + * dbu; 8 = dmae + */ + #define MISC_REG_GRC_RSV_ATTN 0xa3c0 + /* [R 28] this field hold the last information that caused timeout + * attention. bits [19:0] - address; [22:20] function; [23] reserved; + * [27:24] the master that caused the attention - according to the following +- * encodeing:1 = pxp; 2 = mcp; 3 = usdm; 4 = tsdm; 5 = xsdm; 6 = csdm; 7 = ++ * encoding:1 = pxp; 2 = mcp; 3 = usdm; 4 = tsdm; 5 = xsdm; 6 = csdm; 7 = + * dbu; 8 = dmae + */ + #define MISC_REG_GRC_TIMEOUT_ATTN 0xa3c4 +@@ -1567,7 +1567,7 @@ + * MAC DA 2. The reset default is set to mask out all parameters. + */ + #define NIG_REG_P0_LLH_PTP_PARAM_MASK 0x187a0 +-/* [RW 14] Mask regiser for the rules used in detecting PTP packets. Set ++/* [RW 14] Mask register for the rules used in detecting PTP packets. Set + * each bit to 1 to mask out that particular rule. 0-{IPv4 DA 0; UDP DP 0} . + * 1-{IPv4 DA 0; UDP DP 1} . 2-{IPv4 DA 1; UDP DP 0} . 3-{IPv4 DA 1; UDP DP + * 1} . 4-{IPv6 DA 0; UDP DP 0} . 5-{IPv6 DA 0; UDP DP 1} . 6-{IPv6 DA 1; +@@ -1672,7 +1672,7 @@ + * MAC DA 2. The reset default is set to mask out all parameters. + */ + #define NIG_REG_P0_TLLH_PTP_PARAM_MASK 0x187f0 +-/* [RW 14] Mask regiser for the rules used in detecting PTP packets. Set ++/* [RW 14] Mask register for the rules used in detecting PTP packets. Set + * each bit to 1 to mask out that particular rule. 0-{IPv4 DA 0; UDP DP 0} . + * 1-{IPv4 DA 0; UDP DP 1} . 2-{IPv4 DA 1; UDP DP 0} . 3-{IPv4 DA 1; UDP DP + * 1} . 4-{IPv6 DA 0; UDP DP 0} . 5-{IPv6 DA 0; UDP DP 1} . 6-{IPv6 DA 1; +@@ -1839,7 +1839,7 @@ + * MAC DA 2. The reset default is set to mask out all parameters. + */ + #define NIG_REG_P1_LLH_PTP_PARAM_MASK 0x187c8 +-/* [RW 14] Mask regiser for the rules used in detecting PTP packets. Set ++/* [RW 14] Mask register for the rules used in detecting PTP packets. Set + * each bit to 1 to mask out that particular rule. 0-{IPv4 DA 0; UDP DP 0} . + * 1-{IPv4 DA 0; UDP DP 1} . 2-{IPv4 DA 1; UDP DP 0} . 3-{IPv4 DA 1; UDP DP + * 1} . 4-{IPv6 DA 0; UDP DP 0} . 5-{IPv6 DA 0; UDP DP 1} . 6-{IPv6 DA 1; +@@ -1926,7 +1926,7 @@ + * MAC DA 2. The reset default is set to mask out all parameters. + */ + #define NIG_REG_P1_TLLH_PTP_PARAM_MASK 0x187f8 +-/* [RW 14] Mask regiser for the rules used in detecting PTP packets. Set ++/* [RW 14] Mask register for the rules used in detecting PTP packets. Set + * each bit to 1 to mask out that particular rule. 0-{IPv4 DA 0; UDP DP 0} . + * 1-{IPv4 DA 0; UDP DP 1} . 2-{IPv4 DA 1; UDP DP 0} . 3-{IPv4 DA 1; UDP DP + * 1} . 4-{IPv6 DA 0; UDP DP 0} . 5-{IPv6 DA 0; UDP DP 1} . 6-{IPv6 DA 1; +@@ -2306,7 +2306,7 @@ + #define PBF_REG_HDRS_AFTER_BASIC 0x15c0a8 + /* [RW 6] Bit-map indicating which L2 hdrs may appear after L2 tag 0 */ + #define PBF_REG_HDRS_AFTER_TAG_0 0x15c0b8 +-/* [R 1] Removed for E3 B0 - Indicates which COS is conncted to the highest ++/* [R 1] Removed for E3 B0 - Indicates which COS is connected to the highest + * priority in the command arbiter. + */ + #define PBF_REG_HIGH_PRIORITY_COS_NUM 0x15c04c +@@ -2366,7 +2366,7 @@ + */ + #define PBF_REG_NUM_STRICT_ARB_SLOTS 0x15c064 + /* [R 11] Removed for E3 B0 - Port 0 threshold used by arbiter in 16 byte +- * lines used when pause not suppoterd. ++ * lines used when pause not supported. + */ + #define PBF_REG_P0_ARB_THRSH 0x1400e4 + /* [R 11] Removed for E3 B0 - Current credit for port 0 in the tx port +@@ -3503,7 +3503,7 @@ + * queues. + */ + #define QM_REG_OVFERROR 0x16805c +-/* [RC 6] the Q were the qverflow occurs */ ++/* [RC 6] the Q were the overflow occurs */ + #define QM_REG_OVFQNUM 0x168058 + /* [R 16] Pause state for physical queues 15-0 */ + #define QM_REG_PAUSESTATE0 0x168410 +@@ -4890,7 +4890,7 @@ + if set, generate pcie_err_attn output when this error is seen. WC \ + */ + #define PXPCS_TL_FUNC345_STAT_ERR_MASTER_ABRT2 \ +- (1 << 3) /* Receive UR Statusfor Function 2. If set, generate \ ++ (1 << 3) /* Receive UR Status for Function 2. If set, generate \ + pcie_err_attn output when this error is seen. WC */ + #define PXPCS_TL_FUNC345_STAT_ERR_CPL_TIMEOUT2 \ + (1 << 2) /* Completer Timeout Status Status for Function 2, if \ +@@ -4986,7 +4986,7 @@ + if set, generate pcie_err_attn output when this error is seen. WC \ + */ + #define PXPCS_TL_FUNC678_STAT_ERR_MASTER_ABRT5 \ +- (1 << 3) /* Receive UR Statusfor Function 5. If set, generate \ ++ (1 << 3) /* Receive UR Status for Function 5. If set, generate \ + pcie_err_attn output when this error is seen. WC */ + #define PXPCS_TL_FUNC678_STAT_ERR_CPL_TIMEOUT5 \ + (1 << 2) /* Completer Timeout Status Status for Function 5, if \ +diff --git a/drivers/net/bnx2x/ecore_sp.c b/drivers/net/bnx2x/ecore_sp.c +index 0075422eee..c6c3857778 100644 +--- a/drivers/net/bnx2x/ecore_sp.c ++++ b/drivers/net/bnx2x/ecore_sp.c +@@ -1338,7 +1338,7 @@ static int __ecore_vlan_mac_execute_step(struct bnx2x_softc *sc, + if (rc != ECORE_SUCCESS) { + __ecore_vlan_mac_h_pend(sc, o, *ramrod_flags); + +- /** Calling function should not diffrentiate between this case ++ /** Calling function should not differentiate between this case + * and the case in which there is already a pending ramrod + */ + rc = ECORE_PENDING; +@@ -2246,7 +2246,7 @@ struct ecore_pending_mcast_cmd { + union { + ecore_list_t macs_head; + uint32_t macs_num; /* Needed for DEL command */ +- int next_bin; /* Needed for RESTORE flow with aprox match */ ++ int next_bin; /* Needed for RESTORE flow with approx match */ + } data; + + int done; /* set to TRUE, when the command has been handled, +@@ -3424,7 +3424,7 @@ void ecore_init_mac_credit_pool(struct bnx2x_softc *sc, + } else { + + /* +- * CAM credit is equaly divided between all active functions ++ * CAM credit is equally divided between all active functions + * on the PATH. + */ + if (func_num > 0) { +diff --git a/drivers/net/bnx2x/ecore_sp.h b/drivers/net/bnx2x/ecore_sp.h +index d58072dac0..1f4d5a3ebe 100644 +--- a/drivers/net/bnx2x/ecore_sp.h ++++ b/drivers/net/bnx2x/ecore_sp.h +@@ -430,7 +430,7 @@ enum { + RAMROD_RESTORE, + /* Execute the next command now */ + RAMROD_EXEC, +- /* Don't add a new command and continue execution of posponed ++ /* Don't add a new command and continue execution of postponed + * commands. If not set a new command will be added to the + * pending commands list. + */ +@@ -1173,7 +1173,7 @@ struct ecore_rss_config_obj { + /* Last configured indirection table */ + uint8_t ind_table[T_ETH_INDIRECTION_TABLE_SIZE]; + +- /* flags for enabling 4-tupple hash on UDP */ ++ /* flags for enabling 4-tuple hash on UDP */ + uint8_t udp_rss_v4; + uint8_t udp_rss_v6; + +@@ -1285,7 +1285,7 @@ enum ecore_q_type { + #define ECORE_MULTI_TX_COS_E3B0 3 + #define ECORE_MULTI_TX_COS 3 /* Maximum possible */ + #define MAC_PAD (ECORE_ALIGN(ETH_ALEN, sizeof(uint32_t)) - ETH_ALEN) +-/* DMAE channel to be used by FW for timesync workaroun. A driver that sends ++/* DMAE channel to be used by FW for timesync workaround. A driver that sends + * timesync-related ramrods must not use this DMAE command ID. + */ + #define FW_DMAE_CMD_ID 6 +diff --git a/drivers/net/bnx2x/elink.c b/drivers/net/bnx2x/elink.c +index 2093d8f373..43fbf04ece 100644 +--- a/drivers/net/bnx2x/elink.c ++++ b/drivers/net/bnx2x/elink.c +@@ -1460,7 +1460,7 @@ static void elink_ets_e3b0_pbf_disabled(const struct elink_params *params) + } + /****************************************************************************** + * Description: +- * E3B0 disable will return basicly the values to init values. ++ * E3B0 disable will return basically the values to init values. + *. + ******************************************************************************/ + static elink_status_t elink_ets_e3b0_disabled(const struct elink_params *params, +@@ -1483,7 +1483,7 @@ static elink_status_t elink_ets_e3b0_disabled(const struct elink_params *params, + + /****************************************************************************** + * Description: +- * Disable will return basicly the values to init values. ++ * Disable will return basically the values to init values. + * + ******************************************************************************/ + elink_status_t elink_ets_disabled(struct elink_params *params, +@@ -1506,7 +1506,7 @@ elink_status_t elink_ets_disabled(struct elink_params *params, + + /****************************************************************************** + * Description +- * Set the COS mappimg to SP and BW until this point all the COS are not ++ * Set the COS mapping to SP and BW until this point all the COS are not + * set as SP or BW. + ******************************************************************************/ + static elink_status_t elink_ets_e3b0_cli_map(const struct elink_params *params, +@@ -1652,7 +1652,7 @@ static elink_status_t elink_ets_e3b0_get_total_bw( + } + ELINK_DEBUG_P0(sc, + "elink_ets_E3B0_config total BW should be 100"); +- /* We can handle a case whre the BW isn't 100 this can happen ++ /* We can handle a case where the BW isn't 100 this can happen + * if the TC are joined. + */ + } +@@ -2608,7 +2608,7 @@ static elink_status_t elink_emac_enable(struct elink_params *params, + REG_WR(sc, NIG_REG_EGRESS_EMAC0_PORT + port * 4, 1); + + #ifdef ELINK_INCLUDE_EMUL +- /* for paladium */ ++ /* for palladium */ + if (CHIP_REV_IS_EMUL(sc)) { + /* Use lane 1 (of lanes 0-3) */ + REG_WR(sc, NIG_REG_XGXS_LANE_SEL_P0 + port * 4, 1); +@@ -2850,7 +2850,7 @@ static void elink_update_pfc_bmac2(struct elink_params *params, + + /* Set Time (based unit is 512 bit time) between automatic + * re-sending of PP packets amd enable automatic re-send of +- * Per-Priroity Packet as long as pp_gen is asserted and ++ * Per-Priority Packet as long as pp_gen is asserted and + * pp_disable is low. + */ + val = 0x8000; +@@ -3369,7 +3369,7 @@ static elink_status_t elink_pbf_update(struct elink_params *params, + } + + /** +- * elink_get_emac_base - retrive emac base address ++ * elink_get_emac_base - retrieve emac base address + * + * @bp: driver handle + * @mdc_mdio_access: access type +@@ -4518,7 +4518,7 @@ static void elink_warpcore_enable_AN_KR2(struct elink_phy *phy, + elink_cl45_write(sc, phy, reg_set[i].devad, reg_set[i].reg, + reg_set[i].val); + +- /* Start KR2 work-around timer which handles BNX2X8073 link-parner */ ++ /* Start KR2 work-around timer which handles BNX2X8073 link-partner */ + params->link_attr_sync |= LINK_ATTR_SYNC_KR2_ENABLE; + elink_update_link_attr(params, params->link_attr_sync); + } +@@ -7824,7 +7824,7 @@ elink_status_t elink_link_update(struct elink_params *params, + * hence its link is expected to be down + * - SECOND_PHY means that first phy should not be able + * to link up by itself (using configuration) +- * - DEFAULT should be overridden during initialiazation ++ * - DEFAULT should be overridden during initialization + */ + ELINK_DEBUG_P1(sc, "Invalid link indication" + " mpc=0x%x. DISABLING LINK !!!", +@@ -10991,7 +10991,7 @@ static elink_status_t elink_84858_cmd_hdlr(struct elink_phy *phy, + ELINK_DEBUG_P0(sc, "FW cmd failed."); + return ELINK_STATUS_ERROR; + } +- /* Step5: Once the command has completed, read the specficied DATA ++ /* Step5: Once the command has completed, read the specified DATA + * registers for any saved results for the command, if applicable + */ + +diff --git a/drivers/net/bnxt/bnxt_hwrm.c b/drivers/net/bnxt/bnxt_hwrm.c +index f53f8632fe..7bcf36c9cb 100644 +--- a/drivers/net/bnxt/bnxt_hwrm.c ++++ b/drivers/net/bnxt/bnxt_hwrm.c +@@ -3727,7 +3727,7 @@ int bnxt_hwrm_allocate_pf_only(struct bnxt *bp) + int rc; + + if (!BNXT_PF(bp)) { +- PMD_DRV_LOG(ERR, "Attempt to allcoate VFs on a VF!\n"); ++ PMD_DRV_LOG(ERR, "Attempt to allocate VFs on a VF!\n"); + return -EINVAL; + } + +diff --git a/drivers/net/bnxt/tf_core/tfp.c b/drivers/net/bnxt/tf_core/tfp.c +index a4b0934610..a967a9ccf2 100644 +--- a/drivers/net/bnxt/tf_core/tfp.c ++++ b/drivers/net/bnxt/tf_core/tfp.c +@@ -52,7 +52,7 @@ tfp_send_msg_direct(struct bnxt *bp, + } + + /** +- * Allocates zero'ed memory from the heap. ++ * Allocates zeroed memory from the heap. + * + * Returns success or failure code. + */ +diff --git a/drivers/net/bnxt/tf_core/tfp.h b/drivers/net/bnxt/tf_core/tfp.h +index dd0a347058..5a99c7a06e 100644 +--- a/drivers/net/bnxt/tf_core/tfp.h ++++ b/drivers/net/bnxt/tf_core/tfp.h +@@ -150,7 +150,7 @@ tfp_msg_hwrm_oem_cmd(struct tf *tfp, + uint32_t max_flows); + + /** +- * Allocates zero'ed memory from the heap. ++ * Allocates zeroed memory from the heap. + * + * NOTE: Also performs virt2phy address conversion by default thus is + * can be expensive to invoke. +diff --git a/drivers/net/bonding/eth_bond_8023ad_private.h b/drivers/net/bonding/eth_bond_8023ad_private.h +index 9b5738afee..a5e1fffea1 100644 +--- a/drivers/net/bonding/eth_bond_8023ad_private.h ++++ b/drivers/net/bonding/eth_bond_8023ad_private.h +@@ -20,7 +20,7 @@ + /** Maximum number of LACP packets from one slave queued in TX ring. */ + #define BOND_MODE_8023AX_SLAVE_TX_PKTS 1 + /** +- * Timeouts deffinitions (5.4.4 in 802.1AX documentation). ++ * Timeouts definitions (5.4.4 in 802.1AX documentation). + */ + #define BOND_8023AD_FAST_PERIODIC_MS 900 + #define BOND_8023AD_SLOW_PERIODIC_MS 29000 +diff --git a/drivers/net/bonding/eth_bond_private.h b/drivers/net/bonding/eth_bond_private.h +index 8b104b6391..9626b26d67 100644 +--- a/drivers/net/bonding/eth_bond_private.h ++++ b/drivers/net/bonding/eth_bond_private.h +@@ -139,7 +139,7 @@ struct bond_dev_private { + + uint16_t slave_count; /**< Number of bonded slaves */ + struct bond_slave_details slaves[RTE_MAX_ETHPORTS]; +- /**< Arary of bonded slaves details */ ++ /**< Array of bonded slaves details */ + + struct mode8023ad_private mode4; + uint16_t tlb_slaves_order[RTE_MAX_ETHPORTS]; +diff --git a/drivers/net/bonding/rte_eth_bond_8023ad.c b/drivers/net/bonding/rte_eth_bond_8023ad.c +index ca50583d62..b3cddd8a20 100644 +--- a/drivers/net/bonding/rte_eth_bond_8023ad.c ++++ b/drivers/net/bonding/rte_eth_bond_8023ad.c +@@ -243,7 +243,7 @@ record_default(struct port *port) + { + /* Record default parameters for partner. Partner admin parameters + * are not implemented so set them to arbitrary default (last known) and +- * mark actor that parner is in defaulted state. */ ++ * mark actor that partner is in defaulted state. */ + port->partner_state = STATE_LACP_ACTIVE; + ACTOR_STATE_SET(port, DEFAULTED); + } +@@ -300,7 +300,7 @@ rx_machine(struct bond_dev_private *internals, uint16_t slave_id, + MODE4_DEBUG("LACP -> CURRENT\n"); + BOND_PRINT_LACP(lacp); + /* Update selected flag. If partner parameters are defaulted assume they +- * are match. If not defaulted compare LACP actor with ports parner ++ * are match. If not defaulted compare LACP actor with ports partner + * params. */ + if (!ACTOR_STATE(port, DEFAULTED) && + (ACTOR_STATE(port, AGGREGATION) != PARTNER_STATE(port, AGGREGATION) +@@ -399,16 +399,16 @@ periodic_machine(struct bond_dev_private *internals, uint16_t slave_id) + PARTNER_STATE(port, LACP_ACTIVE); + + uint8_t is_partner_fast, was_partner_fast; +- /* No periodic is on BEGIN, LACP DISABLE or when both sides are pasive */ ++ /* No periodic is on BEGIN, LACP DISABLE or when both sides are passive */ + if (SM_FLAG(port, BEGIN) || !SM_FLAG(port, LACP_ENABLED) || !active) { + timer_cancel(&port->periodic_timer); + timer_force_expired(&port->tx_machine_timer); + SM_FLAG_CLR(port, PARTNER_SHORT_TIMEOUT); + + MODE4_DEBUG("-> NO_PERIODIC ( %s%s%s)\n", +- SM_FLAG(port, BEGIN) ? "begind " : "", ++ SM_FLAG(port, BEGIN) ? "begin " : "", + SM_FLAG(port, LACP_ENABLED) ? "" : "LACP disabled ", +- active ? "LACP active " : "LACP pasive "); ++ active ? "LACP active " : "LACP passive "); + return; + } + +@@ -495,10 +495,10 @@ mux_machine(struct bond_dev_private *internals, uint16_t slave_id) + if ((ACTOR_STATE(port, DISTRIBUTING) || ACTOR_STATE(port, COLLECTING)) && + !PARTNER_STATE(port, SYNCHRONIZATION)) { + /* If in COLLECTING or DISTRIBUTING state and partner becomes out of +- * sync transit to ATACHED state. */ ++ * sync transit to ATTACHED state. */ + ACTOR_STATE_CLR(port, DISTRIBUTING); + ACTOR_STATE_CLR(port, COLLECTING); +- /* Clear actor sync to activate transit ATACHED in condition bellow */ ++ /* Clear actor sync to activate transit ATTACHED in condition bellow */ + ACTOR_STATE_CLR(port, SYNCHRONIZATION); + MODE4_DEBUG("Out of sync -> ATTACHED\n"); + } +@@ -696,7 +696,7 @@ selection_logic(struct bond_dev_private *internals, uint16_t slave_id) + /* Search for aggregator suitable for this port */ + for (i = 0; i < slaves_count; ++i) { + agg = &bond_mode_8023ad_ports[slaves[i]]; +- /* Skip ports that are not aggreagators */ ++ /* Skip ports that are not aggregators */ + if (agg->aggregator_port_id != slaves[i]) + continue; + +@@ -921,7 +921,7 @@ bond_mode_8023ad_periodic_cb(void *arg) + + SM_FLAG_SET(port, BEGIN); + +- /* LACP is disabled on half duples or link is down */ ++ /* LACP is disabled on half duplex or link is down */ + if (SM_FLAG(port, LACP_ENABLED)) { + /* If port was enabled set it to BEGIN state */ + SM_FLAG_CLR(port, LACP_ENABLED); +@@ -1069,7 +1069,7 @@ bond_mode_8023ad_activate_slave(struct rte_eth_dev *bond_dev, + port->partner_state = STATE_LACP_ACTIVE | STATE_AGGREGATION; + port->sm_flags = SM_FLAGS_BEGIN; + +- /* use this port as agregator */ ++ /* use this port as aggregator */ + port->aggregator_port_id = slave_id; + + if (bond_mode_8023ad_register_lacp_mac(slave_id) < 0) { +diff --git a/drivers/net/bonding/rte_eth_bond_8023ad.h b/drivers/net/bonding/rte_eth_bond_8023ad.h +index 11a71a55e5..7eb392f8c8 100644 +--- a/drivers/net/bonding/rte_eth_bond_8023ad.h ++++ b/drivers/net/bonding/rte_eth_bond_8023ad.h +@@ -68,7 +68,7 @@ struct port_params { + struct rte_ether_addr system; + /**< System ID - Slave MAC address, same as bonding MAC address */ + uint16_t key; +- /**< Speed information (implementation dependednt) and duplex. */ ++ /**< Speed information (implementation dependent) and duplex. */ + uint16_t port_priority; + /**< Priority of this (unused in current implementation) */ + uint16_t port_number; +@@ -317,7 +317,7 @@ rte_eth_bond_8023ad_dedicated_queues_disable(uint16_t port_id); + * @param port_id Bonding device id + * + * @return +- * agregator mode on success, negative value otherwise ++ * aggregator mode on success, negative value otherwise + */ + int + rte_eth_bond_8023ad_agg_selection_get(uint16_t port_id); +diff --git a/drivers/net/bonding/rte_eth_bond_alb.h b/drivers/net/bonding/rte_eth_bond_alb.h +index 386e70c594..4e9aeda9bc 100644 +--- a/drivers/net/bonding/rte_eth_bond_alb.h ++++ b/drivers/net/bonding/rte_eth_bond_alb.h +@@ -96,7 +96,7 @@ bond_mode_alb_arp_xmit(struct rte_ether_hdr *eth_h, uint16_t offset, + * @param internals Bonding data. + * + * @return +- * Index of slawe on which packet should be sent. ++ * Index of slave on which packet should be sent. + */ + uint16_t + bond_mode_alb_arp_upd(struct client_data *client_info, +diff --git a/drivers/net/bonding/rte_eth_bond_api.c b/drivers/net/bonding/rte_eth_bond_api.c +index 84943cffe2..2d5cac6c51 100644 +--- a/drivers/net/bonding/rte_eth_bond_api.c ++++ b/drivers/net/bonding/rte_eth_bond_api.c +@@ -375,7 +375,7 @@ eth_bond_slave_inherit_dev_info_rx_next(struct bond_dev_private *internals, + * value. Thus, the new internal value of default Rx queue offloads + * has to be masked by rx_queue_offload_capa to make sure that only + * commonly supported offloads are preserved from both the previous +- * value and the value being inhereted from the new slave device. ++ * value and the value being inherited from the new slave device. + */ + rxconf_i->offloads = (rxconf_i->offloads | rxconf->offloads) & + internals->rx_queue_offload_capa; +@@ -413,7 +413,7 @@ eth_bond_slave_inherit_dev_info_tx_next(struct bond_dev_private *internals, + * value. Thus, the new internal value of default Tx queue offloads + * has to be masked by tx_queue_offload_capa to make sure that only + * commonly supported offloads are preserved from both the previous +- * value and the value being inhereted from the new slave device. ++ * value and the value being inherited from the new slave device. + */ + txconf_i->offloads = (txconf_i->offloads | txconf->offloads) & + internals->tx_queue_offload_capa; +diff --git a/drivers/net/cnxk/cn10k_ethdev.h b/drivers/net/cnxk/cn10k_ethdev.h +index c2a46ad7ec..0982158c62 100644 +--- a/drivers/net/cnxk/cn10k_ethdev.h ++++ b/drivers/net/cnxk/cn10k_ethdev.h +@@ -53,7 +53,7 @@ struct cn10k_outb_priv_data { + void *userdata; + /* Rlen computation data */ + struct cnxk_ipsec_outb_rlens rlens; +- /* Back pinter to eth sec session */ ++ /* Back pointer to eth sec session */ + struct cnxk_eth_sec_sess *eth_sec; + /* SA index */ + uint32_t sa_idx; +diff --git a/drivers/net/cnxk/cn10k_tx.h b/drivers/net/cnxk/cn10k_tx.h +index 873e1871f9..f3a282f429 100644 +--- a/drivers/net/cnxk/cn10k_tx.h ++++ b/drivers/net/cnxk/cn10k_tx.h +@@ -736,7 +736,7 @@ cn10k_nix_xmit_prepare_tstamp(uintptr_t lmt_addr, const uint64_t *cmd, + /* Retrieving the default desc values */ + lmt[off] = cmd[2]; + +- /* Using compiler barier to avoid voilation of C ++ /* Using compiler barrier to avoid violation of C + * aliasing rules. + */ + rte_compiler_barrier(); +@@ -745,7 +745,7 @@ cn10k_nix_xmit_prepare_tstamp(uintptr_t lmt_addr, const uint64_t *cmd, + /* Packets for which RTE_MBUF_F_TX_IEEE1588_TMST is not set, tx tstamp + * should not be recorded, hence changing the alg type to + * NIX_SENDMEMALG_SET and also changing send mem addr field to +- * next 8 bytes as it corrpt the actual tx tstamp registered ++ * next 8 bytes as it corrupts the actual Tx tstamp registered + * address. + */ + send_mem->w0.subdc = NIX_SUBDC_MEM; +@@ -2254,7 +2254,7 @@ cn10k_nix_xmit_pkts_vector(void *tx_queue, struct rte_mbuf **tx_pkts, + } + + if (flags & NIX_TX_OFFLOAD_TSTAMP_F) { +- /* Tx ol_flag for timestam. */ ++ /* Tx ol_flag for timestamp. */ + const uint64x2_t olf = {RTE_MBUF_F_TX_IEEE1588_TMST, + RTE_MBUF_F_TX_IEEE1588_TMST}; + /* Set send mem alg to SUB. */ +diff --git a/drivers/net/cnxk/cn9k_tx.h b/drivers/net/cnxk/cn9k_tx.h +index 435dde1317..070a7d9439 100644 +--- a/drivers/net/cnxk/cn9k_tx.h ++++ b/drivers/net/cnxk/cn9k_tx.h +@@ -304,7 +304,7 @@ cn9k_nix_xmit_prepare_tstamp(uint64_t *cmd, const uint64_t *send_mem_desc, + /* Retrieving the default desc values */ + cmd[off] = send_mem_desc[6]; + +- /* Using compiler barier to avoid voilation of C ++ /* Using compiler barrier to avoid violation of C + * aliasing rules. + */ + rte_compiler_barrier(); +@@ -313,7 +313,7 @@ cn9k_nix_xmit_prepare_tstamp(uint64_t *cmd, const uint64_t *send_mem_desc, + /* Packets for which RTE_MBUF_F_TX_IEEE1588_TMST is not set, tx tstamp + * should not be recorded, hence changing the alg type to + * NIX_SENDMEMALG_SET and also changing send mem addr field to +- * next 8 bytes as it corrpt the actual tx tstamp registered ++ * next 8 bytes as it corrupts the actual Tx tstamp registered + * address. + */ + send_mem->w0.cn9k.alg = +@@ -1531,7 +1531,7 @@ cn9k_nix_xmit_pkts_vector(void *tx_queue, struct rte_mbuf **tx_pkts, + } + + if (flags & NIX_TX_OFFLOAD_TSTAMP_F) { +- /* Tx ol_flag for timestam. */ ++ /* Tx ol_flag for timestamp. */ + const uint64x2_t olf = {RTE_MBUF_F_TX_IEEE1588_TMST, + RTE_MBUF_F_TX_IEEE1588_TMST}; + /* Set send mem alg to SUB. */ +diff --git a/drivers/net/cnxk/cnxk_ptp.c b/drivers/net/cnxk/cnxk_ptp.c +index 139fea256c..359f9a30ae 100644 +--- a/drivers/net/cnxk/cnxk_ptp.c ++++ b/drivers/net/cnxk/cnxk_ptp.c +@@ -12,7 +12,7 @@ cnxk_nix_read_clock(struct rte_eth_dev *eth_dev, uint64_t *clock) + /* This API returns the raw PTP HI clock value. Since LFs do not + * have direct access to PTP registers and it requires mbox msg + * to AF for this value. In fastpath reading this value for every +- * packet (which involes mbox call) becomes very expensive, hence ++ * packet (which involves mbox call) becomes very expensive, hence + * we should be able to derive PTP HI clock value from tsc by + * using freq_mult and clk_delta calculated during configure stage. + */ +diff --git a/drivers/net/cxgbe/cxgbe_flow.c b/drivers/net/cxgbe/cxgbe_flow.c +index edcbba9d7c..6e460dfe2e 100644 +--- a/drivers/net/cxgbe/cxgbe_flow.c ++++ b/drivers/net/cxgbe/cxgbe_flow.c +@@ -1378,7 +1378,7 @@ cxgbe_flow_validate(struct rte_eth_dev *dev, + } + + /* +- * @ret : > 0 filter destroyed succsesfully ++ * @ret : > 0 filter destroyed successfully + * < 0 error destroying filter + * == 1 filter not active / not found + */ +diff --git a/drivers/net/cxgbe/cxgbevf_main.c b/drivers/net/cxgbe/cxgbevf_main.c +index f639612ae4..d0c93f8ac3 100644 +--- a/drivers/net/cxgbe/cxgbevf_main.c ++++ b/drivers/net/cxgbe/cxgbevf_main.c +@@ -44,7 +44,7 @@ static void size_nports_qsets(struct adapter *adapter) + */ + pmask_nports = hweight32(adapter->params.vfres.pmask); + if (pmask_nports < adapter->params.nports) { +- dev_warn(adapter->pdev_dev, "only using %d of %d provissioned" ++ dev_warn(adapter->pdev_dev, "only using %d of %d provisioned" + " virtual interfaces; limited by Port Access Rights" + " mask %#x\n", pmask_nports, adapter->params.nports, + adapter->params.vfres.pmask); +diff --git a/drivers/net/cxgbe/sge.c b/drivers/net/cxgbe/sge.c +index f623f3e684..1c76b8e4d0 100644 +--- a/drivers/net/cxgbe/sge.c ++++ b/drivers/net/cxgbe/sge.c +@@ -211,7 +211,7 @@ static inline unsigned int fl_cap(const struct sge_fl *fl) + * @fl: the Free List + * + * Tests specified Free List to see whether the number of buffers +- * available to the hardware has falled below our "starvation" ++ * available to the hardware has fallen below our "starvation" + * threshold. + */ + static inline bool fl_starving(const struct adapter *adapter, +@@ -678,7 +678,7 @@ static void write_sgl(struct rte_mbuf *mbuf, struct sge_txq *q, + * @q: the Tx queue + * @n: number of new descriptors to give to HW + * +- * Ring the doorbel for a Tx queue. ++ * Ring the doorbell for a Tx queue. + */ + static inline void ring_tx_db(struct adapter *adap, struct sge_txq *q) + { +@@ -877,7 +877,7 @@ static inline void ship_tx_pkt_coalesce_wr(struct adapter *adap, + } + + /** +- * should_tx_packet_coalesce - decides wether to coalesce an mbuf or not ++ * should_tx_packet_coalesce - decides whether to coalesce an mbuf or not + * @txq: tx queue where the mbuf is sent + * @mbuf: mbuf to be sent + * @nflits: return value for number of flits needed +@@ -1846,7 +1846,7 @@ int t4_sge_alloc_rxq(struct adapter *adap, struct sge_rspq *iq, bool fwevtq, + * for its status page) along with the associated software + * descriptor ring. The free list size needs to be a multiple + * of the Egress Queue Unit and at least 2 Egress Units larger +- * than the SGE's Egress Congrestion Threshold ++ * than the SGE's Egress Congestion Threshold + * (fl_starve_thres - 1). + */ + if (fl->size < s->fl_starve_thres - 1 + 2 * 8) +diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c +index e49f765434..2c2c4e4ebb 100644 +--- a/drivers/net/dpaa/dpaa_ethdev.c ++++ b/drivers/net/dpaa/dpaa_ethdev.c +@@ -1030,7 +1030,7 @@ int dpaa_eth_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx, + QM_FQCTRL_CTXASTASHING | + QM_FQCTRL_PREFERINCACHE; + opts.fqd.context_a.stashing.exclusive = 0; +- /* In muticore scenario stashing becomes a bottleneck on LS1046. ++ /* In multicore scenario stashing becomes a bottleneck on LS1046. + * So do not enable stashing in this case + */ + if (dpaa_svr_family != SVR_LS1046A_FAMILY) +@@ -1866,7 +1866,7 @@ dpaa_dev_init(struct rte_eth_dev *eth_dev) + + dpaa_intf->name = dpaa_device->name; + +- /* save fman_if & cfg in the interface struture */ ++ /* save fman_if & cfg in the interface structure */ + eth_dev->process_private = fman_intf; + dpaa_intf->ifid = dev_id; + dpaa_intf->cfg = cfg; +@@ -2169,7 +2169,7 @@ rte_dpaa_probe(struct rte_dpaa_driver *dpaa_drv, + if (dpaa_svr_family == SVR_LS1043A_FAMILY) + dpaa_push_mode_max_queue = 0; + +- /* if push mode queues to be enabled. Currenly we are allowing ++ /* if push mode queues to be enabled. Currently we are allowing + * only one queue per thread. + */ + if (getenv("DPAA_PUSH_QUEUES_NUMBER")) { +diff --git a/drivers/net/dpaa/dpaa_rxtx.c b/drivers/net/dpaa/dpaa_rxtx.c +index ffac6ce3e2..956fe946fa 100644 +--- a/drivers/net/dpaa/dpaa_rxtx.c ++++ b/drivers/net/dpaa/dpaa_rxtx.c +@@ -600,8 +600,8 @@ void dpaa_rx_cb_prepare(struct qm_dqrr_entry *dq, void **bufs) + void *ptr = rte_dpaa_mem_ptov(qm_fd_addr(&dq->fd)); + + /* In case of LS1046, annotation stashing is disabled due to L2 cache +- * being bottleneck in case of multicore scanario for this platform. +- * So we prefetch the annoation beforehand, so that it is available ++ * being bottleneck in case of multicore scenario for this platform. ++ * So we prefetch the annotation beforehand, so that it is available + * in cache when accessed. + */ + rte_prefetch0((void *)((uint8_t *)ptr + DEFAULT_RX_ICEOF)); +diff --git a/drivers/net/dpaa/fmlib/fm_ext.h b/drivers/net/dpaa/fmlib/fm_ext.h +index 27c9fb471e..8e7153bdaf 100644 +--- a/drivers/net/dpaa/fmlib/fm_ext.h ++++ b/drivers/net/dpaa/fmlib/fm_ext.h +@@ -176,7 +176,7 @@ typedef struct t_fm_prs_result { + #define FM_FD_ERR_PRS_HDR_ERR 0x00000020 + /**< Header error was identified during parsing */ + #define FM_FD_ERR_BLOCK_LIMIT_EXCEEDED 0x00000008 +- /**< Frame parsed beyind 256 first bytes */ ++ /**< Frame parsed beyond 256 first bytes */ + + #define FM_FD_TX_STATUS_ERR_MASK (FM_FD_ERR_UNSUPPORTED_FORMAT | \ + FM_FD_ERR_LENGTH | \ +diff --git a/drivers/net/dpaa/fmlib/fm_pcd_ext.h b/drivers/net/dpaa/fmlib/fm_pcd_ext.h +index 8be3885fbc..3802b42916 100644 +--- a/drivers/net/dpaa/fmlib/fm_pcd_ext.h ++++ b/drivers/net/dpaa/fmlib/fm_pcd_ext.h +@@ -276,7 +276,7 @@ typedef struct ioc_fm_pcd_counters_params_t { + } ioc_fm_pcd_counters_params_t; + + /* +- * @Description structure for FM exception definitios ++ * @Description structure for FM exception definitions + */ + typedef struct ioc_fm_pcd_exception_params_t { + ioc_fm_pcd_exceptions exception; /**< The requested exception */ +@@ -883,7 +883,7 @@ typedef enum ioc_fm_pcd_manip_hdr_rmv_specific_l2 { + e_IOC_FM_PCD_MANIP_HDR_RMV_ETHERNET, /**< Ethernet/802.3 MAC */ + e_IOC_FM_PCD_MANIP_HDR_RMV_STACKED_QTAGS, /**< stacked QTags */ + e_IOC_FM_PCD_MANIP_HDR_RMV_ETHERNET_AND_MPLS, +- /**< MPLS and Ethernet/802.3 MAC header unitl the header ++ /**< MPLS and Ethernet/802.3 MAC header until the header + * which follows the MPLS header + */ + e_IOC_FM_PCD_MANIP_HDR_RMV_MPLS +@@ -3293,7 +3293,7 @@ typedef struct ioc_fm_pcd_cc_tbl_get_stats_t { + /* + * @Function fm_pcd_net_env_characteristics_delete + * +- * @Description Deletes a set of Network Environment Charecteristics. ++ * @Description Deletes a set of Network Environment Characteristics. + * + * @Param[in] ioc_fm_obj_t The id of a Network Environment object. + * +@@ -3493,7 +3493,7 @@ typedef struct ioc_fm_pcd_cc_tbl_get_stats_t { + * @Return 0 on success; Error code otherwise. + * + * @Cautions Allowed only following fm_pcd_match_table_set() not only of +- * the relevnt node but also the node that points to this node. ++ * the relevant node but also the node that points to this node. + */ + #define FM_PCD_IOC_MATCH_TABLE_MODIFY_KEY_AND_NEXT_ENGINE \ + _IOW(FM_IOC_TYPE_BASE, FM_PCD_IOC_NUM(35), \ +diff --git a/drivers/net/dpaa/fmlib/fm_port_ext.h b/drivers/net/dpaa/fmlib/fm_port_ext.h +index 6f5479fbe1..bb2e00222e 100644 +--- a/drivers/net/dpaa/fmlib/fm_port_ext.h ++++ b/drivers/net/dpaa/fmlib/fm_port_ext.h +@@ -498,7 +498,7 @@ typedef struct ioc_fm_port_pcd_prs_params_t { + /**< Number of bytes from beginning of packet to start parsing + */ + ioc_net_header_type first_prs_hdr; +- /**< The type of the first header axpected at 'parsing_offset' ++ /**< The type of the first header expected at 'parsing_offset' + */ + bool include_in_prs_statistics; + /**< TRUE to include this port in the parser statistics */ +@@ -524,7 +524,7 @@ typedef struct ioc_fm_port_pcd_prs_params_t { + } ioc_fm_port_pcd_prs_params_t; + + /* +- * @Description A structure for defining coarse alassification parameters ++ * @Description A structure for defining coarse classification parameters + * (Must match t_fm_portPcdCcParams defined in fm_port_ext.h) + */ + typedef struct ioc_fm_port_pcd_cc_params_t { +@@ -602,7 +602,7 @@ typedef struct ioc_fm_pcd_prs_start_t { + /**< Number of bytes from beginning of packet to start parsing + */ + ioc_net_header_type first_prs_hdr; +- /**< The type of the first header axpected at 'parsing_offset' ++ /**< The type of the first header expected at 'parsing_offset' + */ + } ioc_fm_pcd_prs_start_t; + +@@ -1356,7 +1356,7 @@ typedef uint32_t fm_port_frame_err_select_t; + #define FM_PORT_FRM_ERR_PRS_HDR_ERR FM_FD_ERR_PRS_HDR_ERR + /**< Header error was identified during parsing */ + #define FM_PORT_FRM_ERR_BLOCK_LIMIT_EXCEEDED FM_FD_ERR_BLOCK_LIMIT_EXCEEDED +- /**< Frame parsed beyind 256 first bytes */ ++ /**< Frame parsed beyond 256 first bytes */ + #define FM_PORT_FRM_ERR_PROCESS_TIMEOUT 0x00000001 + /**< FPM Frame Processing Timeout Exceeded */ + /* @} */ +@@ -1390,7 +1390,7 @@ typedef void (t_fm_port_exception_callback) (t_handle h_app, + * @Param[in] length length of received data + * @Param[in] status receive status and errors + * @Param[in] position position of buffer in frame +- * @Param[in] h_buf_context A handle of the user acossiated with this buffer ++ * @Param[in] h_buf_context A handle of the user associated with this buffer + * + * @Retval e_RX_STORE_RESPONSE_CONTINUE + * order the driver to continue Rx operation for all ready data. +@@ -1414,7 +1414,7 @@ typedef e_rx_store_response(t_fm_port_im_rx_store_callback) (t_handle h_app, + * @Param[in] p_data A pointer to data received + * @Param[in] status transmit status and errors + * @Param[in] last_buffer is last buffer in frame +- * @Param[in] h_buf_context A handle of the user acossiated with this buffer ++ * @Param[in] h_buf_context A handle of the user associated with this buffer + */ + typedef void (t_fm_port_im_tx_conf_callback) (t_handle h_app, + uint8_t *p_data, +@@ -2585,7 +2585,7 @@ typedef struct t_fm_port_congestion_grps { + bool pfc_prio_enable[FM_NUM_CONG_GRPS][FM_MAX_PFC_PRIO]; + /**< a matrix that represents the map between the CG ids + * defined in 'congestion_grps_to_consider' to the +- * priorties mapping array. ++ * priorities mapping array. + */ + } t_fm_port_congestion_grps; + +diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c +index a3706439d5..2b04f14168 100644 +--- a/drivers/net/dpaa2/dpaa2_ethdev.c ++++ b/drivers/net/dpaa2/dpaa2_ethdev.c +@@ -143,7 +143,7 @@ dpaa2_vlan_offload_set(struct rte_eth_dev *dev, int mask) + PMD_INIT_FUNC_TRACE(); + + if (mask & RTE_ETH_VLAN_FILTER_MASK) { +- /* VLAN Filter not avaialble */ ++ /* VLAN Filter not available */ + if (!priv->max_vlan_filters) { + DPAA2_PMD_INFO("VLAN filter not available"); + return -ENOTSUP; +@@ -916,7 +916,7 @@ dpaa2_dev_tx_queue_setup(struct rte_eth_dev *dev, + cong_notif_cfg.units = DPNI_CONGESTION_UNIT_FRAMES; + cong_notif_cfg.threshold_entry = nb_tx_desc; + /* Notify that the queue is not congested when the data in +- * the queue is below this thershold.(90% of value) ++ * the queue is below this threshold.(90% of value) + */ + cong_notif_cfg.threshold_exit = (nb_tx_desc * 9) / 10; + cong_notif_cfg.message_ctx = 0; +@@ -1058,7 +1058,7 @@ dpaa2_supported_ptypes_get(struct rte_eth_dev *dev) + * Dpaa2 link Interrupt handler + * + * @param param +- * The address of parameter (struct rte_eth_dev *) regsitered before. ++ * The address of parameter (struct rte_eth_dev *) registered before. + * + * @return + * void +@@ -2236,7 +2236,7 @@ int dpaa2_eth_eventq_attach(const struct rte_eth_dev *dev, + ocfg.oa = 1; + /* Late arrival window size disabled */ + ocfg.olws = 0; +- /* ORL resource exhaustaion advance NESN disabled */ ++ /* ORL resource exhaustion advance NESN disabled */ + ocfg.oeane = 0; + /* Loose ordering enabled */ + ocfg.oloe = 1; +@@ -2720,13 +2720,13 @@ dpaa2_dev_init(struct rte_eth_dev *eth_dev) + } + eth_dev->tx_pkt_burst = dpaa2_dev_tx; + +- /*Init fields w.r.t. classficaition*/ ++ /* Init fields w.r.t. classification */ + memset(&priv->extract.qos_key_extract, 0, + sizeof(struct dpaa2_key_extract)); + priv->extract.qos_extract_param = (size_t)rte_malloc(NULL, 256, 64); + if (!priv->extract.qos_extract_param) { + DPAA2_PMD_ERR(" Error(%d) in allocation resources for flow " +- " classificaiton ", ret); ++ " classification ", ret); + goto init_err; + } + priv->extract.qos_key_extract.key_info.ipv4_src_offset = +@@ -2744,7 +2744,7 @@ dpaa2_dev_init(struct rte_eth_dev *eth_dev) + priv->extract.tc_extract_param[i] = + (size_t)rte_malloc(NULL, 256, 64); + if (!priv->extract.tc_extract_param[i]) { +- DPAA2_PMD_ERR(" Error(%d) in allocation resources for flow classificaiton", ++ DPAA2_PMD_ERR(" Error(%d) in allocation resources for flow classification", + ret); + goto init_err; + } +diff --git a/drivers/net/dpaa2/dpaa2_ethdev.h b/drivers/net/dpaa2/dpaa2_ethdev.h +index c5e9267bf0..e27239e256 100644 +--- a/drivers/net/dpaa2/dpaa2_ethdev.h ++++ b/drivers/net/dpaa2/dpaa2_ethdev.h +@@ -117,7 +117,7 @@ extern int dpaa2_timestamp_dynfield_offset; + + #define DPAA2_FLOW_MAX_KEY_SIZE 16 + +-/*Externaly defined*/ ++/* Externally defined */ + extern const struct rte_flow_ops dpaa2_flow_ops; + + extern const struct rte_tm_ops dpaa2_tm_ops; +diff --git a/drivers/net/dpaa2/dpaa2_flow.c b/drivers/net/dpaa2/dpaa2_flow.c +index 84fe37a7c0..bf55eb70a3 100644 +--- a/drivers/net/dpaa2/dpaa2_flow.c ++++ b/drivers/net/dpaa2/dpaa2_flow.c +@@ -1451,7 +1451,7 @@ dpaa2_configure_flow_generic_ip( + flow, pattern, &local_cfg, + device_configured, group); + if (ret) { +- DPAA2_PMD_ERR("IP discrimation failed!"); ++ DPAA2_PMD_ERR("IP discrimination failed!"); + return -1; + } + +@@ -3349,7 +3349,7 @@ dpaa2_flow_verify_action( + (actions[j].conf); + if (rss_conf->queue_num > priv->dist_queues) { + DPAA2_PMD_ERR( +- "RSS number exceeds the distrbution size"); ++ "RSS number exceeds the distribution size"); + return -ENOTSUP; + } + for (i = 0; i < (int)rss_conf->queue_num; i++) { +@@ -3596,7 +3596,7 @@ dpaa2_generic_flow_set(struct rte_flow *flow, + qos_cfg.keep_entries = true; + qos_cfg.key_cfg_iova = + (size_t)priv->extract.qos_extract_param; +- /* QoS table is effecitive for multiple TCs.*/ ++ /* QoS table is effective for multiple TCs. */ + if (priv->num_rx_tc > 1) { + ret = dpni_set_qos_table(dpni, CMD_PRI_LOW, + priv->token, &qos_cfg); +@@ -3655,7 +3655,7 @@ dpaa2_generic_flow_set(struct rte_flow *flow, + 0, 0); + if (ret < 0) { + DPAA2_PMD_ERR( +- "Error in addnig entry to QoS table(%d)", ret); ++ "Error in adding entry to QoS table(%d)", ret); + return ret; + } + } +diff --git a/drivers/net/dpaa2/dpaa2_mux.c b/drivers/net/dpaa2/dpaa2_mux.c +index d347f4df51..cd2f7b8aa5 100644 +--- a/drivers/net/dpaa2/dpaa2_mux.c ++++ b/drivers/net/dpaa2/dpaa2_mux.c +@@ -95,7 +95,7 @@ rte_pmd_dpaa2_mux_flow_create(uint32_t dpdmux_id, + mask_iova = (void *)((size_t)key_iova + DIST_PARAM_IOVA_SIZE); + + /* Currently taking only IP protocol as an extract type. +- * This can be exended to other fields using pattern->type. ++ * This can be extended to other fields using pattern->type. + */ + memset(&kg_cfg, 0, sizeof(struct dpkg_profile_cfg)); + +diff --git a/drivers/net/dpaa2/dpaa2_rxtx.c b/drivers/net/dpaa2/dpaa2_rxtx.c +index c65589a5f3..90b971b4bf 100644 +--- a/drivers/net/dpaa2/dpaa2_rxtx.c ++++ b/drivers/net/dpaa2/dpaa2_rxtx.c +@@ -714,7 +714,7 @@ dpaa2_dev_prefetch_rx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) + rte_prefetch0((void *)(size_t)(dq_storage + 1)); + + /* Prepare next pull descriptor. This will give space for the +- * prefething done on DQRR entries ++ * prefetching done on DQRR entries + */ + q_storage->toggle ^= 1; + dq_storage1 = q_storage->dq_storage[q_storage->toggle]; +@@ -1510,7 +1510,7 @@ dpaa2_dev_tx_ordered(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) + if (*dpaa2_seqn(*bufs)) { + /* Use only queue 0 for Tx in case of atomic/ + * ordered packets as packets can get unordered +- * when being tranmitted out from the interface ++ * when being transmitted out from the interface + */ + dpaa2_set_enqueue_descriptor(order_sendq, + (*bufs), +@@ -1738,7 +1738,7 @@ dpaa2_dev_loopback_rx(void *queue, + rte_prefetch0((void *)(size_t)(dq_storage + 1)); + + /* Prepare next pull descriptor. This will give space for the +- * prefething done on DQRR entries ++ * prefetching done on DQRR entries + */ + q_storage->toggle ^= 1; + dq_storage1 = q_storage->dq_storage[q_storage->toggle]; +diff --git a/drivers/net/dpaa2/mc/fsl_dpni.h b/drivers/net/dpaa2/mc/fsl_dpni.h +index 469ab9b3d4..3b9bffeed7 100644 +--- a/drivers/net/dpaa2/mc/fsl_dpni.h ++++ b/drivers/net/dpaa2/mc/fsl_dpni.h +@@ -93,7 +93,7 @@ struct fsl_mc_io; + */ + #define DPNI_OPT_OPR_PER_TC 0x000080 + /** +- * All Tx traffic classes will use a single sender (ignore num_queueus for tx) ++ * All Tx traffic classes will use a single sender (ignore num_queues for tx) + */ + #define DPNI_OPT_SINGLE_SENDER 0x000100 + /** +@@ -617,7 +617,7 @@ int dpni_get_tx_data_offset(struct fsl_mc_io *mc_io, + * @page_3.ceetm_reject_bytes: Cumulative count of the number of bytes in all + * frames whose enqueue was rejected + * @page_3.ceetm_reject_frames: Cumulative count of all frame enqueues rejected +- * @page_4: congestion point drops for seleted TC ++ * @page_4: congestion point drops for selected TC + * @page_4.cgr_reject_frames: number of rejected frames due to congestion point + * @page_4.cgr_reject_bytes: number of rejected bytes due to congestion point + * @page_5: policer statistics per TC +@@ -1417,7 +1417,7 @@ int dpni_get_tx_confirmation_mode(struct fsl_mc_io *mc_io, + * dpkg_prepare_key_cfg() + * @discard_on_miss: Set to '1' to discard frames in case of no match (miss); + * '0' to use the 'default_tc' in such cases +- * @keep_entries: if set to one will not delele existing table entries. This ++ * @keep_entries: if set to one will not delete existing table entries. This + * option will work properly only for dpni objects created with + * DPNI_OPT_HAS_KEY_MASKING option. All previous QoS entries must + * be compatible with new key composition rule. +@@ -1516,7 +1516,7 @@ int dpni_clear_qos_table(struct fsl_mc_io *mc_io, + * @flow_id: Identifies the Rx queue used for matching traffic. Supported + * values are in range 0 to num_queue-1. + * @redirect_obj_token: token that identifies the object where frame is +- * redirected when this rule is hit. This paraneter is used only when one of the ++ * redirected when this rule is hit. This parameter is used only when one of the + * flags DPNI_FS_OPT_REDIRECT_TO_DPNI_RX or DPNI_FS_OPT_REDIRECT_TO_DPNI_TX is + * set. + * The token is obtained using dpni_open() API call. The object must stay +@@ -1797,7 +1797,7 @@ int dpni_load_sw_sequence(struct fsl_mc_io *mc_io, + struct dpni_load_ss_cfg *cfg); + + /** +- * dpni_eanble_sw_sequence() - Enables a software sequence in the parser ++ * dpni_enable_sw_sequence() - Enables a software sequence in the parser + * profile + * corresponding to the ingress or egress of the DPNI. + * @mc_io: Pointer to MC portal's I/O object +diff --git a/drivers/net/e1000/e1000_ethdev.h b/drivers/net/e1000/e1000_ethdev.h +index a548ae2ccb..718a9746ed 100644 +--- a/drivers/net/e1000/e1000_ethdev.h ++++ b/drivers/net/e1000/e1000_ethdev.h +@@ -103,7 +103,7 @@ + * Maximum number of Ring Descriptors. + * + * Since RDLEN/TDLEN should be multiple of 128 bytes, the number of ring +- * desscriptors should meet the following condition: ++ * descriptors should meet the following condition: + * (num_ring_desc * sizeof(struct e1000_rx/tx_desc)) % 128 == 0 + */ + #define E1000_MIN_RING_DESC 32 +@@ -252,7 +252,7 @@ struct igb_rte_flow_rss_conf { + }; + + /* +- * Structure to store filters'info. ++ * Structure to store filters' info. + */ + struct e1000_filter_info { + uint8_t ethertype_mask; /* Bit mask for every used ethertype filter */ +diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c +index 31c4870086..794496abfc 100644 +--- a/drivers/net/e1000/em_ethdev.c ++++ b/drivers/net/e1000/em_ethdev.c +@@ -1058,8 +1058,8 @@ eth_em_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) + + /* + * Starting with 631xESB hw supports 2 TX/RX queues per port. +- * Unfortunatelly, all these nics have just one TX context. +- * So we have few choises for TX: ++ * Unfortunately, all these nics have just one TX context. ++ * So we have few choices for TX: + * - Use just one TX queue. + * - Allow cksum offload only for one TX queue. + * - Don't allow TX cksum offload at all. +@@ -1068,7 +1068,7 @@ eth_em_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) + * (Multiple Receive Queues are mutually exclusive with UDP + * fragmentation and are not supported when a legacy receive + * descriptor format is used). +- * Which means separate RX routinies - as legacy nics (82540, 82545) ++ * Which means separate RX routines - as legacy nics (82540, 82545) + * don't support extended RXD. + * To avoid it we support just one RX queue for now (no RSS). + */ +@@ -1558,7 +1558,7 @@ eth_em_interrupt_get_status(struct rte_eth_dev *dev) + } + + /* +- * It executes link_update after knowing an interrupt is prsent. ++ * It executes link_update after knowing an interrupt is present. + * + * @param dev + * Pointer to struct rte_eth_dev. +@@ -1616,7 +1616,7 @@ eth_em_interrupt_action(struct rte_eth_dev *dev, + * @param handle + * Pointer to interrupt handle. + * @param param +- * The address of parameter (struct rte_eth_dev *) regsitered before. ++ * The address of parameter (struct rte_eth_dev *) registered before. + * + * @return + * void +diff --git a/drivers/net/e1000/em_rxtx.c b/drivers/net/e1000/em_rxtx.c +index 39262502bb..cea5b490ba 100644 +--- a/drivers/net/e1000/em_rxtx.c ++++ b/drivers/net/e1000/em_rxtx.c +@@ -141,7 +141,7 @@ union em_vlan_macip { + struct em_ctx_info { + uint64_t flags; /**< ol_flags related to context build. */ + uint32_t cmp_mask; /**< compare mask */ +- union em_vlan_macip hdrlen; /**< L2 and L3 header lenghts */ ++ union em_vlan_macip hdrlen; /**< L2 and L3 header lengths */ + }; + + /** +@@ -829,7 +829,7 @@ eth_em_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, + * register. + * Update the RDT with the value of the last processed RX descriptor + * minus 1, to guarantee that the RDT register is never equal to the +- * RDH register, which creates a "full" ring situtation from the ++ * RDH register, which creates a "full" ring situation from the + * hardware point of view... + */ + nb_hold = (uint16_t) (nb_hold + rxq->nb_rx_hold); +@@ -1074,7 +1074,7 @@ eth_em_recv_scattered_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, + * register. + * Update the RDT with the value of the last processed RX descriptor + * minus 1, to guarantee that the RDT register is never equal to the +- * RDH register, which creates a "full" ring situtation from the ++ * RDH register, which creates a "full" ring situation from the + * hardware point of view... + */ + nb_hold = (uint16_t) (nb_hold + rxq->nb_rx_hold); +diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c +index 3ee16c15fe..a9c18b27e8 100644 +--- a/drivers/net/e1000/igb_ethdev.c ++++ b/drivers/net/e1000/igb_ethdev.c +@@ -1149,7 +1149,7 @@ eth_igb_configure(struct rte_eth_dev *dev) + if (dev->data->dev_conf.rxmode.mq_mode & RTE_ETH_MQ_RX_RSS_FLAG) + dev->data->dev_conf.rxmode.offloads |= RTE_ETH_RX_OFFLOAD_RSS_HASH; + +- /* multipe queue mode checking */ ++ /* multiple queue mode checking */ + ret = igb_check_mq_mode(dev); + if (ret != 0) { + PMD_DRV_LOG(ERR, "igb_check_mq_mode fails with %d.", +@@ -1265,7 +1265,7 @@ eth_igb_start(struct rte_eth_dev *dev) + } + } + +- /* confiugre msix for rx interrupt */ ++ /* configure MSI-X for Rx interrupt */ + eth_igb_configure_msix_intr(dev); + + /* Configure for OS presence */ +@@ -2819,7 +2819,7 @@ eth_igb_interrupt_get_status(struct rte_eth_dev *dev) + } + + /* +- * It executes link_update after knowing an interrupt is prsent. ++ * It executes link_update after knowing an interrupt is present. + * + * @param dev + * Pointer to struct rte_eth_dev. +@@ -2889,7 +2889,7 @@ eth_igb_interrupt_action(struct rte_eth_dev *dev, + * @param handle + * Pointer to interrupt handle. + * @param param +- * The address of parameter (struct rte_eth_dev *) regsitered before. ++ * The address of parameter (struct rte_eth_dev *) registered before. + * + * @return + * void +@@ -3787,7 +3787,7 @@ igb_inject_2uple_filter(struct rte_eth_dev *dev, + * + * @param + * dev: Pointer to struct rte_eth_dev. +- * ntuple_filter: ponter to the filter that will be added. ++ * ntuple_filter: pointer to the filter that will be added. + * + * @return + * - On success, zero. +@@ -3868,7 +3868,7 @@ igb_delete_2tuple_filter(struct rte_eth_dev *dev, + * + * @param + * dev: Pointer to struct rte_eth_dev. +- * ntuple_filter: ponter to the filter that will be removed. ++ * ntuple_filter: pointer to the filter that will be removed. + * + * @return + * - On success, zero. +@@ -4226,7 +4226,7 @@ igb_inject_5tuple_filter_82576(struct rte_eth_dev *dev, + * + * @param + * dev: Pointer to struct rte_eth_dev. +- * ntuple_filter: ponter to the filter that will be added. ++ * ntuple_filter: pointer to the filter that will be added. + * + * @return + * - On success, zero. +@@ -4313,7 +4313,7 @@ igb_delete_5tuple_filter_82576(struct rte_eth_dev *dev, + * + * @param + * dev: Pointer to struct rte_eth_dev. +- * ntuple_filter: ponter to the filter that will be removed. ++ * ntuple_filter: pointer to the filter that will be removed. + * + * @return + * - On success, zero. +@@ -4831,7 +4831,7 @@ igb_timesync_disable(struct rte_eth_dev *dev) + /* Disable L2 filtering of IEEE1588/802.1AS Ethernet frame types. */ + E1000_WRITE_REG(hw, E1000_ETQF(E1000_ETQF_FILTER_1588), 0); + +- /* Stop incrementating the System Time registers. */ ++ /* Stop incrementing the System Time registers. */ + E1000_WRITE_REG(hw, E1000_TIMINCA, 0); + + return 0; +diff --git a/drivers/net/e1000/igb_flow.c b/drivers/net/e1000/igb_flow.c +index e72376f69c..e46697b6a1 100644 +--- a/drivers/net/e1000/igb_flow.c ++++ b/drivers/net/e1000/igb_flow.c +@@ -57,7 +57,7 @@ struct igb_flex_filter_list igb_filter_flex_list; + struct igb_rss_filter_list igb_filter_rss_list; + + /** +- * Please aware there's an asumption for all the parsers. ++ * Please be aware there's an assumption for all the parsers. + * rte_flow_item is using big endian, rte_flow_attr and + * rte_flow_action are using CPU order. + * Because the pattern is used to describe the packets, +@@ -1608,7 +1608,7 @@ igb_flow_create(struct rte_eth_dev *dev, + + /** + * Check if the flow rule is supported by igb. +- * It only checkes the format. Don't guarantee the rule can be programmed into ++ * It only checks the format. Don't guarantee the rule can be programmed into + * the HW. Because there can be no enough room for the rule. + */ + static int +diff --git a/drivers/net/e1000/igb_pf.c b/drivers/net/e1000/igb_pf.c +index fe355ef6b3..3f3fd0d61e 100644 +--- a/drivers/net/e1000/igb_pf.c ++++ b/drivers/net/e1000/igb_pf.c +@@ -155,7 +155,7 @@ int igb_pf_host_configure(struct rte_eth_dev *eth_dev) + else + E1000_WRITE_REG(hw, E1000_DTXSWC, E1000_DTXSWC_VMDQ_LOOPBACK_EN); + +- /* clear VMDq map to perment rar 0 */ ++ /* clear VMDq map to permanent rar 0 */ + rah = E1000_READ_REG(hw, E1000_RAH(0)); + rah &= ~ (0xFF << E1000_RAH_POOLSEL_SHIFT); + E1000_WRITE_REG(hw, E1000_RAH(0), rah); +diff --git a/drivers/net/e1000/igb_rxtx.c b/drivers/net/e1000/igb_rxtx.c +index 4a311a7b18..f32dee46df 100644 +--- a/drivers/net/e1000/igb_rxtx.c ++++ b/drivers/net/e1000/igb_rxtx.c +@@ -150,7 +150,7 @@ union igb_tx_offload { + (TX_MACIP_LEN_CMP_MASK | TX_TCP_LEN_CMP_MASK | TX_TSO_MSS_CMP_MASK) + + /** +- * Strucutre to check if new context need be built ++ * Structure to check if new context need be built + */ + struct igb_advctx_info { + uint64_t flags; /**< ol_flags related to context build. */ +@@ -967,7 +967,7 @@ eth_igb_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, + * register. + * Update the RDT with the value of the last processed RX descriptor + * minus 1, to guarantee that the RDT register is never equal to the +- * RDH register, which creates a "full" ring situtation from the ++ * RDH register, which creates a "full" ring situation from the + * hardware point of view... + */ + nb_hold = (uint16_t) (nb_hold + rxq->nb_rx_hold); +@@ -1229,7 +1229,7 @@ eth_igb_recv_scattered_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, + * register. + * Update the RDT with the value of the last processed RX descriptor + * minus 1, to guarantee that the RDT register is never equal to the +- * RDH register, which creates a "full" ring situtation from the ++ * RDH register, which creates a "full" ring situation from the + * hardware point of view... + */ + nb_hold = (uint16_t) (nb_hold + rxq->nb_rx_hold); +@@ -1252,7 +1252,7 @@ eth_igb_recv_scattered_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, + * Maximum number of Ring Descriptors. + * + * Since RDLEN/TDLEN should be multiple of 128bytes, the number of ring +- * desscriptors should meet the following condition: ++ * descriptors should meet the following condition: + * (num_ring_desc * sizeof(struct e1000_rx/tx_desc)) % 128 == 0 + */ + +@@ -1350,7 +1350,7 @@ igb_tx_done_cleanup(struct igb_tx_queue *txq, uint32_t free_cnt) + sw_ring[tx_id].last_id = tx_id; + } + +- /* Move to next segemnt. */ ++ /* Move to next segment. */ + tx_id = sw_ring[tx_id].next_id; + + } while (tx_id != tx_next); +@@ -1383,7 +1383,7 @@ igb_tx_done_cleanup(struct igb_tx_queue *txq, uint32_t free_cnt) + + /* Walk the list and find the next mbuf, if any. */ + do { +- /* Move to next segemnt. */ ++ /* Move to next segment. */ + tx_id = sw_ring[tx_id].next_id; + + if (sw_ring[tx_id].mbuf) +@@ -2146,7 +2146,7 @@ igb_vmdq_rx_hw_configure(struct rte_eth_dev *dev) + + igb_rss_disable(dev); + +- /* RCTL: eanble VLAN filter */ ++ /* RCTL: enable VLAN filter */ + rctl = E1000_READ_REG(hw, E1000_RCTL); + rctl |= E1000_RCTL_VFE; + E1000_WRITE_REG(hw, E1000_RCTL, rctl); +diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c +index 634c97acf6..dce26cfa48 100644 +--- a/drivers/net/ena/ena_ethdev.c ++++ b/drivers/net/ena/ena_ethdev.c +@@ -1408,7 +1408,7 @@ static int ena_populate_rx_queue(struct ena_ring *rxq, unsigned int count) + ++rxq->rx_stats.refill_partial; + } + +- /* When we submitted free recources to device... */ ++ /* When we submitted free resources to device... */ + if (likely(i > 0)) { + /* ...let HW know that it can fill buffers with data. */ + ena_com_write_sq_doorbell(rxq->ena_com_io_sq); +diff --git a/drivers/net/ena/ena_ethdev.h b/drivers/net/ena/ena_ethdev.h +index 865e1241e0..f99e4f3984 100644 +--- a/drivers/net/ena/ena_ethdev.h ++++ b/drivers/net/ena/ena_ethdev.h +@@ -42,7 +42,7 @@ + + /* While processing submitted and completed descriptors (rx and tx path + * respectively) in a loop it is desired to: +- * - perform batch submissions while populating sumbissmion queue ++ * - perform batch submissions while populating submission queue + * - avoid blocking transmission of other packets during cleanup phase + * Hence the utilization ratio of 1/8 of a queue size or max value if the size + * of the ring is very big - like 8k Rx rings. +diff --git a/drivers/net/enetfec/enet_regs.h b/drivers/net/enetfec/enet_regs.h +index a300c6f8bc..c9400957f8 100644 +--- a/drivers/net/enetfec/enet_regs.h ++++ b/drivers/net/enetfec/enet_regs.h +@@ -12,7 +12,7 @@ + #define RX_BD_CR ((ushort)0x0004) /* CRC or Frame error */ + #define RX_BD_SH ((ushort)0x0008) /* Reserved */ + #define RX_BD_NO ((ushort)0x0010) /* Rcvd non-octet aligned frame */ +-#define RX_BD_LG ((ushort)0x0020) /* Rcvd frame length voilation */ ++#define RX_BD_LG ((ushort)0x0020) /* Rcvd frame length violation */ + #define RX_BD_FIRST ((ushort)0x0400) /* Reserved */ + #define RX_BD_LAST ((ushort)0x0800) /* last buffer in the frame */ + #define RX_BD_INT 0x00800000 +diff --git a/drivers/net/enic/enic_flow.c b/drivers/net/enic/enic_flow.c +index 33147169ba..cf51793cfe 100644 +--- a/drivers/net/enic/enic_flow.c ++++ b/drivers/net/enic/enic_flow.c +@@ -405,7 +405,7 @@ enic_copy_item_ipv4_v1(struct copy_item_args *arg) + return ENOTSUP; + } + +- /* check that the suppied mask exactly matches capabilty */ ++ /* check that the supplied mask exactly matches capability */ + if (!mask_exact_match((const uint8_t *)&supported_mask, + (const uint8_t *)item->mask, sizeof(*mask))) { + ENICPMD_LOG(ERR, "IPv4 exact match mask"); +@@ -443,7 +443,7 @@ enic_copy_item_udp_v1(struct copy_item_args *arg) + return ENOTSUP; + } + +- /* check that the suppied mask exactly matches capabilty */ ++ /* check that the supplied mask exactly matches capability */ + if (!mask_exact_match((const uint8_t *)&supported_mask, + (const uint8_t *)item->mask, sizeof(*mask))) { + ENICPMD_LOG(ERR, "UDP exact match mask"); +@@ -482,7 +482,7 @@ enic_copy_item_tcp_v1(struct copy_item_args *arg) + return ENOTSUP; + } + +- /* check that the suppied mask exactly matches capabilty */ ++ /* check that the supplied mask exactly matches capability */ + if (!mask_exact_match((const uint8_t *)&supported_mask, + (const uint8_t *)item->mask, sizeof(*mask))) { + ENICPMD_LOG(ERR, "TCP exact match mask"); +@@ -1044,14 +1044,14 @@ fixup_l5_layer(struct enic *enic, struct filter_generic_1 *gp, + } + + /** +- * Build the intenal enic filter structure from the provided pattern. The ++ * Build the internal enic filter structure from the provided pattern. The + * pattern is validated as the items are copied. + * + * @param pattern[in] + * @param items_info[in] + * Info about this NICs item support, like valid previous items. + * @param enic_filter[out] +- * NIC specfilc filters derived from the pattern. ++ * NIC specific filters derived from the pattern. + * @param error[out] + */ + static int +@@ -1123,12 +1123,12 @@ enic_copy_filter(const struct rte_flow_item pattern[], + } + + /** +- * Build the intenal version 1 NIC action structure from the provided pattern. ++ * Build the internal version 1 NIC action structure from the provided pattern. + * The pattern is validated as the items are copied. + * + * @param actions[in] + * @param enic_action[out] +- * NIC specfilc actions derived from the actions. ++ * NIC specific actions derived from the actions. + * @param error[out] + */ + static int +@@ -1170,12 +1170,12 @@ enic_copy_action_v1(__rte_unused struct enic *enic, + } + + /** +- * Build the intenal version 2 NIC action structure from the provided pattern. ++ * Build the internal version 2 NIC action structure from the provided pattern. + * The pattern is validated as the items are copied. + * + * @param actions[in] + * @param enic_action[out] +- * NIC specfilc actions derived from the actions. ++ * NIC specific actions derived from the actions. + * @param error[out] + */ + static int +diff --git a/drivers/net/enic/enic_fm_flow.c b/drivers/net/enic/enic_fm_flow.c +index ae43f36bc0..bef842d460 100644 +--- a/drivers/net/enic/enic_fm_flow.c ++++ b/drivers/net/enic/enic_fm_flow.c +@@ -721,7 +721,7 @@ enic_fm_copy_item_gtp(struct copy_item_args *arg) + } + + /* NIC does not support GTP tunnels. No Items are allowed after this. +- * This prevents the specificaiton of further items. ++ * This prevents the specification of further items. + */ + arg->header_level = 0; + +@@ -733,7 +733,7 @@ enic_fm_copy_item_gtp(struct copy_item_args *arg) + + /* + * Use the raw L4 buffer to match GTP as fm_header_set does not have +- * GTP header. UDP dst port must be specifiec. Using the raw buffer ++ * GTP header. UDP dst port must be specific. Using the raw buffer + * does not affect such UDP item, since we skip UDP in the raw buffer. + */ + fm_data->fk_header_select |= FKH_L4RAW; +@@ -1846,7 +1846,7 @@ enic_fm_dump_tcam_actions(const struct fm_action *fm_action) + /* Remove trailing comma */ + if (buf[0]) + *(bp - 1) = '\0'; +- ENICPMD_LOG(DEBUG, " Acions: %s", buf); ++ ENICPMD_LOG(DEBUG, " Actions: %s", buf); + } + + static int +@@ -2364,7 +2364,7 @@ enic_action_handle_get(struct enic_flowman *fm, struct fm_action *action_in, + if (ret < 0 && ret != -ENOENT) + return rte_flow_error_set(error, -ret, + RTE_FLOW_ERROR_TYPE_UNSPECIFIED, +- NULL, "enic: rte_hash_lookup(aciton)"); ++ NULL, "enic: rte_hash_lookup(action)"); + + if (ret == -ENOENT) { + /* Allocate a new action on the NIC. */ +@@ -2435,7 +2435,7 @@ __enic_fm_flow_add_entry(struct enic_flowman *fm, + + ENICPMD_FUNC_TRACE(); + +- /* Get or create an aciton handle. */ ++ /* Get or create an action handle. */ + ret = enic_action_handle_get(fm, action_in, error, &ah); + if (ret) + return ret; +diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c +index 7f84b5f935..97d97ea793 100644 +--- a/drivers/net/enic/enic_main.c ++++ b/drivers/net/enic/enic_main.c +@@ -1137,7 +1137,7 @@ int enic_disable(struct enic *enic) + } + + /* If we were using interrupts, set the interrupt vector to -1 +- * to disable interrupts. We are not disabling link notifcations, ++ * to disable interrupts. We are not disabling link notifications, + * though, as we want the polling of link status to continue working. + */ + if (enic->rte_dev->data->dev_conf.intr_conf.lsc) +diff --git a/drivers/net/enic/enic_rxtx.c b/drivers/net/enic/enic_rxtx.c +index c44715bfd0..33e96b480e 100644 +--- a/drivers/net/enic/enic_rxtx.c ++++ b/drivers/net/enic/enic_rxtx.c +@@ -653,7 +653,7 @@ static void enqueue_simple_pkts(struct rte_mbuf **pkts, + * The app should not send oversized + * packets. tx_pkt_prepare includes a check as + * well. But some apps ignore the device max size and +- * tx_pkt_prepare. Oversized packets cause WQ errrors ++ * tx_pkt_prepare. Oversized packets cause WQ errors + * and the NIC ends up disabling the whole WQ. So + * truncate packets.. + */ +diff --git a/drivers/net/fm10k/fm10k.h b/drivers/net/fm10k/fm10k.h +index 7cfa29faa8..17a7056c45 100644 +--- a/drivers/net/fm10k/fm10k.h ++++ b/drivers/net/fm10k/fm10k.h +@@ -44,7 +44,7 @@ + #define FM10K_TX_MAX_MTU_SEG UINT8_MAX + + /* +- * byte aligment for HW RX data buffer ++ * byte alignment for HW RX data buffer + * Datasheet requires RX buffer addresses shall either be 512-byte aligned or + * be 8-byte aligned but without crossing host memory pages (4KB alignment + * boundaries). Satisfy first option. +diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c +index 43e1d13431..8bbd8b445d 100644 +--- a/drivers/net/fm10k/fm10k_ethdev.c ++++ b/drivers/net/fm10k/fm10k_ethdev.c +@@ -290,7 +290,7 @@ rx_queue_free(struct fm10k_rx_queue *q) + } + + /* +- * disable RX queue, wait unitl HW finished necessary flush operation ++ * disable RX queue, wait until HW finished necessary flush operation + */ + static inline int + rx_queue_disable(struct fm10k_hw *hw, uint16_t qnum) +@@ -379,7 +379,7 @@ tx_queue_free(struct fm10k_tx_queue *q) + } + + /* +- * disable TX queue, wait unitl HW finished necessary flush operation ++ * disable TX queue, wait until HW finished necessary flush operation + */ + static inline int + tx_queue_disable(struct fm10k_hw *hw, uint16_t qnum) +@@ -453,7 +453,7 @@ fm10k_dev_configure(struct rte_eth_dev *dev) + if (dev->data->dev_conf.rxmode.mq_mode & RTE_ETH_MQ_RX_RSS_FLAG) + dev->data->dev_conf.rxmode.offloads |= RTE_ETH_RX_OFFLOAD_RSS_HASH; + +- /* multipe queue mode checking */ ++ /* multiple queue mode checking */ + ret = fm10k_check_mq_mode(dev); + if (ret != 0) { + PMD_DRV_LOG(ERR, "fm10k_check_mq_mode fails with %d.", +@@ -2553,7 +2553,7 @@ fm10k_dev_handle_fault(struct fm10k_hw *hw, uint32_t eicr) + * @param handle + * Pointer to interrupt handle. + * @param param +- * The address of parameter (struct rte_eth_dev *) regsitered before. ++ * The address of parameter (struct rte_eth_dev *) registered before. + * + * @return + * void +@@ -2676,7 +2676,7 @@ fm10k_dev_interrupt_handler_pf(void *param) + * @param handle + * Pointer to interrupt handle. + * @param param +- * The address of parameter (struct rte_eth_dev *) regsitered before. ++ * The address of parameter (struct rte_eth_dev *) registered before. + * + * @return + * void +@@ -3034,7 +3034,7 @@ fm10k_params_init(struct rte_eth_dev *dev) + struct fm10k_dev_info *info = + FM10K_DEV_PRIVATE_TO_INFO(dev->data->dev_private); + +- /* Inialize bus info. Normally we would call fm10k_get_bus_info(), but ++ /* Initialize bus info. Normally we would call fm10k_get_bus_info(), but + * there is no way to get link status without reading BAR4. Until this + * works, assume we have maximum bandwidth. + * @todo - fix bus info +diff --git a/drivers/net/fm10k/fm10k_rxtx_vec.c b/drivers/net/fm10k/fm10k_rxtx_vec.c +index 1269250e23..10ce5a7582 100644 +--- a/drivers/net/fm10k/fm10k_rxtx_vec.c ++++ b/drivers/net/fm10k/fm10k_rxtx_vec.c +@@ -212,7 +212,7 @@ fm10k_rx_vec_condition_check(struct rte_eth_dev *dev) + struct rte_eth_fdir_conf *fconf = &dev->data->dev_conf.fdir_conf; + + #ifndef RTE_FM10K_RX_OLFLAGS_ENABLE +- /* whithout rx ol_flags, no VP flag report */ ++ /* without rx ol_flags, no VP flag report */ + if (rxmode->offloads & RTE_ETH_RX_OFFLOAD_VLAN_EXTEND) + return -1; + #endif +@@ -239,7 +239,7 @@ fm10k_rxq_vec_setup(struct fm10k_rx_queue *rxq) + struct rte_mbuf mb_def = { .buf_addr = 0 }; /* zeroed mbuf */ + + mb_def.nb_segs = 1; +- /* data_off will be ajusted after new mbuf allocated for 512-byte ++ /* data_off will be adjusted after new mbuf allocated for 512-byte + * alignment. + */ + mb_def.data_off = RTE_PKTMBUF_HEADROOM; +@@ -410,7 +410,7 @@ fm10k_recv_raw_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts, + if (!(rxdp->d.staterr & FM10K_RXD_STATUS_DD)) + return 0; + +- /* Vecotr RX will process 4 packets at a time, strip the unaligned ++ /* Vector RX will process 4 packets at a time, strip the unaligned + * tails in case it's not multiple of 4. + */ + nb_pkts = RTE_ALIGN_FLOOR(nb_pkts, RTE_FM10K_DESCS_PER_LOOP); +@@ -481,7 +481,7 @@ fm10k_recv_raw_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts, + _mm_storeu_si128((__m128i *)&rx_pkts[pos], mbp1); + + #if defined(RTE_ARCH_X86_64) +- /* B.1 load 2 64 bit mbuf poitns */ ++ /* B.1 load 2 64 bit mbuf points */ + mbp2 = _mm_loadu_si128((__m128i *)&mbufp[pos+2]); + #endif + +@@ -573,7 +573,7 @@ fm10k_recv_raw_pkts_vec(void *rx_queue, struct rte_mbuf **rx_pkts, + + fm10k_desc_to_pktype_v(descs0, &rx_pkts[pos]); + +- /* C.4 calc avaialbe number of desc */ ++ /* C.4 calc available number of desc */ + var = __builtin_popcountll(_mm_cvtsi128_si64(staterr)); + nb_pkts_recd += var; + if (likely(var != RTE_FM10K_DESCS_PER_LOOP)) +diff --git a/drivers/net/hinic/hinic_pmd_ethdev.c b/drivers/net/hinic/hinic_pmd_ethdev.c +index 1853511c3b..e8d9aaba84 100644 +--- a/drivers/net/hinic/hinic_pmd_ethdev.c ++++ b/drivers/net/hinic/hinic_pmd_ethdev.c +@@ -255,7 +255,7 @@ static int hinic_vlan_offload_set(struct rte_eth_dev *dev, int mask); + * Interrupt handler triggered by NIC for handling + * specific event. + * +- * @param: The address of parameter (struct rte_eth_dev *) regsitered before. ++ * @param: The address of parameter (struct rte_eth_dev *) registered before. + */ + static void hinic_dev_interrupt_handler(void *param) + { +@@ -336,7 +336,7 @@ static int hinic_dev_configure(struct rte_eth_dev *dev) + return err; + } + +- /* init vlan offoad */ ++ /* init VLAN offload */ + err = hinic_vlan_offload_set(dev, + RTE_ETH_VLAN_STRIP_MASK | RTE_ETH_VLAN_FILTER_MASK); + if (err) { +diff --git a/drivers/net/hinic/hinic_pmd_ethdev.h b/drivers/net/hinic/hinic_pmd_ethdev.h +index 5eca8b10b9..8e6251f69f 100644 +--- a/drivers/net/hinic/hinic_pmd_ethdev.h ++++ b/drivers/net/hinic/hinic_pmd_ethdev.h +@@ -170,7 +170,7 @@ struct tag_tcam_key_mem { + /* + * tunnel packet, mask must be 0xff, spec value is 1; + * normal packet, mask must be 0, spec value is 0; +- * if tunnal packet, ucode use ++ * if tunnel packet, ucode use + * sip/dip/protocol/src_port/dst_dport from inner packet + */ + u32 tunnel_flag:8; +diff --git a/drivers/net/hinic/hinic_pmd_flow.c b/drivers/net/hinic/hinic_pmd_flow.c +index d71a42afbd..2cf24ebcf6 100644 +--- a/drivers/net/hinic/hinic_pmd_flow.c ++++ b/drivers/net/hinic/hinic_pmd_flow.c +@@ -734,7 +734,7 @@ static int hinic_check_ntuple_item_ele(const struct rte_flow_item *item, + * END + * other members in mask and spec should set to 0x00. + * item->last should be NULL. +- * Please aware there's an asumption for all the parsers. ++ * Please be aware there's an assumption for all the parsers. + * rte_flow_item is using big endian, rte_flow_attr and + * rte_flow_action are using CPU order. + * Because the pattern is used to describe the packets, +@@ -1630,7 +1630,7 @@ static int hinic_parse_fdir_filter(struct rte_eth_dev *dev, + + /** + * Check if the flow rule is supported by nic. +- * It only checkes the format. Don't guarantee the rule can be programmed into ++ * It only checks the format. Don't guarantee the rule can be programmed into + * the HW. Because there can be no enough room for the rule. + */ + static int hinic_flow_validate(struct rte_eth_dev *dev, +diff --git a/drivers/net/hinic/hinic_pmd_tx.c b/drivers/net/hinic/hinic_pmd_tx.c +index 2688817f37..f09b1a6e1e 100644 +--- a/drivers/net/hinic/hinic_pmd_tx.c ++++ b/drivers/net/hinic/hinic_pmd_tx.c +@@ -1144,7 +1144,7 @@ u16 hinic_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, u16 nb_pkts) + mbuf_pkt = *tx_pkts++; + queue_info = 0; + +- /* 1. parse sge and tx offlod info from mbuf */ ++ /* 1. parse sge and tx offload info from mbuf */ + if (unlikely(!hinic_get_sge_txoff_info(mbuf_pkt, + &sqe_info, &off_info))) { + txq->txq_stats.off_errs++; +diff --git a/drivers/net/hns3/hns3_cmd.c b/drivers/net/hns3/hns3_cmd.c +index 50cb3eabb1..bdfc85f934 100644 +--- a/drivers/net/hns3/hns3_cmd.c ++++ b/drivers/net/hns3/hns3_cmd.c +@@ -462,7 +462,7 @@ hns3_mask_capability(struct hns3_hw *hw, + for (i = 0; i < MAX_CAPS_BIT; i++) { + if (!(caps_masked & BIT_ULL(i))) + continue; +- hns3_info(hw, "mask capabiliy: id-%u, name-%s.", ++ hns3_info(hw, "mask capability: id-%u, name-%s.", + i, hns3_get_caps_name(i)); + } + } +@@ -699,7 +699,7 @@ hns3_cmd_init(struct hns3_hw *hw) + return 0; + + /* +- * Requiring firmware to enable some features, firber port can still ++ * Requiring firmware to enable some features, fiber port can still + * work without it, but copper port can't work because the firmware + * fails to take over the PHY. + */ +diff --git a/drivers/net/hns3/hns3_common.c b/drivers/net/hns3/hns3_common.c +index 716cebbcec..2ebcf5695b 100644 +--- a/drivers/net/hns3/hns3_common.c ++++ b/drivers/net/hns3/hns3_common.c +@@ -663,7 +663,7 @@ hns3_init_ring_with_vector(struct hns3_hw *hw) + hw->intr_tqps_num = RTE_MIN(vec, hw->tqps_num); + for (i = 0; i < hw->intr_tqps_num; i++) { + /* +- * Set gap limiter/rate limiter/quanity limiter algorithm ++ * Set gap limiter/rate limiter/quantity limiter algorithm + * configuration for interrupt coalesce of queue's interrupt. + */ + hns3_set_queue_intr_gl(hw, i, HNS3_RING_GL_RX, +diff --git a/drivers/net/hns3/hns3_dcb.c b/drivers/net/hns3/hns3_dcb.c +index b22f618e0a..af045b22f7 100644 +--- a/drivers/net/hns3/hns3_dcb.c ++++ b/drivers/net/hns3/hns3_dcb.c +@@ -25,7 +25,7 @@ + * IR(Mbps) = ------------------------- * CLOCK(1000Mbps) + * Tick * (2 ^ IR_s) + * +- * @return: 0: calculate sucessful, negative: fail ++ * @return: 0: calculate successful, negative: fail + */ + static int + hns3_shaper_para_calc(struct hns3_hw *hw, uint32_t ir, uint8_t shaper_level, +@@ -36,8 +36,8 @@ hns3_shaper_para_calc(struct hns3_hw *hw, uint32_t ir, uint8_t shaper_level, + #define DIVISOR_IR_B_126 (126 * DIVISOR_CLK) + + const uint16_t tick_array[HNS3_SHAPER_LVL_CNT] = { +- 6 * 256, /* Prioriy level */ +- 6 * 32, /* Prioriy group level */ ++ 6 * 256, /* Priority level */ ++ 6 * 32, /* Priority group level */ + 6 * 8, /* Port level */ + 6 * 256 /* Qset level */ + }; +@@ -1521,7 +1521,7 @@ hns3_dcb_hw_configure(struct hns3_adapter *hns) + + ret = hns3_dcb_schd_setup_hw(hw); + if (ret) { +- hns3_err(hw, "dcb schdule configure failed! ret = %d", ret); ++ hns3_err(hw, "dcb schedule configure failed! ret = %d", ret); + return ret; + } + +@@ -1726,7 +1726,7 @@ hns3_get_fc_mode(struct hns3_hw *hw, enum rte_eth_fc_mode mode) + * hns3_dcb_pfc_enable - Enable priority flow control + * @dev: pointer to ethernet device + * +- * Configures the pfc settings for one porority. ++ * Configures the pfc settings for one priority. + */ + int + hns3_dcb_pfc_enable(struct rte_eth_dev *dev, struct rte_eth_pfc_conf *pfc_conf) +diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c +index f83cff4d98..25f9c9fab1 100644 +--- a/drivers/net/hns3/hns3_ethdev.c ++++ b/drivers/net/hns3/hns3_ethdev.c +@@ -568,7 +568,7 @@ hns3_set_vlan_rx_offload_cfg(struct hns3_adapter *hns, + hns3_set_bit(req->vport_vlan_cfg, HNS3_SHOW_TAG2_EN_B, + vcfg->vlan2_vlan_prionly ? 1 : 0); + +- /* firmwall will ignore this configuration for PCI_REVISION_ID_HIP08 */ ++ /* firmware will ignore this configuration for PCI_REVISION_ID_HIP08 */ + hns3_set_bit(req->vport_vlan_cfg, HNS3_DISCARD_TAG1_EN_B, + vcfg->strip_tag1_discard_en ? 1 : 0); + hns3_set_bit(req->vport_vlan_cfg, HNS3_DISCARD_TAG2_EN_B, +@@ -763,7 +763,7 @@ hns3_set_vlan_tx_offload_cfg(struct hns3_adapter *hns, + vcfg->insert_tag2_en ? 1 : 0); + hns3_set_bit(req->vport_vlan_cfg, HNS3_CFG_NIC_ROCE_SEL_B, 0); + +- /* firmwall will ignore this configuration for PCI_REVISION_ID_HIP08 */ ++ /* firmware will ignore this configuration for PCI_REVISION_ID_HIP08 */ + hns3_set_bit(req->vport_vlan_cfg, HNS3_TAG_SHIFT_MODE_EN_B, + vcfg->tag_shift_mode_en ? 1 : 0); + +@@ -3385,7 +3385,7 @@ hns3_only_alloc_priv_buff(struct hns3_hw *hw, + * hns3_rx_buffer_calc: calculate the rx private buffer size for all TCs + * @hw: pointer to struct hns3_hw + * @buf_alloc: pointer to buffer calculation data +- * @return: 0: calculate sucessful, negative: fail ++ * @return: 0: calculate successful, negative: fail + */ + static int + hns3_rx_buffer_calc(struct hns3_hw *hw, struct hns3_pkt_buf_alloc *buf_alloc) +@@ -4518,14 +4518,14 @@ hns3_set_firber_default_support_speed(struct hns3_hw *hw) + } + + /* +- * Validity of supported_speed for firber and copper media type can be ++ * Validity of supported_speed for fiber and copper media type can be + * guaranteed by the following policy: + * Copper: + * Although the initialization of the phy in the firmware may not be + * completed, the firmware can guarantees that the supported_speed is + * an valid value. + * Firber: +- * If the version of firmware supports the acitive query way of the ++ * If the version of firmware supports the active query way of the + * HNS3_OPC_GET_SFP_INFO opcode, the supported_speed can be obtained + * through it. If unsupported, use the SFP's speed as the value of the + * supported_speed. +@@ -5285,7 +5285,7 @@ hns3_get_autoneg_fc_mode(struct hns3_hw *hw) + + /* + * Flow control auto-negotiation is not supported for fiber and +- * backpalne media type. ++ * backplane media type. + */ + case HNS3_MEDIA_TYPE_FIBER: + case HNS3_MEDIA_TYPE_BACKPLANE: +@@ -6152,7 +6152,7 @@ hns3_fec_get_internal(struct hns3_hw *hw, uint32_t *fec_capa) + } + + /* +- * FEC mode order defined in hns3 hardware is inconsistend with ++ * FEC mode order defined in hns3 hardware is inconsistent with + * that defined in the ethdev library. So the sequence needs + * to be converted. + */ +diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h +index 4406611fe9..2457754b3d 100644 +--- a/drivers/net/hns3/hns3_ethdev.h ++++ b/drivers/net/hns3/hns3_ethdev.h +@@ -125,7 +125,7 @@ struct hns3_tc_info { + uint8_t tc_sch_mode; /* 0: sp; 1: dwrr */ + uint8_t pgid; + uint32_t bw_limit; +- uint8_t up_to_tc_map; /* user priority maping on the TC */ ++ uint8_t up_to_tc_map; /* user priority mapping on the TC */ + }; + + struct hns3_dcb_info { +@@ -572,12 +572,12 @@ struct hns3_hw { + /* + * vlan mode. + * value range: +- * HNS3_SW_SHIFT_AND_DISCARD_MODE/HNS3_HW_SHFIT_AND_DISCARD_MODE ++ * HNS3_SW_SHIFT_AND_DISCARD_MODE/HNS3_HW_SHIFT_AND_DISCARD_MODE + * + * - HNS3_SW_SHIFT_AND_DISCARD_MODE + * For some versions of hardware network engine, because of the + * hardware limitation, PMD needs to detect the PVID status +- * to work with haredware to implement PVID-related functions. ++ * to work with hardware to implement PVID-related functions. + * For example, driver need discard the stripped PVID tag to ensure + * the PVID will not report to mbuf and shift the inserted VLAN tag + * to avoid port based VLAN covering it. +@@ -725,7 +725,7 @@ enum hns3_mp_req_type { + HNS3_MP_REQ_MAX + }; + +-/* Pameters for IPC. */ ++/* Parameters for IPC. */ + struct hns3_mp_param { + enum hns3_mp_req_type type; + int port_id; +diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c +index 1022b02697..de44b07691 100644 +--- a/drivers/net/hns3/hns3_ethdev_vf.c ++++ b/drivers/net/hns3/hns3_ethdev_vf.c +@@ -318,7 +318,7 @@ hns3vf_set_promisc_mode(struct hns3_hw *hw, bool en_bc_pmc, + * 1. The promiscuous/allmulticast mode can be configured successfully + * only based on the trusted VF device. If based on the non trusted + * VF device, configuring promiscuous/allmulticast mode will fail. +- * The hns3 VF device can be confiruged as trusted device by hns3 PF ++ * The hns3 VF device can be configured as trusted device by hns3 PF + * kernel ethdev driver on the host by the following command: + * "ip link set vf turst on" + * 2. After the promiscuous mode is configured successfully, hns3 VF PMD +@@ -330,7 +330,7 @@ hns3vf_set_promisc_mode(struct hns3_hw *hw, bool en_bc_pmc, + * filter is still effective even in promiscuous mode. If upper + * applications don't call rte_eth_dev_vlan_filter API function to + * set vlan based on VF device, hns3 VF PMD will can't receive +- * the packets with vlan tag in promiscuoue mode. ++ * the packets with vlan tag in promiscuous mode. + */ + hns3_cmd_setup_basic_desc(&desc, HNS3_OPC_MBX_VF_TO_PF, false); + req->msg[0] = HNS3_MBX_SET_PROMISC_MODE; +diff --git a/drivers/net/hns3/hns3_fdir.h b/drivers/net/hns3/hns3_fdir.h +index de2422e12f..ce70a534dc 100644 +--- a/drivers/net/hns3/hns3_fdir.h ++++ b/drivers/net/hns3/hns3_fdir.h +@@ -144,7 +144,7 @@ struct hns3_fdir_rule { + uint32_t flags; + uint32_t fd_id; /* APP marked unique value for this rule. */ + uint8_t action; +- /* VF id, avaiblable when flags with HNS3_RULE_FLAG_VF_ID. */ ++ /* VF id, available when flags with HNS3_RULE_FLAG_VF_ID. */ + uint8_t vf_id; + /* + * equal 0 when action is drop. +diff --git a/drivers/net/hns3/hns3_flow.c b/drivers/net/hns3/hns3_flow.c +index 1aee965e4a..a2c1589c39 100644 +--- a/drivers/net/hns3/hns3_flow.c ++++ b/drivers/net/hns3/hns3_flow.c +@@ -369,7 +369,7 @@ hns3_handle_action_indirect(struct rte_eth_dev *dev, + * + * @param actions[in] + * @param rule[out] +- * NIC specfilc actions derived from the actions. ++ * NIC specific actions derived from the actions. + * @param error[out] + */ + static int +@@ -400,7 +400,7 @@ hns3_handle_actions(struct rte_eth_dev *dev, + * Queue region is implemented by FDIR + RSS in hns3 hardware, + * the FDIR's action is one queue region (start_queue_id and + * queue_num), then RSS spread packets to the queue region by +- * RSS algorigthm. ++ * RSS algorithm. + */ + case RTE_FLOW_ACTION_TYPE_RSS: + ret = hns3_handle_action_queue_region(dev, actions, +@@ -978,7 +978,7 @@ hns3_parse_nvgre(const struct rte_flow_item *item, struct hns3_fdir_rule *rule, + if (nvgre_mask->protocol || nvgre_mask->c_k_s_rsvd0_ver) + return rte_flow_error_set(error, EINVAL, + RTE_FLOW_ERROR_TYPE_ITEM_MASK, item, +- "Ver/protocal is not supported in NVGRE"); ++ "Ver/protocol is not supported in NVGRE"); + + /* TNI must be totally masked or not. */ + if (memcmp(nvgre_mask->tni, full_mask, VNI_OR_TNI_LEN) && +@@ -1023,7 +1023,7 @@ hns3_parse_geneve(const struct rte_flow_item *item, struct hns3_fdir_rule *rule, + if (geneve_mask->ver_opt_len_o_c_rsvd0 || geneve_mask->protocol) + return rte_flow_error_set(error, EINVAL, + RTE_FLOW_ERROR_TYPE_ITEM_MASK, item, +- "Ver/protocal is not supported in GENEVE"); ++ "Ver/protocol is not supported in GENEVE"); + /* VNI must be totally masked or not. */ + if (memcmp(geneve_mask->vni, full_mask, VNI_OR_TNI_LEN) && + memcmp(geneve_mask->vni, zero_mask, VNI_OR_TNI_LEN)) +@@ -1354,7 +1354,7 @@ hns3_rss_input_tuple_supported(struct hns3_hw *hw, + } + + /* +- * This function is used to parse rss action validatation. ++ * This function is used to parse rss action validation. + */ + static int + hns3_parse_rss_filter(struct rte_eth_dev *dev, +@@ -1722,7 +1722,7 @@ hns3_flow_args_check(const struct rte_flow_attr *attr, + + /* + * Check if the flow rule is supported by hns3. +- * It only checkes the format. Don't guarantee the rule can be programmed into ++ * It only checks the format. Don't guarantee the rule can be programmed into + * the HW. Because there can be no enough room for the rule. + */ + static int +diff --git a/drivers/net/hns3/hns3_mbx.c b/drivers/net/hns3/hns3_mbx.c +index 9a05f0d1ee..8e0a58aa02 100644 +--- a/drivers/net/hns3/hns3_mbx.c ++++ b/drivers/net/hns3/hns3_mbx.c +@@ -78,14 +78,14 @@ hns3_get_mbx_resp(struct hns3_hw *hw, uint16_t code, uint16_t subcode, + mbx_time_limit = (uint32_t)hns->mbx_time_limit_ms * US_PER_MS; + while (wait_time < mbx_time_limit) { + if (__atomic_load_n(&hw->reset.disable_cmd, __ATOMIC_RELAXED)) { +- hns3_err(hw, "Don't wait for mbx respone because of " ++ hns3_err(hw, "Don't wait for mbx response because of " + "disable_cmd"); + return -EBUSY; + } + + if (is_reset_pending(hns)) { + hw->mbx_resp.req_msg_data = 0; +- hns3_err(hw, "Don't wait for mbx respone because of " ++ hns3_err(hw, "Don't wait for mbx response because of " + "reset pending"); + return -EIO; + } +diff --git a/drivers/net/hns3/hns3_mbx.h b/drivers/net/hns3/hns3_mbx.h +index c71f43238c..c378783c6c 100644 +--- a/drivers/net/hns3/hns3_mbx.h ++++ b/drivers/net/hns3/hns3_mbx.h +@@ -26,7 +26,7 @@ enum HNS3_MBX_OPCODE { + HNS3_MBX_GET_RETA, /* (VF -> PF) get RETA */ + HNS3_MBX_GET_RSS_KEY, /* (VF -> PF) get RSS key */ + HNS3_MBX_GET_MAC_ADDR, /* (VF -> PF) get MAC addr */ +- HNS3_MBX_PF_VF_RESP, /* (PF -> VF) generate respone to VF */ ++ HNS3_MBX_PF_VF_RESP, /* (PF -> VF) generate response to VF */ + HNS3_MBX_GET_BDNUM, /* (VF -> PF) get BD num */ + HNS3_MBX_GET_BUFSIZE, /* (VF -> PF) get buffer size */ + HNS3_MBX_GET_STREAMID, /* (VF -> PF) get stream id */ +diff --git a/drivers/net/hns3/hns3_rss.h b/drivers/net/hns3/hns3_rss.h +index 9471e7039d..8e8b056f4e 100644 +--- a/drivers/net/hns3/hns3_rss.h ++++ b/drivers/net/hns3/hns3_rss.h +@@ -40,7 +40,7 @@ + struct hns3_rss_conf { + /* RSS parameters :algorithm, flow_types, key, queue */ + struct rte_flow_action_rss conf; +- uint8_t hash_algo; /* hash function type definited by hardware */ ++ uint8_t hash_algo; /* hash function type defined by hardware */ + uint8_t key[HNS3_RSS_KEY_SIZE]; /* Hash key */ + uint16_t rss_indirection_tbl[HNS3_RSS_IND_TBL_SIZE_MAX]; + uint16_t queue[HNS3_RSS_QUEUES_BUFFER_NUM]; /* Queues indices to use */ +diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c +index 3c02fd54e1..9a597e032e 100644 +--- a/drivers/net/hns3/hns3_rxtx.c ++++ b/drivers/net/hns3/hns3_rxtx.c +@@ -1897,7 +1897,7 @@ hns3_rx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t nb_desc, + * For hns3 VF device, whether it needs to process PVID depends + * on the configuration of PF kernel mode netdevice driver. And the + * related PF configuration is delivered through the mailbox and finally +- * reflectd in port_base_vlan_cfg. ++ * reflected in port_base_vlan_cfg. + */ + if (hns->is_vf || hw->vlan_mode == HNS3_SW_SHIFT_AND_DISCARD_MODE) + rxq->pvid_sw_discard_en = hw->port_base_vlan_cfg.state == +@@ -3038,7 +3038,7 @@ hns3_tx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t nb_desc, + * For hns3 VF device, whether it needs to process PVID depends + * on the configuration of PF kernel mode netdev driver. And the + * related PF configuration is delivered through the mailbox and finally +- * reflectd in port_base_vlan_cfg. ++ * reflected in port_base_vlan_cfg. + */ + if (hns->is_vf || hw->vlan_mode == HNS3_SW_SHIFT_AND_DISCARD_MODE) + txq->pvid_sw_shift_en = hw->port_base_vlan_cfg.state == +@@ -3192,7 +3192,7 @@ hns3_fill_first_desc(struct hns3_tx_queue *txq, struct hns3_desc *desc, + * in Tx direction based on hns3 network engine. So when the number of + * VLANs in the packets represented by rxm plus the number of VLAN + * offload by hardware such as PVID etc, exceeds two, the packets will +- * be discarded or the original VLAN of the packets will be overwitted ++ * be discarded or the original VLAN of the packets will be overwritten + * by hardware. When the PF PVID is enabled by calling the API function + * named rte_eth_dev_set_vlan_pvid or the VF PVID is enabled by the hns3 + * PF kernel ether driver, the outer VLAN tag will always be the PVID. +@@ -3377,7 +3377,7 @@ hns3_parse_inner_params(struct rte_mbuf *m, uint32_t *ol_type_vlan_len_msec, + /* + * The inner l2 length of mbuf is the sum of outer l4 length, + * tunneling header length and inner l2 length for a tunnel +- * packect. But in hns3 tx descriptor, the tunneling header ++ * packet. But in hns3 tx descriptor, the tunneling header + * length is contained in the field of outer L4 length. + * Therefore, driver need to calculate the outer L4 length and + * inner L2 length. +@@ -3393,7 +3393,7 @@ hns3_parse_inner_params(struct rte_mbuf *m, uint32_t *ol_type_vlan_len_msec, + tmp_outer |= hns3_gen_field_val(HNS3_TXD_TUNTYPE_M, + HNS3_TXD_TUNTYPE_S, HNS3_TUN_NVGRE); + /* +- * For NVGRE tunnel packect, the outer L4 is empty. So only ++ * For NVGRE tunnel packet, the outer L4 is empty. So only + * fill the NVGRE header length to the outer L4 field. + */ + tmp_outer |= hns3_gen_field_val(HNS3_TXD_L4LEN_M, +@@ -3436,7 +3436,7 @@ hns3_parse_tunneling_params(struct hns3_tx_queue *txq, struct rte_mbuf *m, + * mbuf, but for hns3 descriptor, it is contained in the outer L4. So, + * there is a need that switching between them. To avoid multiple + * calculations, the length of the L2 header include the outer and +- * inner, will be filled during the parsing of tunnel packects. ++ * inner, will be filled during the parsing of tunnel packets. + */ + if (!(ol_flags & RTE_MBUF_F_TX_TUNNEL_MASK)) { + /* +@@ -3616,7 +3616,7 @@ hns3_outer_ipv4_cksum_prepared(struct rte_mbuf *m, uint64_t ol_flags, + if (ol_flags & RTE_MBUF_F_TX_OUTER_UDP_CKSUM) { + struct rte_udp_hdr *udp_hdr; + /* +- * If OUTER_UDP_CKSUM is support, HW can caclulate the pseudo ++ * If OUTER_UDP_CKSUM is support, HW can calculate the pseudo + * header for TSO packets + */ + if (ol_flags & RTE_MBUF_F_TX_TCP_SEG) +@@ -3641,7 +3641,7 @@ hns3_outer_ipv6_cksum_prepared(struct rte_mbuf *m, uint64_t ol_flags, + if (ol_flags & RTE_MBUF_F_TX_OUTER_UDP_CKSUM) { + struct rte_udp_hdr *udp_hdr; + /* +- * If OUTER_UDP_CKSUM is support, HW can caclulate the pseudo ++ * If OUTER_UDP_CKSUM is support, HW can calculate the pseudo + * header for TSO packets + */ + if (ol_flags & RTE_MBUF_F_TX_TCP_SEG) +diff --git a/drivers/net/hns3/hns3_rxtx.h b/drivers/net/hns3/hns3_rxtx.h +index e633b336b1..ea1a805491 100644 +--- a/drivers/net/hns3/hns3_rxtx.h ++++ b/drivers/net/hns3/hns3_rxtx.h +@@ -618,7 +618,7 @@ hns3_handle_bdinfo(struct hns3_rx_queue *rxq, struct rte_mbuf *rxm, + + /* + * If packet len bigger than mtu when recv with no-scattered algorithm, +- * the first n bd will without FE bit, we need process this sisution. ++ * the first n bd will without FE bit, we need process this situation. + * Note: we don't need add statistic counter because latest BD which + * with FE bit will mark HNS3_RXD_L2E_B bit. + */ +diff --git a/drivers/net/hns3/hns3_stats.c b/drivers/net/hns3/hns3_stats.c +index 552ae9d30c..bad65fcbed 100644 +--- a/drivers/net/hns3/hns3_stats.c ++++ b/drivers/net/hns3/hns3_stats.c +@@ -1286,7 +1286,7 @@ hns3_dev_xstats_get_names(struct rte_eth_dev *dev, + * A pointer to an ids array passed by application. This tells which + * statistics values function should retrieve. This parameter + * can be set to NULL if size is 0. In this case function will retrieve +- * all avalible statistics. ++ * all available statistics. + * @param values + * A pointer to a table to be filled with device statistics values. + * @param size +diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c +index c0bfff43ee..1d417dbf8a 100644 +--- a/drivers/net/i40e/i40e_ethdev.c ++++ b/drivers/net/i40e/i40e_ethdev.c +@@ -2483,7 +2483,7 @@ i40e_dev_start(struct rte_eth_dev *dev) + if (ret != I40E_SUCCESS) + PMD_DRV_LOG(WARNING, "Fail to set phy mask"); + +- /* Call get_link_info aq commond to enable/disable LSE */ ++ /* Call get_link_info aq command to enable/disable LSE */ + i40e_dev_link_update(dev, 0); + } + +@@ -3555,7 +3555,7 @@ static int i40e_dev_xstats_get_names(__rte_unused struct rte_eth_dev *dev, + count++; + } + +- /* Get individiual stats from i40e_hw_port struct */ ++ /* Get individual stats from i40e_hw_port struct */ + for (i = 0; i < I40E_NB_HW_PORT_XSTATS; i++) { + strlcpy(xstats_names[count].name, + rte_i40e_hw_port_strings[i].name, +@@ -3613,7 +3613,7 @@ i40e_dev_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *xstats, + count++; + } + +- /* Get individiual stats from i40e_hw_port struct */ ++ /* Get individual stats from i40e_hw_port struct */ + for (i = 0; i < I40E_NB_HW_PORT_XSTATS; i++) { + xstats[count].value = *(uint64_t *)(((char *)hw_stats) + + rte_i40e_hw_port_strings[i].offset); +@@ -5544,7 +5544,7 @@ i40e_vsi_get_bw_config(struct i40e_vsi *vsi) + &ets_sla_config, NULL); + if (ret != I40E_SUCCESS) { + PMD_DRV_LOG(ERR, +- "VSI failed to get TC bandwdith configuration %u", ++ "VSI failed to get TC bandwidth configuration %u", + hw->aq.asq_last_status); + return ret; + } +@@ -6822,7 +6822,7 @@ i40e_handle_mdd_event(struct rte_eth_dev *dev) + * @param handle + * Pointer to interrupt handle. + * @param param +- * The address of parameter (struct rte_eth_dev *) regsitered before. ++ * The address of parameter (struct rte_eth_dev *) registered before. + * + * @return + * void +@@ -9719,7 +9719,7 @@ i40e_ethertype_filter_convert(const struct rte_eth_ethertype_filter *input, + return 0; + } + +-/* Check if there exists the ehtertype filter */ ++/* Check if there exists the ethertype filter */ + struct i40e_ethertype_filter * + i40e_sw_ethertype_filter_lookup(struct i40e_ethertype_rule *ethertype_rule, + const struct i40e_ethertype_filter_input *input) +diff --git a/drivers/net/i40e/i40e_ethdev.h b/drivers/net/i40e/i40e_ethdev.h +index 2d182f8000..a1ebdc093c 100644 +--- a/drivers/net/i40e/i40e_ethdev.h ++++ b/drivers/net/i40e/i40e_ethdev.h +@@ -897,7 +897,7 @@ struct i40e_tunnel_filter { + TAILQ_ENTRY(i40e_tunnel_filter) rules; + struct i40e_tunnel_filter_input input; + uint8_t is_to_vf; /* 0 - to PF, 1 - to VF */ +- uint16_t vf_id; /* VF id, avaiblable when is_to_vf is 1. */ ++ uint16_t vf_id; /* VF id, available when is_to_vf is 1. */ + uint16_t queue; /* Queue assigned to when match */ + }; + +@@ -966,7 +966,7 @@ struct i40e_tunnel_filter_conf { + uint32_t tenant_id; /**< Tenant ID to match. VNI, GRE key... */ + uint16_t queue_id; /**< Queue assigned to if match. */ + uint8_t is_to_vf; /**< 0 - to PF, 1 - to VF */ +- uint16_t vf_id; /**< VF id, avaiblable when is_to_vf is 1. */ ++ uint16_t vf_id; /**< VF id, available when is_to_vf is 1. */ + }; + + TAILQ_HEAD(i40e_flow_list, rte_flow); +@@ -1100,7 +1100,7 @@ struct i40e_vf_msg_cfg { + /* + * If message statistics from a VF exceed the maximal limitation, + * the PF will ignore any new message from that VF for +- * 'ignor_second' time. ++ * 'ignore_second' time. + */ + uint32_t ignore_second; + }; +@@ -1257,7 +1257,7 @@ struct i40e_adapter { + }; + + /** +- * Strucute to store private data for each VF representor instance ++ * Structure to store private data for each VF representor instance + */ + struct i40e_vf_representor { + uint16_t switch_domain_id; +@@ -1265,7 +1265,7 @@ struct i40e_vf_representor { + uint16_t vf_id; + /**< Virtual Function ID */ + struct i40e_adapter *adapter; +- /**< Private data store of assocaiated physical function */ ++ /**< Private data store of associated physical function */ + struct i40e_eth_stats stats_offset; + /**< Zero-point of VF statistics*/ + }; +diff --git a/drivers/net/i40e/i40e_fdir.c b/drivers/net/i40e/i40e_fdir.c +index df2a5aaecc..8caedea14e 100644 +--- a/drivers/net/i40e/i40e_fdir.c ++++ b/drivers/net/i40e/i40e_fdir.c +@@ -142,7 +142,7 @@ i40e_fdir_rx_queue_init(struct i40e_rx_queue *rxq) + I40E_QRX_TAIL(rxq->vsi->base_queue); + + rte_wmb(); +- /* Init the RX tail regieter. */ ++ /* Init the RX tail register. */ + I40E_PCI_REG_WRITE(rxq->qrx_tail, rxq->nb_rx_desc - 1); + + return err; +@@ -430,7 +430,7 @@ i40e_check_fdir_flex_payload(const struct rte_eth_flex_payload_cfg *flex_cfg) + + for (i = 0; i < I40E_FDIR_MAX_FLEX_LEN; i++) { + if (flex_cfg->src_offset[i] >= I40E_MAX_FLX_SOURCE_OFF) { +- PMD_DRV_LOG(ERR, "exceeds maxmial payload limit."); ++ PMD_DRV_LOG(ERR, "exceeds maximal payload limit."); + return -EINVAL; + } + } +@@ -438,7 +438,7 @@ i40e_check_fdir_flex_payload(const struct rte_eth_flex_payload_cfg *flex_cfg) + memset(flex_pit, 0, sizeof(flex_pit)); + num = i40e_srcoff_to_flx_pit(flex_cfg->src_offset, flex_pit); + if (num > I40E_MAX_FLXPLD_FIED) { +- PMD_DRV_LOG(ERR, "exceeds maxmial number of flex fields."); ++ PMD_DRV_LOG(ERR, "exceeds maximal number of flex fields."); + return -EINVAL; + } + for (i = 0; i < num; i++) { +@@ -948,7 +948,7 @@ i40e_flow_fdir_construct_pkt(struct i40e_pf *pf, + uint8_t pctype = fdir_input->pctype; + struct i40e_customized_pctype *cus_pctype; + +- /* raw pcket template - just copy contents of the raw packet */ ++ /* raw packet template - just copy contents of the raw packet */ + if (fdir_input->flow_ext.pkt_template) { + memcpy(raw_pkt, fdir_input->flow.raw_flow.packet, + fdir_input->flow.raw_flow.length); +@@ -1831,7 +1831,7 @@ i40e_flow_add_del_fdir_filter(struct rte_eth_dev *dev, + &check_filter.fdir.input); + if (!node) { + PMD_DRV_LOG(ERR, +- "There's no corresponding flow firector filter!"); ++ "There's no corresponding flow director filter!"); + return -EINVAL; + } + +diff --git a/drivers/net/i40e/i40e_flow.c b/drivers/net/i40e/i40e_flow.c +index c9676caab5..e0cf996200 100644 +--- a/drivers/net/i40e/i40e_flow.c ++++ b/drivers/net/i40e/i40e_flow.c +@@ -3043,7 +3043,7 @@ i40e_flow_parse_fdir_pattern(struct rte_eth_dev *dev, + rte_flow_error_set(error, EINVAL, + RTE_FLOW_ERROR_TYPE_ITEM, + item, +- "Exceeds maxmial payload limit."); ++ "Exceeds maximal payload limit."); + return -rte_errno; + } + +diff --git a/drivers/net/i40e/i40e_pf.c b/drivers/net/i40e/i40e_pf.c +index ccb3924a5f..2435a8a070 100644 +--- a/drivers/net/i40e/i40e_pf.c ++++ b/drivers/net/i40e/i40e_pf.c +@@ -343,7 +343,7 @@ i40e_pf_host_process_cmd_get_vf_resource(struct i40e_pf_vf *vf, uint8_t *msg, + vf->request_caps = *(uint32_t *)msg; + + /* enable all RSS by default, +- * doesn't support hena setting by virtchnnl yet. ++ * doesn't support hena setting by virtchnl yet. + */ + if (vf->request_caps & VIRTCHNL_VF_OFFLOAD_RSS_PF) { + I40E_WRITE_REG(hw, I40E_VFQF_HENA1(0, vf->vf_idx), +@@ -725,7 +725,7 @@ i40e_pf_host_process_cmd_config_irq_map(struct i40e_pf_vf *vf, + if ((map->rxq_map < qbit_max) && (map->txq_map < qbit_max)) { + i40e_pf_config_irq_link_list(vf, map); + } else { +- /* configured queue size excceed limit */ ++ /* configured queue size exceed limit */ + ret = I40E_ERR_PARAM; + goto send_msg; + } +diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c +index e4cb33dc3c..9a00a9b71e 100644 +--- a/drivers/net/i40e/i40e_rxtx.c ++++ b/drivers/net/i40e/i40e_rxtx.c +@@ -609,7 +609,7 @@ i40e_rx_alloc_bufs(struct i40e_rx_queue *rxq) + rxdp[i].read.pkt_addr = dma_addr; + } + +- /* Update rx tail regsiter */ ++ /* Update rx tail register */ + I40E_PCI_REG_WRITE(rxq->qrx_tail, rxq->rx_free_trigger); + + rxq->rx_free_trigger = +@@ -995,7 +995,7 @@ i40e_recv_scattered_pkts(void *rx_queue, + * threshold of the queue, advance the Receive Descriptor Tail (RDT) + * register. Update the RDT with the value of the last processed RX + * descriptor minus 1, to guarantee that the RDT register is never +- * equal to the RDH register, which creates a "full" ring situtation ++ * equal to the RDH register, which creates a "full" ring situation + * from the hardware point of view. + */ + nb_hold = (uint16_t)(nb_hold + rxq->nb_rx_hold); +@@ -1467,7 +1467,7 @@ tx_xmit_pkts(struct i40e_tx_queue *txq, + i40e_tx_fill_hw_ring(txq, tx_pkts + n, (uint16_t)(nb_pkts - n)); + txq->tx_tail = (uint16_t)(txq->tx_tail + (nb_pkts - n)); + +- /* Determin if RS bit needs to be set */ ++ /* Determine if RS bit needs to be set */ + if (txq->tx_tail > txq->tx_next_rs) { + txr[txq->tx_next_rs].cmd_type_offset_bsz |= + rte_cpu_to_le_64(((uint64_t)I40E_TX_DESC_CMD_RS) << +@@ -1697,7 +1697,7 @@ i40e_dev_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id) + } + + if (rxq->rx_deferred_start) +- PMD_DRV_LOG(WARNING, "RX queue %u is deferrd start", ++ PMD_DRV_LOG(WARNING, "RX queue %u is deferred start", + rx_queue_id); + + err = i40e_alloc_rx_queue_mbufs(rxq); +@@ -1706,7 +1706,7 @@ i40e_dev_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id) + return err; + } + +- /* Init the RX tail regieter. */ ++ /* Init the RX tail register. */ + I40E_PCI_REG_WRITE(rxq->qrx_tail, rxq->nb_rx_desc - 1); + + err = i40e_switch_rx_queue(hw, rxq->reg_idx, TRUE); +@@ -1771,7 +1771,7 @@ i40e_dev_tx_queue_start(struct rte_eth_dev *dev, uint16_t tx_queue_id) + } + + if (txq->tx_deferred_start) +- PMD_DRV_LOG(WARNING, "TX queue %u is deferrd start", ++ PMD_DRV_LOG(WARNING, "TX queue %u is deferred start", + tx_queue_id); + + /* +@@ -1930,7 +1930,7 @@ i40e_dev_rx_queue_setup_runtime(struct rte_eth_dev *dev, + PMD_DRV_LOG(ERR, "Can't use default burst."); + return -EINVAL; + } +- /* check scatterred conflict */ ++ /* check scattered conflict */ + if (!dev->data->scattered_rx && use_scattered_rx) { + PMD_DRV_LOG(ERR, "Scattered rx is required."); + return -EINVAL; +@@ -2014,7 +2014,7 @@ i40e_dev_rx_queue_setup(struct rte_eth_dev *dev, + rxq->rx_deferred_start = rx_conf->rx_deferred_start; + rxq->offloads = offloads; + +- /* Allocate the maximun number of RX ring hardware descriptor. */ ++ /* Allocate the maximum number of RX ring hardware descriptor. */ + len = I40E_MAX_RING_DESC; + + /** +@@ -2322,7 +2322,7 @@ i40e_dev_tx_queue_setup(struct rte_eth_dev *dev, + */ + tx_free_thresh = (uint16_t)((tx_conf->tx_free_thresh) ? + tx_conf->tx_free_thresh : DEFAULT_TX_FREE_THRESH); +- /* force tx_rs_thresh to adapt an aggresive tx_free_thresh */ ++ /* force tx_rs_thresh to adapt an aggressive tx_free_thresh */ + tx_rs_thresh = (DEFAULT_TX_RS_THRESH + tx_free_thresh > nb_desc) ? + nb_desc - tx_free_thresh : DEFAULT_TX_RS_THRESH; + if (tx_conf->tx_rs_thresh > 0) +@@ -2991,7 +2991,7 @@ i40e_rx_queue_init(struct i40e_rx_queue *rxq) + if (rxq->max_pkt_len > buf_size) + dev_data->scattered_rx = 1; + +- /* Init the RX tail regieter. */ ++ /* Init the RX tail register. */ + I40E_PCI_REG_WRITE(rxq->qrx_tail, rxq->nb_rx_desc - 1); + + return 0; +diff --git a/drivers/net/i40e/i40e_rxtx_vec_altivec.c b/drivers/net/i40e/i40e_rxtx_vec_altivec.c +index d0bf86dfba..f78ba994f7 100644 +--- a/drivers/net/i40e/i40e_rxtx_vec_altivec.c ++++ b/drivers/net/i40e/i40e_rxtx_vec_altivec.c +@@ -430,7 +430,7 @@ _recv_raw_pkts_vec(struct i40e_rx_queue *rxq, struct rte_mbuf **rx_pkts, + desc_to_ptype_v(descs, &rx_pkts[pos], ptype_tbl); + desc_to_olflags_v(descs, &rx_pkts[pos]); + +- /* C.4 calc avaialbe number of desc */ ++ /* C.4 calc available number of desc */ + var = __builtin_popcountll((vec_ld(0, + (vector unsigned long *)&staterr)[0])); + nb_pkts_recd += var; +diff --git a/drivers/net/i40e/i40e_rxtx_vec_neon.c b/drivers/net/i40e/i40e_rxtx_vec_neon.c +index b951ea2dc3..507468531f 100644 +--- a/drivers/net/i40e/i40e_rxtx_vec_neon.c ++++ b/drivers/net/i40e/i40e_rxtx_vec_neon.c +@@ -151,7 +151,7 @@ desc_to_olflags_v(struct i40e_rx_queue *rxq, uint64x2_t descs[4], + vreinterpretq_u8_u32(l3_l4e))); + /* then we shift left 1 bit */ + l3_l4e = vshlq_n_u32(l3_l4e, 1); +- /* we need to mask out the reduntant bits */ ++ /* we need to mask out the redundant bits */ + l3_l4e = vandq_u32(l3_l4e, cksum_mask); + + vlan0 = vorrq_u32(vlan0, rss); +@@ -416,7 +416,7 @@ _recv_raw_pkts_vec(struct i40e_rx_queue *__rte_restrict rxq, + I40E_UINT16_BIT - 1)); + stat = ~vgetq_lane_u64(vreinterpretq_u64_u16(staterr), 0); + +- /* C.4 calc avaialbe number of desc */ ++ /* C.4 calc available number of desc */ + if (unlikely(stat == 0)) { + nb_pkts_recd += RTE_I40E_DESCS_PER_LOOP; + } else { +diff --git a/drivers/net/i40e/i40e_rxtx_vec_sse.c b/drivers/net/i40e/i40e_rxtx_vec_sse.c +index 497b2404c6..3782e8052f 100644 +--- a/drivers/net/i40e/i40e_rxtx_vec_sse.c ++++ b/drivers/net/i40e/i40e_rxtx_vec_sse.c +@@ -282,7 +282,7 @@ desc_to_olflags_v(struct i40e_rx_queue *rxq, volatile union i40e_rx_desc *rxdp, + l3_l4e = _mm_shuffle_epi8(l3_l4e_flags, l3_l4e); + /* then we shift left 1 bit */ + l3_l4e = _mm_slli_epi32(l3_l4e, 1); +- /* we need to mask out the reduntant bits */ ++ /* we need to mask out the redundant bits */ + l3_l4e = _mm_and_si128(l3_l4e, cksum_mask); + + vlan0 = _mm_or_si128(vlan0, rss); +@@ -297,7 +297,7 @@ desc_to_olflags_v(struct i40e_rx_queue *rxq, volatile union i40e_rx_desc *rxdp, + __m128i v_fdir_ol_flags = descs_to_fdir_16b(desc_fltstat, + descs, rx_pkts); + #endif +- /* OR in ol_flag bits after descriptor speicific extraction */ ++ /* OR in ol_flag bits after descriptor specific extraction */ + vlan0 = _mm_or_si128(vlan0, v_fdir_ol_flags); + } + +@@ -577,7 +577,7 @@ _recv_raw_pkts_vec(struct i40e_rx_queue *rxq, struct rte_mbuf **rx_pkts, + _mm_storeu_si128((void *)&rx_pkts[pos]->rx_descriptor_fields1, + pkt_mb1); + desc_to_ptype_v(descs, &rx_pkts[pos], ptype_tbl); +- /* C.4 calc avaialbe number of desc */ ++ /* C.4 calc available number of desc */ + var = __builtin_popcountll(_mm_cvtsi128_si64(staterr)); + nb_pkts_recd += var; + if (likely(var != RTE_I40E_DESCS_PER_LOOP)) +diff --git a/drivers/net/i40e/rte_pmd_i40e.c b/drivers/net/i40e/rte_pmd_i40e.c +index a492959b75..35829a1eea 100644 +--- a/drivers/net/i40e/rte_pmd_i40e.c ++++ b/drivers/net/i40e/rte_pmd_i40e.c +@@ -1427,7 +1427,7 @@ rte_pmd_i40e_set_tc_strict_prio(uint16_t port, uint8_t tc_map) + /* Get all TCs' bandwidth. */ + for (i = 0; i < I40E_MAX_TRAFFIC_CLASS; i++) { + if (veb->enabled_tc & BIT_ULL(i)) { +- /* For rubust, if bandwidth is 0, use 1 instead. */ ++ /* For robust, if bandwidth is 0, use 1 instead. */ + if (veb->bw_info.bw_ets_share_credits[i]) + ets_data.tc_bw_share_credits[i] = + veb->bw_info.bw_ets_share_credits[i]; +diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c +index 377d7bc7a6..79397f15e5 100644 +--- a/drivers/net/iavf/iavf_ethdev.c ++++ b/drivers/net/iavf/iavf_ethdev.c +@@ -516,7 +516,7 @@ iavf_init_rss(struct iavf_adapter *adapter) + j = 0; + vf->rss_lut[i] = j; + } +- /* send virtchnnl ops to configure rss*/ ++ /* send virtchnl ops to configure RSS */ + ret = iavf_configure_rss_lut(adapter); + if (ret) + return ret; +@@ -831,7 +831,7 @@ static int iavf_config_rx_queues_irqs(struct rte_eth_dev *dev, + "vector %u are mapping to all Rx queues", + vf->msix_base); + } else { +- /* If Rx interrupt is reuquired, and we can use ++ /* If Rx interrupt is required, and we can use + * multi interrupts, then the vec is from 1 + */ + vf->nb_msix = +@@ -1420,7 +1420,7 @@ iavf_dev_rss_reta_update(struct rte_eth_dev *dev, + } + + rte_memcpy(vf->rss_lut, lut, reta_size); +- /* send virtchnnl ops to configure rss*/ ++ /* send virtchnl ops to configure RSS */ + ret = iavf_configure_rss_lut(adapter); + if (ret) /* revert back */ + rte_memcpy(vf->rss_lut, lut, reta_size); +diff --git a/drivers/net/iavf/iavf_ipsec_crypto.c b/drivers/net/iavf/iavf_ipsec_crypto.c +index 884169e061..adf101ab8a 100644 +--- a/drivers/net/iavf/iavf_ipsec_crypto.c ++++ b/drivers/net/iavf/iavf_ipsec_crypto.c +@@ -69,7 +69,7 @@ struct iavf_security_session { + * 16B - 3 + * + * but we also need the IV Length for TSO to correctly calculate the total +- * header length so placing it in the upper 6-bits here for easier reterival. ++ * header length so placing it in the upper 6-bits here for easier retrieval. + */ + static inline uint8_t + calc_ipsec_desc_iv_len_field(uint16_t iv_sz) +@@ -448,7 +448,7 @@ sa_add_set_auth_params(struct virtchnl_ipsec_crypto_cfg_item *cfg, + /** + * Send SA add virtual channel request to Inline IPsec driver. + * +- * Inline IPsec driver expects SPI and destination IP adderss to be in host ++ * Inline IPsec driver expects SPI and destination IP address to be in host + * order, but DPDK APIs are network order, therefore we need to do a htonl + * conversion of these parameters. + */ +@@ -726,7 +726,7 @@ iavf_ipsec_crypto_action_valid(struct rte_eth_dev *ethdev, + /** + * Send virtual channel security policy add request to IES driver. + * +- * IES driver expects SPI and destination IP adderss to be in host ++ * IES driver expects SPI and destination IP address to be in host + * order, but DPDK APIs are network order, therefore we need to do a htonl + * conversion of these parameters. + */ +@@ -994,7 +994,7 @@ iavf_ipsec_crypto_sa_del(struct iavf_adapter *adapter, + request->req_id = (uint16_t)0xDEADBEEF; + + /** +- * SA delete supports deletetion of 1-8 specified SA's or if the flag ++ * SA delete supports deletion of 1-8 specified SA's or if the flag + * field is zero, all SA's associated with VF will be deleted. + */ + if (sess) { +@@ -1147,7 +1147,7 @@ iavf_ipsec_crypto_pkt_metadata_set(void *device, + md = RTE_MBUF_DYNFIELD(m, iavf_sctx->pkt_md_offset, + struct iavf_ipsec_crypto_pkt_metadata *); + +- /* Set immutatable metadata values from session template */ ++ /* Set immutable metadata values from session template */ + memcpy(md, &iavf_sess->pkt_metadata_template, + sizeof(struct iavf_ipsec_crypto_pkt_metadata)); + +@@ -1355,7 +1355,7 @@ iavf_ipsec_crypto_set_security_capabililites(struct iavf_security_ctx + capabilities[number_of_capabilities].op = RTE_CRYPTO_OP_TYPE_UNDEFINED; + + /** +- * Iterate over each virtchl crypto capability by crypto type and ++ * Iterate over each virtchnl crypto capability by crypto type and + * algorithm. + */ + for (i = 0; i < VIRTCHNL_IPSEC_MAX_CRYPTO_CAP_NUM; i++) { +@@ -1454,7 +1454,7 @@ iavf_ipsec_crypto_capabilities_get(void *device) + /** + * Update the security capabilities struct with the runtime discovered + * crypto capabilities, except for last element of the array which is +- * the null terminatation ++ * the null termination + */ + for (i = 0; i < ((sizeof(iavf_security_capabilities) / + sizeof(iavf_security_capabilities[0])) - 1); i++) { +diff --git a/drivers/net/iavf/iavf_ipsec_crypto.h b/drivers/net/iavf/iavf_ipsec_crypto.h +index 4e4c8798ec..687541077a 100644 +--- a/drivers/net/iavf/iavf_ipsec_crypto.h ++++ b/drivers/net/iavf/iavf_ipsec_crypto.h +@@ -73,7 +73,7 @@ enum iavf_ipsec_iv_len { + }; + + +-/* IPsec Crypto Packet Metaday offload flags */ ++/* IPsec Crypto Packet Metadata offload flags */ + #define IAVF_IPSEC_CRYPTO_OL_FLAGS_IS_TUN (0x1 << 0) + #define IAVF_IPSEC_CRYPTO_OL_FLAGS_ESN (0x1 << 1) + #define IAVF_IPSEC_CRYPTO_OL_FLAGS_IPV6_EXT_HDRS (0x1 << 2) +diff --git a/drivers/net/iavf/iavf_rxtx.c b/drivers/net/iavf/iavf_rxtx.c +index 154472c50f..59623ac820 100644 +--- a/drivers/net/iavf/iavf_rxtx.c ++++ b/drivers/net/iavf/iavf_rxtx.c +@@ -648,8 +648,8 @@ iavf_dev_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx, + return -ENOMEM; + } + +- /* Allocate the maximun number of RX ring hardware descriptor with +- * a liitle more to support bulk allocate. ++ /* Allocate the maximum number of RX ring hardware descriptor with ++ * a little more to support bulk allocate. + */ + len = IAVF_MAX_RING_DESC + IAVF_RX_MAX_BURST; + ring_size = RTE_ALIGN(len * sizeof(union iavf_rx_desc), +diff --git a/drivers/net/iavf/iavf_rxtx_vec_sse.c b/drivers/net/iavf/iavf_rxtx_vec_sse.c +index 1bac59bf0e..d582a36326 100644 +--- a/drivers/net/iavf/iavf_rxtx_vec_sse.c ++++ b/drivers/net/iavf/iavf_rxtx_vec_sse.c +@@ -159,7 +159,7 @@ desc_to_olflags_v(struct iavf_rx_queue *rxq, __m128i descs[4], + l3_l4e = _mm_shuffle_epi8(l3_l4e_flags, l3_l4e); + /* then we shift left 1 bit */ + l3_l4e = _mm_slli_epi32(l3_l4e, 1); +- /* we need to mask out the reduntant bits */ ++ /* we need to mask out the redundant bits */ + l3_l4e = _mm_and_si128(l3_l4e, cksum_mask); + + vlan0 = _mm_or_si128(vlan0, rss); +@@ -613,7 +613,7 @@ _recv_raw_pkts_vec(struct iavf_rx_queue *rxq, struct rte_mbuf **rx_pkts, + _mm_storeu_si128((void *)&rx_pkts[pos]->rx_descriptor_fields1, + pkt_mb1); + desc_to_ptype_v(descs, &rx_pkts[pos], ptype_tbl); +- /* C.4 calc avaialbe number of desc */ ++ /* C.4 calc available number of desc */ + var = __builtin_popcountll(_mm_cvtsi128_si64(staterr)); + nb_pkts_recd += var; + if (likely(var != IAVF_VPMD_DESCS_PER_LOOP)) +diff --git a/drivers/net/iavf/iavf_vchnl.c b/drivers/net/iavf/iavf_vchnl.c +index 145b059837..7602691649 100644 +--- a/drivers/net/iavf/iavf_vchnl.c ++++ b/drivers/net/iavf/iavf_vchnl.c +@@ -461,7 +461,7 @@ iavf_check_api_version(struct iavf_adapter *adapter) + (vf->virtchnl_version.major == VIRTCHNL_VERSION_MAJOR_START && + vf->virtchnl_version.minor < VIRTCHNL_VERSION_MINOR_START)) { + PMD_INIT_LOG(ERR, "VIRTCHNL API version should not be lower" +- " than (%u.%u) to support Adapative VF", ++ " than (%u.%u) to support Adaptive VF", + VIRTCHNL_VERSION_MAJOR_START, + VIRTCHNL_VERSION_MAJOR_START); + return -1; +@@ -1487,7 +1487,7 @@ iavf_fdir_check(struct iavf_adapter *adapter, + + err = iavf_execute_vf_cmd(adapter, &args, 0); + if (err) { +- PMD_DRV_LOG(ERR, "fail to check flow direcotor rule"); ++ PMD_DRV_LOG(ERR, "fail to check flow director rule"); + return err; + } + +diff --git a/drivers/net/ice/ice_dcf.c b/drivers/net/ice/ice_dcf.c +index cca1d7bf46..7f0c074b01 100644 +--- a/drivers/net/ice/ice_dcf.c ++++ b/drivers/net/ice/ice_dcf.c +@@ -864,7 +864,7 @@ ice_dcf_init_rss(struct ice_dcf_hw *hw) + j = 0; + hw->rss_lut[i] = j; + } +- /* send virtchnnl ops to configure rss*/ ++ /* send virtchnl ops to configure RSS */ + ret = ice_dcf_configure_rss_lut(hw); + if (ret) + return ret; +diff --git a/drivers/net/ice/ice_dcf_ethdev.c b/drivers/net/ice/ice_dcf_ethdev.c +index 28f7f7fb72..164d834a18 100644 +--- a/drivers/net/ice/ice_dcf_ethdev.c ++++ b/drivers/net/ice/ice_dcf_ethdev.c +@@ -203,7 +203,7 @@ ice_dcf_config_rx_queues_irqs(struct rte_eth_dev *dev, + "vector %u are mapping to all Rx queues", + hw->msix_base); + } else { +- /* If Rx interrupt is reuquired, and we can use ++ /* If Rx interrupt is required, and we can use + * multi interrupts, then the vec is from 1 + */ + hw->nb_msix = RTE_MIN(hw->vf_res->max_vectors, +diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c +index 13a7a9702a..c9fd3de2bd 100644 +--- a/drivers/net/ice/ice_ethdev.c ++++ b/drivers/net/ice/ice_ethdev.c +@@ -1264,7 +1264,7 @@ ice_handle_aq_msg(struct rte_eth_dev *dev) + * @param handle + * Pointer to interrupt handle. + * @param param +- * The address of parameter (struct rte_eth_dev *) regsitered before. ++ * The address of parameter (struct rte_eth_dev *) registered before. + * + * @return + * void +@@ -1627,7 +1627,7 @@ ice_setup_vsi(struct ice_pf *pf, enum ice_vsi_type type) + } + + /* At the beginning, only TC0. */ +- /* What we need here is the maximam number of the TX queues. ++ /* What we need here is the maximum number of the TX queues. + * Currently vsi->nb_qps means it. + * Correct it if any change. + */ +@@ -3576,7 +3576,7 @@ ice_dev_start(struct rte_eth_dev *dev) + goto rx_err; + } + +- /* enable Rx interrput and mapping Rx queue to interrupt vector */ ++ /* enable Rx interrupt and mapping Rx queue to interrupt vector */ + if (ice_rxq_intr_setup(dev)) + return -EIO; + +@@ -3603,7 +3603,7 @@ ice_dev_start(struct rte_eth_dev *dev) + + ice_dev_set_link_up(dev); + +- /* Call get_link_info aq commond to enable/disable LSE */ ++ /* Call get_link_info aq command to enable/disable LSE */ + ice_link_update(dev, 0); + + pf->adapter_stopped = false; +@@ -5395,7 +5395,7 @@ ice_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *xstats, + count++; + } + +- /* Get individiual stats from ice_hw_port struct */ ++ /* Get individual stats from ice_hw_port struct */ + for (i = 0; i < ICE_NB_HW_PORT_XSTATS; i++) { + xstats[count].value = + *(uint64_t *)((char *)hw_stats + +@@ -5426,7 +5426,7 @@ static int ice_xstats_get_names(__rte_unused struct rte_eth_dev *dev, + count++; + } + +- /* Get individiual stats from ice_hw_port struct */ ++ /* Get individual stats from ice_hw_port struct */ + for (i = 0; i < ICE_NB_HW_PORT_XSTATS; i++) { + strlcpy(xstats_names[count].name, ice_hw_port_strings[i].name, + sizeof(xstats_names[count].name)); +diff --git a/drivers/net/ice/ice_rxtx.c b/drivers/net/ice/ice_rxtx.c +index f6d8564ab8..c80d86915e 100644 +--- a/drivers/net/ice/ice_rxtx.c ++++ b/drivers/net/ice/ice_rxtx.c +@@ -1118,7 +1118,7 @@ ice_rx_queue_setup(struct rte_eth_dev *dev, + rxq->proto_xtr = pf->proto_xtr != NULL ? + pf->proto_xtr[queue_idx] : PROTO_XTR_NONE; + +- /* Allocate the maximun number of RX ring hardware descriptor. */ ++ /* Allocate the maximum number of RX ring hardware descriptor. */ + len = ICE_MAX_RING_DESC; + + /** +@@ -1248,7 +1248,7 @@ ice_tx_queue_setup(struct rte_eth_dev *dev, + tx_free_thresh = (uint16_t)(tx_conf->tx_free_thresh ? + tx_conf->tx_free_thresh : + ICE_DEFAULT_TX_FREE_THRESH); +- /* force tx_rs_thresh to adapt an aggresive tx_free_thresh */ ++ /* force tx_rs_thresh to adapt an aggressive tx_free_thresh */ + tx_rs_thresh = + (ICE_DEFAULT_TX_RSBIT_THRESH + tx_free_thresh > nb_desc) ? + nb_desc - tx_free_thresh : ICE_DEFAULT_TX_RSBIT_THRESH; +@@ -1714,7 +1714,7 @@ ice_rx_alloc_bufs(struct ice_rx_queue *rxq) + rxdp[i].read.pkt_addr = dma_addr; + } + +- /* Update rx tail regsiter */ ++ /* Update Rx tail register */ + ICE_PCI_REG_WRITE(rxq->qrx_tail, rxq->rx_free_trigger); + + rxq->rx_free_trigger = +@@ -1976,7 +1976,7 @@ ice_recv_scattered_pkts(void *rx_queue, + * threshold of the queue, advance the Receive Descriptor Tail (RDT) + * register. Update the RDT with the value of the last processed RX + * descriptor minus 1, to guarantee that the RDT register is never +- * equal to the RDH register, which creates a "full" ring situtation ++ * equal to the RDH register, which creates a "full" ring situation + * from the hardware point of view. + */ + nb_hold = (uint16_t)(nb_hold + rxq->nb_rx_hold); +@@ -3117,7 +3117,7 @@ tx_xmit_pkts(struct ice_tx_queue *txq, + ice_tx_fill_hw_ring(txq, tx_pkts + n, (uint16_t)(nb_pkts - n)); + txq->tx_tail = (uint16_t)(txq->tx_tail + (nb_pkts - n)); + +- /* Determin if RS bit needs to be set */ ++ /* Determine if RS bit needs to be set */ + if (txq->tx_tail > txq->tx_next_rs) { + txr[txq->tx_next_rs].cmd_type_offset_bsz |= + rte_cpu_to_le_64(((uint64_t)ICE_TX_DESC_CMD_RS) << +diff --git a/drivers/net/ice/ice_rxtx_vec_sse.c b/drivers/net/ice/ice_rxtx_vec_sse.c +index 6cd44c5847..fd94cedde3 100644 +--- a/drivers/net/ice/ice_rxtx_vec_sse.c ++++ b/drivers/net/ice/ice_rxtx_vec_sse.c +@@ -202,7 +202,7 @@ ice_rx_desc_to_olflags_v(struct ice_rx_queue *rxq, __m128i descs[4], + __m128i l3_l4_mask = _mm_set_epi32(~0x6, ~0x6, ~0x6, ~0x6); + __m128i l3_l4_flags = _mm_and_si128(flags, l3_l4_mask); + flags = _mm_or_si128(l3_l4_flags, l4_outer_flags); +- /* we need to mask out the reduntant bits introduced by RSS or ++ /* we need to mask out the redundant bits introduced by RSS or + * VLAN fields. + */ + flags = _mm_and_si128(flags, cksum_mask); +@@ -566,7 +566,7 @@ _ice_recv_raw_pkts_vec(struct ice_rx_queue *rxq, struct rte_mbuf **rx_pkts, + _mm_storeu_si128((void *)&rx_pkts[pos]->rx_descriptor_fields1, + pkt_mb0); + ice_rx_desc_to_ptype_v(descs, &rx_pkts[pos], ptype_tbl); +- /* C.4 calc avaialbe number of desc */ ++ /* C.4 calc available number of desc */ + var = __builtin_popcountll(_mm_cvtsi128_si64(staterr)); + nb_pkts_recd += var; + if (likely(var != ICE_DESCS_PER_LOOP)) +diff --git a/drivers/net/igc/igc_filter.c b/drivers/net/igc/igc_filter.c +index 51fcabfb59..bff98df200 100644 +--- a/drivers/net/igc/igc_filter.c ++++ b/drivers/net/igc/igc_filter.c +@@ -167,7 +167,7 @@ igc_tuple_filter_lookup(const struct igc_adapter *igc, + /* search the filter array */ + for (; i < IGC_MAX_NTUPLE_FILTERS; i++) { + if (igc->ntuple_filters[i].hash_val) { +- /* compare the hase value */ ++ /* compare the hash value */ + if (ntuple->hash_val == + igc->ntuple_filters[i].hash_val) + /* filter be found, return index */ +diff --git a/drivers/net/igc/igc_txrx.c b/drivers/net/igc/igc_txrx.c +index 339b0c9aa1..e48d5df11a 100644 +--- a/drivers/net/igc/igc_txrx.c ++++ b/drivers/net/igc/igc_txrx.c +@@ -2099,7 +2099,7 @@ eth_igc_tx_done_cleanup(void *txqueue, uint32_t free_cnt) + sw_ring[tx_id].mbuf = NULL; + sw_ring[tx_id].last_id = tx_id; + +- /* Move to next segemnt. */ ++ /* Move to next segment. */ + tx_id = sw_ring[tx_id].next_id; + } while (tx_id != tx_next); + +@@ -2133,7 +2133,7 @@ eth_igc_tx_done_cleanup(void *txqueue, uint32_t free_cnt) + * Walk the list and find the next mbuf, if any. + */ + do { +- /* Move to next segemnt. */ ++ /* Move to next segment. */ + tx_id = sw_ring[tx_id].next_id; + + if (sw_ring[tx_id].mbuf) +diff --git a/drivers/net/ionic/ionic_if.h b/drivers/net/ionic/ionic_if.h +index 693b44d764..45bad9b040 100644 +--- a/drivers/net/ionic/ionic_if.h ++++ b/drivers/net/ionic/ionic_if.h +@@ -2068,7 +2068,7 @@ typedef struct ionic_admin_comp ionic_fw_download_comp; + * enum ionic_fw_control_oper - FW control operations + * @IONIC_FW_RESET: Reset firmware + * @IONIC_FW_INSTALL: Install firmware +- * @IONIC_FW_ACTIVATE: Acticate firmware ++ * @IONIC_FW_ACTIVATE: Activate firmware + */ + enum ionic_fw_control_oper { + IONIC_FW_RESET = 0, +@@ -2091,7 +2091,7 @@ struct ionic_fw_control_cmd { + }; + + /** +- * struct ionic_fw_control_comp - Firmware control copletion ++ * struct ionic_fw_control_comp - Firmware control completion + * @status: Status of the command (enum ionic_status_code) + * @comp_index: Index in the descriptor ring for which this is the completion + * @slot: Slot where the firmware was installed +@@ -2878,7 +2878,7 @@ struct ionic_doorbell { + * and @identity->intr_coal_div to convert from + * usecs to device units: + * +- * coal_init = coal_usecs * coal_mutl / coal_div ++ * coal_init = coal_usecs * coal_mult / coal_div + * + * When an interrupt is sent the interrupt + * coalescing timer current value +diff --git a/drivers/net/ipn3ke/ipn3ke_ethdev.c b/drivers/net/ipn3ke/ipn3ke_ethdev.c +index 964506c6db..014e438dd5 100644 +--- a/drivers/net/ipn3ke/ipn3ke_ethdev.c ++++ b/drivers/net/ipn3ke/ipn3ke_ethdev.c +@@ -483,7 +483,7 @@ static int ipn3ke_vswitch_probe(struct rte_afu_device *afu_dev) + RTE_CACHE_LINE_SIZE, + afu_dev->device.numa_node); + if (!hw) { +- IPN3KE_AFU_PMD_ERR("failed to allocate hardwart data"); ++ IPN3KE_AFU_PMD_ERR("failed to allocate hardware data"); + retval = -ENOMEM; + return -ENOMEM; + } +diff --git a/drivers/net/ipn3ke/ipn3ke_ethdev.h b/drivers/net/ipn3ke/ipn3ke_ethdev.h +index 041f13d9c3..58fcc50c57 100644 +--- a/drivers/net/ipn3ke/ipn3ke_ethdev.h ++++ b/drivers/net/ipn3ke/ipn3ke_ethdev.h +@@ -223,7 +223,7 @@ struct ipn3ke_hw_cap { + }; + + /** +- * Strucute to store private data for each representor instance ++ * Structure to store private data for each representor instance + */ + struct ipn3ke_rpst { + TAILQ_ENTRY(ipn3ke_rpst) next; /**< Next in device list. */ +@@ -237,7 +237,7 @@ struct ipn3ke_rpst { + uint16_t i40e_pf_eth_port_id; + struct rte_eth_link ori_linfo; + struct ipn3ke_tm_internals tm; +- /**< Private data store of assocaiated physical function */ ++ /**< Private data store of associated physical function */ + struct rte_ether_addr mac_addr; + }; + +diff --git a/drivers/net/ipn3ke/ipn3ke_flow.c b/drivers/net/ipn3ke/ipn3ke_flow.c +index f5867ca055..66ae31a5a9 100644 +--- a/drivers/net/ipn3ke/ipn3ke_flow.c ++++ b/drivers/net/ipn3ke/ipn3ke_flow.c +@@ -1299,7 +1299,7 @@ int ipn3ke_flow_init(void *dev) + IPN3KE_AFU_PMD_DEBUG("IPN3KE_CLF_LKUP_ENABLE: %x\n", data); + + +- /* configure rx parse config, settings associatied with VxLAN */ ++ /* configure rx parse config, settings associated with VxLAN */ + IPN3KE_MASK_WRITE_REG(hw, + IPN3KE_CLF_RX_PARSE_CFG, + 0, +diff --git a/drivers/net/ipn3ke/ipn3ke_representor.c b/drivers/net/ipn3ke/ipn3ke_representor.c +index 8139e13a23..abbecfdf2e 100644 +--- a/drivers/net/ipn3ke/ipn3ke_representor.c ++++ b/drivers/net/ipn3ke/ipn3ke_representor.c +@@ -2279,7 +2279,7 @@ ipn3ke_rpst_xstats_get + count++; + } + +- /* Get individiual stats from ipn3ke_rpst_hw_port */ ++ /* Get individual stats from ipn3ke_rpst_hw_port */ + for (i = 0; i < IPN3KE_RPST_HW_PORT_XSTATS_CNT; i++) { + xstats[count].value = *(uint64_t *)(((char *)(&hw_stats)) + + ipn3ke_rpst_hw_port_strings[i].offset); +@@ -2287,7 +2287,7 @@ ipn3ke_rpst_xstats_get + count++; + } + +- /* Get individiual stats from ipn3ke_rpst_rxq_pri */ ++ /* Get individual stats from ipn3ke_rpst_rxq_pri */ + for (i = 0; i < IPN3KE_RPST_RXQ_PRIO_XSTATS_CNT; i++) { + for (prio = 0; prio < IPN3KE_RPST_PRIO_XSTATS_CNT; prio++) { + xstats[count].value = +@@ -2299,7 +2299,7 @@ ipn3ke_rpst_xstats_get + } + } + +- /* Get individiual stats from ipn3ke_rpst_txq_prio */ ++ /* Get individual stats from ipn3ke_rpst_txq_prio */ + for (i = 0; i < IPN3KE_RPST_TXQ_PRIO_XSTATS_CNT; i++) { + for (prio = 0; prio < IPN3KE_RPST_PRIO_XSTATS_CNT; prio++) { + xstats[count].value = +@@ -2337,7 +2337,7 @@ __rte_unused unsigned int limit) + count++; + } + +- /* Get individiual stats from ipn3ke_rpst_hw_port */ ++ /* Get individual stats from ipn3ke_rpst_hw_port */ + for (i = 0; i < IPN3KE_RPST_HW_PORT_XSTATS_CNT; i++) { + snprintf(xstats_names[count].name, + sizeof(xstats_names[count].name), +@@ -2346,7 +2346,7 @@ __rte_unused unsigned int limit) + count++; + } + +- /* Get individiual stats from ipn3ke_rpst_rxq_pri */ ++ /* Get individual stats from ipn3ke_rpst_rxq_pri */ + for (i = 0; i < IPN3KE_RPST_RXQ_PRIO_XSTATS_CNT; i++) { + for (prio = 0; prio < 8; prio++) { + snprintf(xstats_names[count].name, +@@ -2358,7 +2358,7 @@ __rte_unused unsigned int limit) + } + } + +- /* Get individiual stats from ipn3ke_rpst_txq_prio */ ++ /* Get individual stats from ipn3ke_rpst_txq_prio */ + for (i = 0; i < IPN3KE_RPST_TXQ_PRIO_XSTATS_CNT; i++) { + for (prio = 0; prio < 8; prio++) { + snprintf(xstats_names[count].name, +diff --git a/drivers/net/ipn3ke/meson.build b/drivers/net/ipn3ke/meson.build +index 4bf739809e..104d2f58e5 100644 +--- a/drivers/net/ipn3ke/meson.build ++++ b/drivers/net/ipn3ke/meson.build +@@ -8,7 +8,7 @@ if is_windows + endif + + # +-# Add the experimenatal APIs called from this PMD ++# Add the experimental APIs called from this PMD + # rte_eth_switch_domain_alloc() + # rte_eth_dev_create() + # rte_eth_dev_destroy() +diff --git a/drivers/net/ixgbe/ixgbe_bypass.c b/drivers/net/ixgbe/ixgbe_bypass.c +index 67ced6c723..94f34a2996 100644 +--- a/drivers/net/ixgbe/ixgbe_bypass.c ++++ b/drivers/net/ixgbe/ixgbe_bypass.c +@@ -11,7 +11,7 @@ + + #define BYPASS_STATUS_OFF_MASK 3 + +-/* Macros to check for invlaid function pointers. */ ++/* Macros to check for invalid function pointers. */ + #define FUNC_PTR_OR_ERR_RET(func, retval) do { \ + if ((func) == NULL) { \ + PMD_DRV_LOG(ERR, "%s:%d function not supported", \ +diff --git a/drivers/net/ixgbe/ixgbe_bypass_api.h b/drivers/net/ixgbe/ixgbe_bypass_api.h +index 8eb773391b..6ef965dbb6 100644 +--- a/drivers/net/ixgbe/ixgbe_bypass_api.h ++++ b/drivers/net/ixgbe/ixgbe_bypass_api.h +@@ -135,7 +135,7 @@ static s32 ixgbe_bypass_rw_generic(struct ixgbe_hw *hw, u32 cmd, u32 *status) + * ixgbe_bypass_valid_rd_generic - Verify valid return from bit-bang. + * + * If we send a write we can't be sure it took until we can read back +- * that same register. It can be a problem as some of the feilds may ++ * that same register. It can be a problem as some of the fields may + * for valid reasons change between the time wrote the register and + * we read it again to verify. So this function check everything we + * can check and then assumes it worked. +@@ -189,7 +189,7 @@ static bool ixgbe_bypass_valid_rd_generic(u32 in_reg, u32 out_reg) + } + + /** +- * ixgbe_bypass_set_generic - Set a bypass field in the FW CTRL Regiter. ++ * ixgbe_bypass_set_generic - Set a bypass field in the FW CTRL Register. + * + * @hw: pointer to hardware structure + * @cmd: The control word we are setting. +diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c +index fe61dba81d..c8f0460440 100644 +--- a/drivers/net/ixgbe/ixgbe_ethdev.c ++++ b/drivers/net/ixgbe/ixgbe_ethdev.c +@@ -2375,7 +2375,7 @@ ixgbe_dev_configure(struct rte_eth_dev *dev) + if (dev->data->dev_conf.rxmode.mq_mode & RTE_ETH_MQ_RX_RSS_FLAG) + dev->data->dev_conf.rxmode.offloads |= RTE_ETH_RX_OFFLOAD_RSS_HASH; + +- /* multipe queue mode checking */ ++ /* multiple queue mode checking */ + ret = ixgbe_check_mq_mode(dev); + if (ret != 0) { + PMD_DRV_LOG(ERR, "ixgbe_check_mq_mode fails with %d.", +@@ -2603,7 +2603,7 @@ ixgbe_dev_start(struct rte_eth_dev *dev) + } + } + +- /* confiugre msix for sleep until rx interrupt */ ++ /* configure MSI-X for sleep until Rx interrupt */ + ixgbe_configure_msix(dev); + + /* initialize transmission unit */ +@@ -2907,7 +2907,7 @@ ixgbe_dev_set_link_up(struct rte_eth_dev *dev) + if (hw->mac.type == ixgbe_mac_82599EB) { + #ifdef RTE_LIBRTE_IXGBE_BYPASS + if (hw->device_id == IXGBE_DEV_ID_82599_BYPASS) { +- /* Not suported in bypass mode */ ++ /* Not supported in bypass mode */ + PMD_INIT_LOG(ERR, "Set link up is not supported " + "by device id 0x%x", hw->device_id); + return -ENOTSUP; +@@ -2938,7 +2938,7 @@ ixgbe_dev_set_link_down(struct rte_eth_dev *dev) + if (hw->mac.type == ixgbe_mac_82599EB) { + #ifdef RTE_LIBRTE_IXGBE_BYPASS + if (hw->device_id == IXGBE_DEV_ID_82599_BYPASS) { +- /* Not suported in bypass mode */ ++ /* Not supported in bypass mode */ + PMD_INIT_LOG(ERR, "Set link down is not supported " + "by device id 0x%x", hw->device_id); + return -ENOTSUP; +@@ -4603,7 +4603,7 @@ ixgbe_dev_interrupt_action(struct rte_eth_dev *dev) + * @param handle + * Pointer to interrupt handle. + * @param param +- * The address of parameter (struct rte_eth_dev *) regsitered before. ++ * The address of parameter (struct rte_eth_dev *) registered before. + * + * @return + * void +@@ -4659,7 +4659,7 @@ ixgbe_dev_interrupt_delayed_handler(void *param) + * @param handle + * Pointer to interrupt handle. + * @param param +- * The address of parameter (struct rte_eth_dev *) regsitered before. ++ * The address of parameter (struct rte_eth_dev *) registered before. + * + * @return + * void +@@ -5921,7 +5921,7 @@ ixgbevf_configure_msix(struct rte_eth_dev *dev) + /* Configure all RX queues of VF */ + for (q_idx = 0; q_idx < dev->data->nb_rx_queues; q_idx++) { + /* Force all queue use vector 0, +- * as IXGBE_VF_MAXMSIVECOTR = 1 ++ * as IXGBE_VF_MAXMSIVECTOR = 1 + */ + ixgbevf_set_ivar_map(hw, 0, q_idx, vector_idx); + rte_intr_vec_list_index_set(intr_handle, q_idx, +@@ -6256,7 +6256,7 @@ ixgbe_inject_5tuple_filter(struct rte_eth_dev *dev, + * @param + * dev: Pointer to struct rte_eth_dev. + * index: the index the filter allocates. +- * filter: ponter to the filter that will be added. ++ * filter: pointer to the filter that will be added. + * rx_queue: the queue id the filter assigned to. + * + * @return +@@ -6872,7 +6872,7 @@ ixgbe_timesync_disable(struct rte_eth_dev *dev) + /* Disable L2 filtering of IEEE1588/802.1AS Ethernet frame types. */ + IXGBE_WRITE_REG(hw, IXGBE_ETQF(IXGBE_ETQF_FILTER_1588), 0); + +- /* Stop incrementating the System Time registers. */ ++ /* Stop incrementing the System Time registers. */ + IXGBE_WRITE_REG(hw, IXGBE_TIMINCA, 0); + + return 0; +diff --git a/drivers/net/ixgbe/ixgbe_ethdev.h b/drivers/net/ixgbe/ixgbe_ethdev.h +index 83e8b5e56a..69e0e82a5b 100644 +--- a/drivers/net/ixgbe/ixgbe_ethdev.h ++++ b/drivers/net/ixgbe/ixgbe_ethdev.h +@@ -68,7 +68,7 @@ + #define IXGBE_LPBK_NONE 0x0 /* Default value. Loopback is disabled. */ + #define IXGBE_LPBK_TX_RX 0x1 /* Tx->Rx loopback operation is enabled. */ + /* X540-X550 specific loopback operations */ +-#define IXGBE_MII_AUTONEG_ENABLE 0x1000 /* Auto-negociation enable (default = 1) */ ++#define IXGBE_MII_AUTONEG_ENABLE 0x1000 /* Auto-negotiation enable (default = 1) */ + + #define IXGBE_MAX_JUMBO_FRAME_SIZE 0x2600 /* Maximum Jumbo frame size. */ + +diff --git a/drivers/net/ixgbe/ixgbe_fdir.c b/drivers/net/ixgbe/ixgbe_fdir.c +index 7894047829..834c1b3f51 100644 +--- a/drivers/net/ixgbe/ixgbe_fdir.c ++++ b/drivers/net/ixgbe/ixgbe_fdir.c +@@ -390,7 +390,7 @@ fdir_set_input_mask_x550(struct rte_eth_dev *dev) + + switch (info->mask.tunnel_type_mask) { + case 0: +- /* Mask turnnel type */ ++ /* Mask tunnel type */ + fdiripv6m |= IXGBE_FDIRIP6M_TUNNEL_TYPE; + break; + case 1: +diff --git a/drivers/net/ixgbe/ixgbe_flow.c b/drivers/net/ixgbe/ixgbe_flow.c +index bdc9d4796c..368342872a 100644 +--- a/drivers/net/ixgbe/ixgbe_flow.c ++++ b/drivers/net/ixgbe/ixgbe_flow.c +@@ -135,7 +135,7 @@ const struct rte_flow_action *next_no_void_action( + } + + /** +- * Please aware there's an asumption for all the parsers. ++ * Please be aware there's an assumption for all the parsers. + * rte_flow_item is using big endian, rte_flow_attr and + * rte_flow_action are using CPU order. + * Because the pattern is used to describe the packets, +@@ -3261,7 +3261,7 @@ ixgbe_flow_create(struct rte_eth_dev *dev, + + /** + * Check if the flow rule is supported by ixgbe. +- * It only checkes the format. Don't guarantee the rule can be programmed into ++ * It only checks the format. Don't guarantee the rule can be programmed into + * the HW. Because there can be no enough room for the rule. + */ + static int +diff --git a/drivers/net/ixgbe/ixgbe_ipsec.c b/drivers/net/ixgbe/ixgbe_ipsec.c +index 944c9f2380..c353ae33b4 100644 +--- a/drivers/net/ixgbe/ixgbe_ipsec.c ++++ b/drivers/net/ixgbe/ixgbe_ipsec.c +@@ -310,7 +310,7 @@ ixgbe_crypto_remove_sa(struct rte_eth_dev *dev, + return -1; + } + +- /* Disable and clear Rx SPI and key table table entryes*/ ++ /* Disable and clear Rx SPI and key table table entries*/ + reg_val = IPSRXIDX_WRITE | IPSRXIDX_TABLE_SPI | (sa_index << 3); + IXGBE_WRITE_REG(hw, IXGBE_IPSRXSPI, 0); + IXGBE_WRITE_REG(hw, IXGBE_IPSRXIPIDX, 0); +diff --git a/drivers/net/ixgbe/ixgbe_pf.c b/drivers/net/ixgbe/ixgbe_pf.c +index 9f1bd0a62b..c73833b7ae 100644 +--- a/drivers/net/ixgbe/ixgbe_pf.c ++++ b/drivers/net/ixgbe/ixgbe_pf.c +@@ -242,7 +242,7 @@ int ixgbe_pf_host_configure(struct rte_eth_dev *eth_dev) + /* PFDMA Tx General Switch Control Enables VMDQ loopback */ + IXGBE_WRITE_REG(hw, IXGBE_PFDTXGSWC, IXGBE_PFDTXGSWC_VT_LBEN); + +- /* clear VMDq map to perment rar 0 */ ++ /* clear VMDq map to permanent rar 0 */ + hw->mac.ops.clear_vmdq(hw, 0, IXGBE_CLEAR_VMDQ_ALL); + + /* clear VMDq map to scan rar 127 */ +diff --git a/drivers/net/ixgbe/ixgbe_rxtx.c b/drivers/net/ixgbe/ixgbe_rxtx.c +index d7c80d4242..99e928a2a9 100644 +--- a/drivers/net/ixgbe/ixgbe_rxtx.c ++++ b/drivers/net/ixgbe/ixgbe_rxtx.c +@@ -1954,7 +1954,7 @@ ixgbe_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, + * register. + * Update the RDT with the value of the last processed RX descriptor + * minus 1, to guarantee that the RDT register is never equal to the +- * RDH register, which creates a "full" ring situtation from the ++ * RDH register, which creates a "full" ring situation from the + * hardware point of view... + */ + nb_hold = (uint16_t) (nb_hold + rxq->nb_rx_hold); +@@ -2303,7 +2303,7 @@ ixgbe_recv_pkts_lro(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts, + * register. + * Update the RDT with the value of the last processed RX descriptor + * minus 1, to guarantee that the RDT register is never equal to the +- * RDH register, which creates a "full" ring situtation from the ++ * RDH register, which creates a "full" ring situation from the + * hardware point of view... + */ + if (!bulk_alloc && nb_hold > rxq->rx_free_thresh) { +@@ -2666,7 +2666,7 @@ ixgbe_dev_tx_queue_setup(struct rte_eth_dev *dev, + */ + tx_free_thresh = (uint16_t)((tx_conf->tx_free_thresh) ? + tx_conf->tx_free_thresh : DEFAULT_TX_FREE_THRESH); +- /* force tx_rs_thresh to adapt an aggresive tx_free_thresh */ ++ /* force tx_rs_thresh to adapt an aggressive tx_free_thresh */ + tx_rs_thresh = (DEFAULT_TX_RS_THRESH + tx_free_thresh > nb_desc) ? + nb_desc - tx_free_thresh : DEFAULT_TX_RS_THRESH; + if (tx_conf->tx_rs_thresh > 0) +@@ -4831,7 +4831,7 @@ ixgbe_set_rx_function(struct rte_eth_dev *dev) + dev->data->port_id); + dev->rx_pkt_burst = ixgbe_recv_pkts_lro_bulk_alloc; + } else { +- PMD_INIT_LOG(DEBUG, "Using Regualr (non-vector, " ++ PMD_INIT_LOG(DEBUG, "Using Regular (non-vector, " + "single allocation) " + "Scattered Rx callback " + "(port=%d).", +@@ -5170,7 +5170,7 @@ ixgbe_dev_rx_init(struct rte_eth_dev *dev) + /* + * Setup the Checksum Register. + * Disable Full-Packet Checksum which is mutually exclusive with RSS. +- * Enable IP/L4 checkum computation by hardware if requested to do so. ++ * Enable IP/L4 checksum computation by hardware if requested to do so. + */ + rxcsum = IXGBE_READ_REG(hw, IXGBE_RXCSUM); + rxcsum |= IXGBE_RXCSUM_PCSD; +diff --git a/drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c b/drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c +index 1eed949495..c56f76b368 100644 +--- a/drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c ++++ b/drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c +@@ -562,7 +562,7 @@ _recv_raw_pkts_vec(struct ixgbe_rx_queue *rxq, struct rte_mbuf **rx_pkts, + + desc_to_ptype_v(descs, rxq->pkt_type_mask, &rx_pkts[pos]); + +- /* C.4 calc avaialbe number of desc */ ++ /* C.4 calc available number of desc */ + var = __builtin_popcountll(_mm_cvtsi128_si64(staterr)); + nb_pkts_recd += var; + if (likely(var != RTE_IXGBE_DESCS_PER_LOOP)) +diff --git a/drivers/net/memif/memif_socket.c b/drivers/net/memif/memif_socket.c +index 079cf01269..42f48a68a1 100644 +--- a/drivers/net/memif/memif_socket.c ++++ b/drivers/net/memif/memif_socket.c +@@ -726,7 +726,7 @@ memif_msg_receive(struct memif_control_channel *cc) + break; + case MEMIF_MSG_TYPE_INIT: + /* +- * This cc does not have an interface asociated with it. ++ * This cc does not have an interface associated with it. + * If suitable interface is found it will be assigned here. + */ + ret = memif_msg_receive_init(cc, &msg); +diff --git a/drivers/net/memif/rte_eth_memif.c b/drivers/net/memif/rte_eth_memif.c +index e3d523af57..59cb5a82a2 100644 +--- a/drivers/net/memif/rte_eth_memif.c ++++ b/drivers/net/memif/rte_eth_memif.c +@@ -1026,7 +1026,7 @@ memif_regions_init(struct rte_eth_dev *dev) + if (ret < 0) + return ret; + } else { +- /* create one memory region contaning rings and buffers */ ++ /* create one memory region containing rings and buffers */ + ret = memif_region_init_shm(dev, /* has buffers */ 1); + if (ret < 0) + return ret; +diff --git a/drivers/net/mlx4/mlx4.h b/drivers/net/mlx4/mlx4.h +index 2d0c512f79..4023a47602 100644 +--- a/drivers/net/mlx4/mlx4.h ++++ b/drivers/net/mlx4/mlx4.h +@@ -74,7 +74,7 @@ enum mlx4_mp_req_type { + MLX4_MP_REQ_STOP_RXTX, + }; + +-/* Pameters for IPC. */ ++/* Parameters for IPC. */ + struct mlx4_mp_param { + enum mlx4_mp_req_type type; + int port_id; +diff --git a/drivers/net/mlx4/mlx4_ethdev.c b/drivers/net/mlx4/mlx4_ethdev.c +index d606ec8ca7..ce74c51ce2 100644 +--- a/drivers/net/mlx4/mlx4_ethdev.c ++++ b/drivers/net/mlx4/mlx4_ethdev.c +@@ -752,7 +752,7 @@ mlx4_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats) + * Pointer to Ethernet device structure. + * + * @return +- * alwasy 0 on success ++ * always 0 on success + */ + int + mlx4_stats_reset(struct rte_eth_dev *dev) +diff --git a/drivers/net/mlx5/linux/mlx5_os.c b/drivers/net/mlx5/linux/mlx5_os.c +index c29fe3d92b..36f0fbf04a 100644 +--- a/drivers/net/mlx5/linux/mlx5_os.c ++++ b/drivers/net/mlx5/linux/mlx5_os.c +@@ -112,7 +112,7 @@ static struct mlx5_indexed_pool_config icfg[] = { + * Pointer to RQ channel object, which includes the channel fd + * + * @param[out] fd +- * The file descriptor (representing the intetrrupt) used in this channel. ++ * The file descriptor (representing the interrupt) used in this channel. + * + * @return + * 0 on successfully setting the fd to non-blocking, non-zero otherwise. +@@ -1743,7 +1743,7 @@ mlx5_dev_spawn(struct rte_device *dpdk_dev, + priv->drop_queue.hrxq = mlx5_drop_action_create(eth_dev); + if (!priv->drop_queue.hrxq) + goto error; +- /* Port representor shares the same max prioirity with pf port. */ ++ /* Port representor shares the same max priority with pf port. */ + if (!priv->sh->flow_priority_check_flag) { + /* Supported Verbs flow priority number detection. */ + err = mlx5_flow_discover_priorities(eth_dev); +@@ -2300,7 +2300,7 @@ mlx5_os_pci_probe_pf(struct mlx5_common_device *cdev, + /* + * Force standalone bonding + * device for ROCE LAG +- * confgiurations. ++ * configurations. + */ + list[ns].info.master = 0; + list[ns].info.representor = 0; +@@ -2637,7 +2637,7 @@ mlx5_os_pci_probe(struct mlx5_common_device *cdev) + } + if (ret) { + DRV_LOG(ERR, "Probe of PCI device " PCI_PRI_FMT " " +- "aborted due to proding failure of PF %u", ++ "aborted due to prodding failure of PF %u", + pci_dev->addr.domain, pci_dev->addr.bus, + pci_dev->addr.devid, pci_dev->addr.function, + eth_da.ports[p]); +diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c +index aa5f313c1a..8b4387d6b4 100644 +--- a/drivers/net/mlx5/mlx5.c ++++ b/drivers/net/mlx5/mlx5.c +@@ -1642,7 +1642,7 @@ mlx5_dev_close(struct rte_eth_dev *dev) + /* + * Free the shared context in last turn, because the cleanup + * routines above may use some shared fields, like +- * mlx5_os_mac_addr_flush() uses ibdev_path for retrieveing ++ * mlx5_os_mac_addr_flush() uses ibdev_path for retrieving + * ifindex if Netlink fails. + */ + mlx5_free_shared_dev_ctx(priv->sh); +@@ -1962,7 +1962,7 @@ mlx5_args_check(const char *key, const char *val, void *opaque) + if (tmp != MLX5_RCM_NONE && + tmp != MLX5_RCM_LIGHT && + tmp != MLX5_RCM_AGGR) { +- DRV_LOG(ERR, "Unrecognize %s: \"%s\"", key, val); ++ DRV_LOG(ERR, "Unrecognized %s: \"%s\"", key, val); + rte_errno = EINVAL; + return -rte_errno; + } +@@ -2177,17 +2177,17 @@ mlx5_set_metadata_mask(struct rte_eth_dev *dev) + break; + } + if (sh->dv_mark_mask && sh->dv_mark_mask != mark) +- DRV_LOG(WARNING, "metadata MARK mask mismatche %08X:%08X", ++ DRV_LOG(WARNING, "metadata MARK mask mismatch %08X:%08X", + sh->dv_mark_mask, mark); + else + sh->dv_mark_mask = mark; + if (sh->dv_meta_mask && sh->dv_meta_mask != meta) +- DRV_LOG(WARNING, "metadata META mask mismatche %08X:%08X", ++ DRV_LOG(WARNING, "metadata META mask mismatch %08X:%08X", + sh->dv_meta_mask, meta); + else + sh->dv_meta_mask = meta; + if (sh->dv_regc0_mask && sh->dv_regc0_mask != reg_c0) +- DRV_LOG(WARNING, "metadata reg_c0 mask mismatche %08X:%08X", ++ DRV_LOG(WARNING, "metadata reg_c0 mask mismatch %08X:%08X", + sh->dv_meta_mask, reg_c0); + else + sh->dv_regc0_mask = reg_c0; +diff --git a/drivers/net/mlx5/mlx5.h b/drivers/net/mlx5/mlx5.h +index 8466531060..b55f5816af 100644 +--- a/drivers/net/mlx5/mlx5.h ++++ b/drivers/net/mlx5/mlx5.h +@@ -977,7 +977,7 @@ struct mlx5_flow_id_pool { + uint32_t base_index; + /**< The next index that can be used without any free elements. */ + uint32_t *curr; /**< Pointer to the index to pop. */ +- uint32_t *last; /**< Pointer to the last element in the empty arrray. */ ++ uint32_t *last; /**< Pointer to the last element in the empty array. */ + uint32_t max_id; /**< Maximum id can be allocated from the pool. */ + }; + +@@ -1014,7 +1014,7 @@ struct mlx5_dev_txpp { + void *pp; /* Packet pacing context. */ + uint16_t pp_id; /* Packet pacing context index. */ + uint16_t ts_n; /* Number of captured timestamps. */ +- uint16_t ts_p; /* Pointer to statisticks timestamp. */ ++ uint16_t ts_p; /* Pointer to statistics timestamp. */ + struct mlx5_txpp_ts *tsa; /* Timestamps sliding window stats. */ + struct mlx5_txpp_ts ts; /* Cached completion id/timestamp. */ + uint32_t sync_lost:1; /* ci/timestamp synchronization lost. */ +@@ -1118,7 +1118,7 @@ struct mlx5_flex_parser_devx { + uint32_t sample_ids[MLX5_GRAPH_NODE_SAMPLE_NUM]; + }; + +-/* Pattern field dscriptor - how to translate flex pattern into samples. */ ++/* Pattern field descriptor - how to translate flex pattern into samples. */ + __extension__ + struct mlx5_flex_pattern_field { + uint16_t width:6; +@@ -1169,7 +1169,7 @@ struct mlx5_dev_ctx_shared { + /* Shared DV/DR flow data section. */ + uint32_t dv_meta_mask; /* flow META metadata supported mask. */ + uint32_t dv_mark_mask; /* flow MARK metadata supported mask. */ +- uint32_t dv_regc0_mask; /* available bits of metatada reg_c[0]. */ ++ uint32_t dv_regc0_mask; /* available bits of metadata reg_c[0]. */ + void *fdb_domain; /* FDB Direct Rules name space handle. */ + void *rx_domain; /* RX Direct Rules name space handle. */ + void *tx_domain; /* TX Direct Rules name space handle. */ +diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c +index f34e4b88aa..b7cf4143d5 100644 +--- a/drivers/net/mlx5/mlx5_flow.c ++++ b/drivers/net/mlx5/mlx5_flow.c +@@ -1206,7 +1206,7 @@ flow_rxq_tunnel_ptype_update(struct mlx5_rxq_ctrl *rxq_ctrl) + } + + /** +- * Set the Rx queue flags (Mark/Flag and Tunnel Ptypes) according to the devive ++ * Set the Rx queue flags (Mark/Flag and Tunnel Ptypes) according to the device + * flow. + * + * @param[in] dev +@@ -3008,7 +3008,7 @@ mlx5_flow_validate_item_geneve_opt(const struct rte_flow_item *item, + if ((uint32_t)spec->option_len > MLX5_GENEVE_OPTLEN_MASK) + return rte_flow_error_set + (error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ITEM, item, +- "Geneve TLV opt length exceeeds the limit (31)"); ++ "Geneve TLV opt length exceeds the limit (31)"); + /* Check if class type and length masks are full. */ + if (full_mask.option_class != mask->option_class || + full_mask.option_type != mask->option_type || +@@ -3957,7 +3957,7 @@ find_graph_root(uint32_t rss_level) + * subflow. + * + * @param[in] dev_flow +- * Pointer the created preifx subflow. ++ * Pointer the created prefix subflow. + * + * @return + * The layers get from prefix subflow. +@@ -4284,7 +4284,7 @@ flow_dv_mreg_create_cb(void *tool_ctx, void *cb_ctx) + [3] = { .type = RTE_FLOW_ACTION_TYPE_END, }, + }; + +- /* Fill the register fileds in the flow. */ ++ /* Fill the register fields in the flow. */ + ret = mlx5_flow_get_reg_id(dev, MLX5_FLOW_MARK, 0, error); + if (ret < 0) + return NULL; +@@ -4353,7 +4353,7 @@ flow_dv_mreg_create_cb(void *tool_ctx, void *cb_ctx) + /* + * The copy Flows are not included in any list. There + * ones are referenced from other Flows and can not +- * be applied, removed, deleted in ardbitrary order ++ * be applied, removed, deleted in arbitrary order + * by list traversing. + */ + mcp_res->rix_flow = flow_list_create(dev, MLX5_FLOW_TYPE_MCP, +@@ -4810,7 +4810,7 @@ flow_create_split_inner(struct rte_eth_dev *dev, + /* + * If dev_flow is as one of the suffix flow, some actions in suffix + * flow may need some user defined item layer flags, and pass the +- * Metadate rxq mark flag to suffix flow as well. ++ * Metadata rxq mark flag to suffix flow as well. + */ + if (flow_split_info->prefix_layers) + dev_flow->handle->layers = flow_split_info->prefix_layers; +@@ -5359,7 +5359,7 @@ flow_mreg_split_qrss_prep(struct rte_eth_dev *dev, + * @param[out] error + * Perform verbose error reporting if not NULL. + * @param[in] encap_idx +- * The encap action inndex. ++ * The encap action index. + * + * @return + * 0 on success, negative value otherwise +@@ -6884,7 +6884,7 @@ flow_list_destroy(struct rte_eth_dev *dev, enum mlx5_flow_type type, + * @param type + * Flow type to be flushed. + * @param active +- * If flushing is called avtively. ++ * If flushing is called actively. + */ + void + mlx5_flow_list_flush(struct rte_eth_dev *dev, enum mlx5_flow_type type, +@@ -8531,7 +8531,7 @@ mlx5_flow_dev_dump_sh_all(struct rte_eth_dev *dev, + * Perform verbose error reporting if not NULL. PMDs initialize this + * structure in case of error only. + * @return +- * 0 on success, a nagative value otherwise. ++ * 0 on success, a negative value otherwise. + */ + int + mlx5_flow_dev_dump(struct rte_eth_dev *dev, struct rte_flow *flow_idx, +@@ -9009,7 +9009,7 @@ mlx5_get_tof(const struct rte_flow_item *item, + } + + /** +- * tunnel offload functionalilty is defined for DV environment only ++ * tunnel offload functionality is defined for DV environment only + */ + #ifdef HAVE_IBV_FLOW_DV_SUPPORT + __extension__ +diff --git a/drivers/net/mlx5/mlx5_flow.h b/drivers/net/mlx5/mlx5_flow.h +index 1f54649c69..8c131d61ae 100644 +--- a/drivers/net/mlx5/mlx5_flow.h ++++ b/drivers/net/mlx5/mlx5_flow.h +@@ -598,7 +598,7 @@ struct mlx5_flow_tbl_data_entry { + const struct mlx5_flow_tunnel *tunnel; + uint32_t group_id; + uint32_t external:1; +- uint32_t tunnel_offload:1; /* Tunnel offlod table or not. */ ++ uint32_t tunnel_offload:1; /* Tunnel offload table or not. */ + uint32_t is_egress:1; /**< Egress table. */ + uint32_t is_transfer:1; /**< Transfer table. */ + uint32_t dummy:1; /**< DR table. */ +@@ -696,8 +696,8 @@ struct mlx5_flow_handle { + /**< Bit-fields of present layers, see MLX5_FLOW_LAYER_*. */ + void *drv_flow; /**< pointer to driver flow object. */ + uint32_t split_flow_id:27; /**< Sub flow unique match flow id. */ +- uint32_t is_meter_flow_id:1; /**< Indate if flow_id is for meter. */ +- uint32_t mark:1; /**< Metadate rxq mark flag. */ ++ uint32_t is_meter_flow_id:1; /**< Indicate if flow_id is for meter. */ ++ uint32_t mark:1; /**< Metadata rxq mark flag. */ + uint32_t fate_action:3; /**< Fate action type. */ + uint32_t flex_item; /**< referenced Flex Item bitmask. */ + union { +diff --git a/drivers/net/mlx5/mlx5_flow_dv.c b/drivers/net/mlx5/mlx5_flow_dv.c +index 3da122cbb9..8022d7d11f 100644 +--- a/drivers/net/mlx5/mlx5_flow_dv.c ++++ b/drivers/net/mlx5/mlx5_flow_dv.c +@@ -2032,7 +2032,7 @@ flow_dv_validate_item_meta(struct rte_eth_dev *dev __rte_unused, + if (reg == REG_NON) + return rte_flow_error_set(error, ENOTSUP, + RTE_FLOW_ERROR_TYPE_ITEM, item, +- "unavalable extended metadata register"); ++ "unavailable extended metadata register"); + if (reg == REG_B) + return rte_flow_error_set(error, ENOTSUP, + RTE_FLOW_ERROR_TYPE_ITEM, item, +@@ -3205,7 +3205,7 @@ flow_dv_validate_action_set_meta(struct rte_eth_dev *dev, + if (reg == REG_NON) + return rte_flow_error_set(error, ENOTSUP, + RTE_FLOW_ERROR_TYPE_ACTION, action, +- "unavalable extended metadata register"); ++ "unavailable extended metadata register"); + if (reg != REG_A && reg != REG_B) { + struct mlx5_priv *priv = dev->data->dev_private; + +@@ -5145,7 +5145,7 @@ flow_dv_modify_hdr_action_max(struct rte_eth_dev *dev __rte_unused, + * Pointer to error structure. + * + * @return +- * 0 on success, a negative errno value otherwise and rte_ernno is set. ++ * 0 on success, a negative errno value otherwise and rte_errno is set. + */ + static int + mlx5_flow_validate_action_meter(struct rte_eth_dev *dev, +@@ -7858,7 +7858,7 @@ flow_dv_validate(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, + * - Explicit decap action is prohibited by the tunnel offload API. + * - Drop action in tunnel steer rule is prohibited by the API. + * - Application cannot use MARK action because it's value can mask +- * tunnel default miss nitification. ++ * tunnel default miss notification. + * - JUMP in tunnel match rule has no support in current PMD + * implementation. + * - TAG & META are reserved for future uses. +@@ -9184,7 +9184,7 @@ flow_dev_geneve_tlv_option_resource_register(struct rte_eth_dev *dev, + geneve_opt_v->option_type && + geneve_opt_resource->length == + geneve_opt_v->option_len) { +- /* We already have GENVE TLV option obj allocated. */ ++ /* We already have GENEVE TLV option obj allocated. */ + __atomic_fetch_add(&geneve_opt_resource->refcnt, 1, + __ATOMIC_RELAXED); + } else { +@@ -10226,7 +10226,7 @@ __flow_dv_adjust_buf_size(size_t *size, uint8_t match_criteria) + * Check flow matching criteria first, subtract misc5/4 length if flow + * doesn't own misc5/4 parameters. In some old rdma-core releases, + * misc5/4 are not supported, and matcher creation failure is expected +- * w/o subtration. If misc5 is provided, misc4 must be counted in since ++ * w/o subtraction. If misc5 is provided, misc4 must be counted in since + * misc5 is right after misc4. + */ + if (!(match_criteria & (1 << MLX5_MATCH_CRITERIA_ENABLE_MISC5_BIT))) { +@@ -11425,7 +11425,7 @@ flow_dv_dest_array_create_cb(void *tool_ctx __rte_unused, void *cb_ctx) + goto error; + } + } +- /* create a dest array actioin */ ++ /* create a dest array action */ + ret = mlx5_os_flow_dr_create_flow_action_dest_array + (domain, + resource->num_of_dest, +diff --git a/drivers/net/mlx5/mlx5_flow_flex.c b/drivers/net/mlx5/mlx5_flow_flex.c +index 64867dc9e2..9413d4d817 100644 +--- a/drivers/net/mlx5/mlx5_flow_flex.c ++++ b/drivers/net/mlx5/mlx5_flow_flex.c +@@ -205,7 +205,7 @@ mlx5_flex_set_match_sample(void *misc4_m, void *misc4_v, + * @param dev + * Ethernet device to translate flex item on. + * @param[in, out] matcher +- * Flow matcher to confgiure ++ * Flow matcher to configure + * @param[in, out] key + * Flow matcher value. + * @param[in] item +@@ -457,7 +457,7 @@ mlx5_flex_translate_length(struct mlx5_hca_flex_attr *attr, + if (field->offset_shift > 15 || field->offset_shift < 0) + return rte_flow_error_set + (error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, NULL, +- "header length field shift exceeeds limit"); ++ "header length field shift exceeds limit"); + node->header_length_field_shift = field->offset_shift; + node->header_length_field_offset = field->offset_base; + } +diff --git a/drivers/net/mlx5/mlx5_flow_meter.c b/drivers/net/mlx5/mlx5_flow_meter.c +index f4a7b697e6..0e4e6ac3d5 100644 +--- a/drivers/net/mlx5/mlx5_flow_meter.c ++++ b/drivers/net/mlx5/mlx5_flow_meter.c +@@ -251,7 +251,7 @@ mlx5_flow_meter_xir_man_exp_calc(int64_t xir, uint8_t *man, uint8_t *exp) + uint8_t _exp = 0; + uint64_t m, e; + +- /* Special case xir == 0 ? both exp and matissa are 0. */ ++ /* Special case xir == 0 ? both exp and mantissa are 0. */ + if (xir == 0) { + *man = 0; + *exp = 0; +@@ -287,7 +287,7 @@ mlx5_flow_meter_xbs_man_exp_calc(uint64_t xbs, uint8_t *man, uint8_t *exp) + int _exp; + double _man; + +- /* Special case xbs == 0 ? both exp and matissa are 0. */ ++ /* Special case xbs == 0 ? both exp and mantissa are 0. */ + if (xbs == 0) { + *man = 0; + *exp = 0; +@@ -305,7 +305,7 @@ mlx5_flow_meter_xbs_man_exp_calc(uint64_t xbs, uint8_t *man, uint8_t *exp) + * Fill the prm meter parameter. + * + * @param[in,out] fmp +- * Pointer to meter profie to be converted. ++ * Pointer to meter profile to be converted. + * @param[out] error + * Pointer to the error structure. + * +@@ -1101,7 +1101,7 @@ mlx5_flow_meter_action_modify(struct mlx5_priv *priv, + if (ret) + return ret; + } +- /* Update succeedded modify meter parameters. */ ++ /* Update succeeded modify meter parameters. */ + if (modify_bits & MLX5_FLOW_METER_OBJ_MODIFY_FIELD_ACTIVE) + fm->active_state = !!active_state; + } +@@ -1615,7 +1615,7 @@ mlx5_flow_meter_profile_update(struct rte_eth_dev *dev, + return -rte_mtr_error_set(error, -ret, + RTE_MTR_ERROR_TYPE_MTR_PARAMS, + NULL, "Failed to update meter" +- " parmeters in hardware."); ++ " parameters in hardware."); + } + old_fmp->ref_cnt--; + fmp->ref_cnt++; +diff --git a/drivers/net/mlx5/mlx5_rx.c b/drivers/net/mlx5/mlx5_rx.c +index cc98cd1ea5..11214f6c41 100644 +--- a/drivers/net/mlx5/mlx5_rx.c ++++ b/drivers/net/mlx5/mlx5_rx.c +@@ -178,7 +178,7 @@ mlx5_rxq_info_get(struct rte_eth_dev *dev, uint16_t rx_queue_id, + * Pointer to the device structure. + * + * @param rx_queue_id +- * Rx queue identificatior. ++ * Rx queue identification. + * + * @param mode + * Pointer to the burts mode information. +diff --git a/drivers/net/mlx5/mlx5_rxq.c b/drivers/net/mlx5/mlx5_rxq.c +index f77d42dedf..be5f4da1e5 100644 +--- a/drivers/net/mlx5/mlx5_rxq.c ++++ b/drivers/net/mlx5/mlx5_rxq.c +@@ -2152,7 +2152,7 @@ mlx5_rxq_get_hairpin_conf(struct rte_eth_dev *dev, uint16_t idx) + * Number of queues in the array. + * + * @return +- * 1 if all queues in indirection table match 0 othrwise. ++ * 1 if all queues in indirection table match 0 otherwise. + */ + static int + mlx5_ind_table_obj_match_queues(const struct mlx5_ind_table_obj *ind_tbl, +@@ -2586,7 +2586,7 @@ mlx5_hrxq_modify(struct rte_eth_dev *dev, uint32_t hrxq_idx, + if (hrxq->standalone) { + /* + * Replacement of indirection table unsupported for +- * stanalone hrxq objects (used by shared RSS). ++ * standalone hrxq objects (used by shared RSS). + */ + rte_errno = ENOTSUP; + return -rte_errno; +diff --git a/drivers/net/mlx5/mlx5_rxtx_vec_altivec.h b/drivers/net/mlx5/mlx5_rxtx_vec_altivec.h +index 423e229508..f6e434c165 100644 +--- a/drivers/net/mlx5/mlx5_rxtx_vec_altivec.h ++++ b/drivers/net/mlx5/mlx5_rxtx_vec_altivec.h +@@ -1230,7 +1230,7 @@ rxq_cq_process_v(struct mlx5_rxq_data *rxq, volatile struct mlx5_cqe *cq, + uint32_t mask = rxq->flow_meta_port_mask; + uint32_t metadata; + +- /* This code is subject for futher optimization. */ ++ /* This code is subject for further optimization. */ + metadata = rte_be_to_cpu_32 + (cq[pos].flow_table_metadata) & mask; + *RTE_MBUF_DYNFIELD(pkts[pos], offs, uint32_t *) = +diff --git a/drivers/net/mlx5/mlx5_rxtx_vec_neon.h b/drivers/net/mlx5/mlx5_rxtx_vec_neon.h +index b1d16baa61..f7bbde4e0e 100644 +--- a/drivers/net/mlx5/mlx5_rxtx_vec_neon.h ++++ b/drivers/net/mlx5/mlx5_rxtx_vec_neon.h +@@ -839,7 +839,7 @@ rxq_cq_process_v(struct mlx5_rxq_data *rxq, volatile struct mlx5_cqe *cq, + } + } + if (rxq->dynf_meta) { +- /* This code is subject for futher optimization. */ ++ /* This code is subject for further optimization. */ + int32_t offs = rxq->flow_meta_offset; + uint32_t mask = rxq->flow_meta_port_mask; + +diff --git a/drivers/net/mlx5/mlx5_rxtx_vec_sse.h b/drivers/net/mlx5/mlx5_rxtx_vec_sse.h +index f3d838389e..185d2695db 100644 +--- a/drivers/net/mlx5/mlx5_rxtx_vec_sse.h ++++ b/drivers/net/mlx5/mlx5_rxtx_vec_sse.h +@@ -772,7 +772,7 @@ rxq_cq_process_v(struct mlx5_rxq_data *rxq, volatile struct mlx5_cqe *cq, + } + } + if (rxq->dynf_meta) { +- /* This code is subject for futher optimization. */ ++ /* This code is subject for further optimization. */ + int32_t offs = rxq->flow_meta_offset; + uint32_t mask = rxq->flow_meta_port_mask; + +diff --git a/drivers/net/mlx5/mlx5_tx.c b/drivers/net/mlx5/mlx5_tx.c +index 5492d64cae..fd2cf20967 100644 +--- a/drivers/net/mlx5/mlx5_tx.c ++++ b/drivers/net/mlx5/mlx5_tx.c +@@ -728,7 +728,7 @@ mlx5_txq_info_get(struct rte_eth_dev *dev, uint16_t tx_queue_id, + * Pointer to the device structure. + * + * @param tx_queue_id +- * Tx queue identificatior. ++ * Tx queue identification. + * + * @param mode + * Pointer to the burts mode information. +diff --git a/drivers/net/mlx5/mlx5_utils.h b/drivers/net/mlx5/mlx5_utils.h +index cf3db89403..e2dcbafc0a 100644 +--- a/drivers/net/mlx5/mlx5_utils.h ++++ b/drivers/net/mlx5/mlx5_utils.h +@@ -55,7 +55,7 @@ extern int mlx5_logtype; + + /* + * For the case which data is linked with sequence increased index, the +- * array table will be more efficiect than hash table once need to serarch ++ * array table will be more efficient than hash table once need to search + * one data entry in large numbers of entries. Since the traditional hash + * tables has fixed table size, when huge numbers of data saved to the hash + * table, it also comes lots of hash conflict. +diff --git a/drivers/net/mlx5/windows/mlx5_flow_os.c b/drivers/net/mlx5/windows/mlx5_flow_os.c +index c4d5790726..7bb4c4590a 100644 +--- a/drivers/net/mlx5/windows/mlx5_flow_os.c ++++ b/drivers/net/mlx5/windows/mlx5_flow_os.c +@@ -400,7 +400,7 @@ mlx5_flow_os_set_specific_workspace(struct mlx5_flow_workspace *data) + /* + * set_specific_workspace when current value is NULL + * can happen only once per thread, mark this thread in +- * linked list to be able to release reasorces later on. ++ * linked list to be able to release resources later on. + */ + err = mlx5_add_workspace_to_list(data); + if (err) { +diff --git a/drivers/net/mlx5/windows/mlx5_os.c b/drivers/net/mlx5/windows/mlx5_os.c +index dec4b923d0..f143724990 100644 +--- a/drivers/net/mlx5/windows/mlx5_os.c ++++ b/drivers/net/mlx5/windows/mlx5_os.c +@@ -226,7 +226,7 @@ mlx5_os_free_shared_dr(struct mlx5_priv *priv) + * Pointer to RQ channel object, which includes the channel fd + * + * @param[out] fd +- * The file descriptor (representing the intetrrupt) used in this channel. ++ * The file descriptor (representing the interrupt) used in this channel. + * + * @return + * 0 on successfully setting the fd to non-blocking, non-zero otherwise. +diff --git a/drivers/net/mvneta/mvneta_ethdev.c b/drivers/net/mvneta/mvneta_ethdev.c +index 10fe6d828c..eef016aa0b 100644 +--- a/drivers/net/mvneta/mvneta_ethdev.c ++++ b/drivers/net/mvneta/mvneta_ethdev.c +@@ -247,7 +247,7 @@ mvneta_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) + (mru + MRVL_NETA_PKT_OFFS > mbuf_data_size)) { + mru = mbuf_data_size - MRVL_NETA_PKT_OFFS; + mtu = MRVL_NETA_MRU_TO_MTU(mru); +- MVNETA_LOG(WARNING, "MTU too big, max MTU possible limitted by" ++ MVNETA_LOG(WARNING, "MTU too big, max MTU possible limited by" + " current mbuf size: %u. Set MTU to %u, MRU to %u", + mbuf_data_size, mtu, mru); + } +diff --git a/drivers/net/mvpp2/mrvl_ethdev.c b/drivers/net/mvpp2/mrvl_ethdev.c +index 2a8fb6cbce..735efb6cfc 100644 +--- a/drivers/net/mvpp2/mrvl_ethdev.c ++++ b/drivers/net/mvpp2/mrvl_ethdev.c +@@ -579,7 +579,7 @@ mrvl_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) + if (mru - RTE_ETHER_CRC_LEN + MRVL_PKT_OFFS > mbuf_data_size) { + mru = mbuf_data_size + RTE_ETHER_CRC_LEN - MRVL_PKT_OFFS; + mtu = MRVL_PP2_MRU_TO_MTU(mru); +- MRVL_LOG(WARNING, "MTU too big, max MTU possible limitted " ++ MRVL_LOG(WARNING, "MTU too big, max MTU possible limited " + "by current mbuf size: %u. Set MTU to %u, MRU to %u", + mbuf_data_size, mtu, mru); + } +diff --git a/drivers/net/mvpp2/mrvl_qos.c b/drivers/net/mvpp2/mrvl_qos.c +index dbfc3b5d20..99f0ee56d1 100644 +--- a/drivers/net/mvpp2/mrvl_qos.c ++++ b/drivers/net/mvpp2/mrvl_qos.c +@@ -301,7 +301,7 @@ get_entry_values(const char *entry, uint8_t *tab, + } + + /** +- * Parse Traffic Class'es mapping configuration. ++ * Parse Traffic Classes mapping configuration. + * + * @param file Config file handle. + * @param port Which port to look for. +@@ -736,7 +736,7 @@ mrvl_get_cfg(const char *key __rte_unused, const char *path, void *extra_args) + + /* MRVL_TOK_START_HDR replaces MRVL_TOK_DSA_MODE parameter. + * MRVL_TOK_DSA_MODE will be supported for backward +- * compatibillity. ++ * compatibility. + */ + entry = rte_cfgfile_get_entry(file, sec_name, + MRVL_TOK_START_HDR); +diff --git a/drivers/net/netvsc/hn_nvs.c b/drivers/net/netvsc/hn_nvs.c +index 89dbba6cd9..a29ac18ff4 100644 +--- a/drivers/net/netvsc/hn_nvs.c ++++ b/drivers/net/netvsc/hn_nvs.c +@@ -229,7 +229,7 @@ hn_nvs_conn_rxbuf(struct hn_data *hv) + hv->rxbuf_section_cnt = resp.nvs_sect[0].slotcnt; + + /* +- * Pimary queue's rxbuf_info is not allocated at creation time. ++ * Primary queue's rxbuf_info is not allocated at creation time. + * Now we can allocate it after we figure out the slotcnt. + */ + hv->primary->rxbuf_info = rte_calloc("HN_RXBUF_INFO", +diff --git a/drivers/net/netvsc/hn_rxtx.c b/drivers/net/netvsc/hn_rxtx.c +index 028f176c7e..50ca1710ef 100644 +--- a/drivers/net/netvsc/hn_rxtx.c ++++ b/drivers/net/netvsc/hn_rxtx.c +@@ -578,7 +578,7 @@ static void hn_rxpkt(struct hn_rx_queue *rxq, struct hn_rx_bufinfo *rxb, + rte_iova_t iova; + + /* +- * Build an external mbuf that points to recveive area. ++ * Build an external mbuf that points to receive area. + * Use refcount to handle multiple packets in same + * receive buffer section. + */ +@@ -1031,7 +1031,7 @@ hn_dev_rx_queue_count(void *rx_queue) + * returns: + * - -EINVAL - offset outside of ring + * - RTE_ETH_RX_DESC_AVAIL - no data available yet +- * - RTE_ETH_RX_DESC_DONE - data is waiting in stagin ring ++ * - RTE_ETH_RX_DESC_DONE - data is waiting in staging ring + */ + int hn_dev_rx_queue_status(void *arg, uint16_t offset) + { +diff --git a/drivers/net/netvsc/hn_vf.c b/drivers/net/netvsc/hn_vf.c +index fead8eba5d..ebb9c60147 100644 +--- a/drivers/net/netvsc/hn_vf.c ++++ b/drivers/net/netvsc/hn_vf.c +@@ -103,7 +103,7 @@ static void hn_remove_delayed(void *args) + struct rte_device *dev = rte_eth_devices[port_id].device; + int ret; + +- /* Tell VSP to switch data path to synthentic */ ++ /* Tell VSP to switch data path to synthetic */ + hn_vf_remove(hv); + + PMD_DRV_LOG(NOTICE, "Start to remove port %d", port_id); +diff --git a/drivers/net/nfp/nfpcore/nfp-common/nfp_resid.h b/drivers/net/nfp/nfpcore/nfp-common/nfp_resid.h +index 0e03948ec7..394a7628e0 100644 +--- a/drivers/net/nfp/nfpcore/nfp-common/nfp_resid.h ++++ b/drivers/net/nfp/nfpcore/nfp-common/nfp_resid.h +@@ -63,7 +63,7 @@ + * Wildcard indicating a CPP read or write action + * + * The action used will be either read or write depending on whether a read or +- * write instruction/call is performed on the NFP_CPP_ID. It is recomended that ++ * write instruction/call is performed on the NFP_CPP_ID. It is recommended that + * the RW action is used even if all actions to be performed on a NFP_CPP_ID are + * known to be only reads or writes. Doing so will in many cases save NFP CPP + * internal software resources. +@@ -405,7 +405,7 @@ int nfp_idstr2meid(int chip_family, const char *s, const char **endptr); + * @param chip_family Chip family ID + * @param s A string of format "iX.anything" or "iX" + * @param endptr If non-NULL, *endptr will point to the trailing +- * striong after the ME ID part of the string, which ++ * string after the ME ID part of the string, which + * is either an empty string or the first character + * after the separating period. + * @return The island ID on succes, -1 on error. +@@ -425,7 +425,7 @@ int nfp_idstr2island(int chip_family, const char *s, const char **endptr); + * @param chip_family Chip family ID + * @param s A string of format "meX.anything" or "meX" + * @param endptr If non-NULL, *endptr will point to the trailing +- * striong after the ME ID part of the string, which ++ * string after the ME ID part of the string, which + * is either an empty string or the first character + * after the separating period. + * @return The ME number on succes, -1 on error. +diff --git a/drivers/net/nfp/nfpcore/nfp_cppcore.c b/drivers/net/nfp/nfpcore/nfp_cppcore.c +index f91049383e..37799af558 100644 +--- a/drivers/net/nfp/nfpcore/nfp_cppcore.c ++++ b/drivers/net/nfp/nfpcore/nfp_cppcore.c +@@ -202,7 +202,7 @@ nfp_cpp_area_alloc(struct nfp_cpp *cpp, uint32_t dest, + * @address: start address on CPP target + * @size: size of area + * +- * Allocate and initilizae a CPP area structure, and lock it down so ++ * Allocate and initialize a CPP area structure, and lock it down so + * that it can be accessed directly. + * + * NOTE: @address and @size must be 32-bit aligned values. +diff --git a/drivers/net/nfp/nfpcore/nfp_nsp.h b/drivers/net/nfp/nfpcore/nfp_nsp.h +index c9c7b0d0fb..e74cdeb191 100644 +--- a/drivers/net/nfp/nfpcore/nfp_nsp.h ++++ b/drivers/net/nfp/nfpcore/nfp_nsp.h +@@ -272,7 +272,7 @@ int __nfp_eth_set_split(struct nfp_nsp *nsp, unsigned int lanes); + * @br_primary: branch id of primary bootloader + * @br_secondary: branch id of secondary bootloader + * @br_nsp: branch id of NSP +- * @primary: version of primarary bootloader ++ * @primary: version of primary bootloader + * @secondary: version id of secondary bootloader + * @nsp: version id of NSP + * @sensor_mask: mask of present sensors available on NIC +diff --git a/drivers/net/nfp/nfpcore/nfp_resource.c b/drivers/net/nfp/nfpcore/nfp_resource.c +index dd41fa4de4..7b5630fd86 100644 +--- a/drivers/net/nfp/nfpcore/nfp_resource.c ++++ b/drivers/net/nfp/nfpcore/nfp_resource.c +@@ -207,7 +207,7 @@ nfp_resource_acquire(struct nfp_cpp *cpp, const char *name) + * nfp_resource_release() - Release a NFP Resource handle + * @res: NFP Resource handle + * +- * NOTE: This function implictly unlocks the resource handle ++ * NOTE: This function implicitly unlocks the resource handle + */ + void + nfp_resource_release(struct nfp_resource *res) +diff --git a/drivers/net/nfp/nfpcore/nfp_rtsym.c b/drivers/net/nfp/nfpcore/nfp_rtsym.c +index cb7d83db51..2feca2ed81 100644 +--- a/drivers/net/nfp/nfpcore/nfp_rtsym.c ++++ b/drivers/net/nfp/nfpcore/nfp_rtsym.c +@@ -236,7 +236,7 @@ nfp_rtsym_lookup(struct nfp_rtsym_table *rtbl, const char *name) + * nfp_rtsym_read_le() - Read a simple unsigned scalar value from symbol + * @rtbl: NFP RTsym table + * @name: Symbol name +- * @error: Poniter to error code (optional) ++ * @error: Pointer to error code (optional) + * + * Lookup a symbol, map, read it and return it's value. Value of the symbol + * will be interpreted as a simple little-endian unsigned value. Symbol can +diff --git a/drivers/net/ngbe/ngbe_ethdev.c b/drivers/net/ngbe/ngbe_ethdev.c +index 981592f7f4..0d66c32551 100644 +--- a/drivers/net/ngbe/ngbe_ethdev.c ++++ b/drivers/net/ngbe/ngbe_ethdev.c +@@ -983,7 +983,7 @@ ngbe_dev_start(struct rte_eth_dev *dev) + } + } + +- /* confiugre MSI-X for sleep until Rx interrupt */ ++ /* configure MSI-X for sleep until Rx interrupt */ + ngbe_configure_msix(dev); + + /* initialize transmission unit */ +@@ -2641,7 +2641,7 @@ ngbe_set_ivar_map(struct ngbe_hw *hw, int8_t direction, + wr32(hw, NGBE_IVARMISC, tmp); + } else { + /* rx or tx causes */ +- /* Workround for ICR lost */ ++ /* Workaround for ICR lost */ + idx = ((16 * (queue & 1)) + (8 * direction)); + tmp = rd32(hw, NGBE_IVAR(queue >> 1)); + tmp &= ~(0xFF << idx); +@@ -2893,7 +2893,7 @@ ngbe_timesync_disable(struct rte_eth_dev *dev) + /* Disable L2 filtering of IEEE1588/802.1AS Ethernet frame types. */ + wr32(hw, NGBE_ETFLT(NGBE_ETF_ID_1588), 0); + +- /* Stop incrementating the System Time registers. */ ++ /* Stop incrementing the System Time registers. */ + wr32(hw, NGBE_TSTIMEINC, 0); + + return 0; +diff --git a/drivers/net/ngbe/ngbe_pf.c b/drivers/net/ngbe/ngbe_pf.c +index 7f9c04fb0e..12a18de31d 100644 +--- a/drivers/net/ngbe/ngbe_pf.c ++++ b/drivers/net/ngbe/ngbe_pf.c +@@ -163,7 +163,7 @@ int ngbe_pf_host_configure(struct rte_eth_dev *eth_dev) + + wr32(hw, NGBE_PSRCTL, NGBE_PSRCTL_LBENA); + +- /* clear VMDq map to perment rar 0 */ ++ /* clear VMDq map to permanent rar 0 */ + hw->mac.clear_vmdq(hw, 0, BIT_MASK32); + + /* clear VMDq map to scan rar 31 */ +diff --git a/drivers/net/octeontx/octeontx_ethdev.c b/drivers/net/octeontx/octeontx_ethdev.c +index 4f1e368c61..b47472ebbd 100644 +--- a/drivers/net/octeontx/octeontx_ethdev.c ++++ b/drivers/net/octeontx/octeontx_ethdev.c +@@ -1090,7 +1090,7 @@ octeontx_dev_rx_queue_setup(struct rte_eth_dev *dev, uint16_t qidx, + + /* Verify queue index */ + if (qidx >= dev->data->nb_rx_queues) { +- octeontx_log_err("QID %d not supporteded (0 - %d available)\n", ++ octeontx_log_err("QID %d not supported (0 - %d available)\n", + qidx, (dev->data->nb_rx_queues - 1)); + return -ENOTSUP; + } +diff --git a/drivers/net/octeontx2/otx2_ethdev_irq.c b/drivers/net/octeontx2/otx2_ethdev_irq.c +index cc573bb2e8..f56d5b2a38 100644 +--- a/drivers/net/octeontx2/otx2_ethdev_irq.c ++++ b/drivers/net/octeontx2/otx2_ethdev_irq.c +@@ -369,7 +369,7 @@ oxt2_nix_register_cq_irqs(struct rte_eth_dev *eth_dev) + "rc=%d", rc); + return rc; + } +- /* VFIO vector zero is resereved for misc interrupt so ++ /* VFIO vector zero is reserved for misc interrupt so + * doing required adjustment. (b13bfab4cd) + */ + if (rte_intr_vec_list_index_set(handle, q, +diff --git a/drivers/net/octeontx2/otx2_ptp.c b/drivers/net/octeontx2/otx2_ptp.c +index abb2130587..974018f97e 100644 +--- a/drivers/net/octeontx2/otx2_ptp.c ++++ b/drivers/net/octeontx2/otx2_ptp.c +@@ -440,7 +440,7 @@ otx2_nix_read_clock(struct rte_eth_dev *eth_dev, uint64_t *clock) + /* This API returns the raw PTP HI clock value. Since LFs doesn't + * have direct access to PTP registers and it requires mbox msg + * to AF for this value. In fastpath reading this value for every +- * packet (which involes mbox call) becomes very expensive, hence ++ * packet (which involves mbox call) becomes very expensive, hence + * we should be able to derive PTP HI clock value from tsc by + * using freq_mult and clk_delta calculated during configure stage. + */ +diff --git a/drivers/net/octeontx2/otx2_tx.h b/drivers/net/octeontx2/otx2_tx.h +index 4bbd5a390f..a2fb7ce3cb 100644 +--- a/drivers/net/octeontx2/otx2_tx.h ++++ b/drivers/net/octeontx2/otx2_tx.h +@@ -61,7 +61,7 @@ otx2_nix_xmit_prepare_tstamp(uint64_t *cmd, const uint64_t *send_mem_desc, + /* Retrieving the default desc values */ + cmd[off] = send_mem_desc[6]; + +- /* Using compiler barier to avoid voilation of C ++ /* Using compiler barrier to avoid violation of C + * aliasing rules. + */ + rte_compiler_barrier(); +@@ -70,7 +70,7 @@ otx2_nix_xmit_prepare_tstamp(uint64_t *cmd, const uint64_t *send_mem_desc, + /* Packets for which RTE_MBUF_F_TX_IEEE1588_TMST is not set, tx tstamp + * should not be recorded, hence changing the alg type to + * NIX_SENDMEMALG_SET and also changing send mem addr field to +- * next 8 bytes as it corrpt the actual tx tstamp registered ++ * next 8 bytes as it corrupts the actual tx tstamp registered + * address. + */ + send_mem->alg = NIX_SENDMEMALG_SETTSTMP - (is_ol_tstamp); +diff --git a/drivers/net/octeontx2/otx2_vlan.c b/drivers/net/octeontx2/otx2_vlan.c +index cce643b7b5..359680de5c 100644 +--- a/drivers/net/octeontx2/otx2_vlan.c ++++ b/drivers/net/octeontx2/otx2_vlan.c +@@ -953,7 +953,7 @@ static void nix_vlan_reinstall_vlan_filters(struct rte_eth_dev *eth_dev) + struct vlan_entry *entry; + int rc; + +- /* VLAN filters can't be set without setting filtern on */ ++ /* VLAN filters can't be set without setting filters on */ + rc = nix_vlan_handle_default_rx_entry(eth_dev, false, true, true); + if (rc) { + otx2_err("Failed to reinstall vlan filters"); +diff --git a/drivers/net/octeontx_ep/otx2_ep_vf.c b/drivers/net/octeontx_ep/otx2_ep_vf.c +index 0716beb9b1..85e14a998f 100644 +--- a/drivers/net/octeontx_ep/otx2_ep_vf.c ++++ b/drivers/net/octeontx_ep/otx2_ep_vf.c +@@ -104,7 +104,7 @@ otx2_vf_setup_iq_regs(struct otx_ep_device *otx_ep, uint32_t iq_no) + iq->inst_cnt_reg = (uint8_t *)otx_ep->hw_addr + + SDP_VF_R_IN_CNTS(iq_no); + +- otx_ep_dbg("InstQ[%d]:dbell reg @ 0x%p instcnt_reg @ 0x%p", ++ otx_ep_dbg("InstQ[%d]:dbell reg @ 0x%p inst_cnt_reg @ 0x%p", + iq_no, iq->doorbell_reg, iq->inst_cnt_reg); + + do { +diff --git a/drivers/net/octeontx_ep/otx_ep_vf.c b/drivers/net/octeontx_ep/otx_ep_vf.c +index c9b91fef9e..96366b2a7f 100644 +--- a/drivers/net/octeontx_ep/otx_ep_vf.c ++++ b/drivers/net/octeontx_ep/otx_ep_vf.c +@@ -117,7 +117,7 @@ otx_ep_setup_iq_regs(struct otx_ep_device *otx_ep, uint32_t iq_no) + iq->inst_cnt_reg = (uint8_t *)otx_ep->hw_addr + + OTX_EP_R_IN_CNTS(iq_no); + +- otx_ep_dbg("InstQ[%d]:dbell reg @ 0x%p instcnt_reg @ 0x%p\n", ++ otx_ep_dbg("InstQ[%d]:dbell reg @ 0x%p inst_cnt_reg @ 0x%p\n", + iq_no, iq->doorbell_reg, iq->inst_cnt_reg); + + do { +diff --git a/drivers/net/pfe/pfe_ethdev.c b/drivers/net/pfe/pfe_ethdev.c +index 047010e15e..ebb5d1ae0e 100644 +--- a/drivers/net/pfe/pfe_ethdev.c ++++ b/drivers/net/pfe/pfe_ethdev.c +@@ -769,7 +769,7 @@ pfe_eth_init(struct rte_vdev_device *vdev, struct pfe *pfe, int id) + if (eth_dev == NULL) + return -ENOMEM; + +- /* Extract pltform data */ ++ /* Extract platform data */ + pfe_info = (struct ls1012a_pfe_platform_data *)&pfe->platform_data; + if (!pfe_info) { + PFE_PMD_ERR("pfe missing additional platform data"); +diff --git a/drivers/net/pfe/pfe_hal.c b/drivers/net/pfe/pfe_hal.c +index 41d783dbff..6431dec47e 100644 +--- a/drivers/net/pfe/pfe_hal.c ++++ b/drivers/net/pfe/pfe_hal.c +@@ -187,7 +187,7 @@ gemac_set_mode(void *base, __rte_unused int mode) + { + u32 val = readl(base + EMAC_RCNTRL_REG); + +- /*Remove loopbank*/ ++ /* Remove loopback */ + val &= ~EMAC_RCNTRL_LOOP; + + /*Enable flow control and MII mode*/ +diff --git a/drivers/net/pfe/pfe_hif.c b/drivers/net/pfe/pfe_hif.c +index c4a7154ba7..69b1d0edde 100644 +--- a/drivers/net/pfe/pfe_hif.c ++++ b/drivers/net/pfe/pfe_hif.c +@@ -114,9 +114,9 @@ pfe_hif_init_buffers(struct pfe_hif *hif) + * results, eth id, queue id from PFE block along with data. + * so we have to provide additional memory for each packet to + * HIF rx rings so that PFE block can write its headers. +- * so, we are giving the data pointor to HIF rings whose ++ * so, we are giving the data pointer to HIF rings whose + * calculation is as below: +- * mbuf->data_pointor - Required_header_size ++ * mbuf->data_pointer - Required_header_size + * + * We are utilizing the HEADROOM area to receive the PFE + * block headers. On packet reception, HIF driver will use +diff --git a/drivers/net/pfe/pfe_hif.h b/drivers/net/pfe/pfe_hif.h +index 6aaf904bb1..e8d5ba10e1 100644 +--- a/drivers/net/pfe/pfe_hif.h ++++ b/drivers/net/pfe/pfe_hif.h +@@ -8,7 +8,7 @@ + #define HIF_CLIENT_QUEUES_MAX 16 + #define HIF_RX_PKT_MIN_SIZE RTE_CACHE_LINE_SIZE + /* +- * HIF_TX_DESC_NT value should be always greter than 4, ++ * HIF_TX_DESC_NT value should be always greater than 4, + * Otherwise HIF_TX_POLL_MARK will become zero. + */ + #define HIF_RX_DESC_NT 64 +diff --git a/drivers/net/pfe/pfe_hif_lib.c b/drivers/net/pfe/pfe_hif_lib.c +index 799050dce3..6fe6d33d23 100644 +--- a/drivers/net/pfe/pfe_hif_lib.c ++++ b/drivers/net/pfe/pfe_hif_lib.c +@@ -38,7 +38,7 @@ pfe_hif_shm_clean(struct hif_shm *hif_shm) + * This function should be called before initializing HIF driver. + * + * @param[in] hif_shm Shared memory address location in DDR +- * @rerurn 0 - on succes, <0 on fail to initialize ++ * @return 0 - on succes, <0 on fail to initialize + */ + int + pfe_hif_shm_init(struct hif_shm *hif_shm, struct rte_mempool *mb_pool) +@@ -109,9 +109,9 @@ hif_lib_client_release_rx_buffers(struct hif_client_s *client) + for (ii = 0; ii < client->rx_q[qno].size; ii++) { + buf = (void *)desc->data; + if (buf) { +- /* Data pointor to mbuf pointor calculation: ++ /* Data pointer to mbuf pointer calculation: + * "Data - User private data - headroom - mbufsize" +- * Actual data pointor given to HIF BDs was ++ * Actual data pointer given to HIF BDs was + * "mbuf->data_offset - PFE_PKT_HEADER_SZ" + */ + buf = buf + PFE_PKT_HEADER_SZ +@@ -477,7 +477,7 @@ hif_hdr_write(struct hif_hdr *pkt_hdr, unsigned int + client_id, unsigned int qno, + u32 client_ctrl) + { +- /* Optimize the write since the destinaton may be non-cacheable */ ++ /* Optimize the write since the destination may be non-cacheable */ + if (!((unsigned long)pkt_hdr & 0x3)) { + ((u32 *)pkt_hdr)[0] = (client_ctrl << 16) | (qno << 8) | + client_id; +diff --git a/drivers/net/qede/qede_debug.c b/drivers/net/qede/qede_debug.c +index 2297d245c4..af86bcc692 100644 +--- a/drivers/net/qede/qede_debug.c ++++ b/drivers/net/qede/qede_debug.c +@@ -5983,7 +5983,7 @@ static char *qed_get_buf_ptr(void *buf, u32 offset) + /* Reads a param from the specified buffer. Returns the number of dwords read. + * If the returned str_param is NULL, the param is numeric and its value is + * returned in num_param. +- * Otheriwise, the param is a string and its pointer is returned in str_param. ++ * Otherwise, the param is a string and its pointer is returned in str_param. + */ + static u32 qed_read_param(u32 *dump_buf, + const char **param_name, +@@ -7558,7 +7558,7 @@ static enum dbg_status format_feature(struct ecore_hwfn *p_hwfn, + text_buf[i] = '\n'; + + +- /* Free the old dump_buf and point the dump_buf to the newly allocagted ++ /* Free the old dump_buf and point the dump_buf to the newly allocated + * and formatted text buffer. + */ + OSAL_VFREE(p_hwfn, feature->dump_buf); +diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c +index 3e9aaeecd3..a1122a297e 100644 +--- a/drivers/net/qede/qede_ethdev.c ++++ b/drivers/net/qede/qede_ethdev.c +@@ -2338,7 +2338,7 @@ static int qede_set_mtu(struct rte_eth_dev *dev, uint16_t mtu) + if (fp->rxq != NULL) { + bufsz = (uint16_t)rte_pktmbuf_data_room_size( + fp->rxq->mb_pool) - RTE_PKTMBUF_HEADROOM; +- /* cache align the mbuf size to simplfy rx_buf_size ++ /* cache align the mbuf size to simplify rx_buf_size + * calculation + */ + bufsz = QEDE_FLOOR_TO_CACHE_LINE_SIZE(bufsz); +diff --git a/drivers/net/qede/qede_rxtx.c b/drivers/net/qede/qede_rxtx.c +index c0eeea896e..7088c57b50 100644 +--- a/drivers/net/qede/qede_rxtx.c ++++ b/drivers/net/qede/qede_rxtx.c +@@ -90,7 +90,7 @@ static inline int qede_alloc_rx_bulk_mbufs(struct qede_rx_queue *rxq, int count) + * (MTU + Maximum L2 Header Size + 2) / ETH_RX_MAX_BUFF_PER_PKT + * 3) In regular mode - minimum rx_buf_size should be + * (MTU + Maximum L2 Header Size + 2) +- * In above cases +2 corrosponds to 2 bytes padding in front of L2 ++ * In above cases +2 corresponds to 2 bytes padding in front of L2 + * header. + * 4) rx_buf_size should be cacheline-size aligned. So considering + * criteria 1, we need to adjust the size to floor instead of ceil, +@@ -106,7 +106,7 @@ qede_calc_rx_buf_size(struct rte_eth_dev *dev, uint16_t mbufsz, + + if (dev->data->scattered_rx) { + /* per HW limitation, only ETH_RX_MAX_BUFF_PER_PKT number of +- * bufferes can be used for single packet. So need to make sure ++ * buffers can be used for single packet. So need to make sure + * mbuf size is sufficient enough for this. + */ + if ((mbufsz * ETH_RX_MAX_BUFF_PER_PKT) < +@@ -247,7 +247,7 @@ qede_rx_queue_setup(struct rte_eth_dev *dev, uint16_t qid, + + /* Fix up RX buffer size */ + bufsz = (uint16_t)rte_pktmbuf_data_room_size(mp) - RTE_PKTMBUF_HEADROOM; +- /* cache align the mbuf size to simplfy rx_buf_size calculation */ ++ /* cache align the mbuf size to simplify rx_buf_size calculation */ + bufsz = QEDE_FLOOR_TO_CACHE_LINE_SIZE(bufsz); + if ((rxmode->offloads & RTE_ETH_RX_OFFLOAD_SCATTER) || + (max_rx_pktlen + QEDE_ETH_OVERHEAD) > bufsz) { +@@ -1745,7 +1745,7 @@ qede_recv_pkts_regular(void *p_rxq, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) + } + } + +- /* Request number of bufferes to be allocated in next loop */ ++ /* Request number of buffers to be allocated in next loop */ + rxq->rx_alloc_count = rx_alloc_count; + + rxq->rcv_pkts += rx_pkt; +@@ -2042,7 +2042,7 @@ qede_recv_pkts(void *p_rxq, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) + } + } + +- /* Request number of bufferes to be allocated in next loop */ ++ /* Request number of buffers to be allocated in next loop */ + rxq->rx_alloc_count = rx_alloc_count; + + rxq->rcv_pkts += rx_pkt; +@@ -2506,7 +2506,7 @@ qede_xmit_pkts(void *p_txq, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) + /* Inner L2 header size in two byte words */ + inner_l2_hdr_size = (mbuf->l2_len - + MPLSINUDP_HDR_SIZE) / 2; +- /* Inner L4 header offset from the beggining ++ /* Inner L4 header offset from the beginning + * of inner packet in two byte words + */ + inner_l4_hdr_offset = (mbuf->l2_len - +diff --git a/drivers/net/qede/qede_rxtx.h b/drivers/net/qede/qede_rxtx.h +index 754efe793f..11ed1d9b9c 100644 +--- a/drivers/net/qede/qede_rxtx.h ++++ b/drivers/net/qede/qede_rxtx.h +@@ -225,7 +225,7 @@ struct qede_fastpath { + struct qede_tx_queue *txq; + }; + +-/* This structure holds the inforation of fast path queues ++/* This structure holds the information of fast path queues + * belonging to individual engines in CMT mode. + */ + struct qede_fastpath_cmt { +diff --git a/drivers/net/sfc/sfc.c b/drivers/net/sfc/sfc.c +index ed714fe02f..2cead4e045 100644 +--- a/drivers/net/sfc/sfc.c ++++ b/drivers/net/sfc/sfc.c +@@ -371,7 +371,7 @@ sfc_set_drv_limits(struct sfc_adapter *sa) + + /* + * Limits are strict since take into account initial estimation. +- * Resource allocation stategy is described in ++ * Resource allocation strategy is described in + * sfc_estimate_resource_limits(). + */ + lim.edl_min_evq_count = lim.edl_max_evq_count = +diff --git a/drivers/net/sfc/sfc_dp.c b/drivers/net/sfc/sfc_dp.c +index d4cd162541..da2d1603cf 100644 +--- a/drivers/net/sfc/sfc_dp.c ++++ b/drivers/net/sfc/sfc_dp.c +@@ -68,7 +68,7 @@ sfc_dp_register(struct sfc_dp_list *head, struct sfc_dp *entry) + { + if (sfc_dp_find_by_name(head, entry->type, entry->name) != NULL) { + SFC_GENERIC_LOG(ERR, +- "sfc %s dapapath '%s' already registered", ++ "sfc %s datapath '%s' already registered", + entry->type == SFC_DP_RX ? "Rx" : + entry->type == SFC_DP_TX ? "Tx" : + "unknown", +diff --git a/drivers/net/sfc/sfc_dp_rx.h b/drivers/net/sfc/sfc_dp_rx.h +index 760540ba22..246adbd87c 100644 +--- a/drivers/net/sfc/sfc_dp_rx.h ++++ b/drivers/net/sfc/sfc_dp_rx.h +@@ -158,7 +158,7 @@ typedef int (sfc_dp_rx_qcreate_t)(uint16_t port_id, uint16_t queue_id, + struct sfc_dp_rxq **dp_rxqp); + + /** +- * Free resources allocated for datapath recevie queue. ++ * Free resources allocated for datapath receive queue. + */ + typedef void (sfc_dp_rx_qdestroy_t)(struct sfc_dp_rxq *dp_rxq); + +@@ -191,7 +191,7 @@ typedef bool (sfc_dp_rx_qrx_ps_ev_t)(struct sfc_dp_rxq *dp_rxq, + /** + * Receive queue purge function called after queue flush. + * +- * Should be used to free unused recevie buffers. ++ * Should be used to free unused receive buffers. + */ + typedef void (sfc_dp_rx_qpurge_t)(struct sfc_dp_rxq *dp_rxq); + +diff --git a/drivers/net/sfc/sfc_ef100.h b/drivers/net/sfc/sfc_ef100.h +index 5e2052d142..e81847e75a 100644 +--- a/drivers/net/sfc/sfc_ef100.h ++++ b/drivers/net/sfc/sfc_ef100.h +@@ -19,7 +19,7 @@ extern "C" { + * + * @param evq_prime Global address of the prime register + * @param evq_hw_index Event queue index +- * @param evq_read_ptr Masked event qeueu read pointer ++ * @param evq_read_ptr Masked event queue read pointer + */ + static inline void + sfc_ef100_evq_prime(volatile void *evq_prime, unsigned int evq_hw_index, +diff --git a/drivers/net/sfc/sfc_ef100_rx.c b/drivers/net/sfc/sfc_ef100_rx.c +index 5d16bf281d..45253ed7dc 100644 +--- a/drivers/net/sfc/sfc_ef100_rx.c ++++ b/drivers/net/sfc/sfc_ef100_rx.c +@@ -851,7 +851,7 @@ sfc_ef100_rx_qstart(struct sfc_dp_rxq *dp_rxq, unsigned int evq_read_ptr, + unsup_rx_prefix_fields = + efx_rx_prefix_layout_check(pinfo, &sfc_ef100_rx_prefix_layout); + +- /* LENGTH and CLASS filds must always be present */ ++ /* LENGTH and CLASS fields must always be present */ + if ((unsup_rx_prefix_fields & + ((1U << EFX_RX_PREFIX_FIELD_LENGTH) | + (1U << EFX_RX_PREFIX_FIELD_CLASS))) != 0) +diff --git a/drivers/net/sfc/sfc_ef10_essb_rx.c b/drivers/net/sfc/sfc_ef10_essb_rx.c +index 712c207617..78bd430363 100644 +--- a/drivers/net/sfc/sfc_ef10_essb_rx.c ++++ b/drivers/net/sfc/sfc_ef10_essb_rx.c +@@ -630,7 +630,7 @@ sfc_ef10_essb_rx_qcreate(uint16_t port_id, uint16_t queue_id, + rxq->block_size, rxq->buf_stride); + sfc_ef10_essb_rx_info(&rxq->dp.dpq, + "max fill level is %u descs (%u bufs), " +- "refill threashold %u descs (%u bufs)", ++ "refill threshold %u descs (%u bufs)", + rxq->max_fill_level, + rxq->max_fill_level * rxq->block_size, + rxq->refill_threshold, +diff --git a/drivers/net/sfc/sfc_ef10_rx_ev.h b/drivers/net/sfc/sfc_ef10_rx_ev.h +index 821e2227bb..412254e3d7 100644 +--- a/drivers/net/sfc/sfc_ef10_rx_ev.h ++++ b/drivers/net/sfc/sfc_ef10_rx_ev.h +@@ -40,7 +40,7 @@ sfc_ef10_rx_ev_to_offloads(const efx_qword_t rx_ev, struct rte_mbuf *m, + rte_cpu_to_le_64((1ull << ESF_DZ_RX_ECC_ERR_LBN) | + (1ull << ESF_DZ_RX_ECRC_ERR_LBN) | + (1ull << ESF_DZ_RX_PARSE_INCOMPLETE_LBN)))) { +- /* Zero packet type is used as a marker to dicard bad packets */ ++ /* Zero packet type is used as a marker to discard bad packets */ + goto done; + } + +diff --git a/drivers/net/sfc/sfc_intr.c b/drivers/net/sfc/sfc_intr.c +index ab67aa9237..ddddefad7b 100644 +--- a/drivers/net/sfc/sfc_intr.c ++++ b/drivers/net/sfc/sfc_intr.c +@@ -8,7 +8,7 @@ + */ + + /* +- * At the momemt of writing DPDK v16.07 has notion of two types of ++ * At the moment of writing DPDK v16.07 has notion of two types of + * interrupts: LSC (link status change) and RXQ (receive indication). + * It allows to register interrupt callback for entire device which is + * not intended to be used for receive indication (i.e. link status +diff --git a/drivers/net/sfc/sfc_rx.c b/drivers/net/sfc/sfc_rx.c +index 7104284106..cd58d60a36 100644 +--- a/drivers/net/sfc/sfc_rx.c ++++ b/drivers/net/sfc/sfc_rx.c +@@ -1057,7 +1057,7 @@ sfc_rx_mb_pool_buf_size(struct sfc_adapter *sa, struct rte_mempool *mb_pool) + /* Make sure that end padding does not write beyond the buffer */ + if (buf_aligned < nic_align_end) { + /* +- * Estimate space which can be lost. If guarnteed buffer ++ * Estimate space which can be lost. If guaranteed buffer + * size is odd, lost space is (nic_align_end - 1). More + * accurate formula is below. + */ +@@ -1702,7 +1702,7 @@ sfc_rx_fini_queues(struct sfc_adapter *sa, unsigned int nb_rx_queues) + + /* + * Finalize only ethdev queues since other ones are finalized only +- * on device close and they may require additional deinitializaton. ++ * on device close and they may require additional deinitialization. + */ + ethdev_qid = sas->ethdev_rxq_count; + while (--ethdev_qid >= (int)nb_rx_queues) { +@@ -1775,7 +1775,7 @@ sfc_rx_configure(struct sfc_adapter *sa) + + reconfigure = true; + +- /* Do not ununitialize reserved queues */ ++ /* Do not uninitialize reserved queues */ + if (nb_rx_queues < sas->ethdev_rxq_count) + sfc_rx_fini_queues(sa, nb_rx_queues); + +diff --git a/drivers/net/sfc/sfc_tx.c b/drivers/net/sfc/sfc_tx.c +index 0dccf21f7c..cd927cf2f7 100644 +--- a/drivers/net/sfc/sfc_tx.c ++++ b/drivers/net/sfc/sfc_tx.c +@@ -356,7 +356,7 @@ sfc_tx_fini_queues(struct sfc_adapter *sa, unsigned int nb_tx_queues) + + /* + * Finalize only ethdev queues since other ones are finalized only +- * on device close and they may require additional deinitializaton. ++ * on device close and they may require additional deinitialization. + */ + ethdev_qid = sas->ethdev_txq_count; + while (--ethdev_qid >= (int)nb_tx_queues) { +diff --git a/drivers/net/softnic/rte_eth_softnic_flow.c b/drivers/net/softnic/rte_eth_softnic_flow.c +index ca70eab678..ad96288e7e 100644 +--- a/drivers/net/softnic/rte_eth_softnic_flow.c ++++ b/drivers/net/softnic/rte_eth_softnic_flow.c +@@ -930,7 +930,7 @@ flow_rule_match_acl_get(struct pmd_internals *softnic __rte_unused, + * Both *tmask* and *fmask* are byte arrays of size *tsize* and *fsize* + * respectively. + * They are located within a larger buffer at offsets *toffset* and *foffset* +- * respectivelly. Both *tmask* and *fmask* represent bitmasks for the larger ++ * respectively. Both *tmask* and *fmask* represent bitmasks for the larger + * buffer. + * Question: are the two masks equivalent? + * +diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c +index ddca630574..6567e5891b 100644 +--- a/drivers/net/tap/rte_eth_tap.c ++++ b/drivers/net/tap/rte_eth_tap.c +@@ -525,7 +525,7 @@ tap_tx_l4_cksum(uint16_t *l4_cksum, uint16_t l4_phdr_cksum, + } + } + +-/* Accumaulate L4 raw checksums */ ++/* Accumulate L4 raw checksums */ + static void + tap_tx_l4_add_rcksum(char *l4_data, unsigned int l4_len, uint16_t *l4_cksum, + uint32_t *l4_raw_cksum) +diff --git a/drivers/net/tap/tap_bpf_api.c b/drivers/net/tap/tap_bpf_api.c +index 98f6a76011..15283f8917 100644 +--- a/drivers/net/tap/tap_bpf_api.c ++++ b/drivers/net/tap/tap_bpf_api.c +@@ -96,7 +96,7 @@ static inline int sys_bpf(enum bpf_cmd cmd, union bpf_attr *attr, + * Load BPF instructions to kernel + * + * @param[in] type +- * BPF program type: classifieir or action ++ * BPF program type: classifier or action + * + * @param[in] insns + * Array of BPF instructions (equivalent to BPF instructions) +@@ -104,7 +104,7 @@ static inline int sys_bpf(enum bpf_cmd cmd, union bpf_attr *attr, + * @param[in] insns_cnt + * Number of BPF instructions (size of array) + * +- * @param[in] lincense ++ * @param[in] license + * License string that must be acknowledged by the kernel + * + * @return +diff --git a/drivers/net/tap/tap_flow.c b/drivers/net/tap/tap_flow.c +index c4f60ce98e..7673823945 100644 +--- a/drivers/net/tap/tap_flow.c ++++ b/drivers/net/tap/tap_flow.c +@@ -961,7 +961,7 @@ add_action(struct rte_flow *flow, size_t *act_index, struct action_data *adata) + } + + /** +- * Helper function to send a serie of TC actions to the kernel ++ * Helper function to send a series of TC actions to the kernel + * + * @param[in] flow + * Pointer to rte flow containing the netlink message +@@ -2017,7 +2017,7 @@ static int bpf_rss_key(enum bpf_rss_key_e cmd, __u32 *key_idx) + break; + + /* +- * Subtract offest to restore real key index ++ * Subtract offset to restore real key index + * If a non RSS flow is falsely trying to release map + * entry 0 - the offset subtraction will calculate the real + * map index as an out-of-range value and the release operation +diff --git a/drivers/net/thunderx/nicvf_svf.c b/drivers/net/thunderx/nicvf_svf.c +index bccf290599..1bcf73d9fc 100644 +--- a/drivers/net/thunderx/nicvf_svf.c ++++ b/drivers/net/thunderx/nicvf_svf.c +@@ -21,7 +21,7 @@ nicvf_svf_push(struct nicvf *vf) + + entry = rte_zmalloc("nicvf", sizeof(*entry), RTE_CACHE_LINE_SIZE); + if (entry == NULL) +- rte_panic("Cannoc allocate memory for svf_entry\n"); ++ rte_panic("Cannot allocate memory for svf_entry\n"); + + entry->vf = vf; + +diff --git a/drivers/net/txgbe/txgbe_ethdev.c b/drivers/net/txgbe/txgbe_ethdev.c +index 47d0e6ea40..ac4d4e08f4 100644 +--- a/drivers/net/txgbe/txgbe_ethdev.c ++++ b/drivers/net/txgbe/txgbe_ethdev.c +@@ -1678,7 +1678,7 @@ txgbe_dev_start(struct rte_eth_dev *dev) + return -ENOMEM; + } + } +- /* confiugre msix for sleep until rx interrupt */ ++ /* configure msix for sleep until rx interrupt */ + txgbe_configure_msix(dev); + + /* initialize transmission unit */ +@@ -3682,7 +3682,7 @@ txgbe_set_ivar_map(struct txgbe_hw *hw, int8_t direction, + wr32(hw, TXGBE_IVARMISC, tmp); + } else { + /* rx or tx causes */ +- /* Workround for ICR lost */ ++ /* Workaround for ICR lost */ + idx = ((16 * (queue & 1)) + (8 * direction)); + tmp = rd32(hw, TXGBE_IVAR(queue >> 1)); + tmp &= ~(0xFF << idx); +@@ -4387,7 +4387,7 @@ txgbe_timesync_disable(struct rte_eth_dev *dev) + /* Disable L2 filtering of IEEE1588/802.1AS Ethernet frame types. */ + wr32(hw, TXGBE_ETFLT(TXGBE_ETF_ID_1588), 0); + +- /* Stop incrementating the System Time registers. */ ++ /* Stop incrementing the System Time registers. */ + wr32(hw, TXGBE_TSTIMEINC, 0); + + return 0; +diff --git a/drivers/net/txgbe/txgbe_ethdev_vf.c b/drivers/net/txgbe/txgbe_ethdev_vf.c +index 84b960b8f9..f52cd8bc19 100644 +--- a/drivers/net/txgbe/txgbe_ethdev_vf.c ++++ b/drivers/net/txgbe/txgbe_ethdev_vf.c +@@ -961,7 +961,7 @@ txgbevf_set_ivar_map(struct txgbe_hw *hw, int8_t direction, + wr32(hw, TXGBE_VFIVARMISC, tmp); + } else { + /* rx or tx cause */ +- /* Workround for ICR lost */ ++ /* Workaround for ICR lost */ + idx = ((16 * (queue & 1)) + (8 * direction)); + tmp = rd32(hw, TXGBE_VFIVAR(queue >> 1)); + tmp &= ~(0xFF << idx); +@@ -997,7 +997,7 @@ txgbevf_configure_msix(struct rte_eth_dev *dev) + /* Configure all RX queues of VF */ + for (q_idx = 0; q_idx < dev->data->nb_rx_queues; q_idx++) { + /* Force all queue use vector 0, +- * as TXGBE_VF_MAXMSIVECOTR = 1 ++ * as TXGBE_VF_MAXMSIVECTOR = 1 + */ + txgbevf_set_ivar_map(hw, 0, q_idx, vector_idx); + rte_intr_vec_list_index_set(intr_handle, q_idx, +@@ -1288,7 +1288,7 @@ txgbevf_dev_interrupt_get_status(struct rte_eth_dev *dev) + + /* only one misc vector supported - mailbox */ + eicr &= TXGBE_VFICR_MASK; +- /* Workround for ICR lost */ ++ /* Workaround for ICR lost */ + intr->flags |= TXGBE_FLAG_MAILBOX; + + /* To avoid compiler warnings set eicr to used. */ +diff --git a/drivers/net/txgbe/txgbe_ipsec.c b/drivers/net/txgbe/txgbe_ipsec.c +index 445733f3ba..3ca3d85ed5 100644 +--- a/drivers/net/txgbe/txgbe_ipsec.c ++++ b/drivers/net/txgbe/txgbe_ipsec.c +@@ -288,7 +288,7 @@ txgbe_crypto_remove_sa(struct rte_eth_dev *dev, + return -1; + } + +- /* Disable and clear Rx SPI and key table entryes*/ ++ /* Disable and clear Rx SPI and key table entries */ + reg_val = TXGBE_IPSRXIDX_WRITE | + TXGBE_IPSRXIDX_TB_SPI | (sa_index << 3); + wr32(hw, TXGBE_IPSRXSPI, 0); +diff --git a/drivers/net/txgbe/txgbe_pf.c b/drivers/net/txgbe/txgbe_pf.c +index 30be287330..67d92bfa56 100644 +--- a/drivers/net/txgbe/txgbe_pf.c ++++ b/drivers/net/txgbe/txgbe_pf.c +@@ -236,7 +236,7 @@ int txgbe_pf_host_configure(struct rte_eth_dev *eth_dev) + + wr32(hw, TXGBE_PSRCTL, TXGBE_PSRCTL_LBENA); + +- /* clear VMDq map to perment rar 0 */ ++ /* clear VMDq map to permanent rar 0 */ + hw->mac.clear_vmdq(hw, 0, BIT_MASK32); + + /* clear VMDq map to scan rar 127 */ +diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c +index c2588369b2..b317649d7e 100644 +--- a/drivers/net/virtio/virtio_ethdev.c ++++ b/drivers/net/virtio/virtio_ethdev.c +@@ -2657,7 +2657,7 @@ virtio_dev_configure(struct rte_eth_dev *dev) + hw->has_rx_offload = rx_offload_enabled(hw); + + if (dev->data->dev_flags & RTE_ETH_DEV_INTR_LSC) +- /* Enable vector (0) for Link State Intrerrupt */ ++ /* Enable vector (0) for Link State Interrupt */ + if (VIRTIO_OPS(hw)->set_config_irq(hw, 0) == + VIRTIO_MSI_NO_VECTOR) { + PMD_DRV_LOG(ERR, "failed to set config vector"); +@@ -2775,7 +2775,7 @@ virtio_dev_start(struct rte_eth_dev *dev) + } + } + +- /* Enable uio/vfio intr/eventfd mapping: althrough we already did that ++ /* Enable uio/vfio intr/eventfd mapping: although we already did that + * in device configure, but it could be unmapped when device is + * stopped. + */ +diff --git a/drivers/net/virtio/virtio_pci.c b/drivers/net/virtio/virtio_pci.c +index 182cfc9eae..632451dcbe 100644 +--- a/drivers/net/virtio/virtio_pci.c ++++ b/drivers/net/virtio/virtio_pci.c +@@ -235,7 +235,7 @@ legacy_get_isr(struct virtio_hw *hw) + return dst; + } + +-/* Enable one vector (0) for Link State Intrerrupt */ ++/* Enable one vector (0) for Link State Interrupt */ + static uint16_t + legacy_set_config_irq(struct virtio_hw *hw, uint16_t vec) + { +diff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio_rxtx.c +index 2e115ded02..b39dd92d1b 100644 +--- a/drivers/net/virtio/virtio_rxtx.c ++++ b/drivers/net/virtio/virtio_rxtx.c +@@ -962,7 +962,7 @@ virtio_rx_offload(struct rte_mbuf *m, struct virtio_net_hdr *hdr) + return -EINVAL; + } + +- /* Update mss lengthes in mbuf */ ++ /* Update mss lengths in mbuf */ + m->tso_segsz = hdr->gso_size; + switch (hdr->gso_type & ~VIRTIO_NET_HDR_GSO_ECN) { + case VIRTIO_NET_HDR_GSO_TCPV4: +diff --git a/drivers/net/virtio/virtio_rxtx_packed_avx.h b/drivers/net/virtio/virtio_rxtx_packed_avx.h +index 8cb71f3fe6..584ac72f95 100644 +--- a/drivers/net/virtio/virtio_rxtx_packed_avx.h ++++ b/drivers/net/virtio/virtio_rxtx_packed_avx.h +@@ -192,7 +192,7 @@ virtqueue_dequeue_batch_packed_vec(struct virtnet_rx *rxvq, + + /* + * load len from desc, store into mbuf pkt_len and data_len +- * len limiated by l6bit buf_len, pkt_len[16:31] can be ignored ++ * len limited by l6bit buf_len, pkt_len[16:31] can be ignored + */ + const __mmask16 mask = 0x6 | 0x6 << 4 | 0x6 << 8 | 0x6 << 12; + __m512i values = _mm512_maskz_shuffle_epi32(mask, v_desc, 0xAA); +diff --git a/drivers/net/virtio/virtqueue.c b/drivers/net/virtio/virtqueue.c +index 65bf792eb0..c98d696e62 100644 +--- a/drivers/net/virtio/virtqueue.c ++++ b/drivers/net/virtio/virtqueue.c +@@ -13,7 +13,7 @@ + /* + * Two types of mbuf to be cleaned: + * 1) mbuf that has been consumed by backend but not used by virtio. +- * 2) mbuf that hasn't been consued by backend. ++ * 2) mbuf that hasn't been consumed by backend. + */ + struct rte_mbuf * + virtqueue_detach_unused(struct virtqueue *vq) +diff --git a/drivers/net/virtio/virtqueue.h b/drivers/net/virtio/virtqueue.h +index 855f57a956..99c68cf622 100644 +--- a/drivers/net/virtio/virtqueue.h ++++ b/drivers/net/virtio/virtqueue.h +@@ -227,7 +227,7 @@ struct virtio_net_ctrl_rss { + * Control link announce acknowledgement + * + * The command VIRTIO_NET_CTRL_ANNOUNCE_ACK is used to indicate that +- * driver has recevied the notification; device would clear the ++ * driver has received the notification; device would clear the + * VIRTIO_NET_S_ANNOUNCE bit in the status field after it receives + * this command. + */ +@@ -312,7 +312,7 @@ struct virtqueue { + struct vq_desc_extra vq_descx[0]; + }; + +-/* If multiqueue is provided by host, then we suppport it. */ ++/* If multiqueue is provided by host, then we support it. */ + #define VIRTIO_NET_CTRL_MQ 4 + + #define VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET 0 +diff --git a/drivers/raw/dpaa2_qdma/dpaa2_qdma.c b/drivers/raw/dpaa2_qdma/dpaa2_qdma.c +index de26d2aef3..ebc2cd5d0d 100644 +--- a/drivers/raw/dpaa2_qdma/dpaa2_qdma.c ++++ b/drivers/raw/dpaa2_qdma/dpaa2_qdma.c +@@ -653,7 +653,7 @@ dpdmai_dev_dequeue_multijob_prefetch( + rte_prefetch0((void *)(size_t)(dq_storage + 1)); + + /* Prepare next pull descriptor. This will give space for the +- * prefething done on DQRR entries ++ * prefetching done on DQRR entries + */ + q_storage->toggle ^= 1; + dq_storage1 = q_storage->dq_storage[q_storage->toggle]; +diff --git a/drivers/raw/dpaa2_qdma/dpaa2_qdma.h b/drivers/raw/dpaa2_qdma/dpaa2_qdma.h +index d6f6bb5522..1973d5d2b2 100644 +--- a/drivers/raw/dpaa2_qdma/dpaa2_qdma.h ++++ b/drivers/raw/dpaa2_qdma/dpaa2_qdma.h +@@ -82,7 +82,7 @@ struct qdma_device { + /** total number of hw queues. */ + uint16_t num_hw_queues; + /** +- * Maximum number of hw queues to be alocated per core. ++ * Maximum number of hw queues to be allocated per core. + * This is limited by MAX_HW_QUEUE_PER_CORE + */ + uint16_t max_hw_queues_per_core; +@@ -268,7 +268,7 @@ struct dpaa2_dpdmai_dev { + struct fsl_mc_io dpdmai; + /** HW ID for DPDMAI object */ + uint32_t dpdmai_id; +- /** Tocken of this device */ ++ /** Token of this device */ + uint16_t token; + /** Number of queue in this DPDMAI device */ + uint8_t num_queues; +diff --git a/drivers/raw/ifpga/ifpga_rawdev.c b/drivers/raw/ifpga/ifpga_rawdev.c +index 8d9db585a4..0eae0c9477 100644 +--- a/drivers/raw/ifpga/ifpga_rawdev.c ++++ b/drivers/raw/ifpga/ifpga_rawdev.c +@@ -382,7 +382,7 @@ ifpga_monitor_sensor(struct rte_rawdev *raw_dev, + + if (HIGH_WARN(sensor, value) || + LOW_WARN(sensor, value)) { +- IFPGA_RAWDEV_PMD_INFO("%s reach theshold %d\n", ++ IFPGA_RAWDEV_PMD_INFO("%s reach threshold %d\n", + sensor->name, value); + *gsd_start = true; + break; +@@ -393,7 +393,7 @@ ifpga_monitor_sensor(struct rte_rawdev *raw_dev, + if (!strcmp(sensor->name, "12V AUX Voltage")) { + if (value < AUX_VOLTAGE_WARN) { + IFPGA_RAWDEV_PMD_INFO( +- "%s reach theshold %d mV\n", ++ "%s reach threshold %d mV\n", + sensor->name, value); + *gsd_start = true; + break; +@@ -441,12 +441,12 @@ static int set_surprise_link_check_aer( + pos = ifpga_pci_find_ext_capability(fd, RTE_PCI_EXT_CAP_ID_ERR); + if (!pos) + goto end; +- /* save previout ECAP_AER+0x08 */ ++ /* save previous ECAP_AER+0x08 */ + ret = pread(fd, &data, sizeof(data), pos+0x08); + if (ret == -1) + goto end; + ifpga_rdev->aer_old[0] = data; +- /* save previout ECAP_AER+0x14 */ ++ /* save previous ECAP_AER+0x14 */ + ret = pread(fd, &data, sizeof(data), pos+0x14); + if (ret == -1) + goto end; +@@ -531,7 +531,7 @@ ifpga_monitor_start_func(void) + ifpga_rawdev_gsd_handle, NULL); + if (ret != 0) { + IFPGA_RAWDEV_PMD_ERR( +- "Fail to create ifpga nonitor thread"); ++ "Fail to create ifpga monitor thread"); + return -1; + } + ifpga_monitor_start = 1; +diff --git a/drivers/raw/ntb/ntb.h b/drivers/raw/ntb/ntb.h +index cdf7667d5d..c9ff33aa59 100644 +--- a/drivers/raw/ntb/ntb.h ++++ b/drivers/raw/ntb/ntb.h +@@ -95,7 +95,7 @@ enum ntb_spad_idx { + * @spad_write: Write val to local/peer spad register. + * @db_read: Read doorbells status. + * @db_clear: Clear local doorbells. +- * @db_set_mask: Set bits in db mask, preventing db interrpts generated ++ * @db_set_mask: Set bits in db mask, preventing db interrupts generated + * for those db bits. + * @peer_db_set: Set doorbell bit to generate peer interrupt for that bit. + * @vector_bind: Bind vector source [intr] to msix vector [msix]. +diff --git a/drivers/vdpa/mlx5/mlx5_vdpa_mem.c b/drivers/vdpa/mlx5/mlx5_vdpa_mem.c +index b1b9053bff..130d201a85 100644 +--- a/drivers/vdpa/mlx5/mlx5_vdpa_mem.c ++++ b/drivers/vdpa/mlx5/mlx5_vdpa_mem.c +@@ -160,7 +160,7 @@ mlx5_vdpa_vhost_mem_regions_prepare(int vid, uint8_t *mode, uint64_t *mem_size, + * The target here is to group all the physical memory regions of the + * virtio device in one indirect mkey. + * For KLM Fixed Buffer Size mode (HW find the translation entry in one +- * read according to the guest phisical address): ++ * read according to the guest physical address): + * All the sub-direct mkeys of it must be in the same size, hence, each + * one of them should be in the GCD size of all the virtio memory + * regions and the holes between them. +diff --git a/drivers/vdpa/mlx5/mlx5_vdpa_virtq.c b/drivers/vdpa/mlx5/mlx5_vdpa_virtq.c +index db971bad48..2f32aef67f 100644 +--- a/drivers/vdpa/mlx5/mlx5_vdpa_virtq.c ++++ b/drivers/vdpa/mlx5/mlx5_vdpa_virtq.c +@@ -403,7 +403,7 @@ mlx5_vdpa_features_validate(struct mlx5_vdpa_priv *priv) + if (priv->features & (1ULL << VIRTIO_F_RING_PACKED)) { + if (!(priv->caps.virtio_queue_type & (1 << + MLX5_VIRTQ_TYPE_PACKED))) { +- DRV_LOG(ERR, "Failed to configur PACKED mode for vdev " ++ DRV_LOG(ERR, "Failed to configure PACKED mode for vdev " + "%d - it was not reported by HW/driver" + " capability.", priv->vid); + return -ENOTSUP; +diff --git a/examples/bbdev_app/main.c b/examples/bbdev_app/main.c +index ecafc5e4f1..fc7e8b8174 100644 +--- a/examples/bbdev_app/main.c ++++ b/examples/bbdev_app/main.c +@@ -372,7 +372,7 @@ add_awgn(struct rte_mbuf **mbufs, uint16_t num_pkts) + /* Encoder output to Decoder input adapter. The Decoder accepts only soft input + * so each bit of the encoder output must be translated into one byte of LLR. If + * Sub-block Deinterleaver is bypassed, which is the case, the padding bytes +- * must additionally be insterted at the end of each sub-block. ++ * must additionally be inserted at the end of each sub-block. + */ + static inline void + transform_enc_out_dec_in(struct rte_mbuf **mbufs, uint8_t *temp_buf, +diff --git a/examples/bond/main.c b/examples/bond/main.c +index 1087b0dad1..335bde5c8d 100644 +--- a/examples/bond/main.c ++++ b/examples/bond/main.c +@@ -230,7 +230,7 @@ bond_port_init(struct rte_mempool *mbuf_pool) + 0 /*SOCKET_ID_ANY*/); + if (retval < 0) + rte_exit(EXIT_FAILURE, +- "Faled to create bond port\n"); ++ "Failed to create bond port\n"); + + BOND_PORT = retval; + +@@ -405,7 +405,7 @@ static int lcore_main(__rte_unused void *arg1) + struct rte_ether_hdr *); + ether_type = eth_hdr->ether_type; + if (ether_type == rte_cpu_to_be_16(RTE_ETHER_TYPE_VLAN)) +- printf("VLAN taged frame, offset:"); ++ printf("VLAN tagged frame, offset:"); + offset = get_vlan_offset(eth_hdr, ðer_type); + if (offset > 0) + printf("%d\n", offset); +diff --git a/examples/dma/dmafwd.c b/examples/dma/dmafwd.c +index b06042e5fe..9fc46f5255 100644 +--- a/examples/dma/dmafwd.c ++++ b/examples/dma/dmafwd.c +@@ -88,7 +88,7 @@ static uint16_t nb_queues = 1; + /* MAC updating enabled by default. */ + static int mac_updating = 1; + +-/* hardare copy mode enabled by default. */ ++/* hardware copy mode enabled by default. */ + static copy_mode_t copy_mode = COPY_MODE_DMA_NUM; + + /* size of descriptor ring for hardware copy mode or +diff --git a/examples/ethtool/lib/rte_ethtool.c b/examples/ethtool/lib/rte_ethtool.c +index 86286d38a6..ffaad96498 100644 +--- a/examples/ethtool/lib/rte_ethtool.c ++++ b/examples/ethtool/lib/rte_ethtool.c +@@ -402,7 +402,7 @@ rte_ethtool_net_set_rx_mode(uint16_t port_id) + #endif + } + +- /* Enable Rx vlan filter, VF unspport status is discard */ ++ /* Enable Rx vlan filter, VF unsupported status is discard */ + ret = rte_eth_dev_set_vlan_offload(port_id, RTE_ETH_VLAN_FILTER_MASK); + if (ret != 0) + return ret; +diff --git a/examples/ethtool/lib/rte_ethtool.h b/examples/ethtool/lib/rte_ethtool.h +index f177096636..d27e0102b1 100644 +--- a/examples/ethtool/lib/rte_ethtool.h ++++ b/examples/ethtool/lib/rte_ethtool.h +@@ -189,7 +189,7 @@ int rte_ethtool_get_module_eeprom(uint16_t port_id, + + /** + * Retrieve the Ethernet device pause frame configuration according to +- * parameter attributes desribed by ethtool data structure, ++ * parameter attributes described by ethtool data structure, + * ethtool_pauseparam. + * + * @param port_id +@@ -209,7 +209,7 @@ int rte_ethtool_get_pauseparam(uint16_t port_id, + + /** + * Setting the Ethernet device pause frame configuration according to +- * parameter attributes desribed by ethtool data structure, ethtool_pauseparam. ++ * parameter attributes described by ethtool data structure, ethtool_pauseparam. + * + * @param port_id + * The port identifier of the Ethernet device. +diff --git a/examples/ip_reassembly/main.c b/examples/ip_reassembly/main.c +index fb3cac3bd0..6e4c11c3c7 100644 +--- a/examples/ip_reassembly/main.c ++++ b/examples/ip_reassembly/main.c +@@ -244,7 +244,7 @@ static struct rte_lpm6 *socket_lpm6[RTE_MAX_NUMA_NODES]; + #endif /* RTE_LIBRTE_IP_FRAG_TBL_STAT */ + + /* +- * If number of queued packets reached given threahold, then ++ * If number of queued packets reached given threshold, then + * send burst of packets on an output interface. + */ + static inline uint32_t +@@ -873,11 +873,11 @@ setup_queue_tbl(struct rx_queue *rxq, uint32_t lcore, uint32_t queue) + + /* + * At any given moment up to +- * mbufs could be stored int the fragment table. ++ * mbufs could be stored in the fragment table. + * Plus, each TX queue can hold up to packets. + */ + +- /* mbufs stored int the gragment table. 8< */ ++ /* mbufs stored in the fragment table. 8< */ + nb_mbuf = RTE_MAX(max_flow_num, 2UL * MAX_PKT_BURST) * MAX_FRAG_NUM; + nb_mbuf *= (port_conf.rxmode.mtu + RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN + + BUF_SIZE - 1) / BUF_SIZE; +@@ -895,7 +895,7 @@ setup_queue_tbl(struct rx_queue *rxq, uint32_t lcore, uint32_t queue) + "rte_pktmbuf_pool_create(%s) failed", buf); + return -1; + } +- /* >8 End of mbufs stored int the fragmentation table. */ ++ /* >8 End of mbufs stored in the fragmentation table. */ + + return 0; + } +diff --git a/examples/ipsec-secgw/event_helper.c b/examples/ipsec-secgw/event_helper.c +index e8600f5e90..24b210add4 100644 +--- a/examples/ipsec-secgw/event_helper.c ++++ b/examples/ipsec-secgw/event_helper.c +@@ -1353,7 +1353,7 @@ eh_display_rx_adapter_conf(struct eventmode_conf *em_conf) + for (i = 0; i < nb_rx_adapter; i++) { + adapter = &(em_conf->rx_adapter[i]); + sprintf(print_buf, +- "\tRx adaper ID: %-2d\tConnections: %-2d\tEvent dev ID: %-2d", ++ "\tRx adapter ID: %-2d\tConnections: %-2d\tEvent dev ID: %-2d", + adapter->adapter_id, + adapter->nb_connections, + adapter->eventdev_id); +diff --git a/examples/ipsec-secgw/ipsec-secgw.c b/examples/ipsec-secgw/ipsec-secgw.c +index bf3dbf6b5c..96916cd3c5 100644 +--- a/examples/ipsec-secgw/ipsec-secgw.c ++++ b/examples/ipsec-secgw/ipsec-secgw.c +@@ -265,7 +265,7 @@ struct socket_ctx socket_ctx[NB_SOCKETS]; + /* + * Determine is multi-segment support required: + * - either frame buffer size is smaller then mtu +- * - or reassmeble support is requested ++ * - or reassemble support is requested + */ + static int + multi_seg_required(void) +@@ -2050,7 +2050,7 @@ add_mapping(struct rte_hash *map, const char *str, uint16_t cdev_id, + + ret = rte_hash_add_key_data(map, &key, (void *)i); + if (ret < 0) { +- printf("Faled to insert cdev mapping for (lcore %u, " ++ printf("Failed to insert cdev mapping for (lcore %u, " + "cdev %u, qp %u), errno %d\n", + key.lcore_id, ipsec_ctx->tbl[i].id, + ipsec_ctx->tbl[i].qp, ret); +@@ -2083,7 +2083,7 @@ add_cdev_mapping(struct rte_cryptodev_info *dev_info, uint16_t cdev_id, + str = "Inbound"; + } + +- /* Required cryptodevs with operation chainning */ ++ /* Required cryptodevs with operation chaining */ + if (!(dev_info->feature_flags & + RTE_CRYPTODEV_FF_SYM_OPERATION_CHAINING)) + return ret; +@@ -2251,7 +2251,7 @@ port_init(uint16_t portid, uint64_t req_rx_offloads, uint64_t req_tx_offloads) + "Error during getting device (port %u) info: %s\n", + portid, strerror(-ret)); + +- /* limit allowed HW offloafs, as user requested */ ++ /* limit allowed HW offloads, as user requested */ + dev_info.rx_offload_capa &= dev_rx_offload; + dev_info.tx_offload_capa &= dev_tx_offload; + +@@ -2298,7 +2298,7 @@ port_init(uint16_t portid, uint64_t req_rx_offloads, uint64_t req_tx_offloads) + local_port_conf.rxmode.offloads) + rte_exit(EXIT_FAILURE, + "Error: port %u required RX offloads: 0x%" PRIx64 +- ", avaialbe RX offloads: 0x%" PRIx64 "\n", ++ ", available RX offloads: 0x%" PRIx64 "\n", + portid, local_port_conf.rxmode.offloads, + dev_info.rx_offload_capa); + +@@ -2306,7 +2306,7 @@ port_init(uint16_t portid, uint64_t req_rx_offloads, uint64_t req_tx_offloads) + local_port_conf.txmode.offloads) + rte_exit(EXIT_FAILURE, + "Error: port %u required TX offloads: 0x%" PRIx64 +- ", avaialbe TX offloads: 0x%" PRIx64 "\n", ++ ", available TX offloads: 0x%" PRIx64 "\n", + portid, local_port_conf.txmode.offloads, + dev_info.tx_offload_capa); + +@@ -2317,7 +2317,7 @@ port_init(uint16_t portid, uint64_t req_rx_offloads, uint64_t req_tx_offloads) + if (dev_info.tx_offload_capa & RTE_ETH_TX_OFFLOAD_IPV4_CKSUM) + local_port_conf.txmode.offloads |= RTE_ETH_TX_OFFLOAD_IPV4_CKSUM; + +- printf("port %u configurng rx_offloads=0x%" PRIx64 ++ printf("port %u configuring rx_offloads=0x%" PRIx64 + ", tx_offloads=0x%" PRIx64 "\n", + portid, local_port_conf.rxmode.offloads, + local_port_conf.txmode.offloads); +diff --git a/examples/ipsec-secgw/sa.c b/examples/ipsec-secgw/sa.c +index 30bc693e06..1839ac71af 100644 +--- a/examples/ipsec-secgw/sa.c ++++ b/examples/ipsec-secgw/sa.c +@@ -897,7 +897,7 @@ parse_sa_tokens(char **tokens, uint32_t n_tokens, + continue; + } + +- /* unrecognizeable input */ ++ /* unrecognizable input */ + APP_CHECK(0, status, "unrecognized input \"%s\"", + tokens[ti]); + return; +@@ -1145,7 +1145,7 @@ get_spi_proto(uint32_t spi, enum rte_security_ipsec_sa_direction dir, + if (rc4 >= 0) { + if (rc6 >= 0) { + RTE_LOG(ERR, IPSEC, +- "%s: SPI %u used simultaeously by " ++ "%s: SPI %u used simultaneously by " + "IPv4(%d) and IPv6 (%d) SP rules\n", + __func__, spi, rc4, rc6); + return -EINVAL; +@@ -1550,7 +1550,7 @@ ipsec_sa_init(struct ipsec_sa *lsa, struct rte_ipsec_sa *sa, uint32_t sa_size) + } + + /* +- * Allocate space and init rte_ipsec_sa strcutures, ++ * Allocate space and init rte_ipsec_sa structures, + * one per session. + */ + static int +diff --git a/examples/ipsec-secgw/sp4.c b/examples/ipsec-secgw/sp4.c +index beddd7bc1d..fc4101a4a2 100644 +--- a/examples/ipsec-secgw/sp4.c ++++ b/examples/ipsec-secgw/sp4.c +@@ -410,7 +410,7 @@ parse_sp4_tokens(char **tokens, uint32_t n_tokens, + continue; + } + +- /* unrecognizeable input */ ++ /* unrecognizable input */ + APP_CHECK(0, status, "unrecognized input \"%s\"", + tokens[ti]); + return; +diff --git a/examples/ipsec-secgw/sp6.c b/examples/ipsec-secgw/sp6.c +index 328e085288..cce4da7862 100644 +--- a/examples/ipsec-secgw/sp6.c ++++ b/examples/ipsec-secgw/sp6.c +@@ -515,7 +515,7 @@ parse_sp6_tokens(char **tokens, uint32_t n_tokens, + continue; + } + +- /* unrecognizeable input */ ++ /* unrecognizable input */ + APP_CHECK(0, status, "unrecognized input \"%s\"", + tokens[ti]); + return; +diff --git a/examples/ipsec-secgw/test/common_defs.sh b/examples/ipsec-secgw/test/common_defs.sh +index f22eb3ab12..3ef06bc761 100644 +--- a/examples/ipsec-secgw/test/common_defs.sh ++++ b/examples/ipsec-secgw/test/common_defs.sh +@@ -20,7 +20,7 @@ REMOTE_MAC=`ssh ${REMOTE_HOST} ip addr show dev ${REMOTE_IFACE}` + st=$? + REMOTE_MAC=`echo ${REMOTE_MAC} | sed -e 's/^.*ether //' -e 's/ brd.*$//'` + if [[ $st -ne 0 || -z "${REMOTE_MAC}" ]]; then +- echo "coouldn't retrieve ether addr from ${REMOTE_IFACE}" ++ echo "couldn't retrieve ether addr from ${REMOTE_IFACE}" + exit 127 + fi + +@@ -40,7 +40,7 @@ DPDK_VARS="" + + # by default ipsec-secgw can't deal with multi-segment packets + # make sure our local/remote host wouldn't generate fragmented packets +-# if reassmebly option is not enabled ++# if reassembly option is not enabled + DEF_MTU_LEN=1400 + DEF_PING_LEN=1200 + +diff --git a/examples/kni/main.c b/examples/kni/main.c +index d324ee2241..f5b20a7b62 100644 +--- a/examples/kni/main.c ++++ b/examples/kni/main.c +@@ -1039,7 +1039,7 @@ main(int argc, char** argv) + pthread_t kni_link_tid; + int pid; + +- /* Associate signal_hanlder function with USR signals */ ++ /* Associate signal_handler function with USR signals */ + signal(SIGUSR1, signal_handler); + signal(SIGUSR2, signal_handler); + signal(SIGRTMIN, signal_handler); +diff --git a/examples/l2fwd-cat/l2fwd-cat.c b/examples/l2fwd-cat/l2fwd-cat.c +index d9cf00c9df..6e16705e99 100644 +--- a/examples/l2fwd-cat/l2fwd-cat.c ++++ b/examples/l2fwd-cat/l2fwd-cat.c +@@ -157,7 +157,7 @@ main(int argc, char *argv[]) + int ret = rte_eal_init(argc, argv); + if (ret < 0) + rte_exit(EXIT_FAILURE, "Error with EAL initialization\n"); +- /* >8 End of initializion the Environment Abstraction Layer (EAL). */ ++ /* >8 End of initialization the Environment Abstraction Layer (EAL). */ + + argc -= ret; + argv += ret; +diff --git a/examples/l2fwd-event/l2fwd_event_generic.c b/examples/l2fwd-event/l2fwd_event_generic.c +index f31569a744..1977e23261 100644 +--- a/examples/l2fwd-event/l2fwd_event_generic.c ++++ b/examples/l2fwd-event/l2fwd_event_generic.c +@@ -42,7 +42,7 @@ l2fwd_event_device_setup_generic(struct l2fwd_resources *rsrc) + ethdev_count++; + } + +- /* Event device configurtion */ ++ /* Event device configuration */ + rte_event_dev_info_get(event_d_id, &dev_info); + + /* Enable implicit release */ +diff --git a/examples/l2fwd-event/l2fwd_event_internal_port.c b/examples/l2fwd-event/l2fwd_event_internal_port.c +index 86d772d817..717a7bceb8 100644 +--- a/examples/l2fwd-event/l2fwd_event_internal_port.c ++++ b/examples/l2fwd-event/l2fwd_event_internal_port.c +@@ -40,7 +40,7 @@ l2fwd_event_device_setup_internal_port(struct l2fwd_resources *rsrc) + ethdev_count++; + } + +- /* Event device configurtion */ ++ /* Event device configuration */ + rte_event_dev_info_get(event_d_id, &dev_info); + + /* Enable implicit release */ +diff --git a/examples/l2fwd-jobstats/main.c b/examples/l2fwd-jobstats/main.c +index d8eabe4c86..9e71ba2d4e 100644 +--- a/examples/l2fwd-jobstats/main.c ++++ b/examples/l2fwd-jobstats/main.c +@@ -468,7 +468,7 @@ l2fwd_flush_job(__rte_unused struct rte_timer *timer, __rte_unused void *arg) + qconf->next_flush_time[portid] = rte_get_timer_cycles() + drain_tsc; + } + +- /* Pass target to indicate that this job is happy of time interwal ++ /* Pass target to indicate that this job is happy of time interval + * in which it was called. */ + rte_jobstats_finish(&qconf->flush_job, qconf->flush_job.target); + } +diff --git a/examples/l3fwd-acl/main.c b/examples/l3fwd-acl/main.c +index 1fb1807235..2d2ecc7635 100644 +--- a/examples/l3fwd-acl/main.c ++++ b/examples/l3fwd-acl/main.c +@@ -801,8 +801,8 @@ send_packets(struct rte_mbuf **m, uint32_t *res, int num) + } + + /* +- * Parses IPV6 address, exepcts the following format: +- * XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX (where X - is a hexedecimal digit). ++ * Parse IPv6 address, expects the following format: ++ * XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX:XXXX (where X is a hexadecimal digit). + */ + static int + parse_ipv6_addr(const char *in, const char **end, uint32_t v[IPV6_ADDR_U32], +@@ -1959,7 +1959,7 @@ check_all_ports_link_status(uint32_t port_mask) + } + + /* +- * build-up default vaues for dest MACs. ++ * build-up default values for dest MACs. + */ + static void + set_default_dest_mac(void) +diff --git a/examples/l3fwd-power/main.c b/examples/l3fwd-power/main.c +index b8b3be2b8a..20e5b59af9 100644 +--- a/examples/l3fwd-power/main.c ++++ b/examples/l3fwd-power/main.c +@@ -433,7 +433,7 @@ signal_exit_now(int sigtype) + + } + +-/* Freqency scale down timer callback */ ++/* Frequency scale down timer callback */ + static void + power_timer_cb(__rte_unused struct rte_timer *tim, + __rte_unused void *arg) +@@ -2358,7 +2358,7 @@ update_telemetry(__rte_unused struct rte_timer *tim, + ret = rte_metrics_update_values(RTE_METRICS_GLOBAL, telstats_index, + values, RTE_DIM(values)); + if (ret < 0) +- RTE_LOG(WARNING, POWER, "failed to update metrcis\n"); ++ RTE_LOG(WARNING, POWER, "failed to update metrics\n"); + } + + static int +diff --git a/examples/l3fwd/l3fwd_common.h b/examples/l3fwd/l3fwd_common.h +index 7d83ff641a..cbaab79f5b 100644 +--- a/examples/l3fwd/l3fwd_common.h ++++ b/examples/l3fwd/l3fwd_common.h +@@ -51,7 +51,7 @@ rfc1812_process(struct rte_ipv4_hdr *ipv4_hdr, uint16_t *dp, uint32_t ptype) + #endif /* DO_RFC_1812_CHECKS */ + + /* +- * We group consecutive packets with the same destionation port into one burst. ++ * We group consecutive packets with the same destination port into one burst. + * To avoid extra latency this is done together with some other packet + * processing, but after we made a final decision about packet's destination. + * To do this we maintain: +@@ -76,7 +76,7 @@ rfc1812_process(struct rte_ipv4_hdr *ipv4_hdr, uint16_t *dp, uint32_t ptype) + + static const struct { + uint64_t pnum; /* prebuild 4 values for pnum[]. */ +- int32_t idx; /* index for new last updated elemnet. */ ++ int32_t idx; /* index for new last updated element. */ + uint16_t lpv; /* add value to the last updated element. */ + } gptbl[GRPSZ] = { + { +diff --git a/examples/l3fwd/l3fwd_neon.h b/examples/l3fwd/l3fwd_neon.h +index 86ac5971d7..e3d33a5229 100644 +--- a/examples/l3fwd/l3fwd_neon.h ++++ b/examples/l3fwd/l3fwd_neon.h +@@ -64,7 +64,7 @@ processx4_step3(struct rte_mbuf *pkt[FWDSTEP], uint16_t dst_port[FWDSTEP]) + + /* + * Group consecutive packets with the same destination port in bursts of 4. +- * Suppose we have array of destionation ports: ++ * Suppose we have array of destination ports: + * dst_port[] = {a, b, c, d,, e, ... } + * dp1 should contain: , dp2: . + * We doing 4 comparisons at once and the result is 4 bit mask. +diff --git a/examples/l3fwd/l3fwd_sse.h b/examples/l3fwd/l3fwd_sse.h +index bb565ed546..d5a717e18c 100644 +--- a/examples/l3fwd/l3fwd_sse.h ++++ b/examples/l3fwd/l3fwd_sse.h +@@ -64,7 +64,7 @@ processx4_step3(struct rte_mbuf *pkt[FWDSTEP], uint16_t dst_port[FWDSTEP]) + + /* + * Group consecutive packets with the same destination port in bursts of 4. +- * Suppose we have array of destionation ports: ++ * Suppose we have array of destination ports: + * dst_port[] = {a, b, c, d,, e, ... } + * dp1 should contain: , dp2: . + * We doing 4 comparisons at once and the result is 4 bit mask. +diff --git a/examples/multi_process/hotplug_mp/commands.c b/examples/multi_process/hotplug_mp/commands.c +index 48fd329583..41ea265e45 100644 +--- a/examples/multi_process/hotplug_mp/commands.c ++++ b/examples/multi_process/hotplug_mp/commands.c +@@ -175,7 +175,7 @@ static void cmd_dev_detach_parsed(void *parsed_result, + cmdline_printf(cl, "detached device %s\n", + da.name); + else +- cmdline_printf(cl, "failed to dettach device %s\n", ++ cmdline_printf(cl, "failed to detach device %s\n", + da.name); + rte_devargs_reset(&da); + } +diff --git a/examples/multi_process/simple_mp/main.c b/examples/multi_process/simple_mp/main.c +index 5df2a39000..9d5f1088b0 100644 +--- a/examples/multi_process/simple_mp/main.c ++++ b/examples/multi_process/simple_mp/main.c +@@ -4,7 +4,7 @@ + + /* + * This sample application is a simple multi-process application which +- * demostrates sharing of queues and memory pools between processes, and ++ * demonstrates sharing of queues and memory pools between processes, and + * using those queues/pools for communication between the processes. + * + * Application is designed to run with two processes, a primary and a +diff --git a/examples/multi_process/symmetric_mp/main.c b/examples/multi_process/symmetric_mp/main.c +index b35886a77b..050337765f 100644 +--- a/examples/multi_process/symmetric_mp/main.c ++++ b/examples/multi_process/symmetric_mp/main.c +@@ -3,7 +3,7 @@ + */ + + /* +- * Sample application demostrating how to do packet I/O in a multi-process ++ * Sample application demonstrating how to do packet I/O in a multi-process + * environment. The same code can be run as a primary process and as a + * secondary process, just with a different proc-id parameter in each case + * (apart from the EAL flag to indicate a secondary process). +diff --git a/examples/ntb/ntb_fwd.c b/examples/ntb/ntb_fwd.c +index f110fc129f..81964d0308 100644 +--- a/examples/ntb/ntb_fwd.c ++++ b/examples/ntb/ntb_fwd.c +@@ -696,7 +696,7 @@ assign_stream_to_lcores(void) + break; + } + +- /* Print packet forwading config. */ ++ /* Print packet forwarding config. */ + RTE_LCORE_FOREACH_WORKER(lcore_id) { + conf = &fwd_lcore_conf[lcore_id]; + +diff --git a/examples/packet_ordering/main.c b/examples/packet_ordering/main.c +index b01ac60fd1..99e67ef67b 100644 +--- a/examples/packet_ordering/main.c ++++ b/examples/packet_ordering/main.c +@@ -686,7 +686,7 @@ main(int argc, char **argv) + if (ret < 0) + rte_exit(EXIT_FAILURE, "Invalid packet_ordering arguments\n"); + +- /* Check if we have enought cores */ ++ /* Check if we have enough cores */ + if (rte_lcore_count() < 3) + rte_exit(EXIT_FAILURE, "Error, This application needs at " + "least 3 logical cores to run:\n" +diff --git a/examples/performance-thread/common/lthread.c b/examples/performance-thread/common/lthread.c +index 009374a8c3..b02e0fc13a 100644 +--- a/examples/performance-thread/common/lthread.c ++++ b/examples/performance-thread/common/lthread.c +@@ -178,7 +178,7 @@ lthread_create(struct lthread **new_lt, int lcore_id, + bzero(lt, sizeof(struct lthread)); + lt->root_sched = THIS_SCHED; + +- /* set the function args and exit handlder */ ++ /* set the function args and exit handler */ + _lthread_init(lt, fun, arg, _lthread_exit_handler); + + /* put it in the ready queue */ +@@ -384,7 +384,7 @@ void lthread_exit(void *ptr) + } + + +- /* wait until the joinging thread has collected the exit value */ ++ /* wait until the joining thread has collected the exit value */ + while (lt->join != LT_JOIN_EXIT_VAL_READ) + _reschedule(); + +@@ -410,7 +410,7 @@ int lthread_join(struct lthread *lt, void **ptr) + /* invalid to join a detached thread, or a thread that is joined */ + if ((lt_state & BIT(ST_LT_DETACH)) || (lt->join == LT_JOIN_THREAD_SET)) + return POSIX_ERRNO(EINVAL); +- /* pointer to the joining thread and a poingter to return a value */ ++ /* pointer to the joining thread and a pointer to return a value */ + lt->lt_join = current; + current->lt_exit_ptr = ptr; + /* There is a race between lthread_join() and lthread_exit() +diff --git a/examples/performance-thread/common/lthread_diag.c b/examples/performance-thread/common/lthread_diag.c +index 57760a1e23..b1bdf7a30c 100644 +--- a/examples/performance-thread/common/lthread_diag.c ++++ b/examples/performance-thread/common/lthread_diag.c +@@ -232,7 +232,7 @@ lthread_sched_stats_display(void) + } + + /* +- * Defafult diagnostic callback ++ * Default diagnostic callback + */ + static uint64_t + _lthread_diag_default_cb(uint64_t time, struct lthread *lt, int diag_event, +diff --git a/examples/performance-thread/common/lthread_int.h b/examples/performance-thread/common/lthread_int.h +index d010126f16..ec018e34a1 100644 +--- a/examples/performance-thread/common/lthread_int.h ++++ b/examples/performance-thread/common/lthread_int.h +@@ -107,7 +107,7 @@ enum join_st { + LT_JOIN_EXIT_VAL_READ, /* joining thread has collected ret val */ + }; + +-/* defnition of an lthread stack object */ ++/* definition of an lthread stack object */ + struct lthread_stack { + uint8_t stack[LTHREAD_MAX_STACK_SIZE]; + size_t stack_size; +diff --git a/examples/performance-thread/common/lthread_tls.c b/examples/performance-thread/common/lthread_tls.c +index 4ab2e3558b..bae45f2aa9 100644 +--- a/examples/performance-thread/common/lthread_tls.c ++++ b/examples/performance-thread/common/lthread_tls.c +@@ -215,7 +215,7 @@ void _lthread_tls_alloc(struct lthread *lt) + tls->root_sched = (THIS_SCHED); + lt->tls = tls; + +- /* allocate data for TLS varaiables using RTE_PER_LTHREAD macros */ ++ /* allocate data for TLS variables using RTE_PER_LTHREAD macros */ + if (sizeof(void *) < (uint64_t)RTE_PER_LTHREAD_SECTION_SIZE) { + lt->per_lthread_data = + _lthread_objcache_alloc((THIS_SCHED)->per_lthread_cache); +diff --git a/examples/performance-thread/l3fwd-thread/main.c b/examples/performance-thread/l3fwd-thread/main.c +index 8a35040597..1ddb2a9138 100644 +--- a/examples/performance-thread/l3fwd-thread/main.c ++++ b/examples/performance-thread/l3fwd-thread/main.c +@@ -125,7 +125,7 @@ cb_parse_ptype(__rte_unused uint16_t port, __rte_unused uint16_t queue, + } + + /* +- * When set to zero, simple forwaring path is eanbled. ++ * When set to zero, simple forwarding path is enabled. + * When set to one, optimized forwarding path is enabled. + * Note that LPM optimisation path uses SSE4.1 instructions. + */ +@@ -1529,7 +1529,7 @@ processx4_step3(struct rte_mbuf *pkt[FWDSTEP], uint16_t dst_port[FWDSTEP]) + } + + /* +- * We group consecutive packets with the same destionation port into one burst. ++ * We group consecutive packets with the same destination port into one burst. + * To avoid extra latency this is done together with some other packet + * processing, but after we made a final decision about packet's destination. + * To do this we maintain: +@@ -1554,7 +1554,7 @@ processx4_step3(struct rte_mbuf *pkt[FWDSTEP], uint16_t dst_port[FWDSTEP]) + + /* + * Group consecutive packets with the same destination port in bursts of 4. +- * Suppose we have array of destionation ports: ++ * Suppose we have array of destination ports: + * dst_port[] = {a, b, c, d,, e, ... } + * dp1 should contain: , dp2: . + * We doing 4 comparisons at once and the result is 4 bit mask. +@@ -1565,7 +1565,7 @@ port_groupx4(uint16_t pn[FWDSTEP + 1], uint16_t *lp, __m128i dp1, __m128i dp2) + { + static const struct { + uint64_t pnum; /* prebuild 4 values for pnum[]. */ +- int32_t idx; /* index for new last updated elemnet. */ ++ int32_t idx; /* index for new last updated element. */ + uint16_t lpv; /* add value to the last updated element. */ + } gptbl[GRPSZ] = { + { +@@ -1834,7 +1834,7 @@ process_burst(struct rte_mbuf *pkts_burst[MAX_PKT_BURST], int nb_rx, + + /* + * Send packets out, through destination port. +- * Consecuteve pacekts with the same destination port ++ * Consecutive packets with the same destination port + * are already grouped together. + * If destination port for the packet equals BAD_PORT, + * then free the packet without sending it out. +@@ -3514,7 +3514,7 @@ main(int argc, char **argv) + + ret = rte_timer_subsystem_init(); + if (ret < 0) +- rte_exit(EXIT_FAILURE, "Failed to initialize timer subystem\n"); ++ rte_exit(EXIT_FAILURE, "Failed to initialize timer subsystem\n"); + + /* pre-init dst MACs for all ports to 02:00:00:00:00:xx */ + for (portid = 0; portid < RTE_MAX_ETHPORTS; portid++) { +diff --git a/examples/performance-thread/pthread_shim/pthread_shim.h b/examples/performance-thread/pthread_shim/pthread_shim.h +index e90fb15fc1..ce51627a5b 100644 +--- a/examples/performance-thread/pthread_shim/pthread_shim.h ++++ b/examples/performance-thread/pthread_shim/pthread_shim.h +@@ -41,7 +41,7 @@ + * + * The decision whether to invoke the real library function or the lthread + * function is controlled by a per pthread flag that can be switched +- * on of off by the pthread_override_set() API described below. Typcially ++ * on of off by the pthread_override_set() API described below. Typically + * this should be done as the first action of the initial lthread. + * + * N.B In general it would be poor practice to revert to invoke a real +diff --git a/examples/pipeline/examples/registers.spec b/examples/pipeline/examples/registers.spec +index 74a014ad06..59998fef03 100644 +--- a/examples/pipeline/examples/registers.spec ++++ b/examples/pipeline/examples/registers.spec +@@ -4,7 +4,7 @@ + ; This program is setting up two register arrays called "pkt_counters" and "byte_counters". + ; On every input packet (Ethernet/IPv4), the "pkt_counters" register at location indexed by + ; the IPv4 header "Source Address" field is incremented, while the same location in the +-; "byte_counters" array accummulates the value of the IPv4 header "Total Length" field. ++; "byte_counters" array accumulates the value of the IPv4 header "Total Length" field. + ; + ; The "regrd" and "regwr" CLI commands can be used to read and write the current value of + ; any register array location. +diff --git a/examples/qos_sched/cmdline.c b/examples/qos_sched/cmdline.c +index 257b87a7cf..6691b02d89 100644 +--- a/examples/qos_sched/cmdline.c ++++ b/examples/qos_sched/cmdline.c +@@ -41,7 +41,7 @@ static void cmd_help_parsed(__rte_unused void *parsed_result, + " qavg port X subport Y pipe Z : Show average queue size per pipe.\n" + " qavg port X subport Y pipe Z tc A : Show average queue size per pipe and TC.\n" + " qavg port X subport Y pipe Z tc A q B : Show average queue size of a specific queue.\n" +- " qavg [n|period] X : Set number of times and peiod (us).\n\n" ++ " qavg [n|period] X : Set number of times and period (us).\n\n" + ); + + } +diff --git a/examples/server_node_efd/node/node.c b/examples/server_node_efd/node/node.c +index ba1c7e5153..fc2aa5ffef 100644 +--- a/examples/server_node_efd/node/node.c ++++ b/examples/server_node_efd/node/node.c +@@ -296,7 +296,7 @@ handle_packets(struct rte_hash *h, struct rte_mbuf **bufs, uint16_t num_packets) + } + } + } +-/* >8 End of packets dequeueing. */ ++/* >8 End of packets dequeuing. */ + + /* + * Application main function - loops through +diff --git a/examples/skeleton/basicfwd.c b/examples/skeleton/basicfwd.c +index 16435ee3cc..518cd72179 100644 +--- a/examples/skeleton/basicfwd.c ++++ b/examples/skeleton/basicfwd.c +@@ -179,7 +179,7 @@ main(int argc, char *argv[]) + int ret = rte_eal_init(argc, argv); + if (ret < 0) + rte_exit(EXIT_FAILURE, "Error with EAL initialization\n"); +- /* >8 End of initializion the Environment Abstraction Layer (EAL). */ ++ /* >8 End of initialization the Environment Abstraction Layer (EAL). */ + + argc -= ret; + argv += ret; +diff --git a/examples/vhost/main.c b/examples/vhost/main.c +index 5ebfff3ac4..d05a8f9193 100644 +--- a/examples/vhost/main.c ++++ b/examples/vhost/main.c +@@ -107,7 +107,7 @@ static uint32_t burst_rx_retry_num = BURST_RX_RETRIES; + static char *socket_files; + static int nb_sockets; + +-/* empty vmdq configuration structure. Filled in programatically */ ++/* empty VMDq configuration structure. Filled in programmatically */ + static struct rte_eth_conf vmdq_conf_default = { + .rxmode = { + .mq_mode = RTE_ETH_MQ_RX_VMDQ_ONLY, +@@ -115,7 +115,7 @@ static struct rte_eth_conf vmdq_conf_default = { + /* + * VLAN strip is necessary for 1G NIC such as I350, + * this fixes bug of ipv4 forwarding in guest can't +- * forward pakets from one virtio dev to another virtio dev. ++ * forward packets from one virtio dev to another virtio dev. + */ + .offloads = RTE_ETH_RX_OFFLOAD_VLAN_STRIP, + }, +@@ -463,7 +463,7 @@ us_vhost_usage(const char *prgname) + " --nb-devices ND\n" + " -p PORTMASK: Set mask for ports to be used by application\n" + " --vm2vm [0|1|2]: disable/software(default)/hardware vm2vm comms\n" +- " --rx-retry [0|1]: disable/enable(default) retries on rx. Enable retry if destintation queue is full\n" ++ " --rx-retry [0|1]: disable/enable(default) retries on Rx. Enable retry if destination queue is full\n" + " --rx-retry-delay [0-N]: timeout(in usecond) between retries on RX. This makes effect only if retries on rx enabled\n" + " --rx-retry-num [0-N]: the number of retries on rx. This makes effect only if retries on rx enabled\n" + " --mergeable [0|1]: disable(default)/enable RX mergeable buffers\n" +@@ -1288,7 +1288,7 @@ switch_worker(void *arg __rte_unused) + struct vhost_dev *vdev; + struct mbuf_table *tx_q; + +- RTE_LOG(INFO, VHOST_DATA, "Procesing on Core %u started\n", lcore_id); ++ RTE_LOG(INFO, VHOST_DATA, "Processing on Core %u started\n", lcore_id); + + tx_q = &lcore_tx_queue[lcore_id]; + for (i = 0; i < rte_lcore_count(); i++) { +@@ -1332,7 +1332,7 @@ switch_worker(void *arg __rte_unused) + + /* + * Remove a device from the specific data core linked list and from the +- * main linked list. Synchonization occurs through the use of the ++ * main linked list. Synchronization occurs through the use of the + * lcore dev_removal_flag. Device is made volatile here to avoid re-ordering + * of dev->remove=1 which can cause an infinite loop in the rte_pause loop. + */ +diff --git a/examples/vm_power_manager/channel_monitor.c b/examples/vm_power_manager/channel_monitor.c +index d767423a40..97b8def7ca 100644 +--- a/examples/vm_power_manager/channel_monitor.c ++++ b/examples/vm_power_manager/channel_monitor.c +@@ -404,7 +404,7 @@ get_pcpu_to_control(struct policy *pol) + + /* + * So now that we're handling virtual and physical cores, we need to +- * differenciate between them when adding them to the branch monitor. ++ * differentiate between them when adding them to the branch monitor. + * Virtual cores need to be converted to physical cores. + */ + if (pol->pkt.core_type == RTE_POWER_CORE_TYPE_VIRTUAL) { +diff --git a/examples/vm_power_manager/power_manager.h b/examples/vm_power_manager/power_manager.h +index d35f8cbe01..d51039e2c6 100644 +--- a/examples/vm_power_manager/power_manager.h ++++ b/examples/vm_power_manager/power_manager.h +@@ -224,7 +224,7 @@ int power_manager_enable_turbo_core(unsigned int core_num); + int power_manager_disable_turbo_core(unsigned int core_num); + + /** +- * Get the current freuency of the core specified by core_num ++ * Get the current frequency of the core specified by core_num + * + * @param core_num + * The core number to get the current frequency +diff --git a/examples/vmdq/main.c b/examples/vmdq/main.c +index 2c00a942f1..10410b8783 100644 +--- a/examples/vmdq/main.c ++++ b/examples/vmdq/main.c +@@ -62,7 +62,7 @@ static uint8_t rss_enable; + + /* Default structure for VMDq. 8< */ + +-/* empty vmdq configuration structure. Filled in programatically */ ++/* empty VMDq configuration structure. Filled in programmatically */ + static const struct rte_eth_conf vmdq_conf_default = { + .rxmode = { + .mq_mode = RTE_ETH_MQ_RX_VMDQ_ONLY, +diff --git a/kernel/linux/kni/kni_fifo.h b/kernel/linux/kni/kni_fifo.h +index 5c91b55379..1ba5172002 100644 +--- a/kernel/linux/kni/kni_fifo.h ++++ b/kernel/linux/kni/kni_fifo.h +@@ -41,7 +41,7 @@ kni_fifo_put(struct rte_kni_fifo *fifo, void **data, uint32_t num) + } + + /** +- * Get up to num elements from the fifo. Return the number actully read ++ * Get up to num elements from the FIFO. Return the number actually read + */ + static inline uint32_t + kni_fifo_get(struct rte_kni_fifo *fifo, void **data, uint32_t num) +diff --git a/lib/acl/acl_bld.c b/lib/acl/acl_bld.c +index f316d3e875..7ea30f4186 100644 +--- a/lib/acl/acl_bld.c ++++ b/lib/acl/acl_bld.c +@@ -885,7 +885,7 @@ acl_gen_range_trie(struct acl_build_context *context, + return root; + } + +- /* gather information about divirgent paths */ ++ /* gather information about divergent paths */ + lo_00 = 0; + hi_ff = UINT8_MAX; + for (k = n - 1; k >= 0; k--) { +diff --git a/lib/acl/acl_run_altivec.h b/lib/acl/acl_run_altivec.h +index 2de6f27b1f..24a41eec17 100644 +--- a/lib/acl/acl_run_altivec.h ++++ b/lib/acl/acl_run_altivec.h +@@ -146,7 +146,7 @@ transition4(xmm_t next_input, const uint64_t *trans, + + dfa_ofs = vec_sub(t, r); + +- /* QUAD/SINGLE caluclations. */ ++ /* QUAD/SINGLE calculations. */ + t = (xmm_t)vec_cmpgt((vector signed char)in, (vector signed char)tr_hi); + t = (xmm_t)vec_sel( + vec_sel( +diff --git a/lib/acl/acl_run_avx512.c b/lib/acl/acl_run_avx512.c +index 78fbe34f7c..3b8795561b 100644 +--- a/lib/acl/acl_run_avx512.c ++++ b/lib/acl/acl_run_avx512.c +@@ -64,7 +64,7 @@ update_flow_mask(const struct acl_flow_avx512 *flow, uint32_t *fmsk, + } + + /* +- * Resolve matches for multiple categories (LE 8, use 128b instuctions/regs) ++ * Resolve matches for multiple categories (LE 8, use 128b instructions/regs) + */ + static inline void + resolve_mcle8_avx512x1(uint32_t result[], +diff --git a/lib/acl/acl_run_avx512x16.h b/lib/acl/acl_run_avx512x16.h +index 48bb6fed85..f87293eeb7 100644 +--- a/lib/acl/acl_run_avx512x16.h ++++ b/lib/acl/acl_run_avx512x16.h +@@ -10,7 +10,7 @@ + */ + + /* +- * This implementation uses 512-bit registers(zmm) and instrincts. ++ * This implementation uses 512-bit registers(zmm) and intrinsics. + * So our main SIMD type is 512-bit width and each such variable can + * process sizeof(__m512i) / sizeof(uint32_t) == 16 entries in parallel. + */ +@@ -25,20 +25,20 @@ + #define _F_(x) x##_avx512x16 + + /* +- * Same instrincts have different syntaxis (depending on the bit-width), ++ * Same intrinsics have different syntaxes (depending on the bit-width), + * so to overcome that few macros need to be defined. + */ + +-/* Naming convention for generic epi(packed integers) type instrincts. */ ++/* Naming convention for generic epi(packed integers) type intrinsics. */ + #define _M_I_(x) _mm512_##x + +-/* Naming convention for si(whole simd integer) type instrincts. */ ++/* Naming convention for si(whole simd integer) type intrinsics. */ + #define _M_SI_(x) _mm512_##x##_si512 + +-/* Naming convention for masked gather type instrincts. */ ++/* Naming convention for masked gather type intrinsics. */ + #define _M_MGI_(x) _mm512_##x + +-/* Naming convention for gather type instrincts. */ ++/* Naming convention for gather type intrinsics. */ + #define _M_GI_(name, idx, base, scale) _mm512_##name(idx, base, scale) + + /* num/mask of transitions per SIMD regs */ +@@ -239,7 +239,7 @@ _F_(gather_bytes)(__m512i zero, const __m512i p[2], const uint32_t m[2], + } + + /* +- * Resolve matches for multiple categories (GT 8, use 512b instuctions/regs) ++ * Resolve matches for multiple categories (GT 8, use 512b instructions/regs) + */ + static inline void + resolve_mcgt8_avx512x1(uint32_t result[], +diff --git a/lib/acl/acl_run_avx512x8.h b/lib/acl/acl_run_avx512x8.h +index 61ac9d1b47..5da2bbfdeb 100644 +--- a/lib/acl/acl_run_avx512x8.h ++++ b/lib/acl/acl_run_avx512x8.h +@@ -10,7 +10,7 @@ + */ + + /* +- * This implementation uses 256-bit registers(ymm) and instrincts. ++ * This implementation uses 256-bit registers(ymm) and intrinsics. + * So our main SIMD type is 256-bit width and each such variable can + * process sizeof(__m256i) / sizeof(uint32_t) == 8 entries in parallel. + */ +@@ -25,20 +25,20 @@ + #define _F_(x) x##_avx512x8 + + /* +- * Same instrincts have different syntaxis (depending on the bit-width), ++ * Same intrinsics have different syntaxes (depending on the bit-width), + * so to overcome that few macros need to be defined. + */ + +-/* Naming convention for generic epi(packed integers) type instrincts. */ ++/* Naming convention for generic epi(packed integers) type intrinsics. */ + #define _M_I_(x) _mm256_##x + +-/* Naming convention for si(whole simd integer) type instrincts. */ ++/* Naming convention for si(whole simd integer) type intrinsics. */ + #define _M_SI_(x) _mm256_##x##_si256 + +-/* Naming convention for masked gather type instrincts. */ ++/* Naming convention for masked gather type intrinsics. */ + #define _M_MGI_(x) _mm256_m##x + +-/* Naming convention for gather type instrincts. */ ++/* Naming convention for gather type intrinsics. */ + #define _M_GI_(name, idx, base, scale) _mm256_##name(base, idx, scale) + + /* num/mask of transitions per SIMD regs */ +diff --git a/lib/bpf/bpf_convert.c b/lib/bpf/bpf_convert.c +index db84add7dc..9563274c9c 100644 +--- a/lib/bpf/bpf_convert.c ++++ b/lib/bpf/bpf_convert.c +@@ -412,7 +412,7 @@ static int bpf_convert_filter(const struct bpf_insn *prog, size_t len, + BPF_EMIT_JMP; + break; + +- /* ldxb 4 * ([14] & 0xf) is remaped into 6 insns. */ ++ /* ldxb 4 * ([14] & 0xf) is remapped into 6 insns. */ + case BPF_LDX | BPF_MSH | BPF_B: + /* tmp = A */ + *insn++ = BPF_MOV64_REG(BPF_REG_TMP, BPF_REG_A); +@@ -428,7 +428,7 @@ static int bpf_convert_filter(const struct bpf_insn *prog, size_t len, + *insn = BPF_MOV64_REG(BPF_REG_A, BPF_REG_TMP); + break; + +- /* RET_K is remaped into 2 insns. RET_A case doesn't need an ++ /* RET_K is remapped into 2 insns. RET_A case doesn't need an + * extra mov as EBPF_REG_0 is already mapped into BPF_REG_A. + */ + case BPF_RET | BPF_A: +diff --git a/lib/dmadev/rte_dmadev.h b/lib/dmadev/rte_dmadev.h +index 9942c6ec21..4abe79c536 100644 +--- a/lib/dmadev/rte_dmadev.h ++++ b/lib/dmadev/rte_dmadev.h +@@ -533,7 +533,7 @@ struct rte_dma_port_param { + * @note If some fields can not be supported by the + * hardware/driver, then the driver ignores those fields. + * Please check driver-specific documentation for limitations +- * and capablites. ++ * and capabilities. + */ + __extension__ + struct { +@@ -731,7 +731,7 @@ enum rte_dma_status_code { + /** The operation completed successfully. */ + RTE_DMA_STATUS_SUCCESSFUL, + /** The operation failed to complete due abort by user. +- * This is mainly used when processing dev_stop, user could modidy the ++ * This is mainly used when processing dev_stop, user could modify the + * descriptors (e.g. change one bit to tell hardware abort this job), + * it allows outstanding requests to be complete as much as possible, + * so reduce the time to stop the device. +diff --git a/lib/eal/arm/include/rte_cycles_32.h b/lib/eal/arm/include/rte_cycles_32.h +index f79718ce8c..cec4d69e7a 100644 +--- a/lib/eal/arm/include/rte_cycles_32.h ++++ b/lib/eal/arm/include/rte_cycles_32.h +@@ -30,7 +30,7 @@ extern "C" { + + /** + * This call is easily portable to any architecture, however, +- * it may require a system call and inprecise for some tasks. ++ * it may require a system call and imprecise for some tasks. + */ + static inline uint64_t + __rte_rdtsc_syscall(void) +diff --git a/lib/eal/freebsd/eal_interrupts.c b/lib/eal/freebsd/eal_interrupts.c +index 10aa91cc09..9f720bdc8f 100644 +--- a/lib/eal/freebsd/eal_interrupts.c ++++ b/lib/eal/freebsd/eal_interrupts.c +@@ -234,7 +234,7 @@ rte_intr_callback_unregister_pending(const struct rte_intr_handle *intr_handle, + + rte_spinlock_lock(&intr_lock); + +- /* check if the insterrupt source for the fd is existent */ ++ /* check if the interrupt source for the fd is existent */ + TAILQ_FOREACH(src, &intr_sources, next) + if (rte_intr_fd_get(src->intr_handle) == rte_intr_fd_get(intr_handle)) + break; +@@ -288,7 +288,7 @@ rte_intr_callback_unregister(const struct rte_intr_handle *intr_handle, + + rte_spinlock_lock(&intr_lock); + +- /* check if the insterrupt source for the fd is existent */ ++ /* check if the interrupt source for the fd is existent */ + TAILQ_FOREACH(src, &intr_sources, next) + if (rte_intr_fd_get(src->intr_handle) == rte_intr_fd_get(intr_handle)) + break; +diff --git a/lib/eal/include/generic/rte_pflock.h b/lib/eal/include/generic/rte_pflock.h +index b9de063c89..e7bb29b3c5 100644 +--- a/lib/eal/include/generic/rte_pflock.h ++++ b/lib/eal/include/generic/rte_pflock.h +@@ -157,7 +157,7 @@ rte_pflock_write_lock(rte_pflock_t *pf) + uint16_t ticket, w; + + /* Acquire ownership of write-phase. +- * This is same as rte_tickelock_lock(). ++ * This is same as rte_ticketlock_lock(). + */ + ticket = __atomic_fetch_add(&pf->wr.in, 1, __ATOMIC_RELAXED); + rte_wait_until_equal_16(&pf->wr.out, ticket, __ATOMIC_ACQUIRE); +diff --git a/lib/eal/include/rte_malloc.h b/lib/eal/include/rte_malloc.h +index ed02e15119..3892519fab 100644 +--- a/lib/eal/include/rte_malloc.h ++++ b/lib/eal/include/rte_malloc.h +@@ -58,7 +58,7 @@ rte_malloc(const char *type, size_t size, unsigned align) + __rte_alloc_size(2); + + /** +- * Allocate zero'ed memory from the heap. ++ * Allocate zeroed memory from the heap. + * + * Equivalent to rte_malloc() except that the memory zone is + * initialised with zeros. In NUMA systems, the memory allocated resides on the +@@ -189,7 +189,7 @@ rte_malloc_socket(const char *type, size_t size, unsigned align, int socket) + __rte_alloc_size(2); + + /** +- * Allocate zero'ed memory from the heap. ++ * Allocate zeroed memory from the heap. + * + * Equivalent to rte_malloc() except that the memory zone is + * initialised with zeros. +diff --git a/lib/eal/linux/eal_interrupts.c b/lib/eal/linux/eal_interrupts.c +index 621e43626e..c3e9a08822 100644 +--- a/lib/eal/linux/eal_interrupts.c ++++ b/lib/eal/linux/eal_interrupts.c +@@ -589,7 +589,7 @@ rte_intr_callback_unregister_pending(const struct rte_intr_handle *intr_handle, + + rte_spinlock_lock(&intr_lock); + +- /* check if the insterrupt source for the fd is existent */ ++ /* check if the interrupt source for the fd is existent */ + TAILQ_FOREACH(src, &intr_sources, next) { + if (rte_intr_fd_get(src->intr_handle) == rte_intr_fd_get(intr_handle)) + break; +@@ -639,7 +639,7 @@ rte_intr_callback_unregister(const struct rte_intr_handle *intr_handle, + + rte_spinlock_lock(&intr_lock); + +- /* check if the insterrupt source for the fd is existent */ ++ /* check if the interrupt source for the fd is existent */ + TAILQ_FOREACH(src, &intr_sources, next) + if (rte_intr_fd_get(src->intr_handle) == rte_intr_fd_get(intr_handle)) + break; +diff --git a/lib/eal/linux/eal_vfio.h b/lib/eal/linux/eal_vfio.h +index 6ebaca6a0c..c5d5f70548 100644 +--- a/lib/eal/linux/eal_vfio.h ++++ b/lib/eal/linux/eal_vfio.h +@@ -103,7 +103,7 @@ struct vfio_group { + typedef int (*vfio_dma_func_t)(int); + + /* Custom memory region DMA mapping function prototype. +- * Takes VFIO container fd, virtual address, phisical address, length and ++ * Takes VFIO container fd, virtual address, physical address, length and + * operation type (0 to unmap 1 for map) as a parameters. + * Returns 0 on success, -1 on error. + **/ +diff --git a/lib/eal/windows/eal_windows.h b/lib/eal/windows/eal_windows.h +index 23ead6d30c..245aa60344 100644 +--- a/lib/eal/windows/eal_windows.h ++++ b/lib/eal/windows/eal_windows.h +@@ -63,7 +63,7 @@ unsigned int eal_socket_numa_node(unsigned int socket_id); + * @param arg + * Argument to the called function. + * @return +- * 0 on success, netagive error code on failure. ++ * 0 on success, negative error code on failure. + */ + int eal_intr_thread_schedule(void (*func)(void *arg), void *arg); + +diff --git a/lib/eal/windows/include/dirent.h b/lib/eal/windows/include/dirent.h +index 869a598378..34eb077f8c 100644 +--- a/lib/eal/windows/include/dirent.h ++++ b/lib/eal/windows/include/dirent.h +@@ -440,7 +440,7 @@ opendir(const char *dirname) + * display correctly on console. The problem can be fixed in two ways: + * (1) change the character set of console to 1252 using chcp utility + * and use Lucida Console font, or (2) use _cprintf function when +- * writing to console. The _cprinf() will re-encode ANSI strings to the ++ * writing to console. The _cprintf() will re-encode ANSI strings to the + * console code page so many non-ASCII characters will display correctly. + */ + static struct dirent* +@@ -579,7 +579,7 @@ dirent_mbstowcs_s( + wcstr[n] = 0; + } + +- /* Length of resuting multi-byte string WITH zero ++ /* Length of resulting multi-byte string WITH zero + *terminator + */ + if (pReturnValue) +diff --git a/lib/eal/windows/include/fnmatch.h b/lib/eal/windows/include/fnmatch.h +index c272f65ccd..c6b226bd5d 100644 +--- a/lib/eal/windows/include/fnmatch.h ++++ b/lib/eal/windows/include/fnmatch.h +@@ -26,14 +26,14 @@ extern "C" { + #define FNM_PREFIX_DIRS 0x20 + + /** +- * This function is used for searhing a given string source ++ * This function is used for searching a given string source + * with the given regular expression pattern. + * + * @param pattern + * regular expression notation describing the pattern to match + * + * @param string +- * source string to searcg for the pattern ++ * source string to search for the pattern + * + * @param flag + * containing information about the pattern +diff --git a/lib/eal/x86/include/rte_atomic.h b/lib/eal/x86/include/rte_atomic.h +index 915afd9d27..f2ee1a9ce9 100644 +--- a/lib/eal/x86/include/rte_atomic.h ++++ b/lib/eal/x86/include/rte_atomic.h +@@ -60,7 +60,7 @@ extern "C" { + * Basic idea is to use lock prefixed add with some dummy memory location + * as the destination. From their experiments 128B(2 cache lines) below + * current stack pointer looks like a good candidate. +- * So below we use that techinque for rte_smp_mb() implementation. ++ * So below we use that technique for rte_smp_mb() implementation. + */ + + static __rte_always_inline void +diff --git a/lib/eventdev/rte_event_eth_rx_adapter.c b/lib/eventdev/rte_event_eth_rx_adapter.c +index 809416d9b7..3182b52c23 100644 +--- a/lib/eventdev/rte_event_eth_rx_adapter.c ++++ b/lib/eventdev/rte_event_eth_rx_adapter.c +@@ -3334,7 +3334,7 @@ handle_rxa_get_queue_conf(const char *cmd __rte_unused, + token = strtok(NULL, "\0"); + if (token != NULL) + RTE_EDEV_LOG_ERR("Extra parameters passed to eventdev" +- " telemetry command, igrnoring"); ++ " telemetry command, ignoring"); + + if (rte_event_eth_rx_adapter_queue_conf_get(rx_adapter_id, eth_dev_id, + rx_queue_id, &queue_conf)) { +@@ -3398,7 +3398,7 @@ handle_rxa_get_queue_stats(const char *cmd __rte_unused, + token = strtok(NULL, "\0"); + if (token != NULL) + RTE_EDEV_LOG_ERR("Extra parameters passed to eventdev" +- " telemetry command, igrnoring"); ++ " telemetry command, ignoring"); + + if (rte_event_eth_rx_adapter_queue_stats_get(rx_adapter_id, eth_dev_id, + rx_queue_id, &q_stats)) { +@@ -3460,7 +3460,7 @@ handle_rxa_queue_stats_reset(const char *cmd __rte_unused, + token = strtok(NULL, "\0"); + if (token != NULL) + RTE_EDEV_LOG_ERR("Extra parameters passed to eventdev" +- " telemetry command, igrnoring"); ++ " telemetry command, ignoring"); + + if (rte_event_eth_rx_adapter_queue_stats_reset(rx_adapter_id, + eth_dev_id, +diff --git a/lib/fib/rte_fib.c b/lib/fib/rte_fib.c +index 6ca180d7e7..0cced97a77 100644 +--- a/lib/fib/rte_fib.c ++++ b/lib/fib/rte_fib.c +@@ -40,10 +40,10 @@ EAL_REGISTER_TAILQ(rte_fib_tailq) + struct rte_fib { + char name[RTE_FIB_NAMESIZE]; + enum rte_fib_type type; /**< Type of FIB struct */ +- struct rte_rib *rib; /**< RIB helper datastruct */ ++ struct rte_rib *rib; /**< RIB helper datastructure */ + void *dp; /**< pointer to the dataplane struct*/ +- rte_fib_lookup_fn_t lookup; /**< fib lookup function */ +- rte_fib_modify_fn_t modify; /**< modify fib datastruct */ ++ rte_fib_lookup_fn_t lookup; /**< FIB lookup function */ ++ rte_fib_modify_fn_t modify; /**< modify FIB datastructure */ + uint64_t def_nh; + }; + +diff --git a/lib/fib/rte_fib.h b/lib/fib/rte_fib.h +index b3c59dfaaa..e592d3251a 100644 +--- a/lib/fib/rte_fib.h ++++ b/lib/fib/rte_fib.h +@@ -189,7 +189,7 @@ rte_fib_lookup_bulk(struct rte_fib *fib, uint32_t *ips, + * FIB object handle + * @return + * Pointer on the dataplane struct on success +- * NULL othervise ++ * NULL otherwise + */ + void * + rte_fib_get_dp(struct rte_fib *fib); +@@ -201,7 +201,7 @@ rte_fib_get_dp(struct rte_fib *fib); + * FIB object handle + * @return + * Pointer on the RIB on success +- * NULL othervise ++ * NULL otherwise + */ + struct rte_rib * + rte_fib_get_rib(struct rte_fib *fib); +diff --git a/lib/fib/rte_fib6.c b/lib/fib/rte_fib6.c +index be79efe004..eebee297d6 100644 +--- a/lib/fib/rte_fib6.c ++++ b/lib/fib/rte_fib6.c +@@ -40,10 +40,10 @@ EAL_REGISTER_TAILQ(rte_fib6_tailq) + struct rte_fib6 { + char name[FIB6_NAMESIZE]; + enum rte_fib6_type type; /**< Type of FIB struct */ +- struct rte_rib6 *rib; /**< RIB helper datastruct */ ++ struct rte_rib6 *rib; /**< RIB helper datastructure */ + void *dp; /**< pointer to the dataplane struct*/ +- rte_fib6_lookup_fn_t lookup; /**< fib lookup function */ +- rte_fib6_modify_fn_t modify; /**< modify fib datastruct */ ++ rte_fib6_lookup_fn_t lookup; /**< FIB lookup function */ ++ rte_fib6_modify_fn_t modify; /**< modify FIB datastructure */ + uint64_t def_nh; + }; + +diff --git a/lib/fib/rte_fib6.h b/lib/fib/rte_fib6.h +index 95879af96d..cb133719e1 100644 +--- a/lib/fib/rte_fib6.h ++++ b/lib/fib/rte_fib6.h +@@ -184,7 +184,7 @@ rte_fib6_lookup_bulk(struct rte_fib6 *fib, + * FIB6 object handle + * @return + * Pointer on the dataplane struct on success +- * NULL othervise ++ * NULL otherwise + */ + void * + rte_fib6_get_dp(struct rte_fib6 *fib); +@@ -196,7 +196,7 @@ rte_fib6_get_dp(struct rte_fib6 *fib); + * FIB object handle + * @return + * Pointer on the RIB6 on success +- * NULL othervise ++ * NULL otherwise + */ + struct rte_rib6 * + rte_fib6_get_rib(struct rte_fib6 *fib); +diff --git a/lib/ipsec/ipsec_telemetry.c b/lib/ipsec/ipsec_telemetry.c +index b8b08404b6..9a91e47122 100644 +--- a/lib/ipsec/ipsec_telemetry.c ++++ b/lib/ipsec/ipsec_telemetry.c +@@ -236,7 +236,7 @@ RTE_INIT(rte_ipsec_telemetry_init) + "Return list of IPsec SAs with telemetry enabled."); + rte_telemetry_register_cmd("/ipsec/sa/stats", + handle_telemetry_cmd_ipsec_sa_stats, +- "Returns IPsec SA stastistics. Parameters: int sa_spi"); ++ "Returns IPsec SA statistics. Parameters: int sa_spi"); + rte_telemetry_register_cmd("/ipsec/sa/details", + handle_telemetry_cmd_ipsec_sa_details, + "Returns IPsec SA configuration. Parameters: int sa_spi"); +diff --git a/lib/ipsec/rte_ipsec_sad.h b/lib/ipsec/rte_ipsec_sad.h +index b65d295831..a3ae57df7e 100644 +--- a/lib/ipsec/rte_ipsec_sad.h ++++ b/lib/ipsec/rte_ipsec_sad.h +@@ -153,7 +153,7 @@ rte_ipsec_sad_destroy(struct rte_ipsec_sad *sad); + * @param keys + * Array of keys to be looked up in the SAD + * @param sa +- * Pointer assocoated with the keys. ++ * Pointer associated with the keys. + * If the lookup for the given key failed, then corresponding sa + * will be NULL + * @param n +diff --git a/lib/ipsec/sa.c b/lib/ipsec/sa.c +index 1e51482c92..cdb70af0cb 100644 +--- a/lib/ipsec/sa.c ++++ b/lib/ipsec/sa.c +@@ -362,7 +362,7 @@ esp_outb_tun_init(struct rte_ipsec_sa *sa, const struct rte_ipsec_sa_prm *prm) + + memcpy(sa->hdr, prm->tun.hdr, prm->tun.hdr_len); + +- /* insert UDP header if UDP encapsulation is inabled */ ++ /* insert UDP header if UDP encapsulation is enabled */ + if (sa->type & RTE_IPSEC_SATP_NATT_ENABLE) { + struct rte_udp_hdr *udph = (struct rte_udp_hdr *) + &sa->hdr[prm->tun.hdr_len]; +diff --git a/lib/mbuf/rte_mbuf_core.h b/lib/mbuf/rte_mbuf_core.h +index 321a419c71..3d6ddd6773 100644 +--- a/lib/mbuf/rte_mbuf_core.h ++++ b/lib/mbuf/rte_mbuf_core.h +@@ -8,7 +8,7 @@ + + /** + * @file +- * This file contains definion of RTE mbuf structure itself, ++ * This file contains definition of RTE mbuf structure itself, + * packet offload flags and some related macros. + * For majority of DPDK entities, it is not recommended to include + * this file directly, use include instead. +diff --git a/lib/meson.build b/lib/meson.build +index 5363f0d184..963287b174 100644 +--- a/lib/meson.build ++++ b/lib/meson.build +@@ -3,7 +3,7 @@ + + + # process all libraries equally, as far as possible +-# "core" libs first, then others alphebetically as far as possible ++# "core" libs first, then others alphabetically as far as possible + # NOTE: for speed of meson runs, the dependencies in the subdirectories + # sometimes skip deps that would be implied by others, e.g. if mempool is + # given as a dep, no need to mention ring. This is especially true for the +diff --git a/lib/net/rte_l2tpv2.h b/lib/net/rte_l2tpv2.h +index b90e36cf12..938a993b48 100644 +--- a/lib/net/rte_l2tpv2.h ++++ b/lib/net/rte_l2tpv2.h +@@ -143,7 +143,7 @@ struct rte_l2tpv2_msg_without_length { + /** + * L2TPv2 message Header contains all options except ns_nr(length, + * offset size, offset padding). +- * Ns and Nr MUST be toghter. ++ * Ns and Nr MUST be together. + */ + struct rte_l2tpv2_msg_without_ns_nr { + rte_be16_t length; /**< length(16) */ +@@ -155,7 +155,7 @@ struct rte_l2tpv2_msg_without_ns_nr { + + /** + * L2TPv2 message Header contains all options except ns_nr(length, ns, nr). +- * offset size and offset padding MUST be toghter. ++ * offset size and offset padding MUST be together. + */ + struct rte_l2tpv2_msg_without_offset { + rte_be16_t length; /**< length(16) */ +diff --git a/lib/pipeline/rte_swx_ctl.h b/lib/pipeline/rte_swx_ctl.h +index 46d05823e1..82e62e70a7 100644 +--- a/lib/pipeline/rte_swx_ctl.h ++++ b/lib/pipeline/rte_swx_ctl.h +@@ -369,7 +369,7 @@ struct rte_swx_table_stats { + uint64_t n_pkts_miss; + + /** Number of packets (with either lookup hit or miss) per pipeline +- * action. Array of pipeline *n_actions* elements indedex by the ++ * action. Array of pipeline *n_actions* elements indexed by the + * pipeline-level *action_id*, therefore this array has the same size + * for all the tables within the same pipeline. + */ +@@ -629,7 +629,7 @@ struct rte_swx_learner_stats { + uint64_t n_pkts_forget; + + /** Number of packets (with either lookup hit or miss) per pipeline action. Array of +- * pipeline *n_actions* elements indedex by the pipeline-level *action_id*, therefore this ++ * pipeline *n_actions* elements indexed by the pipeline-level *action_id*, therefore this + * array has the same size for all the tables within the same pipeline. + */ + uint64_t *n_pkts_action; +diff --git a/lib/pipeline/rte_swx_pipeline_internal.h b/lib/pipeline/rte_swx_pipeline_internal.h +index 1921fdcd78..fa944c95f2 100644 +--- a/lib/pipeline/rte_swx_pipeline_internal.h ++++ b/lib/pipeline/rte_swx_pipeline_internal.h +@@ -309,7 +309,7 @@ enum instruction_type { + */ + INSTR_ALU_CKADD_FIELD, /* src = H */ + INSTR_ALU_CKADD_STRUCT20, /* src = h.header, with sizeof(header) = 20 */ +- INSTR_ALU_CKADD_STRUCT, /* src = h.hdeader, with any sizeof(header) */ ++ INSTR_ALU_CKADD_STRUCT, /* src = h.header, with any sizeof(header) */ + + /* cksub dst src + * dst = dst '- src +@@ -1562,7 +1562,7 @@ emit_handler(struct thread *t) + return; + } + +- /* Header encapsulation (optionally, with prior header decasulation). */ ++ /* Header encapsulation (optionally, with prior header decapsulation). */ + if ((t->n_headers_out == 2) && + (h1->ptr + h1->n_bytes == t->ptr) && + (h0->ptr == h0->ptr0)) { +diff --git a/lib/pipeline/rte_swx_pipeline_spec.c b/lib/pipeline/rte_swx_pipeline_spec.c +index 8e9aa44e30..07a7580ac8 100644 +--- a/lib/pipeline/rte_swx_pipeline_spec.c ++++ b/lib/pipeline/rte_swx_pipeline_spec.c +@@ -2011,7 +2011,7 @@ rte_swx_pipeline_build_from_spec(struct rte_swx_pipeline *p, + if (err_line) + *err_line = 0; + if (err_msg) +- *err_msg = "Null pipeline arument."; ++ *err_msg = "Null pipeline argument."; + status = -EINVAL; + goto error; + } +diff --git a/lib/power/power_cppc_cpufreq.c b/lib/power/power_cppc_cpufreq.c +index 6afd310e4e..25185a791c 100644 +--- a/lib/power/power_cppc_cpufreq.c ++++ b/lib/power/power_cppc_cpufreq.c +@@ -621,7 +621,7 @@ power_cppc_enable_turbo(unsigned int lcore_id) + return -1; + } + +- /* TODO: must set to max once enbling Turbo? Considering add condition: ++ /* TODO: must set to max once enabling Turbo? Considering add condition: + * if ((pi->turbo_available) && (pi->curr_idx <= 1)) + */ + /* Max may have changed, so call to max function */ +diff --git a/lib/regexdev/rte_regexdev.h b/lib/regexdev/rte_regexdev.h +index 86f0b231b0..0bac46cda9 100644 +--- a/lib/regexdev/rte_regexdev.h ++++ b/lib/regexdev/rte_regexdev.h +@@ -298,14 +298,14 @@ rte_regexdev_get_dev_id(const char *name); + * backtracking positions remembered by any tokens inside the group. + * Example RegEx is `a(?>bc|b)c` if the given patterns are `abc` and `abcc` then + * `a(bc|b)c` matches both where as `a(?>bc|b)c` matches only abcc because +- * atomic groups don't allow backtracing back to `b`. ++ * atomic groups don't allow backtracking back to `b`. + * + * @see struct rte_regexdev_info::regexdev_capa + */ + + #define RTE_REGEXDEV_SUPP_PCRE_BACKTRACKING_CTRL_F (1ULL << 3) + /**< RegEx device support PCRE backtracking control verbs. +- * Some examples of backtracing verbs are (*COMMIT), (*ACCEPT), (*FAIL), ++ * Some examples of backtracking verbs are (*COMMIT), (*ACCEPT), (*FAIL), + * (*SKIP), (*PRUNE). + * + * @see struct rte_regexdev_info::regexdev_capa +@@ -1015,7 +1015,7 @@ rte_regexdev_rule_db_update(uint8_t dev_id, + * @b EXPERIMENTAL: this API may change without prior notice. + * + * Compile local rule set and burn the complied result to the +- * RegEx deive. ++ * RegEx device. + * + * @param dev_id + * RegEx device identifier. +diff --git a/lib/ring/rte_ring_core.h b/lib/ring/rte_ring_core.h +index 46ad584f9c..1252ca9546 100644 +--- a/lib/ring/rte_ring_core.h ++++ b/lib/ring/rte_ring_core.h +@@ -12,7 +12,7 @@ + + /** + * @file +- * This file contains definion of RTE ring structure itself, ++ * This file contains definition of RTE ring structure itself, + * init flags and some related macros. + * For majority of DPDK entities, it is not recommended to include + * this file directly, use include or +diff --git a/lib/sched/rte_pie.h b/lib/sched/rte_pie.h +index dfdf572311..02a987f54a 100644 +--- a/lib/sched/rte_pie.h ++++ b/lib/sched/rte_pie.h +@@ -252,7 +252,7 @@ _rte_pie_drop(const struct rte_pie_config *pie_cfg, + } + + /** +- * @brief Decides if new packet should be enqeued or dropped for non-empty queue ++ * @brief Decides if new packet should be enqueued or dropped for non-empty queue + * + * @param pie_cfg [in] config pointer to a PIE configuration parameter structure + * @param pie [in,out] data pointer to PIE runtime data +@@ -319,7 +319,7 @@ rte_pie_enqueue_nonempty(const struct rte_pie_config *pie_cfg, + } + + /** +- * @brief Decides if new packet should be enqeued or dropped ++ * @brief Decides if new packet should be enqueued or dropped + * Updates run time data and gives verdict whether to enqueue or drop the packet. + * + * @param pie_cfg [in] config pointer to a PIE configuration parameter structure +@@ -330,7 +330,7 @@ rte_pie_enqueue_nonempty(const struct rte_pie_config *pie_cfg, + * + * @return Operation status + * @retval 0 enqueue the packet +- * @retval 1 drop the packet based on drop probility criteria ++ * @retval 1 drop the packet based on drop probability criteria + */ + static inline int + __rte_experimental +diff --git a/lib/sched/rte_red.h b/lib/sched/rte_red.h +index 36273cac64..f5843dab1b 100644 +--- a/lib/sched/rte_red.h ++++ b/lib/sched/rte_red.h +@@ -303,7 +303,7 @@ __rte_red_drop(const struct rte_red_config *red_cfg, struct rte_red *red) + } + + /** +- * @brief Decides if new packet should be enqeued or dropped in queue non-empty case ++ * @brief Decides if new packet should be enqueued or dropped in queue non-empty case + * + * @param red_cfg [in] config pointer to a RED configuration parameter structure + * @param red [in,out] data pointer to RED runtime data +@@ -361,7 +361,7 @@ rte_red_enqueue_nonempty(const struct rte_red_config *red_cfg, + } + + /** +- * @brief Decides if new packet should be enqeued or dropped ++ * @brief Decides if new packet should be enqueued or dropped + * Updates run time data based on new queue size value. + * Based on new queue average and RED configuration parameters + * gives verdict whether to enqueue or drop the packet. +diff --git a/lib/sched/rte_sched.c b/lib/sched/rte_sched.c +index ed44808f7b..62b3d2e315 100644 +--- a/lib/sched/rte_sched.c ++++ b/lib/sched/rte_sched.c +@@ -239,7 +239,7 @@ struct rte_sched_port { + int socket; + + /* Timing */ +- uint64_t time_cpu_cycles; /* Current CPU time measured in CPU cyles */ ++ uint64_t time_cpu_cycles; /* Current CPU time measured in CPU cycles */ + uint64_t time_cpu_bytes; /* Current CPU time measured in bytes */ + uint64_t time; /* Current NIC TX time measured in bytes */ + struct rte_reciprocal inv_cycles_per_byte; /* CPU cycles per byte */ +diff --git a/lib/sched/rte_sched.h b/lib/sched/rte_sched.h +index 484dbdcc3d..3c625ba169 100644 +--- a/lib/sched/rte_sched.h ++++ b/lib/sched/rte_sched.h +@@ -360,7 +360,7 @@ rte_sched_subport_pipe_profile_add(struct rte_sched_port *port, + * + * Hierarchical scheduler subport bandwidth profile add + * Note that this function is safe to use in runtime for adding new +- * subport bandwidth profile as it doesn't have any impact on hiearchical ++ * subport bandwidth profile as it doesn't have any impact on hierarchical + * structure of the scheduler. + * @param port + * Handle to port scheduler instance +diff --git a/lib/table/rte_swx_table.h b/lib/table/rte_swx_table.h +index f93e5f3f95..c1383c2e57 100644 +--- a/lib/table/rte_swx_table.h ++++ b/lib/table/rte_swx_table.h +@@ -216,7 +216,7 @@ typedef int + * operations into the same table. + * + * The typical reason an implementation may choose to split the table lookup +- * operation into multiple steps is to hide the latency of the inherrent memory ++ * operation into multiple steps is to hide the latency of the inherent memory + * read operations: before a read operation with the source data likely not in + * the CPU cache, the source data prefetch is issued and the table lookup + * operation is postponed in favor of some other unrelated work, which the CPU +diff --git a/lib/table/rte_swx_table_selector.h b/lib/table/rte_swx_table_selector.h +index 62988d2856..05863cc90b 100644 +--- a/lib/table/rte_swx_table_selector.h ++++ b/lib/table/rte_swx_table_selector.h +@@ -155,7 +155,7 @@ rte_swx_table_selector_group_set(void *table, + * mechanism allows for multiple concurrent select operations into the same table. + * + * The typical reason an implementation may choose to split the operation into multiple steps is to +- * hide the latency of the inherrent memory read operations: before a read operation with the ++ * hide the latency of the inherent memory read operations: before a read operation with the + * source data likely not in the CPU cache, the source data prefetch is issued and the operation is + * postponed in favor of some other unrelated work, which the CPU executes in parallel with the + * source data being fetched into the CPU cache; later on, the operation is resumed, this time with +diff --git a/lib/telemetry/telemetry.c b/lib/telemetry/telemetry.c +index a7483167d4..e5ccfe47f7 100644 +--- a/lib/telemetry/telemetry.c ++++ b/lib/telemetry/telemetry.c +@@ -534,7 +534,7 @@ telemetry_legacy_init(void) + } + rc = pthread_create(&t_old, NULL, socket_listener, &v1_socket); + if (rc != 0) { +- TMTY_LOG(ERR, "Error with create legcay socket thread: %s\n", ++ TMTY_LOG(ERR, "Error with create legacy socket thread: %s\n", + strerror(rc)); + close(v1_socket.sock); + v1_socket.sock = -1; +diff --git a/lib/telemetry/telemetry_json.h b/lib/telemetry/telemetry_json.h +index f02a12f5b0..db70690274 100644 +--- a/lib/telemetry/telemetry_json.h ++++ b/lib/telemetry/telemetry_json.h +@@ -23,7 +23,7 @@ + /** + * @internal + * Copies a value into a buffer if the buffer has enough available space. +- * Nothing written to buffer if an overflow ocurs. ++ * Nothing written to buffer if an overflow occurs. + * This function is not for use for values larger than given buffer length. + */ + __rte_format_printf(3, 4) +diff --git a/lib/vhost/vhost_user.c b/lib/vhost/vhost_user.c +index 550b0ee8b5..9b690dc81e 100644 +--- a/lib/vhost/vhost_user.c ++++ b/lib/vhost/vhost_user.c +@@ -1115,7 +1115,7 @@ vhost_user_postcopy_region_register(struct virtio_net *dev, + struct uffdio_register reg_struct; + + /* +- * Let's register all the mmap'ed area to ensure ++ * Let's register all the mmapped area to ensure + * alignment on page boundary. + */ + reg_struct.range.start = (uint64_t)(uintptr_t)reg->mmap_addr; +@@ -1177,7 +1177,7 @@ vhost_user_postcopy_register(struct virtio_net *dev, int main_fd, + msg->fd_num = 0; + send_vhost_reply(main_fd, msg); + +- /* Wait for qemu to acknolwedge it's got the addresses ++ /* Wait for qemu to acknowledge it got the addresses + * we've got to wait before we're allowed to generate faults. + */ + if (read_vhost_message(main_fd, &ack_msg) <= 0) { +-- +2.23.0 + diff --git a/0168-net-hns3-remove-meaningless-packet-buffer-rollback.patch b/0168-net-hns3-remove-meaningless-packet-buffer-rollback.patch deleted file mode 100644 index 50e719f628922c00080e004b1805f4645decec6e..0000000000000000000000000000000000000000 --- a/0168-net-hns3-remove-meaningless-packet-buffer-rollback.patch +++ /dev/null @@ -1,75 +0,0 @@ -From 30543af4bf517080e505ce6a99e2d0a3c9211445 Mon Sep 17 00:00:00 2001 -From: Huisong Li -Date: Sat, 15 May 2021 08:52:35 +0800 -Subject: [PATCH 168/189] net/hns3: remove meaningless packet buffer rollback - -Packet buffer allocation and hardware pause configuration fail normally -when a reset occurs. If the execution fails, rollback of the packet -buffer still fails. So this rollback is meaningless. - -Fixes: 62e3ccc2b94c ("net/hns3: support flow control") -Cc: stable@dpdk.org - -Signed-off-by: Huisong Li -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_dcb.c | 14 +++++--------- - 1 file changed, 5 insertions(+), 9 deletions(-) - -diff --git a/drivers/net/hns3/hns3_dcb.c b/drivers/net/hns3/hns3_dcb.c -index 3efc2cd..1547942 100644 ---- a/drivers/net/hns3/hns3_dcb.c -+++ b/drivers/net/hns3/hns3_dcb.c -@@ -1543,7 +1543,7 @@ hns3_dcb_hw_configure(struct hns3_adapter *hns) - enum hns3_fc_status fc_status = hw->current_fc_status; - enum hns3_fc_mode requested_fc_mode = hw->requested_fc_mode; - uint8_t hw_pfc_map = hw->dcb_info.hw_pfc_map; -- int ret, status; -+ int ret; - - if (pf->tx_sch_mode != HNS3_FLAG_TC_BASE_SCH_MODE && - pf->tx_sch_mode != HNS3_FLAG_VNET_BASE_SCH_MODE) -@@ -1568,7 +1568,7 @@ hns3_dcb_hw_configure(struct hns3_adapter *hns) - - ret = hns3_buffer_alloc(hw); - if (ret) -- return ret; -+ goto buffer_alloc_fail; - - hw->current_fc_status = HNS3_FC_STATUS_PFC; - hw->requested_fc_mode = HNS3_FC_FULL; -@@ -1594,10 +1594,9 @@ hns3_dcb_hw_configure(struct hns3_adapter *hns) - pfc_setup_fail: - hw->requested_fc_mode = requested_fc_mode; - hw->current_fc_status = fc_status; -+ -+buffer_alloc_fail: - hw->dcb_info.hw_pfc_map = hw_pfc_map; -- status = hns3_buffer_alloc(hw); -- if (status) -- hns3_err(hw, "recover packet buffer fail! status = %d", status); - - return ret; - } -@@ -1801,7 +1800,7 @@ hns3_dcb_pfc_enable(struct rte_eth_dev *dev, struct rte_eth_pfc_conf *pfc_conf) - uint8_t pfc_en = hw->dcb_info.pfc_en; - uint8_t priority = pfc_conf->priority; - uint16_t pause_time = pf->pause_time; -- int ret, status; -+ int ret; - - pf->pause_time = pfc_conf->fc.pause_time; - hns3_get_fc_mode(hw, pfc_conf->fc.mode); -@@ -1831,9 +1830,6 @@ hns3_dcb_pfc_enable(struct rte_eth_dev *dev, struct rte_eth_pfc_conf *pfc_conf) - pf->pause_time = pause_time; - hw->dcb_info.pfc_en = pfc_en; - hw->dcb_info.hw_pfc_map = hw_pfc_map; -- status = hns3_buffer_alloc(hw); -- if (status) -- hns3_err(hw, "recover packet buffer fail: %d", status); - - return ret; - } --- -2.7.4 - diff --git a/0169-net-hns3-add-VLAN-filter-query-in-dump-file.patch b/0169-net-hns3-add-VLAN-filter-query-in-dump-file.patch new file mode 100644 index 0000000000000000000000000000000000000000..ed999637f75fc56f1ed2f26eaea4c0d44388280e --- /dev/null +++ b/0169-net-hns3-add-VLAN-filter-query-in-dump-file.patch @@ -0,0 +1,158 @@ +From 11186d5e167f1b11c436f0ca550789e855d5292c Mon Sep 17 00:00:00 2001 +From: Dongdong Liu +Date: Fri, 21 Oct 2022 15:36:45 +0800 +Subject: [PATCH 169/189] net/hns3: add VLAN filter query in dump file + +Add VLAN filter query in dump file. + +Signed-off-by: Dongdong Liu +Signed-off-by: Min Hu (Connor) +--- + drivers/net/hns3/hns3_dump.c | 80 +++++++++++++++++++++++++++++++----- + 1 file changed, 69 insertions(+), 11 deletions(-) + +diff --git a/drivers/net/hns3/hns3_dump.c b/drivers/net/hns3/hns3_dump.c +index 1007b09bd2..8268506f6f 100644 +--- a/drivers/net/hns3/hns3_dump.c ++++ b/drivers/net/hns3/hns3_dump.c +@@ -4,11 +4,10 @@ + + #include + +-#include "hns3_ethdev.h" + #include "hns3_common.h" +-#include "hns3_rxtx.h" +-#include "hns3_regs.h" + #include "hns3_logs.h" ++#include "hns3_regs.h" ++#include "hns3_rxtx.h" + #include "hns3_dump.h" + + #define HNS3_BD_DW_NUM 8 +@@ -394,11 +393,6 @@ hns3_get_rxtx_queue_enable_state(FILE *file, struct rte_eth_dev *dev) + uint32_t nb_tx_queues; + uint32_t bitmap_size; + +- bitmap_size = (hw->tqps_num * sizeof(uint32_t) + HNS3_UINT32_BIT) / +- HNS3_UINT32_BIT; +- rx_queue_state = (uint32_t *)rte_zmalloc(NULL, bitmap_size, 0); +- tx_queue_state = (uint32_t *)rte_zmalloc(NULL, bitmap_size, 0); +- + nb_rx_queues = dev->data->nb_rx_queues; + nb_tx_queues = dev->data->nb_tx_queues; + if (nb_rx_queues == 0) { +@@ -410,6 +404,21 @@ hns3_get_rxtx_queue_enable_state(FILE *file, struct rte_eth_dev *dev) + return; + } + ++ bitmap_size = (hw->tqps_num * sizeof(uint32_t) + HNS3_UINT32_BIT) / ++ HNS3_UINT32_BIT; ++ rx_queue_state = (uint32_t *)rte_zmalloc(NULL, bitmap_size, 0); ++ if (rx_queue_state == NULL) { ++ hns3_err(hw, "Failed to allocate memory for rx queue state!"); ++ return; ++ } ++ ++ tx_queue_state = (uint32_t *)rte_zmalloc(NULL, bitmap_size, 0); ++ if (tx_queue_state == NULL) { ++ hns3_err(hw, "Failed to allocate memory for tx queue state!"); ++ rte_free(rx_queue_state); ++ return; ++ } ++ + fprintf(file, "\t -- enable state:\n"); + hns3_get_queue_enable_state(hw, rx_queue_state, nb_rx_queues, true); + hns3_display_queue_enable_state(file, rx_queue_state, nb_rx_queues, +@@ -448,6 +457,51 @@ hns3_get_rxtx_queue_info(FILE *file, struct rte_eth_dev *dev) + hns3_get_rxtx_queue_enable_state(file, dev); + } + ++static int ++hns3_get_vlan_filter_cfg(FILE *file, struct hns3_hw *hw) ++{ ++#define HNS3_FILTER_TYPE_VF 0 ++#define HNS3_FILTER_TYPE_PORT 1 ++#define HNS3_FILTER_FE_NIC_INGRESS_B BIT(0) ++#define HNS3_FILTER_FE_NIC_EGRESS_B BIT(1) ++ struct hns3_vlan_filter_ctrl_cmd *req; ++ struct hns3_cmd_desc desc; ++ uint8_t i; ++ int ret; ++ ++ static const uint32_t vlan_filter_type[] = { ++ HNS3_FILTER_TYPE_PORT, ++ HNS3_FILTER_TYPE_VF ++ }; ++ ++ for (i = 0; i < RTE_DIM(vlan_filter_type); i++) { ++ hns3_cmd_setup_basic_desc(&desc, HNS3_OPC_VLAN_FILTER_CTRL, ++ true); ++ req = (struct hns3_vlan_filter_ctrl_cmd *)desc.data; ++ req->vlan_type = vlan_filter_type[i]; ++ req->vf_id = HNS3_PF_FUNC_ID; ++ ret = hns3_cmd_send(hw, &desc, 1); ++ if (ret != 0) { ++ hns3_err(hw, ++ "NIC IMP exec ret=%d desc_num=%d optcode=0x%x!", ++ ret, 1, rte_le_to_cpu_16(desc.opcode)); ++ return ret; ++ } ++ fprintf(file, ++ "\t -- %s VLAN filter configuration\n" ++ "\t nic_ingress :%s\n" ++ "\t nic_egress :%s\n", ++ req->vlan_type == HNS3_FILTER_TYPE_PORT ? ++ "Port" : "VF", ++ req->vlan_fe & HNS3_FILTER_FE_NIC_INGRESS_B ? ++ "Enable" : "Disable", ++ req->vlan_fe & HNS3_FILTER_FE_NIC_EGRESS_B ? ++ "Enable" : "Disable"); ++ } ++ ++ return 0; ++} ++ + static int + hns3_get_vlan_rx_offload_cfg(FILE *file, struct hns3_hw *hw) + { +@@ -583,6 +637,10 @@ hns3_get_vlan_config_info(FILE *file, struct hns3_hw *hw) + int ret; + + fprintf(file, " - VLAN Config Info:\n"); ++ ret = hns3_get_vlan_filter_cfg(file, hw); ++ if (ret < 0) ++ return; ++ + ret = hns3_get_vlan_rx_offload_cfg(file, hw); + if (ret < 0) + return; +@@ -619,7 +677,7 @@ hns3_get_tm_conf_port_node_info(FILE *file, struct hns3_tm_conf *conf) + return; + + fprintf(file, +- " port_node: \n" ++ " port_node:\n" + " node_id=%u reference_count=%u shaper_profile_id=%d\n", + conf->root->id, conf->root->reference_count, + conf->root->shaper_profile ? +@@ -637,7 +695,7 @@ hns3_get_tm_conf_tc_node_info(FILE *file, struct hns3_tm_conf *conf) + if (conf->nb_tc_node == 0) + return; + +- fprintf(file, " tc_node: \n"); ++ fprintf(file, " tc_node:\n"); + memset(tc_node, 0, sizeof(tc_node)); + TAILQ_FOREACH(tm_node, tc_list, node) { + tidx = hns3_tm_calc_node_tc_no(conf, tm_node->id); +@@ -705,7 +763,7 @@ hns3_get_tm_conf_queue_node_info(FILE *file, struct hns3_tm_conf *conf, + return; + + fprintf(file, +- " queue_node: \n" ++ " queue_node:\n" + " tx queue id | mapped tc (8 mean node not exist)\n"); + + memset(queue_node, 0, sizeof(queue_node)); +-- +2.23.0 + diff --git a/0169-net-hns3-fix-DCB-configuration.patch b/0169-net-hns3-fix-DCB-configuration.patch deleted file mode 100644 index e87a40c9ac68a6eb4f6974a14142e22fe1d84f52..0000000000000000000000000000000000000000 --- a/0169-net-hns3-fix-DCB-configuration.patch +++ /dev/null @@ -1,198 +0,0 @@ -From c8817a4d8e42476b08fdcfc0a2b931e3d2fecc59 Mon Sep 17 00:00:00 2001 -From: Huisong Li -Date: Sat, 15 May 2021 08:52:36 +0800 -Subject: [PATCH 169/189] net/hns3: fix DCB configuration - -Currently, the DCB configuration takes effect in the dev_start stage, and -the mapping between TCs and queues are also updated in this stage. -However, the DCB configuration is delivered in the dev_configure stage. - -If the configuration fails, it should be intercepted in this stage. If -the configuration succeeds, the user should be able to obtain the -corresponding updated information, such as the mapping between TCs and -queues. So this patch moves DCB configuration to dev_configure. - -Fixes: 62e3ccc2b94c ("net/hns3: support flow control") -Cc: stable@dpdk.org - -Signed-off-by: Huisong Li -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_dcb.c | 35 +++++--------------------- - drivers/net/hns3/hns3_dcb.h | 2 +- - drivers/net/hns3/hns3_ethdev.c | 56 +++++++++++++++++++++++------------------- - 3 files changed, 38 insertions(+), 55 deletions(-) - -diff --git a/drivers/net/hns3/hns3_dcb.c b/drivers/net/hns3/hns3_dcb.c -index 1547942..624bf40 100644 ---- a/drivers/net/hns3/hns3_dcb.c -+++ b/drivers/net/hns3/hns3_dcb.c -@@ -1615,8 +1615,7 @@ hns3_dcb_configure(struct hns3_adapter *hns) - int ret; - - hns3_dcb_cfg_validate(hns, &num_tc, &map_changed); -- if (map_changed || -- __atomic_load_n(&hw->reset.resetting, __ATOMIC_RELAXED)) { -+ if (map_changed) { - ret = hns3_dcb_info_update(hns, num_tc); - if (ret) { - hns3_err(hw, "dcb info update failed: %d", ret); -@@ -1712,14 +1711,18 @@ hns3_dcb_init(struct hns3_hw *hw) - return 0; - } - --static int -+int - hns3_update_queue_map_configure(struct hns3_adapter *hns) - { - struct hns3_hw *hw = &hns->hw; -+ enum rte_eth_rx_mq_mode mq_mode = hw->data->dev_conf.rxmode.mq_mode; - uint16_t nb_rx_q = hw->data->nb_rx_queues; - uint16_t nb_tx_q = hw->data->nb_tx_queues; - int ret; - -+ if ((uint32_t)mq_mode & ETH_MQ_RX_DCB_FLAG) -+ return 0; -+ - ret = hns3_dcb_update_tc_queue_mapping(hw, nb_rx_q, nb_tx_q); - if (ret) { - hns3_err(hw, "failed to update tc queue mapping, ret = %d.", -@@ -1733,32 +1736,6 @@ hns3_update_queue_map_configure(struct hns3_adapter *hns) - return ret; - } - --int --hns3_dcb_cfg_update(struct hns3_adapter *hns) --{ -- struct hns3_hw *hw = &hns->hw; -- enum rte_eth_rx_mq_mode mq_mode = hw->data->dev_conf.rxmode.mq_mode; -- int ret; -- -- if ((uint32_t)mq_mode & ETH_MQ_RX_DCB_FLAG) { -- ret = hns3_dcb_configure(hns); -- if (ret) -- hns3_err(hw, "Failed to config dcb: %d", ret); -- } else { -- /* -- * Update queue map without PFC configuration, -- * due to queues reconfigured by user. -- */ -- ret = hns3_update_queue_map_configure(hns); -- if (ret) -- hns3_err(hw, -- "Failed to update queue mapping configure: %d", -- ret); -- } -- -- return ret; --} -- - static void - hns3_get_fc_mode(struct hns3_hw *hw, enum rte_eth_fc_mode mode) - { -diff --git a/drivers/net/hns3/hns3_dcb.h b/drivers/net/hns3/hns3_dcb.h -index 0d25d3b..279f163 100644 ---- a/drivers/net/hns3/hns3_dcb.h -+++ b/drivers/net/hns3/hns3_dcb.h -@@ -207,7 +207,7 @@ int hns3_dcb_pfc_enable(struct rte_eth_dev *dev, - int hns3_queue_to_tc_mapping(struct hns3_hw *hw, uint16_t nb_rx_q, - uint16_t nb_tx_q); - --int hns3_dcb_cfg_update(struct hns3_adapter *hns); -+int hns3_update_queue_map_configure(struct hns3_adapter *hns); - int hns3_port_shaper_update(struct hns3_hw *hw, uint32_t speed); - int hns3_pg_shaper_rate_cfg(struct hns3_hw *hw, uint8_t pg_id, uint32_t rate); - int hns3_pri_shaper_rate_cfg(struct hns3_hw *hw, uint8_t tc_no, uint32_t rate); -diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c -index 88b2cfd..351dc59 100644 ---- a/drivers/net/hns3/hns3_ethdev.c -+++ b/drivers/net/hns3/hns3_ethdev.c -@@ -2274,24 +2274,6 @@ hns3_check_mq_mode(struct rte_eth_dev *dev) - } - - static int --hns3_check_dcb_cfg(struct rte_eth_dev *dev) --{ -- struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private); -- -- if (!hns3_dev_dcb_supported(hw)) { -- hns3_err(hw, "this port does not support dcb configurations."); -- return -EOPNOTSUPP; -- } -- -- if (hw->current_fc_status == HNS3_FC_STATUS_MAC_PAUSE) { -- hns3_err(hw, "MAC pause enabled, cannot config dcb info."); -- return -EOPNOTSUPP; -- } -- -- return 0; --} -- --static int - hns3_bind_ring_with_vector(struct hns3_hw *hw, uint16_t vector_id, bool en, - enum hns3_ring_type queue_type, uint16_t queue_id) - { -@@ -2427,6 +2409,30 @@ hns3_refresh_mtu(struct rte_eth_dev *dev, struct rte_eth_conf *conf) - } - - static int -+hns3_setup_dcb(struct rte_eth_dev *dev) -+{ -+ struct hns3_adapter *hns = dev->data->dev_private; -+ struct hns3_hw *hw = &hns->hw; -+ int ret; -+ -+ if (!hns3_dev_dcb_supported(hw)) { -+ hns3_err(hw, "this port does not support dcb configurations."); -+ return -EOPNOTSUPP; -+ } -+ -+ if (hw->current_fc_status == HNS3_FC_STATUS_MAC_PAUSE) { -+ hns3_err(hw, "MAC pause enabled, cannot config dcb info."); -+ return -EOPNOTSUPP; -+ } -+ -+ ret = hns3_dcb_configure(hns); -+ if (ret) -+ hns3_err(hw, "failed to config dcb: %d", ret); -+ -+ return ret; -+} -+ -+static int - hns3_check_link_speed(struct hns3_hw *hw, uint32_t link_speeds) - { - int ret; -@@ -2506,7 +2512,7 @@ hns3_dev_configure(struct rte_eth_dev *dev) - goto cfg_err; - - if ((uint32_t)mq_mode & ETH_MQ_RX_DCB_FLAG) { -- ret = hns3_check_dcb_cfg(dev); -+ ret = hns3_setup_dcb(dev); - if (ret) - goto cfg_err; - } -@@ -5571,14 +5577,14 @@ hns3_do_start(struct hns3_adapter *hns, bool reset_queue) - struct hns3_hw *hw = &hns->hw; - int ret; - -- ret = hns3_dcb_cfg_update(hns); -- if (ret) -+ ret = hns3_update_queue_map_configure(hns); -+ if (ret) { -+ hns3_err(hw, "failed to update queue mapping configuration, ret = %d", -+ ret); - return ret; -+ } - -- /* -- * The hns3_dcb_cfg_update may configure TM module, so -- * hns3_tm_conf_update must called later. -- */ -+ /* Note: hns3_tm_conf_update must be called after configuring DCB. */ - ret = hns3_tm_conf_update(hw); - if (ret) { - PMD_INIT_LOG(ERR, "failed to update tm conf, ret = %d.", ret); --- -2.7.4 - diff --git a/0170-net-bonding-fix-array-overflow-in-Rx-burst.patch b/0170-net-bonding-fix-array-overflow-in-Rx-burst.patch new file mode 100644 index 0000000000000000000000000000000000000000..fb901bafe9c20cf162313de8a11523032a3e98cb --- /dev/null +++ b/0170-net-bonding-fix-array-overflow-in-Rx-burst.patch @@ -0,0 +1,39 @@ +From a087560ab1d0e5920f77859f5a06245cc5d7bafe Mon Sep 17 00:00:00 2001 +From: Yunjian Wang +Date: Fri, 21 Oct 2022 15:36:46 +0800 +Subject: [PATCH 170/189] net/bonding: fix array overflow in Rx burst + +In bond_ethdev_rx_burst() function, we check the validity of the +'active_slave' as this code: +if (++active_slave == slave_count) + active_slave = 0; +However, the value of 'active_slave' maybe equal to 'slave_count', +when a slave is down. This is wrong and it can cause buffer overflow. +This patch fixes the issue by using '>=' instead of '=='. + +Fixes: e1110e977648 ("net/bonding: fix Rx slave fairness") +Cc: stable@dpdk.org + +Signed-off-by: Lei Ji +Signed-off-by: Yunjian Wang +Acked-by: Min Hu (Connor) +--- + drivers/net/bonding/rte_eth_bond_pmd.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c +index 09636321cd..828fb5f96d 100644 +--- a/drivers/net/bonding/rte_eth_bond_pmd.c ++++ b/drivers/net/bonding/rte_eth_bond_pmd.c +@@ -82,7 +82,7 @@ bond_ethdev_rx_burst(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) + bufs + num_rx_total, nb_pkts); + num_rx_total += num_rx_slave; + nb_pkts -= num_rx_slave; +- if (++active_slave == slave_count) ++ if (++active_slave >= slave_count) + active_slave = 0; + } + +-- +2.23.0 + diff --git a/0170-net-hns3-fix-DCB-reconfiguration.patch b/0170-net-hns3-fix-DCB-reconfiguration.patch deleted file mode 100644 index 0710014b336511cdcc7d33c853f4d183159c551b..0000000000000000000000000000000000000000 --- a/0170-net-hns3-fix-DCB-reconfiguration.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 8e8b04c6f9586cef6a58b6825fee632ebce13c36 Mon Sep 17 00:00:00 2001 -From: Huisong Li -Date: Sat, 15 May 2021 08:52:37 +0800 -Subject: [PATCH 170/189] net/hns3: fix DCB reconfiguration - -Whether the enable bit of the pfc ("pfc_en") is changed or not is one of -the conditions for reconfiguring the DCB. Currently, pfc_en is not -rolled back when DCB configuration fails. This patch fixes it. - -Fixes: 62e3ccc2b94c ("net/hns3: support flow control") -Cc: stable@dpdk.org - -Signed-off-by: Huisong Li -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_dcb.c | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/drivers/net/hns3/hns3_dcb.c b/drivers/net/hns3/hns3_dcb.c -index 624bf40..8778452 100644 ---- a/drivers/net/hns3/hns3_dcb.c -+++ b/drivers/net/hns3/hns3_dcb.c -@@ -1543,6 +1543,7 @@ hns3_dcb_hw_configure(struct hns3_adapter *hns) - enum hns3_fc_status fc_status = hw->current_fc_status; - enum hns3_fc_mode requested_fc_mode = hw->requested_fc_mode; - uint8_t hw_pfc_map = hw->dcb_info.hw_pfc_map; -+ uint8_t pfc_en = hw->dcb_info.pfc_en; - int ret; - - if (pf->tx_sch_mode != HNS3_FLAG_TC_BASE_SCH_MODE && -@@ -1596,6 +1597,7 @@ hns3_dcb_hw_configure(struct hns3_adapter *hns) - hw->current_fc_status = fc_status; - - buffer_alloc_fail: -+ hw->dcb_info.pfc_en = pfc_en; - hw->dcb_info.hw_pfc_map = hw_pfc_map; - - return ret; --- -2.7.4 - diff --git a/0171-net-bonding-fix-double-slave-link-status-query.patch b/0171-net-bonding-fix-double-slave-link-status-query.patch new file mode 100644 index 0000000000000000000000000000000000000000..4470d8dbe04a1cd0fe38b1424952aa6136b650c2 --- /dev/null +++ b/0171-net-bonding-fix-double-slave-link-status-query.patch @@ -0,0 +1,60 @@ +From 7ec0325f9c2bfe2ea961e66588f8ba9e22bb6483 Mon Sep 17 00:00:00 2001 +From: Yunjian Wang +Date: Fri, 21 Oct 2022 15:36:47 +0800 +Subject: [PATCH 171/189] net/bonding: fix double slave link status query + +When link status polling mode is used, the slave link status is +queried twice, which may be inconsistent. To fix this, we can keep +the latest queried link state. + +Fixes: a45b288ef21a ("bond: support link status polling") +Cc: stable@dpdk.org + +Signed-off-by: Yunjian Wang +Acked-by: Min Hu (Connor) +--- + drivers/net/bonding/rte_eth_bond_pmd.c | 7 +++---- + 1 file changed, 3 insertions(+), 4 deletions(-) + +diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c +index 828fb5f96d..3be2b08128 100644 +--- a/drivers/net/bonding/rte_eth_bond_pmd.c ++++ b/drivers/net/bonding/rte_eth_bond_pmd.c +@@ -2400,9 +2400,6 @@ bond_ethdev_slave_link_status_change_monitor(void *cb_arg) + * event callback */ + if (slave_ethdev->data->dev_link.link_status != + internals->slaves[i].last_link_status) { +- internals->slaves[i].last_link_status = +- slave_ethdev->data->dev_link.link_status; +- + bond_ethdev_lsc_event_callback(internals->slaves[i].port_id, + RTE_ETH_EVENT_INTR_LSC, + &bonded_ethdev->data->port_id, +@@ -2901,7 +2898,7 @@ bond_ethdev_lsc_event_callback(uint16_t port_id, enum rte_eth_event_type type, + + uint8_t lsc_flag = 0; + int valid_slave = 0; +- uint16_t active_pos; ++ uint16_t active_pos, slave_idx; + uint16_t i; + + if (type != RTE_ETH_EVENT_INTR_LSC || param == NULL) +@@ -2922,6 +2919,7 @@ bond_ethdev_lsc_event_callback(uint16_t port_id, enum rte_eth_event_type type, + for (i = 0; i < internals->slave_count; i++) { + if (internals->slaves[i].port_id == port_id) { + valid_slave = 1; ++ slave_idx = i; + break; + } + } +@@ -3010,6 +3008,7 @@ bond_ethdev_lsc_event_callback(uint16_t port_id, enum rte_eth_event_type type, + * slaves + */ + bond_ethdev_link_update(bonded_eth_dev, 0); ++ internals->slaves[slave_idx].last_link_status = link.link_status; + + if (lsc_flag) { + /* Cancel any possible outstanding interrupts if delays are enabled */ +-- +2.23.0 + diff --git a/0171-net-hns3-fix-link-speed-when-VF-device-is-down.patch b/0171-net-hns3-fix-link-speed-when-VF-device-is-down.patch deleted file mode 100644 index 94407163e686b4df4a03d6da140300405ec0ab2d..0000000000000000000000000000000000000000 --- a/0171-net-hns3-fix-link-speed-when-VF-device-is-down.patch +++ /dev/null @@ -1,46 +0,0 @@ -From 5c44687c2b82e27046dd8c6eb6e3b3c4dc3a7499 Mon Sep 17 00:00:00 2001 -From: Huisong Li -Date: Sat, 15 May 2021 08:52:38 +0800 -Subject: [PATCH 171/189] net/hns3: fix link speed when VF device is down - -When the port is link down state, it is meaningless to display the -port link speed. It should be an undefined state. - -Fixes: 59fad0f32135 ("net/hns3: support link update operation") -Cc: stable@dpdk.org - -Signed-off-by: Huisong Li -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_ethdev_vf.c | 8 +++++--- - 1 file changed, 5 insertions(+), 3 deletions(-) - -diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c -index 7f7da18..030d63a 100644 ---- a/drivers/net/hns3/hns3_ethdev_vf.c -+++ b/drivers/net/hns3/hns3_ethdev_vf.c -@@ -2202,16 +2202,18 @@ hns3vf_dev_link_update(struct rte_eth_dev *eth_dev, - case ETH_SPEED_NUM_50G: - case ETH_SPEED_NUM_100G: - case ETH_SPEED_NUM_200G: -- new_link.link_speed = mac->link_speed; -+ if (mac->link_status) -+ new_link.link_speed = mac->link_speed; - break; - default: - if (mac->link_status) - new_link.link_speed = ETH_SPEED_NUM_UNKNOWN; -- else -- new_link.link_speed = ETH_SPEED_NUM_NONE; - break; - } - -+ if (!mac->link_status) -+ new_link.link_speed = ETH_SPEED_NUM_NONE; -+ - new_link.link_duplex = mac->link_duplex; - new_link.link_status = mac->link_status ? ETH_LINK_UP : ETH_LINK_DOWN; - new_link.link_autoneg = --- -2.7.4 - diff --git a/0172-app-testpmd-fix-supported-RSS-offload-display.patch b/0172-app-testpmd-fix-supported-RSS-offload-display.patch new file mode 100644 index 0000000000000000000000000000000000000000..26d4294f4c442d61bd2c4282fb2183e0419461a9 --- /dev/null +++ b/0172-app-testpmd-fix-supported-RSS-offload-display.patch @@ -0,0 +1,121 @@ +From 4ba54bf73c3f5038f03163d70e60d43e968878d5 Mon Sep 17 00:00:00 2001 +From: Huisong Li +Date: Fri, 21 Oct 2022 15:36:48 +0800 +Subject: [PATCH 172/189] app/testpmd: fix supported RSS offload display + +The rte_eth_dev_info.flow_type_rss_offloads is populated in terms of +RTE_ETH_RSS_* bits. If PMD sets RTE_ETH_RSS_L3_SRC_ONLY to +dev_info->flow_type_rss_offloads. testpmd will display "user defined 63" +when run 'show port info 0'. Because testpmd use flowtype_to_str() +to display the supported RSS offload of PMD. In fact, the function is +used to display flow type in FDIR commands for i40e or ixgbe. This patch +uses the RTE_ETH_RSS_* bits to display supported RSS offload of PMD. + +Fixes: b12964f621dc ("ethdev: unification of RSS offload types") +Cc: stable@dpdk.org + +Signed-off-by: Huisong Li +Signed-off-by: Ferruh Yigit +--- + app/test-pmd/config.c | 40 ++++++++++++++++++++++++++-------------- + app/test-pmd/testpmd.h | 2 ++ + 2 files changed, 28 insertions(+), 14 deletions(-) + +diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c +index a7fffc3d1d..2849ee7e7c 100644 +--- a/app/test-pmd/config.c ++++ b/app/test-pmd/config.c +@@ -66,8 +66,6 @@ + + #define NS_PER_SEC 1E9 + +-static char *flowtype_to_str(uint16_t flow_type); +- + static const struct { + enum tx_pkt_split split; + const char *name; +@@ -674,6 +672,19 @@ print_dev_capabilities(uint64_t capabilities) + } + } + ++const char * ++rsstypes_to_str(uint64_t rss_type) ++{ ++ uint16_t i; ++ ++ for (i = 0; rss_type_table[i].str != NULL; i++) { ++ if (rss_type_table[i].rss_type == rss_type) ++ return rss_type_table[i].str; ++ } ++ ++ return NULL; ++} ++ + void + port_infos_display(portid_t port_id) + { +@@ -778,19 +789,20 @@ port_infos_display(portid_t port_id) + if (!dev_info.flow_type_rss_offloads) + printf("No RSS offload flow type is supported.\n"); + else { ++ uint64_t rss_offload_types = dev_info.flow_type_rss_offloads; + uint16_t i; +- char *p; + + printf("Supported RSS offload flow types:\n"); +- for (i = RTE_ETH_FLOW_UNKNOWN + 1; +- i < sizeof(dev_info.flow_type_rss_offloads) * CHAR_BIT; i++) { +- if (!(dev_info.flow_type_rss_offloads & (1ULL << i))) +- continue; +- p = flowtype_to_str(i); +- if (p) +- printf(" %s\n", p); +- else +- printf(" user defined %d\n", i); ++ for (i = 0; i < sizeof(rss_offload_types) * CHAR_BIT; i++) { ++ uint64_t rss_offload = RTE_BIT64(i); ++ if ((rss_offload_types & rss_offload) != 0) { ++ const char *p = rsstypes_to_str(rss_offload); ++ if (p) ++ printf(" %s\n", p); ++ else ++ printf(" user defined %u\n", ++ i); ++ } + } + } + +@@ -4811,6 +4823,8 @@ set_record_burst_stats(uint8_t on_off) + record_burst_stats = on_off; + } + ++#if defined(RTE_NET_I40E) || defined(RTE_NET_IXGBE) ++ + static char* + flowtype_to_str(uint16_t flow_type) + { +@@ -4854,8 +4868,6 @@ flowtype_to_str(uint16_t flow_type) + return NULL; + } + +-#if defined(RTE_NET_I40E) || defined(RTE_NET_IXGBE) +- + static inline void + print_fdir_mask(struct rte_eth_fdir_masks *mask) + { +diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h +index 569b4300cf..d6a775c485 100644 +--- a/app/test-pmd/testpmd.h ++++ b/app/test-pmd/testpmd.h +@@ -1105,6 +1105,8 @@ extern int flow_parse(const char *src, void *result, unsigned int size, + struct rte_flow_item **pattern, + struct rte_flow_action **actions); + ++const char *rsstypes_to_str(uint64_t rss_type); ++ + /* + * Work-around of a compilation error with ICC on invocations of the + * rte_be_to_cpu_16() function. +-- +2.23.0 + diff --git a/0172-net-bonding-fix-adding-itself-as-its-slave.patch b/0172-net-bonding-fix-adding-itself-as-its-slave.patch deleted file mode 100644 index 553ad5cc431695a87005c101f5b9ce6e3c575a22..0000000000000000000000000000000000000000 --- a/0172-net-bonding-fix-adding-itself-as-its-slave.patch +++ /dev/null @@ -1,137 +0,0 @@ -From d91cb3a8f42e016965f7e641f1c33763f29fb722 Mon Sep 17 00:00:00 2001 -From: Chengchang Tang -Date: Thu, 15 Apr 2021 15:09:54 +0800 -Subject: [PATCH 172/189] net/bonding: fix adding itself as its slave - -Adding the bond device as its own slave should be forbidden. This -will cause a recursive endless loop in many subsequent operations, -and eventually lead to coredump. - -This problem was found in testpmd, the related logs are as follows: -testpmd> create bonded device 1 0 -Created new bonded device net_bonding_testpmd_0 on (port 4). -testpmd> add bonding slave 4 4 -Segmentation fault (core dumped) - -The call stack is as follows: -0x000000000064eb90 in rte_eth_dev_info_get () -0x00000000006df4b4 in bond_ethdev_info () -0x000000000064eb90 in rte_eth_dev_info_get () -0x00000000006df4b4 in bond_ethdev_info () -0x000000000064eb90 in rte_eth_dev_info_get () -0x0000000000564e58 in eth_dev_info_get_print_err () -0x000000000055e8a4 in init_port_config () -0x000000000052730c in cmd_add_bonding_slave_parsed () -0x0000000000646f60 in cmdline_parse () -0x0000000000645e08 in cmdline_valid_buffer () -0x000000000064956c in rdline_char_in () -0x0000000000645ee0 in cmdline_in () -0x00000000006460a4 in cmdline_interact () -0x0000000000531904 in prompt () -0x000000000051cca8 in main () - -Fixes: 2efb58cbab6e ("bond: new link bonding library") -Cc: stable@dpdk.org - -Signed-off-by: Chengchang Tang -Signed-off-by: Min Hu (Connor) ---- - drivers/net/bonding/eth_bond_private.h | 2 +- - drivers/net/bonding/rte_eth_bond_api.c | 26 +++++++++++++++++--------- - 2 files changed, 18 insertions(+), 10 deletions(-) - -diff --git a/drivers/net/bonding/eth_bond_private.h b/drivers/net/bonding/eth_bond_private.h -index 8f198bd..5c7a552 100644 ---- a/drivers/net/bonding/eth_bond_private.h -+++ b/drivers/net/bonding/eth_bond_private.h -@@ -212,7 +212,7 @@ int - valid_bonded_port_id(uint16_t port_id); - - int --valid_slave_port_id(uint16_t port_id, uint8_t mode); -+valid_slave_port_id(struct bond_dev_private *internals, uint16_t port_id); - - void - deactivate_slave(struct rte_eth_dev *eth_dev, uint16_t port_id); -diff --git a/drivers/net/bonding/rte_eth_bond_api.c b/drivers/net/bonding/rte_eth_bond_api.c -index 55c8e31..44775f6 100644 ---- a/drivers/net/bonding/rte_eth_bond_api.c -+++ b/drivers/net/bonding/rte_eth_bond_api.c -@@ -56,19 +56,25 @@ check_for_master_bonded_ethdev(const struct rte_eth_dev *eth_dev) - } - - int --valid_slave_port_id(uint16_t port_id, uint8_t mode) -+valid_slave_port_id(struct bond_dev_private *internals, uint16_t slave_port_id) - { -- RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -1); -+ RTE_ETH_VALID_PORTID_OR_ERR_RET(slave_port_id, -1); - -- /* Verify that port_id refers to a non bonded port */ -- if (check_for_bonded_ethdev(&rte_eth_devices[port_id]) == 0 && -- mode == BONDING_MODE_8023AD) { -+ /* Verify that slave_port_id refers to a non bonded port */ -+ if (check_for_bonded_ethdev(&rte_eth_devices[slave_port_id]) == 0 && -+ internals->mode == BONDING_MODE_8023AD) { - RTE_BOND_LOG(ERR, "Cannot add slave to bonded device in 802.3ad" - " mode as slave is also a bonded device, only " - "physical devices can be support in this mode."); - return -1; - } - -+ if (internals->port_id == slave_port_id) { -+ RTE_BOND_LOG(ERR, -+ "Cannot add the bonded device itself as its slave."); -+ return -1; -+ } -+ - return 0; - } - -@@ -456,7 +462,7 @@ __eth_bond_slave_add_lock_free(uint16_t bonded_port_id, uint16_t slave_port_id) - bonded_eth_dev = &rte_eth_devices[bonded_port_id]; - internals = bonded_eth_dev->data->dev_private; - -- if (valid_slave_port_id(slave_port_id, internals->mode) != 0) -+ if (valid_slave_port_id(internals, slave_port_id) != 0) - return -1; - - slave_eth_dev = &rte_eth_devices[slave_port_id]; -@@ -605,13 +611,15 @@ rte_eth_bond_slave_add(uint16_t bonded_port_id, uint16_t slave_port_id) - - int retval; - -- /* Verify that port id's are valid bonded and slave ports */ - if (valid_bonded_port_id(bonded_port_id) != 0) - return -1; - - bonded_eth_dev = &rte_eth_devices[bonded_port_id]; - internals = bonded_eth_dev->data->dev_private; - -+ if (valid_slave_port_id(internals, slave_port_id) != 0) -+ return -1; -+ - rte_spinlock_lock(&internals->lock); - - retval = __eth_bond_slave_add_lock_free(bonded_port_id, slave_port_id); -@@ -635,7 +643,7 @@ __eth_bond_slave_remove_lock_free(uint16_t bonded_port_id, - bonded_eth_dev = &rte_eth_devices[bonded_port_id]; - internals = bonded_eth_dev->data->dev_private; - -- if (valid_slave_port_id(slave_port_id, internals->mode) < 0) -+ if (valid_slave_port_id(internals, slave_port_id) < 0) - return -1; - - /* first remove from active slave list */ -@@ -783,7 +791,7 @@ rte_eth_bond_primary_set(uint16_t bonded_port_id, uint16_t slave_port_id) - - internals = rte_eth_devices[bonded_port_id].data->dev_private; - -- if (valid_slave_port_id(slave_port_id, internals->mode) != 0) -+ if (valid_slave_port_id(internals, slave_port_id) != 0) - return -1; - - internals->user_defined_primary_port = 1; --- -2.7.4 - diff --git a/0173-app-testpmd-unify-name-of-L2-payload-offload.patch b/0173-app-testpmd-unify-name-of-L2-payload-offload.patch new file mode 100644 index 0000000000000000000000000000000000000000..383ce7d5dfd6ceca12a770eba7ee01402a4a002e --- /dev/null +++ b/0173-app-testpmd-unify-name-of-L2-payload-offload.patch @@ -0,0 +1,71 @@ +From d1bfba3efc17445439ba794a63643a57b9b5be5a Mon Sep 17 00:00:00 2001 +From: Huisong Li +Date: Fri, 21 Oct 2022 15:36:49 +0800 +Subject: [PATCH 173/189] app/testpmd: unify name of L2 payload offload + +Currently, the "port config all rss xx" command uses 'ether' name to match +and to set 'RTE_ETH_RSS_L2_PAYLOAD' offload. However, others RSS command, +such as, "port config rss-hash-key" and "show port +rss-hash key", use 'l2-payload' to represent this offload. So this patch +unifies the name of 'RTE_ETH_RSS_L2_PAYLOAD' offload. + +Signed-off-by: Huisong Li +Acked-by: Ferruh Yigit +--- + app/test-pmd/cmdline.c | 12 ++++++------ + doc/guides/testpmd_app_ug/testpmd_funcs.rst | 2 +- + 2 files changed, 7 insertions(+), 7 deletions(-) + +diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c +index 26d95e64e0..c5e4c30c9f 100644 +--- a/app/test-pmd/cmdline.c ++++ b/app/test-pmd/cmdline.c +@@ -793,8 +793,8 @@ static void cmd_help_long_parsed(void *parsed_result, + "receive buffers available.\n\n" + + "port config all rss (all|default|ip|tcp|udp|sctp|" +- "ether|port|vxlan|geneve|nvgre|vxlan-gpe|ecpri|mpls|none|level-default|" +- "level-outer|level-inner|)\n" ++ "l2-payload|port|vxlan|geneve|nvgre|vxlan-gpe|ecpri|mpls|ipv4-chksum|" ++ "none|level-default|level-outer|level-inner|)\n" + " Set the RSS mode.\n\n" + + "port config port-id rss reta (hash,queue)[,(hash,queue)]\n" +@@ -2187,7 +2187,7 @@ cmd_config_rss_parsed(void *parsed_result, + rss_conf.rss_hf = RTE_ETH_RSS_TCP; + else if (!strcmp(res->value, "sctp")) + rss_conf.rss_hf = RTE_ETH_RSS_SCTP; +- else if (!strcmp(res->value, "ether")) ++ else if (!strcmp(res->value, "l2_payload")) + rss_conf.rss_hf = RTE_ETH_RSS_L2_PAYLOAD; + else if (!strcmp(res->value, "port")) + rss_conf.rss_hf = RTE_ETH_RSS_PORT; +@@ -2308,9 +2308,9 @@ cmdline_parse_inst_t cmd_config_rss = { + .f = cmd_config_rss_parsed, + .data = NULL, + .help_str = "port config all rss " +- "all|default|eth|vlan|ip|tcp|udp|sctp|ether|port|vxlan|geneve|" +- "nvgre|vxlan-gpe|l2tpv3|esp|ah|pfcp|ecpri|mpls|none|level-default|" +- "level-outer|level-inner|ipv4-chksum|", ++ "all|default|eth|vlan|ip|tcp|udp|sctp|l2-payload|port|vxlan|geneve|" ++ "nvgre|vxlan-gpe|l2tpv3|esp|ah|pfcp|ecpri|mpls|ipv4-chksum|" ++ "none|level-default|level-outer|level-inner|", + .tokens = { + (void *)&cmd_config_rss_port, + (void *)&cmd_config_rss_keyword, +diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst +index 94792d88cc..b75adcce55 100644 +--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst ++++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst +@@ -2285,7 +2285,7 @@ port config - RSS + + Set the RSS (Receive Side Scaling) mode on or off:: + +- testpmd> port config all rss (all|default|eth|vlan|ip|tcp|udp|sctp|ether|port|vxlan|geneve|nvgre|vxlan-gpe|l2tpv3|esp|ah|pfcp|ecpri|mpls|none) ++ testpmd> port config all rss (all|default|eth|vlan|ip|tcp|udp|sctp|l2-payload|port|vxlan|geneve|nvgre|vxlan-gpe|l2tpv3|esp|ah|pfcp|ecpri|mpls|none) + + RSS is on by default. + +-- +2.23.0 + diff --git a/0173-ipc-use-monotonic-clock.patch b/0173-ipc-use-monotonic-clock.patch deleted file mode 100644 index ef750428d3b1cc292a2f9f23a5b9598d5fc613e4..0000000000000000000000000000000000000000 --- a/0173-ipc-use-monotonic-clock.patch +++ /dev/null @@ -1,128 +0,0 @@ -From 5b8e25a80cc320c15477a884ebb5abd15b60a246 Mon Sep 17 00:00:00 2001 -From: Chengwen Feng -Date: Tue, 11 May 2021 18:41:23 +0800 -Subject: [PATCH 173/189] ipc: use monotonic clock -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Currently, the mp uses gettimeofday() API to get the time, and used as -timeout parameter. - -But the time which gets from gettimeofday() API isn't monotonically -increasing. The process may fail if the system time is changed. - -This fixes it by using clock_gettime() API with monotonic attribution. - -Fixes: 783b6e54971d ("eal: add synchronous multi-process communication") -Fixes: f05e26051c15 ("eal: add IPC asynchronous request") -Cc: stable@dpdk.org - -Signed-off-by: Chengwen Feng -Signed-off-by: Min Hu (Connor) -Acked-by: Morten Brørup ---- - lib/librte_eal/common/eal_common_proc.c | 27 +++++++++++++-------------- - 1 file changed, 13 insertions(+), 14 deletions(-) - -diff --git a/lib/librte_eal/common/eal_common_proc.c b/lib/librte_eal/common/eal_common_proc.c -index 6d1af3c..dc4a2ef 100644 ---- a/lib/librte_eal/common/eal_common_proc.c -+++ b/lib/librte_eal/common/eal_common_proc.c -@@ -490,14 +490,11 @@ async_reply_handle_thread_unsafe(void *arg) - struct pending_request *req = (struct pending_request *)arg; - enum async_action action; - struct timespec ts_now; -- struct timeval now; - -- if (gettimeofday(&now, NULL) < 0) { -+ if (clock_gettime(CLOCK_MONOTONIC, &ts_now) < 0) { - RTE_LOG(ERR, EAL, "Cannot get current time\n"); - goto no_trigger; - } -- ts_now.tv_nsec = now.tv_usec * 1000; -- ts_now.tv_sec = now.tv_sec; - - action = process_async_request(req, &ts_now); - -@@ -896,6 +893,7 @@ mp_request_sync(const char *dst, struct rte_mp_msg *req, - struct rte_mp_reply *reply, const struct timespec *ts) - { - int ret; -+ pthread_condattr_t attr; - struct rte_mp_msg msg, *tmp; - struct pending_request pending_req, *exist; - -@@ -904,7 +902,9 @@ mp_request_sync(const char *dst, struct rte_mp_msg *req, - strlcpy(pending_req.dst, dst, sizeof(pending_req.dst)); - pending_req.request = req; - pending_req.reply = &msg; -- pthread_cond_init(&pending_req.sync.cond, NULL); -+ pthread_condattr_init(&attr); -+ pthread_condattr_setclock(&attr, CLOCK_MONOTONIC); -+ pthread_cond_init(&pending_req.sync.cond, &attr); - - exist = find_pending_request(dst, req->name); - if (exist) { -@@ -967,8 +967,7 @@ rte_mp_request_sync(struct rte_mp_msg *req, struct rte_mp_reply *reply, - int dir_fd, ret = -1; - DIR *mp_dir; - struct dirent *ent; -- struct timeval now; -- struct timespec end; -+ struct timespec now, end; - const struct internal_config *internal_conf = - eal_get_internal_configuration(); - -@@ -987,15 +986,15 @@ rte_mp_request_sync(struct rte_mp_msg *req, struct rte_mp_reply *reply, - return -1; - } - -- if (gettimeofday(&now, NULL) < 0) { -+ if (clock_gettime(CLOCK_MONOTONIC, &now) < 0) { - RTE_LOG(ERR, EAL, "Failed to get current time\n"); - rte_errno = errno; - goto end; - } - -- end.tv_nsec = (now.tv_usec * 1000 + ts->tv_nsec) % 1000000000; -+ end.tv_nsec = (now.tv_nsec + ts->tv_nsec) % 1000000000; - end.tv_sec = now.tv_sec + ts->tv_sec + -- (now.tv_usec * 1000 + ts->tv_nsec) / 1000000000; -+ (now.tv_nsec + ts->tv_nsec) / 1000000000; - - /* for secondary process, send request to the primary process only */ - if (rte_eal_process_type() == RTE_PROC_SECONDARY) { -@@ -1069,7 +1068,7 @@ rte_mp_request_async(struct rte_mp_msg *req, const struct timespec *ts, - int dir_fd, ret = 0; - DIR *mp_dir; - struct dirent *ent; -- struct timeval now; -+ struct timespec now; - struct timespec *end; - bool dummy_used = false; - const struct internal_config *internal_conf = -@@ -1086,7 +1085,7 @@ rte_mp_request_async(struct rte_mp_msg *req, const struct timespec *ts, - return -1; - } - -- if (gettimeofday(&now, NULL) < 0) { -+ if (clock_gettime(CLOCK_MONOTONIC, &now) < 0) { - RTE_LOG(ERR, EAL, "Failed to get current time\n"); - rte_errno = errno; - return -1; -@@ -1108,9 +1107,9 @@ rte_mp_request_async(struct rte_mp_msg *req, const struct timespec *ts, - end = ¶m->end; - reply = ¶m->user_reply; - -- end->tv_nsec = (now.tv_usec * 1000 + ts->tv_nsec) % 1000000000; -+ end->tv_nsec = (now.tv_nsec + ts->tv_nsec) % 1000000000; - end->tv_sec = now.tv_sec + ts->tv_sec + -- (now.tv_usec * 1000 + ts->tv_nsec) / 1000000000; -+ (now.tv_nsec + ts->tv_nsec) / 1000000000; - reply->nb_sent = 0; - reply->nb_received = 0; - reply->msgs = NULL; --- -2.7.4 - diff --git a/0174-app-testpmd-refactor-config-all-RSS-command.patch b/0174-app-testpmd-refactor-config-all-RSS-command.patch new file mode 100644 index 0000000000000000000000000000000000000000..a7ee60a54869c4af9ca255fc1d39604657a8dd16 --- /dev/null +++ b/0174-app-testpmd-refactor-config-all-RSS-command.patch @@ -0,0 +1,251 @@ +From 860c15e4347ca38d50f4ce9d3f00e744f090e4e8 Mon Sep 17 00:00:00 2001 +From: Huisong Li +Date: Fri, 21 Oct 2022 15:36:50 +0800 +Subject: [PATCH 174/189] app/testpmd: refactor config all RSS command + +The "port config rss-hash-key" and "show port +rss-hash key" commands both use the 'rss_type_table[]' to get +'rss_types' or the RSS type name. So this patch uses the +'rss_type_table[]' to get the RSS types. In this way, this command +naturally supports more individual types. + +Suggested-by: Ferruh Yigit +Signed-off-by: Huisong Li +Acked-by: Ferruh Yigit +--- + app/test-pmd/cmdline.c | 120 ++++++-------------- + app/test-pmd/config.c | 20 +++- + app/test-pmd/testpmd.h | 1 + + doc/guides/testpmd_app_ug/testpmd_funcs.rst | 10 +- + 4 files changed, 58 insertions(+), 93 deletions(-) + +diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c +index c5e4c30c9f..6cb095f965 100644 +--- a/app/test-pmd/cmdline.c ++++ b/app/test-pmd/cmdline.c +@@ -792,9 +792,14 @@ static void cmd_help_long_parsed(void *parsed_result, + " Enable or disable packet drop on all RX queues of all ports when no " + "receive buffers available.\n\n" + +- "port config all rss (all|default|ip|tcp|udp|sctp|" +- "l2-payload|port|vxlan|geneve|nvgre|vxlan-gpe|ecpri|mpls|ipv4-chksum|" +- "none|level-default|level-outer|level-inner|)\n" ++ "port config all rss (all|default|level-default|level-outer|level-inner|" ++ "ip|tcp|udp|sctp|tunnel|vlan|none|" ++ "ipv4|ipv4-frag|ipv4-tcp|ipv4-udp|ipv4-sctp|ipv4-other|" ++ "ipv6|ipv6-frag|ipv6-tcp|ipv6-udp|ipv6-sctp|ipv6-other|ipv6-ex|ipv6-tcp-ex|ipv6-udp-ex|" ++ "l2-payload|port|vxlan|geneve|nvgre|gtpu|eth|s-vlan|c-vlan|" ++ "esp|ah|l2tpv3|pfcp|pppoe|ecpri|mpls|ipv4-chksum|l4-chksum|" ++ "l3-pre96|l3-pre64|l3-pre56|l3-pre48|l3-pre40|l3-pre32|" ++ "l2-dst-only|l2-src-only|l4-dst-only|l4-src-only|l3-dst-only|l3-src-only|)\n" + " Set the RSS mode.\n\n" + + "port config port-id rss reta (hash,queue)[,(hash,queue)]\n" +@@ -2169,79 +2174,7 @@ cmd_config_rss_parsed(void *parsed_result, + uint16_t i; + int ret; + +- if (!strcmp(res->value, "all")) +- rss_conf.rss_hf = RTE_ETH_RSS_ETH | RTE_ETH_RSS_VLAN | RTE_ETH_RSS_IP | +- RTE_ETH_RSS_TCP | RTE_ETH_RSS_UDP | RTE_ETH_RSS_SCTP | +- RTE_ETH_RSS_L2_PAYLOAD | RTE_ETH_RSS_L2TPV3 | RTE_ETH_RSS_ESP | +- RTE_ETH_RSS_AH | RTE_ETH_RSS_PFCP | RTE_ETH_RSS_GTPU | +- RTE_ETH_RSS_ECPRI; +- else if (!strcmp(res->value, "eth")) +- rss_conf.rss_hf = RTE_ETH_RSS_ETH; +- else if (!strcmp(res->value, "vlan")) +- rss_conf.rss_hf = RTE_ETH_RSS_VLAN; +- else if (!strcmp(res->value, "ip")) +- rss_conf.rss_hf = RTE_ETH_RSS_IP; +- else if (!strcmp(res->value, "udp")) +- rss_conf.rss_hf = RTE_ETH_RSS_UDP; +- else if (!strcmp(res->value, "tcp")) +- rss_conf.rss_hf = RTE_ETH_RSS_TCP; +- else if (!strcmp(res->value, "sctp")) +- rss_conf.rss_hf = RTE_ETH_RSS_SCTP; +- else if (!strcmp(res->value, "l2_payload")) +- rss_conf.rss_hf = RTE_ETH_RSS_L2_PAYLOAD; +- else if (!strcmp(res->value, "port")) +- rss_conf.rss_hf = RTE_ETH_RSS_PORT; +- else if (!strcmp(res->value, "vxlan")) +- rss_conf.rss_hf = RTE_ETH_RSS_VXLAN; +- else if (!strcmp(res->value, "geneve")) +- rss_conf.rss_hf = RTE_ETH_RSS_GENEVE; +- else if (!strcmp(res->value, "nvgre")) +- rss_conf.rss_hf = RTE_ETH_RSS_NVGRE; +- else if (!strcmp(res->value, "l3-pre32")) +- rss_conf.rss_hf = RTE_ETH_RSS_L3_PRE32; +- else if (!strcmp(res->value, "l3-pre40")) +- rss_conf.rss_hf = RTE_ETH_RSS_L3_PRE40; +- else if (!strcmp(res->value, "l3-pre48")) +- rss_conf.rss_hf = RTE_ETH_RSS_L3_PRE48; +- else if (!strcmp(res->value, "l3-pre56")) +- rss_conf.rss_hf = RTE_ETH_RSS_L3_PRE56; +- else if (!strcmp(res->value, "l3-pre64")) +- rss_conf.rss_hf = RTE_ETH_RSS_L3_PRE64; +- else if (!strcmp(res->value, "l3-pre96")) +- rss_conf.rss_hf = RTE_ETH_RSS_L3_PRE96; +- else if (!strcmp(res->value, "l3-src-only")) +- rss_conf.rss_hf = RTE_ETH_RSS_L3_SRC_ONLY; +- else if (!strcmp(res->value, "l3-dst-only")) +- rss_conf.rss_hf = RTE_ETH_RSS_L3_DST_ONLY; +- else if (!strcmp(res->value, "l4-src-only")) +- rss_conf.rss_hf = RTE_ETH_RSS_L4_SRC_ONLY; +- else if (!strcmp(res->value, "l4-dst-only")) +- rss_conf.rss_hf = RTE_ETH_RSS_L4_DST_ONLY; +- else if (!strcmp(res->value, "l2-src-only")) +- rss_conf.rss_hf = RTE_ETH_RSS_L2_SRC_ONLY; +- else if (!strcmp(res->value, "l2-dst-only")) +- rss_conf.rss_hf = RTE_ETH_RSS_L2_DST_ONLY; +- else if (!strcmp(res->value, "l2tpv3")) +- rss_conf.rss_hf = RTE_ETH_RSS_L2TPV3; +- else if (!strcmp(res->value, "esp")) +- rss_conf.rss_hf = RTE_ETH_RSS_ESP; +- else if (!strcmp(res->value, "ah")) +- rss_conf.rss_hf = RTE_ETH_RSS_AH; +- else if (!strcmp(res->value, "pfcp")) +- rss_conf.rss_hf = RTE_ETH_RSS_PFCP; +- else if (!strcmp(res->value, "pppoe")) +- rss_conf.rss_hf = RTE_ETH_RSS_PPPOE; +- else if (!strcmp(res->value, "gtpu")) +- rss_conf.rss_hf = RTE_ETH_RSS_GTPU; +- else if (!strcmp(res->value, "ecpri")) +- rss_conf.rss_hf = RTE_ETH_RSS_ECPRI; +- else if (!strcmp(res->value, "mpls")) +- rss_conf.rss_hf = RTE_ETH_RSS_MPLS; +- else if (!strcmp(res->value, "ipv4-chksum")) +- rss_conf.rss_hf = RTE_ETH_RSS_IPV4_CHKSUM; +- else if (!strcmp(res->value, "none")) +- rss_conf.rss_hf = 0; +- else if (!strcmp(res->value, "level-default")) { ++ if (!strcmp(res->value, "level-default")) { + rss_hf &= (~RTE_ETH_RSS_LEVEL_MASK); + rss_conf.rss_hf = (rss_hf | RTE_ETH_RSS_LEVEL_PMD_DEFAULT); + } else if (!strcmp(res->value, "level-outer")) { +@@ -2250,14 +2183,24 @@ cmd_config_rss_parsed(void *parsed_result, + } else if (!strcmp(res->value, "level-inner")) { + rss_hf &= (~RTE_ETH_RSS_LEVEL_MASK); + rss_conf.rss_hf = (rss_hf | RTE_ETH_RSS_LEVEL_INNERMOST); +- } else if (!strcmp(res->value, "default")) ++ } else if (!strcmp(res->value, "default")) { + use_default = 1; +- else if (isdigit(res->value[0]) && atoi(res->value) > 0 && +- atoi(res->value) < 64) +- rss_conf.rss_hf = 1ULL << atoi(res->value); +- else { +- fprintf(stderr, "Unknown parameter\n"); +- return; ++ } else if (isdigit(res->value[0])) { ++ int value = atoi(res->value); ++ if (value > 0 && value < 64) ++ rss_conf.rss_hf = 1ULL << (uint8_t)value; ++ else { ++ fprintf(stderr, "flowtype_id should be greater than 0 and less than 64.\n"); ++ return; ++ } ++ } else if (!strcmp(res->value, "none")) { ++ rss_conf.rss_hf = 0; ++ } else { ++ rss_conf.rss_hf = str_to_rsstypes(res->value); ++ if (rss_conf.rss_hf == 0) { ++ fprintf(stderr, "Unknown parameter\n"); ++ return; ++ } + } + rss_conf.rss_key = NULL; + /* Update global configuration for RSS types. */ +@@ -2308,9 +2251,14 @@ cmdline_parse_inst_t cmd_config_rss = { + .f = cmd_config_rss_parsed, + .data = NULL, + .help_str = "port config all rss " +- "all|default|eth|vlan|ip|tcp|udp|sctp|l2-payload|port|vxlan|geneve|" +- "nvgre|vxlan-gpe|l2tpv3|esp|ah|pfcp|ecpri|mpls|ipv4-chksum|" +- "none|level-default|level-outer|level-inner|", ++ "all|default|level-default|level-outer|level-inner|" ++ "ip|tcp|udp|sctp|tunnel|vlan|none|" ++ "ipv4|ipv4-frag|ipv4-tcp|ipv4-udp|ipv4-sctp|ipv4-other|" ++ "ipv6|ipv6-frag|ipv6-tcp|ipv6-udp|ipv6-sctp|ipv6-other|ipv6-ex|ipv6-tcp-ex|ipv6-udp-ex|" ++ "l2-payload|port|vxlan|geneve|nvgre|gtpu|eth|s-vlan|c-vlan|" ++ "esp|ah|l2tpv3|pfcp|pppoe|ecpri|mpls|ipv4-chksum|l4-chksum|" ++ "l3-pre96|l3-pre64|l3-pre56|l3-pre48|l3-pre40|l3-pre32|" ++ "l2-dst-only|l2-src-only|l4-dst-only|l4-src-only|l3-dst-only|l3-src-only|", + .tokens = { + (void *)&cmd_config_rss_port, + (void *)&cmd_config_rss_keyword, +diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c +index 2849ee7e7c..b08face76d 100644 +--- a/app/test-pmd/config.c ++++ b/app/test-pmd/config.c +@@ -672,6 +672,19 @@ print_dev_capabilities(uint64_t capabilities) + } + } + ++uint64_t ++str_to_rsstypes(const char *str) ++{ ++ uint16_t i; ++ ++ for (i = 0; rss_type_table[i].str != NULL; i++) { ++ if (strcmp(rss_type_table[i].str, str) == 0) ++ return rss_type_table[i].rss_type; ++ } ++ ++ return 0; ++} ++ + const char * + rsstypes_to_str(uint64_t rss_type) + { +@@ -3063,15 +3076,10 @@ port_rss_hash_key_update(portid_t port_id, char rss_type[], uint8_t *hash_key, + { + struct rte_eth_rss_conf rss_conf; + int diag; +- unsigned int i; + + rss_conf.rss_key = NULL; + rss_conf.rss_key_len = 0; +- rss_conf.rss_hf = 0; +- for (i = 0; rss_type_table[i].str; i++) { +- if (!strcmp(rss_type_table[i].str, rss_type)) +- rss_conf.rss_hf = rss_type_table[i].rss_type; +- } ++ rss_conf.rss_hf = str_to_rsstypes(rss_type); + diag = rte_eth_dev_rss_hash_conf_get(port_id, &rss_conf); + if (diag == 0) { + rss_conf.rss_key = hash_key; +diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h +index d6a775c485..e50188778b 100644 +--- a/app/test-pmd/testpmd.h ++++ b/app/test-pmd/testpmd.h +@@ -1105,6 +1105,7 @@ extern int flow_parse(const char *src, void *result, unsigned int size, + struct rte_flow_item **pattern, + struct rte_flow_action **actions); + ++uint64_t str_to_rsstypes(const char *str); + const char *rsstypes_to_str(uint64_t rss_type); + + /* +diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst +index b75adcce55..e15dc0c4c4 100644 +--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst ++++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst +@@ -2285,7 +2285,15 @@ port config - RSS + + Set the RSS (Receive Side Scaling) mode on or off:: + +- testpmd> port config all rss (all|default|eth|vlan|ip|tcp|udp|sctp|l2-payload|port|vxlan|geneve|nvgre|vxlan-gpe|l2tpv3|esp|ah|pfcp|ecpri|mpls|none) ++ testpmd> port config all rss (all|default|level-default|level-outer|level-inner| \ ++ ip|tcp|udp|sctp|tunnel|vlan|none| \ ++ ipv4|ipv4-frag|ipv4-tcp|ipv4-udp|ipv4-sctp|ipv4-other| \ ++ ipv6|ipv6-frag|ipv6-tcp|ipv6-udp|ipv6-sctp| \ ++ ipv6-other|ipv6-ex|ipv6-tcp-ex|ipv6-udp-ex| \ ++ l2-payload|port|vxlan|geneve|nvgre|gtpu|eth|s-vlan|c-vlan| \ ++ esp|ah|l2tpv3|pfcp|pppoe|ecpri|mpls|ipv4-chksum|l4-chksum| \ ++ l3-pre96|l3-pre64|l3-pre56|l3-pre48|l3-pre40|l3-pre32| \ ++ l2-dst-only|l2-src-only|l4-dst-only|l4-src-only|l3-dst-only|l3-src-only|) + + RSS is on by default. + +-- +2.23.0 + diff --git a/0174-ethdev-add-queue-state-in-queried-queue-information.patch b/0174-ethdev-add-queue-state-in-queried-queue-information.patch deleted file mode 100644 index 8171cfa7fdffe20728c01ccac22749707174a6cc..0000000000000000000000000000000000000000 --- a/0174-ethdev-add-queue-state-in-queried-queue-information.patch +++ /dev/null @@ -1,120 +0,0 @@ -From 7516c1b63b53a27215a0206ae1437a3d5d5d0e08 Mon Sep 17 00:00:00 2001 -From: Lijun Ou -Date: Mon, 19 Apr 2021 16:57:30 +0800 -Subject: [PATCH 174/189] ethdev: add queue state in queried queue information - -Currently, upper-layer application could get queue state only -through pointers such as dev->data->tx_queue_state[queue_id], -this is not the recommended way to access it. So this patch -add get queue state when call rte_eth_rx_queue_info_get and -rte_eth_tx_queue_info_get API. - -Note: After add queue_state field, the 'struct rte_eth_rxq_info' size -remains 128B, and the 'struct rte_eth_txq_info' size remains 64B, so -it could be ABI compatible. - -Signed-off-by: Chengwen Feng -Signed-off-by: Lijun Ou -Acked-by: Konstantin Ananyev -Acked-by: Thomas Monjalon -Reviewed-by: Ferruh Yigit ---- - devtools/libabigail.abignore | 9 +++++++++ - lib/librte_ethdev/rte_ethdev.c | 3 +++ - lib/librte_ethdev/rte_ethdev.h | 9 +++++++++ - lib/librte_ethdev/rte_ethdev_driver.h | 7 ------- - 4 files changed, 21 insertions(+), 7 deletions(-) - -diff --git a/devtools/libabigail.abignore b/devtools/libabigail.abignore -index 025f2c0..b649af1 100644 ---- a/devtools/libabigail.abignore -+++ b/devtools/libabigail.abignore -@@ -7,3 +7,12 @@ - symbol_version = INTERNAL - [suppress_variable] - symbol_version = INTERNAL -+; Ignore fields inserted in alignment hole of rte_eth_rxq_info -+[suppress_type] -+ name = rte_eth_rxq_info -+ has_data_member_inserted_at = offset_after(scattered_rx) -+ -+; Ignore fields inserted in cacheline boundary of rte_eth_txq_info -+[suppress_type] -+ name = rte_eth_txq_info -+ has_data_member_inserted_between = {offset_after(nb_desc), end} -diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c -index f311868..87d1b56 100644 ---- a/lib/librte_ethdev/rte_ethdev.c -+++ b/lib/librte_ethdev/rte_ethdev.c -@@ -5023,6 +5023,8 @@ rte_eth_rx_queue_info_get(uint16_t port_id, uint16_t queue_id, - - memset(qinfo, 0, sizeof(*qinfo)); - dev->dev_ops->rxq_info_get(dev, queue_id, qinfo); -+ qinfo->queue_state = dev->data->rx_queue_state[queue_id]; -+ - return 0; - } - -@@ -5063,6 +5065,7 @@ rte_eth_tx_queue_info_get(uint16_t port_id, uint16_t queue_id, - - memset(qinfo, 0, sizeof(*qinfo)); - dev->dev_ops->txq_info_get(dev, queue_id, qinfo); -+ qinfo->queue_state = dev->data->tx_queue_state[queue_id]; - - return 0; - } -diff --git a/lib/librte_ethdev/rte_ethdev.h b/lib/librte_ethdev/rte_ethdev.h -index e89fc50..d9ab66d 100644 ---- a/lib/librte_ethdev/rte_ethdev.h -+++ b/lib/librte_ethdev/rte_ethdev.h -@@ -1562,6 +1562,13 @@ struct rte_eth_dev_info { - }; - - /** -+ * RX/TX queue states -+ */ -+#define RTE_ETH_QUEUE_STATE_STOPPED 0 -+#define RTE_ETH_QUEUE_STATE_STARTED 1 -+#define RTE_ETH_QUEUE_STATE_HAIRPIN 2 -+ -+/** - * Ethernet device RX queue information structure. - * Used to retrieve information about configured queue. - */ -@@ -1569,6 +1576,7 @@ struct rte_eth_rxq_info { - struct rte_mempool *mp; /**< mempool used by that queue. */ - struct rte_eth_rxconf conf; /**< queue config parameters. */ - uint8_t scattered_rx; /**< scattered packets RX supported. */ -+ uint8_t queue_state; /**< one of RTE_ETH_QUEUE_STATE_*. */ - uint16_t nb_desc; /**< configured number of RXDs. */ - uint16_t rx_buf_size; /**< hardware receive buffer size. */ - } __rte_cache_min_aligned; -@@ -1580,6 +1588,7 @@ struct rte_eth_rxq_info { - struct rte_eth_txq_info { - struct rte_eth_txconf conf; /**< queue config parameters. */ - uint16_t nb_desc; /**< configured number of TXDs. */ -+ uint8_t queue_state; /**< one of RTE_ETH_QUEUE_STATE_*. */ - } __rte_cache_min_aligned; - - /* Generic Burst mode flag definition, values can be ORed. */ -diff --git a/lib/librte_ethdev/rte_ethdev_driver.h b/lib/librte_ethdev/rte_ethdev_driver.h -index 0eacfd8..6d928a4 100644 ---- a/lib/librte_ethdev/rte_ethdev_driver.h -+++ b/lib/librte_ethdev/rte_ethdev_driver.h -@@ -920,13 +920,6 @@ struct eth_dev_ops { - }; - - /** -- * RX/TX queue states -- */ --#define RTE_ETH_QUEUE_STATE_STOPPED 0 --#define RTE_ETH_QUEUE_STATE_STARTED 1 --#define RTE_ETH_QUEUE_STATE_HAIRPIN 2 -- --/** - * @internal - * Check if the selected Rx queue is hairpin queue. - * --- -2.7.4 - diff --git a/0175-app-testpmd-fix-queue-stats-mapping-configuration.patch b/0175-app-testpmd-fix-queue-stats-mapping-configuration.patch deleted file mode 100644 index d84fc38759df2a931d9e91c30a21cb3cc3a69db7..0000000000000000000000000000000000000000 --- a/0175-app-testpmd-fix-queue-stats-mapping-configuration.patch +++ /dev/null @@ -1,769 +0,0 @@ -From f09441b0cd817ec53d5f059273e3266607de5bcd Mon Sep 17 00:00:00 2001 -From: Huisong Li -Date: Wed, 2 Dec 2020 20:48:55 +0800 -Subject: [PATCH 175/189] app/testpmd: fix queue stats mapping configuration - -Currently, the queue stats mapping has the following problems: -1) Many PMD drivers don't support queue stats mapping. But there is no - failure message after executing the command "set stat_qmap rx 0 2 2". -2) Once queue mapping is set, unrelated and unmapped queues are also - displayed. -3) The configuration result does not take effect or can not be queried - in real time. -4) The mapping arrays, "tx_queue_stats_mappings_array" & - "rx_queue_stats_mappings_array" are global and their sizes are based - on fixed max port and queue size assumptions. -5) These record structures, 'map_port_queue_stats_mapping_registers()' - and its sub functions are redundant for majority of drivers. -6) The display of the queue stats and queue stats mapping is mixed - together. - -Since xstats is used to obtain queue statistics, we have made the -following simplifications and adjustments: -1) If PMD requires and supports queue stats mapping, configure to driver - in real time by calling ethdev API after executing the command "set - stat_qmap rx/tx ...". If not, the command can not be accepted. -2) Based on the above adjustments, these record structures, - 'map_port_queue_stats_mapping_registers()' and its sub functions can - be removed. "tx-queue-stats-mapping" & "rx-queue-stats-mapping" - parameters, and 'parse_queue_stats_mapping_config()' can be removed - too. -3) remove display of queue stats mapping in 'fwd_stats_display()' & - 'nic_stats_display()', and obtain queue stats by xstats. Since the - record structures are removed, 'nic_stats_mapping_display()' can be - deleted. - -Fixes: 4dccdc789bf4 ("app/testpmd: simplify handling of stats mappings error") -Fixes: 013af9b6b64f ("app/testpmd: various updates") -Fixes: ed30d9b691b2 ("app/testpmd: add stats per queue") -Cc: stable@dpdk.org - -Signed-off-by: Huisong Li -Reviewed-by: Ferruh Yigit ---- - app/test-pmd/cmdline.c | 17 ++--- - app/test-pmd/config.c | 144 +++++----------------------------- - app/test-pmd/parameters.c | 107 -------------------------- - app/test-pmd/testpmd.c | 191 +++++----------------------------------------- - app/test-pmd/testpmd.h | 22 ------ - 5 files changed, 46 insertions(+), 435 deletions(-) - -diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c -index 0d2d6aa..2ccbaa0 100644 ---- a/app/test-pmd/cmdline.c -+++ b/app/test-pmd/cmdline.c -@@ -163,7 +163,7 @@ static void cmd_help_long_parsed(void *parsed_result, - "Display:\n" - "--------\n\n" - -- "show port (info|stats|summary|xstats|fdir|stat_qmap|dcb_tc|cap) (port_id|all)\n" -+ "show port (info|stats|summary|xstats|fdir|dcb_tc|cap) (port_id|all)\n" - " Display information for port_id, or all.\n\n" - - "show port port_id (module_eeprom|eeprom)\n" -@@ -177,7 +177,7 @@ static void cmd_help_long_parsed(void *parsed_result, - "show port (port_id) rss-hash [key]\n" - " Display the RSS hash functions and RSS hash key of port\n\n" - -- "clear port (info|stats|xstats|fdir|stat_qmap) (port_id|all)\n" -+ "clear port (info|stats|xstats|fdir) (port_id|all)\n" - " Clear information for port_id, or all.\n\n" - - "show (rxq|txq) info (port_id) (queue_id)\n" -@@ -7555,9 +7555,6 @@ static void cmd_showportall_parsed(void *parsed_result, - RTE_ETH_FOREACH_DEV(i) - fdir_get_infos(i); - #endif -- else if (!strcmp(res->what, "stat_qmap")) -- RTE_ETH_FOREACH_DEV(i) -- nic_stats_mapping_display(i); - else if (!strcmp(res->what, "dcb_tc")) - RTE_ETH_FOREACH_DEV(i) - port_dcb_info_display(i); -@@ -7573,14 +7570,14 @@ cmdline_parse_token_string_t cmd_showportall_port = - TOKEN_STRING_INITIALIZER(struct cmd_showportall_result, port, "port"); - cmdline_parse_token_string_t cmd_showportall_what = - TOKEN_STRING_INITIALIZER(struct cmd_showportall_result, what, -- "info#summary#stats#xstats#fdir#stat_qmap#dcb_tc#cap"); -+ "info#summary#stats#xstats#fdir#dcb_tc#cap"); - cmdline_parse_token_string_t cmd_showportall_all = - TOKEN_STRING_INITIALIZER(struct cmd_showportall_result, all, "all"); - cmdline_parse_inst_t cmd_showportall = { - .f = cmd_showportall_parsed, - .data = NULL, - .help_str = "show|clear port " -- "info|summary|stats|xstats|fdir|stat_qmap|dcb_tc|cap all", -+ "info|summary|stats|xstats|fdir|dcb_tc|cap all", - .tokens = { - (void *)&cmd_showportall_show, - (void *)&cmd_showportall_port, -@@ -7622,8 +7619,6 @@ static void cmd_showport_parsed(void *parsed_result, - else if (!strcmp(res->what, "fdir")) - fdir_get_infos(res->portnum); - #endif -- else if (!strcmp(res->what, "stat_qmap")) -- nic_stats_mapping_display(res->portnum); - else if (!strcmp(res->what, "dcb_tc")) - port_dcb_info_display(res->portnum); - else if (!strcmp(res->what, "cap")) -@@ -7637,7 +7632,7 @@ cmdline_parse_token_string_t cmd_showport_port = - TOKEN_STRING_INITIALIZER(struct cmd_showport_result, port, "port"); - cmdline_parse_token_string_t cmd_showport_what = - TOKEN_STRING_INITIALIZER(struct cmd_showport_result, what, -- "info#summary#stats#xstats#fdir#stat_qmap#dcb_tc#cap"); -+ "info#summary#stats#xstats#fdir#dcb_tc#cap"); - cmdline_parse_token_num_t cmd_showport_portnum = - TOKEN_NUM_INITIALIZER(struct cmd_showport_result, portnum, RTE_UINT16); - -@@ -7645,7 +7640,7 @@ cmdline_parse_inst_t cmd_showport = { - .f = cmd_showport_parsed, - .data = NULL, - .help_str = "show|clear port " -- "info|summary|stats|xstats|fdir|stat_qmap|dcb_tc|cap " -+ "info|summary|stats|xstats|fdir|dcb_tc|cap " - "", - .tokens = { - (void *)&cmd_showport_show, -diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c -index b51de59..3f6c864 100644 ---- a/app/test-pmd/config.c -+++ b/app/test-pmd/config.c -@@ -183,8 +183,6 @@ nic_stats_display(portid_t port_id) - diff_ns; - uint64_t mpps_rx, mpps_tx, mbps_rx, mbps_tx; - struct rte_eth_stats stats; -- struct rte_port *port = &ports[port_id]; -- uint8_t i; - - static const char *nic_stats_border = "########################"; - -@@ -196,46 +194,12 @@ nic_stats_display(portid_t port_id) - printf("\n %s NIC statistics for port %-2d %s\n", - nic_stats_border, port_id, nic_stats_border); - -- if ((!port->rx_queue_stats_mapping_enabled) && (!port->tx_queue_stats_mapping_enabled)) { -- printf(" RX-packets: %-10"PRIu64" RX-missed: %-10"PRIu64" RX-bytes: " -- "%-"PRIu64"\n", -- stats.ipackets, stats.imissed, stats.ibytes); -- printf(" RX-errors: %-"PRIu64"\n", stats.ierrors); -- printf(" RX-nombuf: %-10"PRIu64"\n", -- stats.rx_nombuf); -- printf(" TX-packets: %-10"PRIu64" TX-errors: %-10"PRIu64" TX-bytes: " -- "%-"PRIu64"\n", -- stats.opackets, stats.oerrors, stats.obytes); -- } -- else { -- printf(" RX-packets: %10"PRIu64" RX-errors: %10"PRIu64 -- " RX-bytes: %10"PRIu64"\n", -- stats.ipackets, stats.ierrors, stats.ibytes); -- printf(" RX-errors: %10"PRIu64"\n", stats.ierrors); -- printf(" RX-nombuf: %10"PRIu64"\n", -- stats.rx_nombuf); -- printf(" TX-packets: %10"PRIu64" TX-errors: %10"PRIu64 -- " TX-bytes: %10"PRIu64"\n", -- stats.opackets, stats.oerrors, stats.obytes); -- } -- -- if (port->rx_queue_stats_mapping_enabled) { -- printf("\n"); -- for (i = 0; i < RTE_ETHDEV_QUEUE_STAT_CNTRS; i++) { -- printf(" Stats reg %2d RX-packets: %10"PRIu64 -- " RX-errors: %10"PRIu64 -- " RX-bytes: %10"PRIu64"\n", -- i, stats.q_ipackets[i], stats.q_errors[i], stats.q_ibytes[i]); -- } -- } -- if (port->tx_queue_stats_mapping_enabled) { -- printf("\n"); -- for (i = 0; i < RTE_ETHDEV_QUEUE_STAT_CNTRS; i++) { -- printf(" Stats reg %2d TX-packets: %10"PRIu64 -- " TX-bytes: %10"PRIu64"\n", -- i, stats.q_opackets[i], stats.q_obytes[i]); -- } -- } -+ printf(" RX-packets: %-10"PRIu64" RX-missed: %-10"PRIu64" RX-bytes: " -+ "%-"PRIu64"\n", stats.ipackets, stats.imissed, stats.ibytes); -+ printf(" RX-errors: %-"PRIu64"\n", stats.ierrors); -+ printf(" RX-nombuf: %-10"PRIu64"\n", stats.rx_nombuf); -+ printf(" TX-packets: %-10"PRIu64" TX-errors: %-10"PRIu64" TX-bytes: " -+ "%-"PRIu64"\n", stats.opackets, stats.oerrors, stats.obytes); - - diff_ns = 0; - if (clock_gettime(CLOCK_TYPE_ID, &cur_time) == 0) { -@@ -399,54 +363,6 @@ nic_xstats_clear(portid_t port_id) - } - - void --nic_stats_mapping_display(portid_t port_id) --{ -- struct rte_port *port = &ports[port_id]; -- uint16_t i; -- -- static const char *nic_stats_mapping_border = "########################"; -- -- if (port_id_is_invalid(port_id, ENABLED_WARN)) { -- print_valid_ports(); -- return; -- } -- -- if ((!port->rx_queue_stats_mapping_enabled) && (!port->tx_queue_stats_mapping_enabled)) { -- printf("Port id %d - either does not support queue statistic mapping or" -- " no queue statistic mapping set\n", port_id); -- return; -- } -- -- printf("\n %s NIC statistics mapping for port %-2d %s\n", -- nic_stats_mapping_border, port_id, nic_stats_mapping_border); -- -- if (port->rx_queue_stats_mapping_enabled) { -- for (i = 0; i < nb_rx_queue_stats_mappings; i++) { -- if (rx_queue_stats_mappings[i].port_id == port_id) { -- printf(" RX-queue %2d mapped to Stats Reg %2d\n", -- rx_queue_stats_mappings[i].queue_id, -- rx_queue_stats_mappings[i].stats_counter_id); -- } -- } -- printf("\n"); -- } -- -- -- if (port->tx_queue_stats_mapping_enabled) { -- for (i = 0; i < nb_tx_queue_stats_mappings; i++) { -- if (tx_queue_stats_mappings[i].port_id == port_id) { -- printf(" TX-queue %2d mapped to Stats Reg %2d\n", -- tx_queue_stats_mappings[i].queue_id, -- tx_queue_stats_mappings[i].stats_counter_id); -- } -- } -- } -- -- printf(" %s####################################%s\n", -- nic_stats_mapping_border, nic_stats_mapping_border); --} -- --void - rx_queue_infos_display(portid_t port_id, uint16_t queue_id) - { - struct rte_eth_burst_mode mode; -@@ -2573,7 +2489,7 @@ tx_queue_id_is_invalid(queueid_t txq_id) - { - if (txq_id < nb_txq) - return 0; -- printf("Invalid TX queue %d (must be < nb_rxq=%d)\n", txq_id, nb_txq); -+ printf("Invalid TX queue %d (must be < nb_txq=%d)\n", txq_id, nb_txq); - return 1; - } - -@@ -4528,8 +4444,7 @@ tx_vlan_pvid_set(portid_t port_id, uint16_t vlan_id, int on) - void - set_qmap(portid_t port_id, uint8_t is_rx, uint16_t queue_id, uint8_t map_value) - { -- uint16_t i; -- uint8_t existing_mapping_found = 0; -+ int ret; - - if (port_id_is_invalid(port_id, ENABLED_WARN)) - return; -@@ -4539,40 +4454,23 @@ set_qmap(portid_t port_id, uint8_t is_rx, uint16_t queue_id, uint8_t map_value) - - if (map_value >= RTE_ETHDEV_QUEUE_STAT_CNTRS) { - printf("map_value not in required range 0..%d\n", -- RTE_ETHDEV_QUEUE_STAT_CNTRS - 1); -+ RTE_ETHDEV_QUEUE_STAT_CNTRS - 1); - return; - } - -- if (!is_rx) { /*then tx*/ -- for (i = 0; i < nb_tx_queue_stats_mappings; i++) { -- if ((tx_queue_stats_mappings[i].port_id == port_id) && -- (tx_queue_stats_mappings[i].queue_id == queue_id)) { -- tx_queue_stats_mappings[i].stats_counter_id = map_value; -- existing_mapping_found = 1; -- break; -- } -- } -- if (!existing_mapping_found) { /* A new additional mapping... */ -- tx_queue_stats_mappings[nb_tx_queue_stats_mappings].port_id = port_id; -- tx_queue_stats_mappings[nb_tx_queue_stats_mappings].queue_id = queue_id; -- tx_queue_stats_mappings[nb_tx_queue_stats_mappings].stats_counter_id = map_value; -- nb_tx_queue_stats_mappings++; -- } -- } -- else { /*rx*/ -- for (i = 0; i < nb_rx_queue_stats_mappings; i++) { -- if ((rx_queue_stats_mappings[i].port_id == port_id) && -- (rx_queue_stats_mappings[i].queue_id == queue_id)) { -- rx_queue_stats_mappings[i].stats_counter_id = map_value; -- existing_mapping_found = 1; -- break; -- } -+ if (!is_rx) { /* tx */ -+ ret = rte_eth_dev_set_tx_queue_stats_mapping(port_id, queue_id, -+ map_value); -+ if (ret) { -+ printf("failed to set tx queue stats mapping.\n"); -+ return; - } -- if (!existing_mapping_found) { /* A new additional mapping... */ -- rx_queue_stats_mappings[nb_rx_queue_stats_mappings].port_id = port_id; -- rx_queue_stats_mappings[nb_rx_queue_stats_mappings].queue_id = queue_id; -- rx_queue_stats_mappings[nb_rx_queue_stats_mappings].stats_counter_id = map_value; -- nb_rx_queue_stats_mappings++; -+ } else { /* rx */ -+ ret = rte_eth_dev_set_rx_queue_stats_mapping(port_id, queue_id, -+ map_value); -+ if (ret) { -+ printf("failed to set rx queue stats mapping.\n"); -+ return; - } - } - } -diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c -index bbb68a5..414a006 100644 ---- a/app/test-pmd/parameters.c -+++ b/app/test-pmd/parameters.c -@@ -176,12 +176,6 @@ usage(char* progname) - "(0 <= N <= value of txd).\n"); - printf(" --txrst=N: set the transmit RS bit threshold of TX rings to N " - "(0 <= N <= value of txd).\n"); -- printf(" --tx-queue-stats-mapping=(port,queue,mapping)[,(port,queue,mapping]: " -- "tx queues statistics counters mapping " -- "(0 <= mapping <= %d).\n", RTE_ETHDEV_QUEUE_STAT_CNTRS - 1); -- printf(" --rx-queue-stats-mapping=(port,queue,mapping)[,(port,queue,mapping]: " -- "rx queues statistics counters mapping " -- "(0 <= mapping <= %d).\n", RTE_ETHDEV_QUEUE_STAT_CNTRS - 1); - printf(" --no-flush-rx: Don't flush RX streams before forwarding." - " Used mainly with PCAP drivers.\n"); - printf(" --rxoffs=X[,Y]*: set RX segment offsets for split.\n"); -@@ -300,93 +294,6 @@ parse_fwd_portmask(const char *portmask) - set_fwd_ports_mask((uint64_t) pm); - } - -- --static int --parse_queue_stats_mapping_config(const char *q_arg, int is_rx) --{ -- char s[256]; -- const char *p, *p0 = q_arg; -- char *end; -- enum fieldnames { -- FLD_PORT = 0, -- FLD_QUEUE, -- FLD_STATS_COUNTER, -- _NUM_FLD -- }; -- unsigned long int_fld[_NUM_FLD]; -- char *str_fld[_NUM_FLD]; -- int i; -- unsigned size; -- -- /* reset from value set at definition */ -- is_rx ? (nb_rx_queue_stats_mappings = 0) : (nb_tx_queue_stats_mappings = 0); -- -- while ((p = strchr(p0,'(')) != NULL) { -- ++p; -- if((p0 = strchr(p,')')) == NULL) -- return -1; -- -- size = p0 - p; -- if(size >= sizeof(s)) -- return -1; -- -- snprintf(s, sizeof(s), "%.*s", size, p); -- if (rte_strsplit(s, sizeof(s), str_fld, _NUM_FLD, ',') != _NUM_FLD) -- return -1; -- for (i = 0; i < _NUM_FLD; i++){ -- errno = 0; -- int_fld[i] = strtoul(str_fld[i], &end, 0); -- if (errno != 0 || end == str_fld[i] || int_fld[i] > 255) -- return -1; -- } -- /* Check mapping field is in correct range (0..RTE_ETHDEV_QUEUE_STAT_CNTRS-1) */ -- if (int_fld[FLD_STATS_COUNTER] >= RTE_ETHDEV_QUEUE_STAT_CNTRS) { -- printf("Stats counter not in the correct range 0..%d\n", -- RTE_ETHDEV_QUEUE_STAT_CNTRS - 1); -- return -1; -- } -- -- if (!is_rx) { -- if ((nb_tx_queue_stats_mappings >= -- MAX_TX_QUEUE_STATS_MAPPINGS)) { -- printf("exceeded max number of TX queue " -- "statistics mappings: %hu\n", -- nb_tx_queue_stats_mappings); -- return -1; -- } -- tx_queue_stats_mappings_array[nb_tx_queue_stats_mappings].port_id = -- (uint8_t)int_fld[FLD_PORT]; -- tx_queue_stats_mappings_array[nb_tx_queue_stats_mappings].queue_id = -- (uint8_t)int_fld[FLD_QUEUE]; -- tx_queue_stats_mappings_array[nb_tx_queue_stats_mappings].stats_counter_id = -- (uint8_t)int_fld[FLD_STATS_COUNTER]; -- ++nb_tx_queue_stats_mappings; -- } -- else { -- if ((nb_rx_queue_stats_mappings >= -- MAX_RX_QUEUE_STATS_MAPPINGS)) { -- printf("exceeded max number of RX queue " -- "statistics mappings: %hu\n", -- nb_rx_queue_stats_mappings); -- return -1; -- } -- rx_queue_stats_mappings_array[nb_rx_queue_stats_mappings].port_id = -- (uint8_t)int_fld[FLD_PORT]; -- rx_queue_stats_mappings_array[nb_rx_queue_stats_mappings].queue_id = -- (uint8_t)int_fld[FLD_QUEUE]; -- rx_queue_stats_mappings_array[nb_rx_queue_stats_mappings].stats_counter_id = -- (uint8_t)int_fld[FLD_STATS_COUNTER]; -- ++nb_rx_queue_stats_mappings; -- } -- -- } --/* Reassign the rx/tx_queue_stats_mappings pointer to point to this newly populated array rather */ --/* than to the default array (that was set at its definition) */ -- is_rx ? (rx_queue_stats_mappings = rx_queue_stats_mappings_array) : -- (tx_queue_stats_mappings = tx_queue_stats_mappings_array); -- return 0; --} -- - static void - print_invalid_socket_id_error(void) - { -@@ -664,8 +571,6 @@ launch_args_parse(int argc, char** argv) - { "rxht", 1, 0, 0 }, - { "rxwt", 1, 0, 0 }, - { "rxfreet", 1, 0, 0 }, -- { "tx-queue-stats-mapping", 1, 0, 0 }, -- { "rx-queue-stats-mapping", 1, 0, 0 }, - { "no-flush-rx", 0, 0, 0 }, - { "flow-isolate-all", 0, 0, 0 }, - { "rxoffs", 1, 0, 0 }, -@@ -1279,18 +1184,6 @@ launch_args_parse(int argc, char** argv) - else - rte_exit(EXIT_FAILURE, "rxfreet must be >= 0\n"); - } -- if (!strcmp(lgopts[opt_idx].name, "tx-queue-stats-mapping")) { -- if (parse_queue_stats_mapping_config(optarg, TX)) { -- rte_exit(EXIT_FAILURE, -- "invalid TX queue statistics mapping config entered\n"); -- } -- } -- if (!strcmp(lgopts[opt_idx].name, "rx-queue-stats-mapping")) { -- if (parse_queue_stats_mapping_config(optarg, RX)) { -- rte_exit(EXIT_FAILURE, -- "invalid RX queue statistics mapping config entered\n"); -- } -- } - if (!strcmp(lgopts[opt_idx].name, "rxoffs")) { - unsigned int seg_off[MAX_SEGS_BUFFER_SPLIT]; - unsigned int nb_offs; -diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c -index 33fc0fd..33a060d 100644 ---- a/app/test-pmd/testpmd.c -+++ b/app/test-pmd/testpmd.c -@@ -476,15 +476,6 @@ struct rte_fdir_conf fdir_conf = { - - volatile int test_done = 1; /* stop packet forwarding when set to 1. */ - --struct queue_stats_mappings tx_queue_stats_mappings_array[MAX_TX_QUEUE_STATS_MAPPINGS]; --struct queue_stats_mappings rx_queue_stats_mappings_array[MAX_RX_QUEUE_STATS_MAPPINGS]; -- --struct queue_stats_mappings *tx_queue_stats_mappings = tx_queue_stats_mappings_array; --struct queue_stats_mappings *rx_queue_stats_mappings = rx_queue_stats_mappings_array; -- --uint16_t nb_tx_queue_stats_mappings = 0; --uint16_t nb_rx_queue_stats_mappings = 0; -- - /* - * Display zero values by default for xstats - */ -@@ -520,8 +511,6 @@ enum rte_eth_rx_mq_mode rx_mq_mode = ETH_MQ_RX_VMDQ_DCB_RSS; - - /* Forward function declarations */ - static void setup_attached_port(portid_t pi); --static void map_port_queue_stats_mapping_registers(portid_t pi, -- struct rte_port *port); - static void check_all_ports_link_status(uint32_t port_mask); - static int eth_event_callback(portid_t port_id, - enum rte_eth_event_type type, -@@ -1857,8 +1846,6 @@ fwd_stats_display(void) - fwd_cycles += fs->core_cycles; - } - for (i = 0; i < cur_fwd_config.nb_fwd_ports; i++) { -- uint8_t j; -- - pt_id = fwd_ports_ids[i]; - port = &ports[pt_id]; - -@@ -1881,88 +1868,34 @@ fwd_stats_display(void) - printf("\n %s Forward statistics for port %-2d %s\n", - fwd_stats_border, pt_id, fwd_stats_border); - -- if (!port->rx_queue_stats_mapping_enabled && -- !port->tx_queue_stats_mapping_enabled) { -- printf(" RX-packets: %-14"PRIu64 -- " RX-dropped: %-14"PRIu64 -- "RX-total: %-"PRIu64"\n", -- stats.ipackets, stats.imissed, -- stats.ipackets + stats.imissed); -- -- if (cur_fwd_eng == &csum_fwd_engine) -- printf(" Bad-ipcsum: %-14"PRIu64 -- " Bad-l4csum: %-14"PRIu64 -- "Bad-outer-l4csum: %-14"PRIu64"\n", -- ports_stats[pt_id].rx_bad_ip_csum, -- ports_stats[pt_id].rx_bad_l4_csum, -- ports_stats[pt_id].rx_bad_outer_l4_csum); -- if (stats.ierrors + stats.rx_nombuf > 0) { -- printf(" RX-error: %-"PRIu64"\n", -- stats.ierrors); -- printf(" RX-nombufs: %-14"PRIu64"\n", -- stats.rx_nombuf); -- } -+ printf(" RX-packets: %-14"PRIu64" RX-dropped: %-14"PRIu64 -+ "RX-total: %-"PRIu64"\n", stats.ipackets, stats.imissed, -+ stats.ipackets + stats.imissed); - -- printf(" TX-packets: %-14"PRIu64 -- " TX-dropped: %-14"PRIu64 -- "TX-total: %-"PRIu64"\n", -- stats.opackets, ports_stats[pt_id].tx_dropped, -- stats.opackets + ports_stats[pt_id].tx_dropped); -- } else { -- printf(" RX-packets: %14"PRIu64 -- " RX-dropped:%14"PRIu64 -- " RX-total:%14"PRIu64"\n", -- stats.ipackets, stats.imissed, -- stats.ipackets + stats.imissed); -- -- if (cur_fwd_eng == &csum_fwd_engine) -- printf(" Bad-ipcsum:%14"PRIu64 -- " Bad-l4csum:%14"PRIu64 -- " Bad-outer-l4csum: %-14"PRIu64"\n", -- ports_stats[pt_id].rx_bad_ip_csum, -- ports_stats[pt_id].rx_bad_l4_csum, -- ports_stats[pt_id].rx_bad_outer_l4_csum); -- if ((stats.ierrors + stats.rx_nombuf) > 0) { -- printf(" RX-error:%"PRIu64"\n", stats.ierrors); -- printf(" RX-nombufs: %14"PRIu64"\n", -- stats.rx_nombuf); -- } -- -- printf(" TX-packets: %14"PRIu64 -- " TX-dropped:%14"PRIu64 -- " TX-total:%14"PRIu64"\n", -- stats.opackets, ports_stats[pt_id].tx_dropped, -- stats.opackets + ports_stats[pt_id].tx_dropped); -+ if (cur_fwd_eng == &csum_fwd_engine) -+ printf(" Bad-ipcsum: %-14"PRIu64 -+ " Bad-l4csum: %-14"PRIu64 -+ "Bad-outer-l4csum: %-14"PRIu64"\n", -+ ports_stats[pt_id].rx_bad_ip_csum, -+ ports_stats[pt_id].rx_bad_l4_csum, -+ ports_stats[pt_id].rx_bad_outer_l4_csum); -+ if (stats.ierrors + stats.rx_nombuf > 0) { -+ printf(" RX-error: %-"PRIu64"\n", stats.ierrors); -+ printf(" RX-nombufs: %-14"PRIu64"\n", stats.rx_nombuf); - } - -+ printf(" TX-packets: %-14"PRIu64" TX-dropped: %-14"PRIu64 -+ "TX-total: %-"PRIu64"\n", -+ stats.opackets, ports_stats[pt_id].tx_dropped, -+ stats.opackets + ports_stats[pt_id].tx_dropped); -+ - if (record_burst_stats) { - if (ports_stats[pt_id].rx_stream) - pkt_burst_stats_display("RX", - &ports_stats[pt_id].rx_stream->rx_burst_stats); - if (ports_stats[pt_id].tx_stream) - pkt_burst_stats_display("TX", -- &ports_stats[pt_id].tx_stream->tx_burst_stats); -- } -- -- if (port->rx_queue_stats_mapping_enabled) { -- printf("\n"); -- for (j = 0; j < RTE_ETHDEV_QUEUE_STAT_CNTRS; j++) { -- printf(" Stats reg %2d RX-packets:%14"PRIu64 -- " RX-errors:%14"PRIu64 -- " RX-bytes:%14"PRIu64"\n", -- j, stats.q_ipackets[j], -- stats.q_errors[j], stats.q_ibytes[j]); -- } -- printf("\n"); -- } -- if (port->tx_queue_stats_mapping_enabled) { -- for (j = 0; j < RTE_ETHDEV_QUEUE_STAT_CNTRS; j++) { -- printf(" Stats reg %2d TX-packets:%14"PRIu64 -- " TX-bytes:%14" -- PRIu64"\n", -- j, stats.q_opackets[j], -- stats.q_obytes[j]); -- } -+ &ports_stats[pt_id].tx_stream->tx_burst_stats); - } - - printf(" %s--------------------------------%s\n", -@@ -2236,11 +2169,6 @@ start_packet_forwarding(int with_tx_first) - rxtx_config_display(); - - fwd_stats_reset(); -- for (i = 0; i < cur_fwd_config.nb_fwd_ports; i++) { -- pt_id = fwd_ports_ids[i]; -- port = &ports[pt_id]; -- map_port_queue_stats_mapping_registers(pt_id, port); -- } - if (with_tx_first) { - port_fwd_begin = tx_only_engine.port_fwd_begin; - if (port_fwd_begin != NULL) { -@@ -3352,84 +3280,6 @@ dev_event_callback(const char *device_name, enum rte_dev_event_type type, - } - } - --static int --set_tx_queue_stats_mapping_registers(portid_t port_id, struct rte_port *port) --{ -- uint16_t i; -- int diag; -- uint8_t mapping_found = 0; -- -- for (i = 0; i < nb_tx_queue_stats_mappings; i++) { -- if ((tx_queue_stats_mappings[i].port_id == port_id) && -- (tx_queue_stats_mappings[i].queue_id < nb_txq )) { -- diag = rte_eth_dev_set_tx_queue_stats_mapping(port_id, -- tx_queue_stats_mappings[i].queue_id, -- tx_queue_stats_mappings[i].stats_counter_id); -- if (diag != 0) -- return diag; -- mapping_found = 1; -- } -- } -- if (mapping_found) -- port->tx_queue_stats_mapping_enabled = 1; -- return 0; --} -- --static int --set_rx_queue_stats_mapping_registers(portid_t port_id, struct rte_port *port) --{ -- uint16_t i; -- int diag; -- uint8_t mapping_found = 0; -- -- for (i = 0; i < nb_rx_queue_stats_mappings; i++) { -- if ((rx_queue_stats_mappings[i].port_id == port_id) && -- (rx_queue_stats_mappings[i].queue_id < nb_rxq )) { -- diag = rte_eth_dev_set_rx_queue_stats_mapping(port_id, -- rx_queue_stats_mappings[i].queue_id, -- rx_queue_stats_mappings[i].stats_counter_id); -- if (diag != 0) -- return diag; -- mapping_found = 1; -- } -- } -- if (mapping_found) -- port->rx_queue_stats_mapping_enabled = 1; -- return 0; --} -- --static void --map_port_queue_stats_mapping_registers(portid_t pi, struct rte_port *port) --{ -- int diag = 0; -- -- diag = set_tx_queue_stats_mapping_registers(pi, port); -- if (diag != 0) { -- if (diag == -ENOTSUP) { -- port->tx_queue_stats_mapping_enabled = 0; -- printf("TX queue stats mapping not supported port id=%d\n", pi); -- } -- else -- rte_exit(EXIT_FAILURE, -- "set_tx_queue_stats_mapping_registers " -- "failed for port id=%d diag=%d\n", -- pi, diag); -- } -- -- diag = set_rx_queue_stats_mapping_registers(pi, port); -- if (diag != 0) { -- if (diag == -ENOTSUP) { -- port->rx_queue_stats_mapping_enabled = 0; -- printf("RX queue stats mapping not supported port id=%d\n", pi); -- } -- else -- rte_exit(EXIT_FAILURE, -- "set_rx_queue_stats_mapping_registers " -- "failed for port id=%d diag=%d\n", -- pi, diag); -- } --} -- - static void - rxtx_port_config(struct rte_port *port) - { -@@ -3526,7 +3376,6 @@ init_port_config(void) - if (ret != 0) - return; - -- map_port_queue_stats_mapping_registers(pid, port); - #if defined RTE_NET_IXGBE && defined RTE_LIBRTE_IXGBE_BYPASS - rte_pmd_ixgbe_bypass_init(pid); - #endif -@@ -3737,8 +3586,6 @@ init_port_dcb_config(portid_t pid, - if (retval != 0) - return retval; - -- map_port_queue_stats_mapping_registers(pid, rte_port); -- - rte_port->dcb_flag = 1; - - return 0; -diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h -index 6b901a8..5f23162 100644 ---- a/app/test-pmd/testpmd.h -+++ b/app/test-pmd/testpmd.h -@@ -206,8 +206,6 @@ struct rte_port { - uint16_t tunnel_tso_segsz; /**< Segmentation offload MSS for tunneled pkts. */ - uint16_t tx_vlan_id;/**< The tag ID */ - uint16_t tx_vlan_id_outer;/**< The outer tag ID */ -- uint8_t tx_queue_stats_mapping_enabled; -- uint8_t rx_queue_stats_mapping_enabled; - volatile uint16_t port_status; /**< port started or not */ - uint8_t need_setup; /**< port just attached */ - uint8_t need_reconfig; /**< need reconfiguring port or not */ -@@ -326,25 +324,6 @@ enum dcb_mode_enable - DCB_ENABLED - }; - --#define MAX_TX_QUEUE_STATS_MAPPINGS 1024 /* MAX_PORT of 32 @ 32 tx_queues/port */ --#define MAX_RX_QUEUE_STATS_MAPPINGS 4096 /* MAX_PORT of 32 @ 128 rx_queues/port */ -- --struct queue_stats_mappings { -- portid_t port_id; -- uint16_t queue_id; -- uint8_t stats_counter_id; --} __rte_cache_aligned; -- --extern struct queue_stats_mappings tx_queue_stats_mappings_array[]; --extern struct queue_stats_mappings rx_queue_stats_mappings_array[]; -- --/* Assign both tx and rx queue stats mappings to the same default values */ --extern struct queue_stats_mappings *tx_queue_stats_mappings; --extern struct queue_stats_mappings *rx_queue_stats_mappings; -- --extern uint16_t nb_tx_queue_stats_mappings; --extern uint16_t nb_rx_queue_stats_mappings; -- - extern uint8_t xstats_hide_zero; /**< Hide zero values for xstats display */ - - /* globals used for configuration */ -@@ -790,7 +769,6 @@ void nic_stats_display(portid_t port_id); - void nic_stats_clear(portid_t port_id); - void nic_xstats_display(portid_t port_id); - void nic_xstats_clear(portid_t port_id); --void nic_stats_mapping_display(portid_t port_id); - void device_infos_display(const char *identifier); - void port_infos_display(portid_t port_id); - void port_summary_display(portid_t port_id); --- -2.7.4 - diff --git a/0175-app-testpmd-unify-RSS-types-display.patch b/0175-app-testpmd-unify-RSS-types-display.patch new file mode 100644 index 0000000000000000000000000000000000000000..80c5273c8dd858f660ccb3ddcdd4f40ba09514ac --- /dev/null +++ b/0175-app-testpmd-unify-RSS-types-display.patch @@ -0,0 +1,76 @@ +From 6515c3f93ea7b5f5ef79f32ca7360b9edfc5e2ab Mon Sep 17 00:00:00 2001 +From: Huisong Li +Date: Fri, 21 Oct 2022 15:36:51 +0800 +Subject: [PATCH 175/189] app/testpmd: unify RSS types display + +The 'rss_type_table[]' maintains the name and value of RSS types. This +patch unifies a common interface to display RSS types. + +Signed-off-by: Huisong Li +Signed-off-by: Ferruh Yigit +--- + app/test-pmd/config.c | 34 ++++++++++++++++++++-------------- + 1 file changed, 20 insertions(+), 14 deletions(-) + +diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c +index b08face76d..7b725fc7a1 100644 +--- a/app/test-pmd/config.c ++++ b/app/test-pmd/config.c +@@ -1554,6 +1554,23 @@ port_flow_complain(struct rte_flow_error *error) + return -err; + } + ++static void ++rss_types_display(uint64_t rss_types) ++{ ++ uint16_t i; ++ ++ if (rss_types == 0) ++ return; ++ ++ for (i = 0; rss_type_table[i].str; i++) { ++ if (rss_type_table[i].rss_type == 0) ++ continue; ++ if ((rss_types & rss_type_table[i].rss_type) == ++ rss_type_table[i].rss_type) ++ printf(" %s", rss_type_table[i].str); ++ } ++} ++ + static void + rss_config_display(struct rte_flow_action_rss *rss_conf) + { +@@ -1596,13 +1613,7 @@ rss_config_display(struct rte_flow_action_rss *rss_conf) + printf(" none\n"); + return; + } +- for (i = 0; rss_type_table[i].str; i++) { +- if ((rss_conf->types & +- rss_type_table[i].rss_type) == +- rss_type_table[i].rss_type && +- rss_type_table[i].rss_type != 0) +- printf(" %s\n", rss_type_table[i].str); +- } ++ rss_types_display(rss_conf->types); + } + + static struct port_indirect_action * +@@ -3054,13 +3065,8 @@ port_rss_hash_conf_show(portid_t port_id, int show_rss_key) + printf("RSS disabled\n"); + return; + } +- printf("RSS functions:\n "); +- for (i = 0; rss_type_table[i].str; i++) { +- if (rss_type_table[i].rss_type == 0) +- continue; +- if ((rss_hf & rss_type_table[i].rss_type) == rss_type_table[i].rss_type) +- printf("%s ", rss_type_table[i].str); +- } ++ printf("RSS functions:\n"); ++ rss_types_display(rss_hf); + printf("\n"); + if (!show_rss_key) + return; +-- +2.23.0 + diff --git a/0176-app-testpmd-compact-RSS-types-output.patch b/0176-app-testpmd-compact-RSS-types-output.patch new file mode 100644 index 0000000000000000000000000000000000000000..1f4414600a6518309b9c62dc0f40cccd36c3b30f --- /dev/null +++ b/0176-app-testpmd-compact-RSS-types-output.patch @@ -0,0 +1,165 @@ +From ce06141d60c64963a7dc02fbdd9b2229d38a6819 Mon Sep 17 00:00:00 2001 +From: Ferruh Yigit +Date: Fri, 21 Oct 2022 15:36:52 +0800 +Subject: [PATCH 176/189] app/testpmd: compact RSS types output + +In port info command output, 'show port info all', supported RSS offload +types printed one type per line, and although this information is not +most important part of the command it takes big part of the command +output. + +In port RSS hash and flow RSS command output, 'show port 0 rss-hash', +and 'flow query 0 0 rss', all enabled RSS types are printed on one line. +If there are many types, the print will be very long. + +Compacting these RSS offloads and types output by fixing the length of +the character string printed on each line, instead of one per line or +one line. +Output becomes as following: + +Supported RSS offload flow types: + ipv4-frag ipv4-tcp ipv4-udp ipv4-sctp ipv4-other + ipv6-frag ipv6-tcp ipv6-udp ipv6-sctp ipv6-other + l4-dst-only l4-src-only l3-dst-only l3-src-only + +Signed-off-by: Ferruh Yigit +Signed-off-by: Huisong Li +--- + app/test-pmd/config.c | 68 +++++++++++++++++++++++++++++++----------- + app/test-pmd/testpmd.h | 2 ++ + 2 files changed, 52 insertions(+), 18 deletions(-) + +diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c +index 7b725fc7a1..873cca6f3e 100644 +--- a/app/test-pmd/config.c ++++ b/app/test-pmd/config.c +@@ -698,6 +698,38 @@ rsstypes_to_str(uint64_t rss_type) + return NULL; + } + ++static void ++rss_offload_types_display(uint64_t offload_types, uint16_t char_num_per_line) ++{ ++ uint16_t user_defined_str_len; ++ uint16_t total_len = 0; ++ uint16_t str_len = 0; ++ uint64_t rss_offload; ++ uint16_t i; ++ ++ for (i = 0; i < sizeof(offload_types) * CHAR_BIT; i++) { ++ rss_offload = RTE_BIT64(i); ++ if ((offload_types & rss_offload) != 0) { ++ const char *p = rsstypes_to_str(rss_offload); ++ ++ user_defined_str_len = ++ strlen("user-defined-") + (i / 10 + 1); ++ str_len = p ? strlen(p) : user_defined_str_len; ++ str_len += 2; /* add two spaces */ ++ if (total_len + str_len >= char_num_per_line) { ++ total_len = 0; ++ printf("\n"); ++ } ++ ++ if (p) ++ printf(" %s", p); ++ else ++ printf(" user-defined-%u", i); ++ total_len += str_len; ++ } ++ } ++} ++ + void + port_infos_display(portid_t port_id) + { +@@ -802,21 +834,10 @@ port_infos_display(portid_t port_id) + if (!dev_info.flow_type_rss_offloads) + printf("No RSS offload flow type is supported.\n"); + else { +- uint64_t rss_offload_types = dev_info.flow_type_rss_offloads; +- uint16_t i; +- + printf("Supported RSS offload flow types:\n"); +- for (i = 0; i < sizeof(rss_offload_types) * CHAR_BIT; i++) { +- uint64_t rss_offload = RTE_BIT64(i); +- if ((rss_offload_types & rss_offload) != 0) { +- const char *p = rsstypes_to_str(rss_offload); +- if (p) +- printf(" %s\n", p); +- else +- printf(" user defined %u\n", +- i); +- } +- } ++ rss_offload_types_display(dev_info.flow_type_rss_offloads, ++ TESTPMD_RSS_TYPES_CHAR_NUM_PER_LINE); ++ printf("\n"); + } + + printf("Minimum size of RX buffer: %u\n", dev_info.min_rx_bufsize); +@@ -1555,8 +1576,10 @@ port_flow_complain(struct rte_flow_error *error) + } + + static void +-rss_types_display(uint64_t rss_types) ++rss_types_display(uint64_t rss_types, uint16_t char_num_per_line) + { ++ uint16_t total_len = 0; ++ uint16_t str_len; + uint16_t i; + + if (rss_types == 0) +@@ -1565,9 +1588,18 @@ rss_types_display(uint64_t rss_types) + for (i = 0; rss_type_table[i].str; i++) { + if (rss_type_table[i].rss_type == 0) + continue; ++ + if ((rss_types & rss_type_table[i].rss_type) == +- rss_type_table[i].rss_type) ++ rss_type_table[i].rss_type) { ++ /* Contain two spaces */ ++ str_len = strlen(rss_type_table[i].str) + 2; ++ if (total_len + str_len > char_num_per_line) { ++ printf("\n"); ++ total_len = 0; ++ } + printf(" %s", rss_type_table[i].str); ++ total_len += str_len; ++ } + } + } + +@@ -1613,7 +1645,7 @@ rss_config_display(struct rte_flow_action_rss *rss_conf) + printf(" none\n"); + return; + } +- rss_types_display(rss_conf->types); ++ rss_types_display(rss_conf->types, TESTPMD_RSS_TYPES_CHAR_NUM_PER_LINE); + } + + static struct port_indirect_action * +@@ -3066,7 +3098,7 @@ port_rss_hash_conf_show(portid_t port_id, int show_rss_key) + return; + } + printf("RSS functions:\n"); +- rss_types_display(rss_hf); ++ rss_types_display(rss_hf, TESTPMD_RSS_TYPES_CHAR_NUM_PER_LINE); + printf("\n"); + if (!show_rss_key) + return; +diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h +index e50188778b..9c3a5d9bc5 100644 +--- a/app/test-pmd/testpmd.h ++++ b/app/test-pmd/testpmd.h +@@ -105,6 +105,8 @@ struct pkt_burst_stats { + unsigned int pkt_burst_spread[MAX_PKT_BURST + 1]; + }; + ++ ++#define TESTPMD_RSS_TYPES_CHAR_NUM_PER_LINE 64 + /** Information for a given RSS type. */ + struct rss_type_info { + const char *str; /**< Type name. */ +-- +2.23.0 + diff --git a/0176-app-testpmd-fix-bitmap-of-link-speeds-when-force-spe.patch b/0176-app-testpmd-fix-bitmap-of-link-speeds-when-force-spe.patch deleted file mode 100644 index c38659e38e48db5f4843700c722b043b874990d3..0000000000000000000000000000000000000000 --- a/0176-app-testpmd-fix-bitmap-of-link-speeds-when-force-spe.patch +++ /dev/null @@ -1,38 +0,0 @@ -From 3674253a345d4f953044369ca906212af2f04819 Mon Sep 17 00:00:00 2001 -From: Huisong Li -Date: Wed, 14 Apr 2021 11:02:05 +0800 -Subject: [PATCH 176/189] app/testpmd: fix bitmap of link speeds when force - speed - -Currently, when the user sets force link speed through 'link_speeds', -bit(0) of 'link_speeds' is not set to 1(ETH_LINK_SPEED_FIXED), -which conflicts with the definition. - -Fixes: 88fbedcd5e5a ("app/testpmd: move speed and duplex parsing in a function") -Cc: stable@dpdk.org - -Signed-off-by: Huisong Li -Signed-off-by: Min Hu (Connor) -Acked-by: Ferruh Yigit -Acked-by: Ajit Khaparde ---- - app/test-pmd/cmdline.c | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c -index 2ccbaa0..8446ecc 100644 ---- a/app/test-pmd/cmdline.c -+++ b/app/test-pmd/cmdline.c -@@ -1521,6 +1521,9 @@ parse_and_check_speed_duplex(char *speedstr, char *duplexstr, uint32_t *speed) - } - } - -+ if (*speed != ETH_LINK_SPEED_AUTONEG) -+ *speed |= ETH_LINK_SPEED_FIXED; -+ - return 0; - } - --- -2.7.4 - diff --git a/0177-app-testpmd-add-link-autoneg-status-display.patch b/0177-app-testpmd-add-link-autoneg-status-display.patch deleted file mode 100644 index fb8807c69472b64fc9661f261f0649a4e9c84bf6..0000000000000000000000000000000000000000 --- a/0177-app-testpmd-add-link-autoneg-status-display.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 465efdb2120519aba339a2754afaf71e7bf34ec5 Mon Sep 17 00:00:00 2001 -From: Huisong Li -Date: Thu, 15 Apr 2021 14:45:15 +0800 -Subject: [PATCH 177/189] app/testpmd: add link autoneg status display - -This patch adds link autoneg status display in port_infos_display(). - -Signed-off-by: Huisong Li -Signed-off-by: Min Hu (Connor) -Acked-by: Xiaoyun Li ---- - app/test-pmd/config.c | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c -index 3f6c864..d4ec3ff 100644 ---- a/app/test-pmd/config.c -+++ b/app/test-pmd/config.c -@@ -618,6 +618,8 @@ port_infos_display(portid_t port_id) - printf("Link speed: %s\n", rte_eth_link_speed_to_str(link.link_speed)); - printf("Link duplex: %s\n", (link.link_duplex == ETH_LINK_FULL_DUPLEX) ? - ("full-duplex") : ("half-duplex")); -+ printf("Autoneg status: %s\n", (link.link_autoneg == ETH_LINK_AUTONEG) ? -+ ("On") : ("Off")); - - if (!rte_eth_dev_get_mtu(port_id, &mtu)) - printf("MTU: %u\n", mtu); --- -2.7.4 - diff --git a/0177-app-testpmd-reorder-RSS-type-table.patch b/0177-app-testpmd-reorder-RSS-type-table.patch new file mode 100644 index 0000000000000000000000000000000000000000..863b08009dd6dced9a203f5890b1533324362607 --- /dev/null +++ b/0177-app-testpmd-reorder-RSS-type-table.patch @@ -0,0 +1,99 @@ +From 00a08212bf6e1c96e491353183d3db9ffbcf3463 Mon Sep 17 00:00:00 2001 +From: Huisong Li +Date: Fri, 21 Oct 2022 15:36:53 +0800 +Subject: [PATCH 177/189] app/testpmd: reorder RSS type table + +There are group and individual types in rss_type_table[]. However, group +types are very scattered, and individual types are not arranged based on +the bit number order in 'RTE_ETH_RSS_xxx'. For a clear distribution of +types and better maintenance, this patch reorders this table. + +Signed-off-by: Huisong Li +Acked-by: Ferruh Yigit +--- + app/test-pmd/config.c | 47 +++++++++++++++++++++++-------------------- + 1 file changed, 25 insertions(+), 22 deletions(-) + +diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c +index 873cca6f3e..f8cd135970 100644 +--- a/app/test-pmd/config.c ++++ b/app/test-pmd/config.c +@@ -85,17 +85,20 @@ static const struct { + }; + + const struct rss_type_info rss_type_table[] = { ++ /* Group types */ + { "all", RTE_ETH_RSS_ETH | RTE_ETH_RSS_VLAN | RTE_ETH_RSS_IP | RTE_ETH_RSS_TCP | + RTE_ETH_RSS_UDP | RTE_ETH_RSS_SCTP | RTE_ETH_RSS_L2_PAYLOAD | + RTE_ETH_RSS_L2TPV3 | RTE_ETH_RSS_ESP | RTE_ETH_RSS_AH | RTE_ETH_RSS_PFCP | + RTE_ETH_RSS_GTPU | RTE_ETH_RSS_ECPRI | RTE_ETH_RSS_MPLS}, + { "none", 0 }, +- { "eth", RTE_ETH_RSS_ETH }, +- { "l2-src-only", RTE_ETH_RSS_L2_SRC_ONLY }, +- { "l2-dst-only", RTE_ETH_RSS_L2_DST_ONLY }, ++ { "ip", RTE_ETH_RSS_IP }, ++ { "udp", RTE_ETH_RSS_UDP }, ++ { "tcp", RTE_ETH_RSS_TCP }, ++ { "sctp", RTE_ETH_RSS_SCTP }, ++ { "tunnel", RTE_ETH_RSS_TUNNEL }, + { "vlan", RTE_ETH_RSS_VLAN }, +- { "s-vlan", RTE_ETH_RSS_S_VLAN }, +- { "c-vlan", RTE_ETH_RSS_C_VLAN }, ++ ++ /* Individual type */ + { "ipv4", RTE_ETH_RSS_IPV4 }, + { "ipv4-frag", RTE_ETH_RSS_FRAG_IPV4 }, + { "ipv4-tcp", RTE_ETH_RSS_NONFRAG_IPV4_TCP }, +@@ -116,32 +119,32 @@ const struct rss_type_info rss_type_table[] = { + { "vxlan", RTE_ETH_RSS_VXLAN }, + { "geneve", RTE_ETH_RSS_GENEVE }, + { "nvgre", RTE_ETH_RSS_NVGRE }, +- { "ip", RTE_ETH_RSS_IP }, +- { "udp", RTE_ETH_RSS_UDP }, +- { "tcp", RTE_ETH_RSS_TCP }, +- { "sctp", RTE_ETH_RSS_SCTP }, +- { "tunnel", RTE_ETH_RSS_TUNNEL }, +- { "l3-pre32", RTE_ETH_RSS_L3_PRE32 }, +- { "l3-pre40", RTE_ETH_RSS_L3_PRE40 }, +- { "l3-pre48", RTE_ETH_RSS_L3_PRE48 }, +- { "l3-pre56", RTE_ETH_RSS_L3_PRE56 }, +- { "l3-pre64", RTE_ETH_RSS_L3_PRE64 }, +- { "l3-pre96", RTE_ETH_RSS_L3_PRE96 }, +- { "l3-src-only", RTE_ETH_RSS_L3_SRC_ONLY }, +- { "l3-dst-only", RTE_ETH_RSS_L3_DST_ONLY }, +- { "l4-src-only", RTE_ETH_RSS_L4_SRC_ONLY }, +- { "l4-dst-only", RTE_ETH_RSS_L4_DST_ONLY }, ++ { "gtpu", RTE_ETH_RSS_GTPU }, ++ { "eth", RTE_ETH_RSS_ETH }, ++ { "s-vlan", RTE_ETH_RSS_S_VLAN }, ++ { "c-vlan", RTE_ETH_RSS_C_VLAN }, + { "esp", RTE_ETH_RSS_ESP }, + { "ah", RTE_ETH_RSS_AH }, + { "l2tpv3", RTE_ETH_RSS_L2TPV3 }, + { "pfcp", RTE_ETH_RSS_PFCP }, + { "pppoe", RTE_ETH_RSS_PPPOE }, +- { "gtpu", RTE_ETH_RSS_GTPU }, + { "ecpri", RTE_ETH_RSS_ECPRI }, + { "mpls", RTE_ETH_RSS_MPLS }, + { "ipv4-chksum", RTE_ETH_RSS_IPV4_CHKSUM }, + { "l4-chksum", RTE_ETH_RSS_L4_CHKSUM }, +- { NULL, 0 }, ++ { "l3-pre96", RTE_ETH_RSS_L3_PRE96 }, ++ { "l3-pre64", RTE_ETH_RSS_L3_PRE64 }, ++ { "l3-pre56", RTE_ETH_RSS_L3_PRE56 }, ++ { "l3-pre48", RTE_ETH_RSS_L3_PRE48 }, ++ { "l3-pre40", RTE_ETH_RSS_L3_PRE40 }, ++ { "l3-pre32", RTE_ETH_RSS_L3_PRE32 }, ++ { "l2-dst-only", RTE_ETH_RSS_L2_DST_ONLY }, ++ { "l2-src-only", RTE_ETH_RSS_L2_SRC_ONLY }, ++ { "l4-dst-only", RTE_ETH_RSS_L4_DST_ONLY }, ++ { "l4-src-only", RTE_ETH_RSS_L4_SRC_ONLY }, ++ { "l3-dst-only", RTE_ETH_RSS_L3_DST_ONLY }, ++ { "l3-src-only", RTE_ETH_RSS_L3_SRC_ONLY }, ++ { NULL, 0}, + }; + + static const struct { +-- +2.23.0 + diff --git a/0178-app-testpmd-fix-RSS-types-display.patch b/0178-app-testpmd-fix-RSS-types-display.patch new file mode 100644 index 0000000000000000000000000000000000000000..e296b43b08f315d86c3ba49671bd7bc448448ec7 --- /dev/null +++ b/0178-app-testpmd-fix-RSS-types-display.patch @@ -0,0 +1,61 @@ +From 34d8e6bf37155488c61029cf392255dd18ed0a87 Mon Sep 17 00:00:00 2001 +From: Huisong Li +Date: Fri, 21 Oct 2022 15:36:54 +0800 +Subject: [PATCH 178/189] app/testpmd: fix RSS types display + +Now testpmd fails to display types when query RSS rule. The failure is +because the '\n' character is missing at the end of the function +'rss_config_display()'. +Actually, all places calling 'xxx_types_display()' need to '\n'. So this +patch moves '\n' to the inside of these function. + +Bugzilla ID: 1048 +Fixes: 534988c490f1 ("app/testpmd: unify RSS types display") +Fixes: 44a37f3cffe0 ("app/testpmd: compact RSS types output") + +Signed-off-by: Huisong Li +Tested-by: Weiyuan Li +Reviewed-by: Ferruh Yigit +--- + app/test-pmd/config.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c +index f8cd135970..12386c4d82 100644 +--- a/app/test-pmd/config.c ++++ b/app/test-pmd/config.c +@@ -731,6 +731,7 @@ rss_offload_types_display(uint64_t offload_types, uint16_t char_num_per_line) + total_len += str_len; + } + } ++ printf("\n"); + } + + void +@@ -840,7 +841,6 @@ port_infos_display(portid_t port_id) + printf("Supported RSS offload flow types:\n"); + rss_offload_types_display(dev_info.flow_type_rss_offloads, + TESTPMD_RSS_TYPES_CHAR_NUM_PER_LINE); +- printf("\n"); + } + + printf("Minimum size of RX buffer: %u\n", dev_info.min_rx_bufsize); +@@ -1604,6 +1604,7 @@ rss_types_display(uint64_t rss_types, uint16_t char_num_per_line) + total_len += str_len; + } + } ++ printf("\n"); + } + + static void +@@ -3102,7 +3103,6 @@ port_rss_hash_conf_show(portid_t port_id, int show_rss_key) + } + printf("RSS functions:\n"); + rss_types_display(rss_hf, TESTPMD_RSS_TYPES_CHAR_NUM_PER_LINE); +- printf("\n"); + if (!show_rss_key) + return; + printf("RSS key:\n"); +-- +2.23.0 + diff --git a/0178-app-testpmd-support-cleanup-Tx-queue-mbufs.patch b/0178-app-testpmd-support-cleanup-Tx-queue-mbufs.patch deleted file mode 100644 index 8cb49f4c857595c2c7dad8c0b403a844f89e94a8..0000000000000000000000000000000000000000 --- a/0178-app-testpmd-support-cleanup-Tx-queue-mbufs.patch +++ /dev/null @@ -1,152 +0,0 @@ -From 495e9454badc1ee809923d412db13f8e5bae1dca Mon Sep 17 00:00:00 2001 -From: Chengwen Feng -Date: Wed, 21 Apr 2021 16:45:02 +0800 -Subject: [PATCH 178/189] app/testpmd: support cleanup Tx queue mbufs - -This patch supports cleanup txq mbufs command: -port cleanup (port_id) txq (queue_id) (free_cnt) - -Signed-off-by: Chengwen Feng -Signed-off-by: Lijun Ou -Reviewed-by: Ferruh Yigit ---- - app/test-pmd/cmdline.c | 88 +++++++++++++++++++++++++++++ - doc/guides/testpmd_app_ug/testpmd_funcs.rst | 9 +++ - 2 files changed, 97 insertions(+) - -diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c -index 8446ecc..8832416 100644 ---- a/app/test-pmd/cmdline.c -+++ b/app/test-pmd/cmdline.c -@@ -898,6 +898,9 @@ static void cmd_help_long_parsed(void *parsed_result, - " Register a dynf and Set/clear this flag on Tx. " - "Testpmd will set this value to any Tx packet " - "sent from this port\n\n" -+ -+ "port cleanup (port_id) txq (queue_id) (free_cnt)\n" -+ " Cleanup txq mbufs for a specific Tx queue\n\n" - ); - } - -@@ -2439,6 +2442,90 @@ cmdline_parse_inst_t cmd_config_rss_hash_key = { - }, - }; - -+/* *** cleanup txq mbufs *** */ -+struct cmd_cleanup_txq_mbufs_result { -+ cmdline_fixed_string_t port; -+ cmdline_fixed_string_t keyword; -+ cmdline_fixed_string_t name; -+ uint16_t port_id; -+ uint16_t queue_id; -+ uint32_t free_cnt; -+}; -+ -+static void -+cmd_cleanup_txq_mbufs_parsed(void *parsed_result, -+ __rte_unused struct cmdline *cl, -+ __rte_unused void *data) -+{ -+ struct cmd_cleanup_txq_mbufs_result *res = parsed_result; -+ uint16_t port_id = res->port_id; -+ uint16_t queue_id = res->queue_id; -+ uint32_t free_cnt = res->free_cnt; -+ struct rte_eth_txq_info qinfo; -+ int ret; -+ -+ if (test_done == 0) { -+ printf("Please stop forwarding first\n"); -+ return; -+ } -+ -+ if (rte_eth_tx_queue_info_get(port_id, queue_id, &qinfo)) { -+ printf("Failed to get port %u Tx queue %u info\n", -+ port_id, queue_id); -+ return; -+ } -+ -+ if (qinfo.queue_state != RTE_ETH_QUEUE_STATE_STARTED) { -+ printf("Tx queue %u not started\n", queue_id); -+ return; -+ } -+ -+ ret = rte_eth_tx_done_cleanup(port_id, queue_id, free_cnt); -+ if (ret < 0) { -+ printf("Failed to cleanup mbuf for port %u Tx queue %u " -+ "error desc: %s(%d)\n", -+ port_id, queue_id, strerror(-ret), ret); -+ return; -+ } -+ -+ printf("Cleanup port %u Tx queue %u mbuf nums: %u\n", -+ port_id, queue_id, ret); -+} -+ -+cmdline_parse_token_string_t cmd_cleanup_txq_mbufs_port = -+ TOKEN_STRING_INITIALIZER(struct cmd_cleanup_txq_mbufs_result, port, -+ "port"); -+cmdline_parse_token_string_t cmd_cleanup_txq_mbufs_cleanup = -+ TOKEN_STRING_INITIALIZER(struct cmd_cleanup_txq_mbufs_result, keyword, -+ "cleanup"); -+cmdline_parse_token_num_t cmd_cleanup_txq_mbufs_port_id = -+ TOKEN_NUM_INITIALIZER(struct cmd_cleanup_txq_mbufs_result, port_id, -+ RTE_UINT16); -+cmdline_parse_token_string_t cmd_cleanup_txq_mbufs_txq = -+ TOKEN_STRING_INITIALIZER(struct cmd_cleanup_txq_mbufs_result, name, -+ "txq"); -+cmdline_parse_token_num_t cmd_cleanup_txq_mbufs_queue_id = -+ TOKEN_NUM_INITIALIZER(struct cmd_cleanup_txq_mbufs_result, queue_id, -+ RTE_UINT16); -+cmdline_parse_token_num_t cmd_cleanup_txq_mbufs_free_cnt = -+ TOKEN_NUM_INITIALIZER(struct cmd_cleanup_txq_mbufs_result, free_cnt, -+ RTE_UINT32); -+ -+cmdline_parse_inst_t cmd_cleanup_txq_mbufs = { -+ .f = cmd_cleanup_txq_mbufs_parsed, -+ .data = NULL, -+ .help_str = "port cleanup txq ", -+ .tokens = { -+ (void *)&cmd_cleanup_txq_mbufs_port, -+ (void *)&cmd_cleanup_txq_mbufs_cleanup, -+ (void *)&cmd_cleanup_txq_mbufs_port_id, -+ (void *)&cmd_cleanup_txq_mbufs_txq, -+ (void *)&cmd_cleanup_txq_mbufs_queue_id, -+ (void *)&cmd_cleanup_txq_mbufs_free_cnt, -+ NULL, -+ }, -+}; -+ - /* *** configure port rxq/txq ring size *** */ - struct cmd_config_rxtx_ring_size { - cmdline_fixed_string_t port; -@@ -16947,6 +17034,7 @@ cmdline_parse_ctx_t main_ctx[] = { - (cmdline_parse_inst_t *)&cmd_showport_rss_hash, - (cmdline_parse_inst_t *)&cmd_showport_rss_hash_key, - (cmdline_parse_inst_t *)&cmd_config_rss_hash_key, -+ (cmdline_parse_inst_t *)&cmd_cleanup_txq_mbufs, - (cmdline_parse_inst_t *)&cmd_dump, - (cmdline_parse_inst_t *)&cmd_dump_one, - #ifdef RTE_NET_I40E -diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst -index 9be4500..de90726 100644 ---- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst -+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst -@@ -2415,6 +2415,15 @@ hash of input [IP] packets received on port:: - ipv6-udp-ex ) - -+port cleanup txq mbufs -+~~~~~~~~~~~~~~~~~~~~~~ -+ -+To cleanup txq mbufs currently cached by driver:: -+ -+ testpmd> port cleanup (port_id) txq (queue_id) (free_cnt) -+ -+If the value of ``free_cnt`` is 0, driver should free all cached mbufs. -+ - Device Functions - ---------------- - --- -2.7.4 - diff --git a/0179-app-testpmd-show-link-flow-control-info.patch b/0179-app-testpmd-show-link-flow-control-info.patch deleted file mode 100644 index 0af125528bb65e4a0e3216665998bc81a378ebb8..0000000000000000000000000000000000000000 --- a/0179-app-testpmd-show-link-flow-control-info.patch +++ /dev/null @@ -1,144 +0,0 @@ -From f67e3735b1020d516340b8a6ab2cf7c396dc9fac Mon Sep 17 00:00:00 2001 -From: Huisong Li -Date: Wed, 21 Apr 2021 17:41:31 +0800 -Subject: [PATCH 179/189] app/testpmd: show link flow control info - -This patch supports the query of the link flow control parameter -on a port. - -The command format is as follows: -show port flow_ctrl - -Signed-off-by: Huisong Li -Signed-off-by: Min Hu (Connor) -Acked-by: Xiaoyun Li -Acked-by: Kevin Traynor ---- - app/test-pmd/cmdline.c | 78 +++++++++++++++++++++++++++++ - doc/guides/testpmd_app_ug/testpmd_funcs.rst | 7 +++ - 2 files changed, 85 insertions(+) - -diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c -index 8832416..a64b493 100644 ---- a/app/test-pmd/cmdline.c -+++ b/app/test-pmd/cmdline.c -@@ -254,6 +254,9 @@ static void cmd_help_long_parsed(void *parsed_result, - - "show port (port_id) fec_mode" - " Show fec mode of a port.\n\n" -+ -+ "show port (port_id) flow_ctrl" -+ " Show flow control info of a port.\n\n" - ); - } - -@@ -6935,6 +6938,80 @@ cmdline_parse_inst_t cmd_set_allmulti_mode_one = { - }, - }; - -+/* *** GET CURRENT ETHERNET LINK FLOW CONTROL *** */ -+struct cmd_link_flow_ctrl_show { -+ cmdline_fixed_string_t show; -+ cmdline_fixed_string_t port; -+ portid_t port_id; -+ cmdline_fixed_string_t flow_ctrl; -+}; -+ -+cmdline_parse_token_string_t cmd_lfc_show_show = -+ TOKEN_STRING_INITIALIZER(struct cmd_link_flow_ctrl_show, -+ show, "show"); -+cmdline_parse_token_string_t cmd_lfc_show_port = -+ TOKEN_STRING_INITIALIZER(struct cmd_link_flow_ctrl_show, -+ port, "port"); -+cmdline_parse_token_num_t cmd_lfc_show_portid = -+ TOKEN_NUM_INITIALIZER(struct cmd_link_flow_ctrl_show, -+ port_id, RTE_UINT16); -+cmdline_parse_token_string_t cmd_lfc_show_flow_ctrl = -+ TOKEN_STRING_INITIALIZER(struct cmd_link_flow_ctrl_show, -+ flow_ctrl, "flow_ctrl"); -+ -+static void -+cmd_link_flow_ctrl_show_parsed(void *parsed_result, -+ __rte_unused struct cmdline *cl, -+ __rte_unused void *data) -+{ -+ struct cmd_link_flow_ctrl_show *res = parsed_result; -+ static const char *info_border = "*********************"; -+ struct rte_eth_fc_conf fc_conf; -+ bool rx_fc_en = false; -+ bool tx_fc_en = false; -+ int ret; -+ -+ ret = rte_eth_dev_flow_ctrl_get(res->port_id, &fc_conf); -+ if (ret != 0) { -+ printf("Failed to get current flow ctrl information: err = %d\n", -+ ret); -+ return; -+ } -+ -+ if (fc_conf.mode == RTE_FC_RX_PAUSE || fc_conf.mode == RTE_FC_FULL) -+ rx_fc_en = true; -+ if (fc_conf.mode == RTE_FC_TX_PAUSE || fc_conf.mode == RTE_FC_FULL) -+ tx_fc_en = true; -+ -+ printf("\n%s Flow control infos for port %-2d %s\n", -+ info_border, res->port_id, info_border); -+ printf("FC mode:\n"); -+ printf(" Rx pause: %s\n", rx_fc_en ? "on" : "off"); -+ printf(" Tx pause: %s\n", tx_fc_en ? "on" : "off"); -+ printf("Autoneg: %s\n", fc_conf.autoneg ? "on" : "off"); -+ printf("Pause time: 0x%x\n", fc_conf.pause_time); -+ printf("High waterline: 0x%x\n", fc_conf.high_water); -+ printf("Low waterline: 0x%x\n", fc_conf.low_water); -+ printf("Send XON: %s\n", fc_conf.send_xon ? "on" : "off"); -+ printf("Forward MAC control frames: %s\n", -+ fc_conf.mac_ctrl_frame_fwd ? "on" : "off"); -+ printf("\n%s************** End ***********%s\n", -+ info_border, info_border); -+} -+ -+cmdline_parse_inst_t cmd_link_flow_control_show = { -+ .f = cmd_link_flow_ctrl_show_parsed, -+ .data = NULL, -+ .help_str = "show port flow_ctrl", -+ .tokens = { -+ (void *)&cmd_lfc_show_show, -+ (void *)&cmd_lfc_show_port, -+ (void *)&cmd_lfc_show_portid, -+ (void *)&cmd_lfc_show_flow_ctrl, -+ NULL, -+ }, -+}; -+ - /* *** SETUP ETHERNET LINK FLOW CONTROL *** */ - struct cmd_link_flow_ctrl_set_result { - cmdline_fixed_string_t set; -@@ -16981,6 +17058,7 @@ cmdline_parse_ctx_t main_ctx[] = { - (cmdline_parse_inst_t *)&cmd_link_flow_control_set_xon, - (cmdline_parse_inst_t *)&cmd_link_flow_control_set_macfwd, - (cmdline_parse_inst_t *)&cmd_link_flow_control_set_autoneg, -+ (cmdline_parse_inst_t *)&cmd_link_flow_control_show, - (cmdline_parse_inst_t *)&cmd_priority_flow_control_set, - (cmdline_parse_inst_t *)&cmd_config_dcb, - (cmdline_parse_inst_t *)&cmd_read_reg, -diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst -index de90726..f0e0423 100644 ---- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst -+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst -@@ -1521,6 +1521,13 @@ Where: - - * ``autoneg``: Change the auto-negotiation parameter. - -+show flow control -+~~~~~~~~~~~~~~~~~ -+ -+show the link flow control parameter on a port:: -+ -+ testpmd> show port flow_ctrl -+ - set pfc_ctrl rx - ~~~~~~~~~~~~~~~ - --- -2.7.4 - diff --git a/0179-ethdev-support-telemetry-private-dump.patch b/0179-ethdev-support-telemetry-private-dump.patch new file mode 100644 index 0000000000000000000000000000000000000000..92cc946c2f4a90628631466bac43cb57a237b9e3 --- /dev/null +++ b/0179-ethdev-support-telemetry-private-dump.patch @@ -0,0 +1,91 @@ +From 9de9c8f454d4d1d87105700f626568f5f59e6985 Mon Sep 17 00:00:00 2001 +From: Chengwen Feng +Date: Fri, 21 Oct 2022 15:36:55 +0800 +Subject: [PATCH 179/189] ethdev: support telemetry private dump +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This patch supports telemetry private dump a ethdev port. + +Signed-off-by: Chengwen Feng +Acked-by: Morten Brørup +--- + lib/ethdev/rte_ethdev.c | 47 +++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 47 insertions(+) + +diff --git a/lib/ethdev/rte_ethdev.c b/lib/ethdev/rte_ethdev.c +index b95f501b51..df5a627cbe 100644 +--- a/lib/ethdev/rte_ethdev.c ++++ b/lib/ethdev/rte_ethdev.c +@@ -7,6 +7,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -6272,6 +6273,48 @@ eth_dev_handle_port_xstats(const char *cmd __rte_unused, + return 0; + } + ++#ifndef RTE_EXEC_ENV_WINDOWS ++static int ++eth_dev_handle_port_dump_priv(const char *cmd __rte_unused, ++ const char *params, ++ struct rte_tel_data *d) ++{ ++ char *buf, *end_param; ++ int port_id, ret; ++ FILE *f; ++ ++ if (params == NULL || strlen(params) == 0 || !isdigit(*params)) ++ return -EINVAL; ++ ++ port_id = strtoul(params, &end_param, 0); ++ if (*end_param != '\0') ++ RTE_ETHDEV_LOG(NOTICE, ++ "Extra parameters passed to ethdev telemetry command, ignoring"); ++ if (!rte_eth_dev_is_valid_port(port_id)) ++ return -EINVAL; ++ ++ buf = calloc(sizeof(char), RTE_TEL_MAX_SINGLE_STRING_LEN); ++ if (buf == NULL) ++ return -ENOMEM; ++ ++ f = fmemopen(buf, RTE_TEL_MAX_SINGLE_STRING_LEN - 1, "w+"); ++ if (f == NULL) { ++ free(buf); ++ return -EINVAL; ++ } ++ ++ ret = rte_eth_dev_priv_dump(port_id, f); ++ fclose(f); ++ if (ret == 0) { ++ rte_tel_data_start_dict(d); ++ rte_tel_data_string(d, buf); ++ } ++ ++ free(buf); ++ return 0; ++} ++#endif /* !RTE_EXEC_ENV_WINDOWS */ ++ + static int + eth_dev_handle_port_link_status(const char *cmd __rte_unused, + const char *params, +@@ -6571,6 +6614,10 @@ RTE_INIT(ethdev_init_telemetry) + "Returns the common stats for a port. Parameters: int port_id"); + rte_telemetry_register_cmd("/ethdev/xstats", eth_dev_handle_port_xstats, + "Returns the extended stats for a port. Parameters: int port_id"); ++#ifndef RTE_EXEC_ENV_WINDOWS ++ rte_telemetry_register_cmd("/ethdev/dump_priv", eth_dev_handle_port_dump_priv, ++ "Returns dump private information for a port. Parameters: int port_id"); ++#endif + rte_telemetry_register_cmd("/ethdev/link_status", + eth_dev_handle_port_link_status, + "Returns the link status for a port. Parameters: int port_id"); +-- +2.23.0 + diff --git a/0180-app-testpmd-support-display-queue-state.patch b/0180-app-testpmd-support-display-queue-state.patch deleted file mode 100644 index d49fd0792e3b534c77f011a8c2f1504c0f03994e..0000000000000000000000000000000000000000 --- a/0180-app-testpmd-support-display-queue-state.patch +++ /dev/null @@ -1,57 +0,0 @@ -From c36dad2a8570ffadd1fd802c85d0566260ff1daf Mon Sep 17 00:00:00 2001 -From: Chengwen Feng -Date: Wed, 21 Apr 2021 11:24:59 +0800 -Subject: [PATCH 180/189] app/testpmd: support display queue state - -This patch supports display queue state in "show rxq/txq" commands. - -Signed-off-by: Chengwen Feng -Signed-off-by: Min Hu (Connor) -Reviewed-by: Ferruh Yigit ---- - app/test-pmd/config.c | 15 +++++++++++++++ - 1 file changed, 15 insertions(+) - -diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c -index d4ec3ff..baae44e 100644 ---- a/app/test-pmd/config.c -+++ b/app/test-pmd/config.c -@@ -362,6 +362,19 @@ nic_xstats_clear(portid_t port_id) - } - } - -+static const char * -+get_queue_state_name(uint8_t queue_state) -+{ -+ if (queue_state == RTE_ETH_QUEUE_STATE_STOPPED) -+ return "stopped"; -+ else if (queue_state == RTE_ETH_QUEUE_STATE_STARTED) -+ return "started"; -+ else if (queue_state == RTE_ETH_QUEUE_STATE_HAIRPIN) -+ return "hairpin"; -+ else -+ return "unknown"; -+} -+ - void - rx_queue_infos_display(portid_t port_id, uint16_t queue_id) - { -@@ -392,6 +405,7 @@ rx_queue_infos_display(portid_t port_id, uint16_t queue_id) - (qinfo.conf.rx_deferred_start != 0) ? "on" : "off"); - printf("\nRX scattered packets: %s", - (qinfo.scattered_rx != 0) ? "on" : "off"); -+ printf("\nRx queue state: %s", get_queue_state_name(qinfo.queue_state)); - if (qinfo.rx_buf_size != 0) - printf("\nRX buffer size: %hu", qinfo.rx_buf_size); - printf("\nNumber of RXDs: %hu", qinfo.nb_desc); -@@ -432,6 +446,7 @@ tx_queue_infos_display(portid_t port_id, uint16_t queue_id) - printf("\nTX deferred start: %s", - (qinfo.conf.tx_deferred_start != 0) ? "on" : "off"); - printf("\nNumber of TXDs: %hu", qinfo.nb_desc); -+ printf("\nTx queue state: %s", get_queue_state_name(qinfo.queue_state)); - - if (rte_eth_tx_burst_mode_get(port_id, queue_id, &mode) == 0) - printf("\nBurst mode: %s%s", --- -2.7.4 - diff --git a/0180-dmadev-add-telemetry.patch b/0180-dmadev-add-telemetry.patch new file mode 100644 index 0000000000000000000000000000000000000000..d445f54403aeab8dadfce6bf12977cb66411a5ce --- /dev/null +++ b/0180-dmadev-add-telemetry.patch @@ -0,0 +1,224 @@ +From ab11b7f71865aaab19e2a59e877bc70dfbc317b0 Mon Sep 17 00:00:00 2001 +From: Sean Morrissey +Date: Fri, 21 Oct 2022 15:36:56 +0800 +Subject: [PATCH 180/189] dmadev: add telemetry + +Telemetry commands are now registered through the dmadev library +for the gathering of DSA stats. The corresponding callback +functions for listing dmadevs and providing info and stats for a + +An example usage can be seen below: +Connecting to /var/run/dpdk/rte/dpdk_telemetry.v2 +{"version": "DPDK 22.03.0-rc2", "pid": 2956551, "max_output_len": 16384} +Connected to application: "dpdk-dma" +--> / +{"/": ["/", "/dmadev/info", "/dmadev/list", "/dmadev/stats", ...]} +--> /dmadev/list +{"/dmadev/info": {"name": "0000:00:01.0", "nb_vchans": 1, "numa_node": 0, +"max_vchans": 1, "max_desc": 4096, "min_desc": 32, "max_sges": 0, +"capabilities": {"mem2mem": 1, "mem2dev": 0, "dev2mem": 0, ...}}} +--> /dmadev/stats,0,0 +{"/dmadev/stats": {"submitted": 0, "completed": 0, "errors": 0}} + +Signed-off-by: Sean Morrissey +Reviewed-by: Bruce Richardson +Reviewed-by: Conor Walsh +Tested-by: Sunil Pai G +Tested-by: Kevin Laatz +Acked-by: Chengwen Feng +--- + doc/guides/prog_guide/dmadev.rst | 24 ++++++ + lib/dmadev/meson.build | 2 + + lib/dmadev/rte_dmadev.c | 130 +++++++++++++++++++++++++++++++ + 3 files changed, 156 insertions(+) + +diff --git a/doc/guides/prog_guide/dmadev.rst b/doc/guides/prog_guide/dmadev.rst +index 77863f8028..2aa26d33b8 100644 +--- a/doc/guides/prog_guide/dmadev.rst ++++ b/doc/guides/prog_guide/dmadev.rst +@@ -118,3 +118,27 @@ i.e. ``rte_dma_stats_get()``. The statistics returned for each device instance a + * ``submitted``: The number of operations submitted to the device. + * ``completed``: The number of operations which have completed (successful and failed). + * ``errors``: The number of operations that completed with error. ++ ++The dmadev library has support for displaying DMA device information ++through the Telemetry interface. Telemetry commands that can be used ++are shown below. ++ ++#. Get the list of available DMA devices by ID:: ++ ++ --> /dmadev/list ++ {"/dmadev/list": [0, 1]} ++ ++#. Get general information from a DMA device by passing the device id as a parameter:: ++ ++ --> /dmadev/info,0 ++ {"/dmadev/info": {"name": "0000:00:01.0", "nb_vchans": 1, "numa_node": 0, "max_vchans": 1, "max_desc": 4096, ++ "min_desc": 32, "max_sges": 0, "capabilities": {"mem2mem": 1, "mem2dev": 0, "dev2mem": 0, ...}}} ++ ++#. Get the statistics for a particular DMA device and virtual DMA channel by passing the device id and vchan id as parameters ++ (if a DMA device only has one virtual DMA channel you only need to pass the device id):: ++ ++ --> /dmadev/stats,0,0 ++ {"/dmadev/stats": {"submitted": 0, "completed": 0, "errors": 0}} ++ ++For more information on how to use the Telemetry interface, see ++the :doc:`../howto/telemetry`. +diff --git a/lib/dmadev/meson.build b/lib/dmadev/meson.build +index d2fc85e8c7..2f17587b75 100644 +--- a/lib/dmadev/meson.build ++++ b/lib/dmadev/meson.build +@@ -5,3 +5,5 @@ sources = files('rte_dmadev.c') + headers = files('rte_dmadev.h') + indirect_headers += files('rte_dmadev_core.h') + driver_sdk_headers += files('rte_dmadev_pmd.h') ++ ++deps += ['telemetry'] +diff --git a/lib/dmadev/rte_dmadev.c b/lib/dmadev/rte_dmadev.c +index d4b32b2971..174d4c40ae 100644 +--- a/lib/dmadev/rte_dmadev.c ++++ b/lib/dmadev/rte_dmadev.c +@@ -11,6 +11,7 @@ + #include + #include + #include ++#include + + #include "rte_dmadev.h" + #include "rte_dmadev_pmd.h" +@@ -864,3 +865,132 @@ dma_fp_object_dummy(struct rte_dma_fp_object *obj) + obj->completed_status = dummy_completed_status; + obj->burst_capacity = dummy_burst_capacity; + } ++ ++static int ++dmadev_handle_dev_list(const char *cmd __rte_unused, ++ const char *params __rte_unused, ++ struct rte_tel_data *d) ++{ ++ int dev_id; ++ ++ rte_tel_data_start_array(d, RTE_TEL_INT_VAL); ++ for (dev_id = 0; dev_id < dma_devices_max; dev_id++) ++ if (rte_dma_is_valid(dev_id)) ++ rte_tel_data_add_array_int(d, dev_id); ++ ++ return 0; ++} ++ ++#define ADD_CAPA(td, dc, c) rte_tel_data_add_dict_int(td, dma_capability_name(c), !!(dc & c)) ++ ++static int ++dmadev_handle_dev_info(const char *cmd __rte_unused, ++ const char *params, struct rte_tel_data *d) ++{ ++ struct rte_dma_info dma_info; ++ struct rte_tel_data *dma_caps; ++ int dev_id, ret; ++ uint64_t dev_capa; ++ char *end_param; ++ ++ if (params == NULL || strlen(params) == 0 || !isdigit(*params)) ++ return -EINVAL; ++ ++ dev_id = strtoul(params, &end_param, 0); ++ if (*end_param != '\0') ++ RTE_DMA_LOG(WARNING, "Extra parameters passed to dmadev telemetry command, ignoring"); ++ ++ /* Function info_get validates dev_id so we don't need to. */ ++ ret = rte_dma_info_get(dev_id, &dma_info); ++ if (ret < 0) ++ return -EINVAL; ++ dev_capa = dma_info.dev_capa; ++ ++ rte_tel_data_start_dict(d); ++ rte_tel_data_add_dict_string(d, "name", dma_info.dev_name); ++ rte_tel_data_add_dict_int(d, "nb_vchans", dma_info.nb_vchans); ++ rte_tel_data_add_dict_int(d, "numa_node", dma_info.numa_node); ++ rte_tel_data_add_dict_int(d, "max_vchans", dma_info.max_vchans); ++ rte_tel_data_add_dict_int(d, "max_desc", dma_info.max_desc); ++ rte_tel_data_add_dict_int(d, "min_desc", dma_info.min_desc); ++ rte_tel_data_add_dict_int(d, "max_sges", dma_info.max_sges); ++ ++ dma_caps = rte_tel_data_alloc(); ++ if (!dma_caps) ++ return -ENOMEM; ++ ++ rte_tel_data_start_dict(dma_caps); ++ ADD_CAPA(dma_caps, dev_capa, RTE_DMA_CAPA_MEM_TO_MEM); ++ ADD_CAPA(dma_caps, dev_capa, RTE_DMA_CAPA_MEM_TO_DEV); ++ ADD_CAPA(dma_caps, dev_capa, RTE_DMA_CAPA_DEV_TO_MEM); ++ ADD_CAPA(dma_caps, dev_capa, RTE_DMA_CAPA_DEV_TO_DEV); ++ ADD_CAPA(dma_caps, dev_capa, RTE_DMA_CAPA_SVA); ++ ADD_CAPA(dma_caps, dev_capa, RTE_DMA_CAPA_SILENT); ++ ADD_CAPA(dma_caps, dev_capa, RTE_DMA_CAPA_HANDLES_ERRORS); ++ ADD_CAPA(dma_caps, dev_capa, RTE_DMA_CAPA_OPS_COPY); ++ ADD_CAPA(dma_caps, dev_capa, RTE_DMA_CAPA_OPS_COPY_SG); ++ ADD_CAPA(dma_caps, dev_capa, RTE_DMA_CAPA_OPS_FILL); ++ rte_tel_data_add_dict_container(d, "capabilities", dma_caps, 0); ++ ++ return 0; ++} ++ ++#define ADD_DICT_STAT(s) rte_tel_data_add_dict_u64(d, #s, dma_stats.s) ++ ++static int ++dmadev_handle_dev_stats(const char *cmd __rte_unused, ++ const char *params, ++ struct rte_tel_data *d) ++{ ++ struct rte_dma_info dma_info; ++ struct rte_dma_stats dma_stats; ++ int dev_id, ret, vchan_id; ++ char *end_param; ++ const char *vchan_param; ++ ++ if (params == NULL || strlen(params) == 0 || !isdigit(*params)) ++ return -EINVAL; ++ ++ dev_id = strtoul(params, &end_param, 0); ++ ++ /* Function info_get validates dev_id so we don't need to. */ ++ ret = rte_dma_info_get(dev_id, &dma_info); ++ if (ret < 0) ++ return -EINVAL; ++ ++ /* If the device has one vchan the user does not need to supply the ++ * vchan id and only the device id is needed, no extra parameters. ++ */ ++ if (dma_info.nb_vchans == 1 && *end_param == '\0') ++ vchan_id = 0; ++ else { ++ vchan_param = strtok(end_param, ","); ++ if (!vchan_param || strlen(vchan_param) == 0 || !isdigit(*vchan_param)) ++ return -EINVAL; ++ ++ vchan_id = strtoul(vchan_param, &end_param, 0); ++ } ++ if (*end_param != '\0') ++ RTE_DMA_LOG(WARNING, "Extra parameters passed to dmadev telemetry command, ignoring"); ++ ++ ret = rte_dma_stats_get(dev_id, vchan_id, &dma_stats); ++ if (ret < 0) ++ return -EINVAL; ++ ++ rte_tel_data_start_dict(d); ++ ADD_DICT_STAT(submitted); ++ ADD_DICT_STAT(completed); ++ ADD_DICT_STAT(errors); ++ ++ return 0; ++} ++ ++RTE_INIT(dmadev_init_telemetry) ++{ ++ rte_telemetry_register_cmd("/dmadev/list", dmadev_handle_dev_list, ++ "Returns list of available dmadev devices by IDs. No parameters."); ++ rte_telemetry_register_cmd("/dmadev/info", dmadev_handle_dev_info, ++ "Returns information for a dmadev. Parameters: int dev_id"); ++ rte_telemetry_register_cmd("/dmadev/stats", dmadev_handle_dev_stats, ++ "Returns the stats for a dmadev vchannel. Parameters: int dev_id, vchan_id (Optional if only one vchannel)"); ++} +-- +2.23.0 + diff --git a/0181-app-testpmd-fix-max-queue-number-for-Tx-offloads.patch b/0181-app-testpmd-fix-max-queue-number-for-Tx-offloads.patch deleted file mode 100644 index 99db55cc97bbdeadcd206a9fcd2088d1afb74e8c..0000000000000000000000000000000000000000 --- a/0181-app-testpmd-fix-max-queue-number-for-Tx-offloads.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 91cdc3204aec2d95d138d8fd88a16ea9af123a5f Mon Sep 17 00:00:00 2001 -From: Chengchang Tang -Date: Thu, 22 Apr 2021 15:03:31 +0800 -Subject: [PATCH 181/189] app/testpmd: fix max queue number for Tx offloads - -When txq offload is configured, max rxq is used as the max queue. This -patch fixes it. - -Fixes: 74453ac9ef67 ("app/testpmd: fix queue offload configuration") -Cc: stable@dpdk.org - -Signed-off-by: Chengchang Tang -Signed-off-by: Min Hu (Connor) -Acked-by: Xiaoyun Li ---- - app/test-pmd/cmdline.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c -index a64b493..59c4f7e 100644 ---- a/app/test-pmd/cmdline.c -+++ b/app/test-pmd/cmdline.c -@@ -4645,7 +4645,7 @@ cmd_config_queue_tx_offloads(struct rte_port *port) - int k; - - /* Apply queue tx offloads configuration */ -- for (k = 0; k < port->dev_info.max_rx_queues; k++) -+ for (k = 0; k < port->dev_info.max_tx_queues; k++) - port->tx_conf[k].offloads = - port->dev_conf.txmode.offloads; - } --- -2.7.4 - diff --git a/0181-dmadev-support-telemetry-dump-dmadev.patch b/0181-dmadev-support-telemetry-dump-dmadev.patch new file mode 100644 index 0000000000000000000000000000000000000000..cf856849720151edf0d47a32ff14bfd9ccf4a512 --- /dev/null +++ b/0181-dmadev-support-telemetry-dump-dmadev.patch @@ -0,0 +1,78 @@ +From a36114ed036f8c4976dfe3d47f0ee29c9f214fc5 Mon Sep 17 00:00:00 2001 +From: Chengwen Feng +Date: Fri, 21 Oct 2022 15:36:57 +0800 +Subject: [PATCH 181/189] dmadev: support telemetry dump dmadev +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +This patch supports telemetry dump dmadev. + +Signed-off-by: Chengwen Feng +Acked-by: Morten Brørup +--- + lib/dmadev/rte_dmadev.c | 43 +++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 43 insertions(+) + +diff --git a/lib/dmadev/rte_dmadev.c b/lib/dmadev/rte_dmadev.c +index 174d4c40ae..ea1cb815b4 100644 +--- a/lib/dmadev/rte_dmadev.c ++++ b/lib/dmadev/rte_dmadev.c +@@ -985,6 +985,45 @@ dmadev_handle_dev_stats(const char *cmd __rte_unused, + return 0; + } + ++#ifndef RTE_EXEC_ENV_WINDOWS ++static int ++dmadev_handle_dev_dump(const char *cmd __rte_unused, ++ const char *params, ++ struct rte_tel_data *d) ++{ ++ char *buf, *end_param; ++ int dev_id, ret; ++ FILE *f; ++ ++ if (params == NULL || strlen(params) == 0 || !isdigit(*params)) ++ return -EINVAL; ++ ++ dev_id = strtoul(params, &end_param, 0); ++ if (*end_param != '\0') ++ RTE_DMA_LOG(WARNING, "Extra parameters passed to dmadev telemetry command, ignoring"); ++ ++ buf = calloc(sizeof(char), RTE_TEL_MAX_SINGLE_STRING_LEN); ++ if (buf == NULL) ++ return -ENOMEM; ++ ++ f = fmemopen(buf, RTE_TEL_MAX_SINGLE_STRING_LEN - 1, "w+"); ++ if (f == NULL) { ++ free(buf); ++ return -EINVAL; ++ } ++ ++ ret = rte_dma_dump(dev_id, f); ++ fclose(f); ++ if (ret == 0) { ++ rte_tel_data_start_dict(d); ++ rte_tel_data_string(d, buf); ++ } ++ ++ free(buf); ++ return ret; ++} ++#endif /* !RTE_EXEC_ENV_WINDOWS */ ++ + RTE_INIT(dmadev_init_telemetry) + { + rte_telemetry_register_cmd("/dmadev/list", dmadev_handle_dev_list, +@@ -993,4 +1032,8 @@ RTE_INIT(dmadev_init_telemetry) + "Returns information for a dmadev. Parameters: int dev_id"); + rte_telemetry_register_cmd("/dmadev/stats", dmadev_handle_dev_stats, + "Returns the stats for a dmadev vchannel. Parameters: int dev_id, vchan_id (Optional if only one vchannel)"); ++#ifndef RTE_EXEC_ENV_WINDOWS ++ rte_telemetry_register_cmd("/dmadev/dump", dmadev_handle_dev_dump, ++ "Returns dump information for a dmadev. Parameters: int dev_id"); ++#endif + } +-- +2.23.0 + diff --git a/0182-app-testpmd-fix-forward-lcores-number-for-DCB.patch b/0182-app-testpmd-fix-forward-lcores-number-for-DCB.patch deleted file mode 100644 index 5fabbb75e6d6cbfae4b7b2bee2992f21576a613f..0000000000000000000000000000000000000000 --- a/0182-app-testpmd-fix-forward-lcores-number-for-DCB.patch +++ /dev/null @@ -1,70 +0,0 @@ -From fd91f2f494b8dd91eda34ffa3d28b6e44d5988aa Mon Sep 17 00:00:00 2001 -From: Huisong Li -Date: Wed, 28 Apr 2021 14:40:40 +0800 -Subject: [PATCH 182/189] app/testpmd: fix forward lcores number for DCB - -For the DCB forwarding test, each core is assigned to each traffic class. -Number of forwarding cores for DCB test must be equal or less than number -of total TC. Otherwise, the following problems may occur: -1/ Redundant polling threads will be created when forwarding cores number - is greater than total TC number. -2/ Two cores would try to use a same queue on a port when Rx/Tx queue - number is greater than the used TC number, which is not allowed. - -Fixes: 900550de04a7 ("app/testpmd: add dcb support") -Fixes: ce8d561418d4 ("app/testpmd: add port configuration settings") -Cc: stable@dpdk.org - -Signed-off-by: Huisong Li -Signed-off-by: Lijun Ou -Acked-by: Xiaoyun Li ---- - app/test-pmd/config.c | 19 +++++++++++++++++++ - 1 file changed, 19 insertions(+) - -diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c -index baae44e..075929c 100644 ---- a/app/test-pmd/config.c -+++ b/app/test-pmd/config.c -@@ -3154,6 +3154,21 @@ rss_fwd_config_setup(void) - } - } - -+static uint16_t -+get_fwd_port_total_tc_num(void) -+{ -+ struct rte_eth_dcb_info dcb_info; -+ uint16_t total_tc_num = 0; -+ unsigned int i; -+ -+ for (i = 0; i < nb_fwd_ports; i++) { -+ (void)rte_eth_dev_get_dcb_info(fwd_ports_ids[i], &dcb_info); -+ total_tc_num += dcb_info.nb_tcs; -+ } -+ -+ return total_tc_num; -+} -+ - /** - * For the DCB forwarding test, each core is assigned on each traffic class. - * -@@ -3173,12 +3188,16 @@ dcb_fwd_config_setup(void) - lcoreid_t lc_id; - uint16_t nb_rx_queue, nb_tx_queue; - uint16_t i, j, k, sm_id = 0; -+ uint16_t total_tc_num; - uint8_t tc = 0; - - cur_fwd_config.nb_fwd_lcores = (lcoreid_t) nb_fwd_lcores; - cur_fwd_config.nb_fwd_ports = nb_fwd_ports; - cur_fwd_config.nb_fwd_streams = - (streamid_t) (nb_rxq * cur_fwd_config.nb_fwd_ports); -+ total_tc_num = get_fwd_port_total_tc_num(); -+ if (cur_fwd_config.nb_fwd_lcores > total_tc_num) -+ cur_fwd_config.nb_fwd_lcores = total_tc_num; - - /* reinitialize forwarding streams */ - init_fwd_streams(); --- -2.7.4 - diff --git a/0182-telemetry-add-missing-C-guards.patch b/0182-telemetry-add-missing-C-guards.patch new file mode 100644 index 0000000000000000000000000000000000000000..5fa53d2c86ce0980cbbebb43889256fd8c9b041d --- /dev/null +++ b/0182-telemetry-add-missing-C-guards.patch @@ -0,0 +1,45 @@ +From dcccc81ecd1f1a0a24ba361d474ef81c9691fd14 Mon Sep 17 00:00:00 2001 +From: Brian Dooley +Date: Fri, 21 Oct 2022 15:36:58 +0800 +Subject: [PATCH 182/189] telemetry: add missing C++ guards + +Some public header files were missing 'extern "C"' C++ guards, +and couldn't be used by C++ applications. Add the missing guards. + +Fixes: 8877ac688b52 ("telemetry: introduce infrastructure") +Cc: stable@dpdk.org + +Signed-off-by: Brian Dooley +Acked-by: Bruce Richardson +Acked-by: Tyler Retzlaff +--- + lib/telemetry/rte_telemetry.h | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/lib/telemetry/rte_telemetry.h b/lib/telemetry/rte_telemetry.h +index 7bca8a9a49..3372b32f38 100644 +--- a/lib/telemetry/rte_telemetry.h ++++ b/lib/telemetry/rte_telemetry.h +@@ -9,6 +9,10 @@ + #ifndef _RTE_TELEMETRY_H_ + #define _RTE_TELEMETRY_H_ + ++#ifdef __cplusplus ++extern "C" { ++#endif ++ + /** Maximum length for string used in object. */ + #define RTE_TEL_MAX_STRING_LEN 128 + /** Maximum length of string. */ +@@ -294,4 +298,8 @@ rte_tel_data_alloc(void); + void + rte_tel_data_free(struct rte_tel_data *data); + ++#ifdef __cplusplus ++} ++#endif ++ + #endif +-- +2.23.0 + diff --git a/0183-app-testpmd-fix-DCB-forwarding-configuration.patch b/0183-app-testpmd-fix-DCB-forwarding-configuration.patch deleted file mode 100644 index 49b9a4c5e527cb3605a553e4fa4e56313c44dd8c..0000000000000000000000000000000000000000 --- a/0183-app-testpmd-fix-DCB-forwarding-configuration.patch +++ /dev/null @@ -1,113 +0,0 @@ -From 670af503ac76c38183c532f3d6163a3a832f51d9 Mon Sep 17 00:00:00 2001 -From: Huisong Li -Date: Wed, 28 Apr 2021 14:40:41 +0800 -Subject: [PATCH 183/189] app/testpmd: fix DCB forwarding configuration -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -After DCB mode is configured, the operations of port stop and port start -change the value of the global variable "dcb_test", As a result, the -forwarding configuration from DCB to RSS mode, namely, -“dcb_fwd_config_setup()” to "rss_fwd_config_setup()". - -Currently, the 'dcb_flag' field in struct 'rte_port' indicates whether -the port is configured with DCB. And it is sufficient to have -'dcb_config' as a global variable to control the DCB test status. So -this patch deletes the "dcb_test". - -In addition, setting 'dcb_config' at the end of init_port_dcb_config() -in case that ports fail to enter DCB mode. - -Fixes: 900550de04a7 ("app/testpmd: add dcb support") -Fixes: ce8d561418d4 ("app/testpmd: add port configuration settings") -Fixes: 7741e4cf16c0 ("app/testpmd: VMDq and DCB updates") -Cc: stable@dpdk.org - -Signed-off-by: Huisong Li -Signed-off-by: Lijun Ou -Acked-by: Xiaoyun Li ---- - app/test-pmd/testpmd.c | 18 ++++-------------- - app/test-pmd/testpmd.h | 1 - - 2 files changed, 4 insertions(+), 15 deletions(-) - -diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c -index 33a060d..e55d986 100644 ---- a/app/test-pmd/testpmd.c -+++ b/app/test-pmd/testpmd.c -@@ -245,9 +245,6 @@ uint16_t mb_mempool_cache = DEF_MBUF_CACHE; /**< Size of mbuf mempool cache. */ - /* current configuration is in DCB or not,0 means it is not in DCB mode */ - uint8_t dcb_config = 0; - --/* Whether the dcb is in testing status */ --uint8_t dcb_test = 0; -- - /* - * Configurable number of RX/TX queues. - */ -@@ -2141,8 +2138,7 @@ start_packet_forwarding(int with_tx_first) - return; - } - -- -- if(dcb_test) { -+ if (dcb_config) { - for (i = 0; i < nb_fwd_ports; i++) { - pt_id = fwd_ports_ids[i]; - port = &ports[pt_id]; -@@ -2450,8 +2446,6 @@ start_port(portid_t pid) - if (port_id_is_invalid(pid, ENABLED_WARN)) - return 0; - -- if(dcb_config) -- dcb_test = 1; - RTE_ETH_FOREACH_DEV(pi) { - if (pid != pi && pid != (portid_t)RTE_PORT_ALL) - continue; -@@ -2689,11 +2683,6 @@ stop_port(portid_t pid) - portid_t peer_pl[RTE_MAX_ETHPORTS]; - int peer_pi; - -- if (dcb_test) { -- dcb_test = 0; -- dcb_config = 0; -- } -- - if (port_id_is_invalid(pid, ENABLED_WARN)) - return; - -@@ -3519,8 +3508,6 @@ init_port_dcb_config(portid_t pid, - rte_port = &ports[pid]; - - memset(&port_conf, 0, sizeof(struct rte_eth_conf)); -- /* Enter DCB configuration status */ -- dcb_config = 1; - - port_conf.rxmode = rte_port->dev_conf.rxmode; - port_conf.txmode = rte_port->dev_conf.txmode; -@@ -3588,6 +3575,9 @@ init_port_dcb_config(portid_t pid, - - rte_port->dcb_flag = 1; - -+ /* Enter DCB configuration status */ -+ dcb_config = 1; -+ - return 0; - } - -diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h -index 5f23162..303bed8 100644 ---- a/app/test-pmd/testpmd.h -+++ b/app/test-pmd/testpmd.h -@@ -423,7 +423,6 @@ extern uint64_t noisy_lkup_num_reads; - extern uint64_t noisy_lkup_num_reads_writes; - - extern uint8_t dcb_config; --extern uint8_t dcb_test; - - extern uint32_t mbuf_data_size_n; - extern uint16_t mbuf_data_size[MAX_SEGS_BUFFER_SPLIT]; --- -2.7.4 - diff --git a/0183-telemetry-limit-characters-allowed-in-dictionary-nam.patch b/0183-telemetry-limit-characters-allowed-in-dictionary-nam.patch new file mode 100644 index 0000000000000000000000000000000000000000..07df7a5e1fef0e794cfde9211466fade297cd59d --- /dev/null +++ b/0183-telemetry-limit-characters-allowed-in-dictionary-nam.patch @@ -0,0 +1,146 @@ +From 926dc7ff064ee81e6b9732247ddb7785a4ab98b8 Mon Sep 17 00:00:00 2001 +From: Bruce Richardson +Date: Fri, 21 Oct 2022 15:36:59 +0800 +Subject: [PATCH 183/189] telemetry: limit characters allowed in dictionary names + +To save issues with encoding the names of values in dicts, we limit the +allowed names to a subset of character values. This list of allowed +characters can be expanded as necessary in future. + +Signed-off-by: Bruce Richardson +Acked-by: Ciara Power +Acked-by: Morten Brørup +Acked-by: Chengwen Feng + +--- + lib/telemetry/rte_telemetry.h | 8 ++++++++ + lib/telemetry/telemetry_data.c | 31 +++++++++++++++++++++++++++++++ + 2 files changed, 39 insertions(+) + +diff --git a/lib/telemetry/rte_telemetry.h b/lib/telemetry/rte_telemetry.h +index 3372b32f38..fadea48cb9 100644 +--- a/lib/telemetry/rte_telemetry.h ++++ b/lib/telemetry/rte_telemetry.h +@@ -64,6 +64,10 @@ rte_tel_data_start_array(struct rte_tel_data *d, enum rte_tel_value_type type); + /** + * Start a dictionary of values for returning from a callback + * ++ * Dictionaries consist of key-values pairs to be returned, where the keys, ++ * or names, are strings and the values can be any of the types supported by telemetry. ++ * Name strings may only contain alphanumeric characters as well as '_' or '/' ++ * + * @param d + * The data structure passed to the callback + * @return +@@ -159,6 +163,7 @@ rte_tel_data_add_array_container(struct rte_tel_data *d, + * The data structure passed to the callback + * @param name + * The name the value is to be stored under in the dict ++ * Must contain only alphanumeric characters or the symbols: '_' or '/' + * @param val + * The string to be stored in the dict + * @return +@@ -177,6 +182,7 @@ rte_tel_data_add_dict_string(struct rte_tel_data *d, const char *name, + * The data structure passed to the callback + * @param name + * The name the value is to be stored under in the dict ++ * Must contain only alphanumeric characters or the symbols: '_' or '/' + * @param val + * The number to be stored in the dict + * @return +@@ -193,6 +199,7 @@ rte_tel_data_add_dict_int(struct rte_tel_data *d, const char *name, int val); + * The data structure passed to the callback + * @param name + * The name the value is to be stored under in the dict ++ * Must contain only alphanumeric characters or the symbols: '_' or '/' + * @param val + * The number to be stored in the dict + * @return +@@ -212,6 +219,7 @@ rte_tel_data_add_dict_u64(struct rte_tel_data *d, + * The data structure passed to the callback + * @param name + * The name the value is to be stored under in the dict. ++ * Must contain only alphanumeric characters or the symbols: '_' or '/' + * @param val + * The pointer to the container to be stored in the dict. + * @param keep +diff --git a/lib/telemetry/telemetry_data.c b/lib/telemetry/telemetry_data.c +index e14ae3c4d4..be46054c29 100644 +--- a/lib/telemetry/telemetry_data.c ++++ b/lib/telemetry/telemetry_data.c +@@ -3,6 +3,7 @@ + */ + + #undef RTE_USE_LIBBSD ++#include + #include + + #include "telemetry_data.h" +@@ -92,6 +93,24 @@ rte_tel_data_add_array_container(struct rte_tel_data *d, + return 0; + } + ++static bool ++valid_name(const char *name) ++{ ++ char allowed[128] = { ++ ['0' ... '9'] = 1, ++ ['A' ... 'Z'] = 1, ++ ['a' ... 'z'] = 1, ++ ['_'] = 1, ++ ['/'] = 1, ++ }; ++ while (*name != '\0') { ++ if ((size_t)*name >= RTE_DIM(allowed) || allowed[(int)*name] == 0) ++ return false; ++ name++; ++ } ++ return true; ++} ++ + int + rte_tel_data_add_dict_string(struct rte_tel_data *d, const char *name, + const char *val) +@@ -104,6 +123,9 @@ rte_tel_data_add_dict_string(struct rte_tel_data *d, const char *name, + if (d->data_len >= RTE_TEL_MAX_DICT_ENTRIES) + return -ENOSPC; + ++ if (!valid_name(name)) ++ return -EINVAL; ++ + d->data_len++; + e->type = RTE_TEL_STRING_VAL; + vbytes = strlcpy(e->value.sval, val, RTE_TEL_MAX_STRING_LEN); +@@ -123,6 +145,9 @@ rte_tel_data_add_dict_int(struct rte_tel_data *d, const char *name, int val) + if (d->data_len >= RTE_TEL_MAX_DICT_ENTRIES) + return -ENOSPC; + ++ if (!valid_name(name)) ++ return -EINVAL; ++ + d->data_len++; + e->type = RTE_TEL_INT_VAL; + e->value.ival = val; +@@ -140,6 +165,9 @@ rte_tel_data_add_dict_u64(struct rte_tel_data *d, + if (d->data_len >= RTE_TEL_MAX_DICT_ENTRIES) + return -ENOSPC; + ++ if (!valid_name(name)) ++ return -EINVAL; ++ + d->data_len++; + e->type = RTE_TEL_U64_VAL; + e->value.u64val = val; +@@ -161,6 +189,9 @@ rte_tel_data_add_dict_container(struct rte_tel_data *d, const char *name, + if (d->data_len >= RTE_TEL_MAX_DICT_ENTRIES) + return -ENOSPC; + ++ if (!valid_name(name)) ++ return -EINVAL; ++ + d->data_len++; + e->type = RTE_TEL_CONTAINER; + e->value.container.data = val; +-- +2.23.0 + diff --git a/0184-app-testpmd-fix-DCB-re-configuration.patch b/0184-app-testpmd-fix-DCB-re-configuration.patch deleted file mode 100644 index 419a82966f26415283d5f6c6e498bc56fc9b8698..0000000000000000000000000000000000000000 --- a/0184-app-testpmd-fix-DCB-re-configuration.patch +++ /dev/null @@ -1,75 +0,0 @@ -From 4a7456ce2099cd58f1408449520a9d66e6baa81c Mon Sep 17 00:00:00 2001 -From: Huisong Li -Date: Wed, 28 Apr 2021 14:40:42 +0800 -Subject: [PATCH 184/189] app/testpmd: fix DCB re-configuration - -After DCB mode is configured, if we decrease the number of RX and TX -queues, fwd_config_setup() will be called to setup the DCB forwarding -configuration. And forwarding streams are updated based on new queue -numbers in fwd_config_setup(), but the mapping between the TC and -queues obtained by rte_eth_dev_get_dcb_info() is still old queue -numbers (old queue numbers are greater than new queue numbers). -In this case, the segment fault happens. So rte_eth_dev_configure() -should be called again to update the mapping between the TC and -queues before rte_eth_dev_get_dcb_info(). - -Like: -set nbcore 4 -port stop all -port config 0 dcb vt off 4 pfc on -port start all -port stop all -port config all rxq 8 -port config all txq 8 - -Fixes: 900550de04a7 ("app/testpmd: add dcb support") -Cc: stable@dpdk.org - -Signed-off-by: Huisong Li -Signed-off-by: Lijun Ou -Acked-by: Xiaoyun Li ---- - app/test-pmd/config.c | 26 ++++++++++++++++++++++++++ - 1 file changed, 26 insertions(+) - -diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c -index 075929c..c3f9431 100644 ---- a/app/test-pmd/config.c -+++ b/app/test-pmd/config.c -@@ -3189,7 +3189,33 @@ dcb_fwd_config_setup(void) - uint16_t nb_rx_queue, nb_tx_queue; - uint16_t i, j, k, sm_id = 0; - uint16_t total_tc_num; -+ struct rte_port *port; - uint8_t tc = 0; -+ portid_t pid; -+ int ret; -+ -+ /* -+ * The fwd_config_setup() is called when the port is RTE_PORT_STARTED -+ * or RTE_PORT_STOPPED. -+ * -+ * Re-configure ports to get updated mapping between tc and queue in -+ * case the queue number of the port is changed. Skip for started ports -+ * since modifying queue number and calling dev_configure need to stop -+ * ports first. -+ */ -+ for (pid = 0; pid < nb_fwd_ports; pid++) { -+ if (port_is_started(pid) == 1) -+ continue; -+ -+ port = &ports[pid]; -+ ret = rte_eth_dev_configure(pid, nb_rxq, nb_txq, -+ &port->dev_conf); -+ if (ret < 0) { -+ printf("Failed to re-configure port %d, ret = %d.\n", -+ pid, ret); -+ return; -+ } -+ } - - cur_fwd_config.nb_fwd_lcores = (lcoreid_t) nb_fwd_lcores; - cur_fwd_config.nb_fwd_ports = nb_fwd_ports; --- -2.7.4 - diff --git a/0184-telemetry-fix-escaping-of-invalid-json-characters.patch b/0184-telemetry-fix-escaping-of-invalid-json-characters.patch new file mode 100644 index 0000000000000000000000000000000000000000..9f32e8c0e5ec466ed96b098671edcca17269d703 --- /dev/null +++ b/0184-telemetry-fix-escaping-of-invalid-json-characters.patch @@ -0,0 +1,122 @@ +From bdedf8a96e0782e98291e219ed7b74cb7b04fc9c Mon Sep 17 00:00:00 2001 +From: Bruce Richardson +Date: Fri, 21 Oct 2022 15:37:00 +0800 +Subject: [PATCH 184/189] telemetry: fix escaping of invalid json characters +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +For string values returned from telemetry, escape any values that cannot +normally appear in a json string. According to the json spec[1], the +characters than need to be handled are control chars (char value < 0x20) +and '"' and '\' characters. + +To handle this, we replace the snprintf call with a separate string +copying and encapsulation routine which checks each character as it +copies it to the final array. + +[1] https://www.rfc-editor.org/rfc/rfc8259.txt + +Bugzilla ID: 1037 +Fixes: 6dd571fd07c3 ("telemetry: introduce new functionality") + +Signed-off-by: Bruce Richardson +Acked-by: Ciara Power +Acked-by: Morten Brørup +Acked-by: Chengwen Feng +--- + lib/telemetry/telemetry.c | 11 +++++--- + lib/telemetry/telemetry_json.h | 48 +++++++++++++++++++++++++++++++++- + 2 files changed, 55 insertions(+), 4 deletions(-) + +diff --git a/lib/telemetry/telemetry.c b/lib/telemetry/telemetry.c +index e5ccfe47f7..d4a7838ded 100644 +--- a/lib/telemetry/telemetry.c ++++ b/lib/telemetry/telemetry.c +@@ -233,9 +233,14 @@ output_json(const char *cmd, const struct rte_tel_data *d, int s) + MAX_CMD_LEN, cmd ? cmd : "none"); + break; + case RTE_TEL_STRING: +- used = snprintf(out_buf, sizeof(out_buf), "{\"%.*s\":\"%.*s\"}", +- MAX_CMD_LEN, cmd, +- RTE_TEL_MAX_SINGLE_STRING_LEN, d->data.str); ++ prefix_used = snprintf(out_buf, sizeof(out_buf), "{\"%.*s\":", ++ MAX_CMD_LEN, cmd); ++ cb_data_buf = &out_buf[prefix_used]; ++ buf_len = sizeof(out_buf) - prefix_used - 1; /* space for '}' */ ++ ++ used = rte_tel_json_str(cb_data_buf, buf_len, 0, d->data.str); ++ used += prefix_used; ++ used += strlcat(out_buf + used, "}", sizeof(out_buf) - used); + break; + case RTE_TEL_DICT: + prefix_used = snprintf(out_buf, sizeof(out_buf), "{\"%.*s\":", +diff --git a/lib/telemetry/telemetry_json.h b/lib/telemetry/telemetry_json.h +index db70690274..13df5d07e3 100644 +--- a/lib/telemetry/telemetry_json.h ++++ b/lib/telemetry/telemetry_json.h +@@ -44,6 +44,52 @@ __json_snprintf(char *buf, const int len, const char *format, ...) + return 0; /* nothing written or modified */ + } + ++static const char control_chars[0x20] = { ++ ['\n'] = 'n', ++ ['\r'] = 'r', ++ ['\t'] = 't', ++}; ++ ++/** ++ * @internal ++ * Does the same as __json_snprintf(buf, len, "\"%s\"", str) ++ * except that it does proper escaping as necessary. ++ * Drops any invalid characters we don't support ++ */ ++static inline int ++__json_format_str(char *buf, const int len, const char *str) ++{ ++ char tmp[len]; ++ int tmpidx = 0; ++ ++ tmp[tmpidx++] = '"'; ++ while (*str != '\0') { ++ if (*str < (int)RTE_DIM(control_chars)) { ++ int idx = *str; /* compilers don't like char type as index */ ++ if (control_chars[idx] != 0) { ++ tmp[tmpidx++] = '\\'; ++ tmp[tmpidx++] = control_chars[idx]; ++ } ++ } else if (*str == '"' || *str == '\\') { ++ tmp[tmpidx++] = '\\'; ++ tmp[tmpidx++] = *str; ++ } else ++ tmp[tmpidx++] = *str; ++ /* we always need space for closing quote and null character. ++ * Ensuring at least two free characters also means we can always take an ++ * escaped character like "\n" without overflowing ++ */ ++ if (tmpidx > len - 2) ++ return 0; ++ str++; ++ } ++ tmp[tmpidx++] = '"'; ++ tmp[tmpidx] = '\0'; ++ ++ strcpy(buf, tmp); ++ return tmpidx; ++} ++ + /* Copies an empty array into the provided buffer. */ + static inline int + rte_tel_json_empty_array(char *buf, const int len, const int used) +@@ -62,7 +108,7 @@ rte_tel_json_empty_obj(char *buf, const int len, const int used) + static inline int + rte_tel_json_str(char *buf, const int len, const int used, const char *str) + { +- return used + __json_snprintf(buf + used, len - used, "\"%s\"", str); ++ return used + __json_format_str(buf + used, len - used, str); + } + + /* Appends a string into the JSON array in the provided buffer. */ +-- +2.23.0 + diff --git a/0185-app-testpmd-check-DCB-info-support-for-configuration.patch b/0185-app-testpmd-check-DCB-info-support-for-configuration.patch deleted file mode 100644 index 5e05e3e526045145da408ebb36259e4d13719347..0000000000000000000000000000000000000000 --- a/0185-app-testpmd-check-DCB-info-support-for-configuration.patch +++ /dev/null @@ -1,48 +0,0 @@ -From f53ebd40c6c205fc06fab74a0f9456551a8656c1 Mon Sep 17 00:00:00 2001 -From: Huisong Li -Date: Wed, 28 Apr 2021 14:40:43 +0800 -Subject: [PATCH 185/189] app/testpmd: check DCB info support for configuration - -Currently, '.get_dcb_info' must be supported for the port doing DCB -test, or all information in 'rte_eth_dcb_info' are zero. It should be -prevented when user run cmd "port config 0 dcb vt off 4 pfc off". - -This patch adds the check for support of reporting dcb info. - -Signed-off-by: Huisong Li -Signed-off-by: Lijun Ou -Acked-by: Xiaoyun Li ---- - app/test-pmd/cmdline.c | 9 +++++++++ - 1 file changed, 9 insertions(+) - -diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c -index 59c4f7e..40a6871 100644 ---- a/app/test-pmd/cmdline.c -+++ b/app/test-pmd/cmdline.c -@@ -3247,6 +3247,7 @@ cmd_config_dcb_parsed(void *parsed_result, - __rte_unused void *data) - { - struct cmd_config_dcb *res = parsed_result; -+ struct rte_eth_dcb_info dcb_info; - portid_t port_id = res->port_id; - struct rte_port *port; - uint8_t pfc_en; -@@ -3269,6 +3270,14 @@ cmd_config_dcb_parsed(void *parsed_result, - printf("nb_cores shouldn't be less than number of TCs.\n"); - return; - } -+ -+ /* Check whether the port supports the report of DCB info. */ -+ ret = rte_eth_dev_get_dcb_info(port_id, &dcb_info); -+ if (ret == -ENOTSUP) { -+ printf("rte_eth_dev_get_dcb_info not supported.\n"); -+ return; -+ } -+ - if (!strncmp(res->pfc_en, "on", 2)) - pfc_en = 1; - else --- -2.7.4 - diff --git a/0185-telemetry-add-escaping-of-strings-in-arrays.patch b/0185-telemetry-add-escaping-of-strings-in-arrays.patch new file mode 100644 index 0000000000000000000000000000000000000000..0523e66bbd068608a30062aa4a3bb0a2a61fe821 --- /dev/null +++ b/0185-telemetry-add-escaping-of-strings-in-arrays.patch @@ -0,0 +1,97 @@ +From df367f0febc7e5ea999f119f420d30a953268503 Mon Sep 17 00:00:00 2001 +From: Bruce Richardson +Date: Fri, 21 Oct 2022 15:37:01 +0800 +Subject: [PATCH 185/189] telemetry: add escaping of strings in arrays +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +When strings are added to an array variable, we need to properly escape +the invalid json characters in the strings. + +Signed-off-by: Bruce Richardson +Acked-by: Ciara Power +Acked-by: Morten Brørup +Acked-by: Chengwen Feng +--- + lib/telemetry/telemetry_json.h | 28 +++++++++++++++++++--------- + 1 file changed, 19 insertions(+), 9 deletions(-) + +diff --git a/lib/telemetry/telemetry_json.h b/lib/telemetry/telemetry_json.h +index 13df5d07e3..c4442a0bf0 100644 +--- a/lib/telemetry/telemetry_json.h ++++ b/lib/telemetry/telemetry_json.h +@@ -52,17 +52,22 @@ static const char control_chars[0x20] = { + + /** + * @internal +- * Does the same as __json_snprintf(buf, len, "\"%s\"", str) +- * except that it does proper escaping as necessary. ++ * This function acts the same as __json_snprintf(buf, len, "%s%s%s", prefix, str, suffix) ++ * except that it does proper escaping of "str" as necessary. Prefix and suffix should be compile- ++ * time constants not needing escaping. + * Drops any invalid characters we don't support + */ + static inline int +-__json_format_str(char *buf, const int len, const char *str) ++__json_format_str(char *buf, const int len, const char *prefix, const char *str, const char *suffix) + { + char tmp[len]; + int tmpidx = 0; + +- tmp[tmpidx++] = '"'; ++ while (*prefix != '\0' && tmpidx < len) ++ tmp[tmpidx++] = *prefix++; ++ if (tmpidx >= len) ++ return 0; ++ + while (*str != '\0') { + if (*str < (int)RTE_DIM(control_chars)) { + int idx = *str; /* compilers don't like char type as index */ +@@ -75,7 +80,7 @@ __json_format_str(char *buf, const int len, const char *str) + tmp[tmpidx++] = *str; + } else + tmp[tmpidx++] = *str; +- /* we always need space for closing quote and null character. ++ /* we always need space for (at minimum) closing quote and null character. + * Ensuring at least two free characters also means we can always take an + * escaped character like "\n" without overflowing + */ +@@ -83,7 +88,12 @@ __json_format_str(char *buf, const int len, const char *str) + return 0; + str++; + } +- tmp[tmpidx++] = '"'; ++ ++ while (*suffix != '\0' && tmpidx < len) ++ tmp[tmpidx++] = *suffix++; ++ if (tmpidx >= len) ++ return 0; ++ + tmp[tmpidx] = '\0'; + + strcpy(buf, tmp); +@@ -108,7 +118,7 @@ rte_tel_json_empty_obj(char *buf, const int len, const int used) + static inline int + rte_tel_json_str(char *buf, const int len, const int used, const char *str) + { +- return used + __json_format_str(buf + used, len - used, str); ++ return used + __json_format_str(buf + used, len - used, "\"", str, "\""); + } + + /* Appends a string into the JSON array in the provided buffer. */ +@@ -118,9 +128,9 @@ rte_tel_json_add_array_string(char *buf, const int len, const int used, + { + int ret, end = used - 1; /* strip off final delimiter */ + if (used <= 2) /* assume empty, since minimum is '[]' */ +- return __json_snprintf(buf, len, "[\"%s\"]", str); ++ return __json_format_str(buf, len, "[\"", str, "\"]"); + +- ret = __json_snprintf(buf + end, len - end, ",\"%s\"]", str); ++ ret = __json_format_str(buf + end, len - end, ",\"", str, "\"]"); + return ret == 0 ? used : end + ret; + } + +-- +2.23.0 + diff --git a/0186-app-testpmd-verify-DCB-config-during-forward-config.patch b/0186-app-testpmd-verify-DCB-config-during-forward-config.patch deleted file mode 100644 index fe08a1a2d7544367ca0bac077543be9a56cd452e..0000000000000000000000000000000000000000 --- a/0186-app-testpmd-verify-DCB-config-during-forward-config.patch +++ /dev/null @@ -1,107 +0,0 @@ -From 118f18c9ab370a30a25ef548d1dee2b125bcfc16 Mon Sep 17 00:00:00 2001 -From: Huisong Li -Date: Wed, 28 Apr 2021 14:40:44 +0800 -Subject: [PATCH 186/189] app/testpmd: verify DCB config during forward config - -Currently, the check for doing DCB test is assigned to -start_packet_forwarding(), which will be called when -run "start" cmd. But fwd_config_setup() is used in many -scenarios, such as, "port config all rxq". - -This patch moves the check from start_packet_forwarding() -to fwd_config_setup(). - -Fixes: 7741e4cf16c0 ("app/testpmd: VMDq and DCB updates") -Cc: stable@dpdk.org - -Signed-off-by: Huisong Li -Signed-off-by: Lijun Ou -Acked-by: Xiaoyun Li ---- - app/test-pmd/config.c | 23 +++++++++++++++++++++-- - app/test-pmd/testpmd.c | 19 ------------------- - 2 files changed, 21 insertions(+), 21 deletions(-) - -diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c -index c3f9431..7af13f6 100644 ---- a/app/test-pmd/config.c -+++ b/app/test-pmd/config.c -@@ -3345,6 +3345,10 @@ icmp_echo_config_setup(void) - void - fwd_config_setup(void) - { -+ struct rte_port *port; -+ portid_t pt_id; -+ unsigned int i; -+ - cur_fwd_config.fwd_eng = cur_fwd_eng; - if (strcmp(cur_fwd_eng->fwd_mode_name, "icmpecho") == 0) { - icmp_echo_config_setup(); -@@ -3352,9 +3356,24 @@ fwd_config_setup(void) - } - - if ((nb_rxq > 1) && (nb_txq > 1)){ -- if (dcb_config) -+ if (dcb_config) { -+ for (i = 0; i < nb_fwd_ports; i++) { -+ pt_id = fwd_ports_ids[i]; -+ port = &ports[pt_id]; -+ if (!port->dcb_flag) { -+ printf("In DCB mode, all forwarding ports must " -+ "be configured in this mode.\n"); -+ return; -+ } -+ } -+ if (nb_fwd_lcores == 1) { -+ printf("In DCB mode,the nb forwarding cores " -+ "should be larger than 1.\n"); -+ return; -+ } -+ - dcb_fwd_config_setup(); -- else -+ } else - rss_fwd_config_setup(); - } - else -diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c -index e55d986..f9155ae 100644 ---- a/app/test-pmd/testpmd.c -+++ b/app/test-pmd/testpmd.c -@@ -2112,9 +2112,7 @@ start_packet_forwarding(int with_tx_first) - { - port_fwd_begin_t port_fwd_begin; - port_fwd_end_t port_fwd_end; -- struct rte_port *port; - unsigned int i; -- portid_t pt_id; - - if (strcmp(cur_fwd_eng->fwd_mode_name, "rxonly") == 0 && !nb_rxq) - rte_exit(EXIT_FAILURE, "rxq are 0, cannot use rxonly fwd mode\n"); -@@ -2137,23 +2135,6 @@ start_packet_forwarding(int with_tx_first) - printf("Packet forwarding already started\n"); - return; - } -- -- if (dcb_config) { -- for (i = 0; i < nb_fwd_ports; i++) { -- pt_id = fwd_ports_ids[i]; -- port = &ports[pt_id]; -- if (!port->dcb_flag) { -- printf("In DCB mode, all forwarding ports must " -- "be configured in this mode.\n"); -- return; -- } -- } -- if (nb_fwd_lcores == 1) { -- printf("In DCB mode,the nb forwarding cores " -- "should be larger than 1.\n"); -- return; -- } -- } - test_done = 0; - - fwd_config_setup(); --- -2.7.4 - diff --git a/0186-telemetry-add-escaping-of-strings-in-dicts.patch b/0186-telemetry-add-escaping-of-strings-in-dicts.patch new file mode 100644 index 0000000000000000000000000000000000000000..9234a9a2184302e2fc93fc6193171ad8a4df1be4 --- /dev/null +++ b/0186-telemetry-add-escaping-of-strings-in-dicts.patch @@ -0,0 +1,55 @@ +From c3036c497f29f4acf6423a88f59963781af3eafd Mon Sep 17 00:00:00 2001 +From: Bruce Richardson +Date: Fri, 21 Oct 2022 15:37:02 +0800 +Subject: [PATCH 186/189] telemetry: add escaping of strings in dicts +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +When strings are added to an dict variable, we need to properly escape +the invalid json characters in the strings. + +Signed-off-by: Bruce Richardson +Acked-by: Ciara Power +Acked-by: Morten Brørup +Acked-by: Chengwen Feng +--- + lib/telemetry/telemetry_json.h | 12 ++++++++---- + 1 file changed, 8 insertions(+), 4 deletions(-) + +diff --git a/lib/telemetry/telemetry_json.h b/lib/telemetry/telemetry_json.h +index c4442a0bf0..e3fae7c30d 100644 +--- a/lib/telemetry/telemetry_json.h ++++ b/lib/telemetry/telemetry_json.h +@@ -54,7 +54,7 @@ static const char control_chars[0x20] = { + * @internal + * This function acts the same as __json_snprintf(buf, len, "%s%s%s", prefix, str, suffix) + * except that it does proper escaping of "str" as necessary. Prefix and suffix should be compile- +- * time constants not needing escaping. ++ * time constants, or values not needing escaping. + * Drops any invalid characters we don't support + */ + static inline int +@@ -219,12 +219,16 @@ static inline int + rte_tel_json_add_obj_str(char *buf, const int len, const int used, + const char *name, const char *val) + { ++ char tmp_name[RTE_TEL_MAX_STRING_LEN + 5]; + int ret, end = used - 1; ++ ++ /* names are limited to certain characters so need no escaping */ ++ snprintf(tmp_name, sizeof(tmp_name), "{\"%s\":\"", name); + if (used <= 2) /* assume empty, since minimum is '{}' */ +- return __json_snprintf(buf, len, "{\"%s\":\"%s\"}", name, val); ++ return __json_format_str(buf, len, tmp_name, val, "\"}"); + +- ret = __json_snprintf(buf + end, len - end, ",\"%s\":\"%s\"}", +- name, val); ++ tmp_name[0] = ','; /* replace '{' with ',' at start */ ++ ret = __json_format_str(buf + end, len - end, tmp_name, val, "\"}"); + return ret == 0 ? used : end + ret; + } + +-- +2.23.0 + diff --git a/0187-app-testpmd-add-forwarding-configuration-to-DCB-conf.patch b/0187-app-testpmd-add-forwarding-configuration-to-DCB-conf.patch deleted file mode 100644 index 9c3b3fd261e275e9bd617f742b586dd6cd9d718b..0000000000000000000000000000000000000000 --- a/0187-app-testpmd-add-forwarding-configuration-to-DCB-conf.patch +++ /dev/null @@ -1,40 +0,0 @@ -From b7e79c9c712372946ccd9ce66bd3d1b91cd0a9d1 Mon Sep 17 00:00:00 2001 -From: Huisong Li -Date: Wed, 28 Apr 2021 14:40:45 +0800 -Subject: [PATCH 187/189] app/testpmd: add forwarding configuration to DCB - config - -This patch adds fwd_config_setup() at the end of cmd_config_dcb_parsed() -to update "cur_fwd_config", so that the actual forwarding streams can be -queried by the "show config fwd" cmd. - -Signed-off-by: Huisong Li -Signed-off-by: Lijun Ou -Acked-by: Xiaoyun Li ---- - app/test-pmd/cmdline.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c -index 40a6871..78db462 100644 ---- a/app/test-pmd/cmdline.c -+++ b/app/test-pmd/cmdline.c -@@ -3292,13 +3292,13 @@ cmd_config_dcb_parsed(void *parsed_result, - ret = init_port_dcb_config(port_id, DCB_ENABLED, - (enum rte_eth_nb_tcs)res->num_tcs, - pfc_en); -- -- - if (ret != 0) { - printf("Cannot initialize network ports.\n"); - return; - } - -+ fwd_config_setup(); -+ - cmd_reconfig_device_queue(port_id, 1, 1); - } - --- -2.7.4 - diff --git a/0187-telemetry-limit-command-characters.patch b/0187-telemetry-limit-command-characters.patch new file mode 100644 index 0000000000000000000000000000000000000000..ea65d46df7bbe9b6c7bb95eb8c245a56f512bd93 --- /dev/null +++ b/0187-telemetry-limit-command-characters.patch @@ -0,0 +1,55 @@ +From 585eeea3522ce2225a1df94fcc0b8aec2d881b44 Mon Sep 17 00:00:00 2001 +From: Bruce Richardson +Date: Fri, 21 Oct 2022 15:37:03 +0800 +Subject: [PATCH 187/189] telemetry: limit command characters +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Limit the telemetry command characters to the minimum set needed for +current implementations. This prevents issues with invalid json +characters needing to be escaped on replies. + +Signed-off-by: Bruce Richardson +Acked-by: Ciara Power +Acked-by: Morten Brørup +Acked-by: Chengwen Feng +--- + lib/telemetry/telemetry.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/lib/telemetry/telemetry.c b/lib/telemetry/telemetry.c +index d4a7838ded..f0be50b2bf 100644 +--- a/lib/telemetry/telemetry.c ++++ b/lib/telemetry/telemetry.c +@@ -3,6 +3,7 @@ + */ + + #ifndef RTE_EXEC_ENV_WINDOWS ++#include + #include + #include + #include +@@ -71,12 +72,19 @@ int + rte_telemetry_register_cmd(const char *cmd, telemetry_cb fn, const char *help) + { + struct cmd_callback *new_callbacks; ++ const char *cmdp = cmd; + int i = 0; + + if (strlen(cmd) >= MAX_CMD_LEN || fn == NULL || cmd[0] != '/' + || strlen(help) >= RTE_TEL_MAX_STRING_LEN) + return -EINVAL; + ++ while (*cmdp != '\0') { ++ if (!isalnum(*cmdp) && *cmdp != '_' && *cmdp != '/') ++ return -EINVAL; ++ cmdp++; ++ } ++ + rte_spinlock_lock(&callback_sl); + new_callbacks = realloc(callbacks, sizeof(callbacks[0]) * (num_callbacks + 1)); + if (new_callbacks == NULL) { +-- +2.23.0 + diff --git a/0188-app-testpmd-remove-redundant-forwarding-initializati.patch b/0188-app-testpmd-remove-redundant-forwarding-initializati.patch deleted file mode 100644 index 640ad6b6e68f927d0f62b66d48a11908bfccabd7..0000000000000000000000000000000000000000 --- a/0188-app-testpmd-remove-redundant-forwarding-initializati.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 998201309e193b7203ad6418c184993e0f61fc28 Mon Sep 17 00:00:00 2001 -From: Huisong Li -Date: Wed, 28 Apr 2021 14:40:46 +0800 -Subject: [PATCH 188/189] app/testpmd: remove redundant forwarding - initialization - -The fwd_config_setup() is called after init_fwd_streams(). -The fwd_config_setup() will reinitialize forwarding streams. -This patch removes init_fwd_streams() from init_config(). - -Signed-off-by: Huisong Li -Signed-off-by: Lijun Ou -Acked-by: Xiaoyun Li ---- - app/test-pmd/testpmd.c | 4 ---- - 1 file changed, 4 deletions(-) - -diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c -index f9155ae..3098df6 100644 ---- a/app/test-pmd/testpmd.c -+++ b/app/test-pmd/testpmd.c -@@ -1559,10 +1559,6 @@ init_config(void) - fwd_lcores[lc_id]->gso_ctx.flag = 0; - } - -- /* Configuration of packet forwarding streams. */ -- if (init_fwd_streams() < 0) -- rte_exit(EXIT_FAILURE, "FAIL from init_fwd_streams()\n"); -- - fwd_config_setup(); - - /* create a gro context for each lcore */ --- -2.7.4 - diff --git a/0188-telemetry-eliminate-duplicate-code-for-json-output.patch b/0188-telemetry-eliminate-duplicate-code-for-json-output.patch new file mode 100644 index 0000000000000000000000000000000000000000..89e8c425f2da5bad98d6ddc43039cceb8b82317a --- /dev/null +++ b/0188-telemetry-eliminate-duplicate-code-for-json-output.patch @@ -0,0 +1,103 @@ +From c89a9af036a9063903537404d615bed04a700e5b Mon Sep 17 00:00:00 2001 +From: Bruce Richardson +Date: Fri, 21 Oct 2022 15:37:04 +0800 +Subject: [PATCH 188/189] telemetry: eliminate duplicate code for json output +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +When preparing the json response to a telemetry socket query, the code +for prefixing the command name, and appending the file "}" on the end of +the response was duplicated for multiple reply types. Taking this code +out of the switch statement reduces the duplication and makes the code +more maintainable. + +For completeness of testing, add in a test case to validate the "null" +response type - the only leg of the switch statement not already covered +by an existing test case in the telemetry_data tests. + +Signed-off-by: Bruce Richardson +Acked-by: Ciara Power +Acked-by: Morten Brørup +Acked-by: Chengwen Feng +--- + lib/telemetry/telemetry.c | 35 ++++++++++++----------------------- + 1 file changed, 12 insertions(+), 23 deletions(-) + +diff --git a/lib/telemetry/telemetry.c b/lib/telemetry/telemetry.c +index f0be50b2bf..25ab6ed877 100644 +--- a/lib/telemetry/telemetry.c ++++ b/lib/telemetry/telemetry.c +@@ -235,27 +235,22 @@ output_json(const char *cmd, const struct rte_tel_data *d, int s) + + RTE_BUILD_BUG_ON(sizeof(out_buf) < MAX_CMD_LEN + + RTE_TEL_MAX_SINGLE_STRING_LEN + 10); ++ ++ prefix_used = snprintf(out_buf, sizeof(out_buf), "{\"%.*s\":", ++ MAX_CMD_LEN, cmd); ++ cb_data_buf = &out_buf[prefix_used]; ++ buf_len = sizeof(out_buf) - prefix_used - 1; /* space for '}' */ ++ + switch (d->type) { + case RTE_TEL_NULL: +- used = snprintf(out_buf, sizeof(out_buf), "{\"%.*s\":null}", +- MAX_CMD_LEN, cmd ? cmd : "none"); ++ used = strlcpy(cb_data_buf, "null", buf_len); + break; +- case RTE_TEL_STRING: +- prefix_used = snprintf(out_buf, sizeof(out_buf), "{\"%.*s\":", +- MAX_CMD_LEN, cmd); +- cb_data_buf = &out_buf[prefix_used]; +- buf_len = sizeof(out_buf) - prefix_used - 1; /* space for '}' */ + ++ case RTE_TEL_STRING: + used = rte_tel_json_str(cb_data_buf, buf_len, 0, d->data.str); +- used += prefix_used; +- used += strlcat(out_buf + used, "}", sizeof(out_buf) - used); + break; +- case RTE_TEL_DICT: +- prefix_used = snprintf(out_buf, sizeof(out_buf), "{\"%.*s\":", +- MAX_CMD_LEN, cmd); +- cb_data_buf = &out_buf[prefix_used]; +- buf_len = sizeof(out_buf) - prefix_used - 1; /* space for '}' */ + ++ case RTE_TEL_DICT: + used = rte_tel_json_empty_obj(cb_data_buf, buf_len, 0); + for (i = 0; i < d->data_len; i++) { + const struct tel_dict_entry *v = &d->data.dict[i]; +@@ -291,18 +286,12 @@ output_json(const char *cmd, const struct rte_tel_data *d, int s) + } + } + } +- used += prefix_used; +- used += strlcat(out_buf + used, "}", sizeof(out_buf) - used); + break; ++ + case RTE_TEL_ARRAY_STRING: + case RTE_TEL_ARRAY_INT: + case RTE_TEL_ARRAY_U64: + case RTE_TEL_ARRAY_CONTAINER: +- prefix_used = snprintf(out_buf, sizeof(out_buf), "{\"%.*s\":", +- MAX_CMD_LEN, cmd); +- cb_data_buf = &out_buf[prefix_used]; +- buf_len = sizeof(out_buf) - prefix_used - 1; /* space for '}' */ +- + used = rte_tel_json_empty_array(cb_data_buf, buf_len, 0); + for (i = 0; i < d->data_len; i++) + if (d->type == RTE_TEL_ARRAY_STRING) +@@ -330,10 +319,10 @@ output_json(const char *cmd, const struct rte_tel_data *d, int s) + if (!rec_data->keep) + rte_tel_data_free(rec_data->data); + } +- used += prefix_used; +- used += strlcat(out_buf + used, "}", sizeof(out_buf) - used); + break; + } ++ used += prefix_used; ++ used += strlcat(out_buf + used, "}", sizeof(out_buf) - used); + if (write(s, out_buf, used) < 0) + perror("Error writing to socket"); + } +-- +2.23.0 + diff --git a/0189-config-arm-check-SVE-CPU-flag.patch b/0189-config-arm-check-SVE-CPU-flag.patch deleted file mode 100644 index 00a8235935b828b2278df892edc3c3405b1dc9f2..0000000000000000000000000000000000000000 --- a/0189-config-arm-check-SVE-CPU-flag.patch +++ /dev/null @@ -1,39 +0,0 @@ -From 5108d77df4a599d04d378368247e0d234d01766e Mon Sep 17 00:00:00 2001 -From: Chengwen Feng -Date: Fri, 21 May 2021 11:33:54 +0800 -Subject: [PATCH 01/26] config/arm: check SVE CPU flag - -If compiled with SVE feature (e.g. "-march=armv8.2-a+sve'), the binary -could not run on non-SVE platform else it will encounter illegal -instruction [1]. - -This patch fixes it by adding 'RTE_CPUFLAG_SVE' to compile_time_cpuflags, -so that rte_cpu_is_supported() will print meaningful log under above -situation. - -[1] http://mails.dpdk.org/archives/dev/2021-May/209124.html - -Signed-off-by: Chengwen Feng -Acked-by: Ruifeng Wang ---- - config/arm/meson.build | 4 ++++ - 1 file changed, 4 insertions(+) - -diff --git a/config/arm/meson.build b/config/arm/meson.build -index 42b4e43..b18acea 100644 ---- a/config/arm/meson.build -+++ b/config/arm/meson.build -@@ -214,6 +214,10 @@ if (cc.get_define('__ARM_NEON', args: machine_args) != '' or - compile_time_cpuflags += ['RTE_CPUFLAG_NEON'] - endif - -+if cc.get_define('__ARM_FEATURE_SVE', args: machine_args) != '' -+ compile_time_cpuflags += ['RTE_CPUFLAG_SVE'] -+endif -+ - if cc.get_define('__ARM_FEATURE_CRC32', args: machine_args) != '' - compile_time_cpuflags += ['RTE_CPUFLAG_CRC32'] - endif --- -2.7.4 - diff --git a/0189-net-fix-compiling-bug-for-20.11-merge.patch b/0189-net-fix-compiling-bug-for-20.11-merge.patch deleted file mode 100644 index d857b832bd11da2c0159c0c128510b6509ea507e..0000000000000000000000000000000000000000 --- a/0189-net-fix-compiling-bug-for-20.11-merge.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 2fa098fa0c4986f77f00521bc7ef50948397a6ef Mon Sep 17 00:00:00 2001 -From: "Min Hu (Connor)" -Date: Thu, 10 Jun 2021 15:21:07 +0800 -Subject: [PATCH 189/189] net: fix compiling bug for 20.11 merge - -This patch add byte order support for definition. - -Signed-off-by: Min Hu (Connor) ---- - lib/librte_net/rte_geneve.h | 2 ++ - 1 file changed, 2 insertions(+) - -diff --git a/lib/librte_net/rte_geneve.h b/lib/librte_net/rte_geneve.h -index bb67724..3bbc561 100644 ---- a/lib/librte_net/rte_geneve.h -+++ b/lib/librte_net/rte_geneve.h -@@ -12,6 +12,8 @@ - */ - #include - -+#include -+ - #ifdef __cplusplus - extern "C" { - #endif --- -2.7.4 - diff --git a/0189-telemetry-make-help-command-more-helpful.patch b/0189-telemetry-make-help-command-more-helpful.patch new file mode 100644 index 0000000000000000000000000000000000000000..fa2242c49baf0c3502874d9f6254af733c46500e --- /dev/null +++ b/0189-telemetry-make-help-command-more-helpful.patch @@ -0,0 +1,52 @@ +From 2674bf9f28b9dd7724d72096a8e54b19400239bd Mon Sep 17 00:00:00 2001 +From: Bruce Richardson +Date: Fri, 21 Oct 2022 15:37:05 +0800 +Subject: [PATCH 189/189] telemetry: make help command more helpful +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +The /help telemetry command prints out the help text for the given +command passed in as parameter. However, entering /help without any +parameters does not give any useful information as to the fact that you +need to pass in a command to get help on. Update the command so it +prints its own help text when called without any parameters. + +Signed-off-by: Bruce Richardson +Acked-by: Ciara Power +Acked-by: Morten Brørup +Acked-by: Chengwen Feng +--- + lib/telemetry/telemetry.c | 12 +++++++----- + 1 file changed, 7 insertions(+), 5 deletions(-) + +diff --git a/lib/telemetry/telemetry.c b/lib/telemetry/telemetry.c +index 25ab6ed877..52048de55c 100644 +--- a/lib/telemetry/telemetry.c ++++ b/lib/telemetry/telemetry.c +@@ -141,15 +141,17 @@ command_help(const char *cmd __rte_unused, const char *params, + struct rte_tel_data *d) + { + int i; ++ /* if no parameters return our own help text */ ++ const char *to_lookup = (params == NULL ? cmd : params); + +- if (!params) +- return -1; + rte_tel_data_start_dict(d); + rte_spinlock_lock(&callback_sl); + for (i = 0; i < num_callbacks; i++) +- if (strcmp(params, callbacks[i].cmd) == 0) { +- rte_tel_data_add_dict_string(d, params, +- callbacks[i].help); ++ if (strcmp(to_lookup, callbacks[i].cmd) == 0) { ++ if (params == NULL) ++ rte_tel_data_string(d, callbacks[i].help); ++ else ++ rte_tel_data_add_dict_string(d, params, callbacks[i].help); + break; + } + rte_spinlock_unlock(&callback_sl); +-- +2.23.0 + diff --git a/0190-net-bonding-fix-Tx-hash-for-TCP.patch b/0190-net-bonding-fix-Tx-hash-for-TCP.patch new file mode 100644 index 0000000000000000000000000000000000000000..36d3796ce84e026210172a4f25a4835d842dd6b9 --- /dev/null +++ b/0190-net-bonding-fix-Tx-hash-for-TCP.patch @@ -0,0 +1,42 @@ +From fbe9bd4deab755855a4ef2d88e559da6ae4b76c2 Mon Sep 17 00:00:00 2001 +From: Jun Qiu +Date: Fri, 28 Oct 2022 15:32:42 +0800 +Subject: net/bonding: fix Tx hash for TCP + +In the following two cases, tcp_hdr + sizeof(*tcp_hdr) == pkt_end, +and the TCP port is not taken into account in calculating the HASH +value of TCP packets. TCP connections with the same source and +destination IP addresses will be hashed to the same slave port, +which may cause load imbalance. +1. TCP Pure ACK packets with no options, The header length is 20 +and there is no data. +2. A TCP packet contains data, but the first seg of the mbuf +contains only the header information (ETH, IP, TCP), and the +data is in subsequent segs, which is usually the case in the +indirect mbuf used for zero-copy. + +Fixes: 726158060d55 ("net/bonding: fix potential out of bounds read") +Cc: stable@dpdk.org + +Signed-off-by: Jun Qiu +Acked-by: Min Hu (Connor) +--- + drivers/net/bonding/rte_eth_bond_pmd.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c +index 3be2b08128..18754e3299 100644 +--- a/drivers/net/bonding/rte_eth_bond_pmd.c ++++ b/drivers/net/bonding/rte_eth_bond_pmd.c +@@ -768,7 +768,7 @@ burst_xmit_l34_hash(struct rte_mbuf **buf, uint16_t nb_pkts, + ((char *)ipv4_hdr + + ip_hdr_offset); + if ((size_t)tcp_hdr + sizeof(*tcp_hdr) +- < pkt_end) ++ <= pkt_end) + l4hash = HASH_L4_PORTS(tcp_hdr); + } else if (ipv4_hdr->next_proto_id == + IPPROTO_UDP) { +-- +2.23.0 + diff --git a/0190-net-hns3-increase-VF-reset-retry-maximum.patch b/0190-net-hns3-increase-VF-reset-retry-maximum.patch deleted file mode 100644 index ebf60ffb2d52dcde5cb07c8b14d40de2bb3fe3cc..0000000000000000000000000000000000000000 --- a/0190-net-hns3-increase-VF-reset-retry-maximum.patch +++ /dev/null @@ -1,46 +0,0 @@ -From ef9a1fa57d0e364793481727fecc3833b5a82918 Mon Sep 17 00:00:00 2001 -From: Hongbo Zheng -Date: Sun, 13 Jun 2021 10:31:51 +0800 -Subject: [PATCH 02/26] net/hns3: increase VF reset retry maximum - -When the device is very busy, VF reset may have to be -retried many times to succeed, leading to the current -max reset fail retry count not enough. - -Modify max reset fail retry count to 30 to enhance -the reliability of reset function. - -Fixes: 2790c6464725 ("net/hns3: support device reset") -Cc: stable@dpdk.org - -Signed-off-by: Hongbo Zheng -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_intr.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/drivers/net/hns3/hns3_intr.c b/drivers/net/hns3/hns3_intr.c -index 854cb1d..e8ca6d5 100644 ---- a/drivers/net/hns3/hns3_intr.c -+++ b/drivers/net/hns3/hns3_intr.c -@@ -2582,7 +2582,7 @@ hns3_clear_reset_level(struct hns3_hw *hw, uint64_t *levels) - static bool - hns3_reset_err_handle(struct hns3_adapter *hns) - { --#define MAX_RESET_FAIL_CNT 5 -+#define MAX_RESET_FAIL_CNT 30 - - struct hns3_hw *hw = &hns->hw; - -@@ -2676,7 +2676,7 @@ hns3_reset_pre(struct hns3_adapter *hns) - static int - hns3_reset_post(struct hns3_adapter *hns) - { --#define TIMEOUT_RETRIES_CNT 5 -+#define TIMEOUT_RETRIES_CNT 30 - struct hns3_hw *hw = &hns->hw; - struct timeval tv_delta; - struct timeval tv; --- -2.7.4 - diff --git a/0191-net-bonding-add-link-speeds-configuration.patch b/0191-net-bonding-add-link-speeds-configuration.patch new file mode 100644 index 0000000000000000000000000000000000000000..8bdecefd6bb08243e4987c63a64866021aa385ca --- /dev/null +++ b/0191-net-bonding-add-link-speeds-configuration.patch @@ -0,0 +1,112 @@ +From b92c505e9506f38e76dcf094fbbb2e765e5452a8 Mon Sep 17 00:00:00 2001 +From: Huisong Li +Date: Fri, 28 Oct 2022 15:32:43 +0800 +Subject: net/bonding: add link speeds configuration + +This patch adds link speeds configuration. + +Signed-off-by: Huisong Li +Acked-by: Chas Williams <3chas3@gmail.com> +--- + drivers/net/bonding/eth_bond_private.h | 3 +++ + drivers/net/bonding/rte_eth_bond_api.c | 3 +++ + drivers/net/bonding/rte_eth_bond_pmd.c | 27 ++++++++++++++++++++++++++ + 3 files changed, 33 insertions(+) + +diff --git a/drivers/net/bonding/eth_bond_private.h b/drivers/net/bonding/eth_bond_private.h +index 9626b26d67..c338e11d4f 100644 +--- a/drivers/net/bonding/eth_bond_private.h ++++ b/drivers/net/bonding/eth_bond_private.h +@@ -131,6 +131,9 @@ struct bond_dev_private { + uint32_t link_down_delay_ms; + uint32_t link_up_delay_ms; + ++ uint32_t speed_capa; ++ /**< Supported speeds bitmap (RTE_ETH_LINK_SPEED_). */ ++ + uint16_t nb_rx_queues; /**< Total number of rx queues */ + uint16_t nb_tx_queues; /**< Total number of tx queues*/ + +diff --git a/drivers/net/bonding/rte_eth_bond_api.c b/drivers/net/bonding/rte_eth_bond_api.c +index 2d5cac6c51..b74477128a 100644 +--- a/drivers/net/bonding/rte_eth_bond_api.c ++++ b/drivers/net/bonding/rte_eth_bond_api.c +@@ -513,6 +513,8 @@ __eth_bond_slave_add_lock_free(uint16_t bonded_port_id, uint16_t slave_port_id) + internals->primary_port = slave_port_id; + internals->current_primary_port = slave_port_id; + ++ internals->speed_capa = dev_info.speed_capa; ++ + /* Inherit queues settings from first slave */ + internals->nb_rx_queues = slave_eth_dev->data->nb_rx_queues; + internals->nb_tx_queues = slave_eth_dev->data->nb_tx_queues; +@@ -527,6 +529,7 @@ __eth_bond_slave_add_lock_free(uint16_t bonded_port_id, uint16_t slave_port_id) + } else { + int ret; + ++ internals->speed_capa &= dev_info.speed_capa; + eth_bond_slave_inherit_dev_info_rx_next(internals, &dev_info); + eth_bond_slave_inherit_dev_info_tx_next(internals, &dev_info); + +diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c +index 18754e3299..b5b706901a 100644 +--- a/drivers/net/bonding/rte_eth_bond_pmd.c ++++ b/drivers/net/bonding/rte_eth_bond_pmd.c +@@ -1721,6 +1721,8 @@ slave_configure(struct rte_eth_dev *bonded_eth_dev, + + slave_eth_dev->data->dev_conf.rxmode.mtu = + bonded_eth_dev->data->dev_conf.rxmode.mtu; ++ slave_eth_dev->data->dev_conf.link_speeds = ++ bonded_eth_dev->data->dev_conf.link_speeds; + + slave_eth_dev->data->dev_conf.txmode.offloads |= + bonded_eth_dev->data->dev_conf.txmode.offloads; +@@ -2257,6 +2259,7 @@ bond_ethdev_info(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) + + dev_info->reta_size = internals->reta_size; + dev_info->hash_key_size = internals->rss_key_len; ++ dev_info->speed_capa = internals->speed_capa; + + return 0; + } +@@ -3571,6 +3574,7 @@ bond_ethdev_configure(struct rte_eth_dev *dev) + uint64_t offloads; + int arg_count; + uint16_t port_id = dev - rte_eth_devices; ++ uint32_t link_speeds; + uint8_t agg_mode; + + static const uint8_t default_rss_key[40] = { +@@ -3629,6 +3633,29 @@ bond_ethdev_configure(struct rte_eth_dev *dev) + dev->data->dev_conf.txmode.offloads = offloads; + } + ++ link_speeds = dev->data->dev_conf.link_speeds; ++ /* ++ * The default value of 'link_speeds' is zero. From its definition, ++ * this value actually means auto-negotiation. But not all PMDs support ++ * auto-negotiation. So ignore the check for the auto-negotiation and ++ * only consider fixed speed to reduce the impact on PMDs. ++ */ ++ if (link_speeds & RTE_ETH_LINK_SPEED_FIXED) { ++ if ((link_speeds & ++ (internals->speed_capa & ~RTE_ETH_LINK_SPEED_FIXED)) == 0) { ++ RTE_BOND_LOG(ERR, "the fixed speed is not supported by all slave devices."); ++ return -EINVAL; ++ } ++ /* ++ * Two '1' in binary of 'link_speeds': bit0 and a unique ++ * speed bit. ++ */ ++ if (__builtin_popcountl(link_speeds) != 2) { ++ RTE_BOND_LOG(ERR, "please set a unique speed."); ++ return -EINVAL; ++ } ++ } ++ + /* set the max_rx_pktlen */ + internals->max_rx_pktlen = internals->candidate_max_rx_pktlen; + +-- +2.23.0 + diff --git a/0191-net-hns3-fix-delay-for-waiting-to-stop-Rx-Tx.patch b/0191-net-hns3-fix-delay-for-waiting-to-stop-Rx-Tx.patch deleted file mode 100644 index 58ec4576580238e842f85b3da5bc2a84a52fd660..0000000000000000000000000000000000000000 --- a/0191-net-hns3-fix-delay-for-waiting-to-stop-Rx-Tx.patch +++ /dev/null @@ -1,69 +0,0 @@ -From 00276e9b4577158de8d920dd58e486a00d6fe27d Mon Sep 17 00:00:00 2001 -From: Huisong Li -Date: Sun, 13 Jun 2021 10:31:52 +0800 -Subject: [PATCH 03/26] net/hns3: fix delay for waiting to stop Rx/Tx - -When the primary process executes dev_stop or is being reset, the packet -sending and receiving functions is changed. In this moment, the primary -process requests secondary processes to change their Rx/Tx functions, and -delays a period of time in case of crashes when queues are still in use. -The delay time depends on the number of queues actually used, instead of -the maximum number of queues supported by the device. - -Fixes: 23d4b61fee5d ("net/hns3: support multiple process") -Cc: stable@dpdk.org - -Signed-off-by: Huisong Li -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_ethdev.c | 4 ++-- - drivers/net/hns3/hns3_ethdev_vf.c | 4 ++-- - 2 files changed, 4 insertions(+), 4 deletions(-) - -diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c -index 351dc59..f34e117 100644 ---- a/drivers/net/hns3/hns3_ethdev.c -+++ b/drivers/net/hns3/hns3_ethdev.c -@@ -5892,7 +5892,7 @@ hns3_dev_stop(struct rte_eth_dev *dev) - /* Disable datapath on secondary process. */ - hns3_mp_req_stop_rxtx(dev); - /* Prevent crashes when queues are still in use. */ -- rte_delay_ms(hw->tqps_num); -+ rte_delay_ms(hw->cfg_max_queues); - - rte_spinlock_lock(&hw->lock); - if (__atomic_load_n(&hw->reset.resetting, __ATOMIC_RELAXED) == 0) { -@@ -6508,7 +6508,7 @@ hns3_stop_service(struct hns3_adapter *hns) - rte_wmb(); - /* Disable datapath on secondary process. */ - hns3_mp_req_stop_rxtx(eth_dev); -- rte_delay_ms(hw->tqps_num); -+ rte_delay_ms(hw->cfg_max_queues); - - rte_spinlock_lock(&hw->lock); - if (hns->hw.adapter_state == HNS3_NIC_STARTED || -diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c -index 030d63a..1819677 100644 ---- a/drivers/net/hns3/hns3_ethdev_vf.c -+++ b/drivers/net/hns3/hns3_ethdev_vf.c -@@ -2107,7 +2107,7 @@ hns3vf_dev_stop(struct rte_eth_dev *dev) - /* Disable datapath on secondary process. */ - hns3_mp_req_stop_rxtx(dev); - /* Prevent crashes when queues are still in use. */ -- rte_delay_ms(hw->tqps_num); -+ rte_delay_ms(hw->cfg_max_queues); - - rte_spinlock_lock(&hw->lock); - if (__atomic_load_n(&hw->reset.resetting, __ATOMIC_RELAXED) == 0) { -@@ -2555,7 +2555,7 @@ hns3vf_stop_service(struct hns3_adapter *hns) - rte_wmb(); - /* Disable datapath on secondary process. */ - hns3_mp_req_stop_rxtx(eth_dev); -- rte_delay_ms(hw->tqps_num); -+ rte_delay_ms(hw->cfg_max_queues); - - rte_spinlock_lock(&hw->lock); - if (hw->adapter_state == HNS3_NIC_STARTED || --- -2.7.4 - diff --git a/0192-net-bonding-call-Tx-prepare-before-Tx-burst.patch b/0192-net-bonding-call-Tx-prepare-before-Tx-burst.patch new file mode 100644 index 0000000000000000000000000000000000000000..f8fad787d3910586c40f883fc17e4228443f25cf --- /dev/null +++ b/0192-net-bonding-call-Tx-prepare-before-Tx-burst.patch @@ -0,0 +1,211 @@ +From 2606fe3bfdbe544819a08f27cd5ed6b5432c96a7 Mon Sep 17 00:00:00 2001 +From: Chengwen Feng +Date: Fri, 28 Oct 2022 15:32:44 +0800 +Subject: net/bonding: call Tx prepare before Tx burst + +Normally, to use the HW offloads capability (e.g. checksum and TSO) in +the Tx direction, the application needs to call rte_eth_tx_prepare() to +do some adjustment with the packets before sending them. But the +tx_prepare callback of the bonding driver is not implemented. Therefore, +the sent packets may have errors (e.g. checksum errors). + +However, it is difficult to design the tx_prepare callback for bonding +driver. Because when a bonded device sends packets, the bonded device +allocates the packets to different slave devices based on the real-time +link status and bonding mode. That is, it is very difficult for the +bonded device to determine which slave device's prepare function should +be invoked. + +So in this patch, the tx_prepare callback of bonding driver is not +implemented. Instead, the rte_eth_tx_prepare() will be called before +rte_eth_tx_burst(). In this way, all tx_offloads can be processed +correctly for all NIC devices. + +Note: because it is rara that bond different PMDs together, so just +call tx-prepare once in broadcast bonding mode. + +Also the following description was added to the rte_eth_tx_burst() +function: +"@note This function must not modify mbufs (including packets data) +unless the refcnt is 1. The exception is the bonding PMD, which does not +have tx-prepare function, in this case, mbufs maybe modified." + +Signed-off-by: Chengchang Tang +Signed-off-by: Chengwen Feng +Reviewed-by: Min Hu (Connor) +Acked-by: Chas Williams <3chas3@gmail.com> +--- + drivers/net/bonding/rte_eth_bond_8023ad.c | 10 ++++-- + drivers/net/bonding/rte_eth_bond_pmd.c | 37 ++++++++++++++++++----- + lib/ethdev/rte_ethdev.h | 4 +++ + 3 files changed, 41 insertions(+), 10 deletions(-) + +diff --git a/drivers/net/bonding/rte_eth_bond_8023ad.c b/drivers/net/bonding/rte_eth_bond_8023ad.c +index b3cddd8a20..29a71ae0bf 100644 +--- a/drivers/net/bonding/rte_eth_bond_8023ad.c ++++ b/drivers/net/bonding/rte_eth_bond_8023ad.c +@@ -636,9 +636,12 @@ tx_machine(struct bond_dev_private *internals, uint16_t slave_id) + return; + } + } else { +- uint16_t pkts_sent = rte_eth_tx_burst(slave_id, ++ uint16_t pkts_sent = rte_eth_tx_prepare(slave_id, + internals->mode4.dedicated_queues.tx_qid, + &lacp_pkt, 1); ++ pkts_sent = rte_eth_tx_burst(slave_id, ++ internals->mode4.dedicated_queues.tx_qid, ++ &lacp_pkt, pkts_sent); + if (pkts_sent != 1) { + rte_pktmbuf_free(lacp_pkt); + set_warning_flags(port, WRN_TX_QUEUE_FULL); +@@ -1371,9 +1374,12 @@ bond_mode_8023ad_handle_slow_pkt(struct bond_dev_private *internals, + } + } else { + /* Send packet directly to the slow queue */ +- uint16_t tx_count = rte_eth_tx_burst(slave_id, ++ uint16_t tx_count = rte_eth_tx_prepare(slave_id, + internals->mode4.dedicated_queues.tx_qid, + &pkt, 1); ++ tx_count = rte_eth_tx_burst(slave_id, ++ internals->mode4.dedicated_queues.tx_qid, ++ &pkt, tx_count); + if (tx_count != 1) { + /* reset timer */ + port->rx_marker_timer = 0; +diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c +index b5b706901a..4e82f7b145 100644 +--- a/drivers/net/bonding/rte_eth_bond_pmd.c ++++ b/drivers/net/bonding/rte_eth_bond_pmd.c +@@ -602,8 +602,11 @@ bond_ethdev_tx_burst_round_robin(void *queue, struct rte_mbuf **bufs, + /* Send packet burst on each slave device */ + for (i = 0; i < num_of_slaves; i++) { + if (slave_nb_pkts[i] > 0) { ++ num_tx_slave = rte_eth_tx_prepare(slaves[i], ++ bd_tx_q->queue_id, slave_bufs[i], ++ slave_nb_pkts[i]); + num_tx_slave = rte_eth_tx_burst(slaves[i], bd_tx_q->queue_id, +- slave_bufs[i], slave_nb_pkts[i]); ++ slave_bufs[i], num_tx_slave); + + /* if tx burst fails move packets to end of bufs */ + if (unlikely(num_tx_slave < slave_nb_pkts[i])) { +@@ -628,6 +631,7 @@ bond_ethdev_tx_burst_active_backup(void *queue, + { + struct bond_dev_private *internals; + struct bond_tx_queue *bd_tx_q; ++ uint16_t nb_prep_pkts; + + bd_tx_q = (struct bond_tx_queue *)queue; + internals = bd_tx_q->dev_private; +@@ -635,8 +639,11 @@ bond_ethdev_tx_burst_active_backup(void *queue, + if (internals->active_slave_count < 1) + return 0; + ++ nb_prep_pkts = rte_eth_tx_prepare(internals->current_primary_port, ++ bd_tx_q->queue_id, bufs, nb_pkts); ++ + return rte_eth_tx_burst(internals->current_primary_port, bd_tx_q->queue_id, +- bufs, nb_pkts); ++ bufs, nb_prep_pkts); + } + + static inline uint16_t +@@ -910,7 +917,7 @@ bond_ethdev_tx_burst_tlb(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) + + struct rte_eth_dev *primary_port = + &rte_eth_devices[internals->primary_port]; +- uint16_t num_tx_total = 0; ++ uint16_t num_tx_total = 0, num_tx_prep; + uint16_t i, j; + + uint16_t num_of_slaves = internals->active_slave_count; +@@ -951,8 +958,10 @@ bond_ethdev_tx_burst_tlb(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) + #endif + } + +- num_tx_total += rte_eth_tx_burst(slaves[i], bd_tx_q->queue_id, ++ num_tx_prep = rte_eth_tx_prepare(slaves[i], bd_tx_q->queue_id, + bufs + num_tx_total, nb_pkts - num_tx_total); ++ num_tx_total += rte_eth_tx_burst(slaves[i], bd_tx_q->queue_id, ++ bufs + num_tx_total, num_tx_prep); + + if (num_tx_total == nb_pkts) + break; +@@ -1064,8 +1073,10 @@ bond_ethdev_tx_burst_alb(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) + /* Send ARP packets on proper slaves */ + for (i = 0; i < RTE_MAX_ETHPORTS; i++) { + if (slave_bufs_pkts[i] > 0) { +- num_send = rte_eth_tx_burst(i, bd_tx_q->queue_id, ++ num_send = rte_eth_tx_prepare(i, bd_tx_q->queue_id, + slave_bufs[i], slave_bufs_pkts[i]); ++ num_send = rte_eth_tx_burst(i, bd_tx_q->queue_id, ++ slave_bufs[i], num_send); + for (j = 0; j < slave_bufs_pkts[i] - num_send; j++) { + bufs[nb_pkts - 1 - num_not_send - j] = + slave_bufs[i][nb_pkts - 1 - j]; +@@ -1088,8 +1099,10 @@ bond_ethdev_tx_burst_alb(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) + /* Send update packets on proper slaves */ + for (i = 0; i < RTE_MAX_ETHPORTS; i++) { + if (update_bufs_pkts[i] > 0) { ++ num_send = rte_eth_tx_prepare(i, bd_tx_q->queue_id, ++ update_bufs[i], update_bufs_pkts[i]); + num_send = rte_eth_tx_burst(i, bd_tx_q->queue_id, update_bufs[i], +- update_bufs_pkts[i]); ++ num_send); + for (j = num_send; j < update_bufs_pkts[i]; j++) { + rte_pktmbuf_free(update_bufs[i][j]); + } +@@ -1158,9 +1171,12 @@ tx_burst_balance(void *queue, struct rte_mbuf **bufs, uint16_t nb_bufs, + if (slave_nb_bufs[i] == 0) + continue; + +- slave_tx_count = rte_eth_tx_burst(slave_port_ids[i], ++ slave_tx_count = rte_eth_tx_prepare(slave_port_ids[i], + bd_tx_q->queue_id, slave_bufs[i], + slave_nb_bufs[i]); ++ slave_tx_count = rte_eth_tx_burst(slave_port_ids[i], ++ bd_tx_q->queue_id, slave_bufs[i], ++ slave_tx_count); + + total_tx_count += slave_tx_count; + +@@ -1243,8 +1259,10 @@ tx_burst_8023ad(void *queue, struct rte_mbuf **bufs, uint16_t nb_bufs, + + if (rte_ring_dequeue(port->tx_ring, + (void **)&ctrl_pkt) != -ENOENT) { +- slave_tx_count = rte_eth_tx_burst(slave_port_ids[i], ++ slave_tx_count = rte_eth_tx_prepare(slave_port_ids[i], + bd_tx_q->queue_id, &ctrl_pkt, 1); ++ slave_tx_count = rte_eth_tx_burst(slave_port_ids[i], ++ bd_tx_q->queue_id, &ctrl_pkt, slave_tx_count); + /* + * re-enqueue LAG control plane packets to buffering + * ring if transmission fails so the packet isn't lost. +@@ -1316,6 +1334,9 @@ bond_ethdev_tx_burst_broadcast(void *queue, struct rte_mbuf **bufs, + if (num_of_slaves < 1) + return 0; + ++ /* It is rare that bond different PMDs together, so just call tx-prepare once */ ++ nb_pkts = rte_eth_tx_prepare(slaves[0], bd_tx_q->queue_id, bufs, nb_pkts); ++ + /* Increment reference count on mbufs */ + for (i = 0; i < nb_pkts; i++) + rte_pktmbuf_refcnt_update(bufs[i], num_of_slaves - 1); +diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h +index 8c894e090d..b262939a33 100644 +--- a/lib/ethdev/rte_ethdev.h ++++ b/lib/ethdev/rte_ethdev.h +@@ -5691,6 +5691,10 @@ uint16_t rte_eth_call_tx_callbacks(uint16_t port_id, uint16_t queue_id, + * @see rte_eth_tx_prepare to perform some prior checks or adjustments + * for offloads. + * ++ * @note This function must not modify mbufs (including packets data) unless ++ * the refcnt is 1. The exception is the bonding PMD, which does not have ++ * tx-prepare function, in this case, mbufs maybe modified. ++ * + * @param port_id + * The port identifier of the Ethernet device. + * @param queue_id +-- +2.23.0 + diff --git a/0192-net-hns3-fix-fake-queue-rollback.patch b/0192-net-hns3-fix-fake-queue-rollback.patch deleted file mode 100644 index 4c4eb70c640f252b84c08137e6c97d444037860e..0000000000000000000000000000000000000000 --- a/0192-net-hns3-fix-fake-queue-rollback.patch +++ /dev/null @@ -1,84 +0,0 @@ -From f56028fd10925831f3a0e092d317aef165ef9989 Mon Sep 17 00:00:00 2001 -From: Huisong Li -Date: Sun, 13 Jun 2021 10:31:53 +0800 -Subject: [PATCH 04/26] net/hns3: fix fake queue rollback - -When the device supports independent Rx/Tx queues, fake queues do not need -to be created in unequal Rx/Tx queues case. However, dev_configure fails -to be executed on the device supported independent Rx/Tx queues, the -current rollback code logic contains the fake queue. As a result, the fake -queue is created. When dev_configure is successfully called again, these -fake queues still exists and are configured to the hardware. - -Fixes: fa29fe45a7b4 ("net/hns3: support queue start and stop") -Cc: stable@dpdk.org - -Signed-off-by: Huisong Li -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_ethdev.c | 11 ++++------- - drivers/net/hns3/hns3_ethdev_vf.c | 11 ++++------- - drivers/net/hns3/hns3_rxtx.c | 3 +++ - 3 files changed, 11 insertions(+), 14 deletions(-) - -diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c -index f34e117..54a2bc7 100644 ---- a/drivers/net/hns3/hns3_ethdev.c -+++ b/drivers/net/hns3/hns3_ethdev.c -@@ -2497,13 +2497,10 @@ hns3_dev_configure(struct rte_eth_dev *dev) - * work as usual. But these fake queues are imperceptible, and can not - * be used by upper applications. - */ -- if (!hns3_dev_indep_txrx_supported(hw)) { -- ret = hns3_set_fake_rx_or_tx_queues(dev, nb_rx_q, nb_tx_q); -- if (ret) { -- hns3_err(hw, "fail to set Rx/Tx fake queues, ret = %d.", -- ret); -- return ret; -- } -+ ret = hns3_set_fake_rx_or_tx_queues(dev, nb_rx_q, nb_tx_q); -+ if (ret) { -+ hns3_err(hw, "fail to set Rx/Tx fake queues, ret = %d.", ret); -+ return ret; - } - - hw->adapter_state = HNS3_NIC_CONFIGURING; -diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c -index 1819677..3631022 100644 ---- a/drivers/net/hns3/hns3_ethdev_vf.c -+++ b/drivers/net/hns3/hns3_ethdev_vf.c -@@ -801,13 +801,10 @@ hns3vf_dev_configure(struct rte_eth_dev *dev) - * work as usual. But these fake queues are imperceptible, and can not - * be used by upper applications. - */ -- if (!hns3_dev_indep_txrx_supported(hw)) { -- ret = hns3_set_fake_rx_or_tx_queues(dev, nb_rx_q, nb_tx_q); -- if (ret) { -- hns3_err(hw, "fail to set Rx/Tx fake queues, ret = %d.", -- ret); -- return ret; -- } -+ ret = hns3_set_fake_rx_or_tx_queues(dev, nb_rx_q, nb_tx_q); -+ if (ret) { -+ hns3_err(hw, "fail to set Rx/Tx fake queues, ret = %d.", ret); -+ return ret; - } - - hw->adapter_state = HNS3_NIC_CONFIGURING; -diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c -index 6aa2887..3c645b3 100644 ---- a/drivers/net/hns3/hns3_rxtx.c -+++ b/drivers/net/hns3/hns3_rxtx.c -@@ -1617,6 +1617,9 @@ hns3_set_fake_rx_or_tx_queues(struct rte_eth_dev *dev, uint16_t nb_rx_q, - uint16_t q; - int ret; - -+ if (hns3_dev_indep_txrx_supported(hw)) -+ return 0; -+ - /* Setup new number of fake RX/TX queues and reconfigure device. */ - rx_need_add_nb_q = hw->cfg_max_queues - nb_rx_q; - tx_need_add_nb_q = hw->cfg_max_queues - nb_tx_q; --- -2.7.4 - diff --git a/0193-net-bonding-fix-MTU-set-for-slaves.patch b/0193-net-bonding-fix-MTU-set-for-slaves.patch new file mode 100644 index 0000000000000000000000000000000000000000..5c59f5653c560a56359ea5242bfa74fc2aa2ce99 --- /dev/null +++ b/0193-net-bonding-fix-MTU-set-for-slaves.patch @@ -0,0 +1,62 @@ +From f099709983c155337a14340da3d9607a2a08a7f9 Mon Sep 17 00:00:00 2001 +From: Ferruh Yigit +Date: Fri, 28 Oct 2022 15:32:45 +0800 +Subject: net/bonding: fix MTU set for slaves + +ethdev requires device to be configured before setting MTU. + +In bonding PMD, while configuring slaves, bonding first sets MTU later +configures them, which causes failure if slaves are not configured in +advance. + +Fixing by changing the order in slave configure as requested in ethdev +layer, configure first and set MTU later. + +Bugzilla ID: 864 +Fixes: b26bee10ee37 ("ethdev: forbid MTU set before device configure") +Cc: stable@dpdk.org + +Signed-off-by: Ferruh Yigit +Tested-by: Yu Jiang +Acked-by: Min Hu (Connor) +--- + drivers/net/bonding/rte_eth_bond_pmd.c | 16 ++++++++-------- + 1 file changed, 8 insertions(+), 8 deletions(-) + +diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c +index 4e82f7b145..ab1196e505 100644 +--- a/drivers/net/bonding/rte_eth_bond_pmd.c ++++ b/drivers/net/bonding/rte_eth_bond_pmd.c +@@ -1770,14 +1770,6 @@ slave_configure(struct rte_eth_dev *bonded_eth_dev, + } + } + +- errval = rte_eth_dev_set_mtu(slave_eth_dev->data->port_id, +- bonded_eth_dev->data->mtu); +- if (errval != 0 && errval != -ENOTSUP) { +- RTE_BOND_LOG(ERR, "rte_eth_dev_set_mtu: port %u, err (%d)", +- slave_eth_dev->data->port_id, errval); +- return errval; +- } +- + /* Configure device */ + errval = rte_eth_dev_configure(slave_eth_dev->data->port_id, + nb_rx_queues, nb_tx_queues, +@@ -1788,6 +1780,14 @@ slave_configure(struct rte_eth_dev *bonded_eth_dev, + return errval; + } + ++ errval = rte_eth_dev_set_mtu(slave_eth_dev->data->port_id, ++ bonded_eth_dev->data->mtu); ++ if (errval != 0 && errval != -ENOTSUP) { ++ RTE_BOND_LOG(ERR, "rte_eth_dev_set_mtu: port %u, err (%d)", ++ slave_eth_dev->data->port_id, errval); ++ return errval; ++ } ++ + /* Setup Rx Queues */ + for (q_id = 0; q_id < bonded_eth_dev->data->nb_rx_queues; q_id++) { + bd_rx_q = (struct bond_rx_queue *)bonded_eth_dev->data->rx_queues[q_id]; +-- +2.23.0 + diff --git a/0193-net-hns3-fix-VLAN-strip-log.patch b/0193-net-hns3-fix-VLAN-strip-log.patch deleted file mode 100644 index 69a6a99fb3d2b1c365f5672b5438c9102a024c5f..0000000000000000000000000000000000000000 --- a/0193-net-hns3-fix-VLAN-strip-log.patch +++ /dev/null @@ -1,49 +0,0 @@ -From dabf2fc6e1ae8d1a4b87f9b8603d5666a8b05efb Mon Sep 17 00:00:00 2001 -From: Chengchang Tang -Date: Sun, 13 Jun 2021 10:31:54 +0800 -Subject: [PATCH 05/26] net/hns3: fix VLAN strip log - -When the current VLAN stripping is set, the log print always prompts -that the enabling fails, bug if may actually be the disabling failure. - -Fixes: 411d23b9eafb ("net/hns3: support VLAN") -Cc: stable@dpdk.org - -Signed-off-by: Chengchang Tang -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_ethdev.c | 3 ++- - drivers/net/hns3/hns3_ethdev_vf.c | 3 ++- - 2 files changed, 4 insertions(+), 2 deletions(-) - -diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c -index 54a2bc7..3ecdd68 100644 ---- a/drivers/net/hns3/hns3_ethdev.c -+++ b/drivers/net/hns3/hns3_ethdev.c -@@ -640,7 +640,8 @@ hns3_en_hw_strip_rxvtag(struct hns3_adapter *hns, bool enable) - - ret = hns3_set_vlan_rx_offload_cfg(hns, &rxvlan_cfg); - if (ret) { -- hns3_err(hw, "enable strip rx vtag failed, ret =%d", ret); -+ hns3_err(hw, "%s strip rx vtag failed, ret = %d.", -+ enable ? "enable" : "disable", ret); - return ret; - } - -diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c -index 3631022..cd59ae2 100644 ---- a/drivers/net/hns3/hns3_ethdev_vf.c -+++ b/drivers/net/hns3/hns3_ethdev_vf.c -@@ -1606,7 +1606,8 @@ hns3vf_en_hw_strip_rxvtag(struct hns3_hw *hw, bool enable) - ret = hns3_send_mbx_msg(hw, HNS3_MBX_SET_VLAN, HNS3_MBX_VLAN_RX_OFF_CFG, - &msg_data, sizeof(msg_data), false, NULL, 0); - if (ret) -- hns3_err(hw, "vf enable strip failed, ret =%d", ret); -+ hns3_err(hw, "vf %s strip failed, ret = %d.", -+ enable ? "enable" : "disable", ret); - - return ret; - } --- -2.7.4 - diff --git a/0194-app-testpmd-remove-jumbo-offload-related-code.patch b/0194-app-testpmd-remove-jumbo-offload-related-code.patch new file mode 100644 index 0000000000000000000000000000000000000000..d34e0480ae8c3a43daf7d65e810389c56eea76ee --- /dev/null +++ b/0194-app-testpmd-remove-jumbo-offload-related-code.patch @@ -0,0 +1,121 @@ +From 20204b1f3811015975a5dac2012ca770be174acb Mon Sep 17 00:00:00 2001 +From: Chengwen Feng +Date: Fri, 28 Oct 2022 15:32:46 +0800 +Subject: app/testpmd: remove jumbo offload related code + +The jumbo offload was removed from patch [1], but testpmd still exist +jumbo offload related code, this patch removes it, and also updates +the rst file. + +[1] ethdev: remove jumbo offload flag + +Fixes: b563c1421282 ("ethdev: remove jumbo offload flag") +Cc: stable@dpdk.org + +Signed-off-by: Chengwen Feng +Reviewed-by: Andrew Rybchenko +--- + app/test-pmd/cmdline.c | 12 ++++++------ + app/test-pmd/testpmd.h | 1 - + doc/guides/testpmd_app_ug/testpmd_funcs.rst | 8 ++++---- + 3 files changed, 10 insertions(+), 11 deletions(-) + +diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c +index 6cb095f965..8d4a88bb85 100644 +--- a/app/test-pmd/cmdline.c ++++ b/app/test-pmd/cmdline.c +@@ -861,7 +861,7 @@ static void cmd_help_long_parsed(void *parsed_result, + "port config rx_offload vlan_strip|" + "ipv4_cksum|udp_cksum|tcp_cksum|tcp_lro|qinq_strip|" + "outer_ipv4_cksum|macsec_strip|header_split|" +- "vlan_filter|vlan_extend|jumbo_frame|scatter|" ++ "vlan_filter|vlan_extend|scatter|" + "buffer_split|timestamp|security|keep_crc on|off\n" + " Enable or disable a per port Rx offloading" + " on all Rx queues of a port\n\n" +@@ -869,7 +869,7 @@ static void cmd_help_long_parsed(void *parsed_result, + "port (port_id) rxq (queue_id) rx_offload vlan_strip|" + "ipv4_cksum|udp_cksum|tcp_cksum|tcp_lro|qinq_strip|" + "outer_ipv4_cksum|macsec_strip|header_split|" +- "vlan_filter|vlan_extend|jumbo_frame|scatter|" ++ "vlan_filter|vlan_extend|scatter|" + "buffer_split|timestamp|security|keep_crc on|off\n" + " Enable or disable a per queue Rx offloading" + " only on a specific Rx queue\n\n" +@@ -16080,7 +16080,7 @@ cmdline_parse_token_string_t cmd_config_per_port_rx_offload_result_offload = + (struct cmd_config_per_port_rx_offload_result, + offload, "vlan_strip#ipv4_cksum#udp_cksum#tcp_cksum#tcp_lro#" + "qinq_strip#outer_ipv4_cksum#macsec_strip#" +- "header_split#vlan_filter#vlan_extend#jumbo_frame#" ++ "header_split#vlan_filter#vlan_extend#" + "scatter#buffer_split#timestamp#security#" + "keep_crc#rss_hash"); + cmdline_parse_token_string_t cmd_config_per_port_rx_offload_result_on_off = +@@ -16163,7 +16163,7 @@ cmdline_parse_inst_t cmd_config_per_port_rx_offload = { + .help_str = "port config rx_offload vlan_strip|ipv4_cksum|" + "udp_cksum|tcp_cksum|tcp_lro|qinq_strip|outer_ipv4_cksum|" + "macsec_strip|header_split|vlan_filter|vlan_extend|" +- "jumbo_frame|scatter|buffer_split|timestamp|security|" ++ "scatter|buffer_split|timestamp|security|" + "keep_crc|rss_hash on|off", + .tokens = { + (void *)&cmd_config_per_port_rx_offload_result_port, +@@ -16212,7 +16212,7 @@ cmdline_parse_token_string_t cmd_config_per_queue_rx_offload_result_offload = + (struct cmd_config_per_queue_rx_offload_result, + offload, "vlan_strip#ipv4_cksum#udp_cksum#tcp_cksum#tcp_lro#" + "qinq_strip#outer_ipv4_cksum#macsec_strip#" +- "header_split#vlan_filter#vlan_extend#jumbo_frame#" ++ "header_split#vlan_filter#vlan_extend#" + "scatter#buffer_split#timestamp#security#keep_crc"); + cmdline_parse_token_string_t cmd_config_per_queue_rx_offload_result_on_off = + TOKEN_STRING_INITIALIZER +@@ -16271,7 +16271,7 @@ cmdline_parse_inst_t cmd_config_per_queue_rx_offload = { + "vlan_strip|ipv4_cksum|" + "udp_cksum|tcp_cksum|tcp_lro|qinq_strip|outer_ipv4_cksum|" + "macsec_strip|header_split|vlan_filter|vlan_extend|" +- "jumbo_frame|scatter|buffer_split|timestamp|security|" ++ "scatter|buffer_split|timestamp|security|" + "keep_crc on|off", + .tokens = { + (void *)&cmd_config_per_queue_rx_offload_result_port, +diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h +index 9c3a5d9bc5..ab6642585e 100644 +--- a/app/test-pmd/testpmd.h ++++ b/app/test-pmd/testpmd.h +@@ -1097,7 +1097,6 @@ uint16_t tx_pkt_set_dynf(uint16_t port_id, __rte_unused uint16_t queue, + void add_tx_dynf_callback(portid_t portid); + void remove_tx_dynf_callback(portid_t portid); + int update_mtu_from_frame_size(portid_t portid, uint32_t max_rx_pktlen); +-int update_jumbo_frame_offload(portid_t portid); + void flex_item_create(portid_t port_id, uint16_t flex_id, const char *filename); + void flex_item_destroy(portid_t port_id, uint16_t flex_id); + void port_flex_item_flush(portid_t port_id); +diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst +index e15dc0c4c4..e0edd349bc 100644 +--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst ++++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst +@@ -1767,8 +1767,8 @@ Enable or disable a per port Rx offloading on all Rx queues of a port:: + * ``offloading``: can be any of these offloading capability: + vlan_strip, ipv4_cksum, udp_cksum, tcp_cksum, tcp_lro, + qinq_strip, outer_ipv4_cksum, macsec_strip, +- header_split, vlan_filter, vlan_extend, jumbo_frame, +- scatter, timestamp, security, keep_crc, rss_hash ++ header_split, vlan_filter, vlan_extend, scatter, timestamp, security, ++ keep_crc, rss_hash + + This command should be run when the port is stopped, or else it will fail. + +@@ -1782,8 +1782,8 @@ Enable or disable a per queue Rx offloading only on a specific Rx queue:: + * ``offloading``: can be any of these offloading capability: + vlan_strip, ipv4_cksum, udp_cksum, tcp_cksum, tcp_lro, + qinq_strip, outer_ipv4_cksum, macsec_strip, +- header_split, vlan_filter, vlan_extend, jumbo_frame, +- scatter, timestamp, security, keep_crc ++ header_split, vlan_filter, vlan_extend, scatter, timestamp, security, ++ keep_crc + + This command should be run when the port is stopped, or else it will fail. + +-- +2.23.0 + diff --git a/0194-net-hns3-fix-maximum-queues-on-configuration-failure.patch b/0194-net-hns3-fix-maximum-queues-on-configuration-failure.patch deleted file mode 100644 index 52ad26512d1e683e7a753c39a1e2f3ef26c409a5..0000000000000000000000000000000000000000 --- a/0194-net-hns3-fix-maximum-queues-on-configuration-failure.patch +++ /dev/null @@ -1,71 +0,0 @@ -From 592de3eb443016be571a13fd90cb7cc35bd98679 Mon Sep 17 00:00:00 2001 -From: Huisong Li -Date: Sun, 13 Jun 2021 10:31:55 +0800 -Subject: [PATCH 06/26] net/hns3: fix maximum queues on configuration failure - -The "cfg_max_queues" maintains configured max queue numbers from user, -and is equal to the maximum of "nb_rx_queues" and "nb_tx_queues" in -"dev->data". - -From the ethdev layer framework, "nb_rx/tx_queues" in "dev->data" were set -to zero in rte_eth_dev_configure() if ops.dev_configure in PMD fails to be -executed, In addition, if ops.dev_configure in HNS3 PMD failed, the fake -queues are also cleared on a device that does not support independent Rx/Tx -queues. - -Therefore, the "cfg_max_queues" should be also set to zero when -dev_configure fails. - -Fixes: fa29fe45a7b4 ("net/hns3: support queue start and stop") -Cc: stable@dpdk.org - -Signed-off-by: Huisong Li -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_ethdev.c | 2 ++ - drivers/net/hns3/hns3_ethdev_vf.c | 2 ++ - 2 files changed, 4 insertions(+) - -diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c -index 3ecdd68..45ce54c 100644 ---- a/drivers/net/hns3/hns3_ethdev.c -+++ b/drivers/net/hns3/hns3_ethdev.c -@@ -2501,6 +2501,7 @@ hns3_dev_configure(struct rte_eth_dev *dev) - ret = hns3_set_fake_rx_or_tx_queues(dev, nb_rx_q, nb_tx_q); - if (ret) { - hns3_err(hw, "fail to set Rx/Tx fake queues, ret = %d.", ret); -+ hw->cfg_max_queues = 0; - return ret; - } - -@@ -2549,6 +2550,7 @@ hns3_dev_configure(struct rte_eth_dev *dev) - return 0; - - cfg_err: -+ hw->cfg_max_queues = 0; - (void)hns3_set_fake_rx_or_tx_queues(dev, 0, 0); - hw->adapter_state = HNS3_NIC_INITIALIZED; - -diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c -index cd59ae2..cbc3456 100644 ---- a/drivers/net/hns3/hns3_ethdev_vf.c -+++ b/drivers/net/hns3/hns3_ethdev_vf.c -@@ -804,6 +804,7 @@ hns3vf_dev_configure(struct rte_eth_dev *dev) - ret = hns3_set_fake_rx_or_tx_queues(dev, nb_rx_q, nb_tx_q); - if (ret) { - hns3_err(hw, "fail to set Rx/Tx fake queues, ret = %d.", ret); -+ hw->cfg_max_queues = 0; - return ret; - } - -@@ -863,6 +864,7 @@ hns3vf_dev_configure(struct rte_eth_dev *dev) - return 0; - - cfg_err: -+ hw->cfg_max_queues = 0; - (void)hns3_set_fake_rx_or_tx_queues(dev, 0, 0); - hw->adapter_state = HNS3_NIC_INITIALIZED; - --- -2.7.4 - diff --git a/0195-app-testpmd-revert-MAC-update-in-checksum-forwarding.patch b/0195-app-testpmd-revert-MAC-update-in-checksum-forwarding.patch new file mode 100644 index 0000000000000000000000000000000000000000..8e18c47759ecc89b6c761e29e7a88299516cd8f4 --- /dev/null +++ b/0195-app-testpmd-revert-MAC-update-in-checksum-forwarding.patch @@ -0,0 +1,42 @@ +From 304a7bf032352999131c0b3e28c585610000990e Mon Sep 17 00:00:00 2001 +From: Maxime Coquelin +Date: Tue, 15 Nov 2022 12:06:06 +0800 +Subject: app/testpmd: revert MAC update in checksum forwarding + +[ upstream commit 9b4ea7ae77faa8f8aba8c7510c821f75d7863b16 ] + +This patch reverts +commit 10f4620f02e1 ("app/testpmd: modify mac in csum forwarding"), +as the checksum forwarding is expected to only perform +checksum and not also overwrites the source and destination MAC addresses. + +Doing so, we can test checksum offloading with real traffic +without breaking broadcast packets. + +Fixes: 10f4620f02e1 ("app/testpmd: modify mac in csum forwarding") + +Signed-off-by: Maxime Coquelin +Acked-by: Chenbo Xia +Acked-by: Aman Singh +--- + app/test-pmd/csumonly.c | 4 ---- + 1 file changed, 4 deletions(-) + +diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c +index 0177284d9c..206968d37a 100644 +--- a/app/test-pmd/csumonly.c ++++ b/app/test-pmd/csumonly.c +@@ -887,10 +887,6 @@ pkt_burst_checksum_forward(struct fwd_stream *fs) + * and inner headers */ + + eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); +- rte_ether_addr_copy(&peer_eth_addrs[fs->peer_addr], +- ð_hdr->dst_addr); +- rte_ether_addr_copy(&ports[fs->tx_port].eth_addr, +- ð_hdr->src_addr); + parse_ethernet(eth_hdr, &info); + l3_hdr = (char *)eth_hdr + info.l2_len; + +-- +2.23.0 + diff --git a/0195-net-hns3-remove-unnecessary-blank-lines.patch b/0195-net-hns3-remove-unnecessary-blank-lines.patch deleted file mode 100644 index 83bb2001b87da343de6e6f79d5a10dc4e2471a8e..0000000000000000000000000000000000000000 --- a/0195-net-hns3-remove-unnecessary-blank-lines.patch +++ /dev/null @@ -1,64 +0,0 @@ -From c30146c22a93c86c1dcd296eddd99c620b741b8e Mon Sep 17 00:00:00 2001 -From: Hongbo Zheng -Date: Sun, 13 Jun 2021 10:31:56 +0800 -Subject: [PATCH 07/26] net/hns3: remove unnecessary blank lines - -Delete redundant blank lines to make: -1.Return value judgment follow the function call. -2.No blank lines at the end of a code block defined by braces. - -Signed-off-by: Hongbo Zheng -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_ethdev.c | 6 +----- - 1 file changed, 1 insertion(+), 5 deletions(-) - -diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c -index 45ce54c..a80bc56 100644 ---- a/drivers/net/hns3/hns3_ethdev.c -+++ b/drivers/net/hns3/hns3_ethdev.c -@@ -253,8 +253,8 @@ static void - hns3_clear_all_event_cause(struct hns3_hw *hw) - { - uint32_t vector0_int_stats; -- vector0_int_stats = hns3_read_dev(hw, HNS3_VECTOR0_OTHER_INT_STS_REG); - -+ vector0_int_stats = hns3_read_dev(hw, HNS3_VECTOR0_OTHER_INT_STS_REG); - if (BIT(HNS3_VECTOR0_IMPRESET_INT_B) & vector0_int_stats) - hns3_warn(hw, "Probe during IMP reset interrupt"); - -@@ -3124,7 +3124,6 @@ hns3_parse_cfg(struct hns3_cfg *cfg, struct hns3_cmd_desc *desc) - ext_rss_size_max = hns3_get_field(rte_le_to_cpu_32(req->param[2]), - HNS3_CFG_EXT_RSS_SIZE_M, - HNS3_CFG_EXT_RSS_SIZE_S); -- - /* - * Field ext_rss_size_max obtained from firmware will be more flexible - * for future changes and expansions, which is an exponent of 2, instead -@@ -3843,7 +3842,6 @@ hns3_drop_nopfc_buf_till_fit(struct hns3_hw *hw, - for (i = HNS3_MAX_TC_NUM - 1; i >= 0; i--) { - priv = &buf_alloc->priv_buf[i]; - mask = BIT((uint8_t)i); -- - if (hw->hw_tc_map & mask && - !(hw->dcb_info.hw_pfc_map & mask)) { - /* Clear the no pfc TC private buffer */ -@@ -3929,7 +3927,6 @@ hns3_only_alloc_priv_buff(struct hns3_hw *hw, - COMPENSATE_HALF_MPS_NUM * half_mps; - min_rx_priv = roundup(min_rx_priv, HNS3_BUF_SIZE_UNIT); - rx_priv = rounddown(rx_priv, HNS3_BUF_SIZE_UNIT); -- - if (rx_priv < min_rx_priv) - return false; - -@@ -6294,7 +6291,6 @@ hns3_is_reset_pending(struct hns3_adapter *hns) - - hns3_check_event_cause(hns, NULL); - reset = hns3_get_reset_level(hns, &hw->reset.pending); -- - if (reset != HNS3_NONE_RESET && hw->reset.level != HNS3_NONE_RESET && - hw->reset.level < reset) { - hns3_warn(hw, "High level reset %d is pending", reset); --- -2.7.4 - diff --git a/0196-net-bonding-fix-bond4-drop-valid-MAC-packets.patch b/0196-net-bonding-fix-bond4-drop-valid-MAC-packets.patch new file mode 100644 index 0000000000000000000000000000000000000000..41c8deac381808a9c0bec535444b9b0383113fad --- /dev/null +++ b/0196-net-bonding-fix-bond4-drop-valid-MAC-packets.patch @@ -0,0 +1,86 @@ +From 44f34b117cb446f9dce03e683942a40a8a04436c Mon Sep 17 00:00:00 2001 +From: Huisong Li +Date: Tue, 15 Nov 2022 12:06:07 +0800 +Subject: net/bonding: fix bond4 drop valid MAC packets + +[ upstream commit 2176782ec87589927e1b13737b60ee8be28d76af ] + +Currently, by default, bond4 will first try to enable allmulti and +then enable promiscuous if fail to enable allmulti. On reception, +whether unicast and multicast packets should be dropped depends on +which mode has been enabled on the bonding interface. + +In fact, if MAC address of packets in mac_addrs array of bonding +interface, these packets should not be dropped. However, now only +check the default MAC address, which will cause the packets with +MAC added by the '.mac_addr_add' are dropped. + +Fixes: 68218b87c184 ("net/bonding: prefer allmulti to promiscuous for LACP") + +Signed-off-by: Huisong Li +Reviewed-by: Andrew Rybchenko +--- + drivers/net/bonding/rte_eth_bond_pmd.c | 33 +++++++++++++++++++------- + 1 file changed, 25 insertions(+), 8 deletions(-) + +diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c +index ab1196e505..f1e7b6459a 100644 +--- a/drivers/net/bonding/rte_eth_bond_pmd.c ++++ b/drivers/net/bonding/rte_eth_bond_pmd.c +@@ -271,6 +271,24 @@ bond_ethdev_8023ad_flow_set(struct rte_eth_dev *bond_dev, uint16_t slave_port) { + return 0; + } + ++static bool ++is_bond_mac_addr(const struct rte_ether_addr *ea, ++ const struct rte_ether_addr *mac_addrs, uint32_t max_mac_addrs) ++{ ++ uint32_t i; ++ ++ for (i = 0; i < max_mac_addrs; i++) { ++ /* skip zero address */ ++ if (rte_is_zero_ether_addr(&mac_addrs[i])) ++ continue; ++ ++ if (rte_is_same_ether_addr(ea, &mac_addrs[i])) ++ return true; ++ } ++ ++ return false; ++} ++ + static inline uint16_t + rx_burst_8023ad(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts, + bool dedicated_rxq) +@@ -331,8 +349,9 @@ rx_burst_8023ad(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts, + /* Remove packet from array if: + * - it is slow packet but no dedicated rxq is present, + * - slave is not in collecting state, +- * - bonding interface is not in promiscuous mode: +- * - packet is unicast and address does not match, ++ * - bonding interface is not in promiscuous mode and ++ * packet address isn't in mac_addrs array: ++ * - packet is unicast, + * - packet is multicast and bonding interface + * is not in allmulti, + */ +@@ -342,12 +361,10 @@ rx_burst_8023ad(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts, + bufs[j])) || + !collecting || + (!promisc && +- ((rte_is_unicast_ether_addr(&hdr->dst_addr) && +- !rte_is_same_ether_addr(bond_mac, +- &hdr->dst_addr)) || +- (!allmulti && +- rte_is_multicast_ether_addr(&hdr->dst_addr)))))) { +- ++ !is_bond_mac_addr(&hdr->dst_addr, bond_mac, ++ BOND_MAX_MAC_ADDRS) && ++ (rte_is_unicast_ether_addr(&hdr->dst_addr) || ++ !allmulti)))) { + if (hdr->ether_type == ether_type_slow_be) { + bond_mode_8023ad_handle_slow_pkt( + internals, slaves[idx], bufs[j]); +-- +2.23.0 + diff --git a/0196-net-hns3-support-Tx-push-quick-doorbell-for-performa.patch b/0196-net-hns3-support-Tx-push-quick-doorbell-for-performa.patch deleted file mode 100644 index 6c059420628e6ac8af0de0e0917f8b2464bd2fb0..0000000000000000000000000000000000000000 --- a/0196-net-hns3-support-Tx-push-quick-doorbell-for-performa.patch +++ /dev/null @@ -1,277 +0,0 @@ -From 4c96351a025f35434d6d3e01a31072866cf826d6 Mon Sep 17 00:00:00 2001 -From: Chengwen Feng -Date: Tue, 15 Jun 2021 09:34:29 +0800 -Subject: [PATCH 08/26] net/hns3: support Tx push quick doorbell for - performance - -Kunpeng 930 support Tx push mode which could improve performance. -It works like below: - 1. Add PCIe bar45 which support driver direct write the Tx descriptor - or tail reg to it. - 2. Support three operations: a) direct write one Tx descriptor, b) - direct write two Tx descriptors, c) direct write tail reg. - 3. The original tail reg located at bar23, the above bar45 tail reg - could provide better bandwidth from the hardware perspective. - -The hns3 driver only support direct write tail reg (also have the name -of quick doorbell), the detail: -Considering compatibility, firmware will report Tx push capa if the -hardware support it. - -Signed-off-by: Chengwen Feng -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_ethdev.c | 4 +- - drivers/net/hns3/hns3_ethdev.h | 4 ++ - drivers/net/hns3/hns3_ethdev_vf.c | 4 +- - drivers/net/hns3/hns3_rxtx.c | 73 ++++++++++++++++++++++++++++++++++- - drivers/net/hns3/hns3_rxtx.h | 19 +++++++++ - drivers/net/hns3/hns3_rxtx_vec_neon.h | 2 +- - drivers/net/hns3/hns3_rxtx_vec_sve.c | 2 +- - 7 files changed, 102 insertions(+), 6 deletions(-) - -diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c -index a80bc56..7283364 100644 ---- a/drivers/net/hns3/hns3_ethdev.c -+++ b/drivers/net/hns3/hns3_ethdev.c -@@ -5171,6 +5171,8 @@ hns3_init_pf(struct rte_eth_dev *eth_dev) - goto err_cmd_init; - } - -+ hns3_tx_push_init(eth_dev); -+ - /* - * To ensure that the hardware environment is clean during - * initialization, the driver actively clear the hardware environment -@@ -7415,8 +7417,8 @@ hns3_dev_init(struct rte_eth_dev *eth_dev) - "process, ret = %d", ret); - goto err_mp_init_secondary; - } -- - hw->secondary_cnt++; -+ hns3_tx_push_init(eth_dev); - return 0; - } - -diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h -index 53dc498..f3bc60e 100644 ---- a/drivers/net/hns3/hns3_ethdev.h -+++ b/drivers/net/hns3/hns3_ethdev.h -@@ -862,6 +862,7 @@ enum { - HNS3_DEV_SUPPORT_COPPER_B, - HNS3_DEV_SUPPORT_FD_QUEUE_REGION_B, - HNS3_DEV_SUPPORT_PTP_B, -+ HNS3_DEV_SUPPORT_TX_PUSH_B, - HNS3_DEV_SUPPORT_INDEP_TXRX_B, - HNS3_DEV_SUPPORT_STASH_B, - HNS3_DEV_SUPPORT_RXD_ADV_LAYOUT_B, -@@ -900,6 +901,9 @@ enum { - #define hns3_dev_ras_imp_supported(hw) \ - hns3_get_bit((hw)->capability, HNS3_DEV_SUPPORT_RAS_IMP_B) - -+#define hns3_dev_tx_push_supported(hw) \ -+ hns3_get_bit((hw)->capability, HNS3_DEV_SUPPORT_TX_PUSH_B) -+ - #define HNS3_DEV_PRIVATE_TO_HW(adapter) \ - (&((struct hns3_adapter *)adapter)->hw) - #define HNS3_DEV_PRIVATE_TO_PF(adapter) \ -diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c -index cbc3456..2085a29 100644 ---- a/drivers/net/hns3/hns3_ethdev_vf.c -+++ b/drivers/net/hns3/hns3_ethdev_vf.c -@@ -1921,6 +1921,8 @@ hns3vf_init_vf(struct rte_eth_dev *eth_dev) - goto err_cmd_init; - } - -+ hns3_tx_push_init(eth_dev); -+ - /* Get VF resource */ - ret = hns3_query_vf_resource(hw); - if (ret) -@@ -2925,8 +2927,8 @@ hns3vf_dev_init(struct rte_eth_dev *eth_dev) - "process, ret = %d", ret); - goto err_mp_init_secondary; - } -- - hw->secondary_cnt++; -+ hns3_tx_push_init(eth_dev); - return 0; - } - -diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c -index 3c645b3..51b727f 100644 ---- a/drivers/net/hns3/hns3_rxtx.c -+++ b/drivers/net/hns3/hns3_rxtx.c -@@ -2895,6 +2895,69 @@ hns3_tx_queue_conf_check(struct hns3_hw *hw, const struct rte_eth_txconf *conf, - return 0; - } - -+static void * -+hns3_tx_push_get_queue_tail_reg(struct rte_eth_dev *dev, uint16_t queue_id) -+{ -+#define HNS3_TX_PUSH_TQP_REGION_SIZE 0x10000 -+#define HNS3_TX_PUSH_QUICK_DOORBELL_OFFSET 64 -+#define HNS3_TX_PUSH_PCI_BAR_INDEX 4 -+ -+ struct rte_pci_device *pci_dev = RTE_DEV_TO_PCI(dev->device); -+ uint8_t bar_id = HNS3_TX_PUSH_PCI_BAR_INDEX; -+ -+ /* -+ * If device support Tx push then its PCIe bar45 must exist, and DPDK -+ * framework will mmap the bar45 default in PCI probe stage. -+ * -+ * In the bar45, the first half is for RoCE (RDMA over Converged -+ * Ethernet), and the second half is for NIC, every TQP occupy 64KB. -+ * -+ * The quick doorbell located at 64B offset in the TQP region. -+ */ -+ return (char *)pci_dev->mem_resource[bar_id].addr + -+ (pci_dev->mem_resource[bar_id].len >> 1) + -+ HNS3_TX_PUSH_TQP_REGION_SIZE * queue_id + -+ HNS3_TX_PUSH_QUICK_DOORBELL_OFFSET; -+} -+ -+void -+hns3_tx_push_init(struct rte_eth_dev *dev) -+{ -+ struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private); -+ volatile uint32_t *reg; -+ uint32_t val; -+ -+ if (!hns3_dev_tx_push_supported(hw)) -+ return; -+ -+ reg = (volatile uint32_t *)hns3_tx_push_get_queue_tail_reg(dev, 0); -+ /* -+ * Because the size of bar45 is about 8GB size, it may take a long time -+ * to do the page fault in Tx process when work with vfio-pci, so use -+ * one read operation to make kernel setup page table mapping for bar45 -+ * in the init stage. -+ * Note: the bar45 is readable but the result is all 1. -+ */ -+ val = *reg; -+ RTE_SET_USED(val); -+} -+ -+static void -+hns3_tx_push_queue_init(struct rte_eth_dev *dev, -+ uint16_t queue_id, -+ struct hns3_tx_queue *txq) -+{ -+ struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private); -+ if (!hns3_dev_tx_push_supported(hw)) { -+ txq->tx_push_enable = false; -+ return; -+ } -+ -+ txq->io_tail_reg = (volatile void *)hns3_tx_push_get_queue_tail_reg(dev, -+ queue_id); -+ txq->tx_push_enable = true; -+} -+ - int - hns3_tx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t nb_desc, - unsigned int socket_id, const struct rte_eth_txconf *conf) -@@ -2986,6 +3049,12 @@ hns3_tx_queue_setup(struct rte_eth_dev *dev, uint16_t idx, uint16_t nb_desc, - memset(&txq->basic_stats, 0, sizeof(struct hns3_tx_basic_stats)); - memset(&txq->dfx_stats, 0, sizeof(struct hns3_tx_dfx_stats)); - -+ /* -+ * Call hns3_tx_push_queue_init after assigned io_tail_reg field because -+ * it may overwrite the io_tail_reg field. -+ */ -+ hns3_tx_push_queue_init(dev, idx, txq); -+ - rte_spinlock_lock(&hw->lock); - dev->data->tx_queues[idx] = txq; - rte_spinlock_unlock(&hw->lock); -@@ -4032,7 +4101,7 @@ hns3_xmit_pkts_simple(void *tx_queue, - hns3_tx_fill_hw_ring(txq, tx_pkts + nb_tx, nb_pkts - nb_tx); - txq->next_to_use += nb_pkts - nb_tx; - -- hns3_write_reg_opt(txq->io_tail_reg, nb_pkts); -+ hns3_write_txq_tail_reg(txq, nb_pkts); - - return nb_pkts; - } -@@ -4149,7 +4218,7 @@ hns3_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) - end_of_tx: - - if (likely(nb_tx)) -- hns3_write_reg_opt(txq->io_tail_reg, nb_hold); -+ hns3_write_txq_tail_reg(txq, nb_hold); - - return nb_tx; - } -diff --git a/drivers/net/hns3/hns3_rxtx.h b/drivers/net/hns3/hns3_rxtx.h -index a42ab71..e01e582 100644 ---- a/drivers/net/hns3/hns3_rxtx.h -+++ b/drivers/net/hns3/hns3_rxtx.h -@@ -419,6 +419,7 @@ struct hns3_tx_dfx_stats { - }; - - struct hns3_tx_queue { -+ /* The io_tail_reg is write-only if working in tx push mode */ - volatile void *io_tail_reg; - struct hns3_desc *tx_ring; - struct hns3_entry *sw_ring; -@@ -659,6 +660,23 @@ hns3_rx_calc_ptype(struct hns3_rx_queue *rxq, const uint32_t l234_info, - return ptype_tbl->l3table[l3id] | ptype_tbl->l4table[l4id]; - } - -+/* -+ * If enable using Tx push feature and also device support it, then use quick -+ * doorbell (bar45) to inform the hardware. -+ * -+ * The other cases (such as: device don't support or user don't enable using) -+ * then use normal doorbell (bar23) to inform the hardware. -+ */ -+static inline void -+hns3_write_txq_tail_reg(struct hns3_tx_queue *txq, uint32_t value) -+{ -+ rte_io_wmb(); -+ if (txq->tx_push_enable) -+ rte_write64_relaxed(rte_cpu_to_le_32(value), txq->io_tail_reg); -+ else -+ rte_write32_relaxed(rte_cpu_to_le_32(value), txq->io_tail_reg); -+} -+ - void hns3_dev_rx_queue_release(void *queue); - void hns3_dev_tx_queue_release(void *queue); - void hns3_free_all_queues(struct rte_eth_dev *dev); -@@ -741,5 +759,6 @@ int hns3_tx_done_cleanup(void *txq, uint32_t free_cnt); - void hns3_enable_rxd_adv_layout(struct hns3_hw *hw); - int hns3_dev_rx_descriptor_status(void *rx_queue, uint16_t offset); - int hns3_dev_tx_descriptor_status(void *tx_queue, uint16_t offset); -+void hns3_tx_push_init(struct rte_eth_dev *dev); - - #endif /* _HNS3_RXTX_H_ */ -diff --git a/drivers/net/hns3/hns3_rxtx_vec_neon.h b/drivers/net/hns3/hns3_rxtx_vec_neon.h -index 35fef12..30a7d70 100644 ---- a/drivers/net/hns3/hns3_rxtx_vec_neon.h -+++ b/drivers/net/hns3/hns3_rxtx_vec_neon.h -@@ -84,7 +84,7 @@ hns3_xmit_fixed_burst_vec(void *__restrict tx_queue, - txq->next_to_use = next_to_use; - txq->tx_bd_ready -= nb_tx; - -- hns3_write_reg_opt(txq->io_tail_reg, nb_tx); -+ hns3_write_txq_tail_reg(txq, nb_tx); - - return nb_tx; - } -diff --git a/drivers/net/hns3/hns3_rxtx_vec_sve.c b/drivers/net/hns3/hns3_rxtx_vec_sve.c -index be9a4ff..c861887 100644 ---- a/drivers/net/hns3/hns3_rxtx_vec_sve.c -+++ b/drivers/net/hns3/hns3_rxtx_vec_sve.c -@@ -475,7 +475,7 @@ hns3_xmit_fixed_burst_vec_sve(void *__restrict tx_queue, - txq->next_to_use += nb_pkts - nb_tx; - - txq->tx_bd_ready -= nb_pkts; -- hns3_write_reg_opt(txq->io_tail_reg, nb_pkts); -+ hns3_write_txq_tail_reg(txq, nb_pkts); - - return nb_pkts; - } --- -2.7.4 - diff --git a/0197-net-bonding-fix-slave-device-Rx-Tx-offload-configura.patch b/0197-net-bonding-fix-slave-device-Rx-Tx-offload-configura.patch new file mode 100644 index 0000000000000000000000000000000000000000..ee6e168e17013e484e5038d79873e0ace391b978 --- /dev/null +++ b/0197-net-bonding-fix-slave-device-Rx-Tx-offload-configura.patch @@ -0,0 +1,54 @@ +From 6ca88723b7df208ffa5c43fdfda06381103e488a Mon Sep 17 00:00:00 2001 +From: Huisong Li +Date: Tue, 15 Nov 2022 12:06:08 +0800 +Subject: net/bonding: fix slave device Rx/Tx offload configuration + +[ upstream commit fdbc4e7704a7de0f41f72d4f5337b0eddaa81991 ] + +Normally, the Rx/Tx offload capability of bonding interface is +the intersection of the capability of all slave devices. And +Rx/Tx offloads configuration of slave device comes from bonding +interface. But now there is a risk that slave device retains its +previous offload configurations which is not within the offload +configurations of bond interface. + +Fixes: 57b156540f51 ("net/bonding: fix offloading configuration") + +Signed-off-by: Huisong Li +Acked-by: Min Hu (Connor) +--- + drivers/net/bonding/rte_eth_bond_pmd.c | 17 ++++------------- + 1 file changed, 4 insertions(+), 13 deletions(-) + +diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c +index f1e7b6459a..2bf28b829d 100644 +--- a/drivers/net/bonding/rte_eth_bond_pmd.c ++++ b/drivers/net/bonding/rte_eth_bond_pmd.c +@@ -1762,20 +1762,11 @@ slave_configure(struct rte_eth_dev *bonded_eth_dev, + slave_eth_dev->data->dev_conf.link_speeds = + bonded_eth_dev->data->dev_conf.link_speeds; + +- slave_eth_dev->data->dev_conf.txmode.offloads |= +- bonded_eth_dev->data->dev_conf.txmode.offloads; +- +- slave_eth_dev->data->dev_conf.txmode.offloads &= +- (bonded_eth_dev->data->dev_conf.txmode.offloads | +- ~internals->tx_offload_capa); +- +- slave_eth_dev->data->dev_conf.rxmode.offloads |= +- bonded_eth_dev->data->dev_conf.rxmode.offloads; +- +- slave_eth_dev->data->dev_conf.rxmode.offloads &= +- (bonded_eth_dev->data->dev_conf.rxmode.offloads | +- ~internals->rx_offload_capa); ++ slave_eth_dev->data->dev_conf.txmode.offloads = ++ bonded_eth_dev->data->dev_conf.txmode.offloads; + ++ slave_eth_dev->data->dev_conf.rxmode.offloads = ++ bonded_eth_dev->data->dev_conf.rxmode.offloads; + + nb_rx_queues = bonded_eth_dev->data->nb_rx_queues; + nb_tx_queues = bonded_eth_dev->data->nb_tx_queues; +-- +2.23.0 + diff --git a/0197-net-hns3-fix-traffic-management.patch b/0197-net-hns3-fix-traffic-management.patch deleted file mode 100644 index 2b77f6a70b84455cacbe567666ec6cc1d10ad112..0000000000000000000000000000000000000000 --- a/0197-net-hns3-fix-traffic-management.patch +++ /dev/null @@ -1,311 +0,0 @@ -From 78db1dbe9adf7ed0fedd6331dcd3a2c1ee0b85c4 Mon Sep 17 00:00:00 2001 -From: Huisong Li -Date: Mon, 21 Jun 2021 15:38:45 +0800 -Subject: [PATCH 09/26] net/hns3: fix traffic management - -In a multi-TC scenario, if the length of packets destined for different -TCs is different, for example, 64B and 1500B packets destined for TC0 and -TC1 respectively. There is a problem that the bandwidth of the TC to which -large packets are sent is preempted by the TC to which small packets are -sent on the Kunpeng 920 network engine. As a result, the TC bandwidth -accuracy is inaccurate. - -To solve this problem, this patch made the following adjustments: -1/ During initialization, firmware reports the capability bit indicating -whether the TM function is supported. -2/ The command word for configuring TC and port rate limiting is added, -instead of reusing the existing command word. And firmware configured -to the correct module. -3/ When the PF driver is loaded, firmware completes the default -initialization of the TC and port. - -Fixes: c09c7847d892 ("net/hns3: support traffic management") -Cc: stable@dpdk.org - -Signed-off-by: Huisong Li -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_cmd.c | 5 ++- - drivers/net/hns3/hns3_cmd.h | 4 +++ - drivers/net/hns3/hns3_dcb.c | 4 +-- - drivers/net/hns3/hns3_dcb.h | 2 -- - drivers/net/hns3/hns3_ethdev.h | 4 +++ - drivers/net/hns3/hns3_tm.c | 69 +++++++++++++++++++++++++++++------------- - drivers/net/hns3/hns3_tm.h | 12 ++++++++ - 7 files changed, 74 insertions(+), 26 deletions(-) - -diff --git a/drivers/net/hns3/hns3_cmd.c b/drivers/net/hns3/hns3_cmd.c -index 5f4d74d..ab92240 100644 ---- a/drivers/net/hns3/hns3_cmd.c -+++ b/drivers/net/hns3/hns3_cmd.c -@@ -431,7 +431,8 @@ hns3_get_caps_name(uint32_t caps_id) - { HNS3_CAPS_STASH_B, "stash" }, - { HNS3_CAPS_UDP_TUNNEL_CSUM_B, "udp_tunnel_csum" }, - { HNS3_CAPS_RAS_IMP_B, "ras_imp" }, -- { HNS3_CAPS_RXD_ADV_LAYOUT_B, "rxd_adv_layout" } -+ { HNS3_CAPS_RXD_ADV_LAYOUT_B, "rxd_adv_layout" }, -+ { HNS3_CAPS_TM_B, "tm_capability" } - }; - uint32_t i; - -@@ -507,6 +508,8 @@ hns3_parse_capability(struct hns3_hw *hw, - HNS3_DEV_SUPPORT_OUTER_UDP_CKSUM_B, 1); - if (hns3_get_bit(caps, HNS3_CAPS_RAS_IMP_B)) - hns3_set_bit(hw->capability, HNS3_DEV_SUPPORT_RAS_IMP_B, 1); -+ if (hns3_get_bit(caps, HNS3_CAPS_TM_B)) -+ hns3_set_bit(hw->capability, HNS3_DEV_SUPPORT_TM_B, 1); - } - - static uint32_t -diff --git a/drivers/net/hns3/hns3_cmd.h b/drivers/net/hns3/hns3_cmd.h -index a249a7a..cd58303 100644 ---- a/drivers/net/hns3/hns3_cmd.h -+++ b/drivers/net/hns3/hns3_cmd.h -@@ -162,6 +162,9 @@ enum hns3_opcode_type { - HNS3_OPC_TM_INTERNAL_CNT = 0x0851, - HNS3_OPC_TM_INTERNAL_STS_1 = 0x0852, - -+ HNS3_OPC_TM_PORT_LIMIT_RATE = 0x0870, -+ HNS3_OPC_TM_TC_LIMIT_RATE = 0x0871, -+ - /* Mailbox cmd */ - HNS3_OPC_MBX_VF_TO_PF = 0x2001, - -@@ -319,6 +322,7 @@ enum HNS3_CAPS_BITS { - HNS3_CAPS_UDP_TUNNEL_CSUM_B, - HNS3_CAPS_RAS_IMP_B, - HNS3_CAPS_RXD_ADV_LAYOUT_B = 15, -+ HNS3_CAPS_TM_B = 17, - }; - - enum HNS3_API_CAP_BITS { -diff --git a/drivers/net/hns3/hns3_dcb.c b/drivers/net/hns3/hns3_dcb.c -index 8778452..61a2404 100644 ---- a/drivers/net/hns3/hns3_dcb.c -+++ b/drivers/net/hns3/hns3_dcb.c -@@ -415,7 +415,7 @@ hns3_dcb_pg_shapping_cfg(struct hns3_hw *hw, enum hns3_shap_bucket bucket, - return hns3_cmd_send(hw, &desc, 1); - } - --int -+static int - hns3_pg_shaper_rate_cfg(struct hns3_hw *hw, uint8_t pg_id, uint32_t rate) - { - struct hns3_shaper_parameter shaper_parameter; -@@ -551,7 +551,7 @@ hns3_dcb_pri_shapping_cfg(struct hns3_hw *hw, enum hns3_shap_bucket bucket, - return hns3_cmd_send(hw, &desc, 1); - } - --int -+static int - hns3_pri_shaper_rate_cfg(struct hns3_hw *hw, uint8_t tc_no, uint32_t rate) - { - struct hns3_shaper_parameter shaper_parameter; -diff --git a/drivers/net/hns3/hns3_dcb.h b/drivers/net/hns3/hns3_dcb.h -index 279f163..1abe649 100644 ---- a/drivers/net/hns3/hns3_dcb.h -+++ b/drivers/net/hns3/hns3_dcb.h -@@ -209,8 +209,6 @@ int hns3_queue_to_tc_mapping(struct hns3_hw *hw, uint16_t nb_rx_q, - - int hns3_update_queue_map_configure(struct hns3_adapter *hns); - int hns3_port_shaper_update(struct hns3_hw *hw, uint32_t speed); --int hns3_pg_shaper_rate_cfg(struct hns3_hw *hw, uint8_t pg_id, uint32_t rate); --int hns3_pri_shaper_rate_cfg(struct hns3_hw *hw, uint8_t tc_no, uint32_t rate); - uint8_t hns3_txq_mapped_tc_get(struct hns3_hw *hw, uint16_t txq_no); - - #endif /* _HNS3_DCB_H_ */ -diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h -index f3bc60e..31379fd 100644 ---- a/drivers/net/hns3/hns3_ethdev.h -+++ b/drivers/net/hns3/hns3_ethdev.h -@@ -868,6 +868,7 @@ enum { - HNS3_DEV_SUPPORT_RXD_ADV_LAYOUT_B, - HNS3_DEV_SUPPORT_OUTER_UDP_CKSUM_B, - HNS3_DEV_SUPPORT_RAS_IMP_B, -+ HNS3_DEV_SUPPORT_TM_B, - }; - - #define hns3_dev_dcb_supported(hw) \ -@@ -904,6 +905,9 @@ enum { - #define hns3_dev_tx_push_supported(hw) \ - hns3_get_bit((hw)->capability, HNS3_DEV_SUPPORT_TX_PUSH_B) - -+#define hns3_dev_tm_supported(hw) \ -+ hns3_get_bit((hw)->capability, HNS3_DEV_SUPPORT_TM_B) -+ - #define HNS3_DEV_PRIVATE_TO_HW(adapter) \ - (&((struct hns3_adapter *)adapter)->hw) - #define HNS3_DEV_PRIVATE_TO_PF(adapter) \ -diff --git a/drivers/net/hns3/hns3_tm.c b/drivers/net/hns3/hns3_tm.c -index f7bfc25..81c61ad 100644 ---- a/drivers/net/hns3/hns3_tm.c -+++ b/drivers/net/hns3/hns3_tm.c -@@ -28,8 +28,12 @@ void - hns3_tm_conf_init(struct rte_eth_dev *dev) - { - struct hns3_pf *pf = HNS3_DEV_PRIVATE_TO_PF(dev->data->dev_private); -+ struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private); - uint32_t max_tx_queues = hns3_tm_max_tx_queues_get(dev); - -+ if (!hns3_dev_tm_supported(hw)) -+ return; -+ - pf->tm_conf.nb_leaf_nodes_max = max_tx_queues; - pf->tm_conf.nb_nodes_max = 1 + HNS3_MAX_TC_NUM + max_tx_queues; - pf->tm_conf.nb_shaper_profile_max = 1 + HNS3_MAX_TC_NUM; -@@ -50,9 +54,13 @@ void - hns3_tm_conf_uninit(struct rte_eth_dev *dev) - { - struct hns3_pf *pf = HNS3_DEV_PRIVATE_TO_PF(dev->data->dev_private); -+ struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private); - struct hns3_tm_shaper_profile *shaper_profile; - struct hns3_tm_node *tm_node; - -+ if (!hns3_dev_tm_supported(hw)) -+ return; -+ - if (pf->tm_conf.nb_queue_node > 0) { - while ((tm_node = TAILQ_FIRST(&pf->tm_conf.queue_list))) { - TAILQ_REMOVE(&pf->tm_conf.queue_list, tm_node, node); -@@ -912,40 +920,39 @@ static int - hns3_tm_config_port_rate(struct hns3_hw *hw, - struct hns3_tm_shaper_profile *shaper_profile) - { -+ struct hns3_port_limit_rate_cmd *cfg; -+ struct hns3_cmd_desc desc; - uint32_t firmware_rate; - uint64_t rate; -+ int ret; - - if (shaper_profile) { - rate = shaper_profile->profile.peak.rate; - firmware_rate = hns3_tm_rate_convert_tm2firmware(rate); - } else { -- firmware_rate = hw->dcb_info.pg_info[0].bw_limit; -+ firmware_rate = hw->max_tm_rate; - } - -- /* -- * The TM shaper topology after device inited: -- * pri0 shaper --->| -- * pri1 shaper --->| -- * ... |----> pg0 shaper ----> port shaper -- * ... | -- * priX shaper --->| -- * -- * Because port shaper rate maybe changed by firmware, to avoid -- * concurrent configure, driver use pg0 shaper to achieve the rate limit -- * of port. -- * -- * The finally port rate = MIN(pg0 shaper rate, port shaper rate) -- */ -- return hns3_pg_shaper_rate_cfg(hw, 0, firmware_rate); -+ hns3_cmd_setup_basic_desc(&desc, HNS3_OPC_TM_PORT_LIMIT_RATE, false); -+ cfg = (struct hns3_port_limit_rate_cmd *)desc.data; -+ cfg->speed = rte_cpu_to_le_32(firmware_rate); -+ -+ ret = hns3_cmd_send(hw, &desc, 1); -+ if (ret) -+ hns3_err(hw, "failed to config port rate, ret = %d", ret); -+ -+ return ret; - } - - static int --hns3_tm_config_tc_rate(struct hns3_hw *hw, -- uint8_t tc_no, -+hns3_tm_config_tc_rate(struct hns3_hw *hw, uint8_t tc_no, - struct hns3_tm_shaper_profile *shaper_profile) - { -+ struct hns3_tc_limit_rate_cmd *cfg; -+ struct hns3_cmd_desc desc; - uint32_t firmware_rate; - uint64_t rate; -+ int ret; - - if (shaper_profile) { - rate = shaper_profile->profile.peak.rate; -@@ -954,7 +961,17 @@ hns3_tm_config_tc_rate(struct hns3_hw *hw, - firmware_rate = hw->dcb_info.tc_info[tc_no].bw_limit; - } - -- return hns3_pri_shaper_rate_cfg(hw, tc_no, firmware_rate); -+ hns3_cmd_setup_basic_desc(&desc, HNS3_OPC_TM_TC_LIMIT_RATE, false); -+ cfg = (struct hns3_tc_limit_rate_cmd *)desc.data; -+ cfg->speed = rte_cpu_to_le_32(firmware_rate); -+ cfg->tc_id = tc_no; -+ -+ ret = hns3_cmd_send(hw, &desc, 1); -+ if (ret) -+ hns3_err(hw, "failed to config tc (%u) rate, ret = %d", -+ tc_no, ret); -+ -+ return ret; - } - - static bool -@@ -1227,12 +1244,16 @@ static const struct rte_tm_ops hns3_tm_ops = { - }; - - int --hns3_tm_ops_get(struct rte_eth_dev *dev __rte_unused, -- void *arg) -+hns3_tm_ops_get(struct rte_eth_dev *dev, void *arg) - { -+ struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private); -+ - if (arg == NULL) - return -EINVAL; - -+ if (!hns3_dev_tm_supported(hw)) -+ return -EOPNOTSUPP; -+ - *(const void **)arg = &hns3_tm_ops; - - return 0; -@@ -1243,6 +1264,9 @@ hns3_tm_dev_start_proc(struct hns3_hw *hw) - { - struct hns3_pf *pf = HNS3_DEV_HW_TO_PF(hw); - -+ if (!hns3_dev_tm_supported(hw)) -+ return; -+ - if (pf->tm_conf.root && !pf->tm_conf.committed) - hns3_warn(hw, - "please call hierarchy_commit() before starting the port."); -@@ -1289,6 +1313,9 @@ hns3_tm_conf_update(struct hns3_hw *hw) - struct hns3_pf *pf = HNS3_DEV_HW_TO_PF(hw); - struct rte_tm_error error; - -+ if (!hns3_dev_tm_supported(hw)) -+ return 0; -+ - if (pf->tm_conf.root == NULL || !pf->tm_conf.committed) - return 0; - -diff --git a/drivers/net/hns3/hns3_tm.h b/drivers/net/hns3/hns3_tm.h -index d8de3e4..2286d0e 100644 ---- a/drivers/net/hns3/hns3_tm.h -+++ b/drivers/net/hns3/hns3_tm.h -@@ -9,6 +9,18 @@ - #include - #include - -+struct hns3_port_limit_rate_cmd { -+ uint32_t speed; /* Unit Mbps */ -+ uint32_t rsvd[5]; -+}; -+ -+struct hns3_tc_limit_rate_cmd { -+ uint32_t speed; /* Unit Mbps */ -+ uint8_t tc_id; -+ uint8_t rsvd[3]; -+ uint32_t rsvd1[4]; -+}; -+ - enum hns3_tm_node_type { - HNS3_TM_NODE_TYPE_PORT, - HNS3_TM_NODE_TYPE_TC, --- -2.7.4 - diff --git a/0198-app-testpmd-fix-MAC-header-in-csum-forward-engine.patch b/0198-app-testpmd-fix-MAC-header-in-csum-forward-engine.patch new file mode 100644 index 0000000000000000000000000000000000000000..00ef57ee7485965dfe27e6064cfacecb4a9d57ac --- /dev/null +++ b/0198-app-testpmd-fix-MAC-header-in-csum-forward-engine.patch @@ -0,0 +1,154 @@ +From a31eaf3090f26f73fa3996487d9bde36418dbcd9 Mon Sep 17 00:00:00 2001 +From: Huisong Li +Date: Tue, 15 Nov 2022 12:06:09 +0800 +Subject: app/testpmd: fix MAC header in csum forward engine + +[ upstream commit 008834b91ac9a9e4ea982e5d2a4526d1b90a8d18 ] + +MLX5 SR-IOV Tx engine will not transmit Ethernet frame +if destination MAC address matched local port address. The frame ether +looped-back to Rx or dropped, depending on the port configuration. + +Application running over MLX5 SR-IOV port cannot transmit packet +polled from Rx queue as is. The packet Ethernet destination address +must be changed. + +Add new run-time configuration parameter to the `csum` forwarding +engine to control MAC addresses configuration: + +testpmd> csum mac-swap on|off + +`mac-swap on` replace MAC addresses. +`mac-swap off` keep Ethernet header unchanged. + +Fixes: 9b4ea7ae77fa ("app/testpmd: revert MAC update in checksum forwarding") + +Signed-off-by: Gregory Etelson +Acked-by: Huisong Li +--- + app/test-pmd/cmdline.c | 50 +++++++++++++++++++++++++++++++++++++++++ + app/test-pmd/csumonly.c | 6 +++++ + app/test-pmd/testpmd.c | 5 +++-- + app/test-pmd/testpmd.h | 3 ++- + 4 files changed, 61 insertions(+), 3 deletions(-) + +diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c +index 8d4a88bb85..9e0e725913 100644 +--- a/app/test-pmd/cmdline.c ++++ b/app/test-pmd/cmdline.c +@@ -4836,6 +4836,55 @@ cmdline_parse_inst_t cmd_csum_tunnel = { + }, + }; + ++struct cmd_csum_mac_swap_result { ++ cmdline_fixed_string_t csum; ++ cmdline_fixed_string_t parse; ++ cmdline_fixed_string_t onoff; ++ portid_t port_id; ++}; ++ ++static void ++cmd_csum_mac_swap_parsed(void *parsed_result, ++ __rte_unused struct cmdline *cl, ++ __rte_unused void *data) ++{ ++ struct cmd_csum_mac_swap_result *res = parsed_result; ++ ++ if (port_id_is_invalid(res->port_id, ENABLED_WARN)) ++ return; ++ if (strcmp(res->onoff, "on") == 0) ++ ports[res->port_id].fwd_mac_swap = 1; ++ else ++ ports[res->port_id].fwd_mac_swap = 0; ++} ++ ++static cmdline_parse_token_string_t cmd_csum_mac_swap_csum = ++ TOKEN_STRING_INITIALIZER(struct cmd_csum_mac_swap_result, ++ csum, "csum"); ++static cmdline_parse_token_string_t cmd_csum_mac_swap_parse = ++ TOKEN_STRING_INITIALIZER(struct cmd_csum_mac_swap_result, ++ parse, "mac-swap"); ++static cmdline_parse_token_string_t cmd_csum_mac_swap_onoff = ++ TOKEN_STRING_INITIALIZER(struct cmd_csum_mac_swap_result, ++ onoff, "on#off"); ++static cmdline_parse_token_num_t cmd_csum_mac_swap_portid = ++ TOKEN_NUM_INITIALIZER(struct cmd_csum_mac_swap_result, ++ port_id, RTE_UINT16); ++ ++static cmdline_parse_inst_t cmd_csum_mac_swap = { ++ .f = cmd_csum_mac_swap_parsed, ++ .data = NULL, ++ .help_str = "csum mac-swap on|off : " ++ "Enable/Disable forward mac address swap", ++ .tokens = { ++ (void *)&cmd_csum_mac_swap_csum, ++ (void *)&cmd_csum_mac_swap_parse, ++ (void *)&cmd_csum_mac_swap_onoff, ++ (void *)&cmd_csum_mac_swap_portid, ++ NULL, ++ }, ++}; ++ + /* *** ENABLE HARDWARE SEGMENTATION IN TX NON-TUNNELED PACKETS *** */ + struct cmd_tso_set_result { + cmdline_fixed_string_t tso; +@@ -17699,6 +17748,7 @@ cmdline_parse_ctx_t main_ctx[] = { + (cmdline_parse_inst_t *)&cmd_csum_set, + (cmdline_parse_inst_t *)&cmd_csum_show, + (cmdline_parse_inst_t *)&cmd_csum_tunnel, ++ (cmdline_parse_inst_t *)&cmd_csum_mac_swap, + (cmdline_parse_inst_t *)&cmd_tso_set, + (cmdline_parse_inst_t *)&cmd_tso_show, + (cmdline_parse_inst_t *)&cmd_tunnel_tso_set, +diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c +index 206968d37a..d8cb8c89aa 100644 +--- a/app/test-pmd/csumonly.c ++++ b/app/test-pmd/csumonly.c +@@ -887,6 +887,12 @@ pkt_burst_checksum_forward(struct fwd_stream *fs) + * and inner headers */ + + eth_hdr = rte_pktmbuf_mtod(m, struct rte_ether_hdr *); ++ if (ports[fs->tx_port].fwd_mac_swap) { ++ rte_ether_addr_copy(&peer_eth_addrs[fs->peer_addr], ++ ð_hdr->dst_addr); ++ rte_ether_addr_copy(&ports[fs->tx_port].eth_addr, ++ ð_hdr->src_addr); ++ } + parse_ethernet(eth_hdr, &info); + l3_hdr = (char *)eth_hdr + info.l2_len; + +diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c +index 2be92af9f8..ff9eabbcb7 100644 +--- a/app/test-pmd/testpmd.c ++++ b/app/test-pmd/testpmd.c +@@ -4160,10 +4160,11 @@ init_port(void) + "rte_zmalloc(%d struct rte_port) failed\n", + RTE_MAX_ETHPORTS); + } +- for (i = 0; i < RTE_MAX_ETHPORTS; i++) ++ for (i = 0; i < RTE_MAX_ETHPORTS; i++) { ++ ports[i].fwd_mac_swap = 1; + ports[i].xstats_info.allocated = false; +- for (i = 0; i < RTE_MAX_ETHPORTS; i++) + LIST_INIT(&ports[i].flow_tunnel_list); ++ } + /* Initialize ports NUMA structures */ + memset(port_numa, NUMA_NO_CONFIG, RTE_MAX_ETHPORTS); + memset(rxring_numa, NUMA_NO_CONFIG, RTE_MAX_ETHPORTS); +diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h +index ab6642585e..442f97ce3d 100644 +--- a/app/test-pmd/testpmd.h ++++ b/app/test-pmd/testpmd.h +@@ -247,7 +247,8 @@ struct rte_port { + struct rte_ether_addr *mc_addr_pool; /**< pool of multicast addrs */ + uint32_t mc_addr_nb; /**< nb. of addr. in mc_addr_pool */ + uint8_t slave_flag : 1, /**< bonding slave port */ +- bond_flag : 1; /**< port is bond device */ ++ bond_flag : 1, /**< port is bond device */ ++ fwd_mac_swap : 1; /**< swap packet MAC before forward */ + struct port_flow *flow_list; /**< Associated flows. */ + struct port_indirect_action *actions_list; + /**< Associated indirect actions. */ +-- +2.23.0 + diff --git a/0198-config-arm-fix-SVE-build-with-GCC-8.3.patch b/0198-config-arm-fix-SVE-build-with-GCC-8.3.patch deleted file mode 100644 index 247fef7bc37b5c3a127e858847979864bfbad008..0000000000000000000000000000000000000000 --- a/0198-config-arm-fix-SVE-build-with-GCC-8.3.patch +++ /dev/null @@ -1,83 +0,0 @@ -From 8ae253ae5053753fd8225cc78d34ab5d2c449b5f Mon Sep 17 00:00:00 2001 -From: Chengwen Feng -Date: Mon, 28 Jun 2021 10:57:50 +0800 -Subject: [PATCH 12/26] config/arm: fix SVE build with GCC 8.3 - -If the target machine has SVE feature (e.g. "-march=armv8.2-a+sve'), -and the compiler is gcc-8.3, it will produce this error: - In file included from lib/eal/common/eal_common_options.c:38: - lib/eal/arm/include/rte_vect.h:13:10: fatal error: - arm_sve.h: No such file or directory - #include - ^~~~~~~~~~~ - -The root cause is that gcc-8.3 supports SVE (the macro -__ARM_FEATURE_SVE was 1), but it doesn't support SVE ACLE [1]. - -The solution: -a) Detect compiler whether support SVE ACLE, if support then define -RTE_HAS_SVE_ACLE macro. -b) Use the RTE_HAS_SVE_ACLE macro to include SVE header file. - -[1] ACLE: Arm C Language Extensions, the SVE ACLE header file is -, user should include it when writing ACLE SVE code. - -Fixes: 67b68824a82d ("lpm/arm: support SVE") -Cc: stable@dpdk.org - -Signed-off-by: Chengwen Feng -Acked-by: Ruifeng Wang -Signed-off-by: Thomas Monjalon ---- - config/arm/meson.build | 3 +++ - lib/librte_eal/arm/include/rte_vect.h | 3 +++ - lib/librte_lpm/rte_lpm.h | 4 ++++ - 3 files changed, 10 insertions(+) - -diff --git a/config/arm/meson.build b/config/arm/meson.build -index b18acea..06ecaf3 100644 ---- a/config/arm/meson.build -+++ b/config/arm/meson.build -@@ -216,6 +216,9 @@ endif - - if cc.get_define('__ARM_FEATURE_SVE', args: machine_args) != '' - compile_time_cpuflags += ['RTE_CPUFLAG_SVE'] -+ if (cc.check_header('arm_sve.h')) -+ dpdk_conf.set('RTE_HAS_SVE_ACLE', 1) -+ endif - endif - - if cc.get_define('__ARM_FEATURE_CRC32', args: machine_args) != '' -diff --git a/lib/librte_eal/arm/include/rte_vect.h b/lib/librte_eal/arm/include/rte_vect.h -index a739e6e..4b705ba 100644 ---- a/lib/librte_eal/arm/include/rte_vect.h -+++ b/lib/librte_eal/arm/include/rte_vect.h -@@ -9,6 +9,9 @@ - #include "generic/rte_vect.h" - #include "rte_debug.h" - #include "arm_neon.h" -+#ifdef RTE_HAS_SVE_ACLE -+#include -+#endif - - #ifdef __cplusplus - extern "C" { -diff --git a/lib/librte_lpm/rte_lpm.h b/lib/librte_lpm/rte_lpm.h -index 1afe55c..5eb14c1 100644 ---- a/lib/librte_lpm/rte_lpm.h -+++ b/lib/librte_lpm/rte_lpm.h -@@ -402,7 +402,11 @@ rte_lpm_lookupx4(const struct rte_lpm *lpm, xmm_t ip, uint32_t hop[4], - uint32_t defv); - - #if defined(RTE_ARCH_ARM) -+#ifdef RTE_HAS_SVE_ACLE -+#include "rte_lpm_sve.h" -+#else - #include "rte_lpm_neon.h" -+#endif - #elif defined(RTE_ARCH_PPC_64) - #include "rte_lpm_altivec.h" - #else --- -2.7.4 - diff --git a/0199-app-testpmd-update-bond-port-configurations-when-add.patch b/0199-app-testpmd-update-bond-port-configurations-when-add.patch new file mode 100644 index 0000000000000000000000000000000000000000..d973067da169ff1892edf781ac6927315698a66f --- /dev/null +++ b/0199-app-testpmd-update-bond-port-configurations-when-add.patch @@ -0,0 +1,110 @@ +From 97b384c9ecb993ea111bd7648a0aac9127917d22 Mon Sep 17 00:00:00 2001 +From: Huisong Li +Date: Tue, 15 Nov 2022 12:06:10 +0800 +Subject: app/testpmd: update bond port configurations when add slave + +[ upstream commit 76376bd9cd491fb0ca9c0b78346cee0ca7c4a351 ] + +Some capabilities (like, rx_offload_capa and tx_offload_capa) of bonding +device in dev_info is zero when no slave is added. And its capability will +be updated when add a new slave device. + +The capability to update dynamically may introduce some problems if not +handled properly. For example, the reconfig() is called to initialize +bonding port configurations when create a bonding device. The global +tx_mode is assigned to dev_conf.txmode. The DEV_TX_OFFLOAD_MBUF_FAST_FREE +which is the default value of global tx_mode.offloads in testpmd is removed +from bonding device configuration because of zero rx_offload_capa. +As a result, this offload isn't set to bonding device. + +Generally, port configurations of bonding device must be within the +intersection of the capability of all slave devices. If use original port +configurations, the removed capabilities because of adding a new slave may +cause failure when re-initialize bonding device. + +So port configurations of bonding device need to be updated because of the +added and removed capabilities. In addition, this also helps to ensure +consistency between testpmd and bonding device. + +Signed-off-by: Huisong Li +Reviewed-by: Min Hu (Connor) +--- + app/test-pmd/testpmd.c | 40 ++++++++++++++++++++++++++++++++++++++++ + app/test-pmd/testpmd.h | 3 ++- + 2 files changed, 42 insertions(+), 1 deletion(-) + +diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c +index ff9eabbcb7..32098d4701 100644 +--- a/app/test-pmd/testpmd.c ++++ b/app/test-pmd/testpmd.c +@@ -2778,6 +2778,41 @@ fill_xstats_display_info(void) + fill_xstats_display_info_for_port(pi); + } + ++/* ++ * Some capabilities (like, rx_offload_capa and tx_offload_capa) of bonding ++ * device in dev_info is zero when no slave is added. And its capability ++ * will be updated when add a new slave device. So adding a slave device need ++ * to update the port configurations of bonding device. ++ */ ++static void ++update_bonding_port_dev_conf(portid_t bond_pid) ++{ ++#ifdef RTE_NET_BOND ++ struct rte_port *port = &ports[bond_pid]; ++ uint16_t i; ++ int ret; ++ ++ ret = eth_dev_info_get_print_err(bond_pid, &port->dev_info); ++ if (ret != 0) { ++ fprintf(stderr, "Failed to get dev info for port = %u\n", ++ bond_pid); ++ return; ++ } ++ ++ if (port->dev_info.tx_offload_capa & RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE) ++ port->dev_conf.txmode.offloads |= ++ RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE; ++ /* Apply Tx offloads configuration */ ++ for (i = 0; i < port->dev_info.max_tx_queues; i++) ++ port->tx_conf[i].offloads = port->dev_conf.txmode.offloads; ++ ++ port->dev_conf.rx_adv_conf.rss_conf.rss_hf &= ++ port->dev_info.flow_type_rss_offloads; ++#else ++ RTE_SET_USED(bond_pid); ++#endif ++} ++ + int + start_port(portid_t pid) + { +@@ -2842,6 +2877,11 @@ start_port(portid_t pid) + return -1; + } + ++ if (port->bond_flag == 1 && port->update_conf == 1) { ++ update_bonding_port_dev_conf(pi); ++ port->update_conf = 0; ++ } ++ + /* configure port */ + diag = eth_dev_configure_mp(pi, nb_rxq + nb_hairpinq, + nb_txq + nb_hairpinq, +diff --git a/app/test-pmd/testpmd.h b/app/test-pmd/testpmd.h +index 442f97ce3d..480dc3fa34 100644 +--- a/app/test-pmd/testpmd.h ++++ b/app/test-pmd/testpmd.h +@@ -248,7 +248,8 @@ struct rte_port { + uint32_t mc_addr_nb; /**< nb. of addr. in mc_addr_pool */ + uint8_t slave_flag : 1, /**< bonding slave port */ + bond_flag : 1, /**< port is bond device */ +- fwd_mac_swap : 1; /**< swap packet MAC before forward */ ++ fwd_mac_swap : 1, /**< swap packet MAC before forward */ ++ update_conf : 1; /**< need to update bonding device configuration */ + struct port_flow *flow_list; /**< Associated flows. */ + struct port_indirect_action *actions_list; + /**< Associated indirect actions. */ +-- +2.23.0 + diff --git a/0199-net-hns3-fix-Arm-SVE-build-with-GCC-8.3.patch b/0199-net-hns3-fix-Arm-SVE-build-with-GCC-8.3.patch deleted file mode 100644 index e7f72b9bcfd4c040faead0279d8242bce7afb1a4..0000000000000000000000000000000000000000 --- a/0199-net-hns3-fix-Arm-SVE-build-with-GCC-8.3.patch +++ /dev/null @@ -1,77 +0,0 @@ -From 54cda7e32e96a2217e39de257c2dec42bb13a272 Mon Sep 17 00:00:00 2001 -From: Chengwen Feng -Date: Mon, 28 Jun 2021 10:57:51 +0800 -Subject: [PATCH 13/26] net/hns3: fix Arm SVE build with GCC 8.3 - -If the target machine has SVE feature (e.g. '-march=armv8.2-a+sve'), -and compiler is gcc-8.3, it will fail, the error is arm_sve.h: -no such file or directory. - -The solution: -a. If RTE_HAS_SVE_ACLE defined (it means the minimum instruction set -support SVE ACLE) then compiles it. -b. Else if the compiler support SVE ACLE then compiles it. -c. Otherwise don't compile it. - -Fixes: 8c25b02b082a ("net/hns3: fix enabling SVE Rx/Tx") -Fixes: 952ebacce4f2 ("net/hns3: support SVE Rx") -Cc: stable@dpdk.org - -Signed-off-by: Chengwen Feng -Acked-by: Ruifeng Wang ---- - drivers/net/hns3/hns3_rxtx.c | 2 +- - drivers/net/hns3/meson.build | 26 ++++++++++++++++++++++---- - 2 files changed, 23 insertions(+), 5 deletions(-) - -diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c -index 51b727f..d8b79c3 100644 ---- a/drivers/net/hns3/hns3_rxtx.c -+++ b/drivers/net/hns3/hns3_rxtx.c -@@ -2811,7 +2811,7 @@ hns3_get_default_vec_support(void) - static bool - hns3_get_sve_support(void) - { --#if defined(RTE_ARCH_ARM64) && defined(__ARM_FEATURE_SVE) -+#if defined(RTE_HAS_SVE_ACLE) - if (rte_vect_get_max_simd_bitwidth() < RTE_VECT_SIMD_256) - return false; - if (rte_cpu_get_flag_enabled(RTE_CPUFLAG_SVE)) -diff --git a/drivers/net/hns3/meson.build b/drivers/net/hns3/meson.build -index 6d78c33..bf602af 100644 ---- a/drivers/net/hns3/meson.build -+++ b/drivers/net/hns3/meson.build -@@ -32,8 +32,26 @@ sources = files('hns3_cmd.c', - deps += ['hash'] - - if arch_subdir == 'arm' and dpdk_conf.get('RTE_ARCH_64') -- sources += files('hns3_rxtx_vec.c') -- if cc.get_define('__ARM_FEATURE_SVE', args: machine_args) != '' -- sources += files('hns3_rxtx_vec_sve.c') -- endif -+ sources += files('hns3_rxtx_vec.c') -+ -+ # compile SVE when: -+ # a. support SVE in minimum instruction set baseline -+ # b. it's not minimum instruction set, but compiler support -+ if dpdk_conf.has('RTE_HAS_SVE_ACLE') -+ sources += files('hns3_rxtx_vec_sve.c') -+ elif cc.has_argument('-march=armv8.2-a+sve') and cc.check_header('arm_sve.h') -+ cflags += ['-DRTE_HAS_SVE_ACLE=1'] -+ sve_cflags = [] -+ foreach flag: cflags -+ if not (flag.startswith('-march=') or flag.startswith('-mcpu=') or flag.startswith('-mtune=')) -+ sve_cflags += flag -+ endif -+ endforeach -+ hns3_sve_lib = static_library('hns3_sve_lib', -+ 'hns3_rxtx_vec_sve.c', -+ dependencies: [static_rte_ethdev], -+ include_directories: includes, -+ c_args: [sve_cflags, '-march=armv8.2-a+sve']) -+ objs += hns3_sve_lib.extract_objects('hns3_rxtx_vec_sve.c') -+ endif - endif --- -2.7.4 - diff --git a/0200-app-testpmd-fix-GENEVE-parsing-in-checksum-mode.patch b/0200-app-testpmd-fix-GENEVE-parsing-in-checksum-mode.patch new file mode 100644 index 0000000000000000000000000000000000000000..60512e6354a5be1d5f7fc7fc411b8558aff094ff --- /dev/null +++ b/0200-app-testpmd-fix-GENEVE-parsing-in-checksum-mode.patch @@ -0,0 +1,83 @@ +From ecfa2e7054530f4a1eb9118a30a9bc6439b29bd8 Mon Sep 17 00:00:00 2001 +From: Raja Zidane +Date: Tue, 15 Nov 2022 12:06:11 +0800 +Subject: app/testpmd: fix GENEVE parsing in checksum mode + +[ upstream commit 993677affe391be8bb390c2625bc3d8bb857f0a5 ] + +The csum FWD mode parses any received packet to set mbuf offloads for +the transmitting burst, mainly in the checksum/TSO areas. +In the case of a tunnel header, the csum FWD tries to detect known +tunnels by the standard definition using the header's data and fallback +to check the packet type in the mbuf to see if the Rx port driver +already sign the packet as a tunnel. +In the fallback case, the csum assumes the tunnel is VXLAN and parses +the tunnel as VXLAN. +When the GENEVE tunnel was added to the known tunnels in csum, its +parsing trial was wrongly located after the pkt type detection, causing +the csum to parse the GENEVE header as VXLAN when the Rx port set the +tunnel packet type. + +Remove the fall back case to VXLAN. +Log error of unrecognized tunnel if no tunnel was parsed successfully. + +Fixes: c10a026c3b03 ("app/testpmd: introduce vxlan parsing function in csum fwd engine") +Cc: stable@dpdk.org + +Signed-off-by: Raja Zidane +Acked-by: Aman Singh +Acked-by: Ferruh Yigit +--- + app/test-pmd/csumonly.c | 15 +++++++++------ + 1 file changed, 9 insertions(+), 6 deletions(-) + +diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c +index d8cb8c89aa..7c4c04be26 100644 +--- a/app/test-pmd/csumonly.c ++++ b/app/test-pmd/csumonly.c +@@ -257,8 +257,7 @@ parse_gtp(struct rte_udp_hdr *udp_hdr, + /* Parse a vxlan header */ + static void + parse_vxlan(struct rte_udp_hdr *udp_hdr, +- struct testpmd_offload_info *info, +- uint32_t pkt_type) ++ struct testpmd_offload_info *info) + { + struct rte_ether_hdr *eth_hdr; + +@@ -266,8 +265,7 @@ parse_vxlan(struct rte_udp_hdr *udp_hdr, + * default vxlan port (rfc7348) or that the rx offload flag is set + * (i40e only currently) + */ +- if (udp_hdr->dst_port != _htons(RTE_VXLAN_DEFAULT_PORT) && +- RTE_ETH_IS_TUNNEL_PKT(pkt_type) == 0) ++ if (udp_hdr->dst_port != _htons(RTE_VXLAN_DEFAULT_PORT)) + return; + + update_tunnel_outer(info); +@@ -914,8 +912,7 @@ pkt_burst_checksum_forward(struct fwd_stream *fs) + RTE_MBUF_F_TX_TUNNEL_VXLAN_GPE; + goto tunnel_update; + } +- parse_vxlan(udp_hdr, &info, +- m->packet_type); ++ parse_vxlan(udp_hdr, &info); + if (info.is_tunnel) { + tx_ol_flags |= + RTE_MBUF_F_TX_TUNNEL_VXLAN; +@@ -927,6 +924,12 @@ pkt_burst_checksum_forward(struct fwd_stream *fs) + RTE_MBUF_F_TX_TUNNEL_GENEVE; + goto tunnel_update; + } ++ /* Always keep last. */ ++ if (unlikely(RTE_ETH_IS_TUNNEL_PKT( ++ m->packet_type) != 0)) { ++ TESTPMD_LOG(DEBUG, "Unknown tunnel packet. UDP dst port: %hu", ++ udp_hdr->dst_port); ++ } + } else if (info.l4_proto == IPPROTO_GRE) { + struct simple_gre_hdr *gre_hdr; + +-- +2.23.0 + diff --git a/0200-net-hns3-query-basic-info-for-VF.patch b/0200-net-hns3-query-basic-info-for-VF.patch deleted file mode 100644 index 4f7b34ee06d048fefc38cec0c781d6d525c358e4..0000000000000000000000000000000000000000 --- a/0200-net-hns3-query-basic-info-for-VF.patch +++ /dev/null @@ -1,146 +0,0 @@ -From ad113e20b6f776719d5abbb8b1635639a0998c68 Mon Sep 17 00:00:00 2001 -From: Chengchang Tang -Date: Sat, 10 Jul 2021 09:58:32 +0800 -Subject: [PATCH 14/26] net/hns3: query basic info for VF - -There are some features of VF depend on PF, so it's necessary for VF -to know whether current PF supports. Therefore, the final capability -set of VF will be composed of the capability set of hardware and the -capability set of PF. - -For compatibility reasons, the mailbox HNS3_MBX_GET_TCINFO has been -modified to obatin more basic information about the current PF, including -the communication interface version and current PF capabilities set. - -Signed-off-by: Chengchang Tang -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_ethdev.h | 1 + - drivers/net/hns3/hns3_ethdev_vf.c | 48 ++++++++++++++++++++++++--------------- - drivers/net/hns3/hns3_mbx.h | 10 +++++++- - 3 files changed, 40 insertions(+), 19 deletions(-) - -diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h -index 31379fd..0ecf812 100644 ---- a/drivers/net/hns3/hns3_ethdev.h -+++ b/drivers/net/hns3/hns3_ethdev.h -@@ -488,6 +488,7 @@ struct hns3_hw { - struct hns3_rx_missed_stats imissed_stats; - uint64_t oerror_stats; - uint32_t fw_version; -+ uint16_t pf_vf_if_version; /* version of communication interface */ - - uint16_t num_msi; - uint16_t total_tqps_num; /* total task queue pairs of this PF */ -diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c -index 2085a29..bb351be 100644 ---- a/drivers/net/hns3/hns3_ethdev_vf.c -+++ b/drivers/net/hns3/hns3_ethdev_vf.c -@@ -1409,26 +1409,38 @@ hns3vf_get_queue_depth(struct hns3_hw *hw) - } - - static int --hns3vf_get_tc_info(struct hns3_hw *hw) -+hns3vf_get_num_tc(struct hns3_hw *hw) - { -- uint8_t resp_msg; -- int ret; -+ uint8_t num_tc = 0; - uint32_t i; - -- ret = hns3_send_mbx_msg(hw, HNS3_MBX_GET_TCINFO, 0, NULL, 0, -- true, &resp_msg, sizeof(resp_msg)); -+ for (i = 0; i < HNS3_MAX_TC_NUM; i++) { -+ if (hw->hw_tc_map & BIT(i)) -+ num_tc++; -+ } -+ return num_tc; -+} -+ -+static int -+hns3vf_get_basic_info(struct hns3_hw *hw) -+{ -+ uint8_t resp_msg[HNS3_MBX_MAX_RESP_DATA_SIZE]; -+ struct hns3_basic_info *basic_info; -+ int ret; -+ -+ ret = hns3_send_mbx_msg(hw, HNS3_MBX_GET_BASIC_INFO, 0, NULL, 0, -+ true, resp_msg, sizeof(resp_msg)); - if (ret) { -- hns3_err(hw, "VF request to get TC info from PF failed %d", -- ret); -+ hns3_err(hw, "failed to get basic info from PF, ret = %d.", -+ ret); - return ret; - } - -- hw->hw_tc_map = resp_msg; -+ basic_info = (struct hns3_basic_info *)resp_msg; -+ hw->hw_tc_map = basic_info->hw_tc_map; -+ hw->num_tc = hns3vf_get_num_tc(hw); -+ hw->pf_vf_if_version = basic_info->pf_vf_if_version; - -- for (i = 0; i < HNS3_MAX_TC_NUM; i++) { -- if (hw->hw_tc_map & BIT(i)) -- hw->num_tc++; -- } - - return 0; - } -@@ -1468,6 +1480,11 @@ hns3vf_get_configuration(struct hns3_hw *hw) - - hns3vf_get_push_lsc_cap(hw); - -+ /* Get basic info from PF */ -+ ret = hns3vf_get_basic_info(hw); -+ if (ret) -+ return ret; -+ - /* Get queue configuration from PF */ - ret = hns3vf_get_queue_info(hw); - if (ret) -@@ -1483,12 +1500,7 @@ hns3vf_get_configuration(struct hns3_hw *hw) - if (ret) - return ret; - -- ret = hns3vf_get_port_base_vlan_filter_state(hw); -- if (ret) -- return ret; -- -- /* Get tc configuration from PF */ -- return hns3vf_get_tc_info(hw); -+ return hns3vf_get_port_base_vlan_filter_state(hw); - } - - static int -diff --git a/drivers/net/hns3/hns3_mbx.h b/drivers/net/hns3/hns3_mbx.h -index e84ef6d..f6482cc 100644 ---- a/drivers/net/hns3/hns3_mbx.h -+++ b/drivers/net/hns3/hns3_mbx.h -@@ -18,7 +18,7 @@ enum HNS3_MBX_OPCODE { - HNS3_MBX_API_NEGOTIATE, /* (VF -> PF) negotiate API version */ - HNS3_MBX_GET_QINFO, /* (VF -> PF) get queue config */ - HNS3_MBX_GET_QDEPTH, /* (VF -> PF) get queue depth */ -- HNS3_MBX_GET_TCINFO, /* (VF -> PF) get TC config */ -+ HNS3_MBX_GET_BASIC_INFO, /* (VF -> PF) get basic info */ - HNS3_MBX_GET_RETA, /* (VF -> PF) get RETA */ - HNS3_MBX_GET_RSS_KEY, /* (VF -> PF) get RSS key */ - HNS3_MBX_GET_MAC_ADDR, /* (VF -> PF) get MAC addr */ -@@ -47,6 +47,14 @@ enum HNS3_MBX_OPCODE { - HNS3_MBX_PUSH_LINK_STATUS = 201, /* (IMP -> PF) get port link status */ - }; - -+struct hns3_basic_info { -+ uint8_t hw_tc_map; -+ uint8_t rsv; -+ uint16_t pf_vf_if_version; -+ /* capabilities of VF dependent on PF */ -+ uint32_t caps; -+}; -+ - /* below are per-VF mac-vlan subcodes */ - enum hns3_mbx_mac_vlan_subcode { - HNS3_MBX_MAC_VLAN_UC_MODIFY = 0, /* modify UC mac addr */ --- -2.7.4 - diff --git a/0201-net-add-UDP-TCP-checksum-in-mbuf-segments.patch b/0201-net-add-UDP-TCP-checksum-in-mbuf-segments.patch new file mode 100644 index 0000000000000000000000000000000000000000..bdaa89ec2eced23143a289d240ed26df240cf603 --- /dev/null +++ b/0201-net-add-UDP-TCP-checksum-in-mbuf-segments.patch @@ -0,0 +1,239 @@ +From 179fb7a7246a835dbf3fb0449faa506214468b5f Mon Sep 17 00:00:00 2001 +From: Xiaoyun Li +Date: Tue, 15 Nov 2022 12:06:12 +0800 +Subject: net: add UDP/TCP checksum in mbuf segments + +[ upstream commit d178f693bbfe07506d6e3e23a3ce9c34ee554444 ] + +Add functions to call rte_raw_cksum_mbuf() to calculate IPv4/6 +UDP/TCP checksum in mbuf which can be over multi-segments. + +Signed-off-by: Xiaoyun Li +Acked-by: Aman Singh +Acked-by: Ferruh Yigit +Tested-by: Sunil Pai G +--- + lib/net/rte_ip.h | 186 +++++++++++++++++++++++++++++++++++++++++++++++ + 1 file changed, 186 insertions(+) + +diff --git a/lib/net/rte_ip.h b/lib/net/rte_ip.h +index c575250852..534f401d26 100644 +--- a/lib/net/rte_ip.h ++++ b/lib/net/rte_ip.h +@@ -400,6 +400,65 @@ rte_ipv4_udptcp_cksum(const struct rte_ipv4_hdr *ipv4_hdr, const void *l4_hdr) + return cksum; + } + ++/** ++ * @internal Calculate the non-complemented IPv4 L4 checksum of a packet ++ */ ++static inline uint16_t ++__rte_ipv4_udptcp_cksum_mbuf(const struct rte_mbuf *m, ++ const struct rte_ipv4_hdr *ipv4_hdr, ++ uint16_t l4_off) ++{ ++ uint16_t raw_cksum; ++ uint32_t cksum; ++ ++ if (l4_off > m->pkt_len) ++ return 0; ++ ++ if (rte_raw_cksum_mbuf(m, l4_off, m->pkt_len - l4_off, &raw_cksum)) ++ return 0; ++ ++ cksum = raw_cksum + rte_ipv4_phdr_cksum(ipv4_hdr, 0); ++ ++ cksum = ((cksum & 0xffff0000) >> 16) + (cksum & 0xffff); ++ ++ return (uint16_t)cksum; ++} ++ ++/** ++ * @warning ++ * @b EXPERIMENTAL: this API may change without prior notice. ++ * ++ * Compute the IPv4 UDP/TCP checksum of a packet. ++ * ++ * @param m ++ * The pointer to the mbuf. ++ * @param ipv4_hdr ++ * The pointer to the contiguous IPv4 header. ++ * @param l4_off ++ * The offset in bytes to start L4 checksum. ++ * @return ++ * The complemented checksum to set in the L4 header. ++ */ ++__rte_experimental ++static inline uint16_t ++rte_ipv4_udptcp_cksum_mbuf(const struct rte_mbuf *m, ++ const struct rte_ipv4_hdr *ipv4_hdr, uint16_t l4_off) ++{ ++ uint16_t cksum = __rte_ipv4_udptcp_cksum_mbuf(m, ipv4_hdr, l4_off); ++ ++ cksum = ~cksum; ++ ++ /* ++ * Per RFC 768: If the computed checksum is zero for UDP, ++ * it is transmitted as all ones ++ * (the equivalent in one's complement arithmetic). ++ */ ++ if (cksum == 0 && ipv4_hdr->next_proto_id == IPPROTO_UDP) ++ cksum = 0xffff; ++ ++ return cksum; ++} ++ + /** + * Validate the IPv4 UDP or TCP checksum. + * +@@ -426,6 +485,38 @@ rte_ipv4_udptcp_cksum_verify(const struct rte_ipv4_hdr *ipv4_hdr, + return 0; + } + ++/** ++ * @warning ++ * @b EXPERIMENTAL: this API may change without prior notice. ++ * ++ * Verify the IPv4 UDP/TCP checksum of a packet. ++ * ++ * In case of UDP, the caller must first check if udp_hdr->dgram_cksum is 0 ++ * (i.e. no checksum). ++ * ++ * @param m ++ * The pointer to the mbuf. ++ * @param ipv4_hdr ++ * The pointer to the contiguous IPv4 header. ++ * @param l4_off ++ * The offset in bytes to start L4 checksum. ++ * @return ++ * Return 0 if the checksum is correct, else -1. ++ */ ++__rte_experimental ++static inline uint16_t ++rte_ipv4_udptcp_cksum_mbuf_verify(const struct rte_mbuf *m, ++ const struct rte_ipv4_hdr *ipv4_hdr, ++ uint16_t l4_off) ++{ ++ uint16_t cksum = __rte_ipv4_udptcp_cksum_mbuf(m, ipv4_hdr, l4_off); ++ ++ if (cksum != 0xffff) ++ return -1; ++ ++ return 0; ++} ++ + /** + * IPv6 Header + */ +@@ -538,6 +629,68 @@ rte_ipv6_udptcp_cksum(const struct rte_ipv6_hdr *ipv6_hdr, const void *l4_hdr) + return cksum; + } + ++/** ++ * @internal Calculate the non-complemented IPv6 L4 checksum of a packet ++ */ ++static inline uint16_t ++__rte_ipv6_udptcp_cksum_mbuf(const struct rte_mbuf *m, ++ const struct rte_ipv6_hdr *ipv6_hdr, ++ uint16_t l4_off) ++{ ++ uint16_t raw_cksum; ++ uint32_t cksum; ++ ++ if (l4_off > m->pkt_len) ++ return 0; ++ ++ if (rte_raw_cksum_mbuf(m, l4_off, m->pkt_len - l4_off, &raw_cksum)) ++ return 0; ++ ++ cksum = raw_cksum + rte_ipv6_phdr_cksum(ipv6_hdr, 0); ++ ++ cksum = ((cksum & 0xffff0000) >> 16) + (cksum & 0xffff); ++ ++ return (uint16_t)cksum; ++} ++ ++/** ++ * @warning ++ * @b EXPERIMENTAL: this API may change without prior notice. ++ * ++ * Process the IPv6 UDP or TCP checksum of a packet. ++ * ++ * The IPv6 header must not be followed by extension headers. The layer 4 ++ * checksum must be set to 0 in the L4 header by the caller. ++ * ++ * @param m ++ * The pointer to the mbuf. ++ * @param ipv6_hdr ++ * The pointer to the contiguous IPv6 header. ++ * @param l4_off ++ * The offset in bytes to start L4 checksum. ++ * @return ++ * The complemented checksum to set in the L4 header. ++ */ ++__rte_experimental ++static inline uint16_t ++rte_ipv6_udptcp_cksum_mbuf(const struct rte_mbuf *m, ++ const struct rte_ipv6_hdr *ipv6_hdr, uint16_t l4_off) ++{ ++ uint16_t cksum = __rte_ipv6_udptcp_cksum_mbuf(m, ipv6_hdr, l4_off); ++ ++ cksum = ~cksum; ++ ++ /* ++ * Per RFC 768: If the computed checksum is zero for UDP, ++ * it is transmitted as all ones ++ * (the equivalent in one's complement arithmetic). ++ */ ++ if (cksum == 0 && ipv6_hdr->proto == IPPROTO_UDP) ++ cksum = 0xffff; ++ ++ return cksum; ++} ++ + /** + * Validate the IPv6 UDP or TCP checksum. + * +@@ -565,6 +718,39 @@ rte_ipv6_udptcp_cksum_verify(const struct rte_ipv6_hdr *ipv6_hdr, + return 0; + } + ++/** ++ * @warning ++ * @b EXPERIMENTAL: this API may change without prior notice. ++ * ++ * Validate the IPv6 UDP or TCP checksum of a packet. ++ * ++ * In case of UDP, the caller must first check if udp_hdr->dgram_cksum is 0: ++ * this is either invalid or means no checksum in some situations. See 8.1 ++ * (Upper-Layer Checksums) in RFC 8200. ++ * ++ * @param m ++ * The pointer to the mbuf. ++ * @param ipv6_hdr ++ * The pointer to the contiguous IPv6 header. ++ * @param l4_off ++ * The offset in bytes to start L4 checksum. ++ * @return ++ * Return 0 if the checksum is correct, else -1. ++ */ ++__rte_experimental ++static inline int ++rte_ipv6_udptcp_cksum_mbuf_verify(const struct rte_mbuf *m, ++ const struct rte_ipv6_hdr *ipv6_hdr, ++ uint16_t l4_off) ++{ ++ uint16_t cksum = __rte_ipv6_udptcp_cksum_mbuf(m, ipv6_hdr, l4_off); ++ ++ if (cksum != 0xffff) ++ return -1; ++ ++ return 0; ++} ++ + /** IPv6 fragment extension header. */ + #define RTE_IPV6_EHDR_MF_SHIFT 0 + #define RTE_IPV6_EHDR_MF_MASK 1 +-- +2.23.0 + diff --git a/0201-net-hns3-support-VLAN-filter-state-modify-for-VF.patch b/0201-net-hns3-support-VLAN-filter-state-modify-for-VF.patch deleted file mode 100644 index f039fda7f0fc3bfb8ca11c35c99f061ca041cdac..0000000000000000000000000000000000000000 --- a/0201-net-hns3-support-VLAN-filter-state-modify-for-VF.patch +++ /dev/null @@ -1,169 +0,0 @@ -From 7e819e49263e3195e3b04f9a6c32113a6835d76c Mon Sep 17 00:00:00 2001 -From: Chengchang Tang -Date: Sat, 10 Jul 2021 09:58:33 +0800 -Subject: [PATCH 15/26] net/hns3: support VLAN filter state modify for VF - -Since the HW limitation for VF, the VLAN filter is default enabled, and -is not allowed to be closed. Now, the limitation has been removed in -Kunpeng930 network engine, so this patch add support for VF to modify the -VLAN filter state. - -A capabilities bit is added to differentiate between different platforms -and achieve compatibility. When the VF runs on an incomatible platform or -an incompatible kernel-mode driver version is used, the VF behavior is -the same as that before. - -Signed-off-by: Chengchang Tang -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_cmd.h | 9 ++++++++ - drivers/net/hns3/hns3_ethdev.h | 4 ++++ - drivers/net/hns3/hns3_ethdev_vf.c | 48 ++++++++++++++++++++++++++++++++++++--- - drivers/net/hns3/hns3_mbx.h | 1 + - 4 files changed, 59 insertions(+), 3 deletions(-) - -diff --git a/drivers/net/hns3/hns3_cmd.h b/drivers/net/hns3/hns3_cmd.h -index cd58303..780ab0f 100644 ---- a/drivers/net/hns3/hns3_cmd.h -+++ b/drivers/net/hns3/hns3_cmd.h -@@ -325,6 +325,15 @@ enum HNS3_CAPS_BITS { - HNS3_CAPS_TM_B = 17, - }; - -+/* Capabilities of VF dependent on the PF */ -+enum HNS3VF_CAPS_BITS { -+ /* -+ * The following capability index definitions must be the same as those -+ * in kernel side PF. -+ */ -+ HNS3VF_CAPS_VLAN_FLT_MOD_B = 0, -+}; -+ - enum HNS3_API_CAP_BITS { - HNS3_API_CAP_FLEX_RSS_TBL_B, - }; -diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h -index 0ecf812..9a59483 100644 ---- a/drivers/net/hns3/hns3_ethdev.h -+++ b/drivers/net/hns3/hns3_ethdev.h -@@ -870,6 +870,7 @@ enum { - HNS3_DEV_SUPPORT_OUTER_UDP_CKSUM_B, - HNS3_DEV_SUPPORT_RAS_IMP_B, - HNS3_DEV_SUPPORT_TM_B, -+ HNS3_DEV_SUPPORT_VF_VLAN_FLT_MOD_B, - }; - - #define hns3_dev_dcb_supported(hw) \ -@@ -909,6 +910,9 @@ enum { - #define hns3_dev_tm_supported(hw) \ - hns3_get_bit((hw)->capability, HNS3_DEV_SUPPORT_TM_B) - -+#define hns3_dev_vf_vlan_flt_supported(hw) \ -+ hns3_get_bit((hw)->capability, HNS3_DEV_SUPPORT_VF_VLAN_FLT_MOD_B) -+ - #define HNS3_DEV_PRIVATE_TO_HW(adapter) \ - (&((struct hns3_adapter *)adapter)->hw) - #define HNS3_DEV_PRIVATE_TO_PF(adapter) \ -diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c -index bb351be..b62b059 100644 ---- a/drivers/net/hns3/hns3_ethdev_vf.c -+++ b/drivers/net/hns3/hns3_ethdev_vf.c -@@ -1408,6 +1408,14 @@ hns3vf_get_queue_depth(struct hns3_hw *hw) - return 0; - } - -+static void -+hns3vf_update_caps(struct hns3_hw *hw, uint32_t caps) -+{ -+ if (hns3_get_bit(caps, HNS3VF_CAPS_VLAN_FLT_MOD_B)) -+ hns3_set_bit(hw->capability, -+ HNS3_DEV_SUPPORT_VF_VLAN_FLT_MOD_B, 1); -+} -+ - static int - hns3vf_get_num_tc(struct hns3_hw *hw) - { -@@ -1440,7 +1448,7 @@ hns3vf_get_basic_info(struct hns3_hw *hw) - hw->hw_tc_map = basic_info->hw_tc_map; - hw->num_tc = hns3vf_get_num_tc(hw); - hw->pf_vf_if_version = basic_info->pf_vf_if_version; -- -+ hns3vf_update_caps(hw, basic_info->caps); - - return 0; - } -@@ -1611,6 +1619,26 @@ hns3vf_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on) - } - - static int -+hns3vf_en_vlan_filter(struct hns3_hw *hw, bool enable) -+{ -+ uint8_t msg_data; -+ int ret; -+ -+ if (!hns3_dev_vf_vlan_flt_supported(hw)) -+ return 0; -+ -+ msg_data = enable ? 1 : 0; -+ ret = hns3_send_mbx_msg(hw, HNS3_MBX_SET_VLAN, -+ HNS3_MBX_ENABLE_VLAN_FILTER, &msg_data, -+ sizeof(msg_data), true, NULL, 0); -+ if (ret) -+ hns3_err(hw, "%s vlan filter failed, ret = %d.", -+ enable ? "enable" : "disable", ret); -+ -+ return ret; -+} -+ -+static int - hns3vf_en_hw_strip_rxvtag(struct hns3_hw *hw, bool enable) - { - uint8_t msg_data; -@@ -1641,6 +1669,19 @@ hns3vf_vlan_offload_set(struct rte_eth_dev *dev, int mask) - } - - tmp_mask = (unsigned int)mask; -+ -+ if (tmp_mask & ETH_VLAN_FILTER_MASK) { -+ rte_spinlock_lock(&hw->lock); -+ /* Enable or disable VLAN filter */ -+ if (dev_conf->rxmode.offloads & DEV_RX_OFFLOAD_VLAN_FILTER) -+ ret = hns3vf_en_vlan_filter(hw, true); -+ else -+ ret = hns3vf_en_vlan_filter(hw, false); -+ rte_spinlock_unlock(&hw->lock); -+ if (ret) -+ return ret; -+ } -+ - /* Vlan stripping setting */ - if (tmp_mask & ETH_VLAN_STRIP_MASK) { - rte_spinlock_lock(&hw->lock); -@@ -1738,9 +1779,10 @@ hns3vf_dev_configure_vlan(struct rte_eth_dev *dev) - } - - /* Apply vlan offload setting */ -- ret = hns3vf_vlan_offload_set(dev, ETH_VLAN_STRIP_MASK); -+ ret = hns3vf_vlan_offload_set(dev, ETH_VLAN_STRIP_MASK | -+ ETH_VLAN_FILTER_MASK); - if (ret) -- hns3_err(hw, "dev config vlan offload failed, ret =%d", ret); -+ hns3_err(hw, "dev config vlan offload failed, ret = %d.", ret); - - return ret; - } -diff --git a/drivers/net/hns3/hns3_mbx.h b/drivers/net/hns3/hns3_mbx.h -index f6482cc..2154c04 100644 ---- a/drivers/net/hns3/hns3_mbx.h -+++ b/drivers/net/hns3/hns3_mbx.h -@@ -71,6 +71,7 @@ enum hns3_mbx_vlan_cfg_subcode { - HNS3_MBX_VLAN_TX_OFF_CFG, /* set tx side vlan offload */ - HNS3_MBX_VLAN_RX_OFF_CFG, /* set rx side vlan offload */ - HNS3_MBX_GET_PORT_BASE_VLAN_STATE = 4, /* get port based vlan state */ -+ HNS3_MBX_ENABLE_VLAN_FILTER, /* set vlan filter state */ - }; - - enum hns3_mbx_tbl_cfg_subcode { --- -2.7.4 - diff --git a/0202-app-testpmd-add-SW-L4-checksum-in-multi-segments.patch b/0202-app-testpmd-add-SW-L4-checksum-in-multi-segments.patch new file mode 100644 index 0000000000000000000000000000000000000000..dcbe38ebd87b0028877dcae6085a51dfd0199525 --- /dev/null +++ b/0202-app-testpmd-add-SW-L4-checksum-in-multi-segments.patch @@ -0,0 +1,137 @@ +From 2f89f906acfed6fe476f84875bbe1f2c53b8f31a Mon Sep 17 00:00:00 2001 +From: Xiaoyun Li +Date: Tue, 15 Nov 2022 12:06:13 +0800 +Subject: app/testpmd: add SW L4 checksum in multi-segments + +[ upstream commit e6b9d6411e91be7289409238f05ad1c09e8a0d05 ] + +Csum forwarding mode only supports software UDP/TCP csum calculation +for single segment packets when hardware offload is not enabled. +This patch enables software UDP/TCP csum calculation over multiple +segments. + +Signed-off-by: Xiaoyun Li +Tested-by: Sunil Pai G +Acked-by: Ferruh Yigit +--- + app/test-pmd/csumonly.c | 41 ++++++++++++++++++++++++++--------------- + 1 file changed, 26 insertions(+), 15 deletions(-) + +diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c +index 7c4c04be26..10aab3431b 100644 +--- a/app/test-pmd/csumonly.c ++++ b/app/test-pmd/csumonly.c +@@ -96,12 +96,13 @@ struct simple_gre_hdr { + } __rte_packed; + + static uint16_t +-get_udptcp_checksum(void *l3_hdr, void *l4_hdr, uint16_t ethertype) ++get_udptcp_checksum(struct rte_mbuf *m, void *l3_hdr, uint16_t l4_off, ++ uint16_t ethertype) + { + if (ethertype == _htons(RTE_ETHER_TYPE_IPV4)) +- return rte_ipv4_udptcp_cksum(l3_hdr, l4_hdr); ++ return rte_ipv4_udptcp_cksum_mbuf(m, l3_hdr, l4_off); + else /* assume ethertype == RTE_ETHER_TYPE_IPV6 */ +- return rte_ipv6_udptcp_cksum(l3_hdr, l4_hdr); ++ return rte_ipv6_udptcp_cksum_mbuf(m, l3_hdr, l4_off); + } + + /* Parse an IPv4 header to fill l3_len, l4_len, and l4_proto */ +@@ -458,7 +459,7 @@ parse_encap_ip(void *encap_ip, struct testpmd_offload_info *info) + * depending on the testpmd command line configuration */ + static uint64_t + process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info, +- uint64_t tx_offloads) ++ uint64_t tx_offloads, struct rte_mbuf *m) + { + struct rte_ipv4_hdr *ipv4_hdr = l3_hdr; + struct rte_udp_hdr *udp_hdr; +@@ -466,6 +467,7 @@ process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info, + struct rte_sctp_hdr *sctp_hdr; + uint64_t ol_flags = 0; + uint32_t max_pkt_len, tso_segsz = 0; ++ uint16_t l4_off; + + /* ensure packet is large enough to require tso */ + if (!info->is_tunnel) { +@@ -508,9 +510,15 @@ process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info, + if (tx_offloads & RTE_ETH_TX_OFFLOAD_UDP_CKSUM) { + ol_flags |= RTE_MBUF_F_TX_UDP_CKSUM; + } else { ++ if (info->is_tunnel) ++ l4_off = info->l2_len + ++ info->outer_l3_len + ++ info->l2_len + info->l3_len; ++ else ++ l4_off = info->l2_len + info->l3_len; + udp_hdr->dgram_cksum = 0; + udp_hdr->dgram_cksum = +- get_udptcp_checksum(l3_hdr, udp_hdr, ++ get_udptcp_checksum(m, l3_hdr, l4_off, + info->ethertype); + } + } +@@ -525,9 +533,14 @@ process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info, + else if (tx_offloads & RTE_ETH_TX_OFFLOAD_TCP_CKSUM) { + ol_flags |= RTE_MBUF_F_TX_TCP_CKSUM; + } else { ++ if (info->is_tunnel) ++ l4_off = info->l2_len + info->outer_l3_len + ++ info->l2_len + info->l3_len; ++ else ++ l4_off = info->l2_len + info->l3_len; + tcp_hdr->cksum = 0; + tcp_hdr->cksum = +- get_udptcp_checksum(l3_hdr, tcp_hdr, ++ get_udptcp_checksum(m, l3_hdr, l4_off, + info->ethertype); + } + #ifdef RTE_LIB_GSO +@@ -555,7 +568,7 @@ process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info, + /* Calculate the checksum of outer header */ + static uint64_t + process_outer_cksums(void *outer_l3_hdr, struct testpmd_offload_info *info, +- uint64_t tx_offloads, int tso_enabled) ++ uint64_t tx_offloads, int tso_enabled, struct rte_mbuf *m) + { + struct rte_ipv4_hdr *ipv4_hdr = outer_l3_hdr; + struct rte_ipv6_hdr *ipv6_hdr = outer_l3_hdr; +@@ -609,12 +622,9 @@ process_outer_cksums(void *outer_l3_hdr, struct testpmd_offload_info *info, + /* do not recalculate udp cksum if it was 0 */ + if (udp_hdr->dgram_cksum != 0) { + udp_hdr->dgram_cksum = 0; +- if (info->outer_ethertype == _htons(RTE_ETHER_TYPE_IPV4)) +- udp_hdr->dgram_cksum = +- rte_ipv4_udptcp_cksum(ipv4_hdr, udp_hdr); +- else +- udp_hdr->dgram_cksum = +- rte_ipv6_udptcp_cksum(ipv6_hdr, udp_hdr); ++ udp_hdr->dgram_cksum = get_udptcp_checksum(m, outer_l3_hdr, ++ info->l2_len + info->outer_l3_len, ++ info->outer_ethertype); + } + + return ol_flags; +@@ -962,7 +972,7 @@ pkt_burst_checksum_forward(struct fwd_stream *fs) + + /* process checksums of inner headers first */ + tx_ol_flags |= process_inner_cksums(l3_hdr, &info, +- tx_offloads); ++ tx_offloads, m); + + /* Then process outer headers if any. Note that the software + * checksum will be wrong if one of the inner checksums is +@@ -970,7 +980,8 @@ pkt_burst_checksum_forward(struct fwd_stream *fs) + if (info.is_tunnel == 1) { + tx_ol_flags |= process_outer_cksums(outer_l3_hdr, &info, + tx_offloads, +- !!(tx_ol_flags & RTE_MBUF_F_TX_TCP_SEG)); ++ !!(tx_ol_flags & RTE_MBUF_F_TX_TCP_SEG), ++ m); + } + + /* step 3: fill the mbuf meta data (flags and header lengths) */ +-- +2.23.0 + diff --git a/0202-net-hns3-support-multiple-TC-MAC-pause.patch b/0202-net-hns3-support-multiple-TC-MAC-pause.patch deleted file mode 100644 index 3eea474343b6210aa6c4be181c946d4defecff3c..0000000000000000000000000000000000000000 --- a/0202-net-hns3-support-multiple-TC-MAC-pause.patch +++ /dev/null @@ -1,69 +0,0 @@ -From ec5421783ce5243f8bbad0f28db3d05e31e000d8 Mon Sep 17 00:00:00 2001 -From: Huisong Li -Date: Sat, 10 Jul 2021 09:58:34 +0800 -Subject: [PATCH 16/26] net/hns3: support multiple TC MAC pause - -MAC PAUSE can take effect on a single TC or multiple TCs, depending on the -hardware. For example, the Kunpeng 920 supports MAC pause in a single TC, -and the Kunpeng 930 supports MAC pause in multiple TCs. This patch -supports MAC PAUSE in multiple TC for some hardware. - -Signed-off-by: Huisong Li -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_ethdev.c | 5 ++++- - drivers/net/hns3/hns3_ethdev.h | 1 + - 2 files changed, 5 insertions(+), 1 deletion(-) - -diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c -index 7283364..b2ee831 100644 ---- a/drivers/net/hns3/hns3_ethdev.c -+++ b/drivers/net/hns3/hns3_ethdev.c -@@ -3314,6 +3314,7 @@ hns3_get_capability(struct hns3_hw *hw) - pf->tqp_config_mode = HNS3_FIXED_MAX_TQP_NUM_MODE; - hw->rss_info.ipv6_sctp_offload_supported = false; - hw->udp_cksum_mode = HNS3_SPECIAL_PORT_SW_CKSUM_MODE; -+ pf->support_multi_tc_pause = false; - return 0; - } - -@@ -3334,6 +3335,7 @@ hns3_get_capability(struct hns3_hw *hw) - pf->tqp_config_mode = HNS3_FLEX_MAX_TQP_NUM_MODE; - hw->rss_info.ipv6_sctp_offload_supported = true; - hw->udp_cksum_mode = HNS3_SPECIAL_PORT_HW_CKSUM_MODE; -+ pf->support_multi_tc_pause = true; - - return 0; - } -@@ -6100,6 +6102,7 @@ static int - hns3_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf) - { - struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private); -+ struct hns3_pf *pf = HNS3_DEV_PRIVATE_TO_PF(dev->data->dev_private); - int ret; - - if (fc_conf->high_water || fc_conf->low_water || -@@ -6129,7 +6132,7 @@ hns3_flow_ctrl_set(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf) - return -EOPNOTSUPP; - } - -- if (hw->num_tc > 1) { -+ if (hw->num_tc > 1 && !pf->support_multi_tc_pause) { - hns3_err(hw, "in multi-TC scenarios, MAC pause is not supported."); - return -EOPNOTSUPP; - } -diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h -index 9a59483..bdad384 100644 ---- a/drivers/net/hns3/hns3_ethdev.h -+++ b/drivers/net/hns3/hns3_ethdev.h -@@ -783,6 +783,7 @@ struct hns3_pf { - uint8_t prio_tc[HNS3_MAX_USER_PRIO]; /* TC indexed by prio */ - uint16_t pause_time; - bool support_fc_autoneg; /* support FC autonegotiate */ -+ bool support_multi_tc_pause; - - uint16_t wanted_umv_size; - uint16_t max_umv_size; --- -2.7.4 - diff --git a/0203-app-testpmd-fix-L4-checksum-in-multi-segments.patch b/0203-app-testpmd-fix-L4-checksum-in-multi-segments.patch new file mode 100644 index 0000000000000000000000000000000000000000..2640687575eb372665c0fc5d9b691b3e4e1a68eb --- /dev/null +++ b/0203-app-testpmd-fix-L4-checksum-in-multi-segments.patch @@ -0,0 +1,59 @@ +From e6b89f7ed49494302ef1e9cd852281c808f5b14f Mon Sep 17 00:00:00 2001 +From: Kevin Liu +Date: Tue, 15 Nov 2022 12:06:14 +0800 +Subject: app/testpmd: fix L4 checksum in multi-segments + +[ upstream commit 7dc92d17298d8fd05a912606f02a094566ec0b3f ] + +Testpmd forwards packets in checksum mode that it needs to calculate +the checksum of each layer's protocol. + +In process_inner_cksums, when parsing tunnel packets, inner L4 offset +should be outer_l2_len + outer_l3_len + l2_len + l3_len. + +In process_outer_cksums, when parsing tunnel packets, outer L4 offset +should be outer_l2_len + outer_l3_len. + +Fixes: e6b9d6411e91 ("app/testpmd: add SW L4 checksum in multi-segments") + +Signed-off-by: Kevin Liu +Acked-by: Yuying Zhang +Acked-by: Aman Singh +--- + app/test-pmd/csumonly.c | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c +index 10aab3431b..47856dd70a 100644 +--- a/app/test-pmd/csumonly.c ++++ b/app/test-pmd/csumonly.c +@@ -511,7 +511,7 @@ process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info, + ol_flags |= RTE_MBUF_F_TX_UDP_CKSUM; + } else { + if (info->is_tunnel) +- l4_off = info->l2_len + ++ l4_off = info->outer_l2_len + + info->outer_l3_len + + info->l2_len + info->l3_len; + else +@@ -534,7 +534,7 @@ process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info, + ol_flags |= RTE_MBUF_F_TX_TCP_CKSUM; + } else { + if (info->is_tunnel) +- l4_off = info->l2_len + info->outer_l3_len + ++ l4_off = info->outer_l2_len + info->outer_l3_len + + info->l2_len + info->l3_len; + else + l4_off = info->l2_len + info->l3_len; +@@ -623,7 +623,7 @@ process_outer_cksums(void *outer_l3_hdr, struct testpmd_offload_info *info, + if (udp_hdr->dgram_cksum != 0) { + udp_hdr->dgram_cksum = 0; + udp_hdr->dgram_cksum = get_udptcp_checksum(m, outer_l3_hdr, +- info->l2_len + info->outer_l3_len, ++ info->outer_l2_len + info->outer_l3_len, + info->outer_ethertype); + } + +-- +2.23.0 + diff --git a/0203-net-hns3-fix-residual-MAC-address-entry.patch b/0203-net-hns3-fix-residual-MAC-address-entry.patch deleted file mode 100644 index f5a336a484c1ac5abbc64523e5e3982b5e371207..0000000000000000000000000000000000000000 --- a/0203-net-hns3-fix-residual-MAC-address-entry.patch +++ /dev/null @@ -1,74 +0,0 @@ -From 203d961619952ef99fda300b73c3a3c1edd725d3 Mon Sep 17 00:00:00 2001 -From: Chengchang Tang -Date: Sat, 17 Jul 2021 10:02:49 +0800 -Subject: [PATCH 17/26] net/hns3: fix residual MAC address entry - -Currently, even if we fail to remove the origin MAC address from the HW, -the set_default_mac will go on, and add the new MAC address to the HW. -Eventually cause the original MAC address entry to remain in the HW, and -users may receive unexpected packets. - -This patch make set_default_mac return directly to failure if deleting -the original MAC address fails, simplifying the behavior of the driver -and solving the problem of residual MAC address entry. - -Fixes: 7d7f9f80bbfb ("net/hns3: support MAC address related operations") -Cc: stable@dpdk.org - -Signed-off-by: Chengchang Tang -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_ethdev.c | 22 +++++++++------------- - 1 file changed, 9 insertions(+), 13 deletions(-) - -diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c -index b2ee831..ce7aa95 100644 ---- a/drivers/net/hns3/hns3_ethdev.c -+++ b/drivers/net/hns3/hns3_ethdev.c -@@ -1748,7 +1748,6 @@ hns3_set_default_mac_addr(struct rte_eth_dev *dev, - struct rte_ether_addr *oaddr; - char mac_str[RTE_ETHER_ADDR_FMT_SIZE]; - bool default_addr_setted; -- bool rm_succes = false; - int ret, ret_val; - - /* -@@ -1768,9 +1767,10 @@ hns3_set_default_mac_addr(struct rte_eth_dev *dev, - oaddr); - hns3_warn(hw, "Remove old uc mac address(%s) fail: %d", - mac_str, ret); -- rm_succes = false; -- } else -- rm_succes = true; -+ -+ rte_spinlock_unlock(&hw->lock); -+ return ret; -+ } - } - - ret = hns3_add_uc_addr_common(hw, mac_addr); -@@ -1805,16 +1805,12 @@ hns3_set_default_mac_addr(struct rte_eth_dev *dev, - } - - err_add_uc_addr: -- if (rm_succes) { -- ret_val = hns3_add_uc_addr_common(hw, oaddr); -- if (ret_val) { -- hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE, -- oaddr); -- hns3_warn(hw, -- "Failed to restore old uc mac addr(%s): %d", -+ ret_val = hns3_add_uc_addr_common(hw, oaddr); -+ if (ret_val) { -+ hns3_ether_format_addr(mac_str, RTE_ETHER_ADDR_FMT_SIZE, oaddr); -+ hns3_warn(hw, "Failed to restore old uc mac addr(%s): %d", - mac_str, ret_val); -- hw->mac.default_addr_setted = false; -- } -+ hw->mac.default_addr_setted = false; - } - rte_spinlock_unlock(&hw->lock); - --- -2.7.4 - diff --git a/0204-net-bonding-fix-mbuf-fast-free-handling.patch b/0204-net-bonding-fix-mbuf-fast-free-handling.patch new file mode 100644 index 0000000000000000000000000000000000000000..73b5613420c011d57e2cb7003416323cb06b4c8b --- /dev/null +++ b/0204-net-bonding-fix-mbuf-fast-free-handling.patch @@ -0,0 +1,73 @@ +From c90a36013ccaeeb3baf258e4e23120253faee7aa Mon Sep 17 00:00:00 2001 +From: Huisong Li +Date: Tue, 15 Nov 2022 12:06:15 +0800 +Subject: net/bonding: fix mbuf fast free handling + +[ upstream commit b4924c0db589b5d4698abfab3ce60978d9df518b ] + +The RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE offload can't be used in bonding +mode Broadcast and mode 8023AD. Currently, bonding driver forcibly removes +from the dev->data->dev_conf.txmode.offloads and processes as success in +bond_ethdev_configure(). But this still cause that rte_eth_dev_configure() +fails to execute because of the failure of validating Tx offload in the +eth_dev_validate_offloads(). So this patch moves the modification of txmode +offlaods to the stage of adding slave device to report the correct txmode +offloads. + +Fixes: 18c41457cbae ("net/bonding: fix mbuf fast free usage") + +Signed-off-by: Huisong Li +Acked-by: Stephen Hemminger +--- + drivers/net/bonding/rte_eth_bond_api.c | 5 +++++ + drivers/net/bonding/rte_eth_bond_pmd.c | 11 ----------- + 2 files changed, 5 insertions(+), 11 deletions(-) + +diff --git a/drivers/net/bonding/rte_eth_bond_api.c b/drivers/net/bonding/rte_eth_bond_api.c +index b74477128a..1235573bf2 100644 +--- a/drivers/net/bonding/rte_eth_bond_api.c ++++ b/drivers/net/bonding/rte_eth_bond_api.c +@@ -544,6 +544,11 @@ __eth_bond_slave_add_lock_free(uint16_t bonded_port_id, uint16_t slave_port_id) + return ret; + } + ++ /* Bond mode Broadcast & 8023AD don't support MBUF_FAST_FREE offload. */ ++ if (internals->mode == BONDING_MODE_8023AD || ++ internals->mode == BONDING_MODE_BROADCAST) ++ internals->tx_offload_capa &= ~RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE; ++ + bonded_eth_dev->data->dev_conf.rx_adv_conf.rss_conf.rss_hf &= + internals->flow_type_rss_offloads; + +diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c +index 2bf28b829d..29871cf8a3 100644 +--- a/drivers/net/bonding/rte_eth_bond_pmd.c ++++ b/drivers/net/bonding/rte_eth_bond_pmd.c +@@ -3600,7 +3600,6 @@ bond_ethdev_configure(struct rte_eth_dev *dev) + const char *name = dev->device->name; + struct bond_dev_private *internals = dev->data->dev_private; + struct rte_kvargs *kvlist = internals->kvlist; +- uint64_t offloads; + int arg_count; + uint16_t port_id = dev - rte_eth_devices; + uint32_t link_speeds; +@@ -3652,16 +3651,6 @@ bond_ethdev_configure(struct rte_eth_dev *dev) + } + } + +- offloads = dev->data->dev_conf.txmode.offloads; +- if ((offloads & RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE) && +- (internals->mode == BONDING_MODE_8023AD || +- internals->mode == BONDING_MODE_BROADCAST)) { +- RTE_BOND_LOG(WARNING, +- "bond mode broadcast & 8023AD don't support MBUF_FAST_FREE offload, force disable it."); +- offloads &= ~RTE_ETH_TX_OFFLOAD_MBUF_FAST_FREE; +- dev->data->dev_conf.txmode.offloads = offloads; +- } +- + link_speeds = dev->data->dev_conf.link_speeds; + /* + * The default value of 'link_speeds' is zero. From its definition, +-- +2.23.0 + diff --git a/0204-net-hns3-remove-unnecessary-zero-assignments.patch b/0204-net-hns3-remove-unnecessary-zero-assignments.patch deleted file mode 100644 index cc2086dd396a13ff74be7f40e9a2388603342c7e..0000000000000000000000000000000000000000 --- a/0204-net-hns3-remove-unnecessary-zero-assignments.patch +++ /dev/null @@ -1,58 +0,0 @@ -From 679b37031b1e747b5e03bdd74cd18cd885cb1f9e Mon Sep 17 00:00:00 2001 -From: Chengwen Feng -Date: Sat, 17 Jul 2021 10:02:50 +0800 -Subject: [PATCH 18/26] net/hns3: remove unnecessary zero assignments - -The output parameter 'cap' was cleared at the function entry, the -latter zero assignment 'cap' fields was unnecessary, so delete them. - -Fixes: c09c7847d892 ("net/hns3: support traffic management") -Cc: stable@dpdk.org - -Signed-off-by: Chengwen Feng -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_tm.c | 18 ------------------ - 1 file changed, 18 deletions(-) - -diff --git a/drivers/net/hns3/hns3_tm.c b/drivers/net/hns3/hns3_tm.c -index 81c61ad..cd32664 100644 ---- a/drivers/net/hns3/hns3_tm.c -+++ b/drivers/net/hns3/hns3_tm.c -@@ -134,33 +134,15 @@ hns3_tm_capabilities_get(struct rte_eth_dev *dev, - cap->leaf_nodes_identical = 1; - cap->shaper_n_max = 1 + HNS3_MAX_TC_NUM; - cap->shaper_private_n_max = 1 + HNS3_MAX_TC_NUM; -- cap->shaper_private_dual_rate_n_max = 0; -- cap->shaper_private_rate_min = 0; - cap->shaper_private_rate_max = - hns3_tm_rate_convert_firmware2tm(hw->max_tm_rate); -- cap->shaper_shared_n_max = 0; -- cap->shaper_shared_n_nodes_per_shaper_max = 0; -- cap->shaper_shared_n_shapers_per_node_max = 0; -- cap->shaper_shared_dual_rate_n_max = 0; -- cap->shaper_shared_rate_min = 0; -- cap->shaper_shared_rate_max = 0; - - cap->sched_n_children_max = max_tx_queues; - cap->sched_sp_n_priorities_max = 1; -- cap->sched_wfq_n_children_per_group_max = 0; -- cap->sched_wfq_n_groups_max = 0; - cap->sched_wfq_weight_max = 1; - -- cap->cman_head_drop_supported = 0; -- cap->dynamic_update_mask = 0; - cap->shaper_pkt_length_adjust_min = RTE_TM_ETH_FRAMING_OVERHEAD; - cap->shaper_pkt_length_adjust_max = RTE_TM_ETH_FRAMING_OVERHEAD_FCS; -- cap->cman_wred_context_n_max = 0; -- cap->cman_wred_context_private_n_max = 0; -- cap->cman_wred_context_shared_n_max = 0; -- cap->cman_wred_context_shared_n_nodes_per_context_max = 0; -- cap->cman_wred_context_shared_n_contexts_per_node_max = 0; -- cap->stats_mask = 0; - - return 0; - } --- -2.7.4 - diff --git a/0205-doc-fix-application-name-in-procinfo-guide.patch b/0205-doc-fix-application-name-in-procinfo-guide.patch new file mode 100644 index 0000000000000000000000000000000000000000..a7336894d040a0359db411a74f57a75f4266d78d --- /dev/null +++ b/0205-doc-fix-application-name-in-procinfo-guide.patch @@ -0,0 +1,71 @@ +From 3ebc362fe3f70616922d46f3959c1e6d63cf76dc Mon Sep 17 00:00:00 2001 +From: Dongdong Liu +Date: Tue, 11 Oct 2022 19:18:43 +0800 +Subject: doc: fix application name in procinfo guide + +[ upstream commit 2a65f12f6ab461e2cb81192c6bdd136191c82ea9 ] + +In commit 996ef1176111 ("app: add all remaining apps to meson build"), +building the procinfo application through Meson has been done with a +binary name different from the previous Makefile build system [1]. + +When we dropped Makefile support, the documentation was not updated. + +Fixes: 3cc6ecfdfe85 ("build: remove makefiles") +Cc: stable@dpdk.org + +Signed-off-by: Dongdong Liu +Signed-off-by: David Marchand +--- + doc/guides/tools/proc_info.rst | 16 ++++++++-------- + 1 file changed, 8 insertions(+), 8 deletions(-) + +diff --git a/doc/guides/tools/proc_info.rst b/doc/guides/tools/proc_info.rst +index 9772d97ef0..e4f0c83f1b 100644 +--- a/doc/guides/tools/proc_info.rst ++++ b/doc/guides/tools/proc_info.rst +@@ -1,10 +1,10 @@ + .. SPDX-License-Identifier: BSD-3-Clause + Copyright(c) 2015 Intel Corporation. + +-dpdk-procinfo Application +-========================= ++dpdk-proc-info Application ++========================== + +-The dpdk-procinfo application is a Data Plane Development Kit (DPDK) application ++The dpdk-proc-info application is a Data Plane Development Kit (DPDK) application + that runs as a DPDK secondary process and is capable of retrieving port + statistics, resetting port statistics, printing DPDK memory information and + displaying debug information for port. +@@ -17,7 +17,7 @@ The application has a number of command line options: + + .. code-block:: console + +- .//app/dpdk-procinfo -- -m | [-p PORTMASK] [--stats | --xstats | ++ .//app/dpdk-proc-info -- -m | [-p PORTMASK] [--stats | --xstats | + --stats-reset | --xstats-reset] [ --show-port | --show-tm | --show-crypto | + --show-ring[=name] | --show-mempool[=name] | --iter-mempool=name ] + +@@ -72,14 +72,14 @@ by name. For invalid or no mempool name no elements are displayed. + Limitations + ----------- + +-* dpdk-procinfo should run alongside primary process with same DPDK version. ++* dpdk-proc-info should run alongside primary process with same DPDK version. + +-* When running ``dpdk-procinfo`` with shared library mode, it is required to ++* When running ``dpdk-proc-info`` with shared library mode, it is required to + pass the same NIC PMD libraries as used for the primary application. Any + mismatch in PMD library arguments can lead to undefined behavior and results + affecting primary application too. + +-* Stats retrieval using ``dpdk-procinfo`` is not supported for virtual devices like PCAP and TAP. ++* Stats retrieval using ``dpdk-proc-info`` is not supported for virtual devices like PCAP and TAP. + +-* Since default DPDK EAL arguments for ``dpdk-procinfo`` are ``-c1, -n4 & --proc-type=secondary``, ++* Since default DPDK EAL arguments for ``dpdk-proc-info`` are ``-c1, -n4 & --proc-type=secondary``, + It is not expected that the user passes any EAL arguments. +-- +2.23.0 + diff --git a/0205-net-hns3-fix-filter-parsing-comment.patch b/0205-net-hns3-fix-filter-parsing-comment.patch deleted file mode 100644 index c109c2a9a0d85df64022bf635b7de761a91cea5e..0000000000000000000000000000000000000000 --- a/0205-net-hns3-fix-filter-parsing-comment.patch +++ /dev/null @@ -1,89 +0,0 @@ -From 4d98ab6b259c37da13ef2ecba882b39883478b04 Mon Sep 17 00:00:00 2001 -From: Chengwen Feng -Date: Sat, 17 Jul 2021 10:02:51 +0800 -Subject: [PATCH 19/26] net/hns3: fix filter parsing comment - -This patch fixed incorrect comment of hns3_parse_fdir_filter(). - -Fixes: fcba820d9b9e ("net/hns3: support flow director") -Cc: stable@dpdk.org - -Signed-off-by: Chengwen Feng -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_flow.c | 59 +++++++++++++++++--------------------------- - 1 file changed, 23 insertions(+), 36 deletions(-) - -diff --git a/drivers/net/hns3/hns3_flow.c b/drivers/net/hns3/hns3_flow.c -index d405820..a38bb68 100644 ---- a/drivers/net/hns3/hns3_flow.c -+++ b/drivers/net/hns3/hns3_flow.c -@@ -1134,42 +1134,29 @@ is_tunnel_packet(enum rte_flow_item_type type) - } - - /* -- * Parse the rule to see if it is a IP or MAC VLAN flow director rule. -- * And get the flow director filter info BTW. -- * UDP/TCP/SCTP PATTERN: -- * The first not void item can be ETH or IPV4 or IPV6 -- * The second not void item must be IPV4 or IPV6 if the first one is ETH. -- * The next not void item could be UDP or TCP or SCTP (optional) -- * The next not void item could be RAW (for flexbyte, optional) -- * The next not void item must be END. -- * A Fuzzy Match pattern can appear at any place before END. -- * Fuzzy Match is optional for IPV4 but is required for IPV6 -- * MAC VLAN PATTERN: -- * The first not void item must be ETH. -- * The second not void item must be MAC VLAN. -- * The next not void item must be END. -- * ACTION: -- * The first not void action should be QUEUE or DROP. -- * The second not void optional action should be MARK, -- * mark_id is a uint32_t number. -- * The next not void action should be END. -- * UDP/TCP/SCTP pattern example: -- * ITEM Spec Mask -- * ETH NULL NULL -- * IPV4 src_addr 192.168.1.20 0xFFFFFFFF -- * dst_addr 192.167.3.50 0xFFFFFFFF -- * UDP/TCP/SCTP src_port 80 0xFFFF -- * dst_port 80 0xFFFF -- * END -- * MAC VLAN pattern example: -- * ITEM Spec Mask -- * ETH dst_addr -- {0xAC, 0x7B, 0xA1, {0xFF, 0xFF, 0xFF, -- 0x2C, 0x6D, 0x36} 0xFF, 0xFF, 0xFF} -- * MAC VLAN tci 0x2016 0xEFFF -- * END -- * Other members in mask and spec should set to 0x00. -- * Item->last should be NULL. -+ * Parse the flow director rule. -+ * The supported PATTERN: -+ * case: non-tunnel packet: -+ * ETH : src-mac, dst-mac, ethertype -+ * VLAN: tag1, tag2 -+ * IPv4: src-ip, dst-ip, tos, proto -+ * IPv6: src-ip(last 32 bit addr), dst-ip(last 32 bit addr), proto -+ * UDP : src-port, dst-port -+ * TCP : src-port, dst-port -+ * SCTP: src-port, dst-port, tag -+ * case: tunnel packet: -+ * OUTER-ETH: ethertype -+ * OUTER-L3 : proto -+ * OUTER-L4 : src-port, dst-port -+ * TUNNEL : vni, flow-id(only valid when NVGRE) -+ * INNER-ETH/VLAN/IPv4/IPv6/UDP/TCP/SCTP: same as non-tunnel packet -+ * The supported ACTION: -+ * QUEUE -+ * DROP -+ * COUNT -+ * MARK: the id range [0, 4094] -+ * FLAG -+ * RSS: only valid if firmware support FD_QUEUE_REGION. - */ - static int - hns3_parse_fdir_filter(struct rte_eth_dev *dev, --- -2.7.4 - diff --git a/0206-doc-document-device-dump-in-procinfo-guide.patch b/0206-doc-document-device-dump-in-procinfo-guide.patch new file mode 100644 index 0000000000000000000000000000000000000000..b0c5617271425674a1268e019e6a1edc00f87785 --- /dev/null +++ b/0206-doc-document-device-dump-in-procinfo-guide.patch @@ -0,0 +1,44 @@ +From 245e4f0da830830c6ca9b59ce9eb2f7d9ba6e0a5 Mon Sep 17 00:00:00 2001 +From: Dongdong Liu +Date: Tue, 11 Oct 2022 19:18:43 +0800 +Subject: doc: document device dump in procinfo guide + +[ upstream commit dd2658f8d0e4725f579ff098f1ee159d897d6abc ] + +The --show-port-private option was not documented. + +Fixes: bb947a7264da ("app/procinfo: dump device private info") + +Signed-off-by: Dongdong Liu +Signed-off-by: David Marchand +--- + doc/guides/tools/proc_info.rst | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +diff --git a/doc/guides/tools/proc_info.rst b/doc/guides/tools/proc_info.rst +index e4f0c83f1b..5dd6f9ecae 100644 +--- a/doc/guides/tools/proc_info.rst ++++ b/doc/guides/tools/proc_info.rst +@@ -19,7 +19,8 @@ The application has a number of command line options: + + .//app/dpdk-proc-info -- -m | [-p PORTMASK] [--stats | --xstats | + --stats-reset | --xstats-reset] [ --show-port | --show-tm | --show-crypto | +- --show-ring[=name] | --show-mempool[=name] | --iter-mempool=name ] ++ --show-ring[=name] | --show-mempool[=name] | --iter-mempool=name | ++ --show-port-private ] + + Parameters + ~~~~~~~~~~ +@@ -69,6 +70,9 @@ mempool. For invalid or no mempool name, whole list is dump. + The iter-mempool parameter iterates and displays mempool elements specified + by name. For invalid or no mempool name no elements are displayed. + ++**--show-port-private** ++The show-port-private parameter displays ports private information. ++ + Limitations + ----------- + +-- +2.23.0 + diff --git a/0206-net-hns3-fix-timing-of-clearing-interrupt-source.patch b/0206-net-hns3-fix-timing-of-clearing-interrupt-source.patch deleted file mode 100644 index 9c9ceb3052a9b885665ff56bd19c35dba55c7e33..0000000000000000000000000000000000000000 --- a/0206-net-hns3-fix-timing-of-clearing-interrupt-source.patch +++ /dev/null @@ -1,77 +0,0 @@ -From ddd874645976918320694f9095f9a3892eaf4a4c Mon Sep 17 00:00:00 2001 -From: Hongbo Zheng -Date: Sat, 17 Jul 2021 10:02:52 +0800 -Subject: [PATCH 20/26] net/hns3: fix timing of clearing interrupt source - -Currently, the PF/VF does not clear the interrupt source immediately -after receiving the interrupt. As a result, if the second interrupt -task is triggered when processing the first interrupt task, clearing -the interrupt source before exiting will clear the interrupt sources -of the two tasks at the same time. As a result, no interrupt is -triggered for the second task. - -Clearing interrupt source immediately after checking event cause -ensures that: -1. Even if two interrupt tasks are triggered at the same time, they can -be processed. -2. If the second task is triggered during the processing of the first -task and the interrupt source is not cleared, the interrupt is reported -after vector0 is enabled. - -Fixes: a5475d61fa34 ("net/hns3: support VF") -Fixes: 3988ab0eee52 ("net/hns3: add abnormal interrupt process") -Cc: stable@dpdk.org - -Signed-off-by: Hongbo Zheng -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_ethdev.c | 2 +- - drivers/net/hns3/hns3_ethdev_vf.c | 5 ++--- - 2 files changed, 3 insertions(+), 4 deletions(-) - -diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c -index ce7aa95..f658e74 100644 ---- a/drivers/net/hns3/hns3_ethdev.c -+++ b/drivers/net/hns3/hns3_ethdev.c -@@ -317,6 +317,7 @@ hns3_interrupt_handler(void *param) - vector0_int = hns3_read_dev(hw, HNS3_VECTOR0_OTHER_INT_STS_REG); - ras_int = hns3_read_dev(hw, HNS3_RAS_PF_OTHER_INT_STS_REG); - cmdq_int = hns3_read_dev(hw, HNS3_VECTOR0_CMDQ_SRC_REG); -+ hns3_clear_event_cause(hw, event_cause, clearval); - /* vector 0 interrupt is shared with reset and mailbox source events. */ - if (event_cause == HNS3_VECTOR0_EVENT_ERR) { - hns3_warn(hw, "received interrupt: vector0_int_stat:0x%x " -@@ -335,7 +336,6 @@ hns3_interrupt_handler(void *param) - vector0_int, ras_int, cmdq_int); - } - -- hns3_clear_event_cause(hw, event_cause, clearval); - /* Enable interrupt if it is not cause by reset */ - hns3_pf_enable_irq0(hw); - } -diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c -index b62b059..9e3b31e 100644 ---- a/drivers/net/hns3/hns3_ethdev_vf.c -+++ b/drivers/net/hns3/hns3_ethdev_vf.c -@@ -1116,6 +1116,8 @@ hns3vf_interrupt_handler(void *param) - - /* Read out interrupt causes */ - event_cause = hns3vf_check_event_cause(hns, &clearval); -+ /* Clear interrupt causes */ -+ hns3vf_clear_event_cause(hw, clearval); - - switch (event_cause) { - case HNS3VF_VECTOR0_EVENT_RST: -@@ -1128,9 +1130,6 @@ hns3vf_interrupt_handler(void *param) - break; - } - -- /* Clear interrupt causes */ -- hns3vf_clear_event_cause(hw, clearval); -- - /* Enable interrupt */ - hns3vf_enable_irq0(hw); - } --- -2.7.4 - diff --git a/0207-app-procinfo-remove-doxygen-comments.patch b/0207-app-procinfo-remove-doxygen-comments.patch new file mode 100644 index 0000000000000000000000000000000000000000..1de48edef775d2b385bc3e9556ed8c970deb3007 --- /dev/null +++ b/0207-app-procinfo-remove-doxygen-comments.patch @@ -0,0 +1,108 @@ +From 85da70e47d6f94ddaf88625b87e1ba9144c2df1d Mon Sep 17 00:00:00 2001 +From: Dongdong Liu +Date: Tue, 11 Oct 2022 19:18:41 +0800 +Subject: app/procinfo: remove doxygen comments + +[ upstream commit 797f2f510ce10fd049f4815bd7cce9bc19c460be ] + +This code is to do cleanup for the wrong doxygen syntax comments +The DPDK API is documented using doxygen comment annotations in the +header files. The procinfo code seems no need to use doxygen comment. + +Signed-off-by: Dongdong Liu +Acked-by: Reshma Pattan +--- + app/proc-info/main.c | 42 +++++++++++++++++++++--------------------- + 1 file changed, 21 insertions(+), 21 deletions(-) + +diff --git a/app/proc-info/main.c b/app/proc-info/main.c +index accb5e716d..a75a1aa9bd 100644 +--- a/app/proc-info/main.c ++++ b/app/proc-info/main.c +@@ -48,33 +48,33 @@ + #define STATS_BDR_STR(w, s) printf("%.*s%s%.*s\n", w, \ + STATS_BDR_FMT, s, w, STATS_BDR_FMT) + +-/**< mask of enabled ports */ ++/* mask of enabled ports */ + static unsigned long enabled_port_mask; +-/**< Enable stats. */ ++/* Enable stats. */ + static uint32_t enable_stats; +-/**< Enable xstats. */ ++/* Enable xstats. */ + static uint32_t enable_xstats; +-/**< Enable collectd format*/ ++/* Enable collectd format */ + static uint32_t enable_collectd_format; +-/**< FD to send collectd format messages to STDOUT*/ ++/* FD to send collectd format messages to STDOUT */ + static int stdout_fd; +-/**< Host id process is running on */ ++/* Host id process is running on */ + static char host_id[MAX_LONG_OPT_SZ]; + #ifdef RTE_LIB_METRICS +-/**< Enable metrics. */ ++/* Enable metrics. */ + static uint32_t enable_metrics; + #endif +-/**< Enable stats reset. */ ++/* Enable stats reset. */ + static uint32_t reset_stats; +-/**< Enable xstats reset. */ ++/* Enable xstats reset. */ + static uint32_t reset_xstats; +-/**< Enable memory info. */ ++/* Enable memory info. */ + static uint32_t mem_info; +-/**< Enable displaying xstat name. */ ++/* Enable displaying xstat name. */ + static uint32_t enable_xstats_name; + static char *xstats_name; + +-/**< Enable xstats by ids. */ ++/* Enable xstats by ids. */ + #define MAX_NB_XSTATS_IDS 1024 + static uint32_t nb_xstats_ids; + static uint64_t xstats_ids[MAX_NB_XSTATS_IDS]; +@@ -82,28 +82,28 @@ static uint64_t xstats_ids[MAX_NB_XSTATS_IDS]; + /* show border */ + static char bdr_str[MAX_STRING_LEN]; + +-/**< Enable show port. */ ++/* Enable show port. */ + static uint32_t enable_shw_port; +-/**< Enable show port private info. */ ++/* Enable show port private info. */ + static uint32_t enable_shw_port_priv; +-/**< Enable show tm. */ ++/* Enable show tm. */ + static uint32_t enable_shw_tm; +-/**< Enable show crypto. */ ++/* Enable show crypto. */ + static uint32_t enable_shw_crypto; +-/**< Enable show ring. */ ++/* Enable show ring. */ + static uint32_t enable_shw_ring; + static char *ring_name; +-/**< Enable show mempool. */ ++/* Enable show mempool. */ + static uint32_t enable_shw_mempool; + static char *mempool_name; +-/**< Enable iter mempool. */ ++/* Enable iter mempool. */ + static uint32_t enable_iter_mempool; + static char *mempool_iter_name; +-/**< Enable dump regs. */ ++/* Enable dump regs. */ + static uint32_t enable_dump_regs; + static char *dump_regs_file_prefix; + +-/**< display usage */ ++/* display usage */ + static void + proc_info_usage(const char *prgname) + { +-- +2.23.0 + diff --git a/0207-net-hns3-remove-duplicate-compile-time-check.patch b/0207-net-hns3-remove-duplicate-compile-time-check.patch deleted file mode 100644 index 78ae67f3bf68c1b61626bf9fb1937fc0daeaea4b..0000000000000000000000000000000000000000 --- a/0207-net-hns3-remove-duplicate-compile-time-check.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 41c5bde109b81c37c50d407e9d82eebdd4253b79 Mon Sep 17 00:00:00 2001 -From: Chengchang Tang -Date: Sat, 17 Jul 2021 10:02:53 +0800 -Subject: [PATCH 21/26] net/hns3: remove duplicate compile-time check - -This patch delete duplicate compile-time check. - -Fixes: cb12e988f35f ("net/hns3: add compile-time verification on Rx vector") -Cc: stable@dpdk.org - -Signed-off-by: Chengchang Tang -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_rxtx_vec.c | 4 ---- - 1 file changed, 4 deletions(-) - -diff --git a/drivers/net/hns3/hns3_rxtx_vec.c b/drivers/net/hns3/hns3_rxtx_vec.c -index 5fdc1d5..e37e858 100644 ---- a/drivers/net/hns3/hns3_rxtx_vec.c -+++ b/drivers/net/hns3/hns3_rxtx_vec.c -@@ -172,8 +172,6 @@ hns3_rxq_vec_setup_rearm_data(struct hns3_rx_queue *rxq) - offsetof(struct rte_mbuf, rearm_data)); - RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, refcnt) < - offsetof(struct rte_mbuf, rearm_data)); -- RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, refcnt) < -- offsetof(struct rte_mbuf, rearm_data)); - RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, nb_segs) < - offsetof(struct rte_mbuf, rearm_data)); - RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, port) < -@@ -182,8 +180,6 @@ hns3_rxq_vec_setup_rearm_data(struct hns3_rx_queue *rxq) - offsetof(struct rte_mbuf, rearm_data) > 6); - RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, refcnt) - - offsetof(struct rte_mbuf, rearm_data) > 6); -- RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, refcnt) - -- offsetof(struct rte_mbuf, rearm_data) > 6); - RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, nb_segs) - - offsetof(struct rte_mbuf, rearm_data) > 6); - RTE_BUILD_BUG_ON(offsetof(struct rte_mbuf, port) - --- -2.7.4 - diff --git a/0208-app-procinfo-dump-DPDK-version.patch b/0208-app-procinfo-dump-DPDK-version.patch new file mode 100644 index 0000000000000000000000000000000000000000..f82e2dc74ac3255298306a5ff4d4fc4e75d6194e --- /dev/null +++ b/0208-app-procinfo-dump-DPDK-version.patch @@ -0,0 +1,118 @@ +From 1cc631c496d706bfc02cf776ef403b0c22bfede3 Mon Sep 17 00:00:00 2001 +From: "Min Hu (Connor)" +Date: Tue, 11 Oct 2022 19:18:36 +0800 +Subject: app/procinfo: dump DPDK version + +[ upstream commit 4778a8ec8bcf453f039b0663534cc37cb5367b43 ] + +Add support for dump dpdk version. + +The command is like: +dpdk-proc-info -a xxxx:xx:xx.x --file-prefix=xxx -- --version + +Signed-off-by: Min Hu (Connor) +Signed-off-by: Dongdong Liu +Acked-by: Reshma Pattan +--- + app/proc-info/main.c | 19 ++++++++++++++++++- + doc/guides/tools/proc_info.rst | 5 ++++- + 2 files changed, 22 insertions(+), 2 deletions(-) + +diff --git a/app/proc-info/main.c b/app/proc-info/main.c +index a75a1aa9bd..651d678cd1 100644 +--- a/app/proc-info/main.c ++++ b/app/proc-info/main.c +@@ -39,6 +39,7 @@ + #include + #include + #include ++#include + + /* Maximum long option length for option parsing. */ + #define MAX_LONG_OPT_SZ 64 +@@ -102,6 +103,8 @@ static char *mempool_iter_name; + /* Enable dump regs. */ + static uint32_t enable_dump_regs; + static char *dump_regs_file_prefix; ++/* Enable show DPDK version. */ ++static uint32_t enable_shw_version; + + /* display usage */ + static void +@@ -130,6 +133,7 @@ proc_info_usage(const char *prgname) + " --show-crypto: to display crypto information\n" + " --show-ring[=name]: to display ring information\n" + " --show-mempool[=name]: to display mempool information\n" ++ " --version: to display DPDK version\n" + " --iter-mempool=name: iterate mempool elements to display content\n" + " --dump-regs=file-prefix: dump registers to file with the file-prefix\n", + prgname); +@@ -242,6 +246,7 @@ proc_info_parse_args(int argc, char **argv) + {"show-mempool", optional_argument, NULL, 0}, + {"iter-mempool", required_argument, NULL, 0}, + {"dump-regs", required_argument, NULL, 0}, ++ {"version", 0, NULL, 0}, + {NULL, 0, 0, 0} + }; + +@@ -313,7 +318,9 @@ proc_info_parse_args(int argc, char **argv) + "dump-regs", MAX_LONG_OPT_SZ)) { + enable_dump_regs = 1; + dump_regs_file_prefix = optarg; +- } ++ } else if (!strncmp(long_option[option_index].name, ++ "version", MAX_LONG_OPT_SZ)) ++ enable_shw_version = 1; + break; + case 1: + /* Print xstat single value given by name*/ +@@ -1476,6 +1483,14 @@ dump_regs(char *file_prefix) + } + } + ++static void ++show_version(void) ++{ ++ snprintf(bdr_str, MAX_STRING_LEN, " show - DPDK version "); ++ STATS_BDR_STR(10, bdr_str); ++ printf("DPDK version: %s\n", rte_version()); ++} ++ + int + main(int argc, char **argv) + { +@@ -1589,6 +1604,8 @@ main(int argc, char **argv) + iter_mempool(mempool_iter_name); + if (enable_dump_regs) + dump_regs(dump_regs_file_prefix); ++ if (enable_shw_version) ++ show_version(); + + RTE_ETH_FOREACH_DEV(i) + rte_eth_dev_close(i); +diff --git a/doc/guides/tools/proc_info.rst b/doc/guides/tools/proc_info.rst +index 5dd6f9ecae..121142fdd4 100644 +--- a/doc/guides/tools/proc_info.rst ++++ b/doc/guides/tools/proc_info.rst +@@ -20,7 +20,7 @@ The application has a number of command line options: + .//app/dpdk-proc-info -- -m | [-p PORTMASK] [--stats | --xstats | + --stats-reset | --xstats-reset] [ --show-port | --show-tm | --show-crypto | + --show-ring[=name] | --show-mempool[=name] | --iter-mempool=name | +- --show-port-private ] ++ --show-port-private | --version ] + + Parameters + ~~~~~~~~~~ +@@ -73,6 +73,9 @@ by name. For invalid or no mempool name no elements are displayed. + **--show-port-private** + The show-port-private parameter displays ports private information. + ++**--version** ++The version parameter displays DPDK version. ++ + Limitations + ----------- + +-- +2.23.0 + diff --git a/0208-net-hns3-move-speed-auto-negotiation-warning.patch b/0208-net-hns3-move-speed-auto-negotiation-warning.patch deleted file mode 100644 index a01134242464a65a1e91a11bf1474f14002ac27a..0000000000000000000000000000000000000000 --- a/0208-net-hns3-move-speed-auto-negotiation-warning.patch +++ /dev/null @@ -1,62 +0,0 @@ -From 7c10ec3ea203c6190df96a72f5169a4674b8ea74 Mon Sep 17 00:00:00 2001 -From: Huisong Li -Date: Sat, 17 Jul 2021 10:02:54 +0800 -Subject: [PATCH 22/26] net/hns3: move speed auto-negotiation warning - -PF driver prints a warning on device that does not support auto-negotiation -when user does not configure "link_speeds" (default 0), which means -auto-negotiation. Currently, this warning information is printed in -dev_configure stage and a success is returned. Perhaps the user may call -dev_configure multiple times before dev_start for some reason or purpose. -In this case, this message may be printed multiple times. So this patch -moves it to dev_start stage. - -Fixes: cfc9fe48c4d4 ("net/hns3: move link speeds check to configure") -Cc: stable@dpdk.org - -Signed-off-by: Huisong Li -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_ethdev.c | 14 +++++++------- - 1 file changed, 7 insertions(+), 7 deletions(-) - -diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c -index f658e74..c8f283c 100644 ---- a/drivers/net/hns3/hns3_ethdev.c -+++ b/drivers/net/hns3/hns3_ethdev.c -@@ -2437,14 +2437,11 @@ hns3_check_link_speed(struct hns3_hw *hw, uint32_t link_speeds) - /* - * Some hardware doesn't support auto-negotiation, but users may not - * configure link_speeds (default 0), which means auto-negotiation. -- * In this case, a warning message need to be printed, instead of -- * an error. -+ * In this case, it should return success. - */ - if (link_speeds == ETH_LINK_SPEED_AUTONEG && -- hw->mac.support_autoneg == 0) { -- hns3_warn(hw, "auto-negotiation is not supported, use default fixed speed!"); -+ hw->mac.support_autoneg == 0) - return 0; -- } - - if (link_speeds != ETH_LINK_SPEED_AUTONEG) { - ret = hns3_check_port_speed(hw, link_speeds); -@@ -5512,10 +5509,13 @@ hns3_set_fiber_port_link_speed(struct hns3_hw *hw, - /* - * Some hardware doesn't support auto-negotiation, but users may not - * configure link_speeds (default 0), which means auto-negotiation. -- * In this case, it should return success. -+ * In this case, a warning message need to be printed, instead of -+ * an error. - */ -- if (cfg->autoneg) -+ if (cfg->autoneg) { -+ hns3_warn(hw, "auto-negotiation is not supported, use default fixed speed!"); - return 0; -+ } - - return hns3_cfg_mac_speed_dup(hw, cfg->speed, cfg->duplex); - } --- -2.7.4 - diff --git a/0209-app-procinfo-dump-firmware-version.patch b/0209-app-procinfo-dump-firmware-version.patch new file mode 100644 index 0000000000000000000000000000000000000000..865bdc7d15d49bbea1e6f2701b53376e163c1b80 --- /dev/null +++ b/0209-app-procinfo-dump-firmware-version.patch @@ -0,0 +1,134 @@ +From a9114b29e2916f51faac5923cab0a12c34749d10 Mon Sep 17 00:00:00 2001 +From: Dongdong Liu +Date: Tue, 11 Oct 2022 19:18:37 +0800 +Subject: app/procinfo: dump firmware version + +[ upstream commit 37ebf5ab67d7ef4b532819de47ab780dded655e4 ] + +Add support for dump ethdev firmware version. + +The command is like: +dpdk-proc-info -a xxxx:xx:xx.x --file-prefix=xxx -- --firmware-version + +Signed-off-by: Min Hu (Connor) +Signed-off-by: Dongdong Liu +Acked-by: Reshma Pattan +--- + app/proc-info/main.c | 35 ++++++++++++++++++++++++++++++++++ + doc/guides/tools/proc_info.rst | 5 ++++- + 2 files changed, 39 insertions(+), 1 deletion(-) + +diff --git a/app/proc-info/main.c b/app/proc-info/main.c +index 651d678cd1..351c55896b 100644 +--- a/app/proc-info/main.c ++++ b/app/proc-info/main.c +@@ -45,6 +45,8 @@ + #define MAX_LONG_OPT_SZ 64 + #define MAX_STRING_LEN 256 + ++#define ETHDEV_FWVERS_LEN 32 ++ + #define STATS_BDR_FMT "========================================" + #define STATS_BDR_STR(w, s) printf("%.*s%s%.*s\n", w, \ + STATS_BDR_FMT, s, w, STATS_BDR_FMT) +@@ -105,6 +107,8 @@ static uint32_t enable_dump_regs; + static char *dump_regs_file_prefix; + /* Enable show DPDK version. */ + static uint32_t enable_shw_version; ++/* Enable show ethdev firmware version. */ ++static uint32_t enable_shw_fw_version; + + /* display usage */ + static void +@@ -134,6 +138,7 @@ proc_info_usage(const char *prgname) + " --show-ring[=name]: to display ring information\n" + " --show-mempool[=name]: to display mempool information\n" + " --version: to display DPDK version\n" ++ " --firmware-version: to display ethdev firmware version\n" + " --iter-mempool=name: iterate mempool elements to display content\n" + " --dump-regs=file-prefix: dump registers to file with the file-prefix\n", + prgname); +@@ -247,6 +252,7 @@ proc_info_parse_args(int argc, char **argv) + {"iter-mempool", required_argument, NULL, 0}, + {"dump-regs", required_argument, NULL, 0}, + {"version", 0, NULL, 0}, ++ {"firmware-version", 0, NULL, 0}, + {NULL, 0, 0, 0} + }; + +@@ -321,6 +327,9 @@ proc_info_parse_args(int argc, char **argv) + } else if (!strncmp(long_option[option_index].name, + "version", MAX_LONG_OPT_SZ)) + enable_shw_version = 1; ++ else if (!strncmp(long_option[option_index].name, ++ "firmware-version", MAX_LONG_OPT_SZ)) ++ enable_shw_fw_version = 1; + break; + case 1: + /* Print xstat single value given by name*/ +@@ -1491,6 +1500,30 @@ show_version(void) + printf("DPDK version: %s\n", rte_version()); + } + ++static void ++show_firmware_version(void) ++{ ++ char fw_version[ETHDEV_FWVERS_LEN]; ++ uint16_t i; ++ ++ snprintf(bdr_str, MAX_STRING_LEN, " show - firmware version "); ++ STATS_BDR_STR(10, bdr_str); ++ ++ RTE_ETH_FOREACH_DEV(i) { ++ /* Skip if port is not in mask */ ++ if ((enabled_port_mask & (1ul << i)) == 0) ++ continue; ++ ++ if (rte_eth_dev_fw_version_get(i, fw_version, ++ ETHDEV_FWVERS_LEN) == 0) ++ printf("Ethdev port %u firmware version: %s\n", i, ++ fw_version); ++ else ++ printf("Ethdev port %u firmware version: %s\n", i, ++ "not available"); ++ } ++} ++ + int + main(int argc, char **argv) + { +@@ -1606,6 +1639,8 @@ main(int argc, char **argv) + dump_regs(dump_regs_file_prefix); + if (enable_shw_version) + show_version(); ++ if (enable_shw_fw_version) ++ show_firmware_version(); + + RTE_ETH_FOREACH_DEV(i) + rte_eth_dev_close(i); +diff --git a/doc/guides/tools/proc_info.rst b/doc/guides/tools/proc_info.rst +index 121142fdd4..4eb9fb9249 100644 +--- a/doc/guides/tools/proc_info.rst ++++ b/doc/guides/tools/proc_info.rst +@@ -20,7 +20,7 @@ The application has a number of command line options: + .//app/dpdk-proc-info -- -m | [-p PORTMASK] [--stats | --xstats | + --stats-reset | --xstats-reset] [ --show-port | --show-tm | --show-crypto | + --show-ring[=name] | --show-mempool[=name] | --iter-mempool=name | +- --show-port-private | --version ] ++ --show-port-private | --version | --firmware-version ] + + Parameters + ~~~~~~~~~~ +@@ -76,6 +76,9 @@ The show-port-private parameter displays ports private information. + **--version** + The version parameter displays DPDK version. + ++**--firmware-version** ++The firmware-version parameter displays ethdev firmware version. ++ + Limitations + ----------- + +-- +2.23.0 + diff --git a/0209-net-hns3-fix-flow-rule-list-in-multi-process.patch b/0209-net-hns3-fix-flow-rule-list-in-multi-process.patch deleted file mode 100644 index b3f2f9705094261d0159c086d23ce32ba133d64a..0000000000000000000000000000000000000000 --- a/0209-net-hns3-fix-flow-rule-list-in-multi-process.patch +++ /dev/null @@ -1,454 +0,0 @@ -From a1caa97a8ece52a98a5c1d06b397e3e370a65501 Mon Sep 17 00:00:00 2001 -From: Chengwen Feng -Date: Sat, 17 Jul 2021 10:02:55 +0800 -Subject: [PATCH 23/26] net/hns3: fix flow rule list in multi-process - -Currently, hns3 driver saves rte_flow list into the -rte_eth_dev.process_private field, it may cause following problem: -The FDIR/RSS rules cannot be managed in a unified manner because -the management structure is not visible between processes. - -This patch fixes it by moving rte_flow list to struct hns3_hw which is -visible between processes. - -Fixes: fcba820d9b9e ("net/hns3: support flow director") -Fixes: c37ca66f2b27 ("net/hns3: support RSS") -Cc: stable@dpdk.org - -Signed-off-by: Chengwen Feng -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_ethdev.c | 24 ++------- - drivers/net/hns3/hns3_ethdev.h | 3 ++ - drivers/net/hns3/hns3_ethdev_vf.c | 24 ++------- - drivers/net/hns3/hns3_fdir.h | 7 +-- - drivers/net/hns3/hns3_flow.c | 101 +++++++++++++++++++------------------- - 5 files changed, 60 insertions(+), 99 deletions(-) - -diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c -index c8f283c..4c2dcee 100644 ---- a/drivers/net/hns3/hns3_ethdev.c -+++ b/drivers/net/hns3/hns3_ethdev.c -@@ -5289,6 +5289,7 @@ hns3_uninit_pf(struct rte_eth_dev *eth_dev) - hns3_rss_uninit(hns); - (void)hns3_config_gro(hw, false); - hns3_promisc_uninit(hw); -+ hns3_flow_uninit(eth_dev); - hns3_fdir_filter_uninit(hns); - hns3_uninit_umv_space(hw); - hns3_tqp_stats_uninit(hw); -@@ -5915,11 +5916,8 @@ hns3_dev_close(struct rte_eth_dev *eth_dev) - struct hns3_hw *hw = &hns->hw; - int ret = 0; - -- if (rte_eal_process_type() != RTE_PROC_PRIMARY) { -- rte_free(eth_dev->process_private); -- eth_dev->process_private = NULL; -+ if (rte_eal_process_type() != RTE_PROC_PRIMARY) - return 0; -- } - - if (hw->adapter_state == HNS3_NIC_STARTED) - ret = hns3_dev_stop(eth_dev); -@@ -5934,8 +5932,6 @@ hns3_dev_close(struct rte_eth_dev *eth_dev) - hns3_uninit_pf(eth_dev); - hns3_free_all_queues(eth_dev); - rte_free(hw->reset.wait_data); -- rte_free(eth_dev->process_private); -- eth_dev->process_private = NULL; - hns3_mp_uninit_primary(); - hns3_warn(hw, "Close port %u finished", hw->data->port_id); - -@@ -7395,15 +7391,6 @@ hns3_dev_init(struct rte_eth_dev *eth_dev) - - PMD_INIT_FUNC_TRACE(); - -- eth_dev->process_private = (struct hns3_process_private *) -- rte_zmalloc_socket("hns3_filter_list", -- sizeof(struct hns3_process_private), -- RTE_CACHE_LINE_SIZE, eth_dev->device->numa_node); -- if (eth_dev->process_private == NULL) { -- PMD_INIT_LOG(ERR, "Failed to alloc memory for process private"); -- return -ENOMEM; -- } -- - hns3_flow_init(eth_dev); - - hns3_set_rxtx_function(eth_dev); -@@ -7507,8 +7494,6 @@ hns3_dev_init(struct rte_eth_dev *eth_dev) - eth_dev->tx_pkt_burst = NULL; - eth_dev->tx_pkt_prepare = NULL; - eth_dev->tx_descriptor_status = NULL; -- rte_free(eth_dev->process_private); -- eth_dev->process_private = NULL; - return ret; - } - -@@ -7520,11 +7505,8 @@ hns3_dev_uninit(struct rte_eth_dev *eth_dev) - - PMD_INIT_FUNC_TRACE(); - -- if (rte_eal_process_type() != RTE_PROC_PRIMARY) { -- rte_free(eth_dev->process_private); -- eth_dev->process_private = NULL; -+ if (rte_eal_process_type() != RTE_PROC_PRIMARY) - return 0; -- } - - if (hw->adapter_state < HNS3_NIC_CLOSING) - hns3_dev_close(eth_dev); -diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h -index bdad384..0b5d102 100644 ---- a/drivers/net/hns3/hns3_ethdev.h -+++ b/drivers/net/hns3/hns3_ethdev.h -@@ -630,6 +630,9 @@ struct hns3_hw { - struct hns3_port_base_vlan_config port_base_vlan_cfg; - - pthread_mutex_t flows_lock; /* rte_flow ops lock */ -+ struct hns3_fdir_rule_list flow_fdir_list; /* flow fdir rule list */ -+ struct hns3_rss_filter_list flow_rss_list; /* flow RSS rule list */ -+ struct hns3_flow_mem_list flow_list; - - /* - * PMD setup and configuration is not thread safe. Since it is not -diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c -index 9e3b31e..fc088f8 100644 ---- a/drivers/net/hns3/hns3_ethdev_vf.c -+++ b/drivers/net/hns3/hns3_ethdev_vf.c -@@ -2071,6 +2071,7 @@ hns3vf_uninit_vf(struct rte_eth_dev *eth_dev) - (void)hns3_config_gro(hw, false); - (void)hns3vf_set_alive(hw, false); - (void)hns3vf_set_promisc_mode(hw, false, false, false); -+ hns3_flow_uninit(eth_dev); - hns3_tqp_stats_uninit(hw); - hns3vf_disable_irq0(hw); - rte_intr_disable(&pci_dev->intr_handle); -@@ -2186,11 +2187,8 @@ hns3vf_dev_close(struct rte_eth_dev *eth_dev) - struct hns3_hw *hw = &hns->hw; - int ret = 0; - -- if (rte_eal_process_type() != RTE_PROC_PRIMARY) { -- rte_free(eth_dev->process_private); -- eth_dev->process_private = NULL; -+ if (rte_eal_process_type() != RTE_PROC_PRIMARY) - return 0; -- } - - if (hw->adapter_state == HNS3_NIC_STARTED) - ret = hns3vf_dev_stop(eth_dev); -@@ -2204,8 +2202,6 @@ hns3vf_dev_close(struct rte_eth_dev *eth_dev) - hns3vf_uninit_vf(eth_dev); - hns3_free_all_queues(eth_dev); - rte_free(hw->reset.wait_data); -- rte_free(eth_dev->process_private); -- eth_dev->process_private = NULL; - hns3_mp_uninit_primary(); - hns3_warn(hw, "Close port %u finished", hw->data->port_id); - -@@ -2959,15 +2955,6 @@ hns3vf_dev_init(struct rte_eth_dev *eth_dev) - - PMD_INIT_FUNC_TRACE(); - -- eth_dev->process_private = (struct hns3_process_private *) -- rte_zmalloc_socket("hns3_filter_list", -- sizeof(struct hns3_process_private), -- RTE_CACHE_LINE_SIZE, eth_dev->device->numa_node); -- if (eth_dev->process_private == NULL) { -- PMD_INIT_LOG(ERR, "Failed to alloc memory for process private"); -- return -ENOMEM; -- } -- - hns3_flow_init(eth_dev); - - hns3_set_rxtx_function(eth_dev); -@@ -3069,8 +3056,6 @@ hns3vf_dev_init(struct rte_eth_dev *eth_dev) - eth_dev->tx_pkt_burst = NULL; - eth_dev->tx_pkt_prepare = NULL; - eth_dev->tx_descriptor_status = NULL; -- rte_free(eth_dev->process_private); -- eth_dev->process_private = NULL; - - return ret; - } -@@ -3083,11 +3068,8 @@ hns3vf_dev_uninit(struct rte_eth_dev *eth_dev) - - PMD_INIT_FUNC_TRACE(); - -- if (rte_eal_process_type() != RTE_PROC_PRIMARY) { -- rte_free(eth_dev->process_private); -- eth_dev->process_private = NULL; -+ if (rte_eal_process_type() != RTE_PROC_PRIMARY) - return 0; -- } - - if (hw->adapter_state < HNS3_NIC_CLOSING) - hns3vf_dev_close(eth_dev); -diff --git a/drivers/net/hns3/hns3_fdir.h b/drivers/net/hns3/hns3_fdir.h -index d64af85..d7b31d8 100644 ---- a/drivers/net/hns3/hns3_fdir.h -+++ b/drivers/net/hns3/hns3_fdir.h -@@ -189,12 +189,6 @@ TAILQ_HEAD(hns3_fdir_rule_list, hns3_fdir_rule_ele); - TAILQ_HEAD(hns3_rss_filter_list, hns3_rss_conf_ele); - TAILQ_HEAD(hns3_flow_mem_list, hns3_flow_mem); - --struct hns3_process_private { -- struct hns3_fdir_rule_list fdir_list; -- struct hns3_rss_filter_list filter_rss_list; -- struct hns3_flow_mem_list flow_list; --}; -- - /* - * A structure used to define fields of a FDIR related info. - */ -@@ -220,6 +214,7 @@ int hns3_fdir_filter_program(struct hns3_adapter *hns, - int hns3_clear_all_fdir_filter(struct hns3_adapter *hns); - int hns3_get_count(struct hns3_hw *hw, uint32_t id, uint64_t *value); - void hns3_flow_init(struct rte_eth_dev *dev); -+void hns3_flow_uninit(struct rte_eth_dev *dev); - int hns3_restore_all_fdir_filter(struct hns3_adapter *hns); - - #endif /* _HNS3_FDIR_H_ */ -diff --git a/drivers/net/hns3/hns3_flow.c b/drivers/net/hns3/hns3_flow.c -index a38bb68..6c1e727 100644 ---- a/drivers/net/hns3/hns3_flow.c -+++ b/drivers/net/hns3/hns3_flow.c -@@ -1202,54 +1202,34 @@ hns3_parse_fdir_filter(struct rte_eth_dev *dev, - return hns3_handle_actions(dev, actions, rule, error); - } - --void --hns3_flow_init(struct rte_eth_dev *dev) --{ -- struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private); -- struct hns3_process_private *process_list = dev->process_private; -- pthread_mutexattr_t attr; -- -- if (rte_eal_process_type() == RTE_PROC_PRIMARY) { -- pthread_mutexattr_init(&attr); -- pthread_mutexattr_setpshared(&attr, PTHREAD_PROCESS_SHARED); -- pthread_mutex_init(&hw->flows_lock, &attr); -- dev->data->dev_flags |= RTE_ETH_DEV_FLOW_OPS_THREAD_SAFE; -- } -- -- TAILQ_INIT(&process_list->fdir_list); -- TAILQ_INIT(&process_list->filter_rss_list); -- TAILQ_INIT(&process_list->flow_list); --} -- - static void - hns3_filterlist_flush(struct rte_eth_dev *dev) - { -- struct hns3_process_private *process_list = dev->process_private; -+ struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private); - struct hns3_fdir_rule_ele *fdir_rule_ptr; - struct hns3_rss_conf_ele *rss_filter_ptr; - struct hns3_flow_mem *flow_node; - -- fdir_rule_ptr = TAILQ_FIRST(&process_list->fdir_list); -+ fdir_rule_ptr = TAILQ_FIRST(&hw->flow_fdir_list); - while (fdir_rule_ptr) { -- TAILQ_REMOVE(&process_list->fdir_list, fdir_rule_ptr, entries); -+ TAILQ_REMOVE(&hw->flow_fdir_list, fdir_rule_ptr, entries); - rte_free(fdir_rule_ptr); -- fdir_rule_ptr = TAILQ_FIRST(&process_list->fdir_list); -+ fdir_rule_ptr = TAILQ_FIRST(&hw->flow_fdir_list); - } - -- rss_filter_ptr = TAILQ_FIRST(&process_list->filter_rss_list); -+ rss_filter_ptr = TAILQ_FIRST(&hw->flow_rss_list); - while (rss_filter_ptr) { -- TAILQ_REMOVE(&process_list->filter_rss_list, rss_filter_ptr, -- entries); -+ TAILQ_REMOVE(&hw->flow_rss_list, rss_filter_ptr, entries); - rte_free(rss_filter_ptr); -- rss_filter_ptr = TAILQ_FIRST(&process_list->filter_rss_list); -+ rss_filter_ptr = TAILQ_FIRST(&hw->flow_rss_list); - } - -- flow_node = TAILQ_FIRST(&process_list->flow_list); -+ flow_node = TAILQ_FIRST(&hw->flow_list); - while (flow_node) { -- TAILQ_REMOVE(&process_list->flow_list, flow_node, entries); -+ TAILQ_REMOVE(&hw->flow_list, flow_node, entries); - rte_free(flow_node->flow); - rte_free(flow_node); -- flow_node = TAILQ_FIRST(&process_list->flow_list); -+ flow_node = TAILQ_FIRST(&hw->flow_list); - } - } - -@@ -1519,7 +1499,6 @@ static int - hns3_config_rss_filter(struct rte_eth_dev *dev, - const struct hns3_rss_conf *conf, bool add) - { -- struct hns3_process_private *process_list = dev->process_private; - struct hns3_adapter *hns = dev->data->dev_private; - struct hns3_rss_conf_ele *rss_filter_ptr; - struct hns3_hw *hw = &hns->hw; -@@ -1604,7 +1583,7 @@ hns3_config_rss_filter(struct rte_eth_dev *dev, - * When create a new RSS rule, the old rule will be overlaid and set - * invalid. - */ -- TAILQ_FOREACH(rss_filter_ptr, &process_list->filter_rss_list, entries) -+ TAILQ_FOREACH(rss_filter_ptr, &hw->flow_rss_list, entries) - rss_filter_ptr->filter_info.valid = false; - - rss_config_err: -@@ -1616,7 +1595,6 @@ hns3_config_rss_filter(struct rte_eth_dev *dev, - static int - hns3_clear_rss_filter(struct rte_eth_dev *dev) - { -- struct hns3_process_private *process_list = dev->process_private; - struct hns3_adapter *hns = dev->data->dev_private; - struct hns3_rss_conf_ele *rss_filter_ptr; - struct hns3_hw *hw = &hns->hw; -@@ -1624,10 +1602,9 @@ hns3_clear_rss_filter(struct rte_eth_dev *dev) - int rss_rule_fail_cnt = 0; /* count for failure of clearing RSS rules */ - int ret = 0; - -- rss_filter_ptr = TAILQ_FIRST(&process_list->filter_rss_list); -+ rss_filter_ptr = TAILQ_FIRST(&hw->flow_rss_list); - while (rss_filter_ptr) { -- TAILQ_REMOVE(&process_list->filter_rss_list, rss_filter_ptr, -- entries); -+ TAILQ_REMOVE(&hw->flow_rss_list, rss_filter_ptr, entries); - ret = hns3_config_rss_filter(dev, &rss_filter_ptr->filter_info, - false); - if (ret) -@@ -1635,7 +1612,7 @@ hns3_clear_rss_filter(struct rte_eth_dev *dev) - else - rss_rule_succ_cnt++; - rte_free(rss_filter_ptr); -- rss_filter_ptr = TAILQ_FIRST(&process_list->filter_rss_list); -+ rss_filter_ptr = TAILQ_FIRST(&hw->flow_rss_list); - } - - if (rss_rule_fail_cnt) { -@@ -1739,7 +1716,6 @@ hns3_flow_create(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, - const struct rte_flow_action actions[], - struct rte_flow_error *error) - { -- struct hns3_process_private *process_list = dev->process_private; - struct hns3_adapter *hns = dev->data->dev_private; - struct hns3_hw *hw = &hns->hw; - const struct hns3_rss_conf *rss_conf; -@@ -1771,7 +1747,7 @@ hns3_flow_create(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, - } - - flow_node->flow = flow; -- TAILQ_INSERT_TAIL(&process_list->flow_list, flow_node, entries); -+ TAILQ_INSERT_TAIL(&hw->flow_list, flow_node, entries); - - act = hns3_find_rss_general_action(pattern, actions); - if (act) { -@@ -1793,8 +1769,7 @@ hns3_flow_create(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, - hns3_rss_conf_copy(&rss_filter_ptr->filter_info, - &rss_conf->conf); - rss_filter_ptr->filter_info.valid = true; -- TAILQ_INSERT_TAIL(&process_list->filter_rss_list, -- rss_filter_ptr, entries); -+ TAILQ_INSERT_TAIL(&hw->flow_rss_list, rss_filter_ptr, entries); - - flow->rule = rss_filter_ptr; - flow->filter_type = RTE_ETH_FILTER_HASH; -@@ -1828,8 +1803,7 @@ hns3_flow_create(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, - if (!ret) { - memcpy(&fdir_rule_ptr->fdir_conf, &fdir_rule, - sizeof(struct hns3_fdir_rule)); -- TAILQ_INSERT_TAIL(&process_list->fdir_list, -- fdir_rule_ptr, entries); -+ TAILQ_INSERT_TAIL(&hw->flow_fdir_list, fdir_rule_ptr, entries); - flow->rule = fdir_rule_ptr; - flow->filter_type = RTE_ETH_FILTER_FDIR; - -@@ -1844,7 +1818,7 @@ hns3_flow_create(struct rte_eth_dev *dev, const struct rte_flow_attr *attr, - rte_flow_error_set(error, -ret, RTE_FLOW_ERROR_TYPE_HANDLE, NULL, - "Failed to create flow"); - out: -- TAILQ_REMOVE(&process_list->flow_list, flow_node, entries); -+ TAILQ_REMOVE(&hw->flow_list, flow_node, entries); - rte_free(flow_node); - rte_free(flow); - return NULL; -@@ -1855,13 +1829,13 @@ static int - hns3_flow_destroy(struct rte_eth_dev *dev, struct rte_flow *flow, - struct rte_flow_error *error) - { -- struct hns3_process_private *process_list = dev->process_private; - struct hns3_adapter *hns = dev->data->dev_private; - struct hns3_fdir_rule_ele *fdir_rule_ptr; - struct hns3_rss_conf_ele *rss_filter_ptr; - struct hns3_flow_mem *flow_node; - enum rte_filter_type filter_type; - struct hns3_fdir_rule fdir_rule; -+ struct hns3_hw *hw = &hns->hw; - int ret; - - if (flow == NULL) -@@ -1884,7 +1858,7 @@ hns3_flow_destroy(struct rte_eth_dev *dev, struct rte_flow *flow, - "Destroy FDIR fail.Try again"); - if (fdir_rule.flags & HNS3_RULE_FLAG_COUNTER) - hns3_counter_release(dev, fdir_rule.act_cnt.id); -- TAILQ_REMOVE(&process_list->fdir_list, fdir_rule_ptr, entries); -+ TAILQ_REMOVE(&hw->flow_fdir_list, fdir_rule_ptr, entries); - rte_free(fdir_rule_ptr); - fdir_rule_ptr = NULL; - break; -@@ -1897,8 +1871,7 @@ hns3_flow_destroy(struct rte_eth_dev *dev, struct rte_flow *flow, - RTE_FLOW_ERROR_TYPE_HANDLE, - flow, - "Destroy RSS fail.Try again"); -- TAILQ_REMOVE(&process_list->filter_rss_list, rss_filter_ptr, -- entries); -+ TAILQ_REMOVE(&hw->flow_rss_list, rss_filter_ptr, entries); - rte_free(rss_filter_ptr); - rss_filter_ptr = NULL; - break; -@@ -1908,10 +1881,9 @@ hns3_flow_destroy(struct rte_eth_dev *dev, struct rte_flow *flow, - "Unsupported filter type"); - } - -- TAILQ_FOREACH(flow_node, &process_list->flow_list, entries) { -+ TAILQ_FOREACH(flow_node, &hw->flow_list, entries) { - if (flow_node->flow == flow) { -- TAILQ_REMOVE(&process_list->flow_list, flow_node, -- entries); -+ TAILQ_REMOVE(&hw->flow_list, flow_node, entries); - rte_free(flow_node); - flow_node = NULL; - break; -@@ -2115,3 +2087,30 @@ hns3_dev_filter_ctrl(struct rte_eth_dev *dev, enum rte_filter_type filter_type, - - return ret; - } -+ -+void -+hns3_flow_init(struct rte_eth_dev *dev) -+{ -+ struct hns3_hw *hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private); -+ pthread_mutexattr_t attr; -+ -+ if (rte_eal_process_type() != RTE_PROC_PRIMARY) -+ return; -+ -+ pthread_mutexattr_init(&attr); -+ pthread_mutexattr_setpshared(&attr, PTHREAD_PROCESS_SHARED); -+ pthread_mutex_init(&hw->flows_lock, &attr); -+ dev->data->dev_flags |= RTE_ETH_DEV_FLOW_OPS_THREAD_SAFE; -+ -+ TAILQ_INIT(&hw->flow_fdir_list); -+ TAILQ_INIT(&hw->flow_rss_list); -+ TAILQ_INIT(&hw->flow_list); -+} -+ -+void -+hns3_flow_uninit(struct rte_eth_dev *dev) -+{ -+ struct rte_flow_error error; -+ if (rte_eal_process_type() == RTE_PROC_PRIMARY) -+ hns3_flow_flush_wrap(dev, &error); -+} -\ No newline at end of file --- -2.7.4 - diff --git a/0210-app-procinfo-dump-RSS-RETA.patch b/0210-app-procinfo-dump-RSS-RETA.patch new file mode 100644 index 0000000000000000000000000000000000000000..84c8f647b0fd3849c84bb34a9f5b2138e6a5a250 --- /dev/null +++ b/0210-app-procinfo-dump-RSS-RETA.patch @@ -0,0 +1,156 @@ +From 1ec0e71ea5d6b0fbb5bbe7bcde8bf11f57a708ef Mon Sep 17 00:00:00 2001 +From: "Min Hu (Connor)" +Date: Tue, 11 Oct 2022 19:18:38 +0800 +Subject: app/procinfo: dump RSS RETA + +[ upstream commit 0cc5126ccfe5b67b60d869d036cf40496f7591d3 ] + +This patch add support for RSS reta dump. + +The command is like: +dpdk-proc-info -a xxxx:xx:xx.x --file-prefix=xxx -- --show-rss-reta + +Signed-off-by: Min Hu (Connor) +Signed-off-by: Dongdong Liu +Acked-by: Reshma Pattan +--- + app/proc-info/main.c | 57 ++++++++++++++++++++++++++++++++++ + doc/guides/tools/proc_info.rst | 5 ++- + 2 files changed, 61 insertions(+), 1 deletion(-) + +diff --git a/app/proc-info/main.c b/app/proc-info/main.c +index 351c55896b..efae5c6036 100644 +--- a/app/proc-info/main.c ++++ b/app/proc-info/main.c +@@ -46,6 +46,8 @@ + #define MAX_STRING_LEN 256 + + #define ETHDEV_FWVERS_LEN 32 ++#define RTE_RETA_CONF_GROUP_NUM 32 ++#define DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d)) + + #define STATS_BDR_FMT "========================================" + #define STATS_BDR_STR(w, s) printf("%.*s%s%.*s\n", w, \ +@@ -109,6 +111,8 @@ static char *dump_regs_file_prefix; + static uint32_t enable_shw_version; + /* Enable show ethdev firmware version. */ + static uint32_t enable_shw_fw_version; ++/* Enable show RSS reta. */ ++static uint32_t enable_shw_rss_reta; + + /* display usage */ + static void +@@ -139,6 +143,7 @@ proc_info_usage(const char *prgname) + " --show-mempool[=name]: to display mempool information\n" + " --version: to display DPDK version\n" + " --firmware-version: to display ethdev firmware version\n" ++ " --show-rss-reta: to display ports redirection table\n" + " --iter-mempool=name: iterate mempool elements to display content\n" + " --dump-regs=file-prefix: dump registers to file with the file-prefix\n", + prgname); +@@ -253,6 +258,7 @@ proc_info_parse_args(int argc, char **argv) + {"dump-regs", required_argument, NULL, 0}, + {"version", 0, NULL, 0}, + {"firmware-version", 0, NULL, 0}, ++ {"show-rss-reta", 0, NULL, 0}, + {NULL, 0, 0, 0} + }; + +@@ -330,6 +336,9 @@ proc_info_parse_args(int argc, char **argv) + else if (!strncmp(long_option[option_index].name, + "firmware-version", MAX_LONG_OPT_SZ)) + enable_shw_fw_version = 1; ++ else if (!strncmp(long_option[option_index].name, ++ "show-rss-reta", MAX_LONG_OPT_SZ)) ++ enable_shw_rss_reta = 1; + break; + case 1: + /* Print xstat single value given by name*/ +@@ -1524,6 +1533,52 @@ show_firmware_version(void) + } + } + ++static void ++show_port_rss_reta_info(void) ++{ ++ struct rte_eth_rss_reta_entry64 reta_conf[RTE_RETA_CONF_GROUP_NUM + 1]; ++ struct rte_eth_dev_info dev_info; ++ uint16_t i, idx, shift; ++ uint16_t num; ++ uint16_t id; ++ int ret; ++ ++ RTE_ETH_FOREACH_DEV(id) { ++ /* Skip if port is not in mask */ ++ if ((enabled_port_mask & (1ul << id)) == 0) ++ continue; ++ ++ snprintf(bdr_str, MAX_STRING_LEN, " Port %u ", id); ++ STATS_BDR_STR(5, bdr_str); ++ ++ ret = rte_eth_dev_info_get(id, &dev_info); ++ if (ret != 0) { ++ fprintf(stderr, "Error getting device info: %s\n", ++ strerror(-ret)); ++ return; ++ } ++ ++ num = DIV_ROUND_UP(dev_info.reta_size, RTE_ETH_RETA_GROUP_SIZE); ++ memset(reta_conf, 0, sizeof(reta_conf)); ++ for (i = 0; i < num; i++) ++ reta_conf[i].mask = ~0ULL; ++ ++ ret = rte_eth_dev_rss_reta_query(id, reta_conf, dev_info.reta_size); ++ if (ret != 0) { ++ fprintf(stderr, "Error getting RSS RETA info: %s\n", ++ strerror(-ret)); ++ return; ++ } ++ ++ for (i = 0; i < dev_info.reta_size; i++) { ++ idx = i / RTE_ETH_RETA_GROUP_SIZE; ++ shift = i % RTE_ETH_RETA_GROUP_SIZE; ++ printf("RSS RETA configuration: hash index=%u, queue=%u\n", ++ i, reta_conf[idx].reta[shift]); ++ } ++ } ++} ++ + int + main(int argc, char **argv) + { +@@ -1641,6 +1696,8 @@ main(int argc, char **argv) + show_version(); + if (enable_shw_fw_version) + show_firmware_version(); ++ if (enable_shw_rss_reta) ++ show_port_rss_reta_info(); + + RTE_ETH_FOREACH_DEV(i) + rte_eth_dev_close(i); +diff --git a/doc/guides/tools/proc_info.rst b/doc/guides/tools/proc_info.rst +index 4eb9fb9249..7c8d115fdf 100644 +--- a/doc/guides/tools/proc_info.rst ++++ b/doc/guides/tools/proc_info.rst +@@ -20,7 +20,7 @@ The application has a number of command line options: + .//app/dpdk-proc-info -- -m | [-p PORTMASK] [--stats | --xstats | + --stats-reset | --xstats-reset] [ --show-port | --show-tm | --show-crypto | + --show-ring[=name] | --show-mempool[=name] | --iter-mempool=name | +- --show-port-private | --version | --firmware-version ] ++ --show-port-private | --version | --firmware-version | --show-rss-reta ] + + Parameters + ~~~~~~~~~~ +@@ -79,6 +79,9 @@ The version parameter displays DPDK version. + **--firmware-version** + The firmware-version parameter displays ethdev firmware version. + ++**--show-rss-reta** ++The show-rss-reta parameter displays ports rss redirection table. ++ + Limitations + ----------- + +-- +2.23.0 + diff --git a/0210-net-hns3-fix-Tx-prepare-after-stop.patch b/0210-net-hns3-fix-Tx-prepare-after-stop.patch deleted file mode 100644 index 00d8e161853035106a425c74df785ddfa5d4526e..0000000000000000000000000000000000000000 --- a/0210-net-hns3-fix-Tx-prepare-after-stop.patch +++ /dev/null @@ -1,39 +0,0 @@ -From c0e77e78921b2b7de78738c8d023bf5a4dac5383 Mon Sep 17 00:00:00 2001 -From: Huisong Li -Date: Sat, 17 Jul 2021 10:02:56 +0800 -Subject: [PATCH 24/26] net/hns3: fix Tx prepare after stop - -In some special scenarios, such as TSO scenarios, the user layer may need -to call the tx_pkt_prepare(), and then call tx_pkt_burst() to send packets. -If the return value of tx_pkt_parepare() isn't equal to the numbers of -packets requested to send, warning message may be printed at the user -layer. Currently, tx_pkt_prepare() is assigned to dummy function when -dev_stop() is called in hns3 PMD. At this moment, if user layer continues -to send packets, the warning message will always be printed. So this patch -modifies the address to NULL. - -Fixes: 2790c6464725 ("net/hns3: support device reset") -Cc: stable@dpdk.org - -Signed-off-by: Huisong Li -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_rxtx.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c -index d8b79c3..d50cfc6 100644 ---- a/drivers/net/hns3/hns3_rxtx.c -+++ b/drivers/net/hns3/hns3_rxtx.c -@@ -4386,7 +4386,7 @@ void hns3_set_rxtx_function(struct rte_eth_dev *eth_dev) - } else { - eth_dev->rx_pkt_burst = hns3_dummy_rxtx_burst; - eth_dev->tx_pkt_burst = hns3_dummy_rxtx_burst; -- eth_dev->tx_pkt_prepare = hns3_dummy_rxtx_burst; -+ eth_dev->tx_pkt_prepare = NULL; - } - } - --- -2.7.4 - diff --git a/0211-app-procinfo-dump-module-EEPROM-info.patch b/0211-app-procinfo-dump-module-EEPROM-info.patch new file mode 100644 index 0000000000000000000000000000000000000000..fa5d3a7c4c4de91e9405ff8fa5caed32a0299e41 --- /dev/null +++ b/0211-app-procinfo-dump-module-EEPROM-info.patch @@ -0,0 +1,152 @@ +From 24094ec56e38b32eb2d8bab9822a9fb1355a5ef4 Mon Sep 17 00:00:00 2001 +From: "Min Hu (Connor)" +Date: Tue, 11 Oct 2022 19:18:39 +0800 +Subject: app/procinfo: dump module EEPROM info + +[ upstream commit 0084463ea0042f15b3ef50d9e4c47dbe4d3704b1 ] + +This patch add support for module eeprom info dump. + +The command is like: +dpdk-proc-info -a xxxx:xx:xx.x --file-prefix=xxx -- --show-module-eeprom + +Signed-off-by: Min Hu (Connor) +Signed-off-by: Dongdong Liu +Acked-by: Reshma Pattan +--- + app/proc-info/main.c | 52 ++++++++++++++++++++++++++++++++++ + doc/guides/tools/proc_info.rst | 6 +++- + 2 files changed, 57 insertions(+), 1 deletion(-) + +diff --git a/app/proc-info/main.c b/app/proc-info/main.c +index efae5c6036..2d12644543 100644 +--- a/app/proc-info/main.c ++++ b/app/proc-info/main.c +@@ -48,6 +48,7 @@ + #define ETHDEV_FWVERS_LEN 32 + #define RTE_RETA_CONF_GROUP_NUM 32 + #define DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d)) ++#define EEPROM_DUMP_CHUNKSIZE 1024 + + #define STATS_BDR_FMT "========================================" + #define STATS_BDR_STR(w, s) printf("%.*s%s%.*s\n", w, \ +@@ -113,6 +114,8 @@ static uint32_t enable_shw_version; + static uint32_t enable_shw_fw_version; + /* Enable show RSS reta. */ + static uint32_t enable_shw_rss_reta; ++/* Enable show module eeprom information. */ ++static uint32_t enable_shw_module_eeprom; + + /* display usage */ + static void +@@ -144,6 +147,7 @@ proc_info_usage(const char *prgname) + " --version: to display DPDK version\n" + " --firmware-version: to display ethdev firmware version\n" + " --show-rss-reta: to display ports redirection table\n" ++ " --show-module-eeprom: to display ports module eeprom information\n" + " --iter-mempool=name: iterate mempool elements to display content\n" + " --dump-regs=file-prefix: dump registers to file with the file-prefix\n", + prgname); +@@ -259,6 +263,7 @@ proc_info_parse_args(int argc, char **argv) + {"version", 0, NULL, 0}, + {"firmware-version", 0, NULL, 0}, + {"show-rss-reta", 0, NULL, 0}, ++ {"show-module-eeprom", 0, NULL, 0}, + {NULL, 0, 0, 0} + }; + +@@ -339,6 +344,9 @@ proc_info_parse_args(int argc, char **argv) + else if (!strncmp(long_option[option_index].name, + "show-rss-reta", MAX_LONG_OPT_SZ)) + enable_shw_rss_reta = 1; ++ else if (!strncmp(long_option[option_index].name, ++ "show-module-eeprom", MAX_LONG_OPT_SZ)) ++ enable_shw_module_eeprom = 1; + break; + case 1: + /* Print xstat single value given by name*/ +@@ -1579,6 +1587,48 @@ show_port_rss_reta_info(void) + } + } + ++static void ++show_module_eeprom_info(void) ++{ ++ unsigned char bytes_eeprom[EEPROM_DUMP_CHUNKSIZE]; ++ struct rte_eth_dev_module_info module_info; ++ struct rte_dev_eeprom_info eeprom_info; ++ uint16_t i; ++ int ret; ++ ++ RTE_ETH_FOREACH_DEV(i) { ++ /* Skip if port is not in mask */ ++ if ((enabled_port_mask & (1ul << i)) == 0) ++ continue; ++ ++ snprintf(bdr_str, MAX_STRING_LEN, " Port %u ", i); ++ STATS_BDR_STR(5, bdr_str); ++ ++ ret = rte_eth_dev_get_module_info(i, &module_info); ++ if (ret != 0) { ++ fprintf(stderr, "Module EEPROM information read error: %s\n", ++ strerror(-ret)); ++ return; ++ } ++ ++ eeprom_info.offset = 0; ++ eeprom_info.length = module_info.eeprom_len; ++ eeprom_info.data = bytes_eeprom; ++ ++ ret = rte_eth_dev_get_module_eeprom(i, &eeprom_info); ++ if (ret != 0) { ++ fprintf(stderr, "Module EEPROM read error: %s\n", ++ strerror(-ret)); ++ return; ++ } ++ ++ rte_hexdump(stdout, "hexdump", eeprom_info.data, ++ eeprom_info.length); ++ printf("Finish -- Port: %u MODULE EEPROM length: %d bytes\n", ++ i, eeprom_info.length); ++ } ++} ++ + int + main(int argc, char **argv) + { +@@ -1698,6 +1748,8 @@ main(int argc, char **argv) + show_firmware_version(); + if (enable_shw_rss_reta) + show_port_rss_reta_info(); ++ if (enable_shw_module_eeprom) ++ show_module_eeprom_info(); + + RTE_ETH_FOREACH_DEV(i) + rte_eth_dev_close(i); +diff --git a/doc/guides/tools/proc_info.rst b/doc/guides/tools/proc_info.rst +index 7c8d115fdf..dc5d017cff 100644 +--- a/doc/guides/tools/proc_info.rst ++++ b/doc/guides/tools/proc_info.rst +@@ -20,7 +20,8 @@ The application has a number of command line options: + .//app/dpdk-proc-info -- -m | [-p PORTMASK] [--stats | --xstats | + --stats-reset | --xstats-reset] [ --show-port | --show-tm | --show-crypto | + --show-ring[=name] | --show-mempool[=name] | --iter-mempool=name | +- --show-port-private | --version | --firmware-version | --show-rss-reta ] ++ --show-port-private | --version | --firmware-version | --show-rss-reta | ++ --show-module-eeprom ] + + Parameters + ~~~~~~~~~~ +@@ -82,6 +83,9 @@ The firmware-version parameter displays ethdev firmware version. + **--show-rss-reta** + The show-rss-reta parameter displays ports rss redirection table. + ++**--show-module-eeprom** ++The show-module-eeprom parameter displays ports module eeprom information. ++ + Limitations + ----------- + +-- +2.23.0 + diff --git a/0211-net-hns3-disable-PFC-if-not-configured.patch b/0211-net-hns3-disable-PFC-if-not-configured.patch deleted file mode 100644 index 500a3334c9aca82604713947b44f39e98d245734..0000000000000000000000000000000000000000 --- a/0211-net-hns3-disable-PFC-if-not-configured.patch +++ /dev/null @@ -1,197 +0,0 @@ -From adcff6f726ed3345c9d4ad0182de22d2e57459d8 Mon Sep 17 00:00:00 2001 -From: Huisong Li -Date: Sat, 17 Jul 2021 09:04:19 +0800 -Subject: [PATCH 25/26] net/hns3: disable PFC if not configured - -If "dcb_capability_en" in "data->dev_conf" delivered from the dev_configure -does not have the ETH_DCB_PFC_SUPPORT flag, the user wants to disable PFC, -and only enable ETS. Therefore, this patch supports the function of -disabling PFC by the field. In addition, this patch updates -"current_fc_status" of the driver based on the flow control mode requested -by user so as to enable the flow control mode in multi-TC scenarios. - -Signed-off-by: Huisong Li -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_dcb.c | 112 ++++++++++++++++++-------------------------- - 1 file changed, 45 insertions(+), 67 deletions(-) - -diff --git a/drivers/net/hns3/hns3_dcb.c b/drivers/net/hns3/hns3_dcb.c -index 61a2404..4d5b00b 100644 ---- a/drivers/net/hns3/hns3_dcb.c -+++ b/drivers/net/hns3/hns3_dcb.c -@@ -1400,42 +1400,22 @@ hns3_dcb_undrop_tc_map(struct hns3_hw *hw, uint8_t pfc_en) - return pfc_map; - } - --static void --hns3_dcb_cfg_validate(struct hns3_adapter *hns, uint8_t *tc, bool *changed) -+static uint8_t -+hns3_dcb_parse_num_tc(struct hns3_adapter *hns) - { - struct rte_eth_dcb_rx_conf *dcb_rx_conf; - struct hns3_hw *hw = &hns->hw; -- uint16_t nb_rx_q = hw->data->nb_rx_queues; -- uint16_t nb_tx_q = hw->data->nb_tx_queues; -- uint8_t max_tc = 0; -- uint8_t pfc_en; -+ uint8_t max_tc_id = 0; - int i; - - dcb_rx_conf = &hw->data->dev_conf.rx_adv_conf.dcb_rx_conf; - for (i = 0; i < HNS3_MAX_USER_PRIO; i++) { -- if (dcb_rx_conf->dcb_tc[i] != hw->dcb_info.prio_tc[i]) -- *changed = true; -- -- if (dcb_rx_conf->dcb_tc[i] > max_tc) -- max_tc = dcb_rx_conf->dcb_tc[i]; -+ if (dcb_rx_conf->dcb_tc[i] > max_tc_id) -+ max_tc_id = dcb_rx_conf->dcb_tc[i]; - } -- *tc = max_tc + 1; -- if (*tc != hw->dcb_info.num_tc) -- *changed = true; -- -- /* -- * We ensure that dcb information can be reconfigured -- * after the hns3_priority_flow_ctrl_set function called. -- */ -- if (hw->requested_fc_mode != HNS3_FC_FULL) -- *changed = true; -- pfc_en = RTE_LEN2MASK((uint8_t)dcb_rx_conf->nb_tcs, uint8_t); -- if (hw->dcb_info.pfc_en != pfc_en) -- *changed = true; - -- /* tx/rx queue number is reconfigured. */ -- if (nb_rx_q != hw->used_rx_queues || nb_tx_q != hw->used_tx_queues) -- *changed = true; -+ /* Number of TC is equal to max_tc_id plus 1. */ -+ return max_tc_id + 1; - } - - static int -@@ -1567,36 +1547,30 @@ hns3_dcb_hw_configure(struct hns3_adapter *hns) - hw->dcb_info.hw_pfc_map = - hns3_dcb_undrop_tc_map(hw, hw->dcb_info.pfc_en); - -- ret = hns3_buffer_alloc(hw); -- if (ret) -- goto buffer_alloc_fail; -- - hw->current_fc_status = HNS3_FC_STATUS_PFC; - hw->requested_fc_mode = HNS3_FC_FULL; -- ret = hns3_dcb_pause_setup_hw(hw); -- if (ret) { -- hns3_err(hw, "setup pfc failed! ret = %d", ret); -- goto pfc_setup_fail; -- } - } else { -- /* -- * Although dcb_capability_en is lack of ETH_DCB_PFC_SUPPORT -- * flag, the DCB information is configured, such as tc numbers. -- * Therefore, refreshing the allocation of packet buffer is -- * necessary. -- */ -- ret = hns3_buffer_alloc(hw); -- if (ret) -- return ret; -+ hw->current_fc_status = HNS3_FC_STATUS_NONE; -+ hw->requested_fc_mode = HNS3_FC_NONE; -+ hw->dcb_info.pfc_en = 0; -+ hw->dcb_info.hw_pfc_map = 0; -+ } -+ -+ ret = hns3_buffer_alloc(hw); -+ if (ret) -+ goto cfg_fail; -+ -+ ret = hns3_dcb_pause_setup_hw(hw); -+ if (ret) { -+ hns3_err(hw, "setup pfc failed! ret = %d", ret); -+ goto cfg_fail; - } - - return 0; - --pfc_setup_fail: -+cfg_fail: - hw->requested_fc_mode = requested_fc_mode; - hw->current_fc_status = fc_status; -- --buffer_alloc_fail: - hw->dcb_info.pfc_en = pfc_en; - hw->dcb_info.hw_pfc_map = hw_pfc_map; - -@@ -1612,23 +1586,20 @@ int - hns3_dcb_configure(struct hns3_adapter *hns) - { - struct hns3_hw *hw = &hns->hw; -- bool map_changed = false; -- uint8_t num_tc = 0; -+ uint8_t num_tc; - int ret; - -- hns3_dcb_cfg_validate(hns, &num_tc, &map_changed); -- if (map_changed) { -- ret = hns3_dcb_info_update(hns, num_tc); -- if (ret) { -- hns3_err(hw, "dcb info update failed: %d", ret); -- return ret; -- } -+ num_tc = hns3_dcb_parse_num_tc(hns); -+ ret = hns3_dcb_info_update(hns, num_tc); -+ if (ret) { -+ hns3_err(hw, "dcb info update failed: %d", ret); -+ return ret; -+ } - -- ret = hns3_dcb_hw_configure(hns); -- if (ret) { -- hns3_err(hw, "dcb sw configure failed: %d", ret); -- return ret; -- } -+ ret = hns3_dcb_hw_configure(hns); -+ if (ret) { -+ hns3_err(hw, "dcb sw configure failed: %d", ret); -+ return ret; - } - - return 0; -@@ -1781,15 +1752,21 @@ hns3_dcb_pfc_enable(struct rte_eth_dev *dev, struct rte_eth_pfc_conf *pfc_conf) - uint16_t pause_time = pf->pause_time; - int ret; - -- pf->pause_time = pfc_conf->fc.pause_time; -- hns3_get_fc_mode(hw, pfc_conf->fc.mode); -- hw->current_fc_status = HNS3_FC_STATUS_PFC; - hw->dcb_info.pfc_en |= BIT(priority); - hw->dcb_info.hw_pfc_map = - hns3_dcb_undrop_tc_map(hw, hw->dcb_info.pfc_en); - ret = hns3_buffer_alloc(hw); -- if (ret) -- goto pfc_setup_fail; -+ if (ret) { -+ hns3_err(hw, "update packet buffer failed, ret = %d", ret); -+ goto buffer_alloc_fail; -+ } -+ -+ pf->pause_time = pfc_conf->fc.pause_time; -+ hns3_get_fc_mode(hw, pfc_conf->fc.mode); -+ if (hw->requested_fc_mode == HNS3_FC_NONE) -+ hw->current_fc_status = HNS3_FC_STATUS_NONE; -+ else -+ hw->current_fc_status = HNS3_FC_STATUS_PFC; - - /* - * The flow control mode of all UPs will be changed based on -@@ -1807,6 +1784,7 @@ hns3_dcb_pfc_enable(struct rte_eth_dev *dev, struct rte_eth_pfc_conf *pfc_conf) - hw->requested_fc_mode = old_fc_mode; - hw->current_fc_status = fc_status; - pf->pause_time = pause_time; -+buffer_alloc_fail: - hw->dcb_info.pfc_en = pfc_en; - hw->dcb_info.hw_pfc_map = hw_pfc_map; - --- -2.7.4 - diff --git a/0212-app-procinfo-add-burst-mode-to-Rx-Tx-queue-info.patch b/0212-app-procinfo-add-burst-mode-to-Rx-Tx-queue-info.patch new file mode 100644 index 0000000000000000000000000000000000000000..9889d3da953f2a34b024fa0c1ab0badae4ab1fa7 --- /dev/null +++ b/0212-app-procinfo-add-burst-mode-to-Rx-Tx-queue-info.patch @@ -0,0 +1,76 @@ +From cf883e9e107e5f646ab8cb41c50e0cd0ab41b3ce Mon Sep 17 00:00:00 2001 +From: Jie Hai +Date: Tue, 11 Oct 2022 19:18:40 +0800 +Subject: app/procinfo: add burst mode to Rx/Tx queue info + +[ upstream commit a6d81dc0326aae58ea377fc1dc3d62f6bad4ad94 ] + +Add dump of Rx/Tx burst mode in --show-port. + +Sample output changes: + - rx queue +- -- 0 descriptors 0/1024 drop_en rx buffer size 2048 \ + mempool mb_pool_0 socket 0 ++ -- 0 descriptors 0/1024 drop_en rx buffer size 2048 \ + mempool mb_pool_0 socket 0 burst mode : Vector Neon + - tx queue +- -- 0 descriptors 1024 thresh 32/928 \ + offloads : MBUF_FAST_FREE ++ -- 0 descriptors 1024 thresh 32/928 \ + offloads : MBUF_FAST_FREE burst mode : Scalar + +Signed-off-by: Jie Hai +Signed-off-by: Dongdong Liu +Acked-by: Reshma Pattan +--- + app/proc-info/main.c | 15 +++++++++++++++ + 1 file changed, 15 insertions(+) + +diff --git a/app/proc-info/main.c b/app/proc-info/main.c +index 2d12644543..dc948c7cc5 100644 +--- a/app/proc-info/main.c ++++ b/app/proc-info/main.c +@@ -845,6 +845,7 @@ show_port(void) + + for (j = 0; j < dev_info.nb_rx_queues; j++) { + struct rte_eth_rxq_info queue_info; ++ struct rte_eth_burst_mode mode; + int count; + + ret = rte_eth_rx_queue_info_get(i, j, &queue_info); +@@ -880,11 +881,18 @@ show_port(void) + if (queue_info.conf.offloads != 0) + show_offloads(queue_info.conf.offloads, rte_eth_dev_rx_offload_name); + ++ if (rte_eth_rx_burst_mode_get(i, j, &mode) == 0) ++ printf(" burst mode : %s%s", ++ mode.info, ++ mode.flags & RTE_ETH_BURST_FLAG_PER_QUEUE ? ++ " (per queue)" : ""); ++ + printf("\n"); + } + + for (j = 0; j < dev_info.nb_tx_queues; j++) { + struct rte_eth_txq_info queue_info; ++ struct rte_eth_burst_mode mode; + + ret = rte_eth_tx_queue_info_get(i, j, &queue_info); + if (ret != 0) +@@ -905,6 +913,13 @@ show_port(void) + + if (queue_info.conf.offloads != 0) + show_offloads(queue_info.conf.offloads, rte_eth_dev_tx_offload_name); ++ ++ if (rte_eth_tx_burst_mode_get(i, j, &mode) == 0) ++ printf(" burst mode : %s%s", ++ mode.info, ++ mode.flags & RTE_ETH_BURST_FLAG_PER_QUEUE ? ++ " (per queue)" : ""); ++ + printf("\n"); + } + +-- +2.23.0 + diff --git a/0212-net-hns3-use-the-correct-HiSilicon-copyright.patch b/0212-net-hns3-use-the-correct-HiSilicon-copyright.patch deleted file mode 100644 index b9d3c63055d9d136d85811e3d783f9188843eacc..0000000000000000000000000000000000000000 --- a/0212-net-hns3-use-the-correct-HiSilicon-copyright.patch +++ /dev/null @@ -1,412 +0,0 @@ -From 7fcab57399496811e5167d475645f6cb4b67692a Mon Sep 17 00:00:00 2001 -From: "Min Hu (Connor)" -Date: Thu, 1 Apr 2021 16:24:52 +0800 -Subject: [PATCH 26/26] net/hns3: use the correct HiSilicon copyright - -According to the suggestion of our legal department, -to standardize the copyright license of our code to -avoid potential copyright risks, we make a unified -modification to the "Hisilicon", which was nonstandard, -in the main modules we maintain. - -We change it to "HiSilicon", which is consistent with -the terms used on the following official website: -https://www.hisilicon.com/en/terms-of-use. - -Fixes: 565829db8b8f ("net/hns3: add build and doc infrastructure") -Fixes: 952ebacce4f2 ("net/hns3: support SVE Rx") -Fixes: e31f123db06b ("net/hns3: support NEON Tx") -Fixes: c09c7847d892 ("net/hns3: support traffic management") -Cc: stable@dpdk.org - -Signed-off-by: Min Hu (Connor) ---- - drivers/net/hns3/hns3_cmd.c | 2 +- - drivers/net/hns3/hns3_cmd.h | 2 +- - drivers/net/hns3/hns3_dcb.c | 2 +- - drivers/net/hns3/hns3_dcb.h | 2 +- - drivers/net/hns3/hns3_ethdev.c | 2 +- - drivers/net/hns3/hns3_ethdev.h | 2 +- - drivers/net/hns3/hns3_ethdev_vf.c | 2 +- - drivers/net/hns3/hns3_fdir.c | 2 +- - drivers/net/hns3/hns3_fdir.h | 2 +- - drivers/net/hns3/hns3_flow.c | 2 +- - drivers/net/hns3/hns3_intr.c | 2 +- - drivers/net/hns3/hns3_intr.h | 2 +- - drivers/net/hns3/hns3_logs.h | 2 +- - drivers/net/hns3/hns3_mbx.c | 2 +- - drivers/net/hns3/hns3_mbx.h | 2 +- - drivers/net/hns3/hns3_mp.c | 2 +- - drivers/net/hns3/hns3_mp.h | 2 +- - drivers/net/hns3/hns3_regs.c | 2 +- - drivers/net/hns3/hns3_regs.h | 2 +- - drivers/net/hns3/hns3_rss.c | 2 +- - drivers/net/hns3/hns3_rss.h | 2 +- - drivers/net/hns3/hns3_rxtx.c | 2 +- - drivers/net/hns3/hns3_rxtx.h | 2 +- - drivers/net/hns3/hns3_rxtx_vec.c | 2 +- - drivers/net/hns3/hns3_rxtx_vec.h | 2 +- - drivers/net/hns3/hns3_rxtx_vec_neon.h | 2 +- - drivers/net/hns3/hns3_rxtx_vec_sve.c | 2 +- - drivers/net/hns3/hns3_stats.c | 2 +- - drivers/net/hns3/hns3_stats.h | 2 +- - drivers/net/hns3/hns3_tm.c | 2 +- - drivers/net/hns3/hns3_tm.h | 2 +- - drivers/net/hns3/meson.build | 2 +- - 32 files changed, 32 insertions(+), 32 deletions(-) - -diff --git a/drivers/net/hns3/hns3_cmd.c b/drivers/net/hns3/hns3_cmd.c -index ab92240..0de1a53 100644 ---- a/drivers/net/hns3/hns3_cmd.c -+++ b/drivers/net/hns3/hns3_cmd.c -@@ -1,5 +1,5 @@ - /* SPDX-License-Identifier: BSD-3-Clause -- * Copyright(c) 2018-2019 Hisilicon Limited. -+ * Copyright(c) 2018-2021 HiSilicon Limited. - */ - - #include -diff --git a/drivers/net/hns3/hns3_cmd.h b/drivers/net/hns3/hns3_cmd.h -index 780ab0f..88683df 100644 ---- a/drivers/net/hns3/hns3_cmd.h -+++ b/drivers/net/hns3/hns3_cmd.h -@@ -1,5 +1,5 @@ - /* SPDX-License-Identifier: BSD-3-Clause -- * Copyright(c) 2018-2019 Hisilicon Limited. -+ * Copyright(c) 2018-2021 HiSilicon Limited. - */ - - #ifndef _HNS3_CMD_H_ -diff --git a/drivers/net/hns3/hns3_dcb.c b/drivers/net/hns3/hns3_dcb.c -index 4d5b00b..b71e2e9 100644 ---- a/drivers/net/hns3/hns3_dcb.c -+++ b/drivers/net/hns3/hns3_dcb.c -@@ -1,5 +1,5 @@ - /* SPDX-License-Identifier: BSD-3-Clause -- * Copyright(c) 2018-2019 Hisilicon Limited. -+ * Copyright(c) 2018-2021 HiSilicon Limited. - */ - - #include -diff --git a/drivers/net/hns3/hns3_dcb.h b/drivers/net/hns3/hns3_dcb.h -index 1abe649..e06ec17 100644 ---- a/drivers/net/hns3/hns3_dcb.h -+++ b/drivers/net/hns3/hns3_dcb.h -@@ -1,5 +1,5 @@ - /* SPDX-License-Identifier: BSD-3-Clause -- * Copyright(c) 2018-2019 Hisilicon Limited. -+ * Copyright(c) 2018-2021 HiSilicon Limited. - */ - - #ifndef _HNS3_DCB_H_ -diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c -index 4c2dcee..59260c6 100644 ---- a/drivers/net/hns3/hns3_ethdev.c -+++ b/drivers/net/hns3/hns3_ethdev.c -@@ -1,5 +1,5 @@ - /* SPDX-License-Identifier: BSD-3-Clause -- * Copyright(c) 2018-2019 Hisilicon Limited. -+ * Copyright(c) 2018-2021 HiSilicon Limited. - */ - - #include -diff --git a/drivers/net/hns3/hns3_ethdev.h b/drivers/net/hns3/hns3_ethdev.h -index 0b5d102..1b592c8 100644 ---- a/drivers/net/hns3/hns3_ethdev.h -+++ b/drivers/net/hns3/hns3_ethdev.h -@@ -1,5 +1,5 @@ - /* SPDX-License-Identifier: BSD-3-Clause -- * Copyright(c) 2018-2019 Hisilicon Limited. -+ * Copyright(c) 2018-2021 HiSilicon Limited. - */ - - #ifndef _HNS3_ETHDEV_H_ -diff --git a/drivers/net/hns3/hns3_ethdev_vf.c b/drivers/net/hns3/hns3_ethdev_vf.c -index fc088f8..e07eb20 100644 ---- a/drivers/net/hns3/hns3_ethdev_vf.c -+++ b/drivers/net/hns3/hns3_ethdev_vf.c -@@ -1,5 +1,5 @@ - /* SPDX-License-Identifier: BSD-3-Clause -- * Copyright(c) 2018-2019 Hisilicon Limited. -+ * Copyright(c) 2018-2021 HiSilicon Limited. - */ - - #include -diff --git a/drivers/net/hns3/hns3_fdir.c b/drivers/net/hns3/hns3_fdir.c -index 8ab5fd6..40edd6c 100644 ---- a/drivers/net/hns3/hns3_fdir.c -+++ b/drivers/net/hns3/hns3_fdir.c -@@ -1,5 +1,5 @@ - /* SPDX-License-Identifier: BSD-3-Clause -- * Copyright(c) 2018-2019 Hisilicon Limited. -+ * Copyright(c) 2018-2021 HiSilicon Limited. - */ - - #include -diff --git a/drivers/net/hns3/hns3_fdir.h b/drivers/net/hns3/hns3_fdir.h -index d7b31d8..3f610f7 100644 ---- a/drivers/net/hns3/hns3_fdir.h -+++ b/drivers/net/hns3/hns3_fdir.h -@@ -1,5 +1,5 @@ - /* SPDX-License-Identifier: BSD-3-Clause -- * Copyright(c) 2018-2019 Hisilicon Limited. -+ * Copyright(c) 2018-2021 HiSilicon Limited. - */ - - #ifndef _HNS3_FDIR_H_ -diff --git a/drivers/net/hns3/hns3_flow.c b/drivers/net/hns3/hns3_flow.c -index 6c1e727..42b1c70 100644 ---- a/drivers/net/hns3/hns3_flow.c -+++ b/drivers/net/hns3/hns3_flow.c -@@ -1,5 +1,5 @@ - /* SPDX-License-Identifier: BSD-3-Clause -- * Copyright(c) 2018-2019 Hisilicon Limited. -+ * Copyright(c) 2018-2021 HiSilicon Limited. - */ - - #include -diff --git a/drivers/net/hns3/hns3_intr.c b/drivers/net/hns3/hns3_intr.c -index e8ca6d5..0b307fd 100644 ---- a/drivers/net/hns3/hns3_intr.c -+++ b/drivers/net/hns3/hns3_intr.c -@@ -1,5 +1,5 @@ - /* SPDX-License-Identifier: BSD-3-Clause -- * Copyright(c) 2018-2019 Hisilicon Limited. -+ * Copyright(c) 2018-2021 HiSilicon Limited. - */ - - #include -diff --git a/drivers/net/hns3/hns3_intr.h b/drivers/net/hns3/hns3_intr.h -index 4dfc807..1a0f196 100644 ---- a/drivers/net/hns3/hns3_intr.h -+++ b/drivers/net/hns3/hns3_intr.h -@@ -1,5 +1,5 @@ - /* SPDX-License-Identifier: BSD-3-Clause -- * Copyright(c) 2018-2019 Hisilicon Limited. -+ * Copyright(c) 2018-2021 HiSilicon Limited. - */ - - #ifndef _HNS3_INTR_H_ -diff --git a/drivers/net/hns3/hns3_logs.h b/drivers/net/hns3/hns3_logs.h -index f3fc7b5..072a53b 100644 ---- a/drivers/net/hns3/hns3_logs.h -+++ b/drivers/net/hns3/hns3_logs.h -@@ -1,5 +1,5 @@ - /* SPDX-License-Identifier: BSD-3-Clause -- * Copyright(c) 2018-2019 Hisilicon Limited. -+ * Copyright(c) 2018-2021 HiSilicon Limited. - */ - - #ifndef _HNS3_LOGS_H_ -diff --git a/drivers/net/hns3/hns3_mbx.c b/drivers/net/hns3/hns3_mbx.c -index 0c2e03b..411c5eb 100644 ---- a/drivers/net/hns3/hns3_mbx.c -+++ b/drivers/net/hns3/hns3_mbx.c -@@ -1,5 +1,5 @@ - /* SPDX-License-Identifier: BSD-3-Clause -- * Copyright(c) 2018-2019 Hisilicon Limited. -+ * Copyright(c) 2018-2021 HiSilicon Limited. - */ - - #include -diff --git a/drivers/net/hns3/hns3_mbx.h b/drivers/net/hns3/hns3_mbx.h -index 2154c04..f868e33 100644 ---- a/drivers/net/hns3/hns3_mbx.h -+++ b/drivers/net/hns3/hns3_mbx.h -@@ -1,5 +1,5 @@ - /* SPDX-License-Identifier: BSD-3-Clause -- * Copyright(c) 2018-2019 Hisilicon Limited. -+ * Copyright(c) 2018-2021 HiSilicon Limited. - */ - - #ifndef _HNS3_MBX_H_ -diff --git a/drivers/net/hns3/hns3_mp.c b/drivers/net/hns3/hns3_mp.c -index b5cd5b0..2a7654d 100644 ---- a/drivers/net/hns3/hns3_mp.c -+++ b/drivers/net/hns3/hns3_mp.c -@@ -1,5 +1,5 @@ - /* SPDX-License-Identifier: BSD-3-Clause -- * Copyright(c) 2018-2019 Hisilicon Limited. -+ * Copyright(c) 2018-2021 HiSilicon Limited. - */ - - #include -diff --git a/drivers/net/hns3/hns3_mp.h b/drivers/net/hns3/hns3_mp.h -index 036546a..1a73598 100644 ---- a/drivers/net/hns3/hns3_mp.h -+++ b/drivers/net/hns3/hns3_mp.h -@@ -1,5 +1,5 @@ - /* SPDX-License-Identifier: BSD-3-Clause -- * Copyright(c) 2018-2019 Hisilicon Limited. -+ * Copyright(c) 2018-2021 HiSilicon Limited. - */ - - #ifndef _HNS3_MP_H_ -diff --git a/drivers/net/hns3/hns3_regs.c b/drivers/net/hns3/hns3_regs.c -index 374b9ea..ee5bcdf 100644 ---- a/drivers/net/hns3/hns3_regs.c -+++ b/drivers/net/hns3/hns3_regs.c -@@ -1,5 +1,5 @@ - /* SPDX-License-Identifier: BSD-3-Clause -- * Copyright(c) 2018-2019 Hisilicon Limited. -+ * Copyright(c) 2018-2021 HiSilicon Limited. - */ - - #include -diff --git a/drivers/net/hns3/hns3_regs.h b/drivers/net/hns3/hns3_regs.h -index c9e10be..5812eb3 100644 ---- a/drivers/net/hns3/hns3_regs.h -+++ b/drivers/net/hns3/hns3_regs.h -@@ -1,5 +1,5 @@ - /* SPDX-License-Identifier: BSD-3-Clause -- * Copyright(c) 2018-2019 Hisilicon Limited. -+ * Copyright(c) 2018-2021 HiSilicon Limited. - */ - - #ifndef _HNS3_REGS_H_ -diff --git a/drivers/net/hns3/hns3_rss.c b/drivers/net/hns3/hns3_rss.c -index 858e31a..3a81e90 100644 ---- a/drivers/net/hns3/hns3_rss.c -+++ b/drivers/net/hns3/hns3_rss.c -@@ -1,5 +1,5 @@ - /* SPDX-License-Identifier: BSD-3-Clause -- * Copyright(c) 2018-2019 Hisilicon Limited. -+ * Copyright(c) 2018-2021 HiSilicon Limited. - */ - - #include -diff --git a/drivers/net/hns3/hns3_rss.h b/drivers/net/hns3/hns3_rss.h -index 94668ed..996083b 100644 ---- a/drivers/net/hns3/hns3_rss.h -+++ b/drivers/net/hns3/hns3_rss.h -@@ -1,5 +1,5 @@ - /* SPDX-License-Identifier: BSD-3-Clause -- * Copyright(c) 2018-2019 Hisilicon Limited. -+ * Copyright(c) 2018-2021 HiSilicon Limited. - */ - - #ifndef _HNS3_RSS_H_ -diff --git a/drivers/net/hns3/hns3_rxtx.c b/drivers/net/hns3/hns3_rxtx.c -index d50cfc6..13d9a31 100644 ---- a/drivers/net/hns3/hns3_rxtx.c -+++ b/drivers/net/hns3/hns3_rxtx.c -@@ -1,5 +1,5 @@ - /* SPDX-License-Identifier: BSD-3-Clause -- * Copyright(c) 2018-2019 Hisilicon Limited. -+ * Copyright(c) 2018-2021 HiSilicon Limited. - */ - - #include -diff --git a/drivers/net/hns3/hns3_rxtx.h b/drivers/net/hns3/hns3_rxtx.h -index e01e582..56c1b80 100644 ---- a/drivers/net/hns3/hns3_rxtx.h -+++ b/drivers/net/hns3/hns3_rxtx.h -@@ -1,5 +1,5 @@ - /* SPDX-License-Identifier: BSD-3-Clause -- * Copyright(c) 2018-2019 Hisilicon Limited. -+ * Copyright(c) 2018-2021 HiSilicon Limited. - */ - - #ifndef _HNS3_RXTX_H_ -diff --git a/drivers/net/hns3/hns3_rxtx_vec.c b/drivers/net/hns3/hns3_rxtx_vec.c -index e37e858..15a0bd0 100644 ---- a/drivers/net/hns3/hns3_rxtx_vec.c -+++ b/drivers/net/hns3/hns3_rxtx_vec.c -@@ -1,5 +1,5 @@ - /* SPDX-License-Identifier: BSD-3-Clause -- * Copyright(c) 2020 Hisilicon Limited. -+ * Copyright(c) 2020-2021 HiSilicon Limited. - */ - - #include -diff --git a/drivers/net/hns3/hns3_rxtx_vec.h b/drivers/net/hns3/hns3_rxtx_vec.h -index 872ba22..67c75e4 100644 ---- a/drivers/net/hns3/hns3_rxtx_vec.h -+++ b/drivers/net/hns3/hns3_rxtx_vec.h -@@ -1,5 +1,5 @@ - /* SPDX-License-Identifier: BSD-3-Clause -- * Copyright(c) 2020 Hisilicon Limited. -+ * Copyright(c) 2020-2021 HiSilicon Limited. - */ - - #ifndef _HNS3_RXTX_VEC_H_ -diff --git a/drivers/net/hns3/hns3_rxtx_vec_neon.h b/drivers/net/hns3/hns3_rxtx_vec_neon.h -index 30a7d70..74c848d 100644 ---- a/drivers/net/hns3/hns3_rxtx_vec_neon.h -+++ b/drivers/net/hns3/hns3_rxtx_vec_neon.h -@@ -1,5 +1,5 @@ - /* SPDX-License-Identifier: BSD-3-Clause -- * Copyright(c) 2020 Hisilicon Limited. -+ * Copyright(c) 2020-2021 HiSilicon Limited. - */ - - #ifndef _HNS3_RXTX_VEC_NEON_H_ -diff --git a/drivers/net/hns3/hns3_rxtx_vec_sve.c b/drivers/net/hns3/hns3_rxtx_vec_sve.c -index c861887..84a31d8 100644 ---- a/drivers/net/hns3/hns3_rxtx_vec_sve.c -+++ b/drivers/net/hns3/hns3_rxtx_vec_sve.c -@@ -1,5 +1,5 @@ - /* SPDX-License-Identifier: BSD-3-Clause -- * Copyright(c) 2020 Hisilicon Limited. -+ * Copyright(c) 2020-2021 HiSilicon Limited. - */ - - #include -diff --git a/drivers/net/hns3/hns3_stats.c b/drivers/net/hns3/hns3_stats.c -index 464a33d..e09dc0d 100644 ---- a/drivers/net/hns3/hns3_stats.c -+++ b/drivers/net/hns3/hns3_stats.c -@@ -1,5 +1,5 @@ - /* SPDX-License-Identifier: BSD-3-Clause -- * Copyright(c) 2018-2019 Hisilicon Limited. -+ * Copyright(c) 2018-2021 HiSilicon Limited. - */ - - #include -diff --git a/drivers/net/hns3/hns3_stats.h b/drivers/net/hns3/hns3_stats.h -index 273be42..de5c40d 100644 ---- a/drivers/net/hns3/hns3_stats.h -+++ b/drivers/net/hns3/hns3_stats.h -@@ -1,5 +1,5 @@ - /* SPDX-License-Identifier: BSD-3-Clause -- * Copyright(c) 2018-2019 Hisilicon Limited. -+ * Copyright(c) 2018-2021 HiSilicon Limited. - */ - - #ifndef _HNS3_STATS_H_ -diff --git a/drivers/net/hns3/hns3_tm.c b/drivers/net/hns3/hns3_tm.c -index cd32664..db5ac78 100644 ---- a/drivers/net/hns3/hns3_tm.c -+++ b/drivers/net/hns3/hns3_tm.c -@@ -1,5 +1,5 @@ - /* SPDX-License-Identifier: BSD-3-Clause -- * Copyright(c) 2020-2020 Hisilicon Limited. -+ * Copyright(c) 2020-2021 HiSilicon Limited. - */ - - #include -diff --git a/drivers/net/hns3/hns3_tm.h b/drivers/net/hns3/hns3_tm.h -index 2286d0e..83e9cc8 100644 ---- a/drivers/net/hns3/hns3_tm.h -+++ b/drivers/net/hns3/hns3_tm.h -@@ -1,5 +1,5 @@ - /* SPDX-License-Identifier: BSD-3-Clause -- * Copyright(c) 2020-2020 Hisilicon Limited. -+ * Copyright(c) 2020-2021 HiSilicon Limited. - */ - - #ifndef _HNS3_TM_H_ -diff --git a/drivers/net/hns3/meson.build b/drivers/net/hns3/meson.build -index bf602af..881aff6 100644 ---- a/drivers/net/hns3/meson.build -+++ b/drivers/net/hns3/meson.build -@@ -1,5 +1,5 @@ - # SPDX-License-Identifier: BSD-3-Clause --# Copyright(c) 2018-2019 Hisilicon Limited -+# Copyright(c) 2018-2021 Hisilicon Limited - - if not is_linux - build = false --- -2.7.4 - diff --git a/0213-app-procinfo-dump-detailed-info-for-Rx-Tx-descriptor.patch b/0213-app-procinfo-dump-detailed-info-for-Rx-Tx-descriptor.patch new file mode 100644 index 0000000000000000000000000000000000000000..448904715745719027e3e9283bacdd28124d1ca1 --- /dev/null +++ b/0213-app-procinfo-dump-detailed-info-for-Rx-Tx-descriptor.patch @@ -0,0 +1,223 @@ +From 95af4fb4b6c89c9488637920c497849b9ffb1bc6 Mon Sep 17 00:00:00 2001 +From: Dongdong Liu +Date: Tue, 11 Oct 2022 19:18:42 +0800 +Subject: app/procinfo: dump detailed info for Rx/Tx descriptors + +[ upstream commit 6ff065b221b1048e27a0c9a9438d0f11e6fae06d ] + +This patch support Rx/Tx descriptor dump + +The command is like: +dpdk-proc-info -a xxxx:xx:xx.x --file-prefix=xxx -- +--show-rx-descriptor queue_id:offset:num + +dpdk-proc-info -a xxxx:xx:xx.x --file-prefix=xxx -- +--show-tx-descriptor queue_id:offset:num + +queue_id: A queue identifier on this port. +offset: The offset of the descriptor starting from tail. +num: The number of the descriptors to dump. + +Signed-off-by: Min Hu (Connor) +Signed-off-by: Dongdong Liu +Acked-by: Reshma Pattan +--- + app/proc-info/main.c | 104 +++++++++++++++++++++++++++++++++ + doc/guides/tools/proc_info.rst | 17 +++++- + 2 files changed, 120 insertions(+), 1 deletion(-) + +diff --git a/app/proc-info/main.c b/app/proc-info/main.c +index dc948c7cc5..0cc01e3dad 100644 +--- a/app/proc-info/main.c ++++ b/app/proc-info/main.c +@@ -117,6 +117,21 @@ static uint32_t enable_shw_rss_reta; + /* Enable show module eeprom information. */ + static uint32_t enable_shw_module_eeprom; + ++/* Enable dump Rx/Tx descriptor. */ ++static uint32_t enable_shw_rx_desc_dump; ++static uint32_t enable_shw_tx_desc_dump; ++ ++#define DESC_PARAM_NUM 3 ++ ++struct desc_param { ++ uint16_t queue_id; /* A queue identifier on this port. */ ++ uint16_t offset; /* The offset of the descriptor starting from tail. */ ++ uint16_t num; /* The number of the descriptors to dump. */ ++}; ++ ++static struct desc_param rx_desc_param; ++static struct desc_param tx_desc_param; ++ + /* display usage */ + static void + proc_info_usage(const char *prgname) +@@ -148,6 +163,14 @@ proc_info_usage(const char *prgname) + " --firmware-version: to display ethdev firmware version\n" + " --show-rss-reta: to display ports redirection table\n" + " --show-module-eeprom: to display ports module eeprom information\n" ++ " --show-rx-descriptor queue_id:offset:num to display ports Rx descriptor information. " ++ "queue_id: A Rx queue identifier on this port. " ++ "offset: The offset of the descriptor starting from tail. " ++ "num: The number of the descriptors to dump.\n" ++ " --show-tx-descriptor queue_id:offset:num to display ports Tx descriptor information. " ++ "queue_id: A Tx queue identifier on this port. " ++ "offset: The offset of the descriptor starting from tail. " ++ "num: The number of the descriptors to dump.\n" + " --iter-mempool=name: iterate mempool elements to display content\n" + " --dump-regs=file-prefix: dump registers to file with the file-prefix\n", + prgname); +@@ -200,6 +223,19 @@ parse_xstats_ids(char *list, uint64_t *ids, int limit) { + return length; + } + ++static int ++parse_descriptor_param(char *list, struct desc_param *desc) ++{ ++ int ret; ++ ++ ret = sscanf(list, "%hu:%hu:%hu", &desc->queue_id, &desc->offset, ++ &desc->num); ++ if (ret != DESC_PARAM_NUM) ++ return -EINVAL; ++ ++ return 0; ++} ++ + static int + proc_info_preparse_args(int argc, char **argv) + { +@@ -264,6 +300,8 @@ proc_info_parse_args(int argc, char **argv) + {"firmware-version", 0, NULL, 0}, + {"show-rss-reta", 0, NULL, 0}, + {"show-module-eeprom", 0, NULL, 0}, ++ {"show-rx-descriptor", required_argument, NULL, 1}, ++ {"show-tx-descriptor", required_argument, NULL, 1}, + {NULL, 0, 0, 0} + }; + +@@ -367,6 +405,26 @@ proc_info_parse_args(int argc, char **argv) + return -1; + } + nb_xstats_ids = ret; ++ } else if (!strncmp(long_option[option_index].name, ++ "show-rx-descriptor", MAX_LONG_OPT_SZ)) { ++ int ret = parse_descriptor_param(optarg, ++ &rx_desc_param); ++ if (ret < 0) { ++ fprintf(stderr, "Error parsing Rx descriptor param: %s\n", ++ strerror(-ret)); ++ return -1; ++ } ++ enable_shw_rx_desc_dump = 1; ++ } else if (!strncmp(long_option[option_index].name, ++ "show-tx-descriptor", MAX_LONG_OPT_SZ)) { ++ int ret = parse_descriptor_param(optarg, ++ &tx_desc_param); ++ if (ret < 0) { ++ fprintf(stderr, "Error parsing Tx descriptor param: %s\n", ++ strerror(-ret)); ++ return -1; ++ } ++ enable_shw_tx_desc_dump = 1; + } + break; + default: +@@ -1644,6 +1702,48 @@ show_module_eeprom_info(void) + } + } + ++static void ++nic_rx_descriptor_display(uint16_t port_id, struct desc_param *desc) ++{ ++ uint16_t queue_id = desc->queue_id; ++ uint16_t offset = desc->offset; ++ uint16_t num = desc->num; ++ int ret; ++ ++ snprintf(bdr_str, MAX_STRING_LEN, " show - Rx descriptor "); ++ STATS_BDR_STR(10, bdr_str); ++ ++ printf("Dump ethdev Rx descriptor for port %u, queue %u, offset %u, num %u\n", ++ port_id, queue_id, offset, num); ++ ++ ret = rte_eth_rx_descriptor_dump(port_id, queue_id, offset, num, ++ stdout); ++ if (ret < 0) ++ fprintf(stderr, "Error dumping ethdev Rx descriptor: %s\n", ++ strerror(-ret)); ++} ++ ++static void ++nic_tx_descriptor_display(uint16_t port_id, struct desc_param *desc) ++{ ++ uint16_t queue_id = desc->queue_id; ++ uint16_t offset = desc->offset; ++ uint16_t num = desc->num; ++ int ret; ++ ++ snprintf(bdr_str, MAX_STRING_LEN, " show - Tx descriptor "); ++ STATS_BDR_STR(10, bdr_str); ++ ++ printf("Dump ethdev Tx descriptor for port %u, queue %u, offset %u, num %u\n", ++ port_id, queue_id, offset, num); ++ ++ ret = rte_eth_tx_descriptor_dump(port_id, queue_id, offset, num, ++ stdout); ++ if (ret < 0) ++ fprintf(stderr, "Error dumping ethdev Tx descriptor: %s\n", ++ strerror(-ret)); ++} ++ + int + main(int argc, char **argv) + { +@@ -1732,6 +1832,10 @@ main(int argc, char **argv) + metrics_display(i); + #endif + ++ if (enable_shw_rx_desc_dump) ++ nic_rx_descriptor_display(i, &rx_desc_param); ++ if (enable_shw_tx_desc_dump) ++ nic_tx_descriptor_display(i, &tx_desc_param); + } + + #ifdef RTE_LIB_METRICS +diff --git a/doc/guides/tools/proc_info.rst b/doc/guides/tools/proc_info.rst +index dc5d017cff..cf3502a8cb 100644 +--- a/doc/guides/tools/proc_info.rst ++++ b/doc/guides/tools/proc_info.rst +@@ -21,7 +21,8 @@ The application has a number of command line options: + --stats-reset | --xstats-reset] [ --show-port | --show-tm | --show-crypto | + --show-ring[=name] | --show-mempool[=name] | --iter-mempool=name | + --show-port-private | --version | --firmware-version | --show-rss-reta | +- --show-module-eeprom ] ++ --show-module-eeprom | --show-rx-descriptor queue_id:offset:num | ++ --show-tx-descriptor queue_id:offset:num ] + + Parameters + ~~~~~~~~~~ +@@ -86,6 +87,20 @@ The show-rss-reta parameter displays ports rss redirection table. + **--show-module-eeprom** + The show-module-eeprom parameter displays ports module eeprom information. + ++**--show-rx-descriptor queue_id:offset:num** ++The show-rx-descriptor parameter displays ports Rx descriptor information ++specified by queue_id, offset and num. ++queue_id: A Rx queue identifier on this port. ++offset: The offset of the descriptor starting from tail. ++num: The number of the descriptors to dump. ++ ++**--show-tx-descriptor queue_id:offset:num** ++The show-tx-descriptor parameter displays ports Tx descriptor information ++specified by queue_id, offset and num. ++queue_id: A Tx queue identifier on this port. ++offset: The offset of the descriptor starting from tail. ++num: The number of the descriptors to dump. ++ + Limitations + ----------- + +-- +2.23.0 + diff --git a/0213-app-testpmd-change-port-link-speed-without-stopping-.patch b/0213-app-testpmd-change-port-link-speed-without-stopping-.patch deleted file mode 100644 index 0e3309f3b29008786a375f0d7fdd278d47aca932..0000000000000000000000000000000000000000 --- a/0213-app-testpmd-change-port-link-speed-without-stopping-.patch +++ /dev/null @@ -1,46 +0,0 @@ -From 3e1dae547da0a58b31d551edee18511232ba5716 Mon Sep 17 00:00:00 2001 -From: Huisong Li -Date: Wed, 28 Apr 2021 16:36:59 +0800 -Subject: [PATCH 10/26] app/testpmd: change port link speed without stopping - all - -When we use the following cmd to modify the link speed of specified -port: "port config speed xxx duplex xxx", we have to stop -all ports. It's not necessary. - -Fixes: 82113036e4e5 ("ethdev: redesign link speed config") -Cc: stable@dpdk.org - -Signed-off-by: Huisong Li -Signed-off-by: Min Hu (Connor) -Acked-by: Ferruh Yigit -Acked-by: Xiaoyun Li ---- - app/test-pmd/cmdline.c | 8 ++++---- - 1 file changed, 4 insertions(+), 4 deletions(-) - -diff --git a/app/test-pmd/cmdline.c b/app/test-pmd/cmdline.c -index 78db462..b69c648 100644 ---- a/app/test-pmd/cmdline.c -+++ b/app/test-pmd/cmdline.c -@@ -1613,13 +1613,13 @@ cmd_config_speed_specific_parsed(void *parsed_result, - struct cmd_config_speed_specific *res = parsed_result; - uint32_t link_speed; - -- if (!all_ports_stopped()) { -- printf("Please stop all ports first\n"); -+ if (port_id_is_invalid(res->id, ENABLED_WARN)) - return; -- } - -- if (port_id_is_invalid(res->id, ENABLED_WARN)) -+ if (!port_is_stopped(res->id)) { -+ printf("Please stop port %d first\n", res->id); - return; -+ } - - if (parse_and_check_speed_duplex(res->value1, res->value2, - &link_speed) < 0) --- -2.7.4 - diff --git a/0214-ethdev-add-dev-configured-flag.patch b/0214-ethdev-add-dev-configured-flag.patch deleted file mode 100644 index 2002bc53d8236f636d6919a5e25279d5155f22be..0000000000000000000000000000000000000000 --- a/0214-ethdev-add-dev-configured-flag.patch +++ /dev/null @@ -1,107 +0,0 @@ -From f38367e915cd94db9dc3e178eeff114e605d1f1c Mon Sep 17 00:00:00 2001 -From: Huisong Li -Date: Wed, 7 Jul 2021 17:53:34 +0800 -Subject: [PATCH 11/26] ethdev: add dev configured flag - -Currently, if dev_configure is not called or fails to be called, users -can still call dev_start successfully. So it is necessary to have a flag -which indicates whether the device is configured, to control whether -dev_start can be called and eliminate dependency on user invocation order. - -The flag stored in "struct rte_eth_dev_data" is more reasonable than - "enum rte_eth_dev_state". "enum rte_eth_dev_state" is private to the -primary and secondary processes, and can be independently controlled. -However, the secondary process does not make resource allocations and -does not call dev_configure(). These are done by the primary process -and can be obtained or used by the secondary process. So this patch -adds a "dev_configured" flag in "rte_eth_dev_data", like "dev_started". - -Signed-off-by: Huisong Li -Reviewed-by: Andrew Rybchenko -Acked-by: Konstantin Ananyev - -libabigail raised a warning on this change. -This change is fine wrt ABI as far as we understand, but we can't -express an exception rule (see libabigail bug #28060) to waive the -changes only in this part of the rte_eth_dev_data struct. -The solution for now is to globally waive any change on the -rte_eth_dev_data structure. - -Signed-off-by: David Marchand ---- - devtools/libabigail.abignore | 7 +++++++ - lib/librte_ethdev/rte_ethdev.c | 11 +++++++++++ - lib/librte_ethdev/rte_ethdev_core.h | 6 +++++- - 3 files changed, 23 insertions(+), 1 deletion(-) - -diff --git a/devtools/libabigail.abignore b/devtools/libabigail.abignore -index b649af1..80eb0ab 100644 ---- a/devtools/libabigail.abignore -+++ b/devtools/libabigail.abignore -@@ -16,3 +16,10 @@ - [suppress_type] - name = rte_eth_txq_info - has_data_member_inserted_between = {offset_after(nb_desc), end} -+ -+; Ignore all changes to rte_eth_dev_data -+; Note: we only cared about dev_configured bit addition, but libabigail -+; seems to wrongly compute bitfields offset. -+; https://sourceware.org/bugzilla/show_bug.cgi?id=28060 -+[suppress_type] -+ name = rte_eth_dev_data -diff --git a/lib/librte_ethdev/rte_ethdev.c b/lib/librte_ethdev/rte_ethdev.c -index 87d1b56..4bed431 100644 ---- a/lib/librte_ethdev/rte_ethdev.c -+++ b/lib/librte_ethdev/rte_ethdev.c -@@ -1543,6 +1543,8 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q, - } - - rte_ethdev_trace_configure(port_id, nb_rx_q, nb_tx_q, dev_conf, 0); -+ dev->data->dev_configured = 1; -+ - return 0; - reset_queues: - eth_dev_rx_queue_config(dev, 0); -@@ -1551,6 +1553,8 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q, - memcpy(&dev->data->dev_conf, &orig_conf, sizeof(dev->data->dev_conf)); - - rte_ethdev_trace_configure(port_id, nb_rx_q, nb_tx_q, dev_conf, ret); -+ dev->data->dev_configured = 0; -+ - return ret; - } - -@@ -1687,6 +1691,13 @@ rte_eth_dev_start(uint16_t port_id) - - RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_start, -ENOTSUP); - -+ if (dev->data->dev_configured == 0) { -+ RTE_ETHDEV_LOG(INFO, -+ "Device with port_id=%"PRIu16" is not configured.\n", -+ port_id); -+ return -EINVAL; -+ } -+ - if (dev->data->dev_started != 0) { - RTE_ETHDEV_LOG(INFO, - "Device with port_id=%"PRIu16" already started\n", -diff --git a/lib/librte_ethdev/rte_ethdev_core.h b/lib/librte_ethdev/rte_ethdev_core.h -index 918a34e..8d97dd1 100644 ---- a/lib/librte_ethdev/rte_ethdev_core.h -+++ b/lib/librte_ethdev/rte_ethdev_core.h -@@ -168,7 +168,11 @@ struct rte_eth_dev_data { - scattered_rx : 1, /**< RX of scattered packets is ON(1) / OFF(0) */ - all_multicast : 1, /**< RX all multicast mode ON(1) / OFF(0). */ - dev_started : 1, /**< Device state: STARTED(1) / STOPPED(0). */ -- lro : 1; /**< RX LRO is ON(1) / OFF(0) */ -+ lro : 1, /**< RX LRO is ON(1) / OFF(0) */ -+ dev_configured : 1; -+ /**< Device configuration state: -+ * CONFIGURED(1) / NOT CONFIGURED(0). -+ */ - uint8_t rx_queue_state[RTE_MAX_QUEUES_PER_PORT]; - /**< Queues state: HAIRPIN(2) / STARTED(1) / STOPPED(0). */ - uint8_t tx_queue_state[RTE_MAX_QUEUES_PER_PORT]; --- -2.7.4 - diff --git a/CVE-2021-3839.patch b/CVE-2021-3839.patch new file mode 100644 index 0000000000000000000000000000000000000000..9d8e1b7c77bdb9982f08a2285c65ee5e8b0d52ec --- /dev/null +++ b/CVE-2021-3839.patch @@ -0,0 +1,39 @@ +From 4c40d30d2bc8a35b81d1d386e6674acee49acded Mon Sep 17 00:00:00 2001 +From: Chenbo Xia +Date: Mon, 14 Feb 2022 16:32:37 +0800 +Subject: vhost: fix queue number check when setting inflight FD + +[ upstream commit 6442c329b9d2ded0f44b27d2016aaba8ba5844c5 ] + +In function vhost_user_set_inflight_fd, queue number in inflight +message is used to access virtqueue. However, queue number could +be larger than VHOST_MAX_VRING and cause write OOB as this number +will be used to write inflight info in virtqueue structure. This +patch checks the queue number to avoid the issue and also make +sure virtqueues are allocated before setting inflight information. + +Fixes: ad0a4ae491fe ("vhost: checkout resubmit inflight information") + +Reported-by: Wenxiang Qian +Signed-off-by: Chenbo Xia +Reviewed-by: Maxime Coquelin +--- + lib/vhost/vhost_user.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/lib/vhost/vhost_user.c b/lib/vhost/vhost_user.c +index 850ac49169..d4b0ec7358 100644 +--- a/lib/vhost/vhost_user.c ++++ b/lib/vhost/vhost_user.c +@@ -2876,6 +2876,9 @@ vhost_user_check_and_alloc_queue_pair(struct virtio_net *dev, + case VHOST_USER_SET_VRING_ADDR: + vring_idx = msg->payload.addr.index; + break; ++ case VHOST_USER_SET_INFLIGHT_FD: ++ vring_idx = msg->payload.inflight.num_queues - 1; ++ break; + default: + return 0; + } +-- +cgit v1.2.1 diff --git a/CVE-2022-0669.patch b/CVE-2022-0669.patch new file mode 100644 index 0000000000000000000000000000000000000000..9b86bc6ca0ccd690e2944a32396f6630698d04f9 --- /dev/null +++ b/CVE-2022-0669.patch @@ -0,0 +1,44 @@ +From 6cb68162e4b598b7c0747372fa3fcec9cddd19b8 Mon Sep 17 00:00:00 2001 +From: David Marchand +Date: Tue, 18 Jan 2022 15:53:30 +0100 +Subject: vhost: fix FD leak with inflight messages + +[ upstream commit af74f7db384ed149fe42b21dbd7975f8a54ef227 ] + +Even if unlikely, a buggy vhost-user master might attach fds to inflight +messages. Add checks like for other types of vhost-user messages. + +Fixes: d87f1a1cb7b6 ("vhost: support inflight info sharing") + +Signed-off-by: David Marchand +Reviewed-by: Maxime Coquelin +--- + lib/vhost/vhost_user.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/lib/vhost/vhost_user.c b/lib/vhost/vhost_user.c +index d4b0ec7358..9a266b5d42 100644 +--- a/lib/vhost/vhost_user.c ++++ b/lib/vhost/vhost_user.c +@@ -1600,6 +1600,9 @@ vhost_user_get_inflight_fd(struct virtio_net **pdev, + int numa_node = SOCKET_ID_ANY; + void *addr; + ++ if (validate_msg_fds(msg, 0) != 0) ++ return RTE_VHOST_MSG_RESULT_ERR; ++ + if (msg->size != sizeof(msg->payload.inflight)) { + VHOST_LOG_CONFIG(ERR, + "invalid get_inflight_fd message size is %d\n", +@@ -1701,6 +1704,9 @@ vhost_user_set_inflight_fd(struct virtio_net **pdev, VhostUserMsg *msg, + int fd, i; + int numa_node = SOCKET_ID_ANY; + ++ if (validate_msg_fds(msg, 1) != 0) ++ return RTE_VHOST_MSG_RESULT_ERR; ++ + fd = msg->fds[0]; + if (msg->size != sizeof(msg->payload.inflight) || fd < 0) { + VHOST_LOG_CONFIG(ERR, +-- +cgit v1.2.1 diff --git a/backport-0001-CVE-2022-2132.patch b/backport-0001-CVE-2022-2132.patch new file mode 100644 index 0000000000000000000000000000000000000000..571f57bf47df5878f91802d787522bddb714eaee --- /dev/null +++ b/backport-0001-CVE-2022-2132.patch @@ -0,0 +1,104 @@ +From e12d415556994d0901c317f6338ed2961185465f Mon Sep 17 00:00:00 2001 +From: Maxime Coquelin +Date: Thu, 16 Jun 2022 14:25:07 +0200 +Subject: [PATCH] vhost: fix header spanned across more than two descriptors + +[ upstream commit dc1516e260a0df272b218392faf6db3cbf45e717 ] + +This patch aims at supporting the unlikely case where a +Virtio-net header is spanned across more than two +descriptors. + +CVE-2022-2132 +Fixes: fd68b4739d2c ("vhost: use buffer vectors in dequeue path") + +Signed-off-by: Maxime Coquelin +Acked-by: Chenbo Xia +Reviewed-by: David Marchand +Conflict: NA +Reference: https://git.dpdk.org/dpdk-stable/commit/?id=e12d415556 +--- + lib/vhost/virtio_net.c | 41 +++++++++++++---------------------------- + 1 file changed, 13 insertions(+), 28 deletions(-) + +diff --git a/lib/vhost/virtio_net.c b/lib/vhost/virtio_net.c +index 991a7a2bd4..bf4d75b4bd 100644 +--- a/lib/vhost/virtio_net.c ++++ b/lib/vhost/virtio_net.c +@@ -2322,25 +2322,22 @@ copy_desc_to_mbuf(struct virtio_net *dev, struct vhost_virtqueue *vq, + uint32_t buf_avail, buf_offset; + uint64_t buf_addr, buf_len; + uint32_t mbuf_avail, mbuf_offset; ++ uint32_t hdr_remain = dev->vhost_hlen; + uint32_t cpy_len; + struct rte_mbuf *cur = m, *prev = m; + struct virtio_net_hdr tmp_hdr; + struct virtio_net_hdr *hdr = NULL; +- /* A counter to avoid desc dead loop chain */ +- uint16_t vec_idx = 0; ++ uint16_t vec_idx; + struct batch_copy_elem *batch_copy = vq->batch_copy_elems; + int error = 0; + +- buf_addr = buf_vec[vec_idx].buf_addr; +- buf_len = buf_vec[vec_idx].buf_len; +- + if (unlikely(buf_len < dev->vhost_hlen && nr_vec <= 1)) { + error = -1; + goto out; + } + + if (virtio_net_with_host_offload(dev)) { +- if (unlikely(buf_len < sizeof(struct virtio_net_hdr))) { ++ if (unlikely(buf_vec[0].buf_len < sizeof(struct virtio_net_hdr))) { + /* + * No luck, the virtio-net header doesn't fit + * in a contiguous virtual area. +@@ -2348,34 +2345,22 @@ copy_desc_to_mbuf(struct virtio_net *dev, struct vhost_virtqueue *vq, + copy_vnet_hdr_from_desc(&tmp_hdr, buf_vec); + hdr = &tmp_hdr; + } else { +- hdr = (struct virtio_net_hdr *)((uintptr_t)buf_addr); ++ hdr = (struct virtio_net_hdr *)((uintptr_t)buf_vec[0].buf_addr); + } + } + +- /* +- * A virtio driver normally uses at least 2 desc buffers +- * for Tx: the first for storing the header, and others +- * for storing the data. +- */ +- if (unlikely(buf_len < dev->vhost_hlen)) { +- buf_offset = dev->vhost_hlen - buf_len; +- vec_idx++; +- buf_addr = buf_vec[vec_idx].buf_addr; +- buf_len = buf_vec[vec_idx].buf_len; +- buf_avail = buf_len - buf_offset; +- } else if (buf_len == dev->vhost_hlen) { +- if (unlikely(++vec_idx >= nr_vec)) +- goto out; +- buf_addr = buf_vec[vec_idx].buf_addr; +- buf_len = buf_vec[vec_idx].buf_len; ++ for (vec_idx = 0; vec_idx < nr_vec; vec_idx++) { ++ if (buf_vec[vec_idx].buf_len > hdr_remain) ++ break; + +- buf_offset = 0; +- buf_avail = buf_len; +- } else { +- buf_offset = dev->vhost_hlen; +- buf_avail = buf_vec[vec_idx].buf_len - dev->vhost_hlen; ++ hdr_remain -= buf_vec[vec_idx].buf_len; + } + ++ buf_addr = buf_vec[vec_idx].buf_addr; ++ buf_len = buf_vec[vec_idx].buf_len; ++ buf_offset = hdr_remain; ++ buf_avail = buf_vec[vec_idx].buf_len - hdr_remain; ++ + PRINT_PACKET(dev, + (uintptr_t)(buf_addr + buf_offset), + (uint32_t)buf_avail, 0); +-- +2.23.0 + diff --git a/backport-0002-CVE-2022-2132.patch b/backport-0002-CVE-2022-2132.patch new file mode 100644 index 0000000000000000000000000000000000000000..a9a83c68495017d2a34512da6ed1b878a6f68c47 --- /dev/null +++ b/backport-0002-CVE-2022-2132.patch @@ -0,0 +1,79 @@ +From f167022606b5ccca27a627ae599538ce2348ef67 Mon Sep 17 00:00:00 2001 +From: Maxime Coquelin +Date: Thu, 16 Jun 2022 11:35:56 +0200 +Subject: [PATCH] vhost: discard too small descriptor chains + +[ upstream commit 71bd0cc536ad6d84188d947d6f24c17400d8f623 ] + +This patch discards descriptor chains which are smaller +than the Virtio-net header size, and ones that are equal. + +Indeed, such descriptor chains sizes mean there is no +packet data. + +This patch also has the advantage of requesting the exact +packets sizes for the mbufs. + +CVE-2022-2132 +Fixes: 62250c1d0978 ("vhost: extract split ring handling from Rx and Tx functions") +Fixes: c3ff0ac70acb ("vhost: improve performance by supporting large buffer") +Fixes: 84d5204310d7 ("vhost: support async dequeue for split ring") + +Signed-off-by: Maxime Coquelin +Acked-by: Chenbo Xia +Reviewed-by: David Marchand +Conflict: NA +Reference: https://git.dpdk.org/dpdk-stable/commit/?id=f16702260 +--- + lib/vhost/virtio_net.c | 21 +++++++++++++++++---- + 1 file changed, 17 insertions(+), 4 deletions(-) + +diff --git a/lib/vhost/virtio_net.c b/lib/vhost/virtio_net.c +index 858187d1b0..991a7a2bd4 100644 +--- a/lib/vhost/virtio_net.c ++++ b/lib/vhost/virtio_net.c +@@ -2334,10 +2334,10 @@ copy_desc_to_mbuf(struct virtio_net *dev, struct vhost_virtqueue *vq, + struct batch_copy_elem *batch_copy = vq->batch_copy_elems; + int error = 0; + +- if (unlikely(buf_len < dev->vhost_hlen && nr_vec <= 1)) { +- error = -1; +- goto out; +- } ++ /* ++ * The caller has checked the descriptors chain is larger than the ++ * header size. ++ */ + + if (virtio_net_with_host_offload(dev)) { + if (unlikely(buf_vec[0].buf_len < sizeof(struct virtio_net_hdr))) { +@@ -2568,6 +2568,14 @@ virtio_dev_tx_split(struct virtio_net *dev, struct vhost_virtqueue *vq, + + update_shadow_used_ring_split(vq, head_idx, 0); + ++ if (unlikely(buf_len <= dev->vhost_hlen)) { ++ dropped += 1; ++ i++; ++ break; ++ } ++ ++ buf_len -= dev->vhost_hlen; ++ + err = virtio_dev_pktmbuf_prep(dev, pkts[i], buf_len); + if (unlikely(err)) { + /* +@@ -2771,6 +2779,11 @@ vhost_dequeue_single_packed(struct virtio_net *dev, + VHOST_ACCESS_RO) < 0)) + return -1; + ++ if (unlikely(buf_len <= dev->vhost_hlen)) ++ return -1; ++ ++ buf_len -= dev->vhost_hlen; ++ + if (unlikely(virtio_dev_pktmbuf_prep(dev, pkts, buf_len))) { + if (!allocerr_warned) { + VHOST_LOG_DATA(ERR, +-- +2.23.0 + diff --git a/backport-CVE-2022-28199.patch b/backport-CVE-2022-28199.patch new file mode 100644 index 0000000000000000000000000000000000000000..d442e2735ea53c2cfa37ca889f8c6993eddea2cd --- /dev/null +++ b/backport-CVE-2022-28199.patch @@ -0,0 +1,138 @@ +From 25c01bd32374b0c3cbc260f3e3872408d749cb45 Mon Sep 17 00:00:00 2001 +From: Matan Azrad +Date: Thu, 11 Aug 2022 19:59:18 +0300 +Subject: [PATCH] net/mlx5: fix Rx queue recovery mechanism + +[ upstream commit 60b254e3923d007bcadbb8d410f95ad89a2f13fa ] + +The local variables are getting inconsistent in data receiving routines +after queue error recovery. +Receive queue consumer index is getting wrong, need to reset one to the +size of the queue (as RQ was fully replenished in recovery procedure). + +In MPRQ case, also the local consumed strd variable should be reset. + +CVE-2022-28199 +Fixes: 88c0733535d6 ("net/mlx5: extend Rx completion with error handling") + +Signed-off-by: Alexander Kozyrev +Signed-off-by: Matan Azrad +Conflict: NA +Reference: https://git.dpdk.org/dpdk-stable/commit/?id=25c01db32374 +--- + drivers/net/mlx5/mlx5_rx.c | 34 ++++++++++++++++++++++++---------- + 1 file changed, 24 insertions(+), 10 deletions(-) + +diff --git a/drivers/net/mlx5/mlx5_rx.c b/drivers/net/mlx5/mlx5_rx.c +index f388fcc313..9fcd039c22 100644 +--- a/drivers/net/mlx5/mlx5_rx.c ++++ b/drivers/net/mlx5/mlx5_rx.c +@@ -390,6 +390,11 @@ mlx5_rxq_initialize(struct mlx5_rxq_data *rxq) + *rxq->rq_db = rte_cpu_to_be_32(rxq->rq_ci); + } + ++/* Must be negative. */ ++#define MLX5_ERROR_CQE_RET (-1) ++/* Must not be negative. */ ++#define MLX5_RECOVERY_ERROR_RET 0 ++ + /** + * Handle a Rx error. + * The function inserts the RQ state to reset when the first error CQE is +@@ -404,7 +409,7 @@ mlx5_rxq_initialize(struct mlx5_rxq_data *rxq) + * 0 when called from non-vectorized Rx burst. + * + * @return +- * -1 in case of recovery error, otherwise the CQE status. ++ * MLX5_RECOVERY_ERROR_RET in case of recovery error, otherwise the CQE status. + */ + int + mlx5_rx_err_handle(struct mlx5_rxq_data *rxq, uint8_t vec) +@@ -433,7 +438,7 @@ mlx5_rx_err_handle(struct mlx5_rxq_data *rxq, uint8_t vec) + sm.queue_id = rxq->idx; + sm.state = IBV_WQS_RESET; + if (mlx5_queue_state_modify(RXQ_DEV(rxq_ctrl), &sm)) +- return -1; ++ return MLX5_RECOVERY_ERROR_RET; + if (rxq_ctrl->dump_file_n < + RXQ_PORT(rxq_ctrl)->config.max_dump_files_num) { + MKSTR(err_str, "Unexpected CQE error syndrome " +@@ -473,7 +478,7 @@ mlx5_rx_err_handle(struct mlx5_rxq_data *rxq, uint8_t vec) + sm.queue_id = rxq->idx; + sm.state = IBV_WQS_RDY; + if (mlx5_queue_state_modify(RXQ_DEV(rxq_ctrl), &sm)) +- return -1; ++ return MLX5_RECOVERY_ERROR_RET; + if (vec) { + const uint32_t elts_n = + mlx5_rxq_mprq_enabled(rxq) ? +@@ -501,7 +506,7 @@ mlx5_rx_err_handle(struct mlx5_rxq_data *rxq, uint8_t vec) + rte_pktmbuf_free_seg + (*elt); + } +- return -1; ++ return MLX5_RECOVERY_ERROR_RET; + } + } + for (i = 0; i < (int)elts_n; ++i) { +@@ -520,7 +525,7 @@ mlx5_rx_err_handle(struct mlx5_rxq_data *rxq, uint8_t vec) + } + return ret; + default: +- return -1; ++ return MLX5_RECOVERY_ERROR_RET; + } + } + +@@ -538,7 +543,9 @@ mlx5_rx_err_handle(struct mlx5_rxq_data *rxq, uint8_t vec) + * written. + * + * @return +- * 0 in case of empty CQE, otherwise the packet size in bytes. ++ * 0 in case of empty CQE, MLX5_ERROR_CQE_RET in case of error CQE, ++ * otherwise the packet size in regular RxQ, and striding byte ++ * count format in mprq case. + */ + static inline int + mlx5_rx_poll_len(struct mlx5_rxq_data *rxq, volatile struct mlx5_cqe *cqe, +@@ -605,8 +612,8 @@ mlx5_rx_poll_len(struct mlx5_rxq_data *rxq, volatile struct mlx5_cqe *cqe, + rxq->err_state)) { + ret = mlx5_rx_err_handle(rxq, 0); + if (ret == MLX5_CQE_STATUS_HW_OWN || +- ret == -1) +- return 0; ++ ret == MLX5_RECOVERY_ERROR_RET) ++ return MLX5_ERROR_CQE_RET; + } else { + return 0; + } +@@ -851,8 +858,10 @@ mlx5_rx_burst(void *dpdk_rxq, struct rte_mbuf **pkts, uint16_t pkts_n) + if (!pkt) { + cqe = &(*rxq->cqes)[rxq->cq_ci & cqe_cnt]; + len = mlx5_rx_poll_len(rxq, cqe, cqe_cnt, &mcqe); +- if (!len) { ++ if (len <= 0) { + rte_mbuf_raw_free(rep); ++ if (unlikely(len == MLX5_ERROR_CQE_RET)) ++ rq_ci = rxq->rq_ci << sges_n; + break; + } + pkt = seg; +@@ -1075,8 +1084,13 @@ mlx5_rx_burst_mprq(void *dpdk_rxq, struct rte_mbuf **pkts, uint16_t pkts_n) + } + cqe = &(*rxq->cqes)[rxq->cq_ci & cq_mask]; + ret = mlx5_rx_poll_len(rxq, cqe, cq_mask, &mcqe); +- if (!ret) ++ if (ret == 0) ++ break; ++ if (unlikely(ret == MLX5_ERROR_CQE_RET)) { ++ rq_ci = rxq->rq_ci; ++ consumed_strd = rxq->consumed_strd; + break; ++ } + byte_cnt = ret; + len = (byte_cnt & MLX5_MPRQ_LEN_MASK) >> MLX5_MPRQ_LEN_SHIFT; + MLX5_ASSERT((int)len >= (rxq->crc_present << 2)); +-- +2.23.0 + diff --git a/backport-gro-check-payload-length-after-trim.patch b/backport-gro-check-payload-length-after-trim.patch new file mode 100644 index 0000000000000000000000000000000000000000..f1f1a888f9dfa3b90176047625a5f7aca7980865 --- /dev/null +++ b/backport-gro-check-payload-length-after-trim.patch @@ -0,0 +1,82 @@ +From 72f51b097a71fb9bdea13bdd254ff620b34c852e Mon Sep 17 00:00:00 2001 +From: Kumara Parameshwaran +Date: Sun, 16 Oct 2022 20:13:05 +0530 +Subject: [PATCH] gro: check payload length after trim + +When packet is padded with extra bytes the +the validation of the payload length should be done +after the trim operation + +Fixes: b8a55871d5af ("gro: trim tail padding bytes") +Cc: stable@dpdk.org + +Signed-off-by: Kumara Parameshwaran +Acked-by: Jiayu Hu +--- + lib/gro/gro_tcp4.c | 11 ++++++----- + lib/gro/gro_udp4.c | 10 +++++----- + 2 files changed, 11 insertions(+), 10 deletions(-) + +diff --git a/lib/gro/gro_tcp4.c b/lib/gro/gro_tcp4.c +index 8f5e800250..0014096e63 100644 +--- a/lib/gro/gro_tcp4.c ++++ b/lib/gro/gro_tcp4.c +@@ -225,6 +225,12 @@ gro_tcp4_reassemble(struct rte_mbuf *pkt, + */ + if (tcp_hdr->tcp_flags != RTE_TCP_ACK_FLAG) + return -1; ++ ++ /* trim the tail padding bytes */ ++ ip_tlen = rte_be_to_cpu_16(ipv4_hdr->total_length); ++ if (pkt->pkt_len > (uint32_t)(ip_tlen + pkt->l2_len)) ++ rte_pktmbuf_trim(pkt, pkt->pkt_len - ip_tlen - pkt->l2_len); ++ + /* + * Don't process the packet whose payload length is less than or + * equal to 0. +@@ -233,11 +239,6 @@ gro_tcp4_reassemble(struct rte_mbuf *pkt, + if (tcp_dl <= 0) + return -1; + +- /* trim the tail padding bytes */ +- ip_tlen = rte_be_to_cpu_16(ipv4_hdr->total_length); +- if (pkt->pkt_len > (uint32_t)(ip_tlen + pkt->l2_len)) +- rte_pktmbuf_trim(pkt, pkt->pkt_len - ip_tlen - pkt->l2_len); +- + /* + * Save IPv4 ID for the packet whose DF bit is 0. For the packet + * whose DF bit is 1, IPv4 ID is ignored. +diff --git a/lib/gro/gro_udp4.c b/lib/gro/gro_udp4.c +index 839f9748b7..42596d33b6 100644 +--- a/lib/gro/gro_udp4.c ++++ b/lib/gro/gro_udp4.c +@@ -220,6 +220,11 @@ gro_udp4_reassemble(struct rte_mbuf *pkt, + if (!is_ipv4_fragment(ipv4_hdr)) + return -1; + ++ ip_dl = rte_be_to_cpu_16(ipv4_hdr->total_length); ++ /* trim the tail padding bytes */ ++ if (pkt->pkt_len > (uint32_t)(ip_dl + pkt->l2_len)) ++ rte_pktmbuf_trim(pkt, pkt->pkt_len - ip_dl - pkt->l2_len); ++ + /* + * Don't process the packet whose payload length is less than or + * equal to 0. +@@ -227,14 +232,9 @@ gro_udp4_reassemble(struct rte_mbuf *pkt, + if (pkt->pkt_len <= hdr_len) + return -1; + +- ip_dl = rte_be_to_cpu_16(ipv4_hdr->total_length); + if (ip_dl <= pkt->l3_len) + return -1; + +- /* trim the tail padding bytes */ +- if (pkt->pkt_len > (uint32_t)(ip_dl + pkt->l2_len)) +- rte_pktmbuf_trim(pkt, pkt->pkt_len - ip_dl - pkt->l2_len); +- + ip_dl -= pkt->l3_len; + ip_id = rte_be_to_cpu_16(ipv4_hdr->packet_id); + frag_offset = rte_be_to_cpu_16(ipv4_hdr->fragment_offset); +-- +2.23.0 + diff --git a/backport-gro-fix-chain-index-for-more-than-2-packets.patch b/backport-gro-fix-chain-index-for-more-than-2-packets.patch new file mode 100644 index 0000000000000000000000000000000000000000..5ae482347e6f241ae4063652cb66f9cafbe2afb9 --- /dev/null +++ b/backport-gro-fix-chain-index-for-more-than-2-packets.patch @@ -0,0 +1,31 @@ +From bc4a7f7ee0281d96b8d93ac2771135a670b4a00f Mon Sep 17 00:00:00 2001 +From: Kumara Parameshwaran +Date: Wed, 7 Sep 2022 15:02:05 +0530 +Subject: [PATCH] gro: fix chain index for more than 2 packets + +When more than two packets are merged in a flow, and if we receive +a 3rd packet which is matching the sequence of the 2nd packet the +prev_idx will be 1 and not 2, hence resulting in packet re-ordering + +Signed-off-by: Kumara Parameshwaran +Acked-by: Jiayu Hu +--- + lib/gro/gro_tcp4.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/lib/gro/gro_tcp4.c b/lib/gro/gro_tcp4.c +index 7498c66141..9758e28fd5 100644 +--- a/lib/gro/gro_tcp4.c ++++ b/lib/gro/gro_tcp4.c +@@ -305,7 +305,7 @@ gro_tcp4_reassemble(struct rte_mbuf *pkt, + * length is greater than the max value. Store + * the packet into the flow. + */ +- if (insert_new_item(tbl, pkt, start_time, prev_idx, ++ if (insert_new_item(tbl, pkt, start_time, cur_idx, + sent_seq, ip_id, is_atomic) == + INVALID_ARRAY_INDEX) + return -1; +-- +2.23.0 + diff --git a/backport-gro-trim-tail-padding-bytes.patch b/backport-gro-trim-tail-padding-bytes.patch new file mode 100644 index 0000000000000000000000000000000000000000..f34d4a93fe5b62eba9a6172419480ee18797789b --- /dev/null +++ b/backport-gro-trim-tail-padding-bytes.patch @@ -0,0 +1,68 @@ +From b8a55871d5af6f5b8694b1cb5eacbc629734e403 Mon Sep 17 00:00:00 2001 +From: Jun Qiu +Date: Wed, 27 Jul 2022 08:00:36 +0000 +Subject: [PATCH] gro: trim tail padding bytes + +Exclude CRC fields, the minimum Ethernet packet +length is 60 bytes. When the actual packet length +is less than 60 bytes, padding is added to the tail. +When GRO is performed on a packet containing a padding +field, mbuf->pkt_len is the one that contains the +padding field, which leads to the error of thinking +of the padding field as the actual content of the packet. +We need to trim away this extra padding field during +GRO processing. + +Fixes: 0d2cbe59b719 ("lib/gro: support TCP/IPv4") +Cc: stable@dpdk.org + +Signed-off-by: Jun Qiu +Acked-by: Jiayu Hu +--- + lib/gro/gro_tcp4.c | 7 ++++++- + lib/gro/gro_udp4.c | 4 ++++ + 2 files changed, 10 insertions(+), 1 deletion(-) + +diff --git a/lib/gro/gro_tcp4.c b/lib/gro/gro_tcp4.c +index 9758e28fd5..8f5e800250 100644 +--- a/lib/gro/gro_tcp4.c ++++ b/lib/gro/gro_tcp4.c +@@ -198,7 +198,7 @@ gro_tcp4_reassemble(struct rte_mbuf *pkt, + struct rte_tcp_hdr *tcp_hdr; + uint32_t sent_seq; + int32_t tcp_dl; +- uint16_t ip_id, hdr_len, frag_off; ++ uint16_t ip_id, hdr_len, frag_off, ip_tlen; + uint8_t is_atomic; + + struct tcp4_flow_key key; +@@ -233,6 +233,11 @@ gro_tcp4_reassemble(struct rte_mbuf *pkt, + if (tcp_dl <= 0) + return -1; + ++ /* trim the tail padding bytes */ ++ ip_tlen = rte_be_to_cpu_16(ipv4_hdr->total_length); ++ if (pkt->pkt_len > (uint32_t)(ip_tlen + pkt->l2_len)) ++ rte_pktmbuf_trim(pkt, pkt->pkt_len - ip_tlen - pkt->l2_len); ++ + /* + * Save IPv4 ID for the packet whose DF bit is 0. For the packet + * whose DF bit is 1, IPv4 ID is ignored. +diff --git a/lib/gro/gro_udp4.c b/lib/gro/gro_udp4.c +index dd71135ada..839f9748b7 100644 +--- a/lib/gro/gro_udp4.c ++++ b/lib/gro/gro_udp4.c +@@ -231,6 +231,10 @@ gro_udp4_reassemble(struct rte_mbuf *pkt, + if (ip_dl <= pkt->l3_len) + return -1; + ++ /* trim the tail padding bytes */ ++ if (pkt->pkt_len > (uint32_t)(ip_dl + pkt->l2_len)) ++ rte_pktmbuf_trim(pkt, pkt->pkt_len - ip_dl - pkt->l2_len); ++ + ip_dl -= pkt->l3_len; + ip_id = rte_be_to_cpu_16(ipv4_hdr->packet_id); + frag_offset = rte_be_to_cpu_16(ipv4_hdr->fragment_offset); +-- +2.23.0 + diff --git a/dpdk-20.11.tar.xz b/dpdk-20.11.tar.xz deleted file mode 100644 index b022fc58f7b970bca11b382e38f843501ab965b6..0000000000000000000000000000000000000000 Binary files a/dpdk-20.11.tar.xz and /dev/null differ diff --git a/dpdk-21.11.tar.xz b/dpdk-21.11.tar.xz new file mode 100644 index 0000000000000000000000000000000000000000..5b1b7fe053d6cb2017986129a4bc39824947dc4e Binary files /dev/null and b/dpdk-21.11.tar.xz differ diff --git a/dpdk.spec b/dpdk.spec index fe4521f9d0e60334c47237b3aebec0eb917aa7c8..87bbd480e2e1683b5877d90bdb32ca0cde642368 100644 --- a/dpdk.spec +++ b/dpdk.spec @@ -1,245 +1,250 @@ Name: dpdk -Version: 20.11 -Release: 8 +Version: 21.11 +Release: 26 Packager: packaging@6wind.com URL: http://dpdk.org -%global source_version 20.11 +%global source_version 21.11 Source: https://git.dpdk.org/dpdk/snapshot/%{name}-%{version}.tar.xz -Patch0: 0001-net-hns3-adjust-MAC-address-logging.patch -Patch1: 0002-net-hns3-fix-FEC-state-query.patch -Patch2: 0003-net-hns3-fix-build-with-SVE.patch -Patch3: 0004-net-hns3-fix-interception-with-flow-director.patch -Patch4: 0005-net-hns3-fix-xstats-with-id-and-names.patch -Patch5: 0006-net-hns3-fix-error-code-in-xstats.patch -Patch6: 0007-net-hns3-fix-Rx-Tx-errors-stats.patch -Patch7: 0008-net-hns3-fix-crash-with-multi-process.patch -Patch8: 0009-net-hns3-remove-unnecessary-memset.patch -Patch9: 0010-net-hns3-fix-jumbo-frame-flag-condition-for-MTU-set.patch -Patch10: 0011-net-hns3-use-C11-atomics-builtins-for-resetting.patch -Patch11: 0012-net-hns3-support-traffic-management.patch -Patch12: 0013-net-hns3-fix-VF-query-link-status-in-dev-init.patch -Patch13: 0014-net-hns3-use-new-opcode-for-clearing-hardware-resour.patch -Patch14: 0015-net-hns3-fix-register-length-when-dumping-registers.patch -Patch15: 0016-net-hns3-fix-data-overwriting-during-register-dump.patch -Patch16: 0017-net-hns3-fix-dump-register-out-of-range.patch -Patch17: 0018-net-hns3-remove-unused-assignment-for-RSS-key.patch -Patch18: 0019-net-hns3-encapsulate-DFX-stats-in-datapath.patch -Patch19: 0020-net-hns3-move-queue-stats-to-xstats.patch -Patch20: 0021-net-hns3-refactor-converting-descriptor-error.patch -Patch21: 0022-net-hns3-refactor-flow-checks-into-own-functions.patch -Patch22: 0023-net-hns3-reconstruct-Rx-interrupt-map.patch -Patch23: 0024-net-hns3-extract-common-checks-for-flow-director.patch -Patch24: 0025-net-hns3-refactor-reset-event-report-function.patch -Patch25: 0026-net-hns3-fix-memory-leak-on-secondary-process-exit.patch -Patch26: 0027-net-hns3-fix-interrupt-resources-in-Rx-interrupt-mod.patch -Patch27: 0028-net-hns3-rename-RSS-functions.patch -Patch28: 0029-net-hns3-adjust-some-comments.patch -Patch29: 0030-net-hns3-remove-unnecessary-parentheses.patch -Patch30: 0031-net-hns3-adjust-format-specifier-for-enum.patch -Patch31: 0032-net-hns3-support-LSC-event-report.patch -Patch32: 0033-net-hns3-fix-query-order-of-link-status-and-link-inf.patch -Patch33: 0034-net-hns3-fix-link-status-change-from-firmware.patch -Patch34: 0035-net-hns3-fix-RSS-indirection-table-size.patch -Patch35: 0036-net-hns3-constrain-TM-peak-rate.patch -Patch36: 0037-net-hns3-remove-MPLS-from-supported-flow-items.patch -Patch37: 0038-net-hns3-fix-stats-flip-overflow.patch -Patch38: 0039-net-hns3-use-C11-atomics.patch -Patch39: 0040-net-hns3-fix-flow-director-rule-residue-on-malloc-fa.patch -Patch40: 0041-net-hns3-fix-firmware-exceptions-by-concurrent-comma.patch -Patch41: 0042-net-hns3-fix-VF-reset-on-mailbox-failure.patch -Patch42: 0043-net-hns3-validate-requested-maximum-Rx-frame-length.patch -Patch43: 0044-drivers-net-redefine-array-size-macros.patch -Patch44: 0045-net-hns3-support-module-EEPROM-dump.patch -Patch45: 0046-net-hns3-add-more-registers-to-dump.patch -Patch46: 0047-net-hns3-implement-Tx-mbuf-free-on-demand.patch -Patch47: 0048-net-hns3-add-bytes-stats.patch -Patch48: 0049-net-hns3-add-imissed-packet-stats.patch -Patch49: 0050-net-hns3-encapsulate-port-shaping-interface.patch -Patch50: 0051-net-hns3-fix-device-capabilities-for-copper-media-ty.patch -Patch51: 0052-net-hns3-support-PF-device-with-copper-PHYs.patch -Patch52: 0053-net-hns3-support-Rx-descriptor-advanced-layout.patch -Patch53: 0054-net-hns3-fix-HW-buffer-size-on-MTU-update.patch -Patch54: 0055-net-hns3-remove-unused-parameter-markers.patch -Patch55: 0056-net-hns3-fix-mbuf-leakage.patch -Patch56: 0057-net-hns3-process-MAC-interrupt.patch -Patch57: 0058-net-hns3-fix-imprecise-statistics.patch -Patch58: 0059-net-hns3-add-runtime-config-to-select-IO-burst-funct.patch -Patch59: 0060-net-hns3-support-outer-UDP-checksum.patch -Patch60: 0061-net-hns3-adjust-format-of-RAS-related-structures.patch -Patch61: 0062-net-hns3-delete-redundant-xstats-RAS-statistics.patch -Patch62: 0063-net-hns3-support-imissed-stats-for-PF-VF.patch -Patch63: 0064-net-hns3-support-oerrors-stats-in-PF.patch -Patch64: 0065-net-hns3-support-Tx-descriptor-status-query.patch -Patch65: 0066-net-hns3-support-Rx-descriptor-status-query.patch -Patch66: 0067-net-hns3-fix-reporting-undefined-speed.patch -Patch67: 0068-net-hns3-fix-build-for-SVE-path.patch -Patch68: 0069-net-hns3-fix-processing-Tx-offload-flags.patch -Patch69: 0070-net-hns3-fix-Tx-checksum-for-UDP-packets-with-specia.patch -Patch70: 0071-net-hns3-fix-link-update-when-failed-to-get-link-inf.patch -Patch71: 0072-net-hns3-fix-long-task-queue-pairs-reset-time.patch -Patch72: 0073-net-hns3-fix-MTU-config-complexity.patch -Patch73: 0074-net-hns3-support-IEEE-1588-PTP.patch -Patch74: 0075-ethdev-validate-input-in-register-info.patch -Patch75: 0076-net-hns3-support-wait-in-link-update.patch -Patch76: 0077-net-hns3-fix-some-function-names-for-copper-media-ty.patch -Patch77: 0078-net-hns3-fix-setting-default-MAC-address-in-bonding-.patch -Patch78: 0079-net-hns3-fix-FLR-miss-detection.patch -Patch79: 0080-net-hns3-fix-rollback-after-setting-PVID-failure.patch -Patch80: 0081-net-hns3-fix-flow-control-exception.patch -Patch81: 0082-net-hns3-fix-flow-counter-value.patch -Patch82: 0083-net-hns3-fix-VF-mailbox-head-field.patch -Patch83: 0084-net-hns3-support-get-device-version-when-dump-regist.patch -Patch84: 0085-net-hns3-delete-redundant-blank-line.patch -Patch85: 0086-net-hns3-fix-code-style.patch -Patch86: 0087-net-hns3-refactor-VF-LSC-event-report.patch -Patch87: 0088-net-hns3-refactor-PF-LSC-event-report.patch -Patch88: 0089-net-hns3-log-selected-datapath.patch -Patch89: 0090-net-hns3-simplify-selecting-Rx-Tx-function.patch -Patch90: 0091-net-hns3-fix-rollback-in-PF-init.patch -Patch91: 0092-net-hns3-fix-concurrent-interrupt-handling.patch -Patch92: 0093-net-hns3-fix-some-packet-types.patch -Patch93: 0094-net-hns3-fix-timing-in-resetting-queues.patch -Patch94: 0095-net-hns3-fix-queue-state-when-concurrent-with-reset.patch -Patch95: 0096-net-hns3-fix-configure-FEC-when-concurrent-with-rese.patch -Patch96: 0097-net-hns3-delete-mailbox-arq-ring.patch -Patch97: 0098-net-hns3-fix-possible-mismatched-response-of-mailbox.patch -Patch98: 0099-net-hns3-fix-VF-handling-LSC-event-in-secondary-proc.patch -Patch99: 0100-net-hns3-fix-timing-in-mailbox.patch -Patch100: 0101-net-hns3-fix-use-of-command-status-enumeration.patch -Patch101: 0102-net-hns3-fix-verification-of-NEON-support.patch -Patch102: 0103-net-hns3-fix-missing-outer-L4-UDP-flag-for-VXLAN.patch -Patch103: 0104-net-hns3-add-reporting-tunnel-GRE-packet-type.patch -Patch104: 0105-net-hns3-fix-PTP-capability-report.patch -Patch105: 0106-net-hns3-list-supported-ptypes-for-advanced-Rx-descr.patch -Patch106: 0107-net-hns3-remove-VLAN-QinQ-ptypes-from-support-list.patch -Patch107: 0108-net-hns3-fix-supported-speed-of-copper-ports.patch -Patch108: 0109-net-hns3-add-1000M-speed-bit-for-copper-PHYs.patch -Patch109: 0110-net-hns3-fix-flow-control-mode.patch -Patch110: 0111-net-hns3-fix-firmware-compatibility-configuration.patch -Patch111: 0112-net-hns3-obtain-supported-speed-for-fiber-port.patch -Patch112: 0113-net-hns3-report-speed-capability-for-PF.patch -Patch113: 0114-net-hns3-support-link-speed-autoneg-for-PF.patch -Patch114: 0115-net-hns3-support-flow-control-autoneg-for-copper-por.patch -Patch115: 0116-net-hns3-support-fixed-link-speed.patch -Patch116: 0117-net-hns3-rename-Rx-burst-function.patch -Patch117: 0118-net-hns3-remove-unused-macros.patch -Patch118: 0119-net-hns3-support-RAS-process-in-Kunpeng-930.patch -Patch119: 0120-net-hns3-support-masking-device-capability.patch -Patch120: 0121-net-hns3-simplify-Rx-checksum.patch -Patch121: 0122-net-hns3-check-max-SIMD-bitwidth.patch -Patch122: 0123-net-hns3-add-compile-time-verification-on-Rx-vector.patch -Patch123: 0124-net-hns3-remove-redundant-mailbox-response.patch -Patch124: 0125-net-hns3-fix-DCB-mode-check.patch -Patch125: 0126-net-hns3-fix-VMDq-mode-check.patch -Patch126: 0127-net-hns3-fix-flow-director-lock.patch -Patch127: 0128-net-hns3-move-link-speeds-check-to-configure.patch -Patch128: 0129-net-hns3-remove-unused-macro.patch -Patch129: 0130-net-hns3-fix-traffic-management-support-check.patch -Patch130: 0131-net-hns3-ignore-devargs-parsing-return.patch -Patch131: 0132-net-hns3-fix-mailbox-error-message.patch -Patch132: 0133-net-hns3-fix-processing-link-status-message-on-PF.patch -Patch133: 0134-net-hns3-remove-unused-mailbox-macro-and-struct.patch -Patch134: 0135-net-hns3-fix-typos-on-comments.patch -Patch135: 0136-net-hns3-disable-MAC-status-report-interrupt.patch -Patch136: 0137-net-hns3-fix-handling-link-update.patch -Patch137: 0138-net-hns3-fix-link-status-when-port-is-stopped.patch -Patch138: 0139-net-hns3-fix-link-speed-when-port-is-down.patch -Patch139: 0140-net-hns3-support-preferred-burst-size-and-queues-in-.patch -Patch140: 0141-net-hns3-log-time-delta-in-decimal-format.patch -Patch141: 0142-net-hns3-fix-time-delta-calculation.patch -Patch142: 0143-net-hns3-select-Tx-prepare-based-on-Tx-offload.patch -Patch143: 0144-net-hns3-fix-MAC-enable-failure-rollback.patch -Patch144: 0145-net-hns3-fix-IEEE-1588-PTP-for-scalar-scattered-Rx.patch -Patch145: 0146-net-hns3-remove-some-unused-capabilities.patch -Patch146: 0147-net-hns3-refactor-optimised-register-write.patch -Patch147: 0148-net-hns3-use-existing-macro-to-get-array-size.patch -Patch148: 0149-net-hns3-improve-IO-path-data-cache-usage.patch -Patch149: 0150-net-hns3-log-flow-director-configuration.patch -Patch150: 0151-net-hns3-fix-vector-Rx-burst-limitation.patch -Patch151: 0152-net-hns3-remove-read-when-enabling-TM-QCN-error-even.patch -Patch152: 0153-net-hns3-remove-unused-VMDq-code.patch -Patch153: 0154-net-hns3-increase-readability-in-logs.patch -Patch154: 0155-net-hns3-fix-debug-build.patch -Patch155: 0156-net-hns3-return-error-on-PCI-config-write-failure.patch -Patch156: 0157-net-hns3-fix-log-on-flow-director-clear.patch -Patch157: 0158-net-hns3-clear-hash-map-on-flow-director-clear.patch -Patch158: 0159-net-hns3-fix-VF-alive-notification-after-config-rest.patch -Patch159: 0160-net-hns3-fix-querying-flow-director-counter-for-out-.patch -Patch160: 0161-net-hns3-fix-TM-QCN-error-event-report-by-MSI-X.patch -Patch161: 0162-net-hns3-fix-mailbox-message-ID-in-log.patch -Patch162: 0163-net-hns3-fix-secondary-process-request-start-stop-Rx.patch -Patch163: 0164-net-hns3-fix-ordering-in-secondary-process-initializ.patch -Patch164: 0165-net-hns3-fail-setting-FEC-if-one-bit-mode-is-not-sup.patch -Patch165: 0166-net-hns3-fix-Rx-Tx-queue-numbers-check.patch -Patch166: 0167-net-hns3-fix-requested-FC-mode-rollback.patch -Patch167: 0168-net-hns3-remove-meaningless-packet-buffer-rollback.patch -Patch168: 0169-net-hns3-fix-DCB-configuration.patch -Patch169: 0170-net-hns3-fix-DCB-reconfiguration.patch -Patch170: 0171-net-hns3-fix-link-speed-when-VF-device-is-down.patch -Patch171: 0172-net-bonding-fix-adding-itself-as-its-slave.patch -Patch172: 0173-ipc-use-monotonic-clock.patch -Patch173: 0174-ethdev-add-queue-state-in-queried-queue-information.patch -Patch174: 0175-app-testpmd-fix-queue-stats-mapping-configuration.patch -Patch175: 0176-app-testpmd-fix-bitmap-of-link-speeds-when-force-spe.patch -Patch176: 0177-app-testpmd-add-link-autoneg-status-display.patch -Patch177: 0178-app-testpmd-support-cleanup-Tx-queue-mbufs.patch -Patch178: 0179-app-testpmd-show-link-flow-control-info.patch -Patch179: 0180-app-testpmd-support-display-queue-state.patch -Patch180: 0181-app-testpmd-fix-max-queue-number-for-Tx-offloads.patch -Patch181: 0182-app-testpmd-fix-forward-lcores-number-for-DCB.patch -Patch182: 0183-app-testpmd-fix-DCB-forwarding-configuration.patch -Patch183: 0184-app-testpmd-fix-DCB-re-configuration.patch -Patch184: 0185-app-testpmd-check-DCB-info-support-for-configuration.patch -Patch185: 0186-app-testpmd-verify-DCB-config-during-forward-config.patch -Patch186: 0187-app-testpmd-add-forwarding-configuration-to-DCB-conf.patch -Patch187: 0188-app-testpmd-remove-redundant-forwarding-initializati.patch -Patch188: 0189-net-fix-compiling-bug-for-20.11-merge.patch -Patch189: 0189-config-arm-check-SVE-CPU-flag.patch -Patch190: 0190-net-hns3-increase-VF-reset-retry-maximum.patch -Patch191: 0191-net-hns3-fix-delay-for-waiting-to-stop-Rx-Tx.patch -Patch192: 0192-net-hns3-fix-fake-queue-rollback.patch -Patch193: 0193-net-hns3-fix-VLAN-strip-log.patch -Patch194: 0194-net-hns3-fix-maximum-queues-on-configuration-failure.patch -Patch195: 0195-net-hns3-remove-unnecessary-blank-lines.patch -Patch196: 0196-net-hns3-support-Tx-push-quick-doorbell-for-performa.patch -Patch197: 0197-net-hns3-fix-traffic-management.patch -Patch198: 0198-config-arm-fix-SVE-build-with-GCC-8.3.patch -Patch199: 0199-net-hns3-fix-Arm-SVE-build-with-GCC-8.3.patch -Patch200: 0200-net-hns3-query-basic-info-for-VF.patch -Patch201: 0201-net-hns3-support-VLAN-filter-state-modify-for-VF.patch -Patch202: 0202-net-hns3-support-multiple-TC-MAC-pause.patch -Patch203: 0203-net-hns3-fix-residual-MAC-address-entry.patch -Patch204: 0204-net-hns3-remove-unnecessary-zero-assignments.patch -Patch205: 0205-net-hns3-fix-filter-parsing-comment.patch -Patch206: 0206-net-hns3-fix-timing-of-clearing-interrupt-source.patch -Patch207: 0207-net-hns3-remove-duplicate-compile-time-check.patch -Patch208: 0208-net-hns3-move-speed-auto-negotiation-warning.patch -Patch209: 0209-net-hns3-fix-flow-rule-list-in-multi-process.patch -Patch210: 0210-net-hns3-fix-Tx-prepare-after-stop.patch -Patch211: 0211-net-hns3-disable-PFC-if-not-configured.patch -Patch212: 0212-net-hns3-use-the-correct-HiSilicon-copyright.patch -Patch213: 0213-app-testpmd-change-port-link-speed-without-stopping-.patch -Patch214: 0214-ethdev-add-dev-configured-flag.patch +Patch9001: 0001-add-igb-uio.patch +Patch9002: 0002-dpdk-add-secure-compile-option-and-fPIC-option.patch +Patch9003: 0003-dpdk-bugfix-the-deadlock-in-rte_eal_init.patch +Patch9004: 0004-dpdk-master-core-donot-set-affinity-in-libstorage.patch +Patch9005: 0005-dpdk-change-the-log-level-in-prepare_numa.patch +Patch9006: 0006-dpdk-fix-dpdk-coredump-problem.patch +Patch9007: 0007-dpdk-fix-cpu-flag-error-in-Intel-R-Xeon-R-CPU-E5-262.patch +Patch9008: 0008-dpdk-add-support-for-gazelle.patch +Patch9009: 0009-dpdk-fix-error-in-clearing-secondary-process-memseg-lists.patch +Patch9010: 0010-dpdk-fix-coredump-when-primary-process-attach-without-shared-file.patch +Patch9011: 0011-dpdk-fix-fbarray-memseg-destory-error-during-detach.patch +Patch9012: 0012-fix-rte-eal-sec-detach-coredump-count-rollover.patch +Patch9013: 0013-fix-rte-eal-memory-init-double-unlock.patch +Patch9014: 0014-fix-last-argv-pointer-change-to-first.patch +Patch9015: 0015-fix-internal-cfg-and-fbarray-attach-mememory-leak.patch +Patch9016: 0016-fix-error-that-the-secondary-attach-fails-due-to-detach.patch +Patch9017: 0017-fix-master-thread-not-set-affinity.patch +Patch9018: 0018-net-bonding-fix-offloading-configuration.patch +Patch9019: 0019-net-hns3-fix-Rx-Tx-when-fast-path-operation-introduc.patch +Patch9020: 0020-net-hns3-fix-mailbox-wait-time-uninitialization.patch +Patch9021: 0021-net-hns3-fix-vector-burst-when-PTP-enable.patch +Patch9022: 0022-net-hns3-remove-unnecessary-assignment.patch +Patch9023: 0023-net-hns3-fix-using-enum-as-boolean.patch +Patch9024: 0024-net-hns3-extract-common-function-to-initialize-MAC-a.patch +Patch9025: 0025-net-hns3-make-control-plane-function-non-inline.patch +Patch9026: 0026-net-hns3-remove-unnecessary-blank-lines.patch +Patch9027: 0027-net-hns3-extract-reset-failure-handling-to-function.patch +Patch9028: 0028-net-hns3-remove-unused-variables.patch +Patch9029: 0029-net-hns3-remove-getting-number-of-queue-descriptors-.patch +Patch9030: 0030-net-hns3-remove-logging-memory-addresses.patch +Patch9031: 0031-net-hns3-extract-common-function-to-obtain-revision-.patch +Patch9032: 0032-net-hns3-replace-single-line-functions.patch +Patch9033: 0033-net-hns3-remove-non-re-entrant-strerror-call.patch +Patch9034: 0034-net-hns3-rename-function.patch +Patch9035: 0035-net-hns3-extract-functions-to-create-RSS-and-FDIR-fl.patch +Patch9036: 0036-net-hns3-support-indirect-counter-flow-action.patch +Patch9037: 0037-net-hns3-fix-max-packet-size-rollback-in-PF.patch +Patch9038: 0038-net-hns3-fix-RSS-key-with-null.patch +Patch9039: 0039-net-hns3-fix-insecure-way-to-query-MAC-statistics.patch +Patch9040: 0040-net-hns3-fix-double-decrement-of-secondary-count.patch +Patch9041: 0041-net-hns3-fix-operating-queue-when-TCAM-table-is-inva.patch +Patch9042: 0042-net-hns3-delete-duplicated-RSS-type.patch +Patch9043: 0043-net-bonding-fix-promiscuous-and-allmulticast-state.patch +Patch9044: 0044-net-bonding-fix-reference-count-on-mbufs.patch +Patch9045: 0045-app-testpmd-fix-bonding-mode-set.patch +Patch9046: 0046-ethdev-introduce-dump-API.patch +Patch9047: 0047-app-procinfo-add-device-private-info-dump.patch +Patch9048: 0048-net-hns3-dump-device-basic-info.patch +Patch9049: 0049-net-hns3-dump-device-feature-capability.patch +Patch9050: 0050-net-hns3-dump-device-MAC-info.patch +Patch9051: 0051-net-hns3-dump-queue-info.patch +Patch9052: 0052-net-hns3-dump-VLAN-configuration-info.patch +Patch9053: 0053-net-hns3-dump-flow-director-basic-info.patch +Patch9054: 0054-net-hns3-dump-TM-configuration-info.patch +Patch9055: 0055-net-hns3-dump-flow-control-info.patch +Patch9056: 0056-net-hns3-change-dump-file-name.patch +Patch9057: 0057-net-hns3-fix-code-check-for-dump.patch +Patch9058: 0058-ethdev-fix-ethdev-version-map.patch +Patch9059: 0059-net-hns3-delete-simple-bd-cap.patch +Patch9060: 0060-net-hns3-fix-TM-info-dump.patch +Patch9061: 0061-dma-hisilicon-support-Kunpeng-930.patch +Patch9062: 0062-dma-hisilicon-support-error-handling-with-Kunpeng-93.patch +Patch9063: 0063-dma-hisilicon-support-registers-dump-for-Kunpeng-930.patch +Patch9064: 0064-dma-hisilicon-add-queue-full-statistics.patch +Patch9065: 0065-dma-hisilicon-use-common-PCI-device-naming.patch +Patch9066: 0066-app-testpmd-check-starting-port-is-not-in-bonding.patch +Patch9067: 0067-examples-vhost-remove-DMA-type-option-help-info.patch +Patch9068: 0068-kni-fix-freeing-order-in-device-release.patch +Patch9069: 0069-net-hns3-remove-duplicate-macro-definition.patch +Patch9070: 0070-net-hns3-fix-RSS-TC-mode-entry.patch +Patch9071: 0071-net-hns3-fix-VF-RSS-TC-mode-entry.patch +Patch9072: 0072-net-hns3-increase-time-waiting-for-PF-reset-completi.patch +Patch9073: 0073-net-bonding-fix-stopping-non-active-slaves.patch +Patch9074: 0074-net-bonding-fix-slave-stop-and-remove-on-port-close.patch +Patch9075: 0075-net-hns3-fix-order-of-clearing-imissed-register-in-P.patch +Patch9076: 0076-net-hns3-fix-MAC-and-queues-HW-statistics-overflow.patch +Patch9077: 0077-net-hns3-fix-pseudo-sharing-between-threads.patch +Patch9078: 0078-net-hns3-fix-mbuf-free-on-Tx-done-cleanup.patch +Patch9079: 0079-net-hns3-fix-RSS-disable.patch +Patch9080: 0080-net-hns3-fix-rollback-on-RSS-hash-update.patch +Patch9081: 0081-net-hns3-remove-redundant-RSS-tuple-field.patch +Patch9082: 0082-ethdev-fix-RSS-update-when-RSS-is-disabled.patch +Patch9083: 0083-net-hns3-remove-unnecessary-RSS-switch.patch +Patch9084: 0084-app-testpmd-check-statistics-query-before-printing.patch +Patch9085: 0085-app-testpmd-fix-MTU-verification.patch +Patch9086: 0086-app-testpmd-fix-port-status-of-bonding-slave-device.patch +Patch9087: 0087-ethdev-clarify-null-location-case-in-xstats-get.patch +Patch9088: 0088-ethdev-simplify-xstats-get-implementation.patch +Patch9089: 0089-net-hns3-fix-xstats-get-return-if-xstats-is-null.patch +Patch9090: 0090-net-ipn3ke-fix-xstats-get-return-if-xstats-is-null.patch +Patch9091: 0091-net-mvpp2-fix-xstats-get-return-if-xstats-is-null.patch +Patch9092: 0092-net-axgbe-fix-xstats-get-return-if-xstats-is-null.patch +Patch9093: 0093-ethdev-fix-memory-leak-in-xstats-telemetry.patch +Patch9094: 0094-ethdev-fix-possible-null-pointer-access.patch +Patch9095: 0095-net-cnxk-fix-possible-null-dereference-in-telemetry.patch +Patch9096: 0096-net-bonding-fix-mbuf-fast-free-usage.patch +Patch9097: 0097-ethdev-fix-port-state-when-stop.patch +Patch9098: 0098-ethdev-fix-port-close-in-secondary-process.patch +Patch9099: 0099-examples-dma-fix-MTU-configuration.patch +Patch9100: 0100-examples-dma-fix-Tx-drop-statistics.patch +Patch9101: 0101-examples-dma-add-force-minimal-copy-size-parameter.patch +Patch9102: 0102-dma-hisilicon-fix-index-returned-when-no-DMA-complet.patch +Patch9103: 0103-test-dma-check-index-when-no-DMA-completed.patch +Patch9104: 0104-dma-hisilicon-enhance-CQ-scan-robustness.patch +Patch9105: 0105-net-failsafe-fix-device-freeing.patch +Patch9106: 0106-net-tap-fix-device-freeing.patch +Patch9107: 0107-net-bonding-fix-RSS-inconsistent-between-bonded-and-.patch +Patch9108: 0108-app-test-fix-bonding-RSS-test-when-disable-RSS.patch +Patch9109: 0109-net-hns3-add-check-for-deferred-start-queue-when-rol.patch +Patch9110: 0110-net-hns3-remove-redundant-parentheses.patch +Patch9111: 0111-net-hns3-adjust-the-data-type-of-some-variables.patch +Patch9112: 0112-net-hns3-fix-an-unreasonable-memset.patch +Patch9113: 0113-net-hns3-remove-duplicate-definition.patch +Patch9114: 0114-net-hns3-fix-code-check-warning.patch +Patch9115: 0115-net-hns3-fix-return-value-for-unsupported-tuple.patch +Patch9116: 0116-net-hns3-modify-a-function-name.patch +Patch9117: 0117-net-hns3-unify-the-code-wrap-style.patch +Patch9118: 0118-net-hns3-fix-a-segfault-from-secondary-process.patch +Patch9119: 0119-net-hns3-fix-TM-capability-incorrectly-defined.patch +Patch9120: 0120-app-testpmd-add-help-messages-for-multi-process.patch +Patch9121: 0121-app-testpmd-fix-use-of-indirect-action-after-port-cl.patch +Patch9122: 0122-app-testpmd-fix-bonding-slave-devices-not-released.patch +Patch9123: 0123-secure-complilation-options-rpath.patch +Patch9124: 0124-reinit-support-return-ok.patch + +Patch6001: CVE-2021-3839.patch +Patch6002: CVE-2022-0669.patch +Patch6003: backport-0001-CVE-2022-2132.patch +Patch6004: backport-0002-CVE-2022-2132.patch +Patch6005: backport-CVE-2022-28199.patch + +Patch9125: 0125-net-hns3-fix-link-status-capability-query-from-VF.patch +Patch9126: 0126-net-hns3-support-backplane-media-type.patch +Patch9127: 0127-net-hns3-cancel-heartbeat-alarm-when-VF-reset.patch +Patch9128: 0128-net-hns3-fix-PTP-interrupt-logging.patch +Patch9129: 0129-net-hns3-fix-statistics-locking.patch +Patch9130: 0130-net-hns3-fix-descriptors-check-with-SVE.patch +Patch9131: 0131-net-hns3-clean-some-functions.patch +Patch9132: 0132-net-hns3-delete-unused-code.patch +Patch9133: 0133-examples-dma-support-dequeue-when-no-packet-received.patch +Patch9134: 0134-net-hns3-add-dump-of-VF-VLAN-filter-modify-capabilit.patch +Patch9135: 0135-net-hns3-fix-Rx-with-PTP.patch +Patch9136: 0136-net-hns3-fix-crash-in-SVE-Tx.patch +Patch9137: 0137-net-hns3-fix-next-to-use-overflow-in-SVE-Tx.patch +Patch9138: 0138-net-hns3-fix-next-to-use-overflow-in-simple-Tx.patch +Patch9139: 0139-net-hns3-optimize-SVE-Tx-performance.patch +Patch9140: 0140-net-hns3-fix-crash-when-secondary-process-access-FW.patch +Patch9141: 0141-net-hns3-delete-unused-markup.patch +Patch9142: 0142-net-hns3-fix-clearing-hardware-MAC-statistics.patch +Patch9143: 0143-net-hns3-revert-Tx-performance-optimization.patch +Patch9144: 0144-net-hns3-fix-RSS-rule-restore.patch +Patch9145: 0145-net-hns3-fix-RSS-filter-restore.patch +Patch9146: 0146-net-hns3-fix-lock-protection-of-RSS-flow-rule.patch +Patch9147: 0147-net-hns3-fix-RSS-flow-rule-restore.patch +Patch9148: 0148-net-hns3-move-flow-direction-rule-recovery.patch +Patch9149: 0149-net-hns3-fix-restore-filter-function-input.patch +Patch9150: 0150-net-hns3-fix-build-with-gcov.patch +Patch9151: 0151-net-hns3-fix-packet-type-for-GENEVE.patch +Patch9152: 0152-net-hns3-remove-magic-numbers-for-MAC-address.patch +Patch9153: 0153-net-hns3-fix-code-check-warnings.patch +Patch9154: 0154-net-hns3-fix-header-files-includes.patch +Patch9155: 0155-net-hns3-remove-unused-structures.patch +Patch9156: 0156-net-hns3-rename-header-guards.patch +Patch9157: 0157-net-hns3-fix-IPv4-and-IPv6-RSS.patch +Patch9158: 0158-net-hns3-fix-types-in-IPv6-SCTP-fields.patch +Patch9159: 0159-net-hns3-fix-IPv4-RSS.patch +Patch9160: 0160-net-hns3-add-check-for-L3-and-L4-type.patch +Patch9161: 0161-net-hns3-revert-fix-mailbox-communication-with-HW.patch +Patch9162: 0162-net-hns3-fix-VF-mailbox-message-handling.patch +Patch9163: 0163-net-hns3-fix-minimum-Tx-frame-length.patch +Patch9164: 0164-ethdev-introduce-Rx-Tx-descriptor-dump-API.patch +Patch9165: 0165-net-hns3-support-Rx-Tx-descriptor-dump.patch +Patch9166: 0166-remove-unnecessary-null-checks.patch +Patch9167: 0167-ethdev-introduce-generic-dummy-packet-burst-function.patch +Patch9168: 0168-fix-spelling-in-comments-and-strings.patch +Patch9169: 0169-net-hns3-add-VLAN-filter-query-in-dump-file.patch +Patch9170: 0170-net-bonding-fix-array-overflow-in-Rx-burst.patch +Patch9171: 0171-net-bonding-fix-double-slave-link-status-query.patch +Patch9172: 0172-app-testpmd-fix-supported-RSS-offload-display.patch +Patch9173: 0173-app-testpmd-unify-name-of-L2-payload-offload.patch +Patch9174: 0174-app-testpmd-refactor-config-all-RSS-command.patch +Patch9175: 0175-app-testpmd-unify-RSS-types-display.patch +Patch9176: 0176-app-testpmd-compact-RSS-types-output.patch +Patch9177: 0177-app-testpmd-reorder-RSS-type-table.patch +Patch9178: 0178-app-testpmd-fix-RSS-types-display.patch +Patch9179: 0179-ethdev-support-telemetry-private-dump.patch +Patch9180: 0180-dmadev-add-telemetry.patch +Patch9181: 0181-dmadev-support-telemetry-dump-dmadev.patch +Patch9182: 0182-telemetry-add-missing-C-guards.patch +Patch9183: 0183-telemetry-limit-characters-allowed-in-dictionary-nam.patch +Patch9184: 0184-telemetry-fix-escaping-of-invalid-json-characters.patch +Patch9185: 0185-telemetry-add-escaping-of-strings-in-arrays.patch +Patch9186: 0186-telemetry-add-escaping-of-strings-in-dicts.patch +Patch9187: 0187-telemetry-limit-command-characters.patch +Patch9188: 0188-telemetry-eliminate-duplicate-code-for-json-output.patch +Patch9189: 0189-telemetry-make-help-command-more-helpful.patch + +Patch6006: backport-gro-fix-chain-index-for-more-than-2-packets.patch +Patch6007: backport-gro-trim-tail-padding-bytes.patch +Patch6008: backport-gro-check-payload-length-after-trim.patch + +Patch9190: 0190-net-bonding-fix-Tx-hash-for-TCP.patch +Patch9191: 0191-net-bonding-add-link-speeds-configuration.patch +Patch9192: 0192-net-bonding-call-Tx-prepare-before-Tx-burst.patch +Patch9193: 0193-net-bonding-fix-MTU-set-for-slaves.patch +Patch9194: 0194-app-testpmd-remove-jumbo-offload-related-code.patch +Patch9195: 0195-app-testpmd-revert-MAC-update-in-checksum-forwarding.patch +Patch9196: 0196-net-bonding-fix-bond4-drop-valid-MAC-packets.patch +Patch9197: 0197-net-bonding-fix-slave-device-Rx-Tx-offload-configura.patch +Patch9198: 0198-app-testpmd-fix-MAC-header-in-csum-forward-engine.patch +Patch9199: 0199-app-testpmd-update-bond-port-configurations-when-add.patch +Patch9200: 0200-app-testpmd-fix-GENEVE-parsing-in-checksum-mode.patch +Patch9201: 0201-net-add-UDP-TCP-checksum-in-mbuf-segments.patch +Patch9202: 0202-app-testpmd-add-SW-L4-checksum-in-multi-segments.patch +Patch9203: 0203-app-testpmd-fix-L4-checksum-in-multi-segments.patch +Patch9204: 0204-net-bonding-fix-mbuf-fast-free-handling.patch +Patch9205: 0205-doc-fix-application-name-in-procinfo-guide.patch +Patch9206: 0206-doc-document-device-dump-in-procinfo-guide.patch +Patch9207: 0207-app-procinfo-remove-doxygen-comments.patch +Patch9208: 0208-app-procinfo-dump-DPDK-version.patch +Patch9209: 0209-app-procinfo-dump-firmware-version.patch +Patch9210: 0210-app-procinfo-dump-RSS-RETA.patch +Patch9211: 0211-app-procinfo-dump-module-EEPROM-info.patch +Patch9212: 0212-app-procinfo-add-burst-mode-to-Rx-Tx-queue-info.patch +Patch9213: 0213-app-procinfo-dump-detailed-info-for-Rx-Tx-descriptor.patch Summary: Data Plane Development Kit core Group: System Environment/Libraries License: BSD and LGPLv2 and GPLv2 ExclusiveArch: i686 x86_64 aarch64 -%ifarch aarch64 -%global machine armv8a -%global target arm64-%{machine}-linux-gcc -%else -%global machine native -%global target x86_64-%{machine}-linux-gcc -%endif - -BuildRequires: meson ninja-build gcc + +BuildRequires: meson ninja-build gcc diffutils python3-pyelftools BuildRequires: kernel-devel numactl-devel BuildRequires: libpcap libpcap-devel +BuildRequires: rdma-core-devel BuildRequires: uname-build-checks -BuildRequires: doxygen python3-sphinx +BuildRequires: chrpath +BuildRequires: groff-base %define kern_devel_ver %(uname -r) @@ -274,68 +279,90 @@ This package contains the pdump tool for capture the dpdk network packets. %autosetup -n %{name}-%{version} -p1 %build -%define debug_package %{nil} -meson %{target} -Ddisable_drivers=*/octeontx2 -Ddisable_drivers=*/fpga* -Ddisable_drivers=*/ifpga* -Denable_kmods=true -Denable_docs=true -ninja -C %{target} +export CFLAGS="%{optflags}" +meson build -Dplatform=generic -Dexamples=l3fwd-power,ethtool,l3fwd,kni,dma,ptpclient +ninja -C build -v + +#build gazelle-pdump/gazell-proc-info +cd build/app/dpdk-pdump.p +export GAZELLE_FLAGS="-lm -lpthread -lrt -lnuma" +export GAZELLE_LIBS="-lrte_pci -lrte_bus_pci -lrte_cmdline -lrte_hash -lrte_mempool -lrte_mempool_ring -lrte_timer -lrte_eal -lrte_gro -lrte_ring -lrte_mbuf -lrte_telemetry -lrte_kni -lrte_net_ixgbe -lrte_kvargs -lrte_net_hinic -lrte_net_i40e -lrte_net_virtio -lrte_bus_vdev -lrte_net -lrte_rcu -lrte_ethdev -lrte_pdump -lrte_bpf -lrte_security -lrte_cryptodev -lrte_net_pcap -lrte_metrics" +export SECURE_OPTIONS="-fstack-protector-strong -D_FORTIFY_SOURCE=2 -O2 -Wall -Wl,-z,relro,-z,now,-z,noexecstack -Wtrampolines -fPIE -pie -fPIC -g" +gcc -o gazelle-pdump ${GAZELLE_FLAGS} ${SOCURE_OPTIONS} -L../../drivers -L../../lib ${GAZELLE_LIBS} pdump_main.c.o +cd - +cd build/app/dpdk-proc-info.p +gcc -o gazelle-proc-info ${GAZELLE_FLAGS} ${SOCURE_OPTIONS} -L../../drivers -L../../lib ${GAZELLE_LIBS} proc-info_main.c.o %install -namer=%{kern_devel_ver} -DESTDIR=$RPM_BUILD_ROOT/ meson install -C %{target} -DESTDIR=$RPM_BUILD_ROOT/ ninja install -C %{target} - -mkdir -p $RPM_BUILD_ROOT/usr/share/dpdk/%{target} -ln -fs %{buildroot}/usr/local/include %{buildroot}/usr/share/dpdk/%{target}/include -ln -fs %{buildroot}/usr/local/lib64 %{buildroot}/usr/share/dpdk/%{target}/lib - -mkdir -p $RPM_BUILD_ROOT/usr/sbin -ln -fs /usr/local/bin/dpdk-devbind.py %{buildroot}/usr/sbin/dpdk-devbind - -mkdir -p $RPM_BUILD_ROOT/lib64/ -cp -ar ./%{target}/lib/librte_eal.so* $RPM_BUILD_ROOT/lib64/ -cp -ar ./%{target}/lib/librte_mempool.so* $RPM_BUILD_ROOT/lib64/ -cp -ar ./%{target}/lib/librte_ring.so* $RPM_BUILD_ROOT/lib64/ -cp -ar ./%{target}/drivers/librte_mempool_ring.so* $RPM_BUILD_ROOT/lib64/ -cp -ar ./%{target}/lib/librte_pci.so* $RPM_BUILD_ROOT/lib64/ -cp -ar ./%{target}/drivers/librte_bus_pci.so* $RPM_BUILD_ROOT/lib64/ -cp -ar ./%{target}/lib/librte_kvargs.so* $RPM_BUILD_ROOT/lib64/ -cp -ar ./%{target}/lib/librte_acl.so* $RPM_BUILD_ROOT/lib64/ -cp -ar ./%{target}/lib/librte_ethdev.so* $RPM_BUILD_ROOT/lib64/ -cp -ar ./%{target}/lib/librte_mbuf.so* $RPM_BUILD_ROOT/lib64/ -cp -ar ./%{target}/lib/librte_cmdline.so* $RPM_BUILD_ROOT/lib64/ -cp -ar ./%{target}/lib/librte_net.so* $RPM_BUILD_ROOT/lib64/ -cp -ar ./%{target}/lib/librte_meter.so* $RPM_BUILD_ROOT/lib64/ -cp -ar ./%{target}/lib/librte_telemetry.so* $RPM_BUILD_ROOT/lib64/ - -mkdir -p $RPM_BUILD_ROOT/usr/bin -cp ./%{target}/app/dpdk-pdump $RPM_BUILD_ROOT/usr/bin - -strip -g $RPM_BUILD_ROOT/lib/modules/${namer}/extra/dpdk/rte_kni.ko +DESTDIR=$RPM_BUILD_ROOT/ ninja install -C build + +chrpath -d ./build/examples/dpdk-l3fwd +chrpath -d ./build/examples/dpdk-l3fwd-power +chrpath -d ./build/examples/dpdk-ethtool +chrpath -d ./build/examples/dpdk-kni +chrpath -d ./build/examples/dpdk-dma +chrpath -d ./build/examples/dpdk-ptpclient + +cp ./build/examples/dpdk-l3fwd $RPM_BUILD_ROOT/usr/local/bin +cp ./build/examples/dpdk-l3fwd-power $RPM_BUILD_ROOT/usr/local/bin +cp ./build/examples/dpdk-ethtool $RPM_BUILD_ROOT/usr/local/bin +cp ./build/examples/dpdk-kni $RPM_BUILD_ROOT/usr/local/bin +cp ./build/examples/dpdk-dma $RPM_BUILD_ROOT/usr/local/bin +cp ./build/examples/dpdk-ptpclient $RPM_BUILD_ROOT/usr/local/bin +cp ./build/app/dpdk-pdump.p/gazelle-pdump $RPM_BUILD_ROOT/usr/local/bin +cp ./build/app/dpdk-proc-info.p/gazelle-proc-info $RPM_BUILD_ROOT/usr/local/bin + +mkdir -p $RPM_BUILD_ROOT/usr/lib64 +mv $RPM_BUILD_ROOT/usr/local/lib64/* $RPM_BUILD_ROOT/usr/lib64/ + +mkdir -p $RPM_BUILD_ROOT/usr/local/bin +ln -fs /usr/local/bin/dpdk-devbind.py $RPM_BUILD_ROOT/usr/local/bin/dpdk-devbind +mkdir $RPM_BUILD_ROOT/usr/lib64/dpdk/pmds-22.0/lib +mkdir $RPM_BUILD_ROOT/usr/lib64/dpdk/pmds-22.0/include +cd $RPM_BUILD_ROOT/usr/lib64/dpdk/pmds-22.0/include +ln -fs ../../../../local/include/* . +cd - +cd $RPM_BUILD_ROOT/usr/lib64/dpdk/pmds-22.0/lib +ln -fs ../../../*.so . +cd - + +strip -g $RPM_BUILD_ROOT/lib/modules/%{kern_devel_ver}/extra/dpdk/rte_kni.ko +strip -g $RPM_BUILD_ROOT/lib/modules/%{kern_devel_ver}/extra/dpdk/igb_uio.ko %define _unpackaged_files_terminate_build 0 +%define _build_id_links none %files /usr/local/bin/*.py -/lib/modules/%{kern_devel_ver}/extra/dpdk/* -/lib64/librte*.so* -%{_sbindir}/dpdk-devbind +/usr/local/bin/dpdk-devbind +/lib/modules/%{kern_devel_ver}/extra/dpdk/*.ko +/usr/lib64/*.so* +/usr/lib64/dpdk/* +%exclude /usr/lib64/dpdk/pmds-22.0/include/*.h %files devel -%dir /usr/local/include/ -/usr/local/include/*.h -/usr/local/include/generic/*.h -/usr/local/share/dpdk/examples/* -/usr/local/lib64/* -%exclude /usr/local/lib64/*.py -/usr/local/bin/* -%dir /usr/share/dpdk/%{target}/ -/usr/share/dpdk/%{target}/include/* -/usr/share/dpdk/%{target}/lib/* +/usr/local/include +/usr/lib64/*.a +/usr/lib64/dpdk/pmds-22.0/include/*.h +/usr/lib64/pkgconfig/libdpdk-libs.pc +/usr/lib64/pkgconfig/libdpdk.pc %files doc -/usr/local/share/doc/* %files tools -/usr/bin/dpdk-pdump +/usr/local/bin/dpdk-pdump +/usr/local/bin/dpdk-dumpcap +/usr/local/bin/dpdk-proc-info +/usr/local/bin/dpdk-test +/usr/local/bin/dpdk-testpmd +/usr/local/bin/dpdk-l3fwd +/usr/local/bin/dpdk-l3fwd-power +/usr/local/bin/dpdk-ethtool +/usr/local/bin/dpdk-kni +/usr/local/bin/dpdk-dma +/usr/local/bin/dpdk-ptpclient +/usr/local/bin/gazelle-pdump +/usr/local/bin/gazelle-proc-info %post /sbin/ldconfig @@ -346,7 +373,149 @@ strip -g $RPM_BUILD_ROOT/lib/modules/${namer}/extra/dpdk/rte_kni.ko /usr/sbin/depmod %changelog -* Tur Jul 29 2021 Min Hu - 20.11-8 +* Wed Nov 16 2022 chenjiji - 21.11-26 + proc-info adds dumping the following features: + - dpdk version + - firmware version + - RSS RETA + - module eeprom information + - Rx/Tx burst mode + - Rx/Tx descriptor + +* Wed Nov 16 2022 chenjiji - 21.11-25 + Sync some patches for bonding PMD and testpmd. And patchs + are as follows: + - app/testpmd: revert MAC update in checksum forwarding + - net/bonding: fix bond4 drop valid MAC packets + - net/bonding: fix slave device Rx/Tx offload configuration + - app/testpmd: fix MAC header in csum forward engine + - app/testpmd: update bond port configurations when add slave + - app/testpmd: fix GENEVE parsing in checksum mode + - net: add UDP/TCP checksum in mbuf segments + - app/testpmd: add SW L4 checksum in multi-segments + - app/testpmd: fix L4 checksum in multi-segments + - net/bonding: fix mbuf fast free handling + +* Tue Nov 15 2022 jiangheng - 21.11-24 +- proc-info: add gazelle-proc-info support in dpdk + +* Mon Nov 14 2022 kircher - 21.11-23 +- pdump: add gazelle-pdump for pcap + +* Mon Nov 07 2022 jiangheng - 21.11-22 +- set platform to generic for compatibility + +* Sat Oct 29 2022 chenjiji - 21.11-21 + Sync some patches for bonding PMD and testpmd. And patchs + are as follows: + - net/bonding: fix Tx hash for TCP + - net/bonding: add link speeds configuration + - net/bonding: call Tx prepare before Tx burst + - net/bonding: fix MTU set for slaves + - app/testpmd: remove jumbo offload related code + +* Fri Oct 28 2022 jiangheng - 21.11-20 +- gro: trim tail padding bytes +- gro: check payload length after trim +- gro: fix chain index for more than 2 packets + +* Sat Oct 22 2022 Huisong Li - 21.11-19 + Sync some patches for hns3 PMD, telemetry and testpmd. And main + modifications are as follows: + - backport some bugfixes for hns3 + - revert Tx performance optimization for hns3 + - add Rx/Tx descriptor dump feature for hns3 + - refactor some RSS commands for testpmd + - add ethdev telemetry private dump + - add dmadev telemetry + - sync telemetry lib + +* Thu Oct 6 2022 wuchangsheng - 21.11-18 +- reinit support return ok + +* Tue Sep 13 2022 jiangheng - 21.11-17 +- remove secure compilation options rpath + +* Fri Sep 09 2022 jiangheng - 21.11-16 +- fix CVE-2022-28199 + +* Thu Sep 08 2022 jiangheng - 21.11-15 +- fix CVE-2022-2132 + +* Thu Jul 07 2022 Honggang Li - 21.11-14 +- Remove duplicated BuildRequires python-pyelftools + +* Tue Jul 05 2022 Honggang Li - 21.11-13 +- Build mlx5 and mlx4 PMD + +* Thu Jun 16 2022 Dongdong Liu - 21.11-12 +- sync patches from upstreaming branch. + +* Fri Jun 10 2022 xiusailong - 21.11-11 +- fix CVE-2021-3839 CVE-2022-0669 + +* Tue May 17 2022 Min Hu(Connor) - 21.11-10 +- sync patches from 22.03. + +* Wed Mar 23 2022 Min Hu(Connor) - 21.11-9 +- fix adding examples app. + +* Mon Mar 14 2022 Min Hu(Connor) - 21.11-8 +- add examples app. + +* Wed Feb 09 2022 Min Hu(Connor) - 21.11-7 +- sync patches from upstreaming branch. + +* Thu Jan 27 2022 Min Hu(Connor) - 21.11-6 +- fix key bugfixes for hns3 PMD. + +* Fri Jan 14 2022 wuchangsheng - 21.11-5 +- fix master thread not set affinity + +* Wed Jan 12 2022 jiangheng - 21.11-4 +- modify location of header and library Files + +* Mon Jan 10 2022 jiangheng - 21.11-3 +- add /usr/lib64/dpdk/*, here are some so files +- put lib file and header file in the same directory for third-party lib compile + +* Sat Dec 25 2021 wuchangsheng - 21.11-2 +- remove redundant file in rpm +- add gazelle support + +* Fri Dec 17 2021 jiangheng - 21.11-1 +- update to 21.11 + +* Sat Dec 11 2021 Min Hu - 20.11-17 +- Fix execution failure to add DLB to usertools/dpdk-devbind.py + +* Fri Dec 10 2021 Min Hu - 20.11-16 +- del doc package + +* Fri Nov 12 2021 Min Hu - 20.11-15 +- synchronize dmadev and refactor for hns3 PMD + +* Wed Nov 10 2021 Min Hu - 20.11-14 +- release flows left before port stop + +* Mon Nov 08 2021 Min Hu - 20.11-13 +- fix PMD cannot get the RSS key. + +* Mon Nov 01 2021 Min Hu - 20.11-12 +- synchronize dmadev and hns3 bugfixes from upstream + +* Mon Sep 13 2021 chenchen - 20.11-11 +- del rpath from some binaries and bin +- add debug package to strip +- add "-fstack-protector-strong" for binaries and bin + +* Mon Sep 13 2021 Min Hu - 20.11-10 +- add bugfixes for hns3 PMD + +* Tue Aug 31 2021 Min Hu - 20.11-9 +- support link up/down for PF in hns3 PMD + +* Thu Jul 29 2021 Min Hu - 20.11-8 - add lib and testpmd functions to sync upstream * Tue Jul 27 2021 Min Hu - 20.11-7