[Devel] [PATCH RH9 19/22] drivers/bnx2x: Limit setting of the max mtu
Andrey Zhadchenko
andrey.zhadchenko at virtuozzo.com
Thu Oct 7 13:57:43 MSK 2021
From: Andrey Ryabinin <aryabinin at virtuozzo.com>
Limit max mtu so that rx_buf_size fits into single page.
This must save us from allocation failures like this:
kswapd0: page allocation failure: order:2, mode:0x4020
Call Trace:
dump_stack+0x19/0x1b
warn_alloc_failed+0x110/0x180
__alloc_pages_nodemask+0x7bf/0xc60
alloc_pages_current+0x98/0x110
kmalloc_order+0x18/0x40
kmalloc_order_trace+0x26/0xa0
__kmalloc+0x279/0x290
bnx2x_frag_alloc.isra.61+0x2a/0x40 [bnx2x]
bnx2x_rx_int+0x227/0x17c0 [bnx2x]
bnx2x_poll+0x1dd/0x260 [bnx2x]
net_rx_action+0x179/0x390
__do_softirq+0x10f/0x2aa
call_softirq+0x1c/0x30
do_softirq+0x65/0xa0
irq_exit+0x105/0x110
do_IRQ+0x56/0xe0
common_interrupt+0x6d/0x6d
https://jira.sw.ru/browse/PSBM-77016
Signed-off-by: Andrey Ryabinin <aryabinin at virtuozzo.com>
(cherry picked from vz7 commit b28ad48b1942 ("drivers/bnx2x: Limit setting of
the max mtu"))
Signed-off-by: Andrey Zhadchenko <andrey.zhadchenko at virtuozzo.com>
(cherry picked from vz8 commit 4b7a8fabdc742dc9f25e506986f40cb5c661478c)
Signed-off-by: Andrey Zhadchenko <andrey.zhadchenko at virtuozzo.com>
---
drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
index ccb15f8..4893c04 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
@@ -4883,6 +4883,14 @@ int bnx2x_change_mtu(struct net_device *dev, int new_mtu)
return -EAGAIN;
}
+ if (SKB_DATA_ALIGN(new_mtu + BNX2X_FW_RX_ALIGN_START +
+ IP_HEADER_ALIGNMENT_PADDING + ETH_OVERHEAD +
+ BNX2X_FW_RX_ALIGN_END) + NET_SKB_PAD > PAGE_SIZE) {
+ new_mtu = PAGE_SIZE - NET_SKB_PAD - BNX2X_FW_RX_ALIGN_END -
+ ETH_OVERHEAD - IP_HEADER_ALIGNMENT_PADDING -
+ BNX2X_FW_RX_ALIGN_START;
+ }
+
/* This does not race with packet allocation
* because the actual alloc size is
* only updated as part of load
--
1.8.3.1
More information about the Devel
mailing list