RE: [Intel-wired-lan] [PATCH net-next v9 5/7] 8139cp: Implement ndo_set_rx_mode_async callback
From: Loktionov, Aleksandr <hidden>
Date: 2026-03-16 07:34:26
Also in:
intel-wired-lan, lkml, virtualization
quoted hunk ↗ jump to hunk
-----Original Message----- From: Intel-wired-lan <redacted> On Behalf Of I Viswanath Sent: Saturday, March 14, 2026 7:28 PM To: stfomichev@gmail.com; horms@kernel.org; edumazet@google.com; pabeni@redhat.com; andrew+netdev@lunn.ch; kuba@kernel.org; davem@davemloft.net; eperezma@redhat.com; xuanzhuo@linux.alibaba.com; jasowang@redhat.com; mst@redhat.com; Kitszel, Przemyslaw [off-list ref]; Nguyen, Anthony L [off-list ref]; Keller, Jacob E [off-list ref]; ronak.doshi@broadcom.com; pcnet32@frontier.com Cc: bcm-kernel-feedback-list@broadcom.com; netdev@vger.kernel.org; virtualization@lists.linux.dev; intel-wired-lan@lists.osuosl.org; linux-kernel@vger.kernel.org; I Viswanath [off-list ref] Subject: [Intel-wired-lan] [PATCH net-next v9 5/7] 8139cp: Implement ndo_set_rx_mode_async callback Implement the ndo_set_rx_mode_async callback and update the driver to use the snapshot/commit model for RX mode update. Signed-off-by: I Viswanath <redacted> --- Call paths involving netif_set_rx_mode in 8139cp netif_set_rx_mode |-- cp_init_hw | |-- cp_open (ndo_open, takes lock) | | `-- cp_change_mtu (ndo_change_mtu, takes lock) | | | `-- cp_resume (lock added) | `-- cp_tx_timeout (ndo_tx_timeout, takes lock) drivers/net/ethernet/realtek/8139cp.c | 49 ++++++++++++++++++-------- - 1 file changed, 33 insertions(+), 16 deletions(-)diff --git a/drivers/net/ethernet/realtek/8139cp.cb/drivers/net/ethernet/realtek/8139cp.c index 5652da8a178c..9651a0d9d8f0 100644--- a/drivers/net/ethernet/realtek/8139cp.c +++ b/drivers/net/ethernet/realtek/8139cp.c@@ -372,7 +372,6 @@ struct cp_private { } while (0)
...
quoted hunk ↗ jump to hunk
static void __cp_get_stats(struct cp_private *cp) @@ -1040,7 +1042,7@@ static void cp_init_hw (struct cp_private *cp) cp_start_hw(cp); cpw8(TxThresh, 0x06); /* XXX convert magic num to a constant */ - __cp_set_rx_mode(dev); + netif_set_rx_mode(dev); cpw32_f (TxConfig, IFG | (TX_DMA_BURST << TxDMAShift)); cpw8(Config1, cpr8(Config1) | DriverLoaded | PMEnable); @@ -1262,7 +1264,7 @@ static void cp_tx_timeout(struct net_device *dev, unsigned int txqueue) cp_clean_rings(cp); cp_init_rings(cp); cp_start_hw(cp); - __cp_set_rx_mode(dev); + netif_set_rx_mode(dev);
I'm afraid netif_set_rx_mode() in async mode expects netdev ops lock context. Driver lock != netdev ops lock by definition. If this path does not hold the required ops lock, lockdep/WARN can trigger.
quoted hunk ↗ jump to hunk
cpw16_f(IntrMask, cp_norx_intr_mask); netif_wake_queue(dev);@@ -1870,6 +1872,7 @@ static const struct net_device_ops cp_netdev_ops= { .ndo_validate_addr = eth_validate_addr, .ndo_set_mac_address = cp_set_mac_address, .ndo_set_rx_mode = cp_set_rx_mode, + .ndo_set_rx_mode_async = cp_set_rx_mode_async, .ndo_get_stats = cp_get_stats, .ndo_eth_ioctl = cp_ioctl, .ndo_start_xmit = cp_start_xmit,@@ -2071,7 +2074,7 @@ static int __maybe_unused cp_suspend(struct
...