On 01/07/2016 02:53 AM, Hannes Frederic Sowa wrote:
On 07.01.2016 02:01, Daniel Borkmann wrote:
quoted
+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.