PERFORCE change 141357 for review
Andrew Thompson
thompsa at FreeBSD.org
Fri May 9 03:54:11 UTC 2008
http://perforce.freebsd.org/chv.cgi?CH=141357
Change 141357 by thompsa at thompsa_burger on 2008/05/09 03:52:02
Fix some vap handling.
- Only start the vaps if the init routine passed.
- Remove double vap init in NDIS.
Affected files ...
.. //depot/projects/vap/sys/compat/ndis/kern_ndis.c#7 edit
.. //depot/projects/vap/sys/compat/ndis/ntoskrnl_var.h#7 edit
.. //depot/projects/vap/sys/compat/ndis/subr_ndis.c#7 edit
.. //depot/projects/vap/sys/compat/ndis/subr_ntoskrnl.c#7 edit
.. //depot/projects/vap/sys/dev/bwi/if_bwi.c#21 edit
.. //depot/projects/vap/sys/dev/if_ndis/if_ndis.c#22 edit
.. //depot/projects/vap/sys/dev/ipw/if_ipw.c#19 edit
.. //depot/projects/vap/sys/dev/ral/rt2560.c#35 edit
.. //depot/projects/vap/sys/dev/ral/rt2661.c#33 edit
.. //depot/projects/vap/sys/dev/wi/if_wi.c#32 edit
Differences ...
==== //depot/projects/vap/sys/compat/ndis/kern_ndis.c#7 (text+ko) ====
@@ -101,6 +101,11 @@
static struct nd_head ndis_devhead;
+#ifdef NDIS_DEBUG
+int ndis_debug = 0;
+SYSCTL_INT(_debug, OID_AUTO, ndis, CTLFLAG_RW, &ndis_debug, 0,
+ "ndis debug level");
+#endif
/*
* This allows us to export our symbols to other modules.
* Note that we call ourselves 'ndisapi' to avoid a namespace
==== //depot/projects/vap/sys/compat/ndis/ntoskrnl_var.h#7 (text+ko) ====
@@ -35,6 +35,22 @@
#ifndef _NTOSKRNL_VAR_H_
#define _NTOSKRNL_VAR_H_
+#define NDIS_DEBUG
+#ifdef NDIS_DEBUG
+#define DPRINTF(fmt, args...) \
+ do { if (ndis_debug > 0) printf("NDIS: " fmt, ##args); } while (0)
+#define DPRINTFN(n, fmt, args...) \
+ do { if (ndis_debug >= (n)) printf("NDIS: " fmt, ##args); } while (0)
+#define NDISTRACE(fmt, args...) \
+ if (ndis_debug >= 10) \
+ printf("NDIS: %s(" fmt ")\n", __func__, ##args);
+extern int ndis_debug;
+#else
+#define DPRINTF(x)
+#define DPRINTFN(x)
+#define NDISTRACE(x)
+#endif
+
#define MTX_NTOSKRNL_SPIN_LOCK "NDIS thread lock"
/*
==== //depot/projects/vap/sys/compat/ndis/subr_ndis.c#7 (text+ko) ====
@@ -362,6 +362,8 @@
void *path;
void *unused;
{
+ NDISTRACE("%p, %p, %p, %p", wrapper, drv, path, unused);
+
/*
* As of yet, I haven't come up with a compelling
* reason to define a private NDIS wrapper structure,
@@ -392,6 +394,8 @@
ndis_handle handle;
void *syspec;
{
+ NDISTRACE("%p, %p", handle, syspec);
+
/* Nothing to see here, move along. */
return;
}
@@ -402,6 +406,8 @@
ndis_miniport_characteristics *characteristics;
int len;
{
+ NDISTRACE("%p, %p, %u", handle, characteristics, len);
+
ndis_miniport_characteristics *ch = NULL;
driver_object *drv;
@@ -513,6 +519,8 @@
ndis_handle *cfg;
ndis_handle wrapctx;
{
+ NDISTRACE("%p, %p, %p", status, cfg, wrapctx);
+
*cfg = wrapctx;
*status = NDIS_STATUS_SUCCESS;
@@ -810,6 +818,8 @@
NdisAllocateSpinLock(lock)
ndis_spin_lock *lock;
{
+ NDISTRACE("%p", lock);
+
KeInitializeSpinLock(&lock->nsl_spinlock);
lock->nsl_kirql = 0;
@@ -828,6 +838,8 @@
NdisFreeSpinLock(lock)
ndis_spin_lock *lock;
{
+ NDISTRACE("%p", lock);
+
#ifdef notdef
KeInitializeSpinLock(&lock->nsl_spinlock);
lock->nsl_kirql = 0;
@@ -932,6 +944,8 @@
char *dest;
device_t dev;
+ NDISTRACE("%p, %u, %u, %p, %u", adapter, slot, offset, buf, len);
+
block = (ndis_miniport_block *)adapter;
dest = buf;
if (block == NULL)
@@ -970,6 +984,8 @@
void *buf;
uint32_t len;
{
+ NDISTRACE("%p, %u, %u, %p, %u", adapter, slot, offset, buf, len);
+
ndis_miniport_block *block;
int i;
char *dest;
==== //depot/projects/vap/sys/compat/ndis/subr_ntoskrnl.c#7 (text+ko) ====
@@ -657,6 +657,8 @@
{
void *buf;
+ NDISTRACE("%u, %zu, %u", pooltype, len, tag);
+
buf = malloc(len, M_DEVBUF, M_NOWAIT|M_ZERO);
if (buf == NULL)
return(NULL);
@@ -668,6 +670,8 @@
ExFreePool(buf)
void *buf;
{
+ NDISTRACE("%p", buf);
+
free(buf, M_DEVBUF);
return;
}
@@ -681,6 +685,8 @@
{
custom_extension *ce;
+ NDISTRACE("%p, %p, %u, %p", drv, clid, extlen, ext);
+
ce = ExAllocatePoolWithTag(NonPagedPool, sizeof(custom_extension)
+ extlen, 0);
@@ -703,6 +709,8 @@
list_entry *e;
custom_extension *ce;
+ NDISTRACE("%p, %p", drv, clid);
+
/*
* Sanity check. Our dummy bus drivers don't have
* any driver extentions.
@@ -735,6 +743,9 @@
{
device_object *dev;
+ NDISTRACE("%p, %u, str, %u, %u, %u, %p", drv, devextlen, devtype,
+ devchars, exclusive, newdev);
+
dev = ExAllocatePoolWithTag(NonPagedPool, sizeof(device_object), 0);
if (dev == NULL)
return(STATUS_INSUFFICIENT_RESOURCES);
@@ -815,6 +826,8 @@
{
device_object *prev;
+ NDISTRACE("%p", dev);
+
if (dev == NULL)
return;
@@ -846,6 +859,8 @@
{
device_object *d;
+ NDISTRACE("%p", dev);
+
if (dev == NULL)
return (NULL);
@@ -869,6 +884,9 @@
{
irp *ip;
+ NDISTRACE("%u, %p, %p, %u, %p, %p, %p", func, dobj, buf, len, off,
+ event, status);
+
ip = IoBuildAsynchronousFsdRequest(func, dobj, buf, len, off, status);
if (ip == NULL)
return(NULL);
@@ -889,6 +907,8 @@
irp *ip;
io_stack_location *sl;
+ NDISTRACE("%u, %p, %p, %u, %p, %p", func, dobj, buf, len, off, status);
+
ip = IoAllocateIrp(dobj->do_stacksize, TRUE);
if (ip == NULL)
return(NULL);
@@ -965,6 +985,9 @@
io_stack_location *sl;
uint32_t buflen;
+ NDISTRACE("%u, %p, %p, %u, %p, %u, %u, %p, %p", iocode, dobj, ibuf,
+ ilen, obuf, olen, isinternal, event, status);
+
ip = IoAllocateIrp(dobj->do_stacksize, TRUE);
if (ip == NULL)
return(NULL);
@@ -1051,6 +1074,8 @@
{
irp *i;
+ NDISTRACE("%u, %u", stsize, chargequota);
+
i = ExAllocatePoolWithTag(NonPagedPool, IoSizeOfIrp(stsize), 0);
if (i == NULL)
return (NULL);
@@ -1067,6 +1092,8 @@
{
irp *associrp;
+ NDISTRACE("%p, %u", ip, stsize);
+
associrp = IoAllocateIrp(stsize, FALSE);
if (associrp == NULL)
return(NULL);
@@ -1085,6 +1112,8 @@
IoFreeIrp(ip)
irp *ip;
{
+ NDISTRACE("%p", ip);
+
ExFreePool(ip);
return;
}
@@ -1095,6 +1124,8 @@
uint16_t psize;
uint8_t ssize;
{
+ NDISTRACE("%p, %u, %u", io, psize, ssize);
+
bzero((char *)io, IoSizeOfIrp(ssize));
io->irp_size = psize;
io->irp_stackcnt = ssize;
@@ -1113,6 +1144,8 @@
{
uint8_t allocflags;
+ NDISTRACE("%p, %u", ip, status);
+
allocflags = ip->irp_allocflags;
IoInitializeIrp(ip, ip->irp_size, ip->irp_stackcnt);
ip->irp_iostat.isb_status = status;
@@ -1142,6 +1175,8 @@
{
cancel_func cfunc;
+ NDISTRACE("%p", ip);
+
IoAcquireCancelSpinLock(&ip->irp_cancelirql);
cfunc = IoSetCancelRoutine(ip, NULL);
ip->irp_cancel = TRUE;
@@ -1163,6 +1198,8 @@
uint32_t status;
driver_dispatch disp;
+ NDISTRACE("%p, %p", dobj, ip);
+
drvobj = dobj->do_drvobj;
if (ip->irp_currentstackloc <= 0)
@@ -1190,6 +1227,8 @@
io_stack_location *sl;
completion_func cf;
+ NDISTRACE("%p, %u", ip, prioboost);
+
ip->irp_pendingreturned =
IoGetCurrentIrpStackLocation(ip)->isl_ctl & SL_PENDING_RETURNED;
sl = (io_stack_location *)(ip + 1);
@@ -1346,6 +1385,10 @@
{
uint8_t curirql;
+ NDISTRACE("%p, %p, %p, %p, %u, %u, %u, %u, %u, %u, %u", iobj, svcfunc,
+ svcctx, lock, vector, irql, syncirql, imode, shared, affinity,
+ savefloat);
+
*iobj = ExAllocatePoolWithTag(NonPagedPool, sizeof(kinterrupt), 0);
if (*iobj == NULL)
return(STATUS_INSUFFICIENT_RESOURCES);
@@ -1372,6 +1415,8 @@
{
uint8_t irql;
+ NDISTRACE("%p", iobj);
+
if (iobj == NULL)
return;
@@ -1391,6 +1436,8 @@
{
device_object *attached;
+ NDISTRACE("%p, %p", src, dst);
+
mtx_lock(&ntoskrnl_dispatchlock);
attached = IoGetAttachedDevice(dst);
attached->do_attacheddev = src;
@@ -1407,6 +1454,8 @@
{
device_object *tail;
+ NDISTRACE("%p", topdev);
+
mtx_lock(&ntoskrnl_dispatchlock);
/* First, break the chain. */
@@ -2205,6 +2254,9 @@
uint32_t tag;
uint16_t depth;
{
+ NDISTRACE("%p, %p, %p, %u, %zu, %u, %u", lookaside, allocfunc,
+ freefunc, flags, size, tag, depth);
+
bzero((char *)lookaside, sizeof(paged_lookaside_list));
if (size < sizeof(slist_entry))
@@ -2242,6 +2294,8 @@
void *buf;
void (*freefunc)(void *);
+ NDISTRACE("%p", lookaside);
+
freefunc = lookaside->nll_l.gl_freefunc;
while((buf = ntoskrnl_popsl(&lookaside->nll_l.gl_listhead)) != NULL)
MSCALL1(freefunc, buf);
@@ -2260,6 +2314,9 @@
uint32_t tag;
uint16_t depth;
{
+ NDISTRACE("%p, %p, %p, %u, %zu, %u, %u", lookaside, allocfunc,
+ freefunc, flags, size, tag, depth);
+
bzero((char *)lookaside, sizeof(npaged_lookaside_list));
if (size < sizeof(slist_entry))
@@ -2297,6 +2354,8 @@
void *buf;
void (*freefunc)(void *);
+ NDISTRACE("%p", lookaside);
+
freefunc = lookaside->nll_l.gl_freefunc;
while((buf = ntoskrnl_popsl(&lookaside->nll_l.gl_listhead)) != NULL)
MSCALL1(freefunc, buf);
@@ -2486,6 +2545,9 @@
mdl *m;
int zone = 0;
+ NDISTRACE("%p, %u, %u, %u, %p", vaddr, len, secondarybuf, chargequota,
+ iopkt);
+
if (MmSizeOfMdl(vaddr, len) > MDL_ZONE_SIZE)
m = ExAllocatePoolWithTag(NonPagedPool,
MmSizeOfMdl(vaddr, len), 0);
@@ -2529,6 +2591,8 @@
IoFreeMdl(m)
mdl *m;
{
+ NDISTRACE("%p", m);
+
if (m == NULL)
return;
@@ -2548,6 +2612,8 @@
void *addr;
size_t pagelength = roundup(size, PAGE_SIZE);
+ NDISTRACE("%u, %ju", size, highest);
+
addr = ExAllocatePoolWithTag(NonPagedPool, pagelength, 0);
return(addr);
@@ -2565,6 +2631,9 @@
void *addr;
size_t pagelength = roundup(size, PAGE_SIZE);
+ NDISTRACE("%u, %ju, %ju, %ju, %u", size, lowest, highest, boundary,
+ cachetype);
+
addr = ExAllocatePoolWithTag(NonPagedPool, pagelength, 0);
return(addr);
@@ -2574,6 +2643,8 @@
MmFreeContiguousMemory(base)
void *base;
{
+ NDISTRACE("%p", base);
+
ExFreePool(base);
}
@@ -2583,6 +2654,8 @@
uint32_t size;
uint32_t cachetype;
{
+ NDISTRACE("%p", base);
+
ExFreePool(base);
}
@@ -2613,6 +2686,8 @@
vm_offset_t *mdl_pages;
int pagecnt, i;
+ NDISTRACE("%p", m);
+
pagecnt = SPAN_PAGES(m->mdl_byteoffset, m->mdl_bytecount);
if (pagecnt > (m->mdl_size - sizeof(mdl)) / sizeof(vm_offset_t *))
@@ -2874,6 +2949,8 @@
{
io_workitem *iw;
+ NDISTRACE("%p", dobj);
+
iw = uma_zalloc(iw_zone, M_NOWAIT);
if (iw == NULL)
return(NULL);
@@ -2893,6 +2970,8 @@
IoFreeWorkItem(iw)
io_workitem *iw;
{
+ NDISTRACE("%p", iw);
+
uma_zfree(iw_zone, iw);
return;
}
@@ -2909,6 +2988,8 @@
io_workitem *cur;
uint8_t irql;
+ NDISTRACE("%p, %p, %u, %p", iw, iw_func, qtype, ctx);
+
kq = wq_queues + iw->iw_idx;
KeAcquireSpinLock(&kq->kq_lock, &irql);
@@ -2996,6 +3077,7 @@
io_workitem *cur;
uint8_t irql;
+ NDISTRACE("%p, %u", w, qtype);
/*
* We need to do a special sanity test to make sure
@@ -3244,6 +3326,8 @@
driver_object *drv;
uint16_t **name;
+ NDISTRACE("%p, %u, %u, %p, %p", devobj, regprop, buflen, prop, reslen);
+
drv = devobj->do_drvobj;
switch (regprop) {
@@ -3265,6 +3349,8 @@
kmutant *kmutex;
uint32_t level;
{
+ NDISTRACE("%p, %u", kmutex, level);
+
InitializeListHead((&kmutex->km_header.dh_waitlisthead));
kmutex->km_abandoned = FALSE;
kmutex->km_apcdisable = 1;
@@ -3315,6 +3401,8 @@
uint32_t type;
uint8_t state;
{
+ NDISTRACE("%p, %u, %u", kevent, type, state);
+
InitializeListHead((&kevent->k_header.dh_waitlisthead));
kevent->k_header.dh_sigstate = state;
if (type == EVENT_TYPE_NOTIFY)
@@ -3331,6 +3419,8 @@
{
uint32_t prevstate;
+ NDISTRACE("%p", kevent);
+
mtx_lock(&ntoskrnl_dispatchlock);
prevstate = kevent->k_header.dh_sigstate;
kevent->k_header.dh_sigstate = FALSE;
@@ -3351,6 +3441,8 @@
struct thread *td;
wb_ext *we;
+ NDISTRACE("%p, %u, %u", kevent, increment, kwait);
+
mtx_lock(&ntoskrnl_dispatchlock);
prevstate = kevent->k_header.dh_sigstate;
dh = &kevent->k_header;
@@ -3398,6 +3490,8 @@
KeClearEvent(kevent)
nt_kevent *kevent;
{
+ NDISTRACE("%p", kevent);
+
kevent->k_header.dh_sigstate = FALSE;
return;
}
@@ -3455,6 +3549,9 @@
{
nt_objref *nr;
+ NDISTRACE("%p, %u, %p, %u, %p, %p", handle, reqaccess, otype,
+ accessmode, object, handleinfo);
+
nr = malloc(sizeof(nt_objref), M_DEVBUF, M_NOWAIT|M_ZERO);
if (nr == NULL)
return(STATUS_INSUFFICIENT_RESOURCES);
@@ -3477,6 +3574,8 @@
{
nt_objref *nr;
+ NDISTRACE("%p", object);
+
nr = object;
TAILQ_REMOVE(&ntoskrnl_reflist, nr, link);
free(nr, M_DEVBUF);
@@ -3557,6 +3656,9 @@
thread_context *tc;
struct proc *p;
+ NDISTRACE("%p, %u, %p, %p, %p, %p, %p", handle, reqaccess, objattrs,
+ phandle, clientid, thrfunc, thrctx);
+
tc = malloc(sizeof(thread_context), M_TEMP, M_NOWAIT);
if (tc == NULL)
return(STATUS_INSUFFICIENT_RESOURCES);
@@ -3593,6 +3695,8 @@
{
struct nt_objref *nr;
+ NDISTRACE("");
+
mtx_lock(&ntoskrnl_dispatchlock);
TAILQ_FOREACH(nr, &ntoskrnl_reflist, link) {
if (nr->no_obj != curthread->td_proc)
@@ -3617,7 +3721,7 @@
{
va_list ap;
- if (bootverbose) {
+ if (bootverbose || ndis_debug) {
va_start(ap, fmt);
vprintf(fmt, ap);
}
@@ -3824,6 +3928,8 @@
ktimer *timer;
uint32_t type;
{
+ NDISTRACE("%p, %u", timer, type);
+
if (timer == NULL)
return;
@@ -3988,6 +4094,7 @@
void *dpcfunc;
void *dpcctx;
{
+ NDISTRACE("%p, %p, %p", dpc, dpcfunc, dpcctx);
if (dpc == NULL)
return;
@@ -4011,6 +4118,8 @@
uint8_t r;
uint8_t irql;
+ NDISTRACE("%p, %p, %p", dpc, sysarg1, sysarg2);
+
if (dpc == NULL)
return(FALSE);
@@ -4055,6 +4164,8 @@
kdpc_queue *kq;
uint8_t irql;
+ NDISTRACE("%p", dpc);
+
if (dpc == NULL)
return(FALSE);
@@ -4088,6 +4199,8 @@
kdpc *dpc;
uint32_t imp;
{
+ NDISTRACE("%p, %u", dpc, imp);
+
if (imp != KDPC_IMPORTANCE_LOW &&
imp != KDPC_IMPORTANCE_MEDIUM &&
imp != KDPC_IMPORTANCE_HIGH)
@@ -4102,6 +4215,8 @@
kdpc *dpc;
uint8_t cpu;
{
+ NDISTRACE("%p, %u", dpc, cpu);
+
if (cpu > mp_ncpus)
return;
@@ -4115,6 +4230,8 @@
kdpc_queue *kq;
int i;
+ NDISTRACE("");
+
/*
* Poke each DPC queue and wait
* for them to drain.
@@ -4150,6 +4267,8 @@
uint64_t curtime;
uint8_t pending;
+ NDISTRACE("%p, %ju, %u, %p", timer, duetime, period, dpc);
+
if (timer == NULL)
return(FALSE);
@@ -4217,9 +4336,14 @@
{
uint8_t pending;
+ NDISTRACE("%p", timer);
+
if (timer == NULL)
return(FALSE);
+ if (timer->k_dpc)
+ printf("NDIS: KeCancelTimer with pending DPC\n");
+
mtx_lock(&ntoskrnl_dispatchlock);
pending = timer->k_header.dh_inserted;
@@ -4241,6 +4365,8 @@
KeReadStateTimer(timer)
ktimer *timer;
{
+ NDISTRACE("%p", timer);
+
return(timer->k_header.dh_sigstate);
}
==== //depot/projects/vap/sys/dev/bwi/if_bwi.c#21 (text+ko) ====
@@ -1222,10 +1222,15 @@
bwi_init(void *xsc)
{
struct bwi_softc *sc = xsc;
+ struct ifnet *ifp = sc->sc_ifp;
+ struct ieee80211com *ic = ifp->if_l2com;
BWI_LOCK(sc);
bwi_init_statechg(sc, 1);
BWI_UNLOCK(sc);
+
+ if (ifp->if_drv_flags & IFF_DRV_RUNNING)
+ ieee80211_start_all(ic); /* start all vap's */
}
static void
==== //depot/projects/vap/sys/dev/if_ndis/if_ndis.c#22 (text+ko) ====
@@ -1979,8 +1979,6 @@
ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
NDIS_UNLOCK(sc);
-
- /* XXX force handling */
ieee80211_start_all(ic); /* start all vap's */
/*
@@ -2813,10 +2811,8 @@
case SIOCSIFFLAGS:
/*NDIS_LOCK(sc);*/
if (ifp->if_flags & IFF_UP) {
- if (!(ifp->if_drv_flags & IFF_DRV_RUNNING)) {
+ if (!(ifp->if_drv_flags & IFF_DRV_RUNNING))
ndis_init(sc);
- ieee80211_start_all(ic);
- }
} else {
if (ifp->if_drv_flags & IFF_DRV_RUNNING)
ndis_stop(sc);
==== //depot/projects/vap/sys/dev/ipw/if_ipw.c#19 (text+ko) ====
@@ -2406,7 +2406,8 @@
ipw_init_locked(sc);
IPW_UNLOCK(sc);
- ieee80211_start_all(ic);
+ if (ifp->if_drv_flags & IFF_DRV_RUNNING)
+ ieee80211_start_all(ic);
}
static void
==== //depot/projects/vap/sys/dev/ral/rt2560.c#35 (text) ====
@@ -2751,7 +2751,8 @@
rt2560_init_locked(sc);
RAL_UNLOCK(sc);
- ieee80211_start_all(ic);
+ if (ifp->if_drv_flags & IFF_DRV_RUNNING)
+ ieee80211_start_all(ic); /* start all vap's */
}
static void
==== //depot/projects/vap/sys/dev/ral/rt2661.c#33 (text) ====
@@ -2496,7 +2496,8 @@
rt2661_init_locked(sc);
RAL_UNLOCK(sc);
- ieee80211_start_all(ic);
+ if (ifp->if_drv_flags & IFF_DRV_RUNNING)
+ ieee80211_start_all(ic); /* start all vap's */
}
void
==== //depot/projects/vap/sys/dev/wi/if_wi.c#32 (text+ko) ====
@@ -704,7 +704,8 @@
wi_init_locked(sc);
WI_UNLOCK(sc);
- ieee80211_start_all(ic);
+ if (ifp->if_drv_flags & IFF_DRV_RUNNING)
+ ieee80211_start_all(ic); /* start all vap's */
}
static void
More information about the p4-projects
mailing list