svn commit: r287892 - head/sys/dev/usb/wlan

Adrian Chadd adrian at freebsd.org
Thu Sep 17 17:27:29 UTC 2015


On 17 September 2015 at 00:53, Hans Petter Selasky <hps at selasky.org> wrote:
> Hi Adrian,
>
> On 09/17/15 09:43, Adrian Chadd wrote:
>>
>> .. I'm likely going to do exactly that as part of "making" if_rsu do
>> 11n and behave correctly. Right now it does neither.
>
>
> Thank you for helping out with the USB WLAN drivers. Yes, USB requests sleep
> and don't spin until they're done.
>
>>
>> But this is a pretty big design pattern flaw; all of the wifi drivers
>> use the usb library like this and .. well, unless you look under the
>> hood, you don't really realise that serialiser lock is being dropped
>> for you... :(
>
>
> Right. If you need any help test, code or review, let me know.
>
> Not dropping the mutex inside USB sleeping functions would force all USB
> drivers to use SX locks or lower in the locking hierherachy, for
> synchronization, which would not be so good.

Well, that's a big design warning alert. Same as NICs that do
UNLOCK;input;LOCK and chunks of the wifi stack I inherited which do
the same thing - you suddenly can't guarantee consistency in any way.

So, we need some way to serialise management accesses and TX/RX
accesses and we need to use that design pattern for all drivers. Right
now it's "use mutex to serialize hardware state" which people then
break with unlock;stackwork;lock or unlock;sleep;lock. I can't point
to a specific USB device that does it correctly (and most PCI wifi
drivers don't do it either. Sigh.)



-adrian


More information about the svn-src-all mailing list