Skip to contentSkip to conversation

ixgbe: add double of VLAN header when computing the max MTU

PATCH In review Jason Xing 2 participants 2 messages Feb 9, 2023 – Feb 14, 2023

Subsystems (4)
lore
Share & tools
lore

Jason Xing

author
#0 lore raw

PATCH v2 3/3 ixgbe: add double of VLAN header when computing the max MTU

From: Jason Xing <[email protected]>

Include the second VLAN HLEN into account when computing the maximum MTU size as other drivers do.

Fixes fabf1bce103a ("ixgbe: Prevent unsupported configurations with XDP")

---
v2: add reviewed-by label.

---
 drivers/net/ethernet/intel/ixgbe/ixgbe.h      | 2 ++
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 3 +--
 2 files changed, 3 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/ixgbe/ixgbe.h +2 -0
index bc68b8f2176d..8736ca4b2628 100644
@@ -73,6 +73,8 @@
 #define IXGBE_RXBUFFER_4K    4096
 #define IXGBE_MAX_RXBUFFER  16384  /* largest size for a single descriptor */
 
+#define IXGBE_PKT_HDR_PAD   (ETH_HLEN + ETH_FCS_LEN + (VLAN_HLEN * 2))
+
 /* Attempt to maximize the headroom available for incoming frames.  We
  * use a 2K buffer for receives and need 1536/1534 to store the data for
  * the frame.  This leaves us with 512 bytes of room.  From that we need
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +1 -2
index 25ca329f7d3c..4507fba8747a 100644
@@ -6801,8 +6801,7 @@ static int ixgbe_change_mtu(struct net_device *netdev, int new_mtu)
 	struct ixgbe_adapter *adapter = netdev_priv(netdev);
 
 	if (ixgbe_enabled_xdp_adapter(adapter)) {
-		int new_frame_size = new_mtu + ETH_HLEN + ETH_FCS_LEN +
-				     VLAN_HLEN;
+		int new_frame_size = new_mtu + IXGBE_PKT_HDR_PAD;
 
 		if (new_frame_size > ixgbe_max_xdp_frame_size(adapter)) {
 			e_warn(probe, "Requested MTU size is not supported with XDP\n");
Signature · 6 lines
2.37.3

_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
Tested-by on v2 3/3
#1 lore raw
Quoted 29 lines

-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Jason Xing
Sent: 09 February 2023 08:11
To: [email protected]; Brandeburg, Jesse <[email protected]>; Nguyen, Anthony L <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Lobakin, Alexandr <[email protected]>; Fijalkowski, Maciej <[email protected]>
Cc: [email protected]; [email protected]; Alexander Duyck <[email protected]>; [email protected]; intel-wired- [email protected]; [email protected]; Jason Xing <[email protected]>
Subject: [Intel-wired-lan] [PATCH net v2 3/3] ixgbe: add double of VLAN header when computing the max MTU

From: Jason Xing <[email protected]>

Include the second VLAN HLEN into account when computing the maximum MTU size as other drivers do.

Fixes fabf1bce103a ("ixgbe: Prevent unsupported configurations with XDP")
Quoted 7 lines

---
v2: add reviewed-by label.
---
drivers/net/ethernet/intel/ixgbe/ixgbe.h | 2 ++
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 3 +--

2 files changed, 3 insertions(+), 2 deletions(-)