dpdk.git
3 years agodmadev: remove symbol versioning for inline helpers
David Marchand [Wed, 20 Oct 2021 11:25:52 +0000 (12:25 +0100)]
dmadev: remove symbol versioning for inline helpers

Inline helpers have no global symbols in shared libraries.
There is no reason to ask for versioning (plus this library would not
build on Windows).

Fixes: 91e581e5c924 ("dmadev: add data plane API")
Fixes: ea8cf0f8536d ("dmadev: add burst capacity API")

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
3 years agoraw/ioat: deprecate rawdev driver
Conor Walsh [Mon, 18 Oct 2021 12:38:35 +0000 (12:38 +0000)]
raw/ioat: deprecate rawdev driver

Deprecate the rawdev IOAT driver as both IOAT and IDXD drivers have
moved to dmadev.

Signed-off-by: Conor Walsh <conor.walsh@intel.com>
Acked-by: Kevin Laatz <kevin.laatz@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
3 years agousertools/devbind: move ioat device IDs to DMA class
Conor Walsh [Mon, 18 Oct 2021 12:38:34 +0000 (12:38 +0000)]
usertools/devbind: move ioat device IDs to DMA class

Move Intel IOAT devices from Misc to DMA devices.

Signed-off-by: Conor Walsh <conor.walsh@intel.com>
Reviewed-by: Kevin Laatz <kevin.laatz@intel.com>
Reviewed-by: Bruce Richardson <bruce.richardson@intel.com>
3 years agodma/ioat: add burst capacity
Conor Walsh [Mon, 18 Oct 2021 12:38:33 +0000 (12:38 +0000)]
dma/ioat: add burst capacity

Adds the ability to find the remaining space in the IOAT ring.

Signed-off-by: Conor Walsh <conor.walsh@intel.com>
Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
3 years agodma/ioat: add vchan status
Conor Walsh [Mon, 18 Oct 2021 12:38:32 +0000 (12:38 +0000)]
dma/ioat: add vchan status

Add support for the rte_dmadev_vchan_status API call.

Signed-off-by: Conor Walsh <conor.walsh@intel.com>
Reviewed-by: Kevin Laatz <kevin.laatz@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
3 years agodma/ioat: add statistics
Conor Walsh [Mon, 18 Oct 2021 12:38:31 +0000 (12:38 +0000)]
dma/ioat: add statistics

Add statistic tracking for operations in IOAT.

Signed-off-by: Conor Walsh <conor.walsh@intel.com>
Reviewed-by: Kevin Laatz <kevin.laatz@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
3 years agodma/ioat: add data path completion
Conor Walsh [Mon, 18 Oct 2021 12:38:30 +0000 (12:38 +0000)]
dma/ioat: add data path completion

Add the data path functions for gathering completed operations
from IOAT devices.

Signed-off-by: Conor Walsh <conor.walsh@intel.com>
Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
3 years agodma/ioat: add data path job submission
Conor Walsh [Mon, 18 Oct 2021 12:38:29 +0000 (12:38 +0000)]
dma/ioat: add data path job submission

Add data path functions for enqueuing and submitting operations to
IOAT devices.

Signed-off-by: Conor Walsh <conor.walsh@intel.com>
Reviewed-by: Kevin Laatz <kevin.laatz@intel.com>
Reviewed-by: Chengwen Feng <fengchengwen@huawei.com>
3 years agodma/ioat: add start and stop
Conor Walsh [Mon, 18 Oct 2021 12:38:28 +0000 (12:38 +0000)]
dma/ioat: add start and stop

Add start, stop and recover functions for IOAT devices.

Signed-off-by: Conor Walsh <conor.walsh@intel.com>
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Kevin Laatz <kevin.laatz@intel.com>
3 years agodma/ioat: add configuration
Conor Walsh [Mon, 18 Oct 2021 12:38:27 +0000 (12:38 +0000)]
dma/ioat: add configuration

Add functions for device configuration. The info_get and close functions
are included here also. info_get can be useful for checking successful
configuration and close is used by the dmadev api when releasing a
configured device.

Signed-off-by: Conor Walsh <conor.walsh@intel.com>
Reviewed-by: Kevin Laatz <kevin.laatz@intel.com>
3 years agodma/ioat: add datapath structures
Conor Walsh [Mon, 18 Oct 2021 12:38:26 +0000 (12:38 +0000)]
dma/ioat: add datapath structures

Add data structures required for the data path of IOAT devices.

Signed-off-by: Conor Walsh <conor.walsh@intel.com>
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Kevin Laatz <kevin.laatz@intel.com>
3 years agodma/ioat: create dmadev instances on PCI probe
Conor Walsh [Mon, 18 Oct 2021 12:38:25 +0000 (12:38 +0000)]
dma/ioat: create dmadev instances on PCI probe

When a suitable device is found during the PCI probe, create a dmadev
instance for each channel. Internal structures and HW definitions required
for device creation are also included.

Signed-off-by: Conor Walsh <conor.walsh@intel.com>
Reviewed-by: Kevin Laatz <kevin.laatz@intel.com>
3 years agodma/ioat: add device probing and removal
Conor Walsh [Mon, 18 Oct 2021 12:38:24 +0000 (12:38 +0000)]
dma/ioat: add device probing and removal

Add the basic device probe/remove skeleton code and initial documentation
for new IOAT DMA driver. Maintainers update is also included in this
patch.

Signed-off-by: Conor Walsh <conor.walsh@intel.com>
Reviewed-by: Kevin Laatz <kevin.laatz@intel.com>
Reviewed-by: Chengwen Feng <fengchengwen@huawei.com>
3 years agodevtools: fix letter case check in commit title
Thomas Monjalon [Mon, 18 Oct 2021 09:55:58 +0000 (11:55 +0200)]
devtools: fix letter case check in commit title

The prefix (before the colon) of the title is lowercase.
The check of uppercase/lowercase in the commit title
was supposed to apply after the colon,
but some greps were not limited to the exact word.
So in the case of "test/dma: add basic dmadev instance tests",
the lowercase word "dmadev" was wrongly suggested to be uppercase.

The words of the dictionary must be filtered as whole word
with the grep option -w.

Fixes: d448efa259e9 ("devtools: export dictionary for commit title check")
Cc: stable@dpdk.org
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
3 years agousertools/devbind: move idxd device ID to DMA class
Kevin Laatz [Wed, 20 Oct 2021 16:30:13 +0000 (16:30 +0000)]
usertools/devbind: move idxd device ID to DMA class

The dmadev library is the preferred abstraction for using IDXD devices and
will replace the rawdev implementation in future. This patch moves the IDXD
device ID to the dmadev class.

Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>
Reviewed-by: Conor Walsh <conor.walsh@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
3 years agousertools/devbind: add DMA device class
Kevin Laatz [Wed, 20 Oct 2021 16:30:12 +0000 (16:30 +0000)]
usertools/devbind: add DMA device class

Add a new class for DMA devices.
Devices listed under the DMA class are to be used with the dmadev library.

Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>
Reviewed-by: Conor Walsh <conor.walsh@intel.com>
Reviewed-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Chengwen Feng <fengchengwen@huawei.com>
3 years agodma/idxd: move config script from raw driver
Conor Walsh [Wed, 20 Oct 2021 16:30:11 +0000 (16:30 +0000)]
dma/idxd: move config script from raw driver

Move the example script for configuring IDXD devices bound to the IDXD
kernel driver from raw to dma, and create a symlink to still allow use from
raw.

Signed-off-by: Conor Walsh <conor.walsh@intel.com>
Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
3 years agodma/idxd: add burst capacity
Kevin Laatz [Wed, 20 Oct 2021 16:30:10 +0000 (16:30 +0000)]
dma/idxd: add burst capacity

Add support for the burst capacity API. This API will provide the calling
application with the remaining capacity of the current burst (limited by
max HW batch size).

Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>
Reviewed-by: Conor Walsh <conor.walsh@intel.com>
Reviewed-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Chengwen Feng <fengchengwen@huawei.com>
3 years agodma/idxd: add vchan status
Kevin Laatz [Wed, 20 Oct 2021 16:30:09 +0000 (16:30 +0000)]
dma/idxd: add vchan status

When testing dmadev drivers, it is useful to have the HW device in a known
state. This patch adds the implementation of the function which will wait
for the device to be idle (all jobs completed) before proceeding.

Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>
Reviewed-by: Conor Walsh <conor.walsh@intel.com>
3 years agodma/idxd: add operation statistic tracking
Kevin Laatz [Wed, 20 Oct 2021 16:30:08 +0000 (16:30 +0000)]
dma/idxd: add operation statistic tracking

Add statistic tracking for DSA devices.

The dmadev library documentation is also updated to add a generic section
for using the library's statistics APIs.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>
Reviewed-by: Conor Walsh <conor.walsh@intel.com>
Reviewed-by: Chengwen Feng <fengchengwen@huawei.com>
3 years agodma/idxd: add data path job completion
Kevin Laatz [Wed, 20 Oct 2021 16:30:07 +0000 (16:30 +0000)]
dma/idxd: add data path job completion

Add the data path functions for gathering completed operations.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>
Reviewed-by: Conor Walsh <conor.walsh@intel.com>
3 years agodma/idxd: add data path job submission
Kevin Laatz [Wed, 20 Oct 2021 16:30:06 +0000 (16:30 +0000)]
dma/idxd: add data path job submission

Add data path functions for enqueuing and submitting operations to DSA
devices.

Documentation updates are included for dmadev library and IDXD driver docs
as appropriate.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>
Reviewed-by: Conor Walsh <conor.walsh@intel.com>
Reviewed-by: Chengwen Feng <fengchengwen@huawei.com>
3 years agodma/idxd: add start and stop for PCI devices
Kevin Laatz [Wed, 20 Oct 2021 16:30:05 +0000 (16:30 +0000)]
dma/idxd: add start and stop for PCI devices

Add device start/stop functions for DSA devices bound to vfio. For devices
bound to the IDXD kernel driver, these are not required since the IDXD
kernel driver takes care of this.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>
Reviewed-by: Conor Walsh <conor.walsh@intel.com>
3 years agodma/idxd: add configure and info
Kevin Laatz [Wed, 20 Oct 2021 16:30:04 +0000 (16:30 +0000)]
dma/idxd: add configure and info

Add functions for device configuration. The info_get function is included
here since it can be useful for checking successful configuration.

Documentation is also updated to add device configuration usage info.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>
Reviewed-by: Conor Walsh <conor.walsh@intel.com>
Reviewed-by: Chengwen Feng <fengchengwen@huawei.com>
3 years agodma/idxd: add datapath structures
Kevin Laatz [Wed, 20 Oct 2021 16:30:03 +0000 (16:30 +0000)]
dma/idxd: add datapath structures

Add data structures required for the data path for IDXD devices.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>
Reviewed-by: Conor Walsh <conor.walsh@intel.com>
Reviewed-by: Chengwen Feng <fengchengwen@huawei.com>
3 years agodma/idxd: create dmadev instances on PCI probe
Kevin Laatz [Wed, 20 Oct 2021 16:30:02 +0000 (16:30 +0000)]
dma/idxd: create dmadev instances on PCI probe

When a suitable device is found during the PCI probe, create a dmadev
instance for each HW queue. HW definitions required are also included.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>
Reviewed-by: Conor Walsh <conor.walsh@intel.com>
3 years agodma/idxd: create dmadev instances on bus probe
Kevin Laatz [Wed, 20 Oct 2021 16:30:01 +0000 (16:30 +0000)]
dma/idxd: create dmadev instances on bus probe

When a suitable device is found during the bus scan/probe, create a dmadev
instance for each HW queue. Internal structures required for device
creation are also added.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>
Reviewed-by: Conor Walsh <conor.walsh@intel.com>
3 years agodma/idxd: add bus device probing
Kevin Laatz [Wed, 20 Oct 2021 16:30:00 +0000 (16:30 +0000)]
dma/idxd: add bus device probing

Add the basic device probing for DSA devices bound to the IDXD kernel
driver. These devices can be configured via sysfs and made available to
DPDK if they are found during bus scan. Relevant documentation is included.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>
Reviewed-by: Conor Walsh <conor.walsh@intel.com>
3 years agodma/idxd: add skeleton for VFIO based DSA device
Kevin Laatz [Wed, 20 Oct 2021 16:29:59 +0000 (16:29 +0000)]
dma/idxd: add skeleton for VFIO based DSA device

Add the basic device probe/remove skeleton code for DSA device bound to
the vfio pci driver. Relevant documentation and MAINTAINERS update also
included.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>
Reviewed-by: Conor Walsh <conor.walsh@intel.com>
3 years agoraw/ioat: build only if dmadev not present
Bruce Richardson [Wed, 20 Oct 2021 16:29:58 +0000 (16:29 +0000)]
raw/ioat: build only if dmadev not present

Only build the rawdev IDXD/IOAT drivers if the dmadev drivers are not
present.

This change requires the dependencies to be reordered in
drivers/meson.build so that rawdev can use the "RTE_DMA_* build macros to
check for the presence of the equivalent dmadev driver.

A note is also added to the documentation to inform users of this change.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>
Reviewed-by: Conor Walsh <conor.walsh@intel.com>
3 years agoapp/dumpcap: add new packet capture application
Stephen Hemminger [Wed, 20 Oct 2021 21:42:31 +0000 (14:42 -0700)]
app/dumpcap: add new packet capture application

This is a new packet capture application to replace existing pdump.
The new application works like Wireshark dumpcap program and supports
the pdump API features.

It is not complete yet some features such as filtering are not implemented.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
3 years agopdump: support pcapng and filtering
Stephen Hemminger [Wed, 20 Oct 2021 21:42:30 +0000 (14:42 -0700)]
pdump: support pcapng and filtering

This enhances the DPDK pdump library to support new
pcapng format and filtering via BPF.

The internal client/server protocol is changed to support
two versions: the original pdump basic version and a
new pcapng version.

The internal version number (not part of exposed API or ABI)
is intentionally increased to cause any attempt to try
mismatched primary/secondary process to fail.

Add new API to do allow filtering of captured packets with
DPDK BPF (eBPF) filter program. It keeps statistics
on packets captured, filtered, and missed (because ring was full).

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Reshma Pattan <reshma.pattan@intel.com>
Acked-by: Ray Kinsella <mdr@ashroe.eu>
3 years agobpf: add function to dump eBPF instructions
Stephen Hemminger [Wed, 20 Oct 2021 21:42:29 +0000 (14:42 -0700)]
bpf: add function to dump eBPF instructions

When debugging converted (and other) programs it is useful
to see disassembled eBPF output.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Ray Kinsella <mdr@ashroe.eu>
3 years agobpf: add function to convert classic BPF to DPDK BPF
Stephen Hemminger [Wed, 20 Oct 2021 21:42:28 +0000 (14:42 -0700)]
bpf: add function to convert classic BPF to DPDK BPF

The pcap library emits classic BPF (32 bit) and is useful for
creating filter programs.  The DPDK BPF library only implements
extended BPF (eBPF).  Add an function to convert from old to
new.

The rte_bpf_convert function uses rte_malloc to put the resulting
program in hugepage shared memory so it can be passed from a
secondary process to a primary process.

The code to convert was originally done as part of the Linux
kernel implementation then converted to a userspace program.
See https://github.com/tklauser/filter2xdp

Both authors have agreed that it is allowable to create a modified
version of this code and license it with BSD license used by DPDK.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Ray Kinsella <mdr@ashroe.eu>
3 years agobpf: allow self-xor operation
Stephen Hemminger [Wed, 20 Oct 2021 21:42:27 +0000 (14:42 -0700)]
bpf: allow self-xor operation

Some BPF programs may use XOR of a register with itself
as a way to zero register in one instruction.
The BPF filter converter generates this in the prolog
to the generated code.

The BPF validator would not allow this because the value of
register was undefined. But after this operation it always zero.

Fixes: 8021917293d0 ("bpf: add extra validation for input BPF program")
Cc: stable@dpdk.org
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
3 years agotest/bpf: enable in fast tests
Stephen Hemminger [Wed, 20 Oct 2021 21:42:34 +0000 (14:42 -0700)]
test/bpf: enable in fast tests

The BPF autotest is defined but not run automatically.
Since it is short, it should be added to the autotest suite.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
3 years agotest/pcapng: test pcapng library
Stephen Hemminger [Wed, 20 Oct 2021 21:42:33 +0000 (14:42 -0700)]
test/pcapng: test pcapng library

Simple unit test that created pcapng file using API.

To run this test you need to have at least one device.
For example:

DPDK_TEST=pcapng_autotest ./build/app/test/dpdk-test -l 0-15 \
    --no-huge -m 2048 --vdev=net_tap,iface=dummy

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
3 years agopcapng: add new library for writing pcapng files
Stephen Hemminger [Wed, 20 Oct 2021 21:42:26 +0000 (14:42 -0700)]
pcapng: add new library for writing pcapng files

This is utility library for writing pcapng format files
used by Wireshark family of utilities. Older tcpdump
also knows how to read (but not write) this format.

See
  https://github.com/pcapng/pcapng/

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Reshma Pattan <reshma.pattan@intel.com>
Acked-by: Ray Kinsella <mdr@ashroe.eu>
3 years agopdump: disable on Windows
Stephen Hemminger [Wed, 20 Oct 2021 21:42:25 +0000 (14:42 -0700)]
pdump: disable on Windows

The current version of the pdump library was building on
Windows, but it was useless since the pdump utility was not being
built and Windows does not have multi-process support.

The new version of pdump with filtering now has dependency
on bpf. But bpf library is not available on Windows.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
3 years agodmadev: fix debug build
Chengwen Feng [Thu, 21 Oct 2021 12:59:38 +0000 (20:59 +0800)]
dmadev: fix debug build

This patch fix compile error when enable RTE_DMADEV_DEBUG.

Fixes: ea8cf0f8536d ("dmadev: add burst capacity API")

Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
Acked-by: Kevin Laatz <kevin.laatz@intel.com>
Acked-by: Conor Walsh <conor.walsh@intel.com>
3 years agotest/dma: check DMA info query
Chengwen Feng [Thu, 21 Oct 2021 12:59:37 +0000 (20:59 +0800)]
test/dma: check DMA info query

This patch add check for rte_dma_info_get() API.

Fixes: 718f7804841f ("test/dma: add basic dmadev instance tests")

Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
Acked-by: Kevin Laatz <kevin.laatz@intel.com>
Acked-by: Conor Walsh <conor.walsh@intel.com>
3 years agodmadev: hide devices array
David Marchand [Thu, 21 Oct 2021 12:59:36 +0000 (20:59 +0800)]
dmadev: hide devices array

No need to expose rte_dma_devices out of the dmadev library.
Existing helpers should be enough, and inlines make use of
rte_dma_fp_objs.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Reviewed-by: Chengwen Feng <fengchengwen@huawei.com>
Tested-by: Conor Walsh <conor.walsh@intel.com>
Acked-by: Kevin Laatz <kevin.laatz@intel.com>
3 years agoevent/dlb2: optimize credit allocations using port
Pravin Pathak [Thu, 14 Oct 2021 14:51:41 +0000 (14:51 +0000)]
event/dlb2: optimize credit allocations using port

This commit implements the changes required for using suggested
port type hint feature. Each port uses different credit quanta
based on port type specified using port configuration flags.

Each port has separate quanta defined in dlb2_priv.h
Producer and consumer ports will need larger quanta value to reduce number
of credit calls they make. Workers can use small quanta as they mostly
work out of locally cached credits and don't request/return credits often.

Signed-off-by: Pravin Pathak <pravin.pathak@intel.com>
3 years agoapp/eventdev: add event port hints for perf mode
Harry van Haaren [Thu, 14 Oct 2021 14:51:40 +0000 (14:51 +0000)]
app/eventdev: add event port hints for perf mode

This commit adds producer, worker and consumer port hints for the
test-eventdev application performance tests.

Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
3 years agoexamples/eventdev_pipeline: use port config hints
Harry van Haaren [Thu, 14 Oct 2021 14:51:39 +0000 (14:51 +0000)]
examples/eventdev_pipeline: use port config hints

This commit adds the per-port hints added to the eventdev API, indicating
which eventdev ports will be used for producing, forwarding, or consuming
events from the system.

Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
3 years agoeventdev: add usage hints to port configure API
Harry van Haaren [Thu, 14 Oct 2021 14:51:38 +0000 (14:51 +0000)]
eventdev: add usage hints to port configure API

This commit introduces 3 flags to the port configuration flags.
These flags allow the application to indicate what type of work
is expected to be performed by an eventdev port.

The three new flags are
- RTE_EVENT_PORT_CFG_HINT_PRODUCER (mostly RTE_EVENT_OP_NEW events)
- RTE_EVENT_PORT_CFG_HINT_CONSUMER (mostly RTE_EVENT_OP_RELEASE events)
- RTE_EVENT_PORT_CFG_HINT_WORKER   (mostly RTE_EVENT_OP_FORWARD events)

These flags are only hints, and the PMDs must operate under the
assumption that any port can enqueue an event with any type of op.

Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
3 years agoexamples/l2fwd-event: support event vector
Shijith Thotton [Mon, 27 Sep 2021 06:21:35 +0000 (11:51 +0530)]
examples/l2fwd-event: support event vector

Added changes to receive packets as event vector. By default this is
disabled and can be enabled using the option --event-vector. Vector
size and timeout to form the vector can be configured using options
--event-vector-size and --event-vector-tmo.

Example:
dpdk-l2fwd-event -l 0-3 -n 4 -- -p 0x03 --mode=eventdev \
--eventq-sched=ordered --event-vector --event-vector-size 16

Signed-off-by: Shijith Thotton <sthotton@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
3 years agoexamples/l3fwd: support event vector
Shijith Thotton [Mon, 27 Sep 2021 04:57:42 +0000 (10:27 +0530)]
examples/l3fwd: support event vector

Added changes to receive packets as event vector. By default this is
disabled and can be enabled using the option --event-vector. Vector
size and timeout to form the vector can be configured using options
--event-vector-size and --event-vector-tmo.

Example:
dpdk-l3fwd -l 0-3 -n 4 -- -p 0x03 --mode=eventdev \
--eventq-sched=ordered --event-vector --event-vector-size 16

Signed-off-by: Shijith Thotton <sthotton@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
3 years agoeventdev/eth_rx: fix WRR buffer overrun
Naga Harish K S V [Mon, 18 Oct 2021 08:25:41 +0000 (03:25 -0500)]
eventdev/eth_rx: fix WRR buffer overrun

When a poll queue is removed from a rx_adapter instance, the WRR poll
array is recomputed. The wrr array length is reduced in this case. The
next wrr position to poll is stored in wrr_pos variable of rx_adapter
instance. This wrr_pos can become invalid in some cases after wrr is
recomputed. Using this variable to get the next queue and device pair
may leed to wrr buffer overruns.

Resetting the wrr_pos to zero after recomputation of wrr array fixes
the buffer overrun issue.

Fixes: 9c38b704d280 ("eventdev: add eth Rx adapter implementation")
Cc: stable@dpdk.org
Signed-off-by: Naga Harish K S V <s.v.naga.harish.k@intel.com>
Acked-by: Jay Jayatheerthan <jay.jayatheerthan@intel.com>
3 years agoapp/eventdev: support burst enqueue
Rashmi Shetty [Fri, 15 Oct 2021 15:18:53 +0000 (10:18 -0500)]
app/eventdev: support burst enqueue

Introduce a new command line option prod_enq_burst_sz
to set burst size for eventdev enqueue at producer in perf_queue
test. The newly added function perf_producer_burst is called when
prod_enq_burst_sz is greater than 1.

Signed-off-by: Rashmi Shetty <rashmi.shetty@intel.com>
Acked-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
3 years agoapp/eventdev: fix terminal colour after control-c exit
Harry van Haaren [Thu, 14 Oct 2021 09:54:44 +0000 (09:54 +0000)]
app/eventdev: fix terminal colour after control-c exit

Before this commit, a Control^C exit of the test-eventdev application
would print the worker packet percentages, and leave the terminal with
a green colour despite the colour reset being issued after the newline.
By moving the colour reset command before the \n the issue is fixed.

Fixes: 6b1a14a83a06 ("app/eventdev: add packet distribution logs")
Cc: stable@dpdk.org
Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>
Acked-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
3 years agoeventdev: mark trace variables as internal
Pavan Nikhilesh [Mon, 18 Oct 2021 23:36:09 +0000 (05:06 +0530)]
eventdev: mark trace variables as internal

Mark rte_trace global variables as internal i.e. remove them
from experimental section of version map.
Some of them are used in inline APIs, mark those as global.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Acked-by: Ray Kinsella <mdr@ashroe.eu>
3 years agoeventdev: make trace API internal
Pavan Nikhilesh [Mon, 18 Oct 2021 23:36:08 +0000 (05:06 +0530)]
eventdev: make trace API internal

Slowpath trace APIs are only used in rte_eventdev.c so make them
as internal.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Acked-by: Jay Jayatheerthan <jay.jayatheerthan@intel.com>
Acked-by: Abhinandan Gujjar <abhinandan.gujjar@intel.com>
3 years agoeventdev: promote event vector API to stable
Pavan Nikhilesh [Mon, 18 Oct 2021 23:36:07 +0000 (05:06 +0530)]
eventdev: promote event vector API to stable

Promote event vector configuration APIs to stable.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Acked-by: Jay Jayatheerthan <jay.jayatheerthan@intel.com>
Acked-by: Ray Kinsella <mdr@ashroe.eu>
3 years agoeventdev/timer: move adapters memory to hugepage
Pavan Nikhilesh [Mon, 18 Oct 2021 23:36:06 +0000 (05:06 +0530)]
eventdev/timer: move adapters memory to hugepage

Move memory used by timer adapters to hugepage.
Allocate memory on the first adapter create or lookup to address
both primary and secondary process usecases.
This will prevent TLB misses if any and aligns to memory structure
of other subsystems.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
3 years agoeventdev/timer: rearrange struct fields
Pavan Nikhilesh [Mon, 18 Oct 2021 23:36:05 +0000 (05:06 +0530)]
eventdev/timer: rearrange struct fields

Rearrange fields in rte_event_timer data structure to remove holes.
Also, remove use of volatile from rte_event_timer.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
3 years agoeventdev: remove rte prefix for internal structs
Pavan Nikhilesh [Mon, 18 Oct 2021 23:36:04 +0000 (05:06 +0530)]
eventdev: remove rte prefix for internal structs

Remove rte_ prefix from rte_eth_event_enqueue_buffer,
rte_event_eth_rx_adapter and rte_event_crypto_adapter
as they are only used in rte_event_eth_rx_adapter.c and
rte_event_crypto_adapter.c

Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Acked-by: Jay Jayatheerthan <jay.jayatheerthan@intel.com>
Acked-by: Abhinandan Gujjar <abhinandan.gujjar@intel.com>
3 years agoeventdev: hide timer adapter PMD file
Pavan Nikhilesh [Mon, 18 Oct 2021 23:36:03 +0000 (05:06 +0530)]
eventdev: hide timer adapter PMD file

Hide rte_event_timer_adapter_pmd.h file as it is an internal file.
Remove rte_ prefix from rte_event_timer_adapter_ops structure.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
3 years agoeventdev: hide event device related structures
Pavan Nikhilesh [Mon, 18 Oct 2021 23:36:02 +0000 (05:06 +0530)]
eventdev: hide event device related structures

Move rte_eventdev, rte_eventdev_data structures to eventdev_pmd.h.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Acked-by: Harman Kalra <hkalra@marvell.com>
3 years agoeventdev: use new API for inline functions
Pavan Nikhilesh [Mon, 18 Oct 2021 23:36:01 +0000 (05:06 +0530)]
eventdev: use new API for inline functions

Use new driver interface for the fastpath enqueue/dequeue inline
functions.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Acked-by: Jay Jayatheerthan <jay.jayatheerthan@intel.com>
Acked-by: Abhinandan Gujjar <abhinandan.gujjar@intel.com>
3 years agodrivers/event: invoke probing finish function
Pavan Nikhilesh [Mon, 18 Oct 2021 23:36:00 +0000 (05:06 +0530)]
drivers/event: invoke probing finish function

Invoke event_dev_probing_finish() function at the end of probing,
this function sets the function pointers in the fp_ops flat array.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
3 years agoeventdev: move inline APIs into separate structure
Pavan Nikhilesh [Mon, 18 Oct 2021 23:35:59 +0000 (05:05 +0530)]
eventdev: move inline APIs into separate structure

