dpdk.git
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>
4 years agoeal/ppc: fix bool type after altivec include
Ori Kam [Thu, 30 Apr 2020 14:22:14 +0000 (14:22 +0000)]
eal/ppc: fix bool type after altivec include

The AltiVec header file breaks boolean type. [1] [2]

Currently the workaround was located only in mlx5 device.
Adding the trace module caused this issue to appear again, due to
order of includes, it keeps overriding the local fix.

This patch solves this issue by resetting the bool type, immediately
after it is being changed.

[1] https://mails.dpdk.org/archives/dev/2018-August/110281.html

[2]
In file included from
dpdk/ppc_64-power8-linux-gcc/include/rte_mempool_trace_fp.h:18:0,
                 from
dpdk/ppc_64-power8-linux-gcc/include/rte_mempool.h:54,
                 from
dpdk/drivers/common/mlx5/mlx5_common_mr.c:7:
dpdk/ppc_64-power8-linux-gcc/include/rte_trace_point.h: In
function '__rte_trace_point_fp_is_enabled':
dpdk/ppc_64-power8-linux-gcc/include/rte_trace_point.h:226:2:
error: incompatible types when returning type 'int' but '__vector __bool
int' was expected
  return false;
  ^
In file included from
dpdk/ppc_64-power8-linux-gcc/include/rte_trace_point.h:281:0,
                 from
dpdk/ppc_64-power8-linux-gcc/include/rte_mempool_trace_fp.h:18,
                 from
dpdk/ppc_64-power8-linux-gcc/include/rte_mempool.h:54,
                 from
dpdk/drivers/common/mlx5/mlx5_common_mr.c:7:
dpdk/ppc_64-power8-linux-gcc/include/rte_mempool_trace_fp.h:
In function 'rte_mempool_trace_ops_dequeue_bulk':
dpdk/ppc_64-power8-linux-gcc/include/rte_trace_point_provider.h:104:6:
error: wrong type argument to unary exclamation mark
  if (!__rte_trace_point_fp_is_enabled()) \
      ^
dpdk/ppc_64-power8-linux-gcc/include/rte_trace_point.h:49:2:
note: in expansion of macro '__rte_trace_point_emit_header_fp'
  __rte_trace_point_emit_header_##_mode(&__##_tp); \
  ^
dpdk/ppc_64-power8-linux-gcc/include/rte_trace_point.h:99:2:
note: in expansion of macro '__RTE_TRACE_POINT'
  __RTE_TRACE_POINT(fp, tp, args, __VA_ARGS__)
  ^
dpdk/ppc_64-power8-linux-gcc/include/rte_mempool_trace_fp.h:20:1:
note: in expansion of macro 'RTE_TRACE_POINT_FP'
 RTE_TRACE_POINT_FP(
 ^
dpdk/ppc_64-power8-linux-gcc/include/rte_mempool_trace_fp.h:
In function 'rte_mempool_trace_ops_dequeue_contig_blocks':
dpdk/ppc_64-power8-linux-gcc/include/rte_trace_point_provider.h:104:6:
error: wrong type argument to unary exclamation mark
  if (!__rte_trace_point_fp_is_enabled()) \
      ^
dpdk/ppc_64-power8-linux-gcc/include/rte_trace_point.h:49:2:
note: in expansion of macro '__rte_trace_point_emit_header_fp'
  __rte_trace_point_emit_header_##_mode(&__##_tp); \
  ^
dpdk/ppc_64-power8-linux-gcc/include/rte_trace_point.h:99:2:
note: in expansion of macro '__RTE_TRACE_POINT'
  __RTE_TRACE_POINT(fp, tp, args, __VA_ARGS__)
  ^
dpdk/ppc_64-power8-linux-gcc/include/rte_mempool_trace_fp.h:29:1:
note: in expansion of macro 'RTE_TRACE_POINT_FP'
 RTE_TRACE_POINT_FP(
 ^
dpdk/ppc_64-power8-linux-gcc/include/rte_mempool_trace_fp.h:
In function 'rte_mempool_trace_ops_enqueue_bulk':
dpdk/ppc_64-power8-linux-gcc/include/rte_trace_point_provider.h:104:6:
error: wrong type argument to unary exclamation mark
  if (!__rte_trace_point_fp_is_enabled()) \

Fixes: 725f5dd0bfb5 ("net/mlx5: fix build on PPC64")

Signed-off-by: Ori Kam <orika@mellanox.com>
Signed-off-by: David Christensen <drc@linux.vnet.ibm.com>
Tested-by: David Christensen <drc@linux.vnet.ibm.com>
Tested-by: Raslan Darawsheh <rasland@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
4 years agoeal/x86: ignore gcc 10 stringop-overflow warnings
Kevin Traynor [Fri, 17 Apr 2020 15:43:35 +0000 (16:43 +0100)]
eal/x86: ignore gcc 10 stringop-overflow warnings

stringop-overflow warns when it sees a possible overflow
in a string operation.

In the rte_memcpy functions different branches are taken
depending on the size. stringop-overflow is raised for the
branches in the function where it sees the static size of the
src could be overflowed.

However, in reality a correct size argument and in some cases
dynamic allocation would ensure that this does not happen.

For example, in the case below for key, the correct path will be
chosen in rte_memcpy_generic at runtime based on the size argument
but as some paths in the function could lead to a cast to 32 bytes
a warning is raised.

In function ‘_mm256_storeu_si256’,
inlined from ‘rte_memcpy_generic’
at ../lib/librte_eal/common/include/arch/x86/rte_memcpy.h:315:2,
inlined from ‘iavf_configure_rss_key’
at ../lib/librte_eal/common/include/arch/x86/rte_memcpy.h:869:10:

/usr/lib/gcc/x86_64-redhat-linux/10/include/avxintrin.h:928:8:
warning: writing 32 bytes into a region of size 1 [-Wstringop-overflow=]
  928 |   *__P = __A;
      |   ~~~~~^~~~~
In file included
from ../drivers/net/iavf/../../common/iavf/iavf_prototype.h:10,
from ../drivers/net/iavf/iavf.h:9,
from ../drivers/net/iavf/iavf_vchnl.c:22:

../drivers/net/iavf/iavf_vchnl.c:
In function ‘iavf_configure_rss_key’:

../drivers/net/iavf/../../common/iavf/virtchnl.h:508:5:
note: at offset 0 to object ‘key’ with size 1 declared here
  508 |  u8 key[1];         /* RSS hash key, packed bytes */
      |     ^~~

Ignore the stringop-overflow warnings for rte_memcpy.h functions.

Bugzilla ID: 394
Bugzilla ID: 421
Cc: stable@dpdk.org
Signed-off-by: Kevin Traynor <ktraynor@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
4 years agoexamples/ipsec-gw: fix gcc 10 maybe-uninitialized warning
Kevin Traynor [Wed, 11 Mar 2020 11:33:00 +0000 (11:33 +0000)]
examples/ipsec-gw: fix gcc 10 maybe-uninitialized warning

gcc 10.0.1 reports:

../examples/ipsec-secgw/ipsec_process.c: In function ‘ipsec_process’:
../examples/ipsec-secgw/ipsec_process.c:132:34:
error: ‘grp.m’ may be used uninitialized in this function
 [-Werror=maybe-uninitialized]
  132 |    grp[n].cnt = pkts + i - grp[n].m;
      |                            ~~~~~~^~

This is a correct warning for the initial execution of the statement.
However, it is the design of the loop that grp[0].cnt will later be
written with the correct value using an initialized grp[0].m before it
is used.

In order to remove the warning, initialize grp[0].m for the initial and
unused calculation of grp[0].cnt.

Fixes: 3e5f4625dc17 ("examples/ipsec-secgw: make data-path to use IPsec library")
Cc: stable@dpdk.org
Suggested-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Signed-off-by: Kevin Traynor <ktraynor@redhat.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
4 years agonet/avp: fix gcc 10 maybe-uninitialized warning
Kevin Traynor [Wed, 11 Mar 2020 11:32:59 +0000 (11:32 +0000)]
net/avp: fix gcc 10 maybe-uninitialized warning

gcc 10.0.1 reports:

../drivers/net/avp/avp_ethdev.c: In function ‘avp_xmit_scattered_pkts’:
../drivers/net/avp/avp_ethdev.c:1791:24:
warning: ‘avp_bufs[count]’ may be used uninitialized in this function
 [-Wmaybe-uninitialized]
 1791 |   tx_bufs[i] = avp_bufs[count];
      |                ~~~~~~~~^~~~~~~
../drivers/net/avp/avp_ethdev.c:1791:24:
warning: ‘avp_bufs[count]’ may be used uninitialized in this function
 [-Wmaybe-uninitialized]

Fix by initializing the array.

Fixes: 295abce2d25b ("net/avp: add packet transmit functions")
Cc: stable@dpdk.org
Signed-off-by: Kevin Traynor <ktraynor@redhat.com>
Acked-by: Steven Webster <steven.webster@windriver.com>
4 years agodoc: add l3fwd-graph application user guide
Nithin Dabilpuram [Sat, 11 Apr 2020 14:14:28 +0000 (19:44 +0530)]
doc: add l3fwd-graph application user guide

Adding the user guide for l3fwd graph application.

Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
4 years agodoc: add graph library guide
Jerin Jacob [Sat, 11 Apr 2020 14:14:27 +0000 (19:44 +0530)]
doc: add graph library guide

Adding programmer's guide for Graph library and the inbuilt nodes.
This patch also updates the release note for the new libraries.

Signed-off-by: Jerin Jacob <jerinj@marvell.com>
Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
4 years agoexamples/l3fwd-graph: add graph config and main loop
Nithin Dabilpuram [Sat, 11 Apr 2020 14:14:26 +0000 (19:44 +0530)]
examples/l3fwd-graph: add graph config and main loop

Add graph creation, configuration logic and graph main loop.
This graph main loop is run on every slave lcore and calls
rte_graph_walk() to walk over lcore specific rte_graph.
Master core accumulates and prints graph walk stats of all the
lcore's graph's.

Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
4 years agoexamples/l3fwd-graph: add ethdev configuration changes
Nithin Dabilpuram [Sat, 11 Apr 2020 14:14:25 +0000 (19:44 +0530)]
examples/l3fwd-graph: add ethdev configuration changes

Add changes to ethdev port and queue configuration based
on command line parameters for l3fwd graph application.

Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
4 years agoexamples/l3fwd-graph: add graph-based l3fwd skeleton
Nithin Dabilpuram [Sat, 11 Apr 2020 14:14:24 +0000 (19:44 +0530)]
examples/l3fwd-graph: add graph-based l3fwd skeleton

Add graph based l3fwd application skeleton with cmdline
parsing support inline with normal l3fwd.

Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
4 years agonode: add packet drop
Nithin Dabilpuram [Sat, 11 Apr 2020 14:14:23 +0000 (19:44 +0530)]
node: add packet drop

Add packet drop node process function for pkt_drop
rte_node. This node simply free's every object received as
an rte_mbuf to its rte_pktmbuf pool.

Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
4 years agonode: add IPv4 rewrite and lookup control
Nithin Dabilpuram [Sat, 11 Apr 2020 14:14:22 +0000 (19:44 +0530)]
node: add IPv4 rewrite and lookup control

Add ip4_rewrite and ip4_lookup ctrl API. ip4_lookup ctrl
API is used to add route entries for LPM lookup with
result data containing next hop id and next proto.
ip4_rewrite ctrl API is used to add rewrite data for
every next hop.

Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
4 years agonode: add IPv4 rewrite
Kiran Kumar K [Sat, 11 Apr 2020 14:14:21 +0000 (19:44 +0530)]
node: add IPv4 rewrite

Add ip4 rewrite process function for ip4_rewrite
rte_node. On every packet received by this node,
header is overwritten with new data before forwarding
it to next node. Header data to overwrite with is
identified by next hop id passed in mbuf priv data
by previous node.

Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
4 years agonode: add IPv4 lookup for x86
Pavan Nikhilesh [Sat, 11 Apr 2020 14:14:20 +0000 (19:44 +0530)]
node: add IPv4 lookup for x86

Add IPv4 lookup process function for ip4_lookup
rte_node. This node performs LPM lookup using x86_64
vector supported RTE_LPM API on every packet received
and forwards it to a next node that is identified by
lookup result.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
4 years agonode: add IPv4 lookup for arm64
Nithin Dabilpuram [Sat, 11 Apr 2020 14:14:19 +0000 (19:44 +0530)]
node: add IPv4 lookup for arm64

Add arm64 specific IPv4 lookup process function
for ip4_lookup node. This node performs LPM lookup
on every packet received and forwards it to a next
node that is identified by lookup result.

Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
4 years agonode: add generic IPv4 lookup
Pavan Nikhilesh [Sat, 11 Apr 2020 14:14:18 +0000 (19:44 +0530)]
node: add generic IPv4 lookup

Add IPv4 lookup process function for ip4_lookup node.
This node performs LPM lookup using simple RTE_LPM API on every packet
received and forwards it to a next node that is identified by lookup
result.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
4 years agonode: add ethdev control
Nithin Dabilpuram [Sat, 11 Apr 2020 14:14:17 +0000 (19:44 +0530)]
node: add ethdev control

Add ctrl api to setup ethdev_rx and ethdev_tx node.
This ctrl api clones 'N' number of ethdev_rx and ethdev_tx
nodes with specific (port, queue) pairs updated in their context.
All the ethdev ports and queues are setup before this api
is called.

Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
4 years agonode: add ethdev Tx
Nithin Dabilpuram [Sat, 11 Apr 2020 14:14:16 +0000 (19:44 +0530)]
node: add ethdev Tx

Add rte_node ethdev_tx process function and register it to
graph infra. This node has a specific (port, tx-queue) as context
and it enqueue's all the packets received to that specific queue pair.
When rte_eth_tx_burst() i.e enqueue to queue pair fails, packets
are forwarded to pkt_drop node to be free'd.

Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
4 years agonode: add ethdev Rx
Nithin Dabilpuram [Sat, 11 Apr 2020 14:14:15 +0000 (19:44 +0530)]
node: add ethdev Rx

Add source rte_node ethdev_rx process function and register
it. This node is a source node that will be called periodically
and when called, performs rte_eth_rx_burst() on a specific
(port, queue) pair and enqueue them as stream of objects to
next node.

Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
4 years agonode: add logging and null node
Nithin Dabilpuram [Sat, 11 Apr 2020 14:14:14 +0000 (19:44 +0530)]
node: add logging and null node

Add log infra for node specific logging.
Also, add null rte_node that just ignores all the objects
directed to it.

Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
4 years agotest/graph: add performance tests
Pavan Nikhilesh [Sat, 11 Apr 2020 14:14:13 +0000 (19:44 +0530)]
test/graph: add performance tests

Add unit test framework to create and test performance of various
graph models.

example command to test:

echo "graph_perf_autotest" | sudo ./build/app/test/dpdk-test -c 0x30

Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
4 years agotest/graph: add functional tests
Kiran Kumar K [Sat, 11 Apr 2020 14:14:12 +0000 (19:44 +0530)]
test/graph: add functional tests

Adding the unit test to test the functionality of node and graph APIs.
Testing includes registering a node, cloning a node, creating a graph,
perform graph walk, collecting stats and all node and graph debug APIs.

example command to test:
echo "graph_autotest" | sudo ./build/app/test/dpdk-test -c 0x30

Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
4 years agograph: implement fastpath routines
Jerin Jacob [Sat, 11 Apr 2020 14:14:11 +0000 (19:44 +0530)]
graph: implement fastpath routines

Adding implementation for rte_graph_walk() API. This will perform a walk
on the circular buffer and call the process function of each node
and collect the stats if stats collection is enabled.

Signed-off-by: Jerin Jacob <jerinj@marvell.com>
Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
4 years agograph: implement stats
Jerin Jacob [Sat, 11 Apr 2020 14:14:10 +0000 (19:44 +0530)]
graph: implement stats

Adding implementation for graph stats collection API. This API will
create a cluster for a specified node pattern and aggregate the node
runtime stats.

Signed-off-by: Jerin Jacob <jerinj@marvell.com>
Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
4 years agograph: implement debug routines
Jerin Jacob [Sat, 11 Apr 2020 14:14:09 +0000 (19:44 +0530)]
graph: implement debug routines

Adding implementation for graph specific API to dump the
Graph information to a file. This API will dump detailed internal
info about node objects and graph objects.

Signed-off-by: Jerin Jacob <jerinj@marvell.com>
Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
4 years agograph: implement Graphviz export
Jerin Jacob [Sat, 11 Apr 2020 14:14:08 +0000 (19:44 +0530)]
graph: implement Graphviz export

Adding API implementation support exporting the graph object to file.
This will export the graph to a file in Graphviz format.
It can be viewed in many viewers such as
https://dreampuf.github.io/GraphvizOnline/

Signed-off-by: Jerin Jacob <jerinj@marvell.com>
Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
4 years agograph: implement graph operations
Jerin Jacob [Sat, 11 Apr 2020 14:14:07 +0000 (19:44 +0530)]
graph: implement graph operations

Adding support for graph specific API implementation like
Graph lookup to get graph object, retrieving graph ID
From name and graph name from ID.

Signed-off-by: Jerin Jacob <jerinj@marvell.com>
Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
4 years agograph: implement create and destroy
Jerin Jacob [Sat, 11 Apr 2020 14:14:06 +0000 (19:44 +0530)]
graph: implement create and destroy

Adding graph specific API implementations like graph create
and graph destroy. This detect loops in the graph,
check for isolated nodes and operation to verify the validity of
graph.

Signed-off-by: Jerin Jacob <jerinj@marvell.com>
Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
4 years agograph: populate fastpath memory for graph reel
Jerin Jacob [Sat, 11 Apr 2020 14:14:05 +0000 (19:44 +0530)]
graph: populate fastpath memory for graph reel

Adding support to create and populate the memory for graph reel.
This includes reserving the memory in the memzone, populating the nodes,
Allocating memory for node-specific streams to hold objects.

Once it is populated the reel memory contains the following sections.

+---------------------+
|   Graph Header      |
+---------------------+
|   Fence             |
+---------------------+
|   Circular buffer   |
+---------------------+
|   Fence             |
+---------------------+
|   Node Object 0     |
+------------------- -+
|   Node Object 1     |
+------------------- -+
|   Node Object 2     |
+------------------- -+
|   Node Object n     |
+------------------- -+

Signed-off-by: Jerin Jacob <jerinj@marvell.com>
Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
4 years agograph: implement internal operation helpers
Jerin Jacob [Sat, 11 Apr 2020 14:14:04 +0000 (19:44 +0530)]
graph: implement internal operation helpers

Adding internal graph API helpers support to check whether a graph has
isolated nodes and any node have a loop to itself and BFS
algorithm implementation etc.

Signed-off-by: Jerin Jacob <jerinj@marvell.com>
Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
4 years agograph: implement node debug routines
Jerin Jacob [Sat, 11 Apr 2020 14:14:03 +0000 (19:44 +0530)]
graph: implement node debug routines

Adding node debug API implementation support to dump
single or all the node objects to the given file.

Signed-off-by: Jerin Jacob <jerinj@marvell.com>
Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
4 years agograph: implement node operations
Jerin Jacob [Sat, 11 Apr 2020 14:14:02 +0000 (19:44 +0530)]
graph: implement node operations

Adding node-specific API implementation like cloning node, updating
edges for the node, shrinking edges of a node, retrieving edges of a
node.

Signed-off-by: Jerin Jacob <jerinj@marvell.com>
Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
4 years agograph: implement node registration
Jerin Jacob [Sat, 11 Apr 2020 14:14:01 +0000 (19:44 +0530)]
graph: implement node registration

Adding rte_node_register() API implementation includes allocating
memory for node object, check for duplicate node name and
add the allocated node to STAILQ node_list for future use.

Signed-off-by: Jerin Jacob <jerinj@marvell.com>
Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
4 years agograph: define API
Jerin Jacob [Sat, 11 Apr 2020 14:14:00 +0000 (19:44 +0530)]
graph: define API

Graph architecture abstracts the data processing functions as
"node" and "link" them together to create a complex "graph" to enable
reusable/modular data processing functions.

These APIs enables graph framework operations such as create, lookup,
dump and destroy on graph and node operations such as clone,
edge update, and edge shrink, etc. The API also allows creating the
stats cluster to monitor per graph and per node stats.

This patch defines the public API for graph support.
This patch also adds support for the build infrastructure and
update the MAINTAINERS file for the graph subsystem.

Signed-off-by: Jerin Jacob <jerinj@marvell.com>
Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
4 years agomempool: return 0 if area is too small on populate
Olivier Matz [Mon, 4 May 2020 12:49:18 +0000 (14:49 +0200)]
mempool: return 0 if area is too small on populate

Change rte_mempool_populate_iova() and rte_mempool_populate_virt() to
return 0 instead of -EINVAL when there is not enough room to store one
object, as it can be helpful for applications to distinguish this
specific case.

As this is an ABI change, use symbol versioning to preserve old
behavior for binary applications.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
Acked-by: Lukasz Wojciechowski <l.wojciechow@partner.samsung.com>
4 years agoversion: reference next ABI 21 for recent additions
Ray Kinsella [Thu, 30 Apr 2020 10:27:26 +0000 (11:27 +0100)]
version: reference next ABI 21 for recent additions

Change references to ABI 20.0.1 to use ABI v21, see
https://doc.dpdk.org/guides/contributing/abi_policy.html#general-guidelines

"Major ABI versions are declared no more frequently than yearly.
Compatibility with the major ABI version is mandatory in subsequent
releases until a new major ABI version is declared."

Combined ABI policy and versioning in maintainers, add map files to the
filter to more closely monitor future ABI changes.

Signed-off-by: Ray Kinsella <mdr@ashroe.eu>
4 years agomaintainers: update for testpmd
Beilei Xing [Sun, 26 Apr 2020 08:21:53 +0000 (16:21 +0800)]
maintainers: update for testpmd

Replace Jingjing Wu with Beilei Xing.

Signed-off-by: Beilei Xing <beilei.xing@intel.com>
Acked-by: Jingjing Wu <jingjing.wu@intel.com>
4 years agomaintainers: update for Intel iavf
Beilei Xing [Sun, 26 Apr 2020 08:21:52 +0000 (16:21 +0800)]
maintainers: update for Intel iavf

Replace Wenzhuo Lu with Beilei Xing.

Signed-off-by: Beilei Xing <beilei.xing@intel.com>
Acked-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
4 years agomaintainers: update for Intel i40e
Beilei Xing [Sun, 26 Apr 2020 08:21:51 +0000 (16:21 +0800)]
maintainers: update for Intel i40e

Replace Qi Zhang with Jeff Guo.

Signed-off-by: Beilei Xing <beilei.xing@intel.com>
Acked-by: Jeff Guo <jia.guo@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
4 years agomaintainers: update for Intel ixgbe/igb/igc
Wei Zhao [Mon, 27 Apr 2020 01:28:59 +0000 (09:28 +0800)]
maintainers: update for Intel ixgbe/igb/igc

Replace Wenzhuo Lu, Alvin Zhang and Konstantin Ananyev
with Wei Zhao and Jeff Guo.

Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
Acked-by: Jeff Guo <jia.guo@intel.com>
Acked-by: Alvin Zhang <alvinx.zhang@intel.com>
4 years agoethdev: fix build warning on 64-bit value
David Marchand [Mon, 27 Apr 2020 13:23:41 +0000 (15:23 +0200)]
ethdev: fix build warning on 64-bit value

Building OVS with dpdk, sparse complains about 64-bit constant being
passed as a normal integer that can't fit it:
error: constant 0xffffffffffffffff is so big it is unsigned long

Fixes: ecbc8570131d ("ethdev: add PFCP header to flow API")

Signed-off-by: David Marchand <david.marchand@redhat.com>
Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
4 years agoeal: fix typo in endian conversion macros
David Marchand [Mon, 27 Apr 2020 13:23:40 +0000 (15:23 +0200)]
eal: fix typo in endian conversion macros

Caught by code inspection, for little endian, RTE_LEXX macros should
provide rte_leXX_t type values.

Fixes: b75667ef9f7e ("eal: add static endianness conversion macros")
Cc: stable@dpdk.org
Signed-off-by: David Marchand <david.marchand@redhat.com>
Reviewed-by: Bruce Richardson <bruce.richardson@intel.com>
4 years agoring: fix build with -Wswitch-enum
David Marchand [Mon, 27 Apr 2020 13:23:39 +0000 (15:23 +0200)]
ring: fix build with -Wswitch-enum

Some popular vswitch implementation might use a gcc option that
complains about missing enums in switch statements.
Fix this by listing all possible values.

Fixes: 664ff4b1729b ("ring: introduce peek style API")

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>