crc/csum follow-ups
Subsystems (3)
cover crc/csum follow-ups
Daniel Borkmann (3):
net: checksum: fix warning in skb_checksum
lib: crc32: conditionally resched when running testcases
lib: crc32: reduce number of tests for crc32{,c}_combine
include/net/checksum.h | 5 +++++ lib/crc32.c | 7 +++++-- net/core/skbuff.c | 2 +- 3 files changed, 11 insertions(+), 3 deletions(-)
Signature · 1 line
1.8.3.1
PATCH 1/3 net: checksum: fix warning in skb_checksum
This patch fixes a build warning in skb_checksum() by wrapping the csum_partial() usage in skb_checksum(). The problem is that on a few architectures, csum_partial is used with prefix asmlinkage whereas on most architectures it's not. So fix this up generically as we did with csum_block_add_ext() to match the signature. Introduced by 2817a336d4d ("net: skb_checksum: allow custom update/combine for walking skb").
---
Only net-next affected, nothing else.
include/net/checksum.h | 5 +++++ net/core/skbuff.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-)
include/net/checksum.h +5 -0
@@ -98,6 +98,11 @@ static inline __wsum csum_unfold(__sum16 n)return (__force __wsum )n; } +static inline __wsum csum_partial_ext (const void *buff,int len,__wsum sum) +{ +return csum_partial (buff, len, sum); +} +#define CSUM_MANGLED_0 ((__force __sum16)0xffff)static inline void csum_replace4 (__sum16 *sum,__be32 from,__be32 to)
net/core/skbuff.c +1 -1
@@ -2003,7 +2003,7 @@ __wsum skb_checksum(const struct sk_buff *skb, int offset, int len, __wsum csum) {const struct skb_checksum_ops ops = { - .update = csum_partial, + .update = csum_partial_ext, .combine = csum_block_add_ext, };
Signature · 1 line
1.8.3.1
PATCH 2/3 lib: crc32: conditionally resched when running testcases
In reply to Daniel BorkmannFengguang reports that when crc32 selftests are running on startup, on some e.g. 32bit systems, we can get a CPU stall like "INFO: rcu_sched self-detected stall on CPU { 0} (t=2101 jiffies g=4294967081 c=4294967080 q=41)". As this is not intended, add a cond_resched() at the end of a test case to fix it. Introduced by efba721f63 ("lib: crc32: add test cases for crc32{, c}_combine routines").
--- lib/crc32.c | 3 +++ 1 file changed, 3 insertions(+)
lib/crc32.c +3 -0
@@ -29,6 +29,7 @@#include <linux/crc32.h> #include <linux/module.h> #include <linux/types.h> +#include <linux/sched.h> #include "crc32defs.h" #if CRC_LE_BITS >8
@@ -1054,6 +1055,7 @@ static int __init crc32c_combine_test(void) crc_full == test[i].crc32c_le)) errors++; runs++; +cond_resched (); } }
@@ -1147,6 +1149,7 @@ static int __init crc32_combine_test(void) crc_full == test[i].crc_le)) errors++; runs++; +cond_resched (); } }
Signature · 1 line
1.8.3.1
PATCH 3/3 lib: crc32: reduce number of cases for crc32{,c}_combine
In reply to Daniel BorkmannWe can safely reduce the number of test cases by a tenth. There is no particular need to run as many as we're running now for crc32{,c}_combine, that gives us still ~8000 tests we're doing if people run kernels with crc selftests enabled which is perfectly fine.
--- lib/crc32.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
lib/crc32.c +2 -2
@@ -1037,7 +1037,7 @@ static int __init crc32c_combine_test(void)int i, j;int errors =0 , runs =0 ; -for (i =0 ; i <100 ; i++) { +for (i =0 ; i <10 ; i++) {u32 crc_full; crc_full = __crc32c_le(test[i].crc, test_buf + test[i].start,
@@ -1131,7 +1131,7 @@ static int __init crc32_combine_test(void)int i, j;int errors =0 , runs =0 ; -for (i =0 ; i <100 ; i++) { +for (i =0 ; i <10 ; i++) {u32 crc_full; crc_full = crc32_le(test[i].crc, test_buf + test[i].start,
Signature · 1 line
1.8.3.1
David Miller
maintainerFrom: Daniel Borkmann <[email protected]>
Date: Mon, 4 Nov 2013 17:10:24 +0100
Quoted 4 lines
Daniel Borkmann (3):
net: checksum: fix warning inskb_checksum
lib: crc32: conditionally resched when running testcases
lib: crc32: reduce number of tests for crc32{,c}_combine
Series applied, thanks for responding to this so quickly Daniel.