dpdk.git
6 years agomalloc: enable event callbacks for external memory
Anatoly Burakov [Tue, 2 Oct 2018 13:34:55 +0000 (14:34 +0100)]
malloc: enable event callbacks for external memory

When adding or removing external memory from the memory map, there
may be actions that need to be taken on account of this memory (e.g.
DMA mapping). Add support for triggering callbacks when adding,
removing, attaching or detaching external memory.

Some memory event callback handlers will need additional logic to
handle external memory regions. For example, virtio callback has to
completely ignore externally allocated memory, because there is no
way to find file descriptors backing the memory address in a
generic fashion. All other callbacks have also been adjusted to
handle RTE_BAD_IOVA as IOVA address, as this is one of the expected
use cases for external memory support.

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
6 years agomalloc: allow detaching from external memory
Anatoly Burakov [Tue, 2 Oct 2018 13:34:54 +0000 (14:34 +0100)]
malloc: allow detaching from external memory

Add API to detach from existing chunk of external memory in a
process.

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
6 years agomalloc: allow attaching to external memory chunks
Anatoly Burakov [Tue, 2 Oct 2018 13:34:53 +0000 (14:34 +0100)]
malloc: allow attaching to external memory chunks

In order to use external memory in multiple processes, we need to
attach to primary process's memseg lists, so add a new API to do
that. It is the responsibility of the user to ensure that memory
is accessible and that it has been previously added to the malloc
heap by another process.

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
6 years agomalloc: allow removing memory from named heaps
Anatoly Burakov [Tue, 2 Oct 2018 13:34:52 +0000 (14:34 +0100)]
malloc: allow removing memory from named heaps

Add an API to remove memory from specified heaps. This will first
check if all elements within the region are free, and that the
region is the original region that was added to the heap (by
comparing its length to length of memory addressed by the
underlying memseg list).

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
6 years agomalloc: allow adding memory to named heaps
Anatoly Burakov [Tue, 2 Oct 2018 13:34:51 +0000 (14:34 +0100)]
malloc: allow adding memory to named heaps

Add an API to add externally allocated memory to malloc heap. The
memory will be stored in memseg lists like regular DPDK memory.
Multiple segments are allowed within a heap. If IOVA table is
not provided, IOVA addresses are filled in with RTE_BAD_IOVA.

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
6 years agomalloc: allow destroying heaps
Anatoly Burakov [Tue, 2 Oct 2018 13:34:50 +0000 (14:34 +0100)]
malloc: allow destroying heaps

Add an API to destroy specified heap.

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
6 years agomalloc: allow creating malloc heaps
Anatoly Burakov [Tue, 2 Oct 2018 13:34:49 +0000 (14:34 +0100)]
malloc: allow creating malloc heaps

Add API to allow creating new malloc heaps. They will be created
with socket ID's going above RTE_MAX_NUMA_NODES, to avoid clashing
with internal heaps.

This breaks the ABI, so document the change.

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
6 years agomalloc: add function to check if socket is external
Anatoly Burakov [Tue, 2 Oct 2018 13:34:48 +0000 (14:34 +0100)]
malloc: add function to check if socket is external

An API is needed to check whether a particular socket ID belongs
to an internal or external heap. Prime user of this would be
mempool allocator, because normal assumptions of IOVA
contiguousness in IOVA as VA mode do not hold in case of
externally allocated memory.

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
6 years agomalloc: add function to query socket ID of named heap
Anatoly Burakov [Tue, 2 Oct 2018 13:34:47 +0000 (14:34 +0100)]
malloc: add function to query socket ID of named heap

When we will be creating external heaps, they will have their own
"fake" socket ID, so add a function that will map the heap name
to its socket ID.

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
6 years agomalloc: add name to malloc heaps
Anatoly Burakov [Tue, 2 Oct 2018 13:34:46 +0000 (14:34 +0100)]
malloc: add name to malloc heaps

We will need to refer to external heaps in some way. While we use
heap ID's internally, for external API use it has to be something
more user-friendly. So, we will be using a string to uniquely
identify a heap.

This breaks the ABI, so document the change.

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
6 years agosched: do not check for invalid socket ID
Anatoly Burakov [Tue, 2 Oct 2018 13:34:45 +0000 (14:34 +0100)]
sched: do not check for invalid socket ID

We will be assigning "invalid" socket ID's to external heap, and
malloc will now be able to verify if a supplied socket ID is in
fact a valid one, rendering parameter checks for sockets
obsolete.

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
6 years agopipeline: do not check for invalid socket ID
Anatoly Burakov [Tue, 2 Oct 2018 13:34:44 +0000 (14:34 +0100)]
pipeline: do not check for invalid socket ID

We will be assigning "invalid" socket ID's to external heap, and
malloc will now be able to verify if a supplied socket ID is in
fact a valid one, rendering parameter checks for sockets
obsolete.

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
6 years agoflow_classify: do not check for invalid socket ID
Anatoly Burakov [Tue, 2 Oct 2018 13:34:43 +0000 (14:34 +0100)]
flow_classify: do not check for invalid socket ID

We will be assigning "invalid" socket ID's to external heap, and
malloc will now be able to verify if a supplied socket ID is in
fact a valid one, rendering parameter checks for sockets
obsolete.

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
6 years agomem: do not check for invalid socket ID
Anatoly Burakov [Tue, 2 Oct 2018 13:34:42 +0000 (14:34 +0100)]
mem: do not check for invalid socket ID

We will be assigning "invalid" socket ID's to external heap, and
malloc will now be able to verify if a supplied socket ID is in
fact a valid one, rendering parameter checks for sockets
obsolete.

This changes the semantics of what we understand by "socket ID",
so document the change in the release notes.

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
6 years agomalloc: index heaps using heap ID rather than NUMA node
Anatoly Burakov [Tue, 2 Oct 2018 13:34:41 +0000 (14:34 +0100)]
malloc: index heaps using heap ID rather than NUMA node

Switch over all parts of EAL to use heap ID instead of NUMA node
ID to identify heaps. Heap ID for DPDK-internal heaps is NUMA
node's index within the detected NUMA node list. Heap ID for
external heaps will be order of their creation.

This breaks the ABI, so document the changes.

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
6 years agomem: allow memseg lists to be marked as external
Anatoly Burakov [Tue, 2 Oct 2018 13:34:40 +0000 (14:34 +0100)]
mem: allow memseg lists to be marked as external

When we allocate and use DPDK memory, we need to be able to
differentiate between DPDK hugepage segments and segments that
were made part of DPDK but are externally allocated. Add such
a property to memseg lists.

This breaks the ABI, so document the change in release notes.
This also breaks a few internal assumptions about memory
contiguousness, so adjust malloc code in a few places.

All current calls for memseg walk functions were adjusted to
ignore external segments where it made sense.

Mempools is a special case, because we may be asked to allocate
a mempool on a specific socket, and we need to ignore all page
sizes on other heaps or other sockets. Previously, this
assumption of knowing all page sizes was not a problem, but it
will be now, so we have to match socket ID with page size when
calculating minimum page size for a mempool.

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
Acked-by: Yongseok Koh <yskoh@mellanox.com>
6 years agomem: add length to memseg list
Anatoly Burakov [Tue, 2 Oct 2018 13:34:39 +0000 (14:34 +0100)]
mem: add length to memseg list

Previously, to calculate length of memory area covered by a memseg
list, we would've needed to multiply page size by length of fbarray
backing that memseg list. This is not obvious and unnecessarily
low level, so store length in the memseg list itself.

This breaks ABI, so bump the EAL ABI version and document the
change. Also, while we're breaking ABI, pack the members a little
better.

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>
6 years agoeventdev: fix build
Ferruh Yigit [Tue, 9 Oct 2018 10:13:22 +0000 (11:13 +0100)]
eventdev: fix build

build error:
.../lib/librte_eventdev/rte_event_eth_tx_adapter.c:
  In function ‘txa_service_queue_del’:
.../lib/librte_eventdev/rte_event_eth_tx_adapter.c:800:7:
  error: ‘ret’ may be used uninitialized in this function
  [-Werror=maybe-uninitialized]
compilation terminated due to -Wfatal-errors.

https://mails.dpdk.org/archives/test-report/2018-October/065919.html

'ret' may be used uninitialized when 'dev->data->nb_tx_queues' is 0,
although this is not a practical value, initialize 'ret' to cover this
case.

Fixes: a3bbf2e09756 ("eventdev: add eth Tx adapter implementation")

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
6 years agonet/ifc: fix build with Linux < 3.19
Xiao Wang [Mon, 8 Oct 2018 04:32:04 +0000 (12:32 +0800)]
net/ifc: fix build with Linux < 3.19

The typedef of "__virtio16" is introduced into Linux kernel in v3.19.
To prevent build error on old kernel, this patch replaces the
"__virtio" usage with "uint16_t".

Fixes: d7fe5a2861e7 ("net/ifc: support live migration")

Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
6 years agoevent/dpaa: support select based event
Hemant Agrawal [Tue, 25 Sep 2018 07:02:35 +0000 (12:32 +0530)]
event/dpaa: support select based event

This patch add support to use select call with qman portal fd
for timeout based dequeue request for eventdev.

If there is a event available qman portal fd will be set
and the function will be awakened. If no event is available,
it will only wait till the given timeout value.

In case of interrupt the timeout ticks are used as usecs.

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
6 years agoevent/dpaa: remove duplicate log macros
Hemant Agrawal [Tue, 25 Sep 2018 07:02:34 +0000 (12:32 +0530)]
event/dpaa: remove duplicate log macros

align and cleanup the debug log prints

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
6 years agoevent/dsw: fix build with icc
Mattias Rönnblom [Thu, 4 Oct 2018 11:21:13 +0000 (13:21 +0200)]
event/dsw: fix build with icc

Make the -Wno-format-nonliteral flag conditional, and only set in
clang and gcc builds, since this flag is not supported (nor needed)
when building dsw with icc.

Fixes: 46a186b1f0c5 ("event/dsw: add device registration and build system")

Signed-off-by: Mattias Rönnblom <mattias.ronnblom@ericsson.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
6 years agovfio: allow mapping MSI-X BARs if kernel allows it
Anatoly Burakov [Thu, 20 Sep 2018 13:11:13 +0000 (14:11 +0100)]
vfio: allow mapping MSI-X BARs if kernel allows it

Currently, DPDK will skip mapping some areas (or even an entire BAR)
if MSI-X table happens to be in them but is smaller than page size.

Kernels 4.16+ will allow mapping MSI-X BARs [1], and will report this
as a capability flag. Capability flags themselves are also only
supported since kernel 4.6 [2].

This commit will introduce support for checking VFIO capabilities,
and will use it to check if we are allowed to map BARs with MSI-X
tables in them, along with backwards compatibility for older
kernels, including a workaround for a variable rename in VFIO
region info structure [3].

[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/
linux.git/commit/?id=a32295c612c57990d17fb0f41e7134394b2f35f6

[2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/
linux.git/commit/?id=c84982adb23bcf3b99b79ca33527cd2625fbe279

[3] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/
linux.git/commit/?id=ff63eb638d63b95e489f976428f1df01391e15e4

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
6 years agomem: fix undefined behavior in NUMA-aware mapping
Anatoly Burakov [Fri, 21 Sep 2018 09:27:22 +0000 (10:27 +0100)]
mem: fix undefined behavior in NUMA-aware mapping

When NUMA-aware hugepages config option is set, we rely on
libnuma to tell the kernel to allocate hugepages on a specific
NUMA node. However, we allocate node mask before we check if
NUMA is available in the first place, which, according to
the manpage [1], causes undefined behaviour.

Fix by only using nodemask when we have NUMA available.

[1] https://linux.die.net/man/3/numa_alloc_onnode

Bugzilla ID: 20
Fixes: 1b72605d2416 ("mem: balanced allocation of hugepages")
Cc: stable@dpdk.org
Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Acked-by: Ilya Maximets <i.maximets@samsung.com>
6 years agomem: store memory mode flags in shared config
Anatoly Burakov [Thu, 20 Sep 2018 15:41:26 +0000 (16:41 +0100)]
mem: store memory mode flags in shared config

Currently, command-line switches for legacy mem mode or single-file
segments mode are only stored in internal config. This leads to a
situation where these flags have to always match between primary
and secondary, which is bad for usability.

Fix this by storing these flags in the shared config as well, so
that secondary process can know if the primary was launched in
single-file segments or legacy mem mode.

This bumps the EAL ABI, however there's an EAL deprecation notice
already in place[1] for a different feature, so that's OK.

[1] http://patches.dpdk.org/patch/43502/

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
6 years agodevargs: remove comment regarding logs
Gaetan Rivet [Wed, 19 Sep 2018 16:11:11 +0000 (18:11 +0200)]
devargs: remove comment regarding logs

rte_log() is available in the context of this compilation unit,
do not deter from using it.

Signed-off-by: Gaetan Rivet <gaetan.rivet@6wind.com>
6 years agoethdev: register as a class
Gaetan Rivet [Wed, 19 Sep 2018 16:03:36 +0000 (18:03 +0200)]
ethdev: register as a class

Implement the operators of an rte_class for the
ethdev abstraction layer.

Register the layer as such.

Signed-off-by: Gaetan Rivet <gaetan.rivet@6wind.com>
Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
6 years agoethdev: add private generic device iterator
Gaetan Rivet [Wed, 19 Sep 2018 16:03:35 +0000 (18:03 +0200)]
ethdev: add private generic device iterator

This iterator can be customized with a comparison function that will
trigger a stopping condition.

It can be leveraged to write several different iterators that have
similar but non-identical purposes.

It is private to librte_ethdev.

Signed-off-by: Gaetan Rivet <gaetan.rivet@6wind.com>
6 years agobus/vdev: implement device iteration
Gaetan Rivet [Wed, 19 Sep 2018 16:03:33 +0000 (18:03 +0200)]
bus/vdev: implement device iteration

Signed-off-by: Gaetan Rivet <gaetan.rivet@6wind.com>
6 years agobus/pci: add iteration filter on address
Gaetan Rivet [Wed, 19 Sep 2018 16:03:32 +0000 (18:03 +0200)]
bus/pci: add iteration filter on address

The PCI bus can now parse a matching field "id" as follows:

   "bus=pci,id=0000:00:00.0"

           or

   "bus=pci,id=00:00.0"

Signed-off-by: Gaetan Rivet <gaetan.rivet@6wind.com>
6 years agobus/pci: implement device iteration
Gaetan Rivet [Wed, 19 Sep 2018 16:03:31 +0000 (18:03 +0200)]
bus/pci: implement device iteration

Signed-off-by: Gaetan Rivet <gaetan.rivet@6wind.com>
6 years agokni: return failure for all ioctls
Dan Gora [Thu, 13 Sep 2018 21:46:52 +0000 (18:46 -0300)]
kni: return failure for all ioctls

Modify kni_net_ioctl() to return -EOPNOTSUPP for all ioctls instead
of 0.

This is necessary because the Wicked (and possibly other) network
interface managers will perform the SIOCGIWNAME ioctl to check if
the interface is a wireless interface.  If the KNI module returns
success, Wicked will incorrectly interpret the interface as a wireless
interface.

Signed-off-by: Dan Gora <dg@adax.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
6 years agokni: allocate memory dynamically for each device
Igor Ryzhov [Wed, 26 Sep 2018 16:21:06 +0000 (19:21 +0300)]
kni: allocate memory dynamically for each device

Long time ago preallocation of memory for KNI was introduced in commit
0c6bc8e. It was done because of lack of ability to free previously
allocated memzones, which led to memzone exhaustion. Currently memzones
can be freed and this patch uses this ability for dynamic KNI memory
allocation.

Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
6 years agomaintainers: update for OCTEONTX
Jerin Jacob [Tue, 2 Oct 2018 12:50:28 +0000 (18:20 +0530)]
maintainers: update for OCTEONTX

Santosh Shukla no longer associated with Cavium.
Update the octeontx driver code maintainership.

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
6 years agotest/event: fix Rx adapter intr test for skeleton PMD
Nikhil Rao [Tue, 25 Sep 2018 07:19:05 +0000 (12:49 +0530)]
test/event: fix Rx adapter intr test for skeleton PMD

Skeleton PMD does not support RTE_EVENT_ETH_RX_ADAPTER_CAP_MULTI_EVENTQ
so make the Rx queue_id = -1 and initialize the event port
configuration to zero.

Fixes: d65856999dd6 ("test/event: add Rx adapter tests for interrupt driven queues")
Cc: stable@dpdk.org
Signed-off-by: Nikhil Rao <nikhil.rao@intel.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
6 years agotest/event: fix eth Rx adapter test for skeleton PMD
Nikhil Rao [Tue, 25 Sep 2018 07:19:04 +0000 (12:49 +0530)]
test/event: fix eth Rx adapter test for skeleton PMD

Skeleton PMD does not support RTE_EVENT_ETH_RX_ADAPTER_CAP_MULTI_EVENTQ
and implicit_release_disable so make the Rx queue_id = -1 and
initialize the event port configuration to zero.

Fixes: ec36d881f56d ("eventdev: add implicit release disable capability")
Fixes: 2a9c83ae3b2e ("test/eventdev: add multi-ports test")
Cc: stable@dpdk.org
Signed-off-by: Nikhil Rao <nikhil.rao@intel.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
6 years agodoc: update eventdev app guide for Tx adapter
Pavan Nikhilesh [Mon, 24 Sep 2018 08:02:20 +0000 (13:32 +0530)]
doc: update eventdev app guide for Tx adapter

Update eventdev application guide to reflect Tx adapter related changes.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
6 years agoapp/eventdev: support Tx adapter
Pavan Nikhilesh [Mon, 24 Sep 2018 08:02:19 +0000 (13:32 +0530)]
app/eventdev: support Tx adapter

Convert existing Tx service based pipeline to Tx adapter based APIs and
simplify worker functions.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
6 years agoapp/eventdev: remove redundant newlines
Pavan Nikhilesh [Mon, 24 Sep 2018 08:02:18 +0000 (13:32 +0530)]
app/eventdev: remove redundant newlines

Remove unnecessary newline at the end of logs.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
6 years agoapp/eventdev: fix minor typos
Pavan Nikhilesh [Mon, 24 Sep 2018 08:02:17 +0000 (13:32 +0530)]
app/eventdev: fix minor typos

Fix minor typos.

Fixes: 314bcf58ca8f ("app/eventdev: add pipeline queue worker functions")
Cc: stable@dpdk.org
Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
6 years agoeventdev: fix port id argument in Rx adapter caps
Nikhil Rao [Tue, 25 Sep 2018 09:49:05 +0000 (15:19 +0530)]
eventdev: fix port id argument in Rx adapter caps

Make the ethernet port id passed into
rte_event_eth_rx_adapter_caps_get() 16 bit.

Also, update the event rx adapter test to use 16 bit
ethernet port ids.

Fixes: c2189c907dd1 ("eventdev: make ethdev port identifiers 16-bit")
Cc: stable@dpdk.org
Signed-off-by: Nikhil Rao <nikhil.rao@intel.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
6 years agotest/event: fix RSS config for eth Rx adapter
Nikhil Rao [Mon, 24 Sep 2018 08:53:47 +0000 (14:23 +0530)]
test/event: fix RSS config for eth Rx adapter

Remove RSS config as it is not required. The hardcoded RSS
configuration also generates an error on NICs that don't support
it.

Fixes: 8863a1fbfc66 ("ethdev: add supported hash function check")
Cc: stable@dpdk.org
Signed-off-by: Nikhil Rao <nikhil.rao@intel.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
6 years agoexamples/eventdev_pipeline: support Tx adapter
Pavan Nikhilesh [Mon, 24 Sep 2018 10:12:08 +0000 (15:42 +0530)]
examples/eventdev_pipeline: support Tx adapter

Redo the worker pipelines and offload transmission to service cores
seamlessly through Tx adapter.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
Reviewed-by: Nikhil Rao <nikhil.rao@intel.com>
Tested-by: Nikhil Rao <nikhil.rao@intel.com>
6 years agotest/event: add adapter tests to meson build
Nikhil Rao [Thu, 27 Sep 2018 05:46:15 +0000 (11:16 +0530)]
test/event: add adapter tests to meson build

Add tests for event eth Rx, crypto and timer adapters to
meson build

Signed-off-by: Nikhil Rao <nikhil.rao@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
6 years agotest/event: fix build for timer adapter
Nikhil Rao [Thu, 27 Sep 2018 05:46:14 +0000 (11:16 +0530)]
test/event: fix build for timer adapter

Limit the number of objects passed to rte_mempool_put_bulk()
to the size of the object table. This fix eliminates a compiler
warning (array-bounds) triggered when the march command line
parameter to gcc is set to nehalem.

Fixes: d1f3385d0076 ("test: add event timer adapter auto-test")
Cc: stable@dpdk.org
Signed-off-by: Nikhil Rao <nikhil.rao@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
6 years agoevent/octeontx: support Tx adapter
Pavan Nikhilesh [Fri, 28 Sep 2018 11:41:33 +0000 (17:11 +0530)]
event/octeontx: support Tx adapter

Add Tx adapter support and move few routines around to avoid code
duplication.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
6 years agodoc: add event eth Tx adapter guide
Nikhil Rao [Thu, 20 Sep 2018 17:41:16 +0000 (23:11 +0530)]
doc: add event eth Tx adapter guide

Add programmer's guide doc to explain the use of the
Event Ethernet Tx Adapter library.

Signed-off-by: Nikhil Rao <nikhil.rao@intel.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
6 years agoeventdev: add test for eth Tx adapter
Nikhil Rao [Thu, 20 Sep 2018 17:41:15 +0000 (23:11 +0530)]
eventdev: add test for eth Tx adapter

This patch adds tests for the eth Tx adapter APIs. It also
tests the data path for the rte_service function based
implementation of the APIs.

Signed-off-by: Nikhil Rao <nikhil.rao@intel.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
6 years agoeventdev: add eth Tx adapter implementation
Nikhil Rao [Thu, 20 Sep 2018 17:41:14 +0000 (23:11 +0530)]
eventdev: add eth Tx adapter implementation

This patch implements the Tx adapter APIs by invoking the
corresponding eventdev PMD callbacks and also provides
the common rte_service function based implementation when
the eventdev PMD support is absent.

Signed-off-by: Nikhil Rao <nikhil.rao@intel.com>
6 years agoeventdev: add caps API and PMD callbacks for eth Tx adapter
Nikhil Rao [Thu, 20 Sep 2018 17:41:13 +0000 (23:11 +0530)]
eventdev: add caps API and PMD callbacks for eth Tx adapter

The caps API allows the application to query if the transmit
stage is implemented in the eventdev PMD or uses the common
rte_service function. The PMD callbacks support the
eventdev PMD implementation of the adapter.

Signed-off-by: Nikhil Rao <nikhil.rao@intel.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
6 years agoeventdev: add eth Tx adapter APIs
Nikhil Rao [Thu, 20 Sep 2018 17:41:12 +0000 (23:11 +0530)]
eventdev: add eth Tx adapter APIs

The ethernet Tx adapter abstracts the transmit stage of an
event driven packet processing application. The transmit
stage may be implemented with eventdev PMD support or use a
rte_service function implemented in the adapter. These APIs
provide a common configuration and control interface and
an transmit API for the eventdev PMD implementation.

The transmit port is specified using mbuf::port. The transmit
queue is specified using the rte_event_eth_tx_adapter_txq_set()
function.

Signed-off-by: Nikhil Rao <nikhil.rao@intel.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
6 years agotest/event: check burst mode capability
Pavan Nikhilesh [Wed, 5 Sep 2018 14:23:31 +0000 (19:53 +0530)]
test/event: check burst mode capability

Enqueue, dequeue depths are only valid for event devs that have burst
mode capability. Check event dev capability before testing depth
boundary.

Fixes: f8f9d233ea0e ("test/eventdev: add unit tests")
Cc: stable@dpdk.org
Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
6 years agoevent/sw: add unit test for unlinks in progress
Harry van Haaren [Mon, 24 Sep 2018 08:23:33 +0000 (09:23 +0100)]
event/sw: add unit test for unlinks in progress

This commit adds a unit test that checks the behaviour
of the unlinks_in_progress() function, ensuring that the
returned values are the number of unlinks requested,
until the scheduler runs and "acks" the requests, after
which the count should be zero again.

Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>
6 years agoevent/sw: implement unlinks in progress function
Harry van Haaren [Mon, 24 Sep 2018 08:23:32 +0000 (09:23 +0100)]
event/sw: implement unlinks in progress function

This commit adds a counter to each port, which counts the
number of unlinks that have been performed. When the scheduler
thread starts its scheduling routine, it "acks" all unlinks that
have been requested, and the application is gauranteed that no
more events will be scheduled to the port from the unlinked queue.

Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>
6 years agoevent: add function for reading unlink in progress
Harry van Haaren [Mon, 24 Sep 2018 08:23:31 +0000 (09:23 +0100)]
event: add function for reading unlink in progress

This commit introduces a new function in the eventdev API,
which allows applications to read the number of unlink requests
in progress on a particular port of an eventdev instance.

This information allows applications to verify when no more packets
from a particular queue (or any queue) will arrive at a port.
The application could decide to stop polling, or put the core into
a sleep state if it wishes, as it is ensured that no new packets
will arrive at a particular port anymore if all queues are unlinked.

Suggested-by: Matias Elo <matias.elo@nokia.com>
Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
6 years agoevent/sw: fix cq index check for unlink usecases
Harry van Haaren [Fri, 21 Sep 2018 10:25:10 +0000 (11:25 +0100)]
event/sw: fix cq index check for unlink usecases

This commit fixes the cq index checks when unlinking
ports/queues while the scheduler core is running.
Previously, the == comparison could be "skipped" if
in particular corner cases. With the check being changed
to >= this is resolved as the cq idx gets reset to zero.

Bugzilla ID: 60
Fixes: 617995dfc5b2 ("event/sw: add scheduling logic")
Cc: stable@dpdk.org
Suggested-by: Matias Elo <matias.elo@nokia.com>
Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>
6 years agotest/event: remove eth Rx adapter vdev workaround
Nikhil Rao [Thu, 6 Sep 2018 09:11:43 +0000 (14:41 +0530)]
test/event: remove eth Rx adapter vdev workaround

eth Rx adapter has been updated to support hotplugged
devices, devices created after adapter creation can now be
added to the adapter.

Update the adapter_multi_eth_add_del
test case to create the adapter as part of test setup
instead of creating it after creating vdevs.

Fixes: 2a9c83ae3b2e ("test/eventdev: add multi-ports test")
Cc: stable@dpdk.org
Signed-off-by: Nikhil Rao <nikhil.rao@intel.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
6 years agoeventdev: fix eth Rx adapter hotplug incompatibility
Nikhil Rao [Thu, 6 Sep 2018 09:11:42 +0000 (14:41 +0530)]
eventdev: fix eth Rx adapter hotplug incompatibility

Use RTE_MAX_ETHPORTS instead of rte_eth_dev_count_total()
when allocating eth Rx adapter's per-eth device data structure
to account for hotplugged devices.

Fixes: 9c38b704d280 ("eventdev: add eth Rx adapter implementation")
Cc: stable@dpdk.org
Signed-off-by: Nikhil Rao <nikhil.rao@intel.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
6 years agoevent/dpaa2: affine portal at runtime during I/O
Hemant Agrawal [Fri, 21 Sep 2018 11:46:06 +0000 (17:16 +0530)]
event/dpaa2: affine portal at runtime during I/O

This patch restructure the code to have the QBMAN portal
affliated at run time for per lcore basis.
The device cleanup is also improved.

Signed-off-by: Sunil Kumar Kori <sunil.kori@nxp.com>
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
6 years agoevent/dpaa2: support max event port value
Hemant Agrawal [Fri, 21 Sep 2018 11:46:05 +0000 (17:16 +0530)]
event/dpaa2: support max event port value

dev_info->max_event_ports shall be number of available cores.

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
6 years agoevent/dpaa2: enchance timeout handling
Hemant Agrawal [Fri, 21 Sep 2018 11:46:04 +0000 (17:16 +0530)]
event/dpaa2: enchance timeout handling

This patch enhances:
1. Configure the dequeue time out value as per the given
method or per dequeue, global or default.
2. The timeout values were being mixed as ns or ms timeouts,
Now the values are stored as ns and scale is in ms.

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
6 years agoevent/dpaa2: rename info structure
Hemant Agrawal [Fri, 21 Sep 2018 11:46:03 +0000 (17:16 +0530)]
event/dpaa2: rename info structure

This is to keep the dpaa2 driver aligned with dpaa driver.

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
6 years agoevent/dpaa2: fix mbuf assignment in atomic processing
Hemant Agrawal [Fri, 21 Sep 2018 11:46:02 +0000 (17:16 +0530)]
event/dpaa2: fix mbuf assignment in atomic processing

Fixes: 7b6edb640b73 ("event/dpaa2: have separate structure to hold dqrr entries")
Cc: stable@dpdk.org
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
6 years agoevent/dsw: add documentation
Mattias Rönnblom [Tue, 18 Sep 2018 12:45:14 +0000 (14:45 +0200)]
event/dsw: add documentation

The DSW event device is documented in DPDK Programmer's Guide.

The MAINTAINERS file and the 18.11 release notes are updated.

Signed-off-by: Mattias Rönnblom <mattias.ronnblom@ericsson.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
6 years agoevent/dsw: implement xstats counters
Mattias Rönnblom [Tue, 18 Sep 2018 12:45:13 +0000 (14:45 +0200)]
event/dsw: implement xstats counters

The DSW event device now implements the 'xstats' interface and a
number of port- and device-level counters.

Signed-off-by: Mattias Rönnblom <mattias.ronnblom@ericsson.com>
6 years agoevent/dsw: sort events on dequeue
Mattias Rönnblom [Tue, 18 Sep 2018 12:45:12 +0000 (14:45 +0200)]
event/dsw: sort events on dequeue

With this patch, the DSW event device will (optionally) sort the event
burst before giving it to the application. The sorting will primarily
be on queue id, and secondary on flow id.

The sorting is an attempt to optimize data and instruction cache usage
for the application, at the cost of additional event device overhead.

Signed-off-by: Mattias Rönnblom <mattias.ronnblom@ericsson.com>
6 years agoevent/dsw: add load balancing
Mattias Rönnblom [Tue, 18 Sep 2018 12:45:11 +0000 (14:45 +0200)]
event/dsw: add load balancing

The DSW event device will now attempt to migrate (move) flows between
ports in order to balance the load.

Signed-off-by: Mattias Rönnblom <mattias.ronnblom@ericsson.com>
6 years agoevent/dsw: add port load measurements
Mattias Rönnblom [Tue, 18 Sep 2018 12:45:10 +0000 (14:45 +0200)]
event/dsw: add port load measurements

The DSW event device port now attempts to estimate its load (i.e. how
busy it is). This is required for load balancing to work (although
load balancing is not included in this patch), and may also be useful
for debugging purposes.

Signed-off-by: Mattias Rönnblom <mattias.ronnblom@ericsson.com>
6 years agoevent/dsw: add event scheduling and device start/stop
Mattias Rönnblom [Tue, 18 Sep 2018 12:45:09 +0000 (14:45 +0200)]
event/dsw: add event scheduling and device start/stop

With this patch, the DSW event device can be started and stopped,
and also supports scheduling events between ports.

Signed-off-by: Mattias Rönnblom <mattias.ronnblom@ericsson.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
6 years agoevent/dsw: support linking/unlinking ports
Mattias Rönnblom [Tue, 18 Sep 2018 12:45:08 +0000 (14:45 +0200)]
event/dsw: support linking/unlinking ports

Added support for linking and unlinking ports to queues in a DSW event
device.

Signed-off-by: Mattias Rönnblom <mattias.ronnblom@ericsson.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
6 years agoevent/dsw: add port configuration
Mattias Rönnblom [Tue, 18 Sep 2018 12:45:07 +0000 (14:45 +0200)]
event/dsw: add port configuration

Allow port setup and release in the DSW event device.

Signed-off-by: Mattias Rönnblom <mattias.ronnblom@ericsson.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
6 years agoevent/dsw: add device and queue configuration
Mattias Rönnblom [Tue, 18 Sep 2018 12:45:06 +0000 (14:45 +0200)]
event/dsw: add device and queue configuration

Allow queue- and device-level configuration for and retrieval of
contextual information from a DSW event device.

Signed-off-by: Mattias Rönnblom <mattias.ronnblom@ericsson.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
6 years agoevent/dsw: add device registration and build system
Mattias Rönnblom [Tue, 18 Sep 2018 12:45:05 +0000 (14:45 +0200)]
event/dsw: add device registration and build system

This patch contains the Meson and GNU Make build system extensions
required for the Distributed Event Device, and also the initialization
code for the driver itself.

Signed-off-by: Mattias Rönnblom <mattias.ronnblom@ericsson.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
6 years agodoc: fix eventdev shared library version
Jerin Jacob [Tue, 25 Sep 2018 13:12:41 +0000 (18:42 +0530)]
doc: fix eventdev shared library version

The below change set suppose to bump the eventdev shared library version.
It missed updating the version number so fixing it now.

Fixes: 3810ae435783 ("eventdev: add interrupt driven queues to Rx adapter")
Cc: stable@dpdk.org
Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
6 years agodevtools: use a common prefix for temporary files
Thomas Monjalon [Wed, 19 Sep 2018 17:16:29 +0000 (19:16 +0200)]
devtools: use a common prefix for temporary files

Some temporary files were generated in /tmp, others in the current
directory, and none was "dpdk prefixed".

All these files have a common path prefix now: $TMPDIR/dpdk.
TMPDIR is /tmp by default.

Note: the previous use of mktemp, with a template but without -t,
was generating a file in the current directory.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
6 years agodevtools: fix printing subject of checked patch
Thomas Monjalon [Mon, 1 Oct 2018 20:38:13 +0000 (22:38 +0200)]
devtools: fix printing subject of checked patch

If checkpatches.sh is not run with verbose option (-v),
the patch subject is printed as headline of errors only
if there is an error reported by checkpatch.pl, not with other checks.
The headline is moved to a function which is called after each check
if there is an error and if it has not already be printed.

One more addition, in verbose mode, checkpatch.pl is now announced
as done for other checks.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
6 years agodevtools: move awk script ckecking forbidden tokens
Arnon Warshavsky [Thu, 27 Sep 2018 09:04:08 +0000 (12:04 +0300)]
devtools: move awk script ckecking forbidden tokens

The awk code previously read inline in checkpatches.sh
was using -d which is a bash option,
while bash is not the default shell in all distributions.
Now moved to be read from a separate file.

Signed-off-by: Arnon Warshavsky <arnon@qwilt.com>
Acked-by: Andrzej Ostruszka <amo@semihalf.com>
6 years agotest/crypto: fix number of queue pairs
Fiona Trahe [Sat, 22 Sep 2018 13:33:36 +0000 (14:33 +0100)]
test/crypto: fix number of queue pairs

Some of the tests use a QAT-specific value (2) for
maximum nr of queue pairs to create valid/invalid test cases.
This has accidentally worked ok as default max_qps for all PMDs
is larger. It is incorrect however and would fail if a device
had a max lower than the QAT value.
Instead use the value returned by the PMD in the
rte_cryptodev_get_info query, this value is stored in the ts_params.

Fixes: 202d375c60bc ("app/test: add cryptodev unit and performance tests")
Cc: stable@dpdk.org
Signed-off-by: Fiona Trahe <fiona.trahe@intel.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
6 years agocompress/qat: remove unnecessary assignment
Fiona Trahe [Sat, 22 Sep 2018 13:25:38 +0000 (14:25 +0100)]
compress/qat: remove unnecessary assignment

Same variable was assigned twice, remove one.

Fixes: 6a7ea14819e9 ("compress/qat: add xform processing")
Cc: stable@dpdk.org
Signed-off-by: Fiona Trahe <fiona.trahe@intel.com>
Acked-by: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
6 years agocompress/qat: fix checksum on decompression
Fiona Trahe [Sat, 22 Sep 2018 13:25:37 +0000 (14:25 +0100)]
compress/qat: fix checksum on decompression

Checksum was always 0 on QAT decompression due to
incorrect use of union variable.

Fixes: 6a7ea14819e9 ("compress/qat: add xform processing")
Cc: stable@dpdk.org
Signed-off-by: Fiona Trahe <fiona.trahe@intel.com>
Acked-by: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
6 years agodoc: add cryptodev features
Anoob Joseph [Fri, 21 Sep 2018 06:20:42 +0000 (11:50 +0530)]
doc: add cryptodev features

Adding 3DES-ECB & AES-XTS to the list of ciphers supported

Signed-off-by: Anoob Joseph <anoob.joseph@caviumnetworks.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
6 years agocrypto/dpaa_sec: support null algos for protocol offload
Hemant Agrawal [Thu, 30 Aug 2018 05:51:05 +0000 (11:21 +0530)]
crypto/dpaa_sec: support null algos for protocol offload

NULL cipher and NULL auth support is added.

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
6 years agocrypto/dpaa2_sec: restructure session management
Hemant Agrawal [Thu, 30 Aug 2018 05:51:04 +0000 (11:21 +0530)]
crypto/dpaa2_sec: restructure session management

Code for session create is restructured to make scalable to
support different algorithms.

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
6 years agocrypto/dpaa2_sec: support out of place protocol offload
Hemant Agrawal [Thu, 30 Aug 2018 05:51:03 +0000 (11:21 +0530)]
crypto/dpaa2_sec: support out of place protocol offload

OOP support for look aside protocol support is added.

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
6 years agocrypto/dpaa2_sec: enable sequence no rollover
Akhil Goyal [Thu, 30 Aug 2018 05:51:02 +0000 (11:21 +0530)]
crypto/dpaa2_sec: enable sequence no rollover

With this patch sequence number will be rolled over and
SEC block will ignore the sequence number overflow error.

Signed-off-by: Akhil Goyal <akhil.goyal@nxp.com>
6 years agocrypto/dpaa_sec: enable sequence no rollover
Akhil Goyal [Thu, 30 Aug 2018 05:51:01 +0000 (11:21 +0530)]
crypto/dpaa_sec: enable sequence no rollover

With this patch sequence number will be rolled over and
SEC block will ignore the sequence number overflow error.

Signed-off-by: Akhil Goyal <akhil.goyal@nxp.com>
6 years agocrypto/dpaa_sec: reduce number of qp per device
Hemant Agrawal [Thu, 30 Aug 2018 05:51:00 +0000 (11:21 +0530)]
crypto/dpaa_sec: reduce number of qp per device

In dpaa_sec, there are unlimited queues, but in order
to match the DPDK handling of queue pairs, rx side queues
are still unlimited, but the application will see only limited
qp (tx queues) from dpaa_sec hw.

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
6 years agocrypto/dpaa_sec: do not attach session for non-matching qp
Akhil Goyal [Thu, 30 Aug 2018 05:50:59 +0000 (11:20 +0530)]
crypto/dpaa_sec: do not attach session for non-matching qp

if session->qp != qp to be enqueued, it should show an error and
not try to re-attach another qp.

Signed-off-by: Akhil Goyal <akhil.goyal@nxp.com>
6 years agocrypto/dpaa_sec: add lock before Rx HW queue attach
Akhil Goyal [Thu, 30 Aug 2018 05:50:58 +0000 (11:20 +0530)]
crypto/dpaa_sec: add lock before Rx HW queue attach

This is to safeguard as the session config can be done from multi-threads.

Signed-off-by: Akhil Goyal <akhil.goyal@nxp.com>
6 years agocrypto/dpaa: reset session before init
Akhil Goyal [Thu, 30 Aug 2018 05:50:57 +0000 (11:20 +0530)]
crypto/dpaa: reset session before init

Signed-off-by: Akhil Goyal <akhil.goyal@nxp.com>
6 years agocrypto/dpaa: update the flib RTA
Hemant Agrawal [Thu, 30 Aug 2018 05:50:56 +0000 (11:20 +0530)]
crypto/dpaa: update the flib RTA

hw flib code is updated as per the latest set of APIs and macros

Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
6 years agocrypto/aesni_gcm: support all truncated digest sizes
Pablo de Lara [Tue, 14 Aug 2018 00:54:30 +0000 (01:54 +0100)]
crypto/aesni_gcm: support all truncated digest sizes

The full digest size of GCM/GMAC algorithms is 16 bytes.
However, it is sometimes truncated to a smaller size (such as in IPSec).
This commit allows a user to generate a digest of any size
up to the full size.

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Marko Kovacevic <marko.kovacevic@intel.com>
6 years agocrypto/aesni_gcm: remove unneeded J0 calculation
Pablo de Lara [Tue, 14 Aug 2018 00:53:30 +0000 (01:53 +0100)]
crypto/aesni_gcm: remove unneeded J0 calculation

When IV size is 12, padding to 16 bytes is required
and the LSB must be set to 1, according to the spec.
However, the Multi-buffer library is already doing this,
so it is not necessary to do it in the PMD.

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Marko Kovacevic <marko.kovacevic@intel.com>
6 years agocrypto/aesni_mb: support large HMAC key sizes
Pablo de Lara [Tue, 14 Aug 2018 00:38:48 +0000 (01:38 +0100)]
crypto/aesni_mb: support large HMAC key sizes

Add support for SHAx-HMAC key sizes larger than the block size.
For these sizes, the input key is digested with the non-HMAC
version of the algorithm and used as the key.

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Marko Kovacevic <marko.kovacevic@intel.com>
6 years agocrypto/aesni_mb: support all truncated CMAC digest sizes
Pablo de Lara [Tue, 14 Aug 2018 00:38:47 +0000 (01:38 +0100)]
crypto/aesni_mb: support all truncated CMAC digest sizes

The full digest size of CMAC algorithm is 16 bytes.
However, it is sometimes truncated to a smaller size (such as in IPSec).
This commit allows a user to generate a digest of any size
up to the full size.

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Marko Kovacevic <marko.kovacevic@intel.com>
6 years agocrypto/aesni_mb: fix truncated digest size for CMAC
Pablo de Lara [Tue, 14 Aug 2018 00:38:46 +0000 (01:38 +0100)]
crypto/aesni_mb: fix truncated digest size for CMAC

The truncated digest size for AES-CMAC is 12 and not 16,
as the Multi-buffer library can output both 12 and 16 bytes.

Fixes: 6491dbbecebb ("crypto/aesni_mb: support AES CMAC")
Cc: stable@dpdk.org
Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Marko Kovacevic <marko.kovacevic@intel.com>
6 years agocrypto/aesni_mb: check for invalid digest size
Pablo de Lara [Tue, 14 Aug 2018 00:38:45 +0000 (01:38 +0100)]
crypto/aesni_mb: check for invalid digest size

When creating a crypto session, check if
ther requested digest size is supported for
AES-XCBC-MAC and AES-CCM.

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Marko Kovacevic <marko.kovacevic@intel.com>
6 years agocrypto/aesni_mb: support all truncated HMAC digest sizes
Pablo de Lara [Tue, 14 Aug 2018 00:38:44 +0000 (01:38 +0100)]
crypto/aesni_mb: support all truncated HMAC digest sizes

HMAC algorithms (MD5 and SHAx) have different full digest sizes.
However, they are often truncated to a smaller size (such as in IPSec).
This commit allows a user to generate a digest of any size
up to the full size.

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Marko Kovacevic <marko.kovacevic@intel.com>
6 years agocrypto/aesni_mb: fix possible array overrun
Pablo de Lara [Thu, 2 Aug 2018 04:49:40 +0000 (05:49 +0100)]
crypto/aesni_mb: fix possible array overrun

In order to process crypto operations in the AESNI MB PMD,
they need to be sent to the buffer manager of the Multi-buffer library,
through the "job" structure.

Currently, it is checked if there are outstanding operations to process
in the ring, before getting a new job. However, if there are no available
jobs in the manager, a flush operation needs to take place, freeing some
of the jobs, so it can be used for the outstanding operation.

In order to avoid leaving the dequeued operation without being processed,
the maximum number of operations that can be flushed is the remaining
operations to return, which is the maximum number of operations that can
be return minus the number of operations ready to be returned
(nb_ops - processed_jobs), minus 1 (for the new operation).

The problem comes when (nb_ops - processed_jobs) is 1 (last operation to
dequeue). In that case, flush_mb_mgr is called with maximum number of
operations equal to 0, which is wrong, causing a potential overrun in the
"ops" array.
Besides, the operation dequeued from the ring will be leaked, as no more
operations can be returned.

The solution is to first check if there are jobs available in the manager.
If there are not, flush operation gets called, and if enough operations
are returned from the manager, then no more outstanding operations get
dequeued from the ring, avoiding both the memory leak and the array
overrun.
If there are enough jobs, PMD tries to dequeue an operation from the ring.
If there are no operations in the ring, the new job pointer is not used,
and it will be used in the next get_next_job call, so no memory leak
happens.

Fixes: 0f548b50a160 ("crypto/aesni_mb: process crypto op on dequeue")
Cc: stable@dpdk.org
Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
6 years agoapp/test-crypto-perf: fix double allocation of memory
Anoob Joseph [Mon, 10 Sep 2018 06:40:58 +0000 (12:10 +0530)]
app/test-crypto-perf: fix double allocation of memory

The field, 'cipher_iv.data' is allocated twice when cipher is not null.
Ideally the allocation should depend only on the field
'cperf_options.cipher_iv_sz'. This will make sure this code path gets
valid for ciphers which doesn't require IV.

Fixes: 0fbd75a99fc9 ("cryptodev: move IV parameters to session")
Cc: stable@dpdk.org
Signed-off-by: Akash Saxena <akash.saxena@caviumnetworks.com>
Signed-off-by: Anoob Joseph <anoob.joseph@caviumnetworks.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>