aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211
diff options
context:
space:
mode:
Diffstat (limited to 'net/mac80211')
-rw-r--r--net/mac80211/main.c5
-rw-r--r--net/mac80211/util.c16
2 files changed, 21 insertions, 0 deletions
diff --git a/net/mac80211/main.c b/net/mac80211/main.c
index b3bbe78821d9..679b3a14f11f 100644
--- a/net/mac80211/main.c
+++ b/net/mac80211/main.c
@@ -822,6 +822,7 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
822 struct net_device *mdev; 822 struct net_device *mdev;
823 struct ieee80211_master_priv *mpriv; 823 struct ieee80211_master_priv *mpriv;
824 int channels, i, j, max_bitrates; 824 int channels, i, j, max_bitrates;
825 bool supp_ht;
825 826
826 /* 827 /*
827 * generic code guarantees at least one band, 828 * generic code guarantees at least one band,
@@ -830,6 +831,7 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
830 */ 831 */
831 channels = 0; 832 channels = 0;
832 max_bitrates = 0; 833 max_bitrates = 0;
834 supp_ht = false;
833 for (band = 0; band < IEEE80211_NUM_BANDS; band++) { 835 for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
834 struct ieee80211_supported_band *sband; 836 struct ieee80211_supported_band *sband;
835 837
@@ -846,6 +848,7 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
846 848
847 if (max_bitrates < sband->n_bitrates) 849 if (max_bitrates < sband->n_bitrates)
848 max_bitrates = sband->n_bitrates; 850 max_bitrates = sband->n_bitrates;
851 supp_ht = supp_ht || sband->ht_cap.ht_supported;
849 } 852 }
850 853
851 local->int_scan_req.n_channels = channels; 854 local->int_scan_req.n_channels = channels;
@@ -872,6 +875,8 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
872 * information -- SSID is the driver's responsibility. 875 * information -- SSID is the driver's responsibility.
873 */ 876 */
874 local->scan_ies_len = 4 + max_bitrates; /* (ext) supp rates */ 877 local->scan_ies_len = 4 + max_bitrates; /* (ext) supp rates */
878 if (supp_ht)
879 local->scan_ies_len += 2 + sizeof(struct ieee80211_ht_cap);
875 880
876 if (!local->ops->hw_scan) { 881 if (!local->ops->hw_scan) {
877 /* For hw_scan, driver needs to set these up. */ 882 /* For hw_scan, driver needs to set these up. */
diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index 72b091317a7c..1ff83532120f 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -861,6 +861,22 @@ int ieee80211_build_preq_ies(struct ieee80211_local *local, u8 *buffer,
861 *pos++ = rate->bitrate / 5; 861 *pos++ = rate->bitrate / 5;
862 } 862 }
863 863
864 if (sband->ht_cap.ht_supported) {
865 __le16 tmp = cpu_to_le16(sband->ht_cap.cap);
866
867 *pos++ = WLAN_EID_HT_CAPABILITY;
868 *pos++ = sizeof(struct ieee80211_ht_cap);
869 memset(pos, 0, sizeof(struct ieee80211_ht_cap));
870 memcpy(pos, &tmp, sizeof(u16));
871 pos += sizeof(u16);
872 /* TODO: needs a define here for << 2 */
873 *pos++ = sband->ht_cap.ampdu_factor |
874 (sband->ht_cap.ampdu_density << 2);
875 memcpy(pos, &sband->ht_cap.mcs, sizeof(sband->ht_cap.mcs));
876 pos += sizeof(sband->ht_cap.mcs);
877 pos += 2 + 4 + 1; /* ext info, BF cap, antsel */
878 }
879
864 /* 880 /*
865 * If adding more here, adjust code in main.c 881 * If adding more here, adjust code in main.c
866 * that calculates local->scan_ies_len. 882 * that calculates local->scan_ies_len.