]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
net: airoha: Fix always-true condition in PPE1 queue reservation loop
authorWayen.Yan <win847@gmail.com>
Sat, 13 Jun 2026 00:23:12 +0000 (08:23 +0800)
committerJakub Kicinski <kuba@kernel.org>
Mon, 15 Jun 2026 22:45:14 +0000 (15:45 -0700)
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.

Fixes: 23020f049327 ("net: airoha: Introduce ethernet support for EN7581 SoC")
Signed-off-by: Wayen.Yan <win847@gmail.com>
Acked-by: Lorenzo Bianconi <lorenzo@kernel.org>
Link: https://patch.msgid.link/6a2ca3de.ad59c0a6.147df9.2ac1@mx.google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/airoha/airoha_eth.c

index 329988a8400c13a8e2ef60cbd55e9aefb42e3853..7b8d0c5e262ab640b69924c3e24fe242a302b362 100644 (file)
@@ -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