Commit 09593047 authored by Zhu Yi's avatar Zhu Yi Committed by John W. Linville

[PATCH] ieee80211: export list of bit rates with standard WEXT procddures

The patch replace the way to export the list of bit rates in scan results
from IWEVCUSTOM to SIOCGIWRATE. It also removes the max_rate item exported
with SIOCGIWRATE since this should be done by userspace.
Signed-off-by: default avatarJean Tourrilhes <jt@hpl.hp.com>
Signed-off-by: default avatarZhu Yi <yi.zhu@intel.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 73858062
...@@ -50,7 +50,8 @@ static char *ieee80211_translate_scan(struct ieee80211_device *ieee, ...@@ -50,7 +50,8 @@ static char *ieee80211_translate_scan(struct ieee80211_device *ieee,
char *p; char *p;
struct iw_event iwe; struct iw_event iwe;
int i, j; int i, j;
u8 max_rate, rate; char *current_val; /* For rates */
u8 rate;
/* First entry *MUST* be the AP MAC address */ /* First entry *MUST* be the AP MAC address */
iwe.cmd = SIOCGIWAP; iwe.cmd = SIOCGIWAP;
...@@ -107,9 +108,13 @@ static char *ieee80211_translate_scan(struct ieee80211_device *ieee, ...@@ -107,9 +108,13 @@ static char *ieee80211_translate_scan(struct ieee80211_device *ieee,
start = iwe_stream_add_point(start, stop, &iwe, network->ssid); start = iwe_stream_add_point(start, stop, &iwe, network->ssid);
/* Add basic and extended rates */ /* Add basic and extended rates */
max_rate = 0; /* Rate : stuffing multiple values in a single event require a bit
p = custom; * more of magic - Jean II */
p += snprintf(p, MAX_CUSTOM_LEN - (p - custom), " Rates (Mb/s): "); current_val = start + IW_EV_LCP_LEN;
iwe.cmd = SIOCGIWRATE;
/* Those two flags are ignored... */
iwe.u.bitrate.fixed = iwe.u.bitrate.disabled = 0;
for (i = 0, j = 0; i < network->rates_len;) { for (i = 0, j = 0; i < network->rates_len;) {
if (j < network->rates_ex_len && if (j < network->rates_ex_len &&
((network->rates_ex[j] & 0x7F) < ((network->rates_ex[j] & 0x7F) <
...@@ -117,28 +122,21 @@ static char *ieee80211_translate_scan(struct ieee80211_device *ieee, ...@@ -117,28 +122,21 @@ static char *ieee80211_translate_scan(struct ieee80211_device *ieee,
rate = network->rates_ex[j++] & 0x7F; rate = network->rates_ex[j++] & 0x7F;
else else
rate = network->rates[i++] & 0x7F; rate = network->rates[i++] & 0x7F;
if (rate > max_rate) /* Bit rate given in 500 kb/s units (+ 0x80) */
max_rate = rate; iwe.u.bitrate.value = ((rate & 0x7f) * 500000);
p += snprintf(p, MAX_CUSTOM_LEN - (p - custom), /* Add new value to event */
"%d%s ", rate >> 1, (rate & 1) ? ".5" : ""); current_val = iwe_stream_add_value(start, current_val, stop, &iwe, IW_EV_PARAM_LEN);
} }
for (; j < network->rates_ex_len; j++) { for (; j < network->rates_ex_len; j++) {
rate = network->rates_ex[j] & 0x7F; rate = network->rates_ex[j] & 0x7F;
p += snprintf(p, MAX_CUSTOM_LEN - (p - custom), /* Bit rate given in 500 kb/s units (+ 0x80) */
"%d%s ", rate >> 1, (rate & 1) ? ".5" : ""); iwe.u.bitrate.value = ((rate & 0x7f) * 500000);
if (rate > max_rate) /* Add new value to event */
max_rate = rate; current_val = iwe_stream_add_value(start, current_val, stop, &iwe, IW_EV_PARAM_LEN);
} }
/* Check if we added any rate */
iwe.cmd = SIOCGIWRATE; if((current_val - start) > IW_EV_LCP_LEN)
iwe.u.bitrate.fixed = iwe.u.bitrate.disabled = 0; start = current_val;
iwe.u.bitrate.value = max_rate * 500000;
start = iwe_stream_add_event(start, stop, &iwe, IW_EV_PARAM_LEN);
iwe.cmd = IWEVCUSTOM;
iwe.u.data.length = p - custom;
if (iwe.u.data.length)
start = iwe_stream_add_point(start, stop, &iwe, custom);
/* Add quality statistics */ /* Add quality statistics */
iwe.cmd = IWEVQUAL; iwe.cmd = IWEVQUAL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment