Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1980748imm; Sat, 29 Sep 2018 07:59:46 -0700 (PDT) X-Google-Smtp-Source: ACcGV62WGPSodWjPywNQQfAi9ORm/A7CDS/kMET/Y7WC5VcGboODXrnMZkTXYm+vW1RkDfnY38lY X-Received: by 2002:a62:9e52:: with SMTP id s79-v6mr3511310pfd.110.1538233186798; Sat, 29 Sep 2018 07:59:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538233186; cv=none; d=google.com; s=arc-20160816; b=AYLSgisjB8P+Phsnf7+7bYZZn8Hn1Z3nlow+AfrP49fg0mlhmutBznOAsGygvYVCAF 7PWWlW97NZprh+/8a3/aTumLyDogWLfVlRxiIomXAvPMzYnMQFDLI/aEPUBX6XZpQAlT cc97SUWwXfOrYPsl94ANdAST6/PezBAiOvb/bY0xDxpGa/CMVp8wM46Qx6KZEjafC2LT 25nP+0G1K4a1KlA/5152WQX5TwS2uwM4Jz7G2d90QJJ01o7zEX2GZ8xONphtivzx/7Ac NaQGUxdXJKs/NLIa9kik2gK9F/ps/JYS4KpYCEuVOr/E8Gr56XdZj36wGmU6RmBMQFWL 54Yg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=6TXvoeJGsSOZnXDUWJXE9AHexqoi79hWRe5avJa0Q5s=; b=DyVss9PGQRoMHrqPjXIQ7OLdQMt33w+SB8eIYEEFkDS+kZcPT6JxVeA3afvXZ7TA8H ZY6pabBoENuoNYigvs8WJT5u6mpY2c2r+nz/RVEWc+wXetMta28pKPQeuarMJr1TtYU2 i2wtLsWYX/BaMUT07yMqb236qJH9Xu11ILMeQJHAO4QtWGwSrc5hOzq68ZJS4vg3AugM bOCl586/8HeOKS+4h7vuO4+0Pa0fnu8ZZtLehSReoQie5Pc/PL7cKF+EbkulSMik9Swu iH4BH+qLk8zeCS7udDsRhZXb/GwJOgajXmCXEHWr2R6B7hZhhsmhJsHhlqycWAkjPJvi tl6A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l26-v6si7395344pgb.251.2018.09.29.07.59.32; Sat, 29 Sep 2018 07:59:46 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728576AbeI2V1v (ORCPT + 99 others); Sat, 29 Sep 2018 17:27:51 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:13584 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728541AbeI2V1u (ORCPT ); Sat, 29 Sep 2018 17:27:50 -0400 Received: from DGGEMS412-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 6348F95FEA6A4; Sat, 29 Sep 2018 22:58:57 +0800 (CST) Received: from S00293818-DELL1.china.huawei.com (10.47.85.66) by DGGEMS412-HUB.china.huawei.com (10.3.19.212) with Microsoft SMTP Server id 14.3.399.0; Sat, 29 Sep 2018 22:58:51 +0800 From: Salil Mehta To: CC: , , , , , , , Huazhong Tan , Yunsheng Lin Subject: [PATCH V2 net-next 08/10] net: hns3: Change return type of hclge_tm_schd_info_update() Date: Sat, 29 Sep 2018 15:56:20 +0100 Message-ID: <20180929145622.5448-9-salil.mehta@huawei.com> X-Mailer: git-send-email 2.8.3 In-Reply-To: <20180929145622.5448-1-salil.mehta@huawei.com> References: <20180929145622.5448-1-salil.mehta@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.47.85.66] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Huazhong Tan hclge_tm_schd_info_update should return an error when num_tc is greater than alloc_tqps. This patch changes the return type of hnae3_register_ae_algo from void to int. Signed-off-by: Huazhong Tan Signed-off-by: Yunsheng Lin Signed-off-by: Peng Li Signed-off-by: Salil Mehta --- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_dcb.c | 8 ++++++-- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c | 9 ++++++++- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.h | 2 +- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_dcb.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_dcb.c index 92f19384e258..e72f724123d7 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_dcb.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_dcb.c @@ -184,7 +184,9 @@ static int hclge_ieee_setets(struct hnae3_handle *h, struct ieee_ets *ets) if (ret) return ret; - hclge_tm_schd_info_update(hdev, num_tc); + ret = hclge_tm_schd_info_update(hdev, num_tc); + if (ret) + return ret; ret = hclge_ieee_ets_to_tm_info(hdev, ets); if (ret) @@ -310,7 +312,9 @@ static int hclge_setup_tc(struct hnae3_handle *h, u8 tc, u8 *prio_tc) return -EINVAL; } - hclge_tm_schd_info_update(hdev, tc); + ret = hclge_tm_schd_info_update(hdev, tc); + if (ret) + return ret; ret = hclge_tm_prio_tc_info_update(hdev, prio_tc); if (ret) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c index ab7280d7f79c..aa5cb9834d73 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.c @@ -1280,10 +1280,15 @@ int hclge_tm_prio_tc_info_update(struct hclge_dev *hdev, u8 *prio_tc) return 0; } -void hclge_tm_schd_info_update(struct hclge_dev *hdev, u8 num_tc) +int hclge_tm_schd_info_update(struct hclge_dev *hdev, u8 num_tc) { u8 i, bit_map = 0; + for (i = 0; i < hdev->num_alloc_vport; i++) { + if (num_tc > hdev->vport[i].alloc_tqps) + return -EINVAL; + } + hdev->tm_info.num_tc = num_tc; for (i = 0; i < hdev->tm_info.num_tc; i++) @@ -1297,6 +1302,8 @@ void hclge_tm_schd_info_update(struct hclge_dev *hdev, u8 num_tc) hdev->hw_tc_map = bit_map; hclge_tm_schd_info_init(hdev); + + return 0; } int hclge_tm_init_hw(struct hclge_dev *hdev) diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.h b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.h index e1568b826aac..25eef13a3e14 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.h +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_tm.h @@ -132,7 +132,7 @@ int hclge_tm_schd_init(struct hclge_dev *hdev); int hclge_pause_setup_hw(struct hclge_dev *hdev); int hclge_tm_schd_mode_hw(struct hclge_dev *hdev); int hclge_tm_prio_tc_info_update(struct hclge_dev *hdev, u8 *prio_tc); -void hclge_tm_schd_info_update(struct hclge_dev *hdev, u8 num_tc); +int hclge_tm_schd_info_update(struct hclge_dev *hdev, u8 num_tc); int hclge_tm_dwrr_cfg(struct hclge_dev *hdev); int hclge_tm_map_cfg(struct hclge_dev *hdev); int hclge_tm_init_hw(struct hclge_dev *hdev); -- 2.11.0