diff options
author | Arik Nemtsov <arik@wizery.com> | 2011-09-28 07:12:51 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2011-09-30 15:57:06 -0400 |
commit | 768db3438b4b48a33d073093bb364e624409cab7 (patch) | |
tree | 72e2d33d14484d46c16a2880df9c5d633ce7683c | |
parent | 109086ce0b0f94760bdb0e8e2566ff8a2d673639 (diff) |
mac80211: standardize adding supported rates IEs
Relocate the mesh implementation of adding the (extended) supported
rates IE to util.c, anticipating its use by other parts of mac80211.
Signed-off-by: Arik Nemtsov <arik@wizery.com>
Cc: Kalyan C Gaddam <chakkal@iit.edu>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r-- | include/net/mac80211.h | 5 | ||||
-rw-r--r-- | net/mac80211/mesh.c | 58 | ||||
-rw-r--r-- | net/mac80211/mesh.h | 4 | ||||
-rw-r--r-- | net/mac80211/mesh_plink.c | 4 | ||||
-rw-r--r-- | net/mac80211/tx.c | 4 | ||||
-rw-r--r-- | net/mac80211/util.c | 57 |
6 files changed, 66 insertions, 66 deletions
diff --git a/include/net/mac80211.h b/include/net/mac80211.h index 1e83afae3c64..b5f7ada2f87b 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h | |||
@@ -3444,4 +3444,9 @@ void ieee80211_enable_rssi_reports(struct ieee80211_vif *vif, | |||
3444 | int rssi_max_thold); | 3444 | int rssi_max_thold); |
3445 | 3445 | ||
3446 | void ieee80211_disable_rssi_reports(struct ieee80211_vif *vif); | 3446 | void ieee80211_disable_rssi_reports(struct ieee80211_vif *vif); |
3447 | |||
3448 | int ieee80211_add_srates_ie(struct ieee80211_vif *vif, struct sk_buff *skb); | ||
3449 | |||
3450 | int ieee80211_add_ext_srates_ie(struct ieee80211_vif *vif, | ||
3451 | struct sk_buff *skb); | ||
3447 | #endif /* MAC80211_H */ | 3452 | #endif /* MAC80211_H */ |
diff --git a/net/mac80211/mesh.c b/net/mac80211/mesh.c index a4225ae69681..a7078fdba8ca 100644 --- a/net/mac80211/mesh.c +++ b/net/mac80211/mesh.c | |||
@@ -320,64 +320,6 @@ mesh_add_rsn_ie(struct sk_buff *skb, struct ieee80211_sub_if_data *sdata) | |||
320 | return 0; | 320 | return 0; |
321 | } | 321 | } |
322 | 322 | ||
323 | int | ||
324 | mesh_add_srates_ie(struct sk_buff *skb, struct ieee80211_sub_if_data *sdata) | ||
325 | { | ||
326 | struct ieee80211_local *local = sdata->local; | ||
327 | struct ieee80211_supported_band *sband; | ||
328 | int rate; | ||
329 | u8 i, rates, *pos; | ||
330 | |||
331 | sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; | ||
332 | rates = sband->n_bitrates; | ||
333 | if (rates > 8) | ||
334 | rates = 8; | ||
335 | |||
336 | if (skb_tailroom(skb) < rates + 2) | ||
337 | return -ENOMEM; | ||
338 | |||
339 | pos = skb_put(skb, rates + 2); | ||
340 | *pos++ = WLAN_EID_SUPP_RATES; | ||
341 | *pos++ = rates; | ||
342 | for (i = 0; i < rates; i++) { | ||
343 | rate = sband->bitrates[i].bitrate; | ||
344 | *pos++ = (u8) (rate / 5); | ||
345 | } | ||
346 | |||
347 | return 0; | ||
348 | } | ||
349 | |||
350 | int | ||
351 | mesh_add_ext_srates_ie(struct sk_buff *skb, | ||
352 | struct ieee80211_sub_if_data *sdata) | ||
353 | { | ||
354 | struct ieee80211_local *local = sdata->local; | ||
355 | struct ieee80211_supported_band *sband; | ||
356 | int rate; | ||
357 | u8 i, exrates, *pos; | ||
358 | |||
359 | sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; | ||
360 | exrates = sband->n_bitrates; | ||
361 | if (exrates > 8) | ||
362 | exrates -= 8; | ||
363 | else | ||
364 | exrates = 0; | ||
365 | |||
366 | if (skb_tailroom(skb) < exrates + 2) | ||
367 | return -ENOMEM; | ||
368 | |||
369 | if (exrates) { | ||
370 | pos = skb_put(skb, exrates + 2); | ||
371 | *pos++ = WLAN_EID_EXT_SUPP_RATES; | ||
372 | *pos++ = exrates; | ||
373 | for (i = 8; i < sband->n_bitrates; i++) { | ||
374 | rate = sband->bitrates[i].bitrate; | ||
375 | *pos++ = (u8) (rate / 5); | ||
376 | } | ||
377 | } | ||
378 | return 0; | ||
379 | } | ||
380 | |||
381 | int mesh_add_ds_params_ie(struct sk_buff *skb, | 323 | int mesh_add_ds_params_ie(struct sk_buff *skb, |
382 | struct ieee80211_sub_if_data *sdata) | 324 | struct ieee80211_sub_if_data *sdata) |
383 | { | 325 | { |
diff --git a/net/mac80211/mesh.h b/net/mac80211/mesh.h index 7118e8e8855c..8c00e2d1d636 100644 --- a/net/mac80211/mesh.h +++ b/net/mac80211/mesh.h | |||
@@ -210,10 +210,6 @@ int mesh_add_rsn_ie(struct sk_buff *skb, | |||
210 | struct ieee80211_sub_if_data *sdata); | 210 | struct ieee80211_sub_if_data *sdata); |
211 | int mesh_add_vendor_ies(struct sk_buff *skb, | 211 | int mesh_add_vendor_ies(struct sk_buff *skb, |
212 | struct ieee80211_sub_if_data *sdata); | 212 | struct ieee80211_sub_if_data *sdata); |
213 | int mesh_add_srates_ie(struct sk_buff *skb, | ||
214 | struct ieee80211_sub_if_data *sdata); | ||
215 | int mesh_add_ext_srates_ie(struct sk_buff *skb, | ||
216 | struct ieee80211_sub_if_data *sdata); | ||
217 | int mesh_add_ds_params_ie(struct sk_buff *skb, | 213 | int mesh_add_ds_params_ie(struct sk_buff *skb, |
218 | struct ieee80211_sub_if_data *sdata); | 214 | struct ieee80211_sub_if_data *sdata); |
219 | void mesh_rmc_free(struct ieee80211_sub_if_data *sdata); | 215 | void mesh_rmc_free(struct ieee80211_sub_if_data *sdata); |
diff --git a/net/mac80211/mesh_plink.c b/net/mac80211/mesh_plink.c index 1213a23ff0fa..9cc5029b3c46 100644 --- a/net/mac80211/mesh_plink.c +++ b/net/mac80211/mesh_plink.c | |||
@@ -185,8 +185,8 @@ static int mesh_plink_frame_tx(struct ieee80211_sub_if_data *sdata, | |||
185 | pos = skb_put(skb, 2); | 185 | pos = skb_put(skb, 2); |
186 | memcpy(pos + 2, &plid, 2); | 186 | memcpy(pos + 2, &plid, 2); |
187 | } | 187 | } |
188 | if (mesh_add_srates_ie(skb, sdata) || | 188 | if (ieee80211_add_srates_ie(&sdata->vif, skb) || |
189 | mesh_add_ext_srates_ie(skb, sdata) || | 189 | ieee80211_add_ext_srates_ie(&sdata->vif, skb) || |
190 | mesh_add_rsn_ie(skb, sdata) || | 190 | mesh_add_rsn_ie(skb, sdata) || |
191 | mesh_add_meshid_ie(skb, sdata) || | 191 | mesh_add_meshid_ie(skb, sdata) || |
192 | mesh_add_meshconf_ie(skb, sdata)) | 192 | mesh_add_meshconf_ie(skb, sdata)) |
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index 7cd6c28968b2..542272acfc1a 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c | |||
@@ -2307,9 +2307,9 @@ struct sk_buff *ieee80211_beacon_get_tim(struct ieee80211_hw *hw, | |||
2307 | *pos++ = WLAN_EID_SSID; | 2307 | *pos++ = WLAN_EID_SSID; |
2308 | *pos++ = 0x0; | 2308 | *pos++ = 0x0; |
2309 | 2309 | ||
2310 | if (mesh_add_srates_ie(skb, sdata) || | 2310 | if (ieee80211_add_srates_ie(&sdata->vif, skb) || |
2311 | mesh_add_ds_params_ie(skb, sdata) || | 2311 | mesh_add_ds_params_ie(skb, sdata) || |
2312 | mesh_add_ext_srates_ie(skb, sdata) || | 2312 | ieee80211_add_ext_srates_ie(&sdata->vif, skb) || |
2313 | mesh_add_rsn_ie(skb, sdata) || | 2313 | mesh_add_rsn_ie(skb, sdata) || |
2314 | mesh_add_meshid_ie(skb, sdata) || | 2314 | mesh_add_meshid_ie(skb, sdata) || |
2315 | mesh_add_meshconf_ie(skb, sdata) || | 2315 | mesh_add_meshconf_ie(skb, sdata) || |
diff --git a/net/mac80211/util.c b/net/mac80211/util.c index 2c9dc360dc6d..9d4f14621bb0 100644 --- a/net/mac80211/util.c +++ b/net/mac80211/util.c | |||
@@ -1364,3 +1364,60 @@ void ieee80211_disable_rssi_reports(struct ieee80211_vif *vif) | |||
1364 | _ieee80211_enable_rssi_reports(sdata, 0, 0); | 1364 | _ieee80211_enable_rssi_reports(sdata, 0, 0); |
1365 | } | 1365 | } |
1366 | EXPORT_SYMBOL(ieee80211_disable_rssi_reports); | 1366 | EXPORT_SYMBOL(ieee80211_disable_rssi_reports); |
1367 | |||
1368 | int ieee80211_add_srates_ie(struct ieee80211_vif *vif, struct sk_buff *skb) | ||
1369 | { | ||
1370 | struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif); | ||
1371 | struct ieee80211_local *local = sdata->local; | ||
1372 | struct ieee80211_supported_band *sband; | ||
1373 | int rate; | ||
1374 | u8 i, rates, *pos; | ||
1375 | |||
1376 | sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; | ||
1377 | rates = sband->n_bitrates; | ||
1378 | if (rates > 8) | ||
1379 | rates = 8; | ||
1380 | |||
1381 | if (skb_tailroom(skb) < rates + 2) | ||
1382 | return -ENOMEM; | ||
1383 | |||
1384 | pos = skb_put(skb, rates + 2); | ||
1385 | *pos++ = WLAN_EID_SUPP_RATES; | ||
1386 | *pos++ = rates; | ||
1387 | for (i = 0; i < rates; i++) { | ||
1388 | rate = sband->bitrates[i].bitrate; | ||
1389 | *pos++ = (u8) (rate / 5); | ||
1390 | } | ||
1391 | |||
1392 | return 0; | ||
1393 | } | ||
1394 | |||
1395 | int ieee80211_add_ext_srates_ie(struct ieee80211_vif *vif, struct sk_buff *skb) | ||
1396 | { | ||
1397 | struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif); | ||
1398 | struct ieee80211_local *local = sdata->local; | ||
1399 | struct ieee80211_supported_band *sband; | ||
1400 | int rate; | ||
1401 | u8 i, exrates, *pos; | ||
1402 | |||
1403 | sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; | ||
1404 | exrates = sband->n_bitrates; | ||
1405 | if (exrates > 8) | ||
1406 | exrates -= 8; | ||
1407 | else | ||
1408 | exrates = 0; | ||
1409 | |||
1410 | if (skb_tailroom(skb) < exrates + 2) | ||
1411 | return -ENOMEM; | ||
1412 | |||
1413 | if (exrates) { | ||
1414 | pos = skb_put(skb, exrates + 2); | ||
1415 | *pos++ = WLAN_EID_EXT_SUPP_RATES; | ||
1416 | *pos++ = exrates; | ||
1417 | for (i = 8; i < sband->n_bitrates; i++) { | ||
1418 | rate = sband->bitrates[i].bitrate; | ||
1419 | *pos++ = (u8) (rate / 5); | ||
1420 | } | ||
1421 | } | ||
1422 | return 0; | ||
1423 | } | ||