diff options
author | Reinette Chatre <reinette.chatre@intel.com> | 2009-10-30 17:36:13 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-11-02 15:39:47 -0500 |
commit | 62a94926183374d8414ab2ec633d9fe9530644ec (patch) | |
tree | 8fb56c5b8d01e7061301099c8dee85a836cf4041 /drivers/net/wireless/iwlwifi/iwl-3945-rs.c | |
parent | 9a9ca65fbfa1cd14a6c016b793d61492f9f613d0 (diff) |
iwl3945: store station rate scale information in mac80211 station structure
Currently the rate scale information is pointed to from the mac80211
station structure but since that is the only member we might as well make
it part of the structure. Also move the rate scaling initialization to the
init function, no need to do it when we allocate the structure. This fits
with how mac80211 deals with rate scaling information (it always calls init
after allocation) and makes it easier for us to later call initialization
directly.
Signed-off-by: Reinette Chatre <reinette.chatre@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/iwlwifi/iwl-3945-rs.c')
-rw-r--r-- | drivers/net/wireless/iwlwifi/iwl-3945-rs.c | 99 |
1 files changed, 26 insertions, 73 deletions
diff --git a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c index cbb0585083a..819a81bbb1b 100644 --- a/drivers/net/wireless/iwlwifi/iwl-3945-rs.c +++ b/drivers/net/wireless/iwlwifi/iwl-3945-rs.c | |||
@@ -42,38 +42,6 @@ | |||
42 | 42 | ||
43 | #define RS_NAME "iwl-3945-rs" | 43 | #define RS_NAME "iwl-3945-rs" |
44 | 44 | ||
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] = { | 45 | static s32 iwl3945_expected_tpt_g[IWL_RATE_COUNT_3945] = { |
78 | 7, 13, 35, 58, 0, 0, 76, 104, 130, 168, 191, 202 | 46 | 7, 13, 35, 58, 0, 0, 76, 104, 130, 168, 191, 202 |
79 | }; | 47 | }; |
@@ -370,6 +338,28 @@ static void rs_rate_init(void *priv_r, struct ieee80211_supported_band *sband, | |||
370 | 338 | ||
371 | IWL_DEBUG_RATE(priv, "enter\n"); | 339 | IWL_DEBUG_RATE(priv, "enter\n"); |
372 | 340 | ||
341 | spin_lock_init(&rs_sta->lock); | ||
342 | |||
343 | rs_sta->priv = priv; | ||
344 | |||
345 | rs_sta->start_rate = IWL_RATE_INVALID; | ||
346 | |||
347 | /* default to just 802.11b */ | ||
348 | rs_sta->expected_tpt = iwl3945_expected_tpt_b; | ||
349 | |||
350 | rs_sta->last_partial_flush = jiffies; | ||
351 | rs_sta->last_flush = jiffies; | ||
352 | rs_sta->flush_time = IWL_RATE_FLUSH; | ||
353 | rs_sta->last_tx_packets = 0; | ||
354 | rs_sta->ibss_sta_added = 0; | ||
355 | |||
356 | init_timer(&rs_sta->rate_scale_flush); | ||
357 | rs_sta->rate_scale_flush.data = (unsigned long)rs_sta; | ||
358 | rs_sta->rate_scale_flush.function = &iwl3945_bg_rate_scale_flush; | ||
359 | |||
360 | for (i = 0; i < IWL_RATE_COUNT_3945; i++) | ||
361 | iwl3945_clear_window(&rs_sta->win[i]); | ||
362 | |||
373 | /* TODO: what is a good starting rate for STA? About middle? Maybe not | 363 | /* 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 | 364 | * the lowest or the highest rate.. Could consider using RSSI from |
375 | * previous packets? Need to have IEEE 802.1X auth succeed immediately | 365 | * previous packets? Need to have IEEE 802.1X auth succeed immediately |
@@ -409,45 +399,11 @@ static void *rs_alloc_sta(void *iwl_priv, struct ieee80211_sta *sta, gfp_t gfp) | |||
409 | { | 399 | { |
410 | struct iwl3945_rs_sta *rs_sta; | 400 | struct iwl3945_rs_sta *rs_sta; |
411 | struct iwl3945_sta_priv *psta = (void *) sta->drv_priv; | 401 | struct iwl3945_sta_priv *psta = (void *) sta->drv_priv; |
412 | struct iwl_priv *priv = iwl_priv; | 402 | 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 | 403 | ||
420 | IWL_DEBUG_RATE(priv, "enter\n"); | 404 | IWL_DEBUG_RATE(priv, "enter\n"); |
421 | 405 | ||
422 | rs_sta = kzalloc(sizeof(struct iwl3945_rs_sta), gfp); | 406 | 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 | 407 | ||
452 | IWL_DEBUG_RATE(priv, "leave\n"); | 408 | IWL_DEBUG_RATE(priv, "leave\n"); |
453 | 409 | ||
@@ -458,14 +414,11 @@ static void rs_free_sta(void *iwl_priv, struct ieee80211_sta *sta, | |||
458 | void *priv_sta) | 414 | void *priv_sta) |
459 | { | 415 | { |
460 | struct iwl3945_sta_priv *psta = (void *) sta->drv_priv; | 416 | struct iwl3945_sta_priv *psta = (void *) sta->drv_priv; |
461 | struct iwl3945_rs_sta *rs_sta = priv_sta; | 417 | struct iwl3945_rs_sta *rs_sta = &psta->rs_sta; |
462 | struct iwl_priv *priv __maybe_unused = rs_sta->priv; | 418 | struct iwl_priv *priv __maybe_unused = rs_sta->priv; |
463 | 419 | ||
464 | psta->rs_sta = NULL; | ||
465 | |||
466 | IWL_DEBUG_RATE(priv, "enter\n"); | 420 | IWL_DEBUG_RATE(priv, "enter\n"); |
467 | del_timer_sync(&rs_sta->rate_scale_flush); | 421 | del_timer_sync(&rs_sta->rate_scale_flush); |
468 | kfree(rs_sta); | ||
469 | IWL_DEBUG_RATE(priv, "leave\n"); | 422 | IWL_DEBUG_RATE(priv, "leave\n"); |
470 | } | 423 | } |
471 | 424 | ||
@@ -967,7 +920,7 @@ void iwl3945_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id) | |||
967 | } | 920 | } |
968 | 921 | ||
969 | psta = (void *) sta->drv_priv; | 922 | psta = (void *) sta->drv_priv; |
970 | rs_sta = psta->rs_sta; | 923 | rs_sta = &psta->rs_sta; |
971 | 924 | ||
972 | spin_lock_irqsave(&rs_sta->lock, flags); | 925 | spin_lock_irqsave(&rs_sta->lock, flags); |
973 | 926 | ||