dpdk.git
3 years agotest/mempool: fix object initializer
Olivier Matz [Tue, 27 Apr 2021 13:56:45 +0000 (15:56 +0200)]
test/mempool: fix object initializer

The function rte_pktmbuf_init() expects that the mempool private area is
large enough and was previously initialized by rte_pktmbuf_pool_init(),
which is not the case.

This causes the function rte_pktmbuf_priv_size() to return an
unpredictable value, and this value is used as a size in a memset.

Replace the mempool object initializer by my_obj_init(), which does not
have this constraint, and fits the needs for this test.

Fixes: 923ceaeac140 ("test/mempool: add unit test cases")
Cc: stable@dpdk.org
Reported-by: Wenwu Ma <wenwux.ma@intel.com>
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
3 years agombuf: check shared memory before dumping dynamic space
Chengwen Feng [Fri, 23 Apr 2021 08:11:04 +0000 (16:11 +0800)]
mbuf: check shared memory before dumping dynamic space

Because mbuf dyn shared memory was allocated runtime, so it's
necessary to check validity when dump mbuf dyn info.

Also this patch adds an error logging when init shared memory fail.

Fixes: 4958ca3a443a ("mbuf: support dynamic fields and flags")
Cc: stable@dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
3 years agoeal/windows: fix MinGW build
Tal Shnaiderman [Wed, 21 Apr 2021 16:09:42 +0000 (19:09 +0300)]
eal/windows: fix MinGW build

the strncasecmp macro defined in rte_os_shim.h is already
defined in MinGW-w64, as a result the compiler prints out
the warning below on function redefinition whenever compiling
a file including the header in debug mode.

lib/eal/windows/include/rte_os_shim.h:21:
warning: "strncasecmp" redefined

Fixed by defining the macro only to the clang compiler.

Fixes: 45d62067c237 ("eal: make OS shims internal")

Signed-off-by: Tal Shnaiderman <talshn@nvidia.com>
Acked-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
3 years agoeal/arm64: fix platform register bit
Juraj Linkeš [Thu, 22 Apr 2021 09:11:51 +0000 (11:11 +0200)]
eal/arm64: fix platform register bit

REG_PLATFORM only uses bit 0 to indicate whether the value retrieved
from hardware matches PLATFORM_STR.

Fixes: 97523f822ba9 ("eal/arm: add CPU flags for ARMv8")
Cc: stable@dpdk.org
Signed-off-by: Juraj Linkeš <juraj.linkes@pantheon.tech>
Reviewed-by: Jerin Jacob <jerinj@marvell.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
3 years agoraw/ioat: report status of completed jobs
Bruce Richardson [Tue, 4 May 2021 13:14:58 +0000 (14:14 +0100)]
raw/ioat: report status of completed jobs

Add improved error handling to rte_ioat_completed_ops(). This patch adds
new parameters to the function to enable the user to track the completion
status of each individual operation in a batch. With this addition, the
function can help the user to determine firstly, how many operations may
have failed or been skipped and then secondly, which specific operations
did not complete successfully.

Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
3 years agoraw/ioat: add API to query remaining ring space
Kevin Laatz [Tue, 4 May 2021 13:14:57 +0000 (14:14 +0100)]
raw/ioat: add API to query remaining ring space

Add a new API to query remaining descriptor ring capacity. This API is
useful, for example, when an application needs to enqueue a fragmented
packet and wants to ensure that all segments of the packet will be enqueued
together.

Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
3 years agoraw/ioat: rework SW ring layout
Bruce Richardson [Tue, 4 May 2021 13:14:56 +0000 (14:14 +0100)]
raw/ioat: rework SW ring layout

The ring management in the idxd part of the driver is more complex than
it needs to be, tracking individual batches in a ring and having null
descriptors as padding to avoid having single-operation batches. This can
be simplified by using a regular ring-based layout, with additional
overflow at the end to ensure that the one does not need to wrap within a
batch.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
3 years agoraw/ioat: move idxd functions to separate file
Bruce Richardson [Tue, 4 May 2021 13:14:55 +0000 (14:14 +0100)]
raw/ioat: move idxd functions to separate file

Split the rte_ioat_rawdev_fns.h file into two separate headers, so that
the data structures for the original ioat devices and the newer idxd
ones can be kept separate from each other. This makes code management
and rework easier.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
3 years agoraw/ioat: add bus driver for device scanning automatically
Bruce Richardson [Tue, 4 May 2021 13:14:54 +0000 (14:14 +0100)]
raw/ioat: add bus driver for device scanning automatically

Rather than using a vdev with args, DPDK can scan and initialize the
devices automatically using a bus-type driver. This bus does not need to
worry about registering device drivers, rather it can initialize the
devices directly on probe.

The device instances (queues) to use are detected from /dev with the
additional info about them got from /sys.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
3 years agoraw/ioat: allow perform operations function to return error
Kevin Laatz [Tue, 4 May 2021 13:14:53 +0000 (14:14 +0100)]
raw/ioat: allow perform operations function to return error

Change the return type for the rte_ioat_perform_ops() function from void to
int to allow the possibility of returning an error code in future, should
it be necessary.

Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>
3 years agoraw/ioat: make workqueue name configurable in script
Bruce Richardson [Tue, 4 May 2021 13:14:52 +0000 (14:14 +0100)]
raw/ioat: make workqueue name configurable in script

Add a "--name-prefix" parameter to the quick configuration script for
DSA. This allows the queues configured on a DSA instance to be made
available to only one DPDK process in a setup with multiple DPDK process
instances.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
3 years agoraw/ioat: fix script for configuring small number of queues
Bruce Richardson [Tue, 4 May 2021 13:14:51 +0000 (14:14 +0100)]
raw/ioat: fix script for configuring small number of queues

The dpdk_idxd_cfg.py script included with the driver for convenience did
not work properly where the number of queues to be configured was
less than the number of groups or engines. This was because there would
be configured groups/engines not assigned to queues. Fix this by
limiting the engine and group counts to be no bigger than the number of
queues.

Fixes: 01863b9d2354 ("raw/ioat: include example configuration script")
Cc: stable@dpdk.org
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
3 years agoraw/ioat: expand descriptor struct to full 64 bytes
Bruce Richardson [Tue, 4 May 2021 13:14:50 +0000 (14:14 +0100)]
raw/ioat: expand descriptor struct to full 64 bytes

Although it's unused by the driver, add the interrupt handle field in
the descriptor to the descriptor structure for completeness, and
explicitly add the reserved padding field on the end of the structure
too. This means that when a descriptor is defined on the stack, or
initialized by the compiler, the unused/reserved space will be zeroed
appropriately.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
3 years agoraw/ioat: add component prefix to log messages
Bruce Richardson [Tue, 4 May 2021 13:14:49 +0000 (14:14 +0100)]
raw/ioat: add component prefix to log messages

Add the driver prefix "IOAT" to log messages for the driver.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
3 years agoraw/ioat: support limiting queues for idxd PCI device
Bruce Richardson [Tue, 4 May 2021 13:14:48 +0000 (14:14 +0100)]
raw/ioat: support limiting queues for idxd PCI device

When using a full device instance via vfio, allow the user to specify a
maximum number of queues to configure rather than always using the max
number of supported queues.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
3 years agoraw/ioat: add unit tests for completion batching
Bruce Richardson [Tue, 4 May 2021 13:14:47 +0000 (14:14 +0100)]
raw/ioat: add unit tests for completion batching

Add in additional unit tests to verify that we can get completion reports
of multiple batches in a single completed_ops() call. Also verify we can
get smaller number of completions if that is requested too.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
3 years agoconfig/ppc: reduce number of cores and NUMA nodes
David Christensen [Wed, 28 Apr 2021 20:10:16 +0000 (13:10 -0700)]
config/ppc: reduce number of cores and NUMA nodes

When setting RTE_MAX_LCORES to the maximum value supported by ppc
hardware (1536), the lcores_autotest may timeout after 30 seconds
because the test takes nearly 60 seconds to complete. Set max_lcores to
a lower value because the maximum value is unlikely to be seen in any
production systems and to eliminate the quick test timeout error.

