dpdk.git
4 years agonet/iavf: negotiate large VF and request more queues
Ting Xu [Thu, 22 Oct 2020 06:48:59 +0000 (14:48 +0800)]
net/iavf: negotiate large VF and request more queues

Negotiate large VF capability with PF during VF initialization. If large
VF is supported and the number of queues larger than 16 is required, VF
requests additional queues from PF. Mark the state that large VF is
supported.

If the allocated queues number is larger than 16, the max RSS queue
region cannot be 16 anymore. Add the function to query max RSS queue
region from PF, use it in the RSS initialization and future filters
configuration.

Signed-off-by: Ting Xu <ting.xu@intel.com>
Acked-by: Beilei Xing <beilei.xing@intel.com>
4 years agonet/iavf: support requesting additional queues from PF
Ting Xu [Thu, 22 Oct 2020 06:48:58 +0000 (14:48 +0800)]
net/iavf: support requesting additional queues from PF

Add a new virtchnl function to request additional queues from PF.
Current default queue pairs number when creating a VF is 16. In order to
support up to 256 queue pairs per VF, enable this request queues
function.

When requesting queues succeeds, PF will return an event message. If it
is handled by interrupt first, the request queues command cannot receive
the correct PF response and will wait until timeout. Therefore, disable
interrupt before requesting queues in order to handle the event message
asynchronously.

Signed-off-by: Ting Xu <ting.xu@intel.com>
Acked-by: Beilei Xing <beilei.xing@intel.com>
4 years agonet/iavf: handle virtchnl event message without interrupt
Ting Xu [Thu, 22 Oct 2020 06:48:57 +0000 (14:48 +0800)]
net/iavf: handle virtchnl event message without interrupt

Currently, VF can only handle virtchnl event message by calling
interrupt.
It is not available in two cases:
1. If the event message comes during VF initialization before interrupt
   is enabled, this message will not be handled correctly.
2. Some virtchnl commands need to receive the event message and handle
   it with interrupt disabled.

To solve this issue, we add the virtchnl event message handling in the
process of reading vitchnl messages in adminq from PF.

Signed-off-by: Ting Xu <ting.xu@intel.com>
Acked-by: Beilei Xing <beilei.xing@intel.com>
4 years agonet/mlx5: implement vectorized MPRQ burst
Alexander Kozyrev [Wed, 21 Oct 2020 20:30:30 +0000 (20:30 +0000)]
net/mlx5: implement vectorized MPRQ burst

MPRQ (Multi-Packet Rx Queue) processes one packet at a time using
simple scalar instructions. MPRQ works by posting a single large buffer
(consisted of multiple fixed-size strides) in order to receive multiple
packets at once on this buffer. A Rx packet is then copied to a
user-provided mbuf or PMD attaches the Rx packet to the mbuf by the
pointer to an external buffer.

There is an opportunity to speed up the packet receiving by processing
4 packets simultaneously using SIMD (single instruction, multiple data)
extensions. Allocate mbufs in batches for every MPRQ buffer and process
the packets in groups of 4 until all the strides are exhausted. Then
switch to another MPRQ buffer and repeat the process over again.

The vectorized MPRQ burst routine is engaged automatically in case
the mprq_en=1 devarg is specified and the vectorization is not disabled
explicitly by providing rx_vec_en=0 devarg. There is a limitation:
LRO is not supported and scalar MPRQ is selected if it is on.

Signed-off-by: Alexander Kozyrev <akozyrev@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
4 years agonet/mlx5: refactor vectorized Rx
Alexander Kozyrev [Wed, 21 Oct 2020 20:30:29 +0000 (20:30 +0000)]
net/mlx5: refactor vectorized Rx

Move the main processing cycle into a separate function:
rxq_cq_process_v. Put the regular rxq_burst_v function
to a non-arch specific file. Having all SIMD instructions
in a single reusable block is a first preparatory step to
implement vectorized Rx burst for MPRQ feature.

Pass a pointer to the storage of mbufs directly to the
rxq_copy_mbuf_v instead of calculating the pointer inside
this function. This is needed for the future vectorized Rx
routing which is going to pass a different pointer here.

Calculate the number of packets to replenish inside the
mlx5_rx_replenish_bulk_mbuf. Containing this logic in one
place allows us to do the same for MPRQ case.

Signed-off-by: Alexander Kozyrev <akozyrev@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
4 years agonet/mlx5: fix port shared data reference count
Xueming Li [Wed, 21 Oct 2020 11:15:23 +0000 (11:15 +0000)]
net/mlx5: fix port shared data reference count

When probe a representor, tag cache hash table and modification cache
hash table allocated memory upon each port, overwrote previous existing
cache in shared context data.

This patch moves reference check of shared data prior to hash table
allocation to avoid such issue.

Fixes: 6801116688fe ("net/mlx5: fix multiple flow table hash list")
Fixes: 1ef4cdef2682 ("net/mlx5: fix flow tag hash list conversion")
Cc: stable@dpdk.org
Acked-by: Matan Azrad <matan@nvidia.com>
Signed-off-by: Xueming Li <xuemingl@nvidia.com>
4 years agonet/mlx5: fix xstats reset reinitialization
Shiri Kuzin [Mon, 19 Oct 2020 06:36:50 +0000 (09:36 +0300)]
net/mlx5: fix xstats reset reinitialization

The mlx5_xstats_reset clears the device extended statistics.
In this function the driver may reinitialize the structures
that are used to read device counters.

In case of reinitialization, the number of counters may
change, which wouldn't be taken into account by the
reset API callback and can cause a segmentation fault.

This issue is fixed by allocating the counters size after
the reinitialization.

Fixes: a4193ae3bc4f ("net/mlx5: support extended statistics")
Cc: stable@dpdk.org
Reported-by: Ralf Hoffmann <ralf.hoffmann@allegro-packets.com>
Signed-off-by: Shiri Kuzin <shirik@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
4 years agonet/mlx5: optimize counter extend memory
Suanming Mou [Tue, 20 Oct 2020 03:02:28 +0000 (11:02 +0800)]
net/mlx5: optimize counter extend memory

Counter extend memory was allocated for non-batch counter to save the
extra DevX object. Currently, for non-batch counter which does not
support aging, entry in the generic counter struct is used only when
counter is free in free list, and bytes in the struct is used only when
counter is allocated in using.

In this case, the DevX object can be saved to the generic counter struct
union with entry memory when counter is allocated and union with bytes
when counter is free.
And pool type is also not needed as non-fallback mode only has generic
counter and aging counter, just a bit to indicate the pool is aged or
not will be enough.

This eliminates the counter extend info struct saves the memory.

Signed-off-by: Suanming Mou <suanmingm@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
4 years agonet/mlx5: rename flow counter macro
Suanming Mou [Tue, 20 Oct 2020 03:02:27 +0000 (11:02 +0800)]
net/mlx5: rename flow counter macro

Add the MLX5_ prefix to the defined counter macro names.

Signed-off-by: Suanming Mou <suanmingm@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
4 years agonet/mlx5: make shared counters thread safe
Suanming Mou [Tue, 20 Oct 2020 03:02:26 +0000 (11:02 +0800)]
net/mlx5: make shared counters thread safe

The shared counters save the counter index to three level table. As
three level table supports multiple-thread operations now, the shared
counters can take advantage of the table to support multiple-thread.

Signed-off-by: Suanming Mou <suanmingm@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
4 years agonet/mlx5: make three level table thread safe
Suanming Mou [Tue, 20 Oct 2020 03:02:25 +0000 (11:02 +0800)]
net/mlx5: make three level table thread safe

This commit adds thread safety support in three level table using
spinlock and reference counter for each table entry.

An new mlx5_l3t_prepare_entry() function is added in order to support
multiple-thread operation.

Signed-off-by: Suanming Mou <suanmingm@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
4 years agonet/mlx5: synchronize flow counter pool creation
Suanming Mou [Tue, 20 Oct 2020 03:02:24 +0000 (11:02 +0800)]
net/mlx5: synchronize flow counter pool creation

Currently, counter operations are not thread safe as the counter
pools' array resize is not protected.

This commit protects the container pools' array resize using a spinlock.
The original counter pool statistic memory allocate is moved to the
host thread in order to minimize the critical section. Since that pool
statistic memory is required only in query time. The container pools'
array should be resized by the user threads, the new pool may be used
by other rte_flow APIs before the host thread resize is done, if the
pool is not saved to the pools' array, the specified counter memory will
not be found as the pool is not saved to the counter management pool
array. The pool raw statistic memory will be filled in host thread.

The shared counters will be protected in other commit.

Signed-off-by: Suanming Mou <suanmingm@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
4 years agonet/mlx5: remove single counter container
Suanming Mou [Tue, 20 Oct 2020 03:02:23 +0000 (11:02 +0800)]
net/mlx5: remove single counter container

A flow counter which was allocated by a batch API couldn't be assigned
to a flow in the root table (group 0) in old rdma-core version.
Hence, a root table flow counter required PMD mechanism to manage
counters which were allocated singly.

Currently, the batch counters have already been supported in root table
includes a new rdma-core version with MLX5_FLOW_ACTION_COUNTER_OFFSET
enum and with a kernel driver includes
MLX5_IB_ATTR_CREATE_FLOW_ARR_COUNTERS_DEVX_OFFSET enum.

When the PMD uses rdma-core API to assign a batch counter to a root
table flow using invalid counter offset, it should get an error only
if the batch counter assignment for root table is supported.
Using this trial in the initialization time can help to detect the
support.

Using the above trial, if the support is valid, remove the management of
single counter container in the fast counter mechanism. Otherwise, move
the counter mechanism to fallback mode.

Signed-off-by: Suanming Mou <suanmingm@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
4 years agonet/mlx5: optimize shared counter memory
Suanming Mou [Tue, 20 Oct 2020 03:02:22 +0000 (11:02 +0800)]
net/mlx5: optimize shared counter memory

Instead of using special memory to indicate shared counter, this patch
does the optimization to use the counter handler reserved memory to
indicate it.  The counter index with MLX5_CNT_SHARED_OFFSET means the
shared counter.

This patch is also an arrangement for a new adjustment to use batch
counter as shared counter.

Signed-off-by: Suanming Mou <suanmingm@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
4 years agonet/mlx5: locate aging pools in the general container
Suanming Mou [Tue, 20 Oct 2020 03:02:21 +0000 (11:02 +0800)]
net/mlx5: locate aging pools in the general container

Commit [1] introduced different container for the aging counter
pools. In order to save container memory the aging counter pools
can be located in the general pool container.

This patch locates the aging counter pools in the general pool
container. Remove the aging container management.

[1] commit fd143711a6ea ("net/mlx5: separate aging counter pool range")

Signed-off-by: Suanming Mou <suanmingm@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
4 years agonet/bnxt: fix xstats by id
Ferruh Yigit [Tue, 16 Jun 2020 15:36:13 +0000 (16:36 +0100)]
net/bnxt: fix xstats by id

The xstat by id device operation seems wrong, it fills 'xstats' struct
via 'bnxt_dev_xstats_get_op()' call, but the retrieved values are not
transferred to user input 'values' array.

ethdev layer 'rte_eth_xstats_get_by_id()' &
'rte_eth_xstats_get_names_by_id' already provides "by id" support when
device operations are missing.
It is good for PMD to provide these device operations if it has a more
performant way to get by id. But current implementation in PMD already
does same thing with the ethdev APIs, so removing them provides same
functionality.

Fixes: 88920136688c ("net/bnxt: support xstats get by id")
Cc: stable@dpdk.org
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
4 years agonet/bnxt: fix queue release
Somnath Kotur [Tue, 20 Oct 2020 04:11:18 +0000 (09:41 +0530)]
net/bnxt: fix queue release

Some of the ring related memory was not being freed in both the release
ops. Fix to free them now.
Add some more NULL ptr checks in the corresponding queue_release_mbufs()
and queue_release_op() respectively.
Also call queue_release_op() in the error path of the corresponding
queue_setup_op()

Fixes: 6133f207970c ("net/bnxt: add Rx queue create/destroy")
Fixes: 51c87ebafc7d ("net/bnxt: add Tx queue create/destroy")
Cc: stable@dpdk.org
Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
4 years agodoc: advertise flow API transfer rules support in sfc
Andrew Rybchenko [Tue, 20 Oct 2020 09:13:42 +0000 (10:13 +0100)]
doc: advertise flow API transfer rules support in sfc

Transfer rules support matching on various inner and outer packet
headers, traffic source items like PORT_ID, PHY_PORT, PF and VF and
actions to route traffic to destination (PORT_ID, PHY_PORT, PF, VF or
DROP), MARK, FLAG and apply VLAN push/pop transformations.

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
4 years agonet/sfc: support encap flow items in transfer rules
Ivan Malov [Tue, 20 Oct 2020 09:13:41 +0000 (10:13 +0100)]
net/sfc: support encap flow items in transfer rules

Add support for flow items VXLAN, Geneve and NVGRE to
MAE-specific RTE flow implementation.

Having support for these items implies the ability to insert
so-called outer MAE rules and refer to them in MAE action rules.
The patch takes care of all necessary facilities to do that.

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
4 years agocommon/sfc_efx/base: support outer rule provisioning
Ivan Malov [Tue, 20 Oct 2020 09:13:40 +0000 (10:13 +0100)]
common/sfc_efx/base: support outer rule provisioning

Let the client insert / remove outer rules.
Let the client refer to an inserted outer rule in a match
specification of type ACTION.

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
4 years agocommon/sfc_efx/base: validate and compare outer match specs
Ivan Malov [Tue, 20 Oct 2020 09:13:39 +0000 (10:13 +0100)]
common/sfc_efx/base: validate and compare outer match specs

Let the client validate an outer match specification.
Let the client comprare classes of two outer match specifications.

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
4 years agocommon/sfc_efx/base: add API to compare match specs
Ivan Malov [Tue, 20 Oct 2020 09:13:38 +0000 (10:13 +0100)]
common/sfc_efx/base: add API to compare match specs

Match specification format and its size are not exposed to clients.
Provide an API to compare two match specifications.

A client would typically use this API to compare a match specification
of an outer rule being validated with match specifications of already
active outer rules (to make sure that rule class is supported).

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
4 years agocommon/sfc_efx/base: add MAE match field VNET ID for tunnels
Ivan Malov [Tue, 20 Oct 2020 09:13:37 +0000 (10:13 +0100)]
common/sfc_efx/base: add MAE match field VNET ID for tunnels

Add MCDI-compatible enumeration for this field and
provide necessary mappings for it to be inserted
directly into mask-value pairs buffer.

VNET_ID can be used to serve the following match fields:
rte_flow_item_vxlan.vni, rte_flow_item_geneve.vni,
rte_flow_item_nvgre.tni

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
4 years agocommon/sfc_efx/base: add MAE encap match fields
Ivan Malov [Tue, 20 Oct 2020 09:13:36 +0000 (10:13 +0100)]
common/sfc_efx/base: add MAE encap match fields

Add MCDI-compatible enumeration for these fields and
provide necessary mappings for them to be inserted
directly into mask-value pairs buffer.

These fields are meant to comprise a so-called outer
match specification; provide necessary definitions.

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
4 years agocommon/sfc_efx/base: indicate MAE support for encapsulation
Ivan Malov [Tue, 20 Oct 2020 09:13:35 +0000 (10:13 +0100)]
common/sfc_efx/base: indicate MAE support for encapsulation

MAE provides support for encapsulation. One needs to insert
a so-called outer rule, which can match outer packet fields,
to require that matching packets be parsed as tunnel frames
of a given type (VXLAN, Geneve, NVGRE). Then it is possible
to chain this rule with an action rule in order to match on
inner fields and carry out some actions on matching packets.

Report to clients what encapsulation types are supported by
MAE. Indicate the number of priority levels for outer rules.

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
4 years agonet/sfc: support flow item UDP in transfer rules
Ivan Malov [Tue, 20 Oct 2020 09:13:34 +0000 (10:13 +0100)]
net/sfc: support flow item UDP in transfer rules

Add support for this flow item to MAE-specific RTE flow implementation.

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
4 years agonet/sfc: support flow item TCP in transfer rules
Ivan Malov [Tue, 20 Oct 2020 09:13:33 +0000 (10:13 +0100)]
net/sfc: support flow item TCP in transfer rules

Add support for this flow item to MAE-specific RTE flow implementation.

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
4 years agocommon/sfc_efx/base: add MAE match fields for TCP and UDP
Ivan Malov [Tue, 20 Oct 2020 09:13:32 +0000 (10:13 +0100)]
common/sfc_efx/base: add MAE match fields for TCP and UDP

Add MCDI-compatible enumeration for these fields and
provide necessary mappings for them to be inserted
directly into mask-value pairs buffer.

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
4 years agonet/sfc: support flow item IPv6 in transfer rules
Ivan Malov [Tue, 20 Oct 2020 09:13:31 +0000 (10:13 +0100)]
net/sfc: support flow item IPv6 in transfer rules

Add support for this flow item to MAE-specific RTE flow implementation.

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
4 years agocommon/sfc_efx/base: add MAE match fields for IPv6
Ivan Malov [Tue, 20 Oct 2020 09:13:30 +0000 (10:13 +0100)]
common/sfc_efx/base: add MAE match fields for IPv6

Add MCDI-compatible enumeration for these fields and
provide necessary mappings for them to be inserted
directly into mask-value pairs buffer.

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
4 years agonet/sfc: support flow item IPv4 in transfer rules
Ivan Malov [Tue, 20 Oct 2020 09:13:29 +0000 (10:13 +0100)]
net/sfc: support flow item IPv4 in transfer rules

Add support for this flow item to MAE-specific RTE flow implementation.

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
4 years agocommon/sfc_efx/base: add MAE match fields for IPv4
Ivan Malov [Tue, 20 Oct 2020 09:13:28 +0000 (10:13 +0100)]
common/sfc_efx/base: add MAE match fields for IPv4

Add MCDI-compatible enumeration for these fields and
provide necessary mappings for them to be inserted
directly into mask-value pairs buffer.

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
4 years agonet/sfc: support flow item VLAN in transfer rules
Ivan Malov [Tue, 20 Oct 2020 09:13:27 +0000 (10:13 +0100)]
net/sfc: support flow item VLAN in transfer rules

Add support for this flow item to MAE-specific RTE flow implementation.

In a pattern, a L2 item preceding an item VLAN must have
correct "type" ("inner_type") set depending on the total
number of VLAN tags (double-tagging is supported):

"pattern eth type is X / vlan / end",
X = 0x8100, or 0x88a8, or 0x9100, or 0x9200, or 0x9300

"pattern eth type is X / vlan inner_type is 0x8100 / vlan / end"
X = 0x88a8, or 0x9100, or 0x9200, or 0x9300

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
4 years agocommon/sfc_efx/base: add MAE match fields for VLAN
Ivan Malov [Tue, 20 Oct 2020 09:13:26 +0000 (10:13 +0100)]
common/sfc_efx/base: add MAE match fields for VLAN

Add MCDI-compatible enumeration for these fields and
provide necessary mappings for them to be inserted
directly into mask-value pairs buffer.

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
4 years agonet/sfc: support flow item port ID in transfer rules
Ivan Malov [Tue, 20 Oct 2020 09:13:25 +0000 (10:13 +0100)]
net/sfc: support flow item port ID in transfer rules

Add support for this flow item to MAE-specific RTE flow implementation.

The DPDK port must not relate to a different physical device.

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
4 years agonet/sfc: support flow action port ID in transfer rules
Ivan Malov [Tue, 20 Oct 2020 09:13:24 +0000 (10:13 +0100)]
net/sfc: support flow action port ID in transfer rules

The action handler will use MAE action DELIVER with MPORT
of the PCIe function associated with a given DPDK port ID.
The DPDK port must not relate to a different physical device.

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
4 years agonet/sfc: support concept of switch domains/ports
Ivan Malov [Tue, 20 Oct 2020 09:13:23 +0000 (10:13 +0100)]
net/sfc: support concept of switch domains/ports

A later patch will add support for RTE flow action PORT_ID
to MAE backend. The driver has to ensure that such actions
refer to RTE ethdev instances deployed on top of the same
physical device. Also, the driver needs a means to find
sibling RTE ethdev instances when parsing such actions.

In order to solve these problems, add a switch infrastructure
which allocates switch domains based on persistence of device
serial number string across switch ports included in a domain.
Explain mapping between RTE switch port IDs and MAE endpoints.

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
4 years agonet/sfc: add HW switch ID helpers
Ivan Malov [Tue, 20 Oct 2020 09:13:22 +0000 (10:13 +0100)]
net/sfc: add HW switch ID helpers

The driver will need a means to figure out relationship between
RTE ethdev instances and underlying HW switch entities. For now,
use board serial number string as a unique HW switch identifier.

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
4 years agocommon/sfc_efx/base: add API for querying board info
Ivan Malov [Tue, 20 Oct 2020 09:13:21 +0000 (10:13 +0100)]
common/sfc_efx/base: add API for querying board info

Riverhead boards can provide extended version information.
Implement facilities necessary to obtain it.
Add an API for querying board information.

A client driver may use this to discover which of its instances
relate to which physical boards, based on board serial number
persistence for a given physical board.

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
4 years agocommon/sfc_efx/base: refactor version / boot info get helper
Ivan Malov [Tue, 20 Oct 2020 09:13:20 +0000 (10:13 +0100)]
common/sfc_efx/base: refactor version / boot info get helper

Refactor MCDI helper for version information and boot status
retrieval; it should comprise two dedicated helper functions.

A later patch will extend and reuse version retrieval helper.

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
4 years agonet/sfc: support flow action drop in transfer rules
Ivan Malov [Tue, 20 Oct 2020 09:13:19 +0000 (10:13 +0100)]
net/sfc: support flow action drop in transfer rules

Effectively, the resulting action will be of type DELIVER, and
destination MPORT will be a properly constructed NULL value.
This will achieve the requested behaviour (no delivery).

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
4 years agocommon/sfc_efx/base: add API for adding action drop
Ivan Malov [Tue, 20 Oct 2020 09:13:18 +0000 (10:13 +0100)]
common/sfc_efx/base: add API for adding action drop

Client drivers may need to request that matching traffic be dropped.
Add a dedicated API to support this. The API relies on action
DELIVER with properly constructed NULL MPORT argument.

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
4 years agonet/sfc: support flow actions PF and VF in transfer rules
Ivan Malov [Tue, 20 Oct 2020 09:13:17 +0000 (10:13 +0100)]
net/sfc: support flow actions PF and VF in transfer rules

The action handler will use MAE action DELIVER with MPORT of the PF/VF.

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
4 years agonet/sfc: support flow items PF and VF in transfer rules
Ivan Malov [Tue, 20 Oct 2020 09:13:16 +0000 (10:13 +0100)]
net/sfc: support flow items PF and VF in transfer rules

Add support for these flow items to MAE-specific RTE flow implementation.

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
4 years agocommon/sfc_efx/base: add API to get mport of PF/VF
Ivan Malov [Tue, 20 Oct 2020 09:13:15 +0000 (10:13 +0100)]
common/sfc_efx/base: add API to get mport of PF/VF

PCIe functions have static MPORTs which can be utilised by
MAE rules as delivery destinations for matching traffic.

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
4 years agocommon/sfc_efx/base: add named constant for invalid VF
Ivan Malov [Tue, 20 Oct 2020 09:13:14 +0000 (10:13 +0100)]
common/sfc_efx/base: add named constant for invalid VF

This makes existing code clearer. Also, it will be used by a later patch.

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
4 years agonet/sfc: support flow action mark in MAE backend
Ivan Malov [Tue, 20 Oct 2020 09:13:13 +0000 (10:13 +0100)]
net/sfc: support flow action mark in MAE backend

The action handler will use MAE action MARK.

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
4 years agocommon/sfc_efx/base: support adding mark action to set
Ivan Malov [Tue, 20 Oct 2020 09:13:12 +0000 (10:13 +0100)]
common/sfc_efx/base: support adding mark action to set

This action can be added at any point before DELIVER.

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
4 years agonet/sfc: support flow action flag in MAE backend
Ivan Malov [Tue, 20 Oct 2020 09:13:11 +0000 (10:13 +0100)]
net/sfc: support flow action flag in MAE backend

The action handler will use MAE action FLAG.

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
4 years agocommon/sfc_efx/base: support adding flag action to set
Ivan Malov [Tue, 20 Oct 2020 09:13:10 +0000 (10:13 +0100)]
common/sfc_efx/base: support adding flag action to set

This action can be added at any point before DELIVER.

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
4 years agonet/sfc: support VLAN push actions in MAE backend
Ivan Malov [Tue, 20 Oct 2020 09:13:09 +0000 (10:13 +0100)]
net/sfc: support VLAN push actions in MAE backend

A group of actions (OF_PUSH_VLAN, OF_VLAN_SET_VID and
OF_VLAN_SET_PCP) maps to MAE action VLAN_PUSH.

This action group is supported only for rules which have transfer
attribute, and can be requested once or twice per a rule.

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
4 years agonet/sfc: add facilities to handle bundles of actions
Ivan Malov [Tue, 20 Oct 2020 09:13:08 +0000 (10:13 +0100)]
net/sfc: add facilities to handle bundles of actions

There are MAE actions which do not have uniform counterparts
in terms of RTE flow. However, there are bundles of RTE flow
actions which can be considered as such counterparts.

Implement facilities to handle related RTE flow actions as
parts of a whole. These facilities will be used by a later
patch to add support for VLAN PUSH actions bundle.

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
4 years agocommon/sfc_efx/base: support adding VLAN push action
Ivan Malov [Tue, 20 Oct 2020 09:13:07 +0000 (10:13 +0100)]
common/sfc_efx/base: support adding VLAN push action

MAE supports pushing two tags, so this action can
be requested once or twice.

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
4 years agonet/sfc: support flow action OF pop VLAN in MAE backend
Ivan Malov [Tue, 20 Oct 2020 09:13:06 +0000 (10:13 +0100)]
net/sfc: support flow action OF pop VLAN in MAE backend

This action is supported only for rules which have transfer attribute,
and can be requested once or twice per a rule.

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
4 years agocommon/sfc_efx/base: support adding VLAN pop action to set
Ivan Malov [Tue, 20 Oct 2020 09:13:05 +0000 (10:13 +0100)]
common/sfc_efx/base: support adding VLAN pop action to set

MAE supports stripping two tags, so this action can
be requested once or twice.

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
4 years agonet/sfc: implement flow insert/remove in MAE backend
Ivan Malov [Tue, 20 Oct 2020 09:13:04 +0000 (10:13 +0100)]
net/sfc: implement flow insert/remove in MAE backend

Exercise action set allocation / release and action rule
insertion / removal in order to let flow API callers
actually get created flows functioning.

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
4 years agocommon/sfc_efx/base: add MAE action rule provisioning APIs
Ivan Malov [Tue, 20 Oct 2020 09:13:03 +0000 (10:13 +0100)]
common/sfc_efx/base: add MAE action rule provisioning APIs

Add APIs for action rule insert / remove operations.

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
4 years agocommon/sfc_efx/base: add MAE action set provisioning APIs
Ivan Malov [Tue, 20 Oct 2020 09:13:02 +0000 (10:13 +0100)]
common/sfc_efx/base: add MAE action set provisioning APIs

The patch adds APIs for action set allocation / release.

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
4 years agonet/sfc: support flow action PHY port in MAE backend
Ivan Malov [Tue, 20 Oct 2020 09:13:01 +0000 (10:13 +0100)]
net/sfc: support flow action PHY port in MAE backend

The action handler will use MAE action DELIVER with
MPORT of a given physical port.

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
4 years agocommon/sfc_efx/base: support adding deliver action to set
Ivan Malov [Tue, 20 Oct 2020 09:13:00 +0000 (10:13 +0100)]
common/sfc_efx/base: support adding deliver action to set

Introduce a mechanism for adding actions to an action set and
add support for DELIVER action.

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
4 years agonet/sfc: support flow item eth in MAE backend
Ivan Malov [Tue, 20 Oct 2020 09:12:59 +0000 (10:12 +0100)]
net/sfc: support flow item eth in MAE backend

Add support for this flow item to MAE-specific RTE flow implementation.

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
4 years agocommon/sfc_efx/base: add MAE match fields for Ethernet
Ivan Malov [Tue, 20 Oct 2020 09:12:58 +0000 (10:12 +0100)]
common/sfc_efx/base: add MAE match fields for Ethernet

Add MCDI-compatible enumeration for these fields and
provide necessary mappings for them to be inserted
directly into mask-value pairs buffer.

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
4 years agonet/sfc: support flow item PHY PORT in MAE backend
Ivan Malov [Tue, 20 Oct 2020 09:12:57 +0000 (10:12 +0100)]
net/sfc: support flow item PHY PORT in MAE backend

Add support for this flow item to MAE-specific RTE flow implementation.

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
4 years agocommon/sfc_efx/base: support setting PPORT in match spec
Ivan Malov [Tue, 20 Oct 2020 09:12:56 +0000 (10:12 +0100)]
common/sfc_efx/base: support setting PPORT in match spec

Add an API for setting mask-value pairs in a match specification
structure and add support for MAE field INGRESS_PORT of type PPORT.

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
4 years agonet/sfc: add actions parsing stub to MAE backend
Ivan Malov [Tue, 20 Oct 2020 09:12:55 +0000 (10:12 +0100)]
net/sfc: add actions parsing stub to MAE backend

If parsing a flow results in an action set specification
identical to an already existing one, duplication will
be avoided by reusing the list entry of the latter.
Using an attach helper and a reference counter
is meant to serve the said purpose.

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
4 years agocommon/sfc_efx/base: add action set spec init/fini APIs
Ivan Malov [Tue, 20 Oct 2020 09:12:54 +0000 (10:12 +0100)]
common/sfc_efx/base: add action set spec init/fini APIs

The engine is only able to carry out chosen actions on matching packets in
a strict order. No MCDI exists to identify supported actions and the order.
Still, the definition of the latter is available from the FW documentation.

The general idea is to define an action specification structure and supply
a client driver with APIs for adding actions individually, order-dependent.
A client driver is supposed to invoke an API on every action passed by the
application, and if an out-of-order action follows, the API will reject it.

Add an action set specification stub and supply initialise / finalise APIs.

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
4 years agonet/sfc: add verify method to flow validate path
Ivan Malov [Tue, 20 Oct 2020 09:12:53 +0000 (10:12 +0100)]
net/sfc: add verify method to flow validate path

The new method is needed to make sure that a flow being
validated will have a chance to be accepted by the FW.
MAE-specific implementation of the method should
compare the class of a rule being validated with
the corresponding classes of active rules, and,
if no matches found, make a request to the FW.
Support for the latter will be added in future.

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
4 years agocommon/sfc_efx/base: add match specs class comparison API
Ivan Malov [Tue, 20 Oct 2020 09:12:52 +0000 (10:12 +0100)]
common/sfc_efx/base: add match specs class comparison API

From MAE standpoint, a flow rule belongs to some class. Field capabilities
advertised by the FW provide a hint on whether changing a particular match
field value or its mask will affect the class of the rule. A client driver
can make use of the concept of a class by comparing a rule being validated
with already inserted ones so that if an existing rule with the same class
is encountered, it will become possible to skip making an explicit request
to the FW because the class of an already inserted rule is wittingly valid.

Implement an API for client drivers to carry out the said class comparison.

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
4 years agonet/sfc: validate match spec in MAE backend
Ivan Malov [Tue, 20 Oct 2020 09:12:51 +0000 (10:12 +0100)]
net/sfc: validate match spec in MAE backend

Validate the match specification resulting from pattern
parsing within MAE backend in RTE flow implementation.

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
4 years agocommon/sfc_efx/base: add match spec validate API
Ivan Malov [Tue, 20 Oct 2020 09:12:50 +0000 (10:12 +0100)]
common/sfc_efx/base: add match spec validate API

MAE has restrictions on what kind of mask a particular field can have in
a match specification. Add an API for client drivers to check
specifications.

The patch defines a field description list, whilst the list itself is
left empty. This is to provide a general idea of how field properties
will be used to validate a match specification. Particular fields
will be added to the list by follow-up patches.

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
4 years agonet/sfc: add pattern parsing stub to MAE backend
Ivan Malov [Tue, 20 Oct 2020 09:12:49 +0000 (10:12 +0100)]
net/sfc: add pattern parsing stub to MAE backend

Add pattern parsing stub, define and implement flow cleanup method.
The latter is needed to free any dynamic structures allocated
during flow parsing.

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
4 years agocommon/sfc_efx/base: add match spec init/fini APIs
Ivan Malov [Tue, 20 Oct 2020 09:12:48 +0000 (10:12 +0100)]
common/sfc_efx/base: add match spec init/fini APIs

An MAE rule is a function of match criteria and a priority. The said match
criteria have to be provided using "mask-value pairs" packing format which
on its own should not be exposed to client drivers. The latter have to use
a functional interface of sorts in order to generate a match specification.

Define an EFX match specification and implement initialise / finalise APIs.
The "mask-value pairs" buffer itself is not used in this particular patch,
so the corresponding struct member will be added in the follow-up patch.

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
4 years agonet/sfc: add concept of MAE (transfer) rules
Ivan Malov [Tue, 20 Oct 2020 09:12:47 +0000 (10:12 +0100)]
net/sfc: add concept of MAE (transfer) rules

Define the corresponding specification structure and
make the code identify MAE rules by testing transfer
attribute presence. Also, add a priority level check.

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
4 years agocommon/sfc_efx/base: add MAE limit query API
Ivan Malov [Tue, 20 Oct 2020 09:12:46 +0000 (10:12 +0100)]
common/sfc_efx/base: add MAE limit query API

Add an API for client drivers to query the engine limits.

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
4 years agodrivers: init/fini MAE on attach/detach
Ivan Malov [Tue, 20 Oct 2020 09:12:45 +0000 (10:12 +0100)]
drivers: init/fini MAE on attach/detach

These actions affect MAE supplementary resources which are
libefx-internal.

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
4 years agocommon/sfc_efx/base: add MAE init/fini APIs
Ivan Malov [Tue, 20 Oct 2020 09:12:44 +0000 (10:12 +0100)]
common/sfc_efx/base: add MAE init/fini APIs

The patch adds APIs for client drivers to initialise / finalise
MAE-specific context in NIC control structure. The context
itself will be used by the follow-up patches to store
supportive data for library-internal consumers.

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
4 years agonet/sfc: add stub for attaching to MAE
Ivan Malov [Tue, 20 Oct 2020 09:12:43 +0000 (10:12 +0100)]
net/sfc: add stub for attaching to MAE

Add a stub for MAE attach / detach path and introduce MAE-specific
context.

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
4 years agocommon/sfc_efx/base: indicate support for MAE
Ivan Malov [Tue, 20 Oct 2020 09:12:42 +0000 (10:12 +0100)]
common/sfc_efx/base: indicate support for MAE

Riverhead boards maintain support for MAE, a low-level Match-Action
Engine.
The feature is documented in SF-122526-TC.

The new field will help client drivers to test NIC support for MAE
status.

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
4 years agocommon/sfc_efx/base: add MAE definitions to MCDI
Andrew Rybchenko [Tue, 20 Oct 2020 09:12:41 +0000 (10:12 +0100)]
common/sfc_efx/base: add MAE definitions to MCDI

MAE stands for Match-Action-Engine and will be used to
support rte_flow API transfer rules.

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
4 years agoapp/testpmd: fix bonding xmit balance policy command
Min Hu (Connor) [Tue, 20 Oct 2020 03:04:16 +0000 (11:04 +0800)]
app/testpmd: fix bonding xmit balance policy command

Currently there exists inconsistency about name of transmission
policy for a Link Bonding device. "xmit_balance_policy" is not
correct, which should be modified to "balance_xmit_policy".

Fixes: 2950a769315e ("bond: testpmd support")
Fixes: ac718398f477 ("doc: testpmd application user guide")
Cc: stable@dpdk.org
Signed-off-by: Min Hu (Connor) <humin29@huawei.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agonet/softnic: fix out-of-bound access
Savinay Dharmappa [Mon, 19 Oct 2020 11:52:16 +0000 (12:52 +0100)]
net/softnic: fix out-of-bound access

This patch fixes out of bound access of an array.

Coverity issue: 363466, 363459
Fixes: b5dfa6703d49 ("net/softnic: update subport rate dynamically")
Cc: stable@dpdk.org
Signed-off-by: Savinay Dharmappa <savinay.dharmappa@intel.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
4 years agonet/ice: support ACL filter in DCF
Simei Su [Tue, 20 Oct 2020 11:32:42 +0000 (19:32 +0800)]
net/ice: support ACL filter in DCF

Add ice_acl_create_filter to create a rule and ice_acl_destroy_filter
to destroy a rule. If a flow is matched by ACL filter, filter rule
will be set to HW. Currently IPV4/IPV4_UDP/IPV4_TCP/IPV4_SCTP pattern
and drop action are supported.

Signed-off-by: Simei Su <simei.su@intel.com>
Signed-off-by: Xuan Ding <xuan.ding@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
4 years agonet/ice: get PF VSI map
Simei Su [Tue, 20 Oct 2020 11:32:41 +0000 (19:32 +0800)]
net/ice: get PF VSI map

This patch gets PF vsi number when issuing ACL rule in DCF.

Signed-off-by: Simei Su <simei.su@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
4 years agonet/iavf: fix unchecked Tx cleanup error
Leyi Rong [Mon, 19 Oct 2020 05:42:53 +0000 (13:42 +0800)]
net/iavf: fix unchecked Tx cleanup error

Coverity complains of unchecked return value warning of
iavf_xmit_cleanup, while this cleanup is opportunistic and will not cause
problems if it fails. So instead of checking the return value of
iavf_xmit_cleanup and return in case of cleanup failure, we directly cast
it to void function to make the Coverity happy.

Coverity issue: 363045
Fixes: 02d212ca3125 ("net/iavf: rename remaining avf strings")
Cc: stable@dpdk.org
Signed-off-by: Leyi Rong <leyi.rong@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
4 years agonet/ice: fix SCTP RSS configuration
Junyu Jiang [Tue, 20 Oct 2020 08:50:51 +0000 (08:50 +0000)]
net/ice: fix SCTP RSS configuration

This patch configured RSS for sctp with IP address
and port as input set.

Fixes: 4717a12cfaf1 ("net/ice: initialize and update RSS based on user config")
Cc: stable@dpdk.org
Signed-off-by: Junyu Jiang <junyux.jiang@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
4 years agonet/ice/base: fix bitmap set function
Simei Su [Tue, 20 Oct 2020 08:46:39 +0000 (16:46 +0800)]
net/ice/base: fix bitmap set function

This patch corrects an upper limit value in for loop.

Fixes: dd4a3cef556a ("net/ice/base: introduce and use bitmap set API")
Cc: stable@dpdk.org
Signed-off-by: Simei Su <simei.su@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
4 years agonet/iavf: fix adding multicast MAC address
Guinan Sun [Thu, 15 Oct 2020 08:43:05 +0000 (08:43 +0000)]
net/iavf: fix adding multicast MAC address

When the multicast address list is added, it will flush
previous addresses first, and then add new ones.
If the number of multicast address in the list exceeds
the upper limit, it will cause failure, then need to
roll back previous addresses. This patch fixes the issue.

Fixes: 05e4c3aff35f ("net/iavf: support multicast configuration")
Cc: stable@dpdk.org
Signed-off-by: Guinan Sun <guinanx.sun@intel.com>
Tested-by: Yuan Peng <yuan.peng@intel.com>
Acked-by: Beilei Xing <beilei.xing@intel.com>
4 years agonet/mlx5: support query of age action
Dekel Peled [Mon, 19 Oct 2020 13:52:50 +0000 (16:52 +0300)]
net/mlx5: support query of age action

Recent patch [1] adds to ethdev the API for query of age action.
This patch implements in MLX5 PMD the query of age action using
this API.

[1] https://mails.dpdk.org/archives/dev/2020-October/184864.html

Signed-off-by: Dekel Peled <dekelp@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
4 years agonet/mlx5: log LRO minimal size
Dekel Peled [Thu, 15 Oct 2020 13:37:09 +0000 (16:37 +0300)]
net/mlx5: log LRO minimal size

Add debug printout showing HCA capability lro_min_mss_size - the
minimal size of TCP segment required for coalescing.
MLX5 PMD documentation is updated to note this condition.

Signed-off-by: Dekel Peled <dekelp@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
4 years agonet/mlx5: fix use of atomic cmpset for age state
Dekel Peled [Thu, 15 Oct 2020 11:44:24 +0000 (14:44 +0300)]
net/mlx5: fix use of atomic cmpset for age state

According to documentation [1], function rte_atomic16_cmpset()
return value is non-zero on success; 0 on failure.
In existing code this function is called, and the return value
is compared to AGE_CANDIDATE, which is defined as 1.
Such comparison is incorrect and can lead to unwanted behavior.

This patch updates the calls to rte_atomic16_cmpset(), to check
that the return value is 0 or non-zero.

[1] https://doc.dpdk.org/api/rte__atomic_8h.html

Fixes: fa2d01c87d2b ("net/mlx5: support flow aging")
Cc: stable@dpdk.org
Signed-off-by: Dekel Peled <dekelp@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
4 years agonet/mlx5: enforce limitation on IPv6 next protocol
Dekel Peled [Thu, 15 Oct 2020 14:05:57 +0000 (17:05 +0300)]
net/mlx5: enforce limitation on IPv6 next protocol

Due to PRM requirement, the IPv6 header item 'proto' field, indicating
the next header protocol, should not be set as extension header.
This patch adds the relevant validation, and documents the limitation.

Signed-off-by: Dekel Peled <dekelp@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
4 years agonet/mlx5: support match on IPv6 fragment extension
Dekel Peled [Thu, 15 Oct 2020 14:05:56 +0000 (17:05 +0300)]
net/mlx5: support match on IPv6 fragment extension

rte_flow update, following RFC [1], added to ethdev the rte_flow item
ipv6_frag_ext.
This patch adds to MLX5 PMD the option to match on this item type.

[1] http://mails.dpdk.org/archives/dev/2020-March/160255.html

Signed-off-by: Dekel Peled <dekelp@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
4 years agonet/mlx5: support match on IPv6 fragment packets
Dekel Peled [Thu, 15 Oct 2020 14:05:55 +0000 (17:05 +0300)]
net/mlx5: support match on IPv6 fragment packets

This patch adds to MLX5 PMD the support of matching on IPv6
fragmented and non-fragmented packets, using the new field
has_frag_ext, added to rte_flow following RFC [1].

[1] https://mails.dpdk.org/archives/dev/2020-August/177257.html

Signed-off-by: Dekel Peled <dekelp@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
4 years agonet/mlx5: support match on IPv4 fragment packets
Dekel Peled [Thu, 15 Oct 2020 14:05:54 +0000 (17:05 +0300)]
net/mlx5: support match on IPv4 fragment packets

This patch adds to MLX5 PMD the support of matching on IPv4
fragmented and non-fragmented packets, using the IPv4 header
fragment_offset field.

Signed-off-by: Dekel Peled <dekelp@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
4 years agonet/mlx5: remove handling of ICMP fragmented packets
Dekel Peled [Thu, 15 Oct 2020 14:05:53 +0000 (17:05 +0300)]
net/mlx5: remove handling of ICMP fragmented packets

Commit [1] forced setting of match on 'frag' bit mask 1 and value 0.
Previous patch in this series added support of match on fragmented and
non-fragmented packets on L3 items, so this setting is now redundant.

This patch removes the changes done in [1].

[1] commit 85407db9f60d ("net/mlx5: fix matching for ICMP fragments")

Signed-off-by: Dekel Peled <dekelp@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
4 years agonet/mlx5/linux: fix Tx queue operations decision
Matan Azrad [Thu, 15 Oct 2020 06:38:13 +0000 (06:38 +0000)]
net/mlx5/linux: fix Tx queue operations decision

One of the conditions to create Tx queue object by DevX is to be sure
that the DPDK mlx5 driver is not going to be the E-Switch manager of
the device. The issue is with the default FDB flows managed by the
kernel driver, which are not created by the kernel when the Tx queues
are created by DevX.

The current decision is to create the Tx queues by Verbs when E-Switch
is enabled while the current behavior uses an opposite condition to
create them by DevX.

Create the Tx queues by Verbs when E-Switch is enabled.

Fixes: 86d259cec852 ("net/mlx5: separate Tx queue object creations")

Signed-off-by: Matan Azrad <matan@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
4 years agonet/mlx5: fix event queue number query
Matan Azrad [Thu, 15 Oct 2020 06:38:12 +0000 (06:38 +0000)]
net/mlx5: fix event queue number query

When a Rx\Tx queue is created by DevX, its CQ configuration should
include the EQ number of the interrupts.
The EQ is managed by the kernel and there is a glue API in order to
query the EQ number from the kernel.
The EQ query API gets a vector number specifies the kernel vector of
the interrupt handling.

The vector number was wrongly detected according to the configuration
CPU instead of using the device attributes of the supported vectors.
The CPU was wrongly detected by the rte_lcore_to_cpu_id API without any
check, and in case of non-EAL thread context the value was 0xFFFFFFFF
which caused a failure in the EQ number query API.

Use vector 0 for each EQ number query which must be supported by the
kernel.

Fixes: 08d1838f645a ("net/mlx5: implement CQ for Rx using DevX API")
Fixes: d133f4cdb706 ("net/mlx5: create clock queue for packet pacing")
Cc: stable@dpdk.org
Signed-off-by: Matan Azrad <matan@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
4 years agonet/mlx5: fix Tx queue release
Matan Azrad [Thu, 15 Oct 2020 06:38:11 +0000 (06:38 +0000)]
net/mlx5: fix Tx queue release

The HW objects of the Tx queue is created/destroyed in the device
start\stop stage while the ethdev configurations for the Tx queue
starts from the tx_queue_setup stage.
The PMD should save all the last configurations it got from the ethdev
and to apply them to the device in the dev_start operation.

Wrongly, last code added to mitigate the reference counters didn't take
into account the above rule and combined the configurations and HW
objects to be created\destroyed together.

This causes to memory leak and other memory issues.

Make sure the HW object is released in stop operation when there is no
any reference to it while the configurations stay saved.

Fixes: 17a57183c0eb ("net/mlx5: mitigate Tx queue reference counters")

Signed-off-by: Matan Azrad <matan@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
4 years agonet/mlx5: fix Rx queue release
Matan Azrad [Thu, 15 Oct 2020 06:38:10 +0000 (06:38 +0000)]
net/mlx5: fix Rx queue release

The HW objects of the Rx queue is created/destroyed in the device
start\stop stage while the ethdev configurations for the Rx queue
starts from the rx_queue_setup stage.
The PMD should save all the last configurations it got from the ethdev
and to apply them to the device in the dev_start operation.

Wrongly, last code added to mitigate the reference counters didn't take
into account the above rule and combined the configurations and HW
objects to be created\destroyed together.

This causes to memory leak and other memory issues.

Make sure the HW object is released in stop operation when there is no
any reference to it while the configurations stay saved.

Fixes: 24e4b650badc ("net/mlx5: mitigate Rx queue reference counters")

Signed-off-by: Matan Azrad <matan@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
4 years agometrics: fix memory leak on allocation failure
Ciara Power [Thu, 17 Sep 2020 15:03:41 +0000 (16:03 +0100)]
metrics: fix memory leak on allocation failure

If an error occurred when allocating memory for metrics or names,
the function returned without freeing allocated memory. This is now
fixed to avoid the resource leak in the case that either metrics or
names had been successfully allocated memory.

Coverity issue: 362053
Fixes: c5b7197f662e ("telemetry: move some functions to metrics library")
Cc: stable@dpdk.org
Reported-by: Gaurav Singh <gaurav1086@gmail.com>
Signed-off-by: Ciara Power <ciara.power@intel.com>
Acked-by: John McNamara <john.mcnamara@intel.com>