dpdk.git
8 years agoexamples/ipsec-secgw: support IPv6
Sergio Gonzalez Monroy [Thu, 9 Jun 2016 08:42:48 +0000 (09:42 +0100)]
examples/ipsec-secgw: support IPv6

Support IPSec IPv6 allowing IPv4/IPv6 traffic in IPv4 or IPv6 tunnel.

We need separate Routing (LPM) and SP (ACL) tables for IPv4 and IPv6,
but a common SA table.

Signed-off-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
8 years agoexamples/ipsec-secgw: rename SP config
Sergio Gonzalez Monroy [Thu, 9 Jun 2016 08:42:47 +0000 (09:42 +0100)]
examples/ipsec-secgw: rename SP config

Modify the default SP config variables names to be consistent with SA.

The resulting naming convention is that variables with suffixes _out/_in
are the default for ep0 and the reverse for ep1.

Signed-off-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
8 years agoexamples/ipsec-secgw: fix no SA found case
Sergio Gonzalez Monroy [Thu, 9 Jun 2016 08:42:46 +0000 (09:42 +0100)]
examples/ipsec-secgw: fix no SA found case

The application only ASSERTS that an SA is not NULL (only when debugging
is enabled) without properly dealing with the case of not having an SA
for the processed packet.

Behavior should be such as if no SA is found, drop the packet.

Fixes: d299106e8e31 ("examples/ipsec-secgw: add IPsec sample application")

Signed-off-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
8 years agoexamples/ipsec-secgw: rework processing loop
Sergio Gonzalez Monroy [Thu, 9 Jun 2016 08:42:45 +0000 (09:42 +0100)]
examples/ipsec-secgw: rework processing loop

Rework implementation moving from function pointers approach, where each
function implements very specific functionality, to a generic function
approach.

Signed-off-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
8 years agoexamples/ipsec-secgw: add debug build option
Sergio Gonzalez Monroy [Thu, 9 Jun 2016 08:42:44 +0000 (09:42 +0100)]
examples/ipsec-secgw: add debug build option

Add support for building the application with DEBUG=1.
This option adds the compiler stack protection flag and enables extra
output in the application.

Also remove unnecessary VPATH setup.

Signed-off-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
8 years agoexamples/ipsec-secgw: fix stack smashing
Sergio Gonzalez Monroy [Thu, 9 Jun 2016 08:42:43 +0000 (09:42 +0100)]
examples/ipsec-secgw: fix stack smashing

Building the application with -O3 and -fstack-protection (default in
Ubuntu) results in the following error:

*** stack smashing detected ***: ./build/ipsec-secgw terminated

The error is caused by storing an 8B value in a 4B variable.

Fixes: d299106e8e31 ("examples/ipsec-secgw: add IPsec sample application")

Signed-off-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
8 years agoexamples/ipsec-secgw: fix esp padding check
Sergio Gonzalez Monroy [Thu, 9 Jun 2016 08:42:42 +0000 (09:42 +0100)]
examples/ipsec-secgw: fix esp padding check

Current code fails to correctly check padding sequence for inbound
packets.
Padding sequence starts on 1 but it checks for 0.

Fixes: d299106e8e31 ("examples/ipsec-secgw: add IPsec sample application")

Signed-off-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
8 years agoapp/test: refactor SNOW 3G and KASUMI tests
Pablo de Lara [Mon, 20 Jun 2016 14:45:02 +0000 (15:45 +0100)]
app/test: refactor SNOW 3G and KASUMI tests

SNOW3G and KASUMI unit tests are very similar and
they were using duplicated code, so this commit
refactor and remove some of the duplicated functions.

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Deepak Kumar Jain <deepak.k.jain@intel.com>
8 years agoapp/test: add SNOW 3G UEA2 with offset
Pablo de Lara [Mon, 20 Jun 2016 14:45:01 +0000 (15:45 +0100)]
app/test: add SNOW 3G UEA2 with offset

With the new libsso library, buffers can be encrypted/decrypted,
providing an offset in bits, so an extra unit test has been
added to cover this case.

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Deepak Kumar Jain <deepak.k.jain@intel.com>
8 years agoapp/test: add bit-level SNOW 3G UIA2
Pablo de Lara [Mon, 20 Jun 2016 14:45:00 +0000 (15:45 +0100)]
app/test: add bit-level SNOW 3G UIA2

Snow3G PMD supports now buffers that are non byte multiple,
so tests to cover this case have been added.

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Deepak Kumar Jain <deepak.k.jain@intel.com>
8 years agoapp/test: add out-of-place cases for SNOW 3G
Pablo de Lara [Mon, 20 Jun 2016 14:44:59 +0000 (15:44 +0100)]
app/test: add out-of-place cases for SNOW 3G

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Deepak Kumar Jain <deepak.k.jain@intel.com>
8 years agoapp/test: fix buffer lengths for SNOW 3G
Pablo de Lara [Mon, 20 Jun 2016 14:44:58 +0000 (15:44 +0100)]
app/test: fix buffer lengths for SNOW 3G

No padding was added in the input buffers for snow3G tests,
due to a wrong calculation of the length (should be multiple
of the block size). This fix takes into account the case
where the length is not byte multiple.

Fixes: 8bdf665fe6c0 ("app/test: add SNOW 3G")

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Deepak Kumar Jain <deepak.k.jain@intel.com>
8 years agoapp/test: use new bit-level memcmp macro
Pablo de Lara [Mon, 20 Jun 2016 14:44:57 +0000 (15:44 +0100)]
app/test: use new bit-level memcmp macro

Instead of modifying the content of the buffers, to compare them
at bit-level, use the new macro TEST_ASSERT_BUFFERS_ARE_EQUAL_BIT,
which does not make any modifications in the buffers.

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Deepak Kumar Jain <deepak.k.jain@intel.com>
8 years agocrypto/snow3g: add missing feature flags
Pablo de Lara [Mon, 20 Jun 2016 14:44:56 +0000 (15:44 +0100)]
crypto/snow3g: add missing feature flags

The underlying libsso library support SSE4.1 instruction set,
so feature flags of the crypto device must be updated
to reflect this.

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Deepak Kumar Jain <deepak.k.jain@intel.com>
8 years agocrypto/snow3g: support bit-level operations
Pablo de Lara [Mon, 20 Jun 2016 14:44:55 +0000 (15:44 +0100)]
crypto/snow3g: support bit-level operations

Underlying libsso_snow3g library now supports bit-level
operations, so PMD has been updated to allow them.

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Deepak Kumar Jain <deepak.k.jain@intel.com>
8 years agocrypto/snow3g: define IV and digest length constants
Pablo de Lara [Mon, 20 Jun 2016 14:44:54 +0000 (15:44 +0100)]
crypto/snow3g: define IV and digest length constants

