aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/if_team.h
diff options
context:
space:
mode:
authorJiri Pirko <jpirko@redhat.com>2012-04-10 01:15:42 -0400
committerDavid S. Miller <davem@davemloft.net>2012-04-11 10:03:51 -0400
commit80f7c6683fe0e891ef1db7c967d538b5fdddd22c (patch)
tree7252117971ea67654ede4e716b771bb1fe824e36 /include/linux/if_team.h
parent7a5cc24277b57ce38eb0afa6634b71d4d5cc671e (diff)
team: add support for per-port options
This patch allows to create per-port options. That becomes handy for all sorts of stuff, for example for userspace driven link-state, 802.3ad implementation and so on. 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.h30
1 files changed, 17 insertions, 13 deletions
diff --git a/include/linux/if_team.h b/include/linux/if_team.h
index 41163ac14ab4..6f27c841c9a8 100644
--- a/include/linux/if_team.h
+++ b/include/linux/if_team.h
@@ -71,25 +71,27 @@ enum team_option_type {
71 TEAM_OPTION_TYPE_BINARY, 71 TEAM_OPTION_TYPE_BINARY,
72}; 72};
73 73
74struct team_gsetter_ctx {
75 union {
76 u32 u32_val;
77 const char *str_val;
78 struct {
79 const void *ptr;
80 u32 len;
81 } bin_val;
82 } data;
83 struct team_port *port;
84};
85
74struct team_option { 86struct team_option {
75 struct list_head list; 87 struct list_head list;
76 const char *name; 88 const char *name;
89 bool per_port;
77 enum team_option_type type; 90 enum team_option_type type;
78 int (*getter)(struct team *team, void *arg); 91 int (*getter)(struct team *team, struct team_gsetter_ctx *ctx);
79 int (*setter)(struct team *team, void *arg); 92 int (*setter)(struct team *team, struct team_gsetter_ctx *ctx);
80
81 /* Custom gennetlink interface related flags */
82 bool changed;
83 bool removed;
84}; 93};
85 94
86struct team_option_binary {
87 u32 data_len;
88 void *data;
89};
90
91#define team_optarg_tbinary(arg) (*((struct team_option_binary **) arg))
92
93struct team_mode { 95struct team_mode {
94 struct list_head list; 96 struct list_head list;
95 const char *kind; 97 const char *kind;
@@ -118,6 +120,7 @@ struct team {
118 struct list_head port_list; 120 struct list_head port_list;
119 121
120 struct list_head option_list; 122 struct list_head option_list;
123 struct list_head option_inst_list; /* list of option instances */
121 124
122 const struct team_mode *mode; 125 const struct team_mode *mode;
123 struct team_mode_ops ops; 126 struct team_mode_ops ops;
@@ -224,6 +227,7 @@ enum {
224 TEAM_ATTR_OPTION_TYPE, /* u8 */ 227 TEAM_ATTR_OPTION_TYPE, /* u8 */
225 TEAM_ATTR_OPTION_DATA, /* dynamic */ 228 TEAM_ATTR_OPTION_DATA, /* dynamic */
226 TEAM_ATTR_OPTION_REMOVED, /* flag */ 229 TEAM_ATTR_OPTION_REMOVED, /* flag */
230 TEAM_ATTR_OPTION_PORT_IFINDEX, /* u32 */ /* for per-port options */
227 231
228 __TEAM_ATTR_OPTION_MAX, 232 __TEAM_ATTR_OPTION_MAX,
229 TEAM_ATTR_OPTION_MAX = __TEAM_ATTR_OPTION_MAX - 1, 233 TEAM_ATTR_OPTION_MAX = __TEAM_ATTR_OPTION_MAX - 1,