From: Jiri Pirko Date: Fri, 27 Jul 2012 06:28:54 +0000 (+0000) Subject: team: add per port priority option X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=a86fc6b7d603992070c04bd7a8c217d55688b077;p=GitHub%2FLineageOS%2Fandroid_kernel_samsung_universal7580.git team: add per port priority option Allow userspace to set port priority. Signed-off-by: Jiri Pirko Signed-off-by: David S. Miller --- diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c index 70752e631a1..a30b7c1bd9f 100644 --- a/drivers/net/team/team.c +++ b/drivers/net/team/team.c @@ -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", @@ -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; diff --git a/include/linux/if_team.h b/include/linux/if_team.h index e5571c42080..06495b3e7a9 100644 --- a/include/linux/if_team.h +++ b/include/linux/if_team.h @@ -67,6 +67,7 @@ struct team_port { struct netpoll *np; #endif + s32 priority; /* lower number ~ higher priority */ long mode_priv[0]; };