freebsd-dev/sys
Bill Paul 58a6edd121 When you call MiniportInitialize() for an 802.11 driver, it will
at some point result in a status event being triggered (it should
be a link down event: the Microsoft driver design guide says you
should generate one when the NIC is initialized). Some drivers
generate the event during MiniportInitialize(), such that by the
time MiniportInitialize() completes, the NIC is ready to go. But
some drivers, in particular the ones for Atheros wireless NICs,
don't generate the event until after a device interrupt occurs
at some point after MiniportInitialize() has completed.

The gotcha is that you have to wait until the link status event
occurs one way or the other before you try to fiddle with any
settings (ssid, channel, etc...). For the drivers that set the
event sycnhronously this isn't a problem, but for the others
we have to pause after calling ndis_init_nic() and wait for the event
to arrive before continuing. Failing to wait can cause big trouble:
on my SMP system, calling ndis_setstate_80211() after ndis_init_nic()
completes, but _before_ the link event arrives, will lock up or
reset the system.

What we do now is check to see if a link event arrived while
ndis_init_nic() was running, and if it didn't we msleep() until
it does.

Along the way, I discovered a few other problems:

- Defered procedure calls run at PASSIVE_LEVEL, not DISPATCH_LEVEL.
  ntoskrnl_run_dpc() has been fixed accordingly. (I read the documentation
  wrong.)

- Similarly, the NDIS interrupt handler, which is essentially a
  DPC, also doesn't need to run at DISPATCH_LEVEL. ndis_intrtask()
  has been fixed accordingly.

- MiniportQueryInformation() and MiniportSetInformation() run at
  DISPATCH_LEVEL, and each request must complete before another
  can be submitted. ndis_get_info() and ndis_set_info() have been
  fixed accordingly.

- Turned the sleep lock that guards the NDIS thread job list into
  a spin lock. We never do anything with this lock held except manage
  the job list (no other locks are held), so it's safe to do this,
  and it's possible that ndis_sched() and ndis_unsched() can be
  called from DISPATCH_LEVEL, so using a sleep lock here is
  semantically incorrect. Also updated subr_witness.c to add the
  lock to the order list.
2005-03-07 03:05:31 +00:00
..
alpha Remove dead code. 2005-03-07 02:18:52 +00:00
amd64 Remove dead code. 2005-03-07 02:18:52 +00:00
arm Fix typo. 2005-03-07 00:24:52 +00:00
boot Fix typos in a comment. 2005-03-06 13:53:05 +00:00
bsm Add a stub audit_kevents.h, which defines exactly one audit event: 2005-02-02 14:27:36 +00:00
cam Reference a pointer correctly when copying to it's location. 2005-02-21 00:28:36 +00:00
coda Replace the workaround for a deadlock bug in Coda with a different 2005-02-20 23:01:57 +00:00
compat When you call MiniportInitialize() for an 802.11 driver, it will 2005-03-07 03:05:31 +00:00
conf Correct indentation style: 2005-03-07 02:20:14 +00:00
contrib Move all of the hptmv files to /sys/dev/hptmv so that they won't be mistaken 2005-03-02 05:14:28 +00:00
crypto Start the dreaded NOFOO -> NO_FOO conversion. 2004-12-21 08:47:35 +00:00
ddb Start each of the license/copyright comments with /*- 2005-01-06 01:34:41 +00:00
dev When you call MiniportInitialize() for an 802.11 driver, it will 2005-03-07 03:05:31 +00:00
doc
fs Avoid a couple of mutex operations in the process exit path for the 2005-03-01 12:20:49 +00:00
gdb /* -> /*- for copyright notices, minor format tweaks as necessary 2005-01-06 18:27:30 +00:00
geom Don't allow to synchronize a plex that is already sychronizing. 2005-03-04 16:43:40 +00:00
gnu Remove debug printout of major/minor numbers, print name instead. 2005-02-27 21:16:26 +00:00
i4b /* -> /*- for copyright notices, minor format tweaks as necessary 2005-01-06 22:18:23 +00:00
i386 Remove dead code. 2005-03-07 02:18:52 +00:00
ia64 Remove dead code. 2005-03-07 02:18:52 +00:00
isa Save and restore the VGA state across a suspend-resume cycle. This 2005-02-28 21:06:14 +00:00
isofs/cd9660 Conditionalize cd9660 chattiness regarding the nature of the file system 2005-02-18 10:49:55 +00:00
kern When you call MiniportInitialize() for an 802.11 driver, it will 2005-03-07 03:05:31 +00:00
libkern Add strspn() to libkern. 2005-02-10 20:39:39 +00:00
modules Move all of the hptmv files to /sys/dev/hptmv so that they won't be mistaken 2005-03-02 05:14:28 +00:00
net When neither of supported frame type is enabled via kernel options enable 2005-03-06 23:03:58 +00:00
net80211 Recently, it was reported to me that you could provoke a double fault 2005-03-03 17:35:05 +00:00
netatalk When generating a phase II ARP lookup from aarpwhohas(), use a 2005-02-22 14:37:22 +00:00
netatm In the current world order, solisten() implements the state transition of 2005-02-21 21:58:17 +00:00
netgraph Cisco uses milliseconds for uptime. This is stupid. Nobody cares of such 2005-03-03 11:01:05 +00:00
netinet Fix a problem in the Skinny ALG where a specially crafted packet could cause 2005-03-03 03:06:37 +00:00
netinet6 ignores ICMPv6 code field in case of ICMPv6 Packet-Too-Big (as specified in RFC2463 and draft-ietf-ipngwg-icmp-v3-06.txt) 2005-03-02 05:14:15 +00:00
netipsec /* -> /*- for license, minor formatting changes 2005-01-07 01:45:51 +00:00
netipx In the current world order, solisten() implements the state transition of 2005-02-21 21:58:17 +00:00
netkey fixed an unexpected addr/port matching failure in IPv6 SA management 2005-01-10 13:06:42 +00:00
netnatm Mark netatm and netnatm explicitly as requiring Giant, as they still do. 2005-02-17 14:21:22 +00:00
netncp avoid potential null ptr derefs 2005-02-23 22:44:38 +00:00
netsmb /* -> /*- for license, minor formatting changes 2005-01-07 01:45:51 +00:00
nfs /* -> /*- for license, minor formatting changes 2005-01-07 01:45:51 +00:00
nfs4client Follow v_id changes in NFSv[23] 2005-02-22 15:15:28 +00:00
nfsclient Minor cleanup in nfs_request() and removal of a comment that doesn't 2005-02-26 18:55:36 +00:00
nfsserver Don't try to create vnode_pager objects on other filesystems vnodes, 2005-01-24 22:09:13 +00:00
opencrypto Use dynamic major number allocation. 2005-02-27 22:11:02 +00:00
pc98 MFi386: revisions 1.609 and 1.610. 2005-03-06 12:59:59 +00:00
pccard Remove more deadwood that never got implemented in NEWCARD, since NEWCARD 2005-02-15 02:54:53 +00:00
pci Add device id for the Ali M1671 host to AGP bridge. 2005-02-27 13:05:34 +00:00
posix4 /* -> /*- for license, minor formatting changes 2005-01-07 02:29:27 +00:00
powerpc physmem is a much better indicator for 'real' memory on PPC than Maxmem 2005-03-07 01:52:24 +00:00
rpc /* -> /*- for license, minor formatting changes 2005-01-07 02:29:27 +00:00
security Remove an accidental clearing of the new label pointer on a system V 2005-02-24 16:08:41 +00:00
sparc64 Declare as volatile the memory location referenced by a pointer rather than 2005-03-06 20:57:08 +00:00
sys The m_ext reference counts are potentially shared and modified 2005-03-06 20:09:00 +00:00
tools Add VOP_FOO_APV() which takes a pointer to the vop_vector. 2005-02-08 12:54:32 +00:00
ufs - Fix anoter dyslexic moment; an atomic_set_int should've become ACTIVESET, 2005-03-01 07:38:45 +00:00
vm Revert the first part of revision 1.114 and modify the second part. On 2005-02-24 06:13:01 +00:00
Makefile Add targets to build cscope name files and TAGS file for etags. 2005-03-05 00:56:15 +00:00