net/cnxk: add threshold validation for RED config

Message ID 20230102164353.110683-1-skori@marvell.com (mailing list archive)
State Accepted, archived
Delegated to: Jerin Jacob
Headers
Series net/cnxk: add threshold validation for RED config |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/loongarch-compilation success Compilation OK
ci/loongarch-unit-testing success Unit Testing PASS
ci/iol-broadcom-Performance success Performance Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/github-robot: build success github build: passed
ci/iol-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS

Commit Message

Sunil Kumar Kori Jan. 2, 2023, 4:43 p.m. UTC
  From: Sunil Kumar Kori <skori@marvell.com>

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 <skori@marvell.com>
---
 drivers/net/cnxk/cnxk_ethdev_cman.c | 5 +++++
 1 file changed, 5 insertions(+)
  

Comments

Jerin Jacob Jan. 17, 2023, 12:05 p.m. UTC | #1
On Mon, Jan 2, 2023 at 10:14 PM <skori@marvell.com> wrote:
>
> From: Sunil Kumar Kori <skori@marvell.com>
>
> 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 <skori@marvell.com>

Updated the git commit as follows and applied to
dpdk-next-net-mrvl/for-next-net. Thanks


    net/cnxk: validate RED threshold config

    Added vaalidation to check minimum and maximum RED threshold
    values, passed by user.

    Fixes: b7d3a0fe71eb ("net/cnxk: support congestion management operations")
    CC: stable@dpdk.org

    Signed-off-by: Sunil Kumar Kori <skori@marvell.com>

> ---
>  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;
>  }
>
> --
> 2.25.1
>
  

Patch

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;
 }