Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.
Low priority / nit picks for your consideration:
- [Low] The kernel-doc for ibmveth_cleanup_rx_resources() in
drivers/net/ethernet/ibm/ibmveth.c says "Free all RX queue resources",…
--
ibmveth: Refactor RX resource allocation for MQ RX bring-up
This moves the filter list and per-queue RX ring and buffer list
allocation out of ibmveth_open() into helpers that loop over
num_rx_queues and undo their own partial failures. ibmveth_close() and
the open() error path now free through the same helpers.
> diff --git a/drivers/net/ethernet/ibm/ibmveth.c
> b/drivers/net/ethernet/ibm/ibmveth.c
> index fc50036d5d265..559c4d2d957bb 100644
> --- a/drivers/net/ethernet/ibm/ibmveth.c
> +++ b/drivers/net/ethernet/ibm/ibmveth.c
> @@ -159,6 +159,177 @@ static unsigned int ibmveth_real_max_tx_queues(void)
[ ... ]
> +/**
> + * ibmveth_cleanup_rx_resources - Free all RX queue resources
> + * @adapter: ibmveth adapter structure
> + */
> +static void
> +ibmveth_cleanup_rx_resources(struct ibmveth_adapter *adapter)
> +{
> + struct device *dev = &adapter->vdev->dev;
> + int i;
> +
> + for (i = 0; i < adapter->num_rx_queues; i++) {
> + if (adapter->buffer_list_addr[i]) {
> + dma_unmap_single(dev, adapter->buffer_list_dma[i],
> + 4096, DMA_BIDIRECTIONAL);
> + adapter->buffer_list_dma[i] = 0;
> + }
> +
> + if (adapter->rx_queue[i].queue_addr) {
> + dma_free_coherent(dev, adapter->rx_queue[i].queue_len,
> + adapter->rx_queue[i].queue_addr,
> + adapter->rx_queue[i].queue_dma);
> + adapter->rx_queue[i].queue_addr = NULL;
> + }
> +
> + if (adapter->buffer_list_addr[i]) {
> + free_page((unsigned long)adapter->buffer_list_addr[i]);
> + adapter->buffer_list_addr[i] = NULL;
> + }
> + }
> +}
[Severity: Low]
This isn't a bug, but is the kernel-doc for ibmveth_cleanup_rx_resources()
accurate? It says "Free all RX queue resources". The body only frees
buffer_list_addr[i] with its buffer_list_dma[i] mapping, plus the coherent
ring at rx_queue[i].queue_addr.
It doesn't free the per-queue buffer pools in adapter->rx_buff_pool[queue][*]
(the free_map, dma_addr and skbuff arrays and the DMA-mapped skbs). That is
why ibmveth_close() still frees them in a separate loop after calling this
helper:
ibmveth_cleanup_rx_resources(adapter);
ibmveth_free_filter_list(adapter);
for (i = 0; i < IBMVETH_NUM_BUFF_POOLS; i++)
if (adapter->rx_buff_pool[0][i].active)
ibmveth_free_buffer_pool(adapter,
&adapter->rx_buff_pool[0][i]);
The ibmveth_open() error path also keeps its own out_free_buffer_pools
label for the same reason.
At the end of the series this doc line hasn't changed. There, close() and
the open() error path call ibmveth_free_buffer_pools() separately before
this helper. So the helper doesn't seem meant to free the pools.
Could the comment be narrowed to describe the buffer lists and RX rings it
actually frees? The name could also be changed to match its allocator,
ibmveth_alloc_rx_queues().
[ ... ]
--
Sashiko AI review ·
https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261119000711.18093-1-mmc%40linux.ibm.com