Commit 8599a1fe authored by Xin Long's avatar Xin Long Committed by Greg Kroah-Hartman

team: fix netconsole setup over team

[ Upstream commit 9cf2f437 ]

The same fix in Commit dbe17307 ("bridge: fix netconsole
setup over bridge") is also needed for team driver.

While at it, remove the unnecessary parameter *team from
team_port_enable_netpoll().

v1->v2:
  - fix it in a better way, as does bridge.

Fixes: 0fb52a27 ("team: cleanup netpoll clode")
Reported-by: default avatarJoão Avelino Bellomo Filho <jbellomo@redhat.com>
Signed-off-by: default avatarXin Long <lucien.xin@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 3626fb04
...@@ -1078,14 +1078,11 @@ static void team_port_leave(struct team *team, struct team_port *port) ...@@ -1078,14 +1078,11 @@ static void team_port_leave(struct team *team, struct team_port *port)
} }
#ifdef CONFIG_NET_POLL_CONTROLLER #ifdef CONFIG_NET_POLL_CONTROLLER
static int team_port_enable_netpoll(struct team *team, struct team_port *port) static int __team_port_enable_netpoll(struct team_port *port)
{ {
struct netpoll *np; struct netpoll *np;
int err; int err;
if (!team->dev->npinfo)
return 0;
np = kzalloc(sizeof(*np), GFP_KERNEL); np = kzalloc(sizeof(*np), GFP_KERNEL);
if (!np) if (!np)
return -ENOMEM; return -ENOMEM;
...@@ -1099,6 +1096,14 @@ static int team_port_enable_netpoll(struct team *team, struct team_port *port) ...@@ -1099,6 +1096,14 @@ static int team_port_enable_netpoll(struct team *team, struct team_port *port)
return err; return err;
} }
static int team_port_enable_netpoll(struct team_port *port)
{
if (!port->team->dev->npinfo)
return 0;
return __team_port_enable_netpoll(port);
}
static void team_port_disable_netpoll(struct team_port *port) static void team_port_disable_netpoll(struct team_port *port)
{ {
struct netpoll *np = port->np; struct netpoll *np = port->np;
...@@ -1113,7 +1118,7 @@ static void team_port_disable_netpoll(struct team_port *port) ...@@ -1113,7 +1118,7 @@ static void team_port_disable_netpoll(struct team_port *port)
kfree(np); kfree(np);
} }
#else #else
static int team_port_enable_netpoll(struct team *team, struct team_port *port) static int team_port_enable_netpoll(struct team_port *port)
{ {
return 0; return 0;
} }
...@@ -1221,7 +1226,7 @@ static int team_port_add(struct team *team, struct net_device *port_dev) ...@@ -1221,7 +1226,7 @@ static int team_port_add(struct team *team, struct net_device *port_dev)
goto err_vids_add; goto err_vids_add;
} }
err = team_port_enable_netpoll(team, port); err = team_port_enable_netpoll(port);
if (err) { if (err) {
netdev_err(dev, "Failed to enable netpoll on device %s\n", netdev_err(dev, "Failed to enable netpoll on device %s\n",
portname); portname);
...@@ -1919,7 +1924,7 @@ static int team_netpoll_setup(struct net_device *dev, ...@@ -1919,7 +1924,7 @@ static int team_netpoll_setup(struct net_device *dev,
mutex_lock(&team->lock); mutex_lock(&team->lock);
list_for_each_entry(port, &team->port_list, list) { list_for_each_entry(port, &team->port_list, list) {
err = team_port_enable_netpoll(team, port); err = __team_port_enable_netpoll(port);
if (err) { if (err) {
__team_netpoll_cleanup(team); __team_netpoll_cleanup(team);
break; break;
......
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