summaryrefslogtreecommitdiff
path: root/drivers/net/team/team_mode_roundrobin.c
diff options
context:
space:
mode:
authorJiri Pirko <jiri@resnulli.us>2013-03-06 05:31:13 +0400
committerDavid S. Miller <davem@davemloft.net>2013-03-06 23:55:20 +0400
commit753f993911b32e479b4fab5d228dc07c11d1e7e7 (patch)
treef2b3e9f3d6c06366ac24e5222f2475b319bc379f /drivers/net/team/team_mode_roundrobin.c
parentacbba0d0f88e2577b9d92b61b136d13f65831a52 (diff)
downloadlinux-753f993911b32e479b4fab5d228dc07c11d1e7e7.tar.xz
team: introduce random mode
As suggested by Eric Dumazet, allow user to select mode which chooses TX port randomly. Functionality should be more of less similar to round-robin mode with even lower overhead. Signed-off-by: Jiri Pirko <jiri@resnulli.us> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/team/team_mode_roundrobin.c')
-rw-r--r--drivers/net/team/team_mode_roundrobin.c22
1 files changed, 1 insertions, 21 deletions
diff --git a/drivers/net/team/team_mode_roundrobin.c b/drivers/net/team/team_mode_roundrobin.c
index ed63a6bc66ce..d268e4de781b 100644
--- a/drivers/net/team/team_mode_roundrobin.c
+++ b/drivers/net/team/team_mode_roundrobin.c
@@ -25,26 +25,6 @@ static struct rr_priv *rr_priv(struct team *team)
return (struct rr_priv *) &team->mode_priv;
}
-static struct team_port *__get_first_port_up(struct team *team,
- struct team_port *port)
-{
- struct team_port *cur;
-
- if (team_port_txable(port))
- return port;
- cur = port;
- list_for_each_entry_continue_rcu(cur, &team->port_list, list)
- if (team_port_txable(port))
- return cur;
- list_for_each_entry_rcu(cur, &team->port_list, list) {
- if (cur == port)
- break;
- if (team_port_txable(port))
- return cur;
- }
- return NULL;
-}
-
static bool rr_transmit(struct team *team, struct sk_buff *skb)
{
struct team_port *port;
@@ -52,7 +32,7 @@ static bool rr_transmit(struct team *team, struct sk_buff *skb)
port_index = rr_priv(team)->sent_packets++ % team->en_port_count;
port = team_get_port_by_index_rcu(team, port_index);
- port = __get_first_port_up(team, port);
+ port = team_get_first_port_txable_rcu(team, port);
if (unlikely(!port))
goto drop;
if (team_dev_queue_xmit(team, port, skb))