dpdk.git
5 years agotest/crypto: enable additional cases for dpaax
Hemant Agrawal [Wed, 6 Nov 2019 05:17:26 +0000 (10:47 +0530)]
test/crypto: enable additional cases for dpaax

This patch enables short buffer and 12 bit IV AES-CTR cases
for dpaax_sec pmds.

Signed-off-by: Vakul Garg <vakul.garg@nxp.com>
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
5 years agocrypto/dpaa_sec: support AES-GCM for lookaside protocol
Hemant Agrawal [Wed, 6 Nov 2019 05:17:25 +0000 (10:47 +0530)]
crypto/dpaa_sec: support AES-GCM for lookaside protocol

This patch add support for AES-128-GCM, when used in
lookaside protocol offload case.

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
5 years agocrypto/dpaa2_sec: support AES-GCM for lookaside protocol
Hemant Agrawal [Wed, 6 Nov 2019 05:17:24 +0000 (10:47 +0530)]
crypto/dpaa2_sec: support AES-GCM for lookaside protocol

AES-GCM is now supported for lookaside protocol offload also.

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
5 years agocrypto/dpaa_sec: support null cipher and null auth
Hemant Agrawal [Wed, 6 Nov 2019 05:17:23 +0000 (10:47 +0530)]
crypto/dpaa_sec: support null cipher and null auth

These are supported when using protocol offload mode or when
in chain mode.

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
5 years agocrypto/dpaa2_sec: support null cipher and null auth
Hemant Agrawal [Wed, 6 Nov 2019 05:17:22 +0000 (10:47 +0530)]
crypto/dpaa2_sec: support null cipher and null auth

These are supported when using protocol offload mode or in chain mode.

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
5 years agocrypto/dpaa_sec: add check for session validity
Hemant Agrawal [Wed, 6 Nov 2019 05:17:21 +0000 (10:47 +0530)]
crypto/dpaa_sec: add check for session validity

Check if the session is not null during processing.

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
5 years agocrypto/dpaa2_sec: add check for session validity
Hemant Agrawal [Wed, 6 Nov 2019 05:17:20 +0000 (10:47 +0530)]
crypto/dpaa2_sec: add check for session validity

Check if the session is not null during processing.

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
5 years agocrypto/dpaa_sec: fix PDCP capability flags
Hemant Agrawal [Wed, 6 Nov 2019 05:17:19 +0000 (10:47 +0530)]
crypto/dpaa_sec: fix PDCP capability flags

set the pdcp capa_flags to 0 by default.

Fixes: a1173d55598c ("crypto/dpaa_sec: support PDCP offload")
Cc: stable@dpdk.org
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
5 years agocrypto/aesni_gcm: support in-place chained mbufs
Pablo de Lara [Fri, 1 Nov 2019 13:39:23 +0000 (13:39 +0000)]
crypto/aesni_gcm: support in-place chained mbufs

IPSec Multi buffer library supports encryption on multiple segments.
When dealing with chained buffers (multiple segments), as long as
the operation is in-place, the destination buffer does not have to
be contiguous (unlike in the case of out-of-place operation).
Therefore, the limitation of not supporting in-place chained mbuf
can be removed.

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
5 years agodoc: support IPsec Multi-buffer lib v0.53
Pablo de Lara [Mon, 4 Nov 2019 09:32:46 +0000 (09:32 +0000)]
doc: support IPsec Multi-buffer lib v0.53

Updated AESNI MB and AESNI GCM PMD documentation guides
with information about the latest Intel IPSec Multi-buffer
library supported.

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
5 years agoexamples/ipsec-secgw: fix GCM IV length
Marcin Smoczynski [Thu, 31 Oct 2019 14:04:45 +0000 (15:04 +0100)]
examples/ipsec-secgw: fix GCM IV length

The example IPsec application does not work properly when using
AES-GCM with crypto_openssl.

ESP with AES-GCM uses standard 96bit long algorithm IV ([1]) which
later concatenated with be32(1) forms a J0 block. GCM specification
([2], chapter 7.1) states that when length of IV is different than
96b, in order to format a J0 block, GHASH function must be used.

According to specification ([2], chapter 5.1.1) GCM implementations
should support standard 96bit IVs, other lengths are optional. Every
DPDK cryptodev supports 96bit IV and few of them supports 128bit
IV as well (openssl, mrvl, ccp). When passing iv::length=16 to a
cryptodev which does support standard IVs only (e.g. qat) it
implicitly uses starting 96 bits. On the other hand, openssl follows
specification and uses GHASH to compute J0 for that case which results
in different than expected J0 values used for encryption/decryption.

Fix an inability to use AES-GCM with crypto_openssl by changing IV
length to the standard value of 12.

[1] RFC4106, section "4. Nonce format" and "3.1. Initialization Vector"
    https://tools.ietf.org/html/rfc4106
[2] NIST SP800-38D
    https://csrc.nist.gov/publications/detail/sp/800-38d/final

Fixes: 0fbd75a99f ("cryptodev: move IV parameters to session")
Cc: stable@dpdk.org
Signed-off-by: Marcin Smoczynski <marcinx.smoczynski@intel.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
5 years agocrypto/dpaa2_sec: fix length retrieved from hardware
Akhil Goyal [Tue, 5 Nov 2019 21:07:12 +0000 (02:37 +0530)]
crypto/dpaa2_sec: fix length retrieved from hardware

FD retrieved from SEC after crypto processing provides
an updated length of the buffer which need to be updated
in mbuf. The difference in length can be negative hence
changing diff to int32_t from uint32_t.

Fixes: 0a23d4b6f4c2 ("crypto/dpaa2_sec: support protocol offload IPsec")
Cc: stable@dpdk.org
Signed-off-by: Akhil Goyal <akhil.goyal@nxp.com>
5 years agoapp/test-sad: add sanity checks
Vladimir Medvedkin [Fri, 1 Nov 2019 11:38:34 +0000 (11:38 +0000)]
app/test-sad: add sanity checks

Coverity reported about two division by zero:
*** CID 350344:  Incorrect expression  (DIVIDE_BY_ZERO)
Although in fact these dividers will never be equal to 0,
adding explicit checks in lookup() to make coverity happy
will not affect the execution speed.

Fixes: 908be0651a5a ("app/test-sad: add test application for IPsec SAD")

Signed-off-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
5 years agoexamples/ipsec-secgw: add offload fallback tests
Marcin Smoczynski [Mon, 14 Oct 2019 13:48:42 +0000 (15:48 +0200)]
examples/ipsec-secgw: add offload fallback tests

Add tests for offload fallback feature; add inbound config modificator
SGW_CFG_XPRM_IN (offload fallback setting can be set only for inbound
SAs). Tests are using cryptodev for outbound SA.

To test fragmentation with QAT set:
MULTI_SEG_TEST="--reassemble=4096 --cryptodev_mask=0x5555"

Signed-off-by: Marcin Smoczynski <marcinx.smoczynski@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
Tested-by: Bernard Iremonger <bernard.iremonger@intel.com>
5 years agoexamples/ipsec-secgw: add fragment TTL option
Marcin Smoczynski [Mon, 14 Oct 2019 13:48:41 +0000 (15:48 +0200)]
examples/ipsec-secgw: add fragment TTL option

