netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Biggers <ebiggers@kernel.org>
To: netdev@vger.kernel.org
Cc: linux-nvme@lists.infradead.org, linux-sctp@vger.kernel.org,
	linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org,
	Daniel Borkmann <daniel@iogearbox.net>,
	Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>,
	Sagi Grimberg <sagi@grimberg.me>,
	Ard Biesheuvel <ardb@kernel.org>,
	Bernard Metzler <bmt@zurich.ibm.com>
Subject: [PATCH v2 04/10] RDMA/siw: use skb_crc32c() instead of __skb_checksum()
Date: Mon, 19 May 2025 10:50:06 -0700	[thread overview]
Message-ID: <20250519175012.36581-5-ebiggers@kernel.org> (raw)
In-Reply-To: <20250519175012.36581-1-ebiggers@kernel.org>

From: Eric Biggers <ebiggers@google.com>

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.

Reviewed-by: Bernard Metzler <bmt@zurich.ibm.com>
Signed-off-by: Eric Biggers <ebiggers@google.com>
---
 drivers/infiniband/sw/siw/Kconfig |  1 +
 drivers/infiniband/sw/siw/siw.h   | 22 +---------------------
 2 files changed, 2 insertions(+), 21 deletions(-)

diff --git a/drivers/infiniband/sw/siw/Kconfig b/drivers/infiniband/sw/siw/Kconfig
index ae4a953e2a039..186f182b80e79 100644
--- a/drivers/infiniband/sw/siw/Kconfig
+++ b/drivers/infiniband/sw/siw/Kconfig
@@ -1,10 +1,11 @@
 config RDMA_SIW
 	tristate "Software RDMA over TCP/IP (iWARP) driver"
 	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
 	standard Ethernet adapter to interoperate with a iWARP
 	adapter or with another system running the SIW driver.
diff --git a/drivers/infiniband/sw/siw/siw.h b/drivers/infiniband/sw/siw/siw.h
index 385067e07faf1..d9e5a2e4c471a 100644
--- a/drivers/infiniband/sw/siw/siw.h
+++ b/drivers/infiniband/sw/siw/siw.h
@@ -691,33 +691,13 @@ static inline void siw_crc_oneshot(const void *data, size_t len, u8 out[4])
 	siw_crc_init(&crc);
 	siw_crc_update(&crc, data, len);
 	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, ...)                                               \
 	ibdev_dbg(ibdev, "%s: " fmt, __func__, ##__VA_ARGS__)
 
-- 
2.49.0


  parent reply	other threads:[~2025-05-19 17:51 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-19 17:50 [PATCH v2 00/10] net: faster and simpler CRC32C computation Eric Biggers
2025-05-19 17:50 ` [PATCH v2 01/10] net: introduce CONFIG_NET_CRC32C Eric Biggers
2025-05-21 10:09   ` Hannes Reinecke
2025-05-19 17:50 ` [PATCH v2 02/10] net: add skb_crc32c() Eric Biggers
2025-05-21 10:12   ` Hannes Reinecke
2025-05-19 17:50 ` [PATCH v2 03/10] net: use skb_crc32c() in skb_crc32c_csum_help() Eric Biggers
2025-05-21 10:13   ` Hannes Reinecke
2025-05-19 17:50 ` Eric Biggers [this message]
2025-05-21 10:13   ` [PATCH v2 04/10] RDMA/siw: use skb_crc32c() instead of __skb_checksum() Hannes Reinecke
2025-05-19 17:50 ` [PATCH v2 05/10] sctp: " Eric Biggers
2025-05-21 10:14   ` Hannes Reinecke
2025-05-19 17:50 ` [PATCH v2 06/10] net: fold __skb_checksum() into skb_checksum() Eric Biggers
2025-05-21 10:14   ` Hannes Reinecke
2025-05-19 17:50 ` [PATCH v2 07/10] lib/crc32: remove unused support for CRC32C combination Eric Biggers
2025-05-21 10:15   ` Hannes Reinecke
2025-05-19 17:50 ` [PATCH v2 08/10] net: add skb_copy_and_crc32c_datagram_iter() Eric Biggers
2025-05-21 10:16   ` Hannes Reinecke
2025-05-19 17:50 ` [PATCH v2 09/10] nvme-tcp: use crc32c() and skb_copy_and_crc32c_datagram_iter() Eric Biggers
2025-05-21 10:17   ` Hannes Reinecke
2025-05-19 17:50 ` [PATCH v2 10/10] net: remove skb_copy_and_hash_datagram_iter() Eric Biggers
2025-05-21 10:17   ` Hannes Reinecke
2025-05-22 14:07 ` [PATCH v2 00/10] net: faster and simpler CRC32C computation Jakub Kicinski

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=20250519175012.36581-5-ebiggers@kernel.org \
    --to=ebiggers@kernel.org \
    --cc=ardb@kernel.org \
    --cc=bmt@zurich.ibm.com \
    --cc=daniel@iogearbox.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nvme@lists.infradead.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=linux-sctp@vger.kernel.org \
    --cc=marcelo.leitner@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=sagi@grimberg.me \
    /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).