Commit Graph

3027 Commits

Author SHA1 Message Date
Hongbo Zheng
52aab95476 test: check memory allocation for CRC
The rte_zmalloc is called in test_crc_calc without null pointer
check. This patch adds null pointer checks on return value of
rte_zmalloc.

Fixes: 9c77b848b1 ("test: add CRC computation")
Cc: stable@dpdk.org

Signed-off-by: Hongbo Zheng <zhenghongbo3@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
2022-06-26 19:53:05 +02:00
Min Hu (Connor)
bb947a7264 app/procinfo: dump device private info
This patch adds support for dump the device private info
from a running application.
It can help developers locate a problem.

Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
Acked-by: Reshma Pattan <reshma.pattan@intel.com>
2022-06-26 17:51:14 +02:00
Subendu Santra
379e1d62f1 app/procinfo: show all non-owned ports
Show all non-owned ports when no port mask is specified.

The show-port option, without the mask option,
was showing only the last non-owned port.
Show all the non-owned ports instead.

Fixes: 1dd6cffb65 ("app/procinfo: provide way to request info on owned ports")
Cc: stable@dpdk.org

Signed-off-by: Subendu Santra <subendu@arista.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
2022-06-26 17:25:38 +02:00
Heinrich Schuchardt
8343fd749f test/hash: fix out of bound access
rwc_non_lf_results->multi_rw, rwc_lf_results->multi_rw, and
rwc_perf_results->multi_rw are accessed at indexes
[0..NUM_TEST-1][0..1][0..NUMTEST-1]. Currently the first index
overflows the array size in struct rwc_perf.

Fixes: c7eb0972e7 ("test/hash: add lock-free r/w concurrency")
Cc: stable@dpdk.org

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
2022-06-26 17:18:41 +02:00
Stephen Hemminger
64e14b8b07 remove unnecessary null checks
Found by nullfree.cocci.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
[David: for lpm parts:]
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Acked-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>
[David: for vdpa/mlx5 parts:]
Acked-by: Matan Azrad <matan@nvidia.com>
[David: for dma/dpaa2, raw/ifpga, vdpa/mlx5:]
Acked-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
Reviewed-by: Chengwen Feng <fengchengwen@huawei.com>
[David: reran cocci.sh and updated common/mlx5 and cryptodev asym test]
Signed-off-by: David Marchand <david.marchand@redhat.com>
2022-06-24 14:51:09 +02:00
Spike Du
f41a5092e6 app/testpmd: add host shaper command
Add command line options to support host shaper configure.
- Command syntax:
  mlx5 set port <port_id> host_shaper avail_thresh_triggered <0|1> rate
<rate_num>

- Example commands:
To enable avail_thresh_triggered on port 1 and disable current host
shaper:
testpmd> mlx5 set port 1 host_shaper avail_thresh_triggered 1 rate 0

To disable avail_thresh_triggered and current host shaper on port 1:
testpmd> mlx5 set port 1 host_shaper avail_thresh_triggered 0 rate 0

The rate unit is 100Mbps.
To disable avail_thresh_triggered and configure a shaper of 5Gbps on
port 1:
testpmd> mlx5 set port 1 host_shaper avail_thresh_triggered 0 rate 50

Add sample code to handle rxq available descriptor threshold event, it
delays a while so that rxq empties, then disables host shaper and
rearms available descriptor threshold event.

Signed-off-by: Spike Du <spiked@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
2022-06-23 17:25:04 +02:00
Don Wallwork
42fbb8e85d eal/linux: allocate worker lcore stacks in hugepages
Add support for using hugepages for worker lcore stack memory. The
intent is to improve performance by reducing stack memory related TLB
misses and also by using memory local to the NUMA node of each lcore.

EAL option '--huge-worker-stack[=stack-size-in-kbytes]' is added to allow
the feature to be enabled at runtime. If the size is not specified,
the system pthread stack size will be used.

Signed-off-by: Don Wallwork <donw@xsightlabs.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
Acked-by: Chengwen Feng <fengchengwen@huawei.com>
2022-06-23 22:36:33 +02:00
Huichao Cai
e1522b328c ip_frag: fix build with GCC 12
GCC 12 raises warnings on usage of rte_memcpy with IPv4 options handling
in fragments for both the ip_frag library and unit tests.

For example in the library:
In function ‘_mm256_storeu_si256’,
    inlined from ‘rte_mov32’ at
        ../lib/eal/x86/include/rte_memcpy.h:347:2,
    inlined from ‘rte_mov128’ at
        ../lib/eal/x86/include/rte_memcpy.h:369:2,
    inlined from ‘rte_memcpy_generic’
        at ../lib/eal/x86/include/rte_memcpy.h:445:4,
    inlined from ‘rte_memcpy’
        at ../lib/eal/x86/include/rte_memcpy.h:851:10,
    inlined from ‘__create_ipopt_frag_hdr’
        at ../lib/ip_frag/rte_ipv4_fragmentation.c:68:4,
    inlined from ‘rte_ipv4_fragment_packet’
        at ../lib/ip_frag/rte_ipv4_fragmentation.c:242:16:
/usr/lib/gcc/x86_64-redhat-linux/12/include/avxintrin.h:935:8: error:
    array subscript ‘__m256i_u[1]’ is partly outside array bounds of
    ‘uint8_t[60]’ {aka ‘unsigned char[60]’} [-Werror=array-bounds]
  935 |   *__P = __A;
      |   ~~~~~^~~~~
../lib/ip_frag/rte_ipv4_fragmentation.c: In function
    ‘rte_ipv4_fragment_packet’:
../lib/ip_frag/rte_ipv4_fragmentation.c:122:17: note: at offset [52, 60]
    into object ‘ipopt_frag_hdr’ of size 60
  122 |         uint8_t ipopt_frag_hdr[IPV4_HDR_MAX_LEN];
      |                 ^~~~~~~~~~~~~~

To resolve the compilation warning, replace the rte_memcpy with memcpy.

Fixes: b50a14a853 ("ip_frag: add IPv4 options fragment")

Signed-off-by: Huichao Cai <chcchc88@163.com>
2022-06-23 16:32:00 +02:00
Maxime Coquelin
9b4ea7ae77 app/testpmd: revert MAC update in checksum forwarding
This patch reverts
commit 10f4620f02 ("app/testpmd: modify mac in csum forwarding"),
as the checksum forwarding is expected to only perform
checksum and not also overwrites the source and destination MAC addresses.

Doing so, we can test checksum offloading with real traffic
without breaking broadcast packets.

Fixes: 10f4620f02 ("app/testpmd: modify mac in csum forwarding")
Cc: stable@dpdk.org

Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Acked-by: Chenbo Xia <chenbo.xia@intel.com>
Acked-by: Aman Singh <aman.deep.singh@intel.com>
2022-06-17 14:41:04 +02:00
David Marchand
94b3c1a725 net/i40e: move testpmd commands
Move related specific testpmd commands into this driver directory.
While at it, fix checkpatch warnings.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Ferruh Yigit <ferruh.yigit@xilinx.com>
2022-06-20 19:48:39 +02:00
David Marchand
703178f89c net/bonding: move testpmd commands
Move related specific testpmd commands into this driver directory.
While at it, fix checkpatch warnings.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Ferruh Yigit <ferruh.yigit@xilinx.com>
2022-06-20 19:48:39 +02:00
Huisong Li
3889a3220c app/testpmd: fix bonding slave devices not released
Currently, some eth devices are added to bond device, these devices are
not released when the quit command is executed in testpmd. This patch
adds the release operation for all active slaves under a bond device.

Fixes: 0e545d3047 ("app/testpmd: check stopping port is not in bonding")
Cc: stable@dpdk.org

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
Acked-by: Ferruh Yigit <ferruh.yigit@xilinx.com>
2022-06-10 10:07:40 +02:00
Huisong Li
48588943dc app/testpmd: add help messages for multi-process
This patch adds help messages for multi-process.
--num-procs=N: set the total number of multi-process instances.
--proc-id=id:  set the id of the current process from multi-process
instances(0 <= id < num-procs).

Fixes: a550baf24a ("app/testpmd: support multi-process")
Cc: stable@dpdk.org

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
Acked-by: Ferruh Yigit <ferruh.yigit@xilinx.com>
2022-06-09 16:56:41 +02:00
Huisong Li
6496922368 test/bonding: fix RSS test when disable RSS
The "test_rss_lazy" test is used for testing bonding RSS functions
when bonded port disable RSS. Currently, this test case can update
RSS functions of bonded and slave port if bonded port turns off RSS.
It is unreasonable and has been adjusted to be non-updateable in
following patch:
"93e1ea6dfa99 ethdev: fix RSS update when RSS is disabled"

So this patch fixes this test code.

Fixes: 43b630244e ("app/test: add dynamic bonding RSS configuration")
Cc: stable@dpdk.org

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Dongdong Liu <liudongdong3@huawei.com>
2022-06-09 10:47:29 +02:00
Volodymyr Fialko
f3a670783f app/eventdev: increase number of descriptors
Increase number of cryptodev queue pair descriptors by default. Current
size of 128 descriptors does not satisfying minimal requirements of crypto
drivers.

Signed-off-by: Volodymyr Fialko <vfialko@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
2022-06-20 21:28:18 +02:00
Volodymyr Fialko
3158ec9fd5 app/eventdev: add null checks for crypto allocations
Crypto operation allocation may fail in case when total size of queue
pairs are bigger than the pool size.

Signed-off-by: Volodymyr Fialko <vfialko@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
2022-06-20 21:28:10 +02:00
Shijith Thotton
67f2270798 app/eventdev: wait for workers before cryptodev destroy
Destroying cryptodev resources before exiting workers are not safe.
Moved cryptodev destroy after worker thread exit in main thread.

Fixes: de2bc16e1b ("app/eventdev: add crypto producer mode")
Cc: stable@dpdk.org

Signed-off-by: Shijith Thotton <sthotton@marvell.com>
Acked-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
2022-06-13 08:56:19 +02:00
Pavan Nikhilesh
c9043624e3 app/eventdev: add Tx first option to pipeline mode
Add Tx first support to pipeline mode tests, the transmission is done
on all the ethernet ports. This helps in testing eventdev performance
with standalone loopback interfaces.

Example:
./dpdk-test-eventdev ... -- ... --tx_first 512

512 defines the number of packets to transmit.
Add an option Tx packet size, the default packet size is 64.

Following example can change packet size value as 320.

Example:
./dpdk-test-eventdev ... -- ... --tx_first 512 --tx_pkt_sz 320

Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
2022-06-13 07:59:42 +02:00
Pavan Nikhilesh
d67332bca0 app/eventdev: use mempool cache for vector pool
Use mempool cache for vector mempool as vectors are freed by the Tx
routine, also increase the minimum pool size to 512 to avoid resource
contention on Rx.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
2022-06-13 07:58:23 +02:00
Vladimir Medvedkin
3ab95f3d1c test/ipsec: fix performance test
This patch initializes with 0 rte_ipsec_sa_prm inside the
ipsec_sa struct.
Before it was passed uninitialized to rte_ipsec_sa_init(),
which does not check whether prm->ipsec_xform.esn.value is
greater than sa->sqn_mask.

Bugzilla ID: 1023
Fixes: f7f3ac6dcb ("test/ipsec: add performance cases")
Cc: stable@dpdk.org

Signed-off-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>
2022-06-21 20:04:50 +02:00
Ciara Power
7a0f8fe76b test/crypto: fix cipher offset for ZUC
The cipher offset in bits was not being used in ZUC encryption test
functions when creating the operation, it was hardcoded to 0.
This is fixed to use the offset from the test vector as intended.

Fixes: fd01a9be38 ("test/crypto: move IV to crypto op private data")
Cc: stable@dpdk.org

Signed-off-by: Ciara Power <ciara.power@intel.com>
Acked-by: Kai Ji <kai.ji@intel.com>
2022-06-21 20:04:50 +02:00
Kai Ji
4c7ae22f1f crypto/openssl: update DSA routine with 3.0 EVP API
This patch updates asymmetric DSA routine in crypto openssl pmd
to adopt openssl 3.0 EVP apis. Divided the single combined DSA sign
test to two individual DSA sign and DSA verfiy tests.

Signed-off-by: Kai Ji <kai.ji@intel.com>
Acked-by: Fan Zhang <roy.fan.zhang@intel.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
2022-06-21 20:04:50 +02:00
Stanislaw Kardach
ce7323f6f6 test/ipsec: check for devices before testing
Make sure that ipsec_perf_autotest checks if there are any crypto
devices available before it starts performance testing.
Same test is performed in the ipsec_autotest so it seems prudent to do
it here too to not introduce false failures.

Signed-off-by: Stanislaw Kardach <kda@semihalf.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
2022-06-21 20:04:50 +02:00
David Marchand
6e108b6a7c test/ipsec: fix build with GCC 12
GCC 12 raises the following warning:

In function ‘_mm256_loadu_si256’,
    inlined from ‘rte_mov32’ at
        ../lib/eal/x86/include/rte_memcpy.h:319:9,
    inlined from ‘rte_mov128’ at
        ../lib/eal/x86/include/rte_memcpy.h:344:2,
    inlined from ‘rte_memcpy_generic’ at
        ../lib/eal/x86/include/rte_memcpy.h:438:4,
    inlined from ‘rte_memcpy’ at
        ../lib/eal/x86/include/rte_memcpy.h:882:10,
    inlined from ‘setup_test_string.constprop’ at
        ../app/test/test_ipsec.c:572:4:
/usr/lib/gcc/x86_64-redhat-linux/12/include/avxintrin.h:929:10: error:
    array subscript ‘__m256i_u[3]’ is partly outside array bounds of
    ‘const char[108]’ [-Werror=array-bounds]
  929 |   return *__P;
      |          ^~~~
../app/test/test_ipsec.c: In function ‘setup_test_string.constprop’:
../app/test/test_ipsec.c:539:12: note: at offset 96 into object
    ‘null_plain_data’ of size 108
  539 | const char null_plain_data[] =
      |            ^~~~~~~~~~~~~~~

Add a hint so that the compiler understands the copied data is within
the passed string boundaries.

Bugzilla ID: 848
Fixes: 05fe65eb66 ("test/ipsec: introduce functional test")
Cc: stable@dpdk.org

Signed-off-by: David Marchand <david.marchand@redhat.com>
2022-06-21 20:04:50 +02:00
Gagandeep Singh
23a95dfe96 test/crypto-perf: support SDAP for PDCP operations
Add a command line option "--enable-sdap" to enable
Service Data Adaptation Protocol.

example command:
./dpdk-test-crypto-perf -c 0xc  --log-level=8 --
--devtype crypto_dpaa2_sec --optype pdcp --cipher-algo aes-ctr
--cipher-op encrypt --auth-algo zuc-eia3 --auth-op generate
--auth-key-sz 16 --ptest throughput --total-ops 100000 --burst-sz 64
--buffer-sz 64,390,1512  --pool-sz 4096 --silent --pdcp-sn-sz 12
--pdcp-domain control --enable-sdap

Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
2022-06-21 20:04:49 +02:00
Rahul Lakkireddy
694c75e8e3 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: d02c6bfcb9 ("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>
2022-06-21 20:04:49 +02:00
Nicolas Chautru
1c2d2685a5 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>
2022-06-21 20:04:49 +02:00
Stephen Hemminger
0cd10724bf 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>
2022-06-22 10:59:09 +02:00
David Marchand
9aa95b6fc4 test: drop reference to removed tests
cycles_autotest and delay_us_sleep_autotest tests were removed in the
commit ee00af6017 ("test: remove strict timing requirements some tests")
and were wrongly reintroduced later.

Bugzilla ID: 1021
Fixes: 74822233bd ("test: create a list of extra tests")
Cc: stable@dpdk.org

Signed-off-by: David Marchand <david.marchand@redhat.com>
2022-06-21 18:36:43 +02:00
Tyler Retzlaff
101f4508a2 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>
2022-06-21 17:11:46 +02:00
Tyler Retzlaff
456ed79355 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>
2022-06-21 17:10:45 +02:00
Chengwen Feng
894c7d0fae 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>
2022-06-21 11:11:00 +02:00
Chengwen Feng
1c549cdd36 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>
2022-06-15 16:15:50 +02:00
David Marchand
5fc2eece8d 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>
2022-06-15 10:21:19 +02:00
Bruce Richardson
f940a2e333 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: 9b848774a5 ("test: use env variable to run tests")
Fixes: ace2f054ed ("test: take test names from command line")

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
2022-06-13 11:18:39 +02:00
Spike Du
bc70e55948 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>
2022-06-08 21:41:00 +02:00
Ke Zhang
68629be3a6 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: 8fff667578 ("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>
2022-06-08 13:53:26 +02:00
Raja Zidane
1108c33e74 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: 2befc67ff6 ("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>
2022-06-08 13:27:47 +02:00
Michal Mazurek
3dea1b2693 test/cpuflags: add flags for RISC-V
Add checks for all flag values defined in the RISC-V misa CSR register.

Sponsored-by: Frank Zhao <frank.zhao@starfivetech.com>
Sponsored-by: Sam Grove <sam.grove@sifive.com>
Signed-off-by: Michal Mazurek <maz@semihalf.com>
Signed-off-by: Stanislaw Kardach <kda@semihalf.com>
2022-06-08 11:26:34 +02:00
Michal Mazurek
f22e705ebf eal/riscv: support RISC-V architecture
Add all necessary elements for DPDK to compile and run EAL on SiFive
Freedom U740 SoC which is based on SiFive U74-MC (ISA: rv64imafdc)
core complex.

This includes:

- EAL library implementation for rv64imafdc ISA.
- meson build structure for 'riscv' architecture. RTE_ARCH_RISCV define
  is added for architecture identification.
- xmm_t structure operation stubs as there is no vector support in the
  U74 core.

Compilation was tested on Ubuntu and Arch Linux using riscv64 toolchain.
Clang compilation currently not supported due to issues with missing
relocation relaxation.

Two rte_rdtsc() schemes are provided: stable low-resolution using rdtime
(default) and unstable high-resolution using rdcycle. User can override
the scheme by defining RTE_RISCV_RDTSC_USE_HPM=1 during compile time of
both DPDK and the application. The reasoning for this is as follows.
The RISC-V ISA mandates that clock read by rdtime has to be of constant
period and synchronized between all hardware threads within 1 tick
(chapter 10.1 in version 20191213 of RISC-V spec).
However this clock may not be of high-enough frequency for dataplane
uses. I.e. on HiFive Unmatched (FU740) it is 1MHz.
There is a high-resolution alternative in form of rdcycle which is
clocked at the core clock frequency. The drawbacks are that it may be
disabled during sleep (WFI), its frequency might change due to DVFS and
it is core-local and therefore cannot be used as a wall-clock. It can
however be used for micro-benchmarking user applications, similarly to
Aarch64's PMCCNTR PMU counter.

The platform is currently marked as linux-only because rte_cycles
implementation uses the timebase-frequency device-tree node read through
the proc file system. Such approach was chosen because Linux kernel
depends on the presence of this device-tree node.

The i40e PMD driver is disabled on RISC-V as the rv64gc ISA has no vector
operations.

The compilation of following modules has been disabled by this commit
and will be re-enabled in later commits as fixes are introduced:
net/ixgbe, net/memif, net/tap, example/l3fwd.

Sponsored-by: Frank Zhao <frank.zhao@starfivetech.com>
Sponsored-by: Sam Grove <sam.grove@sifive.com>
Signed-off-by: Michal Mazurek <maz@semihalf.com>
Signed-off-by: Stanislaw Kardach <kda@semihalf.com>
2022-06-08 11:26:20 +02:00
Anoob Joseph
96b5d4f992 app/test: count tests skipped at setup
If the setup function returns TEST_SKIPPED, the logs would say the test
case is skipped while the summary count would consider it under failed
cases. Address this by counting such test cases under 'skipped'.

Signed-off-by: Anoob Joseph <anoobj@marvell.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
2022-06-07 20:49:20 +02:00
Bruce Richardson
013b4c52c7 replace zero-length arrays with flexible ones
This patch replaces instances of zero-sized arrays i.e. those at the end
of structures with "[0]" with the more standard syntax of "[]".
Replacement was done using coccinelle script, with some revert and
cleanup of whitespace afterwards.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
2022-06-07 16:44:21 +02:00
Tyler Retzlaff
1f16100df1 test/threads: add unit test for get/set priority
Add unit tests to exercise and demonstrate rte_thread_{get,set}_priority().

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
2022-06-07 13:33:14 +02:00
Mattias Rönnblom
0bee070907 eal: add seqlock
A sequence lock (seqlock) is a synchronization primitive which allows
for data-race free, low-overhead, high-frequency reads, suitable for
data structures shared across many cores and which are updated
relatively infrequently.

A seqlock permits multiple parallel readers. A spinlock is used to
serialize writers. In cases where there is only a single writer, or
writer-writer synchronization is done by some external means, the
"raw" sequence counter type (and accompanying rte_seqcount_*()
functions) may be used instead.

To avoid resource reclamation and other issues, the data protected by
a seqlock is best off being self-contained (i.e., no pointers [except
to constant data]).

One way to think about seqlocks is that they provide means to perform
atomic operations on data objects larger than what the native atomic
machine instructions allow for.

DPDK seqlocks (and the underlying sequence counters) are not
preemption safe on the writer side. A thread preemption affects
performance, not correctness.

A seqlock contains a sequence number, which can be thought of as the
generation of the data it protects.

A reader will
  1. Load the sequence number (sn).
  2. Load, in arbitrary order, the seqlock-protected data.
  3. Load the sn again.
  4. Check if the first and second sn are equal, and even numbered.
     If they are not, discard the loaded data, and restart from 1.

The first three steps need to be ordered using suitable memory fences.

A writer will
  1. Take the spinlock, to serialize writer access.
  2. Load the sn.
  3. Store the original sn + 1 as the new sn.
  4. Perform load and stores to the seqlock-protected data.
  5. Store the original sn + 2 as the new sn.
  6. Release the spinlock.

Proper memory fencing is required to make sure the first sn store, the
data stores, and the second sn store appear to the reader in the
mentioned order.

The sn loads and stores must be atomic, but the data loads and stores
need not be.

The original seqlock design and implementation was done by Stephen
Hemminger. This is an independent implementation, using C11 atomics.

For more information on seqlocks, see
https://en.wikipedia.org/wiki/Seqlock

Acked-by: Morten Brørup <mb@smartsharesystems.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Reviewed-by: Ola Liljedahl <ola.liljedahl@arm.com>
Reviewed-by: Chengwen Feng <fengchengwen@huawei.com>
Signed-off-by: Mattias Rönnblom <mattias.ronnblom@ericsson.com>
2022-06-07 13:33:14 +02:00
Chengwen Feng
f25265f004 test/dma: check index when no DMA completed
If no DMA request is completed, the ring_idx of the last completed
operation need returned by last_idx parameter. This patch adds
testcase for it.

Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Tested-by: Kevin Laatz <kevin.laatz@intel.com>
2022-06-07 12:38:13 +02:00
Jiawei Wang
c4e442fa4c ethdev: add IPv4/IPv6 ECN header rewrite action
This patch introduces the IPv4/IPv6 ECN modify field support, and
adds the testpmd CLI commands support.

Usage:
	modify_field op set dst_type ipv4_ecn src_type ...

For example:

flow create 0 ingress group 1 pattern eth / ipv4 /  end actions
	modify_field op set dst_type ipv4_ecn src_type value src_value
	0x03 width 2 / queue index 0 / end

Signed-off-by: Jiawei Wang <jiaweiw@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
2022-06-02 11:58:38 +02:00
David Marchand
592ab76f9f app/testpmd: register driver specific commands
Introduce a testpmd API so that drivers can register specific commands.

A driver can list some files to compile with testpmd, by setting them
in the testpmd_sources (driver local) meson variable.
drivers/meson.build then takes care of appending this to a global meson
variable, and adding the driver to testpmd dependency.

Note: testpmd.h is fixed to that it is self sufficient when being
included.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
2022-05-31 17:09:12 +02:00
David Marchand
ea0774fff5 app/testpmd: mark most cmdline symbols as static
All those symbols don't need to be global, plus it was hiding unused
code such as:
- cmd_set_conntrack_dir_set and cmd_set_conntrack_dir_conntrack in
  cmdline.c,
- cmd_create_port_meter_g_action, cmd_create_port_meter_r_action,
  cmd_create_port_meter_y_action in cmdline_mtr.c,

Mark those symbols as static.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Acked-by: Ferruh Yigit <ferruh.yigit@xilinx.com>
2022-05-31 16:59:27 +02:00
Jin Liu
dfffd090c3 app/testpmd: fix help of create meter command
The help message of create meter command is incomplete,
lack of policy_id param, update help string.

Fixes: f29fa2c59b ("app/testpmd: support policy actions per color")
Cc: stable@dpdk.org

Signed-off-by: Jin Liu <jin.liu@corigine.com>
Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Signed-off-by: Niklas Söderlund <niklas.soderlund@corigine.com>
Acked-by: Ferruh Yigit <ferruh.yigit@xilinx.com>
2022-05-31 15:16:47 +02:00
Dmitry Kozlyuk
3c4426db54 app/testpmd: do not poll stopped queues
Calling Rx/Tx functions on a stopped queue is not supported.
Do not run packet forwarding for streams that use stopped queues.

Each stream has a read-only "disabled" field,
so that lcore function can skip such streams.
Forwarding engines can set this field
using a new "stream_init" callback function
by checking relevant queue states,
which are stored along with queue configurations
(not all PMDs implement rte_eth_rx/tx_queue_info_get()
to query the state from there).

Fixes: 5f4ec54f1d ("testpmd: queue start and stop")
Cc: stable@dpdk.org

Signed-off-by: Dmitry Kozlyuk <dkozlyuk@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
2022-05-25 17:25:22 +02:00