dpdk.git
4 years agodoc: mark Armv8 as supported by ena PMD
Michal Krawczyk [Fri, 30 Oct 2020 11:31:20 +0000 (12:31 +0100)]
doc: mark Armv8 as supported by ena PMD

The ARMv8 platform support was tested and works fine with the ENA PMD.

It can be used on the AWS a1.* and m6g.* instances.

The ARMv8 support in ENA is at least from v19.11, where the VFIO DPDK
driver was fixed to work with 32-bit applications compiled for arm.

Signed-off-by: Michal Krawczyk <mk@semihalf.com>
Reviewed-by: Igor Chauskin <igorch@amazon.com>
Reviewed-by: Guy Tzalik <gtzalik@amazon.com>
4 years agonet/ena/base: align IO CQ allocation to 4K
Michal Krawczyk [Fri, 30 Oct 2020 11:31:19 +0000 (12:31 +0100)]
net/ena/base: align IO CQ allocation to 4K

Latest generation HW requires IO completion queue descriptors to be
aligned to a 4K in order to achieve the best performance.

Because of that, the new allocation macros were added, which allows
driver to allocate the memory with specified alignment.

The previous allocation macros are now wrappers around the macros
doing the alignment, with the alignment value equal to cacheline size.

Fixes: b68309be44c0 ("net/ena/base: update communication layer for the ENAv2")
Cc: stable@dpdk.org
Signed-off-by: Ido Segev <idose@amazon.com>
Signed-off-by: Michal Krawczyk <mk@semihalf.com>
Reviewed-by: Igor Chauskin <igorch@amazon.com>
Reviewed-by: Amit Bernstein <amitbern@amazon.com>
4 years agonet/ena: change name of supported PCI device IDs
Michal Krawczyk [Fri, 30 Oct 2020 11:31:18 +0000 (12:31 +0100)]
net/ena: change name of supported PCI device IDs

The ID 0xEC21 is not associated with LLQ feature of the device, so it
would be misleading for the user. Because of that, the current
identifier is more precise.

Together with code update, the documentation was changed to reflect
current changes

Signed-off-by: Michal Krawczyk <mk@semihalf.com>
Reviewed-by: Igor Chauskin <igorch@amazon.com>
Reviewed-by: Guy Tzalik <gtzalik@amazon.com>
4 years agonet/ena: fix setting Rx checksum flags in mbuf
Michal Krawczyk [Fri, 30 Oct 2020 11:31:17 +0000 (12:31 +0100)]
net/ena: fix setting Rx checksum flags in mbuf

The driver was never setting PKT_RX_*_CKSUM_GOOD flags, so the only way
of checking if the checksum was checked was by testing for the
PKT_RX_*_CKSUM_BAD. In that situation, the application couldn't detect
if the checksum was valid or unknown, as unknown flag is equal to 0.

Moreover, the l3_csum_err value is only valid if the l3_proto is
indicating IPv4, so it shouldn't be checked for other protocols.

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: Guy Tzalik <gtzalik@amazon.com>
4 years agonet/ena: fix getting xstats global stats offset
Michal Krawczyk [Fri, 30 Oct 2020 11:31:16 +0000 (12:31 +0100)]
net/ena: fix getting xstats global stats offset

There was a bug in a code, which was reading stat_offset value from the
ena_stats_rx_strings array instead of ena_stats_global_strings.

It wasn't causing real problems just because ena_stats_rx_strings was
not smaller than ena_stats_global_strings and both arrays hold the same
offsets.

Fixes: 7830e905b7c9 ("net/ena: expose extended stats")
Cc: stable@dpdk.org
Signed-off-by: Michal Krawczyk <mk@semihalf.com>
Reviewed-by: Igor Chauskin <igorch@amazon.com>
Reviewed-by: Guy Tzalik <gtzalik@amazon.com>
4 years agonet/enic: fix header sizes when copying flow patterns
Hyong Youb Kim [Fri, 30 Oct 2020 07:27:49 +0000 (00:27 -0700)]
net/enic: fix header sizes when copying flow patterns

Several functions use sizeof(struct rte_flow_item_eth) and
sizeof(struct rte_flow_item_ipv6) when copying headers. These sizes
used to coincide with the sizes of rte_ether_hdr and
rte_ipv6_hdr. But, with recently added fields, rte_flow_item_eth and
rte_flow_item_ipv6 have grown in size. Use sizeof(rte_ether_hdr) and
sizeof(rte_ipv6_hdr) instead.

Coverity issue: 363572, 363573
Fixes: ea7768b5bba8 ("net/enic: add flow implementation based on Flow Manager API")
Cc: stable@dpdk.org
Signed-off-by: Hyong Youb Kim <hyonkim@cisco.com>
Reviewed-by: John Daley <johndale@cisco.com>
4 years agonet/hns3: fix enabling SVE Rx/Tx
Lijun Ou [Thu, 29 Oct 2020 12:51:57 +0000 (20:51 +0800)]
net/hns3: fix enabling SVE Rx/Tx

The ARM SVE vector implementation defined macro is
__ARM_FEATURE_SVE and RTE_MACHINE_CPUFLAG macros
have replaced by regular compiler macros.

Besides, we remove the unused macro RTE_LIBRTE_HNS3_INC_VECTOR_SVE.

Fixes: 952ebacce4f2 ("net/hns3: support SVE Rx")

Signed-off-by: Lijun Ou <oulijun@huawei.com>
4 years agonet/hns3: check setting VF PCI bus return value
Hongbo Zheng [Thu, 29 Oct 2020 12:51:56 +0000 (20:51 +0800)]
net/hns3: check setting VF PCI bus return value

Currently hns3vf_reinit_dev only judge whether the return value of
setting PCI bus function is not 0, while it will return a negative
value when execute failed.

Fixes: 243651cb6c8c ("net/hns3: check PCI config space reads")
Cc: stable@dpdk.org
Signed-off-by: Hongbo Zheng <zhenghongbo3@huawei.com>
Signed-off-by: Lijun Ou <oulijun@huawei.com>
4 years agonet/hns3: fix clearing HW ring after queue stop
Chengchang Tang [Thu, 29 Oct 2020 12:51:55 +0000 (20:51 +0800)]
net/hns3: fix clearing HW ring after queue stop

Currently, the rx HW ring is not cleared after queue stop.
When there are packets remaining in the HW rings and the
queues have been stopped, if upper layer user calls the
rx_burst function at this time, an illegal memory access
will occur due to the sw rings has been released.

This patch fix this by reset the sw ring after disable the
queue.

Fixes: fa29fe45a7b4 ("net/hns3: support queue start and stop")
Cc: stable@dpdk.org
Signed-off-by: Chengchang Tang <tangchengchang@huawei.com>
Signed-off-by: Lijun Ou <oulijun@huawei.com>
4 years agonet/hns3: fix data type to store queue number
Huisong Li [Thu, 29 Oct 2020 12:51:54 +0000 (20:51 +0800)]
net/hns3: fix data type to store queue number

Currently, u8 type variable is used to control to release fake queues in
hns3_fake_rx/tx_queue_config function. Although there is no case in
which more than 256 fake queues are created in hns3 network engine, it
is unreasonable to compare u8 variable with u16 variable.

Fixes: a951c1ed3ab5 ("net/hns3: support different numbers of Rx and Tx queues")
Cc: stable@dpdk.org
Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Lijun Ou <oulijun@huawei.com>
4 years agonet/hns3: fix unchecked return value
Hongbo Zheng [Thu, 29 Oct 2020 12:51:53 +0000 (20:51 +0800)]
net/hns3: fix unchecked return value

There are coverity defects related "calling
hns3_reset_all_tqps without checking return value
in hns3_do_start".

This patch fixes the warning by add "void" declaration
because here is exception handling, hns3_reset_all_tqps
will have the corresponding error message if it is
handled incorrectly, so it is not necessary to check
hns3_reset_all_tqps return value, here keep ret as the
error code causing the exception.

Coverity issue: 363048
Fixes: fa29fe45a7b4 ("net/hns3: support queue start and stop")
Cc: stable@dpdk.org
Signed-off-by: Hongbo Zheng <zhenghongbo3@huawei.com>
Signed-off-by: Lijun Ou <oulijun@huawei.com>
4 years agonet/hns3: fix packet type report in Rx
Chengchang Tang [Thu, 29 Oct 2020 12:51:52 +0000 (20:51 +0800)]
net/hns3: fix packet type report in Rx

Currently, hns3 supports recognizing a lot of ptypes, but most
tunnel packet types are not reported to the API
rte_eth_dev_get_supported_ptypes.

And there are some errors in L2 and L3 packet recognition. The
ARP and LLDP are classified to L3 field in RX descriptor. So,
the ptype of LLDP and ARP packets will be set twice. And ptypes
are assigned by bitwise OR, which will eventually cause the ptype
result to be incorrect.

Besides, when a packet with only L2 header, its ptype will not
report by hns3 PMD. This is because the L2/L3 ptype table is not
initialized properly. In this case, the table query result is 0
by default.

As a result, it fixes missing supported ptypes and the mistake in
L2/L3 packet recognition and the unreported L2 packet ptype by
reporting its L2 type when the L3 type unrecognized..

Fixes: bba636698316 ("net/hns3: support Rx/Tx and related operations")
Cc: stable@dpdk.org
Signed-off-by: Chengchang Tang <tangchengchang@huawei.com>
Signed-off-by: Lijun Ou <oulijun@huawei.com>
4 years agonet/hns3: fix RSS max queue id allowed in multi-TC
Huisong Li [Thu, 29 Oct 2020 12:51:51 +0000 (20:51 +0800)]
net/hns3: fix RSS max queue id allowed in multi-TC

Currently, driver uses the maximum number of queues configured by user
as the maximum queue id that can be specified by the RSS rule or the
reta_update api. It is unreasonable and may trigger an incorrect
behavior in the multi-TC scenario. The driver must ensure that the queue
id configured in the redirection table must be within the range of the
number of queues allocated to a TC.

Fixes: c37ca66f2b27 ("net/hns3: support RSS")
Cc: stable@dpdk.org
Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Lijun Ou <oulijun@huawei.com>
4 years agonet/hns3: get number of used descriptors of Rx queue
Lijun Ou [Thu, 29 Oct 2020 12:51:50 +0000 (20:51 +0800)]
net/hns3: get number of used descriptors of Rx queue

Implement the available and used rxd number count function.

In Kunpeng series, the NIC hardware supports to read the bd numbers
which wait processed from the hardware FBD (Full Buffer Descriptor),
and the driver maintains the bd number to be written back hardware.
Compare the number of FBDs with the number of BDs to be written back to
the hardware.

The number of used descriptors of a rx queue is computed as follows:
The fbd numbers of reading from FBD register plus the bd numbers to be
written back to hardware maintained by the driver.

Signed-off-by: Lijun Ou <oulijun@huawei.com>
4 years agonet/iavf: support flex desc metadata extraction
Jeff Guo [Fri, 30 Oct 2020 08:40:30 +0000 (16:40 +0800)]
net/iavf: support flex desc metadata extraction

Enable metadata extraction for flexible descriptors in AVF, that would
allow network function directly get metadata without additional parsing
which would reduce the CPU cost for VFs. The enabling metadata
extractions involve the metadata of VLAN/IPv4/IPv6/IPv6-FLOW/TCP/MPLS
flexible descriptors, and the VF could negotiate the capability of
the flexible descriptor with PF and correspondingly configure the
specific offload at receiving queues.

Signed-off-by: Jeff Guo <jia.guo@intel.com>
Acked-by: Haiyue Wang <haiyue.wang@intel.com>
4 years agonet/ice: rename dynamic mbuf name
Haiyue Wang [Tue, 27 Oct 2020 01:23:28 +0000 (09:23 +0800)]
net/ice: rename dynamic mbuf name

Rename the dynamic mbuf name to 'intel_pmd_xxx' format, so that the
Intel PMD which has the protocol extraction feature will share the
same dynamic field/flags space in mbuf.

Signed-off-by: Haiyue Wang <haiyue.wang@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
4 years agodoc: add mlx5 header to API index
Bing Zhao [Fri, 30 Oct 2020 09:29:22 +0000 (17:29 +0800)]
doc: add mlx5 header to API index

The file "rte_pmd_mlx5.h" is used to provide mlx5 PMD specific APIs
and it needs to be included in the document generation.

Signed-off-by: Bing Zhao <bingz@nvidia.com>
Reviewed-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Ori Kam <orika@nvidia.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agonet/af_xdp: fix integer overflow in umem size calculation
Martin Weiser [Thu, 29 Oct 2020 11:25:42 +0000 (12:25 +0100)]
net/af_xdp: fix integer overflow in umem size calculation

The multiplication of two u32 integers may cause an overflow with large
mempool sizes.

Fixes: 74b46340e2d4 ("net/af_xdp: support shared UMEM")

Signed-off-by: Martin Weiser <martin.weiser@allegro-packets.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agoapp/testpmd: fix eCPRI command line style
Bing Zhao [Thu, 29 Oct 2020 05:35:25 +0000 (13:35 +0800)]
app/testpmd: fix eCPRI command line style

In the current implementation of eCPRI flow item parsing of the CLI,
the token items in the list are not connected properly.
A command containing "rtc_ctrl rtc_id spec 14857 rtc_id mask 0xff00"
will be considered invalid. In order to support spec with mask, the
common entry needs to be typed twice and the whole command will be
too long.
By changing the token lists, it could support spec with mask without
backing from the entry of the item.

Fixes: 17d103cc9365 ("app/testpmd: add eCPRI in flow creation patterns")
Cc: stable@dpdk.org
Signed-off-by: Bing Zhao <bingz@nvidia.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agoethdev: document Rx packet number requirement for vector Rx
Morten Brørup [Mon, 14 Sep 2020 11:05:11 +0000 (13:05 +0200)]
ethdev: document Rx packet number requirement for vector Rx

Updated description of rte_eth_rx_burst() to reflect what drivers,
when using vector instructions, expect from nb_pkts.

Also discussed on the mailing list here:
http://inbox.dpdk.org/dev/98CBD80474FA8B44BF855DF32C47DC35C61257@smartserver.smartshare.dk/

Signed-off-by: Morten Brørup <mb@smartsharesystems.com>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
4 years agonet/sfc: support aarch64 architecture
Andrew Rybchenko [Thu, 22 Oct 2020 12:24:07 +0000 (13:24 +0100)]
net/sfc: support aarch64 architecture

Enable the PMD build on aarch64.

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
4 years agonet/sfc: use compat for 128-bit unsigned integer
Andrew Rybchenko [Thu, 22 Oct 2020 12:24:06 +0000 (13:24 +0100)]
net/sfc: use compat for 128-bit unsigned integer

Prepare to support ARMv8.

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
4 years agocommon/sfc_efx: introduce 128-bit unsigned integer compat
Andrew Rybchenko [Thu, 22 Oct 2020 12:24:05 +0000 (13:24 +0100)]
common/sfc_efx: introduce 128-bit unsigned integer compat

Intel SSE has __m128i, but ARMv8 has __uint128_t. So, add compat
efsys_uint128_t to be used in driver source and have either __u128i
or __uint128_t behind.

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
4 years agonet/hns3: enable RSS for IPv6-SCTP dst/src port fields
Lijun Ou [Wed, 21 Oct 2020 08:54:43 +0000 (16:54 +0800)]
net/hns3: enable RSS for IPv6-SCTP dst/src port fields

For Kunpeng930 NIC hardware, it supports to use dst/src port to
RSS hash for ipv6-sctp packet type. However, the Kunpeng920 NIC
hardware is different with it. The Kunpeng920 NIC only supports
dst/src ip to RSS hash for ipv6-sctp packet type.

Signed-off-by: Lijun Ou <oulijun@huawei.com>
4 years agomaintainers: update for hns3
Lijun Ou [Mon, 19 Oct 2020 14:27:10 +0000 (22:27 +0800)]
maintainers: update for hns3

I am a new hns3 pmd developer and reviewer for upstreaming hns3
pmd driver. So I want to help out here as well.

Signed-off-by: Lijun Ou <oulijun@huawei.com>
Acked-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
4 years agoethdev: move L2 tunnel config structure to ixgbe driver
Andrew Rybchenko [Thu, 22 Oct 2020 10:06:20 +0000 (11:06 +0100)]
ethdev: move L2 tunnel config structure to ixgbe driver

net/ixgbe driver is the only user of the struct rte_eth_l2_tunnel_conf.
Move it to the driver and use ixgbe_ prefix instead of rte_eth_.

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Acked-by: Haiyue Wang <haiyue.wang@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agoethdev: remove L2 tunnel offload control API
Andrew Rybchenko [Thu, 22 Oct 2020 10:06:19 +0000 (11:06 +0100)]
ethdev: remove L2 tunnel offload control API

Remove rte_eth_dev_l2_tunnel_offload_set() and corresponding
ethdev driver operation.

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Acked-by: Haiyue Wang <haiyue.wang@intel.com>
Acked-by: Jeff Guo <jia.guo@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agoethdev: remove API to config L2 tunnel EtherType
Andrew Rybchenko [Thu, 22 Oct 2020 10:06:18 +0000 (11:06 +0100)]
ethdev: remove API to config L2 tunnel EtherType

Remove rte_eth_dev_l2_tunnel_eth_type_conf() and corresponding
ethdev driver operation.

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Acked-by: Haiyue Wang <haiyue.wang@intel.com>
Acked-by: Jeff Guo <jia.guo@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agoethdev: remove legacy filter API functions
Andrew Rybchenko [Thu, 22 Oct 2020 09:42:37 +0000 (10:42 +0100)]
ethdev: remove legacy filter API functions

The legacy filter API, including rte_eth_dev_filter_supported() and
rte_eth_dev_filter_ctrl() is removed. Flow API should be used.

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agoapp/testpmd: remove command to set FDIR flexible filter mask
Andrew Rybchenko [Thu, 22 Oct 2020 09:42:36 +0000 (10:42 +0100)]
app/testpmd: remove command to set FDIR flexible filter mask

The command uses FDIR filter information get API which
is not supported any more.

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agoethdev: remove legacy FDIR filter type support
Andrew Rybchenko [Thu, 22 Oct 2020 09:42:35 +0000 (10:42 +0100)]
ethdev: remove legacy FDIR filter type support

Instead of FDIR filters RTE flow API should be used.

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Acked-by: Haiyue Wang <haiyue.wang@intel.com>
Acked-by: Hyong Youb Kim <hyonkim@cisco.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agoethdev: remove legacy global filter configuration support
Andrew Rybchenko [Thu, 22 Oct 2020 09:42:34 +0000 (10:42 +0100)]
ethdev: remove legacy global filter configuration support

Global filter configuration request was supported by net/i40e
driver only to configure GRE key length.

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agoethdev: remove legacy L2 tunnel filter type support
Andrew Rybchenko [Thu, 22 Oct 2020 09:42:33 +0000 (10:42 +0100)]
ethdev: remove legacy L2 tunnel filter type support

Instead of L2 tunnel filter RTE flow API should be used.

Preserve RTE_ETH_FILTER_L2_TUNNEL since it is used in drivers
internally in RTE flow API support.

rte_eth_l2_tunnel_conf structure is used in other ethdev API
functions.

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Acked-by: Haiyue Wang <haiyue.wang@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agoethdev: remove legacy HASH filter type support
Andrew Rybchenko [Thu, 22 Oct 2020 09:42:32 +0000 (10:42 +0100)]
ethdev: remove legacy HASH filter type support

Instead of HASH filter RTE flow API should be used.

Preserve RTE_ETH_FILTER_HASH since it is used in drivers
internally in RTE flow API support.

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agoethdev: remove legacy tunnel filter type support
Andrew Rybchenko [Thu, 22 Oct 2020 09:42:31 +0000 (10:42 +0100)]
ethdev: remove legacy tunnel filter type support

Instead of TUNNEL filter RTE flow API should be used.

Move corresponding defines and helper structure to ethdev
driver interface since it is still used by drivers internally.

Preserve RTE_ETH_FILTER_TUNNEL because of usage in drivers.

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agoethdev: remove legacy N-tuple filter type support
Andrew Rybchenko [Thu, 22 Oct 2020 09:42:30 +0000 (10:42 +0100)]
ethdev: remove legacy N-tuple filter type support

Instead of N-tuple filter RTE flow API should be used.

Preserve struct rte_eth_ntuple_filter in ethdev API since
the structure and related defines are used in flow classify
library and a number of drivers.

Preserve RTE_ETH_FILTER_NTUPLE because of usage in drivers.

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Acked-by: Haiyue Wang <haiyue.wang@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agoethdev: remove legacy SYN filter type support
Andrew Rybchenko [Thu, 22 Oct 2020 09:42:29 +0000 (10:42 +0100)]
ethdev: remove legacy SYN filter type support

Instead of SYN filter RTE flow API should be used.

Move corresponding definitions to ethdev internal driver API
since it is used by drivers internally.
Preserve RTE_ETH_FILTER_SYN because of it as well.

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Acked-by: Haiyue Wang <haiyue.wang@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agoethdev: move flexible filter type to e1000 driver
Andrew Rybchenko [Thu, 22 Oct 2020 09:42:28 +0000 (10:42 +0100)]
ethdev: move flexible filter type to e1000 driver

net/e1000 driver is the only user of the struct rte_eth_flex_filter
and helper defines.  Move it to the driver and use igb_ prefix
instead of rte_eth_.

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Acked-by: Haiyue Wang <haiyue.wang@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agoethdev: remove legacy flexible filter type support
Andrew Rybchenko [Thu, 22 Oct 2020 09:42:27 +0000 (10:42 +0100)]
ethdev: remove legacy flexible filter type support

Instead of FLEXIBLE filter RTE flow API should be used.

Temporarily preserve helper defines in public interface.

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Acked-by: Haiyue Wang <haiyue.wang@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agoethdev: remove legacy EtherType filter type support
Andrew Rybchenko [Thu, 22 Oct 2020 09:42:26 +0000 (10:42 +0100)]
ethdev: remove legacy EtherType filter type support

Instead of EtherType filter RTE flow API should be used.

Move corresponding definitions to ethdev internal driver API
since it is used by drivers internally.
Preserve RTE_ETH_FILTER_ETHERTYPE because of it as well.

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Acked-by: Haiyue Wang <haiyue.wang@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agoethdev: move MAC filter type to i40e driver
Andrew Rybchenko [Thu, 22 Oct 2020 09:42:25 +0000 (10:42 +0100)]
ethdev: move MAC filter type to i40e driver

net/i40e driver is the only user of the enum rte_mac_filter_type.
Move the define to the driver and use i40e_ prefix instead of rte_.

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agoethdev: remove legacy MACVLAN filter type support
Andrew Rybchenko [Thu, 22 Oct 2020 09:42:24 +0000 (10:42 +0100)]
ethdev: remove legacy MACVLAN filter type support

Instead of MACVLAN filter RTE flow API should be used.

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agonet/vdev_netvsc: fix device probing error flow
Long Li [Thu, 22 Oct 2020 08:11:34 +0000 (01:11 -0700)]
net/vdev_netvsc: fix device probing error flow

If a device probe fails, the alarm is canceled and will no longer work
for previously probed devices.

Fix this by checking if alarm is necessary at the end of each device
probe.  Reset the alarm if there are vdev_netvsc_ctx created.

Fixes: e7dc5d7becc5 ("net/vdev_netvsc: implement core functionality")
Cc: stable@dpdk.org
Signed-off-by: Long Li <longli@microsoft.com>
Acked-by: Matan Azrad <matan@nvidia.com>
4 years agonet/txgbe: prevent driver forcing application to exit
Jiawen Wu [Wed, 28 Oct 2020 02:29:57 +0000 (10:29 +0800)]
net/txgbe: prevent driver forcing application to exit

Replace the 'rte_panic()' with an error return.
Also change the type of the calling function.

Fixes: a6712cd029a4 ("net/txgbe: add PF module init and uninit for SRIOV")
Cc: stable@dpdk.org
Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com>
4 years agovdpa/mlx5: specify lag port affinity
Xueming Li [Wed, 28 Oct 2020 10:44:39 +0000 (10:44 +0000)]
vdpa/mlx5: specify lag port affinity

If set TIS lag port affinity to auto, firmware assign port affinity on
each creation with Round Robin. In case of 2 PFs, if create virtq,
destroy and create again, then each virtq will get same port affinity.

To resolve this fw limitation, this patch sets create TIS with specified
affinity for each PF.

Fixes: bff735011078 ("vdpa/mlx5: prepare virtio queues")
Cc: stable@dpdk.org
Signed-off-by: Xueming Li <xuemingl@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
4 years agocommon/mlx5: get number of ports that can be bonded
Xueming Li [Wed, 28 Oct 2020 10:44:38 +0000 (10:44 +0000)]
common/mlx5: get number of ports that can be bonded

Get HCA capability: number of physical ports that can be bonded.

Cc: stable@dpdk.org
Signed-off-by: Xueming Li <xuemingl@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
4 years agovhost: fix uninitialized local variable
Patrick Fu [Tue, 27 Oct 2020 08:50:19 +0000 (16:50 +0800)]
vhost: fix uninitialized local variable

This patch initializes a local parameter in async data path to avoid
compiler warnings.

Fixes: cd6760da1076 ("vhost: introduce async enqueue for split ring")
Cc: stable@dpdk.org
Signed-off-by: Patrick Fu <patrick.fu@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
4 years agovdpa/mlx5: handle hardware error
Xueming Li [Tue, 27 Oct 2020 08:28:45 +0000 (08:28 +0000)]
vdpa/mlx5: handle hardware error

When hardware error happens, vdpa didn't get such information and leave
driver in silent: working state but no response.

This patch subscribes firmware virtq error event and try to recover max
3 times in 3 seconds, stop virtq if max retry number reached.

When error happens, PMD log in warning level. If failed to recover,
outputs error log. Query virtq statistics to get error counters report.

Acked-by: Matan Azrad <matan@nvidia.com>
Signed-off-by: Xueming Li <xuemingl@nvidia.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
4 years agocommon/mlx5: add virtq attributes error fields
Xueming Li [Tue, 27 Oct 2020 08:28:44 +0000 (08:28 +0000)]
common/mlx5: add virtq attributes error fields

Add the needed fields for virtq DevX object to read the error state.

Acked-by: Matan Azrad <matan@nvidia.com>
Signed-off-by: Xueming Li <xuemingl@nvidia.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
4 years agovhost: fix guest/host physical address conversion
Patrick Fu [Tue, 27 Oct 2020 02:06:08 +0000 (10:06 +0800)]
vhost: fix guest/host physical address conversion

gpa_to_hpa() function almost always fails due to the wrong setup of
the binary tree search key. Since there has already been a similar
function gpa_to_first_hpa() available in the vhost, instead of fixing
the issue in its original logic, gpa_to_hpa() function is rewritten to
be a wrapper of the gpa_to_first_hpa() to avoid code redundancy.

Fixes: e246896178e6 ("vhost: get guest/host physical address mappings")
Fixes: faa9867c4da2 ("vhost: use binary search in address conversion")
Cc: stable@dpdk.org
Signed-off-by: Patrick Fu <patrick.fu@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
4 years agonet/virtio-user: set status on socket reconnect
Adrian Moreno [Mon, 26 Oct 2020 16:39:30 +0000 (17:39 +0100)]
net/virtio-user: set status on socket reconnect

Newer vhost-user backends will rely on SET_STATUS to start the device
so this required to support them.

Fixes: 57912824615f ("net/virtio-user: support vhost status setting")
Cc: stable@dpdk.org
Signed-off-by: Adrian Moreno <amorenoz@redhat.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
4 years agonet/virtio-user: do not assume vhost status feature
Adrian Moreno [Mon, 26 Oct 2020 16:39:29 +0000 (17:39 +0100)]
net/virtio-user: do not assume vhost status feature

There are some status reads and updates that need to happen before the
protocol features are negotiated. Therefore, assuming the backend does
support this feature can lead to failures.

On server mode, do not assume the backend supports
VHOST_USER_PROTOCOL_F_STATUS. Activate it back on reconnection and
clear it on disconnection.

Fixes: 57912824615f ("net/virtio-user: support vhost status setting")
Cc: stable@dpdk.org
Signed-off-by: Adrian Moreno <amorenoz@redhat.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
4 years agonet/virtio-user: lock-protect status updates
Adrian Moreno [Mon, 26 Oct 2020 16:39:28 +0000 (17:39 +0100)]
net/virtio-user: lock-protect status updates

In order to safely set and get the device status from different
threads (e.g: interrupt handlers).

Signed-off-by: Adrian Moreno <amorenoz@redhat.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
4 years agonet/virtio-user: ignore result if status is unsupported
Adrian Moreno [Mon, 26 Oct 2020 16:39:27 +0000 (17:39 +0100)]
net/virtio-user: ignore result if status is unsupported

GET/SET STATUS is an optional feature, so it may not be negotiated. In
that case, the VIRTIO_GET_STATUS call will not update the status (given
as a pointer argument). Failing to identify this case would lead to
undefined behavior as the device status will be updated with the value
of a stack-allocated variable.

To fix this, return ENOTSUP if the feature is not supported and, in that
case, don't update device status.

Fixes: 44102e6298e7 ("net/virtio: check protocol feature in user backend")
Cc stable@dpdk.org

Signed-off-by: Adrian Moreno <amorenoz@redhat.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
4 years agonet/virtio-user: do not assume features are negotiated
Adrian Moreno [Mon, 26 Oct 2020 16:39:26 +0000 (17:39 +0100)]
net/virtio-user: do not assume features are negotiated

According to the virtio spec, ACK and DRIVER status bits should be set
before feature negotiation.

However, until the protocol features are negotiated, the driver does not
know if the device actually supports those vhost-user messages.
Therefore, until FEATURES_OK is set, the GET/SET_STATUS messages should
not be sent.

Fixes: 57912824615f ("net/virtio-user: support vhost status setting")
Cc: stable@dpdk.org
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Signed-off-by: Adrian Moreno <amorenoz@redhat.com>
4 years agonet/virtio-user: fix backend selection if stat fails
Adrian Moreno [Mon, 26 Oct 2020 16:39:25 +0000 (17:39 +0100)]
net/virtio-user: fix backend selection if stat fails

If stat fails because the file does not exist, it means that
the backend must be vhost-user in server mode.

Also, log the detected backend type.

Bugzilla ID: 559
Fixes: f908b22ea47a ("net/virtio: move backend type selection to ethdev")
Cc: stable@dpdk.org
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Acked-by: Kevin Traynor <ktraynor@redhat.com>
Signed-off-by: Adrian Moreno <amorenoz@redhat.com>
4 years agonet/mlx5: use C11 atomics in packet scheduling
Viacheslav Ovsiienko [Wed, 28 Oct 2020 12:44:47 +0000 (12:44 +0000)]
net/mlx5: use C11 atomics in packet scheduling

The rte_atomic API is deprecated and needs to be replaced with
C11 atomic builtins. Use the relaxed ordering and explicit
memory barrier for Clock Queue and timestamps synchronization.

Signed-off-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
4 years agonet/mlx5: remove shared context lock
Xueming Li [Wed, 28 Oct 2020 09:33:53 +0000 (17:33 +0800)]
net/mlx5: remove shared context lock

To support multi-thread flow insertion, this patch removes shared data
lock since all resources should support concurrent protection.

Signed-off-by: Xueming Li <xuemingl@nvidia.com>
Signed-off-by: Suanming Mou <suanmingm@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
4 years agonet/mlx5: make shared action list thread safe
Suanming Mou [Wed, 28 Oct 2020 09:33:52 +0000 (17:33 +0800)]
net/mlx5: make shared action list thread safe

This commit uses spinlock to protect the shared action list in multiple
thread.

