From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=185.246.84.56 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1793959896; b=0iGSeRb507/cVjSntT3wJhnsc8eS8PJqrxcT1o5ATkJPAKIb6pWCT0VQM3SyZM0kxSnC opeA1rQexRxf9upLLz1GtBIrlvJ2nODkEpdVihILIICpeineWcrUHaquZwY1Ue9WoohbP LTZyDqsbfrl/f10n+loKqY6kLkSxdNi7uT24wSezcBkBDkQZrEkKWWJTaj+r1rU4KN+Lp CwMEFXbmAtmPm/wE+brc0u0BeqXT062xLpTDlwUTYjsIEpaj5nZ4MSjq1X9TtQdxF2jjJ AH83TxylmO997FQFMBjHKCQ2pEJpRx8cdnf5xZWt2ukpiHsEhgD2Do3wNjPqD5QFFpg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793959896; h=DMARC-Filter:Received:Received:Received:DKIM-Signature:Message-ID: Date:MIME-Version:User-Agent:Subject:To:Cc:References:From: Content-Language:In-Reply-To:Content-Type:Content-Transfer-Encoding: X-Last-TLS-Session-Version; bh=6ogeEWksxpSUWmxEpBUUGjIXdCyDlrjJdIfYEM0KO6U=; b=KerxT9J7giVoecGkk2xDDmYrpKU3FkBB5fO6h+0BBHu1WfgrpxLvqWjysQO32spFqeDx Kr4p2ZPJPr2EUopJq0sb8yHQjjMnBizWcBsfewX260OROIF+0LL7a3HmlT+yPYbpjdu8w 5yT/5PyEHmynChkKG+ll2qWu3rDGiO851Kd6R8hdOYENwQb56wEiQMcYMwAvCvYVXiBnR wkbN+vt0yIrxl2JNjBgcIs55yy9UR5B4gaouVYdQTihs7cjS02qbuBFnGyRf14dI8KtwM GPN11vo9UnpkdGuQpZm9BNo/VyzV74ojo8wigCekJ5ciqRbfN82WZscXJFVu84hSaBA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=bootlin.com; spf=pass smtp.mailfrom=bootlin.com; dkim=pass header.d=bootlin.com header.i=@bootlin.com header.a=rsa-sha256 header.s=dkim header.b=I5CrbdBu; arc=none smtp.remote-ip=185.246.84.56 Received: from smtpout-02.galae.net (smtpout-02.galae.net [185.246.84.56]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 065D4606A32E for ; Fri, 6 Nov 2026 10:11:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 065D4606A32E Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=bootlin.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bootlin.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=bootlin.com header.i=@bootlin.com header.a=rsa-sha256 header.s=dkim header.b=I5CrbdBu Received: from smtpout-01.galae.net (smtpout-01.galae.net [212.83.139.233]) by smtpout-02.galae.net (Postfix) with ESMTPS id 5A71E1A1355; Fri, 6 Nov 2026 10:11:33 +0000 (UTC) Received: from mail.galae.net (mail.galae.net [212.83.136.155]) by smtpout-01.galae.net (Postfix) with ESMTPS id 259005FFBC; Fri, 6 Nov 2026 10:11:33 +0000 (UTC) Received: from [127.0.0.1] (localhost [127.0.0.1]) by localhost (Mailerdaemon) with ESMTPSA id 31F8B103291F9; Fri, 6 Nov 2026 11:11:22 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=dkim; t=1793959891; h=from:subject:date:message-id:to:cc:mime-version:content-type: content-transfer-encoding:content-language:in-reply-to:references; bh=6ogeEWksxpSUWmxEpBUUGjIXdCyDlrjJdIfYEM0KO6U=; b=I5CrbdBuFxZWEIZBIc49EI2RZqfWkGbm2L+NrRyTZJ1N7ucRBbZshseI6mtnf2iQ3+ecuf TZG5FPUEC8BVovD0Lf4OeEwwfYCnCw5cabRSLhaM/tpvKlEXiVUqyphsti7+20dCBbX7eR 3QfM1qOkrHcwXrRl7p/4ajr228FR1M8E4ae6lcwSWl6JoJyv+x90JYK+ArGk9c2k1OvUd1 M5vAWbaCSezXJFI6izU+WQDs5QUa8CnH0sYx+gcaQHkSYdKStZ9qWmZtJsof/RYe5gRp6L +mwvNx385Qq0wRzYny1U2cmcT6XKsQ5q2WxsH7uFmqOSYqfLA5CN/lBtmnjinQ== Message-ID: <69be2cfe-e296-4f90-ad19-0bd48a83e287@bootlin.com> Date: Fri, 6 Nov 2026 11:11:22 +0100 X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH net-next v20 01/13] phylink: Add phylink_mac_interrupt To: Birger Koblitz , Andrew Lunn , "David S. Miller" , Jakub Kicinski , Paolo Abeni , Russell King , Andrew Lunn , Heiner Kallweit , Huacai Chen , WANG Xuerui , Eric Dumazet Cc: linux-usb@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, loongarch@lists.linux.dev, Jianhui Xu , Emir Beganovic , Nicolai Buchwitz References: <20261106-ax88179a-v20-0-37b5a1189983@birger-koblitz.de> <20261106-ax88179a-v20-1-37b5a1189983@birger-koblitz.de> From: Maxime Chevallier Content-Language: en-US In-Reply-To: <20261106-ax88179a-v20-1-37b5a1189983@birger-koblitz.de> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Last-TLS-Session-Version: TLSv1.3 Hi, On 11/6/26 08:21, Birger Koblitz wrote: > Add the phylink_mac_interrupt() function to phylink, which > passes a link-change interrupt received by the MAC to phylib. > This function can be used by drivers which want to avoid > polling the PHY and instead rely on an interrupt received by > the MAC when a link-change happens. > > Signed-off-by: Birger Koblitz > Reviewed-by: Andrew Lunn > Reviewed-by: Nicolai Buchwitz > --- > drivers/net/phy/phylink.c | 20 ++++++++++++++++++++ > include/linux/phylink.h | 1 + > 2 files changed, 21 insertions(+) > > diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c > index e885da1c28311a12a869e29ceb3c96886f31adc6..a87eaa2f3db5bef8fe56e12b90375bdb7f9c52e7 100644 > --- a/drivers/net/phy/phylink.c > +++ b/drivers/net/phy/phylink.c > @@ -1616,6 +1616,26 @@ static bool phylink_link_is_up(struct phylink *pl) > return pl->netdev ? netif_carrier_ok(pl->netdev) : pl->old_link_state; > } > > +/** > + * phylink_mac_interrupt() - wrapper for phy_mac_interrupt() > + * @pl: a pointer to a &struct phylink returned from phylink_create() > + * > + * Passes a link-change interrupt received by the MAC to phylib. > + * This function may be called in interrupt context, and therefore cannot take > + * a mutex. However, it is safe to assume that the reference to phy does not > + * disappear during the call, as only an SFP module may be unplugged to make a > + * PHY disappear. SFP modules however do not support interrupts. I don't see the relevance of PHY SFP supporting interrupts or not here, this just re-triggers the PHY state machine. Looks like a comment to make sashiko happy. Anyways, I'm OK with the approach, maybe reword that comment if you need to respin, Reviewed-by: Maxime Chevallier Maxime > + */ > +void phylink_mac_interrupt(struct phylink *pl) > +{ > + struct phy_device *phy; > + > + phy = pl->phydev; > + if (phy) > + phy_mac_interrupt(phy); > +} > +EXPORT_SYMBOL_GPL(phylink_mac_interrupt); > + > static void phylink_resolve(struct work_struct *w) > { > struct phylink *pl = container_of(w, struct phylink, resolve); > diff --git a/include/linux/phylink.h b/include/linux/phylink.h > index 3a88a69882a610afb868b55df6f6e77aea918649..a7b6294cc4a075bd2aaa43ed6484de17a6cb88b1 100644 > --- a/include/linux/phylink.h > +++ b/include/linux/phylink.h > @@ -768,6 +768,7 @@ int phylink_ethtool_set_eee(struct phylink *link, struct ethtool_keee *eee); > int phylink_mii_ioctl(struct phylink *, struct ifreq *, int); > int phylink_speed_down(struct phylink *pl, bool sync); > int phylink_speed_up(struct phylink *pl); > +void phylink_mac_interrupt(struct phylink *pl); > > #define phylink_zero(bm) \ > bitmap_zero(bm, __ETHTOOL_LINK_MODE_MASK_NBITS) >