From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ed1-f41.google.com (mail-ed1-f41.google.com [209.85.208.41]) (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 5B23049552F for ; Tue, 9 Jun 2026 15:13:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.41 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781018022; cv=none; b=uO2+sNyr265hC6wM9PLU8KFG5a4PG7I9eTqGa2LhWSzHVgjHjstKnqbdzFQgWgmubUnb6+vAep5BoXZ+Rt+IrU8AR/TAb3qcxKhcUB++ubC7SAo2QE7GdXHVIAdpJZy87K31iXEXrOzFzNVXhBjSTFrvukRrCZXo0p8FhInFhU4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781018022; c=relaxed/simple; bh=tpAXJdZq6BjF0DfbpXDCqiFqjsTUCSKFfSE16ogKceQ=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=TNop0Q4BJGs9bGl69HWxcKEQSsVoowOOtqUokSVMkrad/zqh8WDS+W5btU8/aaN10xY4cio/m4vQCQcMY0PkQB9URzDPKrHSQLkvTLTjul14KeaqCNrH8f6Sslk0cDNhOWHczMHXt4EncaxBNlyNe1D6XqsvmKGRVTIsB2H0HA0= 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=mDBG478I; arc=none smtp.client-ip=209.85.208.41 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="mDBG478I" Received: by mail-ed1-f41.google.com with SMTP id 4fb4d7f45d1cf-68d23396ed3so10101272a12.1 for ; Tue, 09 Jun 2026 08:13:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1781018009; x=1781622809; 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=rCE+R9wA56VqH4pDqL6DakPzOTQgXi/PURE5D91YIjM=; b=mDBG478ILZBk8Rycj2Q5NuQHr65L7wp5JhR5wTxspx9r/zngFDFH3Ayc7VbnOEzQLO AHGOYRKztPAd38+0BUEF3irHU4T+YQSx4fZfDnhZMIk41s/ezIg9rtSVKiLylm9jeA9P F81/sm8+zNqKdpD53hg1eCmd4Wged8xIMwKerZkWxUHUOKpUQYmawIU6JYz4qaFRjqjd LzxCjONVJMmi/02gh37F/l5M0CP1CSNTucZmM3pOBJA8t0VMvqurSb/cC9mFYRwYherk ZERhPJrbhdXbFjFAp5f5k9qpfrYMA5NawbcWfGBzhboMf8HHFqiWWRJRoDtY62iQVuZe RjoQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781018009; x=1781622809; 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=rCE+R9wA56VqH4pDqL6DakPzOTQgXi/PURE5D91YIjM=; b=aoWEwV7NN2k3yCSHzo1fADFxDSZp/r3IBPPnS9P3Z+oKa1MNLrbhNzfbhnjNtCXtkt NK/LGzNGmgjSY0rqqbTr5gJb1UBKB9JjILW7bxzzXTpLYPqKCFzlY4Vpi/FId3qmLbJG qP6NAzTBu5kSeKLlDWNnCFaSWgNd0mPawfdr7GP4fTb+Ud8BxHb3fYSWkZTzQzlWMHny n/N++NC9v9/PBubZh1yJC4FCbvV7zThkfliheoMvUFnF6u5o3tRaT5xz1SNUVv2TJBD2 ScYiXKnMToUyvrfQ8Id4XG7NXVSMfjwwbXbBMj+L24neU6cRIRfpydKmZw+JhZ48K+qk FuuQ== X-Forwarded-Encrypted: i=1; AFNElJ/qY6rquDiMF6FeK8mFyBsYNN9HpIMdiDrVmm8Bua/FG64S0DXxU5PcVLBJEtZXkSh8TparaF5/8cI=@vger.kernel.org X-Gm-Message-State: AOJu0YwBvEAxMNEYO31g7edv9YEzWk/IgowgEAcQIRgOy5Ye7vFWWx/k BxaYHmnI/ImpXlwWPdRd1uwTp2u18zXB0gCdAMVxH8Xljo8ah/l4/usJ X-Gm-Gg: Acq92OEVa/oy+ffsXL0cp4tl92l8y0BHK2lELFudScz8fNhm8JNIqAZ4bYYhL61YF7x 8cVQKTDKBoUdALViYOH/f3DRTUghuhnxUo7sK3xbObNIzY57sUEuqmwNfCZbP2lnGzR8qrPoMCY RFRpRtEvTbrI/+O8TKdaCPoA3HwzzteBj4tsTT1AMprURS+0lDDpSXjXTRJBq9x91SDe8hbZMqO 13RmqWV14S9DY/C5erqcnVUL9d83uoedQSFTWVziRzIO6o6aKA+VByfwUqxbCdEXcnlsN6zH37l U7x8H7k8yQnvmJryWm4VvPkS+QjrJEWhIQMniIqSKZyKQF8sZgD6ZLU/B87s7NelKKHoM54NWhk wI/ToBSwrd+96JGBQZ9bJsL+bEzmaP1BpxBlzZl/qx8924spTpdpRuv63RvQ6xeytJOga6AhI6t B+pwXRcpLdqSj9xaJLSqH2qv78zMGNQ08/ X-Received: by 2002:a17:906:cc55:b0:baa:1d9:66ff with SMTP id a640c23a62f3a-bf9373dad65mr128724266b.20.1781018009295; Tue, 09 Jun 2026 08:13:29 -0700 (PDT) Received: from Ansuel-XPS24 ([2.195.136.12]) by smtp.googlemail.com with ESMTPSA id a640c23a62f3a-bf0517721e5sm1073637866b.9.2026.06.09.08.13.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jun 2026 08:13: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 Subject: [PATCH net-next v6 09/12] net: phylink: add .pcs_link_down PCS OP Date: Tue, 9 Jun 2026 17:12:05 +0200 Message-ID: <20260609151212.29469-10-ansuelsmth@gmail.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260609151212.29469-1-ansuelsmth@gmail.com> References: <20260609151212.29469-1-ansuelsmth@gmail.com> Precedence: bulk X-Mailing-List: linux-doc@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 torn 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 before .mac_link_down to torn 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 | 8 ++++++++ include/linux/phylink.h | 2 ++ 2 files changed, 10 insertions(+) diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c index 65b67c33e12f..38428b375eca 100644 --- a/drivers/net/phy/phylink.c +++ b/drivers/net/phy/phylink.c @@ -1036,6 +1036,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) @@ -1735,6 +1741,8 @@ static void phylink_link_down(struct phylink *pl) phylink_deactivate_lpi(pl); + phylink_pcs_link_down(pl->pcs); + pl->mac_ops->mac_link_down(pl->config, pl->act_link_an_mode, pl->cur_interface); phylink_info(pl, "Link is Down\n"); diff --git a/include/linux/phylink.h b/include/linux/phylink.h index b65f91c78d8c..79a1496fa519 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: torn 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); -- 2.53.0