* [PATCH v3] staging: octeon: fix asymmetric output buffer pool accounting
@ 2026-11-16 6:57 Priyanshu Singh
2026-11-16 9:40 ` Greg Kroah-Hartman
0 siblings, 1 reply; 3+ messages in thread
From: Priyanshu Singh @ 2026-11-16 6:57 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: Dan Carpenter, Oscar Alejandro Sánchez Lucero, linux-staging,
linux-kernel, Priyanshu Singh
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.
Fixes: d5f9bc7360fc ("STAGING: Octeon: Increase output command buffers")
Fixes: 4bcc688a11da ("staging: octeon: handle rx/tx initialization failures in probe")
Signed-off-by: Priyanshu Singh <singhpriyanshu9838@gmail.com>
---
v2 -> v3:
- Add Fixes tag.
v1 -> v2:
- Make it clear in commit message that this was found via code inspection
and is compile-tested only.
- Fix missing space typo in commit message.
drivers/staging/octeon/ethernet-defines.h | 2 ++
drivers/staging/octeon/ethernet.c | 9 ++++++---
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/drivers/staging/octeon/ethernet-defines.h b/drivers/staging/octeon/ethernet-defines.h
index c060374a3da2..3ce7c125ccfd 100644
--- a/drivers/staging/octeon/ethernet-defines.h
+++ b/drivers/staging/octeon/ethernet-defines.h
@@ -37,4 +37,6 @@
#define TOTAL_NUMBER_OF_PORTS (CVMX_PIP_NUM_INPUT_PORTS + 1)
+#define CVM_OCT_NUM_OUTPUT_BUFFERS 1024
+
#endif /* __ETHERNET_DEFINES_H__ */
diff --git a/drivers/staging/octeon/ethernet.c b/drivers/staging/octeon/ethernet.c
index dea5696a6642..e0e6d40602f0 100644
--- a/drivers/staging/octeon/ethernet.c
+++ b/drivers/staging/octeon/ethernet.c
@@ -162,7 +162,8 @@ static void cvm_oct_configure_common_hw(struct platform_device *pdev)
num_packet_buffers);
if (CVMX_FPA_OUTPUT_BUFFER_POOL != CVMX_FPA_PACKET_POOL)
cvm_oct_mem_fill_fpa(pdev, CVMX_FPA_OUTPUT_BUFFER_POOL,
- CVMX_FPA_OUTPUT_BUFFER_POOL_SIZE, 1024);
+ CVMX_FPA_OUTPUT_BUFFER_POOL_SIZE,
+ CVM_OCT_NUM_OUTPUT_BUFFERS);
#ifdef __LITTLE_ENDIAN
{
@@ -974,7 +975,8 @@ static int cvm_oct_probe(struct platform_device *pdev)
num_packet_buffers);
if (CVMX_FPA_OUTPUT_BUFFER_POOL != CVMX_FPA_PACKET_POOL)
cvm_oct_mem_empty_fpa(pdev, CVMX_FPA_OUTPUT_BUFFER_POOL,
- CVMX_FPA_OUTPUT_BUFFER_POOL_SIZE, 128);
+ CVMX_FPA_OUTPUT_BUFFER_POOL_SIZE,
+ CVM_OCT_NUM_OUTPUT_BUFFERS);
return ret;
}
@@ -1009,7 +1011,8 @@ static void cvm_oct_remove(struct platform_device *pdev)
num_packet_buffers);
if (CVMX_FPA_OUTPUT_BUFFER_POOL != CVMX_FPA_PACKET_POOL)
cvm_oct_mem_empty_fpa(pdev, CVMX_FPA_OUTPUT_BUFFER_POOL,
- CVMX_FPA_OUTPUT_BUFFER_POOL_SIZE, 128);
+ CVMX_FPA_OUTPUT_BUFFER_POOL_SIZE,
+ CVM_OCT_NUM_OUTPUT_BUFFERS);
}
static const struct of_device_id cvm_oct_match[] = {
--
2.53.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v3] staging: octeon: fix asymmetric output buffer pool accounting
2026-11-16 6:57 [PATCH v3] staging: octeon: fix asymmetric output buffer pool accounting Priyanshu Singh
@ 2026-11-16 9:40 ` Greg Kroah-Hartman
2026-11-16 10:16 ` ASH
0 siblings, 1 reply; 3+ messages in thread
From: Greg Kroah-Hartman @ 2026-11-16 9:40 UTC (permalink / raw)
To: Priyanshu Singh
Cc: Dan Carpenter, Oscar Alejandro Sánchez Lucero, linux-staging,
linux-kernel
On Mon, Nov 16, 2026 at 06:57:30AM +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.
Please test this on real hardware in order for us to be able to accept
it.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v3] staging: octeon: fix asymmetric output buffer pool accounting
2026-11-16 9:40 ` Greg Kroah-Hartman
@ 2026-11-16 10:16 ` ASH
0 siblings, 0 replies; 3+ messages in thread
From: ASH @ 2026-11-16 10:16 UTC (permalink / raw)
To: Greg Kroah-Hartman
Cc: Dan Carpenter, Oscar Alejandro Sánchez Lucero, linux-staging,
linux-kernel
On Mon, Nov 16, 2026 at 3:10 PM Greg Kroah-Hartman
<gregkh@linuxfoundation.org> wrote:
> Please test this on real hardware in order for us to be able to accept
> it.
Unfortunately, I do not have access to physical Octeon hardware to
run-test this.
The patch was based on commit d5f9bc7360fc ("STAGING: Octeon: Increase output
command buffers"), which increased the allocation in
cvm_oct_configure_common_hw()
from 128 to 1024, but left the corresponding teardown paths in cvm_oct_probe()
and cvm_oct_remove(), passing 128 to cvm_oct_mem_empty_fpa().
If anyone on the list with access to an Octeon board is able to test this, that
would be wonderful. Otherwise, I completely understand dropping this patch until
someone with hardware can verify it.
Thanks,
Priyanshu
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-11-16 10:16 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-16 6:57 [PATCH v3] staging: octeon: fix asymmetric output buffer pool accounting Priyanshu Singh
2026-11-16 9:40 ` Greg Kroah-Hartman
2026-11-16 10:16 ` ASH
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox