Tech Support > Microsoft Windows > Drivers > NdisMCoIndicateReceiveNetBufferLists not working with NDIS_RECEIVE_FLAGS_RESOURCES flag
NdisMCoIndicateReceiveNetBufferLists not working with NDIS_RECEIVE_FLAGS_RESOURCES flag
Posted by Angie on February 29th, 2008


All,

I found one problem in the NdisMCoIndicateReceiveNetBufferLists()
API call.

According to the driver's document , if CoReceiveFlags is specified
with "NDIS_RECEIVE_FLAGS_RESOURCES ", driver can calim the owership of the
buffer. However, I found this API not working. What I did is to
initialize the value of "SourceHandle" to 0x55aa before indicating the
packet up. However, in the the ":MiniportReturnNetBufferLists "
function, this packet was returned from the protocol layer. Does anybody
know what it is going on with problem?


---------------------------WinDbg debugging
output -----------------------------------------
0:VPNDRV:WARNING:CardIndicateReceivedPacket NDIS_RECEIVE_FLAGS_RESOURCES
NumberOfPackets=1
0:VPNDRV:WARNING:CardIndicateReceivedPacket NDIS_RECEIVE_FLAGS_RESOURCES
NumberOfPackets=1
1:VPNDRV:WARNING:MiniportReturnNetBufferLists Not our
NetBufferLists=0x836f54e8 SourceHandle=0x55aa
0:VPNDRV:WARNING:CardIndicateReceivedPacket NDIS_RECEIVE_FLAGS_RESOURCES
NumberOfPackets=1
1:VPNDRV:WARNING:MiniportReturnNetBufferLists Not our
NetBufferLists=0x83bd71d8 SourceHandle=0x55aa
0:VPNDRV:WARNING:CardIndicateReceivedPacket NDIS_RECEIVE_FLAGS_RESOURCES
NumberOfPackets=1
1:VPNDRV:WARNING:MiniportReturnNetBufferLists Not our
NetBufferLists=0x836231d8 SourceHandle=0x55aa
0:VPNDRV:WARNING:CardIndicateReceivedPacket NDIS_RECEIVE_FLAGS_RESOURCES
NumberOfPackets=1
1:VPNDRV:WARNING:MiniportReturnNetBufferLists Not our
NetBufferLists=0x83716418 SourceHandle=0x55aa
0:VPNDRV:WARNING:CardIndicateReceivedPacket NDIS_RECEIVE_FLAGS_RESOURCES
NumberOfPackets=1
1:VPNDRV:WARNING:MiniportReturnNetBufferLists Not our
NetBufferLists=0x836f54e8 SourceHandle=0x55aa
0:VPNDRV:WARNING:CardIndicateReceivedPacket NDIS_RECEIVE_FLAGS_RESOURCES
NumberOfPackets=1
1:VPNDRV:WARNING:MiniportReturnNetBufferLists Not our
NetBufferLists=0x836381d8 SourceHandle=0x55aa
0:VPNDRV:WARNING:CardIndicateReceivedPacket NDIS_RECEIVE_FLAGS_RESOURCES
NumberOfPackets=1
1:VPNDRV:WARNING:MiniportReturnNetBufferLists Not our
NetBufferLists=0x83716418 SourceHandle=0x55aa


-------------------My function to indicate the packet
up ------------------------------------------------


if (pLink->ReceivedNBLChain)
{

ULONG ReceiveFlags=0;


DBG_NOTICE(pAdapter, ("NumberOfPackets
=%d\n",pLink->NumberOfPackets));

if (pAdapter->pCard->RCBCount==RCB_THRESHOLD)

{

NDIS_SET_RECEIVE_FLAG(ReceiveFlags,
NDIS_RECEIVE_FLAGS_RESOURCES);

//-------------------I put a hard code value 0x55aa to "
CurrentNetBufferList->SourceHandle" before indicating the packet
up.---------------------------

#if DBG

{

PNET_BUFFER_LIST CurrentNetBufferList;

UINT i;


CurrentNetBufferList = pLink->ReceivedNBLChain;

for (i=0; i<pLink->NumberOfPackets; i++)

{

CurrentNetBufferList->SourceHandle=0x55aa;

CurrentNetBufferList =
NET_BUFFER_LIST_NEXT_NBL(CurrentNetBufferList);

}

}

#endif

}

else

pAdapter->TotalIndicatedNetBufferList +=pLink->NumberOfPackets;

NET_BUFFER_LIST_NEXT_NBL(pLink->LastReceivedNBL) = NULL;

NdisMCoIndicateReceiveNetBufferLists(

pLink->NdisVcHandle,

pLink->ReceivedNBLChain,

pLink->NumberOfPackets,

ReceiveFlags

);

//

// Packets that were indicated with NDIS_STATUS_RESOURCES

// need to be returned to Hw11 immediately.

//

if ((ReceiveFlags&NDIS_RECEIVE_FLAGS_RESOURCES)) // Implies
LowResourceNBLChain != NULL

{

PNET_BUFFER_LIST CurrentNetBufferList;

UINT i;

PRCB pRCB;


DBG_WARNING(DbgInfo,("NDIS_RECEIVE_FLAGS_RESOURCES
NumberOfPackets=%d\n",pLink->NumberOfPackets));

CurrentNetBufferList = pLink->ReceivedNBLChain;

// DBG_WARNING(pAdapter,
("RCBCount=%d\n",pAdapter->pCard->RCBCount));

for (i=0; i<pLink->NumberOfPackets; i++)

{

pRCB = GET_RCB_FROM_NBL(CurrentNetBufferList);

ASSERT(pRCB);

CardQueueRCB(pAdapter->pCard,pRCB, FALSE);

CurrentNetBufferList =
NET_BUFFER_LIST_NEXT_NBL(CurrentNetBufferList);

}

// Make sure we walked the entire list.

ASSERT(CurrentNetBufferList == NULL);

// DBG_WARNING(pAdapter,
("RCBCount=%d\n",pAdapter->pCard->RCBCount));

}

//reset the following values

pLink->ReceivedNBLChain=NULL;

pLink->LastReceivedNBL=NULL;

pLink->NumberOfPackets=0;

}




Posted by Angie on February 29th, 2008


One more problem I found in this case was that the protocol layer does
not return the buffers to the driver after indicating the packets with
NDIS_RECEIVE_FLAGS_RESOURCES flag.


"Angie" <kimojolin@yahoo.com> wrote in message
news:uAWpJbneIHA.4696@TK2MSFTNGP05.phx.gbl...


Posted by Pavel A. on February 29th, 2008


?? So what do you see:
your MiniportReturnNetBufferLists is called with this buffer list,
or it is NOT called? (the latter is the correct behavior with NDIS_RECEIVE_FLAGS_RESOURCES) ?
What means "not our" in the debug prints?

--PA

"Angie" <kimojolin@yahoo.com> wrote in message news:evLiA9neIHA.4312@TK2MSFTNGP03.phx.gbl...


Posted by Angie on February 29th, 2008


I just wanted to prvoe that when "NDIS_RECEIVE_FLAGS_RESOURCES " is
specified, the indicated buffer is returned from the
MiniportReturnNetBufferLists callback function.
This is not correct. According to the driver document, when the received
packeted is indicated with "NDIS_RECEIVE_FLAGS_RESOURCES " flag, the
indicated buffer should not be returned from from the
MiniportReturnNetBufferLists callback function.

The another serious problem I found was that the packets that were not
indicated with "NDIS_RECEIVE_FLAGS_RESOURCES" flag were not returned from
the MiniportReturnNetBufferLists callback function after this point. The
buffer management mechanism is totally screwed up after the driver indicate
the packet with "NDIS_RECEIVE_FLAGS_RESOURCES " flag.



"Pavel A." <pavel_a@NOwritemeNO.com> wrote in message
news:Owyv75veIHA.4260@TK2MSFTNGP05.phx.gbl...



Similar Posts