4 All ABI entry points into the wlan infrastructure must acquire the
5 wlan_global_serializer. Normally all wireless base drivers also
6 use this serializer to avoid deadlocks.
10 When porting a new wireless low level device be sure to remove all
11 *LOCK* (upper case) macro calls because the whole point of this is
12 to redo the locking with our own.
16 All border crossings (module loader, sysctl, eventhandlers, tasks,
17 callouts, ifnet, devmethod, and interrupt handlers) must be properly
18 wrapped with wlan_serialize_enter() and wlan_serialize_exit(). Pay
19 careful attention to any early return()s that might break your locks.
22 modevent search for DECLARE_MODULE and MOD_LOAD and friends.
24 sysctl search for SYSCTL_HANDLER_ARGS.
26 Generally speaking sysctls should be rewritten to use
27 a flow-through model (see ath for an example) as most
28 of them currently use a badly designed early-termination
31 eventhandler search for EVENTHANDLER_REGISTER.
33 taskq search for TASK_INIT.
35 All taskq callback procedures should be renamed to
38 callout search for callout_reset.
40 search for callout_stop to deal with potential deadlock
43 All callout callback procedures should be renamed to
46 ifnet wlan/ieee80211.c
48 This is handled by ieee80211_ifattach() where we set
49 the serializer to &wlan_global_serializer when we
50 call ether_ifattach(). The low level drivers should
51 just be calling ieee80211_ifattach() so no additional
52 work should be needed here.
54 devmethod Search for DEVMETHOD (low level drivers). Typically
55 this is in the *_pci.c file. The attach function might
56 present an issue where you may wish to release the
57 serializer across the main DMA area allocations.
60 interrupt Search for bus_setup_intr().
62 Typically we pass the &wlan_global_serializer to
63 bus_setup_intr(). The interrupt callback is thus
64 serialized automatically.
67 This is called directly from the wlan's ifp->if_ioctl and
68 also from various wireless drivers. This function expects
69 the serializer to already be acquired.
71 The kernel will acquire if_serializer when making
72 ifp->if_ioctl() calls.
74 {t,lk}sleep Low level drivers sometimes call {t,lk}sleep() to
75 wait for an interrupt driven event to wake them up. In
76 these cases the interrupt will be blocked on the wlan
77 serializer and the tsleep will timeout. To fix the
78 problem use zsleep() to release the &wlan_global_serializer
79 across the sleep operation.
81 firmware The firmware loader uses a taskq to defer certain
82 operations which can then deadlock against the wlan
83 serializer. Thus it is usually a good idea to
84 release the serializer (wlan_serialize_exit/enter)
85 around the call to firmware_get().
87 Low level device drivers
88 Don't forget that low level device drivers such as ath
89 have callouts, taskq, sysctl, and other elements also!
91 Look for old calls to ifnet_serialize*() and remove,
92 in addition to the various LOCK macros.