Syncronization Problem

Hi,

What is the operation of NdisAcquireReadWriteLock/NdisAcquireSpinLock
functions if they are called at DISPATCH_LEVEL(e.g in a Timer function) on a
single processor machine?

I have the following problem. I have an NDIS driver which reads TCP/IP
packets and updates statistics about the traffic. Statistics data are shared
and modified by both Receive handler of the protocol driver and a Timer
function which periodically updates it.

I have used NDIS_RW_LOCK to protect data. But it seems it is not working to
syncronize concurrent updates.

Can anybody show me a proper method valid for both Single/Multi processor
architectures?

Regards,

Egemen Tas

http://www.modemwall.com

Egemen Tas wrote:

What is the operation of NdisAcquireReadWriteLock/NdisAcquireSpinLock
functions if they are called at DISPATCH_LEVEL(e.g in a Timer function) on a
single processor machine?

NdisAcquireSpinLock is a front-end for KeAcquireSpinLock. On a single
processor machine, KeAcquireSpinLock simply raises to IRQL
DISPATCH_LEVEL. This is sufficient to cause serialization.

If the system is already at IRQL DISPATCH_LEVEL, then (needless to say)
KeAcquireSpinLock doesn’t change the IRQL.

I don’t know what NdisAcquireReadWriteLock does, but I’m sure one of the
members here who’s more current on NDIS than I can tell you…

Peter
OSR