From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f50.google.com (mail-wm1-f50.google.com [209.85.128.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 00E643F86EA for ; Thu, 18 Jun 2026 12:58:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.50 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781787512; cv=none; b=eO6QJb6wWXfV2dWwlU0GBpBGc56sYXubItgGWLhF7HnwB/yCboHkcOKfRSQW0/pmjiHRt8c9WR1fvmaLQPSe/XoeuES3kuroa9neFjNhGTUFkNcjmRV1+E3/eJNkbu7Berg0Dx5+1fuSoP20rioedn9KzKkf7m9kMjN/hqomF5U= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781787512; c=relaxed/simple; bh=PvW6l55YU7y+D1r30THykltDeSG0Og5W68W5V8wdrbs=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Q3UyyYBx04m/Kcl2X4LAadUz6wFNZFUQswiUXTyTL5oRnia+B+Hh+ZSLuWsXwuX/9jpbgUHEhMuppw2XG9O+vvMUAJn00PnNmlBDqWifXtAX7EOlFyrsjYZK6bXQIiK5UjkrovKpulf9VVn19sgaK5gfKV6Wfw8zu7CnRqRsuqc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=A83lcs6k; arc=none smtp.client-ip=209.85.128.50 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="A83lcs6k" Received: by mail-wm1-f50.google.com with SMTP id 5b1f17b1804b1-490b12270b3so4773155e9.1 for ; Thu, 18 Jun 2026 05:58:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1781787509; x=1782392309; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=YBpoQAlaT8nFCgwnSUFeme66HFsPGdI0rDUBeKbrcl8=; b=A83lcs6kUprWekHOGtNbuS8uIh7+NCZaEtZn8LMixPUZaFqalZwaQ2TkW59URmIZUl K7BaKYOTa3c8GBU4T1cZ79TFvjSBj6SuqQkxiImd9q23+TOYGvR/JbE79SJ3IwadXDDy FklXOfjAeYvEGu2zmsUB2zt0huAR8+KCc4Q2SCT3WzRBp83EiAX6k83spx4LNxlx2Dqz l92PI5a8fwAF9kWVfJ++F2DLSKI31OygT11+X+zhS7H+mnr4SFgeO+mfVMSidjQf5S1f DeJbxhOPIC/JeG6znTErJu6fnGkKyq+8XuqrRluNRsuzLVuiyZ8yV0F4CHVSDamk6b5b 5UlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781787509; x=1782392309; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-gg:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=YBpoQAlaT8nFCgwnSUFeme66HFsPGdI0rDUBeKbrcl8=; b=mbVSJK5AQbs+VVnsB75JJuHyjCyUhv81D04M4ghnuwj7d87BwRSblNiyVBgfeYDWA9 kQ2XR/ggTcehDgdKWEDndl1kJEow/YC+ruqkAMsyUS7W5nxHUdK81mY6snb8Oz5bKzVN kpqjWemaA9im6v3txEe2gMSrVcGVPQpI2eK7XFujw/sVErfCaMc9KUfAE4pRUuD5ASfO Eln6506mzm0qoKxf+nc1Tk37f++BaN0hzP9sT/ZFAabLt3Vzu9k/5MDUG1uiyhp8QnMH DBi1fZhj5UxWRZE++XuYAiwkwGdj1T7B9WZ7qiLgLBDFtu69j2Ie4cS0v9drA07rNono JtPA== X-Forwarded-Encrypted: i=1; AFNElJ8w51j033VY9oAwlOuPm45cLrpBBowxeP0nb3pO8iyA+H0zSt9JcY/QmTZEkcjimbi7zaZ3r6FpKbea+b0=@vger.kernel.org X-Gm-Message-State: AOJu0YzWjEfMR7q0LGZK5dnMWs5pgBp4Oz/uO9yhDGGLGvOlZ3ng+jYj /MIt1O4XbLoqZ9tWVCW1nX11ZfLquvLgczBDvdiTywf9KIqe0TMRsd74 X-Gm-Gg: AfdE7clZUKJnKTBo+B44TewQ6D4xcj5BbJ/T55+COFWB8G7uuF+cZDhdkcJT7M2hKgl grDHUn0nG3eeb2uO7dnnXu/Z+CZO23qtUoiLTHcV2csQ3UB4KmiUmiYt2R09WzaCbiE0Ev2NLb9 n2B3dP/ECtwgrbSLYeQoomADSZOpl6KRV0hTM43Zojtm+srb5MPSmpcPNoHK6L3+fWWPmJQXcKW h4w1jJsq2D0jFAjhAJ0Tq1ECWBoN3jAZWQflkLE1HS3fM2Rr50KzibzTzZjnfThNkuxIDsAclXp TzFSUGCmk9M598HADCzQQtpo0MiEOgp7K2Z8S9OqHfWKoY3eTuj4StzfVP30n9pGOCDSTe3eJZh BRAMP/R2JZqyATYS3+CNoYwq39qJ1C46Uq3WE1unzr53UdeC0mosaQUT1yqnCC56d4rseXCasuF 0BXrWshL08Ch5zoBQ+oeCyEObk4SXNAJRzbEZpXi1BSlRQPpdRQy1PDNjjvl7TiA== X-Received: by 2002:a05:600c:3148:b0:490:b5d0:598e with SMTP id 5b1f17b1804b1-4923412f0e7mr127508315e9.21.1781787509280; Thu, 18 Jun 2026 05:58:29 -0700 (PDT) Received: from Ansuel-XPS24.localdomain (93-34-88-103.ip49.fastwebnet.it. [93.34.88.103]) by smtp.googlemail.com with ESMTPSA id 5b1f17b1804b1-49230a458f2sm241451585e9.3.2026.06.18.05.58.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Jun 2026 05:58:28 -0700 (PDT) From: Christian Marangi To: Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Simon Horman , Jonathan Corbet , Shuah Khan , Christian Marangi , Lorenzo Bianconi , Heiner Kallweit , Russell King , Saravana Kannan , Philipp Zabel , Nathan Chancellor , Nick Desaulniers , Bill Wendling , Justin Stitt , netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, llvm@lists.linux.dev, Maxime Chevallier Subject: [RFC PATCH net-next v8 09/12] net: phylink: add .pcs_link_down PCS OP Date: Thu, 18 Jun 2026 14:57:17 +0200 Message-ID: <20260618125752.1223-10-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260618125752.1223-1-ansuelsmth@gmail.com> References: <20260618125752.1223-1-ansuelsmth@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Permit for PCS driver to define specific operation to tear down the link between the MAC and the PCS. This might be needed for some PCS that reset counter or require special reset to correctly work if the link needs to be restored later. On phylink_link_down() call, the additional phylink_pcs_link_down() will be called after .mac_link_down to tear down the link. PCS driver will need to define .pcs_link_down to make use of this. Signed-off-by: Christian Marangi --- drivers/net/phy/phylink.c | 9 +++++++++ include/linux/phylink.h | 12 ++++++++++++ 2 files changed, 21 insertions(+) diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c index b9a212bd1206..b2b1d57dacd2 100644 --- a/drivers/net/phy/phylink.c +++ b/drivers/net/phy/phylink.c @@ -1038,6 +1038,12 @@ static void phylink_pcs_link_up(struct phylink_pcs *pcs, unsigned int neg_mode, pcs->ops->pcs_link_up(pcs, neg_mode, interface, speed, duplex); } +static void phylink_pcs_link_down(struct phylink_pcs *pcs) +{ + if (pcs && pcs->ops->pcs_link_down) + pcs->ops->pcs_link_down(pcs); +} + static void phylink_pcs_disable_eee(struct phylink_pcs *pcs) { if (pcs && pcs->ops->pcs_disable_eee) @@ -1739,6 +1745,9 @@ static void phylink_link_down(struct phylink *pl) pl->mac_ops->mac_link_down(pl->config, pl->act_link_an_mode, pl->cur_interface); + + phylink_pcs_link_down(pl->pcs); + phylink_info(pl, "Link is Down\n"); } diff --git a/include/linux/phylink.h b/include/linux/phylink.h index 15e6b1a39dfe..ecf4c384fd31 100644 --- a/include/linux/phylink.h +++ b/include/linux/phylink.h @@ -528,6 +528,7 @@ struct phylink_pcs { * @pcs_an_restart: restart 802.3z BaseX autonegotiation. * @pcs_link_up: program the PCS for the resolved link configuration * (where necessary). + * @pcs_link_down: tear down link between MAC and PCS. * @pcs_disable_eee: optional notification to PCS that EEE has been disabled * at the MAC. * @pcs_enable_eee: optional notification to PCS that EEE will be enabled at @@ -555,6 +556,7 @@ struct phylink_pcs_ops { void (*pcs_an_restart)(struct phylink_pcs *pcs); void (*pcs_link_up)(struct phylink_pcs *pcs, unsigned int neg_mode, phy_interface_t interface, int speed, int duplex); + void (*pcs_link_down)(struct phylink_pcs *pcs); void (*pcs_disable_eee)(struct phylink_pcs *pcs); void (*pcs_enable_eee)(struct phylink_pcs *pcs); int (*pcs_pre_init)(struct phylink_pcs *pcs); @@ -690,6 +692,16 @@ void pcs_an_restart(struct phylink_pcs *pcs); void pcs_link_up(struct phylink_pcs *pcs, unsigned int neg_mode, phy_interface_t interface, int speed, int duplex); +/** + * pcs_link_up() - tear down link between MAC and PCS + * @pcs: a pointer to a &struct phylink_pcs. + * + * This call will be made just after mac_link_down() to inform the PCS the + * link has gone down. PCS should be configured to stop processing packets + * for transmission and reception. + */ +void pcs_link_down(struct phylink_pcs *pcs); + /** * pcs_disable_eee() - Disable EEE at the PCS * @pcs: a pointer to a &struct phylink_pcs -- 2.53.0