DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] net/mlx5: fix devargs validation for multiclass probe
@ 2021-11-25  6:16 michaelba
  2021-11-25  9:29 ` Thomas Monjalon
  0 siblings, 1 reply; 4+ messages in thread
From: michaelba @ 2021-11-25  6:16 UTC (permalink / raw)
  To: dev
  Cc: Matan Azrad, Raslan Darawsheh, Viacheslav Ovsiienko,
	Michael Baum, stable

From: Michael Baum <michaelba@nvidia.com>

The mlx5_args function reads the devargs and checks if they are valid
for this driver and if not it returns an error.

This was normal behavior as long as all the devargs come to this driver,
but since it is possible to run several drivers together, the function
may return an error for another driver's devarg even though it is
completely valid.
In addition the function does not allow the user to know which of the
devargs he sent is incorrect, but returns an error without printing the
unknown devarg.

This patch eliminates the error return in the case of an unknown devarg,
and prints a warning for each such devarg specifically.

Fixes: 7b4f1e6bd367 ("common/mlx5: introduce common library")
Cc: stable@dpdk.org

Signed-off-by: Michael Baum <michaelba@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
---
 drivers/net/mlx5/mlx5.c | 68 ++++++-----------------------------------
 1 file changed, 9 insertions(+), 59 deletions(-)

diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index 4e04817d11..aa5f313c1a 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -1975,9 +1975,9 @@ mlx5_args_check(const char *key, const char *val, void *opaque)
 		config->std_delay_drop = !!(tmp & MLX5_DELAY_DROP_STANDARD);
 		config->hp_delay_drop = !!(tmp & MLX5_DELAY_DROP_HAIRPIN);
 	} else {
-		DRV_LOG(WARNING, "%s: unknown parameter", key);
-		rte_errno = EINVAL;
-		return -rte_errno;
+		DRV_LOG(WARNING,
+			"%s: unknown parameter, maybe it's for another class.",
+			key);
 	}
 	return 0;
 }
@@ -1996,75 +1996,25 @@ mlx5_args_check(const char *key, const char *val, void *opaque)
 int
 mlx5_args(struct mlx5_dev_config *config, struct rte_devargs *devargs)
 {
-	const char **params = (const char *[]){
-		MLX5_DRIVER_KEY,
-		MLX5_RXQ_CQE_COMP_EN,
-		MLX5_RXQ_PKT_PAD_EN,
-		MLX5_RX_MPRQ_EN,
-		MLX5_RX_MPRQ_LOG_STRIDE_NUM,
-		MLX5_RX_MPRQ_LOG_STRIDE_SIZE,
-		MLX5_RX_MPRQ_MAX_MEMCPY_LEN,
-		MLX5_RXQS_MIN_MPRQ,
-		MLX5_TXQ_INLINE,
-		MLX5_TXQ_INLINE_MIN,
-		MLX5_TXQ_INLINE_MAX,
-		MLX5_TXQ_INLINE_MPW,
-		MLX5_TXQS_MIN_INLINE,
-		MLX5_TXQS_MAX_VEC,
-		MLX5_TXQ_MPW_EN,
-		MLX5_TXQ_MPW_HDR_DSEG_EN,
-		MLX5_TXQ_MAX_INLINE_LEN,
-		MLX5_TX_DB_NC,
-		MLX5_TX_PP,
-		MLX5_TX_SKEW,
-		MLX5_TX_VEC_EN,
-		MLX5_RX_VEC_EN,
-		MLX5_L3_VXLAN_EN,
-		MLX5_VF_NL_EN,
-		MLX5_DV_ESW_EN,
-		MLX5_DV_FLOW_EN,
-		MLX5_DV_XMETA_EN,
-		MLX5_LACP_BY_USER,
-		MLX5_MR_EXT_MEMSEG_EN,
-		MLX5_REPRESENTOR,
-		MLX5_MAX_DUMP_FILES_NUM,
-		MLX5_LRO_TIMEOUT_USEC,
-		RTE_DEVARGS_KEY_CLASS,
-		MLX5_HP_BUF_SIZE,
-		MLX5_RECLAIM_MEM,
-		MLX5_SYS_MEM_EN,
-		MLX5_DECAP_EN,
-		MLX5_ALLOW_DUPLICATE_PATTERN,
-		MLX5_MR_MEMPOOL_REG_EN,
-		MLX5_DELAY_DROP,
-		NULL,
-	};
 	struct rte_kvargs *kvlist;
 	int ret = 0;
-	int i;
 
 	if (devargs == NULL)
 		return 0;
 	/* Following UGLY cast is done to pass checkpatch. */
-	kvlist = rte_kvargs_parse(devargs->args, params);
+	kvlist = rte_kvargs_parse(devargs->args, NULL);
 	if (kvlist == NULL) {
 		rte_errno = EINVAL;
 		return -rte_errno;
 	}
 	/* Process parameters. */
-	for (i = 0; (params[i] != NULL); ++i) {
-		if (rte_kvargs_count(kvlist, params[i])) {
-			ret = rte_kvargs_process(kvlist, params[i],
-						 mlx5_args_check, config);
-			if (ret) {
-				rte_errno = EINVAL;
-				rte_kvargs_free(kvlist);
-				return -rte_errno;
-			}
-		}
+	ret = rte_kvargs_process(kvlist, NULL, mlx5_args_check, config);
+	if (ret) {
+		rte_errno = EINVAL;
+		ret = -rte_errno;
 	}
 	rte_kvargs_free(kvlist);
-	return 0;
+	return ret;
 }
 
 /**
-- 
2.25.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] net/mlx5: fix devargs validation for multiclass probe
  2021-11-25  6:16 [PATCH] net/mlx5: fix devargs validation for multiclass probe michaelba
@ 2021-11-25  9:29 ` Thomas Monjalon
  2021-11-25 10:38   ` Matan Azrad
  0 siblings, 1 reply; 4+ messages in thread
From: Thomas Monjalon @ 2021-11-25  9:29 UTC (permalink / raw)
  To: Matan Azrad, Raslan Darawsheh, Michael Baum
  Cc: dev, Viacheslav Ovsiienko, stable, Lior Margalit, asafp

25/11/2021 07:16, michaelba@nvidia.com:
> From: Michael Baum <michaelba@nvidia.com>
> 
> The mlx5_args function reads the devargs and checks if they are valid
> for this driver and if not it returns an error.
> 
> This was normal behavior as long as all the devargs come to this driver,
> but since it is possible to run several drivers together, the function
> may return an error for another driver's devarg even though it is
> completely valid.
> In addition the function does not allow the user to know which of the
> devargs he sent is incorrect, but returns an error without printing the
> unknown devarg.
> 
> This patch eliminates the error return in the case of an unknown devarg,
> and prints a warning for each such devarg specifically.
> 
> Fixes: 7b4f1e6bd367 ("common/mlx5: introduce common library")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Michael Baum <michaelba@nvidia.com>
> Acked-by: Matan Azrad <matan@nvidia.com>
> ---
>  drivers/net/mlx5/mlx5.c | 68 ++++++-----------------------------------
>  1 file changed, 9 insertions(+), 59 deletions(-)

It is quite a big patch.
How well it has been tested?
How critical it is to have in 21.11?



^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [PATCH] net/mlx5: fix devargs validation for multiclass probe
  2021-11-25  9:29 ` Thomas Monjalon
@ 2021-11-25 10:38   ` Matan Azrad
  2021-11-26 12:39     ` Thomas Monjalon
  0 siblings, 1 reply; 4+ messages in thread
From: Matan Azrad @ 2021-11-25 10:38 UTC (permalink / raw)
  To: NBU-Contact-Thomas Monjalon (EXTERNAL), Raslan Darawsheh, Michael Baum
  Cc: dev, Slava Ovsiienko, stable, Lior Margalit, Asaf Penso



From: Thomas Monjalon
> 25/11/2021 07:16, michaelba@nvidia.com:
> > From: Michael Baum <michaelba@nvidia.com>
> >
> > The mlx5_args function reads the devargs and checks if they are valid
> > for this driver and if not it returns an error.
> >
> > This was normal behavior as long as all the devargs come to this
> > driver, but since it is possible to run several drivers together, the
> > function may return an error for another driver's devarg even though
> > it is completely valid.
> > In addition the function does not allow the user to know which of the
> > devargs he sent is incorrect, but returns an error without printing
> > the unknown devarg.
> >
> > This patch eliminates the error return in the case of an unknown
> > devarg, and prints a warning for each such devarg specifically.
> >
> > Fixes: 7b4f1e6bd367 ("common/mlx5: introduce common library")
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Michael Baum <michaelba@nvidia.com>
> > Acked-by: Matan Azrad <matan@nvidia.com>
> > ---
> >  drivers/net/mlx5/mlx5.c | 68
> > ++++++-----------------------------------
> >  1 file changed, 9 insertions(+), 59 deletions(-)
> 
> It is quite a big patch.
> How well it has been tested?

It was tested carefully to see that devargs affect the actual configuration and also to allow running !net classes devargs with the net class.

> How critical it is to have in 21.11?

CRYPTO class cannot run with NET\ETH on the same device.
No significant risk here; I suggest taking.



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] net/mlx5: fix devargs validation for multiclass probe
  2021-11-25 10:38   ` Matan Azrad
@ 2021-11-26 12:39     ` Thomas Monjalon
  0 siblings, 0 replies; 4+ messages in thread
From: Thomas Monjalon @ 2021-11-26 12:39 UTC (permalink / raw)
  To: Michael Baum, Matan Azrad
  Cc: Raslan Darawsheh, dev, Slava Ovsiienko, stable, Lior Margalit,
	Asaf Penso

25/11/2021 11:38, Matan Azrad:
> From: Thomas Monjalon
> > 25/11/2021 07:16, michaelba@nvidia.com:
> > > From: Michael Baum <michaelba@nvidia.com>
> > >
> > > The mlx5_args function reads the devargs and checks if they are valid
> > > for this driver and if not it returns an error.
> > >
> > > This was normal behavior as long as all the devargs come to this
> > > driver, but since it is possible to run several drivers together, the
> > > function may return an error for another driver's devarg even though
> > > it is completely valid.
> > > In addition the function does not allow the user to know which of the
> > > devargs he sent is incorrect, but returns an error without printing
> > > the unknown devarg.
> > >
> > > This patch eliminates the error return in the case of an unknown
> > > devarg, and prints a warning for each such devarg specifically.
> > >
> > > Fixes: 7b4f1e6bd367 ("common/mlx5: introduce common library")
> > > Cc: stable@dpdk.org
> > >
> > > Signed-off-by: Michael Baum <michaelba@nvidia.com>
> > > Acked-by: Matan Azrad <matan@nvidia.com>
> > > ---
> > >  drivers/net/mlx5/mlx5.c | 68
> > > ++++++-----------------------------------
> > >  1 file changed, 9 insertions(+), 59 deletions(-)
> > 
> > It is quite a big patch.
> > How well it has been tested?
> 
> It was tested carefully to see that devargs affect the actual configuration and also to allow running !net classes devargs with the net class.
> 
> > How critical it is to have in 21.11?
> 
> CRYPTO class cannot run with NET\ETH on the same device.
> No significant risk here; I suggest taking.

OK, applied, thanks.




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-11-26 12:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-25  6:16 [PATCH] net/mlx5: fix devargs validation for multiclass probe michaelba
2021-11-25  9:29 ` Thomas Monjalon
2021-11-25 10:38   ` Matan Azrad
2021-11-26 12:39     ` Thomas Monjalon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).