dpdk.git
2 years agoethdev: hide internal structures
Konstantin Ananyev [Wed, 13 Oct 2021 13:37:04 +0000 (14:37 +0100)]
ethdev: hide internal structures

Move rte_eth_dev, rte_eth_dev_data, rte_eth_rxtx_callback and related
data into private header (ethdev_driver.h).
Few minor changes to keep DPDK building after that.

Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
Tested-by: Feifei Wang <feifei.wang2@arm.com>
2 years agoethdev: add API to retrieve multiple MAC addresses
Konstantin Ananyev [Wed, 13 Oct 2021 13:37:03 +0000 (14:37 +0100)]
ethdev: add API to retrieve multiple MAC addresses

Introduce rte_eth_macaddrs_get() to allow user to retrieve all ethernet
addresses assigned to given port.
Change testpmd to use this new function and avoid referencing directly
rte_eth_devices[].

Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
Tested-by: Feifei Wang <feifei.wang2@arm.com>
2 years agoethdev: make fast-path functions to use new flat array
Konstantin Ananyev [Wed, 13 Oct 2021 13:37:02 +0000 (14:37 +0100)]
ethdev: make fast-path functions to use new flat array

Rework fast-path ethdev functions to use rte_eth_fp_ops[].
While it is an API/ABI breakage, this change is intended to be
transparent for both users (no changes in user app is required) and
PMD developers (no changes in PMD is required).
One extra thing to note - RX/TX callback invocation will cause extra
function call with these changes. That might cause some insignificant
slowdown for code-path where RX/TX callbacks are heavily involved.

Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
Tested-by: Feifei Wang <feifei.wang2@arm.com>
2 years agoethdev: copy fast-path API into separate structure
Konstantin Ananyev [Wed, 13 Oct 2021 13:37:01 +0000 (14:37 +0100)]
ethdev: copy fast-path API into separate structure

Copy public function pointers (rx_pkt_burst(), etc.) and related
pointers to internal data from rte_eth_dev structure into a
separate flat array. That array will remain in a public header.
The intention here is to make rte_eth_dev and related structures internal.
That should allow future possible changes to core eth_dev structures
to be transparent to the user and help to avoid ABI/API breakages.
The plan is to keep minimal part of data from rte_eth_dev public,
so we still can use inline functions for fast-path calls
(like rte_eth_rx_burst(), etc.) to avoid/minimize slowdown.
The whole idea beyond this new schema:
1. PMDs keep to setup fast-path function pointers and related data
   inside rte_eth_dev struct in the same way they did it before.
2. Inside rte_eth_dev_start() and inside rte_eth_dev_probing_finish()
   (for secondary process) we call eth_dev_fp_ops_setup, which
   copies these function and data pointers into rte_eth_fp_ops[port_id].
3. Inside rte_eth_dev_stop() and inside rte_eth_dev_release_port()
   we call eth_dev_fp_ops_reset(), which resets rte_eth_fp_ops[port_id]
   into some dummy values.
4. fast-path ethdev API (rte_eth_rx_burst(), etc.) will use that new
   flat array to call PMD specific functions.
That approach should allow us to make rte_eth_devices[] private
without introducing regression and help to avoid changes in drivers code.

Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
Tested-by: Feifei Wang <feifei.wang2@arm.com>
2 years agoethdev: change input parameters for Rx queue count
Konstantin Ananyev [Wed, 13 Oct 2021 13:37:00 +0000 (14:37 +0100)]
ethdev: change input parameters for Rx queue count

Currently majority of fast-path ethdev ops take pointers to internal
queue data structures as an input parameter.
While eth_rx_queue_count() takes a pointer to rte_eth_dev and queue
index.
For future work to hide rte_eth_devices[] and friends it would be
plausible to unify parameters list of all fast-path ethdev ops.
This patch changes eth_rx_queue_count() to accept pointer to internal
queue data as input parameter.
While this change is transparent to user, it still counts as an ABI change,
as eth_rx_queue_count_t is used by ethdev public inline function
rte_eth_rx_queue_count().

Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Acked-by: Hyong Youb Kim <hyonkim@cisco.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
Tested-by: Feifei Wang <feifei.wang2@arm.com>
2 years agoethdev: allocate max space for internal queue array
Konstantin Ananyev [Wed, 13 Oct 2021 13:36:59 +0000 (14:36 +0100)]
ethdev: allocate max space for internal queue array

At queue configure stage always allocate space for maximum possible
number (RTE_MAX_QUEUES_PER_PORT) of queue pointers.
That will allow 'fast' inline functions (eth_rx_burst, etc.) to refer
pointer to internal queue data without extra checking of current number
of configured queues.
That would help in future to hide rte_eth_dev and related structures.
It means that from now on, each ethdev port will always consume:
((2*sizeof(uintptr_t))* RTE_MAX_QUEUES_PER_PORT)
bytes of memory for its queue pointers.
With RTE_MAX_QUEUES_PER_PORT==1024 (default value) it is 16KB per port.

Signed-off-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
Tested-by: Feifei Wang <feifei.wang2@arm.com>
2 years agonet/sfc: refine pattern of group flows in tunnel offload
Ivan Malov [Wed, 13 Oct 2021 13:15:13 +0000 (16:15 +0300)]
net/sfc: refine pattern of group flows in tunnel offload

By design, in a GROUP flow, outer match criteria go to "ENC" fields
of the action rule match specification. The current HW/FW hasn't
got support for these fields (except the VXLAN VNI) yet.

As a workaround, start parsing the pattern from the tunnel item.

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
2 years agonet/sfc: support counters in tunnel offload jump rules
Ivan Malov [Wed, 13 Oct 2021 13:15:12 +0000 (16:15 +0300)]
net/sfc: support counters in tunnel offload jump rules

Such a counter will only report the number of hits, which is actually
a sum of two contributions (the JUMP rule's own counter + indirect
increments issued by counters of the associated GROUP rules.

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
2 years agonet/sfc: use action rules in tunnel offload jump rules
Ivan Malov [Wed, 13 Oct 2021 13:15:11 +0000 (16:15 +0300)]
net/sfc: use action rules in tunnel offload jump rules

By design, JUMP flows should be represented solely by the outer rules. But
the HW/FW hasn't got support for setting Rx mark from RECIRC_ID on outer
rule lookup yet. Neither does it support outer rule counters. As a
workaround, an action rule of lower priority is used to do the job.

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
2 years agonet/sfc: override match fields in tunnel offload jump rules
Ivan Malov [Wed, 13 Oct 2021 13:15:10 +0000 (16:15 +0300)]
net/sfc: override match fields in tunnel offload jump rules

The current HW/FW doesn't allow to match on MAC addresses in outer rules.
One day this will change for sure, but right now a workaround is needed.

Match on VLAN presence in outer rules is also unsupported. Ignore it.

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
2 years agonet/sfc: implement control path operations in tunnel offload
Ivan Malov [Wed, 13 Oct 2021 13:15:09 +0000 (16:15 +0300)]
net/sfc: implement control path operations in tunnel offload

Support generic callbacks which callers will invoke to get
PMD-specific actions and items used to produce JUMP and
GROUP flows and to detect tunnel information.

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
2 years agonet/sfc: support group flows in tunnel offload
Ivan Malov [Wed, 13 Oct 2021 13:15:08 +0000 (16:15 +0300)]
net/sfc: support group flows in tunnel offload

GROUP is an in-house term for so-called "tunnel_match" flows.
On parsing, they are detected by virtue of PMD-internal item
MARK. It associates a given flow with its tunnel context.

Such a flow is represented by a MAE action rule which is
chained with the corresponding JUMP rule's outer rule
by virtue of matching on its recirculation ID.

GROUP flows do narrower match than JUMP flows do and
decapsulate matching packets (full offload).

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
2 years agocommon/sfc_efx/base: match on recirc ID in action rules
Ivan Malov [Wed, 13 Oct 2021 13:15:07 +0000 (16:15 +0300)]
common/sfc_efx/base: match on recirc ID in action rules

Currently, there is an API for setting recirculation ID in
outer rules. Add an API to let action rules match on it.

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
2 years agonet/sfc: support jump flows in tunnel offload
Ivan Malov [Wed, 13 Oct 2021 13:15:06 +0000 (16:15 +0300)]
net/sfc: support jump flows in tunnel offload

JUMP is an in-house term for so-called "tunnel_set" flows. On parsing,
they are identified by virtue of actions MARK (PMD-internal) and JUMP.
The action MARK associates a given flow with its tunnel context.

Such a flow is represented by a MAE outer rule (OR) which has its
recirculation ID set. This ID is also associated with the tunnel
context. The OR is supposed to set this ID in 8 high bits of
Rx mark in matching packets. It also counts the packets.

Packets that hit the OR but miss in action rule (AR) table,
should go to MAE admin PF (that is, to DPDK) by default.

Support for the use of action COUNT in JUMP
flows will be introduced by later patches.

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
2 years agocommon/sfc_efx/base: support recirculation ID in outer rules
Ivan Malov [Wed, 13 Oct 2021 13:15:05 +0000 (16:15 +0300)]
common/sfc_efx/base: support recirculation ID in outer rules

When an outer rule is hit, it can pass recirculation ID down
to action rule lookup, and action rules can match on this ID
instead of matching on the outer rule allocation handle.
By default, recirculation ID is assumed to be zero.

Add an API to set recirculation ID in outer rules.

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Acked-by: Ray Kinsella <mdr@ashroe.eu>
2 years agonet/sfc: fence off 8 bits in Rx mark for tunnel offload
Ivan Malov [Wed, 13 Oct 2021 13:15:04 +0000 (16:15 +0300)]
net/sfc: fence off 8 bits in Rx mark for tunnel offload

Later patches add support for tunnel offload on Riverhead (EF100).
A board can host at most 254 tunnels. Partially offloaded (missed)
tunnel packets are identified by virtue of 8 high bits in Rx mark.

Add basic definitions of the upcoming tunnel offload support and
take care of the dedicated bits in Rx mark across the driver.

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
2 years agonet/enic: fix filter mode detection
Hyong Youb Kim [Wed, 13 Oct 2021 01:21:23 +0000 (18:21 -0700)]
net/enic: fix filter mode detection

vnic_dev_capable_filter_mode() currently fails when
CMD_CAPABILITY(CMD_ADD_FILTER) returns ERR_EPERM. In turn, this
failure causes the driver initialization to fail.

But, firmware may legitimately return ERR_EPERM. For example, VF vNIC
returns ERR_EPERM when it does not support filtering at all. So, treat
ERR_EPERM as "no filtering available" instead of an unexpected error.

Fixes: 322b355f2183 ("net/enic/base: bring NIC interface functions up to date")
Cc: stable@dpdk.org
Signed-off-by: Hyong Youb Kim <hyonkim@cisco.com>
Reviewed-by: John Daley <johndale@cisco.com>
2 years agonet/hns3: fix interrupt vector freeing
Chengwen Feng [Wed, 13 Oct 2021 08:09:08 +0000 (16:09 +0800)]
net/hns3: fix interrupt vector freeing

The intr_handle->intr_vec is allocated by rte_zmalloc(), but freed by
free(), this patch fixes it.

Fixes: 02a7b55657b2 ("net/hns3: support Rx interrupt")
Cc: stable@dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
2 years agonet/sfc: report user flag on EF100 native datapath
Ivan Malov [Tue, 12 Oct 2021 19:46:20 +0000 (22:46 +0300)]
net/sfc: report user flag on EF100 native datapath

Detect the flag in Rx prefix and pass it to users.

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
2 years agocommon/sfc_efx/base: add flag to use Rx prefix user flag
Ivan Malov [Tue, 12 Oct 2021 19:46:19 +0000 (22:46 +0300)]
common/sfc_efx/base: add flag to use Rx prefix user flag

Add an RxQ flag to request support for user flag field of Rx
prefix. The feature is supported only on EF100 and EF10 ESSB.

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
2 years agonet/sfc: support flow mark delivery on EF100 native datapath
Ivan Malov [Tue, 12 Oct 2021 19:46:18 +0000 (22:46 +0300)]
net/sfc: support flow mark delivery on EF100 native datapath

MAE counter engine gets generation counts by virtue of the mark,
so the code to extract the field is already in place, but flow
action MARK doesn't benefit from it. Support this use case, too.

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
2 years agonet/sfc: support API to negotiate delivery of Rx metadata
Ivan Malov [Tue, 12 Oct 2021 19:46:17 +0000 (22:46 +0300)]
net/sfc: support API to negotiate delivery of Rx metadata

Initial support for the method. Later patches will extend it to
make FLAG and MARK delivery available on EF100 native datapath.

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
2 years agoethdev: negotiate delivery of packet metadata from HW to PMD
Ivan Malov [Tue, 12 Oct 2021 19:46:16 +0000 (22:46 +0300)]
ethdev: negotiate delivery of packet metadata from HW to PMD

Provide an API to let the application control the NIC's ability
to deliver specific kinds of per-packet metadata to the PMD.

Checks for the NIC's ability to set these kinds of metadata
in the first place (support for the flow actions) belong in
flow API responsibility domain (flow validate mechanism).
This topic is out of scope of the new API in question.

The PMD's ability to deliver received metadata to the user
by virtue of mbuf fields should be covered by mbuf library.
It is also out of scope of the new API in question.

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
Acked-by: Ray Kinsella <mdr@ashroe.eu>
Acked-by: Jerin Jacob <jerinj@marvell.com>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Acked-by: Somnath Kotur <somnath.kotur@broadcom.com>
Acked-by: Ori Kam <orika@nvidia.com>
Acked-by: Wisam Jaddo <wisamm@nvidia.com>
2 years agonet/bnxt: enhance RSS action support
Ajit Khaparde [Tue, 5 Oct 2021 04:17:53 +0000 (21:17 -0700)]
net/bnxt: enhance RSS action support

Enhance support for RSS action in the non-TruFlow path.
This will allow the user or application to update the RSS settings
using RTE_FLOW API.

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Lance Richardson <lance.richardson@broadcom.com>
Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
2 years agonet/bnxt: fix Rx queue state on start
Ajit Khaparde [Tue, 5 Oct 2021 04:05:23 +0000 (21:05 -0700)]
net/bnxt: fix Rx queue state on start

Fix Rx queue state on device start.
The state of Rx queues could be incorrect in some cases
because instead of updating the state for all the Rx queues,
we are updating it for queues in a VNIC.

Fixes: 0105ea1296c9 ("net/bnxt: support runtime queue setup")
Cc: stable@dpdk.org
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Lance Richardson <lance.richardson@broadcom.com>
2 years agonet/bnxt: create aggregation rings when needed
Ajit Khaparde [Fri, 14 May 2021 01:46:21 +0000 (18:46 -0700)]
net/bnxt: create aggregation rings when needed

Aggregation rings are needed when PMD needs to support jumbo frames, LRO.
Currently we are creating the aggregation rings whether jumbo frames or
LRO has been enabled or disabled. This causes unnecessary allocation of
mbufs needing larger mbuf pool which is not used at all.

This patch modifies the code to create aggregation rings only when
needed.

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Lance Richardson <lance.richardson@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
2 years agonet/mlx5: support keeping CRC on Windows
Tal Shnaiderman [Tue, 12 Oct 2021 12:45:53 +0000 (15:45 +0300)]
net/mlx5: support keeping CRC on Windows

Support of the keep-CRC offloading by checking
the relevant FW capability (scatter_fcs) for NIC support.

Supported offload:

DEV_RX_OFFLOAD_KEEP_CRC

Signed-off-by: Tal Shnaiderman <talshn@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
Tested-by: Idan Hackmon <idanhac@nvidia.com>
2 years agocommon/mlx5: read FCS scattering capability from DevX
Tal Shnaiderman [Tue, 12 Oct 2021 12:45:52 +0000 (15:45 +0300)]
common/mlx5: read FCS scattering capability from DevX

mlx5 in Windows needs the hca capability scatter_fcs
to query the NIC support for the CRC keeping offload.

Added the capability as part of the capabilities
queried by the PMD using DevX.

Signed-off-by: Tal Shnaiderman <talshn@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
Tested-by: Idan Hackmon <idanhac@nvidia.com>
2 years agonet/mlx5: support VLAN stripping offload on Windows
Tal Shnaiderman [Tue, 12 Oct 2021 12:45:51 +0000 (15:45 +0300)]
net/mlx5: support VLAN stripping offload on Windows

Support of the VLAN stripping offloading by checking
the relevant FW capability (vlan_cap) for NIC support.

Supported offload:

DEV_RX_OFFLOAD_VLAN_STRIP

Signed-off-by: Tal Shnaiderman <talshn@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
Tested-by: Idan Hackmon <idanhac@nvidia.com>
2 years agocommon/mlx5: read VLAN capability from DevX
Tal Shnaiderman [Tue, 12 Oct 2021 12:45:50 +0000 (15:45 +0300)]
common/mlx5: read VLAN capability from DevX

mlx5 in Windows needs the hca capability vlan_cap
to query the NIC for VLAN stripping support

Added the capability as part of the capabilities
queried by the PMD using DevX.

Signed-off-by: Tal Shnaiderman <talshn@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
Tested-by: Idan Hackmon <idanhac@nvidia.com>
2 years agonet/mlx5: support TSO offload on Windows
Tal Shnaiderman [Tue, 12 Oct 2021 12:45:49 +0000 (15:45 +0300)]
net/mlx5: support TSO offload on Windows

Support of the TSO offloading by checking
the relevant FW capability for NIC support.

Supported offloads:

DEV_TX_OFFLOAD_TCP_TSO
DEV_TX_OFFLOAD_VXLAN_TNL_TSO
DEV_TX_OFFLOAD_GRE_TNL_TSO
DEV_TX_OFFLOAD_GENEVE_TNL_TSO

Signed-off-by: Tal Shnaiderman <talshn@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
Tested-by: Idan Hackmon <idanhac@nvidia.com>
2 years agocommon/mlx5: read TSO capability from DevX
Tal Shnaiderman [Tue, 12 Oct 2021 12:45:48 +0000 (15:45 +0300)]
common/mlx5: read TSO capability from DevX

mlx5 in Windows needs the hca capability max_lso_cap
to query the NIC for TSO offloading support.

Added the capability as part of the capabilities
queried by the PMD using DevX.

Signed-off-by: Tal Shnaiderman <talshn@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
Tested-by: Idan Hackmon <idanhac@nvidia.com>
2 years agonet/mlx5: query tunneling support on Windows
Tal Shnaiderman [Tue, 12 Oct 2021 12:45:47 +0000 (15:45 +0300)]
net/mlx5: query tunneling support on Windows

Query tunneling supported on the NIC.

Save the offloads values in a config parameter.
This is needed for the following TSO support:

DEV_TX_OFFLOAD_VXLAN_TNL_TSO
DEV_TX_OFFLOAD_GRE_TNL_TSO
DEV_TX_OFFLOAD_GENEVE_TNL_TSO

Signed-off-by: Tal Shnaiderman <talshn@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
Tested-by: Idan Hackmon <idanhac@nvidia.com>
2 years agocommon/mlx5: read tunneling capabilities from DevX
Tal Shnaiderman [Tue, 12 Oct 2021 12:45:46 +0000 (15:45 +0300)]
common/mlx5: read tunneling capabilities from DevX

mlx5 in Windows needs the tunneling hca capabilities
to query the NIC for Inner TSO offloading support.

Added the capability as part of the capabilities
queried by the PMD using DevX.

Signed-off-by: Tal Shnaiderman <talshn@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
Tested-by: Idan Hackmon <idanhac@nvidia.com>
2 years agonet/mlx5: fix tunneling support query
Tal Shnaiderman [Tue, 12 Oct 2021 12:45:45 +0000 (15:45 +0300)]
net/mlx5: fix tunneling support query

Currently, the PMD decides if the tunneling offload
can enable VXLAN/GRE/GENEVE tunneled TSO support by checking
config->tunnel_en (single bit) and config->tso.

This is incorrect, the right way is to check the following
flags returned by the mlx5dv_query_device function:

MLX5DV_RAW_PACKET_CAP_TUNNELED_OFFLOAD_VXLAN - if supported the offload
DEV_TX_OFFLOAD_VXLAN_TNL_TSO can be enabled.
MLX5DV_RAW_PACKET_CAP_TUNNELED_OFFLOAD_GRE - if supported the offload
DEV_TX_OFFLOAD_GRE_TNL_TSO can be enabled.
MLX5DV_RAW_PACKET_CAP_TUNNELED_OFFLOAD_GENEVE - if supported the offload
DEV_TX_OFFLOAD_GENEVE_TNL_TSO can be enabled.

The fix enables the offloads according to the correct
flags returned by the kernel.

Fixes: dbccb4cddcd2 ("net/mlx5: convert to new Tx offloads API")
Cc: stable@dpdk.org
Signed-off-by: Tal Shnaiderman <talshn@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
Tested-by: Idan Hackmon <idanhac@nvidia.com>
2 years agonet/mlx5: query software parsing support on Windows
Tal Shnaiderman [Tue, 12 Oct 2021 12:45:44 +0000 (15:45 +0300)]
net/mlx5: query software parsing support on Windows

Query software parsing supported on the NIC.

Save the offloads values in a config parameter.
This is needed for the outer IPv4 checksum and
IP and UDP tunneled packet TSO support.

Signed-off-by: Tal Shnaiderman <talshn@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
Tested-by: Idan Hackmon <idanhac@nvidia.com>
2 years agocommon/mlx5: read software parsing capabilities from DevX
Tal Shnaiderman [Tue, 12 Oct 2021 12:45:43 +0000 (15:45 +0300)]
common/mlx5: read software parsing capabilities from DevX

mlx5 in Windows needs the software parsing hca capabilities
to query the NIC for TSO and Checksum offloading support.

Added the capability as part of the capabilities
queried by the PMD using DevX.

Signed-off-by: Tal Shnaiderman <talshn@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
Tested-by: Idan Hackmon <idanhac@nvidia.com>
2 years agonet/mlx5: fix software parsing support query
Tal Shnaiderman [Tue, 12 Oct 2021 12:45:42 +0000 (15:45 +0300)]
net/mlx5: fix software parsing support query

Currently, the PMD decides if the software parsing
offload can enable outer IPv4 checksum and tunneled
TSO support by checking config->hw_csum and config->tso
respectively.

This is incorrect, the right way is to check the following
flags returned by the mlx5dv_query_device function:

MLX5DV_SW_PARSING - check general swp support.
MLX5DV_SW_PARSING_CSUM - check swp checksum support.
MLX5DV_SW_PARSING_LSO - check swp LSO/TSO support.

The fix enables the offloads according to the correct
flags returned by the kernel.

Fixes: e46821e9fcdc ("net/mlx5: separate generic tunnel TSO from the standard one")
Cc: stable@dpdk.org
Signed-off-by: Tal Shnaiderman <talshn@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
Tested-by: Idan Hackmon <idanhac@nvidia.com>
2 years agoconfig/cn10k: disable octeontx2 drivers
Tomasz Duszynski [Fri, 1 Oct 2021 20:38:33 +0000 (22:38 +0200)]
config/cn10k: disable octeontx2 drivers

Common octeontx2 code shares some of the PCI identifiers
with cn10k platform and if built wrong drivers may be probed.

octeontx2 configuration disables common cn10k code so disable
common octeontx2 on cn10k.

Signed-off-by: Tomasz Duszynski <tduszynski@marvell.com>
Reviewed-by: Jerin Jacob <jerinj@marvell.com>
2 years agocommon/cnxk: add helpers for reading runplatform
Tomasz Duszynski [Fri, 1 Oct 2021 20:24:56 +0000 (22:24 +0200)]
common/cnxk: add helpers for reading runplatform

Add helper functions that allow one to check platform
ROC is running on. Platform type is retrieved from device
tree attribute runplatform which is updated by EBF accordingly.

Signed-off-by: Tomasz Duszynski <tduszynski@marvell.com>
Reviewed-by: Jerin Jacob <jerinj@marvell.com>
2 years agoraw/cnxk_bphy: use ROC calls for max IRQ get
Jakub Palider [Fri, 1 Oct 2021 20:19:41 +0000 (22:19 +0200)]
raw/cnxk_bphy: use ROC calls for max IRQ get

Maximum interrupt number function used direct access to
structure field while ROC helper exists and serves the
same purpose.

Signed-off-by: Jakub Palider <jpalider@marvell.com>
Reviewed-by: Jerin Jacob <jerinj@marvell.com>
2 years agoraw/cnxk_bphy: add wrappers for available message types
Tomasz Duszynski [Fri, 1 Oct 2021 20:19:40 +0000 (22:19 +0200)]
raw/cnxk_bphy: add wrappers for available message types

One sends commands and receive responses by enqueuing or dequeuing
custom messages. In order to simplify this scheme simple wrappers
were added which take care of all the heavy lifting.

Signed-off-by: Tomasz Duszynski <tduszynski@marvell.com>
Reviewed-by: Jakub Palider <jpalider@marvell.com>
Reviewed-by: Jerin Jacob <jerinj@marvell.com>
2 years agonet/iavf: fix multi-process shared data
Dapeng Yu [Mon, 11 Oct 2021 02:01:31 +0000 (10:01 +0800)]
net/iavf: fix multi-process shared data

When the iavf_adapter instance is not initialized completely in the
primary process, the secondary process accesses its "rte_eth_dev"
member, it causes secondary process crash.

This patch replaces eth_dev with eth_dev_data in iavf_adapter.

Fixes: f978c1c9b3b5 ("net/iavf: add RSS hash parsing in AVX path")
Fixes: 9c9aa0040344 ("net/iavf: add offload path for Rx AVX512 flex descriptor")
Fixes: 63660ea3ee0b ("net/iavf: add RSS hash parsing in SSE path")
Cc: stable@dpdk.org
Signed-off-by: Dapeng Yu <dapengx.yu@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
2 years agonet/i40e/base: update version
Robin Zhang [Sat, 9 Oct 2021 01:39:56 +0000 (01:39 +0000)]
net/i40e/base: update version

Update base code version in README.

Signed-off-by: Robin Zhang <robinx.zhang@intel.com>
Acked-by: Beilei Xing <beilei.xing@intel.com>
2 years agonet/i40e/base: add defines related to DDP
Robin Zhang [Sat, 9 Oct 2021 01:39:55 +0000 (01:39 +0000)]
net/i40e/base: add defines related to DDP

This patch adds some defines related to DDP Track ID.

Signed-off-by: Artur Tyminski <arturx.tyminski@intel.com>
Signed-off-by: Robin Zhang <robinx.zhang@intel.com>
Acked-by: Beilei Xing <beilei.xing@intel.com>
2 years agonet/i40e/base: update FW API version to 1.15
Robin Zhang [Sat, 9 Oct 2021 01:39:54 +0000 (01:39 +0000)]
net/i40e/base: update FW API version to 1.15

Update FVL FW API version to 1.15

Signed-off-by: Maciej Paczkowski <maciej.paczkowski@intel.com>
Signed-off-by: Robin Zhang <robinx.zhang@intel.com>
Acked-by: Beilei Xing <beilei.xing@intel.com>
2 years agonet/i40e/base: add raw format for 32 bytes Rx description
Robin Zhang [Sat, 9 Oct 2021 01:39:53 +0000 (01:39 +0000)]
net/i40e/base: add raw format for 32 bytes Rx description

Add raw format for i40e_32byte_rx_desc, right now this only be used
by kernel driver, the commit is just to sync with kernel driver.

Signed-off-by: Björn Töpel <bjorn.topel@intel.com>
Signed-off-by: Robin Zhang <robinx.zhang@intel.com>
Acked-by: Beilei Xing <beilei.xing@intel.com>
2 years agonet/i40e/base: add MAC frequency calculation if no link
Robin Zhang [Sat, 9 Oct 2021 01:39:52 +0000 (01:39 +0000)]
net/i40e/base: add MAC frequency calculation if no link

Add macros and structures for MAC frequency calculation in case the link
is not present.

Remove duplicate definition in i40e_ethdev.c

Signed-off-by: Piotr Kwapulinski <piotr.kwapulinski@intel.com>
Signed-off-by: Robin Zhang <robinx.zhang@intel.com>
Acked-by: Beilei Xing <beilei.xing@intel.com>
2 years agonet/i40e/base: fix using checksum before check
Robin Zhang [Sat, 9 Oct 2021 01:39:51 +0000 (01:39 +0000)]
net/i40e/base: fix using checksum before check

The variable checksum from i40e_calc_nvm_checksum is used before return
value is checked. Fix this logic.

Fixes: 8db9e2a1b232 ("i40e: base driver")
Fixes: 3ed6c3246f43 ("i40e/base: handle AQ timeout when releasing NVM")
Cc: stable@dpdk.org
Signed-off-by: Christopher Pau <christopher.pau@intel.com>
Signed-off-by: Robin Zhang <robinx.zhang@intel.com>
Acked-by: Beilei Xing <beilei.xing@intel.com>
2 years agonet/i40e/base: fix potentially uninitialized variables
Robin Zhang [Sat, 9 Oct 2021 01:39:50 +0000 (01:39 +0000)]
net/i40e/base: fix potentially uninitialized variables

The status of i40e_read_nvm_word is not checked, so variables set
from this function could be used uninitialized. In this case, preserve
the existing flow that does not block initialization by initializing
these values from the start.

Fixes: 8d6c51fcd24b ("i40e/base: get OEM version")
Fixes: 2db70574247b ("net/i40e/base: limit PF/VF specific code to that driver only")
Cc: stable@dpdk.org
Signed-off-by: Christopher Pau <christopher.pau@intel.com>
Signed-off-by: Robin Zhang <robinx.zhang@intel.com>
Acked-by: Beilei Xing <beilei.xing@intel.com>
2 years agonet/i40e/base: fix function name in comments
Robin Zhang [Sat, 9 Oct 2021 01:39:49 +0000 (01:39 +0000)]
net/i40e/base: fix function name in comments

Fix mismatched function name in comments.

Fixes: 8db9e2a1b232 ("i40e: base driver")
Fixes: 842ea1996335 ("i40e/base: save link module type")
Fixes: fd72a2284a89 ("i40e/base: support LED blinking with new PHY")
Fixes: 788fc17b2dec ("i40e/base: support proxy config for X722")
Cc: stable@dpdk.org
Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Signed-off-by: Robin Zhang <robinx.zhang@intel.com>
Acked-by: Beilei Xing <beilei.xing@intel.com>
2 years agonet/i40e/base: add flags and fields for double VLAN
Robin Zhang [Sat, 9 Oct 2021 01:39:48 +0000 (01:39 +0000)]
net/i40e/base: add flags and fields for double VLAN

Add flags for outer VLAN and include set port parameters.
Add flags, which describe port and switch state for both double VLAN
functionality and outer VLAN processing.

Signed-off-by: Przemyslaw Patynowski <przemyslawx.patynowski@intel.com>
Signed-off-by: Robin Zhang <robinx.zhang@intel.com>
Acked-by: Beilei Xing <beilei.xing@intel.com>
2 years agonet/i40e/base: fix AOC media type
Robin Zhang [Sat, 9 Oct 2021 01:39:47 +0000 (01:39 +0000)]
net/i40e/base: fix AOC media type

For Active Optical Cable (AOC) the correct media type is "Fibre",
not "Direct Attach Copper".

Fixes: d749d4d89969 ("i40e/base: add AOC PHY types")
Fixes: aa153cc89ff0 ("net/i40e/base: add new PHY types for 25G AOC and ACC")
Cc: stable@dpdk.org
Signed-off-by: Dawid Lukwinski <dawid.lukwinski@intel.com>
Signed-off-by: Robin Zhang <robinx.zhang@intel.com>
Acked-by: Beilei Xing <beilei.xing@intel.com>
2 years agonet/i40e/base: fix update link data for X722
Robin Zhang [Sat, 9 Oct 2021 01:39:46 +0000 (01:39 +0000)]
net/i40e/base: fix update link data for X722

The X722 card has 'Link Type' information elsewhere than the X710.
Previously, for all cards, the 'Link Type' information was retrieved by
opcode 0x0607 and this value was wrong for all X722 cards.
Now this information for X722 only is taken by opcode 0x0600
(function: i40e_aq_get_phy_capabilities) instead of an opcode
0x0607 (function: i40e_aq_get_link_info).
All other parameters read by opcode 0x0607 unchanged.

Fixes: e6691b428eb1 ("i40e/base: fix PHY NVM interaction")
Fixes: 75c3de654ead ("net/i40e/base: fix long link down notification time")
Cc: stable@dpdk.org
Signed-off-by: Jaroslaw Gawin <jaroslawx.gawin@intel.com>
Signed-off-by: Robin Zhang <robinx.zhang@intel.com>
Acked-by: Beilei Xing <beilei.xing@intel.com>
2 years agonet/i40e/base: fix PF reset
Robin Zhang [Sat, 9 Oct 2021 01:39:45 +0000 (01:39 +0000)]
net/i40e/base: fix PF reset

PF has to delete all the filters during reset.
If it is fully loaded with filters then it is possible that it will take
more than 200 ms to finish the reset resulting in timeout during pf_reset
and PF reset failed, -15 error indication.

Increasing the timeout value for PF reset from 200 to 1000 to give PF
more time to finish reset if it is loaded with filters.

Fixes: 1e32378f0774 ("i40e/base: increase PF reset max loop limit")
Cc: stable@dpdk.org
Signed-off-by: Sylwester Dziedziuch <sylwesterx.dziedziuch@intel.com>
Signed-off-by: Robin Zhang <robinx.zhang@intel.com>
Acked-by: Beilei Xing <beilei.xing@intel.com>
2 years agonet/i40e/base: fix PHY identifiers for 2.5G and 5G adapters
Robin Zhang [Sat, 9 Oct 2021 01:39:44 +0000 (01:39 +0000)]
net/i40e/base: fix PHY identifiers for 2.5G and 5G adapters

Unlike other supported adapters, 2.5G and 5G use different PHY type
identifiers for reading/writing PHY settings and for reading link status.
This commit introduces separate PHY identifiers for these two operation
types.

Fixes: 988ed63c7441 ("net/i40e/base: add support for Carlsville device")
Cc: stable@dpdk.org
Signed-off-by: Dawid Lukwinski <dawid.lukwinski@intel.com>
Signed-off-by: Robin Zhang <robinx.zhang@intel.com>
Acked-by: Beilei Xing <beilei.xing@intel.com>
2 years agonet/i40e/base: define new shadow RAM pointers
Robin Zhang [Sat, 9 Oct 2021 01:39:43 +0000 (01:39 +0000)]
net/i40e/base: define new shadow RAM pointers

Add definitions for Shadow RAM pointers: 6th FPA (Free Provisioning Area)
module, 5th FPA module in X722 and Preservation Rules module.

These definitions are not using by DPDK now, the purpose of this commit
is to sync base code with kernel driver.

Signed-off-by: Stanislaw Grzeszczak <stanislaw.a.grzeszczak@intel.com>
Signed-off-by: Robin Zhang <robinx.zhang@intel.com>
Acked-by: Beilei Xing <beilei.xing@intel.com>
2 years agonet/i40e/base: set TSA table values when parsing CEE config
Robin Zhang [Sat, 9 Oct 2021 01:39:42 +0000 (01:39 +0000)]
net/i40e/base: set TSA table values when parsing CEE config

Driver did not Set TSA (Transmit Selection Algorithm) table values when
parsing CEE (Converged Enhanced Ethernet) configuration obtained from FW

Signed-off-by: Pawel Malinowski <pawel.malinowski@intel.com>
Signed-off-by: Robin Zhang <robinx.zhang@intel.com>
Acked-by: Beilei Xing <beilei.xing@intel.com>
2 years agonet/i40e/base: add min SRev for 4 more X722 modules
Robin Zhang [Sat, 9 Oct 2021 01:39:41 +0000 (01:39 +0000)]
net/i40e/base: add min SRev for 4 more X722 modules

Some customers want to downgrade to an earlier FW security revision, this
already implemented by FW so that customers can have more control over
the security revisions they can use. FW also implemented a mechanism via
NVMupdate to allow the users to accept or not a baseline Min SRev version
that will limit the secure version rollback only down to that level.

This commit increments X722 API version and adds new minimal rollback
revision that related to the extended implementation of Security Revision
Opt-In for 4 more X722 modules.

These definitions are not using by DPDK now, the purpose of this commit
is sync with latest share code.

Signed-off-by: Stanislaw Grzeszczak <stanislaw.a.grzeszczak@intel.com>
Signed-off-by: Robin Zhang <robinx.zhang@intel.com>
Acked-by: Beilei Xing <beilei.xing@intel.com>
2 years agonet/i40e/base: add send ASQ command v2 functions
Robin Zhang [Sat, 9 Oct 2021 01:39:40 +0000 (01:39 +0000)]
net/i40e/base: add send ASQ command v2 functions

ASQ(Admin Send Queue) send command functions are returning only i40e
status codes yet some calling functions also need Admin Queue status that
is stored in hw->aq.asq_last_status. Since hw object is stored on a heap
it introduces a possibility for a race condition in access to hw if
calling function is not fast enough to read hw->aq.asq_last_status before
next send ASQ command is executed.

Added new versions of send ASQ command functions that return Admin Queue
status on the stack to avoid race conditions in access to
hw->aq.asq_last_status.
Added new _v2 version of i40e_aq_remove_macvlan and i40e_aq_add_macvlan
that is using new _v2 versions of ASQ send command functions and returns
the Admin Queue status on the stack.

Signed-off-by: Sylwester Dziedziuch <sylwesterx.dziedziuch@intel.com>
Signed-off-by: Robin Zhang <robinx.zhang@intel.com>
Acked-by: Beilei Xing <beilei.xing@intel.com>
2 years agonet/ixgbe: fix queue release
Julien Meunier [Tue, 28 Sep 2021 08:12:38 +0000 (10:12 +0200)]
net/ixgbe: fix queue release

On the vector implementation, during the tear-down, the mbufs not
drained in the RxQ and TxQ are freed based on an algorithm which
supposed that the number of descriptors is a power of 2 (max_desc).
Based on this hypothesis, this algorithm uses a bitmask in order to
detect an index overflow during the iteration, and to restart the loop
from 0.

However, there is no such power of 2 requirement in the ixgbe for the
number of descriptors in the RxQ / TxQ. The only requirement is to have
a number correctly aligned.

If a user requested to configure a number of descriptors which is not a
power of 2, as a consequence, during the tear-down, it was possible to
be in an infinite loop, and to never reach the exit loop condition.

By removing the bitmask and changing the loop method, we can avoid this
issue, and allow the user to configure a RxQ / TxQ which is not a power
of 2.

Fixes: c95584dc2b18 ("ixgbe: new vectorized functions for Rx/Tx")
Cc: stable@dpdk.org
Signed-off-by: Julien Meunier <julien.meunier@nokia.com>
Acked-by: Haiyue Wang <haiyue.wang@intel.com>
2 years agonet/i40e: fix Rx packet statistics
Alvin Zhang [Thu, 30 Sep 2021 05:19:57 +0000 (13:19 +0800)]
net/i40e: fix Rx packet statistics

Some packets are discarded by the NIC because they are larger than
the MTU, these packets should be counted as "RX error" instead of
"RX packet", for example:

  pkt1 = Ether()/IP()/Raw('x' * 1400)
  pkt2 = Ether()/IP()/Raw('x' * 1500)

  ---------------- Forward statistics for port 0 -----------------
  RX-packets: 2 RX-dropped: 0 RX-total: 2
  TX-packets: 1 TX-dropped: 0 TX-total: 1
  ----------------------------------------------------------------

  Here the packet pkt2 has been discarded, but still was counted
  by "RX-packets"

The register 'GL_RXERR1' can count above discarded packets.
This patch adds reading and calculation of the 'GL_RXERR1' counter
when reporting DPDK statistics.

Fixes: f4a91c38b4ad ("i40e: add extended stats")
Cc: stable@dpdk.org
Signed-off-by: Alvin Zhang <alvinx.zhang@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
2 years agonet/iavf: fix QFI field bit check for GTPU EH
Junfeng Guo [Fri, 8 Oct 2021 10:41:43 +0000 (10:41 +0000)]
net/iavf: fix QFI field bit check for GTPU EH

If GTPU Extension header has no pdu_type setting, the parsed value of
gtp_psc_spec->hdr.type will be 0, which is same as IAVF_GTPU_EH_DWLINK.
Thus, for this case, we should check gtp_psc_mask->hdr.type instead,
to set QFI field bit of GTPU_EH first.

Fixes: cd212c466992 ("net/iavf: fix QFI fields of GTPU UL/DL for flow director")
Cc: stable@dpdk.org
Signed-off-by: Junfeng Guo <junfeng.guo@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
2 years agoethdev: remove deprecated shared counter attribute
Andrew Rybchenko [Fri, 8 Oct 2021 10:26:15 +0000 (13:26 +0300)]
ethdev: remove deprecated shared counter attribute

Indirect actions should be used to do shared counters.

Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Acked-by: Somnath Kotur <somnath.kotur@broadcom.com>
Acked-by: Ori Kam <orika@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
2 years agoapp/testpmd: add command to print representor info
Viacheslav Galaktionov [Mon, 11 Oct 2021 13:08:40 +0000 (16:08 +0300)]
app/testpmd: add command to print representor info

Make it simpler to debug configurations and code related to the representor
info API.

Signed-off-by: Viacheslav Galaktionov <viacheslav.galaktionov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
Reviewed-by: Xueming Li <xuemingl@nvidia.com>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Acked-by: Xiaoyun Li <xiaoyun.li@intel.com>
2 years agonet/sfc: update comment about representor support
Viacheslav Galaktionov [Mon, 11 Oct 2021 14:48:57 +0000 (17:48 +0300)]
net/sfc: update comment about representor support

The representor support has been implemented to some extent, and the fact
that ethdev mport is equivalent to entity mport is by design.

Fixes: 1fb65e4dae8a ("net/sfc: support flow action port ID in transfer rules")
Cc: stable@dpdk.org
Signed-off-by: Viacheslav Galaktionov <viacheslav.galaktionov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
2 years agonet/sfc: support representor info get
Viacheslav Galaktionov [Mon, 11 Oct 2021 14:48:56 +0000 (17:48 +0300)]
net/sfc: support representor info get

Let the driver provide the user with information about available
representors by implementing the representor_info_get operation.

Due to the lack of any structure to representor IDs, every ID range
describes exactly one representor.

Signed-off-by: Viacheslav Galaktionov <viacheslav.galaktionov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
2 years agonet/sfc: use switch port ID as representor ID
Viacheslav Galaktionov [Mon, 11 Oct 2021 14:48:55 +0000 (17:48 +0300)]
net/sfc: use switch port ID as representor ID

Representor IDs must be unique for each representor. VFs, which are
currently used, are not unique as they may repeat in combination with
different PCI controllers and PFs. On the other hand, switch port IDs
are unique, so they are a better fit for this role.

Signed-off-by: Viacheslav Galaktionov <viacheslav.galaktionov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
2 years agonet/sfc: support new representor parameter syntax
Viacheslav Galaktionov [Mon, 11 Oct 2021 14:48:54 +0000 (17:48 +0300)]
net/sfc: support new representor parameter syntax

Allow the user to specify representor entities using the structured
parameter values.

Signed-off-by: Viacheslav Galaktionov <viacheslav.galaktionov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
2 years agonet/sfc: include controller and port in representor name
Viacheslav Galaktionov [Mon, 11 Oct 2021 14:48:53 +0000 (17:48 +0300)]
net/sfc: include controller and port in representor name

Make representor names unique on multi-host configurations.

Signed-off-by: Viacheslav Galaktionov <viacheslav.galaktionov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
2 years agonet/sfc: store PCI address for represented entities
Viacheslav Galaktionov [Mon, 11 Oct 2021 14:48:52 +0000 (17:48 +0300)]
net/sfc: store PCI address for represented entities

This information will be useful when representor info API is implemented.

Signed-off-by: Viacheslav Galaktionov <viacheslav.galaktionov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
2 years agonet/sfc: maintain controller to EFX interface mapping
Viacheslav Galaktionov [Mon, 11 Oct 2021 14:48:51 +0000 (17:48 +0300)]
net/sfc: maintain controller to EFX interface mapping

Newer hardware may have arbitrarily complex controller configurations,
and for this reason the mapping has been made dynamic: it is represented
with a dynamic array that is indexed by controller numbers and each
element contains an EFX interface number. Since the number of controllers
is expected to be small, this approach should not hurt the performance.

Signed-off-by: Viacheslav Galaktionov <viacheslav.galaktionov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
2 years agocommon/sfc_efx/base: allow getting VNIC MCDI client handles
Viacheslav Galaktionov [Mon, 11 Oct 2021 14:48:50 +0000 (17:48 +0300)]
common/sfc_efx/base: allow getting VNIC MCDI client handles

Equality checks between VNICs should be done by comparing their client
handles. This means that clients should be able to retrieve client
handles for arbitrary functions and themselves.

Signed-off-by: Viacheslav Galaktionov <viacheslav.galaktionov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
2 years agocommon/sfc_efx/base: add API to read MAE mport journal
Viacheslav Galaktionov [Mon, 11 Oct 2021 14:48:49 +0000 (17:48 +0300)]
common/sfc_efx/base: add API to read MAE mport journal

This is required to provide the driver with the current state of mports.

Signed-off-by: Viacheslav Galaktionov <viacheslav.galaktionov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
2 years agocommon/sfc_efx/base: retrieve function interfaces for VNICs
Viacheslav Galaktionov [Mon, 11 Oct 2021 14:48:48 +0000 (17:48 +0300)]
common/sfc_efx/base: retrieve function interfaces for VNICs

This information is required to be able to fully identify the function.
Add this information to the NIC configuration structure for easy access.

Signed-off-by: Viacheslav Galaktionov <viacheslav.galaktionov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
2 years agocommon/sfc_efx/base: add multi-host function mport selector
Viacheslav Galaktionov [Mon, 11 Oct 2021 14:48:47 +0000 (17:48 +0300)]
common/sfc_efx/base: add multi-host function mport selector

Provide helper function to compose multi-host aware PCIe
function M-port selector.

The firmware expects mport selectors to use different sets of values to
represent a PCIe interface in mport selectors and elsewhere. In order to
avoid having the user perform the conversion themselves, it is now done
automatically when a selector is constructed.

In addition, a type has been added to libefx for possible PCIe
interfaces.
This is done to abstract different representations away from the users.

Allow to support matching traffic coming from an arbitrary PCIe
end-point of the NIC and redirect traffic to it.

Signed-off-by: Viacheslav Galaktionov <viacheslav.galaktionov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
2 years agonet/sfc: free MAE lock once switch domain is assigned
Viacheslav Galaktionov [Mon, 11 Oct 2021 14:48:46 +0000 (17:48 +0300)]
net/sfc: free MAE lock once switch domain is assigned

If for some reason the hardware switch ID initialization function fails,
MAE lock is still held after the function finishes. This patch fixes that.

Fixes: 1e7fbdf0ba19 ("net/sfc: support concept of switch domains/ports")
Cc: stable@dpdk.org
Signed-off-by: Viacheslav Galaktionov <viacheslav.galaktionov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
2 years agonet/sfc: add simple port representor statistics
Igor Romanov [Mon, 11 Oct 2021 14:48:45 +0000 (17:48 +0300)]
net/sfc: add simple port representor statistics

Gather statistics of enqueued and dequeued packets in Rx and Tx burst
callbacks to report in stats_get callback.

Signed-off-by: Igor Romanov <igor.romanov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
Reviewed-by: Ivan Malov <ivan.malov@oktetlabs.ru>
2 years agonet/sfc: implement representor Rx
Igor Romanov [Mon, 11 Oct 2021 14:48:44 +0000 (17:48 +0300)]
net/sfc: implement representor Rx

Implement traffic forwarding for representor and representor proxy
from virtual functions to representor Rx queues.

Signed-off-by: Igor Romanov <igor.romanov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
Reviewed-by: Ivan Malov <ivan.malov@oktetlabs.ru>
2 years agonet/sfc: handle ingress mport in EF100 Rx prefix
Igor Romanov [Mon, 11 Oct 2021 14:48:43 +0000 (17:48 +0300)]
net/sfc: handle ingress mport in EF100 Rx prefix

Set ingress mport dynamic field in mbuf in EF100.

For a given PF, Rx queues of representor devices
function on top of the only Rx queue operated by
the PF representor proxy facility. This field is
a means to demultiplex traffic hitting the queue.

Signed-off-by: Igor Romanov <igor.romanov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
Reviewed-by: Ivan Malov <ivan.malov@oktetlabs.ru>
2 years agonet/sfc: use xword type for EF100 Rx prefix
Igor Romanov [Mon, 11 Oct 2021 14:48:42 +0000 (17:48 +0300)]
net/sfc: use xword type for EF100 Rx prefix

Layout of the EF100 Rx prefix is defined in terms of a 32 bytes long
value type (xword). Replace oword with xword to avoid truncation.

Signed-off-by: Igor Romanov <igor.romanov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
Reviewed-by: Ivan Malov <ivan.malov@oktetlabs.ru>
2 years agonet/sfc: implement representor Tx
Igor Romanov [Mon, 11 Oct 2021 14:48:41 +0000 (17:48 +0300)]
net/sfc: implement representor Tx

Forward traffic that is transmitted from a port representor to the
corresponding virtual function using the dedicated TxQ.

Signed-off-by: Igor Romanov <igor.romanov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
Reviewed-by: Ivan Malov <ivan.malov@oktetlabs.ru>
2 years agonet/sfc: support multiple device probe
Igor Romanov [Mon, 11 Oct 2021 14:48:40 +0000 (17:48 +0300)]
net/sfc: support multiple device probe

Support probing the device multiple times so that additional port
representors can be created with hotplug EAL API. To hotplug a
representor, the PF must be hotplugged with different representor
device argument.

Signed-off-by: Igor Romanov <igor.romanov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
Reviewed-by: Ivan Malov <ivan.malov@oktetlabs.ru>
2 years agonet/sfc: implement port representor link update
Igor Romanov [Mon, 11 Oct 2021 14:48:39 +0000 (17:48 +0300)]
net/sfc: implement port representor link update

Implement the callback by reporting link down if the representor
is not started, otherwise report link up with undefined link speed.

Link speed is undefined since representors can pass traffic to each
other even if the PF link is down.

Signed-off-by: Igor Romanov <igor.romanov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
Reviewed-by: Ivan Malov <ivan.malov@oktetlabs.ru>
2 years agonet/sfc: implement port representor start and stop
Igor Romanov [Mon, 11 Oct 2021 14:48:38 +0000 (17:48 +0300)]
net/sfc: implement port representor start and stop

Implement queue start and stop operation both in port
representors and representor proxy.

Signed-off-by: Igor Romanov <igor.romanov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
Reviewed-by: Ivan Malov <ivan.malov@oktetlabs.ru>
2 years agonet/sfc: implement representor Tx queue start/stop
Igor Romanov [Mon, 11 Oct 2021 14:48:37 +0000 (17:48 +0300)]
net/sfc: implement representor Tx queue start/stop

Implement Tx queue start and stop in port representor proxy.

Signed-off-by: Igor Romanov <igor.romanov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
Reviewed-by: Ivan Malov <ivan.malov@oktetlabs.ru>
2 years agonet/sfc: implement representor Rx queue start/stop
Igor Romanov [Mon, 11 Oct 2021 14:48:36 +0000 (17:48 +0300)]
net/sfc: implement representor Rx queue start/stop

Add extra libefx flags to Rx queue information initialization
function interface to be able to specify the ingress m-port
flag for a representor RxQ. Rx prefix of packets on that queue
will contain ingress m-port field required for packet forwarding
in representor proxy.

Signed-off-by: Igor Romanov <igor.romanov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
Reviewed-by: Ivan Malov <ivan.malov@oktetlabs.ru>
2 years agonet/sfc: implement representor queue setup and release
Igor Romanov [Mon, 11 Oct 2021 14:48:35 +0000 (17:48 +0300)]
net/sfc: implement representor queue setup and release

Implement queue creation and destruction both in port representors
and representor proxy.

Signed-off-by: Igor Romanov <igor.romanov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
Reviewed-by: Ivan Malov <ivan.malov@oktetlabs.ru>
2 years agonet/sfc: add representor proxy port API
Igor Romanov [Mon, 11 Oct 2021 14:48:34 +0000 (17:48 +0300)]
net/sfc: add representor proxy port API

The API is required to create and destroy representor proxy
port assigned to representor.

Signed-off-by: Igor Romanov <igor.romanov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
Reviewed-by: Ivan Malov <ivan.malov@oktetlabs.ru>
2 years agocommon/sfc_efx/base: add mport alias MCDI wrappers
Igor Romanov [Mon, 11 Oct 2021 14:48:33 +0000 (17:48 +0300)]
common/sfc_efx/base: add mport alias MCDI wrappers

The APIs allow creation of mports for port representor
traffic filtering.

Signed-off-by: Igor Romanov <igor.romanov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
Reviewed-by: Ivan Malov <ivan.malov@oktetlabs.ru>
2 years agocommon/sfc_efx/base: add API to get mport selector by ID
Igor Romanov [Mon, 11 Oct 2021 14:48:32 +0000 (17:48 +0300)]
common/sfc_efx/base: add API to get mport selector by ID

The conversion is required when mport ID is received via
mport allocation and mport selector is required for filter
creation.

Signed-off-by: Igor Romanov <igor.romanov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
Reviewed-by: Ivan Malov <ivan.malov@oktetlabs.ru>
2 years agocommon/sfc_efx/base: add filter ingress mport matching field
Igor Romanov [Mon, 11 Oct 2021 14:48:31 +0000 (17:48 +0300)]
common/sfc_efx/base: add filter ingress mport matching field

The field changes the mport for which the filter is created.
It is required to filter traffic from VF on an alias mport.

Signed-off-by: Igor Romanov <igor.romanov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
Reviewed-by: Ivan Malov <ivan.malov@oktetlabs.ru>
2 years agonet/sfc: add port representors infrastructure
Igor Romanov [Mon, 11 Oct 2021 14:48:30 +0000 (17:48 +0300)]
net/sfc: add port representors infrastructure

Provide minimal implementation for port representors that only can be
configured and can provide device information.

Signed-off-by: Igor Romanov <igor.romanov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
Reviewed-by: Ivan Malov <ivan.malov@oktetlabs.ru>
2 years agocommon/sfc_efx/base: allow creating invalid mport selectors
Viacheslav Galaktionov [Mon, 11 Oct 2021 14:48:29 +0000 (17:48 +0300)]
common/sfc_efx/base: allow creating invalid mport selectors

There isn't always a valid mport that can be used. For these cases,
special invalid selectors can be generated. Requests that use such
selectors in any way will be rejected.

Signed-off-by: Viacheslav Galaktionov <viacheslav.galaktionov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
2 years agonet/sfc: move adapter state enum to separate header
Igor Romanov [Mon, 11 Oct 2021 14:48:28 +0000 (17:48 +0300)]
net/sfc: move adapter state enum to separate header

Adapter state will be reused by representors, that will have
a separate adapter. Rename adapter state to ethdev state
so that the meaning of it is clearer.

Signed-off-by: Igor Romanov <igor.romanov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
Reviewed-by: Ivan Malov <ivan.malov@oktetlabs.ru>
2 years agonet/sfc: reserve queues for port representors
Igor Romanov [Mon, 11 Oct 2021 14:48:27 +0000 (17:48 +0300)]
net/sfc: reserve queues for port representors

A Tx/Rx queue pair is required to forward traffic between
port representors and virtual functions.

Signed-off-by: Igor Romanov <igor.romanov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
Reviewed-by: Ivan Malov <ivan.malov@oktetlabs.ru>
2 years agonet/sfc: add representors proxy infrastructure
Igor Romanov [Mon, 11 Oct 2021 14:48:26 +0000 (17:48 +0300)]
net/sfc: add representors proxy infrastructure

Representor proxy is a mediator between virtual functions and port
representors. It forwards traffic between virtual functions and port
representors performing base PF ethdev + VF's representor traffic
(de-)multiplexing. The implementation will be provided by later patches.

Signed-off-by: Igor Romanov <igor.romanov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
Reviewed-by: Ivan Malov <ivan.malov@oktetlabs.ru>
2 years agonet/sfc: support EF100 Tx override prefix
Igor Romanov [Mon, 11 Oct 2021 14:48:25 +0000 (17:48 +0300)]
net/sfc: support EF100 Tx override prefix

Add internal mbuf dynamic flag and field to request EF100 native
Tx datapath to use Tx prefix descriptor to override egress m-port.
Overriding egress m-port is necessary on representor Tx burst
so that the packet will reach corresponding VF.

Signed-off-by: Igor Romanov <igor.romanov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
Reviewed-by: Ivan Malov <ivan.malov@oktetlabs.ru>
2 years agocommon/sfc_efx/base: add API to get mport ID by selector
Igor Romanov [Mon, 11 Oct 2021 14:48:24 +0000 (17:48 +0300)]
common/sfc_efx/base: add API to get mport ID by selector

The mport ID is required to set appropriate egress mport ID
in Tx prefix for port representor TxQ.

Signed-off-by: Igor Romanov <igor.romanov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
Reviewed-by: Ivan Malov <ivan.malov@oktetlabs.ru>
2 years agonet/sfc: insert switchdev mode MAE rules
Igor Romanov [Mon, 11 Oct 2021 14:48:23 +0000 (17:48 +0300)]
net/sfc: insert switchdev mode MAE rules

By default, the firmware is in EVB mode, but insertion of the first MAE
rule resets it to switchdev mode automatically and removes all automatic
MAE rules added by EVB support. On initialisation, insert MAE rules that
forward traffic between PHY and PF.

Add an API for creation and insertion of driver-internal MAE
rules(flows).

Signed-off-by: Igor Romanov <igor.romanov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
Reviewed-by: Ivan Malov <ivan.malov@oktetlabs.ru>