dpdk.git
3 years agonet/bnxt: fix resource cleanup
Ajit Khaparde [Thu, 8 Apr 2021 20:17:47 +0000 (13:17 -0700)]
net/bnxt: fix resource cleanup

Fix resource cleanup in port close.
Once the pointers are freed, set them to NULL.
Make sure access to the pointers is validated before use.

Fixes: bb81e07323bb ("net/bnxt: support LED on/off")
Fixes: 804e746c7b73 ("net/bnxt: add hardware resource manager init code")
Fixes: 1d0704f4d793 ("net/bnxt: add device configure operation")
Fixes: 698aa7e95325 ("net/bnxt: add code to determine the Tx COS queue")
Fixes: 322bd6e70272 ("net/bnxt: add port representor infrastructure")
Fixes: 0bf5a0b5ebb8 ("net/bnxt: add a failure log")
Cc: stable@dpdk.org
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
3 years agonet/bonding: fix adding itself as its slave
Chengchang Tang [Thu, 15 Apr 2021 07:09:54 +0000 (15:09 +0800)]
net/bonding: fix adding itself as its slave

Adding the bond device as its own slave should be forbidden. This
will cause a recursive endless loop in many subsequent operations,
and eventually lead to coredump.

This problem was found in testpmd, the related logs are as follows:
testpmd> create bonded device 1 0
Created new bonded device net_bonding_testpmd_0 on (port 4).
testpmd> add bonding slave 4 4
Segmentation fault (core dumped)

The call stack is as follows:
0x000000000064eb90 in rte_eth_dev_info_get ()
0x00000000006df4b4 in bond_ethdev_info ()
0x000000000064eb90 in rte_eth_dev_info_get ()
0x00000000006df4b4 in bond_ethdev_info ()
0x000000000064eb90 in rte_eth_dev_info_get ()
0x0000000000564e58 in eth_dev_info_get_print_err ()
0x000000000055e8a4 in init_port_config ()
0x000000000052730c in cmd_add_bonding_slave_parsed ()
0x0000000000646f60 in cmdline_parse ()
0x0000000000645e08 in cmdline_valid_buffer ()
0x000000000064956c in rdline_char_in ()
0x0000000000645ee0 in cmdline_in ()
0x00000000006460a4 in cmdline_interact ()
0x0000000000531904 in prompt ()
0x000000000051cca8 in main ()

Fixes: 2efb58cbab6e ("bond: new link bonding library")
Cc: stable@dpdk.org
Signed-off-by: Chengchang Tang <tangchengchang@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
3 years agoraw/ifpga/base: check size before assigning
Wei Huang [Thu, 8 Apr 2021 08:51:51 +0000 (04:51 -0400)]
raw/ifpga/base: check size before assigning

In max10_staging_area_init(), variable "size" from fdt_get_reg() may
be invalid, it should be checked before assigning to member variable
"staging_area_size" of structure "intel_max10_device".

Coverity issue: 367480, 367482
Fixes: 96ebfcf8125c ("raw/ifpga/base: add SPI and MAX10 device driver")
Cc: stable@dpdk.org
Signed-off-by: Wei Huang <wei.huang@intel.com>
Acked-by: Tianfei Zhang <tianfei.zhang@intel.com>
3 years agonet/hns3: move link speeds check to configure
Huisong Li [Sat, 17 Apr 2021 09:54:59 +0000 (17:54 +0800)]
net/hns3: move link speeds check to configure

This patch moves the check for "link_speeds" in dev_conf to
dev_configure, so that users know whether "link_speeds" is valid in
advance.

Fixes: bdaf190f8235 ("net/hns3: support link speed autoneg for PF")
Fixes: 400d307e1a60 ("net/hns3: support fixed link speed")

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
3 years agonet/hns3: fix flow director lock
Chengwen Feng [Sat, 17 Apr 2021 09:54:58 +0000 (17:54 +0800)]
net/hns3: fix flow director lock

Currently, the fdir lock was used to protect concurrent access in
multiple processes, it has the following problems:
1) Lack of protection for fdir reset recover.
2) Only part of data is protected, eg. the filterlist is not protected.

We use the following scheme:
1) Del the fdir lock.
2) Add a flow lock and provides rte flow driver ops API-level
   protection.
3) Declare support RTE_ETH_DEV_FLOW_OPS_THREAD_SAFE.

Fixes: fcba820d9b9e ("net/hns3: support flow director")
Cc: stable@dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
3 years agonet/hns3: fix VMDq mode check
Huisong Li [Sat, 17 Apr 2021 09:54:57 +0000 (17:54 +0800)]
net/hns3: fix VMDq mode check

HNS3 PF driver only supports RSS, DCB or NONE multiple queues mode.
Currently, driver doesn't verify the VMDq multi-queue mode completely.
This patch fixes the verification for VMDq mode.

Fixes: 62e3ccc2b94c ("net/hns3: support flow control")
Cc: stable@dpdk.org
Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
3 years agonet/hns3: fix DCB mode check
Huisong Li [Sat, 17 Apr 2021 09:54:56 +0000 (17:54 +0800)]
net/hns3: fix DCB mode check

Currently, "ONLY DCB" and "DCB+RSS" mode are both supported by HNS3
PF driver. But the driver verifies only the "DCB+RSS" multiple queues
mode.

Fixes: 62e3ccc2b94c ("net/hns3: support flow control")
Cc: stable@dpdk.org
Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
3 years agonet/hns3: remove redundant mailbox response
Huisong Li [Sat, 17 Apr 2021 09:54:55 +0000 (17:54 +0800)]
net/hns3: remove redundant mailbox response

Some mbx messages do not need to reply with data. In this case,
it is no need to set the response data address and the response
length.

This patch removes these redundant codes from mbx messages that do
not need be replied.

Fixes: a5475d61fa34 ("net/hns3: support VF")
Cc: stable@dpdk.org
Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
3 years agonet/hns3: add compile-time verification on Rx vector
Chengwen Feng [Sat, 17 Apr 2021 09:54:54 +0000 (17:54 +0800)]
net/hns3: add compile-time verification on Rx vector

Rx vector implementation depends on the mbuf fields
(such as rearm_data/rx_descriptor_fields1) layout, this patch adds
compile-time verification for this.

Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
3 years agoapp/testpmd: add commands for conntrack
Bing Zhao [Mon, 19 Apr 2021 17:51:31 +0000 (01:51 +0800)]
app/testpmd: add commands for conntrack

The command line for testing connection tracking is added. To create
a conntrack object, 3 parts are needed.
  set conntrack com peer ...
  set conntrack orig scale ...
  set conntrack rply scale ...
This will create a full conntrack action structure for the indirect
action. After the indirect action handle of "conntrack" created, it
could be used in the flow creation. Before updating, the same
structure is also needed together with the update command
"conntrack_update" to update the "dir" or "ctx".

After the flow with conntrack action created, the packet should jump
to the next flow for the result checking with conntrack item. The
state is defined with bits and a valid combination could be
supported.

Signed-off-by: Bing Zhao <bingz@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
3 years agoethdev: introduce conntrack flow action and item
Bing Zhao [Mon, 19 Apr 2021 17:51:30 +0000 (01:51 +0800)]
ethdev: introduce conntrack flow action and item

This commit introduces the conntrack action and item.

Usually the HW offloading is stateless. For some stateful offloading
like a TCP connection, HW module will help provide the ability of a
full offloading w/o SW participation after the connection was
established.

The basic usage is that in the first flow rule the application should
add the conntrack action and jump to the next flow table. In the
following flow rule(s) of the next table, the application should use
the conntrack item to match on the result.

A TCP connection has two directions traffic. To set a conntrack
action context correctly, the information of packets from both
directions are required.

The conntrack action should be created on one ethdev port and supply
the peer ethdev port as a parameter to the action. After context
created, it could only be used between these two ethdev ports
(dual-port mode) or a single port. The application should modify the
action via the API "rte_action_handle_update" only when before using
it to create a flow rule with conntrack for the opposite direction.
This will help the driver to recognize the direction of the flow to
be created, especially in the single-port mode, in which case the
traffic from both directions will go through the same ethdev port
if the application works as an "forwarding engine" but not an end
point. There is no need to call the update interface if the
subsequent flow rules have nothing to be changed.

Query will be supported via "rte_action_handle_query" interface,
about the current packets information and connection status. The
fields query capabilities depends on the HW.

For the packets received during the conntrack setup, it is suggested
to re-inject the packets in order to make sure the conntrack module
works correctly without missing any packet. Only the valid packets
should pass the conntrack, packets with invalid TCP information,
like out of window, or with invalid header, like malformed, should
not pass.

Naming and definition:
https://elixir.bootlin.com/linux/latest/source/include/uapi/linux/
        netfilter/nf_conntrack_tcp.h
https://elixir.bootlin.com/linux/latest/source/net/netfilter/
        nf_conntrack_proto_tcp.c

Other reference:
https://www.usenix.org/legacy/events/sec01/invitedtalks/rooij.pdf

Signed-off-by: Bing Zhao <bingz@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
3 years agoapp/testpmd: add packet ID for IP fragment
Jeff Guo [Tue, 13 Apr 2021 08:10:29 +0000 (16:10 +0800)]
app/testpmd: add packet ID for IP fragment

Add the new items to support the flow configuration for IP fragment
packets.

Signed-off-by: Ting Xu <ting.xu@intel.com>
Signed-off-by: Jeff Guo <jia.guo@intel.com>
Acked-by: Ori Kam <orika@nvidia.com>
3 years agonet/iavf: deprecate i40evf PMD
Robin Zhang [Mon, 19 Apr 2021 03:05:39 +0000 (03:05 +0000)]
net/iavf: deprecate i40evf PMD

The i40evf PMD will be deprecated, iavf will be the only VF driver for
Intel 700 serial (i40e) NIC family.

To reach this, there will be 2 steps:

Step 1: iavf will be the default VF driver, while i40evf still can be
selected by devarg: "driver=i40evf".
This is covered by this patch, which include:
1) add all 700 serial NIC VF device ID into iavf PMD
2) skip probe if devargs contain "driver=i40evf" in iavf
3) continue probe if devargs contain "driver=i40evf" in i40evf

Step 2: i40evf and related devarg are removed, this will happen at DPDK
21.11

Between step 1 and step 2, no new feature will be added into i40evf
except bug fix.

Signed-off-by: Robin Zhang <robinx.zhang@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Beilei Xing <beilei.xing@intel.com>
3 years agonet/mlx5: fix VLAN push/pop and decap actions with mirror
Jiawei Wang [Fri, 9 Apr 2021 12:36:42 +0000 (15:36 +0300)]
net/mlx5: fix VLAN push/pop and decap actions with mirror

Due to hardware limitations the VLAN push/pop and decap actions following
the sample action are supported in the FDB Tx steering domain only, the
flows with incorrect action order for other domains are rejected by
rdma-core.

To provide the action order requested in flow API this patch checks for
the VLAN or decap precedence to the sample action and moves the VLAN or
decap actions into the next flow in the new table and adds the jump
action in the prefix sample flow.

This patch also adds the validation for these combination actions.

Fixes: 255b8f86eb6e ("net/mlx5: fix E-Switch egress mirror flow validation")
Cc: stable@dpdk.org
Signed-off-by: Jiawei Wang <jiaweiw@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
3 years agonet/mlx5: support single flow dump
Haifei Luo [Thu, 15 Apr 2021 11:19:24 +0000 (14:19 +0300)]
net/mlx5: support single flow dump

Modify API mlx5_flow_dev_dump to support the feature.
Modify mlx5_socket since one extra arg flow_ptr is added.

The data structure sent to DPDK application from the utility triggering
the flow dumps should be packed and endianness must be specified.
The native host endianness can be used, all exchange happens within
the same host (we use sendmsg aux data and share the file handle,
remote approach is not applicable, no inter-host communication happens).

The message structure to dump one/all flow(s):
struct mlx5_flow_dump_req {
uint32_t port_id;
uint64_t flow_ptr;
} __rte_packed;

If flow_ptr is 0, all flows for the specified port will be dumped.

Signed-off-by: Haifei Luo <haifeil@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
3 years agocommon/mlx5: add functions for single flow dump
Haifei Luo [Thu, 15 Apr 2021 11:19:23 +0000 (14:19 +0300)]
common/mlx5: add functions for single flow dump

Add mlx5 APIs for single flow dump feature

Signed-off-by: Haifei Luo <haifeil@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
3 years agonet/hns3: check max SIMD bitwidth
Chengwen Feng [Thu, 15 Apr 2021 03:52:02 +0000 (11:52 +0800)]
net/hns3: check max SIMD bitwidth

This patch supports check max SIMD bitwidth when choosing NEON and SVE
vector path.

Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
3 years agonet/hns3: simplify Rx checksum
Chengwen Feng [Thu, 15 Apr 2021 03:52:01 +0000 (11:52 +0800)]
net/hns3: simplify Rx checksum

Currently, the L3L4P/L3E/L4E/OL3E/OL4E fields in Rx descriptor used to
indicate hardware checksum result:
1. L3L4P: indicates hardware has processed L3L4 checksum for this
   packet, if this bit is 1 then L3E/L4E/OL3E/OL4E is trustable.
2. L3E: L3 checksum error indication, 1 means with error.
3. L4E: L4 checksum error indication, 1 means with error.
4. OL3E: outer L3 checksum error indication, 1 means with error.
5. OL4E: outer L4 checksum error indication, 1 means with error.

Driver will set the good checksum flag through packet type and
L3E/L4E/OL3E/OL4E when L3L4P is 1, it runs as follows:
1. If packet type indicates it's tunnel packet:
1.1. If packet type indicates it has inner L3 and L3E is zero, then
mark the IP checksum good.
1.2. If packet type indicates it has inner L4 and L4E is zero, then
mark the L4 checksum good.
1.3. If packet type indicates it has outer L4 and OL4E is zero, then
mark the outer L4 checksum good.
2. If packet type indicates it's not tunnel packet:
2.1. If packet type indicates it has L3 and L3E is zero, then mark the
IP checksum good.
2.2. If packet type indicates it has L4 and L4E is zero, then mark the
L4 checksum good.

As described above, the good checksum calculation is time consuming,
it impacts the Rx performance.

By balancing performance and functionality, driver uses the following
scheme to set good checksum flag when L3L4P is 1:
1. If L3E is zero, then mark the IP checksum good.
2. If L4E is zero, then mark the L4 checksum good.

The performance gains are 3% in small packet iofwd scenarios.

Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
3 years agonet/hns3: support masking device capability
Chengwen Feng [Thu, 15 Apr 2021 03:52:00 +0000 (11:52 +0800)]
net/hns3: support masking device capability

This patch supports runtime config of mask device capability, it was
used to mask the capability which queried from firmware.

The device argument key is "dev_caps_mask" which takes hexadecimal
bitmask where each bit represents whether mask corresponding capability.

Its main purpose is to debug and avoid problems.

Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
3 years agoapp/testpmd: support integrity flow item
Ori Kam [Mon, 19 Apr 2021 12:44:31 +0000 (15:44 +0300)]
app/testpmd: support integrity flow item

The integrity item allows the application to match
on the integrity of a packet.

Usage example:
match that packet integrity checks are OK. The checks depend on
packet layers. For example ICMP packet will not check L4 level.
flow create 0 ingress pattern integrity value mask 0x01 value spec 0x01

Match that L4 packet is OK - check L2 & L3 & L4 layers:
flow create 0 ingress pattern integrity value mask 0xfe value spec 0xfe

Signed-off-by: Ori Kam <orika@nvidia.com>
Signed-off-by: Gregory Etelson <getelson@nvidia.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
3 years agoethdev: add packet integrity check flow rules
Ori Kam [Mon, 19 Apr 2021 12:44:30 +0000 (15:44 +0300)]
ethdev: add packet integrity check flow rules

Currently, DPDK application can offload the checksum check,
and report it in the mbuf.

However, as more and more applications are offloading some or all
logic and action to the HW, there is a need to check the packet
integrity so the right decision can be taken.

The application logic can be positive meaning if the packet is
valid jump / do  actions, or negative if packet is not valid
jump to SW / do actions (like drop) and add default flow
(match all in low priority) that will direct the miss packet
to the miss path.

Since currently rte_flow works in positive way the assumption is
that the positive way will be the common way in this case also.

When thinking what is the best API to implement such feature,
we need to consider the following (in no specific order):
1. API breakage.
2. Simplicity.
3. Performance.
4. HW capabilities.
5. rte_flow limitation.
6. Flexibility.

First option: Add integrity flags to each of the items.
For example add checksum_ok to IPv4 item.

Pros:
1. No new rte_flow item.
2. Simple in the way that on each item the app can see
what checks are available.

Cons:
1. API breakage.
2. Increase number of flows, since app can't add global rule and must
   have dedicated flow for each of the flow combinations, for example
   matching on ICMP traffic or UDP/TCP  traffic with IPv4 / IPv6 will
   result in 5 flows.

Second option: dedicated item

Pros:
1. No API breakage, and there will be no for some time due to having
   extra space. (by using bits)
2. Just one flow to support the ICMP or UDP/TCP traffic with IPv4 /
   IPv6.
3. Simplicity application can just look at one place to see all possible
   checks.
4. Allow future support for more tests.

Cons:
1. New item, that holds number of fields from different items.

For starter the following bits are suggested:
1. packet_ok - means that all HW checks depending on packet layer have
   passed. This may mean that in some HW such flow should be split to
   number of flows or fail.
2. l2_ok - all check for layer 2 have passed.
3. l3_ok - all check for layer 3 have passed. If packet doesn't have
   L3 layer this check should fail.
4. l4_ok - all check for layer 4 have passed. If packet doesn't
   have L4 layer this check should fail.
5. l2_crc_ok - the layer 2 CRC is O.K.
6. ipv4_csum_ok - IPv4 checksum is O.K. It is possible that the
   IPv4 checksum will be O.K. but the l3_ok will be 0. It is not
   possible that checksum will be 0 and the l3_ok will be 1.
7. l4_csum_ok - layer 4 checksum is O.K.
8. l3_len_OK - check that the reported layer 3 length is smaller than the
   frame length.

Example of usage:
1. Check packets from all possible layers for integrity.
   flow create integrity spec packet_ok = 1 mask packet_ok = 1 .....

2. Check only packet with layer 4 (UDP / TCP)
   flow create integrity spec l3_ok = 1, l4_ok = 1 mask l3_ok = 1
   l4_ok = 1

Signed-off-by: Ori Kam <orika@nvidia.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
3 years agodoc: update matching versions in ice guide
Qi Zhang [Wed, 24 Mar 2021 13:02:50 +0000 (21:02 +0800)]
doc: update matching versions in ice guide

Updated ice recommended matching list for DPDK 21.02.

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
3 years agodoc: fix matching versions in ice guide
Qi Zhang [Wed, 24 Mar 2021 13:02:49 +0000 (21:02 +0800)]
doc: fix matching versions in ice guide

Fixed matching kernel driver version for DPDK 20.11.

Fixes: e89aebf3b597 ("doc: update ice user guide")
Cc: stable@dpdk.org
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
3 years agoapp/testpmd: add link autoneg status display
Huisong Li [Thu, 15 Apr 2021 06:45:15 +0000 (14:45 +0800)]
app/testpmd: add link autoneg status display

This patch adds link autoneg status display in port_infos_display().

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
Acked-by: Xiaoyun Li <xiaoyun.li@intel.com>
3 years agoethdev: introduce indirect flow action
Bing Zhao [Mon, 19 Apr 2021 14:38:29 +0000 (22:38 +0800)]
ethdev: introduce indirect flow action

Right now, rte_flow_shared_action_* APIs are used for some shared
actions, like RSS, count. The shared action should be created before
using it inside a flow. These shared actions sometimes are not
really shared but just some indirect actions decoupled from a flow.

The new functions rte_flow_action_handle_* are added to replace
the current shared functions rte_flow_shared_action_*.

There are two types of flow actions:
1. the direct (normal) actions that could be created and stored
   within a flow rule. Such action is tied to its flow rule and
   cannot be reused.
2. the indirect action, in the past, named shared_action. It is
   created from a direct actioni, like count or rss, and then used
   in the flow rules with an object handle. The PMD will take care
   of the retrieve from indirect action to the direct action
   when it is referenced.

The indirect action is accessed (update / query) w/o any flow rule,
just via the action object handle. For example, when querying or
resetting a counter, it could be done out of any flow using this
counter, but only the handle of the counter action object is
required.
The indirect action object could be shared by different flows or
used by a single flow, depending on the direct action type and
the real-life requirements.
The handle of an indirect action object is opaque and defined in
each driver and possibly different per direct action type.

The old name "shared" is improper in a sense and should be replaced.

Since the APIs are changed from "rte_flow_shared_action*" to the new
"rte_flow_action_handle*", the testpmd application code and command
line interfaces also need to be updated to do the adaption.
The testpmd application user guide is also updated. All the "shared
action" related parts are replaced with "indirect action" to have a
correct explanation.

The parameter of "update" interface is also changed. A general
pointer will replace the rte_flow_action struct pointer due to the
facts:
1. Some action may not support fields updating. In the example of a
   counter, the only "update" supported should be the reset. So
   passing a rte_flow_action struct pointer is meaningless and
   there is even no such corresponding action struct. What's more,
   if more than one operations should be supported, for some other
   action, such pointer parameter may not meet the need.
2. Some action may need conditional or partial update, the current
   parameter will not provide the ability to indicate which part(s)
   to update.
   For different types of indirect action objects, the pointer could
   either be the same of rte_flow_action* struct - in order not to
   break the current driver implementation, or some wrapper
   structures with bits as masks to indicate which part to be
   updated, depending on real needs of the corresponding direct
   action. For different direct actions, the structures of indirect
   action objects updating will be different.

All the underlayer PMD callbacks will be moved to these new APIs.

The RTE_FLOW_ACTION_TYPE_SHARED is kept for now in order not to
break the ABI. All the implementations are changed by using
RTE_FLOW_ACTION_TYPE_INDIRECT.

Since the APIs are changed from "rte_flow_shared_action*" to the new
"rte_flow_action_handle*" and the "update" interface's 3rd input
parameter is changed to generic pointer, the mlx5 PMD that uses these
APIs needs to do the adaption to the new APIs as well.

Signed-off-by: Bing Zhao <bingz@nvidia.com>
Acked-by: Andrey Vesnovaty <andreyv@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
3 years agonet/hns3: support RAS process in Kunpeng 930
Hongbo Zheng [Mon, 19 Apr 2021 07:36:44 +0000 (15:36 +0800)]
net/hns3: support RAS process in Kunpeng 930

Kunpeng 930 uses a new RAS exception reporting solution.
The reset type and exception status are reported through
firmware. The driver modifies the corresponding code to
adapt to the new solution.

Signed-off-by: Hongbo Zheng <zhenghongbo3@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
3 years agonet/hns3: remove unused macros
Min Hu (Connor) [Mon, 19 Apr 2021 08:13:31 +0000 (16:13 +0800)]
net/hns3: remove unused macros

'HNS3_RXD_TSIND_S' and 'HNS3_RXD_TSIND_M' is unused, which should
be deleted.

This patch fixed it.

Fixes: bba636698316 ("net/hns3: support Rx/Tx and related operations")
Cc: stable@dpdk.org
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
3 years agodoc: add Kunpeng 930 support in hns3 guide
Min Hu (Connor) [Mon, 19 Apr 2021 08:36:59 +0000 (16:36 +0800)]
doc: add Kunpeng 930 support in hns3 guide

Hns3 PMD has already supported Kunpeng 930 SoC.

This patch added description for it.

Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
3 years agoethdev: add queue state in queried queue information
Lijun Ou [Mon, 19 Apr 2021 08:57:30 +0000 (16:57 +0800)]
ethdev: add queue state in queried queue information

Currently, upper-layer application could get queue state only
through pointers such as dev->data->tx_queue_state[queue_id],
this is not the recommended way to access it. So this patch
add get queue state when call rte_eth_rx_queue_info_get and
rte_eth_tx_queue_info_get API.

Note: After add queue_state field, the 'struct rte_eth_rxq_info' size
remains 128B, and the 'struct rte_eth_txq_info' size remains 64B, so
it could be ABI compatible.

Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Signed-off-by: Lijun Ou <oulijun@huawei.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
3 years agodoc: fix HiSilicon copyright syntax
Min Hu (Connor) [Fri, 16 Apr 2021 10:34:29 +0000 (18:34 +0800)]
doc: fix HiSilicon copyright syntax

This patch fixes HiSilicon copyright syntax.

According to the suggestion of our legal department,
to standardize the copyright license of our code to
avoid potential copyright risks, we make a unified
modification to the "Hisilicon", which was nonstandard,
in the main modules we maintain.

We change it to "HiSilicon", which is consistent with
the terms used on the following official website:
https://www.hisilicon.com/en/terms-of-use.

Fixes: 565829db8b8f ("net/hns3: add build and doc infrastructure")
Cc: stable@dpdk.org
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
3 years agodoc: remove queue stats mapping from testpmd guide
Huisong Li [Fri, 16 Apr 2021 10:34:28 +0000 (18:34 +0800)]
doc: remove queue stats mapping from testpmd guide

The "--tx-queue-stats-mapping" and "--rx-queue-stats-mapping"
and display and clear of "stats_map" have been removed from
testpmd.

This patch deletes some descriptions about queue stats mapping
in testpmd doc.

Fixes: 08dcd1870686 ("app/testpmd: fix queue stats mapping configuration")
Cc: stable@dpdk.org
Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
3 years agoexamples/l3fwd: skip Tx queue drain on first FIB iteration
Conor Walsh [Wed, 21 Apr 2021 12:48:42 +0000 (12:48 +0000)]
examples/l3fwd: skip Tx queue drain on first FIB iteration

The commit a8f8b672d575 ("examples/l3fwd: skip Tx queue drain on first iteration")
implemented a change to the EM and LPM lookup methods to
prevent the Tx queue drain running in the first iteration of their
packet processing loops.

This patch applies the same change into the new FIB lookup method.

Signed-off-by: Conor Walsh <conor.walsh@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>
3 years agoexamples/ethtool: remove unused parsing
Chengwen Feng [Wed, 21 Apr 2021 02:39:43 +0000 (10:39 +0800)]
examples/ethtool: remove unused parsing

The new_mtu was assigned twice, the first assignment could be removed.

Fixes: bda68ab9d1e7 ("examples/ethtool: add user-space ethtool sample application")
Cc: stable@dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
3 years agoexamples: add eal cleanup to examples
Chengchang Tang [Thu, 15 Apr 2021 02:26:03 +0000 (10:26 +0800)]
examples: add eal cleanup to examples

According to the programming guide, the rte_eal_init should be used pairs
with rte_eal_cleanup.

This patch add rte_eal_cleanup to examples to encourage new users of
DPDK to use it.

Fixes: aec9c13c5257 ("eal: add function to release internal resources")
Fixes: 3d0fad56b74a ("examples/fips_validation: add crypto FIPS application")
Fixes: c8e6ceecebc1 ("examples/ioat: add new sample app for ioat driver")
Fixes: 4ff457986f76 ("examples/l2fwd-event: add default poll mode routines")
Fixes: 08bd1a174461 ("examples/l3fwd-graph: add graph-based l3fwd skeleton")
Fixes: c5eebf85badc ("examples/ntb: add example for NTB")
Fixes: b77f66002812 ("examples/pipeline: add new example application")
Fixes: edbed86d1cc3 ("examples/vdpa: introduce a new sample for vDPA")
Fixes: c19beb3f38cd ("examples/vhost_blk: introduce vhost storage sample")
Fixes: f5188211c721 ("examples/vhost_crypto: add sample application")
Cc: stable@dpdk.org
Signed-off-by: Chengchang Tang <tangchengchang@huawei.com>
3 years agotelemetry: fix build on FreeBSD < 12.2
Thomas Monjalon [Wed, 21 Apr 2021 17:51:24 +0000 (19:51 +0200)]
telemetry: fix build on FreeBSD < 12.2

The function pthread_setname_np() was originally not available on
FreeBSD. It has been added in FreeBSD 12.2:
https://svnweb.freebsd.org/base?view=revision&revision=362264

The EAL implementation of rte_thread_setname() is duplicated
in the telemetry library, which does not depend on EAL,
so the compilation is safe in all systems.

Fixes: 5da7736f8c53 ("telemetry: set socket listener thread name")

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
3 years agotest/power: round CPU frequency to check
Richael Zhuang [Thu, 15 Apr 2021 05:59:30 +0000 (13:59 +0800)]
test/power: round CPU frequency to check

The value in "/sys/.../cpuinfo_cur_freq" may not be exactly the
same as what was set. For example, if "2400000" is written to
"/sys/.../cpufreq/scaling_setspeed" to set the frequency, then the
value in "/sys/.../cpuinfo_cur_freq" may be "2401222". So need to
round the value.

Fixes: ed7c51a6a680 ("app/test: vm power management")
Cc: stable@dpdk.org
Signed-off-by: Richael Zhuang <richael.zhuang@arm.com>
Reviewed-by: David Hunt <david.hunt@intel.com>
3 years agotest/power: add delay before checking CPU frequency
Richael Zhuang [Thu, 15 Apr 2021 05:59:29 +0000 (13:59 +0800)]
test/power: add delay before checking CPU frequency

For some platforms the newly-set frequency may not be effective
immediately. If we didn't get the right value from cpuinfo_cur_freq
immediately, add 10ms delay each time before rechecking until
timeout.

From our test, for some arm platforms, it requires up to 700ms when
going from a minimum to a maximum frequency. And it's not the
driver/software issue.

Fixes: ed7c51a6a680 ("app/test: vm power management")
Cc: stable@dpdk.org
Signed-off-by: Richael Zhuang <richael.zhuang@arm.com>
Reviewed-by: David Hunt <david.hunt@intel.com>
3 years agotest/bpf: fix error message
Min Hu (Connor) [Wed, 21 Apr 2021 11:36:53 +0000 (19:36 +0800)]
test/bpf: fix error message

This patch fixed wrong error variable in logging message.

Fixes: 83633ba23076 ("test/bpf: fix few small issues")
Cc: stable@dpdk.org
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
3 years agocommon/dpaax: fix possible null pointer access
Chengwen Feng [Wed, 21 Apr 2021 02:46:53 +0000 (10:46 +0800)]
common/dpaax: fix possible null pointer access

This patch fixes possible null pointer access when dump iova table.

Fixes: 2f3d633aa593 ("common/dpaax: add library for PA/VA translation table")
Cc: stable@dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
3 years agosched: fix traffic class oversubscription parameter
Savinay Dharmappa [Wed, 21 Apr 2021 06:50:01 +0000 (07:50 +0100)]
sched: fix traffic class oversubscription parameter

This patch fixes the traffic class oversubscription watermark
value by initialising it with computed value of maximum watermark.

Fixes: ac6fcb841b0f ("sched: update subport rate dynamically")
Cc: stable@dpdk.org
Signed-off-by: Savinay Dharmappa <savinay.dharmappa@intel.com>
Acked-by: Jasvinder Singh <jasvinder.singh@intel.com>
3 years agoip_frag: fix fragmenting IPv4 packet with header option
Pu Xu [Thu, 25 Mar 2021 11:11:30 +0000 (19:11 +0800)]
ip_frag: fix fragmenting IPv4 packet with header option

When fragmenting IPv4 packet, the data offset should be calculated through
the IHL field in IP header rather than using sizeof(struct rte_ipv4_hdr).

Fixes: 4c38e5532a07 ("ip_frag: refactor IPv4 fragmentation into a proper library")
Cc: stable@dpdk.org
Signed-off-by: Pu Xu <583493798@qq.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
3 years agotest: check thread creation
Chengwen Feng [Fri, 16 Apr 2021 08:18:26 +0000 (16:18 +0800)]
test: check thread creation

There was a call for thread create function without result check.
Add result check and message print out after failure.

Fixes: 086eb64db39e ("test/pdump: add unit test for pdump library")
Cc: stable@dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
Acked-by: Reshma Pattan <reshma.pattan@intel.com>
3 years agotelemetry: check thread creations
Chengwen Feng [Fri, 16 Apr 2021 08:18:25 +0000 (16:18 +0800)]
telemetry: check thread creations

Add result check and message print out for thread creation after
failure.

Fixes: b80fe1805eee ("telemetry: introduce backward compatibility")
Fixes: 6dd571fd07c3 ("telemetry: introduce new functionality")
Cc: stable@dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
Acked-by: Ciara Power <ciara.power@intel.com>
3 years agoexamples/vhost_blk: set control worker thread name
Chengwen Feng [Sat, 17 Apr 2021 09:09:48 +0000 (17:09 +0800)]
examples/vhost_blk: set control worker thread name

This patch supports set ctrl worker thread name which is helpful for
debugging.

Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
3 years agoexamples/performance-thread: set thread names
Chengwen Feng [Sat, 17 Apr 2021 09:09:46 +0000 (17:09 +0800)]
examples/performance-thread: set thread names

This patch supports set helloworld thread name which is helpful for
debugging.

Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
3 years agovdpa/ifc: set notify and vring relay thread names
Chengwen Feng [Sat, 17 Apr 2021 09:09:44 +0000 (17:09 +0800)]
vdpa/ifc: set notify and vring relay thread names

This patch supports set notify and vring relay thread name which is
helpful for debugging.

Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
3 years agoraw/ifpga: set monitor thread name
Chengwen Feng [Sat, 17 Apr 2021 09:09:45 +0000 (17:09 +0800)]
raw/ifpga: set monitor thread name

This patch supports set monitor thread name which is helpful for
debugging.

Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
3 years agonet/ice: set VSI reset thread name
Chengwen Feng [Sat, 17 Apr 2021 09:09:43 +0000 (17:09 +0800)]
net/ice: set VSI reset thread name

This patch supports set VSI reset thread name which is helpful for
debugging.

Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
3 years agonet/ark: set generator delay thread name
Chengwen Feng [Sat, 17 Apr 2021 09:09:42 +0000 (17:09 +0800)]
net/ark: set generator delay thread name

This patch supports set delay packet generator start thread name which
is helpful for debugging.

Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
3 years agotelemetry: set socket listener thread name
Chengwen Feng [Sat, 17 Apr 2021 09:09:47 +0000 (17:09 +0800)]
telemetry: set socket listener thread name

This patch supports set init threads name which is helpful for
debugging.

Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
3 years agolib: allow disabling optional libraries
Bruce Richardson [Tue, 20 Apr 2021 10:22:32 +0000 (11:22 +0100)]
lib: allow disabling optional libraries

Add support for the disable_libs option, to allow disabling the build of
particular libraries. As part of this, maintain a list of what libraries
can safely be disabled, without breaking the build - for now this list is
solely those libraries which are not built on FreeBSD, kni, power and
vhost. This list can be expanded by future patches.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
3 years agodevtools: add script to ease backport of renamed files
Bruce Richardson [Tue, 20 Apr 2021 10:22:31 +0000 (11:22 +0100)]
devtools: add script to ease backport of renamed files

With all the library folders renamed to remove the "librte_" prefix,
we need to fixup patches for easier backport, i.e. add back in the
prefix for any references to those renamed files.

In the script itself we use a general approach to allow other functions
to be added in future for other modifications needed to patches.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
3 years agolib: remove librte_ prefix from directory names
Bruce Richardson [Tue, 20 Apr 2021 10:22:30 +0000 (11:22 +0100)]
lib: remove librte_ prefix from directory names

There is no reason for the DPDK libraries to all have 'librte_' prefix on
the directory names. This prefix makes the directory names longer and also
makes it awkward to add features referring to individual libraries in the
build - should the lib names be specified with or without the prefix.
Therefore, we can just remove the library prefix and use the library's
unique name as the directory name, i.e. 'eal' rather than 'librte_eal'

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
3 years agodoc: add Meson coding style to contributors guide
Bruce Richardson [Tue, 20 Apr 2021 10:22:29 +0000 (11:22 +0100)]
doc: add Meson coding style to contributors guide

To help with consistency across all files, add a section to the
contributors guide on meson coding style. Although short, this covers
the basics for now, and can be extended in future as we see the need.

Meson style guide recommends four-space indents, like for python,
so add to editorconfig file.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
3 years agobuild: change indentation in infrastructure files
Bruce Richardson [Tue, 20 Apr 2021 10:22:23 +0000 (11:22 +0100)]
build: change indentation in infrastructure files

Switch from using tabs to 4 spaces for meson.build indentation, for the
basic infrastructure and tooling files, as well as doc and kernel
directories.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
3 years agoexamples: reduce indentation in build files
Bruce Richardson [Tue, 20 Apr 2021 10:22:22 +0000 (11:22 +0100)]
examples: reduce indentation in build files

As with the lib and drivers directories, we can use "continue" keyword to
reduce the indentation level of the majority of the foreach block. At the
same time, we can also replace tab indentation with spaces.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
3 years agoapp: reduce indentation in build files
Bruce Richardson [Tue, 20 Apr 2021 10:22:21 +0000 (11:22 +0100)]
app: reduce indentation in build files

As with the lib and drivers directories, we can use "continue" keyword to
reduce the indentation level of the majority of the foreach block. At the
same time, we can also replace tab indentation with spaces.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
3 years agodrivers: change indentation in build files
Bruce Richardson [Tue, 20 Apr 2021 10:22:25 +0000 (11:22 +0100)]
drivers: change indentation in build files

Switch from using tabs to 4 spaces for meson.build indentation.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
3 years agodrivers: clean up build lists
Bruce Richardson [Tue, 20 Apr 2021 10:22:20 +0000 (11:22 +0100)]
drivers: clean up build lists

Ensure all lists of drivers are standardized:
* one driver per line
* lists double-indented with spaces (as they are line continuations)
* elements in alphabetical order
* opening and closing list brackets "[" & "]" on own lines
* last element has trailing comma

Any code snippets in the list files is adjusted to single-indent using
whitespace to correspond to the new style also.

The lists of standard library dependencies per class, and other short
lists are not formatted one-per-line as these lists are not expected to
grow beyond 2 or 3 entries.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
3 years agodrivers: simplify main build file
Bruce Richardson [Tue, 20 Apr 2021 10:22:19 +0000 (11:22 +0100)]
drivers: simplify main build file

As with the library meson.build file, we can use the "continue" keyword to
reduce the level of indentation used for the majority of the build file.
Since we are changing the whitespace indentation level, we also update the
body of the foreach loop to use the meson standard, 4-space indentation.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
3 years agolib: clean up build files
Bruce Richardson [Tue, 20 Apr 2021 10:22:24 +0000 (11:22 +0100)]
lib: clean up build files

Switch from using tabs to 4 spaces for meson.build indentation. Perform
other formatting cleanups such as ensure that long lists of files are one
per line, and terminating with a final comma before the closing brace to
make addition/removals easier. In some cases, reorder lists of items
where they were not in alphabetical order.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
3 years agolib: tidy up build list
Bruce Richardson [Tue, 20 Apr 2021 10:22:18 +0000 (11:22 +0100)]
lib: tidy up build list

With the lib/meson.build file changed from C-style indentation to
python-style indentation, we need to correct the indentation of the lists
of libraries, since these libs were not modified in the previous patches.
For ease of management of the list and working with patches for adding
to the list, put each library on it's own line.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
3 years agolib: simplify main build file
Bruce Richardson [Tue, 20 Apr 2021 10:22:17 +0000 (11:22 +0100)]
lib: simplify main build file

Two simplifications can be made to the build file which reduce indentation
levels and make it easier to read:

1. When meson build support was first added, the compat library existed in
DPDK as a single header file. Since that header has been merged into EAL,
we no longer need to support header-only libraries, so can shorten the
code.

2. From meson 0.49 onwards we have the "continue" keyword available to
break out of one loop iteration and begin the next. This allows us to
remove blocks in the build configuration file which were conditional on the
"build" variable being true. Instead we can use "continue" to abort
processing at the point where the "build" value becomes false.

Since this patch changes the indentation level of large parts of the
meson.build file, we use the opportunity to adjust the whitespace used to
the meson-standard 4-spec indentation level.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
3 years agopipeline: fix build with GCC 4.8.5
Ali Alnubani [Wed, 21 Apr 2021 10:06:38 +0000 (13:06 +0300)]
pipeline: fix build with GCC 4.8.5

Compilation on CentOS 7 with gcc version 4.8.5 fails with
the following errors:
error: 'src_struct_id' may be used uninitialized in this
function [-Werror=maybe-uninitialized]
error: 'dst_struct_id' may be used uninitialized in this
function [-Werror=maybe-uninitialized]

This patch fixes the build errors by initializing both variables.

Bugzilla ID: 683
Fixes: 783768136f29 ("pipeline: auto-detect endianness of action arguments")

Signed-off-by: Ali Alnubani <alialnu@nvidia.com>
3 years agokni: fix kernel deadlock with bifurcated device
Elad Nachman [Mon, 29 Mar 2021 14:36:55 +0000 (15:36 +0100)]
kni: fix kernel deadlock with bifurcated device

KNI runs userspace callback with rtnl lock held, this is not working
fine with some devices that needs to interact with kernel interface in
the callback, like Mellanox devices.

The solution is releasing the rtnl lock before calling the userspace
callback. But it requires two consideration:

1. The rtnl lock needs to released before 'kni->sync_lock', otherwise it
   causes deadlock with multiple KNI devices, please check below the A.
   for the details of the deadlock condition.

2. When rtnl lock is released for interface down event, it cause a
   regression and deadlock, so can't release the rtnl lock for interface
   down event, please check below B. for the details.

As a solution, interface down event is handled asynchronously and for
all other events rtnl lock is released before processing the callback.

A. KNI sync lock is being locked while rtnl is held.
If two threads are calling kni_net_process_request() ,
then the first one will take the sync lock, release rtnl lock then sleep.
The second thread will try to lock sync lock while holding rtnl.
The first thread will wake, and try to lock rtnl, resulting in a
deadlock.  The remedy is to release rtnl before locking the KNI sync
lock.
Since in between nothing is accessing Linux network-wise, no rtnl
locking is needed.

B. There is a race condition in __dev_close_many() processing the
close_list while the application terminates.
It looks like if two KNI interfaces are terminating,
and one releases the rtnl lock, the other takes it,
updating the close_list in an unstable state,
causing the close_list to become a circular linked list,
hence list_for_each_entry() will endlessly loop inside
__dev_close_many() .

To summarize:
request != interface down : unlock rtnl, send request to user-space,
wait for response, send the response error code to caller in user-space.

request == interface down: send request to user-space, return immediately
with error code of 0 (success) to user-space.

Fixes: 3fc5ca2f6352 ("kni: initial import")
Cc: stable@dpdk.org
Signed-off-by: Elad Nachman <eladv6@gmail.com>
3 years agokni: support async user request
Elad Nachman [Mon, 29 Mar 2021 14:36:54 +0000 (15:36 +0100)]
kni: support async user request

Adding async userspace requests which don't wait for the userspace
response and always return success. This is preparation to address a
regression in KNI.

Signed-off-by: Elad Nachman <eladv6@gmail.com>
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
3 years agokni: refactor user request processing
Stephen Hemminger [Mon, 29 Mar 2021 14:36:53 +0000 (15:36 +0100)]
kni: refactor user request processing

Refactor the parameter kni_net_process_request() gets, this is
preparation for addressing a user request processing deadlock problem.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: Elad Nachman <eladv6@gmail.com>
3 years agotest/cmdline: silence clang 12 warning
Kevin Traynor [Tue, 20 Apr 2021 13:21:50 +0000 (14:21 +0100)]
test/cmdline: silence clang 12 warning

clang 12 gives a warning about string concatenation in arrays.
In this case, as it is a long string test the strings are concatenated.
Add parentheses to indicate this.

$ clang --version
clang version 12.0.0 (Fedora 12.0.0-0.3.rc1.fc34)

../app/test/test_cmdline_num.c:204:5: warning:
suspicious concatenation of string literals in an array initialization;
did you mean to separate the elements with a comma?
[-Wstring-concatenation]
"1111000011110000111100001111000011110000111100001111000011110000",
^
../app/test/test_cmdline_num.c:203:3: note:
place parentheses around the string literal to silence warning
"0b1111000011110000111100001111000011110000111100001111000011110000"
^

Signed-off-by: Kevin Traynor <ktraynor@redhat.com>
3 years agotest/cmdline: fix inputs array
Kevin Traynor [Tue, 20 Apr 2021 13:21:49 +0000 (14:21 +0100)]
test/cmdline: fix inputs array

clang 12 gives a warning about string concatenation in arrays.
In this case it looks like it was unintentional to concatenate
the strings. Separate with a comma.

$ clang --version
clang version 12.0.0 (Fedora 12.0.0-0.3.rc1.fc34)

../app/test/test_cmdline_ipaddr.c:259:3: warning:
suspicious concatenation of string literals in an array initialization;
did you mean to separate the elements with a comma?
[-Wstring-concatenation]
"random invalid text",
^
../app/test/test_cmdline_ipaddr.c:258:3: note:
place parentheses around the string literal to silence warning
"1234:1234:1234:1234:1234:1234:1234:1234:1234:1234:1234"
^

Signed-off-by: Kevin Traynor <ktraynor@redhat.com>
3 years agoconfig/arm: add Marvell CN10K
Pavan Nikhilesh [Mon, 19 Apr 2021 20:39:47 +0000 (02:09 +0530)]
config/arm: add Marvell CN10K

Add config support to cross compile for Marvell CN10K SoC.
Marvell CN10K SoC is based on ARM Neoverse N2 cores.

Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
3 years agomem: fix cleanup after incomplete initialization
Dmitry Kozlyuk [Fri, 9 Apr 2021 17:16:31 +0000 (20:16 +0300)]
mem: fix cleanup after incomplete initialization

In case of EAL initialization failure rte_eal_memory_detach() may be
called before mapping memory configuration, which in this case points
to the static structure. Attempt to unmap it yields error:

    EAL: Could not unmap shared memory config: Invalid argument

Skip unmapping memory configuration if it's not yet shared.

Fixes: dfbc61a2f9a6 ("mem: detach memsegs on cleanup")

Reported-by: David Marchand <david.marchand@redhat.com>
Signed-off-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
3 years agohash: add predictable RSS
Vladimir Medvedkin [Mon, 19 Apr 2021 15:59:51 +0000 (16:59 +0100)]
hash: add predictable RSS

This patch adds predictable RSS API.
It is based on the idea of searching partial Toeplitz hash collisions.

Signed-off-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Yipeng Wang <yipeng1.wang@intel.com>
Acked-by: John McNamara <john.mcnamara@intel.com>
3 years agodoc: add Toeplitz hash guide
Vladimir Medvedkin [Mon, 19 Apr 2021 15:59:54 +0000 (16:59 +0100)]
doc: add Toeplitz hash guide

Add documentation for the Toeplitz hash library.

Signed-off-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>
Reviewed-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Reviewed-by: John McNamara <john.mcnamara@intel.com>
3 years agopipeline: auto-detect endianness of action arguments
Cristian Dumitrescu [Sun, 11 Apr 2021 23:23:38 +0000 (00:23 +0100)]
pipeline: auto-detect endianness of action arguments

Each table entry is made up of match fields and action data, with the
latter made up of the action ID and the action arguments. The approach
of having the user specify explicitly the endianness of the action
arguments is difficult to be picked up by P4 compilers, as the P4
compiler is generally unaware about this aspect.

This commit introduces the auto-detection of the endianness of the
action arguments by examining the endianness of the their destination:
network byte order (NBO) when they get copied to headers and host byte
order (HBO) when they get copied to packet meta-data or mailboxes.

The endianness specification of each action argument as part of the
rule specification, e.g. H(...) and N(...) is removed from the rule
file and auto-detected based on their destination. The DMA instruction
scope is made internal, so mov instructions need to be used. The
pattern of transferring complete headers from table entry action args
to headers is detected, and the associated set of mov instructions
plus header validate is internally detected and replaced with the
internal-only DMA instruction to preserve performance.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
3 years agopipeline: modularize SWX instruction optimizer
Cristian Dumitrescu [Sun, 11 Apr 2021 23:23:37 +0000 (00:23 +0100)]
pipeline: modularize SWX instruction optimizer

Decouple between the different instruction optimizer. Allow each
optimization to run as a separate iteration on the entire instruction
stream.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
3 years agoexamples/l3fwd: implement FIB lookup method
Conor Walsh [Fri, 16 Apr 2021 17:19:40 +0000 (17:19 +0000)]
examples/l3fwd: implement FIB lookup method

This patch implements the Forwarding Information Base (FIB) library
in l3fwd using the function calls and infrastructure introduced in
the previous patch.

Signed-off-by: Conor Walsh <conor.walsh@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>
3 years agoexamples/l3fwd: add FIB infrastructure
Conor Walsh [Fri, 16 Apr 2021 17:19:39 +0000 (17:19 +0000)]
examples/l3fwd: add FIB infrastructure

The purpose of this commit is to add the necessary function calls
and supporting infrastructure to allow the Forwarding Information Base
(FIB) library to be integrated into the l3fwd sample app.
Instead of adding an individual flag for FIB, a new flag '--lookup' has
been added that allows the user to select their desired lookup method.
The flags '-E' and '-L' have been retained for backwards compatibility.

Signed-off-by: Conor Walsh <conor.walsh@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
3 years agoexamples/l3fwd: move routes to common header
Conor Walsh [Fri, 16 Apr 2021 17:19:38 +0000 (17:19 +0000)]
examples/l3fwd: move routes to common header

To prevent code duplication from the addition of lookup methods
the routes specified in lpm should be moved to a common header.

Signed-off-by: Conor Walsh <conor.walsh@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>
3 years agoexamples/l3fwd: fix LPM IPv6 subnets
Conor Walsh [Fri, 16 Apr 2021 17:19:37 +0000 (17:19 +0000)]
examples/l3fwd: fix LPM IPv6 subnets

Any IP within the 2001:200::/48 subnet will match all the routes given
instead of 1 individual route and the application cannot
differentiate between them.
The change in this patch allows the ports to be individually matched using
smaller /64 ranges for each port. These smaller subnet ranges are still
within the 2001:200::/48 subnet range set aside for benchmarking
in RFC5180.
l3fwd will now use 2001:200:0:{0-7}::/64 where 0-7 is the port ID for IPv6.

Fixes: 37afe381bde4 ("examples/l3fwd: use reserved IP addresses")
Cc: stable@dpdk.org
Signed-off-by: Conor Walsh <conor.walsh@intel.com>
Acked-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>
3 years agoexamples/l3fwd: skip Tx queue drain on first iteration
Kathleen Capella [Thu, 8 Apr 2021 21:35:49 +0000 (21:35 +0000)]
examples/l3fwd: skip Tx queue drain on first iteration

Initialize prev_tsc to cur_tsc. This avoids running the TX queue drain
in the first iteration of the packet processing loop.

Signed-off-by: Kathleen Capella <kathleen.capella@arm.com>
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
3 years agoexamples/ptpclient: remove wrong comment
Min Hu (Connor) [Sat, 27 Mar 2021 07:36:26 +0000 (15:36 +0800)]
examples/ptpclient: remove wrong comment

This patch deletes the comments which are wrong and unnecessary.

Fixes: ab129e9065a5 ("examples/ptpclient: add minimal PTP client")
Cc: stable@dpdk.org
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
3 years agoexamples/pipeline: add newline to error messages
Cristian Dumitrescu [Wed, 31 Mar 2021 13:51:53 +0000 (14:51 +0100)]
examples/pipeline: add newline to error messages

Add newline to some error messages that were missing it.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
3 years agopipeline: fix endianness conversions
Cristian Dumitrescu [Sat, 3 Apr 2021 00:17:09 +0000 (01:17 +0100)]
pipeline: fix endianness conversions

The SWX pipeline instructions work with operands of different types:
header fields (h.header.field), packet meta-data (m.field), extern
object mailbox field (e.obj.field), extern function (f.field), action
data read from table entries (t.field), or immediate values; hence the
HMEFTI acronym. The H operands are stored in network byte order (NBO),
while the MEFT operands are stored in host byte order (HBO), hence the
need to operate endianness conversions.

Some of the endianness conversion macros were not working correctly
for some cases such as operands of different sizes, and they are fixed
now. Affected instructions: mov, and, or, xor, jmpeq, jmpneq.

Fixes: 7210349d5baa ("pipeline: add SWX move instruction")
Fixes: 650195cf965a ("pipeline: introduce SWX and instruction")
Fixes: 8f796198dcda ("pipeline: introduce SWX or instruction")
Fixes: b4e607f9fd5e ("pipeline: introduce SWX XOR instruction")
Fixes: b3947e25bed4 ("pipeline: introduce SWX jump and return instructions")
Cc: stable@dpdk.org
Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
3 years agopipeline: adjust error code for internal function
Cristian Dumitrescu [Tue, 30 Mar 2021 10:19:04 +0000 (11:19 +0100)]
pipeline: adjust error code for internal function

Adjusting the error code for the internal function instruction_config
to match the rest of the code which is returning a negative value on
error. Cosmetic change.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
3 years agopipeline: validate header on SWX emit
Cristian Dumitrescu [Fri, 26 Mar 2021 20:29:35 +0000 (20:29 +0000)]
pipeline: validate header on SWX emit

Enhance the behavior of the emit instruction to ignore invalid
headers, as mandated by the P4 language specification.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
3 years agopipeline: add table statistics to SWX
Cristian Dumitrescu [Fri, 16 Apr 2021 23:46:41 +0000 (00:46 +0100)]
pipeline: add table statistics to SWX

Add support for table statistics for the SWX pipeline. For each table,
we maintain a counter for lookup hit packets, one for lookup miss
packets and one packet counter for each table action.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Signed-off-by: Yogesh Jangra <yogesh.jangra@intel.com>
3 years agopipeline: add drop instruction to SWX
Cristian Dumitrescu [Fri, 26 Mar 2021 22:11:08 +0000 (22:11 +0000)]
pipeline: add drop instruction to SWX

Enabled the TX instruction to accept an immediate value for the output
port argument. The drop instruction is simply an alias to the TX
instruction for the last output port of the pipeline.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
3 years agopipeline: relax table match field requirements
Cristian Dumitrescu [Thu, 15 Apr 2021 21:15:35 +0000 (22:15 +0100)]
pipeline: relax table match field requirements

The match fields for a given table have to be part of the same header
or the metadata structure. This commit removes the requirement that
the list of match fields must observe the order of fields within their
structure. For example, the h.ipv4.dst_addr field can now be listed
before the h.ipv4.src_addr field in a table match field list, even
though within the IPv4 header the dst_addr field is present after the
src_addr field.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
3 years agotable: relax requirements for entry action data
Churchill Khangar [Fri, 26 Mar 2021 20:22:24 +0000 (20:22 +0000)]
table: relax requirements for entry action data

Currently, the table entry action data is required to be NULL when the
action data size is zero. We now require that action data is ignored
when the action data size is zero. This is to allow for a table entry
instance to be allocated once with max action data size for the table
and reused repeatedly for actions of different sizes, including zero.

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Signed-off-by: Churchill Khangar <churchill.khangar@intel.com>
3 years agotable: fix out of bounds write
Cristian Dumitrescu [Wed, 7 Apr 2021 10:59:53 +0000 (11:59 +0100)]
table: fix out of bounds write

Fix out of bounds write. The allocated string size was incorrect.

Coverity issue: 369670
Fixes: 66440b7b22f2 ("table: add wildcard match table type")

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
3 years agoport: fix allocation check in ring SWX
Cristian Dumitrescu [Wed, 7 Apr 2021 10:59:45 +0000 (11:59 +0100)]
port: fix allocation check in ring SWX

Fix logically dead code in ring port.

Coverity issue: 369664
Fixes: 77a413017c2d ("port: add ring SWX port")

Signed-off-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
3 years agodevargs: fix list entry update
Xueming Li [Sat, 17 Apr 2021 15:15:32 +0000 (23:15 +0800)]
devargs: fix list entry update

When inserting devargs that is already in list,
existing one was reset and replaced completely by new one,
the entry info was lost during copy.

This patch backups entry info before copy.

Fixes: 64051bb1f144 ("devargs: unify scratch buffer storage")

Reported-by: Jim Harris <james.r.harris@intel.com>
Signed-off-by: Xueming Li <xuemingl@nvidia.com>
3 years agovfio: fix duplicated user mem map
Yunjian Wang [Sat, 10 Apr 2021 09:37:57 +0000 (17:37 +0800)]
vfio: fix duplicated user mem map

Currently, new user mem maps are checked if they are adjacent to
an existing mem map and if so, the mem map entries are merged.

It didn't check for duplicate mem maps, so if the API is called
with the same mem map multiple times, they will occupy multiple
mem map entries. This will reduce the amount of entries available
for unique mem maps.

So check for duplicate mem maps and merge them into one mem map
entry if any found.

Fixes: 0cbce3a167f1 ("vfio: skip DMA map failure if already mapped")
Cc: stable@dpdk.org
Suggested-by: Kevin Traynor <ktraynor@redhat.com>
Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
3 years agopower: replace unsigned -1 with unsigned maximum
Tyler Retzlaff [Tue, 16 Mar 2021 00:13:31 +0000 (17:13 -0700)]
power: replace unsigned -1 with unsigned maximum

Use UINT64_MAX instead of -1ULL.

Some compilers generate a warning when applying a '-' to
an unsigned literal so avoid this by initializing with
unsigned preprocessor definition.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
3 years agoeal: replace unsigned -1 with unsigned maximums
Tyler Retzlaff [Tue, 16 Mar 2021 00:13:31 +0000 (17:13 -0700)]
eal: replace unsigned -1 with unsigned maximums

Use UINT64_MAX and UINT32_MAX instead of -1 or ~0 literal variations
of different explicit widths when creating masks and sentinel values.

Some compilers generate a warning when applying a '-' to an unsigned
literal so avoid this by initializing with unsigned preprocessor
definitions where appropriate.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
Acked-by: Morten Brørup <mb@smartsharesystems.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
3 years agoeal: check vsnprintf failure in devargs parsing
Tyler Retzlaff [Mon, 15 Mar 2021 23:55:24 +0000 (16:55 -0700)]
eal: check vsnprintf failure in devargs parsing

Check for failure, while here just increment len once after checking for
failure instead of duplicating len + 1 math in two different argument
lists.

Signed-off-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
3 years agoconfig/arm: add Hisilicon kunpeng
Chengchang Tang [Fri, 16 Apr 2021 09:57:03 +0000 (17:57 +0800)]
config/arm: add Hisilicon kunpeng

Here adds configs for Kunpeng server.

Signed-off-by: Chengchang Tang <tangchengchang@huawei.com>
Signed-off-by: Lijun Ou <oulijun@huawei.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
Reviewed-by: Ruifeng Wang <ruifeng.wang@arm.com>
3 years agoeventdev: fix case to initiate crypto adapter service
Shijith Thotton [Mon, 12 Apr 2021 08:53:39 +0000 (14:23 +0530)]
eventdev: fix case to initiate crypto adapter service

Initiate software crypto adapter service, only if hardware capabilities
are not reported. In OP_FORWARD mode, software service is not required
to enqueue events if OP_FORWARD capability is supported by the PMD.

Fixes: 7901eac3409a ("eventdev: add crypto adapter implementation")
Cc: stable@dpdk.org
Signed-off-by: Shijith Thotton <sthotton@marvell.com>
Acked-by: Abhinandan Gujjar <abhinandan.gujjar@intel.com>
3 years agotest/event_crypto: use crypto adapter enqueue API
Shijith Thotton [Thu, 15 Apr 2021 09:13:51 +0000 (14:43 +0530)]
test/event_crypto: use crypto adapter enqueue API

Use rte_event_crypto_adapter_enqueue() API to enqueue events to crypto
adapter if forward mode is supported in driver.

Signed-off-by: Shijith Thotton <sthotton@marvell.com>
Acked-by: Abhinandan Gujjar <abhinandan.gujjar@intel.com>
3 years agoevent/octeontx2: support crypto adapter forward mode
Shijith Thotton [Thu, 15 Apr 2021 09:13:50 +0000 (14:43 +0530)]
event/octeontx2: support crypto adapter forward mode

Advertise crypto adapter forward mode capability and set crypto adapter
enqueue function in driver.

Signed-off-by: Shijith Thotton <sthotton@marvell.com>
Acked-by: Abhinandan Gujjar <abhinandan.gujjar@intel.com>