dpdk.git
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>
4 years agobus/vdev: add DMA mapping ops
Maxime Coquelin [Tue, 29 Sep 2020 16:13:57 +0000 (18:13 +0200)]
bus/vdev: add DMA mapping ops

Add DMA map/unmap operation callbacks to the vdev bus, which
could be used by DMA capable vdev drivers.

Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
4 years agovhost: remove dequeue zero-copy support
Maxime Coquelin [Mon, 28 Sep 2020 09:17:12 +0000 (11:17 +0200)]
vhost: remove dequeue zero-copy support

Dequeue zero-copy removal was announced in DPDK v20.08.
This feature brings constraints which makes the maintenance
of the Vhost library difficult. Its limitations makes it also
difficult to use by the applications (Tx vring starvation).

Removing it makes it easier to add new features, and also remove
some code in the hot path, which should bring a performance
improvement for the standard path.

Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
4 years agoexamples/vhost: remove dequeue zero-copy support
Maxime Coquelin [Mon, 28 Sep 2020 09:17:11 +0000 (11:17 +0200)]
examples/vhost: remove dequeue zero-copy support

Dequeue zero-copy feature is being removed from the
Vhost library. This preliminary patch removes its uses
in the Vhost example application.

Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
4 years agoexamples/vhost_crypto: use vhost async-copy flag
Maxime Coquelin [Mon, 28 Sep 2020 09:17:10 +0000 (11:17 +0200)]
examples/vhost_crypto: use vhost async-copy flag

The crypto backend uses RTE_VHOST_USER_DEQUEUE_ZERO_COPY only
for the shared areas to be populated at mmap time. It does
not use the other mechanisms the feature provides.

Now that RTE_VHOST_USER_DEQUEUE_ZERO_COPY is being removed,
let's use RTE_VHOST_USER_ASYNC_COPY instead which does the
same thing.

Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
4 years agonet/vhost: remove dequeue zero-copy support
Maxime Coquelin [Mon, 28 Sep 2020 09:17:09 +0000 (11:17 +0200)]
net/vhost: remove dequeue zero-copy support

The dequeue zero-copy feature from the Vhost library is
being removed in this release, this patch remove its support
in the Vhost PMD.

Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
4 years agonet/virtio: fix indirect descriptors in packed datapaths
Marvin Liu [Mon, 28 Sep 2020 08:20:52 +0000 (16:20 +0800)]
net/virtio: fix indirect descriptors in packed datapaths

Like split ring, packed ring will utilize indirect ring
elements when queuing mbufs need multiple descriptors.
Thus each packet will take only one slot when having
multiple segments.

Fixes: 892dc798fa9c ("net/virtio: implement Tx path for packed queues")
Cc: stable@dpdk.org
Signed-off-by: Marvin Liu <yong.liu@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
4 years agonet/virtio: fix packed ring indirect descricptors setup
Marvin Liu [Mon, 28 Sep 2020 08:20:51 +0000 (16:20 +0800)]
net/virtio: fix packed ring indirect descricptors setup

Add packed indirect descriptors format into virtio Tx
region. When initializing vring, packed indirect
descriptors will be initialized if ring type is packed.

Fixes: bc80357cd677 ("net/virtio: drop unused field in Tx region structure")
Cc: stable@dpdk.org
Signed-off-by: Marvin Liu <yong.liu@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
4 years agoexamples/vhost_blk: check driver start failure
Yunjian Wang [Fri, 25 Sep 2020 11:22:06 +0000 (19:22 +0800)]
examples/vhost_blk: check driver start failure

This checks the return value from the function
rte_vhost_driver_start.

Coverity issue: 362027
Fixes: c19beb3f38cd ("examples/vhost_blk: introduce vhost storage sample")
Cc: stable@dpdk.org
Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
4 years agonet/virtio: sync speed capability with ethdev
Ivan Dyukov [Tue, 22 Sep 2020 21:18:02 +0000 (00:18 +0300)]
net/virtio: sync speed capability with ethdev

ethdev library was updated with new speed 200G

Add 200G speed capa to virtio device

Signed-off-by: Ivan Dyukov <i.dyukov@samsung.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
4 years agonet/virtio: set default speed unknown
Ivan Dyukov [Tue, 22 Sep 2020 21:18:01 +0000 (00:18 +0300)]
net/virtio: set default speed unknown

rte_ethdev states new rule for NICs: they should return UNKNOWN
speed if speed is unknown and interface is up, in case of down
interface, NONE speed should be returned.

Signed-off-by: Ivan Dyukov <i.dyukov@samsung.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
4 years agovhost: promote vDPA API as stable
Maxime Coquelin [Tue, 15 Sep 2020 07:25:56 +0000 (09:25 +0200)]
vhost: promote vDPA API as stable

As announced in v20.08, this patch makes the vDPA
and related Vhost API stable.

Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
4 years agodoc: fix ethdev port id size
Chenbo Xia [Wed, 30 Sep 2020 04:23:28 +0000 (12:23 +0800)]
doc: fix ethdev port id size

The ethdev port id should be 16 bits now. This patch changes the
variable size of port id in docs from 8 bits to 16 bits.

Fixes: fdec9301f52d ("doc: add flow classify guides")
Fixes: 4a3ef59a10c8 ("examples/flow_filtering: add simple demo of flow API")
Cc: stable@dpdk.org
Signed-off-by: Chenbo Xia <chenbo.xia@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agoapp: fix ethdev port id size
Chenbo Xia [Wed, 30 Sep 2020 04:23:27 +0000 (12:23 +0800)]
app: fix ethdev port id size

The ethdev port id should be 16 bits now. This patch changes the
variable size of port id in applications from 8 bits to 16 bits.

Fixes: e977e4199a8d ("app/testpmd: add commands to load/unload BPF filters")
Fixes: 46cf97e4bbfa ("eventdev: add test for eth Tx adapter")
Cc: stable@dpdk.org
Signed-off-by: Chenbo Xia <chenbo.xia@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agodrivers/net: fix port id size
Chenbo Xia [Wed, 30 Sep 2020 04:23:26 +0000 (12:23 +0800)]
drivers/net: fix port id size

The ethdev port id should be 16 bits now. This patch changes the
variable size of port id in some net drivers from 8 bits to 16
bits.

Fixes: 09b23f8b9df6 ("net/bnxt: fix port stop process and cleanup resources")
Fixes: 769de16872ab ("net/bnxt: fix port default rule create/destroy")
Fixes: 50370662b727 ("net/ice: support device and queue ops")
Fixes: a50d7cbbdad7 ("net/qede: support registers dump")
Cc: stable@dpdk.org
Signed-off-by: Chenbo Xia <chenbo.xia@intel.com>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agonet/ring: advertise multi segment Tx and scatter Rx
Dumitru Ceara [Mon, 28 Sep 2020 18:47:29 +0000 (20:47 +0200)]
net/ring: advertise multi segment Tx and scatter Rx

Even though ring interfaces don't support any other TX/RX offloads they
do support sending multi segment packets and this should be advertised
in order to not break applications that use ring interfaces.

Also advertise scatter RX support.

Signed-off-by: Dumitru Ceara <dceara@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
4 years agonet/sfc: create virtual switch to enable VFs
Andrew Rybchenko [Thu, 24 Sep 2020 13:02:35 +0000 (14:02 +0100)]
net/sfc: create virtual switch to enable VFs

PF driver is responsible for vSwitch creation and vPorts allocation
for VFs.

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
4 years agonet/sfc: fix RSS hash offload if queue action is used
Igor Romanov [Thu, 24 Sep 2020 12:40:59 +0000 (13:40 +0100)]
net/sfc: fix RSS hash offload if queue action is used

When RSS hash offload is requested, the ingress filters that forward
packets to an RX queue must have an RSS context assigned to them to
calculate RSS hash, which was not always provided.

Fix it by creating a dummy RSS context that forwards packets
to the same queue and assign it to created by flow API filters when
RSS hash offload is enabled. RSS key and hash functions from
default RSS context are used.

Fixes: 5d308972954c ("ethdev: add mbuf RSS update as an offload")
Cc: stable@dpdk.org
Signed-off-by: Igor Romanov <igor.romanov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
4 years agonet/sfc: fix RSS hash flag when offload is disabled
Igor Romanov [Thu, 24 Sep 2020 12:40:58 +0000 (13:40 +0100)]
net/sfc: fix RSS hash flag when offload is disabled

Do not set RSS hash flag in the received mbufs when RSS hash
offload is not enabled, which means that RSS hash value is invalid.

Fixes: 5d308972954c ("ethdev: add mbuf RSS update as an offload")
Cc: stable@dpdk.org
Signed-off-by: Igor Romanov <igor.romanov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
4 years agoapp/testpmd: extend ICMP flow matching fields
Li Zhang [Wed, 9 Sep 2020 03:34:34 +0000 (06:34 +0300)]
app/testpmd: extend ICMP flow matching fields

Ability to distinguish ICMP identifier fields in packets.
Distinguish ICMP sequence number field too.
Already supports ICMP code and type fields in current version.
Existing fields in ICMP header contain the required information.
ICMP header already is supported and no code change in RTE FLOW.
Extend testpmd CLI to include the fields of ident and sequence number.
One example:
flow create 0 ingress pattern eth / ipv4 /
 icmp code is 1 ident is 5 seq is 6 /
 end actions count / queue index 0 / end
The ICMP packet with code 1, identifier 5 and
sequence number 6 will be matched.
It will implement action counter and forward to queue 0.

Signed-off-by: Li Zhang <lizh@nvidia.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agonet/af_xdp: enable custom XDP program loading
Ciara Loftus [Fri, 25 Sep 2020 09:20:21 +0000 (09:20 +0000)]
net/af_xdp: enable custom XDP program loading

The new 'xdp_prog=<string>' vdev arg allows the user to specify the path to
a custom XDP program to be set on the device, instead of the default libbpf
one. The program must have an XSK_MAP of name 'xsks_map' which will allow
for the redirection of some packets to userspace and thus the PMD, using
some criteria defined in the program. This can be useful for filtering
purposes, for example if we only want a subset of packets to reach
userspace or to drop or process a subset of packets in the kernel.

Note: a netdev may only load one program.

Signed-off-by: Ciara Loftus <ciara.loftus@intel.com>
Tested-by: Xuekun Hu <xuekun.hu@intel.com>
4 years agonet/mlx5: relax atomic refcnt for multi-packet Rx buffer
Phil Yang [Thu, 3 Sep 2020 02:53:10 +0000 (10:53 +0800)]
net/mlx5: relax atomic refcnt for multi-packet Rx buffer

Use C11 atomics with RELAXED ordering instead of the rte_atomic ops
which enforce unnecessary barriers on aarch64.

Signed-off-by: Phil Yang <phil.yang@arm.com>
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
Acked-by: Alexander Kozyrev <akozyrev@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
4 years agonet/qede: fix dereference before null check
Yunjian Wang [Mon, 24 Aug 2020 11:46:53 +0000 (19:46 +0800)]
net/qede: fix dereference before null check

Coverity flags that 'fp->sb_info' variable is used before
it's checked for NULL. This patch fixes this issue.

Coverity issue: 260413
Fixes: 4c4bdadfa9e7 ("net/qede: refactoring multi-queue implementation")
Cc: stable@dpdk.org
Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agonet/octeontx2: move ESP parsing to LE layer
Kiran Kumar K [Thu, 27 Aug 2020 11:40:41 +0000 (17:10 +0530)]
net/octeontx2: move ESP parsing to LE layer

Add support to parse NAT-T-ESP by moving the ESP parsing
to LE.

Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
4 years agoapp/testpmd: align behaviour of multi-port detach
Thomas Monjalon [Mon, 28 Sep 2020 23:14:34 +0000 (01:14 +0200)]
app/testpmd: align behaviour of multi-port detach

A port can be closed in multiple situations:
- close command calling close_port() -> rte_eth_dev_close()
- exit calling close_port() -> rte_eth_dev_close()
- hotplug calling close_port() -> rte_eth_dev_close()
- hotplug calling detach_device() -> rte_dev_remove()
- port detach command, detach_device() -> rte_dev_remove()
- device detach command, detach_devargs() -> rte_eal_hotplug_remove()

The flow rules are flushed before each close.
It was already done in close_port(), detach_devargs() and
detach_port_device() which calls detach_device(),
but not in detach_device(). As a consequence, it was missing for siblings
of port detach command and unplugged device.
The check before calling port_flow_flush() is moved inside the function.

The state of the port to close is checked to be stopped.
As above, this check was missing in detach_device(),
impacting the cases of a multi-port device unplugged or detached
with the port detach command.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agoapp/testpmd: reset port status on close notification
Thomas Monjalon [Mon, 28 Sep 2020 23:14:33 +0000 (01:14 +0200)]
app/testpmd: reset port status on close notification

Since rte_eth_dev_release_port() is called on all port close operations,
the event RTE_ETH_EVENT_DESTROY can be reliably used for resetting
the port status on the application side.

The intermediate state RTE_PORT_HANDLING is removed in close_port()
because a port can also be closed by a PMD in a device remove operation.

In case multiple ports are closed, calling remove_invalid_ports()
only once is enough.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agodrivers/net: remove redundant MAC addresses freeing
Thomas Monjalon [Mon, 28 Sep 2020 23:14:32 +0000 (01:14 +0200)]
drivers/net: remove redundant MAC addresses freeing

The MAC addresses array is already freed by rte_eth_dev_release_port().
The redundant freeing can be removed from the PMD port closing functions.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agodrivers/net: check process type in close operation
Thomas Monjalon [Mon, 28 Sep 2020 23:14:31 +0000 (01:14 +0200)]
drivers/net: check process type in close operation

The secondary processes are not allowed to release shared resources.
Only process-private resources should be freed in a secondary process.
Most of the time, there is no process-private resource,
so the close operation is just forbidden in a secondary process.

After adding proper check in the port close functions,
some redundant checks in the device remove functions are dropped.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: Rosen Xu <rosen.xu@intel.com>
Reviewed-by: Sachin Saxena <sachin.saxena@oss.nxp.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Liron Himi <lironh@marvell.com>
Reviewed-by: Haiyue Wang <haiyue.wang@intel.com>
Acked-by: Jeff Guo <jia.guo@intel.com>
Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agodrivers/net: accept removing device without any port
Thomas Monjalon [Mon, 28 Sep 2020 23:14:30 +0000 (01:14 +0200)]
drivers/net: accept removing device without any port

The ports can be closed (i.e. completely released)
before removing the whole device.
Such case was wrongly considered an error by some drivers.

If the device supports only one port, there is nothing much
to free after the port is closed.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
Reviewed-by: Rosen Xu <rosen.xu@intel.com>
Reviewed-by: Sachin Saxena <sachin.saxena@oss.nxp.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agoethdev: remove old close behaviour
Thomas Monjalon [Mon, 28 Sep 2020 23:14:29 +0000 (01:14 +0200)]
ethdev: remove old close behaviour

The temporary flag RTE_ETH_DEV_CLOSE_REMOVE is removed.
It was introduced in DPDK 18.11 in order to give time for PMDs to migrate.

The old behaviour was to free only queues when closing a port.
The new behaviour is calling rte_eth_dev_release_port() which does
three more tasks:
- trigger event callback
- reset state and few pointers
- free all generic port resources

The private port resources must be released in the .dev_close callback.

The .remove callback should:
- call .dev_close callback
- call rte_eth_dev_release_port()
- free multi-port device shared resources

Despite waiting two years, some drivers have not migrated,
so they may hit issues with the incompatible new behaviour.
After sending emails, adding logs, and announcing the deprecation,
the only last solution is to declare these drivers as unmaintained:
ionic, liquidio, nfp
Below is a summary of what to implement in those drivers.

* The freeing of private port resources must be moved
from the ".remove(device)" function to the ".dev_close(port)" function.

* If a generic resource (.mac_addrs or .hash_mac_addrs) cannot be freed,
it must be set to NULL in ".dev_close" function to protect from
subsequent rte_eth_dev_release_port() freeing.

* Note 1:
The generic resources are freed in rte_eth_dev_release_port(),
after ".dev_close" is called in rte_eth_dev_close(), but not when
calling ".dev_close" directly from the ".remove" PMD function.
That's why rte_eth_dev_release_port() must still be called explicitly
from ".remove(device)" after calling the ".dev_close" PMD function.

* Note 2:
If a device can have multiple ports, the common resources must be freed
only in the ".remove(device)" function.

* Note 3:
The port is supposed to be in a stopped state when it is closed.
If it is not the case, it is free to the PMD implementation
how to react when trying to close a non-stopped port:
either try to stop it automatically or just return an error.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: Liron Himi <lironh@marvell.com>
Reviewed-by: Haiyue Wang <haiyue.wang@intel.com>
Acked-by: Jeff Guo <jia.guo@intel.com>
Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agonet/tap: release port upon close
Yunjian Wang [Mon, 28 Sep 2020 23:14:28 +0000 (01:14 +0200)]
net/tap: release port upon close

The flag RTE_ETH_DEV_CLOSE_REMOVE is set so all port resources
can be freed by rte_eth_dev_close().

Freeing of private port resources is moved
from the ".remove(device)" to the ".dev_close(port)" operation.

Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agonet/softnic: release port upon close
Thomas Monjalon [Mon, 28 Sep 2020 23:14:27 +0000 (01:14 +0200)]
net/softnic: release port upon close

The flag RTE_ETH_DEV_CLOSE_REMOVE is set so all port resources
can be freed by rte_eth_dev_close().

Freeing of private port resources is moved
from the ".remove(device)" to the ".dev_close(port)" operation.

Nothing is closed in a secondary process.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agonet/ring: release port upon close
Thomas Monjalon [Mon, 28 Sep 2020 23:14:26 +0000 (01:14 +0200)]
net/ring: release port upon close

The flag RTE_ETH_DEV_CLOSE_REMOVE is set so all port resources
can be freed by rte_eth_dev_close().

Freeing of private port resources is moved
from the ".remove(device)" to the ".dev_close(port)" operation.

Nothing is closed in a secondary process.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agonet/qede: release port upon close
Rasesh Mody [Mon, 28 Sep 2020 23:14:25 +0000 (01:14 +0200)]
net/qede: release port upon close

Set RTE_ETH_DEV_CLOSE_REMOVE upon probe so all the private resources
for the port can be freed by rte_eth_dev_close(). With this change the
private port resources are released in the .dev_close callback.

Signed-off-by: Rasesh Mody <rmody@marvell.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agonet/pfe: release port upon close
Sachin Saxena [Mon, 28 Sep 2020 23:14:24 +0000 (01:14 +0200)]
net/pfe: release port upon close

With removal of old close behavior, the private
port resources must be released in the .dev_close callback.
Freeing of port private resources is moved from
the ".remove(device)" to the ".dev_close(port)" operation

Signed-off-by: Sachin Saxena <sachin.saxena@oss.nxp.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agonet/pcap: release port upon close
Thomas Monjalon [Mon, 28 Sep 2020 23:14:23 +0000 (01:14 +0200)]
net/pcap: release port upon close

The flag RTE_ETH_DEV_CLOSE_REMOVE is set so all port resources
can be freed by rte_eth_dev_close().

Freeing of private port resources is moved
from the ".remove(device)" to the ".dev_close(port)" operation.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agonet/octeontx: release port upon close
Thomas Monjalon [Mon, 28 Sep 2020 23:14:22 +0000 (01:14 +0200)]
net/octeontx: release port upon close

The flag RTE_ETH_DEV_CLOSE_REMOVE is set so all port resources
can be freed by rte_eth_dev_close().

The callback ".dev_close(port)" is called also
from the ".remove(device)" operation.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agonet/null: release port upon close
Thomas Monjalon [Mon, 28 Sep 2020 23:14:21 +0000 (01:14 +0200)]
net/null: release port upon close

The flag RTE_ETH_DEV_CLOSE_REMOVE is set so all port resources
can be freed by rte_eth_dev_close().

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agonet/mlx4: release port upon close
Thomas Monjalon [Mon, 28 Sep 2020 23:14:20 +0000 (01:14 +0200)]
net/mlx4: release port upon close

The flag RTE_ETH_DEV_CLOSE_REMOVE is set so all port resources
can be freed by rte_eth_dev_close().

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agonet/failsafe: release port upon close
Thomas Monjalon [Mon, 28 Sep 2020 23:14:19 +0000 (01:14 +0200)]
net/failsafe: release port upon close

The flag RTE_ETH_DEV_CLOSE_REMOVE is set so all port resources
can be freed by rte_eth_dev_close().

Freeing of private port resources is moved
from the ".remove(device)" to the ".dev_close(port)" operation.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agonet/enetc: release port upon close
Sachin Saxena [Mon, 28 Sep 2020 23:14:18 +0000 (01:14 +0200)]
net/enetc: release port upon close

With removal of old close behavior, the private
port resources must be released in the .dev_close callback.
Freeing of port private resources is moved from
the ".remove(device)" to the ".dev_close(port)" operation

Signed-off-by: Sachin Saxena <sachin.saxena@oss.nxp.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agonet/dpaa2: release port upon close
Sachin Saxena [Mon, 28 Sep 2020 23:14:17 +0000 (01:14 +0200)]
net/dpaa2: release port upon close

With removal of old close behavior, the private
port resources must be released in the .dev_close callback.
Freeing of port private resources is moved from
the ".remove(device)" to the ".dev_close(port)" operation

Signed-off-by: Sachin Saxena <sachin.saxena@oss.nxp.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agonet/dpaa: release port upon close
Sachin Saxena [Mon, 28 Sep 2020 23:14:16 +0000 (01:14 +0200)]
net/dpaa: release port upon close

With removal of old close behavior, the private
port resources must be released in the .dev_close callback.
Freeing of port private resources is moved from
the ".remove(device)" to the ".dev_close(port)" operation

Signed-off-by: Sachin Saxena <sachin.saxena@oss.nxp.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agonet/bonding: release port upon close
Thomas Monjalon [Mon, 28 Sep 2020 23:14:15 +0000 (01:14 +0200)]
net/bonding: release port upon close

The flag RTE_ETH_DEV_CLOSE_REMOVE is set so all port resources
can be freed by rte_eth_dev_close().

Freeing of private port resources is moved
from the ".remove(device)" to the ".dev_close(port)" operation.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agonet/bnx2x: release port upon close
Rasesh Mody [Mon, 28 Sep 2020 23:14:14 +0000 (01:14 +0200)]
net/bnx2x: release port upon close

Set RTE_ETH_DEV_CLOSE_REMOVE upon probe so all the private resources
for the port can be freed by rte_eth_dev_close(). With this change the
private port resources are released in the .dev_close callback.

Signed-off-by: Rasesh Mody <rmody@marvell.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agonet/axgbe: release port upon close
Thomas Monjalon [Mon, 28 Sep 2020 23:14:13 +0000 (01:14 +0200)]
net/axgbe: release port upon close

The flag RTE_ETH_DEV_CLOSE_REMOVE is set so all port resources
can be freed by rte_eth_dev_close().

Freeing of private port resources is moved
from the ".remove(device)" to the ".dev_close(port)" operation.
The ".dev_close" callback is also called as part of the ".remove" one.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agonet/atlantic: release port upon close
Thomas Monjalon [Mon, 28 Sep 2020 23:14:12 +0000 (01:14 +0200)]
net/atlantic: release port upon close

The flag RTE_ETH_DEV_CLOSE_REMOVE is set so all port resources
can be freed by rte_eth_dev_close().

Freeing of private port resources is moved
from the ".remove(device)" to the ".dev_close(port)" operation.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Igor Russkikh <irusskikh@marvell.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agonet/af_packet: release port upon close
Thomas Monjalon [Mon, 28 Sep 2020 23:14:11 +0000 (01:14 +0200)]
net/af_packet: release port upon close

The flag RTE_ETH_DEV_CLOSE_REMOVE is set so all port resources
can be freed by rte_eth_dev_close().

Freeing of private port resources is moved
from the ".remove(device)" to the ".dev_close(port)" operation.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agoethdev: allow drivers to return error on close
Thomas Monjalon [Mon, 28 Sep 2020 23:14:10 +0000 (01:14 +0200)]
ethdev: allow drivers to return error on close

The device operation .dev_close was returning void.
This driver interface is changed to return an int.

Note that the API rte_eth_dev_close() is still returning void,
although a deprecation notice is pending to change it as well.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: Rosen Xu <rosen.xu@intel.com>
Reviewed-by: Sachin Saxena <sachin.saxena@oss.nxp.com>
Reviewed-by: Liron Himi <lironh@marvell.com>
Reviewed-by: Haiyue Wang <haiyue.wang@intel.com>
Acked-by: Jeff Guo <jia.guo@intel.com>
Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agoethdev: reset device and interrupt pointers on release
Thomas Monjalon [Mon, 28 Sep 2020 23:14:09 +0000 (01:14 +0200)]
ethdev: reset device and interrupt pointers on release

The pointers .device and .intr_handle were already reset by the helper
rte_eth_dev_pci_generic_remove().
It is now made part of rte_eth_dev_release_port().

It makes rte_eth_dev_pci_release() meaningless,
so it is replaced with a call to rte_eth_dev_release_port().

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agoapp/testpmd: fix displaying Rx/Tx queues information
Huisong Li [Fri, 25 Sep 2020 12:47:19 +0000 (20:47 +0800)]
app/testpmd: fix displaying Rx/Tx queues information

Currently, the information of Rx/Tx queues from PMD driver is not
displayed exactly in the rxtx_config_display function. Because
"ports[pid].rx_conf" and "ports[pid].tx_conf" maintained in testpmd
application may be not the value actually used by PMD driver. For
instance, user does not set a field, but PMD driver has to use the
default value.

This patch fixes rxtx_config_display so that the information of Rx/Tx
queues can be really displayed for the PMD driver that implement
.rxq_info_get and .txq_info_get ops callback function.

Fixes: 75c530c1bd53 ("app/testpmd: fix port configuration print")
Fixes: d44f8a485f5d ("app/testpmd: enable per queue configure")
Cc: stable@dpdk.org
Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agoapp/testpmd: fix descriptor id check
Chengchang Tang [Fri, 25 Sep 2020 12:47:18 +0000 (20:47 +0800)]
app/testpmd: fix descriptor id check

The number of desc is a per queue configuration. But in the check
function, nb_txd & nb_rxd are used to check whether the desc_id is
valid. nb_txd & nb_rxd are the global configuration of number of desc.
If the queue configuration is changed by cmdline liks: "port config xx
txq xx ring_size xxx", the real value will be changed.

This patch use the real value to check whether the desc_id is valid.
And if these are not configured by user. It will use the default value
to check it, since the rte_eth_rx_queue_setup & rte_eth_tx_queue_setup
will use a default value to configure the queue if nb_rx_desc or
nb_tx_desc is zero.

Fixes: af75078fece3 ("first public release")
Cc: stable@dpdk.org
Signed-off-by: Chengchang Tang <tangchengchang@huawei.com>
Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agoapp/testpmd: fix packet header in txonly mode
Chengchang Tang [Fri, 25 Sep 2020 12:47:17 +0000 (20:47 +0800)]
app/testpmd: fix packet header in txonly mode

In txonly forward mode, the packet header is fixed by the initial
setting, including the packet length and checksum. So when the packets
varies, this may cause a packet header error. Currently, there are two
methods in txonly mode to randomly change the packets.
1. Set txsplit random and txpkts (x[,y]*), the number of segments
   each packets will be a random value between 1 and total number of
   segments determined by txpkts settings.
   The step as follows:
     a) ./testpmd -w xxx -l xx -n 4 -- -i --disable-device-start
     b) port config 0 tx_offload multi_segs on
     c) set fwd txonly
     d) set txsplit rand
     e) set txpkts 2048,2048,2048,2048
     f) start
The nb_segs of the packets sent by testpmd will be 1~4. The real packet
length will be 2048, 4096, 6144 and 8192. But in fact the packet length
in ip header and udp header will be fixed by 8178 and 8158.

2. Set txonly-multi-flow. the ip address will be varied to generate
   multiple flow.
   The step as follows:
     a) ./testpmd -w xxx -l xx -n 4 -- -i --txonly-multi-flow
     b) set fwd txonly
     c) start
The ip address of each pkts will change randomly, but since the header
is fixed, the checksum may be a error value.

Therefore, this patch adds a function to update the packet length and
check sum in the pkts header when the txsplit mode is set to rand or
multi-flow is set.

Fixes: 82010ef55e7c ("app/testpmd: make txonly mode generate multiple flows")
Fixes: 79bec05b32b7 ("app/testpmd: add ability to split outgoing packets")
Cc: stable@dpdk.org
Signed-off-by: Chengchang Tang <tangchengchang@huawei.com>
Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agoapp/testpmd: remove restriction on Tx segments set
Chengchang Tang [Fri, 25 Sep 2020 12:47:16 +0000 (20:47 +0800)]
app/testpmd: remove restriction on Tx segments set

Currently, if nb_txd is not set, the txpkts is not allowed to be set
because the nb_txd is used to avoid the number of segments exceed the Tx
ring size and the default value of nb_txd is 0. And there is a bug that
nb_txd is the global configuration for Tx ring size and the ring size
could be changed by some command per queue. So these valid check is
unreliable and introduced unnecessary constraints.

This patch adds a valid check function to use the real Tx ring size to
check the validity of txpkts.

Fixes: af75078fece3 ("first public release")
Cc: stable@dpdk.org
Signed-off-by: Chengchang Tang <tangchengchang@huawei.com>
Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agoapp/testpmd: fix VLAN configuration on failure
Chengchang Tang [Fri, 25 Sep 2020 12:47:15 +0000 (20:47 +0800)]
app/testpmd: fix VLAN configuration on failure

When failing to configure VLAN offloads after the port was started, there
is no need to update the port configuration. Currently, when user
configure an unsupported VLAN offloads and fails, and then restart the
port, it will fails since the configuration has been refreshed.

This patch makes the function return directly instead of refreshing the
configuration when execution fails.

Fixes: 384161e00627 ("app/testpmd: adjust on the fly VLAN configuration")
Cc: stable@dpdk.org
Signed-off-by: Chengchang Tang <tangchengchang@huawei.com>
Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agoapp/testpmd: fix port id check in Tx VLAN command
Chengchang Tang [Fri, 25 Sep 2020 12:47:14 +0000 (20:47 +0800)]
app/testpmd: fix port id check in Tx VLAN command

To set Tx vlan offloads, it is required to stop port firstly. But before
checking whether the port is stopped, the port id entered by the user
is not checked for validity. When the port id is illegal, it would lead
to a segmentation fault since it attempts to access a member of
non-existent port.

This patch adds verification of port id in tx vlan offloads and remove
duplicated check.

Fixes: 597f9fafe13b ("app/testpmd: convert to new Tx offloads API")
Cc: stable@dpdk.org
Signed-off-by: Chengchang Tang <tangchengchang@huawei.com>
Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>