From: Eric Biggers <ebiggers@kernel.org>
To: Bernard Metzler <bmt@zurich.ibm.com>,
Jason Gunthorpe <jgg@ziepe.ca>, Leon Romanovsky <leon@kernel.org>,
linux-rdma@vger.kernel.org
Cc: linux-crypto@vger.kernel.org
Subject: [PATCH] RDMA/siw: use crypto_shash_digest() in siw_qp_prepare_tx()
Date: Sat, 28 Oct 2023 21:58:39 -0700 [thread overview]
Message-ID: <20231029045839.154071-1-ebiggers@kernel.org> (raw)
From: Eric Biggers <ebiggers@google.com>
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>
---
drivers/infiniband/sw/siw/siw_qp_tx.c | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/drivers/infiniband/sw/siw/siw_qp_tx.c b/drivers/infiniband/sw/siw/siw_qp_tx.c
index 60b6a4135961..5b390f08f1cd 100644
--- a/drivers/infiniband/sw/siw/siw_qp_tx.c
+++ b/drivers/infiniband/sw/siw/siw_qp_tx.c
@@ -242,28 +242,24 @@ static int siw_qp_prepare_tx(struct siw_iwarp_tx *c_tx)
c_tx->pkt.c_untagged.ddp_mo = 0;
else
c_tx->pkt.c_tagged.ddp_to =
cpu_to_be64(wqe->sqe.raddr);
}
*(u32 *)crc = 0;
/*
* Do complete CRC if enabled and short packet
*/
- if (c_tx->mpa_crc_hd) {
- crypto_shash_init(c_tx->mpa_crc_hd);
- if (crypto_shash_update(c_tx->mpa_crc_hd,
- (u8 *)&c_tx->pkt,
- c_tx->ctrl_len))
- return -EINVAL;
- crypto_shash_final(c_tx->mpa_crc_hd, (u8 *)crc);
- }
+ if (c_tx->mpa_crc_hd &&
+ crypto_shash_digest(c_tx->mpa_crc_hd, (u8 *)&c_tx->pkt,
+ c_tx->ctrl_len, (u8 *)crc) != 0)
+ return -EINVAL;
c_tx->ctrl_len += MPA_CRC_SIZE;
return PKT_COMPLETE;
}
c_tx->ctrl_len += MPA_CRC_SIZE;
c_tx->sge_idx = 0;
c_tx->sge_off = 0;
c_tx->pbl_idx = 0;
/*
base-commit: 2af9b20dbb39f6ebf9b9b6c090271594627d818e
--
2.42.0
next reply other threads:[~2023-10-29 4:59 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-29 4:58 Eric Biggers [this message]
2023-10-30 13:04 ` [PATCH] RDMA/siw: use crypto_shash_digest() in siw_qp_prepare_tx() Bernard Metzler
2023-11-13 8:39 ` Leon Romanovsky
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=20231029045839.154071-1-ebiggers@kernel.org \
--to=ebiggers@kernel.org \
--cc=bmt@zurich.ibm.com \
--cc=jgg@ziepe.ca \
--cc=leon@kernel.org \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
/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