dpdk.git
2 years agodoc: fix indentation in flow-perf guide
Rongwei Liu [Thu, 11 Nov 2021 14:23:40 +0000 (16:23 +0200)]
doc: fix indentation in flow-perf guide

The --meter section used wrong indentation previously.

Fixes: 6a2cf58a045f ("app/flow-perf: support meter action")
Cc: stable@dpdk.org
Signed-off-by: Rongwei Liu <rongweil@nvidia.com>
Acked-by: Wisam Jaddo <wisamm@nvidia.com>
2 years agoapp/flow-perf: add packet metering mode
Rongwei Liu [Thu, 11 Nov 2021 14:23:39 +0000 (16:23 +0200)]
app/flow-perf: add packet metering mode

The flow perf application uses the srtcm_rfc2697 as meter profile
while doing the meter testing.

This patch adds new configuration parameter '--packet-mode' to
generate the meter flows with packet cir instead of byte cir.

Signed-off-by: Rongwei Liu <rongweil@nvidia.com>
Acked-by: Wisam Jaddo <wisamm@nvidia.com>
2 years agoapp/flow-perf: support dynamic values for meter profile
Rongwei Liu [Thu, 11 Nov 2021 14:23:38 +0000 (16:23 +0200)]
app/flow-perf: support dynamic values for meter profile

Change meter-cir option to meter-profile to cover user input for CIR,
CBS & EBS values.

The usage is as below:
--meter-profile=N1,N2,N3 default value is 1250000 156250 0.

Signed-off-by: Rongwei Liu <rongweil@nvidia.com>
Acked-by: Wisam Jaddo <wisamm@nvidia.com>
2 years agoapp/flow-perf: support meter policy API
Rongwei Liu [Thu, 11 Nov 2021 14:23:37 +0000 (16:23 +0200)]
app/flow-perf: support meter policy API

Add option "policy-mtr" to indicate if meter creation will include policy
or not. Meter creation will keep unchanged without it.

With "policy-mtr", the policy is introduced. API create_meter_policy
is to create a policy. API create_meter_rule will use it to create
a meter. The value of it is used to specify meter policy actions.

Signed-off-by: Haifei Luo <haifeil@nvidia.com>
Signed-off-by: Jiawei Wang <jiaweiw@nvidia.com>
Signed-off-by: Rongwei Liu <rongweil@nvidia.com>
Acked-by: Wisam Jaddo <wisamm@nvidia.com>
2 years agoapp/flow-perf: move flow options as global
Rongwei Liu [Thu, 11 Nov 2021 14:23:36 +0000 (16:23 +0200)]
app/flow-perf: move flow options as global

With flow_options defined as global struct, it's possible
to use sub-functions to handle run-time options.

It's helpful to avoid too many tabs warnings.

Signed-off-by: Rongwei Liu <rongweil@nvidia.com>
Acked-by: Wisam Jaddo <wisamm@nvidia.com>
2 years agoeal/ppc: support ASan
David Christensen [Mon, 15 Nov 2021 21:38:47 +0000 (13:38 -0800)]
eal/ppc: support ASan

Add support for Address Sanitizer (ASan) for PPC/POWER architecture.

Signed-off-by: David Christensen <drc@linux.vnet.ibm.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
2 years agotest/red: fix typo in test description
David Marchand [Fri, 12 Nov 2021 13:56:45 +0000 (14:56 +0100)]
test/red: fix typo in test description

This is probably due a s/red/rte_red/ a long time ago.

Fixes: de3cfa2c9823 ("sched: initial import")

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@yahoo.com>
2 years agoexamples/l3fwd: use reserved addresses for EM mode
Pavan Nikhilesh [Fri, 5 Nov 2021 08:38:51 +0000 (14:08 +0530)]
examples/l3fwd: use reserved addresses for EM mode

The l3fwd example should use the reserved IPv4/v6 reserved address
ranges defined in RFC5735, RFC5180 and RFC863 discard protocol for
the port number in the exact match mode of L3 forwarding.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
2 years agoexamples/l3fwd: print device name when adding routes
Pavan Nikhilesh [Fri, 5 Nov 2021 08:38:50 +0000 (14:08 +0530)]
examples/l3fwd: print device name when adding routes

Since the number of Ethernet ports have gone up, print the device name
(which for PCI devices is the BDF triplet), along with the routes.
This is also helpful for cases where allow listing order is not honored.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Reviewed-by: Conor Walsh <conor.walsh@intel.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
2 years agoexamples/l3fwd: increase number of routes
Pavan Nikhilesh [Fri, 5 Nov 2021 08:38:49 +0000 (14:08 +0530)]
examples/l3fwd: increase number of routes

Increase the number of routes from 8 to 16 that are statically added for
lpm and em mode as most of the SoCs support more than 8 interfaces.
The number of routes added is equal to the number of ethernet devices
ports enabled through port mask.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Reviewed-by: Conor Walsh <conor.walsh@intel.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
2 years agonet/af_xdp: workaround custom program loading
Ciara Loftus [Fri, 12 Nov 2021 10:30:02 +0000 (10:30 +0000)]
net/af_xdp: workaround custom program loading

Since v0.4.0, if the underlying kernel supports it, libbpf uses 'bpf
link' to manage the programs on the interfaces of the XDP sockets (xsks).
This is not compatible with the PMD's custom XDP program loading feature
which uses the netlink-based method for loading custom programs.

The conflict arises when libbpf searches for a custom program on the
interface using bpf link, but doesn't find one because the netlink
method was used. libbpf then proceeds to try to load the default program
on the interface, but fails due to the presence of the custom program.

To work around this, the PMD now uses the
XSK_LIBBPF_FLAGS__INHIBIT_PROG_LOAD flag which prevents libbpf from
attempting to search for or load a program. One repercussion is that
DPDK must now insert the xsk into the xsks_map as this was previously
handled by libbpf during the routines for program loading/probing.

Ideally, the PMD would use bpf link to load the custom program, however
at present there is no convenient and reliable way of detecting whether
the underlying kernel supports bpf link. Perhaps this may become
available in a future libbpf release, at which point we can switch the
PMD over to the new bpf link based method.

Signed-off-by: Ciara Loftus <ciara.loftus@intel.com>
2 years agonet/af_xdp: revert use BPF link for XDP programs
Ciara Loftus [Fri, 12 Nov 2021 10:30:01 +0000 (10:30 +0000)]
net/af_xdp: revert use BPF link for XDP programs

The commit ae70cc6e893b ("net/af_xdp: use BPF link for XDP programs")
caused compilation errors on kernels older than v5.8 due to absence of
the bpf_link_info struct and some definitions in the linux/bpf.h header.
Since relying on the reported kernel version is not a robust solution
and also since there doesn't appear to be a suitable definition in the
bpf header that the preprocessor could rely on to determine support for
bpf link, we will take a different approach to solving the issue that
the original patch attempted to solve. The next commit will address
this.

Fixes: ae70cc6e893b ("net/af_xdp: use BPF link for XDP programs")

Signed-off-by: Ciara Loftus <ciara.loftus@intel.com>
2 years agoethdev: fix typos
Ferruh Yigit [Fri, 12 Nov 2021 12:13:39 +0000 (12:13 +0000)]
ethdev: fix typos

Fixes: 9039c8125730 ("ethdev: change promiscuous callbacks to return status")
Fixes: 12e6e3e78fe0 ("ethdev: add API to dump device internal flow info")
Fixes: 44bf3c796be3 ("ethdev: support flow aging")
Cc: stable@dpdk.org
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Ori Kam <orika@nvidia.com>
2 years agoapp/testpmd: fix DCB in VT configuration
Jie Wang [Mon, 15 Nov 2021 03:29:58 +0000 (11:29 +0800)]
app/testpmd: fix DCB in VT configuration

When set port DCB in VT mode enabled, it should remove RSS HASH
offload before reconfiguring the device and queues.

Because port multi-queue mode is changed from RSS to DCB in VT.

Fixes: 2a977b891f99 ("app/testpmd: fix DCB configuration")
Cc: stable@dpdk.org
Signed-off-by: Jie Wang <jie1x.wang@intel.com>
Acked-by: Aman Singh <aman.deep.singh@intel.com>
2 years agonet/szedata2: remove driver
Martin Spinler [Wed, 10 Nov 2021 15:39:24 +0000 (16:39 +0100)]
net/szedata2: remove driver

Remove the szedata2 device driver as the platform is no longer
supported.

Signed-off-by: Martin Spinler <spinler@cesnet.cz>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
2 years agoapp/testpmd: avoid process ID out of range
Haiyue Wang [Mon, 15 Nov 2021 06:05:09 +0000 (14:05 +0800)]
app/testpmd: avoid process ID out of range

The 'proc_id' should be less than 'num_procs', if not, exit the testpmd
and show the error message.

Fixes: a550baf24af9 ("app/testpmd: support multi-process")

Signed-off-by: Haiyue Wang <haiyue.wang@intel.com>
Acked-by: Min Hu (Connor) <humin29@huawei.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
2 years agonet/enetfec: add features
Apeksha Gupta [Mon, 15 Nov 2021 07:19:40 +0000 (12:49 +0530)]
net/enetfec: add features

This patch adds checksum and VLAN offloads in enetfec network
poll mode driver.

Signed-off-by: Sachin Saxena <sachin.saxena@nxp.com>
Signed-off-by: Apeksha Gupta <apeksha.gupta@nxp.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
2 years agonet/enetfec: support Rx/Tx
Apeksha Gupta [Mon, 15 Nov 2021 07:19:39 +0000 (12:49 +0530)]
net/enetfec: support Rx/Tx

This patch adds burst enqueue and dequeue operations to the enetfec
PMD. Basic features added like promiscuous enable, basic stats.

Signed-off-by: Sachin Saxena <sachin.saxena@nxp.com>
Signed-off-by: Apeksha Gupta <apeksha.gupta@nxp.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
2 years agonet/enetfec: support queue configuration
Apeksha Gupta [Mon, 15 Nov 2021 07:19:38 +0000 (12:49 +0530)]
net/enetfec: support queue configuration

This patch adds Rx/Tx queue configuration setup operations.
On packet reception the respective BD Ring status bit is set
which is then used for packet processing.

Signed-off-by: Sachin Saxena <sachin.saxena@nxp.com>
Signed-off-by: Apeksha Gupta <apeksha.gupta@nxp.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
2 years agonet/enetfec: support UIO
Apeksha Gupta [Mon, 15 Nov 2021 07:19:37 +0000 (12:49 +0530)]
net/enetfec: support UIO

Implemented the fec-uio driver in kernel. enetfec PMD uses
UIO interface to interact with "fec-uio" driver implemented in
kernel for PHY initialisation and for mapping the allocated memory
of register & BD from kernel to DPDK which gives access to
non-cacheable memory for BD.

Signed-off-by: Sachin Saxena <sachin.saxena@nxp.com>
Signed-off-by: Apeksha Gupta <apeksha.gupta@nxp.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
2 years agonet/enetfec: introduce driver
Apeksha Gupta [Mon, 15 Nov 2021 07:19:36 +0000 (12:49 +0530)]
net/enetfec: introduce driver

ENETFEC (Fast Ethernet Controller) is a network poll mode driver
for NXP SoC i.MX 8M Mini.

This patch adds skeleton for enetfec driver with probe function.

Signed-off-by: Sachin Saxena <sachin.saxena@nxp.com>
Signed-off-by: Apeksha Gupta <apeksha.gupta@nxp.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
2 years agonet/mlx5: fix delay drop bit set overflow
Bing Zhao [Fri, 12 Nov 2021 14:38:42 +0000 (16:38 +0200)]
net/mlx5: fix delay drop bit set overflow

The attribute to record the global control of hairpin queues' delay
drop was defined as a bit-field with one bit, and the intention was
to reduce the memory overhead. In the meanwhile, the macro was
defined as an enumerated value 0x2.

No matter what value inputted via devarg, the lowest bit was always
zero and the higher bits would be ignored. For hairpin queues, the
delay drop attribute couldn't be enabled.

With the commit, the double logical negation is used to fix this.

Fixes: febcac7b46cd ("net/mlx5: support Rx queue delay drop")

Signed-off-by: Bing Zhao <bingz@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
2 years agonet/mlx5: fix flex item macro collision
Gregory Etelson [Thu, 11 Nov 2021 16:23:04 +0000 (18:23 +0200)]
net/mlx5: fix flex item macro collision

Flex item macro definition values duplicated existing connection
tracking values.

The patch provides new values for flex item macros.

Fixes: a23e9b6e3ee9 ("net/mlx5: handle flex item in flows")

Signed-off-by: Gregory Etelson <getelson@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
2 years agonet/mlx5: fix integrity conversion scheme
Gregory Etelson [Thu, 11 Nov 2021 16:16:26 +0000 (18:16 +0200)]
net/mlx5: fix integrity conversion scheme

RTE flow integrity API provides top-level packet validations.
RTE integrity bits are not always translated one-to-one to
hardware integrity bits.
For example RTE l3_ok and l4_ok integrity bits require 2 hardware
integrity bits each.

The patch fixes RTE l3_ok and l4_ok bits translation to match
ConnectX-6 hardware.

Fixes: 79f8952783d0 ("net/mlx5: support integrity flow item")
Cc: stable@dpdk.org
Signed-off-by: Gregory Etelson <getelson@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
2 years agonet/mlx5: fix Tx scheduling check
Viacheslav Ovsiienko [Wed, 10 Nov 2021 13:05:52 +0000 (15:05 +0200)]
net/mlx5: fix Tx scheduling check

There was a redundant check for the enabled E-Switch, this
resulted in device probing failure if the Tx scheduling was
requested and E-Switch was enabled.

Fixes: f17e4b4ffef9 ("net/mlx5: add Tx scheduling check on queue creation")
Cc: stable@dpdk.org
Signed-off-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
2 years agonet/ice: fix pointer of meta data
Alvin Zhang [Fri, 12 Nov 2021 05:34:18 +0000 (13:34 +0800)]
net/ice: fix pointer of meta data

This patch fixes coverity issue by directly passing the address
of the meta data to subfunction.

Coverity issue: 373867
Fixes: 5ad3db8d4bdd ("net/ice: enable advanced RSS")
Cc: stable@dpdk.org
Signed-off-by: Alvin Zhang <alvinx.zhang@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
2 years agocommon/cnxk: fix memory leak
Anoob Joseph [Wed, 10 Nov 2021 04:32:03 +0000 (10:02 +0530)]
common/cnxk: fix memory leak

The memory allocated for temporarily keeping DPTR need to be freed after
operation.

Also, dptr need to be aligned to 8B.

Fixes: 71213a8b773c ("common/cnxk: support CPT CTX write through microcode op")

Signed-off-by: Anoob Joseph <anoobj@marvell.com>
Reviewed-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
Reviewed-by: Tejasree Kondoj <ktejasree@marvell.com>
2 years agocommon/cnxk: fix pointer argument with GCC 12
Ankur Dwivedi [Mon, 8 Nov 2021 09:19:48 +0000 (14:49 +0530)]
common/cnxk: fix pointer argument with GCC 12

The pointer passed to the rq_ctx and sq_ctx functions was the address
of qctx. Instead of that qctx should be passed. This patch fixes this.

This patch also resolves warning observed with gcc 12 compiler.

log:
   ../drivers/common/cnxk/cnxk_telemetry.h:12:38:
       warning: array subscript
   ‘struct nix_cn10k_sq_ctx_s[0]’ is partly outside array bounds of
   ‘volatile void[8]’ [-Warray-bounds]

Bugzilla ID: 853
Fixes: af75aac78978 ("common/cnxk: support telemetry for NIX")
Cc: stable@dpdk.org
Signed-off-by: Ankur Dwivedi <adwivedi@marvell.com>
Reviewed-by: Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>
Reviewed-by: Jerin Jacob <jerinj@marvell.com>
2 years agonet/iavf: fix pointer of meta data
Alvin Zhang [Thu, 11 Nov 2021 06:31:47 +0000 (14:31 +0800)]
net/iavf: fix pointer of meta data

This patch fixes coverity issue by directly passing the address
of the meta data to lower function.

Coverity issue: 373867
Fixes: 7be10c3004be ("net/iavf: add RSS configuration for VF")
Cc: stable@dpdk.org
Signed-off-by: Alvin Zhang <alvinx.zhang@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
2 years agonet/iavf: fix xstats reset
Radu Nicolau [Tue, 9 Nov 2021 10:33:03 +0000 (10:33 +0000)]
net/iavf: fix xstats reset

Wrong offset used to clear the extended stats section resulting
in eth stats not being reset.

Fixes: ccb49b834cd7 ("net/iavf: support xstats for inline IPsec crypto")

Signed-off-by: Radu Nicolau <radu.nicolau@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
2 years agonet/i40e: fix risk in descriptor read in scalar Rx
Ruifeng Wang [Wed, 15 Sep 2021 08:33:39 +0000 (16:33 +0800)]
net/i40e: fix risk in descriptor read in scalar Rx

Rx descriptor is 16B/32B in size. If the DD bit is set, it indicates
that the rest of the descriptor words have valid values. Hence, the
word containing DD bit must be read first before reading the rest of
the descriptor words.

Since the entire descriptor is not read atomically, on relaxed memory
ordered systems like Aarch64, read of the word containing DD field
could be reordered after read of other words.

Read barrier is inserted between read of the word with DD field
and read of other words. The barrier ensures that the fetched data
is correct.

Testpmd single core test showed no performance drop on x86 or N1SDP.
On ThunderX2, 22% performance regression was observed.

Fixes: 7b0cf70135d1 ("net/i40e: support ARM platform")
Cc: stable@dpdk.org
Signed-off-by: Ruifeng Wang <ruifeng.wang@arm.com>
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
2 years agonet/ice: fix adminq handling on DCF passive reset
Dapeng Yu [Tue, 9 Nov 2021 07:49:47 +0000 (15:49 +0800)]
net/ice: fix adminq handling on DCF passive reset

DCF tries to handle AdminQ when DCF is reset by PF, however the invalid
data may be returned, and error log may be output in this situation.

This patch stops handling AdminQ when a passive reset is detected to
avoid this situation.

Fixes: 7564d5509611 ("net/ice: add DCF hardware initialization")
Cc: stable@dpdk.org
Signed-off-by: Dapeng Yu <dapengx.yu@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
2 years agodoc: describe timestamp limitations for mlx5
Viacheslav Ovsiienko [Mon, 8 Nov 2021 16:41:01 +0000 (18:41 +0200)]
doc: describe timestamp limitations for mlx5

The ConnectX NIC series hardware provides only 63-bit
wide timestamps. The imposed limitations description
added to documentation.

At the moment there are no affected applications known
or bug reports neither, this is just the declaration
of limitation.

Cc: stable@dpdk.org
Signed-off-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
2 years agonet/mlx5: fix modify field action conversion
Viacheslav Ovsiienko [Mon, 8 Nov 2021 14:11:31 +0000 (16:11 +0200)]
net/mlx5: fix modify field action conversion

The routine converting RTE flow modify field action into
field driver's presentation did not specify the field mask
correctly and this resulted into wrong conversion for
the actions with shifted fields.

Fixes: 40c8fb1fd3b3 ("net/mlx5: update modify field action")

Signed-off-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
2 years agocommon/mlx5: fix build for zero-length headroom array
Matan Azrad [Mon, 8 Nov 2021 12:22:04 +0000 (14:22 +0200)]
common/mlx5: fix build for zero-length headroom array

The structure of the striding RQ(MPRQ) buffer includes an array size
defined by the RTE_PKTMBUF_HEADROOM macro added in [1].

When RTE_PKTMBUF_HEADROOM is set to 0 in the compilation config file
the compilation with debug type failed:

"In file included from ../drivers/common/mlx5/mlx5_common.h:25,
                 from ../drivers/common/mlx5/linux/mlx5_nl.h:12,
                 from ../drivers/common/mlx5/linux/mlx5_nl.c:22:
../drivers/common/mlx5/mlx5_common_mr.h:96:10: error: ISO C forbids
                             zero-size array 'pad' [-Werror=pedantic]"

Actually, the array for the first stride headroom is not needed:

Each stride in the striding RQ buffer includes the headroom of the next
stride, so the headroom of the first stride should be allocated before
the starting point of the buffer posted to the HW(HW buffer).

The striding RQ buffer is used as an attached buffer to mbuf and have
shared information per stride.

The LRO support moved all the strides shared information to the top of
the buffer before the first stride headroom but didn't remove the old
memory of this headroom from the buffer.

Remove the old headroom memory from the striding RQ buffer.

[1] commit 7d6bf6b866b8 ("net/mlx5: add Multi-Packet Rx support")

Fixes: 3a22f3877c9d ("net/mlx5: replace external mbuf shared memory")
Cc: stable@dpdk.org
Signed-off-by: Matan Azrad <matan@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
2 years agonet/mlx5: fix RETA update without stopping device
Bing Zhao [Fri, 5 Nov 2021 06:10:57 +0000 (08:10 +0200)]
net/mlx5: fix RETA update without stopping device

The global redirection table is used to create the default flow
rules for the ingress traffic with the lowest priority. It is also
used to create the default RSS rule in the destination table when
there is a tunnel offload.

To update the RETA in-flight, there is no restriction in the ethdev
API. In the previous implementation of mlx5, a port restart was
needed to make the new configuration take effect.

The restart is heavy, e.g., all the queues will be released and
reallocated, users' rules will be flushed. Since the restart is
internal, there is a risk to crash the application when some change
in the ethdev is introduced but no workaround is done in mlx5 PMD.

The users' rules, including the default miss rule for tunnel
offload, should not be impacted by the RETA update. It is improper
to flush all rules when updating RETA.

With this patch, only the default rules will be flushed and
re-created with the new table configuration.

Fixes: 3f2fe392bd49 ("net/mlx5: fix crash during RETA update")
Cc: stable@dpdk.org
Signed-off-by: Bing Zhao <bingz@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
2 years agonet/mlx5: fix tag ID conflict with sample action
Jiawei Wang [Wed, 3 Nov 2021 13:07:59 +0000 (15:07 +0200)]
net/mlx5: fix tag ID conflict with sample action

For the flows containing sample action, the tag action was added
implicitly to store the unique flow index into metadata register in the
split prefix subflow, and then match on this index in the split suffix
subflow. The metadata register for flow index of sample split subflows
was also used to store application metadata TAG 0 item, this might cause
TAG 0 corruption in the flows with sample actions.

This patch uses the same metadata register C index as used for
ASO action since it's reserved and not used directly by the application,
and adds the checking in validation to make sure not to conflict
with ASO CT in the same flow.

Fixes: b4c0ddbfcc58 ("net/mlx5: split sample flow into two sub-flows")
Cc: stable@dpdk.org
Signed-off-by: Jiawei Wang <jiaweiw@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
2 years agonet/mlx5: fix tunnel offload validation
Gregory Etelson [Wed, 3 Nov 2021 08:55:56 +0000 (10:55 +0200)]
net/mlx5: fix tunnel offload validation

Tunnel offload API allows the application to restore packet to
its original form if the chain of flows is missed after DECAP action.

MLX5 PMD provides tunnel offload support only if DV API was enabled.

The patch verifies DV availability before processing with
tunnel offload tasks.

Fixes: 4ec6360de37d ("net/mlx5: implement tunnel offload")
Cc: stable@dpdk.org
Signed-off-by: Gregory Etelson <getelson@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
2 years agocommon/mlx5: fix external memory pool registration
Dmitry Kozlyuk [Tue, 9 Nov 2021 10:32:53 +0000 (12:32 +0200)]
common/mlx5: fix external memory pool registration

Registration of packet mempools with RTE_PKTMBUF_POOL_PINNED_EXT_MEM
was performed incorrectly: after population of such mempool chunks
only contain memory for rte_mbuf structures, while pointers to actual
external memory are not yet filled. MR LKeys could not be obtained
for external memory addresses of such mempools. Rx datapath assumes
all used mempools are registered and does not fallback to dynamic
MR creation in such case, so no packets could be received.

Skip registration of extmem pools on population because it is useless.
If used for Rx, they are registered at port start.
During registration, recognize such pools, inspect their mbufs
and recover the pages they reside in.

While MRs for these pages may already be created by rte_dev_dma_map(),
they are not reused to avoid synchronization on Rx datapath
in case these MRs are changed in the database.

Fixes: 690b2a88c2f7 ("common/mlx5: add mempool registration facilities")

Signed-off-by: Dmitry Kozlyuk <dkozlyuk@nvidia.com>
Reviewed-by: Matan Azrad <matan@nvidia.com>
Reviewed-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
2 years agonet/mlx5: fix meter policy validation
Rongwei Liu [Tue, 2 Nov 2021 07:22:40 +0000 (09:22 +0200)]
net/mlx5: fix meter policy validation

When a user specifies meter policy like "g_actions queue / end
y_actions queue / r_action drop / end", validation logic missed
to set meter policy mode and it took a random value from the stack.

Define ALL policy modes for the mentioned cases.

Fixes: 4b7bf3ffb473 ("net/mlx5: support yellow in meter policy validation")
Cc: stable@dpdk.org
Signed-off-by: Rongwei Liu <rongweil@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
Reviewed-by: Bing Zhao <bingz@nvidia.com>
2 years agonet/mlx5: fix RSS consistency check of meter policy
Bing Zhao [Mon, 18 Oct 2021 14:43:07 +0000 (17:43 +0300)]
net/mlx5: fix RSS consistency check of meter policy

After yellow color actions in the metering policy were supported,
the RSS could be used for both green and yellow colors and only the
queues attribute could be different.

When specifying the attributes of a RSS, some fields can be ignored
and some default values will be used in PMD. For example, there is a
default RSS key in the PMD and it will be used to create the TIR if
nothing is provided by the application.

The default value cases were missed in the current implementation
and it would cause some false positives or crashes.

The comparison function should be adjusted to take all cases into
consideration when RSS is used for both green and yellow colors.

Fixes: 4b7bf3ffb473 ("net/mlx5: support yellow in meter policy validation")
Cc: stable@dpdk.org
Signed-off-by: Bing Zhao <bingz@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
2 years agoethdev: fix device capability to string translation
Dmitry Kozlyuk [Tue, 9 Nov 2021 09:00:57 +0000 (11:00 +0200)]
ethdev: fix device capability to string translation

Add support for RTE_ETH_DEV_CAPA_FLOW_{RULE,SHARED_OBJECT}_KEEP
to rte_eth_dev_capability_name(), missed when adding the capabilities.

Fixes: 1d5a3d68c0f9 ("ethdev: add capability to keep flow rules on restart")
Fixes: 2c9cd45de7e6 ("ethdev: add capability to keep shared objects on restart")

Reported-by: Ali Alnubani <alialnu@nvidia.com>
Signed-off-by: Dmitry Kozlyuk <dkozlyuk@nvidia.com>
Acked-by: Xueming Li <xuemingl@nvidia.com>
Tested-by: Ali Alnubani <alialnu@nvidia.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
2 years agopower: remove unused poll counter
Jim Harris [Fri, 5 Nov 2021 15:53:51 +0000 (15:53 +0000)]
power: remove unused poll counter

Following the previous fix, there is nothing using the ppi counter.

We can remove the related ppi_av array in struct priority_worker.
This allows us to also remove num_dequeue_pkts_prev and pc from
struct priority_worker since they are only used in conjunction
with the ppi_av array.

Suggested-by: David Marchand <david.marchand@redhat.com>
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
2 years agopower: fix build with clang 13
Jim Harris [Fri, 5 Nov 2021 15:53:51 +0000 (15:53 +0000)]
power: fix build with clang 13

clang-13 rightfully complains that the tot_ppi variable in update_stats
is set but not used, since the final accumulated tot_ppi results isn't
used anywhere.

Fixes: 450f0791312c ("power: add traffic pattern aware power control")
Cc: stable@dpdk.org
Signed-off-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
2 years agoeal/arm64: support ASan
Volodymyr Fialko [Tue, 9 Nov 2021 09:59:52 +0000 (10:59 +0100)]
eal/arm64: support ASan

This patch defines ASAN_SHADOW_OFFSET for arm64 according to the ASan
documentation. This offset should cover all arm64 VMAs supported by
ASan.

Signed-off-by: Volodymyr Fialko <vfialko@marvell.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
Acked-by: Ruifeng Wang <ruifeng.wang@arm.com>
2 years agobuild: factorize jansson availability check
David Marchand [Mon, 8 Nov 2021 10:08:08 +0000 (11:08 +0100)]
build: factorize jansson availability check

Since two components wants to know if the jansson library is available,
move it to config/.

Signed-off-by: David Marchand <david.marchand@redhat.com>
2 years agonet/mlx5: workaround MR creation for flow counter
Michael Baum [Tue, 9 Nov 2021 12:36:12 +0000 (14:36 +0200)]
net/mlx5: workaround MR creation for flow counter

Due to kernel driver / FW issues in direct MKEY creation using the DevX
API, this patch replaces the counter MR creation to use wrapped mkey
API.

Fixes: 5382d28c2110 ("net/mlx5: accelerate DV flow counter transactions")
Cc: stable@dpdk.org
Signed-off-by: Michael Baum <michaelba@nvidia.com>
Signed-off-by: Matan Azrad <matan@nvidia.com>
2 years agovdpa/mlx5: workaround guest MR registrations
Michael Baum [Tue, 9 Nov 2021 12:36:11 +0000 (14:36 +0200)]
vdpa/mlx5: workaround guest MR registrations

Due to kernel issue in direct MKEY creation using the DevX API, this
patch replaces the virtio MR creation to use Verbs API.

Fixes: cc07a42da250 ("vdpa/mlx5: prepare memory regions")
Cc: stable@dpdk.org
Signed-off-by: Michael Baum <michaelba@nvidia.com>
Signed-off-by: Matan Azrad <matan@nvidia.com>
2 years agovdpa/mlx5: workaround dirty bitmap MR creation
Matan Azrad [Tue, 9 Nov 2021 12:36:10 +0000 (14:36 +0200)]
vdpa/mlx5: workaround dirty bitmap MR creation

Due to kernel driver/FW issues in direct MKEY creation using the DevX
API, this patch replaces the dirty bitmap MR creation to use wrapped
mkey instead.

Fixes: 9d39e57f21ac ("vdpa/mlx5: support live migration")
Cc: stable@dpdk.org
Signed-off-by: Michael Baum <michaelba@nvidia.com>
Signed-off-by: Matan Azrad <matan@nvidia.com>
2 years agocommon/mlx5: create wrapped MR
Matan Azrad [Tue, 9 Nov 2021 12:36:09 +0000 (14:36 +0200)]
common/mlx5: create wrapped MR

The mlx5 PMD uses the kernel mlx5 driver to map physical memory to the
HW.

Using the Verbs API ibv_reg_mr, a mkey can be created for that.
In this case, the mkey is signed on the user ID of the kernel driver.

Using the DevX API, a mkey also can be created, but it should point an
umem object (represents the specific buffer mapping) created by the
kernel. In this case, the mkey is signed on the user ID of the process
DevX context.

In FW DevX control commands which get mkey as a parameter, there is
a security check on the user ID and Verbs mkeys are rejected.

Unfortunately, also when using DevX mkey, there is an error in the FW
command on umem validation because the umem is not designed to be used
for any mkey parameters.

As a workaround to the kernel driver/FW issue, it is needed to use a
wrapped MR, which is an indirect mkey(created by the DevX API) pointing to
direct mkey created by the kernel for any DevX command uses an MR.

Add an API to create and destroy this wrapped MR.

Fixes: 5382d28c2110 ("net/mlx5: accelerate DV flow counter transactions")
Fixes: 9d39e57f21ac ("vdpa/mlx5: support live migration")
Cc: stable@dpdk.org
Signed-off-by: Michael Baum <michaelba@nvidia.com>
Signed-off-by: Matan Azrad <matan@nvidia.com>
2 years agocommon/mlx5: glue MR registration with IOVA
Michael Baum [Tue, 9 Nov 2021 12:36:08 +0000 (14:36 +0200)]
common/mlx5: glue MR registration with IOVA

Add support for rdma-core API to register IOVA MR.
The API gets the process VA, size, and IOVA and returns a memory region
with space pointed by a specific IOVA.

So any access in this MR should come with an address that is relative to
the IOVA specified in the API.

Fixes: cc07a42da250 ("vdpa/mlx5: prepare memory regions")
Cc: stable@dpdk.org
Signed-off-by: Michael Baum <michaelba@nvidia.com>
Signed-off-by: Matan Azrad <matan@nvidia.com>
2 years agousertools/devbind: update octeontx2 DMA device
Radha Mohan Chintakuntla [Tue, 9 Nov 2021 23:32:19 +0000 (15:32 -0800)]
usertools/devbind: update octeontx2 DMA device

The octeontx2_dma rawdev driver is removed in DPDK-21.11. The new driver
for the same device uses the dmadev. So this patch updates the device
naming and lists it under dma devices section.

Signed-off-by: Radha Mohan Chintakuntla <radhac@marvell.com>
2 years agodma/dpaa: support statistics
Gagandeep Singh [Tue, 9 Nov 2021 04:39:10 +0000 (10:09 +0530)]
dma/dpaa: support statistics

This patch support DMA read and reset statistics operations.

Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
2 years agodma/dpaa: support DMA operations
Gagandeep Singh [Tue, 9 Nov 2021 04:39:09 +0000 (10:09 +0530)]
dma/dpaa: support DMA operations

This patch support copy, submit, completed and
completed status functionality of DMA driver.

Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
2 years agodma/dpaa: support basic operations
Gagandeep Singh [Tue, 9 Nov 2021 04:39:08 +0000 (10:09 +0530)]
dma/dpaa: support basic operations

This patch support basic DMA operations which includes
device capability and channel setup.

Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
2 years agodma/dpaa: add device probing
Gagandeep Singh [Tue, 9 Nov 2021 04:39:07 +0000 (10:09 +0530)]
dma/dpaa: add device probing

This patch add device initialisation functionality.

Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
2 years agodma/dpaa: introduce DPAA DMA driver skeleton
Gagandeep Singh [Tue, 9 Nov 2021 04:39:06 +0000 (10:09 +0530)]
dma/dpaa: introduce DPAA DMA driver skeleton

The DPAA DMA  driver is an implementation of the dmadev APIs,
that provide means to initiate a DMA transaction from CPU.
The initiated DMA is performed without CPU being involved
in the actual DMA transaction. This is achieved via using
the QDMA controller of DPAA SoC.

Signed-off-by: Gagandeep Singh <g.singh@nxp.com>
2 years agoci: add ppc64le cross compilation in GHA
David Christensen [Mon, 8 Nov 2021 17:53:11 +0000 (09:53 -0800)]
ci: add ppc64le cross compilation in GHA

Enable Github Actions to cross-compile code for POWER systems.

Signed-off-by: David Christensen <drc@linux.vnet.ibm.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
2 years agotest: fix dependency on pcapng
David Marchand [Mon, 8 Nov 2021 10:09:19 +0000 (11:09 +0100)]
test: fix dependency on pcapng

The unit test code should depend on the pcapng library.

Fixes: 7a944656b33f ("test/pcapng: test pcapng library")

Signed-off-by: David Marchand <david.marchand@redhat.com>
2 years agobuild: cleanup libpcap dependent components
David Marchand [Mon, 8 Nov 2021 10:09:18 +0000 (11:09 +0100)]
build: cleanup libpcap dependent components

The RTE_PORT_PCAP variable is used to signal libpcap availability,
though its name seems to refer to pcap support in the port library.
Prefer a generic name and add explicit link dependencies where needed.

Fixes: 7a944656b33f ("test/pcapng: test pcapng library")
Fixes: 2eccf6afbea9 ("bpf: add function to convert classic BPF to DPDK BPF")
Fixes: cbb44143be74 ("app/dumpcap: add new packet capture application")

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
2 years agoexamples: skip build when missing dependencies
David Marchand [Sat, 6 Nov 2021 08:53:04 +0000 (09:53 +0100)]
examples: skip build when missing dependencies

Trying to disable the vhost library, meson will complain it can't build
the vhost* and vdpa examples when passing -Dexamples=all.

-Dexamples=all skips examples if the example itself announces it can't
be built (for external dependencies, internal dependencies and other
reasons).
Since examples/meson.build will evaluate the internal dependencies
in any case, let's move the check there and resolve the issue for
optional internal libraries.

Fixes: 0bf583222297 ("lib: allow disabling optional libraries")

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
2 years agotest: add bitmap to fast tests
David Marchand [Wed, 27 Oct 2021 14:05:44 +0000 (16:05 +0200)]
test: add bitmap to fast tests

This test was never added to the list of tests to run in CI.
Its name does not follow the implicit convention of ending with
_autotest.
Let's fix this.

Fixes: 5e9647fd5a1a ("test/bitmap: test scan after half cacheline is cleared")

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
2 years agotest/ipfrag: check fragment offsets
Huichao Cai [Mon, 25 Oct 2021 07:58:59 +0000 (15:58 +0800)]
test/ipfrag: check fragment offsets

Add the test content of the fragment_offset(offset and MF)
to the test_ip_frag function. Add test data for a fragment
that is not the last fragment.

Signed-off-by: Huichao Cai <chcchc88@163.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
2 years agoversion: 21.11-rc2
Thomas Monjalon [Mon, 8 Nov 2021 23:45:12 +0000 (00:45 +0100)]
version: 21.11-rc2

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
2 years agoip_frag: revert fix fragmenting IPv4 fragment
Huichao Cai [Mon, 25 Oct 2021 07:55:53 +0000 (15:55 +0800)]
ip_frag: revert fix fragmenting IPv4 fragment

The patch ("ip_frag: fix fragmenting IPv4 fragment") introduces
a bug and needs to be rolled back. This is because the patch
and variables "flag_offset" conflict with each other.

Bugzilla ID: 835
Fixes: 567473433b7e ("ip_frag: fix fragmenting IPv4 fragment")
Cc: stable@dpdk.org
Signed-off-by: Huichao Cai <chcchc88@163.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
2 years agoip_frag: increase default maximum of fragments
Konstantin Ananyev [Tue, 2 Nov 2021 19:03:09 +0000 (19:03 +0000)]
ip_frag: increase default maximum of fragments

Increase default value for config parameter RTE_LIBRTE_IP_FRAG_MAX_FRAG
from 4 to 8. This parameter controls maximum number of fragments per
packet in ip reassembly table. Increasing this value from 4 to 8 will
allow users to cover common case with jumbo packet size of 9KB and
fragments with default frame size (1500B).
As RTE_LIBRTE_IP_FRAG_MAX_FRAG is used in definition of public
structure (struct rte_ip_frag_death_row), this is an ABI change.

Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
2 years agoip_frag: hide internal structures
Konstantin Ananyev [Mon, 8 Nov 2021 13:55:54 +0000 (13:55 +0000)]
ip_frag: hide internal structures

Move internal reassembly structures into new private
header 'ip_reassembly.h'.

Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
2 years agoapp/testpmd: remove unused header file
Huisong Li [Mon, 25 Oct 2021 06:39:22 +0000 (14:39 +0800)]
app/testpmd: remove unused header file

This patch removes unused "rte_eth_bond.h" header file.

Fixes: 2950a769315e ("bond: testpmd support")
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>
2 years agonet/sfc: support decrement IP TTL actions in transfer flows
Ivan Malov [Fri, 5 Nov 2021 21:54:09 +0000 (00:54 +0300)]
net/sfc: support decrement IP TTL actions in transfer flows

These actions map to MAE action DECR_IP_TTL. It affects
the outermost header in the current processing state of
the packet, which might have been decapsulated by prior
action DECAP. It also updates IPv4 checksum accordingly.

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
2 years agocommon/sfc_efx/base: add API to decrement TTL action to set
Ivan Malov [Fri, 5 Nov 2021 21:54:08 +0000 (00:54 +0300)]
common/sfc_efx/base: add API to decrement TTL action to set

Affects the outermost header, taking prior action DECAP into
account. Takes care to also update IPv4 checksum accordingly.

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
2 years agocommon/sfc_efx/base: factor out no-op helper functions
Ivan Malov [Fri, 5 Nov 2021 21:54:07 +0000 (00:54 +0300)]
common/sfc_efx/base: factor out no-op helper functions

When an action gets added to an action set, a special helper is
used to handle its arguments. There are actions which have no
arguments, and the corresponding helpers are duplicates in
fact. Use a unified no-op helper instead of them.

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
2 years agocommon/sfc_efx/base: refine adding count action to set
Ivan Malov [Fri, 5 Nov 2021 21:54:06 +0000 (00:54 +0300)]
common/sfc_efx/base: refine adding count action to set

1) Invalid counter ID is always set by default.
   Do not set it again when adding the action.

2) Counter ID validity check is missing in the
   action set allocation helper. Introduce it.

Fixes: 238306cf9aff ("common/sfc_efx/base: support counter in action set")
Cc: stable@dpdk.org
Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
2 years agocommon/sfc_efx/base: refine adding encap action to set
Ivan Malov [Fri, 5 Nov 2021 21:54:05 +0000 (00:54 +0300)]
common/sfc_efx/base: refine adding encap action to set

1) Invalid encap. header ID is always set by default.
   Do not set it again when adding the action.

2) Encap. header ID validity check is missing in the
   action set allocation helper. Introduce it.

Fixes: 3907defa5bf0 ("common/sfc_efx/base: support adding encap action to a set")
Cc: stable@dpdk.org
Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
2 years agonet/hns3: remove PF/VF duplicate code
Chengwen Feng [Sat, 6 Nov 2021 01:43:06 +0000 (09:43 +0800)]
net/hns3: remove PF/VF duplicate code

This patch remove PF/VF duplicate code of:
1. get firmware version.
2. get device info.
3. rx interrupt related functions.

Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
2 years agonet/hns3: mark unchecked return of snprintf
Huisong Li [Sat, 6 Nov 2021 01:43:05 +0000 (09:43 +0800)]
net/hns3: mark unchecked return of snprintf

Fixing the return value of the function to clear static warning.

Fixes: 1181500b2fc5 ("net/hns3: adjust MAC address logging")
Cc: stable@dpdk.org
Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
2 years agonet/hns3: remove magic numbers
Huisong Li [Sat, 6 Nov 2021 01:43:04 +0000 (09:43 +0800)]
net/hns3: remove magic numbers

Removing magic numbers with macros.

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
2 years agonet/hns3: move declarations in flow header file
Min Hu (Connor) [Sat, 6 Nov 2021 01:43:03 +0000 (09:43 +0800)]
net/hns3: move declarations in flow header file

This patch adds a hns3_flow.h to make the code easier to maintain.

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
2 years agonet/hns3: extract common code to its own file
Huisong Li [Sat, 6 Nov 2021 01:43:02 +0000 (09:43 +0800)]
net/hns3: extract common code to its own file

This patch extracts a common file to store the common code for PF and VF
driver.

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
2 years agonet/hns3: use unsigned integer for bitwise operations
Huisong Li [Sat, 6 Nov 2021 01:43:01 +0000 (09:43 +0800)]
net/hns3: use unsigned integer for bitwise operations

Bitwise operations should be used only with unsigned integer. This patch
modifies some code that does not meet this rule.

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
2 years agonet/hns3: modify an indent alignment
Huisong Li [Sat, 6 Nov 2021 01:43:00 +0000 (09:43 +0800)]
net/hns3: modify an indent alignment

This patch modifies some code alignment issues to make the code style
more consistent.

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
2 years agonet/hns3: remove redundant function declaration
Huisong Li [Sat, 6 Nov 2021 01:42:59 +0000 (09:42 +0800)]
net/hns3: remove redundant function declaration

This patch removes a redundant function declaration for
hns3_rx_check_vec_support().

Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
2 years agonet/hns3: simplify queue DMA address arithmetic
Huisong Li [Sat, 6 Nov 2021 01:42:58 +0000 (09:42 +0800)]
net/hns3: simplify queue DMA address arithmetic

The patch obtains the upper 32 bits of the Rx/Tx queue DMA address in one
step instead of two steps.

Fixes: bba636698316 ("net/hns3: support Rx/Tx and related operations")
Cc: stable@dpdk.org
Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
2 years agonet/mlx5: fix split buffer Rx
Dmitry Kozlyuk [Mon, 8 Nov 2021 11:17:15 +0000 (13:17 +0200)]
net/mlx5: fix split buffer Rx

Routine to lookup LKey on Rx was assuming that the mbuf address
always belongs to a single mempool: the one associated with an RxQ
or the MPRQ mempool. This assumption is false for split buffers case.
A wrong LKey was looked up, resulting in completion errors.
Modify lookup routines to lookup LKey in the mbuf->pool
for non-MPRQ cases both on Rx datapath and on queue initialization.

Fixes: fec28ca0e3a9 ("net/mlx5: support mempool registration")

Signed-off-by: Dmitry Kozlyuk <dkozlyuk@nvidia.com>
Reviewed-by: Matan Azrad <matan@nvidia.com>
Reviewed-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
2 years agocommon/mlx5: fix queue size in DevX queue pair creation
Raja Zidane [Mon, 8 Nov 2021 13:09:21 +0000 (13:09 +0000)]
common/mlx5: fix queue size in DevX queue pair creation

The number of WQEBBs was provided to QP create, and QP size was calculated
by multiplying the number of WQEBBs by 64, which is the send WQE size.
When creating RQ in the QP (i.e., vdpa driver), the queue size was bigger
because the receive WQE size is 16.
Provide queue size to QP create instead of the number of WQEBBs.

Fixes: f9213ab12cf9 ("common/mlx5: share DevX queue pair operations")

Signed-off-by: Raja Zidane <rzidane@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
2 years agocrypto/mlx5: fix queue size configuration
Raja Zidane [Mon, 8 Nov 2021 13:09:20 +0000 (13:09 +0000)]
crypto/mlx5: fix queue size configuration

The DevX interface for QP creation expects the number of WQEBBs.
Wrongly, the number of descriptors was provided to the QP creation.
In addition, the QP size must be a power of 2 what was not guaranteed.
Provide the number of WQEBBs to the QP creation API.
Round up the SQ size to a power of 2.
Rename (sq/rq)_size to num_of_(send/receive)_wqes.

Fixes: 6152534e211e ("crypto/mlx5: support queue pairs operations")
Cc: stable@dpdk.org
Signed-off-by: Raja Zidane <rzidane@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
Acked-by: Tal Shnaiderman <talshn@nvidia.com>
2 years agocrypto/mlx5: fix freeing on probing failure
Raja Zidane [Mon, 8 Nov 2021 13:09:19 +0000 (13:09 +0000)]
crypto/mlx5: fix freeing on probing failure

When calling device close, unset dek is called which destroys a hash list.
In case of error during dev probe, close is called when dek hlist is not
initialized.
Ensure non null list destroy.

Fixes: 90646d6c6e22 ("crypto/mlx5: support basic operations")
Cc: stable@dpdk.org
Signed-off-by: Raja Zidane <rzidane@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
2 years agocommon/mlx5: fix DevX queue size overflow
Raja Zidane [Mon, 8 Nov 2021 13:09:18 +0000 (13:09 +0000)]
common/mlx5: fix DevX queue size overflow

The HW QP/SQ/RQ/CQ queue sizes may be bigger than 64KB.
The width of the variable handled the queue size is 16 bits
which cannot contain the maximum queue size.
Replace the size type to be uint32_t.

Fixes: 9dab4d62b4dc ("common/mlx5: share DevX CQ creation")
Fixes: 38f537635c15 ("common/mlx5: share DevX SQ creation")
Fixes: f9213ab12cf9 ("common/mlx5: share DevX queue pair operations")
Cc: stable@dpdk.org
Signed-off-by: Raja Zidane <rzidane@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
2 years agointerrupt: fix request notifier interrupt processing
Maciej Szwed [Tue, 19 Oct 2021 10:06:57 +0000 (12:06 +0200)]
interrupt: fix request notifier interrupt processing

We should call read() on RTE_INTR_HANDLE_VFIO_REQ event
to confirm that event.

Fixes: 0eb8a1c4c786 ("vfio: add request notifier interrupt")
Cc: stable@dpdk.org
Signed-off-by: Maciej Szwed <maciej.szwed@intel.com>
2 years agonet/mlx4: fix crash on allocation failure
Harman Kalra [Mon, 1 Nov 2021 17:53:37 +0000 (23:23 +0530)]
net/mlx4: fix crash on allocation failure

This patch fixes coverity issue by adding a NULL check.

Coverity issue: 373687
Fixes: d61138d4f0e2 ("drivers: remove direct access to interrupt handle")

Signed-off-by: Harman Kalra <hkalra@marvell.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
Acked-by: David Marchand <david.marchand@redhat.com>
2 years agodrivers: check interrupt file descriptor validity
Harman Kalra [Mon, 1 Nov 2021 17:53:34 +0000 (23:23 +0530)]
drivers: check interrupt file descriptor validity

This patch fixes coverity issue by adding a check for negative value to
avoid bad bit shift operation and other invalid use of file descriptors.

Coverity issue: 373717, 373697, 373685
Coverity issue: 373723, 373720, 373719, 373718, 373715, 373714, 373713
Coverity issue: 373710, 373707, 373706, 373705, 373704, 373701, 373700
Coverity issue: 373698, 373695, 373692, 373690, 373689
Coverity issue: 373722, 373721, 373709, 373702, 373696
Fixes: d61138d4f0e2 ("drivers: remove direct access to interrupt handle")

Signed-off-by: Harman Kalra <hkalra@marvell.com>
Acked-by: Haiyue Wang <haiyue.wang@intel.com>
Acked-by: David Marchand <david.marchand@redhat.com>
2 years agoeal/linux: check interrupt file descriptor validity
Harman Kalra [Mon, 1 Nov 2021 17:53:33 +0000 (23:23 +0530)]
eal/linux: check interrupt file descriptor validity

This patch fixes coverity issue by adding a check for negative event fd
value.

Coverity issue: 373711, 373694
Fixes: c2bd9367e18f ("lib: remove direct access to interrupt handle")

Signed-off-by: Harman Kalra <hkalra@marvell.com>
Acked-by: David Marchand <david.marchand@redhat.com>
2 years agointerrupts: check file descriptor validity
Harman Kalra [Mon, 1 Nov 2021 17:53:32 +0000 (23:23 +0530)]
interrupts: check file descriptor validity

This patch fixes coverity issues by adding a check for negative event
fd value.

Coverity issue: 373716, 373699, 373693, 373688
Fixes: bbbac4cd6ed2 ("interrupts: remove direct access to interrupt handle")

Signed-off-by: Harman Kalra <hkalra@marvell.com>
Acked-by: David Marchand <david.marchand@redhat.com>
2 years agodoc: add CUDA example in GPU guide
Elena Agostini [Mon, 8 Nov 2021 18:58:05 +0000 (18:58 +0000)]
doc: add CUDA example in GPU guide

Add a pseudo-code example to show how to use gpudev API
with a CUDA application.

Signed-off-by: Elena Agostini <eagostini@nvidia.com>
2 years agogpudev: add communication list
Elena Agostini [Mon, 8 Nov 2021 18:58:04 +0000 (18:58 +0000)]
gpudev: add communication list

In heterogeneous computing system, processing is not only in the CPU.
Some tasks can be delegated to devices working in parallel.
When mixing network activity with task processing there may be the need
to put in communication the CPU with the device in order to synchronize
operations.

An example could be a receive-and-process application
where CPU is responsible for receiving packets in multiple mbufs
and the GPU is responsible for processing the content of those packets.

The purpose of this list is to provide a buffer in CPU memory visible
from the GPU that can be treated as a circular buffer
to let the CPU provide fondamental info of received packets to the GPU.

A possible use-case is described below.

CPU:
- Trigger some task on the GPU
- in a loop:
    - receive a number of packets
    - provide packets info to the GPU

GPU:
- Do some pre-processing
- Wait to receive a new set of packet to be processed

Layout of a communication list would be:

     -------
    |   0    | => pkt_list
    | status |
    | #pkts  |
     -------
    |   1    | => pkt_list
    | status |
    | #pkts  |
     -------
    |   2    | => pkt_list
    | status |
    | #pkts  |
     -------
    |  ....  | => pkt_list
     -------

Signed-off-by: Elena Agostini <eagostini@nvidia.com>
2 years agogpudev: add communication flag
Elena Agostini [Mon, 8 Nov 2021 18:58:03 +0000 (18:58 +0000)]
gpudev: add communication flag

In heterogeneous computing system, processing is not only in the CPU.
Some tasks can be delegated to devices working in parallel.
When mixing network activity with task processing there may be the need
to put in communication the CPU with the device in order to synchronize
operations.

The purpose of this flag is to allow the CPU and the GPU to
exchange ACKs. A possible use-case is described below.

CPU:
- Trigger some task on the GPU
- Prepare some data
- Signal to the GPU the data is ready updating the communication flag

GPU:
- Do some pre-processing
- Wait for more data from the CPU polling on the communication flag
- Consume the data prepared by the CPU

Signed-off-by: Elena Agostini <eagostini@nvidia.com>
2 years agogpudev: add memory barrier
Elena Agostini [Mon, 8 Nov 2021 18:58:02 +0000 (18:58 +0000)]
gpudev: add memory barrier

Add a function for the application to ensure the coherency
of the writes executed by another device into the GPU memory.

Signed-off-by: Elena Agostini <eagostini@nvidia.com>
2 years agogpudev: add memory API
Elena Agostini [Mon, 8 Nov 2021 18:58:01 +0000 (18:58 +0000)]
gpudev: add memory API

In heterogeneous computing system, processing is not only in the CPU.
Some tasks can be delegated to devices working in parallel.
Such workload distribution can be achieved by sharing some memory.

As a first step, the features are focused on memory management.
A function allows to allocate memory inside the device,
or in the main (CPU) memory while making it visible for the device.
This memory may be used to save packets or for synchronization data.

The next step should focus on GPU processing task control.

Signed-off-by: Elena Agostini <eagostini@nvidia.com>
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
2 years agogpudev: support multi-process
Thomas Monjalon [Mon, 8 Nov 2021 18:58:00 +0000 (18:58 +0000)]
gpudev: support multi-process

The device data shared between processes are moved in a struct
allocated in a shared memory (a new memzone for all GPUs).
The main struct rte_gpu references the shared memory
via the pointer mpshared.

The API function rte_gpu_attach() is added to attach a device
from the secondary process.
The function rte_gpu_allocate() can be used only by primary process.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
2 years agogpudev: add child device representing a device context
Thomas Monjalon [Mon, 8 Nov 2021 18:57:59 +0000 (18:57 +0000)]
gpudev: add child device representing a device context

The computing device may operate in some isolated contexts.
Memory and processing are isolated in a silo represented by
a child device.
The context is provided as an opaque by the caller of
rte_gpu_add_child().

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
2 years agogpudev: add event notification
Thomas Monjalon [Mon, 8 Nov 2021 18:57:58 +0000 (18:57 +0000)]
gpudev: add event notification

Callback functions may be registered for a device event.
Callback management is per-process and not thread-safe.

The events RTE_GPU_EVENT_NEW and RTE_GPU_EVENT_DEL
are notified respectively after creation and before removal
of a device, as part of the library functions.
Some future events may be emitted from drivers.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>