diff options
Diffstat (limited to 'net')
-rw-r--r-- | net/mac80211/ht.c | 83 | ||||
-rw-r--r-- | net/mac80211/ieee80211_i.h | 3 | ||||
-rw-r--r-- | net/mac80211/mlme.c | 83 |
3 files changed, 83 insertions, 86 deletions
diff --git a/net/mac80211/ht.c b/net/mac80211/ht.c index 4e3c72f20de7..73bd427750ef 100644 --- a/net/mac80211/ht.c +++ b/net/mac80211/ht.c | |||
@@ -83,89 +83,6 @@ void ieee80211_ht_cap_ie_to_sta_ht_cap(struct ieee80211_supported_band *sband, | |||
83 | ht_cap->mcs.rx_mask[32/8] |= 1; | 83 | ht_cap->mcs.rx_mask[32/8] |= 1; |
84 | } | 84 | } |
85 | 85 | ||
86 | /* | ||
87 | * ieee80211_enable_ht should be called only after the operating band | ||
88 | * has been determined as ht configuration depends on the hw's | ||
89 | * HT abilities for a specific band. | ||
90 | */ | ||
91 | u32 ieee80211_enable_ht(struct ieee80211_sub_if_data *sdata, | ||
92 | struct ieee80211_ht_info *hti, | ||
93 | u16 ap_ht_cap_flags) | ||
94 | { | ||
95 | struct ieee80211_local *local = sdata->local; | ||
96 | struct ieee80211_supported_band *sband; | ||
97 | struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; | ||
98 | struct ieee80211_bss_ht_conf ht; | ||
99 | struct sta_info *sta; | ||
100 | u32 changed = 0; | ||
101 | bool enable_ht = true, ht_changed; | ||
102 | enum nl80211_channel_type channel_type = NL80211_CHAN_NO_HT; | ||
103 | |||
104 | sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; | ||
105 | |||
106 | memset(&ht, 0, sizeof(ht)); | ||
107 | |||
108 | /* HT is not supported */ | ||
109 | if (!sband->ht_cap.ht_supported) | ||
110 | enable_ht = false; | ||
111 | |||
112 | /* check that channel matches the right operating channel */ | ||
113 | if (local->hw.conf.channel->center_freq != | ||
114 | ieee80211_channel_to_frequency(hti->control_chan)) | ||
115 | enable_ht = false; | ||
116 | |||
117 | if (enable_ht) { | ||
118 | channel_type = NL80211_CHAN_HT20; | ||
119 | |||
120 | if (!(ap_ht_cap_flags & IEEE80211_HT_CAP_40MHZ_INTOLERANT) && | ||
121 | (sband->ht_cap.cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40) && | ||
122 | (hti->ht_param & IEEE80211_HT_PARAM_CHAN_WIDTH_ANY)) { | ||
123 | switch(hti->ht_param & IEEE80211_HT_PARAM_CHA_SEC_OFFSET) { | ||
124 | case IEEE80211_HT_PARAM_CHA_SEC_ABOVE: | ||
125 | channel_type = NL80211_CHAN_HT40PLUS; | ||
126 | break; | ||
127 | case IEEE80211_HT_PARAM_CHA_SEC_BELOW: | ||
128 | channel_type = NL80211_CHAN_HT40MINUS; | ||
129 | break; | ||
130 | } | ||
131 | } | ||
132 | } | ||
133 | |||
134 | ht_changed = conf_is_ht(&local->hw.conf) != enable_ht || | ||
135 | channel_type != local->hw.conf.channel_type; | ||
136 | |||
137 | local->oper_channel_type = channel_type; | ||
138 | |||
139 | if (ht_changed) { | ||
140 | /* channel_type change automatically detected */ | ||
141 | ieee80211_hw_config(local, 0); | ||
142 | |||
143 | rcu_read_lock(); | ||
144 | |||
145 | sta = sta_info_get(local, ifmgd->bssid); | ||
146 | if (sta) | ||
147 | rate_control_rate_update(local, sband, sta, | ||
148 | IEEE80211_RC_HT_CHANGED); | ||
149 | |||
150 | rcu_read_unlock(); | ||
151 | |||
152 | } | ||
153 | |||
154 | /* disable HT */ | ||
155 | if (!enable_ht) | ||
156 | return 0; | ||
157 | |||
158 | ht.operation_mode = le16_to_cpu(hti->operation_mode); | ||
159 | |||
160 | /* if bss configuration changed store the new one */ | ||
161 | if (memcmp(&sdata->vif.bss_conf.ht, &ht, sizeof(ht))) { | ||
162 | changed |= BSS_CHANGED_HT; | ||
163 | sdata->vif.bss_conf.ht = ht; | ||
164 | } | ||
165 | |||
166 | return changed; | ||
167 | } | ||
168 | |||
169 | void ieee80211_sta_tear_down_BA_sessions(struct sta_info *sta) | 86 | void ieee80211_sta_tear_down_BA_sessions(struct sta_info *sta) |
170 | { | 87 | { |
171 | int i; | 88 | int i; |
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index 312347d102c8..73d9f894ed5d 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h | |||
@@ -995,9 +995,6 @@ int ieee80211_subif_start_xmit(struct sk_buff *skb, struct net_device *dev); | |||
995 | void ieee80211_ht_cap_ie_to_sta_ht_cap(struct ieee80211_supported_band *sband, | 995 | void ieee80211_ht_cap_ie_to_sta_ht_cap(struct ieee80211_supported_band *sband, |
996 | struct ieee80211_ht_cap *ht_cap_ie, | 996 | struct ieee80211_ht_cap *ht_cap_ie, |
997 | struct ieee80211_sta_ht_cap *ht_cap); | 997 | struct ieee80211_sta_ht_cap *ht_cap); |
998 | u32 ieee80211_enable_ht(struct ieee80211_sub_if_data *sdata, | ||
999 | struct ieee80211_ht_info *hti, | ||
1000 | u16 ap_ht_cap_flags); | ||
1001 | void ieee80211_send_bar(struct ieee80211_sub_if_data *sdata, u8 *ra, u16 tid, u16 ssn); | 998 | void ieee80211_send_bar(struct ieee80211_sub_if_data *sdata, u8 *ra, u16 tid, u16 ssn); |
1002 | void ieee80211_send_delba(struct ieee80211_sub_if_data *sdata, | 999 | void ieee80211_send_delba(struct ieee80211_sub_if_data *sdata, |
1003 | const u8 *da, u16 tid, | 1000 | const u8 *da, u16 tid, |
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index 08db02c237c9..4ce5b9c22324 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c | |||
@@ -80,6 +80,89 @@ static int ieee80211_compatible_rates(struct ieee80211_bss *bss, | |||
80 | return count; | 80 | return count; |
81 | } | 81 | } |
82 | 82 | ||
83 | /* | ||
84 | * ieee80211_enable_ht should be called only after the operating band | ||
85 | * has been determined as ht configuration depends on the hw's | ||
86 | * HT abilities for a specific band. | ||
87 | */ | ||
88 | static u32 ieee80211_enable_ht(struct ieee80211_sub_if_data *sdata, | ||
89 | struct ieee80211_ht_info *hti, | ||
90 | u16 ap_ht_cap_flags) | ||
91 | { | ||
92 | struct ieee80211_local *local = sdata->local; | ||
93 | struct ieee80211_supported_band *sband; | ||
94 | struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; | ||
95 | struct ieee80211_bss_ht_conf ht; | ||
96 | struct sta_info *sta; | ||
97 | u32 changed = 0; | ||
98 | bool enable_ht = true, ht_changed; | ||
99 | enum nl80211_channel_type channel_type = NL80211_CHAN_NO_HT; | ||
100 | |||
101 | sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; | ||
102 | |||
103 | memset(&ht, 0, sizeof(ht)); | ||
104 | |||
105 | /* HT is not supported */ | ||
106 | if (!sband->ht_cap.ht_supported) | ||
107 | enable_ht = false; | ||
108 | |||
109 | /* check that channel matches the right operating channel */ | ||
110 | if (local->hw.conf.channel->center_freq != | ||
111 | ieee80211_channel_to_frequency(hti->control_chan)) | ||
112 | enable_ht = false; | ||
113 | |||
114 | if (enable_ht) { | ||
115 | channel_type = NL80211_CHAN_HT20; | ||
116 | |||
117 | if (!(ap_ht_cap_flags & IEEE80211_HT_CAP_40MHZ_INTOLERANT) && | ||
118 | (sband->ht_cap.cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40) && | ||
119 | (hti->ht_param & IEEE80211_HT_PARAM_CHAN_WIDTH_ANY)) { | ||
120 | switch(hti->ht_param & IEEE80211_HT_PARAM_CHA_SEC_OFFSET) { | ||
121 | case IEEE80211_HT_PARAM_CHA_SEC_ABOVE: | ||
122 | channel_type = NL80211_CHAN_HT40PLUS; | ||
123 | break; | ||
124 | case IEEE80211_HT_PARAM_CHA_SEC_BELOW: | ||
125 | channel_type = NL80211_CHAN_HT40MINUS; | ||
126 | break; | ||
127 | } | ||
128 | } | ||
129 | } | ||
130 | |||
131 | ht_changed = conf_is_ht(&local->hw.conf) != enable_ht || | ||
132 | channel_type != local->hw.conf.channel_type; | ||
133 | |||
134 | local->oper_channel_type = channel_type; | ||
135 | |||
136 | if (ht_changed) { | ||
137 | /* channel_type change automatically detected */ | ||
138 | ieee80211_hw_config(local, 0); | ||
139 | |||
140 | rcu_read_lock(); | ||
141 | |||
142 | sta = sta_info_get(local, ifmgd->bssid); | ||
143 | if (sta) | ||
144 | rate_control_rate_update(local, sband, sta, | ||
145 | IEEE80211_RC_HT_CHANGED); | ||
146 | |||
147 | rcu_read_unlock(); | ||
148 | |||
149 | } | ||
150 | |||
151 | /* disable HT */ | ||
152 | if (!enable_ht) | ||
153 | return 0; | ||
154 | |||
155 | ht.operation_mode = le16_to_cpu(hti->operation_mode); | ||
156 | |||
157 | /* if bss configuration changed store the new one */ | ||
158 | if (memcmp(&sdata->vif.bss_conf.ht, &ht, sizeof(ht))) { | ||
159 | changed |= BSS_CHANGED_HT; | ||
160 | sdata->vif.bss_conf.ht = ht; | ||
161 | } | ||
162 | |||
163 | return changed; | ||
164 | } | ||
165 | |||
83 | /* frame sending functions */ | 166 | /* frame sending functions */ |
84 | 167 | ||
85 | static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata) | 168 | static void ieee80211_send_assoc(struct ieee80211_sub_if_data *sdata) |