Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp4820721rwl; Wed, 28 Dec 2022 09:13:52 -0800 (PST) X-Google-Smtp-Source: AMrXdXuAoUpQWzDQxG1VlCFruSksE657nZ23qUOcdesNxN4xownNhPdzvFmAHbN4izHIcXAFhYlq X-Received: by 2002:a17:90a:2bcd:b0:225:be4c:2586 with SMTP id n13-20020a17090a2bcd00b00225be4c2586mr21844240pje.45.1672247632617; Wed, 28 Dec 2022 09:13:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672247632; cv=none; d=google.com; s=arc-20160816; b=g4z33wXXTst1+4sxT2ei/VNytsSlDsm3wjwcVD3SHV36m2Mcoob5ZGjCqRYprzlzeC 9g6Zs2mTv56gQrLK/ZIkOwpIy982jIC7YJedGJWxztrQmNDIxda6PGY5lHnCMyyvyO7U g7y9S9+3PxV+wk/ycF2nh3p9mDHYbS4zepmT0k2wrihQEcSpBPINKnMNrdprCT74eG87 YF8nyO6GBF4/xCOcmC5iF5V5ykKSxVm5OfHF8uhdDvc5mtPQNHc0XpTC0PxUO04D687P 6h0odkkFigUCsxghuWFImi9Q4P8PjqqOEvfvi1Rtc0t4UpdigNAs1QMxUEe/HzgPdRud eMDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=GdOKgnKxbKVJV4+JZ/4p3pbY7F/lzdsJP2qZqHVunbo=; b=tzoT1/C+yzumXo1bxpD6zE4nYDPF4X3jc9tg/OR5pe0DlZiB6KfS4BBa5qcVTo2Bml mOJSGjs8G9J8MaCnk26eodzHnq6f1WpHOIAETKtLJBmyieqBP5J/iXGkwvmvqJvaHD8a 9K31MVKzCXVxp6edvc4OENwDzOdziHkvIKB3d5WLCWYqHVdU34O7Hz4KrwMzNz9DwGzl nPbGKorwbAc+S9KOAbNWpPNt6qJXQyKAJ4fg0xDsurEVcbKPqTvPMWDG0ubHt/W8Xvt+ YzqOMorc3bO+QiTRQMq3FaOMvV5ANBBbBii4on9kXyabE/ODImqAvgtzq6BhhDQ1lmTi mXsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=Sc3m55x0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l6-20020a63ba46000000b0048988ed9f01si17388252pgu.153.2022.12.28.09.13.43; Wed, 28 Dec 2022 09:13:52 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=Sc3m55x0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235249AbiL1Q62 (ORCPT + 63 others); Wed, 28 Dec 2022 11:58:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52452 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235404AbiL1Q5y (ORCPT ); Wed, 28 Dec 2022 11:57:54 -0500 Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 437BA1FCFA; Wed, 28 Dec 2022 08:54:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Disposition:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:From:Sender:Reply-To:Subject: Date:Message-ID:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Content-Disposition:In-Reply-To:References; bh=GdOKgnKxbKVJV4+JZ/4p3pbY7F/lzdsJP2qZqHVunbo=; b=Sc3m55x0JdOk566x9NnCpGFNAc TJDqMkLG7FIwALCOKeWdsANWcOgiwBqrKcxmGUNTH24sJHksZrSYn+e5ldIR5/8HCgclQ0fTkz8kN MLc4K0EbCg0bXoS0hWZ4JGWvYyMnMNdpiUqM+zNmMvF9YU8vV9m5601/BuN25aW6uQAo=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1pAZgo-000eWF-BD; Wed, 28 Dec 2022 17:54:02 +0100 Date: Wed, 28 Dec 2022 17:54:02 +0100 From: Andrew Lunn To: Florian Fainelli Cc: Michael Walle , Xu Liang , Heiner Kallweit , Russell King , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH RFC net-next v2 1/2] net: phy: allow a phy to opt-out of interrupt handling Message-ID: References: <20221228164008.1653348-1-michael@walle.cc> <20221228164008.1653348-2-michael@walle.cc> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Dec 28, 2022 at 08:49:35AM -0800, Florian Fainelli wrote: > > > On 12/28/2022 8:40 AM, Michael Walle wrote: > > Until now, it is not possible for a PHY driver to disable interrupts > > during runtime. If a driver offers the .config_intr() as well as the > > .handle_interrupt() ops, it is eligible for interrupt handling. > > Introduce a new flag for the dev_flags property of struct phy_device, which > > can be set by PHY driver to skip interrupt setup and fall back to polling > > mode. > > > > At the moment, this is used for the MaxLinear PHY which has broken > > interrupt handling and there is a need to disable interrupts in some > > cases. > > > > Signed-off-by: Michael Walle > > --- > > drivers/net/phy/phy_device.c | 7 +++++++ > > include/linux/phy.h | 2 ++ > > 2 files changed, 9 insertions(+) > > > > diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c > > index 716870a4499c..e4562859ac00 100644 > > --- a/drivers/net/phy/phy_device.c > > +++ b/drivers/net/phy/phy_device.c > > @@ -1487,6 +1487,13 @@ int phy_attach_direct(struct net_device *dev, struct phy_device *phydev, > > phydev->interrupts = PHY_INTERRUPT_DISABLED; > > + /* PHYs can request to use poll mode even though they have an > > + * associated interrupt line. This could be the case if they > > + * detect a broken interrupt handling. > > + */ > > + if (phydev->dev_flags & PHY_F_NO_IRQ) > > + phydev->irq = PHY_POLL; > > Cannot you achieve the same thing with the PHY driver mangling phydev->irq > to a negative value, or is that too later already by the time your phy > driver's probe function is running? It is actually to early. The interrupt is requested when the MAC attaches the PHY. There are is at least one MAC driver which assigns the phydev->irq just before attaching the PHY, a long time after the PHY has probed. Andrew