Skip to contentSkip to conversation

examples/vhost: fix port init failure in mergeable mode

PATCH Applied Chenbo Xia 2 participants 5 messages Nov 4, 2021 – Nov 16, 2021

lore
Share & tools
lore

Chenbo Xia

author
#0 lore raw

PATCH 1/1 examples/vhost: fix port init failure in mergeable mode

When the example starts in mergeable mode with an i40e port, it fails to launch because the examples use default mtu MAX_MTU to configure ethdev. The root cause is some devices have Ethernet frame overhead and then MAX_MTU will be larger than device's max mtu, so the ethdev configure will fail.

This patch checks the device's max mtu before setting the ethdev configuration. If the device has a max mtu, use that value to configure.

Fixes 1bb4a528c41f ("ethdev: fix max Rx packet length")
---
 examples/vhost/main.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
examples/vhost/main.c +7 -2
index 58e12aa710..09fb2382bf 100644
@@ -273,6 +273,13 @@ port_init(uint16_t port)
 
 	tx_rings = (uint16_t)rte_lcore_count();
 
+	if (mergeable) {
+		if (dev_info.max_mtu != UINT16_MAX && dev_info.max_rx_pktlen > dev_info.max_mtu)
+			vmdq_conf_default.rxmode.mtu = dev_info.max_mtu;
+		else
+			vmdq_conf_default.rxmode.mtu = MAX_MTU;
+	}
+
 	/* Get port configuration. */
 	retval = get_eth_conf(&port_conf, num_devices);
 	if (retval < 0)
@@ -631,8 +638,6 @@ us_vhost_parse_args(int argc, char **argv)
 				return -1;
 			}
 			mergeable = !!ret;
-			if (ret)
-				vmdq_conf_default.rxmode.mtu = MAX_MTU;
 			break;
 
 		case OPT_STATS_NUM:
Signature · 1 line
2.17.1
#1 lore raw

Hi Maxime,

Quoted 18 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of Chenbo Xia
Sent: Thursday, November 4, 2021 1:11 PM
To: [email protected]
Cc: [email protected]
Subject: [dpdk-dev] [PATCH] examples/vhost: fix port init failure in mergeable mode

When the example starts in mergeable mode with an i40e port, it fails to launch because the examples use default mtu MAX_MTU to configure ethdev. The root cause is some devices have Ethernet frame overhead and then MAX_MTU will be larger than device's max mtu, so the ethdev configure will fail.

This patch checks the device's max mtu before setting the ethdev configuration. If the device has a max mtu, use that value to configure.

Quoted 5 lines
Fixes 1bb4a528c41f ("ethdev: fix max Rx packet length")

---

I see a unit test failure on this patch, but I think this patch should not cause issues in unit test, could you help me confirm it?

Thanks,
Chenbo

#2 lore raw
Quoted 20 lines · Chenbo

Hi Maxime,

Quoted 18 lines

-----Original Message-----
From: dev <[email protected]> On Behalf Of Chenbo Xia
Sent: Thursday, November 4, 2021 1:11 PM
To: [email protected]
Cc: [email protected]
Subject: [dpdk-dev] [PATCH] examples/vhost: fix port init failure in mergeable mode

When the example starts in mergeable mode with an i40e port, it fails to launch because the examples use default mtu MAX_MTU to configure ethdev. The root cause is some devices have Ethernet frame overhead and then MAX_MTU will be larger than device's max mtu, so the ethdev configure will fail.

This patch checks the device's max mtu before setting the ethdev configuration. If the device has a max mtu, use that value to configure.

Quoted 8 lines
Quoted 5 lines
Fixes 1bb4a528c41f ("ethdev: fix max Rx packet length")

---

I see a unit test failure on this patch, but I think this patch should not cause issues in unit test, could you help me confirm it?

I can confirm, mcslock_autotest is not related to your change, and it seems other patches are facing the same issue, eg:
https://lab.dpdk.org/results/dashboard/patchsets/19997/

Maxime

Quoted 3 lines

Thanks,
Chenbo

Reviewed-by on v1 1/1
#3 lore raw
In reply to Chenbo Xia
Quoted 38 lines · Chenbo Xia

When the example starts in mergeable mode with an i40e port, it fails to launch because the examples use default mtu MAX_MTU to configure ethdev. The root cause is some devices have Ethernet frame overhead and then MAX_MTU will be larger than device's max mtu, so the ethdev configure will fail.

This patch checks the device's max mtu before setting the ethdev configuration. If the device has a max mtu, use that value to configure.

Fixes 1bb4a528c41f ("ethdev: fix max Rx packet length")
---
  examples/vhost/main.c | 9 +++++++--
  1 file changed, 7 insertions(+), 2 deletions(-)
examples/vhost/main.c +7 -0
index 58e12aa710..09fb2382bf 100644
@@ -273,6 +273,13 @@ port_init(uint16_t port)
 
  	tx_rings = (uint16_t)rte_lcore_count();
 
+	if (mergeable) {
+		if (dev_info.max_mtu != UINT16_MAX && dev_info.max_rx_pktlen > dev_info.max_mtu)
+			vmdq_conf_default.rxmode.mtu = dev_info.max_mtu;
+		else
+			vmdq_conf_default.rxmode.mtu = MAX_MTU;
+	}
+
  	/* Get port configuration. */
  	retval = get_eth_conf(&port_conf, num_devices);
  	if (retval < 0)

examples/vhost/main.c us_vhost_parse_args(int argc, char **argv) · line 643

Quoted 8 lines
examples/vhost/main.c +0 -2
@@ -631,8 +638,6 @@ us_vhost_parse_args(int argc, char **argv)
  				return -1;
  			}
  			mergeable = !!ret;
-			if (ret)
-				vmdq_conf_default.rxmode.mtu = MAX_MTU;
  			break;
 
  		case OPT_STATS_NUM:

Thanks,
Maxime

#4 lore raw
In reply to Chenbo Xia
Quoted 10 lines · Chenbo Xia

When the example starts in mergeable mode with an i40e port, it fails to launch because the examples use default mtu MAX_MTU to configure ethdev. The root cause is some devices have Ethernet frame overhead and then MAX_MTU will be larger than device's max mtu, so the ethdev configure will fail.

This patch checks the device's max mtu before setting the ethdev configuration. If the device has a max mtu, use that value to configure.

Quoted 8 lines
Fixes 1bb4a528c41f ("ethdev: fix max Rx packet length")
---
  examples/vhost/main.c | 9 +++++++--
  1 file changed, 7 insertions(+), 2 deletions(-)

Applied to dpdk-next-virtio/main.

Thanks,
Maxime