RDMA/irdma: use crypto_shash_digest() in irdma_ieq_check_mpacrc()
Subsystems (3)
PATCH 1/1 RDMA/irdma: use crypto_shash_digest() in irdma_ieq_check_mpacrc()
From: Eric Biggers <[email protected]>
Simplify irdma_ieq_check_mpacrc() by using crypto_shash_digest() instead of an init+update+final sequence. This should also improve performance.
Signed-off-by Eric Biggers <[email protected]>
--- drivers/infiniband/hw/irdma/utils.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-)
drivers/infiniband/hw/irdma/utils.c +3 -8
@@ -1386,31 +1386,26 @@ void irdma_free_hash_desc(struct shash_desc *desc)* irdma_ieq_check_mpacrc - check if mpa crc is OK * @desc: desc for hash * @addr: address of buffer for crc * @len: length of buffer * @val: value to be compared */ int irdma_ieq_check_mpacrc (struct shash_desc *desc,void *addr,u32 len,u32 val) {u32 crc =0 ; -int ret; -int ret_code =0 ; -crypto_shash_init (desc); - ret =crypto_shash_update (desc, addr, len); -if (!ret) -crypto_shash_final (desc, (u8 *)&crc); +crypto_shash_digest (desc, addr, len, (u8 *)&crc);if (crc != val) - ret_code = -EINVAL ; +return -EINVAL ; -return ret_code; +return 0 ; }/** * irdma_ieq_get_qp - get qp based on quad in puda buffer * @dev: hardware control device structure * @buf: receive puda buffer on exception q */ struct irdma_sc_qp *irdma_ieq_get_qp (struct irdma_sc_dev *dev,struct irdma_puda_buf *buf) {
base-commit: 2af9b20dbb39f6ebf9b9b6c090271594627d818e
Signature · 1 line
2.42.0
Leon Romanovsky
AppliedQuoted 4 lines · Eric Biggers
Simplify
irdma_ieq_check_mpacrc()by usingcrypto_shash_digest()instead of an init+update+final sequence. This should also improve performance.
Applied, thanks!
[1/1] RDMA/irdma: use crypto_shash_digest() in irdma_ieq_check_mpacrc()
https://git.kernel.org/rdma/rdma/c/42c9ce5203de6d
Best regards,
Signature · 1 line
Leon Romanovsky <[email protected]>