dpdk.git
2 years agoapp/testpmd: fix external buffer allocation
Dmitry Kozlyuk [Fri, 17 Dec 2021 09:58:16 +0000 (11:58 +0200)]
app/testpmd: fix external buffer allocation

External pinned buffer memory (--mp-alloc=xbuf)
was allocated as multiple IOVA-contiguous memzones
of 2M size and 2M alignment.
Due to the malloc overhead and the alignment requirement,
each 2M memzone consumed 4M of hugepage memory:
2M of usable memory + X of malloc overhead + (2M-X) padding.
The allocation often failed with 2M hugepages and IOVA-as-PA
if a PA-contiguous span of 2 hugepages could not be found.
Also, with any hugepage size and IOVA mode
memory consumption was almost 2x of the usable amount.

Alignment requirement of 2M for external buffers is redundant.
It was an attempt to ensure IOVA-contiguity
by forcing memzones to start at hugepage boundaries,
while 2M size intended to leave no unused space on the page.
As shown above, this in fact caused excessive memory consumption
and decreased the chance of a successful allocation.
RTE_MEMZONE_F_IOVA_CONTIG already ensures IOVA-contiguity.

Remove the alignment requirement.
Reduce the memzone size by the malloc overhead size (4 cache lines),
so that memory consumption for each memzone is
(2M-X) of usable memory + X of malloc overhead = 2M.
This also means that whenever there are free 2M hugepages,
an IOVA-contiguous memzone can always be allocated.

Fixes: 72512e1897b2 ("app/testpmd: add mempool with external data buffers")
Cc: stable@dpdk.org
Signed-off-by: Dmitry Kozlyuk <dkozlyuk@nvidia.com>
Signed-off-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
2 years agoapp/testpmd: fix dereference before null check
Sean Morrissey [Tue, 18 Jan 2022 10:53:09 +0000 (10:53 +0000)]
app/testpmd: fix dereference before null check

Assign 'left' variable only after null check on 'size'
as function returns if 'size' is null.

Coverity issue: 374381
Fixes: 169a9fed1f4c ("app/testpmd: fix hex string parser support for flow API")
Cc: stable@dpdk.org
Signed-off-by: Sean Morrissey <sean.morrissey@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
2 years agonet/bonding: fix mode type mismatch
Yunjian Wang [Fri, 10 Dec 2021 11:41:01 +0000 (19:41 +0800)]
net/bonding: fix mode type mismatch

There were some type-mismatch issues in bonding and fix them:
- Use %u to fix argument type mismatch in RTE_BOND_LOG.
- The internals->mode is of type uint8_t. But the function
  parameter 'mode' is of type int. So change the mode type
  from int to uint8_t.

Fixes: 2efb58cbab6e ("bond: new link bonding library")
Fixes: a45b288ef21a ("bond: support link status polling")
Fixes: 68451eb6698c ("net/bonding: call through EAL on create/free")
Cc: stable@dpdk.org
Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
Acked-by: Min Hu (Connor) <humin29@huawei.com>
2 years agonet/af_xdp: fix build with -Wunused-function
Ciara Loftus [Thu, 9 Dec 2021 17:19:47 +0000 (17:19 +0000)]
net/af_xdp: fix build with -Wunused-function

The get_shared_umem function is only called when the kernel
flag XDP_UMEM_UNALIGNED_CHUNK_FLAG is defined. Move the
function implementation and associated helper so that it only
gets compiled when that flag is set.

Fixes: 74b46340e2d4 ("net/af_xdp: support shared UMEM")
Cc: stable@dpdk.org
Signed-off-by: Ciara Loftus <ciara.loftus@intel.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
2 years agonet/tap: remove maintainer
Keith Wiles [Thu, 2 Dec 2021 17:15:37 +0000 (17:15 +0000)]
net/tap: remove maintainer

I no longer have the bandwidth to support the TAP PMD, so I am
removing myself as the maintainer so as to not hold up commits.

Signed-off-by: Keith Wiles <keith.wiles@intel.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
2 years agonet/axgbe: use PCI root complex device to distinguish device
Chandubabu Namburu [Thu, 2 Dec 2021 16:10:34 +0000 (16:10 +0000)]
net/axgbe: use PCI root complex device to distinguish device

"bus/pci: optimize bus scan" broke axgbe on V1000/R1000.
RV root complex pci device does not have any kernel driver assigned
so it is removed from pci scan list which is used in
"net/axgbe: add a HW quirk for register definitions".

Get root complex device id directly from pci sysfs instead of
pci scan list.

Fixes: 991e0b1dbc4a ("net/axgbe: add a HW quirk for register definitions")
Cc: stable@dpdk.org
Signed-off-by: Chandubabu Namburu <chandu@amd.com>
Acked-by: Selwin Sebastian <selwin.sebastian@amd.com>
2 years agoapp/testpmd: fix Tx scheduling interval
Viacheslav Ovsiienko [Tue, 23 Nov 2021 16:32:58 +0000 (18:32 +0200)]
app/testpmd: fix Tx scheduling interval

The first "set txtimes" command parameter specifies the time
interval between scheduled send bursts for single queue. This
interval should be the same for all the forwarding ports.
It requires to maintain the timing related variables on per
queue basis instead of per core, as currently implemented.
This resulted in wrong burst intervals if two or more cores
were generating the scheduled traffic for two or more ports
in txonly mode.

This patch moves the timing variable to the fstream structure.
Only txonly forwarding mode with enabled send scheduling is
affected.

Fixes: 4940344dab1d ("app/testpmd: add Tx scheduling command")
Cc: stable@dpdk.org
Signed-off-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
2 years agonet/bonding: fix offloading configuration
Chengchang Tang [Tue, 9 Nov 2021 07:57:26 +0000 (15:57 +0800)]
net/bonding: fix offloading configuration

Currently, part offloadings of the bonding device will not take effect
by using dev_configure(). Because the related configuration will not be
delivered to the slave devices in this way.

The offloading capability of the bonding device is the intersection of
the capability of all slave devices. Based on this, the following
functions are added to the bonding driver:
1. If a Tx offloading is within the capability of the bonding device
   (i.e, all the slave devices support this Tx offloading), the enabling
   status of the offloading of all slave devices depends on the
   configuration of the bonding device.

2. For the Tx offloading that is not within the Tx offloading capability
   of the bonding device, the enabling status of the offloading on the
   slave devices is irrelevant to the bonding device configuration. And
   it depends on the original configuration of the slave devices.

Fixes: e8b3e1a9b1bb ("net/bonding: switch to new offloading API")
Cc: stable@dpdk.org
Signed-off-by: Chengchang Tang <tangchengchang@huawei.com>
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
2 years agoethdev: mark old macros as deprecated
Ferruh Yigit [Wed, 12 Jan 2022 14:36:23 +0000 (14:36 +0000)]
ethdev: mark old macros as deprecated

Old macros kept for backward compatibility, but this cause old macro
usage to sneak in silently.

Marking old macros as deprecated. Downside is this will cause some noise
for applications that are using old macros.

Fixes: 295968d17407 ("ethdev: add namespace")

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
2 years agonet/cnxk: fix promiscuous mode in multicast enable flow
Asaf Ravid [Wed, 1 Dec 2021 10:29:53 +0000 (15:59 +0530)]
net/cnxk: fix promiscuous mode in multicast enable flow

When multicast promiscuous was being enabled it caused the unicast
promiscuous to be disabled. This fix resolves this by setting
NIX_RX_MODE_PROMISC when eth_dev->data->promiscuous is set, regardless.

Fixes: 325d79c00a5a ("net/cnxk: support all multicast")
Cc: stable@dpdk.org
Signed-off-by: Asaf Ravid <aravid@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
2 years agonet/bnxt: check VF representor pointer before access
Ajit Khaparde [Tue, 4 Jan 2022 08:38:24 +0000 (14:08 +0530)]
net/bnxt: check VF representor pointer before access

The PF or trusted VF Rx handler could invoke the VF representor's
Rx function without knowledge of the application cleaning up the
representor ports. Check if the vfr_bp pointer is valid before
accessing it.

Fixes: 6dc83230b43b ("net/bnxt: support port representor data path")
Cc: stable@dpdk.org
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
2 years agonet/bnxt: fix xstats query
Kalesh AP [Tue, 4 Jan 2022 08:38:23 +0000 (14:08 +0530)]
net/bnxt: fix xstats query

Fix incorrect memset in bnxt_dev_xstats_get_op.
In bnxt_dev_xstats_get_op(), the PMD is not zeroing the whole
buffer supplied by the application. This can end up passing
junk statistics values to the application when the FW does not
support extended stats on a function.
Fixed to call memset() with correct size.

Fixes: f55e12f33416 ("net/bnxt: support extended port counters")
Cc: stable@dpdk.org
Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
2 years agonet/bnxt: fix crash by validating pointer
Ajit Khaparde [Tue, 4 Jan 2022 08:38:22 +0000 (14:08 +0530)]
net/bnxt: fix crash by validating pointer

Validate the pointers in rxq before accessing them.
Otherwise it can cause a segfault.

Fixes: 657c2a7f1dd4 ("net/bnxt: create aggregation rings when needed")
Cc: stable@dpdk.org
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
2 years agonet/bnxt: fix PAM4 mask setting
Ajit Khaparde [Tue, 4 Jan 2022 08:38:21 +0000 (14:08 +0530)]
net/bnxt: fix PAM4 mask setting

Set the PAM4 mask setting only when PAM4 signaling is enabled.
Setting it otherwise seems to result in link negotiation.
Also auto_pam4_link_speeds has been renamed to
auto_pam4_link_speed_mask to reflect its real usage.

Fixes: c23f9ded0391 ("net/bnxt: support 200G PAM4 link")
Cc: stable@dpdk.org
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
2 years agonet/bnxt: fix ring teardown
Ajit Khaparde [Tue, 4 Jan 2022 08:38:20 +0000 (14:08 +0530)]
net/bnxt: fix ring teardown

Check for valid bit while scanning for hwrm_done completion
during ring teardown. Not checking the valid bit could cause a
ring overflow when we ring the doorbell.

Fixes: 4fb6ab3f866d ("net/bnxt: check flush status during ring free")
Cc: stable@dpdk.org
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
2 years agonet/bnxt: fix handling of VF configuration change
Kalesh AP [Tue, 4 Jan 2022 08:38:19 +0000 (14:08 +0530)]
net/bnxt: fix handling of VF configuration change

When there is a change in the default VLAN of the VF,
FW sends the VF_CFG_CHANGE async event to the driver.
Upon receiving this async event, driver currently only queries
the FW using HWRM_FUNC_QCFG. But this is not enough.

Driver has to clean up the existing filter and recreate filters
so the FW can apply the default VLAN to the filter.

Fixes: 12213821a8a3 ("net/bnxt: register for more async events")
Cc: stable@dpdk.org
Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
2 years agonet/bnxt: refactor datapath stop for reuse
Somnath Kotur [Tue, 4 Jan 2022 08:38:18 +0000 (14:08 +0530)]
net/bnxt: refactor datapath stop for reuse

Refactor bnxt_stop_rxtx() for reuse.
By accepting rte_eth_dev as input, bnxt_stop_rxtx() can be used
in multiple scenarios such as representor devices.

Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
2 years agonet/bnxt: get maximum supported multicast filters count
Kalesh AP [Tue, 4 Jan 2022 08:38:17 +0000 (14:08 +0530)]
net/bnxt: get maximum supported multicast filters count

The HWRM_FUNC_QCAPS response indicates the maximum number
of multicast filters that can be supported by this function
on the RX side.

Fixed to use this value instead of the hard coded value 16.

Fixes: d69851df12b2 ("net/bnxt: support multicast filter and set MAC addr")
Cc: stable@dpdk.org
Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
2 years agonet/bnxt: fix flow create when RSS is disabled
Kalesh AP [Tue, 4 Jan 2022 08:38:16 +0000 (14:08 +0530)]
net/bnxt: fix flow create when RSS is disabled

This patch reverts the commit "5d47d06b2c83".
Revert this commit as it caused a regression on legacy chips.
On newer chips we use TruFlow based flow creation instead of
HWRM based flow creation.

Fixes: 5d47d06b2c83 ("net/bnxt: modify VNIC accounting")
Cc: stable@dpdk.org
Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
2 years agonet/bnxt: add null check for mark table
Kalesh AP [Tue, 4 Jan 2022 08:38:15 +0000 (14:08 +0530)]
net/bnxt: add null check for mark table

During the port start, driver ignores mark table allocation failure.
This could cause a segfault due to NULL pointer dereference in
bnxt_set_mark_in_mbuf(). Fix this by checking the pointer validity
before accessing it.

Fixes: b87abb2e55cb ("net/bnxt: support marking packet")
Cc: stable@dpdk.org
Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
2 years agonet/bnxt: improve recovery related log messages
Kalesh AP [Tue, 4 Jan 2022 08:38:14 +0000 (14:08 +0530)]
net/bnxt: improve recovery related log messages

Make these messages more specific.

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
2 years agonet/bnxt: set fast-path pointers only if recovery succeeds
Kalesh AP [Tue, 4 Jan 2022 08:38:13 +0000 (14:08 +0530)]
net/bnxt: set fast-path pointers only if recovery succeeds

During reset recovery, fixed to set the fast-path pointers
only if recovery succeeds.

Fixes: 720b55ad278e ("net/bnxt: fix crash caused by error recovery")
Cc: stable@dpdk.org
Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
2 years agonet/bnxt: cap maximum number of unicast MAC addresses
Kalesh AP [Tue, 4 Jan 2022 08:38:12 +0000 (14:08 +0530)]
net/bnxt: cap maximum number of unicast MAC addresses

The Maximum number of receive mac addr is hard coded to 128
in the ethdev library(RTE_ETH_NUM_RECEIVE_MAC_ADDR).
But the bnxt devices support more than 128 unicast MAC filters
which could result in a segfault while user tries to add more
than 128 unicast MAC addresses to the port.

Fixes: a2033fda22ab ("net/bnxt: fix number of MAC addresses for VMDq")
Cc: stable@dpdk.org
Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
2 years agonet/bnxt: fix restoring VLAN filtering after recovery
Kalesh AP [Tue, 4 Jan 2022 08:38:11 +0000 (14:08 +0530)]
net/bnxt: fix restoring VLAN filtering after recovery

