Merge Official Source
Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org>
This commit is contained in:
+116
@@ -0,0 +1,116 @@
|
||||
From f4e661a75cdfa7eb88ac0fa832edd4a90775805d Mon Sep 17 00:00:00 2001
|
||||
From: Pawel Dembicki <paweldembicki@gmail.com>
|
||||
Date: Fri, 7 Nov 2025 23:05:56 +0100
|
||||
Subject: [PATCH] mwl8k: inject DS Params IE into beacons if missing
|
||||
|
||||
Some Marvell AP firmware used with mwl8k misbehaves when beacon frames
|
||||
do not contain a WLAN_EID_DS_PARAMS information element with the current
|
||||
channel. It was reported on OpenWrt Github issues [0].
|
||||
|
||||
When hostapd/mac80211 omits DS Params from the beacon (which is valid on
|
||||
some bands), the firmware stops transmitting sane frames and RX status
|
||||
starts reporting bogus channel information. This makes AP mode unusable.
|
||||
|
||||
Newer Marvell drivers (mwlwifi [1]) hard-code DS Params IE into AP beacons
|
||||
for all chips, which suggests this is a firmware requirement rather than
|
||||
a mwl8k-specific quirk.
|
||||
|
||||
Mirror that behaviour in mwl8k: when setting the beacon, check if
|
||||
WLAN_EID_DS_PARAMS is present, and if not, extend the beacon and inject
|
||||
a DS Params IE at the beginning of the IE list, using the current
|
||||
channel from hw->conf.chandef.chan.
|
||||
|
||||
Tested on Linksys EA4500 (88W8366).
|
||||
|
||||
[0] https://github.com/openwrt/openwrt/issues/19088
|
||||
[1] https://github.com/kaloz/mwlwifi/blob/db97edf20fadea2617805006f5230665fadc6a8c/hif/fwcmd.c#L675
|
||||
|
||||
Tested-by: Antony Kolitsos <zeusomighty@hotmail.com>
|
||||
Signed-off-by: Pawel Dembicki <paweldembicki@gmail.com>
|
||||
---
|
||||
drivers/net/wireless/marvell/mwl8k.c | 61 +++++++++++++++++++++++++---
|
||||
1 file changed, 56 insertions(+), 5 deletions(-)
|
||||
|
||||
--- a/drivers/net/wireless/marvell/mwl8k.c
|
||||
+++ b/drivers/net/wireless/marvell/mwl8k.c
|
||||
@@ -2966,6 +2966,42 @@ mwl8k_cmd_rf_antenna(struct ieee80211_hw
|
||||
/*
|
||||
* CMD_SET_BEACON.
|
||||
*/
|
||||
+
|
||||
+static bool mwl8k_beacon_has_ds_params(const u8 *buf, int len)
|
||||
+{
|
||||
+ const struct ieee80211_mgmt *mgmt = (const void *)buf;
|
||||
+ int ies_len;
|
||||
+
|
||||
+ if (len <= offsetof(struct ieee80211_mgmt, u.beacon.variable))
|
||||
+ return false;
|
||||
+
|
||||
+ ies_len = len - offsetof(struct ieee80211_mgmt, u.beacon.variable);
|
||||
+
|
||||
+ return cfg80211_find_ie(WLAN_EID_DS_PARAMS, mgmt->u.beacon.variable,
|
||||
+ ies_len) != NULL;
|
||||
+}
|
||||
+
|
||||
+static void mwl8k_beacon_copy_inject_ds_params(struct ieee80211_hw *hw,
|
||||
+ u8 *buf_dst, const u8 *buf_src,
|
||||
+ int src_len)
|
||||
+{
|
||||
+ const struct ieee80211_mgmt *mgmt = (const void *)buf_src;
|
||||
+ const u8 *ies;
|
||||
+ int hdr_len, left;
|
||||
+
|
||||
+ ies = mgmt->u.beacon.variable;
|
||||
+ hdr_len = ies - buf_src;
|
||||
+ left = src_len - hdr_len;
|
||||
+
|
||||
+ memcpy(buf_dst, buf_src, hdr_len);
|
||||
+
|
||||
+ /* Inject a DS Params IE at the beginning of the IE list */
|
||||
+ buf_dst[hdr_len + 0] = WLAN_EID_DS_PARAMS;
|
||||
+ buf_dst[hdr_len + 1] = 1;
|
||||
+ buf_dst[hdr_len + 2] = hw->conf.chandef.chan->hw_value;
|
||||
+
|
||||
+ memcpy(buf_dst + hdr_len + 3, buf_src + hdr_len, left);
|
||||
+}
|
||||
struct mwl8k_cmd_set_beacon {
|
||||
struct mwl8k_cmd_pkt_hdr header;
|
||||
__le16 beacon_len;
|
||||
@@ -2975,17 +3011,32 @@ struct mwl8k_cmd_set_beacon {
|
||||
static int mwl8k_cmd_set_beacon(struct ieee80211_hw *hw,
|
||||
struct ieee80211_vif *vif, u8 *beacon, int len)
|
||||
{
|
||||
+ bool ds_params_present = mwl8k_beacon_has_ds_params(beacon, len);
|
||||
struct mwl8k_cmd_set_beacon *cmd;
|
||||
- int rc;
|
||||
+ int rc, final_len = len;
|
||||
+
|
||||
+ if (!ds_params_present)
|
||||
+ /*
|
||||
+ * mwl8k firmware requires a DS Params IE with the current
|
||||
+ * channel in AP beacons. If mac80211/hostapd does not
|
||||
+ * include it, inject one here. IE ID + length + channel
|
||||
+ * number = 3 bytes.
|
||||
+ */
|
||||
+ final_len += 3;
|
||||
|
||||
- cmd = kzalloc(sizeof(*cmd) + len, GFP_KERNEL);
|
||||
+ cmd = kzalloc(sizeof(*cmd) + final_len, GFP_KERNEL);
|
||||
if (cmd == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
cmd->header.code = cpu_to_le16(MWL8K_CMD_SET_BEACON);
|
||||
- cmd->header.length = cpu_to_le16(sizeof(*cmd) + len);
|
||||
- cmd->beacon_len = cpu_to_le16(len);
|
||||
- memcpy(cmd->beacon, beacon, len);
|
||||
+ cmd->header.length = cpu_to_le16(sizeof(*cmd) + final_len);
|
||||
+ cmd->beacon_len = cpu_to_le16(final_len);
|
||||
+
|
||||
+ if (ds_params_present)
|
||||
+ memcpy(cmd->beacon, beacon, len);
|
||||
+ else
|
||||
+ mwl8k_beacon_copy_inject_ds_params(hw, cmd->beacon, beacon,
|
||||
+ len);
|
||||
|
||||
rc = mwl8k_post_pervif_cmd(hw, vif, &cmd->header);
|
||||
kfree(cmd);
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/drivers/net/wireless/marvell/mwl8k.c
|
||||
+++ b/drivers/net/wireless/marvell/mwl8k.c
|
||||
@@ -5716,6 +5716,7 @@ MODULE_FIRMWARE("mwl8k/fmimage_8366.fw")
|
||||
@@ -5767,6 +5767,7 @@ MODULE_FIRMWARE("mwl8k/fmimage_8366.fw")
|
||||
MODULE_FIRMWARE(MWL8K_8366_AP_FW(MWL8K_8366_AP_FW_API));
|
||||
|
||||
static const struct pci_device_id mwl8k_pci_id_table[] = {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/drivers/net/wireless/marvell/mwl8k.c
|
||||
+++ b/drivers/net/wireless/marvell/mwl8k.c
|
||||
@@ -6302,6 +6302,8 @@ static int mwl8k_probe(struct pci_dev *p
|
||||
@@ -6353,6 +6353,8 @@ static int mwl8k_probe(struct pci_dev *p
|
||||
|
||||
priv->running_bsses = 0;
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
return rc;
|
||||
|
||||
err_stop_firmware:
|
||||
@@ -6335,8 +6337,6 @@ static void mwl8k_remove(struct pci_dev
|
||||
@@ -6386,8 +6388,6 @@ static void mwl8k_remove(struct pci_dev
|
||||
return;
|
||||
priv = hw->priv;
|
||||
|
||||
|
||||
@@ -3,14 +3,14 @@ include $(TOPDIR)/rules.mk
|
||||
PKG_NAME:=mt76
|
||||
PKG_RELEASE=1
|
||||
|
||||
PKG_LICENSE:=GPLv2
|
||||
PKG_LICENSE:=BSD-3-Clause-Clear
|
||||
PKG_LICENSE_FILES:=
|
||||
|
||||
PKG_SOURCE_URL:=https://github.com/openwrt/mt76
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_DATE:=2025-09-15
|
||||
PKG_SOURCE_VERSION:=6467af3bcf1154c2ceb032c903d533f0c718bbc2
|
||||
PKG_MIRROR_HASH:=98781ea57cdc97bc63ecb2c1d4004964f2a10663987887445f1c71b76610cd96
|
||||
PKG_SOURCE_DATE:=2025-11-06
|
||||
PKG_SOURCE_VERSION:=eb567bc7f9b692bbf1ddfe31dd740861c58ec85b
|
||||
PKG_MIRROR_HASH:=7cfe242a5494cdf5d8e8eea86633778a525717528bcce70aedef96eee5594383
|
||||
|
||||
PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
|
||||
PKG_USE_NINJA:=0
|
||||
@@ -497,6 +497,12 @@ ifdef CONFIG_PACKAGE_kmod-mt7921e
|
||||
endif
|
||||
ifdef CONFIG_PACKAGE_kmod-mt7996e
|
||||
PKG_MAKE_FLAGS += CONFIG_MT7996E=m
|
||||
ifdef CONFIG_TARGET_airoha_an7581
|
||||
PKG_MAKE_FLAGS += CONFIG_MT76_NPU=y
|
||||
PKG_MAKE_FLAGS += CONFIG_MT7996_NPU=y
|
||||
NOSTDINC_FLAGS += -DCONFIG_MT76_NPU
|
||||
NOSTDINC_FLAGS += -DCONFIG_MT7996_NPU
|
||||
endif
|
||||
endif
|
||||
ifdef CONFIG_PACKAGE_kmod-mt7925-common
|
||||
PKG_MAKE_FLAGS += CONFIG_MT7925_COMMON=m
|
||||
|
||||
+79
@@ -0,0 +1,79 @@
|
||||
From: Lorenzo Bianconi <lorenzo@kernel.org>
|
||||
Date: Wed, 8 Oct 2025 12:41:48 +0200
|
||||
Subject: [PATCH] wifi: mt76: wed: use proper wed reference in mt76 wed driver
|
||||
callabacks
|
||||
|
||||
MT7996 driver can use both wed and wed_hif2 devices to offload traffic
|
||||
from/to the wireless NIC. In the current codebase we assume to always
|
||||
use the primary wed device in wed callbacks resulting in the following
|
||||
crash if the hw runs wed_hif2 (e.g. 6GHz link).
|
||||
|
||||
[ 297.455876] Unable to handle kernel read from unreadable memory at virtual address 000000000000080a
|
||||
[ 297.464928] Mem abort info:
|
||||
[ 297.467722] ESR = 0x0000000096000005
|
||||
[ 297.471461] EC = 0x25: DABT (current EL), IL = 32 bits
|
||||
[ 297.476766] SET = 0, FnV = 0
|
||||
[ 297.479809] EA = 0, S1PTW = 0
|
||||
[ 297.482940] FSC = 0x05: level 1 translation fault
|
||||
[ 297.487809] Data abort info:
|
||||
[ 297.490679] ISV = 0, ISS = 0x00000005, ISS2 = 0x00000000
|
||||
[ 297.496156] CM = 0, WnR = 0, TnD = 0, TagAccess = 0
|
||||
[ 297.501196] GCS = 0, Overlay = 0, DirtyBit = 0, Xs = 0
|
||||
[ 297.506500] user pgtable: 4k pages, 39-bit VAs, pgdp=0000000107480000
|
||||
[ 297.512927] [000000000000080a] pgd=08000001097fb003, p4d=08000001097fb003, pud=08000001097fb003, pmd=0000000000000000
|
||||
[ 297.523532] Internal error: Oops: 0000000096000005 [#1] SMP
|
||||
[ 297.715393] CPU: 2 UID: 0 PID: 45 Comm: kworker/u16:2 Tainted: G O 6.12.50 #0
|
||||
[ 297.723908] Tainted: [O]=OOT_MODULE
|
||||
[ 297.727384] Hardware name: Banana Pi BPI-R4 (2x SFP+) (DT)
|
||||
[ 297.732857] Workqueue: nf_ft_offload_del nf_flow_rule_route_ipv6 [nf_flow_table]
|
||||
[ 297.740254] pstate: 60400005 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
|
||||
[ 297.747205] pc : mt76_wed_offload_disable+0x64/0xa0 [mt76]
|
||||
[ 297.752688] lr : mtk_wed_flow_remove+0x58/0x80
|
||||
[ 297.757126] sp : ffffffc080fe3ae0
|
||||
[ 297.760430] x29: ffffffc080fe3ae0 x28: ffffffc080fe3be0 x27: 00000000deadbef7
|
||||
[ 297.767557] x26: ffffff80c5ebca00 x25: 0000000000000001 x24: ffffff80c85f4c00
|
||||
[ 297.774683] x23: ffffff80c1875b78 x22: ffffffc080d42cd0 x21: ffffffc080660018
|
||||
[ 297.781809] x20: ffffff80c6a076d0 x19: ffffff80c6a043c8 x18: 0000000000000000
|
||||
[ 297.788935] x17: 0000000000000000 x16: 0000000000000001 x15: 0000000000000000
|
||||
[ 297.796060] x14: 0000000000000019 x13: ffffff80c0ad8ec0 x12: 00000000fa83b2da
|
||||
[ 297.803185] x11: ffffff80c02700c0 x10: ffffff80c0ad8ec0 x9 : ffffff81fef96200
|
||||
[ 297.810311] x8 : ffffff80c02700c0 x7 : ffffff80c02700d0 x6 : 0000000000000002
|
||||
[ 297.817435] x5 : 0000000000000400 x4 : 0000000000000000 x3 : 0000000000000000
|
||||
[ 297.824561] x2 : 0000000000000001 x1 : 0000000000000800 x0 : ffffff80c6a063c8
|
||||
[ 297.831686] Call trace:
|
||||
[ 297.834123] mt76_wed_offload_disable+0x64/0xa0 [mt76]
|
||||
[ 297.839254] mtk_wed_flow_remove+0x58/0x80
|
||||
[ 297.843342] mtk_flow_offload_cmd+0x434/0x574
|
||||
[ 297.847689] mtk_wed_setup_tc_block_cb+0x30/0x40
|
||||
[ 297.852295] nf_flow_offload_ipv6_hook+0x7f4/0x964 [nf_flow_table]
|
||||
[ 297.858466] nf_flow_rule_route_ipv6+0x438/0x4a4 [nf_flow_table]
|
||||
[ 297.864463] process_one_work+0x174/0x300
|
||||
[ 297.868465] worker_thread+0x278/0x430
|
||||
[ 297.872204] kthread+0xd8/0xdc
|
||||
[ 297.875251] ret_from_fork+0x10/0x20
|
||||
[ 297.878820] Code: 928b5ae0 8b000273 91400a60 f943fa61 (79401421)
|
||||
[ 297.884901] ---[ end trace 0000000000000000 ]---
|
||||
|
||||
Fix the issue detecting the proper wed reference to use running wed
|
||||
callabacks.
|
||||
|
||||
-- Partial backport for data structure change only (rest is in the mt76 package)
|
||||
|
||||
Fixes: 83eafc9251d6 ("wifi: mt76: mt7996: add wed tx support")
|
||||
Tested-by: Daniel Pawlik <pawlik.dan@gmail.com>
|
||||
Tested-by: Matteo Croce <teknoraver@meta.com>
|
||||
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
|
||||
Link: https://patch.msgid.link/20251008-wed-fixes-v1-1-8f7678583385@kernel.org
|
||||
Signed-off-by: Felix Fietkau <nbd@nbd.name>
|
||||
---
|
||||
|
||||
--- a/include/linux/soc/mediatek/mtk_wed.h
|
||||
+++ b/include/linux/soc/mediatek/mtk_wed.h
|
||||
@@ -154,6 +154,7 @@ struct mtk_wed_device {
|
||||
bool wcid_512;
|
||||
bool hw_rro;
|
||||
bool msi;
|
||||
+ bool hif2;
|
||||
|
||||
u16 token_start;
|
||||
unsigned int nbuf;
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
From: Rex Lu <rex.lu@mediatek.com>
|
||||
Date: Thu, 9 Oct 2025 08:29:34 +0200
|
||||
Subject: [PATCH] net: mtk: wed: add dma mask limitation and GFP_DMA32 for
|
||||
device with more than 4GB DRAM
|
||||
|
||||
Limit tx/rx buffer address to 32-bit address space for board with more
|
||||
than 4GB DRAM.
|
||||
|
||||
Fixes: 804775dfc2885 ("net: ethernet: mtk_eth_soc: add support for Wireless Ethernet Dispatch (WED)")
|
||||
Fixes: 6757d345dd7db ("net: ethernet: mtk_wed: introduce hw_rro support for MT7988")
|
||||
Tested-by: Daniel Pawlik <pawlik.dan@gmail.com>
|
||||
Tested-by: Matteo Croce <teknoraver@meta.com>
|
||||
Signed-off-by: Rex Lu <rex.lu@mediatek.com>
|
||||
Co-developed-by: Lorenzo Bianconi <lorenzo@kernel.org>
|
||||
Signed-off-by: Lorenzo Bianconi <lorenzo@kernel.org>
|
||||
Reviewed-by: Simon Horman <horms@kernel.org>
|
||||
Signed-off-by: David S. Miller <davem@davemloft.net>
|
||||
---
|
||||
|
||||
--- a/drivers/net/ethernet/mediatek/mtk_wed.c
|
||||
+++ b/drivers/net/ethernet/mediatek/mtk_wed.c
|
||||
@@ -677,7 +677,7 @@ mtk_wed_tx_buffer_alloc(struct mtk_wed_d
|
||||
void *buf;
|
||||
int s;
|
||||
|
||||
- page = __dev_alloc_page(GFP_KERNEL);
|
||||
+ page = __dev_alloc_page(GFP_KERNEL | GFP_DMA32);
|
||||
if (!page)
|
||||
return -ENOMEM;
|
||||
|
||||
@@ -800,7 +800,7 @@ mtk_wed_hwrro_buffer_alloc(struct mtk_we
|
||||
struct page *page;
|
||||
int s;
|
||||
|
||||
- page = __dev_alloc_page(GFP_KERNEL);
|
||||
+ page = __dev_alloc_page(GFP_KERNEL | GFP_DMA32);
|
||||
if (!page)
|
||||
return -ENOMEM;
|
||||
|
||||
@@ -2438,6 +2438,10 @@ mtk_wed_attach(struct mtk_wed_device *de
|
||||
dev->version = hw->version;
|
||||
dev->hw->pcie_base = mtk_wed_get_pcie_base(dev);
|
||||
|
||||
+ ret = dma_set_mask_and_coherent(hw->dev, DMA_BIT_MASK(32));
|
||||
+ if (ret)
|
||||
+ goto out;
|
||||
+
|
||||
if (hw->eth->dma_dev == hw->eth->dev &&
|
||||
of_dma_is_coherent(hw->eth->dev->of_node))
|
||||
mtk_eth_set_dma_device(hw->eth, hw->dev);
|
||||
Reference in New Issue
Block a user