[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1366304852.2735.37.camel@bwh-desktop.uk.solarflarecom.com>
Date: Thu, 18 Apr 2013 18:07:32 +0100
From: Ben Hutchings <bhutchings@...arflare.com>
To: Jim Baxter <jim_baxter@...tor.com>
CC: Eric Dumazet <eric.dumazet@...il.com>,
"David S. Miller" <davem@...emloft.net>,
Frank Li <Frank.Li@...escale.com>,
Fugang Duan <B38611@...escale.com>, <netdev@...r.kernel.org>,
Fabio Estevam <festevam@...il.com>,
Francois Romieu <romieu@...zoreil.com>
Subject: Re: [PATCH net-next v3 1/1] net: fec: Enable imx6 enet checksum
acceleration.
On Thu, 2013-04-18 at 17:16 +0100, Ben Hutchings wrote:
[...]
> But you don't actually need to check protocol numbers at all, as the
> kernel already specifies where the checksum should be.
>
> So I think this function should look like:
> {
> if (skb->ip_summed != CHECKSUM_PARTIAL)
> return 0;
>
> if (unlikely(skb_cow_head(skb, 0)))
> return -1;
>
> *(__sum16 *)(skb->head + skb->csum_start + skb->csum_offset) = 0;
> return 0;
> }
>
> The caller needs to check for the failure, and free the skb
> (kfree_skb()) rather than transmitting it.
Oh, presumably you still need to clear the IPv4 header checksum as well.
But it might be better to enable only TCP/UDP checksumming, because
Linux always calculates the IPv4 header checksum in software.
Ben.
--
Ben Hutchings, Staff Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists