dpdk.git
4 years agofix various typos found by Lintian
Luca Boccassi [Sat, 29 Feb 2020 16:37:06 +0000 (16:37 +0000)]
fix various typos found by Lintian

Cc: stable@dpdk.org
Signed-off-by: Luca Boccassi <bluca@debian.org>
4 years agotimer: protect initialization with lock
Honnappa Nagarahalli [Mon, 24 Feb 2020 06:42:18 +0000 (14:42 +0800)]
timer: protect initialization with lock

rte_timer_subsystem_initialized is a global variable that can be
accessed by multiple processes simultaneously. Hence, any access
to rte_timer_subsystem_initialized should be protected by
rte_mcfg_timer_lock.

Fixes: f9d6cd8bfe9e ("timer: fix resource leak in finalize")
Cc: stable@dpdk.org
Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
Reviewed-by: Gavin Hu <gavin.hu@arm.com>
Reviewed-by: Phil Yang <phil.yang@arm.com>
Acked-by: Erik Gabriel Carrillo <erik.g.carrillo@intel.com>
4 years agoipsec: use hash lookup with signatures in SAD lookup
Vladimir Medvedkin [Mon, 20 Apr 2020 18:27:05 +0000 (19:27 +0100)]
ipsec: use hash lookup with signatures in SAD lookup

Change hash function from jhash to crc.
Precalculate hash signatures for a bulk of keys and then
use rte_hash_lookup_with_hash_bulk_data() to speed up sad lookup
Also use rte_hash_add_key_with_hash and _del_key_with_hash with
precalculated hash signature for a key in rte_ipsec_sad_add and
rte_ipsec_sad_del

Signed-off-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
4 years agohash: add bulk lookup with signatures array
Vladimir Medvedkin [Thu, 16 Apr 2020 15:07:19 +0000 (16:07 +0100)]
hash: add bulk lookup with signatures array

Implement rte_hash_lookup_with_hash_bulk_data() and
rte_hash_lookup_with_hash_bulk() - bulk lookup
functions with precomputed hash signatures.
Add these two functions into performance tests.

Signed-off-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>
Acked-by: Yipeng Wang <yipeng1.wang@intel.com>
4 years agobus/pci: support IOVA as VA on PowerNV systems
David Christensen [Mon, 16 Mar 2020 20:38:28 +0000 (13:38 -0700)]
bus/pci: support IOVA as VA on PowerNV systems

