Commit 2fcdb2c9 authored by Jiri Pirko's avatar Jiri Pirko Committed by David S. Miller

team: allow to send multiple set events in one message

When multiple sets are done, event message is generated for each. This
patch accumulates these messages into one.
Signed-off-by: default avatarJiri Pirko <jpirko@redhat.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 35b384bd
...@@ -320,8 +320,6 @@ static void __team_options_unregister(struct team *team, ...@@ -320,8 +320,6 @@ static void __team_options_unregister(struct team *team,
} }
static void __team_options_change_check(struct team *team); static void __team_options_change_check(struct team *team);
static void __team_option_inst_change(struct team *team,
struct team_option_inst *opt_inst);
int team_options_register(struct team *team, int team_options_register(struct team *team,
const struct team_option *option, const struct team_option *option,
...@@ -360,16 +358,9 @@ static int team_option_set(struct team *team, ...@@ -360,16 +358,9 @@ static int team_option_set(struct team *team,
struct team_option_inst *opt_inst, struct team_option_inst *opt_inst,
struct team_gsetter_ctx *ctx) struct team_gsetter_ctx *ctx)
{ {
int err;
if (!opt_inst->option->setter) if (!opt_inst->option->setter)
return -EOPNOTSUPP; return -EOPNOTSUPP;
err = opt_inst->option->setter(team, ctx); return opt_inst->option->setter(team, ctx);
if (err)
return err;
__team_option_inst_change(team, opt_inst);
return err;
} }
void team_option_inst_set_change(struct team_option_inst_info *opt_inst_info) void team_option_inst_set_change(struct team_option_inst_info *opt_inst_info)
...@@ -1750,12 +1741,16 @@ static int team_nl_cmd_options_get(struct sk_buff *skb, struct genl_info *info) ...@@ -1750,12 +1741,16 @@ static int team_nl_cmd_options_get(struct sk_buff *skb, struct genl_info *info)
return err; return err;
} }
static int team_nl_send_event_options_get(struct team *team,
struct list_head *sel_opt_inst_list);
static int team_nl_cmd_options_set(struct sk_buff *skb, struct genl_info *info) static int team_nl_cmd_options_set(struct sk_buff *skb, struct genl_info *info)
{ {
struct team *team; struct team *team;
int err = 0; int err = 0;
int i; int i;
struct nlattr *nl_option; struct nlattr *nl_option;
LIST_HEAD(opt_inst_list);
team = team_nl_team_get(info); team = team_nl_team_get(info);
if (!team) if (!team)
...@@ -1867,6 +1862,8 @@ static int team_nl_cmd_options_set(struct sk_buff *skb, struct genl_info *info) ...@@ -1867,6 +1862,8 @@ static int team_nl_cmd_options_set(struct sk_buff *skb, struct genl_info *info)
err = team_option_set(team, opt_inst, &ctx); err = team_option_set(team, opt_inst, &ctx);
if (err) if (err)
goto team_put; goto team_put;
opt_inst->changed = true;
list_add(&opt_inst->tmp_list, &opt_inst_list);
} }
if (!opt_found) { if (!opt_found) {
err = -ENOENT; err = -ENOENT;
...@@ -1874,6 +1871,8 @@ static int team_nl_cmd_options_set(struct sk_buff *skb, struct genl_info *info) ...@@ -1874,6 +1871,8 @@ static int team_nl_cmd_options_set(struct sk_buff *skb, struct genl_info *info)
} }
} }
err = team_nl_send_event_options_get(team, &opt_inst_list);
team_put: team_put:
team_nl_team_put(team); team_nl_team_put(team);
...@@ -2074,20 +2073,6 @@ static void __team_options_change_check(struct team *team) ...@@ -2074,20 +2073,6 @@ static void __team_options_change_check(struct team *team)
err); err);
} }
static void __team_option_inst_change(struct team *team,
struct team_option_inst *sel_opt_inst)
{
int err;
LIST_HEAD(sel_opt_inst_list);
sel_opt_inst->changed = true;
list_add(&sel_opt_inst->tmp_list, &sel_opt_inst_list);
err = team_nl_send_event_options_get(team, &sel_opt_inst_list);
if (err)
netdev_warn(team->dev, "Failed to send option change via netlink (err %d)\n",
err);
}
/* rtnl lock is held */ /* rtnl lock is held */
static void __team_port_change_check(struct team_port *port, bool linkup) static void __team_port_change_check(struct team_port *port, bool linkup)
{ {
......
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