dpdk.git
2 years agocrypto/cnxk: use unique cache line per inst
Anoob Joseph [Mon, 31 Jan 2022 12:30:28 +0000 (18:00 +0530)]
crypto/cnxk: use unique cache line per inst

CPT inflight request is used to track a request that is enqueued to
cryptodev. Having more than one inst use the same cacheline can result
in serialization of CPT result memory writes causing perf degradations.
Align inflight request to ROC cache line to ensure only one result would
be written per cache line..

Signed-off-by: Anoob Joseph <anoobj@marvell.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
2 years agocommon/cnxk: add ROC cache line size constant
Anoob Joseph [Mon, 31 Jan 2022 12:30:27 +0000 (18:00 +0530)]
common/cnxk: add ROC cache line size constant

Add ROC cache line size constant.

Signed-off-by: Anoob Joseph <anoobj@marvell.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
2 years agocrypto/cnxk: support ESN and anti-replay
Tejasree Kondoj [Mon, 31 Jan 2022 12:30:26 +0000 (18:00 +0530)]
crypto/cnxk: support ESN and anti-replay

Added lookaside IPsec ESN and anti-replay support
through security session update.

Signed-off-by: Tejasree Kondoj <ktejasree@marvell.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
2 years agocommon/cnxk: add err ctl in SA
Anoob Joseph [Mon, 31 Jan 2022 12:30:25 +0000 (18:00 +0530)]
common/cnxk: add err ctl in SA

Add err ctl field in SA context.

Signed-off-by: Anoob Joseph <anoobj@marvell.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
2 years agocompress/octeontx: fix null pointer dereference
Weiguo Li [Tue, 25 Jan 2022 14:33:15 +0000 (22:33 +0800)]
compress/octeontx: fix null pointer dereference

Check for memory allocation failure is added to avoid null
pointer dereference.

Fixes: c378f084d6e3 ("compress/octeontx: add device setup ops")
Cc: stable@dpdk.org
Signed-off-by: Weiguo Li <liwg06@foxmail.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
2 years agocrypto/qat: fix GEN4 AEAD job in raw data path
Kai Ji [Fri, 21 Jan 2022 10:38:30 +0000 (10:38 +0000)]
crypto/qat: fix GEN4 AEAD job in raw data path

This patch fix the cipher params configuration in AEAD job if
QAT GEN4 unified cipher slice(UCS) enabled.

Fixes: 328d690d2f60 ("crypto/qat: update raw data path")
Cc: stable@dpdk.org
Signed-off-by: Kai Ji <kai.ji@intel.com>
Acked-by: Fan Zhang <roy.fan.zhang@intel.com>
2 years agocrypto/ipsec_mb: fix buffer overrun
Pablo de Lara [Thu, 20 Jan 2022 17:04:55 +0000 (17:04 +0000)]
crypto/ipsec_mb: fix buffer overrun

Memory for ZUC cipher/auth key in session had to be expanded to 32 bytes,
instead of 16 bytes, when adding ZUC-256 support.
However, impact is low as this memory is part of a union
with bigger size than 32 bytes.

Coverity issue: 374374
Coverity issue: 374379
Fixes: 8c835018de84 ("crypto/ipsec_mb: support ZUC-256 for aesni_mb")
Cc: stable@dpdk.org
Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Ciara Power <ciara.power@intel.com>
2 years agocrypto/ipsec_mb: fix premature dereference
Piotr Bronowski [Sun, 16 Jan 2022 19:40:43 +0000 (19:40 +0000)]
crypto/ipsec_mb: fix premature dereference

This patch removes coverity defect CID 374380:
Null pointer dereferences  (REVERSE_INULL)

Coverity issue: CID 374380
Fixes: 918fd2f1466b ("crypto/ipsec_mb: move aesni_mb PMD")
Cc: stable@dpdk.org
Signed-off-by: Piotr Bronowski <piotrx.bronowski@intel.com>
2 years agotest/crypto: fix out-of-place SGL in raw datapath
Kai Ji [Fri, 7 Jan 2022 15:06:04 +0000 (15:06 +0000)]
test/crypto: fix out-of-place SGL in raw datapath

Fix out of place scatter gather list in sym raw datapath unit test.

Fixes: cd8166c28cd1 ("test/crypto: add raw API test for dpaax")
Cc: stable@dpdk.org
Signed-off-by: Kai Ji <kai.ji@intel.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
2 years agodoc: simplify baseband features matrix
Thomas Monjalon [Wed, 5 Jan 2022 17:40:15 +0000 (18:40 +0100)]
doc: simplify baseband features matrix

The "feature" BBDEV API is useless as all baseband drivers
must implement it by definition.

The non-implemented features should not be marked with "N".
Keeping them blank is clearer to read in the resulting matrix.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
2 years agocommon/qat: enable GEN4 b devices
Arek Kusztal [Tue, 28 Dec 2021 09:49:54 +0000 (09:49 +0000)]
common/qat: enable GEN4 b devices

This commit enables CPM2.0b devices in Intel QuickAssist
Technology PMD.

Signed-off-by: Arek Kusztal <arkadiuszx.kusztal@intel.com>
Acked-by: Fan Zhang <roy.fan.zhang@intel.com>
2 years agoexamples/ipsec-secgw: fix offload flag used for TSO IPv6
Radu Nicolau [Thu, 25 Nov 2021 13:03:54 +0000 (13:03 +0000)]
examples/ipsec-secgw: fix offload flag used for TSO IPv6

RTE_MBUF_F_TX_OUTER_IP_CKSUM should not be set for IPv6 packets.

Fixes: a7f32947a316 ("examples/ipsec-secgw: support TCP TSO")
Cc: stable@dpdk.org
Signed-off-by: Radu Nicolau <radu.nicolau@intel.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
2 years agoethdev: move driver interface functions to its own file
Ferruh Yigit [Fri, 11 Feb 2022 19:11:43 +0000 (19:11 +0000)]
ethdev: move driver interface functions to its own file

ethdev has two interfaces, one interface between applications and
library, these APIs are declared in the rte_ethdev.h public header.
Other interface is between drivers and library, these functions are
declared in ethdev_driver.h and marked as internal.

But all functions are defined in rte_ethdev.c file. This patch moves
functions for drivers to its own file, ethdev_driver.c for cleanup, no
functional change in functions.

Some public APIs and driver helpers call common internal functions,
which were mostly static since both were in same file. To be able to
move driver helpers, common functions are moved to ethdev_private.c.
(ethdev_private.c is used for functions that are internal to the library
and shared by multiple .c files in the ethdev library.)

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
2 years agoethdev: introduce generic dummy packet burst function
Ferruh Yigit [Fri, 11 Feb 2022 19:11:42 +0000 (19:11 +0000)]
ethdev: introduce generic dummy packet burst function

Multiple PMDs have dummy/noop Rx/Tx packet burst functions.

These dummy functions are very simple, introduce a common function in
the ethdev and update drivers to use it instead of each driver having
its own functions.

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
2 years agonet/ring: support promisc and allmulticast
Robert Sanford [Tue, 21 Dec 2021 19:57:29 +0000 (14:57 -0500)]
net/ring: support promisc and allmulticast

Add promiscuous_enable, promiscuous_disable, allmulticast_enable,
and allmulticast_disable API stubs.
This helps clean up errors in dpdk-test link_bonding_mode4_autotest.

Signed-off-by: Robert Sanford <rsanford@akamai.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2 years agonet/cnxk: avoid command copy from Tx queue
Pavan Nikhilesh [Thu, 10 Feb 2022 13:15:26 +0000 (18:45 +0530)]
net/cnxk: avoid command copy from Tx queue

Tx command is prepared based on offloads enabled and stored in
Tx queue structure at tx_queue_setup phase.
In fastpath the command is copied from Tx queue to LMT line for
all the packets.
Since, the command contents are mostly constants we can move the
command preparation to fastpath and avoid accessing Tx queue
memory.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
2 years agocommon/iavf: add session ID fields for L2TPv2
Jie Wang [Wed, 9 Feb 2022 09:38:55 +0000 (17:38 +0800)]
common/iavf: add session ID fields for L2TPv2

Add virtchnl fields session ID of L2TPv2 for AVF HASH.

Signed-off-by: Jie Wang <jie1x.wang@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
2 years agonet/iavf: initialize large VF setting at startup
Ghalem Boudour [Thu, 10 Feb 2022 10:49:14 +0000 (11:49 +0100)]
net/iavf: initialize large VF setting at startup

lv_enabled is used to remember if large VF setting is configured, but
its value is not initialized at startup. This can lead to a different
configuration regarding the initial configuration of the PF.
For example, a first start is done with 8 rx and 8 tx queues. Large VF
is not needed and reta size is 64.
A second start is done with 20 rx and tx queues. Large VF is required
and reta size is 256.
A third start is done with 2 rx and tx queues. Large VF is not needed
but reta size is 256 as the PF has been configured during the second
start.

In order to have a consistent behavior regarding reta size whatever
the configuration of the PF (may be changed by a previous boot) the
lv_enabled must be set properly at the init phase.

Signed-off-by: Ghalem Boudour <ghalem.boudour@6wind.com>
Signed-off-by: Thibaut Collet <thibaut.collet@6wind.com>
Reviewed-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Ting Xu <ting.xu@intel.com>
2 years agonet/hns3: dump flow control info
Min Hu (Connor) [Fri, 11 Feb 2022 04:49:30 +0000 (12:49 +0800)]
net/hns3: dump flow control info

This patch dumps flow control info such as flow control mode
for debug.

Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
2 years agonet/hns3: dump TM configuration info
Min Hu (Connor) [Fri, 11 Feb 2022 04:49:29 +0000 (12:49 +0800)]
net/hns3: dump TM configuration info

This patch dumps TM configuration info about shaper, port node, TC node,
queue node related info.

Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
2 years agonet/hns3: dump flow director basic info
Min Hu (Connor) [Fri, 11 Feb 2022 04:49:28 +0000 (12:49 +0800)]
net/hns3: dump flow director basic info

This patch dumps flow director basic info such rule numbers, hit counts
for debug.

Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
2 years agonet/hns3: dump VLAN configuration info
Min Hu (Connor) [Fri, 11 Feb 2022 04:49:27 +0000 (12:49 +0800)]
net/hns3: dump VLAN configuration info

This patch dump VLAN filter, strip related info and Pvid info for debug.

Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
2 years agonet/hns3: dump queue info
Min Hu (Connor) [Fri, 11 Feb 2022 04:49:26 +0000 (12:49 +0800)]
net/hns3: dump queue info

This patch dumps Rx/Tx queue info, such as queue numbers, queue enable
state for debug.

Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
2 years agonet/hns3: dump device MAC info
Min Hu (Connor) [Fri, 11 Feb 2022 04:49:25 +0000 (12:49 +0800)]
net/hns3: dump device MAC info

This patch dumps device MAC info which hns3 PMD private info offers.

Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
2 years agonet/hns3: dump device feature capability
Min Hu (Connor) [Fri, 11 Feb 2022 04:49:24 +0000 (12:49 +0800)]
net/hns3: dump device feature capability

Kunpeng 920 and Kunpeng 930 support different feature capability.
This patch dumps feature capability Current device supports.

Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
2 years agonet/hns3: dump device basic info
Min Hu (Connor) [Fri, 11 Feb 2022 04:49:23 +0000 (12:49 +0800)]
net/hns3: dump device basic info

This patch dumps device basic info such as device name, adapter state
for debug.

Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
2 years agodoc: update libxdp usage in af_xdp guide
Ciara Loftus [Fri, 11 Feb 2022 15:03:05 +0000 (15:03 +0000)]
doc: update libxdp usage in af_xdp guide

When libxdp is used, the LIBXDP_OBJECT_PATH environment variable must be
set to the location of where libxdp placed its bpf object files. This is
usually in /usr/local/lib/bpf or /usr/local/lib64/bpf. Failure to do so
will result in the PMD not initialising correctly as the bpf program is
not found. Document this requirement.

Also, mention that the following logs which are generated on application
launch can be ignored:

  libbpf: elf: skipping unrecognized data section(7) .xdp_run_config
  libbpf: elf: skipping unrecognized data section(8) xdp_metadata

Signed-off-by: Ciara Loftus <ciara.loftus@intel.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
2 years agoapp/testpmd: support GRE option flow item
Sean Zhang [Fri, 11 Feb 2022 01:45:29 +0000 (03:45 +0200)]
app/testpmd: support GRE option flow item

Add gre_option command for matching optional fields
(checksum/key/sequence) in GRE header. The item must follow gre item,
and the item does not change the flags in gre item, the application
should set the flags in gre item correspondingly.
Application can still use gre_key item 'gre_key value is xx' for key
matching, the effect is the same with using 'gre_option key is xx'.

The examples for gre_option are as follows:

To match on checksum field with value 0x11:
testpmd> ... pattern / eth / gre c_bit is 1 / gre_option checksum is
0x11 / end ..

To match on checksum field with value 0x11 and any value of key:
testpmd> ... pattern / eth / gre c_bit is 1 k_bit is 1 / gre_option
checksum is 0x11 / end ..

To match on checksum field with value 0x11 and no key field in packet:
testpmd> ... pattern / eth / gre c_bit is 1 k_bit is 0 / gre_option
checksum is 0x11 / end ..

The invalid patterns for gre_option are as follows:

testpmd> ... pattern / eth / gre / gre_option checksum is 0x11 / end ..
(c_bit in gre item not present)
testpmd> ... pattern / eth / gre c_bit is 0 / gre_option checksum is 0x11 /
end .. (c_bit is unset for gre item, but checksum is
specified by gre_option item)

Signed-off-by: Sean Zhang <xiazhang@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
2 years agoethdev: support GRE optional fields
Sean Zhang [Fri, 11 Feb 2022 01:45:28 +0000 (03:45 +0200)]
ethdev: support GRE optional fields

Add flow pattern items and header format for matching optional fields
(checksum/key/sequence) in GRE header. And the flags in gre item should
be correspondingly set with the new added items.

Signed-off-by: Sean Zhang <xiazhang@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
2 years agonet: add optional fields in GRE header
Sean Zhang [Fri, 11 Feb 2022 01:45:27 +0000 (03:45 +0200)]
net: add optional fields in GRE header

There are optional fields in GRE header(checksum/key/sequence), this
patch adds definition of structures of the optional fields.

Signed-off-by: Sean Zhang <xiazhang@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
2 years agonet/af_xdp: re-enable secondary process support
Ciara Loftus [Wed, 9 Feb 2022 09:48:08 +0000 (09:48 +0000)]
net/af_xdp: re-enable secondary process support

Secondary process support had been disabled for the AF_XDP PMD because
there was no logic in place to share the AF_XDP socket file descriptors
between the processes. This commit introduces this logic using the IPC
APIs.

Rx and Tx are disabled in the secondary process due to memory mapping of
the AF_XDP rings being assigned by the kernel in the primary process only.
However other operations including retrieval of stats are permitted.

Signed-off-by: Ciara Loftus <ciara.loftus@intel.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
2 years agonet/txgbe: fix KR auto-negotiation
Jiawen Wu [Wed, 9 Feb 2022 10:42:13 +0000 (18:42 +0800)]
net/txgbe: fix KR auto-negotiation

Fix failure to enter auto-negotiation mode on some firmware versions for
KR NICs.

Fixes: f611dada1af8 ("net/txgbe: update link setup process of backplane NICs")
Cc: stable@dpdk.org
Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com>
2 years agonet/txgbe: fix link up and down
Jiawen Wu [Wed, 9 Feb 2022 10:42:12 +0000 (18:42 +0800)]
net/txgbe: fix link up and down

Add hw->dev_start status in the flow of setting link up/down, to avoid
obtaining link status inconsistent with the settings.

Fixes: 12a653eb53e1 ("net/txgbe: fix link status when device stopped")
Cc: stable@dpdk.org
Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com>
2 years agonet/txgbe: support OEM customized LED
Jiawen Wu [Wed, 9 Feb 2022 10:42:10 +0000 (18:42 +0800)]
net/txgbe: support OEM customized LED

Support to configure LED in firmware. Driver commands firmware to turn
the LED on and off. And OEM customize their LED solutions in firmware.

Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com>
2 years agonet/ngbe: support OEM customized LED
Jiawen Wu [Wed, 9 Feb 2022 10:42:08 +0000 (18:42 +0800)]
net/ngbe: support OEM customized LED

Support to get OEM customized LED configuration information from firmware.
And driver needs to adjust the process of PHY setup link, based on this
LED configuration.

Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com>
2 years agonet/ngbe: support custom PHY interfaces
Jiawen Wu [Wed, 9 Feb 2022 10:42:07 +0000 (18:42 +0800)]
net/ngbe: support custom PHY interfaces

Support sub_device ID 61/62/64 for YT8521S SFP, and 51/52 for M88E1512
PHY.

Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com>
2 years agonet/ngbe: optimize PHY initialization process
Jiawen Wu [Wed, 9 Feb 2022 10:42:06 +0000 (18:42 +0800)]
net/ngbe: optimize PHY initialization process

Reduce the probability of PHY init failure, And add its error return.

Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com>
2 years agonet/ngbe: fix packet statistics
Jiawen Wu [Wed, 9 Feb 2022 10:42:05 +0000 (18:42 +0800)]
net/ngbe: fix packet statistics

Fix specific length packet statistics caused by wrong register addresses.

Fixes: ed5f3bd3373e ("net/ngbe: define registers")
Cc: stable@dpdk.org
Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com>
2 years agonet/ngbe: fix Tx hang on queue disable
Jiawen Wu [Wed, 9 Feb 2022 10:42:04 +0000 (18:42 +0800)]
net/ngbe: fix Tx hang on queue disable

Add commands requesting firmware to enable or disable PCIe bus master.
Disable PCIe master access to clear BME when stop hardware, and verify
there are no pending requests.

Move disabling Tx queue after disabling PCIe bus master, to ensure that
there are no packets left to cause Tx hang.

Fixes: 78710873c2f3 ("net/ngbe: add HW initialization")
Cc: stable@dpdk.org
Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com>
2 years agonet/ngbe: fix missed link interrupt
Jiawen Wu [Wed, 9 Feb 2022 10:42:03 +0000 (18:42 +0800)]
net/ngbe: fix missed link interrupt

When the port is started and stopped continuously and quickly, one
interrupt cannot be handled in time, which will cause subsequent
interrupts to be lost, so that link status will cannot be updated.

Fixes: b9246b8fa280 ("net/ngbe: support link update")
Cc: stable@dpdk.org
Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com>
2 years agonet/ngbe: fix Rx by initializing packet buffer early
Jiawen Wu [Wed, 9 Feb 2022 10:42:02 +0000 (18:42 +0800)]
net/ngbe: fix Rx by initializing packet buffer early

Initialize Rx packet buffer before starting RxTx, ensure to receive
packets.

Fixes: 62fc35e63d0e ("net/ngbe: support Rx queue start/stop")
Cc: stable@dpdk.org
Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com>
2 years agoethdev: introduce dump API
Min Hu (Connor) [Fri, 11 Feb 2022 04:49:22 +0000 (12:49 +0800)]
ethdev: introduce dump API

Added the ethdev dump API which provides querying private info from device.
There exists many private properties in different PMD drivers, such as
adapter state, Rx/Tx func algorithm in hns3 PMD. The information of these
properties is important for debug. As the information is private, the new
API is introduced.

Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
Acked-by: Ray Kinsella <mdr@ashroe.eu>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
2 years agonet/bnxt: fix ring calculation for representors
Ajit Khaparde [Wed, 26 Jan 2022 18:13:26 +0000 (10:13 -0800)]
net/bnxt: fix ring calculation for representors

Currently the Tx and Rx ring count for representors is fixed.
It does not consider the number of rings created for the parent
function. And that can cause issues not only during initialization
but while running traffic.
Instead check the number of rings created for the parent function
while configuring the ring resources for representors.
In some cases VF rep ring init may happen before the parent function's
rings have been setup. And this can cause representor ring count to be
configured as 0. In such cases, initialize the VF representor
ring count to 8.

Fixes: 322bd6e70272 ("net/bnxt: add port representor infrastructure")
Cc: stable@dpdk.org
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
2 years agonet/bnxt: set HW coalescing parameters
Ajit Khaparde [Tue, 1 Feb 2022 22:38:01 +0000 (14:38 -0800)]
net/bnxt: set HW coalescing parameters

Set coalescing parameters correctly for Rx completion rings.
This is not being done for the Rx completion rings currently.

Fixes: 657c2a7f1dd4 ("net/bnxt: create aggregation rings when needed")
Cc: stable@dpdk.org
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
2 years agonet/bnxt: make DMAC field optional for F2 match
Shahaji Bhosle [Tue, 8 Feb 2022 17:00:44 +0000 (09:00 -0800)]
net/bnxt: make DMAC field optional for F2 match

OvS is adding DMAC sometimes and skips sometimes for F2 flows,
to get around not offloading flow make the dmac field optional
in OvS template.

Signed-off-by: Shahaji Bhosle <sbhosle@broadcom.com>
Reviewed-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
2 years agonet/mlx5: fix inline length for multi-segment TSO
Dariusz Sosnowski [Mon, 7 Feb 2022 15:48:56 +0000 (17:48 +0200)]
net/mlx5: fix inline length for multi-segment TSO

This patch removes a redundant assert in mlx5_tx_packet_multi_tso().
That assert assured that the amount of bytes requested to be inlined
is greater than or equal to the minimum amount of bytes required
to be inlined. This requirement is either derived from the NIC
inlining mode or configured through devargs. When using TSO this
requirement can be disregarded, because on all NICs it is satisfied by
TSO inlining requirements, since TSO requires L2, L3, and L4 headers to
be inlined.

Fixes: 18a1c20044c0 ("net/mlx5: implement Tx burst template")
Cc: stable@dpdk.org
Signed-off-by: Dariusz Sosnowski <dsosnowski@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
2 years agonet/mlx5: fix meter capabilities reporting
Alexander Kozyrev [Mon, 7 Feb 2022 13:29:41 +0000 (15:29 +0200)]
net/mlx5: fix meter capabilities reporting

Meter capabilities reporting is not up to date.
Mellanox NICs support RFC2698 and RFC4115 as well as RFC2697.
Add these marker operations to the capabilities list.

Fixes: 6bc327b94fe8 ("net/mlx5: fill meter capabilities using DevX")
Cc: stable@dpdk.org
Signed-off-by: Alexander Kozyrev <akozyrev@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
2 years agonet/mlx5: fix committed bucket size
Alexander Kozyrev [Mon, 7 Feb 2022 13:28:40 +0000 (15:28 +0200)]
net/mlx5: fix committed bucket size

Committed Bucket Size calculation tries to fit into 8-bit wide
mantissa field by setting 256 as a maximum value for it.
To compensate for this increase in the mantissa value the exponent
value has to be reduced by 8. But it gives a negative exponent
value for CBS less than 128. And negative exponent value is not
supported by the NIC. Adjust CSB calculation only for values
bigger than 128 to allow both small and big bucket sizes.

Fixes: 3bd26b23cefc ("net/mlx5: support meter profile operations")
Cc: stable@dpdk.org
Signed-off-by: Alexander Kozyrev <akozyrev@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
2 years agodoc: add mlx5 MPRQ limitation with multi-process
Alexander Kozyrev [Fri, 4 Feb 2022 03:19:13 +0000 (05:19 +0200)]
doc: add mlx5 MPRQ limitation with multi-process

MPRQ cannot be used in multi-process applications because of
externally attached MPRQ buffers. A callback is registered by
a primary process to free MPRQ buffers once they are no longer
needed. But this information is shared among all the processes.
The virtual address of the mlx5_mprq_buf_free_cb function is
different in a secondary process, which leads to a segmentation
fault. Document that MPRQ is not supported in a multi-process
app, since there is no way to find out if this is the one.

Signed-off-by: Alexander Kozyrev <akozyrev@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
2 years agonet/mlx5: remove unused metadata shift parameter
Viacheslav Ovsiienko [Thu, 3 Feb 2022 08:46:52 +0000 (10:46 +0200)]
net/mlx5: remove unused metadata shift parameter

Due to updated modify field action immediate value buffer
pattern [1] the implicit shift for the metadata is not
needed anymore and should be removed.

[1] commit 40c8fb1fd3b3 ("net/mlx5: update modify field action")

Signed-off-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
2 years agonet/mlx5: fix metadata endianness in modify field action
Viacheslav Ovsiienko [Thu, 3 Feb 2022 08:46:51 +0000 (10:46 +0200)]
net/mlx5: fix metadata endianness in modify field action

As modify field action immediate source parameter the metadata
should follow the CPU endianness (according to SET_META action
structure format), and mlx5 PMD wrongly handled the immediate
parameter metadata buffer as big-endian, resulting in wrong
metadata set action with incorrect endianness.

Fixes: 40c8fb1fd3b3 ("net/mlx5: update modify field action")
Cc: stable@dpdk.org
Signed-off-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
2 years agovdpa/sfc: fix null dereference during removal
Weiguo Li [Sat, 29 Jan 2022 17:30:12 +0000 (01:30 +0800)]
vdpa/sfc: fix null dereference during removal

When sva is null, sfc_vdpa_info(sva, ...) will cause a null
dereference. Use SFC_VDPA_GENERIC_LOG() to avoid that.
See macros sfc_vdpa_info and SFC_VDPA_GENERIC_LOG
defined in drivers/vdpa/sfc/sfc_vdpa_log.h for detail.

Fixes: 5e7596ba7cb3 ("vdpa/sfc: introduce Xilinx vDPA driver")
Cc: stable@dpdk.org
Signed-off-by: Weiguo Li <liwg06@foxmail.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
2 years agovhost: fix null pointer dereference in NUMA realloc
Weiguo Li [Sat, 29 Jan 2022 19:07:35 +0000 (03:07 +0800)]
vhost: fix null pointer dereference in NUMA realloc

Fixes: b53c9d20fa06 ("vhost: improve vhost-user layer logs")

Signed-off-by: Weiguo Li <liwg06@foxmail.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
2 years agovdpa/sfc: fix null dereference during config
Weiguo Li [Sat, 29 Jan 2022 18:07:30 +0000 (02:07 +0800)]
vdpa/sfc: fix null dereference during config

Fixes: b11961363b4a ("vdpa/sfc: support device configure and close")
Cc: stable@dpdk.org
Signed-off-by: Weiguo Li <liwg06@foxmail.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
2 years agovhost: add vDPA resource cleanup callback
Xueming Li [Thu, 27 Jan 2022 08:45:35 +0000 (16:45 +0800)]
vhost: add vDPA resource cleanup callback

This patch adds vDPA device cleanup callback to release resources on
vhost user connection close.

Signed-off-by: Xueming Li <xuemingl@nvidia.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
2 years agovhost: integrate dmadev in asynchronous data-path
Jiayu Hu [Wed, 9 Feb 2022 12:51:45 +0000 (07:51 -0500)]
vhost: integrate dmadev in asynchronous data-path

Since dmadev is introduced in 21.11, to avoid the overhead of vhost DMA
abstraction layer and simplify application logics, this patch integrates
dmadev in asynchronous data path.

Signed-off-by: Jiayu Hu <jiayu.hu@intel.com>
Signed-off-by: Sunil Pai G <sunil.pai.g@intel.com>
Tested-by: Yvonne Yang <yvonnex.yang@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
2 years agonet/ice: fix build with 16-byte Rx descriptor
Yiding Zhou [Tue, 8 Feb 2022 15:42:19 +0000 (15:42 +0000)]
net/ice: fix build with 16-byte Rx descriptor

gcc will report error "unused parameter 'rxq'" when the macro
RTE_LIBRTE_ICE_16BYTE_RX_DESC is defined. use RTE_SET_USED to avoid it

Fixes: 7a340b0b4e03 ("net/ice: refactor Rx FlexiMD handling")
Cc: stable@dpdk.org
Signed-off-by: Yiding Zhou <yidingx.zhou@intel.com>
Tested-by: Wei Ling <weix.ling@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
2 years agonet/ice: fix pattern check in flow director
Junfeng Guo [Tue, 8 Feb 2022 07:09:25 +0000 (15:09 +0800)]
net/ice: fix pattern check in flow director

Mask for IPv4/UDP/TCP/SCTP addr/port are not supported in current
code. Thus we need to check each pattern mask. Only zero-mask and
full-mask are allowed to pass the pattern parse, otherwise will
return failure.

Fixes: a631c98a96a2 ("net/ice: fix pattern check for flow director parser")
Cc: stable@dpdk.org
Signed-off-by: Junfeng Guo <junfeng.guo@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
2 years agonet/ice: support drop any and steer all to queue
Yuying Zhang [Wed, 26 Jan 2022 15:57:10 +0000 (15:57 +0000)]
net/ice: support drop any and steer all to queue

This patch supports drop any and steer all to queue in switch
filter. Support new rte_flow pattern any to handle all packets.
The usage is listed below.

1. drop any:
flow create 0 ingress pattern any / end actions drop / end
All packets received in port 0 will be dropped.

2. steer all to queue:
flow create 0 ingress pattern any / end actions queue index 3 / end
All packets received in port 0 will be steered to queue 3.

Signed-off-by: Yuying Zhang <yuying.zhang@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
2 years agonet/ice/base: add profile validation on switch filter
Yuying Zhang [Wed, 26 Jan 2022 15:57:09 +0000 (15:57 +0000)]
net/ice/base: add profile validation on switch filter

Profile type was determined without validation when getting
switch field vector bitmap. It caused error when associating
profile id with given recipe if no lookup elements were given.
Add profile validation to check if the profile is existing
before getting bitmap.

Fixes: 55744222e6e2 ("net/ice/base: associate recipes by profile type")
Cc: stable@dpdk.org
Signed-off-by: Yuying Zhang <yuying.zhang@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
2 years agonet/iavf: count continuous DD bits for Arm in flex Rx
Kathleen Capella [Sat, 5 Feb 2022 00:26:30 +0000 (00:26 +0000)]
net/iavf: count continuous DD bits for Arm in flex Rx

On Arm platforms, reading of descriptors may be re-ordered causing the
status of DD bits to be discontinuous. Add logic to only process
continuous descriptors by checking DD bits.

Fixes: b8b4c54ef9b0 ("net/iavf: support flexible Rx descriptor in normal path")
Cc: stable@dpdk.org
Signed-off-by: Kathleen Capella <kathleen.capella@arm.com>
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
Reviewed-by: Qi Zhang <qi.z.zhang@intel.com>
2 years agonet/iavf: count continuous DD bits for Arm
Kathleen Capella [Sat, 5 Feb 2022 00:26:29 +0000 (00:26 +0000)]
net/iavf: count continuous DD bits for Arm

On Arm platforms, reading of descriptors may be re-ordered causing the
status of DD bits to be discontinuous. Add logic to only process
continuous descriptors by checking DD bits.

Fixes: 1060591eada5 ("net/avf: enable bulk allocate Rx")
Cc: stable@dpdk.org
Signed-off-by: Kathleen Capella <kathleen.capella@arm.com>
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
Reviewed-by: Qi Zhang <qi.z.zhang@intel.com>
2 years agonet/ice: fix dereference before null check
Steve Yang [Mon, 7 Feb 2022 08:25:58 +0000 (08:25 +0000)]
net/ice: fix dereference before null check

This patch fixes coverity issue by assigning the address
of the "info->data" without "info" pointer check.

CID 375065:  Null pointer dereferences  (REVERSE_INULL)
Null-checking "info" suggests that it may be null, but it has already been
dereferenced on all paths leading to the check.

Coverity issue: 375065
Fixes: 52569256583a ("net/ice: support module EEPROM")

Signed-off-by: Steve Yang <stevex.yang@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
2 years agonet/iavf: fix null pointer dereference
Weiguo Li [Fri, 28 Jan 2022 09:43:15 +0000 (17:43 +0800)]
net/iavf: fix null pointer dereference

Check for memory allocation failure is added to avoid null
pointer dereference.

Fixes: 6bc987ecb860 ("net/iavf: support IPsec inline crypto")
Cc: stable@dpdk.org
Signed-off-by: Weiguo Li <liwg06@foxmail.com>
Acked-by: Radu Nicolau <radu.nicolau@intel.com>
2 years agonet/sfc: demand Tx fast free offload on EF10 simple datapath
Ivan Malov [Tue, 8 Feb 2022 23:26:48 +0000 (02:26 +0300)]
net/sfc: demand Tx fast free offload on EF10 simple datapath

Enforce this offload as it is immutable on the said datapath.

Fixes: c78d280e88ef ("net/sfc: convert to new Tx offload API")
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>
2 years agonet/sfc: do not push fast free offload to default TxQ config
Ivan Malov [Tue, 8 Feb 2022 23:26:47 +0000 (02:26 +0300)]
net/sfc: do not push fast free offload to default TxQ config

Doing so is wrong since fast free is an adapter-wide offload.

Technically, the offending commit (see "Fixes" tag) does not
induce failures, however, such started to occur after commit
a4996bd89c42 ("ethdev: new Rx/Tx offloads API") had shown up,
because of the strict offload validation in the generic code.

Fixes: c78d280e88ef ("net/sfc: convert to new Tx offload API")
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>
2 years agoethdev: remove unnecessary null check
Yunjian Wang [Wed, 9 Feb 2022 12:24:10 +0000 (20:24 +0800)]
ethdev: remove unnecessary null check

This NULL check is unnecessary, 'eth_dev' is never NULL.

Fixes: 58b43c1ddfd1 ("ethdev: add telemetry endpoint for device info")
Cc: stable@dpdk.org
Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
2 years agonet/af_xdp: make UMEM configure more readable
Haiyue Wang [Wed, 9 Feb 2022 12:43:58 +0000 (20:43 +0800)]
net/af_xdp: make UMEM configure more readable

The below compile time defined style make the code not so readable, the
first function end block is after "#endif" segment.

#if defined(XDP_UMEM_UNALIGNED_CHUNK_FLAG)

xdp_umem_configure()
{

#else
xdp_umem_configure()
{

#endif
'shared code block'
}

Signed-off-by: Haiyue Wang <haiyue.wang@intel.com>
Acked-by: Ciara Loftus <ciara.loftus@intel.com>
2 years agosecurity: add IPsec option for IP reassembly
Akhil Goyal [Tue, 8 Feb 2022 22:20:27 +0000 (03:50 +0530)]
security: add IPsec option for IP reassembly

A new option is added in IPsec to enable and attempt reassembly
of inbound IP packets.

Signed-off-by: Akhil Goyal <gakhil@marvell.com>
2 years agoethdev: add mbuf dynfield for incomplete IP reassembly
Akhil Goyal [Tue, 8 Feb 2022 22:20:26 +0000 (03:50 +0530)]
ethdev: add mbuf dynfield for incomplete IP reassembly

Hardware IP reassembly may be incomplete for multiple reasons like
reassembly timeout reached, duplicate fragments, etc.
To save application cycles to process these packets again, a new
mbuf dynflag is added to show that the mbuf received is not
reassembled properly.

Now if this dynflag is set, application can retrieve corresponding
chain of mbufs using mbuf dynfield set by the PMD. Now, it will be
up to application to either drop those fragments or wait for more time.

Signed-off-by: Akhil Goyal <gakhil@marvell.com>
2 years agoethdev: introduce IP reassembly offload
Akhil Goyal [Tue, 8 Feb 2022 22:20:25 +0000 (03:50 +0530)]
ethdev: introduce IP reassembly offload

IP Reassembly is a costly operation if it is done in software.
The operation becomes even more costlier if IP fragments are encrypted.
However, if it is offloaded to HW, it can considerably save application
cycles.

Hence, a new offload feature is exposed in eth_dev ops for devices which
can attempt IP reassembly of packets in hardware.
- rte_eth_ip_reassembly_capability_get() - to get the maximum values
  of reassembly configuration which can be set.
- rte_eth_ip_reassembly_conf_set() - to set IP reassembly configuration
  and to enable the feature in the PMD (to be called before
  rte_eth_dev_start()).
- rte_eth_ip_reassembly_conf_get() - to get the current configuration
  set in PMD.

Now when the offload is enabled using rte_eth_ip_reassembly_conf_set(),
the resulting reassembled IP packet would be a typical segmented mbuf in
case of success.

And if reassembly of IP fragments is failed or is incomplete (if
fragments do not come before the reass_timeout, overlap, etc), the mbuf
dynamic flags can be updated by the PMD. This is updated in a subsequent
patch.

Signed-off-by: Akhil Goyal <gakhil@marvell.com>
2 years agoapp/testpmd: add 6 types of L2TPv2 message
Jie Wang [Wed, 9 Feb 2022 09:38:54 +0000 (17:38 +0800)]
app/testpmd: add 6 types of L2TPv2 message

This patch adds L2TPv2 control message and 5 types of data message
support for testpmd.

The added L2TPv2 message types are listed below:
1. L2TPv2 control
2. L2TPv2
3. L2TPv2 + length option
4. L2TPv2 + sequence option
5. L2TPv2 + offset option
6. L2TPv2 + length option + sequence option

Signed-off-by: Jie Wang <jie1x.wang@intel.com>
Acked-by: Ori Kam <orika@nvidia.com>
2 years agonet: fix L2TPv2 common header
Jie Wang [Wed, 9 Feb 2022 09:38:53 +0000 (17:38 +0800)]
net: fix L2TPv2 common header

The fields of L2TPv2 common header were reversed in big endian and
little endian.

This patch fixes this error to ensure L2TPv2 can be parsed correctly.

For L2TP reference:
https://datatracker.ietf.org/doc/html/rfc2661#section-3.1

Fixes: 3a929df1f286 ("ethdev: support L2TPv2 and PPP procotol")
Cc: stable@dpdk.org
Signed-off-by: Jie Wang <jie1x.wang@intel.com>
Acked-by: Ori Kam <orika@nvidia.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
2 years agoethdev: add L2TPv2 RSS offload type
Jie Wang [Wed, 9 Feb 2022 09:38:52 +0000 (17:38 +0800)]
ethdev: add L2TPv2 RSS offload type

This patch defines new RSS offload type for L2TPv2, which
is required when users want to distribute packets based on
the L2TPv2 session ID field.

Signed-off-by: Jie Wang <jie1x.wang@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
2 years agonet/memif: remove pointer deference before null check
Weiguo Li [Wed, 9 Feb 2022 07:39:34 +0000 (15:39 +0800)]
net/memif: remove pointer deference before null check

There are duplicates of assignment here, the one before null check
may cause a null pointer deference, so remove the previous one.

Fixes: 09c7e63a71f9 ("net/memif: introduce memory interface PMD")
Cc: stable@dpdk.org
Signed-off-by: Weiguo Li <liwg06@foxmail.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
2 years agoconfig: align mempool elements to 128 bytes on CN10K
Pavan Nikhilesh [Mon, 13 Dec 2021 11:06:14 +0000 (16:36 +0530)]
config: align mempool elements to 128 bytes on CN10K

Mempool elements are by default aligned to CACHELINE_SIZE.
In CN10K cacheline size is 64B but the RoC requires buffers to be
aligned to 128B.
Set RTE_MEMPOOL_ALIGN to 128 to force mempool buffers to be aligned
128 bytes.

Fixes: 1b4c86a721c9 ("config/arm: add Marvell CN10K")
Cc: stable@dpdk.org
Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
2 years agoeal: ignore gcc-compat warning in clang-only macro
Michael Barker [Mon, 31 Jan 2022 00:05:16 +0000 (13:05 +1300)]
eal: ignore gcc-compat warning in clang-only macro

When compiling with clang using -Wpedantic (or -Wgcc-compat) the use of
diagnose_if kicks up a warning:

.../include/rte_interrupts.h:623:1: error: 'diagnose_if' is a clang
extension [-Werror,-Wgcc-compat]
__rte_internal
^
.../include/rte_compat.h:36:16: note: expanded from macro '__rte_internal'
__attribute__((diagnose_if(1, "Symbol is not public ABI", "error"), \

This change ignores the '-Wgcc-compat' warning in the specific location
where the warning occurs.  It is safe to do in this circumstance as the
specific macro is only defined when using the clang compiler.

Signed-off-by: Michael Barker <mikeb01@gmail.com>
2 years agobuildtools/chkincs: test headers for C++ compatibility
Bruce Richardson [Fri, 11 Feb 2022 11:36:41 +0000 (11:36 +0000)]
buildtools/chkincs: test headers for C++ compatibility

Add support for checking each of our headers for issues when included in
a C++ file.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
2 years agobuildtools/chkincs: remove unnecessary linkage
Bruce Richardson [Fri, 11 Feb 2022 11:36:40 +0000 (11:36 +0000)]
buildtools/chkincs: remove unnecessary linkage

The chkincs binary does not actually call any functions in either libs
or drivers, so we can simplify the linkage of it to just using shared
linkage of the libraries (via meson dependencies). This means a slightly
faster link time as well as making the chkincs binary much, much
smaller.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
2 years agoremove unnecessary null checks
Stephen Hemminger [Wed, 9 Feb 2022 19:17:15 +0000 (11:17 -0800)]
remove unnecessary null checks

Functions like free, rte_free, and rte_mempool_free
already handle NULL pointer so the checks here are not necessary.

Remove redundant NULL pointer checks before free functions
found by nullfree.cocci

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2 years agodevtools: add script to fix unnecessary null checks
Stephen Hemminger [Wed, 9 Feb 2022 19:17:14 +0000 (11:17 -0800)]
devtools: add script to fix unnecessary null checks

This script is based on the idea of the nullfree script
in the Linux kernel. It finds cases where a check for null
pointer is done, but is unnecessary because the function
already handles NULL pointer.

Basic example:
       if (x->buf)
           rte_free(x->buf);
can be reduced to:
       rte_free(x->buf);

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2 years agolib: update documentation of some *_free functions
Stephen Hemminger [Wed, 9 Feb 2022 19:17:13 +0000 (11:17 -0800)]
lib: update documentation of some *_free functions

These functions all behave like libc free() and do
nothing if handed a NULL pointer. The code is already doing
this, this patch just documents the behavior.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2 years agomem: cleanup multiprocess resources
Stephen Hemminger [Sat, 13 Nov 2021 17:22:57 +0000 (09:22 -0800)]
mem: cleanup multiprocess resources

The mp action resources in malloc should be cleaned up via
rte_eal_cleanup.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
2 years agoeal: cleanup multiprocess hotplug resources
Stephen Hemminger [Sat, 13 Nov 2021 17:22:56 +0000 (09:22 -0800)]
eal: cleanup multiprocess hotplug resources

When rte_eal_cleanup is called, hotplug should unregister the
resources associated with the multi-process server.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2 years agovfio: cleanup the multiprocess sync handle
Stephen Hemminger [Sat, 13 Nov 2021 17:22:55 +0000 (09:22 -0800)]
vfio: cleanup the multiprocess sync handle

When rte_eal_cleanup is called the rte_mp_action for VFIO
should be freed.

Fixes: edf73dd33072 ("ipc: handle unsupported IPC in action register")
Cc: stable@dpdk.org
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
2 years agoipc: end multiprocess thread during cleanup
Stephen Hemminger [Sat, 13 Nov 2021 17:22:54 +0000 (09:22 -0800)]
ipc: end multiprocess thread during cleanup

When rte_eal_cleanup is called, all control threads should exit.
For the mp thread, this best handled by closing the mp_socket
and letting the thread see that.

This also fixes potential problems where the mp_socket gets
another hard error, and the thread runs away repeating itself
by reading the same error.

Fixes: 85d6815fa6d0 ("eal: close multi-process socket during cleanup")
Cc: stable@dpdk.org
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
2 years agolog: close in cleanup stage
Stephen Hemminger [Sat, 13 Nov 2021 17:22:53 +0000 (09:22 -0800)]
log: close in cleanup stage

When application calls rte_eal_cleanup on shutdown,
the DPDK log should be closed and cleaned up.

This helps reduce false reports from tools like ASAN
and valgrind that track memory leaks.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2 years agotest/mbuf: fix mbuf data content check
David Marchand [Thu, 3 Feb 2022 09:39:12 +0000 (10:39 +0100)]
test/mbuf: fix mbuf data content check

When allocating a mbuf, its data content is most of the time zero'd but
nothing ensures this. This is especially wrong when building with
RTE_MALLOC_DEBUG, where data is poisoned to 0x6b on free.

This test reserves MBUF_TEST_DATA_LEN2 bytes in the mbuf data segment,
and sets this data to 0xcc.
Calling strlen(), the test may try to read more than MBUF_TEST_DATA_LEN2
which has been noticed when memory had been poisoned.

The mbuf data content is checked right after, so we can simply remove
strlen().

Fixes: 7b295dceea07 ("test/mbuf: add unit test cases")
Cc: stable@dpdk.org
Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
2 years agoapp/fib: fix division by zero
Vladimir Medvedkin [Thu, 27 Jan 2022 18:08:53 +0000 (18:08 +0000)]
app/fib: fix division by zero

This patch fixes the division by 0, which occurs if the number of
routes is less than 10.
Can be triggered by passing -n argument with value < 10:

./dpdk-test-fib -- -n 9
...
Floating point exception (core dumped)

Fixes: 103809d032cd ("app/test-fib: add test application for FIB")
Cc: stable@dpdk.org
Signed-off-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>
Acked-by: Kevin Traynor <ktraynor@redhat.com>
2 years agomem: check allocation in dynamic hugepage init
Yunjian Wang [Tue, 14 Dec 2021 13:30:25 +0000 (21:30 +0800)]
mem: check allocation in dynamic hugepage init

The function malloc() could return NULL, the return value
need to be checked.

Fixes: 6f63858e55e6 ("mem: prevent preallocated pages from being freed")
Cc: stable@dpdk.org
Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
2 years agoeal/arm: inline 128-bit atomic compare exchange with GCC
Pavan Nikhilesh [Fri, 5 Nov 2021 08:57:12 +0000 (14:27 +0530)]
eal/arm: inline 128-bit atomic compare exchange with GCC

GCC [1] now assigns even register pairs for CASP, the fix has also been
backported to all stable releases of older GCC versions.
Removing the manual register allocation allows GCC to inline the
functions and pick optimal registers for performing CASP.

1: https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=563cc649beaf

Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Acked-by: Ruifeng Wang <ruifeng.wang@arm.com>
2 years agovhost: fix C++ include
Bruce Richardson [Thu, 10 Feb 2022 15:42:38 +0000 (15:42 +0000)]
vhost: fix C++ include

The virtio kernel header includes are already noted as being
incompatible with C++. We can ensure that the header is safe for
inclusion in C++ code by not including those headers during C++ builds.
While not ideal, this does ensure that all DPDK headers can be included
in C++ code without errors.

Fixes: f8904d563691 ("vhost: fix header for strict compilation flags")
Cc: stable@dpdk.org
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
2 years agotable: fix C++ include
Bruce Richardson [Thu, 10 Feb 2022 15:42:37 +0000 (15:42 +0000)]
table: fix C++ include

Since C++ doesn't support automatic casting from void * to other types,
we need to explicitly add the casts to any header files in DPDK.

Fixes: ea7be0a0386e ("lib/librte_table: add hash function headers")
Cc: stable@dpdk.org
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
2 years agoipsec: fix C++ include
Bruce Richardson [Thu, 10 Feb 2022 15:42:36 +0000 (15:42 +0000)]
ipsec: fix C++ include

C++ does not have automatic casting to/from void pointers, so need
explicit cast if header is to be included in C++ code

Fixes: f901d9c82688 ("ipsec: add helpers to group completed crypto-ops")
Cc: stable@dpdk.org
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
2 years agograph: fix C++ include
Bruce Richardson [Thu, 10 Feb 2022 15:42:35 +0000 (15:42 +0000)]
graph: fix C++ include

C++ does not have automatic casting to/from void pointers, so need
explicit cast if header is to be included in C++ code

Fixes: 40d4f51403ec ("graph: implement fastpath routines")
Cc: stable@dpdk.org
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
2 years agoeventdev: fix C++ include
Bruce Richardson [Thu, 10 Feb 2022 15:42:34 +0000 (15:42 +0000)]
eventdev: fix C++ include

The eventdev headers had issues when used from C++

* Missing closing "}" for the extern "C" block
* No automatic casting to/from void *

Fixes: a6562f6d6f8e ("eventdev: introduce event timer adapter")
Fixes: 32e326869ed6 ("eventdev: add tracepoints")
Cc: stable@dpdk.org
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
2 years agoeal: fix C++ include
Bruce Richardson [Thu, 10 Feb 2022 15:42:33 +0000 (15:42 +0000)]
eal: fix C++ include

C++ files could not include some headers because:

* "new" is a keyword in C++, so can't be a variable name
* there is no automatic casting to/from void *

Fixes: 184104fc6121 ("ticketlock: introduce fair ticket based locking")
Fixes: 032a7e5499a0 ("trace: implement provider payload")
Cc: stable@dpdk.org
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
2 years agoconfig/arm: add values for native armv7
Juraj Linkeš [Tue, 25 Jan 2022 10:08:28 +0000 (11:08 +0100)]
config/arm: add values for native armv7

Armv7 native build fails with this error:
../config/meson.build:364:1: ERROR: Problem encountered:
Number of CPU cores not specified.

This is because RTE_MAX_LCORE is not set. We also need to set
RTE_MAX_NUMA_NODES in armv7 native builds.

Fixes: 8ef09fdc506b ("build: add optional NUMA and CPU counts detection")
Cc: stable@dpdk.org
Signed-off-by: Juraj Linkeš <juraj.linkes@pantheon.tech>
Acked-by: Ruifeng Wang <ruifeng.wang@arm.com>
2 years agostack: fix stubs header export
David Marchand [Thu, 10 Feb 2022 08:55:43 +0000 (09:55 +0100)]
stack: fix stubs header export

The stubs header is included as part of rte_stack.h for architectures
other than x86_64 and aarch64 (i.e. x86 32 bits and ppc).

Note: chkincs won't catch this issue since it checks headers from within
the source directory.

Fixes: 7911ba0473e0 ("stack: enable lock-free implementation for aarch64")
Cc: stable@dpdk.org
Signed-off-by: David Marchand <david.marchand@redhat.com>
2 years agoregex/mlx5: fix memory allocation check
Weiguo Li [Tue, 25 Jan 2022 11:51:41 +0000 (19:51 +0800)]
regex/mlx5: fix memory allocation check

The wrong field was checked after allocation.

Fixes: e3dbbf718ebc ("regex/mlx5: support configuration")
Cc: stable@dpdk.org
Signed-off-by: Weiguo Li <liwg06@foxmail.com>