mvebu: add sysupgrade support for clearfog
[lede.git] / target / linux / mvebu / patches-4.4 / 039-net-mvneta-Use-on_each_cpu-when-possible.patch
1 From: Gregory CLEMENT <gregory.clement@free-electrons.com>
2 Date: Thu, 4 Feb 2016 22:09:25 +0100
3 Subject: [PATCH] net: mvneta: Use on_each_cpu when possible
4
5 Instead of using a for_each_* loop in which we just call the
6 smp_call_function_single macro, it is more simple to directly use the
7 on_each_cpu macro. Moreover, this macro ensures that the calls will be
8 done all at once.
9
10 Suggested-by: Russell King <rmk+kernel@arm.linux.org.uk>
11 Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
12 Signed-off-by: David S. Miller <davem@davemloft.net>
13 ---
14
15 --- a/drivers/net/ethernet/marvell/mvneta.c
16 +++ b/drivers/net/ethernet/marvell/mvneta.c
17 @@ -2553,7 +2553,7 @@ static void mvneta_percpu_mask_interrupt
18  
19  static void mvneta_start_dev(struct mvneta_port *pp)
20  {
21 -       unsigned int cpu;
22 +       int cpu;
23  
24         mvneta_max_rx_size_set(pp, pp->pkt_size);
25         mvneta_txq_max_tx_size_set(pp, pp->pkt_size);
26 @@ -2569,9 +2569,8 @@ static void mvneta_start_dev(struct mvne
27         }
28  
29         /* Unmask interrupts. It has to be done from each CPU */
30 -       for_each_online_cpu(cpu)
31 -               smp_call_function_single(cpu, mvneta_percpu_unmask_interrupt,
32 -                                        pp, true);
33 +       on_each_cpu(mvneta_percpu_unmask_interrupt, pp, true);
34 +
35         mvreg_write(pp, MVNETA_INTR_MISC_MASK,
36                     MVNETA_CAUSE_PHY_STATUS_CHANGE |
37                     MVNETA_CAUSE_LINK_CHANGE |
38 @@ -2991,7 +2990,7 @@ static int mvneta_percpu_notifier(struct
39  static int mvneta_open(struct net_device *dev)
40  {
41         struct mvneta_port *pp = netdev_priv(dev);
42 -       int ret, cpu;
43 +       int ret;
44  
45         pp->pkt_size = MVNETA_RX_PKT_SIZE(pp->dev->mtu);
46         pp->frag_size = SKB_DATA_ALIGN(MVNETA_RX_BUF_SIZE(pp->pkt_size)) +
47 @@ -3024,9 +3023,7 @@ static int mvneta_open(struct net_device
48         /* Enable per-CPU interrupt on all the CPU to handle our RX
49          * queue interrupts
50          */
51 -       for_each_online_cpu(cpu)
52 -               smp_call_function_single(cpu, mvneta_percpu_enable,
53 -                                        pp, true);
54 +       on_each_cpu(mvneta_percpu_enable, pp, true);
55  
56  
57         /* Register a CPU notifier to handle the case where our CPU
58 @@ -3313,9 +3310,7 @@ static int  mvneta_config_rss(struct mvn
59  
60         netif_tx_stop_all_queues(pp->dev);
61  
62 -       for_each_online_cpu(cpu)
63 -               smp_call_function_single(cpu, mvneta_percpu_mask_interrupt,
64 -                                        pp, true);
65 +       on_each_cpu(mvneta_percpu_mask_interrupt, pp, true);
66  
67         /* We have to synchronise on the napi of each CPU */
68         for_each_online_cpu(cpu) {