提交 129219e4 编写于 作者: G Gregory CLEMENT 提交者: David S. Miller

net: mvneta: Fix for_each_present_cpu usage

This patch convert the for_each_present in on_each_cpu, instead of
applying on the present cpus it will be applied only on the online cpus.
This fix a bug reported on
http://thread.gmane.org/gmane.linux.ports.arm.kernel/468173.

Using the macro on_each_cpu (instead of a for_each_* loop) also ensures
that all the calls will be done all at once.

Fixes: f8642885 ("net: mvneta: Statically assign queues to CPUs")
Reported-by: NStefan Roese <stefan.roese@gmail.com>
Suggested-by: NJisheng Zhang <jszhang@marvell.com>
Suggested-by: NRussell King <rmk+kernel@arm.linux.org.uk>
Signed-off-by: NGregory CLEMENT <gregory.clement@free-electrons.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 59888180
...@@ -2564,7 +2564,7 @@ static void mvneta_start_dev(struct mvneta_port *pp) ...@@ -2564,7 +2564,7 @@ static void mvneta_start_dev(struct mvneta_port *pp)
mvneta_port_enable(pp); mvneta_port_enable(pp);
/* Enable polling on the port */ /* Enable polling on the port */
for_each_present_cpu(cpu) { for_each_online_cpu(cpu) {
struct mvneta_pcpu_port *port = per_cpu_ptr(pp->ports, cpu); struct mvneta_pcpu_port *port = per_cpu_ptr(pp->ports, cpu);
napi_enable(&port->napi); napi_enable(&port->napi);
...@@ -2589,7 +2589,7 @@ static void mvneta_stop_dev(struct mvneta_port *pp) ...@@ -2589,7 +2589,7 @@ static void mvneta_stop_dev(struct mvneta_port *pp)
phy_stop(pp->phy_dev); phy_stop(pp->phy_dev);
for_each_present_cpu(cpu) { for_each_online_cpu(cpu) {
struct mvneta_pcpu_port *port = per_cpu_ptr(pp->ports, cpu); struct mvneta_pcpu_port *port = per_cpu_ptr(pp->ports, cpu);
napi_disable(&port->napi); napi_disable(&port->napi);
...@@ -3057,13 +3057,11 @@ static int mvneta_open(struct net_device *dev) ...@@ -3057,13 +3057,11 @@ static int mvneta_open(struct net_device *dev)
static int mvneta_stop(struct net_device *dev) static int mvneta_stop(struct net_device *dev)
{ {
struct mvneta_port *pp = netdev_priv(dev); struct mvneta_port *pp = netdev_priv(dev);
int cpu;
mvneta_stop_dev(pp); mvneta_stop_dev(pp);
mvneta_mdio_remove(pp); mvneta_mdio_remove(pp);
unregister_cpu_notifier(&pp->cpu_notifier); unregister_cpu_notifier(&pp->cpu_notifier);
for_each_present_cpu(cpu) on_each_cpu(mvneta_percpu_disable, pp, true);
smp_call_function_single(cpu, mvneta_percpu_disable, pp, true);
free_percpu_irq(dev->irq, pp->ports); free_percpu_irq(dev->irq, pp->ports);
mvneta_cleanup_rxqs(pp); mvneta_cleanup_rxqs(pp);
mvneta_cleanup_txqs(pp); mvneta_cleanup_txqs(pp);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册