Commit de3ecc4f authored by Zhengchao Shao's avatar Zhengchao Shao Committed by Jakub Kicinski

team: change the init function in the team_option structure to void

Because the init function in the team_option structure always returns 0,
so change the init function to void and remove redundant code.
Signed-off-by: default avatarZhengchao Shao <shaozhengchao@huawei.com>
Reviewed-by: default avatarHangbin Liu <liuhangbin@gmail.com>
Reviewed-by: default avatarJiri Pirko <jiri@nvidia.com>
Link: https://lore.kernel.org/r/20230807012556.3146071-4-shaozhengchao@huawei.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent adac1194
...@@ -149,7 +149,6 @@ static int __team_option_inst_add(struct team *team, struct team_option *option, ...@@ -149,7 +149,6 @@ static int __team_option_inst_add(struct team *team, struct team_option *option,
struct team_option_inst *opt_inst; struct team_option_inst *opt_inst;
unsigned int array_size; unsigned int array_size;
unsigned int i; unsigned int i;
int err;
array_size = option->array_size; array_size = option->array_size;
if (!array_size) if (!array_size)
...@@ -165,11 +164,8 @@ static int __team_option_inst_add(struct team *team, struct team_option *option, ...@@ -165,11 +164,8 @@ static int __team_option_inst_add(struct team *team, struct team_option *option,
opt_inst->changed = true; opt_inst->changed = true;
opt_inst->removed = false; opt_inst->removed = false;
list_add_tail(&opt_inst->list, &team->option_inst_list); list_add_tail(&opt_inst->list, &team->option_inst_list);
if (option->init) { if (option->init)
err = option->init(team, &opt_inst->info); option->init(team, &opt_inst->info);
if (err)
return err;
}
} }
return 0; return 0;
......
...@@ -57,11 +57,10 @@ static void ab_port_leave(struct team *team, struct team_port *port) ...@@ -57,11 +57,10 @@ static void ab_port_leave(struct team *team, struct team_port *port)
} }
} }
static int ab_active_port_init(struct team *team, static void ab_active_port_init(struct team *team,
struct team_option_inst_info *info) struct team_option_inst_info *info)
{ {
ab_priv(team)->ap_opt_inst_info = info; ab_priv(team)->ap_opt_inst_info = info;
return 0;
} }
static int ab_active_port_get(struct team *team, struct team_gsetter_ctx *ctx) static int ab_active_port_get(struct team *team, struct team_gsetter_ctx *ctx)
......
...@@ -361,14 +361,13 @@ static int lb_tx_method_set(struct team *team, struct team_gsetter_ctx *ctx) ...@@ -361,14 +361,13 @@ static int lb_tx_method_set(struct team *team, struct team_gsetter_ctx *ctx)
return 0; return 0;
} }
static int lb_tx_hash_to_port_mapping_init(struct team *team, static void lb_tx_hash_to_port_mapping_init(struct team *team,
struct team_option_inst_info *info) struct team_option_inst_info *info)
{ {
struct lb_priv *lb_priv = get_lb_priv(team); struct lb_priv *lb_priv = get_lb_priv(team);
unsigned char hash = info->array_index; unsigned char hash = info->array_index;
LB_HTPM_OPT_INST_INFO_BY_HASH(lb_priv, hash) = info; LB_HTPM_OPT_INST_INFO_BY_HASH(lb_priv, hash) = info;
return 0;
} }
static int lb_tx_hash_to_port_mapping_get(struct team *team, static int lb_tx_hash_to_port_mapping_get(struct team *team,
...@@ -401,14 +400,13 @@ static int lb_tx_hash_to_port_mapping_set(struct team *team, ...@@ -401,14 +400,13 @@ static int lb_tx_hash_to_port_mapping_set(struct team *team,
return -ENODEV; return -ENODEV;
} }
static int lb_hash_stats_init(struct team *team, static void lb_hash_stats_init(struct team *team,
struct team_option_inst_info *info) struct team_option_inst_info *info)
{ {
struct lb_priv *lb_priv = get_lb_priv(team); struct lb_priv *lb_priv = get_lb_priv(team);
unsigned char hash = info->array_index; unsigned char hash = info->array_index;
lb_priv->ex->stats.info[hash].opt_inst_info = info; lb_priv->ex->stats.info[hash].opt_inst_info = info;
return 0;
} }
static int lb_hash_stats_get(struct team *team, struct team_gsetter_ctx *ctx) static int lb_hash_stats_get(struct team *team, struct team_gsetter_ctx *ctx)
...@@ -421,14 +419,13 @@ static int lb_hash_stats_get(struct team *team, struct team_gsetter_ctx *ctx) ...@@ -421,14 +419,13 @@ static int lb_hash_stats_get(struct team *team, struct team_gsetter_ctx *ctx)
return 0; return 0;
} }
static int lb_port_stats_init(struct team *team, static void lb_port_stats_init(struct team *team,
struct team_option_inst_info *info) struct team_option_inst_info *info)
{ {
struct team_port *port = info->port; struct team_port *port = info->port;
struct lb_port_priv *lb_port_priv = get_lb_port_priv(port); struct lb_port_priv *lb_port_priv = get_lb_port_priv(port);
lb_port_priv->stats_info.opt_inst_info = info; lb_port_priv->stats_info.opt_inst_info = info;
return 0;
} }
static int lb_port_stats_get(struct team *team, struct team_gsetter_ctx *ctx) static int lb_port_stats_get(struct team *team, struct team_gsetter_ctx *ctx)
......
...@@ -162,7 +162,7 @@ struct team_option { ...@@ -162,7 +162,7 @@ struct team_option {
bool per_port; bool per_port;
unsigned int array_size; /* != 0 means the option is array */ unsigned int array_size; /* != 0 means the option is array */
enum team_option_type type; enum team_option_type type;
int (*init)(struct team *team, struct team_option_inst_info *info); void (*init)(struct team *team, struct team_option_inst_info *info);
int (*getter)(struct team *team, struct team_gsetter_ctx *ctx); int (*getter)(struct team *team, struct team_gsetter_ctx *ctx);
int (*setter)(struct team *team, struct team_gsetter_ctx *ctx); int (*setter)(struct team *team, struct team_gsetter_ctx *ctx);
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment