dpdk.git
2 years agocryptodev: fix freeing after device release
Ciara Power [Wed, 21 Jul 2021 12:51:22 +0000 (12:51 +0000)]
cryptodev: fix freeing after device release

The PMD destroy function was calling the release function, which frees
cryptodev->data, and then tries to free cryptodev->data->dev_private,
which causes the heap use after free issue.

A temporary pointer is set before the free of cryptodev->data,
which can then be used afterwards to free dev_private.
The free cannot be moved to before the release function is called,
as dev_private is used in the PMD close function while being released.

Fixes: 9e6edea41805 ("cryptodev: add APIs to assist PMD initialisation")
Cc: stable@dpdk.org
Reported-by: Zhihong Peng <zhihongx.peng@intel.com>
Signed-off-by: Ciara Power <ciara.power@intel.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
2 years agotest/crypto: increase mbuf data payload size to 4K
Suanming Mou [Tue, 20 Jul 2021 13:28:11 +0000 (16:28 +0300)]
test/crypto: increase mbuf data payload size to 4K

Currently, there is vendor which can support bigger crypto data size.
Increase the default mbuf data payload size to 4K as needed.

Signed-off-by: Suanming Mou <suanmingm@nvidia.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
2 years agocrypto/qat: fix raw data path dequeue
Fan Zhang [Tue, 27 Jul 2021 15:42:46 +0000 (16:42 +0100)]
crypto/qat: fix raw data path dequeue

This patch fixes the raw data path dequeue burst fail problem.
Previously in case the queue is full and not all packets
asked to be dequeued are processed, the dequeue burst will
never happen.

Fixes: c21574edc52a ("cryptodev: add dequeue count parameter in raw API")
Cc: stable@dpdk.org
Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
2 years agocrypto/cnxk: add null check for RSA key data
Kiran Kumar K [Mon, 26 Jul 2021 04:44:19 +0000 (10:14 +0530)]
crypto/cnxk: add null check for RSA key data

Coverity is reporting FORWARD_NULL issue when qt data is NULL.
Adding NULL check for this.

Coverity issue: 371893
Fixes: 5a3513caeb45 ("crypto/cnxk: add asymmetric session")

Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
2 years agocrypto/ccp: convert driver from vdev to PCI
Amaranath Somalapuram [Mon, 26 Jul 2021 09:08:21 +0000 (14:38 +0530)]
crypto/ccp: convert driver from vdev to PCI

drop all the code duplicating the PCI bus driver
developed for enable IOMMU in vdev.

Signed-off-by: Amaranath Somalapuram <asomalap@amd.com>
2 years agocrypto/qat: fix array access
Arek Kusztal [Mon, 26 Jul 2021 16:47:49 +0000 (17:47 +0100)]
crypto/qat: fix array access

Fix possible access of an array by negative index in function
qat_sym_qp_setup.

Coverity issue: 372131, 372134
Fixes: 8f393c4ffdc1 ("common/qat: support GEN4 devices")

Signed-off-by: Arek Kusztal <arkadiuszx.kusztal@intel.com>
Acked-by: Adam Dybkowski <adamx.dybkowski@intel.com>
2 years agocommon/cpt: update asymmetric ECDSA messages
Kiran Kumar K [Mon, 26 Jul 2021 04:48:53 +0000 (10:18 +0530)]
common/cpt: update asymmetric ECDSA messages

Adding changes to asymmetric ECDSA messages to align with
the new ucode for octeontx2 device.

Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
2 years agocrypto/cnxk: update asymmetric ECDSA messages
Kiran Kumar K [Mon, 26 Jul 2021 04:48:52 +0000 (10:18 +0530)]
crypto/cnxk: update asymmetric ECDSA messages

Adding changes to asymmetric ECDSA messages to align with
the new ucode for cnxk device.

Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
2 years agocommon/cnxk: add constants to EC groups
Kiran Kumar K [Mon, 26 Jul 2021 04:48:51 +0000 (10:18 +0530)]
common/cnxk: add constants to EC groups

New ucode expects const values A and B for asymmetric ECDSA
messages. Adding roc support for this.

Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
2 years agonet/bnxt: disable VF representors on Thor
Ajit Khaparde [Fri, 30 Jul 2021 21:08:49 +0000 (14:08 -0700)]
net/bnxt: disable VF representors on Thor

In a few cases with Thor device, PMD can segfault when VF
representors are specified. Temporarily fix it by preventing
VF reps for Thor device. This will be addressed in next release.

Fixes: 3fe124d2536c ("net/bnxt: support Thor platform")
Cc: stable@dpdk.org
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
2 years agotest/rcu: use compiler atomics for data sync
Joyce Kong [Tue, 20 Jul 2021 03:51:25 +0000 (22:51 -0500)]
test/rcu: use compiler atomics for data sync

Covert rte_atomic usages to compiler atomic built-ins in
rcu_perf testcases.

Signed-off-by: Joyce Kong <joyce.kong@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
2 years agotest/service: use compiler atomics for lock sync
Joyce Kong [Tue, 20 Jul 2021 03:51:24 +0000 (22:51 -0500)]
test/service: use compiler atomics for lock sync

Convert rte_atomic usages to compiler atomic built-ins for lock
sync in service_cores testcases.

Signed-off-by: Joyce Kong <joyce.kong@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
2 years agotest/mempool: use compiler atomics for lcores sync
Joyce Kong [Tue, 20 Jul 2021 03:51:23 +0000 (22:51 -0500)]
test/mempool: use compiler atomics for lcores sync

Convert rte_atomic usages to compiler atomic built-ins for lcores
sync in mempool_perf testcases. Meanwhile, remove unnecessary
synchro init as it would be set to 0 when launching cores.

Signed-off-by: Joyce Kong <joyce.kong@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
2 years agotest/mempool: remove unused variable for lcores sync
Joyce Kong [Tue, 20 Jul 2021 03:51:22 +0000 (22:51 -0500)]
test/mempool: remove unused variable for lcores sync

Remove the unused synchro variable as there is no lcores
sync in mempool function test.

Signed-off-by: Joyce Kong <joyce.kong@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
2 years agotest/mcslock: use compiler atomics for lcores sync
Joyce Kong [Tue, 20 Jul 2021 03:51:21 +0000 (22:51 -0500)]
test/mcslock: use compiler atomics for lcores sync

Convert rte_atomic usages to compiler atomic built-ins for lcores
sync in mcslock testcases.

Signed-off-by: Joyce Kong <joyce.kong@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
2 years agotest/rwlock: use compiler atomics for lcores sync
Joyce Kong [Tue, 20 Jul 2021 03:51:20 +0000 (22:51 -0500)]
test/rwlock: use compiler atomics for lcores sync

Convert rte_atomic usages to compiler atomic built-ins for lcores
sync in rwlock testcases.

Signed-off-by: Joyce Kong <joyce.kong@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
2 years agotest/spinlock: use compile atomics for lcores sync
Joyce Kong [Tue, 20 Jul 2021 03:51:19 +0000 (22:51 -0500)]
test/spinlock: use compile atomics for lcores sync

Convert rte_atomic usages to compiler atomic built-ins for lcores
sync in spinlock testcases.

Signed-off-by: Joyce Kong <joyce.kong@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
2 years agotest/ticketlock: use compiler atomics for lcores sync
Joyce Kong [Tue, 20 Jul 2021 03:51:18 +0000 (22:51 -0500)]
test/ticketlock: use compiler atomics for lcores sync

Convert rte_atomic usages to compiler atomic built-ins for lcores
sync in ticketlock testcases.

Signed-off-by: Joyce Kong <joyce.kong@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
2 years agoeal/windows: cleanup virt2phys handle
Dmitry Kozlyuk [Mon, 26 Jul 2021 21:36:32 +0000 (00:36 +0300)]
eal/windows: cleanup virt2phys handle

eal_mem_virt2phys_init() opens a handle for use by rte_mem_virt2phy().
Close this handle on EAL cleanup.

Fixes: 2a5d547a4a9b ("eal/windows: implement basic memory management")
Cc: stable@dpdk.org
Signed-off-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
Acked-by: Ranjit Menon <ranjit.menon@intel.com>
2 years agoexamples/l3fwd: disable multi-queue for single queue
Chaoyong He [Mon, 10 May 2021 16:53:19 +0000 (18:53 +0200)]
examples/l3fwd: disable multi-queue for single queue

Set the Rx multi-queue mode to NONE when configuring a port that is
associated with hardware that only supports a single Rx queue.

Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Signed-off-by: Heinrich Kuhn <heinrich.kuhn@netronome.com>
Signed-off-by: Simon Horman <simon.horman@netronome.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2 years agoapp/procinfo: add device registers dump
Chengchang Tang [Thu, 22 Jul 2021 10:58:36 +0000 (18:58 +0800)]
app/procinfo: add device registers dump

This patch add support for dump the device registers from a running
application. It can help developers locate the problem.

Signed-off-by: Chengchang Tang <tangchengchang@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
Acked-by: Reshma Pattan <reshma.pattan@intel.com>
2 years agoapp/acl: add script to automate testing
Konstantin Ananyev [Mon, 26 Jul 2021 11:51:37 +0000 (12:51 +0100)]
app/acl: add script to automate testing

The purpose of this script is to help automate ACL library functional
testing using test-acl app.
Sample input files are also provided.

Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
2 years agoapp/acl: allow comment and empty line in input
Konstantin Ananyev [Mon, 26 Jul 2021 11:51:36 +0000 (12:51 +0100)]
app/acl: allow comment and empty line in input

Allow comment (lines starting with '#') and empty lines in input
(rules, traces) files. These lines will be just skipped and shouldn't
affect the result anyhow.

Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
2 years agonet/bnxt: fix stats counter resource
Kishore Padmanabha [Mon, 19 Jul 2021 18:00:50 +0000 (14:00 -0400)]
net/bnxt: fix stats counter resource

The flow counters is reduced from 8192 to 6912 for Whitney
for compatibility with different versions of FW.
The FW resource manager splits resources for flow offload
and other use cases. A higher value used for flow offload
by the PMD can cause overriding the resources set aside by
FW. This in turn can lead to FW rejecting filter creation
requests during initialization.

Use a smaller safe value to avoid these issues.

Fixes: 6fad9115101c ("net/bnxt: reorganize ULP template directory structure")
Cc: stable@dpdk.org
Signed-off-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>
Reviewed-by: Randy Schacher <stuart.schacher@broadcom.com>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
2 years agonet/bnxt: fix initialization with old firmware
Jay Ding [Tue, 20 Jul 2021 14:40:27 +0000 (14:40 +0000)]
net/bnxt: fix initialization with old firmware

Fix the resource qcap list handling to use size based on
FW response.
The size of resource qcap list could be different when FW
and application are not matching. Application should be able
to handle this scenario when the FW is older and the size of
qcap is smaller. Failure to do this causes initialization failure.

This patch is needed for backward compatibility on different
firmware versions.

Fixes: 873661aa641a1 ("net/bnxt: support shared session")
Cc: stable@dpdk.org
Signed-off-by: Jay Ding <jay.ding@broadcom.com>
Reviewed-by: Randy Schacher <stuart.schacher@broadcom.com>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
2 years agoeventdev: fix event port setup in Tx adapter
Naga Harish K S V [Sat, 24 Jul 2021 14:10:36 +0000 (09:10 -0500)]
eventdev: fix event port setup in Tx adapter

The event port config set by application in
rte_event_eth_tx_adapter_create API is modified in
default configuration callback function. This patch removes
this hardcode to use application provided event port
config value.

Fixes: a3bbf2e09756 ("eventdev: add eth Tx adapter implementation")
Cc: stable@dpdk.org
Signed-off-by: Naga Harish K S V <s.v.naga.harish.k@intel.com>
2 years agoevent/cnxk: fix reading stale Tx queue depth
Pavan Nikhilesh [Tue, 20 Jul 2021 07:04:32 +0000 (12:34 +0530)]
event/cnxk: fix reading stale Tx queue depth

Reads to Tx queue FC memory need to be atomic to avoid cores using
same Tx queue spinning on stale values.

Fixes: 313e884a22fd ("event/cnxk: support Tx adapter fast path")

Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
2 years agoapp/testpmd: fix hotplug removal
Paulis Gributs [Wed, 28 Jul 2021 13:48:48 +0000 (13:48 +0000)]
app/testpmd: fix hotplug removal

After removing rte_eth_devices from testpmd the vm_hotplug no longer
recovered after removal of a device, because the port was closed
before querying it.

Fixes: 0a0821bcf312 ("app/testpmd: remove most uses of internal ethdev array")

Signed-off-by: Paulis Gributs <paulis.gributs@intel.com>
Acked-by: Xiaoyun Li <xiaoyun.li@intel.com>
2 years agoapp/testpmd: fix Tx checksum calculation for tunnel
Gregory Etelson [Thu, 29 Jul 2021 17:01:41 +0000 (20:01 +0300)]
app/testpmd: fix Tx checksum calculation for tunnel

csumonly engine calculates Tx checksum of a tunnelled packet
for outer headers only or separately for outer and inner headers.
The calculation method is determined by checksum configuration options.
If Tx checksum calculation is separated,
the inner headers are processed before outer headers.

Inner headers processing sets checksum values to 0 unconditionally.
If Tx configuration offloads inner checksums only, outer checksum
calculation in software will read 0 instead of real values
and produce wrong result.

The patch zeroes inner checksums only before software calculation.

Fixes: 6b520d54ebfe ("app/testpmd: use Tx preparation in checksum engine")
Cc: stable@dpdk.org
Signed-off-by: Gregory Etelson <getelson@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Acked-by: Xiaoyun Li <xiaoyun.li@intel.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
2 years agonet/softnic: fix memory leak as profile is freed
Dapeng Yu [Wed, 28 Jul 2021 06:05:39 +0000 (14:05 +0800)]
net/softnic: fix memory leak as profile is freed

In function softnic_table_action_profile_free(), the memory referenced
by pointer "ap" in the instance of "struct softnic_table_action_profile"
is not freed.

This patch fixes it.

Fixes: a737dd4e5863 ("net/softnic: add table action profile")
Cc: stable@dpdk.org
Signed-off-by: Dapeng Yu <dapengx.yu@intel.com>
Acked-by: Jasvinder Singh <jasvinder.singh@intel.com>
2 years agonet/softnic: fix null dereference in arguments parsing
Dapeng Yu [Tue, 27 Jul 2021 08:14:59 +0000 (16:14 +0800)]
net/softnic: fix null dereference in arguments parsing

When there is no "firmware" in arguments, the "firmware" pointer is
null, and will be dereferenced by rte_strscpy().

This patch moves the code block which copies character string from
"firmware" to "p->firmware" into the "if" statements where "firmware"
argument exists and it is duplicated successfully.

Coverity issue: 372136
Fixes: d8f852f5f369 ("net/softnic: fix memory leak in arguments parsing")
Cc: stable@dpdk.org
Signed-off-by: Dapeng Yu <dapengx.yu@intel.com>
Acked-by: Jasvinder Singh <jasvinder.singh@intel.com>
2 years agonet/memif: fix abstract socket address length
Nathan Skrzypczak [Fri, 23 Jul 2021 09:18:57 +0000 (11:18 +0200)]
net/memif: fix abstract socket address length

This fixes using abstract sockets with memifs.
We were not passing the exact addr_len,
which requires zeroing the remaining sun_path
and doesn't appear well in other utilities (e.g. lsof -U)

Signed-off-by: Nathan Skrzypczak <nathan.skrzypczak@gmail.com>
Reviewed-by: Jakub Grajciar <jgrajcia@cisco.com>
2 years agocommon/sfc_efx/base: do not validate MAE action COUNT order
Ivan Malov [Thu, 29 Jul 2021 09:32:59 +0000 (12:32 +0300)]
common/sfc_efx/base: do not validate MAE action COUNT order

In DPDK + Open vSwitch use case, action COUNT is always the
first one to be added. In particular, it goes before action
DECAP in that use case. The current code enforces the right
order (DECAP goes before COUNT), and this provokes failures.
As an exception, do not validate the order for action COUNT.

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
2 years agonet/ena: enable multi-segment in Tx offload flags
Ghalem Boudour [Fri, 30 Jul 2021 08:34:41 +0000 (10:34 +0200)]
net/ena: enable multi-segment in Tx offload flags

The DPDK ENA driver does not provide multi-segment tx offload capability.
Let's add DEV_TX_OFFLOAD_MULTI_SEGS to ports offload capability by
default, and always set it in dev->data->dev_conf.txmode.offload.

This flag in not listed in doc/guides/nics/features/default.ini, so
ena.ini does not need to be updated.

Fixes: 1173fca25af9 ("ena: add polling-mode driver")
Cc: stable@dpdk.org
Signed-off-by: Ghalem Boudour <ghalem.boudour@6wind.com>
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Michal Krawczyk <mk@semihalf.com>
2 years agonet/mlx5: fix meter hierarchy validation with yellow
Bing Zhao [Thu, 29 Jul 2021 16:04:05 +0000 (19:04 +0300)]
net/mlx5: fix meter hierarchy validation with yellow

In mlx5 PMD, the meter hierarchy only supports the green color. It
means that a meter action can only be in the green action list. In
the meanwhile, the yellow action list should be empty now. Any
action for the yellow color policy will be considered invalid if
the green color policy is a hierarchy.

Also, the error message printing of meter hierarchy validation is
fixed by removing an incorrect checking.

Fixes: 4b7bf3ffb473 ("net/mlx5: support yellow in meter policy validation")
Fixes: a3b7af90baba ("net/mlx5: validate meter action in policy")

Signed-off-by: Bing Zhao <bingz@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
2 years agonet/mlx5: fix green meter policy RSS queues
Bing Zhao [Thu, 29 Jul 2021 16:04:04 +0000 (19:04 +0300)]
net/mlx5: fix green meter policy RSS queues

Both green policy and yellow policy could support RSS actions
simultaneous, the Rx queues configuration may be different between
them while the other fields should be the same.

When the only green color policy was supported in the past, the
queues copied and saved in the temporary workspace were used. Since
the yellow support was added, the queues stored in the thread
workspace would be overwritten by the yellow color policy. The flow
rule created using a meter with such a policy would have the same
RSS distribution for both green and yellow packets.

By using the meter action containers RSS information instead of the
workspace RSS, this overwritten can be prevented.

Fixes: b38a12272b3a ("net/mlx5: split meter color policy handling")

Signed-off-by: Bing Zhao <bingz@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
2 years agonet/mlx5: fix meter EIR calculation
Bing Zhao [Thu, 29 Jul 2021 16:04:03 +0000 (19:04 +0300)]
net/mlx5: fix meter EIR calculation

Before the yellow color policy was supported, the only supported
profile of metering is RFC2697 and EIR is not part of the profile.
When creating a meter with this profile, the EIR part was always
zero.

After the yellow color policy supported and RFC2698 & 4115 support
was introduced, EIR is relevant and should be calculated. Usually
the EIR could not be zero and the formula for calculating CIR
mantissa & exponent could be reused.

The EIR could be 0 and then only green and red colors will be
supported from the specification. Both the mantissa and exponent
parts should be set to 0. Currently, the formula wrongly sets
non-zero values for the EIR=0 case.

Setting the mantissa and the exponent parts to zeros when EIR is 0
will solve the issue.

Fixes: 33a7493c8df8 ("net/mlx5: support meter for trTCM profiles")

Signed-off-by: Bing Zhao <bingz@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
2 years agonet/mlx5: fix meter profile validation
Bing Zhao [Thu, 29 Jul 2021 16:04:02 +0000 (19:04 +0300)]
net/mlx5: fix meter profile validation

After the support for yellow color and RFC2698 & RFC4115 were added,
the profile validation adjustment was missed. With this fix, the
validation is like below:
  1. Legacy metering only supports RFC2697 without EBS.
  2. ASO metering can support all three profiles.
  3. For backward compatibility, none EBS with RFC2697 profile is
     still supported and the checking is done in the meter
     creation stage.

In the meanwhile, some checking which was done in the parameters
calculation stage is moved in the validation in order to skip the
useless checking.

Fixes: 33a7493c8df8 ("net/mlx5: support meter for trTCM profiles")

Signed-off-by: Bing Zhao <bingz@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
2 years agonet/mlx5: add Tx scheduling check on queue creation
Viacheslav Ovsiienko [Thu, 29 Jul 2021 12:26:43 +0000 (15:26 +0300)]
net/mlx5: add Tx scheduling check on queue creation

The send scheduling on timestamp offload requires the Send
Queue (SQ) shares its User Access Region (UAR) with the
pacing Clock Queue. The SQ can be created by mlx5 PMD either
with DevX or with Verbs. If the SQ is being created with
DevX, the dedicated UAR can be specified and all the SQs
share the single UAR. Once SQ is being created with Verbs
the SQ's UAR is allocated by the rdma-core library internally
on its own and there is no UAR sharing. This caused hardware
errors on WAIT WQEs and overall send scheduling malfunction.

If SQs are going to be created with Verbs and the send
scheduling offload is explicitly requested via tx_pp devarg
the device probing is rejected as device configuration
can't satisfy the requirements.

Fixes: 3ec73abeed52 ("net/mlx5/linux: fix Tx queue operations decision")
Fixes: 8f848f32fc24 ("net/mlx5: introduce send scheduling devargs")
Cc: stable@dpdk.org
Signed-off-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
2 years agonet/mlx5: fix timestamp initialization on empty clock queue
Viacheslav Ovsiienko [Wed, 28 Jul 2021 14:23:35 +0000 (17:23 +0300)]
net/mlx5: fix timestamp initialization on empty clock queue

The committing completions by clock queue might be delayed
after queue initialization is done and the only Clock Queue
completion entry (CQE) might keep the invalid status till
the CQE first update happens.

The mlx5_txpp_update_timestamp() wrongly recognized invalid
status as error and reported about lost synchronization.

The patch recognizes the invalid status as "not updated yet"
and accurate scheduling initialization routine waits till
CQE first update happens.

Some collateral typos in comment are fixed as well.

Fixes: 77522be0a56d ("net/mlx5: introduce clock queue service routine")
Cc: stable@dpdk.org
Signed-off-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
2 years agonet/mlx5: fix flow engine type in function name
Asaf Penso [Wed, 28 Jul 2021 09:39:46 +0000 (12:39 +0300)]
net/mlx5: fix flow engine type in function name

The concrete function names have a prefix for flow_dv.
This emphasizes the flow engine is Direct Verbs.

The function flow_get_aged_flows doesn’t have this prefix.
It creates an inconsistency with the other functions.

Update the function name to include dv.

Fixes: fa2d01c87d2 ("net/mlx5: support flow aging")
Cc: stable@dpdk.org
Signed-off-by: Asaf Penso <asafp@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
2 years agonet/mlx5: limit implicit MPLS RSS expansion over GRE
Suanming Mou [Wed, 28 Jul 2021 08:24:10 +0000 (11:24 +0300)]
net/mlx5: limit implicit MPLS RSS expansion over GRE

As [1] optimized the MPLS RSS expansion before, this commit limits
the implicitly MPLS RSS expansion for MPLSoGRE as well. For the
RSS flow matcher to GRE level only, it will not expand the MPLS
match item for the sub flows due to performance consideration.

The original RSS flow match item:
ETH VLAN IPV6 GRE GRE_KEY END

The previous RSS expansion:
ETH VLAN IPV6 GRE GRE_KEY END
ETH VLAN IPV6 GRE GRE_KEY IPV4 END
ETH VLAN IPV6 GRE GRE_KEY MPLS IPV4 END
ETH VLAN IPV6 GRE GRE_KEY MPLS ETH IPV4 END

New RSS expansion:
ETH VLAN IPV6 GRE GRE_KEY END
ETH VLAN IPV6 GRE GRE_KEY IPV4 END

[1]
commit a26cc30fa046 ("net/mlx5: limit inner RSS expansion for MPLS")

Signed-off-by: Suanming Mou <suanmingm@nvidia.com>
Acked-by: Xiaoyu Min <jackmin@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
2 years agonet/mlx5: fix default queue number in RSS flow rule
Lior Margalit [Tue, 27 Jul 2021 06:46:20 +0000 (09:46 +0300)]
net/mlx5: fix default queue number in RSS flow rule

The selection flags for the RX hash define how the received packets will
be distributed between multiple queues.
When creating a new TIR, the queue_num is set to 1 if none of the selection
flags is set.

Applied the same to the RSS desc before checking if it matches a cached
TIR object to save creating a new object every time.

Fixes: fabf8a37241c ("net/mlx5: fix shared RSS action release")
Cc: stable@dpdk.org
Signed-off-by: Lior Margalit <lmargalit@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
2 years agonet/mlx5: fix RSS flow rule with L4 mismatch
Lior Margalit [Tue, 27 Jul 2021 06:46:19 +0000 (09:46 +0300)]
net/mlx5: fix RSS flow rule with L4 mismatch

The RSS hash types defined in the API do not support setting the L4 proto
type (TCP or UDP) without setting the L3 proto. For example, ETH_RSS_TCP
is defined as
(ETH_RSS_NONFRAG_IPV4_TCP | \
 ETH_RSS_NONFRAG_IPV6_TCP | \
 ETH_RSS_IPV6_TCP_EX).

The L3 proto of the RSS hash type may be different than the one defined
in the pattern, for example:
testpmd> flow create .../ ipv4 / tcp / end actions rss types ipv6-tcp-ex
end / end

If the RSS hash type also includes L4 proto type as in the above example,
the selection flags for the RX hash are currently set with SPORT/DPORT
without setting SRC/DST IP. As this combination is not supported, it does
not match any of the pre-created TIRs of the indirect RSS action
and the flow creation fails.

The fix is to prevent setting the selection flags for the RX hash with
SPORT/DPORT without setting SRC/DST IP. It applies non-RSS processing of
the received packets. In case of indirect RSS action, it will match the
MLX5_RSS_HASH_NONE pre-created TIR.

Fixes: b1d63d829378 ("net/mlx5: support RSS on src or dst fields only")
Fixes: 4a78c88e3bae ("net/mlx5: fix Verbs flow tunnel")
Cc: stable@dpdk.org
Signed-off-by: Lior Margalit <lmargalit@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
2 years agonet/mlx5: fix mirror flow split with L3 encapsulation
Jiawei Wang [Mon, 26 Jul 2021 06:22:33 +0000 (09:22 +0300)]
net/mlx5: fix mirror flow split with L3 encapsulation

Due to hardware limitations, the decap action (such as
VXLAN/NVGRE/RAW decap) can't follow the sample action in the
same flow, to keep the original action order of sample and decap
actions the flow was internally split into two subflows by PMD,
the sample action was moved into prefix subflow in the original table,
and decap action was moved into suffix subflow in the new table.

There is a specific combination of raw decap and raw encap actions
to specify "L3 encapsulation" packet transformation - raw decap action
to remove L2 header and raw encap to add the tunnel header.
This specific L3 encapsulation is encoded as a single packet reformat
hardware transaction and is supported by hardware after sample
action (no hardware limitations for packet reformat).

The "L3 encapsulation" with mirror actions in the same flow was not handled
correctly in the previous commit.
The patch checks whether the decap action is part of "L3 encapsulation"
and does not move the decap action into suffix subflow for the case.

Fixes: cafd87f62a06 ("net/mlx5: fix VLAN push/pop and decap actions with mirror")
Cc: stable@dpdk.org
Signed-off-by: Jiawei Wang <jiaweiw@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
2 years agonet/mlx5: fix queue leaking in hairpin auto bind check
Bing Zhao [Sat, 24 Jul 2021 13:27:11 +0000 (16:27 +0300)]
net/mlx5: fix queue leaking in hairpin auto bind check

During the start up stage, the hairpin auto bind was executed for
each port. All the Tx and Rx queues configured for this port should
be checked to confirm if the auto bind of hairpin is needed.
1. The queue is hairpin queue.
2. The peer port is the same one and the peer queue should also be
   with hairpin type.
3. The manual bind attribute is not set for this queue.

If the queue is not a hairpin queue or it doesn't need to be bound
automatically, the reference count should be decreased by 1 since
the count was increased when calling the mlx5_*xq_get().
When the peer port is not the same, it means that no auto bind is
supported and the mlx5_*xq_release() was missed in the current
implementation.

By calling the release function before continue, the count is
correct when calling the device close.

Fixes: aa8bea0e3455 ("net/mlx5: add conditional hairpin auto bind")
Cc: stable@dpdk.org
Signed-off-by: Bing Zhao <bingz@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
2 years agonet/mlx5: fix representor interrupt handler
Gregory Etelson [Tue, 20 Jul 2021 15:38:19 +0000 (18:38 +0300)]
net/mlx5: fix representor interrupt handler

In mlx5 PMD the PCI device interrupt vector was used by Uplink
representor exclusively and other VF representors did not support
interrupt mode.
All the VFs and Uplink representors are separate ethernet devices
and must have dedicated interrupt vectors.
The fix provides each representor with a dedicated interrupt
vector.

Fixes: 5882bde88da2 ("net/mlx5: fix representor interrupts handler")
Cc: stable@dpdk.org
Signed-off-by: Gregory Etelson <getelson@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
2 years agonet/iavf: relax RSS virtual channel commands
Alvin Zhang [Mon, 26 Jul 2021 09:17:24 +0000 (17:17 +0800)]
net/iavf: relax RSS virtual channel commands

Kernel PF may not respond to virtual channel commands
VIRTCHNL_OP_GET_RSS_HENA_CAPS and VIRTCHNL_OP_SET_RSS_HENA, which
will cause VF to fail to start.

RSS offload type configuration is not a necessary feature for VF,
so in order to improve VF compatibility, in this patch the PMD will
ignore the error result of above two commands and will print warnings
instead.

Fixes: 5a038d19962d ("net/iavf: fix RSS configuration on i40e VF")
Cc: stable@dpdk.org
Signed-off-by: Alvin Zhang <alvinx.zhang@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
2 years agonet/iavf: fix Tx threshold check
Xiaoyun Li [Thu, 22 Jul 2021 07:56:20 +0000 (15:56 +0800)]
net/iavf: fix Tx threshold check

Function check_tx_thresh is called with wrong parameter. If the
check fails, tx_queue_setup should return error not keep going.
This patch fixes above issues.

Fixes: 69dd4c3d0898 ("net/avf: enable queue and device")
Cc: stable@dpdk.org
Signed-off-by: Xiaoyun Li <xiaoyun.li@intel.com>
Acked-by: Beilei Xing <beilei.xing@intel.com>
2 years agonet/virtio: fix default duplex mode
Chenbo Xia [Tue, 27 Jul 2021 05:14:41 +0000 (13:14 +0800)]
net/virtio: fix default duplex mode

When virtio front-end initializes, the duplex mode should be set
unknown before reading any duplex mode information from configuration
space. This patch fixes the issue that duplex mode is by default set
to zero, which equals ETH_LINK_HALF_DUPLEX. This will lead to duplex
mode being half duplex when front-end does not have the feature
named VIRTIO_NET_F_SPEED_DUPLEX.

Fixes: 1357b4b36246 ("net/virtio: support Virtio link speed feature")
Cc: stable@dpdk.org
Signed-off-by: Chenbo Xia <chenbo.xia@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
2 years agonet/virtio: fix interrupt handle leak
Gaoxiang Liu [Mon, 26 Jul 2021 14:42:05 +0000 (22:42 +0800)]
net/virtio: fix interrupt handle leak

Free memory of interrupt handle in virtio_user_dev_uninit() to
avoid memory leak.
when virtio user dev closes, memory of interrupt handle is not freed
that is allocated in virtio_user_fill_intr_handle().

Fixes: 3d4fb6fd2505 ("net/virtio-user: support Rx interrupt")
Cc: stable@dpdk.org
Signed-off-by: Gaoxiang Liu <liugaoxiang@huawei.com>
Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
2 years agovhost: fix crash on reconnect
Maxime Coquelin [Mon, 26 Jul 2021 07:58:14 +0000 (09:58 +0200)]
vhost: fix crash on reconnect

When the vhost-user frontend like Virtio-user tries to
reconnect to the restarted Vhost backend, the Vhost backend
segfaults when multiqueue is enabled.

This is caused by VHOST_USER_GET_VRING_BASE being called for
a virtqueue that has not been created before, causing a NULL
pointer dereferencing.

This patch adds the VHOST_USER_GET_VRING_BASE requests to
the list of requests that trigger queue pair allocations.

Fixes: 160cbc815b41 ("vhost: remove a hack on queue allocation")
Cc: stable@dpdk.org
Reported-by: Yinan Wang <yinan.wang@intel.com>
Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Tested-by: Yinan Wang <yinan.wang@intel.com>
Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
2 years agonet/virtio: report maximum MTU in device info
Ivan Ilchenko [Wed, 21 Jul 2021 09:22:25 +0000 (12:22 +0300)]
net/virtio: report maximum MTU in device info

Fix the driver to report maximum MTU obtained from config if
VIRTIO_NET_F_MTU is supported or calculated based on maximum
Rx packet length.

Fixes: ad97ceece12c ("ethdev: add min/max MTU to device info")
Cc: stable@dpdk.org
Signed-off-by: Ivan Ilchenko <ivan.ilchenko@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
2 years agoversion: 21.08-rc2
Thomas Monjalon [Sat, 24 Jul 2021 13:22:43 +0000 (15:22 +0200)]
version: 21.08-rc2

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
2 years agoapp/testpmd: send failure logs to stderr
Andrew Rybchenko [Thu, 17 Jun 2021 14:20:25 +0000 (17:20 +0300)]
app/testpmd: send failure logs to stderr

Running with stdout suppressed or redirected for further processing
is very confusing in the case of errors. Fix it by logging errors and
warnings to stderr.

Since lines with log messages are touched anyway concatenate split
format strings to make it easier to search using grep.

Fix indent of format string arguments.

Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Acked-by: Xiaoyun Li <xiaoyun.li@intel.com>
2 years agoapp/testpmd: remove most uses of internal ethdev array
Paulis Gributs [Thu, 15 Jul 2021 13:20:15 +0000 (13:20 +0000)]
app/testpmd: remove most uses of internal ethdev array

This patch removes most uses of the global variable rte_eth_devices
from testpmd. This was done to avoid using the object directly which
applications should not do.

Most uses have been replaced with standard function calls, however
the use of it in the show_macs function could not be replaced as no
function call exists to get all mac addresses of a given port.

Signed-off-by: Paulis Gributs <paulis.gributs@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Xiaoyun Li <xiaoyun.li@intel.com>
2 years agoapp/testpmd: fix MAC address after port reset
Yuying Zhang [Wed, 14 Jul 2021 02:20:27 +0000 (02:20 +0000)]
app/testpmd: fix MAC address after port reset

MAC address of each port in global variable ports hasn't been updated
after resetting. It was the initial one after resetting VF MAC address.
This patch gets correct port MAC address when starting port.

Fixes: a5279d25616d ("app/testpmd: check status of getting MAC address")
Cc: stable@dpdk.org
Signed-off-by: Yuying Zhang <yuying.zhang@intel.com>
Acked-by: Aman Deep Singh <aman.deep.singh@intel.com>
Acked-by: Xiaoyun Li <xiaoyun.li@intel.com>
2 years agoapp/testpmd: fix help string for port reset
Ferruh Yigit [Fri, 23 Jul 2021 12:24:19 +0000 (13:24 +0100)]
app/testpmd: fix help string for port reset

Command help string is missing 'reset' keyword,
although description has it. Adding it.

Fixes: 97f1e196799f ("app/testpmd: add port reset command")
Cc: stable@dpdk.org
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
2 years agosched: rework configuration failure handling
Huisong Li [Fri, 23 Apr 2021 11:01:12 +0000 (19:01 +0800)]
sched: rework configuration failure handling

Currently, rte_sched_free_memory() is called multiple times by the
exception handling code in rte_sched_subport_config() and
rte_sched_pipe_config().

This patch optimizes them into a unified outlet to free memory.

Fixes: ac6fcb841b0f ("sched: update subport rate dynamically")
Fixes: 34a90f86657c ("sched: modify pipe functions for config flexibility")
Fixes: ce7c4fd7c2ac ("sched: add pipe config to subport level")
Cc: stable@dpdk.org
Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2 years agosched: fix profile allocation failure handling
Huisong Li [Fri, 23 Apr 2021 11:01:11 +0000 (19:01 +0800)]
sched: fix profile allocation failure handling

This patch fixes return value judgment when allocate memory to store the
subport profile, and releases memory of 'rte_sched_port' if code fails to
apply for this memory.

Fixes: 0ea4c6afcaf1 ("sched: add subport profile table")
Cc: stable@dpdk.org
Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2 years agopower: check frequencies count before filling array
Richael Zhuang [Fri, 23 Jul 2021 02:22:42 +0000 (10:22 +0800)]
power: check frequencies count before filling array

The freqs array size is RTE_MAX_LCORE_FREQS. Before filling the
array with num_freqs elements, restrict the total num to
RTE_MAX_LCORE_FREQS. This fix aims to fix the coverity scan issue
like:
Overrunning array "pi->freqs" of 256 bytes by passing it to a
function which accesses it at byte offset 464.

Coverity issue: 371913
Fixes: ef1cc88f1837 ("power: support cppc_cpufreq driver")
Cc: stable@dpdk.org
Signed-off-by: Richael Zhuang <richael.zhuang@arm.com>
Acked-by: David Hunt <david.hunt@intel.com>
2 years agoeal: fix argument in 32-bit safe BSF function
Stephen Hemminger [Fri, 23 Jul 2021 15:45:46 +0000 (08:45 -0700)]
eal: fix argument in 32-bit safe BSF function

The first argument to rte_bsf32_safe was incorrectly declared as
a 64 bit value. The code only works on 32 bit values and the underlying
function rte_bsf32 only accepts 32 bit values. This was a mistake
introduced when the safe version was added and probably cause
by copy/paste from the 64 bit version.

The bug passed silently under the radar until some other code was
built with -Wall and -Wextra in C++ and C++ complains about the
missing cast.

Yes, this is a API signature change, but the original code was wrong.
It is an inline so not an ABI change.

Fixes: 4e261f551986 ("eal: add 64-bit bsf and 32-bit safe bsf functions")
Cc: stable@dpdk.org
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
2 years agonet/sfc: improve logging in MAE backend of flow API
Ivan Malov [Wed, 21 Jul 2021 04:15:05 +0000 (07:15 +0300)]
net/sfc: improve logging in MAE backend of flow API

Errors detected during parsing of pattern items and actions
are reflected by setting RTE error, but the name of the bad
element is not disclosed, thus leaving the user to join the
dots themselves. Adjust the code to log missing information.

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
2 years agonet/sfc: extend logging in MAE backend of flow API
Ivan Malov [Wed, 21 Jul 2021 04:15:04 +0000 (07:15 +0300)]
net/sfc: extend logging in MAE backend of flow API

Extra log statements will provide more details to the user
in the case of errors discovered in the pattern or actions.

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
2 years agonet/sfc: add xstats for Rx/Tx doorbells
Ivan Ilchenko [Fri, 23 Jul 2021 13:15:14 +0000 (16:15 +0300)]
net/sfc: add xstats for Rx/Tx doorbells

Rx/Tx doorbells statistics are collected in software and
available per queue. These stats are useful for performance
investigation.

Signed-off-by: Ivan Ilchenko <ivan.ilchenko@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
2 years agonet/sfc: prepare to add more xstats
Ivan Ilchenko [Fri, 23 Jul 2021 13:15:13 +0000 (16:15 +0300)]
net/sfc: prepare to add more xstats

Move getting MAC stats code that involves locking to separate functions
to simplify addition of new xstats.

Signed-off-by: Ivan Ilchenko <ivan.ilchenko@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
2 years agonet/sfc: simplify getting xstats count
Ivan Ilchenko [Fri, 23 Jul 2021 13:15:12 +0000 (16:15 +0300)]
net/sfc: simplify getting xstats count

There is no point to recalculate number of available xstats on
each request. The number is calculated once on device start
and may be returned on subsequent calls.

Signed-off-by: Ivan Ilchenko <ivan.ilchenko@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
2 years agonet/sfc: fix MAC stats update for stopped device
Ivan Ilchenko [Fri, 23 Jul 2021 13:15:11 +0000 (16:15 +0300)]
net/sfc: fix MAC stats update for stopped device

Return the latest stats snapshot in stopped state
instead of returning an error.

Fixes: 1caab2f1e68 ("net/sfc: add basic statistics")
Cc: stable@dpdk.org
Signed-off-by: Ivan Ilchenko <ivan.ilchenko@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
2 years agonet/sfc: fix xstats query by unsorted list of IDs
Ivan Ilchenko [Fri, 23 Jul 2021 13:15:10 +0000 (16:15 +0300)]
net/sfc: fix xstats query by unsorted list of IDs

Device may support only some MAC stats. Add mapping from ids to subset
of supported MAC stats for each port.

Fixes: 73280c1e4ff ("net/sfc: support xstats retrieval by ID")
Cc: stable@dpdk.org
Signed-off-by: Ivan Ilchenko <ivan.ilchenko@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
2 years agonet/sfc: fix xstats query by ID according to ethdev
Ivan Ilchenko [Fri, 23 Jul 2021 13:15:09 +0000 (16:15 +0300)]
net/sfc: fix xstats query by ID according to ethdev

Fix xstats by ID callbacks according to ethdev usage.
Handle combinations of input arguments that are required by ethdev
and sanity check and reject other combinations on callback entry.

Fixes: 73280c1e4ff ("net/sfc: support xstats retrieval by ID")
Cc: stable@dpdk.org
Signed-off-by: Ivan Ilchenko <ivan.ilchenko@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
2 years agonet/sfc: fix reading adapter state without locking
Ivan Ilchenko [Fri, 23 Jul 2021 13:15:06 +0000 (16:15 +0300)]
net/sfc: fix reading adapter state without locking

Update MAC stats function reads adapter state with MAC stats locking
but without adapter locking. Add adapter locking before calling this
function and remove MAC stats locking since there's no point to have
it together with adapter locking. The second place MAC stats locking
is used is MAC stats reset function. It's called with adapter being
already locked so there's no point to use MAC stats locking anymore.

Fixes: 1caab2f1e68 ("net/sfc: add basic statistics")
Cc: stable@dpdk.org
Signed-off-by: Ivan Ilchenko <ivan.ilchenko@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
2 years agonet/sfc: fix MAC stats lock in xstats query by ID
Ivan Ilchenko [Fri, 23 Jul 2021 13:15:05 +0000 (16:15 +0300)]
net/sfc: fix MAC stats lock in xstats query by ID

Add MAC stats lock in xstats_get_by_id() callback before reading
number of supported MAC stats.

Fixes: 73280c1e4ff ("net/sfc: support xstats retrieval by ID")
Cc: stable@dpdk.org
Signed-off-by: Ivan Ilchenko <ivan.ilchenko@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
2 years agoexamples/vhost: handle memory hotplug for async vhost
Cheng Jiang [Fri, 23 Jul 2021 08:09:37 +0000 (08:09 +0000)]
examples/vhost: handle memory hotplug for async vhost

When the guest memory is hotplugged, the vhost application which
enables DMA acceleration must stop DMA transfers before the vhost
re-maps the guest memory.

To accomplish that, we need to do these changes in the vhost sample:
1. add inflight packets count.
2. add vring_state_changed() callback.
3. add inflight packets clear process in destroy_device() and
vring_state_changed().

Signed-off-by: Cheng Jiang <cheng1.jiang@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
2 years agovhost: handle memory hotplug for async vhost
Jiayu Hu [Fri, 23 Jul 2021 08:09:36 +0000 (08:09 +0000)]
vhost: handle memory hotplug for async vhost

When the guest memory is hotplugged, the vhost application which
enables DMA acceleration must stop DMA transfers before the vhost
re-maps the guest memory.

This patch is to notify the vhost application of stopping DMA
transfers.

Signed-off-by: Jiayu Hu <jiayu.hu@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
2 years agovhost: add unsafe async API to clear packets
Cheng Jiang [Fri, 23 Jul 2021 08:09:35 +0000 (08:09 +0000)]
vhost: add unsafe async API to clear packets

Applications need to stop DMA transfers and finish all the inflight
packets when in VM memory hot-plug case and async vhost is used. This
patch is to provide an unsafe API to clear inflight packets which
are submitted to DMA engine in vhost async data path. Update the
program guide and release notes for virtqueue inflight packets clear
API in vhost lib.

Signed-off-by: Cheng Jiang <cheng1.jiang@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
2 years agovhost: fix async callbacks return type
Cheng Jiang [Fri, 23 Jul 2021 08:09:34 +0000 (08:09 +0000)]
vhost: fix async callbacks return type

The async vhost callback ops should return negative value when there
are something wrong in the callback, so the return type should be
changed into int32_t. The issue in vhost example is also fixed.

Fixes: cd6760da1076 ("vhost: introduce async enqueue for split ring")
Fixes: 819a71685826 ("vhost: fix async callback return type")
Fixes: 6b3c81db8bb7 ("vhost: simplify async copy completion")
Fixes: abec60e7115d ("examples/vhost: support vhost async data path")
Fixes: 6e9a9d2a02ae ("examples/vhost: fix ioat dependency")
Fixes: 873e8dad6f49 ("vhost: support packed ring in async datapath")
Cc: stable@dpdk.org
Signed-off-by: Cheng Jiang <cheng1.jiang@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
2 years agodoc: remove SDK info from DPAA2 drivers guides
Hemant Agrawal [Mon, 19 Jul 2021 13:59:17 +0000 (19:29 +0530)]
doc: remove SDK info from DPAA2 drivers guides

The prerequisite info is already present in the platform guide.
No need to repeat it in individual dev guides.

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
2 years agonet/dpaa2: add some parameter validations
Vanshika Shukla [Mon, 19 Jul 2021 13:59:16 +0000 (19:29 +0530)]
net/dpaa2: add some parameter validations

This patch adds validation of the port id for
rte_pmd_dpaa2_set_custom_hash API to check if the
port is a valid DPAA2 port. Also handles some
edge cases in the rte_pmd_dpaa2_mux_flow_create API.

Signed-off-by: Vanshika Shukla <vanshika.shukla@nxp.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
2 years agonet/dpaa2: add per-thread initialization API
Nipun Gupta [Mon, 19 Jul 2021 13:59:15 +0000 (19:29 +0530)]
net/dpaa2: add per-thread initialization API

DPAA2 hardware require a hardware portal context.
If a thread doing DPAA2 i/o do not have portal, it will
allocate it on run-time. This may cause a delay in the
datapath at run-time. To avoid it, it is better to allocate
a hw context portal at the start of thread expected to do
i/o with DPAA2 hardware.

This patch makes necessary changes for the same and creates
a pmd API to allocate a hw context portal for a thread.

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
2 years agonet/dpaa: add check for parsing default Rx queue
Rohit Raj [Mon, 19 Jul 2021 13:59:14 +0000 (19:29 +0530)]
net/dpaa: add check for parsing default Rx queue

Add check for the PCD queue from the kernel interface
for default and error queues.

Signed-off-by: Rohit Raj <rohit.raj@nxp.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
2 years agobus/dpaa: reduce thread ID syscall usage
Hemant Agrawal [Mon, 19 Jul 2021 13:59:13 +0000 (19:29 +0530)]
bus/dpaa: reduce thread ID syscall usage

Reuse DPDK rte_gettid instead of syscall.
It will help to reduce the dpaa portal allocation time.

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
2 years agonet/dpaa: fix headroom in VSP case
Nipun Gupta [Mon, 19 Jul 2021 13:59:12 +0000 (19:29 +0530)]
net/dpaa: fix headroom in VSP case

This patch fixes providing the correct headroom size when
VSP is enabled.

Fixes: e4abd4ff183c ("net/dpaa: support virtual storage profile")
Cc: stable@dpdk.org
Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
2 years agobus/dpaa: fix freeing in FMAN interface destructor
Hemant Agrawal [Mon, 19 Jul 2021 13:59:11 +0000 (19:29 +0530)]
bus/dpaa: fix freeing in FMAN interface destructor

if was allocated with rte_malloc, free shall be equivalent.

Fixes: 4762b3d419c3 ("bus/dpaa: delay fman device list to bus probe")
Cc: stable@dpdk.org
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
2 years agomaintainers: update for ena
Michal Krawczyk [Fri, 23 Jul 2021 10:43:37 +0000 (12:43 +0200)]
maintainers: update for ena

Remove Guy Tzalik as the driver's maintainer and add Shai Brandes who
will now be another maintainer of the ENA DPDK driver.

Signed-off-by: Michal Krawczyk <mk@semihalf.com>
2 years agonet/ena: update version to 2.4.0
Michal Krawczyk [Fri, 23 Jul 2021 10:24:54 +0000 (12:24 +0200)]
net/ena: update version to 2.4.0

This version update contains:
  * Rx interrupts feature,
  * Support for the RSS hash function reconfiguration,
  * Small rework of the works,
  * Reset trigger on Tx path fix.

Signed-off-by: Michal Krawczyk <mk@semihalf.com>
2 years agonet/ena: rework RSS configuration
Michal Krawczyk [Fri, 23 Jul 2021 10:24:53 +0000 (12:24 +0200)]
net/ena: rework RSS configuration

Allow user to specify his own hash key and hash ctrl if the
device is supporting that. HW interprets the key in reverse byte order,
so the PMD reorders the key before passing it to the ena_com layer.

Default key is being set in random matter each time the device is being
initialized.

Moreover, make minor adjustments for reta size setting in terms
of returning error values.

RSS code was moved to ena_rss.c file to improve readability.

Signed-off-by: Michal Krawczyk <mk@semihalf.com>
Reviewed-by: Shai Brandes <shaibran@amazon.com>
Reviewed-by: Shay Agroskin <shayagr@amazon.com>
Reviewed-by: Amit Bernstein <amitbern@amazon.com>
2 years agonet/ena: support Rx interrupt
Michal Krawczyk [Fri, 23 Jul 2021 10:24:52 +0000 (12:24 +0200)]
net/ena: support Rx interrupt

In order to support asynchronous Rx in the applications, the driver has
to configure the event file descriptors and configure the HW.

This patch configures appropriate data structures for the rte_ethdev
layer, adds .rx_queue_intr_enable and .rx_queue_intr_disable API
handlers, and configures IO queues to work in the interrupt mode, if it
was requested by the application.

Signed-off-by: Michal Krawczyk <mk@semihalf.com>
Reviewed-by: Artur Rojek <ar@semihalf.com>
Reviewed-by: Igor Chauskin <igorch@amazon.com>
Reviewed-by: Shai Brandes <shaibran@amazon.com>
Reviewed-by: Shay Agroskin <shayagr@amazon.com>
2 years agonet/ena: trigger reset on Tx prepare failure
Michal Krawczyk [Fri, 23 Jul 2021 10:24:51 +0000 (12:24 +0200)]
net/ena: trigger reset on Tx prepare failure

If the prepare function failed, then it means the descriptors are in the
invalid state.

This condition now triggers the reset, which should be further handled
by the application.

To notify the application about prepare function failure, the error log
was added. In general, it should never fail in normal conditions, as the
Tx function checks for the available space in the Tx ring before the
preparation even starts.

Fixes: 2081d5e2e92d ("net/ena: add reset routine")
Cc: stable@dpdk.org
Signed-off-by: Michal Krawczyk <mk@semihalf.com>
Reviewed-by: Shai Brandes <shaibran@amazon.com>
Reviewed-by: Shay Agroskin <shayagr@amazon.com>
2 years agonet/ena: use common debug options
Michal Krawczyk [Fri, 23 Jul 2021 10:24:50 +0000 (12:24 +0200)]
net/ena: use common debug options

ENA defined its own logger flags for Tx and Rx, but they weren't
technically used anywhere. Those data path loggers weren't used anywhere
after the definition.

This commit uses the generic RTE_ETHDEV_DEBUG_RX and RTE_ETHDEV_DEBUG_TX
flags to define PMD_TX_LOG and PMD_RX_LOG which are now being used on
the data path. The PMD_TX_FREE_LOG was removed, as it has no usage in
the current version of the driver.

RTE_ETH_DEBUG_[TR]X now wraps extra checks for the driver state in the
IO path - this saves extra conditionals on the hot path.

ena_com logger is no longer optional (previously it had to be explicitly
enabled by defining this flag: RTE_LIBRTE_ENA_COM_DEBUG). Having this
logger optional makes tracing of ena_com errors much harder.
Due to ena_com design, it's impossible to separate IO path logs
from the management path logs, so for now they will be always enabled.

Default levels for the affected loggers were modified. Hot path loggers
are initialized with the default level of DEBUG instead of NOTICE, as
they have to be explicitly enabled. ena_com logging level was reduced
from NOTICE to WARNING - as it's no longer optional, the driver should
report just a warnings in the ena_com layer.

Signed-off-by: Michal Krawczyk <mk@semihalf.com>
Reviewed-by: Igor Chauskin <igorch@amazon.com>
Reviewed-by: Shai Brandes <shaibran@amazon.com>
2 years agonet/ena: adjust logs
Michal Krawczyk [Fri, 23 Jul 2021 10:24:49 +0000 (12:24 +0200)]
net/ena: adjust logs

ENA logs were not consistent regarding the new line character. Few of
them were relying on the new line character added by the PMD_*_LOG
macros, but most were adding the new line character by themselves. It
was causing ENA logs to add extra empty line after almost each log.

To unify this behavior, the missing new line characters were added to
the driver logs, and they were removed from the logging macros. After
this patch, every ENA log message should add '\n' at the end.

Moreover, the logging messages were adjusted in terms of wording
(removed unnecessary abbreviations), capitalizing of the words (start
sentences with capital letters, and use 'Tx/Rx' instead of 'tx/TX' etc.

Some of the logs were rephrased to make them more clear for the reader.

Signed-off-by: Michal Krawczyk <mk@semihalf.com>
Reviewed-by: Igor Chauskin <igorch@amazon.com>
Reviewed-by: Shai Brandes <shaibran@amazon.com>
2 years agonet/txgbe: fix VLAN filter setting for VF
Jiawen Wu [Wed, 14 Jul 2021 06:05:48 +0000 (14:05 +0800)]
net/txgbe: fix VLAN filter setting for VF

Fix the function call error on VLAN filter table address setting for VF.

Fixes: aa1ae7941e71 ("net/txgbe: support VF VLAN")
Cc: stable@dpdk.org
Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com>
2 years agonet/hinic: fix MTU consistency with firmware
Guoyang Zhou [Fri, 16 Jul 2021 09:54:30 +0000 (17:54 +0800)]
net/hinic: fix MTU consistency with firmware

The configuration of MTU is inconsistent in the driver and
firmware when the port is stopped, started and reconfigured.
Before, HINIC_MAX_JUMBO_FRAME_SIZE include VLAN tag, but when
frame and pktlen are converted to each other do not include
VLAN tag. And port_mtu_set function will use HINIC_MAX_JUMBO_FRAME_SIZE
to calculate eth_overhead, so MTU will be inconsistent in the driver and
firmware.

Fixes: e542ab51ab27 ("net/hinic: fix jumbo frame flag condition for MTU set")
Cc: stable@dpdk.org
Signed-off-by: Guoyang Zhou <zhouguoyang@huawei.com>
2 years agonet/hinic/base: fix LRO
Guoyang Zhou [Fri, 16 Jul 2021 09:54:29 +0000 (17:54 +0800)]
net/hinic/base: fix LRO

The Rx queue must config as ceq disables, and must set MSI-X
state disabled. Otherwise when LRO is enables, there will be
problems with packet aggregation because of firmware.

Fixes: 9d02f40d6503 ("net/hinic: fix LRO")
Cc: stable@dpdk.org
Signed-off-by: Guoyang Zhou <zhouguoyang@huawei.com>
2 years agonet/hinic: increase protection of the VLAN
Guoyang Zhou [Fri, 16 Jul 2021 09:54:28 +0000 (17:54 +0800)]
net/hinic: increase protection of the VLAN

If the VLAN id 0 is deleted for hinic, all packets without
VLAN will be discarded when the VLAN filter is turned on.

Fixes: 50ce3e7aec8f ("ethdev: fix VLAN offloads set if no relative capabilities")
Cc: stable@dpdk.org
Signed-off-by: Guoyang Zhou <zhouguoyang@huawei.com>
2 years agonet/hns3: disable PFC if not configured
Huisong Li [Sat, 17 Jul 2021 01:04:19 +0000 (09:04 +0800)]
net/hns3: disable PFC if not configured

If "dcb_capability_en" in "data->dev_conf" delivered from the dev_configure
does not have the ETH_DCB_PFC_SUPPORT flag, the user wants to disable PFC,
and only enable ETS. Therefore, this patch supports the function of
disabling PFC by the field. In addition, this patch updates
"current_fc_status" of the driver based on the flow control mode requested
by user so as to enable the flow control mode in multi-TC scenarios.

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
2 years agonet/hns3: fix Tx prepare after stop
Huisong Li [Sat, 17 Jul 2021 02:02:56 +0000 (10:02 +0800)]
net/hns3: fix Tx prepare after stop

In some special scenarios, such as TSO scenarios, the user layer may need
to call the tx_pkt_prepare(), and then call tx_pkt_burst() to send packets.
If the return value of tx_pkt_parepare() isn't equal to the numbers of
packets requested to send, warning message may be printed at the user
layer. Currently, tx_pkt_prepare() is assigned to dummy function when
dev_stop() is called in hns3 PMD. At this moment, if user layer continues
to send packets, the warning message will always be printed. So this patch
modifies the address to NULL.

Fixes: 2790c6464725 ("net/hns3: support device reset")
Cc: stable@dpdk.org
Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
2 years agonet/hns3: fix flow rule list in multi-process
Chengwen Feng [Sat, 17 Jul 2021 02:02:55 +0000 (10:02 +0800)]
net/hns3: fix flow rule list in multi-process

Currently, hns3 driver saves rte_flow list into the
rte_eth_dev.process_private field, it may cause following problem:
The FDIR/RSS rules cannot be managed in a unified manner because
the management structure is not visible between processes.

This patch fixes it by moving rte_flow list to struct hns3_hw which is
visible between processes.

Fixes: fcba820d9b9e ("net/hns3: support flow director")
Fixes: c37ca66f2b27 ("net/hns3: support RSS")
Cc: stable@dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
2 years agonet/hns3: move speed auto-negotiation warning
Huisong Li [Sat, 17 Jul 2021 02:02:54 +0000 (10:02 +0800)]
net/hns3: move speed auto-negotiation warning

PF driver prints a warning on device that does not support auto-negotiation
when user does not configure "link_speeds" (default 0), which means
auto-negotiation. Currently, this warning information is printed in
dev_configure stage and a success is returned. Perhaps the user may call
dev_configure multiple times before dev_start for some reason or purpose.
In this case, this message may be printed multiple times. So this patch
moves it to dev_start stage.

Fixes: cfc9fe48c4d4 ("net/hns3: move link speeds check to configure")
Cc: stable@dpdk.org
Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
2 years agonet/hns3: remove duplicate compile-time check
Chengchang Tang [Sat, 17 Jul 2021 02:02:53 +0000 (10:02 +0800)]
net/hns3: remove duplicate compile-time check

This patch delete duplicate compile-time check.

Fixes: cb12e988f35f ("net/hns3: add compile-time verification on Rx vector")
Cc: stable@dpdk.org
Signed-off-by: Chengchang Tang <tangchengchang@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
2 years agonet/hns3: fix timing of clearing interrupt source
Hongbo Zheng [Sat, 17 Jul 2021 02:02:52 +0000 (10:02 +0800)]
net/hns3: fix timing of clearing interrupt source

Currently, the PF/VF does not clear the interrupt source immediately
after receiving the interrupt. As a result, if the second interrupt
task is triggered when processing the first interrupt task, clearing
the interrupt source before exiting will clear the interrupt sources
of the two tasks at the same time. As a result, no interrupt is
triggered for the second task.

Clearing interrupt source immediately after checking event cause
ensures that:
1. Even if two interrupt tasks are triggered at the same time, they can
be processed.
2. If the second task is triggered during the processing of the first
task and the interrupt source is not cleared, the interrupt is reported
after vector0 is enabled.

Fixes: a5475d61fa34 ("net/hns3: support VF")
Fixes: 3988ab0eee52 ("net/hns3: add abnormal interrupt process")
Cc: stable@dpdk.org
Signed-off-by: Hongbo Zheng <zhenghongbo3@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>