* [patch 4] softmac: fix event sending [not found] <20060411085805.949313000@sipsolutions.net> @ 2006-04-13 0:42 ` Johannes Berg [not found] ` <20060411085841.252064000@sipsolutions.net> 2006-04-13 9:41 ` [patch 5] softmac: report when scanning has finished Johannes Berg 2 siblings, 0 replies; 21+ messages in thread From: Johannes Berg @ 2006-04-13 0:42 UTC (permalink / raw) To: netdev; +Cc: John W. Linville Softmac is sending custom events to userspace already, but it should _really_ be sending the right WEXT events instead. This patch fixes that. Signed-off-by: Dan Williams <dcbw@redhat.com> Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Index: wireless-2.6/include/net/ieee80211softmac.h =================================================================== --- wireless-2.6.orig/include/net/ieee80211softmac.h 2006-04-13 02:35:54.686229309 +0200 +++ wireless-2.6/include/net/ieee80211softmac.h 2006-04-13 02:37:17.676229309 +0200 @@ -267,8 +267,9 @@ #define IEEE80211SOFTMAC_EVENT_AUTH_FAILED 5 #define IEEE80211SOFTMAC_EVENT_AUTH_TIMEOUT 6 #define IEEE80211SOFTMAC_EVENT_ASSOCIATE_NET_NOT_FOUND 7 +#define IEEE80211SOFTMAC_EVENT_DISASSOCIATED 8 /* keep this updated! */ -#define IEEE80211SOFTMAC_EVENT_LAST 7 +#define IEEE80211SOFTMAC_EVENT_LAST 8 /* * If you want to be notified of certain events, you can call * ieee80211softmac_notify[_atomic] with Index: wireless-2.6/net/ieee80211/softmac/ieee80211softmac_assoc.c =================================================================== --- wireless-2.6.orig/net/ieee80211/softmac/ieee80211softmac_assoc.c 2006-04-13 02:35:54.686229309 +0200 +++ wireless-2.6/net/ieee80211/softmac/ieee80211softmac_assoc.c 2006-04-13 02:37:17.686229309 +0200 @@ -101,6 +101,7 @@ /* Do NOT clear bssvalid as that will break ieee80211softmac_assoc_work! */ mac->associated = 0; mac->associnfo.associating = 0; + ieee80211softmac_call_events_locked(mac, IEEE80211SOFTMAC_EVENT_DISASSOCIATED, NULL); spin_unlock_irqrestore(&mac->lock, flags); } @@ -373,6 +374,7 @@ spin_lock_irqsave(&mac->lock, flags); mac->associnfo.bssvalid = 0; mac->associated = 0; + ieee80211softmac_call_events_locked(mac, IEEE80211SOFTMAC_EVENT_DISASSOCIATED, NULL); schedule_work(&mac->associnfo.work); spin_unlock_irqrestore(&mac->lock, flags); Index: wireless-2.6/net/ieee80211/softmac/ieee80211softmac_event.c =================================================================== --- wireless-2.6.orig/net/ieee80211/softmac/ieee80211softmac_event.c 2006-04-13 02:35:54.686229309 +0200 +++ wireless-2.6/net/ieee80211/softmac/ieee80211softmac_event.c 2006-04-13 02:38:51.036229309 +0200 @@ -67,6 +67,7 @@ "authenticating failed", "authenticating timed out", "associating failed because no suitable network was found", + "disassociated", }; @@ -128,13 +129,36 @@ ieee80211softmac_call_events_locked(struct ieee80211softmac_device *mac, int event, void *event_ctx) { struct ieee80211softmac_event *eventptr, *tmp; - union iwreq_data wrqu; - char *msg; + struct ieee80211softmac_network *network; if (event >= 0) { - msg = event_descriptions[event]; - wrqu.data.length = strlen(msg); - wireless_send_event(mac->dev, IWEVCUSTOM, &wrqu, msg); + union iwreq_data wrqu; + int we_event; + char *msg = NULL; + + switch(event) { + case IEEE80211SOFTMAC_EVENT_ASSOCIATED: + network = (struct ieee80211softmac_network *)event_ctx; + wrqu.data.length = 0; + wrqu.data.flags = 0; + memcpy(wrqu.ap_addr.sa_data, &network->bssid[0], ETH_ALEN); + wrqu.ap_addr.sa_family = ARPHRD_ETHER; + we_event = SIOCGIWAP; + break; + case IEEE80211SOFTMAC_EVENT_DISASSOCIATED: + wrqu.data.length = 0; + wrqu.data.flags = 0; + memset(&wrqu, '\0', sizeof (union iwreq_data)); + wrqu.ap_addr.sa_family = ARPHRD_ETHER; + we_event = SIOCGIWAP; + break; + default: + msg = event_descriptions[event]; + wrqu.data.length = strlen(msg); + we_event = IWEVCUSTOM; + break; + } + wireless_send_event(mac->dev, we_event, &wrqu, msg); } if (!list_empty(&mac->events)) ^ permalink raw reply [flat|nested] 21+ messages in thread
[parent not found: <20060411085841.252064000@sipsolutions.net>]
* Re: [patch 1/3] softmac: return -EAGAIN from getscan while scanning [not found] ` <20060411085841.252064000@sipsolutions.net> @ 2006-04-13 9:00 ` Pete Zaitcev 2006-04-13 9:06 ` Johannes Berg 2006-04-13 12:12 ` Dan Williams 0 siblings, 2 replies; 21+ messages in thread From: Pete Zaitcev @ 2006-04-13 9:00 UTC (permalink / raw) To: johannes; +Cc: netdev, linville On Tue, 11 Apr 2006 10:58:06 +0200, johannes@sipsolutions.net wrote: > Below patch was developed after discussion with Daniel Drake who > mentioned to me that wireless tools expect an EAGAIN return from getscan > so that they can wait for the scan to finish before printing out the > results. This sounds completely wrong. Do you guys remember the Subject: string of this discussion by any chance? It's very likely that tools do indeed loop when they see EAGAIN, but this is a workaround, not the main mode of operation. It seems obvious to me that the get method should wait until the scan results are available. Perhaps the discussion had a specific scenario where EAGAIN would make sense, but I cannot imagine what it might be. -- Pete ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [patch 1/3] softmac: return -EAGAIN from getscan while scanning 2006-04-13 9:00 ` [patch 1/3] softmac: return -EAGAIN from getscan while scanning Pete Zaitcev @ 2006-04-13 9:06 ` Johannes Berg 2006-04-13 9:34 ` Johannes Berg 2006-04-13 12:12 ` Dan Williams 1 sibling, 1 reply; 21+ messages in thread From: Johannes Berg @ 2006-04-13 9:06 UTC (permalink / raw) To: Pete Zaitcev; +Cc: netdev, linville, softmac-dev, Jean Tourrilhes [-- Attachment #1: Type: text/plain, Size: 765 bytes --] On Thu, 2006-04-13 at 02:00 -0700, Pete Zaitcev wrote: > This sounds completely wrong. Do you guys remember the Subject: string > of this discussion by any chance? Discussed offline at the wireless summit, sorry. > It's very likely that tools do indeed loop when they see EAGAIN, but > this is a workaround, not the main mode of operation. It seems obvious > to me that the get method should wait until the scan results are > available. Perhaps the discussion had a specific scenario where > EAGAIN would make sense, but I cannot imagine what it might be. Right, they do loop, but they don't have a method to indicate completion. Thus we'd have to actually wait for the completion in the kernel. Jean, what is the intended use here? johannes [-- Attachment #2: This is a digitally signed message part --] [-- Type: application/pgp-signature, Size: 793 bytes --] ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [patch 1/3] softmac: return -EAGAIN from getscan while scanning 2006-04-13 9:06 ` Johannes Berg @ 2006-04-13 9:34 ` Johannes Berg 2006-04-13 12:14 ` Dan Williams 0 siblings, 1 reply; 21+ messages in thread From: Johannes Berg @ 2006-04-13 9:34 UTC (permalink / raw) To: Pete Zaitcev; +Cc: Jean Tourrilhes, netdev, softmac-dev [-- Attachment #1: Type: text/plain, Size: 720 bytes --] On Thu, 2006-04-13 at 11:06 +0200, Johannes Berg wrote: > > It's very likely that tools do indeed loop when they see EAGAIN, but > > this is a workaround, not the main mode of operation. It seems obvious > > to me that the get method should wait until the scan results are > > available. Perhaps the discussion had a specific scenario where > > EAGAIN would make sense, but I cannot imagine what it might be. > > Right, they do loop, but they don't have a method to indicate > completion. Thus we'd have to actually wait for the completion in the > kernel. Jean, what is the intended use here? Hah, never mind, I guess we're just supposed to send SIOCGIWSCAN. Will send a patch in a minute. johannes [-- Attachment #2: This is a digitally signed message part --] [-- Type: application/pgp-signature, Size: 793 bytes --] ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [patch 1/3] softmac: return -EAGAIN from getscan while scanning 2006-04-13 9:34 ` Johannes Berg @ 2006-04-13 12:14 ` Dan Williams 2006-04-13 16:13 ` Jean Tourrilhes 0 siblings, 1 reply; 21+ messages in thread From: Dan Williams @ 2006-04-13 12:14 UTC (permalink / raw) To: Johannes Berg; +Cc: Pete Zaitcev, Jean Tourrilhes, netdev, softmac-dev On Thu, 2006-04-13 at 11:34 +0200, Johannes Berg wrote: > On Thu, 2006-04-13 at 11:06 +0200, Johannes Berg wrote: > > > > It's very likely that tools do indeed loop when they see EAGAIN, but > > > this is a workaround, not the main mode of operation. It seems obvious > > > to me that the get method should wait until the scan results are > > > available. Perhaps the discussion had a specific scenario where > > > EAGAIN would make sense, but I cannot imagine what it might be. > > > > Right, they do loop, but they don't have a method to indicate > > completion. Thus we'd have to actually wait for the completion in the > > kernel. Jean, what is the intended use here? > > Hah, never mind, I guess we're just supposed to send SIOCGIWSCAN. Will > send a patch in a minute. No, you should be doing both really. If you don't do EAGAIN, then tools like iwlist and other simple ones that don't want to spend 100 lines of code in netlink message processing just to receive the wireless event won't work very well. Dan ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [patch 1/3] softmac: return -EAGAIN from getscan while scanning 2006-04-13 12:14 ` Dan Williams @ 2006-04-13 16:13 ` Jean Tourrilhes 2006-04-15 19:24 ` Johannes Berg 0 siblings, 1 reply; 21+ messages in thread From: Jean Tourrilhes @ 2006-04-13 16:13 UTC (permalink / raw) To: Dan Williams; +Cc: Johannes Berg, Pete Zaitcev, netdev, softmac-dev On Thu, Apr 13, 2006 at 08:14:01AM -0400, Dan Williams wrote: > On Thu, 2006-04-13 at 11:34 +0200, Johannes Berg wrote: > > On Thu, 2006-04-13 at 11:06 +0200, Johannes Berg wrote: > > > > > > It's very likely that tools do indeed loop when they see EAGAIN, but > > > > this is a workaround, not the main mode of operation. It seems obvious > > > > to me that the get method should wait until the scan results are > > > > available. Perhaps the discussion had a specific scenario where > > > > EAGAIN would make sense, but I cannot imagine what it might be. > > > > > > Right, they do loop, but they don't have a method to indicate > > > completion. Thus we'd have to actually wait for the completion in the > > > kernel. Jean, what is the intended use here? > > > > Hah, never mind, I guess we're just supposed to send SIOCGIWSCAN. Will > > send a patch in a minute. > > No, you should be doing both really. If you don't do EAGAIN, then tools > like iwlist and other simple ones that don't want to spend 100 lines of > code in netlink message processing just to receive the wireless event > won't work very well. > > Dan Yes, Dan is 100% correct. Jean ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [patch 1/3] softmac: return -EAGAIN from getscan while scanning 2006-04-13 16:13 ` Jean Tourrilhes @ 2006-04-15 19:24 ` Johannes Berg 2006-04-15 21:27 ` Dan Williams 0 siblings, 1 reply; 21+ messages in thread From: Johannes Berg @ 2006-04-15 19:24 UTC (permalink / raw) To: jt; +Cc: Dan Williams, Pete Zaitcev, netdev, softmac-dev [-- Attachment #1: Type: text/plain, Size: 250 bytes --] On Thu, 2006-04-13 at 09:13 -0700, Jean Tourrilhes wrote: > Yes, Dan is 100% correct. Right, slightly later I posted a patch to do it that way. After everyone else has discussed, do we agree to leave the patches as they are now? johannes [-- Attachment #2: This is a digitally signed message part --] [-- Type: application/pgp-signature, Size: 793 bytes --] ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [patch 1/3] softmac: return -EAGAIN from getscan while scanning 2006-04-15 19:24 ` Johannes Berg @ 2006-04-15 21:27 ` Dan Williams 0 siblings, 0 replies; 21+ messages in thread From: Dan Williams @ 2006-04-15 21:27 UTC (permalink / raw) To: Johannes Berg; +Cc: jt, Pete Zaitcev, netdev, softmac-dev On Sat, 2006-04-15 at 21:24 +0200, Johannes Berg wrote: > On Thu, 2006-04-13 at 09:13 -0700, Jean Tourrilhes wrote: > > > Yes, Dan is 100% correct. > > Right, slightly later I posted a patch to do it that way. After everyone > else has discussed, do we agree to leave the patches as they are now? Current patch set looks good to me. Dan ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [patch 1/3] softmac: return -EAGAIN from getscan while scanning 2006-04-13 9:00 ` [patch 1/3] softmac: return -EAGAIN from getscan while scanning Pete Zaitcev 2006-04-13 9:06 ` Johannes Berg @ 2006-04-13 12:12 ` Dan Williams 2006-04-13 12:19 ` Johannes Berg 2006-04-13 22:21 ` Pete Zaitcev 1 sibling, 2 replies; 21+ messages in thread From: Dan Williams @ 2006-04-13 12:12 UTC (permalink / raw) To: Pete Zaitcev; +Cc: johannes, netdev, linville On Thu, 2006-04-13 at 02:00 -0700, Pete Zaitcev wrote: > On Tue, 11 Apr 2006 10:58:06 +0200, johannes@sipsolutions.net wrote: > > > Below patch was developed after discussion with Daniel Drake who > > mentioned to me that wireless tools expect an EAGAIN return from getscan > > so that they can wait for the scan to finish before printing out the > > results. > > This sounds completely wrong. Do you guys remember the Subject: string > of this discussion by any chance? Maybe it's wrong now, but it's how the CLI tools have operated for quite a while AFAIK. There are two options for tools: (a) request scan and block on GIWSCAN until it doesn't return EAGAIN, or (b) request a scan, enter a loop, wait for the GIWSCAN netlink message to come back. The point here is that if you have to write a tool with 100 lines of netlink message processing code _just_ to get the "scan done!" message, that's a bitch. More complicated programs can obviously do this, but simple tools don't want or need to. airo, atmel, and orinoco all do this. ipw does not, and prism54 does not because it does background scanning. I believe that the patch for softmac/bcm43xx EAGAIN is correct. Dan ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [patch 1/3] softmac: return -EAGAIN from getscan while scanning 2006-04-13 12:12 ` Dan Williams @ 2006-04-13 12:19 ` Johannes Berg 2006-04-13 16:00 ` Jouni Malinen 2006-04-13 22:21 ` Pete Zaitcev 1 sibling, 1 reply; 21+ messages in thread From: Johannes Berg @ 2006-04-13 12:19 UTC (permalink / raw) To: Dan Williams; +Cc: Pete Zaitcev, netdev, linville, softmac-dev [-- Attachment #1: Type: text/plain, Size: 1491 bytes --] On Thu, 2006-04-13 at 08:12 -0400, Dan Williams wrote: > Maybe it's wrong now, but it's how the CLI tools have operated for quite > a while AFAIK. Yes, and they don't seem to care about the netlink messages. But the question is rather -- should we block the program inside the kernel and only return from "get scan" after the scan is actually done, rather than returning "we can't give you anything now, try later". We could do that too, but then the program would be blocked inside the kernel without any chance of saying "bah, this takes too long, I'll ignore it". > There are two options for tools: (a) request scan and block on GIWSCAN > until it doesn't return EAGAIN, or (b) request a scan, enter a loop, > wait for the GIWSCAN netlink message to come back. The point here is > that if you have to write a tool with 100 lines of netlink message > processing code _just_ to get the "scan done!" message, that's a bitch. > More complicated programs can obviously do this, but simple tools don't > want or need to. Yeah, I just implemented that in softmac too (patch 5 of my set), so you can just request a scan and do nothing until you are notified that the netlink message came in that scanning is done. > airo, atmel, and orinoco all do this. ipw does not, and prism54 does > not because it does background scanning. I believe that the patch for > softmac/bcm43xx EAGAIN is correct. Good. I hope that these can go in before 2.6.17. johannes [-- Attachment #2: This is a digitally signed message part --] [-- Type: application/pgp-signature, Size: 793 bytes --] ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [patch 1/3] softmac: return -EAGAIN from getscan while scanning 2006-04-13 12:19 ` Johannes Berg @ 2006-04-13 16:00 ` Jouni Malinen 2006-04-13 22:28 ` Pete Zaitcev 0 siblings, 1 reply; 21+ messages in thread From: Jouni Malinen @ 2006-04-13 16:00 UTC (permalink / raw) To: Johannes Berg; +Cc: Dan Williams, Pete Zaitcev, netdev, linville, softmac-dev On Thu, Apr 13, 2006 at 02:19:26PM +0200, Johannes Berg wrote: > But the question is rather -- should we block the program inside the > kernel and only return from "get scan" after the scan is actually done, > rather than returning "we can't give you anything now, try later". We > could do that too, but then the program would be blocked inside the > kernel without any chance of saying "bah, this takes too long, I'll > ignore it". Please don't. That could be blocking an ioctl call for couple of seconds and would be quite horrible for single threaded programs. It is possible to wait for scan completion events, but what if some other program were to request a new scan between the completion event and the attempt to read the previous scan results.. -- Jouni Malinen PGP id EFC895FA ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [patch 1/3] softmac: return -EAGAIN from getscan while scanning 2006-04-13 16:00 ` Jouni Malinen @ 2006-04-13 22:28 ` Pete Zaitcev 2006-04-13 22:45 ` Jouni Malinen 0 siblings, 1 reply; 21+ messages in thread From: Pete Zaitcev @ 2006-04-13 22:28 UTC (permalink / raw) To: Jouni Malinen; +Cc: johannes, dcbw, netdev, linville, softmac-dev, zaitcev On Thu, 13 Apr 2006 09:00:51 -0700, "Jouni Malinen" <jkm@devicescape.com> wrote: > That could be blocking an ioctl call for couple of seconds > and would be quite horrible for single threaded programs. I would say that waiting for couple of seconds in the kernel would be quite wonderful for single threaded programs, when you consider the alternative. I can guess now what your concern is, even though you failed to articulate it: a single-threaded GUI application, which cannot respond to events when blocked in getting scan results. If that's the case, we should be looking at having both blocking and non-blocking calls to fetch scan results. > [...] but what if some other program were > to request a new scan between the completion event and the attempt to > read the previous scan results.. I do not see how this is relevant. -- Pete ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [patch 1/3] softmac: return -EAGAIN from getscan while scanning 2006-04-13 22:28 ` Pete Zaitcev @ 2006-04-13 22:45 ` Jouni Malinen 2006-04-13 23:03 ` Stephen Hemminger 2006-04-13 23:35 ` Pete Zaitcev 0 siblings, 2 replies; 21+ messages in thread From: Jouni Malinen @ 2006-04-13 22:45 UTC (permalink / raw) To: Pete Zaitcev; +Cc: johannes, dcbw, netdev, linville, softmac-dev On Thu, Apr 13, 2006 at 03:28:53PM -0700, Pete Zaitcev wrote: > On Thu, 13 Apr 2006 09:00:51 -0700, "Jouni Malinen" <jkm@devicescape.com> wrote: > > > That could be blocking an ioctl call for couple of seconds > > and would be quite horrible for single threaded programs. > > I would say that waiting for couple of seconds in the kernel would > be quite wonderful for single threaded programs, when you consider > the alternative. I can guess now what your concern is, even though > you failed to articulate it: a single-threaded GUI application, > which cannot respond to events when blocked in getting scan results. > If that's the case, we should be looking at having both blocking > and non-blocking calls to fetch scan results. No, my main concern was single-threaded design in wpa_suppliant.. If the ioctl call is blocking, I would need to create a new (well, the first additional) thread just for this use. Without that, the blocking call would also block all control interface commands (interaction with external programs) and controlling of other interfaces (if more than one is used). > > [...] but what if some other program were > > to request a new scan between the completion event and the attempt to > > read the previous scan results.. > > I do not see how this is relevant. That would make the application wait even if it properly waited for the scan complete event before reading the scan result. If the get-results call is blocking, the single-threaded application simply don't have any easy way of getting the results while being able to do something else while waiting for the scan to complete. Furthermore, blocking ioctl handlers is not really something I would like to see in the kernel.. Aren't there some locks/semaphores/etc. kept for some cases? -- Jouni Malinen PGP id EFC895FA ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [patch 1/3] softmac: return -EAGAIN from getscan while scanning 2006-04-13 22:45 ` Jouni Malinen @ 2006-04-13 23:03 ` Stephen Hemminger 2006-04-13 23:35 ` Pete Zaitcev 1 sibling, 0 replies; 21+ messages in thread From: Stephen Hemminger @ 2006-04-13 23:03 UTC (permalink / raw) To: Jouni Malinen; +Cc: Pete Zaitcev, johannes, dcbw, netdev, linville, softmac-dev On Thu, 13 Apr 2006 15:45:22 -0700 "Jouni Malinen" <jkm@devicescape.com> wrote: > On Thu, Apr 13, 2006 at 03:28:53PM -0700, Pete Zaitcev wrote: > > On Thu, 13 Apr 2006 09:00:51 -0700, "Jouni Malinen" <jkm@devicescape.com> wrote: > > > > > That could be blocking an ioctl call for couple of seconds > > > and would be quite horrible for single threaded programs. > > > > I would say that waiting for couple of seconds in the kernel would > > be quite wonderful for single threaded programs, when you consider > > the alternative. I can guess now what your concern is, even though > > you failed to articulate it: a single-threaded GUI application, > > which cannot respond to events when blocked in getting scan results. > > If that's the case, we should be looking at having both blocking > > and non-blocking calls to fetch scan results. > > No, my main concern was single-threaded design in wpa_suppliant.. If the > ioctl call is blocking, I would need to create a new (well, the first > additional) thread just for this use. Without that, the blocking call > would also block all control interface commands (interaction with > external programs) and controlling of other interfaces (if more than one > is used). > > > > [...] but what if some other program were > > > to request a new scan between the completion event and the attempt to > > > read the previous scan results.. > > > > I do not see how this is relevant. > > That would make the application wait even if it properly waited for the > scan complete event before reading the scan result. If the get-results > call is blocking, the single-threaded application simply don't have any > easy way of getting the results while being able to do something else > while waiting for the scan to complete. Furthermore, blocking ioctl > handlers is not really something I would like to see in the kernel.. > Aren't there some locks/semaphores/etc. kept for some cases? > Sounds like you want a message interface like netlink, not ioctl's. ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [patch 1/3] softmac: return -EAGAIN from getscan while scanning 2006-04-13 22:45 ` Jouni Malinen 2006-04-13 23:03 ` Stephen Hemminger @ 2006-04-13 23:35 ` Pete Zaitcev 1 sibling, 0 replies; 21+ messages in thread From: Pete Zaitcev @ 2006-04-13 23:35 UTC (permalink / raw) To: Jouni Malinen; +Cc: johannes, dcbw, netdev, linville, softmac-dev, zaitcev On Thu, 13 Apr 2006 15:45:22 -0700, "Jouni Malinen" <jkm@devicescape.com> wrote: > > [...] I can guess now what your concern is, even though > > you failed to articulate it: a single-threaded GUI application, > > which cannot respond to events when blocked in getting scan results. > > If that's the case, we should be looking at having both blocking > > and non-blocking calls to fetch scan results. > > No, my main concern was single-threaded design in wpa_suppliant.. If the > ioctl call is blocking, I would need to create a new (well, the first > additional) thread just for this use. Without that, the blocking call > would also block all control interface commands (interaction with > external programs) and controlling of other interfaces (if more than one > is used). I see... Thanks for explainig it. > [...] Furthermore, blocking ioctl > handlers is not really something I would like to see in the kernel.. > Aren't there some locks/semaphores/etc. kept for some cases? I think you are taking this concept too far. Consider things like an ioctl to seek a magnetic tape N files forward, or an ioctl to flush characters to a terminal. They seem to work fine in blocking mode. And no, we do not have a generic API to expose semaphores (I suppose you did not mean SYSV IPC above :-). -- Pete ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [patch 1/3] softmac: return -EAGAIN from getscan while scanning 2006-04-13 12:12 ` Dan Williams 2006-04-13 12:19 ` Johannes Berg @ 2006-04-13 22:21 ` Pete Zaitcev 1 sibling, 0 replies; 21+ messages in thread From: Pete Zaitcev @ 2006-04-13 22:21 UTC (permalink / raw) To: Dan Williams; +Cc: johannes, netdev, linville, zaitcev On Thu, 13 Apr 2006 08:12:55 -0400, Dan Williams <dcbw@redhat.com> wrote: > > This sounds completely wrong. Do you guys remember the Subject: string > > of this discussion by any chance? > There are two options for tools: (a) request scan and block on GIWSCAN > until it doesn't return EAGAIN, or (b) request a scan, enter a loop, > wait for the GIWSCAN netlink message to come back. The point here is > that if you have to write a tool with 100 lines of netlink message > processing code _just_ to get the "scan done!" message, that's a bitch. > More complicated programs can obviously do this, but simple tools don't > want or need to. Do you realize that "block" means "enterering the kernel and calling schedule()", which is exactly what is NOT happening in the patch? I would not mind if the tools "blocked in GIWSCAN", only until it returns success and not EGAIN. With EAGAIN returned, you have to a) block elsewhere and not in GIWSCAN (perhaps in sleep(2) or select(2)), or b) not block at all and loop. > I believe that the patch for softmac/bcm43xx EAGAIN is correct. It is correct, no doubt. The discussion is about wether it is desirable. -- Pete ^ permalink raw reply [flat|nested] 21+ messages in thread
* [patch 5] softmac: report when scanning has finished [not found] <20060411085805.949313000@sipsolutions.net> 2006-04-13 0:42 ` [patch 4] softmac: fix event sending Johannes Berg [not found] ` <20060411085841.252064000@sipsolutions.net> @ 2006-04-13 9:41 ` Johannes Berg 2006-04-13 12:15 ` Dan Williams 2 siblings, 1 reply; 21+ messages in thread From: Johannes Berg @ 2006-04-13 9:41 UTC (permalink / raw) To: netdev; +Cc: John W. Linville, softmac-dev, Dan Williams [-- Attachment #1: Type: text/plain, Size: 1252 bytes --] Make softmac report a scan event when scanning has finished, that way userspace can wait for the event to happen instead of polling for the results. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> --- This patch depends on the previous patch 4. If you want, I can resend the whole series with proper patch x/5 headers etc. I don't know if these can still go in before .17, but it'd be very good if they could, they're essentially bug fixes for things I either didn't know or just plain bugs :) Index: wireless-2.6/net/ieee80211/softmac/ieee80211softmac_event.c =================================================================== --- wireless-2.6.orig/net/ieee80211/softmac/ieee80211softmac_event.c 2006-04-13 02:42:59.000000000 +0200 +++ wireless-2.6/net/ieee80211/softmac/ieee80211softmac_event.c 2006-04-13 11:30:59.896998787 +0200 @@ -152,6 +152,12 @@ wrqu.ap_addr.sa_family = ARPHRD_ETHER; we_event = SIOCGIWAP; break; + case IEEE80211SOFTMAC_EVENT_SCAN_FINISHED: + wrqu.data.length = 0; + wrqu.data.flags = 0; + memset(&wrqu, '\0', sizeof (union iwreq_data)); + we_event = SIOCGIWSCAN; + break; default: msg = event_descriptions[event]; wrqu.data.length = strlen(msg); [-- Attachment #2: This is a digitally signed message part --] [-- Type: application/pgp-signature, Size: 793 bytes --] ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [patch 5] softmac: report when scanning has finished 2006-04-13 9:41 ` [patch 5] softmac: report when scanning has finished Johannes Berg @ 2006-04-13 12:15 ` Dan Williams 0 siblings, 0 replies; 21+ messages in thread From: Dan Williams @ 2006-04-13 12:15 UTC (permalink / raw) To: Johannes Berg; +Cc: netdev, John W. Linville, softmac-dev On Thu, 2006-04-13 at 11:41 +0200, Johannes Berg wrote: > Make softmac report a scan event when scanning has finished, that way > userspace can wait for the event to happen instead of polling for the > results. > > Signed-off-by: Johannes Berg <johannes@sipsolutions.net> ACK, good catch. Signed-off-by: Dan Williams <dcbw@redhat.com> > --- > This patch depends on the previous patch 4. If you want, I can resend > the whole series with proper patch x/5 headers etc. I don't know if > these can still go in before .17, but it'd be very good if they could, > they're essentially bug fixes for things I either didn't know or just > plain bugs :) > > Index: wireless-2.6/net/ieee80211/softmac/ieee80211softmac_event.c > =================================================================== > --- wireless-2.6.orig/net/ieee80211/softmac/ieee80211softmac_event.c 2006-04-13 02:42:59.000000000 +0200 > +++ wireless-2.6/net/ieee80211/softmac/ieee80211softmac_event.c 2006-04-13 11:30:59.896998787 +0200 > @@ -152,6 +152,12 @@ > wrqu.ap_addr.sa_family = ARPHRD_ETHER; > we_event = SIOCGIWAP; > break; > + case IEEE80211SOFTMAC_EVENT_SCAN_FINISHED: > + wrqu.data.length = 0; > + wrqu.data.flags = 0; > + memset(&wrqu, '\0', sizeof (union iwreq_data)); > + we_event = SIOCGIWSCAN; > + break; > default: > msg = event_descriptions[event]; > wrqu.data.length = strlen(msg); > ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [patch 1/3] softmac: return -EAGAIN from getscan while scanning @ 2006-04-13 23:58 Jean Tourrilhes 0 siblings, 0 replies; 21+ messages in thread From: Jean Tourrilhes @ 2006-04-13 23:58 UTC (permalink / raw) To: Stephen Hemminger, netdev, Pete Zaitcev Pete Zaitcev wrote : > > Do you realize that "block" means "enterering the kernel and calling > schedule()", which is exactly what is NOT happening in the patch? > I would not mind if the tools "blocked in GIWSCAN", only until > it returns success and not EGAIN. Do you realise that "block" means holding the netlink mutex. Which means any networking ioctl and netlink operation is blocked, which means ifconfig and iproute are blocked. The MadWifi driver take up to 15sec to perfom scanning. > With EAGAIN returned, you have to a) block elsewhere and not in > GIWSCAN (perhaps in sleep(2) or select(2)), or b) not block at all > and loop. User-space authors are no dummy, they know that looping on EAGAIN is bad, so most do a sleep (actually most user-space use libiw which does a sleep). > It is correct, no doubt. The discussion is about wether it is > desirable. Yes, it is desirable, because we are pragmatic. Jean ^ permalink raw reply [flat|nested] 21+ messages in thread
* Re: [patch 1/3] softmac: return -EAGAIN from getscan while scanning
@ 2006-04-14 0:01 Jean Tourrilhes
2006-04-14 15:58 ` Herbert Xu
0 siblings, 1 reply; 21+ messages in thread
From: Jean Tourrilhes @ 2006-04-14 0:01 UTC (permalink / raw)
To: Stephen Hemminger, netdev
Stephen Hemminger wrote :
>
> Sounds like you want a message interface like netlink, not ioctl's.
We have the message interface (through a Wireless Events,
since WE-14). However, netlink is highly undesirable in embedded space
for bloat reason.
Jean
^ permalink raw reply [flat|nested] 21+ messages in thread* Re: [patch 1/3] softmac: return -EAGAIN from getscan while scanning 2006-04-14 0:01 Jean Tourrilhes @ 2006-04-14 15:58 ` Herbert Xu 0 siblings, 0 replies; 21+ messages in thread From: Herbert Xu @ 2006-04-14 15:58 UTC (permalink / raw) To: jt; +Cc: shemminger, netdev Jean Tourrilhes <jt@hpl.hp.com> wrote: > > We have the message interface (through a Wireless Events, > since WE-14). However, netlink is highly undesirable in embedded space > for bloat reason. Why is that? I've seen many embedded applications using netlink for either routing or IPsec. It doesn't take much code at all to do netlink. Cheers, -- Visit Openswan at http://www.openswan.org/ Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt ^ permalink raw reply [flat|nested] 21+ messages in thread
end of thread, other threads:[~2006-04-15 21:31 UTC | newest]
Thread overview: 21+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20060411085805.949313000@sipsolutions.net>
2006-04-13 0:42 ` [patch 4] softmac: fix event sending Johannes Berg
[not found] ` <20060411085841.252064000@sipsolutions.net>
2006-04-13 9:00 ` [patch 1/3] softmac: return -EAGAIN from getscan while scanning Pete Zaitcev
2006-04-13 9:06 ` Johannes Berg
2006-04-13 9:34 ` Johannes Berg
2006-04-13 12:14 ` Dan Williams
2006-04-13 16:13 ` Jean Tourrilhes
2006-04-15 19:24 ` Johannes Berg
2006-04-15 21:27 ` Dan Williams
2006-04-13 12:12 ` Dan Williams
2006-04-13 12:19 ` Johannes Berg
2006-04-13 16:00 ` Jouni Malinen
2006-04-13 22:28 ` Pete Zaitcev
2006-04-13 22:45 ` Jouni Malinen
2006-04-13 23:03 ` Stephen Hemminger
2006-04-13 23:35 ` Pete Zaitcev
2006-04-13 22:21 ` Pete Zaitcev
2006-04-13 9:41 ` [patch 5] softmac: report when scanning has finished Johannes Berg
2006-04-13 12:15 ` Dan Williams
2006-04-13 23:58 [patch 1/3] softmac: return -EAGAIN from getscan while scanning Jean Tourrilhes
-- strict thread matches above, loose matches on Subject: below --
2006-04-14 0:01 Jean Tourrilhes
2006-04-14 15:58 ` Herbert Xu
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).