List Info

Thread: Re: timing issues with udev and firmware loading




Re: timing issues with udev and firmware loading
country flaguser name
United Kingdom
2008-03-12 09:08:26
Hi Karl,

The latest svn with this auto enable doesn't work very well
with
network_manager, at least for me anyway.

It's ok on boot, but if I unload/load the module the network
interface
never gets brought up. The firmware is loaded ok but nothing
else
happens. I guess it's some sort of timing issue, or maybe
just the
driver state getting confused.

I added this patch so I can turn off the auto enable.
Adding p80211 wlan_auto_enable=0 to /etc/modprobe.conf makes
it all work
as I expect. 

However I'm not sure if this is the right approach,so I'll
see if I can
work out why the net interface never comes up.

cheers
Richard

diff --git a/src/include/wlan/p80211netdev.h
b/src/include/wlan/p80211netdev.h
index 3e23102..58b074d 100644
--- a/src/include/wlan/p80211netdev.h
+++ b/src/include/wlan/p80211netdev.h
 -173,6
+173,7  int p80211wext_event_associated(struct wlandevice
*wlandev, int assoc);
 
 extern int wlan_watchdog;
 extern int wlan_wext_write;
+extern int wlan_auto_enable;
 
 /* WLAN device type */
 typedef struct wlandevice
diff --git a/src/p80211/p80211mod.c
b/src/p80211/p80211mod.c
index 130a0de..1fd51c1 100644
--- a/src/p80211/p80211mod.c
+++ b/src/p80211/p80211mod.c
 -115,6
+115,11  module_param(wlan_wext_write, int, 0644);
 MODULE_PARM_DESC(wlan_wext_write, "enable write
wireless extensions");
 #endif
 
+int wlan_auto_enable = 1;
+module_param(wlan_auto_enable,int,0644);
+MODULE_PARM_DESC(wlan_auto_enable, "auto enable
card");
+
+
 #ifdef WLAN_INCLUDE_DEBUG
 int wlan_debug=0;
 module_param(wlan_debug, int, 0644); 
 -216,3
+221,4  EXPORT_SYMBOL(p80211skb_rxmeta_attach);
 EXPORT_SYMBOL(p80211wext_event_associated);
 
 EXPORT_SYMBOL(wlan_wext_write);
+EXPORT_SYMBOL(wlan_auto_enable);
diff --git a/src/prism2/driver/prism2_usb.c
b/src/prism2/driver/prism2_usb.c
index b250250..8d5d588 100644
--- a/src/prism2/driver/prism2_usb.c
+++ b/src/prism2/driver/prism2_usb.c
 -167,7
+167,7  static int prism2sta_probe_usb(
 		goto failed;
         }
 
-	if (wlan_wext_write)
+	if (wlan_wext_write && wlan_auto_enable)
 		prism2sta_ifstate(wlandev, P80211ENUM_ifstate_enable);
 
 	goto done;

  

On Thu, 2008-02-28 at 19:25 +0000, Karl Relton wrote:
> On Tue, 2008-02-26 at 17:31 -0500, Solomon Peachy
wrote: 
> > On Tue, Feb 26, 2008 at 09:39:29PM +0000, Karl
Relton wrote:
> > > Your alteration misses the point! The
ifstate_enable needs to happen
> > > before the register_wlan ... otherwise we
will still have the same
> > > timing issue.
> > 
> > ... yes and no -- It's happening after the
corereset, which is also a 
> > major source of delay.  At least on non-usb
targets, assuming that it 
> > hasn't been overridden.
> > 
> > > So as it stands things are still broken.
> > 
> > Yeah, I see that, but with the patch they're still
broken; only 
> > differently.  The ifstate_enable isn't guaranteed
to succeed, so 
> > at netdev_register, the hardware is still in an
unknown state.
> > 
> 
> Well if ifstate_enable doesn't succeed, we could even
refrain from
> registering the device at all! Of course that would
leave the user with
> no handle on which to try and bring the device up
manually though, which
> wouldn't be good ...
> 
> > From my perspective, wlan-udev.sh should do
nothing if we're in 
> > wlan_wext_write=1 mode and the hardware is
initialized.  These days the 
> > only real reason to do anything is if the user
explicitly wants to do a 
> > firmware load, and that will screw with
NetworkManager or other apps 
> > anyway.
> > 
> 
> I don't quite see things the same at this point: if
wlan_wext_write=1
> then wlan-udev.sh becomes just the 'firmware helper'.
If
> wlan_wext_write=0 then it is 'hardware initialise
helper'.
> 
> I can see your point (potentially) about firmware
loading messing with
> NetworkManager. Hopefully Tormod might be able to help
us here - I don't
> use NetworkManager but I'm guessing Tormod builds test
installs with
> NetworkManager running.
> 
> -->Tormod: have you worked out how NetworkManager
copes when the net
> device is registered (so NetworkManager presumably then
wants to take
> the device) and yet needs to wait for wlan-udev.sh to
do firmware
> uploading?
> 
> [Note: it might not be a problem at all, depending on
how udev works. I
> think udev gets the event from the kernel, processes it
and sends its
> own udev-event on to things like Hal and
NetworkManager. If udev doesn't
> send the udev-event on until after udev has seen
wlan-udev.sh complete,
> then we have no problem anyway]
> 
> 
> > Of course, the RightWay(tm) to solve all of these
problems is to push 
> > the firmware loading/plugging into the kernel, so
we can use the hotplug 
> > firmware loader and have everything up and running
before we call 
> > register_netdevice().
> > 
> 
> Agreed on this. I wonder just how difficult that is -
especially if it is legitimate to
> still use a shell 'helper' script to do the file choice
and loading. If I get some time,
> I might look into how other drivers do it. However,
that will take me a while, so
> before then we need an interim workable solution that
is basically free of race
> conditions even if not totally elegant.
> 
> Cheers
> Karl
> 
> _______________________________________________
> Linux-wlan-devel mailing list
> Linux-wlan-devellists.linux-wlan.com
> http://lists.linux-wlan.com/mailman/listinfo/linux-
wlan-devel

_______________________________________________
Linux-wlan-devel mailing list
Linux-wlan-devellists.linux-wlan.com
http://lists.linux-wlan.com/mailman/listinfo/linux-
wlan-devel

Re: timing issues with udev and firmware loading
country flaguser name
United Kingdom
2008-03-12 15:37:45
On Wed, 2008-03-12 at 14:08 +0000, Richard Kennedy wrote:
> Hi Karl,
> 
> The latest svn with this auto enable doesn't work very
well with
> network_manager, at least for me anyway.
> 
> It's ok on boot, but if I unload/load the module the
network interface
> never gets brought up. The firmware is loaded ok but
nothing else
> happens. I guess it's some sort of timing issue, or
maybe just the
> driver state getting confused.
> 
> I added this patch so I can turn off the auto enable.
> Adding p80211 wlan_auto_enable=0 to /etc/modprobe.conf
makes it all work
> as I expect. 
> 
> However I'm not sure if this is the right approach,so
I'll see if I can
> work out why the net interface never comes up.
> 
> cheers
> Richard
> 

Hi Richard

The code in svn isn't how I would prefer it - it has the
register_netdev
before the card is first initialised. I would do it the
other way round.
Solomon has his reasons for the way it currently is, but it
does leave
us with potentially bad side effects at the moment.

I'm surprised things are working well for you on boot up.
Have you
checked your log to see that firmware is actually being
loaded on boot
(e.g. in your syslog can you see the firmware version that
you would
expect?). With the current code, my suspicion is that
firmware load on
boot is doomed to fail, unless you have some sleep
statement(s)
somewhere in your wlan-udev.sh/shared/shared.prism2
scripts.

A module unload/reload should result in the same process,
since the
driver sees the hardware afresh and goes through the same
sequence.
Similarly networkmanager ought to have forgot about the
interface and
then pick it up again (but I've never really used it
myself).

Karl

_______________________________________________
Linux-wlan-devel mailing list
Linux-wlan-devellists.linux-wlan.com
http://lists.linux-wlan.com/mailman/listinfo/linux-
wlan-devel

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )