Re: IM driver modifying packet content and task offload
- From: Pankaj Garg <pankajg@xxxxxxxxxxxxxxxxxxxxxx>
- Date: Sun, 11 Feb 2007 23:08:08 -0800
You can create packets in your IM driver and let the underlying miniport do the checksum. You need to do following things (some of which you have already pointed out) to make sure the miniport correctly calculates the checksum:
1. Put correct values for NDIS_TCP_IP_CHECKSUM_PACKET_INFO in the packet 2. Calculate the checksum for the TCP pseudoheader and put that in the packet.
See this from the DDK:
Before offloading the checksum calculation for a TCP packet, the TCP/IP transport calculates the one's complement sum for the TCP pseudoheader. The TCP/IP transport calculates the one's complement sum across all fields in the pseudoheader, including Source IP Address, Destination IP Address, Protocol, and the TCP length for TCP packets. The TCP/IP transport enters the one's complement sum for the pseudoheader in the Checksum field of the TCP header.
The one's complement sum for the pseudoheader provided by the TCP/IP transport gives the NIC an early start in calculating the real TCP checksum for the send packet. To calculate the actual TCP checksum, the NIC calculates the variable part of the TCP checksum (for the TCP header and payload), adds this checksum to the one's complement sum for the pseudoheader calculated by the TCP/IP transport, and calculates the 16-bit one's complement for the checksum. For more information on calculating such checksums, see RFC 793 and RFC 1122.
Good Luck,
--
Pankaj Garg
2007-02-11 at 11:00pm
http://www.intellectualheaven.com
On Sun, 11 Feb 2007, Peter wrote:
.
Sorry, I wrote inaccurate sentence...
Yes IM driver cannot modify packets,
I ment creating own packets with it's own chained buffers and copying
original data to it.
So my question in other words:
assumptions:
Only outgoing packets, task offload is switched on in network card,
IM driver MiniportQueryInformation() does not block
MiniportQueryInformation(...OID_TCP_TASK_OFFLOAD...) requests down to
miniport.
question:
Can it be checksum functional with outgoing packets created by IM driver ?
I tried it. When I set IP/TCP checksums zero, but on target machine I detect
bad checksum.
When I switch off task offload and let IM driver to calculate checksum then
all is ok,
but I 's like to create packets in IM driver and use task offload for
checksum, is it possible ? Or it is really how wrote Maxim: "task offload
means that only miniport can to create checksum..." (I am not sure if I good
understand it.)
I appear also that NDIS_TCP_IP_CHECKSUM_PACKET_INFO must have correct info
for checksums created by miniport, maybe I must to fill it with right values
and try it, if it has sense...
Thx!
Peter
"Anton Bassov" wrote:
Maxim,
or IM driver must return NDIS_STATUS_NOT_SUPPORTED on
MiniportQueryInformation(...OID_TCP_TASK_OFFLOAD...) request.
Why? If this is a received packet with task offload on, then the checksum was
already checked by the hardware. You can still indicate the new packet based on
this one up to TCPIP.
If this is an outgoing packet - then again you can reuse offload. For outgoing
packets, offload means - nobody except the hardware and its driver bother to
compute TCP/IP checksums. Your IM can also not bother.
Actually, the OP said a right thing - modifying IM should fail
OID_TCP_TASK_OFFLOAD request with NDIS_STATUS_NOT_SUPPORTED, rather than
passing it down to miniport. I think Thomas F.Divine was the first one who
discovered it - this info appeared on PCAUSA ages ago (MSDN had not mentioned
this problem at the time). This info subsequently made its way to WDK
documentation, so that these days it is MSFT guideline. Please check WDK
documentation for more info.
Anton Bassov
"Maxim S. Shatskih" wrote:
When IM driver modifies packet content (for example NAT implementation),
cheksum offload must be switched off in network card properties,
IM cannot modify the packet content. It can only assemble its own packet, and
modify it.
or IM driver must return NDIS_STATUS_NOT_SUPPORTED on
MiniportQueryInformation(...OID_TCP_TASK_OFFLOAD...) request.
Why? If this is a received packet with task offload on, then the checksum was
already checked by the hardware. You can still indicate the new packet based on
this one up to TCPIP.
If this is an outgoing packet - then again you can reuse offload. For outgoing
packets, offload means - nobody except the hardware and its driver bother to
compute TCP/IP checksums. Your IM can also not bother.
--
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
maxim@xxxxxxxxxxxxxxxx
http://www.storagecraft.com
- Follow-Ups:
- Re: IM driver modifying packet content and task offload
- From: Stephan Wolf [MVP]
- Re: IM driver modifying packet content and task offload
- References:
- Re: IM driver modifying packet content and task offload
- From: Maxim S. Shatskih
- Re: IM driver modifying packet content and task offload
- From: Anton Bassov
- Re: IM driver modifying packet content and task offload
- From: Peter
- Re: IM driver modifying packet content and task offload
- Prev by Date: Re: IM driver modifying packet content and task offload
- Next by Date: HowTo simply check if a given driver packge includes a valid WHQL/DTM .cat file?
- Previous by thread: Re: IM driver modifying packet content and task offload
- Next by thread: Re: IM driver modifying packet content and task offload
- Index(es):
Relevant Pages
|
|