diff options
author | Jiri Pirko <jiri@resnulli.us> | 2013-06-10 11:42:25 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-06-12 06:06:16 -0400 |
commit | 735d381fa57c573935d35a24ea271ec99897ac63 (patch) | |
tree | e1118f79060396214ac150339eaa6a3a1c7c2168 /include/linux/if_team.h | |
parent | d80b35beac78b52faad2359adf6a6b14e2725e51 (diff) |
team: remove synchronize_rcu() called during port disable
Check the unlikely case of team->en_port_count == 0 before modulo
operation.
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 | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/include/linux/if_team.h b/include/linux/if_team.h index 705459524706..b662045a81c0 100644 --- a/include/linux/if_team.h +++ b/include/linux/if_team.h | |||
@@ -229,6 +229,16 @@ static inline struct team_port *team_get_port_by_index(struct team *team, | |||
229 | return port; | 229 | return port; |
230 | return NULL; | 230 | return NULL; |
231 | } | 231 | } |
232 | |||
233 | static inline int team_num_to_port_index(struct team *team, int num) | ||
234 | { | ||
235 | int en_port_count = ACCESS_ONCE(team->en_port_count); | ||
236 | |||
237 | if (unlikely(!en_port_count)) | ||
238 | return 0; | ||
239 | return num % en_port_count; | ||
240 | } | ||
241 | |||
232 | static inline struct team_port *team_get_port_by_index_rcu(struct team *team, | 242 | static inline struct team_port *team_get_port_by_index_rcu(struct team *team, |
233 | int port_index) | 243 | int port_index) |
234 | { | 244 | { |