Due to fragment loss on highly saturated links and long fragment
lifetime, ipsec-secgw application quickly runs out of free reassembly
buckets. As a result new fragments are being dropped.

Introduce --frag-ttl option which allow user to lower default fragment
lifetime which solves problem of saturated reassembly buckets with high
bandwidth fragmented traffic.

Signed-off-by: Marcin Smoczynski <marcinx.smoczynski@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
Tested-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
5 years agoexamples/ipsec-secgw: support fallback session
Marcin Smoczynski [Mon, 14 Oct 2019 13:48:40 +0000 (15:48 +0200)]
examples/ipsec-secgw: support fallback session

Inline processing is limited to a specified subset of traffic. It is
often unable to handle more complicated situations, such as fragmented
traffic. When using inline processing such traffic is dropped.

Introduce fallback session for inline crypto processing allowing
handling packets that normally would be dropped. A fallback session is
configured by adding 'fallback' keyword with 'lookaside-none' parameter
to an SA configuration. Only 'inline-crypto-offload" as a primary
session and 'lookaside-none' as a fall-back session combination is
supported by this patch.

Fallback session feature is not available in the legacy mode.

Signed-off-by: Marcin Smoczynski <marcinx.smoczynski@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
Tested-by: Bernard Iremonger <bernard.iremonger@intel.com>
5 years agoexamples/ipsec-secgw: clean SA structure
Marcin Smoczynski [Mon, 14 Oct 2019 13:48:39 +0000 (15:48 +0200)]
examples/ipsec-secgw: clean SA structure

Cleanup ipsec_sa structure by removing every field that is already in
the rte_ipsec_session structure:
 * cryptodev/security session union
 * action type
 * offload flags
 * security context
References to abovementioned fields are changed to direct references
to matching fields of rte_ipsec_session structure.

Such refactoring is needed to introduce many sessions per SA feature,
e.g. fallback session for inline offload processing.

Signed-off-by: Marcin Smoczynski <marcinx.smoczynski@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Radu Nicolau <radu.nicolau@intel.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
Tested-by: Bernard Iremonger <bernard.iremonger@intel.com>
5 years agoci: remove LTO job
David Marchand [Fri, 8 Nov 2019 18:21:14 +0000 (19:21 +0100)]
ci: remove LTO job

The LTO job using gcc-7 has two issues at the moment:
- warnings about implicit fallthroughs trigger build errors:

In file included from ...common/include/rte_memory.h:22:0,
                 from ...linux/eal/eal_hugepage_info.c:24:
...common/include/rte_common.h: In function ‘rte_str_to_size’:
...common/include/rte_common.h:744:27: error: this statement may
  fall through [-Werror=implicit-fallthrough=]
  case 'G': case 'g': size *= 1024; /* fall-through */
                      ~~~~~^~~~~~~

- if we disable this warning, linking the binaries takes too much time
  and the job is terminated by Travis because it reaches the maximum
  time limit

Fixes: 098cc0fea3be ("build: add option to enable LTO")

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
5 years agomk: disable OCTEON TX2 on old compilers
Ali Alnubani [Mon, 4 Nov 2019 13:30:09 +0000 (15:30 +0200)]
mk: disable OCTEON TX2 on old compilers

This disables OCTEON TX2 for gcc 4.8.5 as the compiler is
emitting "internal compiler error" for aarch64.

Fixes: 9a8864c8b5da ("net/octeontx2: add build and doc infrastructure")
Cc: stable@dpdk.org
Signed-off-by: Ali Alnubani <alialnu@mellanox.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
5 years agomk: fix build on arm64
Ali Alnubani [Mon, 4 Nov 2019 13:30:08 +0000 (15:30 +0200)]
mk: fix build on arm64

OcteonTx was disabled for causing an internal compiler error on old gcc
versions.
See commit 4f760550a093 ("mk: disable OcteonTx for buggy compilers").

The condition that was added later to apply disabling OcteonTx
only on arm64 caused the condition to never be obeyed because it
compares ["arm64"] to [arm64].

This fixes the condition by using RTE_ARCH instead of CONFIG_RTE_ARCH,
because the former has the quotes removed, while the later doesn't.

Fixes: f3af3e44a444 ("mk: disable OcteonTx for buggy compilers only on arm64")
Cc: stable@dpdk.org
Signed-off-by: Ali Alnubani <alialnu@mellanox.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Jerin Jacob <jerinj@marvell.com>
5 years agodoc: disable dot graph in doxygen
Ali Alnubani [Wed, 23 Oct 2019 11:56:09 +0000 (14:56 +0300)]
doc: disable dot graph in doxygen

Ubuntu ships with a patched version of doxygen that enables
HAVE_DOT (disabled by default). Enabling this option causes the warning:
"""
warning: Included by graph for 'rte_common.h' not generated,
too many nodes. Consider increasing DOT_GRAPH_MAX_NODES
"""
This reproduces with doxygen version 1.8.13 and
dot - graphviz version 2.40.1 on Ubuntu 18.04.

This will force doxygen not to assume that dot (part of Graphviz)
is installed, and will result in dot not being used for visualization.

If someone still needs to generate the graphs, the following can
be considered:
- Increase DOT_GRAPH_MAX_NODES to a large value.
- Set HAVE_DOT for more powerful graphs.
- Set DOT_IMAGE_FORMAT=svg to generate svg images.
- Set INTERACTIVE_SVG=YES to allow zooming and panning.

See:
- http://changelogs.ubuntu.com/changelogs/pool/main/d/doxygen/doxygen_1.8.13-10/changelog
- http://www.doxygen.nl/manual/config.html#cfg_have_dot
- https://github.com/doxygen/doxygen/issues/7345

Signed-off-by: Ali Alnubani <alialnu@mellanox.com>
Acked-by: John McNamara <john.mcnamara@intel.com>
5 years agoevent/dpaa2: support ordered queue
Nipun Gupta [Wed, 6 Nov 2019 14:43:57 +0000 (20:13 +0530)]
event/dpaa2: support ordered queue

Ordered queue is supported on DPAA2. Enable this case.

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
5 years agoraw/dpaa2_qdma: support route by port in DMA
Nipun Gupta [Wed, 6 Nov 2019 14:43:56 +0000 (20:13 +0530)]
raw/dpaa2_qdma: support route by port in DMA

RBP or route by ports can help in translating the DMA
address over the PCI. Thus adding the RBP support with
long and short formats

Signed-off-by: Minghuan Lian <minghuan.lian@nxp.com>
Signed-off-by: Sachin Saxena <sachin.saxena@nxp.com>
Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
5 years agoexamples/l2fwd-event: fix build on RHEL 7.6
David Marchand [Fri, 8 Nov 2019 10:04:42 +0000 (11:04 +0100)]
examples/l2fwd-event: fix build on RHEL 7.6

CC l2fwd_event_generic.o
.../l2fwd_event_generic.c: In function
  ‘l2fwd_rx_tx_adapter_setup_generic’:
.../l2fwd_event_generic.c:203:3: error: missing initializer for field
  ‘impl_opaque’ of ‘struct <anonymous>’
  [-Werror=missing-field-initializers]
   }
   ^
In file included from .../l2fwd_event_generic.c:10:0:
.../include/rte_eventdev.h:1057:12: note: ‘impl_opaque’ declared here
    uint8_t impl_opaque;
            ^

  CC l2fwd_event_internal_port.o
