mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-21 06:01:23 +00:00
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>
This commit is contained in:
parent
acbba0d0f8
commit
753f993911
5 changed files with 105 additions and 21 deletions
|
@ -240,6 +240,26 @@ static inline struct team_port *team_get_port_by_index_rcu(struct team *team,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static inline struct team_port *
|
||||
team_get_first_port_txable_rcu(struct team *team, struct team_port *port)
|
||||
{
|
||||
struct team_port *cur;
|
||||
|
||||
if (likely(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;
|
||||
}
|
||||
|
||||
extern int team_options_register(struct team *team,
|
||||
const struct team_option *option,
|
||||
size_t option_count);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue