Commit Graph

6200 Commits

Author SHA1 Message Date
Asaf Penso
f6eb393849 ethdev: add 200G link speed
There is no way to report back a link speed of 200Gbps.

Adding 200G link speed.

Signed-off-by: Asaf Penso <asafp@mellanox.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
2020-05-11 22:27:39 +02:00
Arek Kusztal
a0f0de06d4 cryptodev: fix ABI compatibility for ChaCha20-Poly1305
This patch adds versioned function rte_cryptodev_info_get()
to prevent some issues with ABI policy.
Node v21 works in same way as before, returning driver capabilities
directly to the API caller. These capabilities may include new elements
not part of the v20 ABI.
Node v20 function maintains compatibility with v20 ABI releases
by stripping out elements not supported in v20 ABI. Because
rte_cryptodev_info_get is called by other API functions,
rte_cryptodev_sym_capability_get function is versioned the same way.

Fixes: b922dbd38c ("cryptodev: add ChaCha20-Poly1305 AEAD algorithm")

Signed-off-by: Arek Kusztal <arkadiuszx.kusztal@intel.com>
Acked-by: Ray Kinsella <mdr@ashroe.eu>
Acked-by: Fiona Trahe <fiona.trahe@intel.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
2020-05-11 13:17:43 +02:00
Arek Kusztal
b922dbd38c cryptodev: add ChaCha20-Poly1305 AEAD algorithm
This patch adds Chacha20-Poly1305 AEAD algorithm to Cryptodev.

