diff mbox series

[04/11] net/hns3: constraint TM peak rate

Message ID 1612355037-48768-5-git-send-email-oulijun@huawei.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers show
Series critical bugfixes for hns3 | expand


Context Check Description
ci/checkpatch success coding style OK

Commit Message

Lijun Ou Feb. 3, 2021, 12:23 p.m. UTC
From: Chengwen Feng <fengchengwen@huawei.com>

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 <fengchengwen@huawei.com>
Signed-off-by: Lijun Ou <oulijun@huawei.com>
 drivers/net/hns3/hns3_tm.c | 6 ++++++
 1 file changed, 6 insertions(+)
diff mbox series


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->message = "peak rate must be at least 1Mbps";
+		return -EINVAL;
+	}
 	if (profile->peak.size) {
 		error->message = "peak bucket size not supported";