NdisMDeregisterInterrupt fails during halt

Hi

I am developing windows pv network driver now. It is OK when i
uninstall/disable the network card from device manager.
NdisMDeregisterInterrupt works properly.
But when i have a NDISTest6.5 (MPE) test, the test case will halt
network card. Problem happens during this process,
NdisMDeregisterInterrupt will hang during halting.
It seems that there are not much packets sending/receiving, but i do not
know what causes this function hanging?
Any help is appreciated.

Thanks
Annie.

> Hi

I am developing windows pv network driver now. It is OK when i
uninstall/disable the network card from device manager.
NdisMDeregisterInterrupt works properly.
But when i have a NDISTest6.5 (MPE) test, the test case will halt
network card. Problem happens during this process,
NdisMDeregisterInterrupt will hang during halting.
It seems that there are not much packets sending/receiving, but i do
not
know what causes this function hanging?
Any help is appreciated.

Just to confirm, you are using NdisMDeregisterInterrupt in the Halt
handler and not the Shutdown handler right?

(probably a stupid question, but I did that in my earlier drivers, and
Shutdown gets called at DIRQL and you can’t use NdisMDeregisterInterrupt
there)

James

> Just to confirm, you are using NdisMDeregisterInterrupt in the Halt

handler and not the Shutdown handler right?

I use it in Halt not Shutdown handler.
Removing device is ok from device manager, but problem exists in
NDISTest 6.5(MPE) test. Do not know what cause this problem during MPE
test.

Thanks
Annie.

Hi

Have you checked the following, especially ensure that no interrupts are
enabled while calling the de-register?
NdisMDeregisterInterrupt releases the association between the initialized
interrupt object at Interrupt and the caller’s MiniportISR function. After
NdisMDeregisterInterrupt returns, NDIS will not call the miniport driver’s
MiniportISR function or MiniportHandleInterrupt function.

A miniport driver can call NdisMDeregisterInterrupt from its
MiniportInitialize or MiniportHalt function only if MiniportInitialize
previously made a successful call to NdisMRegisterInterrupt.

The miniport driver should disable its NIC from generating interrupts before
it calls NdisMDeregisterInterrupt. After NdisMDeregisterInterrupt returns
control, the miniport driver cannot call NdisMSynchronizeWithInterrupt.

Callers of NdisMDeregisterInterrupt must run at IRQL = PASSIVE_LEVEL

Hope this helps

Steve

----- Original Message -----

From: “ANNIE LI”
To: “Windows System Software Devs Interest List”
Sent: Monday, March 02, 2009 11:25 AM
Subject: Re: [ntdev] NdisMDeregisterInterrupt fails during halt

>
>> Just to confirm, you are using NdisMDeregisterInterrupt in the Halt
>> handler and not the Shutdown handler right?
>>
> I use it in Halt not Shutdown handler.
> Removing device is ok from device manager, but problem exists in NDISTest
> 6.5(MPE) test. Do not know what cause this problem during MPE test.
>
> Thanks
> Annie.
>
> —
> NTDEV is sponsored by OSR
>
> For our schedule of WDF, WDM, debugging and other seminars visit:
> http://www.osr.com/seminars
>
> To unsubscribe, visit the List Server section of OSR Online at
> http://www.osronline.com/page.cfm?name=ListServer
>
>

Hi Annie,

We observed a similar problem some time ago when running on XP 64-bit. From various bits of debugging, we deduced that NdisMRegisterInterrupt() was not initializing the NDIS_MINIPORT_INTERRUPT structure properly if it was not cleared out first. This seemed to show up later on as a hang inside NdisMDeregisterInterrupt(). If we simply zero’d out the NDIS_MINIPORT_INTERRUPT structure prior to calling NdisMRegisterInterrupt() the problem went away. If I recall correctly, looking at the NDIS miniport example available at the time it appeared that the driver context area where that structure was stored was always cleared upon allocation, which would mask the issue.

Its possible you may have a completely different issue, but the above problem caused a lot of head-scratching and I’d be interested to find out if its the same issue we saw.

Eric

Thanks.

I zero the memory of NDIS_MINIPORT_INTERRUPT structure before calling
NdisMRegisterInterrupt(), still hit this problem. :frowning:
It seems that spin lock in my DPC will cause this problem. If i hold
spin lock for a longer time, this problem will happen. In this DPC, i do
some splitting packets and checksum work. But i do not know how to
decrease this period of holding spin lock. If i simply decrease the
packets number i process in this DPC, the performance will be poor. But
if processing more packets, this problem will happen.

Any suggestions?

Thanks
Annie.