Received: by 2002:a05:6358:700f:b0:131:369:b2a3 with SMTP id 15csp2946463rwo; Thu, 3 Aug 2023 18:39:07 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH/bLpOWukiAq5YFNjMVOSCwzP1d8DUOhFDvEE6g8b6QzfTsE/wQHKNhE1+D4qik4WxoSG0 X-Received: by 2002:a05:6a00:9a0:b0:687:61f9:c4ef with SMTP id u32-20020a056a0009a000b0068761f9c4efmr513820pfg.15.1691113147136; Thu, 03 Aug 2023 18:39:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691113147; cv=none; d=google.com; s=arc-20160816; b=tNU9CY1hiGudFvU+Ep6wk1GYMmvnsxLSyNe0ICl3vhj5KhCsXIDRUAyivhHG/SeXaB zvVkyPkP9r3wP5tdsZt1JGBOw92yxIr+g/jef5Yfr4aWW15oFHDrOvRKIcrBgrWiUKL0 mFmMaK4nNJIU2vosPeIoMIq5Kkkg2rdNCn9l1VFzQoCtJFf11KYAXhQOplUsnyIzF8yF N9DGEEqkSwgqHJa+ih8AqPYY5W2S15OwM0yQF8XS87S6bwYALyIYESYBXcax/3Sz2oMX IISR9VTGq2Xp7A7Ye0hY2+e8suAAUKfafYwKxWvC0ap+rH9IdjPz0uUMhU7mZBQ0+nfA xA6Q== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ch12-20020a056a00288c00b00680a955d320si867687pfb.56.2023.08.03.18.38.54; Thu, 03 Aug 2023 18:39: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 S232456AbjHDBaD (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 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII 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 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); -- 2.30.0