[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240614200751.GY8447@kernel.org>
Date: Fri, 14 Jun 2024 21:07:51 +0100
From: Simon Horman <horms@...nel.org>
To: David Wei <dw@...idwei.uk>
Cc: Michael Chan <michael.chan@...adcom.com>,
Andy Gospodarek <andrew.gospodarek@...adcom.com>,
Adrian Alvarado <adrian.alvarado@...adcom.com>,
Somnath Kotur <somnath.kotur@...adcom.com>, netdev@...r.kernel.org,
Pavel Begunkov <asml.silence@...il.com>,
Jakub Kicinski <kuba@...nel.org>, David Ahern <dsahern@...nel.org>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>, Paolo Abeni <pabeni@...hat.com>
Subject: Re: [PATCH net-next v1 3/3] bnxt_en: implement netdev_queue_mgmt_ops
On Mon, Jun 10, 2024 at 07:33:24PM -0700, David Wei wrote:
> 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 stopped/started using bnxt_hwrm_vnic_update(), which only
> affects queues that are not in the default RSS context. This is
> different to the GVE that also implemented the queue API recently where
> arbitrary Rx queues can be stopped. Due to this limitation, all ndos
> returns EOPNOTSUPP if the queue is in the default RSS context.
>
> Thanks to Somnath for helping me with using bnxt_hwrm_vnic_update() to
> stop/start an Rx queue. With their permission I've added them as
> Acked-by.
>
> [1]: https://lore.kernel.org/netdev/20240501232549.1327174-2-shailend@google.com/
>
> Acked-by: Somnath Kotur <somnath.kotur@...adcom.com>
> Signed-off-by: David Wei <dw@...idwei.uk>
> ---
> drivers/net/ethernet/broadcom/bnxt/bnxt.c | 307 ++++++++++++++++++++++
> 1 file changed, 307 insertions(+)
>
> diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
...
> +static void bnxt_queue_mem_free(struct net_device *dev, void *qmem)
> +{
> + struct bnxt_rx_ring_info *rxr = qmem;
> + struct bnxt *bp = netdev_priv(dev);
> + struct bnxt_ring_struct *ring;
> +
> + if (bnxt_get_max_rss_ring(bp) >= idx)
> + return -EOPNOTSUPP;
Hi David,
I guess there was some last minute refactoring and these sloped through the
cracks. The two lines above seem a bit out of place here.
* idx doesn't exist in this context
* The return type of this function is void
> +
> + bnxt_free_one_rx_ring(bp, rxr);
> + bnxt_free_one_rx_agg_ring(bp, rxr);
> +
> + /* At this point, this NAPI instance has another page pool associated
> + * with it. Disconnect here before freeing the old page pool to avoid
> + * warnings.
> + */
> + rxr->page_pool->p.napi = NULL;
> + page_pool_destroy(rxr->page_pool);
> + rxr->page_pool = NULL;
> +
> + ring = &rxr->rx_ring_struct;
> + bnxt_free_ring(bp, &ring->ring_mem);
> +
> + ring = &rxr->rx_agg_ring_struct;
> + bnxt_free_ring(bp, &ring->ring_mem);
> +
> + kfree(rxr->rx_agg_bmap);
> + rxr->rx_agg_bmap = NULL;
> +}
...
Powered by blists - more mailing lists