Search Linux Wireless

Re: [PATCH v2 1/7] ath5k: optimize tx descriptor setup

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

 



On Wed, Apr 13, 2011 at 12:07 AM, Felix Fietkau <nbd@xxxxxxxxxxx> wrote:
> Use local variables to reduce the number of load/store operations on uncached
> memory.
>
> Signed-off-by: Felix Fietkau <nbd@xxxxxxxxxxx>
> ---
> Âdrivers/net/wireless/ath/ath5k/desc.c | Â 45 +++++++++++++++++++--------------
> Â1 files changed, 26 insertions(+), 19 deletions(-)
>
> diff --git a/drivers/net/wireless/ath/ath5k/desc.c b/drivers/net/wireless/ath/ath5k/desc.c
> index 16b44ff..6996d55 100644
> --- a/drivers/net/wireless/ath/ath5k/desc.c
> +++ b/drivers/net/wireless/ath/ath5k/desc.c
> @@ -185,6 +185,12 @@ static int ath5k_hw_setup_4word_tx_desc(struct ath5k_hw *ah,
> Â Â Â Âstruct ath5k_hw_4w_tx_ctl *tx_ctl;
> Â Â Â Âunsigned int frame_len;
>
> + Â Â Â /*
> + Â Â Â Â* Use local variables for these to reduce load/store access on
> + Â Â Â Â* uncached memory
> + Â Â Â Â*/
> + Â Â Â u32 txctl0 = 0, txctl1 = 0, txctl2 = 0, txctl3 = 0;
> +
> Â Â Â Âtx_ctl = &desc->ud.ds_tx5212.tx_ctl;
>
> Â Â Â Â/*
> @@ -208,8 +214,9 @@ static int ath5k_hw_setup_4word_tx_desc(struct ath5k_hw *ah,
> Â Â Â Âif (tx_power > AR5K_TUNE_MAX_TXPOWER)
> Â Â Â Â Â Â Â Âtx_power = AR5K_TUNE_MAX_TXPOWER;
>
> - Â Â Â /* Clear descriptor */
> - Â Â Â memset(&desc->ud.ds_tx5212, 0, sizeof(struct ath5k_hw_5212_tx_desc));
> + Â Â Â /* Clear descriptor status area */
> + Â Â Â memset(&desc->ud.ds_tx5212.tx_stat, 0,
> + Â Â Â Â Â Â Âsizeof(desc->ud.ds_tx5212.tx_stat));
>
> Â Â Â Â/* Setup control descriptor */
>
> @@ -221,7 +228,7 @@ static int ath5k_hw_setup_4word_tx_desc(struct ath5k_hw *ah,
> Â Â Â Âif (frame_len & ~AR5K_4W_TX_DESC_CTL0_FRAME_LEN)
> Â Â Â Â Â Â Â Âreturn -EINVAL;
>
> - Â Â Â tx_ctl->tx_control_0 = frame_len & AR5K_4W_TX_DESC_CTL0_FRAME_LEN;
> + Â Â Â txctl0 = frame_len & AR5K_4W_TX_DESC_CTL0_FRAME_LEN;
>
> Â Â Â Â/* Verify and set buffer length */
>
> @@ -232,21 +239,17 @@ static int ath5k_hw_setup_4word_tx_desc(struct ath5k_hw *ah,
> Â Â Â Âif (pkt_len & ~AR5K_4W_TX_DESC_CTL1_BUF_LEN)
> Â Â Â Â Â Â Â Âreturn -EINVAL;
>
> - Â Â Â tx_ctl->tx_control_1 = pkt_len & AR5K_4W_TX_DESC_CTL1_BUF_LEN;
> + Â Â Â txctl1 = pkt_len & AR5K_4W_TX_DESC_CTL1_BUF_LEN;
>
> - Â Â Â tx_ctl->tx_control_0 |=
> - Â Â Â Â Â Â Â AR5K_REG_SM(tx_power, AR5K_4W_TX_DESC_CTL0_XMIT_POWER) |
> - Â Â Â Â Â Â Â AR5K_REG_SM(antenna_mode, AR5K_4W_TX_DESC_CTL0_ANT_MODE_XMIT);
> - Â Â Â tx_ctl->tx_control_1 |= AR5K_REG_SM(type,
> - Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â AR5K_4W_TX_DESC_CTL1_FRAME_TYPE);
> - Â Â Â tx_ctl->tx_control_2 = AR5K_REG_SM(tx_tries0,
> - Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â AR5K_4W_TX_DESC_CTL2_XMIT_TRIES0);
> - Â Â Â tx_ctl->tx_control_3 = tx_rate0 & AR5K_4W_TX_DESC_CTL3_XMIT_RATE0;
> + Â Â Â txctl0 |= AR5K_REG_SM(tx_power, AR5K_4W_TX_DESC_CTL0_XMIT_POWER) |
> + Â Â Â Â Â Â Â Â AR5K_REG_SM(antenna_mode, AR5K_4W_TX_DESC_CTL0_ANT_MODE_XMIT);
> + Â Â Â txctl1 |= AR5K_REG_SM(type, AR5K_4W_TX_DESC_CTL1_FRAME_TYPE);
> + Â Â Â txctl2 = AR5K_REG_SM(tx_tries0, AR5K_4W_TX_DESC_CTL2_XMIT_TRIES0);
> + Â Â Â txctl3 = tx_rate0 & AR5K_4W_TX_DESC_CTL3_XMIT_RATE0;
>
> Â#define _TX_FLAGS(_c, _flag) Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â \
> Â Â Â Âif (flags & AR5K_TXDESC_##_flag) { Â Â Â Â Â Â Â Â Â Â Â\
> - Â Â Â Â Â Â Â tx_ctl->tx_control_##_c |= Â Â Â Â Â Â Â Â Â Â Â\
> - Â Â Â Â Â Â Â Â Â Â Â AR5K_4W_TX_DESC_CTL##_c##_##_flag; Â Â Â\
> + Â Â Â Â Â Â Â txctl##_c |= AR5K_4W_TX_DESC_CTL##_c##_##_flag; \
> Â Â Â Â}
>
> Â Â Â Â_TX_FLAGS(0, CLRDMASK);
> @@ -262,8 +265,8 @@ static int ath5k_hw_setup_4word_tx_desc(struct ath5k_hw *ah,
> Â Â Â Â * WEP crap
> Â Â Â Â */
> Â Â Â Âif (key_index != AR5K_TXKEYIX_INVALID) {
> - Â Â Â Â Â Â Â tx_ctl->tx_control_0 |= AR5K_4W_TX_DESC_CTL0_ENCRYPT_KEY_VALID;
> - Â Â Â Â Â Â Â tx_ctl->tx_control_1 |= AR5K_REG_SM(key_index,
> + Â Â Â Â Â Â Â txctl0 |= AR5K_4W_TX_DESC_CTL0_ENCRYPT_KEY_VALID;
> + Â Â Â Â Â Â Â txctl1 |= AR5K_REG_SM(key_index,
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â ÂAR5K_4W_TX_DESC_CTL1_ENCRYPT_KEY_IDX);
> Â Â Â Â}
>
> @@ -274,12 +277,16 @@ static int ath5k_hw_setup_4word_tx_desc(struct ath5k_hw *ah,
> Â Â Â Â Â Â Â Âif ((flags & AR5K_TXDESC_RTSENA) &&
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â(flags & AR5K_TXDESC_CTSENA))
> Â Â Â Â Â Â Â Â Â Â Â Âreturn -EINVAL;
> - Â Â Â Â Â Â Â tx_ctl->tx_control_2 |= rtscts_duration &
> - Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â AR5K_4W_TX_DESC_CTL2_RTS_DURATION;
> - Â Â Â Â Â Â Â tx_ctl->tx_control_3 |= AR5K_REG_SM(rtscts_rate,
> + Â Â Â Â Â Â Â txctl2 |= rtscts_duration & AR5K_4W_TX_DESC_CTL2_RTS_DURATION;
> + Â Â Â Â Â Â Â txctl3 |= AR5K_REG_SM(rtscts_rate,
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â ÂAR5K_4W_TX_DESC_CTL3_RTS_CTS_RATE);
> Â Â Â Â}
>
> + Â Â Â tx_ctl->tx_control_0 = txctl0;
> + Â Â Â tx_ctl->tx_control_1 = txctl1;
> + Â Â Â tx_ctl->tx_control_2 = txctl2;
> + Â Â Â tx_ctl->tx_control_3 = txctl3;
> +
> Â Â Â Âreturn 0;
> Â}
>
> --
> 1.7.3.2
>

Looks like this v2 did not found its way to wireless-next [1].

- Sedat -

[1] http://git.kernel.org/?p=linux/kernel/git/linville/wireless-next-2.6.git;a=commit;h=c5e0a88aa2e0f42cdb4c79c977c52f6bc38ec160
--
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