mbox series

[RFC,net-next,v2,0/9] bnxt: implement queue api

Message ID 20240502045410.3524155-1-dw@davidwei.uk (mailing list archive)
Headers show
Series bnxt: implement queue api | expand

Message

David Wei May 2, 2024, 4:54 a.m. UTC
Both TCP devmem and io_uring ZC Rx need a way to change the page pool
for an Rx queue and reset it. As discussed in [1], until netdev core
takes a greater role in owning queue mem and ndo_open()/stop() calls
the queue API to alloc/free queue mem, we will have the driver
allocate queue mem in netdev_queue_mgmt_ops.

Rather than keeping the queue restart function in netmem, move it to
netdev core in netdev_rx_queue.h, since io_uring will also need to call
this as well. In the future, we'll have another API function that
changes the page pool memory provider for a given queue, then restarts
it.

The bnxt implementation allocates new queue mem and descriptors for an
rx queue before stopping the queue. Then, before starting the queue, the
queue mem and descriptors are swapped. Finally, the old queue mem and
descriptors are freed.

Individual patches go into more detail about how this is done for bnxt.
But from a high level:

1. Clone the bnxt_rx_ring_info for the specified rx queue
2. Allocate queue mem and descriptors into this clone
3. Stop the queue
4. Swap the queue mem and descriptors around, such that the clone how
   has the old queue mem and descriptors
5. Start the queue
6. Free the clone, which frees the old queue mem and descriptors

This patches compiled but is so far untested as I don't have access to
FW that supports individual rx queue reset. I'm sending it as an RFC to
hopefully get some early feedback while I get a test environment set up.

David Wei (8):
  bnxt: implement queue api
  netdev: add netdev_rx_queue_restart()
  bnxt: refactor bnxt_{alloc,free}_one_rx_ring()
  bnxt: refactor bnxt_{alloc,free}_one_tpa_info()
  bnxt: add __bnxt_init_rx_ring_struct() helper
  bnxt: add helpers for allocating rx ring mem
  bnxt: alloc rx ring mem first before reset
  bnxt: swap rx ring mem during queue_stop()

Mina Almasry (1):
  queue_api: define queue api

 drivers/net/ethernet/broadcom/bnxt/bnxt.c | 410 ++++++++++++++++++----
 drivers/net/ethernet/broadcom/bnxt/bnxt.h |   2 +
 include/linux/netdevice.h                 |   3 +
 include/net/netdev_queues.h               |  27 ++
 include/net/netdev_rx_queue.h             |   3 +
 net/core/Makefile                         |   1 +
 net/core/netdev_rx_queue.c                |  58 +++
 7 files changed, 443 insertions(+), 61 deletions(-)
 create mode 100644 net/core/netdev_rx_queue.c