aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2012-11-29 07:00:10 -0500
committerJohannes Berg <johannes.berg@intel.com>2012-11-30 07:41:27 -0500
commitb9a9ada14aab17f08c1d9735601f1097cdcfc6de (patch)
tree47d823b696f262c53d5f52ef60bfb143b8444fa0
parentc604b9f219422e969fe371cc7259de34c3c5601d (diff)
mac80211: remove probe response temporary buffer allocation
Instead of allocating a temporary buffer to build IEs build them right into the SKB. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
-rw-r--r--drivers/net/wireless/mac80211_hwsim.c7
-rw-r--r--drivers/net/wireless/ti/wl1251/main.c4
-rw-r--r--drivers/net/wireless/ti/wlcore/cmd.c4
-rw-r--r--include/net/mac80211.h5
-rw-r--r--net/mac80211/tx.c9
-rw-r--r--net/mac80211/util.c26
6 files changed, 25 insertions, 30 deletions
diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c
index 2aa8a1aa1184..8a61dbd320e6 100644
--- a/drivers/net/wireless/mac80211_hwsim.c
+++ b/drivers/net/wireless/mac80211_hwsim.c
@@ -1347,9 +1347,14 @@ static void hw_scan_work(struct work_struct *work)
1347 hwsim->hw_scan_vif, 1347 hwsim->hw_scan_vif,
1348 req->ssids[i].ssid, 1348 req->ssids[i].ssid,
1349 req->ssids[i].ssid_len, 1349 req->ssids[i].ssid_len,
1350 req->ie, req->ie_len); 1350 req->ie_len);
1351 if (!probe) 1351 if (!probe)
1352 continue; 1352 continue;
1353
1354 if (req->ie_len)
1355 memcpy(skb_put(probe, req->ie_len), req->ie,
1356 req->ie_len);
1357
1353 local_bh_disable(); 1358 local_bh_disable();
1354 mac80211_hwsim_tx_frame(hwsim->hw, probe, 1359 mac80211_hwsim_tx_frame(hwsim->hw, probe,
1355 hwsim->tmp_chan); 1360 hwsim->tmp_chan);
diff --git a/drivers/net/wireless/ti/wl1251/main.c b/drivers/net/wireless/ti/wl1251/main.c
index 441cbccbd381..f47e8b0482ad 100644
--- a/drivers/net/wireless/ti/wl1251/main.c
+++ b/drivers/net/wireless/ti/wl1251/main.c
@@ -896,11 +896,13 @@ static int wl1251_op_hw_scan(struct ieee80211_hw *hw,
896 goto out; 896 goto out;
897 897
898 skb = ieee80211_probereq_get(wl->hw, wl->vif, ssid, ssid_len, 898 skb = ieee80211_probereq_get(wl->hw, wl->vif, ssid, ssid_len,
899 req->ie, req->ie_len); 899 req->ie_len);
900 if (!skb) { 900 if (!skb) {
901 ret = -ENOMEM; 901 ret = -ENOMEM;
902 goto out; 902 goto out;
903 } 903 }
904 if (req->ie_len)
905 memcpy(skb_put(skb, req->ie_len), req->ie, req->ie_len);
904 906
905 ret = wl1251_cmd_template_set(wl, CMD_PROBE_REQ, skb->data, 907 ret = wl1251_cmd_template_set(wl, CMD_PROBE_REQ, skb->data,
906 skb->len); 908 skb->len);
diff --git a/drivers/net/wireless/ti/wlcore/cmd.c b/drivers/net/wireless/ti/wlcore/cmd.c
index eaef3f41b252..27f83f72a93b 100644
--- a/drivers/net/wireless/ti/wlcore/cmd.c
+++ b/drivers/net/wireless/ti/wlcore/cmd.c
@@ -1038,11 +1038,13 @@ int wl12xx_cmd_build_probe_req(struct wl1271 *wl, struct wl12xx_vif *wlvif,
1038 u16 template_id_5 = CMD_TEMPL_CFG_PROBE_REQ_5; 1038 u16 template_id_5 = CMD_TEMPL_CFG_PROBE_REQ_5;
1039 1039
1040 skb = ieee80211_probereq_get(wl->hw, vif, ssid, ssid_len, 1040 skb = ieee80211_probereq_get(wl->hw, vif, ssid, ssid_len,
1041 ie, ie_len); 1041 ie_len);
1042 if (!skb) { 1042 if (!skb) {
1043 ret = -ENOMEM; 1043 ret = -ENOMEM;
1044 goto out; 1044 goto out;
1045 } 1045 }
1046 if (ie_len)
1047 memcpy(skb_put(skb, ie_len), ie, ie_len);
1046 1048
1047 wl1271_dump(DEBUG_SCAN, "PROBE REQ: ", skb->data, skb->len); 1049 wl1271_dump(DEBUG_SCAN, "PROBE REQ: ", skb->data, skb->len);
1048 1050
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index e806f1d81f66..0472d806fb41 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -3144,8 +3144,7 @@ struct sk_buff *ieee80211_nullfunc_get(struct ieee80211_hw *hw,
3144 * @vif: &struct ieee80211_vif pointer from the add_interface callback. 3144 * @vif: &struct ieee80211_vif pointer from the add_interface callback.
3145 * @ssid: SSID buffer 3145 * @ssid: SSID buffer
3146 * @ssid_len: length of SSID 3146 * @ssid_len: length of SSID
3147 * @ie: buffer containing all IEs except SSID for the template 3147 * @tailroom: tailroom to reserve at end of SKB for IEs
3148 * @ie_len: length of the IE buffer
3149 * 3148 *
3150 * Creates a Probe Request template which can, for example, be uploaded to 3149 * Creates a Probe Request template which can, for example, be uploaded to
3151 * hardware. 3150 * hardware.
@@ -3153,7 +3152,7 @@ struct sk_buff *ieee80211_nullfunc_get(struct ieee80211_hw *hw,
3153struct sk_buff *ieee80211_probereq_get(struct ieee80211_hw *hw, 3152struct sk_buff *ieee80211_probereq_get(struct ieee80211_hw *hw,
3154 struct ieee80211_vif *vif, 3153 struct ieee80211_vif *vif,
3155 const u8 *ssid, size_t ssid_len, 3154 const u8 *ssid, size_t ssid_len,
3156 const u8 *ie, size_t ie_len); 3155 size_t tailroom);
3157 3156
3158/** 3157/**
3159 * ieee80211_rts_get - RTS frame generation function 3158 * ieee80211_rts_get - RTS frame generation function
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index d8ef3417bf2b..ba1ac9d62b08 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -2620,7 +2620,7 @@ EXPORT_SYMBOL(ieee80211_nullfunc_get);
2620struct sk_buff *ieee80211_probereq_get(struct ieee80211_hw *hw, 2620struct sk_buff *ieee80211_probereq_get(struct ieee80211_hw *hw,
2621 struct ieee80211_vif *vif, 2621 struct ieee80211_vif *vif,
2622 const u8 *ssid, size_t ssid_len, 2622 const u8 *ssid, size_t ssid_len,
2623 const u8 *ie, size_t ie_len) 2623 size_t tailroom)
2624{ 2624{
2625 struct ieee80211_sub_if_data *sdata; 2625 struct ieee80211_sub_if_data *sdata;
2626 struct ieee80211_local *local; 2626 struct ieee80211_local *local;
@@ -2634,7 +2634,7 @@ struct sk_buff *ieee80211_probereq_get(struct ieee80211_hw *hw,
2634 ie_ssid_len = 2 + ssid_len; 2634 ie_ssid_len = 2 + ssid_len;
2635 2635
2636 skb = dev_alloc_skb(local->hw.extra_tx_headroom + sizeof(*hdr) + 2636 skb = dev_alloc_skb(local->hw.extra_tx_headroom + sizeof(*hdr) +
2637 ie_ssid_len + ie_len); 2637 ie_ssid_len + tailroom);
2638 if (!skb) 2638 if (!skb)
2639 return NULL; 2639 return NULL;
2640 2640
@@ -2655,11 +2655,6 @@ struct sk_buff *ieee80211_probereq_get(struct ieee80211_hw *hw,
2655 memcpy(pos, ssid, ssid_len); 2655 memcpy(pos, ssid, ssid_len);
2656 pos += ssid_len; 2656 pos += ssid_len;
2657 2657
2658 if (ie) {
2659 pos = skb_put(skb, ie_len);
2660 memcpy(pos, ie, ie_len);
2661 }
2662
2663 return skb; 2658 return skb;
2664} 2659}
2665EXPORT_SYMBOL(ieee80211_probereq_get); 2660EXPORT_SYMBOL(ieee80211_probereq_get);
diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index f119b1b6c1a7..41c9841614b8 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -1239,14 +1239,8 @@ struct sk_buff *ieee80211_build_probe_req(struct ieee80211_sub_if_data *sdata,
1239 struct ieee80211_local *local = sdata->local; 1239 struct ieee80211_local *local = sdata->local;
1240 struct sk_buff *skb; 1240 struct sk_buff *skb;
1241 struct ieee80211_mgmt *mgmt; 1241 struct ieee80211_mgmt *mgmt;
1242 size_t buf_len;
1243 u8 *buf;
1244 u8 chan_no; 1242 u8 chan_no;
1245 1243 int ies_len;
1246 /* FIXME: come up with a proper value */
1247 buf = kmalloc(200 + ie_len, GFP_KERNEL);
1248 if (!buf)
1249 return NULL;
1250 1244
1251 /* 1245 /*
1252 * Do not send DS Channel parameter for directed probe requests 1246 * Do not send DS Channel parameter for directed probe requests
@@ -1258,15 +1252,16 @@ struct sk_buff *ieee80211_build_probe_req(struct ieee80211_sub_if_data *sdata,
1258 else 1252 else
1259 chan_no = ieee80211_frequency_to_channel(chan->center_freq); 1253 chan_no = ieee80211_frequency_to_channel(chan->center_freq);
1260 1254
1261 buf_len = ieee80211_build_preq_ies(local, buf, 200 + ie_len,
1262 ie, ie_len, chan->band,
1263 ratemask, chan_no);
1264
1265 skb = ieee80211_probereq_get(&local->hw, &sdata->vif, 1255 skb = ieee80211_probereq_get(&local->hw, &sdata->vif,
1266 ssid, ssid_len, 1256 ssid, ssid_len, 100 + ie_len);
1267 buf, buf_len);
1268 if (!skb) 1257 if (!skb)
1269 goto out; 1258 return NULL;
1259
1260 ies_len = ieee80211_build_preq_ies(local, skb_tail_pointer(skb),
1261 skb_tailroom(skb),
1262 ie, ie_len, chan->band,
1263 ratemask, chan_no);
1264 skb_put(skb, ies_len);
1270 1265
1271 if (dst) { 1266 if (dst) {
1272 mgmt = (struct ieee80211_mgmt *) skb->data; 1267 mgmt = (struct ieee80211_mgmt *) skb->data;
@@ -1276,9 +1271,6 @@ struct sk_buff *ieee80211_build_probe_req(struct ieee80211_sub_if_data *sdata,
1276 1271
1277 IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT; 1272 IEEE80211_SKB_CB(skb)->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT;
1278 1273
1279 out:
1280 kfree(buf);
1281
1282 return skb; 1274 return skb;
1283} 1275}
1284 1276