Message ID | 0c8eaab8f0685d2a70d125cf876238c70afd4fb6.1644574987.git.christophe.leroy@csgroup.eu (mailing list archive) |
---|---|
State | Changes Requested |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | [1/2] net: Allow csum_sub() to be provided in arch | expand |
diff --git a/include/net/checksum.h b/include/net/checksum.h index 9badcd5532ef..735d98724145 100644 --- a/include/net/checksum.h +++ b/include/net/checksum.h @@ -62,10 +62,12 @@ static inline __wsum csum_add(__wsum csum, __wsum addend) } #endif +#ifndef HAVE_ARCH_CSUM_SUB static inline __wsum csum_sub(__wsum csum, __wsum addend) { return csum_add(csum, ~addend); } +#endif static inline __sum16 csum16_add(__sum16 csum, __be16 addend) {
In the same spirit as commit 07064c6e022b ("net: Allow csum_add to be provided in arch"), allow csum_sub() to be provided by arch. The generic implementation of csum_sub() call csum_add() with the complement of the addendum. Some architectures can do it directly. This will also avoid getting several copies of csum_sub() outlined when building with -Os. Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu> --- include/net/checksum.h | 2 ++ 1 file changed, 2 insertions(+)