[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1424860005.5565.88.camel@edumazet-glaptop2.roam.corp.google.com>
Date: Wed, 25 Feb 2015 02:26:45 -0800
From: Eric Dumazet <eric.dumazet@...il.com>
To: Sabrina Dubroca <sd@...asysnail.net>
Cc: jeffrey.t.kirsher@...el.com, linux.nics@...el.com,
e1000-devel@...ts.sourceforge.net, netdev@...r.kernel.org
Subject: Re: [PATCH net] e1000: add dummy allocator to fix race condition
between mtu change and netpoll
On Wed, 2015-02-25 at 11:05 +0100, Sabrina Dubroca wrote:
> There is a race condition between e1000_change_mtu's cleanups and
> netpoll, when we change the MTU across jumbo size:
...
>
> Fixes: edbbb3ca1077 ("e1000: implement jumbo receive with partial descriptors")
> Signed-off-by: Sabrina Dubroca <sd@...asysnail.net>
> ---
> drivers/net/ethernet/intel/e1000/e1000_main.c | 14 +++++++++++++-
> 1 file changed, 13 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/intel/e1000/e1000_main.c b/drivers/net/ethernet/intel/e1000/e1000_main.c
> index 7f997d36948f..5af866150671 100644
> --- a/drivers/net/ethernet/intel/e1000/e1000_main.c
> +++ b/drivers/net/ethernet/intel/e1000/e1000_main.c
> @@ -144,6 +144,9 @@ static bool e1000_clean_rx_irq(struct e1000_adapter *adapter,
> static bool e1000_clean_jumbo_rx_irq(struct e1000_adapter *adapter,
> struct e1000_rx_ring *rx_ring,
> int *work_done, int work_to_do);
> +static void e1000_alloc_dummy_rx_buffers(struct e1000_adapter *adapter,
> + struct e1000_rx_ring *rx_ring,
> + int cleaned_count);
Why are you using a forward declaration ?
Simply put here the body of this (dummy) function.
> static void e1000_alloc_rx_buffers(struct e1000_adapter *adapter,
> struct e1000_rx_ring *rx_ring,
> int cleaned_count);
> @@ -3552,8 +3555,11 @@ static int e1000_change_mtu(struct net_device *netdev, int new_mtu)
> msleep(1);
> /* e1000_down has a dependency on max_frame_size */
> hw->max_frame_size = max_frame;
> - if (netif_running(netdev))
> + if (netif_running(netdev)) {
> + /* prevent buffers from being reallocated */
> + adapter->alloc_rx_buf = e1000_alloc_dummy_rx_buffers;
> e1000_down(adapter);
> + }
>
> /* NOTE: netdev_alloc_skb reserves 16 bytes, and typically NET_IP_ALIGN
> * means we reserve 2 more, this pushes us to allocate from the next
> @@ -4481,6 +4487,12 @@ next_desc:
> return cleaned;
> }
>
> +static void e1000_alloc_dummy_rx_buffers(struct e1000_adapter *adapter,
> + struct e1000_rx_ring *rx_ring,
> + int cleaned_count)
> +{
> +}
> +
> /**
> * e1000_alloc_jumbo_rx_buffers - Replace used jumbo receive buffers
> * @adapter: address of board private structure
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists