Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1093607imm; Wed, 26 Sep 2018 11:31:03 -0700 (PDT) X-Google-Smtp-Source: ACcGV62uvq8R9NqEf10oRVGvEsaTA6virwf7O9WuxnNnO9E8WUBCJ1ls3Xfj1400MzyDqwnmTuB0 X-Received: by 2002:a62:8247:: with SMTP id w68-v6mr7370778pfd.215.1537986663261; Wed, 26 Sep 2018 11:31:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537986663; cv=none; d=google.com; s=arc-20160816; b=v1rCQbNbLi+zj9oqJy8Y3dniCFqfBUxNyUFYKWNFhh8aHJVh0ZDeLekVxgzM3nbMGI Tcwze6u4FN0bAPFl8+P1cbiI5E3YltXXGZrFMhswzvJcWcePhR2/qISajbnZ51J42nUN DKuKufzSE0Ej8mmdOXza3mzzsCfsbYUmzgQ866CYooBQc4Mk5LfxmP/G8LK+AXytx+Dr k/99bJ1QiszAwRm3z2Ig675E8GBbd8y45Zftla5UIe90KIuXdxOf4ZuAOSiBg0f40V4j ZhFeW6MFdy0Qa4aaSIk6qTdfdoIo7Yxqd3EgkmIqUjx/ulHlkIVALOsqKWNaBW8eGx58 2euA== 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 q15-v6si5064275pff.173.2018.09.26.11.30.48; Wed, 26 Sep 2018 11:31:03 -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 S1728872AbeI0AoG (ORCPT + 99 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 Content-Type: text/plain 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(-) 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); -- 2.7.4