dpdk.git
4 years agopipeline: fix resource leak
Cristian Dumitrescu [Tue, 6 Oct 2020 20:37:53 +0000 (21:37 +0100)]
pipeline: fix resource leak

Coverity issue: 362812
Fixes: b32c0a2c5e ("pipeline: add SWX table update high level API")

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
4 years agopipeline: fix memory leak
Cristian Dumitrescu [Tue, 6 Oct 2020 20:37:49 +0000 (21:37 +0100)]
pipeline: fix memory leak

Coverity issue: 362741
Fixes: b32c0a2c5e ("pipeline: add SWX table update high level API")

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
4 years agoexamples/ioat: fix stats print
Kevin Laatz [Thu, 17 Sep 2020 13:07:40 +0000 (14:07 +0100)]
examples/ioat: fix stats print

Currently some of the status string at the top of the stats output is being
cut off. To fix this, the status string array size has been increased.
In addition to this, the "\n" has been moved to the printf, rather than
having it in the last string, in case of future formatting issues due to
truncation.

Bugzilla ID: 536
Fixes: 632bcd9b5d4f ("examples/ioat: print statistics")
Cc: stable@dpdk.org
Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
4 years agoraw/ioat: add fill operation
Kevin Laatz [Thu, 8 Oct 2020 09:51:33 +0000 (10:51 +0100)]
raw/ioat: add fill operation

Add fill operation enqueue support for IOAT and IDXD. The fill enqueue is
similar to the copy enqueue, but takes a 'pattern' rather than a source
address to transfer to the destination address. This patch also includes an
additional test case for the new operation type.

Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Radu Nicolau <radu.nicolau@intel.com>
4 years agoraw/ioat: clean up use of common test function
Bruce Richardson [Thu, 8 Oct 2020 09:51:32 +0000 (10:51 +0100)]
raw/ioat: clean up use of common test function

Now that all devices can pass the same set of unit tests, eliminate the
temporary idxd_rawdev_test function and move the prototype for
ioat_rawdev_test to the proper internal header file, to be used by all
device instances.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Kevin Laatz <kevin.laatz@intel.com>
Acked-by: Radu Nicolau <radu.nicolau@intel.com>
4 years agoraw/ioat: add xstats tracking for idxd device
Bruce Richardson [Thu, 8 Oct 2020 09:51:31 +0000 (10:51 +0100)]
raw/ioat: add xstats tracking for idxd device

Add update of the relevant stats for the data path functions and point the
overall device struct xstats function pointers to the existing ioat
functions.

At this point, all necessary hooks for supporting the existing unit tests
are in place so call them for each device.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Kevin Laatz <kevin.laatz@intel.com>
Acked-by: Radu Nicolau <radu.nicolau@intel.com>
4 years agoraw/ioat: move xstats functions to common file
Bruce Richardson [Thu, 8 Oct 2020 09:51:30 +0000 (10:51 +0100)]
raw/ioat: move xstats functions to common file

The xstats functions can be used by all ioat devices so move them from the
ioat_rawdev.c file to ioat_common.c, and add the function prototypes to the
internal header file.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Kevin Laatz <kevin.laatz@intel.com>
Acked-by: Radu Nicolau <radu.nicolau@intel.com>
4 years agoraw/ioat: create separate statistics structure
Bruce Richardson [Thu, 8 Oct 2020 09:51:29 +0000 (10:51 +0100)]
raw/ioat: create separate statistics structure

Rather than having the xstats as fields inside the main driver structure,
create a separate structure type for them.

As part of the change, when updating the stats functions referring to the
stats by the old path, we can simplify them to use the id to directly index
into the stats structure, making the code shorter and simpler.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Kevin Laatz <kevin.laatz@intel.com>
Acked-by: Radu Nicolau <radu.nicolau@intel.com>
4 years agoraw/ioat: add info query for idxd device
Bruce Richardson [Thu, 8 Oct 2020 09:51:28 +0000 (10:51 +0100)]
raw/ioat: add info query for idxd device

Add the info get function for DSA devices, returning just the ring size
info about the device, same as is returned for existing IOAT/CBDMA devices.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Kevin Laatz <kevin.laatz@intel.com>
Acked-by: Radu Nicolau <radu.nicolau@intel.com>
4 years agoraw/ioat: add data path for idxd device
Bruce Richardson [Thu, 8 Oct 2020 09:51:27 +0000 (10:51 +0100)]
raw/ioat: add data path for idxd device

Add support for doing copies using DSA hardware. This is implemented by
just switching on the device type field at the start of the inline
functions. Since there is no hardware which will have both device types
present this branch will always be predictable after the first call,
meaning it has little to no perf penalty.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Kevin Laatz <kevin.laatz@intel.com>
Acked-by: Radu Nicolau <radu.nicolau@intel.com>
4 years agoraw/ioat: start and stop idxd device
Bruce Richardson [Thu, 8 Oct 2020 09:51:26 +0000 (10:51 +0100)]
raw/ioat: start and stop idxd device

Add the start and stop functions for DSA hardware devices using the
vfio/uio kernel drivers. For vdevs using the idxd kernel driver, the device
must be started using sysfs before the device node appears for vdev use -
making start/stop functions in the driver unnecessary.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Kevin Laatz <kevin.laatz@intel.com>
Acked-by: Radu Nicolau <radu.nicolau@intel.com>
4 years agoraw/ioat: configure idxd devices
Bruce Richardson [Thu, 8 Oct 2020 09:51:25 +0000 (10:51 +0100)]
raw/ioat: configure idxd devices

Add configure function for idxd devices, taking the same parameters as the
existing configure function for ioat. The ring_size parameter is used to
compute the maximum number of bursts to be supported by the driver, given
that the hardware works on individual bursts of descriptors at a time.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Kevin Laatz <kevin.laatz@intel.com>
Acked-by: Radu Nicolau <radu.nicolau@intel.com>
4 years agoraw/ioat: add datapath data structures for idxd devices
Bruce Richardson [Thu, 8 Oct 2020 09:51:24 +0000 (10:51 +0100)]
raw/ioat: add datapath data structures for idxd devices

Add in the relevant data structures for the data path for DSA devices. Also
include a device dump function to output the status of each device.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Kevin Laatz <kevin.laatz@intel.com>
Acked-by: Radu Nicolau <radu.nicolau@intel.com>
4 years agoraw/ioat: probe idxd vdev
Kevin Laatz [Thu, 8 Oct 2020 09:51:23 +0000 (10:51 +0100)]
raw/ioat: probe idxd vdev

For each vdev (DSA work queue) instance, create a rawdev instance.

Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Radu Nicolau <radu.nicolau@intel.com>
4 years agoraw/ioat: probe idxd PCI
Bruce Richardson [Thu, 8 Oct 2020 09:51:22 +0000 (10:51 +0100)]
raw/ioat: probe idxd PCI

When a matching device is found via PCI probe create a rawdev instance for
each queue on the hardware. Use empty self-test function for these devices
so that the overall rawdev_autotest does not report failures.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Kevin Laatz <kevin.laatz@intel.com>
Acked-by: Radu Nicolau <radu.nicolau@intel.com>
4 years agoraw/ioat: include example configuration script
Bruce Richardson [Thu, 8 Oct 2020 09:51:21 +0000 (10:51 +0100)]
raw/ioat: include example configuration script

Devices managed by the idxd kernel driver must be configured for DPDK use
before it can be used by the ioat driver. This example script serves both
as a quick way to get the driver set up with a simple configuration, and as
the basis for users to modify it and create their own configuration
scripts.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Kevin Laatz <kevin.laatz@intel.com>
Acked-by: Radu Nicolau <radu.nicolau@intel.com>
4 years agoraw/ioat: introduce vdev probe for DSA/idxd device
Kevin Laatz [Thu, 8 Oct 2020 09:51:20 +0000 (10:51 +0100)]
raw/ioat: introduce vdev probe for DSA/idxd device

The Intel DSA devices can be exposed to userspace via kernel driver, so can
be used without having to bind them to vfio/uio. Therefore we add support
for using those kernel-configured devices as vdevs, taking as parameter the
individual HW work queue to be used by the vdev.

Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Radu Nicolau <radu.nicolau@intel.com>
4 years agoraw/ioat: add skeleton for VFIO/UIO based DSA device
Bruce Richardson [Thu, 8 Oct 2020 09:51:19 +0000 (10:51 +0100)]
raw/ioat: add skeleton for VFIO/UIO based DSA device

Add in the basic probe/remove skeleton code for DSA devices which are bound
directly to vfio or uio driver. The kernel module for supporting these uses
the "idxd" name, so that name is used as function and file prefix to avoid
conflict with existing "ioat" prefixed functions.

Since we are adding new files to the driver and there will be common
definitions shared between the various files, we create a new internal
header file ioat_private.h to hold common macros and function prototypes.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Kevin Laatz <kevin.laatz@intel.com>
Acked-by: Radu Nicolau <radu.nicolau@intel.com>
4 years agousertools: support binding Intel DSA device
Kevin Laatz [Thu, 8 Oct 2020 09:51:18 +0000 (10:51 +0100)]
usertools: support binding Intel DSA device

Intel Data Streaming Accelerator (Intel DSA) is a high-performance data
copy and transformation accelerator which will be integrated in future
Intel processors [1].

Add DSA device support to dpdk-devbind.py script.

[1] https://01.org/blogs/2019/introducing-intel-data-streaming-accelerator

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>
Acked-by: Radu Nicolau <radu.nicolau@intel.com>
4 years agoraw/ioat: make HW register spec private
Bruce Richardson [Thu, 8 Oct 2020 09:51:17 +0000 (10:51 +0100)]
raw/ioat: make HW register spec private

Only a few definitions from the hardware spec are actually used in the
driver runtime, so we can copy over those few and make the rest of the spec
a private header in the driver.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Kevin Laatz <kevin.laatz@intel.com>
Acked-by: Radu Nicolau <radu.nicolau@intel.com>
4 years agoraw/ioat: add separate API for fence call
Bruce Richardson [Thu, 8 Oct 2020 09:51:16 +0000 (10:51 +0100)]
raw/ioat: add separate API for fence call

Rather than having the fence signalled via a flag on a descriptor - which
requires reading the docs to find out whether the flag needs to go on the
last descriptor before, or the first descriptor after the fence - we can
instead add a separate fence API call. This becomes unambiguous to use,
since the fence call explicitly comes between two other enqueue calls. It
also allows more freedom of implementation in the driver code.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Kevin Laatz <kevin.laatz@intel.com>
Acked-by: Radu Nicolau <radu.nicolau@intel.com>
4 years agoraw/ioat: rename functions to be operation-agnostic
Bruce Richardson [Thu, 8 Oct 2020 09:51:15 +0000 (10:51 +0100)]
raw/ioat: rename functions to be operation-agnostic

Since the hardware supported by the ioat driver is capable of operations
other than just copies, we can rename the doorbell and completion-return
functions to not have "copies" in their names. These functions are not
copy-specific, and so would apply for other operations which may be added
later to the driver.

Also add a suitable warning using deprecation attribute for any code using
the old functions names.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Kevin Laatz <kevin.laatz@intel.com>
Acked-by: Radu Nicolau <radu.nicolau@intel.com>
4 years agoraw/ioat: split header file for readability
Bruce Richardson [Thu, 8 Oct 2020 09:51:14 +0000 (10:51 +0100)]
raw/ioat: split header file for readability

Rather than having a single long complicated header file for general use we
can split things so that there is one header with all the publicly needed
information - data structs and function prototypes - while the rest of the
internal details are put separately. This makes it easier to read,
understand and use the APIs.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Kevin Laatz <kevin.laatz@intel.com>
Acked-by: Radu Nicolau <radu.nicolau@intel.com>
4 years agoraw/ioat: add flag to control copying handle parameters
Cheng Jiang [Thu, 8 Oct 2020 09:51:13 +0000 (10:51 +0100)]
raw/ioat: add flag to control copying handle parameters

Add a flag which controls whether rte_ioat_enqueue_copy and
rte_ioat_completed_copies function should process handle parameters. Not
doing so can improve the performance when handle parameters are not
necessary.

Signed-off-by: Cheng Jiang <cheng1.jiang@intel.com>
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Kevin Laatz <kevin.laatz@intel.com>
Acked-by: Radu Nicolau <radu.nicolau@intel.com>
4 years agoraw/ioat: include extra info in test errors
Bruce Richardson [Thu, 8 Oct 2020 09:51:12 +0000 (10:51 +0100)]
raw/ioat: include extra info in test errors

In case of any failures, include the function name and the line number of
the error message in the message, to make tracking down the failure easier.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Kevin Laatz <kevin.laatz@intel.com>
Acked-by: Radu Nicolau <radu.nicolau@intel.com>
4 years agoraw/ioat: enable use from C++
Bruce Richardson [Thu, 8 Oct 2020 09:51:11 +0000 (10:51 +0100)]
raw/ioat: enable use from C++

To allow the header file to be used from C++ code we need to ensure all
typecasts are explicit, and include an 'extern "C"' guard.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Kevin Laatz <kevin.laatz@intel.com>
Acked-by: Radu Nicolau <radu.nicolau@intel.com>
4 years agoraw/ioat: fix missing close function
Kevin Laatz [Thu, 8 Oct 2020 09:51:10 +0000 (10:51 +0100)]
raw/ioat: fix missing close function

When rte_rawdev_pmd_release() is called, rte_rawdev_close() looks for a
dev_close function for the device causing a segmentation fault when no
close() function is implemented for a driver.

This patch resolves the issue by adding a stub function ioat_dev_close().

Fixes: f687e842e328 ("raw/ioat: introduce IOAT driver")
Cc: stable@dpdk.org
Reported-by: Sunil Pai G <sunil.pai.g@intel.com>
Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>
Reviewed-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Sunil Pai G <sunil.pai.g@intel.com>
Acked-by: Radu Nicolau <radu.nicolau@intel.com>
4 years agodoc: add ioat driver to API index
Bruce Richardson [Thu, 8 Oct 2020 09:51:09 +0000 (10:51 +0100)]
doc: add ioat driver to API index

Add the ioat driver to the doxygen documentation.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Kevin Laatz <kevin.laatz@intel.com>
Acked-by: Radu Nicolau <radu.nicolau@intel.com>
4 years agopmdinfogen: fix build with gcc 11
Ferruh Yigit [Mon, 21 Sep 2020 13:38:30 +0000 (14:38 +0100)]
pmdinfogen: fix build with gcc 11

Error observed with gcc 11 under development
gcc (GCC) 11.0.0 20200920 (experimental)

build error:
In file included from ../buildtools/pmdinfogen/pmdinfogen.c:17:
../buildtools/pmdinfogen/pmdinfogen.c: In function ‘parse_elf’:
../buildtools/pmdinfogen/pmdinfogen.h:78:1:
warning: this ‘else’ clause does not guard...
[-Wmisleading-indentation]
   78 | else \
      | ^~~~
../buildtools/pmdinfogen/pmdinfogen.h:83:35:
note: in expansion of macro ‘CONVERT_NATIVE’
   83 | #define TO_NATIVE(fend, width, x) CONVERT_NATIVE(fend, width, x)
      |                                   ^~~~~~~~~~~~~~
../buildtools/pmdinfogen/pmdinfogen.c:152:28:
note: in expansion of macro ‘TO_NATIVE’
  152 |         hdr->e_type      = TO_NATIVE(endian, 16, hdr->e_type);
      |                            ^~~~~~~~~
../buildtools/pmdinfogen/pmdinfogen.h:80:9:
note: ...this statement, but the latter is misleadingly indented
as if it were guarded by the ‘else’
   80 |         ___x; \
      |         ^~~~

Fixes: 98b0fdb0ffc6 ("pmdinfogen: add buildtools and pmdinfogen utility")
Cc: stable@dpdk.org
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
4 years agoapp/testpmd: fix build with gcc 11
Ferruh Yigit [Mon, 21 Sep 2020 13:38:29 +0000 (14:38 +0100)]
app/testpmd: fix build with gcc 11

Error observed with gcc 11 under development
gcc (GCC) 11.0.0 20200920 (experimental)

../app/test-pmd/config.c:1777:61:
warning: argument 3 of type ‘const uint32_t[n]’
{aka ‘const unsigned int[n]’} declared as a variable length
array [-Wvla-parameter]
 1777 | port_flow_list(portid_t port_id, uint32_t n,
  const uint32_t group[n])
      |                 ~~~~~~~~~~~~~~~^~~~~~~~
In file included from ../app/test-pmd/config.c:53:
../app/test-pmd/testpmd.h:764:67:
note: previously declared as a pointer ‘const uint32_t *’
{aka ‘const unsigned int *’}
  764 | void port_flow_list(portid_t port_id, uint32_t n,
   const uint32_t *group);
      |                         ~~~~~~~~~~~~~~~~^~~~~

Fixes: 938a184a1870 ("app/testpmd: implement basic support for flow API")
Cc: stable@dpdk.org
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
Reviewed-by: Phil Yang <phil.yang@arm.com>
Reviewed-by: Asaf Penso <asafp@nvidia.com>
4 years agotimer: add limitation note for sync stop and reset
Erik Gabriel Carrillo [Wed, 9 Sep 2020 14:41:14 +0000 (09:41 -0500)]
timer: add limitation note for sync stop and reset

If a timer's callback function calls rte_timer_reset_sync() or
rte_timer_stop_sync() on another timer that is in the RUNNING state and
owned by the current lcore, the *_sync() calls will loop indefinitely.

Relatedly, if a timer's callback function calls *_sync() on another
timer that is in the RUNNING state and is owned by a different lcore,
but a timer callback function runs on that different lcore and calls
*_sync() on a timer that is in the RUNNING state and owned by the
current lcore, the two lcores will loop indefinitely.

Add a note in the rte_timer_stop_sync and rte_timer_reset_sync
documentation that indicates that these APIs should not be used inside
timer callback functions in order to avoid the hangs described above,
and suggests an alternative.

Bugzilla ID: 491
Cc: stable@dpdk.org
Signed-off-by: Erik Gabriel Carrillo <erik.g.carrillo@intel.com>
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
4 years agodoc: add stack mempool guide
Gage Eads [Wed, 7 Oct 2020 14:18:32 +0000 (09:18 -0500)]
doc: add stack mempool guide

This guide describes the two stack modes, their tradeoffs, and (via a
reference to the mempool guide) how to enable them.

Signed-off-by: Gage Eads <gage.eads@intel.com>
Reviewed-by: Olivier Matz <olivier.matz@6wind.com>
4 years agotrace: increase event CTF description buffer size
Timothy McDaniel [Mon, 5 Oct 2020 20:02:34 +0000 (15:02 -0500)]
trace: increase event CTF description buffer size

The current buffer size is not big enough to register trace points for
new additions in the eventdev subsystem.
Increase TRACE_CTF_FIELD_SIZE by 64 bytes for now.

Signed-off-by: Timothy McDaniel <timothy.mcdaniel@intel.com>
Acked-by: Sunil Kumar Kori <skori@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
4 years agopower: fix current frequency index
Reshma Pattan [Wed, 29 Jul 2020 13:58:53 +0000 (14:58 +0100)]
power: fix current frequency index

During power initialization the pstate cpufreq api is
not setting the initial curr_idx of pstate_power_info
to corresponding current frequency index.

Without this the idx is always 0, which is causing the
below check to pass and returns without setting the initial
min/max frequency to system max frequency and this leads to
incorrect frequency settings when power_pstate_cpufreq_set_freq()
is called in the apps.

set_freq_internal(struct pstate_power_info *pi, uint32_t idx)
{
...

 /* Check if it is the same as current */
        if (idx == pi->curr_idx)
                return 0;
...
}

scenario 1:
If system has starting scaling min/max: 1000/1000, and want to
set this to 2200/2200, the max frequency gets updated but not min.

scenario 2:
If system has starting scaling min/max: 2200/1000, and want to set
to 2200/2200, the max, min frequency was not updated. Since no change
in max that should be ok, but min was also ignored, which will be fixed
now with the new changes.

Fixes: e6c6dc0f ("power: add p-state driver compatibility")
Cc: stable@dpdk.org
Signed-off-by: Reshma Pattan <reshma.pattan@intel.com>
Reviewed-by: Liang Ma <liang.j.ma@intel.com>
4 years agotrace: add size_t as generic trace point
Pavan Nikhilesh [Tue, 25 Aug 2020 23:24:09 +0000 (04:54 +0530)]
trace: add size_t as generic trace point

Add size_t as a generic trace point. Also, update
test_generic_trace_point() to validate size_t emitter.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Acked-by: Sunil Kumar Kori <skori@mavell.com>
4 years agotrace: fix size_t field emitter
Pavan Nikhilesh [Tue, 25 Aug 2020 23:24:08 +0000 (04:54 +0530)]
trace: fix size_t field emitter

Add size_t CTF format metadata, this is needed by CTF analyzers to
parse the emitted CTF trace.

Fixes: 262c4ee791c6 ("trace: add size_t field emitter")

Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Acked-by: Sunil Kumar Kori <skori@mavell.com>
4 years agomempool: dump handler index and name
Hemant Agrawal [Tue, 8 Sep 2020 05:41:53 +0000 (11:11 +0530)]
mempool: dump handler index and name

Enhance the dump function to also print the ops index
and associated mempool ops name

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
4 years agoport: remove useless assignment
Fan Zhang [Fri, 18 Sep 2020 08:23:10 +0000 (09:23 +0100)]
port: remove useless assignment

This patch fixes an unused value in pcap source port by
removing the setting to the value.

Coverity issue: 362020
Fixes: d4b42133d85b ("port: add pcap file source")
Cc: stable@dpdk.org
Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
4 years agoraw/skeleton: allow closing already closed device
Lukasz Wojciechowski [Mon, 21 Sep 2020 21:44:20 +0000 (23:44 +0200)]
raw/skeleton: allow closing already closed device

