]> Pileus Git - ~andy/linux/blobdiff - include/linux/if_team.h
team: introduce random mode
[~andy/linux] / include / linux / if_team.h
index 3283def744833cd70587e1163694efe4267c3673..4474557904f69eef849b329b41b91ba4f72bb678 100644 (file)
@@ -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);