Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 46bc8d4b authored by Stanislaw Gruszka's avatar Stanislaw Gruszka
Browse files

iwlegacy: rename priv to il



Make code shorter.

Signed-off-by: default avatarStanislaw Gruszka <sgruszka@redhat.com>
parent e2ebc833
Loading
Loading
Loading
Loading
+45 −45
Original line number Diff line number Diff line
@@ -29,22 +29,22 @@
#include "iwl-3945-debugfs.h"


static int il3945_statistics_flag(struct il_priv *priv, char *buf, int bufsz)
static int il3945_statistics_flag(struct il_priv *il, char *buf, int bufsz)
{
	int p = 0;

	p += scnprintf(buf + p, bufsz - p, "Statistics Flag(0x%X):\n",
		       le32_to_cpu(priv->_3945.statistics.flag));
	if (le32_to_cpu(priv->_3945.statistics.flag) &
		       le32_to_cpu(il->_3945.statistics.flag));
	if (le32_to_cpu(il->_3945.statistics.flag) &
			UCODE_STATISTICS_CLEAR_MSK)
		p += scnprintf(buf + p, bufsz - p,
			       "\tStatistics have been cleared\n");
	p += scnprintf(buf + p, bufsz - p, "\tOperational Frequency: %s\n",
		       (le32_to_cpu(priv->_3945.statistics.flag) &
		       (le32_to_cpu(il->_3945.statistics.flag) &
			UCODE_STATISTICS_FREQUENCY_MSK)
			? "2.4 GHz" : "5.2 GHz");
	p += scnprintf(buf + p, bufsz - p, "\tTGj Narrow Band: %s\n",
		       (le32_to_cpu(priv->_3945.statistics.flag) &
		       (le32_to_cpu(il->_3945.statistics.flag) &
			UCODE_STATISTICS_NARROW_BAND_MSK)
			? "enabled" : "disabled");
	return p;
@@ -54,7 +54,7 @@ ssize_t il3945_ucode_rx_stats_read(struct file *file,
				    char __user *user_buf,
				    size_t count, loff_t *ppos)
{
	struct il_priv *priv = file->private_data;
	struct il_priv *il = file->private_data;
	int pos = 0;
	char *buf;
	int bufsz = sizeof(struct iwl39_statistics_rx_phy) * 40 +
@@ -66,12 +66,12 @@ ssize_t il3945_ucode_rx_stats_read(struct file *file,
	struct iwl39_statistics_rx_non_phy *general, *accum_general;
	struct iwl39_statistics_rx_non_phy *delta_general, *max_general;

	if (!il_is_alive(priv))
	if (!il_is_alive(il))
		return -EAGAIN;

	buf = kzalloc(bufsz, GFP_KERNEL);
	if (!buf) {
		IL_ERR(priv, "Can not allocate Buffer\n");
		IL_ERR(il, "Can not allocate Buffer\n");
		return -ENOMEM;
	}

@@ -80,20 +80,20 @@ ssize_t il3945_ucode_rx_stats_read(struct file *file,
	 * the last statistics notification from uCode
	 * might not reflect the current uCode activity
	 */
	ofdm = &priv->_3945.statistics.rx.ofdm;
	cck = &priv->_3945.statistics.rx.cck;
	general = &priv->_3945.statistics.rx.general;
	accum_ofdm = &priv->_3945.accum_statistics.rx.ofdm;
	accum_cck = &priv->_3945.accum_statistics.rx.cck;
	accum_general = &priv->_3945.accum_statistics.rx.general;
	delta_ofdm = &priv->_3945.delta_statistics.rx.ofdm;
	delta_cck = &priv->_3945.delta_statistics.rx.cck;
	delta_general = &priv->_3945.delta_statistics.rx.general;
	max_ofdm = &priv->_3945.max_delta.rx.ofdm;
	max_cck = &priv->_3945.max_delta.rx.cck;
	max_general = &priv->_3945.max_delta.rx.general;
	ofdm = &il->_3945.statistics.rx.ofdm;
	cck = &il->_3945.statistics.rx.cck;
	general = &il->_3945.statistics.rx.general;
	accum_ofdm = &il->_3945.accum_statistics.rx.ofdm;
	accum_cck = &il->_3945.accum_statistics.rx.cck;
	accum_general = &il->_3945.accum_statistics.rx.general;
	delta_ofdm = &il->_3945.delta_statistics.rx.ofdm;
	delta_cck = &il->_3945.delta_statistics.rx.cck;
	delta_general = &il->_3945.delta_statistics.rx.general;
	max_ofdm = &il->_3945.max_delta.rx.ofdm;
	max_cck = &il->_3945.max_delta.rx.cck;
	max_general = &il->_3945.max_delta.rx.general;

	pos += il3945_statistics_flag(priv, buf, bufsz);
	pos += il3945_statistics_flag(il, buf, bufsz);
	pos += scnprintf(buf + pos, bufsz - pos, "%-32s     current"
			 "acumulative       delta         max\n",
			 "Statistics_Rx - OFDM:");
@@ -329,19 +329,19 @@ ssize_t il3945_ucode_tx_stats_read(struct file *file,
				    char __user *user_buf,
				    size_t count, loff_t *ppos)
{
	struct il_priv *priv = file->private_data;
	struct il_priv *il = file->private_data;
	int pos = 0;
	char *buf;
	int bufsz = (sizeof(struct iwl39_statistics_tx) * 48) + 250;
	ssize_t ret;
	struct iwl39_statistics_tx *tx, *accum_tx, *delta_tx, *max_tx;

	if (!il_is_alive(priv))
	if (!il_is_alive(il))
		return -EAGAIN;

	buf = kzalloc(bufsz, GFP_KERNEL);
	if (!buf) {
		IL_ERR(priv, "Can not allocate Buffer\n");
		IL_ERR(il, "Can not allocate Buffer\n");
		return -ENOMEM;
	}

@@ -350,11 +350,11 @@ ssize_t il3945_ucode_tx_stats_read(struct file *file,
	 * the last statistics notification from uCode
	 * might not reflect the current uCode activity
	 */
	tx = &priv->_3945.statistics.tx;
	accum_tx = &priv->_3945.accum_statistics.tx;
	delta_tx = &priv->_3945.delta_statistics.tx;
	max_tx = &priv->_3945.max_delta.tx;
	pos += il3945_statistics_flag(priv, buf, bufsz);
	tx = &il->_3945.statistics.tx;
	accum_tx = &il->_3945.accum_statistics.tx;
	delta_tx = &il->_3945.delta_statistics.tx;
	max_tx = &il->_3945.max_delta.tx;
	pos += il3945_statistics_flag(il, buf, bufsz);
	pos += scnprintf(buf + pos, bufsz - pos, "%-32s     current"
			 "acumulative       delta         max\n",
			 "Statistics_Tx:");
@@ -425,7 +425,7 @@ ssize_t il3945_ucode_general_stats_read(struct file *file,
					 char __user *user_buf,
					 size_t count, loff_t *ppos)
{
	struct il_priv *priv = file->private_data;
	struct il_priv *il = file->private_data;
	int pos = 0;
	char *buf;
	int bufsz = sizeof(struct iwl39_statistics_general) * 10 + 300;
@@ -435,12 +435,12 @@ ssize_t il3945_ucode_general_stats_read(struct file *file,
	struct statistics_dbg *dbg, *accum_dbg, *delta_dbg, *max_dbg;
	struct iwl39_statistics_div *div, *accum_div, *delta_div, *max_div;

	if (!il_is_alive(priv))
	if (!il_is_alive(il))
		return -EAGAIN;

	buf = kzalloc(bufsz, GFP_KERNEL);
	if (!buf) {
		IL_ERR(priv, "Can not allocate Buffer\n");
		IL_ERR(il, "Can not allocate Buffer\n");
		return -ENOMEM;
	}

@@ -449,19 +449,19 @@ ssize_t il3945_ucode_general_stats_read(struct file *file,
	 * the last statistics notification from uCode
	 * might not reflect the current uCode activity
	 */
	general = &priv->_3945.statistics.general;
	dbg = &priv->_3945.statistics.general.dbg;
	div = &priv->_3945.statistics.general.div;
	accum_general = &priv->_3945.accum_statistics.general;
	delta_general = &priv->_3945.delta_statistics.general;
	max_general = &priv->_3945.max_delta.general;
	accum_dbg = &priv->_3945.accum_statistics.general.dbg;
	delta_dbg = &priv->_3945.delta_statistics.general.dbg;
	max_dbg = &priv->_3945.max_delta.general.dbg;
	accum_div = &priv->_3945.accum_statistics.general.div;
	delta_div = &priv->_3945.delta_statistics.general.div;
	max_div = &priv->_3945.max_delta.general.div;
	pos += il3945_statistics_flag(priv, buf, bufsz);
	general = &il->_3945.statistics.general;
	dbg = &il->_3945.statistics.general.dbg;
	div = &il->_3945.statistics.general.div;
	accum_general = &il->_3945.accum_statistics.general;
	delta_general = &il->_3945.delta_statistics.general;
	max_general = &il->_3945.max_delta.general;
	accum_dbg = &il->_3945.accum_statistics.general.dbg;
	delta_dbg = &il->_3945.delta_statistics.general.dbg;
	max_dbg = &il->_3945.max_delta.general.dbg;
	accum_div = &il->_3945.accum_statistics.general.div;
	delta_div = &il->_3945.delta_statistics.general.div;
	max_div = &il->_3945.max_delta.general.div;
	pos += il3945_statistics_flag(il, buf, bufsz);
	pos += scnprintf(buf + pos, bufsz - pos, "%-32s     current"
			 "acumulative       delta         max\n",
			 "Statistics_General:");
+2 −2
Original line number Diff line number Diff line
@@ -44,7 +44,7 @@


/* Send led command */
static int il3945_send_led_cmd(struct il_priv *priv,
static int il3945_send_led_cmd(struct il_priv *il,
				struct il_led_cmd *led_cmd)
{
	struct il_host_cmd cmd = {
@@ -55,7 +55,7 @@ static int il3945_send_led_cmd(struct il_priv *priv,
		.callback = NULL,
	};

	return il_send_cmd(priv, &cmd);
	return il_send_cmd(il, &cmd);
}

const struct il_led_ops il3945_led_ops = {
+78 −78
Original line number Diff line number Diff line
@@ -153,7 +153,7 @@ static int il3945_rate_scale_flush_windows(struct il3945_rs_sta *rs_sta)
	int unflushed = 0;
	int i;
	unsigned long flags;
	struct il_priv *priv __maybe_unused = rs_sta->priv;
	struct il_priv *il __maybe_unused = rs_sta->il;

	/*
	 * For each rate, if we have collected data on that rate
@@ -167,7 +167,7 @@ static int il3945_rate_scale_flush_windows(struct il3945_rs_sta *rs_sta)
		spin_lock_irqsave(&rs_sta->lock, flags);
		if (time_after(jiffies, rs_sta->win[i].stamp +
			       IL_RATE_WIN_FLUSH)) {
			IL_DEBUG_RATE(priv, "flushing %d samples of rate "
			IL_DEBUG_RATE(il, "flushing %d samples of rate "
				       "index %d\n",
				       rs_sta->win[i].counter, i);
			il3945_clear_window(&rs_sta->win[i]);
@@ -186,12 +186,12 @@ static int il3945_rate_scale_flush_windows(struct il3945_rs_sta *rs_sta)
static void il3945_bg_rate_scale_flush(unsigned long data)
{
	struct il3945_rs_sta *rs_sta = (void *)data;
	struct il_priv *priv __maybe_unused = rs_sta->priv;
	struct il_priv *il __maybe_unused = rs_sta->il;
	int unflushed = 0;
	unsigned long flags;
	u32 packet_count, duration, pps;

	IL_DEBUG_RATE(priv, "enter\n");
	IL_DEBUG_RATE(il, "enter\n");

	unflushed = il3945_rate_scale_flush_windows(rs_sta);

@@ -206,7 +206,7 @@ static void il3945_bg_rate_scale_flush(unsigned long data)
		duration =
		    jiffies_to_msecs(jiffies - rs_sta->last_partial_flush);

		IL_DEBUG_RATE(priv, "Tx'd %d packets in %dms\n",
		IL_DEBUG_RATE(il, "Tx'd %d packets in %dms\n",
			       packet_count, duration);

		/* Determine packets per second */
@@ -226,7 +226,7 @@ static void il3945_bg_rate_scale_flush(unsigned long data)

		rs_sta->flush_time = msecs_to_jiffies(duration);

		IL_DEBUG_RATE(priv, "new flush period: %d msec ave %d\n",
		IL_DEBUG_RATE(il, "new flush period: %d msec ave %d\n",
			       duration, packet_count);

		mod_timer(&rs_sta->rate_scale_flush, jiffies +
@@ -244,7 +244,7 @@ static void il3945_bg_rate_scale_flush(unsigned long data)

	spin_unlock_irqrestore(&rs_sta->lock, flags);

	IL_DEBUG_RATE(priv, "leave\n");
	IL_DEBUG_RATE(il, "leave\n");
}

/**
@@ -260,10 +260,10 @@ static void il3945_collect_tx_data(struct il3945_rs_sta *rs_sta,
{
	unsigned long flags;
	s32 fail_count;
	struct il_priv *priv __maybe_unused = rs_sta->priv;
	struct il_priv *il __maybe_unused = rs_sta->il;

	if (!retries) {
		IL_DEBUG_RATE(priv, "leave: retries == 0 -- should be at least 1\n");
		IL_DEBUG_RATE(il, "leave: retries == 0 -- should be at least 1\n");
		return;
	}

@@ -332,24 +332,24 @@ static void il3945_collect_tx_data(struct il3945_rs_sta *rs_sta,
/*
 * Called after adding a new station to initialize rate scaling
 */
void il3945_rs_rate_init(struct il_priv *priv, struct ieee80211_sta *sta, u8 sta_id)
void il3945_rs_rate_init(struct il_priv *il, struct ieee80211_sta *sta, u8 sta_id)
{
	struct ieee80211_hw *hw = priv->hw;
	struct ieee80211_conf *conf = &priv->hw->conf;
	struct ieee80211_hw *hw = il->hw;
	struct ieee80211_conf *conf = &il->hw->conf;
	struct il3945_sta_priv *psta;
	struct il3945_rs_sta *rs_sta;
	struct ieee80211_supported_band *sband;
	int i;

	IL_DEBUG_INFO(priv, "enter\n");
	if (sta_id == priv->contexts[IL_RXON_CTX_BSS].bcast_sta_id)
	IL_DEBUG_INFO(il, "enter\n");
	if (sta_id == il->contexts[IL_RXON_CTX_BSS].bcast_sta_id)
		goto out;

	psta = (struct il3945_sta_priv *) sta->drv_priv;
	rs_sta = &psta->rs_sta;
	sband = hw->wiphy->bands[conf->channel->band];

	rs_sta->priv = priv;
	rs_sta->il = il;

	rs_sta->start_rate = IL_RATE_INVALID;

@@ -379,18 +379,18 @@ void il3945_rs_rate_init(struct il_priv *priv, struct ieee80211_sta *sta, u8 sta
		}
	}

	priv->_3945.sta_supp_rates = sta->supp_rates[sband->band];
	il->_3945.sta_supp_rates = sta->supp_rates[sband->band];
	/* For 5 GHz band it start at IL_FIRST_OFDM_RATE */
	if (sband->band == IEEE80211_BAND_5GHZ) {
		rs_sta->last_txrate_idx += IL_FIRST_OFDM_RATE;
		priv->_3945.sta_supp_rates = priv->_3945.sta_supp_rates <<
		il->_3945.sta_supp_rates = il->_3945.sta_supp_rates <<
						IL_FIRST_OFDM_RATE;
	}

out:
	priv->stations[sta_id].used &= ~IL_STA_UCODE_INPROGRESS;
	il->stations[sta_id].used &= ~IL_STA_UCODE_INPROGRESS;

	IL_DEBUG_INFO(priv, "leave\n");
	IL_DEBUG_INFO(il, "leave\n");
}

static void *il3945_rs_alloc(struct ieee80211_hw *hw, struct dentry *debugfsdir)
@@ -399,7 +399,7 @@ static void *il3945_rs_alloc(struct ieee80211_hw *hw, struct dentry *debugfsdir)
}

/* rate scale requires free function to be implemented */
static void il3945_rs_free(void *priv)
static void il3945_rs_free(void *il)
{
	return;
}
@@ -408,24 +408,24 @@ static void *il3945_rs_alloc_sta(void *il_priv, struct ieee80211_sta *sta, gfp_t
{
	struct il3945_rs_sta *rs_sta;
	struct il3945_sta_priv *psta = (void *) sta->drv_priv;
	struct il_priv *priv __maybe_unused = il_priv;
	struct il_priv *il __maybe_unused = il_priv;

	IL_DEBUG_RATE(priv, "enter\n");
	IL_DEBUG_RATE(il, "enter\n");

	rs_sta = &psta->rs_sta;

	spin_lock_init(&rs_sta->lock);
	init_timer(&rs_sta->rate_scale_flush);

	IL_DEBUG_RATE(priv, "leave\n");
	IL_DEBUG_RATE(il, "leave\n");

	return rs_sta;
}

static void il3945_rs_free_sta(void *il_priv, struct ieee80211_sta *sta,
			void *priv_sta)
			void *il_sta)
{
	struct il3945_rs_sta *rs_sta = priv_sta;
	struct il3945_rs_sta *rs_sta = il_sta;

	/*
	 * Be careful not to use any members of il3945_rs_sta (like trying
@@ -442,18 +442,18 @@ static void il3945_rs_free_sta(void *il_priv, struct ieee80211_sta *sta,
 * NOTE: Uses il_priv->retry_rate for the # of retries attempted by
 * the hardware for each rate.
 */
static void il3945_rs_tx_status(void *priv_rate, struct ieee80211_supported_band *sband,
			 struct ieee80211_sta *sta, void *priv_sta,
static void il3945_rs_tx_status(void *il_rate, struct ieee80211_supported_band *sband,
			 struct ieee80211_sta *sta, void *il_sta,
			 struct sk_buff *skb)
{
	s8 retries = 0, current_count;
	int scale_rate_index, first_index, last_index;
	unsigned long flags;
	struct il_priv *priv = (struct il_priv *)priv_rate;
	struct il3945_rs_sta *rs_sta = priv_sta;
	struct il_priv *il = (struct il_priv *)il_rate;
	struct il3945_rs_sta *rs_sta = il_sta;
	struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);

	IL_DEBUG_RATE(priv, "enter\n");
	IL_DEBUG_RATE(il, "enter\n");

	retries = info->status.rates[0].count;
	/* Sanity Check for retries */
@@ -462,18 +462,18 @@ static void il3945_rs_tx_status(void *priv_rate, struct ieee80211_supported_band

	first_index = sband->bitrates[info->status.rates[0].idx].hw_value;
	if ((first_index < 0) || (first_index >= IL_RATE_COUNT_3945)) {
		IL_DEBUG_RATE(priv, "leave: Rate out of bounds: %d\n", first_index);
		IL_DEBUG_RATE(il, "leave: Rate out of bounds: %d\n", first_index);
		return;
	}

	if (!priv_sta) {
		IL_DEBUG_RATE(priv, "leave: No STA priv data to update!\n");
	if (!il_sta) {
		IL_DEBUG_RATE(il, "leave: No STA il data to update!\n");
		return;
	}

	/* Treat uninitialized rate scaling data same as non-existing. */
	if (!rs_sta->priv) {
		IL_DEBUG_RATE(priv, "leave: STA priv data uninitialized!\n");
	if (!rs_sta->il) {
		IL_DEBUG_RATE(il, "leave: STA il data uninitialized!\n");
		return;
	}

@@ -487,19 +487,19 @@ static void il3945_rs_tx_status(void *priv_rate, struct ieee80211_supported_band
	 * Update the window for each rate.  We determine which rates
	 * were Tx'd based on the total number of retries vs. the number
	 * of retries configured for each rate -- currently set to the
	 * priv value 'retry_rate' vs. rate specific
	 * il value 'retry_rate' vs. rate specific
	 *
	 * On exit from this while loop last_index indicates the rate
	 * at which the frame was finally transmitted (or failed if no
	 * ACK)
	 */
	while (retries > 1) {
		if ((retries - 1) < priv->retry_rate) {
		if ((retries - 1) < il->retry_rate) {
			current_count = (retries - 1);
			last_index = scale_rate_index;
		} else {
			current_count = priv->retry_rate;
			last_index = il3945_rs_next_rate(priv,
			current_count = il->retry_rate;
			last_index = il3945_rs_next_rate(il,
							 scale_rate_index);
		}

@@ -508,7 +508,7 @@ static void il3945_rs_tx_status(void *priv_rate, struct ieee80211_supported_band
		il3945_collect_tx_data(rs_sta,
				    &rs_sta->win[scale_rate_index],
				    0, current_count, scale_rate_index);
		IL_DEBUG_RATE(priv, "Update rate %d for %d retries.\n",
		IL_DEBUG_RATE(il, "Update rate %d for %d retries.\n",
			       scale_rate_index, current_count);

		retries -= current_count;
@@ -518,7 +518,7 @@ static void il3945_rs_tx_status(void *priv_rate, struct ieee80211_supported_band


	/* Update the last index window with success/failure based on ACK */
	IL_DEBUG_RATE(priv, "Update rate %d with %s.\n",
	IL_DEBUG_RATE(il, "Update rate %d with %s.\n",
		       last_index,
		       (info->flags & IEEE80211_TX_STAT_ACK) ?
		       "success" : "failure");
@@ -543,7 +543,7 @@ static void il3945_rs_tx_status(void *priv_rate, struct ieee80211_supported_band

	spin_unlock_irqrestore(&rs_sta->lock, flags);

	IL_DEBUG_RATE(priv, "leave\n");
	IL_DEBUG_RATE(il, "leave\n");
}

static u16 il3945_get_adjacent_rate(struct il3945_rs_sta *rs_sta,
@@ -551,7 +551,7 @@ static u16 il3945_get_adjacent_rate(struct il3945_rs_sta *rs_sta,
{
	u8 high = IL_RATE_INVALID;
	u8 low = IL_RATE_INVALID;
	struct il_priv *priv __maybe_unused = rs_sta->priv;
	struct il_priv *il __maybe_unused = rs_sta->il;

	/* 802.11A walks to the next literal adjacent rate in
	 * the rate table */
@@ -591,7 +591,7 @@ static u16 il3945_get_adjacent_rate(struct il3945_rs_sta *rs_sta,
			break;
		if (rate_mask & (1 << low))
			break;
		IL_DEBUG_RATE(priv, "Skipping masked lower rate: %d\n", low);
		IL_DEBUG_RATE(il, "Skipping masked lower rate: %d\n", low);
	}

	high = index;
@@ -604,7 +604,7 @@ static u16 il3945_get_adjacent_rate(struct il3945_rs_sta *rs_sta,
			break;
		if (rate_mask & (1 << high))
			break;
		IL_DEBUG_RATE(priv, "Skipping masked higher rate: %d\n", high);
		IL_DEBUG_RATE(il, "Skipping masked higher rate: %d\n", high);
	}

	return (high << 8) | low;
@@ -626,8 +626,8 @@ static u16 il3945_get_adjacent_rate(struct il3945_rs_sta *rs_sta,
 * rate table and must reference the driver allocated rate table
 *
 */
static void il3945_rs_get_rate(void *priv_r, struct ieee80211_sta *sta,
			void *priv_sta,	struct ieee80211_tx_rate_control *txrc)
static void il3945_rs_get_rate(void *il_r, struct ieee80211_sta *sta,
			void *il_sta,	struct ieee80211_tx_rate_control *txrc)
{
	struct ieee80211_supported_band *sband = txrc->sband;
	struct sk_buff *skb = txrc->skb;
@@ -635,7 +635,7 @@ static void il3945_rs_get_rate(void *priv_r, struct ieee80211_sta *sta,
	u8 high = IL_RATE_INVALID;
	u16 high_low;
	int index;
	struct il3945_rs_sta *rs_sta = priv_sta;
	struct il3945_rs_sta *rs_sta = il_sta;
	struct il3945_rate_scale_data *window = NULL;
	int current_tpt = IL_INVALID_VALUE;
	int low_tpt = IL_INVALID_VALUE;
@@ -645,18 +645,18 @@ static void il3945_rs_get_rate(void *priv_r, struct ieee80211_sta *sta,
	unsigned long flags;
	u16 rate_mask;
	s8 max_rate_idx = -1;
	struct il_priv *priv __maybe_unused = (struct il_priv *)priv_r;
	struct il_priv *il __maybe_unused = (struct il_priv *)il_r;
	struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);

	IL_DEBUG_RATE(priv, "enter\n");
	IL_DEBUG_RATE(il, "enter\n");

	/* Treat uninitialized rate scaling data same as non-existing. */
	if (rs_sta && !rs_sta->priv) {
		IL_DEBUG_RATE(priv, "Rate scaling information not initialized yet.\n");
		priv_sta = NULL;
	if (rs_sta && !rs_sta->il) {
		IL_DEBUG_RATE(il, "Rate scaling information not initialized yet.\n");
		il_sta = NULL;
	}

	if (rate_control_send_low(sta, priv_sta, txrc))
	if (rate_control_send_low(sta, il_sta, txrc))
		return;

	rate_mask = sta->supp_rates[sband->band];
@@ -699,7 +699,7 @@ static void il3945_rs_get_rate(void *priv_r, struct ieee80211_sta *sta,
	     (window->success_counter < IL_RATE_MIN_SUCCESS_TH))) {
		spin_unlock_irqrestore(&rs_sta->lock, flags);

		IL_DEBUG_RATE(priv, "Invalid average_tpt on rate %d: "
		IL_DEBUG_RATE(il, "Invalid average_tpt on rate %d: "
			       "counter: %d, success_counter: %d, "
			       "expected_tpt is %sNULL\n",
			       index,
@@ -737,7 +737,7 @@ static void il3945_rs_get_rate(void *priv_r, struct ieee80211_sta *sta,

	/* Low success ratio , need to drop the rate */
	if ((window->success_ratio < IL_RATE_DECREASE_TH) || !current_tpt) {
		IL_DEBUG_RATE(priv, "decrease rate because of low success_ratio\n");
		IL_DEBUG_RATE(il, "decrease rate because of low success_ratio\n");
		scale_action = -1;
	/* No throughput measured yet for adjacent rates,
	 * try increase */
@@ -756,7 +756,7 @@ static void il3945_rs_get_rate(void *priv_r, struct ieee80211_sta *sta,
		 (high_tpt != IL_INVALID_VALUE) &&
		 (low_tpt < current_tpt) && (high_tpt < current_tpt)) {

		IL_DEBUG_RATE(priv, "No action -- low [%d] & high [%d] < "
		IL_DEBUG_RATE(il, "No action -- low [%d] & high [%d] < "
			       "current_tpt [%d]\n",
			       low_tpt, high_tpt, current_tpt);
		scale_action = 0;
@@ -771,13 +771,13 @@ static void il3945_rs_get_rate(void *priv_r, struct ieee80211_sta *sta,
				window->success_ratio >= IL_RATE_INCREASE_TH)
				scale_action = 1;
			else {
				IL_DEBUG_RATE(priv,
				IL_DEBUG_RATE(il,
				    "decrease rate because of high tpt\n");
				scale_action = 0;
			}
		} else if (low_tpt != IL_INVALID_VALUE) {
			if (low_tpt > current_tpt) {
				IL_DEBUG_RATE(priv,
				IL_DEBUG_RATE(il,
				    "decrease rate because of low tpt\n");
				scale_action = -1;
			} else if (window->success_ratio >= IL_RATE_INCREASE_TH) {
@@ -816,7 +816,7 @@ static void il3945_rs_get_rate(void *priv_r, struct ieee80211_sta *sta,
		break;
	}

	IL_DEBUG_RATE(priv, "Selected %d (action %d) - low %d high %d\n",
	IL_DEBUG_RATE(il, "Selected %d (action %d) - low %d high %d\n",
		       index, scale_action, low, high);

 out:
@@ -831,7 +831,7 @@ static void il3945_rs_get_rate(void *priv_r, struct ieee80211_sta *sta,
		info->control.rates[0].idx = rs_sta->last_txrate_idx;
	}

	IL_DEBUG_RATE(priv, "leave: %d\n", index);
	IL_DEBUG_RATE(il, "leave: %d\n", index);
}

#ifdef CONFIG_MAC80211_DEBUGFS
@@ -878,10 +878,10 @@ static const struct file_operations rs_sta_dbgfs_stats_table_ops = {
	.llseek = default_llseek,
};

static void il3945_add_debugfs(void *priv, void *priv_sta,
static void il3945_add_debugfs(void *il, void *il_sta,
				struct dentry *dir)
{
	struct il3945_rs_sta *lq_sta = priv_sta;
	struct il3945_rs_sta *lq_sta = il_sta;

	lq_sta->rs_sta_dbgfs_stats_table_file =
		debugfs_create_file("rate_stats_table", 0600, dir,
@@ -889,9 +889,9 @@ static void il3945_add_debugfs(void *priv, void *priv_sta,

}

static void il3945_remove_debugfs(void *priv, void *priv_sta)
static void il3945_remove_debugfs(void *il, void *il_sta)
{
	struct il3945_rs_sta *lq_sta = priv_sta;
	struct il3945_rs_sta *lq_sta = il_sta;
	debugfs_remove(lq_sta->rs_sta_dbgfs_stats_table_file);
}
#endif
@@ -901,9 +901,9 @@ static void il3945_remove_debugfs(void *priv, void *priv_sta)
 * the station is added. Since mac80211 calls this function before a
 * station is added we ignore it.
 */
static void il3945_rs_rate_init_stub(void *priv_r,
static void il3945_rs_rate_init_stub(void *il_r,
				struct ieee80211_supported_band *sband,
			      struct ieee80211_sta *sta, void *priv_sta)
			      struct ieee80211_sta *sta, void *il_sta)
{
}

@@ -925,21 +925,21 @@ static struct rate_control_ops rs_ops = {
};
void il3945_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id)
{
	struct il_priv *priv = hw->priv;
	struct il_priv *il = hw->priv;
	s32 rssi = 0;
	unsigned long flags;
	struct il3945_rs_sta *rs_sta;
	struct ieee80211_sta *sta;
	struct il3945_sta_priv *psta;

	IL_DEBUG_RATE(priv, "enter\n");
	IL_DEBUG_RATE(il, "enter\n");

	rcu_read_lock();

	sta = ieee80211_find_sta(priv->contexts[IL_RXON_CTX_BSS].vif,
				 priv->stations[sta_id].sta.sta.addr);
	sta = ieee80211_find_sta(il->contexts[IL_RXON_CTX_BSS].vif,
				 il->stations[sta_id].sta.sta.addr);
	if (!sta) {
		IL_DEBUG_RATE(priv, "Unable to find station to initialize rate scaling.\n");
		IL_DEBUG_RATE(il, "Unable to find station to initialize rate scaling.\n");
		rcu_read_unlock();
		return;
	}
@@ -950,10 +950,10 @@ void il3945_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id)
	spin_lock_irqsave(&rs_sta->lock, flags);

	rs_sta->tgg = 0;
	switch (priv->band) {
	switch (il->band) {
	case IEEE80211_BAND_2GHZ:
		/* TODO: this always does G, not a regression */
		if (priv->contexts[IL_RXON_CTX_BSS].active.flags &
		if (il->contexts[IL_RXON_CTX_BSS].active.flags &
						RXON_FLG_TGG_PROTECT_MSK) {
			rs_sta->tgg = 1;
			rs_sta->expected_tpt = il3945_expected_tpt_g_prot;
@@ -971,15 +971,15 @@ void il3945_rate_scale_init(struct ieee80211_hw *hw, s32 sta_id)

	spin_unlock_irqrestore(&rs_sta->lock, flags);

	rssi = priv->_3945.last_rx_rssi;
	rssi = il->_3945.last_rx_rssi;
	if (rssi == 0)
		rssi = IL_MIN_RSSI_VAL;

	IL_DEBUG_RATE(priv, "Network RSSI: %d\n", rssi);
	IL_DEBUG_RATE(il, "Network RSSI: %d\n", rssi);

	rs_sta->start_rate = il3945_get_rate_index_by_rssi(rssi, priv->band);
	rs_sta->start_rate = il3945_get_rate_index_by_rssi(rssi, il->band);

	IL_DEBUG_RATE(priv, "leave: rssi %d assign rate index: "
	IL_DEBUG_RATE(il, "leave: rssi %d assign rate index: "
		       "%d (plcp 0x%x)\n", rssi, rs_sta->start_rate,
		       il3945_rates[rs_sta->start_rate].plcp);
	rcu_read_unlock();
+393 −393

File changed.

Preview size limit exceeded, changes collapsed.

+39 −39
Original line number Diff line number Diff line
@@ -85,7 +85,7 @@ struct il3945_rate_scale_data {

struct il3945_rs_sta {
	spinlock_t lock;
	struct il_priv *priv;
	struct il_priv *il;
	s32 *expected_tpt;
	unsigned long last_partial_flush;
	unsigned long last_flush;
@@ -207,12 +207,12 @@ struct il3945_ibss_seq {
 *****************************************************************************/
extern int il3945_calc_db_from_ratio(int sig_ratio);
extern void il3945_rx_replenish(void *data);
extern void il3945_rx_queue_reset(struct il_priv *priv, struct il_rx_queue *rxq);
extern unsigned int il3945_fill_beacon_frame(struct il_priv *priv,
extern void il3945_rx_queue_reset(struct il_priv *il, struct il_rx_queue *rxq);
extern unsigned int il3945_fill_beacon_frame(struct il_priv *il,
					struct ieee80211_hdr *hdr, int left);
extern int il3945_dump_nic_event_log(struct il_priv *priv, bool full_log,
extern int il3945_dump_nic_event_log(struct il_priv *il, bool full_log,
				       char **buf, bool display);
extern void il3945_dump_nic_error_log(struct il_priv *priv);
extern void il3945_dump_nic_error_log(struct il_priv *il);

/******************************************************************************
 *
@@ -230,44 +230,44 @@ extern void il3945_dump_nic_error_log(struct il_priv *priv);
 * il3945_mac_     <-- mac80211 callback
 *
 ****************************************************************************/
extern void il3945_hw_rx_handler_setup(struct il_priv *priv);
extern void il3945_hw_setup_deferred_work(struct il_priv *priv);
extern void il3945_hw_cancel_deferred_work(struct il_priv *priv);
extern int il3945_hw_rxq_stop(struct il_priv *priv);
extern int il3945_hw_set_hw_params(struct il_priv *priv);
extern int il3945_hw_nic_init(struct il_priv *priv);
extern int il3945_hw_nic_stop_master(struct il_priv *priv);
extern void il3945_hw_txq_ctx_free(struct il_priv *priv);
extern void il3945_hw_txq_ctx_stop(struct il_priv *priv);
extern int il3945_hw_nic_reset(struct il_priv *priv);
extern int il3945_hw_txq_attach_buf_to_tfd(struct il_priv *priv,
extern void il3945_hw_rx_handler_setup(struct il_priv *il);
extern void il3945_hw_setup_deferred_work(struct il_priv *il);
extern void il3945_hw_cancel_deferred_work(struct il_priv *il);
extern int il3945_hw_rxq_stop(struct il_priv *il);
extern int il3945_hw_set_hw_params(struct il_priv *il);
extern int il3945_hw_nic_init(struct il_priv *il);
extern int il3945_hw_nic_stop_master(struct il_priv *il);
extern void il3945_hw_txq_ctx_free(struct il_priv *il);
extern void il3945_hw_txq_ctx_stop(struct il_priv *il);
extern int il3945_hw_nic_reset(struct il_priv *il);
extern int il3945_hw_txq_attach_buf_to_tfd(struct il_priv *il,
					    struct il_tx_queue *txq,
					    dma_addr_t addr, u16 len,
					    u8 reset, u8 pad);
extern void il3945_hw_txq_free_tfd(struct il_priv *priv,
extern void il3945_hw_txq_free_tfd(struct il_priv *il,
				    struct il_tx_queue *txq);
extern int il3945_hw_get_temperature(struct il_priv *priv);
extern int il3945_hw_tx_queue_init(struct il_priv *priv,
extern int il3945_hw_get_temperature(struct il_priv *il);
extern int il3945_hw_tx_queue_init(struct il_priv *il,
				struct il_tx_queue *txq);
extern unsigned int il3945_hw_get_beacon_cmd(struct il_priv *priv,
extern unsigned int il3945_hw_get_beacon_cmd(struct il_priv *il,
				 struct il3945_frame *frame, u8 rate);
void il3945_hw_build_tx_cmd_rate(struct il_priv *priv,
void il3945_hw_build_tx_cmd_rate(struct il_priv *il,
				  struct il_device_cmd *cmd,
				  struct ieee80211_tx_info *info,
				  struct ieee80211_hdr *hdr,
				  int sta_id, int tx_id);
extern int il3945_hw_reg_send_txpower(struct il_priv *priv);
extern int il3945_hw_reg_set_txpower(struct il_priv *priv, s8 power);
extern void il3945_hw_rx_statistics(struct il_priv *priv,
extern int il3945_hw_reg_send_txpower(struct il_priv *il);
extern int il3945_hw_reg_set_txpower(struct il_priv *il, s8 power);
extern void il3945_hw_rx_statistics(struct il_priv *il,
				 struct il_rx_mem_buffer *rxb);
void il3945_reply_statistics(struct il_priv *priv,
void il3945_reply_statistics(struct il_priv *il,
			      struct il_rx_mem_buffer *rxb);
extern void il3945_disable_events(struct il_priv *priv);
extern int il4965_get_temperature(const struct il_priv *priv);
extern void il3945_post_associate(struct il_priv *priv);
extern void il3945_config_ap(struct il_priv *priv);
extern void il3945_disable_events(struct il_priv *il);
extern int il4965_get_temperature(const struct il_priv *il);
extern void il3945_post_associate(struct il_priv *il);
extern void il3945_config_ap(struct il_priv *il);

extern int il3945_commit_rxon(struct il_priv *priv,
extern int il3945_commit_rxon(struct il_priv *il,
			       struct il_rxon_context *ctx);

/**
@@ -278,26 +278,26 @@ extern int il3945_commit_rxon(struct il_priv *priv,
 * not yet been merged into a single common layer for managing the
 * station tables.
 */
extern u8 il3945_hw_find_station(struct il_priv *priv, const u8 *bssid);
extern u8 il3945_hw_find_station(struct il_priv *il, const u8 *bssid);

extern struct ieee80211_ops il3945_hw_ops;

/*
 * Forward declare iwl-3945.c functions for iwl3945-base.c
 */
extern __le32 il3945_get_antenna_flags(const struct il_priv *priv);
extern int il3945_init_hw_rate_table(struct il_priv *priv);
extern void il3945_reg_txpower_periodic(struct il_priv *priv);
extern int il3945_txpower_set_from_eeprom(struct il_priv *priv);
extern __le32 il3945_get_antenna_flags(const struct il_priv *il);
extern int il3945_init_hw_rate_table(struct il_priv *il);
extern void il3945_reg_txpower_periodic(struct il_priv *il);
extern int il3945_txpower_set_from_eeprom(struct il_priv *il);

extern const struct il_channel_info *il3945_get_channel_info(
	const struct il_priv *priv, enum ieee80211_band band, u16 channel);
	const struct il_priv *il, enum ieee80211_band band, u16 channel);

extern int il3945_rs_next_rate(struct il_priv *priv, int rate);
extern int il3945_rs_next_rate(struct il_priv *il, int rate);

/* scanning */
int il3945_request_scan(struct il_priv *priv, struct ieee80211_vif *vif);
void il3945_post_scan(struct il_priv *priv);
int il3945_request_scan(struct il_priv *il, struct ieee80211_vif *vif);
void il3945_post_scan(struct il_priv *il);

/* rates */
extern const struct il3945_rate_info il3945_rates[IL_RATE_COUNT_3945];
Loading