]> git.ipfire.org Git - thirdparty/openwrt.git/commitdiff
airoha: backport optimization in QDMA rx queue descriptor setup
authorChristian Marangi <ansuelsmth@gmail.com>
Wed, 15 Apr 2026 12:46:25 +0000 (14:46 +0200)
committerChristian Marangi <ansuelsmth@gmail.com>
Wed, 15 Apr 2026 12:46:25 +0000 (14:46 +0200)
Backport patch merged upstream that optimize the QDMA rx queue descriptor
setup by configuring the CPU IDX only when needed.

Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
target/linux/airoha/patches-6.12/143-v7.1-net-airoha-Fix-typo-in-airoha_set_gdm2_loopback-rout.patch [new file with mode: 0644]
target/linux/airoha/patches-6.12/144-v7.1-net-airoha-Set-REG_RX_CPU_IDX-once-in-airoha_qdma_fi.patch [new file with mode: 0644]
target/linux/airoha/patches-6.12/310-02-net-airoha-deassert-XSI-line-on-hw-init.patch
target/linux/airoha/patches-6.12/310-03-net-airoha-add-reference-for-SPORT-GDM4-in-qdma_get_.patch
target/linux/airoha/patches-6.12/310-06-net-airoha-add-initial-fixup-for-GDM3-4-port-support.patch
target/linux/airoha/patches-6.12/310-07-airoha-ethernet-drop-xsi-mac-reset.patch
target/linux/airoha/patches-6.12/310-10-net-airoha-add-phylink-support-for-GDM2-4.patch
target/linux/airoha/patches-6.12/604-02-net-ethernet-airoha-define-sport-value-for-GDM3.patch
target/linux/airoha/patches-6.12/606-net-airoha-disable-external-phy-code-if-PCS_AIROHA-i.patch

diff --git a/target/linux/airoha/patches-6.12/143-v7.1-net-airoha-Fix-typo-in-airoha_set_gdm2_loopback-rout.patch b/target/linux/airoha/patches-6.12/143-v7.1-net-airoha-Fix-typo-in-airoha_set_gdm2_loopback-rout.patch
new file mode 100644 (file)
index 0000000..dcbc223
--- /dev/null
@@ -0,0 +1,35 @@
+From a94ddc191f19579a7e0a5da2c012f1048ce10262 Mon Sep 17 00:00:00 2001
+From: Lorenzo Bianconi <lorenzo@kernel.org>
+Date: Mon, 30 Mar 2026 00:03:49 +0200
+Subject: [PATCH] net: airoha: Fix typo in airoha_set_gdm2_loopback routine
+ name
+
+Rename airhoha_set_gdm2_loopback() in airoha_set_gdm2_loopback()
+
+Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
+Link: https://patch.msgid.link/20260330-airoha_set_gdm2_loopback-fix-typo-v1-1-a1320ff6b6cc@kernel.org
+Signed-off-by: Jakub Kicinski <kuba@kernel.org>
+---
+ drivers/net/ethernet/airoha/airoha_eth.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/drivers/net/ethernet/airoha/airoha_eth.c
++++ b/drivers/net/ethernet/airoha/airoha_eth.c
+@@ -1722,7 +1722,7 @@ static int airoha_dev_set_macaddr(struct
+       return 0;
+ }
+-static int airhoha_set_gdm2_loopback(struct airoha_gdm_port *port)
++static int airoha_set_gdm2_loopback(struct airoha_gdm_port *port)
+ {
+       struct airoha_eth *eth = port->qdma->eth;
+       u32 val, pse_port, chan;
+@@ -1796,7 +1796,7 @@ static int airoha_dev_init(struct net_de
+               if (!eth->ports[1]) {
+                       int err;
+-                      err = airhoha_set_gdm2_loopback(port);
++                      err = airoha_set_gdm2_loopback(port);
+                       if (err)
+                               return err;
+               }
diff --git a/target/linux/airoha/patches-6.12/144-v7.1-net-airoha-Set-REG_RX_CPU_IDX-once-in-airoha_qdma_fi.patch b/target/linux/airoha/patches-6.12/144-v7.1-net-airoha-Set-REG_RX_CPU_IDX-once-in-airoha_qdma_fi.patch
new file mode 100644 (file)
index 0000000..8a98233
--- /dev/null
@@ -0,0 +1,34 @@
+From 269389ba539834ec80e4d55583fca2cd70e4dc9c Mon Sep 17 00:00:00 2001
+From: Lorenzo Bianconi <lorenzo@kernel.org>
+Date: Tue, 31 Mar 2026 12:33:24 +0200
+Subject: [PATCH] net: airoha: Set REG_RX_CPU_IDX() once in
+ airoha_qdma_fill_rx_queue()
+
+It is not necessary to update REG_RX_CPU_IDX register for each iteration
+of the descriptor loop in airoha_qdma_fill_rx_queue routine.
+Move REG_RX_CPU_IDX configuration out of the descriptor loop and rely on
+the last queue head value updated in the descriptor loop.
+
+Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
+Link: https://patch.msgid.link/20260331-airoha-cpu-idx-out-off-loop-v1-1-75c66b428f50@kernel.org
+Signed-off-by: Paolo Abeni <pabeni@redhat.com>
+---
+ drivers/net/ethernet/airoha/airoha_eth.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+--- a/drivers/net/ethernet/airoha/airoha_eth.c
++++ b/drivers/net/ethernet/airoha/airoha_eth.c
+@@ -561,11 +561,12 @@ static int airoha_qdma_fill_rx_queue(str
+               WRITE_ONCE(desc->msg1, 0);
+               WRITE_ONCE(desc->msg2, 0);
+               WRITE_ONCE(desc->msg3, 0);
++      }
++      if (nframes)
+               airoha_qdma_rmw(qdma, REG_RX_CPU_IDX(qid),
+                               RX_RING_CPU_IDX_MASK,
+                               FIELD_PREP(RX_RING_CPU_IDX_MASK, q->head));
+-      }
+       return nframes;
+ }
index fa1c9e56690f960054a2d0f81fe3ef82d5b8c8b0..6d5b7c5e954c63003c980b4f08ec38bbfc1a13e1 100644 (file)
@@ -13,7 +13,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
 
 --- a/drivers/net/ethernet/airoha/airoha_eth.c
 +++ b/drivers/net/ethernet/airoha/airoha_eth.c
-@@ -1422,6 +1422,10 @@ static int airoha_hw_init(struct platfor
+@@ -1423,6 +1423,10 @@ static int airoha_hw_init(struct platfor
        if (err)
                return err;
  
index 069faaaf15d1ba16132942d07b9ef9c1622e5757..874b832c427789bbbc6d18339c9f0ebaf4642dc3 100644 (file)
@@ -16,7 +16,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
 
 --- a/drivers/net/ethernet/airoha/airoha_eth.c
 +++ b/drivers/net/ethernet/airoha/airoha_eth.c
-@@ -577,8 +577,11 @@ static int airoha_qdma_get_gdm_port(stru
+@@ -578,8 +578,11 @@ static int airoha_qdma_get_gdm_port(stru
  
        sport = FIELD_GET(QDMA_ETH_RXMSG_SPORT_MASK, msg1);
        switch (sport) {
index 7c4d4b17d50f6f7c615d65aef5925f9a7be77606..248aaa31a95866b85557ca3c4b8ef1970ec8e617 100644 (file)
@@ -28,7 +28,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
  
        airoha_fe_crsn_qsel_init(eth);
  
-@@ -1654,7 +1656,8 @@ static int airoha_dev_open(struct net_de
+@@ -1655,7 +1657,8 @@ static int airoha_dev_open(struct net_de
        if (err)
                return err;
  
index f5f1d06137a97e1dea07f22cb049891f5a9586b8..f5246dd01d2572347677594798ef1684a5533055 100644 (file)
@@ -15,7 +15,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
 
 --- a/drivers/net/ethernet/airoha/airoha_eth.c
 +++ b/drivers/net/ethernet/airoha/airoha_eth.c
-@@ -3125,7 +3125,6 @@ static void airoha_remove(struct platfor
+@@ -3126,7 +3126,6 @@ static void airoha_remove(struct platfor
  }
  
  static const char * const en7581_xsi_rsts_names[] = {
@@ -23,7 +23,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
        "hsi0-mac",
        "hsi1-mac",
        "hsi-mac",
-@@ -3179,7 +3178,6 @@ static u32 airoha_en7581_get_vip_port(st
+@@ -3180,7 +3179,6 @@ static u32 airoha_en7581_get_vip_port(st
  }
  
  static const char * const an7583_xsi_rsts_names[] = {
index 035311cda18b3ded8ca59e8d92eca2cc957beedf..9d23c58b2f0b48ca73ffaed7dc2dd9cce5f1f573 100644 (file)
@@ -35,7 +35,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
  static void airoha_set_macaddr(struct airoha_gdm_port *port, const u8 *addr)
  {
        struct airoha_eth *eth = port->qdma->eth;
-@@ -1651,6 +1657,17 @@ static int airoha_dev_open(struct net_de
+@@ -1652,6 +1658,17 @@ static int airoha_dev_open(struct net_de
        struct airoha_qdma *qdma = port->qdma;
        u32 pse_port = FE_PSE_PORT_PPE1;
  
@@ -53,7 +53,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
        netif_tx_start_all_queues(dev);
        err = airoha_set_vip_for_gdm_port(port, true);
        if (err)
-@@ -1715,6 +1732,11 @@ static int airoha_dev_stop(struct net_de
+@@ -1716,6 +1733,11 @@ static int airoha_dev_stop(struct net_de
                }
        }
  
@@ -65,7 +65,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
        return 0;
  }
  
-@@ -2845,6 +2867,20 @@ static const struct ethtool_ops airoha_e
+@@ -2846,6 +2868,20 @@ static const struct ethtool_ops airoha_e
        .get_link               = ethtool_op_get_link,
  };
  
@@ -86,7 +86,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
  static int airoha_metadata_dst_alloc(struct airoha_gdm_port *port)
  {
        int i;
-@@ -2889,6 +2925,99 @@ bool airoha_is_valid_gdm_port(struct air
+@@ -2890,6 +2926,99 @@ bool airoha_is_valid_gdm_port(struct air
        return false;
  }
  
@@ -186,7 +186,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
  static int airoha_alloc_gdm_port(struct airoha_eth *eth,
                                 struct device_node *np)
  {
-@@ -2962,6 +3091,12 @@ static int airoha_alloc_gdm_port(struct
+@@ -2963,6 +3092,12 @@ static int airoha_alloc_gdm_port(struct
        port->nbq = id == AIROHA_GDM3_IDX && airoha_is_7581(eth) ? 4 : 0;
        eth->ports[p] = port;
  
@@ -199,7 +199,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
        return airoha_metadata_dst_alloc(port);
  }
  
-@@ -3091,6 +3226,10 @@ error_napi_stop:
+@@ -3092,6 +3227,10 @@ error_napi_stop:
  
                if (port->dev->reg_state == NETREG_REGISTERED)
                        unregister_netdev(port->dev);
@@ -210,7 +210,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
                airoha_metadata_dst_free(port);
        }
        airoha_hw_cleanup(eth);
-@@ -3117,6 +3256,10 @@ static void airoha_remove(struct platfor
+@@ -3118,6 +3257,10 @@ static void airoha_remove(struct platfor
  
                unregister_netdev(port->dev);
                airoha_metadata_dst_free(port);
index 05e219a97f5b14f31e05d01edcb70f4fbe520a8b..5c354ad29272bb809818b0d84cfe8f114225427e 100644 (file)
@@ -14,7 +14,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
 
 --- a/drivers/net/ethernet/airoha/airoha_eth.c
 +++ b/drivers/net/ethernet/airoha/airoha_eth.c
-@@ -588,6 +588,9 @@ static int airoha_qdma_get_gdm_port(stru
+@@ -589,6 +589,9 @@ static int airoha_qdma_get_gdm_port(stru
        case 0x18:
                port = 3; /* GDM4 */
                break;
index 5bed5930496d3ab941431f2837a370b033c30a10..699b11c60e16fc3b859ee8ce19f6c887db07e37c 100644 (file)
@@ -28,7 +28,7 @@ Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
  
  static void airoha_set_macaddr(struct airoha_gdm_port *port, const u8 *addr)
  {
-@@ -1660,6 +1662,7 @@ static int airoha_dev_open(struct net_de
+@@ -1661,6 +1663,7 @@ static int airoha_dev_open(struct net_de
        struct airoha_qdma *qdma = port->qdma;
        u32 pse_port = FE_PSE_PORT_PPE1;
  
@@ -36,7 +36,7 @@ Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
        if (airhoa_is_phy_external(port)) {
                err = phylink_of_phy_connect(port->phylink, dev->dev.of_node, 0);
                if (err) {
-@@ -1670,6 +1673,7 @@ static int airoha_dev_open(struct net_de
+@@ -1671,6 +1674,7 @@ static int airoha_dev_open(struct net_de
  
                phylink_start(port->phylink);
        }
@@ -44,7 +44,7 @@ Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
  
        netif_tx_start_all_queues(dev);
        err = airoha_set_vip_for_gdm_port(port, true);
-@@ -1735,10 +1739,12 @@ static int airoha_dev_stop(struct net_de
+@@ -1736,10 +1740,12 @@ static int airoha_dev_stop(struct net_de
                }
        }
  
@@ -57,7 +57,7 @@ Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
  
        return 0;
  }
-@@ -2870,6 +2876,7 @@ static const struct ethtool_ops airoha_e
+@@ -2871,6 +2877,7 @@ static const struct ethtool_ops airoha_e
        .get_link               = ethtool_op_get_link,
  };
  
@@ -65,7 +65,7 @@ Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
  static struct phylink_pcs *airoha_phylink_mac_select_pcs(struct phylink_config *config,
                                                         phy_interface_t interface)
  {
-@@ -2883,6 +2890,7 @@ static void airoha_mac_config(struct phy
+@@ -2884,6 +2891,7 @@ static void airoha_mac_config(struct phy
                              const struct phylink_link_state *state)
  {
  }
@@ -73,7 +73,7 @@ Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
  
  static int airoha_metadata_dst_alloc(struct airoha_gdm_port *port)
  {
-@@ -2928,6 +2936,7 @@ bool airoha_is_valid_gdm_port(struct air
+@@ -2929,6 +2937,7 @@ bool airoha_is_valid_gdm_port(struct air
        return false;
  }
  
@@ -81,7 +81,7 @@ Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
  static void airoha_mac_link_up(struct phylink_config *config, struct phy_device *phy,
                               unsigned int mode, phy_interface_t interface,
                               int speed, int duplex, bool tx_pause, bool rx_pause)
-@@ -3020,6 +3029,7 @@ static int airoha_setup_phylink(struct n
+@@ -3021,6 +3030,7 @@ static int airoha_setup_phylink(struct n
  
        return 0;
  }
@@ -89,7 +89,7 @@ Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
  
  static int airoha_alloc_gdm_port(struct airoha_eth *eth,
                                 struct device_node *np)
-@@ -3094,11 +3104,13 @@ static int airoha_alloc_gdm_port(struct
+@@ -3095,11 +3105,13 @@ static int airoha_alloc_gdm_port(struct
        port->nbq = id == AIROHA_GDM3_IDX && airoha_is_7581(eth) ? 4 : 0;
        eth->ports[p] = port;
  
@@ -103,7 +103,7 @@ Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
  
        return airoha_metadata_dst_alloc(port);
  }
-@@ -3229,10 +3241,12 @@ error_napi_stop:
+@@ -3230,10 +3242,12 @@ error_napi_stop:
  
                if (port->dev->reg_state == NETREG_REGISTERED)
                        unregister_netdev(port->dev);
@@ -116,7 +116,7 @@ Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
                airoha_metadata_dst_free(port);
        }
        airoha_hw_cleanup(eth);
-@@ -3259,10 +3273,12 @@ static void airoha_remove(struct platfor
+@@ -3260,10 +3274,12 @@ static void airoha_remove(struct platfor
  
                unregister_netdev(port->dev);
                airoha_metadata_dst_free(port);