aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211
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 /net/mac80211
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>
Diffstat (limited to 'net/mac80211')
-rw-r--r--net/mac80211/tx.c9
-rw-r--r--net/mac80211/util.c26
2 files changed, 11 insertions, 24 deletions
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