Hi, I have an Ndis 6.30 IM driver, with 2 miniports bound to my driver’s protocol edge. I am noticing an issue during driver unload, where the MINIPORT_HALT does not get called by NDIS upon calling “NdisIMDeInitializeDeviceInstance(miniportAdapterHandle)” from within my protocol’s PROTOCOL_UNBIND_ADAPTER_EX handler.
This happens most of the times during unload, and looking at the OID and Send counters, I do not see any pending requests.
When I pass traffic, the driver works as expected. My unbind/unload logic is pretty much like whats in the Windows Mux sample driver code.
Basically, NdisIMDeInitializeDeviceInstance() blocks and never returns. I continue to get OIDs once this happens, and my driver is stuck during unload when this happens.
Here is some debugging info I captured when this happened:
0: kd> !ndiskd.miniports
.reload ndis.sys…
Reload succeeded.
MiniDriver Miniport Name
ffffe00002bd6020 ffffe0000390b1a0 Microsoft ISATAP Adapter #2
ffffe00002bd6020 ffffe0000224f1a0 Microsoft ISATAP Adapter #3
ffffe00001ffaa30 ffffe00001e2a1a0 1 - Miniport
ffffe00001ffaa30 ffffe00001e281a0 2 - Miniport
ffffe00002bd6020 ffffe00002da91a0 Microsoft ISATAP Adapter
ffffe00002ffe920 ffffe000016051a0 WAN Miniport (PPPOE)
ffffe00002ff8ba0 ffffe00002ff91a0 WAN Miniport (L2TP)
ffffe00002ebf260 ffffe00002ff51a0 WAN Miniport (Network Monitor)
ffffe00002fee330 ffffe00002ff31a0 WAN Miniport (PPTP)
ffffe00002f3fba0 ffffe00002fde1a0 Intel(R) 82574L Gigabit Network Connection #2
ffffe00002ebf260 ffffe00002fbc1a0 WAN Miniport (IPv6)
ffffe00002ee3ba0 ffffe00002fba1a0 Microsoft Kernel Debug Network Adapter
ffffe00002ed3680 ffffe00002fb71a0 WAN Miniport (IKEv2)
ffffe00002ecfba0 ffffe00002fa01a0 WAN Miniport (SSTP)
ffffe00002ebf260 ffffe00002f9e1a0 WAN Miniport (IP)
========================================================================
0: kd> !ndiskd.miniport ffffe00001e2a1a0
MINIPORT
1 - Miniport
Ndis handle ffffe00001e2a1a0
Ndis API version v6.30
Adapter context ffffe000030003f0
Miniport driver ffffe00001ffaa30 - TIMMP v3.0
Network interface ffffe0000378da20
Media type 802.3
Device instance ROOT\TIMMP\0000
Device object ffffe00001e2a050 !miniport ffffe00001e2a1a0 -device
MAC address 00-0c-29-f8-34-9c
STATE
Miniport Running
Device PnP STOPPED !miniport ffffe00001e2a1a0 -log
Datapath Normal
Interface Up
Media Connected
Power D0
References 9 !miniport ffffe00001e2a1a0 -ref
Total resets 0
Pending OID None
Flags NOT_BUS_MASTER, INTERMEDIATE_DRIVER,
DEFAULT_PORT_ACTIVATED, NOT_RESOURCES_AVAILABLE,
SUPPORTS_MEDIA_SENSE, DOES_NOT_DO_LOOPBACK,
MEDIA_CONNECTED
PnP flags PM_SUPPORTED, DEVICE_POWER_ENABLED, NO_HALT_ON_SUSPEND,
RECEIVED_START, VERIFYING
BINDINGS
Bind operations are in progress .thread /p ffffe00003727080; kM
Protocol list Driver Open Context
TCPIP ffffe000028c6620 ffffe000023dd610 ffffe00003893330
TCPIP6 ffffe000028c7620 ffffe000023de8a0 ffffe000038d0330
(RASPPPOE) ffffe00002ffe510 Declined with NDIS_STATUS_FAILURE
(NDISUIO) Not running
LLTDIO ffffe00002e2b6b0 ffffe000023e5c10 ffffe000023d9af0
RSPNDR ffffe00002e33490 ffffe000023e6c10 ffffe000038c46a0
(RDMANDK) ffffe00002e6fc10 Declined with NDIS_STATUS_NOT_RECOGNIZED
Filter list Driver Module Context
WFP 802.3 MAC Layer LightWeight Filter-0000
ffffe00002984d70 ffffe00003789470 ffffe000023d4210
QoS Packet Scheduler-0000
ffffe00002e71750 ffffe0000308b010 ffffe000033a1180
WFP Native MAC Layer LightWeight Filter-0000
ffffe00002984ad0 ffffe000023da260 ffffe0000307e010
MORE INFORMATION
!minidriver ffffe00001ffaa30 -handlers !miniport ffffe00001e2a1a0 -offloads
!miniport ffffe00001e2a1a0 -pm !miniport ffffe00001e2a1a0 -protocoloffloads
!oid -miniport ffffe00001e2a1a0 !miniport ffffe00001e2a1a0 -timers
!pendingnbls ffffe00001e2a1a0
!miniport ffffe00001e2a1a0 -wol !miniport ffffe00001e2a1a0 -filterdb
!miniport ffffe00001e2a1a0 -rcvqueues !miniport ffffe00001e2a1a0 -rcvfilter
!miniport ffffe00001e2a1a0 -rss !miniport ffffe00001e2a1a0 -nicswitch
!miniport ffffe00001e2a1a0 -hw !miniport ffffe00001e2a1a0 -ss
!miniport ffffe00001e2a1a0 -ports !miniport ffffe00001e2a1a0 -wmi
0: kd> !oid -miniport ffffe00001e2a1a0
ALL PENDING OIDs
[Showing all OIDs on the stack for miniport ffffe00001e2a1a0]
No pending or queued OIDs were found.
0: kd> !pendingnbls ffffe00001e2a1a0
PHASE 1/3: Found 39 NBL pool(s).
A timeout occurred. The timeout can be increased in the Debugging options page
A timeout occurred. The timeout can be increased in the Debugging options page
A timeout occurred. The timeout can be increased in the Debugging options page
A timeout occurred. The timeout can be increased in the Debugging options page
PHASE 2/3: Found 82 freed NBL(s).
Pending Nbl Currently held by
A timeout occurred. The timeout can be increased in the Debugging options page
A timeout occurred. The timeout can be increased in the Debugging options page
A timeout occurred. The timeout can be increased in the Debugging options page
No pending NBLs were found.
PHASE 3/3: Found 0 pending NBL(s) of 2130 total NBL(s).
Search complete.
0: kd> !oid -miniport ffffe00001e2a1a0
ALL PENDING OIDs
[Showing all OIDs on the stack for miniport ffffe00001e2a1a0]
0: kd> !ndiskd.mopen ffffe00001e2a1a0
OPEN
Ndis handle ffffe00001e2a1a0
Flags [Unrecognized flags 00a02280] OPEN_CLOSING,
OPEN_CALL_MANAGER, NO_BIND_REQUEST, USE_MULTICAST_LIST
References ffffe000 !mopen ffffe00001e2a1a0 -ref
Source Cannot load field ‘m_bindSources’ in ‘class Ndis::BindState’
Datapath state [Unreadable value]
Pause reason [Unreadable value]
Unbind reason [Unreadable value]
Protocol ffffe000030003f0 - [Zero-length string]
Protocol context 00001e06
Miniport ffffe00001e2a1a0 - 1 - Miniport
Miniport context ffffe000023e6c10
RECEIVE PATH
Packet filter [Unrecognized flags 00700800] ALL_MULTICAST, ALL_LOCAL
Frame Type(s) [This protocol has not registered any frame types]
Only showing the first 256 of 7324844 multicast addresses
Multicast address list 08-57-48-83-ec-20 !miniport ffffe00001e2a1a0 -filterdb
39-03-00-04-72-14
00-b9-1a-00-00-00
—> Has a bunch of more MAC entries
===============================================================================================
No pending or queued OIDs were found.
0: kd> !ndiskd.miniports
MiniDriver Miniport Name
ffffe00002bd6020 ffffe0000390b1a0 Microsoft ISATAP Adapter #2
ffffe00002bd6020 ffffe0000224f1a0 Microsoft ISATAP Adapter #3
ffffe00001ffaa30 ffffe00001e2a1a0 1 - Miniport
ffffe00001ffaa30 ffffe00001e281a0 2 - Miniport
ffffe00002bd6020 ffffe00002da91a0 Microsoft ISATAP Adapter
ffffe00002ffe920 ffffe000016051a0 WAN Miniport (PPPOE)
ffffe00002ff8ba0 ffffe00002ff91a0 WAN Miniport (L2TP)
ffffe00002ebf260 ffffe00002ff51a0 WAN Miniport (Network Monitor)
ffffe00002fee330 ffffe00002ff31a0 WAN Miniport (PPTP)
ffffe00002f3fba0 ffffe00002fde1a0 Intel(R) 82574L Gigabit Network Connection #2
ffffe00002ebf260 ffffe00002fbc1a0 WAN Miniport (IPv6)
ffffe00002ee3ba0 ffffe00002fba1a0 Microsoft Kernel Debug Network Adapter
ffffe00002ed3680 ffffe00002fb71a0 WAN Miniport (IKEv2)
ffffe00002ecfba0 ffffe00002fa01a0 WAN Miniport (SSTP)
ffffe00002ebf260 ffffe00002f9e1a0 WAN Miniport (IP)
==================================================================================================
0: kd> !ndiskd.miniport ffffe00001e281a0
MINIPORT
2 - Miniport
Ndis handle ffffe00001e281a0
Ndis API version v6.30
Adapter context ffffe00002dfb3f0
Miniport driver ffffe00001ffaa30 - TIMMP v3.0
Network interface ffffe000037902c0
Media type 802.3
Device instance ROOT\TIMMP\0001
Device object ffffe00001e28050 !miniport ffffe00001e281a0 -device
MAC address 00-0c-29-f8-34-9c
STATE
Miniport Running
Device PnP Started !miniport ffffe00001e281a0 -log
Datapath Normal
Interface Up
Media Connected
Power D0
References 8 !miniport ffffe00001e281a0 -ref
Total resets 0
Pending OID None
Flags NOT_BUS_MASTER, INTERMEDIATE_DRIVER,
DEFAULT_PORT_ACTIVATED, NOT_RESOURCES_AVAILABLE,
SUPPORTS_MEDIA_SENSE, DOES_NOT_DO_LOOPBACK,
MEDIA_CONNECTED
PnP flags PM_SUPPORTED, DEVICE_POWER_ENABLED, NO_HALT_ON_SUSPEND,
RECEIVED_START, VERIFYING
BINDINGS
Protocol list Driver Open Context
TCPIP ffffe000028c6620 ffffe000037fc200 ffffe0000383e330
TCPIP6 ffffe000028c7620 ffffe0000307f500 ffffe000023d6330
(RASPPPOE) ffffe00002ffe510 Declined with NDIS_STATUS_FAILURE
(NDISUIO) Not running
LLTDIO ffffe00002e2b6b0 ffffe0000307fc10 ffffe000023e49d0
RSPNDR ffffe00002e33490 ffffe0000307e6b0 ffffe0000224e010
(RDMANDK) ffffe00002e6fc10 Declined with NDIS_STATUS_NOT_RECOGNIZED
Filter list Driver Module Context
WFP 802.3 MAC Layer LightWeight Filter-0000
ffffe00002984d70 ffffe00002e0cc70 ffffe0000300ec20
QoS Packet Scheduler-0000
ffffe00002e71750 ffffe00003003c70 ffffe00002bac180
WFP Native MAC Layer LightWeight Filter-0000
ffffe00002984ad0 ffffe00001bf5680 ffffe00003008c20
MORE INFORMATION
!minidriver ffffe00001ffaa30 -handlers !miniport ffffe00001e281a0 -offloads
!miniport ffffe00001e281a0 -pm !miniport ffffe00001e281a0 -protocoloffloads
!oid -miniport ffffe00001e281a0 !miniport ffffe00001e281a0 -timers
!pendingnbls ffffe00001e281a0
!miniport ffffe00001e281a0 -wol !miniport ffffe00001e281a0 -filterdb
!miniport ffffe00001e281a0 -rcvqueues !miniport ffffe00001e281a0 -rcvfilter
!miniport ffffe00001e281a0 -rss !miniport ffffe00001e281a0 -nicswitch
!miniport ffffe00001e281a0 -hw !miniport ffffe00001e281a0 -ss
!miniport ffffe00001e281a0 -ports !miniport ffffe00001e281a0 -wmi
0: kd> !oid -miniport ffffe00001e281a0
ALL PENDING OIDs
[Showing all OIDs on the stack for miniport ffffe00001e281a0]
No pending or queued OIDs were found.
0: kd> !pendingnbls ffffe00001e281a0
PHASE 1/3: Found 39 NBL pool(s).
PHASE 2/3: Found 82 freed NBL(s).
Pending Nbl Currently held by
No pending NBLs were found.
PHASE 3/3: Found 0 pending NBL(s) of 2130 total NBL(s).
Search complete.
0: kd> !ndiskd.mopen ffffe00001e281a0
OPEN
Ndis handle ffffe00001e281a0
Flags [Unrecognized flags 00a00280] OPEN_CLOSING,
OPEN_CALL_MANAGER, NO_BIND_REQUEST, USE_MULTICAST_LIST
References ffffe000 !mopen ffffe00001e281a0 -ref
Source Cannot load field ‘m_bindSources’ in ‘class Ndis::BindState’
Datapath state [Unreadable value]
Pause reason [Unreadable value]
Unbind reason [Unreadable value]
Protocol ffffe00002dfb3f0 - [Zero-length string]
Protocol context 00001e06
Miniport ffffe00001e281a0 - 2 - Miniport
Miniport context ffffe0000307e6b0
RECEIVE PATH
Packet filter [Unrecognized flags 00700800] ALL_MULTICAST, ALL_LOCAL
Frame Type(s) [This protocol has not registered any frame types]
Only showing the first 256 of 7324844 multicast addresses
Multicast address list 08-57-48-83-ec-20 !miniport ffffe00001e281a0 -filterdb
39-03-00-04-72-14
00-b9-1a-00-00-00
—> Has a bunch of more MAC entries
I am really clueless on what could be going wrong here. I have seen a few posts around NdisIMDeInitializeDeviceInstance in some other mailing lists but haven’t seen a solution for the same.