freebsd-skq/sys/compat/ndis
wpaul 2fe7b09cb1 Fix a problem reported by Pierre Beyssac. Sometinmes when ndis_get_info()
calls MiniportQueryInformation(), it will return NDIS_STATUS_PENDING.
When this happens, ndis_get_info() will sleep waiting for a completion
event. If two threads call ndis_get_info() and both end up having to
sleep, they will both end up waiting on the same wait channel, which
can cause a panic in sleepq_add() if INVARIANTS are turned on.

Fix this by having ndis_get_info() use a common mutex rather than
using the process mutex with PROC_LOCK(). Also do the same for
ndis_set_info(). Note that Pierre's original patch also made ndis_thsuspend()
use the new mutex, but ndis_thsuspend() shouldn't need this since
it will make each thread that calls it sleep on a unique wait channel.

Also, it occured to me that we probably don't want to enter
MiniportQueryInformation() or MiniportSetInformation() from more
than one thread at any given time, so now we acquire a Windows
spinlock before calling either of them. The Microsoft documentation
says that MiniportQueryInformation() and MiniportSetInformation()
are called at DISPATCH_LEVEL, and previously we would call
KeRaiseIrql() to set the IRQL to DISPATCH_LEVEL before entering
either routine, but this only guarantees mutual exclusion on
uniprocessor machines. To make it SMP safe, we need to use a real
spinlock. For now, I'm abusing the spinlock embedded in the
NDIS_MINIPORT_BLOCK structure for this purpose. (This may need to be
applied to some of the other routines in kern_ndis.c at a later date.)

Export ntoskrnl_init_lock() (KeInitializeSpinlock()) from subr_ntoskrnl.c
since we need to use in in kern_ndis.c, and since it's technically part
of the Windows kernel DDK API along with the other spinlock routines. Use
it in subr_ndis.c too rather than frobbing the spinlock directly.
2005-01-14 22:39:44 +00:00
..
cfg_var.h Start each of the license/copyright comments with /*- 2005-01-05 22:34:37 +00:00
hal_var.h Start each of the license/copyright comments with /*- 2005-01-05 22:34:37 +00:00
kern_ndis.c Fix a problem reported by Pierre Beyssac. Sometinmes when ndis_get_info() 2005-01-14 22:39:44 +00:00
ndis_var.h Start each of the license/copyright comments with /*- 2005-01-05 22:34:37 +00:00
ntoskrnl_var.h Fix a problem reported by Pierre Beyssac. Sometinmes when ndis_get_info() 2005-01-14 22:39:44 +00:00
pe_var.h Start each of the license/copyright comments with /*- 2005-01-05 22:34:37 +00:00
resource_var.h Add missing cprd_flags member to partial resource structure in 2004-03-29 02:15:29 +00:00
subr_hal.c Start each of the license/copyright comments with /*- 2005-01-05 22:34:37 +00:00
subr_ndis.c Fix a problem reported by Pierre Beyssac. Sometinmes when ndis_get_info() 2005-01-14 22:39:44 +00:00
subr_ntoskrnl.c Fix a problem reported by Pierre Beyssac. Sometinmes when ndis_get_info() 2005-01-14 22:39:44 +00:00
subr_pe.c Start each of the license/copyright comments with /*- 2005-01-05 22:34:37 +00:00