dpdk.git
3 years agodevtools: fix path in forbidden token check
David Marchand [Mon, 6 Jul 2020 08:00:21 +0000 (10:00 +0200)]
devtools: fix path in forbidden token check

Fix displayed filename by adjusting the extraction from the patch.

Before:
Warning in /lib/librte_eal/linux/eal.c:

After:
Warning in lib/librte_eal/linux/eal.c:

Fixes: 7413e7f2aeb3 ("devtools: alert on new calls to exit from libs")
Cc: stable@dpdk.org
Signed-off-by: David Marchand <david.marchand@redhat.com>
3 years agoevent/octeontx2: improve datapath memory locality
Pavan Nikhilesh [Mon, 29 Jun 2020 01:33:28 +0000 (07:03 +0530)]
event/octeontx2: improve datapath memory locality

When event device is transmitting packet on OCTEONTX2 it needs to access
the destined ethernet device TXq data.
Currently, we get the TXq data through rte_eth_devices global array.
Instead save the TXq address inside event port memory.

Cc: stable@dpdk.org
Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
3 years agoevent/octeontx2: fix sub event type
Pavan Nikhilesh [Mon, 29 Jun 2020 01:33:27 +0000 (07:03 +0530)]
event/octeontx2: fix sub event type

In OCTEONTX2 event device we use sub_event_type to store the ethernet
port identifier when we receive work from OCTEONTX2 ethernet device.
This violates the event device spec as sub_event_type should be 0 in
the initial receive stage.
Set sub_event_type to 0 after copying the port id.

Fixes: 0fe4accd8ec8 ("event/octeontx2: add Rx adapter fastpath ops")
Cc: stable@dpdk.org
Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
3 years agoevent/octeontx2: fix device reconfigure
Pavan Nikhilesh [Mon, 29 Jun 2020 01:33:26 +0000 (07:03 +0530)]
event/octeontx2: fix device reconfigure

When event device is re-configured maintain the event queue to event port
links and event port status instead of resetting them.

Fixes: cd24e70258bd ("event/octeontx2: add device configure function")
Cc: stable@dpdk.org
Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
3 years agoexamples/eventdev: fix 32-bit coremask
Harry van Haaren [Tue, 16 Jun 2020 16:56:03 +0000 (17:56 +0100)]
examples/eventdev: fix 32-bit coremask

This commit fixes a bug in 32-bit environments when a core mask greater
than 32-bits is requested. The fix is to convert the bitmask logic to
64 bits, aligning 64 and 32 bit implementations.

Fixes: adb5d548 ("examples/eventdev_pipeline_sw_pmd: add sample app")
Cc: stable@dpdk.org
Reported-by: Jun W Zhou <junx.w.zhou@intel.com>
Suggested-by: Mao Jiang <maox.jiang@intel.com>
Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>
3 years agoevent/octeontx: fix memory corruption
Harman Kalra [Fri, 15 May 2020 11:21:24 +0000 (16:51 +0530)]
event/octeontx: fix memory corruption

Since PMD enqueues a single event at a time, fixing the issue by
passing 1 rather than nb_events to avoid any out of bound access as
reported by coverity.

Coverity issue: 358447
Fixes: 56a96aa42464 ("event/octeontx: add framework for Rx/Tx offloads")
Cc: stable@dpdk.org
Signed-off-by: Harman Kalra <hkalra@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
3 years agotrace: simplify trace point registration
David Marchand [Sat, 4 Jul 2020 15:14:08 +0000 (17:14 +0200)]
trace: simplify trace point registration

RTE_TRACE_POINT_DEFINE and RTE_TRACE_POINT_REGISTER must come in pairs.
Merge them and let RTE_TRACE_POINT_REGISTER handle the constructor part.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
3 years agoeal: restrict default plugin path to shared lib mode
Bruce Richardson [Fri, 26 Jun 2020 14:59:57 +0000 (15:59 +0100)]
eal: restrict default plugin path to shared lib mode

When using statically linked DPDK binaries, the EAL checks the default PMD
path and tries to load any drivers there, despite the fact that all drivers
are normally linked into the binary.  This behaviour can cause issues if
the PMD path and lib dir is configured to a non-standard location which is
not in the ld.so.conf paths, e.g. a build with prefix set to a home
directory location. In a case such as this, EAL will try and
(unnecessarily) load the .so driver files but that load will fail as their
dependent libraries, such as ethdev, for example, will not be found.

Because of this, it is better if statically linked DPDK apps do not load
drivers from the standard paths automatically. The user can always have
this behaviour by explicitly specifying the path using -d flag, if so
desired.

Not loading the libraries automatically can also prevent potential issues
with a user building and running a statically-linked DPDK binary based off
a private copy of DPDK, while there exists on the same machine a
system-wide installation of DPDK in the default locations. Without this
change, the system-installed drivers will be loaded to the binary alongside
the statically-linked drivers, which is not what the user would have
intended.

To detect whether we are in a statically or dynamically linked binary, we
can have EAL try to get a dlopen handle to its own shared library, by
calling dlopen with the RTLD_NOLOAD flag. This will return NULL if there is
no such shared lib loaded i.e. the code is executing from a static library,
or a handle to the lib if it is loaded.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
Tested-by: Sunil Pai G <sunil.pai.g@intel.com>
3 years agoeal: cache last directory permissions checked
Bruce Richardson [Fri, 3 Jul 2020 10:23:32 +0000 (11:23 +0100)]
eal: cache last directory permissions checked

When loading a directory of drivers, we check the same hierarchy multiple
times. If we just cache the last directory checked, this avoids repeated
checks of the same path, since all drivers in that path have been added to
the list consecutively.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
3 years agoeal: forbid loading drivers from insecure paths
Bruce Richardson [Fri, 3 Jul 2020 10:23:31 +0000 (11:23 +0100)]
eal: forbid loading drivers from insecure paths

Any paths on the system which are world-writable are insecure and should
not be used for loading drivers. Therefore, whenever an absolute or
relative driver path is passed to EAL, check for world-writability and
don't load any drivers from that path if it is insecure. Drivers loaded
from system locations i.e. those passed without any path info and found
automatically by the loader, are excluded from these checks as system paths
are assumed to be secure.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
3 years agoeal: load only shared libs from driver plugin directories
Bruce Richardson [Fri, 3 Jul 2020 10:23:30 +0000 (11:23 +0100)]
eal: load only shared libs from driver plugin directories

When we pass a "-d" flag to EAL pointing to a directory, we attempt to load
all files in that directory as driver plugins, irrespective of file type.
This procludes using e.g. the build/drivers directory, as a driver source
since it contains static libs and other files as well as the shared
objects.

By filtering out any files whose filename does not end in ".so", we can
improve usability by allowing other non-driver files to be present in the
driver directory.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
3 years agoeal: remove unnecessary null-termination in plugin path
Bruce Richardson [Fri, 3 Jul 2020 10:23:29 +0000 (11:23 +0100)]
eal: remove unnecessary null-termination in plugin path

Since strlcpy always null-terminates, and the buffer is zeroed before copy
anyway, there is no need to explicitly zero the end of the character
array, or to limit the bytes that strlcpy can write.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
3 years agobuild: check AVX512 rather than binutils version
Bruce Richardson [Sat, 4 Jul 2020 11:48:01 +0000 (12:48 +0100)]
build: check AVX512 rather than binutils version

