Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9110431pxu; Mon, 28 Dec 2020 06:55:08 -0800 (PST) X-Google-Smtp-Source: ABdhPJwzX672O62cy7DGgtk9/uFDZWRGyUfb4Kor2YqMz9ZKSWzAQ1BxTauoXd8DP31pulbfxyGe X-Received: by 2002:a05:6402:129a:: with SMTP id w26mr43401019edv.355.1609167308425; Mon, 28 Dec 2020 06:55:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609167308; cv=none; d=google.com; s=arc-20160816; b=Ne+nONFpotofNZzPtNalBmyBOTaWPVulpi1M7t6LMrf67uoTeoWM80G/wJ0pXUTmuo VNn/wRkXPobHq6LliXam4yjsS8XD7oZdK329BVUxdnWp/JzD34duJITd+jDTuyAlj1N6 BKndc0WQW8a8CIyfIseWTwj3B4eEmXNc+K07IJSv3zhheeSPnx1k87ydmxgUoyy2qcnO LzNemWmso8SyyV59JnvnnBF0oFlEV/ONtkdpuzw2Zp2tionPO7uWWTjJqIRRt3yO/YDc JokwbL7pHUkVwl4L2MofuReBsTTfqg1+FcR7DIA+g/C9gSnGL5An5OfeYoh2KMAgyzrJ fbNA== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=uhw+Y/6zzg0LGZPsCaDlsH7neJTSh5RFqZdAFUDIZII=; b=InF7LwxC3O0MzM0eoDPL/b867LDSk8dLJGXpsHhkQu7D+jsRCDRllnnStSiXV0hMmo N+Y6QP6EJlwrOu1JE1fuNuwCOFPDiAqlBHlW+3ys5d/Nhljx/PVGgDjABT2VQdEqK1PD g8JiS2thMzR8fBQKhbZF8GXfkYzeTpAPlmF9qschMY+GjuRckXEXzakV6l3SGCSqTErV M8n2Q/lTsc8ayVp0RlFtjqFuKjhgwT0/ta5ZZIiuFCoVfPhU9xzJpsW6YSQmG1LiKao3 KEhgdUIj6kzzYfrSXZ9yZK4CGV3LQaxXjIyTFMp92mw3g4HHXZFQVSJCX9rMQUa/0hak JM1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=eVcvSznl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b7si20757445edq.548.2020.12.28.06.54.46; Mon, 28 Dec 2020 06:55:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=eVcvSznl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2441585AbgL1OTJ (ORCPT + 99 others); Mon, 28 Dec 2020 09:19:09 -0500 Received: from mail.kernel.org ([198.145.29.99]:53456 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2440595AbgL1OTG (ORCPT ); Mon, 28 Dec 2020 09:19:06 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id DF57420731; Mon, 28 Dec 2020 14:18:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609165130; bh=CRCtOdDamxHN7cTxpI9y41/INOW1ct7uRop5YKntB7Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eVcvSznlyguLKBP/lj0HYD9AgRS9es7idxll19PA6Z1/Y2iIXfIb4jCo5u5mc//wx GX+Vu+uJipgs4O81qtCOJAG9n28r0awjCe5pFvJjwyeYU52huyPaLPMuyo4u+iyGZC dcoCGOiS4IRVf/t5pzyBaxb5WsOmFX1Sc8GJmJZY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Wenpeng Liang , Weihang Li , Jason Gunthorpe , Sasha Levin Subject: [PATCH 5.10 423/717] RDMA/hns: Normalization the judgment of some features Date: Mon, 28 Dec 2020 13:47:01 +0100 Message-Id: <20201228125041.230729369@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228125020.963311703@linuxfoundation.org> References: <20201228125020.963311703@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Wenpeng Liang [ Upstream commit 4ddeacf68a3dd05f346b63f4507e1032a15cc3cc ] Whether to enable the these features should better depend on the enable flags, not the value of related fields. Fixes: 5c1f167af112 ("RDMA/hns: Init SRQ table for hip08") Fixes: 3cb2c996c9dc ("RDMA/hns: Add support for SCCC in size of 64 Bytes") Link: https://lore.kernel.org/r/1607650657-35992-3-git-send-email-liweihang@huawei.com Signed-off-by: Wenpeng Liang Signed-off-by: Weihang Li Signed-off-by: Jason Gunthorpe Signed-off-by: Sasha Levin --- drivers/infiniband/hw/hns/hns_roce_hem.c | 4 ++-- drivers/infiniband/hw/hns/hns_roce_main.c | 8 ++++---- drivers/infiniband/hw/hns/hns_roce_qp.c | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/infiniband/hw/hns/hns_roce_hem.c b/drivers/infiniband/hw/hns/hns_roce_hem.c index 7487cf3d2c37a..66f9f036ef946 100644 --- a/drivers/infiniband/hw/hns/hns_roce_hem.c +++ b/drivers/infiniband/hw/hns/hns_roce_hem.c @@ -1017,7 +1017,7 @@ void hns_roce_cleanup_hem_table(struct hns_roce_dev *hr_dev, void hns_roce_cleanup_hem(struct hns_roce_dev *hr_dev) { - if (hr_dev->caps.srqc_entry_sz) + if (hr_dev->caps.flags & HNS_ROCE_CAP_FLAG_SRQ) hns_roce_cleanup_hem_table(hr_dev, &hr_dev->srq_table.table); hns_roce_cleanup_hem_table(hr_dev, &hr_dev->cq_table.table); @@ -1027,7 +1027,7 @@ void hns_roce_cleanup_hem(struct hns_roce_dev *hr_dev) if (hr_dev->caps.cqc_timer_entry_sz) hns_roce_cleanup_hem_table(hr_dev, &hr_dev->cqc_timer_table); - if (hr_dev->caps.sccc_sz) + if (hr_dev->caps.flags & HNS_ROCE_CAP_FLAG_QP_FLOW_CTRL) hns_roce_cleanup_hem_table(hr_dev, &hr_dev->qp_table.sccc_table); if (hr_dev->caps.trrl_entry_sz) diff --git a/drivers/infiniband/hw/hns/hns_roce_main.c b/drivers/infiniband/hw/hns/hns_roce_main.c index a6277d1c36ba9..ae721fa61e0e4 100644 --- a/drivers/infiniband/hw/hns/hns_roce_main.c +++ b/drivers/infiniband/hw/hns/hns_roce_main.c @@ -632,7 +632,7 @@ static int hns_roce_init_hem(struct hns_roce_dev *hr_dev) goto err_unmap_trrl; } - if (hr_dev->caps.srqc_entry_sz) { + if (hr_dev->caps.flags & HNS_ROCE_CAP_FLAG_SRQ) { ret = hns_roce_init_hem_table(hr_dev, &hr_dev->srq_table.table, HEM_TYPE_SRQC, hr_dev->caps.srqc_entry_sz, @@ -644,7 +644,7 @@ static int hns_roce_init_hem(struct hns_roce_dev *hr_dev) } } - if (hr_dev->caps.sccc_sz) { + if (hr_dev->caps.flags & HNS_ROCE_CAP_FLAG_QP_FLOW_CTRL) { ret = hns_roce_init_hem_table(hr_dev, &hr_dev->qp_table.sccc_table, HEM_TYPE_SCCC, @@ -688,11 +688,11 @@ err_unmap_qpc_timer: hns_roce_cleanup_hem_table(hr_dev, &hr_dev->qpc_timer_table); err_unmap_ctx: - if (hr_dev->caps.sccc_sz) + if (hr_dev->caps.flags & HNS_ROCE_CAP_FLAG_QP_FLOW_CTRL) hns_roce_cleanup_hem_table(hr_dev, &hr_dev->qp_table.sccc_table); err_unmap_srq: - if (hr_dev->caps.srqc_entry_sz) + if (hr_dev->caps.flags & HNS_ROCE_CAP_FLAG_SRQ) hns_roce_cleanup_hem_table(hr_dev, &hr_dev->srq_table.table); err_unmap_cq: diff --git a/drivers/infiniband/hw/hns/hns_roce_qp.c b/drivers/infiniband/hw/hns/hns_roce_qp.c index 800141ab643a3..ef1452215b17d 100644 --- a/drivers/infiniband/hw/hns/hns_roce_qp.c +++ b/drivers/infiniband/hw/hns/hns_roce_qp.c @@ -286,7 +286,7 @@ static int alloc_qpc(struct hns_roce_dev *hr_dev, struct hns_roce_qp *hr_qp) } } - if (hr_dev->caps.sccc_sz) { + if (hr_dev->caps.flags & HNS_ROCE_CAP_FLAG_QP_FLOW_CTRL) { /* Alloc memory for SCC CTX */ ret = hns_roce_table_get(hr_dev, &qp_table->sccc_table, hr_qp->qpn); -- 2.27.0