Skip to content

Commit acd6996

Browse files
Jiri Pirkodavem330
authored andcommitted
team: add per-port option for enabling/disabling ports
Signed-off-by: Jiri Pirko <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 19a0b58 commit acd6996

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

drivers/net/team/team.c

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -904,6 +904,23 @@ static int team_mode_option_set(struct team *team, struct team_gsetter_ctx *ctx)
904904
return team_change_mode(team, ctx->data.str_val);
905905
}
906906

907+
static int team_port_en_option_get(struct team *team,
908+
struct team_gsetter_ctx *ctx)
909+
{
910+
ctx->data.bool_val = team_port_enabled(ctx->port);
911+
return 0;
912+
}
913+
914+
static int team_port_en_option_set(struct team *team,
915+
struct team_gsetter_ctx *ctx)
916+
{
917+
if (ctx->data.bool_val)
918+
team_port_enable(team, ctx->port);
919+
else
920+
team_port_disable(team, ctx->port);
921+
return 0;
922+
}
923+
907924
static int team_user_linkup_option_get(struct team *team,
908925
struct team_gsetter_ctx *ctx)
909926
{
@@ -945,6 +962,13 @@ static const struct team_option team_options[] = {
945962
.getter = team_mode_option_get,
946963
.setter = team_mode_option_set,
947964
},
965+
{
966+
.name = "enabled",
967+
.type = TEAM_OPTION_TYPE_BOOL,
968+
.per_port = true,
969+
.getter = team_port_en_option_get,
970+
.setter = team_port_en_option_set,
971+
},
948972
{
949973
.name = "user_linkup",
950974
.type = TEAM_OPTION_TYPE_BOOL,

0 commit comments

Comments
 (0)