netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mohamed Abbas <mabbas@linux.intel.com>
To: netdev@vger.kernel.org
Cc: "John W. Linville" <linville@tuxdriver.com>
Subject: [PATCH 02/3] d80211:  iwlist scan
Date: Mon, 21 Aug 2006 17:36:16 -0700	[thread overview]
Message-ID: <44EA5180.2080701@linux.intel.com> (raw)
In-Reply-To: <44EA501E.4010605@linux.intel.com>

[-- Attachment #1: Type: text/plain, Size: 299 bytes --]

This patch enhance iwlist scan to dispaly supported rate with readable 
format. It also add a macro to convert channel to freq value. this macro 
is needed in ieee80211_rx_bss_info. In 3945 we issues a host scan 
command to perform scanning which will cause in setting the freq to the 
wrong value.

[-- Attachment #2: d80211-iwlist-fix.patch --]
[-- Type: text/plain, Size: 3203 bytes --]

diff --git a/net/d80211/ieee80211_i.h b/net/d80211/ieee80211_i.h
index bdaaf5e..29c40c5 100644
--- a/net/d80211/ieee80211_i.h
+++ b/net/d80211/ieee80211_i.h
@@ -442,6 +445,7 @@ #define IEEE80211_IRQSAFE_QUEUE_LIMIT 12
 #define IEEE80211_SCAN_MATCH_SSID BIT(0)
 #define IEEE80211_SCAN_WPA_ONLY BIT(1)
 #define IEEE80211_SCAN_EXTRA_INFO BIT(2)
+#define IEEE80211_SCAN_SUPP_RATE_INFO BIT(3)
 	int scan_flags;
 
 #ifdef CONFIG_HOSTAPD_WPA_TESTING
diff --git a/net/d80211/ieee80211_sta.c b/net/d80211/ieee80211_sta.c
index 8caf352..1153932 100644
--- a/net/d80211/ieee80211_sta.c
+++ b/net/d80211/ieee80211_sta.c
@@ -1329,6 +1329,11 @@ void ieee80211_rx_bss_list_deinit(struct
 	}
 }
 
+/* macro to convert channel to freq value */
+#define ieee80211chan2mhz(x) \
+        (((x) <= 14) ? \
+        (((x) == 14) ? 2484 : ((x) * 5) + 2407) : \
+        ((x) + 1000) * 5)
 
 static void ieee80211_rx_bss_info(struct net_device *dev,
 				  struct ieee80211_mgmt *mgmt,
@@ -1547,18 +1552,7 @@ #endif
 	bss->hw_mode = local->conf.phymode;
 	bss->channel = channel;
 	bss->freq = local->conf.freq;
-	if (channel != local->conf.channel &&
-	    (local->conf.phymode == MODE_IEEE80211G ||
-	     local->conf.phymode == MODE_IEEE80211B) &&
-	    channel >= 1 && channel <= 14) {
-		static const int freq_list[] = {
-			2412, 2417, 2422, 2427, 2432, 2437, 2442,
-			2447, 2452, 2457, 2462, 2467, 2472, 2484
-		};
-		/* IEEE 802.11g/b mode can receive packets from neighboring
-		 * channels, so map the channel into frequency. */
-		bss->freq = freq_list[channel - 1];
-	}
+	bss->freq = ieee80211chan2mhz(channel);
 	bss->timestamp = timestamp;
 	bss->last_update = jiffies;
 	bss->rssi = rx_status->ssi;
@@ -2724,16 +2719,33 @@ ieee80211_sta_scan_result(struct net_dev
 		current_ev = iwe_stream_add_point(current_ev, end_buf, &iwe,
 						  buf);
 
-		p = buf;
-		p += sprintf(p, "supp_rates=");
-		for (i = 0; i < bss->supp_rates_len; i++)
-			p+= sprintf(p, "%02x", bss->supp_rates[i]);
-		memset(&iwe, 0, sizeof(iwe));
-		iwe.cmd = IWEVCUSTOM;
-		iwe.u.data.length = strlen(buf);
-		current_ev = iwe_stream_add_point(current_ev, end_buf, &iwe,
-						  buf);
-
+		/* dispaly all support rates in readable format */
+		if ((local->scan_flags & IEEE80211_SCAN_SUPP_RATE_INFO)) {
+        		p = current_ev + IW_EV_LCP_LEN;
+        		iwe.cmd = SIOCGIWRATE;
+        		/* Those two flags are ignored... */
+        		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);
+				p = iwe_stream_add_value(current_ev, p, 
+					      end_buf, &iwe, IW_EV_PARAM_LEN);
+			}
+        		/* Check if we added any rate */
+	        	if((p - current_ev) > IW_EV_LCP_LEN)
+                		current_ev = p;
+		} else {
+			p = buf;
+			p += sprintf(p, "supp_rates=");
+			for (i = 0; i < bss->supp_rates_len; i++)
+				p+= sprintf(p, "%02x", bss->supp_rates[i]);
+			memset(&iwe, 0, sizeof(iwe));
+			iwe.cmd = IWEVCUSTOM;
+			iwe.u.data.length = strlen(buf);
+			current_ev = iwe_stream_add_point(current_ev, end_buf, 
+						  &iwe, buf);
+		}
 		kfree(buf);
 		break;
 	} while (0);

  reply	other threads:[~2006-08-22  0:37 UTC|newest]

Thread overview: 57+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-21  7:41 [PATCH 00/18] d80211: various cleanups/fixes/changes Johannes Berg
2006-08-21  7:41 ` [PATCH 01/18] d80211: LED triggers Johannes Berg
2006-08-22  0:30   ` [PATCH 01/3] d80211: add support for SIOCSIWRATE, SIOCSIWTXPOW and SIOCSIWPOWER Mohamed Abbas
2006-08-22  0:36     ` Mohamed Abbas [this message]
2006-08-23 15:46       ` [PATCH 02/3] d80211: iwlist scan Jiri Benc
2006-08-28 20:37         ` [PATCH 0/7] d80211: support more wireless command mabbas
2006-08-22  0:38     ` [PATCH 03/3] d80211: adhoc Mohamed Abbas
2006-08-23 15:51       ` Jiri Benc
2006-08-23 15:19     ` [PATCH 01/3] d80211: add support for SIOCSIWRATE, SIOCSIWTXPOW and SIOCSIWPOWER Jiri Benc
2006-08-25 18:37     ` Jouni Malinen
2006-08-25 18:46       ` Mohamed Abbas
2006-08-22 16:54   ` [PATCH 01/18] d80211: LED triggers Jouni Malinen
2006-08-22 18:38     ` Jiri Benc
2006-08-23  7:02     ` Johannes Berg
2006-08-23 18:16   ` Jiri Benc
2006-08-24  7:03     ` Johannes Berg
2006-09-22 11:59   ` Jiri Benc
2006-08-21  7:41 ` [PATCH 02/18] d80211: master link Johannes Berg
2006-08-21  8:13   ` Johannes Berg
2006-08-21 19:08   ` Jiri Benc
2006-08-22  7:49     ` Johannes Berg
2006-08-21  7:41 ` [PATCH 03/18] d80211: pointers as extended booleans Johannes Berg
2006-08-22  6:43   ` Bill Fink
2006-08-22  8:39     ` Johannes Berg
2006-08-21  7:41 ` [PATCH 04/18] d80211: use kzalloc() Johannes Berg
2006-08-21  7:41 ` [PATCH 05/18] d80211: get rid of WME bitfield Johannes Berg
2006-08-21  7:41 ` [PATCH 06/18] d80211: rework rate control registration Johannes Berg
2006-08-21 19:19   ` Jiri Benc
2006-08-22  8:33     ` Johannes Berg
2006-08-21  7:41 ` [PATCH 07/18] d80211: get rid of sta_aid in favour of keeping track of TIM Johannes Berg
2006-08-22 18:36   ` Jiri Benc
2006-08-23  7:04     ` Johannes Berg
2006-08-23 10:04     ` [PATCH] " Johannes Berg
2006-08-23 10:05       ` Johannes Berg
2006-08-23 10:16     ` [PATCH ] " Johannes Berg
2006-08-21  7:41 ` [PATCH 08/18] d80211: clean up exports Johannes Berg
2006-08-22 16:44   ` Jouni Malinen
2006-08-23  7:01     ` Johannes Berg
2006-08-23 10:03     ` [PATCH] " Johannes Berg
2006-08-21  7:41 ` [PATCH 09/18] d80211: move out rate control registration code Johannes Berg
2006-08-21  7:41 ` [PATCH 10/18] d80211: clean up includes Johannes Berg
2006-08-21  7:41 ` [PATCH 11/18] d80211: clean up qdisc requeue Johannes Berg
2006-08-21 19:31   ` Jiri Benc
2006-08-22  7:48     ` Johannes Berg
2006-08-21  7:41 ` [PATCH 12/18] d80211: fix some sparse warnings Johannes Berg
2006-08-22 18:55   ` Jiri Benc
2006-08-21  7:41 ` [PATCH 13/18] d80211: clean up some coding style issues Johannes Berg
2006-08-21 19:35   ` Jiri Benc
2006-08-22  8:27     ` Johannes Berg
2006-08-21  7:41 ` [PATCH 14/18] d80211: make lowlevel TX framedump option visible Johannes Berg
2006-08-21  7:41 ` [PATCH 15/18] d80211: surface IBSS debug Johannes Berg
2006-08-21  7:41 ` [PATCH 16/18] d80211: get rid of MICHAEL_MIC_HWACCEL define Johannes Berg
2006-08-22 19:00   ` Jiri Benc
2006-08-23  7:05     ` Johannes Berg
2006-08-23  9:46       ` Jiri Benc
2006-08-21  7:41 ` [PATCH 17/18] d80211: surface powersave debug switch Johannes Berg
2006-08-21  7:41 ` [PATCH 18/18] d80211: fix some documentation Johannes Berg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=44EA5180.2080701@linux.intel.com \
    --to=mabbas@linux.intel.com \
    --cc=linville@tuxdriver.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).