dpdk.git
4 years agovdpa/ifc: fix build with recent kernels
Maxime Coquelin [Fri, 2 Oct 2020 07:54:00 +0000 (09:54 +0200)]
vdpa/ifc: fix build with recent kernels

VIRTIO_F_IOMMU_PLATFORM is now defined in recent kernel
headers, causing build issue.

Let's define it in the IFC vDPA driver only if it wasn't already.

Fixes: a3f8150eac6d ("net/ifcvf: add ifcvf vDPA driver")
Cc: stable@dpdk.org
Reported-by: Brandon Lo <blo@iol.unh.edu>
Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Acked-by: David Marchand <david.marchand@redhat.com>
4 years agosupport python 3 only
Louise Kilheeney [Wed, 30 Sep 2020 11:40:14 +0000 (12:40 +0100)]
support python 3 only

Changed scripts to explicitly use Python 3 only, to avoid
maintaining Python 2.
Removed deprecation notices.

Signed-off-by: Louise Kilheeney <louise.kilheeney@intel.com>
Signed-off-by: Kevin Laatz <kevin.laatz@intel.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Robin Jarry <robin.jarry@6wind.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Ray Kinsella <mdr@ashroe.eu>
4 years agopipeline: fix build with glibc < 2.26
David Marchand [Fri, 2 Oct 2020 08:28:31 +0000 (10:28 +0200)]
pipeline: fix build with glibc < 2.26

reallocarray has been introduced in glibc 2.26 but we still support
glibc >= 2.7.
Simply replace with realloc, as the considered sizes are unlikely to
overflow.

"""
The reallocarray() function changes the size of the memory block
pointed to by ptr to be large enough for an array of nmemb elements,
each of which is size bytes.  It is equivalent to the call

       realloc(ptr, nmemb * size);

However, unlike that realloc() call, reallocarray() fails safely in
the case where the multiplication would overflow.  If such an over‐
flow occurs, reallocarray() returns NULL, sets errno to ENOMEM, and
leaves the original block of memory unchanged.
"""

Fixes: 3ca60ceed79a ("pipeline: add SWX pipeline specification file")

Signed-off-by: David Marchand <david.marchand@redhat.com>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
4 years agonet/virtio: introduce vhost-vDPA backend
Maxime Coquelin [Tue, 29 Sep 2020 16:14:04 +0000 (18:14 +0200)]
net/virtio: introduce vhost-vDPA backend

vhost-vDPA is a new virtio backend type introduced by vDPA kernel
framework, which provides abstraction to the vDPA devices and
exposes an unified control interface through a char dev.

This patch adds support to the vhost-vDPA backend. As similar to
the existing vhost kernel backend, a set of virtio_user ops were
introduced for vhost-vDPA backend to handle device specific operations
such as:
 - device setup
 - ioctl message handling
 - queue pair enabling
 - dma map/unmap
vDPA relevant ioctl codes and data structures are also defined in
this patch.

Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
4 years agonet/virtio: split virtio-user start
Maxime Coquelin [Tue, 29 Sep 2020 16:14:03 +0000 (18:14 +0200)]
net/virtio: split virtio-user start

Move feature bit settings in device start out as an standalone
function, so that feature bit could be negotiated at device
feature_ok status.

Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
4 years agonet/virtio: adapt virtio-user status size
Maxime Coquelin [Tue, 29 Sep 2020 16:14:02 +0000 (18:14 +0200)]
net/virtio: adapt virtio-user status size

Set proper payload size for set/get status message. The payload
size varies according to backend types.

Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Signed-off-by: Patrick Fu <patrick.fu@intel.com>
Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
4 years agonet/virtio: check protocol feature in user backend
Maxime Coquelin [Tue, 29 Sep 2020 16:14:01 +0000 (18:14 +0200)]
net/virtio: check protocol feature in user backend

When sending set status message, move protocol feature check
to vhost_user to be compatible with different backend types.

Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
4 years agonet/virtio: introduce vhost-vDPA backend type
Maxime Coquelin [Tue, 29 Sep 2020 16:14:00 +0000 (18:14 +0200)]
net/virtio: introduce vhost-vDPA backend type

Backend type is determined by checking char-device major numbers

Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Signed-off-by: Adrian Moreno <amorenoz@redhat.com>
Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
4 years agonet/virtio: move backend type selection to ethdev
Adrian Moreno [Tue, 29 Sep 2020 16:13:59 +0000 (18:13 +0200)]
net/virtio: move backend type selection to ethdev

This is a preparation patch with no functional change.

Use an enum instead of a boolean for the backend type.
Move the detection logic to the ethdev layer (where it is needed for the
first time).
The virtio_user_dev stores the backend type in the virtio_user_dev
struct so the type is only determined once

Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Signed-off-by: Adrian Moreno <amorenoz@redhat.com>
Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
4 years agonet/virtio: introduce DMA ops
Maxime Coquelin [Tue, 29 Sep 2020 16:13:58 +0000 (18:13 +0200)]
net/virtio: introduce DMA ops

Add DMA map/unmap callbacks to the virtio_user pmd, which could
be leveraged by vdev bus driver to map memory for backend
devices with DMA capability.

Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
4 years agobus/vdev: add DMA mapping ops
Maxime Coquelin [Tue, 29 Sep 2020 16:13:57 +0000 (18:13 +0200)]
bus/vdev: add DMA mapping ops

Add DMA map/unmap operation callbacks to the vdev bus, which
could be used by DMA capable vdev drivers.

Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
4 years agovhost: remove dequeue zero-copy support
Maxime Coquelin [Mon, 28 Sep 2020 09:17:12 +0000 (11:17 +0200)]
vhost: remove dequeue zero-copy support

Dequeue zero-copy removal was announced in DPDK v20.08.
This feature brings constraints which makes the maintenance
of the Vhost library difficult. Its limitations makes it also
difficult to use by the applications (Tx vring starvation).

Removing it makes it easier to add new features, and also remove
some code in the hot path, which should bring a performance
improvement for the standard path.

Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
4 years agoexamples/vhost: remove dequeue zero-copy support
Maxime Coquelin [Mon, 28 Sep 2020 09:17:11 +0000 (11:17 +0200)]
examples/vhost: remove dequeue zero-copy support

Dequeue zero-copy feature is being removed from the
Vhost library. This preliminary patch removes its uses
in the Vhost example application.

Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
4 years agoexamples/vhost_crypto: use vhost async-copy flag
Maxime Coquelin [Mon, 28 Sep 2020 09:17:10 +0000 (11:17 +0200)]
examples/vhost_crypto: use vhost async-copy flag

The crypto backend uses RTE_VHOST_USER_DEQUEUE_ZERO_COPY only
for the shared areas to be populated at mmap time. It does
not use the other mechanisms the feature provides.

Now that RTE_VHOST_USER_DEQUEUE_ZERO_COPY is being removed,
let's use RTE_VHOST_USER_ASYNC_COPY instead which does the
same thing.

Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
4 years agonet/vhost: remove dequeue zero-copy support
Maxime Coquelin [Mon, 28 Sep 2020 09:17:09 +0000 (11:17 +0200)]
net/vhost: remove dequeue zero-copy support

The dequeue zero-copy feature from the Vhost library is
being removed in this release, this patch remove its support
in the Vhost PMD.

Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
4 years agonet/virtio: fix indirect descriptors in packed datapaths
Marvin Liu [Mon, 28 Sep 2020 08:20:52 +0000 (16:20 +0800)]
net/virtio: fix indirect descriptors in packed datapaths

Like split ring, packed ring will utilize indirect ring
elements when queuing mbufs need multiple descriptors.
Thus each packet will take only one slot when having
multiple segments.

Fixes: 892dc798fa9c ("net/virtio: implement Tx path for packed queues")
Cc: stable@dpdk.org
Signed-off-by: Marvin Liu <yong.liu@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
4 years agonet/virtio: fix packed ring indirect descricptors setup
Marvin Liu [Mon, 28 Sep 2020 08:20:51 +0000 (16:20 +0800)]
net/virtio: fix packed ring indirect descricptors setup

Add packed indirect descriptors format into virtio Tx
region. When initializing vring, packed indirect
descriptors will be initialized if ring type is packed.

Fixes: bc80357cd677 ("net/virtio: drop unused field in Tx region structure")
Cc: stable@dpdk.org
Signed-off-by: Marvin Liu <yong.liu@intel.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
4 years agoexamples/vhost_blk: check driver start failure
Yunjian Wang [Fri, 25 Sep 2020 11:22:06 +0000 (19:22 +0800)]
examples/vhost_blk: check driver start failure

This checks the return value from the function
rte_vhost_driver_start.

Coverity issue: 362027
Fixes: c19beb3f38cd ("examples/vhost_blk: introduce vhost storage sample")
Cc: stable@dpdk.org
Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
4 years agonet/virtio: sync speed capability with ethdev
Ivan Dyukov [Tue, 22 Sep 2020 21:18:02 +0000 (00:18 +0300)]
net/virtio: sync speed capability with ethdev

ethdev library was updated with new speed 200G

Add 200G speed capa to virtio device

Signed-off-by: Ivan Dyukov <i.dyukov@samsung.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
4 years agonet/virtio: set default speed unknown
Ivan Dyukov [Tue, 22 Sep 2020 21:18:01 +0000 (00:18 +0300)]
net/virtio: set default speed unknown

rte_ethdev states new rule for NICs: they should return UNKNOWN
speed if speed is unknown and interface is up, in case of down
interface, NONE speed should be returned.

Signed-off-by: Ivan Dyukov <i.dyukov@samsung.com>
Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>
4 years agovhost: promote vDPA API as stable
Maxime Coquelin [Tue, 15 Sep 2020 07:25:56 +0000 (09:25 +0200)]
vhost: promote vDPA API as stable

As announced in v20.08, this patch makes the vDPA
and related Vhost API stable.

Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
4 years agodoc: fix ethdev port id size
Chenbo Xia [Wed, 30 Sep 2020 04:23:28 +0000 (12:23 +0800)]
doc: fix ethdev port id size

The ethdev port id should be 16 bits now. This patch changes the
variable size of port id in docs from 8 bits to 16 bits.

Fixes: fdec9301f52d ("doc: add flow classify guides")
Fixes: 4a3ef59a10c8 ("examples/flow_filtering: add simple demo of flow API")
Cc: stable@dpdk.org
Signed-off-by: Chenbo Xia <chenbo.xia@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agoapp: fix ethdev port id size
Chenbo Xia [Wed, 30 Sep 2020 04:23:27 +0000 (12:23 +0800)]
app: fix ethdev port id size

The ethdev port id should be 16 bits now. This patch changes the
variable size of port id in applications from 8 bits to 16 bits.

Fixes: e977e4199a8d ("app/testpmd: add commands to load/unload BPF filters")
Fixes: 46cf97e4bbfa ("eventdev: add test for eth Tx adapter")
Cc: stable@dpdk.org
Signed-off-by: Chenbo Xia <chenbo.xia@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agodrivers/net: fix port id size
Chenbo Xia [Wed, 30 Sep 2020 04:23:26 +0000 (12:23 +0800)]
drivers/net: fix port id size

The ethdev port id should be 16 bits now. This patch changes the
variable size of port id in some net drivers from 8 bits to 16
bits.

Fixes: 09b23f8b9df6 ("net/bnxt: fix port stop process and cleanup resources")
Fixes: 769de16872ab ("net/bnxt: fix port default rule create/destroy")
Fixes: 50370662b727 ("net/ice: support device and queue ops")
Fixes: a50d7cbbdad7 ("net/qede: support registers dump")
Cc: stable@dpdk.org
Signed-off-by: Chenbo Xia <chenbo.xia@intel.com>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agonet/ring: advertise multi segment Tx and scatter Rx
Dumitru Ceara [Mon, 28 Sep 2020 18:47:29 +0000 (20:47 +0200)]
net/ring: advertise multi segment Tx and scatter Rx

Even though ring interfaces don't support any other TX/RX offloads they
do support sending multi segment packets and this should be advertised
in order to not break applications that use ring interfaces.

Also advertise scatter RX support.

Signed-off-by: Dumitru Ceara <dceara@redhat.com>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
4 years agonet/sfc: create virtual switch to enable VFs
Andrew Rybchenko [Thu, 24 Sep 2020 13:02:35 +0000 (14:02 +0100)]
net/sfc: create virtual switch to enable VFs

PF driver is responsible for vSwitch creation and vPorts allocation
for VFs.

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
4 years agonet/sfc: fix RSS hash offload if queue action is used
Igor Romanov [Thu, 24 Sep 2020 12:40:59 +0000 (13:40 +0100)]
net/sfc: fix RSS hash offload if queue action is used

When RSS hash offload is requested, the ingress filters that forward
packets to an RX queue must have an RSS context assigned to them to
calculate RSS hash, which was not always provided.

Fix it by creating a dummy RSS context that forwards packets
to the same queue and assign it to created by flow API filters when
RSS hash offload is enabled. RSS key and hash functions from
default RSS context are used.

Fixes: 5d308972954c ("ethdev: add mbuf RSS update as an offload")
Cc: stable@dpdk.org
Signed-off-by: Igor Romanov <igor.romanov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
4 years agonet/sfc: fix RSS hash flag when offload is disabled
Igor Romanov [Thu, 24 Sep 2020 12:40:58 +0000 (13:40 +0100)]
net/sfc: fix RSS hash flag when offload is disabled

Do not set RSS hash flag in the received mbufs when RSS hash
offload is not enabled, which means that RSS hash value is invalid.

Fixes: 5d308972954c ("ethdev: add mbuf RSS update as an offload")
Cc: stable@dpdk.org
Signed-off-by: Igor Romanov <igor.romanov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
4 years agoapp/testpmd: extend ICMP flow matching fields
Li Zhang [Wed, 9 Sep 2020 03:34:34 +0000 (06:34 +0300)]
app/testpmd: extend ICMP flow matching fields

Ability to distinguish ICMP identifier fields in packets.
Distinguish ICMP sequence number field too.
Already supports ICMP code and type fields in current version.
Existing fields in ICMP header contain the required information.
ICMP header already is supported and no code change in RTE FLOW.
Extend testpmd CLI to include the fields of ident and sequence number.
One example:
flow create 0 ingress pattern eth / ipv4 /
 icmp code is 1 ident is 5 seq is 6 /
 end actions count / queue index 0 / end
The ICMP packet with code 1, identifier 5 and
sequence number 6 will be matched.
It will implement action counter and forward to queue 0.

Signed-off-by: Li Zhang <lizh@nvidia.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agonet/af_xdp: enable custom XDP program loading
Ciara Loftus [Fri, 25 Sep 2020 09:20:21 +0000 (09:20 +0000)]
net/af_xdp: enable custom XDP program loading

The new 'xdp_prog=<string>' vdev arg allows the user to specify the path to
a custom XDP program to be set on the device, instead of the default libbpf
one. The program must have an XSK_MAP of name 'xsks_map' which will allow
for the redirection of some packets to userspace and thus the PMD, using
some criteria defined in the program. This can be useful for filtering
purposes, for example if we only want a subset of packets to reach
userspace or to drop or process a subset of packets in the kernel.

Note: a netdev may only load one program.

Signed-off-by: Ciara Loftus <ciara.loftus@intel.com>
Tested-by: Xuekun Hu <xuekun.hu@intel.com>
4 years agonet/mlx5: relax atomic refcnt for multi-packet Rx buffer
Phil Yang [Thu, 3 Sep 2020 02:53:10 +0000 (10:53 +0800)]
net/mlx5: relax atomic refcnt for multi-packet Rx buffer

Use C11 atomics with RELAXED ordering instead of the rte_atomic ops
which enforce unnecessary barriers on aarch64.

Signed-off-by: Phil Yang <phil.yang@arm.com>
Reviewed-by: Honnappa Nagarahalli <honnappa.nagarahalli@arm.com>
Acked-by: Alexander Kozyrev <akozyrev@nvidia.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@nvidia.com>
4 years agonet/qede: fix dereference before null check
Yunjian Wang [Mon, 24 Aug 2020 11:46:53 +0000 (19:46 +0800)]
net/qede: fix dereference before null check

Coverity flags that 'fp->sb_info' variable is used before
it's checked for NULL. This patch fixes this issue.

Coverity issue: 260413
Fixes: 4c4bdadfa9e7 ("net/qede: refactoring multi-queue implementation")
Cc: stable@dpdk.org
Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agonet/octeontx2: move ESP parsing to LE layer
Kiran Kumar K [Thu, 27 Aug 2020 11:40:41 +0000 (17:10 +0530)]
net/octeontx2: move ESP parsing to LE layer

Add support to parse NAT-T-ESP by moving the ESP parsing
to LE.

Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
4 years agoapp/testpmd: align behaviour of multi-port detach
Thomas Monjalon [Mon, 28 Sep 2020 23:14:34 +0000 (01:14 +0200)]
app/testpmd: align behaviour of multi-port detach

A port can be closed in multiple situations:
- close command calling close_port() -> rte_eth_dev_close()
- exit calling close_port() -> rte_eth_dev_close()
- hotplug calling close_port() -> rte_eth_dev_close()
- hotplug calling detach_device() -> rte_dev_remove()
- port detach command, detach_device() -> rte_dev_remove()
- device detach command, detach_devargs() -> rte_eal_hotplug_remove()

The flow rules are flushed before each close.
It was already done in close_port(), detach_devargs() and
detach_port_device() which calls detach_device(),
but not in detach_device(). As a consequence, it was missing for siblings
of port detach command and unplugged device.
The check before calling port_flow_flush() is moved inside the function.

The state of the port to close is checked to be stopped.
As above, this check was missing in detach_device(),
impacting the cases of a multi-port device unplugged or detached
with the port detach command.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agoapp/testpmd: reset port status on close notification
Thomas Monjalon [Mon, 28 Sep 2020 23:14:33 +0000 (01:14 +0200)]
app/testpmd: reset port status on close notification

Since rte_eth_dev_release_port() is called on all port close operations,
the event RTE_ETH_EVENT_DESTROY can be reliably used for resetting
the port status on the application side.

The intermediate state RTE_PORT_HANDLING is removed in close_port()
because a port can also be closed by a PMD in a device remove operation.

In case multiple ports are closed, calling remove_invalid_ports()
only once is enough.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agodrivers/net: remove redundant MAC addresses freeing
Thomas Monjalon [Mon, 28 Sep 2020 23:14:32 +0000 (01:14 +0200)]
drivers/net: remove redundant MAC addresses freeing

The MAC addresses array is already freed by rte_eth_dev_release_port().
The redundant freeing can be removed from the PMD port closing functions.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agodrivers/net: check process type in close operation
Thomas Monjalon [Mon, 28 Sep 2020 23:14:31 +0000 (01:14 +0200)]
drivers/net: check process type in close operation

The secondary processes are not allowed to release shared resources.
Only process-private resources should be freed in a secondary process.
Most of the time, there is no process-private resource,
so the close operation is just forbidden in a secondary process.

After adding proper check in the port close functions,
some redundant checks in the device remove functions are dropped.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: Rosen Xu <rosen.xu@intel.com>
Reviewed-by: Sachin Saxena <sachin.saxena@oss.nxp.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Liron Himi <lironh@marvell.com>
Reviewed-by: Haiyue Wang <haiyue.wang@intel.com>
Acked-by: Jeff Guo <jia.guo@intel.com>
Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agodrivers/net: accept removing device without any port
Thomas Monjalon [Mon, 28 Sep 2020 23:14:30 +0000 (01:14 +0200)]
drivers/net: accept removing device without any port

The ports can be closed (i.e. completely released)
before removing the whole device.
Such case was wrongly considered an error by some drivers.

If the device supports only one port, there is nothing much
to free after the port is closed.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
Reviewed-by: Rosen Xu <rosen.xu@intel.com>
Reviewed-by: Sachin Saxena <sachin.saxena@oss.nxp.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agoethdev: remove old close behaviour
Thomas Monjalon [Mon, 28 Sep 2020 23:14:29 +0000 (01:14 +0200)]
ethdev: remove old close behaviour

The temporary flag RTE_ETH_DEV_CLOSE_REMOVE is removed.
It was introduced in DPDK 18.11 in order to give time for PMDs to migrate.

The old behaviour was to free only queues when closing a port.
The new behaviour is calling rte_eth_dev_release_port() which does
three more tasks:
- trigger event callback
- reset state and few pointers
- free all generic port resources

The private port resources must be released in the .dev_close callback.

The .remove callback should:
- call .dev_close callback
- call rte_eth_dev_release_port()
- free multi-port device shared resources

Despite waiting two years, some drivers have not migrated,
so they may hit issues with the incompatible new behaviour.
After sending emails, adding logs, and announcing the deprecation,
the only last solution is to declare these drivers as unmaintained:
ionic, liquidio, nfp
Below is a summary of what to implement in those drivers.

* The freeing of private port resources must be moved
from the ".remove(device)" function to the ".dev_close(port)" function.

* If a generic resource (.mac_addrs or .hash_mac_addrs) cannot be freed,
it must be set to NULL in ".dev_close" function to protect from
subsequent rte_eth_dev_release_port() freeing.

* Note 1:
The generic resources are freed in rte_eth_dev_release_port(),
after ".dev_close" is called in rte_eth_dev_close(), but not when
calling ".dev_close" directly from the ".remove" PMD function.
That's why rte_eth_dev_release_port() must still be called explicitly
from ".remove(device)" after calling the ".dev_close" PMD function.

* Note 2:
If a device can have multiple ports, the common resources must be freed
only in the ".remove(device)" function.

* Note 3:
The port is supposed to be in a stopped state when it is closed.
If it is not the case, it is free to the PMD implementation
how to react when trying to close a non-stopped port:
either try to stop it automatically or just return an error.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: Liron Himi <lironh@marvell.com>
Reviewed-by: Haiyue Wang <haiyue.wang@intel.com>
Acked-by: Jeff Guo <jia.guo@intel.com>
Acked-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agonet/tap: release port upon close
Yunjian Wang [Mon, 28 Sep 2020 23:14:28 +0000 (01:14 +0200)]
net/tap: release port upon close

The flag RTE_ETH_DEV_CLOSE_REMOVE is set so all port resources
can be freed by rte_eth_dev_close().

Freeing of private port resources is moved
from the ".remove(device)" to the ".dev_close(port)" operation.

Signed-off-by: Yunjian Wang <wangyunjian@huawei.com>
Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agonet/softnic: release port upon close
Thomas Monjalon [Mon, 28 Sep 2020 23:14:27 +0000 (01:14 +0200)]
net/softnic: release port upon close

The flag RTE_ETH_DEV_CLOSE_REMOVE is set so all port resources
can be freed by rte_eth_dev_close().

Freeing of private port resources is moved
from the ".remove(device)" to the ".dev_close(port)" operation.

Nothing is closed in a secondary process.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agonet/ring: release port upon close
Thomas Monjalon [Mon, 28 Sep 2020 23:14:26 +0000 (01:14 +0200)]
net/ring: release port upon close

The flag RTE_ETH_DEV_CLOSE_REMOVE is set so all port resources
can be freed by rte_eth_dev_close().

Freeing of private port resources is moved
from the ".remove(device)" to the ".dev_close(port)" operation.

Nothing is closed in a secondary process.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agonet/qede: release port upon close
Rasesh Mody [Mon, 28 Sep 2020 23:14:25 +0000 (01:14 +0200)]
net/qede: release port upon close

Set RTE_ETH_DEV_CLOSE_REMOVE upon probe so all the private resources
for the port can be freed by rte_eth_dev_close(). With this change the
private port resources are released in the .dev_close callback.

Signed-off-by: Rasesh Mody <rmody@marvell.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agonet/pfe: release port upon close
Sachin Saxena [Mon, 28 Sep 2020 23:14:24 +0000 (01:14 +0200)]
net/pfe: release port upon close

With removal of old close behavior, the private
port resources must be released in the .dev_close callback.
Freeing of port private resources is moved from
the ".remove(device)" to the ".dev_close(port)" operation

Signed-off-by: Sachin Saxena <sachin.saxena@oss.nxp.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agonet/pcap: release port upon close
Thomas Monjalon [Mon, 28 Sep 2020 23:14:23 +0000 (01:14 +0200)]
net/pcap: release port upon close

The flag RTE_ETH_DEV_CLOSE_REMOVE is set so all port resources
can be freed by rte_eth_dev_close().

Freeing of private port resources is moved
from the ".remove(device)" to the ".dev_close(port)" operation.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agonet/octeontx: release port upon close
Thomas Monjalon [Mon, 28 Sep 2020 23:14:22 +0000 (01:14 +0200)]
net/octeontx: release port upon close

The flag RTE_ETH_DEV_CLOSE_REMOVE is set so all port resources
can be freed by rte_eth_dev_close().

The callback ".dev_close(port)" is called also
from the ".remove(device)" operation.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agonet/null: release port upon close
Thomas Monjalon [Mon, 28 Sep 2020 23:14:21 +0000 (01:14 +0200)]
net/null: release port upon close

The flag RTE_ETH_DEV_CLOSE_REMOVE is set so all port resources
can be freed by rte_eth_dev_close().

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agonet/mlx4: release port upon close
Thomas Monjalon [Mon, 28 Sep 2020 23:14:20 +0000 (01:14 +0200)]
net/mlx4: release port upon close

The flag RTE_ETH_DEV_CLOSE_REMOVE is set so all port resources
can be freed by rte_eth_dev_close().

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agonet/failsafe: release port upon close
Thomas Monjalon [Mon, 28 Sep 2020 23:14:19 +0000 (01:14 +0200)]
net/failsafe: release port upon close

The flag RTE_ETH_DEV_CLOSE_REMOVE is set so all port resources
can be freed by rte_eth_dev_close().

Freeing of private port resources is moved
from the ".remove(device)" to the ".dev_close(port)" operation.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agonet/enetc: release port upon close
Sachin Saxena [Mon, 28 Sep 2020 23:14:18 +0000 (01:14 +0200)]
net/enetc: release port upon close

With removal of old close behavior, the private
port resources must be released in the .dev_close callback.
Freeing of port private resources is moved from
the ".remove(device)" to the ".dev_close(port)" operation

Signed-off-by: Sachin Saxena <sachin.saxena@oss.nxp.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agonet/dpaa2: release port upon close
Sachin Saxena [Mon, 28 Sep 2020 23:14:17 +0000 (01:14 +0200)]
net/dpaa2: release port upon close

With removal of old close behavior, the private
port resources must be released in the .dev_close callback.
Freeing of port private resources is moved from
the ".remove(device)" to the ".dev_close(port)" operation

Signed-off-by: Sachin Saxena <sachin.saxena@oss.nxp.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agonet/dpaa: release port upon close
Sachin Saxena [Mon, 28 Sep 2020 23:14:16 +0000 (01:14 +0200)]
net/dpaa: release port upon close

With removal of old close behavior, the private
port resources must be released in the .dev_close callback.
Freeing of port private resources is moved from
the ".remove(device)" to the ".dev_close(port)" operation

Signed-off-by: Sachin Saxena <sachin.saxena@oss.nxp.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agonet/bonding: release port upon close
Thomas Monjalon [Mon, 28 Sep 2020 23:14:15 +0000 (01:14 +0200)]
net/bonding: release port upon close

The flag RTE_ETH_DEV_CLOSE_REMOVE is set so all port resources
can be freed by rte_eth_dev_close().

Freeing of private port resources is moved
from the ".remove(device)" to the ".dev_close(port)" operation.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agonet/bnx2x: release port upon close
Rasesh Mody [Mon, 28 Sep 2020 23:14:14 +0000 (01:14 +0200)]
net/bnx2x: release port upon close

Set RTE_ETH_DEV_CLOSE_REMOVE upon probe so all the private resources
for the port can be freed by rte_eth_dev_close(). With this change the
private port resources are released in the .dev_close callback.

Signed-off-by: Rasesh Mody <rmody@marvell.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agonet/axgbe: release port upon close
Thomas Monjalon [Mon, 28 Sep 2020 23:14:13 +0000 (01:14 +0200)]
net/axgbe: release port upon close

The flag RTE_ETH_DEV_CLOSE_REMOVE is set so all port resources
can be freed by rte_eth_dev_close().

Freeing of private port resources is moved
from the ".remove(device)" to the ".dev_close(port)" operation.
The ".dev_close" callback is also called as part of the ".remove" one.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agonet/atlantic: release port upon close
Thomas Monjalon [Mon, 28 Sep 2020 23:14:12 +0000 (01:14 +0200)]
net/atlantic: release port upon close

The flag RTE_ETH_DEV_CLOSE_REMOVE is set so all port resources
can be freed by rte_eth_dev_close().

Freeing of private port resources is moved
from the ".remove(device)" to the ".dev_close(port)" operation.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Igor Russkikh <irusskikh@marvell.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agonet/af_packet: release port upon close
Thomas Monjalon [Mon, 28 Sep 2020 23:14:11 +0000 (01:14 +0200)]
net/af_packet: release port upon close

The flag RTE_ETH_DEV_CLOSE_REMOVE is set so all port resources
can be freed by rte_eth_dev_close().

Freeing of private port resources is moved
from the ".remove(device)" to the ".dev_close(port)" operation.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agoethdev: allow drivers to return error on close
Thomas Monjalon [Mon, 28 Sep 2020 23:14:10 +0000 (01:14 +0200)]
ethdev: allow drivers to return error on close

The device operation .dev_close was returning void.
This driver interface is changed to return an int.

Note that the API rte_eth_dev_close() is still returning void,
although a deprecation notice is pending to change it as well.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: Rosen Xu <rosen.xu@intel.com>
Reviewed-by: Sachin Saxena <sachin.saxena@oss.nxp.com>
Reviewed-by: Liron Himi <lironh@marvell.com>
Reviewed-by: Haiyue Wang <haiyue.wang@intel.com>
Acked-by: Jeff Guo <jia.guo@intel.com>
Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agoethdev: reset device and interrupt pointers on release
Thomas Monjalon [Mon, 28 Sep 2020 23:14:09 +0000 (01:14 +0200)]
ethdev: reset device and interrupt pointers on release

The pointers .device and .intr_handle were already reset by the helper
rte_eth_dev_pci_generic_remove().
It is now made part of rte_eth_dev_release_port().

It makes rte_eth_dev_pci_release() meaningless,
so it is replaced with a call to rte_eth_dev_release_port().

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
Reviewed-by: Andrew Rybchenko <arybchenko@solarflare.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
4 years agoapp/testpmd: fix displaying Rx/Tx queues information
Huisong Li [Fri, 25 Sep 2020 12:47:19 +0000 (20:47 +0800)]
app/testpmd: fix displaying Rx/Tx queues information

Currently, the information of Rx/Tx queues from PMD driver is not
displayed exactly in the rxtx_config_display function. Because
"ports[pid].rx_conf" and "ports[pid].tx_conf" maintained in testpmd
application may be not the value actually used by PMD driver. For
instance, user does not set a field, but PMD driver has to use the
default value.

This patch fixes rxtx_config_display so that the information of Rx/Tx
queues can be really displayed for the PMD driver that implement
.rxq_info_get and .txq_info_get ops callback function.

Fixes: 75c530c1bd53 ("app/testpmd: fix port configuration print")
Fixes: d44f8a485f5d ("app/testpmd: enable per queue configure")
Cc: stable@dpdk.org
Signed-off-by: Huisong Li <lihuisong@huawei.com>
Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agoapp/testpmd: fix descriptor id check
Chengchang Tang [Fri, 25 Sep 2020 12:47:18 +0000 (20:47 +0800)]
app/testpmd: fix descriptor id check

The number of desc is a per queue configuration. But in the check
function, nb_txd & nb_rxd are used to check whether the desc_id is
valid. nb_txd & nb_rxd are the global configuration of number of desc.
If the queue configuration is changed by cmdline liks: "port config xx
txq xx ring_size xxx", the real value will be changed.

This patch use the real value to check whether the desc_id is valid.
And if these are not configured by user. It will use the default value
to check it, since the rte_eth_rx_queue_setup & rte_eth_tx_queue_setup
will use a default value to configure the queue if nb_rx_desc or
nb_tx_desc is zero.

Fixes: af75078fece3 ("first public release")
Cc: stable@dpdk.org
Signed-off-by: Chengchang Tang <tangchengchang@huawei.com>
Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agoapp/testpmd: fix packet header in txonly mode
Chengchang Tang [Fri, 25 Sep 2020 12:47:17 +0000 (20:47 +0800)]
app/testpmd: fix packet header in txonly mode

In txonly forward mode, the packet header is fixed by the initial
setting, including the packet length and checksum. So when the packets
varies, this may cause a packet header error. Currently, there are two
methods in txonly mode to randomly change the packets.
1. Set txsplit random and txpkts (x[,y]*), the number of segments
   each packets will be a random value between 1 and total number of
   segments determined by txpkts settings.
   The step as follows:
     a) ./testpmd -w xxx -l xx -n 4 -- -i --disable-device-start
     b) port config 0 tx_offload multi_segs on
     c) set fwd txonly
     d) set txsplit rand
     e) set txpkts 2048,2048,2048,2048
     f) start
The nb_segs of the packets sent by testpmd will be 1~4. The real packet
length will be 2048, 4096, 6144 and 8192. But in fact the packet length
in ip header and udp header will be fixed by 8178 and 8158.

2. Set txonly-multi-flow. the ip address will be varied to generate
   multiple flow.
   The step as follows:
     a) ./testpmd -w xxx -l xx -n 4 -- -i --txonly-multi-flow
     b) set fwd txonly
     c) start
The ip address of each pkts will change randomly, but since the header
is fixed, the checksum may be a error value.

Therefore, this patch adds a function to update the packet length and
check sum in the pkts header when the txsplit mode is set to rand or
multi-flow is set.

Fixes: 82010ef55e7c ("app/testpmd: make txonly mode generate multiple flows")
Fixes: 79bec05b32b7 ("app/testpmd: add ability to split outgoing packets")
Cc: stable@dpdk.org
Signed-off-by: Chengchang Tang <tangchengchang@huawei.com>
Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agoapp/testpmd: remove restriction on Tx segments set
Chengchang Tang [Fri, 25 Sep 2020 12:47:16 +0000 (20:47 +0800)]
app/testpmd: remove restriction on Tx segments set

Currently, if nb_txd is not set, the txpkts is not allowed to be set
because the nb_txd is used to avoid the number of segments exceed the Tx
ring size and the default value of nb_txd is 0. And there is a bug that
nb_txd is the global configuration for Tx ring size and the ring size
could be changed by some command per queue. So these valid check is
unreliable and introduced unnecessary constraints.

This patch adds a valid check function to use the real Tx ring size to
check the validity of txpkts.

Fixes: af75078fece3 ("first public release")
Cc: stable@dpdk.org
Signed-off-by: Chengchang Tang <tangchengchang@huawei.com>
Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agoapp/testpmd: fix VLAN configuration on failure
Chengchang Tang [Fri, 25 Sep 2020 12:47:15 +0000 (20:47 +0800)]
app/testpmd: fix VLAN configuration on failure

When failing to configure VLAN offloads after the port was started, there
is no need to update the port configuration. Currently, when user
configure an unsupported VLAN offloads and fails, and then restart the
port, it will fails since the configuration has been refreshed.

This patch makes the function return directly instead of refreshing the
configuration when execution fails.

Fixes: 384161e00627 ("app/testpmd: adjust on the fly VLAN configuration")
Cc: stable@dpdk.org
Signed-off-by: Chengchang Tang <tangchengchang@huawei.com>
Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agoapp/testpmd: fix port id check in Tx VLAN command
Chengchang Tang [Fri, 25 Sep 2020 12:47:14 +0000 (20:47 +0800)]
app/testpmd: fix port id check in Tx VLAN command

To set Tx vlan offloads, it is required to stop port firstly. But before
checking whether the port is stopped, the port id entered by the user
is not checked for validity. When the port id is illegal, it would lead
to a segmentation fault since it attempts to access a member of
non-existent port.

This patch adds verification of port id in tx vlan offloads and remove
duplicated check.

Fixes: 597f9fafe13b ("app/testpmd: convert to new Tx offloads API")
Cc: stable@dpdk.org
Signed-off-by: Chengchang Tang <tangchengchang@huawei.com>
Signed-off-by: Wei Hu (Xavier) <xavier.huwei@huawei.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
4 years agocommon/sfc_efx/base: handle descriptor proxy queue events
Andy Moreton [Thu, 24 Sep 2020 12:12:35 +0000 (13:12 +0100)]
common/sfc_efx/base: handle descriptor proxy queue events

The TXQ_DESC and VIRTQ_DESC events are used to pass host descriptors
over an extended width event queue to an application processor for
handling. See SF-122927-TC and SF-122966-SW for details.

Signed-off-by: Andy Moreton <amoreton@xilinx.com>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
4 years agocommon/sfc_efx/base: add option for descriptor proxy queues
Andy Moreton [Thu, 24 Sep 2020 12:12:34 +0000 (13:12 +0100)]
common/sfc_efx/base: add option for descriptor proxy queues

EF100 uses descriptor proxy queues to support virtio-blk proxy.

Signed-off-by: Andy Moreton <amoreton@xilinx.com>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
4 years agocommon/sfc_efx/base: handle normal events in extended width
Andy Moreton [Thu, 24 Sep 2020 12:12:33 +0000 (13:12 +0100)]
common/sfc_efx/base: handle normal events in extended width

Process the encasulated events as for the normal event loop. The phase
bit in the encapsulated event should be ignored, as the polling loop
uses the phase bit from the extended-width event.

Signed-off-by: Andy Moreton <amoreton@xilinx.com>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
4 years agocommon/sfc_efx/base: poll extended width event queues
Andy Moreton [Thu, 24 Sep 2020 12:12:32 +0000 (13:12 +0100)]
common/sfc_efx/base: poll extended width event queues

Extended width queues use a different layout and so require
a different polling loop.

Signed-off-by: Andy Moreton <amoreton@xilinx.com>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
4 years agocommon/sfc_efx/base: support creation of extended width EvQ
Andy Moreton [Thu, 24 Sep 2020 12:12:31 +0000 (13:12 +0100)]
common/sfc_efx/base: support creation of extended width EvQ

Add a flag to request an extended width event queue, and
check that the supplied buffer is large enough to hold the
event queue descriptors.

Signed-off-by: Andy Moreton <amoreton@xilinx.com>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
4 years agocommon/sfc_efx/base: add 256-bit type
Andy Moreton [Thu, 24 Sep 2020 12:12:30 +0000 (13:12 +0100)]
common/sfc_efx/base: add 256-bit type

EF100 requires support for extended-width event descriptors
for use with descriptor proxy queues. Extend libefx types
used for hardware access (and endian conversion) to support
a 256bit data type.

Signed-off-by: Andy Moreton <amoreton@xilinx.com>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
4 years agocommon/sfc_efx/base: add option for extended width events
Andy Moreton [Thu, 24 Sep 2020 12:12:29 +0000 (13:12 +0100)]
common/sfc_efx/base: add option for extended width events

EF100 uses event queues with 256bit extended width events to
support descriptor proxy queues.

Signed-off-by: Andy Moreton <amoreton@xilinx.com>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
4 years agocommon/sfc_efx/base: allocate vAdaptor on Riverhead
Andrew Rybchenko [Thu, 24 Sep 2020 12:12:28 +0000 (13:12 +0100)]
common/sfc_efx/base: allocate vAdaptor on Riverhead

Riverhead has EVB support similar to EF10 and NIC must allocate
its vAdaptor on init.

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
4 years agocommon/sfc_efx/base: use EF10 EVB methods for Riverhead
Andrew Rybchenko [Thu, 24 Sep 2020 12:12:27 +0000 (13:12 +0100)]
common/sfc_efx/base: use EF10 EVB methods for Riverhead

There is no difference yet in EVB support on EF10 and Riverhead.
So, it is better to reuse existing methods.

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
4 years agocommon/sfc_efx/base: replace PCI efsys macros with functions
Igor Romanov [Thu, 24 Sep 2020 12:12:26 +0000 (13:12 +0100)]
common/sfc_efx/base: replace PCI efsys macros with functions

efsys macros that manipulate PCI devices cannot be defined in
common sfc_efx DPDK driver since in DPDK build the bus drivers
that provide required functionality are built after common drivers.

Replace the macros with function callbacks to remove that build
dependency. Drivers now should pass the callbacks directly to
efx function instead of defining implementation in efsys.

Signed-off-by: Igor Romanov <igor.romanov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
4 years agocommon/sfc_efx/base: support UDP tunnel operations for EF100
Igor Romanov [Thu, 24 Sep 2020 12:12:25 +0000 (13:12 +0100)]
common/sfc_efx/base: support UDP tunnel operations for EF100

EF100 uses VNIC encapsulation rule MCDI for configuring UDP
tunnels in HW individually. Use busy added and removed states
of UDP tunnel table entries for the implementation.

Signed-off-by: Igor Romanov <igor.romanov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
4 years agocommon/sfc_efx/base: introduce states for UDP tunnel entries
Igor Romanov [Thu, 24 Sep 2020 12:12:24 +0000 (13:12 +0100)]
common/sfc_efx/base: introduce states for UDP tunnel entries

UDP tunnel reconfigure operation takes UDP tunnel table, which contains
entries that need to be applied to HW. This approach does not retain
information about what entries were removed or added, which is required
for Riverhead.

Add states to the table entries to indicate add or remove operations.
On tunnel reconfiguration added and removed entries become busy to
indicate that the entries are currently configured and to prevent add or
remove operations from other threads. After tunnel reconfiguration is
complete, the states are reset - added entries become applied and
removed entries are purged from the table.

Signed-off-by: Igor Romanov <igor.romanov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
4 years agocommon/sfc_efx/base: introduce UDP tunnel destruct operation
Igor Romanov [Thu, 24 Sep 2020 12:12:23 +0000 (13:12 +0100)]
common/sfc_efx/base: introduce UDP tunnel destruct operation

The procedures for destroying UDP tunnels are NIC family specific,
so they should be implemented separately for each of them.

Check for supported UDP encapsulation is removed from generic
operations since it is no longer used by the generic libefx API.

Signed-off-by: Igor Romanov <igor.romanov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
4 years agocommon/sfc_efx/base: add NIC magic check on BAR lookup
Igor Romanov [Thu, 24 Sep 2020 12:12:22 +0000 (13:12 +0100)]
common/sfc_efx/base: add NIC magic check on BAR lookup

Check that BAR lookup was successful by looking at the content
of signature register.

Signed-off-by: Igor Romanov <igor.romanov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
4 years agocommon/sfc_efx/base: add Xilinx capabilities table lookup
Igor Romanov [Thu, 24 Sep 2020 12:12:21 +0000 (13:12 +0100)]
common/sfc_efx/base: add Xilinx capabilities table lookup

APIs for searching a capability in a Xilinx capabilities table and
reading table entries are needed for function control window lookup
to get the bar index and offset of the window.

Signed-off-by: Igor Romanov <igor.romanov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
4 years agocommon/sfc_efx/base: add efsys API to find a memory BAR
Igor Romanov [Thu, 24 Sep 2020 12:12:20 +0000 (13:12 +0100)]
common/sfc_efx/base: add efsys API to find a memory BAR

Function control window lookup needs memory BARs handles to
search Xilinx capabilities tables.

Define an API to get a memory BAR handle by a PCIe device handle and
BAR index.

Signed-off-by: Igor Romanov <igor.romanov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
4 years agocommon/sfc_efx/base: add function control window lookup API
Igor Romanov [Thu, 24 Sep 2020 12:12:19 +0000 (13:12 +0100)]
common/sfc_efx/base: add function control window lookup API

Riverhead NIC may provide a locator of function control window
(EF100 resource locator).
The locator may be present in a Xilinx capabilities table which
itself is located by looking into extended PCI capabilities.

PCI capabilities are made possible to access by adding PCI config
space interface to efsys.

APIs are implemented to facilitate function control window lookup:
 - API to find an extended PCI capability given a capability ID;
 - API to read Xilinx PCI capability;

Signed-off-by: Igor Romanov <igor.romanov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
4 years agocommon/sfc_efx/base: add function control window concept
Igor Romanov [Thu, 24 Sep 2020 12:12:18 +0000 (13:12 +0100)]
common/sfc_efx/base: add function control window concept

Function control window can be located at a different offset than
other windows on Riverhead. Meaning that the drivers must handle
accesses to the function control window differently in case of EF100.

Add accessor macros for function control window and change
EFX NIC create API to facilitate that accessors.

Signed-off-by: Igor Romanov <igor.romanov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
4 years agocommon/sfc_efx/base: choose smallest Rx prefix on Riverhead
Andrew Rybchenko [Thu, 24 Sep 2020 12:12:17 +0000 (13:12 +0100)]
common/sfc_efx/base: choose smallest Rx prefix on Riverhead

Riverhead supports many Rx prefixes. The Rx prefix may be chosen
based on which information is required.

To have better performance choose the smallest Rx prefix which
meets our requirements.

Right now there is no way to specify requirements on Rx queue
creation, but it could be added in the future.

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
4 years agocommon/sfc_efx/base: group RxQ parameters into a structure
Andrew Rybchenko [Thu, 24 Sep 2020 12:12:16 +0000 (13:12 +0100)]
common/sfc_efx/base: group RxQ parameters into a structure

Make number of efx_mcdi_init_rxq() arguments reasonable before
addition of one more argument.
Non essential parameters not supported in some cases are moved
into helper structure.

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
4 years agocommon/sfc_efx/base: add API to get Rx prefix information
Andrew Rybchenko [Thu, 24 Sep 2020 12:12:15 +0000 (13:12 +0100)]
common/sfc_efx/base: add API to get Rx prefix information

Define default Siena, EF10 default, packed stream, equal-stride
superbuffer and Riverhead default prefixes in order to make an API
to get Rx prefix layout information generic and usable on all NICs.

Riverhead supports many Rx prefixes. Riverhead FW supports MCDI to
choose Rx prefix based on required Rx prefix fields and allows to
query the prefix layout using MCDI. The patch prepares to introduce
the support in libefx and provides fallback for NICs and FW which
lacks the support.

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
4 years agocommon/sfc_efx: do not include libefx headers from efsys.h
Andrew Rybchenko [Thu, 24 Sep 2020 12:12:14 +0000 (13:12 +0100)]
common/sfc_efx: do not include libefx headers from efsys.h

efsys.h may depends on target system headers only. Otherwise, it could
result in cross-dependency when libefx header depends on efsys.h and
efsys.h depends on the libefx header.

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andrew Lee <andrewle@xilinx.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
4 years agocommon/sfc_efx/base: report restrictions for TSO version 3
Ivan Malov [Thu, 24 Sep 2020 12:12:13 +0000 (13:12 +0100)]
common/sfc_efx/base: report restrictions for TSO version 3

Riverhead puts a number of restrictions on TSO transactions.
Reflect some of them in the NIC configuration structure.

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andrew Lee <andrewle@xilinx.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
4 years agocommon/sfc_efx/base: indicate support for TSO version 3
Ivan Malov [Thu, 24 Sep 2020 12:12:12 +0000 (13:12 +0100)]
common/sfc_efx/base: indicate support for TSO version 3

Riverhead boards support TSO version 3.

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andrew Lee <andrewle@xilinx.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
4 years agocommon/sfc_efx/base: handle Tx complete on Riverhead
Andrew Rybchenko [Thu, 24 Sep 2020 12:12:11 +0000 (13:12 +0100)]
common/sfc_efx/base: handle Tx complete on Riverhead

Introduce a new event callback which has the same prototype, but
provides number of completed descriptors instead of the last
completed descriptor index.

When all libefx-based drivers implement the new callback, libefx
may be updated to use it for Siena and EF10 family NICs and
the old one may be removed.

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
4 years agocommon/sfc_efx/base: handle Rx events for Riverhead
Andrew Rybchenko [Thu, 24 Sep 2020 12:12:10 +0000 (13:12 +0100)]
common/sfc_efx/base: handle Rx events for Riverhead

Rx event on Riverhead provides a number of received packets and
no classification/offloads information is available Rx event.

Introduce a new event callback to be implemented by drivers.
The callback provides information about the number of completed
packets. libefx-based drivers should implement the new callback
for Riverhead and keep the old one for Siena and EF10 NICs.
The new callback may be used for Medford2 NO_CONT_EV Rx mode
support.

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
4 years agocommon/sfc_efx/base: fix Tx descriptor DMA sync on Riverhead
Andrew Rybchenko [Thu, 24 Sep 2020 12:12:09 +0000 (13:12 +0100)]
common/sfc_efx/base: fix Tx descriptor DMA sync on Riverhead

Rx/Tx queue DMA sync should not assume descriptor size to be the same
for all NIC familties since it Tx descritor size is 16 on Riverhead.

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
4 years agocommon/sfc_efx/base: implement Tx control path for Riverhead
Andrew Rybchenko [Thu, 24 Sep 2020 12:12:08 +0000 (13:12 +0100)]
common/sfc_efx/base: implement Tx control path for Riverhead

Tx control path on Riverhead is very similar to EF10, but datapath
differs a lot since Tx descriptor size is 16 bytes (vs 8 bytes on EF10).

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
4 years agocommon/sfc_efx/base: implement Rx control path for Riverhead
Andrew Rybchenko [Thu, 24 Sep 2020 12:12:07 +0000 (13:12 +0100)]
common/sfc_efx/base: implement Rx control path for Riverhead

Reuse EF10 RSS-related functions since current version of the RSS
interface is compatible with EF10.

Implement own functions to create and destroy Rx queues which reuse
MCDI wrappers which are shared with EF10.

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
4 years agocommon/sfc_efx/base: move Rx index check to generic code
Andrew Rybchenko [Thu, 24 Sep 2020 12:12:06 +0000 (13:12 +0100)]
common/sfc_efx/base: move Rx index check to generic code

Make NIC family specific functions a bit shorter and reduce
code duplication.

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
4 years agocommon/sfc_efx/base: free Rx queue structure in generic code
Andrew Rybchenko [Thu, 24 Sep 2020 12:12:05 +0000 (13:12 +0100)]
common/sfc_efx/base: free Rx queue structure in generic code

Rx queue structure is allocated in generic code, but was freed in NIC
family specific callbacks. Move free to generic function makes NIC
family specific callbacks shorter and reduces code duplication.

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
4 years agocommon/sfc_efx/base: maintain RxQ counter in generic code
Andrew Rybchenko [Thu, 24 Sep 2020 12:12:04 +0000 (13:12 +0100)]
common/sfc_efx/base: maintain RxQ counter in generic code

The counter is incremented in generic efx_rx_qcreate(), but was
asserted and decremented in NIC family specific queue create and
destroy callbacks.  Move assert and decrement to generic functions
as well to make NIC family specific callbacks shorter.

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
4 years agocommon/sfc_efx/base: switch TxQ init to extended version
Andrew Rybchenko [Thu, 24 Sep 2020 12:12:03 +0000 (13:12 +0100)]
common/sfc_efx/base: switch TxQ init to extended version

Extended version of MCDI allows up to 64 DMA addresses which are
required for Riverhead.

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
4 years agocommon/sfc_efx/base: move TxQ init/fini wrappers to generic
Andrew Rybchenko [Thu, 24 Sep 2020 12:12:02 +0000 (13:12 +0100)]
common/sfc_efx/base: move TxQ init/fini wrappers to generic

TxQ init/fini MCDI is similar on Riverhead and these
functions should be reused to implement TxQ creation and
destruction on Riverhead.

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
Reviewed-by: Vijay Kumar Srivastava <vsrivast@xilinx.com>
4 years agocommon/sfc_efx/base: move RxQ init/fini wrappers to generic
Andrew Rybchenko [Thu, 24 Sep 2020 12:12:01 +0000 (13:12 +0100)]
common/sfc_efx/base: move RxQ init/fini wrappers to generic

RxQ init/fini MCDI is similar on Riverhead and these
functions should be reused to implement RxQ creation and
destruction on Riverhead.

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>