Explicitly check return value in add_specific()
CID 357760 (#2 of 2): Negative array index write (NEGATIVE_RETURNS)
8. negative_returns: Using variable ret as an index to array sad->cnt_arr
Coverity issue: 357760 Fixes: b2ee26926775 ("ipsec: add SAD add/delete/lookup implementation") Cc: stable@dpdk.org Signed-off-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com> Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Pablo de Lara [Mon, 11 May 2020 09:14:20 +0000 (10:14 +0100)]
crypto/zuc: support IPsec Multi-buffer lib v0.54
The latest version of the Intel IPSec Multi-buffer library
adds an API to authenticate multiple buffers in parallel.
The PMD is modified to use this API, improving
performance of the ZUC-EIA3 algorithm.
Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Akhil Goyal [Sat, 9 May 2020 23:12:16 +0000 (04:42 +0530)]
test/crypto: remove QAT specific check
In test_queue_pair_descriptor_setup() and
test_device_configure_invalid_queue_pair_ids a QAT specific
check is there, however the test case can be run on any PMD.
Hence removed the unnecessary check.
test_queue_pair_descriptor_setup and
test_device_configure_invalid_queue_pair_ids execution
need to be altered as the valid device values should be
configured in the end so that all other tests can be
executed.
Signed-off-by: Apeksha Gupta <apeksha.gupta@nxp.com> Signed-off-by: Akhil Goyal <akhil.goyal@nxp.com> Acked-by: Adam Dybkowski <adamx.dybkowski@intel.com> Acked-by: Anoob Joseph <anoobj@marvell.com>
Akhil Goyal [Sat, 9 May 2020 23:12:14 +0000 (04:42 +0530)]
test/crypto: run PDCP cases if supported
cryptodevs which support rte_security PDCP protocol,
can run all PDCP cases if it sets a feature flag
RTE_CRYPTODEV_FF_SECURITY. Previously, only dpaa2_sec
and dpaa_sec test suites were running these tests.
Now it is moved to generic test suite with a check
on the feature flag and the case will be skipped if it
is not supported by the PMD.
Signed-off-by: Akhil Goyal <akhil.goyal@nxp.com> Acked-by: Adam Dybkowski <adamx.dybkowski@intel.com> Acked-by: Anoob Joseph <anoobj@marvell.com>
Akhil Goyal [Sat, 9 May 2020 23:12:13 +0000 (04:42 +0530)]
test/crypto: skip unsupported session
The session init routine rte_cryptodev_sym_session_init(),
could return -ENOTSUP when the requested algo combination
is not supported by the PMD. This should be treated as
unsupported feature.
Signed-off-by: Akhil Goyal <akhil.goyal@nxp.com> Acked-by: Adam Dybkowski <adamx.dybkowski@intel.com> Acked-by: Anoob Joseph <anoobj@marvell.com>
Akhil Goyal [Sat, 9 May 2020 23:12:12 +0000 (04:42 +0530)]
test/crypto: skip unsupported session-less cases
There were some PMD specific checks to skip the case if
it is not supported. This patch checks the feature flag
RTE_CRYPTODEV_FF_SYM_SESSIONLESS if PMD supports it or not.
Signed-off-by: Apeksha Gupta <apeksha.gupta@nxp.com> Signed-off-by: Akhil Goyal <akhil.goyal@nxp.com> Acked-by: Adam Dybkowski <adamx.dybkowski@intel.com> Acked-by: Anoob Joseph <anoobj@marvell.com>
Skipped the test cases for the PMDs which do not support
RTE_CRYPTODEV_FF_NON_BYTE_ALIGNED_DATA and subsequently
removed the PMD specific checks for running that case.
Signed-off-by: Apeksha Gupta <apeksha.gupta@nxp.com> Signed-off-by: Akhil Goyal <akhil.goyal@nxp.com> Acked-by: Adam Dybkowski <adamx.dybkowski@intel.com> Acked-by: Anoob Joseph <anoobj@marvell.com>
Akhil Goyal [Sat, 9 May 2020 23:12:09 +0000 (04:42 +0530)]
cryptodev: add feature flag for non-byte aligned data
Some wireless algos like SNOW, ZUC may support input
data in bits which are not byte aligned. However, not
all PMDs can support this requirement. Hence added a
new feature flag RTE_CRYPTODEV_FF_NON_BYTE_ALIGNED_DATA
to identify which all PMDs can support non-byte aligned
data.
Signed-off-by: Akhil Goyal <akhil.goyal@nxp.com> Acked-by: Fiona Trahe <fiona.trahe@intel.com> Acked-by: Adam Dybkowski <adamx.dybkowski@intel.com> Acked-by: Anoob Joseph <anoobj@marvell.com>
Kevin Traynor [Fri, 8 May 2020 16:27:55 +0000 (17:27 +0100)]
drivers/crypto: disable gcc 10 no-common errors
gcc 10 defaults to -fno-common and as a result when linking
with crypto drivers:
drivers/librte_pmd_dpaa_sec.a(crypto_dpaa_sec_dpaa_sec.c.o):
(.bss+0x4): multiple definition of `rta_sec_era';
drivers/librte_pmd_caam_jr.a(crypto_caam_jr_caam_jr.c.o):
(.bss+0x0): first defined here
drivers/librte_pmd_dpaa2_sec.a(crypto_dpaa2_sec_dpaa2_sec_dpseci.c.o):
(.data+0x0): multiple definition of `rta_sec_era';
drivers/librte_pmd_caam_jr.a(crypto_caam_jr_caam_jr.c.o):
(.bss+0x0): first defined here
This is a blunt fix for the issue by enabling fcommon for
dpaa_sec/dpaa2_sec/caam_jr.
Ankur Dwivedi [Thu, 7 May 2020 15:26:10 +0000 (20:56 +0530)]
test/crypto: handle unsupported error on session init
The session init routine rte_cryptodev_sym_session_init(),
could return -ENOTSUP when the requested algo combination
is not supported by the PMD. This should be treated as
unsupported features. For other return values like -EINVAL
or -ENOMEM the test can be treated as failure.
examples/fips_validation: fix parsing of algorithms
Few of the NIST TDES test files don't contain TDES string.
Added indicators to identify such files. These indicators
are part of only NIST TDES test vector files.
Fixes: 527cbf3d5ee3 ("examples/fips_validation: support TDES parsing") Cc: stable@dpdk.org Signed-off-by: Archana Muniganti <marchana@marvell.com> Signed-off-by: Ayuj Verma <ayverma@marvell.com> Acked-by: Anoob Joseph <anoobj@marvell.com>
Adam Dybkowski [Wed, 6 May 2020 21:31:07 +0000 (23:31 +0200)]
common/qat: remove redundant check
This patch removed the non-essential check for NULL pointer.
Coverity issue: 357770 Fixes: c13cecf60f12 ("compress/qat: support IM buffer too small operation") Signed-off-by: Adam Dybkowski <adamx.dybkowski@intel.com> Acked-by: Fiona Trahe <fiona.trahe@intel.com>
Adam Dybkowski [Wed, 6 May 2020 11:29:43 +0000 (13:29 +0200)]
common/qat: fix enqueue/dequeue statistics
This patch fixes enqueued and dequeued count statistics that should
contain the number of operations enqueued by the end user app
instead of the total number of QAT requests - bigger in case of
a multiple-request dynamic Huffman compression operation.
Fixes: c13cecf60f12 ("compress/qat: support IM buffer too small operation") Signed-off-by: Adam Dybkowski <adamx.dybkowski@intel.com> Acked-by: Fiona Trahe <fiona.trahe@intel.com>
Praveen Shetty [Wed, 6 May 2020 11:02:41 +0000 (12:02 +0100)]
examples/ipsec-secgw: fix ESP flow error log
Function create_ipsec_esp_flow returns a negative number in case of any
failure and we are passing this to strerror to display the error message.
But strerror()'s argument cannot be negative.
In case of failure, displaying exact error message to console is handled
in create_ipsec_esp_flow function.
So it is not required to print the error message again using strerror.
This patch will remove the unnecessary calling of strerror function
to fix the negative argument passing to strerror issue.
Kevin Traynor [Wed, 6 May 2020 09:45:18 +0000 (10:45 +0100)]
crypto/kasumi: fix extern declaration
gcc 10 defaults to fno-common and it reports:
crypto_kasumi_rte_kasumi_pmd_ops.c.o:(.data.rel+0x0):
multiple definition of `rte_kasumi_pmd_ops';
crypto_kasumi_rte_kasumi_pmd.c.o:(.bss+0x8): first defined here
Fix by making rte_kasumi_pmd_ops extern in the header file.
Fixes: 2773c86d061a ("crypto/kasumi: add driver for KASUMI library") Cc: stable@dpdk.org Signed-off-by: Kevin Traynor <ktraynor@redhat.com> Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
1) possible leak of memory
In cryptodev_dpaa_sec_probe() function in case of portal
initialization failure, function exited without cleanup.
The patch redirects flow to out label, which provides
proper cleanup in case of error: freeing cryptodevice private
data and releasing cryptodevice.
2) double free of cryptodev private data
The function dpaa_sec_dev_init() in case of failure called
dpaa_sec_uninit() which freed both private data and security
context. However one layer above in cryptodev_dpaa_sec_probe()
function, the private data were freed one more time.
The patch limits cleanup of the dpaa_sec_dev_init() function
to freeing only the security context.
This patch fixes management of memory for authentication
and encryption keys.
There were two issues with former state of implementation:
1) Invalid access to dpaa_sec_session union members
The dpaa_sec_session structure includes an anonymous union:
union {
struct {...} aead_key;
struct {
struct {...} cipher_key;
struct {...} auth_key;
};
};
Depending on the used algorithm a rte_zmalloc() function
allocated memory that was kept in aead_key, cipher_key
or auth_key. However every time the memory was released,
rte_free() was called only on cipher and auth keys, even
if pointer to allocated memory was stored in aead_key.
The C language specification defines such behavior as undefined.
As the cipher_key and aead_key are similar, have same sizes and
alignment, it has worked, but it's directly against C specification.
This patch fixes this, providing a free_session_data() function
to free the keys data. It verifies which algorithm was used
(aead or auth+cipher) and frees proper part of the union.
2) Some keys might have been freed multiple times
In functions like: dpaa_sec_cipher_init(), dpaa_sec_auth_init(),
dpaa_sec_chain_init(), dpaa_sec_aead_init() keys data were freed
before returning due to some error conditions. However the pointers
were not zeroed causing another calls to ret_free from higher
layers of code. This causes an error log about invalid memory address
to be printed.
This patch fixes it by making only one layer responsible for freeing
memory
Adam Dybkowski [Tue, 5 May 2020 15:30:37 +0000 (17:30 +0200)]
common/qat: fix queue head update
This patch fixes missing queue head update that occurred when
a multiple-request dynamic Huffman compression operation was not
complete within one qat_dequeue_op_burst function call.
Fixes: c13cecf60f12 ("compress/qat: support IM buffer too small operation") Signed-off-by: Adam Dybkowski <adamx.dybkowski@intel.com> Acked-by: Fiona Trahe <fiona.trahe@intel.com> Tested-by: Xinfeng Zhao <xinfengx.zhao@intel.com>
Mariusz Drost [Mon, 4 May 2020 10:06:34 +0000 (12:06 +0200)]
examples/ipsec-secgw: clean up test scripts
As more test cases are defined for execution, test scripts structure
needs to be reorganized, so fewer files are needed to describe the test.
To achieve that, new environment variables are incorporated into the
scripts.
Additionally, tests for mixed tunnel protocols are added.
Signed-off-by: Mariusz Drost <mariuszx.drost@intel.com> Tested-by: Konstantin Ananyev <konstantin.ananyev@intel.com> Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Adam Dybkowski [Wed, 29 Apr 2020 10:57:04 +0000 (12:57 +0200)]
app/crypto-perf: fix display of sample test vector
This patch disables displaying sample test vector contents when
executing throughput and latency tests as the sample data is not
used in those tests (not copied to input mbuf in order to achieve
better performance).
Fixes: f8be1786b1b8 ("app/crypto-perf: introduce performance test application") Cc: stable@dpdk.org Signed-off-by: Adam Dybkowski <adamx.dybkowski@intel.com> Acked-by: Fiona Trahe <fiona.trahe@intel.com>
Phil Yang [Fri, 24 Apr 2020 04:33:04 +0000 (12:33 +0800)]
ipsec: optimize SA outbound sequence update
For SA outbound packets, rte_atomic64_add_return is used to generate
SQN atomically. Use C11 atomics with RELAXED ordering for outbound SQN
update instead of rte_atomic ops which enforce unnecessary barriers on
aarch64.
Signed-off-by: Phil Yang <phil.yang@arm.com> Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com> Reviewed-by: Gavin Hu <gavin.hu@arm.com> Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
test/security: enable tests for non-implemented ops
After re-enabling checks for non-implemented ops in non-debug mode
in librte_security set_pkt_metadata and get_userdata functions,
tests verifying proper work of tests can be enabled also.
Pablo de Lara [Thu, 23 Apr 2020 13:46:49 +0000 (14:46 +0100)]
crypto/aesni_mb: fix DOCSIS AES-256
When adding support for DOCSIS AES-256,
when setting the cipher parameters, all key sizes
were accepted, but only 128-bit and 256-bit keys
are supported.
Fixes: 9536622b86c8 ("crypto/aesni_mb: support DOCSIS AES-256") Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com> Acked-by: Mairtin o Loingsigh <mairtin.oloingsigh@intel.com>
Pablo de Lara [Mon, 20 Apr 2020 11:05:29 +0000 (12:05 +0100)]
crypto/aesni_mb: check if session is valid
Check if session is valid after getting operation
out of the internal IPSec MB manager, in case the
session has been freed while the operation was still
inside the manager.
Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
This commit fixes failures of the flow_classify_autotest when
ran on dual-socket servers, as the sample application does not
support more than a single socket. Increasing the NB_SOCKETS
value allows the test to run successfully.
Fixes: 9c9befea4f57 ("test: add flow classify unit tests") Cc: stable@dpdk.org Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com> Tested-by: Ferruh Yigit <ferruh.yigit@intel.com> Tested-by: Bernard Iremonger <bernard.iremonger@intel.com> Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
The autotest application build was partially enabled for building with
the net/bond driver disabled, but a number of items were missed, leading
to build errors when the driver was disabled, e.g. by simply doing
"-Ddisable_drivers=net/*" when calling meson.
../app/test/test_link_bonding.c:25:10: fatal error: rte_eth_bond.h: \
No such file or directory
With this fix in place, it's possible to build DPDK with meson with all
non-bus, non-mempool drivers disabled i.e. using meson option
Anatoly Burakov [Thu, 7 May 2020 10:46:28 +0000 (11:46 +0100)]
examples/l3fwd-power: add Rx interrupt timeout
Currently, thread waiting on an interrupt does not have a timeout, so
it will not ever wake up until traffic arrives. This means that, when
time comes to exit the application, it will not quit unless there
happens to be traffic coming in and waking up the thread from sleep.
Fix it so that the interrupt thread sleeps for 10ms before waking up
and attempting to poll again. Additionally, remove the log message
to avoid spamming about entering interrupt mode.
Fixes: 613ce6691c0d ("examples/l3fwd-power: implement proper shutdown") Cc: stable@dpdk.org Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com> Acked-by: David Hunt <david.hunt@intel.com> Tested-by: Lihong Ma <lihongx.ma@intel.com>
Ferruh Yigit [Mon, 11 May 2020 16:07:25 +0000 (17:07 +0100)]
event/octeontx2: fix build for O1 optimization
Can be reproduced with "make EXTRA_CFLAGS='-O1'" command using
gcc 7.3.0
Build error
In file included from .../drivers/event/octeontx2/ot
x2_evdev.c:15:0:
.../drivers/event/octeontx2/otx2_evdev_stats.h:
In function ‘otx2_sso_xstats_get’:
.../drivers/event/octeontx2/otx2_evdev_stats.h:124:9:
error: ‘xstats’ may be used uninitialized in this function
[-Werror=maybe-uninitialized]
xstat = &xstats[ids[i] - start_offset];
~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This is false positive, 'xstats_mode_count' should be preventing taking
the loop and accessing 'xstats'.
Returning in that case to silence the compiler warning.
Reported-by: Konstantin Ananyev <konstantin.ananyev@intel.com> Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com> Tested-by: Konstantin Ananyev <konstantin.ananyev@intel.com> Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com> Acked-by: Jerin Jacob <jerinj@marvell.com>
Ferruh Yigit [Mon, 11 May 2020 16:07:24 +0000 (17:07 +0100)]
net/ena: fix build for O1 optimization
Can be reproduced with "make EXTRA_CFLAGS='-O1'" command using
gcc (GCC) 9.3.1 20200408 (Red Hat 9.3.1-2)
Build error:
.../drivers/net/ena/ena_ethdev.c: In function ‘eth_ena_dev_init’:
.../drivers/net/ena/ena_ethdev.c:1815:20:
error: ‘wd_state’ may be used uninitialized in this function
[-Werror=maybe-uninitialized]
1815 | adapter->wd_state = wd_state;
| ~~~~~~~~~~~~~~~~~~^~~~~~~~~~
This looks like false positive, fixing by assigning initial value to
'wd_state' variable.
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com> Acked-by: Michal Krawczyk <mk@semihalf.com>
Ferruh Yigit [Mon, 11 May 2020 16:07:23 +0000 (17:07 +0100)]
mempool/octeontx2: fix build for gcc O1 optimization
Can be reproduced with "make EXTRA_CFLAGS='-O1'" command using
gcc (GCC) 9.3.1 20200408 (Red Hat 9.3.1-2)
Build error:
In file included from .../drivers/mempool/octeontx2/otx2_mempool.h:13,
from .../drivers/mempool/octeontx2/otx2_mempool_ops.c:8:
.../drivers/mempool/octeontx2/otx2_mempool_ops.c:
In function ‘otx2_npa_alloc’:
.../drivers/common/octeontx2/otx2_common.h:94:2:
error: ‘aura_handle’ may be used uninitialized in this function
[-Werror=maybe-uninitialized]
94 | rte_log(RTE_LOG_DEBUG, otx2_logtype_ ## subsystem, \
| ^~~~~~~
.../drivers/mempool/octeontx2/otx2_mempool_ops.c:643:11:
note: ‘aura_handle’ was declared here
643 | uint64_t aura_handle;
| ^~~~~~~~~~~
This looks like false positive, assigning an initial value to
'aura_handle' to fix the build error.
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com> Acked-by: Jerin Jacob <jerinj@marvell.com>
Ferruh Yigit [Mon, 11 May 2020 16:07:22 +0000 (17:07 +0100)]
ring: fix build for gcc O1 optimization
Can be reproduced with "make EXTRA_CFLAGS='-O1'" command using
gcc (GCC) 9.3.1 20200408 (Red Hat 9.3.1-2)
Two build errors:
1)
In file included from .../build/include/rte_ring_elem.h:1093,
from .../lib/librte_rcu/rte_rcu_qsbr.c:21:
../lib/librte_rcu/rte_rcu_qsbr.c: In function ‘rte_rcu_qsbr_dq_reclaim’:
.../build/include/rte_ring_peek.h:282:22:
error: ‘avail’ may be used uninitialized in this function
[-Werror=maybe-uninitialized]
282 | *available = avail - n;
| ~~~~~~^~~
./build/include/rte_ring_peek.h:259:11: note: ‘avail’ was declared here
259 | uint32_t avail, head, next;
| ^~~~~
2)
In file included from .../build/include/rte_ring_elem.h:1093,
from .../build/include/rte_ring.h:405,
from .../app/test/test_ring_stress.h:13,
from .../app/test/test_ring_stress_impl.h:5,
from .../app/test/test_ring_peek_stress.c:5:
.../app/test/test_ring_peek_stress.c: In function ‘_st_ring_enqueue_bulk’:
.../build/include/rte_ring_peek.h:80:22:
error: ‘free’ may be used uninitialized in this function
[-Werror=maybe-uninitialized]
80 | *free_space = free - n;
| ~~~~~^~~
.../build/include/rte_ring_peek.h:60:11: note: ‘free’ was declared here
60 | uint32_t free, head, next;
| ^~~~
The cases shouldn't be hit, and it looks like there is already logic
error if it has been hit, but assigning 'avail' & 'free' to '0' to fix
the build error.
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com> Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
This commit fixes a segfault on exit by using Ctrl^C if the master lcore
was also being used as a worker core. The root cause of the issue was
that the interrupt handler was cleaning up resources such as the ethdev
and eventdev ports, and once the interrupt handler would return, that
thread would continue working as an eventdev worker, and dereference the
memory which just had free() called on it.
Fixed by moving the cleanup code from the interrupt handler to the
cleanup stage of main(), which the master thread will execute once
it has returned from its worker() functionality.
Fixes: 085edac2ca38 ("examples/eventdev_pipeline: support Tx adapter") Cc: stable@dpdk.org Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com> Tested-by: Jun W Zhou <junx.w.zhou@intel.com>
David Marchand [Mon, 11 May 2020 14:39:21 +0000 (16:39 +0200)]
telemetry: fix error log output
Caught while running testpmd:
No telemetry legacy support- No legacy callbacks, legacy socket not createdInteractive-mode selected
Add missing \n.
Fixes: 6dd571fd07c3 ("telemetry: introduce new functionality") Signed-off-by: David Marchand <david.marchand@redhat.com> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
David Marchand [Mon, 11 May 2020 13:32:12 +0000 (15:32 +0200)]
telemetry: fix build for armv7
telemetry can not depend on EAL anymore but it still wants to get arch
headers.
We directly point at the right source directories by using the same logic
than EAL. However the special case of armv7 has been missed.
Fix this by defaulting ARCH_DIR to RTE_ARCH.
Caught on OBS:
[ 162s] SYMLINK-FILE include/rte_telemetry.h
[ 162s] CC telemetry.o
[ 162s] CC telemetry_data.o
[ 162s] CC telemetry_legacy.o
[ 162s] .../lib/librte_telemetry/telemetry.c:15:10: fatal error:
rte_spinlock.h: No such file or directory
[ 162s] #include <rte_spinlock.h>
[ 162s] ^~~~~~~~~~~~~~~~
[ 162s] compilation terminated.
Fixes: 6dd571fd07c3 ("telemetry: introduce new functionality") Signed-off-by: David Marchand <david.marchand@redhat.com> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Bing Zhao [Thu, 7 May 2020 08:02:54 +0000 (16:02 +0800)]
mem: fix overflow on allocation
The size checking is done in the caller. The size parameter is an
unsigned (64b wide) right now, so the comparison with zero should be
enough in most cases. But it won't help in the following case.
If the allocating request input a huge number by mistake, e.g., some
overflow after the calculation (especially subtraction), the checking
in the caller will succeed since it is not zero. Indeed, there is not
enough space in the system to support such huge memory allocation.
Usually it will return failure in the following code. But if the
input size is just a little smaller than the UINT64_MAX, like -2 in
signed type.
The roundup will cause an overflow and then "reset" the size to 0,
and then only a header (128B now) with zero length will be returned.
The following will be the previous allocation header.
It should be OK in most cases if the application won't access the
memory body. Or else, some critical issue will be caused and not easy
to debug. So this issue should be prevented at the beginning, like
other big size failure, NULL pointer should be returned also.
Fixes: fdf20fa7bee9 ("add prefix to cache line macros") Cc: stable@dpdk.org Signed-off-by: Bing Zhao <bingz@mellanox.com> Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
Louise Kilheeney [Mon, 27 Apr 2020 14:57:43 +0000 (15:57 +0100)]
examples/l2fwd-keepalive: fix mbuf pool size
MBUF pool of size 8192 was causing packet loss when using four ports. To
fix this issue this patch specifies the number of MBUF's per port
instead of having one set MBUF pool size, this way it will adapt to any
number of ports.
Fixes: e64833f2273a ("examples/l2fwd-keepalive: add sample application") Cc: stable@dpdk.org Signed-off-by: Louise Kilheeney <louise.kilheeney@intel.com> Tested-by: Xi Zhang <xix.zhang@intel.com>
bus/pci: optimise scanning with whitelist/blacklist
rte_bus_scan API scans all the available PCI devices irrespective of white
or black listing parameters then further devices are probed based on white
or black listing parameters. So unnecessary CPU cycles are wasted during
rte_pci_scan.
For Octeontx2 platform with core frequency 2.4 Ghz, rte_bus_scan consumes
around 26ms to scan around 90 PCI devices but all may not be used by the
application. So for the application which uses 2 NICs, rte_bus_scan
consumes few microseconds and rest time is saved with this patch.
Patch restricts devices to be scanned as per below mentioned conditions:
- All devices will be scanned if no parameters are passed.
- Only white listed devices will be scanned if white list is available.
- All devices, except black listed, will be scanned if black list is
available.
Signed-off-by: Sunil Kumar Kori <skori@marvell.com> Acked-by: Gaetan Rivet <grive@u256.net>
Jerin Jacob [Mon, 4 May 2020 13:26:53 +0000 (18:56 +0530)]
bus/pci: reduce boot-up logs to absolute minimum
Some machines may have a lot of PCI devices and all of them are
not bound to DPDK. In such case the logs from EAL creates a lot of
clutter on boot-up, typically one needs to scroll the screen to
find other issues in boot-up.
This patch changes the following to reduce the clutter in
the default boot-up logs.
- Change the log-level of PCI probes to `debug`
- Introduce new driver probe as `info` log-level for the successful probe.
Phil Yang [Wed, 6 May 2020 15:28:04 +0000 (23:28 +0800)]
service: relax barriers with C11 atomics
The runstate, comp_runstate and app_runstate are used as guard variables
in the service core lib. To guarantee the inter-threads visibility of
these guard variables, it uses rte_smp_r/wmb. This patch use c11 atomic
built-ins to relax these barriers.
Signed-off-by: Phil Yang <phil.yang@arm.com> Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com> Acked-by: Harry van Haaren <harry.van.haaren@intel.com>
Phil Yang [Wed, 6 May 2020 15:28:03 +0000 (23:28 +0800)]
service: optimize with C11 atomics
The num_mapped_cores is used as a statistics. Use c11 atomics with
RELAXED ordering for num_mapped_cores instead of rte_atomic ops which
enforce unnessary barriers on aarch64.
Replace execute_lock operations to spinlock_try_lock to avoid duplicate
code.
Signed-off-by: Phil Yang <phil.yang@arm.com> Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com> Acked-by: Harry van Haaren <harry.van.haaren@intel.com>
Phil Yang [Wed, 6 May 2020 15:28:02 +0000 (23:28 +0800)]
service: remove redundant code
The service id validation is duplicated, remove the redundant code
in the calling functions.
Signed-off-by: Phil Yang <phil.yang@arm.com> Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com> Acked-by: Harry van Haaren <harry.van.haaren@intel.com>
Phil Yang [Wed, 6 May 2020 15:28:01 +0000 (23:28 +0800)]
service: remove rte prefix from static functions
clean up rte prefix from static functions.
remove unused parameter for service_dump_one function.
Signed-off-by: Phil Yang <phil.yang@arm.com> Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com> Acked-by: Harry van Haaren <harry.van.haaren@intel.com>
service: fix identification of service running on other lcore
The logic to identify if the MT unsafe service is running on another
core can return -EBUSY spuriously. In such cases, running the service
becomes costlier than using atomic operations. Assume that the
application passes the right parameters and reduce the number of
instructions for all cases.
Cc: stable@dpdk.org Fixes: 8d39d3e237c2 ("service: fix race in service on app lcore function") Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com> Reviewed-by: Phil Yang <phil.yang@arm.com> Acked-by: Harry van Haaren <harry.van.haaren@intel.com>
A MT unsafe service might get configured to run on another core
while the service is running currently. This might result in the
MT unsafe service running on multiple cores simultaneously. Use
'execute_lock' always when the service is MT unsafe.
If the service is known to be mapped on a single lcore,
setting the service capability to MT safe will avoid taking
the lock and improve the performance.
Fixes: e9139a32f6e8 ("service: add function to run on app lcore") Cc: stable@dpdk.org Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com> Reviewed-by: Phil Yang <phil.yang@arm.com> Acked-by: Harry van Haaren <harry.van.haaren@intel.com>
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com> Signed-off-by: Ciara Power <ciara.power@intel.com> Reviewed-by: Keith Wiles <keith.wiles@intel.com>
Ciara Power [Thu, 30 Apr 2020 16:01:34 +0000 (17:01 +0100)]
eal: add telemetry as dependency
This patch moves telemetry further down the build, and adds it as a
dependency for EAL. Telemetry V2 is now configured to build by default,
and the legacy support is built when the telemetry config flag is set.
Telemetry now has EAL flags, shown below:
"--telemetry" = Enables telemetry (this is default if no flags given)
"--no-telemetry" = Disables telemetry
When telemetry is enabled, it will attempt to open the new socket
version, and also the legacy support socket (this will depend on Jansson
external dependency and telemetry config flag, as before).
Signed-off-by: Ciara Power <ciara.power@intel.com> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com> Reviewed-by: Keith Wiles <keith.wiles@intel.com>
Ciara Power [Thu, 30 Apr 2020 16:01:33 +0000 (17:01 +0100)]
telemetry: remove redundant code
This patch removes the existing telemetry files, which are now redundant
as the new version of telemetry has backward compatibility for their
functionality.
Signed-off-by: Ciara Power <ciara.power@intel.com> Reviewed-by: Keith Wiles <keith.wiles@intel.com>
Ciara Power [Thu, 30 Apr 2020 16:01:32 +0000 (17:01 +0100)]
telemetry: introduce backward compatibility
The new telemetry will now open a socket using the old telemetry path,
to ensure backward compatibility. This is not yet initialised, as it
would clash with the existing telemetry, to be removed in a later patch.
This means that both old and new telemetry socket interfaces are
handled in a common way.
Signed-off-by: Ciara Power <ciara.power@intel.com> Reviewed-by: Keith Wiles <keith.wiles@intel.com>
The existing stats tracking done by the app using the metrics
library is unaffected. This will still be used to ensure backward
compatibility.
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com> Signed-off-by: Ciara Power <ciara.power@intel.com> Reviewed-by: Keith Wiles <keith.wiles@intel.com>
Ciara Power [Thu, 30 Apr 2020 16:01:30 +0000 (17:01 +0100)]
rawdev: add telemetry callbacks
The rawdev library now registers commands with telemetry, and
implements the corresponding callback functions. These allow a list of
rawdev devices and xstats for a rawdev port to be queried.
An example usage, with ioat rawdev driver instances, is shown below:
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com> Signed-off-by: Ciara Power <ciara.power@intel.com> Reviewed-by: Keith Wiles <keith.wiles@intel.com>
Bruce Richardson [Thu, 30 Apr 2020 16:01:29 +0000 (17:01 +0100)]
ethdev: add telemetry callbacks
The ethdev library now registers commands with telemetry, and
implements the callback functions. These commands allow the list of
ethdev ports and the xstats and link status for a port to be queried.
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com> Signed-off-by: Ciara Power <ciara.power@intel.com> Reviewed-by: Keith Wiles <keith.wiles@intel.com>
Bruce Richardson [Thu, 30 Apr 2020 16:01:28 +0000 (17:01 +0100)]
usertools: add new telemetry script
This patch adds a python script that can be used with the new telemetry
socket. It connects as a client to the socket, and allows the user send
a command and see the JSON response.
The example usage below shows the script connecting to the new telemetry
socket, and sending three default telemetry commands entered by the user.
The response for each command is shown below the user input.
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com> Signed-off-by: Ciara Power <ciara.power@intel.com> Reviewed-by: Keith Wiles <keith.wiles@intel.com>
Ciara Power [Thu, 30 Apr 2020 16:01:27 +0000 (17:01 +0100)]
telemetry: add default callback commands
The default commands are now added to provide the list of commands
available, help text for a specified command, and also information
about DPDK and telemetry.
Signed-off-by: Ciara Power <ciara.power@intel.com> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com> Reviewed-by: Keith Wiles <keith.wiles@intel.com>
Bruce Richardson [Thu, 30 Apr 2020 16:01:25 +0000 (17:01 +0100)]
telemetry: introduce new functionality
This patch introduces a new telemetry connection socket and handling
functionality. Like the existing telemetry implementation (which is
unaffected by this change) it uses a unix socket, but unlike the
existing one it does not have a fixed list of commands - instead
libraries or applications can register telemetry commands and callbacks
to provide a full-extensible solution for all kinds of telemetry across
DPDK.
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com> Signed-off-by: Ciara Power <ciara.power@intel.com> Reviewed-by: Keith Wiles <keith.wiles@intel.com>
Bruce Richardson [Thu, 30 Apr 2020 16:01:24 +0000 (17:01 +0100)]
telemetry: add utility functions for creating JSON
The functions added in this patch will make it easier for telemetry
to convert data to correct JSON responses to telemetry requests.
Tests are also added for these json utility functions.
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com> Reviewed-by: Keith Wiles <keith.wiles@intel.com>
Bruce Richardson [Thu, 30 Apr 2020 16:01:23 +0000 (17:01 +0100)]
telemetry: invert dependency on metrics library
Rather than having the telemetry library depend on the metrics
lib we invert the dependency so that metrics instead depends
on telemetry lib, and registers the needed functions with it
at init time. This prepares the way for a cleaner telemetry
architecture to be applied in later patches.
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com> Reviewed-by: Keith Wiles <keith.wiles@intel.com>
Ciara Power [Thu, 30 Apr 2020 16:01:22 +0000 (17:01 +0100)]
metrics: reduce telemetry code
The telemetry code that was moved into the metrics library can be
shortened, while still maintaining the same functionality.
Signed-off-by: Ciara Power <ciara.power@intel.com> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com> Reviewed-by: Keith Wiles <keith.wiles@intel.com>
Ciara Power [Thu, 30 Apr 2020 16:01:21 +0000 (17:01 +0100)]
telemetry: move some functions to metrics library
This commit moves some of the telemetry library code to a new file in
the metrics library. No modifications are made to the moved code,
except what is needed to allow it to compile and run. The additional
code in metrics is built only when the Jansson library is present.
Telemetry functions as normal, using the functions from the
metrics_telemetry file. This move will enable code be reused by the new
version of telemetry in a later commit, to support backward
compatibility with the existing telemetry usage.
Signed-off-by: Ciara Power <ciara.power@intel.com> Reviewed-by: Keith Wiles <keith.wiles@intel.com>
Bruce Richardson [Thu, 30 Apr 2020 16:01:20 +0000 (17:01 +0100)]
build: add arch-specific header path to global includes
The global include path, which is used by anything built before EAL,
points to the EAL header files so they utility macros etc. can be used
anywhere in DPDK. This path included the OS-specific EAL header files,
but not the architecture-specific ones. This patch moves the selection
of target architecture to the top-level meson.build file so that the
global include can reference that.
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com> Reviewed-by: Keith Wiles <keith.wiles@intel.com>
Kevin Laatz [Tue, 28 Apr 2020 12:40:26 +0000 (13:40 +0100)]
eal/x86: add more CPU flags
This patch adds CPU flags which will enable the detection of ISA
features available on more recent x86 based CPUs.
The CPUID leaf information can be found in
Table 1-2. "Information Returned by CPUID Instruction" of this document:
https://software.intel.com/sites/default/files/managed/c5/15/architecture-instruction-set-extensions-programming-reference.pdf
The following CPU flags are added in this patch:
- AVX-512 doubleword and quadword instructions.
- AVX-512 integer fused multiply-add instructions.
- AVX-512 conflict detection instructions.
- AVX-512 byte and word instructions.
- AVX-512 vector length instructions.
- AVX-512 vector bit manipulation instructions.
- AVX-512 vector bit manipulation 2 instructions.
- Galois field new instructions.
- Vector AES instructions.
- Vector carry-less multiply instructions.
- AVX-512 vector neural network instructions.
- AVX-512 for bit algorithm instructions.
- AVX-512 vector popcount instructions.
- Cache line demote instructions.
- Direct store instructions.
- Direct store 64B instructions.
- AVX-512 two register intersection instructions.
Signed-off-by: Kevin Laatz <kevin.laatz@intel.com> Acked-by: Harry van Haaren <harry.van.haaren@intel.com> Acked-by: Ray Kinsella <mdr@ashroe.eu>
Pallavi Kadam [Wed, 6 May 2020 01:30:31 +0000 (18:30 -0700)]
eal/windows: add fnmatch implementation
Fnmatch implementation is required on Windows to support
log level arguments specified with a globbing pattern.
The source file is with BSD-3-Clause license.
https://github.com/lattera/freebsd/blob/master/usr.bin/csup/fnmatch.c
When building a target application with static linking mode via
makefiles and enable linking to ibverbs libs by setting
"CONFIG_RTE_IBVERBS_LINK_STATIC=y". The libibverbs.pc will be
chosen and all the libs listed in the file will be linked
by default. Some static lib archives may contain the same files
and common interfaces inside.
The "--no-whole-archive" needs to be enabled for the linker to
discard the useless symbols and resolve the symbols redefinition
error.
Fixes: 2c0dd7b69fb0 ("config: add static linkage of mlx dependency") Cc: stable@dpdk.org Signed-off-by: Bing Zhao <bingz@mellanox.com> Acked-by: Thomas Monjalon <thomas@monjalon.net>
Adding support for rx checksum offload. In case of wrong
checksum received (inner/outer l3/l4) it reports the
corresponding layer which has bad checksum. It also adds
rx burst function pointer hook for rx checksum offload to
event PMD.
Signed-off-by: Harman Kalra <hkalra@marvell.com> Acked-by: Jerin Jacob <jerinj@marvell.com>
event/octeontx2: fix queue removal from Rx adapter
When eth port queue is removed from Rx adapter using
rte_event_eth_rx_adapter_queue_del() it incorrectly
initializes CQ context instead of modifying it. This
might lead to a crash when CQ context is modified
as a part of rte_eth_dev_stop() sequence as CQ will
hold invalid entries. This is responsibility of an
application to call rte_event_eth_rx_adapter_queue_del()
to remove eth port queue from Rx adapter in tear down
sequence.
Ophir Munk [Tue, 5 May 2020 06:16:07 +0000 (06:16 +0000)]
net/mlx5: fix flow rules with Verbs
The flow_verbs_translate() function accumulates hash fields while
iterating through the flow items (SRC_IPV4, DST_IPV4, SRC_IPV6,
DST_IPV6, SRC_PORT_TCP, DST_PORT_TCP, SRC_PORT_UDP, DST_PORT_UDP).
Before this commit the dev_flow handle structure was reused in each new
flow_verbs_translate() call, however the dev_flow->hash_fields variable
was not reset before each call. As a result hash_fields from previous
calls remained present in the current flow which lead to invalid
combinations (e.g. simultaneous IPv4 and IPv6 specs). This scenario
happens for example in the next flows sequence, when running in verbs
mode (dv_flow_en=0).
flow create 0 ingress group 0 pattern eth / ipv4 / end <rss actions>
flow create 0 ingress group 0 pattern eth / ipv6 / end <rss actions>
The fix is to reset dev_flow->hash_fields in flow_verbs_prepare().
Fixes: e7bfa3596a0a ("net/mlx5: separate the flow handle resource") Signed-off-by: Ophir Munk <ophirmu@mellanox.com> Acked-by: Matan Azrad <matan@mellanox.com>
This patch updates the MLX5 PMD and release notes documentations.
Adding the notes of the behavior change that rte flows organization
is switched into non-cached mode for applications.
Signed-off-by: Bing Zhao <bingz@mellanox.com> Acked-by: Ori Kam <orika@mellanox.com>
The assertion was added incorrectly in converting the modify actions
into the format of low layer driver.
There is no mask specified in the rte_flow actions, and PMD driver
will give a mask of all 1s to the field to be modified. For each
field, the mask could not be zero. But for the whole header which
contains this field, the masks of other fields could be zero. The
assertion needs to be removed for debug mode.