.../l2fwd_event_internal_port.c: In function
  ‘l2fwd_rx_tx_adapter_setup_internal_port’:
.../l2fwd_event_internal_port.c:201:3: error: missing initializer for
  field ‘impl_opaque’ of ‘struct <anonymous>’
  [-Werror=missing-field-initializers]
   }
   ^
In file included from .../l2fwd_event_internal_port.c:10:0:
.../include/rte_eventdev.h:1057:12: note: ‘impl_opaque’ declared here
    uint8_t impl_opaque;
            ^

Fixes: 50f05aa6ed9a ("examples/l2fwd-event: setup Rx/Tx adapter")

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Kevin Traynor <ktraynor@redhat.com>
5 years agonet/bnxt: remove commented out code
Kevin Traynor [Wed, 6 Nov 2019 19:02:03 +0000 (19:02 +0000)]
net/bnxt: remove commented out code

This commented out todo and code is old. Remove it.

Fixes: b7435d660a8c ("net/bnxt: add ntuple filtering support")
Cc: stable@dpdk.org
Signed-off-by: Kevin Traynor <ktraynor@redhat.com>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
5 years agoevent/opdl: remove commented out code
Kevin Traynor [Wed, 6 Nov 2019 19:02:02 +0000 (19:02 +0000)]
event/opdl: remove commented out code

Some variables are commented out. Remove them.

Fixes: d548ef513cd7 ("event/opdl: add unit tests")
Cc: stable@dpdk.org
Signed-off-by: Kevin Traynor <ktraynor@redhat.com>
Acked-by: Liang Ma <liang.j.ma@intel.com>
5 years agocompress/octeontx: remove commented out code
Kevin Traynor [Wed, 6 Nov 2019 19:02:01 +0000 (19:02 +0000)]
compress/octeontx: remove commented out code

This code is commented out. Remove it.

Fixes: 43e610bb8565 ("compress/octeontx: introduce octeontx zip PMD")
Cc: stable@dpdk.org
Signed-off-by: Kevin Traynor <ktraynor@redhat.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
5 years agonet/ipn3ke: remove commented out code
Kevin Traynor [Wed, 6 Nov 2019 19:02:00 +0000 (19:02 +0000)]
net/ipn3ke: remove commented out code

These struct members and variable were commented out. Remove them.

Fixes: c01c748e4ae6 ("net/ipn3ke: add new driver")
Fixes: c820468ac99c ("net/ipn3ke: support TM")
Cc: stable@dpdk.org
Signed-off-by: Kevin Traynor <ktraynor@redhat.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
Reviewed-by: Rosen Xu <rosen.xu@intel.com>
5 years agonet/ipn3ke: remove useless if statement
Kevin Traynor [Wed, 6 Nov 2019 19:01:59 +0000 (19:01 +0000)]
net/ipn3ke: remove useless if statement

Coverity complains that this statement is not needed as the goto
label is on the next line anyway. Remove the if statement.

653        ret = ipn3ke_cfg_parse_i40e_pf_ethdev(afu_name, pf_name);
   CID 337930 (#1 of 1): Identical code for different branches
   (IDENTICAL_BRANCHES)identical_branches: The same code is executed
   when the condition ret is true or false, because the code in the
   if-then branch and after the if statement is identical. Should
   the if statement be removed?
654        if (ret)
655                goto end;
   implicit_else: The code from the above if-then branch is identical
   to the code after the if statement.
656end:

Coverity issue: 337930
Fixes: c01c748e4ae6 ("net/ipn3ke: add new driver")
Cc: stable@dpdk.org
Signed-off-by: Kevin Traynor <ktraynor@redhat.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
Reviewed-by: Rosen Xu <rosen.xu@intel.com>
5 years agonet/ipn3ke: fix TM commit check
Kevin Traynor [Wed, 6 Nov 2019 19:01:58 +0000 (19:01 +0000)]
net/ipn3ke: fix TM commit check

Coverity is complaining about identical code regardless of which branch
of the if else is taken. Functionally it means an error will always be
returned if this if else is hit. Remove the else branch.

    CID 337928 (#1 of 1): Identical code for different branches
    (IDENTICAL_BRANCHES)identical_branches: The same code is executed
    regardless of whether n->level != IPN3KE_TM_NODE_LEVEL_COS ||
    n->n_children != 0U is true, because the 'then' and 'else' branches
    are identical. Should one of the branches be modified, or the entire
    'if' statement replaced?
1506  if (n->level != IPN3KE_TM_NODE_LEVEL_COS ||
1507          n->n_children != 0) {
1508          return -rte_tm_error_set(error,
1509                  EINVAL,
1510                  RTE_TM_ERROR_TYPE_UNSPECIFIED,
1511                  NULL,
1512                  rte_strerror(EINVAL));
    else_branch: The else branch, identical to the then branch.
1513  } else {
1514          return -rte_tm_error_set(error,
1515                  EINVAL,
1516                  RTE_TM_ERROR_TYPE_UNSPECIFIED,
1517                  NULL,
1518                  rte_strerror(EINVAL));
1519  }

Coverity issue: 337928
Fixes: c820468ac99c ("net/ipn3ke: support TM")
Cc: stable@dpdk.org
Signed-off-by: Kevin Traynor <ktraynor@redhat.com>
Reviewed-by: Rosen Xu <rosen.xu@intel.com>
5 years agocommon/cpt: fix possible null dereference
Kevin Traynor [Wed, 6 Nov 2019 19:01:57 +0000 (19:01 +0000)]
common/cpt: fix possible null dereference

Coverity complains that ctrl_flags is set to NULL at the start
of the function and it may not have been set before there is a
jump to fc_success and it is dereferenced.

Check for NULL before dereference.

312fc_success:
   CID 344983 (#1 of 1): Explicit null dereferenced
   (FORWARD_NULL)7. var_deref_op: Dereferencing null pointer ctrl_flags.
313        *ctrl_flags = rte_cpu_to_be_64(*ctrl_flags);

Coverity issue: 344983
Fixes: 6cc54096520d ("crypto/octeontx: add supported sessions")
Cc: stable@dpdk.org
Signed-off-by: Kevin Traynor <ktraynor@redhat.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
5 years agonet/pcap: fix argument checks
Kevin Traynor [Wed, 6 Nov 2019 19:01:56 +0000 (19:01 +0000)]
net/pcap: fix argument checks

Previously rx/tx_queues were passed into eth_from_pcaps_common()
as ptrs and were checked for being NULL.

In commit da6ba28f0540 ("net/pcap: use a struct to pass user options")
that changed to pass in a ptr to a pmd_devargs_all which contains
the rx/tx_queues.

The parameter checking was not updated as part of that commit and
coverity caught that there was still a check if rx/tx_queues were
NULL, apparently after they had been dereferenced.

In fact as they are a members of the devargs_all struct, they will
not be NULL so remove those checks.

1231        struct pmd_devargs *rx_queues = &devargs_all->rx_queues;
1232        struct pmd_devargs *tx_queues = &devargs_all->tx_queues;
1233        const unsigned int nb_rx_queues = rx_queues->num_of_queue;
    deref_ptr: Directly dereferencing pointer tx_queues.
1234        const unsigned int nb_tx_queues = tx_queues->num_of_queue;
1235        unsigned int i;
1236
1237        /* do some parameter checking */
    CID 345004: Dereference before null check (REVERSE_INULL)
    [select issue]
1238        if (rx_queues == NULL && nb_rx_queues > 0)
1239                return -1;
    CID 345029 (#1 of 1): Dereference before null check (REVERSE_INULL)
    check_after_deref: Null-checking tx_queues suggests that it may be
    null, but it has already been dereferenced on all paths leading to
    the check.
1240        if (tx_queues == NULL && nb_tx_queues > 0)
1241                return -1;

Coverity issue: 345029
Coverity issue: 345044
Fixes: da6ba28f0540 ("net/pcap: use a struct to pass user options")
Cc: stable@dpdk.org
Signed-off-by: Kevin Traynor <ktraynor@redhat.com>
Acked-by: Cian Ferriter <cian.ferriter@intel.com>
5 years agocmdline: replace FreeBSD ifdef for IP address parsing
Thomas Monjalon [Wed, 6 Nov 2019 12:09:43 +0000 (13:09 +0100)]
cmdline: replace FreeBSD ifdef for IP address parsing

The constants like AF_INET are in sys/socket.h in FreeBSD.
The #ifdef macro __FreeBSD__ is replaced with RTE_EXEC_ENV_FREEBSD
in order to be consistent across DPDK files, and allow to grep
for EXEC_ENV among other benefits.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
5 years agoexamples/l3fwd: fix IP reserved address range
Stephen Hemminger [Tue, 5 Nov 2019 16:09:21 +0000 (08:09 -0800)]
examples/l3fwd: fix IP reserved address range

The original patch used incorrect subnet range for testing.

Fixes: 37afe381bde4 ("examples/l3fwd: use reserved IP addresses")
Cc: stable@dpdk.org
Reported-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Reported-by: Ferruh Yigit <ferruh.yigit@intel.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
5 years agonet/qede: clean LTO warnings
Andrzej Ostruszka [Thu, 7 Nov 2019 15:03:18 +0000 (16:03 +0100)]
net/qede: clean LTO warnings

During LTO build compiler reports some 'false positive' warnings about
variables being possibly used uninitialized.  This patch silences these
warnings.

Exemplary compiler warning to suppress (with LTO enabled):
error: ‘transceiver_type’ may be used uninitialized in this function
[-Werror=maybe-uninitialized]
  switch (transceiver_type) {

Signed-off-by: Andrzej Ostruszka <aostruszka@marvell.com>
5 years agonet/ifc: clean LTO warnings
Andrzej Ostruszka [Thu, 7 Nov 2019 15:03:17 +0000 (16:03 +0100)]
net/ifc: clean LTO warnings

During LTO build compiler reports some 'false positive' warnings about
variables being possibly used uninitialized.  This patch silences these
warnings.

Exemplary compiler warning to suppress (with LTO enabled):
error: ‘features’ may be used uninitialized in this function
[-Werror=maybe-uninitialized]
  if (RTE_VHOST_NEED_LOG(features)) {

Signed-off-by: Andrzej Ostruszka <aostruszka@marvell.com>
5 years agonet/i40e: clean LTO warnings
Andrzej Ostruszka [Thu, 7 Nov 2019 15:03:16 +0000 (16:03 +0100)]
net/i40e: clean LTO warnings

During LTO build compiler reports some 'false positive' warnings about
variables being possibly used uninitialized.  This patch silences these
warnings.

Exemplary compiler warning to suppress (with LTO enabled):
error: ‘filter_idx’ may be used uninitialized in this function
[-Werror=maybe-uninitialized]
  PMD_DRV_LOG(INFO, "Added port %d with AQ command with index %d",

Signed-off-by: Andrzej Ostruszka <aostruszka@marvell.com>
5 years agonet/e1000: clean LTO warnings
Andrzej Ostruszka [Thu, 7 Nov 2019 15:03:15 +0000 (16:03 +0100)]
net/e1000: clean LTO warnings

During LTO build compiler reports some 'false positive' warnings about
variables being possibly used uninitialized.  This patch silences these
warnings.

Exemplary compiler warning to suppress (with LTO enabled):
error: ‘link’ may be used uninitialized in this function
[-Werror=maybe-uninitialized]
  if (link) {

Signed-off-by: Andrzej Ostruszka <aostruszka@marvell.com>
5 years agonet/dpaa2: fix possible use of uninitialized vars
Andrzej Ostruszka [Thu, 7 Nov 2019 15:03:14 +0000 (16:03 +0100)]
net/dpaa2: fix possible use of uninitialized vars

This patch fixes 'maybe-uninitialized' warnings reported by compiler
when using LTO.

Compiler warning pointing to this error (with LTO enabled):
error: ‘kg_cfg.extracts[0].masks[0].mask’ may be used uninitialized in
this function [-Werror=maybe-uninitialized]
    extr->masks[j].mask = cfg->extracts[i].masks[j].mask;

Fixes: 16bbc98a3e63 ("bus/fslmc: update MC to 10.3.x")
Cc: stable@dpdk.org
Signed-off-by: Andrzej Ostruszka <aostruszka@marvell.com>
5 years agotest: clean LTO warnings
Andrzej Ostruszka [Thu, 7 Nov 2019 15:03:13 +0000 (16:03 +0100)]
test: clean LTO warnings

During LTO build compiler reports some 'false positive' warnings about
variables being possibly used uninitialized.  This patch silences these
warnings.

Exemplary compiler warning to suppress (with LTO enabled):
error: ‘stats.greatest_free_size’ may be used uninitialized in this
function [-Werror=maybe-uninitialized]
  return len - overhead;

Signed-off-by: Andrzej Ostruszka <aostruszka@marvell.com>
Acked-by: Yipeng Wang <yipeng1.wang@intel.com>
5 years agoevent/octeontx2: clean LTO warnings
Andrzej Ostruszka [Thu, 7 Nov 2019 15:03:12 +0000 (16:03 +0100)]
event/octeontx2: clean LTO warnings

During LTO build compiler reports some 'false positive' warnings about
variables being possibly used uninitialized.  This patch silences these
warnings.

Exemplary compiler warning to suppress (with LTO enabled):
error: ‘chunk’ may be used uninitialized in this function
[-Werror=maybe-uninitialized]
   bkt->current_chunk = (uintptr_t)chunk;

Signed-off-by: Andrzej Ostruszka <aostruszka@marvell.com>
5 years agoapp/eventdev: clean LTO warnings
Andrzej Ostruszka [Thu, 7 Nov 2019 15:03:11 +0000 (16:03 +0100)]
app/eventdev: clean LTO warnings

During LTO build compiler reports some 'false positive' warnings about
variables being possibly used uninitialized.  This patch silences these
warnings.

Exemplary compiler warning to suppress (with LTO enabled):
error: ‘service_id’ may be used uninitialized in this function
[-Werror=maybe-uninitialized]
    ret = evt_service_setup(service_id);

Signed-off-by: Andrzej Ostruszka <aostruszka@marvell.com>
Reviewed-by: Jerin Jacob <jerinj@marvell.com>
5 years agoeventdev: fix possible use of uninitialized var
Andrzej Ostruszka [Thu, 7 Nov 2019 15:03:10 +0000 (16:03 +0100)]
eventdev: fix possible use of uninitialized var

Fix the logic for the case of event queue allowing all schedule types.

Compiler warning pointing to this error (with LTO enabled):
error: ‘sched_type’ may be used uninitialized in this function
[-Werror=maybe-uninitialized]
  if ((ret < 0 && ret != -EOVERFLOW) ||

Fixes: 6750b21bd6af ("eventdev: add default software timer adapter")
Cc: stable@dpdk.org
Signed-off-by: Andrzej Ostruszka <aostruszka@marvell.com>
Reviewed-by: Jerin Jacob <jerinj@marvell.com>
5 years agobuild: add option to enable LTO
Andrzej Ostruszka [Thu, 7 Nov 2019 15:03:09 +0000 (16:03 +0100)]
build: add option to enable LTO

This patch adds an option to enable link time optimization.  In addition
to LTO option itself (-flto) fat-lto-objects are being used.  This is
because during the build pmdinfogen scans the generated ELF objects to
find this_pmd_name* symbol in symbol table.  Without fat-lto-objects gcc
produces ELF only with extra symbols for internal use during linking.

Signed-off-by: Andrzej Ostruszka <aostruszka@marvell.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
5 years agolib: annotate versioned functions
Andrzej Ostruszka [Thu, 7 Nov 2019 15:03:08 +0000 (16:03 +0100)]
lib: annotate versioned functions

Every implementation of a particular version of given symbol needs to be
marked in its declaration as such (using `__vsym` macro).  This patch
fixes this and also clarifies the documentation about that.

Signed-off-by: Andrzej Ostruszka <aostruszka@marvell.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
5 years agodoc: fix description of versioning macros
Andrzej Ostruszka [Thu, 7 Nov 2019 15:03:07 +0000 (16:03 +0100)]
doc: fix description of versioning macros

This patch fixes documentation of versioning macros so that they are
aligned with their implementation (no underscore is added by macros).

Fixes: f1ef9794f9bd ("doc: add ABI guidelines")
Cc: stable@dpdk.org
Signed-off-by: Andrzej Ostruszka <aostruszka@marvell.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
5 years agoport: fix build dependency
Rahul R Shah [Wed, 6 Nov 2019 14:43:20 +0000 (07:43 -0700)]
port: fix build dependency

The port library should be built after eventdev library.

Fixes: 5d92c4e592c4 ("port: add eventdev port type")
Cc: stable@dpdk.org
Signed-off-by: Rahul R Shah <rahul.r.shah@intel.com>
Tested-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
5 years agotest/atomic: add atomic 16/32/64-bit exchanges test
David Christensen [Wed, 6 Nov 2019 21:18:35 +0000 (13:18 -0800)]
test/atomic: add atomic 16/32/64-bit exchanges test

The test works by creating a token comprised of random data
and a CRC8 value, using the rte_atomicXX_exchange to exchange
the new token for a previously generated token, and then
verifying that the exchanged data is intact (i.e. the CRC8
is still correct for the data).

Signed-off-by: David Christensen <drc@linux.vnet.ibm.com>
Acked-by: David Marchand <david.marchand@redhat.com>
5 years agotest/rib: speed up rib6 autotests
Vladimir Medvedkin [Wed, 6 Nov 2019 12:21:47 +0000 (12:21 +0000)]
test/rib: speed up rib6 autotests

Split slow part of rib6_autotest into rib6_slow_autotest

Fixes: abab6d2966dc ("test/rib: add IPv6 autotests")

Signed-off-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>
Acked-by: Aaron Conole <aconole@redhat.com>
5 years agotest/rib: speed up rib autotests
Vladimir Medvedkin [Wed, 6 Nov 2019 12:21:46 +0000 (12:21 +0000)]
test/rib: speed up rib autotests

Split slow part of rib_autotest into rib_slow_autotest

Fixes: b35df4dd666e ("test/rib: add autotests")

Signed-off-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>
Acked-by: Aaron Conole <aconole@redhat.com>
5 years agovfio: fix DMA mapping of external heaps
Anatoly Burakov [Tue, 5 Nov 2019 15:15:12 +0000 (15:15 +0000)]
vfio: fix DMA mapping of external heaps

Currently, externally created heaps are supposed to be automatically
mapped for VFIO DMA by EAL, however they only do so if, at the time of
heap creation, VFIO is initialized and has at least one device
available. If no devices are available at the time of heap creation (or
if devices were available, but were since hot-unplugged, thus dropping
all VFIO container mappings), then VFIO mapping code would have skipped
over externally allocated heaps.

The fix is two-fold. First, we allow externally allocated memory
segments to be marked as "heap" segments. This allows us to distinguish
between external memory segments that were created via heap API, from
those that were created via rte_extmem_register() API.

Then, we fix the VFIO code to only skip non-heap external segments.
Also, since external heaps are not guaranteed to have valid IOVA
addresses, we will skip those which have invalid IOVA addresses as well.

Fixes: 0f526d674f8e ("malloc: separate creating memseg list and malloc heap")
Cc: stable@dpdk.org
Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Tested-by: Rajesh Ravi <rajesh.ravi@broadcom.com>
Acked-by: David Marchand <david.marchand@redhat.com>
5 years agovfio: remove deprecated DMA mapping functions
Anatoly Burakov [Thu, 24 Oct 2019 12:18:24 +0000 (13:18 +0100)]
vfio: remove deprecated DMA mapping functions

The rte_vfio_dma_map/unmap API's have been marked as deprecated in
release 19.05. Remove them.

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Acked-by: David Marchand <david.marchand@redhat.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
5 years agovfio: fix DMA mapping with default container
Anatoly Burakov [Mon, 4 Nov 2019 17:41:33 +0000 (17:41 +0000)]
vfio: fix DMA mapping with default container

When requesting DMA mapping to default container, we are meant to
supply the RTE_VFIO_DEFAULT_CONTAINER_FD value, however this is
not handled correctly by get_vfio_cfg_by_container_fd(), because
it only looks at actual fd values and does not check for this
special case.

Fix it to return default container if the fd requested is the
special RTE_VFIO_DEFAULT_CONTAINER_FD value.

Fixes: 4106d89a18f8 ("vfio: allow DMA map to the default container")
Cc: stable@dpdk.org
Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
Acked-by: Shahaf Shuler <shahafs@mellanox.com>
5 years agodoc: add application usage guide for l2fwd-event
Sunil Kumar Kori [Wed, 30 Oct 2019 17:03:47 +0000 (22:33 +0530)]
doc: add application usage guide for l2fwd-event

Add documentation for l2fwd-event example.
Update release notes.

Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
Acked-by: Nipun Gupta <nipun.gupta@nxp.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
5 years agoexamples/l2fwd-event: add graceful teardown
Pavan Nikhilesh [Wed, 30 Oct 2019 16:26:50 +0000 (21:56 +0530)]
examples/l2fwd-event: add graceful teardown

Add graceful teardown that addresses both event mode and poll mode.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Acked-by: Nipun Gupta <nipun.gupta@nxp.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
5 years agoexamples/l2fwd-event: add eventdev main loop
Pavan Nikhilesh [Wed, 30 Oct 2019 16:26:49 +0000 (21:56 +0530)]
examples/l2fwd-event: add eventdev main loop

Add event dev main loop based on enabled l2fwd options and eventdev
capabilities.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Acked-by: Nipun Gupta <nipun.gupta@nxp.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
5 years agoexamples/l2fwd-event: setup service core
Pavan Nikhilesh [Wed, 30 Oct 2019 16:26:48 +0000 (21:56 +0530)]
examples/l2fwd-event: setup service core

Setup service cores for eventdev and Rx/Tx adapter when they don't have
internal port capability.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Acked-by: Nipun Gupta <nipun.gupta@nxp.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
5 years agoexamples/l2fwd-event: setup Rx/Tx adapter
Sunil Kumar Kori [Wed, 30 Oct 2019 16:26:47 +0000 (21:56 +0530)]
examples/l2fwd-event: setup Rx/Tx adapter

Add event eth Rx/Tx adapter setup for both generic and internal port
event device pipelines.

Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Acked-by: Nipun Gupta <nipun.gupta@nxp.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
5 years agoexamples/l2fwd-event: setup event queue and port
Sunil Kumar Kori [Wed, 30 Oct 2019 16:26:46 +0000 (21:56 +0530)]
examples/l2fwd-event: setup event queue and port

Add event device queue and port setup based on event eth Tx adapter
capabilities.

Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Acked-by: Nipun Gupta <nipun.gupta@nxp.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
5 years agoexamples/l2fwd-event: setup event device
Sunil Kumar Kori [Wed, 30 Oct 2019 16:26:45 +0000 (21:56 +0530)]
examples/l2fwd-event: setup event device

Add event device device setup based on event eth Tx adapter
capabilities.

Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Acked-by: Nipun Gupta <nipun.gupta@nxp.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
5 years agoexamples/l2fwd-event: add infra to split eventdev framework
Sunil Kumar Kori [Wed, 30 Oct 2019 16:26:44 +0000 (21:56 +0530)]
examples/l2fwd-event: add infra to split eventdev framework

Add infra to split eventdev framework based on event Tx adapter
capability.
If event Tx adapter has internal port capability then we use
`rte_event_eth_tx_adapter_enqueue` to transmitting packets else
we use a SINGLE_LINK event queue to enqueue packets to a service
core which is responsible for transmitting packets.

Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Acked-by: Nipun Gupta <nipun.gupta@nxp.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
5 years agoexamples/l2fwd-event: add infra for eventdev
Pavan Nikhilesh [Wed, 30 Oct 2019 16:26:43 +0000 (21:56 +0530)]
examples/l2fwd-event: add infra for eventdev

Add infra to select event device as a mode to process packets through
command line arguments. Also, allow the user to select the schedule type
to be RTE_SCHED_TYPE_ORDERED, RTE_SCHED_TYPE_ATOMIC or
RTE_SCHED_TYPE_PARALLEL.

Usage:

`--mode="eventdev"` or `--mode="poll"`
`--eventq-sched="ordered"`, `--eventq-sched="atomic"` or
`--event-sched=parallel`

Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Acked-by: Nipun Gupta <nipun.gupta@nxp.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
5 years agoexamples/l2fwd-event: add default poll mode routines
Pavan Nikhilesh [Wed, 30 Oct 2019 16:26:42 +0000 (21:56 +0530)]
examples/l2fwd-event: add default poll mode routines

Add the default l2fwd poll mode routines similar to examples/l2fwd.

Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Acked-by: Nipun Gupta <nipun.gupta@nxp.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
5 years agoevent/octeontx2: remove hot spots by prefetching data
Pavan Nikhilesh [Wed, 23 Oct 2019 16:07:07 +0000 (21:37 +0530)]
event/octeontx2: remove hot spots by prefetching data

Recent profiling revealed few hotspots in octeontx2 event device
driver add prefetch hints to reduce stalls.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
5 years agoevent/octeontx2: use WFE while waiting for head
Pavan Nikhilesh [Wed, 23 Oct 2019 16:12:43 +0000 (21:42 +0530)]
event/octeontx2: use WFE while waiting for head

Use WFE to save power while waiting for tag to become head.

SSO signals EVENTI to allow cores to exit from wfe when they
are waiting for specific operations in which one of them is
setting HEAD bit in GWS_TAG.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Reviewed-by: Gavin Hu <gavin.hu@arm.com>
5 years agodoc: bump supported SDK and firmware version for DPAA2
Hemant Agrawal [Tue, 5 Nov 2019 07:59:07 +0000 (13:29 +0530)]
doc: bump supported SDK and firmware version for DPAA2

This patch bump the supported SDK and MC firmware version
to the latest.

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
5 years agoconfig: remove redundant DPAA2 build
Hemant Agrawal [Tue, 5 Nov 2019 07:59:06 +0000 (13:29 +0530)]
config: remove redundant DPAA2 build

dpaa and dpaa2 config have evolved to be same. The same binary
can now work across the platforms. So, there is no need to maintain
two different build configs.
The dpaa config shall work for both generation of dpaa platforms.

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
5 years agonet/bnx2x: fix meson build
Rasesh Mody [Wed, 6 Nov 2019 05:45:20 +0000 (21:45 -0800)]
net/bnx2x: fix meson build

Use kernel headers for __le* types to avoid potential conflicts
resulting in redefinition errors for some Linux build environments.
Add check for FreeBSD execution environments.

Without this fix, aarch64 builds can fail with error below:

In file included from ../drivers/net/bnx2x/bnx2x.h:22,
                 from ../drivers/net/bnx2x/bnx2x_ethdev.c:8:
../drivers/net/bnx2x/bnx2x_osal.h:27:17: error:
conflicting types for ‘uint64_t’
 #define __le64  uint64_t
               ^~~~~~~~
In file included from /usr/include/stdint.h:37,
                 from /usr/lib/gcc/aarch64-linux-gnu/8/include/stdint.h:9,
                 from ../lib/librte_eal/common/include/arch/arm/rte_byteorder.h:16,
                 from ../drivers/net/bnx2x/bnx2x.h:17,
                 from ../drivers/net/bnx2x/bnx2x_ethdev.c:8:
/usr/include/aarch64-linux-gnu/bits/stdint-uintn.h:27:20: note:
previous declaration of ‘uint64_t’ was here
 typedef __uint64_t uint64_t;
                    ^~~~~~~~

There is also one minor change mixed in this commit:
Some use of __FreeBSD__ are replaced by RTE_EXEC_ENV_FREEBSD.

Fixes: 38dff79ba736 ("net/bnx2x: update HSI")

Signed-off-by: Rasesh Mody <rmody@marvell.com>
Tested-by: Dharmik Thakkar <dharmik.thakkar@arm.com>
Tested-by: Gavin Hu <gavin.hu@arm.com>
5 years agotest/mempool: fix false positive result
Olivier Matz [Mon, 4 Nov 2019 10:06:23 +0000 (11:06 +0100)]
test/mempool: fix false positive result

The ret variable, initialized to -1, is changed to 0 during the test,
making the test successful in some cases where it should return a
failure.

Fix this by always using the GOTO_ERR() macro that sets the ret
variable before doing the goto.

Fixes: 923ceaeac140 ("test/mempool: add unit test cases")

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
5 years agomempool: use specific macro for object alignment
Olivier Matz [Tue, 5 Nov 2019 15:37:06 +0000 (16:37 +0100)]
mempool: use specific macro for object alignment

For consistency, RTE_MEMPOOL_ALIGN should be used in place of
RTE_CACHE_LINE_SIZE. They have the same value, because the only arch
that was defining a specific value for it has been removed from DPDK.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>
Acked-by: Nipun Gupta <nipun.gupta@nxp.com>
5 years agomempool: prevent objects from being across pages
Olivier Matz [Tue, 5 Nov 2019 15:37:05 +0000 (16:37 +0100)]
mempool: prevent objects from being across pages

When populating a mempool, ensure that objects are not located across
several pages, except if user did not request IOVA-contiguous objects.

Signed-off-by: Vamsi Attunuru <vattunuru@marvell.com>
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Nipun Gupta <nipun.gupta@nxp.com>
Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
5 years agomempool: introduce helpers for populate and required size
Olivier Matz [Tue, 5 Nov 2019 15:37:04 +0000 (16:37 +0100)]
mempool: introduce helpers for populate and required size

Introduce new functions that can used by mempool drivers to
calculate required memory size and to populate mempool.

For now, these helpers just replace the *_default() functions
without change. They will be enhanced in next commit.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Nipun Gupta <nipun.gupta@nxp.com>
Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>
5 years agomempool: introduce function to get mempool page size
Olivier Matz [Tue, 5 Nov 2019 15:37:03 +0000 (16:37 +0100)]
mempool: introduce function to get mempool page size

In rte_mempool_populate_default(), we determine the page size,
which is needed for calc_size and allocation of memory.

Move this in a function and export it, it will be used in a next
commit.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>
Acked-by: Nipun Gupta <nipun.gupta@nxp.com>
5 years agomempool: remove optimistic IOVA-contiguous allocation
Olivier Matz [Tue, 5 Nov 2019 15:37:02 +0000 (16:37 +0100)]
mempool: remove optimistic IOVA-contiguous allocation

The previous commit reduced the amount of required memory when
populating the mempool with non IOVA-contiguous memory.

Since there is no big advantage to have a fully iova-contiguous mempool
if it is not explicitly asked, remove this code, it simplifies the
populate function.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>
Acked-by: Nipun Gupta <nipun.gupta@nxp.com>
5 years agomempool: reduce wasted space on populate
Olivier Matz [Tue, 5 Nov 2019 15:37:01 +0000 (16:37 +0100)]
mempool: reduce wasted space on populate

The size returned by rte_mempool_op_calc_mem_size_default() is aligned
to the specified page size. Therefore, with big pages, the returned size
can be much more that what we really need to populate the mempool.

For instance, populating a mempool that requires 1.1GB of memory with
1GB hugepages can result in allocating 2GB of memory.

This problem is hidden most of the time due to the allocation method of
rte_mempool_populate_default(): when try_iova_contig_mempool=true, it
first tries to allocate an iova contiguous area, without the alignment
constraint. If it fails, it fallbacks to an aligned allocation that does
not require to be iova-contiguous. This can also fallback into several
smaller aligned allocations.

This commit changes rte_mempool_op_calc_mem_size_default() to relax the
alignment constraint to a cache line and to return a smaller size.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>
Acked-by: Nipun Gupta <nipun.gupta@nxp.com>
5 years agomempool: allow populating with unaligned virtual area
Olivier Matz [Tue, 5 Nov 2019 15:37:00 +0000 (16:37 +0100)]
mempool: allow populating with unaligned virtual area

rte_mempool_populate_virt() currently requires that both addr
and length are page-aligned.

Remove this unneeded constraint which can be annoying with big
hugepages (ex: 1GB).

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>
Acked-by: Nipun Gupta <nipun.gupta@nxp.com>
5 years agobus/fslmc: sanitize device name parsing for clarity
Shreyansh Jain [Tue, 5 Nov 2019 14:23:21 +0000 (19:53 +0530)]
bus/fslmc: sanitize device name parsing for clarity

remove unnecessary dup and free

Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
Reviewed-by: Nipun Gupta <nipun.gupta@nxp.com>
5 years agobus/dpaa: move QBMAN global init to bus
Hemant Agrawal [Tue, 5 Nov 2019 14:23:20 +0000 (19:53 +0530)]
bus/dpaa: move QBMAN global init to bus

DPAA SEC shall be able to work independent of DPAA ETH
driver.
This patch moves qbman init to bus, so that any driver
can use them even when no eth resources are present
or none of the eth devices are probed.

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
5 years agomempool/dpaa2: report error on endless loop in mbuf release
Radu Bulie [Tue, 5 Nov 2019 14:23:19 +0000 (19:53 +0530)]
mempool/dpaa2: report error on endless loop in mbuf release

When BMAN is not able to accept more buffers, it could be that
there are no FBPR's (internal mem provided to bman) left.
Report error in such condition.

Fixes: 5dc43d22b5ad ("mempool/dpaa2: add hardware offloaded mempool")
Cc: stable@dpdk.org
Signed-off-by: Radu Bulie <radu-andrei.bulie@nxp.com>
Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
5 years agoraw/dpaa2_cmdif: add retry and timeout in packet enqueue API
Nipun Gupta [Tue, 5 Nov 2019 14:23:18 +0000 (19:53 +0530)]
raw/dpaa2_cmdif: add retry and timeout in packet enqueue API

This patch adds retry in the DPAA2 CMDIF packet enqueue API

Fixes: 53c71586c789 ("raw/dpaa2_cmdif: support enqueue/dequeue operations")
Cc: stable@dpdk.org
Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
5 years agoraw/dpaa2_qdma: add retry and timeout in packet enqueue API
Nipun Gupta [Tue, 5 Nov 2019 14:23:17 +0000 (19:53 +0530)]
raw/dpaa2_qdma: add retry and timeout in packet enqueue API

This patch adds the logic in the DPAA2 QDMA packet enqueue API

Fixes: 4d9a3f2a0159 ("raw/dpaa2_qdma: support RBP mode")
Cc: stable@dpdk.org
Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
5 years agonet/dpaa2: add retry and timeout in packet enqueue API
Nipun Gupta [Tue, 5 Nov 2019 14:23:16 +0000 (19:53 +0530)]
net/dpaa2: add retry and timeout in packet enqueue API

In the packet transmit, if the QBMAN is not able to process the
packets, the Tx function loops infinitely to send the packet out.
This patch changes the logic retry for some time (count) and then
return.

Fixes: cd9935cec873 ("net/dpaa2: enable Rx and Tx operations")
Fixes: 16c4a3c46ab7 ("bus/fslmc: add enqueue response read in qbman")
Cc: stable@dpdk.org
Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Signed-off-by: Radu Bulie <radu-andrei.bulie@nxp.com>
5 years agocommon/dpaax: fallback to check separate memory node for VM
Nipun Gupta [Tue, 5 Nov 2019 14:23:15 +0000 (19:53 +0530)]
common/dpaax: fallback to check separate memory node for VM

In Virtual Machine the memory node in the device tree is at
'/proc/device-tree/memory/reg' which is separate from the memory
node path on the host. This patch enables check on both the paths.

Fixes: 2f3d633aa593 ("common/dpaax: add library for PA/VA translation table")
Cc: stable@dpdk.org
Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
5 years agonet/dpaa: fix LS1043 alignment check
Nipun Gupta [Tue, 5 Nov 2019 14:23:14 +0000 (19:53 +0530)]
net/dpaa: fix LS1043 alignment check

On LS1043, we are good to check 128 byte alignment of offset to
transmit out the packet

Fixes: f8c7a17a48c9 ("net/dpaa: support Tx scatter gather for non-DPAA buffer")
Cc: stable@dpdk.org
Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
5 years agonet/dpaa: fix supported RSS types
Nipun Gupta [Tue, 5 Nov 2019 14:23:13 +0000 (19:53 +0530)]
net/dpaa: fix supported RSS types

This patch fixes the supported RSS types on DPAA platform

Fixes: 15aa2a1b02e6 ("net/dpaa: update RSS offload types")
Cc: stable@dpdk.org
Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
5 years agotest/fib: add IPv6 performance autotests
Vladimir Medvedkin [Fri, 1 Nov 2019 15:21:45 +0000 (15:21 +0000)]
test/fib: add IPv6 performance autotests

Performance IPv6 tests for the FIB library.

Signed-off-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>
5 years agotest/fib: add performance autotests
Vladimir Medvedkin [Fri, 1 Nov 2019 15:21:44 +0000 (15:21 +0000)]
test/fib: add performance autotests

Performance tests for the new FIB library.

Signed-off-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>
5 years agotest/fib: add IPv6 autotests
Vladimir Medvedkin [Fri, 1 Nov 2019 15:21:43 +0000 (15:21 +0000)]
test/fib: add IPv6 autotests

Functional IPv6 tests for the FIB library.

Signed-off-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>
5 years agotest/fib: add autotests
Vladimir Medvedkin [Fri, 1 Nov 2019 15:21:42 +0000 (15:21 +0000)]
test/fib: add autotests

Functional tests for the new FIB library.

Signed-off-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>
5 years agofib: add dataplane algorithm for IPv6
Vladimir Medvedkin [Fri, 1 Nov 2019 15:21:41 +0000 (15:21 +0000)]
fib: add dataplane algorithm for IPv6

Add fib implementation for ipv6 using modified DIR24_8 algorithm.
Implementation is similar to current LPM6 implementation but has
few enhancements:
faster control plane operations
more bits for userdata in table entries
configurable userdata size

Signed-off-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>
5 years agofib: add DIR24-8 dataplane algorithm
Vladimir Medvedkin [Fri, 1 Nov 2019 15:21:40 +0000 (15:21 +0000)]
fib: add DIR24-8 dataplane algorithm

Add fib implementation for DIR24_8 algorithm for IPv4.
Implementation is similar to current LPM implementation but has
few enhancements:
faster control plane operations
more bits for userdata in table entries
configurable userdata size

Signed-off-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>
5 years agofib: support IPv6
Vladimir Medvedkin [Fri, 1 Nov 2019 15:21:39 +0000 (15:21 +0000)]
fib: support IPv6

Add FIB library support for IPv6.
It implements a dataplane structures and algorithms designed for
fast IPv6 longest prefix match.

Signed-off-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>
5 years agofib: add FIB library
Vladimir Medvedkin [Fri, 1 Nov 2019 15:21:38 +0000 (15:21 +0000)]
fib: add FIB library

Add FIB (Forwarding Information Base) library. This library
implements a dataplane structures and algorithms designed for
fast longest prefix match.
Internally it consists of two parts - RIB (control plane ops) and
implementation for the dataplane tasks.
Initial version provides two implementations for both IPv4 and IPv6:
dummy (uses RIB as a dataplane) and DIR24_8 (same as current LPM)
Due to proposed design it allows to extend FIB with new algorithms
in future (for example DXR, poptrie, etc).

Signed-off-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>
5 years agotest/rib: add IPv6 autotests
Vladimir Medvedkin [Fri, 1 Nov 2019 15:21:37 +0000 (15:21 +0000)]
test/rib: add IPv6 autotests

Functional tests for RIB6.

Signed-off-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>
5 years agorib: support IPv6
Vladimir Medvedkin [Fri, 1 Nov 2019 15:21:36 +0000 (15:21 +0000)]
rib: support IPv6

Extend RIB library with IPv6 support.

Signed-off-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>
5 years agotest/rib: add autotests
Vladimir Medvedkin [Fri, 1 Nov 2019 15:21:35 +0000 (15:21 +0000)]
test/rib: add autotests

Functional tests for the new RIB library.

Signed-off-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>
5 years agorib: add RIB library
Vladimir Medvedkin [Fri, 1 Nov 2019 15:21:34 +0000 (15:21 +0000)]
rib: add RIB library

Add RIB (Routing Information Base) library. This library
implements an IPv4 routing table optimized for control plane
operations. It implements a control plane struct containing routes
in a tree and provides fast add/del operations for routes.
Also it allows to perform fast subtree traversals
(i.e. retrieve existing subroutes for a given prefix).
This structure will be used as a control plane helper structure
for FIB implementation. Also it might be used standalone in other
different places such as bitmaps for example.
Internal implementation is level compressed binary trie.

Signed-off-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>
5 years agocrypto/dpaa2_sec: fix build with clang 3.4.2
Ciara Power [Thu, 31 Oct 2019 14:05:52 +0000 (14:05 +0000)]
crypto/dpaa2_sec: fix build with clang 3.4.2

Building with clang 3.4.2 caused the following error:

  CC dpaa2_sec_dpseci.o
In file included from /dpdk/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c:40:
In file included from /dpdk/drivers/common/dpaax/caamflib/desc/ipsec.h:11:
In file included from /dpdk/drivers/common/dpaax/caamflib/rta.h:11:
In file included from .../common/dpaax/caamflib/rta/sec_run_time_asm.h:14:
/dpdk/drivers/common/dpaax/compat.h:108:18:
error: redefinition of typedef 'dma_addr_t' is a C11 feature
[-Werror,-Wtypedef-redefinition]
typedef uint64_t        dma_addr_t;
                        ^
/dpdk/drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c:37:18:
note: previous definition is here
typedef uint64_t        dma_addr_t;
                        ^

The dma_addr_t was defined in the common compat.h file, and does not
need to be redefined.

The meson build include directories list was updated to enable the
definition in the common compat.h file be used.

Fixes: 8c83f28cc8a4 ("common/dpaax: move OF library from DPAA bus")

Signed-off-by: Ciara Power <ciara.power@intel.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
5 years agoconfig: disable IEEE1588 on DPAA2
Nipun Gupta [Thu, 31 Oct 2019 12:48:35 +0000 (18:18 +0530)]
config: disable IEEE1588 on DPAA2

This patch disables the 1588 timer support by default on DPAA2
platform due to the performance impact.
By default it is disabled in config/common_base, so remove the entry
from DPAA2.

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
5 years agobus/fslmc: fix resource leak
Agalya Babu RadhaKrishnan [Tue, 10 Sep 2019 07:30:55 +0000 (08:30 +0100)]
bus/fslmc: fix resource leak

1 issue caught by coverity (issue 344967).
Leaked_storage: Variable sep going out of scope leaks the
storage it points to.

When 'sep' is not null and sep_exist is 0, 'sep' is freed
before going out of scope of the function irrespective of
'addr' exists or not.

Coverity issue: 344967
Fixes: e67a61614d0b ("bus/fslmc: support device iteration")
Cc: stable@dpdk.org
Signed-off-by: Agalya Babu RadhaKrishnan <agalyax.babu.radhakrishnan@intel.com>
Acked-by: Sachin Saxena <sachin.saxena@nxp.com>