From: Alexei Starovoitov <ast@plumgrid.com>
To: "David S. Miller" <davem@davemloft.net>
Cc: Daniel Borkmann <daniel@iogearbox.net>,
Jiri Pirko <jiri@resnulli.us>,
Jamal Hadi Salim <jhs@mojatatu.com>,
netdev@vger.kernel.org
Subject: [PATCH v2 net-next 1/2] net: introduce skb_postpush_rcsum() helper
Date: Tue, 7 Apr 2015 18:03:44 -0700 [thread overview]
Message-ID: <1428455025-5945-1-git-send-email-ast@plumgrid.com> (raw)
similar to skb_postpull_rcsum() introduce skb_postpush_rcsum() helper
Signed-off-by: Alexei Starovoitov <ast@plumgrid.com>
---
skb_postpush_rcsum() is also used in the next patch.
include/linux/skbuff.h | 7 +++++++
net/core/filter.c | 4 ++--
2 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index 36f3f43c0117..3c5b191869bb 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -2586,6 +2586,13 @@ static inline void skb_postpull_rcsum(struct sk_buff *skb,
skb->csum = csum_sub(skb->csum, csum_partial(start, len, 0));
}
+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));
+}
+
unsigned char *skb_pull_rcsum(struct sk_buff *skb, unsigned int len);
/**
diff --git a/net/core/filter.c b/net/core/filter.c
index b669e75d2b36..e5872704c28b 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -1213,8 +1213,8 @@ static u64 bpf_skb_store_bytes(u64 r1, u64 r2, u64 r3, u64 r4, u64 flags)
/* skb_store_bits cannot return -EFAULT here */
skb_store_bits(skb, offset, ptr, len);
- if (BPF_RECOMPUTE_CSUM(flags) && skb->ip_summed == CHECKSUM_COMPLETE)
- skb->csum = csum_add(skb->csum, csum_partial(ptr, len, 0));
+ if (BPF_RECOMPUTE_CSUM(flags))
+ skb_postpush_rcsum(skb, ptr, len);
return 0;
}
--
1.7.9.5
next reply other threads:[~2015-04-08 1:03 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-08 1:03 Alexei Starovoitov [this message]
2015-04-08 1:03 ` [PATCH v2 net-next 2/2] tc: make ingress and egress qdiscs consistent Alexei Starovoitov
2015-04-08 2:35 ` David Miller
2015-04-08 3:22 ` Alexei Starovoitov
2015-04-08 4:48 ` Alexei Starovoitov
2015-04-08 8:36 ` Daniel Borkmann
2015-04-08 9:05 ` Jiri Pirko
2015-04-08 10:54 ` Daniel Borkmann
2015-04-08 11:14 ` Daniel Borkmann
2015-04-08 11:47 ` Jamal Hadi Salim
2015-04-08 12:31 ` Daniel Borkmann
2015-04-08 12:58 ` Jamal Hadi Salim
2015-04-08 13:14 ` Thomas Graf
2015-04-08 13:27 ` Daniel Borkmann
2015-04-08 13:34 ` Jiri Pirko
2015-04-08 13:41 ` Daniel Borkmann
2015-04-08 13:47 ` Thomas Graf
2015-04-08 13:52 ` Jamal Hadi Salim
2015-04-08 14:53 ` Daniel Borkmann
2015-04-08 16:26 ` Alexei Starovoitov
2015-04-08 16:32 ` David Miller
2015-04-08 16:44 ` Alexei Starovoitov
2015-04-08 16:54 ` Daniel Borkmann
2015-04-08 11:43 ` Jamal Hadi Salim
2015-04-08 7:25 ` [PATCH v2 net-next 1/2] net: introduce skb_postpush_rcsum() helper Daniel Borkmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1428455025-5945-1-git-send-email-ast@plumgrid.com \
--to=ast@plumgrid.com \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=jhs@mojatatu.com \
--cc=jiri@resnulli.us \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).