diff options
author | Jiri Pirko <jpirko@redhat.com> | 2012-04-20 00:42:05 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-04-21 16:26:33 -0400 |
commit | 19a0b58e506b06fd41659d8734bba6a3e87980f4 (patch) | |
tree | f9844eaf9d1471c6fcd98c850b1ed6cd57f2bce3 /include/linux/if_team.h | |
parent | 4c78bb845bd2aaf1f7136e75314c7d034cfd120f (diff) |
team: allow to enable/disable ports
This patch changes content of hashlist (used to get port struct by
computed index (0...en_port_count-1)). Now the hash list contains only
enabled ports so userspace will be able to say what ports can be used
for tx/rx. This becomes handy when userspace will need to disable ports
which does not belong to active aggregator. By default, newly added port
is enabled.
Signed-off-by: Jiri Pirko <jpirko@redhat.com>
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 | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/include/linux/if_team.h b/include/linux/if_team.h index 5fd5ab171165..8185f57a9c7f 100644 --- a/include/linux/if_team.h +++ b/include/linux/if_team.h | |||
@@ -28,10 +28,10 @@ struct team; | |||
28 | 28 | ||
29 | struct team_port { | 29 | struct team_port { |
30 | struct net_device *dev; | 30 | struct net_device *dev; |
31 | struct hlist_node hlist; /* node in hash list */ | 31 | struct hlist_node hlist; /* node in enabled ports hash list */ |
32 | struct list_head list; /* node in ordinary list */ | 32 | struct list_head list; /* node in ordinary list */ |
33 | struct team *team; | 33 | struct team *team; |
34 | int index; | 34 | int index; /* index of enabled port. If disabled, it's set to -1 */ |
35 | 35 | ||
36 | bool linkup; /* either state.linkup or user.linkup */ | 36 | bool linkup; /* either state.linkup or user.linkup */ |
37 | 37 | ||
@@ -125,11 +125,12 @@ struct team { | |||
125 | struct mutex lock; /* used for overall locking, e.g. port lists write */ | 125 | struct mutex lock; /* used for overall locking, e.g. port lists write */ |
126 | 126 | ||
127 | /* | 127 | /* |
128 | * port lists with port count | 128 | * List of enabled ports and their count |
129 | */ | 129 | */ |
130 | int port_count; | 130 | int en_port_count; |
131 | struct hlist_head port_hlist[TEAM_PORT_HASHENTRIES]; | 131 | struct hlist_head en_port_hlist[TEAM_PORT_HASHENTRIES]; |
132 | struct list_head port_list; | 132 | |
133 | struct list_head port_list; /* list of all ports */ | ||
133 | 134 | ||
134 | struct list_head option_list; | 135 | struct list_head option_list; |
135 | struct list_head option_inst_list; /* list of option instances */ | 136 | struct list_head option_inst_list; /* list of option instances */ |
@@ -142,7 +143,7 @@ struct team { | |||
142 | static inline struct hlist_head *team_port_index_hash(struct team *team, | 143 | static inline struct hlist_head *team_port_index_hash(struct team *team, |
143 | int port_index) | 144 | int port_index) |
144 | { | 145 | { |
145 | return &team->port_hlist[port_index & (TEAM_PORT_HASHENTRIES - 1)]; | 146 | return &team->en_port_hlist[port_index & (TEAM_PORT_HASHENTRIES - 1)]; |
146 | } | 147 | } |
147 | 148 | ||
148 | static inline struct team_port *team_get_port_by_index(struct team *team, | 149 | static inline struct team_port *team_get_port_by_index(struct team *team, |