dpdk.git
5 years agobuildtools: fix build for some mktemp
Ferruh Yigit [Sat, 27 Oct 2018 00:38:15 +0000 (01:38 +0100)]
buildtools: fix build for some mktemp

build error:
== Build drivers/net/tap
mktemp: cannot create temp file /tmp/dpdk.auto-config-h.sh.XXX.c:
Invalid argument
.../buildtools/auto-config-h.sh: line 86: : No such file or directory
.../drivers/net/tap/Makefile:55: recipe for target
   'tap_autoconf.h.new' failed

Above error observed on Wind River Linux 8.0

`mktemp` command in that system has a restrictions to have X in
the template at the end and at least six of them.

Complied to mktemp requirements and add -xc flag to compiler to say
`temp` file is a C file

Fixes: ff37ca5d3773 ("devtools: use a common prefix for temporary files")

Reported-by: Shuai Zhu <shuaix.zhu@intel.com>
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
5 years agodoc: add telemetry how-to
Ciara Power [Sat, 27 Oct 2018 09:17:48 +0000 (10:17 +0100)]
doc: add telemetry how-to

This patch adds all documentation for telemetry.

A description on how to use the Telemetry API with a DPDK
application is given in this document.

It also adds a release notes update for telemetry.

Signed-off-by: Ciara Power <ciara.power@intel.com>
Signed-off-by: Brian Archbold <brian.archbold@intel.com>
Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>
Acked-by: Harry van Haaren <harry.van.haaren@intel.com>
Acked-by: Marko Kovacevic <marko.kovacevic@intel.com>
5 years agousertools: add client script for telemetry
Ciara Power [Sat, 27 Oct 2018 09:17:49 +0000 (10:17 +0100)]
usertools: add client script for telemetry

This patch adds a python script which can be used as a demo
client. The script is interactive and will allow the user to
register, request statistics, and unregister.

To run the script, an argument for the client file path must
be passed in: "python telemetry_client.py <file_path>".

This script is useful to see how the Telemetry API for DPDK
is used, and how to make the initial connection.

Signed-off-by: Ciara Power <ciara.power@intel.com>
Signed-off-by: Brian Archbold <brian.archbold@intel.com>
Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>
Acked-by: Harry van Haaren <harry.van.haaren@intel.com>
5 years agobuild: add dependency on telemetry to apps with meson
Kevin Laatz [Sat, 27 Oct 2018 09:17:50 +0000 (10:17 +0100)]
build: add dependency on telemetry to apps with meson

This patch adds telemetry as a dependecy to all applications. Without these
changes, the --telemetry flag will not be recognised and applications will
fail to run if they want to enable telemetry.

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>
Signed-off-by: Radu Nicolau <radu.nicolau@intel.com>
Acked-by: Harry van Haaren <harry.van.haaren@intel.com>
5 years agotelemetry: add ability to disable selftest
Ciara Power [Sat, 27 Oct 2018 09:17:47 +0000 (10:17 +0100)]
telemetry: add ability to disable selftest

This patch adds functionality to enable/disable the selftest.

This functionality will be extended in future to make the
enabling/disabling more dynamic and remove this 'hardcoded' approach. We
are temporarily using this approach due to the design changes (vdev vs eal)
made to the library.

Signed-off-by: Ciara Power <ciara.power@intel.com>
Signed-off-by: Brian Archbold <brian.archbold@intel.com>
Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>
Acked-by: Harry van Haaren <harry.van.haaren@intel.com>
5 years agotelemetry: format json response when sending stats
Ciara Power [Sat, 27 Oct 2018 09:17:46 +0000 (10:17 +0100)]
telemetry: format json response when sending stats

This patch adds functionality to create a JSON message in
order to send it to a client socket.

When stats are requested by a client, they are retrieved from
the metrics library and encoded in JSON format.

Signed-off-by: Ciara Power <ciara.power@intel.com>
Signed-off-by: Brian Archbold <brian.archbold@intel.com>
Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>
Acked-by: Harry van Haaren <harry.van.haaren@intel.com>
5 years agotelemetry: update metrics before sending stats
Ciara Power [Sat, 27 Oct 2018 09:17:45 +0000 (10:17 +0100)]
telemetry: update metrics before sending stats

This patch adds functionality to update the statistics in
the metrics library with values from the ethdev stats.

Values need to be updated before they are encoded into a JSON
message and sent to the client that requested them. The JSON encoding
will be added in a subsequent patch.

Signed-off-by: Ciara Power <ciara.power@intel.com>
Signed-off-by: Brian Archbold <brian.archbold@intel.com>
Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>
Acked-by: Harry van Haaren <harry.van.haaren@intel.com>
5 years agotelemetry: add parser for client socket messages
Ciara Power [Sat, 27 Oct 2018 09:17:44 +0000 (10:17 +0100)]
telemetry: add parser for client socket messages

This patch adds the parser file. This is used to parse any
messages that are received on any of the client sockets.

Currently, the unregister functionality works using the parser.
Functionality relating to getting statistic values for certain ports
will be added in a subsequent patch, however the parsing involved
for that command is added in this patch.

Some of the parser code included is in preparation for future
functionality, that is not implemented yet in this patchset.

Signed-off-by: Ciara Power <ciara.power@intel.com>
Signed-off-by: Brian Archbold <brian.archbold@intel.com>
Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>
Acked-by: Harry van Haaren <harry.van.haaren@intel.com>
5 years agotelemetry: add client feature and sockets
Ciara Power [Sat, 27 Oct 2018 09:17:43 +0000 (10:17 +0100)]
telemetry: add client feature and sockets

This patch introduces clients to the telemetry API.

When a client makes a connection through the initial telemetry
socket, they can send a message through the socket to be
parsed. Register messages are expected through this socket, to
enable clients to register and have a client socket setup for
future communications.

A TAILQ is used to store all clients information. Using this, the
client sockets are polled for messages, which will later be parsed
and dealt with accordingly.

Functionality that make use of the client sockets were introduced
in this patch also, such as writing to client sockets, and sending
error responses.

Signed-off-by: Ciara Power <ciara.power@intel.com>
Signed-off-by: Brian Archbold <brian.archbold@intel.com>
Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>
Acked-by: Harry van Haaren <harry.van.haaren@intel.com>
5 years agotelemetry: add initial connection socket
Ciara Power [Sat, 27 Oct 2018 09:17:42 +0000 (10:17 +0100)]
telemetry: add initial connection socket

This patch adds the telemetry UNIX socket. It is used to
allow connections from external clients.

On the initial connection from a client, ethdev stats are
registered in the metrics library, to allow for their retrieval
at a later stage.

Signed-off-by: Ciara Power <ciara.power@intel.com>
Signed-off-by: Brian Archbold <brian.archbold@intel.com>
Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>
Acked-by: Harry van Haaren <harry.van.haaren@intel.com>
5 years agotelemetry: introduce infrastructure
Ciara Power [Sat, 27 Oct 2018 09:17:41 +0000 (10:17 +0100)]
telemetry: introduce infrastructure

This patch adds the infrastructure and initial code for the telemetry
library.

The telemetry init is registered with eal_init(). We can then check to see
if --telemetry was passed as an eal option. If --telemetry was parsed, then
we call telemetry init at the end of eal init.

Control threads are used to get CPU cycles for telemetry, which are
configured in this patch also.

Signed-off-by: Ciara Power <ciara.power@intel.com>
Signed-off-by: Brian Archbold <brian.archbold@intel.com>
Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>
Signed-off-by: Radu Nicolau <radu.nicolau@intel.com>
Acked-by: Harry van Haaren <harry.van.haaren@intel.com>
5 years agoeal: export function to get runtime directory
Kevin Laatz [Sat, 27 Oct 2018 09:17:40 +0000 (10:17 +0100)]
eal: export function to get runtime directory

This patch makes the eal_get_runtime_dir() API public so it can be used
from outside EAL.

Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>
Acked-by: Harry van Haaren <harry.van.haaren@intel.com>
5 years agoeal: add option register infrastructure
Kevin Laatz [Sat, 27 Oct 2018 09:17:39 +0000 (10:17 +0100)]
eal: add option register infrastructure

This commit adds infrastructure to EAL that allows an application to
register it's init function with EAL. This allows libraries to be
initialized at the end of EAL init.

This infrastructure allows libraries that depend on EAL to be initialized
as part of EAL init, removing circular dependency issues.

Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>
Acked-by: Harry van Haaren <harry.van.haaren@intel.com>
Acked-by: Gaetan Rivet <gaetan.rivet@6wind.com>
5 years agocommon/qat: fix for invalid response from firmware
Fiona Trahe [Tue, 23 Oct 2018 23:39:42 +0000 (00:39 +0100)]
common/qat: fix for invalid response from firmware

Check that the firmware response has a bit set indicating
it's valid before dereferencing the rest of the response contents.

Fixes: 0bdd36e12245 ("crypto/qat: make dequeue function generic")
Cc: stable@dpdk.org
Signed-off-by: Fiona Trahe <fiona.trahe@intel.com>
Acked-by: Arek Kusztal <arkadiuszx.kusztal@intel.com>
5 years agocompress/qat: enable dynamic huffman encoding
Fiona Trahe [Fri, 26 Oct 2018 18:18:30 +0000 (19:18 +0100)]
compress/qat: enable dynamic huffman encoding

Enable dynamic huffman encoding in the QAT comp PMD.

Signed-off-by: Tomasz Jozwiak <tomaszx.jozwiak@intel.com>
Signed-off-by: Fiona Trahe <fiona.trahe@intel.com>
Acked-by: Arek Kusztal <arkadiuszx.kusztal@intel.com>
5 years agoapp/testpmd: fix QinQ strip display option
Jerin Jacob [Fri, 26 Oct 2018 12:40:32 +0000 (12:40 +0000)]
app/testpmd: fix QinQ strip display option

Fix a typo on DEV_RX_OFFLOAD_QINQ_STRIP selection.

Fixes: 0074d02fca21 ("app/testpmd: convert to new Rx offloads API")
Cc: stable@dpdk.org
Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
5 years agodoc: fix typo in testpmd guide
Yong Wang [Fri, 26 Oct 2018 10:27:03 +0000 (06:27 -0400)]
doc: fix typo in testpmd guide

The forwarding mode mac_swap should be macswap in testpmd guide.

Fixes: e76d7a768ce0 ("doc: fix syntax in testpmd user guide")
Cc: stable@dpdk.org
Signed-off-by: Yong Wang <wang.yong19@zte.com.cn>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
5 years agoethdev: make offload name API non-experimental
Stephen Hemminger [Fri, 19 Oct 2018 17:35:32 +0000 (10:35 -0700)]
ethdev: make offload name API non-experimental

The offload name functions are useful, but since they are
marked experimental they can not be used by upstream projects.
For example, VPP duplicates the same table in its code.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
5 years agonet/bonding: avoid making copy of MAC address
Chas Williams [Thu, 25 Oct 2018 22:04:37 +0000 (18:04 -0400)]
net/bonding: avoid making copy of MAC address

Calling rte_eth_macaddr_get to get a copy of the MAC address causes
a hot spot according to profiling. We can easily get the current
MAC address by just examining the bonded device.

Signed-off-by: Chas Williams <chas3@att.com>
5 years agonet/ena: change version to 1.1.1
Michal Krawczyk [Thu, 25 Oct 2018 17:59:23 +0000 (19:59 +0200)]
net/ena: change version to 1.1.1

Version change is connected with major bug fixes.

Signed-off-by: Michal Krawczyk <mk@semihalf.com>
5 years agonet/ena: fix passing RSS hash to mbuf
Stewart Allen [Thu, 25 Oct 2018 17:59:22 +0000 (19:59 +0200)]
net/ena: fix passing RSS hash to mbuf

The driver was passing to the mbuf Rx queue ID instead of hash received
from the device. Now, the RSS hash from the Rx descriptor is being set.

Fixes: 1173fca25af9 ("ena: add polling-mode driver")
Cc: stable@dpdk.org
Signed-off-by: Stewart Allen <allenste@amazon.com>
Acked-by: Michal Krawczyk <mk@semihalf.com>
5 years agonet/ena: recreate HW IO rings on start and stop
Michal Krawczyk [Thu, 25 Oct 2018 17:59:21 +0000 (19:59 +0200)]
net/ena: recreate HW IO rings on start and stop

On the start the driver was refilling all Rx buffs, but the old ones
were not released. That way running start/stop for a few times was
causing device to run out of descriptors.

To fix the issue, IO rings are now being destroyed on stop, and
recreated on start. That way the device is not losing any descriptors.

Furthermore, there was also memory leak for the Rx mbufs, which were
created on start and not destroyed on stop.

Fixes: eb0ef49dd5d5 ("net/ena: add stop and uninit routines")
Cc: stable@dpdk.org
Signed-off-by: Michal Krawczyk <mk@semihalf.com>
5 years agodrivers/net: use sleep delay by default for Intel NICs
Ilya Maximets [Wed, 10 Oct 2018 14:12:20 +0000 (17:12 +0300)]
drivers/net: use sleep delay by default for Intel NICs

NICs uses different delays up to a second during their
configuration. It makes no sense to busy-wait so long wasting
CPU cycles and preventing any other threads to execute on the
same CPU core. These busy polling are the rudiments that came
from the kernel drivers where you can not sleep in interrupt
context, but as we're in userspace, we're able and should
sleep to allow other threads to run.
Delays never called on rx/tx path, so this should not affect
performance.

Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
5 years agoeal: add nanosleep based delay function
Ilya Maximets [Wed, 10 Oct 2018 14:12:19 +0000 (17:12 +0300)]
eal: add nanosleep based delay function

Add a new rte_delay_us_sleep() function that uses nanosleep().
This function can be used by applications to not implement
their own nanosleep() based callback and by internal DPDK
code if CPU non-blocking delay needed.

Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
5 years agonet/*/base: allow experimental APIs
Ilya Maximets [Thu, 4 Oct 2018 13:18:35 +0000 (16:18 +0300)]
net/*/base: allow experimental APIs

This functionality was missed while adding new drivers to
the meson build.

Fixes: bfabd06000c0 ("net/avf: support meson build")
Fixes: 30d3d0168301 ("net/qede: add in meson build")

Signed-off-by: Ilya Maximets <i.maximets@samsung.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
5 years agoapp/testpmd: setup attached ports on probe event
Thomas Monjalon [Thu, 25 Oct 2018 15:11:17 +0000 (17:11 +0200)]
app/testpmd: setup attached ports on probe event

After probing is done, each new port must be setup.
The new ports are currently guessed by iterating on ports
matching the devargs string used for probing.

When probing a port, it is possible that one more port probing
get triggered (e.g. PF is automatically probed when probing
a VF representor). Such automatic probing will be caught only on event.

The iterator loop may be replaced by a call from the event callback.
In order to be able to test both modes, a command is added
to choose between iterator and event modes.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
5 years agoapp/testpmd: move ethdev events registration
Thomas Monjalon [Thu, 25 Oct 2018 15:11:16 +0000 (17:11 +0200)]
app/testpmd: move ethdev events registration

The callback for ethdev events was registered on port start,
so it was missing some events.

It is now registered at the beginning of the main function.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
5 years agoapp/testpmd: check not configuring port twice
Thomas Monjalon [Thu, 25 Oct 2018 15:11:15 +0000 (17:11 +0200)]
app/testpmd: check not configuring port twice

It is possible to request probing of a device twice,
and possibly get new ports for this device.
However, the ports which were already probed and setup
must not be setup again. That's why it is checked whether
the port is already part of fwd_ports_ids array at the beginning
of the function setup_attached_port().

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
5 years agoapp/testpmd: merge ports list update functions
Thomas Monjalon [Thu, 25 Oct 2018 15:11:14 +0000 (17:11 +0200)]
app/testpmd: merge ports list update functions

The arrays ports_ids and fwd_ports_ids require the same kind
of update when some ports are removed or added.

The functions update_fwd_ports() and remove_unused_fwd_ports()
are merged in the new function remove_invalid_ports().
The part for adding new port is moved into setup_attached_port().

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
5 years agoapp/testpmd: check not detaching device twice
Thomas Monjalon [Thu, 25 Oct 2018 15:11:13 +0000 (17:11 +0200)]
app/testpmd: check not detaching device twice

The command "port detach" is removing the EAL rte_device
of the ethdev port specified as parameter.
The function name and some comments are updated to make clear
that we are detaching the whole device.

After detaching, the pointer, which maps a port to its device,
is reset. This way, it is possible to check whether a port
is still associated to a (not removed) device.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
5 years agonet/ixgbe: update Tx offload mask
Zhirun Yan [Thu, 25 Oct 2018 14:58:40 +0000 (14:58 +0000)]
net/ixgbe: update Tx offload mask

Tx offload mask is updated in following commit: commit 1037ed842c37
("mbuf: fix Tx offload mask"). Currently, the new added offload
flags are not supported in PMD and application will fail to call
PMD transmit prepare function.

This patch updates IXGBE_TX_OFFFLOAD_MASK.

Fixes: 1037ed842c37 ("mbuf: fix Tx offload mask")
Cc: stable@dpdk.org
Signed-off-by: Zhirun Yan <zhirun.yan@intel.com>
Reviewed-by: Xiaolong Ye <xiaolong.ye@intel.com>
5 years agonet/ixgbe: prevent ic session leak on failure
Vipin Varghese [Fri, 12 Oct 2018 09:53:46 +0000 (15:23 +0530)]
net/ixgbe: prevent ic session leak on failure

For function ixgbe_crypto_create_session, fetches ic_session from the
mempool. But on failure scenarios, the object is not released back to
mempool. Using rte_mempool_put the ic_session is put back to mempool.

Signed-off-by: Vipin Varghese <vipin.varghese@intel.com>
Acked-by: Radu Nicolau <radu.nicolau@intel.com>
5 years agoethdev: fix iterator default behaviour for representors
Thomas Monjalon [Wed, 24 Oct 2018 13:13:21 +0000 (15:13 +0200)]
ethdev: fix iterator default behaviour for representors

The iterator was matching all representors if it was not specified
in the devargs string. It was a wrong default behaviour.

If there is no representor parameter in the devargs, the iterator
should not match any representor port.

The implementation of the default behaviour would be simpler
if a "no match" handler is added to rte_kvargs_process().
As it requires an API breakage, it will be reworked later.

Fixes: a7d3c6271d55 ("ethdev: support representor id as iterator filter")

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
5 years agoethdev: filter destroy event before probed
Thomas Monjalon [Wed, 24 Oct 2018 13:12:32 +0000 (15:12 +0200)]
ethdev: filter destroy event before probed

If a port is being created and rollbacked because of an error,
the event RTE_ETH_EVENT_DESTROY should not be sent.
It makes no sense to receive a destroy event for a port which
was not yet announced via RTE_ETH_EVENT_NEW.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
5 years agonet: support MPLS in software packet type parser
Olivier Matz [Tue, 23 Oct 2018 07:46:49 +0000 (09:46 +0200)]
net: support MPLS in software packet type parser

Add RTE_PTYPE_L2_ETHER_MPLS packet type support in rte_net_get_ptype().

Signed-off-by: Didier Pallard <didier.pallard@6wind.com>
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
5 years agonet: add MPLS header structure
Olivier Matz [Tue, 23 Oct 2018 07:46:48 +0000 (09:46 +0200)]
net: add MPLS header structure

Add the Mpls header structure in librte_net. It will be used by next
patch that adds the support of Mpls L2 layer in the software packet
type parser.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
5 years agoethdev: fix metadata documentation
Dekel Peled [Wed, 24 Oct 2018 06:22:00 +0000 (09:22 +0300)]
ethdev: fix metadata documentation

Previous patch introduced the Tx metadata feature, with unnecessary
restrictions on data entry.

This fix updates the documentation, removing the data entry
restrictions on metadata item.

Fixes: 839b20be0e9b ("ethdev: support metadata as flow rule criteria")

Acked-by: Ori Kam <orika@mellanox.com>
Signed-off-by: Dekel Peled <dekelp@mellanox.com>
5 years agoapp/testpmd: fix metadata API and Tx insertion
Dekel Peled [Wed, 24 Oct 2018 06:21:59 +0000 (09:21 +0300)]
app/testpmd: fix metadata API and Tx insertion

Previous patch introduces the Tx metadata feature, with unnecessary
restrictions on data entry.
It also used the metadata in txonly fwd engine only.

This fix removes the data entry restrictions on metadata item.
It also implements callback function to add the metadata in every
Tx packet, sent by any fwd engine.

Fixes: c18feafa193c ("app/testpmd: support metadata as flow rule item")

Signed-off-by: Dekel Peled <dekelp@mellanox.com>
Acked-by: Ori Kam <orika@mellanox.com>
5 years agoraw/ifpga: check probing error
Rosen Xu [Tue, 23 Oct 2018 01:50:49 +0000 (09:50 +0800)]
raw/ifpga: check probing error

Fixes not checking rte_eal_hotplug_add() return value issue.

Coverity issue: 323508
Fixes: ef1e8ede3da5 ("raw/ifpga: add Intel FPGA bus rawdev driver")
Cc: stable@dpdk.org
Signed-off-by: Rosen Xu <rosen.xu@intel.com>
Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>
5 years agonet/mlx5: close all ports on remove
Ophir Munk [Tue, 23 Oct 2018 18:26:05 +0000 (18:26 +0000)]
net/mlx5: close all ports on remove

With the introduction of representors several eth devices are using
the same rte device (e.g. a PCI bus). When calling port detach on one
eth device it is required that all eth devices belonging to the
same rte device have been closed in advance, then the rte device
itself can be removed/detached.
This commit implements this requirement implicitly by adding a
remove callback to struct rte_pci_driver.
The new behavior can be demonstrated in testpmd.
First we attach a representor 0 using PCI address 0000:08:00.0
testpmd> port attach  0000:08:00.0,representor=[0]
Attaching a new port...
EAL: PCI device 0000:08:00.0 on NUMA socket 0
EAL:   probe driver: 15b3:1013 net_mlx5
Port 0 is attached.
Done
Port 1 is attached.
Done

Port 0 is the master device (PF) - an ethdev of the PCI address.
Port 1 is representor 0 - another ethdev (representing a VF) using the
same PCI address. Next we detach port 1
testpmd> port detach 1
Removing a device...
Port 0 is closed
Port 1 is closed
Now total ports is 0
Done

Since port 0 has been implicitly closed we cannot act on it anymore.
testpmd> port stop 0
Invalid port 0

Signed-off-by: Ophir Munk <ophirmu@mellanox.com>
Acked-by: Shahaf Shuler <shahafs@mellanox.com>
5 years agonet/mlx5: release port on close
Ophir Munk [Tue, 23 Oct 2018 18:26:04 +0000 (18:26 +0000)]
net/mlx5: release port on close

With the introduction of representors several eth devices are using
the same rte device (e.g. a PCI bus). It is therefore required to
release the eth device resources during an eth device close operation
rather than during an rte device removal (detach) operation.
In current version many PMDs are still releasing the eth device as
part of the rte device removal. In order to allow a smooth transition
for all PMDs to behave correctly an ethdev flag RTE_ETH_DEV_CLOSE_REMOVE
is used. When this flag is set it indicates to rte_eth_dev_close() to
call rte_eth_dev_release_port(), so the port is freed during the close
operation.

Signed-off-by: Ophir Munk <ophirmu@mellanox.com>
Acked-by: Shahaf Shuler <shahafs@mellanox.com>
5 years agonet/mlx5: allow multiple probing for representor
Ophir Munk [Tue, 23 Oct 2018 18:26:03 +0000 (18:26 +0000)]
net/mlx5: allow multiple probing for representor

Implement probing of a rte device multiple times, see [1].
Set PCI driver RTE_PCI_DRV_PROBE_AGAIN flag to enable multiple probing
of the PCI device by the PCI common driver.
Consecutive probing requests with a devargs string may contain
repetitive master and representors devices for which eth device should
be created only once. In case an eth device already exists - silently
ignore it.

[1]
commit e9d159c3d534 ("eal: allow probing a device again")

Signed-off-by: Ophir Munk <ophirmu@mellanox.com>
Acked-by: Shahaf Shuler <shahafs@mellanox.com>
5 years agonet/mlx5: fix bit width of item and action flags
Yongseok Koh [Wed, 24 Oct 2018 12:36:15 +0000 (15:36 +0300)]
net/mlx5: fix bit width of item and action flags

Most of the code uses uint64_t for MLX5_FLOW_LAYER_* and
MLX5_FLOW_ACTION_*, but there're some code using uint32_t.

Fixes: 2ed2fe5f0a9c ("net/mlx5: rewrite IP address UDP/TCP port by E-Switch")
Fixes: 57123c00c1b8 ("net/mlx5: add Linux TC flower driver for E-Switch flow")
Fixes: fc2c498ccb94 ("net/mlx5: add Direct Verbs translate items")
Fixes: 3d69434113d1 ("net/mlx5: add Direct Verbs validation function")
Fixes: 84c406e74524 ("net/mlx5: add flow translate function")
Fixes: 23c1d42c7138 ("net/mlx5: split flow validation to dedicated function")

Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
Acked-by: Shahaf Shuler <shahafs@mellanox.com>
5 years agonet/mlx5: fix flow tunnel handling
Yongseok Koh [Wed, 24 Oct 2018 12:36:14 +0000 (15:36 +0300)]
net/mlx5: fix flow tunnel handling

Both rte_flow and mlx5_flow redundantly have item flags. And it is not
properly set in the code. This causes wrong tunnel flag handling. A
rte_flow can have multiple expanded device flows if the flow has an RSS
action. Therefore, mlx5_flow should have the layers field.

Fixes: c4d9b9f7f382 ("net/mlx5: add Direct Verbs final functions")
Fixes: fc2c498ccb94 ("net/mlx5: add Direct Verbs translate items")
Fixes: 3d69434113d1 ("net/mlx5: add Direct Verbs validation function")
Fixes: 84c406e74524 ("net/mlx5: add flow translate function")
Fixes: 4e05a229c5da ("net/mlx5: add flow prepare function")
Fixes: 23c1d42c7138 ("net/mlx5: split flow validation to dedicated function")

Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
Acked-by: Shahaf Shuler <shahafs@mellanox.com>
5 years agonet/mlx5: rename static functions
Yongseok Koh [Wed, 24 Oct 2018 12:36:13 +0000 (15:36 +0300)]
net/mlx5: rename static functions

In mlx5_flow*.c, static functions have names starting from 'flow_' while
shared ones start from "mlx5_flow_'.

Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
Acked-by: Shahaf Shuler <shahafs@mellanox.com>
5 years agonet/mlx5: fix flow mark ID conversion in Direct Verbs
Yongseok Koh [Tue, 23 Oct 2018 16:52:15 +0000 (16:52 +0000)]
net/mlx5: fix flow mark ID conversion in Direct Verbs

Fixes: d02cb0691299 ("net/mlx5: add Direct Verbs translate actions")

Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
Acked-by: Ori Kam <orika@mellanox.com>
5 years agonet/mlx5: fix wildcard item for Direct Verbs
Yongseok Koh [Tue, 23 Oct 2018 16:52:13 +0000 (16:52 +0000)]
net/mlx5: fix wildcard item for Direct Verbs

If a network layer is specified with no spec, it means wildcard match.
flow_dv_translate_item_*() returns without writing anything if spec is
null and it causes creation of wrong flow. E.g., the following flow has to
patch with any ipv4 packet.

  flow create 0 ingress pattern eth / ipv4 / end actions ...

But, with the current code, it matches any packet because PMD doesn't write
anything about IPv4. The matcher value and mask becomes completely zero. It
should have written the IP version at least. It is same for the rest of
items.

Even if the spec is null, PMD has to write constant fields before return,
e.g. IP version and IP protocol number.

Fixes: fc2c498ccb94 ("net/mlx5: add Direct Verbs translate items")

Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
Acked-by: Ori Kam <orika@mellanox.com>
5 years agonet/mlx5: fix item validation in Direct Verbs
Yongseok Koh [Tue, 23 Oct 2018 16:52:12 +0000 (16:52 +0000)]
net/mlx5: fix item validation in Direct Verbs

1) remove MPLS item in validation as it doesn't have a translator.

2) add missing NVGRE item to validation

3) match switch-case order between validation and translation.

Fixes: fc2c498ccb94 ("net/mlx5: add Direct Verbs translate items")
Fixes: 3d69434113d1 ("net/mlx5: add Direct Verbs validation function")

Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
Acked-by: Ori Kam <orika@mellanox.com>
5 years agonet/mlx5: fix UDP hash field flag in Direct Verbs
Yongseok Koh [Tue, 23 Oct 2018 16:52:10 +0000 (16:52 +0000)]
net/mlx5: fix UDP hash field flag in Direct Verbs

Fixes: fc2c498ccb94 ("net/mlx5: add Direct Verbs translate items")

Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
Acked-by: Ori Kam <orika@mellanox.com>
5 years agonet/mlx5: add warning message for Direct Verbs flow
Yongseok Koh [Tue, 23 Oct 2018 16:52:09 +0000 (16:52 +0000)]
net/mlx5: add warning message for Direct Verbs flow

In case that the library doesn't support DV flow, if enabled by
'dv_flow_en=1', print out a warning message and disable it.

Fixes: 51e72d386c99 ("net/mlx5: add runtime parameter to enable Direct Verbs")

Signed-off-by: Yongseok Koh <yskoh@mellanox.com>
Acked-by: Ori Kam <orika@mellanox.com>
5 years agonet/mlx5: support new flow counter API
Viacheslav Ovsiienko [Tue, 23 Oct 2018 10:04:16 +0000 (10:04 +0000)]
net/mlx5: support new flow counter API

This patch updates the functions performing the Verbs ibrary calls
in order to support different versions of the library.
The functions:
  - flow_verbs_counter_new()
  - flow_verbs_counter_release()
  - flow_verbs_counter_query()
now have the several compilation branches, depending on the
counters support found in the system at compile time.

The flow_verbs_counter_create() function is introduced as
helper for flow_verbs_counter_new(), actually this helper
create the counters with Verbs.

Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
5 years agonet/mlx5: remove unnecessary structure initializers
Viacheslav Ovsiienko [Tue, 23 Oct 2018 10:04:15 +0000 (10:04 +0000)]
net/mlx5: remove unnecessary structure initializers

The unnecessary structure filed initializers to zero are removed.
We need to do this minor preparation before the following
mlx5 counter structure modification.

Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
5 years agonet/mlx5: add new flow counter Verbs API to glue library
Viacheslav Ovsiienko [Tue, 23 Oct 2018 10:04:14 +0000 (10:04 +0000)]
net/mlx5: add new flow counter Verbs API to glue library

This patch updates the mlx5 glue library, new counter support
Verbs function pointers are added to the glue linking structure
mlx5_glue. This structure now contains the pointers to the both
versions of counter supporting functions due to compatibility
issues. Depending on configuration macros the functions perform
actual Verbs library calls or return an error with meaning
"feature is not supported" (NULL or ENOTSUP).

Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
5 years agonet/mlx5: relocate flow counters query function
Viacheslav Ovsiienko [Tue, 23 Oct 2018 10:04:13 +0000 (10:04 +0000)]
net/mlx5: relocate flow counters query function

The flow_verbs_query_count() is moved into the the group of counter
managing functions and renamed to flow_verbs_counter_query() in order
to be in unified fashion with others.

Also minor function modification is made to avoid unreachable code
warnings if there is no counter support at compile time.

Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
5 years agonet/mlx5: simplify flow counters support check
Viacheslav Ovsiienko [Tue, 23 Oct 2018 10:04:13 +0000 (10:04 +0000)]
net/mlx5: simplify flow counters support check

The redundant check of Flow counters support in runtime is removed.
The flag flow_counter_en is eliminated from the code. The Verbs
create counter function just returns an error if no counter
support presented in the system.

If there is no any of Flow counters configuration macro defined
the log message is emited, indicating the missing counter support.

mlx5_flow_validate_action_count() fuctnion is also updated due to
flow_counter_en flag removal.

Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
5 years agonet/mlx5: introduce new flow counters configuration macro
Viacheslav Ovsiienko [Tue, 23 Oct 2018 10:04:12 +0000 (10:04 +0000)]
net/mlx5: introduce new flow counters configuration macro

The new configuration macro HAVE_IBV_DEVICE_COUNTERS_SET_V45 is
introduced. Both makefile and meson.build are changed.

Flow counter support code depends on the following configuration
macros:

- HAVE_IBV_DEVICE_COUNTERS_SET_V42 - is defined if system supports
  the "old" flow counters functionality, MLNX_OFED version from
  4.2 to 4.4 is required.

- HAVE_IBV_DEVICE_COUNTERS_SET_V45 - is defined if system supports
  the "new" flow counters functionality, MLNX_OVED 4.5 (or higher)
  or Linux rdma-core v19 (or higher) is required.

Neither HAVE_IBV_DEVICE_COUNTERS_SET_V42 nor
HAVE_IBV_DEVICE_COUNTERS_SET_V45 is defined if there is no
counters support.

Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
5 years agonet/mlx5: rename flow counter configuration macro
Viacheslav Ovsiienko [Tue, 23 Oct 2018 10:04:11 +0000 (10:04 +0000)]
net/mlx5: rename flow counter configuration macro

The HAVE_IBV_DEVICE_COUNTERS_SET_SUPPORT is replaced with
HAVE_IBV_DEVICE_COUNTERS_SET_V42. At this stage it is just
macro renaming. This macro is defined if system supports
the "old" Flow counters functionality, MLNX_OFED version
from 4.2 to 4.4 is required.

We need to do this preparation before introducing the new
configuration macro (HAVE_IBV_DEVICE_COUNTERS_SET_V45) for
the "new" Flow counters support.

Both makefile and meson.build are changed.

Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
5 years agonet/mlx5: fix flow counters creation
Viacheslav Ovsiienko [Tue, 23 Oct 2018 10:04:10 +0000 (10:04 +0000)]
net/mlx5: fix flow counters creation

The Flow counter creation function contains two problems:

  - Flow counter object in Verbs is not freed in case of memory
    allocation error. The call of counter Verbs object deallocating
    function is added to fix.

  - The initial value of reference counter is set to one in order
    to provide the correct counter object freeing in the
    flow_verbs_counter_release() function. The reference counter
    field should be initialized to one.

Fixes: 60bd8c9747e8 ("net/mlx5: add count flow action")
Cc: stable@dpdk.org
Signed-off-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
5 years agovhost: initialize postcopy ufd properly
Tiwei Bie [Wed, 24 Oct 2018 09:39:48 +0000 (17:39 +0800)]
vhost: initialize postcopy ufd properly

Currently, postcopy_ufd is initialized to 0 implicitly, so fd 0
could be closed unexpectedly by vhost_backend_cleanup(). Fix this
issue by initializing postcopy_ufd to -1 explicitly.

Fixes: 9eefef3b5970 ("vhost: introduce postcopy advise message")

Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
5 years agovhost: avoid memory barriers when no descriptors dequeued
Maxime Coquelin [Tue, 23 Oct 2018 10:07:10 +0000 (12:07 +0200)]
vhost: avoid memory barriers when no descriptors dequeued

In both split and packed dequeue paths, flush_shadow_used_ring
and vhost_ring_call variants gets called even if not packets
have been dequeued, and so no descriptors updates happened.

It has an impact on CPU pipeline, as memory barriers are used
in these functions.

This patch don't call these functions if no descriptors have
been dequeued. The performance gain with split ring when
dequeue zero-copy is disabled should be null, but should be
noticeable with packed ring or dequeue zero-copy enabled.

Fixes: ae999ce49dcb ("vhost: add Tx support for packed ring")
Fixes: 915cf9404225 ("vhost: use shadow used ring in dequeue path")
Cc: stable@dpdk.org
Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Reviewed-by: Jens Freimann <jfreimann@redhat.com>
Tested-by: Jens Freimann <jfreimann@redhat.com>
Reviewed-by: Tiwei Bie <tiwei.bie@intel.com>
5 years agonet/i40e: update Tx offload mask
Beilei Xing [Tue, 23 Oct 2018 06:14:31 +0000 (14:14 +0800)]
net/i40e: update Tx offload mask

Tx offload mask is updated in following commit:
commit 1037ed842c37 ("mbuf: fix Tx offload mask").

Currently, the new added offload flags are not supported in PMD
and application will fail to call PMD transmit prepare function.
This patch updates PMD Tx offload mask.

Cc: stable@dpdk.org
Signed-off-by: Beilei Xing <beilei.xing@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
5 years agonet/ixgbe: fix RSS flow error return
Wei Zhao [Tue, 23 Oct 2018 03:38:10 +0000 (11:38 +0800)]
net/ixgbe: fix RSS flow error return

If hash function is 0, it should disable RSS then return 0.

Fixes: 518cc3927b13 ("net/ixgbe: move RSS to flow API")
Cc: stable@dpdk.org
Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
Tested-by: Yuan Peng <yuan.peng@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
5 years agonet/i40e: cancel alarm handler at the end of closure
Xiaolong Ye [Tue, 23 Oct 2018 00:54:28 +0000 (08:54 +0800)]
net/i40e: cancel alarm handler at the end of closure

Some operations in i40evf_dev_close like i40evf_dev_promiscuous_disable
still need alarm handler to clear the pending cmd, if alarm handler is
canceled in early stage of i40evf_dev_close,
i40evf_dev_promiscuous_disable will result in failure.

Fixes: 864a800d706d ("net/i40e: remove VF interrupt handler")
Cc: stable@dpdk.org
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
Acked-by: Beilei Xing <beilei.xing@intel.com>
5 years agonet/i40e: enable loopback function for X722 MAC
Haiyue Wang [Mon, 22 Oct 2018 07:47:41 +0000 (15:47 +0800)]
net/i40e: enable loopback function for X722 MAC

In FVL, there was an issue and it didn't support the loopback function
before FW 5.0. For FPK (X722) it should work.

So it needs to distinguish between the devices by checking MAC type.

Fixes: 689bba33272d ("i40e: add VEB switching support")
Fixes: bce83974ba2c ("net/i40e: set Tx loopback from PF")
Cc: stable@dpdk.org
Signed-off-by: Haiyue Wang <haiyue.wang@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
5 years agonet/ixgbe: fix flow create in ntuple check
Faicker Mo [Tue, 18 Sep 2018 05:48:52 +0000 (13:48 +0800)]
net/ixgbe: fix flow create in ntuple check

In ixgbe_flow_create function, ntuple filter is parsed first. If the
flow is considered to be ntuple filter, it will not go on to judge
ethertype filter, syn filter and fdir filter.
In the function ntuple_filter_to_5tuple, 5 tuple info is checked,
but it's too late to jump over the ntuple filter if it's a fdir filter.

Fixes: 46ea969177f3 ("net/ixgbe: add ntuple support to flow parser")
Cc: stable@dpdk.org
Signed-off-by: Faicker Mo <faicker.mo@ucloud.cn>
Acked-by: Wei Zhao <wei.zhao1@intel.com>
5 years agoethdev: support MAC address as iterator filter
Thomas Monjalon [Mon, 22 Oct 2018 13:15:30 +0000 (15:15 +0200)]
ethdev: support MAC address as iterator filter

The MAC addresses of a port can be matched with devargs.

As the conflict between rte_ether.h and netinet/ether.h is not resolved,
the MAC parsing is done with a rte_cmdline function.
As a result, cmdline library becomes a dependency of ethdev.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
5 years agoethdev: support representor id as iterator filter
Thomas Monjalon [Mon, 22 Oct 2018 13:15:29 +0000 (15:15 +0200)]
ethdev: support representor id as iterator filter

The representor id is added in rte_eth_dev_data in order to be able
to match a port with its representor id in devargs.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>
5 years agoethdev: move representor parsing functions
Thomas Monjalon [Mon, 22 Oct 2018 13:15:28 +0000 (15:15 +0200)]
ethdev: move representor parsing functions

The functions for representor devargs parsing were static
in the file rte_ethdev.c.
In order to reuse them in the file rte_class_eth.c,
they are moved to the files ethdev_private.c/.h.

A log is fixed by adding a missing line feed.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
5 years agokvargs: support list value
Thomas Monjalon [Mon, 22 Oct 2018 13:15:27 +0000 (15:15 +0200)]
kvargs: support list value

If a value contains a comma, rte_kvargs_tokenize() will split here.
In order to support list syntax [a,b] as value, an extra parsing of
the square brackets is added.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
5 years agonet/mlx5: support metadata as flow rule criteria
Dekel Peled [Tue, 23 Oct 2018 19:34:09 +0000 (22:34 +0300)]
net/mlx5: support metadata as flow rule criteria

As described in series starting at [1], it adds option to set
metadata value as match pattern when creating a new flow rule.

This patch adds metadata support in mlx5 driver, in two parts:
- Add the validation and setting of metadata value in matcher,
  when creating a new flow rule.
- Add the passing of metadata value from mbuf to wqe when
  indicated by ol_flag, in different burst functions.

[1] "ethdev: support metadata as flow rule criteria"
    http://mails.dpdk.org/archives/dev/2018-September/113269.html

Signed-off-by: Dekel Peled <dekelp@mellanox.com>
Acked-by: Shahaf Shuler <shahafs@mellanox.com>
5 years agoapp/testpmd: support more types for flow RSS
Wei Zhao [Tue, 23 Oct 2018 09:20:56 +0000 (17:20 +0800)]
app/testpmd: support more types for flow RSS

Some user and tester require flow RSS to support more types,
so add "all" and "none" to make configuration more easy for users.

Tested-by: Yuan Peng <yuan.peng@intel.com>
Signed-off-by: Wei Zhao <wei.zhao1@intel.com>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
5 years agoeal: remove deprecated attach/detach functions
Thomas Monjalon [Tue, 23 Oct 2018 08:28:41 +0000 (10:28 +0200)]
eal: remove deprecated attach/detach functions

These hotplug functions were deprecated and have some new replacements.
As announced earlier, the oldest ones are now removed.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>
5 years agoethdev: remove deprecated attach/detach functions
Thomas Monjalon [Tue, 23 Oct 2018 08:28:40 +0000 (10:28 +0200)]
ethdev: remove deprecated attach/detach functions

The hotplug attach/detach features are implemented in EAL layer.
There is a new ethdev iterator to retrieve ports from ethdev layer.

As announced earlier, the (buggy) ethdev functions are now removed.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>
5 years agodoc: replace doxygen example in contribution guide
Thomas Monjalon [Tue, 23 Oct 2018 08:28:39 +0000 (10:28 +0200)]
doc: replace doxygen example in contribution guide

The provided example of doxygen header is about a deprecated function.
It is replaced by rte_spinlock_trylock() which is small and
good enough for the purpose.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>
5 years agoethdev: allow iterating with pure class filter
Thomas Monjalon [Tue, 23 Oct 2018 08:28:38 +0000 (10:28 +0200)]
ethdev: allow iterating with pure class filter

If no rte_device is given in the iterator,
eth_dev_match() is looking at all ports without any restriction,
except the ethdev kvargs filter.

It allows to iterate with a devargs filter referencing only
some ethdev parameters. The format (from the new devargs syntax) is:
class=eth,paramY=Y

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>
5 years agoethdev: add iterator to match devargs input
Thomas Monjalon [Tue, 23 Oct 2018 08:28:37 +0000 (10:28 +0200)]
ethdev: add iterator to match devargs input

The iterator will return the ethdev port ids matching a devargs string.
It is recommended to use the macro RTE_ETH_FOREACH_MATCHING_DEV()
for usage convenience.

The class string is prefixed with '+' in order to skip the validation
of the parameter keys. It is tolerated for the compatibility with
the old (current) syntax where all parameters (bus, class and driver)
are mixed in the same string without any delimiter.
Thanks to this compatibility prefix, the driver parameters will be
skipped during the ethdev parsing, and not considered invalid.

A macro is introduced in rte_common.h to workaround a const field.
This hack is needed to free const strings in the iterator.
It is preferred to keep the const for these fields, because it gives
a hint that they are not changed at each iteration.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>
5 years agobus/vdev: add iteration filter on name
Thomas Monjalon [Tue, 23 Oct 2018 08:28:36 +0000 (10:28 +0200)]
bus/vdev: add iteration filter on name

A virtual device can be matched with following syntax:
bus=vdev,name=X

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>
5 years agovhost: fix vector filling for packed ring
Tiwei Bie [Tue, 23 Oct 2018 06:07:49 +0000 (14:07 +0800)]
vhost: fix vector filling for packed ring

We should return the length of the buffers described by
the current descriptor chain after filling the buffer
vector. So we need to zero the *len first.

Fixes: 2f3225a7d69b ("vhost: add vector filling support for packed ring")
Cc: stable@dpdk.org
Signed-off-by: Tiwei Bie <tiwei.bie@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
5 years agovhost/crypto: fix shared lib build without cryptodev
Timothy Redaelli [Tue, 16 Oct 2018 20:47:16 +0000 (22:47 +0200)]
vhost/crypto: fix shared lib build without cryptodev

Currently it's not possible to build DPDK as shared library with
cryptodev disabled since vhost is trying to link with rte_crypto,
but rte_crypto and rte_hash are only needed when you build vhost_crypto
and so only when cryptodev is enabled.

This patch fix this by linking rte_vhost with rte_crypto and rte_hash
only when cryptodev is enabled.

Fixes: b4ca81298613 ("vhost/crypto: fix build without cryptodev")
Fixes: 939066d96563 ("vhost/crypto: add public function implementation")
Cc: stable@dpdk.org
Signed-off-by: Timothy Redaelli <tredaelli@redhat.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
5 years agoapp/testpmd: add MPLSoGRE encapsulation
Ori Kam [Mon, 22 Oct 2018 17:38:11 +0000 (17:38 +0000)]
app/testpmd: add MPLSoGRE encapsulation

Example for MPLSoGRE tunnel:
ETH / IPV4 / GRE / MPLS / IP / L4..L7

In order to encapsulate such a tunnel there is a need to remove L2 of
the inner packet and encap the remaining tunnel, this is done by
applying 2 rte flow commands l2_decap followed by mplsogre_encap.
Both commands must appear in the same flow, and from the point of the
packet it both actions are applied at the same time. (There is no part
where a packet doesn't have L2 header).

Decapsulating such a tunnel works the other way, first we need to decap
the outer tunnel header and then apply the new L2.
So the commands will be mplsogre_decap / l2_encap

Due to the complex encapsulation of MPLSoGRE flow action and
based on the fact testpmd does not allocate memory, this patch adds a
new command in testpmd to initialise a global structure containing the
necessary information to make the outer layer of the packet.  This same
global structures will then be used by the flow commands in testpmd when
the action mplsogre_encap, mplsogre_decap, will be parsed, at this
point, the conversion into such action becomes trivial.

Signed-off-by: Ori Kam <orika@mellanox.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
5 years agoapp/testpmd: add MPLSoUDP encapsulation
Ori Kam [Mon, 22 Oct 2018 17:38:10 +0000 (17:38 +0000)]
app/testpmd: add MPLSoUDP encapsulation

MPLSoUDP is an example for L3 tunnel encapsulation.

L3 tunnel type is a tunnel that is missing the layer 2 header of the
inner packet.

Example for MPLSoUDP tunnel:
ETH / IPV4 / UDP / MPLS / IP / L4..L7

In order to encapsulate such a tunnel there is a need to remove L2 of
the inner packet and encap the remaining tunnel, this is done by
applying 2 rte flow commands l2_decap followed by mplsoudp_encap.
Both commands must appear in the same flow, and from the point of the
packet it both actions are applied at the same time. (There is no part
where a packet doesn't have L2 header).

Decapsulating such a tunnel works the other way, first we need to decap
the outer tunnel header and then apply the new L2.
So the commands will be mplsoudp_decap / l2_encap

Due to the complex encapsulation of MPLSoUDP and L2  flow actions and
based on the fact testpmd does not allocate memory, this patch adds a
new command in testpmd to initialise a global structures containing the
necessary information to make the outer layer of the packet.  This same
global structures will then be used by the flow commands in testpmd when
the action mplsoudp_encap, mplsoudp_decap, l2_encap, l2_decap, will be
parsed, at this point, the conversion into such action becomes trivial.

The l2_encap and l2_decap actions can also be used for other L3 tunnel
types.

Signed-off-by: Ori Kam <orika@mellanox.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
5 years agoethdev: add raw encapsulation action
Ori Kam [Mon, 22 Oct 2018 17:38:09 +0000 (17:38 +0000)]
ethdev: add raw encapsulation action

Currenlty the encap/decap actions only support encapsulation
of VXLAN and NVGRE L2 packets (L2 encapsulation is where
the inner packet has a valid Ethernet header, while L3 encapsulation
is where the inner packet doesn't have the Ethernet header).
In addtion the parameter to to the encap action is a list of rte items,
this results in 2 extra translation, between the application to the
actioni and from the action to the NIC. This results in negative impact
on the insertion performance.

Looking forward there are going to be a need to support many more tunnel
encapsulations. For example MPLSoGRE, MPLSoUDP.
Adding the new encapsulation will result in duplication of code.
For example the code for handling NVGRE and VXLAN are exactly the same,
and each new tunnel will have the same exact structure.

This patch introduce a raw encapsulation that can support L2 tunnel types
and L3 tunnel types. In addtion the new
encapsulations commands are using raw buffer inorder to save the
converstion time, both for the application and the PMD.

In order to encapsulate L3 tunnel type there is a need to use both
actions in the same rule: The decap to remove the L2 of the original
packet, and then encap command to encapsulate the packet with the
tunnel.
For decap L3 there is also a need to use both commands in the same flow
first the decap command to remove the outer tunnel header and then encap
to add the L2 header.

Signed-off-by: Ori Kam <orika@mellanox.com>
Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
5 years agonet/mlx5: support e-switch flow count action
Moti Haimovsky [Thu, 18 Oct 2018 18:29:23 +0000 (21:29 +0300)]
net/mlx5: support e-switch flow count action

This commit adds support for configuring flows destined to the mlx5
eswitch with 'count' action and for querying these counts at runtime.

Each flow rule configured by the mlx5 driver is implicitly assigned
with flow counters. These counters can be retrieved when querying
the flow rule via Netlink, they can be found in each flow action
section of the reply. Hence, supporting the 'count' action in the
flow configuration command is straight-forward. When transposing
the command to a tc Netlink message we just ignore it instead of
rejecting it.
In the 'flow query count' side, the command now uses tc Netlink
query command in order to retrieve the values of the flow counters.

Signed-off-by: Moti Haimovsky <motih@mellanox.com>
5 years agonet/mlx5: add flow query abstraction interface
Moti Haimovsky [Thu, 18 Oct 2018 18:29:22 +0000 (21:29 +0300)]
net/mlx5: add flow query abstraction interface

Flow engine now supports multiple driver paths with each having
its own flow query implantation routine.
This patch adds an abstraction to the flow query routine in accordance
to commit 0c76d1c9a18d ("net/mlx5: add abstraction for multiple flow
drivers") done by Yongseok Koh.

Signed-off-by: Moti Haimovsky <motih@mellanox.com>
5 years agonet/mlx5: use the new infrastructure for tc flow
Moti Haimovsky [Thu, 18 Oct 2018 18:29:21 +0000 (21:29 +0300)]
net/mlx5: use the new infrastructure for tc flow

modified TC-flow code to use the new infrastructure
introduced in "net/mlx5: refactor TC-flow infrastructure"
commit.

Signed-off-by: Moti Haimovsky <motih@mellanox.com>
5 years agonet/mlx5: refactor TC-flow infrastructure
Moti Haimovsky [Thu, 18 Oct 2018 18:29:20 +0000 (21:29 +0300)]
net/mlx5: refactor TC-flow infrastructure

This commit refactors tc_flow as a preparation to coming commits
that sends different type of messages and expect differ type of replies
while still using the same underlying routines.

Signed-off-by: Moti Haimovsky <motih@mellanox.com>
5 years agoapp/testpmd: support metadata as flow rule item
Dekel Peled [Sun, 21 Oct 2018 14:22:48 +0000 (17:22 +0300)]
app/testpmd: support metadata as flow rule item

As described in [1], this series adds option to set metadata value
as match pattern when creating a new flow rule.

This patch introduces additional options in testpmd commands:
- New item type "meta" "data"
- New per-port offload flag "match_metadata".

It also adds commands to configure the tx_metadata value to use:
- New 'config' command takes a 32 bit value and stores it per port:
port config <port_id> tx_metadata <value>
  testpmd will add to any Tx packet sent from this port the metadata
  value, and set ol_flags accordingly.
- A matching 'show' command is added to read the configured value:
port config <port_id> tx_metadata <value>

[1] "ethdev: support metadata as flow rule criteria"

Signed-off-by: Dekel Peled <dekelp@mellanox.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
5 years agoethdev: support metadata as flow rule criteria
Dekel Peled [Sun, 21 Oct 2018 14:22:47 +0000 (17:22 +0300)]
ethdev: support metadata as flow rule criteria

As described in [1], a new rte_flow item is added to support metadata
to use as flow rule match pattern.
The metadata is an opaque item, fully controlled by the application.

The use of metadata is relevant for egress rules only.
It can be set in the flow rule using the RTE_FLOW_ITEM_META.

An additional member 'tx_metadata' is added in union with existing member
'hash' of struct 'rte_mbuf', located to avoid conflicts with existing
fields. This additional member is used to carry the metadata item.

Application should set the packet metadata in the mbuf dedicated field,
and set the PKT_TX_METADATA flag in the mbuf->ol_flags.
The NIC will use the packet metadata as match criteria for relevant
flow rules.

This patch introduces metadata item type for rte_flow RTE_FLOW_ITEM_META,
along with corresponding struct rte_flow_item_meta and ol_flag
PKT_TX_METADATA.

[1] "[RFC,v2] ethdev: support metadata as flow rule criteria"

Signed-off-by: Dekel Peled <dekelp@mellanox.com>
Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
5 years agoethdev: complete closing of port
Thomas Monjalon [Fri, 19 Oct 2018 02:07:57 +0000 (04:07 +0200)]
ethdev: complete closing of port

After closing a port, it cannot be restarted.
So there is no reason to not free all associated resources.

The last step was done with rte_eth_dev_detach() which is deprecated.
Instead of blindly removing the associated rte_device, the driver should
check if no more port (ethdev, cryptodev, etc) is open for the device.

The last ethdev freeing which were done by rte_eth_dev_detach(),
are now done at the end of rte_eth_dev_close() if the driver supports
the flag RTE_ETH_DEV_CLOSE_REMOVE.
There will be a transition period for PMDs to enable this new flag
and migrate to the new behaviour.
When enabling RTE_ETH_DEV_CLOSE_REMOVE, the PMD must free all its
private resources for the port, in its dev_close function.
It is advised to call the dev_close function in the remove function
in order to support removing a device without closing its ports.

Some drivers does not allocate MAC addresses dynamically or separately.
In those cases, the pointer is set to NULL, in order to avoid wrongly
freeing them in rte_eth_dev_release_port().

A closed port will have the state RTE_ETH_DEV_UNUSED which is
considered as invalid by rte_eth_dev_is_valid_port().
So validity is not checked anymore for closed ports in testpmd.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>
5 years agoethdev: remove release function for secondary process
Thomas Monjalon [Fri, 19 Oct 2018 02:07:56 +0000 (04:07 +0200)]
ethdev: remove release function for secondary process

After previous changes, the function rte_eth_dev_release_port()
can be used for primary or secondary process as well.
The only difference with rte_eth_dev_release_port_secondary()
is the shared lock used in rte_eth_dev_release_port().

The function rte_eth_dev_release_port_secondary() was recently
added in 18.11 cycle.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>
5 years agoethdev: free all common data when releasing port
Thomas Monjalon [Fri, 19 Oct 2018 02:07:55 +0000 (04:07 +0200)]
ethdev: free all common data when releasing port

This is a clean-up of common ethdev data freeing.
All data freeing are moved to rte_eth_dev_release_port()
and done only in case of primary process.

It is probably fixing some memory leaks for PMDs which were
not freeing all data.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
5 years agoethdev: fix doxygen comments of shared data fields
Thomas Monjalon [Fri, 19 Oct 2018 02:07:54 +0000 (04:07 +0200)]
ethdev: fix doxygen comments of shared data fields

Some doxygen comments were wrongly associated to the next field
because of syntax /** instead of /**<

Some other cleanups (like alignment) are done.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>
5 years agoapp/testpmd: allow detaching a port not closed
Thomas Monjalon [Fri, 19 Oct 2018 02:07:53 +0000 (04:07 +0200)]
app/testpmd: allow detaching a port not closed

The testpmd application aim is for testing;
so order of operations should not be enforced.

There was a test to forbid detaching before closing a port.
However, it may interesting to test what happens in such case.
It is possible for a PMD to automatically close the port when detaching.

in order to avoid a crash, it is checked that the port must be stopped
before detaching (as for closing).

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
5 years agoapp/testpmd: update port list for multiple removals
Wisam Jaddo [Fri, 19 Oct 2018 02:07:52 +0000 (04:07 +0200)]
app/testpmd: update port list for multiple removals

When detaching a port, the full rte_device is removed.
If the rte_device was hosting several ports,
the testpmd list of ports must be updated for multiple removals.

Signed-off-by: Wisam Jaddo <wisamm@mellanox.com>
Acked-by: Bernard Iremonger <bernard.iremonger@intel.com>
5 years agodoc: update release notes for enic
Hyong Youb Kim [Sat, 20 Oct 2018 08:32:49 +0000 (01:32 -0700)]
doc: update release notes for enic

Fixes: 8a6ff33d6d36 ("net/enic: add AVX2 based vectorized Rx handler")
Fixes: 86df6c4e2fce ("net/enic: support flow counter action")
Fixes: 70401fd7784d ("net/enic: add VLAN and csum offloads to simple Tx handler")
Fixes: c0aae00d7da0 ("net/enic: enable IOVA mode")

Signed-off-by: Hyong Youb Kim <hyonkim@cisco.com>
Reviewed-by: John Daley <johndale@cisco.com>
5 years agonet/enic: add missing Tx offload flags
Hyong Youb Kim [Sat, 20 Oct 2018 08:32:48 +0000 (01:32 -0700)]
net/enic: add missing Tx offload flags

The following commit has added a number of existing offload flags such
as PKT_TX_IPV4 and PKT_TX_IPV6 to PKT_TX_OFFLOAD_MASK defined in
rte_mbuf.h. That change breaks the enic driver's Tx prepare handler.

commit ef28cfa73822 ("mbuf: fix Tx offload mask")

The enic driver keeps the supported offload flags in a local variable
(tx_offload_mask), which is strictly a subset of
PKT_TX_OFFLOAD_MASK. This variable is then used to compute the
unsupported flags (tx_offload_notsup_mask), and the Tx prepare handler
(tx_pkt_prepare) uses it to reject packets with unsupported offload
flags.

As is, tx_offload_notsup_mask ends up containing flags like
PKT_TX_IPV4 that are actually supported by the driver, which then
breaks any application that uses checksum offloads and calls the Tx
prepare handler. So add the flags to tx_offload_mask that the driver
supports but were missing in PKT_TX_OFFLOAD_MASK.

Signed-off-by: Hyong Youb Kim <hyonkim@cisco.com>
Reviewed-by: John Daley <johndale@cisco.com>
5 years agonet/enic: fix supported packet types
Hyong Youb Kim [Sat, 20 Oct 2018 08:32:47 +0000 (01:32 -0700)]
net/enic: fix supported packet types

The handler for dev_supported_ptypes_get currently returns null when
the vectorized Rx handler is used. It is also missing tunnel packet
types. Add the missing packet types to the supported list, and return
the right list for the vectorized Rx handler.

Fixes: 8a6ff33d6d36 ("net/enic: add AVX2 based vectorized Rx handler")
Fixes: 93fb21fdbe23 ("net/enic: enable overlay offload for VXLAN and GENEVE")
Cc: stable@dpdk.org
Signed-off-by: Hyong Youb Kim <hyonkim@cisco.com>
Reviewed-by: John Daley <johndale@cisco.com>
5 years agoexamples/vdpa: fix spelling in error message
Stephen Hemminger [Thu, 18 Oct 2018 22:34:30 +0000 (15:34 -0700)]
examples/vdpa: fix spelling in error message

Fixes: edbed86d1cc3 ("examples/vdpa: introduce a new sample for vDPA")

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
5 years agodoc: fix spelling in PMD guides
Stephen Hemminger [Thu, 18 Oct 2018 22:32:55 +0000 (15:32 -0700)]
doc: fix spelling in PMD guides

Trivial pelling errors found by codespell.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Marko Kovacevic <marko.kovacevic@intel.com>
5 years agonet/i40e: keep promiscuous on if allmulticast is enabled
Huaibin Wang [Fri, 19 Oct 2018 09:45:21 +0000 (11:45 +0200)]
net/i40e: keep promiscuous on if allmulticast is enabled

Promisc should not be disabled if the all multicast mode is enabled.
Patch keeps the promiscuous on if all multicast mode is on, this
behavior is also consistent with the implementation done on ixgbe
pmd.

Cc: stable@dpdk.org
Signed-off-by: Huaibin Wang <huaibin.wang@6wind.com>
Signed-off-by: Laurent Hardy <laurent.hardy@6wind.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>