From patchwork Fri Jun 27 15:20:45 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Russell King X-Patchwork-Id: 365021 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id B6F5B1400DE for ; Sat, 28 Jun 2014 01:20:56 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754304AbaF0PUu (ORCPT ); Fri, 27 Jun 2014 11:20:50 -0400 Received: from gw-1.arm.linux.org.uk ([78.32.30.217]:45244 "EHLO pandora.arm.linux.org.uk" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754294AbaF0PUr (ORCPT ); Fri, 27 Jun 2014 11:20:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=arm.linux.org.uk; s=pandora; h=Date:Sender:Message-Id:Subject:Cc:To:From:References:In-Reply-To; bh=rhke2IiWsJBvCWQ23PJZxlbma2RmjbrtwJQUkTHP7Ys=; b=ba9+dqVntzwdwAQXTmzZoHN+VkkiXowfIsGQk0+fBt1bedWDHSKIgPzJpM9cq+S4sSa3+PEwWlu1zgfIItNo/naGD7BqVPon2qvG0k1zFdZVbCPjJLGuMrQD3ST2QynQPiWzt5ns1QOntQaxAdPAG9+N8+HwzyR7bkrGNF99BkY=; Received: from e0022681537dd.dyn.arm.linux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:48062 helo=rmk-PC.arm.linux.org.uk) by pandora.arm.linux.org.uk with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.76) (envelope-from ) id 1X0XxG-0004cd-5R; Fri, 27 Jun 2014 16:20:46 +0100 Received: from rmk by rmk-PC.arm.linux.org.uk with local (Exim 4.76) (envelope-from ) id 1X0XxF-0001Oc-N8; Fri, 27 Jun 2014 16:20:45 +0100 In-Reply-To: <20140627151542.GL32514@n2100.arm.linux.org.uk> References: <20140627151542.GL32514@n2100.arm.linux.org.uk> From: Russell King To: linux-arm-kernel@lists.infradead.org, netdev@vger.kernel.org Cc: Fugang Duan Subject: [PATCH CFT 22/30] net: fec: quiesce packet processing when taking link down in fec_enet_adjust_link() Message-Id: Date: Fri, 27 Jun 2014 16:20:45 +0100 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org When the link goes down, the adjust_link method will be called, but there is no synchronisation to ensure that we won't be processing some last remaining packets via the NAPI handlers while performing a reset of the device. Add the necessary synchronisation to ensure that packet processing is complete before we stop and reset the FEC. Signed-off-by: Russell King --- drivers/net/ethernet/freescale/fec_main.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c index 466268fffadd..b2b8aff3f73c 100644 --- a/drivers/net/ethernet/freescale/fec_main.c +++ b/drivers/net/ethernet/freescale/fec_main.c @@ -1530,7 +1530,11 @@ static void fec_enet_adjust_link(struct net_device *ndev) } } else { if (fep->link) { + napi_disable(&fep->napi); + netif_tx_lock_bh(ndev); fec_stop(ndev); + netif_tx_unlock_bh(ndev); + napi_enable(&fep->napi); fep->link = phy_dev->link; status_change = 1; }