examples/vhost: fix floating point exception when there is no VMDQ

Message ID 20220411163451.572814-1-yuanx.wang@intel.com (mailing list archive)
State Superseded, archived
Delegated to: Maxime Coquelin
Headers
Series examples/vhost: fix floating point exception when there is no VMDQ |

Checks

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

Commit Message

Wang, YuanX April 11, 2022, 4:34 p.m. UTC
  If the VMDQ limits is 0, a divide-by-zero error occurs.
This patch replaces throwing a floating point exception with
a normal error message.

Signed-off-by: Yuan Wang <yuanx.wang@intel.com>
---
 examples/vhost/main.c | 4 ++++
 1 file changed, 4 insertions(+)
  

Comments

Chenbo Xia May 16, 2022, 12:57 p.m. UTC | #1
Hi Yuan,

> -----Original Message-----
> From: Wang, YuanX <yuanx.wang@intel.com>
> Sent: Tuesday, April 12, 2022 12:35 AM
> To: maxime.coquelin@redhat.com; Xia, Chenbo <chenbo.xia@intel.com>
> Cc: dev@dpdk.org; Hu, Jiayu <jiayu.hu@intel.com>; He, Xingguang
> <xingguang.he@intel.com>; Wang, YuanX <yuanx.wang@intel.com>
> Subject: [PATCH] examples/vhost: fix floating point exception when there
> is no VMDQ

Based on the error reported by devtools/check-git-log.sh

Title better be: examples/vhost: fix floating point exception when no VMDq

> 
> If the VMDQ limits is 0, a divide-by-zero error occurs.
> This patch replaces throwing a floating point exception with
> a normal error message.

Pls add fix and cc-stable tag.

Thanks,
Chenbo

> 
> Signed-off-by: Yuan Wang <yuanx.wang@intel.com>
> ---
>  examples/vhost/main.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/examples/vhost/main.c b/examples/vhost/main.c
> index d94fabb060..815ac1cd57 100644
> --- a/examples/vhost/main.c
> +++ b/examples/vhost/main.c
> @@ -400,6 +400,10 @@ port_init(uint16_t port)
> 
>  		return retval;
>  	}
> +	if (dev_info.max_vmdq_pools == 0) {
> +		RTE_LOG(ERR, VHOST_PORT, "Failed to get VMDQ info.\n");
> +		return -1;
> +	}
> 
>  	rxconf = &dev_info.default_rxconf;
>  	txconf = &dev_info.default_txconf;
> --
> 2.25.1
  
Wang, YuanX May 17, 2022, 10:14 a.m. UTC | #2
Hi Chenbo,

> -----Original Message-----
> From: Xia, Chenbo <chenbo.xia@intel.com>
> Sent: Monday, May 16, 2022 8:57 PM
> To: Wang, YuanX <yuanx.wang@intel.com>; maxime.coquelin@redhat.com
> Cc: dev@dpdk.org; Hu, Jiayu <jiayu.hu@intel.com>; He, Xingguang
> <xingguang.he@intel.com>
> Subject: RE: [PATCH] examples/vhost: fix floating point exception when
> there is no VMDQ
> 
> Hi Yuan,
> 
> > -----Original Message-----
> > From: Wang, YuanX <yuanx.wang@intel.com>
> > Sent: Tuesday, April 12, 2022 12:35 AM
> > To: maxime.coquelin@redhat.com; Xia, Chenbo <chenbo.xia@intel.com>
> > Cc: dev@dpdk.org; Hu, Jiayu <jiayu.hu@intel.com>; He, Xingguang
> > <xingguang.he@intel.com>; Wang, YuanX <yuanx.wang@intel.com>
> > Subject: [PATCH] examples/vhost: fix floating point exception when
> > there is no VMDQ
> 
> Based on the error reported by devtools/check-git-log.sh
> 
> Title better be: examples/vhost: fix floating point exception when no VMDq
> 
> >
> > If the VMDQ limits is 0, a divide-by-zero error occurs.
> > This patch replaces throwing a floating point exception with a normal
> > error message.
> 
> Pls add fix and cc-stable tag.

Thanks for the comments, will fix it in next version.

Regards,
Yuan

> 
> Thanks,
> Chenbo
> 
> >
> > Signed-off-by: Yuan Wang <yuanx.wang@intel.com>
> > ---
> >  examples/vhost/main.c | 4 ++++
> >  1 file changed, 4 insertions(+)
> >
> > diff --git a/examples/vhost/main.c b/examples/vhost/main.c index
> > d94fabb060..815ac1cd57 100644
> > --- a/examples/vhost/main.c
> > +++ b/examples/vhost/main.c
> > @@ -400,6 +400,10 @@ port_init(uint16_t port)
> >
> >  		return retval;
> >  	}
> > +	if (dev_info.max_vmdq_pools == 0) {
> > +		RTE_LOG(ERR, VHOST_PORT, "Failed to get VMDQ info.\n");
> > +		return -1;
> > +	}
> >
> >  	rxconf = &dev_info.default_rxconf;
> >  	txconf = &dev_info.default_txconf;
> > --
> > 2.25.1
  

Patch

diff --git a/examples/vhost/main.c b/examples/vhost/main.c
index d94fabb060..815ac1cd57 100644
--- a/examples/vhost/main.c
+++ b/examples/vhost/main.c
@@ -400,6 +400,10 @@  port_init(uint16_t port)
 
 		return retval;
 	}
+	if (dev_info.max_vmdq_pools == 0) {
+		RTE_LOG(ERR, VHOST_PORT, "Failed to get VMDQ info.\n");
+		return -1;
+	}
 
 	rxconf = &dev_info.default_rxconf;
 	txconf = &dev_info.default_txconf;