Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp10017998rwr; Fri, 12 May 2023 02:34:35 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7/cTKV4GhvOKngs/AhlYkqPuTqGKNU8xD87T50PxrR/5esvphF3XWwgWhChhmjEfdyZiDY X-Received: by 2002:a17:90a:a595:b0:247:14ac:4d3a with SMTP id b21-20020a17090aa59500b0024714ac4d3amr27906271pjq.20.1683884075054; Fri, 12 May 2023 02:34:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683884075; cv=none; d=google.com; s=arc-20160816; b=eBtrHZ7cCEACuv3kh76G+3rLz/av8MNnCrVEUpUUHLRfWo+U6pGSl6P7h5xr05C/tU D2ASRwpmL0JR6LoIKX67yxQkHZ1BJuvckdDGD4et1weGQGxXwJDohK8lJfNaMzkbOVAX ioecBh76OygCyx2JnxdKQgqKlwvImMOM1aeLiETTtHf1cvk20qHGMvoVvPyOXw3jzn86 fJ6gdU7h4tB/sLtm/KVSU0RKHS9MwL4QnAyN1ZoewGgnUKGQ+myzltuPEL9lDvmyuVw1 biwVVqtGZ5EYNQfdmAyleZkREpOLE715d0x9BexRS71tnIFBINzAYl5VobjMnKpfKVFG s+Uw== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x7-20020a17090a2b0700b0024e43558fbdsi21998276pjc.129.2023.05.12.02.34.23; Fri, 12 May 2023 02:34:35 -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 S240426AbjELJYx (ORCPT + 99 others); Fri, 12 May 2023 05:24:53 -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 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=-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 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); -- 2.30.0