[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <568E37A3.5070104@iogearbox.net>
Date: Thu, 07 Jan 2016 11:02:11 +0100
From: Daniel Borkmann <daniel@...earbox.net>
To: Hannes Frederic Sowa <hannes@...essinduktion.org>,
davem@...emloft.net
CC: alexei.starovoitov@...il.com, netdev@...r.kernel.org
Subject: Re: [PATCH net-next] bpf: add skb_postpush_rcsum and fix dev_forward_skb
occasions
On 01/07/2016 02:53 AM, Hannes Frederic Sowa wrote:
> On 07.01.2016 02:01, Daniel Borkmann wrote:
>> +static inline void skb_postpush_rcsum(struct sk_buff *skb,
>> + const void *start, unsigned int len)
>> +{
>> + if (skb->ip_summed == CHECKSUM_COMPLETE)
>> + skb->csum = csum_add(skb->csum, csum_partial(start, len, 0));
>
> skb->csum = csum_partial(start, len, skb->csum);
>
> should work without calling carry-add twice, no?
Hmm, indeed, seems you're right. Since the csum_partial() only covers
this particular fragment with feeding initial csum as 0, the result
from the do_csum() stays as is for the first part, and the csum_add()
does effectively the same as if we've fed skb->csum already into
csum_partial().
There are btw couple of other places where this generic helper could be
used as well.
--
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