Skip to contentSkip to conversation

net: ti: icssg: Remove dedicated workqueue for ndo_set_rx_mode callback

PATCH Applied Kevin Hao 4 participants 5 messages Feb 5 – Feb 7

Subsystems (3)
lore
Share & tools
lore

Kevin Hao

author
#0 lore raw

PATCH v2 1/1 net: ti: icssg: Remove dedicated workqueue for ndo_set_rx_mode callback

Currently, both the icssg-prueth and icssg-prueth-sr1 drivers create a dedicated 'emac->cmd_wq' workqueue.

In the icssg-prueth-sr1 driver, this workqueue is not utilized at all.

In the icssg-prueth driver, the workqueue is only used to execute the actual processing of ndo_set_rx_mode. However, creating a dedicated workqueue for such a simple use case is unnecessary. To simplify the code, switch to using the system default workqueue instead.

---
While addressing an issue in the cpsw driver, I based my fix [1] on the implementation of the emac_ndo_set_rx_mode() function in icssg. During review, Jakub pointed out that the dedicated workqueue for the ndo_set_rx_mode callback might be unnecessary [2]. I subsequently used the system workqueue for this purpose in the cpsw driver, and it performed as expected. Therefore, I believe the same approach can be applied to the icssg driver. This patch aim to remove this dedicated workqueue for icssg drivers.

Please note: I do not have access to a board that supports the CSSG PRU Ethernet controller, so this change has only been build-tested.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git/commit/?id=c0b5dc73a38f954e780f93a549b8fe225235c07a
[2] https://lore.kernel.org/all/[email protected]/
---
Cc: MD Danish Anwar <[email protected]>
Cc: Roger Quadros <[email protected]>
Cc: Andrew Lunn <[email protected]>
Cc: "David S. Miller" <[email protected]>
Cc: Eric Dumazet <[email protected]>
Cc: Jakub Kicinski <[email protected]>
Cc: Paolo Abeni <[email protected]>
Cc: Meghana Malladi <[email protected]>
Cc: Jacob Keller <[email protected]>
Cc: Vadim Fedorenko <[email protected]>
Cc: Himanshu Mittal <[email protected]>
Cc: Simon Horman <[email protected]>
Cc: Byungchul Park <[email protected]>
Cc: Markus Elfring <[email protected]>
Cc: [email protected]
---
Changes in v2:
- Given the issue identified by the AI [3], squash these two patches into
one as suggested by Jakub.

- Include the cpsw fix link and the link to Jakub's email in the cover letter, as requested by Meghana.

- Link to v1: https://lore.kernel.org/r/[email protected]

[3] https://netdev-ai.bots.linux.dev/ai-review.html?id=02da18ab-455d-4d98-88bb-d8a975623c3f

---
 drivers/net/ethernet/ti/icssg/icssg_common.c     |  1 -
 drivers/net/ethernet/ti/icssg/icssg_prueth.c     | 13 ++++---------
 drivers/net/ethernet/ti/icssg/icssg_prueth.h     |  1 -
 drivers/net/ethernet/ti/icssg/icssg_prueth_sr1.c |  9 +--------
 4 files changed, 5 insertions(+), 19 deletions(-)
drivers/net/ethernet/ti/icssg/icssg_common.c +0 -1
index 090aa74d3ce7257ae52158b2ff9a2a1239bfcfc8..0cf9dfe0fa362b4ff986b6815952f95b79cb476d 100644
@@ -1720,7 +1720,6 @@ void prueth_netdev_exit(struct prueth *prueth,
 	netif_napi_del(&emac->napi_rx);
 
 	pruss_release_mem_region(prueth->pruss, &emac->dram);
-	destroy_workqueue(emac->cmd_wq);
 	free_netdev(emac->ndev);
 	prueth->emac[mac] = NULL;
 }
drivers/net/ethernet/ti/icssg/icssg_prueth.c +4 -9
index f65041662173c1968f7e70dc4a3d897523f24095..0939994c932f5322eebbaa1b2fe43e20d3dca5ae 100644
@@ -1099,7 +1099,7 @@ static void emac_ndo_set_rx_mode(struct net_device *ndev)
 {
 	struct prueth_emac *emac = netdev_priv(ndev);
 
-	queue_work(emac->cmd_wq, &emac->rx_mode_work);
+	schedule_work(&emac->rx_mode_work);
 }
 
 static netdev_features_t emac_ndo_fix_features(struct net_device *ndev,
@@ -1451,11 +1451,6 @@ static int prueth_netdev_init(struct prueth *prueth,
 	emac->port_id = port;
 	emac->xdp_prog = NULL;
 	emac->ndev->pcpu_stat_type = NETDEV_PCPU_STAT_TSTATS;
-	emac->cmd_wq = create_singlethread_workqueue("icssg_cmd_wq");
-	if (!emac->cmd_wq) {
-		ret = -ENOMEM;
-		goto free_ndev;
-	}
 	INIT_WORK(&emac->rx_mode_work, emac_ndo_set_rx_mode_work);
 
 	INIT_DELAYED_WORK(&emac->stats_work, icssg_stats_work_handler);
@@ -1467,7 +1462,7 @@ static int prueth_netdev_init(struct prueth *prueth,
 	if (ret) {
 		dev_err(prueth->dev, "unable to get DRAM: %d\n", ret);
 		ret = -ENOMEM;
-		goto free_wq;
+		goto free_ndev;
 	}
 
 	emac->tx_ch_num = 1;
@@ -1566,8 +1561,6 @@ static int prueth_netdev_init(struct prueth *prueth,
 
 free:
 	pruss_release_mem_region(prueth->pruss, &emac->dram);
-free_wq:
-	destroy_workqueue(emac->cmd_wq);
 free_ndev:
 	emac->ndev = NULL;
 	prueth->emac[mac] = NULL;
@@ -2236,6 +2229,7 @@ static int prueth_probe(struct platform_device *pdev)
 			prueth->emac[i]->ndev->phydev = NULL;
 		}
 		unregister_netdev(prueth->registered_netdevs[i]);
+		disable_work_sync(&prueth->emac[i]->rx_mode_work);
 	}
 
 netdev_exit:
@@ -2295,6 +2289,7 @@ static void prueth_remove(struct platform_device *pdev)
 		phy_disconnect(prueth->emac[i]->ndev->phydev);
 		prueth->emac[i]->ndev->phydev = NULL;
 		unregister_netdev(prueth->registered_netdevs[i]);
+		disable_work_sync(&prueth->emac[i]->rx_mode_work);
 	}
 
 	for (i = 0; i < PRUETH_NUM_MACS; i++) {
drivers/net/ethernet/ti/icssg/icssg_prueth.h +0 -1
index 10eadd35665045a98a0c0a639606b7c2691195de..3d94fa5a7ac10992d35fdb63458f8cb6eb3a5a22 100644
@@ -236,7 +236,6 @@ struct prueth_emac {
 	/* Mutex to serialize access to firmware command interface */
 	struct mutex cmd_lock;
 	struct work_struct rx_mode_work;
-	struct workqueue_struct	*cmd_wq;
 
 	struct pruss_mem_region dram;
 
drivers/net/ethernet/ti/icssg/icssg_prueth_sr1.c +1 -8
index 7bb4f0d850cc72d997e5ead38cf56f1dbc2355a1..b8115ca47082f9676067bb65c6eb3a441290fd7c 100644
@@ -783,11 +783,6 @@ static int prueth_netdev_init(struct prueth *prueth,
 	emac->prueth = prueth;
 	emac->ndev = ndev;
 	emac->port_id = port;
-	emac->cmd_wq = create_singlethread_workqueue("icssg_cmd_wq");
-	if (!emac->cmd_wq) {
-		ret = -ENOMEM;
-		goto free_ndev;
-	}
 
 	INIT_DELAYED_WORK(&emac->stats_work, icssg_stats_work_handler);
 
@@ -798,7 +793,7 @@ static int prueth_netdev_init(struct prueth *prueth,
 	if (ret) {
 		dev_err(prueth->dev, "unable to get DRAM: %d\n", ret);
 		ret = -ENOMEM;
-		goto free_wq;
+		goto free_ndev;
 	}
 
 	/* SR1.0 uses a dedicated high priority channel
@@ -883,8 +878,6 @@ static int prueth_netdev_init(struct prueth *prueth,
 
 free:
 	pruss_release_mem_region(prueth->pruss, &emac->dram);
-free_wq:
-	destroy_workqueue(emac->cmd_wq);
 free_ndev:
 	emac->ndev = NULL;
 	prueth->emac[mac] = NULL;

---
base-commit: 0f8a890c4524d6e4013ff225e70de2aed7e6d726
change-id: 20260203-icssg-prueth-workqueue-f460eba72132

Best regards,

Signature · 1 line
Kevin Hao <[email protected]>
#1 lore raw
Quoted 34 lines · Kevin Hao

Currently, both the icssg-prueth and icssg-prueth-sr1 drivers create a dedicated 'emac->cmd_wq' workqueue.

In the icssg-prueth-sr1 driver, this workqueue is not utilized at all.

In the icssg-prueth driver, the workqueue is only used to execute the actual processing of ndo_set_rx_mode. However, creating a dedicated workqueue for such a simple use case is unnecessary. To simplify the code, switch to using the system default workqueue instead.

---
While addressing an issue in the cpsw driver, I based my fix [1] on the implementation of the emac_ndo_set_rx_mode() function in icssg. During review, Jakub pointed out that the dedicated workqueue for the ndo_set_rx_mode callback might be unnecessary [2]. I subsequently used the system workqueue for this purpose in the cpsw driver, and it performed as expected. Therefore, I believe the same approach can be applied to the icssg driver. This patch aim to remove this dedicated workqueue for icssg drivers.

Please note: I do not have access to a board that supports the CSSG PRU Ethernet controller, so this change has only been build-tested.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git/commit/?id=c0b5dc73a38f954e780f93a549b8fe225235c07a
[2] https://lore.kernel.org/all/[email protected]/
---
Cc: MD Danish Anwar <[email protected]>
Cc: Roger Quadros <[email protected]>
Cc: Andrew Lunn <[email protected]>
Cc: "David S. Miller" <[email protected]>
Cc: Eric Dumazet <[email protected]>
Cc: Jakub Kicinski <[email protected]>
Cc: Paolo Abeni <[email protected]>
Cc: Meghana Malladi <[email protected]>

Quoted 8 lines

Cc: Jacob Keller <[email protected]>
Cc: Vadim Fedorenko <[email protected]>
Cc: Himanshu Mittal <[email protected]>
Cc: Simon Horman <[email protected]>
Cc: Byungchul Park <[email protected]>
Cc: Markus Elfring <[email protected]>
Cc: [email protected]
---

Meghana, Can you please test this patch on AM64x and verify icssg_prueth driver functionalities.

Signature · 2 lines
Thanks and Regards,
Danish
Tested-by on v2 1/1
#2 lore raw
In reply to Kevin Hao
Quoted 28 lines · Kevin Hao

Currently, both the icssg-prueth and icssg-prueth-sr1 drivers create a dedicated 'emac->cmd_wq' workqueue. In the icssg-prueth-sr1 driver, this workqueue is not utilized at all. In the icssg-prueth driver, the workqueue is only used to execute ZjQcmQRYFpfptBannerStart
This message was sent from outside of Texas Instruments.
Do not click links or open attachments unless you recognize the source of this email and know the content is safe.
Report Suspicious
<https://us-phishalarm-ewt.proofpoint.com/EWT/v1/G3vK! uxdqXRfPtm1bKqXPFrvrtjTYQ8PpETcsXm4BwzS8mboFbVY11ssua4wfTbejgHbxjjWn8Pd03T8mRUc-C2Ywijhr0alXjcHhfRE3zQch7w8HkSQ$>
ZjQcmQRYFpfptBannerEnd

Currently, both the icssg-prueth and icssg-prueth-sr1 drivers create a dedicated 'emac->cmd_wq' workqueue.

In the icssg-prueth-sr1 driver, this workqueue is not utilized at all.

In the icssg-prueth driver, the workqueue is only used to execute the actual processing of ndo_set_rx_mode. However, creating a dedicated workqueue for such a simple use case is unnecessary. To simplify the code, switch to using the system default workqueue instead.

---
While addressing an issue in the cpsw driver, I based my fix [1] on the implementation of the emac_ndo_set_rx_mode() function in icssg. During review, Jakub pointed out that the dedicated workqueue for the ndo_set_rx_mode callback might be unnecessary [2]. I subsequently used the system workqueue for this purpose in the cpsw driver, and it performed as expected. Therefore, I believe the same approach can be applied to the icssg driver. This patch aim to remove this dedicated workqueue for icssg drivers.

Quoted 2 lines

Please note: I do not have access to a board that supports the CSSG PRU Ethernet controller, so this change has only been build-tested.

Based on the changes I have multicast and promiscuous modes.
logs: https://gist.github.com/MeghanaMalladiTI/9598b33848344027772a5bf759b1bb8e

reviewer Reviewed-by on v2 1/1
#3 lore raw
In reply to Kevin Hao
Quoted 11 lines · Kevin Hao

Currently, both the icssg-prueth and icssg-prueth-sr1 drivers create a dedicated 'emac->cmd_wq' workqueue.

In the icssg-prueth-sr1 driver, this workqueue is not utilized at all.

In the icssg-prueth driver, the workqueue is only used to execute the actual processing of ndo_set_rx_mode. However, creating a dedicated workqueue for such a simple use case is unnecessary. To simplify the code, switch to using the system default workqueue instead.

Signature · 2 lines
Thanks and Regards,
Danish
#4 lore raw
In reply to Kevin Hao
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Quoted 11 lines · On Thu, 05 Feb 2026 14:25:09 +0800 you wrote:

Currently, both the icssg-prueth and icssg-prueth-sr1 drivers create a dedicated 'emac->cmd_wq' workqueue.

In the icssg-prueth-sr1 driver, this workqueue is not utilized at all.

In the icssg-prueth driver, the workqueue is only used to execute the actual processing of ndo_set_rx_mode. However, creating a dedicated workqueue for such a simple use case is unnecessary. To simplify the code, switch to using the system default workqueue instead.

[...]

Here is the summary with links:
- [net-next,v2] net: ti: icssg: Remove dedicated workqueue for ndo_set_rx_mode callback

    https://git.kernel.org/netdev/net-next/c/b6e2db0ed9b9

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html