diff options
author | Jiri Pirko <jiri@resnulli.us> | 2013-03-05 20:31:13 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-03-06 14:55:20 -0500 |
commit | 753f993911b32e479b4fab5d228dc07c11d1e7e7 (patch) | |
tree | f2b3e9f3d6c06366ac24e5222f2475b319bc379f /include/linux/if_team.h | |
parent | acbba0d0f88e2577b9d92b61b136d13f65831a52 (diff) |
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 'include/linux/if_team.h')
-rw-r--r-- | include/linux/if_team.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/include/linux/if_team.h b/include/linux/if_team.h index 3283def74483..4474557904f6 100644 --- a/include/linux/if_team.h +++ b/include/linux/if_team.h | |||
@@ -240,6 +240,26 @@ static inline struct team_port *team_get_port_by_index_rcu(struct team *team, | |||
240 | return NULL; | 240 | return NULL; |
241 | } | 241 | } |
242 | 242 | ||
243 | static inline struct team_port * | ||
244 | team_get_first_port_txable_rcu(struct team *team, struct team_port *port) | ||
245 | { | ||
246 | struct team_port *cur; | ||
247 | |||
248 | if (likely(team_port_txable(port))) | ||
249 | return port; | ||
250 | cur = port; | ||
251 | list_for_each_entry_continue_rcu(cur, &team->port_list, list) | ||
252 | if (team_port_txable(port)) | ||
253 | return cur; | ||
254 | list_for_each_entry_rcu(cur, &team->port_list, list) { | ||
255 | if (cur == port) | ||
256 | break; | ||
257 | if (team_port_txable(port)) | ||
258 | return cur; | ||
259 | } | ||
260 | return NULL; | ||
261 | } | ||
262 | |||
243 | extern int team_options_register(struct team *team, | 263 | extern int team_options_register(struct team *team, |
244 | const struct team_option *option, | 264 | const struct team_option *option, |
245 | size_t option_count); | 265 | size_t option_count); |