Revert "mvebu: remove linux 4.4 support"
[openwrt/openwrt.git] / target / linux / mvebu / patches-4.4 / 037-net-mvneta-Fix-for_each_present_cpu-usage.patch
1 From: Gregory CLEMENT <gregory.clement@free-electrons.com>
2 Date: Thu, 4 Feb 2016 22:09:23 +0100
3 Subject: [PATCH] net: mvneta: Fix for_each_present_cpu usage
4
5 This patch convert the for_each_present in on_each_cpu, instead of
6 applying on the present cpus it will be applied only on the online cpus.
7 This fix a bug reported on
8 http://thread.gmane.org/gmane.linux.ports.arm.kernel/468173.
9
10 Using the macro on_each_cpu (instead of a for_each_* loop) also ensures
11 that all the calls will be done all at once.
12
13 Fixes: f86428854480 ("net: mvneta: Statically assign queues to CPUs")
14 Reported-by: Stefan Roese <stefan.roese@gmail.com>
15 Suggested-by: Jisheng Zhang <jszhang@marvell.com>
16 Suggested-by: Russell King <rmk+kernel@arm.linux.org.uk>
17 Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
18 Signed-off-by: David S. Miller <davem@davemloft.net>
19 ---
20
21 --- a/drivers/net/ethernet/marvell/mvneta.c
22 +++ b/drivers/net/ethernet/marvell/mvneta.c
23 @@ -2562,7 +2562,7 @@ static void mvneta_start_dev(struct mvne
24 mvneta_port_enable(pp);
25
26 /* Enable polling on the port */
27 - for_each_present_cpu(cpu) {
28 + for_each_online_cpu(cpu) {
29 struct mvneta_pcpu_port *port = per_cpu_ptr(pp->ports, cpu);
30
31 napi_enable(&port->napi);
32 @@ -2587,7 +2587,7 @@ static void mvneta_stop_dev(struct mvnet
33
34 phy_stop(pp->phy_dev);
35
36 - for_each_present_cpu(cpu) {
37 + for_each_online_cpu(cpu) {
38 struct mvneta_pcpu_port *port = per_cpu_ptr(pp->ports, cpu);
39
40 napi_disable(&port->napi);
41 @@ -3055,13 +3055,11 @@ err_cleanup_rxqs:
42 static int mvneta_stop(struct net_device *dev)
43 {
44 struct mvneta_port *pp = netdev_priv(dev);
45 - int cpu;
46
47 mvneta_stop_dev(pp);
48 mvneta_mdio_remove(pp);
49 unregister_cpu_notifier(&pp->cpu_notifier);
50 - for_each_present_cpu(cpu)
51 - smp_call_function_single(cpu, mvneta_percpu_disable, pp, true);
52 + on_each_cpu(mvneta_percpu_disable, pp, true);
53 free_percpu_irq(dev->irq, pp->ports);
54 mvneta_cleanup_rxqs(pp);
55 mvneta_cleanup_txqs(pp);