FAILED: patch "[PATCH] net: txgbe: fix RTNL assertion warning when remove module" failed to apply to 6.12-stable tree
Subsystems (3)
[email protected]
maintainerThe patch below does not apply to the 6.12-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.12.y
git checkout FETCH_HEAD
git cherry-pick -x e159f05e12cc1111a3103b99375ddf0dfd0e7d63
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026050104-careless-extended-8765@gregkh' --subject-prefix 'PATCH 6.12.y' HEAD^..
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From e159f05e12cc1111a3103b99375ddf0dfd0e7d63 Mon Sep 17 00:00:00 2001
From: Jiawen Wu <[email protected]>
Date: Tue, 7 Apr 2026 17:40:41 +0800
Subject: [PATCH] net: txgbe: fix RTNL assertion warning when remove module
For the copper NIC with external PHY, the driver called phylink_connect_phy() during probe and phylink_disconnect_phy() during remove. It caused an RTNL assertion warning in phylink_disconnect_phy() upon module remove.
To fix this, add rtnl_lock() and rtnl_unlock() around the phylink_disconnect_phy() in remove function.
------------[ cut here ]------------ RTNL: assertion failed at drivers/net/phy/phylink.c (2351) WARNING: drivers/net/phy/phylink.c:2351 at phylink_disconnect_phy+0xd8/0xf0 [phylink], CPU#0: rmmod/4464 Modules linked in: ... CPU: 0 UID: 0 PID: 4464 Comm: rmmod Kdump: loaded Not tainted 7.0.0-rc4+ Hardware name: Micro-Star International Co., Ltd. MS-7E16/X670E GAMING PLUS WIFI (MS-7E16), BIOS 1.90 12/31/2024 RIP: 0010:phylink_disconnect_phy+0xe4/0xf0 [phylink] Code: 5b 41 5c 41 5d 41 5e 41 5f 5d 31 c0 31 d2 31 f6 31 ff e9 3a 38 8f e7
48 8d 3d 48 87 e2 ff ba 2f 09 00 00 48 c7 c6 c1 22 24 c0 <67> 48 0f b9 3a e9 34 ff ff ff 66 90 90 90 90 90 90 90 90 90 90 90
RSP: 0018:ffffce7288363ac0 EFLAGS: 00010246
RAX: 0000000000000000 RBX: ffff89654b2a1a00 RCX: 0000000000000000
RDX: 000000000000092f RSI: ffffffffc02422c1 RDI: ffffffffc0239020
RBP: ffffce7288363ae8 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000000 R12: ffff8964c4022000
R13: ffff89654fce3028 R14: ffff89654ebb4000 R15: ffffffffc0226348
FS: 0000795e80d93780(0000) GS:ffff896c52857000(0000)
knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00005b528b592000 CR3: 0000000170d0f000 CR4: 0000000000f50ef0
PKRU: 55555554
Call Trace: <TASK> txgbe_remove_phy+0xbb/0xd0 [txgbe] txgbe_remove+0x4c/0xb0 [txgbe] pci_device_remove+0x41/0xb0 device_remove+0x43/0x80 device_release_driver_internal+0x206/0x270 driver_detach+0x4a/0xa0 bus_remove_driver+0x83/0x120 driver_unregister+0x2f/0x60 pci_unregister_driver+0x40/0x90 txgbe_driver_exit+0x10/0x850 [txgbe] __do_sys_delete_module.isra.0+0x1c3/0x2f0 __x64_sys_delete_module+0x12/0x20 x64_sys_call+0x20c3/0x2390 do_syscall_64+0x11c/0x1500 ? srso_alias_return_thunk+0x5/0xfbef5 ? do_syscall_64+0x15a/0x1500 ? srso_alias_return_thunk+0x5/0xfbef5 ? do_fault+0x312/0x580 ? srso_alias_return_thunk+0x5/0xfbef5 ? __handle_mm_fault+0x9d5/0x1040 ? srso_alias_return_thunk+0x5/0xfbef5 ? count_memcg_events+0x101/0x1d0 ? srso_alias_return_thunk+0x5/0xfbef5 ? handle_mm_fault+0x1e8/0x2f0 ? srso_alias_return_thunk+0x5/0xfbef5 ? do_user_addr_fault+0x2f8/0x820 ? srso_alias_return_thunk+0x5/0xfbef5 ? irqentry_exit+0xb2/0x600 ? srso_alias_return_thunk+0x5/0xfbef5 ? exc_page_fault+0x92/0x1c0 entry_SYSCALL_64_after_hwframe+0x76/0x7e
drivers/net/ethernet/wangxun/txgbe/txgbe_phy.c +2 -0
@@ -657,7 +657,9 @@ void txgbe_remove_phy(struct txgbe *txgbe)return ;case wx_mac_sp:if (txgbe->wx->media_type == wx_media_copper) { +rtnl_lock ();phylink_disconnect_phy (txgbe->wx->phylink); +rtnl_unlock ();phylink_destroy (txgbe->wx->phylink);return ; }
Sasha Levin
maintainerPATCH 1/3 net: wangxun: Add support for PTP clock
From: Jiawen Wu <[email protected]>
[ Upstream commit 06e75161b9d4833518a7c266310a0635eab50616 ]
Implement support for PTP clock on Wangxun NICs.
Stable-dep-of: e159f05e12cc ("net: txgbe: fix RTNL assertion warning when remove module")
--- drivers/net/ethernet/wangxun/Kconfig | 1 + drivers/net/ethernet/wangxun/libwx/Makefile | 2 +- .../net/ethernet/wangxun/libwx/wx_ethtool.c | 3 + drivers/net/ethernet/wangxun/libwx/wx_lib.c | 52 +- drivers/net/ethernet/wangxun/libwx/wx_ptp.c | 603 ++++++++++++++++++ drivers/net/ethernet/wangxun/libwx/wx_ptp.h | 19 + drivers/net/ethernet/wangxun/libwx/wx_type.h | 68 ++ drivers/net/ethernet/wangxun/ngbe/ngbe_main.c | 8 + drivers/net/ethernet/wangxun/ngbe/ngbe_mdio.c | 10 + .../net/ethernet/wangxun/txgbe/txgbe_main.c | 11 + .../net/ethernet/wangxun/txgbe/txgbe_phy.c | 9 + 11 files changed, 780 insertions(+), 6 deletions(-) create mode 100644 drivers/net/ethernet/wangxun/libwx/wx_ptp.c create mode 100644 drivers/net/ethernet/wangxun/libwx/wx_ptp.h
drivers/net/ethernet/wangxun/Kconfig +1 -0
@@ -18,6 +18,7 @@ if NET_VENDOR_WANGXUN config LIBWX tristate + depends on PTP_1588_CLOCK_OPTIONAL select PAGE_POOL help Common library for Wangxun(R) Ethernet drivers.
drivers/net/ethernet/wangxun/libwx/Makefile +1 -1
@@ -4,4 +4,4 @@ obj-$(CONFIG_LIBWX) += libwx.o -libwx-objs := wx_hw.o wx_lib.o wx_ethtool.o +libwx-objs := wx_hw.o wx_lib.o wx_ethtool.o wx_ptp.o
drivers/net/ethernet/wangxun/libwx/wx_ethtool.c +3 -0
@@ -41,6 +41,9 @@ static const struct wx_stats wx_gstrings_stats[] = {WX_STAT ("rx_csum_offload_good_count" , hw_csum_rx_good),WX_STAT ("rx_csum_offload_errors" , hw_csum_rx_error),WX_STAT ("alloc_rx_buff_failed" , alloc_rx_buff_failed), +WX_STAT ("tx_hwtstamp_timeouts" , tx_hwtstamp_timeouts), +WX_STAT ("tx_hwtstamp_skipped" , tx_hwtstamp_skipped), + WX_STAT("rx_hwtstamp_cleared", rx_hwtstamp_cleared), }; static const struct wx_stats wx_gstrings_fdir_stats[] = {
drivers/net/ethernet/wangxun/libwx/wx_lib.c +47 -5
119 lines not on this page · raw message
drivers/net/ethernet/wangxun/libwx/wx_ptp.c new file +603 -0
603 lines not on this page · raw message
drivers/net/ethernet/wangxun/libwx/wx_ptp.h new file +19 -0
@@ -0,0 +1,19 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* Copyright (c) 2019 - 2025 Beijing WangXun Technology Co., Ltd. */ + +#ifndef _WX_PTP_H_ +#define _WX_PTP_H_ + +void wx_ptp_reset_cyclecounter (struct wx *wx); +void wx_ptp_reset (struct wx *wx); +void wx_ptp_init (struct wx *wx); +void wx_ptp_suspend (struct wx *wx); +void wx_ptp_stop (struct wx *wx); +void wx_ptp_rx_hwtstamp (struct wx *wx,struct sk_buff *skb); +int wx_hwtstamp_get (struct net_device *dev, +struct kernel_hwtstamp_config *cfg); +int wx_hwtstamp_set (struct net_device *dev, +struct kernel_hwtstamp_config *cfg, +struct netlink_ext_ack *extack); + +#endif /* _WX_PTP_H_ */
drivers/net/ethernet/wangxun/libwx/wx_type.h +68 -0
128 lines not on this page · raw message
drivers/net/ethernet/wangxun/ngbe/ngbe_main.c +8 -0
@@ -14,6 +14,7 @@#include "../libwx/wx_type.h" #include "../libwx/wx_hw.h" #include "../libwx/wx_lib.h" +#include "../libwx/wx_ptp.h" #include "ngbe_type.h" #include "ngbe_mdio.h" #include "ngbe_hw.h"
@@ -317,6 +318,8 @@ void ngbe_down(struct wx *wx) {phylink_stop (wx->phylink);ngbe_disable_device (wx); +if (test_bit (WX_STATE_PTP_RUNNING , wx->state)) +wx_ptp_reset (wx);wx_clean_all_tx_rings (wx);wx_clean_all_rx_rings (wx); }
@@ -379,6 +382,8 @@ static int ngbe_open(struct net_device *netdev)if (err) goto err_dis_phy; +wx_ptp_init (wx); +ngbe_up (wx);return 0 ;
@@ -407,6 +412,7 @@ static int ngbe_close(struct net_device *netdev) {struct wx *wx =netdev_priv (netdev); +wx_ptp_stop (wx);ngbe_down (wx);wx_free_irq (wx);wx_free_isb_resources (wx);
@@ -507,6 +513,8 @@ static const struct net_device_ops ngbe_netdev_ops = { .ndo_get_stats64 = wx_get_stats64, .ndo_vlan_rx_add_vid = wx_vlan_rx_add_vid, .ndo_vlan_rx_kill_vid = wx_vlan_rx_kill_vid, + .ndo_hwtstamp_set = wx_hwtstamp_set, + .ndo_hwtstamp_get = wx_hwtstamp_get, };/**
drivers/net/ethernet/wangxun/ngbe/ngbe_mdio.c +10 -0
@@ -7,6 +7,7 @@#include <linux/phy.h> #include "../libwx/wx_type.h" +#include "../libwx/wx_ptp.h" #include "../libwx/wx_hw.h" #include "ngbe_type.h" #include "ngbe_mdio.h"
@@ -64,6 +65,11 @@ static void ngbe_mac_config(struct phylink_config *config, unsigned int mode,static void ngbe_mac_link_down (struct phylink_config *config,unsigned int mode,phy_interface_t interface) { +struct wx *wx =phylink_to_wx (config); + + wx->speed =SPEED_UNKNOWN ; +if (test_bit (WX_STATE_PTP_RUNNING , wx->state)) +wx_ptp_reset_cyclecounter (wx); } static void ngbe_mac_link_up(struct phylink_config *config,
@@ -103,6 +109,10 @@ static void ngbe_mac_link_up(struct phylink_config *config,wr32 (wx,WX_MAC_PKT_FLT ,WX_MAC_PKT_FLT_PR ); reg =rd32 (wx,WX_MAC_WDG_TIMEOUT );wr32 (wx,WX_MAC_WDG_TIMEOUT , reg); + + wx->speed = speed; +if (test_bit (WX_STATE_PTP_RUNNING , wx->state)) +wx_ptp_reset_cyclecounter (wx); }static const struct phylink_mac_ops ngbe_mac_ops = {
drivers/net/ethernet/wangxun/txgbe/txgbe_main.c +11 -0
@@ -13,6 +13,7 @@#include "../libwx/wx_type.h" #include "../libwx/wx_lib.h" +#include "../libwx/wx_ptp.h" #include "../libwx/wx_hw.h" #include "txgbe_type.h" #include "txgbe_hw.h"
@@ -116,6 +117,9 @@ static void txgbe_reset(struct wx *wx)memcpy (old_addr, &wx->mac_table[0 ].addr, netdev->addr_len);wx_flush_sw_mac_table (wx);wx_mac_set_default_filter (wx, old_addr); + +if (test_bit (WX_STATE_PTP_RUNNING , wx->state)) +wx_ptp_reset (wx); }static void txgbe_disable_device (struct wx *wx)
@@ -176,6 +180,7 @@ void txgbe_down(struct wx *wx)void txgbe_up (struct wx *wx) {wx_configure (wx); +wx_ptp_init (wx);txgbe_up_complete (wx); }
@@ -325,6 +330,8 @@ static int txgbe_open(struct net_device *netdev)if (err) goto err_free_irq; +wx_ptp_init (wx); +txgbe_up_complete (wx);return 0 ;
@@ -351,6 +358,7 @@ static int txgbe_open(struct net_device *netdev)*/ static void txgbe_close_suspend (struct wx *wx) { +wx_ptp_suspend (wx);txgbe_disable_device (wx);wx_free_resources (wx); }
@@ -370,6 +378,7 @@ static int txgbe_close(struct net_device *netdev) {struct wx *wx =netdev_priv (netdev); +wx_ptp_stop (wx);txgbe_down (wx);wx_free_irq (wx);txgbe_free_misc_irq (wx->priv);
@@ -484,6 +493,8 @@ static const struct net_device_ops txgbe_netdev_ops = { .ndo_get_stats64 = wx_get_stats64, .ndo_vlan_rx_add_vid = wx_vlan_rx_add_vid, .ndo_vlan_rx_kill_vid = wx_vlan_rx_kill_vid, + .ndo_hwtstamp_set = wx_hwtstamp_set, + .ndo_hwtstamp_get = wx_hwtstamp_get, };/**
drivers/net/ethernet/wangxun/txgbe/txgbe_phy.c +9 -0
@@ -15,6 +15,7 @@#include "../libwx/wx_type.h" #include "../libwx/wx_lib.h" +#include "../libwx/wx_ptp.h" #include "../libwx/wx_hw.h" #include "txgbe_type.h" #include "txgbe_phy.h"
@@ -179,6 +180,10 @@ 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 ); + + wx->speed =SPEED_UNKNOWN ; +if (test_bit (WX_STATE_PTP_RUNNING , wx->state)) +wx_ptp_reset_cyclecounter (wx); } static void txgbe_mac_link_up(struct phylink_config *config,
@@ -215,6 +220,10 @@ static void txgbe_mac_link_up(struct phylink_config *config,wr32 (wx,WX_MAC_PKT_FLT ,WX_MAC_PKT_FLT_PR ); wdg =rd32 (wx,WX_MAC_WDG_TIMEOUT );wr32 (wx,WX_MAC_WDG_TIMEOUT , wdg); + + wx->speed = speed; +if (test_bit (WX_STATE_PTP_RUNNING , wx->state)) +wx_ptp_reset_cyclecounter (wx); } static int txgbe_mac_prepare(struct phylink_config *config, unsigned int mode,
Signature · 1 line
2.53.0
Jiawen Wu
maintainerPATCH 1/1 net: txgbe: fix RTNL assertion warning when remove module
In reply to [email protected]For the copper NIC with external PHY, the driver called phylink_connect_phy() during probe and phylink_disconnect_phy() during remove. It caused an RTNL assertion warning in phylink_disconnect_phy() upon module remove.
To fix this, add rtnl_lock() and rtnl_unlock() around the phylink_disconnect_phy() in remove function.
------------[ cut here ]------------ RTNL: assertion failed at drivers/net/phy/phylink.c (2351) WARNING: drivers/net/phy/phylink.c:2351 at phylink_disconnect_phy+0xd8/0xf0 [phylink], CPU#0: rmmod/4464 Modules linked in: ... CPU: 0 UID: 0 PID: 4464 Comm: rmmod Kdump: loaded Not tainted 7.0.0-rc4+ Hardware name: Micro-Star International Co., Ltd. MS-7E16/X670E GAMING PLUS WIFI (MS-7E16), BIOS 1.90 12/31/2024 RIP: 0010:phylink_disconnect_phy+0xe4/0xf0 [phylink] Code: 5b 41 5c 41 5d 41 5e 41 5f 5d 31 c0 31 d2 31 f6 31 ff e9 3a 38 8f e7
48 8d 3d 48 87 e2 ff ba 2f 09 00 00 48 c7 c6 c1 22 24 c0 <67> 48 0f b9 3a e9 34 ff ff ff 66 90 90 90 90 90 90 90 90 90 90 90
RSP: 0018:ffffce7288363ac0 EFLAGS: 00010246
RAX: 0000000000000000 RBX: ffff89654b2a1a00 RCX: 0000000000000000
RDX: 000000000000092f RSI: ffffffffc02422c1 RDI: ffffffffc0239020
RBP: ffffce7288363ae8 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000000 R12: ffff8964c4022000
R13: ffff89654fce3028 R14: ffff89654ebb4000 R15: ffffffffc0226348
FS: 0000795e80d93780(0000) GS:ffff896c52857000(0000)
knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00005b528b592000 CR3: 0000000170d0f000 CR4: 0000000000f50ef0
PKRU: 55555554
Call Trace: <TASK> txgbe_remove_phy+0xbb/0xd0 [txgbe] txgbe_remove+0x4c/0xb0 [txgbe] pci_device_remove+0x41/0xb0 device_remove+0x43/0x80 device_release_driver_internal+0x206/0x270 driver_detach+0x4a/0xa0 bus_remove_driver+0x83/0x120 driver_unregister+0x2f/0x60 pci_unregister_driver+0x40/0x90 txgbe_driver_exit+0x10/0x850 [txgbe] __do_sys_delete_module.isra.0+0x1c3/0x2f0 __x64_sys_delete_module+0x12/0x20 x64_sys_call+0x20c3/0x2390 do_syscall_64+0x11c/0x1500 ? srso_alias_return_thunk+0x5/0xfbef5 ? do_syscall_64+0x15a/0x1500 ? srso_alias_return_thunk+0x5/0xfbef5 ? do_fault+0x312/0x580 ? srso_alias_return_thunk+0x5/0xfbef5 ? __handle_mm_fault+0x9d5/0x1040 ? srso_alias_return_thunk+0x5/0xfbef5 ? count_memcg_events+0x101/0x1d0 ? srso_alias_return_thunk+0x5/0xfbef5 ? handle_mm_fault+0x1e8/0x2f0 ? srso_alias_return_thunk+0x5/0xfbef5 ? do_user_addr_fault+0x2f8/0x820 ? srso_alias_return_thunk+0x5/0xfbef5 ? irqentry_exit+0xb2/0x600 ? srso_alias_return_thunk+0x5/0xfbef5 ? exc_page_fault+0x92/0x1c0 entry_SYSCALL_64_after_hwframe+0x76/0x7e
--- drivers/net/ethernet/wangxun/txgbe/txgbe_phy.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/ethernet/wangxun/txgbe/txgbe_phy.c +2 -0
@@ -622,7 +622,9 @@ int txgbe_init_phy(struct txgbe *txgbe)void txgbe_remove_phy (struct txgbe *txgbe) {if (txgbe->wx->media_type == sp_media_copper) { +rtnl_lock ();phylink_disconnect_phy (txgbe->wx->phylink); +rtnl_unlock ();phylink_destroy (txgbe->wx->phylink);return ; }
Signature · 1 line
2.51.0
Re: [PATCH 6.12.y] net: txgbe: fix RTNL assertion warning when remove module
Quoted 1 line
[PATCH 6.12.y] net: txgbe: fix RTNL assertion warning when remove module
Queued for 6.12.y, thanks.
--
Sasha