Devicetree
 help / color / mirror / Atom feed
From: Minda Chen <minda.chen@starfivetech.com>
To: Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S . Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Jose Abreu <joabreu@synopsys.com>,
	Maxime Coquelin <mcoquelin.stm32@gmail.com>,
	Russell King <linux@armlinux.org.uk>,
	Giuseppe Cavallaro <peppe.cavallaro@st.com>,
	Alexandre Torgue <alexandre.torgue@foss.st.com>,
	Rob Herring <robh+dt@kernel.org>,
	Krzysztof Kozlowski <krzk+dt@kernel.org>,
	Conor Dooley <conor@kernel.org>,
	netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org,
	linux-stm32@st-md-mailman.stormreply.com,
	devicetree@vger.kernel.org,
	Minda Chen <minda.chen@starfivetech.com>
Subject: [net-next v1 6/6] net: stmmac: ethtool: Do NOT call phylink function in NCSI mode.
Date: Wed, 10 Jun 2026 15:24:20 +0800	[thread overview]
Message-ID: <20260610072420.64699-7-minda.chen@starfivetech.com> (raw)
In-Reply-To: <20260610072420.64699-1-minda.chen@starfivetech.com>

stmmac ethtool module do not call phylink function
while GMAC NCSI mode.
stmmac_ethtool_get_link_ksettings() return NCSI defaut
speed and duplex setting, except that most cases return
-EOPNOTSUPP error code.

Signed-off-by: Minda Chen <minda.chen@starfivetech.com>
---
 .../ethernet/stmicro/stmmac/stmmac_ethtool.c  | 32 ++++++++++++++++++-
 1 file changed, 31 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
index 92585d27ab88..149d3b9536ce 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
@@ -322,6 +322,12 @@ static int stmmac_ethtool_get_link_ksettings(struct net_device *dev,
 {
 	struct stmmac_priv *priv = netdev_priv(dev);
 
+	if (priv->plat->use_ncsi) {
+		cmd->base.speed = SPEED_100;
+		cmd->base.duplex = DUPLEX_FULL;
+		return 0;
+	}
+
 	return phylink_ethtool_ksettings_get(priv->phylink, cmd);
 }
 
@@ -331,6 +337,9 @@ stmmac_ethtool_set_link_ksettings(struct net_device *dev,
 {
 	struct stmmac_priv *priv = netdev_priv(dev);
 
+	if (priv->plat->use_ncsi)
+		return -EOPNOTSUPP;
+
 	return phylink_ethtool_ksettings_set(priv->phylink, cmd);
 }
 
@@ -384,6 +393,9 @@ static int stmmac_nway_reset(struct net_device *dev)
 {
 	struct stmmac_priv *priv = netdev_priv(dev);
 
+	if (priv->plat->use_ncsi)
+		return -EOPNOTSUPP;
+
 	return phylink_ethtool_nway_reset(priv->phylink);
 }
 
@@ -424,6 +436,9 @@ stmmac_get_pauseparam(struct net_device *netdev,
 {
 	struct stmmac_priv *priv = netdev_priv(netdev);
 
+	if (priv->plat->use_ncsi)
+		return;
+
 	phylink_ethtool_get_pauseparam(priv->phylink, pause);
 }
 
@@ -433,6 +448,9 @@ stmmac_set_pauseparam(struct net_device *netdev,
 {
 	struct stmmac_priv *priv = netdev_priv(netdev);
 
+	if (priv->plat->use_ncsi)
+		return -EOPNOTSUPP;
+
 	return phylink_ethtool_set_pauseparam(priv->phylink, pause);
 }
 
@@ -547,7 +565,7 @@ static void stmmac_get_ethtool_stats(struct net_device *dev,
 					     (*(u32 *)p);
 			}
 		}
-		if (priv->dma_cap.eee) {
+		if (priv->dma_cap.eee && !priv->plat->use_ncsi) {
 			int val = phylink_get_eee_err(priv->phylink);
 			if (val)
 				priv->xstats.phy_eee_wakeup_error_n = val;
@@ -723,6 +741,9 @@ static void stmmac_get_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
 {
 	struct stmmac_priv *priv = netdev_priv(dev);
 
+	if (priv->plat->use_ncsi)
+		return;
+
 	return phylink_ethtool_get_wol(priv->phylink, wol);
 }
 
@@ -730,6 +751,9 @@ static int stmmac_set_wol(struct net_device *dev, struct ethtool_wolinfo *wol)
 {
 	struct stmmac_priv *priv = netdev_priv(dev);
 
+	if (priv->plat->use_ncsi)
+		return -EOPNOTSUPP;
+
 	return phylink_ethtool_set_wol(priv->phylink, wol);
 }
 
@@ -738,6 +762,9 @@ static int stmmac_ethtool_op_get_eee(struct net_device *dev,
 {
 	struct stmmac_priv *priv = netdev_priv(dev);
 
+	if (priv->plat->use_ncsi)
+		return -EOPNOTSUPP;
+
 	return phylink_ethtool_get_eee(priv->phylink, edata);
 }
 
@@ -746,6 +773,9 @@ static int stmmac_ethtool_op_set_eee(struct net_device *dev,
 {
 	struct stmmac_priv *priv = netdev_priv(dev);
 
+	if (priv->plat->use_ncsi)
+		return -EOPNOTSUPP;
+
 	return phylink_ethtool_set_eee(priv->phylink, edata);
 }
 
-- 
2.17.1


  parent reply	other threads:[~2026-06-10  7:58 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-10  7:24 [net-next v1 0/6] Add synopsys designware GMAC NCSI support Minda Chen
2026-06-10  7:24 ` [net-next v1 1/6] dt-bindings: net: dwmac: Add snps,use-ncsi property Minda Chen
2026-06-10  7:50   ` Krzysztof Kozlowski
2026-06-10  8:17   ` Andrew Lunn
2026-06-10  7:24 ` [net-next v1 2/6] net: stmmac: Checking whether priv->phylink if NULL in NCSI case Minda Chen
2026-06-10  8:26   ` Andrew Lunn
2026-06-10  7:24 ` [net-next v1 3/6] net: stmmac: Add register NCSI device support Minda Chen
2026-06-10  7:24 ` [net-next v1 4/6] net: stmmac: Add NCSI VLAN setting Minda Chen
2026-06-10  7:24 ` [net-next v1 5/6] net: dwmac4: Add NCSI mac speed and duplex setting in NCSI case Minda Chen
2026-06-10  7:24 ` Minda Chen [this message]
2026-06-10  8:31   ` [net-next v1 6/6] net: stmmac: ethtool: Do NOT call phylink function in NCSI mode Andrew Lunn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260610072420.64699-7-minda.chen@starfivetech.com \
    --to=minda.chen@starfivetech.com \
    --cc=alexandre.torgue@foss.st.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=conor@kernel.org \
    --cc=davem@davemloft.net \
    --cc=devicetree@vger.kernel.org \
    --cc=edumazet@google.com \
    --cc=joabreu@synopsys.com \
    --cc=krzk+dt@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-stm32@st-md-mailman.stormreply.com \
    --cc=linux@armlinux.org.uk \
    --cc=mcoquelin.stm32@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=peppe.cavallaro@st.com \
    --cc=robh+dt@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox