Commit Graph

13648 Commits

Author SHA1 Message Date
Pablo de Lara
5fa2a3089b crypto/aesni_gcm: remove unneeded cast
qp->temp_digest is already an array of uint8_t,
so no need to cast to uint8_t*.

Fixes: baf1e63bfd ("crypto/aesni_gcm: do not append digest")
Cc: stable@dpdk.org

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Fiona Trahe <fiona.trahe@intel.com>
2018-05-22 16:36:11 +02:00
Pablo de Lara
279e0f57b5 crypto/aesni_mb: fix capabilities
Missing AES-CMAC supported parameters
in PMD capabilities.

Fixes: 6491dbbece ("crypto/aesni_mb: support AES CMAC")

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Marko Kovacevic <marko.kovacevic@intel.com>
2018-05-22 16:36:11 +02:00
Jerin Jacob
873dac8ec6 app/crypto-perf: fix parameters copy
Since arm64 was using plain memcpy for rte_memcpy, gcc 8.1, could
detect size was more than source address range. In this case, the
source was wrong.

test/test/test_cryptodev.c: In function 'test_multi_session_random_usage':
rte_memcpy_64.h:364:29: error: 'memcpy'
forming offset [113, 184] is out of the bounds [0, 112] of object
'testsuite_params' with type 'struct crypto_testsuite_params'
[-Werror=array-bounds]
 #define rte_memcpy(d, s, n) memcpy((d), (s), (n))
                             ^~~~~~~~~~~~~~~~~~~~~
test/test/test_cryptodev.c:6618:3: note:
in expansion of macro 'rte_memcpy'
   rte_memcpy(&ut_paramz[i].ut_params, &testsuite_params,
   ^~~~~~~~~~
test/test/test_cryptodev.c:140:39: note:
'testsuite_params' declared here
 static struct crypto_testsuite_params testsuite_params = { NULL };

Fixes: ffbe3be0d4 ("app/test: add libcrypto")
Cc: stable@dpdk.org

Suggested-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
2018-05-22 16:36:11 +02:00
Jerin Jacob
21f579fcef app/crypto-perf: use strcpy for allocated string
inlined from ‘cperf_test_vector_get_from_file’ at
app/test-crypto-perf/cperf_test_vector_parsing.c:578:11:
app/test-crypto-perf/cperf_test_vector_parsing.c:510:3: error:
‘strncpy’ output truncated before terminating nul copying as many bytes
from a string as its length [-Werror=stringop-truncation]
   strncpy(entry, line, strlen(line));
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
app/test-crypto-perf/cperf_test_vector_parsing.c:528:5: error:
‘strncat’ output truncated before terminating nul copying as many bytes
from a string as its length [-Werror=stringop-truncation]
     strncat(entry, line, strlen(line));
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Found this issue with meson build and gcc 8.1.

Fixes: f8be1786b1 ("app/crypto-perf: introduce performance test application")
Cc: stable@dpdk.org

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
2018-05-22 16:36:11 +02:00
Fan Zhang
91b9c522d6 crypto/scheduler: fix possible duplicated ring names
This patch fixes the possible duplicated ring names in multi-core
scheduler. Originally two or more multi-core schedulers may have
same worker ring names thus will cause initialization error.

Fixes: 4c07e0552f ("crypto/scheduler: add multicore scheduling mode")
Cc: stable@dpdk.org

Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
2018-05-22 16:36:11 +02:00
Kirill Rybalchenko
cc32201a8d crypto/scheduler: fix multicore rings re-use
When scheduler mode changed from multicore to roundrobin and
back to multicore, scheduler tries to create memory rings with
the same name and fails. The fix allows to lookup and re-use
previously allocated memory rings.

Fixes: 4c07e0552f ("crypto/scheduler: add multicore scheduling mode")
Cc: stable@dpdk.org

Signed-off-by: Kirill Rybalchenko <kirill.rybalchenko@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Fan Zhang <roy.fan.zhang@intel.com>
Tested-by: Reshma Pattan <reshma.pattan@intel.com>
2018-05-22 16:36:11 +02:00
Kamil Chalupnik
b1bc4217fd app/bbdev: fix unchecked return value
Fixing CHECKED_RETURN issue by checking values returned
by rte_bbdev_dec_op_alloc_bulk and rte_bbdev_enc_op_alloc_bulk
functions.

Coverity issue: 279447, 279456
Fixes: f714a18885 ("app/testbbdev: add test application for bbdev")
Cc: stable@dpdk.org

Signed-off-by: Kamil Chalupnik <kamilx.chalupnik@intel.com>
Acked-by: Amr Mokhtar <amr.mokhtar@intel.com>
2018-05-22 16:36:11 +02:00
Rosen Xu
bb5c82daa7 bus/ifpga: fix null pointer dereference in scan
Fix ifpga_scan_one() null pointer dereferences issue.

Coverity issue: 279454
Fixes: 05fa3d4a65 ("bus/ifpga: add Intel FPGA bus library")
Cc: stable@dpdk.org

Signed-off-by: Rosen Xu <rosen.xu@intel.com>
2018-05-22 19:16:26 +02:00
Rosen Xu
0898181974 bus/ifpga: fix memory leaks in scan
There are some resource leaks in ifpga_scan_one.
This patch fixes it.

Coverity issue: 279459
Fixes: 05fa3d4a65 ("bus/ifpga: add Intel FPGA bus library")
Cc: stable@dpdk.org

Signed-off-by: Rosen Xu <rosen.xu@intel.com>
2018-05-22 19:16:25 +02:00
Rosen Xu
07b4a8be61 bus/ifpga: fix error check in unplug
The control variable should be afu_dev not dev.

Coverity issue: 279455
Fixes: 05fa3d4a65 ("bus/ifpga: add Intel FPGA bus library")
Cc: stable@dpdk.org

Signed-off-by: Rosen Xu <rosen.xu@intel.com>
2018-05-22 19:15:58 +02:00
Thomas Monjalon
f14b264f65 bus/vdev: replace device list lock by a recursive one
A device like failsafe can manage sub-devices.
When removing such device, it removes its sub-devices
and try to take the same vdev_device_list_lock.
It was causing a deadlock because the lock was not recursive.

Fixes: 35f462839b ("bus/vdev: add lock on device list")

Suggested-by: Anatoly Burakov <anatoly.burakov@intel.com>
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Tested-by: Matan Azrad <matan@mellanox.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
2018-05-22 16:33:48 +02:00
Andy Green
3291abb5a2 ethdev: fix type and scope of variables in Rx burst
GCC 8.1 warned:

In function 'rte_eth_rx_burst':
rte_ethdev.h:3836:18: warning: conversion to 'int16_t'
{aka 'short int'} from 'uint16_t' {aka 'short unsigned int'}
may change the sign of the result [-Wsign-conversion]
  int16_t nb_rx = (*dev->rx_pkt_burst)(dev->data->rx_queues[queue_id],
                  ^
rte_ethdev.h:3844:50: warning: conversion to 'uint16_t'
{aka 'short unsigned int'} from 'int16_t' {aka 'short int'}
may change the sign of the result [-Wsign-conversion]
    nb_rx = cb->fn.rx(port_id, queue_id, rx_pkts, nb_rx,
                                                  ^~~~~
rte_ethdev.h:3844:12: warning: conversion to 'int16_t'
{aka 'short int'} from 'uint16_t' {aka 'short unsigned int'}
may change the sign of the result [-Wsign-conversion]
    nb_rx = cb->fn.rx(port_id, queue_id, rx_pkts, nb_rx,
            ^~
rte_ethdev.h:3851:9: warning: conversion to 'uint16_t'
{aka 'short unsigned int'} from 'int16_t' {aka 'short int'}
may change the sign of the result [-Wsign-conversion]
  return nb_rx;
         ^~~~~

The second part of the patch is solved by its own basic
block because it is inside a preprocessor conditional.

Bringing the declaration of the var to the top of the
function would require that also being given its own
preprocessor conditional, or a (void)var to avoid an
unused var warning.  The basic block is no worse than
those imho.

Fixes: 467465d86d ("ethdev: add packet count parameter to Rx callback")
Fixes: 4dc294158c ("ethdev: support optional Rx and Tx callbacks")
Cc: stable@dpdk.org

Signed-off-by: Andy Green <andy@warmcat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2018-05-22 16:32:36 +02:00
Andy Green
9d0b59f84e mbuf: avoid integer promotion in prepend/adj/chain
GCC 8.1 warned:

In function 'rte_pktmbuf_prepend':
rte_mbuf.h:1908:17: warning: conversion from 'int' to 'uint16_t'
{aka 'short unsigned int'} may change value [-Wconversion]
  m->data_off -= len;
                 ^~~
m->data_off is a uint16_t

        uint16_t data_off;

len (a uint16_t) is promoted to an int using -=.  Do the
subtraction explicitly and cast the result to uint16_t.

The below += or -= changes are solving the same thing.

In function 'rte_pktmbuf_adj':
rte_mbuf.h:1969:17: warning: conversion from 'int' to 'uint16_t'
{aka 'short unsigned int'} may change value [-Wconversion]
  m->data_off += len;
                 ^~~

In function 'rte_pktmbuf_chain':
rte_mbuf.h:2082:19: warning: conversion from 'int' to 'uint16_t'
{aka 'short unsigned int'} may change value [-Wconversion]
  head->nb_segs += tail->nb_segs;
                   ^~~~
Also uint16_t

        uint16_t nb_segs;         /**< Number of segments. */

Fixes: 08b563ffb1 ("mbuf: replace data pointer by an offset")
Fixes: 1a60a0daa6 ("mbuf: fix segments number type increase")
Cc: stable@dpdk.org

Signed-off-by: Andy Green <andy@warmcat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2018-05-22 16:32:36 +02:00
Andy Green
ef5092e16b mbuf: avoid implicit demotion in 64-bit arithmetic
GCC 8.1 warned:

In function 'rte_validate_tx_offload':
rte_mbuf.h:2112:19: warning: conversion to 'uint64_t'
{aka 'long unsigned int'} from 'int' may change the
sign of the result [-Wsign-conversion]
  inner_l3_offset += m->outer_l2_len + m->outer_l3_len;
                   ^~

  uint64_t inner_l3_offset...

  /* fields for TX offloading of tunnels */
  uint64_t outer_l3_len:9; /**< Outer L3 (IP) Hdr Length. */
  uint64_t outer_l2_len:7; /**< Outer L2 (MAC) Hdr Length. */

We want to do the arithmetic entirely in uint64_t
space, but with the +=, the rhs type becomes int since the
bitfields will fit in int.

Elaborate the artithmetic to be u64 = u64 + int + int, so
the type of the result is correct to be stored in the u64.

Fixes: 4fb7e803eb ("ethdev: add Tx preparation")
Cc: stable@dpdk.org

Signed-off-by: Andy Green <andy@warmcat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2018-05-22 16:32:36 +02:00
Andy Green
50f239c908 mbuf: fix type of variables in linearize function
GCC 8.1 warned:

In function 'rte_pktmbuf_linearize':
rte_mbuf.h:1873:32: warning: conversion to 'int' from 'uint32_t'
{aka 'unsigned int'} may change the sign of the result [-Wsign-conversion]
rte_mbuf.h:2166:13: note: in expansion of macro 'rte_pktmbuf_pkt_len'
   copy_len = rte_pktmbuf_pkt_len(mbuf) - rte_pktmbuf_data_len(mbuf);
rte_mbuf.h:2180:51: warning: conversion to 'size_t'
{aka 'long unsigned int'} from 'int' may change the
sign of the result [-Wsign-conversion]
rte_memcpy(buffer, rte_pktmbuf_mtod(m, char *), seg_len);
                                                ^~~~~~~

The temp is consumed as a size_t.  So let's make it
a size_t in the first place.

Fixes: 1feda4d8fc ("mbuf: add a function to linearize a packet")
Cc: stable@dpdk.org

Signed-off-by: Andy Green <andy@warmcat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2018-05-22 16:32:36 +02:00
Andy Green
ad37810662 mbuf: fix type of private size in detach
GCC 8.1 warned:

In function 'rte_pktmbuf_detach':
rte_mbuf.h:1583:17: warning: conversion from 'uint32_t'
{aka 'unsigned int'} to 'uint16_t' {aka 'short unsigned int'}
may change value [-Wconversion]
  m->priv_size = priv_size;
                 ^~~~~~~~~

The temp priv_size is declared as a uint32_t.  But it
only deals in uint16_t.  m->priv_size is a uint16_t.
Change it to a uint16_t.

Fixes: 355e6735b3 ("mbuf: fix cloning with private mbuf data")
Cc: stable@dpdk.org

Signed-off-by: Andy Green <andy@warmcat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2018-05-22 16:27:15 +02:00
Andy Green
f37a2e7c74 net: explicit cast in L4 checksum
GCC 8.1 warned:

In function 'rte_ipv4_udptcp_cksum':
rte_byteorder.h:51:24: warning: conversion from 'long unsigned int' to
'uint32_t' {aka 'unsigned int'} may change value [-Wconversion]
 #define rte_bswap16(x) ((uint16_t) (__builtin_constant_p(x) ?  \
                        ^
rte_byteorder.h:85:29: note: in expansion of macro 'rte_bswap16'
 #define rte_be_to_cpu_16(x) rte_bswap16(x)
                             ^~~~~~~~~~~
rte_ip.h:321:11: note: in expansion of macro 'rte_be_to_cpu_16'
  l4_len = rte_be_to_cpu_16(ipv4_hdr->total_length) -
           ^~~~~~~~~~~~~~~~

Also with this one, it is a cast that always occurred
and is just being done explicitly, with no changes to
the generated code.

The warning stack is misleading, it points to the last
element in the macro that produced the lhs of the subtraction
above.  But the only "unsigned long int" in the expression is
the result of the sizeof() on the rhs, it promotes the
subtraction result to unsigned long.  So the error actually
relates to the result of the outer subtraction.

The actual error is "you are trying to put an unsigned long
into a uint32_t".  We always did so, the fix is just to inform
the compiler it is intentional with an explicit cast.

Fixes: 6006818cfb ("net: new checksum functions")
Cc: stable@dpdk.org

Signed-off-by: Andy Green <andy@warmcat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2018-05-22 16:27:09 +02:00
Andy Green
1587d36e22 eal: explicit cast in rwlock functions
GCC 8.1 warned:

In function 'rte_rwlock_read_lock':
rte_rwlock.h:74:12: warning: conversion to 'uint32_t'
{aka 'unsigned int'} from 'int32_t' {aka 'int'} may
change the sign of the result [-Wsign-conversion]
            x, x + 1);
            ^
rte_rwlock.h:74:17: warning: conversion to 'uint32_t'
{aka 'unsigned int'} from 'int' may change the sign
of the result [-Wsign-conversion]
            x, x + 1);
               ~~^~~

In function 'rte_rwlock_write_lock':
rte_rwlock.h:110:15: warning: unsigned conversion
from 'int' to 'uint32_t' {aka 'unsigned int'}
changes value from '-1' to '4294967295' [-Wsign-conversion]
            0, -1);
               ^~

Again in this case we are making explicit the exact cast
that was always happening implicitly.  The patch does not
change the generated code.

The int32_t temp "x" is required to be signed to detect
a < 0 error condition from the lock status.  Afterwards,
it has always been implicitly cast to uint32_t when it
is used in the arguments to rte_atomic32_cmpset()...
gcc8.1 objects to the implicit cast now and requires us
to cast it explicitly.

Fixes: af75078fec ("first public release")
Cc: stable@dpdk.org

Signed-off-by: Andy Green <andy@warmcat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2018-05-22 16:27:01 +02:00
Andy Green
14035e5fad eal/x86: fix type of variable in memcpy function
GCC 8.1 warned:

rte_memcpy.h:793:2: note: in expansion of macro 'MOVEUNALIGNED_LEFT47'
  MOVEUNALIGNED_LEFT47(dst, src, n, srcofs);
  ^~~~~~~~~~~~~~~~~~~~
rte_memcpy.h:649:51: warning: conversion from 'size_t'
{aka 'long unsigned int'} to 'int' may change value [-Wconversion]
     case 0x0B: MOVEUNALIGNED_LEFT47_IMM(dst, src, n, 0x0B); break;
                                                   ^

rte_memcpy.h:616:15: note: in definition of macro 'MOVEUNALIGNED_LEFT47_IMM'
         tmp = len;
               ^~~
rte_memcpy.h:793:2: note: in expansion of macro 'MOVEUNALIGNED_LEFT47'
  MOVEUNALIGNED_LEFT47(dst, src, n, srcofs);
  ^~~~~~~~~~~~~~~~~~~~
rte_memcpy.h:618:13: warning: conversion to 'size_t'
{aka 'long unsigned int'} from 'int'
may change the sign of the result [-Wsign-conversion]
         tmp -= len;
             ^~

rte_memcpy.h:649:16: note: in expansion of macro 'MOVEUNALIGNED_LEFT47_IMM'
     case 0x0B: MOVEUNALIGNED_LEFT47_IMM(dst, src, n, 0x0B); break;
                ^~~~~~~~~~~~~~~~~~~~~~~~
rte_memcpy.h:793:2: note: in expansion of macro 'MOVEUNALIGNED_LEFT47'
  MOVEUNALIGNED_LEFT47(dst, src, n, srcofs);
  ^~~~~~~~~~~~~~~~~~~~
rte_memcpy.h:618:13: warning: conversion to 'size_t'
{aka 'long unsigned int'} from 'int'
may change the sign of the result [-Wsign-conversion]
             tmp -= len;
                 ^~

We can eliminate the problems by setting the type of tmp to
size_t in the first place.

Fixes: d35cc1fe6a ("eal/x86: revert select optimized memcpy at run-time")
Cc: stable@dpdk.org

Suggested-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: Andy Green <andy@warmcat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2018-05-22 16:26:03 +02:00
Daniel Shelepov
fe613657ce app/testpmd: fix burst stats reporting
When RTE_TEST_PMD_RECORD_BURST_STATS is enabled, testpmd collects
burst statistics and includes them in the port stats report.  The
summary should include top 2 most frequent burst sizes, but there is a
bug in finding the top-2.  During the scan of burst size counts, the
top-2 can change only if top-1 also changes.

Added logic to update the top-2 if current burst size is larger than
existing top-2, but smaller than existing top-1.

Fixes: af75078fec ("first public release")
Cc: stable@dpdk.org

Signed-off-by: Daniel Shelepov <dashel@microsoft.com>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
2018-05-21 17:12:49 +02:00
Tianfei Zhang
4022248efe raw/ifpga/base: fix an error return
fix a return error value by DPDK Coverity static code analysis

Coverity issue: 279448
Fixes: 56bb54ea1b ("raw/ifpga/base: add Intel FPGA OPAE share code")

Signed-off-by: Tianfei Zhang <tianfei.zhang@intel.com>
2018-05-21 16:13:06 +02:00
Ferruh Yigit
6ff0f81d0e log: fix pattern matching
loglevel set wrong when ":" is used as separator, like
--log-type="user:debug"

This is because fnmatch returns zero on success. Fixed fnmatch return
value check.

Fixes: 7f0bb634a1 ("log: add ability to match log type with globbing")

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
2018-05-21 15:49:27 +02:00
Andrew Rybchenko
bfa49c8f12 mempool/bucket: add to meson build
Fixes: 4ed00862c8 ("mempool/bucket: implement bucket mempool manager")

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
2018-05-21 12:00:09 +02:00
Stephen Hemminger
999951c86b bus/vdev: fix double space in logs
The VDEV_LOG() macro already adds a newline, don't duplicate.

Fixes: d22fcb225c ("bus/vdev: change log type")
Cc: stable@dpdk.org

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
2018-05-21 01:23:21 +02:00
Vipin Varghese
84e22d6177 test/eventdev: fix ethdev port id to 16-bit
port id in test case is update to unsigned int 16 bit, to
prevent compilation failure when RTE_MAX_ETHPORTS port is
set more than 255.

Fixes: fc8030eb8f ("test/eventdev: add tests for eth Rx adapter APIs")
Cc: stable@dpdk.org

Signed-off-by: Vipin Varghese <vipin.varghese@intel.com>
Acked-by: Nikhil Rao <nikhil.rao@intel.com>
2018-05-21 01:16:41 +02:00
Adrien Mazarguil
97c228a0aa eal: fix runtime directory permissions
Executable bit must be set on directories for normal users to enter them.

This patch addresses the inability to start DPDK applications as non-root
due to errors such as:

 EAL: failed to bind /tmp/dpdk/rte/mp_socket: Permission denied

Fixes: 56236363b4 ("eal: add directory for runtime data")

Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2018-05-21 01:08:26 +02:00
Gavin Hu
e8995ed72c raw/ifpga: fix ARM build with clang
The patch fixes the compile issue with clang on ARM64, as well as
clang + X86 builing hosts.

Newly introduced #pragma pack(1) in the header file caused compiling
issues for the files who included it.

In file included from drivers/raw/ifpga_rawdev/base/ifpga_fme_dperf.c:5:
In file included from drivers/raw/ifpga_rawdev/base/ifpga_feature_dev.h:8:
drivers/raw/ifpga_rawdev/base/ifpga_hw.h:8:10: error:
the current #pragma pack alignment value is modified in the included file

The fix is to change the #pragma pack alignment locally and not have
effect on other files who included this header file.

Fixes: 56bb54ea1b ("raw/ifpga/base: add Intel FPGA OPAE share code")

Signed-off-by: Gavin Hu <gavin.hu@arm.com>
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
Reviewed-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
2018-05-21 00:58:43 +02:00
Gavin Hu
454878ff83 eventdev: fix build with clang on ARM
This patch fix the clang compiling issue reported on the ARM64
builing hosts. ev is a pointer in size of 64bit, but herein
it should be the size of its content.

lib/librte_eventdev/rte_event_crypto_adapter.c:530:49: error:
'rte_memcpy' call operates on objects of type 'struct rte_event'
while the size is based on a different type
      'struct rte_event *' [-Werror,-Wsizeof-pointer-memaccess]
                rte_memcpy(ev, &m_data->response_info, sizeof(ev));
lib/librte_eventdev/rte_event_crypto_adapter.c:530:49:
note: did you mean to dereference the argument to 'sizeof' (and multiply
it by the number of elements)?
      rte_memcpy(ev, &m_data->response_info, sizeof(ev));

Fixes: 7901eac340 ("eventdev: add crypto adapter implementation")

Signed-off-by: Gavin Hu <gavin.hu@arm.com>
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
Reviewed-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
2018-05-21 00:55:50 +02:00
Gavin Hu
74572f23cd net/mlx5: fix build with clang on ARM
This patch adds a pair of "()" to embrace the argument
input to the function-like macro invocation.

drivers/net/mlx5/mlx5_rxtx_vec.c:37:
drivers/net/mlx5/mlx5_rxtx_vec_neon.h:170:24: error: too many arguments
provided to function-like macro invocation
	(uint16x8_t) { 0, 0, cs_flags, rte_cpu_to_be_16(len),

Fixes: 570acdb1da ("net/mlx5: add vectorized Rx/Tx burst for ARM")
Cc: stable@dpdk.org

Signed-off-by: Gavin Hu <gavin.hu@arm.com>
Signed-off-by: Sirshak Das <sirshak.das@arm.com>
Reviewed-by: Phil Yang <phil.yang@arm.com>
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
Reviewed-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Acked-by: Yongseok Koh <yskoh@mellanox.com>
2018-05-21 00:55:39 +02:00
Andy Green
45d1be93b9 ethdev: explicit cast of queue count return
GCC 8.1 produces a warning:
rte_ethdev.h: In function 'rte_eth_rx_queue_count':
rte_ethdev.h:3882:10: warning: conversion to 'int' from 'uint32_t'
{aka 'unsigned int'} may change the sign of the result [-Wsign-conversion]
  return (*dev->dev_ops->rx_queue_count)(dev, queue_id);
         ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Fixes: 33cf6be04d ("ethdev: add sanity checks to functions")
Cc: stable@dpdk.org

Signed-off-by: Andy Green <andy@warmcat.com>
2018-05-21 00:21:38 +02:00
Andy Green
8bf255bb38 net: explicit cast of protocol in IPv6 checksum
GCC 8.1 warned:

In function 'rte_ipv6_phdr_cksum':
rte_ip.h:378:18: warning: conversion to 'uint32_t' {aka 'unsigned int'}
from 'int' may change the sign of the result [-Wsign-conversion]
  psd_hdr.proto = (ipv6_hdr->proto << 24);

Fixes: 6006818cfb ("net: new checksum functions")
Cc: stable@dpdk.org

Signed-off-by: Andy Green <andy@warmcat.com>
2018-05-21 00:21:34 +02:00
Andy Green
466de6d5d8 net: explicit cast of IP checksum to 16-bit
GCC 8.1 warned:

In function 'rte_raw_cksum_mbuf':
rte_ip.h:225:22: warning: conversion from 'uint32_t'
{aka 'unsigned int'} to 'uint16_t' {aka 'short unsigned int'}
may change value [-Wconversion]
    tmp = rte_bswap16(tmp);
                      ^~~

In function 'rte_ipv4_cksum':
rte_ip.h:256:35: warning: conversion from 'int' to 'uint16_t'
{aka 'short unsigned int'} may change value [-Wconversion]
  return (cksum == 0xffff) ? cksum : ~cksum;
         ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~

rte_ip.h:332:9: warning: conversion from 'uint32_t'
{aka 'unsigned int'} to 'uint16_t' {aka 'short unsigned int'}
may change value [-Wconversion]
  return cksum;
         ^~~~~

In function 'rte_ipv6_udptcp_cksum':
rte_ip.h:421:9: warning: conversion from 'uint32_t' {aka 'unsigned int'}
to 'uint16_t' {aka 'short unsigned int'} may change value [-Wconversion]
  return cksum;
         ^~~~~

Fixes: 6006818cfb ("net: new checksum functions")
Fixes: 4199fdea60 ("mbuf: generic support for TCP segmentation offload")
Cc: stable@dpdk.org

Signed-off-by: Andy Green <andy@warmcat.com>
2018-05-21 00:21:30 +02:00
Andy Green
beb4076567 net: explicit cast of multicast bit clearing
GCC 8.1 warned:

rte_ether.h:213:13:
warning: conversion from 'int' to 'uint8_t'
{aka 'unsigned char'} may change value [-Wconversion]
  addr[0] &= ~ETHER_GROUP_ADDR;

Fixes: 7ef0072910 ("ethdev: random MAC address")
Cc: stable@dpdk.org

Signed-off-by: Andy Green <andy@warmcat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2018-05-21 00:21:24 +02:00
Andy Green
c779ebdca0 mbuf: explicit cast of size on detach
GCC 8.1 warned:

In function 'rte_pktmbuf_detach':
rte_mbuf.h:1580:14: warning: conversion from 'long unsigned int'
to 'uint32_t' {aka 'unsigned int'} may change value [-Wconversion]
  mbuf_size = sizeof(struct rte_mbuf) + priv_size;
              ^~~~~~

Fixes: 355e6735b3 ("mbuf: fix cloning with private mbuf data")
Cc: stable@dpdk.org

Signed-off-by: Andy Green <andy@warmcat.com>
2018-05-21 00:21:19 +02:00
Andy Green
0298bfb263 mbuf: explicit cast of external buffer length
GCC 8.1 warned:

rte_common.h:141:34:
warning: conversion from 'long unsigned int' to 'uint16_t'
{aka 'short unsigned int'} may change value [-Wconversion]
 #define RTE_PTR_DIFF(ptr1, ptr2) ((uintptr_t)(ptr1) - (uintptr_t)(ptr2))
                                  ^
rte_mbuf.h:1360:13:
note: in expansion of macro 'RTE_PTR_DIFF'
  *buf_len = RTE_PTR_DIFF(shinfo, buf_addr);

Fixes: a53aa2b9f3 ("mbuf: support attaching external buffer")

Signed-off-by: Andy Green <andy@warmcat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2018-05-21 00:21:12 +02:00
Andy Green
553ff494cb mbuf: explicit cast of headroom on reset
GCC 8.1 warned:

rte_common.h:384:2:
warning: conversion from 'int' to 'uint16_t'
{aka 'short unsigned int'} may change value [-Wconversion]
  __extension__ ({ \
  ^~~~~~~~~~~~~
rte_mbuf.h:1204:16:
note: in expansion of macro 'RTE_MIN'
  m->data_off = RTE_MIN(RTE_PKTMBUF_HEADROOM, (uint16_t)m->buf_len);

RTE_PKTMBUF_HEADROOM is typ 128, so it doesn't make trouble.

Fixes: 08b563ffb1 ("mbuf: replace data pointer by an offset")
Cc: stable@dpdk.org

Signed-off-by: Andy Green <andy@warmcat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2018-05-21 00:21:05 +02:00
Andy Green
f6ffdf1c2c mbuf: explicit casts of reference counter
differences to the atomic16 are signed, but the
atomic16 itself is unsigned.  It needs to be
made explicit with casts.

Fixes: af75078fec ("first public release")
Fixes: a53aa2b9f3 ("mbuf: support attaching external buffer")
Cc: stable@dpdk.org

Signed-off-by: Andy Green <andy@warmcat.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
2018-05-21 00:20:48 +02:00
Andy Green
ee07d519ce mbuf: fix reference counter integer promotion
GCC 8.1 warned:

"1 + value", where value is an uint16_t causes promotion
to a signed int.  The compiler complained that we are
shoving an int into a uint16_t return type with different
size and sign.

Bumping and returning value directly instead removes the
promotion and the problem.

Fixes: f20b50b946 ("mbuf: optimize refcnt update")
Fixes: a53aa2b9f3 ("mbuf: support attaching external buffer")
Cc: stable@dpdk.org

Signed-off-by: Andy Green <andy@warmcat.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
2018-05-21 00:20:28 +02:00
Andy Green
e8ed5056c8 ring: remove signed type flip-flopping
GCC 8.1 warns:

rte_ring.h:350:46:
warning: conversion to 'uint32_t' {aka 'unsigned int'}
from 'int' may change the sign of the result
[-Wsign-conversion]
  update_tail(&r->prod, prod_head, prod_next, is_sp, 1);

The visible apis take unsigned int, then call a private
api taking an int, which finally calls an api taking an
unsigned int.

Convert the private api to take unsigned int removing
5 x warning similar to that shown above.

Fixes: 0dfc98c507 ("ring: separate out head index manipulation")
Cc: stable@dpdk.org

Signed-off-by: Andy Green <andy@warmcat.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
2018-05-21 00:20:16 +02:00
Andy Green
712a3db0b5 ring: remove useless variables
There were warnings with GCC 8.1:

In function '__rte_ring_move_prod_head':
rte_ring_generic.h:76:3:
warning: ISO C90 forbids mixed declarations and code
[-Wdeclaration-after-statement]
   const uint32_t cons_tail = r->cons.tail;
   ^~~~~

In function '__rte_ring_move_cons_head':
rte_ring_generic.h:147:3:
warning: ISO C90 forbids mixed declarations and code
[-Wdeclaration-after-statement]
   const uint32_t prod_tail = r->prod.tail;

Fixes: 0dfc98c507 ("ring: separate out head index manipulation")
Cc: stable@dpdk.org

Signed-off-by: Andy Green <andy@warmcat.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
2018-05-21 00:20:12 +02:00
Andy Green
c7bf809382 eal: explicit cast in constant byte swap
GCC 8.1 warns:

rte_byteorder.h: In function 'rte_constant_bswap16':
rte_byteorder.h:54:45: warning: conversion from
'int' to 'uint16_t' {aka 'short unsigned int'}
may change value [-Wconversion]
  ((((uint16_t)(v) & UINT16_C(0x00ff)) << 8) | \
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
   (((uint16_t)(v) & UINT16_C(0xff00)) >> 8))
   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
rte_byteorder.h:126:9: note: in expansion of macro
'RTE_STATIC_BSWAP16'
  return RTE_STATIC_BSWAP16(x);
         ^~~~~~~~~~~~~~~~~~

The other two sizes are going to be afflicted the
same, so get the same fix.

Fixes: b75667ef9f ("eal: add static endianness conversion macros")
Cc: stable@dpdk.org

Signed-off-by: Andy Green <andy@warmcat.com>
2018-05-21 00:20:05 +02:00
Andy Green
d3db77d7d8 eal: fix casts in random functions
GCC 8.1 warns:

In function 'rte_srand':
rte_random.h:34:10:
warning: conversion to 'long int' from 'long unsigned int'
may change the sign of the result [-Wsign-conversion]
  srand48((long unsigned int)seedval);

rte_random.h:51:8:
warning: conversion to 'uint64_t' {aka 'long unsigned int'}
from 'long int' may change the sign of the result
[-Wsign-conversion]
  val = lrand48();
        ^~~~~~~

rte_random.h:53:6:
warning: conversion to 'long unsigned int' from 'long int'
may change the sign of the result [-Wsign-conversion]
  val += lrand48();

Fixes: af75078fec ("first public release")
Cc: stable@dpdk.org

Signed-off-by: Andy Green <andy@warmcat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2018-05-21 00:19:30 +02:00
Andy Green
622a7305d1 eal: explicit cast of strlcpy return
GCC 8.1 warns:
rte_string_fns.h: In function 'rte_strlcpy':
rte_string_fns.h:58:9:
warning: conversion to 'size_t' {aka 'long unsigned int'} from
'int' may change the sign of the result [-Wsign-conversion]
  return snprintf(dst, size, "%s", src);
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Fixes: 5364de644a ("eal: support strlcpy function")

Signed-off-by: Andy Green <andy@warmcat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2018-05-21 00:19:08 +02:00
David Marchand
a2ff2827dc mbuf: fix C++ build on void pointer cast
Including rte_mbuf.h in C++ triggers the following warning as C++ does not
allow implicit casting of a void *.

In file included from test.cpp:1:0:
rte_mbuf.h: In function ‘rte_mbuf_ext_shared_info*
rte_pktmbuf_ext_shinfo_init_helper(void*, uint16_t*,
rte_mbuf_extbuf_free_callback_t, void*)’:
rte_mbuf.h:1349:9: error: invalid conversion
from ‘void*’ to ‘rte_mbuf_ext_shared_info*’ [-fpermissive]
  shinfo = RTE_PTR_ALIGN_FLOOR(RTE_PTR_SUB(buf_end,
         ^

Fixes: a53aa2b9f3 ("mbuf: support attaching external buffer")

Signed-off-by: David Marchand <david.marchand@6wind.com>
2018-05-18 13:20:49 +02:00
Roman Zhukov
1613848c2c net/sfc: fix errno if flow API RSS action parse fails
The value of rte_errno must be positive in case of an error.

Fixes: d77d07391d ("net/sfc: support flow API RSS action")
Cc: stable@dpdk.org

Signed-off-by: Roman Zhukov <roman.zhukov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
2018-05-17 19:44:23 +02:00
Ophir Munk
2f5045c51c net/tap: support RSS hash update
Add RSS hash update callback to eth_dev_ops.

Signed-off-by: Ophir Munk <ophirmu@mellanox.com>
Acked-by: Keith Wiles <keith.wiles@intel.com>
2018-05-17 19:07:08 +02:00
Qi Zhang
115ae7689f doc: add runtime queue setup in release notes
Add updates for runtime queue setup.

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
2018-05-17 19:06:29 +02:00
Adrien Mazarguil
911bbb0f7c net/mlx4: fix shifts of signed values in Tx
This patch addresses the following issues reported by cppcheck:

 [drivers/net/mlx4/mlx4_rxtx.c:266]: (error) Shifting signed 32-bit value
     by 31 bits is undefined behaviour
 [drivers/net/mlx4/mlx4_rxtx.c:624]: (error) Shifting signed 32-bit value
     by 31 bits is undefined behaviour
 [drivers/net/mlx4/mlx4_txq.c:89]: (error) Shifting signed 32-bit value by
     31 bits is undefined behaviour
 [drivers/net/mlx4/mlx4_txq.c:91]: (error) Shifting signed 32-bit value by
     31 bits is undefined behaviour

Fixes: 78e81a9844 ("net/mlx4: merge Tx queue rings management")
Cc: stable@dpdk.org

Reported-by: Ferruh Yigit <ferruh.yigit@intel.com>
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
2018-05-17 19:06:29 +02:00
Shahaf Shuler
607fc8e4a9 net/mlx5: fix default RSS level
Using inner RSS by default for GRE leads to memory corruption as the
extra flow items added for the inner RSS are not counted in the flow
attributes buffer size.

Fixing by enforcing the default RSS level to be outer. This much
simplify the flow engine and more robust.
Future optimization for out of the box RSS can be done on subsequent
commits.

Fixes: d4a405186b ("net/mlx5: support tunnel RSS level")

Signed-off-by: Shahaf Shuler <shahafs@mellanox.com>
Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
2018-05-17 19:06:29 +02:00
Xiaoyun Li
f59917c840 net/avf: fix traffic blocked on reset
When resetting ports, traffic will be blocked. There is a mistake when
getting hw info at avf_dev_stop. This causes the device stop without
stopping queues. This patch fixes this issue.

Fixes: 69dd4c3d08 ("net/avf: enable queue and device")
Cc: stable@dpdk.org

Signed-off-by: Xiaoyun Li <xiaoyun.li@intel.com>
Acked-by: Helin Zhang <helin.zhang@intel.com>
2018-05-17 19:06:29 +02:00