Signed-off-by: Arek Kusztal <arkadiuszx.kusztal@intel.com>
Acked-by: Fiona Trahe <fiona.trahe@intel.com>
Acked-by: Anoob Joseph <anoobj@marvell.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
2020-05-11 13:17:43 +02:00
Vladimir Medvedkin
e62893f5ec ipsec: check SAD lookup error
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: b2ee269267 ("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>
2020-05-11 13:17:43 +02:00
Akhil Goyal
e11bdd3774 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>
2020-05-11 13:17:43 +02:00
Phil Yang
1a805dee01 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>
2020-05-11 13:17:43 +02:00
Nicolas Chautru
cc29fea1ca bbdev: fix doxygen comments
Several doxygen markup were incorrect in header files.

Fixes: 4935e1e9f7 ("bbdev: introduce wireless base band device lib")
Cc: stable@dpdk.org

Signed-off-by: Nicolas Chautru <nicolas.chautru@intel.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
2020-05-11 13:17:43 +02:00
Ferruh Yigit
867b49d17a 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>
2020-05-11 19:20:54 +02:00
David Marchand
dd6275a424 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: 6dd571fd07 ("telemetry: introduce new functionality")

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2020-05-11 18:58:14 +02:00
David Marchand
a1d8f30925 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: 6dd571fd07 ("telemetry: introduce new functionality")

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2020-05-11 17:44:13 +02:00
Bing Zhao
b341a09c1d 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: fdf20fa7be ("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>
2020-05-11 17:44:13 +02:00
Phil Yang
205032bbfc 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>
2020-05-11 13:21:54 +02:00
Phil Yang
41e8227e20 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>
2020-05-11 13:21:54 +02:00
Phil Yang
6c8d14ffbb 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>
2020-05-11 13:21:54 +02:00
Phil Yang
7a0ad72f6e 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>
2020-05-11 13:21:54 +02:00
Honnappa Nagarahalli
5c76111f06 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: 8d39d3e237 ("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>
2020-05-11 13:17:05 +02:00
Honnappa Nagarahalli
18cae99cb9 service: fix race condition for MT unsafe service
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: e9139a32f6 ("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>
2020-05-11 09:33:45 +02:00
Bruce Richardson
293c53d8b2 eal: add telemetry callbacks
EAL now registers commands to provide some basic info from EAL.

Example:
Connecting to /var/run/dpdk/rte/dpdk_telemetry.v2
{"version": "DPDK 20.05.0-rc0", "pid": 72662, "max_output_len": 16384}
--> /
{"/": ["/", "/eal/app_params", "/eal/params", "/ethdev/link_status", \
    "/ethdev/list", "/ethdev/xstats", "/help", "/info", "/rawdev/list", \
    "/rawdev/xstats"]}
--> /eal/app_params
{"/eal/app_params": ["-i"]}
--> /eal/params
{"/eal/params": ["./app/dpdk-testpmd"]}

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>
2020-05-11 00:37:16 +02:00
Ciara Power
e122b0bff9 eal: remove option registration infrastructure
As Telemetry no longer uses rte_option, and was the only user of this
infrastructure, it can now be removed.

Signed-off-by: Ciara Power <ciara.power@intel.com>
Reviewed-by: Keith Wiles <keith.wiles@intel.com>
2020-05-11 00:37:16 +02:00
Ciara Power
eeb486f3ba 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>
2020-05-11 00:37:16 +02:00
Ciara Power
63e7cb1bf1 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>
2020-05-11 00:37:16 +02:00
Ciara Power
b80fe1805e 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>
2020-05-11 00:37:15 +02:00
Ciara Power
b1ad0e1245 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:

Connecting to /var/run/dpdk/rte/dpdk_telemetry.v2
{"version": "DPDK 20.05.0-rc0", "pid": 65777, "max_output_len": 16384}
--> /
{"/": ["/", "/ethdev/link_status", "/ethdev/list", "/ethdev/xstats", \
    "/help", "/info", "/rawdev/list", "/rawdev/xstats"]}
--> /rawdev/list
{"/rawdev/list": [0, 1, 2, 3, 4, 5]}
--> /rawdev/xstats,0
{"/rawdev/xstats": {"failed_enqueues": 0, "successful_enqueues": 0, \
    "copies_started": 0, "copies_completed": 0}}

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>
2020-05-11 00:37:09 +02:00
Bruce Richardson
c190daedb9 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.

An example using ethdev commands is shown below:

Connecting to /var/run/dpdk/rte/dpdk_telemetry.v2
{"version": "DPDK 20.05.0-rc0", "pid": 64379, "max_output_len": 16384}
--> /
{"/": ["/", "/ethdev/link_status", "/ethdev/list", "/ethdev/xstats", \
    "/help", "/info"]}
--> /ethdev/list
{"/ethdev/list": [0, 1, 2, 3]}
--> /ethdev/link_status,0
{"/ethdev/link_status": {"status": "UP", "speed": 10000, "duplex": \
    "full-duplex"}}
--> /ethdev/xstats,0
{"/ethdev/xstats": {"rx_good_packets": 0, "tx_good_packets": 0, \
    <snip>
    "tx_priority7_xon_to_xoff_packets": 0}}

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>
2020-05-11 00:37:01 +02:00
Ciara Power
f38748736e 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>
2020-05-10 23:56:33 +02:00
Bruce Richardson
ed1bfad7d3 telemetry: add functions for returning callback data
The functions added in this patch will help applications build
up data in reply to a telemetry request.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Keith Wiles <keith.wiles@intel.com>
2020-05-10 23:54:25 +02:00
Bruce Richardson
6dd571fd07 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>
2020-05-10 23:53:57 +02:00
Bruce Richardson
52af6ccb2b 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>
2020-05-10 23:52:41 +02:00
Bruce Richardson
07c1b6925b 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>
2020-05-10 23:52:00 +02:00
Ciara Power
bb8f5fc317 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>
2020-05-10 23:50:32 +02:00
Ciara Power
c5b7197f66 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>
2020-05-10 23:46:18 +02:00
Bruce Richardson
44dfb297af 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>
2020-05-10 23:45:02 +02:00
Kevin Laatz
dec44d4110 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>
2020-05-07 14:51:06 +02:00
Pallavi Kadam
5ebf83784d eal/windows: support logging
Initialize logging on Windows to send log output
to the console.

Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
Reviewed-by: Tasnim Bashar <tbashar@mellanox.com>
Tested-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
Tested-by: Narcisa Vasile <navasile@linux.microsoft.com>
Acked-by: Narcisa Vasile <navasile@linux.microsoft.com>
2020-05-07 12:18:18 +02:00
Pallavi Kadam
98e792a35c 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

Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
Reviewed-by: Tasnim Bashar <tbashar@mellanox.com>
Tested-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
Acked-by: Narcisa Vasile <navasile@linux.microsoft.com>
2020-05-07 12:18:17 +02:00
Pavan Nikhilesh
a5f30c925b eventdev: fix probe and remove for secondary process
When probing event device in secondary process skip reinitializing
the device data structure as it is already done in primary process.

When removing event device in secondary process skip closing the
event device as it should be done by primary process.

Fixes: 322d0345c2 ("eventdev: implement PMD registration functions")
Cc: stable@dpdk.org

Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
2020-05-02 12:31:57 +02:00
Joyce Kong
3fc1d87c2a virtio: use one way barrier for split vring avail index
In case VIRTIO_F_ORDER_PLATFORM(36) is not negotiated, then the frontend
and backend are assumed to be implemented in software, that is they can
run on identical CPUs in an SMP configuration.
Thus a weak form of memory barriers like rte_smp_r/wmb, other than
rte_cio_r/wmb, is sufficient for this case(vq->hw->weak_barriers == 1)
and yields better performance.
For the above case, this patch helps yielding even better performance
by replacing the two-way barriers with C11 one-way barriers for avail
index in split ring.

Signed-off-by: Joyce Kong <joyce.kong@arm.com>
Reviewed-by: Gavin Hu <gavin.hu@arm.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
2020-05-05 15:54:26 +02:00
Joyce Kong
ea5207c158 virtio: use one way barrier for split vring used index
In case VIRTIO_F_ORDER_PLATFORM(36) is not negotiated, then the frontend
and backend are assumed to be implemented in software, that is they can
run on identical CPUs in an SMP configuration.
Thus a weak form of memory barriers like rte_smp_r/wmb, other than
rte_cio_r/wmb, is sufficient for this case(vq->hw->weak_barriers == 1)
and yields better performance.
For the above case, this patch helps yielding even better performance
by replacing the two-way barriers with C11 one-way barriers for used
index in split ring.

Signed-off-by: Joyce Kong <joyce.kong@arm.com>
Reviewed-by: Gavin Hu <gavin.hu@arm.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
2020-05-05 15:54:26 +02:00
Marvin Liu
faa9867c4d vhost: use binary search in address conversion
If Tx zero copy enabled, gpa to hpa mapping table is updated one by
one. This will harm performance when guest memory backend using 2M
hugepages. Now utilize binary search to find the entry in mapping
table, meanwhile set the threshold to 256 entries for linear search.

Signed-off-by: Marvin Liu <yong.liu@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
2020-05-05 15:54:26 +02:00
Marvin Liu
20fd2f91cf vhost: utilize dynamic memory allocator
Replace dynamic memory allocator with dpdk memory allocator.

Signed-off-by: Marvin Liu <yong.liu@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
2020-05-05 15:54:26 +02:00
Xuan Ding
715070ea10 vhost: prevent zero-copy with incompatible client mode
In server mode, virtio-user inits under the assumption that vhost-user
supports a list of features. However, this could be problematic when
in_order feature is negotiated but not supported by vhost-user when
enables dequeue_zero_copy later.

Add handling when vhost-user enables dequeue_zero_copy as client.

Fixes: 64ab701c3d ("vhost: add vhost-user client mode")
Cc: stable@dpdk.org

Signed-off-by: Xuan Ding <xuan.ding@intel.com>
Tested-by: Yinan Wang <yinan.wang@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
2020-05-05 15:54:26 +02:00
Phil Yang
7ffe400019 vhost: optimize broadcast RARP sync with C11 atomic
The rarp packet broadcast flag is synchronized with rte_atomic_XX APIs
which is a full barrier, DMB, on aarch64. This patch optimized it with
c11 atomic one-way barrier.

Signed-off-by: Phil Yang <phil.yang@arm.com>
Reviewed-by: Gavin Hu <gavin.hu@arm.com>
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
Reviewed-by: Joyce Kong <joyce.kong@arm.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
2020-05-05 15:54:26 +02:00
Roland Qi
41f32b052c vhost: fix peer close check
In process_slave_message_reply(), there is a
possibility that receiving a peer close
message instead of a real message response.

This patch targeting to handle the peer close
scenario and report the correct error message.

Fixes: a277c71598 ("vhost: refactor code structure")
Cc: stable@dpdk.org

Signed-off-by: Roland Qi <roland.qi@ucloud.cn>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
2020-05-05 15:54:26 +02:00
David Christensen
67889d1130 eal/ppc: fix build with gcc 9.3
Building DPDK on Ubuntu 20.04 with GCC 9.3.0 results in a "subscript is
outside array bounds" message in rte_memcpy function.  The build error
is caused by an interaction between __builtin_constant_p and
"-Werror=array-bounds" as described in this bugzilla:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90387

Modify the code to disable the array-bounds check for GCC versions 9.0
to 9.3.

Cc: stable@dpdk.org

Signed-off-by: David Christensen <drc@linux.vnet.ibm.com>
2020-05-06 18:12:57 +02:00
Olivier Matz
b2aa2c9723 kvargs: fix invalid token parsing on FreeBSD
The behavior of strtok_r() is not the same between GNU libc and FreeBSD
libc: in the first case, the context is set to "" when the last token is
returned, while in the second case it is set to NULL.

On FreeBSD, the current code crashes because we are dereferencing a NULL
pointer (ctx1). Fix it by first checking if it is NULL. This works with
both GNU and FreeBSD libc.

Fixes: ffcf831454 ("kvargs: fix buffer overflow when parsing list")
Cc: stable@dpdk.org

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Tested-by: Zhimin Huang <zhiminx.huang@intel.com>
2020-05-06 15:22:19 +02:00
Phil Yang
b2f8a22e79 trace: fix build with gcc 10
Prevent from writing beyond the allocated memory.

GCC 10 compiling output:
eal_common_trace_utils.c: In function 'eal_trace_dir_args_save':
eal_common_trace_utils.c:290:24: error: '__builtin___sprintf_chk'   \
	may write a terminating nul past the end of the destination \
	[-Werror=format-overflow=]
  290 |  sprintf(dir_path, "%s/", optarg);
      |                        ^

Fixes: 8af866df8d ("trace: add trace directory configuration parameter")

Signed-off-by: Phil Yang <phil.yang@arm.com>
Reviewed-by: Lijian Zhang <lijian.zhang@arm.com>
Tested-by: Lijian Zhang <lijian.zhang@arm.com>
Acked-by: Sunil Kumar Kori <skori@marvell.com>
Signed-off-by: David Marchand <david.marchand@redhat.com>
2020-05-06 15:07:18 +02:00
David Marchand
3df4282917 trace: remove string duplication
No need to duplicate an untouched string.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Sunil Kumar Kori <skori@marvell.com>
2020-05-06 15:07:18 +02:00
David Marchand
970a407648 trace: remove limitation on patterns number
There is nothing performance sensitive in this list, use dynamic
allocations and remove the arbitrary limit on the number of trace
patterns a user can pass.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Sunil Kumar Kori <skori@marvell.com>
2020-05-06 15:07:07 +02:00
David Marchand
d73b9f83cd trace: remove unneeded checks in internal API
The trace framework can be configured via 4 EAL options:
- --trace which calls eal_trace_args_save,
- --trace-dir which calls eal_trace_dir_args_save,
- --trace-bufsz which calls eal_trace_bufsz_args_save,
- --trace-mode which calls eal_trace_mode_args_save.

Those 4 internal callbacks are getting passed a non NULL value:
optarg won't be NULL since those options are declared with
required_argument (man getopt_long).

eal_trace_bufsz_args_save() already trusted passed value, align the other
3 internal callbacks.

Coverity issue: 357768
Fixes: 8c8066ea6a ("trace: add trace mode configuration parameter")

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Sunil Kumar Kori <skori@marvell.com>
2020-05-06 13:50:32 +02:00
David Marchand
b86aebcb6f trace: avoid confusion on optarg
Prefer a local name to optarg which is a global symbol from the C library.

Fixes: 8c8066ea6a ("trace: add trace mode configuration parameter")

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Sunil Kumar Kori <skori@marvell.com>
2020-05-06 13:50:32 +02:00
David Marchand
ebaee64097 trace: simplify trace point headers
Invert the current trace point headers logic by making
rte_trace_point_register.h include rte_trace_point.h.

There is no more need for a RTE_TRACE_POINT_REGISTER_SELECT special macro
since including rte_trace_point_register.h itself means we want to
register trace points.

The unexplained "provider" notion is removed from the documentation and
rte_trace_point_provider.h is merged into rte_trace_point.h.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
2020-05-06 13:50:32 +02:00
David Marchand
b4f2fde1a5 cryptodev: fix trace points registration
Those trace points are defined but not registered.

Fixes: 4cf30e3f3c ("cryptodev: add tracepoints")

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Sunil Kumar Kori <skori@marvell.com>
2020-05-06 13:50:32 +02:00
Ori Kam
f5bf02df31 eal/ppc: fix bool type after altivec include
The AltiVec header file breaks boolean type. [1] [2]

Currently the workaround was located only in mlx5 device.
Adding the trace module caused this issue to appear again, due to
order of includes, it keeps overriding the local fix.

This patch solves this issue by resetting the bool type, immediately
after it is being changed.

[1] https://mails.dpdk.org/archives/dev/2018-August/110281.html

[2]
In file included from
dpdk/ppc_64-power8-linux-gcc/include/rte_mempool_trace_fp.h:18:0,
                 from
dpdk/ppc_64-power8-linux-gcc/include/rte_mempool.h:54,
                 from
dpdk/drivers/common/mlx5/mlx5_common_mr.c:7:
dpdk/ppc_64-power8-linux-gcc/include/rte_trace_point.h: In
function '__rte_trace_point_fp_is_enabled':
dpdk/ppc_64-power8-linux-gcc/include/rte_trace_point.h:226:2:
error: incompatible types when returning type 'int' but '__vector __bool
int' was expected
  return false;
  ^
In file included from
dpdk/ppc_64-power8-linux-gcc/include/rte_trace_point.h:281:0,
                 from
dpdk/ppc_64-power8-linux-gcc/include/rte_mempool_trace_fp.h:18,
                 from
dpdk/ppc_64-power8-linux-gcc/include/rte_mempool.h:54,
                 from
dpdk/drivers/common/mlx5/mlx5_common_mr.c:7:
dpdk/ppc_64-power8-linux-gcc/include/rte_mempool_trace_fp.h:
In function 'rte_mempool_trace_ops_dequeue_bulk':
dpdk/ppc_64-power8-linux-gcc/include/rte_trace_point_provider.h:104:6:
error: wrong type argument to unary exclamation mark
  if (!__rte_trace_point_fp_is_enabled()) \
      ^
dpdk/ppc_64-power8-linux-gcc/include/rte_trace_point.h:49:2:
note: in expansion of macro '__rte_trace_point_emit_header_fp'
  __rte_trace_point_emit_header_##_mode(&__##_tp); \
  ^
dpdk/ppc_64-power8-linux-gcc/include/rte_trace_point.h:99:2:
note: in expansion of macro '__RTE_TRACE_POINT'
  __RTE_TRACE_POINT(fp, tp, args, __VA_ARGS__)
  ^
dpdk/ppc_64-power8-linux-gcc/include/rte_mempool_trace_fp.h:20:1:
note: in expansion of macro 'RTE_TRACE_POINT_FP'
 RTE_TRACE_POINT_FP(
 ^
dpdk/ppc_64-power8-linux-gcc/include/rte_mempool_trace_fp.h:
In function 'rte_mempool_trace_ops_dequeue_contig_blocks':
dpdk/ppc_64-power8-linux-gcc/include/rte_trace_point_provider.h:104:6:
error: wrong type argument to unary exclamation mark
  if (!__rte_trace_point_fp_is_enabled()) \
      ^
dpdk/ppc_64-power8-linux-gcc/include/rte_trace_point.h:49:2:
note: in expansion of macro '__rte_trace_point_emit_header_fp'
  __rte_trace_point_emit_header_##_mode(&__##_tp); \
  ^
dpdk/ppc_64-power8-linux-gcc/include/rte_trace_point.h:99:2:
note: in expansion of macro '__RTE_TRACE_POINT'
  __RTE_TRACE_POINT(fp, tp, args, __VA_ARGS__)
  ^
dpdk/ppc_64-power8-linux-gcc/include/rte_mempool_trace_fp.h:29:1:
note: in expansion of macro 'RTE_TRACE_POINT_FP'
 RTE_TRACE_POINT_FP(
 ^
dpdk/ppc_64-power8-linux-gcc/include/rte_mempool_trace_fp.h:
In function 'rte_mempool_trace_ops_enqueue_bulk':
dpdk/ppc_64-power8-linux-gcc/include/rte_trace_point_provider.h:104:6:
error: wrong type argument to unary exclamation mark
  if (!__rte_trace_point_fp_is_enabled()) \

Fixes: 725f5dd0bf ("net/mlx5: fix build on PPC64")

Signed-off-by: Ori Kam <orika@mellanox.com>
Signed-off-by: David Christensen <drc@linux.vnet.ibm.com>
Tested-by: David Christensen <drc@linux.vnet.ibm.com>
Tested-by: Raslan Darawsheh <rasland@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
2020-05-06 11:45:13 +02:00
Kevin Traynor
b5b3ea803e eal/x86: ignore gcc 10 stringop-overflow warnings
stringop-overflow warns when it sees a possible overflow
in a string operation.

In the rte_memcpy functions different branches are taken
depending on the size. stringop-overflow is raised for the
branches in the function where it sees the static size of the
src could be overflowed.

However, in reality a correct size argument and in some cases
dynamic allocation would ensure that this does not happen.

For example, in the case below for key, the correct path will be
chosen in rte_memcpy_generic at runtime based on the size argument
but as some paths in the function could lead to a cast to 32 bytes
a warning is raised.

In function ‘_mm256_storeu_si256’,
inlined from ‘rte_memcpy_generic’
at ../lib/librte_eal/common/include/arch/x86/rte_memcpy.h:315:2,
inlined from ‘iavf_configure_rss_key’
at ../lib/librte_eal/common/include/arch/x86/rte_memcpy.h:869:10:

/usr/lib/gcc/x86_64-redhat-linux/10/include/avxintrin.h:928:8:
warning: writing 32 bytes into a region of size 1 [-Wstringop-overflow=]
  928 |   *__P = __A;
      |   ~~~~~^~~~~
In file included
from ../drivers/net/iavf/../../common/iavf/iavf_prototype.h:10,
from ../drivers/net/iavf/iavf.h:9,
from ../drivers/net/iavf/iavf_vchnl.c:22:

../drivers/net/iavf/iavf_vchnl.c:
In function ‘iavf_configure_rss_key’:

../drivers/net/iavf/../../common/iavf/virtchnl.h:508:5:
note: at offset 0 to object ‘key’ with size 1 declared here
  508 |  u8 key[1];         /* RSS hash key, packed bytes */
      |     ^~~

Ignore the stringop-overflow warnings for rte_memcpy.h functions.

Bugzilla ID: 394
Bugzilla ID: 421
Cc: stable@dpdk.org

Signed-off-by: Kevin Traynor <ktraynor@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
2020-05-06 11:45:10 +02:00
Nithin Dabilpuram
da4b610415 node: add packet drop
Add packet drop node process function for pkt_drop
rte_node. This node simply free's every object received as
an rte_mbuf to its rte_pktmbuf pool.

Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
2020-05-05 23:42:13 +02:00
Nithin Dabilpuram
f00708c2aa node: add IPv4 rewrite and lookup control
Add ip4_rewrite and ip4_lookup ctrl API. ip4_lookup ctrl
API is used to add route entries for LPM lookup with
result data containing next hop id and next proto.
ip4_rewrite ctrl API is used to add rewrite data for
every next hop.

Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
2020-05-05 23:41:30 +02:00
Kiran Kumar K
0d352661e0 node: add IPv4 rewrite
Add ip4 rewrite process function for ip4_rewrite
rte_node. On every packet received by this node,
header is overwritten with new data before forwarding
it to next node. Header data to overwrite with is
identified by next hop id passed in mbuf priv data
by previous node.

Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
2020-05-05 23:41:11 +02:00
Pavan Nikhilesh
11afaa84d0 node: add IPv4 lookup for x86
Add IPv4 lookup process function for ip4_lookup
rte_node. This node performs LPM lookup using x86_64
vector supported RTE_LPM API on every packet received
and forwards it to a next node that is identified by
lookup result.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
2020-05-05 23:41:05 +02:00
Nithin Dabilpuram
16df6a2c66 node: add IPv4 lookup for arm64
Add arm64 specific IPv4 lookup process function
for ip4_lookup node. This node performs LPM lookup
on every packet received and forwards it to a next
node that is identified by lookup result.

Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
2020-05-05 23:40:36 +02:00
Pavan Nikhilesh
0555f11c2e node: add generic IPv4 lookup
Add IPv4 lookup process function for ip4_lookup node.
This node performs LPM lookup using simple RTE_LPM API on every packet
received and forwards it to a next node that is identified by lookup
result.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
2020-05-05 23:40:22 +02:00
Nithin Dabilpuram
947d7f682f node: add ethdev control
Add ctrl api to setup ethdev_rx and ethdev_tx node.
This ctrl api clones 'N' number of ethdev_rx and ethdev_tx
nodes with specific (port, queue) pairs updated in their context.
All the ethdev ports and queues are setup before this api
is called.

Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
2020-05-05 23:38:35 +02:00
Nithin Dabilpuram
77edede86f node: add ethdev Tx
Add rte_node ethdev_tx process function and register it to
graph infra. This node has a specific (port, tx-queue) as context
and it enqueue's all the packets received to that specific queue pair.
When rte_eth_tx_burst() i.e enqueue to queue pair fails, packets
are forwarded to pkt_drop node to be free'd.

Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
2020-05-05 23:38:31 +02:00
Nithin Dabilpuram
f0f804236f node: add ethdev Rx
Add source rte_node ethdev_rx process function and register
it. This node is a source node that will be called periodically
and when called, performs rte_eth_rx_burst() on a specific
(port, queue) pair and enqueue them as stream of objects to
next node.

Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
2020-05-05 23:38:10 +02:00
Nithin Dabilpuram
13fcf8aff7 node: add logging and null node
Add log infra for node specific logging.
Also, add null rte_node that just ignores all the objects
directed to it.

Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
2020-05-05 23:37:43 +02:00
Jerin Jacob
40d4f51403 graph: implement fastpath routines
Adding implementation for rte_graph_walk() API. This will perform a walk
on the circular buffer and call the process function of each node
and collect the stats if stats collection is enabled.

Signed-off-by: Jerin Jacob <jerinj@marvell.com>
Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
2020-05-05 23:32:02 +02:00
Jerin Jacob
af1ae8b6a3 graph: implement stats
Adding implementation for graph stats collection API. This API will
create a cluster for a specified node pattern and aggregate the node
runtime stats.

Signed-off-by: Jerin Jacob <jerinj@marvell.com>
Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
2020-05-05 23:31:53 +02:00
Jerin Jacob
85c0b5285f graph: implement debug routines
Adding implementation for graph specific API to dump the
Graph information to a file. This API will dump detailed internal
info about node objects and graph objects.

Signed-off-by: Jerin Jacob <jerinj@marvell.com>
Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
2020-05-05 23:31:47 +02:00
Jerin Jacob
618d05635e graph: implement Graphviz export
Adding API implementation support exporting the graph object to file.
This will export the graph to a file in Graphviz format.
It can be viewed in many viewers such as
https://dreampuf.github.io/GraphvizOnline/

Signed-off-by: Jerin Jacob <jerinj@marvell.com>
Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
2020-05-05 23:31:41 +02:00
Jerin Jacob
c671b62cc5 graph: implement graph operations
Adding support for graph specific API implementation like
Graph lookup to get graph object, retrieving graph ID
From name and graph name from ID.

Signed-off-by: Jerin Jacob <jerinj@marvell.com>
Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
2020-05-05 23:30:19 +02:00
Jerin Jacob
a91fecc19c graph: implement create and destroy
Adding graph specific API implementations like graph create
and graph destroy. This detect loops in the graph,
check for isolated nodes and operation to verify the validity of
graph.

Signed-off-by: Jerin Jacob <jerinj@marvell.com>
Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
2020-05-05 23:29:43 +02:00
Jerin Jacob
d6bba625cd graph: populate fastpath memory for graph reel
Adding support to create and populate the memory for graph reel.
This includes reserving the memory in the memzone, populating the nodes,
Allocating memory for node-specific streams to hold objects.

Once it is populated the reel memory contains the following sections.

+---------------------+
|   Graph Header      |
+---------------------+
|   Fence             |
+---------------------+
|   Circular buffer   |
+---------------------+
|   Fence             |
+---------------------+
|   Node Object 0     |
+------------------- -+
|   Node Object 1     |
+------------------- -+
|   Node Object 2     |
+------------------- -+
|   Node Object n     |
+------------------- -+

Signed-off-by: Jerin Jacob <jerinj@marvell.com>
Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
2020-05-05 23:28:24 +02:00
Jerin Jacob
32bd4751f9 graph: implement internal operation helpers
Adding internal graph API helpers support to check whether a graph has
isolated nodes and any node have a loop to itself and BFS
algorithm implementation etc.

Signed-off-by: Jerin Jacob <jerinj@marvell.com>
Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
2020-05-05 23:28:13 +02:00
Jerin Jacob
9027182689 graph: implement node debug routines
Adding node debug API implementation support to dump
single or all the node objects to the given file.

Signed-off-by: Jerin Jacob <jerinj@marvell.com>
Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
2020-05-05 23:28:09 +02:00
Jerin Jacob
c59dac2ca1 graph: implement node operations
Adding node-specific API implementation like cloning node, updating
edges for the node, shrinking edges of a node, retrieving edges of a
node.

Signed-off-by: Jerin Jacob <jerinj@marvell.com>
Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
2020-05-05 23:28:07 +02:00
Jerin Jacob
c7c995cc58 graph: implement node registration
Adding rte_node_register() API implementation includes allocating
memory for node object, check for duplicate node name and
add the allocated node to STAILQ node_list for future use.

Signed-off-by: Jerin Jacob <jerinj@marvell.com>
Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
2020-05-05 23:28:03 +02:00
Jerin Jacob
a2da742768 graph: define API
Graph architecture abstracts the data processing functions as
"node" and "link" them together to create a complex "graph" to enable
reusable/modular data processing functions.

These APIs enables graph framework operations such as create, lookup,
dump and destroy on graph and node operations such as clone,
edge update, and edge shrink, etc. The API also allows creating the
stats cluster to monitor per graph and per node stats.

This patch defines the public API for graph support.
This patch also adds support for the build infrastructure and
update the MAINTAINERS file for the graph subsystem.

Signed-off-by: Jerin Jacob <jerinj@marvell.com>
Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
2020-05-05 23:27:49 +02:00
Olivier Matz
c0280d5d8a mempool: return 0 if area is too small on populate
Change rte_mempool_populate_iova() and rte_mempool_populate_virt() to
return 0 instead of -EINVAL when there is not enough room to store one
object, as it can be helpful for applications to distinguish this
specific case.

As this is an ABI change, use symbol versioning to preserve old
behavior for binary applications.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
Acked-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
2020-05-05 00:27:05 +02:00
Ray Kinsella
105f3039c7 version: reference next ABI 21 for recent additions
Change references to ABI 20.0.1 to use ABI v21, see
https://doc.dpdk.org/guides/contributing/abi_policy.html#general-guidelines

"Major ABI versions are declared no more frequently than yearly.
Compatibility with the major ABI version is mandatory in subsequent
releases until a new major ABI version is declared."

Combined ABI policy and versioning in maintainers, add map files to the
filter to more closely monitor future ABI changes.

Signed-off-by: Ray Kinsella <mdr@ashroe.eu>
2020-05-05 00:25:34 +02:00
David Marchand
37924a2f07 ethdev: fix build warning on 64-bit value
Building OVS with dpdk, sparse complains about 64-bit constant being
passed as a normal integer that can't fit it:
error: constant 0xffffffffffffffff is so big it is unsigned long

Fixes: ecbc857013 ("ethdev: add PFCP header to flow API")

Signed-off-by: David Marchand <david.marchand@redhat.com>
Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
2020-04-28 11:34:40 +02:00
David Marchand
a3e283ed90 eal: fix typo in endian conversion macros
Caught by code inspection, for little endian, RTE_LEXX macros should
provide rte_leXX_t type values.

Fixes: b75667ef9f ("eal: add static endianness conversion macros")
Cc: stable@dpdk.org

Signed-off-by: David Marchand <david.marchand@redhat.com>
Reviewed-by: Bruce Richardson <bruce.richardson@intel.com>
2020-04-28 11:34:40 +02:00
David Marchand
2ead29e1d6 ring: fix build with -Wswitch-enum
Some popular vswitch implementation might use a gcc option that
complains about missing enums in switch statements.
Fix this by listing all possible values.

Fixes: 664ff4b172 ("ring: introduce peek style API")

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
2020-04-28 11:34:40 +02:00
Phil Yang
2f89dc2ed7 timer: relax barrier for status update
Volatile has no ordering semantics. The rte_timer structure defines
timer status as a volatile variable and uses the rte_r/wmb barrier
to guarantee inter-thread visibility.

This patch optimized the volatile operation with c11 atomic operations
and one-way barrier to save the performance penalty. According to the
timer_perf_autotest benchmarking results, this patch can uplift 10%~16%
timer appending performance, 3%~20% timer resetting performance and 45%
timer callbacks scheduling performance on aarch64 and no loss in
performance for x86.

Suggested-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
Signed-off-by: Phil Yang <phil.yang@arm.com>
Reviewed-by: Gavin Hu <gavin.hu@arm.com>
Acked-by: Erik Gabriel Carrillo <erik.g.carrillo@intel.com>
2020-04-26 22:07:38 +02:00
Dmitry Kozlyuk
9ca37645c7 eal: disable tracing on Windows
Fix build errors caused by using Unix-specific functions in common code.
Hide and disable command-line options related to tracing on Windows.

Fixes: 3d26a70ae3 ("trace: add trace configuration parameter")
Fixes: 3b155d24bd ("trace: hook subsystem to Linux")

Reported-by: Pallavi Kadam <pallavi.kadam@intel.com>
Suggested-by: Thomas Monjalon <thomas@monjalon.net>
Signed-off-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
2020-04-26 20:03:56 +02:00
Thomas Monjalon
27efcf2003 mem: fix build
Some compilers (on RHEL7 and CentOS7) were getting this error:
	error: "RTE_EXEC_ENV_FREEBSD" is not defined [-Werror=undef]

Existence of a macro must be checked with "#ifdef" or "#if defined".

Fixes: d72e4042c5 ("mem: exclude unused memory from core dump")

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Tested-by: Raslan Darawsheh <rasland@mellanox.com>
2020-04-26 13:27:08 +02:00
Muhammad Bilal
ec5a905ec8 mbuf: prevent setting mempool ops name empty
Bugzilla ID: 353

Signed-off-by: Muhammad Bilal <m.bilal@emumba.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
2020-04-25 22:56:10 +02:00
Luca Boccassi
611faa5f46 fix various typos found by Lintian
Cc: stable@dpdk.org

Signed-off-by: Luca Boccassi <bluca@debian.org>
2020-04-25 19:53:47 +02:00
Honnappa Nagarahalli
68f7f31aaa timer: protect initialization with lock
rte_timer_subsystem_initialized is a global variable that can be
accessed by multiple processes simultaneously. Hence, any access
to rte_timer_subsystem_initialized should be protected by
rte_mcfg_timer_lock.

Fixes: f9d6cd8bfe ("timer: fix resource leak in finalize")
Cc: stable@dpdk.org

Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
Reviewed-by: Gavin Hu <gavin.hu@arm.com>
Reviewed-by: Phil Yang <phil.yang@arm.com>
Acked-by: Erik Gabriel Carrillo <erik.g.carrillo@intel.com>
2020-04-25 19:26:47 +02:00
Vladimir Medvedkin
a5a4d86d1e ipsec: use hash lookup with signatures in SAD lookup
Change hash function from jhash to crc.
Precalculate hash signatures for a bulk of keys and then
use rte_hash_lookup_with_hash_bulk_data() to speed up sad lookup
Also use rte_hash_add_key_with_hash and _del_key_with_hash with
precalculated hash signature for a key in rte_ipsec_sad_add and
rte_ipsec_sad_del

Signed-off-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
2020-04-25 19:26:47 +02:00
Vladimir Medvedkin
14b8ab5762 hash: add bulk lookup with signatures array
Implement rte_hash_lookup_with_hash_bulk_data() and
rte_hash_lookup_with_hash_bulk() - bulk lookup
functions with precomputed hash signatures.
Add these two functions into performance tests.

Signed-off-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>
Acked-by: Yipeng Wang <yipeng1.wang@intel.com>
2020-04-25 19:26:47 +02:00
Haiyue Wang
4c82473412 build: add internal tag check
Add checks during build to ensure that all symbols in the INTERNAL
version map section have __internal tags on their definitions, and
enable the warnings needed to announce their use.

Signed-off-by: Haiyue Wang <haiyue.wang@intel.com>
Signed-off-by: David Marchand <david.marchand@redhat.com>
2020-04-25 17:01:01 +02:00
Haiyue Wang
2d148778d2 build: enable internal API tag
Allow the drivers and libraries to use the internal tag for marking
internal ABI symbols.

Signed-off-by: Haiyue Wang <haiyue.wang@intel.com>
2020-04-25 17:01:00 +02:00
Haiyue Wang
fba5af82ad eal: add internal ABI tag definition
Introduce the __rte_internal tag to mark internal ABI function which is
used only by the drivers or other libraries.
Like for __rte_experimental, this tag must be on a separate line before
function proprotypes.

Signed-off-by: Haiyue Wang <haiyue.wang@intel.com>
2020-04-25 17:01:00 +02:00
Aaron Conole
cf5a605da6 ip_frag: ensure minimum v6 fragmentation length
In addition, do a formal parameter check.

Signed-off-by: Aaron Conole <aconole@redhat.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
2020-04-25 15:15:27 +02:00
Aaron Conole
c2cad3f6bc ip_frag: ensure minimum v4 fragmentation length
Do a formal parameter check of mtu length, as well as
checking the the various inputs for validity.  If any
aren't acceptable, we bail.

Signed-off-by: Aaron Conole <aconole@redhat.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
2020-04-25 15:15:23 +02:00
David Marchand
269e1d04a1 eal: fix build on armv7
Caught by OBS on armv7:

In file included from .../lib/librte_eal/include/rte_string_fns.h:21,
                 from .../lib/librte_kvargs/rte_kvargs.c:9:
.../lib/librte_eal/include/rte_common.h:67:37: error: expected '=', ',',
 ';', 'asm' or '__attribute__' before '__rte_aligned'
   67 | typedef uint64_t unaligned_uint64_t __rte_aligned(1);
      |                                     ^~~~~~~~~~~~~
.../lib/librte_eal/include/rte_common.h:68:37: error: expected '=', ',',
 ';', 'asm' or '__attribute__' before '__rte_aligned'
   68 | typedef uint32_t unaligned_uint32_t __rte_aligned(1);
      |                                     ^~~~~~~~~~~~~
.../lib/librte_eal/include/rte_common.h:69:37: error: expected '=', ',',
 ';', 'asm' or '__attribute__' before '__rte_aligned'
   69 | typedef uint16_t unaligned_uint16_t __rte_aligned(1);
      |                                     ^~~~~~~~~~~~~
make[3]: *** [.../mk/internal/rte.compile-pre.mk:116: rte_kvargs.o] Error 1

Move __rte_aligned macro definition before alignment types used by
architectures requiring RTE_ARCH_STRICT_ALIGN like armv7.

Fixes: f35e5b3e07 ("replace alignment attributes")

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
2020-04-24 19:36:17 +02:00
Li Feng
d72e4042c5 mem: exclude unused memory from core dump
Currently, even though memory is mapped with PROT_NONE, this does not
cause it to be excluded from core dumps. This is counter-productive,
because in a lot of cases, this memory will go unused (e.g. when the
memory subsystem preallocates VA space but hasn't yet mapped physical
pages into it).

Use `madvise()` call with MADV_DONTDUMP/MADV_NOCORE to exclude the
unused memory from being dumped.

Signed-off-by: Li Feng <fengli@smartx.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
2020-04-24 19:36:17 +02:00
Li Feng
76e91e3f14 mem: mark pages as not accessed when freeing memory
Commit 8a4baf06c1 ("mem: mark pages as not accessed when reserving VA")
has mapped the initialized memory with PROT_NONE, and when it's unmapped,
eal_memalloc.c should remmap the anonymous memory with PROT_NONE too.

Fixes: 8a4baf06c1 ("mem: mark pages as not accessed when reserving VA")
Cc: stable@dpdk.org

Signed-off-by: Li Feng <fengli@smartx.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
2020-04-24 19:36:17 +02:00
Stephen Hemminger
a9aa14d9aa eal: fix comments spelling
Fix spelling errors in comments (found with codespell).

Note that "inbetween" is not correct in English and should
either be two words or better yet, the in can be dropped.
https://www.grammarly.com/blog/in-between-or-inbetween/

Fixes: 12f45fa7e2 ("eal/arm: read timer from PMU if enabled")
Fixes: 096ffd811f ("eal/x86: use lock-prefixed instructions for SMP barrier")
Fixes: 1d406458db ("mem: make segment preallocation OS-specific")
Fixes: bb372060da ("malloc: make heap a doubly-linked list")
Fixes: 7353ee7344 ("fbarray: add API to find biggest used or free chunks")
Cc: stable@dpdk.org

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2020-04-24 19:29:06 +02:00
Stephen Hemminger
e2635408a0 lpm6: fix comments spelling
Fix spelling errors in comments.

Fixes: e480688dce ("lpm6: add incremental update on delete")
Cc: stable@dpdk.org

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
2020-04-24 19:29:02 +02:00
Alex Kiselev
64c46bacf4 lpm6: fix size of tbl8 group
Fixes: e480688dce ("lpm6: add incremental update on delete")
Cc: stable@dpdk.org

Signed-off-by: Alex Kiselev <alex@therouter.net>
Acked-by: Andrzej Ostruszka <aostruszka@marvell.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2020-04-24 19:19:44 +02:00
Yangchao Zhou
a26aa0d5e2 lpm: skip table entries update if rules found
Table entries do not need to be updated if the same rules can be found.

Signed-off-by: Yangchao Zhou <zhouyates@gmail.com>
Acked-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>
2020-04-24 19:19:44 +02:00
Fady Bader
036d82365e mempool: remove inline functions from export list
The code didn't compile when using exported mempool functions
under Windows.

compilation error logs:
rte_mempool_exports.def : error LNK2001:
unresolved external symbol rte_mempool_cache_flush
rte_mempool_exports.def : error LNK2001:
unresolved external symbol rte_mempool_default_cache
rte_mempool_exports.def : error LNK2001:
unresolved external symbol rte_mempool_generic_get
rte_mempool_exports.def : error LNK2001:
unresolved external symbol rte_mempool_generic_put
lib\librte_mempool.dll.a : fatal error LNK1120: 4 unresolved externals
clang: error: linker command failed with exit code 1120 (use -v to see invocation)

The cause was that there were some inline functions that were included
in the export list.
To solve this the functions, which are implemented in the header
and shouldn't be exported, were removed from rte_mempool_version.map
export list.

Fixes: 4b5062755a ("mempool: allow user-owned cache")
Fixes: 656f2d3ede ("mempool: deprecate specific get and put functions")
Cc: stable@dpdk.org

Signed-off-by: Fady Bader <fady@mellanox.com>
Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
2020-04-24 18:11:49 +02:00
Konstantin Ananyev
34dff8bacc security: fix crash at accessing non-implemented ops
Valid checks for optional function pointers inside dev-ops
were disabled by undefined macro.

Fixes: b6ee985478 ("security: fix verification of parameters")
Cc: stable@dpdk.org

Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
2020-04-23 17:56:38 +02:00
Alexander Kozyrev
6c55b622a9 net/mlx5: set dynamic flow metadata in Rx queues
Using a global mbuf dynamic field for metadata incurs some
performance penalty on a datapath. Store this information in
the Rx queue descriptor for a better cache locality.

Fixes: a18ac61133 ("net/mlx5: add metadata support to Rx datapath")
Cc: stable@dpdk.org

Signed-off-by: Alexander Kozyrev <akozyrev@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
2020-04-21 22:28:06 +02:00
Jeff Guo
e482a3c9f5 ethdev: add RSS offload types
Defines some new RSS offload types for ETH/S_VLAN/C_VLAN/L2TPV3/
/PFCP/L2_SRC_ONLY/L2_DST_ONLY.

Signed-off-by: Jeff Guo <jia.guo@intel.com>
Reviewed-by: Qi Zhang <qi.z.zhang@intel.com>
Reviewed-by: Bernard Iremonger <bernard.iremonger@intel.com>
Acked-by: Ori Kam <orika@mellanox.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
2020-04-21 18:03:19 +02:00
Dong Zhou
44bf3c796b ethdev: support flow aging
One of the reasons to destroy a flow is the fact that no packet matches
the flow for "timeout" time.
For example, when TCP\UDP sessions are suddenly closed.

Currently, there is not any DPDK mechanism for flow aging and the
applications use their own ways to detect and destroy aged-out flows.

The flow aging implementation need include:
- A new rte_flow action: RTE_FLOW_ACTION_TYPE_AGE to set the timeout and
  the application flow context for each flow.
- A new ethdev event: RTE_ETH_EVENT_FLOW_AGED for the driver to report
  that there are new aged-out flows.
- A new rte_flow API: rte_flow_get_aged_flows to get the aged-out flows
  contexts from the port.
- Support input flow aging command line in Testpmd.

The new event type addition in the enum is flagged as an ABI breakage,
so an ignore rule is added for these reasons:
- It is not changing value of existing types (except MAX)
- The new value is not used by existing API if the event is not
  registered
In general, it is safe adding new ethdev event types at the end of the
enum, because of event callback registration mechanism.

Signed-off-by: Dong Zhou <dongz@mellanox.com>
Acked-by: Ori Kam <orika@mellanox.com>
Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
Acked-by: Matan Azrad <matan@mellanox.com>
2020-04-21 17:34:05 +02:00
Marvin Liu
c7de6f9be5 vhost: fix shadowed descriptors not flushed
When ring size or enqueue packets not aligned with batch number, it is
possible that descs update still kept in shadowed used structure when
batched enqueue. Fix this issue by flushing remained shadowed used descs
before batch flush.

Fixes: f41516c309 ("vhost: flush batched enqueue descs directly")
Cc: stable@dpdk.org

Signed-off-by: Marvin Liu <yong.liu@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
2020-04-21 13:57:09 +02:00
Marvin Liu
8b13d12a16 vhost: fix shadow update
Defer shadow ring update introduces functional issue which has been
described in Eugenio's fix patch.

The current implementation of vhost_net in packed vring tries to fill
the shadow vector before send any actual changes to the guest. While
this can be beneficial for the throughput, it conflicts with some
bufferfloats methods like the linux kernel napi, that stops
transmitting packets if there are too much bytes/buffers in the
driver.

It also introduces performance issue when frontend run much faster than
backend. Frontend may not be able to collect available descs when shadow
update is deferred. That will harm RFC2544 throughput.

Appropriate choice is to remove deferred shadowed update method.
Now shadowed used descs are flushed at the end of dequeue function.

Fixes: 31d6c6a5b8 ("vhost: optimize packed ring dequeue")
Cc: stable@dpdk.org

Signed-off-by: Marvin Liu <yong.liu@intel.com>
Tested-by: Yinan Wang <yinan.wang@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
2020-04-21 13:57:08 +02:00
Bernard Iremonger
496a253c79 ethdev: add RSS offload types for ESP and AH
Add ETH_RSS_ESP and ETH_RSS_AH macros

Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
Reviewed-by: Beilei Xing <beilei.xing@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
2020-04-21 13:57:08 +02:00
Maxime Coquelin
0265a1980f vhost: prefix vDPA enum value for PCI address type
In order to avoid potential conflicts, rename the PCI_ADDR
enum value to VDPA_ADDR_PCI in vdpa_addr_type_enum.

All symbols referencing this enum are experimental, so it
does not break API policy.

Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Acked-by: Matan Azrad <matan@mellanox.com>
2020-04-21 13:57:07 +02:00
Itsuro Oda
7470f845c1 vhost: make IOTLB cache name unique among processes
Currently, iotlb cache name is comprised of vid and virtqueue
index. For example, "iotlb_cache_0_0". Because vid is assigned
per process, iotlb cache name is not unique among multi processes.
For example a secondary process uses a vhost
(ex. eth_vhost0,iface=/tmp/sock0) and another secondary process
uses a vhost (ex. eth_vhost1,iface=/tmp/sock1), iotlb cache
name of both vhost ("iotlb_cache_0_0") are same and as a result
iotlb cache is broken.

This patch makes iotlb cache name unique among milti processes
by adding process id to the iotlb cache name.

The prefix of the name is shortened to "iotlb_" since the maximum
length of pool name is 25 bytes (RTE_MEMPOOL_NAMESIZE is 26).
Note that it is just 25 characters in maximum at the moment.
Here,
* pid_t == int: max 10 digits.
* vid < MAX_VHOST_DECICE(1024): max 4 digits.
* vq_index < VHOST_MAX_VRING(256): max 3 digits.

Fixes: d012d1f293 ("vhost: add IOTLB helper functions")
Cc: stable@dpdk.org

Signed-off-by: Itsuro Oda <oda@valinux.co.jp>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
2020-04-21 13:57:07 +02:00
Xiaolong Ye
96ddd23ae4 vhost: remove unused variable
VHOST_FEATURES has been removed in previous refactoring.

Fixes: 0917f9d1f0 ("vhost: use new APIs to handle features")
Cc: stable@dpdk.org

Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
2020-04-21 13:57:07 +02:00
Marvin Liu
2a0ff4d554 vhost: fix packed ring zero-copy
Available buffer ID should be stored in the zmbuf in the packed-ring
dequeue path. There's no guarantee that local queue avail index is
equal to buffer ID.

Fixes: d1eafb5322 ("vhost: add packed ring zcopy batch and single dequeue")
Cc: stable@dpdk.org

Signed-off-by: Marvin Liu <yong.liu@intel.com>
Reported-by: Yinan Wang <yinan.wang@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
2020-04-21 13:57:07 +02:00
Fan Zhang
699a225b38 vhost/crypto: add missing user protocol flag
This patch fixes the vhost crypto missed
"VHOST_USER_PROTOCOL_F_CONFIG" flag problem during initialization.
Newer Qemu version requires this feature enabled.

Fixes: 939066d965 ("vhost/crypto: add public function implementation")
Cc: stable@dpdk.org

Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
2020-04-21 13:57:07 +02:00
Eugeny Parshutin
5dd45467b4 ethdev: fix build when vtune profiling is on
Add the previous prototype for the 'profile_hook_rx_burst_cb' function
to fix the compiler warning when the DPDK is built with
'RTE_ETHDEV_PROFILE_WITH_VTUNE' config option enabled:
/home/dpdk/lib/librte_ethdev/ethdev_profile.c:17:1: warning:
no previous prototype for profile_hook_rx_burst_cb [-Wmissing-prototypes]

Fixes: 2c1bbab7f0 ("ethdev: change vtune profiling approach")
Cc: stable@dpdk.org

Signed-off-by: Eugeny Parshutin <eugeny.parshutin@linux.intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
2020-04-21 13:57:06 +02:00
Sunil Kumar Kori
40b75c73d1 mempool: add tracepoints
Add tracepoints at important and mandatory APIs for tracing support.

Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
Acked-by: David Marchand <david.marchand@redhat.com>
2020-04-23 15:40:11 +02:00
Sunil Kumar Kori
4cf30e3f3c cryptodev: add tracepoints
Add tracepoints at important and mandatory APIs for tracing support.

Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
Acked-by: David Marchand <david.marchand@redhat.com>
2020-04-23 15:40:09 +02:00
Sunil Kumar Kori
32e326869e eventdev: add tracepoints
Add tracepoints at important and mandatory APIs for tracing support.

Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
Acked-by: David Marchand <david.marchand@redhat.com>
2020-04-23 15:40:08 +02:00
Sunil Kumar Kori
78d44153de ethdev: add tracepoints
Add tracepoints at important and mandatory APIs for tracing support.

Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
Acked-by: David Marchand <david.marchand@redhat.com>
2020-04-23 15:40:06 +02:00
Sunil Kumar Kori
8c8066ea6a trace: add trace mode configuration parameter
Trace library exposes --trace-mode eal parameter to configure
event record mode when ring buffers are full.

Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
Acked-by: David Marchand <david.marchand@redhat.com>
2020-04-23 15:40:01 +02:00
Sunil Kumar Kori
44ab5377f0 trace: add trace bufsize configuration parameter
Trace library exposes --trace-bufsz EAL parameter to configure
maximum size of ring buffer where events are to be stored.

Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
Acked-by: David Marchand <david.marchand@redhat.com>
2020-04-23 15:40:00 +02:00
Sunil Kumar Kori
8af866df8d trace: add trace directory configuration parameter
Trace library exposes --trace-dir EAL parameter to configure
directory where traces will be generated.

Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
Acked-by: David Marchand <david.marchand@redhat.com>
2020-04-23 15:39:58 +02:00
Sunil Kumar Kori
3d26a70ae3 trace: add trace configuration parameter
Trace library exposes --trace EAL parameter to enable trace points.

Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
Acked-by: David Marchand <david.marchand@redhat.com>
2020-04-23 15:39:57 +02:00
Jerin Jacob
05c4105738 trace: add interrupt tracepoints
Add the following interrupt related tracepoints.

- rte_eal_trace_intr_callback_register()
- rte_eal_trace_intr_callback_unregister()
- rte_eal_trace_intr_enable()
- rte_eal_trace_intr_disable()

Signed-off-by: Jerin Jacob <jerinj@marvell.com>
Acked-by: David Marchand <david.marchand@redhat.com>
2020-04-23 15:39:55 +02:00
Jerin Jacob
0baa1e01c3 trace: add thread tracepoints
Add the following thread related tracepoints.

- rte_eal_trace_thread_remote_launch()
- rte_eal_trace_thread_lcore_ready()

Signed-off-by: Jerin Jacob <jerinj@marvell.com>
Acked-by: David Marchand <david.marchand@redhat.com>
2020-04-23 15:39:53 +02:00
Jerin Jacob
402321cfca trace: add memzone tracepoints
Add the following memzone related tracepoints.

- rte_eal_trace_memzone_reserve()
- rte_eal_trace_memzone_lookup()
- rte_eal_trace_memzone_free()

Signed-off-by: Jerin Jacob <jerinj@marvell.com>
Acked-by: David Marchand <david.marchand@redhat.com>
2020-04-23 15:39:51 +02:00
Jerin Jacob
52f409d614 trace: add memory tracepoints
Add the following memory-related tracepoints.

- rte_eal_trace_mem_zmalloc()
- rte_eal_trace_mem_malloc()
- rte_eal_trace_mem_realloc()
- rte_eal_trace_mem_free()

rte_malloc() and rte_free() has been used in the trace implementation,
in order to avoid tracing implementation specific events, added
an internal no trace version rte_malloc() and rte_free().

Signed-off-by: Jerin Jacob <jerinj@marvell.com>
Acked-by: David Marchand <david.marchand@redhat.com>
2020-04-23 15:39:48 +02:00
Jerin Jacob
4931010619 trace: add alarm tracepoints
Add following alarm related trace points.

- rte_eal_trace_alarm_set()
- rte_eal_trace_alarm_cancel()

Signed-off-by: Jerin Jacob <jerinj@marvell.com>
Acked-by: David Marchand <david.marchand@redhat.com>
2020-04-23 15:39:47 +02:00
Jerin Jacob
6c232fc44c trace: add generic tracepoints
This patch creates the following generic tracepoint for
generic tracing when there is no dedicated tracepoint is
available.

- rte_eal_trace_generic_void()
- rte_eal_trace_generic_u64()
- rte_eal_trace_generic_u32()
- rte_eal_trace_generic_u16()
- rte_eal_trace_generic_u8()
- rte_eal_trace_generic_i64()
- rte_eal_trace_generic_i32()
- rte_eal_trace_generic_i16()
- rte_eal_trace_generic_i8()
- rte_eal_trace_generic_int()
- rte_eal_trace_generic_long()
- rte_eal_trace_generic_float()
- rte_eal_trace_generic_double()
- rte_eal_trace_generic_ptr()
- rte_eal_trace_generic_str()

For example, if an application wishes to emit an int datatype,
it can call rte_eal_trace_generic_int(val) to emit the trace.

Signed-off-by: Jerin Jacob <jerinj@marvell.com>
Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
Acked-by: David Marchand <david.marchand@redhat.com>
2020-04-23 15:39:42 +02:00
Jerin Jacob
96cdbf046a trace: hook subsystem to FreeBSD
Connect the internal trace interface API to FreeBSD EAL.

Signed-off-by: Jerin Jacob <jerinj@marvell.com>
Acked-by: David Marchand <david.marchand@redhat.com>
2020-04-23 15:39:40 +02:00
Jerin Jacob
3b155d24bd trace: hook subsystem to Linux
Connect the internal trace interface API to Linux EAL.

Signed-off-by: Jerin Jacob <jerinj@marvell.com>
Acked-by: David Marchand <david.marchand@redhat.com>
2020-04-23 15:39:38 +02:00
Jerin Jacob
032a7e5499 trace: implement provider payload
The trace function payloads such as rte_trace_point_emit_* have
dual functions. The first to emit the payload for the registration
function and the second one to act as trace mem emitters a.k.a
provider payload.

When it is used as provider payload, those function copy the trace
field to trace memory based on the tracing mode.

Added payload definitions under ALLOW_EXPERIMENTAL_API define
to allow the existing applications to compile without enabling
experimental APIs.

Signed-off-by: Jerin Jacob <jerinj@marvell.com>
Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
Acked-by: David Marchand <david.marchand@redhat.com>
2020-04-23 15:39:36 +02:00
Jerin Jacob
0cd4ea043f trace: implement registration payload
The trace function payloads such as rte_trace_point_emit_* have
dual functions. The first to emit the payload for the registration
function and the second one to act as trace memory emitters.

When it is used as registration payload, it will do the following to
fulfill the registration job.
- Find out the size of the event,
- Generate metadata field string using __rte_trace_point_emit_field().

Signed-off-by: Jerin Jacob <jerinj@marvell.com>
Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
Acked-by: David Marchand <david.marchand@redhat.com>
2020-04-23 15:39:33 +02:00
Jerin Jacob
4b8ea84e9b trace: implement trace save
Implement rte_trace_save(), which will save the metadata
file and trace memory snapshot to the trace directory.

Signed-off-by: Jerin Jacob <jerinj@marvell.com>
Acked-by: David Marchand <david.marchand@redhat.com>
2020-04-23 15:39:29 +02:00
Jerin Jacob
f6b2d65dcd trace: implement debug dump
Implement rte_trace_metadata_dump() and rte_trace_dump()
functions. Former one used to dump the CTF metadata file and
the latter one to dump all the registered events and its status.

Signed-off-by: Jerin Jacob <jerinj@marvell.com>
Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
Acked-by: David Marchand <david.marchand@redhat.com>
2020-04-23 15:39:28 +02:00
Jerin Jacob
29d985cad8 trace: implement memory allocation
Trace memory will be allocated per thread to enable lockless trace
events updates to the memory. The allocator will first attempt to
allocate from hugepage, then if not available from hugepage or
finally fallback to malloc memory.

Later in the patches series, this API will be hooked to DPDK fast path
and control plane thread creation API. It is possible for non
DPDK thread to use trace events. In that case, trace memory
will be allocated on the first event emission.

Signed-off-by: Jerin Jacob <jerinj@marvell.com>
Acked-by: David Marchand <david.marchand@redhat.com>
2020-04-23 15:39:26 +02:00
Sunil Kumar Kori
ffed0853e6 trace: handle CTF keyword collision
Some of the keyword like align, event, "." and "->" etc will be
used in CTF metadata syntax. This patch support for handling
those keywords with DPDK events name.

Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
Acked-by: David Marchand <david.marchand@redhat.com>
2020-04-23 15:39:24 +02:00
Jerin Jacob
f1a099f5b1 trace: create CTF TDSL metadata in memory
Common trace format(CTF) defines the metadata[1][2] for trace events,
This patch creates the metadata for the DPDK events in memory and
later this will be saved to trace directory on rte_trace_save()
invocation.

[1] https://diamon.org/ctf/#specification
[2] https://diamon.org/ctf/#examples

Signed-off-by: Jerin Jacob <jerinj@marvell.com>
Acked-by: David Marchand <david.marchand@redhat.com>
2020-04-23 15:39:22 +02:00
Jerin Jacob
185b7dc1d4 trace: save bootup timestamp
Find epoch_sec, epoch_nsec and uptime_ticks time information
on eal_trace_init()/bootup to derive the time in the trace.

Signed-off-by: Jerin Jacob <jerinj@marvell.com>
Acked-by: David Marchand <david.marchand@redhat.com>
2020-04-23 15:39:20 +02:00
Jerin Jacob
321dd5f8fa trace: add internal init and fini interface
Define eal_trace_init() and eal_trace_fini() EAL interface
functions that rte_eal_init() and rte_eal_cleanup() function can
use to initialize and finalize the trace subsystem.
eal_trace_init() function will add the following functionality if
trace is enabled through EAL command line param.

- Test for trace registration failure.
- Test for duplicate trace name registration.
- Generate UUID ver 4.
- Create a trace directory.

Signed-off-by: Jerin Jacob <jerinj@marvell.com>
Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
Acked-by: David Marchand <david.marchand@redhat.com>
2020-04-23 15:39:15 +02:00
Jerin Jacob
84c4fae462 trace: implement operation APIs
This patch implements the following public trace APIs.

- rte_trace_is_enabled()
- rte_trace_mode_get()
- rte_trace_mode_set()
- rte_trace_pattern()
- rte_trace_point_disable()
- rte_trace_point_enable()
- rte_trace_point_is_enabled()
- rte_trace_point_lookup()
- rte_trace_regexp()

Signed-off-by: Jerin Jacob <jerinj@marvell.com>
Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
Acked-by: David Marchand <david.marchand@redhat.com>
2020-04-23 15:39:13 +02:00
Jerin Jacob
f58880682c trace: implement register API
The consumers of trace API defines the tracepoint and registers
to eal. Internally these tracepoints will be stored in STAILQ
for future use. This patch implements the tracepoint
registration function.

Signed-off-by: Jerin Jacob <jerinj@marvell.com>
Acked-by: David Marchand <david.marchand@redhat.com>
2020-04-23 15:39:09 +02:00
Jerin Jacob
27db82c709 trace: introduce new subsystem
Define the public API for trace support.
This patch also adds support for the build infrastructure and
update the MAINTAINERS file for the trace subsystem.

The 8 bytes tracepoint object is a global variable, and can be used in
fast path. Created a new __rte_trace_point section to store the
tracepoint objects as,
- It is a mostly read-only data and not to mix with other "write"
  global variables.
- Chances that the same subsystem fast path variables come in the same
  fast path cache line. i.e, it will enable a more predictable
  performance number from build to build.

Signed-off-by: Jerin Jacob <jerinj@marvell.com>
Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
Acked-by: David Marchand <david.marchand@redhat.com>
2020-04-23 15:39:06 +02:00
Jerin Jacob
d0cfb06468 eal: introduce API for getting thread name
Introduce rte_thread_getname() API to get the thread name
and implement it for Linux and FreeBSD.

FreeBSD does not support getting the thread name.

One of the consumers of this API will be the trace subsystem where
it used as an informative purpose.

Signed-off-by: Jerin Jacob <jerinj@marvell.com>
Acked-by: David Marchand <david.marchand@redhat.com>
2020-04-23 15:39:03 +02:00
Honnappa Nagarahalli
bf386ae377 rcu: add additional debug logs
Added additional debug logs. These helped in debugging RCU defer APIs.

Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
Reviewed-by: Gavin Hu <gavin.hu@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
2020-04-22 20:46:00 +02:00
Honnappa Nagarahalli
706d306ea3 rcu: add resource reclamation APIs
Add resource reclamation using defer queues to make it simple for
applications and libraries to integrate rte_rcu library.

Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
Reviewed-by: Ola Liljedahl <ola.liljedahl@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
2020-04-22 20:28:07 +02:00
Pablo de Lara
b3aaf24de5 cryptodev: add session-less feature flag
Add feature flag for symmetric sessionless support,
so it can be checked by applications.

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Adam Dybkowski <adamx.dybkowski@intel.com>
Tested-by: Ruifeng Wang <ruifeng.wang@arm.com>
Acked-by: Fiona Trahe <fiona.trahe@intel.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
2020-04-19 22:45:11 +02:00
Lukasz Wojciechowski
e36b5a87d6 security: fix session counter
Fix session counter to be decreased in rte_security_session_destroy
only when session was successfully destroyed.

Formerly session counter was decreased prior session destroying
and returning session object to mempool. It remained decreased even
if session was not destroyed and mempool object released making counter
invalid.

Fixes: c261d1431b ("security: introduce security API and framework")
Cc: stable@dpdk.org

Signed-off-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
Acked-by: Anoob Joseph <anoobj@marvell.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
2020-04-19 17:15:14 +02:00
Lukasz Wojciechowski
3139b9568b security: fix return types in documentation
Enhance returned values description for rte_security_session_destroy
and some other minor description changes.

Fixes: c261d1431b ("security: introduce security API and framework")
Cc: stable@dpdk.org

Signed-off-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
Acked-by: Anoob Joseph <anoobj@marvell.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
2020-04-19 17:15:14 +02:00
Lukasz Wojciechowski
b6ee985478 security: fix verification of parameters
This patch adds verification of the parameters to the ret_security API
functions. All required parameters are checked if they are not NULL.

Checks verify full chain of pointers, e.g. in case of verification of
"instance->ops->session_XXX", they check also "instance"
and "instance->ops".

Fixes: c261d1431b ("security: introduce security API and framework")
Fixes: 1a08c379b9 ("security: support user data retrieval")
Cc: stable@dpdk.org

Signed-off-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
Acked-by: Anoob Joseph <anoobj@marvell.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
2020-04-19 17:15:14 +02:00