From: Jouni Malinen <jouni@qca.qualcomm.com>
To: Kalle Valo <kvalo@qca.qualcomm.com>
Cc: <linux-wireless@vger.kernel.org>
Subject: [PATCH] ath6kl: Use cfg80211_inform_bss instead of cfg80211_inform_bss_frame
Date: Thu, 11 Aug 2011 00:32:49 +0300 [thread overview]
Message-ID: <20110810213249.GA7328@jouni.qca.qualcomm.com> (raw)
There is no point in generating a bogus Beacon frame for
cfg80211_inform_bss_frame when cfg80211_inform_bss can be used
instead.
Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
---
drivers/net/wireless/ath/ath6kl/cfg80211.c | 44 +++++++++++-----------------
1 files changed, 17 insertions(+), 27 deletions(-)
diff --git a/drivers/net/wireless/ath/ath6kl/cfg80211.c b/drivers/net/wireless/ath/ath6kl/cfg80211.c
index 14559ff..201398e 100644
--- a/drivers/net/wireless/ath/ath6kl/cfg80211.c
+++ b/drivers/net/wireless/ath/ath6kl/cfg80211.c
@@ -723,8 +723,6 @@ static inline bool is_ch_11a(u16 ch)
/* struct ath6kl_node_table::nt_nodelock is locked when calling this */
void ath6kl_cfg80211_scan_node(struct wiphy *wiphy, struct bss *ni)
{
- u16 size;
- unsigned char *ieeemgmtbuf = NULL;
struct ieee80211_mgmt *mgmt;
struct ieee80211_channel *channel;
struct ieee80211_supported_band *band;
@@ -741,37 +739,29 @@ void ath6kl_cfg80211_scan_node(struct wiphy *wiphy, struct bss *ni)
else
band = wiphy->bands[IEEE80211_BAND_2GHZ]; /* 11b */
- size = ni->ni_framelen + offsetof(struct ieee80211_mgmt, u);
- ieeemgmtbuf = kmalloc(size, GFP_ATOMIC);
- if (!ieeemgmtbuf) {
- ath6kl_err("ieee mgmt buf alloc error\n");
- return;
- }
-
- /*
- * TODO: Update target to include 802.11 mac header while sending
- * bss info. Target removes 802.11 mac header while sending the bss
- * info to host, cfg80211 needs it, for time being just filling the
- * da, sa and bssid fields alone.
- */
- mgmt = (struct ieee80211_mgmt *)ieeemgmtbuf;
- memset(mgmt->da, 0xff, ETH_ALEN); /*broadcast addr */
- memcpy(mgmt->sa, ni->ni_macaddr, ETH_ALEN);
- memcpy(mgmt->bssid, ni->ni_macaddr, ETH_ALEN);
- memcpy(ieeemgmtbuf + offsetof(struct ieee80211_mgmt, u),
- ni->ni_buf, ni->ni_framelen);
-
freq = cie->ie_chan;
channel = ieee80211_get_channel(wiphy, freq);
signal = ni->ni_snr * 100;
ath6kl_dbg(ATH6KL_DBG_WLAN_CFG,
"%s: bssid %pM ch %d freq %d size %d\n", __func__,
- mgmt->bssid, channel->hw_value, freq, size);
- cfg80211_inform_bss_frame(wiphy, channel, mgmt,
- size, signal, GFP_ATOMIC);
-
- kfree(ieeemgmtbuf);
+ ni->ni_macaddr, channel->hw_value, freq, ni->ni_framelen);
+ /*
+ * Both Beacon and Probe Response frames have same payload structure,
+ * so it is fine to share the parser for both.
+ */
+ if (ni->ni_framelen < 8 + 2 + 2)
+ return;
+ mgmt = (struct ieee80211_mgmt *) (ni->ni_buf -
+ offsetof(struct ieee80211_mgmt, u));
+ cfg80211_inform_bss(wiphy, channel, ni->ni_macaddr,
+ le64_to_cpu(mgmt->u.beacon.timestamp),
+ le16_to_cpu(mgmt->u.beacon.capab_info),
+ le16_to_cpu(mgmt->u.beacon.beacon_int),
+ mgmt->u.beacon.variable,
+ ni->ni_buf + ni->ni_framelen -
+ mgmt->u.beacon.variable,
+ signal, GFP_ATOMIC);
}
static int ath6kl_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev,
--
1.7.4.1
--
Jouni Malinen PGP id EFC895FA
next reply other threads:[~2011-08-10 21:32 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-08-10 21:32 Jouni Malinen [this message]
2011-08-14 9:29 ` [PATCH] ath6kl: Use cfg80211_inform_bss instead of cfg80211_inform_bss_frame 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=20110810213249.GA7328@jouni.qca.qualcomm.com \
--to=jouni@qca.qualcomm.com \
--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).