[v1] app/testpmd: fix the overhead overflow issue

Message ID 20201105095151.61052-1-stevex.yang@intel.com (mailing list archive)
State Rejected, archived
Headers
Series [v1] app/testpmd: fix the overhead overflow issue |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK
ci/travis-robot success Travis build: passed
ci/iol-testing success Testing PASS
ci/iol-intel-Functional fail Functional Testing issues
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS

Commit Message

Steve Yang Nov. 5, 2020, 9:51 a.m. UTC
  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.yang@intel.com>
---
 app/test-pmd/testpmd.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
  

Comments

Ferruh Yigit Nov. 5, 2020, 2:31 p.m. UTC | #1
On 11/5/2020 9:51 AM, Steve Yang wrote:
> 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.yang@intel.com>

Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>
  
Thomas Monjalon Nov. 5, 2020, 6:22 p.m. UTC | #2
05/11/2020 15:31, Ferruh Yigit:
> On 11/5/2020 9:51 AM, Steve Yang wrote:
> > 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.yang@intel.com>
> 
> Acked-by: Ferruh Yigit <ferruh.yigit@intel.com>

Rejected because causing other issues:
http://inbox.dpdk.org/dev/CADyeNEB2610Shzm6QN--wO8wDzg_-QtYuG05=gWrcaA39h0_ww@mail.gmail.com/
  

Patch

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