@@ -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;
@@ -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:
*/