From d2722eadf2dd2ed385020eba141a7499bc35815d Mon Sep 17 00:00:00 2001 From: Christian Marangi Date: Wed, 15 Apr 2026 14:46:25 +0200 Subject: [PATCH] airoha: backport QDMA rx queue descriptor setup optimization Backport patch merged upstream that optimize the QDMA rx queue descriptor setup by configuring the CPU IDX only when needed. (cherry picked from commit 70ad03e0ac2d7c6d8597e13d74bbc057bb6fc17c) Link: https://github.com/openwrt/openwrt/pull/23046 Signed-off-by: Christian Marangi --- ...ypo-in-airoha_set_gdm2_loopback-rout.patch | 35 +++++++++++++++++++ ...EG_RX_CPU_IDX-once-in-airoha_qdma_fi.patch | 34 ++++++++++++++++++ ...-airoha-deassert-XSI-line-on-hw-init.patch | 2 +- ...eference-for-SPORT-GDM4-in-qdma_get_.patch | 2 +- ...nitial-fixup-for-GDM3-4-port-support.patch | 2 +- ...7-airoha-ethernet-drop-xsi-mac-reset.patch | 4 +-- ...iroha-add-phylink-support-for-GDM2-4.patch | 14 ++++---- ...t-airoha-define-sport-value-for-GDM3.patch | 2 +- ...le-external-phy-code-if-PCS_AIROHA-i.patch | 20 +++++------ 9 files changed, 92 insertions(+), 23 deletions(-) create mode 100644 target/linux/airoha/patches-6.12/143-v7.1-net-airoha-Fix-typo-in-airoha_set_gdm2_loopback-rout.patch create mode 100644 target/linux/airoha/patches-6.12/144-v7.1-net-airoha-Set-REG_RX_CPU_IDX-once-in-airoha_qdma_fi.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 index 0000000000..dcbc223ca1 --- /dev/null +++ b/target/linux/airoha/patches-6.12/143-v7.1-net-airoha-Fix-typo-in-airoha_set_gdm2_loopback-rout.patch @@ -0,0 +1,35 @@ +From a94ddc191f19579a7e0a5da2c012f1048ce10262 Mon Sep 17 00:00:00 2001 +From: Lorenzo Bianconi +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 +Link: https://patch.msgid.link/20260330-airoha_set_gdm2_loopback-fix-typo-v1-1-a1320ff6b6cc@kernel.org +Signed-off-by: Jakub Kicinski +--- + 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 index 0000000000..8a982330b2 --- /dev/null +++ b/target/linux/airoha/patches-6.12/144-v7.1-net-airoha-Set-REG_RX_CPU_IDX-once-in-airoha_qdma_fi.patch @@ -0,0 +1,34 @@ +From 269389ba539834ec80e4d55583fca2cd70e4dc9c Mon Sep 17 00:00:00 2001 +From: Lorenzo Bianconi +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 +Link: https://patch.msgid.link/20260331-airoha-cpu-idx-out-off-loop-v1-1-75c66b428f50@kernel.org +Signed-off-by: Paolo Abeni +--- + 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; + } diff --git a/target/linux/airoha/patches-6.12/310-02-net-airoha-deassert-XSI-line-on-hw-init.patch b/target/linux/airoha/patches-6.12/310-02-net-airoha-deassert-XSI-line-on-hw-init.patch index fa1c9e5669..6d5b7c5e95 100644 --- a/target/linux/airoha/patches-6.12/310-02-net-airoha-deassert-XSI-line-on-hw-init.patch +++ b/target/linux/airoha/patches-6.12/310-02-net-airoha-deassert-XSI-line-on-hw-init.patch @@ -13,7 +13,7 @@ Signed-off-by: Christian Marangi --- 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; diff --git a/target/linux/airoha/patches-6.12/310-03-net-airoha-add-reference-for-SPORT-GDM4-in-qdma_get_.patch b/target/linux/airoha/patches-6.12/310-03-net-airoha-add-reference-for-SPORT-GDM4-in-qdma_get_.patch index 069faaaf15..874b832c42 100644 --- a/target/linux/airoha/patches-6.12/310-03-net-airoha-add-reference-for-SPORT-GDM4-in-qdma_get_.patch +++ b/target/linux/airoha/patches-6.12/310-03-net-airoha-add-reference-for-SPORT-GDM4-in-qdma_get_.patch @@ -16,7 +16,7 @@ Signed-off-by: Christian Marangi --- 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) { diff --git a/target/linux/airoha/patches-6.12/310-06-net-airoha-add-initial-fixup-for-GDM3-4-port-support.patch b/target/linux/airoha/patches-6.12/310-06-net-airoha-add-initial-fixup-for-GDM3-4-port-support.patch index 7c4d4b17d5..248aaa31a9 100644 --- a/target/linux/airoha/patches-6.12/310-06-net-airoha-add-initial-fixup-for-GDM3-4-port-support.patch +++ b/target/linux/airoha/patches-6.12/310-06-net-airoha-add-initial-fixup-for-GDM3-4-port-support.patch @@ -28,7 +28,7 @@ Signed-off-by: Christian Marangi 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; diff --git a/target/linux/airoha/patches-6.12/310-07-airoha-ethernet-drop-xsi-mac-reset.patch b/target/linux/airoha/patches-6.12/310-07-airoha-ethernet-drop-xsi-mac-reset.patch index f5f1d06137..f5246dd01d 100644 --- a/target/linux/airoha/patches-6.12/310-07-airoha-ethernet-drop-xsi-mac-reset.patch +++ b/target/linux/airoha/patches-6.12/310-07-airoha-ethernet-drop-xsi-mac-reset.patch @@ -15,7 +15,7 @@ Signed-off-by: Christian Marangi --- 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 "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[] = { diff --git a/target/linux/airoha/patches-6.12/310-10-net-airoha-add-phylink-support-for-GDM2-4.patch b/target/linux/airoha/patches-6.12/310-10-net-airoha-add-phylink-support-for-GDM2-4.patch index 035311cda1..9d23c58b2f 100644 --- a/target/linux/airoha/patches-6.12/310-10-net-airoha-add-phylink-support-for-GDM2-4.patch +++ b/target/linux/airoha/patches-6.12/310-10-net-airoha-add-phylink-support-for-GDM2-4.patch @@ -35,7 +35,7 @@ Signed-off-by: Christian Marangi 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 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 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 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 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 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 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); diff --git a/target/linux/airoha/patches-6.12/604-02-net-ethernet-airoha-define-sport-value-for-GDM3.patch b/target/linux/airoha/patches-6.12/604-02-net-ethernet-airoha-define-sport-value-for-GDM3.patch index 05e219a97f..5c354ad292 100644 --- a/target/linux/airoha/patches-6.12/604-02-net-ethernet-airoha-define-sport-value-for-GDM3.patch +++ b/target/linux/airoha/patches-6.12/604-02-net-ethernet-airoha-define-sport-value-for-GDM3.patch @@ -14,7 +14,7 @@ Signed-off-by: Christian Marangi --- 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; diff --git a/target/linux/airoha/patches-6.12/606-net-airoha-disable-external-phy-code-if-PCS_AIROHA-i.patch b/target/linux/airoha/patches-6.12/606-net-airoha-disable-external-phy-code-if-PCS_AIROHA-i.patch index 5bed593049..699b11c60e 100644 --- a/target/linux/airoha/patches-6.12/606-net-airoha-disable-external-phy-code-if-PCS_AIROHA-i.patch +++ b/target/linux/airoha/patches-6.12/606-net-airoha-disable-external-phy-code-if-PCS_AIROHA-i.patch @@ -28,7 +28,7 @@ Signed-off-by: Mikhail Kshevetskiy 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 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 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 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 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 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 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 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 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 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);