dpdk.git
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>
3 years agoeventdev: introduce crypto adapter enqueue API
Akhil Goyal [Thu, 15 Apr 2021 09:13:49 +0000 (14:43 +0530)]
eventdev: introduce crypto adapter enqueue API

In case an event from a previous stage is required to be forwarded
to a crypto adapter and PMD supports internal event port in crypto
adapter, exposed via capability
RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_OP_FWD, we do not have
a way to check in the API rte_event_enqueue_burst(), whether it is
for crypto adapter or for eth tx adapter.

Hence we need a new API similar to rte_event_eth_tx_adapter_enqueue(),
which can send to a crypto adapter.

Note that RTE_EVENT_TYPE_* cannot be used to make that decision,
as it is meant for event source and not event destination.
And event port designated for crypto adapter is designed to be used
for OP_NEW mode.

Hence, in order to support an event PMD which has an internal event port
in crypto adapter (RTE_EVENT_CRYPTO_ADAPTER_OP_FORWARD mode), exposed
via capability RTE_EVENT_CRYPTO_ADAPTER_CAP_INTERNAL_PORT_OP_FWD,
application should use rte_event_crypto_adapter_enqueue() API to enqueue
events.

When internal port is not available(RTE_EVENT_CRYPTO_ADAPTER_OP_NEW mode),
application can use API rte_event_enqueue_burst() as it was doing earlier,
i.e. retrieve event port used by crypto adapter and bind its event queues
to that port and enqueue events using the API rte_event_enqueue_burst().

Signed-off-by: Akhil Goyal <gakhil@marvell.com>
Acked-by: Abhinandan Gujjar <abhinandan.gujjar@intel.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
3 years agonet/ice: add Rx AVX512 offload path
Leyi Rong [Thu, 15 Apr 2021 08:58:11 +0000 (16:58 +0800)]
net/ice: add Rx AVX512 offload path

Split AVX512 Rx data path into two, one is for basic,
the other one can support additional Rx offload features,
including Rx checksum offload, Rx vlan offload, RSS offload.

Signed-off-by: Leyi Rong <leyi.rong@intel.com>
Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
Tested-by: Qin Sun <qinx.sun@intel.com>
3 years agonet/ice: add Tx AVX512 offload path
Leyi Rong [Thu, 15 Apr 2021 08:58:10 +0000 (16:58 +0800)]
net/ice: add Tx AVX512 offload path

Add alternative Tx data path for AVX512 which can support partial
Tx offload features, including Tx checksum offload, vlan/QinQ
insertion offload.

Signed-off-by: Leyi Rong <leyi.rong@intel.com>
Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
Tested-by: Qin Sun <qinx.sun@intel.com>
3 years agonet/iavf: fix lack of MAC type when set MAC address
Robin Zhang [Fri, 19 Mar 2021 09:20:19 +0000 (09:20 +0000)]
net/iavf: fix lack of MAC type when set MAC address

When set default MAC address, use type VIRTCHNL_ETHER_ADDR_PRIMARY as this
case is changing device/primary unicast MAC. For other cases, such as
adding or deleting extra unicast addresses and multicast addresses, use
type VIRTCHNL_ETHER_ADDR_EXTRA.

Fixes: cb25d4323fbf ("net/avf: enable MAC VLAN and promisc ops")
Cc: stable@dpdk.org
Signed-off-by: Robin Zhang <robinx.zhang@intel.com>
Tested-by: Yan Xia <yanx.xia@intel.com>
3 years agonet/i40e: fix lack of MAC type when set MAC address
Robin Zhang [Fri, 19 Mar 2021 09:20:18 +0000 (09:20 +0000)]
net/i40e: fix lack of MAC type when set MAC address

Currently, there is no way for a VF driver to specify that it wants to
change its device/primary unicast MAC address. This makes it
difficult/impossible for the PF driver to track the VF's device/primary
unicast MAC address, which is used for VM/VF reboot and displaying on
the host. Fix this by using 2 bits of a pad byte in the
virtchnl_ether_addr structure so the VF can specify what type of MAC
it's adding/deleting.

Below are the values that should be used by all VF drivers going
forward.

VIRTCHNL_ETHER_ADDR_LEGACY(0):
- The type should only ever be 0 for legacy AVF drivers (i.e.
  drivers that don't support the new type bits). The PF drivers
  will track VF's device/primary unicast MAC using with best
  effort.

VIRTCHNL_ETHER_ADDR_PRIMARY(1):
- This type should only be used when the VF is changing their
  device/primary unicast MAC. It should be used for both delete
  and add cases related to the device/primary unicast MAC.

VIRTCHNL_ETHER_ADDR_EXTRA(2):
- This type should be used when the VF is adding and/or deleting
  MAC addresses that are not the device/primary unicast MAC. For
  example, extra unicast addresses and multicast addresses
  assuming the PF supports "extra" addresses at all.

If a PF is parsing the type field of the virtchnl_ether_addr, then it
should use the VIRTCHNL_ETHER_ADDR_TYPE_MASK to mask the first two bits
of the type field since 0, 1, and 2 are the only valid values.

For i40evf PMD, when set default MAC address, use type
VIRTCHNL_ETHER_ADDR_PRIMARY as this case is changing device/primary
unicast MAC. For other cases, such as adding or deleting extra unicast
addresses and multicast addresses, use type VIRTCHNL_ETHER_ADDR_EXTRA.

Fixes: 6d13ea8e8e49 ("net: add rte prefix to ether structures")
Fixes: caccf8b318ca ("ethdev: return diagnostic when setting MAC address")
Cc: stable@dpdk.org
Signed-off-by: Robin Zhang <robinx.zhang@intel.com>
Tested-by: Yan Xia <yanx.xia@intel.com>
3 years agonet/ice: support flow priority for DCF switch filter
Yuying Zhang [Thu, 15 Apr 2021 15:38:45 +0000 (15:38 +0000)]
net/ice: support flow priority for DCF switch filter

Support rte flow priority attribute for DCF switch filter.
When a packet is matched by two rules, the behavior of it
is not defined. This patch supports flow priority to create
different recipes for this situation. Only priority 0 and 1
are supported and higher value denotes higher priority.

for example:
1. flow create 0 priority 0 ingress pattern eth / vlan tci is 2 / vlan
   tci is 2 / end actions vf id 2 / end
2. flow create 0 priority 1 ingress pattern eth / vlan / vlan / ipv4 dst
   is 192.168.0.1 / end actions vf id 1 / end

These two rules can be created at the same time in DCF switch
filter and priority of rule 2 is higher. Packet hits rule 2
when two conditions of rules are satisfied.

Signed-off-by: Yuying Zhang <yuying.zhang@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
3 years agonet/i40e: support 25G AOC/ACC cables
Yury Kylulin [Tue, 13 Apr 2021 15:29:50 +0000 (18:29 +0300)]
net/i40e: support 25G AOC/ACC cables

Enable additional PHY types (25G-AOC and 25G-ACC) for set PHY config
command.

Signed-off-by: Yury Kylulin <yury.kylulin@intel.com>
Tested-by: Ashish Paul <apaul@juniper.net>
3 years agonet/ice: support GTPU TEID pattern for switch filter
Yuying Zhang [Thu, 15 Apr 2021 10:47:51 +0000 (10:47 +0000)]
net/ice: support GTPU TEID pattern for switch filter

Enable GTPU pattern for CVL switch filter. Support teid and
qfi field of GTPU pattern. Patterns without inner l3/l4 field
support outer dst/src ip. Patterns with inner l3/l4 field only
support inner dst/src ip and inner dst/src port.

+----------------------------------+------------------------------------+
| Pattern                          | Input Set                          |
+----------------------------------+------------------------------------+
| pattern_eth_ipv4_gtpu            | teid, dst/src ip                   |
| pattern_eth_ipv6_gtpu            | teid, dst/src ip                   |
| pattern_eth_ipv4_gtpu_ipv4       | teid, dst/src ip                   |
| pattern_eth_ipv4_gtpu_ipv4_tcp   | teid, dst/src ip, dst/src port     |
| pattern_eth_ipv4_gtpu_ipv4_udp   | teid, dst/src ip, dst/src port     |
| pattern_eth_ipv4_gtpu_ipv6       | teid, dst/src ip                   |
| pattern_eth_ipv4_gtpu_ipv6_tcp   | teid, dst/src ip, dst/src port     |
| pattern_eth_ipv4_gtpu_ipv6_udp   | teid, dst/src ip, dst/src port     |
| pattern_eth_ipv6_gtpu_ipv4       | teid, dst/src ip                   |
| pattern_eth_ipv6_gtpu_ipv4_tcp   | teid, dst/src ip, dst/src port     |
| pattern_eth_ipv6_gtpu_ipv4_udp   | teid, dst/src ip, dst/src port     |
| pattern_eth_ipv6_gtpu_ipv6       | teid, dst/src ip                   |
| pattern_eth_ipv6_gtpu_ipv6_tcp   | teid, dst/src ip, dst/src port     |
| pattern_eth_ipv6_gtpu_ipv6_udp   | teid, dst/src ip, dst/src port     |
| pattern_eth_ipv4_gtpu_eh_ipv4    | teid, qfi, dst/src ip              |
| pattern_eth_ipv4_gtpu_eh_ipv4_tcp| teid, qfi, dst/src ip, dst/src port|
| pattern_eth_ipv4_gtpu_eh_ipv4_udp| teid, qfi, dst/src ip, dst/src port|
| pattern_eth_ipv4_gtpu_eh_ipv6    | teid, qfi, dst/src ip              |
| pattern_eth_ipv4_gtpu_eh_ipv6_tcp| teid, qfi, dst/src ip, dst/src port|
| pattern_eth_ipv4_gtpu_eh_ipv6_udp| teid, qfi, dst/src ip, dst/src port|
| pattern_eth_ipv6_gtpu_eh_ipv4    | teid, qfi, dst/src ip              |
| pattern_eth_ipv6_gtpu_eh_ipv4_tcp| teid, qfi, dst/src ip, dst/src port|
| pattern_eth_ipv6_gtpu_eh_ipv4_udp| teid, qfi, dst/src ip, dst/src port|
| pattern_eth_ipv6_gtpu_eh_ipv6    | teid, qfi, dst/src ip              |
| pattern_eth_ipv6_gtpu_eh_ipv6_tcp| teid, qfi, dst/src ip, dst/src port|
| pattern_eth_ipv6_gtpu_eh_ipv6_udp| teid, qfi, dst/src ip, dst/src port|
+----------------------------------+------------------------------------+

Signed-off-by: Yuying Zhang <yuying.zhang@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
3 years agonet/ice/base: support GTPU for DCF switch filter
Yuying Zhang [Thu, 15 Apr 2021 10:47:50 +0000 (10:47 +0000)]
net/ice/base: support GTPU for DCF switch filter

Enable GTPU filtering for DCF switch filter.

Signed-off-by: Yuying Zhang <yuying.zhang@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
3 years agonet/mlx5: separate Tx burst functions to different files
Michael Baum [Mon, 12 Apr 2021 06:32:25 +0000 (06:32 +0000)]
net/mlx5: separate Tx burst functions to different files

This patch separates Tx burst function implementations to different
source files, thus allowing them to compile in parallel.

Signed-off-by: Michael Baum <michaelba@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
3 years agonet/mlx5: separate Tx function implementations to new file
Michael Baum [Mon, 12 Apr 2021 06:32:24 +0000 (06:32 +0000)]
net/mlx5: separate Tx function implementations to new file

This patch separates Tx function implementations to different source
file as an optional preparation step for Tx cleanup.

Signed-off-by: Michael Baum <michaelba@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
3 years agonet/mlx5: separate Tx burst template to header file
Michael Baum [Mon, 12 Apr 2021 06:32:23 +0000 (06:32 +0000)]
net/mlx5: separate Tx burst template to header file

This patch moves Tx burst and its inline functions declarations to
header file to allow its use from several separate source files and as a
possible preparation for Tx cleanup.

Signed-off-by: Michael Baum <michaelba@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
3 years agonet/mlx5: separate Tx function declarations to another file
Michael Baum [Mon, 12 Apr 2021 06:32:22 +0000 (06:32 +0000)]
net/mlx5: separate Tx function declarations to another file

This patch separates Tx function declarations to different header file
in preparation for removing their implementation from the source file
and as an optional preparation for Tx cleanup.

Signed-off-by: Michael Baum <michaelba@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
3 years agonet/mlx5: separate Rx function implementations to new file
Michael Baum [Mon, 12 Apr 2021 06:32:21 +0000 (06:32 +0000)]
net/mlx5: separate Rx function implementations to new file

This patch separates Rx function implementations to different source
file as an optional preparation step for further consolidation of Rx
burst functions.

Signed-off-by: Michael Baum <michaelba@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
3 years agonet/mlx5: separate Rx function declarations to another file
Michael Baum [Mon, 12 Apr 2021 06:32:20 +0000 (06:32 +0000)]
net/mlx5: separate Rx function declarations to another file

The mlx5_rxtx.c file contains a lot of Tx burst functions, each of those
is performance-optimized for the specific set of requested offloads.
These ones are generated on the basis of the template function and it
takes significant time to compile, just due to a large number of giant
functions generated in the same file and this compilation is not being
done in parallel with using multithreading.

Therefore we can split the mlx5_rxtx.c file into several separate files
to allow different functions to be compiled simultaneously.
In this patch, we separate Rx function declarations to different header
file in preparation for removing them from the source file and as an
optional preparation step for further consolidation of Rx burst
functions.

Signed-off-by: Michael Baum <michaelba@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
3 years agonet/hns3: rename Rx burst function
Chengwen Feng [Thu, 15 Apr 2021 08:35:21 +0000 (16:35 +0800)]
net/hns3: rename Rx burst function

Currently, user could use runtime config "rx_func_hint=simple" to
select the hns3_recv_pkts API, but the API's name get from
rte_eth_rx_burst_mode_get is "Scalar" which has not reflected "simple".

So this patch renames hns3_recv_pkts to hns3_recv_pkts_simple, and
also change it's name which gets from rte_eth_rx_burst_mode_get to
"Scalar Simple" to maintain conceptual consistency.

Fixes: 521ab3e93361 ("net/hns3: add simple Rx path")
Cc: stable@dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
3 years agonet/virtio: fix kernel set owner for multi-queue devices
Thierry Herbelot [Thu, 8 Apr 2021 12:37:29 +0000 (14:37 +0200)]
net/virtio: fix kernel set owner for multi-queue devices

Restore the original code, where VHOST_SET_OWNER is applied to
all vhostfds of the device.

Fixes: 06856cabb89b ("net/virtio: add virtio-user ops to set owner")
Cc: stable@dpdk.org
Signed-off-by: Thierry Herbelot <thierry.herbelot@6wind.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
3 years agonet/hns3: support fixed link speed
Huisong Li [Tue, 13 Apr 2021 13:47:19 +0000 (21:47 +0800)]
net/hns3: support fixed link speed

This patch adds the configuration of fixed speed for the PF device.

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
3 years agonet/hns3: support flow control autoneg for copper port
Huisong Li [Tue, 13 Apr 2021 13:47:18 +0000 (21:47 +0800)]
net/hns3: support flow control autoneg for copper port

If the flow control auto-negotiation is not supported and the flow
control modes on the local and link partner is asymmetric, the flow
control on the NIC does not take effect. The support of the
auto-negotiation capability requires the cooperation of the firmware
and driver.

This patch supports the flow control auto-negotiation only for copper
port. For optical ports, the forced flow control mode is still used.

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
3 years agonet/hns3: support link speed autoneg for PF
Huisong Li [Tue, 13 Apr 2021 13:47:17 +0000 (21:47 +0800)]
net/hns3: support link speed autoneg for PF

This patch supports link speed auto-negotiation for PF. If the
device supports auto-negotiation, the device negotiates with
the link partner at all speeds supported by the device.

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>