team: push array_index and port into separate structure

Introduce struct team_option_inst_info and push option instance info
there. It can be then easily passed to gsetter context and used for
feature async option changes.

Signed-off-by: Jiri Pirko <jpirko@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Jiri Pirko 2012-06-19 05:54:10 +00:00 committed by David S. Miller
parent 0d572e45f7
commit 85d59a8724
2 changed files with 50 additions and 27 deletions

View file

@ -83,6 +83,11 @@ enum team_option_type {
TEAM_OPTION_TYPE_BOOL,
};
struct team_option_inst_info {
u32 array_index;
struct team_port *port; /* != NULL if per-port */
};
struct team_gsetter_ctx {
union {
u32 u32_val;
@ -93,8 +98,7 @@ struct team_gsetter_ctx {
} bin_val;
bool bool_val;
} data;
u32 array_index;
struct team_port *port;
struct team_option_inst_info *info;
};
struct team_option {
@ -103,6 +107,7 @@ struct team_option {
bool per_port;
unsigned int array_size; /* != 0 means the option is array */
enum team_option_type type;
int (*init)(struct team *team, struct team_option_inst_info *info);
int (*getter)(struct team *team, struct team_gsetter_ctx *ctx);
int (*setter)(struct team *team, struct team_gsetter_ctx *ctx);
};