[v1,1/5] net/e1000: fix max mtu size packets with vlan tag cannot be received by default
diff mbox series

Message ID 20200916055212.25019-2-stevex.yang@intel.com
State Superseded
Delegated to: Qi Zhang
Headers show
  • fix default max mtu size when device configured
Related show


Context Check Description
ci/checkpatch warning coding style issues

Commit Message

SteveX Yang Sept. 16, 2020, 5:52 a.m. UTC
testpmd will initialize default max packet length to 1518 which does't
include vlan tag size in ether overheader. Once, send the max mtu length
packet with vlan tag, the max packet length will exceed 1518 that will
cause packets dropped directly from NIC hw side.

e1000 can support single vlan tags that need more 4 bytes for max packet
size, so, configures the correct max packet size in dev_config ops.

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

Signed-off-by: SteveX Yang <stevex.yang@intel.com>
 drivers/net/e1000/em_ethdev.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff mbox series

diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c
index 902b1cdca..68ff892be 100644
--- a/drivers/net/e1000/em_ethdev.c
+++ b/drivers/net/e1000/em_ethdev.c
@@ -437,10 +437,21 @@  eth_em_configure(struct rte_eth_dev *dev)
 	struct e1000_interrupt *intr =
+	struct rte_eth_rxmode *rxmode = &dev->data->dev_conf.rxmode;
 	intr->flags |= E1000_FLAG_NEED_LINK_UPDATE;
+	/**
+	 * Considering vlan tag packet, max frame size should be MTU and
+	 * corresponding ether overhead.
+	 */
+	if (dev->data->mtu == RTE_ETHER_MTU &&
+		rxmode->max_rx_pkt_len == RTE_ETHER_MAX_LEN) {
+		rxmode->max_rx_pkt_len = RTE_ETHER_MTU + E1000_ETH_OVERHEAD;
+		rxmode->offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME;
+	}
 	return 0;