[PATCH rdma-next 07/13] RDMA/core: Add support for creating crypto enabled QPs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Israel Rukshin <israelr@xxxxxxxxxx>

Add a list of crypto MRs and introduce a crypto WR type to post
on those QPs.

Signed-off-by: Israel Rukshin <israelr@xxxxxxxxxx>
Signed-off-by: Leon Romanovsky <leon@xxxxxxxxxx>
---
 drivers/infiniband/core/verbs.c |  3 +++
 include/rdma/ib_verbs.h         | 12 +++++++++++-
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/drivers/infiniband/core/verbs.c b/drivers/infiniband/core/verbs.c
index 61473fee4b54..01aefff6760e 100644
--- a/drivers/infiniband/core/verbs.c
+++ b/drivers/infiniband/core/verbs.c
@@ -1223,6 +1223,7 @@ static struct ib_qp *create_qp(struct ib_device *dev, struct ib_pd *pd,
 	spin_lock_init(&qp->mr_lock);
 	INIT_LIST_HEAD(&qp->rdma_mrs);
 	INIT_LIST_HEAD(&qp->sig_mrs);
+	INIT_LIST_HEAD(&qp->crypto_mrs);
 
 	qp->send_cq = attr->send_cq;
 	qp->recv_cq = attr->recv_cq;
@@ -1363,6 +1364,8 @@ struct ib_qp *ib_create_qp_kernel(struct ib_pd *pd,
 				 device->attrs.max_sge_rd);
 	if (qp_init_attr->create_flags & IB_QP_CREATE_INTEGRITY_EN)
 		qp->integrity_en = true;
+	if (qp_init_attr->create_flags & IB_QP_CREATE_CRYPTO_EN)
+		qp->crypto_en = true;
 
 	return qp;
 
diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h
index 7507661c78d0..1770cd30c0f0 100644
--- a/include/rdma/ib_verbs.h
+++ b/include/rdma/ib_verbs.h
@@ -1175,6 +1175,8 @@ enum ib_qp_create_flags {
 	IB_QP_CREATE_INTEGRITY_EN		= 1ULL << 34,
 	/* Create an accelerated UD QP */
 	IB_QP_CREATE_NETDEV_USE			= 1ULL << 35,
+	/* The created QP can carry out cryptographic handover operations */
+	IB_QP_CREATE_CRYPTO_EN			= 1ULL << 36,
 };
 
 /*
@@ -1352,6 +1354,12 @@ enum ib_wr_opcode {
 	/* These are kernel only and can not be issued by userspace */
 	IB_WR_REG_MR = 0x20,
 	IB_WR_REG_MR_INTEGRITY,
+	/*
+	 * It is used to assign crypto properties to a MKey. Use the MKey in
+	 * any RDMA transaction (SEND/RECV/READ/WRITE) to encrypt/decrypt data
+	 * on-the-fly.
+	 */
+	IB_WR_REG_MR_CRYPTO,
 
 	/* reserve values for low level drivers' internal use.
 	 * These values will not be used at all in the ib core layer.
@@ -1800,6 +1808,7 @@ struct ib_qp {
 	int			mrs_used;
 	struct list_head	rdma_mrs;
 	struct list_head	sig_mrs;
+	struct list_head	crypto_mrs;
 	struct ib_srq	       *srq;
 	struct ib_xrcd	       *xrcd; /* XRC TGT QPs only */
 	struct list_head	xrcd_list;
@@ -1822,7 +1831,8 @@ struct ib_qp {
 	struct ib_qp_security  *qp_sec;
 	u32			port;
 
-	bool			integrity_en;
+	u8			integrity_en:1;
+	u8			crypto_en:1;
 	/*
 	 * Implementation details of the RDMA core, don't use in drivers:
 	 */
-- 
2.39.0




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux