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@google.com>,
"'Jakub Kicinski'" <kuba@kernel.org>,
"'Paolo Abeni'" <pabeni@redhat.com>,
"'Jacob Keller'" <jacob.e.keller@intel.com>,
"'Kees Cook'" <kees@kernel.org>,
"'Aleksandr Loktionov'" <aleksandr.loktionov@intel.com>,
"'Uwe Kleine-König (The Capable Hub)'"
<u.kleine-koenig@baylibre.com>,
"'Rongguang Wei'" <weirongguang@kylinos.cn>,
"'Chenguang Zhao'" <zhaochenguang@kylinos.cn>
Subject: RE: [PATCH net-next v3] net: wangxun: use cached NCSI and WOL capability flags
Date: Wed, 16 Sep 2026 17:48:43 +0800 [thread overview]
Message-ID: <02bc01dd45c0$8f532090$adf961b0$@trustnetic.com> (raw)
In-Reply-To: <E5215E3514E295BA+20260916063312.203457-1-jiawenwu@trustnetic.com>
On Wed, Sep 16, 2026 2:33 PM, Jiawen Wu wrote:
> wx_disable_rx() and txgbe_disable_device() open-code the same subsystem
> device ID tests to decide whether the MAC receiver and transmitter have
> to stay enabled for out-of-band management:
>
> (subsystem_device_id & WX_NCSI_MASK) == WX_NCSI_SUP ||
> (subsystem_device_id & WX_WOL_MASK) == WX_WOL_SUP
>
> ngbe_init_type_code() already decodes the subsystem device ID into
> wx->ncsi_enabled and wx->wol_hw_supported. Do the same in
> txgbe_init_type_code() and let both call sites test the cached flags, so
> that each driver decides the capability once while probing instead of
> having shared code re-derive it from raw IDs.
>
> This is not equivalent for ngbe, and that is intentional.
> wx->ncsi_enabled has never been read since it was added by commit
> 02338c484ab6 ("net: ngbe: Initialize sw info and register netdev"), and
> it is wider than the inline test:
>
> wx->ncsi_enabled = (ncsi_mask == WX_NCSI_SUP ||
> type_mask == NGBE_SUBID_OCP_CARD) ? 1 : 0;
>
> OCP mezzanine cards are NCSI capable by design, so the NCSI semantics do
> apply to them, and they need the MAC receiver to keep running for
> out-of-band management. The inline test does not cover the OCP card
> type, so on such a card that does not have the NCSI bit set the receiver
> was turned off on every path reaching wx_disable_rx(), i.e.
> ngbe_disable_device() on ifdown, wx_stop_adapter() from ngbe_reset_hw()
> and wx_configure_rx(), and management traffic was dropped. Reading
> ncsi_enabled keeps the receiver enabled on these cards.
>
> No Fixes: tag is added on purpose. The broken behaviour goes back to the
> initial ngbe support in v6.2, and wx_disable_rx() has since been moved
> into libwx and reworked several times, so this does not cherry-pick into
> stable kernels in any useful form.
>
> For txgbe both flags are newly initialized, but wol_hw_supported is only
> consumed by txgbe_disable_device() there - txgbe does not implement the
> WoL ethtool ops - so txgbe behaviour is unchanged.
>
> Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com>
This patch should be deferred.
Another conflicting fix needs to be committed first.
> ---
> v3:
> - Rewritting commit message.
>
> v2: https://lore.kernel.org/all/F76F75E3FFF42A39+20260908025416.42250-1-jiawenwu@trustnetic.com
> - Remove single-use locals.
> - Describe the behavior change on ngbe OCP cards.
>
> v1: https://lore.kernel.org/all/95D34449BA183C54+20260901070238.78509-1-jiawenwu@trustnetic.com
> ---
> drivers/net/ethernet/wangxun/libwx/wx_hw.c | 3 +--
> drivers/net/ethernet/wangxun/txgbe/txgbe_main.c | 6 ++++--
> 2 files changed, 5 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/ethernet/wangxun/libwx/wx_hw.c b/drivers/net/ethernet/wangxun/libwx/wx_hw.c
> index 111aadf79208..2490c4dd548f 100644
> --- a/drivers/net/ethernet/wangxun/libwx/wx_hw.c
> +++ b/drivers/net/ethernet/wangxun/libwx/wx_hw.c
> @@ -1313,8 +1313,7 @@ void wx_disable_rx(struct wx *wx)
> rxctrl &= ~WX_RDB_PB_CTL_RXEN;
> wr32(wx, WX_RDB_PB_CTL, rxctrl);
>
> - if (!(((wx->subsystem_device_id & WX_NCSI_MASK) == WX_NCSI_SUP) ||
> - ((wx->subsystem_device_id & WX_WOL_MASK) == WX_WOL_SUP))) {
> + if (!(wx->ncsi_enabled || wx->wol_hw_supported)) {
> /* disable mac receiver */
> wr32m(wx, WX_MAC_RX_CFG,
> WX_MAC_RX_CFG_RE, 0);
> diff --git a/drivers/net/ethernet/wangxun/txgbe/txgbe_main.c b/drivers/net/ethernet/wangxun/txgbe/txgbe_main.c
> index eb91c4f28ecd..0ecbd1c0e553 100644
> --- a/drivers/net/ethernet/wangxun/txgbe/txgbe_main.c
> +++ b/drivers/net/ethernet/wangxun/txgbe/txgbe_main.c
> @@ -267,8 +267,7 @@ static void txgbe_disable_device(struct wx *wx)
> wx_set_all_vfs(wx);
> }
>
> - if (!(((wx->subsystem_device_id & WX_NCSI_MASK) == WX_NCSI_SUP) ||
> - ((wx->subsystem_device_id & WX_WOL_MASK) == WX_WOL_SUP))) {
> + if (!(wx->ncsi_enabled || wx->wol_hw_supported)) {
> /* disable mac transmiter */
> wr32m(wx, WX_MAC_TX_CFG, WX_MAC_TX_CFG_TE, 0);
> }
> @@ -381,6 +380,9 @@ static void txgbe_init_type_code(struct wx *wx)
> wx->media_type = wx_media_unknown;
> break;
> }
> +
> + wx->wol_hw_supported = ((wx->subsystem_device_id & WX_WOL_MASK) == WX_WOL_SUP);
> + wx->ncsi_enabled = ((wx->subsystem_device_id & WX_NCSI_MASK) == WX_NCSI_SUP);
> }
>
> /**
> --
> 2.51.0
>
next prev parent reply other threads:[~2026-09-16 9:50 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-16 6:33 [PATCH net-next v3] net: wangxun: use cached NCSI and WOL capability flags Jiawen Wu
2026-09-16 9:48 ` Jiawen Wu [this message]
2026-09-20 6:47 ` netdev-bot+sashiko
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='02bc01dd45c0$8f532090$adf961b0$@trustnetic.com' \
--to=jiawenwu@trustnetic.com \
--cc=aleksandr.loktionov@intel.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=jacob.e.keller@intel.com \
--cc=kees@kernel.org \
--cc=kuba@kernel.org \
--cc=mengyuanlou@net-swift.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=u.kleine-koenig@baylibre.com \
--cc=weirongguang@kylinos.cn \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.