mac80211: fix broken spatial multiplexing defaults

Most mac80211 drivers leave the SMPS field in the HT capabilities
uninitialized (unfortunately defaults to static SMPS), which leads to
some devices limiting themselves to single-stream rates in some modes
(mostly mesh and IBSS).

Signed-off-by: Felix Fietkau <nbd@nbd.name>
This commit is contained in:
Felix Fietkau 2017-01-11 23:35:19 +01:00
parent 544dee575d
commit 2b6284f5a8
2 changed files with 43 additions and 2 deletions

View file

@ -0,0 +1,41 @@
From: Felix Fietkau <nbd@nbd.name>
Date: Wed, 11 Jan 2017 23:30:20 +0100
Subject: [PATCH] mac80211: initialize SMPS field in HT capabilities
ibss and mesh modes copy the ht capabilites from the band without
overriding the SMPS state. Unfortunately the default value 0 for the
SMPS field means static SMPS instead of disabled.
This results in HT ibss and mesh setups using only single-stream rates,
even though SMPS is not supposed to be active.
Initialize SMPS to disabled for all bands on ieee80211_hw_register to
ensure that the value is sane where it is not overriden with the real
SMPS state.
Reported-by: Elektra Wagenrad <onelektra@gmx.net>
Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
--- a/net/mac80211/main.c
+++ b/net/mac80211/main.c
@@ -908,10 +908,15 @@ int ieee80211_register_hw(struct ieee802
supp_ht = supp_ht || sband->ht_cap.ht_supported;
supp_vht = supp_vht || sband->vht_cap.vht_supported;
- if (sband->ht_cap.ht_supported)
- local->rx_chains =
- max(ieee80211_mcs_to_chains(&sband->ht_cap.mcs),
- local->rx_chains);
+ if (!sband->ht_cap.ht_supported)
+ continue;
+
+ local->rx_chains =
+ max(ieee80211_mcs_to_chains(&sband->ht_cap.mcs),
+ local->rx_chains);
+
+ sband->ht_cap.cap |= WLAN_HT_CAP_SM_PS_DISABLED <<
+ IEEE80211_HT_CAP_SM_PS_SHIFT;
/* TODO: consider VHT for RX chains, hopefully it's the same */
}

View file

@ -1,6 +1,6 @@
--- a/include/net/cfg80211.h --- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h +++ b/include/net/cfg80211.h
@@ -2562,6 +2562,7 @@ struct cfg80211_nan_func { @@ -2590,6 +2590,7 @@ struct cfg80211_nan_func {
* (as advertised by the nl80211 feature flag.) * (as advertised by the nl80211 feature flag.)
* @get_tx_power: store the current TX power into the dbm variable; * @get_tx_power: store the current TX power into the dbm variable;
* return 0 if successful * return 0 if successful
@ -8,7 +8,7 @@
* *
* @set_wds_peer: set the WDS peer for a WDS interface * @set_wds_peer: set the WDS peer for a WDS interface
* *
@@ -2836,6 +2837,7 @@ struct cfg80211_ops { @@ -2864,6 +2865,7 @@ struct cfg80211_ops {
enum nl80211_tx_power_setting type, int mbm); enum nl80211_tx_power_setting type, int mbm);
int (*get_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev, int (*get_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev,
int *dbm); int *dbm);