netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hong Liu <hong.liu@intel.com>
To: jbenc@suse.cz
Cc: netdev@vger.kernel.org
Subject: [PATCH 2/2]d80211: add hardware scan callback
Date: Fri, 25 Aug 2006 16:32:13 +0800	[thread overview]
Message-ID: <1156494733.21483.14.camel@devlinux-hong> (raw)

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

Add hardware scan callback to support cards like ipw3945 which
implements the scan command in firmware.

Thanks,
Hong

[-- Attachment #2: d80211-add-hw-scan-git.patch --]
[-- Type: text/x-patch, Size: 3712 bytes --]

diff --git a/include/net/d80211.h b/include/net/d80211.h
index ba5cb4c..b369d12 100644
--- a/include/net/d80211.h
+++ b/include/net/d80211.h
@@ -595,6 +595,10 @@ struct ieee80211_hw {
         int (*passive_scan)(struct net_device *dev, int state,
                             struct ieee80211_scan_conf *conf);
 
+	/* Ask the hardware to service the scan request, no need to start
+	 * the scan state machine in stack. */
+	int (*hw_scan)(struct net_device *dev, u8 *ssid, size_t len);
+
         /* return low-level statistics */
 	int (*get_stats)(struct net_device *dev,
 			 struct ieee80211_low_level_stats *stats);
@@ -893,6 +897,8 @@ void ieee80211_tx_led(int state, struct 
  */
 void ieee80211_rx_led(int state, struct net_device *dev);
 
+/* set station scan completed */
+void ieee80211_set_scan_completed(struct net_device *dev);
 
 /* IEEE 802.11 defines */
 
diff --git a/net/d80211/ieee80211.c b/net/d80211/ieee80211.c
index 60eca90..dc920c1 100644
--- a/net/d80211/ieee80211.c
+++ b/net/d80211/ieee80211.c
@@ -4831,6 +4831,7 @@ EXPORT_SYMBOL(sta_info_get);
 EXPORT_SYMBOL(sta_info_put);
 EXPORT_SYMBOL(ieee80211_radar_status);
 EXPORT_SYMBOL(ieee80211_get_mc_list_item);
+EXPORT_SYMBOL(ieee80211_set_scan_completed);
 
 module_init(ieee80211_init);
 module_exit(ieee80211_exit);
diff --git a/net/d80211/ieee80211_sta.c b/net/d80211/ieee80211_sta.c
index 2144b34..4bb2234 100644
--- a/net/d80211/ieee80211_sta.c
+++ b/net/d80211/ieee80211_sta.c
@@ -2426,6 +2426,28 @@ static int ieee80211_active_scan(struct 
 }
 
 
+void ieee80211_set_scan_completed(struct net_device *dev)
+{
+	struct ieee80211_local *local = dev->ieee80211_ptr;
+	struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
+	union iwreq_data wrqu;
+
+	printk(KERN_DEBUG "%s: scan completed\n", dev->name);
+	local->sta_scanning = 0;
+	local->last_scan_completed = jiffies;
+
+	memset(&wrqu, 0, sizeof(wrqu));
+	wireless_send_event(dev, SIOCGIWSCAN, &wrqu, NULL);
+
+	if (sdata->type == IEEE80211_IF_TYPE_IBSS) {
+		struct ieee80211_if_sta *ifsta = &sdata->u.sta;
+		if (!ifsta->bssid_set ||
+		    (!ifsta->state == IEEE80211_IBSS_JOINED &&
+		    !ieee80211_sta_active_ibss(dev)))
+			ieee80211_sta_find_ibss(dev, ifsta);
+	}
+}
+
 static void ieee80211_sta_scan_work(void *ptr)
 {
 	struct net_device *dev = ptr;
@@ -2434,7 +2456,6 @@ static void ieee80211_sta_scan_work(void
 	struct ieee80211_hw_modes *mode;
 	struct ieee80211_channel *chan;
 	int skip;
-	union iwreq_data wrqu;
 	unsigned long next_delay = 0;
 
 	if (!local->sta_scanning)
@@ -2451,20 +2472,8 @@ static void ieee80211_sta_scan_work(void
 				       "operational channel after scan\n",
 				       dev->name);
 			}
-			printk(KERN_DEBUG "%s: scan completed\n", dev->name);
-			local->sta_scanning = 0;
-			local->last_scan_completed = jiffies;
-			memset(&wrqu, 0, sizeof(wrqu));
-			wireless_send_event(dev, SIOCGIWSCAN, &wrqu, NULL);
-			if (sdata->type == IEEE80211_IF_TYPE_IBSS) {
-				struct ieee80211_sub_if_data *sdata =
-					IEEE80211_DEV_TO_SUB_IF(dev);
-				struct ieee80211_if_sta *ifsta = &sdata->u.sta;
-				if (!ifsta->bssid_set ||
-				    (ifsta->state == IEEE80211_IBSS_JOINED &&
-				     !ieee80211_sta_active_ibss(dev)))
-					ieee80211_sta_find_ibss(dev, ifsta);
-			}
+
+			ieee80211_set_scan_completed(dev);
 			return;
 		}
 		skip = !(local->enabled_modes & (1 << mode->mode));
@@ -2565,9 +2574,12 @@ int ieee80211_sta_req_scan(struct net_de
 
 	printk(KERN_DEBUG "%s: starting scan\n", dev->name);
 
+	local->sta_scanning = 1;
+	if (local->hw->hw_scan)
+		return local->hw->hw_scan(dev, ssid, ssid_len);
+
 	ieee80211_sta_save_oper_chan(dev);
 
-	local->sta_scanning = 1;
 	/* TODO: stop TX queue? */
 
 	if (ssid) {

             reply	other threads:[~2006-08-25  8:36 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-25  8:32 Hong Liu [this message]
2006-08-29 12:08 ` [PATCH 2/2]d80211: add hardware scan callback Johannes Berg
2006-08-30 17:10 ` Jiri Benc
2006-08-30 18:36   ` Mohamed Abbas
2006-09-01  3:37   ` Hong Liu
2006-09-01  6:41     ` Johannes Berg
2006-09-01  7:34       ` Hong Liu
2006-09-21 19:22         ` Jiri Benc
2009-04-06 15:12 ` oterito

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=1156494733.21483.14.camel@devlinux-hong \
    --to=hong.liu@intel.com \
    --cc=jbenc@suse.cz \
    --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).