From patchwork Wed Sep 26 18:28:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Salil Mehta X-Patchwork-Id: 147625 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp1059040lji; Wed, 26 Sep 2018 11:30:17 -0700 (PDT) X-Google-Smtp-Source: ACcGV63WWNRLosXdAJlUww88yu7wGZr5rIiBGTQqNkKX/2piSzqCNGUTD/PS9/378jQFBtOMhIY9 X-Received: by 2002:a17:902:d881:: with SMTP id b1-v6mr7279027plz.191.1537986617192; Wed, 26 Sep 2018 11:30:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537986617; cv=none; d=google.com; s=arc-20160816; b=JtcxKlZbgjunuCu8cDXXiUVIFlMg1moClK9nivrIewWJeSDjNITPribnTy6Fte/9UP R5oogB1o7wNiDn1hVREt3njhm6g8f4JVZXtsTY0AIOwcq1ENYbHLvGJfcol/Ukz4f1ok l7AYSOtFY1hBmQyqF3qrdhmwm0SsS4pwM8T5ftz8//Ur9ze+tQ92o52E3rKFo2CSzKyd rS8qkCnsLb0JxDWE0tc7GQe871azQ9zG7HVjJtYJesSvg4n0XosQmgqIgZ6gOWTlWAhB bZ4Plz9J6x+UInHKBv2x65xgzlSbXa9DsZJOsRP/Mf9Yv3+AH60S4YSerYWYfcHZbYac 2zqw== 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=bHvXb2AWXnMVLItjsHjwkAaoL545NXWQDUSFdAfRqZ8=; b=T5U40rJWDT7blMztk4LnZYE9784mMMQ4Awl7rAAm3QcAnudRk5dkhl9cUPYddeUCgt E0RgvM7kdmvDvf0asFZpPiS01Ik1oLwRDnFB2N1TT8ygiabbTIXhkE4JQLyEnf6pcvSr gb9OsFD1ilFLgFmpS2D5eVxrk9QcjkGkAe3TjORqhLSq0x5jL2k0fYGk2elYdwqC0PRN ngQdqSCnuEKeMGc0qSHhGH3L+BEwDPez3A45uJX51fjVXP/MBoVA5ztMORDgqrwNdUek QDSpr7mum22whezy3JVHi1RQxMco/todoowbbAa1pVLNeNEFs7rZUdttQ1kC6q3+FUNm /6Uw== 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 s13-v6si5919865pgi.73.2018.09.26.11.30.16; Wed, 26 Sep 2018 11:30:17 -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 S1728877AbeI0AoG (ORCPT + 32 others); Wed, 26 Sep 2018 20:44:06 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:13155 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728810AbeI0AoF (ORCPT ); Wed, 26 Sep 2018 20:44:05 -0400 Received: from DGGEMS405-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 9D4157D3F0272; Thu, 27 Sep 2018 02:29:48 +0800 (CST) Received: from S00293818-DELL1.china.huawei.com (10.202.226.54) by DGGEMS405-HUB.china.huawei.com (10.3.19.205) with Microsoft SMTP Server id 14.3.399.0; Thu, 27 Sep 2018 02:29:43 +0800 From: Salil Mehta To: CC: , , , , , , , Huazhong Tan , Yunsheng Lin Subject: [PATCH net-next 08/10] net: hns3: Change return type of hclge_tm_schd_info_update() Date: Wed, 26 Sep 2018 19:28:38 +0100 Message-ID: <20180926182840.28392-9-salil.mehta@huawei.com> X-Mailer: git-send-email 2.8.3 In-Reply-To: <20180926182840.28392-1-salil.mehta@huawei.com> References: <20180926182840.28392-1-salil.mehta@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.202.226.54] 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(-) -- 2.7.4 diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_dcb.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_dcb.c index 92f1938..e72f724 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 ab7280d..aa5cb98 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 e1568b8..25eef13 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);