Skip to contentSkip to conversation

net/i40e: fix vlan packets drop

dpdk-dev Superseded Xiao Zhang 5 participants 10 messages Oct 14, 2019 – Feb 10, 2020 Network drivers

lore
Share & tools
lore

Xiao Zhang

author
#0 lore raw

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

Fixes 35b2d13fd6fd ("net: add rte prefix to ether defines")
---
 drivers/net/i40e/i40e_ethdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/i40e/i40e_ethdev.c +1 -1
index 2ca14da..156d67b 100644
@@ -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
Signature · 1 line
2.7.4
#1 lore raw
Quoted 5 lines · Xiao Zhang

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

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

To make sure it is backported to the correct stable branches, please tag the commit that introduced the bug, not the last commit to touch the line.

drivers/net/i40e/i40e_ethdev.c

Quoted 11 lines
---
 drivers/net/i40e/i40e_ethdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/i40e/i40e_ethdev.c +0 -0
index 2ca14da..156d67b 100644

What about vf?

drivers/net/i40e/i40e_ethdev.c i40e_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) · line 12109

Quoted 10 lines
drivers/net/i40e/i40e_ethdev.c +1 -1
@@ -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

+cc Ian, who looked into MTU for i40e a while back.

MTU code changing makes me nervous. You would need to look through everywhere there is something related to pkt len to check it is still ok.

E.g. if I got it right (maybe I miss something), this means a 1500 mtu will set frame_size to 1526, which will turn off jumbo and set dev_data->dev_conf.rxmode.max_rx_pkt_len = 1526

Then in i40e_rx_queue_config()

rxq->max_pkt_len = RTE_MIN(len, data->dev_conf.rxmode.max_rx_pkt_len);
                   ^^^ lets say max_rx_pkt_len (1526) is the min

if (data->dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_JUMBO_FRAME) {

[snip jumbo on branch]

} else {
	if (rxq->max_pkt_len < RTE_ETHER_MIN_LEN ||
		rxq->max_pkt_len > RTE_ETHER_MAX_LEN) {
                ^^^ 1526           ^^^ 1518

		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);
		return I40E_ERR_CONFIG;
                ^^^ Error returned ???
	}
}
#2 lore raw

Hi Kevin,

Quoted 9 lines

-----Original Message-----
From: Kevin Traynor [mailto:[email protected]]
Sent: Tuesday, October 15, 2019 1:42 AM
To: Zhang, Xiao <[email protected]>; [email protected]
Cc: Xing, Beilei <[email protected]>; Zhang, Qi Z <[email protected]>; [email protected]; Stokes, Ian <[email protected]>
Subject: Re: [dpdk-dev] net/i40e: fix vlan packets drop

On 14/10/2019 08:53, Xiao Zhang wrote:

Quoted 8 lines
Quoted 5 lines

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

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

To make sure it is backported to the correct stable branches, please tag the commit that introduced the bug, not the last commit to touch the line.

Got it, the right fixline should be Fixes: 43e5488c0ac6 ("net/i40e: support MTU configuration"), will correct it.

Quoted 8 lines
Quoted 8 lines
---
 drivers/net/i40e/i40e_ethdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 6 lines

drivers/net/i40e/i40e_ethdev.c

Quoted 4 lines
(quoted diff) +0 -0

b/drivers/net/i40e/i40e_ethdev.c index 2ca14da..156d67b 100644

drivers/net/i40e/i40e_ethdev.c +0 -0

What about vf?

vf also need to be fixed, will add it.

Quoted 31 lines

drivers/net/i40e/i40e_ethdev.c i40e_dev_mtu_set(struct rte_eth_dev *dev,

Quoted 2 lines
drivers/net/i40e/i40e_ethdev.c +0 -0
@@ -12103,7 +12103,7 @@ i40e_dev_mtu_set(struct rte_eth_dev *dev,

uint16_t mtu)

drivers/net/i40e/i40e_ethdev.c i40e_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu) · line 12109

Quoted 9 lines
drivers/net/i40e/i40e_ethdev.c +1 -1
 		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

+cc Ian, who looked into MTU for i40e a while back.

MTU code changing makes me nervous. You would need to look through everywhere there is something related to pkt len to check it is still ok.

