aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/mediatek/patches-4.9/0094-net-affinity.patch
blob: 8e51bdd6237f9e750929b3aec29421cc83d1cb9c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
Index: linux-4.9.17/drivers/net/ethernet/mediatek/mtk_eth_soc.c
===================================================================
--- linux-4.9.17.orig/drivers/net/ethernet/mediatek/mtk_eth_soc.c
+++ linux-4.9.17/drivers/net/ethernet/mediatek/mtk_eth_soc.c
@@ -2459,15 +2459,23 @@ static int mtk_probe(struct platform_dev
 			goto err_deinit_hw;
 	}
 
+	for (i = 0; i < 3; i++) {
+		int cpu = i % num_online_cpus();
+
+		cpumask_set_cpu(cpu, &eth->affinity_mask[i]);
+	}
+
 	err = devm_request_irq(eth->dev, eth->irq[1], mtk_handle_irq_tx, 0,
 			       dev_name(eth->dev), eth);
 	if (err)
 		goto err_free_dev;
+	irq_set_affinity_hint(eth->irq[1], &eth->affinity_mask[1]);
 
 	err = devm_request_irq(eth->dev, eth->irq[2], mtk_handle_irq_rx, 0,
 			       dev_name(eth->dev), eth);
 	if (err)
 		goto err_free_dev;
+	irq_set_affinity_hint(eth->irq[2], &eth->affinity_mask[2]);
 
 	err = mtk_mdio_init(eth);
 	if (err)
Index: linux-4.9.17/drivers/net/ethernet/mediatek/mtk_eth_soc.h
===================================================================
--- linux-4.9.17.orig/drivers/net/ethernet/mediatek/mtk_eth_soc.h
+++ linux-4.9.17/drivers/net/ethernet/mediatek/mtk_eth_soc.h
@@ -539,6 +539,7 @@ struct mtk_eth {
 	struct net_device		*netdev[MTK_MAX_DEVS];
 	struct mtk_mac			*mac[MTK_MAX_DEVS];
 	int				irq[3];
+	cpumask_t			affinity_mask[3];
 	u32				msg_enable;
 	unsigned long			sysclk;
 	struct regmap			*ethsys;