dpdk.git
3 years agoexamples/fips_validation: fix parsing of algorithms
Archana Muniganti [Fri, 17 Apr 2020 15:08:40 +0000 (20:38 +0530)]
examples/fips_validation: fix parsing of algorithms

Few of the NIST TDES test files don't contain TDES string.
Added indicators to identify such files. These indicators
are part of only NIST TDES test vector files.

Fixes: 527cbf3d5ee3 ("examples/fips_validation: support TDES parsing")
Cc: stable@dpdk.org
Signed-off-by: Archana Muniganti <marchana@marvell.com>
Signed-off-by: Ayuj Verma <ayverma@marvell.com>
Acked-by: Anoob Joseph <anoobj@marvell.com>
3 years agocommon/qat: remove redundant check
Adam Dybkowski [Wed, 6 May 2020 21:31:07 +0000 (23:31 +0200)]
common/qat: remove redundant check

This patch removed the non-essential check for NULL pointer.

Coverity issue: 357770
Fixes: c13cecf60f12 ("compress/qat: support IM buffer too small operation")

Signed-off-by: Adam Dybkowski <adamx.dybkowski@intel.com>
Acked-by: Fiona Trahe <fiona.trahe@intel.com>
3 years agocommon/qat: fix enqueue/dequeue statistics
Adam Dybkowski [Wed, 6 May 2020 11:29:43 +0000 (13:29 +0200)]
common/qat: fix enqueue/dequeue statistics

This patch fixes enqueued and dequeued count statistics that should
contain the number of operations enqueued by the end user app
instead of the total number of QAT requests - bigger in case of
a multiple-request dynamic Huffman compression operation.

Fixes: c13cecf60f12 ("compress/qat: support IM buffer too small operation")

Signed-off-by: Adam Dybkowski <adamx.dybkowski@intel.com>
Acked-by: Fiona Trahe <fiona.trahe@intel.com>
3 years agoexamples/ipsec-secgw: fix ESP flow error log
Praveen Shetty [Wed, 6 May 2020 11:02:41 +0000 (12:02 +0100)]
examples/ipsec-secgw: fix ESP flow error log

Function create_ipsec_esp_flow returns a negative number in case of any
failure and we are passing this to strerror to display the error message.
But strerror()'s argument cannot be negative.
In case of failure, displaying exact error message to console is handled
in create_ipsec_esp_flow function.
So it is not required to print the error message again using strerror.
This patch will remove the unnecessary calling of strerror function
to fix the negative argument passing to strerror issue.

Coverity issue: 357691
Fixes: 6738c0a95695 ("examples/ipsec-secgw: support flow director")

Signed-off-by: Praveen Shetty <praveen.shetty@intel.com>
Acked-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
Acked-by: Anoob Joseph <anoobj@marvell.com>
3 years agocrypto/kasumi: fix extern declaration
Kevin Traynor [Wed, 6 May 2020 09:45:18 +0000 (10:45 +0100)]
crypto/kasumi: fix extern declaration

gcc 10 defaults to fno-common and it reports:

crypto_kasumi_rte_kasumi_pmd_ops.c.o:(.data.rel+0x0):
multiple definition of `rte_kasumi_pmd_ops';
crypto_kasumi_rte_kasumi_pmd.c.o:(.bss+0x8): first defined here

Fix by making rte_kasumi_pmd_ops extern in the header file.

Fixes: 2773c86d061a ("crypto/kasumi: add driver for KASUMI library")
Cc: stable@dpdk.org
Signed-off-by: Kevin Traynor <ktraynor@redhat.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
3 years agotest/crypto: set null cipher IV length to zero
Ankur Dwivedi [Wed, 6 May 2020 09:37:26 +0000 (15:07 +0530)]
test/crypto: set null cipher IV length to zero

For null cipher the iv length should be set to zero.

Signed-off-by: Ankur Dwivedi <adwivedi@marvell.com>
Acked-by: Anoob Joseph <anoobj@marvell.com>
Acked-by: Fiona Trahe <fiona.trahe@intel.com>
3 years agocrypto/dpaa_sec: repair memory allocations
Lukasz Wojciechowski [Tue, 5 May 2020 21:41:05 +0000 (23:41 +0200)]
crypto/dpaa_sec: repair memory allocations

This patch repairs 2 memory allocations issues:

1) possible leak of memory
    In cryptodev_dpaa_sec_probe() function in case of portal
    initialization failure, function exited without cleanup.

    The patch redirects flow to out label, which provides
    proper cleanup in case of error: freeing cryptodevice private
    data and releasing cryptodevice.

2) double free of cryptodev private data
    The function dpaa_sec_dev_init() in case of failure called
    dpaa_sec_uninit() which freed both private data and security
    context. However one layer above in cryptodev_dpaa_sec_probe()
    function, the private data were freed one more time.

    The patch limits cleanup of the dpaa_sec_dev_init() function
    to freeing only the security context.

Signed-off-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
3 years agocrypto/dpaa_sec: improve memory freeing
Lukasz Wojciechowski [Tue, 5 May 2020 21:41:04 +0000 (23:41 +0200)]
crypto/dpaa_sec: improve memory freeing

This patch fixes management of memory for authentication
and encryption keys.
There were two issues with former state of implementation:

1) Invalid access to dpaa_sec_session union members
    The dpaa_sec_session structure includes an anonymous union:
    union {
        struct {...} aead_key;
        struct {
            struct {...} cipher_key;
            struct {...} auth_key;
        };
    };
    Depending on the used algorithm a rte_zmalloc() function
    allocated memory that was kept in aead_key, cipher_key
    or auth_key. However every time the memory was released,
    rte_free() was called only on cipher and auth keys, even
    if pointer to allocated memory was stored in aead_key.

    The C language specification defines such behavior as undefined.
    As the cipher_key and aead_key are similar, have same sizes and
    alignment, it has worked, but it's directly against C specification.

    This patch fixes this, providing a free_session_data() function
    to free the keys data. It verifies which algorithm was used
    (aead or auth+cipher) and frees proper part of the union.

2) Some keys might have been freed multiple times
    In functions like: dpaa_sec_cipher_init(), dpaa_sec_auth_init(),
    dpaa_sec_chain_init(), dpaa_sec_aead_init() keys data were freed
    before returning due to some error conditions. However the pointers
    were not zeroed causing another calls to ret_free from higher
    layers of code. This causes an error log about invalid memory address
    to be printed.

    This patch fixes it by making only one layer responsible for freeing
    memory

Signed-off-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
3 years agocommon/qat: fix queue head update
Adam Dybkowski [Tue, 5 May 2020 15:30:37 +0000 (17:30 +0200)]
common/qat: fix queue head update

This patch fixes missing queue head update that occurred when
a multiple-request dynamic Huffman compression operation was not
complete within one qat_dequeue_op_burst function call.

Fixes: c13cecf60f12 ("compress/qat: support IM buffer too small operation")

Signed-off-by: Adam Dybkowski <adamx.dybkowski@intel.com>
Acked-by: Fiona Trahe <fiona.trahe@intel.com>
Tested-by: Xinfeng Zhao <xinfengx.zhao@intel.com>
3 years agoexamples/ipsec-secgw: clean up test scripts
Mariusz Drost [Mon, 4 May 2020 10:06:34 +0000 (12:06 +0200)]
examples/ipsec-secgw: clean up test scripts

As more test cases are defined for execution, test scripts structure
needs to be reorganized, so fewer files are needed to describe the test.
To achieve that, new environment variables are incorporated into the
scripts.
Additionally, tests for mixed tunnel protocols are added.

Signed-off-by: Mariusz Drost <mariuszx.drost@intel.com>
Tested-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
3 years agocrypto/qat: fix cipher descriptor for ZUC and SNOW
Arek Kusztal [Wed, 29 Apr 2020 14:51:34 +0000 (16:51 +0200)]
crypto/qat: fix cipher descriptor for ZUC and SNOW

Offset of cd pointer is too big by state1size + state2size, so few extra
unnecessary bytes will be copied into cd. Snow offset was improved as well.

Fixes: d9b7d5bbc845 ("crypto/qat: add ZUC EEA3/EIA3 capability")
Cc: stable@dpdk.org
Signed-off-by: Arek Kusztal <arkadiuszx.kusztal@intel.com>
Acked-by: Fiona Trahe <fiona.trahe@intel.com>
3 years agoapp/crypto-perf: fix display of sample test vector
Adam Dybkowski [Wed, 29 Apr 2020 10:57:04 +0000 (12:57 +0200)]
app/crypto-perf: fix display of sample test vector

This patch disables displaying sample test vector contents when
executing throughput and latency tests as the sample data is not
used in those tests (not copied to input mbuf in order to achieve
better performance).

Fixes: f8be1786b1b8 ("app/crypto-perf: introduce performance test application")
Cc: stable@dpdk.org
Signed-off-by: Adam Dybkowski <adamx.dybkowski@intel.com>
Acked-by: Fiona Trahe <fiona.trahe@intel.com>
3 years agocrypto/ccp: fix fd leak on probe failure
Yunjian Wang [Sun, 26 Apr 2020 06:36:15 +0000 (14:36 +0800)]
crypto/ccp: fix fd leak on probe failure

Zero is a valid fd. When ccp_probe_device() is failed, the uio_fd won't be
closed thus leading fd leak.

Fixes: ef4b04f87fa6 ("crypto/ccp: support device init")
Cc: stable@dpdk.org
Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
Acked-by: Ravi Kumar <ravi1.kumar@amd.com>
3 years agoipsec: optimize SA outbound sequence update
Phil Yang [Fri, 24 Apr 2020 04:33:04 +0000 (12:33 +0800)]
ipsec: optimize SA outbound sequence update

For SA outbound packets, rte_atomic64_add_return is used to generate
SQN atomically. Use C11 atomics with RELAXED ordering for outbound SQN
update instead of rte_atomic ops which enforce unnecessary barriers on
aarch64.

Signed-off-by: Phil Yang <phil.yang@arm.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
Reviewed-by: Gavin Hu <gavin.hu@arm.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
3 years agotest/security: enable tests for non-implemented ops
Lukasz Wojciechowski [Thu, 23 Apr 2020 16:25:54 +0000 (18:25 +0200)]
test/security: enable tests for non-implemented ops

After re-enabling checks for non-implemented ops in non-debug mode
in librte_security set_pkt_metadata and get_userdata functions,
tests verifying proper work of tests can be enabled also.

Signed-off-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
3 years agocrypto/aesni_mb: fix DOCSIS AES-256
Pablo de Lara [Thu, 23 Apr 2020 13:46:49 +0000 (14:46 +0100)]
crypto/aesni_mb: fix DOCSIS AES-256

When adding support for DOCSIS AES-256,
when setting the cipher parameters, all key sizes
were accepted, but only 128-bit and 256-bit keys
are supported.

Fixes: 9536622b86c8 ("crypto/aesni_mb: support DOCSIS AES-256")

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Mairtin o Loingsigh <mairtin.oloingsigh@intel.com>
3 years agotest/ipsec: add performance cases
Savinay Dharmappa [Thu, 23 Apr 2020 15:25:04 +0000 (16:25 +0100)]
test/ipsec: add performance cases

Add new test-case to measure performance of
IPsec data-path functions.

Signed-off-by: Savinay Dharmappa <savinay.dharmappa@intel.com>
Tested-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
3 years agocrypto/aesni_mb: check if session is valid
Pablo de Lara [Mon, 20 Apr 2020 11:05:29 +0000 (12:05 +0100)]
crypto/aesni_mb: check if session is valid

Check if session is valid after getting operation
out of the internal IPSec MB manager, in case the
session has been freed while the operation was still
inside the manager.

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
3 years agobbdev: fix doxygen comments
Nicolas Chautru [Sun, 19 Apr 2020 23:39:48 +0000 (16:39 -0700)]
bbdev: fix doxygen comments

Several doxygen markup were incorrect in header files.

Fixes: 4935e1e9f76e ("bbdev: introduce wireless base band device lib")
Cc: stable@dpdk.org
Signed-off-by: Nicolas Chautru <nicolas.chautru@intel.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
3 years agotest/flow_classify: enable multi-sockets system
Harry van Haaren [Fri, 1 May 2020 11:08:14 +0000 (12:08 +0100)]
test/flow_classify: enable multi-sockets system

This commit fixes failures of the flow_classify_autotest when
ran on dual-socket servers, as the sample application does not
support more than a single socket. Increasing the NB_SOCKETS
value allows the test to run successfully.

Fixes: 9c9befea4f57 ("test: add flow classify unit tests")
Cc: stable@dpdk.org
Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>
Tested-by: Ferruh Yigit <ferruh.yigit@intel.com>
Tested-by: Bernard Iremonger <bernard.iremonger@intel.com>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
3 years agotest/bonding: allow disabling driver
Bruce Richardson [Fri, 1 May 2020 15:05:49 +0000 (16:05 +0100)]
test/bonding: allow disabling driver

The autotest application build was partially enabled for building with
the net/bond driver disabled, but a number of items were missed, leading
to build errors when the driver was disabled, e.g. by simply doing
"-Ddisable_drivers=net/*" when calling meson.

  ../app/test/test_link_bonding.c:25:10: fatal error: rte_eth_bond.h: \
No such file or directory

With this fix in place, it's possible to build DPDK with meson with all
non-bus, non-mempool drivers disabled i.e. using meson option

-Ddisable_drivers=baseband/*,compress/*,crypto/*,event/*,net/*,raw/*,vdpa/*

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
Tested-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
3 years agoexamples/l3fwd-power: add Rx interrupt timeout
Anatoly Burakov [Thu, 7 May 2020 10:46:28 +0000 (11:46 +0100)]
examples/l3fwd-power: add Rx interrupt timeout

Currently, thread waiting on an interrupt does not have a timeout, so
it will not ever wake up until traffic arrives. This means that, when
time comes to exit the application, it will not quit unless there
happens to be traffic coming in and waking up the thread from sleep.

Fix it so that the interrupt thread sleeps for 10ms before waking up
and attempting to poll again. Additionally, remove the log message
to avoid spamming about entering interrupt mode.

Fixes: 613ce6691c0d ("examples/l3fwd-power: implement proper shutdown")
Cc: stable@dpdk.org
Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Acked-by: David Hunt <david.hunt@intel.com>
Tested-by: Lihong Ma <lihongx.ma@intel.com>
3 years agoevent/octeontx2: fix build for O1 optimization
Ferruh Yigit [Mon, 11 May 2020 16:07:25 +0000 (17:07 +0100)]
event/octeontx2: fix build for O1 optimization

Can be reproduced with "make EXTRA_CFLAGS='-O1'" command using
gcc 7.3.0

Build error
In file included from .../drivers/event/octeontx2/ot
x2_evdev.c:15:0:
.../drivers/event/octeontx2/otx2_evdev_stats.h:
    In function ‘otx2_sso_xstats_get’:
.../drivers/event/octeontx2/otx2_evdev_stats.h:124:9:
    error: ‘xstats’ may be used uninitialized in this function
           [-Werror=maybe-uninitialized]
   xstat = &xstats[ids[i] - start_offset];
   ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This is false positive, 'xstats_mode_count' should be preventing taking
the loop and accessing 'xstats'.
Returning in that case to silence the compiler warning.

Reported-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Tested-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
3 years agonet/ena: fix build for O1 optimization
Ferruh Yigit [Mon, 11 May 2020 16:07:24 +0000 (17:07 +0100)]
net/ena: fix build for O1 optimization

Can be reproduced with "make EXTRA_CFLAGS='-O1'" command using
gcc (GCC) 9.3.1 20200408 (Red Hat 9.3.1-2)

Build error:
.../drivers/net/ena/ena_ethdev.c: In function ‘eth_ena_dev_init’:
.../drivers/net/ena/ena_ethdev.c:1815:20:
    error: ‘wd_state’ may be used uninitialized in this function
           [-Werror=maybe-uninitialized]
 1815 |  adapter->wd_state = wd_state;
      |  ~~~~~~~~~~~~~~~~~~^~~~~~~~~~

This looks like false positive, fixing by assigning initial value to
'wd_state' variable.

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Michal Krawczyk <mk@semihalf.com>
3 years agomempool/octeontx2: fix build for gcc O1 optimization
Ferruh Yigit [Mon, 11 May 2020 16:07:23 +0000 (17:07 +0100)]
mempool/octeontx2: fix build for gcc O1 optimization

Can be reproduced with "make EXTRA_CFLAGS='-O1'" command using
gcc (GCC) 9.3.1 20200408 (Red Hat 9.3.1-2)

Build error:
In file included from .../drivers/mempool/octeontx2/otx2_mempool.h:13,
                from .../drivers/mempool/octeontx2/otx2_mempool_ops.c:8:
.../drivers/mempool/octeontx2/otx2_mempool_ops.c:
In function ‘otx2_npa_alloc’:
.../drivers/common/octeontx2/otx2_common.h:94:2:
    error: ‘aura_handle’ may be used uninitialized in this function
           [-Werror=maybe-uninitialized]
   94 |  rte_log(RTE_LOG_DEBUG, otx2_logtype_ ## subsystem,  \
      |  ^~~~~~~
.../drivers/mempool/octeontx2/otx2_mempool_ops.c:643:11:
    note: ‘aura_handle’ was declared here
  643 |  uint64_t aura_handle;
      |           ^~~~~~~~~~~

This looks like false positive, assigning an initial value to
'aura_handle' to fix the build error.

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
3 years agoring: fix build for gcc O1 optimization
Ferruh Yigit [Mon, 11 May 2020 16:07:22 +0000 (17:07 +0100)]
ring: fix build for gcc O1 optimization

Can be reproduced with "make EXTRA_CFLAGS='-O1'" command using
gcc (GCC) 9.3.1 20200408 (Red Hat 9.3.1-2)

Two build errors:
1)
In file included from .../build/include/rte_ring_elem.h:1093,
                 from .../lib/librte_rcu/rte_rcu_qsbr.c:21:
../lib/librte_rcu/rte_rcu_qsbr.c: In function ‘rte_rcu_qsbr_dq_reclaim’:
.../build/include/rte_ring_peek.h:282:22:
    error: ‘avail’ may be used uninitialized in this function
           [-Werror=maybe-uninitialized]
  282 |   *available = avail - n;
      |                ~~~~~~^~~
./build/include/rte_ring_peek.h:259:11: note: ‘avail’ was declared here
  259 |  uint32_t avail, head, next;
      |           ^~~~~

2)
In file included from .../build/include/rte_ring_elem.h:1093,
                 from .../build/include/rte_ring.h:405,
                 from .../app/test/test_ring_stress.h:13,
                 from .../app/test/test_ring_stress_impl.h:5,
                 from .../app/test/test_ring_peek_stress.c:5:
.../app/test/test_ring_peek_stress.c: In function ‘_st_ring_enqueue_bulk’:
.../build/include/rte_ring_peek.h:80:22:
    error: ‘free’ may be used uninitialized in this function
           [-Werror=maybe-uninitialized]
   80 |   *free_space = free - n;
      |                 ~~~~~^~~
.../build/include/rte_ring_peek.h:60:11: note: ‘free’ was declared here
   60 |  uint32_t free, head, next;
      |           ^~~~

The cases shouldn't be hit, and it looks like there is already logic
error if it has been hit, but assigning 'avail' & 'free' to '0' to fix
the build error.

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
3 years agoexamples/eventdev: fix crash on exit
Harry van Haaren [Tue, 5 May 2020 09:39:04 +0000 (10:39 +0100)]
examples/eventdev: fix crash on exit

This commit fixes a segfault on exit by using Ctrl^C if the master lcore
was also being used as a worker core. The root cause of the issue was
that the interrupt handler was cleaning up resources such as the ethdev
and eventdev ports, and once the interrupt handler would return, that
thread would continue working as an eventdev worker, and dereference the
memory which just had free() called on it.

Fixed by moving the cleanup code from the interrupt handler to the
cleanup stage of main(), which the master thread will execute once
it has returned from its worker() functionality.

Fixes: 085edac2ca38 ("examples/eventdev_pipeline: support Tx adapter")
Cc: stable@dpdk.org
Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>
Tested-by: Jun W Zhou <junx.w.zhou@intel.com>
3 years agotelemetry: fix error log output
David Marchand [Mon, 11 May 2020 14:39:21 +0000 (16:39 +0200)]
telemetry: fix error log output

Caught while running testpmd:
No telemetry legacy support- No legacy callbacks, legacy socket not createdInteractive-mode selected

Add missing \n.

Fixes: 6dd571fd07c3 ("telemetry: introduce new functionality")

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
3 years agotelemetry: fix build for armv7
David Marchand [Mon, 11 May 2020 13:32:12 +0000 (15:32 +0200)]
telemetry: fix build for armv7

telemetry can not depend on EAL anymore but it still wants to get arch
headers.
We directly point at the right source directories by using the same logic
than EAL. However the special case of armv7 has been missed.

Fix this by defaulting ARCH_DIR to RTE_ARCH.

Caught on OBS:
[  162s]   SYMLINK-FILE include/rte_telemetry.h
[  162s]   CC telemetry.o
[  162s]   CC telemetry_data.o
[  162s]   CC telemetry_legacy.o
[  162s] .../lib/librte_telemetry/telemetry.c:15:10: fatal error:
 rte_spinlock.h: No such file or directory
[  162s]  #include <rte_spinlock.h>
[  162s]           ^~~~~~~~~~~~~~~~
[  162s] compilation terminated.

Fixes: 6dd571fd07c3 ("telemetry: introduce new functionality")

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
3 years agomem: fix overflow on allocation
Bing Zhao [Thu, 7 May 2020 08:02:54 +0000 (16:02 +0800)]
mem: fix overflow on allocation

The size checking is done in the caller. The size parameter is an
unsigned (64b wide) right now, so the comparison with zero should be
enough in most cases. But it won't help in the following case.
If the allocating request input a huge number by mistake, e.g., some
overflow after the calculation (especially subtraction), the checking
in the caller will succeed since it is not zero. Indeed, there is not
enough space in the system to support such huge memory allocation.
Usually it will return failure in the following code. But if the
input size is just a little smaller than the UINT64_MAX, like -2 in
signed type.
The roundup will cause an overflow and then "reset" the size to 0,
and then only a header (128B now) with zero length will be returned.
The following will be the previous allocation header.
It should be OK in most cases if the application won't access the
memory body. Or else, some critical issue will be caused and not easy
to debug. So this issue should be prevented at the beginning, like
other big size failure, NULL pointer should be returned also.

Fixes: fdf20fa7bee9 ("add prefix to cache line macros")
Cc: stable@dpdk.org
Signed-off-by: Bing Zhao <bingz@mellanox.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
3 years agoexamples/l2fwd-keepalive: fix mbuf pool size
Louise Kilheeney [Mon, 27 Apr 2020 14:57:43 +0000 (15:57 +0100)]
examples/l2fwd-keepalive: fix mbuf pool size

MBUF pool of size 8192 was causing packet loss when using four ports. To
fix this issue this patch specifies the number of MBUF's per port
instead of having one set MBUF pool size, this way it will adapt to any
number of ports.

Fixes: e64833f2273a ("examples/l2fwd-keepalive: add sample application")
Cc: stable@dpdk.org
Signed-off-by: Louise Kilheeney <louise.kilheeney@intel.com>
Tested-by: Xi Zhang <xix.zhang@intel.com>
3 years agoraw/ioat: support ICX
Radu Nicolau [Wed, 29 Apr 2020 12:29:30 +0000 (13:29 +0100)]
raw/ioat: support ICX

Add support for Ice Lake IOAT DMA engine PCI Device ID.

Signed-off-by: Radu Nicolau <radu.nicolau@intel.com>
Reviewed-by: Bruce Richardson <bruce.richardson@intel.com>
3 years agobus/pci: optimise scanning with whitelist/blacklist
Sunil Kumar Kori [Sat, 2 May 2020 07:42:05 +0000 (13:12 +0530)]
bus/pci: optimise scanning with whitelist/blacklist

rte_bus_scan API scans all the available PCI devices irrespective of white
or black listing parameters then further devices are probed based on white
or black listing parameters. So unnecessary CPU cycles are wasted during
rte_pci_scan.

For Octeontx2 platform with core frequency 2.4 Ghz, rte_bus_scan consumes
around 26ms to scan around 90 PCI devices but all may not be used by the
application. So for the application which uses 2 NICs, rte_bus_scan
consumes few microseconds and rest time is saved with this patch.

Patch restricts devices to be scanned as per below mentioned conditions:
 - All devices will be scanned if no parameters are passed.
 - Only white listed devices will be scanned if white list is available.
 - All devices, except black listed, will be scanned if black list is
   available.

Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
Acked-by: Gaetan Rivet <grive@u256.net>
3 years agoremove references to private PCI probe function
David Marchand [Wed, 6 May 2020 12:43:13 +0000 (14:43 +0200)]
remove references to private PCI probe function

rte_pci_probe() is private to the PCI bus.
Clean the remaining references in the documentation and comments.

Fixes: c752998b5e2e ("pci: introduce library and driver")
Cc: stable@dpdk.org
Signed-off-by: David Marchand <david.marchand@redhat.com>
Reviewed-by: Gaetan Rivet <grive@u256.net>
3 years agobus/pci: reduce boot-up logs to absolute minimum
Jerin Jacob [Mon, 4 May 2020 13:26:53 +0000 (18:56 +0530)]
bus/pci: reduce boot-up logs to absolute minimum

Some machines may have a lot of PCI devices and all of them are
not bound to DPDK. In such case the logs from EAL creates a lot of
clutter on boot-up, typically one needs to scroll the screen to
find other issues in boot-up.

This patch changes the following to reduce the clutter in
the default boot-up logs.

- Change the log-level of PCI probes to `debug`
- Introduce new driver probe as `info` log-level for the successful probe.

Signed-off-by: Jerin Jacob <jerinj@marvell.com>
3 years agoservice: relax barriers with C11 atomics
Phil Yang [Wed, 6 May 2020 15:28:04 +0000 (23:28 +0800)]
service: relax barriers with C11 atomics

The runstate, comp_runstate and app_runstate are used as guard variables
in the service core lib. To guarantee the inter-threads visibility of
these guard variables, it uses rte_smp_r/wmb. This patch use c11 atomic
built-ins to relax these barriers.

Signed-off-by: Phil Yang <phil.yang@arm.com>
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
Acked-by: Harry van Haaren <harry.van.haaren@intel.com>
3 years agoservice: optimize with C11 atomics
Phil Yang [Wed, 6 May 2020 15:28:03 +0000 (23:28 +0800)]
service: optimize with C11 atomics

The num_mapped_cores is used as a statistics. Use c11 atomics with
RELAXED ordering for num_mapped_cores instead of rte_atomic ops which
enforce unnessary barriers on aarch64.

Replace execute_lock operations to spinlock_try_lock to avoid duplicate
code.

Signed-off-by: Phil Yang <phil.yang@arm.com>
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
Acked-by: Harry van Haaren <harry.van.haaren@intel.com>
3 years agoservice: remove redundant code
Phil Yang [Wed, 6 May 2020 15:28:02 +0000 (23:28 +0800)]
service: remove redundant code

The service id validation is duplicated, remove the redundant code
in the calling functions.

Signed-off-by: Phil Yang <phil.yang@arm.com>
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
Acked-by: Harry van Haaren <harry.van.haaren@intel.com>
3 years agoservice: remove rte prefix from static functions
Phil Yang [Wed, 6 May 2020 15:28:01 +0000 (23:28 +0800)]
service: remove rte prefix from static functions

clean up rte prefix from static functions.
remove unused parameter for service_dump_one function.

Signed-off-by: Phil Yang <phil.yang@arm.com>
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
Acked-by: Harry van Haaren <harry.van.haaren@intel.com>
3 years agoservice: fix identification of service running on other lcore
Honnappa Nagarahalli [Wed, 6 May 2020 15:28:00 +0000 (23:28 +0800)]
service: fix identification of service running on other lcore

The logic to identify if the MT unsafe service is running on another
core can return -EBUSY spuriously. In such cases, running the service
becomes costlier than using atomic operations. Assume that the
application passes the right parameters and reduce the number of
instructions for all cases.

Cc: stable@dpdk.org
Fixes: 8d39d3e237c2 ("service: fix race in service on app lcore function")

Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
Reviewed-by: Phil Yang <phil.yang@arm.com>
Acked-by: Harry van Haaren <harry.van.haaren@intel.com>
4 years agoservice: fix race condition for MT unsafe service
Honnappa Nagarahalli [Wed, 6 May 2020 15:27:59 +0000 (23:27 +0800)]
service: fix race condition for MT unsafe service

A MT unsafe service might get configured to run on another core
while the service is running currently. This might result in the
MT unsafe service running on multiple cores simultaneously. Use
'execute_lock' always when the service is MT unsafe.

If the service is known to be mapped on a single lcore,
setting the service capability to MT safe will avoid taking
the lock and improve the performance.

Fixes: e9139a32f6e8 ("service: add function to run on app lcore")
Cc: stable@dpdk.org
Signed-off-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
Reviewed-by: Phil Yang <phil.yang@arm.com>
Acked-by: Harry van Haaren <harry.van.haaren@intel.com>
4 years agotest/service: add perf test for service on app lcore
Harry van Haaren [Wed, 6 May 2020 17:16:42 +0000 (18:16 +0100)]
test/service: add perf test for service on app lcore

This commit adds a basic test to check the cycle cost
of related to calling into a service.

Signed-off-by: Harry van Haaren <harry.van.haaren@intel.com>
Tested-by: Phil Yang <phil.yang@arm.com>
Reviewed-by: Phil Yang <phil.yang@arm.com>
4 years agodoc: update telemetry guides
Ciara Power [Thu, 30 Apr 2020 16:01:37 +0000 (17:01 +0100)]
doc: update telemetry guides

The existing documentation for Telemetry is updated, and further
documentation is added.

Signed-off-by: Ciara Power <ciara.power@intel.com>
Reviewed-by: Keith Wiles <keith.wiles@intel.com>
4 years agoeal: add telemetry callbacks
Bruce Richardson [Thu, 30 Apr 2020 16:01:36 +0000 (17:01 +0100)]
eal: add telemetry callbacks

EAL now registers commands to provide some basic info from EAL.

Example:
Connecting to /var/run/dpdk/rte/dpdk_telemetry.v2
{"version": "DPDK 20.05.0-rc0", "pid": 72662, "max_output_len": 16384}
--> /
{"/": ["/", "/eal/app_params", "/eal/params", "/ethdev/link_status", \
    "/ethdev/list", "/ethdev/xstats", "/help", "/info", "/rawdev/list", \
    "/rawdev/xstats"]}
--> /eal/app_params
{"/eal/app_params": ["-i"]}
--> /eal/params
{"/eal/params": ["./app/dpdk-testpmd"]}

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: Ciara Power <ciara.power@intel.com>
Reviewed-by: Keith Wiles <keith.wiles@intel.com>
4 years agoeal: remove option registration infrastructure
Ciara Power [Thu, 30 Apr 2020 16:01:35 +0000 (17:01 +0100)]
eal: remove option registration infrastructure

As Telemetry no longer uses rte_option, and was the only user of this
infrastructure, it can now be removed.

Signed-off-by: Ciara Power <ciara.power@intel.com>
Reviewed-by: Keith Wiles <keith.wiles@intel.com>
4 years agoeal: add telemetry as dependency
Ciara Power [Thu, 30 Apr 2020 16:01:34 +0000 (17:01 +0100)]
eal: add telemetry as dependency

This patch moves telemetry further down the build, and adds it as a
dependency for EAL. Telemetry V2 is now configured to build by default,
and the legacy support is built when the telemetry config flag is set.

Telemetry now has EAL flags, shown below:
"--telemetry" = Enables telemetry (this is default if no flags given)
"--no-telemetry" = Disables telemetry

When telemetry is enabled, it will attempt to open the new socket
version, and also the legacy support socket (this will depend on Jansson
external dependency and telemetry config flag, as before).

Signed-off-by: Ciara Power <ciara.power@intel.com>
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Keith Wiles <keith.wiles@intel.com>
4 years agotelemetry: remove redundant code
Ciara Power [Thu, 30 Apr 2020 16:01:33 +0000 (17:01 +0100)]
telemetry: remove redundant code

This patch removes the existing telemetry files, which are now redundant
as the new version of telemetry has backward compatibility for their
functionality.

Signed-off-by: Ciara Power <ciara.power@intel.com>
Reviewed-by: Keith Wiles <keith.wiles@intel.com>
4 years agotelemetry: introduce backward compatibility
Ciara Power [Thu, 30 Apr 2020 16:01:32 +0000 (17:01 +0100)]
telemetry: introduce backward compatibility

The new telemetry will now open a socket using the old telemetry path,
to ensure backward compatibility. This is not yet initialised, as it
would clash with the existing telemetry, to be removed in a later patch.
This means that both old and new telemetry socket interfaces are
handled in a common way.

Signed-off-by: Ciara Power <ciara.power@intel.com>
Reviewed-by: Keith Wiles <keith.wiles@intel.com>
4 years agoexamples/l3fwd-power: use new telemetry
Ciara Power [Thu, 30 Apr 2020 16:01:31 +0000 (17:01 +0100)]
examples/l3fwd-power: use new telemetry

The l3fwd-power example app now registers a stats command with
telemetry, and provides a callback function to handle formatting the
power stats.

An example usage is shown below:

Connecting to /var/run/dpdk/rte/dpdk_telemetry.v2
{"version": "DPDK 20.05.0-rc0", "pid": 63384, "max_output_len": 16384}
--> /
{"/": ["/", "/ethdev/link_status", "/ethdev/list", "/ethdev/xstats", \
    "/help", "/info", "/l3fwd-power/stats", "/rawdev/list", \
    "/rawdev/xstats"]}
--> /l3fwd-power/stats
{"/l3fwd-power/stats": {"empty_poll": 281625000, "full_poll": 0, \
    "busy_percent": 0}}

The existing stats tracking done by the app using the metrics
library is unaffected. This will still be used to ensure backward
compatibility.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: Ciara Power <ciara.power@intel.com>
Reviewed-by: Keith Wiles <keith.wiles@intel.com>
4 years agorawdev: add telemetry callbacks
Ciara Power [Thu, 30 Apr 2020 16:01:30 +0000 (17:01 +0100)]
rawdev: add telemetry callbacks

The rawdev library now registers commands with telemetry, and
implements the corresponding callback functions. These allow a list of
rawdev devices and xstats for a rawdev port to be queried.

An example usage, with ioat rawdev driver instances, is shown below:

Connecting to /var/run/dpdk/rte/dpdk_telemetry.v2
{"version": "DPDK 20.05.0-rc0", "pid": 65777, "max_output_len": 16384}
--> /
{"/": ["/", "/ethdev/link_status", "/ethdev/list", "/ethdev/xstats", \
    "/help", "/info", "/rawdev/list", "/rawdev/xstats"]}
--> /rawdev/list
{"/rawdev/list": [0, 1, 2, 3, 4, 5]}
--> /rawdev/xstats,0
{"/rawdev/xstats": {"failed_enqueues": 0, "successful_enqueues": 0, \
    "copies_started": 0, "copies_completed": 0}}

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: Ciara Power <ciara.power@intel.com>
Reviewed-by: Keith Wiles <keith.wiles@intel.com>
4 years agoethdev: add telemetry callbacks
Bruce Richardson [Thu, 30 Apr 2020 16:01:29 +0000 (17:01 +0100)]
ethdev: add telemetry callbacks

The ethdev library now registers commands with telemetry, and
implements the callback functions. These commands allow the list of
ethdev ports and the xstats and link status for a port to be queried.

An example using ethdev commands is shown below:

Connecting to /var/run/dpdk/rte/dpdk_telemetry.v2
{"version": "DPDK 20.05.0-rc0", "pid": 64379, "max_output_len": 16384}
--> /
{"/": ["/", "/ethdev/link_status", "/ethdev/list", "/ethdev/xstats", \
    "/help", "/info"]}
--> /ethdev/list
{"/ethdev/list": [0, 1, 2, 3]}
--> /ethdev/link_status,0
{"/ethdev/link_status": {"status": "UP", "speed": 10000, "duplex": \
    "full-duplex"}}
--> /ethdev/xstats,0
{"/ethdev/xstats": {"rx_good_packets": 0, "tx_good_packets": 0, \
    <snip>
    "tx_priority7_xon_to_xoff_packets": 0}}

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: Ciara Power <ciara.power@intel.com>
Reviewed-by: Keith Wiles <keith.wiles@intel.com>
4 years agousertools: add new telemetry script
Bruce Richardson [Thu, 30 Apr 2020 16:01:28 +0000 (17:01 +0100)]
usertools: add new telemetry script

This patch adds a python script that can be used with the new telemetry
socket. It connects as a client to the socket, and allows the user send
a command and see the JSON response.

The example usage below shows the script connecting to the new telemetry
socket, and sending three default telemetry commands entered by the user.
The response for each command is shown below the user input.

Connecting to /var/run/dpdk/rte/dpdk_telemetry.v2
{"version": "DPDK 20.05.0-rc0", "pid": 32794, "max_output_len": 16384}
--> /
{"/": ["/", "/help", "/info"]}
--> /info
{"/info": {"version": "DPDK 20.05.0-rc0", "pid": 32794, \
    "max_output_len": 16384}}
--> /help,/info
{"/help": {"/info": "Returns DPDK Telemetry information. \
    Takes no parameters"}}

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: Ciara Power <ciara.power@intel.com>
Reviewed-by: Keith Wiles <keith.wiles@intel.com>
4 years agotelemetry: add default callback commands
Ciara Power [Thu, 30 Apr 2020 16:01:27 +0000 (17:01 +0100)]
telemetry: add default callback commands

The default commands are now added to provide the list of commands
available, help text for a specified command, and also information
about DPDK and telemetry.

Signed-off-by: Ciara Power <ciara.power@intel.com>
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Keith Wiles <keith.wiles@intel.com>
4 years agotelemetry: add functions for returning callback data
Bruce Richardson [Thu, 30 Apr 2020 16:01:26 +0000 (17:01 +0100)]
telemetry: add functions for returning callback data

The functions added in this patch will help applications build
up data in reply to a telemetry request.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Keith Wiles <keith.wiles@intel.com>
4 years agotelemetry: introduce new functionality
Bruce Richardson [Thu, 30 Apr 2020 16:01:25 +0000 (17:01 +0100)]
telemetry: introduce new functionality

This patch introduces a new telemetry connection socket and handling
functionality. Like the existing telemetry implementation (which is
unaffected by this change) it uses a unix socket, but unlike the
existing one it does not have a fixed list of commands - instead
libraries or applications can register telemetry commands and callbacks
to provide a full-extensible solution for all kinds of telemetry across
DPDK.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: Ciara Power <ciara.power@intel.com>
Reviewed-by: Keith Wiles <keith.wiles@intel.com>
4 years agotelemetry: add utility functions for creating JSON
Bruce Richardson [Thu, 30 Apr 2020 16:01:24 +0000 (17:01 +0100)]
telemetry: add utility functions for creating JSON

The functions added in this patch will make it easier for telemetry
to convert data to correct JSON responses to telemetry requests.
Tests are also  added for these json utility functions.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Keith Wiles <keith.wiles@intel.com>
4 years agotelemetry: invert dependency on metrics library
Bruce Richardson [Thu, 30 Apr 2020 16:01:23 +0000 (17:01 +0100)]
telemetry: invert dependency on metrics library

Rather than having the telemetry library depend on the metrics
lib we invert the dependency so that metrics instead depends
on telemetry lib, and registers the needed functions with it
at init time. This prepares the way for a cleaner telemetry
architecture to be applied in later patches.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Keith Wiles <keith.wiles@intel.com>
4 years agometrics: reduce telemetry code
Ciara Power [Thu, 30 Apr 2020 16:01:22 +0000 (17:01 +0100)]
metrics: reduce telemetry code

The telemetry code that was moved into the metrics library can be
shortened, while still maintaining the same functionality.

Signed-off-by: Ciara Power <ciara.power@intel.com>
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Keith Wiles <keith.wiles@intel.com>
4 years agotelemetry: move some functions to metrics library
Ciara Power [Thu, 30 Apr 2020 16:01:21 +0000 (17:01 +0100)]
telemetry: move some functions to metrics library

This commit moves some of the telemetry library code to a new file in
the metrics library. No modifications are made to the moved code,
except what is needed to allow it to compile and run. The additional
code in metrics is built only when the Jansson library is  present.
Telemetry functions as normal, using the functions from the
metrics_telemetry file. This move will enable code be reused by the new
version of telemetry in a later commit, to support backward
compatibility with the existing telemetry usage.

Signed-off-by: Ciara Power <ciara.power@intel.com>
Reviewed-by: Keith Wiles <keith.wiles@intel.com>
4 years agobuild: add arch-specific header path to global includes
Bruce Richardson [Thu, 30 Apr 2020 16:01:20 +0000 (17:01 +0100)]
build: add arch-specific header path to global includes

The global include path, which is used by anything built before EAL,
points to the EAL header files so they utility macros etc. can be used
anywhere in DPDK. This path included the OS-specific EAL header files,
but not the architecture-specific ones. This patch moves the selection
of target architecture to the top-level meson.build file so that the
global include can reference that.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Keith Wiles <keith.wiles@intel.com>
4 years agoeal/x86: add more CPU flags
Kevin Laatz [Tue, 28 Apr 2020 12:40:26 +0000 (13:40 +0100)]
eal/x86: add more CPU flags

This patch adds CPU flags which will enable the detection of ISA
features available on more recent x86 based CPUs.

The CPUID leaf information can be found in
Table 1-2. "Information Returned by CPUID Instruction" of this document:
https://software.intel.com/sites/default/files/managed/c5/15/architecture-instruction-set-extensions-programming-reference.pdf

The following CPU flags are added in this patch:
    - AVX-512 doubleword and quadword instructions.
    - AVX-512 integer fused multiply-add instructions.
    - AVX-512 conflict detection instructions.
    - AVX-512 byte and word instructions.
    - AVX-512 vector length instructions.
    - AVX-512 vector bit manipulation instructions.
    - AVX-512 vector bit manipulation 2 instructions.
    - Galois field new instructions.
    - Vector AES instructions.
    - Vector carry-less multiply instructions.
    - AVX-512 vector neural network instructions.
    - AVX-512 for bit algorithm instructions.
    - AVX-512 vector popcount instructions.
    - Cache line demote instructions.
    - Direct store instructions.
    - Direct store 64B instructions.
    - AVX-512 two register intersection instructions.

Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>
Acked-by: Harry van Haaren <harry.van.haaren@intel.com>
Acked-by: Ray Kinsella <mdr@ashroe.eu>
4 years agoeal/windows: support logging
Pallavi Kadam [Wed, 6 May 2020 01:30:32 +0000 (18:30 -0700)]
eal/windows: support logging

Initialize logging on Windows to send log output
to the console.

Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
Reviewed-by: Tasnim Bashar <tbashar@mellanox.com>
Tested-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
Tested-by: Narcisa Vasile <navasile@linux.microsoft.com>
Acked-by: Narcisa Vasile <navasile@linux.microsoft.com>
4 years agoeal/windows: add fnmatch implementation
Pallavi Kadam [Wed, 6 May 2020 01:30:31 +0000 (18:30 -0700)]
eal/windows: add fnmatch implementation

Fnmatch implementation is required on Windows to support
log level arguments specified with a globbing pattern.
The source file is with BSD-3-Clause license.
https://github.com/lattera/freebsd/blob/master/usr.bin/csup/fnmatch.c

Signed-off-by: Pallavi Kadam <pallavi.kadam@intel.com>
Reviewed-by: Ranjit Menon <ranjit.menon@intel.com>
Reviewed-by: Tasnim Bashar <tbashar@mellanox.com>
Tested-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
Acked-by: Narcisa Vasile <navasile@linux.microsoft.com>
4 years agomk: fix static linkage of mlx dependency
Bing Zhao [Wed, 29 Apr 2020 12:11:55 +0000 (20:11 +0800)]
mk: fix static linkage of mlx dependency

When building a target application with static linking mode via
makefiles and enable linking to ibverbs libs by setting
"CONFIG_RTE_IBVERBS_LINK_STATIC=y". The libibverbs.pc will be
chosen and all the libs listed in the file will be linked
by default. Some static lib archives may contain the same files
and common interfaces inside.
The "--no-whole-archive" needs to be enabled for the linker to
discard the useless symbols and resolve the symbols redefinition
error.

Fixes: 2c0dd7b69fb0 ("config: add static linkage of mlx dependency")
Cc: stable@dpdk.org
Signed-off-by: Bing Zhao <bingz@mellanox.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
4 years agocommon/octeontx: fix gcc 9.1 ABI break
Pavan Nikhilesh [Sat, 2 May 2020 16:10:31 +0000 (21:40 +0530)]
common/octeontx: fix gcc 9.1 ABI break

GCC 9.1 fixes a bug with passing bitfields as pass by value in function
parameters and generates a warning for the same as below:

drivers/common/octeontx/octeontx_mbox.c:282:1: note: parameter passing
for argument of type ‘struct mbox_intf_ver’ changed in GCC 9.1

Fix the warning generated by passing bitfield as pass by reference.

Fixes: b4134b2d31cc ("common/octeontx: update mbox to version 1.1.3")
Cc: stable@dpdk.org
Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Acked-by: Harman Kalra <hkalra@marvell.com>
Tested-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agoevent/dsw: avoid reusing previously recorded events
Mattias Rönnblom [Mon, 4 May 2020 09:30:59 +0000 (11:30 +0200)]
event/dsw: avoid reusing previously recorded events

Avoid reusing recorded events when performing a migration, since this
may make the migration selection logic pick an already-moved flow.

Fixes: f6257b22e767 ("event/dsw: add load balancing")
Cc: stable@dpdk.org
Reported-by: Venky Venkatesh <vvenkatesh@paloaltonetworks.com>
Signed-off-by: Mattias Rönnblom <mattias.ronnblom@ericsson.com>
4 years agoevent/octeontx: support Rx/Tx checksum offload
Harman Kalra [Tue, 28 Apr 2020 12:40:12 +0000 (18:10 +0530)]
event/octeontx: support Rx/Tx checksum offload

Adding support for rx checksum offload. In case of wrong
checksum received (inner/outer l3/l4) it reports the
corresponding layer which has bad checksum. It also adds
rx burst function pointer hook for rx checksum offload to
event PMD.

Signed-off-by: Harman Kalra <hkalra@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
4 years agoevent/octeontx: support VLAN filter offload
Vamsi Attunuru [Tue, 28 Apr 2020 12:40:11 +0000 (18:10 +0530)]
event/octeontx: support VLAN filter offload

Adding rx burst function pointer hooks for vlan filter
offload in event PMD.

Signed-off-by: Vamsi Attunuru <vattunuru@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
4 years agoevent/octeontx: add framework for Rx/Tx offloads
Harman Kalra [Tue, 28 Apr 2020 12:40:10 +0000 (18:10 +0530)]
event/octeontx: add framework for Rx/Tx offloads

Adding macro based framework to hook dequeue/enqueue function
pointers to the appropriate function based on rx/tx offloads.

Signed-off-by: Harman Kalra <hkalra@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
4 years agoevent/octeontx: support multi-segment
Harman Kalra [Tue, 28 Apr 2020 12:40:09 +0000 (18:10 +0530)]
event/octeontx: support multi-segment

Adding support for multi segment to the eventdev PMD.

Signed-off-by: Harman Kalra <hkalra@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
4 years agoeventdev: fix probe and remove for secondary process
Pavan Nikhilesh [Mon, 27 Apr 2020 18:10:38 +0000 (23:40 +0530)]
eventdev: fix probe and remove for secondary process

When probing event device in secondary process skip reinitializing
the device data structure as it is already done in primary process.

When removing event device in secondary process skip closing the
event device as it should be done by primary process.

Fixes: 322d0345c2bc ("eventdev: implement PMD registration functions")
Cc: stable@dpdk.org
Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
4 years agoevent/octeontx2: fix queue removal from Rx adapter
Lukasz Bartosik [Thu, 16 Apr 2020 15:47:40 +0000 (17:47 +0200)]
event/octeontx2: fix queue removal from Rx adapter

When eth port queue is removed from Rx adapter using
rte_event_eth_rx_adapter_queue_del() it incorrectly
initializes CQ context instead of modifying it. This
might lead to a crash when CQ context is modified
as a part of rte_eth_dev_stop() sequence as CQ will
hold invalid entries. This is responsibility of an
application to call rte_event_eth_rx_adapter_queue_del()
to remove eth port queue from Rx adapter in tear down
sequence.

Fixes: 37720fc1fba8 ("event/octeontx2: add Rx adapter")
Cc: stable@dpdk.org
Signed-off-by: Lukasz Bartosik <lbartosik@marvell.com>
Acked-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
4 years agoexamples/l3fwd: fix error checking
Sunil Kumar Kori [Fri, 17 Apr 2020 08:25:16 +0000 (13:55 +0530)]
examples/l3fwd: fix error checking

This patch fixes coverity issues regard to error check.

Coverity issue: 354227, 354232, 354238, 354239, 354240
Fixes: aaf58cb85b62 ("examples/l3fwd: add event port and queue setup")
Cc: stable@dpdk.org
Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
Acked-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
4 years agonet/mlx5: fix flow rules with Verbs
Ophir Munk [Tue, 5 May 2020 06:16:07 +0000 (06:16 +0000)]
net/mlx5: fix flow rules with Verbs

The flow_verbs_translate() function accumulates hash fields while
iterating through the flow items (SRC_IPV4, DST_IPV4, SRC_IPV6,
DST_IPV6, SRC_PORT_TCP, DST_PORT_TCP, SRC_PORT_UDP, DST_PORT_UDP).
Before this commit the dev_flow handle structure was reused in each new
flow_verbs_translate() call, however the dev_flow->hash_fields variable
was not reset before each call. As a result hash_fields from previous
calls remained present in the current flow which lead to invalid
combinations (e.g.  simultaneous IPv4 and IPv6 specs). This scenario
happens for example in the next flows sequence, when running in verbs
mode (dv_flow_en=0).

flow create 0 ingress group 0 pattern eth / ipv4 / end <rss actions>
flow create 0 ingress group 0 pattern eth / ipv6 / end <rss actions>

The fix is to reset dev_flow->hash_fields in flow_verbs_prepare().

Fixes: e7bfa3596a0a ("net/mlx5: separate the flow handle resource")

Signed-off-by: Ophir Munk <ophirmu@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
4 years agodoc: explicit flow config behaviour in mlx5 guide
Bing Zhao [Wed, 22 Apr 2020 15:27:15 +0000 (23:27 +0800)]
doc: explicit flow config behaviour in mlx5 guide

This patch updates the MLX5 PMD and release notes documentations.
Adding the notes of the behavior change that rte flows organization
is switched into non-cached mode for applications.

Signed-off-by: Bing Zhao <bingz@mellanox.com>
Acked-by: Ori Kam <orika@mellanox.com>
4 years agodoc: add hairpin buffer size config in mlx5 guide
Bing Zhao [Wed, 22 Apr 2020 03:11:20 +0000 (11:11 +0800)]
doc: add hairpin buffer size config in mlx5 guide

This patch updates the MLX5 PMD and release notes documentations.
Adding the guideline for hairpin data buffer size configuration.

Signed-off-by: Bing Zhao <bingz@mellanox.com>
Acked-by: Ori Kam <orika@mellanox.com>
4 years agonet/mlx5: optimize IPv4/IPv6 matching
Eli Britstein [Sun, 3 May 2020 10:47:55 +0000 (10:47 +0000)]
net/mlx5: optimize IPv4/IPv6 matching

The HW is optimized for IPv4/IPv6. For such cases avoid matching on
ethertype, and use ip_version field instead.

Signed-off-by: Eli Britstein <elibr@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
4 years agonet/mlx5: introduce helper to set IP version match
Eli Britstein [Sun, 3 May 2020 10:47:54 +0000 (10:47 +0000)]
net/mlx5: introduce helper to set IP version match

Introduce a helper function to set the ip_version match.

Signed-off-by: Eli Britstein <elibr@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
4 years agonet/mlx5: fix gcc 10 enum-conversion warning
Kevin Traynor [Fri, 20 Mar 2020 16:47:42 +0000 (16:47 +0000)]
net/mlx5: fix gcc 10 enum-conversion warning

gcc 10.0.1 reports warnings when using mlx5_rte_flow enums
with rte_flow type enums. For example:

../drivers/net/mlx5/mlx5_flow.c: In function ‘flow_hairpin_split’:
../drivers/net/mlx5/mlx5_flow.c:3406:19:
warning: implicit conversion from ‘enum mlx5_rtedflow_action_type’ to
         ‘enum rte_flow_action_type’ [-Wenum-conversion]
 3406 |  tag_action->type = MLX5_RTE_FLOW_ACTION_TYPE_TAG;
      |                   ^
../drivers/net/mlx5/mlx5_flow.c:3419:13:
warning: implicit conversion from ‘enum mlx5_rte_flow_item_type’
         to ‘enum rte_flow_item_type’ [-Wenum-conversion]
 3419 |  item->type = MLX5_RTE_FLOW_ITEM_TYPE_TAG;
      |             ^

Fix by casting to the correct enum.

Signed-off-by: Kevin Traynor <ktraynor@redhat.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agonet/mlx5: fix VLAN ID check
Wisam Jaddo [Thu, 30 Apr 2020 08:31:03 +0000 (08:31 +0000)]
net/mlx5: fix VLAN ID check

All comparison should be done in CPU endianness, otherwise
it will not give right results.

for example:
255 after converting into RTE_BE16 will be biger than 4096 after
converting into RTE_BE16.

Fixes: a5f2da0b816b ("net/mlx5: support modify VLAN ID on new VLAN header")
Cc: stable@dpdk.org
Signed-off-by: Wisam Jaddo <wisamm@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agonet/mlx5: fix assert in modify converting
Bing Zhao [Wed, 29 Apr 2020 13:06:14 +0000 (21:06 +0800)]
net/mlx5: fix assert in modify converting

The assertion was added incorrectly in converting the modify actions
into the format of low layer driver.
There is no mask specified in the rte_flow actions, and PMD driver
will give a mask of all 1s to the field to be modified. For each
field, the mask could not be zero. But for the whole header which
contains this field, the masks of other fields could be zero. The
assertion needs to be removed for debug mode.

Fixes: 72a944dba163 ("net/mlx5: fix header modify action validation")
Cc: stable@dpdk.org
Signed-off-by: Bing Zhao <bingz@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agonet/mlx5: support flow aging
Dong Zhou [Wed, 29 Apr 2020 02:25:09 +0000 (05:25 +0300)]
net/mlx5: support flow aging

Currently, there is no flow aging check and age-out event callback
mechanism for mlx5 driver, this patch implements it. It's included:
- Splitting the current counter container to aged or no-aged container
  since reducing memory consumption. Aged container will allocate extra
  memory to save the aging parameter from user configuration.
- Aging check and age-out event callback mechanism based on current
  counter. When a flow be checked aged-out, RTE_ETH_EVENT_FLOW_AGED
  event will be triggered to applications.
- Implement the new API: rte_flow_get_aged_flows, applications can use
  this API to get aged flows.

Signed-off-by: Dong Zhou <dongz@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
4 years agonet/mlx5: modify ext-counter memory allocation
Dong Zhou [Wed, 29 Apr 2020 02:25:08 +0000 (05:25 +0300)]
net/mlx5: modify ext-counter memory allocation

Currently, the counter pool needs 512 ext-counter memory for no batch
counters, it's allocated separately by once, behind the 512
basic-counter memory. This is not easy to get ext-counter pointer by
corresponding basic-counter pointer. This is also no easy for expanding
some other potential additional type of counter memory.

So, need allocate every one of ext-counter and basic-counter together,
as a single piece of memory. It's will be same for further additional
type of counter memory. In this case, one piece of memory contains all
type of memory for one counter, it's easy to get each type memory by
using offsetting.

Signed-off-by: Dong Zhou <dongz@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
4 years agonet/mlx5: fix RSS enablement
Xiaoyu Min [Wed, 29 Apr 2020 13:00:42 +0000 (16:00 +0300)]
net/mlx5: fix RSS enablement

PMD create some default control rules with RSS action
if it's not isolated mode.

However whether default control rules need to do RSS or not should be
controlled by device configuration, the mq_mode of rxmode configuration
in specific.

In another word, only when mq_mode is configured with ETH_MQ_RX_RSS_FLAG
set, then RSS is needed for default rules.

Fixes: c64ccc0eca2f ("mlx5: fix overwritten RSS configuration")
Cc: stable@dpdk.org
Signed-off-by: Xiaoyu Min <jackmin@mellanox.com>
Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
4 years agonet/bnxt: modify mark manager validity checks
Kishore Padmanabha [Mon, 4 May 2020 17:25:02 +0000 (13:25 -0400)]
net/bnxt: modify mark manager validity checks

The ULP mark manager originally assumed that zero was an invalid
mark and used it for invalidation and deletion.  The mark manager
now supports adding zero as a mark, flags for validity and type,
and adds explicit bounds checking instead of relying on mask.

Signed-off-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>
Reviewed-by: Mike Baucom <michael.baucom@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
4 years agonet/bnxt: fix mark handling
Mike Baucom [Thu, 30 Apr 2020 20:39:13 +0000 (02:09 +0530)]
net/bnxt: fix mark handling

The current mark handling uses the meta data field of the rxcmp as the
first level check for determining gfid vs lfid.  When the meta data is
zero due to only the lowest 16bits of the gfid being set, the cfa code
is incorrectly interpreted as being an lfid.  Changing code to look at
meta fmt instead of the meta data directly for the determination.

Fixes: b87abb2e55cb ("net/bnxt: support marking packet")

Signed-off-by: Mike Baucom <michael.baucom@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Lance Richardson <lance.richardson@broadcom.com>
4 years agonet/octeontx2: update red algo for shaper dynamic update
Nithin Dabilpuram [Fri, 1 May 2020 14:24:16 +0000 (19:54 +0530)]
net/octeontx2: update red algo for shaper dynamic update

Due to an errata red algo needs to be set to discard instead of stall
for 96XX C0 silicon for two rate shaping. This workaround is being
already handled for newly created hierarchy but not for dynamic
shaper update cases. This patch hence applies the workaround
even when for shaper dynamic update.

Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
4 years agonet/octeontx2: fix bad L4 checksum detection
Amit Gupta [Fri, 1 May 2020 09:53:28 +0000 (15:23 +0530)]
net/octeontx2: fix bad L4 checksum detection

On detecting outer L4 checksum as bad, both outer and
inner checksums are marked as bad. No need to explicitly
check inner L4 checksum in this case.

Outer L4 UDP checksum error => PKT_RX_OUTER_L4_CKSUM_BAD
and PKT_RX_L4_CKSUM_BAD

Inner L4 UDP checksum error => PKT_RX_L4_CKSUM_BAD

Fixes: 41fe7a3a11fd ("net/octeontx2: offload bad L2/L3/L4 UDP lengths detection")

Signed-off-by: Amit Gupta <agupta3@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
4 years agonet/octeontx: fix dangling pointer on init failure
Yunjian Wang [Tue, 7 Apr 2020 11:35:43 +0000 (19:35 +0800)]
net/octeontx: fix dangling pointer on init failure

When octeontx_create() is cleaning up, it does not correctly set
the mac_addrs variable to NULL, which will lead to a double free.

Fixes: 9e399b88ce2f ("net/octeontx: fix memory leak of MAC address table")
Cc: stable@dpdk.org
Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
Acked-by: Harman Kalra <hkalra@marvell.com>
4 years agonet/qede: support FW version query
Rasesh Mody [Sat, 25 Apr 2020 06:13:47 +0000 (23:13 -0700)]
net/qede: support FW version query

Add support for get firmware version operation.

Get and dump multi boot image (MBI) version as part of get
firmware version string along with Management firmware (MFW) version.
Use qede_fw_version_get() for PMD info logs.

Signed-off-by: Yash Sharma <ysharma@marvell.com>
Signed-off-by: Rasesh Mody <rmody@marvell.com>
Signed-off-by: Igor Russkikh <irusskikh@marvell.com>
4 years agonet/qede: support flow API flush
Rasesh Mody [Sat, 25 Apr 2020 06:13:46 +0000 (23:13 -0700)]
net/qede: support flow API flush

This patch adds support to flush the rte flows.

Signed-off-by: Rasesh Mody <rmody@marvell.com>
Signed-off-by: Igor Russkikh <irusskikh@marvell.com>
4 years agovdpa/mlx5: fix PCI address comparison
Matan Azrad [Mon, 4 May 2020 07:12:09 +0000 (07:12 +0000)]
vdpa/mlx5: fix PCI address comparison

A regular memcmp function was used to compare between two objects of
type `struct rte_pci_addr`.

Due to the alignment rules of compiler structure builders, some memory
is not initiated in the structure even though all the fields were
initiated.

Therefore, the comparison may fail even though the PCI addresses are
identical and to cause false failure in probe.

Use the dedicated API to compare 2 PCI addresses.

Fixes: 75dd0ae91765 ("vdpa/mlx5: disable RoCE")
Cc: stable@dpdk.org
Signed-off-by: Matan Azrad <matan@mellanox.com>
Tested-by: Noa Ezra <noae@mellanox.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
4 years agovirtio: use one way barrier for split vring avail index
Joyce Kong [Thu, 30 Apr 2020 09:14:37 +0000 (17:14 +0800)]
virtio: use one way barrier for split vring avail index

In case VIRTIO_F_ORDER_PLATFORM(36) is not negotiated, then the frontend
and backend are assumed to be implemented in software, that is they can
run on identical CPUs in an SMP configuration.
Thus a weak form of memory barriers like rte_smp_r/wmb, other than
rte_cio_r/wmb, is sufficient for this case(vq->hw->weak_barriers == 1)
and yields better performance.
For the above case, this patch helps yielding even better performance
by replacing the two-way barriers with C11 one-way barriers for avail
index in split ring.

Signed-off-by: Joyce Kong <joyce.kong@arm.com>
Reviewed-by: Gavin Hu <gavin.hu@arm.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
4 years agovirtio: use one way barrier for split vring used index
Joyce Kong [Thu, 30 Apr 2020 09:14:36 +0000 (17:14 +0800)]
virtio: use one way barrier for split vring used index

In case VIRTIO_F_ORDER_PLATFORM(36) is not negotiated, then the frontend
and backend are assumed to be implemented in software, that is they can
run on identical CPUs in an SMP configuration.
Thus a weak form of memory barriers like rte_smp_r/wmb, other than
rte_cio_r/wmb, is sufficient for this case(vq->hw->weak_barriers == 1)
and yields better performance.
For the above case, this patch helps yielding even better performance
by replacing the two-way barriers with C11 one-way barriers for used
index in split ring.

Signed-off-by: Joyce Kong <joyce.kong@arm.com>
Reviewed-by: Gavin Hu <gavin.hu@arm.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
4 years agonet/hns3: fix return value when clearing statistics
Wei Hu (Xavier) [Wed, 29 Apr 2020 11:13:28 +0000 (19:13 +0800)]
net/hns3: fix return value when clearing statistics

Since the return value of the '.stats_reset' and '.xstats_reset'
callback function is int, when failing to issue command to firmware to
execute clear statistics, the relevant callback function should return
non-zero value.

Fixes: 8839c5e202f3 ("net/hns3: support device stats")
Cc: stable@dpdk.org
Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
4 years agonet/hns3: fix MSI-X interrupt during initialization
Wei Hu (Xavier) [Wed, 29 Apr 2020 11:13:27 +0000 (19:13 +0800)]
net/hns3: fix MSI-X interrupt during initialization

Currently, based on hns3 VF device error may occur during initialization.

The root cause as below:
When the following formula is executed during initialization, the
private variable named hw->tqps_num has not been obtained from PF driver
through mailbox, further causes failure when mapping interrupt and
queues.
  hw->num_msi = (num_msi > hw->tqps_num + 1) ? hw->tqps_num + 1 : num_msi;
We need to use hw->tqp_num after it is correctly assigned.

On the other hand, because the private variable named hw->num_msi, which
represents the number of MSI-x interrupt of hns3 PF/VF device, is used in
the '.get_reg' ops implementation function to dump all interrupt related
registers, it should be obtained from firmware directly and we'd better
not modify it in the driver.

Fixes: ef2e785c36cf ("net/hns3: fix Tx interrupt when enabling Rx interrupt")
Fixes: 02a7b55657b2 ("net/hns3: support Rx interrupt")
Cc: stable@dpdk.org
Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
Signed-off-by: Hao Chen <chenhao164@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
4 years agonet/hns3: fix VLAN PVID when configuring device
Min Hu (Connor) [Wed, 29 Apr 2020 11:13:26 +0000 (19:13 +0800)]
net/hns3: fix VLAN PVID when configuring device

In current version, when upper level application calls the
rte_eth_dev_configure API function, if pvid config is not set of the
input parameter which struct type is rte_eth_conf, hns3 pmd driver also
sets the VLAN pvid related configuration to hardware, and this is not
reasonable. For example, As pvid is set to 100 by
rte_eth_dev_set_vlan_pvid, when pvid config is not set in rte_eth_conf,
rte_eth_dev_configure will tell driver to delete pvid 0, and that is
meaningless.

This patch fixes it to ensure that driver does not set VLAN pvid related
configuration to hardware when pvid config is not set in rte_eth_conf.

Fixes: 411d23b9eafb ("net/hns3: support VLAN")
Cc: stable@dpdk.org
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
Signed-off-by: Chengchang Tang <tangchengchang@huawei.com>
4 years agonet/hns3: get PCI revision ID
Wei Hu (Xavier) [Wed, 29 Apr 2020 11:13:25 +0000 (19:13 +0800)]
net/hns3: get PCI revision ID

The hns3 network engine is built-in multiple SoCs, such as kunpeng 920,
kunpeng 930, etc. The PCI revision id is 0x21 in kunpeng 920, and the PCI
revision id is 0x30 in kunpeng 930.

This patch gets PCI revision to identify different version of hardware
network engine.

Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
4 years agonet/hns3: add error code to some logs
Lijun Ou [Wed, 29 Apr 2020 11:13:24 +0000 (19:13 +0800)]
net/hns3: add error code to some logs

Here adds some prints for return value when the relative function fails
and enter the exception branch.

Signed-off-by: Lijun Ou <oulijun@huawei.com>
Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
4 years agonet/hns3: get Tx abnormal errors in xstats
Wei Hu (Xavier) [Wed, 29 Apr 2020 11:13:23 +0000 (19:13 +0800)]
net/hns3: get Tx abnormal errors in xstats

When upper level application calls the rte_eth_tx_burst API function to
send multiple packets at a time with burst mode based on hns3 network
engine, there are some abnormal conditions that cause the driver to fail
to operate the hardware to send packets correctly.

This patch adds some statistic counts for the abnormal errors of Tx data
path to the extend device statistics. The upper level application can
get them by calling the rte_eth_xstats_get API function.

Note: When using burst mode to call the rte_eth_tx_burst API function to
send multiple packets at a time. When the first abnormal error is
detected, add one to the relevant error statistics item, and then exit
the loop of sending multiple packets of the function. That is to say,
even if there are multiple packets in which abnormal errors may be
detected in the burst, the relevant error statistics in the driver will
only be increased by one.

The detail description of the Tx abnormal errors statistic items as
below:
 - TX_OVER_LENGTH_PKT_CNT Total number of greater than
   HNS3_MAX_FRAME_LEN the driver supported.

 - TX_EXCEED_LIMITED_BD_PKT_CNT
     Total number of exceeding the hardware limited bd which process a
     packet needed bd numbers.

 - TX_EXCEED_LIMITED_BD_PKT_REASSEMBLE_FAIL_CNT
     Total number of exceeding the hardware limited bd fail which
     process a packet needed bd numbers and reassemble fail.

 - TX_UNSUPPORTED_TUNNEL_PKT_CNT
     Total number of unsupported tunnel packet. The unsupported tunnel
     type: vxlan_gpe, gtp, ipip and MPLSINUDP, MPLSINUDP is a packet
     with MPLS-in-UDP RFC 7510 header.

 - TX_QUEUE_FULL_CNT
     Total count which the available bd numbers in current bd queue is
     less than the bd numbers with the pkt process needed.

 - TX_SHORT_PKT_PAD_FAIL_CNT
     Total count which the packet length is less than minimum packet
     size HNS3_MIN_PKT_SIZE and fail to be appended with 0.

Signed-off-by: Lijun Ou <oulijun@huawei.com>
Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Signed-off-by: Hao Chen <chenhao164@huawei.com>