Skip to content

Commit d2722ea

Browse files
committed
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 70ad03e) Link: openwrt/openwrt#23046 Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
1 parent 919361f commit d2722ea

9 files changed

Lines changed: 92 additions & 23 deletions
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
From a94ddc191f19579a7e0a5da2c012f1048ce10262 Mon Sep 17 00:00:00 2001
2+
From: Lorenzo Bianconi <lorenzo@kernel.org>
3+
Date: Mon, 30 Mar 2026 00:03:49 +0200
4+
Subject: [PATCH] net: airoha: Fix typo in airoha_set_gdm2_loopback routine
5+
name
6+
7+
Rename airhoha_set_gdm2_loopback() in airoha_set_gdm2_loopback()
8+
9+
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
10+
Link: https://patch.msgid.link/20260330-airoha_set_gdm2_loopback-fix-typo-v1-1-a1320ff6b6cc@kernel.org
11+
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
12+
---
13+
drivers/net/ethernet/airoha/airoha_eth.c | 4 ++--
14+
1 file changed, 2 insertions(+), 2 deletions(-)
15+
16+
--- a/drivers/net/ethernet/airoha/airoha_eth.c
17+
+++ b/drivers/net/ethernet/airoha/airoha_eth.c
18+
@@ -1722,7 +1722,7 @@ static int airoha_dev_set_macaddr(struct
19+
return 0;
20+
}
21+
22+
-static int airhoha_set_gdm2_loopback(struct airoha_gdm_port *port)
23+
+static int airoha_set_gdm2_loopback(struct airoha_gdm_port *port)
24+
{
25+
struct airoha_eth *eth = port->qdma->eth;
26+
u32 val, pse_port, chan;
27+
@@ -1796,7 +1796,7 @@ static int airoha_dev_init(struct net_de
28+
if (!eth->ports[1]) {
29+
int err;
30+
31+
- err = airhoha_set_gdm2_loopback(port);
32+
+ err = airoha_set_gdm2_loopback(port);
33+
if (err)
34+
return err;
35+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
From 269389ba539834ec80e4d55583fca2cd70e4dc9c Mon Sep 17 00:00:00 2001
2+
From: Lorenzo Bianconi <lorenzo@kernel.org>
3+
Date: Tue, 31 Mar 2026 12:33:24 +0200
4+
Subject: [PATCH] net: airoha: Set REG_RX_CPU_IDX() once in
5+
airoha_qdma_fill_rx_queue()
6+
7+
It is not necessary to update REG_RX_CPU_IDX register for each iteration
8+
of the descriptor loop in airoha_qdma_fill_rx_queue routine.
9+
Move REG_RX_CPU_IDX configuration out of the descriptor loop and rely on
10+
the last queue head value updated in the descriptor loop.
11+
12+
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
13+
Link: https://patch.msgid.link/20260331-airoha-cpu-idx-out-off-loop-v1-1-75c66b428f50@kernel.org
14+
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
15+
---
16+
drivers/net/ethernet/airoha/airoha_eth.c | 3 ++-
17+
1 file changed, 2 insertions(+), 1 deletion(-)
18+
19+
--- a/drivers/net/ethernet/airoha/airoha_eth.c
20+
+++ b/drivers/net/ethernet/airoha/airoha_eth.c
21+
@@ -561,11 +561,12 @@ static int airoha_qdma_fill_rx_queue(str
22+
WRITE_ONCE(desc->msg1, 0);
23+
WRITE_ONCE(desc->msg2, 0);
24+
WRITE_ONCE(desc->msg3, 0);
25+
+ }
26+
27+
+ if (nframes)
28+
airoha_qdma_rmw(qdma, REG_RX_CPU_IDX(qid),
29+
RX_RING_CPU_IDX_MASK,
30+
FIELD_PREP(RX_RING_CPU_IDX_MASK, q->head));
31+
- }
32+
33+
return nframes;
34+
}

target/linux/airoha/patches-6.12/310-02-net-airoha-deassert-XSI-line-on-hw-init.patch

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
1313

1414
--- a/drivers/net/ethernet/airoha/airoha_eth.c
1515
+++ b/drivers/net/ethernet/airoha/airoha_eth.c
16-
@@ -1422,6 +1422,10 @@ static int airoha_hw_init(struct platfor
16+
@@ -1423,6 +1423,10 @@ static int airoha_hw_init(struct platfor
1717
if (err)
1818
return err;
1919

target/linux/airoha/patches-6.12/310-03-net-airoha-add-reference-for-SPORT-GDM4-in-qdma_get_.patch

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
1616

1717
--- a/drivers/net/ethernet/airoha/airoha_eth.c
1818
+++ b/drivers/net/ethernet/airoha/airoha_eth.c
19-
@@ -577,8 +577,11 @@ static int airoha_qdma_get_gdm_port(stru
19+
@@ -578,8 +578,11 @@ static int airoha_qdma_get_gdm_port(stru
2020

2121
sport = FIELD_GET(QDMA_ETH_RXMSG_SPORT_MASK, msg1);
2222
switch (sport) {

target/linux/airoha/patches-6.12/310-06-net-airoha-add-initial-fixup-for-GDM3-4-port-support.patch

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
2828

2929
airoha_fe_crsn_qsel_init(eth);
3030

31-
@@ -1654,7 +1656,8 @@ static int airoha_dev_open(struct net_de
31+
@@ -1655,7 +1657,8 @@ static int airoha_dev_open(struct net_de
3232
if (err)
3333
return err;
3434

target/linux/airoha/patches-6.12/310-07-airoha-ethernet-drop-xsi-mac-reset.patch

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
1515

1616
--- a/drivers/net/ethernet/airoha/airoha_eth.c
1717
+++ b/drivers/net/ethernet/airoha/airoha_eth.c
18-
@@ -3125,7 +3125,6 @@ static void airoha_remove(struct platfor
18+
@@ -3126,7 +3126,6 @@ static void airoha_remove(struct platfor
1919
}
2020

2121
static const char * const en7581_xsi_rsts_names[] = {
2222
- "xsi-mac",
2323
"hsi0-mac",
2424
"hsi1-mac",
2525
"hsi-mac",
26-
@@ -3179,7 +3178,6 @@ static u32 airoha_en7581_get_vip_port(st
26+
@@ -3180,7 +3179,6 @@ static u32 airoha_en7581_get_vip_port(st
2727
}
2828

2929
static const char * const an7583_xsi_rsts_names[] = {

target/linux/airoha/patches-6.12/310-10-net-airoha-add-phylink-support-for-GDM2-4.patch

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
3535
static void airoha_set_macaddr(struct airoha_gdm_port *port, const u8 *addr)
3636
{
3737
struct airoha_eth *eth = port->qdma->eth;
38-
@@ -1651,6 +1657,17 @@ static int airoha_dev_open(struct net_de
38+
@@ -1652,6 +1658,17 @@ static int airoha_dev_open(struct net_de
3939
struct airoha_qdma *qdma = port->qdma;
4040
u32 pse_port = FE_PSE_PORT_PPE1;
4141

@@ -53,7 +53,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
5353
netif_tx_start_all_queues(dev);
5454
err = airoha_set_vip_for_gdm_port(port, true);
5555
if (err)
56-
@@ -1715,6 +1732,11 @@ static int airoha_dev_stop(struct net_de
56+
@@ -1716,6 +1733,11 @@ static int airoha_dev_stop(struct net_de
5757
}
5858
}
5959

@@ -65,7 +65,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
6565
return 0;
6666
}
6767

68-
@@ -2845,6 +2867,20 @@ static const struct ethtool_ops airoha_e
68+
@@ -2846,6 +2868,20 @@ static const struct ethtool_ops airoha_e
6969
.get_link = ethtool_op_get_link,
7070
};
7171

@@ -86,7 +86,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
8686
static int airoha_metadata_dst_alloc(struct airoha_gdm_port *port)
8787
{
8888
int i;
89-
@@ -2889,6 +2925,99 @@ bool airoha_is_valid_gdm_port(struct air
89+
@@ -2890,6 +2926,99 @@ bool airoha_is_valid_gdm_port(struct air
9090
return false;
9191
}
9292

@@ -186,7 +186,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
186186
static int airoha_alloc_gdm_port(struct airoha_eth *eth,
187187
struct device_node *np)
188188
{
189-
@@ -2962,6 +3091,12 @@ static int airoha_alloc_gdm_port(struct
189+
@@ -2963,6 +3092,12 @@ static int airoha_alloc_gdm_port(struct
190190
port->nbq = id == AIROHA_GDM3_IDX && airoha_is_7581(eth) ? 4 : 0;
191191
eth->ports[p] = port;
192192

@@ -199,7 +199,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
199199
return airoha_metadata_dst_alloc(port);
200200
}
201201

202-
@@ -3091,6 +3226,10 @@ error_napi_stop:
202+
@@ -3092,6 +3227,10 @@ error_napi_stop:
203203

204204
if (port->dev->reg_state == NETREG_REGISTERED)
205205
unregister_netdev(port->dev);
@@ -210,7 +210,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
210210
airoha_metadata_dst_free(port);
211211
}
212212
airoha_hw_cleanup(eth);
213-
@@ -3117,6 +3256,10 @@ static void airoha_remove(struct platfor
213+
@@ -3118,6 +3257,10 @@ static void airoha_remove(struct platfor
214214

215215
unregister_netdev(port->dev);
216216
airoha_metadata_dst_free(port);

target/linux/airoha/patches-6.12/604-02-net-ethernet-airoha-define-sport-value-for-GDM3.patch

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
1414

1515
--- a/drivers/net/ethernet/airoha/airoha_eth.c
1616
+++ b/drivers/net/ethernet/airoha/airoha_eth.c
17-
@@ -588,6 +588,9 @@ static int airoha_qdma_get_gdm_port(stru
17+
@@ -589,6 +589,9 @@ static int airoha_qdma_get_gdm_port(stru
1818
case 0x18:
1919
port = 3; /* GDM4 */
2020
break;

target/linux/airoha/patches-6.12/606-net-airoha-disable-external-phy-code-if-PCS_AIROHA-i.patch

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,23 +28,23 @@ Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
2828

2929
static void airoha_set_macaddr(struct airoha_gdm_port *port, const u8 *addr)
3030
{
31-
@@ -1660,6 +1662,7 @@ static int airoha_dev_open(struct net_de
31+
@@ -1661,6 +1663,7 @@ static int airoha_dev_open(struct net_de
3232
struct airoha_qdma *qdma = port->qdma;
3333
u32 pse_port = FE_PSE_PORT_PPE1;
3434

3535
+#if defined(CONFIG_PCS_AIROHA)
3636
if (airhoa_is_phy_external(port)) {
3737
err = phylink_of_phy_connect(port->phylink, dev->dev.of_node, 0);
3838
if (err) {
39-
@@ -1670,6 +1673,7 @@ static int airoha_dev_open(struct net_de
39+
@@ -1671,6 +1674,7 @@ static int airoha_dev_open(struct net_de
4040

4141
phylink_start(port->phylink);
4242
}
4343
+#endif
4444

4545
netif_tx_start_all_queues(dev);
4646
err = airoha_set_vip_for_gdm_port(port, true);
47-
@@ -1735,10 +1739,12 @@ static int airoha_dev_stop(struct net_de
47+
@@ -1736,10 +1740,12 @@ static int airoha_dev_stop(struct net_de
4848
}
4949
}
5050

@@ -57,39 +57,39 @@ Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
5757

5858
return 0;
5959
}
60-
@@ -2870,6 +2876,7 @@ static const struct ethtool_ops airoha_e
60+
@@ -2871,6 +2877,7 @@ static const struct ethtool_ops airoha_e
6161
.get_link = ethtool_op_get_link,
6262
};
6363

6464
+#if defined(CONFIG_PCS_AIROHA)
6565
static struct phylink_pcs *airoha_phylink_mac_select_pcs(struct phylink_config *config,
6666
phy_interface_t interface)
6767
{
68-
@@ -2883,6 +2890,7 @@ static void airoha_mac_config(struct phy
68+
@@ -2884,6 +2891,7 @@ static void airoha_mac_config(struct phy
6969
const struct phylink_link_state *state)
7070
{
7171
}
7272
+#endif
7373

7474
static int airoha_metadata_dst_alloc(struct airoha_gdm_port *port)
7575
{
76-
@@ -2928,6 +2936,7 @@ bool airoha_is_valid_gdm_port(struct air
76+
@@ -2929,6 +2937,7 @@ bool airoha_is_valid_gdm_port(struct air
7777
return false;
7878
}
7979

8080
+#if defined(CONFIG_PCS_AIROHA)
8181
static void airoha_mac_link_up(struct phylink_config *config, struct phy_device *phy,
8282
unsigned int mode, phy_interface_t interface,
8383
int speed, int duplex, bool tx_pause, bool rx_pause)
84-
@@ -3020,6 +3029,7 @@ static int airoha_setup_phylink(struct n
84+
@@ -3021,6 +3030,7 @@ static int airoha_setup_phylink(struct n
8585

8686
return 0;
8787
}
8888
+#endif
8989

9090
static int airoha_alloc_gdm_port(struct airoha_eth *eth,
9191
struct device_node *np)
92-
@@ -3094,11 +3104,13 @@ static int airoha_alloc_gdm_port(struct
92+
@@ -3095,11 +3105,13 @@ static int airoha_alloc_gdm_port(struct
9393
port->nbq = id == AIROHA_GDM3_IDX && airoha_is_7581(eth) ? 4 : 0;
9494
eth->ports[p] = port;
9595

@@ -103,7 +103,7 @@ Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
103103

104104
return airoha_metadata_dst_alloc(port);
105105
}
106-
@@ -3229,10 +3241,12 @@ error_napi_stop:
106+
@@ -3230,10 +3242,12 @@ error_napi_stop:
107107

108108
if (port->dev->reg_state == NETREG_REGISTERED)
109109
unregister_netdev(port->dev);
@@ -116,7 +116,7 @@ Signed-off-by: Mikhail Kshevetskiy <mikhail.kshevetskiy@iopsys.eu>
116116
airoha_metadata_dst_free(port);
117117
}
118118
airoha_hw_cleanup(eth);
119-
@@ -3259,10 +3273,12 @@ static void airoha_remove(struct platfor
119+
@@ -3260,10 +3274,12 @@ static void airoha_remove(struct platfor
120120

121121
unregister_netdev(port->dev);
122122
airoha_metadata_dst_free(port);

0 commit comments

Comments
 (0)