diff options
Diffstat (limited to 'net')
-rw-r--r-- | net/ieee80211/ieee80211_rx.c | 39 | ||||
-rw-r--r-- | net/ieee80211/softmac/ieee80211softmac_assoc.c | 21 | ||||
-rw-r--r-- | net/ieee80211/softmac/ieee80211softmac_io.c | 14 | ||||
-rw-r--r-- | net/ieee80211/softmac/ieee80211softmac_module.c | 90 | ||||
-rw-r--r-- | net/ieee80211/softmac/ieee80211softmac_priv.h | 8 |
5 files changed, 128 insertions, 44 deletions
diff --git a/net/ieee80211/ieee80211_rx.c b/net/ieee80211/ieee80211_rx.c index 72d4d4e04d42..d60358d702d7 100644 --- a/net/ieee80211/ieee80211_rx.c +++ b/net/ieee80211/ieee80211_rx.c | |||
@@ -779,33 +779,44 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, | |||
779 | return 0; | 779 | return 0; |
780 | } | 780 | } |
781 | 781 | ||
782 | /* Filter out unrelated packets, call ieee80211_rx[_mgt] */ | 782 | /* Filter out unrelated packets, call ieee80211_rx[_mgt] |
783 | int ieee80211_rx_any(struct ieee80211_device *ieee, | 783 | * This function takes over the skb, it should not be used again after calling |
784 | * this function. */ | ||
785 | void ieee80211_rx_any(struct ieee80211_device *ieee, | ||
784 | struct sk_buff *skb, struct ieee80211_rx_stats *stats) | 786 | struct sk_buff *skb, struct ieee80211_rx_stats *stats) |
785 | { | 787 | { |
786 | struct ieee80211_hdr_4addr *hdr; | 788 | struct ieee80211_hdr_4addr *hdr; |
787 | int is_packet_for_us; | 789 | int is_packet_for_us; |
788 | u16 fc; | 790 | u16 fc; |
789 | 791 | ||
790 | if (ieee->iw_mode == IW_MODE_MONITOR) | 792 | if (ieee->iw_mode == IW_MODE_MONITOR) { |
791 | return ieee80211_rx(ieee, skb, stats) ? 0 : -EINVAL; | 793 | if (!ieee80211_rx(ieee, skb, stats)) |
794 | dev_kfree_skb_irq(skb); | ||
795 | return; | ||
796 | } | ||
797 | |||
798 | if (skb->len < sizeof(struct ieee80211_hdr)) | ||
799 | goto drop_free; | ||
792 | 800 | ||
793 | hdr = (struct ieee80211_hdr_4addr *)skb->data; | 801 | hdr = (struct ieee80211_hdr_4addr *)skb->data; |
794 | fc = le16_to_cpu(hdr->frame_ctl); | 802 | fc = le16_to_cpu(hdr->frame_ctl); |
795 | 803 | ||
796 | if ((fc & IEEE80211_FCTL_VERS) != 0) | 804 | if ((fc & IEEE80211_FCTL_VERS) != 0) |
797 | return -EINVAL; | 805 | goto drop_free; |
798 | 806 | ||
799 | switch (fc & IEEE80211_FCTL_FTYPE) { | 807 | switch (fc & IEEE80211_FCTL_FTYPE) { |
800 | case IEEE80211_FTYPE_MGMT: | 808 | case IEEE80211_FTYPE_MGMT: |
809 | if (skb->len < sizeof(struct ieee80211_hdr_3addr)) | ||
810 | goto drop_free; | ||
801 | ieee80211_rx_mgt(ieee, hdr, stats); | 811 | ieee80211_rx_mgt(ieee, hdr, stats); |
802 | return 0; | 812 | dev_kfree_skb_irq(skb); |
813 | return; | ||
803 | case IEEE80211_FTYPE_DATA: | 814 | case IEEE80211_FTYPE_DATA: |
804 | break; | 815 | break; |
805 | case IEEE80211_FTYPE_CTL: | 816 | case IEEE80211_FTYPE_CTL: |
806 | return 0; | 817 | return; |
807 | default: | 818 | default: |
808 | return -EINVAL; | 819 | return; |
809 | } | 820 | } |
810 | 821 | ||
811 | is_packet_for_us = 0; | 822 | is_packet_for_us = 0; |
@@ -849,8 +860,14 @@ int ieee80211_rx_any(struct ieee80211_device *ieee, | |||
849 | } | 860 | } |
850 | 861 | ||
851 | if (is_packet_for_us) | 862 | if (is_packet_for_us) |
852 | return (ieee80211_rx(ieee, skb, stats) ? 0 : -EINVAL); | 863 | if (!ieee80211_rx(ieee, skb, stats)) |
853 | return 0; | 864 | dev_kfree_skb_irq(skb); |
865 | return; | ||
866 | |||
867 | drop_free: | ||
868 | dev_kfree_skb_irq(skb); | ||
869 | ieee->stats.rx_dropped++; | ||
870 | return; | ||
854 | } | 871 | } |
855 | 872 | ||
856 | #define MGMT_FRAME_FIXED_PART_LENGTH 0x24 | 873 | #define MGMT_FRAME_FIXED_PART_LENGTH 0x24 |
@@ -1166,6 +1183,7 @@ static int ieee80211_parse_info_param(struct ieee80211_info_element | |||
1166 | 1183 | ||
1167 | case MFIE_TYPE_ERP_INFO: | 1184 | case MFIE_TYPE_ERP_INFO: |
1168 | network->erp_value = info_element->data[0]; | 1185 | network->erp_value = info_element->data[0]; |
1186 | network->flags |= NETWORK_HAS_ERP_VALUE; | ||
1169 | IEEE80211_DEBUG_MGMT("MFIE_TYPE_ERP_SET: %d\n", | 1187 | IEEE80211_DEBUG_MGMT("MFIE_TYPE_ERP_SET: %d\n", |
1170 | network->erp_value); | 1188 | network->erp_value); |
1171 | break; | 1189 | break; |
@@ -1729,5 +1747,6 @@ void ieee80211_rx_mgt(struct ieee80211_device *ieee, | |||
1729 | } | 1747 | } |
1730 | } | 1748 | } |
1731 | 1749 | ||
1750 | EXPORT_SYMBOL_GPL(ieee80211_rx_any); | ||
1732 | EXPORT_SYMBOL(ieee80211_rx_mgt); | 1751 | EXPORT_SYMBOL(ieee80211_rx_mgt); |
1733 | EXPORT_SYMBOL(ieee80211_rx); | 1752 | EXPORT_SYMBOL(ieee80211_rx); |
diff --git a/net/ieee80211/softmac/ieee80211softmac_assoc.c b/net/ieee80211/softmac/ieee80211softmac_assoc.c index 44215ce64d4e..589f6d2c548a 100644 --- a/net/ieee80211/softmac/ieee80211softmac_assoc.c +++ b/net/ieee80211/softmac/ieee80211softmac_assoc.c | |||
@@ -96,7 +96,7 @@ ieee80211softmac_disassoc(struct ieee80211softmac_device *mac) | |||
96 | mac->associated = 0; | 96 | mac->associated = 0; |
97 | mac->associnfo.bssvalid = 0; | 97 | mac->associnfo.bssvalid = 0; |
98 | mac->associnfo.associating = 0; | 98 | mac->associnfo.associating = 0; |
99 | ieee80211softmac_init_txrates(mac); | 99 | ieee80211softmac_init_bss(mac); |
100 | ieee80211softmac_call_events_locked(mac, IEEE80211SOFTMAC_EVENT_DISASSOCIATED, NULL); | 100 | ieee80211softmac_call_events_locked(mac, IEEE80211SOFTMAC_EVENT_DISASSOCIATED, NULL); |
101 | spin_unlock_irqrestore(&mac->lock, flags); | 101 | spin_unlock_irqrestore(&mac->lock, flags); |
102 | } | 102 | } |
@@ -334,11 +334,19 @@ ieee80211softmac_associated(struct ieee80211softmac_device *mac, | |||
334 | struct ieee80211_assoc_response * resp, | 334 | struct ieee80211_assoc_response * resp, |
335 | struct ieee80211softmac_network *net) | 335 | struct ieee80211softmac_network *net) |
336 | { | 336 | { |
337 | u16 cap = le16_to_cpu(resp->capability); | ||
338 | u8 erp_value = net->erp_value; | ||
339 | |||
337 | mac->associnfo.associating = 0; | 340 | mac->associnfo.associating = 0; |
338 | mac->associnfo.supported_rates = net->supported_rates; | 341 | mac->bssinfo.supported_rates = net->supported_rates; |
339 | ieee80211softmac_recalc_txrates(mac); | 342 | ieee80211softmac_recalc_txrates(mac); |
340 | 343 | ||
341 | mac->associated = 1; | 344 | mac->associated = 1; |
345 | |||
346 | mac->associnfo.short_preamble_available = | ||
347 | (cap & WLAN_CAPABILITY_SHORT_PREAMBLE) != 0; | ||
348 | ieee80211softmac_process_erp(mac, erp_value); | ||
349 | |||
342 | if (mac->set_bssid_filter) | 350 | if (mac->set_bssid_filter) |
343 | mac->set_bssid_filter(mac->dev, net->bssid); | 351 | mac->set_bssid_filter(mac->dev, net->bssid); |
344 | memcpy(mac->ieee->bssid, net->bssid, ETH_ALEN); | 352 | memcpy(mac->ieee->bssid, net->bssid, ETH_ALEN); |
@@ -351,9 +359,9 @@ ieee80211softmac_associated(struct ieee80211softmac_device *mac, | |||
351 | int | 359 | int |
352 | ieee80211softmac_handle_assoc_response(struct net_device * dev, | 360 | ieee80211softmac_handle_assoc_response(struct net_device * dev, |
353 | struct ieee80211_assoc_response * resp, | 361 | struct ieee80211_assoc_response * resp, |
354 | struct ieee80211_network * _ieee80211_network_do_not_use) | 362 | struct ieee80211_network * _ieee80211_network) |
355 | { | 363 | { |
356 | /* NOTE: the network parameter has to be ignored by | 364 | /* NOTE: the network parameter has to be mostly ignored by |
357 | * this code because it is the ieee80211's pointer | 365 | * this code because it is the ieee80211's pointer |
358 | * to the struct, not ours (we made a copy) | 366 | * to the struct, not ours (we made a copy) |
359 | */ | 367 | */ |
@@ -385,6 +393,11 @@ ieee80211softmac_handle_assoc_response(struct net_device * dev, | |||
385 | /* now that we know it was for us, we can cancel the timeout */ | 393 | /* now that we know it was for us, we can cancel the timeout */ |
386 | cancel_delayed_work(&mac->associnfo.timeout); | 394 | cancel_delayed_work(&mac->associnfo.timeout); |
387 | 395 | ||
396 | /* if the association response included an ERP IE, update our saved | ||
397 | * copy */ | ||
398 | if (_ieee80211_network->flags & NETWORK_HAS_ERP_VALUE) | ||
399 | network->erp_value = _ieee80211_network->erp_value; | ||
400 | |||
388 | switch (status) { | 401 | switch (status) { |
389 | case 0: | 402 | case 0: |
390 | dprintk(KERN_INFO PFX "associated!\n"); | 403 | dprintk(KERN_INFO PFX "associated!\n"); |
diff --git a/net/ieee80211/softmac/ieee80211softmac_io.c b/net/ieee80211/softmac/ieee80211softmac_io.c index 6ae5a1dc7956..82bfddbf33a2 100644 --- a/net/ieee80211/softmac/ieee80211softmac_io.c +++ b/net/ieee80211/softmac/ieee80211softmac_io.c | |||
@@ -467,3 +467,17 @@ ieee80211softmac_send_mgt_frame(struct ieee80211softmac_device *mac, | |||
467 | kfree(pkt); | 467 | kfree(pkt); |
468 | return 0; | 468 | return 0; |
469 | } | 469 | } |
470 | |||
471 | /* Beacon handling */ | ||
472 | int ieee80211softmac_handle_beacon(struct net_device *dev, | ||
473 | struct ieee80211_beacon *beacon, | ||
474 | struct ieee80211_network *network) | ||
475 | { | ||
476 | struct ieee80211softmac_device *mac = ieee80211_priv(dev); | ||
477 | |||
478 | if (mac->associated && memcmp(network->bssid, mac->associnfo.bssid, ETH_ALEN) == 0) | ||
479 | ieee80211softmac_process_erp(mac, network->erp_value); | ||
480 | |||
481 | return 0; | ||
482 | } | ||
483 | |||
diff --git a/net/ieee80211/softmac/ieee80211softmac_module.c b/net/ieee80211/softmac/ieee80211softmac_module.c index 4b2e57d12418..addea1cf73ae 100644 --- a/net/ieee80211/softmac/ieee80211softmac_module.c +++ b/net/ieee80211/softmac/ieee80211softmac_module.c | |||
@@ -44,6 +44,7 @@ struct net_device *alloc_ieee80211softmac(int sizeof_priv) | |||
44 | softmac->ieee->handle_assoc_response = ieee80211softmac_handle_assoc_response; | 44 | softmac->ieee->handle_assoc_response = ieee80211softmac_handle_assoc_response; |
45 | softmac->ieee->handle_reassoc_request = ieee80211softmac_handle_reassoc_req; | 45 | softmac->ieee->handle_reassoc_request = ieee80211softmac_handle_reassoc_req; |
46 | softmac->ieee->handle_disassoc = ieee80211softmac_handle_disassoc; | 46 | softmac->ieee->handle_disassoc = ieee80211softmac_handle_disassoc; |
47 | softmac->ieee->handle_beacon = ieee80211softmac_handle_beacon; | ||
47 | softmac->scaninfo = NULL; | 48 | softmac->scaninfo = NULL; |
48 | 49 | ||
49 | softmac->associnfo.scan_retry = IEEE80211SOFTMAC_ASSOC_SCAN_RETRY_LIMIT; | 50 | softmac->associnfo.scan_retry = IEEE80211SOFTMAC_ASSOC_SCAN_RETRY_LIMIT; |
@@ -178,21 +179,14 @@ int ieee80211softmac_ratesinfo_rate_supported(struct ieee80211softmac_ratesinfo | |||
178 | return 0; | 179 | return 0; |
179 | } | 180 | } |
180 | 181 | ||
181 | /* Finds the highest rate which is: | 182 | u8 ieee80211softmac_highest_supported_rate(struct ieee80211softmac_device *mac, |
182 | * 1. Present in ri (optionally a basic rate) | ||
183 | * 2. Supported by the device | ||
184 | * 3. Less than or equal to the user-defined rate | ||
185 | */ | ||
186 | static u8 highest_supported_rate(struct ieee80211softmac_device *mac, | ||
187 | struct ieee80211softmac_ratesinfo *ri, int basic_only) | 183 | struct ieee80211softmac_ratesinfo *ri, int basic_only) |
188 | { | 184 | { |
189 | u8 user_rate = mac->txrates.user_rate; | 185 | u8 user_rate = mac->txrates.user_rate; |
190 | int i; | 186 | int i; |
191 | 187 | ||
192 | if (ri->count == 0) { | 188 | if (ri->count == 0) |
193 | dprintk(KERN_ERR PFX "empty ratesinfo?\n"); | ||
194 | return IEEE80211_CCK_RATE_1MB; | 189 | return IEEE80211_CCK_RATE_1MB; |
195 | } | ||
196 | 190 | ||
197 | for (i = ri->count - 1; i >= 0; i--) { | 191 | for (i = ri->count - 1; i >= 0; i--) { |
198 | u8 rate = ri->rates[i]; | 192 | u8 rate = ri->rates[i]; |
@@ -208,36 +202,61 @@ static u8 highest_supported_rate(struct ieee80211softmac_device *mac, | |||
208 | /* If we haven't found a suitable rate by now, just trust the user */ | 202 | /* If we haven't found a suitable rate by now, just trust the user */ |
209 | return user_rate; | 203 | return user_rate; |
210 | } | 204 | } |
205 | EXPORT_SYMBOL_GPL(ieee80211softmac_highest_supported_rate); | ||
206 | |||
207 | void ieee80211softmac_process_erp(struct ieee80211softmac_device *mac, | ||
208 | u8 erp_value) | ||
209 | { | ||
210 | int use_protection; | ||
211 | int short_preamble; | ||
212 | u32 changes = 0; | ||
213 | |||
214 | /* Barker preamble mode */ | ||
215 | short_preamble = ((erp_value & WLAN_ERP_BARKER_PREAMBLE) == 0 | ||
216 | && mac->associnfo.short_preamble_available) ? 1 : 0; | ||
217 | |||
218 | /* Protection needed? */ | ||
219 | use_protection = (erp_value & WLAN_ERP_USE_PROTECTION) != 0; | ||
220 | |||
221 | if (mac->bssinfo.short_preamble != short_preamble) { | ||
222 | changes |= IEEE80211SOFTMAC_BSSINFOCHG_SHORT_PREAMBLE; | ||
223 | mac->bssinfo.short_preamble = short_preamble; | ||
224 | } | ||
225 | |||
226 | if (mac->bssinfo.use_protection != use_protection) { | ||
227 | changes |= IEEE80211SOFTMAC_BSSINFOCHG_PROTECTION; | ||
228 | mac->bssinfo.use_protection = use_protection; | ||
229 | } | ||
230 | |||
231 | if (mac->bssinfo_change && changes) | ||
232 | mac->bssinfo_change(mac->dev, changes); | ||
233 | } | ||
211 | 234 | ||
212 | void ieee80211softmac_recalc_txrates(struct ieee80211softmac_device *mac) | 235 | void ieee80211softmac_recalc_txrates(struct ieee80211softmac_device *mac) |
213 | { | 236 | { |
214 | struct ieee80211softmac_txrates *txrates = &mac->txrates; | 237 | struct ieee80211softmac_txrates *txrates = &mac->txrates; |
215 | struct ieee80211softmac_txrates oldrates; | ||
216 | u32 change = 0; | 238 | u32 change = 0; |
217 | 239 | ||
218 | if (mac->txrates_change) | ||
219 | oldrates = mac->txrates; | ||
220 | |||
221 | change |= IEEE80211SOFTMAC_TXRATECHG_DEFAULT; | 240 | change |= IEEE80211SOFTMAC_TXRATECHG_DEFAULT; |
222 | txrates->default_rate = highest_supported_rate(mac, &mac->associnfo.supported_rates, 0); | 241 | txrates->default_rate = ieee80211softmac_highest_supported_rate(mac, &mac->bssinfo.supported_rates, 0); |
223 | 242 | ||
224 | change |= IEEE80211SOFTMAC_TXRATECHG_DEFAULT_FBACK; | 243 | change |= IEEE80211SOFTMAC_TXRATECHG_DEFAULT_FBACK; |
225 | txrates->default_fallback = lower_rate(mac, txrates->default_rate); | 244 | txrates->default_fallback = lower_rate(mac, txrates->default_rate); |
226 | 245 | ||
227 | change |= IEEE80211SOFTMAC_TXRATECHG_MCAST; | 246 | change |= IEEE80211SOFTMAC_TXRATECHG_MCAST; |
228 | txrates->mcast_rate = highest_supported_rate(mac, &mac->associnfo.supported_rates, 1); | 247 | txrates->mcast_rate = ieee80211softmac_highest_supported_rate(mac, &mac->bssinfo.supported_rates, 1); |
229 | 248 | ||
230 | if (mac->txrates_change) | 249 | if (mac->txrates_change) |
231 | mac->txrates_change(mac->dev, change, &oldrates); | 250 | mac->txrates_change(mac->dev, change); |
232 | 251 | ||
233 | } | 252 | } |
234 | 253 | ||
235 | void ieee80211softmac_init_txrates(struct ieee80211softmac_device *mac) | 254 | void ieee80211softmac_init_bss(struct ieee80211softmac_device *mac) |
236 | { | 255 | { |
237 | struct ieee80211_device *ieee = mac->ieee; | 256 | struct ieee80211_device *ieee = mac->ieee; |
238 | u32 change = 0; | 257 | u32 change = 0; |
239 | struct ieee80211softmac_txrates *txrates = &mac->txrates; | 258 | struct ieee80211softmac_txrates *txrates = &mac->txrates; |
240 | struct ieee80211softmac_txrates oldrates; | 259 | struct ieee80211softmac_bss_info *bssinfo = &mac->bssinfo; |
241 | 260 | ||
242 | /* TODO: We need some kind of state machine to lower the default rates | 261 | /* TODO: We need some kind of state machine to lower the default rates |
243 | * if we loose too many packets. | 262 | * if we loose too many packets. |
@@ -245,8 +264,6 @@ void ieee80211softmac_init_txrates(struct ieee80211softmac_device *mac) | |||
245 | /* Change the default txrate to the highest possible value. | 264 | /* Change the default txrate to the highest possible value. |
246 | * The txrate machine will lower it, if it is too high. | 265 | * The txrate machine will lower it, if it is too high. |
247 | */ | 266 | */ |
248 | if (mac->txrates_change) | ||
249 | oldrates = mac->txrates; | ||
250 | /* FIXME: We don't correctly handle backing down to lower | 267 | /* FIXME: We don't correctly handle backing down to lower |
251 | rates, so 801.11g devices start off at 11M for now. People | 268 | rates, so 801.11g devices start off at 11M for now. People |
252 | can manually change it if they really need to, but 11M is | 269 | can manually change it if they really need to, but 11M is |
@@ -272,7 +289,23 @@ void ieee80211softmac_init_txrates(struct ieee80211softmac_device *mac) | |||
272 | change |= IEEE80211SOFTMAC_TXRATECHG_MGT_MCAST; | 289 | change |= IEEE80211SOFTMAC_TXRATECHG_MGT_MCAST; |
273 | 290 | ||
274 | if (mac->txrates_change) | 291 | if (mac->txrates_change) |
275 | mac->txrates_change(mac->dev, change, &oldrates); | 292 | mac->txrates_change(mac->dev, change); |
293 | |||
294 | change = 0; | ||
295 | |||
296 | bssinfo->supported_rates.count = 0; | ||
297 | memset(bssinfo->supported_rates.rates, 0, | ||
298 | sizeof(bssinfo->supported_rates.rates)); | ||
299 | change |= IEEE80211SOFTMAC_BSSINFOCHG_RATES; | ||
300 | |||
301 | bssinfo->short_preamble = 0; | ||
302 | change |= IEEE80211SOFTMAC_BSSINFOCHG_SHORT_PREAMBLE; | ||
303 | |||
304 | bssinfo->use_protection = 0; | ||
305 | change |= IEEE80211SOFTMAC_BSSINFOCHG_PROTECTION; | ||
306 | |||
307 | if (mac->bssinfo_change) | ||
308 | mac->bssinfo_change(mac->dev, change); | ||
276 | 309 | ||
277 | mac->running = 1; | 310 | mac->running = 1; |
278 | } | 311 | } |
@@ -282,7 +315,7 @@ void ieee80211softmac_start(struct net_device *dev) | |||
282 | struct ieee80211softmac_device *mac = ieee80211_priv(dev); | 315 | struct ieee80211softmac_device *mac = ieee80211_priv(dev); |
283 | 316 | ||
284 | ieee80211softmac_start_check_rates(mac); | 317 | ieee80211softmac_start_check_rates(mac); |
285 | ieee80211softmac_init_txrates(mac); | 318 | ieee80211softmac_init_bss(mac); |
286 | } | 319 | } |
287 | EXPORT_SYMBOL_GPL(ieee80211softmac_start); | 320 | EXPORT_SYMBOL_GPL(ieee80211softmac_start); |
288 | 321 | ||
@@ -335,7 +368,6 @@ u8 ieee80211softmac_lower_rate_delta(struct ieee80211softmac_device *mac, u8 rat | |||
335 | static void ieee80211softmac_add_txrates_badness(struct ieee80211softmac_device *mac, | 368 | static void ieee80211softmac_add_txrates_badness(struct ieee80211softmac_device *mac, |
336 | int amount) | 369 | int amount) |
337 | { | 370 | { |
338 | struct ieee80211softmac_txrates oldrates; | ||
339 | u8 default_rate = mac->txrates.default_rate; | 371 | u8 default_rate = mac->txrates.default_rate; |
340 | u8 default_fallback = mac->txrates.default_fallback; | 372 | u8 default_fallback = mac->txrates.default_fallback; |
341 | u32 changes = 0; | 373 | u32 changes = 0; |
@@ -348,8 +380,6 @@ printk("badness %d\n", mac->txrate_badness); | |||
348 | mac->txrate_badness += amount; | 380 | mac->txrate_badness += amount; |
349 | if (mac->txrate_badness <= -1000) { | 381 | if (mac->txrate_badness <= -1000) { |
350 | /* Very small badness. Try a faster bitrate. */ | 382 | /* Very small badness. Try a faster bitrate. */ |
351 | if (mac->txrates_change) | ||
352 | memcpy(&oldrates, &mac->txrates, sizeof(oldrates)); | ||
353 | default_rate = raise_rate(mac, default_rate); | 383 | default_rate = raise_rate(mac, default_rate); |
354 | changes |= IEEE80211SOFTMAC_TXRATECHG_DEFAULT; | 384 | changes |= IEEE80211SOFTMAC_TXRATECHG_DEFAULT; |
355 | default_fallback = get_fallback_rate(mac, default_rate); | 385 | default_fallback = get_fallback_rate(mac, default_rate); |
@@ -358,8 +388,6 @@ printk("badness %d\n", mac->txrate_badness); | |||
358 | printk("Bitrate raised to %u\n", default_rate); | 388 | printk("Bitrate raised to %u\n", default_rate); |
359 | } else if (mac->txrate_badness >= 10000) { | 389 | } else if (mac->txrate_badness >= 10000) { |
360 | /* Very high badness. Try a slower bitrate. */ | 390 | /* Very high badness. Try a slower bitrate. */ |
361 | if (mac->txrates_change) | ||
362 | memcpy(&oldrates, &mac->txrates, sizeof(oldrates)); | ||
363 | default_rate = lower_rate(mac, default_rate); | 391 | default_rate = lower_rate(mac, default_rate); |
364 | changes |= IEEE80211SOFTMAC_TXRATECHG_DEFAULT; | 392 | changes |= IEEE80211SOFTMAC_TXRATECHG_DEFAULT; |
365 | default_fallback = get_fallback_rate(mac, default_rate); | 393 | default_fallback = get_fallback_rate(mac, default_rate); |
@@ -372,7 +400,7 @@ printk("Bitrate lowered to %u\n", default_rate); | |||
372 | mac->txrates.default_fallback = default_fallback; | 400 | mac->txrates.default_fallback = default_fallback; |
373 | 401 | ||
374 | if (changes && mac->txrates_change) | 402 | if (changes && mac->txrates_change) |
375 | mac->txrates_change(mac->dev, changes, &oldrates); | 403 | mac->txrates_change(mac->dev, changes); |
376 | } | 404 | } |
377 | 405 | ||
378 | void ieee80211softmac_fragment_lost(struct net_device *dev, | 406 | void ieee80211softmac_fragment_lost(struct net_device *dev, |
@@ -416,7 +444,11 @@ ieee80211softmac_create_network(struct ieee80211softmac_device *mac, | |||
416 | memcpy(&softnet->supported_rates.rates[softnet->supported_rates.count], net->rates_ex, net->rates_ex_len); | 444 | memcpy(&softnet->supported_rates.rates[softnet->supported_rates.count], net->rates_ex, net->rates_ex_len); |
417 | softnet->supported_rates.count += net->rates_ex_len; | 445 | softnet->supported_rates.count += net->rates_ex_len; |
418 | sort(softnet->supported_rates.rates, softnet->supported_rates.count, sizeof(softnet->supported_rates.rates[0]), rate_cmp, NULL); | 446 | sort(softnet->supported_rates.rates, softnet->supported_rates.count, sizeof(softnet->supported_rates.rates[0]), rate_cmp, NULL); |
419 | 447 | ||
448 | /* we save the ERP value because it is needed at association time, and | ||
449 | * many AP's do not include an ERP IE in the association response. */ | ||
450 | softnet->erp_value = net->erp_value; | ||
451 | |||
420 | softnet->capabilities = net->capability; | 452 | softnet->capabilities = net->capability; |
421 | return softnet; | 453 | return softnet; |
422 | } | 454 | } |
diff --git a/net/ieee80211/softmac/ieee80211softmac_priv.h b/net/ieee80211/softmac/ieee80211softmac_priv.h index fa1f8e3acfc0..0642e090b8a7 100644 --- a/net/ieee80211/softmac/ieee80211softmac_priv.h +++ b/net/ieee80211/softmac/ieee80211softmac_priv.h | |||
@@ -116,9 +116,11 @@ ieee80211softmac_get_network_by_essid(struct ieee80211softmac_device *mac, | |||
116 | struct ieee80211softmac_essid *essid); | 116 | struct ieee80211softmac_essid *essid); |
117 | 117 | ||
118 | /* Rates related */ | 118 | /* Rates related */ |
119 | void ieee80211softmac_process_erp(struct ieee80211softmac_device *mac, | ||
120 | u8 erp_value); | ||
119 | int ieee80211softmac_ratesinfo_rate_supported(struct ieee80211softmac_ratesinfo *ri, u8 rate); | 121 | int ieee80211softmac_ratesinfo_rate_supported(struct ieee80211softmac_ratesinfo *ri, u8 rate); |
120 | u8 ieee80211softmac_lower_rate_delta(struct ieee80211softmac_device *mac, u8 rate, int delta); | 122 | u8 ieee80211softmac_lower_rate_delta(struct ieee80211softmac_device *mac, u8 rate, int delta); |
121 | void ieee80211softmac_init_txrates(struct ieee80211softmac_device *mac); | 123 | void ieee80211softmac_init_bss(struct ieee80211softmac_device *mac); |
122 | void ieee80211softmac_recalc_txrates(struct ieee80211softmac_device *mac); | 124 | void ieee80211softmac_recalc_txrates(struct ieee80211softmac_device *mac); |
123 | static inline u8 lower_rate(struct ieee80211softmac_device *mac, u8 rate) { | 125 | static inline u8 lower_rate(struct ieee80211softmac_device *mac, u8 rate) { |
124 | return ieee80211softmac_lower_rate_delta(mac, rate, 1); | 126 | return ieee80211softmac_lower_rate_delta(mac, rate, 1); |
@@ -133,6 +135,9 @@ static inline u8 get_fallback_rate(struct ieee80211softmac_device *mac, u8 rate) | |||
133 | /*** prototypes from _io.c */ | 135 | /*** prototypes from _io.c */ |
134 | int ieee80211softmac_send_mgt_frame(struct ieee80211softmac_device *mac, | 136 | int ieee80211softmac_send_mgt_frame(struct ieee80211softmac_device *mac, |
135 | void* ptrarg, u32 type, u32 arg); | 137 | void* ptrarg, u32 type, u32 arg); |
138 | int ieee80211softmac_handle_beacon(struct net_device *dev, | ||
139 | struct ieee80211_beacon *beacon, | ||
140 | struct ieee80211_network *network); | ||
136 | 141 | ||
137 | /*** prototypes from _auth.c */ | 142 | /*** prototypes from _auth.c */ |
138 | /* do these have to go into the public header? */ | 143 | /* do these have to go into the public header? */ |
@@ -189,6 +194,7 @@ struct ieee80211softmac_network { | |||
189 | authenticated:1, | 194 | authenticated:1, |
190 | auth_desynced_once:1; | 195 | auth_desynced_once:1; |
191 | 196 | ||
197 | u8 erp_value; /* Saved ERP value */ | ||
192 | u16 capabilities; /* Capabilities bitfield */ | 198 | u16 capabilities; /* Capabilities bitfield */ |
193 | u8 challenge_len; /* Auth Challenge length */ | 199 | u8 challenge_len; /* Auth Challenge length */ |
194 | char *challenge; /* Challenge Text */ | 200 | char *challenge; /* Challenge Text */ |