dpdk.git
6 years agocompressdev: add operation management
Fiona Trahe [Fri, 27 Apr 2018 13:23:58 +0000 (14:23 +0100)]
compressdev: add operation management

Added functions to allocate and free compression operations.

Signed-off-by: Fiona Trahe <fiona.trahe@intel.com>
Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Signed-off-by: Shally Verma <shally.verma@caviumnetworks.com>
Signed-off-by: Ashish Gupta <ashish.gupta@caviumnetworks.com>
6 years agocompressdev: add enqueue/dequeue functions
Fiona Trahe [Fri, 27 Apr 2018 13:23:57 +0000 (14:23 +0100)]
compressdev: add enqueue/dequeue functions

Signed-off-by: Fiona Trahe <fiona.trahe@intel.com>
Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Signed-off-by: Shally Verma <shally.verma@caviumnetworks.com>
Signed-off-by: Ashish Gupta <ashish.gupta@caviumnetworks.com>
6 years agocompressdev: add compression specific data
Fiona Trahe [Fri, 27 Apr 2018 13:23:56 +0000 (14:23 +0100)]
compressdev: add compression specific data

Added structures and enums specific to compression,
including the compression operation structure and the
different supported algorithms, checksums and compression
levels.

Signed-off-by: Fiona Trahe <fiona.trahe@intel.com>
Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Signed-off-by: Shally Verma <shally.verma@caviumnetworks.com>
Signed-off-by: Ashish Gupta <ashish.gupta@caviumnetworks.com>
6 years agocompressdev: add queue pair management
Fiona Trahe [Fri, 27 Apr 2018 13:23:55 +0000 (14:23 +0100)]
compressdev: add queue pair management

Add functions to manage device queue pairs.

Signed-off-by: Fiona Trahe <fiona.trahe@intel.com>
Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Signed-off-by: Shally Verma <shally.verma@caviumnetworks.com>
Signed-off-by: Ashish Gupta <ashish.gupta@caviumnetworks.com>
6 years agocompressdev: add basic device management
Fiona Trahe [Fri, 27 Apr 2018 13:23:54 +0000 (14:23 +0100)]
compressdev: add basic device management

Add basic functions to manage compress devices,
including driver and device allocation, and the basic
interface with compressdev PMDs.

Signed-off-by: Fiona Trahe <fiona.trahe@intel.com>
Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Signed-off-by: Shally Verma <shally.verma@caviumnetworks.com>
Signed-off-by: Ashish Gupta <ashish.gupta@caviumnetworks.com>
6 years agocrypto/scheduler: fix memory leak
Pablo de Lara [Thu, 26 Apr 2018 15:09:50 +0000 (16:09 +0100)]
crypto/scheduler: fix memory leak

If private context creation fails, the memory
allocated for it and for some of the rings created
was being leaked.
In case of failure, it must be freed.

Fixes: 4c07e0552f0a ("crypto/scheduler: add multicore scheduling mode")
Cc: stable@dpdk.org
Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Fan Zhang <roy.fan.zhang@intel.com>
6 years agocrypto/scheduler: set null pointer after freeing
Pablo de Lara [Thu, 26 Apr 2018 15:09:49 +0000 (16:09 +0100)]
crypto/scheduler: set null pointer after freeing

When freeing memory, pointers should be set to NULL,
to avoid memory corruption/segmentation faults.

Fixes: 31439ee72b2c ("crypto/scheduler: add API implementations")
Fixes: 50e14527b9d1 ("crypto/scheduler: improve parameters parsing")
Fixes: 57523e682bb7 ("crypto/scheduler: register operation functions")
Fixes: a783aa634410 ("crypto/scheduler: add packet size based mode")
Fixes: 4c07e0552f0a ("crypto/scheduler: add multicore scheduling mode")
Cc: stable@dpdk.org
Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Fan Zhang <roy.fan.zhang@intel.com>
6 years agocrypto/mrvl: rename PMD to mvsam
Tomasz Duszynski [Tue, 8 May 2018 08:14:04 +0000 (10:14 +0200)]
crypto/mrvl: rename PMD to mvsam

Picking a company stock ticker for a PMD name might not be a best approach
in a long run since name is too generic.

This patch addresses that and renames mrvl to mvsam.

Signed-off-by: Natalie Samsonov <nsamsono@marvell.com>
Signed-off-by: Tomasz Duszynski <tdu@semihalf.com>
6 years agoeventdev: make ethdev port identifiers 16-bit
Nikhil Rao [Wed, 9 May 2018 20:52:40 +0000 (02:22 +0530)]
eventdev: make ethdev port identifiers 16-bit

Ethernet port ID data size has been extended to 16 bits size 17.11
Update the Rx event adapter interface and implementation accordingly.

This commit bumps the library version to refect the ABI change
caused by extending the ethernet port parameter in Rx adapter
functions from 8 to 16 bits.

Fixes: 9c38b704d280 ("eventdev: add eth Rx adapter implementation")
Cc: stable@dpdk.org
Signed-off-by: Nikhil Rao <nikhil.rao@intel.com>
6 years agodoc: add event crypto adapter guide
Abhinandan Gujjar [Wed, 9 May 2018 08:18:01 +0000 (13:48 +0530)]
doc: add event crypto adapter guide

Add entries in the programmer's guide, API index, maintainer's file
and release notes for the event crypto adapter.

Signed-off-by: Abhinandan Gujjar <abhinandan.gujjar@intel.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
6 years agotest: add event crypto adapter auto-test
Abhinandan Gujjar [Wed, 9 May 2018 09:20:34 +0000 (14:50 +0530)]
test: add event crypto adapter auto-test

Added testsuite to test the crypto adapter functionality.
The testsuite detects the HW/SW event & crypto devices and
their capabilities. Depending upon the capability, adapter
is confgured and modes are tested.

Signed-off-by: Abhinandan Gujjar <abhinandan.gujjar@intel.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
6 years agoeventdev: add crypto adapter implementation
Abhinandan Gujjar [Wed, 9 May 2018 08:17:59 +0000 (13:47 +0530)]
eventdev: add crypto adapter implementation

This patch adds common code for the crypto adapter to support
SW and HW based transfer mechanisms. The adapter uses an EAL
service core function for SW based packet transfer and uses
the eventdev PMD functions to configure HW based packet
transfer between the crypto device and the event device.
This patch also adds adapter to the meson build system &
updates the necessary makefile & map file.

Signed-off-by: Abhinandan Gujjar <abhinandan.gujjar@intel.com>
Signed-off-by: Nikhil Rao <nikhil.rao@intel.com>
Signed-off-by: Gage Eads <gage.eads@intel.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
6 years agoeventdev: add driver interface of crypto adapter
Abhinandan Gujjar [Wed, 9 May 2018 08:17:58 +0000 (13:47 +0530)]
eventdev: add driver interface of crypto adapter

This patch defines capabilities & functions to be called
for eventdev PMDs.

Signed-off-by: Abhinandan Gujjar <abhinandan.gujjar@intel.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
6 years agoeventdev: introduce event crypto adapter
Abhinandan Gujjar [Wed, 9 May 2018 08:17:57 +0000 (13:47 +0530)]
eventdev: introduce event crypto adapter

This patch introduces event crypto adapter APIs. It
also provides information on working model/adapter
modes & their usage. Application is expected to use
this interface to transfer packets between the crypto
device & the event device.

Signed-off-by: Abhinandan Gujjar <abhinandan.gujjar@intel.com>
Signed-off-by: Nikhil Rao <nikhil.rao@intel.com>
Signed-off-by: Gage Eads <gage.eads@intel.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
6 years agoevent/dpaa2: remove link from info structure
Ashish Jain [Wed, 9 May 2018 09:20:53 +0000 (14:50 +0530)]
event/dpaa2: remove link from info structure

Removing use of link data under evq_info_t structure which was
used to check whether the the associated evq has been linked
or not. Since, an evq can be linked to multiple event ports,
thus setting the link variable only allowed the first event
port to be associated with the evq. This led to huge performance
drop in case of multiple event ports as I/O only worked on
first event port associated with the evq.

Fixes: 0ce3ce7c275c ("event/dpaa2: add configuration functions")
Cc: stable@dpdk.org
Signed-off-by: Ashish Jain <ashish.jain@nxp.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
6 years agoevent/dpaa2: remove check on epoll return
Nipun Gupta [Wed, 9 May 2018 09:20:52 +0000 (14:50 +0530)]
event/dpaa2: remove check on epoll return

Driver shouldn't take decision on signals received. The return
from epoll was blocking on EINTR which is not the right use-case.

Fixes: 36d87bb92230 ("event/dpaa2: handle timeout using interrupts in dequeue")
Cc: stable@dpdk.org
Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
6 years agotest: fix build with gcc 4.8.5
Erik Gabriel Carrillo [Mon, 7 May 2018 19:12:52 +0000 (14:12 -0500)]
test: fix build with gcc 4.8.5

Build errors occur on CentOS 7 with GCC 4.8.5 20150623 in the
event_timer_adapter_test autotest; the
-Werror=missing-field-initializers option causes the compiler to emit
messages like "error: missing initializer for field ‘priority’ of
‘struct <anonymous>’" in several places.

Add -Wno-missing-field-initializers to the test's CFLAGS to allow the
current syntax if we are using GCC 5.0 or lower.

Fixes: d1f3385d0076 ("test: add event timer adapter auto-test")

Signed-off-by: Erik Gabriel Carrillo <erik.g.carrillo@intel.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
6 years agomk: disable OcteonTx for buggy compilers
Pavan Nikhilesh [Mon, 7 May 2018 12:30:42 +0000 (18:00 +0530)]
mk: disable OcteonTx for buggy compilers

Disable octeontx for gcc 4.8.5 as compiler is emitting "internal
compiler error" for aarch64.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
Tested-by: Ali Alnubani <alialnu@mellanox.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
6 years agoevent/octeontx: fix SPDX tag placement
Pavan Nikhilesh [Mon, 23 Apr 2018 12:38:33 +0000 (18:08 +0530)]
event/octeontx: fix SPDX tag placement

Fixes: fd5baf09cdf9 ("event/octeontx: probe timvf PCIe devices")

Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
6 years agoeventdev: convert eth Rx adapter files to SPDX license tag
Nikhil Rao [Tue, 24 Apr 2018 22:32:21 +0000 (04:02 +0530)]
eventdev: convert eth Rx adapter files to SPDX license tag

Signed-off-by: Nikhil Rao <nikhil.rao@intel.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
6 years agodoc: update release notes for OcteonTx TIM driver
Pavan Nikhilesh [Fri, 20 Apr 2018 08:08:33 +0000 (13:38 +0530)]
doc: update release notes for OcteonTx TIM driver

Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
Acked-by: Marko Kovacevic <marko.kovacevic@intel.com>
6 years agoevent/octeontx: fix build with clang 6
Pavan Nikhilesh [Tue, 8 May 2018 21:26:00 +0000 (02:56 +0530)]
event/octeontx: fix build with clang 6

Clang 6 & 7 fail to naturally align packed structs due to this clang
can't use 8byte atomic primitives and splits them into lesser atomic
primitives. To use lesser atomic primitives we need to link libatomic
(-latomic), instead supply alignment attribute to the compiler.

timvf_worker.c:(.text+0x498): undefined reference to `__atomic_fetch_add_8'
timvf_worker.c:(.text+0x525): undefined reference to `__atomic_store_2'
timvf_worker.c:(.text+0x557): undefined reference to `__atomic_fetch_add_4'
timvf_worker.c:(.text+0x5de): undefined reference to `__atomic_store_2'

Fixes: f874c1eb1519 ("event/octeontx: create and free timer adapter")

Reported-by: Andrew Rybchenko <arybchenko@solarflare.com>
Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
6 years agotable: add dedicated params struct for cuckoo hash
Jasvinder Singh [Tue, 8 May 2018 14:17:18 +0000 (15:17 +0100)]
table: add dedicated params struct for cuckoo hash

Add dedicated parameter structure for cuckoo hash. The cuckoo hash from
librte_hash uses slightly different prototype for the hash function (no
key_mask parameter, 32-bit seed and return value) that require either
of the following approaches:
   1/ Function pointer conversion: gcc 8.1 warning [1], misleading [2]
   2/ Union within the parameter structure: pollutes a very generic API
      parameter structure with some implementation dependent detail
      (i.e. key mask not available for one of the available
      implementations)
   3/ Using opaque pointer for hash function: same issue from 2/
   4/ Different parameter structure: avoid issue from 2/; hopefully,
      it won't be long before librte_hash implements the key mask feature,
      so the generic API structure could be used.

[1] http://www.dpdk.org/ml/archives/dev/2018-April/094950.html
[2] http://www.dpdk.org/ml/archives/dev/2018-April/096250.html

Fixes: 5a80bf0ae613 ("table: add cuckoo hash")

Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
6 years agoexamples/ip_pipeline: replace strncpy with strlcpy
Jasvinder Singh [Tue, 17 Apr 2018 13:17:19 +0000 (14:17 +0100)]
examples/ip_pipeline: replace strncpy with strlcpy

The destination string may not have a null termination if
the source string's length is equal to the sizeof.

Fix by replacing strncpy with strlcpy that guarantees NULL-termination.

[merged several commits]

Coverty issue: 272606
Fixes: d75c371e9b46 ("examples/ip_pipeline: add pipeline object")
Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Coverty issue: 272594
Fixes: 133c2c6565d6 ("examples/ip_pipeline: add link object")
Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
Coverty issue: 272603
Fixes: 2f74ae28e23f ("examples/ip_pipeline: add tap object")
Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Coverity issue: 272588
Fixes: 6bfe74f8c93e ("examples/ip_pipeline: add mempool object")
Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>
Reviewed-by: Jasvinder Singh <jasvinder.singh@intel.com>
Coverity issue: 272592
Fixes: 25961ff3bcb9 ("examples/ip_pipeline: add traffic manager object")
Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>
Reviewed-by: Jasvinder Singh <jasvinder.singh@intel.com>
Coverity issue: 272562
Fixes: 9a408cc8ac ("examples/ip_pipeline: add KNI object")
Signed-off-by: Reshma Pattan <reshma.pattan@intel.com>
Reviewed-by: Jasvinder Singh <jasvinder.singh@intel.com>
Coverity issue: 272580
Fixes: 719374345c ("examples/ip_pipeline: add action profile objects")
Signed-off-by: Reshma Pattan <reshma.pattan@intel.com>
Reviewed-by: Jasvinder Singh <jasvinder.singh@intel.com>
Coverity issue: 272572
Fixes: 719374345cee ("examples/ip_pipeline: add action profile objects")
Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Coverity issue: 272563
Fixes: 8245472c58c8 ("examples/ip_pipeline: add sw queue object")
Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
6 years agoexamples/ip_pipeline: remove dead code in table command
Fan Zhang [Mon, 16 Apr 2018 10:58:20 +0000 (11:58 +0100)]
examples/ip_pipeline: remove dead code in table command

Coverity issue: 272567
Fixes: d75c371e9b46 ("examples/ip_pipeline: add pipeline object")

Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
Reviewed-by: Jasvinder Singh <jasvinder.singh@intel.com>
6 years agoexamples/ip_pipeline: fix uninitialized KNI parameter
Reshma Pattan [Wed, 18 Apr 2018 16:58:07 +0000 (17:58 +0100)]
examples/ip_pipeline: fix uninitialized KNI parameter

Using uninitialized value p.thread_id when calling kni_create.
Initialize the kni_params object to 0.

Coverity issue: 272569
Fixes: 9a408cc8ac ("examples/ip_pipeline: add KNI object")

Signed-off-by: Reshma Pattan <reshma.pattan@intel.com>
Reviewed-by: Jasvinder Singh <jasvinder.singh@intel.com>
6 years agoexamples/ip_pipeline: fix uninitialized link parameter
Fan Zhang [Fri, 20 Apr 2018 14:39:21 +0000 (15:39 +0100)]
examples/ip_pipeline: fix uninitialized link parameter

Coverity issue: 272575
Fixes: 133c2c6565d6 ("examples/ip_pipeline: add link object")

Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
Reviewed-by: Jasvinder Singh <jasvinder.singh@intel.com>
6 years agoexamples/ip_pipeline: fix leak on DSCP parsing
Jasvinder Singh [Mon, 16 Apr 2018 16:03:11 +0000 (17:03 +0100)]
examples/ip_pipeline: fix leak on DSCP parsing

Close the file stream before returning from the function to avoid
memory leak.

Coverity issue: 272605
Fixes: 2b82ef4861c0 ("examples/ip_pipeline: add DSCP table update command")

Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
6 years agoexamples/ip_pipeline: fix leak on tap creation failure
Reshma Pattan [Wed, 18 Apr 2018 16:58:09 +0000 (17:58 +0100)]
examples/ip_pipeline: fix leak on tap creation failure

Close tap device fd before returning upon failures.

Coverity issue: 272576
Fixes: 2f74ae28e2 ("examples/ip_pipeline: add tap object")

Signed-off-by: Reshma Pattan <reshma.pattan@intel.com>
Reviewed-by: Jasvinder Singh <jasvinder.singh@intel.com>
6 years agoexamples/ip_pipeline: fix leak on connection error
Kevin Laatz [Thu, 19 Apr 2018 11:04:18 +0000 (12:04 +0100)]
examples/ip_pipeline: fix leak on connection error

Closing the fd_server file descriptor on error to fix the resource leak.

Coverity issue: 272587
Fixes: 4bbf8e30aa5e ("examples/ip_pipeline: add CLI interface")

Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>
Reviewed-by: Jasvinder Singh <jasvinder.singh@intel.com>
6 years agoapp/testpmd: add command to resume a TM node
Tomasz Duszynski [Mon, 19 Feb 2018 07:46:19 +0000 (08:46 +0100)]
app/testpmd: add command to resume a TM node

Traffic manager provides an API for resuming
an arbitrary node in a hierarchy.

This commit adds support for calling this API
from testpmd.

Signed-off-by: Tomasz Duszynski <tdu@semihalf.com>
Reviewed-by: Jasvinder Singh <jasvinder.singh@intel.com>
6 years agoapp/testpmd: add command to suspend a TM node
Tomasz Duszynski [Mon, 19 Feb 2018 07:46:18 +0000 (08:46 +0100)]
app/testpmd: add command to suspend a TM node

Traffic manager provides an API for suspending
an arbitrary node in a hierarchy.

This commit adds support for calling this API from testpmd.

Signed-off-by: Tomasz Duszynski <tdu@semihalf.com>
Reviewed-by: Jasvinder Singh <jasvinder.singh@intel.com>
6 years agosched: add post-init pipe profile API
Jasvinder Singh [Fri, 4 May 2018 14:10:12 +0000 (15:10 +0100)]
sched: add post-init pipe profile API

Add new API function to add more pipe configuration profiles
post initialization to the set of exisitng profiles specified during
the creation of scheduler port.

This API removes the current limitation that forces the user
to define the full set of pipe profiles as the part of port parameters
while port is being created.

Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
6 years agoethdev: support WRED thresholds in bytes
Nikhil Rao [Tue, 20 Feb 2018 13:30:53 +0000 (08:30 -0500)]
ethdev: support WRED thresholds in bytes

WRED thresholds can be specified in bytes if the TM leaf
node supports it. Also extend WRED thresholds to 32 bits from 16.

TM capability (port/level/queue) fields cman_wred_packet_mode_supported and
cman_wred_byte_mode_supported, when non-zero, indicate support for WRED
thresholds in packets and bytes respectively.

The packet_mode member of struct rte_tm_wred_params, when non-zero,
indicates that the min and max thresholds are specified in
packets and when zero, indicates that the min and max thresholds
are specified in bytes.

Signed-off-by: Nikhil Rao <nikhil.rao@intel.com>
6 years agoethdev: fix TM API comment
Ben Shelton [Wed, 21 Mar 2018 15:45:33 +0000 (10:45 -0500)]
ethdev: fix TM API comment

The rte_tm_node_wfq_weight_mode_update() API function operates on
non-leaf nodes, not leaf nodes.

Signed-off-by: Ben Shelton <benjamin.h.shelton@intel.com>
6 years agoapp/testpmd: fix copy of raw flow item
Qi Zhang [Mon, 7 May 2018 09:50:44 +0000 (17:50 +0800)]
app/testpmd: fix copy of raw flow item

When calculate memory size of an RTE_FLOW_ITEM_TYPE_RAW 's mask
mask->length is not the real size of binary pattern, it should take
spec->length, or memory size will be over counted (0xffff) and invalid
memory be access during following memcpy.

Fixes: d0ad8648b1c5 ("app/testpmd: fix RSS flow action configuration")
Cc: stable@dpdk.org
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
6 years agomem: add argument to memory event callback
Anatoly Burakov [Thu, 3 May 2018 08:28:00 +0000 (09:28 +0100)]
mem: add argument to memory event callback

It may be useful to pass arbitrary data to the callback (such
as device pointers), so add this to the mem event callback API.

Suggested-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Tested-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Acked-by: Maxime Coquelin <maxime.coquelin@redhat.com>
6 years agomempool: fix alignment of memzone length when populating
Olivier Matz [Mon, 7 May 2018 08:18:01 +0000 (10:18 +0200)]
mempool: fix alignment of memzone length when populating

When populating a mempool with the default function, if there is not
enough virtually contiguous memory for the whole mempool, it will be
populated with several chunks. A chunk of the maximum available length
is requested with:

  mz = rte_memzone_reserve_aligned(..., len=0, ..., align=x)

If align is smaller than the page size, the address and the length of
the memzone may not be a multiple of the page size. This makes
rte_mempool_populate_virt() to fail because it requires them to be
page-aligned. This patch fixes that.

The problem can be reproduced easily by allocating more than available
memory:
  ./build/app/testpmd -l 0,1 -- --total-num-mbufs=65536
  ...
  Cause: Creation of mbuf pool for socket 0 failed: Invalid argument

After the patch, the error code is correct:
  ./build/app/testpmd -l 0,1 -- --total-num-mbufs=65536
  ...
  Cause: Creation of mbuf pool for socket 0 failed: Cannot allocate memory

Fixes: ba0009560c30 ("mempool: support new allocation methods")

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>
6 years agodoc: add DPAA2 CMDIF rawdev guide
Nipun Gupta [Fri, 4 May 2018 10:11:29 +0000 (15:41 +0530)]
doc: add DPAA2 CMDIF rawdev guide

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Acked-by: Marko Kovacevic <marko.kovacevic@intel.com>
Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>
6 years agoraw/dpaa2_cmdif: support enqueue/dequeue operations
Nipun Gupta [Fri, 4 May 2018 10:11:28 +0000 (15:41 +0530)]
raw/dpaa2_cmdif: support enqueue/dequeue operations

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>
6 years agoraw/dpaa2_cmdif: add attribute get functionality
Nipun Gupta [Fri, 4 May 2018 10:11:27 +0000 (15:41 +0530)]
raw/dpaa2_cmdif: add attribute get functionality

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>
6 years agoraw/dpaa2_cmdif: introduce DPAA2 command interface driver
Nipun Gupta [Fri, 4 May 2018 10:11:26 +0000 (15:41 +0530)]
raw/dpaa2_cmdif: introduce DPAA2 command interface driver

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>
6 years agobus/fslmc: keep Tx queues information for DPCI devices
Nipun Gupta [Fri, 4 May 2018 10:11:25 +0000 (15:41 +0530)]
bus/fslmc: keep Tx queues information for DPCI devices

The DPCI devices have both Tx and Rx queues. Event devices use
DPCI Rx queues only, but CMDIF (AIOP) uses both Tx and Rx queues.
This patch enables Tx queues configuration too.

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>
6 years agobus/fslmc: expose API to free DPCI device
Nipun Gupta [Fri, 4 May 2018 10:11:24 +0000 (15:41 +0530)]
bus/fslmc: expose API to free DPCI device

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>
6 years agomempool/dpaa2: add functions for CMDIF
Nipun Gupta [Fri, 4 May 2018 10:11:23 +0000 (15:41 +0530)]
mempool/dpaa2: add functions for CMDIF

There are two API's which are required by NXP specific Command Interface
Application (AIOP CMDIF). This patch exposes these two API's.

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>
6 years agodoc: add DPAA2 QDMA rawdev guide
Nipun Gupta [Thu, 3 May 2018 16:06:10 +0000 (21:36 +0530)]
doc: add DPAA2 QDMA rawdev guide

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>
6 years agoraw/dpaa2_qdma: support enqueue/dequeue operations
Nipun Gupta [Thu, 3 May 2018 16:06:09 +0000 (21:36 +0530)]
raw/dpaa2_qdma: support enqueue/dequeue operations

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>
6 years agoraw/dpaa2_qdma: support configuration APIs
Nipun Gupta [Thu, 3 May 2018 16:06:08 +0000 (21:36 +0530)]
raw/dpaa2_qdma: support configuration APIs

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>
6 years agoraw/dpaa2_qdma: introduce the DPAA2 QDMA driver
Nipun Gupta [Thu, 3 May 2018 16:06:07 +0000 (21:36 +0530)]
raw/dpaa2_qdma: introduce the DPAA2 QDMA driver

DPAA2 QDMA driver uses MC DPDMAI object. This driver enables
the user (app) to perform data DMA without involving CPU in
the DMA process

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>
6 years agobus/fslmc: add macros required by QDMA for FLE and FD
Nipun Gupta [Thu, 3 May 2018 16:06:06 +0000 (21:36 +0530)]
bus/fslmc: add macros required by QDMA for FLE and FD

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>
6 years agobus/fslmc: support scanning and probing of QDMA devices
Nipun Gupta [Thu, 3 May 2018 16:06:05 +0000 (21:36 +0530)]
bus/fslmc: support scanning and probing of QDMA devices

'dpdmai' devices detected on fsl-mc bus are represented by DPAA2 QDMA
devices in DPDK.

Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>
6 years agobus/fslmc: support MC DPDMAI object
Nipun Gupta [Thu, 3 May 2018 16:06:04 +0000 (21:36 +0530)]
bus/fslmc: support MC DPDMAI object

This patch adds the DPDMAI (Data Path DMA Interface)
object support in MC driver.

Signed-off-by: Cristian Sovaiala <cristian.sovaiala@nxp.com>
Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>
6 years agodrivers/raw: support meson build
Nipun Gupta [Thu, 3 May 2018 16:06:03 +0000 (21:36 +0530)]
drivers/raw: support meson build

Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
Signed-off-by: Nipun Gupta <nipun.gupta@nxp.com>
6 years agomaintainers: resign from vhost and vdev
Jianfeng Tan [Thu, 3 May 2018 09:52:01 +0000 (09:52 +0000)]
maintainers: resign from vhost and vdev

Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
6 years agoversion: 18.05-rc2
Thomas Monjalon [Wed, 2 May 2018 21:12:16 +0000 (23:12 +0200)]
version: 18.05-rc2

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
6 years agonet/ixgbe: check probing error
Declan Doherty [Wed, 2 May 2018 15:59:41 +0000 (16:59 +0100)]
net/ixgbe: check probing error

Add NULL parameter check for rte_eth_dev_allocated() API call to
eth_ixgbe_pci_probe().

Coverity Issue: 277216
Fixes: cf80ba6e2038 ("net/ixgbe: add support for representor ports")

Signed-off-by: Declan Doherty <declan.doherty@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
6 years agonet/ixgbe: fix probe with no devargs
Declan Doherty [Wed, 2 May 2018 15:59:40 +0000 (16:59 +0100)]
net/ixgbe: fix probe with no devargs

Initialise rte_ethdev_args parameters to zero to handle
the case where no devargs are passed to the IXGBE PF on
device probe, so that there is no invalid attempts to create
representor ports.

Coverity Issue: 277231
Fixes: cf80ba6e2038 ("net/ixgbe: add support for representor ports")

Signed-off-by: Declan Doherty <declan.doherty@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
6 years agonet/ixgbe: revert default PF device name
Declan Doherty [Wed, 2 May 2018 15:59:39 +0000 (16:59 +0100)]
net/ixgbe: revert default PF device name

Changes introduced by cf80ba6e2038 modified the default name generated
for the IXGBE PF PMD, this patch reverts the default name to the
original PCI BDBF.

Fixes: cf80ba6e2038 ("net/ixgbe: add support for representor ports")

Signed-off-by: Declan Doherty <declan.doherty@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
6 years agonet/axgbe: fix jumbo setting overwritten
Ravi Kumar [Wed, 2 May 2018 08:47:24 +0000 (04:47 -0400)]
net/axgbe: fix jumbo setting overwritten

Stored register value to enable jumbo frame was always
overwritten. Assigning value based on rx_buf_size.

Coverity issue: 277239
Fixes: 7c4158a5b592 ("net/axgbe: add DMA programming and start/stop")

Signed-off-by: Ravi Kumar <ravi1.kumar@amd.com>
6 years agonet/i40e: remove dependence on Tx queue flags
Qi Zhang [Wed, 2 May 2018 03:56:33 +0000 (11:56 +0800)]
net/i40e: remove dependence on Tx queue flags

Since we move to new offload APIs, txq_flags is no long needed.
This patch remove the dependence on that.

Fixes: 7497d3e2f777 ("net/i40e: convert to new Tx offloads API")

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
6 years agonet/i40e: fix queue offload initialization
Qi Zhang [Wed, 2 May 2018 03:56:32 +0000 (11:56 +0800)]
net/i40e: fix queue offload initialization

Add missing queue offload initialization.

Fixes: 7497d3e2f777 ("net/i40e: convert to new Tx offloads API")
Fixes: c3ac7c5b0b8a ("net/i40e: convert to new Rx offloads API")

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
6 years agonet/vmxnet3: convert to new Rx offload API
Louis Luo [Tue, 1 May 2018 21:22:56 +0000 (14:22 -0700)]
net/vmxnet3: convert to new Rx offload API

Ethdev RX offloads API has changed since: commit ce17eddefc20
("ethdev: introduce Rx queue offloads API")

This patch adopts the new RX Offload API in vmxnet3 driver.

Signed-off-by: Louis Luo <llouis@vmware.com>
Acked-by: Yong Wang <yongwang@vmware.com>
6 years agonet/dpaa2: add missing device info fields
Hemant Agrawal [Tue, 1 May 2018 10:44:28 +0000 (16:14 +0530)]
net/dpaa2: add missing device info fields

Add the hashed RSS support info and other fields in device info.

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
6 years agonet/dpaa: fix RSS hash support
Hemant Agrawal [Tue, 1 May 2018 10:44:27 +0000 (16:14 +0530)]
net/dpaa: fix RSS hash support

Fixes: 4fa5e0bbc573 ("net/dpaa: support hashed RSS")
Cc: stable@dpdk.org
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
6 years agonet/i40e: fix Tx function selection with new offloads
Bruce Richardson [Tue, 1 May 2018 14:13:54 +0000 (15:13 +0100)]
net/i40e: fix Tx function selection with new offloads

The Tx function selection code in the driver only used the older txq
flags values to check whether the scalar or vector functions should be
used. This caused performance regressions with testpmd io-fwd as the
scalar path rather than the vector one was being used in the default
case. Fix this by changing the code to take account of new offloads and
deleting the defines used for the old ones.

Fixes: 7497d3e2f777 ("net/i40e: convert to new Tx offloads API")

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
6 years agonet/i40e: revert default PF device name
Declan Doherty [Mon, 30 Apr 2018 15:30:20 +0000 (16:30 +0100)]
net/i40e: revert default PF device name

Changes introduced by e0cb96204b71 modified the default name generated
for the i40e PF PMD, this patch reverts the default name to the
original PCI BDF.

Fixes: e0cb96204b71 ("net/i40e: add support for representor ports")

Signed-off-by: Declan Doherty <declan.doherty@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
6 years agonet/mlx4: fix inner RSS support for broken kernels
Adrien Mazarguil [Thu, 26 Apr 2018 16:26:16 +0000 (18:26 +0200)]
net/mlx4: fix inner RSS support for broken kernels

Linux 4.15 and 4.16 may report inner RSS as a supported capability of the
device, however it can't be used due to missing code in the kernel.

This triggers an error when creating the default hash QP and prevents this
PMD from starting up without a prior call to rte_flow_isolate().

Fixes: 55e8991e3199 ("net/mlx4: restore inner VXLAN RSS support")
Cc: stable@dpdk.org
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
6 years agonet/mlx4: fix default RSS hash fields
Adrien Mazarguil [Thu, 26 Apr 2018 16:26:15 +0000 (18:26 +0200)]
net/mlx4: fix default RSS hash fields

Using special types value -1 with mlx4_conv_rss_types() is supposed to
return a supported set of Verbs RSS hash fields, that is, priv->hw_rss_sup
unmodified.

Due to the way this function is written and because it is also used to
initially populate priv->hw_rss_sup however, this special value works
properly only once and fails with ENOTSUP errors afterward.

This problem can be seen when re-creating default flows (e.g. by entering
and leaving isolated mode).

Fixes: 024e87bef40b ("net/mlx4: restore UDP RSS by probing capabilities")
Cc: stable@dpdk.org
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
6 years agonet/mlx4: fix Rx resource leak in case of error
Adrien Mazarguil [Thu, 26 Apr 2018 16:26:13 +0000 (18:26 +0200)]
net/mlx4: fix Rx resource leak in case of error

When creation of a flow rule fails during dev_start(), the usage count of
the common RSS context is not decremented, which triggers an assertion
failure in debug mode during dev_close().

This is addressed by tracking the initialization status of the common RSS
context in order to add missing cleanup code.

A similar issue exists in mlx4_rxq_attach(), where usage count is
incremented on a Rx queue but not released in case of error. This may lead
to the above issue since RSS contexts created by flow rules attach
themselves to Rx queues, incrementing their usage count.

Fixes: 5697a4142107 ("net/mlx4: relax Rx queue configuration order")
Cc: stable@dpdk.org
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
6 years agonet/mlx5: fix flow director rule deletion crash
Adrien Mazarguil [Thu, 26 Apr 2018 16:17:46 +0000 (18:17 +0200)]
net/mlx5: fix flow director rule deletion crash

Flow director rules matching traffic properties above layer 2 do not
target a fixed hash Rx queue (HASH_RXQ_ETH), it actually depends on the
highest protocol layer specified by each flow rule.

mlx5_fdir_filter_delete() makes this wrong assumption and causes a crash
when attempting to destroy flow rules with L3/L4 specifications.

Fixes: 4c3e9bcdd52e ("net/mlx5: support flow director")
Cc: stable@dpdk.org
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
6 years agoeal/x86: fix atomic exchange for 32-bit
Konstantin Ananyev [Wed, 2 May 2018 13:58:26 +0000 (14:58 +0100)]
eal/x86: fix atomic exchange for 32-bit

Should break out of loop when rte_atomic64_cmpset() returns non-zero.

Fixes: ff2863570fcc ("eal: introduce atomic exchange operation")

Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
Tested-by: Ferruh Yigit <ferruh.yigit@intel.com>
6 years agomalloc: avoid padding elements on page deallocation
Anatoly Burakov [Wed, 2 May 2018 15:38:16 +0000 (16:38 +0100)]
malloc: avoid padding elements on page deallocation

Currently, when deallocating pages, malloc will fixup other
elements' headers if there is not enough space to store a full
element in leftover space. This leads to race conditions because
there are some functions that check for pad size with an unlocked
heap, expecting pad size to be constant.

Fix it by being more conservative and only freeing pages when
there is enough space before and after the page to store a free
element.

Fixes: 1403f87d4fb8 ("malloc: enable memory hotplug support")

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
6 years agomalloc: set pad to 0 on free
Anatoly Burakov [Wed, 2 May 2018 15:38:15 +0000 (16:38 +0100)]
malloc: set pad to 0 on free

The pad value is not used unless element is in pad state, but it
will show up in heap dumps and may be confusing.

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
6 years agoeal: fix use-after-free on control thread creation
Jianfeng Tan [Wed, 2 May 2018 13:52:14 +0000 (13:52 +0000)]
eal: fix use-after-free on control thread creation

After below commit, we encounter some strange issue:
  1) Dead lock as described here:
     http://dpdk.org/ml/archives/dev/2018-April/099806.html
  2) SIGSEGV issue when starting a testpmd in VM.

Considering below commit changes to use dynamic memory instead of
stack for memory barrier, we doubt it's caused by use-after-free.

Fixes: 3d09a6e26d8b ("eal: fix threads block on barrier")

Reported-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Reported-by: Lei Yao <lei.a.yao@intel.com>
Suggested-by: Stephen Hemminger <stephen@networkplumber.org>
Suggested-by: Olivier Matz <olivier.matz@6wind.com>
Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
Reviewed-by: Olivier Matz <olivier.matz@6wind.com>
6 years agoeal: fix memory leak on control thread failure
Jianfeng Tan [Wed, 2 May 2018 10:26:32 +0000 (10:26 +0000)]
eal: fix memory leak on control thread failure

params is not freed if pthread_create() fails. The fix is
straight-forward.

Fixes: 3d09a6e26d8b ("eal: fix threads block on barrier")

Reported-by: Olivier Matz <olivier.matz@6wind.com>
Signed-off-by: Jianfeng Tan <jianfeng.tan@intel.com>
Reviewed-by: Olivier Matz <olivier.matz@6wind.com>
6 years agoethdev: remove error return on RSS hash check
Ferruh Yigit [Tue, 1 May 2018 13:33:43 +0000 (14:33 +0100)]
ethdev: remove error return on RSS hash check

Many sample applications fail because of
dev_info.flow_type_rss_offloads check in rte_eth_dev_configure()

The sample applications need to be fixed/updated before returning error
on rte_eth_dev_configure() and rte_eth_dev_rss_hash_update().

This patch keeps the error logs but removes returning errors.

Fixes: 8863a1fbfc66 ("ethdev: add supported hash function check")

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
6 years agoigb_uio: pass MODULE_CFLAGS in Kbuild
Luca Boccassi [Tue, 1 May 2018 13:50:33 +0000 (14:50 +0100)]
igb_uio: pass MODULE_CFLAGS in Kbuild

With the legacy build system MODULE_CFLAGS can be set to pass compiler
flags specific for the kernel modules builds.
This is used currently by Ubuntu and Debian.
Set ccflags-y in the Kbuild to achieve the same result with Meson, and
to keep backward compatbility with older scripts.

Fixes regression in Ubuntu/Debian when the Kbuild is included in the
DKMS source package, as DKMS will pick it up silently by default if
present, causing the MODULE_CFLAGS to be ignored.

Fixes: a52f4574f798 ("igb_uio: build with meson")
Cc: stable@dpdk.org
Signed-off-by: Luca Boccassi <bluca@debian.org>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
6 years agoexamples/flow_classify: fix validation in port init
Bernard Iremonger [Mon, 30 Apr 2018 13:43:54 +0000 (14:43 +0100)]
examples/flow_classify: fix validation in port init

The port_init function calls the rte_eth_dev_is_valid_port function.
This function now returns 1 if the port state is attached.
A return value of 1 now means a valid port.

Fixes: a9dbe1802226 ("fix ethdev port id validation")

Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
6 years agomalloc: fix heap size not set on init
Anatoly Burakov [Wed, 25 Apr 2018 13:42:55 +0000 (14:42 +0100)]
malloc: fix heap size not set on init

When heap initializes, we need to add already allocated segments
onto the heap. However, in doing that, we never increased total
heap size. Fix it by adding segment length to total heap length
when initializing the heap.

Fixes: 66cc45e293ed ("mem: replace memseg with memseg lists")

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
6 years agomem/linux: fix hugedir write deadlock
Anatoly Burakov [Mon, 30 Apr 2018 10:38:19 +0000 (11:38 +0100)]
mem/linux: fix hugedir write deadlock

At hugepage info initialization, EAL takes out a write lock on
hugetlbfs directories, and drops it after the memory init is
finished. However, in non-legacy mode, if "-m" or "--socket-mem"
switches are passed, this leads to a deadlock because EAL tries
to allocate pages (and thus take out a write lock on hugedir)
while still holding a separate hugedir write lock in EAL.

Fix it by checking if write lock in hugepage info is active, and
not trying to lock the directory if the hugedir fd is valid.

Fixes: 1a7dc2252f28 ("mem: revert to using flock and add per-segment lockfiles")

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Tested-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Tested-by: Shahaf Shuler <shahafs@mellanox.com>
Tested-by: Andrew Rybchenko <arybchenko@solarflare.com>
6 years agoversion: 18.05-rc1
Thomas Monjalon [Fri, 27 Apr 2018 22:26:04 +0000 (00:26 +0200)]
version: 18.05-rc1

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
6 years agodoc: update memory option usage for FreeBSD
Reshma Pattan [Fri, 27 Apr 2018 12:59:22 +0000 (13:59 +0100)]
doc: update memory option usage for FreeBSD

EAL option -m is supported in FreeBSD,
so move it under supported heading from non
supported heading.

Signed-off-by: Reshma Pattan <reshma.pattan@intel.com>
Reviewed-by: Anatoly Burakov <anatoly.burakov@intel.com>
6 years agomaintainers: call out subtree for bbdev and security
Pablo de Lara [Fri, 13 Apr 2018 08:14:39 +0000 (09:14 +0100)]
maintainers: call out subtree for bbdev and security

Commits for bbdev and security libraries are merged
into the Next Crypto subtree.

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
6 years agomaintainers: add backup for next-crypto tree
Akhil Goyal [Thu, 12 Apr 2018 08:32:16 +0000 (14:02 +0530)]
maintainers: add backup for next-crypto tree

Signed-off-by: Akhil Goyal <akhil.goyal@nxp.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
6 years agomaintainers: claim EAL memory init
Anatoly Burakov [Mon, 23 Apr 2018 12:29:57 +0000 (13:29 +0100)]
maintainers: claim EAL memory init

Claim maintainership of all areas of EAL memory init, including
OS-specific parts of it.

Also, claim maintainership of fbarray, since although it's not
related to memory allocation, it is heavily used by it and its
primary purpose is to serve memory allocation functions, and
thus will appear under "memory allocation" banner.

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
6 years agomem: revert to using flock and add per-segment lockfiles
Anatoly Burakov [Thu, 19 Apr 2018 10:20:21 +0000 (11:20 +0100)]
mem: revert to using flock and add per-segment lockfiles

The original implementation used flock() locks, but was later
switched to using fcntl() locks for page locking, because
fcntl() locks allow locking parts of a file, which is useful
for single-file segments mode, where locking the entire file
isn't as useful because we still need to grow and shrink it.

However, according to fcntl()'s Ubuntu manpage [1], semantics of
fcntl() locks have a giant oversight:

  This interface follows the completely stupid semantics of System
  V and IEEE Std 1003.1-1988 (“POSIX.1”) that require that all
  locks associated with a file for a given process are removed
  when any file descriptor for that file is closed by that process.
  This semantic means that applications must be aware of any files
  that a subroutine library may access.

Basically, closing *any* fd with an fcntl() lock (which we do because
we don't want to leak fd's) will drop the lock completely.

So, in this commit, we will be reverting back to using flock() locks
everywhere. However, that still leaves the problem of locking parts
of a memseg list file in single file segments mode, and we will be
solving it with creating separate lock files per each page, and
tracking those with flock().

We will also be removing all of this tailq business and replacing it
with a simple array - saving a few bytes is not worth the extra
hassle of dealing with pointers and potential memory allocation
failures. Also, remove the tailq lock since it is not needed - these
fd lists are per-process, and within a given process, it is always
only one thread handling access to hugetlbfs.

So, first one to allocate a segment will create a lockfile, and put
a shared lock on it. When we're shrinking the page file, we will be
trying to take out a write lock on that lockfile, which would fail if
any other process is holding onto the lockfile as well. This way, we
can know if we can shrink the segment file. Also, if no other locks
are found in the lock list for a given memseg list, the memseg list
fd is automatically closed.

One other thing to note is, according to flock() Ubuntu manpage [2],
upgrading the lock from shared to exclusive is implemented by dropping
and reacquiring the lock, which is not atomic and thus would have
created race conditions. So, on attempting to perform operations in
hugetlbfs, we will take out a writelock on hugetlbfs directory, so
that only one process could perform hugetlbfs operations concurrently.

[1] http://manpages.ubuntu.com/manpages/artful/en/man2/fcntl.2freebsd.html
[2] http://manpages.ubuntu.com/manpages/bionic/en/man2/flock.2.html

Fixes: 66cc45e293ed ("mem: replace memseg with memseg lists")
Fixes: 582bed1e1d1d ("mem: support mapping hugepages at runtime")
Fixes: a5ff05d60fc5 ("mem: support unmapping pages at runtime")
Fixes: 2a04139f66b4 ("eal: add single file segments option")

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
6 years agomem: add memalloc init stage
Anatoly Burakov [Thu, 19 Apr 2018 09:40:48 +0000 (10:40 +0100)]
mem: add memalloc init stage

Currently, memseg lists for secondary process are allocated on
sync (triggered by init), when they are accessed for the first
time. Move this initialization to a separate init stage for
memalloc.

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
6 years agomem: improve autodetection of hugepage counts on 32-bit
Anatoly Burakov [Tue, 24 Apr 2018 10:19:24 +0000 (11:19 +0100)]
mem: improve autodetection of hugepage counts on 32-bit

For non-legacy mode, we are preallocating space for hugepages, so
we know in advance which pages we will be able to allocate, and
which we won't. However, the init procedure was using hugepage
counts gathered from sysfs and paid no attention to hugepage
sizes that were actually available for reservation, and failed
on attempts to reserve unavailable pages.

Fix this by limiting total page counts by number of pages
actually preallocated.

Also, VA preallocate procedure only looks at mountpoints that are
available, and expects pages to exist if a mountpoint exists. That
might not necessarily be the case, so also check if there are
hugepages available for a particular page size on a particular
NUMA node.

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Tested-by: Jananee Parthasarathy <jananeex.m.parthasarathy@intel.com>
6 years agomem: improve preallocation on 32-bit
Anatoly Burakov [Fri, 20 Apr 2018 15:25:26 +0000 (16:25 +0100)]
mem: improve preallocation on 32-bit

Previously, if we couldn't preallocate VA space on 32-bit for
one page size, we simply bailed out, even though we could've
tried allocating VA space with other page sizes.

For example, if user had both 1G and 2M pages enabled, and
has asked DPDK to allocate memory on both sockets, DPDK
would've tried to allocate VA space for 1x1G page on both
sockets, failed and never tried again, even though it
could've allocated the same 1G of VA space for 512x2M pages.

Fix this by retrying with different page sizes if VA space
reservation failed.

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Tested-by: Jananee Parthasarathy <jananeex.m.parthasarathy@intel.com>
6 years agomem: fix 32-bit memory upper limit for non-legacy mode
Anatoly Burakov [Fri, 20 Apr 2018 15:25:25 +0000 (16:25 +0100)]
mem: fix 32-bit memory upper limit for non-legacy mode

32-bit mode has an upper limit on amount of VA space it can preallocate,
but the original implementation used the wrong constant, resulting in
failure to initialize due to integer overflow. Fix it by using the
correct constant.

Fixes: 66cc45e293ed ("mem: replace memseg with memseg lists")

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Tested-by: Jananee Parthasarathy <jananeex.m.parthasarathy@intel.com>
6 years agomalloc: check for heap corruption
Anatoly Burakov [Mon, 16 Apr 2018 15:04:27 +0000 (16:04 +0100)]
malloc: check for heap corruption

Previous code checked for both first/last elements being NULL,
but if they weren't, the expectation was that they're both
non-NULL, which will be the case under normal conditions, but
may not be the case due to heap structure corruption.

Coverity issue: 272566
Fixes: bb372060dad4 ("malloc: make heap a doubly-linked list")

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Acked-by: Harry van Haaren <harry.van.haaren@intel.com>
6 years agomalloc: fix out-of-bounds segment array access
Anatoly Burakov [Mon, 16 Apr 2018 16:45:00 +0000 (17:45 +0100)]
malloc: fix out-of-bounds segment array access

Technically, while the pointer would've been invalid if msl_idx
were invalid, we wouldn't have actually attempted to access the
pointer until verifying the index. Fix it by moving array access
to after we've verified validity of the index.

Coverity issue: 272574
Fixes: 66cc45e293ed ("mem: replace memseg with memseg lists")

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Acked-by: Harry van Haaren <harry.van.haaren@intel.com>
6 years agomalloc: replace snprintf with strlcpy
Anatoly Burakov [Tue, 17 Apr 2018 14:20:45 +0000 (15:20 +0100)]
malloc: replace snprintf with strlcpy

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Acked-by: Harry van Haaren <harry.van.haaren@intel.com>
6 years agomem: log page address before unmapping
Anatoly Burakov [Tue, 17 Apr 2018 10:57:52 +0000 (11:57 +0100)]
mem: log page address before unmapping

If user has specified a flag to unmap the area right after mapping it,
we were passing an already-unmapped pointer to RTE_LOG. This is not an
issue since RTE_LOG doesn't actually dereference the pointer, but fix
it anyway by moving call to RTE_LOG to before unmap.

Coverity issue: 272584
Fixes: b7cc54187ea4 ("mem: move virtual area function in common directory")

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
6 years agomem: fix page fault trigger
Anatoly Burakov [Fri, 27 Apr 2018 16:38:21 +0000 (17:38 +0100)]
mem: fix page fault trigger

Coverity reports these lines as having no effect. Technically, we do
want for those lines to have no effect, however they would've likely
been optimized out. Add volatile qualifiers to ensure the code has
effects.

Coverity issue: 272608
Fixes: 582bed1e1d1d ("mem: support mapping hugepages at runtime")

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
6 years agomem: fix potential bad unmap on map failure
Anatoly Burakov [Mon, 16 Apr 2018 14:37:30 +0000 (15:37 +0100)]
mem: fix potential bad unmap on map failure

Previously, if mmap failed to map page address at requested
address, we were attempting to unmap the wrong address. Fix it
by unmapping our actual mapped address, and jump further to
avoid unmapping memory that is not allocated.

Coverity issue: 272602
Fixes: 582bed1e1d1d ("mem: support mapping hugepages at runtime")

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
6 years agomem: fix comparison of old policy
Anatoly Burakov [Mon, 16 Apr 2018 16:18:55 +0000 (17:18 +0100)]
mem: fix comparison of old policy

Previous code had an old rebase leftover from the time when
oldpolicy was an actual int, instead of a pointer. Fix it to
do comparison with dereferencing the pointer.

Coverity issue: 272589
Fixes: 582bed1e1d1d ("mem: support mapping hugepages at runtime")

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
6 years agomem: fix potential resource leak on alloc
Anatoly Burakov [Mon, 16 Apr 2018 15:37:03 +0000 (16:37 +0100)]
mem: fix potential resource leak on alloc

Normally, tailq entry should have a valid fd by the time we attempt
to map the segment. However, in case it doesn't, we're leaking fd,
so fix it.

Coverity issue: 272570
Fixes: 2a04139f66b4 ("eal: add single file segments option")

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
6 years agomem: fix potential resource leak on freeing
Anatoly Burakov [Mon, 16 Apr 2018 15:31:08 +0000 (16:31 +0100)]
mem: fix potential resource leak on freeing

We close fd if we managed to find it in the list of allocated
segment lists (which should always be the case under normal
conditions), but if we didn't, the fd was leaking. Close it if
we couldn't find it in the segment list. This is not an issue
as if the segment is zero length, we're getting rid of it
anyway, so there's no harm in not storing the fd anywhere.

Coverity issue: 272568
Fixes: 2a04139f66b4 ("eal: add single file segments option")

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
6 years agomem: fix potential double close on map failure
Anatoly Burakov [Mon, 16 Apr 2018 15:11:55 +0000 (16:11 +0100)]
mem: fix potential double close on map failure

We were closing descriptor before checking if mapping has
failed, but if it did, we did a second close afterwards. Fix
it by moving closing descriptor to after we've done all error
checks.

Coverity issue: 272560
Fixes: 2a04139f66b4 ("eal: add single file segments option")

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>