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

Message ID 20200916055212.25019-3-stevex.yang@intel.com
State Superseded, archived
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

Steve 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.

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

Fixes: a5aeb2b9e225 ("net/igc: support Rx and Tx")

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

diff mbox series

diff --git a/drivers/net/igc/igc_ethdev.c b/drivers/net/igc/igc_ethdev.c
index 6ab3ee909..6113793a2 100644
--- a/drivers/net/igc/igc_ethdev.c
+++ b/drivers/net/igc/igc_ethdev.c
@@ -341,10 +341,20 @@  static int
 eth_igc_configure(struct rte_eth_dev *dev)
 	struct igc_interrupt *intr = IGC_DEV_PRIVATE_INTR(dev);
+	struct rte_eth_rxmode *rxmode = &dev->data->dev_conf.rxmode;
 	int ret;
+	/* 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 + IGC_ETH_OVERHEAD;
+		rxmode->offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME;
+	}
 	ret  = igc_check_mq_mode(dev);
 	if (ret != 0)
 		return ret;