Search Linux Wireless

Re: [PATCH 1/5] ath5k: Simplify powertable recalculation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2010/12/21 Bruno Randolf <br1@xxxxxxxxxxx>:
> Let ath5k_hw_txpower() decide if it can re-use the powertable or if it has to
> be recalculated instead of passing a 'fast' flag from the outside.
>
> Signed-off-by: Bruno Randolf <br1@xxxxxxxxxxx>
> ---
> Âdrivers/net/wireless/ath/ath5k/ath5k.h | Â Â1 +
> Âdrivers/net/wireless/ath/ath5k/phy.c  |  35 ++++++++++++--------------------
> Â2 files changed, 14 insertions(+), 22 deletions(-)
>
> diff --git a/drivers/net/wireless/ath/ath5k/ath5k.h b/drivers/net/wireless/ath/ath5k/ath5k.h
> index d6e7440..e6491bf 100644
> --- a/drivers/net/wireless/ath/ath5k/ath5k.h
> +++ b/drivers/net/wireless/ath/ath5k/ath5k.h
> @@ -1113,6 +1113,7 @@ struct ath5k_hw {
> Â Â Â Â Â Â Â Âs16 Â Â Â Â Â Â txp_cck_ofdm_gainf_delta;
> Â Â Â Â Â Â Â Â/* Value in dB units */
> Â Â Â Â Â Â Â Âs16 Â Â Â Â Â Â txp_cck_ofdm_pwr_delta;
> +        bool      Âtxp_setup;
> Â Â Â Â} ah_txpower;
>
> Â Â Â Âstruct {
> diff --git a/drivers/net/wireless/ath/ath5k/phy.c b/drivers/net/wireless/ath/ath5k/phy.c
> index f84afb4..7c6d7dc 100644
> --- a/drivers/net/wireless/ath/ath5k/phy.c
> +++ b/drivers/net/wireless/ath/ath5k/phy.c
> @@ -3004,6 +3004,8 @@ ath5k_setup_channel_powertable(struct ath5k_hw *ah,
> Â Â Â Â Â Â Â Âreturn -EINVAL;
> Â Â Â Â}
>
> + Â Â Â ah->ah_txpower.txp_setup = true;
> +
> Â Â Â Âreturn 0;
> Â}
>
> @@ -3105,9 +3107,10 @@ ath5k_setup_rate_powertable(struct ath5k_hw *ah, u16 max_pwr,
> Â*/
> Âstatic int
> Âath5k_hw_txpower(struct ath5k_hw *ah, struct ieee80211_channel *channel,
> - Â Â Â Â Â Â Â u8 ee_mode, u8 txpower, bool fast)
> + Â Â Â Â Â Â Â u8 ee_mode, u8 txpower)
> Â{
> Â Â Â Âstruct ath5k_rate_pcal_info rate_info;
> + Â Â Â struct ieee80211_channel *curr_channel = ah->ah_current_channel;
> Â Â Â Âu8 type;
> Â Â Â Âint ret;
>
> @@ -3138,10 +3141,13 @@ ath5k_hw_txpower(struct ath5k_hw *ah, struct ieee80211_channel *channel,
> Â Â Â Â Â Â Â Âreturn -EINVAL;
> Â Â Â Â}
>
> - Â Â Â /* If fast is set it means we are on the same channel/mode
> - Â Â Â Â* so there is no need to recalculate the powertable, we 'll
> - Â Â Â Â* just use the cached one */
> - Â Â Â if (!fast) {
> + Â Â Â /*
> + Â Â Â Â* If we don't change channel/mode skip tx powertable calculation
> + Â Â Â Â* and use the cached one.
> + Â Â Â Â*/
> + Â Â Â if (!ah->ah_txpower.txp_setup ||
> + Â Â Â Â Â (channel->hw_value != curr_channel->hw_value) ||
> + Â Â Â Â Â (channel->center_freq != curr_channel->center_freq)) {
> Â Â Â Â Â Â Â Â/* Reset TX power values */
> Â Â Â Â Â Â Â Âmemset(&ah->ah_txpower, 0, sizeof(ah->ah_txpower));
> Â Â Â Â Â Â Â Âah->ah_txpower.txp_tpc = AR5K_TUNE_TPC_TXPOWER;
> @@ -3159,8 +3165,6 @@ ath5k_hw_txpower(struct ath5k_hw *ah, struct ieee80211_channel *channel,
> Â Â Â Âelse
> Â Â Â Â Â Â Â Âath5k_setup_pcdac_table(ah);
>
> -
> -
> Â Â Â Â/* Limit max power if we have a CTL available */
> Â Â Â Âath5k_get_max_ctl_power(ah, channel);
>
> @@ -3238,7 +3242,7 @@ int ath5k_hw_set_txpower_limit(struct ath5k_hw *ah, u8 txpower)
> Â Â Â ÂATH5K_DBG(ah->ah_sc, ATH5K_DEBUG_TXPOWER,
> Â Â Â Â Â Â Â Â"changing txpower to %d\n", txpower);
>
> - Â Â Â return ath5k_hw_txpower(ah, channel, ee_mode, txpower, true);
> + Â Â Â return ath5k_hw_txpower(ah, channel, ee_mode, txpower);
> Â}
>
> Â/*************\
> @@ -3251,7 +3255,6 @@ int ath5k_hw_phy_init(struct ath5k_hw *ah, struct ieee80211_channel *channel,
> Â Â Â Âstruct ieee80211_channel *curr_channel;
> Â Â Â Âint ret, i;
> Â Â Â Âu32 phy_tst1;
> - Â Â Â bool fast_txp;
> Â Â Â Âret = 0;
>
> Â Â Â Â/*
> @@ -3282,17 +3285,6 @@ int ath5k_hw_phy_init(struct ath5k_hw *ah, struct ieee80211_channel *channel,
> Â Â Â Â}
>
> Â Â Â Â/*
> - Â Â Â Â* If we don't change channel/mode skip
> - Â Â Â Â* tx powertable calculation and use the
> - Â Â Â Â* cached one.
> - Â Â Â Â*/
> - Â Â Â if ((channel->hw_value == curr_channel->hw_value) &&
> - Â Â Â (channel->center_freq == curr_channel->center_freq))
> - Â Â Â Â Â Â Â fast_txp = true;
> - Â Â Â else
> - Â Â Â Â Â Â Â fast_txp = false;
> -
> - Â Â Â /*
> Â Â Â Â * Set TX power
> Â Â Â Â *
> Â Â Â Â * Note: We need to do that before we set
> @@ -3300,8 +3292,7 @@ int ath5k_hw_phy_init(struct ath5k_hw *ah, struct ieee80211_channel *channel,
> Â Â Â Â * properly set curve indices.
> Â Â Â Â */
> Â Â Â Âret = ath5k_hw_txpower(ah, channel, ee_mode,
> - Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â ah->ah_txpower.txp_max_pwr / 2,
> - Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â fast_txp);
> + Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â ah->ah_txpower.txp_max_pwr / 2);
> Â Â Â Âif (ret)
> Â Â Â Â Â Â Â Âreturn ret;
>
>
>

Acked-by: Nick Kossifidis <mickflemm@xxxxxxxxx>


-- 
GPG ID: 0xD21DB2DB
As you read this post global entropy rises. Have Fun ;-)
Nick
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux