problem about checksum offload in ndis miniport driver

Hi

I am developing windows pv network driver and hit some problem about
checksum.
I run a virtual machine on a linux OS, when checksum offload is enabled
in my virtual machine, it works ok when i run iperf between this VM and
other physical PC. But if i run iperf between linux OS and this VM, the
problem happens.
When checksum offload is enabled, linux OS will send to VM packets
without checksum or with checksum invalid, because those packets do not
pass through physical network card. After the driver receive those
packets, if i set Receive.NdisPacketTcpChecksumSucceeded TRUE, and send
packets to NDIS directly, windows will drop those packets. I think NDIS
still check the checksum even when checksum offload is enabled. Am i
right? So I must calculate checksum in my driver before i send those to
NDIS, but this will cause performance hit.

So when checksum in receiving packets is invalid with checksum offload
enabled, are there any solutions to avoid calculating checksum in
windows pv driver?
Any suggestion is appreciated.

Thanks
Annie

Hello Ainne,

Are you testing with Vista? Secondly are you seeing any split in your
packets when you receive it like Header and Data Split?
If you see any Header-Data Split then its new feature in Vista which i you
can disable on read by making registry entry.

regards
rohit

On Fri, Jan 16, 2009 at 2:38 PM, ANNIE LI wrote:

> Hi
>
> I am developing windows pv network driver and hit some problem about
> checksum.
> I run a virtual machine on a linux OS, when checksum offload is enabled in
> my virtual machine, it works ok when i run iperf between this VM and other
> physical PC. But if i run iperf between linux OS and this VM, the problem
> happens.
> When checksum offload is enabled, linux OS will send to VM packets without
> checksum or with checksum invalid, because those packets do not pass through
> physical network card. After the driver receive those packets, if i set
> Receive.NdisPacketTcpChecksumSucceeded TRUE, and send packets to NDIS
> directly, windows will drop those packets. I think NDIS still check the
> checksum even when checksum offload is enabled. Am i right? So I must
> calculate checksum in my driver before i send those to NDIS, but this will
> cause performance hit.
>
> So when checksum in receiving packets is invalid with checksum offload
> enabled, are there any solutions to avoid calculating checksum in windows pv
> driver?
> Any suggestion is appreciated.
>
> 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
>


Rohit Gupta
ST Microelectronics
Noida

> Hi

I am developing windows pv network driver and hit some problem about
checksum.
I run a virtual machine on a linux OS, when checksum offload is
enabled
in my virtual machine, it works ok when i run iperf between this VM
and
other physical PC. But if i run iperf between linux OS and this VM,
the
problem happens.
When checksum offload is enabled, linux OS will send to VM packets
without checksum or with checksum invalid, because those packets do
not
pass through physical network card. After the driver receive those
packets, if i set Receive.NdisPacketTcpChecksumSucceeded TRUE, and
send
packets to NDIS directly, windows will drop those packets. I think
NDIS
still check the checksum even when checksum offload is enabled. Am i
right? So I must calculate checksum in my driver before i send those
to
NDIS, but this will cause performance hit.

Annie,

That is what I found - the checksum has to be correct even if the
‘checksum ok’ flag is set. And yes it does cause a performance hit.

Are you using NDIS 5.1 or 6.x?

Also, if you haven’t already I highly recommend using the NDIS test from
the WLK. It found a heap of little things wrong with my drivers that
could have caused funny things to happen in fairly rare circumstances,
making them otherwise really really hard to track down.

So when checksum in receiving packets is invalid with checksum offload
enabled, are there any solutions to avoid calculating checksum in
windows pv driver?
Any suggestion is appreciated.

Me too. My driver performance is over 2Gbits/second from DomU->Dom0 but
only 600Mbits/second from Dom0->Domu (because of this checksum checking
and because windows doesn’t handle a ‘large receive offload’.

Thanks

James

Hi rohit gupta,

No, I test it with winXP and Win2k3.
Furthermore, not any split in receiving packets.
If i disable checksum offload, it works ok when linux OS send packets to
VM. So i think it is checksum problem.

Thanks
Annie

rohit gupta wrote:

Hello Ainne,

Are you testing with Vista? Secondly are you seeing any split in your
packets when you receive it like Header and Data Split?
If you see any Header-Data Split then its new feature in Vista which i
you can disable on read by making registry entry.

regards
rohit

Hi James,

Are you using NDIS 5.1 or 6.x?

I use NDIS 5.1, but 6.x is necessary for srv2008 and vista performance.

Also, if you haven’t already I highly recommend using the NDIS test from
the WLK. It found a heap of little things wrong with my drivers that
could have caused funny things to happen in fairly rare circumstances,
making them otherwise really really hard to track down.

Thanks for your information.

Me too. My driver performance is over 2Gbits/second from DomU->Dom0 but
only 600Mbits/second from Dom0->Domu (because of this checksum checking
and because windows doesn’t handle a ‘large receive offload’.

So i wonder any solutions to avoid this?

Thanks
Annie.

Annie, my best solution was to use the OID to tell the protocol stack that checksum offloading was turned ON for received packets. However, this doesn’t seem to work for UDP, so you have to do a quick check and if your incoming packet is UDP, calculate the checksum right there in your miniport and stamp the packet with it.

Hi sprochniak,

Thank you very much.
When the protocol stack query information about my miniport driver, i
replied it as supporting checksum offloading, and set
Receive.NdisPacketTcpChecksumSucceeded TRUE when receiving packets
without checksum. But for tcp packets, it seems that windows still think
checksum is error when i make such process, and drop those packets.
Are there any other steps i missed?

Thanks
Annie

xxxxx@VirtualIron.com wrote:

Annie, my best solution was to use the OID to tell the protocol stack that checksum offloading was turned ON for received packets. However, this doesn’t seem to work for UDP, so you have to do a quick check and if your incoming packet is UDP, calculate the checksum right there in your miniport and stamp the packet with it.


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