In order to avoid using magic numbers, macros for
the IV and digest lengths for Snow3G have been added.

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Deepak Kumar Jain <deepak.k.jain@intel.com>
8 years agodoc: update build instructions for libsso_snow3g
Pablo de Lara [Mon, 20 Jun 2016 14:44:53 +0000 (15:44 +0100)]
doc: update build instructions for libsso_snow3g

With the library update, the way to compile the library
has changed, so documentation reflects this change.
Also, the patch to fix the compilation issues present with gcc > 5.0
has been removed, as the issues have been fixed in the library.

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Deepak Kumar Jain <deepak.k.jain@intel.com>
8 years agocrypto/snow3g: rename libsso reference due to library update
Pablo de Lara [Mon, 20 Jun 2016 14:44:52 +0000 (15:44 +0100)]
crypto/snow3g: rename libsso reference due to library update

The underlying libsso library that SNOW3G PMD uses has been updated,
so now it is called libsso_snow3g. Also, the path to the library
has been renamed to reflect this changes (now called LIBSSO_SNOW3G_PATH).

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Deepak Kumar Jain <deepak.k.jain@intel.com>
8 years agoapp/test: add KASUMI crypto
Pablo de Lara [Mon, 20 Jun 2016 14:40:06 +0000 (15:40 +0100)]
app/test: add KASUMI crypto

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Deepak Kumar Jain <deepak.k.jain@intel.com>
8 years agoapp/test: add new buffer comparison macros
Pablo de Lara [Mon, 20 Jun 2016 14:40:05 +0000 (15:40 +0100)]
app/test: add new buffer comparison macros

In order to compare buffers with length and offset in bits,
new macros have been created, which use the previous compare function
to compare full bytes and then, compare first and last bytes of
each buffer separately.

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Deepak Kumar Jain <deepak.k.jain@intel.com>
8 years agocrypto/kasumi: add driver for KASUMI library
Pablo de Lara [Mon, 20 Jun 2016 14:40:04 +0000 (15:40 +0100)]
crypto/kasumi: add driver for KASUMI library

Added new SW PMD which makes use of the libsso_kasumi SW library,
which provides wireless algorithms KASUMI F8 and F9
in software.

This PMD supports cipher-only, hash-only and chained operations
("cipher then hash" and "hash then cipher") of the following
algorithms:
- RTE_CRYPTO_SYM_CIPHER_KASUMI_F8
- RTE_CRYPTO_SYM_AUTH_KASUMI_F9

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Deepak Kumar Jain <deepak.k.jain@intel.com>
8 years agodoc: fix crypto feature table
Pablo de Lara [Thu, 9 Jun 2016 15:44:34 +0000 (16:44 +0100)]
doc: fix crypto feature table

Some crypto PMDs that support symmetric crypto were not marked
as supported in the supported feature flags table.

Fixes: 2373c0661b2f0 ("doc: add cryptodevs guide overview")

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Deepak Kumar Jain <deepak.k.jain@intel.com>
Acked-by: John McNamara <john.mcnamara@intel.com>
8 years agoapp/test: use hexdump if debug log is enabled
Pablo de Lara [Wed, 15 Jun 2016 14:11:20 +0000 (15:11 +0100)]
app/test: use hexdump if debug log is enabled

Instead of using the previous RTE_APP_TEST_DEBUG macro,
to dump memory when it was enabled (with rte_hexdump),
a new TEST_HEXDUMP is defined, which will call rte_hexdump
if RTE_LOG_LEVEL is set to RTE_LOG_DEBUG.

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Fan Zhang <roy.fan.zhang@intel.com>
8 years agoapp/test: remove unnecessary hexdump
Pablo de Lara [Wed, 15 Jun 2016 14:11:19 +0000 (15:11 +0100)]
app/test: remove unnecessary hexdump

Fixes: 202d375c60bc1 ("app/test: add cryptodev unit and performance tests")

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Fan Zhang <roy.fan.zhang@intel.com>
8 years agoapp/test: fix debug build
Pablo de Lara [Wed, 15 Jun 2016 14:11:18 +0000 (15:11 +0100)]
app/test: fix debug build

When RTE_APP_TEST_DEBUG is set, there were some errors:

app/test/test_cryptodev.c: In function ‘create_gcm_operation’:
app/test/test_cryptodev.c:3619:18: error: ‘struct rte_crypto_op’ has no member named ‘digest’
     ut_params->op->digest.data,
                  ^
app/test/test_cryptodev.c:3620:18: error: ‘struct rte_crypto_op’ has no member named ‘digest’
     ut_params->op->digest.length);
                  ^
app/test/test_cryptodev.c:3662:41: error: ‘struct rte_crypto_op’ has no member named ‘iv’
  rte_hexdump(stdout, "iv:", ut_params->op->iv.data, iv_pad_len);
                                         ^
app/test/test_cryptodev.c:3664:17: error: ‘struct rte_crypto_op’ has no member named ‘additional_auth’
    ut_params->op->additional_auth.data, aad_len);

Fixes: eec136f3c54fc ("aesni_gcm: add driver for AES-GCM crypto operations")

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Fan Zhang <roy.fan.zhang@intel.com>
8 years agoapp/test: remove useless hexdump include
Pablo de Lara [Wed, 15 Jun 2016 14:11:17 +0000 (15:11 +0100)]
app/test: remove useless hexdump include

Cryptodev performance tests do not need to use any function
from rte_hexdump.h.

Fixes: 202d375c60bc1 ("app/test: add cryptodev unit and performance tests")

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Fan Zhang <roy.fan.zhang@intel.com>
8 years agoapp/test: fix crypto typos
Deepak Kumar Jain [Mon, 20 Jun 2016 15:08:25 +0000 (16:08 +0100)]
app/test: fix crypto typos

Fixing typo in the performance tests for example preftest to perftest.

Signed-off-by: Deepak Kumar Jain <deepak.k.jain@intel.com>
8 years agoapp/test: update AES SHA performance test
Fiona Trahe [Mon, 20 Jun 2016 15:08:24 +0000 (16:08 +0100)]
app/test: update AES SHA performance test

Updating the AES performance test in line with snow3g performance test.
Output format has been updated so as to get better understanding of numbers.

Signed-off-by: Fiona Trahe <fiona.trahe@intel.com>
Signed-off-by: Deepak Kumar Jain <deepak.k.jain@intel.com>
8 years agoapp/test: add SNOW 3G performance test
Fiona Trahe [Mon, 20 Jun 2016 15:08:23 +0000 (16:08 +0100)]
app/test: add SNOW 3G performance test

Adding performance test for snow3g wireless algorithm.
Performance test can run over both software and hardware.

Signed-off-by: Fiona Trahe <fiona.trahe@intel.com>
Signed-off-by: Deepak Kumar Jain <deepak.k.jain@intel.com>
Signed-off-by: Declan Doherty <declan.doherty@intel.com>
8 years agoapp/test: add more AES algorithms
Fan Zhang [Wed, 15 Jun 2016 11:02:50 +0000 (12:02 +0100)]
app/test: add more AES algorithms

This patch adds the HMAC-SHA224 and HMAC-SHA384 digest generation and
verification tests to crypto

Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
8 years agoapp/test: rework crypto AES unit test
Fan Zhang [Wed, 15 Jun 2016 11:02:49 +0000 (12:02 +0100)]
app/test: rework crypto AES unit test

This patch reworks the crypto AES unit test by introducing a new unified
test function

Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
8 years agokeepalive: fix missing symbol export
Remy Horton [Mon, 20 Jun 2016 09:59:00 +0000 (10:59 +0100)]
keepalive: fix missing symbol export

The KeepAlive rte_keepalive_mark_sleep function was not being exported.

Fixes: 90c622f35679 ("keepalive: add liveness callback")

Signed-off-by: Remy Horton <remy.horton@intel.com>
8 years agomem: fix leak after mapping failure
Marcin Kerlin [Thu, 16 Jun 2016 15:14:00 +0000 (17:14 +0200)]
mem: fix leak after mapping failure

Patch fixes resource leak in rte_eal_hugepage_attach() where mapped files
were not freed back to the OS in case of failure. Patch uses the behavior
of Linux munmap: "It is not an error if the indicated range does not
contain any mapped pages".

Coverity issue: 13295, 13296, 13303

Fixes: af75078fece3 ("first public release")

Signed-off-by: Marcin Kerlin <marcinx.kerlin@intel.com>
Acked-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
8 years agomem: fix error message with Xen
Marcin Kerlin [Wed, 15 Jun 2016 11:17:17 +0000 (13:17 +0200)]
mem: fix error message with Xen

Minor typo fix to error message

Fixes: 148f963fb532 ("xen: core library changes")

Signed-off-by: Marcin Kerlin <marcinx.kerlin@intel.com>
8 years agomem: fix possible integer overflow
Sergio Gonzalez Monroy [Tue, 14 Jun 2016 18:07:18 +0000 (19:07 +0100)]
mem: fix possible integer overflow

It is possible to get an integer overflow if we try to reserve a memzone
with len = 0 (meaning the maximum contiguous space available) and the
maximum available elem size is less than (MALLOC_ELEM_OVERHEAD + align).

Coverity issue: 107111

Fixes: fafcc11985a2 ("mem: rework memzone to be allocated by malloc")

Signed-off-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
8 years agopci: fix resource release when unmapping
Tetsuya Mukawa [Thu, 16 Jun 2016 02:33:10 +0000 (11:33 +0900)]
pci: fix resource release when unmapping

This patch fixes wrong resource release of pci_uio_unmap().
The 'path' member of mapped_pci_resource structure is allocated by
primary process, but currently it will be freed by both primary
and secondary process.
The patch fixes to be freed by only primary process.

Signed-off-by: Tetsuya Mukawa <mukawa@igel.co.jp>
Acked-by: David Marchand <david.marchand@6wind.com>
8 years agopci: fix resource leak when secondary process mapping fails
Tetsuya Mukawa [Thu, 16 Jun 2016 02:33:11 +0000 (11:33 +0900)]
pci: fix resource leak when secondary process mapping fails

This patch fixes resource leak of pci_uio_map_secondary().
If pci_map_resource() succeeds but mapped address is different from an
address primary process mapped, this should be error.
Then the addresses secondary process mapped should be freed.

Signed-off-by: Tetsuya Mukawa <mukawa@igel.co.jp>
Acked-by: David Marchand <david.marchand@6wind.com>
8 years agoeal: fix argument parsing check
Tetsuya Mukawa [Thu, 16 Jun 2016 02:33:09 +0000 (11:33 +0900)]
eal: fix argument parsing check

This patch fixes wrong error checking of rte_eal_parse_devargs_str().
Currently, a return value of strdup() is wrongly checked.

Fixes: 0fe11ec592b2 ("eal: add vdev init and uninit")

Signed-off-by: Tetsuya Mukawa <mukawa@igel.co.jp>
Acked-by: David Marchand <david.marchand@6wind.com>
8 years agoeal/linux: fix build with glibc < 2.12
Thomas Monjalon [Sun, 19 Jun 2016 21:03:52 +0000 (23:03 +0200)]
eal/linux: fix build with glibc < 2.12

The function rte_thread_setname needs glibc 2.12,
otherwise it returns -1 without using any parameter.
The macro RTE_SET_USED avoids an "unused parameter" warning.

Fixes: 3901ed99c2f8 ("eal: fix thread naming on FreeBSD")

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
8 years agoeal: fix thread naming on FreeBSD
Thomas Monjalon [Fri, 17 Jun 2016 12:48:16 +0000 (14:48 +0200)]
eal: fix thread naming on FreeBSD

rte_thread_setname was a macro defined only for Linux.
The function rte_thread_setname() can now be used on FreeBSD
as well on Linux.
It is required to build librte_pdump.

The macro was 0 for old glibc. The function is now returning -1.
The related logs are decreased from error to debug level because
it is not an important failure, just a debug inconvenience.

Fixes: 278f945402c5 ("pdump: add new library for packet capture")

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Acked-by: David Marchand <david.marchand@6wind.com>
8 years agokeepalive: fix exported symbols
Thomas Monjalon [Fri, 17 Jun 2016 15:00:22 +0000 (17:00 +0200)]
keepalive: fix exported symbols

The function rte_keepalive_register_alive_callback do not exist.
The function rte_keepalive_register_relay_callback was missing for BSD.

Fixes: 90c622f35679 ("keepalive: add liveness callback")

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
8 years agoapp/test: fix resource creation with objcopy on FreeBSD
Jan Viktorin [Fri, 17 Jun 2016 12:52:47 +0000 (14:52 +0200)]
app/test: fix resource creation with objcopy on FreeBSD

Using of the /dev/stdin generates a warning when compiling on FreeBSD:

 objcopy: Warning: '/dev/stdin' is not an ordinary file
 app/test/Makefile:78: recipe for target 'test_resource_c.res.o' failed
 # ls -l /dev/stdin
 lrwxr-xr-x  1 root  wheel  4 Jun 17 12:24 /dev/stdin -> fd/0

Replace /dev/stdin by a temporary file.

Reported-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
Tested-by: Thomas Monjalon <thomas.monjalon@6wind.com>
8 years agomk: fix build clean
Thomas Monjalon [Fri, 17 Jun 2016 13:20:16 +0000 (15:20 +0200)]
mk: fix build clean

The variables AESNI_MULTI_BUFFER_LIB_PATH and LIBSSO_PATH
are not required for "make clean".
It is the same fix as in the commit e277b2397.

Fixes: eec136f3c54f ("aesni_gcm: add driver for AES-GCM crypto operations")
Fixes: 3aafc423cf4d ("snow3g: add driver for SNOW 3G library")

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
8 years agomk: mute build of test resources
Thomas Monjalon [Thu, 16 Jun 2016 21:56:37 +0000 (23:56 +0200)]
mk: mute build of test resources

The objcopy and tar commands were printed even in quiet mode.
They are now replaced by a simple line and still visible in verbose mode.

Fixes: ab64f5df8004 ("app/test: support resources externally linked")
Fixes: 66819e6c11d8 ("app/test: support resources archived by tar")

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
8 years agoapp/testpmd: initialize pdump
Reshma Pattan [Wed, 15 Jun 2016 14:06:24 +0000 (15:06 +0100)]
app/testpmd: initialize pdump

Call rte_pdump_init and rte_pdump_uninit for packet
capturing initialization and uninitialization.

Signed-off-by: Reshma Pattan <reshma.pattan@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
8 years agoapp/pdump: add tool for packet capturing
Reshma Pattan [Wed, 15 Jun 2016 14:06:23 +0000 (15:06 +0100)]
app/pdump: add tool for packet capturing

The new pdump tool is added for packet capturing on dpdk.
This tool runs as secondary process by default.
Tool facilitates the command line options like
port, device_id, queue which user should pass on
to the tool to request the packet capture on those devices.

Tool creates the rte ring, mempool and pcap vdev and
calls the enable API of the pdump library with port/device_id,
queue, ring and mempool as arguments to enable the packet
capture on specific devices and gets the packets from the
primary process over the ring. Once the packets are
received, those packets will be send to the pcap vdev.

Tool can be terminated by using ctrl+c(SIGINT) upon which tool
calls the disable API of the pdump library to disable the packet capture
and dequeues the rest of the packets from the ring and sends them on
to the pcap vdev, then after releases all allocated resources.

Signed-off-by: Reshma Pattan <reshma.pattan@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
8 years agopdump: add new library for packet capture
Reshma Pattan [Wed, 15 Jun 2016 14:06:22 +0000 (15:06 +0100)]
pdump: add new library for packet capture

The librte_pdump library provides a framework for
packet capturing in dpdk. The library provides set of
APIs to initialize the packet capture framework, to
enable or disable the packet capture, and to uninitialize
it.

The librte_pdump library works on a client/server model.
The server is responsible for enabling or disabling the
packet capture and the clients are responsible
for requesting the enabling or disabling of the packet
capture.

Enabling APIs are supported with port, queue, ring and
mempool parameters. Applications should pass on this information
to get the packets from the dpdk ports.

For enabling requests from applications, library creates the client
request containing the mempool, ring, port and queue information and
sends the request to the server. After receiving the request, server
registers the Rx and Tx callbacks for all the port and queues.
After the callbacks registration, registered callbacks will get the
Rx and Tx packets. Packets then will be copied to the new mbufs that
are allocated from the user passed mempool. These new mbufs then will
be enqueued to the application passed ring. Applications need to dequeue
the mbufs from the rings and direct them to the devices like
pcap vdev for viewing the packets outside of the dpdk
using the packet capture tools.

For disabling requests, library creates the client request containing
the port and queue information and sends the request to the server.
After receiving the request, server removes the Rx and Tx callback
for all the port and queues.

Signed-off-by: Reshma Pattan <reshma.pattan@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
8 years agoethdev: get port by name
Reshma Pattan [Wed, 15 Jun 2016 14:06:21 +0000 (15:06 +0100)]
ethdev: get port by name

Converted rte_eth_dev_get_port_by_name to a public API.
Converted rte_eth_dev_get_name_by_port to a public API.

The librte_pdump library provides the APIs to enable or disable the
packet capture either using the port id or pci address or device name.
So pdump library need to do a mapping from name to port and port to name
internally to validate the device name and register the Rx and Tx
callbacks for the mapped ports. So these APIs are made public for the
pdump library for doing the mentioned mappings.

Signed-off-by: Reshma Pattan <reshma.pattan@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
8 years agoethdev: get queues numbers
Reshma Pattan [Wed, 15 Jun 2016 14:06:20 +0000 (15:06 +0100)]
ethdev: get queues numbers

The new fields nb_rx_queues and nb_tx_queues are added to the
rte_eth_dev_info structure.
Changes to API rte_eth_dev_info_get() are done to update these new fields
to the rte_eth_dev_info object.
Release notes is updated with the changes.

The librte_pdump library needs to register Rx and Tx callbacks for all
the nb_rx_queues and nb_tx_queues, when application wants to capture the
packets on all the software configured number of Rx and Tx queues of the
device. So far there is no support to get nb_rx_queues and nb_tx_queues
information from the ethdev library. Hence these changes are introduced.

Signed-off-by: Reshma Pattan <reshma.pattan@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
8 years agoethdev: insert Rx callback as head of list
Reshma Pattan [Wed, 15 Jun 2016 14:06:19 +0000 (15:06 +0100)]
ethdev: insert Rx callback as head of list

Added new public api rte_eth_add_first_rx_callback to add given
callback as head of the list.

The librte_pdump library should display Rx packets of the
NIC even before they are being processed by other callbacks
of the application (because other callbacks of the application
may change the packet data as part of the processing).
So packet capturing framework should register a callback at the
head of the Rx callback list so that callback always gets called
first before any other callbacks of the applications. Hence this API
is introduced.

Signed-off-by: Reshma Pattan <reshma.pattan@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
8 years agoethdev: protect Rx/Tx callback change with locks
Reshma Pattan [Wed, 15 Jun 2016 14:06:18 +0000 (15:06 +0100)]
ethdev: protect Rx/Tx callback change with locks

Added spinlocks around add/remove logic of Rx and Tx callbacks
to avoid corruption of callback lists in multithreaded context.

Signed-off-by: Reshma Pattan <reshma.pattan@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
8 years agoexamples/l2fwd-keepalive: add IPC liveness reporting
Remy Horton [Wed, 15 Jun 2016 15:25:51 +0000 (16:25 +0100)]
examples/l2fwd-keepalive: add IPC liveness reporting

Changes the l2fwd keepalive example to show how the new keepalive
enhancements can be used to relay core state to an external process.

Signed-off-by: Remy Horton <remy.horton@intel.com>
8 years agokeepalive: add liveness callback
Remy Horton [Wed, 15 Jun 2016 15:25:50 +0000 (16:25 +0100)]
keepalive: add liveness callback

Adds and documents new callbacks that allow transitions to core
states other than dead to be reported to applications.

Signed-off-by: Remy Horton <remy.horton@intel.com>
8 years agokeepalive: export states
Remy Horton [Wed, 15 Jun 2016 15:25:49 +0000 (16:25 +0100)]
keepalive: export states

Changes the keepalive state from an anonymous enum to a declared one
which is externally visible, so that keepalive enum values can be
used by applications.

Signed-off-by: Remy Horton <remy.horton@intel.com>
8 years agoethdev: remove name from extended statistic fetch
Remy Horton [Wed, 15 Jun 2016 15:25:33 +0000 (16:25 +0100)]
ethdev: remove name from extended statistic fetch

The current extended ethernet statistics fetching involve doing several
string operations, which causes performance issues if there are lots of
statistics and/or network interfaces. This patch changes the test-pmd
and proc_info applications to use the new xstats API, and removes
deprecated code associated with the old API.

Signed-off-by: Remy Horton <remy.horton@intel.com>
8 years agonet/virtio: fetch extended statistics with integer ids
Remy Horton [Wed, 15 Jun 2016 15:25:32 +0000 (16:25 +0100)]
net/virtio: fetch extended statistics with integer ids

The current extended ethernet statistics fetching involve doing several
string operations, which causes performance issues if there are lots of
statistics and/or network interfaces. This patch changes the virtio driver
to use the new API that seperates name string and value queries.

Signed-off-by: Remy Horton <remy.horton@intel.com>
8 years agonet/i40e: fetch extended statistics with integer ids
Remy Horton [Wed, 15 Jun 2016 15:25:31 +0000 (16:25 +0100)]
net/i40e: fetch extended statistics with integer ids

The current extended ethernet statistics fetching involve doing several
string operations, which causes performance issues if there are lots of
statistics and/or network interfaces. This patch changes the i40e driver
to use the new API that seperates name string and value queries.

Signed-off-by: Remy Horton <remy.horton@intel.com>
8 years agonet/fm10k: fetch extended statistics with integer ids
Remy Horton [Wed, 15 Jun 2016 15:25:30 +0000 (16:25 +0100)]
net/fm10k: fetch extended statistics with integer ids

The current extended ethernet statistics fetching involve doing several
string operations, which causes performance issues if there are lots of
statistics and/or network interfaces. This patch changes the fm10k driver
to use the new API that seperates name string and value queries.

Signed-off-by: Remy Horton <remy.horton@intel.com>
8 years agonet/igb: fetch extended statistics with integer ids
Remy Horton [Wed, 15 Jun 2016 15:25:29 +0000 (16:25 +0100)]
net/igb: fetch extended statistics with integer ids

The current extended ethernet statistics fetching involve doing several
string operations, which causes performance issues if there are lots of
statistics and/or network interfaces. This patch changes the e1000 driver
to use the new API that seperates name string and value queries.

Signed-off-by: Remy Horton <remy.horton@intel.com>
8 years agonet/ixgbe: fetch extended statistics with integer ids
Remy Horton [Wed, 15 Jun 2016 15:25:28 +0000 (16:25 +0100)]
net/ixgbe: fetch extended statistics with integer ids

The current extended ethernet statistics fetching involve doing several
string operations, which causes performance issues if there are lots of
statistics and/or network interfaces. This patch changes the ixgbe driver
to use the new API that seperates name string and value queries.

Signed-off-by: Remy Horton <remy.horton@intel.com>
8 years agoethdev: fetch extended statistics with integer ids
Remy Horton [Wed, 15 Jun 2016 15:25:27 +0000 (16:25 +0100)]
ethdev: fetch extended statistics with integer ids

The current extended ethernet statistics fetching involve doing several
string operations, which causes performance issues if there are lots of
statistics and/or network interfaces. This patch changes the xstats
functions to instead use a numeric identifier rather than a string, and
adds the ability to retrieve identifier-to-string mappings.

Signed-off-by: Remy Horton <remy.horton@intel.com>
8 years agoapp/testpmd: print RSS hash update error
Slawomir Mrozowicz [Wed, 15 Jun 2016 10:33:42 +0000 (12:33 +0200)]
app/testpmd: print RSS hash update error

Calling rte_eth_dev_rss_hash_update without checking return value.
Fixed by handle return value and print out error status.

Coverity issue: 119251
Fixes: ce8d561418d4 ("app/testpmd: add port configuration settings")

Signed-off-by: Slawomir Mrozowicz <slawomirx.mrozowicz@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
8 years agoapp/testpmd: show topology at forwarding start
Zhihong Wang [Tue, 14 Jun 2016 23:08:06 +0000 (19:08 -0400)]
app/testpmd: show topology at forwarding start

This patch show topology at forwarding start.

"show config fwd" also does this, but showing it directly can reduce the
possibility of misconfiguration.

Currently fwd_config_display() calls fwd_config_setup(), this misleading
behavior will be fixed in other patches.

Signed-off-by: Zhihong Wang <zhihong.wang@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
8 years agoapp/testpmd: handle all Rx queues in RSS setup
Zhihong Wang [Tue, 14 Jun 2016 23:08:05 +0000 (19:08 -0400)]
app/testpmd: handle all Rx queues in RSS setup

This patch removes constraints in rxq handling when multiqueue is enabled
to handle all the rxqs.

Current testpmd forces a dedicated core for each rxq, some rxqs may be
ignored when core number is less than rxq number, and that causes confusion
and inconvenience.

One example: an engineer was doing multiqueue test, there're 2
ports in guest each with 4 queues, and testpmd was used as the forwarding
engine in guest, as usual he used 1 core for forwarding, as a results he
only saw traffic from port 0 queue 0 to port 1 queue 0, then a lot of
emails and quite some time are spent to root cause it, and of course it's
caused by this unreasonable testpmd behavior.

Moreover, even if we understand this behavior, if we want to test the
above case, we still need 8 cores for a single guest to poll all the
rxqs, obviously this is too expensive.

We met quite a lot cases like this, one recent example:
http://openvswitch.org/pipermail/dev/2016-June/072110.html

Signed-off-by: Zhihong Wang <zhihong.wang@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
8 years agoapp/testpmd: show throughput in port stats
Zhihong Wang [Tue, 14 Jun 2016 23:08:04 +0000 (19:08 -0400)]
app/testpmd: show throughput in port stats

This patch adds throughput numbers (in the period since last use of this
command) in port statistics display for "show port stats (port_id|all)".

Signed-off-by: Zhihong Wang <zhihong.wang@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
8 years agoapp/testpmd: add tx_first burst number option
Zhihong Wang [Tue, 14 Jun 2016 23:08:03 +0000 (19:08 -0400)]
app/testpmd: add tx_first burst number option

This patch enables configurable tx_first burst number.

Use "start tx_first (burst_num)" to specify how many bursts of packets to
be sent before forwarding start, or "start tx_first" like before for the
default 1 burst send.

Signed-off-by: Zhihong Wang <zhihong.wang@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
8 years agoapp/testpmd: add retry option
Zhihong Wang [Tue, 14 Jun 2016 23:08:02 +0000 (19:08 -0400)]
app/testpmd: add retry option

This patch adds retry option in testpmd to prevent most packet losses.
It can be enabled by "set fwd <mode> retry". All modes except rxonly
support this option.

Adding retry mechanism expands test case coverage to support scenarios
where packet loss affects test results.

Signed-off-by: Zhihong Wang <zhihong.wang@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
8 years agoapp/testpmd: stop forwarding on exit
Bernard Iremonger [Tue, 14 Jun 2016 15:35:42 +0000 (16:35 +0100)]
app/testpmd: stop forwarding on exit

Stop forwarding on exit whether all ports are started or not.

Fixes: ce8d561418d4 ("app/testpmd: add port configuration settings")

Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
8 years agoapp/testpmd: check for valid mbuf pool
Bernard Iremonger [Tue, 14 Jun 2016 15:35:41 +0000 (16:35 +0100)]
app/testpmd: check for valid mbuf pool

Fixes: b6ea6408fbc7 ("ethdev: store numa_node per device")

Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
8 years agoapp/testpmd: check for valid socket id when attaching port
Bernard Iremonger [Tue, 14 Jun 2016 15:35:40 +0000 (16:35 +0100)]
app/testpmd: check for valid socket id when attaching port

Fixes: edab33b1c01d ("app/testpmd: support port hotplug")

Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
8 years agoapp/testpmd: move forward streams initialisation
Bernard Iremonger [Tue, 14 Jun 2016 15:35:39 +0000 (16:35 +0100)]
app/testpmd: move forward streams initialisation

Move call to init_fwd_streams from start_port function
to start_packet_forwarding function.

Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
8 years agoapp/testpmd: separate forward config setup from display
Bernard Iremonger [Tue, 14 Jun 2016 15:35:37 +0000 (16:35 +0100)]
app/testpmd: separate forward config setup from display

Add call to fwd_config_setup to init_config.
Add call to fwd_config_setup for corelist, coremask and nbcore setup.
Add call to fwd_config_setup for portlist, portmask and nbport setup.
Add call to fwd_config_setup for rxq, txq, rxd and txd setup.
Remove fwd_config_setup from fwd_config_display.
Call the pkt_fwd_config_display function directly,
and remove the fwd_config_display wrapper function.

Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
8 years agoapp/testpmd: check stopping port is not in bonding
Bernard Iremonger [Tue, 14 Jun 2016 15:35:38 +0000 (16:35 +0100)]
app/testpmd: check stopping port is not in bonding

Add new function port_is_bonding_slave
Use this function in stop_port and close_port functions.

Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
8 years agoapp/testpmd: check stopping port is not forwarding
Bernard Iremonger [Tue, 14 Jun 2016 15:35:36 +0000 (16:35 +0100)]
app/testpmd: check stopping port is not forwarding

Add calls to port_is_forwarding function in stop_port and
close_port functions to check that port is not forwarding.

Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
8 years agoapp/testpmd: do not update forwarding config
Bernard Iremonger [Tue, 14 Jun 2016 15:35:35 +0000 (16:35 +0100)]
app/testpmd: do not update forwarding config

Do not update forwarding configuration when attaching or detaching a port
Remove checks on test_done variable.
Remove code to update forwarding configuration.

Fixes: edab33b1c01d ("app/testpmd: support port hotplug")

Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
8 years agoconfig: enable virtio for ppc64
Olivier Matz [Tue, 17 May 2016 09:59:52 +0000 (11:59 +0200)]
config: enable virtio for ppc64

Now that virtio pmd is supported on ppc, enable it.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
8 years agovirtio: fix PCI accesses for ppc64 in legacy mode
David Marchand [Tue, 17 May 2016 09:59:51 +0000 (11:59 +0200)]
virtio: fix PCI accesses for ppc64 in legacy mode

Although ppc supports both endianesses, qemu supposes that the cpu is
big endian and enforces this for the virtio-net stuff.

Fix PCI accesses in legacy mode. Only ppc64le is supported at the moment.

Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
8 years agopci: mmap ioports on non-x86 Linux
Olivier Matz [Wed, 18 May 2016 16:27:30 +0000 (18:27 +0200)]
pci: mmap ioports on non-x86 Linux

On PPC64, the ioports are mapped in memory. Implement the missing part
of ioport API for PPC64 when using uio. This may also work on other
architectures but it has not been tested.

Signed-off-by: David Marchand <david.marchand@6wind.com>
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
8 years agopci: split function parsing resources in sysfs
Olivier Matz [Tue, 17 May 2016 09:59:49 +0000 (11:59 +0200)]
pci: split function parsing resources in sysfs

Split pci_parse_sysfs_resource() and introduce
pci_parse_one_sysfs_resource() that parses one line of sysfs resource
file.

This new function will be exported and used in next commits when
mapping the ioports resources.

No functional change.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
8 years agopci: remove invalid comment
Olivier Matz [Tue, 17 May 2016 09:59:48 +0000 (11:59 +0200)]
pci: remove invalid comment

In a previous commit, the file used to map the PCI resources changed
from "/dev/uio<x>" to "/sys/bus/pci/devices/<busaddr>/resource", making
the comment wrong. Remove it.

Fixes: 9e67561acd1a ("eal/linux: mmap uio resources using resourceX files")

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
8 years agoeal/linux: only call iopl on x86
Olivier Matz [Tue, 17 May 2016 09:59:47 +0000 (11:59 +0200)]
eal/linux: only call iopl on x86

From iopl(2) man page: "This call is mostly for the x86 architecture. On
many other architectures it does not exist or will always return an
error".

This patch removes the call to iopl() in rte_eal_iopl_init() for
architectures other than x86, and always return 0 (success). This was
already done for ARM in
commit 0291476ae364 ("eal/linux: never check iopl for arm")

