dpdk.git
3 years agoeventdev: remove redundant reset on timer cancel
Phil Yang [Tue, 7 Jul 2020 15:54:52 +0000 (23:54 +0800)]
eventdev: remove redundant reset on timer cancel

There is no thread will access these impl_opaque data after timer
canceled. When new timer armed, it got refilled. So the cleanup
process is unnecessary.

Cc: stable@dpdk.org
Signed-off-by: Phil Yang <phil.yang@arm.com>
Reviewed-by: Dharmik Thakkar <dharmik.thakkar@arm.com>
3 years agoeventdev: use C11 atomics for lcore timer armed flag
Phil Yang [Tue, 7 Jul 2020 15:54:51 +0000 (23:54 +0800)]
eventdev: use C11 atomics for lcore timer armed flag

The in_use flag is a per core variable which is not shared between
lcores in the normal case and the access of this variable should be
ordered on the same core. However, if non-EAL thread pick the highest
lcore to insert timers into, there is the possibility of conflicts
on this flag between threads. Then the atomic compare-and-swap
operation is needed.

Use the C11 atomics instead of the generic rte_atomic operations to
avoid the unnecessary barrier on aarch64.

Cc: stable@dpdk.org
Signed-off-by: Phil Yang <phil.yang@arm.com>
Reviewed-by: Dharmik Thakkar <dharmik.thakkar@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Acked-by: Erik Gabriel Carrillo <erik.g.carrillo@intel.com>
3 years agoeventdev: fix race condition on timer list counter
Phil Yang [Tue, 7 Jul 2020 15:54:50 +0000 (23:54 +0800)]
eventdev: fix race condition on timer list counter

The n_poll_lcores counter and poll_lcore array are shared between lcores
and the update of these variables are out of the protection of spinlock
on each lcore timer list. The read-modify-write operations of the counter
are not atomic, so it has the potential of race condition between lcores.

Use c11 atomics with RELAXED ordering to prevent confliction.

Fixes: cc7b73ea9e3b ("eventdev: add new software timer adapter")
Cc: stable@dpdk.org
Signed-off-by: Phil Yang <phil.yang@arm.com>
Reviewed-by: Dharmik Thakkar <dharmik.thakkar@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Acked-by: Erik Gabriel Carrillo <erik.g.carrillo@intel.com>
3 years agotest/crypto: add ChaCha20-Poly1305 cases
Arek Kusztal [Tue, 7 Jul 2020 15:16:01 +0000 (17:16 +0200)]
test/crypto: add ChaCha20-Poly1305 cases

This patch adds Chacha20-Poly1305 implementation to
cryptodev tests.

Signed-off-by: Arek Kusztal <arkadiuszx.kusztal@intel.com>
Acked-by: Anoob Joseph <anoobj@marvell.com>
Acked-by: Tejasree Kondoj <ktejasree@marvell.com>
3 years agocrypto/qat: support ChaCha20-Poly1305
Arek Kusztal [Tue, 7 Jul 2020 15:16:00 +0000 (17:16 +0200)]
crypto/qat: support ChaCha20-Poly1305

This patchset adds ChaCha20-Poly1305 implementation to Intel
QuickAssist Technology pmd.

Signed-off-by: Arek Kusztal <arkadiuszx.kusztal@intel.com>
3 years agocommon/qat: add multi-process handling of capabilities
Arek Kusztal [Tue, 7 Jul 2020 15:02:39 +0000 (17:02 +0200)]
common/qat: add multi-process handling of capabilities

Move qat capabilities data into a memzone where it can be
shared by primary and secondary processes.

Signed-off-by: Arek Kusztal <arkadiuszx.kusztal@intel.com>
Acked-by: Fiona Trahe <fiona.trahe@intel.com>
3 years agocrypto/qat: add multi-process handling of driver ID
Arek Kusztal [Tue, 7 Jul 2020 15:02:38 +0000 (17:02 +0200)]
crypto/qat: add multi-process handling of driver ID

As cryptodev driver_id is allocated per-process,
a corner case exists where binaries for primary and
secondary processes could have different driver_ids
if built differently. Add checking in qat PMD to catch and
handle the case where driver_ids are inconsistent.

Signed-off-by: Arek Kusztal <arkadiuszx.kusztal@intel.com>
Acked-by: Fiona Trahe <fiona.trahe@intel.com>
3 years agocommon/qat: improve multi-process handling
Arek Kusztal [Tue, 7 Jul 2020 15:02:37 +0000 (17:02 +0200)]
common/qat: improve multi-process handling

This patch refactors qat data into structures
which are local to the process and structures which
are intended to be shared by primary and secondary
processes. This enables qat devices to be used by
multi process applications.

Signed-off-by: Arek Kusztal <arkadiuszx.kusztal@intel.com>
Acked-by: Fiona Trahe <fiona.trahe@intel.com>
3 years agocommon/dpaax: remove unnecessary jump for PDCP
Akhil Goyal [Tue, 10 Dec 2019 12:50:33 +0000 (18:20 +0530)]
common/dpaax: remove unnecessary jump for PDCP

In case of LX2160, PROTOCOL command can be used in some of the PDCP
cases, in those the jump command prior to KEY command may not be
required.

The issue observed due to these JUMP command on LX2160 is that,
the CAAM gets stuck and the processing never get completed. The
system becomes unusable.

Signed-off-by: Akhil Goyal <akhil.goyal@nxp.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
3 years agocommon/dpaax: fix 12-bit null auth case
Akhil Goyal [Wed, 8 Jan 2020 12:52:31 +0000 (18:22 +0530)]
common/dpaax: fix 12-bit null auth case

In cases of NULL auth in PDCP, the descriptors
should be based on ALGORITHM command instead of
PROTOCOL command.
It was done in case of encap, but was missing in
decap.

Fixes: 526cdf60f1e5 ("crypto/dpaa2_sec: update desc for PDCP 18-bit enc-auth")
Cc: stable@dpdk.org
Signed-off-by: Akhil Goyal <akhil.goyal@nxp.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
3 years agocrypto/dpaa2_sec: fix HFN override
Akhil Goyal [Fri, 14 Feb 2020 10:05:18 +0000 (15:35 +0530)]
crypto/dpaa2_sec: fix HFN override

HFN is set as a uint32_t but the value retrieved is
uint8_t. Fixed the type casting to get the correct value.

Fixes: bef594ec5cc8 ("crypto/dpaa2_sec: support PDCP offload")
Fixes: af61f0750948 ("crypto/dpaa2_sec: support scatter gather for proto offloads")
Cc: stable@dpdk.org
Signed-off-by: Akhil Goyal <akhil.goyal@nxp.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
3 years agocrypto/dpaax_sec: fix inline query for descriptors
Akhil Goyal [Thu, 4 Jun 2020 20:04:10 +0000 (01:34 +0530)]
crypto/dpaax_sec: fix inline query for descriptors

The maximum length of job descriptor which is formed
is 13 words and hence rta_inline_query should take
care of the max descriptor(shared + job) lengths and
thus find out of the key can be referenced or immediate.

Fixes: 05b12700cd4c ("crypto/dpaa_sec: support null algos for protocol offload")
Fixes: 13273250eec5 ("crypto/dpaa2_sec: support AES-GCM and CTR")
Cc: stable@dpdk.org
Signed-off-by: Akhil Goyal <akhil.goyal@nxp.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
3 years agotest/crypto-perf: add option to enable session HFN
Akhil Goyal [Mon, 6 Jul 2020 05:00:34 +0000 (10:30 +0530)]
test/crypto-perf: add option to enable session HFN

Add a new option for PDCP cases to enable use of session
based fixed HFN value instead of per packet HFN which was
enabled by hfn override feature.
By default HFN override is enabled and if session based
fixed HFN need to be tested, add "--pdcp-ses-hfn-en" in the
command line.

Signed-off-by: Akhil Goyal <akhil.goyal@nxp.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
3 years agotest/crypto: update PDCP HFN scenarios
Akhil Goyal [Mon, 6 Jul 2020 05:00:23 +0000 (10:30 +0530)]
test/crypto: update PDCP HFN scenarios

As per current framework of PDCP testing, app can only support
either HFN override or fixed session HFN values but not both.
Now to enable both, either we duplicate all PDCP cases(>100)
for both override and fixed HFN. It will look clumsy as the
number of cases will be very high without much value addition.

Now to overcome this, we can do HFN override for Downlink cases
and fixed HFN for uplink cases. This way we will not loose the
test coverage and there will not be duplicacy in the test cases.

Signed-off-by: Akhil Goyal <akhil.goyal@nxp.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
3 years agocrypto/dpaax_sec: fix 18-bit PDCP cases with HFN override
Akhil Goyal [Mon, 1 Jun 2020 17:17:45 +0000 (22:47 +0530)]
crypto/dpaax_sec: fix 18-bit PDCP cases with HFN override

In case of RTA_SEC_ERA = 8, where the length of shared desc
is large for some of PDCP cases, the descriptor buffer cannot
hold 2 extra words when HFN override is enabled. As a result,
the descriptor fails.

This patch converts one of the keys from immediate key to
reference key hence reducing the length of the descriptor.

Fixes: 2e4cbdb4b2c2 ("crypto/dpaax_sec: support PDCP U-Plane with integrity")
Cc: stable@dpdk.org
Signed-off-by: Akhil Goyal <akhil.goyal@nxp.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
3 years agocrypto/octeontx2: support ChaCha20-Poly1305
Tejasree Kondoj [Tue, 16 Jun 2020 13:02:16 +0000 (18:32 +0530)]
crypto/octeontx2: support ChaCha20-Poly1305

Add ChaCha20-Poly1305 AEAD algorithm support in crypto_octeontx2 PMD

Signed-off-by: Anoob Joseph <anoobj@marvell.com>
Signed-off-by: Tejasree Kondoj <ktejasree@marvell.com>
3 years agocrypto/octeontx2: discover capabilities
Tejasree Kondoj [Tue, 16 Jun 2020 13:02:15 +0000 (18:32 +0530)]
crypto/octeontx2: discover capabilities

Populate capabilities based on device features.

Signed-off-by: Anoob Joseph <anoobj@marvell.com>
Signed-off-by: Tejasree Kondoj <ktejasree@marvell.com>
3 years agocryptodev: add traces in multi-process path
Fiona Trahe [Wed, 10 Jun 2020 18:53:08 +0000 (20:53 +0200)]
cryptodev: add traces in multi-process path

This patch adds traces to some Cryptodev functions that are used
in primary/secondary context.

Signed-off-by: Fiona Trahe <fiona.trahe@intel.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
3 years agocryptodev: add function to check queue pair status
Fiona Trahe [Wed, 24 Jun 2020 14:26:53 +0000 (16:26 +0200)]
cryptodev: add function to check queue pair status

This patch adds function that can check if queue pair
was already setup. This may be useful when dealing with
multi process approach in cryptodev.

Signed-off-by: Fiona Trahe <fiona.trahe@intel.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
3 years agocrypto/qat: fix AES-XTS capabilities
Adam Dybkowski [Fri, 26 Jun 2020 11:23:42 +0000 (13:23 +0200)]
crypto/qat: fix AES-XTS capabilities

This patch fixes the increment field of the AES-XTS cipher key size.

Fixes: 7d5ef3bb32cd ("crypto/qat: support XTS")
Cc: stable@dpdk.org
Signed-off-by: Adam Dybkowski <adamx.dybkowski@intel.com>
Acked-by: Fiona Trahe <fiona.trahe@intel.com>
3 years agotest/crypto: use generic test suite for OCTEON TX/TX2
Anoob Joseph [Fri, 3 Jul 2020 05:41:44 +0000 (11:11 +0530)]
test/crypto: use generic test suite for OCTEON TX/TX2

This patch enables the generic crypto tests for OCTEON TX and
OCTEON TX2 PMDs. Removes the PMD specific tests.

Signed-off-by: Ankur Dwivedi <adwivedi@marvell.com>
Signed-off-by: Anoob Joseph <anoobj@marvell.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
3 years agotest/crypto: remove some PMD specific null tests
Anoob Joseph [Fri, 3 Jul 2020 05:41:43 +0000 (11:11 +0530)]
test/crypto: remove some PMD specific null tests

This patch removes the OCTEON TX and OCTEON TX2 PMDs specific
test cases related to null cipher.

Signed-off-by: Ankur Dwivedi <adwivedi@marvell.com>
Signed-off-by: Anoob Joseph <anoobj@marvell.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
3 years agocrypto/octeontx2: revert non-byte aligned data feature
Ankur Dwivedi [Fri, 3 Jul 2020 05:41:42 +0000 (11:11 +0530)]
crypto/octeontx2: revert non-byte aligned data feature

This reverts commit 51f3e107aca23a1cbc1a5ad9fdce7921340307b5.

For SNOW and ZUC algos the offset value for enryption and decryption
is converted to bytes. Hence RTE_CRYPTODEV_FF_NON_BYTE_ALIGNED_DATA
feature is not supported by the octeontx2 crypto pmd.

Fixes: 51f3e107aca2 ("crypto/octeontx2: enable non-byte aligned data")
Cc: stable@dpdk.org
Signed-off-by: Ankur Dwivedi <adwivedi@marvell.com>
3 years agocrypto/octeontx: revert non-byte aligned data feature
Ankur Dwivedi [Fri, 3 Jul 2020 05:41:41 +0000 (11:11 +0530)]
crypto/octeontx: revert non-byte aligned data feature

This reverts commit 32b8f26adf8b26a55230408ff6adffd4b2327e52.

For SNOW and ZUC algos the offset value for enryption and decryption
is converted to bytes. Hence RTE_CRYPTODEV_FF_NON_BYTE_ALIGNED_DATA
feature is not supported by the octeontx crypto pmd.

Fixes: 32b8f26adf8b ("crypto/octeontx: enable non-byte aligned data")
Cc: stable@dpdk.org
Signed-off-by: Ankur Dwivedi <adwivedi@marvell.com>
3 years agocrypto/octeontx2: reset session private data
Ankur Dwivedi [Fri, 3 Jul 2020 05:41:40 +0000 (11:11 +0530)]
crypto/octeontx2: reset session private data

This patch sets the first 32 bytes of session private data
to zero. This prevents garbage data to be used in code logic.

Signed-off-by: Ankur Dwivedi <adwivedi@marvell.com>
3 years agocrypto/octeontx: reset session private data
Ankur Dwivedi [Fri, 3 Jul 2020 05:41:39 +0000 (11:11 +0530)]
crypto/octeontx: reset session private data

This patch sets the first 32 bytes of session private data
to zero. This prevents garbage data to be used in code logic.

Signed-off-by: Ankur Dwivedi <adwivedi@marvell.com>
3 years agocrypto/octeontx: remove empty statistics callback
Ankur Dwivedi [Fri, 3 Jul 2020 05:41:38 +0000 (11:11 +0530)]
crypto/octeontx: remove empty statistics callback

The stats get and reset functions for octeontx crypto PMD are
unimplemented. So removing them.

Signed-off-by: Ankur Dwivedi <adwivedi@marvell.com>
3 years agocommon/cpt: fix encryption offset
Ankur Dwivedi [Fri, 3 Jul 2020 05:41:37 +0000 (11:11 +0530)]
common/cpt: fix encryption offset

In case of gmac auth the encryption offset should be set to zero.

Fixes: b74652f3a91f ("common/cpt: add microcode interface for encryption")
Fixes: 177b41ceee61 ("common/cpt: add microcode interface for decryption")
Cc: stable@dpdk.org
Signed-off-by: Ankur Dwivedi <adwivedi@marvell.com>
3 years agotest/crypto-perf: support DOCSIS protocol
David Coyle [Fri, 3 Jul 2020 12:39:33 +0000 (13:39 +0100)]
test/crypto-perf: support DOCSIS protocol

Update test-crypto-perf app to calculate DOCSIS throughput numbers.

1 new parameter is added for DOCSIS:
--docsis-hdr-sz <n>

./dpdk-test-crypto-perf -l 3,4 --socket-mem 2048,0
--vdev crypto_aesni_mb_pmd_1 -n 1 -- --devtype crypto_aesni_mb
--optype docsis --cipher-algo aes-docsisbpi --cipher-op encrypt
--cipher-key-sz 16 --cipher-iv-sz 16 --burst-sz 32 --total-ops 20000000
--buffer-sz 1024 --silent --docsis-hdr-sz 17

Signed-off-by: David Coyle <david.coyle@intel.com>
Signed-off-by: Mairtin o Loingsigh <mairtin.oloingsigh@intel.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
3 years agotest/security: add DOCSIS capability checks
David Coyle [Fri, 3 Jul 2020 12:39:32 +0000 (13:39 +0100)]
test/security: add DOCSIS capability checks

Add unit tests for DOCSIS capabilitity checks.

Signed-off-by: David Coyle <david.coyle@intel.com>
Signed-off-by: Mairtin o Loingsigh <mairtin.oloingsigh@intel.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
3 years agotest/crypto: add DOCSIS security cases
David Coyle [Fri, 3 Jul 2020 12:39:31 +0000 (13:39 +0100)]
test/crypto: add DOCSIS security cases

Add uplink and downlink DOCSIS unit test cases and vectors, to test
the combined DOCSIS Crypto-CRC support that has been added to the
rte_security library.

Signed-off-by: David Coyle <david.coyle@intel.com>
Signed-off-by: Mairtin o Loingsigh <mairtin.oloingsigh@intel.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
3 years agocrypto/qat: support DOCSIS protocol
David Coyle [Fri, 3 Jul 2020 12:39:30 +0000 (13:39 +0100)]
crypto/qat: support DOCSIS protocol

Add support to the QAT SYM PMD for the DOCSIS protocol, through the
rte_security API. This, therefore, includes adding support for the
rte_security API to this PMD.

Signed-off-by: David Coyle <david.coyle@intel.com>
Signed-off-by: Mairtin o Loingsigh <mairtin.oloingsigh@intel.com>
3 years agocrypto/aesni_mb: support DOCSIS protocol
David Coyle [Fri, 3 Jul 2020 12:39:29 +0000 (13:39 +0100)]
crypto/aesni_mb: support DOCSIS protocol

Add support to the AESNI-MB PMD for the DOCSIS protocol, through the
rte_security API. This, therefore, includes adding support for the
rte_security API to this PMD.

Signed-off-by: David Coyle <david.coyle@intel.com>
Signed-off-by: Mairtin o Loingsigh <mairtin.oloingsigh@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
3 years agocryptodev: add comments for DOCSIS protocol
David Coyle [Fri, 3 Jul 2020 12:39:28 +0000 (13:39 +0100)]
cryptodev: add comments for DOCSIS protocol

Add a note to the rte_crypto_sym_op->auth.data fields to state that
for DOCSIS security protocol, these are used to specify the offset and
length of data over which the CRC is calculated.

Signed-off-by: David Coyle <david.coyle@intel.com>
Signed-off-by: Mairtin o Loingsigh <mairtin.oloingsigh@intel.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
3 years agosecurity: support DOCSIS protocol
David Coyle [Fri, 3 Jul 2020 12:39:27 +0000 (13:39 +0100)]
security: support DOCSIS protocol

Add support for DOCSIS protocol to rte_security library. This support
currently comprises the combination of Crypto and CRC operations.

Signed-off-by: David Coyle <david.coyle@intel.com>
Signed-off-by: Mairtin o Loingsigh <mairtin.oloingsigh@intel.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
3 years agocrypto/qat: verify session IOVA
Adam Dybkowski [Mon, 8 Jun 2020 13:15:03 +0000 (15:15 +0200)]
crypto/qat: verify session IOVA

This patch adds the verification of the crypto session IOVA
that should be known (not zero) to proceed with the
session initialisation. In case of unknown IOVA
the error code -EINVAL is returned.

Signed-off-by: Adam Dybkowski <adamx.dybkowski@intel.com>
Acked-by: Fiona Trahe <fiona.trahe@intel.com>
3 years agocryptodev: verify session mempool element size
Adam Dybkowski [Mon, 8 Jun 2020 13:15:02 +0000 (15:15 +0200)]
cryptodev: verify session mempool element size

This patch adds the verification of the element size of the
mempool provided for the session creation. Returns the error
if the element size is too small to hold the session object.

Signed-off-by: Adam Dybkowski <adamx.dybkowski@intel.com>
Acked-by: Fiona Trahe <fiona.trahe@intel.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
3 years agotest/crypto: fix asymmetric session mempool creation
Adam Dybkowski [Mon, 8 Jun 2020 13:15:01 +0000 (15:15 +0200)]
test/crypto: fix asymmetric session mempool creation

This patch fixes the element size of the mempool used
for allocating asym crypto sessions and their private data.

Fixes: 2c6dab9cd93d ("test/crypto: add RSA and Mod tests")
Cc: stable@dpdk.org
Signed-off-by: Adam Dybkowski <adamx.dybkowski@intel.com>
Acked-by: Fiona Trahe <fiona.trahe@intel.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
3 years agodrivers/crypto: add missing OOP feature flag
Pablo de Lara [Thu, 4 Jun 2020 08:51:12 +0000 (08:51 +0000)]
drivers/crypto: add missing OOP feature flag

ZUC, SNOW3G and KASUMI PMDs support Out-of-place operations,
but their feature flags did not reflect this.

Fixes: 2717246ecd7d ("cryptodev: replace mbuf scatter gather flag")
Cc: stable@dpdk.org
Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
3 years agoexamples/ipsec-secgw: add per-core packet statistics
Anoob Joseph [Wed, 13 May 2020 17:45:19 +0000 (23:15 +0530)]
examples/ipsec-secgw: add per-core packet statistics

Adding per core packet handling stats to analyze traffic distribution
when multiple cores are engaged.

Since aggregating the packet stats across cores would affect
performance, keeping the feature disabled using compile time flags.

Signed-off-by: Anoob Joseph <anoobj@marvell.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
3 years agoeal: add multiprocess disable API
David Marchand [Mon, 6 Jul 2020 20:52:34 +0000 (22:52 +0200)]
eal: add multiprocess disable API

The multiprocess feature has been implicitly enabled so far.
Applications might want to explicitly disable like when using the
non-EAL threads registration API.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
3 years agomempool/bucket: handle non-EAL lcores
David Marchand [Mon, 6 Jul 2020 20:52:33 +0000 (22:52 +0200)]
mempool/bucket: handle non-EAL lcores

Convert to new lcore API to support non-EAL lcores.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
3 years agoeal: add lcore iterators
David Marchand [Mon, 6 Jul 2020 20:52:32 +0000 (22:52 +0200)]
eal: add lcore iterators

Add a helper to iterate all lcores.
The iterator callback is read-only wrt the lcores list.

Implement a dump function on top of this for debugging.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Reviewed-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
3 years agoeal: add lcore init callbacks
David Marchand [Mon, 6 Jul 2020 20:52:31 +0000 (22:52 +0200)]
eal: add lcore init callbacks

DPDK components and applications can have their say when a new lcore is
initialized. For this, they can register a callback for initializing and
releasing their private data.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
3 years agoeal: register non-EAL threads as lcores
David Marchand [Mon, 6 Jul 2020 20:52:30 +0000 (22:52 +0200)]
eal: register non-EAL threads as lcores

DPDK allows calling some part of its API from a non-EAL thread but this
has some limitations.
OVS (and other applications) has its own thread management but still
want to avoid such limitations by hacking RTE_PER_LCORE(_lcore_id) and
faking EAL threads potentially unknown of some DPDK component.

Introduce a new API to register non-EAL thread and associate them to a
free lcore with a new NON_EAL role.
This role denotes lcores that do not run DPDK mainloop and as such
prevents use of rte_eal_wait_lcore() and consorts.

Multiprocess is not supported as the need for cohabitation with this new
feature is unclear at the moment.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
3 years agoeal: move lcore role code
David Marchand [Mon, 6 Jul 2020 20:52:29 +0000 (22:52 +0200)]
eal: move lcore role code

For consistency sake, move all lcore role code in the dedicated
compilation unit / header.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Reviewed-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
3 years agoeal: introduce thread uninit helper
David Marchand [Mon, 6 Jul 2020 20:52:28 +0000 (22:52 +0200)]
eal: introduce thread uninit helper

This is a preparation step for dynamically unregistering threads.

Since we explicitly allocate a per thread trace buffer in
__rte_thread_init, add an internal helper to free this buffer.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
3 years agoeal: introduce thread init helper
David Marchand [Mon, 6 Jul 2020 20:52:27 +0000 (22:52 +0200)]
eal: introduce thread init helper

Introduce a helper responsible for initialising the per thread context.
We can then have a unified context for EAL and non-EAL threads and
remove copy/paste'd OS-specific helpers.

Per EAL thread CPU affinity setting is separated from the thread init.
It is to accommodate with Windows EAL where CPU affinity is not set at
the moment.
Besides, having affinity set by the master lcore in FreeBSD and Linux
will make it possible to detect errors rather than panic in the child
thread. But the cleanup when such an event happens is left for later.

A side-effect of this patch is that control threads can now use
recursive locks (rte_gettid() was not called before).

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
3 years agoeal: fix multiple definition of per lcore thread id
David Marchand [Mon, 6 Jul 2020 20:52:26 +0000 (22:52 +0200)]
eal: fix multiple definition of per lcore thread id

Because of the inline accessor + static declaration in rte_gettid(),
we end up with multiple symbols for RTE_PER_LCORE(_thread_id).
Each compilation unit will pay a cost when accessing this information
for the first time.

$ nm build/app/dpdk-testpmd | grep per_lcore__thread_id
0000000000000054 d per_lcore__thread_id.5037
0000000000000040 d per_lcore__thread_id.5103
0000000000000048 d per_lcore__thread_id.5259
000000000000004c d per_lcore__thread_id.5259
0000000000000044 d per_lcore__thread_id.5933
0000000000000058 d per_lcore__thread_id.6261
0000000000000050 d per_lcore__thread_id.7378
000000000000005c d per_lcore__thread_id.7496
000000000000000c d per_lcore__thread_id.8016
0000000000000010 d per_lcore__thread_id.8431

Make it global as part of the DPDK_21 stable ABI.

Fixes: ef76436c6834 ("eal: get unique thread id")

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Ray Kinsella <mdr@ashroe.eu>
Reviewed-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
3 years agoeal: relocate per thread symbols to common
David Marchand [Mon, 6 Jul 2020 20:52:25 +0000 (22:52 +0200)]
eal: relocate per thread symbols to common

We have per lcore thread symbols scattered in OS implementations but
common code relies on them.
Move all of them in common.

RTE_PER_LCORE(_socket_id) and RTE_PER_LCORE(_cpuset) have public
accessors and are not exported through the library map, they can be
made static.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Reviewed-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
3 years agodoc: announce deprecation of coherent I/O memory barriers
Honnappa Nagarahalli [Mon, 6 Jul 2020 23:43:33 +0000 (18:43 -0500)]
doc: announce deprecation of coherent I/O memory barriers

rte_cio_*mb APIs will be deprecated in 20.11 release.

Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
Reviewed-by: David Christensen <drc@linux.vnet.ibm.com>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
3 years agoeal/arm: adjust memory barriers for IO on ARMv8
Honnappa Nagarahalli [Mon, 6 Jul 2020 23:43:31 +0000 (18:43 -0500)]
eal/arm: adjust memory barriers for IO on ARMv8

Change the barrier APIs for IO to reflect that Armv8-a is other-multi-copy
atomicity memory model.

Armv8-a memory model has been strengthened to require
other-multi-copy atomicity. This property requires memory accesses
from an observer to become visible to all other observers
simultaneously [3]. This means

a) A write arriving at an endpoint shared between multiple CPUs is
   visible to all CPUs
b) A write that is visible to all CPUs is also visible to all other
   observers in the shareability domain

This allows for using cheaper DMB instructions in the place of DSB
for devices that are visible to all CPUs (i.e. devices that DPDK
caters to).

Please refer to [1], [2] and [3] for more information.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=22ec71615d824f4f11d38d0e55a88d8956b7e45f
[2] https://www.youtube.com/watch?v=i6DayghhA8Q
[3] https://www.cl.cam.ac.uk/~pes20/armv8-mca/

Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
Tested-by: Ruifeng Wang <ruifeng.wang@arm.com>
3 years agodoc: clarify period of alias to experimental symbol
Ray Kinsella [Tue, 7 Jul 2020 17:51:01 +0000 (18:51 +0100)]
doc: clarify period of alias to experimental symbol

Clarify retention period for aliases to experimental.

Signed-off-by: Ray Kinsella <mdr@ashroe.eu>
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
3 years agodoc: reword ABI policy for Windows
Ray Kinsella [Tue, 7 Jul 2020 17:51:00 +0000 (18:51 +0100)]
doc: reword ABI policy for Windows

Minor changes to the abi policy for windows.

Signed-off-by: Ray Kinsella <mdr@ashroe.eu>
3 years agotest/service: check active state on two lcores
Igor Romanov [Tue, 7 Jul 2020 10:45:25 +0000 (11:45 +0100)]
test/service: check active state on two lcores

The test checks that the service may be active API works
when there are two cores: a non-service lcore and a service one.

The API notes to take care when checking the status of a running
service, but the test setup allows for a safe usage in that case.

Signed-off-by: Igor Romanov <igor.romanov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Acked-by: Harry van Haaren <harry.van.haaren@intel.com>
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
3 years agoservice: fix lcore iteration
Igor Romanov [Tue, 7 Jul 2020 10:45:24 +0000 (11:45 +0100)]
service: fix lcore iteration

The service core list is populated, but not used. Incorrect
lcore states are examined for a service.

Use the populated list to iterate over service cores.

Fixes: e484ccddbe1b ("service: avoid false sharing on core state")
Cc: stable@dpdk.org
Signed-off-by: Igor Romanov <igor.romanov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Acked-by: Harry van Haaren <harry.van.haaren@intel.com>
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
3 years agorib: add C++ include guard
Stephen Hemminger [Thu, 25 Jun 2020 20:32:08 +0000 (13:32 -0700)]
rib: add C++ include guard

All include files should be safe from C++

Fixes: 5a5793a5ffa2 ("rib: add RIB library")
Fixes: f7e861e21c46 ("rib: support IPv6")
Cc: stable@dpdk.org
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>
3 years agorib: check for negative maximum of nodes
Stephen Hemminger [Thu, 25 Jun 2020 20:32:07 +0000 (13:32 -0700)]
rib: check for negative maximum of nodes

Max_nodes in config is signed, but a negative value makes
no sense. Get rid of extra BSD style parens.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>
3 years agorib: constify arguments
Stephen Hemminger [Thu, 25 Jun 2020 20:32:06 +0000 (13:32 -0700)]
rib: constify arguments

The getter functions should take a constant pointer
to make it clear that node is not modified.

The rib create functions do not modify their config structure.
Mark the config as constant so that programs can pass
simple constant data.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>
3 years agocfgfile: fix stack buffer underflow
Stephen Hemminger [Thu, 2 Jul 2020 03:05:58 +0000 (20:05 -0700)]
cfgfile: fix stack buffer underflow

If cfgfile is give a line with comment character at the start
of the line, it will dereference outside of the buffer.

Detected with address sanitizer:

SUMMARY: AddressSanitizer: stack-buffer-underflow
lib/librte_cfgfile/rte_cfgfile.c:194 in rte_cfgfile_load_with_params
Shadow bytes around the buggy address:
  0x200fff79f6a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x200fff79f6b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x200fff79f6c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x200fff79f6d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x200fff79f6e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
=>0x200fff79f6f0: 00 00 00 00 f1 f1 f1[f1]00 00 00 00 00 00 00 00
  0x200fff79f700: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x200fff79f710: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x200fff79f720: 04 f2 f2 f2 f3 f3 f3 f3 00 00 00 00 00 00 00 00
  0x200fff79f730: 00 00 00 00 00 00 00 00 00 00 f1 f1 f1 f1 00 f2
  0x200fff79f740: f2 f2 f3 f3 f3 f3 00 00 00 00 00 00 00 00 00 00
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07
  Heap left redzone:       fa
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
==2189==ABORTING

Fixes: a6a47ac9c2c9 ("cfgfile: rework load function")
Cc: stable@dpdk.org
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Reviewed-by: Bruce Richardson <bruce.richardson@intel.com>
3 years agorawdev: export dump function in map file
Bruce Richardson [Mon, 6 Jul 2020 10:31:32 +0000 (11:31 +0100)]
rawdev: export dump function in map file

The rte_rawdev_dump function was missing from the map file,
meaning it was unavailable for use when linking dynamically.

Fixes: c88b3f2558ed ("rawdev: introduce raw device library")
Cc: stable@dpdk.org
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
3 years agorawdev: fill NUMA socket ID in info
Bruce Richardson [Mon, 6 Jul 2020 10:31:31 +0000 (11:31 +0100)]
rawdev: fill NUMA socket ID in info

The rawdev info struct has a socket_id field which was not filled in.

We can also omit the checks for the parameter struct being null, since
that is previously checked in the function.

Fixes: c88b3f2558ed ("rawdev: introduce raw device library")
Cc: stable@dpdk.org
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
3 years agorawdev: allow getting info for unknown device
Bruce Richardson [Mon, 6 Jul 2020 10:31:30 +0000 (11:31 +0100)]
rawdev: allow getting info for unknown device

To call the rte_rawdev_info_get() function, the user currently has to know
the underlying type of the device in order to pass an appropriate structure
or buffer as the dev_private pointer in the info structure. By allowing a
NULL value for this field, we can skip getting the device-specific info and
just return the generic info - including the device name and driver, which
can be used to determine the device type - to the user.

This ensures that basic info can be get for all rawdevs, without knowing
the type, and even if the info driver API call has not been implemented for
the device.

Cc: stable@dpdk.org
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
3 years agotest: fix rpath for drivers with meson
Timothy Redaelli [Wed, 1 Jul 2020 17:16:38 +0000 (19:16 +0200)]
test: fix rpath for drivers with meson

This commit fixes the setting of relative rpath on dpdk-test for
drivers ($libdir/dpdk/pmd-$abiver) to the correct absolute rpath
($prefix$libdir/dpdk/pmd-$abiver).

Fixes: b5dc795a8a55 ("test: build app with meson as dpdk-test")
Cc: stable@dpdk.org
Signed-off-by: Timothy Redaelli <tredaelli@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
3 years agovfio: support VF token
Haiyue Wang [Fri, 3 Jul 2020 14:57:18 +0000 (22:57 +0800)]
vfio: support VF token

The Linux kernel module vfio-pci introduces the VF token to enable
SR-IOV support since 5.7.

The VF token can be set by a vfio-pci based PF driver and must be known
by the vfio-pci based VF driver in order to gain access to the device.

Since the vfio-pci module uses the VF token as internal data to provide
the collaboration between SR-IOV PF and VFs, so DPDK can use the same
VF token for all PF devices by specifying the related EAL option.

Signed-off-by: Haiyue Wang <haiyue.wang@intel.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
Tested-by: Harman Kalra <hkalra@marvell.com>
3 years agoeal: fix uuid header dependencies
Haiyue Wang [Fri, 3 Jul 2020 14:57:17 +0000 (22:57 +0800)]
eal: fix uuid header dependencies

Add the dependent header files explicitly, so that the user just needs
to include the 'rte_uuid.h' header file directly to avoid compile error:
 (1). rte_uuid.h:97:55: error: unknown type name ‘size_t’
 (2). rte_uuid.h:58:2: error: implicit declaration of function ‘memcpy’

Fixes: 6bc67c497a51 ("eal: add uuid API")
Cc: stable@dpdk.org
Signed-off-by: Haiyue Wang <haiyue.wang@intel.com>
Acked-by: David Marchand <david.marchand@redhat.com>
3 years agovfio: lower the priority of startup messages
Stephen Hemminger [Fri, 12 Jun 2020 00:10:04 +0000 (17:10 -0700)]
vfio: lower the priority of startup messages

The startup of VFIO is too noisy. Logging is expensive on some
systems, and distracting to the user.

It should not be logging at NOTICE level, reduce it to INFO level.
It really should be DEBUG here but that would hide it by default.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
3 years agovfio: remove unused variable
Yunjian Wang [Sat, 16 May 2020 07:58:39 +0000 (15:58 +0800)]
vfio: remove unused variable

The 'group_status' has never been used and can be removed.

Fixes: 94c0776b1bad ("vfio: support hotplug")
Cc: stable@dpdk.org
Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
3 years agoeal: fix lcore accessors for non-EAL threads
Stephen Hemminger [Wed, 8 Apr 2020 20:24:19 +0000 (13:24 -0700)]
eal: fix lcore accessors for non-EAL threads

If rte_lcore_index() is asked to give the index of the
current lcore (argument -1) and is called from a non-EAL thread
then it would invalid result. The result would come
lcore_config[-1].core_index which is some other data in the
per-thread area.

The resolution is to return -1 which is what rte_lcore_index()
returns if handed an invalid lcore.

Same issue existed with rte_lcore_to_cpu_id().

Bugzilla ID: 446
Fixes: 26cc3bbe4dc0 ("eal: add lcore accessors")

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: David Marchand <david.marchand@redhat.com>
3 years agoeal/armv8: force inlining of timer API
Honnappa Nagarahalli [Fri, 26 Jun 2020 20:35:02 +0000 (15:35 -0500)]
eal/armv8: force inlining of timer API

Change the inline functions to use __rte_always_inline to be
consistent with rest of the inline functions.

Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
3 years agoeal/armv8: fix timer frequency calibration with PMU
Honnappa Nagarahalli [Fri, 26 Jun 2020 20:35:01 +0000 (15:35 -0500)]
eal/armv8: fix timer frequency calibration with PMU

get_tsc_freq uses 'nanosleep' system call to calculate the CPU
frequency. However, 'nanosleep' results in the process getting
un-scheduled. The kernel saves and restores the PMU state. This
ensures that the PMU cycles are not counted towards a sleeping
process. When RTE_ARM_EAL_RDTSC_USE_PMU is defined, this results
in incorrect CPU frequency calculation. This logic is replaced
with generic counter based loop.

Bugzilla ID: 450
Fixes: f91bcbb2d9a6 ("eal/armv8: use high-resolution cycle counter")
Cc: stable@dpdk.org
Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Reviewed-by: Dharmik Thakkar <dharmik.thakkar@arm.com>
Reviewed-by: Phil Yang <phil.yang@arm.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
3 years agolog: remove unneeded logtype declaration
Jerin Jacob [Mon, 6 Jul 2020 13:08:11 +0000 (18:38 +0530)]
log: remove unneeded logtype declaration

RTE_LOG_REGISTER macro already declares the log type.
Remove the unneeded log type declaration.

Fixes: 9c99878aa1b1 ("log: introduce logtype register macro")

Reported-by: David Marchand <david.marchand@redhat.com>
Signed-off-by: Jerin Jacob <jerinj@marvell.com>
Acked-by: Gage Eads <gage.eads@intel.com>
3 years agorawdev: remove remaining experimental tags
Hemant Agrawal [Tue, 7 Jul 2020 08:54:07 +0000 (14:24 +0530)]
rawdev: remove remaining experimental tags

The experimental tags were removed, but the comment
is still having API classification as EXPERIMENTAL

Fixes: 931cc531aad2 ("rawdev: remove experimental tag")
Cc: stable@dpdk.org
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: David Marchand <david.marchand@redhat.com>
3 years agolib: remind experimental status in headers
David Marchand [Fri, 26 Jun 2020 08:16:38 +0000 (10:16 +0200)]
lib: remind experimental status in headers

The following libraries are experimental, all of their functions can
be changed or removed:

- librte_bbdev
- librte_bpf
- librte_compressdev
- librte_fib
- librte_flow_classify
- librte_graph
- librte_ipsec
- librte_node
- librte_rcu
- librte_rib
- librte_stack
- librte_telemetry

Their status is properly announced in MAINTAINERS.
Remind this status in their headers in a common fashion (aligned to ABI
docs).

Cc: stable@dpdk.org
Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
3 years agodrivers: drop workaround for internal libraries version
David Marchand [Fri, 26 Jun 2020 08:16:37 +0000 (10:16 +0200)]
drivers: drop workaround for internal libraries version

Now that all libraries have a single version, we can drop the empty
stable blocks that had been added when moving symbols from stable to
internal ABI.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
3 years agobuild: remove special versioning for non stable libraries
David Marchand [Fri, 26 Jun 2020 08:16:36 +0000 (10:16 +0200)]
build: remove special versioning for non stable libraries

Having a special versioning for experimental/internal libraries put a
additional maintenance cost while this status is already announced in
MAINTAINERS and the library headers/documentation.
Following discussions and vote at 05/20 TB meeting [1], use a single
versioning for all libraries in DPDK.

Note: for the ABI check, an exception [2] had been added when tweaking
this special versioning [3].
Prefer explicit libabigail rules (which will be dropped in 20.11).

1: https://mails.dpdk.org/archives/dev/2020-May/168450.html
2: https://git.dpdk.org/dpdk/commit/?id=23d7ad5db41c
3: https://git.dpdk.org/dpdk/commit/?id=ec2b8cd7ed69

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Ray Kinsella <mdr@ashroe.eu>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
3 years agombuf: build on Windows
Tal Shnaiderman [Thu, 25 Jun 2020 15:24:15 +0000 (18:24 +0300)]
mbuf: build on Windows

Build the lib for Windows.
Export needed EAL functions used by the lib.

Signed-off-by: Tal Shnaiderman <talshn@mellanox.com>
3 years agoeal: support endianness detection on Windows
Tal Shnaiderman [Thu, 25 Jun 2020 15:24:14 +0000 (18:24 +0300)]
eal: support endianness detection on Windows

Inclusion of the endian.h header is set only for Linux OS.

Windows endianness will be determined by the predefined
__BYTE_ORDER__ macro.

Signed-off-by: Tal Shnaiderman <talshn@mellanox.com>
3 years agomempool: build on Windows
Fady Bader [Mon, 6 Jul 2020 11:32:41 +0000 (14:32 +0300)]
mempool: build on Windows

Some EAL functions are used by mempool lib but not exported on Windows.
The functions are exported.
Added mempool to supported libraries for Windows compilation.

Signed-off-by: Fady Bader <fady@mellanox.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
3 years agomempool: use generic memory syscall wrappers
Fady Bader [Mon, 6 Jul 2020 11:32:40 +0000 (14:32 +0300)]
mempool: use generic memory syscall wrappers

Using generic memory management calls instead of Unix memory management
calls for mempool.

Signed-off-by: Fady Bader <fady@mellanox.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
3 years agoeal: disable function versioning on Windows
Fady Bader [Mon, 6 Jul 2020 11:32:39 +0000 (14:32 +0300)]
eal: disable function versioning on Windows

Function versioning implementation is not supported by Windows.
Function versioning is disabled on Windows.

Signed-off-by: Fady Bader <fady@mellanox.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
3 years agosched: fix port time rounding
Alan Dewar [Thu, 25 Jun 2020 09:59:30 +0000 (10:59 +0100)]
sched: fix port time rounding

The QoS scheduler works off port time that is computed from the number
of CPU cycles that have elapsed since the last time the port was
polled.   It divides the number of elapsed cycles to calculate how
many bytes can be sent, however this division can generate rounding
errors, where some fraction of a byte sent may be lost.

Lose enough of these fractional bytes and the QoS scheduler
underperforms.  The problem is worse with low bandwidths.

To compensate for this rounding error this fix doesn't advance the
port's time_cpu_cycles by the number of cycles that have elapsed,
but by multiplying the computed number of bytes that can be sent
(which has been rounded down) by number of cycles per byte.
This will mean that port's time_cpu_cycles will lag behind the CPU
cycles momentarily.  At the next poll, the lag will be taken into
account.

Fixes: de3cfa2c98 ("sched: initial import")
Cc: stable@dpdk.org
Signed-off-by: Alan Dewar <alan.dewar@att.com>
Acked-by: Jasvinder Singh <jasvinder.singh@intel.com>
3 years agoregexdev: implement API functions
Ori Kam [Mon, 6 Jul 2020 17:36:49 +0000 (17:36 +0000)]
regexdev: implement API functions

This commit implements all the RegEx public API.

Signed-off-by: Ori Kam <orika@mellanox.com>
Acked-by: Guy Kaneti <guyk@marvell.com>
3 years agoregexdev: add core functions
Ori Kam [Mon, 6 Jul 2020 17:36:48 +0000 (17:36 +0000)]
regexdev: add core functions

This commit introduce the API that is needed by the RegEx devices in
order to work with the RegEX lib.

During the probe of a RegEx device, the device should configure itself,
and allocate the resources it requires.
On completion of the device init, it should call the
rte_regex_dev_register in order to register itself as a RegEx device.

Signed-off-by: Ori Kam <orika@mellanox.com>
Signed-off-by: Parav Pandit <parav@mellanox.com>
Acked-by: Guy Kaneti <guyk@marvell.com>
3 years agoregexdev: add core structures
Ori Kam [Mon, 6 Jul 2020 17:36:47 +0000 (17:36 +0000)]
regexdev: add core structures

This commit introduce the rte_regexdev_core.h file.
This file holds internal structures and API that are used by
the regexdev.

Signed-off-by: Ori Kam <orika@mellanox.com>
Acked-by: Guy Kaneti <guyk@marvell.com>
3 years agoregexdev: introduce API
Jerin Jacob [Mon, 6 Jul 2020 17:36:46 +0000 (17:36 +0000)]
regexdev: introduce API

As RegEx usage become more used by DPDK applications, for example:
* Next Generation Firewalls (NGFW)
* Deep Packet and Flow Inspection (DPI)
* Intrusion Prevention Systems (IPS)
* DDoS Mitigation
* Network Monitoring
* Data Loss Prevention (DLP)
* Smart NICs
* Grammar based content processing
* URL, spam and adware filtering
* Advanced auditing and policing of user/application security policies
* Financial data mining - parsing of streamed financial feeds
* Application recognition.
* Dmemory introspection.
* Natural Language Processing (NLP)
* Sentiment Analysis.
* Big data database acceleration.
* Computational storage.

Number of PMD providers started to work on HW implementation,
along side with SW implementations.

This lib adds the support for those kind of devices.

The RegEx Device API is composed of two parts:
- The application-oriented RegEx API that includes functions to setup
  a RegEx device (configure it, setup its queue pairs and start it),
  update the rule database and so on.

- The driver-oriented RegEx API that exports a function allowing
  a RegEx poll Mode Driver (PMD) to simultaneously register itself as
  a RegEx device driver.

RegEx device components and definitions:

    +-----------------+
    |                 |
    |                 o---------+    rte_regexdev_[en|de]queue_burst()
    |   PCRE based    o------+  |               |
    |  RegEx pattern  |      |  |  +--------+   |
    | matching engine o------+--+--o        |   |    +------+
    |                 |      |  |  | queue  |<==o===>|Core 0|
    |                 o----+ |  |  | pair 0 |        |      |
    |                 |    | |  |  +--------+        +------+
    +-----------------+    | |  |
           ^               | |  |  +--------+
           |               | |  |  |        |        +------+
           |               | +--+--o queue  |<======>|Core 1|
       Rule|Database       |    |  | pair 1 |        |      |
    +------+----------+    |    |  +--------+        +------+
    |     Group 0     |    |    |
    | +-------------+ |    |    |  +--------+        +------+
    | | Rules 0..n  | |    |    |  |        |        |Core 2|
    | +-------------+ |    |    +--o queue  |<======>|      |
    |     Group 1     |    |       | pair 2 |        +------+
    | +-------------+ |    |       +--------+
    | | Rules 0..n  | |    |
    | +-------------+ |    |       +--------+
    |     Group 2     |    |       |        |        +------+
    | +-------------+ |    |       | queue  |<======>|Core n|
    | | Rules 0..n  | |    +-------o pair n |        |      |
    | +-------------+ |            +--------+        +------+
    |     Group n     |
    | +-------------+ |<-------rte_regexdev_rule_db_update()
    | |             | |<-------rte_regexdev_rule_db_compile_activate()
    | | Rules 0..n  | |<-------rte_regexdev_rule_db_import()
    | +-------------+ |------->rte_regexdev_rule_db_export()
    +-----------------+

RegEx: A regular expression is a concise and flexible means for matching
strings of text, such as particular characters, words, or patterns of
characters. A common abbreviation for this is â~@~\RegExâ~@~].

RegEx device: A hardware or software-based implementation of RegEx
device API for PCRE based pattern matching syntax and semantics.

PCRE RegEx syntax and semantics specification:
http://regexkit.sourceforge.net/Documentation/pcre/pcrepattern.html

RegEx queue pair: Each RegEx device should have one or more queue pair to
transmit a burst of pattern matching request and receive a burst of
receive the pattern matching response. The pattern matching
request/response embedded in *rte_regex_ops* structure.

Rule: A pattern matching rule expressed in PCRE RegEx syntax along with
Match ID and Group ID to identify the rule upon the match.

Rule database: The RegEx device accepts regular expressions and converts
them into a compiled rule database that can then be used to scan data.
Compilation allows the device to analyze the given pattern(s) and
pre-determine how to scan for these patterns in an optimized fashion that
would be far too expensive to compute at run-time. A rule database
contains a set of rules that compiled in device specific binary form.

Match ID or Rule ID: A unique identifier provided at the time of rule
creation for the application to identify the rule upon match.

Group ID: Group of rules can be grouped under one group ID to enable
rule isolation and effective pattern matching. A unique group identifier
provided at the time of rule creation for the application to identify
the rule upon match.

Scan: A pattern matching request through *enqueue* API.

It may possible that a given RegEx device may not support all the
features
of PCRE. The application may probe unsupported features through
struct rte_regexdev_info::pcre_unsup_flags

By default, all the functions of the RegEx Device API exported by a PMD
are lock-free functions which assume to not be invoked in parallel on
different logical cores to work on the same target object. For instance,
the dequeue function of a PMD cannot be invoked in parallel on two logical
cores to operates on same RegEx queue pair. Of course, this function
can be invoked in parallel by different logical core on different queue
pair. It is the responsibility of the upper level application to
enforce this rule.

In all functions of the RegEx API, the RegEx device is
designated by an integer >= 0 named the device identifier *dev_id*

At the RegEx driver level, RegEx devices are represented by a generic
data structure of type *rte_regexdev*.
RegEx devices are dynamically registered during the PCI/SoC device
probing phase performed at EAL initialization time.
When a RegEx device is being probed, a *rte_regexdev* structure and
a new device identifier are allocated for that device. Then, the
regexdev_init() function supplied by the RegEx driver matching the
probed device is invoked to properly initialize the device.

The role of the device init function consists of resetting the hardware
or software RegEx driver implementations.

If the device init operation is successful, the correspondence between
the device identifier assigned to the new device and its associated
*rte_regexdev* structure is effectively registered.
Otherwise, both the *rte_regexdev* structure and the device identifier
are freed.

The functions exported by the application RegEx API to setup a device
designated by its device identifier must be invoked in the following
order:
    - rte_regexdev_configure()
    - rte_regexdev_queue_pair_setup()
    - rte_regexdev_start()

Then, the application can invoke, in any order, the functions
exported by the RegEx API to enqueue pattern matching job, dequeue
pattern matching response, get the stats, update the rule database,
get/set device attributes and so on

If the application wants to change the configuration (i.e. call
rte_regexdev_configure() or rte_regexdev_queue_pair_setup()), it must
call rte_regexdev_stop() first to stop the device and then do the
reconfiguration before calling rte_regexdev_start() again. The enqueue and
dequeue functions should not be invoked when the device is stopped.

Finally, an application can close a RegEx device by invoking the
rte_regexdev_close() function.

Each function of the application RegEx API invokes a specific function
of the PMD that controls the target device designated by its device
identifier.

For this purpose, all device-specific functions of a RegEx driver are
supplied through a set of pointers contained in a generic structure of
type *regexdev_ops*.
The address of the *regexdev_ops* structure is stored in the
*rte_regexdev* structure by the device init function of the RegEx driver,
which is invoked during the PCI/SoC device probing phase, as explained
earlier.

In other words, each function of the RegEx API simply retrieves the
*rte_regexdev* structure associated with the device identifier and
performs an indirect invocation of the corresponding driver function
supplied in the *regexdev_ops* structure of the *rte_regexdev*
structure.

For performance reasons, the address of the fast-path functions of the
RegEx driver is not contained in the *regexdev_ops* structure.
Instead, they are directly stored at the beginning of the *rte_regexdev*
structure to avoid an extra indirect memory access during their
invocation.

RTE RegEx device drivers do not use interrupts for enqueue or dequeue
operation. Instead, RegEx drivers export Poll-Mode enqueue and dequeue
functions to applications.

The *enqueue* operation submits a burst of RegEx pattern matching
request to the RegEx device and the *dequeue* operation gets a burst of
pattern matching response for the ones submitted through *enqueue*
operation.

Typical application utilisation of the RegEx device API will follow the
following programming flow.

- rte_regexdev_configure()
- rte_regexdev_queue_pair_setup()
- rte_regexdev_rule_db_update() Needs to invoke if precompiled rule
  database not
  provided in rte_regexdev_config::rule_db for rte_regexdev_configure()
  and/or application needs to update rule database.
- rte_regexdev_rule_db_compile_activate() Needs to invoke if
  rte_regexdev_rule_db_update function was used.
- Create or reuse exiting mempool for *rte_regex_ops* objects.
- rte_regexdev_start()
- rte_regexdev_enqueue_burst()
- rte_regexdev_dequeue_burst()

Signed-off-by: Jerin Jacob <jerinj@marvell.com>
Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Signed-off-by: Ori Kam <orika@mellanox.com>
3 years agodevtools: fix check of variable declaration inside for
David Marchand [Mon, 6 Jul 2020 08:00:22 +0000 (10:00 +0200)]
devtools: fix check of variable declaration inside for

An expression with a space is split by the awk script resulting in
false positive for any patch matching any of the two part of the
expression.
Fix this by using [[:space:]].

Fixes: 43e73483a4b8 ("devtools: forbid variable declaration inside for")

Signed-off-by: David Marchand <david.marchand@redhat.com>
3 years agodevtools: fix path in forbidden token check
David Marchand [Mon, 6 Jul 2020 08:00:21 +0000 (10:00 +0200)]
devtools: fix path in forbidden token check

Fix displayed filename by adjusting the extraction from the patch.

Before:
Warning in /lib/librte_eal/linux/eal.c:

After:
Warning in lib/librte_eal/linux/eal.c:

Fixes: 7413e7f2aeb3 ("devtools: alert on new calls to exit from libs")
Cc: stable@dpdk.org
Signed-off-by: David Marchand <david.marchand@redhat.com>
3 years agoevent/octeontx2: improve datapath memory locality
Pavan Nikhilesh [Mon, 29 Jun 2020 01:33:28 +0000 (07:03 +0530)]
event/octeontx2: improve datapath memory locality

When event device is transmitting packet on OCTEONTX2 it needs to access
the destined ethernet device TXq data.
Currently, we get the TXq data through rte_eth_devices global array.
Instead save the TXq address inside event port memory.

Cc: stable@dpdk.org
Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
3 years agoevent/octeontx2: fix sub event type
Pavan Nikhilesh [Mon, 29 Jun 2020 01:33:27 +0000 (07:03 +0530)]
event/octeontx2: fix sub event type

In OCTEONTX2 event device we use sub_event_type to store the ethernet
port identifier when we receive work from OCTEONTX2 ethernet device.
This violates the event device spec as sub_event_type should be 0 in
the initial receive stage.
Set sub_event_type to 0 after copying the port id.

Fixes: 0fe4accd8ec8 ("event/octeontx2: add Rx adapter fastpath ops")
Cc: stable@dpdk.org
Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
3 years agoevent/octeontx2: fix device reconfigure
Pavan Nikhilesh [Mon, 29 Jun 2020 01:33:26 +0000 (07:03 +0530)]
event/octeontx2: fix device reconfigure

When event device is re-configured maintain the event queue to event port
links and event port status instead of resetting them.

Fixes: cd24e70258bd ("event/octeontx2: add device configure function")
Cc: stable@dpdk.org
Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
3 years agoexamples/eventdev: fix 32-bit coremask
Harry van Haaren [Tue, 16 Jun 2020 16:56:03 +0000 (17:56 +0100)]
examples/eventdev: fix 32-bit coremask

This commit fixes a bug in 32-bit environments when a core mask greater
than 32-bits is requested. The fix is to convert the bitmask logic to
64 bits, aligning 64 and 32 bit implementations.

Fixes: adb5d548 ("examples/eventdev_pipeline_sw_pmd: add sample app")
Cc: stable@dpdk.org
Reported-by: Jun W Zhou <junx.w.zhou@intel.com>
Suggested-by: Mao Jiang <maox.jiang@intel.com>
Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>
3 years agoevent/octeontx: fix memory corruption
Harman Kalra [Fri, 15 May 2020 11:21:24 +0000 (16:51 +0530)]
event/octeontx: fix memory corruption

Since PMD enqueues a single event at a time, fixing the issue by
passing 1 rather than nb_events to avoid any out of bound access as
reported by coverity.

Coverity issue: 358447
Fixes: 56a96aa42464 ("event/octeontx: add framework for Rx/Tx offloads")
Cc: stable@dpdk.org
Signed-off-by: Harman Kalra <hkalra@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
3 years agotrace: simplify trace point registration
David Marchand [Sat, 4 Jul 2020 15:14:08 +0000 (17:14 +0200)]
trace: simplify trace point registration

RTE_TRACE_POINT_DEFINE and RTE_TRACE_POINT_REGISTER must come in pairs.
Merge them and let RTE_TRACE_POINT_REGISTER handle the constructor part.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
3 years agoeal: restrict default plugin path to shared lib mode
Bruce Richardson [Fri, 26 Jun 2020 14:59:57 +0000 (15:59 +0100)]
eal: restrict default plugin path to shared lib mode

When using statically linked DPDK binaries, the EAL checks the default PMD
path and tries to load any drivers there, despite the fact that all drivers
are normally linked into the binary.  This behaviour can cause issues if
the PMD path and lib dir is configured to a non-standard location which is
not in the ld.so.conf paths, e.g. a build with prefix set to a home
directory location. In a case such as this, EAL will try and
(unnecessarily) load the .so driver files but that load will fail as their
dependent libraries, such as ethdev, for example, will not be found.

Because of this, it is better if statically linked DPDK apps do not load
drivers from the standard paths automatically. The user can always have
this behaviour by explicitly specifying the path using -d flag, if so
desired.

Not loading the libraries automatically can also prevent potential issues
with a user building and running a statically-linked DPDK binary based off
a private copy of DPDK, while there exists on the same machine a
system-wide installation of DPDK in the default locations. Without this
change, the system-installed drivers will be loaded to the binary alongside
the statically-linked drivers, which is not what the user would have
intended.

To detect whether we are in a statically or dynamically linked binary, we
can have EAL try to get a dlopen handle to its own shared library, by
calling dlopen with the RTLD_NOLOAD flag. This will return NULL if there is
no such shared lib loaded i.e. the code is executing from a static library,
or a handle to the lib if it is loaded.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
Tested-by: Sunil Pai G <sunil.pai.g@intel.com>
3 years agoeal: cache last directory permissions checked
Bruce Richardson [Fri, 3 Jul 2020 10:23:32 +0000 (11:23 +0100)]
eal: cache last directory permissions checked

When loading a directory of drivers, we check the same hierarchy multiple
times. If we just cache the last directory checked, this avoids repeated
checks of the same path, since all drivers in that path have been added to
the list consecutively.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
3 years agoeal: forbid loading drivers from insecure paths
Bruce Richardson [Fri, 3 Jul 2020 10:23:31 +0000 (11:23 +0100)]
eal: forbid loading drivers from insecure paths

Any paths on the system which are world-writable are insecure and should
not be used for loading drivers. Therefore, whenever an absolute or
relative driver path is passed to EAL, check for world-writability and
don't load any drivers from that path if it is insecure. Drivers loaded
from system locations i.e. those passed without any path info and found
automatically by the loader, are excluded from these checks as system paths
are assumed to be secure.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
3 years agoeal: load only shared libs from driver plugin directories
Bruce Richardson [Fri, 3 Jul 2020 10:23:30 +0000 (11:23 +0100)]
eal: load only shared libs from driver plugin directories

When we pass a "-d" flag to EAL pointing to a directory, we attempt to load
all files in that directory as driver plugins, irrespective of file type.
This procludes using e.g. the build/drivers directory, as a driver source
since it contains static libs and other files as well as the shared
objects.

By filtering out any files whose filename does not end in ".so", we can
improve usability by allowing other non-driver files to be present in the
driver directory.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
3 years agoeal: remove unnecessary null-termination in plugin path
Bruce Richardson [Fri, 3 Jul 2020 10:23:29 +0000 (11:23 +0100)]
eal: remove unnecessary null-termination in plugin path

Since strlcpy always null-terminates, and the buffer is zeroed before copy
anyway, there is no need to explicitly zero the end of the character
array, or to limit the bytes that strlcpy can write.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
3 years agobuild: check AVX512 rather than binutils version
Bruce Richardson [Sat, 4 Jul 2020 11:48:01 +0000 (12:48 +0100)]
build: check AVX512 rather than binutils version

Rather than checking the binutils version number, which can lead to
unnecessary disabling of AVX512 if fixes have been backported to distro
versions, we can instead check the output of "as" from binutils to see if
it is correct.

The check in the script uses the minimal assembly reproduction code posted
to the public bug tracker for gcc/binutils for those issues [1]. If the
binutils bug is present, the instruction parameters - specifically the
displacement parameter - will be different in the disassembled output
compared to the input. Therefore the check involves assembling a single
instruction and disassembling it again, checking that the two match.

[1] https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90028

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Tested-by: Harry van Haaren <harry.van.haaren@intel.com>