Rather than checking the binutils version number, which can lead to
unnecessary disabling of AVX512 if fixes have been backported to distro
versions, we can instead check the output of "as" from binutils to see if
it is correct.

The check in the script uses the minimal assembly reproduction code posted
to the public bug tracker for gcc/binutils for those issues [1]. If the
binutils bug is present, the instruction parameters - specifically the
displacement parameter - will be different in the disassembled output
compared to the input. Therefore the check involves assembling a single
instruction and disassembling it again, checking that the two match.

[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90028

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Tested-by: Harry van Haaren <harry.van.haaren@intel.com>
3 years agomem: fix 32-bit init config with meson
Bruce Richardson [Thu, 2 Jul 2020 10:57:21 +0000 (11:57 +0100)]
mem: fix 32-bit init config with meson

When building with meson, the default size of virtual address space
reserved for mapping pages was globally set at 512GB, which is too big for
use in 32-bit processes. To match the behaviour with "make", we configure
this to be 512GB for 64-bit and 2GB for 32-bit builds.

Bugzilla ID: 498
Fixes: 66cc45e293ed ("mem: replace memseg with memseg lists")
Cc: stable@dpdk.org
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Tested-by: Ferruh Yigit <ferruh.yigit@intel.com>
3 years agoexamples/l2fwd: add forwarding port mapping option
Vamsi Attunuru [Mon, 27 Apr 2020 18:31:16 +0000 (00:01 +0530)]
examples/l2fwd: add forwarding port mapping option

Current l2fwd application statically configures adjacent ports as
destination ports for forwarding the traffic.

Add a portmap option to pass the forwarding port pair mapping which allows
the user to configure forwarding port mapping.

If no portmap argument is specified, destination port map is not
changed and traffic gets forwarded with existing mapping.

To align port/queue configuration of each lcore with destination port
map, port/queue configuration of each lcore gets modified when portmap
option is specified.

Ex: ./l2fwd -c 0xff -- -p 0x3f -q 2 --portmap="(0,3)(1,4)(2,5)"

With above portmap option, traffic received from portid = 0 gets forwarded
to port = 3 and vice versa, similarly traffic gets forwarded on other port
pairs (1,4) and (2,5)

Signed-off-by: Vamsi Attunuru <vattunuru@marvell.com>
Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Acked-by: Andrzej Ostruszka <aostruszka@marvell.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
3 years agobuild: remove special handling for node library
Thomas Monjalon [Wed, 1 Jul 2020 07:31:34 +0000 (09:31 +0200)]
build: remove special handling for node library

The node library had a need of being linked as a whole
to make some constructors effective.
Now that all libraries are linked with --whole-archive,
there is no need to have this library separate.

Fixes: e2db26f76673 ("build: always link whole DPDK static libraries")

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Tested-by: Jerin Jacob <jerinj@marvell.com>
3 years agolog: introduce logtype register macro
Jerin Jacob [Wed, 1 Jul 2020 12:33:35 +0000 (18:03 +0530)]
log: introduce logtype register macro

Introduce the RTE_LOG_REGISTER macro to avoid the code duplication
in the logtype registration process.

It is a wrapper macro for declaring the logtype, registering it and
setting its level in the constructor context.

Signed-off-by: Jerin Jacob <jerinj@marvell.com>
Acked-by: Adam Dybkowski <adamx.dybkowski@intel.com>
Acked-by: Sachin Saxena <sachin.saxena@nxp.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
3 years agotest/ring: rename stress test for MT peek API
Konstantin Ananyev [Thu, 2 Jul 2020 14:10:27 +0000 (15:10 +0100)]
test/ring: rename stress test for MT peek API

Rename test_ring_peek_stress to test_ring_mt_peek_stress to
keep same naming conventions for ST and MT test cases.

Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
3 years agotest/ring: add stress test for ST peek API
Konstantin Ananyev [Thu, 2 Jul 2020 14:10:26 +0000 (15:10 +0100)]
test/ring: add stress test for ST peek API

Introduce new test case to test ST peek API.

Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
3 years agotest/ring: reduce compilation time
Konstantin Ananyev [Wed, 29 Apr 2020 17:57:14 +0000 (18:57 +0100)]
test/ring: reduce compilation time

Rework test code to reduce code complexity for the compiler and
bring down compilation time and memory consumption.
Current test_ring_enqueue/test_ring_dequeue functions contain
too many branches and it takes compiler a lot of effort to resolve all
of them at compile time.
So the patch replaces these branchy function invocations
with an  array of function pointers (test_enqdeq_impl[]).
That way compiler knows straightway which function to use
for each particular case.

Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
3 years agodevtools: allow ENOSYS in checkpatch
Thomas Monjalon [Mon, 8 Jun 2020 13:28:50 +0000 (15:28 +0200)]
devtools: allow ENOSYS in checkpatch

The Linux checkpatch default is warning on the use of ENOSYS.
This is allowed in DPDK API.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
3 years agodevtools: remove useless files from ABI reference
Thomas Monjalon [Sun, 24 May 2020 17:43:41 +0000 (19:43 +0200)]
devtools: remove useless files from ABI reference

When building an ABI reference with meson, some static libraries
are built and linked in apps. They are useless and take a lot of space.
Those binaries, and other useless files (examples and doc files)
in the share/ directory, are removed after being installed.

In order to save time when building the ABI reference,
the examples (which are not installed anyway) are not compiled.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: David Marchand <david.marchand@redhat.com>
3 years agodevtools: forbid variable declaration inside for
Thomas Monjalon [Sun, 24 May 2020 17:30:07 +0000 (19:30 +0200)]
devtools: forbid variable declaration inside for

Some compilers raise an error when declaring a variable
in the middle of a function. This is a C99 allowance.
Even if DPDK switches globally to C99 or C11 standard,
the coding rules are for declarations at the beginning
of a block:
http://doc.dpdk.org/guides/contributing/coding_style.html#local-variables

This coding style is enforced by adding a check of
the common patterns like "for (int i;"

The occurrences of the checked pattern are fixed:
'for *(\(char\|u\?int\|unsigned\|s\?size_t\)'
In the file dpaa2_sparser.c, the fix is to remove the unused macros.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: David Marchand <david.marchand@redhat.com>
3 years agobuild/pkg-config: prevent overlinking
Bruce Richardson [Tue, 30 Jun 2020 14:14:33 +0000 (15:14 +0100)]
build/pkg-config: prevent overlinking

Add the --as-needed linker flag to the DPDK library list in the pkg-config
file so as to prevent overlinking. Without this flag, when linking
statically using flags from $(pkg-config --static --libs libdpdk), all DPDK
drivers and libs were statically linked in, but the binary was also
requiring all the shared versions be present to run.

The real root-cause of this issue is that the DPDK libraries need to be
duplicated in the linker command when doing static linking, due to the
behaviour of pkg-config, but since that behaviour cannot be easily changed,
this is a simple workaround to avoid problems.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Luca Boccassi <bluca@debian.org>
Acked-by: Sunil Pai G <sunil.pai.g@intel.com>
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
3 years agobuild/pkg-config: improve static linking flags
Bruce Richardson [Tue, 30 Jun 2020 14:14:32 +0000 (15:14 +0100)]
build/pkg-config: improve static linking flags

Rather than setting -Bstatic in the linker flags when doing a static link,
and then having to explicitly set -Bdynamic again afterwards, we can update
the pkg-config file to use -l:libfoo.a syntax to explicitly refer to the
static library in question. Since this syntax is not supported by meson's
pkg-config module directly, we can post-process the .pc files instead to
adjust them.

Once done, we can simplify the examples' makefiles and the docs by removing
the explicit static flag.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Luca Boccassi <bluca@debian.org>
Acked-by: Sunil Pai G <sunil.pai.g@intel.com>
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
3 years agobuild/pkg-config: output drivers first for static build
Bruce Richardson [Tue, 30 Jun 2020 14:14:31 +0000 (15:14 +0100)]
build/pkg-config: output drivers first for static build

When calling pkg-config --static --libs, pkg-config will always output the
regular libs first, and then the extra libs from Libs.private field,
since the assumption is that those are additional dependencies for building
statically that the .a files depend upon.

However, for DPDK, we only link the driver files for static builds, and
those need to come *before* the regular libraries. To get this result, we
need two pkgconfig files for DPDK, one for the shared libs, and a second
for the static libs and drivers, which depends upon the first. Using a
dependency means that the shared libs are printed only after the
Libs.private field rather than before.

Without this patch, the linking works in DPDK because in all cases we
specify the libraries after the drivers in the Libs.private line, ensuring
that the references to the libs from the drivers can be resolved. The
current output is therefore of the form, "(shared)libs, drivers,
(static)libs", while after this patch the output is, "drivers,
(static)libs, (shared)libs". The former case will not work if we use the
--whole-archive flag on the static libs as it will lead to duplicate
definitions due to some references having been previously resolved from the
shared libraries. By ensuring the shared libraries come last in the link
link, this issue does not occur, as duplicate references when linking the
shared libs will be ignored.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Luca Boccassi <bluca@debian.org>
Acked-by: Sunil Pai G <sunil.pai.g@intel.com>
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
3 years agobuild/pkg-config: move pkg-config file creation
Bruce Richardson [Tue, 30 Jun 2020 14:14:30 +0000 (15:14 +0100)]
build/pkg-config: move pkg-config file creation

Ahead of changes to rework the file, move the pkg-config file generation to
a new directory under buildtools. This allows the meson code to be
separated out from the main meson.build for simplicity, and also allows any
additional scripts for working with the pkg-config files to be placed there
too.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Luca Boccassi <bluca@debian.org>
Acked-by: Sunil Pai G <sunil.pai.g@intel.com>
3 years agodevtools: test static linkage with pkg-config
Bruce Richardson [Tue, 30 Jun 2020 14:14:29 +0000 (15:14 +0100)]
devtools: test static linkage with pkg-config

The pkg-config file was tested by building some of the examples using make,
pulling the cflags and ldflags from the pkg-config file for DPDK. However,
this only tested the shared library linkage, and not the static, so this
patch updates it to test both.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Luca Boccassi <bluca@debian.org>
Acked-by: Sunil Pai G <sunil.pai.g@intel.com>
3 years agobuild: remove unnecessary variable
Bruce Richardson [Tue, 30 Jun 2020 14:14:28 +0000 (15:14 +0100)]
build: remove unnecessary variable

Since all libraries are explicitly linked as part of a build, we no longer
need to track ones that should be always included for linking against apps.

Previously telemetry was special-cased for linking as it was not directly
needed by the linker when linking the apps, since they never called into it
directly. This meant that it could be forgotten when specifying the app
dependencies, and so the telemetry support would not work. This
special-casing was never needed for make as it always linked in all
libraries, as meson does now.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Luca Boccassi <bluca@debian.org>
Acked-by: Sunil Pai G <sunil.pai.g@intel.com>
3 years agobuild: always link whole DPDK static libraries
Bruce Richardson [Tue, 30 Jun 2020 14:14:27 +0000 (15:14 +0100)]
build: always link whole DPDK static libraries

To ensure all constructors are included in static build, we need to pass
the --whole-archive flag when linking, which is used with the
"link_whole" meson option. Since we use link_whole for all libs, we no
longer need to track the lib as part of the static dependency, just the
path to the headers for compiling.

After this patch is applied, all DPDK .a files are inside
--whole-archive/--no-whole-archive flags, but external dependencies and
shared libs being linked against remain outside.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Tested-by: Andrzej Ostruszka <aostruszka@marvell.com>
Acked-by: Luca Boccassi <bluca@debian.org>
Acked-by: Sunil Pai G <sunil.pai.g@intel.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
3 years agotest: fix build with ring PMD but no bond PMD
Bruce Richardson [Wed, 27 May 2020 14:57:45 +0000 (15:57 +0100)]
test: fix build with ring PMD but no bond PMD

If the bonding pmd is disabled, all autotest associated with it should be
disabled. However, some of those tests also depended upon the ring PMD so
were placed in a block depending on that driver - and unfortunately that
driver alone. This caused build failures if the ring PMD was enabled but
the bonding PMD disabled, due to missing header files and driver libs.

This error can be reproduced by configuring DPDK using e.g.

  meson configure -Ddisable_drivers=net/[!r]* build

(which will disable all drivers not starting with "r"), and then building
using ninja.

Fix this by moving all link bonding autotests to the one block and putting
a second conditional check within that block for those also requiring the
ring PMD.

Fixes: 7f6ef1664027 ("test/bonding: allow disabling driver")
Fixes: 207b1c813f39 ("test: fix build without ring PMD")

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
3 years agoring: optimize empty test
Morten Brørup [Tue, 19 May 2020 15:27:25 +0000 (15:27 +0000)]
ring: optimize empty test

Testing if the ring is empty is as simple as comparing the producer and
consumer pointers.

In theory, this optimization reduces the number of potential cache misses
from 3 to 2 by not having to read r->mask in rte_ring_count().

The modification of this function were also discussed in the RFC here:
https://mails.dpdk.org/archives/dev/2020-April/165752.html

Signed-off-by: Morten Brørup <mb@smartsharesystems.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
3 years agoring: cleanup coding style
Morten Brørup [Tue, 19 May 2020 15:27:24 +0000 (15:27 +0000)]
ring: cleanup coding style

Fix coding style violations that checkpatch will complain about.

Add missing "int" after "unsigned".
Add missing spaces around "+=" and "+".
Remove superfluous type cast of numerical constant.

Suggested-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Signed-off-by: Morten Brørup <mb@smartsharesystems.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
3 years agoring: fix tail in peek API for ST mode
Feifei Wang [Sun, 28 Jun 2020 06:23:47 +0000 (14:23 +0800)]
ring: fix tail in peek API for ST mode

The value of *tail should be the prod->tail not prod->head. After
modification, it can record 'tail' so head/tail can be updated
accordingly.

Fixes: 664ff4b1729b ("ring: introduce peek style API")

Signed-off-by: Feifei Wang <feifei.wang2@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
3 years agoring: fix bulk enqueue for HTS/RTS ring modes
Feifei Wang [Wed, 10 Jun 2020 05:57:04 +0000 (13:57 +0800)]
ring: fix bulk enqueue for HTS/RTS ring modes

Remove the unwanted call to "_rte_ring_do_enqueue_elem" to allow for
correct handling of RTS/HTS modes.

Fixes: e6ba4731c0f3 ("ring: introduce RTS ring mode")

Signed-off-by: Feifei Wang <feifei.wang2@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Acked-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
3 years agotest/ring: fix statistics in bulk enq/dequeue
Feifei Wang [Mon, 8 Jun 2020 05:58:46 +0000 (13:58 +0800)]
test/ring: fix statistics in bulk enq/dequeue

In size 32 bulk ring enq/dequeue performance test, the "Total count"
statistics is incorrect. For example, running the test on lcore 25 and
lcore 26, the output is as follows:

The test command:
$sudo ./arm64-armv8a-linuxapp-gcc/app/test -l 25-26
RTE>>ring_perf_autotest

Bulk enq/dequeue count on size 32
Core [25] count = 288268
Core [26] count = 288281
Total count (size: 32): 1066323

Fixed it by reset the counter at the beginning of each loop. The
revised output is as follows:

Bulk enq/dequeue count on size 32
Core [25] count = 285643
Core [26] count = 285688
Total count (size: 32): 571331

Fixes: 759cf9b5632c ("test/ring: enhance mp/mc coverage")
Cc: stable@dpdk.org
Signed-off-by: Feifei Wang <feifei.wang2@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Reviewed-by: Phil Yang <phil.yang@arm.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
3 years agonet/af_xdp: revert to MP/MC ring for copy mode
Ciara Loftus [Thu, 25 Jun 2020 13:39:50 +0000 (13:39 +0000)]
net/af_xdp: revert to MP/MC ring for copy mode

This reverts commit 489e0b5b33209d929dc490cc591abd840dcefdfc.

The ring used in copy mode should be multi-producer multi-consumer
because enqueues and dequeues to the ring are performed on both the rx
and tx paths, which can be running on different threads.

Fixes: 489e0b5b3320 ("net/af_xdp: use single producer/consumer ring")
Cc: stable@dpdk.org
Signed-off-by: Ciara Loftus <ciara.loftus@intel.com>
3 years agonet/af_xdp: improve packet loss
Ciara Loftus [Tue, 23 Jun 2020 14:29:25 +0000 (14:29 +0000)]
net/af_xdp: improve packet loss

This commit makes some changes to the AF_XDP PMD in an effort to improve
its packet loss characteristics.

1. In the case of failed transmission due to inability to reserve a tx
   descriptor, the PMD now pulls from the completion ring, issues a
   syscall in which the kernel attempts to complete outstanding tx
   operations, then tries to reserve the tx descriptor again. Prior to
   this we dropped the packet after the syscall and didn't try to
   re-reserve.

2. During completion ring cleanup, always pull as many entries as
   possible from the ring as opposed to the batch size or just how many
   packets we're going to attempt to send. Keeping the completion ring
   emptier should reduce failed transmissions in the kernel, as the
   kernel requires space in the completion ring to successfully tx.

3. Size the fill ring as twice the receive ring size which may help
   reduce allocation failures in the driver.

4. Emulate a tx_free_thresh - when the number of available entries in
   the completion ring rises above this, we pull from it. The threshold
   is set to 1k entries.

With these changes, a benchmark which measured the packet rate at which
0.01% packet loss could be reached improved from ~0.1G to ~3Gbps.

Signed-off-by: Ciara Loftus <ciara.loftus@intel.com>
Acked-by: Xiaolong Ye <xiaolong.ye@intel.com>
3 years agomaintainers: update for af_xdp
Ciara Loftus [Tue, 30 Jun 2020 12:04:58 +0000 (12:04 +0000)]
maintainers: update for af_xdp

Replace Xiaolong Ye with Ciara Loftus.

Signed-off-by: Ciara Loftus <ciara.loftus@intel.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
3 years agomaintainers: resign from next-net-intel/virtio/vhost/af_xdp
Xiaolong Ye [Thu, 18 Jun 2020 14:14:11 +0000 (22:14 +0800)]
maintainers: resign from next-net-intel/virtio/vhost/af_xdp

I will leave Intel soon and likely won't have dedicated time for
maintainership, so removing my name from all related maintainer roles.

Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
3 years agovhost: fix features definition location
Matan Azrad [Thu, 18 Jun 2020 19:08:20 +0000 (19:08 +0000)]
vhost: fix features definition location

The vhost library provide an infrastructure in order to help the DPDK
users to manage vhost devices.

One of the infrastructure parts is the features enablement APIs.

Some features bits may be defined only in the internal file vhost.h in
case the kernel version doesn't include them.

Hence, user running on old kernel may not be able to manage thus
features.

Move all the feature bits definitions to the API file rte_vhost.h.

Fixes: db69be54b6ff ("vhost: hide internal code")
Fixes: 8d286dbeb8d7 ("vhost: fix multiple queue not enabled for old kernels")
Fixes: 3d3c6590b58c ("vhost: enable virtio MTU feature")
Fixes: 704098fc478c ("vhost: fix build with old kernels")
Cc: stable@dpdk.org
Signed-off-by: Matan Azrad <matan@mellanox.com>
Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
3 years agonet/virtio: simplify variable name
Joyce Kong [Wed, 24 Jun 2020 08:45:10 +0000 (16:45 +0800)]
net/virtio: simplify variable name

Virtio_hw *hw has been pointed to vq->hw, it is better to use
hw instead of vq->hw in later code.

Signed-off-by: Joyce Kong <joyce.kong@arm.com>
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
3 years agovdpa/mlx5: support queue update
Matan Azrad [Mon, 29 Jun 2020 14:08:21 +0000 (14:08 +0000)]
vdpa/mlx5: support queue update

Last changes in vDPA device management by vhost library may cause queue
ready state update after the device configuration.

So, there is chance that some queue configuration information will be
known only after the device was configured.

Add support to reconfigure a queue after the device configuration
according to the queue state update and the configuration changes.

Adjust the host notifier and the guest notification configuration to be
per queue and to be applied in the enablement process.

Signed-off-by: Matan Azrad <matan@mellanox.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
3 years agovhost: notify virtq file descriptor update
Matan Azrad [Mon, 29 Jun 2020 14:08:20 +0000 (14:08 +0000)]
vhost: notify virtq file descriptor update

When virtq call or kick file descriptors are changed in the device
configuration when the queue is ready, the application and the vDPA
driver should be notified to be aligned to the new file descriptors.

Notify the state to be disabled before the file descriptor update and
return it back to be enabled after the update.

Signed-off-by: Matan Azrad <matan@mellanox.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
3 years agovhost: handle memory hotplug with vDPA devices
Matan Azrad [Mon, 29 Jun 2020 14:08:19 +0000 (14:08 +0000)]
vhost: handle memory hotplug with vDPA devices

Some vDPA drivers' basic configurations should be updated when the
guest memory is hotplugged.

Close vDPA device before hotplug operation and recreate it after the
hotplug operation is done.

Signed-off-by: Matan Azrad <matan@mellanox.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
3 years agovhost: improve device readiness notifications
Matan Azrad [Mon, 29 Jun 2020 14:08:18 +0000 (14:08 +0000)]
vhost: improve device readiness notifications

Some guest drivers may not configure disabled virtio queues.

In this case, the vhost management never notifies the application and
the vDPA device readiness because it waits to the device to be ready.

The current ready state means that all the virtio queues should be
configured regardless the enablement status.

In order to support this case, this patch changes the ready state:
The device is ready when at least 1 queue pair is configured and
enabled.

So, now, the application and vDPA driver are notifies when the first
queue pair is configured and enabled.

Also the queue notifications will be triggered according to the new
ready definition.

Signed-off-by: Matan Azrad <matan@mellanox.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
3 years agovhost: skip access lock when vDPA is configured
Matan Azrad [Mon, 29 Jun 2020 14:08:17 +0000 (14:08 +0000)]
vhost: skip access lock when vDPA is configured

No need to take access lock in the vhost-user message handler when
vDPA driver controls all the data-path of the vhost device.

It allows the vDPA set_vring_state operation callback to configure
guest notifications.

Signed-off-by: Matan Azrad <matan@mellanox.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
3 years agovhost: support host notifier queue configuration
Matan Azrad [Mon, 29 Jun 2020 14:08:16 +0000 (14:08 +0000)]
vhost: support host notifier queue configuration

As an arrangement to per queue operations in the vDPA device it is
needed to change the next experimental API:

The API ``rte_vhost_host_notifier_ctrl`` was changed to be per queue
instead of per device.

A `qid` parameter was added to the API arguments list.

Setting the parameter to the value RTE_VHOST_QUEUE_ALL configures the
host notifier to all the device queues as done before this patch.

Signed-off-by: Matan Azrad <matan@mellanox.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
3 years agovdpa/mlx5: control completion queue event mode
Matan Azrad [Mon, 29 Jun 2020 14:01:56 +0000 (14:01 +0000)]
vdpa/mlx5: control completion queue event mode

The CQ polling is necessary in order to manage guest notifications when
the guest doesn't work with poll mode (callfd != -1).

The CQ polling scheduling method can affect the host CPU utilization and
the traffic bandwidth.

Define 3 modes to control the CQ polling scheduling:

1. A timer thread which automatically adjusts its delays to the coming
   traffic rate.
2. A timer thread with fixed delay time.
3. Interrupts: Each CQE burst arms the CQ in order to get an interrupt
   event in the next traffic burst.

When traffic becomes off, mode 3 is taken automatically.

The interrupt management takes a lot of CPU cycles but forward traffic
event to the guest very fast.

Timer thread save the interrupt overhead but may add delay for the guest
notification.

Add device arguments to control on the mode.

Signed-off-by: Matan Azrad <matan@mellanox.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
3 years agovdpa/mlx5: optimize completion queue poll
Matan Azrad [Mon, 29 Jun 2020 14:01:55 +0000 (14:01 +0000)]
vdpa/mlx5: optimize completion queue poll

The vDPA driver uses a CQ in order to know when traffic works were
completed by the HW.

Each traffic burst completion adds a CQE to the CQ.

When the vDPA driver detects CQEs in the CQ, it triggers the guest
notification for the corresponding queue and consumes all of them.

There is collapse feature in the HW that configures the HW to write all
the CQEs in the first entry of the CQ.

Using this feature, the vDPA driver can read only the first CQE,
validate that the completion counter inside the CQE was changed and if
so, to notify the guest.

Use CQ collapse feature in order to improve the poll utilization.

Signed-off-by: Matan Azrad <matan@mellanox.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
3 years agovdpa/mlx5: optimize notification events
Matan Azrad [Mon, 29 Jun 2020 14:01:54 +0000 (14:01 +0000)]
vdpa/mlx5: optimize notification events

When the virtio guest driver doesn't work with poll mode, the driver
creates event mechanism in order to schedule completion notifications
for each virtq burst traffic.

When traffic comes to a virtq, a CQE will be added to the virtq CQ by
the FW.
The driver requests interrupt for the next CQE index, and when interrupt
is triggered, the driver polls the CQ and notifies the guest by virtq
callfd writing.

According to the described method, the interrupts will be triggered for
each burst of traffic. The burst size depends on interrupt latency.

Interrupts management takes a lot of CPU cycles and using it for each
traffic burst takes big portion of CPU capacity.

When traffic is on, using timer for CQ poll scheduling instead of
interrupts saves a lot of CPU cycles.

Move CQ poll scheduling to be done by timer in case of running traffic.
Request interrupts only when traffic is off.

The timer scheduling management is done by a new dedicated thread uses
a usleep command.

Signed-off-by: Matan Azrad <matan@mellanox.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
3 years agocommon/mlx5: remove unneeded experimental build flag
David Marchand [Thu, 25 Jun 2020 07:57:41 +0000 (09:57 +0200)]
common/mlx5: remove unneeded experimental build flag

allow_experimental_apis flag has no effect for in-tree compilation.
See https://git.dpdk.org/dpdk/commit/?id=acec04c4b2f5

Fixes: 72f756605651 ("common/mlx5: move glue files under Linux directory")

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Raslan Darawsheh <rasland@mellanox.com>
3 years agonet/mlx5: fix iterator type in Rx queue management
Michael Baum [Wed, 24 Jun 2020 13:50:39 +0000 (13:50 +0000)]
net/mlx5: fix iterator type in Rx queue management

The mlx5_check_vec_rx_support function in the mlx5_rxtx_vec.c file
passes the RX queues array in the loop. Similarly, the mlx5_mprq_enabled
function in the mlx5_rxq.c file passes the RX queues array in the loop.

In both cases, the iterator of the loop is called i and the variable
representing the array size is called rxqs_n.
The i variable is of UINT16_T type while the rxqs_n variable is of
unsigned int type. The size of the rxqs_n variable is much larger than
the number of iterations allowed by the i type, theoretically there may
be a situation where the value of the rxqs_n will be greater than can be
represented by 16 bits and the loop will never end.

Change the type of i to UINT32_T.

Fixes: 7d6bf6b866b8 ("net/mlx5: add Multi-Packet Rx support")
Fixes: 6cb559d67b83 ("net/mlx5: add vectorized Rx/Tx burst for x86")
Cc: stable@dpdk.org
Signed-off-by: Michael Baum <michaelba@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
3 years agonet/mlx5: use anonymous Direct Verbs allocator argument
Michael Baum [Wed, 24 Jun 2020 13:46:41 +0000 (13:46 +0000)]
net/mlx5: use anonymous Direct Verbs allocator argument

The mlx5_dev_spawn function defines an struct mlx5dv_ctx_allocators type
variable several hundred rows after it starts, with the only use it
being passed as a parameter to the mlx5_glue->dv_set_context_attr
function.
However, according to DPDK Coding Style Guidelines, variables should be
declared at the start of a block of code rather than in the middle.
Therefore, to improve the Coding Style, the variable is passed directly
to the function without declaring it before.

Signed-off-by: Michael Baum <michaelba@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
3 years agonet/mlx4: remove useless assignment
Michael Baum [Wed, 24 Jun 2020 13:44:27 +0000 (13:44 +0000)]
net/mlx4: remove useless assignment

The mlx4_ibv_device_to_pci_addr function defines a variable called ret
inside a loop and uses it.

During the loop, the function assigns a value within the variable and
breaks from the loop, so that this assigning has done nothing and is
actually unnecessary.

Remove the unnecessary assigning.

Signed-off-by: Michael Baum <michaelba@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
3 years agocommon/mlx5: remove useless assignment
Michael Baum [Wed, 24 Jun 2020 13:33:50 +0000 (13:33 +0000)]
common/mlx5: remove useless assignment

The mlx5_dev_to_pci_addr function defines a variable called ret inside a
loop and uses it.

During the loop, the function assigns a value within the variable and
breaks from the loop, so that this assigning has done nothing and is
actually unnecessary.

Remove the unnecessary assigning.

Signed-off-by: Michael Baum <michaelba@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
3 years agonet/mlx4: use anonymous Direct Verbs allocator argument
Michael Baum [Wed, 24 Jun 2020 13:29:55 +0000 (13:29 +0000)]
net/mlx4: use anonymous Direct Verbs allocator argument

The mlx4_pci_probe function defines an struct mlx4dv_ctx_allocators type
variable several hundred rows after it starts, with the only use it
being passed as a parameter to the mlx4_glue->dv_set_context_attr
function.
However, according to DPDK Coding Style Guidelines, variables should be
declared at the start of a block of code rather than in the middle.
Therefore, to improve the Coding Style, the variable is passed directly
to the function without declaring it before.

Signed-off-by: Michael Baum <michaelba@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
3 years agonet/mlx5: use direct API to find port by device
Michael Baum [Wed, 24 Jun 2020 13:23:57 +0000 (13:23 +0000)]
net/mlx5: use direct API to find port by device

Using RTE_ETH_FOREACH_DEV_OF loop is not necessary when the driver wants
to find only the first match.

Use rte_eth_find_next_of to find it.

Signed-off-by: Michael Baum <michaelba@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
3 years agocommon/mlx5: fix code arrangement in tag allocation
Michael Baum [Wed, 24 Jun 2020 13:20:31 +0000 (13:20 +0000)]
common/mlx5: fix code arrangement in tag allocation

Flow tag action is supported only when the driver has DR or DV support.
The tag allocation is adjusted to the modes DV or DR.

In case both DR and DV are not supported in the system, the driver
handles static code for error report.
This error code, wrongly, was compiled when DV is supported while in
this case it cannot be accessed at all.

Ignore the aforementioned static error code in case of DV by
preprocessor commands rearrangement.

Fixes: cbb66daa3c85 ("net/mlx5: prepare Direct Verbs for Direct Rule")
Cc: stable@dpdk.org
Signed-off-by: Michael Baum <michaelba@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
3 years agonet/mlx5: add parameter for LACP packets control
Shiri Kuzin [Tue, 23 Jun 2020 08:41:07 +0000 (11:41 +0300)]
net/mlx5: add parameter for LACP packets control

The new devarg will control the steering of the lacp traffic.
When setting dv_lacp_by_user = 0 the lacp traffic will be
steered to kernel and managed there.

When setting dv_lacp_by_user = 1 the lacp traffic will
not be steered and the user will need to manage it.

Signed-off-by: Shiri Kuzin <shirik@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
3 years agonet/mlx5: add default miss action to flow engine
Shiri Kuzin [Tue, 23 Jun 2020 08:41:06 +0000 (11:41 +0300)]
net/mlx5: add default miss action to flow engine

The new action is an internal mlx5 action that will call
the rdma-core function MLX5DV_FLOW_ACTION_DEFAULT_MISS.

The default miss action will be used when a bond is
configured to allow traffic related to the bond to
be managed in the kernel.

Signed-off-by: Shiri Kuzin <shirik@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
3 years agocommon/mlx5: add default miss action
Shiri Kuzin [Tue, 23 Jun 2020 08:41:05 +0000 (11:41 +0300)]
common/mlx5: add default miss action

Add dv_create_action_default_miss wrapper function
for the action added to the rdma-core
MLX5DV_FLOW_ACTION_DEFAULT_MISS.

When a packet matches MLX5DV_FLOW_ACTION_DEFAULT_MISS
action it is steered to the default miss of the verbs
steering domain.

Signed-off-by: Shiri Kuzin <shirik@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
3 years agodoc: update for ice DCF datapath configuration
Qi Zhang [Tue, 23 Jun 2020 12:29:33 +0000 (20:29 +0800)]
doc: update for ice DCF datapath configuration

Add DCF datapath configuration to release notes.
Add "ice_dcf" driver feature list.

Signed-off-by: Ting Xu <ting.xu@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Reviewed-by: Qiming Yang <qiming.yang@intel.com>
3 years agonet/ice: set MAC filter during start for DCF
Qi Zhang [Tue, 23 Jun 2020 02:38:37 +0000 (10:38 +0800)]
net/ice: set MAC filter during start for DCF

Add support to add and delete MAC address filter in DCF.

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Signed-off-by: Ting Xu <ting.xu@intel.com>
Reviewed-by: Qiming Yang <qiming.yang@intel.com>
3 years agonet/ice: enable stats for DCF
Qi Zhang [Tue, 23 Jun 2020 02:38:36 +0000 (10:38 +0800)]
net/ice: enable stats for DCF

Add support to get and reset Rx/Tx stats in DCF. Query stats
from PF.

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Signed-off-by: Ting Xu <ting.xu@intel.com>
Reviewed-by: Qiming Yang <qiming.yang@intel.com>
3 years agonet/ice: add queue start and stop for DCF
Qi Zhang [Tue, 23 Jun 2020 02:38:35 +0000 (10:38 +0800)]
net/ice: add queue start and stop for DCF

Add queue start and stop in DCF. Support queue enable and disable
through virtual channel. Add support for Rx queue mbufs allocation
and queue reset.

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Signed-off-by: Ting Xu <ting.xu@intel.com>
Reviewed-by: Qiming Yang <qiming.yang@intel.com>
3 years agonet/ice: add queue config in DCF
Qi Zhang [Tue, 23 Jun 2020 02:38:34 +0000 (10:38 +0800)]
net/ice: add queue config in DCF

Add queues and Rx queue irqs configuration during device start
in DCF. The setup is sent to PF via virtchnl.

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Signed-off-by: Ting Xu <ting.xu@intel.com>
Reviewed-by: Qiming Yang <qiming.yang@intel.com>
3 years agonet/ice: init RSS during DCF start
Qi Zhang [Tue, 23 Jun 2020 02:38:33 +0000 (10:38 +0800)]
net/ice: init RSS during DCF start

Enable RSS initialization during DCF start. Add RSS LUT and
RSS key configuration functions.

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Signed-off-by: Ting Xu <ting.xu@intel.com>
Reviewed-by: Qiming Yang <qiming.yang@intel.com>
3 years agonet/ice: add Rx queue init in DCF
Qi Zhang [Tue, 23 Jun 2020 02:38:32 +0000 (10:38 +0800)]
net/ice: add Rx queue init in DCF

Enable Rx queues initialization during device start in DCF.

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Signed-off-by: Ting Xu <ting.xu@intel.com>
Reviewed-by: Qiming Yang <qiming.yang@intel.com>
3 years agonet/ice: add stop flag for device start/stop
Qi Zhang [Tue, 23 Jun 2020 02:38:31 +0000 (10:38 +0800)]
net/ice: add stop flag for device start/stop

Add stop flag for DCF device start and stop.

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Signed-off-by: Ting Xu <ting.xu@intel.com>
Reviewed-by: Qiming Yang <qiming.yang@intel.com>
3 years agonet/ice: complete queue setup in DCF
Qi Zhang [Tue, 23 Jun 2020 02:38:30 +0000 (10:38 +0800)]
net/ice: complete queue setup in DCF

Delete original DCF queue setup functions and use ice
queue setup and release functions instead.

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Signed-off-by: Ting Xu <ting.xu@intel.com>
Reviewed-by: Qiming Yang <qiming.yang@intel.com>
3 years agonet/ice: complete device configure in DCF
Qi Zhang [Tue, 23 Jun 2020 02:38:29 +0000 (10:38 +0800)]
net/ice: complete device configure in DCF

Enable device configuration function in DCF.

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Signed-off-by: Ting Xu <ting.xu@intel.com>
Reviewed-by: Qiming Yang <qiming.yang@intel.com>
3 years agonet/ice: complete device info get in DCF
Qi Zhang [Tue, 23 Jun 2020 02:38:28 +0000 (10:38 +0800)]
net/ice: complete device info get in DCF

Add support to get complete device information for DCF, including
Rx/Tx offload capabilities and default configuration.

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Signed-off-by: Ting Xu <ting.xu@intel.com>
Reviewed-by: Qiming Yang <qiming.yang@intel.com>
3 years agonet/ice: init RSS and supported RXDID in DCF
Qi Zhang [Tue, 23 Jun 2020 02:38:27 +0000 (10:38 +0800)]
net/ice: init RSS and supported RXDID in DCF

Enable RSS parameters initialization and get the supported
flexible descriptor RXDIDs bitmap from PF during DCF init.

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Signed-off-by: Ting Xu <ting.xu@intel.com>
Reviewed-by: Qiming Yang <qiming.yang@intel.com>
3 years agonet/bnxt: update ULP template database for new opcodes
Kishore Padmanabha [Fri, 12 Jun 2020 12:50:24 +0000 (18:20 +0530)]
net/bnxt: update ULP template database for new opcodes

The ulp template database is updated to support the new
combined opcodes.

Signed-off-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>
Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
Reviewed-by: Mike Baucom <michael.baucom@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
3 years agonet/bnxt: rename fields in device params structure
Kishore Padmanabha [Fri, 12 Jun 2020 12:50:23 +0000 (18:20 +0530)]
net/bnxt: rename fields in device params structure

The fields in the device params structure are renamed to reflect
the usage of those fields.

Signed-off-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>
Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Mike Baucom <michael.baucom@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
3 years agonet/bnxt: support mark action for LFID rules
Kishore Padmanabha [Fri, 12 Jun 2020 12:49:52 +0000 (18:19 +0530)]
net/bnxt: support mark action for LFID rules

The ulp mapper changes to support mark actions for non
GFID entries that support only LFID rules.

Signed-off-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>
Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Mike Baucom <michael.baucom@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
3 years agonet/bnxt: add vfr flag to mark manager
Kishore Padmanabha [Fri, 12 Jun 2020 12:49:51 +0000 (18:19 +0530)]
net/bnxt: add vfr flag to mark manager

Add support for the vfr flag to the mark manager.
The vf representor flag is added to class table so it can be set in
the template details.
Also added the vfr flag process in mark database.

Signed-off-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>
Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Mike Baucom <michael.baucom@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
3 years agonet/bnxt: support internal exact match flows
Kishore Padmanabha [Fri, 12 Jun 2020 12:50:21 +0000 (18:20 +0530)]
net/bnxt: support internal exact match flows

Added support of internal exact match flows and the action
mark is supported for these flows.

Signed-off-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>
Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Mike Baucom <michael.baucom@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
3 years agonet/bnxt: refactor mapper opcodes
Mike Baucom [Fri, 12 Jun 2020 12:50:18 +0000 (18:20 +0530)]
net/bnxt: refactor mapper opcodes

Unify the opcodes of the different enums into a single enum for reuse of
common processors. Also the ADD_PAD opcode is now SET_TO_ZERO.
This change better reflects the intent of the opcode and allows it to be
used in more circumstances without overloading the term pad.
The fields that were setting a constant zero have now been switched to
use the new SET_TO_ZERO opcode as an optimization.  The SET_TO_ZERO does
not copy data into the key/result/mask fields, but rather simply
increments the write pointer.

Signed-off-by: Mike Baucom <michael.baucom@broadcom.com>
Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Signed-off-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
Reviewed-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
3 years agonet/bnxt: divide ULP template database to smaller modules
Kishore Padmanabha [Fri, 12 Jun 2020 12:50:17 +0000 (18:20 +0530)]
net/bnxt: divide ULP template database to smaller modules

The ulp template db file is broken into three parts namely the
table, class and action files.

Signed-off-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>
Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Mike Baucom <michael.baucom@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
3 years agonet/bnxt: remove implicit bitset update for vnic action
Kishore Padmanabha [Fri, 12 Jun 2020 12:50:16 +0000 (18:20 +0530)]
net/bnxt: remove implicit bitset update for vnic action

The implicit update of the egress vnic action bitset for a flow
that does not specify the forwarding port explicitly is removed.

Signed-off-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>
Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Mike Baucom <michael.baucom@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
3 years agonet/bnxt: modify IPv6 VTC flow field parsing
Venkat Duvvuru [Fri, 12 Jun 2020 12:50:15 +0000 (18:20 +0530)]
net/bnxt: modify IPv6 VTC flow field parsing

ipv6 vtc_flow contains three fields
1. Version
2. Priority / Traffic Class
3. Flow Label
Currently, these are not parsed separately and also not set separately
in the field bitmap by the flow parser. However, the template treats
them separately. As a result, the flow matching doesn't succeed because
the bitmaps of parser and the template doesn't match.

This patch fixes this problem by parsing the above mentioned fields
individually to align with the template.

Signed-off-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Mike Baucom <michael.baucom@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
3 years agonet/bnxt: get VF representor action record
Kishore Padmanabha [Fri, 12 Jun 2020 12:50:14 +0000 (18:20 +0530)]
net/bnxt: get VF representor action record

Added flow db api to get the vf representor action
record for a given flow.

Signed-off-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>
Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Mike Baucom <michael.baucom@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
3 years agonet/bnxt: support VXLAN encap/decap templates
Kishore Padmanabha [Fri, 12 Jun 2020 12:50:13 +0000 (18:20 +0530)]
net/bnxt: support VXLAN encap/decap templates

Two templates are added to ulp template db, an ingress rule
for vxlan decap and an egress rule for vxlan encap.

Signed-off-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>
Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Mike Baucom <michael.baucom@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
3 years agonet/bnxt: set maximum flow count
Shuanglin Wang [Fri, 12 Jun 2020 12:50:12 +0000 (18:20 +0530)]
net/bnxt: set maximum flow count

User could set max flow count by passing a devarg
"-w 0000:0d:00.0,max_num_kflows=64" to a DPDK application;
The value must be not less than 32K and be power-of-2;
the default value is 32K.

Signed-off-by: Shuanglin Wang <shuanglin.wang@broadcom.com>
Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
3 years agonet/bnxt: refactor and rename some fields and enums
Kishore Padmanabha [Fri, 12 Jun 2020 12:50:08 +0000 (18:20 +0530)]
net/bnxt: refactor and rename some fields and enums

- rename regfile_wr_idx to regfile_idx
  The regfile index shall be used for both write and read operations.
  Hence the field is renamed.
- remove the unused enum BNXT_ULP_REGFILE_INDEX_CACHE_ENTRY_PTR
- rename the enums in the bnxt_ulp_resource_sub_type
  The enums in the bnxt_ulp_resource_sub_type are renamed to reflect
  the table types explicitly.
- rename an enum in the regfile index
  The BNXT_ULP_REGFILE_INDEX_ACTION_PTR_MAIN is renamed to
  BNXT_ULP_REGFILE_INDEX_MAIN_ACTION_PTR since it is the main
  action pointer.
- remove cache_tbl_id enums
  The bnxt_ulp_cache_tbl_id enums are not required any longer
  since the index is now calculated using resource sub type
  and direction.

Signed-off-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>
Reviewed-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
Reviewed-by: Mike Baucom <michael.baucom@broadcom.com>
Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
3 years agonet/bnxt: convert critical resource to enum
Kishore Padmanabha [Fri, 12 Jun 2020 12:50:07 +0000 (18:20 +0530)]
net/bnxt: convert critical resource to enum

The critical resource field in the template table is assigned
enumeration values instead of hard coded values.

Signed-off-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>
Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Mike Baucom <michael.baucom@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
3 years agonet/bnxt: use vport in PHY port action handler
Kishore Padmanabha [Fri, 12 Jun 2020 12:50:06 +0000 (18:20 +0530)]
net/bnxt: use vport in PHY port action handler

The phy port action handler should get vport details and not
vnic id. The fix is to calculate the vport of the given
port.

Signed-off-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>
Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Mike Baucom <michael.baucom@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
3 years agonet/bnxt: process action templates
Kishore Padmanabha [Fri, 12 Jun 2020 12:50:05 +0000 (18:20 +0530)]
net/bnxt: process action templates

Extend index table processing to process action templates.
The index table processing is extended to address encapsulation fields
so that action template index table can be processed by a common index
processing function that can process both class and action index
tables.

Signed-off-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>
Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Mike Baucom <michael.baucom@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
3 years agonet/bnxt: support action bitmap opcode
Kishore Padmanabha [Fri, 12 Jun 2020 12:50:02 +0000 (18:20 +0530)]
net/bnxt: support action bitmap opcode

This enables using the action bitmap to update the action result
fields in the flow creation instead of using computed header fields.
Direction bit needs to be added to the action bitmap during
flow parsing, so that egress flows can be matched to the
template signature.
An example would be the usage of the vlan pop action bitmap that is
used to updated action result field as part of this commit.
Also the ulp action bitmap enumeration values that
contain open flow string are renamed.

Signed-off-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>
Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Mike Baucom <michael.baucom@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
3 years agonet/bnxt: remove cache table ID from mapper class table
Kishore Padmanabha [Fri, 12 Jun 2020 12:50:00 +0000 (18:20 +0530)]
net/bnxt: remove cache table ID from mapper class table

The cache table id is not needed anymore since the value can
be calculated from resource sub type and direction.

Signed-off-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>
Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Mike Baucom <michael.baucom@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
3 years agonet/bnxt: add resource subtype to class and action tables
Kishore Padmanabha [Fri, 12 Jun 2020 12:49:59 +0000 (18:19 +0530)]
net/bnxt: add resource subtype to class and action tables

Added support for resource sub type to class and action tables
renamed table id to resource type.

Signed-off-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>
Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Mike Baucom <michael.baucom@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
3 years agonet/bnxt: change default identifier to global resource
Kishore Padmanabha [Fri, 12 Jun 2020 12:49:58 +0000 (18:19 +0530)]
net/bnxt: change default identifier to global resource

The default identifier list in ulp mapper is extended to support
other truflow resource types and not just identifiers.

Signed-off-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>
Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
3 years agonet/bnxt: update compute field list and access macros
Kishore Padmanabha [Fri, 12 Jun 2020 12:49:57 +0000 (18:19 +0530)]
net/bnxt: update compute field list and access macros

The compute field is extended to support action fields and not
just header fields, hence CHF is changed to CF. The access macro
for compute field is renamed to address this.

Signed-off-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>
Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
3 years agonet/bnxt: add computed header field in result opcode
Kishore Padmanabha [Fri, 12 Jun 2020 12:49:56 +0000 (18:19 +0530)]
net/bnxt: add computed header field in result opcode

Added support for computed header fields in the result field
processing. The computed header fields are fields that are extracted
from header fields or derived from data that is not part of the flow
command but shall be used in setting up of the flow rule.

Signed-off-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>
Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
3 years agonet/bnxt: support more resource functions in flow database
Kishore Padmanabha [Fri, 12 Jun 2020 12:49:54 +0000 (18:19 +0530)]
net/bnxt: support more resource functions in flow database

Added support to include more resource functions in the flow
database. The number of bits increased from 3 to 8 for storing
the resource function.

Signed-off-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>
Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
3 years agonet/bnxt: remove fields from bitmap and mapper table
Kishore Padmanabha [Fri, 12 Jun 2020 12:49:50 +0000 (18:19 +0530)]
net/bnxt: remove fields from bitmap and mapper table

Remove unnecessary fields from bitmap and mapper table.

- remove svif and VLAN info from header bitmap
The svif and vlan information are removed from header bitmap
signature so that the matching algorithm does not use these
fields to perform matching. So flows with or without vlan
tag could use the same flow template.
- remove mem field from mapper class table
Remove the unused mem field in the ulp mapper class table structure

Signed-off-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>
Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>
Reviewed-by: Mike Baucom <michael.baucom@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
3 years agonet/bnxt: distribute makefile to subdirectories
Kishore Padmanabha [Fri, 12 Jun 2020 12:49:49 +0000 (18:19 +0530)]
net/bnxt: distribute makefile to subdirectories

Created sub Makefile for tf_ulp and and tf_core for easy management.

Signed-off-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>
Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Mike Baucom <michael.baucom@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
3 years agonet/octeontx2: fix DMAC filtering
Harman Kalra [Wed, 3 Jun 2020 14:52:13 +0000 (20:22 +0530)]
net/octeontx2: fix DMAC filtering

Issue has been observed where packets are getting dropped
at DMAC filtering if a new dmac address is added before
starting of port.

Fixes: c43adf61682f ("net/octeontx2: add unicast MAC filter")
Cc: stable@dpdk.org
Signed-off-by: Harman Kalra <hkalra@marvell.com>
Acked-by: Sunil Kumar Kori <skori@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>