net: add skb_copy_and_crc32c_datagram_iter()
authorEric Biggers <ebiggers@google.com>
Mon, 19 May 2025 17:50:10 +0000 (10:50 -0700)
committerJakub Kicinski <kuba@kernel.org>
Wed, 21 May 2025 22:40:17 +0000 (15:40 -0700)
commitea6342d98928e243f2024fb97a9b4d42ee55dfba
tree0edd157c8f009ddadab991d2c80c41070dc677d2
parentb82f72292ab4c65250bd734281464a6ab1ff4133
net: add skb_copy_and_crc32c_datagram_iter()

Since skb_copy_and_hash_datagram_iter() is used only with CRC32C, the
crypto_ahash abstraction provides no value.  Add
skb_copy_and_crc32c_datagram_iter() which just calls crc32c() directly.

This is faster and simpler.  It also doesn't have the weird dependency
issue where skb_copy_and_hash_datagram_iter() depends on
CONFIG_CRYPTO_HASH=y without that being expressed explicitly in the
kconfig (presumably because it was too heavyweight for NET to select).
The new function is conditional on the hidden boolean symbol NET_CRC32C,
which selects CRC32.  So it gets compiled only when something that
actually needs CRC32C packet checksums is enabled, it has no implicit
dependency, and it doesn't depend on the heavyweight crypto layer.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Link: https://patch.msgid.link/20250519175012.36581-9-ebiggers@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
include/linux/skbuff.h
net/core/datagram.c