blob: c05b086074580bbc61947950cf674717f3ca6c64 [file] [log] [blame]
From de4d3e25a555dedd70793d0362b1e501ed1a77f1 Mon Sep 17 00:00:00 2001
From: Benjamin Lin <benjamin-jw.lin@mediatek.com>
Date: Tue, 30 Apr 2024 10:28:29 +0800
Subject: [PATCH] mac80211: mtk: fix inconsistent QoS mapping between AP and
AP_VLAN VIFs
Fix inconsistent QoS mapping between AP and AP_VLAN IFs.
Specifically, when WDS AP IF is connected by a WDS STA, the QoS map of the AP_VLAN VIF is NULL.
So the QoS types of packets to the WDS STA will be determined using the default mapping rule.
However, SoftMAC driver uses the QoS map of the AP VIF, which may already be set.
Therefore, it is possible that the QoS mappings of SW and HW are inconsistent.
Thus, sync QoS map of AP VIF to that of AP_VLAN VIF.
Signed-off-by: Benjamin Lin <benjamin-jw.lin@mediatek.com>
---
net/mac80211/iface.c | 23 ++++++++++++++++++++++-
1 file changed, 22 insertions(+), 1 deletion(-)
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
index ef32d53..138ad79 100644
--- a/net/mac80211/iface.c
+++ b/net/mac80211/iface.c
@@ -297,8 +297,29 @@ static int ieee80211_check_concurrent_iface(struct ieee80211_sub_if_data *sdata,
* can only add VLANs to enabled APs
*/
if (iftype == NL80211_IFTYPE_AP_VLAN &&
- nsdata->vif.type == NL80211_IFTYPE_AP)
+ nsdata->vif.type == NL80211_IFTYPE_AP) {
+ struct mac80211_qos_map *old_qos_map, *new_qos_map = NULL;
+
sdata->bss = &nsdata->u.ap;
+
+ rcu_read_lock();
+ old_qos_map = rcu_dereference(nsdata->qos_map);
+ if (old_qos_map) {
+ new_qos_map = kzalloc(sizeof(*new_qos_map), GFP_KERNEL);
+ if (!new_qos_map) {
+ rcu_read_unlock();
+ return -ENOMEM;
+ }
+ memcpy(&new_qos_map->qos_map, &old_qos_map->qos_map,
+ sizeof(new_qos_map->qos_map));
+ }
+ rcu_read_unlock();
+
+ old_qos_map = sdata_dereference(sdata->qos_map, sdata);
+ rcu_assign_pointer(sdata->qos_map, new_qos_map);
+ if (old_qos_map)
+ kfree_rcu(old_qos_map, rcu_head);
+ }
}
}
--
2.18.0