Bugzilla ID: 684
Fixes: db1f2f8a9fe5 ("config: increase maximum lcores for ppc")
Cc: stable@dpdk.org
Signed-off-by: David Christensen <drc@linux.vnet.ibm.com>
Acked-by: Luca Boccassi <bluca@debian.org>
3 years agobuild: fix formatting of Meson lists
Bruce Richardson [Mon, 26 Apr 2021 10:54:03 +0000 (11:54 +0100)]
build: fix formatting of Meson lists

Running "./devtools/check-meson.py --fix" on the DPDK repo fixes a
number of issues with whitespace and formatting of files:

* indentation of lists
* missing trailing commas on final list element
* multiple list entries per line when list is not all single-line

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
3 years agodevtools: add script to check indentation of Meson lists
Bruce Richardson [Mon, 26 Apr 2021 10:54:02 +0000 (11:54 +0100)]
devtools: add script to check indentation of Meson lists

This is a script to fix up minor formatting issues in meson files.
It scans for, and can optionally fix, indentation issues and missing
trailing commas in the lists in meson.build files. It also detects,
and can fix, multi-line lists where more than one entry appears on a
line.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Anatoly Burakov <anatoly.burakov@intel.com>
3 years agomempool: distinguish cache and pool debug counters
Joyce Kong [Tue, 27 Apr 2021 16:01:40 +0000 (11:01 -0500)]
mempool: distinguish cache and pool debug counters

If cache is enabled, objects will be retrieved/put from/to cache,
subsequently from/to the common pool. Now the debug stats calculate
the objects retrieved/put from/to cache and pool together, it is
better to distinguish them.

Signed-off-by: Joyce Kong <joyce.kong@arm.com>
Signed-off-by: Dharmik Thakkar <dharmik.thakkar@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
3 years agomempool: make stats macro generic
Dharmik Thakkar [Tue, 27 Apr 2021 16:01:39 +0000 (11:01 -0500)]
mempool: make stats macro generic

Make __MEMPOOL_STAT_ADD macro more generic and delete
__MEMPOOL_CONTIG_BLOCKS_STAT_ADD macro.

Suggested-by: Olivier Matz <olivier.matz@6wind.com>
Signed-off-by: Dharmik Thakkar <dharmik.thakkar@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
3 years agostack: allow lock-free only on relevant architectures
Stanislaw Kardach [Mon, 12 Apr 2021 08:28:59 +0000 (10:28 +0200)]
stack: allow lock-free only on relevant architectures

Since commit 7911ba0473e0 ("stack: enable lock-free implementation for
aarch64"), lock-free stack is supported on arm64 but this description was
missing from the doxygen for the flag.

Currently it is impossible to detect programmatically whether lock-free
implementation of rte_stack is supported. One could check whether the
header guard for lock-free stubs is defined (_RTE_STACK_LF_STUBS_H_) but
that's an unstable implementation detail. Because of that currently all
lock-free ring creations silently succeed (as long as the stack header
is 16B long) which later leads to push and pop operations being NOPs.
The observable effect is that stack_lf_autotest fails on platforms not
supporting the lock-free. Instead it should just skip the lock-free test
altogether.

This commit adds a new errno value (ENOTSUP) that may be returned by
rte_stack_create() to indicate that a given combination of flags is not
supported on a current platform.
This is detected by checking a compile-time flag in the include logic in
rte_stack_lf.h which may be used by applications to check the lock-free
support at compile time.

Use the added RTE_STACK_LF_SUPPORTED flag to disable the lock-free stack
tests at the compile time.
Perf test doesn't fail because rte_ring_create() succeeds, however
marking this test as skipped gives a better indication of what actually
was tested.

Fixes: 7911ba0473e0 ("stack: enable lock-free implementation for aarch64")

Signed-off-by: Stanislaw Kardach <kda@semihalf.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
3 years agombuf: mark offload flag as deprecated
David Marchand [Mon, 3 May 2021 13:26:43 +0000 (15:26 +0200)]
mbuf: mark offload flag as deprecated

PKT_RX_EIP_CKSUM_BAD has been declared deprecated but there was no
warning to applications still using it.
Fix this by marking as deprecated with the newly introduced
RTE_DEPRECATED.

Fixes: e8a419d6de4b ("mbuf: rename outer IP checksum macro")

Signed-off-by: David Marchand <david.marchand@redhat.com>
Reviewed-by: Flavio Leitner <fbl@sysclose.org>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Lance Richardson <lance.richardson@broadcom.com>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
3 years agoversion: 21.05-rc1
Thomas Monjalon [Wed, 21 Apr 2021 22:28:57 +0000 (00:28 +0200)]
version: 21.05-rc1

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
3 years agodoc: announce support of Alpine Linux
Thomas Monjalon [Sat, 17 Apr 2021 22:16:48 +0000 (00:16 +0200)]
doc: announce support of Alpine Linux

After many patches in several releases to make DPDK buildable with musl,
and few adjustments for busybox, it is time to show the support of DPDK
built in Alpine Linux.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
3 years agodoc: fix names of UIO drivers
Thomas Monjalon [Thu, 18 Mar 2021 11:00:49 +0000 (12:00 +0100)]
doc: fix names of UIO drivers

Fix typos in the names of kernel drivers based on UIO,
and make sure the generic term for the interface is UIO in capitals.

Fixes: 3a78b2f73206 ("doc: add virtio crypto PMD guide")
Fixes: 3cc4d996fa75 ("doc: update VFIO usage in qat crypto guide")
Fixes: 39922c470e3c ("doc: add known uio_pci_generic issue for i40e")
Fixes: 86fa6c57a175 ("doc: add known igb_uio issue for i40e")
Fixes: beff6d8e8e2e ("net/netvsc: add documentation")
Cc: stable@dpdk.org
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
3 years agonet/pcap: build on Windows
Dmitry Kozlyuk [Wed, 21 Apr 2021 19:33:51 +0000 (22:33 +0300)]
net/pcap: build on Windows

Implement OS-dependent functions and enable build for Windows.
Account for different library name in Windows libpcap distributions.

Signed-off-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
Acked-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
3 years agonet/pcap: move OS-dependent code to separate files
Dmitry Kozlyuk [Wed, 21 Apr 2021 19:33:50 +0000 (22:33 +0300)]
net/pcap: move OS-dependent code to separate files

PCAP PMD queries interface information differently for Linux and
FreeBSD, OS-specific code is guarded by #ifdef. This PMD also depends on
POSIX bits, namely gettimeofday() and NAME_MAX.

Move OS-dependent code to separate files.
Replace POSIX bits with DPDK equivalents.
Rename rte_eth_pcap.c to pcap_ethdev.c, like it is in most other PMDs.

Signed-off-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
3 years agoeal: add timespec_get shim
Dmitry Kozlyuk [Wed, 21 Apr 2021 19:33:49 +0000 (22:33 +0300)]
eal: add timespec_get shim

C11 timespec_get() is not provided on some platforms:

* MinGW-w64 does not currently implement it [1].
* FreeBSD 11 with Clang 10.0.0 does not provide it.

Add internal shims to Windows and FreeBSD EALs.
For Windows, it can be removed after [1] is fixed.

[1]: https://sourceforge.net/p/mingw-w64/mailman/message/37224689/

Signed-off-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
Acked-by: Jie Zhou <jizh@linux.microsoft.com>
Acked-by: Nick Connolly <nick.connolly@mayadata.io>
3 years agonet/e1000/base: fix timeout for shadow RAM write
Chengwen Feng [Wed, 21 Apr 2021 09:15:35 +0000 (17:15 +0800)]
net/e1000/base: fix timeout for shadow RAM write

This fixes the timed out for shadow RAM write EEWR can't be detected.

Fixes: 5a32a257f957 ("e1000: more NICs in base driver")
Cc: stable@dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
Acked-by: Haiyue Wang <haiyue.wang@intel.com>
3 years agonet/i40e: fix flow director for common pctypes
Murphy Yang [Wed, 21 Apr 2021 03:44:03 +0000 (03:44 +0000)]
net/i40e: fix flow director for common pctypes

Currently, FDIR doesn't work for all common PCTYPEs, the root cause is
that input set is not configured.

Fixes: 4a072ad43442 ("net/i40e: fix flow director config after flow validate")
Cc: stable@dpdk.org
Signed-off-by: Murphy Yang <murphyx.yang@intel.com>
Acked-by: Beilei Xing <beilei.xing@intel.com>
3 years agoethdev: add sanity checks in control APIs
Min Hu (Connor) [Wed, 21 Apr 2021 12:36:33 +0000 (20:36 +0800)]
ethdev: add sanity checks in control APIs

This patch adds more sanity checks in control path APIs.

Fixes: 214ed1acd125 ("ethdev: add iterator to match devargs input")
Fixes: 3d98f921fbe9 ("ethdev: unify prefix for static functions and variables")
Fixes: 0366137722a0 ("ethdev: check for invalid device name")
Fixes: d948f596fee2 ("ethdev: fix port data mismatched in multiple process model")
Fixes: 5b7ba31148a8 ("ethdev: add port ownership")
Fixes: f8244c6399d9 ("ethdev: increase port id range")
Cc: stable@dpdk.org
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Acked-by: Kevin Traynor <ktraynor@redhat.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
3 years agoapp/testpmd: support display queue state
Chengwen Feng [Wed, 21 Apr 2021 03:24:59 +0000 (11:24 +0800)]
app/testpmd: support display queue state

This patch supports display queue state in "show rxq/txq" commands.

Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
3 years agoapp/testpmd: show link flow control info
Huisong Li [Wed, 21 Apr 2021 09:41:31 +0000 (17:41 +0800)]
app/testpmd: show link flow control info

This patch supports the query of the link flow control parameter
on a port.

The command format is as follows:
show port <port_id> flow_ctrl

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
Acked-by: Xiaoyun Li <xiaoyun.li@intel.com>
Acked-by: Kevin Traynor <ktraynor@redhat.com>
3 years agoapp/testpmd: support cleanup Tx queue mbufs
Chengwen Feng [Wed, 21 Apr 2021 08:45:02 +0000 (16:45 +0800)]
app/testpmd: support cleanup Tx queue mbufs

This patch supports cleanup txq mbufs command:
port cleanup (port_id) txq (queue_id) (free_cnt)

Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Signed-off-by: Lijun Ou <oulijun@huawei.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
3 years agonet/sfc: add more debug messages to transfer flows
Ivan Malov [Tue, 20 Apr 2021 21:10:06 +0000 (00:10 +0300)]
net/sfc: add more debug messages to transfer flows

These are really helpful when it comes to tracking
resource sharing and debugging various leaks.

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
3 years agonet/sfc: revise FW RSRC free error logs in transfer rules
Ivan Malov [Tue, 20 Apr 2021 21:10:05 +0000 (00:10 +0300)]
net/sfc: revise FW RSRC free error logs in transfer rules

The current code simply forwards FW resource free failure
to the application leaving the operation incomplete. This
stalls the application and makes debugging very difficult.

Make the driver proceed with handling FW resource free in
the case of errors. Add explicit error logging statements.

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
3 years agonet/sfc: fix outer rule and encap rollback on error
Ivan Malov [Tue, 20 Apr 2021 21:10:04 +0000 (00:10 +0300)]
net/sfc: fix outer rule and encap rollback on error

Add missing statements to invalidate MAE resource IDs.

Fixes: dadff137931c ("net/sfc: support encap flow items in transfer rules")
Fixes: 1bbd1ec2348a ("net/sfc: support action VXLAN encap in MAE backend")
Cc: stable@dpdk.org
Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
3 years agoapp/testpmd: support policy actions per color
Haifei Luo [Tue, 20 Apr 2021 14:04:50 +0000 (17:04 +0300)]
app/testpmd: support policy actions per color

Add the create/del policy CLIs to support actions per color.
The CLIs are:
Create:  add port meter policy (port_id) (policy_id) g_actions (actions)
y_actions (actions) r_actions (actions)
Delete:  del port meter policy (port_id) (policy_id)

Examples:
testpmd> add port meter policy 0 1 g_actions rss / end y_actions end
r_actions drop / end
testpmd> del port meter policy 0 1

Signed-off-by: Haifei Luo <haifeil@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
3 years agoethdev: add pre-defined meter policy API
Li Zhang [Tue, 20 Apr 2021 14:04:49 +0000 (17:04 +0300)]
ethdev: add pre-defined meter policy API

Currently, the flow meter policy does not support multiple actions
per color; also the allowed action types per color are very limited.
In addition, the policy cannot be pre-defined.

Due to the growing in flow actions offload abilities there is a potential
for the user to use variety of actions per color differently.
This new meter policy API comes to allow this potential in the most ethdev
common way using rte_flow action definition.
A list of rte_flow actions will be provided by the user per color
in order to create a meter policy.
In addition, the API forces to pre-define the policy before
the meters creation in order to allow sharing of single policy
with multiple meters efficiently.

meter_policy_id is added into struct rte_mtr_params.
So that it can get the policy during the meters creation.

Allow coloring the packet using a new rte_flow_action_color
as could be done by the old policy API.

Add two common policy template as macros in the head file.

The next API function were added:
- rte_mtr_meter_policy_add
- rte_mtr_meter_policy_delete
- rte_mtr_meter_policy_update
- rte_mtr_meter_policy_validate
The next struct was changed:
- rte_mtr_params
- rte_mtr_capabilities
The next API was deleted:
- rte_mtr_policer_actions_update

To support this API the following app were changed:
app/test-flow-perf: clean meter policer
app/testpmd: clean meter policer

To support this API the following drivers were changed:
net/softnic: support meter policy API
1. Cleans meter rte_mtr_policer_action.
2. Supports policy API to get color action as policer action did.
   The color action will be mapped into rte_table_action_policer.

net/mlx5: clean meter creation management
Cleans and breaks part of the current meter management
in order to allow better design with policy API.

Signed-off-by: Li Zhang <lizh@nvidia.com>
Signed-off-by: Haifei Luo <haifeil@nvidia.com>
Signed-off-by: Jiawei Wang <jiaweiw@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
Acked-by: Ray Kinsella <mdr@ashroe.eu>
Acked-by: Ori Kam <orika@nvidia.com>
Acked-by: Jasvinder Singh <jasvinder.singh@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
3 years agonet/ice: fix disabling promiscuous mode
Siwar Zitouni [Mon, 19 Apr 2021 12:53:48 +0000 (14:53 +0200)]
net/ice: fix disabling promiscuous mode

When promiscuous mode is disabled, allmulticast is
also disabled, even if it was previously enabled.

Add a test in ice_promisc_disable()
to check if allmulticast should be kept enabled.

Fixes: c945e4bf9063 ("net/ice: support promiscuous mode")
Cc: stable@dpdk.org
Signed-off-by: Thibaut Collet <thibaut.collet@6wind.com>
Signed-off-by: Siwar Zitouni <siwar.zitouni@6wind.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
3 years agonet/i40e: add Tx preparation for simple Tx datapath
Leyi Rong [Tue, 20 Apr 2021 05:29:45 +0000 (13:29 +0800)]
net/i40e: add Tx preparation for simple Tx datapath

Introduce i40e_simple_prep_pkts() as the preparation function for
simple Tx data path, as it's for sanity check for simple Tx.

Suggested-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Signed-off-by: Leyi Rong <leyi.rong@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
3 years agonet/mlx5: allow multiple flow tables on same level
Li Zhang [Tue, 20 Apr 2021 10:55:21 +0000 (13:55 +0300)]
net/mlx5: allow multiple flow tables on same level

The driver devices support creation of multiple flow tables.
Jump action can be used in order to move the packet steering
to different flow table.
Table 0 is always the root table for packet steering.

Jumping between tables may cause endless loops in steering mechanism,
that's why each table has level attribute,
the driver sub-system may not allow jumping to table with
equal or lower level than the current table.

Currently, in the driver, the table ID and level are always identical.

Allow multiple flow table creation with the same level attribute.

This patch adds the table id in flow table data entry, while
allocates the flow table, if the table level is same but the
different table id, the new table will be allocated with new
table object id. It supports 4M multiple flow tables on the
same level.

Signed-off-by: Li Zhang <lizh@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
3 years agonet/mlx5: make ASO meter queue thread-safe
Li Zhang [Tue, 20 Apr 2021 10:55:20 +0000 (13:55 +0300)]
net/mlx5: make ASO meter queue thread-safe

Synchronize ASO meter queue accesses from
different threads using a spinlock.

Signed-off-by: Li Zhang <lizh@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
3 years agonet/mlx5: support ASO meter action
Li Zhang [Tue, 20 Apr 2021 10:55:19 +0000 (13:55 +0300)]
net/mlx5: support ASO meter action

When ASO action is available, use it as the meter action

Signed-off-by: Shun Hao <shunh@nvidia.com>
Signed-off-by: Li Zhang <lizh@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
3 years agonet/mlx5: add meter ASO queue management
Li Zhang [Tue, 20 Apr 2021 10:55:18 +0000 (13:55 +0300)]
net/mlx5: add meter ASO queue management

This patch adds the ASO queue management for flow meter,
includes send WQE and CQE handle functions.

Signed-off-by: Li Zhang <lizh@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
3 years agonet/mlx5: initialize flow meter ASO SQ
Li Zhang [Tue, 20 Apr 2021 10:55:17 +0000 (13:55 +0300)]
net/mlx5: initialize flow meter ASO SQ

Initialize the flow meter ASO SQ WQEs with
all the constant data that should not be updated
per enqueue operation.

Signed-off-by: Li Zhang <lizh@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
3 years agonet/mlx5: add flow meter pool to manage meter object
Li Zhang [Tue, 20 Apr 2021 10:55:16 +0000 (13:55 +0300)]
net/mlx5: add flow meter pool to manage meter object

Add ASO flow meter pool to manage meter object

Signed-off-by: Li Zhang <lizh@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
3 years agocommon/mlx5: create ASO flow meter object with DevX
Li Zhang [Tue, 20 Apr 2021 10:55:15 +0000 (13:55 +0300)]
common/mlx5: create ASO flow meter object with DevX

Add DevX API to create ASO flow meter object.

Signed-off-by: Li Zhang <lizh@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
3 years agocommon/mlx5: add read ASO flow meter HCA capability
Li Zhang [Tue, 20 Apr 2021 10:55:14 +0000 (13:55 +0300)]
common/mlx5: add read ASO flow meter HCA capability

Read and store the device capability of FLOW_METER_ASO general object,
using the DevX API.

Signed-off-by: Li Zhang <lizh@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
3 years agocommon/mlx5: add definitions for ASO flow meter
Li Zhang [Tue, 20 Apr 2021 10:55:13 +0000 (13:55 +0300)]
common/mlx5: add definitions for ASO flow meter

This patch adds different PRM definitions, related to
ASO (Advanced Steering Operation) flow meter feature,
in MLX5 PMD code.

Signed-off-by: Li Zhang <lizh@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
3 years agonet/mlx5: use mask for meter register setting
Shun Hao [Tue, 20 Apr 2021 10:55:12 +0000 (13:55 +0300)]
net/mlx5: use mask for meter register setting

ASO (Advanced Steering Operation) meter feature may require
to locate the flow context tag action after the ASO action.
When color register is shared by meter_id/flow_id, it's like:
Bits[0-7] A meter color value set by the HW.
Bits[8-31] A flow id and meter id set by SW.

Currently the tag action for meter writes all the bits
of the meter register, so it will potentially overwrite
meter color when ASO meter action is before the tag action.

Set only 24-MSB-bits of meter register in the meter tag action.

Signed-off-by: Shun Hao <shunh@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
3 years agonet/mlx5: optimize meter statistics
Li Zhang [Tue, 20 Apr 2021 10:55:11 +0000 (13:55 +0300)]
net/mlx5: optimize meter statistics

Meter statistics are each policer action each counter.
Totally 4 counters per each meter.
It causes cache missed
and lead to data forwarding performance low.

To optimize it, support pass counter for green
and drop counter for red.
Totally two counters per each meter.
Also use the global drop statistics for
all meter drop action.

Limitations as below:
1. It does not support yellow counter and return 0.
2. All the meter colors with drop action will be
   counted only by the global drop statistics.
3. Red color must be with drop action.

Signed-off-by: Li Zhang <lizh@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
3 years agonet/mlx5: fix meter statistics
Shun Hao [Tue, 20 Apr 2021 10:55:10 +0000 (13:55 +0300)]
net/mlx5: fix meter statistics

Currently, packets after meter will be steered to a global policer
table,
which includes green/red color rules for every meter, so as to have
counter statistics of each color in every meter.

There's a bug that all the rules in global policer table are matching
only color criteria, so all packets will be counted to one meter only,
and other meter statistics are always zero.

This patch does these:
1. The rules in policer table matches both meter index and color, so
packet after meter could be counted to the correct meter counter.
2. The meter index and flow index are now sharing the available
register bits dynamically. Meter index starts from lsb, and flow
index starts from msb.

Fixes: 46a5e6bc6a85 ("net/mlx5: prepare meter flow tables")
Cc: stable@dpdk.org
Signed-off-by: Shun Hao <shunh@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
3 years agocommon/mlx5: add color register idle bits definition
Shun Hao [Tue, 20 Apr 2021 10:55:09 +0000 (13:55 +0300)]
common/mlx5: add color register idle bits definition

8 bits are used for meter color in meter register. When the meter
register can be shared, the rest 24 bits can be used by others.
This adds the definition for the 24 bits that can be shared.

Signed-off-by: Shun Hao <shunh@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
3 years agonet/mlx5: support three level table walk
Suanming Mou [Tue, 20 Apr 2021 10:55:08 +0000 (13:55 +0300)]
net/mlx5: support three level table walk

This commit adds table entry walk for the three level table.

Signed-off-by: Suanming Mou <suanmingm@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
3 years agodoc: fix Rx burst function in hns3 guide
Min Hu (Connor) [Tue, 20 Apr 2021 08:59:52 +0000 (16:59 +0800)]
doc: fix Rx burst function in hns3 guide

The patch 'net/hns3: rename Rx burst function' changed `simple'
Rx function name from 'scalar' to 'scalar simple', but doc
ignored that.

This patch fixed it.

Fixes: aa5baf47e1a3 ("net/hns3: rename Rx burst function")
Cc: stable@dpdk.org
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
3 years agonet/hns3: ignore devargs parsing return
Min Hu (Connor) [Tue, 20 Apr 2021 08:59:50 +0000 (16:59 +0800)]
net/hns3: ignore devargs parsing return

In hns3 PMD, as the handler always return 0, the return value
of a function 'rte_kvargs_process' no need to be checked. But
the API definition has return value, so 'void' could be used
to ignore that.

Fixes: a124f9e9591b ("net/hns3: add runtime config to select IO burst function")

Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
3 years agonet/hns3: fix traffic management support check
Min Hu (Connor) [Tue, 20 Apr 2021 08:59:49 +0000 (16:59 +0800)]
net/hns3: fix traffic management support check

params->leaf.cman has enum type which is not isomorphic with boolean
type, however it is used as a boolean expression.

This patch fixed it.

Fixes: c09c7847d892 ("net/hns3: support traffic management")
Cc: stable@dpdk.org
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
3 years agonet/hns3: remove unused macro
Min Hu (Connor) [Tue, 20 Apr 2021 08:59:48 +0000 (16:59 +0800)]
net/hns3: remove unused macro

'HNS3_RXD_LKBK_B' was defined in previous versions but no used.
This patch deleted it.

Fixes: bba636698316 ("net/hns3: support Rx/Tx and related operations")
Cc: stable@dpdk.org
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
3 years agonet/af_xdp: use recvfrom only if busy polling enabled
Ciara Loftus [Tue, 20 Apr 2021 08:44:31 +0000 (09:44 +0100)]
net/af_xdp: use recvfrom only if busy polling enabled

The recvfrom() syscall is only supported by AF_XDP sockets since
kernel 5.11. Only use it if busy polling is configured. We can
assume a kernel >= 5.11 is in use if busy polling is configured
so we can safely call recvfrom() in that case.

Fixes: 63e8989fe5a4 ("net/af_xdp: use recvfrom instead of poll syscall")

Signed-off-by: Ciara Loftus <ciara.loftus@intel.com>
3 years agonet/af_xdp: fix trigger for syscall on Tx
Ciara Loftus [Tue, 20 Apr 2021 08:44:30 +0000 (09:44 +0100)]
net/af_xdp: fix trigger for syscall on Tx

The send() syscall on the Tx path is not concerned with busy polling
and as such its invocation should not depend on whether or not it is
configured. Fix this by distinguishing the conditions necessary for
syscalls on the Rx and Tx paths individually.

Fixes: 055a393626ed ("net/af_xdp: prefer busy polling")

Signed-off-by: Ciara Loftus <ciara.loftus@intel.com>
3 years agonet/igc: fix Rx packet size
Alvin Zhang [Tue, 20 Apr 2021 02:05:20 +0000 (10:05 +0800)]
net/igc: fix Rx packet size

When DEV_RX_OFFLOAD_KEEP_CRC is enabled, the PMD will minus 4 bytes
of CRC from the size of a packet, but the NIC will strip the CRC
because the CRC strip bit in DVMOLR register is not cleared. This
will cause the size of a packet to be 4 bytes less.

This patch updates the CRC strip bit according to whether
DEV_RX_OFFLOAD_KEEP_CRC is enabled.

Fixes: a5aeb2b9e225 ("net/igc: support Rx and Tx")
Cc: stable@dpdk.org
Signed-off-by: Alvin Zhang <alvinx.zhang@intel.com>
Acked-by: Haiyue Wang <haiyue.wang@intel.com>
3 years agonet/bnxt: fix health check alarm cancellation
Kalesh AP [Tue, 20 Apr 2021 04:08:45 +0000 (09:38 +0530)]
net/bnxt: fix health check alarm cancellation

Driver cancels the health check alarm only if error recovery is enabled
in the FW. This can cause an issue. There is a small window where the
driver receives the async event from FW and port close is invoked
immediately. Driver clears BNXT_FLAG_RECOVERY_ENABLED flag when it gets
the async event from FW. As a result, the health check alarm will not
get canceled during port close and causes a segfault when the alarm tries
to read Heartbeat register.

Fix this by canceling the health check alarm unconditionally during
port stop.

Fixes: 9d0cbaecc91a ("net/bnxt: support periodic FW health monitoring")
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>
3 years agonet/bnxt: cap max Rx rings for Thor
Ajit Khaparde [Wed, 14 Apr 2021 23:44:49 +0000 (16:44 -0700)]
net/bnxt: cap max Rx rings for Thor

For Thor devices, RSS table can only accommodate 512 Rx queues.
When RSS is enabled, Cap the max Rx rings to 512.
For non-RSS case, the number will be limited by number of VNICs.

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Lance Richardson <lance.richardson@broadcom.com>
3 years agonet/bnxt: fix resource cleanup
Ajit Khaparde [Thu, 8 Apr 2021 20:17:47 +0000 (13:17 -0700)]
net/bnxt: fix resource cleanup

Fix resource cleanup in port close.
Once the pointers are freed, set them to NULL.
Make sure access to the pointers is validated before use.

Fixes: bb81e07323bb ("net/bnxt: support LED on/off")
Fixes: 804e746c7b73 ("net/bnxt: add hardware resource manager init code")
Fixes: 1d0704f4d793 ("net/bnxt: add device configure operation")
Fixes: 698aa7e95325 ("net/bnxt: add code to determine the Tx COS queue")
Fixes: 322bd6e70272 ("net/bnxt: add port representor infrastructure")
Fixes: 0bf5a0b5ebb8 ("net/bnxt: add a failure log")
Cc: stable@dpdk.org
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
3 years agonet/bonding: fix adding itself as its slave
Chengchang Tang [Thu, 15 Apr 2021 07:09:54 +0000 (15:09 +0800)]
net/bonding: fix adding itself as its slave

Adding the bond device as its own slave should be forbidden. This
will cause a recursive endless loop in many subsequent operations,
and eventually lead to coredump.

This problem was found in testpmd, the related logs are as follows:
testpmd> create bonded device 1 0
Created new bonded device net_bonding_testpmd_0 on (port 4).
testpmd> add bonding slave 4 4
Segmentation fault (core dumped)

The call stack is as follows:
0x000000000064eb90 in rte_eth_dev_info_get ()
0x00000000006df4b4 in bond_ethdev_info ()
0x000000000064eb90 in rte_eth_dev_info_get ()
0x00000000006df4b4 in bond_ethdev_info ()
0x000000000064eb90 in rte_eth_dev_info_get ()
0x0000000000564e58 in eth_dev_info_get_print_err ()
0x000000000055e8a4 in init_port_config ()
0x000000000052730c in cmd_add_bonding_slave_parsed ()
0x0000000000646f60 in cmdline_parse ()
0x0000000000645e08 in cmdline_valid_buffer ()
0x000000000064956c in rdline_char_in ()
0x0000000000645ee0 in cmdline_in ()
0x00000000006460a4 in cmdline_interact ()
0x0000000000531904 in prompt ()
0x000000000051cca8 in main ()

Fixes: 2efb58cbab6e ("bond: new link bonding library")
Cc: stable@dpdk.org
Signed-off-by: Chengchang Tang <tangchengchang@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
3 years agoraw/ifpga/base: check size before assigning
Wei Huang [Thu, 8 Apr 2021 08:51:51 +0000 (04:51 -0400)]
raw/ifpga/base: check size before assigning

In max10_staging_area_init(), variable "size" from fdt_get_reg() may
be invalid, it should be checked before assigning to member variable
"staging_area_size" of structure "intel_max10_device".

Coverity issue: 367480, 367482
Fixes: 96ebfcf8125c ("raw/ifpga/base: add SPI and MAX10 device driver")
Cc: stable@dpdk.org
Signed-off-by: Wei Huang <wei.huang@intel.com>
Acked-by: Tianfei Zhang <tianfei.zhang@intel.com>
3 years agonet/hns3: move link speeds check to configure
Huisong Li [Sat, 17 Apr 2021 09:54:59 +0000 (17:54 +0800)]
net/hns3: move link speeds check to configure

This patch moves the check for "link_speeds" in dev_conf to
dev_configure, so that users know whether "link_speeds" is valid in
advance.

Fixes: bdaf190f8235 ("net/hns3: support link speed autoneg for PF")
Fixes: 400d307e1a60 ("net/hns3: support fixed link speed")

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
3 years agonet/hns3: fix flow director lock
Chengwen Feng [Sat, 17 Apr 2021 09:54:58 +0000 (17:54 +0800)]
net/hns3: fix flow director lock

Currently, the fdir lock was used to protect concurrent access in
multiple processes, it has the following problems:
1) Lack of protection for fdir reset recover.
2) Only part of data is protected, eg. the filterlist is not protected.

We use the following scheme:
1) Del the fdir lock.
2) Add a flow lock and provides rte flow driver ops API-level
   protection.
3) Declare support RTE_ETH_DEV_FLOW_OPS_THREAD_SAFE.

Fixes: fcba820d9b9e ("net/hns3: support flow director")
Cc: stable@dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
3 years agonet/hns3: fix VMDq mode check
Huisong Li [Sat, 17 Apr 2021 09:54:57 +0000 (17:54 +0800)]
net/hns3: fix VMDq mode check

HNS3 PF driver only supports RSS, DCB or NONE multiple queues mode.
Currently, driver doesn't verify the VMDq multi-queue mode completely.
This patch fixes the verification for VMDq mode.

Fixes: 62e3ccc2b94c ("net/hns3: support flow control")
Cc: stable@dpdk.org
Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
3 years agonet/hns3: fix DCB mode check
Huisong Li [Sat, 17 Apr 2021 09:54:56 +0000 (17:54 +0800)]
net/hns3: fix DCB mode check

Currently, "ONLY DCB" and "DCB+RSS" mode are both supported by HNS3
PF driver. But the driver verifies only the "DCB+RSS" multiple queues
mode.

Fixes: 62e3ccc2b94c ("net/hns3: support flow control")
Cc: stable@dpdk.org
Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
3 years agonet/hns3: remove redundant mailbox response
Huisong Li [Sat, 17 Apr 2021 09:54:55 +0000 (17:54 +0800)]
net/hns3: remove redundant mailbox response

Some mbx messages do not need to reply with data. In this case,
it is no need to set the response data address and the response
length.

This patch removes these redundant codes from mbx messages that do
not need be replied.

Fixes: a5475d61fa34 ("net/hns3: support VF")
Cc: stable@dpdk.org
Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
3 years agonet/hns3: add compile-time verification on Rx vector
Chengwen Feng [Sat, 17 Apr 2021 09:54:54 +0000 (17:54 +0800)]
net/hns3: add compile-time verification on Rx vector

Rx vector implementation depends on the mbuf fields
(such as rearm_data/rx_descriptor_fields1) layout, this patch adds
compile-time verification for this.

Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
3 years agoapp/testpmd: add commands for conntrack
Bing Zhao [Mon, 19 Apr 2021 17:51:31 +0000 (01:51 +0800)]
app/testpmd: add commands for conntrack

The command line for testing connection tracking is added. To create
a conntrack object, 3 parts are needed.
  set conntrack com peer ...
  set conntrack orig scale ...
  set conntrack rply scale ...
This will create a full conntrack action structure for the indirect
action. After the indirect action handle of "conntrack" created, it
could be used in the flow creation. Before updating, the same
structure is also needed together with the update command
"conntrack_update" to update the "dir" or "ctx".

After the flow with conntrack action created, the packet should jump
to the next flow for the result checking with conntrack item. The
state is defined with bits and a valid combination could be
supported.

Signed-off-by: Bing Zhao <bingz@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
3 years agoethdev: introduce conntrack flow action and item
Bing Zhao [Mon, 19 Apr 2021 17:51:30 +0000 (01:51 +0800)]
ethdev: introduce conntrack flow action and item

This commit introduces the conntrack action and item.

Usually the HW offloading is stateless. For some stateful offloading
like a TCP connection, HW module will help provide the ability of a
full offloading w/o SW participation after the connection was
established.

The basic usage is that in the first flow rule the application should
add the conntrack action and jump to the next flow table. In the
following flow rule(s) of the next table, the application should use
the conntrack item to match on the result.

A TCP connection has two directions traffic. To set a conntrack
action context correctly, the information of packets from both
directions are required.

The conntrack action should be created on one ethdev port and supply
the peer ethdev port as a parameter to the action. After context
created, it could only be used between these two ethdev ports
(dual-port mode) or a single port. The application should modify the
action via the API "rte_action_handle_update" only when before using
it to create a flow rule with conntrack for the opposite direction.
This will help the driver to recognize the direction of the flow to
be created, especially in the single-port mode, in which case the
traffic from both directions will go through the same ethdev port
if the application works as an "forwarding engine" but not an end
point. There is no need to call the update interface if the
subsequent flow rules have nothing to be changed.

Query will be supported via "rte_action_handle_query" interface,
about the current packets information and connection status. The
fields query capabilities depends on the HW.

For the packets received during the conntrack setup, it is suggested
to re-inject the packets in order to make sure the conntrack module
works correctly without missing any packet. Only the valid packets
should pass the conntrack, packets with invalid TCP information,
like out of window, or with invalid header, like malformed, should
not pass.

Naming and definition:
https://elixir.bootlin.com/linux/latest/source/include/uapi/linux/
        netfilter/nf_conntrack_tcp.h
https://elixir.bootlin.com/linux/latest/source/net/netfilter/
        nf_conntrack_proto_tcp.c

Other reference:
https://www.usenix.org/legacy/events/sec01/invitedtalks/rooij.pdf

Signed-off-by: Bing Zhao <bingz@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
3 years agoapp/testpmd: add packet ID for IP fragment
Jeff Guo [Tue, 13 Apr 2021 08:10:29 +0000 (16:10 +0800)]
app/testpmd: add packet ID for IP fragment

Add the new items to support the flow configuration for IP fragment
packets.

Signed-off-by: Ting Xu <ting.xu@intel.com>
Signed-off-by: Jeff Guo <jia.guo@intel.com>
Acked-by: Ori Kam <orika@nvidia.com>
3 years agonet/iavf: deprecate i40evf PMD
Robin Zhang [Mon, 19 Apr 2021 03:05:39 +0000 (03:05 +0000)]
net/iavf: deprecate i40evf PMD

The i40evf PMD will be deprecated, iavf will be the only VF driver for
Intel 700 serial (i40e) NIC family.

To reach this, there will be 2 steps:

Step 1: iavf will be the default VF driver, while i40evf still can be
selected by devarg: "driver=i40evf".
This is covered by this patch, which include:
1) add all 700 serial NIC VF device ID into iavf PMD
2) skip probe if devargs contain "driver=i40evf" in iavf
3) continue probe if devargs contain "driver=i40evf" in i40evf

Step 2: i40evf and related devarg are removed, this will happen at DPDK
21.11

Between step 1 and step 2, no new feature will be added into i40evf
except bug fix.

Signed-off-by: Robin Zhang <robinx.zhang@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Beilei Xing <beilei.xing@intel.com>
3 years agonet/mlx5: fix VLAN push/pop and decap actions with mirror
Jiawei Wang [Fri, 9 Apr 2021 12:36:42 +0000 (15:36 +0300)]
net/mlx5: fix VLAN push/pop and decap actions with mirror

Due to hardware limitations the VLAN push/pop and decap actions following
the sample action are supported in the FDB Tx steering domain only, the
flows with incorrect action order for other domains are rejected by
rdma-core.

To provide the action order requested in flow API this patch checks for
the VLAN or decap precedence to the sample action and moves the VLAN or
decap actions into the next flow in the new table and adds the jump
action in the prefix sample flow.

This patch also adds the validation for these combination actions.

Fixes: 255b8f86eb6e ("net/mlx5: fix E-Switch egress mirror flow validation")
Cc: stable@dpdk.org
Signed-off-by: Jiawei Wang <jiaweiw@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
3 years agonet/mlx5: support single flow dump
Haifei Luo [Thu, 15 Apr 2021 11:19:24 +0000 (14:19 +0300)]
net/mlx5: support single flow dump

Modify API mlx5_flow_dev_dump to support the feature.
Modify mlx5_socket since one extra arg flow_ptr is added.

The data structure sent to DPDK application from the utility triggering
the flow dumps should be packed and endianness must be specified.
The native host endianness can be used, all exchange happens within
the same host (we use sendmsg aux data and share the file handle,
remote approach is not applicable, no inter-host communication happens).

The message structure to dump one/all flow(s):
struct mlx5_flow_dump_req {
uint32_t port_id;
uint64_t flow_ptr;
} __rte_packed;

If flow_ptr is 0, all flows for the specified port will be dumped.

Signed-off-by: Haifei Luo <haifeil@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
3 years agocommon/mlx5: add functions for single flow dump
Haifei Luo [Thu, 15 Apr 2021 11:19:23 +0000 (14:19 +0300)]
common/mlx5: add functions for single flow dump

Add mlx5 APIs for single flow dump feature

Signed-off-by: Haifei Luo <haifeil@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
3 years agonet/hns3: check max SIMD bitwidth
Chengwen Feng [Thu, 15 Apr 2021 03:52:02 +0000 (11:52 +0800)]
net/hns3: check max SIMD bitwidth

This patch supports check max SIMD bitwidth when choosing NEON and SVE
vector path.

Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
3 years agonet/hns3: simplify Rx checksum
Chengwen Feng [Thu, 15 Apr 2021 03:52:01 +0000 (11:52 +0800)]
net/hns3: simplify Rx checksum

Currently, the L3L4P/L3E/L4E/OL3E/OL4E fields in Rx descriptor used to
indicate hardware checksum result:
1. L3L4P: indicates hardware has processed L3L4 checksum for this
   packet, if this bit is 1 then L3E/L4E/OL3E/OL4E is trustable.
2. L3E: L3 checksum error indication, 1 means with error.
3. L4E: L4 checksum error indication, 1 means with error.
4. OL3E: outer L3 checksum error indication, 1 means with error.
5. OL4E: outer L4 checksum error indication, 1 means with error.

Driver will set the good checksum flag through packet type and
L3E/L4E/OL3E/OL4E when L3L4P is 1, it runs as follows:
1. If packet type indicates it's tunnel packet:
1.1. If packet type indicates it has inner L3 and L3E is zero, then
mark the IP checksum good.
1.2. If packet type indicates it has inner L4 and L4E is zero, then
mark the L4 checksum good.
1.3. If packet type indicates it has outer L4 and OL4E is zero, then
mark the outer L4 checksum good.
2. If packet type indicates it's not tunnel packet:
2.1. If packet type indicates it has L3 and L3E is zero, then mark the
IP checksum good.
2.2. If packet type indicates it has L4 and L4E is zero, then mark the
L4 checksum good.

As described above, the good checksum calculation is time consuming,
it impacts the Rx performance.

By balancing performance and functionality, driver uses the following
scheme to set good checksum flag when L3L4P is 1:
1. If L3E is zero, then mark the IP checksum good.
2. If L4E is zero, then mark the L4 checksum good.

The performance gains are 3% in small packet iofwd scenarios.

Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
3 years agonet/hns3: support masking device capability
Chengwen Feng [Thu, 15 Apr 2021 03:52:00 +0000 (11:52 +0800)]
net/hns3: support masking device capability

This patch supports runtime config of mask device capability, it was
used to mask the capability which queried from firmware.

The device argument key is "dev_caps_mask" which takes hexadecimal
bitmask where each bit represents whether mask corresponding capability.

Its main purpose is to debug and avoid problems.

Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
3 years agoapp/testpmd: support integrity flow item
Ori Kam [Mon, 19 Apr 2021 12:44:31 +0000 (15:44 +0300)]
app/testpmd: support integrity flow item

The integrity item allows the application to match
on the integrity of a packet.

Usage example:
match that packet integrity checks are OK. The checks depend on
packet layers. For example ICMP packet will not check L4 level.
flow create 0 ingress pattern integrity value mask 0x01 value spec 0x01

Match that L4 packet is OK - check L2 & L3 & L4 layers:
flow create 0 ingress pattern integrity value mask 0xfe value spec 0xfe

Signed-off-by: Ori Kam <orika@nvidia.com>
Signed-off-by: Gregory Etelson <getelson@nvidia.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
3 years agoethdev: add packet integrity check flow rules
Ori Kam [Mon, 19 Apr 2021 12:44:30 +0000 (15:44 +0300)]
ethdev: add packet integrity check flow rules

Currently, DPDK application can offload the checksum check,
and report it in the mbuf.

However, as more and more applications are offloading some or all
logic and action to the HW, there is a need to check the packet
integrity so the right decision can be taken.

The application logic can be positive meaning if the packet is
valid jump / do  actions, or negative if packet is not valid
jump to SW / do actions (like drop) and add default flow
(match all in low priority) that will direct the miss packet
to the miss path.

Since currently rte_flow works in positive way the assumption is
that the positive way will be the common way in this case also.

When thinking what is the best API to implement such feature,
we need to consider the following (in no specific order):
1. API breakage.
2. Simplicity.
3. Performance.
4. HW capabilities.
5. rte_flow limitation.
6. Flexibility.

First option: Add integrity flags to each of the items.
For example add checksum_ok to IPv4 item.

Pros:
1. No new rte_flow item.
2. Simple in the way that on each item the app can see
what checks are available.

Cons:
1. API breakage.
2. Increase number of flows, since app can't add global rule and must
   have dedicated flow for each of the flow combinations, for example
   matching on ICMP traffic or UDP/TCP  traffic with IPv4 / IPv6 will
   result in 5 flows.

Second option: dedicated item

Pros:
1. No API breakage, and there will be no for some time due to having
   extra space. (by using bits)
2. Just one flow to support the ICMP or UDP/TCP traffic with IPv4 /
   IPv6.
3. Simplicity application can just look at one place to see all possible
   checks.
4. Allow future support for more tests.

Cons:
1. New item, that holds number of fields from different items.

For starter the following bits are suggested:
1. packet_ok - means that all HW checks depending on packet layer have
   passed. This may mean that in some HW such flow should be split to
   number of flows or fail.
2. l2_ok - all check for layer 2 have passed.
3. l3_ok - all check for layer 3 have passed. If packet doesn't have
   L3 layer this check should fail.
4. l4_ok - all check for layer 4 have passed. If packet doesn't
   have L4 layer this check should fail.
5. l2_crc_ok - the layer 2 CRC is O.K.
6. ipv4_csum_ok - IPv4 checksum is O.K. It is possible that the
   IPv4 checksum will be O.K. but the l3_ok will be 0. It is not
   possible that checksum will be 0 and the l3_ok will be 1.
7. l4_csum_ok - layer 4 checksum is O.K.
8. l3_len_OK - check that the reported layer 3 length is smaller than the
   frame length.

Example of usage:
1. Check packets from all possible layers for integrity.
   flow create integrity spec packet_ok = 1 mask packet_ok = 1 .....

2. Check only packet with layer 4 (UDP / TCP)
   flow create integrity spec l3_ok = 1, l4_ok = 1 mask l3_ok = 1
   l4_ok = 1

Signed-off-by: Ori Kam <orika@nvidia.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
3 years agodoc: update matching versions in ice guide
Qi Zhang [Wed, 24 Mar 2021 13:02:50 +0000 (21:02 +0800)]
doc: update matching versions in ice guide

Updated ice recommended matching list for DPDK 21.02.

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
3 years agodoc: fix matching versions in ice guide
Qi Zhang [Wed, 24 Mar 2021 13:02:49 +0000 (21:02 +0800)]
doc: fix matching versions in ice guide

Fixed matching kernel driver version for DPDK 20.11.

Fixes: e89aebf3b597 ("doc: update ice user guide")
Cc: stable@dpdk.org
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
3 years agoapp/testpmd: add link autoneg status display
Huisong Li [Thu, 15 Apr 2021 06:45:15 +0000 (14:45 +0800)]
app/testpmd: add link autoneg status display

This patch adds link autoneg status display in port_infos_display().

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
Acked-by: Xiaoyun Li <xiaoyun.li@intel.com>
3 years agoethdev: introduce indirect flow action
Bing Zhao [Mon, 19 Apr 2021 14:38:29 +0000 (22:38 +0800)]
ethdev: introduce indirect flow action

Right now, rte_flow_shared_action_* APIs are used for some shared
actions, like RSS, count. The shared action should be created before
using it inside a flow. These shared actions sometimes are not
really shared but just some indirect actions decoupled from a flow.

The new functions rte_flow_action_handle_* are added to replace
the current shared functions rte_flow_shared_action_*.

There are two types of flow actions:
1. the direct (normal) actions that could be created and stored
   within a flow rule. Such action is tied to its flow rule and
   cannot be reused.
2. the indirect action, in the past, named shared_action. It is
   created from a direct actioni, like count or rss, and then used
   in the flow rules with an object handle. The PMD will take care
   of the retrieve from indirect action to the direct action
   when it is referenced.

The indirect action is accessed (update / query) w/o any flow rule,
just via the action object handle. For example, when querying or
resetting a counter, it could be done out of any flow using this
counter, but only the handle of the counter action object is
required.
The indirect action object could be shared by different flows or
used by a single flow, depending on the direct action type and
the real-life requirements.
The handle of an indirect action object is opaque and defined in
each driver and possibly different per direct action type.

The old name "shared" is improper in a sense and should be replaced.

Since the APIs are changed from "rte_flow_shared_action*" to the new
"rte_flow_action_handle*", the testpmd application code and command
line interfaces also need to be updated to do the adaption.
The testpmd application user guide is also updated. All the "shared
action" related parts are replaced with "indirect action" to have a
correct explanation.

The parameter of "update" interface is also changed. A general
pointer will replace the rte_flow_action struct pointer due to the
facts:
1. Some action may not support fields updating. In the example of a
   counter, the only "update" supported should be the reset. So
   passing a rte_flow_action struct pointer is meaningless and
   there is even no such corresponding action struct. What's more,
   if more than one operations should be supported, for some other
   action, such pointer parameter may not meet the need.
2. Some action may need conditional or partial update, the current
   parameter will not provide the ability to indicate which part(s)
   to update.
   For different types of indirect action objects, the pointer could
   either be the same of rte_flow_action* struct - in order not to
   break the current driver implementation, or some wrapper
   structures with bits as masks to indicate which part to be
   updated, depending on real needs of the corresponding direct
   action. For different direct actions, the structures of indirect
   action objects updating will be different.

All the underlayer PMD callbacks will be moved to these new APIs.

The RTE_FLOW_ACTION_TYPE_SHARED is kept for now in order not to
break the ABI. All the implementations are changed by using
RTE_FLOW_ACTION_TYPE_INDIRECT.

Since the APIs are changed from "rte_flow_shared_action*" to the new
"rte_flow_action_handle*" and the "update" interface's 3rd input
parameter is changed to generic pointer, the mlx5 PMD that uses these
APIs needs to do the adaption to the new APIs as well.

Signed-off-by: Bing Zhao <bingz@nvidia.com>
Acked-by: Andrey Vesnovaty <andreyv@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
3 years agonet/hns3: support RAS process in Kunpeng 930
Hongbo Zheng [Mon, 19 Apr 2021 07:36:44 +0000 (15:36 +0800)]
net/hns3: support RAS process in Kunpeng 930

Kunpeng 930 uses a new RAS exception reporting solution.
The reset type and exception status are reported through
firmware. The driver modifies the corresponding code to
adapt to the new solution.

Signed-off-by: Hongbo Zheng <zhenghongbo3@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
3 years agonet/hns3: remove unused macros
Min Hu (Connor) [Mon, 19 Apr 2021 08:13:31 +0000 (16:13 +0800)]
net/hns3: remove unused macros

'HNS3_RXD_TSIND_S' and 'HNS3_RXD_TSIND_M' is unused, which should
be deleted.

This patch fixed it.

Fixes: bba636698316 ("net/hns3: support Rx/Tx and related operations")
Cc: stable@dpdk.org
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
3 years agodoc: add Kunpeng 930 support in hns3 guide
Min Hu (Connor) [Mon, 19 Apr 2021 08:36:59 +0000 (16:36 +0800)]
doc: add Kunpeng 930 support in hns3 guide

Hns3 PMD has already supported Kunpeng 930 SoC.

This patch added description for it.

Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
3 years agoethdev: add queue state in queried queue information
Lijun Ou [Mon, 19 Apr 2021 08:57:30 +0000 (16:57 +0800)]
ethdev: add queue state in queried queue information

Currently, upper-layer application could get queue state only
through pointers such as dev->data->tx_queue_state[queue_id],
this is not the recommended way to access it. So this patch
add get queue state when call rte_eth_rx_queue_info_get and
rte_eth_tx_queue_info_get API.

Note: After add queue_state field, the 'struct rte_eth_rxq_info' size
remains 128B, and the 'struct rte_eth_txq_info' size remains 64B, so
it could be ABI compatible.

Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Signed-off-by: Lijun Ou <oulijun@huawei.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
3 years agodoc: fix HiSilicon copyright syntax
Min Hu (Connor) [Fri, 16 Apr 2021 10:34:29 +0000 (18:34 +0800)]
doc: fix HiSilicon copyright syntax

This patch fixes HiSilicon copyright syntax.

According to the suggestion of our legal department,
to standardize the copyright license of our code to
avoid potential copyright risks, we make a unified
modification to the "Hisilicon", which was nonstandard,
in the main modules we maintain.

We change it to "HiSilicon", which is consistent with
the terms used on the following official website:
https://www.hisilicon.com/en/terms-of-use.

Fixes: 565829db8b8f ("net/hns3: add build and doc infrastructure")
Cc: stable@dpdk.org
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
3 years agodoc: remove queue stats mapping from testpmd guide
Huisong Li [Fri, 16 Apr 2021 10:34:28 +0000 (18:34 +0800)]
doc: remove queue stats mapping from testpmd guide

The "--tx-queue-stats-mapping" and "--rx-queue-stats-mapping"
and display and clear of "stats_map" have been removed from
testpmd.

This patch deletes some descriptions about queue stats mapping
in testpmd doc.

Fixes: 08dcd1870686 ("app/testpmd: fix queue stats mapping configuration")
Cc: stable@dpdk.org
Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
3 years agoexamples/l3fwd: skip Tx queue drain on first FIB iteration
Conor Walsh [Wed, 21 Apr 2021 12:48:42 +0000 (12:48 +0000)]
examples/l3fwd: skip Tx queue drain on first FIB iteration

The commit a8f8b672d575 ("examples/l3fwd: skip Tx queue drain on first iteration")
implemented a change to the EM and LPM lookup methods to
prevent the Tx queue drain running in the first iteration of their
packet processing loops.

This patch applies the same change into the new FIB lookup method.

Signed-off-by: Conor Walsh <conor.walsh@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>
3 years agoexamples/ethtool: remove unused parsing
Chengwen Feng [Wed, 21 Apr 2021 02:39:43 +0000 (10:39 +0800)]
examples/ethtool: remove unused parsing

The new_mtu was assigned twice, the first assignment could be removed.

Fixes: bda68ab9d1e7 ("examples/ethtool: add user-space ethtool sample application")
Cc: stable@dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
3 years agoexamples: add eal cleanup to examples
Chengchang Tang [Thu, 15 Apr 2021 02:26:03 +0000 (10:26 +0800)]
examples: add eal cleanup to examples

According to the programming guide, the rte_eal_init should be used pairs
with rte_eal_cleanup.

This patch add rte_eal_cleanup to examples to encourage new users of
DPDK to use it.

Fixes: aec9c13c5257 ("eal: add function to release internal resources")
Fixes: 3d0fad56b74a ("examples/fips_validation: add crypto FIPS application")
Fixes: c8e6ceecebc1 ("examples/ioat: add new sample app for ioat driver")
Fixes: 4ff457986f76 ("examples/l2fwd-event: add default poll mode routines")
Fixes: 08bd1a174461 ("examples/l3fwd-graph: add graph-based l3fwd skeleton")
Fixes: c5eebf85badc ("examples/ntb: add example for NTB")
Fixes: b77f66002812 ("examples/pipeline: add new example application")
Fixes: edbed86d1cc3 ("examples/vdpa: introduce a new sample for vDPA")
Fixes: c19beb3f38cd ("examples/vhost_blk: introduce vhost storage sample")
Fixes: f5188211c721 ("examples/vhost_crypto: add sample application")
Cc: stable@dpdk.org
Signed-off-by: Chengchang Tang <tangchengchang@huawei.com>
3 years agotelemetry: fix build on FreeBSD < 12.2
Thomas Monjalon [Wed, 21 Apr 2021 17:51:24 +0000 (19:51 +0200)]
telemetry: fix build on FreeBSD < 12.2

The function pthread_setname_np() was originally not available on
FreeBSD. It has been added in FreeBSD 12.2:
https://svnweb.freebsd.org/base?view=revision&revision=362264

The EAL implementation of rte_thread_setname() is duplicated
in the telemetry library, which does not depend on EAL,
so the compilation is safe in all systems.

Fixes: 5da7736f8c53 ("telemetry: set socket listener thread name")

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>