Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp506999pxb; Tue, 19 Oct 2021 07:23:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxQXOy5i72igA2qIy//9+kQvNHhKSpCmMfnznIM6h9nLFQh+RqDvwLaOJoVfGQtE6kuEejD X-Received: by 2002:a17:906:11db:: with SMTP id o27mr38047124eja.540.1634653406730; Tue, 19 Oct 2021 07:23:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634653406; cv=none; d=google.com; s=arc-20160816; b=HMg8bcTjfhfRxBwXVTrxPsxHe3dfr+I1yZfrpp0s68uK7Z9x2xsy2QcO6Xrm/mzRMP pAJAXoQBrM8FW0bTQdIVOrcmExu9xU1ktqMLWsnuPqTA789W+X4qCFMI6FJHa+WoNRmp PbAiNIWSrWo/0k/B7rsgWdIbnfTyfhYpso6cHHyYZhZwc80TkVrlCpsrL+Z+pjR8H2w0 YafJ1n36ovau5y+q645aMMCX2obkha3aJHDLWD0YFGC34nHWF91aXoHOcOjh4Q7Y2rD3 QGTQ1gSPUV59Tw2L2j3YeirYdDjBdv1cUbb1GWgIT9r4iYb4w3EVivX9D3xnIubGSTwi 78DQ== 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=CTvoY8jYl1+z6823OlmhDnL4ewRkW7JXwBI7IhGS10A=; b=hsimmzgfu8h+eIFONR2kYNZ2CIwwrE7IFq2Vf2PUYPRmyY3S66+/24Z2k8EanEAtz9 QKDsOn6NRroUjWOfHIz6Zqv/kxvC+g7C4Kfo0UGc+x3+UNCmlvzVmLy0FQC7F8nbPrOr 4VtyCfsUl0c7mT+YbQPwX4iYXA+vbFypcuEiqTNmUNWHrk1gdfYaEvf5QuyG8SvZJ8xT AR/V2+1R7TCV/DxMUJUQ+NaD0f9T0RLH3iX3XI+bsIctux+3Ldf9uBw9z+7i0IT/Kx08 GAFmeO/cSKhmZu9sNQt49GMbklGqy4V+IaC5Omo+IpvbZdNq39LXnq+G0liaYRGs9/jA ie6A== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k16si23745637ejg.742.2021.10.19.07.23.02; Tue, 19 Oct 2021 07:23:26 -0700 (PDT) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233009AbhJSOXQ (ORCPT + 99 others); Tue, 19 Oct 2021 10:23:16 -0400 Received: from szxga02-in.huawei.com ([45.249.212.188]:24361 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229846AbhJSOXG (ORCPT ); Tue, 19 Oct 2021 10:23:06 -0400 Received: from dggemv704-chm.china.huawei.com (unknown [172.30.72.54]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4HYbQC0c3vzRH7P; Tue, 19 Oct 2021 22:16:19 +0800 (CST) Received: from kwepemm600016.china.huawei.com (7.193.23.20) by dggemv704-chm.china.huawei.com (10.3.19.47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.15; Tue, 19 Oct 2021 22:20:52 +0800 Received: from localhost.localdomain (10.67.165.24) by kwepemm600016.china.huawei.com (7.193.23.20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.15; Tue, 19 Oct 2021 22:20:51 +0800 From: Guangbin Huang To: , CC: , , , , Subject: [PATCH net 3/8] net: hns3: add limit ets dwrr bandwidth cannot be 0 Date: Tue, 19 Oct 2021 22:16:30 +0800 Message-ID: <20211019141635.43695-4-huangguangbin2@huawei.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211019141635.43695-1-huangguangbin2@huawei.com> References: <20211019141635.43695-1-huangguangbin2@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.67.165.24] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To kwepemm600016.china.huawei.com (7.193.23.20) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If ets dwrr bandwidth of tc is set to 0, the hardware will switch to SP mode. In this case, this tc may occupy all the tx bandwidth if it has huge traffic, so it violates the purpose of the user setting. To fix this problem, limit the ets dwrr bandwidth must greater than 0. Fixes: cacde272dd00 ("net: hns3: Add hclge_dcb module for the support of DCB feature") Signed-off-by: Guangbin Huang --- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_dcb.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_dcb.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_dcb.c index 307c9e830510..91cb578f56b8 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_dcb.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_dcb.c @@ -137,6 +137,15 @@ static int hclge_ets_sch_mode_validate(struct hclge_dev *hdev, *changed = true; break; case IEEE_8021QAZ_TSA_ETS: + /* The hardware will switch to sp mode if bandwidth is + * 0, so limit ets bandwidth must be greater than 0. + */ + if (!ets->tc_tx_bw[i]) { + dev_err(&hdev->pdev->dev, + "tc%u ets bw cannot be 0\n", i); + return -EINVAL; + } + if (hdev->tm_info.tc_info[i].tc_sch_mode != HCLGE_SCH_MODE_DWRR) *changed = true; -- 2.33.0