mirror of
https://github.com/Telecominfraproject/wlan-ap.git
synced 2025-12-20 10:51:27 +00:00
135 lines
3.9 KiB
Diff
135 lines
3.9 KiB
Diff
From 6fbc3d0df8f7d36a735c62ce54cbb39140e58f17 Mon Sep 17 00:00:00 2001
|
|
From: Allen Ye <allen.ye@mediatek.com>
|
|
Date: Mon, 22 Jan 2024 15:47:23 +0800
|
|
Subject: [PATCH] mac80211: mtk: Add cert mode for disable ba timeout and fix
|
|
SMPS cap check
|
|
|
|
Signed-off-by: Allen Ye <allen.ye@mediatek.com>
|
|
---
|
|
include/net/mac80211.h | 7 ++++++
|
|
net/mac80211/agg-tx.c | 5 ++++-
|
|
net/mac80211/debugfs.c | 49 ++++++++++++++++++++++++++++++++++++++++++
|
|
net/mac80211/rx.c | 3 ++-
|
|
4 files changed, 62 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
|
|
index 41d57e7..415dcfe 100644
|
|
--- a/include/net/mac80211.h
|
|
+++ b/include/net/mac80211.h
|
|
@@ -2654,8 +2654,15 @@ struct ieee80211_hw {
|
|
u8 tx_sk_pacing_shift;
|
|
u8 weight_multiplier;
|
|
u32 max_mtu;
|
|
+ bool cert_mode;
|
|
};
|
|
|
|
+static inline bool ieee80211_is_cert_mode(struct ieee80211_hw *hw)
|
|
+{
|
|
+ return hw->cert_mode;
|
|
+}
|
|
+
|
|
+
|
|
static inline bool _ieee80211_hw_check(struct ieee80211_hw *hw,
|
|
enum ieee80211_hw_flags flg)
|
|
{
|
|
diff --git a/net/mac80211/agg-tx.c b/net/mac80211/agg-tx.c
|
|
index ad0c0d6..6ea3676 100644
|
|
--- a/net/mac80211/agg-tx.c
|
|
+++ b/net/mac80211/agg-tx.c
|
|
@@ -1052,7 +1052,10 @@ void ieee80211_process_addba_resp(struct ieee80211_local *local,
|
|
tid_tx->timeout =
|
|
le16_to_cpu(mgmt->u.action.u.addba_resp.timeout);
|
|
|
|
- if (tid_tx->timeout) {
|
|
+ /* In the case of certification env, testbed STA cannot accept frequent DelBA.
|
|
+ * Therefore, we remove the session timer check here to avoid crashing testbed STA.
|
|
+ */
|
|
+ if (tid_tx->timeout && !ieee80211_is_cert_mode(&local->hw)) {
|
|
mod_timer(&tid_tx->session_timer,
|
|
TU_TO_EXP_TIME(tid_tx->timeout));
|
|
tid_tx->last_tx = jiffies;
|
|
diff --git a/net/mac80211/debugfs.c b/net/mac80211/debugfs.c
|
|
index 46f6c82..7a4ce05 100644
|
|
--- a/net/mac80211/debugfs.c
|
|
+++ b/net/mac80211/debugfs.c
|
|
@@ -440,6 +440,54 @@ static const struct file_operations reset_ops = {
|
|
};
|
|
#endif
|
|
|
|
+static ssize_t cert_mode_read(struct file *file,
|
|
+ char __user *user_buf,
|
|
+ size_t count,
|
|
+ loff_t *ppos)
|
|
+{
|
|
+ struct ieee80211_local *local = file->private_data;
|
|
+ char buf[32];
|
|
+ int len = 0;
|
|
+
|
|
+ len = scnprintf(buf, sizeof(buf), "cert_mode: %d\n",
|
|
+ local->hw.cert_mode);
|
|
+
|
|
+ return simple_read_from_buffer(user_buf, count, ppos,
|
|
+ buf, len);
|
|
+}
|
|
+
|
|
+static ssize_t cert_mode_write(struct file *file,
|
|
+ const char __user *user_buf,
|
|
+ size_t count,
|
|
+ loff_t *ppos)
|
|
+{
|
|
+ struct ieee80211_local *local = 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, &local->hw.cert_mode))
|
|
+ return -EINVAL;
|
|
+
|
|
+ return count;
|
|
+}
|
|
+
|
|
+static const struct file_operations cert_mode_ops = {
|
|
+ .write = cert_mode_write,
|
|
+ .read = cert_mode_read,
|
|
+ .open = simple_open,
|
|
+ .llseek = noop_llseek,
|
|
+};
|
|
+
|
|
static const char *hw_flag_names[] = {
|
|
#define FLAG(F) [IEEE80211_HW_##F] = #F
|
|
FLAG(HAS_RATE_CONTROL),
|
|
@@ -670,6 +718,7 @@ void debugfs_hw_add(struct ieee80211_local *local)
|
|
debugfs_create_u32("aql_threshold", 0600,
|
|
phyd, &local->aql_threshold);
|
|
|
|
+ DEBUGFS_ADD_MODE(cert_mode, 0644);
|
|
statsd = debugfs_create_dir("statistics", phyd);
|
|
|
|
/* if the dir failed, don't put all the other things into the root! */
|
|
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
|
|
index a9fcc7a..de2dc66 100644
|
|
--- a/net/mac80211/rx.c
|
|
+++ b/net/mac80211/rx.c
|
|
@@ -3366,7 +3366,8 @@ ieee80211_rx_h_action(struct ieee80211_rx_data *rx)
|
|
switch (mgmt->u.action.category) {
|
|
case WLAN_CATEGORY_HT:
|
|
/* reject HT action frames from stations not supporting HT */
|
|
- if (!rx->sta->sta.ht_cap.ht_supported)
|
|
+ if (!rx->sta->sta.ht_cap.ht_supported &&
|
|
+ !rx->sta->sta.he_cap.has_he)
|
|
goto invalid;
|
|
|
|
if (sdata->vif.type != NL80211_IFTYPE_STATION &&
|
|
--
|
|
2.18.0
|
|
|