From 2b6284f5a8fa12e1b3241f0651859d4e45537eb5 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Wed, 11 Jan 2017 23:35:19 +0100 Subject: [PATCH] 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 --- ...ialize-SMPS-field-in-HT-capabilities.patch | 41 +++++++++++++++++++ .../522-mac80211_configure_antenna_gain.patch | 4 +- 2 files changed, 43 insertions(+), 2 deletions(-) create mode 100644 package/kernel/mac80211/patches/348-mac80211-initialize-SMPS-field-in-HT-capabilities.patch diff --git a/package/kernel/mac80211/patches/348-mac80211-initialize-SMPS-field-in-HT-capabilities.patch b/package/kernel/mac80211/patches/348-mac80211-initialize-SMPS-field-in-HT-capabilities.patch new file mode 100644 index 0000000000..118f535716 --- /dev/null +++ b/package/kernel/mac80211/patches/348-mac80211-initialize-SMPS-field-in-HT-capabilities.patch @@ -0,0 +1,41 @@ +From: Felix Fietkau +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 +Signed-off-by: Felix Fietkau +--- + +--- 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 */ + } diff --git a/package/kernel/mac80211/patches/522-mac80211_configure_antenna_gain.patch b/package/kernel/mac80211/patches/522-mac80211_configure_antenna_gain.patch index 6e4962b09d..9e767ffa8d 100644 --- a/package/kernel/mac80211/patches/522-mac80211_configure_antenna_gain.patch +++ b/package/kernel/mac80211/patches/522-mac80211_configure_antenna_gain.patch @@ -1,6 +1,6 @@ --- a/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.) * @get_tx_power: store the current TX power into the dbm variable; * return 0 if successful @@ -8,7 +8,7 @@ * * @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); int (*get_tx_power)(struct wiphy *wiphy, struct wireless_dev *wdev, int *dbm); -- 2.30.2