Skip to content

Commit

Permalink
team: add per port priority option
Browse files Browse the repository at this point in the history
Allow userspace to set port priority.

Signed-off-by: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Jiri Pirko authored and David S. Miller committed Aug 4, 2012
1 parent 6982163 commit a86fc6b
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
25 changes: 25 additions & 0 deletions drivers/net/team/team.c
Original file line number Diff line number Diff line change
Expand Up @@ -1092,6 +1092,24 @@ static int team_user_linkup_en_option_set(struct team *team,
return 0;
}

static int team_priority_option_get(struct team *team,
struct team_gsetter_ctx *ctx)
{
struct team_port *port = ctx->info->port;

ctx->data.s32_val = port->priority;
return 0;
}

static int team_priority_option_set(struct team *team,
struct team_gsetter_ctx *ctx)
{
struct team_port *port = ctx->info->port;

port->priority = ctx->data.s32_val;
return 0;
}

static const struct team_option team_options[] = {
{
.name = "mode",
Expand Down Expand Up @@ -1120,6 +1138,13 @@ static const struct team_option team_options[] = {
.getter = team_user_linkup_en_option_get,
.setter = team_user_linkup_en_option_set,
},
{
.name = "priority",
.type = TEAM_OPTION_TYPE_S32,
.per_port = true,
.getter = team_priority_option_get,
.setter = team_priority_option_set,
},
};

static struct lock_class_key team_netdev_xmit_lock_key;
Expand Down
1 change: 1 addition & 0 deletions include/linux/if_team.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ struct team_port {
struct netpoll *np;
#endif

s32 priority; /* lower number ~ higher priority */
long mode_priv[0];
};

Expand Down

0 comments on commit a86fc6b

Please sign in to comment.