dpdk.git
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 years agocommon/sfc_efx/base: handle MCDI events on Riverhead
Andrew Rybchenko [Thu, 24 Sep 2020 12:12:00 +0000 (13:12 +0100)]
common/sfc_efx/base: handle MCDI events on Riverhead

EF100 MCDI event layout is same as on EF10 except added QDMA phase
bit which is unused on EF10.

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
3 years agocommon/sfc_efx/base: complete EvQ creation on Riverhead
Ivan Malov [Thu, 24 Sep 2020 12:11:59 +0000 (13:11 +0100)]
common/sfc_efx/base: complete EvQ creation on Riverhead

Client drivers relying on interrupts will fail to complete event
queue creation on Riverhead boards as the latter have no support
for INIT_DONE events which means that it's useless to wait until
initialisation callback is triggered by interrupt-driven polling.

Client drivers which avoid interrupt-driven polling still handle
INIT_DONE events by direct polling and will fail to do so.

Solve this problem by adding an extra poll-once method which
will be called by client drivers after queue creation (probably,
with driver-specific lock being held). The method will invoke
initialisation callback on Riverhead and do nothing on the other
boards. Then the drivers will proceed with normal waiting which
will complete immediately in the case of Riverhead.

Signed-off-by: Ivan Malov <ivan.malov@oktetlabs.ru>
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
3 years agocommon/sfc_efx/base: add event queue module for Riverhead
Andrew Rybchenko [Thu, 24 Sep 2020 12:11:58 +0000 (13:11 +0100)]
common/sfc_efx/base: add event queue module for Riverhead

Events are significantly reworked on Riverhead, so it is better
to implement own set of callbacks to simplify future development
and avoid inheritance of legacy code.

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
3 years agocommon/sfc_efx/base: merge versions of init EvQ wrappers
Andrew Rybchenko [Thu, 24 Sep 2020 12:11:57 +0000 (13:11 +0100)]
common/sfc_efx/base: merge versions of init EvQ wrappers

The decision on which version of the INIT_EVQ command to use may
be done inside the function itself. Caller should just provide
enough information sufficient in both cases. It avoids code
duplication and simplifies maintenance.

If v2 is not supported, keep decision about low-latency hint outside
the MCDI helper function since it will differ on Riverhead (there is
no EVB yet, but still want merging for better throughput).

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
3 years agocommon/sfc_efx/base: prepare to merge EvQ init functions
Andrew Rybchenko [Thu, 24 Sep 2020 12:11:56 +0000 (13:11 +0100)]
common/sfc_efx/base: prepare to merge EvQ init functions

v1 and v2 defines are the same except output length.

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
3 years agocommon/sfc_efx/base: move EvQ create generic checks
Andrew Rybchenko [Thu, 24 Sep 2020 12:11:55 +0000 (13:11 +0100)]
common/sfc_efx/base: move EvQ create generic checks

There is no point to duplicate these generic checks in NIC family
specific handlers.

As the side effect it fixes bug with incorrect interrupt moderation
settings silently ignored on event queue create on Siena.

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

EvQ init/fini MCDI is similar on Riverhead and these
functions should be reused to implement EvQ 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>
3 years agocommon/sfc_efx/base: add interrupts module for Riverhead
Andrew Rybchenko [Thu, 24 Sep 2020 12:11:53 +0000 (13:11 +0100)]
common/sfc_efx/base: add interrupts module for Riverhead

Riverhead supports interrupt aggregation rings. Right now there
are no plans to support it in libefx, but it is better to have
own set of callbacks to easier handle EF10 and Riverhead
differences in the future.

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

There is no difference yet in MAC 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>
Reviewed-by: Vijay Kumar Srivastava <vsrivast@xilinx.com>
3 years agocommon/sfc_efx/base: use EF10 filter methods for Riverhead
Andrew Rybchenko [Thu, 24 Sep 2020 12:11:51 +0000 (13:11 +0100)]
common/sfc_efx/base: use EF10 filter methods for Riverhead

Filtering MCDI on Riverhead are the same as on EF10.

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
Reviewed-by: Vijay Kumar Srivastava <vsrivast@xilinx.com>
3 years agocommon/sfc_efx/base: use dummy tunnel ops for Riverhead
Andrew Rybchenko [Thu, 24 Sep 2020 12:11:50 +0000 (13:11 +0100)]
common/sfc_efx/base: use dummy tunnel ops for Riverhead

Riverhead does not support tunnels yet.

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
3 years agocommon/sfc_efx/base: add Riverhead support to NIC module
Andrew Rybchenko [Thu, 24 Sep 2020 12:11:49 +0000 (13:11 +0100)]
common/sfc_efx/base: add Riverhead support to NIC module

Define basic NIC features and limitations.

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
Reviewed-by: Vijay Kumar Srivastava <vsrivast@xilinx.com>
3 years agocommon/sfc_efx/base: factor out MCDI entity reset helper
Andrew Rybchenko [Thu, 24 Sep 2020 12:11:48 +0000 (13:11 +0100)]
common/sfc_efx/base: factor out MCDI entity reset helper

The helper will be reused on Riverhead.

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
3 years agocommon/sfc_efx/base: set NIC features in generic place
Andrew Rybchenko [Thu, 24 Sep 2020 12:11:47 +0000 (13:11 +0100)]
common/sfc_efx/base: set NIC features in generic place

There is no point to duplicate it NIC family specific probe handlers.

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
3 years agocommon/sfc_efx/base: factor out helper to get board config
Andrew Rybchenko [Thu, 24 Sep 2020 12:11:46 +0000 (13:11 +0100)]
common/sfc_efx/base: factor out helper to get board config

The helper will be used on Riverhead.

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
3 years agocommon/sfc_efx/base: remove PF count get from caps get
Andrew Rybchenko [Thu, 24 Sep 2020 12:11:45 +0000 (13:11 +0100)]
common/sfc_efx/base: remove PF count get from caps get

ef10_get_datapath_caps() should simply fill in NIC configuration
based MC_CMD_GET_CAPABILITIES output.

Number of PFs is a part of board configuration should be obtained
in corresponding function.

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
3 years agocommon/sfc_efx/base: move 14b prefix check out of caps get
Andrew Rybchenko [Thu, 24 Sep 2020 12:11:44 +0000 (13:11 +0100)]
common/sfc_efx/base: move 14b prefix check out of caps get

The function which gets capabilities from MC should simply fill in
NIC configuration. Caller should decide if the configuration is
supported or not.

The change is required to prepare the function to be reused on
Riverhead.

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

There is no difference yet in PHY 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>
Reviewed-by: Vijay Kumar Srivastava <vsrivast@xilinx.com>
3 years agocommon/sfc_efx/base: use EF10 MCDI methods for Riverhead
Andrew Rybchenko [Thu, 24 Sep 2020 12:11:42 +0000 (13:11 +0100)]
common/sfc_efx/base: use EF10 MCDI methods for Riverhead

MCDI on Riverhead is very close to the EF10 and there is no
point to duplicate the code.

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
3 years agocommon/sfc_efx/base: update registers check for Riverhead
Andrew Rybchenko [Thu, 24 Sep 2020 12:11:41 +0000 (13:11 +0100)]
common/sfc_efx/base: update registers check for Riverhead

Riverhead family got letter 'G' for registers definition.
Registers used for Riverhead should have the letter in the
specification range.

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
Reviewed-by: Vijay Kumar Srivastava <vsrivast@xilinx.com>
3 years agocommon/sfc_efx/base: add Riverhead NIC family
Andrew Rybchenko [Thu, 24 Sep 2020 12:11:40 +0000 (13:11 +0100)]
common/sfc_efx/base: add Riverhead NIC family

Riverhead is the first NIC family of the EF100 architecture.

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
Reviewed-by: Vijay Kumar Srivastava <vsrivast@xilinx.com>
3 years agocommon/sfc_efx/base: add efsys option for Riverhead
Andrew Rybchenko [Thu, 24 Sep 2020 12:11:39 +0000 (13:11 +0100)]
common/sfc_efx/base: add efsys option for Riverhead

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
Reviewed-by: Vijay Kumar Srivastava <vsrivast@xilinx.com>
3 years agocommon/sfc_efx/base: add event queue operation to do polling
Andrew Rybchenko [Thu, 24 Sep 2020 12:11:38 +0000 (13:11 +0100)]
common/sfc_efx/base: add event queue operation to do polling

Event queue host interface differ on Riverhead and implementation
will be different.

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@xilinx.com>
3 years agocommon/sfc_efx/base: update MCDI headers
Andrew Rybchenko [Thu, 24 Sep 2020 12:11:37 +0000 (13:11 +0100)]
common/sfc_efx/base: update MCDI headers

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
3 years agocommon/sfc_efx/base: add EF100 registers definitions
Andrew Rybchenko [Thu, 24 Sep 2020 12:11:36 +0000 (13:11 +0100)]
common/sfc_efx/base: add EF100 registers definitions

Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
3 years agonet/octeontx2: support VLAN insert and strip actions
Kiran Kumar K [Mon, 24 Aug 2020 07:04:24 +0000 (12:34 +0530)]
net/octeontx2: support VLAN insert and strip actions

Adding support for RTE Flow VLAN insert and strip actions.

Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
3 years agonet/octeontx2: set max VTAG insertion size
Kiran Kumar K [Fri, 21 Aug 2020 06:59:30 +0000 (12:29 +0530)]
net/octeontx2: set max VTAG insertion size

When TX side VTAG insertion is enabled, SMQ should be configured with
the maximum VTAG insertion size to avoid generating NIX_SQINT_SEND_ERR
interrupt. Since the default value is zero, This patch configures the
VTAG insertion size to the max supported value.

Signed-off-by: Kiran Kumar K <kirankumark@marvell.com>
Acked-by: Jerin Jacob <jerinj@marvell.com>
3 years agonet/qede: support VF FLR
Manish Chopra [Fri, 25 Sep 2020 11:55:08 +0000 (04:55 -0700)]
net/qede: support VF FLR

This patch adds required bit to handle VF FLR
indication from Management FW (MFW) of the device

With that VFs were able to load in VM (VF attached as PCI
passthrough to the guest VM) followed by FLR successfully

Updated the docs/guides with the feature support

Signed-off-by: Manish Chopra <manishc@marvell.com>
Signed-off-by: Igor Russkikh <irusskikh@marvell.com>
Signed-off-by: Rasesh Mody <rmody@marvell.com>