From patchwork Tue Dec 6 13:02:00 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zhijian Li (Fujitsu)" X-Patchwork-Id: 30290 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2809422wrr; Tue, 6 Dec 2022 05:08:54 -0800 (PST) X-Google-Smtp-Source: AA0mqf5iN/PQeGAtuTXM/cKgxPXR6tH8olVb6kAQXSSqjsHU+3QaplE/ooaQRmkhLw64uXy4WTkT X-Received: by 2002:a17:906:f0da:b0:7c0:d609:4120 with SMTP id dk26-20020a170906f0da00b007c0d6094120mr11855684ejb.320.1670332134733; Tue, 06 Dec 2022 05:08:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670332134; cv=none; d=google.com; s=arc-20160816; b=M7Q94O0oZnruIpg6jEfb5mBAr7GcdTsgB1YNZCP74vG2yLNdDfYwS+ZL9ck6ASEhOH +r/LaQYQkDGQJTnA0vMAaNIs0L14fIcuHslU/1EqwqaVNQhXqTQoz12GesImnggpSQC2 25o7hHhiD7tpKzTcfAQEHt33vRV8LT3x4AOyXGrZYoQo8zTMJDwibN8zMeknQmZCakhi HFtfaIYxv9ZgUpNoeeOv/ksZd+t+iou85VAg1YylOGxg/EVRI8INNdEfGzgWv8V9il6f JosJWwBC+oZUfmDVsSi1FMs7/QZcrW4kzT2Lmk6KAY+oZ84J+2ZTswLBYWsh2lObC4+L 6XRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=XllqzXr2aEBzKWNoQ15JAv4SZVIV5llhYv6ROV3SyhM=; b=VIFwajSp4cEcOyi1fUr0Zt5rQBBRdb3ikgHEiQ5r9RRyYrM/F+W/1Sx8f5PFjdoefo 4IW1TZcj04HMA8mGf8TU+/Tm5iDa/hKosgxlsquiMeR1LnUu4XMjPwXwh8DbaaEww3Nj WllXU90scMTnAh+KZyjRfA3YSRitXuwRMRlJEb27BU/GJe9S2uEx9fOWvS1HS4z8GeOj FGbFXcI2ljqg0KdcjZoujkMo8FZCRFkGC1O7vmIYCY+LYMYUd41aNT+qwI1aVr5kGxCp I19P9oYqpwL10qq45MBuM6UipgCt2jknpLbRlXWbB/p7BuZ1tvQTnfOEqNXS3/7VPgxW ZJ3g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=fujitsu.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b9-20020a056402278900b00461cb980126si2409815ede.309.2022.12.06.05.08.30; Tue, 06 Dec 2022 05:08:54 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=fujitsu.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234866AbiLFNDn (ORCPT + 99 others); Tue, 6 Dec 2022 08:03:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34612 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234893AbiLFNCY (ORCPT ); Tue, 6 Dec 2022 08:02:24 -0500 Received: from esa11.hc1455-7.c3s2.iphmx.com (esa11.hc1455-7.c3s2.iphmx.com [207.54.90.137]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 544F7D2E3; Tue, 6 Dec 2022 05:02:21 -0800 (PST) X-IronPort-AV: E=McAfee;i="6500,9779,10552"; a="78294263" X-IronPort-AV: E=Sophos;i="5.96,222,1665414000"; d="scan'208";a="78294263" Received: from unknown (HELO oym-r4.gw.nic.fujitsu.com) ([210.162.30.92]) by esa11.hc1455-7.c3s2.iphmx.com with ESMTP; 06 Dec 2022 22:02:20 +0900 Received: from oym-m2.gw.nic.fujitsu.com (oym-nat-oym-m2.gw.nic.fujitsu.com [192.168.87.59]) by oym-r4.gw.nic.fujitsu.com (Postfix) with ESMTP id 25E80DD994; Tue, 6 Dec 2022 22:02:19 +0900 (JST) Received: from kws-ab2.gw.nic.fujitsu.com (kws-ab2.gw.nic.fujitsu.com [192.51.206.12]) by oym-m2.gw.nic.fujitsu.com (Postfix) with ESMTP id 58D0EBF5E2; Tue, 6 Dec 2022 22:02:18 +0900 (JST) Received: from FNSTPC.g08.fujitsu.local (unknown [10.167.226.45]) by kws-ab2.gw.nic.fujitsu.com (Postfix) with ESMTP id 489A52340E31; Tue, 6 Dec 2022 22:02:17 +0900 (JST) From: Li Zhijian To: Bob Pearson , Leon Romanovsky , Jason Gunthorpe , linux-rdma@vger.kernel.org Cc: Zhu Yanjun , yangx.jy@fujitsu.com, y-goto@fujitsu.com, mbloch@nvidia.com, tom@talpey.com, tomasz.gromadzki@intel.com, dan.j.williams@intel.com, linux-kernel@vger.kernel.org, Li Zhijian Subject: [for-next PATCH 09/10] RDMA/cm: Make QP FLUSHABLE for supported device Date: Tue, 6 Dec 2022 21:02:00 +0800 Message-Id: <20221206130201.30986-10-lizhijian@fujitsu.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221206130201.30986-1-lizhijian@fujitsu.com> References: <20221206130201.30986-1-lizhijian@fujitsu.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-TM-AS-Product-Ver: IMSS-9.1.0.1408-9.0.0.1002-27306.007 X-TM-AS-User-Approved-Sender: Yes X-TMASE-Version: IMSS-9.1.0.1408-9.0.1002-27306.007 X-TMASE-Result: 10-3.491200-10.000000 X-TMASE-MatchedRID: XQoK3HqFntCNpmmKKDMxRBFbgtHjUWLym0H2L3kjQgqOVdQAiMmbZ7QS /KxKInUSGlIk2Jn88ims3cxFKjrJJg8rYO92b9NmTuctSpiuWyUUi4Ehat05499RlPzeVuQQupO isvffcFAeHbRWTn6MWgRwIKYSevfuJ1KOwNqVG3GhLSC6hXpJl3O1oaQ51CuNmyiLZetSf8mfop 0ytGwvXiq2rl3dzGQ1tSUt10mlRwOgEuuQp1ojSopZ99nU19O1dAvIodzvTTS4XTI5zHRVOjRsj qNLiyWSoijzbmPsL2EGPFNcHWllqqT0oCFWLSFCGIoA/ljtOSEVxRB/din+uJ07T8ZSLiAVvR84 /OmB1wQp4n8eQBnwiw== X-TMASE-SNAP-Result: 1.821001.0001-0-1-22:0,33:0,34:0-0 X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1751470188280775614?= X-GMAIL-MSGID: =?utf-8?q?1751470188280775614?= 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. Signed-off-by: Li Zhijian --- V7: enable flush for supported device only # Jason V5: new patch, inspired by Bob Signed-off-by: Li Zhijian --- drivers/infiniband/core/cm.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) 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; + } qp_attr->pkey_index = cm_id_priv->av.pkey_index; if (cm_id_priv->av.port) qp_attr->port_num = cm_id_priv->av.port->port_num;