From patchwork Sat Sep 29 14:56:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Salil Mehta X-Patchwork-Id: 147847 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp1986440lji; Sat, 29 Sep 2018 07:59:10 -0700 (PDT) X-Google-Smtp-Source: ACcGV62jG9sx0msLY/aFU6+BHtVvKJyBXJtJzZqqht4/MMTgsrFUgCiYqCwd8ykhsHz9Eqp1KcQn X-Received: by 2002:a62:a0e:: with SMTP id s14-v6mr3448048pfi.153.1538233150520; Sat, 29 Sep 2018 07:59:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538233150; cv=none; d=google.com; s=arc-20160816; b=IhQuUxi034/V2le9B0/wLqKNvBzQ/pDxVrP3FFsoeUMO59b+ryldnbBMiBATUZRtcY PYhXn70chvwvBzopL/AMV8q2CkIE4pJuVr91gqN9jo420wrjb/Gy8guBsj42apAANQ4U J6pLixH652TR+3jVhHt7JEmvM1vjIMiQ5RnDG6+J4lQLqwnlfxEcqEFAI9IxmP10UYqb XNAMzVCh9h1qZvWktn9k3Yv0kC+klFXEmo7yS7DugTPFMS80F3Lb2H2KBhgpXjmE404N ZgNUZYds8UgrjdsAlO7EElBjLknLEKN3aeTLwO/WIyV1wqEninn2y77/7a1Tvv3P+eP3 IypQ== 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=Yeah5RLvra7Jt3mWNq6Bivet9tuRzaodRSOwJ3O0S3+53I5OCEf80KjQP/N3K7gC9F K5PL1IJxTm7/aD2/zFTLo9/qAW9Giq0G1+7booykEGzjhPemeIM7xtqJ+1t0YIPISJKX rUwJObw21m67zwscwOeGQaS4rzmS2t2CIdxQ25JeINY+guibTKEsdQ3rT0eO8HoZYBoB wAmywNyr5+EQVK3imL+zE4gAdW0X2adnOK7lSBO7JdRmokfHugza3mOx4N6CAP1x6vkt ZkcNGLmHCZdaIJaTIo45tjSgg+DJSC2A50rAUc3UfxYrnVFntAJKuChgA+pRYXqHXo07 pUXw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-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 l5-v6si7858234pgg.277.2018.09.29.07.59.10; Sat, 29 Sep 2018 07:59:10 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of netdev-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 netdev-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728583AbeI2V1v (ORCPT + 10 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 X-Originating-IP: [10.47.85.66] X-CFilter-Loop: Reflected Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@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.11.0 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);