summaryrefslogtreecommitdiffstats
path: root/sys/compat/ndis/kern_ndis.c
diff options
context:
space:
mode:
authorwpaul <wpaul@FreeBSD.org>2005-11-02 18:01:04 +0000
committerwpaul <wpaul@FreeBSD.org>2005-11-02 18:01:04 +0000
commitc104267c1a97cafb9b2e7707382601a452ced831 (patch)
tree2f760970c94cf94b930470434ca4054a9ae096c5 /sys/compat/ndis/kern_ndis.c
parentb53d0a6c803e7602549b842ef5a0491dfb45d5a1 (diff)
downloadFreeBSD-src-c104267c1a97cafb9b2e7707382601a452ced831.zip
FreeBSD-src-c104267c1a97cafb9b2e7707382601a452ced831.tar.gz
Tests with my dual Opteron system have shown that it's possible
for code to start out on one CPU when thunking into Windows mode in ctxsw_utow(), and then be pre-empted and migrated to another CPU before thunking back to UNIX mode in ctxsw_wtou(). This is bad, because then we can end up looking at the wrong 'thread environment block' when trying to come back to UNIX mode. To avoid this, we now pin ourselves to the current CPU when thunking into Windows code. Few other cleanups, since I'm here: - Get rid of the ndis_isr(), ndis_enable_interrupt() and ndis_disable_interrupt() wrappers from kern_ndis.c and just invoke the miniport's methods directly in the interrupt handling routines in subr_ndis.c. We may as well lose the function call overhead, since we don't need to export these things outside of ndis.ko now anyway. - Remove call to ndis_enable_interrupt() from ndis_init() in if_ndis.c. We don't need to do it there anyway (the miniport init routine handles it, if needed). - Fix the logic in NdisWriteErrorLogEntry() a little. - Change some NDIS_STATUS_xxx codes in subr_ntoskrnl.c into STATUS_xxx codes. - Handle kthread_create() failure correctly in PsCreateSystemThread().
Diffstat (limited to 'sys/compat/ndis/kern_ndis.c')
-rw-r--r--sys/compat/ndis/kern_ndis.c70
1 files changed, 4 insertions, 66 deletions
diff --git a/sys/compat/ndis/kern_ndis.c b/sys/compat/ndis/kern_ndis.c
index 8baa011..98f49cf 100644
--- a/sys/compat/ndis/kern_ndis.c
+++ b/sys/compat/ndis/kern_ndis.c
@@ -717,7 +717,11 @@ ndis_ptom(m0, p)
for (buf = priv->npp_head; buf != NULL; buf = buf->mdl_next) {
if (buf == priv->npp_head)
+#ifdef MT_HEADER
+ MGETHDR(m, M_DONTWAIT, MT_HEADER);
+#else
MGETHDR(m, M_DONTWAIT, MT_DATA);
+#endif
else
MGET(m, M_DONTWAIT, MT_DATA);
if (m == NULL) {
@@ -1250,72 +1254,6 @@ ndis_init_nic(arg)
return(0);
}
-void
-ndis_enable_intr(arg)
- void *arg;
-{
- struct ndis_softc *sc;
- ndis_handle adapter;
- ndis_enable_interrupts_handler intrenbfunc;
-
- sc = arg;
- adapter = sc->ndis_block->nmb_miniportadapterctx;
- intrenbfunc = sc->ndis_chars->nmc_enable_interrupts_func;
- if (adapter == NULL || intrenbfunc == NULL)
- return;
- MSCALL1(intrenbfunc, adapter);
-
- return;
-}
-
-void
-ndis_disable_intr(arg)
- void *arg;
-{
- struct ndis_softc *sc;
- ndis_handle adapter;
- ndis_disable_interrupts_handler intrdisfunc;
-
- sc = arg;
- adapter = sc->ndis_block->nmb_miniportadapterctx;
- intrdisfunc = sc->ndis_chars->nmc_disable_interrupts_func;
- if (adapter == NULL || intrdisfunc == NULL)
- return;
-
- MSCALL1(intrdisfunc, adapter);
-
- return;
-}
-
-int
-ndis_isr(arg, ourintr, callhandler)
- void *arg;
- int *ourintr;
- int *callhandler;
-{
- struct ndis_softc *sc;
- ndis_handle adapter;
- ndis_isr_handler isrfunc;
- uint8_t accepted, queue;
-
- if (arg == NULL || ourintr == NULL || callhandler == NULL)
- return(EINVAL);
-
- sc = arg;
- adapter = sc->ndis_block->nmb_miniportadapterctx;
- isrfunc = sc->ndis_chars->nmc_isr_func;
-
- if (adapter == NULL || isrfunc == NULL)
- return(ENXIO);
-
- MSCALL3(isrfunc, &accepted, &queue, adapter);
-
- *ourintr = accepted;
- *callhandler = queue;
-
- return(0);
-}
-
static void
ndis_intrsetup(dpc, dobj, ip, sc)
kdpc *dpc;
OpenPOWER on IntegriCloud