mac80211: update patches

Signed-off-by: Arif Alam <arif.alam@netexperience.com>
This commit is contained in:
Arif Alam
2025-07-30 01:30:44 -04:00
parent 7f5f4ccad0
commit 26b61bbdd9
11 changed files with 510 additions and 136 deletions

View File

@@ -1,15 +1,15 @@
From 5c8d90efe02c47ce76a6d5383ea6aa90eb0c73d8 Mon Sep 17 00:00:00 2001
From 991886a6f8840802d611e0f75e79aa4ec5e68ccc Mon Sep 17 00:00:00 2001
From: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
Date: Mon, 20 Feb 2023 14:25:24 +0800
Subject: [PATCH] mac80211: mtk: add sta-assisted DFS state update mechanism
Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
---
include/net/cfg80211.h | 14 +++++++++
include/uapi/linux/nl80211.h | 6 ++++
net/mac80211/mlme.c | 11 +++++++
net/wireless/chan.c | 60 ++++++++++++++++++++++++++++++++++++
4 files changed, 91 insertions(+)
include/net/cfg80211.h | 14 ++++++
include/uapi/linux/nl80211.h | 6 +++
net/mac80211/mlme.c | 11 +++++
net/wireless/chan.c | 92 ++++++++++++++++++++++++++++++++++++
4 files changed, 123 insertions(+)
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 77276db..03f072f 100644
@@ -97,7 +97,7 @@ index 8ee325a..2dbc18c 100644
drv_event_callback(sdata->local, sdata, &event);
sdata_info(sdata, "associated\n");
diff --git a/net/wireless/chan.c b/net/wireless/chan.c
index c217276..9f651f9 100644
index c217276..f48995c 100644
--- a/net/wireless/chan.c
+++ b/net/wireless/chan.c
@@ -14,6 +14,7 @@
@@ -108,7 +108,7 @@ index c217276..9f651f9 100644
static bool cfg80211_valid_60g_freq(u32 freq)
{
@@ -1393,3 +1394,62 @@ bool cfg80211_any_usable_channels(struct wiphy *wiphy,
@@ -1393,3 +1394,94 @@ bool cfg80211_any_usable_channels(struct wiphy *wiphy,
return false;
}
EXPORT_SYMBOL(cfg80211_any_usable_channels);
@@ -133,26 +133,29 @@ index c217276..9f651f9 100644
+ const struct cfg80211_chan_def *csa_chandef,
+ bool associated)
+{
+ struct wiphy *wiphy = wdev->wiphy;
+ bool csa_active = !!csa_chandef;
+ enum nl80211_dfs_state dfs_state = NL80211_DFS_USABLE;
+ enum nl80211_radar_event event = NL80211_RADAR_STA_CAC_EXPIRED;
+
+ ASSERT_WDEV_LOCK(wdev);
+
+ if (!bss_chandef)
+ return;
+
+ /* assume csa channel is cac completed */
+ if (csa_active &&
+ (cfg80211_chandef_dfs_usable(wdev->wiphy, csa_chandef) ||
+ cfg80211_chandef_dfs_available(wdev->wiphy, csa_chandef))) {
+ cfg80211_set_dfs_state(wdev->wiphy, csa_chandef, NL80211_DFS_AVAILABLE);
+ cfg80211_sta_radar_notify(wdev->wiphy, csa_chandef,
+ (cfg80211_chandef_dfs_usable(wiphy, csa_chandef) ||
+ cfg80211_chandef_dfs_available(wiphy, csa_chandef))) {
+ cfg80211_set_dfs_state(wiphy, csa_chandef, NL80211_DFS_AVAILABLE);
+ cfg80211_sta_radar_notify(wiphy, csa_chandef,
+ NL80211_RADAR_STA_CAC_SKIPPED);
+ netdev_info(wdev->netdev, "Set CSA channel's DFS state to available\n");
+ }
+
+ /* avoid updating the dfs state during nop */
+ if (!cfg80211_chandef_dfs_usable(wdev->wiphy, bss_chandef) &&
+ !cfg80211_chandef_dfs_available(wdev->wiphy, bss_chandef))
+ if (!cfg80211_chandef_dfs_usable(wiphy, bss_chandef) &&
+ !cfg80211_chandef_dfs_available(wiphy, bss_chandef))
+ return;
+
+ if (associated && !csa_active) {
@@ -160,8 +163,37 @@ index c217276..9f651f9 100644
+ event = NL80211_RADAR_STA_CAC_SKIPPED;
+ }
+
+ cfg80211_set_dfs_state(wdev->wiphy, bss_chandef, dfs_state);
+ cfg80211_sta_radar_notify(wdev->wiphy, bss_chandef, event);
+ /* avoid setting the dfs state to usable
+ * when other interfaces still operate on this channel
+ */
+ if (dfs_state == NL80211_DFS_USABLE) {
+ struct wireless_dev *tmp_wdev;
+
+ if (cfg80211_offchan_chain_is_active(wiphy_to_rdev(wiphy),
+ bss_chandef->chan))
+ return;
+
+ list_for_each_entry(tmp_wdev, &wiphy->wdev_list, list) {
+ /* avoid ABBA deadlock between two stations */
+ if (tmp_wdev->iftype == NL80211_IFTYPE_STATION)
+ continue;
+
+ wdev_lock(tmp_wdev);
+ if (!cfg80211_beaconing_iface_active(tmp_wdev)) {
+ wdev_unlock(tmp_wdev);
+ continue;
+ }
+
+ if (cfg80211_is_sub_chan(&tmp_wdev->chandef, bss_chandef->chan)) {
+ wdev_unlock(tmp_wdev);
+ return;
+ }
+ wdev_unlock(tmp_wdev);
+ }
+ }
+
+ cfg80211_set_dfs_state(wiphy, bss_chandef, dfs_state);
+ cfg80211_sta_radar_notify(wiphy, bss_chandef, event);
+
+ if (csa_active)
+ netdev_info(wdev->netdev, "Set origin channel's DFS state to usable\n");

View File

@@ -1,4 +1,4 @@
From bb918e40dcc7d082f898234cf29cd545de78621e Mon Sep 17 00:00:00 2001
From 70526aabf704d778796dfbaa042fe48e03aa7d61 Mon Sep 17 00:00:00 2001
From: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
Date: Wed, 15 Nov 2023 15:05:17 +0800
Subject: [PATCH] mac80211: mtk: add DFS CAC countdown in CSA flow
@@ -10,11 +10,11 @@ Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
net/mac80211/ieee80211_i.h | 2 +
net/mac80211/iface.c | 2 +
net/mac80211/mlme.c | 6 ++-
net/mac80211/util.c | 11 ++++-
net/mac80211/util.c | 16 +++++++-
net/wireless/chan.c | 72 ++++++++++++++++++++++++++++++++
net/wireless/nl80211.c | 5 ++-
net/wireless/rdev-ops.h | 17 ++++++++
9 files changed, 221 insertions(+), 10 deletions(-)
9 files changed, 226 insertions(+), 10 deletions(-)
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 03f072f..a443b0d 100644
@@ -272,16 +272,21 @@ index 2dbc18c..ed81ebf 100644
NL80211_RADAR_CAC_FINISHED,
GFP_KERNEL);
diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index 26cd627..e07fe73 100644
index 26cd627..1e8420d 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -3873,7 +3873,16 @@ void ieee80211_dfs_cac_cancel(struct ieee80211_local *local)
@@ -3873,7 +3873,21 @@ void ieee80211_dfs_cac_cancel(struct ieee80211_local *local)
if (sdata->wdev.cac_started) {
chandef = sdata->vif.bss_conf.chandef;
- ieee80211_vif_release_channel(sdata);
+ if (sdata->vif.csa_active) {
+ sdata->vif.csa_active = false;
+ if (sdata->csa_block_tx) {
+ ieee80211_wake_vif_queues(local, sdata,
+ IEEE80211_QUEUE_STOP_REASON_CSA);
+ sdata->csa_block_tx = false;
+ }
+ if (sdata->u.ap.next_beacon) {
+ kfree(sdata->u.ap.next_beacon->mbssid_ies);
+ kfree(sdata->u.ap.next_beacon);
@@ -294,7 +299,7 @@ index 26cd627..e07fe73 100644
&chandef,
NL80211_RADAR_CAC_ABORTED,
diff --git a/net/wireless/chan.c b/net/wireless/chan.c
index 9f651f9..f02598b 100644
index f48995c..c7bfa6b 100644
--- a/net/wireless/chan.c
+++ b/net/wireless/chan.c
@@ -1262,6 +1262,78 @@ bool cfg80211_reg_can_beacon_relax(struct wiphy *wiphy,

View File

@@ -1,19 +1,21 @@
From 08661908d4c2fb5f8d7ca00e0e7e6b33a6ae6e31 Mon Sep 17 00:00:00 2001
From b43f0f6528bff00b4fbb25e0cbb9ac88577d1467 Mon Sep 17 00:00:00 2001
From: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
Date: Wed, 27 Dec 2023 14:26:22 +0800
Subject: [PATCH] mac80211: mtk: send deauth frame if CAC is required during
CSA
Avoid sending deauth in cert mode (11AC VHT4-2.16h-DFS).
Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
---
net/mac80211/cfg.c | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
net/mac80211/cfg.c | 28 ++++++++++++++++++++++++++++
1 file changed, 28 insertions(+)
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 3e6e903..eb73834 100644
index 7a30ca6..2ee5b63 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -3361,6 +3361,31 @@ static int ieee80211_start_radar_detection_post_csa(struct wiphy *wiphy,
@@ -3361,6 +3361,32 @@ static int ieee80211_start_radar_detection_post_csa(struct wiphy *wiphy,
return 1;
}
@@ -28,7 +30,8 @@ index 3e6e903..eb73834 100644
+ &sdata->csa_chandef) &&
+ !cfg80211_reg_can_beacon_relax(local->hw.wiphy,
+ &sdata->csa_chandef,
+ sdata->wdev.iftype);
+ sdata->wdev.iftype) &&
+ !ieee80211_is_cert_mode(&local->hw);
+ /* broadcast deauth frame if CAC is required */
+ if (!send_deauth)
+ return;
@@ -45,7 +48,7 @@ index 3e6e903..eb73834 100644
static int __ieee80211_csa_finalize(struct ieee80211_sub_if_data *sdata)
{
struct ieee80211_local *local = sdata->local;
@@ -3371,6 +3396,8 @@ static int __ieee80211_csa_finalize(struct ieee80211_sub_if_data *sdata)
@@ -3371,6 +3397,8 @@ static int __ieee80211_csa_finalize(struct ieee80211_sub_if_data *sdata)
lockdep_assert_held(&local->mtx);
lockdep_assert_held(&local->chanctx_mtx);
@@ -55,5 +58,5 @@ index 3e6e903..eb73834 100644
* using reservation isn't immediate as it may be deferred until later
* with multi-vif. once reservation is complete it will re-schedule the
--
2.18.0
2.45.2

View File

@@ -0,0 +1,95 @@
From 843e2b25433dc6c3cbc2ff4a754bef091cabe54b Mon Sep 17 00:00:00 2001
From: Benjamin Lin <benjamin-jw.lin@mediatek.com>
Date: Mon, 24 Jun 2024 17:50:08 +0800
Subject: [PATCH] mac80211: mtk: add callback function to set QoS map in HW
The mapping from IP DSCP to IEEE 802.11 user priority may be customized.
Therefore, the mapping needs to be passed to HW, so that the QoS type of traffic can be mapped in a consistent manner for both SW and HW paths.
Signed-off-by: Benjamin Lin <benjamin-jw.lin@mediatek.com>
---
include/net/mac80211.h | 3 +++
net/mac80211/cfg.c | 2 +-
net/mac80211/driver-ops.h | 16 ++++++++++++++++
net/mac80211/trace.h | 6 ++++++
4 files changed, 26 insertions(+), 1 deletion(-)
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 5c26752..b622c76 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -3982,6 +3982,7 @@ struct ieee80211_prep_tx_info {
* disable background CAC/radar detection.
* @net_fill_forward_path: Called from .ndo_fill_forward_path in order to
* resolve a path for hardware flow offloading
+ * @set_qos_map: Set QoS mapping information to driver.
*/
struct ieee80211_ops {
void (*tx)(struct ieee80211_hw *hw,
@@ -4321,6 +4322,8 @@ struct ieee80211_ops {
struct net_device_path_ctx *ctx,
struct net_device_path *path);
#endif
+ int (*set_qos_map)(struct ieee80211_vif *vif,
+ struct cfg80211_qos_map *qos_map);
};
/**
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index ffb60a2..80fba54 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -4040,7 +4040,7 @@ static int ieee80211_set_qos_map(struct wiphy *wiphy,
if (old_qos_map)
kfree_rcu(old_qos_map, rcu_head);
- return 0;
+ return drv_set_qos_map(sdata->local, sdata, qos_map);
}
static int ieee80211_set_ap_chanwidth(struct wiphy *wiphy,
diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h
index 9e8003f..d4723dc 100644
--- a/net/mac80211/driver-ops.h
+++ b/net/mac80211/driver-ops.h
@@ -1525,4 +1525,20 @@ static inline int drv_net_fill_forward_path(struct ieee80211_local *local,
}
#endif
+static inline int drv_set_qos_map(struct ieee80211_local *local,
+ struct ieee80211_sub_if_data *sdata,
+ struct cfg80211_qos_map *qos_map)
+{
+ int ret = -EOPNOTSUPP;
+
+ might_sleep();
+
+ trace_drv_set_qos_map(local, sdata);
+ if (local->ops->set_qos_map)
+ ret = local->ops->set_qos_map(&sdata->vif, qos_map);
+ trace_drv_return_int(local, ret);
+
+ return ret;
+}
+
#endif /* __MAC80211_DRIVER_OPS */
diff --git a/net/mac80211/trace.h b/net/mac80211/trace.h
index d15dadd..c6fc75e 100644
--- a/net/mac80211/trace.h
+++ b/net/mac80211/trace.h
@@ -2929,6 +2929,12 @@ TRACE_EVENT(bss_color_bitmap,
)
);
+DEFINE_EVENT(local_sdata_evt, drv_set_qos_map,
+ TP_PROTO(struct ieee80211_local *local,
+ struct ieee80211_sub_if_data *sdata),
+ TP_ARGS(local, sdata)
+);
+
#endif /* !__MAC80211_DRIVER_TRACE || TRACE_HEADER_MULTI_READ */
#undef TRACE_INCLUDE_PATH
--
2.18.0

View File

@@ -1,58 +0,0 @@
From ac1e8443a250f418b6124e7b4f4ea65a03c4d02b Mon Sep 17 00:00:00 2001
From: Benjamin Lin <benjamin-jw.lin@mediatek.com>
Date: Fri, 26 Apr 2024 09:29:39 +0800
Subject: [PATCH] mac80211: mtk: add exported function for SoftMAC driver to
get QoS map
The mapping from IP DSCP to IEEE 802.11 user priority may be customized.
Therefore, driver needs to pass the mapping to HW, so that the QoS type of traffic can be mapped in a consistent manner for both SW and HW paths.
Signed-off-by: Benjamin Lin <benjamin-jw.lin@mediatek.com>
---
include/net/mac80211.h | 12 ++++++++++++
net/mac80211/util.c | 10 +++++++++-
2 files changed, 21 insertions(+), 1 deletion(-)
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 5c26752..420963f 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -6942,4 +6942,16 @@ static inline bool ieee80211_is_tx_data(struct sk_buff *skb)
* @hw: pointer as obtained from ieee80211_alloc_hw()
*/
unsigned long ieee80211_get_scanning(struct ieee80211_hw *hw);
+
+/**
+ * ieee80211_get_qos_map - get QoS mapping information.
+ *
+ * @vif: &struct ieee80211_vif pointer from the add_interface callback.
+ *
+ * Return: Pointer to the QoS mapping information.
+ *
+ * Note that the return value is an RCU-protected pointer, so rcu_read_lock()
+ * must be held when calling this function.
+ */
+struct cfg80211_qos_map *ieee80211_get_qos_map(struct ieee80211_vif *vif);
#endif /* MAC80211_H */
diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index e07fe73..865c4ac 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -4643,4 +4643,12 @@ unsigned long ieee80211_get_scanning(struct ieee80211_hw *hw)
return local->scanning;
}
-EXPORT_SYMBOL(ieee80211_get_scanning);
\ No newline at end of file
+EXPORT_SYMBOL(ieee80211_get_scanning);
+
+struct cfg80211_qos_map *ieee80211_get_qos_map(struct ieee80211_vif *vif)
+{
+ struct mac80211_qos_map *qos_map = rcu_dereference(vif_to_sdata(vif)->qos_map);
+
+ return qos_map ? &qos_map->qos_map : NULL;
+}
+EXPORT_SYMBOL(ieee80211_get_qos_map);
--
2.18.0

View File

@@ -0,0 +1,56 @@
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

View File

@@ -0,0 +1,34 @@
From 9c1bd48929ad7c6b55d4486e7c519c778f9900d6 Mon Sep 17 00:00:00 2001
From: Peter Chiu <chui-hao.chiu@mediatek.com>
Date: Mon, 14 Oct 2024 15:27:28 +0800
Subject: [PATCH] mac80211: mtk: set IEEE80211_TX_CTL_USE_MINRATE when probing
station
The TxS may not be reported to driver correctly when we set BA_DISALBE = 0.
When mac80211 set IEEE80211_TX_CTL_USE_MINRATE, mt76 would use fixed rate
and set BA_DISABLE = 1 to transmit the packet. So mt76 can receive TxS
correctly.
Signed-off-by: Peter Chiu <chui-hao.chiu@mediatek.com>
---
net/mac80211/cfg.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 80fba54..4818dca 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -3957,7 +3957,8 @@ static int ieee80211_probe_client(struct wiphy *wiphy, struct net_device *dev,
info = IEEE80211_SKB_CB(skb);
info->flags |= IEEE80211_TX_CTL_REQ_TX_STATUS |
- IEEE80211_TX_INTFL_NL80211_FRAME_TX;
+ IEEE80211_TX_INTFL_NL80211_FRAME_TX |
+ IEEE80211_TX_CTL_USE_MINRATE;
info->band = band;
skb_set_queue_mapping(skb, IEEE80211_AC_VO);
--
2.45.2

View File

@@ -0,0 +1,196 @@
From d873d195bcb481b7b82be195cb17e3fc7f7ecf58 Mon Sep 17 00:00:00 2001
From: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
Date: Wed, 11 Dec 2024 13:21:21 +0800
Subject: [PATCH] mac80211: mtk: add dfs relax flag for scanning without dfs
restrictions
Add dfs relax flag for scanning without dfs restrictions.
If user turn on the dfs relax flag by entering the following command:
echo 1 > /sys/kernel/debug/ieee80211/phyX/scan_dfs_relax
Then, allow AP/STA to scan while operating on a DFS channel.
Signed-off-by: StanleyYP Wang <StanleyYP.Wang@mediatek.com>
---
include/net/cfg80211.h | 4 +++
net/mac80211/offchannel.c | 4 +--
net/mac80211/scan.c | 3 ++-
net/wireless/debugfs.c | 53 +++++++++++++++++++++++++++++++++++++++
net/wireless/nl80211.c | 14 ++++++++---
5 files changed, 71 insertions(+), 7 deletions(-)
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index 67b0e6c..f159340 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -5047,6 +5047,8 @@ struct wiphy_iftype_akm_suites {
* @mbssid_max_ema_profile_periodicity: maximum profile periodicity supported by
* the driver. Setting this field to a non-zero value indicates that the
* driver supports enhanced multi-BSSID advertisements (EMA AP).
+ *
+ * @dfs_relax: a flag to relax the DFS restrictions during scanning
*/
struct wiphy {
struct mutex mtx;
@@ -5197,6 +5199,8 @@ struct wiphy {
u8 mbssid_max_interfaces;
u8 ema_max_profile_periodicity;
+ bool dfs_relax;
+
char priv[] __aligned(NETDEV_ALIGN);
};
diff --git a/net/mac80211/offchannel.c b/net/mac80211/offchannel.c
index 042b6fb..2cd8454 100644
--- a/net/mac80211/offchannel.c
+++ b/net/mac80211/offchannel.c
@@ -579,8 +579,8 @@ static int ieee80211_start_roc_work(struct ieee80211_local *local,
}
/* if there's no need to queue, handle it immediately */
- if (list_empty(&local->roc_list) &&
- !local->scanning && !ieee80211_is_radar_required(local)) {
+ if (list_empty(&local->roc_list) && !local->scanning &&
+ (local->hw.wiphy->dfs_relax || !ieee80211_is_radar_required(local))) {
/* if not HW assist, just queue & schedule work */
if (!local->ops->remain_on_channel) {
list_add_tail(&roc->list, &local->roc_list);
diff --git a/net/mac80211/scan.c b/net/mac80211/scan.c
index 9d53f1a..9ef5179 100644
--- a/net/mac80211/scan.c
+++ b/net/mac80211/scan.c
@@ -572,7 +572,8 @@ static bool __ieee80211_can_leave_ch(struct ieee80211_sub_if_data *sdata)
if (!ieee80211_is_radar_required(local))
return true;
- if (!regulatory_pre_cac_allowed(local->hw.wiphy))
+ if (!local->hw.wiphy->dfs_relax &&
+ !regulatory_pre_cac_allowed(local->hw.wiphy))
return false;
mutex_lock(&local->iflist_mtx);
diff --git a/net/wireless/debugfs.c b/net/wireless/debugfs.c
index 0637ed4..9fecbef 100644
--- a/net/wireless/debugfs.c
+++ b/net/wireless/debugfs.c
@@ -388,6 +388,58 @@ dfs_available_reset(void *data, u64 val)
DEFINE_DEBUGFS_ATTRIBUTE(dfs_available_reset_ops, NULL,
dfs_available_reset, "0x%08llx\n");
+
+static ssize_t scan_dfs_relax_write(struct file *file,
+ const char __user *user_buf,
+ size_t count, loff_t *ppos)
+{
+ struct wiphy *wiphy = file->private_data;
+ char buf[16];
+
+ if (count >= sizeof(buf))
+ return -EINVAL;
+
+ if (copy_from_user(buf, user_buf, count))
+ return -EFAULT;
+
+ if (count && buf[count - 1] == '\n')
+ buf[count - 1] = '\0';
+ else
+ buf[count] = '\0';
+
+ if (kstrtobool(buf, &wiphy->dfs_relax))
+ return -EINVAL;
+
+ return count;
+}
+
+static ssize_t scan_dfs_relax_read(struct file *file, char __user *user_buf,
+ size_t count, loff_t *ppos)
+{
+ struct wiphy *wiphy = file->private_data;
+ unsigned int r, offset, buf_size = PAGE_SIZE;
+ char *buf;
+
+ buf = kzalloc(buf_size, GFP_KERNEL);
+ if (!buf)
+ return -ENOMEM;
+
+ offset = scnprintf(buf, buf_size, "dfs relax: %u\n", wiphy->dfs_relax);
+
+ r = simple_read_from_buffer(user_buf, count, ppos, buf, offset);
+
+ kfree(buf);
+
+ return r;
+}
+
+static const struct file_operations scan_dfs_relax_ops = {
+ .write = scan_dfs_relax_write,
+ .read = scan_dfs_relax_read,
+ .open = simple_open,
+ .llseek = default_llseek,
+};
+
#define DEBUGFS_ADD(name, chmod) \
debugfs_create_file(#name, chmod, phyd, &rdev->wiphy, &name## _ops)
@@ -404,4 +456,5 @@ void cfg80211_debugfs_rdev_add(struct cfg80211_registered_device *rdev)
DEBUGFS_ADD(dfs_skip_nop, 0600);
DEBUGFS_ADD(dfs_skip_cac, 0600);
DEBUGFS_ADD(dfs_available_reset, 0600);
+ DEBUGFS_ADD(scan_dfs_relax, 0644);
}
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 4883b1f..3d22429 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -8400,13 +8400,16 @@ int nl80211_parse_random_mac(struct nlattr **attrs,
return 0;
}
-static bool cfg80211_off_channel_oper_allowed(struct wireless_dev *wdev)
+static bool cfg80211_off_channel_oper_allowed(struct wireless_dev *wdev, bool dfs_relax)
{
ASSERT_WDEV_LOCK(wdev);
if (!cfg80211_beaconing_iface_active(wdev))
return true;
+ if (dfs_relax)
+ return true;
+
if (!(wdev->chandef.chan->flags & IEEE80211_CHAN_RADAR))
return true;
@@ -8627,7 +8630,7 @@ static int nl80211_trigger_scan(struct sk_buff *skb, struct genl_info *info)
request->n_channels = i;
wdev_lock(wdev);
- if (!cfg80211_off_channel_oper_allowed(wdev)) {
+ if (!cfg80211_off_channel_oper_allowed(wdev, wiphy->dfs_relax)) {
struct ieee80211_channel *chan;
if (request->n_channels != 1) {
@@ -11549,8 +11552,11 @@ static int nl80211_remain_on_channel(struct sk_buff *skb,
if (err)
return err;
+ if (wdev->cac_started)
+ return -EBUSY;
+
wdev_lock(wdev);
- if (!cfg80211_off_channel_oper_allowed(wdev) &&
+ if (!cfg80211_off_channel_oper_allowed(wdev, rdev->wiphy.dfs_relax) &&
!cfg80211_chandef_identical(&wdev->chandef, &chandef)) {
compat_chandef = cfg80211_chandef_compatible(&wdev->chandef,
&chandef);
@@ -11755,7 +11761,7 @@ static int nl80211_tx_mgmt(struct sk_buff *skb, struct genl_info *info)
return -EINVAL;
wdev_lock(wdev);
- if (params.offchan && !cfg80211_off_channel_oper_allowed(wdev)) {
+ if (params.offchan && !cfg80211_off_channel_oper_allowed(wdev, false)) {
wdev_unlock(wdev);
return -EBUSY;
}
--
2.45.2

View File

@@ -1,7 +1,7 @@
From bad36168042569eb4c7ab6a549f7444a40e299c3 Mon Sep 17 00:00:00 2001
From 026c9872e3460f1632b60324e062016887b31134 Mon Sep 17 00:00:00 2001
From: Sujuan Chen <sujuan.chen@mediatek.com>
Date: Fri, 11 Mar 2022 11:34:11 +0800
Subject: [PATCH 9900/9903] mac80211: mtk: mask kernel version limitation and
Subject: [PATCH 9900/9902] mac80211: mtk: mask kernel version limitation and
fill forward path in kernel 5.4
Signed-off-by: Sujuan Chen <sujuan.chen@mediatek.com>
@@ -13,10 +13,10 @@ Signed-off-by: Sujuan Chen <sujuan.chen@mediatek.com>
4 files changed, 10 deletions(-)
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 91affd5..42192cd 100644
index b622c76..c6625c2 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -4307,13 +4307,11 @@ struct ieee80211_ops {
@@ -4315,13 +4315,11 @@ struct ieee80211_ops {
struct ieee80211_sta *sta, u8 flowid);
int (*set_radar_background)(struct ieee80211_hw *hw,
struct cfg80211_chan_def *chandef);
@@ -27,11 +27,11 @@ index 91affd5..42192cd 100644
struct net_device_path_ctx *ctx,
struct net_device_path *path);
-#endif
int (*set_qos_map)(struct ieee80211_vif *vif,
struct cfg80211_qos_map *qos_map);
};
/**
diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h
index 9e8003f..19e2ada 100644
index d4723dc..91ea8b2 100644
--- a/net/mac80211/driver-ops.h
+++ b/net/mac80211/driver-ops.h
@@ -1501,7 +1501,6 @@ static inline void drv_twt_teardown_request(struct ieee80211_local *local,
@@ -42,18 +42,19 @@ index 9e8003f..19e2ada 100644
static inline int drv_net_fill_forward_path(struct ieee80211_local *local,
struct ieee80211_sub_if_data *sdata,
struct ieee80211_sta *sta,
@@ -1523,6 +1522,5 @@ static inline int drv_net_fill_forward_path(struct ieee80211_local *local,
@@ -1523,7 +1522,6 @@ static inline int drv_net_fill_forward_path(struct ieee80211_local *local,
return ret;
}
-#endif
#endif /* __MAC80211_DRIVER_OPS */
static inline int drv_set_qos_map(struct ieee80211_local *local,
struct ieee80211_sub_if_data *sdata,
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
index 00b0443..a7169a5 100644
index 138ad79..4b92867 100644
--- a/net/mac80211/iface.c
+++ b/net/mac80211/iface.c
@@ -853,7 +853,6 @@ static const struct net_device_ops ieee80211_monitorif_ops = {
@@ -875,7 +875,6 @@ static const struct net_device_ops ieee80211_monitorif_ops = {
};
@@ -61,7 +62,7 @@ index 00b0443..a7169a5 100644
static int ieee80211_netdev_fill_forward_path(struct net_device_path_ctx *ctx,
struct net_device_path *path)
{
@@ -911,7 +910,6 @@ out:
@@ -933,7 +932,6 @@ out:
return ret;
}
@@ -69,7 +70,7 @@ index 00b0443..a7169a5 100644
static const struct net_device_ops ieee80211_dataif_8023_ops = {
#if LINUX_VERSION_IS_LESS(4,10,0)
@@ -930,9 +928,7 @@ static const struct net_device_ops ieee80211_dataif_8023_ops = {
@@ -952,9 +950,7 @@ static const struct net_device_ops ieee80211_dataif_8023_ops = {
#else
.ndo_get_stats64 = bp_ieee80211_get_stats64,
#endif
@@ -80,7 +81,7 @@ index 00b0443..a7169a5 100644
static bool ieee80211_iftype_supports_hdr_offload(enum nl80211_iftype iftype)
diff --git a/net/mac80211/trace.h b/net/mac80211/trace.h
index d15dadd..8770033 100644
index c6fc75e..6b7b46b 100644
--- a/net/mac80211/trace.h
+++ b/net/mac80211/trace.h
@@ -2899,14 +2899,12 @@ TRACE_EVENT(drv_twt_teardown_request,

View File

@@ -1,23 +1,23 @@
From 0161154c18a464bbb350bcb5ef620bd255940640 Mon Sep 17 00:00:00 2001
From e5612cde83ef67f8fa4633f7d364e05bac6e02a3 Mon Sep 17 00:00:00 2001
From: Sujuan Chen <sujuan.chen@mediatek.com>
Date: Wed, 18 May 2022 15:10:22 +0800
Subject: [PATCH 9901/9903] mac80211: mtk: add fill receive path ops to get wed
Subject: [PATCH 9901/9902] mac80211: mtk: add fill receive path ops to get wed
idx
Signed-off-by: Sujuan Chen <sujuan.chen@mediatek.com>
---
include/net/mac80211.h | 12 ++++++++++++
net/mac80211/driver-ops.h | 13 +++++++++++++
net/mac80211/driver-ops.h | 14 +++++++++++++-
net/mac80211/iface.c | 24 ++++++++++++++++++++++++
net/mac80211/util.c | 9 +++++++++
4 files changed, 58 insertions(+)
4 files changed, 58 insertions(+), 1 deletion(-)
mode change 100644 => 100755 include/net/mac80211.h
mode change 100644 => 100755 net/mac80211/util.c
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
old mode 100644
new mode 100755
index 42192cd..8a71026
index c6625c2..cb8b28d
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -1798,6 +1798,13 @@ struct ieee80211_vif *wdev_to_ieee80211_vif(struct wireless_dev *wdev);
@@ -34,30 +34,30 @@ index 42192cd..8a71026
/**
* enum ieee80211_key_flags - key flags
*
@@ -3975,6 +3982,8 @@ struct ieee80211_prep_tx_info {
@@ -3982,6 +3989,8 @@ struct ieee80211_prep_tx_info {
* disable background CAC/radar detection.
* @net_fill_forward_path: Called from .ndo_fill_forward_path in order to
* resolve a path for hardware flow offloading
+ * @net_fill_receive_path: Called from .ndo_fill_receive_path in order to
+ * get a path for hardware flow offloading
* @set_qos_map: Set QoS mapping information to driver.
*/
struct ieee80211_ops {
void (*tx)(struct ieee80211_hw *hw,
@@ -4312,6 +4321,9 @@ struct ieee80211_ops {
@@ -4320,6 +4329,9 @@ struct ieee80211_ops {
struct ieee80211_sta *sta,
struct net_device_path_ctx *ctx,
struct net_device_path *path);
+ int (*net_fill_receive_path)(struct ieee80211_hw *hw,
+ struct net_device_path_ctx *ctx,
+ struct net_device_path *path);
int (*set_qos_map)(struct ieee80211_vif *vif,
struct cfg80211_qos_map *qos_map);
};
/**
diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h
index 19e2ada..88dedfc 100644
index 91ea8b2..348f815 100644
--- a/net/mac80211/driver-ops.h
+++ b/net/mac80211/driver-ops.h
@@ -1523,4 +1523,17 @@ static inline int drv_net_fill_forward_path(struct ieee80211_local *local,
@@ -1523,6 +1523,19 @@ static inline int drv_net_fill_forward_path(struct ieee80211_local *local,
return ret;
}
@@ -74,12 +74,20 @@ index 19e2ada..88dedfc 100644
+ return ret;
+}
+
static inline int drv_set_qos_map(struct ieee80211_local *local,
struct ieee80211_sub_if_data *sdata,
struct cfg80211_qos_map *qos_map)
@@ -1538,5 +1551,4 @@ static inline int drv_set_qos_map(struct ieee80211_local *local,
return ret;
}
-
#endif /* __MAC80211_DRIVER_OPS */
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
index a7169a5..8a4f4e1 100644
index 4b92867..c08bfbe 100644
--- a/net/mac80211/iface.c
+++ b/net/mac80211/iface.c
@@ -911,6 +911,29 @@ out:
@@ -933,6 +933,29 @@ out:
return ret;
}
@@ -109,7 +117,7 @@ index a7169a5..8a4f4e1 100644
static const struct net_device_ops ieee80211_dataif_8023_ops = {
#if LINUX_VERSION_IS_LESS(4,10,0)
.ndo_change_mtu = __change_mtu,
@@ -929,6 +952,7 @@ static const struct net_device_ops ieee80211_dataif_8023_ops = {
@@ -951,6 +974,7 @@ static const struct net_device_ops ieee80211_dataif_8023_ops = {
.ndo_get_stats64 = bp_ieee80211_get_stats64,
#endif
.ndo_fill_forward_path = ieee80211_netdev_fill_forward_path,
@@ -120,7 +128,7 @@ index a7169a5..8a4f4e1 100644
diff --git a/net/mac80211/util.c b/net/mac80211/util.c
old mode 100644
new mode 100755
index 8d36b05..d26a2b8
index e07fe73..809eb37
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -898,6 +898,15 @@ struct wireless_dev *ieee80211_vif_to_wdev(struct ieee80211_vif *vif)

View File

@@ -1,7 +1,7 @@
From fdc7f27785b716eae1e02df73c095ecfe2677d9f Mon Sep 17 00:00:00 2001
From d62db23d46d1887aff58c76b0eb9960a46afb9bf Mon Sep 17 00:00:00 2001
From: Sujuan Chen <sujuan.chen@mediatek.com>
Date: Tue, 28 Mar 2023 10:53:31 +0800
Subject: [PATCH 9902/9903] mac80211: mtk: add support for letting drivers
Subject: [PATCH 9902/9902] mac80211: mtk: add support for letting drivers
register tc offload support
On newer MediaTek SoCs (e.g. MT7986), WLAN->WLAN or WLAN->Ethernet flows can
@@ -18,10 +18,10 @@ Signed-off-by: Sujuan Chen <sujuan.chen@mediatek.com>
5 files changed, 70 insertions(+), 1 deletion(-)
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 8a71026..861bc9a 100755
index cb8b28d..6104072 100755
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -3984,6 +3984,10 @@ struct ieee80211_prep_tx_info {
@@ -3991,6 +3991,10 @@ struct ieee80211_prep_tx_info {
* resolve a path for hardware flow offloading
* @net_fill_receive_path: Called from .ndo_fill_receive_path in order to
* get a path for hardware flow offloading
@@ -29,10 +29,10 @@ index 8a71026..861bc9a 100755
+ * flow offloading for flows originating from the vif.
+ * Note that the driver must not assume that the vif driver_data is valid
+ * at this point, since the callback can be called during netdev teardown.
* @set_qos_map: Set QoS mapping information to driver.
*/
struct ieee80211_ops {
void (*tx)(struct ieee80211_hw *hw,
@@ -4324,6 +4328,11 @@ struct ieee80211_ops {
@@ -4332,6 +4336,11 @@ struct ieee80211_ops {
int (*net_fill_receive_path)(struct ieee80211_hw *hw,
struct net_device_path_ctx *ctx,
struct net_device_path *path);
@@ -41,14 +41,14 @@ index 8a71026..861bc9a 100755
+ struct net_device *dev,
+ enum tc_setup_type type,
+ void *type_data);
int (*set_qos_map)(struct ieee80211_vif *vif,
struct cfg80211_qos_map *qos_map);
};
/**
diff --git a/net/mac80211/driver-ops.h b/net/mac80211/driver-ops.h
index 88dedfc..3ceba5e 100644
index 348f815..f56a71f 100644
--- a/net/mac80211/driver-ops.h
+++ b/net/mac80211/driver-ops.h
@@ -1536,4 +1536,21 @@ static inline int drv_net_fill_receive_path(struct ieee80211_local *local,
@@ -1536,6 +1536,23 @@ static inline int drv_net_fill_receive_path(struct ieee80211_local *local,
return ret;
}
@@ -69,12 +69,14 @@ index 88dedfc..3ceba5e 100644
+ return ret;
+}
+
#endif /* __MAC80211_DRIVER_OPS */
static inline int drv_set_qos_map(struct ieee80211_local *local,
struct ieee80211_sub_if_data *sdata,
struct cfg80211_qos_map *qos_map)
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index 2519c14..fe7a03a 100644
index bb5906d..b02ca21 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -1822,7 +1822,8 @@ void ieee80211_color_aging_work(struct work_struct *work);
@@ -1824,7 +1824,8 @@ void ieee80211_color_aging_work(struct work_struct *work);
/* interface handling */
#define MAC80211_SUPPORTED_FEATURES_TX (NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM | \
NETIF_F_HW_CSUM | NETIF_F_SG | \
@@ -85,10 +87,10 @@ index 2519c14..fe7a03a 100644
#define MAC80211_SUPPORTED_FEATURES (MAC80211_SUPPORTED_FEATURES_TX | \
MAC80211_SUPPORTED_FEATURES_RX)
diff --git a/net/mac80211/iface.c b/net/mac80211/iface.c
index 8a4f4e1..f3bf837 100644
index c08bfbe..ddeaa8f 100644
--- a/net/mac80211/iface.c
+++ b/net/mac80211/iface.c
@@ -773,6 +773,21 @@ static int __change_mtu(struct net_device *ndev, int new_mtu){
@@ -795,6 +795,21 @@ static int __change_mtu(struct net_device *ndev, int new_mtu){
}
#endif
@@ -110,7 +112,7 @@ index 8a4f4e1..f3bf837 100644
static const struct net_device_ops ieee80211_dataif_ops = {
#if LINUX_VERSION_IS_LESS(4,10,0)
.ndo_change_mtu = __change_mtu,
@@ -790,6 +805,7 @@ static const struct net_device_ops ieee80211_dataif_ops = {
@@ -812,6 +827,7 @@ static const struct net_device_ops ieee80211_dataif_ops = {
#else
.ndo_get_stats64 = bp_ieee80211_get_stats64,
#endif
@@ -118,7 +120,7 @@ index 8a4f4e1..f3bf837 100644
};
@@ -953,6 +969,7 @@ static const struct net_device_ops ieee80211_dataif_8023_ops = {
@@ -975,6 +991,7 @@ static const struct net_device_ops ieee80211_dataif_8023_ops = {
#endif
.ndo_fill_forward_path = ieee80211_netdev_fill_forward_path,
.ndo_fill_receive_path = ieee80211_netdev_fill_receive_path,
@@ -127,7 +129,7 @@ index 8a4f4e1..f3bf837 100644
static bool ieee80211_iftype_supports_hdr_offload(enum nl80211_iftype iftype)
diff --git a/net/mac80211/trace.h b/net/mac80211/trace.h
index 8770033..78d9803 100644
index 6b7b46b..5aea24a 100644
--- a/net/mac80211/trace.h
+++ b/net/mac80211/trace.h
@@ -2906,6 +2906,31 @@ DEFINE_EVENT(sta_event, drv_net_fill_forward_path,