Skip to contentSkip to conversation

net/ice: fix max frame size

PATCH In review Qi Zhang 2 participants 3 messages Mar 27, 2019 – Apr 10, 2019 Network drivers

lore
Share & tools
lore

Qi Zhang

author
#0 lore raw

PATCH 1/1 net/ice: fix max frame size

Max frame size setup should consider double VLAN case.

Fixes ae2bdd0219cb ("net/ice: support MTU setting")
---
 drivers/net/ice/ice_ethdev.c | 3 +--
 drivers/net/ice/ice_ethdev.h | 7 +++++++
 drivers/net/ice/ice_rxtx.c   | 2 +-
 3 files changed, 9 insertions(+), 3 deletions(-)
drivers/net/ice/ice_ethdev.c +1 -2
index cdb5502d1..b9b32fa97 100644
@@ -2043,8 +2043,7 @@ ice_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
 {
 	struct ice_pf *pf = ICE_DEV_PRIVATE_TO_PF(dev->data->dev_private);
 	struct rte_eth_dev_data *dev_data = pf->dev_data;
-	uint32_t frame_size = mtu + ETHER_HDR_LEN
-			      + ETHER_CRC_LEN + ICE_VLAN_TAG_SIZE;
+	uint32_t frame_size = mtu + ICE_ETH_OVERHEAD;
 
 	/* check if mtu is within the allowed range */
 	if (mtu < ETHER_MIN_MTU || frame_size > ICE_FRAME_SIZE_MAX)
drivers/net/ice/ice_ethdev.h +7 -0
index 3cefa5b5b..655624c3c 100644
@@ -115,6 +115,13 @@
 	ETH_RSS_NONFRAG_IPV6_OTHER | \
 	ETH_RSS_L2_PAYLOAD)
 
+/**
+ * The overhead from MTU to max frame size.
+ * Considering QinQ packet, the VLAN tag needs to be counted twice.
+ */
+#define ICE_ETH_OVERHEAD \
+	(ETHER_HDR_LEN + ETHER_CRC_LEN + ICE_VLAN_TAG_SIZE * 2)
+
 struct ice_adapter;
 
 /**
drivers/net/ice/ice_rxtx.c +1 -1
index c794ee861..b3ff14694 100644
@@ -113,7 +113,7 @@ ice_program_hw_rx_queue(struct ice_rx_queue *rxq)
 			      RTE_PKTMBUF_HEADROOM);
 
 	/* Check if scattered RX needs to be used. */
-	if ((rxq->max_pkt_len + 2 * ICE_VLAN_TAG_SIZE) > buf_size)
+	if (rxq->max_pkt_len > buf_size)
 		dev->data->scattered_rx = 1;
 
 	rxq->qrx_tail = hw->hw_addr + QRX_TAIL(rxq->reg_idx);
Signature · 1 line
2.13.6
Acked-by on v1 1/1
#1 lore raw

Hi,

Quoted 9 lines

-----Original Message-----
From: Zhang, Qi Z
Sent: Wednesday, March 27, 2019 7:39 PM
To: Lu, Wenzhuo <[email protected]>; Yang, Qiming <[email protected]>
Cc: [email protected]; Yigit, Ferruh <[email protected]>; Zhang, Qi Z <[email protected]>
Subject: [PATCH] net/ice: fix max frame size

Quoted 5 lines

Max frame size setup should consider double VLAN case.

Fixes ae2bdd0219cb ("net/ice: support MTU setting")
author Applied
#2 lore raw
Quoted 20 lines

-----Original Message-----
From: Lu, Wenzhuo
Sent: Wednesday, April 10, 2019 3:26 PM
To: Zhang, Qi Z <[email protected]>; Yang, Qiming <[email protected]>
Cc: [email protected]; Yigit, Ferruh <[email protected]>
Subject: RE: [PATCH] net/ice: fix max frame size

Hi,

Quoted 9 lines

-----Original Message-----
From: Zhang, Qi Z
Sent: Wednesday, March 27, 2019 7:39 PM
To: Lu, Wenzhuo <[email protected]>; Yang, Qiming <[email protected]>
Cc: [email protected]; Yigit, Ferruh <[email protected]>; Zhang, Qi Z <[email protected]>
Subject: [PATCH] net/ice: fix max frame size

Quoted 6 lines
Quoted 5 lines

Max frame size setup should consider double VLAN case.

Fixes ae2bdd0219cb ("net/ice: support MTU setting")

Applied to dpdk-next-net-intel.

Thanks
Qi