summaryrefslogtreecommitdiffstats
path: root/sys/compat/ndis/ntoskrnl_var.h
diff options
context:
space:
mode:
authorwpaul <wpaul@FreeBSD.org>2005-05-19 04:44:26 +0000
committerwpaul <wpaul@FreeBSD.org>2005-05-19 04:44:26 +0000
commit8e4107ff8fb214fe5141e4fbcaf07d79be8054e5 (patch)
treec76597a96dfa452438eaf437b53d7eb8d885711c /sys/compat/ndis/ntoskrnl_var.h
parenteee15b6b760b3a8df97475f67ad7baa5b81552a4 (diff)
downloadFreeBSD-src-8e4107ff8fb214fe5141e4fbcaf07d79be8054e5.zip
FreeBSD-src-8e4107ff8fb214fe5141e4fbcaf07d79be8054e5.tar.gz
Fix some of the things I broke so that the SMC2602W (AMD Am1772) driver
works again. This driver uses NdisScheduleWorkItem(), and we have to take special steps to insure that its workitems don't collide with any of the other workitems used by the NDISulator. In particular, if one of the driver's work jobs blocks, it can prevent NdisMAllocateSharedMemoryAsync() from completing when expected. The original hack to fix this was to have NdisMAllocateSharedMemoryAsync() defer its work to the DPC queue instead of the general task queue. To fix it now, I decided to add some additional workitem threads. (There's supposed to be a pool of worker threads in Windows anyway.) Currently, there are 4. There should be at least 2. One is reserved for the legacy ExQueueWorkItem() API, while the others are used in round-robin by the IoQueueWorkItem() API. NdisMAllocateSharedMemoryAsync() uses the latter API while NdisScheduleWorkItem() uses the former, so the deadlock is avoided. Fixed NdisMRegisterDevice()/NdisMDeregisterDevice() to work a little more sensibly with the new driver_object/device_object framework. It doesn't really register a working user-mode interface, but the existing code was completely wrong for the new framework. Fixed a couple of bugs dealing with the cancellation of events and DPCs. When cancelling an event that's still on the timer queue (i.e. hasn't expired yet), reset dh_inserted in its dispatch header to FALSE. Previously, it was left set to TRUE, which would make a cancelled timer appear to have not been cancelled. Also, when removing a DPC from a queue, reset its list pointers, otherwise a cancelled DPC might mistakenly be treated as still pending. Lastly, fix the behavior of ntoskrnl_wakeup() when dealing with objects that have nobody waiting on them: sync event objects get their signalled state reset to FALSE, but notification objects should still be set to TRUE.
Diffstat (limited to 'sys/compat/ndis/ntoskrnl_var.h')
-rw-r--r--sys/compat/ndis/ntoskrnl_var.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/sys/compat/ndis/ntoskrnl_var.h b/sys/compat/ndis/ntoskrnl_var.h
index 3db1e4e..622a387 100644
--- a/sys/compat/ndis/ntoskrnl_var.h
+++ b/sys/compat/ndis/ntoskrnl_var.h
@@ -1166,13 +1166,18 @@ struct io_workitem {
void *iw_ctx;
list_entry iw_listentry;
device_object *iw_dobj;
+ int iw_idx;
};
typedef struct io_workitem io_workitem;
#define WORKQUEUE_CRITICAL 0
#define WORKQUEUE_DELAYED 1
-#define WORKQUEUE_HUPERCRITICAL 2
+#define WORKQUEUE_HYPERCRITICAL 2
+
+#define WORKITEM_THREADS 4
+#define WORKITEM_LEGACY_THREAD 3
+#define WORKIDX_INC(x) (x) = (x + 1) % WORKITEM_LEGACY_THREAD
/*
* Older, deprecated work item API, needed to support NdisQueueWorkItem().
OpenPOWER on IntegriCloud