Karl Relton
2008-02-20 20:43:27 UTC
[I've moved over to the devel alias]
that the drvr_start operation now has a 1000 msec sleep inserted it (to
work-around dodgy hardware etc. etc.).
What is happening is as follows:
- prism2sta_probe_usb is calling register_wlandev(), setting
wlandev->msdstate = WLAN_MSD_HWPRESENT
and then calling prism2sta_ifstate to do the automatic enable.
- The automatic enable is sets
wlandev->msdstate = WLAN_MSD_RUNNING_PENDING
and then calls drvr_start which will take at least 1 second due to
its enforced waiting time.
- in parallel, as a result of register_wlandev, udev will be signalled
with the 'ADD NET' which triggers the rule to call wlan-udev.sh
- wlan-udev.sh results in wlanctl-ng being called, which in turn results
in p80211req_dorequest being called.
- p80211req_dorequest tests wlandev->msdstate, and since it is not in a
'normal' state, returns with -ENODEV
So its not that the device doesn't exist, its that it is in a funny
state that p80211req_dorequest throws out with the 'no device' error
code.
The quick work-around is of course to insert a 2 second sleep into
wlan-udev.sh, as you have found.
p80211req_dorequest could be changed to return -EBUSY, the correct
status for what is happening at that point. This would still need work
in wlan-udev.sh (or its friends) to wait-loop while -EBUSY is returned
by wlanctl-ng.
Perhaps it would be better though to re-order prism2sta_probe_usb to
call prism2sta_ifstate before registering the device? That way udev and
associated user-space stuff would be delayed until the device really was
ready.
I would imagine that even if you weren't trying to do a firmware upload,
the current code could give NetworkManager head-aches because it might
try controlling the device while the prism2sta_ifstate is still in
operation.
Karl
Hi,
I have some trouble with the new (svn version 1851) wlan_wext_write
auto-enabling and loading of firmware through udev scripts. I reported
this in http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=465681 but I
"The firmware loading fails because when /etc/wlan/wlan-udev.sh is
run, the wlan0 interface is not available
wlanctl-ng: No such device
wlanctl-ng: No such device
prism2dl: No such device
Running it manually later works fine. I inserted a "sleep 2" on the
top of wlan-udev.sh and then it works
fine. It can seem like the udev rule 84-linux-wlan-ng runs the
wlan-udev.sh script "too early". I also stopped
network-manager to verify that it was not to blame.
However, if I echo 0 > /sys/module/p80211/parameters/wlan_wext_write,
the firmware loading works. So this
problem might be related to the new auto-enabling in the driver."
What we have here is a race condition, which is exasperated by the factI have some trouble with the new (svn version 1851) wlan_wext_write
auto-enabling and loading of firmware through udev scripts. I reported
this in http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=465681 but I
"The firmware loading fails because when /etc/wlan/wlan-udev.sh is
run, the wlan0 interface is not available
wlanctl-ng: No such device
wlanctl-ng: No such device
prism2dl: No such device
Running it manually later works fine. I inserted a "sleep 2" on the
top of wlan-udev.sh and then it works
fine. It can seem like the udev rule 84-linux-wlan-ng runs the
wlan-udev.sh script "too early". I also stopped
network-manager to verify that it was not to blame.
However, if I echo 0 > /sys/module/p80211/parameters/wlan_wext_write,
the firmware loading works. So this
problem might be related to the new auto-enabling in the driver."
that the drvr_start operation now has a 1000 msec sleep inserted it (to
work-around dodgy hardware etc. etc.).
What is happening is as follows:
- prism2sta_probe_usb is calling register_wlandev(), setting
wlandev->msdstate = WLAN_MSD_HWPRESENT
and then calling prism2sta_ifstate to do the automatic enable.
- The automatic enable is sets
wlandev->msdstate = WLAN_MSD_RUNNING_PENDING
and then calls drvr_start which will take at least 1 second due to
its enforced waiting time.
- in parallel, as a result of register_wlandev, udev will be signalled
with the 'ADD NET' which triggers the rule to call wlan-udev.sh
- wlan-udev.sh results in wlanctl-ng being called, which in turn results
in p80211req_dorequest being called.
- p80211req_dorequest tests wlandev->msdstate, and since it is not in a
'normal' state, returns with -ENODEV
So its not that the device doesn't exist, its that it is in a funny
state that p80211req_dorequest throws out with the 'no device' error
code.
The quick work-around is of course to insert a 2 second sleep into
wlan-udev.sh, as you have found.
p80211req_dorequest could be changed to return -EBUSY, the correct
status for what is happening at that point. This would still need work
in wlan-udev.sh (or its friends) to wait-loop while -EBUSY is returned
by wlanctl-ng.
Perhaps it would be better though to re-order prism2sta_probe_usb to
call prism2sta_ifstate before registering the device? That way udev and
associated user-space stuff would be delayed until the device really was
ready.
I would imagine that even if you weren't trying to do a firmware upload,
the current code could give NetworkManager head-aches because it might
try controlling the device while the prism2sta_ifstate is still in
operation.
Karl