From ed4c4d169e660b4253a11c7915cd7a01c4b11398 Mon Sep 17 00:00:00 2001 From: cokane Date: Thu, 17 Apr 2008 22:01:38 +0000 Subject: [PATCH] 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 --- sys/dev/if_ndis/if_ndis.c | 15 ++++++--------- sys/dev/if_ndis/if_ndisvar.h | 2 +- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/sys/dev/if_ndis/if_ndis.c b/sys/dev/if_ndis/if_ndis.c index 9a9efa7580b8..9658ee723901 100644 --- a/sys/dev/if_ndis/if_ndis.c +++ b/sys/dev/if_ndis/if_ndis.c @@ -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; diff --git a/sys/dev/if_ndis/if_ndisvar.h b/sys/dev/if_ndis/if_ndisvar.h index 578d04f74278..cdbf543ec052 100644 --- a/sys/dev/if_ndis/if_ndisvar.h +++ b/sys/dev/if_ndis/if_ndisvar.h @@ -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;