Move fastpath inline function pointers from rte_eventdev into a
separate structure accessed via a flat array.
The intention is to make rte_eventdev and related structures private
to avoid future API/ABI breakages.`

Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Acked-by: Ray Kinsella <mdr@ashroe.eu>
3 years agoeventdev: allocate max space for internal arrays
Pavan Nikhilesh [Mon, 18 Oct 2021 23:35:58 +0000 (05:05 +0530)]
eventdev: allocate max space for internal arrays

Allocate max space for internal port, port config, queue config and
link map arrays.
Introduce new macro RTE_EVENT_MAX_PORTS_PER_DEV and set it to max
possible value.
This simplifies the port and queue reconfigure scenarios and will
also allow inline functions to refer pointer to internal port data
without extra checking of current number of configured queues.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
3 years agoeventdev: separate internal structures
Pavan Nikhilesh [Mon, 18 Oct 2021 23:35:57 +0000 (05:05 +0530)]
eventdev: separate internal structures

Create rte_eventdev_core.h and move all the internal data structures
to this file. These structures are mostly used by drivers, but they
need to be in the public header file as they are accessed by datapath
inline functions for performance reasons.
The accessibility of these data structures is not changed.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
3 years agoeventdev: make driver interface as internal
Pavan Nikhilesh [Mon, 18 Oct 2021 23:35:56 +0000 (05:05 +0530)]
eventdev: make driver interface as internal

Mark all the driver specific functions as internal, remove
`rte` prefix from `struct rte_eventdev_ops`.
Remove experimental tag from internal functions.
Remove `eventdev_pmd.h` from non-internal header files.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
3 years agoeventdev/eth_rx: support telemetry
Ganapati Kundapura [Wed, 13 Oct 2021 07:57:03 +0000 (02:57 -0500)]
eventdev/eth_rx: support telemetry

Added telemetry callbacks to get Rx adapter stats, reset stats and
to get Rx queue config information.

Signed-off-by: Ganapati Kundapura <ganapati.kundapura@intel.com>
Acked-by: Jay Jayatheerthan <jay.jayatheerthan@intel.com>
Acked-by: Naga Harish K S V <s.v.naga.harish.k@intel.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
3 years agoeventdev/eth_rx: add per-queue event buffer
Naga Harish K S V [Wed, 6 Oct 2021 07:55:46 +0000 (02:55 -0500)]
eventdev/eth_rx: add per-queue event buffer

Added per queue buffer. To configure per queue event buffer size,
application sets rte_event_eth_rx_adapter_params::use_queue_event_buf
flag as true while using rte_event_eth_rx_adapter_create_with_params().

The per queue event buffer size is populated in
rte_event_eth_rx_adapter_queue_conf::event_buf_size and passed
to rte_event_eth_rx_adapter_queue_add().

Signed-off-by: Naga Harish K S V <s.v.naga.harish.k@intel.com>
Acked-by: Jay Jayatheerthan <jay.jayatheerthan@intel.com>
3 years agoeventdev/eth_rx: add event buffer size configurability
Naga Harish K S V [Wed, 6 Oct 2021 07:55:44 +0000 (02:55 -0500)]
eventdev/eth_rx: add event buffer size configurability

Currently event buffer is static array with a default size defined
internally.

To configure event buffer size from application,
rte_event_eth_rx_adapter_create_with_params() API is added which
takes struct rte_event_eth_rx_adapter_params to configure event
buffer size in addition other params. The event buffer size is
rounded up for better buffer utilization and performance. In case
of NULL params argument, default event buffer size is used.

Signed-off-by: Naga Harish K S V <s.v.naga.harish.k@intel.com>
Signed-off-by: Ganapati Kundapura <ganapati.kundapura@intel.com>
Acked-by: Jay Jayatheerthan <jay.jayatheerthan@intel.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
3 years agoeventdev/eth_rx: support Rx queue config get
Ganapati Kundapura [Thu, 16 Sep 2021 12:51:06 +0000 (07:51 -0500)]
eventdev/eth_rx: support Rx queue config get

Added rte_event_eth_rx_adapter_queue_conf_get() API to get rx queue
information - event queue identifier, flags for handling received packets,
scheduler type, event priority, polling frequency of the receive queue
and flow identifier in rte_event_eth_rx_adapter_queue_conf structure

Signed-off-by: Ganapati Kundapura <ganapati.kundapura@intel.com>
Acked-by: Jay Jayatheerthan <jay.jayatheerthan@intel.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
3 years agoeventdev/eth_rx: use timestamp as dynamic mbuf field
Ganapati Kundapura [Tue, 28 Sep 2021 16:38:48 +0000 (11:38 -0500)]
eventdev/eth_rx: use timestamp as dynamic mbuf field

Add support to register timestamp dynamic field in mbuf.

Update the timestamp in mbuf for each packet before enqueuing
to event device if the timestamp is not already set.

Adding the timestamp in Rx adapter avoids additional latency
due to the event device.

Signed-off-by: Ganapati Kundapura <ganapati.kundapura@intel.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
3 years agoeventdev/eth_rx: simplify event vector config
Pavan Nikhilesh [Wed, 15 Sep 2021 13:15:20 +0000 (18:45 +0530)]
eventdev/eth_rx: simplify event vector config

Include vector configuration into the structure
``rte_event_eth_rx_adapter_queue_conf`` that is used to configure
Rx adapter ethernet device Rx queue parameters.
This simplifies event vector configuration as it avoids splitting
configuration per Rx queue.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Acked-by: Jay Jayatheerthan <jay.jayatheerthan@intel.com>
Acked-by: Ray Kinsella <mdr@ashroe.eu>
Acked-by: Jerin Jacob <jerinj@marvell.com>
3 years agoeventdev/crypto: add cryptodev start in adapter spec
Shijith Thotton [Fri, 3 Sep 2021 06:39:28 +0000 (12:09 +0530)]
eventdev/crypto: add cryptodev start in adapter spec

Event crypto adapter spec does not mention about cryptodev start and
stop. Cryptodev attached to the adapter should be started before calling
crypto adapter start. Added the same in spec and test application.

Signed-off-by: Shijith Thotton <sthotton@marvell.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
3 years agoevent/cnxk: fix max timer chunk pool cache size
Shijith Thotton [Mon, 30 Aug 2021 16:14:46 +0000 (21:44 +0530)]
event/cnxk: fix max timer chunk pool cache size

Reduced max chunk pool cache size from RTE_MEMPOOL_CACHE_MAX_SIZE(512)
to 128.

If chunk pool cache is empty, it gets filled during arm. Filling 512
entries at a time will fail arm if timeout is shorter, hence
reduce the pool cache size.

Fixes: 0e792433d051 ("event/cnxk: create and free timer adapter")
Cc: stable@dpdk.org
Signed-off-by: Shijith Thotton <sthotton@marvell.com>
3 years agoevent/cnxk: fix SSO and TIM argument parsing
Shijith Thotton [Mon, 30 Aug 2021 16:06:46 +0000 (21:36 +0530)]
event/cnxk: fix SSO and TIM argument parsing

Type of kvargs value and handler function argument should match to avoid
spilling memory.

Fixes: 7ffa7379965e ("event/cnxk: add option to configure getwork mode")
Cc: stable@dpdk.org
Signed-off-by: Shijith Thotton <sthotton@marvell.com>
3 years agoeventdev/eth_rx: make enqueue buffer circular
Ganapati Kundapura [Mon, 30 Aug 2021 13:06:25 +0000 (08:06 -0500)]
eventdev/eth_rx: make enqueue buffer circular

Rx adapter uses memove() to move unprocessed events to the beginning of
the packet enqueue buffer. The use memmove() was found to consume good
amount of CPU cycles (about 20%).

This patch removes the use of memove() while implementing a circular
buffer to avoid copying of data. With this change RX adapter is able
to fill the buffer of 16384 events.

Signed-off-by: Ganapati Kundapura <ganapati.kundapura@intel.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
3 years agotest: rely on EAL detection for core list
David Marchand [Tue, 19 Oct 2021 11:26:02 +0000 (13:26 +0200)]
test: rely on EAL detection for core list

Cores count has a direct impact on the time needed to complete unit
tests.

Currently, the core list used for unit test is enforced to "all cores on
the system" with no way for (CI) users to adapt it.
On the other hand, EAL default behavior (when no -c/-l option gets passed)
is to start threads on as many cores available in the process cpu
affinity.

Remove logic from meson: users can then select where to run the tests by
either running meson with a custom cpu affinity (using taskset/cpuset
depending on OS) or by passing a --test-args option to meson.

Example:
$ sudo meson test -C build --suite fast-tests -t 3 --test-args "-l 0-3"

Signed-off-by: David Marchand <david.marchand@redhat.com>
Tested-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Aaron Conole <aconole@redhat.com>
3 years agocommon/mlx5: share MR mempool registration
Michael Baum [Tue, 19 Oct 2021 20:56:02 +0000 (23:56 +0300)]
common/mlx5: share MR mempool registration

Expand the use of mempool registration to MR management for other
drivers.

Signed-off-by: Michael Baum <michaelba@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
3 years agocommon/mlx5: support device DMA map and unmap
Michael Baum [Tue, 19 Oct 2021 20:56:01 +0000 (23:56 +0300)]
common/mlx5: support device DMA map and unmap

Since MR management has moved to the common area, there is no longer a
need for the DMA map and unmap function for each driver.
This patch share those functions. For most drivers it supports these
operations for the first time.

Signed-off-by: Michael Baum <michaelba@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
3 years agocommon/mlx5: share MR management
Michael Baum [Tue, 19 Oct 2021 20:56:00 +0000 (23:56 +0300)]
common/mlx5: share MR management

Add global shared MR cache as a field of common device structure.
Move MR management to use this global cache for all drivers.

Signed-off-by: Michael Baum <michaelba@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
3 years agocommon/mlx5: share MR top-half search function
Michael Baum [Tue, 19 Oct 2021 20:55:59 +0000 (23:55 +0300)]
common/mlx5: share MR top-half search function

Add function to search in local liniar cache and use it in the drivers
instead of their functions.

Signed-off-by: Michael Baum <michaelba@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
3 years agocommon/mlx5: add global MR cache create function
Michael Baum [Tue, 19 Oct 2021 20:55:58 +0000 (23:55 +0300)]
common/mlx5: add global MR cache create function

Add function for global shared MR cache structure initialization.
This function include:
 - btree initialization.
 - set callbacks for reg and dereg MR.

Signed-off-by: Michael Baum <michaelba@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
3 years agocommon/mlx5: add MR control initialization
Michael Baum [Tue, 19 Oct 2021 20:55:57 +0000 (23:55 +0300)]
common/mlx5: add MR control initialization

Add function for MR control structure initialization.
This function include:
 - btree initialization.
 - dev_gen_ptr initialization.

Signed-off-by: Michael Baum <michaelba@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
3 years agonet/mlx5: remove redundancy in MR file
Michael Baum [Tue, 19 Oct 2021 20:55:56 +0000 (23:55 +0300)]
net/mlx5: remove redundancy in MR file

This patch remove two redundant things from MR file:

1. mr_find_contig_memsegs_data structure which is moved to common file
   before.
2. External memory mechanism - mlx5_tx_update_ext_mp function.
   Since commit [1] which added support for DMA map and unmap, external
   mem must be configured by the user using rte_mem_map function and no
   need to handle this in pmd.

[1]
commit 989e999d9305
("net/mlx5: support PCI device DMA map and unmap")

Signed-off-by: Michael Baum <michaelba@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
3 years agocommon/mlx5: share HCA capabilities handle
Michael Baum [Tue, 19 Oct 2021 20:55:55 +0000 (23:55 +0300)]
common/mlx5: share HCA capabilities handle

Add HCA attributes structure as a field of device config structure.
It query in common probing, and updates the timestamp format fields.

Each driver use HCA attributes from common device config structure,
instead of query it for itself.

Signed-off-by: Michael Baum <michaelba@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
3 years agocommon/mlx5: share protection domain object
Michael Baum [Tue, 19 Oct 2021 20:55:54 +0000 (23:55 +0300)]
common/mlx5: share protection domain object

Create shared Protection Domain in common area and add it and its PDN as
fields of common device structure.

Use this Protection Domain in all drivers and remove the PD and PDN
fields from their private structure.

Signed-off-by: Michael Baum <michaelba@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
3 years agocommon/mlx5: disable RoCE in device context creation
Michael Baum [Tue, 19 Oct 2021 20:55:53 +0000 (23:55 +0300)]
common/mlx5: disable RoCE in device context creation

Add option to get IB device after disabling RoCE. It is relevant if
there is vDPA class in device arguments list.

Use common device context in vDPA driver and remove the ctx field from
its private structure.

Signed-off-by: Michael Baum <michaelba@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
3 years agocommon/mlx5: share device context object
Michael Baum [Tue, 19 Oct 2021 20:55:52 +0000 (23:55 +0300)]
common/mlx5: share device context object

Create shared context device in common area and add it as a field of
common device.
Use this context device in all drivers and remove the ctx field from
their private structure.

Signed-off-by: Michael Baum <michaelba@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
3 years agonet/mlx5: remove redundant flag in device config
Michael Baum [Tue, 19 Oct 2021 20:55:51 +0000 (23:55 +0300)]
net/mlx5: remove redundant flag in device config

Device configure structure has flag named devx as same as SH structure
with the same meaning.

Remove the flag from the configuration structure and move all the
usages to the SH flag.

Signed-off-by: Michael Baum <michaelba@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
3 years agocommon/mlx5: move basic probing functions to common
Michael Baum [Tue, 19 Oct 2021 20:55:50 +0000 (23:55 +0300)]
common/mlx5: move basic probing functions to common

Move open IBV/DevX device function to common.

Signed-off-by: Michael Baum <michaelba@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
3 years agonet/mlx5: rearrange probing functions for Windows
Michael Baum [Tue, 19 Oct 2021 20:55:49 +0000 (23:55 +0300)]
net/mlx5: rearrange probing functions for Windows

Rearrange device detection code.
Rearrange configuration structures filling.
Remove unneeded variables.

Signed-off-by: Michael Baum <michaelba@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
3 years agocommon/mlx5: share memory related devargs
Michael Baum [Tue, 19 Oct 2021 20:55:48 +0000 (23:55 +0300)]
common/mlx5: share memory related devargs

Add device configure structure and function to parse user device
arguments into it.
Move parsing and management of relevant device arguments to common.

Signed-off-by: Michael Baum <michaelba@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
3 years agocommon/mlx5: share common definitions
Michael Baum [Tue, 19 Oct 2021 20:55:47 +0000 (23:55 +0300)]
common/mlx5: share common definitions

Create MACRO definitions file in the common driver as preparation for MR
and basic probe sharing.
Move relevant definitions from the net driver to the above file.

Signed-off-by: Michael Baum <michaelba@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
3 years agocommon/mlx5: share basic probing with internal drivers
Michael Baum [Tue, 19 Oct 2021 20:55:46 +0000 (23:55 +0300)]
common/mlx5: share basic probing with internal drivers

Create common probing structure that includes, for now, basic probing
information detected by the common driver and share it with all the
internal drivers.

Signed-off-by: Michael Baum <michaelba@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
3 years agonet/mlx5: register memory event callback in Windows
Michael Baum [Tue, 19 Oct 2021 20:55:45 +0000 (23:55 +0300)]
net/mlx5: register memory event callback in Windows

In device initialization, the driver registers to free hugepages events.
When hugepage is released, this callback frees all its related MRs.

In Windows initialization, this callback is not registered what may
cause to use invalid memory.

This patch adds memory event callback registration in Windows
initialization.

Fixes: 980826dc6f0f ("net/mlx5: probe on Windows")
Cc: stable@dpdk.org
Signed-off-by: Michael Baum <michaelba@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
3 years agotest: add devargs test cases
Xueming Li [Wed, 20 Oct 2021 15:47:39 +0000 (23:47 +0800)]
test: add devargs test cases

Initial version to test global devargs syntax.

Signed-off-by: Xueming Li <xuemingl@nvidia.com>
Reviewed-by: Gaetan Rivet <grive@u256.net>
3 years agodevargs: make bus optional
Xueming Li [Wed, 20 Oct 2021 15:47:38 +0000 (23:47 +0800)]
devargs: make bus optional

Global devargs syntax is used as device iteration filter like
"class=vdpa", a devargs without bus args is valid from parsing
perspective.

This patch makes bus args optional.

Fixes: d2a66ad79480 ("bus: add device arguments name parsing")

Signed-off-by: Xueming Li <xuemingl@nvidia.com>
Reviewed-by: Gaetan Rivet <grive@u256.net>
3 years agodevargs: support path value with global device syntax
Xueming Li [Wed, 20 Oct 2021 15:47:37 +0000 (23:47 +0800)]
devargs: support path value with global device syntax

Slash is used to split global device arguments.

To support path value which contains slash, this patch parses devargs by
locating both slash and layer name key:
  bus=a,name=/some/path/class=b,k1=v1/driver=c,k2=v2
"/class=" and "/driver" are valid start of a layer.

Signed-off-by: Xueming Li <xuemingl@nvidia.com>
Reviewed-by: Gaetan Rivet <grive@u256.net>
3 years agombuf: fix reset on mbuf free
Olivier Matz [Wed, 29 Sep 2021 21:37:07 +0000 (23:37 +0200)]
mbuf: fix reset on mbuf free

m->nb_seg must be reset on mbuf free whatever the value of m->next,
because it can happen that m->nb_seg is != 1. For instance in this
case:

  m1 = rte_pktmbuf_alloc(mp);
  rte_pktmbuf_append(m1, 500);
  m2 = rte_pktmbuf_alloc(mp);
  rte_pktmbuf_append(m2, 500);
  rte_pktmbuf_chain(m1, m2);
  m0 = rte_pktmbuf_alloc(mp);
  rte_pktmbuf_append(m0, 500);
  rte_pktmbuf_chain(m0, m1);

As rte_pktmbuf_chain() does not reset nb_seg in the initial m1
segment (this is not required), after this code the mbuf chain
have 3 segments:
  - m0: next=m1, nb_seg=3
  - m1: next=m2, nb_seg=2
  - m2: next=NULL, nb_seg=1

Then split this chain between m1 and m2, it would result in 2 packets:
  - first packet
    - m0: next=m1, nb_seg=2
    - m1: next=NULL, nb_seg=2
  - second packet
    - m2: next=NULL, nb_seg=1

Freeing the first packet will not restore nb_seg=1 in the second
segment. This is an issue because it is expected that mbufs stored
in pool have their nb_seg field set to 1.

Fixes: 8f094a9ac5d7 ("mbuf: set mbuf fields while in pool")
Cc: stable@dpdk.org
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Tested-by: Ali Alnubani <alialnu@nvidia.com>
3 years agohash: promote some functions to stable
Honnappa Nagarahalli [Fri, 15 Oct 2021 02:27:10 +0000 (21:27 -0500)]
hash: promote some functions to stable

Promote APIs to stable.

Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
Reviewed-by: Dharmik Thakkar <dharmik.thakkar@arm.com>
Acked-by: Yipeng Wang <yipeng1.wang@intel.com>
3 years agotest/hash: fix buffer overflow with jhash
Vladimir Medvedkin [Thu, 14 Oct 2021 17:48:19 +0000 (18:48 +0100)]
test/hash: fix buffer overflow with jhash

This patch fixes buffer overflow reported by ASAN,
please reference https://bugs.dpdk.org/show_bug.cgi?id=818

Some tests for the rte_hash table use the rte_jhash_32b() as
the hash function. This hash function interprets the length
argument in units of 4 bytes.

This patch adds a wrapper function around rte_jhash_32b()
to reflect API differences regarding the length argument,
effectively dividing it by 4.

For some tests rte_jhash() is used with keys of length not
a multiple of 4 bytes. From the rte_jhash() documentation:
If input key is not aligned to four byte boundaries or a
multiple of four bytes in length, the memory region just
after may be read (but not used in the computation).

This patch increases the size of the proto field of the
flow_key struct up to uint32_t.

Bugzilla ID: 818
Fixes: af75078fece3 ("first public release")
Cc: stable@dpdk.org
Signed-off-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>
Acked-by: Yipeng Wang <yipeng1.wang@intel.com>