dpdk.git
4 years agobuild: remove unneeded meson option
David Marchand [Tue, 19 Nov 2019 12:59:23 +0000 (13:59 +0100)]
build: remove unneeded meson option

The meson option has been missed when removing this code.

Fixes: 8e35792c5325 ("eal: remove dead code on NUMA node detection")
Cc: stable@dpdk.org
Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
4 years agokni: reduce interface name size
Michael Pfeiffer [Fri, 15 Nov 2019 13:03:28 +0000 (14:03 +0100)]
kni: reduce interface name size

The name in rte_kni_device_info is passed to the kernel, which allows
interface names with at most 16 bytes (IFNAMSIZ). rte_kni_alloc with a
longer name currently trigger a kernel BUG in alloc_netdev_mqs in
net/core/dev.c. Reduce RTE_KNI_NAMESIZE to prevent this situation.

Signed-off-by: Michael Pfeiffer <michael.pfeiffer@tu-ilmenau.de>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agomempool: remove check for bad IOVA when populating
Anatoly Burakov [Thu, 14 Nov 2019 13:58:21 +0000 (13:58 +0000)]
mempool: remove check for bad IOVA when populating

Currently, mempool will check if IOVA is bad for a segment, and reject
the IOVA if hugepages are also enabled. This check is wrong because now
that we have external memory segments, they are allowed to have their
IOVA's to be invalid. This check also doesn't make much sense in the
first place, because the following code can handle bad IOVA's perfectly
well (and in fact, this check is not triggering a failure when
--no-huge option is enabled), so there is not much sense to check for
this in the first place.

Fixes: 950e8fb4e194 ("mem: allow registering external memory areas")
Cc: stable@dpdk.org
Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
Tested-by: Bo Chen <box.c.chen@intel.com>
4 years agomempool: use actual IOVA addresses when populating
Anatoly Burakov [Thu, 14 Nov 2019 13:58:20 +0000 (13:58 +0000)]
mempool: use actual IOVA addresses when populating

Currently, when mempool is being populated, we get IOVA address
of every segment using rte_mem_virt2iova(). This works for internal
memory, but does not really work for external memory, and does not
work on platforms which return RTE_BAD_IOVA as a result of this
call (such as FreeBSD). Moreover, even when it works, the function
in question will do unnecessary pagewalks in IOVA as PA mode, as
it falls back to rte_mem_virt2phy() instead of just doing a lookup in
internal memseg table.

To fix it, replace the call to first attempt to look through the
internal memseg table (this takes care of internal and external memory),
and fall back to rte_mem_virt2iova() when unable to perform VA->IOVA
translation via memseg table.

Fixes: 66cc45e293ed ("mem: replace memseg with memseg lists")
Cc: stable@dpdk.org
Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
Tested-by: Bo Chen <box.c.chen@intel.com>
4 years agoeal/linux: remove KNI restriction on IOVA
Vamsi Attunuru [Sun, 17 Nov 2019 15:12:44 +0000 (16:12 +0100)]
eal/linux: remove KNI restriction on IOVA

Now that KNI supports VA (with kernel versions starting 4.6.0), we can
accept IOVA as VA, but KNI must be configured for this.
Pass iova_mode when creating KNI netdevs.

So far, IOVA detection policy forced IOVA as PA when KNI is loaded,
whatever the buses IOVA requirements were.

We can now use IOVA as VA, but this comes with a cost in KNI.
When no constraint is expressed by the buses, keep the current behavior
of choosing PA.

Note: this change supposes that dpdk is built on the same kernel than
the target system kernel; no objection has been expressed on this topic.

Signed-off-by: Vamsi Attunuru <vattunuru@marvell.com>
Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
Signed-off-by: David Marchand <david.marchand@redhat.com>
Reviewed-by: Jerin Jacob <jerinj@marvell.com>
4 years agokni: support userspace VA
Vamsi Attunuru [Sun, 17 Nov 2019 15:12:43 +0000 (16:12 +0100)]
kni: support userspace VA

Patch adds support for kernel module to work in IOVA = VA mode by
providing address translation routines to convert userspace VA to
kernel VA.

KNI performance using PA is not changed by this patch.
But comparing KNI using PA to KNI using VA, the latter will have lower
performance due to the cost of the added translation.

This translation is implemented only with kernel versions starting 4.6.0.

Signed-off-by: Vamsi Attunuru <vattunuru@marvell.com>
Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
Reviewed-by: Jerin Jacob <jerinj@marvell.com>
4 years agovhost: fix vring requests validation broken if no FD
Zhike Wang [Wed, 13 Nov 2019 11:03:28 +0000 (19:03 +0800)]
vhost: fix vring requests validation broken if no FD

When VHOST_USER_VRING_NOFD_MASK is set, the fd_num is 0,
so validate_msg_fds() will return error. In this case,
the negotiation of vring message between vhost user front end and
back end would fail, and as a result, vhost user link could NOT be up.

How to reproduce:
1.Run dpdk testpmd insides VM, which locates at host with ovs+dpdk.
2.Notice that inside ovs there are endless logs regarding failure to
handle VHOST_USER_SET_VRING_CALL, and link of vm could NOT be up.

Fixes: bf472259dde6 ("vhost: fix possible denial of service by leaking FDs")
Cc: stable@dpdk.org
Signed-off-by: Zhike Wang <wangzk320@163.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Reviewed-by: Tiwei Bie <tiwei.bie@intel.com>
4 years agodoc/guides: clean repeated words
David Marchand [Tue, 12 Nov 2019 19:33:41 +0000 (20:33 +0100)]
doc/guides: clean repeated words

Shoot repeated words in all our guides.

Cc: stable@dpdk.org
Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Kevin Traynor <ktraynor@redhat.com>
4 years agodoc: fix link to AESNI mb external library
David Marchand [Tue, 12 Nov 2019 19:31:03 +0000 (20:31 +0100)]
doc: fix link to AESNI mb external library

Add missing _.

Fixes: 2977a13657ab ("doc: fix AESNI_MB guide")
Cc: stable@dpdk.org
Signed-off-by: David Marchand <david.marchand@redhat.com>
4 years agodoc: fix address type description for IOAT rawdev
Xiao Wang [Fri, 18 Oct 2019 00:01:47 +0000 (20:01 -0400)]
doc: fix address type description for IOAT rawdev

Align the description to what the code snippet shows.

Fixes: 0a92e63fc4cd ("raw/ioat: add local API to perform copies")
Cc: stable@dpdk.org
Signed-off-by: Xiao Wang <xiao.w.wang@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
4 years agodoc: fix internal links for older releases
David Marchand [Tue, 8 Oct 2019 09:47:36 +0000 (11:47 +0200)]
doc: fix internal links for older releases

Using external explicit references to http://doc.dpdk.org makes older
releases documentation point to the current master documentation pages.
Switch to internal references.

Fixes: 59ad25fe2184 ("doc: add overview of qat guide")
Fixes: 30e7fbd62839 ("doc: add event timer adapter guide")
Fixes: b7f859c9a9a5 ("doc: add switch representation documentation")
Fixes: f714a18885a6 ("app/testbbdev: add test application for bbdev")
Cc: stable@dpdk.org
Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agodoc: add oss-security to the security process
Luca Boccassi [Sat, 21 Sep 2019 14:52:42 +0000 (16:52 +0200)]
doc: add oss-security to the security process

The OSS-security project functions as a single point of contact for
pre-release, embargoed security notifications. Distributions and major
vendors are subscribed to this private list, so that they can be warned
in advance and schedule the work required to fix the vulnerability.

List and link this process in the DPDK security process document.

Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
4 years agotest: optimise fd closing in forks
Krzysztof Kanas [Tue, 12 Nov 2019 20:31:02 +0000 (21:31 +0100)]
test: optimise fd closing in forks

Caught while investigating timeouts on a ARM64 server.

Stracing a test process running the eal_flags_autotest, we can see that
the fork helper is checking all possible file descriptors from
getdtablesize() to 2, and close the existing ones.
We can do better by inspecting this forked process /proc/self/fd
directory.

Besides, checking file descriptors via /proc/self/fd only makes sense for
Linux. This code was a noop on FreeBSD.

Fixes: af75078fece3 ("first public release")
Cc: stable@dpdk.org
Signed-off-by: Krzysztof Kanas <kkanas@marvell.com>
Signed-off-by: David Marchand <david.marchand@redhat.com>
Tested-by: Krzysztof Kanas <kkanas@marvell.com>
Acked-by: Kevin Traynor <ktraynor@redhat.com>
4 years agobus/pci: align next mapping address on page boundary
Wangyu (Eric) [Wed, 13 Nov 2019 07:17:30 +0000 (07:17 +0000)]
bus/pci: align next mapping address on page boundary

Currently, the next address picked by PCI mapping infrastructure
may be page-unaligned due to BAR length being smaller than page size.
This leads to a situation where the requested map address is invalid,
resulting in mmap() call returning an arbitrary address,
which will later interfere with device BAR mapping in secondary processes.

Fix it by always aligning the next requested address on page boundary.

Fixes: c752998b5e2e ("pci: introduce library and driver")
Cc: stable@dpdk.org
Signed-off-by: Xiaofeng Deng <dengxiaofeng@huawei.com>
Signed-off-by: Wangyu (Eric) <seven.wangyu@huawei.com>
Acked-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
Acked-by: Min Hu (Connor) <humin29@huawei.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
Acked-by: Gavin Hu <gavin.hu@arm.com>
4 years agocmdline: remove unnecessary #ifdef
Stephen Hemminger [Fri, 8 Nov 2019 18:00:35 +0000 (10:00 -0800)]
cmdline: remove unnecessary #ifdef

The #ifdef to conditionally include <sys/socket.h> on BSD
is unnecessary. It is harmless to include the header on other
OS's. An extra include is better than an #ifdef.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
4 years agoexamples/l2fwd: fix build warning with system wide install
David Marchand [Tue, 12 Nov 2019 12:37:33 +0000 (13:37 +0100)]
examples/l2fwd: fix build warning with system wide install

Caught when compiling this example with pkg-config:

 ## Building l2fwd
 ...
 main.c: In function ‘main’:
 main.c:716:3: warning: ‘rte_eth_dev_set_ptypes’ is deprecated: Symbol
 is not yet part of stable ABI [-Wdeprecated-declarations]
   716 |   ret = rte_eth_dev_set_ptypes(portid, RTE_PTYPE_UNKNOWN, NULL,
       |   ^~~
 In file included from main.c:38:
 ...build-x86-default/install-root/usr/local/include/rte_ethdev.h:2661:5:
 note: declared here
  2661 | int rte_eth_dev_set_ptypes(uint16_t port_id, uint32_t
 ptype_mask,
       |     ^~~~~~~~~~~~~~~~~~~~~~
 ln -sf l2fwd-shared build/l2fwd

Fixes: 9731df2e7554 ("examples/l2fwd: disable packet type parsing")

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agovhost: fix possible denial of service by leaking FDs
Maxime Coquelin [Tue, 3 Sep 2019 15:34:22 +0000 (17:34 +0200)]
vhost: fix possible denial of service by leaking FDs

A malicious Vhost-user master could send in loop hand-crafted
vhost-user messages containing more file descriptors the
vhost-user slave expects. Doing so causes the application using
the vhost-user library to run out of FDs.

This issue has been assigned CVE-2019-14818

Fixes: 8f972312b8f4 ("vhost: support vhost-user")

Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
4 years agovhost: fix possible denial of service on SET_VRING_NUM
Maxime Coquelin [Fri, 23 Aug 2019 13:17:05 +0000 (15:17 +0200)]
vhost: fix possible denial of service on SET_VRING_NUM

vhost_user_set_vring_num() performs multiple allocations
without checking whether data were previously allocated.

It may cause a denial of service because of the memory leaks
that happen if a malicious vhost-user master keeps sending
VHOST_USER_SET_VRING_NUM request until the slave runs out
of memory.

This issue has been assigned CVE-2019-14818

Fixes: b0a985d1f340 ("vhost: add dequeue zero copy")

Reported-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
4 years agoversion: 19.11-rc2
Thomas Monjalon [Tue, 12 Nov 2019 08:07:25 +0000 (09:07 +0100)]
version: 19.11-rc2

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
4 years agodoc: update versioning guide for ABI versions
Ray Kinsella [Mon, 11 Nov 2019 11:57:58 +0000 (11:57 +0000)]
doc: update versioning guide for ABI versions

Updates to the ABI versioning guide, to account for the changes to the DPDK
ABI/API policy. Fixes for references to abi versioning and policy guides.

Signed-off-by: Ray Kinsella <mdr@ashroe.eu>
Acked-by: John McNamara <john.mcnamara@intel.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agodoc: introduce major ABI versions
Ray Kinsella [Mon, 11 Nov 2019 11:57:57 +0000 (11:57 +0000)]
doc: introduce major ABI versions

This policy change introduces major ABI versions, these are
declared every year, typically aligned with the LTS release
and are supported by subsequent releases in the following year.
This change is intended to improve ABI stabilty for those projects
consuming DPDK.

Signed-off-by: Ray Kinsella <mdr@ashroe.eu>
Acked-by: John McNamara <john.mcnamara@intel.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
4 years agodoc: separate versioning guide into version and policy
Ray Kinsella [Mon, 11 Nov 2019 11:57:56 +0000 (11:57 +0000)]
doc: separate versioning guide into version and policy

Separate versioning.rst into abi versioning and abi policy guidance, in
preparation for adding more detail to the abi policy. Add an entry to the
maintainer file for the abi policy.

Signed-off-by: Ray Kinsella <mdr@ashroe.eu>
Acked-by: John McNamara <john.mcnamara@intel.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agoexamples/vm_power: fix no port in guest
David Hunt [Tue, 29 Oct 2019 11:40:13 +0000 (11:40 +0000)]
examples/vm_power: fix no port in guest

If there are no ports available to the guest cli application, it will
exit when setting up the default policy because it fails to set the mac
address. This should not be the case, as this example can be used for
many other use cases that do not need ports.

If ports not found, simply set nb_mac_to_monitor in the policy to zero
and continue.

Fixes: 70febdcfd60f ("examples: check status of getting MAC address")

Signed-off-by: David Hunt <david.hunt@intel.com>
Acked-by: Lei Yao <lei.a.yao@intel.com>
4 years agoexamples/vm_power: fix OOB frequency oscillations
David Hunt [Wed, 24 Jul 2019 13:18:03 +0000 (14:18 +0100)]
examples/vm_power: fix OOB frequency oscillations

The branch ratio algorithm in the vm_power_manager sample application
can be very sensitive at patricular loads in a workload, causing
oscillations between min and max frequency. For example, if a
workload is at 50%, scaling up may change the ratio
enough that it immediately thinks it needs to scale down again.

This patch introduces a sliding window recording the scale up/down
direction for the last 32 samples, and scales up if any samples indicate
we should scale up, otherwise scale down. Each core has it's own window.

Fixes: 4b1a631b8a8a ("examples/vm_power: add oob monitoring functions")
Cc: stable@dpdk.org
Signed-off-by: David Hunt <david.hunt@intel.com>
Acked-by: Anatoly Burakov <anatoly.burakov@intel.com>
4 years agoethdev: fix last item detection on RSS flow expand
Matan Azrad [Mon, 11 Nov 2019 10:42:05 +0000 (10:42 +0000)]
ethdev: fix last item detection on RSS flow expand

There is a rte_flow API which expands a RSS flow pattern to multiple
patterns according to the RSS hash types in the RSS action
configuration.

As part of the expansion, detection of the last item of the flow uses
the "next proto" field of the last configured item in the pattern list.
Wrongly, the mask of this field was not considered in order to validate
the field.

Ignore "next proto" fields when their corresponded masks invalidate them.

Fixes: fc2dd8dd492f ("ethdev: fix expand RSS flows")
Cc: stable@dpdk.org
Signed-off-by: Matan Azrad <matan@mellanox.com>
Acked-by: Xiaoyu Min <jackmin@mellanox.com>
Acked-by: Ori Kam <orika@mellanox.com>
4 years agoapp/testpmd: set maximum LRO packet size
Dekel Peled [Mon, 11 Nov 2019 17:47:35 +0000 (19:47 +0200)]
app/testpmd: set maximum LRO packet size

This patch implements use of the API for LRO aggregated packet
max size.
It adds command-line and runtime commands to configure this value,
and adds option to show the supported value.
Documentation is updated accordingly.

Signed-off-by: Dekel Peled <dekelp@mellanox.com>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
Acked-by: Matan Azrad <matan@mellanox.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agonet/mlx5: set maximum LRO packet size
Dekel Peled [Mon, 11 Nov 2019 17:47:34 +0000 (19:47 +0200)]
net/mlx5: set maximum LRO packet size

This patch implements use of the API for LRO aggregated packet
max size.
Rx queue create is updated to use the relevant configuration.
Documentation is updated accordingly.

Signed-off-by: Dekel Peled <dekelp@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
4 years agoethdev: add maximum LRO packet size
Dekel Peled [Mon, 11 Nov 2019 17:47:33 +0000 (19:47 +0200)]
ethdev: add maximum LRO packet size

This patch implements API for configuration and
validation of max size for LRO aggregated packet.

Signed-off-by: Dekel Peled <dekelp@mellanox.com>
Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>
Acked-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Matan Azrad <matan@mellanox.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agoeventdev: reserve space in main structs for extension
Jerin Jacob [Fri, 8 Nov 2019 16:56:03 +0000 (22:26 +0530)]
eventdev: reserve space in main structs for extension

The struct rte_eventdev and rte_eventdev_data are supposed
to be used internally only, but there is a chance that
increasing their size would break ABI for some applications.
In order to allow smooth addition of features without breaking
ABI compatibility, some space is reserved.

Signed-off-by: Jerin Jacob <jerinj@marvell.com>
4 years agonet/dpaa2: fix Rx offload flags on jumbo MTU set
Sachin Saxena [Mon, 11 Nov 2019 16:08:57 +0000 (21:38 +0530)]
net/dpaa2: fix Rx offload flags on jumbo MTU set

The JUMBO frame handling in dpaa2_dev_mtu_set api was not correct.
When frame_size is greater than RTE_ETHER_MAX_LEN, the
intention is to add JUMBO flag in rx offload while it was resetting
all other flags other than JUMBO as AND operator was used instead of OR.

Fixes: 0ebce6129bc6 ("net/dpaa2: support new ethdev offload APIs")
Cc: stable@dpdk.org
Signed-off-by: Sachin Saxena <sachin.saxena@nxp.com>
Reviewed-by: Gagandeep Singh <g.singh@nxp.com>
4 years agoethdev: reserve space in main structs for extension
Thomas Monjalon [Mon, 11 Nov 2019 07:26:09 +0000 (08:26 +0100)]
ethdev: reserve space in main structs for extension

In order to allow smooth addition of features without breaking
ABI compatibility, some space is reserved in several core structs
of ethdev API.

The struct rte_eth_dev and rte_eth_dev_data are supposed
to be used internally only, but there is a chance that
increasing their size would break ABI for some applications.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agonet/mlx5: set VF MAC address from host
Raslan Darawsheh [Mon, 11 Nov 2019 11:40:20 +0000 (11:40 +0000)]
net/mlx5: set VF MAC address from host

Allow to configure the default MAC address of a VF
via its representor port in the host.

An API was proposed to specify explicitly the VF as a
target: https://patches.dpdk.org/patch/62176/

It has been rejected by the technical board in order to
keep compatibility with behavior in Intel PMDs.
http://mails.dpdk.org/archives/dev/2019-November/150588.html

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Signed-off-by: Raslan Darawsheh <rasland@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agoapp/testpmd: disable packet type parsing by default
Pavan Nikhilesh [Mon, 11 Nov 2019 13:19:13 +0000 (18:49 +0530)]
app/testpmd: disable packet type parsing by default

Disable packey type parsing on port init, user can enable ptype parsing
by issuing set ptype command.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agoapp/testpmd: add command to set supported packet types
Pavan Nikhilesh [Mon, 11 Nov 2019 13:19:12 +0000 (18:49 +0530)]
app/testpmd: add command to set supported packet types

Add command to set supported ptype mask.
Usage:
set port <port_id> ptype_mask <ptype_mask>

Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agoexamples/l2fwd: disable packet type parsing
Pavan Nikhilesh [Mon, 11 Nov 2019 13:19:11 +0000 (18:49 +0530)]
examples/l2fwd: disable packet type parsing

Disable packet type parsing as l2fwd doesn't rely on packet types.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agoexamples/eventdev: add new Rx RSS hash offload
Pavan Nikhilesh [Mon, 11 Nov 2019 13:19:10 +0000 (18:49 +0530)]
examples/eventdev: add new Rx RSS hash offload

Since pipeline_generic uses `rte_mbuf::hash::rss` add the new Rx offload
flag `DEV_RX_OFFLOAD_RSS_HASH` to inform PMD to copy the RSS hash result
into the mbuf.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agoexamples/eventdev: split port init sequence
Pavan Nikhilesh [Mon, 11 Nov 2019 13:19:09 +0000 (18:49 +0530)]
examples/eventdev: split port init sequence

Split port initialization sequence based on event device capabilities.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agodrivers/net: update Rx RSS hash offload capabilities
Pavan Nikhilesh [Mon, 11 Nov 2019 13:19:08 +0000 (18:49 +0530)]
drivers/net: update Rx RSS hash offload capabilities

Add DEV_RX_OFFLOAD_RSS_HASH flag for all PMDs that support RSS hash
delivery.

Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agoethdev: validate offloads set by PMD
Pavan Nikhilesh [Mon, 11 Nov 2019 13:19:07 +0000 (18:49 +0530)]
ethdev: validate offloads set by PMD

Some PMDs cannot work when certain offloads are enable/disabled, as a
workaround PMDs auto enable/disable offloads internally and expose it
through dev->data->dev_conf.rxmode.offloads.

After device specific dev_configure is called compare the requested
offloads to the offloads exposed by the PMD and, if the PMD failed
to enable a given offload then log it and return -EINVAL from
rte_eth_dev_configure, else if the PMD failed to disable a given offload
log and continue with rte_eth_dev_configure.

Suggested-by: Andrew Rybchenko <arybchenko@solarflare.com>
Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>
4 years agoethdev: add mbuf RSS update as an offload
Pavan Nikhilesh [Mon, 11 Nov 2019 13:19:06 +0000 (18:49 +0530)]
ethdev: add mbuf RSS update as an offload

Add new Rx offload flag `DEV_RX_OFFLOAD_RSS_HASH` which can be used to
enable/disable PMDs write to `rte_mbuf::hash::rss`.
PMDs notify the validity of `rte_mbuf::hash:rss` to the application
by enabling `PKT_RX_RSS_HASH ` flag in `rte_mbuf::ol_flags`.

Also update testpmd rx_offload command to include RSS_HASH

Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agoethdev: add packet type range function
Pavan Nikhilesh [Mon, 11 Nov 2019 13:19:05 +0000 (18:49 +0530)]
ethdev: add packet type range function

Add `rte_eth_dev_set_ptypes` function that will allow the application
to inform the PMD about reduced range of packet types to handle.
Based on the ptypes set PMDs can optimize their Rx path.

-If application doesn’t want any ptype information it can call
`rte_eth_dev_set_ptypes(ethdev_id, RTE_PTYPE_UNKNOWN, NULL, 0)`
and PMD may skip packet type processing and set rte_mbuf::packet_type to
RTE_PTYPE_UNKNOWN.

-If application doesn’t call `rte_eth_dev_set_ptypes` PMD can return
`rte_mbuf::packet_type` with `rte_eth_dev_get_supported_ptypes`.

-If application is interested only in L2/L3 layer, it can inform the PMD
to update `rte_mbuf::packet_type` with L2/L3 ptype by calling
`rte_eth_dev_set_ptypes(ethdev_id,
RTE_PTYPE_L2_MASK | RTE_PTYPE_L3_MASK, NULL, 0)`.

Suggested-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Signed-off-by: Pavan Nikhilesh <pbhagavatula@marvell.com>
Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>
4 years agodoc: add ice PMD in doxygen
Haiyue Wang [Fri, 8 Nov 2019 15:44:35 +0000 (23:44 +0800)]
doc: add ice PMD in doxygen

Add the doxygen for ice protocol extraction feature APIs.

Signed-off-by: Haiyue Wang <haiyue.wang@intel.com>
Reviewed-by: Xiaolong Ye <xiaolong.ye@intel.com>
4 years agonet/ice: optimize protocol extraction by dynamic mbuf
Haiyue Wang [Fri, 8 Nov 2019 15:44:34 +0000 (23:44 +0800)]
net/ice: optimize protocol extraction by dynamic mbuf

The original design is to use rte_mbuf::udata64 to save the metadata of
protocol extraction which has network protocol data fields and type, a
private API is used to decode this metadata.

Use the dynamic mbuf field and flags to register the needed fields in
mbuf, to avoid overwriting 'rte_mbuf::udata64', since the application
may use it. Now the protocol extraction metadate is saved into dynamic
mbuf field with 4B size, and its type and validity is indicated by the
related dynamic mbuf flags in 'rte_mbuf::ol_flags'.

Signed-off-by: Haiyue Wang <haiyue.wang@intel.com>
Reviewed-by: Xiaolong Ye <xiaolong.ye@intel.com>
4 years agonet/mlx5: optimize tag traversal with hash list
Bing Zhao [Fri, 8 Nov 2019 05:26:57 +0000 (07:26 +0200)]
net/mlx5: optimize tag traversal with hash list

Tag action for flow mark/flag could be reused by different flows.
When creating a new flow with mark, the existing tag resources will
be traversed in order to confirm if the action is already created.
If only one linked list is used, the searching rate will drop
significantly with the number of tag actions increasing.
By using a hash lists table, it will speed up the searching process
and in the meanwhile, the memory consumption won't be large if only
a small number tag action resources are created(compared to other
hash table implementations). The list heads array size could be
optimized with some extendable hash table in the future.

Signed-off-by: Bing Zhao <bingz@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agonet/mlx5: reorganize flow matcher resources
Bing Zhao [Fri, 8 Nov 2019 15:23:10 +0000 (17:23 +0200)]
net/mlx5: reorganize flow matcher resources

Matchers are created on the specific table. If a single linked list
is used to store these, then the finding process might be the
bottleneck when there are a lot of different flow matchers on a
huge amount of tables. The matchers could be move into the table
data resource structure in order to reduce the comparison times
when finding.

Signed-off-by: Bing Zhao <bingz@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agonet/mlx5: reorganize jump table resources
Bing Zhao [Fri, 8 Nov 2019 15:23:09 +0000 (17:23 +0200)]
net/mlx5: reorganize jump table resources

Jump object is associated with table object, so there is no need to
use a single linked list to store it. All the jump objects could be
put together with related flow tables.

Signed-off-by: Bing Zhao <bingz@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agonet/mlx5: reorganize flow tables with hash list
Bing Zhao [Fri, 8 Nov 2019 15:23:08 +0000 (17:23 +0200)]
net/mlx5: reorganize flow tables with hash list

In the current flow tables organization, arrays are used. This is
fast for searching, creating related object that will be used in
flow creation. But it introduces some limitation to the table index.
Then we can reorganize the flow tables information with hash list.
When using hash list, there is no need to maintain three arrays for
NIC TX, RX and FDB tables object information.
This attribute could be used together with the table ID to generate
a 64-bits key that is unique for the hash list insertion, lookup and
deletion.

Signed-off-by: Bing Zhao <bingz@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agonet/mlx5: control transmit doorbell register mapping
Viacheslav Ovsiienko [Fri, 8 Nov 2019 15:07:50 +0000 (15:07 +0000)]
net/mlx5: control transmit doorbell register mapping

The rdma core library can map doorbell register in two ways,
depending on the environment variable "MLX5_SHUT_UP_BF":

  - as regular cached memory, the variable is either missing or
    set to zero. This type of mapping may cause the significant
    doorbell register writing latency and requires explicit
    memory write barrier to mitigate this issue and prevent
    write combining.

  - as non-cached memory, the variable is present and set to
    not "0" value. This type of mapping may cause performance
    impact under heavy loading conditions but the explicit write
    memory barrier is not required and it may improve core
    performance.

The new devarg is introduced "tx_db_nc", if this parameter is
set to zero, the doorbell register is forced to be mapped to
cached memory and requires explicit memory barrier after
writing to. If "tx_db_nc" is set to non-zero value the doorbell
will be mapped as non-cached memory, not requiring the memory
barrier. If "tx_db_nc" is missing the behaviour will be defined
by presence of "MLX5_SHUT_UP_BF" in environment. If variable
is missed the default value zero will be set for ARM64 hosts
and one for others.

In run time the code checks the mapping type and provides the
memory barrier after writing to tx doorbell register if it is
needed. The mapping type is extracted directly from the
uar_mmap_offset field in the queue properties.

Fixes: 18a1c20044c0 ("net/mlx5: implement Tx burst template")
Cc: stable@dpdk.org
Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
4 years agonet/failsafe: support xstats
Stephen Hemminger [Fri, 1 Nov 2019 20:12:56 +0000 (13:12 -0700)]
net/failsafe: support xstats

Add support for extended statistics in failsafe driver.
Reports detailed statistics for each sub device.

Example:

testpmd> show port xstats 1
rx_good_packets: 0
tx_good_packets: 0
rx_good_bytes: 0
tx_good_bytes: 0
rx_missed_errors: 0
rx_errors: 0
tx_errors: 0
rx_mbuf_allocation_errors: 0
rx_q0packets: 0
rx_q0bytes: 0
rx_q0errors: 0
tx_q0packets: 0
tx_q0bytes: 0
rx_sub0_good_packets: 0
tx_sub0_good_packets: 0
...
rx_sub1_good_packets: 0
tx_sub1_good_packets: 0
rx_sub1_good_bytes: 0

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agoapp/testpmd: block xstats for hidden ports
Stephen Hemminger [Fri, 1 Nov 2019 20:12:55 +0000 (13:12 -0700)]
app/testpmd: block xstats for hidden ports

All the other testpmd commands block access to devices that
are owned. Looks like xstat got overlooked.

Fixes: bfd5051b43b5 ("app/testpmd: new command to get extended statistics")
Cc: stable@dpdk.org
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
4 years agoexamples/vhost_blk: introduce vhost storage sample
Jin Yu [Mon, 4 Nov 2019 16:36:26 +0000 (00:36 +0800)]
examples/vhost_blk: introduce vhost storage sample

A Vhost-blk example that support inflight feature. It uses the
new APIs that introduced in the first patch, so it can show how these
APIs work to support inflight feature.

Signed-off-by: Jin Yu <jin.yu@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
4 years agonet/ice: free HW tables when device closed
Qi Zhang [Fri, 8 Nov 2019 09:40:39 +0000 (17:40 +0800)]
net/ice: free HW tables when device closed

Free the HW tables during dev_close.
Otherwise there will be two issues:
1. Memory won't be freed if the device is detached.
2. Driver can't be initialized correctly after device reset.

Fixes: a4c8c48fe3f4 ("net/ice: load OS default package")
Cc: stable@dpdk.org
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Xiaolong Ye <xiaolong.ye@intel.com>
4 years agonet/ice: remove VLAN TPID set
Tao Zhu [Thu, 31 Oct 2019 10:29:23 +0000 (18:29 +0800)]
net/ice: remove VLAN TPID set

Set vlan tpid is not supported by ice hardware. Delete driver code
that doesn't work.

Signed-off-by: Tao Zhu <taox.zhu@intel.com>
Acked-by: Qiming Yang <qiming.yang@intel.com>
Acked-by: Xiaolong Ye <xiaolong.ye@intel.com>
4 years agonet/ice: add error cases for wrong packages
Simei Su [Thu, 7 Nov 2019 07:34:43 +0000 (15:34 +0800)]
net/ice: add error cases for wrong packages

If the switch/fdir/hash module can't resolve a correct parser,
it should return error.

Fixes: 47d460d63233 ("net/ice: rework switch filter")
Fixes: efc16c621415 ("net/ice: support flow director GTPU tunnel")
Fixes: 5ad3db8d4bdd ("net/ice: enable advanced RSS")

Signed-off-by: Simei Su <simei.su@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Xiaolong Ye <xiaolong.ye@intel.com>
4 years agonet/mlx5: fix asserts for multi-segment Tx offload misconfig
Viacheslav Ovsiienko [Thu, 7 Nov 2019 13:18:24 +0000 (13:18 +0000)]
net/mlx5: fix asserts for multi-segment Tx offload misconfig

To support multi-segment packet sending the Tx datapath
DEV_TX_OFFLOAD_MULTI_SEGS offload must be configured.
In debug configuration the asserts arise if the multi-segment
packet is being sent and no DEV_TX_OFFLOAD_MULTI_SEGS is set.
It was found that in some execution paths asserts were missed,
this patch adds ones.

Fixes: 18a1c20044c0 ("net/mlx5: implement Tx burst template")
Cc: stable@dpdk.org
Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
4 years agonet/mlx5: clean meter resources
Suanming Mou [Fri, 8 Nov 2019 03:49:25 +0000 (05:49 +0200)]
net/mlx5: clean meter resources

When the port is closed or program exits ungraceful, the meter rulers
should be flushed after the flow destroyed.

Signed-off-by: Suanming Mou <suanmingm@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
4 years agonet/mlx5: share tag between meter and metadata
Suanming Mou [Fri, 8 Nov 2019 03:49:24 +0000 (05:49 +0200)]
net/mlx5: share tag between meter and metadata

In the meter flow split, metadata flow will be as the sub flow of meter
suffix flow. In meter suffix flow, there is already a unique id tag
exist as for the meter prefix and suffix flow match.

Make metadata feature and meter both share the unique id tag for match.

Signed-off-by: Suanming Mou <suanmingm@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
4 years agonet/mlx5: split meter flow
Suanming Mou [Fri, 8 Nov 2019 03:49:23 +0000 (05:49 +0200)]
net/mlx5: split meter flow

The flow with meter action will be divided to three sub flows, the
prefix flow, the meter flow and the suffix flow.

For these three sub flows, as the prefix flow and meter flow have the
meter color match. In order the make the packet from prefix flow to
match with the suffix flow, an extra metadata register is allocated.
The prefix flow will add a unique id to the register and the suffix
flow matches on that unique id.

As RSS will also divided the flow to several sub flows, flow with meter
will be divided as the sub flow of the RSS sub flows if have as below:

Original flow ->
RSS sub flow 1 ->
Meter sub flow 1 (Contain three sub flows.)
RSS sub flow 2 ->
Meter sub flow 2 (Contain three sub flows.)
......
RSS sub flow n ->
Meter sub flow n (Contain three sub flows.)

The metadata feature flow will be split as the sub flow of the meter
suffix flow.

Signed-off-by: Suanming Mou <suanmingm@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
4 years agonet/mlx5: support meter flow action
Suanming Mou [Fri, 8 Nov 2019 03:49:22 +0000 (05:49 +0200)]
net/mlx5: support meter flow action

Add meter flow action support in flow validate and translate.

Signed-off-by: Suanming Mou <suanmingm@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
4 years agonet/mlx5: add meter attach and detach
Suanming Mou [Fri, 8 Nov 2019 03:49:21 +0000 (05:49 +0200)]
net/mlx5: add meter attach and detach

Add the meter attach and detach for the flow create.

When create the flow with meter, first try to find any created meter
action matches the flow meter id. If the meter action is already
created, just attach to it and increase the ref_cnt. If not, create
one.

For the dettach, decrease the ref_cnt, destroy the meter action while
the ref_cnt decreased to zero.

Signed-off-by: Suanming Mou <suanmingm@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
4 years agonet/mlx5: add meter statistics read and update
Suanming Mou [Fri, 8 Nov 2019 03:49:20 +0000 (05:49 +0200)]
net/mlx5: add meter statistics read and update

This commit add the meter statistics read and update to check the meter
statistics.

New internal functions in rte_mtr_ops callback:
1. stats_update()
2. stats_read()

Signed-off-by: Suanming Mou <suanmingm@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
4 years agonet/mlx5: add count action to meter
Suanming Mou [Fri, 8 Nov 2019 03:49:19 +0000 (05:49 +0200)]
net/mlx5: add count action to meter

Add count action to meter for metering packet statistics. All the
packets be colored and dropped will be recorded.

Signed-off-by: Suanming Mou <suanmingm@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
4 years agonet/mlx5: expose flow counters management
Suanming Mou [Fri, 8 Nov 2019 03:49:18 +0000 (05:49 +0200)]
net/mlx5: expose flow counters management

Expose the flow counter management mechanism for other components to
use.

Signed-off-by: Suanming Mou <suanmingm@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
4 years agonet/mlx5: support meter profile update
Suanming Mou [Fri, 8 Nov 2019 03:49:17 +0000 (05:49 +0200)]
net/mlx5: support meter profile update

This commit add the meter profile update support.

New internal function in rte_mtr_ops callback:
1. meter_profile_update()

Signed-off-by: Suanming Mou <suanmingm@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
4 years agonet/mlx5: support meter modification operations
Suanming Mou [Fri, 8 Nov 2019 03:49:16 +0000 (05:49 +0200)]
net/mlx5: support meter modification operations

This commit add meter enable and disable supoort.

New internal functions in rte_mtr_ops callback:
1. meter_enable()
2. meter_disable()

The meter_enable() enables the meter action and the meter_disable()
disables the meter action.

Signed-off-by: Suanming Mou <suanmingm@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
4 years agonet/mlx5: add meter action creation to the glue
Suanming Mou [Fri, 8 Nov 2019 03:49:15 +0000 (05:49 +0200)]
net/mlx5: add meter action creation to the glue

This commit add the meter action creation to the glue code.

Signed-off-by: Suanming Mou <suanmingm@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
4 years agonet/mlx5: support basic meter operations
Suanming Mou [Fri, 8 Nov 2019 03:49:14 +0000 (05:49 +0200)]
net/mlx5: support basic meter operations

This commit add the basic meter operations for meter create and destroy.

New internal functions in rte_mtr_ops callback:
1. create()
2. destroy()

The create() callback will create the corresponding flow rules on the
meter table.
The destroy() callback destroys the flow rules on the meter table.

Signed-off-by: Suanming Mou <suanmingm@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
4 years agonet/mlx5: add policer rules operations
Suanming Mou [Fri, 8 Nov 2019 03:49:13 +0000 (05:49 +0200)]
net/mlx5: add policer rules operations

This commit create the color rules on the meter table for the packets.

As the prefix flow with meter action colors the packets, the packets
are transferred to the meter table with meter color match flows. Here
we create the flow rules  with green yellow red actions on the meter
table. Packets match the color will be processed by the related color
flow rule.

Signed-off-by: Suanming Mou <suanmingm@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
4 years agonet/mlx5: prepare meter flow tables
Suanming Mou [Fri, 8 Nov 2019 03:49:12 +0000 (05:49 +0200)]
net/mlx5: prepare meter flow tables

This commit prepare the meter table and suffix table.

A flow with meter will be split to three flows. The three flows are
created on differnet tables. The packets transfer between the flows
on the tables as below:

Prefix flow -> Meter flow -> Suffix flow

Prefix flow does the user defined match and the meter action. The meter
action colors the packet and set its destination to meter table to be
processed by the meter flow.
The meter flow judges if the packet can be passed or not. If packet can
be passed, it will be transferred to the suffix table.
The suffix flow on the suffix table will apply the left user defined
actions to the packet.

The ingress egress and transfer all have the independent meter and
suffix tables.

Signed-off-by: Suanming Mou <suanmingm@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
4 years agonet/mlx5: validate meter profile
Suanming Mou [Fri, 8 Nov 2019 03:49:11 +0000 (05:49 +0200)]
net/mlx5: validate meter profile

The add meter profile should be validated if it is valid or has been add
to the list. Invalid and exist profile should not be add to the list.

Signed-off-by: Suanming Mou <suanmingm@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
4 years agonet/mlx5: support meter profile operations
Suanming Mou [Fri, 8 Nov 2019 03:49:10 +0000 (05:49 +0200)]
net/mlx5: support meter profile operations

This commit add the support of meter profile add and delete operations.

New internal functions in rte_mtr_ops callback:
1. meter_profile_add()
2. meter_profile_delete()

Only RTE_MTR_SRTCM_RFC2697 algorithm is supported and can be added. To
add other algorithm will report an error.

Signed-off-by: Suanming Mou <suanmingm@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
4 years agonet/mlx5: allocate flow meter registers
Suanming Mou [Fri, 8 Nov 2019 03:49:09 +0000 (05:49 +0200)]
net/mlx5: allocate flow meter registers

Meter need the metadata REG_C to have the color match between the prefix
flow and the meter flow.

As the user define or metadata feature will both use the REG_C in the
suffix flow, the color match register meter uses will not impact the
register use in the later sub flow.

Another case is that tag is add before meter flow. In this case, meter
should not touch the register the tag action is using. To avoid that
case, meter should reserve the REG_C's used by user defined MLX5_APP_TAG.

Signed-off-by: Suanming Mou <suanmingm@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
4 years agonet/mlx5: fill meter capabilities using DevX
Suanming Mou [Fri, 8 Nov 2019 03:49:08 +0000 (05:49 +0200)]
net/mlx5: fill meter capabilities using DevX

This commit add the support of fill and get the meter capabilities
from DevX.

Support items:
1. The srTCM color bind mode.
2. Meter share with multiple flows.
3. Action drop.

The color aware mode and multiple meter chaining in a flow are not
supported.

New internal function in rte_mtr_ops callback:
1. capabilities_get()

Signed-off-by: Suanming Mou <suanmingm@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
4 years agonet/mlx5: add meter operation callback
Suanming Mou [Fri, 8 Nov 2019 03:49:07 +0000 (05:49 +0200)]
net/mlx5: add meter operation callback

Add the new mlx5_flow_meter.c file for metering support.

Signed-off-by: Suanming Mou <suanmingm@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
4 years agonet/mlx5: fix condition to create default rule
Dekel Peled [Thu, 7 Nov 2019 15:04:19 +0000 (17:04 +0200)]
net/mlx5: fix condition to create default rule

Previous patch added creation of a default flow rule on port start.
Rule is created under the condition that device is in eswitch mode,
and is not a VF, to make sure rule is created only once.
In Bluefield, where PF representor is used, this condition is not
sufficient. Rule is created twice, causing loss of traffic.

This patch updates this condition, adding check that device is also
not a representor.

Fixes: b67b4ecbde22 ("net/mlx5: skip table zero to improve insertion rate")

Signed-off-by: Dekel Peled <dekelp@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agonet/mlx5: allow jump to group lower than current
Dekel Peled [Thu, 7 Nov 2019 11:33:35 +0000 (13:33 +0200)]
net/mlx5: allow jump to group lower than current

In current implementation, jump action is allowed only if target
group is higher than the current flow group,

This patch updates function flow_dv_validate_action_jump() to allow
jump action if target group is higher or lower than the current flow
group.
Target group equal to current flow group is still rejected.

Signed-off-by: Dekel Peled <dekelp@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agonet/mlx5: add metadata register copy table
Viacheslav Ovsiienko [Thu, 7 Nov 2019 17:10:04 +0000 (17:10 +0000)]
net/mlx5: add metadata register copy table

While reg_c[meta] can be copied to reg_b simply by modify-header
action (it is supported by hardware), it is not possible to copy
reg_c[mark] to the STE flow_tag as flow_tag is not a metadata
register and this is not supported by hardware. Instead, it
should be manually set by a flow per each unique MARK ID. For
this purpose, there should be a dedicated flow table -
RX_CP_TBL and all the Rx flow should pass by the table
to properly copy values from the register to flow tag field.

And for each MARK action, a copy flow should be added
to RX_CP_TBL according to the MARK ID like:
  (if reg_c[mark] == mark_id),
    flow_tag := mark_id / reg_b := reg_c[meta] / jump to RX_ACT_TBL

For SET_META action, there can be only one default flow like:
  reg_b := reg_c[meta] / jump to RX_ACT_TBL

Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
4 years agonet/mlx5: split Rx flows to provide metadata copy
Viacheslav Ovsiienko [Thu, 7 Nov 2019 17:10:03 +0000 (17:10 +0000)]
net/mlx5: split Rx flows to provide metadata copy

Values set by MARK and SET_META actions should be carried over
to the VF representor in case of flow miss on Tx path. However,
as not all metadata registers are preserved across the different
domains (NIC Rx/Tx and E-Switch FDB), as a workaround, those
values should be carried by reg_c's which are preserved across
domains and copied to STE flow_tag (MARK) and reg_b (META) fields
in the last stage of flow steering, in order to scatter those
values to flow_tag and flow_table_metadata of CQE.

While reg_c[meta] can be copied to reg_b simply by modify-header
action (it is supported by hardware), it is not possible to copy
reg_c[mark] to the STE flow_tag as flow_tag is not a metadata
register and this is not supported by hardware. Instead, it should
be manually set by a flow per MARK ID. For this purpose, there
should be a dedicated flow table - RX_CP_TBL and all the Rx flow
should pass by the table to properly copy values.

As the last action of Rx flow steering must be a terminal action
such as QUEUE, RSS or DROP, if a user flow has Q/RSS action, the
flow must be split in order to pass by the RX_CP_TBL. And the
remained Q/RSS action will be performed by another dedicated
action table - RX_ACT_TBL.

For example, for an ingress flow:
    pattern,
    actions_having_QRSS
it must be split into two flows. The first one is,
    pattern,
    actions_except_QRSS / copy (reg_c[2] := flow_id) / jump to RX_CP_TBL
and the second one in RX_ACT_TBL.
    (if reg_c[2] == flow_id),
    action_QRSS
where flow_id is uniquely allocated and managed identifier.

This patch implements the Rx flow splitting and build the RX_ACT_TBL.
Also, per each egress flow on NIC Tx, a copy action (reg_c[]= reg_a)
should be added in order to transfer metadata from WQE.

Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
4 years agonet/mlx5: introduce flow splitters chain
Viacheslav Ovsiienko [Thu, 7 Nov 2019 17:10:02 +0000 (17:10 +0000)]
net/mlx5: introduce flow splitters chain

The mlx5 hardware has some limitations and flow might
require to be split into multiple internal subflows.
For example this is needed to provide the meter object
sharing between multiple flows or to provide metadata
register copying before final queue/rss action.

The multiple features might require several level of
splitting. For example, hairpin feature splits the
original flow into two ones - rx and tx parts. Then
RSS feature should split rx part into multiple subflows
with extended item sets. Then, metering feature might
require splitting each RSS subflow into meter jump
chain, and then metadata extensive support might
require the final subflows splitting. So, we have
to organize the chain of splitting subroutines to
abstract each level of splitting.

Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
4 years agonet/mlx5: add metadata support to Rx datapath
Viacheslav Ovsiienko [Thu, 7 Nov 2019 17:10:01 +0000 (17:10 +0000)]
net/mlx5: add metadata support to Rx datapath

This patch moves metadata from completion descriptor
to appropriate dynamic mbuf field.

Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
4 years agonet/mlx5: extend flow metadata support
Viacheslav Ovsiienko [Thu, 7 Nov 2019 17:10:00 +0000 (17:10 +0000)]
net/mlx5: extend flow metadata support

META item is supported on both Rx and Tx. 'transfer' attribute
is also supported. SET_META action is also added.

Due to restriction on reg_c[meta], various bit width might be
available. If devarg parameter dv_xmeta_en=1, the META uses
metadata register reg_c[0], which may be required for internal
kernel or firmware needs. In this case PMD queries kernel about
available fields in reg_c[0] and restricts the register usage
accordingly. If devarg parameter dv_xmeta_en=2, the META feature
uses reg_c[1], there should be no limitations on the data width.

However, extensive MEAT feature is currently disabled until
register copy on loopback is supported by forthcoming patches.

Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
4 years agonet/mlx5: extend flow mark support
Viacheslav Ovsiienko [Thu, 7 Nov 2019 17:09:59 +0000 (17:09 +0000)]
net/mlx5: extend flow mark support

Flow MARK item is newly supported along with MARK action. MARK
action and item are supported on both Rx and Tx. It works on the
metadata reg_c[] only if extensive flow metadata register is
supported. Without the support, MARK action behaves same as
before - valid only on Rx and no MARK item is valid.

FLAG action is also modified accordingly. FLAG action is
supported on both Rx and Tx via reg_c[] if extensive flow
metadata register is supported.

However, the new MARK/FLAG item and action are currently
disabled until register copy on loopback is supported by
forthcoming patches.

The actual index of engaged metadata reg_c[] register to
support FLAG/MARK actions depends on dv_xmeta_en devarg value.

For extensive metadata mode 1 the reg_c[1] is used and
transitive MARK data width is 24. For extensive metadata mode 2
the reg_c[0] is used and transitive MARK data width might be
restricted to 0 or 16 bits, depending on kernel usage of reg_c[0].
The actual supported width can be discovered by series of trials
with rte_flow_validate().

Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
4 years agonet/mlx5: support flow tag
Viacheslav Ovsiienko [Thu, 7 Nov 2019 17:09:58 +0000 (17:09 +0000)]
net/mlx5: support flow tag

Add support of new rte_flow item and action - TAG and SET_TAG. TAG is
a transient value which can be kept during flow matching.

This is supported through device metadata register reg_c[]. Although
there are 8 registers are available on the current mlx5 device,
some of them can be reserved for firmware or kernel purposes.
The availability should be queried by iterative trial-and-error
mlx5_flow_discover_mreg_c() routine.

Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
4 years agonet/mlx5: update metadata register ID query
Viacheslav Ovsiienko [Thu, 7 Nov 2019 17:09:57 +0000 (17:09 +0000)]
net/mlx5: update metadata register ID query

The NIC might support up to 8 extensive metadata registers.
These registers are supposed to be used by multiple features.
There is register id query routine to allow determine which
register is actually used by specified feature.

Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
4 years agonet/mlx5: check maximum modify actions number
Viacheslav Ovsiienko [Thu, 7 Nov 2019 17:09:56 +0000 (17:09 +0000)]
net/mlx5: check maximum modify actions number

If the extensive metadata registers are supported,
it can be regarded inclusively that the extensive
metadata support is possible. E.g. metadata register
copy action, supporting 16 modify header actions,
reserving register across different steering domain
(FDB and NIC) and so on.

This patch handles the maximal amount of header modify
actions depending on discovered metadata registers
support.

Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
4 years agonet/mlx5: adjust shared register according to mask
Viacheslav Ovsiienko [Thu, 7 Nov 2019 17:09:55 +0000 (17:09 +0000)]
net/mlx5: adjust shared register according to mask

The metadata register reg_c[0] might be used by kernel or
firmware for their internal purposes. The actual used mask
can be queried from the kernel. The remaining bits can be
used by PMD to provide META or MARK feature. The code queries
the mask of reg_c[0] and adjust the resource usage dynamically.

Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
4 years agonet/mlx5: add devarg for extensive metadata support
Viacheslav Ovsiienko [Thu, 7 Nov 2019 17:09:54 +0000 (17:09 +0000)]
net/mlx5: add devarg for extensive metadata support

The PMD parameter dv_xmeta_en is added to control extensive
metadata support. A nonzero value enables extensive flow
metadata support if device is capable and driver supports it.
This can enable extensive support of MARK and META item of
rte_flow. The newly introduced SET_TAG and SET_META actions
do not depend on dv_xmeta_en parameter, because there is
no compatibility issue for new entities. The dv_xmeta_en is
disabled by default.

There are some possible configurations, depending on parameter
value:

- 0, this is default value, defines the legacy mode, the MARK
  and META related actions and items operate only within NIC Tx
  and NIC Rx steering domains, no MARK and META information
  crosses the domain boundaries. The MARK item is 24 bits wide,
  the META item is 32 bits wide.

- 1, this engages extensive metadata mode, the MARK and META
  related actions and items operate within all supported steering
  domains, including FDB, MARK and META information may cross
  the domain boundaries. The ``MARK`` item is 24 bits wide, the
  META item width depends on kernel and firmware configurations
  and might be 0, 16 or 32 bits. Within NIC Tx domain META data
  width is 32 bits for compatibility, the actual width of data
  transferred to the FDB domain depends on kernel configuration
  and may be vary. The actual supported width can be retrieved
  in runtime by series of rte_flow_validate() trials.

- 2, this engages extensive metadata mode, the MARK and META
  related actions and items operate within all supported steering
  domains, including FDB, MARK and META information may cross
  the domain boundaries. The META item is 32 bits wide, the MARK
  item width depends on kernel and firmware configurations and
  might be 0, 16 or 24 bits. The actual supported width can be
  retrieved in runtime by series of rte_flow_validate() trials.

If there is no E-Switch configuration the ``dv_xmeta_en`` parameter is
ignored and the device is configured to operate in legacy mode (0).

Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
4 years agonet/mlx5: check metadata registers availability
Viacheslav Ovsiienko [Thu, 7 Nov 2019 17:09:53 +0000 (17:09 +0000)]
net/mlx5: check metadata registers availability

The metadata registers reg_c provide support for TAG and
SET_TAG features. Although there are 8 registers are available
on the current mlx5 devices, some of them can be reserved.
The availability should be queried by iterative trial-and-error
implemented by mlx5_flow_discover_mreg_c() routine.

If reg_c is available, it can be regarded inclusively that
the extensive metadata support is possible. E.g. metadata
register copy action, supporting 16 modify header actions
(instead of 8 by default) preserving register across
different domains (FDB and NIC) and so on.

Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
4 years agonet/mlx5: rename structure and function
Viacheslav Ovsiienko [Thu, 7 Nov 2019 17:09:52 +0000 (17:09 +0000)]
net/mlx5: rename structure and function

There are some renaming:
- in the DV flow engine overall: flow_d_* -> flow_dv_*
- in flow_dv_translate(): res -> mhdr_res

Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
4 years agonet/mlx5: update meta register matcher set
Viacheslav Ovsiienko [Thu, 7 Nov 2019 17:09:51 +0000 (17:09 +0000)]
net/mlx5: update meta register matcher set

Introduce the dedicated matcher register field setup routine.
Update the code to use this unified one.

Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
4 years agonet/mlx5: update flow functions
Viacheslav Ovsiienko [Thu, 7 Nov 2019 17:09:50 +0000 (17:09 +0000)]
net/mlx5: update flow functions

Update flow creation/destroy functions for future reuse.
List operations can be skipped inside functions and done
separately out of flow creation.

Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
4 years agonet/mlx5: refactor flow structure
Viacheslav Ovsiienko [Thu, 7 Nov 2019 17:09:49 +0000 (17:09 +0000)]
net/mlx5: refactor flow structure

Some rte_flow fields which are local to subflows have been moved to
mlx5_flow structure. RSS attributes are grouped by mlx5_flow_rss structure.
tag_resource is moved to mlx5_flow_dv structure.

Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
4 years agonet/mlx5: add metadata register copy
Viacheslav Ovsiienko [Thu, 7 Nov 2019 17:09:48 +0000 (17:09 +0000)]
net/mlx5: add metadata register copy

Add flow metadata register copy action which is supported through modify
header command. As it is an internal action, not exposed to users, item
type (MLX5_RTE_FLOW_ACTION_TYPE_COPY_MREG) is negative value. This can be
used when creating PMD internal subflows.

Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
4 years agonet/mlx5: update modify header action translator
Viacheslav Ovsiienko [Thu, 7 Nov 2019 17:09:47 +0000 (17:09 +0000)]
net/mlx5: update modify header action translator

When composing device command for modify header action, provided mask
should be taken more accurate into account thus length and offset
in action should be set accordingly at precise bit-wise boundaries.

For the future use, metadata register copy action is also added.

Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
4 years agonet/mlx5: convert internal tag endianness
Viacheslav Ovsiienko [Thu, 7 Nov 2019 17:09:46 +0000 (17:09 +0000)]
net/mlx5: convert internal tag endianness

Public API RTE_FLOW_ACTION_TYPE_TAG and RTE_FLOW_ITEM_TYPE_TAG
present data in host-endian format, as all metadata related
entities. The internal mlx5 tag related action and item should
use the same endianness to be conformed.

Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
Acked-by: Matan Azrad <matan@mellanox.com>
4 years agonet/mlx5: introduce hash list
Bing Zhao [Wed, 6 Nov 2019 13:07:56 +0000 (15:07 +0200)]
net/mlx5: introduce hash list

Introduce simple hash list to the mlx5 utilities. User can define
its own data structure containing the mlx5_hlist_entry and create
the hash list table via the creation interface. Then the entry will
be inserted into the table and linked to the corresponding list
head. User should guarantee there is no collision of the key and
provide a callback function to handle all the remaining entries in
the table when destroying the hash list. User should define a proper
number of the list heads in the table in order to get a better
performance. The LSB of the 'key' is used to calculate the index of
the head in the list heads array.
This implementation is not multi-threads safe right now.

Signed-off-by: Bing Zhao <bingz@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
4 years agoapp/testpmd: support hairpin
Ori Kam [Tue, 5 Nov 2019 19:05:19 +0000 (19:05 +0000)]
app/testpmd: support hairpin

This commit introduce the hairpin queues to the testpmd.
the hairpin queue is configured using --hairpinq=<n>
the hairpin queue adds n queue objects for both the total number
of TX queues and RX queues.
The connection between the queues are 1 to 1, first Rx hairpin queue
will be connected to the first Tx hairpin queue

Signed-off-by: Ori Kam <orika@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agonet/sfc: fix adapter lock usage on rule creation
Ivan Malov [Sun, 3 Nov 2019 10:33:09 +0000 (13:33 +0300)]
net/sfc: fix adapter lock usage on rule creation

The point is that adapter lock has to be held on
list accesses, as well as when talking to the HW.

Fixes: a9825ccf5bb8 ("net/sfc: support flow API filters")
Cc: stable@dpdk.org
Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
4 years agonet/enic: re-enable link status change interrupt
Hyong Youb Kim [Thu, 7 Nov 2019 14:42:24 +0000 (06:42 -0800)]
net/enic: re-enable link status change interrupt

When INTx is used, the interrupt handler needs to explicitly re-enable
interrupt in order to receive another one in future. The LSC interrupt
handler currently does not, and the link state never gets updated when
INTx is used (e.g. uio_pci_generic). Call rte_intr_ack() at the end of
the handler, to re-enable INTx.

Fixes: fefed3d1e62c ("enic: new driver")
Cc: stable@dpdk.org
Signed-off-by: Hyong Youb Kim <hyonkim@cisco.com>
Reviewed-by: John Daley <johndale@cisco.com>
4 years agoethdev: fix expand RSS flows
Xiaoyu Min [Tue, 5 Nov 2019 13:42:43 +0000 (15:42 +0200)]
ethdev: fix expand RSS flows

rte_flow_expand_rss expands rte_flow item list based on the RSS
types. In another word, some additional rules are added if the user
specified items are not complete enough according to the RSS type,
for example:

  ... pattern eth / end actions rss type tcp end ...

User only provides item eth but want to do RSS on tcp traffic.
The pattern is not complete enough to filter TCP traffic only.
This will be a problem for some HWs.
So some PMDs use rte_flow_expand_rss to expand above user provided
flow to:

  ... pattern eth / end actions rss types tcp
  ... pattern eth / ipv4 / tcp / end actions rss types tcp ...
  ... pattern eth / ipv6 / tcp / end actions rss types tcp ...

in order to filter TCP traffic only and do RSS correctly.

However the current expansion cannot handle pattern as below, which
provides ethertype or ip next proto instead of providing an item:

  ... pattern eth type is 0x86DD / end actions rss types tcp ...

rte_flow_expand_rss will expand above flow to:

  ... pattern eth type is 0x86DD / ipv4 / tcp end ...

which has conflicting values: 0x86DD vs. ipv4 and some HWs will refuse
to create flow.

This patch will fix above by checking the last item's spec and to
expand RSS flows correctly.

Currently only support to complete item list based on ether type or ip
next proto.

Fixes: 4ed05fcd441b ("ethdev: add flow API to expand RSS flows")
Cc: stable@dpdk.org
Signed-off-by: Xiaoyu Min <jackmin@mellanox.com>
Acked-by: Ori Kam <orika@mellanox.com>