Commit Graph

31 Commits

Author SHA1 Message Date
Xueming Li
7483341ae5 ethdev: change queue release callback
Currently, most ethdev callback API use queue ID as parameter, but Rx
and Tx queue release callback use queue object which is used by Rx and
Tx burst data plane callback.

To align with other eth device queue configuration callbacks:
- queue release callbacks are changed to use queue ID
- all drivers are adapted

Signed-off-by: Xueming Li <xuemingl@nvidia.com>
Reviewed-by: Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Acked-by: Somnath Kotur <somnath.kotur@broadcom.com>
Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
2021-10-06 19:16:03 +02:00
Ajit Khaparde
0f22fe124b net/bnxt: fix Tx queue startup state
Default queue state of Tx queues on startup is not correct.
Fix this by setting the state when the port is started.

Fixes: 6eb3cc2294 ("net/bnxt: add initial Tx code")
Cc: stable@dpdk.org

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Lance Richardson <lance.richardson@broadcom.com>
2021-09-26 23:14:57 +02:00
Ajit Khaparde
0105ea1296 net/bnxt: support runtime queue setup
Add support for runtime Rx and Tx queue setup. This will allow
Rx/Tx queue setup after the interface is started.

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
2021-07-08 05:55:56 +02:00
Lance Richardson
c6c90a33de net/bnxt: fix ring and context memory allocation
Use requested socket ID when allocating memory for transmit rings,
receive rings, and completion queues. Use device NUMA ID when
allocating context memory, notification queue rings, async
completion queue rings, and VNIC attributes.

Fixes: 6eb3cc2294 ("net/bnxt: add initial Tx code")
Fixes: 9738793f28 ("net/bnxt: add VNIC functions and structs")
Fixes: f8168ca0e6 ("net/bnxt: support thor controller")
Fixes: bd0a14c99f ("net/bnxt: use dedicated CPR for async events")
Fixes: 683e5cf792 ("net/bnxt: use common NQ ring")
Cc: stable@dpdk.org

Signed-off-by: Lance Richardson <lance.richardson@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
2021-07-08 05:55:52 +02:00
Lance Richardson
527b10089c net/bnxt: optimize Tx completion handling
Avoid copying mbuf pointers to separate array for bulk
mbuf free when handling transmit completions for vector
mode transmit.

Signed-off-by: Lance Richardson <lance.richardson@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
2021-03-12 16:07:33 +01:00
Ajit Khaparde
2addc463ee net/bnxt: update copyright year
Update copyright year in various files.

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
2021-01-29 18:16:10 +01:00
Sriharsha Basavapatna
c72fe7ac3b net/bnxt: fix max rings computation
The current max_rings computation does not take into account the case
when max_nq_rings is <= num_async_cpr. This results in a wrong value
like 0, when max_nq_rings is 1. Fix this by subtracting num_async_cpr
only when max_cp_rings > num_async_cpr.

Apart from this, the entire logic is currently spread across a few
macros, making it hard to read and debug this code. Move this code
into an inline function.

max_msix is not used in the max_rings calculation.
Apparently the max_msix field returned in HWRM_RESC_QCAPS is only valid
for Thor and newer chips. On Wh+ it will be equal to min_compl_rings.
Also, when a function reset is performed on an application quit, FW
will not reset the VF resource pool as per design.
This can lead to a strange condition wherein the max_msix field
on Wh+ keeps changing on each application re-load thereby throwing
throwing off the max_rings computation.

Fixes: f03e66cb64 ("net/bnxt: limit queue count for NS3/Stingray devices")
Cc: stable@dpdk.org

Signed-off-by: Sriharsha Basavapatna <sriharsha.basavapatna@broadcom.com>
Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
2021-01-08 16:03:05 +01:00
Somnath Kotur
97c3271781 net/bnxt: fix queue release
Some of the ring related memory was not being freed in both the release
ops. Fix to free them now.
Add some more NULL ptr checks in the corresponding queue_release_mbufs()
and queue_release_op() respectively.
Also call queue_release_op() in the error path of the corresponding
queue_setup_op()

Fixes: 6133f20797 ("net/bnxt: add Rx queue create/destroy")
Fixes: 51c87ebafc ("net/bnxt: add Tx queue create/destroy")
Cc: stable@dpdk.org

Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
2020-11-03 23:24:25 +01:00
Lance Richardson
369f6077c5 net/bnxt: support fast mbuf free
Add support for DEV_TX_OFFLOAD_MBUF_FAST_FREE to bnxt
vector mode transmit. This offload may be enabled
only when multi-segment transmit is not needed, all
transmitted mbufs for a given queue will be allocated
from the same pool, and all transmitted mbufs will
have a reference count of 1.

Signed-off-by: Lance Richardson <lance.richardson@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
2020-10-09 13:17:42 +02:00
Lance Richardson
cec43bbf38 net/bnxt: improve small ring sizes support
Improve support for small ring sizes:
   - Ensure that transmit free threshold is no more than 1/4 ring size.
   - Ensure that receive free threshold is no more than 1/4 ring size.
   - Validate requested ring sizes against minimum supported size.
   - Use rxq receive free threshold instead of fixed maximum burst
     size to trigger bulk receive buffer allocation.

Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: Lance Richardson <lance.richardson@broadcom.com>
2020-09-18 18:55:09 +02:00
Somnath Kotur
f03e66cb64 net/bnxt: limit queue count for NS3/Stingray devices
Cap max queue count to 128 for NS3 devices and ensure that same count
is reported as part of dev_info_get_op as well

Signed-off-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Rahul Gupta <rahul.gupta@broadcom.com>
2019-11-20 17:36:05 +01:00
Lance Richardson
00932678c6 net/bnxt: fix mbuf free when clearing Tx queue
When freeing pending transmit mbufs, use rte_pktmbuf_free_seg()
instead of rte_pktmbuf_free(), otherwise linked mbufs may be freed
more than once.

Fixes: 6eb3cc2294 ("net/bnxt: add initial Tx code")
Cc: stable@dpdk.org

Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: Lance Richardson <lance.richardson@broadcom.com>
2019-10-25 19:00:22 +02:00
Kalesh AP
f7b1b6b12d net/bnxt: remove redundant header file inclusion
bnxt.h header includes bnxt_cpr.h and bnxt_util.h.
There is no need to include these headers file explicitly.

This commit does not cause any functional change.

Cc: stable@dpdk.org

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
2019-10-23 16:43:08 +02:00
Lance Richardson
683e5cf792 net/bnxt: use common NQ ring
Thor queue scaling is currently limited by the number of NQs that
can be allocated. Fix by using a common NQ for all receive/transmit
rings instead of allocating a separate NQ for each ring.

Fixes: f8168ca0e6 ("net/bnxt: support thor controller")
Cc: stable@dpdk.org

Signed-off-by: Lance Richardson <lance.richardson@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
2019-10-08 12:14:32 +02:00
Kalesh AP
2171e66f93 net/bnxt: fix deferred start of Tx queues
Driver should not change "deferred_start" state of the tx queues.
It should get the state in queue_setup_op() and use that value.

Since the deferred start state was being used in the packet transmit
functions to determine whether the queue has been stopped already,
introduced a per-txq flag to track queue stopped/started state.

Fixes: 9b63c6fd70 ("net/bnxt: support Rx/Tx queue start/stop")
Cc: stable@dpdk.org

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Lance Richardson <lance.richardson@broadcom.com>
2019-10-08 12:14:30 +02:00
Kalesh AP
1bf01f5135 net/bnxt: prevent device access when device is in reset
Refactor init and uninit functions so that the driver can fail
the eth_dev_ops callbacks and accessing Tx and Rx queues
when device is in reset or in error state.

Transmit and receive queues are freed during reset cleanup and
reallocated during recovery. So we block all data path handling
in this state. The eth_dev dev_started field is updated depending
on the status of the device.

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Santoshkumar Karanappa Rastapur <santosh.rastapur@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
2019-10-08 12:14:30 +02:00
Lance Richardson
3227d09853 net/bnxt: revert fix traffic stall on stop/start
This reverts commit aa2c00702b, which
introduced the possibility of an invalid address exception when running
an application with a stopped receive queue. The issues with rxq stop/start
 will be revisited in the 19.11 release timeframe.

Fixes: aa2c00702b ("net/bnxt: fix traffic stall on Rx queue stop/start")
Cc: stable@dpdk.org

Signed-off-by: Lance Richardson <lance.richardson@broadcom.com>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
2019-08-10 23:55:07 +02:00
Kalesh AP
aa2c00702b net/bnxt: fix traffic stall on Rx queue stop/start
Fixed a check in bnxt_alloc_hwrm_rx_ring() while initializing
the rx ring.

Driver should not change "deferred_start" status of rx/tx queues.
It should get the status in queue_setup_op() and use that value.

Fixes: 9b63c6fd70 ("net/bnxt: support Rx/Tx queue start/stop")
Cc: stable@dpdk.org

Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
2019-08-05 23:33:12 +02:00
Lance Richardson
f8168ca0e6 net/bnxt: support thor controller
This commit adds support to the bnxt PMD for devices
based on the BCM57508 "thor" Ethernet controller.

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Signed-off-by: Lance Richardson <lance.richardson@broadcom.com>
2019-06-13 23:54:30 +09:00
Stephen Hemminger
78466c95f8 net/bnxt: remove unnecessary cast
The device private pointer (dev_private) is of type void *
therefore no cast is necessary in C.

Cc: stable@dpdk.org

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Acked-by: Lance Richardson <lance.richardson@broadcom.com>
2019-06-13 23:54:29 +09:00
Ajit Khaparde
5ef3592c97 net/bnxt: support bulk free of Tx mbufs
The driver currently uses rte_pktmbuf_free() to free each mbuf
after transmit completion. This is optimized to free multiple
mbufs using rte_mempool_put_bulk().

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: Sriharsha Basavapatna <sriharsha.basavapatna@broadcom.com>
2019-05-27 18:09:07 +02:00
Rahul Gupta
f7b36e8f36 net/bnxt: validate structs and pointers before use
Validate pointers aren't pointing to uninitialized areas
including txq and rxq before using them to avoid
bnxt driver from crashing.

Signed-off-by: Rahul Gupta <rahul.gupta@broadcom.com>
Signed-off-by: Jay Ding <jay.ding@broadcom.com>
Signed-off-by: Scott Branden <scott.branden@broadcom.com>
Reviewed-by: Ray Jui <ray.jui@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Randy Schacher <stuart.schacher@broadcom.com>
Tested-by: Randy Schacher <stuart.schacher@broadcom.com>
2018-05-14 22:31:48 +01:00
Jay Ding
a42b152aba net/bnxt: update returned error on invalid max ring
Return EINVAL instead of ENOSPC when invalid queue_idx passed in
during rx and tx queue_setup_op routines.

Signed-off-by: Jay Ding <jay.ding@broadcom.com>
Signed-off-by: Scott Branden <scott.branden@broadcom.com>
Reviewed-by: Ray Jui <ray.jui@broadcom.com>
Reviewed-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
2018-05-14 22:31:48 +01:00
Ajit Khaparde
23460b4c6a net/bnxt: avoid freeing memzone multiple times
Since we are storing the mem_zone address for each ring created,
we are freeing the same address multiple times.
For example the memory zone created for Rx is being freed during
Rx ring cleanup, AGG ring cleanup and CQ cleanup.
Avoid this by storing the memory zone address in RXQ instead and
free it as a part of queue_release dev_op.
In the same way do the same for TX queues as well.

Fixes: 51c87ebafc ("net/bnxt: add Tx queue create/destroy")
Cc: stable@dpdk.org

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
2018-04-27 15:54:56 +01:00
Scott Branden
fd710bb1f6 net/bnxt: convert to SPDX license tag
Update the license header on bnxt files to be the standard
BSD-3-Clause license used for the rest of DPDK,
bring the files in compliance with the DPDK licensing policy.

Signed-off-by: Scott Branden <scott.branden@broadcom.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
2018-04-14 00:40:21 +02:00
Ajit Khaparde
3e92fd4e4e net/bnxt: use dynamic log type
This patch implements driver specific log type doing away with
usage of RTE_LOG() for logging.

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
2018-01-29 10:04:28 +01:00
Ajit Khaparde
f10d528250 net/bnxt: check on-chip resources
Check for availability of on-chip resources - like Queue count,
number stat context, number of ring groups before inheriting and
initializing as per application requirements.
Also check before creating a Tx or Rx queue make sure there are
enough resources to complete the request.

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
2018-01-16 18:47:49 +01:00
Ajit Khaparde
2bb1d5db43 net/bnxt: allocate Rx/Tx and completion rings
Perform allocation and free()ing of ring and information structures
for the TX, RX, and completion rings. The previous patches had
so far provided top level stubs and generic ring support, while this
patch does the real allocation and freeing of the memory specific to
each different type of generic ring.

For example bnxt_init_tx_ring_struct() or bnxt_init_rx_ring_struct() is
now allocating memory based on the socked_id being provided.

bnxt_tx_queue_setup_op() or bnxt_rx_queue_setup_op() have gone through
some reformatting to perform a graceful cleanup in case memory
allocation fails.

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: Stephen Hurd <stephen.hurd@broadcom.com>
Reviewed-by: David Christensen <david.christensen@broadcom.com>
2016-06-20 17:21:52 +02:00
Ajit Khaparde
6eb3cc2294 net/bnxt: add initial Tx code
Initial implementation of tx_pkt_burst for transmit.
bnxt_xmit_pkts() is the top level function that is called during Tx.

bnxt_handle_tx_cp() is used to check and process the Tx completions
generated for the Tx Buffer Descriptors sent by the hardware.

This patch also adds code to allocate rings in the hardware.
For each Tx queue allocated in the PMD driver, a corresponding ring
in hardware will be created. Every time a Tx request is initiated
via the bnxt_xmit_pkts() call, a Buffer Descriptor is created and
is sent to the hardware via the associated Tx ring.

On completing the Tx operation, the hardware will generates the status
in the form of a completion. This completion is processed by the
bnxt_handle_tx_cp() function.

Functions like bnxt_init_tx_ring_struct() and bnxt_init_one_tx_ring()
are used to initialize various members of the structure before
starting Tx operations.

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: Stephen Hurd <stephen.hurd@broadcom.com>
Reviewed-by: David Christensen <david.christensen@broadcom.com>
2016-06-20 17:21:51 +02:00
Ajit Khaparde
57d5e5bc86 net/bnxt: add statistics
Add the bnxt_stats_get_op() and bnxt_stats_reset_op() dev_ops to
get and reset statistics. It also brings in the associated HWRM calls
to handle the requests appropriately.

We also have the bnxt_free_stats() function which will be used in the
follow on patches to free the memory allocated by the driver for
statistics.

New HWRM calls:
bnxt_hwrm_stat_clear:
	This command clears statistics of a context

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: Stephen Hurd <stephen.hurd@broadcom.com>
Reviewed-by: David Christensen <david.christensen@broadcom.com>
2016-06-20 17:21:51 +02:00
Ajit Khaparde
51c87ebafc net/bnxt: add Tx queue create/destroy
In this patch we are adding the bnxt_tx_queue_setup_op() and
bnxt_tx_queue_release_op() functions. These will be tied to the
tx_queue_setup and tx_queue_release dev_ops in a subsequent patch.
In these functions we allocate/free memory for the TX queues.

This still requires support to create a TX ring in the ASIC which
will be completed in a future commit. Each Tx queue created via the
tx_queue_setup dev_op will have an associated Tx ring in the hardware.

A Tx request coming on the Tx queue gets sent to the corresponding
Tx ring in the ASIC for subsequent transmission.

Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Signed-off-by: Stephen Hurd <stephen.hurd@broadcom.com>
Reviewed-by: David Christensen <david.christensen@broadcom.com>
2016-06-20 17:21:51 +02:00