All recent POWER systems, Power 8 and 9 specifically, support an IOMMU
(it can't be disabled). The functionality of the IOMMU is different
depending on whether it's running on a bare metal PowerNV system or in
a virtual environment (PowerVM LPAR or KVM/QEMU).  DPDK currently
supports the IOMMU found on PowerNV platforms, sPAPRv2, so IOVA=VA
mode can be enabled when the correct platform is detected.

The POWER IOMMU type can't be detected through mechanisms such as
parsing files in the /sys hierarchy like x86_64 systems so the
/proc/cpuinfo file is parsed to determine whether Linux is running
on bare metal (i.e. PowerNV) or in a virtual environment (KVM/QEMU).

Signed-off-by: David Christensen <drc@linux.vnet.ibm.com>
4 years agodevtools: ignore internal ABI check
Haiyue Wang [Sat, 25 Apr 2020 10:56:18 +0000 (18:56 +0800)]
devtools: ignore internal ABI check

Ignore the internal version ABI check, this kind of ABI is used only
by drivers and libraries.

Signed-off-by: Haiyue Wang <haiyue.wang@intel.com>
Signed-off-by: David Marchand <david.marchand@redhat.com>
4 years agobuild: add internal tag check
Haiyue Wang [Sat, 25 Apr 2020 10:56:17 +0000 (18:56 +0800)]
build: add internal tag check

Add checks during build to ensure that all symbols in the INTERNAL
version map section have __internal tags on their definitions, and
enable the warnings needed to announce their use.

Signed-off-by: Haiyue Wang <haiyue.wang@intel.com>
Signed-off-by: David Marchand <david.marchand@redhat.com>
4 years agobuild: enable internal API tag
Haiyue Wang [Sat, 25 Apr 2020 10:56:16 +0000 (18:56 +0800)]
build: enable internal API tag

Allow the drivers and libraries to use the internal tag for marking
internal ABI symbols.

Signed-off-by: Haiyue Wang <haiyue.wang@intel.com>
4 years agoeal: add internal ABI tag definition
Haiyue Wang [Sat, 25 Apr 2020 10:56:15 +0000 (18:56 +0800)]
eal: add internal ABI tag definition

Introduce the __rte_internal tag to mark internal ABI function which is
used only by the drivers or other libraries.
Like for __rte_experimental, this tag must be on a separate line before
function proprotypes.

Signed-off-by: Haiyue Wang <haiyue.wang@intel.com>
4 years agotest/ipfrag: add unit test case
Aaron Conole [Mon, 20 Apr 2020 19:25:23 +0000 (15:25 -0400)]
test/ipfrag: add unit test case

Initial IP fragmentation unit test.

Signed-off-by: Aaron Conole <aconole@redhat.com>
Tested-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
Reviewed-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
4 years agoip_frag: ensure minimum v6 fragmentation length
Aaron Conole [Mon, 20 Apr 2020 19:25:22 +0000 (15:25 -0400)]
ip_frag: ensure minimum v6 fragmentation length

In addition, do a formal parameter check.

Signed-off-by: Aaron Conole <aconole@redhat.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
4 years agoip_frag: ensure minimum v4 fragmentation length
Aaron Conole [Mon, 20 Apr 2020 19:25:21 +0000 (15:25 -0400)]
ip_frag: ensure minimum v4 fragmentation length

Do a formal parameter check of mtu length, as well as
checking the the various inputs for validity.  If any
aren't acceptable, we bail.

Signed-off-by: Aaron Conole <aconole@redhat.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
4 years agoeal: fix build on armv7
David Marchand [Thu, 23 Apr 2020 14:24:36 +0000 (16:24 +0200)]
eal: fix build on armv7

Caught by OBS on armv7:

In file included from .../lib/librte_eal/include/rte_string_fns.h:21,
                 from .../lib/librte_kvargs/rte_kvargs.c:9:
.../lib/librte_eal/include/rte_common.h:67:37: error: expected '=', ',',
 ';', 'asm' or '__attribute__' before '__rte_aligned'
   67 | typedef uint64_t unaligned_uint64_t __rte_aligned(1);
      |                                     ^~~~~~~~~~~~~
.../lib/librte_eal/include/rte_common.h:68:37: error: expected '=', ',',
 ';', 'asm' or '__attribute__' before '__rte_aligned'
   68 | typedef uint32_t unaligned_uint32_t __rte_aligned(1);
      |                                     ^~~~~~~~~~~~~
.../lib/librte_eal/include/rte_common.h:69:37: error: expected '=', ',',
 ';', 'asm' or '__attribute__' before '__rte_aligned'
   69 | typedef uint16_t unaligned_uint16_t __rte_aligned(1);
      |                                     ^~~~~~~~~~~~~
make[3]: *** [.../mk/internal/rte.compile-pre.mk:116: rte_kvargs.o] Error 1

Move __rte_aligned macro definition before alignment types used by
architectures requiring RTE_ARCH_STRICT_ALIGN like armv7.

Fixes: f35e5b3e07b2 ("replace alignment attributes")

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
4 years agomem: exclude unused memory from core dump
Li Feng [Fri, 24 Apr 2020 13:19:05 +0000 (21:19 +0800)]
mem: exclude unused memory from core dump

Currently, even though memory is mapped with PROT_NONE, this does not
cause it to be excluded from core dumps. This is counter-productive,
because in a lot of cases, this memory will go unused (e.g. when the
memory subsystem preallocates VA space but hasn't yet mapped physical
pages into it).

Use `madvise()` call with MADV_DONTDUMP/MADV_NOCORE to exclude the
unused memory from being dumped.

Signed-off-by: Li Feng <fengli@smartx.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
4 years agomem: mark pages as not accessed when freeing memory
Li Feng [Fri, 24 Apr 2020 10:42:05 +0000 (18:42 +0800)]
mem: mark pages as not accessed when freeing memory

Commit 8a4baf06c17a ("mem: mark pages as not accessed when reserving VA")
has mapped the initialized memory with PROT_NONE, and when it's unmapped,
eal_memalloc.c should remmap the anonymous memory with PROT_NONE too.

Fixes: 8a4baf06c17a ("mem: mark pages as not accessed when reserving VA")
Cc: stable@dpdk.org
Signed-off-by: Li Feng <fengli@smartx.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
4 years agoeal: fix comments spelling
Stephen Hemminger [Tue, 10 Mar 2020 16:35:20 +0000 (09:35 -0700)]
eal: fix comments spelling

Fix spelling errors in comments (found with codespell).

Note that "inbetween" is not correct in English and should
either be two words or better yet, the in can be dropped.
https://www.grammarly.com/blog/in-between-or-inbetween/

Fixes: 12f45fa7e29b ("eal/arm: read timer from PMU if enabled")
Fixes: 096ffd811fe2 ("eal/x86: use lock-prefixed instructions for SMP barrier")
Fixes: 1d406458db47 ("mem: make segment preallocation OS-specific")
Fixes: bb372060dad4 ("malloc: make heap a doubly-linked list")
Fixes: 7353ee7344b4 ("fbarray: add API to find biggest used or free chunks")
Cc: stable@dpdk.org
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agolpm6: fix comments spelling
Stephen Hemminger [Tue, 10 Mar 2020 16:26:22 +0000 (09:26 -0700)]
lpm6: fix comments spelling

Fix spelling errors in comments.

Fixes: e480688dce6d ("lpm6: add incremental update on delete")
Cc: stable@dpdk.org
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agolpm6: fix size of tbl8 group
Alex Kiselev [Wed, 8 Apr 2020 13:07:30 +0000 (15:07 +0200)]
lpm6: fix size of tbl8 group

Fixes: e480688dce6d ("lpm6: add incremental update on delete")
Cc: stable@dpdk.org
Signed-off-by: Alex Kiselev <alex@therouter.net>
Acked-by: Andrzej Ostruszka <aostruszka@marvell.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
4 years agolpm: skip table entries update if rules found
Yangchao Zhou [Mon, 20 Apr 2020 02:48:50 +0000 (10:48 +0800)]
lpm: skip table entries update if rules found

Table entries do not need to be updated if the same rules can be found.

Signed-off-by: Yangchao Zhou <zhouyates@gmail.com>
Acked-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>
4 years agomempool: remove inline functions from export list
Fady Bader [Wed, 22 Apr 2020 07:37:44 +0000 (10:37 +0300)]
mempool: remove inline functions from export list

The code didn't compile when using exported mempool functions
under Windows.

compilation error logs:
rte_mempool_exports.def : error LNK2001:
unresolved external symbol rte_mempool_cache_flush
rte_mempool_exports.def : error LNK2001:
unresolved external symbol rte_mempool_default_cache
rte_mempool_exports.def : error LNK2001:
unresolved external symbol rte_mempool_generic_get
rte_mempool_exports.def : error LNK2001:
unresolved external symbol rte_mempool_generic_put
lib\librte_mempool.dll.a : fatal error LNK1120: 4 unresolved externals
clang: error: linker command failed with exit code 1120 (use -v to see invocation)

The cause was that there were some inline functions that were included
in the export list.
To solve this the functions, which are implemented in the header
and shouldn't be exported, were removed from rte_mempool_version.map
export list.

Fixes: 4b5062755aa7 ("mempool: allow user-owned cache")
Fixes: 656f2d3ede96 ("mempool: deprecate specific get and put functions")
Cc: stable@dpdk.org
Signed-off-by: Fady Bader <fady@mellanox.com>
Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
4 years agodevtools: fix tracepoint symbols check
Thomas Monjalon [Fri, 24 Apr 2020 09:32:24 +0000 (11:32 +0200)]
devtools: fix tracepoint symbols check

The tracepoint symbols __rte_*_trace_* are defined via a macro,
adding prefix "__", so they cannot be found by map checker.
Those symbols defined by RTE_TRACE_POINT and RTE_TRACE_POINT_FP
are checked in source code without the generated prefix.

The same logic is applied to per core variables, previously skipped.

Fixes: 6c232fc44c74 ("trace: add generic tracepoints")
Fixes: 4931010619fe ("trace: add alarm tracepoints")
Fixes: 52f409d614a0 ("trace: add memory tracepoints")
Fixes: 402321cfca9b ("trace: add memzone tracepoints")
Fixes: 0baa1e01c339 ("trace: add thread tracepoints")
Fixes: 05c4105738d8 ("trace: add interrupt tracepoints")
Fixes: 78d44153de8f ("ethdev: add tracepoints")
Fixes: 32e326869ed6 ("eventdev: add tracepoints")
Fixes: 4cf30e3f3c35 ("cryptodev: add tracepoints")
Fixes: 40b75c73d1c6 ("mempool: add tracepoints")

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: David Marchand <david.marchand@redhat.com>
4 years agosecurity: fix crash at accessing non-implemented ops
Konstantin Ananyev [Thu, 23 Apr 2020 15:10:42 +0000 (16:10 +0100)]
security: fix crash at accessing non-implemented ops

Valid checks for optional function pointers inside dev-ops
were disabled by undefined macro.

Fixes: b6ee98547847 ("security: fix verification of parameters")
Cc: stable@dpdk.org
Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
4 years agonet/bnxt: fix port MAC query on VF
Kalesh AP [Tue, 21 Apr 2020 21:33:51 +0000 (14:33 -0700)]
net/bnxt: fix port MAC query on VF

HWRM_PORT_MAC_QCFG is not supported on a VF. Added a PF check
in bnxt_hwrm_port_mac_qcfg() to prevent the probe failure on a VF.

Fixes: f6e250d21ab0 ("net/bnxt: fetch SVIF information from firmware")

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
4 years agonet/bnxt: log firmware status on early init failure
Kalesh AP [Tue, 21 Apr 2020 21:33:50 +0000 (14:33 -0700)]
net/bnxt: log firmware status on early init failure

Firmware reports any fatal error (either ASIC or Firmware related) via a
new status register. This status register can provide more detailed
information about the firmware errors, especially if error occurs before
HWRM_VER_GET is issued. Attempt to map this register if it is present
and check for firmware status when VER_GET command fails.

Refactored the code to allocate the "bp->recovery_info" structure
in bnxt_init_fw() instead of doing in bnxt_hwrm_error_recovery_qcfg().

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
4 years agonet/bnxt: fix VLAN add when port is stopped
Kalesh AP [Tue, 21 Apr 2020 21:33:49 +0000 (14:33 -0700)]
net/bnxt: fix VLAN add when port is stopped

Driver destroys the vnic when the port is brought down.
When user tries to add a vlan when port is stopped, driver
issues HWRM command to FW with invalid vnic_id and it fails.

Fixed to return an error while setting vlan when port is
not started.

Fixes: b4e190d55c25 ("net/bnxt: fix MAC/VLAN filter allocation")
Cc: stable@dpdk.org
Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
4 years agonet/bnxt: fix port start failure handling
Kalesh AP [Tue, 21 Apr 2020 21:33:48 +0000 (14:33 -0700)]
net/bnxt: fix port start failure handling

Fixed to invoke clean up in the reverse sequence of
initialization in case any of the FW commands fail
during port start.

Fixes: 0b533591238f ("net/bnxt: inform firmware about IF state changes")
Cc: stable@dpdk.org
Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
4 years agonet/bnxt: use true/false for bool types
Kalesh AP [Tue, 21 Apr 2020 21:33:47 +0000 (14:33 -0700)]
net/bnxt: use true/false for bool types

Fixes: 0b533591238f ("net/bnxt: inform firmware about IF state changes")
Cc: stable@dpdk.org
Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Lance Richardson <lance.richardson@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
4 years agonet/bnxt: fix HWRM command during FW reset
Kalesh AP [Tue, 21 Apr 2020 21:33:46 +0000 (14:33 -0700)]
net/bnxt: fix HWRM command during FW reset

FW returns HWRM_ERR_CODE_HOT_RESET_PROGRESS(0xa) when it is
unable to process a specific cmd while hot reset is in progress.
Host driver is expected to keep retrying the cmd for 2s with
a gap of 50ms between each retrial.

Also, fixed to fail port start if the HWRM_FUNC_DRV_IF_CHANGE
still returns error after 2 seconds.

Fixes: 0b533591238f ("net/bnxt: inform firmware about IF state changes")
Cc: stable@dpdk.org
Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Lance Richardson <lance.richardson@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
4 years agonet/bnxt: support speed capabilities query
Kalesh AP [Tue, 21 Apr 2020 21:33:45 +0000 (14:33 -0700)]
net/bnxt: support speed capabilities query

Added information about supported speeds for the port in the
"dev_infos_get". As other PMDs are returning the speed capabilities,
apps may expect this behavior from bnxt PMD.

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
4 years agonet/bnxt: use macro for PCI log format
Kalesh AP [Tue, 21 Apr 2020 21:33:44 +0000 (14:33 -0700)]
net/bnxt: use macro for PCI log format

Use PCI_PRI_FMT instead of "%04x:%02x:%02x:%02x" print format.

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
4 years agonet/bnxt: fix build on BSD
Ajit Khaparde [Tue, 21 Apr 2020 21:33:43 +0000 (14:33 -0700)]
net/bnxt: fix build on BSD

There is no ENODATA in the errno.h in BSD.
Use a common errno to return error.

Fixes: 69c410b8448d ("net/bnxt: support EM/EEM")

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>
Reviewed-by: Lance Richardson <lance.richardson@broadcom.com>
4 years agonet/ice: fix flow redirector
Beilei Xing [Wed, 22 Apr 2020 12:22:44 +0000 (20:22 +0800)]
net/ice: fix flow redirector

If there's VF reset, the kernel PF will remove rules
associated with the reset VF no matter the HW VSI ID
is changed or not. So DCF should redirector all rules
associated with the reset VF no matter the HW VSI ID
is changed or not.

Fixes: 3b3757bda3c3 ("net/ice: get VF hardware index in DCF")
Fixes: c8183dd8e059 ("net/ice: redirect switch rule to new VSI")

Signed-off-by: Beilei Xing <beilei.xing@intel.com>
Acked-by: Haiyue Wang <haiyue.wang@intel.com>
4 years agonet/iavf: fix stats query error code
Cheng Peng [Tue, 14 Apr 2020 01:56:57 +0000 (09:56 +0800)]
net/iavf: fix stats query error code

The iavf_dev_stats_get function should return ret instead of -eio.

Fixes: f4a41a6953af ("net/avf: support stats")
Cc: stable@dpdk.org
Signed-off-by: Cheng Peng <cheng.peng5@zte.com.cn>
Acked-by: Xiaolong Ye <xiaolong.ye@intel.com>
4 years agonet/i40e: enable PPC AltiVec path in meson build
David Christensen [Thu, 9 Apr 2020 18:20:55 +0000 (11:20 -0700)]
net/i40e: enable PPC AltiVec path in meson build

The meson build file does not enable i40e vectorization support for
PPC/altivec systems, even though the existing Makefile does enable the
support. Add the required architecture check and sources line.

Signed-off-by: David Christensen <drc@linux.vnet.ibm.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
4 years agonet/ixgbe: fix link status after port reset
Shougang Wang [Mon, 13 Apr 2020 01:38:39 +0000 (01:38 +0000)]
net/ixgbe: fix link status after port reset

It's a normal behavior to change the link status to up after
resetting the port. So it is unnecessary to set link down before
starting port, and changing the link state(link up/down) frequently
will cause link speed unstable.

Fixes: c3f2fbff78cf ("net/ixgbe: fix link status")
Cc: stable@dpdk.org
Signed-off-by: Shougang Wang <shougangx.wang@intel.com>
Acked-by: Qiming Yang <qiming.yang@intel.com>
Tested-by: Xueming Zhang <xuemingx.zhang@intel.com>
4 years agonet/ice: support flow for AH ESP and L2TP
Wei Zhao [Mon, 20 Apr 2020 05:18:55 +0000 (13:18 +0800)]
net/ice: support flow for AH ESP and L2TP

Add switch filter support for AH ESP and L2TP protocol,
and use SPI or session idas input set for switch rule.

Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
4 years agonet/ice/base: support L2TP on switch
Wei Zhao [Mon, 20 Apr 2020 05:18:54 +0000 (13:18 +0800)]
net/ice/base: support L2TP on switch

Add dummy packet and tunnel type to support
L2TP on switch, now we can use session id as
input set for switch rule.

Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
4 years agonet/ice/base: support AH ESP and NAT-T on switch
Wei Zhao [Mon, 20 Apr 2020 05:18:53 +0000 (13:18 +0800)]
net/ice/base: support AH ESP and NAT-T on switch

Add dummy packet and tunnel type to support
AH ESP and NAT-T on switch, now we can use SPI as
input set for switch rule.

Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
4 years agonet/ixgbe: fix resource leak after thread exits normally
Tao Zhu [Wed, 22 Apr 2020 12:37:36 +0000 (12:37 +0000)]
net/ixgbe: fix resource leak after thread exits normally

When the thread exits normally, pthread_join() is not called, which can
result in a resource leak. Therefore, the thread is set to separation
mode using function pthread_detach(), so that no program call
pthread_join() is required to recycle, and when the thread exits,
the system automatically reclaims resources.

Wait for the thread to finish with timeout argument(0 means that it will
not return until link complete), wait until the thread finishes before
returning. Normally, the thread will finish in a shorter time, and give
a warning message if it hasn't finished in a longer time.

Fixes: 819d0d1d57f1 ("net/ixgbe: fix blocking system events")
Cc: stable@dpdk.org
Signed-off-by: Tao Zhu <taox.zhu@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Reviewed-by: Xiaolong Ye <xiaolong.ye@intel.com>
4 years agonet/mlx5: improve logging of MPRQ selection
Alexander Kozyrev [Fri, 17 Apr 2020 17:20:39 +0000 (17:20 +0000)]
net/mlx5: improve logging of MPRQ selection

MPRQ is silently turned off in case there is not enough
Rx queues configured. Improve the logging to show a
warning in this case to notify a user about the Rx burst
function selected.

Fixes: 7d6bf6b866b8 ("net/mlx5: add Multi-Packet Rx support")
Cc: stable@dpdk.org
Signed-off-by: Alexander Kozyrev <akozyrev@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agonet/mlx5: set dynamic flow metadata in Rx queues
Alexander Kozyrev [Fri, 17 Apr 2020 17:14:53 +0000 (17:14 +0000)]
net/mlx5: set dynamic flow metadata in Rx queues

Using a global mbuf dynamic field for metadata incurs some
performance penalty on a datapath. Store this information in
the Rx queue descriptor for a better cache locality.

Fixes: a18ac6113331 ("net/mlx5: add metadata support to Rx datapath")
Cc: stable@dpdk.org
Signed-off-by: Alexander Kozyrev <akozyrev@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agonet/mlx5: fix header modify action validation
Bing Zhao [Tue, 21 Apr 2020 14:03:34 +0000 (22:03 +0800)]
net/mlx5: fix header modify action validation

The header modify actions number supported now has some limitation,
and it is decided by both driver and hardware. If the configuration
is different or the table to insert the flow is different, the result
might be different if the flow contains header modify actions.
Currently, the actual action number could only be calculated in the
later stage called translate, from user specified value to the driver
format. And the action numbers checking is missed in the flow
validation. So PMD will return incorrect result to indicate the
flow actions are valid by rte_flow_validate but then it will fail
when calling rte_flow_create.

Adding some simple checking in the validation will help to get rid
of this incorrect checking. Most of the actions will only consume 1
SW action field except the MAC address and IPv6 address. And from
SW POV, the maximal action fields for these will be consumed even if
only part of such field will be modified because that there is no
mask in the flow actions and the mask will always be all ONEs.

The metering or extra metadata supports will cost one more action.

Fixes: 9597330c6844 ("net/mlx5: update modify header action translator")
Cc: stable@dpdk.org
Signed-off-by: Bing Zhao <bingz@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agonet/mlx5: fix crash when releasing meter table
Tonghao Zhang [Wed, 15 Apr 2020 08:52:29 +0000 (16:52 +0800)]
net/mlx5: fix crash when releasing meter table

The meters of ports share the same meter table on
the port. When releasing meters, don't check value returned
using assert. Because other meters may reference to it.

Fixes: 46a5e6bc6a85 ("net/mlx5: prepare meter flow tables")
Fixes: 9dbaf7eef6e1 ("net/mlx5: fix meter suffix table leak")
Cc: stable@dpdk.org
Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agoapp/testpmd: remove hardcoded descriptors limit
Lijun Ou [Sat, 18 Apr 2020 03:44:38 +0000 (11:44 +0800)]
app/testpmd: remove hardcoded descriptors limit

When users configure rxds and txds by used port config cmd based
on testpmd application, it will not be able to configure rxd and
txd according to the max capability range supported by the actual
NIC hardware. Due testpmd defects, it can only configure a fixed
range to 0 to 2048.
The final result is that an incorrect printing prompt appears and
cannot be applied using rxd && txd according to the actual
capabilities supported by the device.
In order to solve the above problems, we modify the testpmd. First
by calling the rte_eth_dev_info_get api to obtain the max and min
rx/tx capability supported by the hns3, and then use this range
to compare with the actual value by users configured and make
reasonable limitation.

Signed-off-by: Lijun Ou <oulijun@huawei.com>
Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
4 years agonet/hns3: get Rx/Tx queue fbd in xstats
Chengwen Feng [Tue, 21 Apr 2020 03:32:15 +0000 (11:32 +0800)]
net/hns3: get Rx/Tx queue fbd in xstats

This patch adds getting Rx/Tx queue fbd information in extended device
statistics. The upper level application can get them by calling the
rte_eth_xstats_get API function.

The fbd registers of every Rx/Tx queue are very useful to identify the
Rx/Tx bottleneck.
1. The Rx queue fbd register is the number of the unprocessed buffer
   descriptors which are waiting for driver to process;
2. The Tx queue fbd register is the number of the unprocessed buffer
   descriptors which are waiting for network engine hardware to process.

As a result, we get the following output information in testpmd
application by using the command "show port xstats" as below:
rx_q0RX_QUEUE_FBD: 19
rx_q1RX_QUEUE_FBD: 18
tx_q0TX_QUEUE_FBD: 0
tx_q1TX_QUEUE_FBD: 0

Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
Signed-off-by: Huisong Li <lihuisong@huawei.com>
4 years agonet/hns3: modify format for firmware version
Wei Hu (Xavier) [Tue, 21 Apr 2020 03:32:14 +0000 (11:32 +0800)]
net/hns3: modify format for firmware version

This patch modifies the print format for firmware version in the log, It
replaces "0x%08x" with "%lu.%lu.%lu.%lu" in the format control string.
By the way, this patch adds ".fw_version_get" ops implemation for hns3
VF PMD driver.

Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
4 years agoapp/testpmd: add new types to RSS hash commands
Jeff Guo [Wed, 22 Apr 2020 01:02:55 +0000 (21:02 -0400)]
app/testpmd: add new types to RSS hash commands

Add some new types, such as eth/l2-src-only/l2-dst-only/svlan/cvlan/
l2tpv3/esp/ah/pfcp types into RSS hash commands, it could be used
to configure these rss input set by cmdline.

Example flow commands was:
testpmd>flow create 0 ingress pattern eth / ipv4 / l2tpv3oip / end \
actions rss types l2tpv3 end key_len 0 queues end / end

port config commands was:
testpmd>port config all rss l2tpv3

Signed-off-by: Jeff Guo <jia.guo@intel.com>
Acked-by: Ori Kam <orika@mellanox.com>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
4 years agonet/iavf: add RSS configuration for VF
Jeff Guo [Wed, 22 Apr 2020 01:02:54 +0000 (21:02 -0400)]
net/iavf: add RSS configuration for VF

The VF must be capable of configuring RSS. Add a virtchnl handler to
parse a specific RSS configuration, and process the configuration for
VFs, such as add or delete a RSS rule.

Signed-off-by: Jeff Guo <jia.guo@intel.com>
Reviewed-by: Qi Zhang <qi.z.zhang@intel.com>
4 years agoethdev: add RSS offload types
Jeff Guo [Wed, 22 Apr 2020 01:02:53 +0000 (21:02 -0400)]
ethdev: add RSS offload types

Defines some new RSS offload types for ETH/S_VLAN/C_VLAN/L2TPV3/
/PFCP/L2_SRC_ONLY/L2_DST_ONLY.

Signed-off-by: Jeff Guo <jia.guo@intel.com>
Reviewed-by: Qi Zhang <qi.z.zhang@intel.com>
Reviewed-by: Bernard Iremonger <bernard.iremonger@intel.com>
Acked-by: Ori Kam <orika@mellanox.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agoethdev: support flow aging
Dong Zhou [Tue, 21 Apr 2020 10:11:38 +0000 (13:11 +0300)]
ethdev: support flow aging

One of the reasons to destroy a flow is the fact that no packet matches
the flow for "timeout" time.
For example, when TCP\UDP sessions are suddenly closed.

Currently, there is not any DPDK mechanism for flow aging and the
applications use their own ways to detect and destroy aged-out flows.

The flow aging implementation need include:
- A new rte_flow action: RTE_FLOW_ACTION_TYPE_AGE to set the timeout and
  the application flow context for each flow.
- A new ethdev event: RTE_ETH_EVENT_FLOW_AGED for the driver to report
  that there are new aged-out flows.
- A new rte_flow API: rte_flow_get_aged_flows to get the aged-out flows
  contexts from the port.
- Support input flow aging command line in Testpmd.

The new event type addition in the enum is flagged as an ABI breakage,
so an ignore rule is added for these reasons:
- It is not changing value of existing types (except MAX)
- The new value is not used by existing API if the event is not
  registered
In general, it is safe adding new ethdev event types at the end of the
enum, because of event callback registration mechanism.

Signed-off-by: Dong Zhou <dongz@mellanox.com>
Acked-by: Ori Kam <orika@mellanox.com>
Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
Acked-by: Matan Azrad <matan@mellanox.com>
4 years agocommon/mlx5: fix build with rdma-core 21
Thomas Monjalon [Thu, 16 Apr 2020 15:59:04 +0000 (17:59 +0200)]
common/mlx5: fix build with rdma-core 21

drivers/common/mlx5/mlx5_glue.c: In function 'mlx5_glue_devx_qp_query':
drivers/common/mlx5/mlx5_glue.c:1010:9: error:
implicit declaration of function 'mlx5dv_devx_qp_query'

The function mlx5dv_devx_qp_query() was added in rdma-core 22.
This function is compiled only if HAVE_IBV_DEVX_OBJ,
which is true if the function mlx5dv_devx_obj_create is found.
Unfortunately mlx5dv_devx_obj_create() was introduced in rdma-core 21,
when mlx5dv_devx_qp_query() did not exist yet.

A new flag HAVE_IBV_DEVX_QP is added when mlx5dv_devx_qp_query()
is found.

Fixes: 62d6f70f30f4 ("net/mlx5: add glue for queue query via DevX")
Cc: stable@dpdk.org
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agonet/mlx5: optimize memory for flow meter
Wentao Cui [Mon, 20 Apr 2020 02:40:02 +0000 (05:40 +0300)]
net/mlx5: optimize memory for flow meter

This commit focus on flow meter data structures
optimization: mlx5_flow_meter.

Optimize memory consumption of flow meter data structure.
Reorganize flow meter data structure,delete unnecessary
data fields.

Signed-off-by: Wentao Cui <wentaoc@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agonet/i40e: fix flow director initialisation
Bernard Iremonger [Tue, 7 Apr 2020 15:26:41 +0000 (16:26 +0100)]
net/i40e: fix flow director initialisation

Remove references to struct rte_fdir_conf which is deprecated,
in i40e_flow_parse_fdir_filter(), i40e_flow_destroy() and
i40e_flow_add_del_fdir_filter().

Fixes: c3be43817cfb ("net/i40e: fix unexpected skip FDIR setup")
Fixes: 2e67a7fbf3ff ("net/i40e: config flow director automatically")
Fixes: 4149825bbdb9 ("net/i40e: finish integration FDIR with generic flow API")
Cc: stable@dpdk.org
Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
Acked-by: Beilei Xing <beilei.xing@intel.com>
4 years agonet/iavf: support flow director mark action
Simei Su [Tue, 21 Apr 2020 06:19:30 +0000 (14:19 +0800)]
net/iavf: support flow director mark action

This patch enables mark action support and takes mark only case
into consideration.

Signed-off-by: Simei Su <simei.su@intel.com>
Reviewed-by: Qi Zhang <qi.z.zhang@intel.com>
4 years agonet/iavf: support flow director PFCP
Simei Su [Tue, 21 Apr 2020 06:19:29 +0000 (14:19 +0800)]
net/iavf: support flow director PFCP

This patch enables PFCP node and session packets with S_FIELD
for flow director filter.

Signed-off-by: Simei Su <simei.su@intel.com>
Reviewed-by: Qi Zhang <qi.z.zhang@intel.com>
4 years agonet/iavf: support flow director L2TPv3 and IPsec
Simei Su [Tue, 21 Apr 2020 06:19:28 +0000 (14:19 +0800)]
net/iavf: support flow director L2TPv3 and IPsec

This patch enables L2TPv3 with SESSION_ID, ESP/AH with SPI, NAT-T
with SPI and IP src/dst for flow director filter.

Signed-off-by: Simei Su <simei.su@intel.com>
Reviewed-by: Qi Zhang <qi.z.zhang@intel.com>
4 years agonet/iavf: support flow director GTPU
Simei Su [Tue, 21 Apr 2020 06:19:27 +0000 (14:19 +0800)]
net/iavf: support flow director GTPU

This patch enables GTPU with TEID and QFI for flow director filter.

Signed-off-by: Simei Su <simei.su@intel.com>
Reviewed-by: Qi Zhang <qi.z.zhang@intel.com>
4 years agonet/iavf: support flow director basic rule
Simei Su [Tue, 21 Apr 2020 06:19:26 +0000 (14:19 +0800)]
net/iavf: support flow director basic rule

This patch adds FDIR create/destroy/validate function in AVF.
Common pattern and queue/qgroup/passthru/drop actions are supported.

Signed-off-by: Simei Su <simei.su@intel.com>
Reviewed-by: Qi Zhang <qi.z.zhang@intel.com>
4 years agonet/ice: check DSN package file firstly
Haiyue Wang [Thu, 16 Apr 2020 03:11:22 +0000 (11:11 +0800)]
net/ice: check DSN package file firstly

Align the package file search sequence with PF only for DCF mode. Get
the DSN through the virtual channel firstly to check the accessibility
of the package file.

Signed-off-by: Haiyue Wang <haiyue.wang@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
4 years agonet/iavf: add RSS hash parsing in SSE path
Leyi Rong [Mon, 20 Apr 2020 06:16:25 +0000 (14:16 +0800)]
net/iavf: add RSS hash parsing in SSE path

Support RSS hash parsing from Flex Rx
descriptor in SSE data path.

Signed-off-by: Leyi Rong <leyi.rong@intel.com>
Reviewed-by: Qi Zhang <qi.z.zhang@intel.com>
4 years agonet/iavf: add RSS hash parsing in AVX path
Leyi Rong [Mon, 20 Apr 2020 06:16:24 +0000 (14:16 +0800)]
net/iavf: add RSS hash parsing in AVX path

Support RSS hash parsing from Flex Rx
descriptor in AVX data path.

Signed-off-by: Leyi Rong <leyi.rong@intel.com>
Reviewed-by: Qi Zhang <qi.z.zhang@intel.com>
4 years agonet/iavf: support flow mark in SSE path
Leyi Rong [Mon, 20 Apr 2020 06:16:23 +0000 (14:16 +0800)]
net/iavf: support flow mark in SSE path

Support Flow Director mark ID parsing from Flex
Rx descriptor in SSE path.

Signed-off-by: Leyi Rong <leyi.rong@intel.com>
Reviewed-by: Qi Zhang <qi.z.zhang@intel.com>
4 years agonet/iavf: support flow mark in AVX path
Leyi Rong [Mon, 20 Apr 2020 06:16:22 +0000 (14:16 +0800)]
net/iavf: support flow mark in AVX path

Support Flow Director mark ID parsing from Flex
Rx descriptor in AVX path.

Signed-off-by: Leyi Rong <leyi.rong@intel.com>
Reviewed-by: Qi Zhang <qi.z.zhang@intel.com>
4 years agonet/iavf: support flow mark in normal data path
Leyi Rong [Mon, 20 Apr 2020 06:16:21 +0000 (14:16 +0800)]
net/iavf: support flow mark in normal data path

Support Flow Director mark ID parsing in normal path.

Signed-off-by: Leyi Rong <leyi.rong@intel.com>
Reviewed-by: Qi Zhang <qi.z.zhang@intel.com>
4 years agonet/iavf: add flow director enabled switch value
Leyi Rong [Mon, 20 Apr 2020 06:16:20 +0000 (14:16 +0800)]
net/iavf: add flow director enabled switch value

The commit adds fdir_enabled flag into iavf_rx_queue structure
to identify if fdir id is active. Rx data path can be benefit if
fdir id parsing is not needed, especially in vector path.

Signed-off-by: Leyi Rong <leyi.rong@intel.com>
Reviewed-by: Qi Zhang <qi.z.zhang@intel.com>
4 years agonet/iavf: support flexible Rx descriptor in SSE path
Leyi Rong [Mon, 20 Apr 2020 06:16:19 +0000 (14:16 +0800)]
net/iavf: support flexible Rx descriptor in SSE path

Support flexible Rx descriptor format in SSE
path of iAVF PMD.

Signed-off-by: Leyi Rong <leyi.rong@intel.com>
Reviewed-by: Qi Zhang <qi.z.zhang@intel.com>
4 years agonet/iavf: support flexible Rx descriptor in AVX path
Leyi Rong [Mon, 20 Apr 2020 06:16:18 +0000 (14:16 +0800)]
net/iavf: support flexible Rx descriptor in AVX path

Support flexible Rx descriptor format in AVX
path of iAVF PMD.

Signed-off-by: Leyi Rong <leyi.rong@intel.com>
Reviewed-by: Qi Zhang <qi.z.zhang@intel.com>
4 years agonet/iavf: support flexible Rx descriptor in normal path
Leyi Rong [Mon, 20 Apr 2020 06:16:17 +0000 (14:16 +0800)]
net/iavf: support flexible Rx descriptor in normal path

Support flexible Rx descriptor format in normal
path of iAVF PMD.

Signed-off-by: Leyi Rong <leyi.rong@intel.com>
Reviewed-by: Qi Zhang <qi.z.zhang@intel.com>
4 years agonet/iavf: return error if opcode is mismatched
Leyi Rong [Mon, 20 Apr 2020 06:16:16 +0000 (14:16 +0800)]
net/iavf: return error if opcode is mismatched

Adds error return when the opcode of read message is
mismatched which is received from adminQ.

Signed-off-by: Leyi Rong <leyi.rong@intel.com>
Reviewed-by: Qi Zhang <qi.z.zhang@intel.com>
4 years agonet/iavf: support flexible Rx descriptor definitions
Leyi Rong [Mon, 20 Apr 2020 06:16:15 +0000 (14:16 +0800)]
net/iavf: support flexible Rx descriptor definitions

Add definitions for flexible Rx descriptor structures and macros.

Signed-off-by: Leyi Rong <leyi.rong@intel.com>
Reviewed-by: Qi Zhang <qi.z.zhang@intel.com>
4 years agodoc: add mlx5 flow memory optimization to release notes
Suanming Mou [Mon, 20 Apr 2020 06:53:44 +0000 (14:53 +0800)]
doc: add mlx5 flow memory optimization to release notes

Add flow memory optimization item.

Signed-off-by: Suanming Mou <suanmingm@mellanox.com>
Acked-by: Raslan Darawsheh <rasland@mellanox.com>
4 years agonet/mlx5: reorganize flow API structure
Suanming Mou [Thu, 16 Apr 2020 08:34:31 +0000 (16:34 +0800)]
net/mlx5: reorganize flow API structure

Currently, the rte flow structure is not fully aligned and has some
bits wasted. The members can be optimized and reorganized to save
memory.

1. The drv_type uses only limited bits, change the type to 2 bits what
it needs.

2. Align the hairpin_flow_id, drv_type, fdir, copy_applied to 32 bits.
As hairpin never uses the full 32 bits.

3. __rte_packed helps tight up the structure memory layout.

The optimization totally helps save 14 bytes for the structure.

Signed-off-by: Suanming Mou <suanmingm@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agonet/mlx5: allocate flow API from indexed pool
Suanming Mou [Thu, 16 Apr 2020 08:34:30 +0000 (16:34 +0800)]
net/mlx5: allocate flow API from indexed pool

This commit allocates rte flow from indexed memory pool.

Allocate rte flow memory from indexed memory pool helps save more than
MALLOC_ELEM_OVERHEAD bytes memory from rte_malloc().

Signed-off-by: Suanming Mou <suanmingm@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agonet/mlx5: optimize flow RSS struct
Suanming Mou [Thu, 16 Apr 2020 08:34:29 +0000 (16:34 +0800)]
net/mlx5: optimize flow RSS struct

When destroy the flow with RSS, flow can invoke the queues information
from hrxq index table object, since the queue number and list are both
saved to the index table object. No need to save the duplicated data in
rte flow.

Save the RSS description information to the intermediate private data
when create the flow with RSS action helps to save the memory for rte
flow.

Signed-off-by: Suanming Mou <suanmingm@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agonet/mlx5: optimize flow director filter memory
Wentao Cui [Thu, 16 Apr 2020 08:34:28 +0000 (16:34 +0800)]
net/mlx5: optimize flow director filter memory

This commit is for mlx5 fdir flow memory optimization.

Currently for the fdir member in rte_flow structure. It saves the fdir
memory pointer directly. As fdir is fading away, use one bit help to
indicate the function in the flow and add the content to an extra list
save the memory for the other widely usage cases.

Signed-off-by: Wentao Cui <wentaoc@mellanox.com>
Signed-off-by: Suanming Mou <suanmingm@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agonet/mlx5: convert mark copy resource to indexed
Suanming Mou [Thu, 16 Apr 2020 08:34:27 +0000 (16:34 +0800)]
net/mlx5: convert mark copy resource to indexed

Allocate mark copy resource from indexed pool helps rte flow saves the 4
bytes index instead of 8 bytes pointer. For mark copy resource itself,
it helps save MALLOC_ELEM_OVERHEAD bytes from rte_malloc().

Signed-off-by: Suanming Mou <suanmingm@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agonet/mlx5: allocate meter from indexed pool
Suanming Mou [Thu, 16 Apr 2020 08:34:26 +0000 (16:34 +0800)]
net/mlx5: allocate meter from indexed pool

This patch allocate the meter object memory from indexed memory pool
which will help to save the MALLOC_ELEM_OVERHEAD memory taken by
rte_malloc().

Signed-off-by: Suanming Mou <suanmingm@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agonet/mlx5: optimize flow meter handle type
Suanming Mou [Thu, 16 Apr 2020 08:34:25 +0000 (16:34 +0800)]
net/mlx5: optimize flow meter handle type

While flow attaches the meter handle, the meter id can be the unique tag
for the flow to get the meter handle. It's no need for flow to save the
pointer of the meter handle.

Save the meter id instead of pointer helps reduce the size for rte flow
structure.

As the supported maximum meter rule is 4K, uint16_t type is selected for
the meter id.

Signed-off-by: Suanming Mou <suanmingm@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agonet/mlx5: reorganize flow handle struct
Suanming Mou [Thu, 16 Apr 2020 08:34:24 +0000 (16:34 +0800)]
net/mlx5: reorganize flow handle struct

Currently, the mlx5_flow_handle struct is not fully aligned and has some
bits wasted. The members can be optimized and reorganized to save memory.

1. As metadata and meter is sharing the same flow match id, now the flow
   id is limited to 24 bits due to the 8 MSBs are used as for the meter
   color.  Align the flow id to other bit members to 32 bits to save the
   mlx5 flow handle memory.

2. The vlan_vf in struct mlx5_flow_handle_dv was already moved to struct
   mlx5_flow_handle. Remove the legacy vlan_vf in struct
   mlx5_flow_handle_dv.

3. Reorganize the vlan_vf in mlx5_flow_handle with member SILIST_ENTRY
   next to make it align with 8 bytes.

4. Reorganize the header modify in mlx5_flow_handle_dv to ILIST_ENTRY
   next to make it align to with bytes.

5. Introduce __rte_pack attribute to make the struct tightly organized.

It will totally save 20 bytes memory for mlx5_flow_handle struct.

For the resource objects which are converted to indexed, align the names
with the prefix of rix_.

Signed-off-by: Suanming Mou <suanmingm@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agonet/mlx5: optimize action flags in flow handle
Suanming Mou [Thu, 16 Apr 2020 08:34:23 +0000 (16:34 +0800)]
net/mlx5: optimize action flags in flow handle

As only limited bits is used in act_flags for flow destroy, it's a bit
expensive to save the whole 64 bits. Move the act_flags out of flow
handle and save the needed bits for flow destroy to save some bytes for
the flow handle data struct.

The fate action type and mark bits are reserved as they will be used in
flow destroy.

Signed-off-by: Suanming Mou <suanmingm@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agonet/mlx5: reorganize fate actions as union
Suanming Mou [Thu, 16 Apr 2020 08:34:22 +0000 (16:34 +0800)]
net/mlx5: reorganize fate actions as union

Currently, one flow only has one fate action, the fate actions members
in the flow struct can be reorganized as union to save the memory for
flow struct.

This commit reorganizes the fate actions as union, the act_flags helps
to identify the fate action type when flow destroys.

Signed-off-by: Suanming Mou <suanmingm@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agonet/mlx5: convert flow dev handle to indexed
Suanming Mou [Thu, 16 Apr 2020 02:42:08 +0000 (10:42 +0800)]
net/mlx5: convert flow dev handle to indexed

This commit converts flow dev handle to indexed.

Change the mlx5 flow handle from pointer to uint32_t saves memory for
flow. With million flow, it saves several MBytes memory.

Signed-off-by: Suanming Mou <suanmingm@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agonet/mlx5: convert hrxq to indexed
Suanming Mou [Thu, 16 Apr 2020 02:42:07 +0000 (10:42 +0800)]
net/mlx5: convert hrxq to indexed

This commit converts hrxq to indexed.

Using the uint32_t index instead of pointer saves 4 bytes memory for the
flow handle. For millions flows, it will save several MBytes of memory.

Signed-off-by: Suanming Mou <suanmingm@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agonet/mlx5: convert jump resource to indexed
Suanming Mou [Thu, 16 Apr 2020 02:42:06 +0000 (10:42 +0800)]
net/mlx5: convert jump resource to indexed

This commit convert jump resource to indexed.

The table data struct is allocated from indexed memory. As it is add in
the hash list, the pointer is still used for hash list search. The index
is added to the table struct, and the pointer in flow handle is decrease
to uint32_t type. For flow without jump flows, it saves 4 bytes memory.

Signed-off-by: Suanming Mou <suanmingm@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agonet/mlx5: convert port id action to indexed
Suanming Mou [Thu, 16 Apr 2020 02:42:05 +0000 (10:42 +0800)]
net/mlx5: convert port id action to indexed

This commit converts port id action to indexed.

Using the uint32_t index instead of pointer saves 4 bytes memory for the
flow handle. For millions flows, it will save several MBytes of memory.

Signed-off-by: Suanming Mou <suanmingm@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agonet/mlx5: convert tag resource to indexed
Suanming Mou [Thu, 16 Apr 2020 02:42:04 +0000 (10:42 +0800)]
net/mlx5: convert tag resource to indexed

This commit convert tag resource to indexed.

As tag resources are add in the hash list, to avoid introduce
performance issue and keep the hash list, only the tag resource memory
is allocated from indexed memory. The resources is still added to the
hash list. Add four bytes index in the tag resource struct and change
the tag resources in the flow handle from pointer to uint32_t seems be
no benefit for tag resource, but it saves memory for flows without tag
action. And also for sub flows share one tag action resource.

Signed-off-by: Suanming Mou <suanmingm@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agonet/mlx5: convert push VLAN resource to indexed
Suanming Mou [Thu, 16 Apr 2020 02:42:03 +0000 (10:42 +0800)]
net/mlx5: convert push VLAN resource to indexed

This commit converts the push VLAN resource to indexed.

Using the uint32_t index instead of pointer saves 4 bytes memory for the
flow handle. For millions flows, it will save several MBytes of memory.

Signed-off-by: Suanming Mou <suanmingm@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agonet/mlx5: convert encap/decap resource to indexed
Suanming Mou [Thu, 16 Apr 2020 02:42:02 +0000 (10:42 +0800)]
net/mlx5: convert encap/decap resource to indexed

This commit converts the flow encap/decap resource to indexed.

Using the uint32_t index instead of pointer saves 4 bytes memory for the
flow handle. For millions flows, it will save several MBytes of memory.

Signed-off-by: Suanming Mou <suanmingm@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agonet/mlx5: add trunk release for indexed pool
Suanming Mou [Thu, 16 Apr 2020 02:42:01 +0000 (10:42 +0800)]
net/mlx5: add trunk release for indexed pool

While entries are fully freed in trunk, it means the trunk is free now.
User may prefer the free trunk memory can be reclaimed.

Add the trunk release memory option for indexed pool in this case.

Signed-off-by: Suanming Mou <suanmingm@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agonet/mlx5: add trunk dynamic grow for indexed pool
Suanming Mou [Thu, 16 Apr 2020 02:42:00 +0000 (10:42 +0800)]
net/mlx5: add trunk dynamic grow for indexed pool

This commit add trunk dynamic grow for the indexed pool.

In case for pools which are not sure the entry number needed, pools can
be configured in increase progressively mode. It means the trunk size
will be increased dynamically one after one, then reach a stable value.
It saves memory to avoid allocate a very big trunk at beginning.

User should set both the grow_shift and grow_trunk to help the trunk
grow works. Keep one or both grow_shift and grow_trunk as 0 makes the
trunk work as fixed size.

Signed-off-by: Suanming Mou <suanmingm@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agonet/mlx5: add indexed memory pool
Suanming Mou [Thu, 16 Apr 2020 02:41:59 +0000 (10:41 +0800)]
net/mlx5: add indexed memory pool

Currently, the memory allocated by rte_malloc() also introduced more
than 64 bytes overhead. It means when allocate 64 bytes memory, the
real cost in memory maybe double. And the libc malloc() overhead is 16
bytes, If users try allocating millions of small memory blocks, the
overhead costing maybe huge. And save the memory pointer will also be
quite expensive.

Indexed memory pool is introduced to save the memory for allocating
huge amount of small memory blocks. The indexed memory uses trunk and
bitmap to manage the memory entries. While the pool is empty, the trunk
slot contains memory entry array will be allocated firstly. The bitmap
in the trunk records the entry allocation. The offset of trunk slot in
the pool and the offset of memory entry in the trunk slot compose the
index for the memory entry. So, by the index, it will be very easy to
address the memory of the entry. User saves the 32 bits index for the
memory resource instead of the 64 bits pointer.
User should create different pools for allocating different size of
small memory block. It means one pool provides one fixed size of small
memory blocked allocating.

Signed-off-by: Suanming Mou <suanmingm@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agonet/tap: fix queues fd check before close
Yunjian Wang [Fri, 17 Apr 2020 12:03:57 +0000 (20:03 +0800)]
net/tap: fix queues fd check before close

The fd is possibly a negative value while it is passed as an
argument to function "close". Fix the check to the fd.

Fixes: ed8132e7c912 ("net/tap: move fds of queues to be in process private")
Cc: stable@dpdk.org
Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agonet/bnxt: remove redefinition of page size
Ajit Khaparde [Fri, 17 Apr 2020 16:02:58 +0000 (09:02 -0700)]
net/bnxt: remove redefinition of page size

PAGE_SIZE is a common macro and cause redefinition errors.
Replace such occurrences.

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
4 years agonet/bnxt: add port database
Kishore Padmanabha [Wed, 15 Apr 2020 14:49:16 +0000 (20:19 +0530)]
net/bnxt: add port database

The port database is a repository of the port details
it is used by the ulp code to query any port related details.

Reviewed-by: Mike Baucom <michael.baucom@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>
Signed-off-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
4 years agonet/bnxt: add cache table type for TCAM lookup
Mike Baucom [Wed, 15 Apr 2020 14:49:15 +0000 (20:19 +0530)]
net/bnxt: add cache table type for TCAM lookup

In order to re-use allocated resources and reduce search complexity for
simple keys, a generic software cache table was added for the TCAM. The
implementation is specifically only for keys that can be compressed to
less than 16 bits.  The keys are generated using the same mechanisms as
other search tables, but the table type is set to a cache that mirrors
the actual TCAM table. The allocated result fields are stored in the
cache entry and can be used for subsequent searches in future tables.

Reviewed-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: Mike Baucom <michael.baucom@broadcom.com>
Signed-off-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
4 years agonet/bnxt: add default identifiers to ULP mapper
Mike Baucom [Fri, 17 Apr 2020 15:53:24 +0000 (08:53 -0700)]
net/bnxt: add default identifiers to ULP mapper

- Added ulp_mapper_init/deinit to allocate/deallocate mapper data for
  storing the default identifiers
- Modified the template_db to include the new opcode for accessing the
  default ids.
- Modified the result and key field builders to use the new opcode for
  writing the default ids into blobs

Reviewed-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: Mike Baucom <michael.baucom@broadcom.com>
Signed-off-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
4 years agonet/bnxt: add session and function flow flush
Kishore Padmanabha [Wed, 15 Apr 2020 14:49:13 +0000 (20:19 +0530)]
net/bnxt: add session and function flow flush

The ulp flow flush has been extended to support session flow
flush and function flow flush. The session flow flush is called when
there the device is sole owner of the session and it deletes all the
flows associated with that session. The function flow flush is
called if the device function is not the sole owner of the session,
it deletes all the flows that are associated with that device
function.

Reviewed-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
Reviewed-by: Mike Baucom <michael.baucom@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>
Signed-off-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
4 years agonet/bnxt: use hashing for flow template match
Kishore Padmanabha [Wed, 15 Apr 2020 14:49:12 +0000 (20:19 +0530)]
net/bnxt: use hashing for flow template match

Currently, all the flow templates are sequentially searched to find out
whether there is a matching template for the incoming RTE_FLOW offload
request. As sequential search will have performance concerns, this
patch will address it by using hash algorithm to find out the flow
template. This change resulted in creation of computed fields to
remove the fields that do not participate in the hash calculations.
The field bitmap is created for this purpose.

Reviewed-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>
Signed-off-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
4 years agonet/bnxt: aggregate ULP mapper create arguments
Mike Baucom [Wed, 15 Apr 2020 14:49:11 +0000 (20:19 +0530)]
net/bnxt: aggregate ULP mapper create arguments

The changes are to the ulp mapper flow_create, the API changed
to take the bnxt_ulp_mapper_create_parms structure instead of individual
fields.

Reviewed-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: Mike Baucom <michael.baucom@broadcom.com>
Signed-off-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
4 years agonet/bnxt: aggregate ULP parser arguments
Kishore Padmanabha [Wed, 15 Apr 2020 14:49:10 +0000 (20:19 +0530)]
net/bnxt: aggregate ULP parser arguments

The changes are to the ulp rte parser, the API are changed
to take the parser param structure instead of individual
fields.

Reviewed-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>
Signed-off-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>