Search Linux Wireless

[PATCH] mac80211: Sort supported rates in scan output

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In mac80211, the results of a scan show basic rates followed by extended
rates, thus values are not listed in any particular order. This patch sorts
all rates in increasing value.

Signed-off-by: Larry Finger <Larry.Finger@xxxxxxxxxxxx>
---

Index: wireless-dev/net/mac80211/ieee80211_sta.c
===================================================================
--- wireless-dev.orig/net/mac80211/ieee80211_sta.c
+++ wireless-dev/net/mac80211/ieee80211_sta.c
@@ -3013,7 +3017,8 @@ ieee80211_sta_scan_result(struct net_dev
 	if (bss && bss->supp_rates_len > 0) {
 		/* display all supported rates in readable format */
 		char *p = current_ev + IW_EV_LCP_LEN;
-		int i;
+		int i, j, tmp;
+		int trial_rate, cur_rate = 0;
 
 		memset(&iwe, 0, sizeof(iwe));
 		iwe.cmd = SIOCGIWRATE;
@@ -3021,8 +3026,14 @@ ieee80211_sta_scan_result(struct net_dev
 		iwe.u.bitrate.fixed = iwe.u.bitrate.disabled = 0;
 
 		for (i = 0; i < bss->supp_rates_len; i++) {
-			iwe.u.bitrate.value = ((bss->supp_rates[i] &
-							0x7f) * 500000);
+			trial_rate = 99999999;
+			for (j = 0; j < bss->supp_rates_len; j++) {
+				tmp = bss->supp_rates[j] & 0x7f;
+				if (tmp > cur_rate && tmp < trial_rate)
+					trial_rate = tmp;
+			}
+			cur_rate = trial_rate;
+			iwe.u.bitrate.value = cur_rate * 500000;
 			p = iwe_stream_add_value(current_ev, p,
 					end_buf, &iwe, IW_EV_PARAM_LEN);
 		}
-
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux