diff options
Diffstat (limited to 'net/mac80211/util.c')
-rw-r--r-- | net/mac80211/util.c | 57 |
1 files changed, 57 insertions, 0 deletions
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 | } | ||