From: Paolo Pisati <p.pisati@gmail.com>
To: --to=Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Martin KaFai Lau <kafai@fb.com>, Song Liu <songliubraving@fb.com>,
Yonghong Song <yhs@fb.com>,
"David S . Miller" <davem@davemloft.net>,
Shuah Khan <shuah@kernel.org>,
Jakub Kicinski <jakub.kicinski@netronome.com>,
Jiong Wang <jiong.wang@netronome.com>
Cc: netdev@vger.kernel.org, bpf@vger.kernel.org,
linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 1/2] bpf: bpf_csum_diff: fold the checksum before returning the value
Date: Thu, 11 Jul 2019 11:40:36 +0200 [thread overview]
Message-ID: <1562838037-1884-2-git-send-email-p.pisati@gmail.com> (raw)
In-Reply-To: <1562838037-1884-1-git-send-email-p.pisati@gmail.com>
From: Paolo Pisati <paolo.pisati@canonical.com>
With this change, bpf_csum_diff behave homogeneously among different
checksum calculation code / csum_partial() (tested on x86-64, arm64 and
arm).
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
---
net/core/filter.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/core/filter.c b/net/core/filter.c
index f615e42cf4ef..8db7f58f1ea1 100644
--- a/net/core/filter.c
+++ b/net/core/filter.c
@@ -1990,7 +1990,7 @@ BPF_CALL_5(bpf_csum_diff, __be32 *, from, u32, from_size,
for (i = 0; i < to_size / sizeof(__be32); i++, j++)
sp->diff[j] = to[i];
- return csum_partial(sp->diff, diff_size, seed);
+ return csum_fold(csum_partial(sp->diff, diff_size, seed));
}
static const struct bpf_func_proto bpf_csum_diff_proto = {
--
2.17.1
next prev parent reply other threads:[~2019-07-11 9:40 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-01 11:54 [RESEND] test_verifier #13 fails on arm64: "retval 65507 != -29" Paolo Pisati
2019-07-01 21:51 ` Yonghong Song
2019-07-10 10:02 ` Paolo Pisati
2019-07-10 22:52 ` Andrii Nakryiko
2019-07-10 22:54 ` Andrii Nakryiko
2019-07-10 23:14 ` Andi Kleen
2019-07-11 9:40 ` [PATCH 0/2] [RESEND] Fold checksum at the end of bpf_csum_diff and fix Paolo Pisati
2019-07-11 9:40 ` Paolo Pisati [this message]
2019-07-11 9:40 ` [PATCH 2/2] bpf, selftest: fix checksum value for test #13 Paolo Pisati
2019-07-11 23:47 ` Andrii Nakryiko
2019-07-11 9:31 [PATCH 0/2] Fold checksum at the end of bpf_csum_diff and fix Paolo Pisati
2019-07-11 9:31 ` [PATCH 1/2] bpf: bpf_csum_diff: fold the checksum before returning the value Paolo Pisati
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=1562838037-1884-2-git-send-email-p.pisati@gmail.com \
--to=p.pisati@gmail.com \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=jakub.kicinski@netronome.com \
--cc=jiong.wang@netronome.com \
--cc=kafai@fb.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=shuah@kernel.org \
--cc=songliubraving@fb.com \
--cc=yhs@fb.com \
/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).