UDP packets are getting dropped because of invalied checksum though checksum offload is enabled in kernel-2.6.32

Peter Teoh htmldeveloper at gmail.com
Thu Jul 19 21:52:47 EDT 2012


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.

For my case:

lshw:
           *-network
                description: Ethernet interface
                product: RTL8111/8168B PCI Express Gigabit Ethernet
controller
                vendor: Realtek Semiconductor Co., Ltd.

and lsmod gives r8169 and the kernel file (realtek/r8169.c):

        TD0_TCP_CS      = (1 << 16),            /* Calculate TCP/IP
checksum */
        TD0_UDP_CS      = (1 << 17),            /* Calculate UDP/IP
checksum */
        TD0_IP_CS       = (1 << 18),            /* Calculate IP checksum */

So there are altogether three different modes provided by hardware I
guessed.

On Thu, Jul 19, 2012 at 9:42 PM, Murali Annamneni <a.murali at hcl.com> wrote:

> Hi Kristof,
>
> Thanks for your quick reply.
>
> 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".
> Still packets are getting dropped. I found that oflload engine is not
> computing the checksum.
> Do you know anything about  checksum offload feature is corrected in
> kernel-2.6.32 ?
>
>
> Thanks & Regards
> Murali Annamneni
>
>
> -----Original Message-----
> From: Kristof Provost [mailto:kristof at sigsegv.be]
> Sent: Thursday, July 19, 2012 6:53 PM
> To: Murali Annamneni
> Cc: kernelnewbies at kernelnewbies.org
> Subject: Re: UDP packets are getting dropped because of invalied checksum
> though checksum offload is enabled in kernel-2.6.32
>
> On 2012-07-19 18:28:57 (+0530), Murali Annamneni <a.murali at hcl.com> wrote:
> > Hi All,
> >
> > 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.
> > After modifying the udp packet, I'm computing ip & udp checksum. This
> computation is consuming some cpu cycles.
> > 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.
> > While testing, I found that kernel is dropping the packets because of
> invalid checksums for ip & udp packets.
> > I have few doubts regarding checksum offload
> >
> Wild guess: try setting the checksum to zero before sending the packet.
> 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).
>
> Regards,
> Kristof
>
>
>
> ::DISCLAIMER::
>
> ----------------------------------------------------------------------------------------------------------------------------------------------------
>
> The contents of this e-mail and any attachment(s) are confidential and
> intended for the named recipient(s) only.
> E-mail transmission is not guaranteed to be secure or error-free as
> information could be intercepted, corrupted,
> lost, destroyed, arrive late or incomplete, or may contain viruses in
> transmission. The e mail and its contents
> (with or without referred errors) shall therefore not attach any liability
> on the originator or HCL or its affiliates.
> Views or opinions, if any, presented in this email are solely those of the
> author and may not necessarily reflect the
> views or opinions of HCL or its affiliates. Any form of reproduction,
> dissemination, copying, disclosure, modification,
> distribution and / or publication of this message without the prior
> written consent of authorized representative of
> HCL is strictly prohibited. If you have received this email in error
> please delete it and notify the sender immediately.
> Before opening any email and/or attachments, please check them for viruses
> and other defects.
>
>
> ----------------------------------------------------------------------------------------------------------------------------------------------------
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>



-- 
Regards,
Peter Teoh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20120720/80699475/attachment.html 


More information about the Kernelnewbies mailing list