netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2/2]d80211: add hardware scan callback
@ 2006-08-25  8:32 Hong Liu
  2006-08-29 12:08 ` Johannes Berg
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Hong Liu @ 2006-08-25  8:32 UTC (permalink / raw)
  To: jbenc; +Cc: netdev

[-- 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) {

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/2]d80211: add hardware scan callback
  2006-08-25  8:32 [PATCH 2/2]d80211: add hardware scan callback Hong Liu
@ 2006-08-29 12:08 ` Johannes Berg
  2006-08-30 17:10 ` Jiri Benc
  2009-04-06 15:12 ` oterito
  2 siblings, 0 replies; 9+ messages in thread
From: Johannes Berg @ 2006-08-29 12:08 UTC (permalink / raw)
  To: Hong Liu; +Cc: jbenc, netdev

On Fri, 2006-08-25 at 16:32 +0800, Hong Liu wrote:
> 
> +       local->sta_scanning = 1;
> +       if (local->hw->hw_scan)
> +               return local->hw->hw_scan(dev, ssid, ssid_len); 

You set sta_scanning even if that returns an error, is that correct?

johannes

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/2]d80211: add hardware scan callback
  2006-08-25  8:32 [PATCH 2/2]d80211: add hardware scan callback Hong Liu
  2006-08-29 12:08 ` Johannes Berg
@ 2006-08-30 17:10 ` Jiri Benc
  2006-08-30 18:36   ` Mohamed Abbas
  2006-09-01  3:37   ` Hong Liu
  2009-04-06 15:12 ` oterito
  2 siblings, 2 replies; 9+ messages in thread
From: Jiri Benc @ 2006-08-30 17:10 UTC (permalink / raw)
  To: Hong Liu; +Cc: netdev, John W. Linville

On Fri, 25 Aug 2006 16:32:13 +0800, Hong Liu wrote:
> Add hardware scan callback to support cards like ipw3945 which
> implements the scan command in firmware.

How ipw3945 performs scan? From the patch, it looks like it switches
channels (and sends probe requests) in the firmware and delivers all
received beacons and probe responses through the normal rx path to be
handled in a software MAC layer. This is really weird behaviour and
doesn't make sense to me. Why isn't channel switching left to the
software MAC as well?

> +/* set station scan completed */
> +void ieee80211_set_scan_completed(struct net_device *dev);

Why "set"? "ieee80211_scan_completed" sounds better.

Thanks,

 Jiri

-- 
Jiri Benc
SUSE Labs

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/2]d80211: add hardware scan callback
  2006-08-30 17:10 ` Jiri Benc
@ 2006-08-30 18:36   ` Mohamed Abbas
  2006-09-01  3:37   ` Hong Liu
  1 sibling, 0 replies; 9+ messages in thread
From: Mohamed Abbas @ 2006-08-30 18:36 UTC (permalink / raw)
  To: Jiri Benc; +Cc: Hong Liu, netdev, John W. Linville

3945 firmware and hardware still do time critical functions like  
Beaconing and power management. This restrict us once associated to 
switch channel from the driver. we need to unassociated first before 
switching to a new channel. Because of this restriction while 
associated  we can only call scan command and the firmware will take of 
tunning to available channels to listen to beacon and prob_resp.
Jiri Benc wrote:

>On Fri, 25 Aug 2006 16:32:13 +0800, Hong Liu wrote:
>  
>
>>Add hardware scan callback to support cards like ipw3945 which
>>implements the scan command in firmware.
>>    
>>
>
>How ipw3945 performs scan? From the patch, it looks like it switches
>channels (and sends probe requests) in the firmware and delivers all
>received beacons and probe responses through the normal rx path to be
>handled in a software MAC layer. This is really weird behaviour and
>doesn't make sense to me. Why isn't channel switching left to the
>software MAC as well?
>
>  
>
>>+/* set station scan completed */
>>+void ieee80211_set_scan_completed(struct net_device *dev);
>>    
>>
>
>Why "set"? "ieee80211_scan_completed" sounds better.
>
>Thanks,
>
> Jiri
>
>  
>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/2]d80211: add hardware scan callback
  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
  1 sibling, 1 reply; 9+ messages in thread