Signed-off-by: Suanming Mou <suanmingm@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
4 years agonet/mlx5: make tunnel hub list thread safe
Suanming Mou [Wed, 28 Oct 2020 09:33:51 +0000 (17:33 +0800)]
net/mlx5: make tunnel hub list thread safe

This commit uses spinlock to protect the tunnel hub list in multiple
thread.

Signed-off-by: Suanming Mou <suanmingm@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
4 years agonet/mlx5: remove unused hash list operations
Suanming Mou [Wed, 28 Oct 2020 09:33:50 +0000 (17:33 +0800)]
net/mlx5: remove unused hash list operations

In previous commits the hash list objects have been converted
to new thread safe hash list. The legacy hash list code can be
removed now.

Signed-off-by: Suanming Mou <suanmingm@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
4 years agonet/mlx5: make tunnel offloading table thread safe
Suanming Mou [Wed, 28 Oct 2020 09:33:49 +0000 (17:33 +0800)]
net/mlx5: make tunnel offloading table thread safe

To support multi-thread flow insertion, this patch updates tunnel
offloading hash table to use thread safe hash list.

Signed-off-by: Suanming Mou <suanmingm@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
4 years agonet/mlx5: make sample and mirror action thread safe
Suanming Mou [Wed, 28 Oct 2020 09:33:48 +0000 (17:33 +0800)]
net/mlx5: make sample and mirror action thread safe

This commit uses cache list to make sample and mirror action thread
safe.

Signed-off-by: Suanming Mou <suanmingm@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
4 years agonet/mlx5: fix sample register error flow
Suanming Mou [Wed, 28 Oct 2020 09:33:47 +0000 (17:33 +0800)]
net/mlx5: fix sample register error flow

Currently, sample flow need to prepare and register the sub-actions
before sample action is created.

Once the same sample action exists, the sub-actions registered by
the second flow should be released, or these sub-actions will be
leaked. Since the exist sample action only release these same
sub-actions when the sample action itself releases.

When same sample action exists, call the sub-action release function
for the later flow to release the redundant prepared sub-actions.

Fixes: 0756228b2704 ("net/mlx5: update translate function for sample action")

Signed-off-by: Suanming Mou <suanmingm@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
4 years agonet/mlx5: simplify sample attributes
Suanming Mou [Wed, 28 Oct 2020 09:33:46 +0000 (17:33 +0800)]
net/mlx5: simplify sample attributes

Currently, the sample action resource already has ft_type to indicate
the action domain attribute, the extra flow attributes parameter can
be optimized.

This commit uses action resource ty_type as domain attribute instead of
the flow attribute.

Signed-off-by: Suanming Mou <suanmingm@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
4 years agonet/mlx5: make push VLAN action cache thread safe
Xueming Li [Wed, 28 Oct 2020 09:33:45 +0000 (17:33 +0800)]
net/mlx5: make push VLAN action cache thread safe

To support multi-thread flow insertion, this patch converts push VLAN
action cache list to thread safe cache list.

Signed-off-by: Xueming Li <xuemingl@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
4 years agonet/mlx5: make port ID action cache thread safe
Xueming Li [Wed, 28 Oct 2020 09:33:44 +0000 (17:33 +0800)]
net/mlx5: make port ID action cache thread safe

To support multi-thread flow insertion, this patch convert port id
action cache list to thread safe cache list.

Signed-off-by: Xueming Li <xuemingl@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
4 years agonet/mlx5: make matcher list thread safe
Xueming Li [Wed, 28 Oct 2020 09:33:43 +0000 (17:33 +0800)]
net/mlx5: make matcher list thread safe

To support multi-thread flow insertion, this path converts matcher list
to use thread safe cache list API.

Signed-off-by: Xueming Li <xuemingl@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
4 years agonet/mlx5: make Rx queue thread safe
Suanming Mou [Wed, 28 Oct 2020 09:33:42 +0000 (17:33 +0800)]
net/mlx5: make Rx queue thread safe

This commit applies the cache linked list to Rx queue to make it thread
safe.

Signed-off-by: Suanming Mou <suanmingm@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
4 years agonet/mlx5: optimize shared RSS list operation
Suanming Mou [Wed, 28 Oct 2020 09:33:41 +0000 (17:33 +0800)]
net/mlx5: optimize shared RSS list operation

When create shared RSS hrxq, the hrxq will be created directly, no hrxq
will be reused.

In this case, add the shared RSS hrxq to the queue list is redundant.
And it also hurts the generic queue lookup.

This commit avoids add the shared RSS hrxq to the queue list.

Signed-off-by: Suanming Mou <suanmingm@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
4 years agonet/mlx5: introduce thread safe linked list cache
Xueming Li [Wed, 28 Oct 2020 09:33:40 +0000 (17:33 +0800)]
net/mlx5: introduce thread safe linked list cache

New API of linked list for cache:
- Optimized for small amount cache list.
- Optimized for read-most list.
- Thread safe.
- Since number of entries are limited, entries allocated by API.
- For dynamic entry size, pass 0 as entry size, then the creation
callback allocate the entry.
- Since number of entries are limited, no need to use indexed pool to
allocate memory. API will remove entry and free with mlx5_free.
- Search API is not supposed to be used in multi-thread.

Signed-off-by: Xueming Li <xuemingl@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
4 years agonet/mlx5: make header reformat action thread safe
Suanming Mou [Wed, 28 Oct 2020 09:33:39 +0000 (17:33 +0800)]
net/mlx5: make header reformat action thread safe

To support multi-thread flow insertion, this patch updates flow header
reformat action list to use thread safe hash list with write-most mode.

Signed-off-by: Suanming Mou <suanmingm@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
4 years agonet/mlx5: make metadata copy flow list thread safe
Xueming Li [Wed, 28 Oct 2020 09:33:38 +0000 (17:33 +0800)]
net/mlx5: make metadata copy flow list thread safe

To support multi-thread flow insertion, this patch updates metadata copy
flow list to use thread safe hash list.

Signed-off-by: Xueming Li <xuemingl@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
4 years agonet/mlx5: remove unused mreg copy
Suanming Mou [Wed, 28 Oct 2020 09:33:37 +0000 (17:33 +0800)]
net/mlx5: remove unused mreg copy

After non-cache mode feature was implemented, the flows can only be
created when port started. No need to check if the mreg flows are
created in port stopped status, and apply the mreg flows after port
start will also never happen.

This commit removed the relevant not used mreg copy code.

Signed-off-by: Suanming Mou <suanmingm@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
4 years agonet/mlx5: make flow modify action list thread safe
Xueming Li [Wed, 28 Oct 2020 09:33:36 +0000 (17:33 +0800)]
net/mlx5: make flow modify action list thread safe

To support multi-thread flow insertion, this patch updates flow modify
action list to use thread safe hash list with write-most mode.

Signed-off-by: Xueming Li <xuemingl@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
4 years agonet/mlx5: make flow tag list thread safe
Xueming Li [Wed, 28 Oct 2020 09:33:35 +0000 (17:33 +0800)]
net/mlx5: make flow tag list thread safe

To support multi-thread flow insertion, this patch updates flow tag list
to use thread safe hash list with write-most mode.

Signed-off-by: Xueming Li <xuemingl@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
4 years agonet/mlx5: fix redundant Direct Verbs resources allocate
Suanming Mou [Wed, 28 Oct 2020 09:33:34 +0000 (17:33 +0800)]
net/mlx5: fix redundant Direct Verbs resources allocate

All table, tag, header modify, header reformat are supported only on DV
mode. For the OFED version doesn't support these, create the related
redundant DV resources waste the memory.

Add the code section in the HAVE_IBV_FLOW_DV_SUPPORT macro to avoid the
redundant resources allocation.

Fixes: 2eb4d0107acc ("net/mlx5: refactor PCI probing on Linux")
Cc: stable@dpdk.org
Signed-off-by: Suanming Mou <suanmingm@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
4 years agonet/mlx5: make flow table cache thread safe
Xueming Li [Wed, 28 Oct 2020 09:33:33 +0000 (17:33 +0800)]
net/mlx5: make flow table cache thread safe

To support multi-thread flow insertion/removal, this patch uses thread
safe hash list API for flow table cache hash list.

Signed-off-by: Xueming Li <xuemingl@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
4 years agonet/mlx5: add flow table tunnel offload attribute
Suanming Mou [Wed, 28 Oct 2020 09:33:32 +0000 (17:33 +0800)]
net/mlx5: add flow table tunnel offload attribute

As flow table is shared between the ports in the same shared IB device,
flow table may be created by one port and released by other port.

Currently, the tunnel offloading active check in flow table release is
based on the port which release the flow table. Since the flow table
create port and release port may have different tunnel offloading
configuration, it will cause invalid tunnel offloading release or
tunnel offloading resource leaks.

Add the flow table tunnel offloading attribute to indicate the flow
table has tunnel offloading resource or not to avoid wrong tunnel
offloading operation.

Signed-off-by: Suanming Mou <suanmingm@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
4 years agonet/mlx5: support concurrent access for hash list
Xueming Li [Wed, 28 Oct 2020 09:33:31 +0000 (17:33 +0800)]
net/mlx5: support concurrent access for hash list

In order to support hash list concurrent access, adding next:
1. List level read/write lock.
2. Entry reference counter.
3. Entry create/match/remove callback.
4. Remove insert/lookup/remove function which are not thread safe.
5. Add register/unregister function to support entry reuse.

For better performance, lookup function uses read lock to
allow concurrent lookup from different thread, all other hash list
modification functions uses write lock which blocks concurrent
modification and lookups from other thread.

The exact objects change will be applied in the next patches.

Signed-off-by: Xueming Li <xuemingl@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
4 years agonet/mlx5: create global drop action
Suanming Mou [Wed, 28 Oct 2020 09:33:30 +0000 (17:33 +0800)]
net/mlx5: create global drop action

This commit creates the global drop action for flows instead of
maintain it in flow insertion time. The uniqueu global drop action
makes it thread safe.

Signed-off-by: Suanming Mou <suanmingm@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
4 years agonet/mlx5: create global default miss action
Suanming Mou [Wed, 28 Oct 2020 09:33:29 +0000 (17:33 +0800)]
net/mlx5: create global default miss action

This commit creates the global default miss action instead of maintain
it in flow insertion time. This makes the action to be thread safe.

Signed-off-by: Suanming Mou <suanmingm@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
4 years agonet/mlx5: create global jump action
Suanming Mou [Wed, 28 Oct 2020 09:33:28 +0000 (17:33 +0800)]
net/mlx5: create global jump action

This commit changes the jump action in table to be created with table
creation in advanced. In this case, the jump action is safe to be used
in multiple thread. The jump action will be destroyed when table is not
used anymore and released.

Signed-off-by: Suanming Mou <suanmingm@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
4 years agonet/mlx5: make VLAN network interface thread safe
Suanming Mou [Wed, 28 Oct 2020 09:33:27 +0000 (17:33 +0800)]
net/mlx5: make VLAN network interface thread safe

This commit protects the VLAN VM workaround area using a spinlock
in multiple-thread flow insertion to make it thread safe.

Signed-off-by: Suanming Mou <suanmingm@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
4 years agonet/mlx5: make meter action thread safe
Suanming Mou [Wed, 28 Oct 2020 09:33:26 +0000 (17:33 +0800)]
net/mlx5: make meter action thread safe

This commit adds the spinlock for the meter action to make it be thread
safe. Atomic reference counter in all is not enough as the meter action
should be created synchronized with reference counter increment. With
only atomic reference counter, even the counter is increased, the action
may still not be created.

Signed-off-by: Suanming Mou <suanmingm@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
4 years agonet/mlx5: make flow list thread safe
Xueming Li [Wed, 28 Oct 2020 09:33:25 +0000 (17:33 +0800)]
net/mlx5: make flow list thread safe

To support multi-thread flow operations, this patch introduces list lock
for the rte_flow list manages all the rte_flow handlers.

Signed-off-by: Xueming Li <xuemingl@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
4 years agonet/mlx5: use indexed pool as id generator
Xueming Li [Wed, 28 Oct 2020 09:33:24 +0000 (17:33 +0800)]
net/mlx5: use indexed pool as id generator

The ID generation API used an integer pool to save released ID, To
support multiple flow, it has to be enhanced to be thread safe.

Indexed pool could be used to generate unique ID by setting size of pool
entry to zero. Since bitmap is used, an extra benefits is saving memory
to about one bit per entry. Further more indexed pool could be thread
safe by enabling lock.

This patch leverages indexed pool to generate ID, removes
unused ID generating API.

Signed-off-by: Xueming Li <xuemingl@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
4 years agonet/mlx5: support zero size entry for indexed pool
Xueming Li [Wed, 28 Oct 2020 09:33:23 +0000 (17:33 +0800)]
net/mlx5: support zero size entry for indexed pool

To make indexed pool to be used as ID generator, this patch allows entry
size to be zero.

Signed-off-by: Xueming Li <xuemingl@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
4 years agonet/mlx5: reuse flow id as hairpin id
Xueming Li [Wed, 28 Oct 2020 09:33:22 +0000 (17:33 +0800)]
net/mlx5: reuse flow id as hairpin id

Hairpin flow matching required a unique flow ID for matching.
This patch reuses flow ID as hairpin flow ID, this will save some code
to generate a separate hairpin ID, also saves flow memory by removing
hairpin ID.

Signed-off-by: Xueming Li <xuemingl@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
4 years agonet/mlx5: use thread specific flow workspace
Xueming Li [Wed, 28 Oct 2020 09:33:21 +0000 (17:33 +0800)]
net/mlx5: use thread specific flow workspace

As part of multi-thread flow support, this patch moves flow intermediate
data to thread specific, makes them a flow workspace. The workspace is
allocated per thread, destroyed along with thread life-cycle.

Signed-off-by: Xueming Li <xuemingl@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
4 years agonet/mlx5: use thread safe index pool for flow objects
Suanming Mou [Wed, 28 Oct 2020 09:33:20 +0000 (17:33 +0800)]
net/mlx5: use thread safe index pool for flow objects

As mlx5 PMD is changed to be thread safe, all the flow-related
sub-objects inside the PMD should be thread safe. This commit
changes the index memory pools' lock configuration to be enabled.
That makes the index pool be thread safe.

Signed-off-by: Suanming Mou <suanmingm@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
4 years agonet/mlx: do not enforce RSS hash offload
Alexander Kozyrev [Tue, 27 Oct 2020 15:14:36 +0000 (15:14 +0000)]
net/mlx: do not enforce RSS hash offload

Rx RSS hash offload should be controlled by the user
and should not be enforced by RSS multi-queue Rx mode.

Fixes: 8b945a7f7dcb ("drivers/net: update Rx RSS hash offload capabilities")
Cc: stable@dpdk.org
Author: Andrew Rybchenko <arybchenko@solarflare.com>
Signed-off-by: Alexander Kozyrev <akozyrev@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
4 years agonet/mlx5: add flow sync API
Bing Zhao [Tue, 27 Oct 2020 14:46:54 +0000 (22:46 +0800)]
net/mlx5: add flow sync API

When creating a flow, the rule itself might not take effort
immediately once the function call returns with success. It would
take some time to let the steering synchronize with the hardware.

If the application wants the packet to be sent to hit the flow after
it is created, this flow sync API can be used to clear the steering
HW cache to enforce next packet hits the latest rules.

For TX, usually the NIC TX domain and/or the FDB domain should be
synchronized depends in which domain the flow is created.

The application could also try to synchronize the NIC RX and/or the
FDB domain for the ingress packets.

Signed-off-by: Bing Zhao <bingz@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
4 years agocommon/mlx5: add glue function for domain sync
Bing Zhao [Tue, 27 Oct 2020 14:46:53 +0000 (22:46 +0800)]
common/mlx5: add glue function for domain sync

In rdma-core, the "mlx5dv_dr_domain_sync" function was already
provided. It is used to flush the rule submission queue. The wrapper
function in the glue layer is added for using this.
It only supports DR flows right now the same as domain creating and
destroying functions.

Signed-off-by: Bing Zhao <bingz@nvidia.com>
Acked-by: Ori Kam <orika@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
4 years agonet/mlx5: use C11 atomics for flow tables
Alexander Kozyrev [Tue, 27 Oct 2020 15:28:24 +0000 (15:28 +0000)]
net/mlx5: use C11 atomics for flow tables

The rte_atomic API is deprecated and needs to be replaced with
C11 atomic builtins. Use the relaxed ordering for RTE flow tables.
Enforce Acquire/Release model for managing DevX pools.

Signed-off-by: Alexander Kozyrev <akozyrev@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
4 years agonet/mlx5: use C11 atomics for RxQ/TxQ refcounts
Alexander Kozyrev [Tue, 27 Oct 2020 15:28:23 +0000 (15:28 +0000)]
net/mlx5: use C11 atomics for RxQ/TxQ refcounts

The rte_atomic API is deprecated and needs to be replaced with
C11 atomic builtins. Use the relaxed ordering for RxQ/TxQ refcounts.

Signed-off-by: Alexander Kozyrev <akozyrev@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
4 years agocommon/mlx5: use C11 atomics for netlink sequence
Alexander Kozyrev [Tue, 27 Oct 2020 15:28:22 +0000 (15:28 +0000)]
common/mlx5: use C11 atomics for netlink sequence

The rte_atomic API is deprecated and needs to be replaced with
C11 atomic builtins. Use __atomic_add_fetch instead of
rte_atomic32_add_return to generate a Netlink sequence number.

Signed-off-by: Alexander Kozyrev <akozyrev@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
4 years agocommon/mlx5: use C11 atomics for memory allocation
Alexander Kozyrev [Tue, 27 Oct 2020 15:28:21 +0000 (15:28 +0000)]
common/mlx5: use C11 atomics for memory allocation

The rte_atomic API is deprecated and needs to be replaced with
C11 atomic builtins. Use the relaxed ordering for mlx5 mallocs.

Signed-off-by: Alexander Kozyrev <akozyrev@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
4 years agonet/mlx5: fix Tx queue start
Matan Azrad [Tue, 27 Oct 2020 06:43:25 +0000 (06:43 +0000)]
net/mlx5: fix Tx queue start

The Tx queue stop\start operations update the HW state of the Tx queue
object. The stop API should update the state from ready to reset in
order to stop any queue traffic and the start API should update the
state from reset to ready in order to open the traffic path.

The start API wrongly tried to change the state from ready to ready what
caused a failure in FW on the current state validation.

Replace ready to ready command by reset to ready command in the Tx start
API.

Fixes: 161d103b231c ("net/mlx5: add queue start and stop")
Cc: stable@dpdk.org
Signed-off-by: Matan Azrad <matan@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
Acked-by: Asaf Penso <asafp@nvidia.com>
4 years agonet/mlx5: support item type error message in flow Verbs
Li Zhang [Mon, 28 Sep 2020 06:55:46 +0000 (09:55 +0300)]
net/mlx5: support item type error message in flow Verbs

Update the flow verbs error message to "item type X not supported",
when it is not supported,
instead of a generic error message "item not supported".

Signed-off-by: Li Zhang <lizh@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>