diff options
author | Andrea Bastoni <bastoni@cs.unc.edu> | 2010-05-30 19:16:45 -0400 |
---|---|---|
committer | Andrea Bastoni <bastoni@cs.unc.edu> | 2010-05-30 19:16:45 -0400 |
commit | ada47b5fe13d89735805b566185f4885f5a3f750 (patch) | |
tree | 644b88f8a71896307d71438e9b3af49126ffb22b /drivers/net/wireless/iwlwifi/iwl-3945-rs.c | |
parent | 43e98717ad40a4ae64545b5ba047c7b86aa44f4f (diff) | |
parent | 3280f21d43ee541f97f8cda5792150d2dbec20d5 (diff) |
Merge branch 'wip-2.6.34' into old-private-masterarchived-private-master
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-3945-rs.c')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-3945-rs.c | 105 |
1 files changed, 30 insertions, 75 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c index cbb0585083a9..902c4d4293e9 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c +++ b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /****************************************************************************** | 1 | /****************************************************************************** |
2 | * | 2 | * |
3 | * Copyright(c) 2005 - 2009 Intel Corporation. All rights reserved. | 3 | * Copyright(c) 2005 - 2010 Intel Corporation. All rights reserved. |
4 | * | 4 | * |
5 | * This program is free software; you can redistribute it and/or modify it | 5 | * This program is free software; you can redistribute it and/or modify it |
6 | * under the terms of version 2 of the GNU General Public License as | 6 | * under the terms of version 2 of the GNU General Public License as |
@@ -27,6 +27,7 @@ | |||
27 | #include <linux/kernel.h> | 27 | #include <linux/kernel.h> |
28 | #include <linux/init.h> | 28 | #include <linux/init.h> |
29 | #include <linux/skbuff.h> | 29 | #include <linux/skbuff.h> |
30 | #include <linux/slab.h> | ||
30 | #include <linux/wireless.h> | 31 | #include <linux/wireless.h> |
31 | #include <net/mac80211.h> | 32 | #include <net/mac80211.h> |
32 | 33 | ||
@@ -42,38 +43,6 @@ | |||
42 | 43 | ||
43 | #define RS_NAME "iwl-3945-rs" | 44 | #define RS_NAME "iwl-3945-rs" |
44 | 45 | ||
45 | struct iwl3945_rate_scale_data { | ||
46 | u64 data; | ||
47 | s32 success_counter; | ||
48 | s32 success_ratio; | ||
49 | s32 counter; | ||
50 | s32 average_tpt; | ||
51 | unsigned long stamp; | ||
52 | }; | ||
53 | |||
54 | struct iwl3945_rs_sta { | ||
55 | spinlock_t lock; | ||
56 | struct iwl_priv *priv; | ||
57 | s32 *expected_tpt; | ||
58 | unsigned long last_partial_flush; | ||
59 | unsigned long last_flush; | ||
60 | u32 flush_time; | ||
61 | u32 last_tx_packets; | ||
62 | u32 tx_packets; | ||
63 | u8 tgg; | ||
64 | u8 flush_pending; | ||
65 | u8 start_rate; | ||
66 | u8 ibss_sta_added; | ||
67 | struct timer_list rate_scale_flush; | ||
68 | struct iwl3945_rate_scale_data win[IWL_RATE_COUNT_3945]; | ||
69 | #ifdef CONFIG_MAC80211_DEBUGFS | ||
70 | struct dentry *rs_sta_dbgfs_stats_table_file; | ||
71 | #endif | ||
72 | |||
73 | /* used to be in sta_info */ | ||
74 | int last_txrate_idx; | ||
75 | }; | ||
76 | |||
77 | static s32 iwl3945_expected_tpt_g[IWL_RATE_COUNT_3945] = { | 46 | static s32 iwl3945_expected_tpt_g[IWL_RATE_COUNT_3945] = { |
78 | 7, 13, 35, 58, 0, 0, 76, 104, 130, 168, 191, 202 | 47 | 7, 13, 35, 58, 0, 0, 76, 104, 130, 168, 191, 202 |
79 | }; | 48 | }; |
@@ -370,6 +339,28 @@ static void rs_rate_init(void *priv_r, struct ieee80211_supported_band *sband, | |||
370 | 339 | ||
371 | IWL_DEBUG_RATE(priv, "enter\n"); | 340 | IWL_DEBUG_RATE(priv, "enter\n"); |
372 | 341 | ||
342 | spin_lock_init(&rs_sta->lock); | ||
343 | |||
344 | rs_sta->priv = priv; | ||
345 | |||
346 | rs_sta->start_rate = IWL_RATE_INVALID; | ||
347 | |||
348 | /* default to just 802.11b */ | ||
349 | rs_sta->expected_tpt = iwl3945_expected_tpt_b; | ||
350 | |||
351 | rs_sta->last_partial_flush = jiffies; | ||
352 | rs_sta->last_flush = jiffies; | ||
353 | rs_sta->flush_time = IWL_RATE_FLUSH; | ||
354 | rs_sta->last_tx_packets = 0; | ||
355 | rs_sta->ibss_sta_added = 0; | ||
356 | |||
357 | init_timer(&rs_sta->rate_scale_flush); | ||
358 | rs_sta->rate_scale_flush.data = (unsigned long)rs_sta; | ||
359 | rs_sta->rate_scale_flush.function = iwl3945_bg_rate_scale_flush; | ||
360 | |||
361 | for (i = 0; i < IWL_RATE_COUNT_3945; i++) | ||
362 | iwl3945_clear_window(&rs_sta->win[i]); | ||
363 | |||
373 | /* TODO: what is a good starting rate for STA? About middle? Maybe not | 364 | /* TODO: what is a good starting rate for STA? About middle? Maybe not |
374 | * the lowest or the highest rate.. Could consider using RSSI from | 365 | * the lowest or the highest rate.. Could consider using RSSI from |
375 | * previous packets? Need to have IEEE 802.1X auth succeed immediately | 366 | * previous packets? Need to have IEEE 802.1X auth succeed immediately |
@@ -409,45 +400,11 @@ static void *rs_alloc_sta(void *iwl_priv, struct ieee80211_sta *sta, gfp_t gfp) | |||
409 | { | 400 | { |
410 | struct iwl3945_rs_sta *rs_sta; | 401 | struct iwl3945_rs_sta *rs_sta; |
411 | struct iwl3945_sta_priv *psta = (void *) sta->drv_priv; | 402 | struct iwl3945_sta_priv *psta = (void *) sta->drv_priv; |
412 | struct iwl_priv *priv = iwl_priv; | 403 | struct iwl_priv *priv __maybe_unused = iwl_priv; |
413 | int i; | ||
414 | |||
415 | /* | ||
416 | * XXX: If it's using sta->drv_priv anyway, it might | ||
417 | * as well just put all the information there. | ||
418 | */ | ||
419 | 404 | ||
420 | IWL_DEBUG_RATE(priv, "enter\n"); | 405 | IWL_DEBUG_RATE(priv, "enter\n"); |
421 | 406 | ||
422 | rs_sta = kzalloc(sizeof(struct iwl3945_rs_sta), gfp); | 407 | rs_sta = &psta->rs_sta; |
423 | if (!rs_sta) { | ||
424 | IWL_DEBUG_RATE(priv, "leave: ENOMEM\n"); | ||
425 | return NULL; | ||
426 | } | ||
427 | |||
428 | psta->rs_sta = rs_sta; | ||
429 | |||
430 | spin_lock_init(&rs_sta->lock); | ||
431 | |||
432 | rs_sta->priv = priv; | ||
433 | |||
434 | rs_sta->start_rate = IWL_RATE_INVALID; | ||
435 | |||
436 | /* default to just 802.11b */ | ||
437 | rs_sta->expected_tpt = iwl3945_expected_tpt_b; | ||
438 | |||
439 | rs_sta->last_partial_flush = jiffies; | ||
440 | rs_sta->last_flush = jiffies; | ||
441 | rs_sta->flush_time = IWL_RATE_FLUSH; | ||
442 | rs_sta->last_tx_packets = 0; | ||
443 | rs_sta->ibss_sta_added = 0; | ||
444 | |||
445 | init_timer(&rs_sta->rate_scale_flush); | ||
446 | rs_sta->rate_scale_flush.data = (unsigned long)rs_sta; | ||
447 | rs_sta->rate_scale_flush.function = &iwl3945_bg_rate_scale_flush; | ||
448 | |||
449 | for (i = 0; i < IWL_RATE_COUNT_3945; i++) | ||
450 | iwl3945_clear_window(&rs_sta->win[i]); | ||
451 | 408 | ||
452 | IWL_DEBUG_RATE(priv, "leave\n"); | 409 | IWL_DEBUG_RATE(priv, "leave\n"); |
453 | 410 | ||
@@ -458,14 +415,11 @@ static void rs_free_sta(void *iwl_priv, struct ieee80211_sta *sta, | |||
458 | void *priv_sta) | 415 | void *priv_sta) |
459 | { | 416 | { |
460 | struct iwl3945_sta_priv *psta = (void *) sta->drv_priv; | 417 | struct iwl3945_sta_priv *psta = (void *) sta->drv_priv; |
461 | struct iwl3945_rs_sta *rs_sta = priv_sta; | 418 | struct iwl3945_rs_sta *rs_sta = &psta->rs_sta; |
462 | struct iwl_priv *priv __maybe_unused = rs_sta->priv; | 419 | struct iwl_priv *priv __maybe_unused = rs_sta->priv; |
463 | 420 | ||
464 | psta->rs_sta = NULL; | ||
465 | |||
466 | IWL_DEBUG_RATE(priv, "enter\n"); | 421 | IWL_DEBUG_RATE(priv, "enter\n"); |
467 | del_timer_sync(&rs_sta->rate_scale_flush); | 422 | del_timer_sync(&rs_sta->rate_scale_flush); |
468 | kfree(rs_sta); | ||
469 | IWL_DEBUG_RATE(priv, "leave\n"); | 423 | IWL_DEBUG_RATE(priv, "leave\n"); |
470 | } | 424 | } |
471 | 425 | ||
@@ -960,14 +914,15 @@ void iwl3945_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id) | |||
960 | 914 | ||
961 | rcu_read_lock(); | 915 | rcu_read_lock(); |
962 | 916 | ||
963 | sta = ieee80211_find_sta(hw, priv->stations[sta_id].sta.sta.addr); | 917 | sta = ieee80211_find_sta(priv->vif, |
918 | priv->stations[sta_id].sta.sta.addr); | ||
964 | if (!sta) { | 919 | if (!sta) { |
965 | rcu_read_unlock(); | 920 | rcu_read_unlock(); |
966 | return; | 921 | return; |
967 | } | 922 | } |
968 | 923 | ||
969 | psta = (void *) sta->drv_priv; | 924 | psta = (void *) sta->drv_priv; |
970 | rs_sta = psta->rs_sta; | 925 | rs_sta = &psta->rs_sta; |
971 | 926 | ||
972 | spin_lock_irqsave(&rs_sta->lock, flags); | 927 | spin_lock_irqsave(&rs_sta->lock, flags); |
973 | 928 | ||