1

RDMA/siw: Use crypto_shash_digest() in siw_qp_prepare_tx()

Simplify siw_qp_prepare_tx() by using crypto_shash_digest() instead of
an init+update+final sequence.  This should also improve performance.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Link: https://lore.kernel.org/r/20231029045839.154071-1-ebiggers@kernel.org
Acked-by: Bernard Metzler <bmt@zurich.ibm.com>
Signed-off-by: Leon Romanovsky <leon@kernel.org>
This commit is contained in:
Eric Biggers 2023-10-28 21:58:39 -07:00 committed by Leon Romanovsky
parent 48f996d4ad
commit 9aac6c05a5

View File

@ -249,14 +249,10 @@ static int siw_qp_prepare_tx(struct siw_iwarp_tx *c_tx)
/* /*
* Do complete CRC if enabled and short packet * Do complete CRC if enabled and short packet
*/ */
if (c_tx->mpa_crc_hd) { if (c_tx->mpa_crc_hd &&
crypto_shash_init(c_tx->mpa_crc_hd); crypto_shash_digest(c_tx->mpa_crc_hd, (u8 *)&c_tx->pkt,
if (crypto_shash_update(c_tx->mpa_crc_hd, c_tx->ctrl_len, (u8 *)crc) != 0)
(u8 *)&c_tx->pkt, return -EINVAL;
c_tx->ctrl_len))
return -EINVAL;
crypto_shash_final(c_tx->mpa_crc_hd, (u8 *)crc);
}
c_tx->ctrl_len += MPA_CRC_SIZE; c_tx->ctrl_len += MPA_CRC_SIZE;
return PKT_COMPLETE; return PKT_COMPLETE;