Skip to content

Commit 2fcdb2c

Browse files
Jiri Pirkodavem330
Jiri Pirko
authored andcommitted
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: Jiri Pirko <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 35b384b commit 2fcdb2c

File tree

1 file changed

+9
-24
lines changed

1 file changed

+9
-24
lines changed

drivers/net/team/team.c

+9-24
Original file line numberDiff line numberDiff line change
@@ -320,8 +320,6 @@ static void __team_options_unregister(struct team *team,
320320
}
321321

322322
static void __team_options_change_check(struct team *team);
323-
static void __team_option_inst_change(struct team *team,
324-
struct team_option_inst *opt_inst);
325323

326324
int team_options_register(struct team *team,
327325
const struct team_option *option,
@@ -360,16 +358,9 @@ static int team_option_set(struct team *team,
360358
struct team_option_inst *opt_inst,
361359
struct team_gsetter_ctx *ctx)
362360
{
363-
int err;
364-
365361
if (!opt_inst->option->setter)
366362
return -EOPNOTSUPP;
367-
err = opt_inst->option->setter(team, ctx);
368-
if (err)
369-
return err;
370-
371-
__team_option_inst_change(team, opt_inst);
372-
return err;
363+
return opt_inst->option->setter(team, ctx);
373364
}
374365

375366
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)
17501741
return err;
17511742
}
17521743

1744+
static int team_nl_send_event_options_get(struct team *team,
1745+
struct list_head *sel_opt_inst_list);
1746+
17531747
static int team_nl_cmd_options_set(struct sk_buff *skb, struct genl_info *info)
17541748
{
17551749
struct team *team;
17561750
int err = 0;
17571751
int i;
17581752
struct nlattr *nl_option;
1753+
LIST_HEAD(opt_inst_list);
17591754

17601755
team = team_nl_team_get(info);
17611756
if (!team)
@@ -1867,13 +1862,17 @@ static int team_nl_cmd_options_set(struct sk_buff *skb, struct genl_info *info)
18671862
err = team_option_set(team, opt_inst, &ctx);
18681863
if (err)
18691864
goto team_put;
1865+
opt_inst->changed = true;
1866+
list_add(&opt_inst->tmp_list, &opt_inst_list);
18701867
}
18711868
if (!opt_found) {
18721869
err = -ENOENT;
18731870
goto team_put;
18741871
}
18751872
}
18761873

1874+
err = team_nl_send_event_options_get(team, &opt_inst_list);
1875+
18771876
team_put:
18781877
team_nl_team_put(team);
18791878

@@ -2074,20 +2073,6 @@ static void __team_options_change_check(struct team *team)
20742073
err);
20752074
}
20762075

2077-
static void __team_option_inst_change(struct team *team,
2078-
struct team_option_inst *sel_opt_inst)
2079-
{
2080-
int err;
2081-
LIST_HEAD(sel_opt_inst_list);
2082-
2083-
sel_opt_inst->changed = true;
2084-
list_add(&sel_opt_inst->tmp_list, &sel_opt_inst_list);
2085-
err = team_nl_send_event_options_get(team, &sel_opt_inst_list);
2086-
if (err)
2087-
netdev_warn(team->dev, "Failed to send option change via netlink (err %d)\n",
2088-
err);
2089-
}
2090-
20912076
/* rtnl lock is held */
20922077
static void __team_port_change_check(struct team_port *port, bool linkup)
20932078
{

0 commit comments

Comments
 (0)