On 12/17/2020 9:22 AM, Steve Yang wrote:
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.

Removed the rx_offloads assignment for jumbo frame during command line
parsing, and set the correct jumbo frame flag if MTU size is larger than
the default value 'RTE_ETHER_MTU' within 'init_config()'.

Fixes: 384161e00627 ("app/testpmd: adjust on the fly VLAN configuration")
Fixes: 35b2d13fd6fd ("net: add rte prefix to ether defines")
Fixes: ce17eddefc20 ("ethdev: introduce Rx queue offloads API")
Fixes: 150c9ac2df13 ("app/testpmd: update Rx offload after setting MTU")

Signed-off-by: Steve Yang <stevex.y...@intel.com>

<...>

@@ -1446,6 +1447,25 @@ 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_mtu &&

Similar to the ethdev comment, above check can be dropped.

+                   port->dev_info.max_mtu != UINT16_MAX &&
+                   port->dev_info.max_rx_pktlen &&
+                   port->dev_info.max_rx_pktlen > port->dev_info.max_mtu)
+                       eth_overhead = port->dev_info.max_rx_pktlen -
+                               port->dev_info.max_mtu;
+               else
+                       eth_overhead =
+                               RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN;
+
+               if (port->dev_conf.rxmode.max_rx_pkt_len <=
+                       (uint32_t)(RTE_ETHER_MTU + eth_overhead))
+                       port->dev_conf.rxmode.max_rx_pkt_len =
+                                       RTE_ETHER_MTU + eth_overhead;
+               else
+                       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 &=


Reply via email to