dpdk.git
4 years agotelemetry: add default callback commands
Ciara Power [Thu, 30 Apr 2020 16:01:27 +0000 (17:01 +0100)]
telemetry: add default callback commands

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Adding support for multi segment to the eventdev PMD.

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

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

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

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

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

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

This patch fixes coverity issues regard to error check.

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

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

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

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

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

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

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

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

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

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

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

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

Introduce a helper function to set the ip_version match.

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

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

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

Fix by casting to the correct enum.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Outer L4 UDP checksum error => PKT_RX_OUTER_L4_CKSUM_BAD
and PKT_RX_L4_CKSUM_BAD

Inner L4 UDP checksum error => PKT_RX_L4_CKSUM_BAD

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

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

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

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

Add support for get firmware version operation.

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

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

This patch adds support to flush the rte flows.

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

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

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

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

Use the dedicated API to compare 2 PCI addresses.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Signed-off-by: Lijun Ou <oulijun@huawei.com>
Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Signed-off-by: Hao Chen <chenhao164@huawei.com>
4 years agonet/softnic: fix resource leak for pipeline
Jasvinder Singh [Mon, 27 Apr 2020 17:15:51 +0000 (18:15 +0100)]
net/softnic: fix resource leak for pipeline

For sending request messages to data plane threads, the
caller invokes pipeline_msg_send_recv() function which never
returns null response. Thus, removed redundant check on
the returned response.

Coverity issue: 357676, 357680, 357681, 357682, 357690, 357693, 357711
Coverity issue: 357722, 357725, 357734, 357739, 357743, 357747, 357762
Coverity issue: 357766, 357787

Fixes: 6d4d05402501 ("net/softnic: add command to read stats")
Fixes: 202905f3ee4d ("net/softnic: add command to create objects")
Fixes: ee19326a4b1e ("net/softnic: add command for pipeline table entries")
Fixes: 9bc0ce0ad17c ("net/softnic: add command for meter action")
Fixes: 2505030a8383 ("net/softnic: add command for TTL action")
Cc: stable@dpdk.org
Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
4 years agonet/softnic: fix memory leak for thread
Jasvinder Singh [Mon, 27 Apr 2020 17:13:20 +0000 (18:13 +0100)]
net/softnic: fix memory leak for thread

For sending request messages to data plane threads, the
caller invokes thread_msg_send_recv() function which never
returns null response. Thus, removed redundant check on
the returned response.

Coverity issue: 357717, 357772
Fixes: 70709c78fda6 ("net/softnic: add command to enable/disable pipeline")
Cc: stable@dpdk.org
Signed-off-by: Jasvinder Singh <jasvinder.singh@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
4 years agonet/sfc/base: fix build when EVB is enabled
Andrew Rybchenko [Tue, 28 Apr 2020 13:37:26 +0000 (14:37 +0100)]
net/sfc/base: fix build when EVB is enabled

Make local MCDI helper functions static.

Fixes: f0bda0cd680d ("net/sfc/base: add MCDI wrappers for vPort and vSwitch in EVB")
Fixes: ea94d14dbea0 ("net/sfc/base: provide APIs to configure and reset vPort")
Cc: stable@dpdk.org
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
4 years agonet/sfc/base: use simpler EF10 family run-time checks
Andrew Rybchenko [Tue, 28 Apr 2020 13:37:25 +0000 (14:37 +0100)]
net/sfc/base: use simpler EF10 family run-time checks

Fixes: 4625c4f5277d ("net/sfc/base: factor out upstream port vAdaptor allocation")
Fixes: 4f12e20c85dc ("net/sfc/base: introduce EVB module for SR-IOV")
Fixes: 18c8e84d7726 ("net/sfc/base: support proxy auth operations for SR-IOV")
Cc: stable@dpdk.org
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
4 years agonet/sfc/base: use simpler EF10 family conditional check
Andrew Rybchenko [Tue, 28 Apr 2020 13:37:24 +0000 (14:37 +0100)]
net/sfc/base: use simpler EF10 family conditional check

Fixes: 4f12e20c85dc ("net/sfc/base: introduce EVB module for SR-IOV")
Fixes: 18c8e84d7726 ("net/sfc/base: support proxy auth operations for SR-IOV")
Cc: stable@dpdk.org
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
4 years agoexamples/vhost_blk: refactor to increase readability
Jin Yu [Thu, 30 Apr 2020 17:20:08 +0000 (01:20 +0800)]
examples/vhost_blk: refactor to increase readability

Refactor the code and make it easier to read. It's
useful for understanding the inflight APIs and how
packed ring works. Update the RST because the packed
ring patch has been merged to QEMU master and ring_packed
parameter changes to packed.

Signed-off-by: Jin Yu <jin.yu@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
4 years agonet/mlx5: fix actions validation on root table
Bing Zhao [Wed, 29 Apr 2020 12:54:20 +0000 (20:54 +0800)]
net/mlx5: fix actions validation on root table

The maximal supported header modifications number of a single modify
context on the root table cannot be queried from firmware directly.
It is a fixed value of 16 in the latest releases. In the validation
stage, PMD driver should ensure that no more than 16 header modify
actions exist in a single context.
In some old firmware releases, the supported value is 8. PMD driver
should try its best to create the flow. Firmware will return error
and refuse to create the flow if the actions number exceeds the
maximal value.

Fixes: 72a944dba163 ("net/mlx5: fix header modify action validation")
Cc: stable@dpdk.org
Signed-off-by: Bing Zhao <bingz@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agonet/mlx5: fix indexed pool bitmap initialization
Suanming Mou [Tue, 28 Apr 2020 09:13:37 +0000 (17:13 +0800)]
net/mlx5: fix indexed pool bitmap initialization

Currently, the indexed memory pool bitmap start address is not aligned
to cacheline size explicitly. The bitmap initialization requires the
address should be cacheline aligned. In that case, the initialization
maybe failed if the address is not cacheline aligned.

Add RTE_CACHE_LINE_ROUNDUP() to the trunk size calculation to make sure
the bitmap offset address will start with cacheline aligned.

Fixes: a3cf59f56c47 ("net/mlx5: add indexed memory pool")

Signed-off-by: Suanming Mou <suanmingm@mellanox.com>
Tested-by: Lijian Zhang <lijian.zhang@arm.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
4 years agonet/mlx5: fix packet length assert in MPRQ
Alexander Kozyrev [Mon, 27 Apr 2020 18:23:13 +0000 (18:23 +0000)]
net/mlx5: fix packet length assert in MPRQ

The assert that checks if there is a enough room for the
whole packet minus headroom data is written incorrectly.
The check should be negated in order to work properly.

Fixes: bd0d5930bf56 ("net/mlx5: enable MPRQ multi-stride operations")

Signed-off-by: Alexander Kozyrev <akozyrev@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agonet/mlx5: fix assert in dynamic metadata handling
Alexander Kozyrev [Mon, 27 Apr 2020 18:20:11 +0000 (18:20 +0000)]
net/mlx5: fix assert in dynamic metadata handling

The assert in dynamic flow metadata handling is wrong after the
fix for the performance degradation. The assert meant to check
the metadata mask but was updated with the metadata offset instead.
Fix this assert and restore proper metadata mask checking.

Fixes: 6c55b622a956 ("net/mlx5: set dynamic flow metadata in Rx queues")
Cc: stable@dpdk.org
Signed-off-by: Alexander Kozyrev <akozyrev@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agovhost: use binary search in address conversion
Marvin Liu [Wed, 29 Apr 2020 01:04:22 +0000 (09:04 +0800)]
vhost: use binary search in address conversion

If Tx zero copy enabled, gpa to hpa mapping table is updated one by
one. This will harm performance when guest memory backend using 2M
hugepages. Now utilize binary search to find the entry in mapping
table, meanwhile set the threshold to 256 entries for linear search.

Signed-off-by: Marvin Liu <yong.liu@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
4 years agovhost: utilize dynamic memory allocator
Marvin Liu [Wed, 29 Apr 2020 01:04:21 +0000 (09:04 +0800)]
vhost: utilize dynamic memory allocator

Replace dynamic memory allocator with dpdk memory allocator.

Signed-off-by: Marvin Liu <yong.liu@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
4 years agovhost: prevent zero-copy with incompatible client mode
Xuan Ding [Wed, 29 Apr 2020 02:59:46 +0000 (02:59 +0000)]
vhost: prevent zero-copy with incompatible client mode

In server mode, virtio-user inits under the assumption that vhost-user
supports a list of features. However, this could be problematic when
in_order feature is negotiated but not supported by vhost-user when
enables dequeue_zero_copy later.

Add handling when vhost-user enables dequeue_zero_copy as client.

Fixes: 64ab701c3d1e ("vhost: add vhost-user client mode")
Cc: stable@dpdk.org
Signed-off-by: Xuan Ding <xuan.ding@intel.com>
Tested-by: Yinan Wang <yinan.wang@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
4 years agonet/virtio: add election for vectorized path
Marvin Liu [Wed, 29 Apr 2020 07:28:21 +0000 (15:28 +0800)]
net/virtio: add election for vectorized path

Rewrite vectorized path selection logic. Default setting comes from
vectorized devarg, then checks each criteria.

Packed ring vectorized path need:
    AVX512F and required extensions are supported by compiler and host
    VERSION_1 and IN_ORDER features are negotiated
    mergeable feature is not negotiated
    LRO offloading is disabled

Split ring vectorized rx path need:
    mergeable and IN_ORDER features are not negotiated
    LRO, chksum and vlan strip offloadings are disabled

Signed-off-by: Marvin Liu <yong.liu@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
4 years agonet/virtio: add vectorized packed ring Tx
Marvin Liu [Wed, 29 Apr 2020 07:28:20 +0000 (15:28 +0800)]
net/virtio: add vectorized packed ring Tx

Optimize packed ring Tx path like Rx path. Split Tx path into batch and
single Tx functions. Batch function is further optimized by AVX512
instructions.

Signed-off-by: Marvin Liu <yong.liu@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
4 years agonet/virtio: add vectorized packed ring Rx
Marvin Liu [Wed, 29 Apr 2020 07:28:19 +0000 (15:28 +0800)]
net/virtio: add vectorized packed ring Rx

Optimize packed ring Rx path with SIMD instructions. Solution of
optimization is pretty like vhost, is that split path into batch and
single functions. Batch function is further optimized by AVX512
instructions.

Signed-off-by: Marvin Liu <yong.liu@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
4 years agonet/virtio: reuse packed ring functions
Marvin Liu [Wed, 29 Apr 2020 07:28:18 +0000 (15:28 +0800)]
net/virtio: reuse packed ring functions

Move offload, xmit cleanup and packed xmit enqueue function to header
file. These functions will be reused by packed ring vectorized path.

Signed-off-by: Marvin Liu <yong.liu@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
4 years agonet/virtio-user: add parameter to enable vectorized path
Marvin Liu [Wed, 29 Apr 2020 07:28:17 +0000 (15:28 +0800)]
net/virtio-user: add parameter to enable vectorized path

Add new devarg for virtio user device vectorized path selection.
By default vectorized path is disabled.

Signed-off-by: Marvin Liu <yong.liu@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
4 years agonet/virtio: add parameter to enable vectorized path
Marvin Liu [Wed, 29 Apr 2020 07:28:16 +0000 (15:28 +0800)]
net/virtio: add parameter to enable vectorized path

Previously, virtio split ring vectorized path was enabled by default.
This is not suitable for everyone because that path does not follow
virtio spec. Add new devarg for virtio vectorized path selection. By
default vectorized path is disabled.

Signed-off-by: Marvin Liu <yong.liu@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
4 years agonet/virtio: enable in-order feature if negotiated
Marvin Liu [Wed, 29 Apr 2020 07:28:15 +0000 (15:28 +0800)]
net/virtio: enable in-order feature if negotiated

Ring initialization is different when inorder feature negotiated. This
action should dependent on negotiated feature bits.

Signed-off-by: Marvin Liu <yong.liu@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
4 years agonet/virtio: add Rx free threshold setting
Marvin Liu [Wed, 29 Apr 2020 07:28:14 +0000 (15:28 +0800)]
net/virtio: add Rx free threshold setting

Introduce free threshold setting in Rx queue, its default value is 32.
Limit the threshold size to multiple of four as only vectorized packed
Rx function will utilize it. Virtio driver will rearm Rx queue when
more than rx_free_thresh descs were dequeued.

Signed-off-by: Marvin Liu <yong.liu@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
4 years agovdpa/mlx5: recreate a virtq becoming enabled
Matan Azrad [Sun, 26 Apr 2020 12:07:36 +0000 (12:07 +0000)]
vdpa/mlx5: recreate a virtq becoming enabled

The virtq configurations may be changed when it moves from disabled
state to enabled state.

Listen to the state callback even if the device is not configured.
Recreate the virtq when it moves from disabled state to enabled state
and when the device is configured.

Signed-off-by: Matan Azrad <matan@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
4 years agovdpa/mlx5: separate virtq stop
Matan Azrad [Sun, 26 Apr 2020 12:07:35 +0000 (12:07 +0000)]
vdpa/mlx5: separate virtq stop

In live migration, before logging the virtq, the driver queries the
virtq indexes after moving it to suspend mode.

Separate this method to new function mlx5_vdpa_virtq_stop as a
preparation for reusing.

Signed-off-by: Matan Azrad <matan@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
4 years agovdpa/mlx5: manage virtqs by array
Matan Azrad [Sun, 26 Apr 2020 12:07:34 +0000 (12:07 +0000)]
vdpa/mlx5: manage virtqs by array

As a preparation to listen the virtqs status before the device is
configured, manage the virtqs structures in array instead of list.

Signed-off-by: Matan Azrad <matan@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
4 years agovhost: optimize broadcast RARP sync with C11 atomic
Phil Yang [Thu, 23 Apr 2020 16:54:49 +0000 (00:54 +0800)]
vhost: optimize broadcast RARP sync with C11 atomic

The rarp packet broadcast flag is synchronized with rte_atomic_XX APIs
which is a full barrier, DMB, on aarch64. This patch optimized it with
c11 atomic one-way barrier.

Signed-off-by: Phil Yang <phil.yang@arm.com>
Reviewed-by: Gavin Hu <gavin.hu@arm.com>
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
Reviewed-by: Joyce Kong <joyce.kong@arm.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
4 years agovhost: fix peer close check
Roland Qi [Tue, 21 Apr 2020 08:59:39 +0000 (16:59 +0800)]
vhost: fix peer close check

In process_slave_message_reply(), there is a
possibility that receiving a peer close
message instead of a real message response.

This patch targeting to handle the peer close
scenario and report the correct error message.

Fixes: a277c7159876 ("vhost: refactor code structure")
Cc: stable@dpdk.org
Signed-off-by: Roland Qi <roland.qi@ucloud.cn>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
4 years agodoc: remove virtio vector PMD from NIC features table
Maxime Coquelin [Mon, 20 Apr 2020 07:53:10 +0000 (09:53 +0200)]
doc: remove virtio vector PMD from NIC features table

The goal is to make the table more readable.

Mark as partially supported features that are supported in
the generic Virtio driver but not in the vectorized ones.

Suggested-by: Thomas Monjalon <thomas@monjalon.net>
Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
4 years agonet/mlx5: save meter index instead of meter id
Suanming Mou [Sun, 26 Apr 2020 02:51:25 +0000 (10:51 +0800)]
net/mlx5: save meter index instead of meter id

Currently, while creating the flow with meter, meter id is saved to the
rte flow. While destroying the flow, the meter object will be found by
the meter id, so the meter object will be released accordingly. But as
the meter id is configured by user, while the meter id is set to 0, it
doesn't make any sense to flow destroy since 0 means flow doesn't have
meter. The meter object with id 0 will be leaked.

As meter object is allocated from indexed memory, and the index starts
from 1, save the internal generated index instead of user defined meter
id will never meet the issue as above.

This patch saves meter index instead of meter id in rte flow.

Signed-off-by: Suanming Mou <suanmingm@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agocommon/mlx5: fix uninitialized RoCE variable
Stephen Hemminger [Wed, 22 Apr 2020 22:31:30 +0000 (15:31 -0700)]
common/mlx5: fix uninitialized RoCE variable

Gcc 8.3.0 (Debian 10) complains about uninitialized variable.

[474/2122] Compiling C object
'drivers/a715181@@tmp_rte_common_mlx5@sta/common_mlx5_mlx5_nl.c.o'.
In file included from ../drivers/common/mlx5/mlx5_nl.h:12,
                 from ../drivers/common/mlx5/mlx5_nl.c:23:
../drivers/common/mlx5/mlx5_nl.c: In function ‘mlx5_nl_enable_roce_get’:
../drivers/common/mlx5/mlx5_common.h:68:2: warning: ‘cur_en’ may be used
uninitialized in this function [-Wmaybe-uninitialized]
  rte_log(RTE_LOG_ ## level, \
  ^~~~~~~
../drivers/common/mlx5/mlx5_nl.c:1560:6: note: ‘cur_en’ was declared here
  int cur_en;
      ^~~~~~

The compiler is correct, this variable would only be set if kernel
netlink response message contains the DEVLINK parameter that flags if
ROCE is enabled.

Fixes: fa69eaef5f49 ("common/mlx5: support ROCE disable through Netlink")
Cc: stable@dpdk.org
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agonet/mlx5: fix assert in doorbell lookup
Asaf Penso [Thu, 16 Apr 2020 17:15:09 +0000 (17:15 +0000)]
net/mlx5: fix assert in doorbell lookup

The asserts makes sure that 'i' doesn't exceed the expected value.
This to prevent an out of bound access to dbr_bitmap.

The current location of the assert protects the assignment of
dbr_bitmap, but not the access to it.

Moved the assert to the correct place, to protect both cases.
Also, used an existing define for the assert.

Fixes: 21cae8580fd0 ("net/mlx5: allocate door-bells via DevX")
Cc: stable@dpdk.org
Signed-off-by: Asaf Penso <asafp@mellanox.com>
Reviewed-by: Dekel Peled <dekelp@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agonet/mlx5: fix empty flow error structure
Bing Zhao [Fri, 17 Apr 2020 07:30:44 +0000 (15:30 +0800)]
net/mlx5: fix empty flow error structure

The output flow error parameter is used to indicate the detailed
reason of the failure when calling a rte_flow_* interface. Even
though sometimes the application will not check it or use it, the PMD
must fill it in the failure branch before returning. Or else, some
dirty value in the stack, heap will be accessed as a pointer and then
cause a crash.
In this case, when a port is stopped, it is not allowed to insert a
flow from application. The detailed error information should be
filled. If the application needs to check the detailed error reason,
it will get the information but not result in any crash.

Fixes: 40b9e7f65fe1 ("net/mlx5: check device status before creating flow")

Signed-off-by: Bing Zhao <bingz@mellanox.com>
Acked-by: Ori Kam <orika@mellanox.com>
4 years agonet/mlx5: fix Rx queue flags on destroying flow
Bing Zhao [Fri, 17 Apr 2020 07:23:30 +0000 (15:23 +0800)]
net/mlx5: fix Rx queue flags on destroying flow

After inserting an offload flow, the software flag information will
be updated based on the flow. When receiving a packet on this queue,
the hardware packet type bits and the software flag will be used
together to get the inner packet and tunnel header type (if any) from
the global packet type table.
When destroying a flow, the corresponding Rx queue flag needs to be
updated. All flags should be cleared when closing a device because
all control flows and application flows are invalid anymore.
Such behavior is missed when implementing the non-cached mode.

Fixes: 8db7e3b69822 ("net/mlx5: change operations for non-cached flows")

Signed-off-by: Bing Zhao <bingz@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agonet/ice/base: fix DCF switch rule
Qi Zhang [Thu, 23 Apr 2020 13:07:04 +0000 (21:07 +0800)]
net/ice/base: fix DCF switch rule

1. ln_en bit should not be turned on, since we only support Rx VEB.
2. lan_en bit need to be turned on for a DCF switch rule, otherwise
   any Tx packet that hit on a rule will be dropped.

Fixes: fed0c5ca5f19 ("net/ice/base: support programming a new switch recipe")
Cc: stable@dpdk.org
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Qiming Yang <qiming.yang@intel.com>
4 years agonet/iavf: fix VF reset for flow director rule
Simei Su [Tue, 28 Apr 2020 05:49:19 +0000 (13:49 +0800)]
net/iavf: fix VF reset for flow director rule

After VF reset, FDIR rule still takes effect. To solve the issue,
this patch adds to flush all flows before flow uninit. VIRTCHNL
sends message to PF by Admin Queue, so flow flush should be implemented
before Admin Queue shut down.

Fixes: ff2d0c345c3b ("net/iavf: support generic flow API")

Signed-off-by: Simei Su <simei.su@intel.com>
Acked-by: Xiaolong Ye <xiaolong.ye@intel.com>
4 years agonet/i40e: fix flush of flow director filter
Wei Zhao [Wed, 29 Apr 2020 02:03:53 +0000 (10:03 +0800)]
net/i40e: fix flush of flow director filter

When we flush FDIR filter, we can not call i40e_fdir_teardown()
function as it will free vsi used for FDIR, then the vsi->base_queue
will be freed from pf->qp_pool, but vsi->base_queue can only get
once when do dev init in i40e_pf_setup(). If we free it, it will
never be alloc again.

Bugzilla ID: 404
Fixes: 2e67a7fbf3ff ("net/i40e: config flow director automatically")
Cc: stable@dpdk.org
Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
Acked-by: Beilei Xing <beilei.xing@intel.com>
4 years agodoc: add i40e limitation for flow director
Wei Zhao [Wed, 29 Apr 2020 02:03:52 +0000 (10:03 +0800)]
doc: add i40e limitation for flow director

Each PCTYPE can only have one specific FDIR input set at one time.
Add input set requirement info to i40e doc.

Bugzilla ID: 403
Fixes: 14c66a451ef7 ("net/i40e: flush tunnel filters")
Cc: stable@dpdk.org
Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
Acked-by: Beilei Xing <beilei.xing@intel.com>
4 years agonet/i40e: fix flow director for ARP packets
Wei Zhao [Wed, 29 Apr 2020 02:03:51 +0000 (10:03 +0800)]
net/i40e: fix flow director for ARP packets

Currently, flow "pattern eth type is 0x0806 / end actions mark id
0x86 / rss / end" can't be created successfully. FDIR parser
shouldn't deny RTE_ETHER_TYPE_ARP since ARP packets will be
parsed as PCTYPE_L2_PAYLOAD. This patch fixes the issue.

Bugzilla ID: 402
Fixes: 42044b69c67d ("net/i40e: support input set selection for FDIR")
Cc: stable@dpdk.org
Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
Acked-by: Beilei Xing <beilei.xing@intel.com>
4 years agonet/ice/base: workaround unexpected rule deletion
Qi Zhang [Thu, 23 Apr 2020 04:22:13 +0000 (12:22 +0800)]
net/ice/base: workaround unexpected rule deletion

Ideally a rule with "TO VSI LIST" action should not be deleted when one
of the VF reset happens. The correct action by kernel PF driver is to
remove the VSI of a reset VF from the VSI list, but this is not
implemented in kernel PF yet, so workaround is the DCF to prevent a
rule with "To VSI List" action happens.

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Reviewed-by: Wei Zhao <wei.zhao1@intel.com>
4 years agonet/bnxt: add Truflow flush-timer to alloc table scope
Shahaji Bhosle [Sat, 25 Apr 2020 03:47:25 +0000 (09:17 +0530)]
net/bnxt: add Truflow flush-timer to alloc table scope

Updated the params list to include flush timer, this will
allow users to set the HW flush timer value in 10th of second.
Setting 0 will disable the pending cache flush feature.

Signed-off-by: Shahaji Bhosle <sbhosle@broadcom.com>
Signed-off-by: Randy Schacher <stuart.schacher@broadcom.com>
Signed-off-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
Reviewed-by: Mike Baucom <michael.baucom@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
4 years agonet/bnxt: update ULP to handle action/index tables
Mike Baucom [Sat, 25 Apr 2020 03:47:24 +0000 (09:17 +0530)]
net/bnxt: update ULP to handle action/index tables

The ulp required to be changed to properly call the index table
management routines and use the index for external memory indices.
The ulp no longer has to account for stride as the tf_core returns the
actual offset, not a 0 based index.

Signed-off-by: Mike Baucom <michael.baucom@broadcom.com>
Reviewed-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>
Reviewed-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
4 years agonet/bnxt: update external action record pool
Farah Smith [Sat, 25 Apr 2020 03:47:23 +0000 (09:17 +0530)]
net/bnxt: update external action record pool

- Added support variable sized action records
- Additional error checking on table scope params
- Single external pool supported per direction
- Changed to return action record pointer
- Allows action pool to fully utilize the number of flows

Signed-off-by: Farah Smith <farah.smith@broadcom.com>
Signed-off-by: Mike Baucom <michael.baucom@broadcom.com>
Reviewed-by: Peter Spreadborough <peter.spreadborough@broadcom.com>
Reviewed-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>
4 years agonet/bnxt: enable processing partially added flows
Mike Baucom [Sat, 25 Apr 2020 03:47:22 +0000 (09:17 +0530)]
net/bnxt: enable processing partially added flows

The resource function did not have a method of invalidating or
indicating that a resource is uninitialized.  Added an invalid enum so
that processing works correctly for partially added flows.

Signed-off-by: Mike Baucom <michael.baucom@broadcom.com>
Reviewed-by: Kishore Padmanabha <kishore.padmanabha@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
4 years agonet/bnxt: fix max ring count
Somnath Kotur [Fri, 24 Apr 2020 11:00:54 +0000 (16:30 +0530)]
net/bnxt: fix max ring count

Max Rx Ring count could be < Max stat contexts. While accounting
for stat contexts, this should be also considered and
the max ring count adjusted accordingly.

Fixes: f03e66cb64ce ("net/bnxt: limit queue count for NS3/Stingray devices")
Cc: stable@dpdk.org
Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
4 years agoeal/ppc: fix build with gcc 9.3
David Christensen [Mon, 4 May 2020 21:03:47 +0000 (14:03 -0700)]
eal/ppc: fix build with gcc 9.3

Building DPDK on Ubuntu 20.04 with GCC 9.3.0 results in a "subscript is
outside array bounds" message in rte_memcpy function.  The build error
is caused by an interaction between __builtin_constant_p and
"-Werror=array-bounds" as described in this bugzilla:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90387

Modify the code to disable the array-bounds check for GCC versions 9.0
to 9.3.

Cc: stable@dpdk.org
Signed-off-by: David Christensen <drc@linux.vnet.ibm.com>
4 years agokvargs: fix invalid token parsing on FreeBSD
Olivier Matz [Wed, 29 Apr 2020 13:17:00 +0000 (15:17 +0200)]
kvargs: fix invalid token parsing on FreeBSD

The behavior of strtok_r() is not the same between GNU libc and FreeBSD
libc: in the first case, the context is set to "" when the last token is
returned, while in the second case it is set to NULL.

On FreeBSD, the current code crashes because we are dereferencing a NULL
pointer (ctx1). Fix it by first checking if it is NULL. This works with
both GNU and FreeBSD libc.

Fixes: ffcf831454a9 ("kvargs: fix buffer overflow when parsing list")
Cc: stable@dpdk.org
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Tested-by: Zhimin Huang <zhiminx.huang@intel.com>

4 years agotrace: fix build with gcc 10
Phil Yang [Tue, 28 Apr 2020 14:37:07 +0000 (22:37 +0800)]
trace: fix build with gcc 10

Prevent from writing beyond the allocated memory.

GCC 10 compiling output:
eal_common_trace_utils.c: In function 'eal_trace_dir_args_save':
eal_common_trace_utils.c:290:24: error: '__builtin___sprintf_chk'   \
may write a terminating nul past the end of the destination \
[-Werror=format-overflow=]
  290 |  sprintf(dir_path, "%s/", optarg);
      |                        ^

Fixes: 8af866df8d8c ("trace: add trace directory configuration parameter")

Signed-off-by: Phil Yang <phil.yang@arm.com>
Reviewed-by: Lijian Zhang <lijian.zhang@arm.com>
Tested-by: Lijian Zhang <lijian.zhang@arm.com>
Acked-by: Sunil Kumar Kori <skori@marvell.com>
Signed-off-by: David Marchand <david.marchand@redhat.com>
4 years agotrace: remove string duplication
David Marchand [Thu, 30 Apr 2020 17:44:48 +0000 (19:44 +0200)]
trace: remove string duplication

No need to duplicate an untouched string.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Sunil Kumar Kori <skori@marvell.com>
4 years agotrace: remove limitation on patterns number
David Marchand [Thu, 30 Apr 2020 16:31:55 +0000 (18:31 +0200)]
trace: remove limitation on patterns number

There is nothing performance sensitive in this list, use dynamic
allocations and remove the arbitrary limit on the number of trace
patterns a user can pass.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Sunil Kumar Kori <skori@marvell.com>
4 years agotrace: remove unneeded checks in internal API
David Marchand [Thu, 30 Apr 2020 15:33:18 +0000 (17:33 +0200)]
trace: remove unneeded checks in internal API

The trace framework can be configured via 4 EAL options:
- --trace which calls eal_trace_args_save,
- --trace-dir which calls eal_trace_dir_args_save,
- --trace-bufsz which calls eal_trace_bufsz_args_save,
- --trace-mode which calls eal_trace_mode_args_save.

Those 4 internal callbacks are getting passed a non NULL value:
optarg won't be NULL since those options are declared with
required_argument (man getopt_long).

eal_trace_bufsz_args_save() already trusted passed value, align the other
3 internal callbacks.

Coverity issue: 357768
Fixes: 8c8066ea6a7b ("trace: add trace mode configuration parameter")

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Sunil Kumar Kori <skori@marvell.com>
4 years agotrace: avoid confusion on optarg
David Marchand [Thu, 30 Apr 2020 17:27:16 +0000 (19:27 +0200)]
trace: avoid confusion on optarg

Prefer a local name to optarg which is a global symbol from the C library.

Fixes: 8c8066ea6a7b ("trace: add trace mode configuration parameter")

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Sunil Kumar Kori <skori@marvell.com>
4 years agotrace: simplify trace point headers
David Marchand [Wed, 29 Apr 2020 13:46:49 +0000 (15:46 +0200)]
trace: simplify trace point headers

Invert the current trace point headers logic by making
rte_trace_point_register.h include rte_trace_point.h.

There is no more need for a RTE_TRACE_POINT_REGISTER_SELECT special macro
since including rte_trace_point_register.h itself means we want to
register trace points.

The unexplained "provider" notion is removed from the documentation and
rte_trace_point_provider.h is merged into rte_trace_point.h.

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
4 years agocryptodev: fix trace points registration
David Marchand [Wed, 29 Apr 2020 12:36:23 +0000 (14:36 +0200)]
cryptodev: fix trace points registration

Those trace points are defined but not registered.

Fixes: 4cf30e3f3c35 ("cryptodev: add tracepoints")

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Sunil Kumar Kori <skori@marvell.com>