From patchwork Fri May 12 09:22:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Junxian Huang X-Patchwork-Id: 93023 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp4963561vqo; Fri, 12 May 2023 02:29:16 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4c9D7/ebBgHQzBhXx6BP/aZVRP+dK+qsA5rB4YCCSL64+QxIwPjIxojy0f76geDf6caSTr X-Received: by 2002:a05:6a20:8f22:b0:101:1e75:78e with SMTP id b34-20020a056a208f2200b001011e75078emr15028194pzk.14.1683883755791; Fri, 12 May 2023 02:29:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683883755; cv=none; d=google.com; s=arc-20160816; b=GMsCQy5iTYXOlu8Ice9jHNCeFYzAt90RqlXYGlLqfZ6/XUf6LYCu/DkQ24c93AWOSH d8hvQfYgqMfU3zF3TSyacEnqrcmf0jzynPTVmpucGUGXe04eovztVmImM5WLXMJj4crV B3T72d4maul3sO9PWqxrQSUIaC/ojhih4YGvXdEQfcF4oGqO1lbhwIWP+VgivnjiCB5Z cYbKeGzOLpKAsQr7+TnR/XkSijXSWdpocFkeUoVJsGSf8mQ/SWv9WkH33taLRXCv4T7P SSO6oYZciPJYCyJbypSXDS5vx1i7JyMKp1TrYEbTq7dLS8goDh7qoovkuha7wrdNNEhh ZDJg== 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=keSj7gso6oNcPhnQregp1xwwMHcyfIERttnbPX4KvJ8=; b=petddvHZFBKPtq8uFDd1PXgIHMmWjksxQUd3o3Vllf9TpPZgKaw5M422NWF1/BbXtt ESLc29/7q+a6/S9OSTNRxReTfFe70mN4IpBdMEM0vEEV48lnrsigt8BZ8Z7VtKK7hiC4 00Jwtvpe99OiV0F3rbtGqoR9JZ92CF8pwoZoXXXNjDsyw/TdI3gJXyB+e5qOJLnjsxGN 09lyURkuHlVbySDNHDXuSxBfcdlG/DGmZA6uf9eT66CCSyGmV0L8SRAxjc1HNpmGRKeM h0PimTcmcNuCNl4Us44xj6VcZ+CB11SL5laUty8aUmvSy3WhH4IUof2TK3GqnZ9OAeIP e59A== 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 o28-20020a637e5c000000b00513f15fed67si8677426pgn.517.2023.05.12.02.29.02; Fri, 12 May 2023 02:29:15 -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 S240429AbjELJYy (ORCPT + 99 others); Fri, 12 May 2023 05:24:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53280 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240276AbjELJYs (ORCPT ); Fri, 12 May 2023 05:24:48 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 80DEB100DD; Fri, 12 May 2023 02:24:47 -0700 (PDT) Received: from kwepemi500006.china.huawei.com (unknown [172.30.72.56]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4QHjsJ66SJzTkdb; Fri, 12 May 2023 17:20:04 +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.23; Fri, 12 May 2023 17:24:45 +0800 From: Junxian Huang To: , CC: , , , Subject: [PATCH for-rc 3/3] RDMA/hns: Modify the value of long message loopback slice Date: Fri, 12 May 2023 17:22:45 +0800 Message-ID: <20230512092245.344442-4-huangjunxian6@hisilicon.com> X-Mailer: git-send-email 2.30.0 In-Reply-To: <20230512092245.344442-1-huangjunxian6@hisilicon.com> References: <20230512092245.344442-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=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, 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: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1765680093007107655?= X-GMAIL-MSGID: =?utf-8?q?1765680093007107655?= From: Yangyang Li Long message loopback slice is used for achieving traffic balance between QPs. It prevents the problem that QPs with large traffic occupying the hardware pipeline for a long time and QPs with small traffic cannot be scheduled. Currently, its maximum value is set to 16K, which means only after a QP sends 16K will the second QP be scheduled. This value is too large, which will lead to unbalanced traffic scheduling, and thus it needs to be modified. The setting range of the long message loopback slice is modified to be from 1024 (the lower limit supported by hardware) to mtu. Actual testing shows that this value can significantly reduce error in hardware traffic scheduling. This solution is compatible with both HIP08 and HIP09. The modified lp_pktn_ini has a maximum value of 2 (when mtu is 256), so the range checking code for lp_pktn_ini is no longer necessary and needs to be deleted. Fixes: 0e60778efb07 ("RDMA/hns: Modify the value of MAX_LP_MSG_LEN to meet hardware compatibility") Signed-off-by: Yangyang Li Signed-off-by: Junxian Huang --- drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c index 3a1c90406ed9..d4c6b9bc0a4e 100644 --- a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c +++ b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c @@ -4583,11 +4583,9 @@ static int modify_qp_init_to_rtr(struct ib_qp *ibqp, mtu = ib_mtu_enum_to_int(ib_mtu); if (WARN_ON(mtu <= 0)) return -EINVAL; -#define MAX_LP_MSG_LEN 16384 - /* MTU * (2 ^ LP_PKTN_INI) shouldn't be bigger than 16KB */ - lp_pktn_ini = ilog2(MAX_LP_MSG_LEN / mtu); - if (WARN_ON(lp_pktn_ini >= 0xF)) - return -EINVAL; +#define MIN_LP_MSG_LEN 1024 + /* mtu * (2 ^ lp_pktn_ini) should be in the range of 1024 to mtu */ + lp_pktn_ini = ilog2(max(mtu, MIN_LP_MSG_LEN) / mtu); if (attr_mask & IB_QP_PATH_MTU) { hr_reg_write(context, QPC_MTU, ib_mtu);