Commit 6b125d63 authored by Gregory CLEMENT's avatar Gregory CLEMENT Committed by David S. Miller

net: mvneta: Use on_each_cpu when possible

Instead of using a for_each_* loop in which we just call the
smp_call_function_single macro, it is more simple to directly use the
on_each_cpu macro. Moreover, this macro ensures that the calls will be
done all at once.
Suggested-by: default avatarRussell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: default avatarGregory CLEMENT <gregory.clement@free-electrons.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent cad5d847
...@@ -2555,7 +2555,7 @@ static void mvneta_percpu_mask_interrupt(void *arg) ...@@ -2555,7 +2555,7 @@ static void mvneta_percpu_mask_interrupt(void *arg)
static void mvneta_start_dev(struct mvneta_port *pp) static void mvneta_start_dev(struct mvneta_port *pp)
{ {
unsigned int cpu; int cpu;
mvneta_max_rx_size_set(pp, pp->pkt_size); mvneta_max_rx_size_set(pp, pp->pkt_size);
mvneta_txq_max_tx_size_set(pp, pp->pkt_size); mvneta_txq_max_tx_size_set(pp, pp->pkt_size);
...@@ -2571,9 +2571,8 @@ static void mvneta_start_dev(struct mvneta_port *pp) ...@@ -2571,9 +2571,8 @@ static void mvneta_start_dev(struct mvneta_port *pp)
} }
/* Unmask interrupts. It has to be done from each CPU */ /* Unmask interrupts. It has to be done from each CPU */
for_each_online_cpu(cpu) on_each_cpu(mvneta_percpu_unmask_interrupt, pp, true);
smp_call_function_single(cpu, mvneta_percpu_unmask_interrupt,
pp, true);
mvreg_write(pp, MVNETA_INTR_MISC_MASK, mvreg_write(pp, MVNETA_INTR_MISC_MASK,
MVNETA_CAUSE_PHY_STATUS_CHANGE | MVNETA_CAUSE_PHY_STATUS_CHANGE |
MVNETA_CAUSE_LINK_CHANGE | MVNETA_CAUSE_LINK_CHANGE |
...@@ -2993,7 +2992,7 @@ static int mvneta_percpu_notifier(struct notifier_block *nfb, ...@@ -2993,7 +2992,7 @@ static int mvneta_percpu_notifier(struct notifier_block *nfb,
static int mvneta_open(struct net_device *dev) static int mvneta_open(struct net_device *dev)
{ {
struct mvneta_port *pp = netdev_priv(dev); struct mvneta_port *pp = netdev_priv(dev);
int ret, cpu; int ret;
pp->pkt_size = MVNETA_RX_PKT_SIZE(pp->dev->mtu); pp->pkt_size = MVNETA_RX_PKT_SIZE(pp->dev->mtu);
pp->frag_size = SKB_DATA_ALIGN(MVNETA_RX_BUF_SIZE(pp->pkt_size)) + pp->frag_size = SKB_DATA_ALIGN(MVNETA_RX_BUF_SIZE(pp->pkt_size)) +
...@@ -3026,9 +3025,7 @@ static int mvneta_open(struct net_device *dev) ...@@ -3026,9 +3025,7 @@ static int mvneta_open(struct net_device *dev)
/* Enable per-CPU interrupt on all the CPU to handle our RX /* Enable per-CPU interrupt on all the CPU to handle our RX
* queue interrupts * queue interrupts
*/ */
for_each_online_cpu(cpu) on_each_cpu(mvneta_percpu_enable, pp, true);
smp_call_function_single(cpu, mvneta_percpu_enable,
pp, true);
/* Register a CPU notifier to handle the case where our CPU /* Register a CPU notifier to handle the case where our CPU
...@@ -3315,9 +3312,7 @@ static int mvneta_config_rss(struct mvneta_port *pp) ...@@ -3315,9 +3312,7 @@ static int mvneta_config_rss(struct mvneta_port *pp)
netif_tx_stop_all_queues(pp->dev); netif_tx_stop_all_queues(pp->dev);
for_each_online_cpu(cpu) on_each_cpu(mvneta_percpu_mask_interrupt, pp, true);
smp_call_function_single(cpu, mvneta_percpu_mask_interrupt,
pp, true);
/* We have to synchronise on the napi of each CPU */ /* We have to synchronise on the napi of each CPU */
for_each_online_cpu(cpu) { for_each_online_cpu(cpu) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment