Re: [PATCH v2] staging: octeon: fix asymmetric output buffer pool accounting

From: Dan Carpenter

Date: Mon Nov 16 2026 - 00:28:21 EST


On Fri, Nov 13, 2026 at 11:16:22PM +0000, Priyanshu Singh wrote:
> In cvm_oct_configure_common_hw(), when CVMX_FPA_OUTPUT_BUFFER_POOL differs
> from CVMX_FPA_PACKET_POOL, 1024 output buffers are allocated and added to
> the hardware Free Pool Allocator (FPA) pool. However, in cvm_oct_probe()
> (err_tx:) and in cvm_oct_remove(), cvm_oct_mem_empty_fpa() is called with
> 128 instead of 1024 as the expected buffer count.
>
> This asymmetric accounting causes cvm_oct_free_hw_memory() to report a
> false warning ("Freeing of pool 2 had too many buffers (-896)") upon
> draining the pool.
>
> Define CVM_OCT_NUM_OUTPUT_BUFFERS in ethernet-defines.h and use this
> constant across cvm_oct_configure_common_hw(),
> cvm_oct_probe(), and cvm_oct_remove() to ensure symmetric allocation
> and deallocation.
>
> This was found via manual code inspection and is compile-tested only.
>
> Signed-off-by: Priyanshu Singh <singhpriyanshu9838@xxxxxxxxx>
> ---

This needs a Fixes tag.

regards,
dan carpenter