Re: [PATCH net-next v8 3/6] net: napi: add CPU affinity to napi_config

From
Jakub Kicinski <kuba@kernel.org>
Date
2025-02-15 17:58:35
Also in
intel-wired-lan
Reply to
Ahmed Zaki, 2025-02-11
On Tue, 11 Feb 2025 14:06:54 -0700 Ahmed Zaki wrote:
quoted hunk ↗ jump to hunk
@@ -11575,9 +11615,9 @@ struct net_device *alloc_netdev_mqs(int sizeof_priv, const char *name,
 		void (*setup)(struct net_device *),
 		unsigned int txqs, unsigned int rxqs)
 {
+	unsigned int maxqs, i, numa;
 	struct net_device *dev;
 	size_t napi_config_sz;
-	unsigned int maxqs;
 
 	BUG_ON(strlen(name) >= sizeof(dev->name));
 
@@ -11679,6 +11719,11 @@ struct net_device *alloc_netdev_mqs(int sizeof_priv, const char *name,
 	if (!dev->napi_config)
 		goto free_all;
 
+	numa = dev_to_node(&dev->dev);
Does this work? dev->dev is the "software" device, IOW the netdev itself.
The HW dev is dev->dev.parent but it won't be set at this stage, we'd
need to move the init to register, or maybe netif_enable_cpu_rmap() /
netif_set_affinity_auto() ?
quoted hunk ↗ jump to hunk
+	for (i = 0; i < maxqs; i++)
+		cpumask_set_cpu(cpumask_local_spread(i, numa),
+				&dev->napi_config[i].affinity_mask);
Thread (13 messages) 13 messages, 3 authors, last reply 2025-02-15
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help