2022-02-16 07:22:14

by Aloka Dixit

[permalink] [raw]
Subject: [PATCH 3/3] mac80211: EHT operation element support in AP mode

Add new parameters to struct ieee80211_bss_conf for EHT operation
element data in AP mode.

Signed-off-by: Aloka Dixit <[email protected]>
---
include/net/mac80211.h | 7 +++++++
net/mac80211/cfg.c | 8 ++++++++
net/mac80211/eht.c | 11 +++++++++++
net/mac80211/ieee80211_i.h | 2 ++
4 files changed, 28 insertions(+)

diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index e584a3998d2c..e7e3b31a4c75 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -637,6 +637,8 @@ struct ieee80211_fils_discovery {
* @tx_pwr_env_num: number of @tx_pwr_env.
* @pwr_reduction: power constraint of BSS.
* @eht_support: does this BSS support EHT
+ * @eht_oper: EHT operation information of the BSS (AP/Mesh) or of the AP we
+ * are connected to (STA).
*/
struct ieee80211_bss_conf {
const u8 *bssid;
@@ -712,6 +714,11 @@ struct ieee80211_bss_conf {
u8 tx_pwr_env_num;
u8 pwr_reduction;
bool eht_support;
+ struct {
+ u8 chan_width;
+ u8 ccfs;
+ u8 present_bm;
+ } eht_oper;
};

/**
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index aa45627a4208..4227236dd5ba 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -1137,6 +1137,14 @@ static int ieee80211_start_ap(struct wiphy *wiphy, struct net_device *dev,
changed |= BSS_CHANGED_HE_BSS_COLOR;
}

+ if (params->eht_cap && params->eht_oper) {
+ if (!sdata->vif.bss_conf.he_support)
+ return -EOPNOTSUPP;
+
+ sdata->vif.bss_conf.eht_support = true;
+ ieee80211_eht_op_ie_to_bss_conf(&sdata->vif, params->eht_oper);
+ }
+
if (sdata->vif.type == NL80211_IFTYPE_AP &&
params->mbssid_config.tx_wdev) {
err = ieee80211_set_ap_mbssid_options(sdata,
diff --git a/net/mac80211/eht.c b/net/mac80211/eht.c
index 364ad0ef7692..243dfcfaf7b2 100644
--- a/net/mac80211/eht.c
+++ b/net/mac80211/eht.c
@@ -74,3 +74,14 @@ ieee80211_eht_cap_ie_to_sta_eht_cap(struct ieee80211_sub_if_data *sdata,
sta->cur_max_bandwidth = ieee80211_sta_cap_rx_bw(sta);
sta->sta.bandwidth = ieee80211_sta_cur_vht_bw(sta);
}
+
+void ieee80211_eht_op_ie_to_bss_conf(struct ieee80211_vif *vif,
+ const struct ieee80211_eht_operation *op_ie)
+{
+ if (!op_ie)
+ return;
+
+ vif->bss_conf.eht_oper.chan_width = op_ie->chan_width;
+ vif->bss_conf.eht_oper.ccfs = op_ie->ccfs;
+ vif->bss_conf.eht_oper.present_bm = op_ie->present_bm;
+}
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h
index 00d5bd6013c2..2f1261ebe94d 100644
--- a/net/mac80211/ieee80211_i.h
+++ b/net/mac80211/ieee80211_i.h
@@ -2532,4 +2532,6 @@ ieee80211_eht_cap_ie_to_sta_eht_cap(struct ieee80211_sub_if_data *sdata,
const u8 *he_cap_ie, u8 he_cap_len,
const struct ieee80211_eht_cap_elem *eht_cap_ie_elem,
u8 eht_cap_len, struct sta_info *sta);
+void ieee80211_eht_op_ie_to_bss_conf(struct ieee80211_vif *vif,
+ const struct ieee80211_eht_operation *eht_op);
#endif /* IEEE80211_I_H */
--
2.31.1