From: Hong Liu @ 2006-09-01  3:37 UTC (permalink / raw)
  To: Jiri Benc; +Cc: netdev, John W. Linville

On Thu, 2006-08-31 at 01:10, Jiri Benc wrote:
> On Fri, 25 Aug 2006 16:32:13 +0800, Hong Liu wrote:
> > Add hardware scan callback to support cards like ipw3945 which
> > implements the scan command in firmware.
> 
> How ipw3945 performs scan? From the patch, it looks like it switches
> channels (and sends probe requests) in the firmware and delivers all
> received beacons and probe responses through the normal rx path to be
> handled in a software MAC layer. This is really weird behaviour and
> doesn't make sense to me. Why isn't channel switching left to the
> software MAC as well?
> 
> > +/* set station scan completed */
> > +void ieee80211_set_scan_completed(struct net_device *dev);
> 
> Why "set"? "ieee80211_scan_completed" sounds better.
> 
> Thanks,
> 
>  Jiri
> 
> --
> Jiri Benc
> SUSE Labs
> 


Signed-off-by: Hong Liu <hong.liu@intel.com>

diff --git a/include/net/d80211.h b/include/net/d80211.h
index 42fdbf7..1caa8a9 100644
--- a/include/net/d80211.h
+++ b/include/net/d80211.h
@@ -600,6 +600,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);
@@ -906,6 +910,8 @@ void ieee80211_tx_led(int state, struct 
  */
 void ieee80211_rx_led(int state, struct net_device *dev);
 
+/* called by driver to notify scan status completed */
+void ieee80211_scan_completed(struct net_device *dev);
 
 /* IEEE 802.11 defines */
 
diff --git a/net/d80211/ieee80211.c b/net/d80211/ieee80211.c
diff --git a/net/d80211/ieee80211_sta.c b/net/d80211/ieee80211_sta.c
index 557ba17..8541a52 100644
--- a/net/d80211/ieee80211_sta.c
+++ b/net/d80211/ieee80211_sta.c
@@ -2410,6 +2410,29 @@ static int ieee80211_active_scan(struct 
 }
 
 
+void ieee80211_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);
+	}
+}
+EXPORT_SYMBOL(ieee80211_scan_completed);
+
 static void ieee80211_sta_scan_work(void *ptr)
 {
 	struct net_device *dev = ptr;
@@ -2418,7 +2441,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)
@@ -2435,20 +2457,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_scan_completed(dev);
 			return;
 		}
 		skip = !(local->enabled_modes & (1 << mode->mode));
@@ -2549,9 +2559,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) {

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/2]d80211: add hardware scan callback
  2006-09-01  3:37   ` Hong Liu
@ 2006-09-01  6:41     ` Johannes Berg
  2006-09-01  7:34       ` Hong Liu
  0 siblings, 1 reply; 9+ messages in thread
From: Johannes Berg @ 2006-09-01  6:41 UTC (permalink / raw)
  To: Hong Liu; +Cc: Jiri Benc, netdev, John W. Linville

On Fri, 2006-09-01 at 11:37 +0800, Hong Liu wrote:
>  
> +	local->sta_scanning = 1;
> +	if (local->hw->hw_scan)
> +		return local->hw->hw_scan(dev, ssid, ssid_len);
> +

My question still stands, is it proper to assign sta_scanning to 1 even
if the function returns an error?

johannes

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/2]d80211: add hardware scan callback
  2006-09-01  6:41     ` Johannes Berg
@ 2006-09-01  7:34       ` Hong Liu
  2006-09-21 19:22         ` Jiri Benc
  0 siblings, 1 reply; 9+ messages in thread
From: Hong Liu @ 2006-09-01  7:34 UTC (permalink / raw)
  To: Johannes Berg; +Cc: Jiri Benc, netdev, John W. Linville

On Fri, 2006-09-01 at 14:41, Johannes Berg wrote:
> On Fri, 2006-09-01 at 11:37 +0800, Hong Liu wrote:
> > 
> > +     local->sta_scanning = 1;
> > +     if (local->hw->hw_scan)
> > +             return local->hw->hw_scan(dev, ssid, ssid_len);
> > +
> 
> My question still stands, is it proper to assign sta_scanning to 1 even
> if the function returns an error?
> 
> johannes
> 
> 
Thanks for point this out!
Change to only set sta_scanning to 1 if hw_scan successes.


Signed-off-by: Hong Liu <hong.liu@intel.com>

diff --git a/include/net/d80211.h b/include/net/d80211.h
index 42fdbf7..1caa8a9 100644
--- a/include/net/d80211.h
+++ b/include/net/d80211.h
@@ -600,6 +600,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);
@@ -906,6 +910,8 @@ void ieee80211_tx_led(int state, struct 
  */
 void ieee80211_rx_led(int state, struct net_device *dev);
 
+/* called by driver to notify scan status completed */
+void ieee80211_scan_completed(struct net_device *dev);
 
 /* IEEE 802.11 defines */
 
diff --git a/net/d80211/ieee80211_sta.c b/net/d80211/ieee80211_sta.c
index 557ba17..1f60a22 100644
--- a/net/d80211/ieee80211_sta.c
+++ b/net/d80211/ieee80211_sta.c
@@ -2410,6 +2410,29 @@ static int ieee80211_active_scan(struct 
 }
 
 
+void ieee80211_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);
+	}
+}
+EXPORT_SYMBOL(ieee80211_scan_completed);
+
 static void ieee80211_sta_scan_work(void *ptr)
 {
 	struct net_device *dev = ptr;
@@ -2418,7 +2441,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)
@@ -2435,20 +2457,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_scan_completed(dev);
 			return;
 		}
 		skip = !(local->enabled_modes & (1 << mode->mode));
@@ -2549,6 +2559,13 @@ int ieee80211_sta_req_scan(struct net_de
 
 	printk(KERN_DEBUG "%s: starting scan\n", dev->name);
 
+	if (local->hw->hw_scan) {
+		int rc = local->hw->hw_scan(dev, ssid, ssid_len);
+		if (!rc)
+			local->sta_scanning = 1;
+		return rc;
+	}
+
 	ieee80211_sta_save_oper_chan(dev);
 
 	local->sta_scanning = 1;

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/2]d80211: add hardware scan callback
  2006-09-01  7:34       ` Hong Liu
@ 2006-09-21 19:22         ` Jiri Benc
  0 siblings, 0 replies; 9+ messages in thread
From: Jiri Benc @ 2006-09-21 19:22 UTC (permalink / raw)
  To: Hong Liu; +Cc: Johannes Berg, netdev, John W. Linville

On Fri, 01 Sep 2006 15:34:38 +0800, Hong Liu wrote:
> Thanks for point this out!
> Change to only set sta_scanning to 1 if hw_scan successes.

Applied to my tree. Thanks for the patch!

 Jiri

-- 
Jiri Benc
SUSE Labs

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH 2/2]d80211: add hardware scan callback
  2006-08-25  8:32 [PATCH 2/2]d80211: add hardware scan callback Hong Liu
  2006-08-29 12:08 ` Johannes Berg
  2006-08-30 17:10 ` Jiri Benc
@ 2009-04-06 15:12 ` oterito
  2 siblings, 0 replies; 9+ messages in thread
From: oterito @ 2009-04-06 15:12 UTC (permalink / raw)
  To: netdev


Hello, pleas I need help, I triying to scan all AP's in a range, but I have a
problem, I have depreciate SIOIWAPLIST, and also SIOCIWSCAN always return 0.
I dont know If I can put a patch to activate that an wich patch can I use
and how. I'm a begginer user of linux. I'm working with debian etch and I
have a Intel ipw3945 wirelles chipset. Thanks
-- 
View this message in context: http://www.nabble.com/-PATCH-2-2-d80211%3A-add-hardware-scan-callback-tp5979589p22910800.html
Sent from the netdev mailing list archive at Nabble.com.


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2009-04-06 15:12 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-08-25  8:32 [PATCH 2/2]d80211: add hardware scan callback Hong Liu
2006-08-29 12:08 ` 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

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).