Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755987AbcK3BCf (ORCPT ); Tue, 29 Nov 2016 20:02:35 -0500 Received: from shards.monkeyblade.net ([184.105.139.130]:38518 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751190AbcK3BCb (ORCPT ); Tue, 29 Nov 2016 20:02:31 -0500 Date: Tue, 29 Nov 2016 20:02:29 -0500 (EST) Message-Id: <20161129.200229.2088117281049539695.davem@davemloft.net> To: cyrille.pitchen@atmel.com Cc: nicolas.ferre@atmel.com, netdev@vger.kernel.org, soren.brinkmann@xilinx.com, Andrei.Pistirica@microchip.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH net v2 1/1] net: macb: fix the RX queue reset in macb_rx() From: David Miller In-Reply-To: <80ebb550eb6155e3b882cab1fb8d78a7385f8227.1480339901.git.cyrille.pitchen@atmel.com> References: <80ebb550eb6155e3b882cab1fb8d78a7385f8227.1480339901.git.cyrille.pitchen@atmel.com> X-Mailer: Mew version 6.7 on Emacs 25.1 / Mule 6.0 (HANACHIRUSATO) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.12 (shards.monkeyblade.net [149.20.54.216]); Tue, 29 Nov 2016 16:03:06 -0800 (PST) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1246 Lines: 26 From: Cyrille Pitchen Date: Mon, 28 Nov 2016 14:40:55 +0100 > On macb only (not gem), when a RX queue corruption was detected from > macb_rx(), the RX queue was reset: during this process the RX ring > buffer descriptor was initialized by macb_init_rx_ring() but we forgot > to also set bp->rx_tail to 0. > > Indeed, when processing the received frames, bp->rx_tail provides the > macb driver with the index in the RX ring buffer of the next buffer to > process. So when the whole ring buffer is reset we must also reset > bp->rx_tail so the driver is synchronized again with the hardware. > > Since macb_init_rx_ring() is called from many locations, currently from > macb_rx() and macb_init_rings(), we'd rather add the "bp->rx_tail = 0;" > line inside macb_init_rx_ring() than add the very same line after each > call of this function. > > Without this fix, the rx queue is not reset properly to recover from > queue corruption and connection drop may occur. > > Signed-off-by: Cyrille Pitchen > Fixes: 9ba723b081a2 ("net: macb: remove BUG_ON() and reset the queue to handle RX errors") > Acked-by: Nicolas Ferre Applied and queued up for -stable, thanks.