Skip to content

Commit c74042f

Browse files
Alexander DuyckJeff Kirsher
authored andcommitted
ixgbe: Limit use of 2K buffers on architectures with 256B or larger cache lines
On architectures that have a cache line size larger than 64 Bytes we start running into issues where the amount of headroom for the frame starts shrinking. The size of skb_shared_info on a system with a 64B L1 cache line size is 320. This increases to 384 with a 128B cache line, and 512 with a 256B cache line. In addition the NET_SKB_PAD value increases as well consistent with the cache line size. As a result when we get to a 256B cache line as seen on the s390 we end up 768 bytes used by padding and shared info leaving us with only 1280 bytes to use for data storage. On architectures such as this we should default to using 3K Rx buffers out of a 8K page instead of trying to do 1.5K buffers out of a 4K page. To take all of this into account I have added one small check so that we compare the max_frame to the amount of actual data we can store. This was already occurring for igb, but I had overlooked it for ixgbe as it doesn't have strict limits for 82599 once we enable jumbo frames. By adding this check we will automatically enable 3K Rx buffers as soon as the maximum frame size we can handle drops below the standard Ethernet MTU. I also went through and fixed one small typo that I found where I had left an IGB in a variable name due to a copy/paste error. Signed-off-by: Alexander Duyck <[email protected]> Tested-by: Andrew Bowers <[email protected]> Signed-off-by: Jeff Kirsher <[email protected]>
1 parent d3aa9c9 commit c74042f

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@
9696
#define IXGBE_MAX_FRAME_BUILD_SKB \
9797
(SKB_WITH_OVERHEAD(IXGBE_RXBUFFER_2K) - IXGBE_SKB_PAD)
9898
#else
99-
#define IGB_MAX_FRAME_BUILD_SKB IXGBE_RXBUFFER_2K
99+
#define IXGBE_MAX_FRAME_BUILD_SKB IXGBE_RXBUFFER_2K
100100
#endif
101101

102102
/*

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3972,7 +3972,8 @@ static void ixgbe_set_rx_buffer_len(struct ixgbe_adapter *adapter)
39723972
if (adapter->flags2 & IXGBE_FLAG2_RSC_ENABLED)
39733973
set_bit(__IXGBE_RX_3K_BUFFER, &rx_ring->state);
39743974

3975-
if (max_frame > (ETH_FRAME_LEN + ETH_FCS_LEN))
3975+
if ((max_frame > (ETH_FRAME_LEN + ETH_FCS_LEN)) ||
3976+
(max_frame > IXGBE_MAX_FRAME_BUILD_SKB))
39763977
set_bit(__IXGBE_RX_3K_BUFFER, &rx_ring->state);
39773978
#endif
39783979
}

0 commit comments

Comments
 (0)