dpdk.git
3 years agoexamples/l2fwd-crypto: fix build with pkg-config
David Marchand [Sat, 14 Nov 2020 09:05:26 +0000 (10:05 +0100)]
examples/l2fwd-crypto: fix build with pkg-config

Two issues fixed here.

First add the experimental flag.
Then fix a link issue with the crypto scheduler driver:
/usr/bin/ld: /tmp/cchr7aHA.o: in function `main':
main.c:(.text.startup+0x1673): undefined reference to
`rte_cryptodev_scheduler_workers_get'
collect2: error: ld returned 1 exit status

Fixes: e3bcb99a5e13 ("examples/l2fwd-crypto: limit number of sessions")
Fixes: 261bbff75e34 ("examples: use separate crypto session mempools")
Cc: stable@dpdk.org
Signed-off-by: David Marchand <david.marchand@redhat.com>
3 years agoexamples/kni: fix build with pkg-config
David Marchand [Sat, 14 Nov 2020 09:05:25 +0000 (10:05 +0100)]
examples/kni: fix build with pkg-config

rm -f build/kni build/kni-static build/kni-shared
test -d build && rmdir -p build || true
[...]
/usr/bin/ld: /tmp/cc72ssnK.o: undefined reference to symbol
'pthread_join@@GLIBC_2.2.5'

This example explicitly call pthread API and should be linked against
the pthread library.

Fixes: 724beb913b44 ("examples/kni: monitor and update link state continually")
Cc: stable@dpdk.org
Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
3 years agoexamples/ipsec-gw: fix build with pkg-config
David Marchand [Sat, 14 Nov 2020 09:05:24 +0000 (10:05 +0100)]
examples/ipsec-gw: fix build with pkg-config

flow.c: In function ‘parse_flow_tokens’:
flow.c:153:23: error: taking address of packed member of ‘struct
rte_ipv4_hdr’ may result in an unaligned pointer value
[-Werror=address-of-packed-member]
  153 |     if (ipv4_addr_cpy(&rule->ipv4.spec.hdr.src_addr,
      |                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
flow.c:154:9: error: taking address of packed member of ‘struct
rte_ipv4_hdr’ may result in an unaligned pointer value
[-Werror=address-of-packed-member]
  154 |         &rule->ipv4.mask.hdr.src_addr,
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
flow.c:170:23: error: taking address of packed member of ‘struct
rte_ipv4_hdr’ may result in an unaligned pointer value
[-Werror=address-of-packed-member]
  170 |     if (ipv4_addr_cpy(&rule->ipv4.spec.hdr.dst_addr,
      |                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
flow.c:171:9: error: taking address of packed member of ‘struct
rte_ipv4_hdr’ may result in an unaligned pointer value
[-Werror=address-of-packed-member]
  171 |         &rule->ipv4.mask.hdr.dst_addr,
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors

Meson build is fine since we waive those warnings.
Replicate it for make.

Fixes: 8e693616fcb2 ("examples/ipsec-secgw: enable flow based distribution")
Cc: stable@dpdk.org
Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
3 years agoexamples/fips_validation: fix build with pkg-config
David Marchand [Sat, 14 Nov 2020 09:05:23 +0000 (10:05 +0100)]
examples/fips_validation: fix build with pkg-config

When this example started using rte_cryptodev_sym_session_pool_create,
the part for pkg-config builds was not updated.

Fixes: 261bbff75e34 ("examples: use separate crypto session mempools")
Cc: stable@dpdk.org
Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
4 years agoapp/eventdev: check timer adadpters number
Pavan Nikhilesh [Thu, 12 Nov 2020 17:43:29 +0000 (23:13 +0530)]
app/eventdev: check timer adadpters number

Fix SEGFAULT when nb_timer_adapters command line parameter is
set to 0.

Fixes: 98c6292105d4 ("app/eventdev: add options for event timer adapter")
Cc: stable@dpdk.org
Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
4 years agoevent/dlb: remove duplicate/unused PCI code
Timothy McDaniel [Wed, 11 Nov 2020 20:27:02 +0000 (14:27 -0600)]
event/dlb: remove duplicate/unused PCI code

Use rte_pci_find_ext_capability instead of private version,
Remove unused PCI offsets and values
Use PCI definitions from rte_pci.h, where available.

Signed-off-by: Timothy McDaniel <timothy.mcdaniel@intel.com>
4 years agoevent/dlb: skip memzone freeing if port created
Timothy McDaniel [Wed, 11 Nov 2020 20:27:01 +0000 (14:27 -0600)]
event/dlb: skip memzone freeing if port created

Add missing returns so that the memzone free is not called if
port create is successful.

Signed-off-by: Timothy McDaniel <timothy.mcdaniel@intel.com>
Reviewed-by: Mike Ximing Chen <mike.ximing.chen@intel.com>
4 years agoevent/dlb2: remove duplicate/unused PCI code
Timothy McDaniel [Wed, 11 Nov 2020 20:27:00 +0000 (14:27 -0600)]
event/dlb2: remove duplicate/unused PCI code

Use rte_pci_find_ext_capability instead of private version,
Remove unused PCI offsets and values
Use PCI definitions from rte_pci.h, where available.

Signed-off-by: Timothy McDaniel <timothy.mcdaniel@intel.com>
4 years agoevent/dlb2: add delayed token pop logic
Timothy McDaniel [Wed, 11 Nov 2020 20:26:59 +0000 (14:26 -0600)]
event/dlb2: add delayed token pop logic

The code contained in this commit was inadvertently omitted
when dissecting the dlb2 code base into discrete patches for
upstream.

Signed-off-by: Timothy McDaniel <timothy.mcdaniel@intel.com>
Reviewed-by: Mike Ximing Chen <mike.ximing.chen@intel.com>
4 years agodoc: add some features to DLB2 guide
Timothy McDaniel [Thu, 5 Nov 2020 21:22:51 +0000 (15:22 -0600)]
doc: add some features to DLB2 guide

Add queue depth threshold and class of service sections
to DLB2 rst file.

Fixes: 5433956 ("event/dlb2: add eventdev probe")

Signed-off-by: Timothy McDaniel <timothy.mcdaniel@intel.com>
4 years agoevent/dlb2: fix mempool query in self test
Timothy McDaniel [Thu, 5 Nov 2020 21:22:52 +0000 (15:22 -0600)]
event/dlb2: fix mempool query in self test

Add NULL check before using t->mbuf_pool.

Coverity issue: 363719
Fixes: 6f1b828 ("event/dlb2: add self-tests")

Signed-off-by: Timothy McDaniel <timothy.mcdaniel@intel.com>
4 years agoevent/dlb: remove useless assignment
Timothy McDaniel [Thu, 5 Nov 2020 21:22:54 +0000 (15:22 -0600)]
event/dlb: remove useless assignment

Remove nonproductive assignment of qmport->cq_depth.

Coverity issue: 363717
Fixes: ee57517 ("event/dlb: add port setup")

Signed-off-by: Timothy McDaniel <timothy.mcdaniel@intel.com>
4 years agoevent/dlb: fix memory overrun in PF reset
Timothy McDaniel [Thu, 5 Nov 2020 21:22:53 +0000 (15:22 -0600)]
event/dlb: fix memory overrun in PF reset

Fix memory corruption bug caused by passing address of a 16b value,
instead of address of a 32b value.

Coverity issue: 363715
Fixes: 1998008 ("event/dlb: add eventdev probe")

Signed-off-by: Timothy McDaniel <timothy.mcdaniel@intel.com>
4 years agodoc: support IPsec Multi-buffer lib v0.55
Pablo de Lara [Thu, 12 Nov 2020 16:36:21 +0000 (16:36 +0000)]
doc: support IPsec Multi-buffer lib v0.55

Updated AESNI MB and AESNI GCM PMD documentation guides
with information about the latest Intel IPSec Multi-buffer
library supported.

Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
4 years agotest/crypto: fix typo in block cipher output
Ciara Power [Wed, 11 Nov 2020 09:42:54 +0000 (09:42 +0000)]
test/crypto: fix typo in block cipher output

The print statement had a typo, "sesionless" should have been
"sessionless". This is now fixed.

Fixes: afcfa2fd0431 ("test/crypto: check session-less support")
Cc: stable@dpdk.org
Signed-off-by: Ciara Power <ciara.power@intel.com>
4 years agotest/crypto: fix out-of-place test
Fan Zhang [Thu, 5 Nov 2020 13:58:57 +0000 (13:58 +0000)]
test/crypto: fix out-of-place test

This patch fixes bypassed out of place test for PMDs that support it.

Fixes: 4868f6591c6f ("test/crypto: add cases for raw datapath API")

Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
Acked-by: Adam Dybkowski <adamx.dybkowski@intel.com>
4 years agodoc: fix typo in ipsec-secgw guide
David Marchand [Thu, 5 Nov 2020 08:36:17 +0000 (09:36 +0100)]
doc: fix typo in ipsec-secgw guide

Fixes: 02dc5b7d58c7 ("doc: update ipsec-secgw guide and release notes")
Cc: stable@dpdk.org
Signed-off-by: David Marchand <david.marchand@redhat.com>
4 years agodoc: add reference to Intel baseband configuration tool
Nicolas Chautru [Tue, 3 Nov 2020 19:39:36 +0000 (11:39 -0800)]
doc: add reference to Intel baseband configuration tool

Adding reference to pf_bb_config in github to do
device configuration of the fpga_5gnr, fpga_lte and
acc100 devices and pmds.

Signed-off-by: Nicolas Chautru <nicolas.chautru@intel.com>
Reviewed-by: Tom Rix <trix@redhat.com>
4 years agocommon/cpt: remove redundant structure
Archana Muniganti [Tue, 3 Nov 2020 08:37:17 +0000 (14:07 +0530)]
common/cpt: remove redundant structure

Replaced structure 'rid' which has single field with its
field itself.

Signed-off-by: Archana Muniganti <marchana@marvell.com>
Acked-by: Anoob Joseph <anoobj@marvell.com>
4 years agocommon/cpt: use predefined macros
Archana Muniganti [Tue, 3 Nov 2020 08:37:16 +0000 (14:07 +0530)]
common/cpt: use predefined macros

Replace redundant macro ROUNDUP* with predefined macros.

Signed-off-by: Archana Muniganti <marchana@marvell.com>
Acked-by: Anoob Joseph <anoobj@marvell.com>
4 years agocommon/cpt: remove temporary variables
Archana Muniganti [Tue, 3 Nov 2020 08:37:15 +0000 (14:07 +0530)]
common/cpt: remove temporary variables

Remove temporary variable used in datapath.

Signed-off-by: Archana Muniganti <marchana@marvell.com>
Acked-by: Anoob Joseph <anoobj@marvell.com>
4 years agocommon/cpt: prepopulate word7 in session
Archana Muniganti [Tue, 3 Nov 2020 08:37:14 +0000 (14:07 +0530)]
common/cpt: prepopulate word7 in session

CPT inst word7 is an immutable data for a session.
This data can be populated in a session.

Signed-off-by: Archana Muniganti <marchana@marvell.com>
Acked-by: Anoob Joseph <anoobj@marvell.com>
4 years agotest/crypto: fix null dereference of crypto op
Ciara Power [Fri, 30 Oct 2020 13:11:26 +0000 (13:11 +0000)]
test/crypto: fix null dereference of crypto op

In two test cases, the op value is set by the return of the
process_crypto_request function, which may be NULL. The op->status
value was checked afterwards, which was causing a dereference issue.

To fix this, a temporary op variable is used to hold the return
from the process_crypto_request function, so the original op->status
can be checked after the possible NULL return value.
The original op value is then set to hold the temporary op value.

Coverity issue: 363452, 363465
Fixes: 4868f6591c6f ("test/crypto: add cases for raw datapath API")

Signed-off-by: Ciara Power <ciara.power@intel.com>
Acked-by: Akhil Goyal <akhil.goyal@nxp.com>
4 years agotest/crypto: fix GMAC SGL case
Fan Zhang [Thu, 29 Oct 2020 14:46:31 +0000 (14:46 +0000)]
test/crypto: fix GMAC SGL case

This patch fixes the GMAC SGL test that fails to bypass
unsupported PMDs.

Fixes: dcdd01691f39 ("test/crypto: add GMAC SGL")

Signed-off-by: Fan Zhang <roy.fan.zhang@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Tested-by: Yu Jiang <yux.jiang@intel.com>
3 years agocommon/mlx5: fix freeing on flex parser creation failure
Michael Baum [Wed, 11 Nov 2020 07:36:48 +0000 (07:36 +0000)]
common/mlx5: fix freeing on flex parser creation failure

The mlx5_devx_cmd_create_flex_parser function defines a local array
(with constant size) named in, and then allocates a pointer to
mlx5_devx_obj structure by the mlx5_malloc function.

If the allocation fails, the function releases the array in and returns
NULL. However, the array has been defined locally on the stack and the
mlx5_free function is not required to release it.

Remove the call to the mlx5_free function.

Fixes: 66914d19d135 ("common/mlx5: convert control path memory to unified malloc")
Cc: stable@dpdk.org
Signed-off-by: Michael Baum <michaelba@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
3 years agonet/mlx5/linux: fix probing adjustment depending on DevX
Michael Baum [Wed, 11 Nov 2020 07:36:47 +0000 (07:36 +0000)]
net/mlx5/linux: fix probing adjustment depending on DevX

Bonding adjustment is done only when DEVX_PORT is supported in the
rdma-core.

Some bonding condition was done even when DEVX_PORT is not supported.

Remove it.

Fixes: 2eb4d0107acc ("net/mlx5: refactor PCI probing on Linux")
Cc: stable@dpdk.org
Signed-off-by: Michael Baum <michaelba@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
3 years agonet/mlx5: fix leak on ASO age pools resize failure
Michael Baum [Wed, 11 Nov 2020 07:36:46 +0000 (07:36 +0000)]
net/mlx5: fix leak on ASO age pools resize failure

In ASO age pools resize, the PMD starts ASO data-path.

When starting ASO data-path is failed, the pools memory was not freed
what caused a memory leak.

Free it.

Fixes: f935ed4b645a ("net/mlx5: support flow hit action for aging")

Signed-off-by: Michael Baum <michaelba@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
3 years agonet/mlx5: fix leak on Rx queue creation failure
Michael Baum [Wed, 11 Nov 2020 07:36:45 +0000 (07:36 +0000)]
net/mlx5: fix leak on Rx queue creation failure

In Rx queue creation, there is a validation for the Rx configuration.

When scatter offload validation for buffer split is failed, the Rx queue
object memory was not freed what caused a memory leak.

Free it.

Fixes: a0a45e8af723 ("net/mlx5: configure Rx queue for buffer split")

Signed-off-by: Michael Baum <michaelba@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
3 years agonet/mlx5: remove unused calculation in RSS expansion
Michael Baum [Wed, 11 Nov 2020 07:36:44 +0000 (07:36 +0000)]
net/mlx5: remove unused calculation in RSS expansion

The RSS flow expansion get a memory buffer to fill the new patterns of
the expanded flows.
This memory management saves the next address to write into the buffer
in a dedicated variable.

The calculation for the next address was wrongly also done when all the
patterns were ready.

Remove it.

Fixes: 4ed05fcd441b ("ethdev: add flow API to expand RSS flows")
Cc: stable@dpdk.org
Signed-off-by: Michael Baum <michaelba@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
3 years agonet/mlx5: fix nested flow creation
Xueming Li [Mon, 9 Nov 2020 22:57:59 +0000 (22:57 +0000)]
net/mlx5: fix nested flow creation

If xmedata mode 1 enabled and create a flow with RSS and mark action,
there was an error that rdma-core failed to create RQT due to wrong
queue definition. This was due to mixed flow creation in thread specific
flow workspace.

This patch introduces nested flow workspace(context data), each flow
uses dedicate flow workspace, pop and restore workspace when nested flow
creation done, the original flow with continue with original flow
workspace. The total number of thread specific flow workspace should be
2 due to only one nested flow creation scenario so far.

Fixes: 8bb81f2649b1 ("net/mlx5: use thread specific flow workspace")
Fixes: 3ac3d8234b82 ("net/mlx5: fix index when creating flow")
Cc: stable@dpdk.org
Signed-off-by: Xueming Li <xuemingl@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
3 years agonet/mlx5: fix Unix socket path
Xueming Li [Tue, 3 Nov 2020 08:28:43 +0000 (08:28 +0000)]
net/mlx5: fix Unix socket path

mlx_steering_dump_parser.py tool failed to dump flow due to socket file
name changed.

Change socket file name back to make it consistent.

Fixes: e4b7b8d082db ("common/mlx5: fix PCI driver name")
Cc: stable@dpdk.org
Signed-off-by: Xueming Li <xuemingl@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
3 years agonet/mlx5: fix detection of counter offset support
Suanming Mou [Thu, 12 Nov 2020 08:51:43 +0000 (16:51 +0800)]
net/mlx5: fix detection of counter offset support

Currently, the counter offset support is discovered by creating the
rule with invalid offset counter and jump action in root table. If
the rule creation fails with EINVAL errno, that mean counter offset
is not supported in root table.

However, jump action may not be supported in some rdma-core version.
In this case, the discover code will not work properly.

This commits changes the jump action to generic drop action. That
makes the discover code to be more compatible.

Fixes: 994829e695c0 ("net/mlx5: remove single counter container")

Signed-off-by: Suanming Mou <suanmingm@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
3 years agonet/mlx5: fix hairpin unbind
Bing Zhao [Fri, 13 Nov 2020 07:05:33 +0000 (15:05 +0800)]
net/mlx5: fix hairpin unbind

In the implementation of mlx5_hairpin_unbind, a copy-paste error was
inside. If a single peer Rx port needed to be unbound, it would be
bound again by mistake.

All the hardware resources were released when stopping the device and
no mess of the configuration was introduced. But when trying to unbind
the ports again, the issue would appear.

The typo of the function call is fixed. If there is no hairpin queue
bound between two ports, the unbinding process should be considered
successful.

Fixes: 37cd4501e873 ("net/mlx5: support two ports hairpin mode")

Signed-off-by: Bing Zhao <bingz@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
3 years agonet/mlx5: validate MPLSoGRE with GRE key
Xiaoyu Min [Tue, 10 Nov 2020 11:59:53 +0000 (19:59 +0800)]
net/mlx5: validate MPLSoGRE with GRE key

Currently PMD only accept flow which item_mpls directly follow item_gre,
means to match the GRE header without GRE optional field key in MPLSoGRE
encapsulation.

However, for the MPLSoGRE, the GRE header could have the optional field
(i.e, key) according to the RFC. So PMD need to accept this.

Add MLX5_FLOW_LAYER_GRE_KEY into allowed prev_layer to fix

Fixes: a7a0365565a4 ("net/mlx5: match GRE key and present bits")
Cc: stable@dpdk.org
Signed-off-by: Xiaoyu Min <jackmin@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
3 years agonet/mlx5: fix check of eCPRI previous layer
Bing Zhao [Wed, 11 Nov 2020 09:28:50 +0000 (17:28 +0800)]
net/mlx5: fix check of eCPRI previous layer

Based on the specification, eCPRI can only follow ETH (VLAN) layer
or UDP layer. When creating a flow with eCPRI item, this should be
checked and invalid layout of the layers should be rejected.

Fixes: c7eca23657b7 ("net/mlx5: add flow validation of eCPRI header")
Cc: stable@dpdk.org
Signed-off-by: Bing Zhao <bingz@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
3 years agonet/mlx5: fix Rx descriptors info for MPRQ
Alexander Kozyrev [Sun, 8 Nov 2020 04:28:04 +0000 (04:28 +0000)]
net/mlx5: fix Rx descriptors info for MPRQ

The number of descriptors configured is returned to a user
via the rxq_info_get API. This number is incorrect for MPRQ.
For SPRQ this number matches the number of mbufs allocated.
For MPRQ we have fewer external MPRQ buffers that can hold
multiple packets in strides of this big buffer. Take that
into account and return the number of MPRQ buffers multiplied
by the number of strides in this case.

Fixes: 26f1bae837eb ("net/mlx5: add Rx/Tx burst mode info")
Cc: stable@dpdk.org
Signed-off-by: Alexander Kozyrev <akozyrev@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
3 years agonet/mlx5: improve vectorized MPRQ descriptors locality
Alexander Kozyrev [Sun, 8 Nov 2020 04:23:57 +0000 (04:23 +0000)]
net/mlx5: improve vectorized MPRQ descriptors locality

There is a performance penalty for the replenish scheme
used in vectorized Rx burst for both MPRQ and SPRQ.
Mbuf elements are being filled at the end of the mbufs
array and being replenished at the beginning. That leads
to an increase in cache misses and the performance drop.
The more Rx descriptors are used the worse the situation.

Change the allocation scheme for vectorized MPRQ Rx burst:
allocate new mbufs only when consumed mbufs are almost
depleted (always have one burst gap between allocated and
consumed indices). Keeping a small number of mbufs allocated
improves cache locality and improves performance a lot.

Unfortunately, this approach cannot be applied to SPRQ Rx
burst routine. In MPRQ Rx burst we simply copy packets from
external MPRQ buffers or attach these buffers to mbufs.
In SPRQ Rx burst we allow the NIC to fill mbufs for us.
Hence keeping a small number of allocated mbufs will limit
NIC ability to fill as many buffers as possible. This fact
offsets the advantage of better cache locality.

Fixes: 0f20acbf5eda ("net/mlx5: implement vectorized MPRQ burst")

Signed-off-by: Alexander Kozyrev <akozyrev@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
4 years agonet/bnxt: fix doorbell barrier location
Lance Richardson [Fri, 13 Nov 2020 16:04:45 +0000 (11:04 -0500)]
net/bnxt: fix doorbell barrier location

Simplify some doorbell functions now that rte_cio_wmb() has been
eliminated and rte_io_wmb() is equivalent for Arm.

Fix a performance degradation on x86 platforms caused by a
previous Arm performance fix by moving the compiler barrier
closer to the I/O write.

Fixes: f0f5d844d138 ("eal: remove deprecated coherent IO memory barriers")
Fixes: bfc1d45875e2 ("net/bnxt: fix performance for Arm")
Cc: stable@dpdk.org
Signed-off-by: Lance Richardson <lance.richardson@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
4 years agonet/pcap: fix registration of timestamp dynamic field
Olivier Matz [Fri, 13 Nov 2020 10:39:57 +0000 (11:39 +0100)]
net/pcap: fix registration of timestamp dynamic field

In pcap pmd, the timestamp mbuf dynamic field is mandatory. When the
pcap pmd is created in a secondary process (this is the case for pdump),
it cannot be registered because this is not allowed from a secondary
process.

To ensure that the field is properly registered, do it from probe()
instead of configure(). Indeed, probe() is first invoked on the primary
process when a device is created in a secondary, this enables
registering dynfield from secondary process.

Bugzilla ID: 571
Fixes: d23d73d088c1 ("net/pcap: switch Rx timestamp to dynamic mbuf field")

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agoapp/testpmd: fix MTU after device configure
Ferruh Yigit [Fri, 13 Nov 2020 11:44:00 +0000 (11:44 +0000)]
app/testpmd: fix MTU after device configure

In 'rte_eth_dev_configure()', if 'DEV_RX_OFFLOAD_JUMBO_FRAME' is not set
the max frame size is limited to 'RTE_ETHER_MAX_LEN' (1518).
This is mistake because for the PMDs that has frame size bigger than
"RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN" (18 bytes), the MTU becomes
less than 1500, causing a valid frame with 1500 bytes payload to be
dropped.

Since 'rte_eth_dev_set_mtu()' works as expected, it is called after
'rte_eth_dev_configure()' to fix the MTU.
It may look redundant to set MTU after 'rte_eth_dev_configure()', both
with default values, but it is not, the resulting MTU config can be
different in the device based on frame overhead of the PMD.

And instead of setting the MTU to default value, it is first get via
'rte_eth_dev_get_mtu()' and set again, this is to cover cases MTU
changed from testpmd command line.

'rte_eth_dev_set_mtu()', '-ENOTSUP' error is ignored to prevent
irrelevant warning messages for the virtual PMDs.

Fixes: af75078fece3 ("first public release")
Cc: stable@dpdk.org
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Reviewed-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Tested-by: Igor Romanov <igor.romanov@oktetlabs.ru>
4 years agonet/tap: allow all-zero checksum for UDP over IPv4
Michael Pfeiffer [Fri, 13 Nov 2020 14:03:32 +0000 (15:03 +0100)]
net/tap: allow all-zero checksum for UDP over IPv4

Unlike TCP, UDP checksums are optional and may be zero to indicate "not
set" [RFC 768] (except for IPv6, where this prohibited [RFC 8200]). Add
this special case to the checksum offload emulation in net/tap.

Signed-off-by: Michael Pfeiffer <michael.pfeiffer@tu-ilmenau.de>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agocommon/sfc_efx/base: fix macro to extract from 256-bit type
Andrew Rybchenko [Fri, 13 Nov 2020 08:42:40 +0000 (08:42 +0000)]
common/sfc_efx/base: fix macro to extract from 256-bit type

Fixes: eda1cc20c3bc ("common/sfc_efx/base: add 256-bit type")

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
4 years agovhost: fix fd leak in kick setup
Maxime Coquelin [Thu, 12 Nov 2020 17:10:29 +0000 (18:10 +0100)]
vhost: fix fd leak in kick setup

This patch fixes a file descriptor leak which happens
in the error path of vhost_user_set_vring_kick().

Fixes: 4796ad63ba1f ("examples/vhost: import userspace vhost application")
Cc: stable@dpdk.org
Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
Reviewed-by: Xueming Li <xuemingl@nvidia.com>
4 years agovhost: fix fd leak in dirty logging setup
Maxime Coquelin [Thu, 12 Nov 2020 17:10:28 +0000 (18:10 +0100)]
vhost: fix fd leak in dirty logging setup

This patch fixes a file descriptor leak which happens
in the error path of vhost_user_set_log_base().

Fixes: 4796ad63ba1f ("examples/vhost: import userspace vhost application")
Cc: stable@dpdk.org
Reported-by: Xuan Ding <xuan.ding@intel.com>
Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
Reviewed-by: Xueming Li <xuemingl@nvidia.com>
4 years agovhost: fix error path when setting memory tables
Maxime Coquelin [Thu, 12 Nov 2020 17:10:27 +0000 (18:10 +0100)]
vhost: fix error path when setting memory tables

If an error is encountered before the memory regions are
parsed, the file descriptors for these shared buffers are
leaked.

This patch fixes this by closing the message file descriptors
on error, taking care of avoiding double closing of the file
descriptors. guest_pages is also freed, even though it was not
leaked as its pointer was not overridden on subsequent function
calls.

Fixes: 8f972312b8f4 ("vhost: support vhost-user")
Cc: stable@dpdk.org
Reported-by: Xuan Ding <xuan.ding@intel.com>
Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
Reviewed-by: Xueming Li <xuemingl@nvidia.com>
4 years agoexamples/vhost: fix ioat dependency
Cheng Jiang [Thu, 12 Nov 2020 15:49:02 +0000 (15:49 +0000)]
examples/vhost: fix ioat dependency

Fix vhost-switch compiling issue when ioat dependency is missing.
Change 'RTE_x86' check into 'RTE_RAW_IOAT' check in meson build file.
Use 'RTE_RAW_IOAT' to control conditional compiling in source file.
Clean some codes.

Fixes: abec60e7115d ("examples/vhost: support vhost async data path")
Fixes: 3a04ecb21420 ("examples/vhost: add async vhost args parsing")

Reported-by: David Marchand <david.marchand@redhat.com>
Signed-off-by: Cheng Jiang <cheng1.jiang@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Tested-by: David Marchand <david.marchand@redhat.com>
4 years agoexamples/vhost: fix string split error handling
Cheng Jiang [Wed, 11 Nov 2020 09:08:06 +0000 (09:08 +0000)]
examples/vhost: fix string split error handling

Add checking return value of string split function to fix the
coverity issue.

Coverity issue: 363739
Fixes: 3a04ecb21420 ("examples/vhost: add async vhost args parsing")

Signed-off-by: Cheng Jiang <cheng1.jiang@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
4 years agoexamples/vhost: check argument length
Cheng Jiang [Fri, 6 Nov 2020 03:24:01 +0000 (03:24 +0000)]
examples/vhost: check argument length

Add args length check before copying to fix the coverity issue.

Coverity issue: 363741
Fixes: 3a04ecb21420 ("examples/vhost: add async vhost args parsing")

Signed-off-by: Cheng Jiang <cheng1.jiang@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
4 years agonet/iavf: fix RSS when VF port closed
Steve Yang [Fri, 13 Nov 2020 00:46:42 +0000 (00:46 +0000)]
net/iavf: fix RSS when VF port closed

Check the VF RSS offload flag and ignore relative operation when
iavf hash uninit to avoid reset/close error.

Fixes: 7be10c3004be ("net/iavf: add RSS configuration for VF")
Cc: stable@dpdk.org
Signed-off-by: Steve Yang <stevex.yang@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
4 years agonet/ice: support flow mark ID in AVX512
Alvin Zhang [Fri, 13 Nov 2020 02:51:18 +0000 (10:51 +0800)]
net/ice: support flow mark ID in AVX512

Support flow director mark ID parsing from flexible Rx descriptor
in avx512 path.

Signed-off-by: Alvin Zhang <alvinx.zhang@intel.com>
Tested-by: Qin Sun <qinx.sun@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
4 years agonet/ixgbe: remove redundant MAC flag check
Haiyue Wang [Thu, 12 Nov 2020 02:00:06 +0000 (10:00 +0800)]
net/ixgbe: remove redundant MAC flag check

The flag of RTE_ETHTYPE_FLAGS_MAC has been checked twice, so remove the
first error message "Not supported by ethertype filter" which is not so
specific, and keep the error message "mac compare is unsupported" which
aligns to the definition of RTE_ETHTYPE_FLAGS_MAC.

Fixes: eb3539fc8550 ("net/ixgbe: parse ethertype filter")
Cc: stable@dpdk.org
Signed-off-by: Haiyue Wang <haiyue.wang@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
4 years agonet/bnxt: fix assignment instead of comparison
Mike Baucom [Thu, 12 Nov 2020 15:29:45 +0000 (07:29 -0800)]
net/bnxt: fix assignment instead of comparison

Use comparison operator instead of incorrectly using the assignment
operator.

Coverity issue: 363566, 36357
Fixes: 42c40f8902f7 ("net/bnxt: consolidate template table processing")

Signed-off-by: Mike Baucom <michael.baucom@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
4 years agonet/txgbe: fix build by simplifying xstats return
Conor Walsh [Wed, 11 Nov 2020 15:39:33 +0000 (15:39 +0000)]
net/txgbe: fix build by simplifying xstats return

When DPDK is compiled with gcc 7.5 with the optimization level set to 1
gcc sees the 'offset' variable in txgbe_ethdev.c as possibly being
uninitialised.
The 'txgbe_get_offset_by_id()' return value, "-(int)(id + 1)", seems
confusing gcc that it assumes '0' can be returned in the failure case.
To correct this the return statement for error case in
'txgbe_get_offset_by_id()' is simplified to return '-1'.

Fixes: 91fe49c87d76 ("net/txgbe: support device xstats")

Signed-off-by: Conor Walsh <conor.walsh@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agonet/hinic/base: add message check for command channel
Guoyang Zhou [Wed, 11 Nov 2020 06:33:37 +0000 (14:33 +0800)]
net/hinic/base: add message check for command channel

In the command channel, a message may has several fragments,
and the several fragments should have same message id. To
prevent problems, this check is added.

Fixes: 1e4593db1d58 ("net/hinic/base: fix log info for PF command channel")
Cc: stable@dpdk.org
Signed-off-by: Guoyang Zhou <zhouguoyang@huawei.com>
4 years agonet/iavf: fix performance drop after port reset
Leyi Rong [Thu, 12 Nov 2020 05:51:54 +0000 (13:51 +0800)]
net/iavf: fix performance drop after port reset

Needs to reset rxq->rxrearm_start to 0 when reset_rx_queue(),
otherwise, the random value of rxrearm_start will cause performance drop
due to L3 contested accesses.

Fixes: 69dd4c3d0898 ("net/avf: enable queue and device")
Cc: stable@dpdk.org
Signed-off-by: Leyi Rong <leyi.rong@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
4 years agodoc: update firmware/driver mapping table for i40e
Shougang Wang [Wed, 11 Nov 2020 03:27:17 +0000 (03:27 +0000)]
doc: update firmware/driver mapping table for i40e

Update i40e PMD firmware/driver mapping table.

Signed-off-by: Shougang Wang <shougangx.wang@intel.com>
Acked-by: Jeff Guo <jia.guo@intel.com>
4 years agonet/ice: fix perfect match for ACL rule
Simei Su [Wed, 11 Nov 2020 11:30:05 +0000 (19:30 +0800)]
net/ice: fix perfect match for ACL rule

A rule with an imperfect match (wildcarding) will be routed through
ACL. A perfect match should be rejected by ACL.

Fixes: 40d466fa9f76 ("net/ice: support ACL filter in DCF")

Signed-off-by: Simei Su <simei.su@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
4 years agonet/af_xdp: fix pointer storage size
Ferruh Yigit [Mon, 9 Nov 2020 13:30:05 +0000 (13:30 +0000)]
net/af_xdp: fix pointer storage size

'uint64_t' is used to hold the pointer, for 32-bits build this
assumption is wrong and giving following build error:

rte_eth_af_xdp.c: In function ‘xdp_umem_configure’:
rte_eth_af_xdp.c:970:15:
    error: cast to pointer from integer of different size
           [-Werror=int-to-pointer-cast]
  970 |   base_addr = (void *)get_base_addr(mb_pool, &align);
      |               ^

Replacing the 'uint64_t' return type of the 'get_base_addr()' to the
'uintptr_t'.
Although not sure if the overall logic supports the 32-bits, using
'uintptr_t' should be safe both for 64/32 bits.

Fixes: d8a210774e1d ("net/af_xdp: support unaligned umem chunks")
Cc: stable@dpdk.org
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Tested-by: Ciara Loftus <ciara.loftus@intel.com>
4 years agoapp/testpmd: support age shared action context
Matan Azrad [Tue, 10 Nov 2020 17:06:39 +0000 (17:06 +0000)]
app/testpmd: support age shared action context

When an age action becomes aged-out the next call for
rte_flow_get_aged_flows API should return the action context supplied
by the action configuration structure.

In case the age action is created by the shared action API, the shared
action context of the Testpmd application was not set.

In addition, the application handler of the contexts returned by the
rte_flow_get_aged_flows API didn't consider the fact that the action
could be set by the shared action API and considered it as regular flow
context.

This caused a crash in Testpmd when the context is parsed.

This patch set context type in the flow and shared action context and
uses it to parse the aged-out contexts correctly.

Signed-off-by: Matan Azrad <matan@nvidia.com>
Acked-by: Dekel Peled <dekelp@nvidia.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agonet/mlx5: fix shared RSS action release
Suanming Mou [Tue, 10 Nov 2020 03:28:02 +0000 (11:28 +0800)]
net/mlx5: fix shared RSS action release

As shared RSS action will be shared by multiple flows, the action
is created as global standalone action and managed only by the
relevant shared action management functions.

Currently, hrxqs will be created by shared RSS action or general
queue action. For hrxqs created by shared RSS action, they should
also only be released with shared RSS action. It's not correct to
release the shared RSS action hrxqs as general queue actions do
in flow destroy.

This commit adds a new fate action type for shared RSS action to
handle the shared RSS action hrxq release correctly.

Fixes: e1592b6c4dea ("net/mlx5: make Rx queue thread safe")

Signed-off-by: Suanming Mou <suanmingm@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
4 years agonet/mlx5: fix missing meter packet
Xueming Li [Tue, 3 Nov 2020 11:01:39 +0000 (11:01 +0000)]
net/mlx5: fix missing meter packet

For transfer flow with meter, packet was passed without applying flow
action. The group level was multiplied by 10 for group level 65531.

This patch fixes this issue by correcting suffix table group level
calculation.

Fixes: 3e8f3e51fd93 ("net/mlx5: fix meter table definitions")
Cc: stable@dpdk.org
Signed-off-by: Xueming Li <xuemingl@nvidia.com>
Reviewed-by: Suanming Mou <suanmingm@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
4 years agonet/iavf: check RSS rule queue region size
Ting Xu [Wed, 11 Nov 2020 06:42:50 +0000 (14:42 +0800)]
net/iavf: check RSS rule queue region size

When a rule is set to do RSS to redirect flows to a group of queues, the
queue region size should not be larger than the max RSS queue region
supported by HW. This patch added the step to check the queue region
size, and report failure if the size does not meet the requirement.

Fixes: e436cd43835b ("net/iavf: negotiate large VF and request more queues")
Cc: stable@dpdk.org
Signed-off-by: Ting Xu <ting.xu@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
4 years agonet/iavf: fix releasing mbufs
Ting Xu [Wed, 11 Nov 2020 03:06:51 +0000 (11:06 +0800)]
net/iavf: fix releasing mbufs

In the function _iavf_rx_queue_release_mbufs_vec to release rx mbufs,
rxq->rxrearm_nb is given the value of rx descriptor number at last.
However, since the process to release and allocate mbufs lacks the
initialization of rxrearm_nb, if we try to release mbufs next time, it
will return without releasing directly. In this patch, rxrearm_nb is
initialized to be zero in rx queue reset.

Fixes: 319c421f3890 ("net/avf: enable SSE Rx Tx")
Cc: stable@dpdk.org
Signed-off-by: Ting Xu <ting.xu@intel.com>
Acked-by: Jingjing Wu <jingjing.wu@intel.com>
4 years agonet/i40e: fix build for log format specifier
Ferruh Yigit [Tue, 10 Nov 2020 17:54:57 +0000 (17:54 +0000)]
net/i40e: fix build for log format specifier

Build error:
i40e_common.c: In function "i40e_parse_discover_capabilities":
../drivers/net/i40e/base/../i40e_logs.h:43:50:
    error: format "%llX" expects argument of type "long long unsigned
           int", but argument 7 has type "u64" {aka "long unsigned int"
           [-Werror=format=]
   43 |  rte_log(RTE_LOG_ ## level, i40e_logtype_driver, "%s(): " fmt, \
      |                                                  ^~~~~~~~
.../i40e_osdep.h:87:3: note: in expansion of macro "PMD_DRV_LOG_RAW"
   87 |   PMD_DRV_LOG_RAW(DEBUG, "i40e %02x.%x " s,       \
      |   ^~~~~~~~~~~~~~~
.../base/i40e_common.c:4100:4: note: in expansion of macro "i40e_debug"
 4100 |    i40e_debug(hw, I40E_DEBUG_INIT,
      |    ^~~~~~~~~~

There are multiple build error because of same reason, all fixed.

Using 'PRIX64' to fix the build error.

Fixes: 889bc9f0cd3a ("i40e/base: unify the capability function")
Fixes: 9b1041574cd4 ("i40e/base: enhance polling of NVM semaphore")
Fixes: 8db9e2a1b232 ("i40e: base driver")
Fixes: 3b7271f3958a ("i40e/base: catch NVM write semaphore timeout and retry")
Cc: stable@dpdk.org
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Luca Boccassi <bluca@debian.org>
4 years agonet/ice: fix some RSS hash fields
Junfeng Guo [Tue, 10 Nov 2020 08:45:03 +0000 (16:45 +0800)]
net/ice: fix some RSS hash fields

Previous code in ice_rss_hash_set has mismatched hash fields and
headers for UDP and TCP.

Fixes: 16187528a923 ("net/ice/base: refactor RSS configure API")

Signed-off-by: Junfeng Guo <junfeng.guo@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
4 years agonet/i40e: add C++ include guard
Prateek Agarwal [Sat, 7 Nov 2020 09:00:38 +0000 (14:30 +0530)]
net/i40e: add C++ include guard

Add extern "C" in rte_pmd_i40e.h when be compiled with CPP.

Fixes: 17e906a1ea9c ("net/i40e: support link status notification")
Cc: stable@dpdk.org
Signed-off-by: Prateek Agarwal <prateekag@cse.iitb.ac.in>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
4 years agonet/iavf: check cache pointer before dereference
Wenzhuo Lu [Tue, 10 Nov 2020 06:46:01 +0000 (14:46 +0800)]
net/iavf: check cache pointer before dereference

The return value of rte_mempool_default_cache should be
checked as it can be NULL.

Fixes: 9ab9514c150e ("net/iavf: enable AVX512 for Tx")

Reported-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
4 years agonet/ice: check cache pointer before dereference
Wenzhuo Lu [Tue, 10 Nov 2020 06:45:52 +0000 (14:45 +0800)]
net/ice: check cache pointer before dereference

The return value of rte_mempool_default_cache should be
checked as it can be NULL.

Fixes: a4e480de268e ("net/ice: optimize Tx by using AVX512")

Reported-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
4 years agonet/i40e: fix flow director flex configuration
Chenxu Di [Tue, 10 Nov 2020 07:08:14 +0000 (07:08 +0000)]
net/i40e: fix flow director flex configuration

The configuration of FDIR flex mask and flex pit should not be set
during flow validate. It should be set when flow create.

Fixes: 6ced3dd72f5f ("net/i40e: support flexible payload parsing for FDIR")
Cc: stable@dpdk.org
Signed-off-by: Chenxu Di <chenxux.di@intel.com>
Tested-by: Jun W Zhou <junx.w.zhou@intel.com>
Acked-by: Jeff Guo <jia.guo@intel.com>
4 years agonet/ice: fix crash when device reset
Simei Su [Tue, 10 Nov 2020 02:01:50 +0000 (10:01 +0800)]
net/ice: fix crash when device reset

When device resets, it should not implement ACL initialization
which is only executed in DCF. This patch disable ACL init and
uninit when in DPDK PF only mode.

Fixes: 40d466fa9f76 ("net/ice: support ACL filter in DCF")

Signed-off-by: Simei Su <simei.su@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
4 years agonet/iavf: fix RXDID configure
Jeff Guo [Mon, 9 Nov 2020 06:05:17 +0000 (14:05 +0800)]
net/iavf: fix RXDID configure

When configure Rx queue by virtchnnl, the RXDID (Rx Descriptor ID)
should be configured only if the Rx queue has been set up.

Fixes: 12b435bf8f2f ("net/iavf: support flex desc metadata extraction")

Signed-off-by: Jeff Guo <jia.guo@intel.com>
Tested-by: Yingya Han <yingyax.han@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
4 years agodoc: add large iavf support to release notes
Ting Xu [Tue, 10 Nov 2020 01:56:05 +0000 (09:56 +0800)]
doc: add large iavf support to release notes

Update release note for large VF, supporting up to 256 queue pairs per
VF.

Fixes: e436cd43835b ("net/iavf: negotiate large VF and request more queues")

Signed-off-by: Ting Xu <ting.xu@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
4 years agonet/hns3: use unsigned types for bit operator
Hongbo Zheng [Mon, 9 Nov 2020 14:28:58 +0000 (22:28 +0800)]
net/hns3: use unsigned types for bit operator

According to bit operator reliability style, variables in
the right expression participating int bit operation
must be an unsigned type.

Signed-off-by: Hongbo Zheng <zhenghongbo3@huawei.com>
Signed-off-by: Lijun Ou <oulijun@huawei.com>
4 years agonet/hns3: remove some blank lines
Lijun Ou [Mon, 9 Nov 2020 14:29:02 +0000 (22:29 +0800)]
net/hns3: remove some blank lines

According to the rule of the static check tools
that arrange blank lines properly to keep the
code compact, here remove some unnecessary blank
line to fix the above rule warning.

Signed-off-by: Lijun Ou <oulijun@huawei.com>
4 years agonet/hns3: fix queue state after reset
Chengchang Tang [Mon, 9 Nov 2020 14:29:01 +0000 (22:29 +0800)]
net/hns3: fix queue state after reset

FLR operation will reset the queue enabling state and
the driver needs to restore the state after reset.
If the driver does not restore the state, it will result
in unpredictable behavior with reset when user start or
stop queue by calling the relevant function if.

This patch fix it by add a queue enabling state restore
function to the reset handler.

Fixes: fa29fe45a7b4 ("net/hns3: support queue start and stop")
Cc: stable@dpdk.org
Signed-off-by: Chengchang Tang <tangchengchang@huawei.com>
Signed-off-by: Lijun Ou <oulijun@huawei.com>
4 years agonet/hns3: check PCI config space write
Lijun Ou [Mon, 9 Nov 2020 14:29:00 +0000 (22:29 +0800)]
net/hns3: check PCI config space write

Here adds a check for the return value when calling
rte_pci_write_config.

Coverity issue: 363714
Fixes: cea37e513329 ("net/hns3: fix FLR reset")
Cc: stable@dpdk.org
Signed-off-by: Lijun Ou <oulijun@huawei.com>
4 years agonet/hns3: adjust code style for struct initialization
Hongbo Zheng [Mon, 9 Nov 2020 14:28:59 +0000 (22:28 +0800)]
net/hns3: adjust code style for struct initialization

According to the rule of the used static check tool,
each member is initialized on a separate lines when
struct and union members are initialized, here is
tempting to adjust some code lines in order to remove
the warning.

Signed-off-by: Hongbo Zheng <zhenghongbo3@huawei.com>
Signed-off-by: Lijun Ou <oulijun@huawei.com>
4 years agonet/hns3: use correct logging format specifiers
Hongbo Zheng [Mon, 9 Nov 2020 14:28:57 +0000 (22:28 +0800)]
net/hns3: use correct logging format specifiers

In current driver print log function, some print format
symbols does not match with the actual variable types.

Signed-off-by: Hongbo Zheng <zhenghongbo3@huawei.com>
Signed-off-by: Lijun Ou <oulijun@huawei.com>
4 years agonet/sfc: use more robust string comparison
Ivan Malov [Mon, 9 Nov 2020 11:46:06 +0000 (14:46 +0300)]
net/sfc: use more robust string comparison

When it comes to comparing HW switch ID strings,
use strncmp to avoid reading past the buffer.

Fixes: e86b48aa46d4 ("net/sfc: add HW switch ID helpers")

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
4 years agocommon/sfc_efx/base: improve MCDI version/boot clarity
Ivan Malov [Mon, 9 Nov 2020 11:46:05 +0000 (14:46 +0300)]
common/sfc_efx/base: improve MCDI version/boot clarity

Improve the clarity of the code.

Fixes: 833cfcd590e2 ("common/sfc_efx/base: add API for querying board info")
Fixes: 312191e86eb0 ("common/sfc_efx/base: refactor version / boot info get helper")

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
4 years agonet/txgbe: remove direct use of compiler attribute
Jiawen Wu [Mon, 9 Nov 2020 07:43:46 +0000 (15:43 +0800)]
net/txgbe: remove direct use of compiler attribute

Remove direct use of compiler attribute.

Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agovhost: fix virtqueue initialization
Maxime Coquelin [Fri, 6 Nov 2020 14:47:44 +0000 (15:47 +0100)]
vhost: fix virtqueue initialization

This patches fixes virtqueue initialization issue causing
segfault or file descriptor being closed unexpectedly.

The wrong index was passed to init_vring_queue() by
alloc_vring_queue() when a hole in the virtqueue array was
met.

Fixes: 8acd7c213353 ("vhost: fix virtqueues metadata allocation")
Cc: stable@dpdk.org
Reported-by: Yu Jiang <yux.jiang@intel.com>
Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
Tested-by: Yu Jiang <yux.jiang@intel.com>
4 years agovhost: fix async inflight packet counter
Patrick Fu [Tue, 3 Nov 2020 05:35:01 +0000 (13:35 +0800)]
vhost: fix async inflight packet counter

Async inflight packet counter should take failed packets into account.
Failed packets will be deducted in the error handling logic.

Fixes: 6b3c81db8bb7 ("vhost: simplify async copy completion")
Fixes: cd6760da1076 ("vhost: introduce async enqueue for split ring")
Cc: stable@dpdk.org
Signed-off-by: Patrick Fu <patrick.fu@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
4 years agoexamples/vhost_crypto: add new line character in usage
Ibtisam Tariq [Mon, 2 Nov 2020 11:38:25 +0000 (11:38 +0000)]
examples/vhost_crypto: add new line character in usage

Add new line character(\n) in the usage of vhost_crypto example for
better readability

Fixes: 709521f4c2cd ("examples/vhost_crypto: support multi-core")
Cc: stable@dpdk.org
Signed-off-by: Ibtisam Tariq <ibtisam.tariq@emumba.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
4 years agonet/mlx5: fix Tx queue completion on stop
Viacheslav Ovsiienko [Fri, 6 Nov 2020 16:58:03 +0000 (16:58 +0000)]
net/mlx5: fix Tx queue completion on stop

The Tx queue completion production index was not reset
on Tx queue stop and there were completions remaining
from the previous queue run. This caused the wrong
completion queue operating and overall Tx queue malfunction
on queue restart.

Fixes: 161d103b231c ("net/mlx5: add queue start and stop")
Cc: stable@dpdk.org
Signed-off-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
4 years agonet/mlx5: fix Rx queue completion index consistency
Viacheslav Ovsiienko [Fri, 6 Nov 2020 17:16:10 +0000 (17:16 +0000)]
net/mlx5: fix Rx queue completion index consistency

The Rx queue completion consumer index got temporary
wrong value pointing to the midst of the compressed CQE
session. If application crashed at the moment the next
queue restart caused handling wrong CQEs pointed by index
and losing consuming index synchronization, that made
reliable queue restart impossible.

Fixes: 88c0733535d6 ("net/mlx5: extend Rx completion with error handling")
Cc: stable@dpdk.org
Signed-off-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
4 years agonet/mlx5: fix hash list entry assert
Suanming Mou [Fri, 6 Nov 2020 03:02:21 +0000 (11:02 +0800)]
net/mlx5: fix hash list entry assert

The entry variable assert in the mlx5_hlist_register() function is not
correct. Remove the invalid entry variable.

Fixes: e69a59227db0 ("net/mlx5: support concurrent access for hash list")

Signed-off-by: Suanming Mou <suanmingm@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
4 years agonet/mlx5: fix use of local array for global error
Dekel Peled [Wed, 4 Nov 2020 14:25:19 +0000 (16:25 +0200)]
net/mlx5: fix use of local array for global error

Recent patch uses a local string array as input for function
rte_flow_error_set().
This stack memory may be later used by other code sections,
overwriting the desired error string.

This patch implements an error string for the specific case
requested, of ICMP item not supported in Verbs flow engine.

Fixes: d51475d1bfa5 ("net/mlx5: support item type error message in flow Verbs")

Signed-off-by: Dekel Peled <dekelp@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
4 years agonet/mlx5: fix group value of sample suffix flow
Jiawei Wang [Wed, 4 Nov 2020 13:29:49 +0000 (15:29 +0200)]
net/mlx5: fix group value of sample suffix flow

mlx5 PMD split the sampling flow into prefix flow and suffix
flow. On the sample action translation function, the scaled
group value of suffix flow be attached into sample object and
saved into sample resource.

mlx5 PMD fetched the group value from the sample resource to
create the suffix flow. On the mlx5_flow_group_to_table
function the group value of suffix flow was scaled with table
factor again and translated into HW table. That caused the
incorrect group value of sample suffix flow.

The fix introduces a 'skip_scale' flag and sets it to 1 for the
sample suffix flow creation. On the mlx5_flow_group_to_table
function skips the scale with table factor to use the correct
group value.

Fixes: 4ec6360de37d ("net/mlx5: implement tunnel offload")

Signed-off-by: Jiawei Wang <jiaweiw@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
4 years agonet/mlx5: fix switch port id when representor in bonding
Dong Zhou [Wed, 4 Nov 2020 06:04:55 +0000 (08:04 +0200)]
net/mlx5: fix switch port id when representor in bonding

In the bonding configurations the port switch id for representors was
composed of pf index in bonding as the 1 MSB and the representor's index
as the remaining 15 LSBs. The special corner case for the host PF
representor on BF setups with representor id 0xFFFF was missed as well.

The new switch port id consists of 4 MSBs for the pf bonding index and
the remaining 12 LSBs for the representor index. The switch port id
ranges for each type of representors are as follows:

Uplink representor(AKA master): 0xFFFF
Host PF representor: 0x<pf_bond>FFF
VF representor: 0x<pf_bond>[0-FFE]

Fixes: bee57a0a3565 ("net/mlx5: update switch port id in bonding configuration")
Cc: stable@dpdk.org
Signed-off-by: Dong Zhou <dongzhou@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
4 years agonet/mlx5: fix aging queue doorbell ringing
Dekel Peled [Tue, 3 Nov 2020 10:38:04 +0000 (12:38 +0200)]
net/mlx5: fix aging queue doorbell ringing

Recent patch introduced a new SQ for ASO flow hit management.
This SQ uses two WQEBB's for each WQE.
The SQ producer index is 16 bits wide.

The enqueue loop posts new WQEs to the ASO SQ, using WQE index for
the SQ management.
This 16 bits index multiplied by 2 was wrongly used also for SQ
doorbell ringing.
The multiplication caused the SW index overlapping to be out of sync
with the hardware index, causing it to get stuck.

This patch separates the WQE index management from the doorbell index
management.
So, for each WQE index incrementation by 1, the doorbell index is
incremented by 2.

Fixes: f935ed4b645a ("net/mlx5: support flow hit action for aging")

Signed-off-by: Dekel Peled <dekelp@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
4 years agonet/mlx5: fix eCPRI common header endianness
Bing Zhao [Tue, 3 Nov 2020 05:41:58 +0000 (13:41 +0800)]
net/mlx5: fix eCPRI common header endianness

The input header of a RTE flow item is with network byte order. In
the host with little endian, the bit field order are the same as the
byte order.
When checking the eCPRI message type, the wrong field will be selected.
Fixing to use correct field.

Fixes: daa38a8924a0 ("net/mlx5: add flow translation of eCPRI header")
Cc: stable@dpdk.org
Signed-off-by: Bing Zhao <bingz@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
4 years agoraw/ifpga/base: check adapter pointer before dereference
Wei Huang [Thu, 5 Nov 2020 02:05:40 +0000 (21:05 -0500)]
raw/ifpga/base: check adapter pointer before dereference

In opae_adapter_destroy(), pointer "adapter" is not validated before
passing it to opae_adapter_shm_free() and opae_adapter_mutex_close()
which dereference it.

Coverity issue: 363752
Fixes: e41856b515ce ("raw/ifpga/base: enhance driver reliability in multi-process")

Signed-off-by: Wei Huang <wei.huang@intel.com>
Acked-by: Rosen Xu <rosen.xu@intel.com>
4 years agoraw/ifpga/base: unlock mutex on Nios init failure
Wei Huang [Thu, 5 Nov 2020 02:05:39 +0000 (21:05 -0500)]
raw/ifpga/base: unlock mutex on Nios init failure

In fme_nios_spi_init(), a mutex is locked for protecting nios
initialization process, the mutex is only unlocked when process
is successful, it should also be unlocked when process fail.

Coverity issue: 363751
Fixes: e41856b515ce ("raw/ifpga/base: enhance driver reliability in multi-process")

Signed-off-by: Wei Huang <wei.huang@intel.com>
Acked-by: Rosen Xu <rosen.xu@intel.com>
4 years agocommon/sfc_efx/base: avoid reading past buffer
Ivan Malov [Thu, 5 Nov 2020 20:46:12 +0000 (23:46 +0300)]
common/sfc_efx/base: avoid reading past buffer

Existing field ID validity check does not validate the field
descriptor availability. Make it more rigorous to avoid
reading past the buffer containing field descriptors.

Coverity issue: 363742
Fixes: 370ed675a952 ("common/sfc_efx/base: support setting PPORT in match spec")

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
4 years agonet/ring: fix typo in log message
Olivier Matz [Wed, 4 Nov 2020 17:01:25 +0000 (18:01 +0100)]
net/ring: fix typo in log message

Add a missing space.

Fixes: 869bf6d222bb ("net/ring: fix coding style")
Cc: stable@dpdk.org
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agonet/txgbe: replace forbidden functions
Jiawen Wu [Fri, 6 Nov 2020 02:10:53 +0000 (10:10 +0800)]
net/txgbe: replace forbidden functions

Remove rte_panic(), and use rte_atomic_thread_fence()
instead of rte_smp_[r/w]mb.

Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agonet/mlx5: fix Tx queue stop state
Matan Azrad [Tue, 3 Nov 2020 06:48:32 +0000 (06:48 +0000)]
net/mlx5: fix Tx queue stop state

The Tx queue stop API doesn't call the PMD callback when the state of
the queue is stopped.
The drivers should update the state to be stopped when the queue stop
callback is done successfully or when the port is stopped.
The drivers should update the state to be started when the queue start
callback is done successfully or when the port is started.

The driver wrongly didn't update the state as started when the port
start callback was done which kept the state as stopped.
Following call to a queue stop API was not completed by ethdev layer
because the state is already stopped.

Move the state update from the Tx queue setup to the port start
callback.

Fixes: 161d103b231c ("net/mlx5: add queue start and stop")
Cc: stable@dpdk.org
Signed-off-by: Matan Azrad <matan@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
4 years agonet/mlx5: fix Tx queue reference count check
Matan Azrad [Tue, 3 Nov 2020 06:47:44 +0000 (06:47 +0000)]
net/mlx5: fix Tx queue reference count check

The Txq refcnt 1 value means that there is no real reference to the
queue and only the control configurations are saved in the struct.

The patch below wrongly didn't consider it and caused a leak in the Txq
object resource.

Revert the specific update in the refcnt.

Fixes: b5c8b3e70cdf ("net/mlx5: use C11 atomics for RxQ/TxQ refcounts")

Signed-off-by: Matan Azrad <matan@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
4 years agocommon/mlx5: free MR resource on device DMA unmap
Jiawei Wang [Mon, 2 Nov 2020 02:22:28 +0000 (04:22 +0200)]
common/mlx5: free MR resource on device DMA unmap

mlx5 PMD created the MR (Memory Region) resource on the
mlx5_dma_map call to make the memory available for DMA
operations. On the mlx5_dma_unmap call the MR resource
was not freed but inserted to MR Free list for further
garbage collection.
Actual MR resource destroying happened on device stop
call. That caused the runtime out of memory in case of
application performed multiple DMA map/unmap calls.

The fix immediately frees the MR resource on mlx5_dma_unmap
call not engaging the list. The export for mlx5_mr_free
function from common PMD part is added as well.

Fixes: 989e999d9305 ("net/mlx5: support PCI device DMA map and unmap")
Cc: stable@dpdk.org
Signed-off-by: Jiawei Wang <jiaweiw@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>