Skip to contentSkip to conversation

tcp/udp checksum and bridging

DISCUSSION James Harper 3 participants 3 messages Jan 6, 2008 – Jan 7, 2008

lore
Share & tools
lore
#0 lore raw

I have a setup with a Linux PV DomU which is on the same bridge as a Windows DomU using the PV drivers which Andy and I have been developing.

When a tcp packet originates from anywhere but on the same bridge, everything is fine, but when the packet originates from a machine on the same bridge, the checksum is wrong.

I think the problem is that the Linux DomU assumes that something else will do the checksum of the tcp packet, which is mostly correct unless the packet is only bridged and not routed...

Any suggestions?

Thanks

James

#1 lore raw
Quoted 2 lines

I have a setup with a Linux PV DomU which is on the same bridge as a Windows DomU using the PV drivers which Andy and I have been developing.

Cool. Glad to hear you're progressing well.

Quoted 9 lines

When a tcp packet originates from anywhere but on the same bridge, everything is fine, but when the packet originates from a machine on the same bridge, the checksum is wrong.

I think the problem is that the Linux DomU assumes that something else will do the checksum of the tcp packet, which is mostly correct unless the packet is only bridged and not routed...

Any suggestions?

I believe the NETTXF_data_validated or NETTXF_csum_blank flags should be set in the rx structure's flags in order to indicate that checksum has not been done... Are you checking for this?

I'm not really very familiar with this code, this is just something I had a vague recollection of existing and was therefore able to dredge up in the code. It's got a lot more complicated than I remember!

Cheers.
Mark

Signature · 4 lines
Dave: Just a question. What use is a unicyle with no seat?  And no pedals!
Mark: To answer a question with a question: What use is a skateboard?
Dave: Skateboards have wheels.
Mark: My wheel has a wheel!
#2 lore raw
In reply to James Harper

The problem is that an operating system may or may not expect the check summing to be offloaded to the hardware (sounds like it is in this case), and if the packet doesn't physically leave the system it's not going to touch the hardware and get that checksum.

There are two solutions: One is to checksum all incoming packets in the miniport. That is of course somewhat an undesirable performance hit. Plus, Miniports aren't really supposed to know anything about IP and doing IP checksumming there could be considered a hack.

The other is to respond to the proper NDIS OIDs and tell windows that checksumming for incoming packets is performed by the hardware. This will keep the protocol stack from doing the checksums and dropping all the packets. Specifically, handling OID_TCP_TASK_OFFLOAD for NDIS_TASK_TCP_IP_CHECKSUM will allow you to do that.

Unfortunately OID_TCP_TASK_OFFLOAD will only help you with TCP, as a windows limitation will not allow you to turn off the checksumming for UDP and windows will drop all of your internode UDP packets. Use the NETRXF_data_validated and NETRXF_csum_blank flags to determine that the packets are from an internal source, then do a simple test to see if the packet is UDP. Once you've determined that, you've got to stamp a checksum on it yourself before you indicate the packet up to the protocol stack.

Steve

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of James Harper
Sent: Sunday, January 06, 2008 5:27 AM
To: xen-devel
Subject: [Xen-devel] tcp/udp checksum and bridging

I have a setup with a Linux PV DomU which is on the same bridge as a Windows DomU using the PV drivers which Andy and I have been developing.

When a tcp packet originates from anywhere but on the same bridge, everything is fine, but when the packet originates from a machine on the same bridge, the checksum is wrong.

I think the problem is that the Linux DomU assumes that something else will do the checksum of the tcp packet, which is mostly correct unless the packet is only bridged and not routed...

Any suggestions?

Thanks

James

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel