From patchwork Mon Jan 2 16:43:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sunil Kumar Kori X-Patchwork-Id: 121511 X-Patchwork-Delegate: jerinj@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id CA4A4A00C2; Mon, 2 Jan 2023 17:44:09 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 6C19F40693; Mon, 2 Jan 2023 17:44:09 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id B355C40689 for ; Mon, 2 Jan 2023 17:44:07 +0100 (CET) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3022wX4e005542 for ; Mon, 2 Jan 2023 08:44:07 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=Xz+w9JY0Qv3Ay6fWlrrdNS46ZEAzYQ6iE1K29/Ms8k0=; b=I+HLyLQaFpT4NWJBd9qvMroZRD8J/FK16RJFWXoJIMG1hKQLMg+VkJA7DH5NndXVHujx 90W78k02CTeGOIUpEnotfgam/wH38ZmXaA3eEGcWejokqGj8YVx8caY+4Vr08U1YVIsA /4cvW1iqhl8fAzTzj+vhxvllvjs7k23GEviuzwtRxr769qsELPrD4ISSv4ODOT0chWJm VihpvBmD51BfgT2H+xrClmKNfNR/WYoFeps6sVG8HxLGK8BNhGV872iyAtWQad+SBvxK IHKnHR8ZH92jFo5GmUFcXd7ZfnmzUBM7q6hixJv3NLln/40HYTWF9m5b9zbHUeAHgHao ww== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3mtnftcd93-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT) for ; Mon, 02 Jan 2023 08:44:06 -0800 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.42; Mon, 2 Jan 2023 08:44:04 -0800 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.42 via Frontend Transport; Mon, 2 Jan 2023 08:44:04 -0800 Received: from localhost.localdomain (unknown [10.28.34.25]) by maili.marvell.com (Postfix) with ESMTP id 116B13F7082; Mon, 2 Jan 2023 08:44:02 -0800 (PST) From: To: Nithin Dabilpuram , Kiran Kumar K , Sunil Kumar Kori , Satha Rao CC: Subject: [PATCH] net/cnxk: add threshold validation for RED config Date: Mon, 2 Jan 2023 22:13:53 +0530 Message-ID: <20230102164353.110683-1-skori@marvell.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Proofpoint-GUID: Wsl-9pe_7-3mYUnomNj9YwQurvofv1W6 X-Proofpoint-ORIG-GUID: Wsl-9pe_7-3mYUnomNj9YwQurvofv1W6 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2023-01-02_10,2022-12-30_01,2022-06-22_01 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 From: Sunil Kumar Kori Validation is added to check minimum and maximum RED threshold values, passed by user. Fixes: b7d3a0fe71eb ("net/cnxk: support congestion management operations") Signed-off-by: Sunil Kumar Kori --- drivers/net/cnxk/cnxk_ethdev_cman.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/net/cnxk/cnxk_ethdev_cman.c b/drivers/net/cnxk/cnxk_ethdev_cman.c index d5e647c64d..a7ccdfb756 100644 --- a/drivers/net/cnxk/cnxk_ethdev_cman.c +++ b/drivers/net/cnxk/cnxk_ethdev_cman.c @@ -68,6 +68,11 @@ nix_cman_config_validate(struct rte_eth_dev *eth_dev, const struct rte_eth_cman_ return -EINVAL; } + if (config->mode_param.red.min_th > config->mode_param.red.max_th) { + plt_err("RED minimum threshold must be less or equal to maximum threshold"); + return -EINVAL; + } + return 0; }