net: airoha: Fix always-true condition in PPE1 queue reservation loop
Subsystems (4)
PATCH 1/1 net: airoha: Fix always-true condition in PPE1 queue reservation loop
In airoha_fe_pse_ports_init(), the inner condition for PPE1 queue reservation is identical to the for-loop bound, making it always true and the else branch dead code:
for (q = 0; q < pse_port_num_queues[FE_PSE_PORT_PPE1]; q++) {
if (q < pse_port_num_queues[FE_PSE_PORT_PPE1]) /* always true */
set RSV_PAGES;
else
set 0; /* unreachable */
}The intended behavior is to reserve pages only for the first half of the queues, matching the PPE2 implementation on line 334 which correctly uses the /2 divisor. Fix the PPE1 condition accordingly.
--- drivers/net/ethernet/airoha/airoha_eth.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/airoha/airoha_eth.c +1 -1
@@ -311,7 +311,7 @@ static void airoha_fe_pse_ports_init(struct airoha_eth *eth) PSE_QUEUE_RSV_PAGES);/* PPE1 */ for (q =0 ; q < pse_port_num_queues[FE_PSE_PORT_PPE1 ]; q++) { -if (q < pse_port_num_queues[FE_PSE_PORT_PPE1 ]) +if (q < pse_port_num_queues[FE_PSE_PORT_PPE1 ] /2 )airoha_fe_set_pse_oq_rsv (eth,FE_PSE_PORT_PPE1 , q,PSE_QUEUE_RSV_PAGES );else
Signature · 1 line
2.51.0
Quoted 11 lines
In
airoha_fe_pse_ports_init(), the inner condition for PPE1 queue reservation is identical to the for-loop bound, making it always true and the else branch dead code:for (q = 0; q < pse_port_num_queues[FE_PSE_PORT_PPE1]; q++) { if (q < pse_port_num_queues[FE_PSE_PORT_PPE1]) /* always true */ set RSV_PAGES; else set 0; /* unreachable */ }
Quoted 6 lines
The intended behavior is to reserve pages only for the first half of the queues, matching the PPE2 implementation on line 334 which correctly uses the /2 divisor. Fix the PPE1 condition accordingly.
Fixes 23020f049327 ("net: airoha: Introduce ethernet support for EN7581 SoC")Signed-off-by Wayen.Yan <[email protected]>
Quoted 21 lines
--- drivers/net/ethernet/airoha/airoha_eth.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/net/ethernet/airoha/airoha_eth.c +1
-1@@ -311,7 +311,7 @@ static void airoha_fe_pse_ports_init(struct airoha_eth *eth) PSE_QUEUE_RSV_PAGES);/* PPE1 */ for (q =0 ; q < pse_port_num_queues[FE_PSE_PORT_PPE1 ]; q++) { -if (q < pse_port_num_queues[FE_PSE_PORT_PPE1 ]) +if (q < pse_port_num_queues[FE_PSE_PORT_PPE1 ] /2 )airoha_fe_set_pse_oq_rsv (eth,FE_PSE_PORT_PPE1 , q,PSE_QUEUE_RSV_PAGES );else Signature · 1 line
2.51.0
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:
Quoted 4 lines · On Sat, 13 Jun 2026 08:23:12 +0800 you wrote:
In
airoha_fe_pse_ports_init(), the inner condition for PPE1 queue reservation is identical to the for-loop bound, making it always true and the else branch dead code:
Quoted 8 lines
for (q = 0; q < pse_port_num_queues[FE_PSE_PORT_PPE1]; q++) { if (q < pse_port_num_queues[FE_PSE_PORT_PPE1]) /* always true */ set RSV_PAGES; else set 0; /* unreachable */ }[...]
Here is the summary with links:
- net: airoha: Fix always-true condition in PPE1 queue reservation loop
https://git.kernel.org/netdev/net/c/c66f8511a810
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html