dpdk.git
4 years agotest/crypto: add AES-GCM J0 case
Arek Kusztal [Fri, 13 Mar 2020 18:07:51 +0000 (19:07 +0100)]
test/crypto: add AES-GCM J0 case

This patch adds crypto J0 test case to AES-GCM

Signed-off-by: Arek Kusztal <arkadiuszx.kusztal@intel.com>
Acked-by: Fiona Trahe <fiona.trahe@intel.com>
4 years agocrypto/qat: support AES-GCM J0
Arek Kusztal [Fri, 13 Mar 2020 18:07:50 +0000 (19:07 +0100)]
crypto/qat: support AES-GCM J0

This patch adds J0 capability to Intel QuickAssist Technology driver

Signed-off-by: Arek Kusztal <arkadiuszx.kusztal@intel.com>
Acked-by: Fiona Trahe <fiona.trahe@intel.com>
4 years agotest/ipsec: fix crash in session destroy
Ruifeng Wang [Fri, 20 Mar 2020 08:05:20 +0000 (16:05 +0800)]
test/ipsec: fix crash in session destroy

Segfault was observed when running ipsec unit test:

 + TestCase [10] : test_ipsec_replay_inb_repeat_null_null_wrapper
                   succeeded
 + TestCase [11] : test_ipsec_replay_inb_inside_burst_null_null_wrapper
                   succeeded
 + TestCase [12] : test_ipsec_crypto_inb_burst_2sa_null_null_wrapper
                   succeeded
 + TestCase [13] : test_ipsec_crypto_inb_burst_2sa_4grp_null_null_wrapper
                   succeeded
Segmentation fault

Data corruption happens due to incorrect destroy of session. Security
session needs process different from crypto session.

Destroy corresponding sessions according to different security actions.

Fixes: 05fe65eb66b2 ("test/ipsec: introduce functional test")
Cc: stable@dpdk.org
Signed-off-by: Ruifeng Wang <ruifeng.wang@arm.com>
Reviewed-by: Phil Yang <phil.yang@arm.com>
Reviewed-by: Gavin Hu <gavin.hu@arm.com>
Tested-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
4 years agocommon/qat: optimise calculation of cookie index
Fiona Trahe [Wed, 11 Mar 2020 12:26:08 +0000 (13:26 +0100)]
common/qat: optimise calculation of cookie index

Avoid costly division, use shift instead.

Signed-off-by: Fiona Trahe <fiona.trahe@intel.com>
Acked-by: Arek Kusztal <arkadiuszx.kusztal@intel.com>
4 years agocrypto/qat: optimise check for chained mbufs
Fiona Trahe [Wed, 11 Mar 2020 12:26:07 +0000 (13:26 +0100)]
crypto/qat: optimise check for chained mbufs

To detect if sgl, use nb_segs > 1, instead of checking for next pointer,
as nb_segs is in first cache-line while next is in second cache-line.

Signed-off-by: Fiona Trahe <fiona.trahe@intel.com>
Acked-by: Arek Kusztal <arkadiuszx.kusztal@intel.com>
4 years agocrypto/qat: improve out-of-place conditional check
Fiona Trahe [Wed, 11 Mar 2020 12:26:06 +0000 (13:26 +0100)]
crypto/qat: improve out-of-place conditional check

Improve case where application set m_dst to same as m_src
so really an in-place operation, though would have been treated
as out-of-place. No functional change but this path can now benefit
from DMA alignment.

Signed-off-by: Fiona Trahe <fiona.trahe@intel.com>
Acked-by: Arek Kusztal <arkadiuszx.kusztal@intel.com>
4 years agocompressdev: remove unused function pointer prototype
Artur Trybula [Fri, 6 Mar 2020 11:16:35 +0000 (12:16 +0100)]
compressdev: remove unused function pointer prototype

This commit removes unused prototype of the function pointer
compressdev_queue_pair_count_t.

Signed-off-by: Artur Trybula <arturx.trybula@intel.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
4 years agocryptodev: remove unused operation for queue count
Artur Trybula [Fri, 6 Mar 2020 11:16:33 +0000 (12:16 +0100)]
cryptodev: remove unused operation for queue count

This commit removes unused function pointer (queue_pair_count)
from struct rte_cryptodev_ops. Related functions removed as well.

Signed-off-by: Artur Trybula <arturx.trybula@intel.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Acked-by: Fiona Trahe <fiona.trahe@intel.com>
Acked-by: Anoob Joseph <anoobj@marvell.com>
4 years agocommon/qat: fix GEN3 marketing name
Adam Dybkowski [Wed, 4 Mar 2020 13:18:35 +0000 (14:18 +0100)]
common/qat: fix GEN3 marketing name

This patch fixes the marketing name of the QAT GEN3 to P5xxx.
Updates this name mentioned in the compression PMD as well as
in the documentation.

Fixes: aa983f03ad2e ("crypto/qat: handle Single Pass Crypto Requests on GEN3")
Fixes: a124830a6f00 ("compress/qat: enable dynamic huffman encoding")
Fixes: 1f5e4053f9b4 ("common/qat: support GEN3 devices")
Cc: stable@dpdk.org
Signed-off-by: Adam Dybkowski <adamx.dybkowski@intel.com>
Acked-by: Fiona Trahe <fiona.trahe@intel.com>
4 years agocryptodev: fix missing device id range checking
Adam Dybkowski [Thu, 20 Feb 2020 15:04:15 +0000 (16:04 +0100)]
cryptodev: fix missing device id range checking

This patch adds range-checking of the device id passed from
the user app code. It prevents out-of-range array accesses
which in some situations resulted in an
application crash (segfault).

Fixes: 3dd4435cf473 ("cryptodev: fix checks related to device id")
Cc: stable@dpdk.org
Signed-off-by: Adam Dybkowski <adamx.dybkowski@intel.com>
Acked-by: Fiona Trahe <fiona.trahe@intel.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
4 years agotest/crypto: add AES-256 DOCSIS test vectors
Mairtin o Loingsigh [Wed, 26 Feb 2020 09:04:11 +0000 (09:04 +0000)]
test/crypto: add AES-256 DOCSIS test vectors

This patch adds test vectors for AES-256 and sets QAT as the
target PMD.

Signed-off-by: Mairtin o Loingsigh <mairtin.oloingsigh@intel.com>
Acked-by: Fiona Trahe <fiona.trahe@intel.com>
4 years agocrypto/qat: support DOCSIS AES-256
Mairtin o Loingsigh [Wed, 26 Feb 2020 09:04:10 +0000 (09:04 +0000)]
crypto/qat: support DOCSIS AES-256

This patch adds support for DOCSIS AES-256 when using qat

Signed-off-by: Mairtin o Loingsigh <mairtin.oloingsigh@intel.com>
Acked-by: Fiona Trahe <fiona.trahe@intel.com>
4 years agoexamples/ipsec-secgw: reserve crypto queues in event mode
Lukasz Bartosik [Thu, 27 Feb 2020 16:18:37 +0000 (17:18 +0100)]
examples/ipsec-secgw: reserve crypto queues in event mode

Reserve minimum number of crypto queues equal to number of ports.
This is to fulfill inline protocol offload requirements.

Signed-off-by: Anoob Joseph <anoobj@marvell.com>
Signed-off-by: Lukasz Bartosik <lbartosik@marvell.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
4 years agodoc: add event mode to ipsec-secgw
Lukasz Bartosik [Thu, 27 Feb 2020 16:18:36 +0000 (17:18 +0100)]
doc: add event mode to ipsec-secgw

Document addition of event mode support
to ipsec-secgw application.

Signed-off-by: Anoob Joseph <anoobj@marvell.com>
Signed-off-by: Lukasz Bartosik <lbartosik@marvell.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
4 years agoexamples/ipsec-secgw: make number of buffers dynamic
Lukasz Bartosik [Thu, 27 Feb 2020 16:18:35 +0000 (17:18 +0100)]
examples/ipsec-secgw: make number of buffers dynamic

Make number of buffers in a pool nb_mbuf_in_pool dependent on number
of ports, cores and crypto queues. Add command line option -s which
when used overrides dynamic calculation of number of buffers in a pool.

Signed-off-by: Anoob Joseph <anoobj@marvell.com>
Signed-off-by: Lukasz Bartosik <lbartosik@marvell.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
4 years agoexamples/ipsec-secgw: add app mode worker
Lukasz Bartosik [Thu, 27 Feb 2020 16:18:34 +0000 (17:18 +0100)]
examples/ipsec-secgw: add app mode worker

Add application inbound/outbound worker thread and
IPsec application processing code for event mode.

Example ipsec-secgw command in app mode:
ipsec-secgw -w 0002:02:00.0,ipsec_in_max_spi=128
-w 0002:03:00.0,ipsec_in_max_spi=128 -w 0002:0e:00.0 -w 0002:10:00.1
--log-level=8 -c 0x1 -- -P -p 0x3 -u 0x1 -f aes-gcm.cfg
--transfer-mode event --event-schedule-type parallel

Signed-off-by: Anoob Joseph <anoobj@marvell.com>
Signed-off-by: Ankur Dwivedi <adwivedi@marvell.com>
Signed-off-by: Lukasz Bartosik <lbartosik@marvell.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
4 years agoexamples/ipsec-secgw: add driver mode worker
Lukasz Bartosik [Thu, 27 Feb 2020 16:18:33 +0000 (17:18 +0100)]
examples/ipsec-secgw: add driver mode worker

Add driver inbound and outbound worker thread for ipsec-secgw. In driver
mode application does as little as possible. It simply forwards packets
back to port from which traffic was received instructing HW to apply
inline security processing using first outbound SA configured for
a given port. If a port does not have SA configured outbound traffic
on that port will be silently dropped. The aim of this mode is to
measure HW capabilities. Driver mode is selected with single-sa option.
The single-sa option accepts SA index however in event mode the SA
index is ignored.

Example command to run ipsec-secgw in driver mode:
ipsec-secgw -w 0002:02:00.0,ipsec_in_max_spi=128
-w 0002:03:00.0,ipsec_in_max_spi=128 -w 0002:0e:00.0 -w 0002:10:00.1
--log-level=8 -c 0x1 -- -P -p 0x3 -u 0x1 -f aes-gcm.cfg
--transfer-mode event --event-schedule-type parallel --single-sa 0

Signed-off-by: Anoob Joseph <anoobj@marvell.com>
Signed-off-by: Ankur Dwivedi <adwivedi@marvell.com>
Signed-off-by: Lukasz Bartosik <lbartosik@marvell.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
4 years agoexamples/ipsec-secgw: add event mode
Lukasz Bartosik [Thu, 27 Feb 2020 16:18:32 +0000 (17:18 +0100)]
examples/ipsec-secgw: add event mode

Add eventmode support to ipsec-secgw. With the aid of event helper
configure and use the eventmode capabilities.

Signed-off-by: Anoob Joseph <anoobj@marvell.com>
Signed-off-by: Lukasz Bartosik <lbartosik@marvell.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
4 years agoexamples/ipsec-secgw: add event helper config init/uninit
Lukasz Bartosik [Thu, 27 Feb 2020 16:18:31 +0000 (17:18 +0100)]
examples/ipsec-secgw: add event helper config init/uninit

Add eventmode helper eh_conf_init and eh_conf_uninit
functions which purpose is to initialize and
uninitialize eventmode helper configuration.

Signed-off-by: Anoob Joseph <anoobj@marvell.com>
Signed-off-by: Lukasz Bartosik <lbartosik@marvell.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
4 years agoexamples/ipsec-secgw: support internal ports for events
Lukasz Bartosik [Thu, 27 Feb 2020 16:18:30 +0000 (17:18 +0100)]
examples/ipsec-secgw: support internal ports for events

Add support for Rx and Tx internal ports. When internal ports are
available then a packet can be received from eth port and forwarded
to event queue by HW without any software intervention. The same
applies to Tx side where a packet sent to an event queue can by
forwarded by HW to eth port without any software intervention.

Signed-off-by: Anoob Joseph <anoobj@marvell.com>
Signed-off-by: Lukasz Bartosik <lbartosik@marvell.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
4 years agoexamples/ipsec-secgw: add event worker launch
Lukasz Bartosik [Thu, 27 Feb 2020 16:18:29 +0000 (17:18 +0100)]
examples/ipsec-secgw: add event worker launch

In eventmode workers can be drafted differently according to the
capabilities of the underlying event device. The added functions will
receive an array of such workers and probe the eventmode properties to
choose the worker.

Signed-off-by: Anoob Joseph <anoobj@marvell.com>
Signed-off-by: Lukasz Bartosik <lbartosik@marvell.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
4 years agoexamples/ipsec-secgw: add event config display
Anoob Joseph [Thu, 27 Feb 2020 16:18:28 +0000 (17:18 +0100)]
examples/ipsec-secgw: add event config display

Add routines to display the eventmode configuration and provide
an overview of the devices used.

Signed-off-by: Anoob Joseph <anoobj@marvell.com>
Signed-off-by: Lukasz Bartosik <lbartosik@marvell.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
4 years agoexamples/ipsec-secgw: support event Tx adapter
Anoob Joseph [Thu, 27 Feb 2020 16:18:27 +0000 (17:18 +0100)]
examples/ipsec-secgw: support event Tx adapter

Add Tx adapter support. The event helper init routine will initialize
the Tx adapter according to the configuration. If Tx adapter config
is not present it will generate a default config.

Signed-off-by: Anoob Joseph <anoobj@marvell.com>
Signed-off-by: Lukasz Bartosik <lbartosik@marvell.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
4 years agoexamples/ipsec-secgw: support event Rx adapter
Anoob Joseph [Thu, 27 Feb 2020 16:18:26 +0000 (17:18 +0100)]
examples/ipsec-secgw: support event Rx adapter

Add Rx adapter support. The event helper init routine will initialize
the Rx adapter according to the configuration. If Rx adapter config
is not present it will generate a default config. If there are enough
event queues available it will map eth ports and event queues 1:1
(one eth port will be connected to one event queue). Otherwise it
will map all eth ports to one event queue.

Signed-off-by: Anoob Joseph <anoobj@marvell.com>
Signed-off-by: Lukasz Bartosik <lbartosik@marvell.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
4 years agoexamples/ipsec-secgw: add event port-lcore link
Anoob Joseph [Thu, 27 Feb 2020 16:18:25 +0000 (17:18 +0100)]
examples/ipsec-secgw: add event port-lcore link

Add event device port-lcore link and specify which event queues should
be connected to the event port. Generate a default config for event
port-lcore links if it is not specified in the configuration. This
routine will check the number of available ports and then create links
according to the number of cores available. This patch also adds a new
entry in the eventmode conf to denote that all queues are to be linked
with every port. This enables one core to receive packets from all
ethernet ports.

Signed-off-by: Anoob Joseph <anoobj@marvell.com>
Signed-off-by: Lukasz Bartosik <lbartosik@marvell.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
4 years agoexamples/ipsec-secgw: add framework for event helper
Anoob Joseph [Thu, 27 Feb 2020 16:18:24 +0000 (17:18 +0100)]
examples/ipsec-secgw: add framework for event helper

Add framework for eventmode helper. Event mode involves
initialization of multiple devices like eventdev, ethdev
and etc. Add routines to initialize and uninitialize event
device. Generate a default config for event device if it
is not specified in the configuration. Currently event
helper supports single event device only.

Signed-off-by: Anoob Joseph <anoobj@marvell.com>
Signed-off-by: Lukasz Bartosik <lbartosik@marvell.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
4 years agoexamples/ipsec-secgw: add default flow for inline Rx
Ankur Dwivedi [Thu, 27 Feb 2020 16:18:23 +0000 (17:18 +0100)]
examples/ipsec-secgw: add default flow for inline Rx

The default flow created would enable security processing on all ESP
packets. If the default flow is created, SA based rte_flow creation
would be skipped.

Signed-off-by: Ankur Dwivedi <adwivedi@marvell.com>
Signed-off-by: Anoob Joseph <anoobj@marvell.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
4 years agoapp/test-fib: add in default build
Vladimir Medvedkin [Mon, 9 Mar 2020 12:42:23 +0000 (12:42 +0000)]
app/test-fib: add in default build

Build test-fib application.

Signed-off-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>
4 years agoapp/test-fib: get rid of libresolv dependency
Vladimir Medvedkin [Mon, 9 Mar 2020 12:42:22 +0000 (12:42 +0000)]
app/test-fib: get rid of libresolv dependency

Get rid of using inet_net_pton(). Implement it internally in the app.

Signed-off-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>
4 years agoapp/test-fib: fix 32-bits build
Vladimir Medvedkin [Mon, 9 Mar 2020 12:42:21 +0000 (12:42 +0000)]
app/test-fib: fix 32-bits build

Change format for uint64_t to %"PRIu64" to make compiler happy.

Fixes: 103809d032cd ("app/test-fib: add test application for FIB")
Cc: stable@dpdk.org
Signed-off-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>
4 years agoapp/test-fib: fix possible use of uninitialized data
Vladimir Medvedkin [Mon, 9 Mar 2020 12:42:20 +0000 (12:42 +0000)]
app/test-fib: fix possible use of uninitialized data

Compiler can throw warning message for routes and lookup files.

Fixes: 103809d032cd ("app/test-fib: add test application for FIB")
Cc: stable@dpdk.org
Signed-off-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>
4 years agofib: fix headers for C++ support
Asim Jamshed [Mon, 16 Mar 2020 18:42:36 +0000 (18:42 +0000)]
fib: fix headers for C++ support

This patch allows C++ programs to use librte_fib library routines.
Previously C++ programs were not able to link this library and programs
would fail to get linked. With this patch compilation and linking
will be successful.

Fixes: 39e927248416 ("fib: add FIB library")
Fixes: 40d41a8a7b34 ("fib: support IPv6")
Cc: stable@dpdk.org
Signed-off-by: Asim Jamshed <asim.jamshed@gmail.com>
Signed-off-by: Saikrishna Edupuganti <saikrishna.edupuganti@intel.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
Acked-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>
4 years agoci: fix telemetry dependency in Travis
Juraj Linkeš [Fri, 3 Apr 2020 12:45:49 +0000 (14:45 +0200)]
ci: fix telemetry dependency in Travis

libjansson4 is not enough to build telemetry. Replace it with
libjansson-dev.

Fixes: 99889bd85228 ("ci: introduce Travis builds for GitHub repositories")
Cc: stable@dpdk.org
Signed-off-by: Juraj Linkeš <juraj.linkes@pantheon.tech>
Acked-by: Aaron Conole <aconole@redhat.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
4 years agolpm6: make IPv6 address immutable
Andrzej Ostruszka [Tue, 10 Mar 2020 09:13:26 +0000 (10:13 +0100)]
lpm6: make IPv6 address immutable

None of the public functions modify IPv6 address passed.  So their
parameters are made const - with the exception of bulk functions.
This exception is due to compatibility problems - some compilers report
problems with const-casting of array of arrays.

Previously only lookup and add were updated to have addresses passed as
const so I'm adding this fixline.

Fixes: d82927d2f81d ("lpm6: make IPv6 address immutable")
Cc: stable@dpdk.org
Signed-off-by: Andrzej Ostruszka <aostruszka@marvell.com>
Acked-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>
4 years agoeal: clean make and meson files
Thomas Monjalon [Fri, 27 Mar 2020 01:15:40 +0000 (02:15 +0100)]
eal: clean make and meson files

Clean up indent and line ordering in Makefile and meson.build
for consistency in linux/ and freebsd/ directories.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: David Marchand <david.marchand@redhat.com>
4 years agoeal: move OS-specific sub-directories
Thomas Monjalon [Fri, 27 Mar 2020 01:15:39 +0000 (02:15 +0100)]
eal: move OS-specific sub-directories

Since the kernel modules are moved to kernel/ directory,
there is no need anymore for the sub-directory eal/ in
linux/, freebsd/ and windows/.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: David Marchand <david.marchand@redhat.com>
4 years agoeal: move common header files
Thomas Monjalon [Fri, 27 Mar 2020 01:15:38 +0000 (02:15 +0100)]
eal: move common header files

The EAL API (with doxygen documentation) is moved from
common/include/ to include/, which makes more clear that
it is the global API for all environments and architectures.

Note that the arch-specific and OS-specific include files are not
in this global include directory, but include/generic/ should
cover the doxygen documentation for them.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: David Marchand <david.marchand@redhat.com>
4 years agoeal: simplify meson build of common directory
Thomas Monjalon [Fri, 27 Mar 2020 01:15:37 +0000 (02:15 +0100)]
eal: simplify meson build of common directory

The variable common_sources allows to change the list of common files
from an arch-specific or OS-specific meson file.
For consistency and least surprise principle, this variable is removed.
Now the list of common sources is defined only in common/meson.build.
As a consequence, the temporary list of files which are currently supported
on Windows, is moved from windows/eal/meson.build.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: David Marchand <david.marchand@redhat.com>
4 years agoeal: move arch-specific header files
Thomas Monjalon [Fri, 27 Mar 2020 01:15:36 +0000 (02:15 +0100)]
eal: move arch-specific header files

The arch-specific directories arm, ppc and x86 in common/include/arch/
are moved as include/ sub-directories of respective arch directories:
- arm/include/
- ppc/include/
- x86/include/

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: Gavin Hu <gavin.hu@arm.com>
Reviewed-by: David Christensen <drc@linux.vnet.ibm.com>
Acked-by: David Marchand <david.marchand@redhat.com>
4 years agoeal: move arch-specific C files
Thomas Monjalon [Fri, 27 Mar 2020 01:15:35 +0000 (02:15 +0100)]
eal: move arch-specific C files

The arch-specific directories arm, ppc and x86 in common/arch/
are moved at the same level as the OS-specific directories.
It makes more clear that EAL is covering a matrix combining OS and arch.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: David Christensen <drc@linux.vnet.ibm.com>
Acked-by: David Marchand <david.marchand@redhat.com>
4 years agobuild: rename ppc sub-directories
Thomas Monjalon [Fri, 27 Mar 2020 01:15:34 +0000 (02:15 +0100)]
build: rename ppc sub-directories

The directories ppc_64 are renamed as ppc in
- config/
- lib/librte_eal/common/arch/
- lib/librte_eal/common/include/arch/

The EAL directories are not really renamed, but symbolically linked,
because they will be moved with their new name in the next commits.

If ppc_32 needs to be supported, it can be in the same directory.
The arch directories arm and x86 are already covering both 32 and 64-bit
sub-architectures.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: David Christensen <drc@linux.vnet.ibm.com>
Acked-by: David Marchand <david.marchand@redhat.com>
4 years agoeal: remove useless makefiles
Thomas Monjalon [Fri, 27 Mar 2020 01:15:33 +0000 (02:15 +0100)]
eal: remove useless makefiles

When moving files to the directory kernel/,
the file BSDmakefile.meson was left in eal/.

Also the intermediate makefiles in linux/ and freebsd/ became useless.

Fixes: acaa9ee991b5 ("move kernel modules directories")
Cc: stable@dpdk.org
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: David Marchand <david.marchand@redhat.com>
4 years agombuf: optimize memory loads during freeing
Alexander Kozyrev [Fri, 20 Mar 2020 15:55:15 +0000 (15:55 +0000)]
mbuf: optimize memory loads during freeing

Introduction of pinned external buffers doubled memory loads in the
rte_pktmbuf_prefree_seg() function. Analysis of the generated assembly
code shows unnecessary load of the pool field of the rte_mbuf structure.
Here is the snippet of the assembly for "if (!RTE_MBUF_DIRECT(m))":
Before the change the code was:
movq  0x18(%rbx), %rax // load the ol_flags field
test %r13, %rax        // check if ol_flags equals to 0x60...0
jz 0x9a8718 <Block 2>  // jump out to "if (m->next != NULL)"
After the change the code became:
movq  0x18(%rbx), %rax // load ol_flags
test %r14, %rax        // check if ol_flags equals to 0x60...0
jnz 0x9bea38 <Block 2> // jump in to "if (!RTE_MBUF_HAS_EXTBUF(m)"
movq  0x48(%rbx), %rax // load the pool field
jmp 0x9bea78 <Block 7> // jump out to "if (m->next != NULL)"
Look like this absolutely unneeded memory load of the pool field is an
optimization for the external buffer case in GCC (4.8.5), since Clang
generates the same assembly for both before and after the change versions.
Plus, GCC favors the external buffer case over the simple case.
This assembly code layout causes the performance degradation because the
rte_pktmbuf_prefree_seg() function is a part of a very hot path.
Workaround this compilation issue by moving the check for pinned buffer
apart from the check for external buffer and restore the initial code
flow that favors the direct mbuf case over the external one.

Fixes: 6ef1107ad4c6 ("mbuf: detach mbuf with pinned external buffer")
Cc: stable@dpdk.org
Signed-off-by: Alexander Kozyrev <akozyrev@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
4 years agobus/pci: fix devargs on probing again
Somnath Kotur [Fri, 14 Feb 2020 06:43:53 +0000 (12:13 +0530)]
bus/pci: fix devargs on probing again

As per the comments in this code section, since there is a matching device,
it is now its responsibility to manage the devargs we've just inserted.
But the matching device ptr's devargs is still uninitialized or not pointing
to the newest dev_args that were passed as a parameter to local_dev_probe().
This is needed particularly in the case when *probe is called again* on an
already probed device as part of adding a representor port to OVS-DPDK.

Fixes: 7e8b26650146 ("eal: fix hotplug add / remove")
Cc: stable@dpdk.org
Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Acked-by: Gaetan Rivet <grive@u256.net>
4 years agokvargs: fix buffer overflow when parsing list
Yunjian Wang [Fri, 27 Mar 2020 08:09:55 +0000 (09:09 +0100)]
kvargs: fix buffer overflow when parsing list

When the input string is "key=[", the ending '\0' is replaced
by a ',', leading to a heap buffer overflow.

Check the content of ctx1 to avoid this problem.

Fixes: cc0579f2339a ("kvargs: support list value")
Cc: stable@dpdk.org
Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
4 years agotest/kvargs: fix invalid cases check
Olivier Matz [Fri, 27 Mar 2020 08:09:54 +0000 (09:09 +0100)]
test/kvargs: fix invalid cases check

The return was not properly placed, and only the first test case
was validated.

Fixes: e495f5435524 ("kvargs: add test case in app/test")
Cc: stable@dpdk.org
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
4 years agotest/kvargs: fix to consider empty elements as valid
Olivier Matz [Fri, 27 Mar 2020 08:09:53 +0000 (09:09 +0100)]
test/kvargs: fix to consider empty elements as valid

Empty elements passed to the kvargs parser are silently
ignored. Examples of valid strings:
  ""
  ","
  ",,,,,,key=val,,,,"

Fix the unit tests to conform to this behavior.

Note: the test_invalid_kvargs() function is currently broken, which
explain why the tests were not failing. It is fixed in the next commit.

Fixes: e495f5435524 ("kvargs: add test case in app/test")
Cc: stable@dpdk.org
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
4 years agolog: add API to check if a logtype can log in a given level
Ferruh Yigit [Fri, 13 Mar 2020 14:51:59 +0000 (14:51 +0000)]
log: add API to check if a logtype can log in a given level

This is a helper function in case components would like to do more work
than just logging a message based on log level, like for example
collecting some stats if the log type is DEBUG etc..

A few existing relevant usage converted to this new API.

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Hyong Youb Kim <hyonkim@cisco.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Reviewed-by: Andrzej Ostruszka <aostruszka@marvell.com>
Acked-by: David Marchand <david.marchand@redhat.com>
4 years agomem: preallocate VA space in no-huge mode
Anatoly Burakov [Fri, 7 Feb 2020 11:11:14 +0000 (11:11 +0000)]
mem: preallocate VA space in no-huge mode

When --no-huge mode is used, the memory is currently allocated with
mmap(NULL, ...). This is fine in most cases, but can fail in cases
where DPDK is run on a machine with an IOMMU that is of more limited
address width than that of a VA, because we're not specifying the
address hint for mmap() call.

Fix it by preallocating VA space before mapping it.

Cc: stable@dpdk.org
Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Tested-by: David Marchand <david.marchand@redhat.com>
Tested-by: Jun W Zhou <junx.w.zhou@intel.com>
4 years agovfio: map contiguous areas in one go
Anatoly Burakov [Tue, 25 Feb 2020 13:24:48 +0000 (13:24 +0000)]
vfio: map contiguous areas in one go

Currently, when we are creating DMA mappings for memory that's
either external or is backed by hugepages in IOVA as PA mode, we
assume that each page is necessarily discontiguous. This may not
actually be the case, especially for external memory, where the
user is able to create their own IOVA table and make it
contiguous. This is a problem because VFIO has a limited number
of DMA mappings, and it does not appear to concatenate them and
treats each mapping as separate, even when they cover adjacent
areas.

Fix this so that we always map contiguous memory in a single
chunk, as opposed to mapping each segment separately.

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Acked-by: Ray Kinsella <ray.kinsella@intel.com>
4 years agoeal/freebsd: fix queuing duplicate alarm callbacks
Mit Matelske [Wed, 20 Nov 2019 20:10:56 +0000 (14:10 -0600)]
eal/freebsd: fix queuing duplicate alarm callbacks

The source callback list grows infinitely when more than alarm
is queued.

This fix recognizes that an alarm interrupt in FreeBSD should never
have more than one callback on its list, so if
rte_intr_callback_register() is called with an interrupt handle type
of RTE_INTR_HANDLE_ALARM, so if such an interrupt type already has a
non-empty list, then a new callback is not created, but the kevent
timer is restarted properly.

Fixes: 23150bd8d8a8 ("eal/bsd: add interrupt thread")
Cc: stable@dpdk.org
Signed-off-by: Mit Matelske <mit@pt.net>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
4 years agoeal: store control thread CPU affinity in TLS
Jerin Jacob [Wed, 5 Feb 2020 10:24:15 +0000 (15:54 +0530)]
eal: store control thread CPU affinity in TLS

_cpuset TLS variable stores the CPU affinity of eal thread.
Populate the _cpuset TLS variable for control thread to

1) Make rte_thread_get_affinity() and eal_thread_dump_affinity
functional with control thread.
2) Quick access to cpu affinity.

Signed-off-by: Jerin Jacob <jerinj@marvell.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
4 years agoci: enable unit test for aarch64
Ruifeng Wang [Mon, 23 Mar 2020 19:59:26 +0000 (20:59 +0100)]
ci: enable unit test for aarch64

Add Travis CI jobs to run unit tests on aarch64 platform.

Signed-off-by: Ruifeng Wang <ruifeng.wang@arm.com>
Reviewed-by: Gavin Hu <gavin.hu@arm.com>
Acked-by: Aaron Conole <aconole@redhat.com>
4 years agoci: run tests even without hugepage
Ruifeng Wang [Mon, 23 Mar 2020 19:59:25 +0000 (20:59 +0100)]
ci: run tests even without hugepage

As fast-tests suite generated with only applicable cases included,
hugepage is not a mandatory to run the test.
Ignore the result of hugepage set up, so that validation in environment
without hugepage can proceed.

Signed-off-by: Ruifeng Wang <ruifeng.wang@arm.com>
Reviewed-by: Gavin Hu <gavin.hu@arm.com>
Acked-by: Aaron Conole <aconole@redhat.com>
4 years agotest: allow no-huge mode for fast-tests
Ruifeng Wang [Mon, 23 Mar 2020 19:59:24 +0000 (20:59 +0100)]
test: allow no-huge mode for fast-tests

In environments where hugepage are not available, such as
containers, many cases in fast-tests suite should also run
if no-huge EAL option is used.

Flag is appended to each case in fast-tests suite to indicate
whether it lives with no-huge mode.
With the flag, fast-tests suite can be generated based on
detected hugepage availability of building environment.
All cases will be valid if hugepage is available, whereas
only applicable cases will be added if environment has no
hugepage support.

Suggested-by: Aaron Conole <aconole@redhat.com>
Signed-off-by: Ruifeng Wang <ruifeng.wang@arm.com>
Reviewed-by: Gavin Hu <gavin.hu@arm.com>
Acked-by: Aaron Conole <aconole@redhat.com>
Signed-off-by: David Marchand <david.marchand@redhat.com>
4 years agotest: skip some subtests in no-huge mode
Ruifeng Wang [Mon, 23 Mar 2020 19:59:23 +0000 (20:59 +0100)]
test: skip some subtests in no-huge mode

When running with '--no-huge' flag, tests failed with messages as:
    ACL context creation with invalid NUMA should have failed!
    fbk hash creation should have failed
    test_table_pipeline: Check pipeline invalid params failed.

These cases test against invalid socket ID as input parameter, and
expect error return. But function calls return success because
invalid sock ID is overwritten to SOCKET_ID_ANY when in no-huge mode.

The tests against invalid socket ID are skipped in no-huge mode.

Fixes: 5640171c528a ("malloc: fix external heap allocation in no-huge mode")
Cc: stable@dpdk.org
Signed-off-by: Ruifeng Wang <ruifeng.wang@arm.com>
Reviewed-by: Gavin Hu <gavin.hu@arm.com>
Acked-by: Aaron Conole <aconole@redhat.com>
Acked-by: Yipeng Wang <yipeng1.wang@intel.com>
4 years agotest: load drivers when required
David Marchand [Mon, 23 Mar 2020 19:59:22 +0000 (20:59 +0100)]
test: load drivers when required

Concatenating to test_args if event_eth_tx_adapter_autotest is executed
makes all subsequent tests inherit from the drivers loading while this
is unneeded.

Fixes: 207b1c813f39 ("test: fix build without ring PMD")
Cc: stable@dpdk.org
Signed-off-by: David Marchand <david.marchand@redhat.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Acked-by: Aaron Conole <aconole@redhat.com>
4 years agodevtools: silence meson install
David Marchand [Tue, 17 Mar 2020 16:25:21 +0000 (17:25 +0100)]
devtools: silence meson install

Installing with ninja is quite verbose by default, hide ninja output under
TEST_MESON_BUILD_VERBOSE and TEST_MESON_BUILD_VERY_VERBOSE options.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
4 years agodevtools: fix symbol map change check
Nithin Dabilpuram [Mon, 23 Mar 2020 11:56:13 +0000 (17:26 +0530)]
devtools: fix symbol map change check

Fix check symbol change script to detect new diff file when
it is in between  "--- /dev/null" to "b/lib/...".
Current awk line expects line to start with "a/..."
which is not always true for all diffs.
As a result if in_map was '1' earlier, it will not be changed
to '0' and we get check patch errors which are not true.

Fixes: 4bec48184e33 ("devtools: add checks for ABI symbol addition")
Cc: stable@dpdk.org
Signed-off-by: David Marchand <david.marchand@redhat.com>
Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Tested-by: Jerin Jacob <jerinj@marvell.com>
4 years agomaintainers: update for ring library
Olivier Matz [Thu, 5 Mar 2020 17:00:08 +0000 (18:00 +0100)]
maintainers: update for ring library

Honnappa and Konstantin contributed actively to the ring library
and volunteered to replace myself as maintainers.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
4 years agoring: fix unaligned memory access on aarch32
Phil Yang [Mon, 9 Mar 2020 17:19:55 +0000 (01:19 +0800)]
ring: fix unaligned memory access on aarch32

The 32-bit arm machine doesn't support unaligned memory access. It
will cause a bus error on aarch32 with the custom element size ring.

Thread 1 "test" received signal SIGBUS, Bus error.
__rte_ring_enqueue_elems_64 (n=1, obj_table=0xf5edfe41, prod_head=0, \
r=0xf5edfb80) at /build/dpdk/build/include/rte_ring_elem.h:177
177                             ring[idx++] = obj[i++];

Fixes: cc4b218790f6 ("ring: support configurable element size")

Signed-off-by: Phil Yang <phil.yang@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
4 years agocontigmem: cleanup properly when load fails
Jim Harris [Mon, 9 Mar 2020 10:00:25 +0000 (03:00 -0700)]
contigmem: cleanup properly when load fails

If contigmem is not able to allocate all of the
requested buffers, it frees whatever buffers were
able to be allocated up until that point.

But the pointers are not set to NULL in that case.
After the load fails, the FreeBSD kernel will
immediately call the contigmem unload handler, which
tries to free the buffers again since the pointers
were not set to NULL.

It's not clear that we should just rely on the unload
handler getting called after load failure. So let's
keep the existing cleanup code in the load handler,
but explicitly set the pointers to NULL after freeing
them.

Fixes: 5f51eca22489 ("contigmem: free allocated memory on error")
Cc: stable@dpdk.org
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
4 years agonet/mlx5: reduce Tx completion index memory loads
Alexander Kozyrev [Mon, 16 Mar 2020 15:34:59 +0000 (15:34 +0000)]
net/mlx5: reduce Tx completion index memory loads

There is a non-optimal check if doorbell is needed present in the
mlx5_tx_handle_completion() function. Advancing a copy of the txq
consumer index and checking this copy with initial value causes
unnecessary memory loads and hurts the performance. It is better to
have a simple small boolean variable for this purpose. That allows
to eliminate all the excessive memory operations with the txq consumer
index and restore the performance of the tx completions.

Fixes: 1fd9af05e44e ("net/mlx5: update Tx error handling routine")
Cc: stable@dpdk.org
Signed-off-by: Alexander Kozyrev <akozyrev@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agonet/mlx5: fix CVLAN tag set in IP item translation
Dekel Peled [Mon, 16 Mar 2020 08:57:39 +0000 (10:57 +0200)]
net/mlx5: fix CVLAN tag set in IP item translation

Previous fix added, at the end of functions
flow_dv_translate_item_ipv4() and flow_dv_translate_item_ipv6(), the
setting of cvlan_tag mask.
In the case of unspecified item (item->spec == null) these functions
return, and the new code section is not reached.

This patch moves the setting of cvlan_tag mask to be done before the
check of item->spec, to make sure it is always executed.

Fixes: 797329d6c4a1 ("net/mlx5: fix match on ethertype and CVLAN tag")
Cc: stable@dpdk.org
Signed-off-by: Dekel Peled <dekelp@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
4 years agonet/hinic: allocate IO memory with socket id
Xiaoyun Wang [Sat, 14 Mar 2020 10:02:06 +0000 (18:02 +0800)]
net/hinic: allocate IO memory with socket id

This patch makes IO memory allocation with socketid,
the txq or rxq descriptor and IO resource can be allocated with
socketid that passed by queue setup ops, which can improve
performance for cross-numa scene.

Cc: stable@dpdk.org
Signed-off-by: Xiaoyun Wang <cloud.wangxiaoyun@huawei.com>
4 years agonet/axgbe: support descriptor status
Amaranath Somalapuram [Mon, 2 Mar 2020 08:16:55 +0000 (13:46 +0530)]
net/axgbe: support descriptor status

Adding API axgbe_dev_rx_descriptor_status, axgbe_dev_tx_descriptor_status

Signed-off-by: Amaranath Somalapuram <asomalap@amd.com>
Acked-by: Ravi Kumar <ravi1.kumar@amd.com>
4 years agonet/axgbe: advertise supported packet types
Amaranath Somalapuram [Mon, 2 Mar 2020 08:16:54 +0000 (13:46 +0530)]
net/axgbe: advertise supported packet types

Adding api for eth_dev_supported_ptypes_get_t

Signed-off-by: Amaranath Somalapuram <asomalap@amd.com>
Acked-by: Ravi Kumar <ravi1.kumar@amd.com>
4 years agonet/axgbe: support queue query
Amaranath Somalapuram [Mon, 2 Mar 2020 08:16:53 +0000 (13:46 +0530)]
net/axgbe: support queue query

Adding API for axgbe_rxq_info_get, axgbe_txq_info_get

Signed-off-by: Amaranath Somalapuram <asomalap@amd.com>
Acked-by: Ravi Kumar <ravi1.kumar@amd.com>
4 years agonet/axgbe: support priority flow control
Amaranath Somalapuram [Tue, 3 Mar 2020 08:19:58 +0000 (13:49 +0530)]
net/axgbe: support priority flow control

Adding API for priority_flow_ctrl_set.
Priority flow control to set water high and low,
pause_time and priority.

Signed-off-by: Amaranath Somalapuram <asomalap@amd.com>
Acked-by: Ravi Kumar <ravi1.kumar@amd.com>
4 years agonet/axgbe: support flow control
Amaranath Somalapuram [Tue, 3 Mar 2020 08:19:57 +0000 (13:49 +0530)]
net/axgbe: support flow control

Adding api for flow_ctrl_get and flow_ctrl_set.
By default axgbe driver flow control is disabled.
Adding dpdk flow control to set water high and low.

Signed-off-by: Amaranath Somalapuram <asomalap@amd.com>
Acked-by: Ravi Kumar <ravi1.kumar@amd.com>
4 years agonet/mlx5: fix zero metadata action
Wisam Jaddo [Thu, 12 Mar 2020 09:24:40 +0000 (11:24 +0200)]
net/mlx5: fix zero metadata action

There is no reason to prevent the user from using zero metadata,
it indeed means no metadata, but sometimes the user may need to
report to datapath that there is no metadata anymore, which is
valid case.

Fixes: fcc8d2f716fd ("net/mlx5: extend flow metadata support")
Cc: stable@dpdk.org
Signed-off-by: Wisam Jaddo <wisamm@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agonet/ixgbe: fix setting VF MAC address
Guinan Sun [Wed, 11 Mar 2020 09:06:51 +0000 (09:06 +0000)]
net/ixgbe: fix setting VF MAC address

The reason why PF cannot receive data normally is that vf performed
the clear_rar operation through dev close without adding a mac address. 
This will cause the association between the index and rx address set
by VMDq to be cancelled,thus affecting the data reception of PF. The
correction method is to add a check action, and do not perform the
set_rar operation without adding a mac address to prevent affecting the
reception of data.

Fixes: 3c4270187518 ("net/ixgbe: support VF MAC address add/remove")
Cc: stable@dpdk.org
Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
Acked-by: Xiaolong Ye <xiaolong.ye@intel.com>
4 years agonet/cxgbe: add devargs to control filtermode and filtermask
Karra Satwik [Wed, 11 Mar 2020 09:05:51 +0000 (14:35 +0530)]
net/cxgbe: add devargs to control filtermode and filtermask

Apart from the 4-tuple (IP src/dst addresses and TCP/UDP src/dst
port addresses), there are only 40-bits available to match other
fields in packet headers. Not all combinations of packet header
fields can fit in the 40-bit tuple.

Currently, the combination of packet header fields to match are
configured via filterMode for LETCAM filters and filterMask for
HASH filters in firmware config files (t5/t6-config.txt). So, add
devargs to allow User to dynamically select the filterMode and
filterMask combination during runtime, without having to modify the
firmware config files and reflashing them onto the adapter. A table
of supported combinations is maintained by the driver to internally
translate the User specified devargs combination to hardware's internal
format before writing the requested combination to hardware

Signed-off-by: Karra Satwik <kaara.satwik@chelsio.com>
Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
4 years agonet/cxgbe: use firmware API for validating filter spec
Karra Satwik [Wed, 11 Mar 2020 09:05:50 +0000 (14:35 +0530)]
net/cxgbe: use firmware API for validating filter spec

Add new firmware API FW_PARAM_DEV_FILTER_MODE_MASK to fetch
the filtermode and filtermask values configured in hardware,
which are used to validate the match combinations in the filter
spec before offloading the filter rules to hardware. For older
firmware that doesn't support the new API, fallback to older way
of directly reading from indirect registers

Signed-off-by: Karra Satwik <kaara.satwik@chelsio.com>
Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
4 years agonet/cxgbe: support flow API for source MAC rewrite
Karra Satwik [Wed, 11 Mar 2020 09:05:49 +0000 (14:35 +0530)]
net/cxgbe: support flow API for source MAC rewrite

Add support to rewrite Source MAC addresses. The new Source
MAC address is written into a free entry in the SMT table
and the corresponding SMT index is used by hardware to
rewrite the Source MAC address of the packets hitting the
flow.

Signed-off-by: Karra Satwik <kaara.satwik@chelsio.com>
Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
4 years agonet/cxgbe: support Source MAC Table
Karra Satwik [Wed, 11 Mar 2020 09:05:48 +0000 (14:35 +0530)]
net/cxgbe: support Source MAC Table

Source MAC Table (SMT) is used for storing Source MAC
addresses to be written in packets transmitted on the
wire. Hence, the SMT table can be used for overwriting
Source MAC addresses in packets, hitting corresponding
filter rules inserted by the rte_flow API.

Query firmware for SMT start and size information available
to the underlying PF. Allocate and maintain the corresponding
driver's copy of the hardware SMT table, with appropriate
refcount mechanism. If SMT information is not available, then
use the entire hardware SMT table.

Signed-off-by: Karra Satwik <kaara.satwik@chelsio.com>
Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
4 years agonet/cxgbe: support flow API for destination MAC rewrite
Karra Satwik [Wed, 11 Mar 2020 09:05:47 +0000 (14:35 +0530)]
net/cxgbe: support flow API for destination MAC rewrite

Add support for overwriting destination MAC addresses.
The new MAC address is written into a free entry in the
L2T table and the corresponding L2T index is used by
hardware to overwrite the destination MAC address of the
packets hitting the flow

Signed-off-by: Karra Satwik <kaara.satwik@chelsio.com>
Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
4 years agonet/cxgbe: support flow API for matching all packets on VF
Karra Satwik [Wed, 11 Mar 2020 09:05:46 +0000 (14:35 +0530)]
net/cxgbe: support flow API for matching all packets on VF

Add support to match all packets received on the underlying VF.

Use new firmware API to fetch the Virtual Interface Number (VIN)
allocated to each VF by the firmware. The VIN is required to
write filter rules to match all packets on VFs, whose identifier
is beyond max 7-bit value (i.e. 127) in VIID.

If firmware doesn't support fetching the VIN information, then
fallback to manually retrieving the VIN value from the 7-bit field
in the VIID, which only supports in range of 0..127. In this case,
packets belonging to VFs, whose identifier is beyond 127 can't be
matched.

Signed-off-by: Karra Satwik <kaara.satwik@chelsio.com>
Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
4 years agonet/cxgbe: support flow API for matching all packets on PF
Karra Satwik [Wed, 11 Mar 2020 09:05:45 +0000 (14:35 +0530)]
net/cxgbe: support flow API for matching all packets on PF

Add support to match all packets received on the underlying PF

Note that the same 17-bit hardware tuple is shared between QinQ
and PF match. Hence, match on either QinQ or PF only can be done
at a time. Both QinQ and PF match can't be enabled at the same time.

Also, remove check to reject rules without spec because
RTE_FLOW_ITEM_TYPE_PF doesn't require a spec. Due to this check
removal, RTE_FLOW_ITEM_TYPE_PHY_PORT item needs to be updated to
handle NULL spec

Signed-off-by: Karra Satwik <kaara.satwik@chelsio.com>
Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
4 years agonet/cxgbe: support flow API for matching IP TOS
Karra Satwik [Wed, 11 Mar 2020 09:05:44 +0000 (14:35 +0530)]
net/cxgbe: support flow API for matching IP TOS

Add support to match Type of Service (TOS) field in
IPv4/IPv6 header

Signed-off-by: Karra Satwik <kaara.satwik@chelsio.com>
Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
4 years agonet/cxgbe: support flow API for matching QinQ VLAN
Karra Satwik [Wed, 11 Mar 2020 09:05:43 +0000 (14:35 +0530)]
net/cxgbe: support flow API for matching QinQ VLAN

Add support to match fields in 802.1ad Q-in-Q VLAN packets.
Relax check for repeated pattern items for RTE_FLOW_ITEM_TYPE_VLAN
item, since the same item is used to represent both QinQ and VLAN
packets.

When QinQ match is enabled, the ethertype field in the hardware
spec must contain the innermost VLAN header's ethertype field,
and not the Ethernet header's ethertype field. The hardware
automatically searches for ethertype 0x88A8/0x8100 in Ethernet
header, when parsing incoming packet against QinQ/VLAN pattern,
respectively.

Signed-off-by: Karra Satwik <kaara.satwik@chelsio.com>
Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
4 years agonet/sfc/base: handle manual and auto filter clashes in EF10
Igor Romanov [Tue, 10 Mar 2020 09:48:39 +0000 (09:48 +0000)]
net/sfc/base: handle manual and auto filter clashes in EF10

Make user filters a priority in EF10 datapath. When a manual
filter with a specification that is equal to an existing auto
filter is inserted, the manual filter:
- replaces auto filter if the specification is exclusive;
- is inserted along existing auto filter otherwise;

In the first case the auto filter that was replaced is saved.
This saved filter can be updated on filter reconfiguration and
is restored on the manual filter removal.

Fixes: e7cd430c864f ("net/sfc/base: import SFN7xxx family support")
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/base: refactor filter lookup loop in EF10
Igor Romanov [Tue, 10 Mar 2020 09:48:38 +0000 (09:48 +0000)]
net/sfc/base: refactor filter lookup loop in EF10

The code is refactored to make it more clear and allow for
more convenient further changes.

Fixes: e7cd430c864f ("net/sfc/base: import SFN7xxx family support")
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/base: reject automatic filter creation by users
Igor Romanov [Tue, 10 Mar 2020 09:48:37 +0000 (09:48 +0000)]
net/sfc/base: reject automatic filter creation by users

The automatic filter priority may only be used by filter implementation,
so reject the attempts to create such filters by client drivers.

Fixes: f9565517ff4f ("net/sfc/base: import filters support")
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/base: reduce filter priorities to implemented only
Igor Romanov [Tue, 10 Mar 2020 09:48:36 +0000 (09:48 +0000)]
net/sfc/base: reduce filter priorities to implemented only

Only implemented filter priorities are manual and auto. Remove
unused priorities since exposing unimplemented functionality
is of no benefit.

Tx filter specification default priority is changed to manual,
since required priority does not differ from it in the implementation.

Fixes: f9565517ff4f ("net/sfc/base: import filters support")
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: set priority of created filters to manual
Igor Romanov [Tue, 10 Mar 2020 09:48:35 +0000 (09:48 +0000)]
net/sfc: set priority of created filters to manual

The priority should be explicitly set to manual for correct
usage of libefx filters.

Fixes: a9825ccf5bb8 ("net/sfc: support flow API filters")
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 promiscuous and allmulticast toggles errors
Igor Romanov [Tue, 10 Mar 2020 09:42:09 +0000 (09:42 +0000)]
net/sfc: fix promiscuous and allmulticast toggles errors

Returned errors of ethdev callbacks are negative. Internal
sfc functions return positive errors, so convert them to
negative value.

Fixes: 9039c8125730 ("ethdev: change promiscuous callbacks to return status")
Cc: stable@dpdk.org
Signed-off-by: Igor Romanov <igor.romanov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
4 years agoethdev: fix spelling
Stephen Hemminger [Tue, 10 Mar 2020 16:24:05 +0000 (09:24 -0700)]
ethdev: fix spelling

Minor spelling errors found by aspell and codespell

Fixes: 1daa33805824 ("ethdev: validate offloads set by PMD")
Fixes: 81f9db8ecc2c ("ethdev: add vlan offload support")
Fixes: c8231c63ddcb ("ethdev: insert Rx callback as head of list")
Cc: stable@dpdk.org
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agonet/ionic: use standard boolean type
Sunil Kumar Kori [Mon, 9 Mar 2020 09:09:27 +0000 (14:39 +0530)]
net/ionic: use standard boolean type

Any DPDK public header file which includes stdbool.h may conflict with
local definition of bool, if any, which further results in compilation
error. To avoid, used standard stdbool.h instead of defining bool
internally.

I observed this issue during a development where I included rte_uuid.h
into rte_ethdev.h. As rte_ethdev.h is included to PMD driver, it started
throwing error as given below:

  CC ionic_rxtx.o
In file included from .../dpdk/build/include/rte_uuid.h:17:0,
                 from .../dpdk/build/include/rte_ethdev.h:161,
                 from .../dpdk/build/include/rte_ethdev_driver.h:18,
                 from .../dpdk/drivers/net/ionic/ionic_rxtx.c:34:
.../dpdk/drivers/net/ionic/ionic_osdep.h:48:17:
    error: two or more data types in declaration specifiers
typedef uint8_t bool;
                 ^
In file included from .../dpdk/drivers/net/ionic/ionic_dev.h:8:0,
                 from .../dpdk/drivers/net/ionic/ionic.h:13,
                 from .../dpdk/drivers/net/ionic/ionic_mac_api.h:8,
                 from .../dpdk/drivers/net/ionic/ionic_rxtx.c:45:
.../dpdk/drivers/net/ionic/ionic_osdep.h:48:1:
    warning: useless type name in empty declaration
typedef uint8_t bool;
^~~~~~~
cc1: warning: unrecognized command line option
‘-Wno-address-of-packed-member’
.../dpdk/mk/internal/rte.compile-pre.mk:114:
recipe for target 'ionic_rxtx.o' failed

Fixes: 5ef518098ec6 ("net/ionic: register and initialize adapter")
Cc: stable@dpdk.org
Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
Acked-by: Alfredo Cardigliano <cardigliano@ntop.org>
4 years agonet/hns3: fix promiscuous mode for PF
Chengchang Tang [Mon, 9 Mar 2020 09:32:43 +0000 (17:32 +0800)]
net/hns3: fix promiscuous mode for PF

Currently, when promiscuous mode is enabled, it is just allowed to
accept all the unicast and broadcast packets in hns3 PF PMD driver. It
should also be able to receive multicast packets.

Fixes: 19a3ca4c99cf ("net/hns3: add start/stop and configure operations")
Cc: stable@dpdk.org
Signed-off-by: Chengchang Tang <tangchengchang@huawei.com>
Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
4 years agonet/hns3: support promiscuous and allmulticast mode for VF
Chengchang Tang [Mon, 9 Mar 2020 09:32:42 +0000 (17:32 +0800)]
net/hns3: support promiscuous and allmulticast mode for VF

Currently, we only support VF device is bound to vfio_pci or igb_uio and
then driven by DPDK driver when PF is driven by kernel mode hns3 ethdev
driver, VF is not supported when PF is driven by hns3 DPDK driver.

This patch adds promiscuous and allmulticast mode support for hns3 VF
PMD driver.
1) The promiscuous/allmulticast mode can be configured successfully only
   based on the trusted VF device. If based on the non trusted VF
   device, configuring promiscuous/allmulticast mode will fail. The hns3
   VF device can be configured as trusted device by hns3 PF kernel
   ethdev driver on the host by "ip link set <eth num> vf <vf id> turst
   on" command.
2) After the promiscuous mode is configured successfully, hns3 VF PMD
   driver can receive the ingress and outgoing traffic. In the words,
   all the ingress packets, all the packets sent from the PF and other
   VFs on the same physical port.
3) Note: Because of the hardware constraints, By default vlan filter is
   enabled and couldn't be turned off based on VF device, so vlan filter
   is still effective even in promiscuous mode. If upper applications
   don't call rte_eth_dev_vlan_filter API function to set vlan based on
   VF device, hns3 VF PMD driver will can't receive the packets with
   vlan tag in promiscuous mode.

Signed-off-by: Chengchang Tang <tangchengchang@huawei.com>
Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
4 years agonet/hns3: remove restriction on setting VF MTU
Chengchang Tang [Mon, 9 Mar 2020 09:32:41 +0000 (17:32 +0800)]
net/hns3: remove restriction on setting VF MTU

The hns3 PF/VF devices on the same port share the hardware MTU
configuration. Currently, we send mailbox to inform hns3 PF kernel
ethdev driver to finish hardware MTU configuration in hns3 VF PMD
driver, there is no need to stop the port for hns3 VF device, and
the MTU value issued by hns3 VF PMD driver must be less than or
equal to PF's MTU.

Signed-off-by: Chengchang Tang <tangchengchang@huawei.com>
Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
4 years agonet/hns3: fix Tx interrupt when enabling Rx interrupt
Wei Hu (Xavier) [Mon, 9 Mar 2020 09:32:40 +0000 (17:32 +0800)]
net/hns3: fix Tx interrupt when enabling Rx interrupt

Currently, when receiving and transmitting packets based on hns3 network
engine there are probably unexpected and redundant Tx interrupts if Rx
interrupt is enabled.

The root cause as below:
Tx and Rx queues with the same number share the interrupt vector in hns3
network engine, and in this case there are the residual hardware mapping
relationship configuration between queue and interrupt vector configured
in hns3 kernel ethdev driver.

We should clear the all hardware mapping relationship configurations in
the initialization. Because of the hardware constraints, we have to
implement clearing the relationship by binding all queues to the last
interrupt vector and reserving the last interrupt vector, this method
results in a decrease of the maximum queues when upper applications call
the rte_eth_dev_configure API function to enable Rx interrupt.

Fixes: 02a7b55657b2 ("net/hns3: support Rx interrupt")
Cc: stable@dpdk.org
Signed-off-by: Hao Chen <chenhao164@huawei.com>
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Signed-off-by: Lijun Ou <oulijun@huawei.com>
Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
4 years agonet/hns3: support TSO
Hongbo Zheng [Mon, 9 Mar 2020 09:32:39 +0000 (17:32 +0800)]
net/hns3: support TSO

This patch adds TCP segment offload support for hns3 PMD driver.

Signed-off-by: Hongbo Zheng <zhenghongbo3@huawei.com>
Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
4 years agoethdev: add PFCP header to flow API
Xiao Zhang [Fri, 6 Mar 2020 06:39:26 +0000 (14:39 +0800)]
ethdev: add PFCP header to flow API

This patch adds the new flow item RTE_FLOW_ITEM_TYPE_PFCP to flow API to
match a PFCP header.
Add sample PFCP rules for testpmd guide. Since Session Endpoint
Identifier (SEID) only will be present in PFCP Session header and PFCP
Session headers shall be identified when the S field is equal to 1, when
create rules for PFCP Session header with certain SEID the S field need
be set 1.

Signed-off-by: Xiao Zhang <xiao.zhang@intel.com>
Acked-by: Ori Kam <orika@mellanox.com>
4 years agonet/ice: remove redundant functions
Qi Zhang [Mon, 9 Mar 2020 12:12:14 +0000 (20:12 +0800)]
net/ice: remove redundant functions

Remove function ice_clear_queues, since all equivalent code
has already been executed during ice_rx|tx_queue_stop.

Also function ice_rx|tx_queue_release_mbufs simply wrapped a
function pointer call which is not necessary, remove them.

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Reviewed-by: Xiaolong Ye <xiaolong.ye@intel.com>
4 years agonet/hinic: fix repeating cable log and length check
Kevin Traynor [Fri, 6 Mar 2020 12:06:52 +0000 (12:06 +0000)]
net/hinic: fix repeating cable log and length check

gcc 10.0.1 reports:

../drivers/net/hinic/base/hinic_pmd_hwdev.c: In function ‘print_cable_info’:
../drivers/net/hinic/base/hinic_pmd_hwdev.c:1398:3:
warning:
‘snprintf’ argument 4 may overlap destination object ‘tmp_str’
[-Wrestrict]
 1398 |   snprintf(tmp_str + strlen(tmp_str), (sizeof(tmp_str) - 1),
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 1399 |     "%s, Temperature: %u", tmp_str,
      |     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 1400 |     info->cable_temp);
      |     ~~~~~~~~~~~~~~~~~

The warning is that tmp_str is in both src and dest.

Anyway, the current code is incorrect and because of the +strlen
the existing string will be repeated twice and max length
does not limit to the end of the string.

Fix by removing tmp_str from the src of snprintf and adding the
correct max length.

Fixes: d9ce1917941c ("net/hinic/base: add hardware operation")
Cc: stable@dpdk.org
Signed-off-by: Kevin Traynor <ktraynor@redhat.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agonet/hinic: fix snprintf length of cable info
Kevin Traynor [Fri, 6 Mar 2020 12:06:51 +0000 (12:06 +0000)]
net/hinic: fix snprintf length of cable info

Correct length and remove unnecessary brackets.

Fixes: d9ce1917941c ("net/hinic/base: add hardware operation")
Cc: stable@dpdk.org
Signed-off-by: Kevin Traynor <ktraynor@redhat.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agonet/memif: fix init when already connected
Július Milan [Wed, 19 Feb 2020 08:19:16 +0000 (09:19 +0100)]
net/memif: fix init when already connected

This patch fixes the situation when there is already connected pair of
memif interfaces and another slave tries to initiate the connection with
(already occupied) master. Expected behavior is that the second slave
is refused and gets disconnect message with reason: "Already connected",
while old connection remains functional.

Fixes: 09c7e63a71f9 ("net/memif: introduce memory interface PMD")
Cc: stable@dpdk.org
Signed-off-by: Július Milan <jmilan.dev@gmail.com>
Reviewed-by: Jakub Grajciar <jgrajcia@cisco.com>
4 years agonet/memif: enable loopback
Július Milan [Mon, 9 Mar 2020 14:22:08 +0000 (15:22 +0100)]
net/memif: enable loopback

With this patch it is possible to connect 2 DPDK memifs into loopback,
i.e. when they have the same id and different roles, as for example:
  "--vdev=net_memif0,role=master,id=0"
  "--vdev=net_memif1,role=slave,id=0"

Signed-off-by: Július Milan <jmilan.dev@gmail.com>
Reviewed-by: Jakub Grajciar <jgrajcia@cisco.com>