diff options
author | Jiri Pirko <jpirko@redhat.com> | 2012-04-20 04:42:06 (GMT) |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-04-21 20:26:33 (GMT) |
commit | acd69962341a956b5bcc5b4178b70fa527d7ce11 (patch) | |
tree | a04079ece8230c98a9ff3488eb5651ed4bbd9eb2 | |
parent | 19a0b58e506b06fd41659d8734bba6a3e87980f4 (diff) | |
download | linux-acd69962341a956b5bcc5b4178b70fa527d7ce11.tar.xz |
team: add per-port option for enabling/disabling ports
Signed-off-by: Jiri Pirko <jpirko@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/team/team.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c index fe7ca40..c61ae35 100644 --- a/drivers/net/team/team.c +++ b/drivers/net/team/team.c @@ -904,6 +904,23 @@ static int team_mode_option_set(struct team *team, struct team_gsetter_ctx *ctx) return team_change_mode(team, ctx->data.str_val); } +static int team_port_en_option_get(struct team *team, + struct team_gsetter_ctx *ctx) +{ + ctx->data.bool_val = team_port_enabled(ctx->port); + return 0; +} + +static int team_port_en_option_set(struct team *team, + struct team_gsetter_ctx *ctx) +{ + if (ctx->data.bool_val) + team_port_enable(team, ctx->port); + else + team_port_disable(team, ctx->port); + return 0; +} + static int team_user_linkup_option_get(struct team *team, struct team_gsetter_ctx *ctx) { @@ -946,6 +963,13 @@ static const struct team_option team_options[] = { .setter = team_mode_option_set, }, { + .name = "enabled", + .type = TEAM_OPTION_TYPE_BOOL, + .per_port = true, + .getter = team_port_en_option_get, + .setter = team_port_en_option_set, + }, + { .name = "user_linkup", .type = TEAM_OPTION_TYPE_BOOL, .per_port = true, |