Sending packets through NDIS driver

Hi,
In my protocol driver I’m creating a thread and in this thread I’m calling NdisSend to send data on the network. Before sending I see the buffer getting filled properly with data…but when I capture the packet on the network I don’t see the correct data only half of the data is received most of the times and rest of the locations are filled with some pattern like 0x2E or 0x00…
Pls. help.
Regards,
Rajeev

Rajeev,

If you need help you need to give more information. If you
post the code you have written most probably we can help.

-Srin.

-----Original Message-----
From: Rajeev Gaba [mailto:xxxxx@intersolutions.stpn.soft.net]
Sent: Wednesday, July 02, 2003 12:06 PM
To: NT Developers Interest List
Subject: [ntdev] Sending packets through NDIS driver

Hi,

In my protocol driver I’m creating a thread and in this thread I’m
calling NdisSend to send data on the network. Before sending I see the
buffer getting filled properly with data…but when I capture the
packet on the network I don’t see the correct data only half of the data
is received most of the times and rest of the locations are filled with
some pattern like 0x2E or 0x00…

Pls. help.

Regards,

Rajeev


You are currently subscribed to ntdev as: xxxxx@nai.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

Hi
The TxThread code segement is as

;;
;;

while(TRUE){
Status = KeWaitForSingleObject(
&pContext->pThreadObj,
Executive,
KernelMode,
FALSE,
NULL);

Status = NdisAllocateMemoryWithTag(&pData,PacketLen,‘zJAR’);

if(!open->Bound){
DebugPrint((“Adapter binding is not there\n”));
return /*STATUS_UNSUCCESSFUL*/;
}
;;
;;
;;
/*My data gets copied in to the buffer here*/
RtlCopyMemory((pData+DataOffset),(pPort->TxQueLoc.Buffer+pPort->TxQueLoc.ReadPtr),8);
;;/*I see my 8 bytes of data being copied to the buffer*/
;;
NdisAllocatePacket(
&Status,&pPacket,open->PacketPool);

if (Status != NDIS_STATUS_SUCCESS) {
DebugPrint((“Tx:Cudn’t allocate Packet\n”));
return /*STATUS_INSUFFICIENT_RESOURCES*/;
}

NdisAllocateBuffer(
&Status,&pBuf,open->BufferPool,pData,PacketLen);

if(Status != NDIS_STATUS_SUCCESS){
NdisFreePacket(pPacket);
return /*STATUS_INSUFFICIENT_RESOURCES*/;
}
NdisChainBufferAtFront(pPacket,pBuf);
NdisSend(&Status,open->AdapterHandle,pPacket);
;;/*After executing this I see only four out of those 8 bytes being sent on the network*/
;;
}

Pls. suggest some thing. And one more thing what I should with the status I get after this NdisSend call…I mean if get STATUS_PENDING how I should free my allocated memory(i.e.pData).

Regards,
Rajeev
----- Original Message -----
From: xxxxx@NAI.com
To: NT Developers Interest List
Sent: Thursday, July 03, 2003 12:44 AM
Subject: [ntdev] RE: Sending packets through NDIS driver

Rajeev,

If you need help you need to give more information. If you post the code you have written most probably we can help.

-Srin.

-----Original Message-----
From: Rajeev Gaba [mailto:xxxxx@intersolutions.stpn.soft.net]
Sent: Wednesday, July 02, 2003 12:06 PM
To: NT Developers Interest List
Subject: [ntdev] Sending packets through NDIS driver

Hi,

In my protocol driver I’m creating a thread and in this thread I’m calling NdisSend to send data on the network. Before sending I see the buffer getting filled properly with data…but when I capture the packet on the network I don’t see the correct data only half of the data is received most of the times and rest of the locations are filled with some pattern like 0x2E or 0x00…

Pls. help.

Regards,

Rajeev


You are currently subscribed to ntdev as: xxxxx@nai.com
To unsubscribe send a blank email to xxxxx@lists.osr.com


You are currently subscribed to ntdev as: xxxxx@intersolutions.stpn.soft.net
To unsubscribe send a blank email to xxxxx@lists.osr.com

Hi,Rajeev Gaba

When NdisSend return STATUS_PENDING you can’t free you NidsPacket and NidsBuffer .You can free all there resource when you ProtocolSendComplete is callback.
======== 2003-07-03 20:44:00 You wrote??

Hi
The TxThread code segement is as

;;
;;

while(TRUE){
Status = KeWaitForSingleObject(
&pContext->pThreadObj,
Executive,
KernelMode,
FALSE,
NULL);

Status = NdisAllocateMemoryWithTag(&pData,PacketLen,‘zJAR’);

if(!open->Bound){
DebugPrint((“Adapter binding is not there\n”));
return /*STATUS_UNSUCCESSFUL*/;
}
;;
;;
;;
/*My data gets copied in to the buffer here*/
RtlCopyMemory((pData+DataOffset),(pPort->TxQueLoc.Buffer+pPort->TxQueLoc.ReadPtr),8);
;;/*I see my 8 bytes of data being copied to the buffer*/
;;
NdisAllocatePacket(
&Status,&pPacket,open->PacketPool);

if (Status != NDIS_STATUS_SUCCESS) {
DebugPrint((“Tx:Cudn’t allocate Packet\n”));
return /*STATUS_INSUFFICIENT_RESOURCES*/;
}

NdisAllocateBuffer(
&Status,&pBuf,open->BufferPool,pData,PacketLen);

if(Status != NDIS_STATUS_SUCCESS){
NdisFreePacket(pPacket);
return /*STATUS_INSUFFICIENT_RESOURCES*/;
}
NdisChainBufferAtFront(pPacket,pBuf);
NdisSend(&Status,open->AdapterHandle,pPacket);
;;/*After executing this I see only four out of those 8 bytes being sent on the network*/
;;
}

Pls. suggest some thing. And one more thing what I should with the status I get after this NdisSend call…I mean if get STATUS_PENDING how I should free my allocated memory(i.e.pData).

Regards,
Rajeev
----- Original Message -----
From: xxxxx@NAI.com
To: NT Developers Interest List
Sent: Thursday, July 03, 2003 12:44 AM
Subject: [ntdev] RE: Sending packets through NDIS driver

Rajeev,
If you need help you need to give more information. If you post the code you have written most probably we can help.

-Srin.

-----Original Message-----
From: Rajeev Gaba [mailto:xxxxx@intersolutions.stpn.soft.net]
Sent: Wednesday, July 02, 2003 12:06 PM
To: NT Developers Interest List
Subject: [ntdev] Sending packets through NDIS driver

Hi,
In my protocol driver I’m creating a thread and in this thread I’m calling NdisSend to send data on the network. Before sending I see the buffer getting filled properly with data…but when I capture the packet on the network I don’t see the correct data only half of the data is received most of the times and rest of the locations are filled with some pattern like 0x2E or 0x00…
Pls. help.
Regards,
Rajeev

You are currently subscribed to ntdev as: xxxxx@nai.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

You are currently subscribed to ntdev as: xxxxx@intersolutions.stpn.soft.net
To unsubscribe send a blank email to xxxxx@lists.osr.com

You are currently subscribed to ntdev as: xxxxx@sinfors.com.cn
To unsubscribe send a blank email to xxxxx@lists.osr.com

= = = = = = = = = = = = = = = = = = = = = =
Best regards.
Crasher Guo.
xxxxx@sinfors.com.cn
2003-07-04