[Devel] [PATCH RHEL7 COMMIT] drivers/bnx2x: Limit setting of the max mtu

Konstantin Khorenko khorenko at virtuozzo.com
Thu Jan 11 17:42:52 MSK 2018


The commit is pushed to "branch-rh7-3.10.0-693.11.1.vz7.39.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-693.11.1.vz7.39.10
------>
commit b28ad48b19427e0644ae63d614db4a19fe0e4471
Author: Andrey Ryabinin <aryabinin at virtuozzo.com>
Date:   Thu Jan 11 17:42:52 2018 +0300

    drivers/bnx2x: Limit setting of the max mtu
    
    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>
---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
index f4e939f2ad66..339cfb0180e4 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
@@ -4868,6 +4868,15 @@ int bnx2x_change_mtu(struct net_device *dev, int new_mtu)
 		return -EINVAL;
 	}
 
+	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


More information about the Devel mailing list