Skip to content

Commit

Permalink
team: add per-port option for enabling/disabling ports
Browse files Browse the repository at this point in the history
Signed-off-by: Jiri Pirko <jpirko@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Jiri Pirko authored and David S. Miller committed Apr 21, 2012
1 parent 19a0b58 commit acd6996
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions drivers/net/team/team.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -945,6 +962,13 @@ static const struct team_option team_options[] = {
.getter = team_mode_option_get,
.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,
Expand Down

0 comments on commit acd6996

Please sign in to comment.