dpdk.git
6 years agonet/mlx5: swap items/actions validations for E-Switch rules
Viacheslav Ovsiienko [Sat, 3 Nov 2018 06:18:38 +0000 (06:18 +0000)]
net/mlx5: swap items/actions validations for E-Switch rules

The rule validation function for E-Switch checks item list first,
then action list is checked. This patch swaps the validation order,
now actions are checked first. This is preparation for validation
function update with VXLAN tunnel actions. VXLAN decapsulation
action requires to check the items in special way. We could do
this special check in the single item check pass if the action
flags were gathered before. This is the reason to swap the
item/actions checking loops.

Suggested-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
Acked-by: Yongseok Koh <yskoh@mellanox.com>
6 years agonet/mlx5: add necessary structures for E-Switch VXLAN
Viacheslav Ovsiienko [Sat, 3 Nov 2018 06:18:37 +0000 (06:18 +0000)]
net/mlx5: add necessary structures for E-Switch VXLAN

This patch introduces the data structures needed to implement VXLAN
encapsulation/decapsulation hardware offload support for E-Switch.

Suggested-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
Acked-by: Yongseok Koh <yskoh@mellanox.com>
6 years agonet/mlx5: add necessary definitions for E-Switch VXLAN
Viacheslav Ovsiienko [Sat, 3 Nov 2018 06:18:36 +0000 (06:18 +0000)]
net/mlx5: add necessary definitions for E-Switch VXLAN

This patch contains tc flower related and some other definitions
needed to implement VXLAN encapsulation/decapsulation hardware
offload support for E-Switch.

mlx5 driver dynamically creates and manages the VXLAN virtual
tunnel endpoint devices, the following definitions control
the parameters of these network devices:

- MLX5_VXLAN_PORT_MIN - minimal allowed UDP port for VXLAN device
- MLX5_VXLAN_PORT_MAX - maximal allowed UDP port for VXLAN device
- MLX5_VXLAN_DEVICE_PFX - name prefix of driver created VXLAN device

The mlx5 drivers creates the VXLAN devices with UDP port within
specified range, devices have the names with specified prefix,
followed by decimal digits of UDP port.

Suggested-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
Acked-by: Yongseok Koh <yskoh@mellanox.com>
6 years agonet/mlx5: prepare meson build for adding E-Switch VXLAN
Viacheslav Ovsiienko [Sat, 3 Nov 2018 06:18:36 +0000 (06:18 +0000)]
net/mlx5: prepare meson build for adding E-Switch VXLAN

This patch updates meson.build before adding E-Switch VXLAN
encapsulation/decapsulation hardware offload support.
E-Switch rules are controlled via tc Netilnk commands,
so we need to include tc related headers, and check for
some tunnel specific key definitions.

Suggested-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
Acked-by: Yongseok Koh <yskoh@mellanox.com>
6 years agonet/mlx5: prepare makefile for adding E-Switch VXLAN
Viacheslav Ovsiienko [Sat, 3 Nov 2018 06:18:35 +0000 (06:18 +0000)]
net/mlx5: prepare makefile for adding E-Switch VXLAN

This patch updates makefile before adding E-Switch VXLAN
encapsulation/decapsulation hardware offload support.
E-Switch rules are controlled via tc Netilnk commands,
so we need to include tc related headers, and check for
some tunnel specific key definitions.

Suggested-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
Acked-by: Yongseok Koh <yskoh@mellanox.com>
6 years agonet/enic: use macro for attribute weak
Hyong Youb Kim [Fri, 2 Nov 2018 05:49:17 +0000 (22:49 -0700)]
net/enic: use macro for attribute weak

Fixes: 8a6ff33d6d36 ("net/enic: add AVX2 based vectorized Rx handler")

Signed-off-by: Hyong Youb Kim <hyonkim@cisco.com>
6 years agovhost/crypto: fix inferred misuse of enum
Fan Zhang [Thu, 1 Nov 2018 14:15:04 +0000 (14:15 +0000)]
vhost/crypto: fix inferred misuse of enum

Fix inffered misuse of enum rte_crypto_cipher_algorithm and
rte_crypto_auth_algorithm

Coverity issue: 277202
Fixes: e80a98708166 ("vhost/crypto: add session message handler")
Cc: stable@dpdk.org
Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
6 years agoapp/testpmd: fix port status for new bonded devices
Radu Nicolau [Thu, 1 Nov 2018 11:20:32 +0000 (11:20 +0000)]
app/testpmd: fix port status for new bonded devices

Set port status to stopped for newly added devices.

Fixes: 2950a769315e ("bond: testpmd support")
Cc: stable@dpdk.org
Signed-off-by: Radu Nicolau <radu.nicolau@intel.com>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
6 years agodoc: clarify TSO Tx offload prerequisite
Jerin Jacob [Thu, 1 Nov 2018 08:46:42 +0000 (08:46 +0000)]
doc: clarify TSO Tx offload prerequisite

Based on the PKT_TX_TCP_SEG definition,
the application needs to update PKT_TX_IPV4 or PKT_TX_IPV6
based on IPV4 or IPV6 packet and PKT_TX_IP_CKSUM ol_flags
to enable Tx TSO offload.

Fixes: dad1ec72a377 ("doc: document NIC features")
Cc: stable@dpdk.org
Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
6 years agonet/bonding: fix crash on probe
Radu Nicolau [Wed, 31 Oct 2018 15:50:08 +0000 (15:50 +0000)]
net/bonding: fix crash on probe

After the patch below the call to rte_eth_bond_8023ad_agg_selection_set
from probe() segfaults; there is no need to call the function, just set
the mode directly.
Also, reverted 1620175b400e.

Fixes: 391797f04208 ("drivers/bus: move driver assignment to end of probing")
Fixes: 1620175b400e ("net/bonding: fix invalid port id")
Cc: stable@dpdk.org
Signed-off-by: Radu Nicolau <radu.nicolau@intel.com>
Acked-by: Chas Williams <chas3@att.com>
6 years agonet/ena: remove resources when port is being closed
Michal Krawczyk [Wed, 31 Oct 2018 14:53:16 +0000 (15:53 +0100)]
net/ena: remove resources when port is being closed

The new API introduced in 18.11 is suggesting, that the driver should
release all it's resources at the dev_close routine.

All resources previously released in uninit routine during PCI removal,
are now being released at the dev_close and the PMD is indicating that
it is supporting API changes by setting RTE_ETH_DEV_CLOSE_REMOVE flag.

As the device is not allocating MAC addresses dynamically, it is setting
mac_addrs field to NULL, so it wouldn't be released by the
rte_eth_dev_release_port().

Signed-off-by: Michal Krawczyk <mk@semihalf.com>
6 years agonet/qede/base: fix to initialize HW for LLH filters
Rasesh Mody [Wed, 31 Oct 2018 00:27:03 +0000 (00:27 +0000)]
net/qede/base: fix to initialize HW for LLH filters

During initialization of leading PF, we need to initialize HW for LLH
filters. Set HW init parameter to set the engine affinity for
multiple engine adapters.

Fixes: 3eed444a9621 ("net/qede/base: changes for 100G")

Signed-off-by: Rasesh Mody <rasesh.mody@cavium.com>
6 years agoapp/testpmd: fix Tx offload flags
Ferruh Yigit [Sun, 28 Oct 2018 02:16:39 +0000 (02:16 +0000)]
app/testpmd: fix Tx offload flags

ol_flags can be wrong if DEV_TX_OFFLOAD_VLAN_INSERT is not set in
tx_offloads

Fixes: 3eecba267cd6 ("app/testpmd: cleanup internal Tx offloads flags field")
Cc: stable@dpdk.org
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
6 years agoethdev: fix redundant function pointer check
Ferruh Yigit [Sun, 28 Oct 2018 01:46:50 +0000 (01:46 +0000)]
ethdev: fix redundant function pointer check

RTE_FUNC_PTR_OR_ERR_RET() already does the `ethdev_uninit` NULL check.

Fixes: e489007a411c ("ethdev: add generic create/destroy ethdev APIs")
Cc: stable@dpdk.org
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
6 years agovhost: advertize packed ring layout support
Maxime Coquelin [Wed, 31 Oct 2018 10:26:40 +0000 (11:26 +0100)]
vhost: advertize packed ring layout support

Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Reviewed-by: Jens Freimann <jfreimann@redhat.com>
Reviewed-by: Tiwei Bie <tiwei.bie@intel.com>
6 years agovhost: add packed ring support to vring base requests
Maxime Coquelin [Wed, 31 Oct 2018 10:26:39 +0000 (11:26 +0100)]
vhost: add packed ring support to vring base requests

For packed ring layout, we need save avail index and its wrap
counter value. At restore time, the used index and its wrap counter
are set to available's ones, as the ring procressing is stopped
at vring base get time.

Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Reviewed-by: Jens Freimann <jfreimann@redhat.com>
Reviewed-by: Tiwei Bie <tiwei.bie@intel.com>
6 years agonet/virtio: do not re-enter clean up routines
Chas Williams [Mon, 17 Jul 2017 23:05:22 +0000 (19:05 -0400)]
net/virtio: do not re-enter clean up routines

.dev_uninit calls .dev_stop and .dev_close.  The work that is done in
those routines doesn't need repeated.  Use started and opened to track
the adapter's status.

Fixes: c1f86306a026 ("virtio: add new driver")
Cc: stable@dpdk.org
Signed-off-by: Chas Williams <ciwillia@brocade.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
6 years agonet/ixgbe: fix busy polling while fiber link update
Ilya Maximets [Thu, 1 Nov 2018 16:04:59 +0000 (19:04 +0300)]
net/ixgbe: fix busy polling while fiber link update

If the multispeed fiber link is in DOWN state, ixgbe_setup_link
could take around a second of busy polling. This is highly
inconvenient for the case where single thread periodically
checks the link statuses. For example, OVS main thread
periodically updates the link statuses and hangs for a really
long time busy waiting on ixgbe_setup_link() for a DOWN fiber
ports. For case with 3 down ports it hangs for a 3 seconds and
unable to do anything including packet processing.
Fix that by shifting that workaround to a separate thread by
alarm handler that will try to set up link if it is DOWN.

Fixes: c12d22f65b13 ("net/ixgbe: ensure link status is updated")
Cc: stable@dpdk.org
Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Reviewed-by: Qi Zhang <qi.z.zhang@intel.com>
Reviewed-by: Wei Zhao <wei.zhao1@intel.com>
6 years agonet/mlx5: enable loopback by configured mode
Dekel Peled [Thu, 1 Nov 2018 07:11:04 +0000 (09:11 +0200)]
net/mlx5: enable loopback by configured mode

Enable NIC loopback mode based on rte_eth_conf.lpbk_mode
configuration.

Signed-off-by: Dekel Peled <dekelp@mellanox.com>
Acked-by: Shahaf Shuler <shahafs@mellanox.com>
6 years agonet/mlx5: add caching of encap/decap actions
Dekel Peled [Thu, 1 Nov 2018 09:37:33 +0000 (11:37 +0200)]
net/mlx5: add caching of encap/decap actions

Make flow encap and decap Verbs actions cacheable resources.
Store created actions in local database.
This enables MLX5 PMD reuse of existing actions.

Signed-off-by: Dekel Peled <dekelp@mellanox.com>
Acked-by: Shahaf Shuler <shahafs@mellanox.com>
6 years agonet/mlx5: add raw data encap/decap to Direct Verbs
Dekel Peled [Thu, 1 Nov 2018 09:37:32 +0000 (11:37 +0200)]
net/mlx5: add raw data encap/decap to Direct Verbs

This patch implements the encap and decap actions, using raw data,
in DV flow for MLX5 PMD.

Signed-off-by: Dekel Peled <dekelp@mellanox.com>
Acked-by: Shahaf Shuler <shahafs@mellanox.com>
6 years agonet/mlx5: add NVGRE decap action to Direct Verbs
Dekel Peled [Thu, 1 Nov 2018 09:37:31 +0000 (11:37 +0200)]
net/mlx5: add NVGRE decap action to Direct Verbs

This patch implements the NVGRE decap action in DV flow for MLX5 PMD.

Signed-off-by: Dekel Peled <dekelp@mellanox.com>
Acked-by: Shahaf Shuler <shahafs@mellanox.com>
6 years agonet/mlx5: add NVGRE encap action to Direct Verbs
Dekel Peled [Thu, 1 Nov 2018 09:37:30 +0000 (11:37 +0200)]
net/mlx5: add NVGRE encap action to Direct Verbs

This patch implements the nvgre encap action in DV flow for MLX5 PMD.

Signed-off-by: Dekel Peled <dekelp@mellanox.com>
Acked-by: Shahaf Shuler <shahafs@mellanox.com>
6 years agonet/mlx5: add VXLAN decap action to Direct Verbs
Dekel Peled [Thu, 1 Nov 2018 09:37:29 +0000 (11:37 +0200)]
net/mlx5: add VXLAN decap action to Direct Verbs

This patch implements the VXLAN decap action in DV flow for MLX5 PMD.

Signed-off-by: Dekel Peled <dekelp@mellanox.com>
Acked-by: Shahaf Shuler <shahafs@mellanox.com>
6 years agonet/mlx5: add VXLAN encap action to Direct Verbs
Dekel Peled [Thu, 1 Nov 2018 09:37:28 +0000 (11:37 +0200)]
net/mlx5: add VXLAN encap action to Direct Verbs

This patch implements the VXLAN encap action in DV flow for MLX5 PMD.

Signed-off-by: Dekel Peled <dekelp@mellanox.com>
Acked-by: Shahaf Shuler <shahafs@mellanox.com>
6 years agonet/mlx5: add flow action functions to glue
Dekel Peled [Thu, 1 Nov 2018 09:37:27 +0000 (11:37 +0200)]
net/mlx5: add flow action functions to glue

This patch adds glue functions for operations:
- Create packet reformat (encap/decap) flow action.
- Destroy flow action.

The new operations depend on HAVE_IBV_FLOW_DV_SUPPORT.

Signed-off-by: Dekel Peled <dekelp@mellanox.com>
Acked-by: Yongseok Koh <yskoh@mellanox.com>
Acked-by: Shahaf Shuler <shahafs@mellanox.com>
6 years agonet: fix build with pedantic
Shahaf Shuler [Thu, 1 Nov 2018 12:46:45 +0000 (14:46 +0200)]
net: fix build with pedantic

The following error popped when compiling with -pedantic:

In file included from
 drivers/net/mlx5/mlx5_flow_dv.c:28:0:
 include/rte_gre.h:20:2:
 error: type of bit-field 'res2' is a GCC  extension [-Werror=pedantic]
 uint16_t res2:4; /**< Reserved */

Fixing by adding the __extension__ attribute.

Fixes: 894f71a3805d ("net: add GRE header structure")
Cc: stable@dpdk.org
Signed-off-by: Shahaf Shuler <shahafs@mellanox.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
6 years agonet/mlx5: fix validation of MLPS-in-GRE
Yongseok Koh [Tue, 30 Oct 2018 07:53:07 +0000 (07:53 +0000)]
net/mlx5: fix validation of MLPS-in-GRE

Multiple tunnel isn't allowed but MPLS over GRE should be accepted.

Fixes: 23c1d42c7138 ("net/mlx5: split flow validation to dedicated function")

Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
Acked-by: Shahaf Shuler <shahafs@mellanox.com>
6 years agonet/mlx5: add missing flow director delete
Yongseok Koh [Tue, 30 Oct 2018 07:51:27 +0000 (07:51 +0000)]
net/mlx5: add missing flow director delete

Deleting FDIR flow is not implemented by mistake. Also the name of static
functions are properly renamed.

Fixes: b42c000e37a8 ("net/mlx5: remove flow support")
Cc: stable@dpdk.org
Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
Acked-by: Shahaf Shuler <shahafs@mellanox.com>
6 years agonet/mlx5: fix memory leak on Direct Verbs error
Dekel Peled [Mon, 29 Oct 2018 16:09:10 +0000 (18:09 +0200)]
net/mlx5: fix memory leak on Direct Verbs error

Add freeing of allocated memory before exiting on mlx5dv error.

Fixes: fc2c498ccb94 ("net/mlx5: add Direct Verbs translate items")

Signed-off-by: Dekel Peled <dekelp@mellanox.com>
Acked-by: Yongseok Koh <yskoh@mellanox.com>
6 years agonet/virtio: fix guest announce support
Tiwei Bie [Mon, 29 Oct 2018 05:28:08 +0000 (13:28 +0800)]
net/virtio: fix guest announce support

We need to check the status field in virtio net config structure
instead of the bits read from ISR register to know whether we need
to do guest announce.

Fixes: 7365504f77e3 ("net/virtio: support guest announce")
Cc: stable@dpdk.org
Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
6 years agonet/virtio-user: simplify device features preparation
Tiwei Bie [Mon, 29 Oct 2018 05:28:07 +0000 (13:28 +0800)]
net/virtio-user: simplify device features preparation

Get rid of the duplicated code in device features preparation
which looks awful.

Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
6 years agonet/virtio-user: fix device features for server mode
Tiwei Bie [Mon, 29 Oct 2018 05:28:06 +0000 (13:28 +0800)]
net/virtio-user: fix device features for server mode

We need to save the supported frontend features (which won't be
announced by vhost backend), otherwise we will lost them when the
connection to vhost-user backend is established in server mode.

Fixes: 201a41651715 ("net/virtio-user: fix multiple queues fail in server mode")
Cc: stable@dpdk.org
Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
6 years agonet/virtio-user: do not reset owner when driver resets
Tiwei Bie [Mon, 29 Oct 2018 05:28:05 +0000 (13:28 +0800)]
net/virtio-user: do not reset owner when driver resets

When driver resets the device, virtio-user just needs to send
GET_VRING_BASE messages to stop the vhost backend, and that's
what QEMU does. With this change, we won't need to set owner
when starting virtio-user device anymore. This will help us to
get rid of below error message on startup:

vhost_kernel_ioctl(): VHOST_SET_OWNER failed: Device or resource busy

Fixes: bce7e9050f9b ("net/virtio-user: fix start with kernel vhost")
Fixes: 0d6a8752ac9d ("net/virtio-user: fix crash as features change")
Cc: stable@dpdk.org
Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
6 years agonet/virtio-user: do not make vhost channel non-block
Tiwei Bie [Mon, 29 Oct 2018 05:28:04 +0000 (13:28 +0800)]
net/virtio-user: do not make vhost channel non-block

There is no need to make the vhost user channel nonblock, and
making it nonblock will make vhost_user_read() fail with EAGAIN
when vhost messages need a reply.

Fixes: bd8f50a45d0f ("net/virtio-user: support server mode")
Cc: stable@dpdk.org
Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
6 years agonet/virtio-user: do not stop stopped device again
Tiwei Bie [Mon, 29 Oct 2018 05:28:03 +0000 (13:28 +0800)]
net/virtio-user: do not stop stopped device again

Without this change, virtio-user still works, but it will show
annoying error messages like this on shutdown:

vhost_kernel_set_backend(): VHOST_NET_SET_BACKEND fails, Operation not permitted
vhost_kernel_ioctl(): VHOST_RESET_OWNER failed: Operation not permitted

Fixes: e3b434818bbb ("net/virtio-user: support kernel vhost")
Fixes: 12ecb2f63b12 ("net/virtio-user: support memory hotplug")
Cc: stable@dpdk.org
Reported-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
6 years agonet/vhost: fix parameters string
Tiwei Bie [Thu, 25 Oct 2018 09:46:59 +0000 (17:46 +0800)]
net/vhost: fix parameters string

Add the missing params to the param string.

Fixes: 39cac2adcad0 ("net/vhost: add client option")
Fixes: 4ce97c6f6b4f ("net/vhost: add an option to enable dequeue zero copy")
Fixes: 447e0d379756 ("net/vhost: add parameter to enable IOMMU feature")
Fixes: 6d6e95cec455 ("net/vhost: add parameter to enable postcopy")
Cc: stable@dpdk.org
Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
6 years agonet/virtio: drop duplicated reset method
Tiwei Bie [Thu, 25 Oct 2018 09:46:58 +0000 (17:46 +0800)]
net/virtio: drop duplicated reset method

Drop the duplicated reset() method in virtio_pci_ops. Currently
vtpci_reset() is implemented on set_status() and get_status()
directly. The reset() method in virtio_pci_ops isn't used and
its implementation in the legacy device isn't right.

Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
6 years agonet/mlx5: add 128B padding of Rx completion entry
Yongseok Koh [Thu, 25 Oct 2018 06:24:00 +0000 (06:24 +0000)]
net/mlx5: add 128B padding of Rx completion entry

A PMD parameter (rxq_cqe_pad_en) is added to enable 128B padding of CQE on
RX side. The size of CQE is aligned with the size of a cacheline of the
core. If cacheline size is 128B, the CQE size is configured to be 128B even
though the device writes only 64B data on the cacheline. This is to avoid
unnecessary cache invalidation by device's two consecutive writes on to one
cacheline. However in some architecture, it is more beneficial to update
entire cacheline with padding the rest 64B rather than striding because
read-modify-write could drop performance a lot. On the other hand, writing
extra data will consume more PCIe bandwidth and could also drop the maximum
throughput. It is recommended to empirically set this parameter. Disabled
by default.

Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
Acked-by: Shahaf Shuler <shahafs@mellanox.com>
6 years agonet/mlx5: fix flow counters deletion in Verbs
Viacheslav Ovsiienko [Sat, 27 Oct 2018 10:54:21 +0000 (10:54 +0000)]
net/mlx5: fix flow counters deletion in Verbs

The Flow counters created with Verbs are erroneously destroyed
in Flow remove function (flow_verbs_remove()). Counter Verbs
handles stored in the translated rule buffer become invalid.
If rule is reapplied with these invalid counter handles the
driver hangs.

The counter should be destroyed with Verbs in the Flow destroy
function. The Flow remove function should keep counters intact.

Fixes: 60bd8c9747e8 ("net/mlx5: add count flow action")
Cc: stable@dpdk.org
Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
Acked-by: Shahaf Shuler <shahafs@mellanox.com>
6 years agonet/mlx5: fix detection and error for multiple item layers
Shahaf Shuler [Thu, 25 Oct 2018 08:53:51 +0000 (11:53 +0300)]
net/mlx5: fix detection and error for multiple item layers

1. The check for the Eth item was wrong. causing an error with
flow rules like:

flow create 0 ingress pattern eth / vlan vid is 13 / ipv4 / gre / eth /
vlan vid is 15 / end actions drop / end

2. align all error messages.

3. align multiple item layers check.

Fixes: 23c1d42c7138 ("net/mlx5: split flow validation to dedicated function")

Signed-off-by: Shahaf Shuler <shahafs@mellanox.com>
Acked-by: Yongseok Koh <yskoh@mellanox.com>
6 years agonet/mlx5: fix bit width of flow items
Shahaf Shuler [Thu, 25 Oct 2018 08:53:50 +0000 (11:53 +0300)]
net/mlx5: fix bit width of flow items

Apply the changes from commit c744f6b1b969 ("net/mlx5: fix bit width of
item and action flags") in some places that were overlooked.

Fixes: 0ddd11437a9a ("net/mlx5: fix bit width of item and action flags")
Fixes: 23c1d42c7138 ("net/mlx5: split flow validation to dedicated function")

Signed-off-by: Shahaf Shuler <shahafs@mellanox.com>
Acked-by: Yongseok Koh <yskoh@mellanox.com>
6 years agonet/mlx5: use pkg-config to handle SUSE libmnl
Stephen Hemminger [Thu, 25 Oct 2018 20:29:38 +0000 (13:29 -0700)]
net/mlx5: use pkg-config to handle SUSE libmnl

SUSE decided to install the libmnl include file in a non-standard
place: /usr/include/libmnl/libmnl/libmnl.h

This was probably a mistake by the SUSE package maintainer,
but hard to get fixed. Workaround the problem by pkg-config to find
the necessary include directive for libmnl.

Fixes: 20b71e92ef8e ("net/mlx5: lay groundwork for switch offloads")
Cc: stable@dpdk.org
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Yongseok Koh <yskoh@mellanox.com>
Acked-by: Luca Boccassi <bluca@debian.org>
6 years agonet/i40e: fix offload not supported mask
Xiaolong Ye [Fri, 26 Oct 2018 06:33:14 +0000 (14:33 +0800)]
net/i40e: fix offload not supported mask

Just as the name I40E_TX_OFFLOAD_NOTSUP_MASK indicates, it should be the
mask of unsupported features (either not in PKT_TX_OFFLOAD_MASK or in
I40E_TX_OFFLOAD_MASK), however, xor will not get desired result here,
assume bit 0 of PKT_TX_OFFLOAD_MASK and I40E_TX_OFFLOAD_MAKS are 0 which
means corresponding feature is not supported in both sides, then we get
value of bit 0 of I40E_TX_OFFLOAD_NOTSUP_MASK which is 0 via xor, it
implies that it is supported which doesn't meet our expectation.

Correct it by a NOT-AND operation.

Fixes: 3f33e643e5c6 ("net/i40e: add Tx preparation")
Cc: stable@dpdk.org
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
6 years agonet/ixgbe: enable detach from secondary
Qi Zhang [Thu, 25 Oct 2018 02:48:57 +0000 (10:48 +0800)]
net/ixgbe: enable detach from secondary

Since we have enabled the hotplug mechanism for multi-process, it's not
necessary to return -EPERM when try detaches a device from a secondary
process.

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
6 years agoexamples/fips_validation: fix build
Thomas Monjalon [Mon, 5 Nov 2018 17:37:21 +0000 (18:37 +0100)]
examples/fips_validation: fix build

The example was not added to the Makefile and there are some
compilation errors:

examples/fips_validation/main.c: In function ‘prepare_aead_op’:
error: control reaches end of non-void function
examples/fips_validation/main.c: In function ‘prepare_auth_op’:
error: control reaches end of non-void function

Fixes: 3d0fad56b74a ("examples/fips_validation: add crypto FIPS application")
Fixes: f64adb6714e0 ("examples/fips_validation: support HMAC parsing")
Fixes: 4aaad2995e13 ("examples/fips_validation: support GCM parsing")

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
Tested-by: Ferruh Yigit <ferruh.yigit@intel.com>
6 years agoring/c11: move atomic load of head above the loop
Gavin Hu [Fri, 2 Nov 2018 11:21:28 +0000 (19:21 +0800)]
ring/c11: move atomic load of head above the loop

In __rte_ring_move_prod_head, move the __atomic_load_n up and out of
the do {} while loop as upon failure the old_head will be updated,
another load is costly and not necessary.

This helps a little on the latency,about 1~5%.

 Test result with the patch(two cores):
 SP/SC bulk enq/dequeue (size: 8): 5.64
 MP/MC bulk enq/dequeue (size: 8): 9.58
 SP/SC bulk enq/dequeue (size: 32): 1.98
 MP/MC bulk enq/dequeue (size: 32): 2.30

Fixes: 39368ebfc606 ("ring: introduce C11 memory model barrier option")
Cc: stable@dpdk.org
Signed-off-by: Gavin Hu <gavin.hu@arm.com>
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
Reviewed-by: Steve Capper <steve.capper@arm.com>
Reviewed-by: Ola Liljedahl <ola.liljedahl@arm.com>
Reviewed-by: Jia He <justin.he@arm.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Tested-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
6 years agoring/c11: synchronize load and store of the tail
Gavin Hu [Fri, 2 Nov 2018 11:21:27 +0000 (19:21 +0800)]
ring/c11: synchronize load and store of the tail

Synchronize the load-acquire of the tail and the store-release
within update_tail, the store release ensures all the ring operations,
enqueue or dequeue, are seen by the observers on the other side as soon
as they see the updated tail. The load-acquire is needed here as the
data dependency is not a reliable way for ordering as the compiler might
break it by saving to temporary values to boost performance.
When computing the free_entries and avail_entries, use atomic semantics
to load the heads and tails instead.

The patch was benchmarked with test/ring_perf_autotest and it decreases
the enqueue/dequeue latency by 5% ~ 27.6% with two lcores, the real gains
are dependent on the number of lcores, depth of the ring, SPSC or MPMC.
For 1 lcore, it also improves a little, about 3 ~ 4%.
It is a big improvement, in case of MPMC, with two lcores and ring size
of 32, it saves latency up to (3.26-2.36)/3.26 = 27.6%.

This patch is a bug fix, while the improvement is a bonus. In our analysis
the improvement comes from the cacheline pre-filling after hoisting load-
acquire from _atomic_compare_exchange_n up above.

The test command:
$sudo ./test/test/test -l 16-19,44-47,72-75,100-103 -n 4 --socket-mem=\
1024 -- -i

Test result with this patch(two cores):
 SP/SC bulk enq/dequeue (size: 8): 5.86
 MP/MC bulk enq/dequeue (size: 8): 10.15
 SP/SC bulk enq/dequeue (size: 32): 1.94
 MP/MC bulk enq/dequeue (size: 32): 2.36

In comparison of the test result without this patch:
 SP/SC bulk enq/dequeue (size: 8): 6.67
 MP/MC bulk enq/dequeue (size: 8): 13.12
 SP/SC bulk enq/dequeue (size: 32): 2.04
 MP/MC bulk enq/dequeue (size: 32): 3.26

Fixes: 39368ebfc6 ("ring: introduce C11 memory model barrier option")
Cc: stable@dpdk.org
Signed-off-by: Gavin Hu <gavin.hu@arm.com>
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
Reviewed-by: Steve Capper <steve.capper@arm.com>
Reviewed-by: Ola Liljedahl <ola.liljedahl@arm.com>
Reviewed-by: Jia He <justin.he@arm.com>
Acked-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Tested-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
6 years agoexamples/fips_validation: support CCM parsing
Marko Kovacevic [Fri, 2 Nov 2018 09:55:34 +0000 (09:55 +0000)]
examples/fips_validation: support CCM parsing

Added enablement for CCM parser, to allow the
application to parser the ccm request files and to validate all
test types supported.

Signed-off-by: Marko Kovacevic <marko.kovacevic@intel.com>
Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
Acked-by: Arek Kusztal <arkadiuszx.kusztal@intel.com>
Reviewed-by: Akhil Goyal <akhil.goyal@nxp.com>
6 years agoexamples/fips_validation: support CMAC parsing
Marko Kovacevic [Fri, 2 Nov 2018 09:55:33 +0000 (09:55 +0000)]
examples/fips_validation: support CMAC parsing

Added enablement for CMAC parser, to allow the
application to parser the cmac request files and to validate all
test types supported.

Signed-off-by: Marko Kovacevic <marko.kovacevic@intel.com>
Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
Acked-by: Arek Kusztal <arkadiuszx.kusztal@intel.com>
Reviewed-by: Akhil Goyal <akhil.goyal@nxp.com>
6 years agoexamples/fips_validation: support GCM parsing
Marko Kovacevic [Fri, 2 Nov 2018 09:55:32 +0000 (09:55 +0000)]
examples/fips_validation: support GCM parsing

Added enablement for GCM parser, to allow the
application to parser the GCM request file and to validate all
tests supported.

Signed-off-by: Marko Kovacevic <marko.kovacevic@intel.com>
Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
Acked-by: Arek Kusztal <arkadiuszx.kusztal@intel.com>
Reviewed-by: Akhil Goyal <akhil.goyal@nxp.com>
6 years agoexamples/fips_validation: support TDES parsing
Marko Kovacevic [Fri, 2 Nov 2018 09:55:31 +0000 (09:55 +0000)]
examples/fips_validation: support TDES parsing

Added enablement for TDES parser, to allow the
application to parser the TDES request files and to validate all
test types supported.

Signed-off-by: Marko Kovacevic <marko.kovacevic@intel.com>
Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
Acked-by: Arek Kusztal <arkadiuszx.kusztal@intel.com>
Reviewed-by: Akhil Goyal <akhil.goyal@nxp.com>
6 years agoexamples/fips_validation: support HMAC parsing
Marko Kovacevic [Fri, 2 Nov 2018 09:55:30 +0000 (09:55 +0000)]
examples/fips_validation: support HMAC parsing

Added enablement for HMAC parser, to allow the
application to parser the hmac request files and to validate all
tests supported

Signed-off-by: Marko Kovacevic <marko.kovacevic@intel.com>
Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
Acked-by: Arek Kusztal <arkadiuszx.kusztal@intel.com>
Reviewed-by: Akhil Goyal <akhil.goyal@nxp.com>
6 years agoexamples/fips_validation: support AES parsing
Marko Kovacevic [Fri, 2 Nov 2018 09:55:29 +0000 (09:55 +0000)]
examples/fips_validation: support AES parsing

Added enablement for AES-CBC parser, to allow the
application to parser the aes request file and to validate all
test types supported.

Signed-off-by: Marko Kovacevic <marko.kovacevic@intel.com>
Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
Acked-by: Arek Kusztal <arkadiuszx.kusztal@intel.com>
Reviewed-by: Akhil Goyal <akhil.goyal@nxp.com>
6 years agoexamples/fips_validation: add crypto FIPS application
Marko Kovacevic [Fri, 2 Nov 2018 09:55:28 +0000 (09:55 +0000)]
examples/fips_validation: add crypto FIPS application

Added FIPS application into the examples to allow
users to use a simple sample app to validate
their systems and be able to get FIPS certification.

Signed-off-by: Marko Kovacevic <marko.kovacevic@intel.com>
Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
Acked-by: Arek Kusztal <arkadiuszx.kusztal@intel.com>
Reviewed-by: Akhil Goyal <akhil.goyal@nxp.com>
6 years agocompress/isal: fix uncleared compression states
Lee Daly [Thu, 1 Nov 2018 11:48:19 +0000 (11:48 +0000)]
compress/isal: fix uncleared compression states

Fixing uncleared states of compression & decompression engines post op.

Fixes: 788e748d3845 ("compress/isal: support chained mbufs")
Fixes: dc49e6aa4879 ("compress/isal: add ISA-L compression functionality")
Fixes: 7bf4f0630af6 ("compress/isal: add ISA-L decomp functionality")
Cc: stable@dpdk.org
Signed-off-by: Lee Daly <lee.daly@intel.com>
6 years agocompress/qat: add log for IM buffer too small
Fiona Trahe [Wed, 31 Oct 2018 21:46:57 +0000 (21:46 +0000)]
compress/qat: add log for IM buffer too small

Display trace if error returned from firmware is likely due
to intermediate buffers being too small for the compressed
output. Update documentation to explain this error case
and to clarify intermediate buffer memory usage.

Signed-off-by: Fiona Trahe <fiona.trahe@intel.com>
Acked-by: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
6 years agotest/compress: improve debug logs
Fiona Trahe [Wed, 31 Oct 2018 00:42:06 +0000 (00:42 +0000)]
test/compress: improve debug logs

Make clear which engine is compressing and which is decompressing
in debug output. Also add newline and print ratio = 0 if test fails.

Signed-off-by: Fiona Trahe <fiona.trahe@intel.com>
Acked-by: Lee Daly <lee.daly@intel.com>
Acked-by: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
6 years agocompress/qat: fix out-of-bounds write
Fiona Trahe [Wed, 31 Oct 2018 00:39:54 +0000 (00:39 +0000)]
compress/qat: fix out-of-bounds write

QAT array for sgls in intermediate buffer structure
was #defined to 1, but setup code hardcoded as if 2 buffers
so causing out of bounds write. Reworked to loop correctly
using #define.

Fixes: a124830a6f00 ("compress/qat: enable dynamic huffman encoding")

Reported-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Signed-off-by: Fiona Trahe <fiona.trahe@intel.com>
Tested-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
6 years agocrypto/caam_jr: fix check before job ring freeing
Gagandeep Singh [Mon, 29 Oct 2018 12:15:51 +0000 (12:15 +0000)]
crypto/caam_jr: fix check before job ring freeing

Check should be on parameter uio_fd instead of
local variable job_ring

Fixes: e7a45f3cc2 ("crypto/caam_jr: add UIO specific operations")

Reported-by: Ferruh Yigit <ferruh.yigit@intel.com>
Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
6 years agocompressdev: fix op allocation
Fiona Trahe [Sat, 27 Oct 2018 00:43:07 +0000 (01:43 +0100)]
compressdev: fix op allocation

Fixed bad logic in rte_comp_op_alloc() checking return
value from rte_comp_op_raw_bulk_alloc(). This
could have resulted in a seg-fault in error case.
Made rte_comp_ob_bulk_alloc() code consistent
with rte_comp_op_alloc().

Fixes: 96086db5a369 ("compressdev: add operation management")
Cc: stable@dpdk.org
Reported-by: Sabyasachi Sengupta <sabyasg@hpe.com>
Signed-off-by: Fiona Trahe <fiona.trahe@intel.com>
Acked-by: Shally Verma <shally.verma@caviumnetworks.com>
6 years agocompressdev: clarify usage of op structure
Fiona Trahe [Sat, 27 Oct 2018 00:13:54 +0000 (01:13 +0100)]
compressdev: clarify usage of op structure

Add note on usage of op structure and when it can be
accessed and freed.

Fixes: 63f4bfd5328b ("compressdev: add enqueue/dequeue functions")
Cc: stable@dpdk.org
Signed-off-by: Fiona Trahe <fiona.trahe@intel.com>
Acked-by: Shally Verma <shally.verma@caviumnetworks.com>
6 years agotest/crypto: remove redundant RSA verification
Akash Saxena [Thu, 25 Oct 2018 10:01:01 +0000 (10:01 +0000)]
test/crypto: remove redundant RSA verification

Change unit test app to check only for op->status =
RTE_CRYPTO_OP_STATUS_SUCCESS/ERROR instead of calling rsa_verify().
as the cryptodev API is expected to return error incase of data
mismatch.

Signed-off-by: Ayuj Verma <ayuj.verma@caviumnetworks.com>
Signed-off-by: Akash Saxena <akash.saxena@caviumnetworks.com>
Signed-off-by: Shally Verma <shally.verma@caviumnetworks.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
6 years agocrypto/openssl: fix RSA verify operation
Akash Saxena [Thu, 25 Oct 2018 10:00:56 +0000 (10:00 +0000)]
crypto/openssl: fix RSA verify operation

In lib cryptodev, RSA verify operation inputs plain message text and
corresponding signature and expected to return
RTE_CRYPTO_OP_STATUS_SUCCESS/FAILURE on a signature match/mismatch.
Current OpenSSL PMD RSA verify implementation overrides application passed
sign input by decrypted output which isn't expected.

This patch addresses this issue in OpenSSL PMD. Now, OpenSSL PMD use
tmp buffer to pass to OpenSSL sign API and memcmp output with
original plain text to verify signature match.
Set op->status = RTE_CRYPTO_OP_STATUS_ERROR on signature mismatch.

Fixes: 3e9d6bd447fb ("crypto/openssl: add RSA and mod asym operations")
Cc: stable@dpdk.org
Signed-off-by: Ayuj Verma <ayuj.verma@caviumnetworks.com>
Signed-off-by: Akash Saxena <akash.saxena@caviumnetworks.com>
Signed-off-by: Shally Verma <shally.verma@caviumnetworks.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
6 years agoexamples/ip_pipeline: fix port and table stats read
Cristian Dumitrescu [Tue, 30 Oct 2018 18:44:09 +0000 (18:44 +0000)]
examples/ip_pipeline: fix port and table stats read

Fix the pipeline port and table stats read operation.

Fixes: 50e73d051806 ("examples/ip_pipeline: add stats read commands")
Cc: stable@dpdk.org
Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
Signed-off-by: Hongjun Ni <hongjun.ni@intel.com>
6 years agoexamples/ip_pipeline: support table rule show
Cristian Dumitrescu [Tue, 30 Oct 2018 18:40:41 +0000 (18:40 +0000)]
examples/ip_pipeline: support table rule show

Add support for the table rule show operation.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
6 years agoexamples/ip_pipeline: support rule time read
Cristian Dumitrescu [Tue, 30 Oct 2018 18:36:55 +0000 (18:36 +0000)]
examples/ip_pipeline: support rule time read

Add support for the table rule timestamp read operation.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
6 years agoexamples/ip_pipeline: support rule TTL stats read
Cristian Dumitrescu [Tue, 30 Oct 2018 18:28:48 +0000 (18:28 +0000)]
examples/ip_pipeline: support rule TTL stats read

Add support for the table rule TTL stats read operation.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
6 years agoexamples/ip_pipeline: support meter stats read
Cristian Dumitrescu [Tue, 30 Oct 2018 18:25:41 +0000 (18:25 +0000)]
examples/ip_pipeline: support meter stats read

Add support for the rule meter stats read operation.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
6 years agoexamples/ip_pipeline: support rule stats read
Cristian Dumitrescu [Tue, 30 Oct 2018 18:21:37 +0000 (18:21 +0000)]
examples/ip_pipeline: support rule stats read

Add support for rule stats read operation.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
6 years agoexamples/ip_pipeline: track rules on delete default
Cristian Dumitrescu [Tue, 30 Oct 2018 18:14:46 +0000 (18:14 +0000)]
examples/ip_pipeline: track rules on delete default

Support table rule tracking on table rule delete default operation.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
6 years agoexamples/ip_pipeline: track table rules on delete
Cristian Dumitrescu [Tue, 30 Oct 2018 18:12:41 +0000 (18:12 +0000)]
examples/ip_pipeline: track table rules on delete

Support table rule tracking on table rule delete operation.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
Signed-off-by: Hongjun Ni <hongjun.ni@intel.com>
6 years agoexamples/ip_pipeline: track rules on add default
Cristian Dumitrescu [Tue, 30 Oct 2018 18:09:35 +0000 (18:09 +0000)]
examples/ip_pipeline: track rules on add default

Support table rule tracking on table rule add default operation.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
6 years agoexamples/ip_pipeline: track table rules on add bulk
Cristian Dumitrescu [Tue, 30 Oct 2018 18:04:09 +0000 (18:04 +0000)]
examples/ip_pipeline: track table rules on add bulk

Support table rule tracking on table rule add bulk operation.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
6 years agoexamples/ip_pipeline: track table rules on add
Cristian Dumitrescu [Tue, 30 Oct 2018 17:45:20 +0000 (17:45 +0000)]
examples/ip_pipeline: track table rules on add

Support table rule tracking on table rule add operation.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
Signed-off-by: Hongjun Ni <hongjun.ni@intel.com>
6 years agoexamples/ip_pipeline: add rule list per table
Cristian Dumitrescu [Tue, 30 Oct 2018 17:36:41 +0000 (17:36 +0000)]
examples/ip_pipeline: add rule list per table

For each pipeline table, have the master thread maintain the list of
rules that are currently stored in the table. This list allows the
master thread to handle table queries with minimal impact for the
data plane threads: requests to read the current set of table rules
are fully handled by the master thread with no involvement from
data plane threads, requests to read the per table rule moving data
(such as stats counters or timestamp associated with specific
actions) are handled by the data plane threads through plain memory
reads rather than key lookup.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
Signed-off-by: Hongjun Ni <hongjun.ni@intel.com>
6 years agonet/softnic: fix string copy
Reshma Pattan [Wed, 31 Oct 2018 10:16:59 +0000 (10:16 +0000)]
net/softnic: fix string copy

Use strlcpy instead of strcpy to avoid buffer overrun.

Coverity issues: 323475,323478,323514,323515
Fixes: b767f8efc8 ("net/softnic: replace pointers with arrays")
Fixes: c169b6a588 ("net/softnic: map flow attribute to pipeline table")

Signed-off-by: Reshma Pattan <reshma.pattan@intel.com>
6 years agonet/softnic: fix mixing enum values
Jasvinder Singh [Wed, 31 Oct 2018 11:58:22 +0000 (11:58 +0000)]
net/softnic: fix mixing enum values

Fix mixing enum types enum rte_table_action_policer
and enum rte_mtr_policer_action for dereference of
policer action.

Coverity issue 323483, 323511
Fixes: 7e30e444c3e4 ("net/softnic: support flow meter action")
Fixes: 8a917ef88db7 ("net/softnic: update policer actions")

Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
6 years agodoc: add policer table details for metering application
Vipin Varghese [Tue, 30 Oct 2018 03:56:15 +0000 (09:26 +0530)]
doc: add policer table details for metering application

The change adds note for previous colour in colour blind and DROP
in profile table actions. In colour blind mode only valid previous
colour is GREEN. To drop packets based on new colour one needs to
set action as DROP in profile table.

Signed-off-by: Vipin Varghese <vipin.varghese@intel.com>
6 years agoapp/testpmd: fix RED byte stats
Leah Tekoa [Thu, 25 Oct 2018 06:05:14 +0000 (06:05 +0000)]
app/testpmd: fix RED byte stats

Y stands for Yellow, R stands for Red.

Fixes: 30ffb4e67ee3 ("app/testpmd: add commands traffic metering and policing")
Cc: stable@dpdk.org
Signed-off-by: Leah Tekoa <leah@ethernitynet.com>
6 years agoapp/testpmd: fix shaper profile parameters
Rosen Xu [Mon, 22 Oct 2018 08:46:40 +0000 (16:46 +0800)]
app/testpmd: fix shaper profile parameters

As struct rte_tm_shaper_params defined, the command line of
testpmd should include committed and peak parameters, but
right now the command line doesn't identify whether it's
committed or peak parameter. This patch identifies and
adds the clarify definition

Fixes: bddc2f40b594 ("app/testpmd: add commands for shaper and wred profiles")
Cc: stable@dpdk.org
Signed-off-by: Rosen Xu <rosen.xu@intel.com>
6 years agomem: add thread unsafe version for DMA mask check
Alejandro Lucero [Thu, 1 Nov 2018 19:53:30 +0000 (19:53 +0000)]
mem: add thread unsafe version for DMA mask check

During memory initialization calling rte_mem_check_dma_mask
leads to a deadlock because memory_hotplug_lock is locked by a
writer, the current code in execution, and rte_memseg_walk
tries to lock as a reader.

This patch adds a thread_unsafe version which will call the final
function specifying the memory_hotplug_lock does not need to be
acquired. The patch also modified rte_mem_check_dma_mask as a
intermediate step which will call the final function as before,
implying memory_hotplug_lock will be acquired.

PMDs should always use the version acquiring the lock with the
thread_unsafe one being just for internal EAL memory code.

Fixes: 223b7f1d5ef6 ("mem: add function for checking memseg IOVA")

Signed-off-by: Alejandro Lucero <alejandro.lucero@netronome.com>
Tested-by: Ferruh Yigit <ferruh.yigit@intel.com>
6 years agomem: use DMA mask check for legacy memory
Alejandro Lucero [Thu, 1 Nov 2018 19:53:29 +0000 (19:53 +0000)]
mem: use DMA mask check for legacy memory

If a device reports addressing limitations through a dma mask,
the IOVAs for mapped memory needs to be checked out for ensuring
correct functionality.

Previous patches introduced this DMA check for main memory code
currently being used but other options like legacy memory and the
no hugepages option need to be also considered.

This patch adds the DMA check for those cases.

Signed-off-by: Alejandro Lucero <alejandro.lucero@netronome.com>
Tested-by: Ferruh Yigit <ferruh.yigit@intel.com>
6 years agomalloc: modify error message for DMA mask check
Alejandro Lucero [Thu, 1 Nov 2018 19:53:28 +0000 (19:53 +0000)]
malloc: modify error message for DMA mask check

If DMA mask checks shows mapped memory out of the supported range
specified by the DMA mask, nothing can be done but return an error
an report the error. This can imply the app not being executed at
all or precluding dynamic memory allocation once the app is running.
In any case, we can advice the user to force IOVA as PA if currently
IOVA being VA and user being root.

Signed-off-by: Alejandro Lucero <alejandro.lucero@netronome.com>
Tested-by: Ferruh Yigit <ferruh.yigit@intel.com>
6 years agobus/pci: avoid call to DMA mask check
Alejandro Lucero [Thu, 1 Nov 2018 19:53:27 +0000 (19:53 +0000)]
bus/pci: avoid call to DMA mask check

Calling rte_mem_check_dma_mask when memory has not been initialized
yet is wrong. This patch use rte_mem_set_dma_mask instead.

Once memory initialization is done, the dma mask set will be used
for checking memory mapped is within the specified mask.

Fixes: fe822eb8c565 ("bus/pci: use IOVA DMA mask check when setting IOVA mode")

Signed-off-by: Alejandro Lucero <alejandro.lucero@netronome.com>
Tested-by: Ferruh Yigit <ferruh.yigit@intel.com>
6 years agomem: add function for setting DMA mask
Alejandro Lucero [Thu, 1 Nov 2018 19:53:26 +0000 (19:53 +0000)]
mem: add function for setting DMA mask

This patch adds the possibility of setting a dma mask to be used
once the memory initialization is done.

This is currently needed when IOVA mode is set by PCI related
code and an x86 IOMMU hardware unit is present. Current code calls
rte_mem_check_dma_mask but it is wrong to do so at that point
because the memory has not been initialized yet.

Signed-off-by: Alejandro Lucero <alejandro.lucero@netronome.com>
Tested-by: Ferruh Yigit <ferruh.yigit@intel.com>
6 years agomem: rename DMA mask check with proper prefix
Alejandro Lucero [Thu, 1 Nov 2018 19:53:25 +0000 (19:53 +0000)]
mem: rename DMA mask check with proper prefix

Current name rte_eal_check_dma_mask does not follow the naming
used in the rest of the file.

Signed-off-by: Alejandro Lucero <alejandro.lucero@netronome.com>
Tested-by: Ferruh Yigit <ferruh.yigit@intel.com>
6 years agomalloc: fix DMA mask check
Alejandro Lucero [Thu, 1 Nov 2018 19:53:24 +0000 (19:53 +0000)]
malloc: fix DMA mask check

The param needs to be the maskbits and not the mask.

Fixes: 223b7f1d5ef6 ("mem: add function for checking memseg IOVA")

Signed-off-by: Alejandro Lucero <alejandro.lucero@netronome.com>
Tested-by: Ferruh Yigit <ferruh.yigit@intel.com>
6 years agodoc: fix PDF build
Marko Kovacevic [Fri, 2 Nov 2018 13:38:08 +0000 (13:38 +0000)]
doc: fix PDF build

PDF build was failing in the howto guides
found the weird character causing the issue

Fixes: 6e9270eab112 ("doc: add telemetry how-to")

Signed-off-by: Marko Kovacevic <marko.kovacevic@intel.com>
Tested-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: John McNamara <john.mcnamara@intel.com>
6 years agoeal: fix build with gcc 9.0
Ferruh Yigit [Fri, 2 Nov 2018 19:06:06 +0000 (19:06 +0000)]
eal: fix build with gcc 9.0

build error:
In function ‘eal_plugin_add’,
    .../lib/librte_eal/common/eal_common_options.c:225:2:
    error: ‘strncpy’ output may be truncated copying 4095 bytes from a
           string of length 4095 [-Werror=stringop-truncation]
    strncpy(solib->name, path, PATH_MAX-1);

strncpy may result a not null-terminated string,
replaced it with strlcpy

Fixes: f9a08f650211 ("eal: add support for shared object drivers")
Cc: stable@dpdk.org
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
6 years agobus/dpaa: fix build with gcc 9.0
Ferruh Yigit [Fri, 2 Nov 2018 19:06:05 +0000 (19:06 +0000)]
bus/dpaa: fix build with gcc 9.0

build error:
In function ‘fman_if_init’,
    .../drivers/bus/dpaa/base/fman/fman.c:186:2:
    error: ‘strncpy’ output may be truncated copying 4095 bytes from a
           string of length 4095 [-Werror=stringop-truncation]
    strncpy(__if->node_path, dpa_node->full_name, PATH_MAX - 1);

strncpy may result a not null-terminated string,
replaced it with strlcpy

Fixes: 5b22cf744689 ("bus/dpaa: introducing FMan configurations")
Cc: stable@dpdk.org
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
6 years agocrypto/scheduler: fix build with gcc 8.2
Jerin Jacob [Sat, 3 Nov 2018 14:58:53 +0000 (14:58 +0000)]
crypto/scheduler: fix build with gcc 8.2

build_error:

drivers/crypto/scheduler/scheduler_pmd.c: In function ‘parse_name_arg’:
drivers/crypto/scheduler/scheduler_pmd.c:372:2: error: ‘strncpy’
specified bound 64 equals destination size [-Werror=stringop-truncation]
  strncpy(params->name, value, RTE_CRYPTODEV_NAME_MAX_LEN);
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
strncpy may result a not null-terminated string,
replaced it with strlcpy

Fixes: 503e9c5afb38 ("crypto/scheduler: register as vdev driver")
Cc: stable@dpdk.org
Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
6 years agoeal: fix error string function
Jerin Jacob [Fri, 2 Nov 2018 08:11:23 +0000 (08:11 +0000)]
eal: fix error string function

errno_autotest testcase were failed since
commit 5d7b673d5fd6 ("mk: build with _GNU_SOURCE defined by default")
RTE>>errno_autotest
rte_strerror: 'Unknown error 11',
strerror: 'Resource temporarily unavailable'
Test Failed

There are two different version of strerror_t() based on
_GNU_SOURCE definition.

/* XSI-compliant */
int strerror_r(int errnum, char *buf, size_t buflen);

/* GNU-specific */
char *strerror_r(int errnum, char *buf, size_t buflen);

Since the GNU-specific version returns char* the exiting "if"
condition around the strerror_r fails.

Switching back to XSI-compliant version to allow

a) Portable strerror_r() usage as musl c library uses
non GNU speficic version
https://git.musl-libc.org/cgit/musl/tree/src/string/strerror_r.c

b) Based on strerror_r(3) man page, it is possible that GNU-specific
version need not use char *buf to fill error message instead it
can use the immutable static string from the library and return it.

note from strerror_r(3) man page:

The GNU-specific strerror_r() returns a pointer to a string containing
the error message.  This may be either a pointer to a string that the
function stores in buf, or a pointer to some (immutable)
static string (in which case buf is unused).

Fixes: 5d7b673d5fd6 ("mk: build with _GNU_SOURCE defined by default")

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
6 years agomk: disable gcc AVX512F support
Yongseok Koh [Sat, 3 Nov 2018 01:06:32 +0000 (01:06 +0000)]
mk: disable gcc AVX512F support

This is a workaround to prevent a crash, which might be caused by
optimization of newer gcc (7.3.0) on Intel Skylake.

This disables AVX512F support of gcc by adding -mno-avx512f if it is
disabled in DPDK (CONFIG_RTE_ENABLE_AVX512=n).

This does not apply to the meson build as that doesn't have such an option
but always enable AVX512F whenever supported.

Bugzilla ID: 97
Cc: stable@dpdk.org
Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
6 years agoexamples/vm_power: respect maximum CPUs
David Hunt [Wed, 31 Oct 2018 11:50:32 +0000 (11:50 +0000)]
examples/vm_power: respect maximum CPUs

The vm_power_manager app was not respecting the POWER_MGR_MAX_CPUS
during initialisation, so if there were more CPUs than this value (64),
it would lead to buffer overruns of there were more then 64 cores in
the system.

Added in a check during init and un-init to only initialise up to
lcore_id 63.

This raises the question as to why not simply increase the value of
POWER_MGR_MAX_CPUS. Well, it's not that simple, as many of the APIs take
a uint64_t as a parameter for the core mask, and this will not work for
cores greater than 63. So some work needs to be done in the future to
remove this limitation. For now we'll fix the memory corruption.

Also, the patch that this fixes says "allow greater than 64 cores" but
that's not across the entire application, it's only for the out-of-band
monitoring. I'll add a notice for an API change in the next release to
clean this up, i.e. depricate any API calls that use masks.

Fixes: 6453b9284b64 ("examples/vm_power: allow greater than 64 cores")
Cc: stable@dpdk.org
Signed-off-by: David Hunt <david.hunt@intel.com>
6 years agoexamples/multi_process: add sigint handler to server
Raslan Darawsheh [Thu, 27 Sep 2018 11:51:44 +0000 (14:51 +0300)]
examples/multi_process: add sigint handler to server

add sigint handler in the server application to stop and close ports

Signed-off-by: Raslan Darawsheh <rasland@mellanox.com>
6 years agodevtools: add explicit warnings for forbidden tokens
Arnon Warshavsky [Fri, 2 Nov 2018 10:52:21 +0000 (12:52 +0200)]
devtools: add explicit warnings for forbidden tokens

Replace the content of warning in the forbidden tokens script
from using the searched regex into using explicit messages

Signed-off-by: Arnon Warshavsky <arnon@qwilt.com>
6 years agoeal/linux: handle UIO read failure in interrupt handler
Luca Boccassi [Wed, 31 Oct 2018 18:39:45 +0000 (18:39 +0000)]
eal/linux: handle UIO read failure in interrupt handler

If a device is unplugged while an interrupt is pending, the
read call to the uio device to remove it from the poll wait list
can fail resulting in it being continually polled forever. This
change checks for the read failing and if so, unregisters the device
as an interrupt source and causes the wait list to be rebuilt.

This race has been reported and observed in production.

Fixes: 0a45657a6794 ("pci: rework interrupt handling")
Cc: stable@dpdk.org
Signed-off-by: Brian Russell <brussell@brocade.com>
Signed-off-by: Luca Boccassi <bluca@debian.org>
6 years agonet/vmxnet3: fix hot-unplug
Luca Boccassi [Wed, 31 Oct 2018 18:39:44 +0000 (18:39 +0000)]
net/vmxnet3: fix hot-unplug

The vmxnet3 driver can't call back into dev_close(), and possibly
dev_stop(), in dev_uninit().  When dev_uninit() is called, anything
that those routines would want to clean up has already been released.
Further, for complete cleanup, it is necessary to release any of the
queue resources during dev_close().
This allows a vmxnet3 device to be hot-unplugged without leaking
queues.
Also set RTE_ETH_DEV_CLOSE_REMOVE on close so that the port resources
can be deallocated.
Return EBUSY if remove is called before stop.

Fixes: dfaff37fc46d ("vmxnet3: import new vmxnet3 poll mode driver implementation")
Cc: stable@dpdk.org
Signed-off-by: Brian Russell <brussell@brocade.com>
Signed-off-by: Luca Boccassi <bluca@debian.org>
6 years agonet/virtio: register/unregister intr handler on start/stop
Luca Boccassi [Wed, 31 Oct 2018 18:39:43 +0000 (18:39 +0000)]
net/virtio: register/unregister intr handler on start/stop

Register and unregister the virtio interrupt handler when the device is
started and stopped. This allows a virtio device to be hotplugged or
unplugged.

Fixes: c1f86306a026 ("virtio: add new driver")
Cc: stable@dpdk.org
Signed-off-by: Brian Russell <brussell@brocade.com>
Signed-off-by: Luca Boccassi <bluca@debian.org>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>