During port start, driver calls bnxt_vlan_offload_set_op()
to program VLAN Filter/VLAN Strip setting to the HW. This
in turns add the vlan filters.

This results in a failure when bnxt_restore_filters() invokes
bnxt_restore_vlan_filters() during the recovery as the vlans are
already programmed.

Fix to ignore the error(-EEXIST).

Fixes: 151c8240ac6a ("net/bnxt: restore VLAN filters during reset recovery")
Cc: stable@dpdk.org
Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
2 years agonet/bnxt: restore RSS configuration after reset recovery
Kalesh AP [Tue, 4 Jan 2022 08:38:10 +0000 (14:08 +0530)]
net/bnxt: restore RSS configuration after reset recovery

During reset recovery, driver is not restoring the VNIC rss hash key.
It's generating a new random hash key which results in unexpected
RSS behavior after recovery. Fixed this by storing the VNIC RSS
configuration to a local struct and then applying the cached value
during the recovery.

Fixes: df6cd7c1f73a ("net/bnxt: handle reset notify async event from FW")
Cc: stable@dpdk.org
Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
2 years agonet/bnxt: fix queue stop operation
Kalesh AP [Tue, 4 Jan 2022 08:38:09 +0000 (14:08 +0530)]
net/bnxt: fix queue stop operation

When there are no active Rx queues(i.e when all queues have been
stopped), clear the RSS redirection table of the VNIC on Thor.

Fixes: 9b63c6fd70e3 ("net/bnxt: support Rx/Tx queue start/stop")
Cc: stable@dpdk.org
Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Lance Richardson <lance.richardson@broadcom.com>
2 years agonet/bnxt: fix multicast MAC restore during reset recovery
Kalesh AP [Tue, 4 Jan 2022 08:38:08 +0000 (14:08 +0530)]
net/bnxt: fix multicast MAC restore during reset recovery

During reset recovery, driver is not restoring the multicast
mac addresses. Added code to restore them during reset recovery.

Fixes: b02f1573cd07 ("net/bnxt: restore MAC filters during reset recovery")
Cc: stable@dpdk.org
Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
2 years agonet/bnxt: fix multicast address set
Kalesh AP [Tue, 4 Jan 2022 08:38:07 +0000 (14:08 +0530)]
net/bnxt: fix multicast address set

Fix bnxt_dev_set_mc_addr_list_op.
Fix to cache the multicast mac addresses added to the port
to the driver private structure memory. Use this cached mc list
to program the FW.

This fixes an issue where multicast packets reception is
successful only if the multicast mac address of the packets
is the first one in the multicast address list of the port.

This is in preparation for another fix in the series.

Fixes: d69851df12b2 ("net/bnxt: support multicast filter and set MAC addr")
Cc: stable@dpdk.org
Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
2 years agonet/bnxt: fix xstats names query overrun
Lance Richardson [Tue, 30 Nov 2021 14:42:26 +0000 (09:42 -0500)]
net/bnxt: fix xstats names query overrun

When the xstats_names parameter to rte_eth_xstats_get_names()
is non-NULL and the size parameter is less than the required
number of entries, the driver must return the required size
without modifying (and over-running) the caller's xstats_names
array.

Update bnxt_dev_xstats_get_names_op() in accordance with this
requirement.

Fixes: bfb9c2260be2 ("net/bnxt: support xstats get/reset")
Cc: stable@dpdk.org
Signed-off-by: Lance Richardson <lance.richardson@broadcom.com>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
2 years agonet/mlx5: relax headroom assertion
Dmitry Kozlyuk [Tue, 28 Dec 2021 09:20:43 +0000 (11:20 +0200)]
net/mlx5: relax headroom assertion

A debug assertion in Single-Packet Receive Queue (SPRQ) mode
required all Rx mbufs to have a 128 byte headroom,
based on the assumption that rte_pktmbuf_init() sets it.
However, rte_pktmbuf_init() may set a smaller headroom
if the dataroom is insufficient, e.g. this is a natural case
for split buffer segments. The headroom can also be larger.
Only check the headroom size when vectored Rx routines
are used because they rely on it. Relax the assertion
to require sufficient headroom size, not an exact one.

Fixes: a0a45e8af723 ("net/mlx5: configure Rx queue for buffer split")
Cc: stable@dpdk.org
Signed-off-by: Dmitry Kozlyuk <dkozlyuk@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
2 years agonet/mlx5: fix GCC uninitialized variable warning
Dmitry Kozlyuk [Tue, 28 Dec 2021 09:17:03 +0000 (11:17 +0200)]
net/mlx5: fix GCC uninitialized variable warning

When building with -Db_sanitize=thread, GCC gives a warning:

drivers/net/mlx5/mlx5_flow_meter.c: In function ‘mlx5_flow_meter_create’:
drivers/net/mlx5/mlx5_flow_meter.c:1170:33: warning: ‘legacy_fm’ may be
    used uninitialized in this function [-Wmaybe-uninitialized]

This is a false-positive: legacy_fm is initialized and used
if and only if priv->sh->meter_aso_en is false.
Work around this by initializing legacy_fm to NULL.
Add an assertion before legacy_fm use in case the logic changes.

Fixes: 444320186393 ("net/mlx5: support meter creation with policy")
Cc: stable@dpdk.org
Reported-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: Dmitry Kozlyuk <dkozlyuk@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
2 years agonet/mlx5: support imissed counter on Windows
Tal Shnaiderman [Fri, 24 Dec 2021 06:46:46 +0000 (08:46 +0200)]
net/mlx5: support imissed counter on Windows

Add support for the imissed counter using the DevX API on Windows.

imissed is queried by creating a queue counter for the port, attaching
it to all created RQs and querying the "out_of_buffer" field.

If the counter cannot be created, imissed will always report 0.

Signed-off-by: Tal Shnaiderman <talshn@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
2 years agonet/mlx5: fix GRE protocol type translation for Verbs
Gregory Etelson [Thu, 23 Dec 2021 13:16:38 +0000 (15:16 +0200)]
net/mlx5: fix GRE protocol type translation for Verbs

When application creates several flows to match on GRE tunnel without
explicitly specifying GRE protocol type value in flow rules, PMD will
translate that to zero mask.
RDMA-CORE cannot distinguish between different inner flow types and
produces identical matchers for each zero mask.

The patch extracts inner header type from flow rule and forces it in
GRE protocol type, if application did not specify any.

Fixes: 84c406e74524 ("net/mlx5: add flow translate function")
Cc: stable@dpdk.org
Signed-off-by: Gregory Etelson <getelson@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
2 years agonet/mlx5: fix RSS expansion with explicit next protocol
Gregory Etelson [Thu, 23 Dec 2021 13:08:17 +0000 (15:08 +0200)]
net/mlx5: fix RSS expansion with explicit next protocol

The PMD RSS expansion scheme by default compiles flow rules for all
flow item types that may branch out from a stub supplied
by application.
For example,
ETH can lead to VLAN, IPv4 or IPv6.
IPv4 can lead to UDP, TCP, IPv4 or IPv6.

If application explicitly specified next protocol type, expansion must
use that option only and not create flows with other protocol types.

The PMD ignored explicit next protocol values in GRE and VXLAN-GPE.

The patch updates RSS expansion for GRE and VXLAN-GPE with explicit
next protocol settings.

Fixes: c7870bfe09dc ("ethdev: move RSS expansion code to mlx5 driver")
Cc: stable@dpdk.org
Signed-off-by: Gregory Etelson <getelson@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
2 years agonet/mlx5: fix assertion on flags set in packet mbuf
Lior Margalit [Thu, 23 Dec 2021 08:15:41 +0000 (10:15 +0200)]
net/mlx5: fix assertion on flags set in packet mbuf

Fixed the assertion on the flags set in pkt->ol_flags for vectorized
MPRQ.  With vectorized MPRQ the CQs are processed before copying the
MPRQ bufs so the valid assertion is that the expected flag is set and
not that the pkt->ol_flags equlas this flag alone.

Fixes: 0f20acbf5eda ("net/mlx5: implement vectorized MPRQ burst")
Cc: stable@dpdk.org
Signed-off-by: Lior Margalit <lmargalit@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
2 years agocommon/mlx5: fix missing validation in devargs parsing
Michael Baum [Thu, 16 Dec 2021 18:40:40 +0000 (20:40 +0200)]
common/mlx5: fix missing validation in devargs parsing

The rte_kvargs_parse function parses the arguments
"key=value,key=value,..." string and return an allocated structure that
contains a key/value list.
It enables also to send a key without value and updates the values in
the following ways:
 - "key=value,key,..." - value is updated as NULL.
 - "key=value,key=,..." - value is updated as "" (empty string).

Mlx5 PMDs use this function to parse, but they don't support key without
value. They send the value as an argument to strtol function.
When strtol gets NULL as a parameter it cause a crash, when it gets ""
(empty string) it returns 0.

Adds a check that will prevent an argument in these formats, and returns
an error for it.

Fixes: 85209924039c ("common/mlx5: share memory related devargs")
Cc: stable@dpdk.org
Signed-off-by: Michael Baum <michaelba@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
2 years agonet/mlx5: fix memory socket selection in ASO management
Michael Baum [Wed, 8 Dec 2021 14:51:34 +0000 (16:51 +0200)]
net/mlx5: fix memory socket selection in ASO management

In ASO objects creation (WQE, CQE and MR), socket number is given as
a parameter.

The selection was wrongly socket 0 hardcoded even if the user didn't
configure memory for this socket.

This patch replaces the selection to default socket (SOCKET_ID_ANY).

Fixes: f935ed4b645a ("net/mlx5: support flow hit action for aging")
Cc: stable@dpdk.org
Signed-off-by: Michael Baum <michaelba@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
2 years agocommon/mlx5: fix error handling in multi-class probe
Michael Baum [Wed, 24 Nov 2021 22:02:38 +0000 (00:02 +0200)]
common/mlx5: fix error handling in multi-class probe

The common drivers_probe function calls in a loop to all probe functions
for classes requested by the user. After it manages to probe them all,
it updates this on the device in the "classes_loaded" field.

If one of them fails, all those probed to it are remove using the
drivers_remove function. However, this function only releases the
classes in the "classes_loaded" field on the given device and misses the
newly probed classes.

This patch removes the condition from the release function, and ensures
that the caller function sends a more accurate parameter.

Fixes: 8a41f4deccc3 ("common/mlx5: introduce layer for multiple class drivers")
Cc: stable@dpdk.org
Signed-off-by: Michael Baum <michaelba@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
2 years agonet/ixgbe: add vector Rx parameter check
Bin Zheng [Fri, 10 Dec 2021 08:22:09 +0000 (16:22 +0800)]
net/ixgbe: add vector Rx parameter check

Under the circumstance that `rx_tail` wrap back to zero
and the advance speed of `rx_tail` is greater than `rxrearm_start`,
`rx_tail` will catch up with `rxrearm_start` and surpass it.
This may cause some mbufs be reused by application.

So we need to make some restrictions to ensure that
 `rx_tail` will not exceed `rxrearm_start`.

e.g.

RDH: 972 RDT: 991 rxrearm_nb: 991 rxrearm_start: 992 rx_tail: 959
RDH: 1004 RDT: 1023 rxrearm_nb: 991 rxrearm_start: 0 rx_tail: 991
RDH: 12 RDT: 31 rxrearm_nb: 991 rxrearm_start: 32 rx_tail: 1023
RDH: 31 RDT: 63 rxrearm_nb: 960 rxrearm_start: 64 rx_tail: 0
RDH: 95 RDT: 95 rxrearm_nb: 1016 rxrearm_start: 96 rx_tail: 88
RDH: 95 RDT: 127 rxrearm_nb: 991 rxrearm_start: 128 rx_tail: 95
...
RDH: 908 RDT: 927 rxrearm_nb: 991 rxrearm_start: 928 rx_tail: 895
RDH: 940 RDT: 959 rxrearm_nb: 991 rxrearm_start: 960 rx_tail: 927
RDH: 980 RDT: 991 rxrearm_nb: 991 rxrearm_start: 992 rx_tail: 959
RDH: 991 RDT: 991 rxrearm_nb: 1026 rxrearm_start: 992 rx_tail: 994

when `rx_tail` catches up with `rxrearm_start`,
2(994 - 992) mbufs be reused by application !

Bugzilla ID: 882
Fixes: 5a3cca342417 ("net/ixgbe: fix vector Rx")
Cc: stable@dpdk.org
Signed-off-by: Bin Zheng <zhengbin.89740@bytedance.com>
Acked-by: Leyi Rong <leyi.rong@intel.com>
Reviewed-by: Haiyue Wang <haiyue.wang@intel.com>
Reviewed-by: Liang Ma <liangma@liangbit.com>
2 years agonet/iavf: fix segmentation offload condition
Radu Nicolau [Mon, 22 Nov 2021 15:30:00 +0000 (15:30 +0000)]
net/iavf: fix segmentation offload condition

Apply segmentation offload when requested for non tunneled
packets e.g. IPsec transport mode.

Fixes: 1e728b01120c ("net/iavf: rework Tx path")
Cc: stable@dpdk.org
Signed-off-by: Radu Nicolau <radu.nicolau@intel.com>
Reviewed-by: Qi Zhang <qi.z.zhang@intel.com>
2 years agonet/ice: fix Tx checksum offload
Kevin Liu [Sun, 12 Dec 2021 14:35:20 +0000 (14:35 +0000)]
net/ice: fix Tx checksum offload

The tunnel packets is missing some information after Tx forwarding.

In ice_txd_enable_offload, when set tunnel packet Tx checksum
offload enable, td_offset should be set with outer l2/l3 len instead
of inner l2/l3 len.

In ice_txd_enable_checksum, td_offset should also be set with outer
l3 len.

This patch fix the bug that the checksum engine can forward Ipv4/Ipv6
tunnel packets.

Fixes: 28f9002ab67f ("net/ice: add Tx AVX512 offload path")
Fixes: 17c7d0f9d6a4 ("net/ice: support basic Rx/Tx")
Cc: stable@dpdk.org
Signed-off-by: Kevin Liu <kevinx.liu@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
2 years agonet/ice: track DCF state of PF
Dapeng Yu [Wed, 24 Nov 2021 08:12:20 +0000 (16:12 +0800)]
net/ice: track DCF state of PF

When VF is reset, PF will change DCF state from ON to other state, if
flow creation, destroy, or redirect command is sent to DCF at this
time, it will fail.

This patch tracks DCF state and returns try-again error to caller when
DCF state is not ON.

Cc: stable@dpdk.org
Signed-off-by: Dapeng Yu <dapengx.yu@intel.com>
Acked-by: Haiyue Wang <haiyue.wang@intel.com>
2 years agonet/iavf: remove git residue symbol
Haiyue Wang [Thu, 16 Dec 2021 04:43:42 +0000 (12:43 +0800)]
net/iavf: remove git residue symbol

This extra symbol '+' should be added when patch was reapplied, and the
compiler treats it as unsigned type, so the code still runs well.

Fixes: 84108425054a ("net/iavf: support asynchronous virtual channel message")
Cc: stable@dpdk.org
Signed-off-by: Haiyue Wang <haiyue.wang@intel.com>
Acked-by: Beilei Xing <beilei.xing@intel.com>
Acked-by: Radu Nicolau <radu.nicolau@intel.com>
2 years agonet/ice: fix Tx checksum offload capability
Qi Zhang [Wed, 24 Nov 2021 01:09:28 +0000 (09:09 +0800)]
net/ice: fix Tx checksum offload capability

Add missing capability for outer UDP Tx checksum.
Also fixed the feature list in ice_dcf.ini

Fixes: bf89db4409bb ("net/ice: complete device info get in DCF")
Cc: stable@dpdk.org
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Qiming Yang <qiming.yang@intel.com>
2 years agonet/ice: fix pattern check for flow director parser
Junfeng Guo [Wed, 22 Dec 2021 08:11:38 +0000 (16:11 +0800)]
net/ice: fix pattern check for flow director parser

FDIR rules with masks are not supported in current code. Thus add
pattern check for IPv4/UDP/TCP/SCTP addr/port to terminate the FDIR
programming stage.

Fixes: 1b71ed2cdd5d ("net/ice: refactor flow pattern parser")
Cc: stable@dpdk.org
Signed-off-by: Junfeng Guo <junfeng.guo@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
2 years agonet/cnxk: add devargs for configuring SDP channel mask
Satheesh Paul [Tue, 9 Nov 2021 09:42:04 +0000 (15:12 +0530)]
net/cnxk: add devargs for configuring SDP channel mask

This patch adds support to configure channel mask which will
be used by rte flow when adding flow rules on SDP interfaces.

Signed-off-by: Satheesh Paul <psatheesh@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
2 years agocommon/cnxk: support setting channel mask for SDP interfaces
Satheesh Paul [Tue, 9 Nov 2021 09:42:03 +0000 (15:12 +0530)]
common/cnxk: support setting channel mask for SDP interfaces

ROC changes to support setting channel mask for SDP interfaces.

Signed-off-by: Satheesh Paul <psatheesh@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
2 years agonet/qede: fix redundant condition in debug code
Anatoly Burakov [Tue, 30 Nov 2021 16:59:13 +0000 (16:59 +0000)]
net/qede: fix redundant condition in debug code

Expression "a && 1" is equivalent to just "a", so fix the accidental
inclusion of a literal in code.

Fixes: ec55c118792b ("net/qede: add infrastructure for debug data collection")
Cc: stable@dpdk.org
Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Acked-by: Devendra Singh Rawat <dsinghrawat@marvell.com>
Reviewed-by: Igor Russkikh <irusskikh@marvell.com>
Acked-by: Rasesh Mody <rmody@marvell.com>
2 years agocommon/cnxk: wait for XAQ pool to fill
Ashwin Sekhar T K [Tue, 30 Nov 2021 06:07:02 +0000 (11:37 +0530)]
common/cnxk: wait for XAQ pool to fill

Wait for XAQ pool to get filled with the freed pointers
before proceeding.

Signed-off-by: Ashwin Sekhar T K <asekhar@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
2 years agocommon/cnxk: wait for SQB pool to fill
Ashwin Sekhar T K [Tue, 30 Nov 2021 06:07:01 +0000 (11:37 +0530)]
common/cnxk: wait for SQB pool to fill

Wait for SQB pool to get filled with the freed pointers
before proceeding.

Signed-off-by: Ashwin Sekhar T K <asekhar@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
2 years agocommon/cnxk: support waiting for pool filling
Ashwin Sekhar T K [Tue, 30 Nov 2021 06:07:00 +0000 (11:37 +0530)]
common/cnxk: support waiting for pool filling

Add roc_npa_aura_op_available_wait() API which can be used to wait
until an NPA pool gets filled up to a certain count of pointers.

Signed-off-by: Ashwin Sekhar T K <asekhar@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
2 years agocommon/cnxk: update CPU directive in NPA assembly code
Ashwin Sekhar T K [Tue, 30 Nov 2021 05:48:09 +0000 (11:18 +0530)]
common/cnxk: update CPU directive in NPA assembly code

Use arch_extension instead of .cpu directive in NPA assembly code
snippets. Using .cpu directive with generic causes it to override
the micro architecture selected by march,mcpu.
For example if march=armv8.5-a+crypto+sve2 provided then the .cpu
directive overrides it to generic+crypto+sve2, use arch_extension
to get the expected result.

Signed-off-by: Ashwin Sekhar T K <asekhar@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
2 years agocommon/cnxk: use CAS with release semantics for batch alloc
Ashwin Sekhar T K [Tue, 30 Nov 2021 05:45:27 +0000 (11:15 +0530)]
common/cnxk: use CAS with release semantics for batch alloc

Before issuing the batch alloc, we clear the first word of
cache lines so that NPA can update the status. Make sure that
this line clear is flushed before the batch alloc is issued.

Signed-off-by: Ashwin Sekhar T K <asekhar@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
2 years agocommon/cnxk: ensure ROC cache alignment of NPA stack size
Ashwin Sekhar T K [Tue, 30 Nov 2021 05:38:22 +0000 (11:08 +0530)]
common/cnxk: ensure ROC cache alignment of NPA stack size

When PLT_CACHE_LINE_SIZE is set to 64B, the memzone size reserved for
NPA stack could be a multiple of 64B. In such a case, when NDC SYNC
is initiated for the NPA LF, it could go and corrupt an additional
64B bytes as NDC flushes in multiples of ROC cache line size (128B).

So ensure that NPA stack size requested is a multiple of 128B.

Signed-off-by: Ashwin Sekhar T K <asekhar@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
2 years agocommon/cnxk: fix nibble parsing order when dumping MCAM
Satheesh Paul [Wed, 24 Nov 2021 07:55:27 +0000 (13:25 +0530)]
common/cnxk: fix nibble parsing order when dumping MCAM

Fix the order in which layer flags and layer type fields
are parsed when dumping the MCAM data.

Fixes: 9869c39918a0 ("common/cnxk: support flow entry dump")
Cc: stable@dpdk.org
Signed-off-by: Satheesh Paul <psatheesh@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
2 years agonet/mlx5: fix MPRQ stride devargs adjustment
Michael Baum [Tue, 23 Nov 2021 18:38:05 +0000 (20:38 +0200)]
net/mlx5: fix MPRQ stride devargs adjustment

In Multi-Packet RQ creation, the user can choose the number of strides
and their size in bytes. The user updates it using specific devargs for
both of these parameters.
The above two parameters determine the size of the WQE which is actually
their product of multiplication.

If the user selects values that are not in the supported range, the PMD
changes them to default values. However, apart from the range
limitations for each parameter individually there is also a minimum
value on their multiplication. When the user selects values that their
multiplication are lower than minimum value, no adjustment is made and
the creation of the WQE fails.

This patch adds an adjustment in these cases as well. When the user
selects values whose multiplication is lower than the minimum, they are
replaced with the default values.

Fixes: ecb160456aed ("net/mlx5: add device parameter for MPRQ stride size")
Cc: stable@dpdk.org
Signed-off-by: Michael Baum <michaelba@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
2 years agonet/mlx5: improve stride parameter names
Michael Baum [Tue, 23 Nov 2021 18:38:04 +0000 (20:38 +0200)]
net/mlx5: improve stride parameter names

In the striding RQ management there are two important parameters, the
size of the single stride in bytes and the number of strides.

Both the data-path structure and config structure keep the log of the
above parameters. However, in their names there is no mention that the
value is a log which may be misleading as if the fields represent the
values themselves.

This patch updates their names describing the values more accurately.

Fixes: ecb160456aed ("net/mlx5: add device parameter for MPRQ stride size")
Cc: stable@dpdk.org
Signed-off-by: Michael Baum <michaelba@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
2 years agocommon/mlx5: add minimum WQE size for striding RQ
Michael Baum [Tue, 23 Nov 2021 18:38:03 +0000 (20:38 +0200)]
common/mlx5: add minimum WQE size for striding RQ

Some devices have a WQE size limit for striding RQ. On some newer
devices, this limitation is smaller and information on its size is
provided by the firmware.

This patch adds the attribute query from firmware: the minimum required
size of WQE buffer for striding RQ in granularity of Bytes.

Cc: stable@dpdk.org
Signed-off-by: Michael Baum <michaelba@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
2 years agonet/mlx5: fix modify field MAC address offset
Viacheslav Ovsiienko [Fri, 26 Nov 2021 13:09:45 +0000 (15:09 +0200)]
net/mlx5: fix modify field MAC address offset

The MAC addresses fields are 48 bit wide and are processed
by mlx5 PMD as two words. There the bug was introduced for
the offset, causing malfunction of MODIFY_FIELD action
with MAC address fields as source or destination and
with non zero field offset.

Fixes: 40c8fb1fd3b3 ("net/mlx5: update modify field action")
Cc: stable@dpdk.org
Signed-off-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
2 years agomem: quiet base address hint warning if not requested
Anatoly Burakov [Mon, 9 Nov 2020 15:47:48 +0000 (15:47 +0000)]
mem: quiet base address hint warning if not requested

Any EAL memory allocation often goes through eal_get_virtual_area()
function, which will print a warning whenever the resulting allocation
didn't match the specified address requirements. This is useful for
when we have requested a specific base virtual address, to let the user
know that the mapping has deviated from that address.

However, on Linux, we also have a default base address that's there to
ensure better chances of successful secondary process initialization,
as well as higher likelihood of the virtual areas to fit inside the
IOMMU address width. Because of this default base address, there are
warnings printed even when no base address was explicitly requested,
which can be confusing to the user.

Emit this warning with debug level unless base address was explicitly
requested by the user.

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
2 years agodma/cnxk: fix installing internal headers
Srikanth Yalavarthi [Wed, 26 Jan 2022 05:49:34 +0000 (21:49 -0800)]
dma/cnxk: fix installing internal headers

DMA module internal header files are currently being installed to the
prefix directory. This patch updates DMA meson config file to exclude
internal headers during install stage.

Fixes: 53f6d7328bf4 ("dma/cnxk: create and initialize device on PCI probing")
Cc: stable@dpdk.org
Signed-off-by: Srikanth Yalavarthi <syalavarthi@marvell.com>
Acked-by: Radha Mohan Chintakuntla <radhac@marvell.com>
2 years agodevtools: fix comment detection in forbidden token check
David Marchand [Thu, 27 Jan 2022 10:55:11 +0000 (11:55 +0100)]
devtools: fix comment detection in forbidden token check

After a comment section was detected, passing to a new hunk was not seen
as ending the section and all subsequent hunks were ignored.

Fixes: 7413e7f2aeb3 ("devtools: alert on new calls to exit from libs")
Cc: stable@dpdk.org
Reported-by: Thomas Monjalon <thomas@monjalon.net>
Signed-off-by: David Marchand <david.marchand@redhat.com>
2 years agotest/crypto: add copy/set DF cases in IPsec
Anoob Joseph [Mon, 6 Dec 2021 11:08:00 +0000 (16:38 +0530)]
test/crypto: add copy/set DF cases in IPsec

Add test cases to verify copy DF and set DF options
with lookaside IPsec offload.

Signed-off-by: Anoob Joseph <anoobj@marvell.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
2 years agotest/crypto: add AES-XCBC known vectors
Anoob Joseph [Mon, 6 Dec 2021 11:07:59 +0000 (16:37 +0530)]
test/crypto: add AES-XCBC known vectors

Add known vector test cases for NULL cipher + AES-XCBC.
Also add both algos to the combined mode list of algos.

Signed-off-by: Anoob Joseph <anoobj@marvell.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
2 years agotest/crypto: skip null auth in ICV corrupt case
Tejasree Kondoj [Mon, 6 Dec 2021 11:07:58 +0000 (16:37 +0530)]
test/crypto: skip null auth in ICV corrupt case

Skipping NULL authentication in ICV corruption test case
for lookaside IPsec testsuite.

Signed-off-by: Tejasree Kondoj <ktejasree@marvell.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
2 years agotest/crypto: add fragmented packet case
Tejasree Kondoj [Mon, 6 Dec 2021 11:07:57 +0000 (16:37 +0530)]
test/crypto: add fragmented packet case

Add fragmented plain packet test case in combined mode.
The test case leverages combined mode framework to generate
IPsec packet from a fragment and verify that headers are formed
correctly. The IPsec packet would be decapsulated and the plain
packet is compared against the original packet.

Signed-off-by: Tejasree Kondoj <ktejasree@marvell.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
2 years agotest/crypto: add IPsec AES-CTR cases
Tejasree Kondoj [Mon, 6 Dec 2021 11:07:56 +0000 (16:37 +0530)]
test/crypto: add IPsec AES-CTR cases

Add IPsec AES-CTR test case for combined mode
in lookaside IPsec testsuite.

Signed-off-by: Tejasree Kondoj <ktejasree@marvell.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
2 years agotest/crypto: add IPsec security stats cases
Ankur Dwivedi [Mon, 6 Dec 2021 11:07:55 +0000 (16:37 +0530)]
test/crypto: add IPsec security stats cases

Add security stats test cases in IPSEC protocol testsuite.

Signed-off-by: Ankur Dwivedi <adwivedi@marvell.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
2 years agotest/crypto: add IPsec transport mode cases
Anoob Joseph [Mon, 6 Dec 2021 11:07:54 +0000 (16:37 +0530)]
test/crypto: add IPsec transport mode cases

Added IPsec transport mode test cases for IPv4 packets
in the test app.

Signed-off-by: Anoob Joseph <anoobj@marvell.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
2 years agotest/crypto: add IPsec fragmented packet known vectors
Tejasree Kondoj [Mon, 6 Dec 2021 11:07:53 +0000 (16:37 +0530)]
test/crypto: add IPsec fragmented packet known vectors

Added fragmented plain packet known vector test case in
IPsec outbound. The test case sends a fragmented packet
and ensures that the IPsec packet generated has correct
fragmentation fields (ie, the IPsec packet is not fragmented)
by comparing against the known vector.

Signed-off-by: Tejasree Kondoj <ktejasree@marvell.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
2 years agotest/crypto: add IPsec HMAC-SHA384/512 known vectors
Tejasree Kondoj [Mon, 6 Dec 2021 11:07:52 +0000 (16:37 +0530)]
test/crypto: add IPsec HMAC-SHA384/512 known vectors

Test app is updated with lookaside IPsec HMAC-SHA384/512
known vectors test cases.

Signed-off-by: Tejasree Kondoj <ktejasree@marvell.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
2 years agotest/crypto: add IPv6 tunnel mode cases
Tejasree Kondoj [Mon, 6 Dec 2021 11:07:51 +0000 (16:37 +0530)]
test/crypto: add IPv6 tunnel mode cases

Added IPv6 known vector and combined mode tests.
Following modes are added:
Tunnel IPv6 in IPv6
Tunnel IPv4 in IPv4
Tunnel IPv4 in IPv6
Tunnel IPv6 in IPv4

Signed-off-by: Tejasree Kondoj <ktejasree@marvell.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
2 years agotest/crypto: add chained operations in combined cases
Anoob Joseph [Mon, 6 Dec 2021 11:07:50 +0000 (16:37 +0530)]
test/crypto: add chained operations in combined cases

Extend lookaside IPsec combined mode cases to cover chained
operations also.

Currently covering combinations of Ciphers(AES-128-CBC)
and Auth(NULL, SHA2-256 [16B ICV]).

Signed-off-by: Anoob Joseph <anoobj@marvell.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
2 years agotest/crypto: add IPsec AES-CBC-HMAC-SHA256 known vectors
Tejasree Kondoj [Mon, 6 Dec 2021 11:07:49 +0000 (16:37 +0530)]
test/crypto: add IPsec AES-CBC-HMAC-SHA256 known vectors

Test app for lookaside IPsec is added with
AES-CBC-HMAC-SHA256 test cases.

Signed-off-by: Tejasree Kondoj <ktejasree@marvell.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
2 years agotest/crypto: add IPsec AES-CBC known vectors
Anoob Joseph [Mon, 6 Dec 2021 11:07:48 +0000 (16:37 +0530)]
test/crypto: add IPsec AES-CBC known vectors

Extend IPsec lookaside test framework to support chained
operations and add AES-CBC 128 known vector tests.

Signed-off-by: Anoob Joseph <anoobj@marvell.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
2 years agoexamples/ipsec-secgw: fix default flow rule creation
Nithin Dabilpuram [Fri, 17 Dec 2021 12:44:51 +0000 (18:14 +0530)]
examples/ipsec-secgw: fix default flow rule creation

Fix default flow rule to create after ethdev start to align
with rte_flow spec.

Fixes: 513f192b5fd4 ("examples/ipsec-secgw: add default flow for inline Rx")
Cc: stable@dpdk.org
Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
2 years agoexamples/ipsec-secgw: fix eventdev start sequence
Nithin Dabilpuram [Thu, 2 Dec 2021 12:30:36 +0000 (18:00 +0530)]
examples/ipsec-secgw: fix eventdev start sequence

Start eventdev after complete initialization of event dev,
rx adapter and tx adapter.

Fixes: e0b0e55c8f15 ("examples/ipsec-secgw: add framework for event helper")
Cc: stable@dpdk.org
Signed-off-by: Nithin Dabilpuram <ndabilpuram@marvell.com>
Acked-by: Anoob Joseph <anoobj@marvell.com>
2 years agocrypto/ipsec_mb: fix tainted data for session
Ciara Power [Fri, 10 Dec 2021 14:09:52 +0000 (14:09 +0000)]
crypto/ipsec_mb: fix tainted data for session

Downcasting a void * to struct aesni_gcm_session * caused the session
data to be treated as tainted.
Removing the void * temporary variable and adding a cast avoids this
issue.

Coverity issue: 374377
Fixes: 746825e5c0ea ("crypto/ipsec_mb: move aesni_gcm PMD")
Cc: stable@dpdk.org
Signed-off-by: Ciara Power <ciara.power@intel.com>
Acked-by: Fan Zhang <roy.fan.zhang@intel.com>
2 years agocrypto/ipsec_mb: fix queue cleanup null pointer dereference
Ciara Power [Fri, 10 Dec 2021 14:09:51 +0000 (14:09 +0000)]
crypto/ipsec_mb: fix queue cleanup null pointer dereference

The qp was being used in the cleanup without checking if it was non NULL.
A check is now added to verify qp is non NULL before use.

Coverity issue: 374375
Fixes: c75542ae4200 ("crypto/ipsec_mb: introduce IPsec_mb framework")
Cc: stable@dpdk.org
Signed-off-by: Ciara Power <ciara.power@intel.com>
Acked-by: Fan Zhang <roy.fan.zhang@intel.com>
2 years agocrypto/ipsec_mb: fix queue setup null pointer dereference
Ciara Power [Fri, 10 Dec 2021 14:09:50 +0000 (14:09 +0000)]
crypto/ipsec_mb: fix queue setup null pointer dereference

When setting up a qp in a secondary process, the local qp pointer is set
to the stored device qp, configured by the primary process for that
device, but only if that device qp is not NULL.
If the device qp was not set up correctly by the primary process and has
a NULL value, the local qp variable stays at the default initialised
value, NULL. This causes a NULL pointer dereference later in the
function when using the qp value.

This is fixed by always setting the local qp to the value of the device
qp stored, and then checking if qp is NULL, returning an error if it is.

Coverity issue: 374382
Fixes: 72a169278a56 ("crypto/ipsec_mb: support multi-process")
Cc: stable@dpdk.org
Signed-off-by: Ciara Power <ciara.power@intel.com>
Acked-by: Fan Zhang <roy.fan.zhang@intel.com>
2 years agocrypto/cnxk: update microcode completion handling
Anoob Joseph [Fri, 17 Dec 2021 09:20:11 +0000 (14:50 +0530)]
crypto/cnxk: update microcode completion handling

Update microcode completion code handling to update the required mbuf &
crypto op flags. IP checksum good case is now reported by specific
microcode completion code.

Signed-off-by: Anoob Joseph <anoobj@marvell.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
2 years agocrypto/cnxk: enable copy DSCP
Anoob Joseph [Fri, 17 Dec 2021 09:20:10 +0000 (14:50 +0530)]
crypto/cnxk: enable copy DSCP

Copy DSCP is supported. Enable it in capabilities.

Signed-off-by: Anoob Joseph <anoobj@marvell.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
2 years agocrypto/cnxk: add per packet IV in lookaside IPsec debug
Archana Muniganti [Fri, 17 Dec 2021 09:20:09 +0000 (14:50 +0530)]
crypto/cnxk: add per packet IV in lookaside IPsec debug

For cn9k, use HW GEN IV as default and add per pkt IV
in lookaside IPsec debug mode. Debug mode helps to verify
lookaside PMD using known outbound vectors in lookaside
autotest.

Signed-off-by: Archana Muniganti <marchana@marvell.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
2 years agocrypto/cnxk: support AES-CMAC
Anoob Joseph [Fri, 17 Dec 2021 09:20:08 +0000 (14:50 +0530)]
crypto/cnxk: support AES-CMAC

Add support for AES CMAC auth algorithm.

Signed-off-by: Anoob Joseph <anoobj@marvell.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
2 years agocrypto/cnxk: add copy and set DF
Anoob Joseph [Fri, 17 Dec 2021 09:20:07 +0000 (14:50 +0530)]
crypto/cnxk: add copy and set DF

Add support for copy and set DF bit.

Signed-off-by: Anoob Joseph <anoobj@marvell.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
2 years agocrypto/cnxk: support AES-XCBC and null cipher
Anoob Joseph [Fri, 17 Dec 2021 09:20:06 +0000 (14:50 +0530)]
crypto/cnxk: support AES-XCBC and null cipher

Add support for AES XCBC and NULL cipher.

Signed-off-by: Anoob Joseph <anoobj@marvell.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
2 years agocrypto/cnxk: fix extend tail calculation
Anoob Joseph [Fri, 17 Dec 2021 09:20:05 +0000 (14:50 +0530)]
crypto/cnxk: fix extend tail calculation

If the packet size to be incremented after IPsec processing is less
than size of hdr (size incremented before submitting), then extend_tail
can become negative. Allow negative values for the variable.

Fixes: 67a87e89561c ("crypto/cnxk: add cn9k lookaside IPsec datapath")
Cc: stable@dpdk.org
Signed-off-by: Anoob Joseph <anoobj@marvell.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
2 years agocrypto/cnxk: support lookaside IPsec AES-CTR
Tejasree Kondoj [Fri, 17 Dec 2021 09:20:04 +0000 (14:50 +0530)]
crypto/cnxk: support lookaside IPsec AES-CTR

Adding AES-CTR support to cnxk CPT in
lookaside IPsec mode.

Signed-off-by: Tejasree Kondoj <ktejasree@marvell.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
2 years agocrypto/cnxk: add more info on command timeout
Anoob Joseph [Fri, 17 Dec 2021 09:20:03 +0000 (14:50 +0530)]
crypto/cnxk: add more info on command timeout

Print more info when command timeout happens. Print software and
hardware queue information.

Signed-off-by: Anoob Joseph <anoobj@marvell.com>
Signed-off-by: Tejasree Kondoj <ktejasree@marvell.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
2 years agocrypto/cnxk: use atomics to access CPT res
Anoob Joseph [Fri, 17 Dec 2021 09:20:02 +0000 (14:50 +0530)]
crypto/cnxk: use atomics to access CPT res

The memory would be updated by hardware. Use atomics to read the same.

Signed-off-by: Anoob Joseph <anoobj@marvell.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
2 years agocrypto/cnxk: fix inflight count calculation
Anoob Joseph [Fri, 17 Dec 2021 09:20:01 +0000 (14:50 +0530)]
crypto/cnxk: fix inflight count calculation

Inflight count calculation is updated to cover wrap around cases where
head can become smaller than tail.

Fixes: fd390896f4a3 ("crypto/cnxk: allow different cores in pending queue")
Cc: stable@dpdk.org
Reported-by: Kiran Kumar K <kirankumark@marvell.com>
Signed-off-by: Anoob Joseph <anoobj@marvell.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
2 years agocrypto/cnxk: handle null chained ops
Anoob Joseph [Fri, 17 Dec 2021 09:20:00 +0000 (14:50 +0530)]
crypto/cnxk: handle null chained ops

Verification doesn't cover cases when NULL auth/cipher is provided as a
chain. Removed the separate function for verification and added a
replacement function which calls the appropriate downstream functions.

Signed-off-by: Anoob Joseph <anoobj@marvell.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
2 years agocrypto/cnxk: add context reload for IV
Tejasree Kondoj [Fri, 17 Dec 2021 09:19:59 +0000 (14:49 +0530)]
crypto/cnxk: add context reload for IV

Adding context reload in datapath for IV in debug mode.

Signed-off-by: Tejasree Kondoj <ktejasree@marvell.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
2 years agocrypto/cnxk: skip unsupported cases
Anoob Joseph [Fri, 17 Dec 2021 09:19:58 +0000 (14:49 +0530)]
crypto/cnxk: skip unsupported cases

Add skip for transport mode tests that are not supported. Also,
updated the transport mode path to configure IP version as v4.

Signed-off-by: Anoob Joseph <anoobj@marvell.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
2 years agocrypto/cnxk: add security session stats get
Ankur Dwivedi [Fri, 17 Dec 2021 09:19:57 +0000 (14:49 +0530)]
crypto/cnxk: add security session stats get

Adds the security session stats get op for cn10k.

Signed-off-by: Ankur Dwivedi <adwivedi@marvell.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
2 years agocrypto/cnxk: use struct sizes for CTX writes
Anoob Joseph [Fri, 17 Dec 2021 09:19:56 +0000 (14:49 +0530)]
crypto/cnxk: use struct sizes for CTX writes

CTX writes only require the lengths are 8B aligned. Use the struct size
directly.

Signed-off-by: Anoob Joseph <anoobj@marvell.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
2 years agocrypto/cnxk: account for CPT CTX updates and flush delays
Anoob Joseph [Fri, 17 Dec 2021 09:19:55 +0000 (14:49 +0530)]
crypto/cnxk: account for CPT CTX updates and flush delays

CPT CTX write with microcode would require CPT flush to complete to have
DRAM updated with the SA. Since datapath requires SA direction field,
introduce a new flag for the same.

Session destroy path is also updated to clear sa.valid bit using CTX
reload operation.

Session is updated with marker to differentiate s/w immutable and s/w
mutable portions.

Signed-off-by: Anoob Joseph <anoobj@marvell.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
2 years agocrypto/cnxk: support lookaside IPsec HMAC-SHA384/512
Tejasree Kondoj [Fri, 17 Dec 2021 09:19:54 +0000 (14:49 +0530)]
crypto/cnxk: support lookaside IPsec HMAC-SHA384/512

Adding HMAC-SHA384/512 support to cnxk lookaside IPsec.

Signed-off-by: Tejasree Kondoj <ktejasree@marvell.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
2 years agocrypto/cnxk: write CPT CTX through microcode op
Tejasree Kondoj [Fri, 17 Dec 2021 09:19:53 +0000 (14:49 +0530)]
crypto/cnxk: write CPT CTX through microcode op

Adding support to write CPT CTX through microcode op(SET_CTX) for
cn10k lookaside PMD.

Signed-off-by: Tejasree Kondoj <ktejasree@marvell.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>
2 years agocrypto/cnxk: update maximum sec crypto capabilities
Anoob Joseph [Fri, 17 Dec 2021 09:19:52 +0000 (14:49 +0530)]
crypto/cnxk: update maximum sec crypto capabilities

Update the macro to include newly added ciphers.
Updated the functions populating caps to throw error
when max is exceeded.

Signed-off-by: Anoob Joseph <anoobj@marvell.com>
Acked-by: Akhil Goyal <gakhil@marvell.com>