]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
RDMA/siw: use skb_crc32c() instead of __skb_checksum()
authorEric Biggers <ebiggers@google.com>
Mon, 19 May 2025 17:50:06 +0000 (10:50 -0700)
committerJakub Kicinski <kuba@kernel.org>
Wed, 21 May 2025 22:40:05 +0000 (15:40 -0700)
Instead of calling __skb_checksum() with a skb_checksum_ops struct that
does CRC32C, just call the new function skb_crc32c().  This is faster
and simpler.

Acked-by: Leon Romanovsky <leon@kernel.org>
Reviewed-by: Bernard Metzler <bmt@zurich.ibm.com>
Signed-off-by: Eric Biggers <ebiggers@google.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
Link: https://patch.msgid.link/20250519175012.36581-5-ebiggers@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/infiniband/sw/siw/Kconfig
drivers/infiniband/sw/siw/siw.h

index ae4a953e2a039de8fdc8bd90f6c2fba38622412d..186f182b80e7947efeabe8bb67844c30751ae34e 100644 (file)
@@ -3,6 +3,7 @@ config RDMA_SIW
        depends on INET && INFINIBAND
        depends on INFINIBAND_VIRT_DMA
        select CRC32
+       select NET_CRC32C
        help
        This driver implements the iWARP RDMA transport over
        the Linux TCP/IP network stack. It enables a system with a
index 385067e07faf190c05f478bb8a29479e38af8562..d9e5a2e4c471a4a47151a176dd789d4200a43802 100644 (file)
@@ -693,29 +693,9 @@ static inline void siw_crc_oneshot(const void *data, size_t len, u8 out[4])
        return siw_crc_final(&crc, out);
 }
 
-static inline __wsum siw_csum_update(const void *buff, int len, __wsum sum)
-{
-       return (__force __wsum)crc32c((__force __u32)sum, buff, len);
-}
-
-static inline __wsum siw_csum_combine(__wsum csum, __wsum csum2, int offset,
-                                     int len)
-{
-       return (__force __wsum)crc32c_combine((__force __u32)csum,
-                                             (__force __u32)csum2, len);
-}
-
 static inline void siw_crc_skb(struct siw_rx_stream *srx, unsigned int len)
 {
-       const struct skb_checksum_ops siw_cs_ops = {
-               .update = siw_csum_update,
-               .combine = siw_csum_combine,
-       };
-       __wsum crc = (__force __wsum)srx->mpa_crc;
-
-       crc = __skb_checksum(srx->skb, srx->skb_offset, len, crc,
-                            &siw_cs_ops);
-       srx->mpa_crc = (__force u32)crc;
+       srx->mpa_crc = skb_crc32c(srx->skb, srx->skb_offset, len, srx->mpa_crc);
 }
 
 #define siw_dbg(ibdev, fmt, ...)                                               \