From d9bb410888ce1354ce29dcde671e1e21cc0c64cd Mon Sep 17 00:00:00 2001 From: Sergey Matyukevich Date: Tue, 8 Jan 2019 23:31:49 +0300 Subject: [PATCH] mac80211: allow overriding HT STBC capabilities Allow user to override STBC configuration for Rx and Tx spatial streams. In practice RX/TX STBC settings can be modified using appropriate options in wpa_supplicant configuration file: tx_stbc=-1..1 rx_stbc=-1..3 This functionality has been added to wpa_supplicant in commit cdeea70f59d0. In FullMAC case these STBC options are passed to drivers by cfg80211 connect callback in fields of cfg80211_connect_params structure. However for mac80211 drivers, e.g. for mac80211_hwsim, overrides for STBC settings are ignored. The reason why RX/TX STBC capabilities are not modified for mac80211 drivers is as follows. All drivers need to specify supported HT/VHT overrides explicitly: see ht_capa_mod_mask and vht_capa_mod_mask fields of wiphy structure. Only supported overrides will be passed to drivers by cfg80211_connect and cfg80211_mlme_assoc operations: see bitwise 'AND' performed by cfg80211_oper_and_ht_capa and cfg80211_oper_and_vht_capa. This commit adds RX/TX STBC HT capabilities to mac80211_ht_capa_mod_mask, allowing their modifications, as well as applies requested STBC modifications in function ieee80211_apply_htcap_overrides. Signed-off-by: Sergey Matyukevich Signed-off-by: Johannes Berg --- net/mac80211/ht.c | 8 ++++++++ net/mac80211/main.c | 2 ++ 2 files changed, 10 insertions(+) diff --git a/net/mac80211/ht.c b/net/mac80211/ht.c index f849ea814993..e03c46ac8e4d 100644 --- a/net/mac80211/ht.c +++ b/net/mac80211/ht.c @@ -107,6 +107,14 @@ void ieee80211_apply_htcap_overrides(struct ieee80211_sub_if_data *sdata, __check_htcap_enable(ht_capa, ht_capa_mask, ht_cap, IEEE80211_HT_CAP_40MHZ_INTOLERANT); + /* Allow user to enable TX STBC bit */ + __check_htcap_enable(ht_capa, ht_capa_mask, ht_cap, + IEEE80211_HT_CAP_TX_STBC); + + /* Allow user to configure RX STBC bits */ + if (ht_capa_mask->cap_info & IEEE80211_HT_CAP_RX_STBC) + ht_cap->cap |= ht_capa->cap_info & IEEE80211_HT_CAP_RX_STBC; + /* Allow user to decrease AMPDU factor */ if (ht_capa_mask->ampdu_params_info & IEEE80211_HT_AMPDU_PARM_FACTOR) { diff --git a/net/mac80211/main.c b/net/mac80211/main.c index 896f17d726d0..71005b6dfcd1 100644 --- a/net/mac80211/main.c +++ b/net/mac80211/main.c @@ -478,6 +478,8 @@ static const struct ieee80211_ht_cap mac80211_ht_capa_mod_mask = { IEEE80211_HT_CAP_MAX_AMSDU | IEEE80211_HT_CAP_SGI_20 | IEEE80211_HT_CAP_SGI_40 | + IEEE80211_HT_CAP_TX_STBC | + IEEE80211_HT_CAP_RX_STBC | IEEE80211_HT_CAP_LDPC_CODING | IEEE80211_HT_CAP_40MHZ_INTOLERANT), .mcs = {