From 6e88e1357c788d40cd64a8c9080e81ca6c9eee0f Mon Sep 17 00:00:00 2001 From: Jiri Pirko Date: Wed, 11 Jul 2012 05:34:02 +0000 Subject: [PATCH] team: use function team_port_txable() for determing enabled and up port Signed-off-by: Jiri Pirko Signed-off-by: David S. Miller --- drivers/net/team/team.c | 6 ++++++ drivers/net/team/team_mode_roundrobin.c | 6 +++--- include/linux/if_team.h | 1 + 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c index 9b94f53a9d4b..bc7afa51d052 100644 --- a/drivers/net/team/team.c +++ b/drivers/net/team/team.c @@ -677,6 +677,12 @@ bool team_port_enabled(struct team_port *port) } EXPORT_SYMBOL(team_port_enabled); +bool team_port_txable(struct team_port *port) +{ + return port->linkup && team_port_enabled(port); +} +EXPORT_SYMBOL(team_port_txable); + /* * Enable/disable port by adding to enabled port hashlist and setting * port->index (Might be racy so reader could see incorrect ifindex when diff --git a/drivers/net/team/team_mode_roundrobin.c b/drivers/net/team/team_mode_roundrobin.c index 52dd0ec9cd1f..0cf38e9b9d26 100644 --- a/drivers/net/team/team_mode_roundrobin.c +++ b/drivers/net/team/team_mode_roundrobin.c @@ -30,16 +30,16 @@ static struct team_port *__get_first_port_up(struct team *team, { struct team_port *cur; - if (port->linkup) + if (team_port_txable(port)) return port; cur = port; list_for_each_entry_continue_rcu(cur, &team->port_list, list) - if (cur->linkup) + if (team_port_txable(port)) return cur; list_for_each_entry_rcu(cur, &team->port_list, list) { if (cur == port) break; - if (cur->linkup) + if (team_port_txable(port)) return cur; } return NULL; diff --git a/include/linux/if_team.h b/include/linux/if_team.h index 99efd60fa8c9..dca426cb1e12 100644 --- a/include/linux/if_team.h +++ b/include/linux/if_team.h @@ -64,6 +64,7 @@ struct team_port { }; extern bool team_port_enabled(struct team_port *port); +extern bool team_port_txable(struct team_port *port); struct team_mode_ops { int (*init)(struct team *team);