[dpdk-stable] [v2] net/i40e: fix vlan packets drop

Xiao Zhang xiao.zhang at intel.com
Mon Oct 21 04:44:51 CEST 2019


Vlan packets with ip length bigger then 1496 will not be received by
i40e/i40evf due to wrong packets size checking. This patch fixes the issue
by correcting the maximum frame size during checking.

Fixes: 43e5488c0ac6 ("net/i40e: support MTU configuration")
Cc: stable at dpdk.org

Signed-off-by: Xiao Zhang <xiao.zhang at intel.com>
---
v2
add fix for i40evf and correct the checking when using the max_pkt_len.
---
 drivers/net/i40e/i40e_ethdev.c    | 2 +-
 drivers/net/i40e/i40e_ethdev_vf.c | 8 +++++---
 drivers/net/i40e/i40e_rxtx.c      | 6 ++++--
 3 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 2ca14da..156d67b 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -12103,7 +12103,7 @@ i40e_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
 		return -EBUSY;
 	}
 
-	if (frame_size > RTE_ETHER_MAX_LEN)
+	if (frame_size > RTE_ETHER_MAX_LEN + I40E_VLAN_TAG_SIZE * 2)
 		dev_data->dev_conf.rxmode.offloads |=
 			DEV_RX_OFFLOAD_JUMBO_FRAME;
 	else
diff --git a/drivers/net/i40e/i40e_ethdev_vf.c b/drivers/net/i40e/i40e_ethdev_vf.c
index 5dba092..bc825e2 100644
--- a/drivers/net/i40e/i40e_ethdev_vf.c
+++ b/drivers/net/i40e/i40e_ethdev_vf.c
@@ -1782,12 +1782,14 @@ i40evf_rxq_init(struct rte_eth_dev *dev, struct i40e_rx_queue *rxq)
 		}
 	} else {
 		if (rxq->max_pkt_len < RTE_ETHER_MIN_LEN ||
-		    rxq->max_pkt_len > RTE_ETHER_MAX_LEN) {
+		    rxq->max_pkt_len > RTE_ETHER_MAX_LEN +
+				I40E_VLAN_TAG_SIZE * 2) {
 			PMD_DRV_LOG(ERR, "maximum packet length must be "
 				"larger than %u and smaller than %u, as jumbo "
 				"frame is disabled",
 				(uint32_t)RTE_ETHER_MIN_LEN,
-				(uint32_t)RTE_ETHER_MAX_LEN);
+				(uint32_t)RTE_ETHER_MAX_LEN +
+					I40E_VLAN_TAG_SIZE * 2);
 			return I40E_ERR_CONFIG;
 		}
 	}
@@ -2747,7 +2749,7 @@ i40evf_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
 		return -EBUSY;
 	}
 
-	if (frame_size > RTE_ETHER_MAX_LEN)
+	if (frame_size > RTE_ETHER_MAX_LEN + I40E_VLAN_TAG_SIZE * 2)
 		dev_data->dev_conf.rxmode.offloads |=
 			DEV_RX_OFFLOAD_JUMBO_FRAME;
 	else
diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c
index ff6eb4a..0c178e3 100644
--- a/drivers/net/i40e/i40e_rxtx.c
+++ b/drivers/net/i40e/i40e_rxtx.c
@@ -2634,12 +2634,14 @@ i40e_rx_queue_config(struct i40e_rx_queue *rxq)
 		}
 	} else {
 		if (rxq->max_pkt_len < RTE_ETHER_MIN_LEN ||
-			rxq->max_pkt_len > RTE_ETHER_MAX_LEN) {
+			rxq->max_pkt_len > RTE_ETHER_MAX_LEN +
+				I40E_VLAN_TAG_SIZE * 2) {
 			PMD_DRV_LOG(ERR, "maximum packet length must be "
 				    "larger than %u and smaller than %u, "
 				    "as jumbo frame is disabled",
 				    (uint32_t)RTE_ETHER_MIN_LEN,
-				    (uint32_t)RTE_ETHER_MAX_LEN);
+				    (uint32_t)RTE_ETHER_MAX_LEN +
+						I40E_VLAN_TAG_SIZE * 2);
 			return I40E_ERR_CONFIG;
 		}
 	}
-- 
2.7.4



More information about the stable mailing list