Netdev List
 help / color / mirror / Atom feed
* [PATCH net-next] net: wangxun: refactor NCSI and WOL capability checks
@ 2026-08-17  6:59 Jiawen Wu
  2026-08-17 15:39 ` Jakub Kicinski
  0 siblings, 1 reply; 2+ messages in thread
From: Jiawen Wu @ 2026-08-17  6:59 UTC (permalink / raw)
  To: netdev
  Cc: Mengyuan Lou, Andrew Lunn, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Jacob Keller, Kees Cook,
	Aleksandr Loktionov, Uwe Kleine-König (The Capable Hub),
	Jiawen Wu

There is a clean refactoring that replaces inline bitwise checks with
precomputed boolean fields. The hardware capability of NCSI and WOL is
obtained from the sub-system ID and do not change.

Signed-off-by: Jiawen Wu <jiawenwu@trustnetic.com>
---
 drivers/net/ethernet/wangxun/libwx/wx_hw.c      | 3 +--
 drivers/net/ethernet/wangxun/txgbe/txgbe_main.c | 8 ++++++--
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/wangxun/libwx/wx_hw.c b/drivers/net/ethernet/wangxun/libwx/wx_hw.c
index 122c4952d203..f0046dcb5496 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..8c508aa3ce62 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);
 	}
@@ -336,6 +335,8 @@ static void txgbe_down_suspend(struct wx *wx)
  **/
 static void txgbe_init_type_code(struct wx *wx)
 {
+	u16 ncsi_mask = wx->subsystem_device_id & WX_NCSI_MASK;
+	u16 wol_mask = wx->subsystem_device_id & WX_WOL_MASK;
 	u8 device_type = wx->subsystem_device_id & 0xF0;
 
 	switch (wx->device_id) {
@@ -381,6 +382,9 @@ static void txgbe_init_type_code(struct wx *wx)
 		wx->media_type = wx_media_unknown;
 		break;
 	}
+
+	wx->wol_hw_supported = ((wol_mask) == WX_WOL_SUP);
+	wx->ncsi_enabled = ((ncsi_mask) == WX_NCSI_SUP);
 }
 
 /**
-- 
2.51.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net-next] net: wangxun: refactor NCSI and WOL capability checks
  2026-08-17  6:59 [PATCH net-next] net: wangxun: refactor NCSI and WOL capability checks Jiawen Wu
@ 2026-08-17 15:39 ` Jakub Kicinski
  0 siblings, 0 replies; 2+ messages in thread
From: Jakub Kicinski @ 2026-08-17 15:39 UTC (permalink / raw)
  To: Jiawen Wu
  Cc: netdev, Mengyuan Lou, Andrew Lunn, David S. Miller, Eric Dumazet,
	Paolo Abeni, Jacob Keller, Kees Cook, Aleksandr Loktionov,
	Uwe Kleine-König (The Capable Hub)

On Mon, 17 Aug 2026 14:59:02 +0800 Jiawen Wu wrote:
> Subject: [PATCH net-next] net: wangxun: refactor NCSI and WOL capability checks

## Form letter - net-next-closed

The merge window for v7.3 has started, and therefore net-next is closed
for new drivers, features, code refactoring and optimizations.
We will only consider applying net-next patches which were posted
before the announcement:

https://lore.kernel.org/20260816155953.072d73da@kernel.org

Fixes are obviously welcome at any time. net-next patches may be sent
for review and discussion only with an RFC tag.

Please repost when net-next reopens.

See: https://www.kernel.org/doc/html/next/process/maintainer-netdev.html#development-cycle
-- 
pw-bot: defer
pv-bot: closed


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-08-17 15:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-17  6:59 [PATCH net-next] net: wangxun: refactor NCSI and WOL capability checks Jiawen Wu
2026-08-17 15:39 ` Jakub Kicinski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox