From patchwork Thu Mar 8 20:31:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brad Mouring X-Patchwork-Id: 883338 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ni.com Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3zy2J51S5pz9sdd for ; Fri, 9 Mar 2018 07:32:37 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751137AbeCHUcZ (ORCPT ); Thu, 8 Mar 2018 15:32:25 -0500 Received: from mx0a-00010702.pphosted.com ([148.163.156.75]:36728 "EHLO mx0b-00010702.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751092AbeCHUcX (ORCPT ); Thu, 8 Mar 2018 15:32:23 -0500 Received: from pps.filterd (m0098780.ppops.net [127.0.0.1]) by mx0a-00010702.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w28KQPhf022183; Thu, 8 Mar 2018 14:32:18 -0600 Received: from ni.com (skprod2.natinst.com [130.164.80.23]) by mx0a-00010702.pphosted.com with ESMTP id 2gjac170q1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 08 Mar 2018 14:32:18 -0600 Received: from us-aus-exhub1.ni.corp.natinst.com (us-aus-exhub1.ni.corp.natinst.com [130.164.68.41]) by us-aus-skprod2.natinst.com (8.16.0.22/8.16.0.22) with ESMTPS id w28KWHqA026896 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 8 Mar 2018 14:32:17 -0600 Received: from us-aus-exch5.ni.corp.natinst.com (130.164.68.15) by us-aus-exhub1.ni.corp.natinst.com (130.164.68.41) with Microsoft SMTP Server (TLS) id 15.0.1156.6; Thu, 8 Mar 2018 14:32:17 -0600 Received: from us-aus-exhub2.ni.corp.natinst.com (130.164.68.32) by us-aus-exch5.ni.corp.natinst.com (130.164.68.15) with Microsoft SMTP Server (TLS) id 15.0.1156.6; Thu, 8 Mar 2018 14:32:16 -0600 Received: from ni.com (130.164.49.7) by us-aus-exhub2.ni.corp.natinst.com (130.164.68.32) with Microsoft SMTP Server id 15.0.1156.6 via Frontend Transport; Thu, 8 Mar 2018 14:32:16 -0600 Received: by ni.com (sSMTP sendmail emulation); Thu, 08 Mar 2018 14:32:16 -0600 From: Brad Mouring To: Andrew Lunn , Florian Fainelli CC: , , Sergei Shtylyov , Brad Mouring Subject: [PATCH] net: phy: Tell caller result of phy_change() Date: Thu, 8 Mar 2018 14:31:57 -0600 Message-ID: <20180308203157.10855-1-brad.mouring@ni.com> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180307225042.2205-1-brad.mouring@ni.com> References: <20180307225042.2205-1-brad.mouring@ni.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2018-03-08_11:, , signatures=0 X-Proofpoint-Spam-Reason: safe Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org In 664fcf123a30e (net: phy: Threaded interrupts allow some simplification) the phy_interrupt system was changed to use a traditional threaded interrupt scheme instead of a workqueue approach. With this change, the phy status check moved into phy_change, which did not report back to the caller whether or not the interrupt was handled. This means that, in the case of a shared phy interrupt, only the first phydev's interrupt registers are checked (since phy_interrupt() would always return IRQ_HANDLED). This leads to interrupt storms when it is a secondary device that's actually the interrupt source. Signed-off-by: Brad Mouring --- drivers/net/phy/phy.c | 13 +++++++------ include/linux/phy.h | 1 - 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index e3e29c2b028b..ebce9f2b2742 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -617,6 +617,8 @@ static void phy_error(struct phy_device *phydev) phy_trigger_machine(phydev, false); } +static irqreturn_t phy_change(struct phy_device *phydev); + /** * phy_interrupt - PHY interrupt handler * @irq: interrupt line @@ -632,9 +634,7 @@ static irqreturn_t phy_interrupt(int irq, void *phy_dat) if (PHY_HALTED == phydev->state) return IRQ_NONE; /* It can't be ours. */ - phy_change(phydev); - - return IRQ_HANDLED; + return phy_change(phydev); } /** @@ -723,12 +723,12 @@ EXPORT_SYMBOL(phy_stop_interrupts); * phy_change - Called by the phy_interrupt to handle PHY changes * @phydev: phy_device struct that interrupted */ -void phy_change(struct phy_device *phydev) +static irqreturn_t phy_change(struct phy_device *phydev) { if (phy_interrupt_is_valid(phydev)) { if (phydev->drv->did_interrupt && !phydev->drv->did_interrupt(phydev)) - return; + return IRQ_NONE; if (phydev->state == PHY_HALTED) if (phy_disable_interrupts(phydev)) @@ -745,10 +745,11 @@ void phy_change(struct phy_device *phydev) if (phy_interrupt_is_valid(phydev) && phy_clear_interrupt(phydev)) goto phy_err; - return; + return IRQ_HANDLED; phy_err: phy_error(phydev); + return IRQ_NONE; } /** diff --git a/include/linux/phy.h b/include/linux/phy.h index 5a0c3e53e7c2..2e55838655b9 100644 --- a/include/linux/phy.h +++ b/include/linux/phy.h @@ -1011,7 +1011,6 @@ int phy_driver_register(struct phy_driver *new_driver, struct module *owner); int phy_drivers_register(struct phy_driver *new_driver, int n, struct module *owner); void phy_state_machine(struct work_struct *work); -void phy_change(struct phy_device *phydev); void phy_change_work(struct work_struct *work); void phy_mac_interrupt(struct phy_device *phydev); void phy_start_machine(struct phy_device *phydev);