Change the timeout(9) usage in if_ndis to a callout(9) implementation,

as the former is becoming deprecated and exhibits some extraneous
Giant-locking. The new callout(9) is declared MPSAFE, so it may
improve concurrency.

Tested by:	matteo
Silence from:	wpaul
MFC after:	1 month
This commit is contained in:
cokane 2008-04-17 22:01:38 +00:00
parent ca47fccd6b
commit ed4c4d169e
2 changed files with 7 additions and 10 deletions

View File

@ -1582,17 +1582,13 @@ ndis_tick(xsc)
{
struct ndis_softc *sc;
mtx_unlock(&Giant);
sc = xsc;
IoQueueWorkItem(sc->ndis_tickitem,
(io_workitem_func)ndis_ticktask_wrap,
WORKQUEUE_CRITICAL, sc);
sc->ndis_stat_ch = timeout(ndis_tick, sc, hz *
sc->ndis_block->nmb_checkforhangsecs);
mtx_lock(&Giant);
callout_reset(&sc->ndis_stat_callout,
hz * sc->ndis_block->nmb_checkforhangsecs, ndis_tick, sc);
return;
}
@ -1939,8 +1935,9 @@ ndis_init(xsc)
if (sc->ndis_block->nmb_checkforhangsecs == 0)
sc->ndis_block->nmb_checkforhangsecs = 3;
sc->ndis_stat_ch = timeout(ndis_tick, sc,
hz * sc->ndis_block->nmb_checkforhangsecs);
callout_init(&sc->ndis_stat_callout, 1);
callout_reset(&sc->ndis_stat_callout,
hz * sc->ndis_block->nmb_checkforhangsecs, ndis_tick, sc);
return;
}
@ -3153,7 +3150,7 @@ ndis_stop(sc)
ieee80211_new_state(ic, IEEE80211_S_INIT, -1);
ifp = sc->ifp;
untimeout(ndis_tick, sc, sc->ndis_stat_ch);
callout_drain(&sc->ndis_stat_callout);
NDIS_LOCK(sc);
ifp->if_timer = 0;

View File

@ -129,7 +129,7 @@ struct ndis_softc {
ndis_miniport_block *ndis_block;
ndis_miniport_characteristics *ndis_chars;
interface_type ndis_type;
struct callout_handle ndis_stat_ch;
struct callout ndis_stat_callout;
int ndis_maxpkts;
ndis_oid *ndis_oids;
int ndis_oidcnt;