• David Wei's avatar
    bnxt_en: implement netdev_queue_mgmt_ops · 2d694c27
    David Wei authored
    Implement netdev_queue_mgmt_ops for bnxt added in [1].
    
    Two bnxt_rx_ring_info structs are allocated to hold the new/old queue
    memory. Queue memory is copied from/to the main bp->rx_ring[idx]
    bnxt_rx_ring_info.
    
    Queue memory is pre-allocated in bnxt_queue_mem_alloc() into a clone,
    and then copied into bp->rx_ring[idx] in bnxt_queue_mem_start().
    
    Similarly, when bp->rx_ring[idx] is stopped its queue memory is copied
    into a clone, and then freed later in bnxt_queue_mem_free().
    
    I tested this patchset with netdev_rx_queue_restart(), including
    inducing errors in all places that returns an error code. In all cases,
    the queue is left in a good working state.
    
    Rx queues are created/destroyed using bnxt_hwrm_rx_ring_alloc() and
    bnxt_hwrm_rx_ring_free(), which issue HWRM_RING_ALLOC and HWRM_RING_FREE
    commands respectively to the firmware. By the time a HWRM_RING_FREE
    response is received, there won't be any more completions from that
    queue.
    
    Thanks to Somnath for helping me with this patch. With their permission
    I've added them as Acked-by.
    
    [1]: https://lore.kernel.org/netdev/20240501232549.1327174-2-shailend@google.com/Acked-by: default avatarSomnath Kotur <somnath.kotur@broadcom.com>
    Signed-off-by: default avatarDavid Wei <dw@davidwei.uk>
    Reviewed-by: default avatarSimon Horman <horms@kernel.org>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    2d694c27
bnxt.c 424 KB