From: Kalle Valo <kalle.valo@iki.fi>
To: linux-wireless@vger.kernel.org
Subject: [PATCH 4/9] mac80211: create Probe Request template
Date: Sun, 03 Jan 2010 23:07:49 +0200 [thread overview]
Message-ID: <20100103210749.29287.96141.stgit@tikku> (raw)
In-Reply-To: <20100103210552.29287.20384.stgit@tikku>
From: Kalle Valo <kalle.valo@nokia.com>
Certain type of hardware, for example wl1251 and wl1271, need a template
for the Probe Request. Create a function ieee80211_probereq_get() which
creates the template and drivers send it to hardware.
Signed-off-by: Kalle Valo <kalle.valo@nokia.com>
---
include/net/mac80211.h | 17 ++++++++++++++++
net/mac80211/tx.c | 50 ++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 67 insertions(+), 0 deletions(-)
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index eda45c3..02647bb 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -1904,6 +1904,23 @@ struct sk_buff *ieee80211_nullfunc_get(struct ieee80211_hw *hw,
struct ieee80211_vif *vif);
/**
+ * ieee80211_probereq_get - retrieve a Probe Request template
+ * @hw: pointer obtained from ieee80211_alloc_hw().
+ * @vif: &struct ieee80211_vif pointer from the add_interface callback.
+ * @ssid: SSID buffer
+ * @ssid_len: length of SSID
+ * @ie: buffer containing all IEs expect SSID for the template
+ * @ie_len: length of the IE buffer
+ *
+ * Creates a Probe Request template which can, for example, uploaded to
+ * hardware.
+ */
+struct sk_buff *ieee80211_probereq_get(struct ieee80211_hw *hw,
+ struct ieee80211_vif *vif,
+ const u8 *ssid, size_t ssid_len,
+ const u8 *ie, size_t ie_len);
+
+/**
* ieee80211_rts_get - RTS frame generation function
* @hw: pointer obtained from ieee80211_alloc_hw().
* @vif: &struct ieee80211_vif pointer from the add_interface callback.
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index bb8819d..361dbf6 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -2268,6 +2268,56 @@ struct sk_buff *ieee80211_nullfunc_get(struct ieee80211_hw *hw,
}
EXPORT_SYMBOL(ieee80211_nullfunc_get);
+struct sk_buff *ieee80211_probereq_get(struct ieee80211_hw *hw,
+ struct ieee80211_vif *vif,
+ const u8 *ssid, size_t ssid_len,
+ const u8 *ie, size_t ie_len)
+{
+ struct ieee80211_sub_if_data *sdata;
+ struct ieee80211_local *local;
+ struct ieee80211_hdr_3addr *hdr;
+ struct sk_buff *skb;
+ size_t ie_ssid_len;
+ u8 *pos;
+
+ sdata = vif_to_sdata(vif);
+ local = sdata->local;
+ ie_ssid_len = 2 + ssid_len;
+
+ skb = dev_alloc_skb(local->hw.extra_tx_headroom + sizeof(*hdr) +
+ ie_ssid_len + ie_len);
+ if (!skb) {
+ printk(KERN_DEBUG "%s: failed to allocate buffer for probe "
+ "request template\n", sdata->name);
+ return NULL;
+ }
+
+ skb_reserve(skb, local->hw.extra_tx_headroom);
+
+ hdr = (struct ieee80211_hdr_3addr *) skb_put(skb, sizeof(*hdr));
+ memset(hdr, 0, sizeof(*hdr));
+ hdr->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT |
+ IEEE80211_STYPE_PROBE_REQ);
+ memset(hdr->addr1, 0xff, ETH_ALEN);
+ memcpy(hdr->addr2, vif->addr, ETH_ALEN);
+ memset(hdr->addr3, 0xff, ETH_ALEN);
+
+ pos = skb_put(skb, ie_ssid_len);
+ *pos++ = WLAN_EID_SSID;
+ *pos++ = ssid_len;
+ if (ssid)
+ memcpy(pos, ssid, ssid_len);
+ pos += ssid_len;
+
+ if (ie) {
+ pos = skb_put(skb, ie_len);
+ memcpy(pos, ie, ie_len);
+ }
+
+ return skb;
+}
+EXPORT_SYMBOL(ieee80211_probereq_get);
+
void ieee80211_rts_get(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
const void *frame, size_t frame_len,
const struct ieee80211_tx_info *frame_txctl,
next prev parent reply other threads:[~2010-01-03 21:17 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-03 21:07 [PATCH 0/9] mac80211: templates for drivers Kalle Valo
2010-01-03 21:07 ` [PATCH 1/9] mac80211: add functions to create PS Poll and Nullfunc templates Kalle Valo
2010-01-03 21:07 ` [PATCH 2/9] mac80211: use PS Poll and Nullfunc templates when sending such frames Kalle Valo
2010-01-03 21:07 ` [PATCH 3/9] wl1251: get PS Poll and Nullfunc templates from mac80211 Kalle Valo
2010-01-03 21:07 ` Kalle Valo [this message]
2010-01-05 9:21 ` [PATCH 4/9] mac80211: create Probe Request template Johannes Berg
2010-01-05 10:15 ` Kalle Valo
2010-01-05 10:23 ` Johannes Berg
2010-01-03 21:07 ` [PATCH 5/9] mac80211: use Probe Request template when sending a direct scan Kalle Valo
2010-01-03 21:08 ` [PATCH 6/9] wl1251: cleanup scanning code Kalle Valo
2010-01-03 21:08 ` [PATCH 7/9] wl1251: get probe request template from mac80211 Kalle Valo
2010-01-03 21:08 ` [PATCH 8/9] wl1251: use mac80211 provided channel parameters in scanning Kalle Valo
2010-01-03 21:08 ` [PATCH 9/9] wl1251: fix sleep related error paths in wl1251_op_bss_info_changed() Kalle Valo
2010-01-05 9:22 ` [PATCH 0/9] mac80211: templates for drivers Johannes Berg
2010-01-05 10:17 ` 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=20100103210749.29287.96141.stgit@tikku \
--to=kalle.valo@iki.fi \
--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).