[1/2] net/bonding: add error hint for invald args

Message ID 20220214081344.13637-1-wanjunjie@bytedance.com (mailing list archive)
State Superseded, archived
Delegated to: Ferruh Yigit
Headers
Series [1/2] net/bonding: add error hint for invald args |

Checks

Context Check Description
ci/checkpatch warning coding style issues

Commit Message

Wan Junjie Feb. 14, 2022, 8:13 a.m. UTC
  When invalid args exsit, application exits with no error hint.
Adding a log message here will help users to know the reson.

Signed-off-by: Wan Junjie <wanjunjie@bytedance.com>
---
 drivers/net/bonding/rte_eth_bond_pmd.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
  

Comments

humin (Q) Feb. 15, 2022, 9:12 a.m. UTC | #1
Hi, wan,
	The headline has spelling errors.

在 2022/2/14 16:13, Wan Junjie 写道:
> When invalid args exsit, application exits with no error hint.
> Adding a log message here will help users to know the reson.
> 
> Signed-off-by: Wan Junjie <wanjunjie@bytedance.com>
> ---
>   drivers/net/bonding/rte_eth_bond_pmd.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c
> index bfa931098e..aa6519f83c 100644
> --- a/drivers/net/bonding/rte_eth_bond_pmd.c
> +++ b/drivers/net/bonding/rte_eth_bond_pmd.c
> @@ -3439,8 +3439,10 @@ bond_probe(struct rte_vdev_device *dev)
>   
>   	kvlist = rte_kvargs_parse(rte_vdev_device_args(dev),
>   		pmd_bond_init_valid_arguments);
> -	if (kvlist == NULL)
> +	if (kvlist == NULL) {
> +		RTE_BOND_LOG(ERR, "Invalid args in %s", rte_vdev_device_args(dev));
>   		return -1;
> +	}
>   
>   	/* Parse link bonding mode */
>   	if (rte_kvargs_count(kvlist, PMD_BOND_MODE_KVARG) == 1) {
>
  
Wan Junjie Feb. 15, 2022, 9:50 a.m. UTC | #2
Hi Min Hu,

Thanks for the reply
Will fix it in v2.

Regards,
Wan Junjie

On Tue, Feb 15, 2022 at 5:12 PM Min Hu (Connor) <humin29@huawei.com> wrote:
>
> Hi, wan,
>         The headline has spelling errors.
>
> 在 2022/2/14 16:13, Wan Junjie 写道:
> > When invalid args exsit, application exits with no error hint.
> > Adding a log message here will help users to know the reson.
> >
> > Signed-off-by: Wan Junjie <wanjunjie@bytedance.com>
> > ---
> >   drivers/net/bonding/rte_eth_bond_pmd.c | 4 +++-
> >   1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c
> > index bfa931098e..aa6519f83c 100644
> > --- a/drivers/net/bonding/rte_eth_bond_pmd.c
> > +++ b/drivers/net/bonding/rte_eth_bond_pmd.c
> > @@ -3439,8 +3439,10 @@ bond_probe(struct rte_vdev_device *dev)
> >
> >       kvlist = rte_kvargs_parse(rte_vdev_device_args(dev),
> >               pmd_bond_init_valid_arguments);
> > -     if (kvlist == NULL)
> > +     if (kvlist == NULL) {
> > +             RTE_BOND_LOG(ERR, "Invalid args in %s", rte_vdev_device_args(dev));
> >               return -1;
> > +     }
> >
> >       /* Parse link bonding mode */
> >       if (rte_kvargs_count(kvlist, PMD_BOND_MODE_KVARG) == 1) {
> >
  

Patch

diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c
index bfa931098e..aa6519f83c 100644
--- a/drivers/net/bonding/rte_eth_bond_pmd.c
+++ b/drivers/net/bonding/rte_eth_bond_pmd.c
@@ -3439,8 +3439,10 @@  bond_probe(struct rte_vdev_device *dev)
 
 	kvlist = rte_kvargs_parse(rte_vdev_device_args(dev),
 		pmd_bond_init_valid_arguments);
-	if (kvlist == NULL)
+	if (kvlist == NULL) {
+		RTE_BOND_LOG(ERR, "Invalid args in %s", rte_vdev_device_args(dev));
 		return -1;
+	}
 
 	/* Parse link bonding mode */
 	if (rte_kvargs_count(kvlist, PMD_BOND_MODE_KVARG) == 1) {