[lwlan-devel] [patch] move ctlx tidy up to a function in hfa284x_usb.c

Richard Kennedy richard at rsk.demon.co.uk
Tue May 15 05:15:13 EDT 2007


On Tue, 2007-05-15 at 01:07 +0100, Chris Rankin wrote:
> --- Richard Kennedy <richard at rsk.demon.co.uk> wrote:
> > Before this patch p80211netdev_hwremoved(wlandev) is called with the
> > ctlx lock held.
> 
> That was by design. The hwremoved flag tells the driver that the adapter has been physically
> yanked from the PC, and puts the brakes on any further CTLX handling. You will notice that these
> functions are checking this flag while they themselves hold the spinlock, e.g.
> 
> hfa384x_usbctlx_complete_sync()
> hfa384x_tx_timeout()
> hfa384x_usbctlx_completion_task()
> hfa384x_usbctlxq_run()
> hfa384x_usb_throttlefn()
> hfa384x_usbctlx_submit()
> 
> and what they have in common (IIRC) is that they move CTLXs from one working list to another (also
> under the spinlock). However, once the adapter is yanked, the disconnect function takes all the
> CTLXs off the working lists and places them all onto a "cleanlist" instead. It is therefore
> *imperative* that the hwremoved flag is set at the same time, so that all of the above functions
> know that the CTLXs are no longer safe to touch.
> 
> Remember that disconnection is an unpredicatable, asynchronous event that happens on the user's
> whim. We really don't want to be putting all CTLXs onto the cleanlist while (say) the completion
> task is in the middle of migrating a CTLX from one working list to the next.
> 
> I need to think further about the significance of the other change.
> 
> Cheers,
> Chris
> 
Chris,
thanks for the info, that gives me something to think about.
I'm trying to get suspend/resume working so although the card hasn't
been removed it is about to have its power removed.

My suspend code does this

  //disable card
+  p80211netdev_hwremoved(wlandev);
+  prism2sta_ifstate(wlandev, P80211ENUM_ifstate_disable);
+  if (hw) 
+    hfa384x_destroy_urbs(hw);

So I think it should be safe to clear the lists at that point.

My card is built in the the laptop so I never get to remove it or test
what happens when it is. My current version of suspend/resume seems to
work, but I'm still checking it to try and make sure that nothing is
leaking memory and it restarts in a clean state.


Cheers
Richard







More information about the Linux-wlan-devel mailing list