Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 171366
b: refs/heads/master
c: 62a9492
h: refs/heads/master
v: v3
  • Loading branch information
Reinette Chatre authored and John W. Linville committed Nov 2, 2009
1 parent 52736d4 commit 4e09100
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 75 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 9a9ca65fbfa1cd14a6c016b793d61492f9f613d0
refs/heads/master: 62a94926183374d8414ab2ec633d9fe9530644ec
99 changes: 26 additions & 73 deletions trunk/drivers/net/wireless/iwlwifi/iwl-3945-rs.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,38 +42,6 @@

#define RS_NAME "iwl-3945-rs"

struct iwl3945_rate_scale_data {
u64 data;
s32 success_counter;
s32 success_ratio;
s32 counter;
s32 average_tpt;
unsigned long stamp;
};

struct iwl3945_rs_sta {
spinlock_t lock;
struct iwl_priv *priv;
s32 *expected_tpt;
unsigned long last_partial_flush;
unsigned long last_flush;
u32 flush_time;
u32 last_tx_packets;
u32 tx_packets;
u8 tgg;
u8 flush_pending;
u8 start_rate;
u8 ibss_sta_added;
struct timer_list rate_scale_flush;
struct iwl3945_rate_scale_data win[IWL_RATE_COUNT_3945];
#ifdef CONFIG_MAC80211_DEBUGFS
struct dentry *rs_sta_dbgfs_stats_table_file;
#endif

/* used to be in sta_info */
int last_txrate_idx;
};

static s32 iwl3945_expected_tpt_g[IWL_RATE_COUNT_3945] = {
7, 13, 35, 58, 0, 0, 76, 104, 130, 168, 191, 202
};
Expand Down Expand Up @@ -370,6 +338,28 @@ static void rs_rate_init(void *priv_r, struct ieee80211_supported_band *sband,

IWL_DEBUG_RATE(priv, "enter\n");

spin_lock_init(&rs_sta->lock);

rs_sta->priv = priv;

rs_sta->start_rate = IWL_RATE_INVALID;

/* default to just 802.11b */
rs_sta->expected_tpt = iwl3945_expected_tpt_b;

rs_sta->last_partial_flush = jiffies;
rs_sta->last_flush = jiffies;
rs_sta->flush_time = IWL_RATE_FLUSH;
rs_sta->last_tx_packets = 0;
rs_sta->ibss_sta_added = 0;

init_timer(&rs_sta->rate_scale_flush);
rs_sta->rate_scale_flush.data = (unsigned long)rs_sta;
rs_sta->rate_scale_flush.function = &iwl3945_bg_rate_scale_flush;

for (i = 0; i < IWL_RATE_COUNT_3945; i++)
iwl3945_clear_window(&rs_sta->win[i]);

/* TODO: what is a good starting rate for STA? About middle? Maybe not
* the lowest or the highest rate.. Could consider using RSSI from
* previous packets? Need to have IEEE 802.1X auth succeed immediately
Expand Down Expand Up @@ -409,45 +399,11 @@ static void *rs_alloc_sta(void *iwl_priv, struct ieee80211_sta *sta, gfp_t gfp)
{
struct iwl3945_rs_sta *rs_sta;
struct iwl3945_sta_priv *psta = (void *) sta->drv_priv;
struct iwl_priv *priv = iwl_priv;
int i;

/*
* XXX: If it's using sta->drv_priv anyway, it might
* as well just put all the information there.
*/
struct iwl_priv *priv __maybe_unused = iwl_priv;

IWL_DEBUG_RATE(priv, "enter\n");

rs_sta = kzalloc(sizeof(struct iwl3945_rs_sta), gfp);
if (!rs_sta) {
IWL_DEBUG_RATE(priv, "leave: ENOMEM\n");
return NULL;
}

psta->rs_sta = rs_sta;

spin_lock_init(&rs_sta->lock);

rs_sta->priv = priv;

rs_sta->start_rate = IWL_RATE_INVALID;

/* default to just 802.11b */
rs_sta->expected_tpt = iwl3945_expected_tpt_b;

rs_sta->last_partial_flush = jiffies;
rs_sta->last_flush = jiffies;
rs_sta->flush_time = IWL_RATE_FLUSH;
rs_sta->last_tx_packets = 0;
rs_sta->ibss_sta_added = 0;

init_timer(&rs_sta->rate_scale_flush);
rs_sta->rate_scale_flush.data = (unsigned long)rs_sta;
rs_sta->rate_scale_flush.function = &iwl3945_bg_rate_scale_flush;

for (i = 0; i < IWL_RATE_COUNT_3945; i++)
iwl3945_clear_window(&rs_sta->win[i]);
rs_sta = &psta->rs_sta;

IWL_DEBUG_RATE(priv, "leave\n");

Expand All @@ -458,14 +414,11 @@ static void rs_free_sta(void *iwl_priv, struct ieee80211_sta *sta,
void *priv_sta)
{
struct iwl3945_sta_priv *psta = (void *) sta->drv_priv;
struct iwl3945_rs_sta *rs_sta = priv_sta;
struct iwl3945_rs_sta *rs_sta = &psta->rs_sta;
struct iwl_priv *priv __maybe_unused = rs_sta->priv;

psta->rs_sta = NULL;

IWL_DEBUG_RATE(priv, "enter\n");
del_timer_sync(&rs_sta->rate_scale_flush);
kfree(rs_sta);
IWL_DEBUG_RATE(priv, "leave\n");
}

Expand Down Expand Up @@ -967,7 +920,7 @@ void iwl3945_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id)
}

psta = (void *) sta->drv_priv;
rs_sta = psta->rs_sta;
rs_sta = &psta->rs_sta;

spin_lock_irqsave(&rs_sta->lock, flags);

Expand Down
35 changes: 34 additions & 1 deletion trunk/drivers/net/wireless/iwlwifi/iwl-3945.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,41 @@ extern struct pci_device_id iwl3945_hw_card_ids[];
/* Module parameters accessible from iwl-*.c */
extern struct iwl_mod_params iwl3945_mod_params;

struct iwl3945_rate_scale_data {
u64 data;
s32 success_counter;
s32 success_ratio;
s32 counter;
s32 average_tpt;
unsigned long stamp;
};

struct iwl3945_rs_sta {
spinlock_t lock;
struct iwl_priv *priv;
s32 *expected_tpt;
unsigned long last_partial_flush;
unsigned long last_flush;
u32 flush_time;
u32 last_tx_packets;
u32 tx_packets;
u8 tgg;
u8 flush_pending;
u8 start_rate;
u8 ibss_sta_added;
struct timer_list rate_scale_flush;
struct iwl3945_rate_scale_data win[IWL_RATE_COUNT_3945];
#ifdef CONFIG_MAC80211_DEBUGFS
struct dentry *rs_sta_dbgfs_stats_table_file;
#endif

/* used to be in sta_info */
int last_txrate_idx;
};


struct iwl3945_sta_priv {
struct iwl3945_rs_sta *rs_sta;
struct iwl3945_rs_sta rs_sta;
};

enum iwl3945_antenna {
Expand Down

0 comments on commit 4e09100

Please sign in to comment.