From patchwork Fri Aug 4 01:27:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Junxian Huang X-Patchwork-Id: 130902 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f41:0:b0:3e4:2afc:c1 with SMTP id v1csp1519358vqx; Thu, 3 Aug 2023 18:51:08 -0700 (PDT) X-Google-Smtp-Source: APBJJlEUDGnQAwl/L7d/fg3QyaZ0WPpgMWcp39ukFSH7pH1BZ2YFF+CFKcqTfLodLz9KXw71SEBt X-Received: by 2002:a05:6402:4404:b0:522:e6b0:8056 with SMTP id y4-20020a056402440400b00522e6b08056mr8012415eda.4.1691113867850; Thu, 03 Aug 2023 18:51:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691113867; cv=none; d=google.com; s=arc-20160816; b=lbq7kOLbmI1lm+Svgz92vSGRHxI27K9WNI3Nm3ihrTHpfRNLuYAhFLe5KmmAs0G1po D/PkJVKdqxcJ/Wqxlhxw0+UVaHNVMJlDADT+QAuepClUieTk5cF0ijeFmr0BbygnbvSV DV1o+kS0qo1+QI6MVuszvs6aAYCPBq6aKwTke0dDl/cg6Gx9w1zqghF7Fouv7vRyut6g rSC1ji8TSQzGy9tpVj0BuJVVzVHbSEKdtCsEZLqHOB8DDXK3MTRn0erk/Ct7dYrlkDbu O7tAELp7p8BPUQil11kRmNnya6XJ710kDUs1TsqoYEyhJBd/gk+PYJhfAdnuEEnTa0TF fOIQ== 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=sathpuJJGnJwsx56gLtTBSS97ujmKRCdiTQe0hPK+BA=; fh=3H3oLXANh5v13tjHxrBYuXblpWbB01kHKe+fQJ1oJi8=; b=Bp0WmebZ2yxXgWZsnQ5SrbN/g3MerQmP8Cx2biCMkDKNeLqwbWt6Xsb+dpVVbkdZ2s Po+avMW1UMusGrurcbbZhgLAxmCJMPX8Rr/4i5/hBOI5ZQMaVapUXuJtWRQShkKDnAXz IDLsB1Ov1foaCKv2n7sS6txb56n1fPzbnzjRNgPbQAhmLqMV7YoqSnCbyUE+Lr/tDkMI kju+QrcTWSEgTM3MW8BLbnW10EkjU25BdcNw/myW+htRvcfMTolPuQ70pYJrsfPRJHZS EvPaTMqtv6ZZrl1rbvJ9EqIgvgwB2rpCJdzhOIOofOuRos6TN/VQUUKsSmQBYzyCPCNr I9/A== 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=hisilicon.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bc20-20020a056402205400b00522ab076c25si705105edb.141.2023.08.03.18.50.44; Thu, 03 Aug 2023 18:51:07 -0700 (PDT) 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=hisilicon.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231382AbjHDBaD (ORCPT + 99 others); Thu, 3 Aug 2023 21:30:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50308 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231824AbjHDB3y (ORCPT ); Thu, 3 Aug 2023 21:29:54 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1FAD24481; Thu, 3 Aug 2023 18:29:53 -0700 (PDT) Received: from kwepemi500006.china.huawei.com (unknown [172.30.72.54]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4RH7Qk3QmbzrS0S; Fri, 4 Aug 2023 09:28:46 +0800 (CST) Received: from localhost.localdomain (10.67.165.2) by kwepemi500006.china.huawei.com (7.221.188.68) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Fri, 4 Aug 2023 09:29:50 +0800 From: Junxian Huang To: , CC: , , , Subject: [PATCH for-rc 2/4] RDMA/hns: Fix incorrect post-send with direct wqe of wr-list Date: Fri, 4 Aug 2023 09:27:09 +0800 Message-ID: <20230804012711.808069-3-huangjunxian6@hisilicon.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20230804012711.808069-1-huangjunxian6@hisilicon.com> References: <20230804012711.808069-1-huangjunxian6@hisilicon.com> MIME-Version: 1.0 X-Originating-IP: [10.67.165.2] X-ClientProxiedBy: dggems704-chm.china.huawei.com (10.3.19.181) To kwepemi500006.china.huawei.com (7.221.188.68) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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: INBOX X-GMAIL-THRID: 1773261415344411967 X-GMAIL-MSGID: 1773261415344411967 Currently, direct wqe is not supported for wr-list. RoCE driver excludes direct wqe for wr-list by judging whether the number of wr is 1. For a wr-list where the second wr is a length-error atomic wr, the post-send driver handles the first wr and adds 1 to the wr number counter firstly. While handling the second wr, the driver finds out a length error and terminates the wr handle process, remaining the counter at 1. This causes the driver mistakenly judges there is only 1 wr and thus enters the direct wqe process, carrying the current length-error atomic wqe. This patch fixes the error by adding a judgement whether the current wr is a bad wr. If so, use the normal doorbell process but not direct wqe despite the wr number is 1. Fixes: 01584a5edcc4 ("RDMA/hns: Add support of direct wqe") Signed-off-by: Junxian Huang --- drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c index 8f7eb11066b4..f95551b6d407 100644 --- a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c +++ b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c @@ -750,7 +750,8 @@ static int hns_roce_v2_post_send(struct ib_qp *ibqp, qp->sq.head += nreq; qp->next_sge = sge_idx; - if (nreq == 1 && (qp->en_flags & HNS_ROCE_QP_CAP_DIRECT_WQE)) + if (nreq == 1 && !ret && + (qp->en_flags & HNS_ROCE_QP_CAP_DIRECT_WQE)) write_dwqe(hr_dev, qp, wqe); else update_sq_db(hr_dev, qp);