If "dev_info.max_mtu" isn't set by driver, the rte_ethdev will set
default value "UINT16_MAX", that will cause the overhead value overflow.

Add more strict condition to ensure the overhead valid.

Fixes: bed05536c8f8 ("app/testpmd: fix max Rx packet length for VLAN packets")

Signed-off-by: Steve Yang <stevex.y...@intel.com>
---
 app/test-pmd/testpmd.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index c263121a9a..b34eaf2016 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -1459,7 +1459,10 @@ init_config(void)
                                 "rte_eth_dev_info_get() failed\n");
 
                /* Update the max_rx_pkt_len to have MTU as RTE_ETHER_MTU */
-               if (port->dev_info.max_rx_pktlen && port->dev_info.max_mtu)
+               if (port->dev_info.max_mtu &&
+                   port->dev_info.max_mtu != UINT16_MAX &&
+                   port->dev_info.max_rx_pktlen &&
+                   port->dev_info.max_rx_pktlen > port->dev_info.max_mtu)
                        overhead_len = port->dev_info.max_rx_pktlen -
                                port->dev_info.max_mtu;
                else
-- 
2.17.1

Reply via email to