E.g. if I got it right (maybe I miss something), this means a 1500 mtu will set frame_size to 1526, which will turn off jumbo and set dev_data-

Quoted 1 line

dev_conf.rxmode.max_rx_pkt_len = 1526

Then in i40e_rx_queue_config()

rxq->max_pkt_len = RTE_MIN(len, data->dev_conf.rxmode.max_rx_pkt_len);
                   ^^^ lets say max_rx_pkt_len (1526) is the min

if (data->dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_JUMBO_FRAME) {

[snip jumbo on branch]

Quoted 14 lines
} else {
	if (rxq->max_pkt_len < RTE_ETHER_MIN_LEN ||
		rxq->max_pkt_len > RTE_ETHER_MAX_LEN) {
                ^^^ 1526           ^^^ 1518

		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);
		return I40E_ERR_CONFIG;
                ^^^ Error returned ???
	}
}

Thanks for point out. Will go through the code to check if related pkt length still ok.

author
#3 lore raw

PATCH v2 1/1 net/i40e: fix vlan packets drop

In reply to Xiao Zhang

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")

---
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(-)
drivers/net/i40e/i40e_ethdev.c +1 -1
index 2ca14da..156d67b 100644
@@ -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
drivers/net/i40e/i40e_ethdev_vf.c +5 -3
index 5dba092..bc825e2 100644
@@ -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
drivers/net/i40e/i40e_rxtx.c +4 -2
index ff6eb4a..0c178e3 100644
@@ -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;
 		}
 	}
Signature · 1 line
2.7.4
#4 lore raw
Quoted 35 lines · Xiao Zhang

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")

---
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(-)
drivers/net/i40e/i40e_ethdev.c +1 -1
index 2ca14da..156d67b 100644
@@ -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
drivers/net/i40e/i40e_ethdev_vf.c +0 -0
index 5dba092..bc825e2 100644

drivers/net/i40e/i40e_ethdev_vf.c i40evf_rxq_init(struct rte_eth_dev *dev, struct i40e_rx_queue *rxq) · line 1782

Quoted 1 line
drivers/net/i40e/i40e_ethdev_vf.c +0 -0
@@ -1782,12 +1782,14 @@ i40evf_rxq_init(struct rte_eth_dev *dev, struct i40e_rx_queue *rxq)
 		}

Size check in jumbo on case needs to be updated also

Quoted 29 lines
drivers/net/i40e/i40e_ethdev_vf.c +5 -3
 	} 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
drivers/net/i40e/i40e_rxtx.c +0 -0
index ff6eb4a..0c178e3 100644

drivers/net/i40e/i40e_rxtx.c i40e_rx_queue_config(struct i40e_rx_queue *rxq) · line 2634

Quoted 1 line
drivers/net/i40e/i40e_rxtx.c +0 -0
@@ -2634,12 +2634,14 @@ i40e_rx_queue_config(struct i40e_rx_queue *rxq)
 		}

Size check in jumbo on case needs to be updated also

Quoted 6 lines
drivers/net/i40e/i40e_rxtx.c +2 -1
 	} 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) {

drivers/net/i40e/i40e_rxtx.c i40e_rx_queue_config(struct i40e_rx_queue *rxq) · line 2647

Quoted 10 lines
drivers/net/i40e/i40e_rxtx.c +2 -1
 			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;
 		}
 	}

Doing quick search for RTE_ETHER_MAX_LEN,

- in i40e_fdir_rx_queue_init(), is 'rx_ctx.rxmax = RTE_ETHER_MAX_LEN;' still correct now?

- Looking at rte_eth_dev_configure()
https://git.dpdk.org/dpdk/tree/lib/librte_ethdev/rte_ethdev.c#n1242
Does it mean an MTU not allowed without jumbo frames during configuration is allowed later with mtu_set?

Request is to review related code and see if there are any impacts with this change.

@Beilei Xing @Qi Zhang, this patch needs careful review by i40e maintainer.

thanks,
Kevin.

author
#5 lore raw

PATCH v3 1/1 net/i40e: fix vlan packets drop

In reply to Xiao Zhang

VLAN packets with ip length bigger than 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")

---
v3
Checking more places using max packet len.
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 | 11 +++++++----
 drivers/net/i40e/i40e_fdir.c      |  2 +-
 drivers/net/i40e/i40e_rxtx.c      |  9 ++++++---
 lib/librte_ethdev/rte_ethdev.c    | 10 ++++++++--
 lib/librte_net/rte_ether.h        |  1 +
 6 files changed, 24 insertions(+), 11 deletions(-)
drivers/net/i40e/i40e_ethdev.c +1 -1
index 77a4683..b0e23c7 100644
@@ -12105,7 +12105,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
drivers/net/i40e/i40e_ethdev_vf.c +7 -4
index 5dba092..1e0b50f 100644
@@ -1772,7 +1772,8 @@ i40evf_rxq_init(struct rte_eth_dev *dev, struct i40e_rx_queue *rxq)
 	 * Check if the jumbo frame and maximum packet length are set correctly
 	 */
 	if (dev_data->dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_JUMBO_FRAME) {
-		if (rxq->max_pkt_len <= RTE_ETHER_MAX_LEN ||
+		if (rxq->max_pkt_len <= RTE_ETHER_MAX_LEN +
+				I40E_VLAN_TAG_SIZE * 2 ||
 		    rxq->max_pkt_len > I40E_FRAME_SIZE_MAX) {
 			PMD_DRV_LOG(ERR, "maximum packet length must be "
 				"larger than %u and smaller than %u, as jumbo "
@@ -1782,12 +1783,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 +2750,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
drivers/net/i40e/i40e_fdir.c +1 -1
index dee007d..8b813cb 100644
@@ -113,7 +113,7 @@ i40e_fdir_rx_queue_init(struct i40e_rx_queue *rxq)
 #endif
 	rx_ctx.dtype = i40e_header_split_none;
 	rx_ctx.hsplit_0 = I40E_HEADER_SPLIT_NONE;
-	rx_ctx.rxmax = RTE_ETHER_MAX_LEN;
+	rx_ctx.rxmax = RTE_ETHER_MAX_LEN + I40E_VLAN_TAG_SIZE * 2;
 	rx_ctx.tphrdesc_ena = 1;
 	rx_ctx.tphwdesc_ena = 1;
 	rx_ctx.tphdata_ena = 1;
drivers/net/i40e/i40e_rxtx.c +6 -3
index 6a66cec..a93b11f 100644
@@ -2617,7 +2617,8 @@ i40e_rx_queue_config(struct i40e_rx_queue *rxq)
 		RTE_MIN((uint32_t)(hw->func_caps.rx_buf_chain_len *
 			rxq->rx_buf_len), data->dev_conf.rxmode.max_rx_pkt_len);
 	if (data->dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_JUMBO_FRAME) {
-		if (rxq->max_pkt_len <= RTE_ETHER_MAX_LEN ||
+		if (rxq->max_pkt_len <= RTE_ETHER_MAX_LEN +
+				I40E_VLAN_TAG_SIZE * 2 ||
 			rxq->max_pkt_len > I40E_FRAME_SIZE_MAX) {
 			PMD_DRV_LOG(ERR, "maximum packet length must "
 				    "be larger than %u and smaller than %u,"
@@ -2628,12 +2629,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;
 		}
 	}
lib/librte_ethdev/rte_ethdev.c +8 -2
index 7743205..f6722be 100644
@@ -1257,11 +1257,17 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,
 			goto rollback;
 		}
 	} else {
+		/**
+		 * The overhead from MTU to max frame size.
+		 * Considering VLAN and QinQ packet, the VLAN tag size
+		 * needs to be added to RTE_ETHER_MAX_LEN.
+		 */
 		if (dev_conf->rxmode.max_rx_pkt_len < RTE_ETHER_MIN_LEN ||
-			dev_conf->rxmode.max_rx_pkt_len > RTE_ETHER_MAX_LEN)
+			dev_conf->rxmode.max_rx_pkt_len > RTE_ETHER_MAX_LEN
+				+ RTE_ETHER_VLAN_LEN * 2)
 			/* Use default value */
 			dev->data->dev_conf.rxmode.max_rx_pkt_len =
-							RTE_ETHER_MAX_LEN;
+				RTE_ETHER_MAX_LEN + RTE_ETHER_VLAN_LEN * 2;
 	}
 
 	/* Any requested offloading must be within its device capabilities */
lib/librte_net/rte_ether.h +1 -0
index e069dc7..9c5eee7 100644
@@ -26,6 +26,7 @@ extern "C" {
 #define RTE_ETHER_ADDR_LEN  6 /**< Length of Ethernet address. */
 #define RTE_ETHER_TYPE_LEN  2 /**< Length of Ethernet type field. */
 #define RTE_ETHER_CRC_LEN   4 /**< Length of Ethernet CRC. */
+#define RTE_ETHER_VLAN_LEN  4 /**< Length of Ethernet VLAN tag. */
 #define RTE_ETHER_HDR_LEN   \
 	(RTE_ETHER_ADDR_LEN * 2 + \
 		RTE_ETHER_TYPE_LEN) /**< Length of Ethernet header. */
Signature · 1 line
2.7.4
#6 lore raw

Hi Xiao,

Quoted 40 lines · Xiao Zhang

VLAN packets with ip length bigger than 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")

---
v3
Checking more places using max packet len.
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 | 11 +++++++----
 drivers/net/i40e/i40e_fdir.c      |  2 +-
 drivers/net/i40e/i40e_rxtx.c      |  9 ++++++---
 lib/librte_ethdev/rte_ethdev.c    | 10 ++++++++--
 lib/librte_net/rte_ether.h        |  1 +
 6 files changed, 24 insertions(+), 11 deletions(-)
drivers/net/i40e/i40e_ethdev.c +1 -1
index 77a4683..b0e23c7 100644
@@ -12105,7 +12105,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
drivers/net/i40e/i40e_ethdev_vf.c +0 -0
index 5dba092..1e0b50f 100644

drivers/net/i40e/i40e_ethdev_vf.c i40evf_rxq_init(struct rte_eth_dev *dev, struct i40e_rx_queue *rxq) · line 1779

Quoted 9 lines
drivers/net/i40e/i40e_ethdev_vf.c +2 -1
@@ -1772,7 +1772,8 @@ i40evf_rxq_init(struct rte_eth_dev *dev, struct i40e_rx_queue *rxq)
 	 * Check if the jumbo frame and maximum packet length are set correctly
 	 */
 	if (dev_data->dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_JUMBO_FRAME) {
-		if (rxq->max_pkt_len <= RTE_ETHER_MAX_LEN ||
+		if (rxq->max_pkt_len <= RTE_ETHER_MAX_LEN +
+				I40E_VLAN_TAG_SIZE * 2 ||
 		    rxq->max_pkt_len > I40E_FRAME_SIZE_MAX) {
 			PMD_DRV_LOG(ERR, "maximum packet length must be "
 				"larger than %u and smaller than %u, as jumbo "

The log needs to be match the check

Quoted 44 lines
drivers/net/i40e/i40e_ethdev_vf.c +5 -3
@@ -1782,12 +1783,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 +2750,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
drivers/net/i40e/i40e_fdir.c +1 -1
index dee007d..8b813cb 100644
@@ -113,7 +113,7 @@ i40e_fdir_rx_queue_init(struct i40e_rx_queue *rxq)
 #endif
 	rx_ctx.dtype = i40e_header_split_none;
 	rx_ctx.hsplit_0 = I40E_HEADER_SPLIT_NONE;
-	rx_ctx.rxmax = RTE_ETHER_MAX_LEN;
+	rx_ctx.rxmax = RTE_ETHER_MAX_LEN + I40E_VLAN_TAG_SIZE * 2;
 	rx_ctx.tphrdesc_ena = 1;
 	rx_ctx.tphwdesc_ena = 1;
 	rx_ctx.tphdata_ena = 1;
drivers/net/i40e/i40e_rxtx.c +0 -0
index 6a66cec..a93b11f 100644

drivers/net/i40e/i40e_rxtx.c i40e_rx_queue_config(struct i40e_rx_queue *rxq) · line 2624

Quoted 9 lines
drivers/net/i40e/i40e_rxtx.c +2 -1
@@ -2617,7 +2617,8 @@ i40e_rx_queue_config(struct i40e_rx_queue *rxq)
 		RTE_MIN((uint32_t)(hw->func_caps.rx_buf_chain_len *
 			rxq->rx_buf_len), data->dev_conf.rxmode.max_rx_pkt_len);
 	if (data->dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_JUMBO_FRAME) {
-		if (rxq->max_pkt_len <= RTE_ETHER_MAX_LEN ||
+		if (rxq->max_pkt_len <= RTE_ETHER_MAX_LEN +
+				I40E_VLAN_TAG_SIZE * 2 ||
 			rxq->max_pkt_len > I40E_FRAME_SIZE_MAX) {
 			PMD_DRV_LOG(ERR, "maximum packet length must "
 				    "be larger than %u and smaller than %u,"

The log needs to be match the check

Quoted 28 lines
drivers/net/i40e/i40e_rxtx.c +4 -2
@@ -2628,12 +2629,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;
 		}
 	}
lib/librte_ethdev/rte_ethdev.c +3 -0
index 7743205..f6722be 100644
@@ -1257,11 +1257,17 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,
 			goto rollback;
 		}
 	} else {
+		/**
+		 * The overhead from MTU to max frame size.
+		 * Considering VLAN and QinQ packet, the VLAN tag size

lib/librte_ethdev/rte_ethdev.c rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q, · line 1270

Quoted 10 lines
lib/librte_ethdev/rte_ethdev.c +5 -2
+		 * needs to be added to RTE_ETHER_MAX_LEN.
+		 */
 		if (dev_conf->rxmode.max_rx_pkt_len < RTE_ETHER_MIN_LEN ||
-			dev_conf->rxmode.max_rx_pkt_len > RTE_ETHER_MAX_LEN)
+			dev_conf->rxmode.max_rx_pkt_len > RTE_ETHER_MAX_LEN
+				+ RTE_ETHER_VLAN_LEN * 2)
 			/* Use default value */
 			dev->data->dev_conf.rxmode.max_rx_pkt_len =
-							RTE_ETHER_MAX_LEN;
+				RTE_ETHER_MAX_LEN + RTE_ETHER_VLAN_LEN * 2;

+cc ethdev maintainers

This looks ok to me for i40e case, but I don't know if there is a consequence for other PMDs. It seems late to change this, so maybe you can live without this part for now.

Even on the i40e parts, there can be some subtle bug and I requested i40e maintainers to review carefully but it has not happened, so for me it shouldn't be merged at present.

Quoted 16 lines
lib/librte_ethdev/rte_ethdev.c +0 -0
 	}
 
 	/* Any requested offloading must be within its device capabilities */
lib/librte_net/rte_ether.h +1 -0
index e069dc7..9c5eee7 100644
@@ -26,6 +26,7 @@ extern "C" {
 #define RTE_ETHER_ADDR_LEN  6 /**< Length of Ethernet address. */
 #define RTE_ETHER_TYPE_LEN  2 /**< Length of Ethernet type field. */
 #define RTE_ETHER_CRC_LEN   4 /**< Length of Ethernet CRC. */
+#define RTE_ETHER_VLAN_LEN  4 /**< Length of Ethernet VLAN tag. */
 #define RTE_ETHER_HDR_LEN   \
 	(RTE_ETHER_ADDR_LEN * 2 + \
 		RTE_ETHER_TYPE_LEN) /**< Length of Ethernet header. */
#7 lore raw

08/11/2019 20:28, Kevin Traynor:

Quoted 47 lines

Hi Xiao,

Quoted 31 lines · Xiao Zhang

VLAN packets with ip length bigger than 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")

---
v3
Checking more places using max packet len.
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 | 11 +++++++----
 drivers/net/i40e/i40e_fdir.c      |  2 +-
 drivers/net/i40e/i40e_rxtx.c      |  9 ++++++---
 lib/librte_ethdev/rte_ethdev.c    | 10 ++++++++--
 lib/librte_net/rte_ether.h        |  1 +
 6 files changed, 24 insertions(+), 11 deletions(-)
lib/librte_ethdev/rte_ethdev.c +3 -0
@@ -1257,11 +1257,17 @@ rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,
 			goto rollback;
 		}
 	} else {
+		/**
+		 * The overhead from MTU to max frame size.
+		 * Considering VLAN and QinQ packet, the VLAN tag size

lib/librte_ethdev/rte_ethdev.c rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q, · line 1270

Quoted 10 lines
lib/librte_ethdev/rte_ethdev.c +5 -2
+		 * needs to be added to RTE_ETHER_MAX_LEN.
+		 */
 		if (dev_conf->rxmode.max_rx_pkt_len < RTE_ETHER_MIN_LEN ||
-			dev_conf->rxmode.max_rx_pkt_len > RTE_ETHER_MAX_LEN)
+			dev_conf->rxmode.max_rx_pkt_len > RTE_ETHER_MAX_LEN
+				+ RTE_ETHER_VLAN_LEN * 2)
 			/* Use default value */
 			dev->data->dev_conf.rxmode.max_rx_pkt_len =
-							RTE_ETHER_MAX_LEN;
+				RTE_ETHER_MAX_LEN + RTE_ETHER_VLAN_LEN * 2;

+cc ethdev maintainers

Quoted 7 lines

This looks ok to me for i40e case, but I don't know if there is a consequence for other PMDs. It seems late to change this, so maybe you can live without this part for now.

Even on the i40e parts, there can be some subtle bug and I requested i40e maintainers to review carefully but it has not happened, so for me it shouldn't be merged at present.

I would nack for another, simpler, reason:
No ethdev behaviour change should be submitted if title does not start with "ethdev:" and if ethdev maintainers are not Cc'ed.

#8 lore raw
Quoted 67 lines

-----Original Message-----
From: Thomas Monjalon <[email protected]>
Sent: Saturday, November 9, 2019 3:49 AM
To: Kevin Traynor <[email protected]>
Cc: Zhang, Xiao <[email protected]>; [email protected]; Xing, Beilei <[email protected]>; Zhang, Qi Z <[email protected]>; Stokes, Ian <[email protected]>; [email protected]; Andrew Rybchenko <[email protected]>; Yigit, Ferruh <[email protected]>; Ye, Xiaolong <[email protected]>
Subject: Re: [v3] net/i40e: fix vlan packets drop

08/11/2019 20:28, Kevin Traynor:

Quoted 25 lines

Hi Xiao,

Quoted 22 lines · Xiao Zhang

VLAN packets with ip length bigger than 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")

---
v3
Checking more places using max packet len.
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 | 11 +++++++----
 drivers/net/i40e/i40e_fdir.c      |  2 +-
 drivers/net/i40e/i40e_rxtx.c      |  9 ++++++---
 lib/librte_ethdev/rte_ethdev.c    | 10 ++++++++--
 lib/librte_net/rte_ether.h        |  1 +
 6 files changed, 24 insertions(+), 11 deletions(-)
Quoted 3 lines

lib/librte_ethdev/rte_ethdev.c rte_eth_dev_configure(uint16_t port_id,

Quoted 3 lines
lib/librte_ethdev/rte_ethdev.c +0 -0
@@ -1257,11 +1257,17 @@ rte_eth_dev_configure(uint16_t port_id,

uint16_t nb_rx_q, uint16_t nb_tx_q,

Quoted 9 lines

lib/librte_ethdev/rte_ethdev.c rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,

Quoted 9 lines
lib/librte_ethdev/rte_ethdev.c +5 -0
 			goto rollback;
 		}
 	} else {
+		/**
+		 * The overhead from MTU to max frame size.
+		 * Considering VLAN and QinQ packet, the VLAN tag size
+		 * needs to be added to RTE_ETHER_MAX_LEN.
+		 */
 		if (dev_conf->rxmode.max_rx_pkt_len < RTE_ETHER_MIN_LEN

||

Quoted 14 lines

lib/librte_ethdev/rte_ethdev.c rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q, · line 1270

Quoted 7 lines
lib/librte_ethdev/rte_ethdev.c +3 -2
-			dev_conf->rxmode.max_rx_pkt_len > RTE_ETHER_MAX_LEN)
+			dev_conf->rxmode.max_rx_pkt_len > RTE_ETHER_MAX_LEN
+				+ RTE_ETHER_VLAN_LEN * 2)
 			/* Use default value */
 			dev->data->dev_conf.rxmode.max_rx_pkt_len =
-							RTE_ETHER_MAX_LEN;
+				RTE_ETHER_MAX_LEN + RTE_ETHER_VLAN_LEN * 2;

+cc ethdev maintainers

This looks ok to me for i40e case, but I don't know if there is a consequence for other PMDs. It seems late to change this, so maybe you can live without this part for now.

Quoted 9 lines
Quoted 3 lines

Even on the i40e parts, there can be some subtle bug and I requested i40e maintainers to review carefully but it has not happened, so for me it shouldn't be merged at present.

I would nack for another, simpler, reason:
No ethdev behaviour change should be submitted if title does not start with "ethdev:" and if ethdev maintainers are not Cc'ed.

Yes, the patch should be dropped even without the ethdev part change, the fix for i40e need more refine. Sorry for review this late.

#9 lore raw
Quoted 68 lines · Qi Z
Quoted 68 lines

-----Original Message-----
From: Thomas Monjalon <[email protected]>
Sent: Saturday, November 9, 2019 3:49 AM
To: Kevin Traynor <[email protected]>
Cc: Zhang, Xiao <[email protected]>; [email protected]; Xing, Beilei <[email protected]>; Zhang, Qi Z <[email protected]>; Stokes, Ian <[email protected]>; [email protected]; Andrew Rybchenko <[email protected]>; Yigit, Ferruh <[email protected]>; Ye, Xiaolong <[email protected]>
Subject: Re: [v3] net/i40e: fix vlan packets drop

08/11/2019 20:28, Kevin Traynor:

Quoted 25 lines

Hi Xiao,

Quoted 22 lines · Xiao Zhang

VLAN packets with ip length bigger than 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")

---
v3
Checking more places using max packet len.
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 | 11 +++++++----
  drivers/net/i40e/i40e_fdir.c      |  2 +-
  drivers/net/i40e/i40e_rxtx.c      |  9 ++++++---
  lib/librte_ethdev/rte_ethdev.c    | 10 ++++++++--
  lib/librte_net/rte_ether.h        |  1 +
  6 files changed, 24 insertions(+), 11 deletions(-)
Quoted 3 lines

lib/librte_ethdev/rte_ethdev.c rte_eth_dev_configure(uint16_t port_id,

Quoted 3 lines
lib/librte_ethdev/rte_ethdev.c +0 -0
@@ -1257,11 +1257,17 @@ rte_eth_dev_configure(uint16_t port_id,

uint16_t nb_rx_q, uint16_t nb_tx_q,

Quoted 9 lines

lib/librte_ethdev/rte_ethdev.c rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q,

Quoted 9 lines
lib/librte_ethdev/rte_ethdev.c +5 -0
  			goto rollback;
  		}
  	} else {
+		/**
+		 * The overhead from MTU to max frame size.
+		 * Considering VLAN and QinQ packet, the VLAN tag size
+		 * needs to be added to RTE_ETHER_MAX_LEN.
+		 */
  		if (dev_conf->rxmode.max_rx_pkt_len < RTE_ETHER_MIN_LEN

||

Quoted 16 lines

lib/librte_ethdev/rte_ethdev.c rte_eth_dev_configure(uint16_t port_id, uint16_t nb_rx_q, uint16_t nb_tx_q, · line 1270

Quoted 7 lines
lib/librte_ethdev/rte_ethdev.c +3 -2
-			dev_conf->rxmode.max_rx_pkt_len > RTE_ETHER_MAX_LEN)
+			dev_conf->rxmode.max_rx_pkt_len > RTE_ETHER_MAX_LEN
+				+ RTE_ETHER_VLAN_LEN * 2)
  			/* Use default value */
  			dev->data->dev_conf.rxmode.max_rx_pkt_len =
-							RTE_ETHER_MAX_LEN;
+				RTE_ETHER_MAX_LEN + RTE_ETHER_VLAN_LEN * 2;

+cc ethdev maintainers

This looks ok to me for i40e case, but I don't know if there is a consequence for other PMDs. It seems late to change this, so maybe you can live without this part for now.

Even on the i40e parts, there can be some subtle bug and I requested i40e maintainers to review carefully but it has not happened, so for me it shouldn't be merged at present.

Quoted 7 lines
Quoted 5 lines

I would nack for another, simpler, reason:
No ethdev behaviour change should be submitted if title does not start with "ethdev:" and if ethdev maintainers are not Cc'ed.

Yes, the patch should be dropped even without the ethdev part change, the fix for i40e need more refine. Sorry for review this late.

From what I can see, no fix for the bug this patch attempts to address
has been merged yet. Correct?