From ddbc8c16a97fd6662ecccf7e8431a9a3c7f43366 Mon Sep 17 00:00:00 2001 From: Alvin Zhang Date: Thu, 8 Apr 2021 15:41:02 +0800 Subject: [PATCH] net/e1000: fix max Rx packet size According to E1000_ETH_OVERHEAD definition, max_rx_pkt_len contains one VLAN tag size. Therefore when config RLPML register, if dual VLAN not enabled there is no need to add VLAN tag size to max_rx_pkt_len, otherwise only one another VLAN tag size should be added to. Fixes: e51abef39382 ("igb: fix max RX packet size and support dual VLAN") Cc: stable@dpdk.org Signed-off-by: Alvin Zhang Tested-by: Lingli Chen Acked-by: Haiyue Wang --- drivers/net/e1000/igb_ethdev.c | 5 ++--- drivers/net/e1000/igb_rxtx.c | 9 ++++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/net/e1000/igb_ethdev.c b/drivers/net/e1000/igb_ethdev.c index 7d6d04abcb..3fdffe3294 100644 --- a/drivers/net/e1000/igb_ethdev.c +++ b/drivers/net/e1000/igb_ethdev.c @@ -2686,8 +2686,7 @@ igb_vlan_hw_extend_disable(struct rte_eth_dev *dev) /* Update maximum packet length */ if (dev->data->dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_JUMBO_FRAME) E1000_WRITE_REG(hw, E1000_RLPML, - dev->data->dev_conf.rxmode.max_rx_pkt_len + - VLAN_TAG_SIZE); + dev->data->dev_conf.rxmode.max_rx_pkt_len); } static void @@ -2706,7 +2705,7 @@ igb_vlan_hw_extend_enable(struct rte_eth_dev *dev) if (dev->data->dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_JUMBO_FRAME) E1000_WRITE_REG(hw, E1000_RLPML, dev->data->dev_conf.rxmode.max_rx_pkt_len + - 2 * VLAN_TAG_SIZE); + VLAN_TAG_SIZE); } static int diff --git a/drivers/net/e1000/igb_rxtx.c b/drivers/net/e1000/igb_rxtx.c index 45da4ed9d2..278d5d2712 100644 --- a/drivers/net/e1000/igb_rxtx.c +++ b/drivers/net/e1000/igb_rxtx.c @@ -2343,15 +2343,18 @@ eth_igb_rx_init(struct rte_eth_dev *dev) * Configure support of jumbo frames, if any. */ if (dev->data->dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_JUMBO_FRAME) { + uint32_t max_len = dev->data->dev_conf.rxmode.max_rx_pkt_len; + rctl |= E1000_RCTL_LPE; /* * Set maximum packet length by default, and might be updated * together with enabling/disabling dual VLAN. */ - E1000_WRITE_REG(hw, E1000_RLPML, - dev->data->dev_conf.rxmode.max_rx_pkt_len + - VLAN_TAG_SIZE); + if (rxmode->offloads & DEV_RX_OFFLOAD_VLAN_EXTEND) + max_len += VLAN_TAG_SIZE; + + E1000_WRITE_REG(hw, E1000_RLPML, max_len); } else rctl &= ~E1000_RCTL_LPE; -- 2.20.1