Next patches will introduce the support of memory mapped IO resources
for architectures != x86.

On BSD, there is nothing to do as open("/dev/io") already does the
proper thing. See man IO(4).

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
8 years agopci: fix typos in ioport doxygen comments
Olivier Matz [Tue, 17 May 2016 09:59:46 +0000 (11:59 +0200)]
pci: fix typos in ioport doxygen comments

Fix some typos and add missing comments related to ioports API in
rte_pci.h.

Fixes: 756ce64b1 ("eal: introduce PCI ioport API")

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
8 years agombuf: add new Rx flags for stripped VLAN
Olivier Matz [Wed, 15 Jun 2016 11:48:07 +0000 (13:48 +0200)]
mbuf: add new Rx flags for stripped VLAN

The behavior of PKT_RX_VLAN_PKT was not very well defined, resulting in
PMDs not advertising the same flags in similar conditions.

Following discussion in [1], introduce 2 new flags PKT_RX_VLAN_STRIPPED
and PKT_RX_QINQ_STRIPPED that are better defined:

  PKT_RX_VLAN_STRIPPED: a vlan has been stripped by the hardware and its
  tci is saved in mbuf->vlan_tci. This can only happen if vlan stripping
  is enabled in the RX configuration of the PMD.

For now, the old flag PKT_RX_VLAN_PKT is kept but marked as deprecated.
It should be removed from applications and PMDs in a future revision.

This patch also updates the drivers. For PKT_RX_VLAN_PKT:

- e1000, enic, i40e, mlx5, nfp, vmxnet3: done, PKT_RX_VLAN_PKT already
  had the same meaning than PKT_RX_VLAN_STRIPPED, minor update is
  required.
- fm10k: done, PKT_RX_VLAN_PKT already had the same meaning than
  PKT_RX_VLAN_STRIPPED, and vlan stripping is always enabled on fm10k.
- ixgbe: modification done (vector and normal), the old flag was set
  when a vlan was recognized, even if vlan stripping was disabled.
- the other drivers do not support vlan stripping.

For PKT_RX_QINQ_PKT, it was only supported on i40e, and the behavior was
already correct, so we can reuse the same bit value for
PKT_RX_QINQ_STRIPPED.

[1] http://dpdk.org/ml/archives/dev/2016-April/037837.html,

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
8 years agoethdev: clarify the origin of mbufs
Olivier Matz [Mon, 13 Jun 2016 13:45:28 +0000 (15:45 +0200)]
ethdev: clarify the origin of mbufs

Following the discussion on dpdk-users [1], enhance the API
documentation of rte_eth_tx_burst() to specify that the mbufs have to be
allocated from a pool.

[1] http://dpdk.org/ml/archives/users/2016-June/000618.html

Reported-by: Xiaoban Wu <xiaoban_wu@student.uml.edu>
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
8 years agoexamples: fix duplicated lpm6 name
Olivier Matz [Mon, 13 Jun 2016 09:43:03 +0000 (11:43 +0200)]
examples: fix duplicated lpm6 name

When starting the ip_fragmentation or ip_reassembly example
on several sockets, it fails.

The name of the lpm6 table is the same on every socket,
resulting in a table creation failure (-EEXIST). The failure
appeared after:
commit f82f705b635d ("lpm: fix allocation of an existing object")

Indeed, before this commit the returned value when the existing
table, which was probably a bug in that case: one table for 2
sockets for lpm6, and one per socket for lpm.

Fixes: 74de12b7b63a ("examples/ip_fragmentation: overhaul")
Fixes: b84fb4cb88ff ("examples/ip_reassembly: overhaul")

Reported-by: Heng Ding <hengx.ding@intel.com>
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
8 years agoeal/x86: improve memcpy performance
Zhihong Wang [Wed, 25 May 2016 01:23:03 +0000 (21:23 -0400)]
eal/x86: improve memcpy performance

This patch fixes rte_memcpy performance in Haswell and Broadwell for
vhost when copy size larger than 256 bytes.

It is observed that for large copies like 1024/1518 ones, rte_memcpy
suffers high ratio of store buffer full issue which causes pipeline
to stall in scenarios like vhost enqueue. This can be alleviated by
adjusting instruction layout. Note that this issue may not be visible
in micro test.

How to reproduce?

PHY-VM-PHY using vhost/virtio or vhost/virtio loop back, with large
packets like 1024/1518 bytes ones. Make sure packet generation rate
is not the bottleneck if PHY-VM-PHY is used.

Test report: http://dpdk.org/ml/archives/dev/2016-May/039716.html

Signed-off-by: Zhihong Wang <zhihong.wang@intel.com>
Tested-by: Qian Xu <qian.q.xu@intel.com>
8 years agomempool: fix local cache initialization
Sergio Gonzalez Monroy [Thu, 9 Jun 2016 08:19:47 +0000 (09:19 +0100)]
mempool: fix local cache initialization

The mempool local cache was not initialized properly leading to
undefined behavior in cases where the allocated memory was used
previously and left with data.

Fixes: 213af31e0960 ("mempool: reduce structure size if no cache needed")

Signed-off-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
8 years agoapp/test: remove real PCI ids
Jan Viktorin [Tue, 14 Jun 2016 13:46:21 +0000 (15:46 +0200)]
app/test: remove real PCI ids

There are 2 new fake devices for testing PCI infra. All the fake devices
are now identified by non-existing vendor and device IDs so there is no
real driver to bind to them. The testing drivers match those IDs.

Suggested-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Signed-off-by: Jan Viktorin <viktorin@rehivetech.com>
8 years agoconfig: select maximum nodes and cores on ThunderX
Jerin Jacob [Mon, 13 Jun 2016 14:01:32 +0000 (19:31 +0530)]
config: select maximum nodes and cores on ThunderX

ThunderX platform can support dual sockets numa configuration and 48
cores per socket.

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
8 years agomk: define objcopy target and arch on IBM POWER
Chao Zhu [Wed, 15 Jun 2016 11:38:42 +0000 (19:38 +0800)]
mk: define objcopy target and arch on IBM POWER

This patch defines the target and arch value of objcopy program for
IBM POWER PPC64 little endian architecture.

Fixes: 99d6231fdca7 ("mk: define objcopy-specific target and arch")

Signed-off-by: Chao Zhu <chaozhu@linux.vnet.ibm.com>
8 years agoexamples/ip_pipeline: add core mappings script
Guruprasad Mukundarao [Fri, 10 Jun 2016 15:55:05 +0000 (16:55 +0100)]
examples/ip_pipeline: add core mappings script

This script parses the application configuration file and detects all the
pipelines specified therein, and then, it generates all the possible mappings
of those pipelines on the specified CPU core-list.

As a result, each of the possible pipeline-to-core mappings is saved as
separate output configuration file. For example- if input file is
edge_router_downstream.cfg with 3 pipeline (excluding pipeline 0) and
core-list is “1, 2”, following combinations will be generated-

Pipeline 1        Pipeline 2      Pipeline 3
Core = 1          Core = 1        Core = 2
Core = 1          Core = 2        Core = 1
Core = 2          Core = 1        Core = 1
Core = 2          Core = 2        Core = 1
Core = 2          Core = 1        Core = 2
Core = 1          Core = 2        Core = 2
Core = C1         Core = C1H      Core = C2
Core = C1         Core = C2       Core = C1H
Core = C2         Core = C1       Core = C1H

This script will help users to analyse the performance of application by
evaluating all the generated configuration files with different
pipelines-to-core mappings and obtaining the application configuration file
with best performance.

To run the script, issue the following command;

./pipeline-to-core-mapping.py -i <input_configuration_file> -pc "s<socket-id>c<core-id>"

Some optional arguments are as follows:
  -h, --help            show this help message and exit
  -ht {ON,OFF}, --hyper-thread {ON,OFF}
                        enable/disable hyper threading. default is ON
  -nO, --no-output-file
                        disable output config file generation. Output file
                        generation is enabled by default

Signed-off-by: Guruprasad Mukundarao <guruprasadx.rao@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
8 years agoexamples/ip_pipeline: fix false cacheline sharing among threads
Jasvinder Singh [Sun, 12 Jun 2016 12:42:47 +0000 (13:42 +0100)]
examples/ip_pipeline: fix false cacheline sharing among threads

In ip_pipeline app, the structure app_thread_data needs to be aligned to
the cache line boundary as threads on different cpu cores are accessing
fields of the app->thread_data and having this structure not aligned on
cacheline boundary leads to false cacheline sharing.

Fixes: 7f64b9c004aa ("examples/ip_pipeline: rework config file syntax")

Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
8 years agoexamples/ip_pipeline: fix null pointer dereference
Marcin Kerlin [Mon, 13 Jun 2016 09:35:48 +0000 (11:35 +0200)]
examples/ip_pipeline: fix null pointer dereference

Return value of function app_pipeline_type_find is not checking before
dereference. Fix this problem by adding checking condition.

Coverity issue: 127196
Fixes: b4aee0fb9c6d ("examples/ip_pipeline: reconfigure thread binding dynamically")

Signed-off-by: Marcin Kerlin <marcinx.kerlin@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
8 years agosched: fix build without red
Jasvinder Singh [Thu, 2 Jun 2016 10:28:10 +0000 (11:28 +0100)]
sched: fix build without red

This commit fixes the following compile error messages when
CONFIG_RTE_SCHED_RED=n and CONFIG_RTE_SCHED_COLLECT_STATS=y;

rte_sched.c: In function ‘rte_sched_port_update_subport_stats_on_drop’:
rte_sched.c:1090:41: error: unused parameter ‘red’
struct rte_mbuf *pkt, uint32_t red)
                                         ^
rte_sched.c: In function ‘rte_sched_port_update_queue_stats_on_drop’:
rte_sched.c:1116:39: error: unused parameter ‘red’
struct rte_mbuf *pkt, uint32_t red)

Fixes: 4d51afb5cdb6 ("sched: keep track of RED drops")

Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
8 years agokni: describe mempool capacity requirement
Alex Wang [Sat, 21 May 2016 07:58:36 +0000 (00:58 -0700)]
kni: describe mempool capacity requirement

Function like 'rte_kni_rx_burst()' keeps
allocating 'MAX_MBUF_BURST_NUM' mbufs to
kni fifo queue unless the queue's capacity
('KNI_FIFO_COUNT_MAX') is reached.  So, if
the mempool is under-provisioned, user may
run into "Out of Memory" logs from KNI code.
This commit documents the need to provision
mempool capacity of more than
"2 x KNI_FIFO_COUNT_MAX" for each KNI interface.

Signed-off-by: Alex Wang <alex@awakenetworks.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: John McNamara <john.mcnamara@intel.com>
8 years agokni: fix inverted function comments
Alex Wang [Sat, 21 May 2016 07:58:35 +0000 (00:58 -0700)]
kni: fix inverted function comments

The 'mbufs' alloc/free descriptions for
'rte_kni_tx_burst()' and 'rte_kni_rx_burst()'
should be inverted.

Fixes: 3fc5ca2 ("kni: initial import")

Signed-off-by: Alex Wang <alex@awakenetworks.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
8 years agodoc: add known issue in EAL argument parsing
Jingjing Wu [Mon, 23 May 2016 14:24:54 +0000 (22:24 +0800)]
doc: add known issue in EAL argument parsing

This patch docs the issue on EAL argument that the last EAL
argument is replaced by program name in argv[].

Reported-by: Ziye Yang <ziye.yang@intel.com>
Signed-off-by: Jingjing Wu <jingjing.wu@intel.com>
Acked-by: John McNamara <john.mcnamara@intel.com>
8 years agopci: support class id probing
Ziye Yang [Tue, 24 May 2016 12:50:36 +0000 (20:50 +0800)]
pci: support class id probing

This patch is used to add the class_id (class_code,
subclass_code, programming_interface) support for
pci_device probe. With this patch, it will be
flexible for users to probe a class of devices
by class_id.

Signed-off-by: Ziye Yang <ziye.yang@intel.com>
8 years agoconfig: make libarchive optional
Thomas Monjalon [Tue, 14 Jun 2016 08:51:39 +0000 (10:51 +0200)]
config: make libarchive optional

The commit 66819e6 has introduced a dependency on libarchive to be able
to use some tar resources in the unit tests.
It is now an optional dependency because some systems do not have it
installed.

If CONFIG_RTE_APP_TEST_RESOURCE_TAR is disabled, the PCI test will not
be run. When a "configure" script will be integrated, the libarchive
availability could be checked to automatically enable the option.

Signed-off-by: Thomas Monjalon <thomas.monjalon@6wind.com>
Reviewed-by: Jan Viktorin <viktorin@rehivetech.com>
8 years agoapp/test: fix wraparound of mempool performance rate
David Hunt [Thu, 26 May 2016 14:15:54 +0000 (15:15 +0100)]
app/test: fix wraparound of mempool performance rate

Recent CPU's can easily wrap around a 32-bit unsigned int in
the mempool perf test. Increase to a 64-bit uint.

Signed-off-by: David Hunt <david.hunt@intel.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>