Skip to content

Commit dee4bf7

Browse files
committed
Merge branch '10GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/net-queue
Tony Nguyen says: ==================== Intel Wired LAN Driver Updates 2023-02-14 (ixgbe, i40e) This series contains updates to ixgbe and i40e drivers. Jason Xing corrects comparison of frame sizes for setting MTU with XDP on ixgbe and adjusts frame size to account for a second VLAN header on ixgbe and i40e. * '10GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/net-queue: ixgbe: add double of VLAN header when computing the max MTU i40e: add double of VLAN header when computing the max MTU ixgbe: allow to increase MTU to 3K with XDP enabled ==================== Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
2 parents fda6c89 + 0967bf8 commit dee4bf7

File tree

3 files changed

+20
-12
lines changed

3 files changed

+20
-12
lines changed

drivers/net/ethernet/intel/i40e/i40e_main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2921,7 +2921,7 @@ static int i40e_change_mtu(struct net_device *netdev, int new_mtu)
29212921
struct i40e_pf *pf = vsi->back;
29222922

29232923
if (i40e_enabled_xdp_vsi(vsi)) {
2924-
int frame_size = new_mtu + ETH_HLEN + ETH_FCS_LEN + VLAN_HLEN;
2924+
int frame_size = new_mtu + I40E_PACKET_HDR_PAD;
29252925

29262926
if (frame_size > i40e_max_xdp_frame_size(vsi))
29272927
return -EINVAL;

drivers/net/ethernet/intel/ixgbe/ixgbe.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,8 @@
7373
#define IXGBE_RXBUFFER_4K 4096
7474
#define IXGBE_MAX_RXBUFFER 16384 /* largest size for a single descriptor */
7575

76+
#define IXGBE_PKT_HDR_PAD (ETH_HLEN + ETH_FCS_LEN + (VLAN_HLEN * 2))
77+
7678
/* Attempt to maximize the headroom available for incoming frames. We
7779
* use a 2K buffer for receives and need 1536/1534 to store the data for
7880
* the frame. This leaves us with 512 bytes of room. From that we need

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

Lines changed: 17 additions & 11 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,12 @@ 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) {
6792-
int new_frame_size = new_mtu + ETH_HLEN + ETH_FCS_LEN +
6793-
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];
6803+
if (ixgbe_enabled_xdp_adapter(adapter)) {
6804+
int new_frame_size = new_mtu + IXGBE_PKT_HDR_PAD;
67986805

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-
}
6806+
if (new_frame_size > ixgbe_max_xdp_frame_size(adapter)) {
6807+
e_warn(probe, "Requested MTU size is not supported with XDP\n");
6808+
return -EINVAL;
68036809
}
68046810
}
68056811

0 commit comments

Comments
 (0)