* [PATCH] mac80211: trigger ieee80211_sta_work after opening interface @ 2008-03-23 19:23 Jan Niehusmann 2008-03-23 22:16 ` Johannes Berg 0 siblings, 1 reply; 8+ messages in thread From: Jan Niehusmann @ 2008-03-23 19:23 UTC (permalink / raw) To: John W. Linville; +Cc: linux-wireless, Michael Wu, Johannes Berg, Jiri Benc ieee80211_sta_work is disabled while network interface is down. Therefore, if you configure wireless parameters before bringing the interface up, these configurations are not yet effective and association fails. A workaround from userspace is calling a command like 'iwconfig wlan0 ap any' after the interface is brought up. To fix this behaviour, trigger execution of ieee80211_sta_work from ieee80211_open when in STA or IBSS mode. Signed-off-by: Jan Niehusmann <jan@gondor.com> --- diff --git a/net/mac80211/ieee80211.c b/net/mac80211/ieee80211.c index 28bcdf9..8e58639 100644 --- a/net/mac80211/ieee80211.c +++ b/net/mac80211/ieee80211.c @@ -286,6 +286,18 @@ static int ieee80211_open(struct net_device *dev) if (need_hw_reconfig) ieee80211_hw_config(local); + /* + * ieee80211_sta_work is disabled while network interface + * is down. Therefore, some configuration changes may not + * yet be effective. Trigger execution of ieee80211_sta_work + * to fix this. + */ + if(sdata->vif.type == IEEE80211_IF_TYPE_STA || + sdata->vif.type == IEEE80211_IF_TYPE_IBSS) { + struct ieee80211_if_sta *ifsta = &sdata->u.sta; + queue_work(local->hw.workqueue, &ifsta->work); + } + netif_start_queue(dev); return 0; ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] mac80211: trigger ieee80211_sta_work after opening interface 2008-03-23 19:23 [PATCH] mac80211: trigger ieee80211_sta_work after opening interface Jan Niehusmann @ 2008-03-23 22:16 ` Johannes Berg 2008-03-23 22:28 ` Tomas Winkler 2008-03-23 23:57 ` Jan Niehusmann 0 siblings, 2 replies; 8+ messages in thread From: Johannes Berg @ 2008-03-23 22:16 UTC (permalink / raw) To: Jan Niehusmann; +Cc: John W. Linville, linux-wireless, Michael Wu, Jiri Benc [-- Attachment #1: Type: text/plain, Size: 729 bytes --] On Sun, 2008-03-23 at 20:23 +0100, Jan Niehusmann wrote: > ieee80211_sta_work is disabled while network interface > is down. Therefore, if you configure wireless parameters > before bringing the interface up, these configurations are > not yet effective and association fails. > > A workaround from userspace is calling a command like > 'iwconfig wlan0 ap any' after the interface is brought up. > > To fix this behaviour, trigger execution of ieee80211_sta_work from > ieee80211_open when in STA or IBSS mode. What happens with this patch when you haven't set any configuration items before bringing the interface up? We want it to do nothing, if that behaviour is kept the patch should be fine. johannes [-- Attachment #2: This is a digitally signed message part --] [-- Type: application/pgp-signature, Size: 828 bytes --] ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] mac80211: trigger ieee80211_sta_work after opening interface 2008-03-23 22:16 ` Johannes Berg @ 2008-03-23 22:28 ` Tomas Winkler 2008-03-24 0:10 ` Jan Niehusmann 2008-03-24 14:32 ` Dan Williams 2008-03-23 23:57 ` Jan Niehusmann 1 sibling, 2 replies; 8+ messages in thread From: Tomas Winkler @ 2008-03-23 22:28 UTC (permalink / raw) To: Johannes Berg Cc: Jan Niehusmann, John W. Linville, linux-wireless, Michael Wu, Jiri Benc On Mon, Mar 24, 2008 at 12:16 AM, Johannes Berg <johannes@sipsolutions.net> wrote: > > On Sun, 2008-03-23 at 20:23 +0100, Jan Niehusmann wrote: > > ieee80211_sta_work is disabled while network interface > > is down. Therefore, if you configure wireless parameters > > before bringing the interface up, these configurations are > > not yet effective and association fails. > > > > A workaround from userspace is calling a command like > > 'iwconfig wlan0 ap any' after the interface is brought up. > > > > To fix this behaviour, trigger execution of ieee80211_sta_work from > > ieee80211_open when in STA or IBSS mode. > > What happens with this patch when you haven't set any configuration > items before bringing the interface up? We want it to do nothing, if > that behaviour is kept the patch should be fine. Why should be possible to configure device when it's not up. Shouldn't be there some order in which things are happening? Thanks Tomas > johannes > ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] mac80211: trigger ieee80211_sta_work after opening interface 2008-03-23 22:28 ` Tomas Winkler @ 2008-03-24 0:10 ` Jan Niehusmann 2008-03-24 14:32 ` Dan Williams 1 sibling, 0 replies; 8+ messages in thread From: Jan Niehusmann @ 2008-03-24 0:10 UTC (permalink / raw) To: Tomas Winkler Cc: Johannes Berg, John W. Linville, linux-wireless, Michael Wu, Jiri Benc On Mon, Mar 24, 2008 at 12:28:07AM +0200, Tomas Winkler wrote: > Why should be possible to configure device when it's not up. Shouldn't > be there some order in which things are happening? I don't know if it should be possible, but the debian ifup scripts seem to do it that way. I just configured the interface in /etc/network/interfaces using the wireless_* config options, and 'ifup wlan0' fails to start the network as the interface doesn't associate. It does work if I manually call 'iwconfig wlan0 ap any' after the scripts brought the interface up. With the patch, 'ifup wlan0' works perfectly for me. Also, I'm not the only one with this problem, as I found exactly the same hint with google: http://bayleshanks.com/tips-computer-lenovoX61t-gnuLinuxSetup "I found that I have to do "iwconfig wlan0 ap any" before it will associate with my router. Dunno if that's a general problem or if I did something wrong in /etc/network/interfaces." (Please not that I'm using a Lenovo x61s, and the mentioned link talks about an x61t, which are quite similar. So it may be that this behaviour is only visible with some hardware configurations.) Jan ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] mac80211: trigger ieee80211_sta_work after opening interface 2008-03-23 22:28 ` Tomas Winkler 2008-03-24 0:10 ` Jan Niehusmann @ 2008-03-24 14:32 ` Dan Williams 2008-03-24 14:56 ` Tomas Winkler 1 sibling, 1 reply; 8+ messages in thread From: Dan Williams @ 2008-03-24 14:32 UTC (permalink / raw) To: Tomas Winkler Cc: Johannes Berg, Jan Niehusmann, John W. Linville, linux-wireless, Michael Wu, Jiri Benc On Mon, 2008-03-24 at 00:28 +0200, Tomas Winkler wrote: > On Mon, Mar 24, 2008 at 12:16 AM, Johannes Berg > <johannes@sipsolutions.net> wrote: > > > > On Sun, 2008-03-23 at 20:23 +0100, Jan Niehusmann wrote: > > > ieee80211_sta_work is disabled while network interface > > > is down. Therefore, if you configure wireless parameters > > > before bringing the interface up, these configurations are > > > not yet effective and association fails. > > > > > > A workaround from userspace is calling a command like > > > 'iwconfig wlan0 ap any' after the interface is brought up. > > > > > > To fix this behaviour, trigger execution of ieee80211_sta_work from > > > ieee80211_open when in STA or IBSS mode. > > > > What happens with this patch when you haven't set any configuration > > items before bringing the interface up? We want it to do nothing, if > > that behaviour is kept the patch should be fine. > > Why should be possible to configure device when it's not up. Shouldn't > be there some order in which things are happening? This was the way that wireless-tools/WEXT worked with older fullmac type cards; the driver would usually cache the value until the device came up (and then blast all cached values to the card and try to associate) or the firmware would still accept commands while the interface was down because the firmware was already on the card and didn't have to be loaded at runtime. These days, of course, with cards that load firmware on open() (ex iwl to save power, and others) this isn't possible unless the driver caches the values until the device is brought up. Personally, I don't really think this is an issue. Things change, some cards don't allow scanning when they are down, etc. It's a lot of code to cache the values in the driver that isn't really needed if people just start setting the device up before configuring it. I think the tradeoff of having to modify userspace tool behavior versus having to maintain more code in the drivers/stack is quite clear: less code in mac80211/drivers. Dan > Thanks > Tomas > > > johannes > > > -- > To unsubscribe from this list: send the line "unsubscribe linux-wireless" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] mac80211: trigger ieee80211_sta_work after opening interface 2008-03-24 14:32 ` Dan Williams @ 2008-03-24 14:56 ` Tomas Winkler 0 siblings, 0 replies; 8+ messages in thread From: Tomas Winkler @ 2008-03-24 14:56 UTC (permalink / raw) To: Dan Williams Cc: Johannes Berg, Jan Niehusmann, John W. Linville, linux-wireless, Michael Wu, Jiri Benc On Mon, Mar 24, 2008 at 4:32 PM, Dan Williams <dcbw@redhat.com> wrote: > > On Mon, 2008-03-24 at 00:28 +0200, Tomas Winkler wrote: > > On Mon, Mar 24, 2008 at 12:16 AM, Johannes Berg > > <johannes@sipsolutions.net> wrote: > > > > > > On Sun, 2008-03-23 at 20:23 +0100, Jan Niehusmann wrote: > > > > ieee80211_sta_work is disabled while network interface > > > > is down. Therefore, if you configure wireless parameters > > > > before bringing the interface up, these configurations are > > > > not yet effective and association fails. > > > > > > > > A workaround from userspace is calling a command like > > > > 'iwconfig wlan0 ap any' after the interface is brought up. > > > > > > > > To fix this behaviour, trigger execution of ieee80211_sta_work from > > > > ieee80211_open when in STA or IBSS mode. > > > > > > What happens with this patch when you haven't set any configuration > > > items before bringing the interface up? We want it to do nothing, if > > > that behaviour is kept the patch should be fine. > > > > Why should be possible to configure device when it's not up. Shouldn't > > be there some order in which things are happening? > > This was the way that wireless-tools/WEXT worked with older fullmac type > cards; the driver would usually cache the value until the device came up > (and then blast all cached values to the card and try to associate) or > the firmware would still accept commands while the interface was down > because the firmware was already on the card and didn't have to be > loaded at runtime. I'm stopping to like the idea of having firmware loaded in open, there is conceptual problem with this as we've seen in rfkill and now the configuration. Probe is a problem because the filesystem is not available so there have to be something in between. > These days, of course, with cards that load firmware on open() (ex iwl > to save power, and others) this isn't possible unless the driver caches > the values until the device is brought up. > > Personally, I don't really think this is an issue. Things change, some > cards don't allow scanning when they are down, etc. It's a lot of code > to cache the values in the driver that isn't really needed if people > just start setting the device up before configuring it. I think the > tradeoff of having to modify userspace tool behavior versus having to > maintain more code in the drivers/stack is quite clear: less code in > mac80211/drivers. Aggree Tomas ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] mac80211: trigger ieee80211_sta_work after opening interface 2008-03-23 22:16 ` Johannes Berg 2008-03-23 22:28 ` Tomas Winkler @ 2008-03-23 23:57 ` Jan Niehusmann 2008-03-24 10:21 ` Johannes Berg 1 sibling, 1 reply; 8+ messages in thread From: Jan Niehusmann @ 2008-03-23 23:57 UTC (permalink / raw) To: Johannes Berg; +Cc: John W. Linville, linux-wireless, Michael Wu, Jiri Benc On Sun, Mar 23, 2008 at 11:16:35PM +0100, Johannes Berg wrote: > On Sun, 2008-03-23 at 20:23 +0100, Jan Niehusmann wrote: > > To fix this behaviour, trigger execution of ieee80211_sta_work from > > ieee80211_open when in STA or IBSS mode. > > What happens with this patch when you haven't set any configuration > items before bringing the interface up? We want it to do nothing, if > that behaviour is kept the patch should be fine. As far as I can tell (without knowing mac80211 very well), ifsta->state should be IEEE80211_DISABLED on an unconfigured interface. With ifsta->state==IEEE80211_DISABLED, ieee80211_sta_work only does the following: [...] while ((skb = skb_dequeue(&ifsta->skb_queue))) ieee80211_sta_rx_queued_mgmt(dev, skb); [...] if (test_and_clear_bit(IEEE80211_STA_REQ_AUTH, &ifsta->request)) { if (ieee80211_sta_config_auth(dev, ifsta)) return; clear_bit(IEEE80211_STA_REQ_RUN, &ifsta->request); } else if (!test_and_clear_bit(IEEE80211_STA_REQ_RUN, &ifsta->request)) return; This looks quite safe, especially as ifsta->skb_queue should be empty in DISABLED state (ieee80211_rx_h_mgmt doesn't enqueue packets unless mode is STA or IBSS). I also just tried it, calling 'ifconfig wlan0 up' on an otherwise unconfigured interface didn't have any obvious effect. BTW, after doing this, I noticed that setting essid first and the WEP encryption key later didn't lead to associated state. Again, I had to trigger association by calling 'iwconfig wlan0 essid ...' or 'iwconfig wlan0 ap any' after setting the key. Is this behaviour expected? Jan ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] mac80211: trigger ieee80211_sta_work after opening interface 2008-03-23 23:57 ` Jan Niehusmann @ 2008-03-24 10:21 ` Johannes Berg 0 siblings, 0 replies; 8+ messages in thread From: Johannes Berg @ 2008-03-24 10:21 UTC (permalink / raw) To: Jan Niehusmann; +Cc: John W. Linville, linux-wireless, Michael Wu, Jiri Benc [-- Attachment #1: Type: text/plain, Size: 344 bytes --] > BTW, after doing this, I noticed that setting essid first and the WEP > encryption key later didn't lead to associated state. Again, I had to > trigger association by calling 'iwconfig wlan0 essid ...' or 'iwconfig > wlan0 ap any' after setting the key. Is this behaviour expected? Yes, and for sure not going to change. johannes [-- Attachment #2: This is a digitally signed message part --] [-- Type: application/pgp-signature, Size: 828 bytes --] ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2008-03-24 14:56 UTC | newest] Thread overview: 8+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2008-03-23 19:23 [PATCH] mac80211: trigger ieee80211_sta_work after opening interface Jan Niehusmann 2008-03-23 22:16 ` Johannes Berg 2008-03-23 22:28 ` Tomas Winkler 2008-03-24 0:10 ` Jan Niehusmann 2008-03-24 14:32 ` Dan Williams 2008-03-24 14:56 ` Tomas Winkler 2008-03-23 23:57 ` Jan Niehusmann 2008-03-24 10:21 ` Johannes Berg
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.