diff options
author | Jiri Pirko <jpirko@redhat.com> | 2012-06-19 01:54:20 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-06-19 18:00:24 -0400 |
commit | 2fcdb2c9e6598e6ced232eca7aa4a61342691f3b (patch) | |
tree | 2e430f1b75bac5bbf380e5731ab38ebc246e1c30 /drivers/net/team | |
parent | 35b384bd14f91c74e358e02969ee7bb2542e6d78 (diff) |
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 <jpirko@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/team')
-rw-r--r-- | drivers/net/team/team.c | 33 |
1 files changed, 9 insertions, 24 deletions
diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c index a7b391dfb3b0..3a4a74be52d9 100644 --- a/drivers/net/team/team.c +++ b/drivers/net/team/team.c | |||
@@ -320,8 +320,6 @@ static void __team_options_unregister(struct team *team, | |||
320 | } | 320 | } |
321 | 321 | ||
322 | static void __team_options_change_check(struct team *team); | 322 | 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); | ||
325 | 323 | ||
326 | int team_options_register(struct team *team, | 324 | int team_options_register(struct team *team, |
327 | const struct team_option *option, | 325 | const struct team_option *option, |
@@ -360,16 +358,9 @@ static int team_option_set(struct team *team, | |||
360 | struct team_option_inst *opt_inst, | 358 | struct team_option_inst *opt_inst, |
361 | struct team_gsetter_ctx *ctx) | 359 | struct team_gsetter_ctx *ctx) |
362 | { | 360 | { |
363 | int err; | ||
364 | |||
365 | if (!opt_inst->option->setter) | 361 | if (!opt_inst->option->setter) |
366 | return -EOPNOTSUPP; | 362 | return -EOPNOTSUPP; |
367 | err = opt_inst->option->setter(team, ctx); | 363 | return opt_inst->option->setter(team, ctx); |
368 | if (err) | ||
369 | return err; | ||
370 | |||
371 | __team_option_inst_change(team, opt_inst); | ||
372 | return err; | ||
373 | } | 364 | } |
374 | 365 | ||
375 | void team_option_inst_set_change(struct team_option_inst_info *opt_inst_info) | 366 | 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 | return err; | 1741 | return err; |
1751 | } | 1742 | } |
1752 | 1743 | ||
1744 | static int team_nl_send_event_options_get(struct team *team, | ||
1745 | struct list_head *sel_opt_inst_list); | ||
1746 | |||
1753 | static int team_nl_cmd_options_set(struct sk_buff *skb, struct genl_info *info) | 1747 | static int team_nl_cmd_options_set(struct sk_buff *skb, struct genl_info *info) |
1754 | { | 1748 | { |
1755 | struct team *team; | 1749 | struct team *team; |
1756 | int err = 0; | 1750 | int err = 0; |
1757 | int i; | 1751 | int i; |
1758 | struct nlattr *nl_option; | 1752 | struct nlattr *nl_option; |
1753 | LIST_HEAD(opt_inst_list); | ||
1759 | 1754 | ||
1760 | team = team_nl_team_get(info); | 1755 | team = team_nl_team_get(info); |
1761 | if (!team) | 1756 | if (!team) |
@@ -1867,6 +1862,8 @@ static int team_nl_cmd_options_set(struct sk_buff *skb, struct genl_info *info) | |||
1867 | err = team_option_set(team, opt_inst, &ctx); | 1862 | err = team_option_set(team, opt_inst, &ctx); |
1868 | if (err) | 1863 | if (err) |
1869 | goto team_put; | 1864 | goto team_put; |
1865 | opt_inst->changed = true; | ||
1866 | list_add(&opt_inst->tmp_list, &opt_inst_list); | ||
1870 | } | 1867 | } |
1871 | if (!opt_found) { | 1868 | if (!opt_found) { |
1872 | err = -ENOENT; | 1869 | err = -ENOENT; |
@@ -1874,6 +1871,8 @@ static int team_nl_cmd_options_set(struct sk_buff *skb, struct genl_info *info) | |||
1874 | } | 1871 | } |
1875 | } | 1872 | } |
1876 | 1873 | ||
1874 | err = team_nl_send_event_options_get(team, &opt_inst_list); | ||
1875 | |||
1877 | team_put: | 1876 | team_put: |
1878 | team_nl_team_put(team); | 1877 | team_nl_team_put(team); |
1879 | 1878 | ||
@@ -2074,20 +2073,6 @@ static void __team_options_change_check(struct team *team) | |||
2074 | err); | 2073 | err); |
2075 | } | 2074 | } |
2076 | 2075 | ||
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 | |||
2091 | /* rtnl lock is held */ | 2076 | /* rtnl lock is held */ |
2092 | static void __team_port_change_check(struct team_port *port, bool linkup) | 2077 | static void __team_port_change_check(struct team_port *port, bool linkup) |
2093 | { | 2078 | { |