Skip to content

Commit a9e2245

Browse files
stklcodehauke
authored andcommitted
mwlwifi: add patch series for kernel 6.18 compatibility
Migrate timer handling (removed in 6.13) and netdev dummy initialization (removed in 6.16) to new methods with guards to not break older kernels. This resolves compilation errors due to missing del_timer_sync(), from_timer() and init_dummy_netdev(). Signed-off-by: Stefan Kalscheuer <stefan@stklcode.de> Link: openwrt/openwrt#22775 Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
1 parent f48ef00 commit a9e2245

2 files changed

Lines changed: 109 additions & 0 deletions

File tree

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
From 4bdd4f2a21f830e5987b6dbdbadb389b7f0c12bd Mon Sep 17 00:00:00 2001
2+
From: Stefan Kalscheuer <stefan@stklcode.de>
3+
Date: Fri, 3 Apr 2026 14:17:02 +0200
4+
Subject: [PATCH] fix timer handling kernel >= 6.13
5+
6+
Switch periodic timer shutdown to timer_shutdown_sync() on kernel 6.13
7+
and newer, as del_timer_sync() is no longer available to use. The new
8+
call prevents re-arming the timer after shutdown which should be desired
9+
behavior in this case.
10+
11+
Replace from_timer() with timer_container_of() for kernel 6.16.
12+
13+
Signed-off-by: Stefan Kalscheuer <stefan@stklcode.de>
14+
---
15+
core.c | 8 ++++++++
16+
1 file changed, 8 insertions(+)
17+
18+
--- a/core.c
19+
+++ b/core.c
20+
@@ -738,7 +738,11 @@ static irqreturn_t mwl_isr(int irq, void
21+
#ifdef timer_setup
22+
static void timer_routine(struct timer_list *t)
23+
{
24+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6,16,0)
25+
struct mwl_priv *priv = from_timer(priv, t, period_timer);
26+
+#else
27+
+ struct mwl_priv *priv = timer_container_of(priv, t, period_timer);
28+
+#endif
29+
struct ieee80211_hw *hw = priv->hw;
30+
#else
31+
static void timer_routine(unsigned long data)
32+
@@ -975,7 +979,11 @@ static void mwl_wl_deinit(struct mwl_pri
33+
{
34+
struct ieee80211_hw *hw = priv->hw;
35+
36+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6,13,0)
37+
del_timer_sync(&priv->period_timer);
38+
+#else
39+
+ timer_shutdown_sync(&priv->period_timer);
40+
+#endif
41+
42+
if (priv->irq != -1) {
43+
free_irq(priv->irq, hw);
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
From 835f385dbf3a47727181e73063a433e5c7113eca Mon Sep 17 00:00:00 2001
2+
From: Stefan Kalscheuer <stefan@stklcode.de>
3+
Date: Fri, 3 Apr 2026 16:52:44 +0200
4+
Subject: [PATCH] replace init_dummy_netdev() with alloc_netdev_dummy() for
5+
kernel 6.14+
6+
7+
init_dummy_netdev() was removed in kernel 6.14. Un-embed the net_device
8+
from the private struct by converting it into a pointer and use
9+
alloc_netdev_dummy() for initialization of the dummy device.
10+
11+
Signed-off-by: Stefan Kalscheuer <stefan@stklcode.de>
12+
---
13+
hif/pcie/dev.h | 4 ++++
14+
hif/pcie/pcie.c | 17 +++++++++++++++--
15+
2 files changed, 19 insertions(+), 2 deletions(-)
16+
17+
--- a/hif/pcie/dev.h
18+
+++ b/hif/pcie/dev.h
19+
@@ -583,7 +583,11 @@ struct pcie_priv {
20+
struct tasklet_struct tx_task;
21+
struct tasklet_struct tx_done_task;
22+
/* NAPI */
23+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6,14,0)
24+
struct net_device napi_dev;
25+
+#else
26+
+ struct net_device *napi_dev;
27+
+#endif
28+
struct napi_struct napi;
29+
struct tasklet_struct rx_task;
30+
unsigned int tx_head_room;
31+
--- a/hif/pcie/pcie.c
32+
+++ b/hif/pcie/pcie.c
33+
@@ -215,9 +215,15 @@ static int pcie_init_8997(struct ieee802
34+
(void *)pcie_8997_tx_done_task, (unsigned long)hw);
35+
tasklet_disable(&pcie_priv->tx_done_task);
36+
spin_lock_init(&pcie_priv->tx_desc_lock);
37+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6,15,0)
38+
init_dummy_netdev(&pcie_priv->napi_dev);
39+
- netif_napi_add(&pcie_priv->napi_dev, &pcie_priv->napi,
40+
- pcie_8997_poll_napi);
41+
+ netif_napi_add(&pcie_priv->napi_dev, &pcie_priv->napi, pcie_8997_poll_napi);
42+
+#else
43+
+ pcie_priv->napi_dev = alloc_netdev_dummy(0);
44+
+ if (!pcie_priv->napi_dev)
45+
+ return -ENOMEM;
46+
+ netif_napi_add(pcie_priv->napi_dev, &pcie_priv->napi, pcie_8997_poll_napi);
47+
+#endif
48+
pcie_priv->txq_limit = PCIE_TX_QUEUE_LIMIT;
49+
pcie_priv->txq_wake_threshold = PCIE_TX_WAKE_Q_THRESHOLD;
50+
pcie_priv->recv_limit = PCIE_RECEIVE_LIMIT;
51+
@@ -310,8 +316,15 @@ static int pcie_init_8864(struct ieee802
52+
tasklet_init(&pcie_priv->tx_done_task, (void *)pcie_8864_tx_done_task, (unsigned long)hw);
53+
tasklet_disable(&pcie_priv->tx_done_task);
54+
spin_lock_init(&pcie_priv->tx_desc_lock);
55+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(6,14,0)
56+
init_dummy_netdev(&pcie_priv->napi_dev);
57+
netif_napi_add(&pcie_priv->napi_dev, &pcie_priv->napi, pcie_8864_poll_napi);
58+
+#else
59+
+ pcie_priv->napi_dev = alloc_netdev_dummy(0);
60+
+ if (!pcie_priv->napi_dev)
61+
+ return -ENOMEM;
62+
+ netif_napi_add(pcie_priv->napi_dev, &pcie_priv->napi, pcie_8864_poll_napi);
63+
+#endif
64+
pcie_priv->txq_limit = PCIE_TX_QUEUE_LIMIT;
65+
pcie_priv->txq_wake_threshold = PCIE_TX_WAKE_Q_THRESHOLD;
66+
pcie_priv->recv_limit = PCIE_RECEIVE_LIMIT;

0 commit comments

Comments
 (0)