scsi: iscsi_tcp: switch to using the crc32c library
PATCH 1/1 scsi: iscsi_tcp: switch to using the crc32c library
From: Eric Biggers <[email protected]>
Now that the crc32c() library function directly takes advantage of architecture-specific optimizations, it is unnecessary to go through the crypto API. Just use crc32c(). This is much simpler, and it improves performance due to eliminating the crypto API overhead.
--- drivers/scsi/Kconfig | 2 +- drivers/scsi/iscsi_tcp.c | 60 ++++-------------------- drivers/scsi/iscsi_tcp.h | 4 +- drivers/scsi/libiscsi_tcp.c | 91 ++++++++++++++++--------------------- include/scsi/libiscsi_tcp.h | 16 +++---- 5 files changed, 57 insertions(+), 116 deletions(-)
drivers/scsi/Kconfig +1 -1
@@ -301,13 +301,13 @@ menuconfig SCSI_LOWLEVEL if SCSI_LOWLEVEL && SCSI config ISCSI_TCP tristate "iSCSI Initiator over TCP/IP" depends on SCSI && INET + select CRC32 select CRYPTO select CRYPTO_MD5 - select CRYPTO_CRC32C select SCSI_ISCSI_ATTRS help The iSCSI Driver provides a host with the ability to access storage through an IP network. The driver uses the iSCSI protocol to transport SCSI requests and responses over a TCP/IP network between the host
drivers/scsi/iscsi_tcp.c +8 -52
156 lines not on this page · raw message
drivers/scsi/iscsi_tcp.h +2 -2
@@ -39,12 +39,12 @@ struct iscsi_sw_tcp_conn {void (*old_data_ready)(struct sock *);void (*old_state_change)(struct sock *);void (*old_write_space)(struct sock *);/* data and header digests */ -struct ahash_request *tx_hash;/* CRC32C (Tx) */ -struct ahash_request *rx_hash;/* CRC32C (Rx) */ +u32 tx_crc;/* CRC32C (Tx) */ +u32 rx_crc;/* CRC32C (Rx) */ /* MIB custom statistics */ uint32_t sendpage_failures_cnt;uint32_t discontiguous_hdr_cnt; };
drivers/scsi/libiscsi_tcp.c +40 -51
257 lines not on this page · raw message
include/scsi/libiscsi_tcp.h +6 -10
@@ -13,11 +13,10 @@#include <scsi/libiscsi.h> struct iscsi_tcp_conn ;struct iscsi_segment ;struct sk_buff ; -struct ahash_request ;typedef int iscsi_segment_done_fn_t (struct iscsi_tcp_conn *,struct iscsi_segment *);struct iscsi_segment {
@@ -25,11 +24,11 @@ struct iscsi_segment {unsigned int size;unsigned int copied;unsigned int total_size;unsigned int total_copied; -struct ahash_request *hash; +u32 *crcp;unsigned char padbuf[ISCSI_PAD_LEN ];unsigned char recv_digest[ISCSI_DIGEST_SIZE ];unsigned char digest[ISCSI_DIGEST_SIZE ];unsigned int digest_len;
@@ -59,12 +58,12 @@ struct iscsi_tcp_conn {int stop_stage;/* conn_stop() flag: * * stop to recover, * * stop to terminate */ /* control data */ struct iscsi_tcp_recv in;/* TCP receive context */ -/* CRC32C (Rx) LLD should set this is they do not offload */ -struct ahash_request *rx_hash; +/* CRC32C (Rx) LLD should set this if they do not offload */ +u32 *rx_crcp; };struct iscsi_tcp_task {uint32_t exp_datasn;/* expected target's R2TSN/DataSN */ int data_offset;
@@ -97,22 +96,19 @@ extern int iscsi_tcp_segment_done(struct iscsi_tcp_conn *tcp_conn, unsigned copied);extern void iscsi_tcp_segment_unmap (struct iscsi_segment *segment);extern void iscsi_segment_init_linear (struct iscsi_segment *segment,void *data,size_t size, -iscsi_segment_done_fn_t *done, -struct ahash_request *hash); +iscsi_segment_done_fn_t *done,u32 *crcp);extern int iscsi_segment_seek_sg (struct iscsi_segment *segment,struct scatterlist *sg_list,unsigned int sg_count,unsigned int offset,size_t size, -iscsi_segment_done_fn_t *done, -struct ahash_request *hash); +iscsi_segment_done_fn_t *done,u32 *crcp);/* digest helpers */ -extern void iscsi_tcp_dgst_header (struct ahash_request *hash,const void *hdr, -size_t hdrlen, +extern void iscsi_tcp_dgst_header (const void *hdr,size_t hdrlen,unsigned char digest[ISCSI_DIGEST_SIZE ]);extern struct iscsi_cls_conn *iscsi_tcp_conn_setup (struct iscsi_cls_session *cls_session,int dd_data_size,uint32_t conn_idx);extern void iscsi_tcp_conn_teardown (struct iscsi_cls_conn *cls_conn);
base-commit: 2014c95afecee3e76ca4a56956a936e23283f05b
Signature · 1 line
2.48.1
Martin K. Petersen
AppliedEric,
Quoted 4 lines
Now that the
crc32c()library function directly takes advantage of architecture-specific optimizations, it is unnecessary to go through the crypto API. Just usecrc32c(). This is much simpler, and it improves performance due to eliminating the crypto API overhead.
Applied to 6.15/scsi-staging, thanks!
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering
Martin K. Petersen
AppliedQuoted 6 lines · Eric Biggers
Now that the
crc32c()library function directly takes advantage of architecture-specific optimizations, it is unnecessary to go through the crypto API. Just usecrc32c(). This is much simpler, and it improves performance due to eliminating the crypto API overhead.
Applied to 6.15/scsi-queue, thanks!
[1/1] scsi: iscsi_tcp: switch to using the crc32c library
https://git.kernel.org/mkp/scsi/c/92186c1455a2
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering