Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp2491303lqp; Sun, 24 Mar 2024 23:22:22 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVWKPErxvcciuKbT4tmrGl1HzXNbARbinHSfv/gbP7XZHIdHh79+Q8aunxd4bS5/iPZdMpfS7/7frMkv5qPUNe4LHj2fuCoHXCmfA3wfg== X-Google-Smtp-Source: AGHT+IFFgXJ9DmrYD/0y2fXUpyNjMXVr9T9bTl+8OlgaZS/d2Iv78T1jriwPQ1v32lKH0luUNDmJ X-Received: by 2002:aa7:c546:0:b0:56b:f5ae:d2c2 with SMTP id s6-20020aa7c546000000b0056bf5aed2c2mr5115799edr.28.1711347742804; Sun, 24 Mar 2024 23:22:22 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711347742; cv=pass; d=google.com; s=arc-20160816; b=CHBMuWXb9xcoUzVbfyyzhgX2KY/Z6tHGgr5dO3IYD7/8DDMI1Sw6OFgfMDvSl+cV/O wQhE4VFpavC356beq5r/jz/EdP57W75KwNnGKynd0blUesuasrejid3QmDtfW+nlZylK 7N0eicr8O/GCR15HjJGnM/x/uWzNZg/XeZLCxrou8D9IqktbGr7D1+nbebgXl23lvwwI B6xvpKdeNNHjXYG61C2tIajWTDS42UvGCLniTHO+9Sz4cKdlld/XREIy0viFPpV9N8t2 ghwQGrsiqerSIEvErJM61WAayC2CxwsS5Qa1mKd0fu8vridp2vG/nT0dd1+TFC6sfKjC JLqg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=DlceELC0VFQQuFRCNlqN2thYQK+yBxURW/Jpn3gd8cc=; fh=dJt7upZr4lnRwXTWKoBqN6UOBT1Ztlw3GNUGRBlOLvA=; b=q2m8oLWvHRphRmrQ7v1laO6euq1IZIlBJrPeazp2WGxypqqk7W6AvSdCP7aoLUr3aH tWW3pGDGEB0r4DxHAOiAEij+6iEda0I3bIODjixoMXTItu6AJRXNvgX9tVLF4oV9B87Z mcDChpamDIa3uTKUCr9ecSPvy8MpByzjijIJtZIZd9rUKRzyYBxF4TaItX7jwe2lX1Xl IB8YhsPk7JnSDLYv0guXKd5QjX6MxnQUOMUz36BSe8KBmfqptZfFZEC0z75UlTFRtqIB /zftnCPh5jED1/BF0BlKReTyf8LvvKcTNBSol6p1mLXxRFvKZg0Fe4+wd0OhwdOCVzLg 8Bqg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=npD4Wuao; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-114624-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-114624-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id 22-20020a170906301600b00a47377bdec3si2162007ejz.150.2024.03.24.23.22.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Mar 2024 23:22:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-114624-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=npD4Wuao; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-114624-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-114624-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 6842E1F2BCA1 for ; Mon, 25 Mar 2024 06:21:27 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4B40A2A493D; Sun, 24 Mar 2024 23:56:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="npD4Wuao" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5C40923450D; Sun, 24 Mar 2024 23:18:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711322282; cv=none; b=mKpzI7lwFEDoYj5YccV389b+KkzeJRHaJglNVj/3ggGyx4ZCsZ8o1IQqQ2nbkXcF7jwl2//zhg91JO74+vzaOXi6+0C/x8jV5nDeymnGopbLmthE4T0clh0f8rFslArLp6tKDVP7PLkX/OLf+9majpnnlRtIOQ/0Xk4yDsc55sU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711322282; c=relaxed/simple; bh=29OKIg7YUnRgl/JzYN9K7rSXlGBuWt74fJoWE1JKOyU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ErVqvQlYBbz06Il1vlbWtBom6wWT56wQ0u6fUREteIdVmQ0rZ3zklG+I8j2N2aKwbef81f12UTaxIdDT2gIKSjyAa7vwLNNWVdYzdn+OnG49Lis07S0eJ+iaO/0Hqoy52qoWY1ubExmrcGvTUcX521+o5oUc3c3jVQzkyexnwb0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=npD4Wuao; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 81835C43399; Sun, 24 Mar 2024 23:18:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1711322282; bh=29OKIg7YUnRgl/JzYN9K7rSXlGBuWt74fJoWE1JKOyU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=npD4WuaoN9+qj26wfxLTS1S6LNMkHx6goQZ4Xl6X/LvSEKtILo91NVYzm96R7R+xk v1ZSlv1Fehz0CYlU8ecJBKOrK69+Z4GaS27y51/RaP6HgrYPP7NObPzFICgombArV7 xcNjws9/1z2QDgfhhxWolv8WJumR3fcmIlXSHySFOu2+fpewJ4pWj3XqAzCDMg/tB2 zhgfk88Tp8QQCtpIezfveTtLi2/636DH/wNxLYlnWaRW/jLsVfwDmnQ8WqddLisfI3 JG3cMhnzKvu3DSVohNPa16FX+IEoZJ9L0JbIXVQxPcFdWq5tSt63NMygBdiU8DwCs+ pFEErf/kEH3lQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Luoyouming , Junxian Huang , Leon Romanovsky , Sasha Levin Subject: [PATCH 6.1 365/451] RDMA/hns: Fix mis-modifying default congestion control algorithm Date: Sun, 24 Mar 2024 19:10:41 -0400 Message-ID: <20240324231207.1351418-366-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240324231207.1351418-1-sashal@kernel.org> References: <20240324231207.1351418-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit From: Luoyouming [ Upstream commit d20a7cf9f714f0763efb56f0f2eeca1cb91315ed ] Commit 27c5fd271d8b ("RDMA/hns: The UD mode can only be configured with DCQCN") adds a check of congest control alorithm for UD. But that patch causes a problem: hr_dev->caps.congest_type is global, used by all QPs, so modifying this field to DCQCN for UD QPs causes other QPs unable to use any other algorithm except DCQCN. Revert the modification in commit 27c5fd271d8b ("RDMA/hns: The UD mode can only be configured with DCQCN"). Add a new field cong_type to struct hns_roce_qp and configure DCQCN for UD QPs. Fixes: 27c5fd271d8b ("RDMA/hns: The UD mode can only be configured with DCQCN") Fixes: f91696f2f053 ("RDMA/hns: Support congestion control type selection according to the FW") Signed-off-by: Luoyouming Signed-off-by: Junxian Huang Link: https://lore.kernel.org/r/20240219061805.668170-1-huangjunxian6@hisilicon.com Signed-off-by: Leon Romanovsky Signed-off-by: Sasha Levin --- drivers/infiniband/hw/hns/hns_roce_device.h | 17 +++++++++-------- drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 16 ++++++++++------ 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/drivers/infiniband/hw/hns/hns_roce_device.h b/drivers/infiniband/hw/hns/hns_roce_device.h index 1112afa0af552..8748b65c87ea7 100644 --- a/drivers/infiniband/hw/hns/hns_roce_device.h +++ b/drivers/infiniband/hw/hns/hns_roce_device.h @@ -595,6 +595,13 @@ struct hns_roce_work { u32 queue_num; }; +enum hns_roce_cong_type { + CONG_TYPE_DCQCN, + CONG_TYPE_LDCP, + CONG_TYPE_HC3, + CONG_TYPE_DIP, +}; + struct hns_roce_qp { struct ib_qp ibqp; struct hns_roce_wq rq; @@ -639,6 +646,7 @@ struct hns_roce_qp { struct list_head sq_node; /* all send qps are on a list */ struct hns_user_mmap_entry *dwqe_mmap_entry; u32 config; + enum hns_roce_cong_type cong_type; }; struct hns_roce_ib_iboe { @@ -710,13 +718,6 @@ struct hns_roce_eq_table { struct hns_roce_eq *eq; }; -enum cong_type { - CONG_TYPE_DCQCN, - CONG_TYPE_LDCP, - CONG_TYPE_HC3, - CONG_TYPE_DIP, -}; - struct hns_roce_caps { u64 fw_ver; u8 num_ports; @@ -847,7 +848,7 @@ struct hns_roce_caps { u16 default_aeq_period; u16 default_aeq_arm_st; u16 default_ceq_arm_st; - enum cong_type cong_type; + enum hns_roce_cong_type cong_type; }; enum hns_roce_device_state { diff --git a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c index 58fbb1d3b7f41..d06b19e69a151 100644 --- a/drivers/infiniband/hw/hns/hns_roce_hw_v2.c +++ b/drivers/infiniband/hw/hns/hns_roce_hw_v2.c @@ -4886,12 +4886,15 @@ static int check_cong_type(struct ib_qp *ibqp, struct hns_roce_congestion_algorithm *cong_alg) { struct hns_roce_dev *hr_dev = to_hr_dev(ibqp->device); + struct hns_roce_qp *hr_qp = to_hr_qp(ibqp); - if (ibqp->qp_type == IB_QPT_UD) - hr_dev->caps.cong_type = CONG_TYPE_DCQCN; + if (ibqp->qp_type == IB_QPT_UD || ibqp->qp_type == IB_QPT_GSI) + hr_qp->cong_type = CONG_TYPE_DCQCN; + else + hr_qp->cong_type = hr_dev->caps.cong_type; /* different congestion types match different configurations */ - switch (hr_dev->caps.cong_type) { + switch (hr_qp->cong_type) { case CONG_TYPE_DCQCN: cong_alg->alg_sel = CONG_DCQCN; cong_alg->alg_sub_sel = UNSUPPORT_CONG_LEVEL; @@ -4919,8 +4922,8 @@ static int check_cong_type(struct ib_qp *ibqp, default: ibdev_warn(&hr_dev->ib_dev, "invalid type(%u) for congestion selection.\n", - hr_dev->caps.cong_type); - hr_dev->caps.cong_type = CONG_TYPE_DCQCN; + hr_qp->cong_type); + hr_qp->cong_type = CONG_TYPE_DCQCN; cong_alg->alg_sel = CONG_DCQCN; cong_alg->alg_sub_sel = UNSUPPORT_CONG_LEVEL; cong_alg->dip_vld = DIP_INVALID; @@ -4939,6 +4942,7 @@ static int fill_cong_field(struct ib_qp *ibqp, const struct ib_qp_attr *attr, struct hns_roce_congestion_algorithm cong_field; struct ib_device *ibdev = ibqp->device; struct hns_roce_dev *hr_dev = to_hr_dev(ibdev); + struct hns_roce_qp *hr_qp = to_hr_qp(ibqp); u32 dip_idx = 0; int ret; @@ -4951,7 +4955,7 @@ static int fill_cong_field(struct ib_qp *ibqp, const struct ib_qp_attr *attr, return ret; hr_reg_write(context, QPC_CONG_ALGO_TMPL_ID, hr_dev->cong_algo_tmpl_id + - hr_dev->caps.cong_type * HNS_ROCE_CONG_SIZE); + hr_qp->cong_type * HNS_ROCE_CONG_SIZE); hr_reg_clear(qpc_mask, QPC_CONG_ALGO_TMPL_ID); hr_reg_write(&context->ext, QPCEX_CONG_ALG_SEL, cong_field.alg_sel); hr_reg_clear(&qpc_mask->ext, QPCEX_CONG_ALG_SEL); -- 2.43.0