dpdk.git
6 years agonet: explicit cast of IP checksum to 16-bit
Andy Green [Thu, 17 May 2018 13:49:57 +0000 (21:49 +0800)]
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: 6006818cfb26 ("net: new checksum functions")
Fixes: 4199fdea60c3 ("mbuf: generic support for TCP segmentation offload")
Cc: stable@dpdk.org
Signed-off-by: Andy Green <andy@warmcat.com>
6 years agonet: explicit cast of multicast bit clearing
Andy Green [Thu, 17 May 2018 13:49:47 +0000 (21:49 +0800)]
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: 7ef007291004 ("ethdev: random MAC address")
Cc: stable@dpdk.org
Signed-off-by: Andy Green <andy@warmcat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
6 years agombuf: explicit cast of size on detach
Andy Green [Thu, 17 May 2018 13:50:22 +0000 (21:50 +0800)]
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: 355e6735b335 ("mbuf: fix cloning with private mbuf data")
Cc: stable@dpdk.org
Signed-off-by: Andy Green <andy@warmcat.com>
6 years agombuf: explicit cast of external buffer length
Andy Green [Thu, 17 May 2018 13:49:42 +0000 (21:49 +0800)]
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: a53aa2b9f3be ("mbuf: support attaching external buffer")

Signed-off-by: Andy Green <andy@warmcat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
6 years agombuf: explicit cast of headroom on reset
Andy Green [Thu, 17 May 2018 13:49:37 +0000 (21:49 +0800)]
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: 08b563ffb19d ("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>
6 years agombuf: explicit casts of reference counter
Andy Green [Thu, 17 May 2018 13:49:32 +0000 (21:49 +0800)]
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: af75078fece3 ("first public release")
Fixes: a53aa2b9f3be ("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>
6 years agombuf: fix reference counter integer promotion
Andy Green [Thu, 17 May 2018 13:49:27 +0000 (21:49 +0800)]
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: f20b50b946da ("mbuf: optimize refcnt update")
Fixes: a53aa2b9f3be ("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>
6 years agoring: remove signed type flip-flopping
Andy Green [Thu, 17 May 2018 13:49:22 +0000 (21:49 +0800)]
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: 0dfc98c507b1 ("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>
6 years agoring: remove useless variables
Andy Green [Thu, 17 May 2018 13:49:17 +0000 (21:49 +0800)]
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: 0dfc98c507b1 ("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>
6 years agoeal: explicit cast in constant byte swap
Andy Green [Thu, 17 May 2018 13:50:37 +0000 (21:50 +0800)]
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: b75667ef9f7e ("eal: add static endianness conversion macros")
Cc: stable@dpdk.org
Signed-off-by: Andy Green <andy@warmcat.com>
6 years agoeal: fix casts in random functions
Andy Green [Thu, 17 May 2018 13:49:12 +0000 (21:49 +0800)]
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: af75078fece3 ("first public release")
Cc: stable@dpdk.org
Signed-off-by: Andy Green <andy@warmcat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
6 years agoeal: explicit cast of strlcpy return
Andy Green [Thu, 17 May 2018 14:03:48 +0000 (22:03 +0800)]
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: 5364de644a4b ("eal: support strlcpy function")

Signed-off-by: Andy Green <andy@warmcat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
6 years agombuf: fix C++ build on void pointer cast
David Marchand [Wed, 16 May 2018 11:10:40 +0000 (13:10 +0200)]
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: a53aa2b9f3be ("mbuf: support attaching external buffer")

Signed-off-by: David Marchand <david.marchand@6wind.com>
6 years agonet/sfc: fix errno if flow API RSS action parse fails
Roman Zhukov [Wed, 16 May 2018 14:21:23 +0000 (15:21 +0100)]
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: d77d07391d4d ("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>
6 years agonet/tap: support RSS hash update
Ophir Munk [Thu, 10 May 2018 17:30:25 +0000 (17:30 +0000)]
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>
6 years agodoc: add runtime queue setup in release notes
Qi Zhang [Thu, 10 May 2018 06:55:14 +0000 (14:55 +0800)]
doc: add runtime queue setup in release notes

Add updates for runtime queue setup.

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
6 years agonet/mlx4: fix shifts of signed values in Tx
Adrien Mazarguil [Wed, 16 May 2018 16:20:54 +0000 (18:20 +0200)]
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: 78e81a9844f8 ("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>
6 years agonet/mlx5: fix default RSS level
Shahaf Shuler [Tue, 15 May 2018 13:23:24 +0000 (16:23 +0300)]
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: d4a405186b73 ("net/mlx5: support tunnel RSS level")

Signed-off-by: Shahaf Shuler <shahafs@mellanox.com>
Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
6 years agonet/avf: fix traffic blocked on reset
Xiaoyun Li [Thu, 17 May 2018 11:24:14 +0000 (19:24 +0800)]
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: 69dd4c3d0898 ("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>
6 years agonet/ixgbe: fix too many interrupts
Wenzhuo Lu [Thu, 17 May 2018 05:34:09 +0000 (13:34 +0800)]
net/ixgbe: fix too many interrupts

To support kernel VF, PBA bit is always set. But it may
cause the too many interrupts issue on specific Linux
kernel versions, e.g. 4.4.0-116.
PF host should set the auto clean, mask and throttling
as we always set the register for kernel VF.

Fixes: 6b75183ac4d0 ("net/ixgbe: fix wrong PBA setting")
Cc: stable@dpdk.org
Signed-off-by: Michael Luo <michael.luo@intel.com>
Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
Reviewed-by: Qi Zhang <qi.z.zhang@intel.com>
6 years agonet/i40e: fix failing to disable FDIR Tx queue
Beilei Xing [Tue, 15 May 2018 16:19:05 +0000 (00:19 +0800)]
net/i40e: fix failing to disable FDIR Tx queue

If flow director is enabled, FDIR Tx queue can't
be disabled when exiting application. Root cause
is FDIR Tx queue is not disabled before removing
HMC backing store.

Fixes: 71d35259ff67 ("i40e: tear down flow director")
Cc: stable@dpdk.org
Signed-off-by: Beilei Xing <beilei.xing@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
6 years agonet/sfc: improve unsupported flow pattern message
Ivan Malov [Wed, 16 May 2018 13:24:03 +0000 (14:24 +0100)]
net/sfc: improve unsupported flow pattern message

Such a message could be generated by two places
in the code, and there is a difference in the
text albeit there is no difference in the meaning.
These two messages must be the same so that
automated error log comparison may be carried
out without confusion.

Fixes: a9825ccf5bb8 ("net/sfc: support flow API filters")
Cc: stable@dpdk.org
Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
6 years agonet/sfc: fix minimum number of Rx descriptors in ESSB mode
Andrew Rybchenko [Wed, 16 May 2018 12:35:36 +0000 (13:35 +0100)]
net/sfc: fix minimum number of Rx descriptors in ESSB mode

Number of descriptors in equal stride super-buffer Rx mode defines
number of packet buffers to be used. Each HW Rx descriptor has
many packet buffers and the number depends on total size of mbuf
and CONFIG_RTE_DRIVER_MEMPOOL_BUCKET_SIZE_KB value.
Typically it makes a bit less than 32 buffers per descriptor.
Since HW Rx descriptors must be pushed by 8, it makes about 256
as required minimum. Double it in advertised minimum to allow for
at least 2 refill blocks.

Fixes: 390f9b8d82c9 ("net/sfc: support equal stride super-buffer Rx mode")

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
6 years agomaintainers: fix responsibility of flow API bits
Adrien Mazarguil [Tue, 15 May 2018 16:23:03 +0000 (18:23 +0200)]
maintainers: fix responsibility of flow API bits

The following commits lack MAINTAINERS entries for this mess.

Fixes: 4d73b6fb9907 ("doc: add generic flow API guide")
Fixes: 19c90af6285c ("app/testpmd: add flow command")
Cc: stable@dpdk.org
Signed-off-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
6 years agonet/tap: fix isolation mode toggling
Ophir Munk [Mon, 14 May 2018 22:26:27 +0000 (22:26 +0000)]
net/tap: fix isolation mode toggling

Running testpmd command "flow isolae <port> 0" (i.e. disabling flow
isolation) followed by command "flow isolate <port> 1" (i.e. enabling
flow isolation) may result in a TAP error:
PMD: Kernel refused TC filter rule creation (17): File exists

Root cause analysis: when disabling flow isolation we keep the local
rule to redirect packets on TX (TAP_REMOTE_TX index) while we add it
again when enabling flow isolation. As a result this rule is added
two times in a row which results in "File exists" error.
The fix is to identify the "File exists" error and silently ignore it.

Another issue occurs when enabling isolation mode several times in a
row in which case the same tc rules are added consecutively and
rte_flow structs are added to a linked list before removing the
previous rte_flow structs.
The fix is to act upon isolation mode command only when there is a
change from "0" to "1" (or vice versa).

Fixes: f503d2694825 ("net/tap: support flow API isolated mode")
Cc: stable@dpdk.org
Reviewed-by: Raslan Darawsheh <rasland@mellanox.com>
Signed-off-by: Ophir Munk <ophirmu@mellanox.com>
Acked-by: Keith Wiles <keith.wiles@intel.com>
6 years agomaintainers: hand off ownership of tap PMD
Pascal Mazon [Thu, 17 May 2018 09:44:58 +0000 (11:44 +0200)]
maintainers: hand off ownership of tap PMD

I have unfortunately no longer time enough for maintaining Tap PMD.
Keith has kindly volunteered to take over maintainership. He's been at
the origin of this PMD and knows well how it works.

Signed-off-by: Pascal Mazon <pascal.mazon@6wind.com>
Acked-by: Keith Wiles <keith.wiles@intel.com>
6 years agovhost: improve dirty pages logging performance
Maxime Coquelin [Thu, 17 May 2018 11:44:47 +0000 (13:44 +0200)]
vhost: improve dirty pages logging performance

This patch caches all dirty pages logging until the used ring index
is updated.

The goal of this optimization is to fix a performance regression
introduced when the vhost library started to use atomic operations
to set bits in the shared dirty log map. While the fix was valid
as previous implementation wasn't safe against concurrent accesses,
contention was induced.

With this patch, during migration, we have:
1. Less atomic operations as only a single atomic OR operation
per 32 or 64 (depending on CPU) pages.
2. Less atomic operations as during a burst, the same page will
be marked dirty only once.
3. Less write memory barriers.

Fixes: 897f13a1f726 ("vhost: make page logging atomic")
Cc: stable@dpdk.org
Suggested-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Reviewed-by: Tiwei Bie <tiwei.bie@intel.com>
6 years agonet/mlx5: fix build without tunnel RSS support
Shahaf Shuler [Sun, 13 May 2018 08:07:46 +0000 (11:07 +0300)]
net/mlx5: fix build without tunnel RSS support

IBV_RX_HASH_INNER should be referenced only when having tunnel support
in the Verbs headers.

Fixes: 80f2d0ed7ff9 ("net/mlx5: add hardware flow debug dump")

Signed-off-by: Shahaf Shuler <shahafs@mellanox.com>
6 years agonet/mlx5: support MPLS-in-GRE and MPLS-in-UDP
Matan Azrad [Tue, 15 May 2018 11:07:14 +0000 (11:07 +0000)]
net/mlx5: support MPLS-in-GRE and MPLS-in-UDP

Add support for MPLS over GRE and MPLS over UDP tunnel types as
described in the next RFCs:
1. https://tools.ietf.org/html/rfc4023
2. https://tools.ietf.org/html/rfc7510
3. https://tools.ietf.org/html/rfc4385

Signed-off-by: Matan Azrad <matan@mellanox.com>
Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
6 years agonet/mlx5: add Bluefield device id
Shahaf Shuler [Tue, 15 May 2018 06:12:50 +0000 (09:12 +0300)]
net/mlx5: add Bluefield device id

Signed-off-by: Shahaf Shuler <shahafs@mellanox.com>
Acked-by: Nelio Laranjeiro <nelio.laranjeiro@6wind.com>
6 years agonet/mlx5: fix flow director drop rule deletion crash
Shahaf Shuler [Tue, 15 May 2018 06:26:35 +0000 (09:26 +0300)]
net/mlx5: fix flow director drop rule deletion crash

Drop flow rules are created on the ETH queue even though the parser layer
matches the flow rule layer (L3/L4)

Fixes: 6f2f4948b236 ("net/mlx5: fix flow director rule deletion crash")
Cc: stable@dpdk.org
Signed-off-by: Shahaf Shuler <shahafs@mellanox.com>
Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
6 years agonet/virtio-user: fix device init in legacy-mem mode
Xiao Wang [Thu, 17 May 2018 07:35:25 +0000 (15:35 +0800)]
net/virtio-user: fix device init in legacy-mem mode

In legacy-mem mode, memory event callback registering is not supported,
we should not return error in dev_init on this case.

Fixes: 12ecb2f63b12 ("net/virtio-user: support memory hotplug")

Suggested-by: Tiwei Bie <tiwei.bie@intel.com>
Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
6 years agonet/virtio-user: strip MAC feature when none specified
Tiwei Bie [Fri, 11 May 2018 10:55:42 +0000 (18:55 +0800)]
net/virtio-user: strip MAC feature when none specified

Currently VIRTIO_NET_F_MAC is set unconditionally when server
mode is used. It should be stripped when MAC isn't specified.

Fixes: bd8f50a45d0f ("net/virtio-user: support server mode")

Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
6 years agonet/vhost: do not clear offload flags in Rx
Tiwei Bie [Thu, 10 May 2018 07:04:14 +0000 (15:04 +0800)]
net/vhost: do not clear offload flags in Rx

The ol_flags of mbufs returned by rte_vhost_dequeue_burst()
contain necessary offload information. It can't be zeroed.

Fixes: f63d356ee993 ("net/vhost: insert/strip VLAN header in software")
Cc: stable@dpdk.org
Reported-by: Lei Yao <lei.a.yao@intel.com>
Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
6 years agovhost/crypto: handle virtually non-contiguous buffers
Fan Zhang [Thu, 10 May 2018 15:41:22 +0000 (16:41 +0100)]
vhost/crypto: handle virtually non-contiguous buffers

This patch enables the handling of buffers non-contiguous in
virtual address space in the vhost_crypto. Instead of using
rte_vhost_va_from_guest_pa(), the host virtual address is
converted by vhost_iova_to_vva() for wider use cases.

For copy mode, the copy length is limited to the chunk size,
next chunks VAs being fetched afterward.

Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
6 years agovhost/crypto: fix descriptor move
Fan Zhang [Wed, 9 May 2018 14:08:39 +0000 (15:08 +0100)]
vhost/crypto: fix descriptor move

This patch fixes the redundant descriptor move in the copy mode
of vhost crypto. Originally the redundant descriptor move will
cause the message parsing error.

Fixes: 3bb595ecd682 ("vhost/crypto: add request handler")

Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
6 years agonet/virtio-user: fix feature setting with vhost-net backend
Jiayu Hu [Fri, 11 May 2018 07:26:07 +0000 (15:26 +0800)]
net/virtio-user: fix feature setting with vhost-net backend

When the backend is vhost-net, virtio-user must work in client mode and
needs to request features from the backend in virtio_user_dev_init().
But currently, virtio-user is assigned to default features in this case.

This patch is to fix this inappropriate feature setting.

Fixes: bd8f50a45d0f ("net/virtio-user: support server mode")

Signed-off-by: Jiayu Hu <jiayu.hu@intel.com>
Tested-by: Lei Yao <lei.a.yao@intel.com>
Reviewed-by: Tiwei Bie <tiwei.bie@intel.com>
Reviewed-by: Zhiyong Yang <zhiyong.yang@intel.com>
6 years agoversion: 18.05-rc4
Thomas Monjalon [Tue, 15 May 2018 20:38:39 +0000 (22:38 +0200)]
version: 18.05-rc4

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
6 years agonet/qede: fix default Tx offload config
Rasesh Mody [Tue, 15 May 2018 19:43:59 +0000 (12:43 -0700)]
net/qede: fix default Tx offload config

Correct the default Tx offload config

Fixes: 946dfd18a4ec ("net/qede: convert to new Rx/Tx offloads API")

Signed-off-by: Rasesh Mody <rasesh.mody@cavium.com>
6 years agonet/mlx5: fix uninitialized variable in probing
Andy Green [Mon, 14 May 2018 05:04:38 +0000 (13:04 +0800)]
net/mlx5: fix uninitialized variable in probing

Fixes: ccdcba53a3f4 ("net/mlx5: use Netlink to add/remove MAC addresses")

Signed-off-by: Andy Green <andy@warmcat.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Yongseok Koh <yskoh@mellanox.com>
6 years agonet/bnx2x: fix memzone name overrun
Andy Green [Mon, 14 May 2018 05:04:43 +0000 (13:04 +0800)]
net/bnx2x: fix memzone name overrun

Fixes: 540a211084a7 ("bnx2x: driver core")
Cc: stable@dpdk.org
Signed-off-by: Andy Green <andy@warmcat.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Acked-by: Rasesh Mody <rasesh.mody@cavium.com>
6 years agonet/bnx2x: fix KR2 device check
Andy Green [Mon, 14 May 2018 05:04:33 +0000 (13:04 +0800)]
net/bnx2x: fix KR2 device check

In function ‘elink_check_kr2_wa’:
drivers/net/bnx2x/elink.c:12922:28:
error: bitwise comparison always evaluates to false
[-Werror=tautological-compare]
        ((next_page & 0xe0) == 0x2))));

This was fixed elsewhere in 2014

Fixes: b5bf7719221d ("bnx2x: driver support routines")
Cc: stable@dpdk.org
Signed-off-by: Andy Green <andy@warmcat.com>
Acked-by: Rasesh Mody <rasesh.mody@cavium.com>
6 years agonet/bnx2x: do not cast function pointers as a policy
Andy Green [Mon, 14 May 2018 05:04:28 +0000 (13:04 +0800)]
net/bnx2x: do not cast function pointers as a policy

This is stopping the compiler telling you when you have
done something stupid... that is something none of us
can afford...

Now gcc 8.x can tell you did something stupid despite
trying to hide the evidence.

Remove all the "black magic" casts.

Fix the actual problems.

Fixes: b5bf7719221d ("bnx2x: driver support routines")
Cc: stable@dpdk.org
Signed-off-by: Andy Green <andy@warmcat.com>
Acked-by: Rasesh Mody <rasesh.mody@cavium.com>
6 years agomempool: fix virtual address population
Anatoly Burakov [Mon, 14 May 2018 16:06:15 +0000 (17:06 +0100)]
mempool: fix virtual address population

Currently, populate_virt will check if mempool is already populated.
This will cause inability to reserve multi-chunk mempools if
contiguous memory is not a hard requirement, because if allocating
all-contiguous memory fails, mempool will retry with virtual addresses
and will call populate_virt. It seems that the original code never
anticipated more than one non-physically contiguous area.

Fix it by removing the check in populate virt. populate_anon() function
calls populate_virt() also, and it can be reasonably inferred that it is
expecting that virtual area is not already populated. Even though a
similar check is already in place there, also add the check that was
part of populate_virt() just in case.

Fixes: aab4f62d6c1c ("mempool: support no hugepage mode")
Cc: stable@dpdk.org
Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>
6 years agoeal: move runtime directory creation after args parsing
Anatoly Burakov [Tue, 15 May 2018 10:44:52 +0000 (11:44 +0100)]
eal: move runtime directory creation after args parsing

The intention of the original code was to create runtime data
directory as early as possible, however it was moved too early,
before the arguments were parsed, resulting in --file-prefix
option essentially not working.

Fix this by moving eal_create_runtime_dir() to after command
line arguments parsing.

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

Reported-by: Andrew Rybchenko <arybchenko@solarflare.com>
Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Tested-by: Andrew Rybchenko <arybchenko@solarflare.com>
6 years agobus/pci: fix size of driver name buffer
Andy Green [Tue, 15 May 2018 07:31:00 +0000 (15:31 +0800)]
bus/pci: fix size of driver name buffer

Variable dri_name is a pointer and it is incorrect to use its
size as the buffer size. Caller knows the buffer size and
it is safer to pass it explicitly.

Fixes: fe5f777b5383 ("bus/pci: replace strncpy by strlcpy")
Cc: stable@dpdk.org
Signed-off-by: Andy Green <andy@warmcat.com>
Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>
6 years agoversion: 18.05-rc3
Ferruh Yigit [Mon, 14 May 2018 23:03:42 +0000 (00:03 +0100)]
version: 18.05-rc3

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
6 years agoeal: move runtime data into dedicated directory
Anatoly Burakov [Mon, 14 May 2018 16:27:42 +0000 (17:27 +0100)]
eal: move runtime data into dedicated directory

Fix all calls to functions in eal_filesystem to produce paths
residing inside dedicated DPDK runtime directory. Leaving DPDK
runtime config in place as 3rd-party applications within the
DPDK ecosystem might rely on this path to determine whether
DPDK is running, so moving that will be postponed to the next
release cycle.

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
6 years agoeal: add directory for runtime data
Anatoly Burakov [Mon, 14 May 2018 16:27:41 +0000 (17:27 +0100)]
eal: add directory for runtime data

Currently, during runtime, DPDK will store a bunch of files here
and there (in /var/run, /tmp or in $HOME). Fix it by creating a
DPDK-specific runtime directory, under which all runtime data
will be placed. The template for creating this runtime directory
is the following:

  <base path>/dpdk/<DPDK prefix>/

Where <base path> is set to either "/var/run" if run as root, or
$XDG_RUNTIME_DIR if run as non-root, with a fallback to /tmp if
$XDG_RUNTIME_DIR is not defined. So, for example, if run as root,
by default all runtime data will be stored at /var/run/dpdk/rte/.

There is no equivalent of "mkdir -p", so we will be creating the
path step by step.

Nothing uses this new path yet, changes for that will come in
next commit.

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Reviewed-by: Reshma Pattan <reshma.pattan@intel.com>
6 years agomem: rename function returning hugepage data path
Anatoly Burakov [Mon, 14 May 2018 16:27:40 +0000 (17:27 +0100)]
mem: rename function returning hugepage data path

The original name for this path was not too descriptive and
confusing. Rename it to a more appropriate and descriptive name:
it stores data about hugepages, so name it eal_hugepage_data_path().

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Reviewed-by: Reshma Pattan <reshma.pattan@intel.com>
6 years agoeal: remove unused path pattern
Anatoly Burakov [Mon, 14 May 2018 16:27:39 +0000 (17:27 +0100)]
eal: remove unused path pattern

The define was a leftover from IVSHMEM library.

Fixes: c711ccb30987 ("ivshmem: remove library and its EAL integration")
Cc: stable@dpdk.org
Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Reviewed-by: David Marchand <david.marchand@6wind.com>
6 years agodevtools: provide more generic grep in git check
Andy Green [Mon, 14 May 2018 04:59:56 +0000 (12:59 +0800)]
devtools: provide more generic grep in git check

On Fedora 28, every patch is faulted for
"Wrong headline uppercase", because [A-Z] is not
always case sensitive.

Change to use [[:upper:]]

Signed-off-by: Andy Green <andy@warmcat.com>
Tested-by: Ferruh Yigit <ferruh.yigit@intel.com>
6 years agoapp/bbdev: use strcpy for allocated string
Andy Green [Mon, 14 May 2018 05:01:07 +0000 (13:01 +0800)]
app/bbdev: use strcpy for allocated string

app/test-bbdev/test_bbdev_vector.c:895: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-bbdev/test_bbdev_vector.c:917: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));
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Fixes: f714a18885a6 ("app/testbbdev: add test application for bbdev")
Cc: stable@dpdk.org
Signed-off-by: Andy Green <andy@warmcat.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
6 years agoapp/procinfo: fix sprintf overrun
Andy Green [Mon, 14 May 2018 05:01:02 +0000 (13:01 +0800)]
app/procinfo: fix sprintf overrun

app/proc-info/main.c: In function ‘nic_xstats_display’:
app/proc-info/main.c:495:45: error:
‘%s’ directive writing up to 255 bytes into a regioni of size between 165 and 232
[-Werror=format-overflow=]
    sprintf(buf, "PUTVAL %s/dpdkstat-port.%u/%s-%s N:%"
                                             ^~
     PRIu64"\n", host_id, port_id, counter_type,
                                   ~~~~~~~~~~~~
app/proc-info/main.c:495:4: note:
‘sprintf’ output between 31 and 435 bytes into a destination of size 256
    sprintf(buf, "PUTVAL %s/dpdkstat-port.%u/%s-%s N:%"
    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     PRIu64"\n", host_id, port_id, counter_type,
     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     xstats_names[i].name, values[i]);

Fixes: 2deb6b5246d7 ("app/procinfo: add collectd format and host id")
Cc: stable@dpdk.org
Signed-off-by: Andy Green <andy@warmcat.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
6 years agonet/vdev_netvsc: replace strncpy by strlcpy
Andy Green [Mon, 14 May 2018 05:00:57 +0000 (13:00 +0800)]
net/vdev_netvsc: replace strncpy by strlcpy

Continue snprintf to strlcpy conversions started by commit
c022cb400e92 ("convert snprintf to strlcpy").

Cc: stable@dpdk.org
Signed-off-by: Andy Green <andy@warmcat.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
6 years agonet/vdev_netvsc: readlink inputs cannot be aliased
Andy Green [Mon, 14 May 2018 05:00:52 +0000 (13:00 +0800)]
net/vdev_netvsc: readlink inputs cannot be aliased

drivers/net/vdev_netvsc/vdev_netvsc.c:335:2:error:
passing argument 2 to restrict-qualified parameter aliases with argument 1
  ret = readlink(buf, buf, size);
  ^~~

Fixes: e7dc5d7becc5 ("net/vdev_netvsc: implement core functionality")
Cc: stable@dpdk.org
Signed-off-by: Andy Green <andy@warmcat.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
6 years agonet/sfc: make sure that stats name is nul-terminated
Andy Green [Mon, 14 May 2018 05:00:47 +0000 (13:00 +0800)]
net/sfc: make sure that stats name is nul-terminated

Fixes: 73280c1e4ff2 ("net/sfc: support xstats retrieval by ID")
Fixes: 7b9891769f4b ("net/sfc: support extended statistics")
Cc: stable@dpdk.org
Signed-off-by: Andy Green <andy@warmcat.com>
Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
6 years agonet/qede: fix strncpy
Andy Green [Mon, 14 May 2018 05:00:42 +0000 (13:00 +0800)]
net/qede: fix strncpy

drivers/net/qede/qede_main.c: In function ‘qed_slowpath_start’:
drivers/net/qede/qede_main.c:307:3: error:
‘strncpy’ output may be truncated copying 12 bytes from a string of length 127
[-Werror=stringop-truncation]
   strncpy((char *)drv_version.name, (const char *)params->name,
   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    MCP_DRV_VER_STR_SIZE - 4);
    ~~~~~~~~~~~~~~~~~~~~~~~~~

Fixes: 86a2265e59d7 ("qede: add SRIOV support")
Cc: stable@dpdk.org
Signed-off-by: Andy Green <andy@warmcat.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
6 years agonet/qede: replace strncpy by strlcpy
Andy Green [Mon, 14 May 2018 05:00:37 +0000 (13:00 +0800)]
net/qede: replace strncpy by strlcpy

Fixes: 8427c6647964 ("net/qede/base: add attention formatting string")
Cc: stable@dpdk.org
Signed-off-by: Andy Green <andy@warmcat.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
6 years agonet/nfp: fix memcpy out of source range
Andy Green [Mon, 14 May 2018 05:00:32 +0000 (13:00 +0800)]
net/nfp: fix memcpy out of source range

drivers/net/nfp/nfp_net.c:669:2: error:
‘memcpy’ forming offset [5, 6] is out of the bounds [0, 4]
of object ‘tmp’ with type ‘uint32_t’ {aka ‘unsigned int’}
[-Werror=array-bounds]
memcpy(&hw->mac_addr[0], &tmp, sizeof(struct ether_addr));

Fixes: e6decee38209 ("net/nfp: use random MAC address if not configured")
Cc: stable@dpdk.org
Signed-off-by: Andy Green <andy@warmcat.com>
Acked-by: Alejandro Lucero <alejandro.lucero@netronome.com>
Tested-by: Alejandro Lucero <alejandro.lucero@netronome.com>
6 years agonet/nfp: fix off-by-one and no nul on strncpy use
Andy Green [Mon, 14 May 2018 05:00:27 +0000 (13:00 +0800)]
net/nfp: fix off-by-one and no nul on strncpy use

drivers/net/nfp/nfpcore/nfp_resource.c:76:2:error:
‘strncpy’ output may be truncated copying 8 bytes from a string of length 8
[-Werror=stringop-truncation]
  strncpy(name_pad, res->name, sizeof(name_pad));

Fixes: c7e9729da6b5 ("net/nfp: support CPP")

Signed-off-by: Andy Green <andy@warmcat.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
6 years agonet/nfp: fix strncpy misuse
Andy Green [Mon, 14 May 2018 05:00:22 +0000 (13:00 +0800)]
net/nfp: fix strncpy misuse

Fixes: c7e9729da6b5 ("net/nfp: support CPP")

Signed-off-by: Andy Green <andy@warmcat.com>
Acked-by: Alejandro Lucero <alejandro.lucero@netronome.com>
Tested-by: Alejandro Lucero <alejandro.lucero@netronome.com>
6 years agonet/nfp: fix buffer overflow of FW strings
Andy Green [Mon, 14 May 2018 05:00:01 +0000 (13:00 +0800)]
net/nfp: fix buffer overflow of FW strings

drivers/net/nfp/nfp_net.c: In function ‘nfp_pf_pci_probe’:
drivers/net/nfp/nfp_net.c:3160: 23: error:
‘%s’ directive writing up to 99 bytes into a region of size 76
[-Werror=format-overflow=]
  sprintf(fw_name, "%s/%s.nffw", DEFAULT_FW_PATH, serial);

Note fw_buf still has to increase somewhat even after
restricting serial[], since otherwise:

drivers/net/nfp/nfp_net.c: In function ‘nfp_pf_pci_probe’:
drivers/net/nfp/nfp_net.c:3176:23:
error: ‘%s’ directive writing up to 99 bytes into a region of size 76
[-Werror=format-overflow=]
  sprintf(fw_name, "%s/%s", DEFAULT_FW_PATH, card);
                       ^~
drivers/net/nfp/nfp_net.c:3262:32:
  err = nfp_fw_upload(dev, nsp, card_desc);
                                ~~~~~~~~~
drivers/net/nfp/nfp_net.c:3176:2:
note: ‘sprintf’ output between 25 and 124 bytes into a destination of size 100
  sprintf(fw_name, "%s/%s", DEFAULT_FW_PATH, card);

Fixes: 896c265ef954 ("net/nfp: use new CPP interface")

Signed-off-by: Andy Green <andy@warmcat.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
6 years agonet/axgbe: fix EEPROM string comparison
Andy Green [Mon, 14 May 2018 05:00:17 +0000 (13:00 +0800)]
net/axgbe: fix EEPROM string comparison

drivers/net/axgbe/axgbe_phy_impl.c:576:6: error:
‘__builtin_memcmp_eq’ reading 16 bytes from a region of size 9
[-Werror=stringop-overflow=]
  if (memcmp(&sfp_eeprom->base[AXGBE_SFP_BASE_VENDOR_NAME],
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      AXGBE_BEL_FUSE_VENDOR, AXGBE_SFP_BASE_VENDOR_NAME_LEN))

Fixes: a5c7273771e8 ("net/axgbe: add phy programming APIs")

Signed-off-by: Andy Green <andy@warmcat.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
6 years agobus/dpaa: fix inconsistent struct alignment
Andy Green [Mon, 14 May 2018 05:00:12 +0000 (13:00 +0800)]
bus/dpaa: fix inconsistent struct alignment

The actual descriptor for qm_mr_entry is 64-byte aligned.

But the original code plays a trick, and puts a u8 common
to the three descriptor subtypes in the union afterwards
outside their structure definitions.

Unfortunately since they compose a struct qm_fd with
alignment 8, this trick destroys the ability of the compiler
to understand what has happened, resulting in this kind of
problem:

drivers/bus/dpaa/include/fsl_qman.h:354:3: error:
alignment 1 of ‘struct <anonymous>’ is less than 8 [-Werror=packed-not-aligned]
   } __packed dcern;

on gcc 8 / Fedora 28 out of the box.

This patch moves the u8 verb into the structure definitions
composed into the union, so the alignment of the parent struct
containing the alignment 8 object can also be seen to be
alignment 8 by the compiler.  Uses of .verb are fixed up to use
.ern.verb (the same offset of +0 inside all the structs in
the union).

The final struct layout should be unchanged.

Fixes: c47ff048b99a ("bus/dpaa: add QMAN driver core routines")
Fixes: f6fadc3e6310 ("bus/dpaa: add QMAN interface driver")
Cc: stable@dpdk.org
Signed-off-by: Andy Green <andy@warmcat.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Tested-by: Hemant Agrawal <hemant.agrawal@nxp.com>
6 years agobus/pci: replace strncpy by strlcpy
Andy Green [Mon, 14 May 2018 05:00:06 +0000 (13:00 +0800)]
bus/pci: replace strncpy by strlcpy

In function ‘pci_get_kernel_driver_by_path’,
    inlined from ‘pci_scan_one.isra.1’ at
drivers/bus/pci/linux/pci.c:317:8:
drivers/bus/pci/linux/pci.c:57:3: error:
‘strncpy’ specified bound depends on the length of the source argument
[-Werror=stringop-overflow=]
   strncpy(dri_name, name + 1, strlen(name + 1) + 1);

Fixes: d9a8cd9595f2 ("pci: add kernel driver type")
Cc: stable@dpdk.org
Signed-off-by: Andy Green <andy@warmcat.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
6 years agonet/tap: add default name to tun
Vipin Varghese [Sat, 12 May 2018 06:21:33 +0000 (11:51 +0530)]
net/tap: add default name to tun

The change adds default name to reflect TUN PMD instance. if option
name is not passed, the default dtun is taken.

Signed-off-by: Vipin Varghese <vipin.varghese@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
6 years agonet/enic: fix missing offload capabilities
Hyong Youb Kim [Mon, 14 May 2018 14:11:26 +0000 (07:11 -0700)]
net/enic: fix missing offload capabilities

Add the following missing flags to the advertised offloads.
- DEV_RX_OFFLOAD_CRC_STRIP
  CRC is always stripped.
- DEV_RX_OFFLOAD_JUMBO_FRAME
  Jumbo support is always enabled on the NIC.
- DEV_RX_OFFLOAD_SCATTER
  Scatter Rx is currently supported.
- DEV_TX_OFFLOAD_MULTI_SEGS
  Multiple-segment transmit has always been supported.

Fixes: 93fb21fdbe23 ("net/enic: enable overlay offload for VXLAN and GENEVE")

Signed-off-by: Hyong Youb Kim <hyonkim@cisco.com>
6 years agonet/bonding: fix slave activation simultaneously
Matan Azrad [Tue, 24 Apr 2018 11:29:30 +0000 (11:29 +0000)]
net/bonding: fix slave activation simultaneously

The bonding PMD decides to activate\deactivate its slaves according to
the slaves link statuses.
Thus, it registers to the LSC events of the slaves ports and
activates\deactivates them from its LSC callbacks called asynchronously
by the host thread when the slave link status is changed.

In addition, the bonding PMD uses the callback for slave activation
when it tries to start it, this operation is probably called by the
master thread.

Consequently, a slave may be activated in the same time by two
different threads and may cause a lot of optional errors, for example,
slave mempool recreation with the same name causes an error.

Synchronize the critical section in the LSC callback using a special
new spinlock.

Fixes: 414b202343ce ("bonding: fix initial link status of slave")
Fixes: a45b288ef21a ("bond: support link status polling")
Cc: stable@dpdk.org
Signed-off-by: Matan Azrad <matan@mellanox.com>
Acked-by: Declan Doherty <declan.doherty@intel.com>
6 years agonet/avf: fix Rx interrupt mapping
Jingjing Wu [Fri, 11 May 2018 15:09:48 +0000 (23:09 +0800)]
net/avf: fix Rx interrupt mapping

Vector used for rx mapping is different if WB_ON_ITR
is supported. The mapping table need to be updated.

Fixes: d6bde6b5eae9 ("net/avf: enable Rx interrupt")

Signed-off-by: Jingjing Wu <jingjing.wu@intel.com>
Cc: stable@dpdk.org
6 years agonet/dpaa2: change VLAN strip value to offload flag
Shreyansh Jain [Mon, 14 May 2018 10:58:26 +0000 (16:28 +0530)]
net/dpaa2: change VLAN strip value to offload flag

Fixes: 0ebce6129bc6 ("net/dpaa2: support new ethdev offload APIs")

Signed-off-by: Shreyansh Jain <shreyansh.jain@nxp.com>
6 years agonet/cxgbe: free resources during uninit
Rahul Lakkireddy [Sat, 12 May 2018 11:50:00 +0000 (17:20 +0530)]
net/cxgbe: free resources during uninit

Move freeing up resources from dev_close() to dev_uninit(). This fixes
NULL pointer de-reference when accessing adapter context needed by
other ports under same PF, but had been freed up by the first port.
This can happen if only the first port is started up and the check
to free up all resources is still satisfied. When dev_close is
called for other ports, adapter context is NULL since it was freed
up by the first port.

Thus, by moving to dev_uninit() all the ports can be teared down
safely without need for extra checks.

Fixes: 2195df6d11bd ("net/cxgbe: rework ethdev device allocation")

Signed-off-by: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
Signed-off-by: Kumar Sanghvi <kumaras@chelsio.com>
6 years agonet/mlx4: advertise supported RSS hash functions
Ophir Munk [Mon, 14 May 2018 10:07:32 +0000 (10:07 +0000)]
net/mlx4: advertise supported RSS hash functions

Advertise mlx4 supported RSS functions as part of dev_infos_get
callback.
Previous to this commit RSS support was reported as none. Since the
introduction of [1] it is required that all RSS configurations will be
verified.

[1] commit 8863a1fbfc66 ("ethdev: add supported hash function check")

Signed-off-by: Ophir Munk <ophirmu@mellanox.com>
6 years agonet/mlx4: avoid constant recreations in function
Ophir Munk [Mon, 14 May 2018 10:07:31 +0000 (10:07 +0000)]
net/mlx4: avoid constant recreations in function

Function mlx4_conv_rss_types() contains constant arrays variables
which are recreated with every call to the function. By changing the
arrays definitions from "const" to "static const" these recreations
can be saved.

Signed-off-by: Ophir Munk <ophirmu@mellanox.com>
6 years agonet/mlx5: use correct field in a union structure
Yongseok Koh [Sat, 12 May 2018 01:35:45 +0000 (18:35 -0700)]
net/mlx5: use correct field in a union structure

This is not a bug but it is better to use semantically correct field.

Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
6 years agonet/mlx5: use coherent I/O memory barrier
Yongseok Koh [Sat, 12 May 2018 01:35:44 +0000 (18:35 -0700)]
net/mlx5: use coherent I/O memory barrier

Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
6 years agonet/mlx5: fix inlining segmented TSO packet
Yongseok Koh [Fri, 11 May 2018 17:39:13 +0000 (10:39 -0700)]
net/mlx5: fix inlining segmented TSO packet

When a multi-segmented packet is inlined, data can be further inlined even
after the first segment. In case of TSO packet, extra inline data after TSO
header should be carried by an inline DSEG which has 4B inline header
recording the length of the inline data. If more than one segment is
inlined, the length doesn't count from the second segment. This will cause
a fault in HW and CQE will have an error, which is ignored by PMD.

Fixes: f895536be4fa ("net/mlx5: enable inlining data from multiple segments")
Cc: stable@dpdk.org
Signed-off-by: Xueming Li <xuemingl@mellanox.com>
Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
6 years agoapp/testpmd: check if CRC strip offload supported
Ferruh Yigit [Wed, 9 May 2018 22:09:04 +0000 (23:09 +0100)]
app/testpmd: check if CRC strip offload supported

Testpmd set CRC_STRIP offload blindly, this is wrong according offload
API definition, and will cause error for the PMDs that doesn't support
CRC_STRIP like virtual PMDs.

Check if underlying device report this capability and don't set it if
not supported.

Fixes: 0074d02fca21 ("app/testpmd: convert to new Rx offloads API")

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Shahaf Shuler <shahafs@mellanox.com>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
6 years agonet/failsafe: add an RSS hash update callback
Ophir Munk [Thu, 10 May 2018 14:38:10 +0000 (14:38 +0000)]
net/failsafe: add an RSS hash update callback

Add an RSS hash update callback to eth_dev_ops.

Signed-off-by: Ophir Munk <ophirmu@mellanox.com>
Acked-by: Gaetan Rivet <gaetan.rivet@6wind.com>
6 years agoethdev: improve doc for name by port ID API
Ivan Malov [Fri, 11 May 2018 14:05:51 +0000 (15:05 +0100)]
ethdev: improve doc for name by port ID API

Description of rte_eth_dev_get_name_by_port() calls
port ID argument a pointer, which is misleading.
Also, output buffer minimal size is not mentioned.
These points need to be improved.

Fixes: bde516d5a85a ("ethdev: get port by name")
Cc: stable@dpdk.org
Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
6 years agonet/ixgbe: fix missing port representor data-path
Remy Horton [Fri, 11 May 2018 12:28:45 +0000 (13:28 +0100)]
net/ixgbe: fix missing port representor data-path

This patch adds Rx and Tx burst functions to the ixgbe
Port Representors, so that the implementation within
ixgbe PMD can be tested using applications such as
testpmd which require data-path functionality.

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

Signed-off-by: Remy Horton <remy.horton@intel.com>
Acked-by: Mohammad Abdul Awal <mohammad.abdul.awal@intel.com>
6 years agonet/i40e: fix missing port representor data-path
Remy Horton [Fri, 11 May 2018 12:28:44 +0000 (13:28 +0100)]
net/i40e: fix missing port representor data-path

This patch adds Rx and Tx burst functions to the i40e Port
Representors, so that the implementation within this PMD
can be tested using applications such as testpmd which
require data-path functionality.

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

Signed-off-by: Remy Horton <remy.horton@intel.com>
Acked-by: Mohammad Abdul Awal <mohammad.abdul.awal@intel.com>
6 years agoethdev: fix checking Rx/Tx queue status
Yanglong Wu [Fri, 11 May 2018 08:22:28 +0000 (16:22 +0800)]
ethdev: fix checking Rx/Tx queue status

Relax the check for queue setup, since some device
may not update queue states during dev_stop.

Fixes: cac923cfea47 ("ethdev: support runtime queue setup")

Signed-off-by: Yanglong Wu <yanglong.wu@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
6 years agonet/i40e: print original value for global register change
Beilei Xing [Fri, 11 May 2018 18:17:07 +0000 (02:17 +0800)]
net/i40e: print original value for global register change

Currently, only new value is printed during global
register change. Add original value to help debugging
facility.

Fixes: bc66b9717c50 ("net/i40e: add debug logs when writing global registers")
Cc: stable@dpdk.org
Signed-off-by: Beilei Xing <beilei.xing@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
6 years agonet/virtio-user: fix multiple queues fail in server mode
Zhiyong Yang [Fri, 11 May 2018 03:31:37 +0000 (11:31 +0800)]
net/virtio-user: fix multiple queues fail in server mode

This patch fixes multiple queues failure when virtio-user works in
server mode.

This patch adds feature negotiation in the processing of virtio-user
connection and enables multiple-queue pairs.

Fixes: bd8f50a45d0f ("net/virtio-user: support server mode")
Cc: stable@dpdk.org
Signed-off-by: Zhiyong Yang <zhiyong.yang@intel.com>
Reviewed-by: Tiwei Bie <tiwei.bie@intel.com>
6 years agonet/i40e: fix missing VLAN offload capability
Yanglong Wu [Thu, 10 May 2018 06:50:38 +0000 (14:50 +0800)]
net/i40e: fix missing VLAN offload capability

VLAN offload capability should be exposed in VF
since i40e does support it.

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

Signed-off-by: Yanglong Wu <yanglong.wu@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
6 years agonet/i40e: fix missing mbuf fast free offload
Qi Zhang [Fri, 11 May 2018 01:25:42 +0000 (09:25 +0800)]
net/i40e: fix missing mbuf fast free offload

Expose the missing mbuf fast free capability since i40 does
support it.

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

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
6 years agoethdev: fix port removal notification timing
Matan Azrad [Thu, 10 May 2018 23:58:36 +0000 (01:58 +0200)]
ethdev: fix port removal notification timing

When an ethdev port is released, a destroy event is triggered to notify
the users about the released port.

A bit before the destroy event is triggered, the port becomes invalid
by changing its state to UNUSED and cleaning its data. Therefore, the
port is invalid for the destroy event callback process and the users
may get a wrong information of the port.

Move the destroy event emitting to be called before the port
invalidation.

Fixes: 133b54779aa1 ("ethdev: fix port data reset timing")
Fixes: 29aa41e36de7 ("ethdev: add notifications for probing and removal")
Cc: stable@dpdk.org
Signed-off-by: Matan Azrad <matan@mellanox.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Stephen Hemminger <stephen@networkplumber.org>
6 years agonet/failsafe: fix sub-device ownership race
Matan Azrad [Thu, 10 May 2018 23:58:35 +0000 (01:58 +0200)]
net/failsafe: fix sub-device ownership race

There is time between the sub-device port probing by the sub-device PMD
to the sub-device port ownership taking by a fail-safe port.

In this time, the port is available for the application usage. For
example, the port will be exposed to the applications which use
RTE_ETH_FOREACH_DEV iterator.

Thus, ownership unaware applications may manage the port in this time
what may cause a lot of problematic behaviors in the fail-safe
sub-device initialization.

Register to the ethdev NEW event to take the sub-device port ownership
before it becomes exposed to the application.

Fixes: a46f8d584eb8 ("net/failsafe: add fail-safe PMD")
Cc: stable@dpdk.org
Signed-off-by: Matan Azrad <matan@mellanox.com>
Acked-by: Gaetan Rivet <gaetan.rivet@6wind.com>
Reviewed-by: Stephen Hemminger <stephen@networkplumber.org>
6 years agoethdev: fix port probing notification
Thomas Monjalon [Thu, 10 May 2018 23:58:34 +0000 (01:58 +0200)]
ethdev: fix port probing notification

The new device was notified as soon as it was allocated.
It leads to use a device which is not yet initialized.

The notification must be published after the initialization is done
by the PMD, but before the state is changed, in order to let
notified entities taking ownership before general availability.

Fixes: 29aa41e36de7 ("ethdev: add notifications for probing and removal")
Cc: stable@dpdk.org
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Stephen Hemminger <stephen@networkplumber.org>
6 years agoethdev: fix port visibility before initialization
Thomas Monjalon [Thu, 10 May 2018 23:58:33 +0000 (01:58 +0200)]
ethdev: fix port visibility before initialization

The port was set to the state ATTACHED during allocation.
The consequence was to iterate over ports which are not initialized.

The state ATTACHED is now set as the last step of probing.

The uniqueness of port name is now checked before the availability
of a port id for allocation (order reversed).

As the state is not set on allocation anymore, it is also not checked
in the function telling whether a port is allocated or not.
The name of the port is set on allocation, so it is enough as a check.

Fixes: 5588909af21b ("ethdev: add device iterator")
Cc: stable@dpdk.org
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Signed-off-by: Matan Azrad <matan@mellanox.com>
Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Stephen Hemminger <stephen@networkplumber.org>
6 years agoethdev: add lock to port allocation check
Matan Azrad [Thu, 10 May 2018 23:58:32 +0000 (01:58 +0200)]
ethdev: add lock to port allocation check

When comparing the port name, there can be a race condition with
a thread allocating a new port and writing the name at the same time.
It can lead to match with a partial name by error.

The check of the port is now considered as a critical section
protected with locks.

This fix will be even more required for multi-process when the
port availability will rely only on the name, in a following patch.

Fixes: 84934303a17c ("ethdev: synchronize port allocation")
Cc: stable@dpdk.org
Signed-off-by: Matan Azrad <matan@mellanox.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Stephen Hemminger <stephen@networkplumber.org>
6 years agoethdev: allow ownership operations on unused port
Matan Azrad [Thu, 10 May 2018 23:58:31 +0000 (01:58 +0200)]
ethdev: allow ownership operations on unused port

When the state will be updated later than in allocation,
we may need to update the ownership of a port which is
still in state unused.

It will be used to take ownership of a port before it is
declared as available for other entities.

Cc: stable@dpdk.org
Signed-off-by: Matan Azrad <matan@mellanox.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Stephen Hemminger <stephen@networkplumber.org>
6 years agoethdev: add probing finish function
Thomas Monjalon [Thu, 10 May 2018 23:58:30 +0000 (01:58 +0200)]
ethdev: add probing finish function

A new hook function is added and called inside the PMDs at the end
of the device probing:
- in primary process, after allocating, init and config
- in secondary process, after attaching and local init

This new function is almost empty for now.
It will be used later to add some post-initialization processing.

For the PMDs calling the helpers rte_eth_dev_create() or
rte_eth_dev_pci_generic_probe(), the hook rte_eth_dev_probing_finish()
is called from here, and not in the PMD itself.

Note that the helper rte_eth_dev_create() could be used more,
especially for vdevs, avoiding some code duplication in PMDs.

Cc: stable@dpdk.org
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Stephen Hemminger <stephen@networkplumber.org>
6 years agodrivers/net: use higher level of probing helper for PCI
Thomas Monjalon [Thu, 10 May 2018 23:58:29 +0000 (01:58 +0200)]
drivers/net: use higher level of probing helper for PCI

The drivers avp, bnx2x and liquidio were using the helper function
rte_eth_dev_pci_allocate() and can be replaced by
rte_eth_dev_pci_generic_probe() which calls the former.

Fixes: dcd5c8112bc3 ("ethdev: add PCI driver helpers")
Cc: stable@dpdk.org
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Stephen Hemminger <stephen@networkplumber.org>
6 years agoethdev: add doxygen comments for each state
Thomas Monjalon [Thu, 10 May 2018 23:58:28 +0000 (01:58 +0200)]
ethdev: add doxygen comments for each state

The enum rte_eth_dev_state was not properly documented.
Its values did not appear in the doxygen output,
and may be misunderstood.

The state RTE_ETH_DEV_DEFERRED has no interest anymore
since the ownership mechanism brings a more flexible categorization.
This state could be removed later.

Fixes: d52268a8b24b ("ethdev: expose device states")
Fixes: cb894d99eceb ("ethdev: add deferred intermediate device state")
Fixes: 5b7ba31148a8 ("ethdev: add port ownership")
Fixes: 7106edc12380 ("ethdev: add devop to check removal status")

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Matan Azrad <matan@mellanox.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Stephen Hemminger <stephen@networkplumber.org>
6 years agonet/failsafe: fix sub-device visibility
Thomas Monjalon [Thu, 10 May 2018 23:58:27 +0000 (01:58 +0200)]
net/failsafe: fix sub-device visibility

The iterator function rte_eth_find_next_owned_by(), used by the
iterator macro RTE_ETH_FOREACH_DEV_OWNED_BY, are ignoring the devices
which are neither ATTACHED nor REMOVED. Thus sub-devices, having
the state DEFERRED, cannot be seen with the ethdev iterator.
The state RTE_ETH_DEV_DEFERRED can be replaced by
RTE_ETH_DEV_ATTACHED + owner.

Fixes: dcd0c9c32b8d ("net/failsafe: use ownership mechanism for slaves")
Cc: stable@dpdk.org
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Matan Azrad <matan@mellanox.com>
Acked-by: Gaetan Rivet <gaetan.rivet@6wind.com>
Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Stephen Hemminger <stephen@networkplumber.org>
6 years agoethdev: fix debug log of owner id
Thomas Monjalon [Thu, 10 May 2018 23:58:26 +0000 (01:58 +0200)]
ethdev: fix debug log of owner id

The owner id is 64-bit.
On 32-bit environment, it must be printed with PRIX64.

Fixes: 5b7ba31148a8 ("ethdev: add port ownership")
Cc: stable@dpdk.org
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Stephen Hemminger <stephen@networkplumber.org>
6 years agoapp/testpmd: add commands to test new offload API
Wei Dai [Wed, 9 May 2018 12:13:50 +0000 (20:13 +0800)]
app/testpmd: add commands to test new offload API

Add following testpmd run-time commands to support test of
new Rx offload API:
show port <port_id> rx_offload capabilities
show port <port_id> rx_offload configuration
port config <port_id> rx_offload <offload> on|off
port <port_id> rxq <queue_id> rx_offload <offload> on|off
Above last 2 commands should be run when the port is stopped.
And <offload> can be one of "vlan_strip", "ipv4_cksum", ...

Add following testpmd run-time commands to support test of
new Tx offload API:
show port <port_id> tx_offload capabilities
show port <port_id> tx_offload configuration
port config <port_id> tx_offload <offload> on|off
port <port_id> txq <queue_id> tx_offload <offload> on|off
Above last 2 commands should be run when the port is stopped.
And <offload> can be one of "vlan_insert", "udp_cksum", ...

Signed-off-by: Wei Dai <wei.dai@intel.com>
Acked-by: Jingjing Wu <jingjing.wu@intel.com>
6 years agonet/i40e: print global register change info
Beilei Xing [Thu, 10 May 2018 22:48:38 +0000 (06:48 +0800)]
net/i40e: print global register change info

Global register change info during enabling
flexible payload is not printed.
This patch changes macro to print the global
register change info.

Fixes: d2f9fe8ae309 ("net/i40e: turn off flexible payload on driver init")
Cc: stable@dpdk.org
Signed-off-by: Beilei Xing <beilei.xing@intel.com>