This patch return OK code (0) from skeleton_rawdev_close function
if firmware is in SKELETON_FW_READY state. Formerly it returned
-EINVAL error code.

Returning an error here is troublesome as it disallows proper release
of the rawdev. The rte_rawdev_pmd_release function from librte_rawdev
library calls drivers' rawdev_close handler and continues execution
only in case of errorless call.
(see lib/librte_rawdev/rte_rawdev.c:540)

The SKELETON_FW_READY state is reached after creation, reset, unload
or close of the device. The device should be ok to be released in
such situations.

To reproduce issue fixed by this patch, call rawdev_autotest
from dpdk-test app for few times. As the device is not properly
released, the next calls will fail.

Fixes: 61c592a8d035 ("raw/skeleton: introduce skeleton rawdev driver")
Cc: stable@dpdk.org
Signed-off-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
4 years agoraw/skeleton: reset test statistics
Lukasz Wojciechowski [Mon, 21 Sep 2020 21:44:19 +0000 (23:44 +0200)]
raw/skeleton: reset test statistics

Statistics: passed, failed, unsupported and total are kept
in global static variables. As global variables they are initiated
with zeroes. However running test multiple times cumulates results
from previous calls.

This patch resets statistics with zeroes in testsuite_setup().

To reproduce issue fixed by this patch, run rawdev_autotest command
in dpdk-test app multiple times.

Fixes: 55ca1b0f2151 ("raw/skeleton: add test cases")
Cc: stable@dpdk.org
Signed-off-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
4 years agoethdev: add common stats for telemetry
Ciara Power [Wed, 23 Sep 2020 11:12:28 +0000 (12:12 +0100)]
ethdev: add common stats for telemetry

The ethdev library now registers a telemetry command for common ethdev
statistics.

An example usage is shown below:

Connecting to /var/run/dpdk/rte/dpdk_telemetry.v2
{"version": "DPDK 20.08.0-rc1", "pid": 14119, "max_output_len": 16384}
--> /ethdev/stats,0
{"/ethdev/stats": {"ipackets": 0, "opackets": 0, "ibytes": 0, "obytes": \
    0, "imissed": 0, "ierrors": 0, "oerrors": 0, "rx_nombuf": 0, \
    "q_ipackets": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], \
    "q_opackets": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], \
    "q_ibytes": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], \
    "q_obytes": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], \
    "q_errors": [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]}}

Signed-off-by: Ciara Power <ciara.power@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
4 years agotest/telemetry: add unit tests for data to JSON
Louise Kilheeney [Wed, 23 Sep 2020 11:12:27 +0000 (12:12 +0100)]
test/telemetry: add unit tests for data to JSON

This patch adds tests for verifying telemetry data structures are
converted to JSON as expected. Both flat and recursive data structures
are tested, for all possible value types.

The app connects to the telemetry socket as a client, and registers one
command with a corresponding callback function. Each time the callback
function is called, it copies a global data variable to the data pointer
passed in by telemetry.
When a test case is run, the test case function builds up the global
data variable with the relevant data types, and the expected json string
output which should be generated from that. The 'test_output()' function
is used to trigger the callback and ensure the actual output matches
that expected.

Signed-off-by: Louise Kilheeney <louise.kilheeney@intel.com>
Signed-off-by: Ciara Power <ciara.power@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
4 years agotelemetry: support array values in data object
Ciara Power [Wed, 23 Sep 2020 11:12:26 +0000 (12:12 +0100)]
telemetry: support array values in data object

Arrays of type uint64_t/int/string can now be included within an array
or dict. One level of embedded containers is supported. This is
necessary to allow for instances such as the ethdev queue stats to be
reported as a list of uint64_t values, rather than having multiple dict
entries with one uint64_t value for each queue stat.

The memory management APIs provided by telemetry simplify the memory
allocation/free aspect of the embedded container. The rte_tel_data_alloc
function is called in the library/app callback to return a pointer to a
container that has been allocated memory. When adding this container
to an array/dict, a parameter is passed to indicate if the memory
should be freed by telemetry after use. This will allow reuse of the
allocated memory if the library/app wishes to do so.

Signed-off-by: Ciara Power <ciara.power@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
4 years agotelemetry: fix passing full params string to command
Ciara Power [Thu, 27 Aug 2020 08:39:22 +0000 (09:39 +0100)]
telemetry: fix passing full params string to command

Telemetry only passed the first param to the command handler if multiple
were entered by the user, separated by commas. Telemetry is required to
pass the full params string to the command, by splitting by a comma
delimiter only once to remove the command part of the string. This will
enable future commands to take multiple param values.

Fixes: b1ad0e124536 ("rawdev: add telemetry callbacks")
Fixes: c190daedb9b1 ("ethdev: add telemetry callbacks")
Fixes: 6dd571fd07c3 ("telemetry: introduce new functionality")
Cc: stable@dpdk.org
Signed-off-by: Ciara Power <ciara.power@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
4 years agoapp/procinfo: close devices before exit
Ferruh Yigit [Wed, 30 Sep 2020 12:06:37 +0000 (13:06 +0100)]
app/procinfo: close devices before exit

As well as this is correct thing to close devices before exit, it is
also useful to test the closing devices from secondary process.

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agogro: support VXLAN UDP/IPv4
Yi Yang [Thu, 24 Sep 2020 08:57:39 +0000 (16:57 +0800)]
gro: support VXLAN UDP/IPv4

VXLAN UDP/IPv4 GRO can help improve VM-to-VM UDP
performance when UFO or GSO is enabled in VM, GRO
must be supported if UFO or GSO is enabled,
otherwise, performance can't get big improvement
if only GSO is there.

With this enabled in DPDK, OVS DPDK can leverage it
to improve VM-to-VM UDP performance, it will reassemble
VXLAN UDP/IPv4 fragments immediate after they are
received from a physical NIC. It is very helpful in
OVS DPDK VXLAN use case.

Signed-off-by: Yi Yang <yangyi01@inspur.com>
Acked-by: Jiayu Hu <jiayu.hu@intel.com>
4 years agogro: support UDP/IPv4
Yi Yang [Thu, 24 Sep 2020 08:57:38 +0000 (16:57 +0800)]
gro: support UDP/IPv4

UDP/IPv4 GRO can help improve VM-to-VM UDP performance
when UFO or GSO is enabled in VM, GRO must be supported
if UFO or GSO is enabled, otherwise, performance can't
get big improvement if only GSO is there.

With this enabled in DPDK, OVS DPDK can leverage it
to improve VM-to-VM UDP performance, it will reassemble
UDP fragments immediate after they are received from
a physical NIC. It is very helpful in OVS DPDK VLAN use
case.

Signed-off-by: Yi Yang <yangyi01@inspur.com>
Acked-by: Jiayu Hu <jiayu.hu@intel.com>
4 years agonet: calculate checksum of packet with IPv4 options
Michael Pfeiffer [Tue, 1 Sep 2020 09:47:55 +0000 (11:47 +0200)]
net: calculate checksum of packet with IPv4 options

Currently, rte_ipv4_cksum() and rte_ipv4_udptcp_cksum() assume all IPv4
headers have sizeof(struct rte_ipv4_hdr) bytes. This is not true for
those (rare) packets with IPv4 options. Thus, both IPv4 and TCP/UDP
checksums are calculated wrong.

This patch fixes the issue by using the actual IPv4 header length from
the packet's IHL field.

Signed-off-by: Michael Pfeiffer <michael.pfeiffer@tu-ilmenau.de>
Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
4 years agokernel/linux: remove igb_uio
Thomas Monjalon [Mon, 7 Sep 2020 22:39:03 +0000 (00:39 +0200)]
kernel/linux: remove igb_uio

As decided in the Technical Board in November 2019,
the kernel module igb_uio is moved to the dpdk-kmods repository
in the /linux/igb_uio/ directory.

Minutes of Technical Board meeting:
https://mails.dpdk.org/archives/dev/2019-November/151763.html

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agobus/dpaa: enhance link status
Rohit Raj [Thu, 24 Sep 2020 04:02:09 +0000 (09:32 +0530)]
bus/dpaa: enhance link status

This patch adds support to get/set link speed, duplex and
autoneg mode status from/to PHY. Enhance device capabilities
to advertise all supported link speeds according to mac type.

Also enables fallback support for get link status API where
kernel support is missing.

Signed-off-by: Sachin Saxena <sachin.saxena@oss.nxp.com>
Signed-off-by: Rohit Raj <rohit.raj@nxp.com>
Acked-by: Nipun Gupta <nipun.gupta@nxp.com>
4 years agonet/dpaa: send error packets to application
Nipun Gupta [Thu, 24 Sep 2020 04:02:08 +0000 (09:32 +0530)]
net/dpaa: send error packets to application

Send error packets to main queue (rx) to make application
enable to receive error packets.
Earlier all packets with L3/L4 checksum errors were getting
dropped by the hardware.

Signed-off-by: Rohit Raj <rohit.raj@nxp.com>
Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
4 years agobus/dpaa: enable Rx/Tx error queues
Sachin Saxena [Thu, 24 Sep 2020 04:02:07 +0000 (09:32 +0530)]
bus/dpaa: enable Rx/Tx error queues

Enables a debugging queue to fetch error (Rx/Tx) packets
to user space. Earlier all packets with L3/L4 checksum
errors were getting dropped by the hardware.

Setting CONFIG_RTE_LIBRTE_DPAA_DEBUG_DRIVER=y is required
which enables following enhancements.
1) Enable TX/RX error queues to check the errors packet.
2) Display error frame information(payload, status, paresr result).
3) Send error packets to application

Signed-off-by: Jun Yang <jun.yang@nxp.com>
Signed-off-by: Rohit Raj <rohit.raj@nxp.com>
Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Signed-off-by: Sachin Saxena <sachin.saxena@oss.nxp.com>
4 years agonet/dpaa2: fix check for key size
Apeksha Gupta [Thu, 24 Sep 2020 04:02:06 +0000 (09:32 +0530)]
net/dpaa2: fix check for key size

DPAA2 has support for raw flow classification, which can
be used for any protocol rules. This change fixes flow key
pattern length match boundary condition with spec length.

Fixes: 3f881f8d6eb0 ("net/dpaa2: support raw flow classification")
Cc: stable@dpdk.org
Signed-off-by: Apeksha Gupta <apeksha.gupta@nxp.com>
Acked-by: Nipun Gupta <nipun.gupta@nxp.com>
4 years agobus/fslmc: run secondary debug app without restriction
Rohit Raj [Thu, 24 Sep 2020 04:02:05 +0000 (09:32 +0530)]
bus/fslmc: run secondary debug app without restriction

dpaa2 hw impose limits on some HW access devices like DPMCP(Management
control Port) and DPIO (HW portal). This causes issue in their shared
usages in case of multi-process applications. It can overcome by using
whitelist/blacklist in primary and secondary applications.
However it imposes restrictions on standard debugging apps like
dpdk-procinfo, which can be used to debug any existing application.

This patch introduces reserving extra DPMCP and DPIO to be used by
secondary process if devices are not blocked previously in primary
application.
This leaves the last DPMCP and DPIO for the secondary process usages.

Signed-off-by: Rohit Raj <rohit.raj@nxp.com>
Signed-off-by: Sachin Saxena <sachin.saxena@oss.nxp.com>
Acked-by: Nipun Gupta <nipun.gupta@nxp.com>
4 years agobus/fslmc: fix atomic queues on NXP LX2 platform
Youri Querry [Thu, 24 Sep 2020 04:02:04 +0000 (09:32 +0530)]
bus/fslmc: fix atomic queues on NXP LX2 platform

Traffic was stalling after few packet while running l2fwd-event
in atomic mode on LX2 platform. It was due to wrong dca setting
while enqueuing packets to EQCR.
This patch fixes the issue by writing correct dca setting.

Fixes: 1b49352f41be ("bus/fslmc: rename portal pi index to consumer index")
Cc: stable@dpdk.org
Signed-off-by: Youri Querry <youri.querry_1@nxp.com>
Signed-off-by: Rohit Raj <rohit.raj@nxp.com>
Acked-by: Nipun Gupta <nipun.gupta@nxp.com>
4 years agomempool: promote some experimental functions as stable
Olivier Matz [Tue, 6 Oct 2020 07:07:50 +0000 (09:07 +0200)]
mempool: promote some experimental functions as stable

Move symbols introduced in version <= 19.11 in the stable ABI.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
4 years agomempool: remove v20 ABI compatibility
Olivier Matz [Tue, 6 Oct 2020 07:07:49 +0000 (09:07 +0200)]
mempool: remove v20 ABI compatibility

Remove the deprecated v20 ABI of rte_mempool_populate_iova() and
rte_mempool_populate_virt().

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
4 years agobus/fslmc: fix dpio close
Rohit Raj [Tue, 28 Jul 2020 16:24:59 +0000 (21:54 +0530)]
bus/fslmc: fix dpio close

The current state of the DPIO object should be checked
before trying to close/disable the object.

Fixes: 293c0ca94c36 ("bus/fslmc: support memory backed portals with QBMAN 5.0")
Cc: stable@dpdk.org
Signed-off-by: Rohit Raj <rohit.raj@nxp.com>
Acked-by: Sachin Saxena <sachin.saxena@oss.nxp.com>
4 years agorcu: promote library as stable
Joyce Kong [Fri, 11 Sep 2020 05:45:33 +0000 (13:45 +0800)]
rcu: promote library as stable

RCU library supporting quiescent state was introduced
in 19.05 release and has been around 4 releases, it
should be mature enough to remove the experimental tag.

Signed-off-by: Joyce Kong <joyce.kong@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: David Christensen <drc@linux.vnet.ibm.com>
4 years agomcslock: promote as stable
Joyce Kong [Fri, 11 Sep 2020 05:45:32 +0000 (13:45 +0800)]
mcslock: promote as stable

Since rte_mcslock APIs were introduced in 19.08 release,
it is now possible to remove the experimental tag from:
rte_mcslock_lock()
rte_mcslock_unlock()
rte_mcslock_trylock()
rte_mcslock_is_locked()

Signed-off-by: Joyce Kong <joyce.kong@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Acked-by: Phil Yang <phil.yang@arm.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: David Christensen <drc@linux.vnet.ibm.com>
4 years agoticketlock: promote as stable
Joyce Kong [Fri, 11 Sep 2020 05:45:31 +0000 (13:45 +0800)]
ticketlock: promote as stable

As rte_ticketlock was introduced in 19.05 release
and there were no changes in its public API since
19.11 release, it should be mature enough to remove
the experimental tag.

Signed-off-by: Joyce Kong <joyce.kong@arm.com>
Reviewed-by: Phil Yang <phil.yang@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: David Christensen <drc@linux.vnet.ibm.com>
4 years agoeal: promote wait until equal API as stable
Joyce Kong [Fri, 11 Sep 2020 05:45:34 +0000 (13:45 +0800)]
eal: promote wait until equal API as stable

rte_wait_until_equal_xx APIs were introduced in 19.11 release
and there were no changes in the public APIs since then, it
should be mature enough to remove the experimental tag.

Signed-off-by: Joyce Kong <joyce.kong@arm.com>
Reviewed-by: Phil Yang <phil.yang@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: David Christensen <drc@linux.vnet.ibm.com>
4 years agomaintainers: add titles for examples
Olivier Matz [Tue, 6 Oct 2020 07:03:02 +0000 (09:03 +0200)]
maintainers: add titles for examples

The devtools/get-maintainer.sh script does not work with examples
because there is no title line between them: it returns a longer list
than expected.

Add the missing titles for each example to fix this behavior.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
4 years agoexamples/vm_power: fix 32-bit build
Ferruh Yigit [Mon, 5 Oct 2020 17:02:01 +0000 (18:02 +0100)]
examples/vm_power: fix 32-bit build

Compiler version:
gcc 10.2.1 "cc (GCC) 10.2.1 20200723 (Red Hat 10.2.1-1)"

Build error:
../examples/vm_power_manager/guest_cli/vm_power_cli_guest.c:346:23:
 warning: format ‘%ld’ expects argument of type ‘long int’, but
argument 4 has type ‘uint64_t’ {aka ‘long long unsigned int’}
[-Wformat=]
  346 |    cmdline_printf(cl, "Capabilities of [%d] vcore are:"
      |                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
......
  349 |      pkt_caps_list.turbo[i],
      |      ~~~~~~~~~~~~~~~~~~~~~~
      |                         |
      |                         uint64_t {aka long long unsigned int}

Fixes: 07525d1a047a ("examples/vm_power: send capabilities request from guest")
Cc: stable@dpdk.org
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Tested-by: David Marchand <david.marchand@redhat.com>
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
4 years agotest/raw: remove ioat-specific autotest
Bruce Richardson [Thu, 10 Sep 2020 16:47:16 +0000 (17:47 +0100)]
test/raw: remove ioat-specific autotest

Since the rawdev autotest can now be used to test all rawdevs on the
system, there is no need for a dedicated ioat autotest command.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Kevin Laatz <kevin.laatz@intel.com>
4 years agotest/raw: run selftest on all devices
Bruce Richardson [Thu, 10 Sep 2020 16:47:15 +0000 (17:47 +0100)]
test/raw: run selftest on all devices

Rather than having each rawdev provide its own autotest command, we can
instead just use the generic rawdev_autotest to test any and all available
rawdevs.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Kevin Laatz <kevin.laatz@intel.com>
4 years agoraw/ioat: support multiple devices being tested
Bruce Richardson [Thu, 10 Sep 2020 16:47:14 +0000 (17:47 +0100)]
raw/ioat: support multiple devices being tested

The current selftest function uses a single global variable to track state
which implies that only a single instance can have the selftest function
called on it. Change this to an array to allow multiple instances to be
tested.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Kevin Laatz <kevin.laatz@intel.com>
4 years agoraw/ntb: support Intel Ice Lake
Xiaoyun Li [Tue, 8 Sep 2020 03:27:54 +0000 (11:27 +0800)]
raw/ntb: support Intel Ice Lake

Add NTB device support (4th generation) for Intel Ice Lake platform.

Signed-off-by: Xiaoyun Li <xiaoyun.li@intel.com>
Acked-by: Jingjing Wu <jingjing.wu@intel.com>
4 years agodrivers/common: mark all symbols as internal
David Marchand [Thu, 1 Oct 2020 07:55:17 +0000 (09:55 +0200)]
drivers/common: mark all symbols as internal

Now that we have the internal tag, let's avoid confusion with exported
symbols in common drivers that were using the experimental tag as a
workaround.
There is also no need to put internal API symbols in the public stable
ABI.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Anoob Joseph <anoobj@marvell.com>
Acked-by: Ray Kinsella <mdr@ashroe.eu>
4 years agoregex/mlx5: add dynamic memory registration to datapath
Yuval Avnery [Mon, 5 Oct 2020 10:51:20 +0000 (10:51 +0000)]
regex/mlx5: add dynamic memory registration to datapath

Currently job data is being copied to pre-registered buffer.
To avoid memcpy on the datapath, use dynamic memory registration.

This change will reduce latency when sending regex jobs. The first few
jobs may have high latency due to registration, but assuming all
following mbufs will arrive from the same mempool/hugepage, there will
be no further memory registration.

Signed-off-by: Yuval Avnery <yuvalav@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
4 years agomem: fix allocation in container with SELinux
David Marchand [Thu, 10 Sep 2020 16:24:07 +0000 (18:24 +0200)]
mem: fix allocation in container with SELinux

This is something we encountered while working in an OpenShift
environment with SELinux enabled.
In this environment, a DPDK application could create/write to hugepage
files but removing them was refused.
This resulted in dirty files being reused when starting a new DPDK
application and triggered random crashes / erratic behavior.

Getting a SELinux setup can be a challenge, and even more if you add
containers to the picture :-).
So here is a reproducer for the interested testers:

  # cat >wrap.c <<EOF
  #define _GNU_SOURCE
  #include <dlfcn.h>
  #include <errno.h>
  #include <stdio.h>
  #include <string.h>
  #include <sys/stat.h>
  #include <sys/types.h>
  #include <unistd.h>

  int unlink(const char *pathname)
  {
   static int (*orig)(const char *pathname) = NULL;
   struct stat st;

   if (orig == NULL)
   orig = dlsym(RTLD_NEXT, "unlink");
   if (strstr(pathname, "rtemap_") != NULL &&
stat(pathname, &st) == 0) {
   fprintf(stderr, "### refused unlink for %s\n",
   pathname);
   errno = EACCES;
   return -1;
   }
   fprintf(stderr, "### called unlink for %s\n", pathname);
   return orig(pathname);
  }

  int unlinkat(int dirfd, const char *pathname, int flags)
  {
   static int (*orig)(int dirfd, const char *pathname, int flags) =
   NULL;
   struct stat st;

   if (orig == NULL)
   orig = dlsym(RTLD_NEXT, "unlinkat");
   if (strstr(pathname, "rtemap_") != NULL &&
   fstatat(dirfd, pathname, &st, flags) == 0) {
   fprintf(stderr, "### refused unlinkat for %s\n",
   pathname);
   errno = EACCES;
   return -1;
   }
   fprintf(stderr, "### called unlinkat for %s\n", pathname);
   return orig(dirfd, pathname, flags);
  }
  EOF

  # gcc -fPIC -shared  -o libwrap.so wrap.c -ldl
  # \rm /dev/hugepages/rtemap*

  # # First run is fine
  # LD_PRELOAD=libwrap.so dpdk-testpmd -w 0000:01:00.0 -- -i
  [...]
  Configuring Port 0 (socket 0)
  Port 0: 24:6E:96:3C:52:D8
  Checking link statuses...
  Done
  testpmd>

  # # Second run we have dirty memory
  # LD_PRELOAD=libwrap.so dpdk-testpmd -w 0000:01:00.0 -- -i
  [...]
  ### refused unlinkat for rtemap_0
  [...]
  Port 0 is now not stopped
  Please stop the ports first
  Done
  testpmd>

Removing hugepage files is done in multiple places and the memory
allocation code is complex.
This fix tries to do the minimum and avoids touching other paths.

If trying to remove the hugepage file before allocating a page fails,
the error is reported to the caller and the user will see a memory
allocation error log.

Fixes: 582bed1e1d1d ("mem: support mapping hugepages at runtime")
Cc: stable@dpdk.org
Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
4 years agomempool: dump socket attribute
Sachin Saxena [Fri, 11 Sep 2020 08:13:16 +0000 (13:43 +0530)]
mempool: dump socket attribute

Enhance the dump function to also print socket_id attribute
passed at creation time.

Signed-off-by: Sachin Saxena <sachin.saxena@oss.nxp.com>
Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
4 years agorcu: avoid literal suffix warning in C++ mode
Dmitry Kozlyuk [Fri, 4 Sep 2020 20:47:34 +0000 (23:47 +0300)]
rcu: avoid literal suffix warning in C++ mode

Sequences like "value = %"PRIu64 (no space before PRIu64) are parsed as
a single preprocessor token, user-defined-string-literal, in C++11
onwards. While modern compilers are smart enough to parse this properly,
GCC 9.3.0 generates warnings like:

    rte_rcu_qsbr.h:555:26: warning: invalid suffix on literal; C++11
    requires a space between literal and string macro [-Wliteral-suffix]

Add spaces around format specifier macros to make public headers
compatible with C++ without causing warnings. Make similar changes in C
source for style consistency within the library.

Fixes: 64994b56c ("rcu: add RCU library supporting QSBR mechanism")
Cc: stable@dpdk.org
Signed-off-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
4 years agomaintainers: update email address
Andrew Rybchenko [Thu, 24 Sep 2020 13:40:22 +0000 (14:40 +0100)]
maintainers: update email address

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
4 years agodoc: remove trailing white space
Stephen Hemminger [Wed, 12 Aug 2020 23:06:22 +0000 (16:06 -0700)]
doc: remove trailing white space

Run a simple script to remove trailing white space and blank
lines at end of file across all documents.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agodoc: add doxygen index file to dependencies
Bruce Richardson [Tue, 1 Sep 2020 14:51:27 +0000 (15:51 +0100)]
doc: add doxygen index file to dependencies

The doxygen index file is not printed as a processed file by doxygen so it
does not appear in the output .d (dependency file) list automatically
generated. Therefore, for correct rebuild tracking, we need to explicitly
include it as a dependency of the doxygen job.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
4 years agodoc: fix formatting of notes in meson guide
Bruce Richardson [Thu, 3 Sep 2020 14:00:33 +0000 (15:00 +0100)]
doc: fix formatting of notes in meson guide

The "note" callouts in the chapter describing the meson build were
incorrectly formatted, so adjust to use the correct markdown syntax.

Fixes: 9c3adc289c5e ("doc: add instructions on build using meson")
Cc: stable@dpdk.org
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: John McNamara <john.mcnamara@intel.com>
4 years agodoc: make sphinx comply with meson werror option
Bruce Richardson [Thu, 1 Oct 2020 11:14:01 +0000 (12:14 +0100)]
doc: make sphinx comply with meson werror option

When the --werror meson build option is set, we can pass the "-W",
warning-as-errors, flag to sphinx to get the same behaviour for doc
building as for building the rest of DPDK. This can help catch
documentation errors sooner in the development process.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
4 years agostack: promote library as stable
Gage Eads [Wed, 30 Sep 2020 21:39:54 +0000 (16:39 -0500)]
stack: promote library as stable

The stack library was first released in 19.05, and its interfaces have been
stable since their initial introduction. This commit promotes the full
interface to stable, starting with the 20.11 major version.

Signed-off-by: Gage Eads <gage.eads@intel.com>
Acked-by: David Marchand <david.marchand@redhat.com>
4 years agotimer: promote some experimental functions as stable
Erik Gabriel Carrillo [Tue, 8 Sep 2020 20:03:55 +0000 (15:03 -0500)]
timer: promote some experimental functions as stable

Some new APIs were added to the timer library in the 19.05 release, and
there have been no changes to their interfaces since then. These
functions can be considered stable enough to remove their 'experimental'
tag.

Signed-off-by: Erik Gabriel Carrillo <erik.g.carrillo@intel.com>
Acked-by: Ray Kinsella <mdr@ashroe.eu>
4 years agometer: remove experimental alias
Ferruh Yigit [Mon, 17 Aug 2020 10:22:13 +0000 (11:22 +0100)]
meter: remove experimental alias

Remove ABI versioning for APIs:
'rte_meter_trtcm_rfc4115_profile_config()'
'rte_meter_trtcm_rfc4115_config()'

The alias was introduced in
commit 60197bda97a0 ("meter: provide experimental alias for matured API")

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Acked-by: Ray Kinsella <mdr@ashroe.eu>
4 years agodoc: remove references to python 2
Robin Jarry [Fri, 2 Oct 2020 15:47:53 +0000 (17:47 +0200)]
doc: remove references to python 2

Python 2 support has now been dropped. Remove references to it in the
documentation.

Since all python scripts now have a proper shebang that calls python3,
execute the scripts directly without specifying the interpreter.

Sphinx version from most Linux distros is OK in 2020, do not encourage
people to break their system by installing with pip. Use the distros
official packages.

Signed-off-by: Robin Jarry <robin.jarry@6wind.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Kevin Laatz <kevin.laatz@intel.com>
4 years agobus/pci: remove unnecessary cast
Yunjian Wang [Wed, 16 Sep 2020 12:41:56 +0000 (20:41 +0800)]
bus/pci: remove unnecessary cast

The variables 'vfio_res->nb_maps' and 'i' are of type int. The type
casting of 'vfio_res->nb_maps' is redundant and not required.

Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
4 years agobus/pci: fix leak on VFIO mapping error
Yunjian Wang [Fri, 11 Sep 2020 11:08:04 +0000 (19:08 +0800)]
bus/pci: fix leak on VFIO mapping error

Currently, only the 'vfio_dev_fd' is closed in failure path, so
some resources are not released(such as 'vfio_group_fd'). The
rte_vfio_release_device() should be used to avoid this problem.

Fixes: 33604c31354a ("vfio: refactor PCI BAR mapping")
Cc: stable@dpdk.org
Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
Reviewed-by: Anatoly Burakov <anatoly.burakov@intel.com>
4 years agobus/pci: fix memory leak when unmapping VFIO resource
Yunjian Wang [Fri, 11 Sep 2020 10:57:42 +0000 (18:57 +0800)]
bus/pci: fix memory leak when unmapping VFIO resource

The 'vfio_res' is not freed when unmapping resource by primary process.
This leads to memory leak.

Fixes: ab53203e194b ("vfio: enable unmapping resource for secondary")
Cc: stable@dpdk.org
Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
4 years agobus/fslmc: fix VFIO group descriptor check
Yunjian Wang [Tue, 19 May 2020 03:42:12 +0000 (11:42 +0800)]
bus/fslmc: fix VFIO group descriptor check

The issue is that a file descriptor at 0 is a valid one. Currently
the file not found, the return value will be set to 0. As a result,
it is impossible to distinguish between a correct descriptor and a
failed return value. Fix it to return -ENOENT instead of 0.

Fixes: a69f79300262 ("bus/fslmc: support multi VFIO group")
Cc: stable@dpdk.org
Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
4 years agovfio: fix group descriptor check
Yunjian Wang [Tue, 19 May 2020 03:42:00 +0000 (11:42 +0800)]
vfio: fix group descriptor check

The issue is that a file descriptor at 0 is a valid one. Currently
the file not found, the return value will be set to 0. As a result,
it is impossible to distinguish between a correct descriptor and a
failed return value. Fix it to return -ENOENT instead of 0.

Fixes: b758423bc4fe ("vfio: fix race condition with sysfs")
Fixes: ff0b67d1c868 ("vfio: DMA mapping")
Cc: stable@dpdk.org
Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
Reviewed-by: Anatoly Burakov <anatoly.burakov@intel.com>
4 years agomempool/ring: build on Windows
Tal Shnaiderman [Wed, 16 Sep 2020 10:42:04 +0000 (13:42 +0300)]
mempool/ring: build on Windows

Build the ring mempool handler for Windows OS.

Signed-off-by: Tal Shnaiderman <talshn@nvidia.com>
Acked-by: Ranjit Menon <ranjit.menon@intel.com>
4 years agohash: build on Windows
Ophir Munk [Thu, 1 Oct 2020 15:30:59 +0000 (18:30 +0300)]
hash: build on Windows

Build the lib for Windows.
Export the needed function from eal.

Signed-off-by: Ophir Munk <ophirmu@nvidia.com>
Signed-off-by: Tal Shnaiderman <talshn@nvidia.com>
Tested-by: Pallavi Kadam <pallavi.kadam@intel.com>
Acked-by: Pallavi Kadam <pallavi.kadam@intel.com>
4 years agoeal/windows: use bundled getopt with MinGW
Dmitry Kozlyuk [Thu, 24 Sep 2020 23:17:07 +0000 (02:17 +0300)]
eal/windows: use bundled getopt with MinGW

Clang builds use getopt.c in librte_eal while MinGW provides
implementation as part of the toolchain. Statically linking librte_eal
to an application that depends on getopt results in undefined reference
errors with MinGW. There are no such errors with Clang, because with
Clang librte_eal actually defines getopt functions.

Use getopt.c in EAL with Clang and MinGW to get identical behavior.
Adjust code for MinGW. Incidentally, this removes a bug when free() is
called on uninitialized memory.

Fixes: 5e373e456e6 ("eal/windows: add getopt implementation")
Cc: stable@dpdk.org
Reported-by: Khoa To <khot@microsoft.com>
Reported-by: Tal Shnaiderman <talshn@nvidia.com>
Signed-off-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
Acked-by: Khoa To <khot@microsoft.com>
Acked-by: Pallavi Kadam <pallavi.kadam@intel.com>
4 years agovdpa/ifc: fix build with recent kernels
Maxime Coquelin [Fri, 2 Oct 2020 07:54:00 +0000 (09:54 +0200)]
vdpa/ifc: fix build with recent kernels

VIRTIO_F_IOMMU_PLATFORM is now defined in recent kernel
headers, causing build issue.

Let's define it in the IFC vDPA driver only if it wasn't already.

Fixes: a3f8150eac6d ("net/ifcvf: add ifcvf vDPA driver")
Cc: stable@dpdk.org
Reported-by: Brandon Lo <blo@iol.unh.edu>
Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Acked-by: David Marchand <david.marchand@redhat.com>
4 years agosupport python 3 only
Louise Kilheeney [Wed, 30 Sep 2020 11:40:14 +0000 (12:40 +0100)]
support python 3 only

Changed scripts to explicitly use Python 3 only, to avoid
maintaining Python 2.
Removed deprecation notices.

Signed-off-by: Louise Kilheeney <louise.kilheeney@intel.com>
Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Robin Jarry <robin.jarry@6wind.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Ray Kinsella <mdr@ashroe.eu>
4 years agopipeline: fix build with glibc < 2.26
David Marchand [Fri, 2 Oct 2020 08:28:31 +0000 (10:28 +0200)]
pipeline: fix build with glibc < 2.26

reallocarray has been introduced in glibc 2.26 but we still support
glibc >= 2.7.
Simply replace with realloc, as the considered sizes are unlikely to
overflow.

"""
The reallocarray() function changes the size of the memory block
pointed to by ptr to be large enough for an array of nmemb elements,
each of which is size bytes.  It is equivalent to the call

       realloc(ptr, nmemb * size);

However, unlike that realloc() call, reallocarray() fails safely in
the case where the multiplication would overflow.  If such an over‐
flow occurs, reallocarray() returns NULL, sets errno to ENOMEM, and
leaves the original block of memory unchanged.
"""

Fixes: 3ca60ceed79a ("pipeline: add SWX pipeline specification file")

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
4 years agonet/virtio: introduce vhost-vDPA backend
Maxime Coquelin [Tue, 29 Sep 2020 16:14:04 +0000 (18:14 +0200)]
net/virtio: introduce vhost-vDPA backend

vhost-vDPA is a new virtio backend type introduced by vDPA kernel
framework, which provides abstraction to the vDPA devices and
exposes an unified control interface through a char dev.

This patch adds support to the vhost-vDPA backend. As similar to
the existing vhost kernel backend, a set of virtio_user ops were
introduced for vhost-vDPA backend to handle device specific operations
such as:
 - device setup
 - ioctl message handling
 - queue pair enabling
 - dma map/unmap
vDPA relevant ioctl codes and data structures are also defined in
this patch.

Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
4 years agonet/virtio: split virtio-user start
Maxime Coquelin [Tue, 29 Sep 2020 16:14:03 +0000 (18:14 +0200)]
net/virtio: split virtio-user start

Move feature bit settings in device start out as an standalone
function, so that feature bit could be negotiated at device
feature_ok status.

Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
4 years agonet/virtio: adapt virtio-user status size
Maxime Coquelin [Tue, 29 Sep 2020 16:14:02 +0000 (18:14 +0200)]
net/virtio: adapt virtio-user status size

Set proper payload size for set/get status message. The payload
size varies according to backend types.

Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Signed-off-by: Patrick Fu <patrick.fu@intel.com>
Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
4 years agonet/virtio: check protocol feature in user backend
Maxime Coquelin [Tue, 29 Sep 2020 16:14:01 +0000 (18:14 +0200)]
net/virtio: check protocol feature in user backend

When sending set status message, move protocol feature check
to vhost_user to be compatible with different backend types.

Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
4 years agonet/virtio: introduce vhost-vDPA backend type
Maxime Coquelin [Tue, 29 Sep 2020 16:14:00 +0000 (18:14 +0200)]
net/virtio: introduce vhost-vDPA backend type

Backend type is determined by checking char-device major numbers

Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Signed-off-by: Adrian Moreno <amorenoz@redhat.com>
Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
4 years agonet/virtio: move backend type selection to ethdev
Adrian Moreno [Tue, 29 Sep 2020 16:13:59 +0000 (18:13 +0200)]
net/virtio: move backend type selection to ethdev

This is a preparation patch with no functional change.

Use an enum instead of a boolean for the backend type.
Move the detection logic to the ethdev layer (where it is needed for the
first time).
The virtio_user_dev stores the backend type in the virtio_user_dev
struct so the type is only determined once

Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Signed-off-by: Adrian Moreno <amorenoz@redhat.com>
Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
4 years agonet/virtio: introduce DMA ops
Maxime Coquelin [Tue, 29 Sep 2020 16:13:58 +0000 (18:13 +0200)]
net/virtio: introduce DMA ops

Add DMA map/unmap callbacks to the virtio_user pmd, which could
be leveraged by vdev bus driver to map memory for backend
devices with DMA capability.

Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>