Skip to content

Commit 8b4d379

Browse files
zhijianli88jgunthorpe
authored andcommitted
RDMA/cm: Make QP FLUSHABLE for supported device
Similar to RDMA and Atomic qp attributes enabled by default in CM, enable FLUSH attribute for supported device. That makes applications that are built with rdma_create_ep, rdma_accept APIs have FLUSH qp attribute natively so that user is able to request FLUSH operation simpler. Note that, a FLUSH operation requires FLUSH are supported by both device(HCA) and memory region(MR) and QP at the same time, so it's safe to enable FLUSH qp attribute by default here. FLUSH attribute can be disable by modify_qp() interface. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Li Zhijian <[email protected]> Signed-off-by: Jason Gunthorpe <[email protected]>
1 parent 70aad90 commit 8b4d379

File tree

1 file changed

+11
-2
lines changed
  • drivers/infiniband/core

1 file changed

+11
-2
lines changed

drivers/infiniband/core/cm.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4094,9 +4094,18 @@ static int cm_init_qp_init_attr(struct cm_id_private *cm_id_priv,
40944094
*qp_attr_mask = IB_QP_STATE | IB_QP_ACCESS_FLAGS |
40954095
IB_QP_PKEY_INDEX | IB_QP_PORT;
40964096
qp_attr->qp_access_flags = IB_ACCESS_REMOTE_WRITE;
4097-
if (cm_id_priv->responder_resources)
4097+
if (cm_id_priv->responder_resources) {
4098+
struct ib_device *ib_dev = cm_id_priv->id.device;
4099+
u64 support_flush = ib_dev->attrs.device_cap_flags &
4100+
(IB_DEVICE_FLUSH_GLOBAL | IB_DEVICE_FLUSH_PERSISTENT);
4101+
u32 flushable = support_flush ?
4102+
(IB_ACCESS_FLUSH_GLOBAL |
4103+
IB_ACCESS_FLUSH_PERSISTENT) : 0;
4104+
40984105
qp_attr->qp_access_flags |= IB_ACCESS_REMOTE_READ |
4099-
IB_ACCESS_REMOTE_ATOMIC;
4106+
IB_ACCESS_REMOTE_ATOMIC |
4107+
flushable;
4108+
}
41004109
qp_attr->pkey_index = cm_id_priv->av.pkey_index;
41014110
if (cm_id_priv->av.port)
41024111
qp_attr->port_num = cm_id_priv->av.port->port_num;

0 commit comments

Comments
 (0)