Re: [for-next PATCH v6 09/10] RDMA/cm: Make QP FLUSHABLE

Jason Gunthorpe
2022-12-05T17:13:06Z

On Mon, Dec 05, 2022 at 10:07:11AM +0000, lizhijian@fujitsu.com wrote:
> diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c
> index 1f9938a2c475..603c0aecc361 100644
> --- a/drivers/infiniband/core/cm.c
> +++ b/drivers/infiniband/core/cm.c
> @@ -4094,9 +4094,18 @@ static int cm_init_qp_init_attr(struct cm_id_private *cm_id_priv,
> *qp_attr_mask = IB_QP_STATE | IB_QP_ACCESS_FLAGS |
> IB_QP_PKEY_INDEX | IB_QP_PORT;
> qp_attr->qp_access_flags = IB_ACCESS_REMOTE_WRITE;
> - if (cm_id_priv->responder_resources)
> + if (cm_id_priv->responder_resources) {
> + struct ib_device *ib_dev = cm_id_priv->id.device;
> + u64 support_flush = ib_dev->attrs.device_cap_flags &
> + (IB_DEVICE_FLUSH_GLOBAL | IB_DEVICE_FLUSH_PERSISTENT);
> + u32 flushable = support_flush ?
> + (IB_ACCESS_FLUSH_GLOBAL |
> + IB_ACCESS_FLUSH_PERSISTENT) : 0;
> +
> qp_attr->qp_access_flags |= IB_ACCESS_REMOTE_READ |
> - IB_ACCESS_REMOTE_ATOMIC;
> + IB_ACCESS_REMOTE_ATOMIC |
> + flushable;
> + }

This makes more sense

Jason