Thread (5 messages) flat view 5 messages, 3 authors, 2016-01-07

Re: [PATCH net-next] bpf: add skb_postpush_rcsum and fix dev_forward_skb occasions

From: Daniel Borkmann <daniel@iogearbox.net>
Date: 2016-01-07 10:02:15

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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help