Yes, u are right to set the checksum value to zero to let the hardware do the stuff. But is the hardware correctly configured? "ethtool" is just a userspace tool, but it will still need the hardware drivers to actually implement the stuff. use "lshw" to see which hardware u have, and whether it is claimed by any drivers or not, and "lsmod" to guess which driver could be used. And then look into the kernel source: drivers/net/ethernet branch to sieve out the file that implement the driver, possibly look into the file and see whether hardware checksum has actually been properly done. possibly u may add some debug message, recompile and reload the drivers to debug it.<div>
<br></div><div>For my case:</div><div><br></div><div>lshw:</div><div><div> *-network</div><div> description: Ethernet interface</div><div> product: RTL8111/8168B PCI Express Gigabit Ethernet controller</div>
<div> vendor: Realtek Semiconductor Co., Ltd.</div><div><br></div><div>and lsmod gives r8169 and the kernel file (realtek/r8169.c):</div><div><br></div><div><div> TD0_TCP_CS = (1 << 16), /* Calculate TCP/IP checksum */</div>
<div> TD0_UDP_CS = (1 << 17), /* Calculate UDP/IP checksum */</div><div> TD0_IP_CS = (1 << 18), /* Calculate IP checksum */</div><div><br></div></div><div>So there are altogether three different modes provided by hardware I guessed.</div>
<br><div class="gmail_quote">On Thu, Jul 19, 2012 at 9:42 PM, Murali Annamneni <span dir="ltr"><<a href="mailto:a.murali@hcl.com" target="_blank">a.murali@hcl.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi Kristof,<br>
<br>
Thanks for your quick reply.<br>
<br>
I have made changes to my code suchthat before leaving from post hook(i.e. before entering into the ethernet device), I set udp & ip checksum's as "0".<br>
Still packets are getting dropped. I found that oflload engine is not computing the checksum.<br>
Do you know anything about checksum offload feature is corrected in kernel-2.6.32 ?<br>
<div class="im HOEnZb"><br>
<br>
Thanks & Regards<br>
Murali Annamneni<br>
<br>
<br>
</div><div class="im HOEnZb">-----Original Message-----<br>
From: Kristof Provost [mailto:<a href="mailto:kristof@sigsegv.be">kristof@sigsegv.be</a>]<br>
Sent: Thursday, July 19, 2012 6:53 PM<br>
To: Murali Annamneni<br>
Cc: <a href="mailto:kernelnewbies@kernelnewbies.org">kernelnewbies@kernelnewbies.org</a><br>
Subject: Re: UDP packets are getting dropped because of invalied checksum though checksum offload is enabled in kernel-2.6.32<br>
<br>
On 2012-07-19 18:28:57 (+0530), Murali Annamneni <<a href="mailto:a.murali@hcl.com">a.murali@hcl.com</a>> wrote:<br>
> Hi All,<br>
><br>
> I have written a kernel module using netfilter framework. In my code I'll do some modifications to the header & payload parts of UDP packet in pre & post hooks.<br>
> After modifying the udp packet, I'm computing ip & udp checksum. This computation is consuming some cpu cycles.<br>
> Now, I want to offload this computation to the Ethernet device. For this I have commented the checksum computation in my code and enabled the checksum offload parameters of my Ethernet device.<br>
> While testing, I found that kernel is dropping the packets because of invalid checksums for ip & udp packets.<br>
> I have few doubts regarding checksum offload<br>
><br>
Wild guess: try setting the checksum to zero before sending the packet.<br>
It's possible that the offload engine won't recompute checksums unless they're zero (i.e. it might assume non-zero checksums are already correct).<br>
<br>
Regards,<br>
Kristof<br>
<br>
<br>
<br>
</div><div class="im HOEnZb">::DISCLAIMER::<br>
----------------------------------------------------------------------------------------------------------------------------------------------------<br>
<br>
The contents of this e-mail and any attachment(s) are confidential and intended for the named recipient(s) only.<br>
E-mail transmission is not guaranteed to be secure or error-free as information could be intercepted, corrupted,<br>
lost, destroyed, arrive late or incomplete, or may contain viruses in transmission. The e mail and its contents<br>
(with or without referred errors) shall therefore not attach any liability on the originator or HCL or its affiliates.<br>
Views or opinions, if any, presented in this email are solely those of the author and may not necessarily reflect the<br>
views or opinions of HCL or its affiliates. Any form of reproduction, dissemination, copying, disclosure, modification,<br>
distribution and / or publication of this message without the prior written consent of authorized representative of<br>
HCL is strictly prohibited. If you have received this email in error please delete it and notify the sender immediately.<br>
Before opening any email and/or attachments, please check them for viruses and other defects.<br>
<br>
----------------------------------------------------------------------------------------------------------------------------------------------------<br>
</div><div class="HOEnZb"><div class="h5">_______________________________________________<br>
Kernelnewbies mailing list<br>
<a href="mailto:Kernelnewbies@kernelnewbies.org">Kernelnewbies@kernelnewbies.org</a><br>
<a href="http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies" target="_blank">http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies</a><br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>Regards,<br>Peter Teoh<br>
</div>