From: Chengwen Feng Date: Wed, 3 Feb 2021 12:23:50 +0000 (+0800) Subject: net/hns3: constrain TM peak rate X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=3e5c397ce40c5468f14d0e61bae20b9ebc79a8ae;p=dpdk.git net/hns3: constrain TM peak rate 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 --- diff --git a/drivers/net/hns3/hns3_tm.c b/drivers/net/hns3/hns3_tm.c index d1639d4a0e..bcae57aefa 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";