From b5ca88eb335580dc48ef5ebb3b86719bdb5a4113 Mon Sep 17 00:00:00 2001 From: Jesse Brandeburg Date: Tue, 8 Jul 2008 15:51:42 -0700 Subject: [PATCH] ixgb: fix race on rx_buffer_len in mtu change some random coverage testing found that when changing mtu under heavy traffic load, NAPI would use the rx_buffer_len variable after it had been changed by change_mtu. Similar to e1000 bugs found long ago. Signed-off-by: Jesse Brandeburg Signed-off-by: Jeff Kirsher Signed-off-by: Jeff Garzik --- drivers/net/ixgb/ixgb_main.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/net/ixgb/ixgb_main.c b/drivers/net/ixgb/ixgb_main.c index 4bf6bbc65822..c3234c451043 100644 --- a/drivers/net/ixgb/ixgb_main.c +++ b/drivers/net/ixgb/ixgb_main.c @@ -1573,14 +1573,18 @@ ixgb_change_mtu(struct net_device *netdev, int new_mtu) return -EINVAL; } + if (old_max_frame == max_frame) + return 0; + + if (netif_running(netdev)) + ixgb_down(adapter, true); + adapter->rx_buffer_len = max_frame + 8; /* + 8 for errata */ netdev->mtu = new_mtu; - if ((old_max_frame != max_frame) && netif_running(netdev)) { - ixgb_down(adapter, true); + if (netif_running(netdev)) ixgb_up(adapter); - } return 0; } -- 2.30.2