mirror of
https://github.com/torvalds/linux.git
synced 2026-09-25 17:42:03 +02:00
RDMA/rxe: switch to using the crc32 library
Now that the crc32_le() library function takes advantage of architecture-specific optimizations, it is unnecessary to go through the crypto API. Just use crc32_le(). This is much simpler, and it improves performance due to eliminating the crypto API overhead. Signed-off-by: Eric Biggers <ebiggers@google.com> Link: https://patch.msgid.link/20250207032316.53941-1-ebiggers@kernel.org Reviewed-by: Zhu Yanjun <yanjun.zhu@linux.dev> Signed-off-by: Leon Romanovsky <leon@kernel.org>
This commit is contained in:
parent
79bccd7461
commit
ccca5e8aa1
|
|
@ -4,8 +4,7 @@ config RDMA_RXE
|
||||||
depends on INET && PCI && INFINIBAND
|
depends on INET && PCI && INFINIBAND
|
||||||
depends on INFINIBAND_VIRT_DMA
|
depends on INFINIBAND_VIRT_DMA
|
||||||
select NET_UDP_TUNNEL
|
select NET_UDP_TUNNEL
|
||||||
select CRYPTO
|
select CRC32
|
||||||
select CRYPTO_CRC32
|
|
||||||
help
|
help
|
||||||
This driver implements the InfiniBand RDMA transport over
|
This driver implements the InfiniBand RDMA transport over
|
||||||
the Linux network stack. It enables a system with a
|
the Linux network stack. It enables a system with a
|
||||||
|
|
|
||||||
|
|
@ -31,9 +31,6 @@ void rxe_dealloc(struct ib_device *ib_dev)
|
||||||
|
|
||||||
WARN_ON(!RB_EMPTY_ROOT(&rxe->mcg_tree));
|
WARN_ON(!RB_EMPTY_ROOT(&rxe->mcg_tree));
|
||||||
|
|
||||||
if (rxe->tfm)
|
|
||||||
crypto_free_shash(rxe->tfm);
|
|
||||||
|
|
||||||
mutex_destroy(&rxe->usdev_lock);
|
mutex_destroy(&rxe->usdev_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,6 @@
|
||||||
#include <rdma/ib_umem.h>
|
#include <rdma/ib_umem.h>
|
||||||
#include <rdma/ib_cache.h>
|
#include <rdma/ib_cache.h>
|
||||||
#include <rdma/ib_addr.h>
|
#include <rdma/ib_addr.h>
|
||||||
#include <crypto/hash.h>
|
|
||||||
|
|
||||||
#include "rxe_net.h"
|
#include "rxe_net.h"
|
||||||
#include "rxe_opcode.h"
|
#include "rxe_opcode.h"
|
||||||
|
|
|
||||||
|
|
@ -9,28 +9,6 @@
|
||||||
#include "rxe.h"
|
#include "rxe.h"
|
||||||
#include "rxe_loc.h"
|
#include "rxe_loc.h"
|
||||||
|
|
||||||
/**
|
|
||||||
* rxe_icrc_init() - Initialize crypto function for computing crc32
|
|
||||||
* @rxe: rdma_rxe device object
|
|
||||||
*
|
|
||||||
* Return: 0 on success else an error
|
|
||||||
*/
|
|
||||||
int rxe_icrc_init(struct rxe_dev *rxe)
|
|
||||||
{
|
|
||||||
struct crypto_shash *tfm;
|
|
||||||
|
|
||||||
tfm = crypto_alloc_shash("crc32", 0, 0);
|
|
||||||
if (IS_ERR(tfm)) {
|
|
||||||
rxe_dbg_dev(rxe, "failed to init crc32 algorithm err: %ld\n",
|
|
||||||
PTR_ERR(tfm));
|
|
||||||
return PTR_ERR(tfm);
|
|
||||||
}
|
|
||||||
|
|
||||||
rxe->tfm = tfm;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* rxe_crc32() - Compute cumulative crc32 for a contiguous segment
|
* rxe_crc32() - Compute cumulative crc32 for a contiguous segment
|
||||||
* @rxe: rdma_rxe device object
|
* @rxe: rdma_rxe device object
|
||||||
|
|
@ -42,23 +20,7 @@ int rxe_icrc_init(struct rxe_dev *rxe)
|
||||||
*/
|
*/
|
||||||
static __be32 rxe_crc32(struct rxe_dev *rxe, __be32 crc, void *next, size_t len)
|
static __be32 rxe_crc32(struct rxe_dev *rxe, __be32 crc, void *next, size_t len)
|
||||||
{
|
{
|
||||||
__be32 icrc;
|
return (__force __be32)crc32_le((__force u32)crc, next, len);
|
||||||
int err;
|
|
||||||
|
|
||||||
SHASH_DESC_ON_STACK(shash, rxe->tfm);
|
|
||||||
|
|
||||||
shash->tfm = rxe->tfm;
|
|
||||||
*(__be32 *)shash_desc_ctx(shash) = crc;
|
|
||||||
err = crypto_shash_update(shash, next, len);
|
|
||||||
if (unlikely(err)) {
|
|
||||||
rxe_dbg_dev(rxe, "failed crc calculation, err: %d\n", err);
|
|
||||||
return (__force __be32)crc32_le((__force u32)crc, next, len);
|
|
||||||
}
|
|
||||||
|
|
||||||
icrc = *(__be32 *)shash_desc_ctx(shash);
|
|
||||||
barrier_data(shash_desc_ctx(shash));
|
|
||||||
|
|
||||||
return icrc;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -168,7 +168,6 @@ int rxe_sender(struct rxe_qp *qp);
|
||||||
int rxe_receiver(struct rxe_qp *qp);
|
int rxe_receiver(struct rxe_qp *qp);
|
||||||
|
|
||||||
/* rxe_icrc.c */
|
/* rxe_icrc.c */
|
||||||
int rxe_icrc_init(struct rxe_dev *rxe);
|
|
||||||
int rxe_icrc_check(struct sk_buff *skb, struct rxe_pkt_info *pkt);
|
int rxe_icrc_check(struct sk_buff *skb, struct rxe_pkt_info *pkt);
|
||||||
void rxe_icrc_generate(struct sk_buff *skb, struct rxe_pkt_info *pkt);
|
void rxe_icrc_generate(struct sk_buff *skb, struct rxe_pkt_info *pkt);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <linux/skbuff.h>
|
#include <linux/skbuff.h>
|
||||||
#include <crypto/hash.h>
|
|
||||||
|
|
||||||
#include "rxe.h"
|
#include "rxe.h"
|
||||||
#include "rxe_loc.h"
|
#include "rxe_loc.h"
|
||||||
|
|
|
||||||
|
|
@ -1546,10 +1546,6 @@ int rxe_register_device(struct rxe_dev *rxe, const char *ibdev_name,
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
err = rxe_icrc_init(rxe);
|
|
||||||
if (err)
|
|
||||||
return err;
|
|
||||||
|
|
||||||
err = ib_register_device(dev, ibdev_name, NULL);
|
err = ib_register_device(dev, ibdev_name, NULL);
|
||||||
if (err)
|
if (err)
|
||||||
rxe_dbg_dev(rxe, "failed with error %d\n", err);
|
rxe_dbg_dev(rxe, "failed with error %d\n", err);
|
||||||
|
|
|
||||||
|
|
@ -404,7 +404,6 @@ struct rxe_dev {
|
||||||
atomic64_t stats_counters[RXE_NUM_OF_COUNTERS];
|
atomic64_t stats_counters[RXE_NUM_OF_COUNTERS];
|
||||||
|
|
||||||
struct rxe_port port;
|
struct rxe_port port;
|
||||||
struct crypto_shash *tfm;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static inline struct net_device *rxe_ib_device_get_netdev(struct ib_device *dev)
|
static inline struct net_device *rxe_ib_device_get_netdev(struct ib_device *dev)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user