Search Linux Wireless

Re: [PATCH 17/24] ath6kl: add main.c

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

 



On 07/13/2011 07:30 AM, Joe Perches wrote:
> On Wed, 2011-07-13 at 04:35 +0300, Kalle Valo wrote:
>> Signed-off-by: Kalle Valo <kvalo@xxxxxxxxxxxxxxxx>
>> ---
>>  drivers/net/wireless/ath/ath6kl/main.c | 1337 ++++++++++++++++++++++++++++++++
> 
>> +static void ath6kl_add_new_sta(struct ath6kl *ar, u8 *mac, u16 aid, u8 *wpaie,
>> +			u8 ielen, u8 keymgmt, u8 ucipher, u8 auth)
>> +{
>> +	u8 free_slot;
>> +
>> +	free_slot = aid - 1;
>> +	memcpy(ar->sta_list[free_slot].mac, mac, ETH_ALEN);
>> +	memcpy(ar->sta_list[free_slot].wpa_ie, wpaie, ielen);
> 
> 
> Many versions of gcc do not optimize these repeated dereferences.
> It's better to use a temporary local.
> 
> 	struct ath6kl_sta *sta = &ar->sta_list[free_slot];
> 
> 	memcpy(sta->mac, mac, ETH_ALEN);
> 	memcpy(sta->wpa_ie, wpaie, ielen);
> 
> 	etc..

Fixed.

>> +static void ath6kl_sta_cleanup(struct ath6kl *ar, u8 i)
>> +{
>> +	/* empty the queued pkts in the PS queue if any */
>> +	spin_lock_bh(&ar->sta_list[i].psq_lock);
>> +	skb_queue_purge(&ar->sta_list[i].psq);
>> +	spin_unlock_bh(&ar->sta_list[i].psq_lock);
>> +
>> +	memset(&ar->ap_stats.sta[ar->sta_list[i].aid - 1], 0,
> 
> here too.

Fixed.

>> +void ath6kl_tgt_stats_event(struct ath6kl *ar, u8 *ptr, u32 len)
>> +{
>> +	struct wmi_ap_mode_stat *p = (struct wmi_ap_mode_stat *) ptr;
>> +	struct wmi_ap_mode_stat *ap = &ar->ap_stats;
>> +	u8 ac;
>> +
>> +	if (ar->nw_type == AP_NETWORK) {
>> +		if (len < sizeof(*p))
>> +			return;
>> +
>> +		for (ac = 0; ac < AP_MAX_NUM_STA; ac++) {
>> +			ath6kl_add_le32(&ap->sta[ac].tx_bytes,
>> +					p->sta[ac].tx_bytes);
> 
> maybe better here to use temporaries too.
> 
> 		struct ath6kl_sta *st_ap = &ap->sta[ac];
> 		struct ath6kl_sta *st_p = &p->sta[ac];
> 
>> +			ath6kl_add_le32(&ap->sta[ac].tx_pkts,
>> +					p->sta[ac].tx_pkts);
>> +			ath6kl_add_le32(&ap->sta[ac].tx_error,
>> +					p->sta[ac].tx_error);
> 
> 			ath6kl_add_le32(st_ap->tx_pkts, st_p->tx_pkts);
> 			ath6kl_add_le32(st_ap->tx_error, st_p->tx_error);
> 
> etc.

Fixed.

Kalle
--
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