From: Jakub Kicinski <kuba@kernel.org>
To: Kevin Hao <haokexin@gmail.com>
Cc: netdev@vger.kernel.org, stable@vger.kernel.org,
Siddharth Vadapalli <s-vadapalli@ti.com>,
Roger Quadros <rogerq@kernel.org>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Paolo Abeni <pabeni@redhat.com>,
Vladimir Oltean <vladimir.oltean@nxp.com>,
Kuniyuki Iwashima <kuniyu@google.com>,
linux-omap@vger.kernel.org
Subject: Re: [PATCH net v4] net: cpsw_new: Execute ndo_set_rx_mode callback in a work queue
Date: Sat, 31 Jan 2026 12:41:20 -0800 [thread overview]
Message-ID: <20260131124120.744bd931@kernel.org> (raw)
In-Reply-To: <20260130-bbb-v4-1-2bd000a15c34@gmail.com>
On Fri, 30 Jan 2026 13:34:07 +0800 Kevin Hao wrote:
> --- a/drivers/net/ethernet/ti/cpsw_new.c
> +++ b/drivers/net/ethernet/ti/cpsw_new.c
What's your plan for fixing drivers/net/ethernet/ti/cpsw.c ?
My preference would be to post both of the fixes at once,
I think this version is quite close, just a couple of nit picks
below..
> @@ -248,15 +248,25 @@ static int cpsw_purge_all_mc(struct net_device *ndev, const u8 *addr, int num)
> return 0;
> }
>
> -static void cpsw_ndo_set_rx_mode(struct net_device *ndev)
> +static void cpsw_ndo_set_rx_mode_work(struct work_struct *work)
> {
> - struct cpsw_priv *priv = netdev_priv(ndev);
> + struct cpsw_priv *priv = container_of(work, struct cpsw_priv, rx_mode_work);
> struct cpsw_common *cpsw = priv->cpsw;
> + struct net_device *ndev = priv->ndev;
>
> + rtnl_lock();
> + if (!netif_running(ndev)) {
> + rtnl_unlock();
> + return;
since the "undo" logic is getting complex you should use a goto.
Replace the unlock and the return; here with:
goto unlock_rtnl;
> + }
> +
> + netif_addr_lock_bh(ndev);
> if (ndev->flags & IFF_PROMISC) {
> /* Enable promiscuous mode */
> cpsw_set_promiscious(ndev, true);
> cpsw_ale_set_allmulti(cpsw->ale, IFF_ALLMULTI, priv->emac_port);
> + netif_addr_unlock_bh(ndev);
> + rtnl_unlock();
goto unlock_addr;
> return;
> }
>
> @@ -270,6 +280,15 @@ static void cpsw_ndo_set_rx_mode(struct net_device *ndev)
> /* add/remove mcast address either for real netdev or for vlan */
> __hw_addr_ref_sync_dev(&ndev->mc, ndev, cpsw_add_mc_addr,
> cpsw_del_mc_addr);
And place a labels here:
unlock_addr:
> + netif_addr_unlock_bh(ndev);
unlock_rtnl:
> + rtnl_unlock();
> +}
> for (i = 0; i < cpsw->data.slaves; i++) {
> - if (!cpsw->slaves[i].ndev)
> + ndev = cpsw->slaves[i].ndev;
> + if (!ndev)
> continue;
>
> - unregister_netdev(cpsw->slaves[i].ndev);
> + priv = netdev_priv(ndev);
> + disable_work_sync(&priv->rx_mode_work);
> + unregister_netdev(ndev);
I understand that this is safe but I think that more logical ordering
would be to shut things down _after_ object is unregistered.
--
pw-bot: cr
next prev parent reply other threads:[~2026-01-31 20:41 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-30 5:34 [PATCH net v4] net: cpsw_new: Execute ndo_set_rx_mode callback in a work queue Kevin Hao
2026-01-31 20:41 ` Jakub Kicinski [this message]
2026-02-01 1:15 ` Kevin Hao
2026-02-03 0:19 ` Jakub Kicinski
2026-02-03 1:18 ` Kevin Hao
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=20260131124120.744bd931@kernel.org \
--to=kuba@kernel.org \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=haokexin@gmail.com \
--cc=kuniyu@google.com \
--cc=linux-omap@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=rogerq@kernel.org \
--cc=s-vadapalli@ti.com \
--cc=stable@vger.kernel.org \
--cc=vladimir.oltean@nxp.com \
/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.