dpdk.git
2 years agocrypto/cnxk: fix condition check
Volodymyr Fialko [Thu, 9 Jun 2022 09:27:31 +0000 (11:27 +0200)]
crypto/cnxk: fix condition check

The value of ec_mdata cannot be NULL, instead check that value of
private_data_offset was set.

Coverity issue: 378861, 378865
Fixes: 97ebfda82910 ("crypto/cnxk: add event metadata set operation")

Signed-off-by: Volodymyr Fialko <vfialko@marvell.com>
Acked-by: Anoob Joseph <anoobj@marvell.com>
2 years agocrypto/cnxk: swap ZUC-256 IV
Ankur Dwivedi [Fri, 3 Jun 2022 07:13:07 +0000 (12:43 +0530)]
crypto/cnxk: swap ZUC-256 IV

The microcode expects the IV to be in reverse of what is provided
by dpdk test app. Also the first 8 bytes of reversed IV is
compressed to 6 bytes.

Signed-off-by: Ankur Dwivedi <adwivedi@marvell.com>
Reviewed-by: Jerin Jacob <jerinj@marvell.com>
2 years agocommon/cnxk: swap ZUC-256 key
Ankur Dwivedi [Fri, 3 Jun 2022 07:13:06 +0000 (12:43 +0530)]
common/cnxk: swap ZUC-256 key

The microcode expects zuc-256 key to be in reverse of what is
provided by dpdk test app. This patch swaps the zuc-256 key.

Signed-off-by: Ankur Dwivedi <adwivedi@marvell.com>
Reviewed-by: Jerin Jacob <jerinj@marvell.com>
2 years agoexamples/ipsec-secgw: fix packet type parsing
Radu Nicolau [Fri, 10 Jun 2022 10:45:54 +0000 (11:45 +0100)]
examples/ipsec-secgw: fix packet type parsing

Add new packet type flags instead of overwriting.

Fixes: d04bb1c52647 ("examples/ipsec-secgw: use HW parsed packet type in poll mode")

Signed-off-by: Radu Nicolau <radu.nicolau@intel.com>
Acked-by: Fan Zhang <roy.fan.zhang@intel.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
2 years agoexamples/ipsec-secgw: add option for descriptors per QP
Volodymyr Fialko [Thu, 9 Jun 2022 13:01:29 +0000 (15:01 +0200)]
examples/ipsec-secgw: add option for descriptors per QP

Added option to configure number of queue pair descriptors via command
line (--desc-nb NUMBER_OF_DESC).

When the crypto processing takes longer durations, small queue pair size
would result in cryptodev enqueue failures. Larger queue pair size would
allow more packets to stay in flight simultaneously and reduce enqueue
failures.

Signed-off-by: Volodymyr Fialko <vfialko@marvell.com>
Acked-by: Anoob Joseph <anoobj@marvell.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
2 years agoexamples/ipsec-secgw: fix ESN setting
Radu Nicolau [Tue, 14 Jun 2022 12:43:13 +0000 (13:43 +0100)]
examples/ipsec-secgw: fix ESN setting

Fix ESN option flag and initial value for the rte_ipsec library path.

Fixes: 560029d5cfc9 ("examples/ipsec-secgw: define initial ESN value")
Cc: stable@dpdk.org
Signed-off-by: Radu Nicolau <radu.nicolau@intel.com>
Acked-by: Fan Zhang <roy.fan.zhang@intel.com>
2 years agotest/crypto: fix build with optimization=1
Rahul Lakkireddy [Mon, 13 Jun 2022 09:52:23 +0000 (15:22 +0530)]
test/crypto: fix build with optimization=1

Fail IPSec ESN and antireplay cases, if there are no packets. Fixes
following warning when using optimization=1 build flag with GCC 11.

../app/test/test_cryptodev.c: In function ‘test_ipsec_pkt_replay’:
../app/test/test_cryptodev.c:10074:15: warning: ‘td_outb’ may be used uninitialized [-Wmaybe-uninitialized]
         ret = test_ipsec_proto_process(td_outb, td_inb, nb_pkts, true,
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                        &flags);
                                        ~~~~~~~
../app/test/test_cryptodev.c:9150:1: note: by argument 1 of type ‘const struct ipsec_test_data[]’ to ‘test_ipsec_proto_process’ declared here
 test_ipsec_proto_process(const struct ipsec_test_data td[],
 ^~~~~~~~~~~~~~~~~~~~~~~~
../app/test/test_cryptodev.c:10056:32: note: ‘td_outb’ declared here
         struct ipsec_test_data td_outb[IPSEC_TEST_PACKETS_MAX];
                                ^~~~~~~

Bugzilla ID: 1032
Fixes: d02c6bfcb99a ("test/crypto: add ESN and antireplay cases")
Cc: stable@dpdk.org
Reported-by: Daxue Gao <daxuex.gao@intel.com>
Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
Acked-by: Anoob Joseph <anoobj@marvell.com>
2 years agonet/iavf: fix NAT-T payload length
Radu Nicolau [Wed, 25 May 2022 13:59:12 +0000 (14:59 +0100)]
net/iavf: fix NAT-T payload length

Correct the length calculation used for NAT-T

Fixes: 6bc987ecb860 ("net/iavf: support IPsec inline crypto")
Cc: stable@dpdk.org
Signed-off-by: Radu Nicolau <radu.nicolau@intel.com>
Acked-by: Fan Zhang <roy.fan.zhang@intel.com>
2 years agoexamples/ipsec-secgw: fix NAT-T header fields
Radu Nicolau [Wed, 25 May 2022 13:59:11 +0000 (14:59 +0100)]
examples/ipsec-secgw: fix NAT-T header fields

Use the proper IP protocol (UDP instead of ESP) and set the ports when
UDP encapsulation is enabled.

Fixes: 9ae86b4cfc77 ("examples/ipsec-secgw: support UDP encap for inline crypto")
Cc: stable@dpdk.org
Signed-off-by: Radu Nicolau <radu.nicolau@intel.com>
Acked-by: Fan Zhang <roy.fan.zhang@intel.com>
2 years agoipsec: fix NAT-T ports and length
Radu Nicolau [Wed, 25 May 2022 13:59:10 +0000 (14:59 +0100)]
ipsec: fix NAT-T ports and length

Fix the UDP header fields, wrong byte order used for src and dst port
and wrong offset used when updating UDP datagram length.

Fixes: 01eef5907fc3 ("ipsec: support NAT-T")
Cc: stable@dpdk.org
Signed-off-by: Radu Nicolau <radu.nicolau@intel.com>
Acked-by: Fan Zhang <roy.fan.zhang@intel.com>
2 years agobaseband/acc100: configure ACC101 from PF
Nicolas Chautru [Tue, 31 May 2022 22:31:47 +0000 (15:31 -0700)]
baseband/acc100: configure ACC101 from PF

Adding companion function common to ACC100/ACC101 which
can be called from bbdev-test when running from PF.

Signed-off-by: Nicolas Chautru <nicolas.chautru@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
2 years agobaseband/acc100: modify validation code for ACC101
Nicolas Chautru [Tue, 31 May 2022 22:31:46 +0000 (15:31 -0700)]
baseband/acc100: modify validation code for ACC101

The validation requirement is different for the two
devices.

Signed-off-by: Nicolas Chautru <nicolas.chautru@intel.com>
Reviewed-by: Hernan Vargas <hernan.vargas@intel.com>
2 years agobaseband/acc100: introduce PMD for ACC101
Nicolas Chautru [Tue, 31 May 2022 22:31:45 +0000 (15:31 -0700)]
baseband/acc100: introduce PMD for ACC101

Added support for ACC101 as a derivative of ACC100.
Integrated in unified driver and reusing existing code when possible.

Signed-off-by: Nicolas Chautru <nicolas.chautru@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
2 years agobaseband/acc100: remove RTE prefix for internal macros
Nicolas Chautru [Tue, 31 May 2022 22:31:44 +0000 (15:31 -0700)]
baseband/acc100: remove RTE prefix for internal macros

Cosmetic update to remove RTE_ prefix for a define
kept internal.

Signed-off-by: Nicolas Chautru <nicolas.chautru@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
2 years agobaseband/acc100: add protection for some negative scenario
Nicolas Chautru [Tue, 31 May 2022 22:31:43 +0000 (15:31 -0700)]
baseband/acc100: add protection for some negative scenario

Catch exception in PMD in case of invalid input parameter.

Fixes: 5ad5060f8f7a ("baseband/acc100: add LDPC processing functions")
Cc: stable@dpdk.org
Signed-off-by: Nicolas Chautru <nicolas.chautru@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
2 years agobaseband/acc100: update companion PF configure function
Nicolas Chautru [Tue, 31 May 2022 22:31:42 +0000 (15:31 -0700)]
baseband/acc100: update companion PF configure function

Update of the device configuration function from PF used for bbdev-test
to latest sequence for ACC199 PRQ device and matching version in
pf_bb_config 22.03.

Fixes: b17d70922d5d ("baseband/acc100: add configure function")
Cc: stable@dpdk.org
Signed-off-by: Nicolas Chautru <nicolas.chautru@intel.com>
Reviewed-by: Hernan Vargas <hernan.vargas@intel.com>
2 years agoeal/x86: drop export of internal alignment macro
David Marchand [Tue, 21 Jun 2022 14:13:25 +0000 (16:13 +0200)]
eal/x86: drop export of internal alignment macro

ALIGNMENT_MASK is only used internally.
Besides it lacks a DPDK-related prefix.
Hide it from external eyes.

Fixes: f5472703c0bd ("eal: optimize aligned memcpy on x86")
Cc: stable@dpdk.org
Reported-by: Morten Brørup <mb@smartsharesystems.com>
Signed-off-by: David Marchand <david.marchand@redhat.com>
2 years agosched: fix floating point math
Stephen Hemminger [Thu, 26 May 2022 20:26:53 +0000 (13:26 -0700)]
sched: fix floating point math

The function rte_pie_drop was attempting to do a random probability
drop, but because of incorrect usage of fixed point divide
it would always return 1.

Change to use new rte_drand() instead.

Fixes: 44c730b0e379 ("sched: add PIE based congestion management")
Cc: stable@dpdk.org
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Jasvinder Singh <jasvinder.singh@intel.com>
2 years agosched: remove unnecessary floating point
Stephen Hemminger [Thu, 26 May 2022 20:26:52 +0000 (13:26 -0700)]
sched: remove unnecessary floating point

The qdelay variable is derived from and compared to 64 bit
value so it doesn't have to be floating point.

Fixes: 44c730b0e379 ("sched: add PIE based congestion management")
Cc: stable@dpdk.org
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Jasvinder Singh <jasvinder.singh@intel.com>
2 years agoeal: provide pseudo-random floating point number
Stephen Hemminger [Thu, 26 May 2022 20:26:51 +0000 (13:26 -0700)]
eal: provide pseudo-random floating point number

The PIE code and other applications can benefit from having a
fast way to get a random floating point value. This new function
is equivalent to drand() in the standard library.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Ray Kinsella <mdr@ashroe.eu>
2 years agocommon/cnxk: support switching CPRI/ETH back and forth
Tomasz Duszynski [Sat, 4 Jun 2022 16:26:51 +0000 (18:26 +0200)]
common/cnxk: support switching CPRI/ETH back and forth

Add support for toggling modes between ETH and CPRI on
newer MACs (RPM).

Signed-off-by: Tomasz Duszynski <tduszynski@marvell.com>
Reviewed-by: Jakub Palider <jpalider@marvell.com>
Reviewed-by: Jerin Jacob <jerinj@marvell.com>
2 years agocommon/cnxk: sync eth mode change command with firmware
Tomasz Duszynski [Sat, 4 Jun 2022 16:26:50 +0000 (18:26 +0200)]
common/cnxk: sync eth mode change command with firmware

Layout of eth mode change command defined by firmware has been changed
recently. So in order to retain compatibility between ROC and firmware
update existing codebase.

Signed-off-by: Tomasz Duszynski <tduszynski@marvell.com>
Reviewed-by: Jakub Palider <jpalider@marvell.com>
Reviewed-by: Jerin Jacob <jerinj@marvell.com>
2 years agocommon/cnxk: remove unused constants
Tomasz Duszynski [Sat, 4 Jun 2022 16:26:49 +0000 (18:26 +0200)]
common/cnxk: remove unused constants

Some constants are redundant hence remove them.

Signed-off-by: Tomasz Duszynski <tduszynski@marvell.com>
Reviewed-by: Jakub Palider <jpalider@marvell.com>
Reviewed-by: Jerin Jacob <jerinj@marvell.com>
2 years agoraw/cnxk_bphy: support changing CPRI misc settings
Tomasz Duszynski [Sat, 4 Jun 2022 16:26:48 +0000 (18:26 +0200)]
raw/cnxk_bphy: support changing CPRI misc settings

Add support for changing miscellaneous CPRI settings.

Signed-off-by: Tomasz Duszynski <tduszynski@marvell.com>
Reviewed-by: Jerin Jacob <jerinj@marvell.com>
2 years agoraw/cnxk_bphy: support enabling Tx for CPRI SERDES
Tomasz Duszynski [Sat, 4 Jun 2022 16:26:47 +0000 (18:26 +0200)]
raw/cnxk_bphy: support enabling Tx for CPRI SERDES

Add support for enabling or disablig TX for SERDES
configured in CPRI mode.

Signed-off-by: Tomasz Duszynski <tduszynski@marvell.com>
Reviewed-by: Jakub Palider <jpalider@marvell.com>
Reviewed-by: Jerin Jacob <jerinj@marvell.com>
2 years agoraw/cnxk_bphy: support switching from eCPRI to CPRI
Tomasz Duszynski [Sat, 4 Jun 2022 16:26:46 +0000 (18:26 +0200)]
raw/cnxk_bphy: support switching from eCPRI to CPRI

Add support for switching from ethernet (eCPRI) to CPRI mode.

Signed-off-by: Tomasz Duszynski <tduszynski@marvell.com>
Reviewed-by: Jakub Palider <jpalider@marvell.com>
Reviewed-by: Jerin Jacob <jerinj@marvell.com>
2 years agocommon/cnxk: do not switch affinity back and forth
Tomasz Duszynski [Sat, 4 Jun 2022 16:26:45 +0000 (18:26 +0200)]
common/cnxk: do not switch affinity back and forth

Switching affinity back and forth was used as a mean to pass CPU number
to IRQ registration routine which is an overkill.

Simplify current logic by extending IRQ registration routine parameter
list with a CPU which should run IRQ handler.

Signed-off-by: Tomasz Duszynski <tduszynski@marvell.com>
Reviewed-by: Jakub Palider <jpalider@marvell.com>
Reviewed-by: Jerin Jacob <jerinj@marvell.com>
2 years agoraw/cnxk_bphy: add doxygen comments
Jakub Palider [Sat, 4 Jun 2022 16:26:44 +0000 (18:26 +0200)]
raw/cnxk_bphy: add doxygen comments

Documentation in doxygen format is important for API
headers used by end user. This patch fills BPHY and CGX
interface with missing bits.

Signed-off-by: Jakub Palider <jpalider@marvell.com>
Reviewed-by: Jerin Jacob <jerinj@marvell.com>
2 years agocommon/cnxk: use wider mask to extract RPM ID
Tomasz Duszynski [Sat, 4 Jun 2022 16:26:43 +0000 (18:26 +0200)]
common/cnxk: use wider mask to extract RPM ID

Some platforms have more RPMs available than the others. Take than
into account when retrieving id of a particular RPM.

Signed-off-by: Tomasz Duszynski <tduszynski@marvell.com>
Reviewed-by: Jakub Palider <jpalider@marvell.com>
Reviewed-by: Jerin Jacob <jerinj@marvell.com>
Tested-by: Jerin Jacob <jerinj@marvell.com>
2 years agocommon/cnxk: update register access for CNF10xxN
Tomasz Duszynski [Sat, 4 Jun 2022 16:26:42 +0000 (18:26 +0200)]
common/cnxk: update register access for CNF10xxN

Due to HW changes some fields which were used to enable
xmit were moved elsewhere. This patch takes care of this.

Signed-off-by: Tomasz Duszynski <tduszynski@marvell.com>
Reviewed-by: Jakub Palider <jpalider@marvell.com>
Reviewed-by: Jerin Jacob <jerinj@marvell.com>
Tested-by: Jerin Jacob <jerinj@marvell.com>
2 years agotest: drop reference to removed tests
David Marchand [Mon, 13 Jun 2022 07:37:00 +0000 (09:37 +0200)]
test: drop reference to removed tests

cycles_autotest and delay_us_sleep_autotest tests were removed in the
commit ee00af60170b ("test: remove strict timing requirements some tests")
and were wrongly reintroduced later.

Bugzilla ID: 1021
Fixes: 74822233bdc2 ("test: create a list of extra tests")
Cc: stable@dpdk.org
Signed-off-by: David Marchand <david.marchand@redhat.com>
2 years agodma/idxd: fix AVX2 in non-datapath functions
Bruce Richardson [Fri, 17 Jun 2022 10:59:20 +0000 (11:59 +0100)]
dma/idxd: fix AVX2 in non-datapath functions

While all systems which will use the idxd driver for hardware will
support AVX2, if the driver is present the initialization functions e.g.
to register logs, will be called on all systems - irrespective of HW
support. This can cause issues if the system running DPDK does not have
AVX2, and the compiler has included AVX instructions in the
initialization code.

To fix this, remove AVX2 instruction set from the whole build of the
driver. Instead, we add "target(avx2)" attribute to all datapath
functions, so those - and only those functions - will having AVX2
instructions in them.

Bugzilla ID: 1038
Fixes: 3d36a0a1c7de ("dma/idxd: add data path job submission")
Cc: stable@dpdk.org
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Conor Walsh <conor.walsh@intel.com>
2 years agodma/idxd: fix default for workqueue options
Bruce Richardson [Fri, 17 Jun 2022 11:17:50 +0000 (12:17 +0100)]
dma/idxd: fix default for workqueue options

When no --wq-option flag is passed to dpdk_idxd_cfg.py script, the
default value used by argparse is None. This leads to later errors which
are expecting an array value:

TypeError: 'NoneType' object is not iterable

This is fixed by specifying that the empty array should be the default
if no flags are passed.

Fixes: 94b0f04dc0e3 ("dma/idxd: add generic option for queue config")

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Sunil Pai G <sunil.pai.g@intel.com>
Acked-by: Conor Walsh <conor.walsh@intel.com>
2 years agotest: enable most driver tests on Windows
Tyler Retzlaff [Fri, 20 May 2022 10:12:06 +0000 (03:12 -0700)]
test: enable most driver tests on Windows

Enable most of the driver tests to run on Windows, most tests will be
skipped since the drivers themselves are not available on Windows.

Tests not removed from conditional run:

cryptodev_openssl_asym_autotest
  Test fails because it does not bother checking to see if required
  driver is available as the other cryptodev tests do.
  The test should be updated to fix the issue.

eventdev_selftest_octeontx, eventdev_selftest_sw
  Because it has a dependency on eventdev library which doesn't build
  on Windows. These should be resolved by including/running the tests
  dependent on if dpdk_conf.has('RTE_LIB_EVENT')

dump_xxx tests are still to be evaluated, no attempt has been made
to move these out of conditional run for Windows.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
2 years agotest/crypto: remove Windows conditional compilation
Tyler Retzlaff [Fri, 20 May 2022 10:12:05 +0000 (03:12 -0700)]
test/crypto: remove Windows conditional compilation

Build the test/crypto harnesses on Windows to allow them to be listed
as tests to run.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
2 years agovhost: remove unneeded header includes
Sean Morrissey [Mon, 20 Jun 2022 10:40:30 +0000 (10:40 +0000)]
vhost: remove unneeded header includes

These header includes have been flagged by the iwyu_tool
and removed.

Signed-off-by: Sean Morrissey <sean.morrissey@intel.com>
Acked-by: Chenbo Xia <chenbo.xia@intel.com>
2 years agotimer: remove unneeded header includes
Sean Morrissey [Mon, 20 Jun 2022 10:40:29 +0000 (10:40 +0000)]
timer: remove unneeded header includes

These header includes have been flagged by the iwyu_tool
and removed.

Signed-off-by: Sean Morrissey <sean.morrissey@intel.com>
2 years agosched: remove unneeded header includes
Sean Morrissey [Mon, 20 Jun 2022 10:40:28 +0000 (10:40 +0000)]
sched: remove unneeded header includes

These header includes have been flagged by the iwyu_tool
and removed.

Signed-off-by: Sean Morrissey <sean.morrissey@intel.com>
2 years agorawdev: remove unneeded header includes
Sean Morrissey [Mon, 20 Jun 2022 10:40:27 +0000 (10:40 +0000)]
rawdev: remove unneeded header includes

These header includes have been flagged by the iwyu_tool
and removed.

Signed-off-by: Sean Morrissey <sean.morrissey@intel.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
2 years agopower: remove unneeded header includes
Sean Morrissey [Mon, 20 Jun 2022 10:40:26 +0000 (10:40 +0000)]
power: remove unneeded header includes

These header includes have been flagged by the iwyu_tool
and removed.

Signed-off-by: Sean Morrissey <sean.morrissey@intel.com>
2 years agonet: remove unneeded header includes
Sean Morrissey [Mon, 20 Jun 2022 10:40:25 +0000 (10:40 +0000)]
net: remove unneeded header includes

These header includes have been flagged by the iwyu_tool
and removed.

Signed-off-by: Sean Morrissey <sean.morrissey@intel.com>
2 years agometer: remove unneeded header includes
Sean Morrissey [Mon, 20 Jun 2022 10:40:24 +0000 (10:40 +0000)]
meter: remove unneeded header includes

These header includes have been flagged by the iwyu_tool
and removed.

Signed-off-by: Sean Morrissey <sean.morrissey@intel.com>
2 years agojobstats: remove unneeded header includes
Sean Morrissey [Mon, 20 Jun 2022 10:40:23 +0000 (10:40 +0000)]
jobstats: remove unneeded header includes

These header includes have been flagged by the iwyu_tool
and removed.

Signed-off-by: Sean Morrissey <sean.morrissey@intel.com>
2 years agohash: remove unneeded header includes
Sean Morrissey [Mon, 20 Jun 2022 10:40:22 +0000 (10:40 +0000)]
hash: remove unneeded header includes

These header includes have been flagged by the iwyu_tool
and removed.

Signed-off-by: Sean Morrissey <sean.morrissey@intel.com>
2 years agogso: remove unneeded header includes
Sean Morrissey [Mon, 20 Jun 2022 10:40:21 +0000 (10:40 +0000)]
gso: remove unneeded header includes

These header includes have been flagged by the iwyu_tool
and removed.

Signed-off-by: Sean Morrissey <sean.morrissey@intel.com>
2 years agogpudev: remove unneeded header includes
Sean Morrissey [Mon, 20 Jun 2022 10:40:20 +0000 (10:40 +0000)]
gpudev: remove unneeded header includes

These header includes have been flagged by the iwyu_tool
and removed.

Signed-off-by: Sean Morrissey <sean.morrissey@intel.com>
2 years agoethdev: remove unneeded header includes
Sean Morrissey [Mon, 20 Jun 2022 10:40:19 +0000 (10:40 +0000)]
ethdev: remove unneeded header includes

These header includes have been flagged by the iwyu_tool
and removed.

Signed-off-by: Sean Morrissey <sean.morrissey@intel.com>
2 years agoeal: remove unneeded header includes
Sean Morrissey [Mon, 20 Jun 2022 10:40:18 +0000 (10:40 +0000)]
eal: remove unneeded header includes

These header includes have been flagged by the iwyu_tool
and removed.

Signed-off-by: Sean Morrissey <sean.morrissey@intel.com>
2 years agocmdline: remove unneeded header includes
Sean Morrissey [Mon, 20 Jun 2022 10:40:17 +0000 (10:40 +0000)]
cmdline: remove unneeded header includes

These header includes have been flagged by the iwyu_tool
and removed.

Signed-off-by: Sean Morrissey <sean.morrissey@intel.com>
2 years agotest/trace: add a test with traces enabled
Chengwen Feng [Fri, 17 Jun 2022 02:29:13 +0000 (10:29 +0800)]
test/trace: add a test with traces enabled

Currently trace_autotest unit test is executed with traces disabled.
This patch introduces trace_autotest unit test with traces enabled,
and the traces file is written to the directory where dpdk-test is
located.

Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
2 years agotrace: fix init with long file prefix
Chengwen Feng [Fri, 17 Jun 2022 02:29:11 +0000 (10:29 +0800)]
trace: fix init with long file prefix

Bug scenario:
1. start testpmd:
  $ dpdk-testpmd -l 4-6 -a 0000:7d:00.0 --trace=.* \
    --file-prefix=trace_autotest -- -i
2. then observed:
  EAL: eal_trace_init():93 failed to initialize trace [File exists]
  EAL: FATAL: Cannot init trace
  EAL: Cannot init trace
  EAL: Error - exiting with code: 1

The root cause it that the offset set wrong with long file-prefix and
then lead the strftime return failed.

At the same time, trace_session_name_generate() uses errno as the return
value, but the errno was not set if strftime returned zero.
A previously set errno (EEXIST or ENOENT from call to mkdir for creating
the runtime configuration directory) was returned in this case.
This is fragile and may lead to incorrect logic if errno was set
to 0 previously.
This also resulted in inaccurate prompting.
Set errno to ENOSPC if strftime return zero.

Fixes: 321dd5f8fa62 ("trace: add internal init and fini interface")
Cc: stable@dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
2 years agotrace: fix crash when exiting
Chengwen Feng [Fri, 17 Jun 2022 02:29:10 +0000 (10:29 +0800)]
trace: fix crash when exiting

Bug scenario:
1. start testpmd:
  $ dpdk-testpmd -l 4-6 -a 0000:7d:00.0 --trace=.* -- -i
2. quit testpmd and then observed segment fault:
  Bye...
  Segmentation fault (core dumped)

The root cause is that rte_trace_save() and eal_trace_fini() access
the huge pages which were cleanup by rte_eal_memory_detach().

This patch moves rte_trace_save() and eal_trace_fini() before
rte_eal_memory_detach() to fix the bug.

Fixes: dfbc61a2f9a6 ("mem: detach memsegs on cleanup")
Cc: stable@dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Tested-by: Jerin Jacob <jerinj@marvell.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
2 years agoraw/ifpga: add HE-HSSI AFU driver
Wei Huang [Thu, 16 Jun 2022 03:00:34 +0000 (23:00 -0400)]
raw/ifpga: add HE-HSSI AFU driver

HE-HSSI is one of the host exerciser modules in OFS FPGA,
which is used to test HSSI (High Speed Serial Interface).
This driver initialize the module and report test result.

Signed-off-by: Wei Huang <wei.huang@intel.com>
Acked-by: Tianfei Zhang <tianfei.zhang@intel.com>
Reviewed-by: Rosen Xu <rosen.xu@intel.com>
2 years agoraw/ifpga: add HE-MEM AFU driver
Wei Huang [Thu, 16 Jun 2022 03:00:33 +0000 (23:00 -0400)]
raw/ifpga: add HE-MEM AFU driver

HE-MEM is one of the host exerciser modules in OFS FPGA,
which is used to test local memory with built-in traffic
generator.
This driver initialize the module and report test result.

Signed-off-by: Wei Huang <wei.huang@intel.com>
Acked-by: Tianfei Zhang <tianfei.zhang@intel.com>
Reviewed-by: Rosen Xu <rosen.xu@intel.com>
2 years agoraw/ifpga: add HE-LPBK AFU driver
Wei Huang [Thu, 16 Jun 2022 03:00:32 +0000 (23:00 -0400)]
raw/ifpga: add HE-LPBK AFU driver

HE-LPBK and HE-MEM-LPBK are host exerciser modules in OFS FPGA,
HE-LPBK is used to test PCI bus and HE-MEM-LPBK is used to test
local memory.
This driver initialize the modules and report test result.

Signed-off-by: Wei Huang <wei.huang@intel.com>
Acked-by: Tianfei Zhang <tianfei.zhang@intel.com>
Reviewed-by: Rosen Xu <rosen.xu@intel.com>
2 years agoraw/ifpga: add N3000 AFU driver
Wei Huang [Thu, 16 Jun 2022 03:00:31 +0000 (23:00 -0400)]
raw/ifpga: add N3000 AFU driver

N3000 AFU includes NLB0 and DMA modules, NLB0 is used to test PCI bus
and DMA is used to test local memory.
This driver initialize the modules and report test result.

Signed-off-by: Wei Huang <wei.huang@intel.com>
Acked-by: Tianfei Zhang <tianfei.zhang@intel.com>
Reviewed-by: Rosen Xu <rosen.xu@intel.com>
2 years agoraw/ifpga: introduce AFU driver framework
Wei Huang [Thu, 16 Jun 2022 03:00:30 +0000 (23:00 -0400)]
raw/ifpga: introduce AFU driver framework

AFU (Acceleration Function Unit) is part of FPGA and enumerated
by ifpga driver.
This driver implements common AFU device interfaces and exposes
them to application as standard raw device APIs.
Normally application can operate specified AFU as below,
1. call rte_rawdev_pmd_get_named_dev() to find AFU device.
2. call rte_rawdev_configure() to initialize AFU device.
3. call rte_rawdev_selftest() to test AFU device.

Signed-off-by: Wei Huang <wei.huang@intel.com>
Acked-by: Tianfei Zhang <tianfei.zhang@intel.com>
Reviewed-by: Rosen Xu <rosen.xu@intel.com>
2 years agoraw/ifpga/base: add PMCI sensor driver
Wei Huang [Fri, 17 Jun 2022 07:19:35 +0000 (03:19 -0400)]
raw/ifpga/base: add PMCI sensor driver

N6000 ADP platform support more sensors than N3000, they are
accessed with the help of PMCI sensor driver.

Signed-off-by: Wei Huang <wei.huang@intel.com>
Acked-by: Tianfei Zhang <tianfei.zhang@intel.com>
Reviewed-by: Rosen Xu <rosen.xu@intel.com>
2 years agoraw/ifpga/base: update flash operation interface
Wei Huang [Fri, 17 Jun 2022 07:19:34 +0000 (03:19 -0400)]
raw/ifpga/base: update flash operation interface

In N6000 ADP platform, SPI protocol, master and QSPI flash are
transparent to host software. The SPI master implemented in PMCI
automatically converts the mailbox commands to the SPI protocol
required by SPI slave.
That means flash operation is different from old platform, new
interfaces are introduced to adapt these changes.

Signed-off-by: Wei Huang <wei.huang@intel.com>
Acked-by: Tianfei Zhang <tianfei.zhang@intel.com>
Reviewed-by: Rosen Xu <rosen.xu@intel.com>
2 years agoraw/ifpga/base: update board information
Wei Huang [Fri, 17 Jun 2022 07:19:33 +0000 (03:19 -0400)]
raw/ifpga/base: update board information

N6000 ADP platform has different definition of board information,
they can be recognized after this patch.

Signed-off-by: Wei Huang <wei.huang@intel.com>
Acked-by: Tianfei Zhang <tianfei.zhang@intel.com>
Reviewed-by: Rosen Xu <rosen.xu@intel.com>
2 years agoraw/ifpga/base: add PMCI base driver
Wei Huang [Fri, 17 Jun 2022 07:19:32 +0000 (03:19 -0400)]
raw/ifpga/base: add PMCI base driver

PMCI (Platform Management Control Interface) is a new module in FPGA,
which is designed to cooperate with BMC chip to fulfill board management
functions.
This base driver implements interfaces to access registers of BMC chip.

Signed-off-by: Wei Huang <wei.huang@intel.com>
Acked-by: Tianfei Zhang <tianfei.zhang@intel.com>
Reviewed-by: Rosen Xu <rosen.xu@intel.com>
2 years agoraw/ifpga: fix file handle leak
Wei Huang [Thu, 9 Jun 2022 08:50:09 +0000 (04:50 -0400)]
raw/ifpga: fix file handle leak

Coverity issue: 379064
Fixes: 673c897f4d73 ("raw/ifpga: support OFS card probing")

Signed-off-by: Wei Huang <wei.huang@intel.com>
Acked-by: Tianfei Zhang <tianfei.zhang@intel.com>
Reviewed-by: Rosen Xu <rosen.xu@intel.com>
2 years agomaintainers: update for testpmd
Xiaoyun Li [Mon, 13 Jun 2022 08:36:57 +0000 (16:36 +0800)]
maintainers: update for testpmd

Resigning my maintainership for testpmd.

Signed-off-by: Xiaoyun Li <xiaoyun.li@intel.com>
Acked-by: Yuying Zhang <yuying.zhang@intel.com>
2 years agopipeline: rework optimization pattern for header generation
Cristian Dumitrescu [Thu, 16 Jun 2022 14:16:45 +0000 (15:16 +0100)]
pipeline: rework optimization pattern for header generation

The P4 language requires marking a header as valid before any of the
header fields are written as opposed to after the writes are done.
Hence, the optimization of replacing the sequence of instructions to
generate a header by reading it from the table action data with a
single DMA internal instruction are reworked from "mov all + validate
-> dma" to "validate + mov all -> dma".

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2 years agopipeline: fix check maximum learner table timeouts
Harshad Narayane [Thu, 16 Jun 2022 09:14:55 +0000 (10:14 +0100)]
pipeline: fix check maximum learner table timeouts

Fix comparison used to check against the maximum number of learner
table timeouts.

Fixes: e2ecc53582fb ("pipeline: improve learner table timers")

Signed-off-by: Harshad Narayane <harshad.suresh.narayane@intel.com>
Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2 years agopipeline: fix packet mirroring configuration
Cristian Dumitrescu [Mon, 13 Jun 2022 17:28:34 +0000 (18:28 +0100)]
pipeline: fix packet mirroring configuration

Fix segmentation fault due to null pointer dereferencing inside the
"mirror" instruction when number of mirroring slots is set to 0. This
was taking place when the "mirror" instruction was used without the
mirror feature being properly configured, i.e. the API function
rte_swx_pipeline_mirroring_config was not called at initialization.

Fixes: dac0ecd9098 ("pipeline: support packet mirroring")

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2 years agodma/hisilicon: fix includes in header file
Min Hu (Connor) [Tue, 14 Jun 2022 09:33:19 +0000 (17:33 +0800)]
dma/hisilicon: fix includes in header file

Header files should be self contained. This patch fixed it.

Fixes: 9e16317a38f9 ("dma/hisilicon: add probing")
Cc: stable@dpdk.org
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
2 years agodma/skeleton: support multiple instances
Sivaprasad Tummala [Wed, 8 Jun 2022 08:50:07 +0000 (16:50 +0800)]
dma/skeleton: support multiple instances

DPDK app can support multiple hardware DMA instances.
With DMA skeleton, only a single instance can be configured.

This patch supports multiple driver instances per device.

Signed-off-by: Sivaprasad Tummala <sivaprasad.tummala@amd.com>
Tested-by: Vipin Varghese <vipin.varghese@amd.com>
Reviewed-by: Chengwen Feng <fengchengwen@huawei.com>
Tested-by: Chengwen Feng <fengchengwen@huawei.com>
2 years agotest/dma: reset last index before checking completion
Chengwen Feng [Wed, 8 Jun 2022 08:50:06 +0000 (16:50 +0800)]
test/dma: reset last index before checking completion

Some DMA PMD may not update last-idx when no DMA completed, the
previous patch [1] cannot detect this problem actually.

This patch resets last-idx before invoking DMA completed ops to fix it.

[1] test/dma: check index when no DMA completed

Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
2 years agodma/skeleton: fix index returned when no memcpy completed
Chengwen Feng [Wed, 8 Jun 2022 08:50:05 +0000 (16:50 +0800)]
dma/skeleton: fix index returned when no memcpy completed

If no memcopy request is completed, the ring_idx of the last completed
operation need returned by last_idx parameter. This patch fixes it.

Fixes: 05d5fc66a269 ("dma/skeleton: introduce skeleton driver")
Cc: stable@dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
2 years agoapp/flow-perf: fix build with GCC 12
David Marchand [Wed, 18 May 2022 10:16:56 +0000 (12:16 +0200)]
app/flow-perf: fix build with GCC 12

GCC 12 raises the following warning:

../app/test-flow-perf/main.c: In function ‘start_forwarding’:
../app/test-flow-perf/main.c:1737:28: error: ‘sprintf’ may write a
    terminating nul past the end of the destination
    [-Werror=format-overflow=]
 1737 |         sprintf(p[i++], "%d", (int)n);
      |                            ^
In function ‘pretty_number’,
    inlined from ‘packet_per_second_stats’ at
        ../app/test-flow-perf/main.c:1792:4,
    inlined from ‘start_forwarding’ at
        ../app/test-flow-perf/main.c:1831:3:
[...]

We can simplify this code and rely on libc integer formatting via
this system locales.

Bugzilla ID: 856
Cc: stable@dpdk.org
Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
2 years agovdpa/ifc: fix build with GCC 12
David Marchand [Wed, 18 May 2022 10:16:54 +0000 (12:16 +0200)]
vdpa/ifc: fix build with GCC 12

GCC 12 raises the following warning:

../drivers/vdpa/ifc/ifcvf_vdpa.c: In function ‘vdpa_enable_vfio_intr’:
../drivers/vdpa/ifc/ifcvf_vdpa.c:383:62: error: writing 4 bytes into a
    region of size 0 [-Werror=stringop-overflow=]
  383 |                         fd_ptr[RTE_INTR_VEC_RXTX_OFFSET + i] = fd;
      |                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
../drivers/vdpa/ifc/ifcvf_vdpa.c:348:14: note: at offset 32 into
    destination object ‘irq_set_buf’ of size 32
  348 |         char irq_set_buf[MSIX_IRQ_SET_BUF_LEN];
      |              ^~~~~~~~~~~

Validate number of vrings to avoid out of bound access.

Bugzilla ID: 855
Cc: stable@dpdk.org
Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Xiao Wang <xiao.w.wang@intel.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
2 years agonet/ice: fix build with GCC 12
David Marchand [Wed, 18 May 2022 10:16:51 +0000 (12:16 +0200)]
net/ice: fix build with GCC 12

GCC 12 raises the following warning:

In file included from ../lib/mempool/rte_mempool.h:46,
                 from ../lib/mbuf/rte_mbuf.h:38,
                 from ../lib/net/rte_ether.h:22,
                 from ../lib/ethdev/rte_ethdev.h:172,
                 from ../lib/ethdev/ethdev_driver.h:22,
                 from ../lib/ethdev/ethdev_pci.h:17,
                 from ../drivers/net/ice/ice_ethdev.c:6:
../drivers/net/ice/ice_ethdev.c: In function ‘ice_dev_configure’:
../lib/eal/x86/include/rte_memcpy.h:370:9: warning: array subscript 64 is
        outside array bounds of ‘struct ice_aqc_get_set_rss_keys[1]’
        [-Warray-bounds]
  370 | rte_mov32((uint8_t *)dst + 2 * 32, (const uint8_t *)src + 2 * 32);
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../drivers/net/ice/ice_ethdev.c:3202:41: note: while referencing ‘key’
 3202 |         struct ice_aqc_get_set_rss_keys key;
      |                                         ^~~

Restrict copy to minimum size.

Bugzilla ID: 850
Cc: stable@dpdk.org
Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
2 years agonet/enetfec: fix build with GCC 12
David Marchand [Wed, 18 May 2022 10:16:50 +0000 (12:16 +0200)]
net/enetfec: fix build with GCC 12

GCC 12 raises the following warning:

../drivers/net/enetfec/enet_ethdev.c: In function
        ‘enetfec_rx_queue_setup’:
../drivers/net/enetfec/enet_ethdev.c:473:9: error: array
        subscript 1 is
    above array bounds of ‘uint32_t[1]’ {aka ‘unsigned int[1]’}
        [-Werror=array-bounds]
  473 | rte_write32(rte_cpu_to_le_32(fep->bd_addr_p_r[queue_idx]),
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  474 |     (uint8_t *)fep->hw_baseaddr_v + ENETFEC_RD_START(queue_idx));
      |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ../drivers/net/enetfec/enet_ethdev.c:9:
../drivers/net/enetfec/enet_ethdev.h:113:33: note: while referencing
        ‘bd_addr_p_r’
  113 | uint32_t                bd_addr_p_r[ENETFEC_MAX_Q];
      |                                 ^~~~~~~~~~~

This driver properly announces that it only supports 1 rxq.
Silence this warning by adding an explicit check on the queue id.

Cc: stable@dpdk.org
Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Sachin Saxena <sachin.saxena@nxp.com>
2 years agonet/ena: fix build with GCC 12
David Marchand [Wed, 18 May 2022 10:16:49 +0000 (12:16 +0200)]
net/ena: fix build with GCC 12

GCC 12 raises the following warning:

In file included from ../lib/mempool/rte_mempool.h:46,
                 from ../lib/mbuf/rte_mbuf.h:38,
                 from ../lib/net/rte_ether.h:22,
                 from ../drivers/net/ena/ena_ethdev.h:10,
                 from ../drivers/net/ena/ena_rss.c:6:
../drivers/net/ena/ena_rss.c: In function ‘ena_rss_key_fill’:
../lib/eal/x86/include/rte_memcpy.h:370:9: warning: array subscript 64 is
        outside array bounds of ‘uint8_t[40]’
        {aka ‘unsigned char[40]’} [-Warray-bounds]
  370 | rte_mov32((uint8_t *)dst + 2 * 32, (const uint8_t *)src + 2 * 32);
      | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../drivers/net/ena/ena_rss.c:51:24: note: while referencing ‘default_key’
   51 | static uint8_t default_key[ENA_HASH_KEY_SIZE];
      |                ^~~~~~~~~~~

This is a false positive because the copied size is checked against
ENA_HASH_KEY_SIZE in a (build) assert.
Silence this warning by calling memcpy with the minimal size.

Bugzilla ID: 849
Cc: stable@dpdk.org
Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
2 years agocrypto/ipsec_mb: fix build with GCC 12
David Marchand [Wed, 18 May 2022 10:16:48 +0000 (12:16 +0200)]
crypto/ipsec_mb: fix build with GCC 12

GCC 12 raises the following warning:

In function ‘__rte_ring_enqueue_elems_64’,
    inlined from ‘__rte_ring_enqueue_elems’ at
        ../lib/ring/rte_ring_elem_pvt.h:130:3,
    inlined from ‘__rte_ring_do_hts_enqueue_elem’ at
        ../lib/ring/rte_ring_hts_elem_pvt.h:196:3,
    inlined from ‘rte_ring_mp_hts_enqueue_burst_elem’ at
        ../lib/ring/rte_ring_hts.h:110:9,
    inlined from ‘rte_ring_enqueue_burst_elem’ at
        ../lib/ring/rte_ring_elem.h:577:10,
    inlined from ‘rte_ring_enqueue_burst’ at
        ../lib/ring/rte_ring.h:738:9,
    inlined from ‘process_op_bit’ at
        ../drivers/crypto/ipsec_mb/pmd_snow3g.c:425:16,
    inlined from ‘snow3g_pmd_dequeue_burst’ at
        ../drivers/crypto/ipsec_mb/pmd_snow3g.c:484:20:
../lib/ring/rte_ring_elem_pvt.h:68:44: error: array subscript 1 is
        outside array bounds of ‘struct rte_crypto_op[0]’
        [-Werror=array-bounds]
   68 |                         ring[idx + 1] = obj[i + 1];
      |                                         ~~~^~~~~~~
../drivers/crypto/ipsec_mb/pmd_snow3g.c: In function
        ‘snow3g_pmd_dequeue_burst’:
../drivers/crypto/ipsec_mb/pmd_snow3g.c:434:1: note:
        at offset 8 into object ‘op’ of size 8
  434 | snow3g_pmd_dequeue_burst(void *queue_pair,
      | ^~~~~~~~~~~~~~~~~~~~~~~~

Validate that one (exactly) op has been processed or return early.

Fixes: b537abdbee74 ("crypto/snow3g: support bit-level operations")
Cc: stable@dpdk.org
Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
2 years agoci: enable C++ check for RISC-V
Stanislaw Kardach [Thu, 9 Jun 2022 12:17:01 +0000 (14:17 +0200)]
ci: enable C++ check for RISC-V

The current packages installed for RISC-V build check do not contain a
C++ compiler, which hid an issue with C++ type conversion in the
rte_vect.h header on RISC-V or in the scalar implementation of the LPM
x4 lookup. Now that this issue is fixed, use the full toolchain install
to enable the C++ test.

Besides, the user's guide for RISC-V cross-compilation recommends the
use of crossbuild-essential-riscv64.

Signed-off-by: Stanislaw Kardach <kda@semihalf.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
Acked-by: Aaron Conole <aconole@redhat.com>
2 years agolpm: fix scalar version header for C++
Stanislaw Kardach [Thu, 9 Jun 2022 12:17:00 +0000 (14:17 +0200)]
lpm: fix scalar version header for C++

rte_xmm_t is a union type which wraps around xmm_t and maps its contents
to scalar structures. Since C++ has stricter type conversion rules than
C, the rte_xmm_t::x has to be used instead of C-casting.

The generated assembly is identical to the code without the fix (checked
both on x86 and RISC-V).

Fixes: 406937f89ffd ("lpm: add scalar version of lookupx4")

Signed-off-by: Stanislaw Kardach <kda@semihalf.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
2 years agoeal/riscv: fix vector header for C++
Stanislaw Kardach [Thu, 9 Jun 2022 12:16:59 +0000 (14:16 +0200)]
eal/riscv: fix vector header for C++

rte_xmm_t is a union type which wraps around xmm_t and maps its contents
to scalar structures. Since C++ has stricter type conversion rules than
C, the rte_xmm_t::x has to be used instead of C-casting.

Fixes: f22e705ebf12 ("eal/riscv: support RISC-V architecture")

Signed-off-by: Stanislaw Kardach <kda@semihalf.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
2 years agoconfig: remove explicit undef of unset values
Bruce Richardson [Thu, 16 Dec 2021 11:14:30 +0000 (11:14 +0000)]
config: remove explicit undef of unset values

Rather than explicitly clearing any setting of undefined values in our
rte_config.h file, it's better to instead just add a comment that the
value is not set. Using a comment allows the user to set the value using
CFLAGS or similar mechanism without the config file clearing the value
again.

The text used "<VALUE> is not set" is modelled after the kernel approach
of doing the same thing.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
Acked-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
Signed-off-by: David Marchand <david.marchand@redhat.com>
2 years agobuild: add ccache for cross compilation
Jerin Jacob [Wed, 8 Jun 2022 17:13:04 +0000 (22:43 +0530)]
build: add ccache for cross compilation

By default, ccache is not used for cross build[1].
Update all cross files to use ccache if it is available
in build machine.

Also, updated devtools/test-meson-builds.sh
script to find the correct DPDK_TARGET due to
change in cross file syntax.

[1]
https://mesonbuild.com/Machine-files.html

Signed-off-by: Jerin Jacob <jerinj@marvell.com>
Acked-by: Stanislaw Kardach <kda@semihalf.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
Acked-by: Ruifeng Wang <ruifeng.wang@arm.com>
2 years agotest: validate test names in non interactive mode
Bruce Richardson [Fri, 10 Jun 2022 14:24:06 +0000 (15:24 +0100)]
test: validate test names in non interactive mode

When passing in test names to run via either the DPDK_TEST environment
variable or via extra argv parameters, the checks run on those commands
can miss valid commands that are registered with the cmdline library in
the initial context used to set it up. This is seen in the fact that the
"dump_*" set of commands are not callable via argv parameters, but can
be called manually.

To fix this, just use the commandline library to validate each command
before executing it, stopping execution when an error is encountered.
This also has the benefit of not having the test binary drop to
interactive mode if all commandline parameters given are invalid.

Bugzilla ID: 1002
Fixes: 9b848774a5dc ("test: use env variable to run tests")
Fixes: ace2f054ed43 ("test: take test names from command line")

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
2 years agocmdline: add function to verify valid commands
Bruce Richardson [Fri, 10 Jun 2022 14:24:05 +0000 (15:24 +0100)]
cmdline: add function to verify valid commands

The cmdline library cmdline_parse() function parses a command and
executes the action automatically too. The cmdline_valid_buffer function
also uses this function to validate commands, meaning that there is no
function to validate a command as ok without executing it.

To fix this omission, we extract the body of cmdline_parse into a new
static inline function with an extra parameter to indicate whether the
action should be performed or not. Then we create two wrappers around
that - a replacement for the existing cmdline_parse function where the
extra parameter is "true" to execute the command, and a new function
"cmdline_parse_check" which passes the parameter as "false" to perform
cmdline validation only.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Tested-by: Weiyuan Li <weiyuanx.li@intel.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
2 years agoversion: 22.07-rc1
Thomas Monjalon [Wed, 8 Jun 2022 19:43:41 +0000 (21:43 +0200)]
version: 22.07-rc1

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
2 years agodevtools: unify cross-compilation tests
Thomas Monjalon [Wed, 8 Jun 2022 15:36:40 +0000 (17:36 +0200)]
devtools: unify cross-compilation tests

Reduce the number of Arm builds from 3 to 1:
only generic armv8 with GCC.
The specific PPC builds on Ubuntu are skipped.

The build directories for PPC and RISC-V
are also renamed for consistency:
- build-arm64-generic-gcc
- build-ppc64-power8-gcc
- build-riscv64-generic-gcc

The cross file is always saved in variable "f" for readability.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: David Marchand <david.marchand@redhat.com>
2 years agokni: use dedicated function to set MAC address
Ke Zhang [Wed, 8 Jun 2022 12:11:17 +0000 (15:11 +0300)]
kni: use dedicated function to set MAC address

The warning info:
warning: passing argument 1 of ‘memcpy’ discards ‘const’
qualifier from pointer target type

Variable dev_addr is done const intentionally in v5.17 to prevent using
it directly.  See the following Linux kernel changeset for details:

commit adeef3e32146 ("net: constify netdev->dev_addr")

Used helper function was introduced earlier in v5.15.

Fixes: ea6b39b5b847 ("kni: remove ethtool support")
Cc: stable@dpdk.org
Signed-off-by: Ke Zhang <ke1x.zhang@intel.com>
Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Acked-by: Ferruh Yigit <ferruh.yigit@xilinx.com>
2 years agokni: use dedicated function to set random MAC address
Ke Zhang [Wed, 8 Jun 2022 12:11:16 +0000 (15:11 +0300)]
kni: use dedicated function to set random MAC address

eth_hw_addr_random() sets address type correctly.

eth_hw_addr_random() is available since Linux v3.4, so
no compat is required.

Also fix the warning:
warning: passing argument 1 of ‘memcpy’ discards ‘const’
qualifier from pointer target type

Variable dev_addr is done const intentionally in Linux v5.17 to
prevent using it directly.

Fixes: ea6b39b5b847 ("kni: remove ethtool support")
Cc: stable@dpdk.org
Signed-off-by: Ke Zhang <ke1x.zhang@intel.com>
Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Acked-by: Ferruh Yigit <ferruh.yigit@xilinx.com>
2 years agoethdev: introduce available Rx descriptors threshold
Spike Du [Wed, 8 Jun 2022 16:35:28 +0000 (19:35 +0300)]
ethdev: introduce available Rx descriptors threshold

A new event RTE_ETH_EVENT_RX_AVAIL_THRESH should be generated by HW
when number of available descriptors in Rx queue goes below the
threshold.

The threshold is defined as a percentage of an Rx queue size with valid
values from 0 to 99 (inclusive). Zero (default) value disables it.

There is no capability reporting for the feature. Application should
simply try to set required threshold value and handle result.

Add testpmd commands to control the threshold:
  set port <port_id> rxq <rxq_id> avail_thresh <avail_thresh_num>

Signed-off-by: Spike Du <spiked@nvidia.com>
Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
2 years agokernel/linux: get kernel version from kernel source
Ferdinand Thiessen [Thu, 3 Mar 2022 13:15:43 +0000 (14:15 +0100)]
kernel/linux: get kernel version from kernel source

When building the kernel modules, try to get the kernel version from
the kernel sources first.
This fixes the kernel modules installation directory if the target kernel
version differs from the host kernel version, like for CI build or when
packaging for linux distributions.

Signed-off-by: Ferdinand Thiessen <rpm@fthiessen.de>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Tested-by: Ferruh Yigit <ferruh.yigit@intel.com>
2 years agonet/tap: fix device freeing
Yunjian Wang [Tue, 7 Jun 2022 06:50:57 +0000 (14:50 +0800)]
net/tap: fix device freeing

The error path was calling rte_eth_dev_release_port() function,
which frees eth_dev->data->dev_private, and then tries to free
pmd->intr_handle, which causes the use after free issue.

The free can be moved to before the release function is called.

Fixes: d61138d4f0e ("drivers: remove direct access to interrupt handle")
Cc: stable@dpdk.org
Signed-off-by: Xiangjun Meng <mengxiangjun4@huawei.com>
Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
2 years agonet/failsafe: fix device freeing
Yunjian Wang [Tue, 7 Jun 2022 06:50:49 +0000 (14:50 +0800)]
net/failsafe: fix device freeing

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

The free can be moved to before the release function is called.

Fixes: d61138d4f0e ("drivers: remove direct access to interrupt handle")
Cc: stable@dpdk.org
Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
2 years agoapp/testpmd: fix multicast address pool leak
Ke Zhang [Fri, 25 Mar 2022 08:35:55 +0000 (08:35 +0000)]
app/testpmd: fix multicast address pool leak

A multicast address pool is allocated for a port when
using mcast_addr testpmd commands.

When closing a port or stopping testpmd, this pool was
not freed, resulting in a leak.
This issue has been caught using ASan.

Free this pool when closing the port.

Error info as following:
ERROR: LeakSanitizer: detected memory leaksDirect leak of
       192 byte(s)
0 0x7f6a2e0aeffe in __interceptor_realloc
(/lib/x86_64-linux-gnu/libasan.so.5+0x10dffe)
1 0x565361eb340f in mcast_addr_pool_extend
../app/test-pmd/config.c:5162
2 0x565361eb3556 in mcast_addr_pool_append
../app/test-pmd/config.c:5180
3 0x565361eb3aae in mcast_addr_add
../app/test-pmd/config.c:5243

Fixes: 8fff667578a7 ("app/testpmd: new command to add/remove multicast MAC addresses")
Cc: stable@dpdk.org
Signed-off-by: Ke Zhang <ke1x.zhang@intel.com>
Acked-by: Yuying Zhang <yuying.zhang@intel.com>
Acked-by: Ferruh Yigit <ferruh.yigit@xilinx.com>
2 years agoapp/testpmd: fix packet segment allocation
Raja Zidane [Thu, 2 Jun 2022 12:59:47 +0000 (15:59 +0300)]
app/testpmd: fix packet segment allocation

When --mbuf-size cmdline parameter is specified, the segments to scatter
packets on are allocated sequentially from these extra memory pools
(the mbuf for the first segment is allocated from the first pool, the
second one from the second pool, and so on, if segment number is greater
then pool’s the mbuf for remaining segments will be allocated from the
last valid pool).
A bug in comparing segment index with mbuf index caused wrong mapping
of one of the segments.

Fix the comparison.

Fixes: 2befc67ff679 ("app/testpmd: add extended Rx queue setup")
Cc: stable@dpdk.org
Signed-off-by: Raja Zidane <rzidane@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
2 years agoeal: remove unused arch-specific headers for locks
David Marchand [Wed, 8 Jun 2022 11:57:01 +0000 (13:57 +0200)]
eal: remove unused arch-specific headers for locks

MCS lock, PF lock and Ticket lock have no arch specific implementation,
there is no need for the extra redirection in headers.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Stanislaw Kardach <kda@semihalf.com>
2 years agonet/ark: support virtual functions
Ed Czeck [Tue, 7 Jun 2022 21:31:49 +0000 (17:31 -0400)]
net/ark: support virtual functions

- Add capabilities field isvf to dev struct
- Disable configuration calls as required by VF

Signed-off-by: Ed Czeck <ed.czeck@atomicrules.com>
2 years agonet/ark: support new devices
Ed Czeck [Tue, 7 Jun 2022 21:31:48 +0000 (17:31 -0400)]
net/ark: support new devices

Support new devices and update device list in doc

Signed-off-by: Ed Czeck <ed.czeck@atomicrules.com>
2 years agonet/ark: report additional errors from firmware
Ed Czeck [Tue, 7 Jun 2022 21:31:47 +0000 (17:31 -0400)]
net/ark: report additional errors from firmware

Detect and report completion errors from firmware

Signed-off-by: Ed Czeck <ed.czeck@atomicrules.com>
2 years agonet/ark: update UDM functions for firmware update
Ed Czeck [Tue, 7 Jun 2022 21:31:46 +0000 (17:31 -0400)]
net/ark: update UDM functions for firmware update

- New firmware version for UDM (Upstream Data Mover)
- Remove device-level start, stop, and reset operations
- Add queue-based start, stop and reset as required by firmware
- Remove performance structs as they are not in the firmware module

Signed-off-by: Ed Czeck <ed.czeck@atomicrules.com>
2 years agonet/ark: update DDM functions for firmware update
Ed Czeck [Tue, 7 Jun 2022 21:31:45 +0000 (17:31 -0400)]
net/ark: update DDM functions for firmware update

- New firmware version for DDM (Downstream Data Mover)
- Remove device-level start, stop, and reset operations
- Add queue-based start, stop and reset as required by firmware

Signed-off-by: Ed Czeck <ed.czeck@atomicrules.com>
2 years agonet/ark: update MPU functions for firmware update
Ed Czeck [Tue, 7 Jun 2022 21:31:44 +0000 (17:31 -0400)]
net/ark: update MPU functions for firmware update

- New firmware version for MPU (Mbuf Prefetch Unit)
- Remove device-level global operations
- Remove ark_mpu_reset_stats function

Signed-off-by: Ed Czeck <ed.czeck@atomicrules.com>