Commit b6c6cc4a authored by Bob Pearson's avatar Bob Pearson Committed by Jason Gunthorpe

RDMA/rxe: Move rxe_crc32 to a subroutine

Move rxe_crc32() from rxe.h to rxe_icrc.c as a static local function.

Link: https://lore.kernel.org/r/20210707040040.15434-6-rpearsonhpe@gmail.comSigned-off-by: default avatarBob Pearson <rpearsonhpe@gmail.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
parent 1117f26e
...@@ -42,27 +42,6 @@ ...@@ -42,27 +42,6 @@
extern bool rxe_initialized; extern bool rxe_initialized;
static inline u32 rxe_crc32(struct rxe_dev *rxe,
u32 crc, void *next, size_t len)
{
u32 retval;
int err;
SHASH_DESC_ON_STACK(shash, rxe->tfm);
shash->tfm = rxe->tfm;
*(u32 *)shash_desc_ctx(shash) = crc;
err = crypto_shash_update(shash, next, len);
if (unlikely(err)) {
pr_warn_ratelimited("failed crc calculation, err: %d\n", err);
return crc32_le(crc, next, len);
}
retval = *(u32 *)shash_desc_ctx(shash);
barrier_data(shash_desc_ctx(shash));
return retval;
}
void rxe_set_mtu(struct rxe_dev *rxe, unsigned int dev_mtu); void rxe_set_mtu(struct rxe_dev *rxe, unsigned int dev_mtu);
int rxe_add(struct rxe_dev *rxe, unsigned int mtu, const char *ibdev_name); int rxe_add(struct rxe_dev *rxe, unsigned int mtu, const char *ibdev_name);
......
...@@ -7,6 +7,27 @@ ...@@ -7,6 +7,27 @@
#include "rxe.h" #include "rxe.h"
#include "rxe_loc.h" #include "rxe_loc.h"
static u32 rxe_crc32(struct rxe_dev *rxe, u32 crc, void *next, size_t len)
{
u32 icrc;
int err;
SHASH_DESC_ON_STACK(shash, rxe->tfm);
shash->tfm = rxe->tfm;
*(u32 *)shash_desc_ctx(shash) = crc;
err = crypto_shash_update(shash, next, len);
if (unlikely(err)) {
pr_warn_ratelimited("failed crc calculation, err: %d\n", err);
return crc32_le(crc, next, len);
}
icrc = *(u32 *)shash_desc_ctx(shash);
barrier_data(shash_desc_ctx(shash));
return icrc;
}
/* Compute a partial ICRC for all the IB transport headers. */ /* Compute a partial ICRC for all the IB transport headers. */
u32 rxe_icrc_hdr(struct rxe_pkt_info *pkt, struct sk_buff *skb) u32 rxe_icrc_hdr(struct rxe_pkt_info *pkt, struct sk_buff *skb)
{ {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment