From: Joe Perches <joe@perches.com>
To: Kalle Valo <kvalo@qca.qualcomm.com>
Cc: linux-wireless@vger.kernel.org, devel@linuxdriverproject.org,
gregkh@suse.de
Subject: Re: [PATCH 17/24] ath6kl: add main.c
Date: Tue, 12 Jul 2011 21:30:56 -0700 [thread overview]
Message-ID: <1310531456.1143.30.camel@Joe-Laptop> (raw)
In-Reply-To: <20110713013545.8517.71741.stgit@localhost6.localdomain6>
On Wed, 2011-07-13 at 04:35 +0300, Kalle Valo wrote:
> Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
> ---
> 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..
> +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.
> + sizeof(struct wmi_per_sta_stat));
> + memset(&ar->sta_list[i].mac, 0, ETH_ALEN);
> + memset(&ar->sta_list[i].wpa_ie, 0, IEEE80211_MAX_IE);
> + ar->sta_list[i].aid = 0;
> + ar->sta_list[i].sta_flags = 0;
> +
> + ar->sta_list_index = ar->sta_list_index & ~(1 << i);
> +
> +}
[]
> +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.
next prev parent reply other threads:[~2011-07-13 4:30 UTC|newest]
Thread overview: 56+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-13 1:32 [PATCH 00/24] ath6kl cleaned up driver Kalle Valo
2011-07-13 1:33 ` [PATCH 01/24] ath6kl: add bmi.c Kalle Valo
2011-07-13 4:28 ` Joe Perches
2011-07-13 7:08 ` Kalle Valo
2011-07-13 12:19 ` Joe Perches
2011-07-14 6:46 ` Kalle Valo
2011-07-14 7:33 ` Joe Perches
2011-07-14 7:38 ` Kalle Valo
2011-07-13 1:33 ` [PATCH 02/24] ath6kl: add bmi.h Kalle Valo
2011-07-13 1:33 ` [PATCH 03/24] ath6kl: add cfg80211.c Kalle Valo
2011-07-13 4:29 ` Joe Perches
2011-07-13 7:22 ` Kalle Valo
2011-07-13 1:33 ` [PATCH 04/24] ath6kl: add cfg80211.h Kalle Valo
2011-07-13 1:33 ` [PATCH 05/24] ath6kl: add common.h Kalle Valo
2011-07-13 1:33 ` [PATCH 06/24] ath6kl: add core.h Kalle Valo
2011-07-13 4:29 ` Joe Perches
2011-07-13 7:41 ` Kalle Valo
2011-07-13 1:34 ` [PATCH 07/24] ath6kl: add debug.c Kalle Valo
2011-07-13 4:29 ` Joe Perches
2011-07-13 1:34 ` [PATCH 08/24] ath6kl: add debug.h Kalle Valo
2011-07-13 1:34 ` [PATCH 09/24] ath6kl: add hif-ops.h Kalle Valo
2011-07-13 1:34 ` [PATCH 10/24] ath6kl: add hif.h Kalle Valo
2011-07-13 1:34 ` [PATCH 11/24] ath6kl: add htc.c Kalle Valo
2011-07-13 4:30 ` Joe Perches
2011-07-13 7:46 ` Kalle Valo
2011-07-13 12:33 ` Joe Perches
2011-07-13 13:38 ` Vasanthakumar Thiagarajan
2011-07-13 1:34 ` [PATCH 12/24] ath6kl: add htc.h Kalle Valo
2011-07-13 1:35 ` [PATCH 13/24] ath6kl: add htc_hif.c Kalle Valo
2011-07-13 1:35 ` [PATCH 14/24] ath6kl: add htc_hif.h Kalle Valo
2011-07-13 1:35 ` [PATCH 15/24] ath6kl: add ieee80211.h Kalle Valo
2011-07-13 7:29 ` Johannes Berg
2011-07-13 8:25 ` Kalle Valo
2011-07-13 1:35 ` [PATCH 16/24] ath6kl: add init.c Kalle Valo
2011-07-13 1:35 ` [PATCH 17/24] ath6kl: add main.c Kalle Valo
2011-07-13 4:30 ` Joe Perches [this message]
2011-07-13 8:18 ` Kalle Valo
2011-07-13 1:35 ` [PATCH 18/24] ath6kl: add node.c Kalle Valo
2011-07-13 1:36 ` [PATCH 19/24] ath6kl: add sdio.c Kalle Valo
2011-07-13 1:36 ` [PATCH 20/24] ath6kl: add target.h Kalle Valo
2011-07-13 1:36 ` [PATCH 21/24] ath6kl: add txrx.c Kalle Valo
2011-07-13 4:31 ` Joe Perches
2011-07-13 8:21 ` Kalle Valo
2011-07-13 8:23 ` Kalle Valo
2011-07-13 1:36 ` [PATCH 22/24] ath6kl: add wmi.c Kalle Valo
2011-07-13 1:36 ` [PATCH 23/24] ath6kl: add wmi.h Kalle Valo
2011-07-13 1:37 ` [PATCH 24/24] ath6kl: add Kconfig and Makefile Kalle Valo
2011-07-13 8:34 ` [PATCH 00/24] ath6kl cleaned up driver Kalle Valo
2011-07-13 9:22 ` Dan Carpenter
2011-07-13 9:28 ` Johannes Berg
2011-07-13 9:34 ` Dan Carpenter
2011-07-13 9:41 ` Johannes Berg
2011-07-13 9:33 ` Dan Carpenter
2011-07-13 10:04 ` Vasanthakumar Thiagarajan
2011-07-14 10:06 ` Dan Carpenter
2011-07-14 10:35 ` Kalle Valo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1310531456.1143.30.camel@Joe-Laptop \
--to=joe@perches.com \
--cc=devel@linuxdriverproject.org \
--cc=gregkh@suse.de \
--cc=kvalo@qca.qualcomm.com \
--cc=linux-wireless@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).