aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/tx.c
diff options
context:
space:
mode:
authorKalle Valo <kalle.valo@nokia.com>2010-01-05 13:16:38 -0500
committerJohn W. Linville <linville@tuxdriver.com>2010-01-12 13:51:25 -0500
commit05e54ea6cce400ac34528d705179b45244f61074 (patch)
treed645290f4866b457795696c7c4e9f609a07a4e55 /net/mac80211/tx.c
parentf7f70579340dba1e551c0e52349fde0370592174 (diff)
mac80211: create Probe Request template
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> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/tx.c')
-rw-r--r--net/mac80211/tx.c50
1 files changed, 50 insertions, 0 deletions
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index 055b45b146d9..0661e696a1dd 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -2278,6 +2278,56 @@ struct sk_buff *ieee80211_nullfunc_get(struct ieee80211_hw *hw,
2278} 2278}
2279EXPORT_SYMBOL(ieee80211_nullfunc_get); 2279EXPORT_SYMBOL(ieee80211_nullfunc_get);
2280 2280
2281struct sk_buff *ieee80211_probereq_get(struct ieee80211_hw *hw,
2282 struct ieee80211_vif *vif,
2283 const u8 *ssid, size_t ssid_len,
2284 const u8 *ie, size_t ie_len)
2285{
2286 struct ieee80211_sub_if_data *sdata;
2287 struct ieee80211_local *local;
2288 struct ieee80211_hdr_3addr *hdr;
2289 struct sk_buff *skb;
2290 size_t ie_ssid_len;
2291 u8 *pos;
2292
2293 sdata = vif_to_sdata(vif);
2294 local = sdata->local;
2295 ie_ssid_len = 2 + ssid_len;
2296
2297 skb = dev_alloc_skb(local->hw.extra_tx_headroom + sizeof(*hdr) +
2298 ie_ssid_len + ie_len);
2299 if (!skb) {
2300 printk(KERN_DEBUG "%s: failed to allocate buffer for probe "
2301 "request template\n", sdata->name);
2302 return NULL;
2303 }
2304
2305 skb_reserve(skb, local->hw.extra_tx_headroom);
2306
2307 hdr = (struct ieee80211_hdr_3addr *) skb_put(skb, sizeof(*hdr));
2308 memset(hdr, 0, sizeof(*hdr));
2309 hdr->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT |
2310 IEEE80211_STYPE_PROBE_REQ);
2311 memset(hdr->addr1, 0xff, ETH_ALEN);
2312 memcpy(hdr->addr2, vif->addr, ETH_ALEN);
2313 memset(hdr->addr3, 0xff, ETH_ALEN);
2314
2315 pos = skb_put(skb, ie_ssid_len);
2316 *pos++ = WLAN_EID_SSID;
2317 *pos++ = ssid_len;
2318 if (ssid)
2319 memcpy(pos, ssid, ssid_len);
2320 pos += ssid_len;
2321
2322 if (ie) {
2323 pos = skb_put(skb, ie_len);
2324 memcpy(pos, ie, ie_len);
2325 }
2326
2327 return skb;
2328}
2329EXPORT_SYMBOL(ieee80211_probereq_get);
2330
2281void ieee80211_rts_get(struct ieee80211_hw *hw, struct ieee80211_vif *vif, 2331void ieee80211_rts_get(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
2282 const void *frame, size_t frame_len, 2332 const void *frame, size_t frame_len,
2283 const struct ieee80211_tx_info *frame_txctl, 2333 const struct ieee80211_tx_info *frame_txctl,