Skip to content

Commit c685890

Browse files
LorenzoBianconiAnsuel
authored andcommitted
airoha: backport some missing airoha_eth upstream patches
Backport more upstream patch to include all the fixes pushed upstream and add all the preliminary patch for multi-serdes support. While at it also move 2 patch in the 6xx numbering to the 000-1xx backport numbering to keep things tidy. All the affected patch manually and automatically refreshed. Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org> [ add comment, renumber patch, add more patch, fix PCS patch ] Link: openwrt/openwrt#22479 (cherry picked from commit c5a8ddd) Link: openwrt/openwrt#22820 Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
1 parent 2c8fff4 commit c685890

21 files changed

Lines changed: 1004 additions & 56 deletions
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
From a7fc8c641cab855824c45e5e8877e40fd528b5df Mon Sep 17 00:00:00 2001
2+
From: Lorenzo Bianconi <lorenzo@kernel.org>
3+
Date: Fri, 2 Jan 2026 12:29:38 +0100
4+
Subject: [PATCH] net: airoha: Fix npu rx DMA definitions
5+
6+
Fix typos in npu rx DMA descriptor definitions.
7+
8+
Fixes: b3ef7bdec66fb ("net: airoha: Add airoha_offload.h header")
9+
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
10+
Link: https://patch.msgid.link/20260102-airoha-npu-dma-rx-def-fixes-v1-1-205fc6bf7d94@kernel.org
11+
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
12+
---
13+
include/linux/soc/airoha/airoha_offload.h | 8 ++++----
14+
1 file changed, 4 insertions(+), 4 deletions(-)
15+
16+
--- a/include/linux/soc/airoha/airoha_offload.h
17+
+++ b/include/linux/soc/airoha/airoha_offload.h
18+
@@ -71,12 +71,12 @@ static inline void airoha_ppe_dev_check_
19+
#define NPU_RX1_DESC_NUM 512
20+
21+
/* CTRL */
22+
-#define NPU_RX_DMA_DESC_LAST_MASK BIT(29)
23+
-#define NPU_RX_DMA_DESC_LEN_MASK GENMASK(28, 15)
24+
-#define NPU_RX_DMA_DESC_CUR_LEN_MASK GENMASK(14, 1)
25+
+#define NPU_RX_DMA_DESC_LAST_MASK BIT(27)
26+
+#define NPU_RX_DMA_DESC_LEN_MASK GENMASK(26, 14)
27+
+#define NPU_RX_DMA_DESC_CUR_LEN_MASK GENMASK(13, 1)
28+
#define NPU_RX_DMA_DESC_DONE_MASK BIT(0)
29+
/* INFO */
30+
-#define NPU_RX_DMA_PKT_COUNT_MASK GENMASK(31, 28)
31+
+#define NPU_RX_DMA_PKT_COUNT_MASK GENMASK(31, 29)
32+
#define NPU_RX_DMA_PKT_ID_MASK GENMASK(28, 26)
33+
#define NPU_RX_DMA_SRC_PORT_MASK GENMASK(25, 21)
34+
#define NPU_RX_DMA_CRSN_MASK GENMASK(20, 16)
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
From 5e7365b5a1ac8f517a7a84442289d7de242deb76 Mon Sep 17 00:00:00 2001
2+
From: Lorenzo Bianconi <lorenzo@kernel.org>
3+
Date: Sun, 14 Dec 2025 10:30:07 +0100
4+
Subject: [PATCH] net: airoha: Move net_devs registration in a dedicated
5+
routine
6+
7+
Since airoha_probe() is not executed under rtnl lock, there is small race
8+
where a given device is configured by user-space while the remaining ones
9+
are not completely loaded from the dts yet. This condition will allow a
10+
hw device misconfiguration since there are some conditions (e.g. GDM2 check
11+
in airoha_dev_init()) that require all device are properly loaded from the
12+
device tree. Fix the issue moving net_devices registration at the end of
13+
the airoha_probe routine.
14+
15+
Fixes: 9cd451d414f6e ("net: airoha: Add loopback support for GDM2")
16+
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
17+
Reviewed-by: Simon Horman <horms@kernel.org>
18+
Link: https://patch.msgid.link/20251214-airoha-fix-dev-registration-v1-1-860e027ad4c6@kernel.org
19+
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
20+
---
21+
drivers/net/ethernet/airoha/airoha_eth.c | 39 ++++++++++++++++--------
22+
1 file changed, 26 insertions(+), 13 deletions(-)
23+
24+
--- a/drivers/net/ethernet/airoha/airoha_eth.c
25+
+++ b/drivers/net/ethernet/airoha/airoha_eth.c
26+
@@ -2924,19 +2924,26 @@ static int airoha_alloc_gdm_port(struct
27+
port->id = id;
28+
eth->ports[p] = port;
29+
30+
- err = airoha_metadata_dst_alloc(port);
31+
- if (err)
32+
- return err;
33+
+ return airoha_metadata_dst_alloc(port);
34+
+}
35+
36+
- err = register_netdev(dev);
37+
- if (err)
38+
- goto free_metadata_dst;
39+
+static int airoha_register_gdm_devices(struct airoha_eth *eth)
40+
+{
41+
+ int i;
42+
43+
- return 0;
44+
+ for (i = 0; i < ARRAY_SIZE(eth->ports); i++) {
45+
+ struct airoha_gdm_port *port = eth->ports[i];
46+
+ int err;
47+
+
48+
+ if (!port)
49+
+ continue;
50+
+
51+
+ err = register_netdev(port->dev);
52+
+ if (err)
53+
+ return err;
54+
+ }
55+
56+
-free_metadata_dst:
57+
- airoha_metadata_dst_free(port);
58+
- return err;
59+
+ return 0;
60+
}
61+
62+
static int airoha_probe(struct platform_device *pdev)
63+
@@ -3027,6 +3034,10 @@ static int airoha_probe(struct platform_
64+
}
65+
}
66+
67+
+ err = airoha_register_gdm_devices(eth);
68+
+ if (err)
69+
+ goto error_napi_stop;
70+
+
71+
return 0;
72+
73+
error_napi_stop:
74+
@@ -3040,10 +3051,12 @@ error_hw_cleanup:
75+
for (i = 0; i < ARRAY_SIZE(eth->ports); i++) {
76+
struct airoha_gdm_port *port = eth->ports[i];
77+
78+
- if (port && port->dev->reg_state == NETREG_REGISTERED) {
79+
+ if (!port)
80+
+ continue;
81+
+
82+
+ if (port->dev->reg_state == NETREG_REGISTERED)
83+
unregister_netdev(port->dev);
84+
- airoha_metadata_dst_free(port);
85+
- }
86+
+ airoha_metadata_dst_free(port);
87+
}
88+
free_netdev(eth->napi_dev);
89+
platform_set_drvdata(pdev, NULL);
Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
From 4d513329b87c1bd0546d9f0288794e244322daa6 Mon Sep 17 00:00:00 2001
2+
From: Lorenzo Bianconi <lorenzo@kernel.org>
3+
Date: Mon, 5 Jan 2026 10:40:47 +0100
4+
Subject: [PATCH] net: airoha: Use gdm port enum value whenever possible
5+
6+
Use AIROHA_GDMx_IDX enum value whenever possible.
7+
This patch is just cosmetic changes and does not introduce any logic one.
8+
9+
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
10+
Link: https://patch.msgid.link/20260105-airoha-use-port-idx-enum-v1-1-503ca5763858@kernel.org
11+
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
12+
---
13+
drivers/net/ethernet/airoha/airoha_eth.c | 40 +++++++++++++-----------
14+
1 file changed, 21 insertions(+), 19 deletions(-)
15+
16+
--- a/drivers/net/ethernet/airoha/airoha_eth.c
17+
+++ b/drivers/net/ethernet/airoha/airoha_eth.c
18+
@@ -108,11 +108,11 @@ static int airoha_set_vip_for_gdm_port(s
19+
u32 vip_port;
20+
21+
switch (port->id) {
22+
- case 3:
23+
+ case AIROHA_GDM3_IDX:
24+
/* FIXME: handle XSI_PCIE1_PORT */
25+
vip_port = XSI_PCIE0_VIP_PORT_MASK;
26+
break;
27+
- case 4:
28+
+ case AIROHA_GDM4_IDX:
29+
/* FIXME: handle XSI_USB_PORT */
30+
vip_port = XSI_ETH_VIP_PORT_MASK;
31+
break;
32+
@@ -514,8 +514,8 @@ static int airoha_fe_init(struct airoha_
33+
FIELD_PREP(IP_ASSEMBLE_PORT_MASK, 0) |
34+
FIELD_PREP(IP_ASSEMBLE_NBQ_MASK, 22));
35+
36+
- airoha_fe_set(eth, REG_GDM_FWD_CFG(3), GDM_PAD_EN_MASK);
37+
- airoha_fe_set(eth, REG_GDM_FWD_CFG(4), GDM_PAD_EN_MASK);
38+
+ airoha_fe_set(eth, REG_GDM_FWD_CFG(AIROHA_GDM3_IDX), GDM_PAD_EN_MASK);
39+
+ airoha_fe_set(eth, REG_GDM_FWD_CFG(AIROHA_GDM4_IDX), GDM_PAD_EN_MASK);
40+
41+
airoha_fe_crsn_qsel_init(eth);
42+
43+
@@ -1690,27 +1690,29 @@ static int airhoha_set_gdm2_loopback(str
44+
/* Forward the traffic to the proper GDM port */
45+
pse_port = port->id == AIROHA_GDM3_IDX ? FE_PSE_PORT_GDM3
46+
: FE_PSE_PORT_GDM4;
47+
- airoha_set_gdm_port_fwd_cfg(eth, REG_GDM_FWD_CFG(2), pse_port);
48+
- airoha_fe_clear(eth, REG_GDM_FWD_CFG(2), GDM_STRIP_CRC_MASK);
49+
+ airoha_set_gdm_port_fwd_cfg(eth, REG_GDM_FWD_CFG(AIROHA_GDM2_IDX),
50+
+ pse_port);
51+
+ airoha_fe_clear(eth, REG_GDM_FWD_CFG(AIROHA_GDM2_IDX),
52+
+ GDM_STRIP_CRC_MASK);
53+
54+
/* Enable GDM2 loopback */
55+
- airoha_fe_wr(eth, REG_GDM_TXCHN_EN(2), 0xffffffff);
56+
- airoha_fe_wr(eth, REG_GDM_RXCHN_EN(2), 0xffff);
57+
+ airoha_fe_wr(eth, REG_GDM_TXCHN_EN(AIROHA_GDM2_IDX), 0xffffffff);
58+
+ airoha_fe_wr(eth, REG_GDM_RXCHN_EN(AIROHA_GDM2_IDX), 0xffff);
59+
60+
chan = port->id == AIROHA_GDM3_IDX ? airoha_is_7581(eth) ? 4 : 3 : 0;
61+
- airoha_fe_rmw(eth, REG_GDM_LPBK_CFG(2),
62+
+ airoha_fe_rmw(eth, REG_GDM_LPBK_CFG(AIROHA_GDM2_IDX),
63+
LPBK_CHAN_MASK | LPBK_MODE_MASK | LPBK_EN_MASK,
64+
FIELD_PREP(LPBK_CHAN_MASK, chan) |
65+
LBK_GAP_MODE_MASK | LBK_LEN_MODE_MASK |
66+
LBK_CHAN_MODE_MASK | LPBK_EN_MASK);
67+
- airoha_fe_rmw(eth, REG_GDM_LEN_CFG(2),
68+
+ airoha_fe_rmw(eth, REG_GDM_LEN_CFG(AIROHA_GDM2_IDX),
69+
GDM_SHORT_LEN_MASK | GDM_LONG_LEN_MASK,
70+
FIELD_PREP(GDM_SHORT_LEN_MASK, 60) |
71+
FIELD_PREP(GDM_LONG_LEN_MASK, AIROHA_MAX_MTU));
72+
73+
/* Disable VIP and IFC for GDM2 */
74+
- airoha_fe_clear(eth, REG_FE_VIP_PORT_EN, BIT(2));
75+
- airoha_fe_clear(eth, REG_FE_IFC_PORT_EN, BIT(2));
76+
+ airoha_fe_clear(eth, REG_FE_VIP_PORT_EN, BIT(AIROHA_GDM2_IDX));
77+
+ airoha_fe_clear(eth, REG_FE_IFC_PORT_EN, BIT(AIROHA_GDM2_IDX));
78+
79+
/* XXX: handle XSI_USB_PORT and XSI_PCE1_PORT */
80+
nbq = port->id == AIROHA_GDM3_IDX && airoha_is_7581(eth) ? 4 : 0;
81+
@@ -1746,8 +1748,8 @@ static int airoha_dev_init(struct net_de
82+
airoha_set_macaddr(port, dev->dev_addr);
83+
84+
switch (port->id) {
85+
- case 3:
86+
- case 4:
87+
+ case AIROHA_GDM3_IDX:
88+
+ case AIROHA_GDM4_IDX:
89+
/* If GDM2 is active we can't enable loopback */
90+
if (!eth->ports[1]) {
91+
int err;
92+
@@ -1757,7 +1759,7 @@ static int airoha_dev_init(struct net_de
93+
return err;
94+
}
95+
fallthrough;
96+
- case 2:
97+
+ case AIROHA_GDM2_IDX:
98+
if (airoha_ppe_is_enabled(eth, 1)) {
99+
/* For PPE2 always use secondary cpu port. */
100+
fe_cpu_port = FE_PSE_PORT_CDM2;
101+
@@ -3101,14 +3103,14 @@ static const char * const en7581_xsi_rst
102+
static int airoha_en7581_get_src_port_id(struct airoha_gdm_port *port, int nbq)
103+
{
104+
switch (port->id) {
105+
- case 3:
106+
+ case AIROHA_GDM3_IDX:
107+
/* 7581 SoC supports PCIe serdes on GDM3 port */
108+
if (nbq == 4)
109+
return HSGMII_LAN_7581_PCIE0_SRCPORT;
110+
if (nbq == 5)
111+
return HSGMII_LAN_7581_PCIE1_SRCPORT;
112+
break;
113+
- case 4:
114+
+ case AIROHA_GDM4_IDX:
115+
/* 7581 SoC supports eth and usb serdes on GDM4 port */
116+
if (!nbq)
117+
return HSGMII_LAN_7581_ETH_SRCPORT;
118+
@@ -3132,12 +3134,12 @@ static const char * const an7583_xsi_rst
119+
static int airoha_an7583_get_src_port_id(struct airoha_gdm_port *port, int nbq)
120+
{
121+
switch (port->id) {
122+
- case 3:
123+
+ case AIROHA_GDM3_IDX:
124+
/* 7583 SoC supports eth serdes on GDM3 port */
125+
if (!nbq)
126+
return HSGMII_LAN_7583_ETH_SRCPORT;
127+
break;
128+
- case 4:
129+
+ case AIROHA_GDM4_IDX:
130+
/* 7583 SoC supports PCIe and USB serdes on GDM4 port */
131+
if (!nbq)
132+
return HSGMII_LAN_7583_PCIE_SRCPORT;
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
From e4bc5dd53bf5d46cd58f081ffccc3809e2be5373 Mon Sep 17 00:00:00 2001
2+
From: Lorenzo Bianconi <lorenzo@kernel.org>
3+
Date: Mon, 5 Jan 2026 09:49:16 +0100
4+
Subject: [PATCH] net: airoha: npu: Dump fw version during probe
5+
6+
Dump firmware version running on the npu during module probe.
7+
8+
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
9+
Link: https://patch.msgid.link/20260105-airoha-npu-dump-fw-v1-1-36d8326975f8@kernel.org
10+
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
11+
---
12+
drivers/net/ethernet/airoha/airoha_npu.c | 6 ++++++
13+
1 file changed, 6 insertions(+)
14+
15+
--- a/drivers/net/ethernet/airoha/airoha_npu.c
16+
+++ b/drivers/net/ethernet/airoha/airoha_npu.c
17+
@@ -658,6 +658,7 @@ static int airoha_npu_probe(struct platf
18+
struct device_node *np;
19+
void __iomem *base;
20+
int i, irq, err;
21+
+ u32 val;
22+
23+
base = devm_platform_ioremap_resource(pdev, 0);
24+
if (IS_ERR(base))
25+
@@ -757,6 +758,11 @@ static int airoha_npu_probe(struct platf
26+
regmap_write(npu->regmap, REG_CR_BOOT_TRIGGER, 0x1);
27+
msleep(100);
28+
29+
+ if (!airoha_npu_wlan_msg_get(npu, 0, WLAN_FUNC_GET_WAIT_NPU_VERSION,
30+
+ &val, sizeof(val), GFP_KERNEL))
31+
+ dev_info(dev, "NPU fw version: %0d.%d\n",
32+
+ (val >> 16) & 0xffff, val & 0xffff);
33+
+
34+
platform_set_drvdata(pdev, npu);
35+
36+
return 0;
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
From 6abcf751bc084804a9e5b3051442e8a2ce67f48a Mon Sep 17 00:00:00 2001
2+
From: Lorenzo Bianconi <lorenzo@kernel.org>
3+
Date: Mon, 5 Jan 2026 09:43:31 +0100
4+
Subject: [PATCH] net: airoha: Fix schedule while atomic in airoha_ppe_deinit()
5+
6+
airoha_ppe_deinit() runs airoha_npu_ppe_deinit() in atomic context.
7+
airoha_npu_ppe_deinit routine allocates ppe_data buffer with GFP_KERNEL
8+
flag. Rely on rcu_replace_pointer in airoha_ppe_deinit routine in order
9+
to fix schedule while atomic issue in airoha_npu_ppe_deinit() since we
10+
do not need atomic context there.
11+
12+
Fixes: 00a7678310fe3 ("net: airoha: Introduce flowtable offload support")
13+
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
14+
Link: https://patch.msgid.link/20260105-airoha-fw-ethtool-v2-1-3b32b158cc31@kernel.org
15+
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
16+
---
17+
drivers/net/ethernet/airoha/airoha_ppe.c | 9 ++++++---
18+
1 file changed, 6 insertions(+), 3 deletions(-)
19+
20+
--- a/drivers/net/ethernet/airoha/airoha_ppe.c
21+
+++ b/drivers/net/ethernet/airoha/airoha_ppe.c
22+
@@ -1547,13 +1547,16 @@ void airoha_ppe_deinit(struct airoha_eth
23+
{
24+
struct airoha_npu *npu;
25+
26+
- rcu_read_lock();
27+
- npu = rcu_dereference(eth->npu);
28+
+ mutex_lock(&flow_offload_mutex);
29+
+
30+
+ npu = rcu_replace_pointer(eth->npu, NULL,
31+
+ lockdep_is_held(&flow_offload_mutex));
32+
if (npu) {
33+
npu->ops.ppe_deinit(npu);
34+
airoha_npu_put(npu);
35+
}
36+
- rcu_read_unlock();
37+
+
38+
+ mutex_unlock(&flow_offload_mutex);
39+
40+
rhashtable_destroy(&eth->ppe->l2_flows);
41+
rhashtable_destroy(&eth->flow_table);

target/linux/airoha/patches-6.12/611-v7.0-net-airoha-implement-get_link_ksettings.patch renamed to target/linux/airoha/patches-6.12/120-v7.0-net-airoha-implement-get_link_ksettings.patch

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Signed-off-by: Paolo Abeni <pabeni@redhat.com>
1616

1717
--- a/drivers/net/ethernet/airoha/airoha_eth.c
1818
+++ b/drivers/net/ethernet/airoha/airoha_eth.c
19-
@@ -2844,6 +2844,7 @@ static const struct ethtool_ops airoha_e
19+
@@ -2805,6 +2805,7 @@ static const struct ethtool_ops airoha_e
2020
.get_drvinfo = airoha_ethtool_get_drvinfo,
2121
.get_eth_mac_stats = airoha_ethtool_get_mac_stats,
2222
.get_rmon_stats = airoha_ethtool_get_rmon_stats,
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
From 875a59c9a9e584d99d8e9e5aa8435ec9300bfe91 Mon Sep 17 00:00:00 2001
2+
From: Lorenzo Bianconi <lorenzo@kernel.org>
3+
Date: Thu, 8 Jan 2026 16:05:08 +0100
4+
Subject: [PATCH] net: airoha: npu: Init BA memory region if provided via DTS
5+
6+
Initialize NPU Block Ack memory region if reserved via DTS.
7+
Block Ack memory region is used by NPU MT7996 (Eagle) offloading.
8+
9+
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
10+
Link: https://patch.msgid.link/20260108-airoha-ba-memory-region-v3-2-bf1814e5dcc4@kernel.org
11+
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
12+
---
13+
drivers/net/ethernet/airoha/airoha_npu.c | 8 ++++++++
14+
1 file changed, 8 insertions(+)
15+
16+
--- a/drivers/net/ethernet/airoha/airoha_npu.c
17+
+++ b/drivers/net/ethernet/airoha/airoha_npu.c
18+
@@ -519,6 +519,14 @@ static int airoha_npu_wlan_init_memory(s
19+
if (err)
20+
return err;
21+
22+
+ if (of_property_match_string(npu->dev->of_node, "memory-region-names",
23+
+ "ba") >= 0) {
24+
+ cmd = WLAN_FUNC_SET_WAIT_DRAM_BA_NODE_ADDR;
25+
+ err = airoha_npu_wlan_set_reserved_memory(npu, 0, "ba", cmd);
26+
+ if (err)
27+
+ return err;
28+
+ }
29+
+
30+
cmd = WLAN_FUNC_SET_WAIT_IS_FORCE_TO_CPU;
31+
return airoha_npu_wlan_msg_send(npu, 0, cmd, &val, sizeof(val),
32+
GFP_KERNEL);

0 commit comments

Comments
 (0)