From: Sergey Matyukevich <[email protected]>

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 <[email protected]>
---
 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 87a729926734..1114ee217bd6 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 = {
-- 
2.20.1

Reply via email to