From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 67B25A0A0E; Wed, 3 Feb 2021 08:47:45 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D4DA5240476; Wed, 3 Feb 2021 08:47:00 +0100 (CET) Received: from szxga06-in.huawei.com (szxga06-in.huawei.com [45.249.212.32]) by mails.dpdk.org (Postfix) with ESMTP id 1712B240452 for ; Wed, 3 Feb 2021 08:46:56 +0100 (CET) Received: from DGGEMS404-HUB.china.huawei.com (unknown [172.30.72.59]) by szxga06-in.huawei.com (SkyGuard) with ESMTP id 4DVtyl6fDHzjGbS; Wed, 3 Feb 2021 15:45:51 +0800 (CST) Received: from localhost.localdomain (10.69.192.56) by DGGEMS404-HUB.china.huawei.com (10.3.19.204) with Microsoft SMTP Server id 14.3.498.0; Wed, 3 Feb 2021 15:46:50 +0800 From: Lijun Ou To: CC: , Date: Wed, 3 Feb 2021 15:46:15 +0800 Message-ID: <1612338382-3253-11-git-send-email-oulijun@huawei.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1612338382-3253-1-git-send-email-oulijun@huawei.com> References: <1612338382-3253-1-git-send-email-oulijun@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.69.192.56] X-CFilter-Loop: Reflected Subject: [dpdk-dev] [PATCH 10/17] net/hns3: constraint TM peak rate X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Chengwen Feng User could config Port or TC's peak rate by TM ops, but hardware does not support peak rate which lower than 1Mbps. So we constraint tm peak rate must be at least 1Mbps. Fixes: c09c7847d892 ("net/hns3: support traffic management") Signed-off-by: Chengwen Feng Signed-off-by: Lijun Ou --- drivers/net/hns3/hns3_tm.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/net/hns3/hns3_tm.c b/drivers/net/hns3/hns3_tm.c index d1639d4..bcae57a 100644 --- a/drivers/net/hns3/hns3_tm.c +++ b/drivers/net/hns3/hns3_tm.c @@ -200,6 +200,12 @@ hns3_tm_shaper_profile_param_check(struct rte_eth_dev *dev, return -EINVAL; } + if (profile->peak.rate < hns3_tm_rate_convert_firmware2tm(1)) { + error->type = RTE_TM_ERROR_TYPE_SHAPER_PROFILE_PEAK_RATE; + error->message = "peak rate must be at least 1Mbps"; + return -EINVAL; + } + if (profile->peak.size) { error->type = RTE_TM_ERROR_TYPE_SHAPER_PROFILE_PEAK_SIZE; error->message = "peak bucket size not supported"; -- 2.7.4