Skip to content

Commit f9cd6a4

Browse files
JasonXinganguy11
authored andcommitted
ixgbe: allow to increase MTU to 3K with XDP enabled
Recently I encountered one case where I cannot increase the MTU size directly from 1500 to a much bigger value with XDP enabled if the server is equipped with IXGBE card, which happened on thousands of servers in production environment. After applying the current patch, we can set the maximum MTU size to 3K. This patch follows the behavior of changing MTU as i40e/ice does. References: [1] commit 23b4451 ("ice: allow 3k MTU for XDP") [2] commit 0c8493d ("i40e: add XDP support for pass and drop actions") Fixes: fabf1bc ("ixgbe: Prevent unsupported configurations with XDP") Signed-off-by: Jason Xing <[email protected]> Reviewed-by: Alexander Duyck <[email protected]> Tested-by: Chandan Kumar Rout <[email protected]> (A Contingent Worker at Intel) Signed-off-by: Tony Nguyen <[email protected]>
1 parent 05d7623 commit f9cd6a4

File tree

1 file changed

+16
-9
lines changed

1 file changed

+16
-9
lines changed

drivers/net/ethernet/intel/ixgbe/ixgbe_main.c

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6777,6 +6777,18 @@ static void ixgbe_free_all_rx_resources(struct ixgbe_adapter *adapter)
67776777
ixgbe_free_rx_resources(adapter->rx_ring[i]);
67786778
}
67796779

6780+
/**
6781+
* ixgbe_max_xdp_frame_size - returns the maximum allowed frame size for XDP
6782+
* @adapter: device handle, pointer to adapter
6783+
*/
6784+
static int ixgbe_max_xdp_frame_size(struct ixgbe_adapter *adapter)
6785+
{
6786+
if (PAGE_SIZE >= 8192 || adapter->flags2 & IXGBE_FLAG2_RX_LEGACY)
6787+
return IXGBE_RXBUFFER_2K;
6788+
else
6789+
return IXGBE_RXBUFFER_3K;
6790+
}
6791+
67806792
/**
67816793
* ixgbe_change_mtu - Change the Maximum Transfer Unit
67826794
* @netdev: network interface device structure
@@ -6788,18 +6800,13 @@ static int ixgbe_change_mtu(struct net_device *netdev, int new_mtu)
67886800
{
67896801
struct ixgbe_adapter *adapter = netdev_priv(netdev);
67906802

6791-
if (adapter->xdp_prog) {
6803+
if (ixgbe_enabled_xdp_adapter(adapter)) {
67926804
int new_frame_size = new_mtu + ETH_HLEN + ETH_FCS_LEN +
67936805
VLAN_HLEN;
6794-
int i;
6795-
6796-
for (i = 0; i < adapter->num_rx_queues; i++) {
6797-
struct ixgbe_ring *ring = adapter->rx_ring[i];
67986806

6799-
if (new_frame_size > ixgbe_rx_bufsz(ring)) {
6800-
e_warn(probe, "Requested MTU size is not supported with XDP\n");
6801-
return -EINVAL;
6802-
}
6807+
if (new_frame_size > ixgbe_max_xdp_frame_size(adapter)) {
6808+
e_warn(probe, "Requested MTU size is not supported with XDP\n");
6809+
return -EINVAL;
68036810
}
68046811
}
68056812

0 commit comments

Comments
 (0)