From: Jiawen Wu <jiawenwu@trustnetic.com>
To: netdev@vger.kernel.org
Cc: "Mengyuan Lou" <mengyuanlou@net-swift.com>,
"Andrew Lunn" <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
"Eric Dumazet" <edumazet@kernel.org>,
"Jakub Kicinski" <kuba@kernel.org>,
"Paolo Abeni" <pabeni@redhat.com>,
"Russell King" <linux@armlinux.org.uk>,
"Jacob Keller" <jacob.e.keller@intel.com>,
"Kees Cook" <kees@kernel.org>,
"Chenguang Zhao" <zhaochenguang@kylinos.cn>,
"Aleksandr Loktionov" <aleksandr.loktionov@intel.com>,
"Uwe Kleine-König (The Capable Hub)"
<u.kleine-koenig@baylibre.com>,
"Russell King (Oracle)" <rmk+kernel@armlinux.org.uk>,
"Maciej Fijalkowski" <maciej.fijalkowski@intel.com>,
"Simon Horman" <horms@kernel.org>,
"Jiawen Wu" <jiawenwu@trustnetic.com>
Subject: [PATCH net v3 2/3] net: txgbe: keep MAC enabled for SP devices that support NCSI
Date: Tue, 13 Oct 2026 10:06:25 +0800 [thread overview]
Message-ID: <20261013020626.5548-4-jiawenwu@trustnetic.com> (raw)
In-Reply-To: <20261013020626.5548-1-jiawenwu@trustnetic.com>
SP devices using NCSI require the MAC transmitter and optical Tx to
remain enabled when the host interface is down.
Skip disabling MAC Tx in mac_link_down() for NCSI devices. Keep the
data-path shutdown in mac_prepare() for PCS reconfiguration, and
re-enable MAC Tx in mac_finish() without waiting for host link-up.
txgbe_down() still performs a LAN reset through txgbe_reset_hw() after
the MAC is left enabled. This does not clear MAC Tx on NCSI devices,
because the NCSI firmware protects the MAC configuration from the LAN
reset, so no further re-enable is needed on the down path.
Keep TX_DISABLE deasserted while an NCSI host interface is down.
Retain normal SFP GPIO handling while the interface is up, including
transmit fault recovery.
TX_DISABLE is driven by the SFP core, which asserts it at probe and
whenever the upstream is stopped by phylink_stop(). Neither the SFP
core nor phylink provides a way to keep the transmitter enabled while
the interface is down.
Therefore, handle this in the GPIO controller: requests to assert
TX_DISABLE are ignored while WX_STATE_DOWN is set on an NCSI device.
WX_STATE_DOWN is set before phylink_stop() in txgbe_down() and cleared
before phylink_start() in txgbe_up_complete(), so requests made while
the interface is up, including TX fault recovery, still reach the
hardware.
While the interface is down, the SFP core considers TX_DISABLE
asserted although the line is driven low. This does not affect the
SFP state machine, which stays in SFP_S_DOWN until the upstream is
started again and then deasserts TX_DISABLE itself.
Fixes: 08f08f9390e4 ("net: txgbe: Support phylink MAC layer")
Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com>
---
drivers/net/ethernet/wangxun/txgbe/txgbe_phy.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/wangxun/txgbe/txgbe_phy.c b/drivers/net/ethernet/wangxun/txgbe/txgbe_phy.c
index dc9f243146580..589ad5d2f17b3 100644
--- a/drivers/net/ethernet/wangxun/txgbe/txgbe_phy.c
+++ b/drivers/net/ethernet/wangxun/txgbe/txgbe_phy.c
@@ -182,7 +182,8 @@ static void txgbe_mac_link_down(struct phylink_config *config,
{
struct wx *wx = phylink_to_wx(config);
- wr32m(wx, WX_MAC_TX_CFG, WX_MAC_TX_CFG_TE, 0);
+ if (!wx->ncsi_enabled)
+ wr32m(wx, WX_MAC_TX_CFG, WX_MAC_TX_CFG_TE, 0);
wx->speed = SPEED_UNKNOWN;
if (test_bit(WX_STATE_PTP_RUNNING, wx->state))
@@ -253,6 +254,10 @@ static int txgbe_mac_finish(struct phylink_config *config, unsigned int mode,
txgbe_enable_sec_tx_path(wx);
wr32m(wx, WX_MAC_RX_CFG, WX_MAC_RX_CFG_RE, WX_MAC_RX_CFG_RE);
+ /* NCSI requires MAC Tx to be enabled even if the host link stays down. */
+ if (wx->ncsi_enabled)
+ wr32m(wx, WX_MAC_TX_CFG, WX_MAC_TX_CFG_TE, WX_MAC_TX_CFG_TE);
+
return 0;
}
@@ -368,6 +373,11 @@ static int txgbe_gpio_direction_out(struct gpio_chip *chip, unsigned int offset,
unsigned long flags;
u32 set;
+ /* Keep the NCSI transmitter enabled while the host interface is down. */
+ if (wx->ncsi_enabled && BIT(offset) == TXGBE_GPIOBIT_1 &&
+ test_bit(WX_STATE_DOWN, wx->state))
+ val = 0;
+
set = val ? BIT(offset) : 0;
raw_spin_lock_irqsave(&wx->gpio_lock, flags);
--
2.51.0
next prev parent reply other threads:[~2026-10-13 2:07 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-13 2:06 [PATCH net v3 0/3] net: wangxun: keep MAC enabled for NCSI devices Jiawen Wu
2026-10-13 2:06 ` [PATCH v3 1/3] net: libwx: keep NGBE OCP cards MAC enabled Jiawen Wu
2026-10-13 2:09 ` netdev-bot+sinfo
2026-10-13 2:13 ` Jiawen Wu
2026-10-13 2:06 ` [PATCH net v3 1/3] net: wangxun: " Jiawen Wu
2026-10-13 2:06 ` Jiawen Wu [this message]
2026-10-13 2:06 ` [PATCH net v3 3/3] net: txgbe: keep MAC enabled for AML devices that support NCSI Jiawen Wu
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=20261013020626.5548-4-jiawenwu@trustnetic.com \
--to=jiawenwu@trustnetic.com \
--cc=aleksandr.loktionov@intel.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=horms@kernel.org \
--cc=jacob.e.keller@intel.com \
--cc=kees@kernel.org \
--cc=kuba@kernel.org \
--cc=linux@armlinux.org.uk \
--cc=maciej.fijalkowski@intel.com \
--cc=mengyuanlou@net-swift.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=rmk+kernel@armlinux.org.uk \
--cc=u.kleine-koenig@baylibre.com \
--cc=zhaochenguang@kylinos.cn \
/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