Skip to content

Commit

Permalink
app/testpmd: fix max Rx packet length for VLAN packet
Browse files Browse the repository at this point in the history
[ upstream commit f6870a7 ]

When the max Rx packet length is smaller than the sum of MTU size and
ether overhead size, it should be enlarged, otherwise the VLAN packets
will be dropped.

Fixes: 35b2d13 ("net: add rte prefix to ether defines")

Signed-off-by: Steve Yang <stevex.yang@intel.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
  • Loading branch information
Steve Yang authored and bluca committed Nov 9, 2020
1 parent 3f359e8 commit 28c5e85
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions app/test-pmd/testpmd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1301,6 +1301,7 @@ init_config(void)
struct rte_gro_param gro_param;
uint32_t gso_types;
uint16_t data_size;
uint16_t overhead_len;
bool warning = 0;
int k;
int ret;
Expand Down Expand Up @@ -1337,6 +1338,28 @@ init_config(void)
rte_exit(EXIT_FAILURE,
"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)
overhead_len = port->dev_info.max_rx_pktlen -
port->dev_info.max_mtu;
else
overhead_len = RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN;

port->dev_conf.rxmode.max_rx_pkt_len =
RTE_ETHER_MTU + overhead_len;

/*
* This is workaround to avoid resize max rx packet len.
* Ethdev assumes jumbo frame size must be greater than
* RTE_ETHER_MAX_LEN, and will resize 'max_rx_pkt_len' to
* default value when it is greater than RTE_ETHER_MAX_LEN
* for normal frame.
*/
if (port->dev_conf.rxmode.max_rx_pkt_len > RTE_ETHER_MAX_LEN) {
port->dev_conf.rxmode.offloads |=
DEV_RX_OFFLOAD_JUMBO_FRAME;
}

if (!(port->dev_info.tx_offload_capa &
DEV_TX_OFFLOAD_MBUF_FAST_FREE))
port->dev_conf.txmode.offloads &=
Expand Down

0 comments on commit 28c5e85

Please sign in to comment.