From patchwork Mon Dec 3 20:46:08 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Francois Romieu X-Patchwork-Id: 203441 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 11E1A2C0098 for ; Tue, 4 Dec 2012 08:11:15 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752379Ab2LCVLM (ORCPT ); Mon, 3 Dec 2012 16:11:12 -0500 Received: from violet.fr.zoreil.com ([92.243.8.30]:39934 "EHLO violet.fr.zoreil.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751511Ab2LCVLL (ORCPT ); Mon, 3 Dec 2012 16:11:11 -0500 Received: from violet.fr.zoreil.com (localhost [127.0.0.1]) by violet.fr.zoreil.com (8.13.8/8.13.8) with ESMTP id qB3Kk9t0009982; Mon, 3 Dec 2012 21:46:09 +0100 Received: (from romieu@localhost) by violet.fr.zoreil.com (8.13.8/8.13.8/Submit) id qB3Kk8hX009981; Mon, 3 Dec 2012 21:46:08 +0100 Date: Mon, 3 Dec 2012 21:46:08 +0100 From: Francois Romieu To: jogreene@redhat.com Cc: David Miller , netdev@vger.kernel.org, dwmw2@infradead.org Subject: Re: [RFT PATCH] 8139cp: properly support change of MTU values [v2] Message-ID: <20121203204608.GA9815@electric-eye.fr.zoreil.com> References: <1354551573-23721-1-git-send-email-jogreene@redhat.com> <20121203.135200.1242505353532930826.davem@davemloft.net> Mime-Version: 1.0 Content-Disposition: inline In-Reply-To: <20121203.135200.1242505353532930826.davem@davemloft.net> User-Agent: Mutt/1.4.2.2i X-Organisation: Land of Sunshine Inc. Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org David Miller : [...] > I've applied this to net-next, if it triggers any problems we have > some time to work it out before 3.8 is released. I have bounced the messages to David Woodhouse since he authored the last 8139cp changes in net-next and owns the hardware to notice regressions. My message of two days ago was wrong : it is not possible for the irq handler to process a Tx event after the rings have been freed. Things still look racy wrt netpoll though. Any objection against the patch below ? (I did not gotoize the dev == NULL test: it is really unlikely and should go away). Tested-by: David Woodhouse --- To unsubscribe from this list: send the line "unsubscribe netdev" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/net/ethernet/realtek/8139cp.c b/drivers/net/ethernet/realtek/8139cp.c index 0da3f5e..57cd542 100644 --- a/drivers/net/ethernet/realtek/8139cp.c +++ b/drivers/net/ethernet/realtek/8139cp.c @@ -577,28 +577,30 @@ static irqreturn_t cp_interrupt (int irq, void *dev_instance) { struct net_device *dev = dev_instance; struct cp_private *cp; + int handled = 0; u16 status; if (unlikely(dev == NULL)) return IRQ_NONE; cp = netdev_priv(dev); + spin_lock(&cp->lock); + status = cpr16(IntrStatus); if (!status || (status == 0xFFFF)) - return IRQ_NONE; + goto out_unlock; + + handled = 1; netif_dbg(cp, intr, dev, "intr, status %04x cmd %02x cpcmd %04x\n", status, cpr8(Cmd), cpr16(CpCmd)); cpw16(IntrStatus, status & ~cp_rx_intr_mask); - spin_lock(&cp->lock); - /* close possible race's with dev_close */ if (unlikely(!netif_running(dev))) { cpw16(IntrMask, 0); - spin_unlock(&cp->lock); - return IRQ_HANDLED; + goto out_unlock; } if (status & (RxOK | RxErr | RxEmpty | RxFIFOOvr)) @@ -612,8 +614,6 @@ static irqreturn_t cp_interrupt (int irq, void *dev_instance) if (status & LinkChg) mii_check_media(&cp->mii_if, netif_msg_link(cp), false); - spin_unlock(&cp->lock); - if (status & PciErr) { u16 pci_status; @@ -625,7 +625,10 @@ static irqreturn_t cp_interrupt (int irq, void *dev_instance) /* TODO: reset hardware */ } - return IRQ_HANDLED; +out_unlock: + spin_unlock(&cp->lock); + + return IRQ_RETVAL(handled); } #ifdef CONFIG_NET_POLL_CONTROLLER