dpdk.git
2 years agonet/cnxk: support to validate meter policy
Sunil Kumar Kori [Tue, 12 Oct 2021 07:06:03 +0000 (12:36 +0530)]
net/cnxk: support to validate meter policy

Implement API to validate meter policy for CNXK platform.

Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
Signed-off-by: Rakesh Kudurumalla <rkudurumalla@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
2 years agonet/cnxk: support to delete meter profile
Sunil Kumar Kori [Tue, 12 Oct 2021 07:06:02 +0000 (12:36 +0530)]
net/cnxk: support to delete meter profile

Implement API to delete meter profile for CNXK platform.

Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
Signed-off-by: Rakesh Kudurumalla <rkudurumalla@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
2 years agonet/cnxk: support to create meter profile
Sunil Kumar Kori [Tue, 12 Oct 2021 07:06:01 +0000 (12:36 +0530)]
net/cnxk: support to create meter profile

Implement API to add meter profile for CNXK platform.

Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
Signed-off-by: Rakesh Kudurumalla <rkudurumalla@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
2 years agonet/cnxk: support to get meter capabilities
Sunil Kumar Kori [Tue, 12 Oct 2021 07:06:00 +0000 (12:36 +0530)]
net/cnxk: support to get meter capabilities

Implement ethdev operation to get meter capabilities for
CNXK platform.

Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
Signed-off-by: Rakesh Kudurumalla <rkudurumalla@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
2 years agonet/cnxk: support meter ops get
Sunil Kumar Kori [Tue, 12 Oct 2021 07:05:59 +0000 (12:35 +0530)]
net/cnxk: support meter ops get

To enable support for ingress meter, supported operations
are exposed for CNXK platform.

Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
Signed-off-by: Rakesh Kudurumalla <rkudurumalla@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
2 years agocommon/cnxk: support meter in action list
Sunil Kumar Kori [Tue, 12 Oct 2021 07:05:58 +0000 (12:35 +0530)]
common/cnxk: support meter in action list

Meter action is added in supported action list.

Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
2 years agocommon/cnxk: support profile stats reset
Sunil Kumar Kori [Tue, 12 Oct 2021 07:05:57 +0000 (12:35 +0530)]
common/cnxk: support profile stats reset

Implement RoC API to reset stats per bandwidth profile
or per NIXLF.

Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
2 years agocommon/cnxk: support profile statistics
Sunil Kumar Kori [Tue, 12 Oct 2021 07:05:56 +0000 (12:35 +0530)]
common/cnxk: support profile statistics

CN10K platform provides statistics per bandwidth profile and
per nixlf. Implement RoC API to read stats for given bandwidth
profile.

Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
2 years agocommon/cnxk: support bandwidth profile stats to index
Sunil Kumar Kori [Tue, 12 Oct 2021 07:05:55 +0000 (12:35 +0530)]
common/cnxk: support bandwidth profile stats to index

CN10K platform supports different stats for HW bandwidth profiles.
Implement RoC API to get index for given stats type.

Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
2 years agocommon/cnxk: support bandwidth profiles connection
Sunil Kumar Kori [Tue, 12 Oct 2021 07:05:54 +0000 (12:35 +0530)]
common/cnxk: support bandwidth profiles connection

To maintain chain of bandwidth profiles, they needs to be
connected. Implement RoC API to connect two bandwidth profiles
at different levels.

Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
2 years agocommon/cnxk: support precolor table setup
Sunil Kumar Kori [Tue, 12 Oct 2021 07:05:53 +0000 (12:35 +0530)]
common/cnxk: support precolor table setup

For initial coloring of input packet, CN10K platform maintains
precolor table for VLAN, DSCP and Generic. Implement RoC
interface to setup pre color table.

Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
2 years agocommon/cnxk: support bandwidth profile dump
Sunil Kumar Kori [Tue, 12 Oct 2021 07:05:52 +0000 (12:35 +0530)]
common/cnxk: support bandwidth profile dump

Implement RoC API to dump bandwidth profile on CN10K
platform.

Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
2 years agocommon/cnxk: support profile state toggle
Sunil Kumar Kori [Tue, 12 Oct 2021 07:05:51 +0000 (12:35 +0530)]
common/cnxk: support profile state toggle

Implement RoC API to enable or disable HW bandwidth profiles
on CN10K platform.

Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
2 years agocommon/cnxk: support bandwidth profile configure
Sunil Kumar Kori [Tue, 12 Oct 2021 07:05:50 +0000 (12:35 +0530)]
common/cnxk: support bandwidth profile configure

Implement RoC API to configure HW bandwidth profile for
CN10K platform.

Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
2 years agocommon/cnxk: support bandwidth profiles free
Sunil Kumar Kori [Tue, 12 Oct 2021 07:05:49 +0000 (12:35 +0530)]
common/cnxk: support bandwidth profiles free

Implement RoC interface to free HW bandwidth profiles on
CN10K platform.

Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
2 years agocommon/cnxk: support bandwidth profiles allocation
Sunil Kumar Kori [Tue, 12 Oct 2021 07:05:48 +0000 (12:35 +0530)]
common/cnxk: support bandwidth profiles allocation

Implement RoC API to allocate HW resources i.e. bandwidth
profiles for policer processing on CN10K platform.

Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
2 years agocommon/cnxk: support to get profile count
Sunil Kumar Kori [Tue, 12 Oct 2021 07:05:47 +0000 (12:35 +0530)]
common/cnxk: support to get profile count

Implement interface to get available profile count for given
NIXLF.

Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
2 years agocommon/cnxk: support to get policer level to index
Sunil Kumar Kori [Tue, 12 Oct 2021 07:05:46 +0000 (12:35 +0530)]
common/cnxk: support to get policer level to index

CN10K platform supports policer up to 3 level of hierarchy.
Implement RoC API to get corresponding index for given level.

Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
2 years agocommon/cnxk: update policer mbox API and HW definitions
Sunil Kumar Kori [Tue, 12 Oct 2021 07:05:45 +0000 (12:35 +0530)]
common/cnxk: update policer mbox API and HW definitions

To support ingress policer on CN10K, MBOX interfaces and HW
definitions updated.

Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
Acked-by: Ray Kinsella <mdr@ashroe.eu>
Acked-by: Jerin Jacob <jerinj@marvell.com>
2 years agonet/octeontx2: use fast udata and mdata flags
Tejasree Kondoj [Fri, 24 Sep 2021 17:11:45 +0000 (22:41 +0530)]
net/octeontx2: use fast udata and mdata flags

Using fast metadata and userdata flags instead of
driver callbacks for set_pkt_metadata and
get_userdata in inline IPsec.

Signed-off-by: Tejasree Kondoj <ktejasree@marvell.com>
Acked-by: Anoob Joseph <anoobj@marvell.com>
2 years agonet/mlx5: fix RSS expansion for L2/L3 VXLAN
Lior Margalit [Thu, 14 Oct 2021 06:21:36 +0000 (09:21 +0300)]
net/mlx5: fix RSS expansion for L2/L3 VXLAN

The RSS expansion algorithm is using a graph to find the possible
expansion paths. The current implementation does not differentiate
between standard (L2) VXLAN and L3 VXLAN. As result the flow is expanded
with all possible paths.
For example:
testpmd> flow create... / vxlan / end actions rss level 2 / end
It is currently expanded to the following paths:
ETH IPV4 UDP VXLAN END
ETH IPV4 UDP VXLAN ETH IPV4 END
ETH IPV4 UDP VXLAN ETH IPV6 END
ETH IPV4 UDP VXLAN IPV4 END
ETH IPV4 UDP VXLAN IPV6 END

The fix is to adjust the expansion according to the outer UDP destination
port. In case flow pattern defines a match on the standard udp port, 4789,
or does not define a match on the destination port, which also implies
setting the standard one, the expansion for the above example will be:
ETH IPV4 UDP VXLAN END
ETH IPV4 UDP VXLAN ETH IPV4 END
ETH IPV4 UDP VXLAN ETH IPV6 END
Otherwise, the expansion will be:
ETH IPV4 UDP VXLAN END
ETH IPV4 UDP VXLAN IPV4 END
ETH IPV4 UDP VXLAN IPV6 END

Fixes: f4f06e361516 ("net/mlx5: add flow VXLAN item")
Cc: stable@dpdk.org
Signed-off-by: Lior Margalit <lmargalit@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
2 years agonet/i40e: fix risk in descriptor read in NEON Rx
Ruifeng Wang [Wed, 15 Sep 2021 08:33:38 +0000 (16:33 +0800)]
net/i40e: fix risk in descriptor read in NEON Rx

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

In NEON vector PMD, vector load loads two contiguous 8B of
descriptor data into vector register. Given vector load ensures no
16B atomicity, read of the word that includes DD field could be
reordered after read of other words. In this case, some words could
contain invalid data.

Read barrier is added after read of qword1 that includes DD field.
And qword0 is reloaded to update vector register. This ensures
that the fetched data is correct.

Testpmd single core test on N1SDP/ThunderX2 showed no performance drop.

Fixes: ae0eb310f253 ("net/i40e: implement vector PMD for ARM")
Cc: stable@dpdk.org
Signed-off-by: Ruifeng Wang <ruifeng.wang@arm.com>
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
2 years agonet/i40e: fix IPv6 fragment RSS offload type in flow
Alvin Zhang [Tue, 19 Oct 2021 01:53:48 +0000 (09:53 +0800)]
net/i40e: fix IPv6 fragment RSS offload type in flow

To keep flow format uniform with ice, this patch adds support for
this RSS rule:
    flow create 0 ingress pattern eth / ipv6 / ipv6_frag_ext / end \
    actions rss types ipv6-frag end queues end queues end / end

Fixes: ef4c16fd9148 ("net/i40e: refactor RSS flow")
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/ice: fix generic build on FreeBSD
Leyi Rong [Tue, 19 Oct 2021 03:02:08 +0000 (11:02 +0800)]
net/ice: fix generic build on FreeBSD

The common header file for vectorization is included in multiple files,
and so must use macros for the current compilation unit, rather than the
compiler-capability flag set for the whole driver. With the current,
incorrect, macro, the AVX512 or AVX2 flags may be set when compiling up
SSE code, leading to compilation errors. Changing from "CC_AVX*_SUPPORT"
to the compiler-defined "__AVX*__" macros fixes this issue. In addition,
splitting AVX-specific code into the new ice_rxtx_common_avx.h header
file to avoid such bugs.

Bugzilla ID: 788
Fixes: a4e480de268e ("net/ice: optimize Tx by using AVX512")
Fixes: 20daa1c978b7 ("net/ice: fix crash in AVX512")
Cc: stable@dpdk.org
Signed-off-by: Leyi Rong <leyi.rong@intel.com>
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
2 years agonet/i40e: fix generic build on FreeBSD
Leyi Rong [Tue, 19 Oct 2021 03:02:07 +0000 (11:02 +0800)]
net/i40e: fix generic build on FreeBSD

The common header file for vectorization is included in multiple files,
and so must use macros for the current compilation unit, rather than the
compiler-capability flag set for the whole driver. With the current,
incorrect, macro, the AVX512 or AVX2 flags may be set when compiling up
SSE code, leading to compilation errors. Changing from "CC_AVX*_SUPPORT"
to the compiler-defined "__AVX*__" macros fixes this issue. In addition,
splitting AVX-specific code into the new i40e_rxtx_common_avx.h header
file to avoid such bugs.

Bugzilla ID: 788
Fixes: 0604b1f2208f ("net/i40e: fix crash in AVX512")
Cc: stable@dpdk.org
Signed-off-by: Leyi Rong <leyi.rong@intel.com>
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
2 years agonet/mlx5: support more tunnel types
Eli Britstein [Thu, 23 Sep 2021 08:43:01 +0000 (11:43 +0300)]
net/mlx5: support more tunnel types

Accept RTE_FLOW_ITEM_TYPE_GRE, RTE_FLOW_ITEM_TYPE_NVGRE and
RTE_FLOW_ITEM_TYPE_GENEVE as valid tunnel types.

Fixes: 4ec6360de37d ("net/mlx5: implement tunnel offload")
Cc: stable@dpdk.org
Signed-off-by: Eli Britstein <elibr@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
2 years agoapp/testpmd: add tunnel types
Eli Britstein [Thu, 23 Sep 2021 08:43:00 +0000 (11:43 +0300)]
app/testpmd: add tunnel types

Current testpmd implementation supports VXLAN only for tunnel offload.
Add GRE, NVGRE and GENEVE for tunnel offload flow matches.

For example:
testpmd> flow tunnel create 0 type vxlan
port 0: flow tunnel #1 type vxlan
testpmd> flow tunnel create 0 type nvgre
port 0: flow tunnel #2 type nvgre
testpmd> flow tunnel create 0 type gre
port 0: flow tunnel #3 type gre
testpmd> flow tunnel create 0 type geneve
port 0: flow tunnel #4 type geneve

Fixes: 1b9f274623b8 ("app/testpmd: add commands for tunnel offload")
Cc: stable@dpdk.org
Signed-off-by: Eli Britstein <elibr@nvidia.com>
Reviewed-by: Gregory Etelson <getelson@nvidia.com>
2 years agonet/softnic: fix memory leak of meter policy
Dapeng Yu [Thu, 14 Oct 2021 02:12:07 +0000 (10:12 +0800)]
net/softnic: fix memory leak of meter policy

After the meter policies are created, they are not freed on device
close.

This patch fixes it.

Fixes: 5f0d54f372f0 ("ethdev: add pre-defined meter policy API")
Cc: stable@dpdk.org
Signed-off-by: Dapeng Yu <dapengx.yu@intel.com>
Acked-by: Jasvinder Singh <jasvinder.singh@intel.com>
2 years agoapp/testpmd: fix access to DSCP table entries
Sunil Kumar Kori [Tue, 12 Oct 2021 08:33:17 +0000 (14:03 +0530)]
app/testpmd: fix access to DSCP table entries

During parsing of DSCP entries, memory is allocated and assigned
to *dscp_table. Later on, same memory is accessed using
*dscp_table[i++].

Due to higher precedence for array subscript, dscp_table[i++] will
be executed first which actually does not point to the same memory
which was allocated previously for DSCP table entries.

Fixes: 459463ae6c26 ("app/testpmd: fix memory allocation for DSCP table")
Cc: stable@dpdk.org
Signed-off-by: Sunil Kumar Kori <skori@marvell.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
2 years agonet/ena: update version to 2.5.0
Michal Krawczyk [Tue, 19 Oct 2021 10:56:29 +0000 (12:56 +0200)]
net/ena: update version to 2.5.0

This version update contains:
  * Fix for verification of the offload capabilities (especially for
    IPv6 packets).
  * Support for Tx and Rx free threshold values.
  * Fixes for per-queue offload capabilities.
  * Announce support of the scattered Rx offload.
  * NUMA aware allocations.
  * Check for the missing Tx completions.

Signed-off-by: Michal Krawczyk <mk@semihalf.com>
2 years agonet/ena: check missing Tx completions
Michal Krawczyk [Tue, 19 Oct 2021 10:56:28 +0000 (12:56 +0200)]
net/ena: check missing Tx completions

In some cases Tx descriptors may be uncompleted by the HW and as a
result they will never be released.

This patch adds checking for the missing Tx completions to the ENA timer
service, so in order to use this feature, the application must call the
function rte_timer_manage().

Missing Tx completion reset threshold is determined dynamically, by
taking into consideration ring size and the default value.

Tx cleanup is associated with the Tx burst function. As DPDK
applications can call Tx burst function dynamically, time when last
cleanup was called must be traced to avoid false detection of the
missing Tx completion.

Signed-off-by: Michal Krawczyk <mk@semihalf.com>
Reviewed-by: Igor Chauskin <igorch@amazon.com>
Reviewed-by: Shai Brandes <shaibran@amazon.com>
2 years agonet/ena: add NUMA-aware allocations
Michal Krawczyk [Tue, 19 Oct 2021 10:56:27 +0000 (12:56 +0200)]
net/ena: add NUMA-aware allocations

Only the IO rings memory was allocated with taking the socket ID into
the respect, while the other structures was allocated using the regular
rte_zmalloc() API.

Ring specific structures are now being allocated using the ring's
socket ID.

Signed-off-by: Michal Krawczyk <mk@semihalf.com>
Reviewed-by: Igor Chauskin <igorch@amazon.com>
Reviewed-by: Shai Brandes <shaibran@amazon.com>
2 years agonet/ena: advertise scattered Rx capability
Michal Krawczyk [Tue, 19 Oct 2021 10:56:26 +0000 (12:56 +0200)]
net/ena: advertise scattered Rx capability

ENA can't be forced to always pass single descriptor for the Rx packet.
Even if the passed buffer size is big enough to hold the data, we can't
make assumption that the HW won't use extra descriptor because of
internal optimizations. This assumption may be true, but only for some
of the FW revisions, which may differ depending on the used AWS instance
type.

As the scattered Rx support on the Rx path already exists, the driver
just needs to announce DEV_RX_OFFLOAD_SCATTER capability by turning on
the rte_eth_dev_data::scattered_rx option.

Fixes: 1173fca25af9 ("ena: add polling-mode driver")
Cc: stable@dpdk.org
Signed-off-by: Michal Krawczyk <mk@semihalf.com>
Reviewed-by: Igor Chauskin <igorch@amazon.com>
Reviewed-by: Shai Brandes <shaibran@amazon.com>
2 years agonet/ena: fix per-queue offload capabilities
Michal Krawczyk [Tue, 19 Oct 2021 10:56:25 +0000 (12:56 +0200)]
net/ena: fix per-queue offload capabilities

As ENA currently doesn't support offloads which could be configured
per-queue, only per-port flags should be set.

In addition, to make the code cleaner, parsing appropriate offload
flags is encapsulated into helper functions, in a similar matter it's
done by the other PMDs.

[1] https://doc.dpdk.org/guides/prog_guide/
    poll_mode_drv.html?highlight=offloads#hardware-offload

Fixes: 7369f88f88c0 ("net/ena: convert to new Rx offloads API")
Fixes: 56b8b9b7e5d2 ("net/ena: convert to new Tx offloads API")
Cc: stable@dpdk.org
Signed-off-by: Michal Krawczyk <mk@semihalf.com>
Reviewed-by: Igor Chauskin <igorch@amazon.com>
Reviewed-by: Shai Brandes <shaibran@amazon.com>
2 years agonet/ena: support Tx/Rx free thresholds
Michal Krawczyk [Tue, 19 Oct 2021 10:56:24 +0000 (12:56 +0200)]
net/ena: support Tx/Rx free thresholds

The caller can pass Tx or Rx free threshold value to the configuration
structure for each ring. It determines when the Tx/Rx function should
start cleaning up/refilling the descriptors. ENA was ignoring this value
and doing it's own calculations.

Now the user can configure ENA's behavior using this parameter and if
this variable won't be set, the ENA will continue with the old behavior
and will use it's own threshold value.

The default value is not provided by the ENA in the ena_infos_get(), as
it's being determined dynamically, depending on the requested ring size.

Note that NULL check for Tx conf was removed from the function
ena_tx_queue_setup(), as at this place the configuration will be
either provided by the user or the default config will be used and it's
handled by the upper (rte_ethdev) layer.

Tx threshold shouldn't be used for the Tx cleanup budget as it can be
inadequate to the used burst. Now the PMD tries to release mbufs for the
ring until it will be depleted.

Signed-off-by: Michal Krawczyk <mk@semihalf.com>
Reviewed-by: Igor Chauskin <igorch@amazon.com>
Reviewed-by: Shai Brandes <shaibran@amazon.com>
2 years agonet/ena: fix offload capabilities verification
Michal Krawczyk [Tue, 19 Oct 2021 10:56:23 +0000 (12:56 +0200)]
net/ena: fix offload capabilities verification

ENA PMD has multiple checksum offload flags, which are more discrete
than the DPDK offload capabilities flags.
As the driver wasn't storing it's internal checksum offload capabilities
and was relying only on the DPDK capabilities, not all scenarios could
be properly covered (like when to prepare pseudo header checksum and
when not).

Moreover, the user could request offload capability, which isn't
supported by the HW and the PMD would quietly ignore the issue.

This commit reworks eth_ena_prep_pkts() function to perform additional
checks and to properly reflect the HW requirements. With the
RTE_LIBRTE_ETHDEV_DEBUG enabled, the function will do even more
verifications, to help the user find any issues with the mbuf
configuration.

Fixes: b3fc5a1ae10d ("net/ena: add Tx preparation")
Cc: stable@dpdk.org
Signed-off-by: Michal Krawczyk <mk@semihalf.com>
Reviewed-by: Igor Chauskin <igorch@amazon.com>
Reviewed-by: Shai Brandes <shaibran@amazon.com>
2 years agonet/sfc: implement transfer proxy port callback
Viacheslav Galaktionov [Fri, 15 Oct 2021 06:49:03 +0000 (09:49 +0300)]
net/sfc: implement transfer proxy port callback

In sfc, MAE admin serves as a transfer proxy. In order to track which
ethdev is privileged, augment every independent switch port structure
with information about its MAE privilege.

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: allow ports without MAE privilege
Viacheslav Galaktionov [Fri, 15 Oct 2021 06:49:02 +0000 (09:49 +0300)]
net/sfc: allow ports without MAE privilege

Register unprivileged ports in the switch domain registry in order to
allow redirecting traffic to them.

Differentiate between different levels of MAE support, update all MAE
status checks.

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: support unprivileged MAE clients
Viacheslav Galaktionov [Fri, 15 Oct 2021 06:49:01 +0000 (09:49 +0300)]
common/sfc_efx/base: support unprivileged MAE clients

In order to differentiate between privileged and unprivileged MAE clients,
add a separate boolean flag to represent a NIC's MAE privilege level.

Allow initializing unprivileged MAE clients by avoiding calls to functions
that can only be called by the admin NIC.

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 agoexamples/ip_reassembly: remove unused option
Ferruh Yigit [Mon, 18 Oct 2021 13:48:53 +0000 (14:48 +0100)]
examples/ip_reassembly: remove unused option

Remove 'max-pkt-len' parameter.

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
2 years agoethdev: unify MTU checks
Ferruh Yigit [Mon, 18 Oct 2021 13:48:52 +0000 (14:48 +0100)]
ethdev: unify MTU checks

Both 'rte_eth_dev_configure()' & 'rte_eth_dev_set_mtu()' sets MTU but
have slightly different checks. Like one checks min MTU against
RTE_ETHER_MIN_MTU and other RTE_ETHER_MIN_LEN.

Checks moved into common function to unify the checks. Also this has
benefit to have common error logs.

Default 'dev_info->min_mtu' (the one set by ethdev if driver doesn't
provide one), changed to ('RTE_ETHER_MIN_LEN' - overhead). Previously it
was 'RTE_ETHER_MIN_MTU' which is min MTU for IPv4 packets. Since the
intention is to provide min MTU corresponding minimum frame size, new
default value suits better.

Suggested-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
2 years agoethdev: remove jumbo offload flag
Ferruh Yigit [Mon, 18 Oct 2021 13:48:51 +0000 (14:48 +0100)]
ethdev: remove jumbo offload flag

Removing 'DEV_RX_OFFLOAD_JUMBO_FRAME' offload flag.

Instead of drivers announce this capability, application can deduct the
capability by checking reported 'dev_info.max_mtu' or
'dev_info.max_rx_pktlen'.

And instead of application setting this flag explicitly to enable jumbo
frames, this can be deduced by driver by comparing requested 'mtu' to
'RTE_ETHER_MTU'.

Removing this additional configuration for simplification.

Suggested-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Reviewed-by: Rosen Xu <rosen.xu@intel.com>
Acked-by: Somnath Kotur <somnath.kotur@broadcom.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Huisong Li <lihuisong@huawei.com>
Acked-by: Hyong Youb Kim <hyonkim@cisco.com>
Acked-by: Michal Krawczyk <mk@semihalf.com>
2 years agoethdev: move MTU set check to library
Ferruh Yigit [Mon, 18 Oct 2021 13:48:50 +0000 (14:48 +0100)]
ethdev: move MTU set check to library

Move requested MTU value check to the API to prevent the duplicated
code.

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Reviewed-by: Rosen Xu <rosen.xu@intel.com>
Acked-by: Somnath Kotur <somnath.kotur@broadcom.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
2 years agoethdev: move jumbo frame offload check to library
Ferruh Yigit [Mon, 18 Oct 2021 13:48:49 +0000 (14:48 +0100)]
ethdev: move jumbo frame offload check to library

Setting MTU bigger than RTE_ETHER_MTU requires the jumbo frame support,
and application should enable the jumbo frame offload support for it.

When jumbo frame offload is not enabled by application, but MTU bigger
than RTE_ETHER_MTU is requested there are two options, either fail or
enable jumbo frame offload implicitly.

Enabling jumbo frame offload implicitly is selected by many drivers
since setting a big MTU value already implies it, and this increases
usability.

This patch moves this logic from drivers to the library, both to reduce
the duplicated code in the drivers and to make behaviour more visible.

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Reviewed-by: Rosen Xu <rosen.xu@intel.com>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Acked-by: Somnath Kotur <somnath.kotur@broadcom.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Huisong Li <lihuisong@huawei.com>
2 years agoethdev: fix max Rx packet length
Ferruh Yigit [Mon, 18 Oct 2021 13:48:48 +0000 (14:48 +0100)]
ethdev: fix max Rx packet length

There is a confusion on setting max Rx packet length, this patch aims to
clarify it.

'rte_eth_dev_configure()' API accepts max Rx packet size via
'uint32_t max_rx_pkt_len' field of the config struct 'struct
rte_eth_conf'.

Also 'rte_eth_dev_set_mtu()' API can be used to set the MTU, and result
stored into '(struct rte_eth_dev)->data->mtu'.

These two APIs are related but they work in a disconnected way, they
store the set values in different variables which makes hard to figure
out which one to use, also having two different method for a related
functionality is confusing for the users.

Other issues causing confusion is:
* maximum transmission unit (MTU) is payload of the Ethernet frame. And
  'max_rx_pkt_len' is the size of the Ethernet frame. Difference is
  Ethernet frame overhead, and this overhead may be different from
  device to device based on what device supports, like VLAN and QinQ.
* 'max_rx_pkt_len' is only valid when application requested jumbo frame,
  which adds additional confusion and some APIs and PMDs already
  discards this documented behavior.
* For the jumbo frame enabled case, 'max_rx_pkt_len' is an mandatory
  field, this adds configuration complexity for application.

As solution, both APIs gets MTU as parameter, and both saves the result
in same variable '(struct rte_eth_dev)->data->mtu'. For this
'max_rx_pkt_len' updated as 'mtu', and it is always valid independent
from jumbo frame.

For 'rte_eth_dev_configure()', 'dev->data->dev_conf.rxmode.mtu' is user
request and it should be used only within configure function and result
should be stored to '(struct rte_eth_dev)->data->mtu'. After that point
both application and PMD uses MTU from this variable.

When application doesn't provide an MTU during 'rte_eth_dev_configure()'
default 'RTE_ETHER_MTU' value is used.

Additional clarification done on scattered Rx configuration, in
relation to MTU and Rx buffer size.
MTU is used to configure the device for physical Rx/Tx size limitation,
Rx buffer is where to store Rx packets, many PMDs use mbuf data buffer
size as Rx buffer size.
PMDs compare MTU against Rx buffer size to decide enabling scattered Rx
or not. If scattered Rx is not supported by device, MTU bigger than Rx
buffer size should fail.

Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Acked-by: Somnath Kotur <somnath.kotur@broadcom.com>
Acked-by: Huisong Li <lihuisong@huawei.com>
Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Rosen Xu <rosen.xu@intel.com>
Acked-by: Hyong Youb Kim <hyonkim@cisco.com>
2 years agonet: fix aliasing in checksum computation
Georg Sauthoff [Sun, 17 Oct 2021 20:37:18 +0000 (22:37 +0200)]
net: fix aliasing in checksum computation

That means a superfluous cast is removed and aliasing through a uint8_t
pointer is eliminated. NB: The C standard specifies that a unsigned char
pointer may alias while the C standard doesn't include such requirement
for uint8_t pointers.

Also simplified the loop since a modern C compiler can speed up (i.e.
auto-vectorize) it in a similar way. For example, GCC auto-vectorizes it
for Haswell using AVX registers while halving the number of instructions
in the generated code.

Fixes: 6006818cfb26 ("net: new checksum functions")
Fixes: e079655c41fb ("net: fix build with gcc 4.4.7 and strict aliasing")
Cc: stable@dpdk.org
Signed-off-by: Georg Sauthoff <mail@gms.tf>
Reviewed-by: Morten Brørup <mb@smartsharesystems.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
2 years agonet/enic: fix build with GCC 7.5
Ferruh Yigit [Fri, 15 Oct 2021 10:28:18 +0000 (11:28 +0100)]
net/enic: fix build with GCC 7.5

Build error:
../drivers/net/enic/enic_fm_flow.c: In function 'enic_fm_flow_parse':
../drivers/net/enic/enic_fm_flow.c:1467:24:
error: 'dev' may be used uninitialized in this function
[-Werror=maybe-uninitialized]
    struct rte_eth_dev *dev;
                        ^~~
../drivers/net/enic/enic_fm_flow.c:1580:24:
error: 'dev' may be used uninitialized in this function
[-Werror=maybe-uninitialized]
    struct rte_eth_dev *dev;
                        ^~~
../drivers/net/enic/enic_fm_flow.c:1599:24:
error: 'dev' may be used uninitialized in this function
[-Werror=maybe-uninitialized]
    struct rte_eth_dev *dev;
                        ^~~

Build error looks like false positive, but to silence the compiler
initializing the pointer with NULL.

Bugzilla ID: 812
Fixes: 54bd4ebe8b05 ("net/enic: support meta flow actions to overrule destinations")

Reported-by: David Marchand <david.marchand@redhat.com>
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
2 years agodoc: fix emulated device names in e1000 guide
William Tu [Mon, 11 Oct 2021 18:55:40 +0000 (11:55 -0700)]
doc: fix emulated device names in e1000 guide

The device name should be 82574L Gigabit Ethernet Controller.
The patch also remove a redundant "*".

Fixes: fc1f2750a3ec ("doc: programmers guide")
Cc: stable@dpdk.org
Signed-off-by: William Tu <u9012063@gmail.com>
Acked-by: Haiyue Wang <haiyue.wang@intel.com>
2 years agocommon/octeontx2: enable build only on 64-bit Linux
Pavan Nikhilesh [Thu, 14 Oct 2021 19:56:53 +0000 (01:26 +0530)]
common/octeontx2: enable build only on 64-bit Linux

Since AARCH32 extension is not implemented on octeontx2 family, only
enable build for 64bit.
Due to Linux kernel AF(Admin Function) driver dependency, only enable
build for 64-bit Linux.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
2 years agocommon/octeontx: enable build only on 64-bit Linux
Pavan Nikhilesh [Thu, 14 Oct 2021 19:56:52 +0000 (01:26 +0530)]
common/octeontx: enable build only on 64-bit Linux

Since AARCH32 extension is not implemented on octeontx family, only
enable build for 64bit.
Due to Linux kernel AF(Admin function) driver dependency, only enable
build for 64-bit Linux.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
2 years agonet/thunderx: enable build only on 64-bit Linux
Pavan Nikhilesh [Thu, 14 Oct 2021 19:56:51 +0000 (01:26 +0530)]
net/thunderx: enable build only on 64-bit Linux

Since AARCH32 extension is not implemented on thunderx family, only
enable build for 64bit.
Due to Linux kernel AF(Admin function) driver dependency, only enable
build for Linux.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
2 years agoapp/testpmd: fix RSS hash offload display
Jie Wang [Thu, 14 Oct 2021 10:31:24 +0000 (18:31 +0800)]
app/testpmd: fix RSS hash offload display

The driver may change RSS hash offloads in dev->data->dev_conf
during dev_configure which may cause port->dev_conf and port->rx_conf
contain outdated values.
Since testpmd uses its configuration structures to display offloads
configuration, it doesn't display RSS hash offload.

This patch updates the testpmd offloads from device configuration
to fix this issue.

Fixes: ce8d561418d4 ("app/testpmd: add port configuration settings")

Signed-off-by: Jie Wang <jie1x.wang@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
2 years agoethdev: add API to get device configuration
Jie Wang [Thu, 14 Oct 2021 10:31:23 +0000 (18:31 +0800)]
ethdev: add API to get device configuration

The driver may change offloads info into dev->data->dev_conf
in dev_configure which may cause apps use outdated values.

Add a new API to get actual device configuration.

Signed-off-by: Jie Wang <jie1x.wang@intel.com>
Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
2 years agonet/bonding: fix Tx queue release
Xueming Li [Fri, 15 Oct 2021 09:55:48 +0000 (17:55 +0800)]
net/bonding: fix Tx queue release

When release Tx queue, Rx queue data got freed because wrong Tx queue
data located.

This patch fixes the wrong Tx queue data location.

Fixes: 7483341ae553 ("ethdev: change queue release callback")

Signed-off-by: Xueming Li <xuemingl@nvidia.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
2 years agonet/mlx5: fix domains selection for meter policy
Li Zhang [Mon, 11 Oct 2021 02:40:48 +0000 (05:40 +0300)]
net/mlx5: fix domains selection for meter policy

Fate actions are different per domain.
When all the domains, ingress, egress and FDB (transfer),
can support all the policy actions, i.e. [SET_TAG],
the policy prepares resources for all the domains and
failure happens if one of the domains misses its fate action
in the policy action list.

Remove the domains missing their fate action
from the meter policy preparation.

Now, the policy will prepare a domain only when the domain supports
all the actions and when one of the domain fate actions is on the list.

Fixes: afb4aa4f122b ("net/mlx5: support meter policy operations")
Cc: stable@dpdk.org
Signed-off-by: Li Zhang <lizh@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
2 years agonet/ice: fix dereferenced null pointer
Simei Su [Mon, 11 Oct 2021 08:25:25 +0000 (16:25 +0800)]
net/ice: fix dereferenced null pointer

This patch fixes coverity issue by avoiding use of null pointer
in taking false branch.

Coverity issue: 373360
Fixes: 437dbd2fd428 ("net/ice: support 1PPS")

Signed-off-by: Simei Su <simei.su@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
2 years agonet/ice: fix freeing queues on DCF device reset
Dapeng Yu [Mon, 11 Oct 2021 07:25:46 +0000 (15:25 +0800)]
net/ice: fix freeing queues on DCF device reset

In function ice_dcf_stop_queues(), RX queues and TX queues are actually
not freed, so their pointers shall not be set to NULL when queues are
stopped.

This patch adds function call to free queues on DCF device close,
which also set the RX and TX queues' pointers to NULL on freeing
queues, and avoids referring to the released resource when device is
started again.

Fixes: 1a86f4dbdf42 ("net/ice: support DCF device reset")
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/ice: fix deadlock on flow redirect
Dapeng Yu [Mon, 11 Oct 2021 07:38:49 +0000 (15:38 +0800)]
net/ice: fix deadlock on flow redirect

If flow redirect failed, the spinlock will not be unlocked.
This patch fixes it.

Fixes: bc9201388d56 ("net/ice: support flow redirect")
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/ice: fix build when Rx descriptor size is 16
Simei Su [Mon, 11 Oct 2021 08:35:52 +0000 (16:35 +0800)]
net/ice: fix build when Rx descriptor size is 16

The Timestamp Overlay feature is available only in 32B Flex Descriptors.
This patch adds compile option when in 16B Flex Descriptors.

Fixes: 953e74e6b73a ("net/ice: enable Rx timestamp on flex descriptor")
Fixes: 646dcbe6c701 ("net/ice: support IEEE 1588 PTP")

Signed-off-by: Simei Su <simei.su@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
2 years agonet/ice/base: fix null pointer dereferences for parser
Junfeng Guo [Wed, 13 Oct 2021 10:34:55 +0000 (10:34 +0000)]
net/ice/base: fix null pointer dereferences for parser

Null-checking "p" suggests that it may be null, but it has already
been dereferenced on all paths leading to the check. Thus correct
the code lines and remove the redundant line.

Fixes: c84f8aa2100c ("net/ice/base: add parser runtime skeleton")

Signed-off-by: Junfeng Guo <junfeng.guo@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
2 years agonet/i40e: upgrade AQ command of MAC/VLAN remove
Robin Zhang [Mon, 11 Oct 2021 08:12:48 +0000 (08:12 +0000)]
net/i40e: upgrade AQ command of MAC/VLAN remove

Firmware 8.4+ will return I40E_AQ_RC_ENOENT when try to delete
non-existent MAC/VLAN addresses from the HW filtering, this should
not be considered as an Admin Queue error. But in i40e_asq_send_command,
it will return I40E_ERR_ADMIN_QUEUE_ERROR if the return value of Admin
Queue command processed by Firmware is not I40E_AQ_RC_OK or
I40E_AQ_RC_EBUSY.

Use i40e_aq_remove_macvlan_v2 instead so that we can get the
corresponding Admin Queue status, and not report as an error in DPDK
when Firmware return I40E_AQ_RC_ENOENT, and this also not break with an
old firmware.

Signed-off-by: Robin Zhang <robinx.zhang@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
2 years agonet/ice/base: fix parser runtime reset
Junfeng Guo [Mon, 11 Oct 2021 13:30:13 +0000 (13:30 +0000)]
net/ice/base: fix parser runtime reset

Adjust the code line order of the parser runtime reset, since the
struct rt->psr is used in function _rt_flag_set before assignment.

Fixes: c84f8aa2100c ("net/ice/base: add parser runtime skeleton")
Cc: stable@dpdk.org
Signed-off-by: Junfeng Guo <junfeng.guo@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
2 years agodrivers/net: remove queue xstats auto-fill flag
Andrew Rybchenko [Tue, 28 Sep 2021 16:48:54 +0000 (19:48 +0300)]
drivers/net: remove queue xstats auto-fill flag

Some drivers do not provide per-queue statistics. So, there is no point
to have these misleading zeros in xstats.

Fixes: f30e69b41f94 ("ethdev: add device flag to bypass auto-filled queue xstats")
Cc: stable@dpdk.org
Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
2 years agoethdev: add telemetry endpoint for device info
Gowrishankar Muthukrishnan [Wed, 29 Sep 2021 04:25:29 +0000 (09:55 +0530)]
ethdev: add telemetry endpoint for device info

Add telemetry endpoint /ethdev/info for device info.

Signed-off-by: Gowrishankar Muthukrishnan <gmuthukrishn@marvell.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
2 years agonet: introduce IPv4 IHL and version fields
Gregory Etelson [Thu, 14 Oct 2021 17:41:13 +0000 (20:41 +0300)]
net: introduce IPv4 IHL and version fields

RTE IPv4 header definition combines the `version' and `ihl'  fields
into a single structure member.
This patch introduces dedicated structure members for both `version'
and `ihl' IPv4 fields. Separated header fields definitions allow to
create simplified code to match on the IHL value in a flow rule.
The original `version_ihl' structure member is kept for backward
compatibility.

Signed-off-by: Gregory Etelson <getelson@nvidia.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Ray Kinsella <mdr@ashroe.eu>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
2 years agonet: fix IPv4 change announce
Gregory Etelson [Thu, 14 Oct 2021 17:41:12 +0000 (20:41 +0300)]
net: fix IPv4 change announce

IPv4 header encodes fragment information into 16 bits field.
3 bits hold flags and remaining 13 bits are for fragment offset.
13 bits bit-field cannot be defined both for big and little endian
systems.

The patch removes IPv4 fragments union announce.

Fixes: f7383e7c7ec1 ("net: announce changes in IPv4 header access")

Signed-off-by: Gregory Etelson <getelson@nvidia.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Akhil Goyal <gakhil@marvell.com>
Acked-by: Ori Kam <orika@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
2 years agonet/txgbe: fix VXLAN-GPE packet checksum
Jiawen Wu [Wed, 13 Oct 2021 02:45:21 +0000 (10:45 +0800)]
net/txgbe: fix VXLAN-GPE packet checksum

Parse inner L2 length to set correct packet type, and ensure that
hardware can compute the checksum successfully.

Fixes: b950203be7f1 ("net/txgbe: support VXLAN-GPE")
Cc: stable@dpdk.org
Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com>
2 years agonet/txgbe: set fixed flag for exact link speed
Jiawen Wu [Wed, 13 Oct 2021 02:45:20 +0000 (10:45 +0800)]
net/txgbe: set fixed flag for exact link speed

Setting exact link speed makes sense if auto-negotiation is
disabled. Fixed flag is required to disable auto-negotiation.

Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com>
2 years agonet/txgbe: fix to get interrupt status
Jiawen Wu [Wed, 13 Oct 2021 02:45:19 +0000 (10:45 +0800)]
net/txgbe: fix to get interrupt status

It's necessary to set 1 on TXGBE_PX_INTA register to get interrupts
normally, when legacy interrupt mode is used.

Fixes: 2fc745e6b606 ("net/txgbe: add interrupt operation")
Cc: stable@dpdk.org
Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com>
2 years agoapp/testpmd: add option to display extended statistics
Ivan Ilchenko [Thu, 14 Oct 2021 09:00:01 +0000 (12:00 +0300)]
app/testpmd: add option to display extended statistics

Add 'display-xstats' option for using in accompanying with Rx/Tx statistics
(i.e. 'stats-period' option or 'show port stats' interactive command) to
display specified list of extended statistics.

Signed-off-by: Ivan Ilchenko <ivan.ilchenko@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
2 years agonet/mlx5: update modify field action
Viacheslav Ovsiienko [Wed, 13 Oct 2021 18:45:16 +0000 (21:45 +0300)]
net/mlx5: update modify field action

Update immediate value/pointer source operand support
for modify field RTE Flow action:

  - source operand data can be presented by byte buffer
    (instead of former uint64_t) or by pointer
  - no host byte ordering is assumed anymore for immediate
    data buffer (not uint64_t anymore)
  - no immediate value offset is expected (the source
    subfield is located at the same offset as in destination)

Signed-off-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
2 years agoapp/testpmd: fix hex string parser in flow commands
Viacheslav Ovsiienko [Wed, 13 Oct 2021 18:45:15 +0000 (21:45 +0300)]
app/testpmd: fix hex string parser in flow commands

The hexadecimal string parser does not check the target
field buffer size, buffer overflow happens and might
cause the application failure (segmentation fault
is observed usually).

Fixes: 169a9fed1f4c ("app/testpmd: fix hex string parser support for flow API")
Cc: stable@dpdk.org
Signed-off-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
2 years agoapp/testpmd: update modify field flow action support
Viacheslav Ovsiienko [Wed, 13 Oct 2021 18:45:14 +0000 (21:45 +0300)]
app/testpmd: update modify field flow action support

The testpmd flow create command updates provided:

  - modify field action supports the updated actions
  - pointer type added for action source field
  - pointer and value source field takes hex string
    instead of unsigned int in host endianness

There are some examples of flow with update modified
field action:

1. IPv6 destination address bytes 4-7 assignment:
   0000::1111 - > 0000:xxxx:4455:6677::1111

   flow create 0 egress group 1
     pattern eth / ipv6 dst is 0000::1111 / udp / end
     actions modify_field op set
             dst_type ipv6_dst
     dst_offset 32
             src_type value
             src_value 0011223344556677
     width 32 / end

2. Copy second byte of IPv4 destination address to the
   third byte of source address:
     10.0.118.4 -> 192.168.100.1
     10.0.168.4 -> 192.168.100.1

   flow create 0 egress group 1
     pattern eth / ipv4 / udp / end
     actions modify_field op set
             dst_type ipv4_src
             dst_offset 16
     src_type ipv4_dst
     src_offset 8
     width 8 / end

3. Assign METADATA value with 11223344 value from the
   hex string in the linear buffer. Please note, the value
   definition should follow host-endian, example is given
   for x86 (little-endian):

   flow create 0 egress group 1
     pattern eth / ipv4 / end
     actions modify_field op set
             dst_type meta
     src_type pointer
     src_ptr 44332211
     width 32 / end

4. Assign destination MAC with EA:11:0B:AD:0B:ED value:

   flow create 0 egress group 1
     pattern eth / end
     actions modify_field op set
             dst_type mac_dst
     src_type value
     src_value EA110BAD0BED
     width 48 / end

Signed-off-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
2 years agoethdev: add experimental comment for modify field action
Viacheslav Ovsiienko [Wed, 13 Oct 2021 18:45:13 +0000 (21:45 +0300)]
ethdev: add experimental comment for modify field action

EXPERIMENTAL tag was missed in rte_flow_action_modify_data
structure description.

Fixes: 73b68f4c54a0 ("ethdev: introduce generic modify flow action")
Cc: stable@dpdk.org
Signed-off-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
2 years agoethdev: update modify field flow action
Viacheslav Ovsiienko [Wed, 13 Oct 2021 18:45:12 +0000 (21:45 +0300)]
ethdev: update modify field flow action

The generic modify field flow action introduced in [1] has
some issues related to the immediate source operand:

  - immediate source can be presented either as an unsigned
    64-bit integer or pointer to data pattern in memory.
    There was no explicit pointer field defined in the union.

  - the byte ordering for 64-bit integer was not specified.
    Many fields have shorter lengths and byte ordering
    is crucial.

  - how the bit offset is applied to the immediate source
    field was not defined and documented.

  - 64-bit integer size is not enough to provide IPv6
    addresses.

In order to cover the issues and exclude any ambiguities
the following is done:

  - introduce the explicit pointer field
    in rte_flow_action_modify_data structure

  - replace the 64-bit unsigned integer with 16-byte array

  - update the modify field flow action documentation

Appropriate deprecation notice has been removed.

[1] commit 73b68f4c54a0 ("ethdev: introduce generic modify flow action")

Signed-off-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
2 years agoethdev: query proxy port to manage transfer flows
Ivan Malov [Thu, 14 Oct 2021 03:21:45 +0000 (06:21 +0300)]
ethdev: query proxy port to manage transfer flows

Not all DPDK ports in a given switching domain may have the
privilege to manage "transfer" flows. Add an API to find a
port with sufficient privileges by any port in the domain.

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Acked-by: Ori Kam <orika@nvidia.com>
2 years agonet/bnxt: fix build with debug macro
Ferruh Yigit [Wed, 13 Oct 2021 16:31:01 +0000 (17:31 +0100)]
net/bnxt: fix build with debug macro

Setting 'RTE_LIBRTE_BNXT_TRUFLOW_DEBUG' macro cause build error,
removing it.

Also with meson build system compile time debug macros should be
documented in driver documentation, since there is no other way to
figure out their existence.

Fixes: ad9eed0248ad ("net/bnxt: support flow template for Thor")
Cc: stable@dpdk.org
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
2 years agonet/softnic: fix useless address check
Ferruh Yigit [Mon, 4 Oct 2021 17:27:22 +0000 (18:27 +0100)]
net/softnic: fix useless address check

Reported by "gcc (GCC) 12.0.0 20211003 (experimental)":

./drivers/net/softnic/rte_eth_softnic_cli.c:
In function ‘tmgr_hierarchy_default’:
./drivers/net/softnic/rte_eth_softnic_cli.c:634:73:
error: the comparison will always evaluate as ‘true’ for the
address of ‘tc_valid’ will never be NULL [-Werror=address]
  634 | (&params->shared_shaper_id.tc_valid[0]) ? 1 : 0,
      |                                         ^

Fixing it by removing useless check.

Fixes: 1af2dc5111ce ("net/softnic: add command for default tmgr hierarchy")
Fixes: 5eb676d74fc8 ("net/softnic: add config flexibility to TM")
Cc: stable@dpdk.org
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Jasvinder Singh <jasvinder.singh@intel.com>
2 years agonet/sfc: support port representor flow item
Andrew Rybchenko [Wed, 13 Oct 2021 17:34:48 +0000 (20:34 +0300)]
net/sfc: support port representor flow item

Add support for item PORT_REPRESENTOR which should
be used instead of ambiguous item PORT_ID.

Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
2 years agonet/octeontx2: support port representor flow action
Andrew Rybchenko [Wed, 13 Oct 2021 17:34:47 +0000 (20:34 +0300)]
net/octeontx2: support port representor flow action

Action PORT_ID implementation assumes ingress only. Its semantics
suggests that support for equal action PORT_REPRESENTOR be added.

Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
2 years agonet/mlx5: support represented port flow action
Andrew Rybchenko [Wed, 13 Oct 2021 17:34:46 +0000 (20:34 +0300)]
net/mlx5: support represented port flow action

Semantics of the existing support for action PORT_ID suggests
that support for equal action REPRESENTED_PORT be implemented.

Helper functions keep port_id suffix since action
MLX5_FLOW_ACTION_PORT_ID is still used internally.

Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
2 years agonet/enic: support meta flow actions to overrule destinations
Andrew Rybchenko [Wed, 13 Oct 2021 17:34:45 +0000 (20:34 +0300)]
net/enic: support meta flow actions to overrule destinations

Add support for actions PORT_REPRESENTOR and REPRESENTED_PORT
based on the existing support for action PORT_ID.

Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Acked-by: Hyong Youb Kim <hyonkim@cisco.com>
2 years agonet/bnxt: support meta flow actions to overrule destinations
Andrew Rybchenko [Wed, 13 Oct 2021 17:34:44 +0000 (20:34 +0300)]
net/bnxt: support meta flow actions to overrule destinations

Add support for actions PORT_REPRESENTOR and REPRESENTED_PORT
based on the existing support for action PORT_ID.

Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
2 years agonet/bnxt: support meta flow items to match on traffic source
Andrew Rybchenko [Wed, 13 Oct 2021 17:34:43 +0000 (20:34 +0300)]
net/bnxt: support meta flow items to match on traffic source

Add support for items PORT_REPRESENTOR and REPRESENTED_PORT
based on the existing support for item PORT_ID.

The use of item PORT_ID depends on the specified direction attribute.
Items PORT_REPRESENTOR and REPRESENTED_PORT, in turn, define traffic
direction themselves. The former matches traffic from the driver's
vNIC. The latter matches packets from either a v-port (network) or
a VF's vNIC (if the driver's port is a VF representor).

Signed-off-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
2 years agoethdev: deprecate direction attributes in transfer flows
Ivan Malov [Wed, 13 Oct 2021 17:34:42 +0000 (20:34 +0300)]
ethdev: deprecate direction attributes in transfer flows

Attributes "ingress" and "egress" can only apply unambiguosly
to non-"transfer" flows. In "transfer" flows, the standpoint
is effectively shifted to the embedded switch. There can be
many different endpoints connected to the switch, so the
use of "ingress" / "egress" does not shed light on which
endpoints precisely can be considered as traffic sources.

Add relevant deprecation notices and suggest the use of precise
traffic source items (PORT_REPRESENTOR and REPRESENTED_PORT).

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Acked-by: Ori Kam <orika@nvidia.com>
Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
2 years agoethdev: deprecate hard-to-use or ambiguous items and actions
Ivan Malov [Wed, 13 Oct 2021 17:34:41 +0000 (20:34 +0300)]
ethdev: deprecate hard-to-use or ambiguous items and actions

PF, VF and PHY_PORT require that applications have extra
knowledge of the underlying NIC and thus are hard to use.
Also, the corresponding items depend on the direction
attribute (ingress / egress), which complicates their
use in applications and interpretation in PMDs.

The concept of PORT_ID is ambiguous as it doesn't say whether
the port in question is an ethdev or the represented entity.

Items and actions PORT_REPRESENTOR, REPRESENTED_PORT
should be used instead.

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Acked-by: Ori Kam <orika@nvidia.com>
Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
2 years agoethdev: add represented port action to flow API
Ivan Malov [Wed, 13 Oct 2021 17:34:40 +0000 (20:34 +0300)]
ethdev: add represented port action to flow API

For use in "transfer" flows. Supposed to send matching traffic to the
entity represented by the given ethdev, at embedded switch level.
Such an entity can be a network (via a network port), a guest
machine (via a VF) or another ethdev in the same application.

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Acked-by: Ori Kam <orika@nvidia.com>
Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
2 years agoethdev: add port representor action to flow API
Ivan Malov [Wed, 13 Oct 2021 17:34:39 +0000 (20:34 +0300)]
ethdev: add port representor action to flow API

For use in "transfer" flows. Supposed to send matching traffic to
the given ethdev (to the application), at embedded switch level.

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Acked-by: Ori Kam <orika@nvidia.com>
Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
2 years agoethdev: add represented port item to flow API
Ivan Malov [Wed, 13 Oct 2021 17:34:38 +0000 (20:34 +0300)]
ethdev: add represented port item to flow API

For use in "transfer" flows. Supposed to match traffic entering the
embedded switch from the entity represented by the given ethdev.
Such an entity can be a network (via a network port), a guest
machine (via a VF) or another ethdev in the same application.

Must not be combined with direction attributes.

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Acked-by: Ori Kam <orika@nvidia.com>
Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
2 years agoethdev: add port representor item to flow API
Ivan Malov [Wed, 13 Oct 2021 17:34:37 +0000 (20:34 +0300)]
ethdev: add port representor item to flow API

For use in "transfer" flows. Supposed to match traffic
entering the embedded switch from the given ethdev.

Must not be combined with direction attributes.

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Acked-by: Ori Kam <orika@nvidia.com>
Acked-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
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>