Skip to contentSkip to conversation

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

PATCH Superseded Yuan Wang 3 participants 6 messages Apr 11, 2022 – Jun 1, 2022

lore
Share & tools
lore

Yuan Wang

author
#0 lore raw

PATCH 1/1 examples/vhost: fix floating point exception when there is 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.

---
 examples/vhost/main.c | 4 ++++
 1 file changed, 4 insertions(+)
examples/vhost/main.c +4 -0
index d94fabb060..815ac1cd57 100644
@@ -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;
Signature · 1 line
2.25.1
#1 lore raw

Hi Yuan,

Quoted 8 lines

-----Original Message-----
From: Wang, YuanX <[email protected]>
Sent: Tuesday, April 12, 2022 12:35 AM
To: [email protected]; Xia, Chenbo <[email protected]>
Cc: [email protected]; Hu, Jiayu <[email protected]>; He, Xingguang <[email protected]>; Wang, YuanX <[email protected]>
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

Quoted 4 lines

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

Quoted 23 lines
---
 examples/vhost/main.c | 4 ++++
 1 file changed, 4 insertions(+)
examples/vhost/main.c +4 -1
index d94fabb060..815ac1cd57 100644
@@ -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

#2 lore raw

Hi Chenbo,

Quoted 22 lines

-----Original Message-----
From: Xia, Chenbo <[email protected]>
Sent: Monday, May 16, 2022 8:57 PM
To: Wang, YuanX <[email protected]>; [email protected]
Cc: [email protected]; Hu, Jiayu <[email protected]>; He, Xingguang <[email protected]>
Subject: RE: [PATCH] examples/vhost: fix floating point exception when there is no VMDQ

Hi Yuan,

Quoted 8 lines

-----Original Message-----
From: Wang, YuanX <[email protected]>
Sent: Tuesday, April 12, 2022 12:35 AM
To: [email protected]; Xia, Chenbo <[email protected]>
Cc: [email protected]; Hu, Jiayu <[email protected]>; He, Xingguang <[email protected]>; Wang, YuanX <[email protected]>
Subject: [PATCH] examples/vhost: fix floating point exception when there is no VMDQ

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

Quoted 8 lines

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

Quoted 4 lines

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

Quoted 27 lines

Thanks,
Chenbo

Quoted 23 lines
---
 examples/vhost/main.c | 4 ++++
 1 file changed, 4 insertions(+)
examples/vhost/main.c index renamed from examples/vhost/main.c +0 -0

d94fabb060..815ac1cd57 100644

examples/vhost/main.c +4 -1
@@ -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

author
#3 lore raw

PATCH v2 1/1 examples/vhost: fix floating point exception when no VMDq

In reply to Yuan Wang

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.

Fixes d19533e86f ("examples/vhost: copy old vhost example")
---
 examples/vhost/main.c | 4 ++++
 1 file changed, 4 insertions(+)
examples/vhost/main.c +4 -0
index c4d46de1c5..48d9f3802f 100644
@@ -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;
Signature · 1 line
2.25.1
Reviewed-by on v2 1/1
#4 lore raw

RE: [PATCH v2] examples/vhost: fix floating point exception when no VMDq

Quoted 38 lines

-----Original Message-----
From: Wang, YuanX <[email protected]>
Sent: Wednesday, May 18, 2022 9:37 PM
To: [email protected]; Xia, Chenbo <[email protected]>
Cc: [email protected]; Hu, Jiayu <[email protected]>; He, Xingguang <[email protected]>; Wang, YuanX <[email protected]>; [email protected]
Subject: [PATCH v2] 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.

Fixes d19533e86f ("examples/vhost: copy old vhost example")
---
 examples/vhost/main.c | 4 ++++
 1 file changed, 4 insertions(+)
examples/vhost/main.c +4 -1
index c4d46de1c5..48d9f3802f 100644
@@ -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;
--
Quoted 1 line

2.25.1

#5 lore raw

Re: [PATCH v2] examples/vhost: fix floating point exception when no VMDq

In reply to Yuan Wang
Quoted 17 lines · Yuan Wang

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.

Fixes d19533e86f ("examples/vhost: copy old vhost example")
---
  examples/vhost/main.c | 4 ++++
  1 file changed, 4 insertions(+)
examples/vhost/main.c +0 -0
index c4d46de1c5..48d9f3802f 100644

examples/vhost/main.c port_init(uint16_t port) · line 409

Quoted 10 lines
examples/vhost/main.c +4 -0
@@ -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;

Applied to dpdk-next-virtio/main.

Thanks,
Maxime