From: Jiri Pirko <jpirko@redhat.com>
To: netdev@vger.kernel.org
Cc: davem@davemloft.net, eric.dumazet@gmail.com, jbrouer@redhat.com
Subject: [patch net-next 18/19] team: allow to send multiple set events in one message
Date: Tue, 19 Jun 2012 17:54:20 +0200 [thread overview]
Message-ID: <1340121261-2966-19-git-send-email-jpirko@redhat.com> (raw)
In-Reply-To: <1340121261-2966-1-git-send-email-jpirko@redhat.com>
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>
---
drivers/net/team/team.c | 33 +++++++++------------------------
1 file changed, 9 insertions(+), 24 deletions(-)
diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c
index a7b391d..3a4a74b 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,
}
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,
const struct team_option *option,
@@ -360,16 +358,9 @@ static int team_option_set(struct team *team,
struct team_option_inst *opt_inst,
struct team_gsetter_ctx *ctx)
{
- int err;
-
if (!opt_inst->option->setter)
return -EOPNOTSUPP;
- err = opt_inst->option->setter(team, ctx);
- if (err)
- return err;
-
- __team_option_inst_change(team, opt_inst);
- return err;
+ return opt_inst->option->setter(team, ctx);
}
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)
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)
{
struct team *team;
int err = 0;
int i;
struct nlattr *nl_option;
+ LIST_HEAD(opt_inst_list);
team = team_nl_team_get(info);
if (!team)
@@ -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);
if (err)
goto team_put;
+ opt_inst->changed = true;
+ list_add(&opt_inst->tmp_list, &opt_inst_list);
}
if (!opt_found) {
err = -ENOENT;
@@ -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_nl_team_put(team);
@@ -2074,20 +2073,6 @@ static void __team_options_change_check(struct team *team)
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 */
static void __team_port_change_check(struct team_port *port, bool linkup)
{
--
1.7.10.2
next prev parent reply other threads:[~2012-06-19 15:54 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-19 15:54 [patch net-next 00/19] team: couple of patches Jiri Pirko
2012-06-19 15:54 ` [patch net-next 01/19] team: make team_mode struct const Jiri Pirko
2012-06-19 15:54 ` [patch net-next 02/19] team: for nomode use dummy struct team_mode Jiri Pirko
2012-06-19 15:54 ` [patch net-next 03/19] team: add mode priv to port Jiri Pirko
2012-06-19 15:54 ` [patch net-next 04/19] team: lb: push hash counting into separate function Jiri Pirko
2012-06-19 15:54 ` [patch net-next 05/19] team: allow read/write-only options Jiri Pirko
2012-06-19 15:54 ` [patch net-next 06/19] team: introduce array options Jiri Pirko
2012-06-19 15:54 ` [patch net-next 07/19] team: comments: s/net\/drivers\/team/drivers\/net\/team/ Jiri Pirko
2012-06-19 15:54 ` [patch net-next 08/19] team: push array_index and port into separate structure Jiri Pirko
2012-06-19 15:54 ` [patch net-next 09/19] team: allow async option changes Jiri Pirko
2012-06-19 15:54 ` [patch net-next 10/19] team: fix error path in team_nl_fill_options_get() Jiri Pirko
2012-06-19 15:54 ` [patch net-next 11/19] team: fix error path in team_nl_fill_port_list_get() Jiri Pirko
2012-06-19 15:54 ` [patch net-next 12/19] team: allow to specify one option instance to be send to userspace Jiri Pirko
2012-06-19 15:54 ` [patch net-next 13/19] team: pass NULL to __team_option_inst_add() instead of 0 Jiri Pirko
2012-06-19 15:54 ` [patch net-next 14/19] team: add port_[enabled/disabled] mode callbacks Jiri Pirko
2012-06-19 15:54 ` [patch net-next 15/19] team: lb: introduce infrastructure for userspace driven tx loadbalancing Jiri Pirko
2012-06-19 15:54 ` [patch net-next 16/19] team: implement multipart netlink messages for options transfers Jiri Pirko
2012-06-19 15:54 ` [patch net-next 17/19] team: ensure correct order of netlink messages delivery Jiri Pirko
2012-06-19 15:54 ` Jiri Pirko [this message]
2012-06-19 15:54 ` [patch net-next 19/19] team: use rcu_dereference_bh() in tx path Jiri Pirko
2012-06-19 22:01 ` [patch net-next 00/19] team: couple of patches David Miller
2012-06-20 6:40 ` Jesper Dangaard Brouer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1340121261-2966-19-git-send-email-jpirko@redhat.com \
--to=jpirko@redhat.com \
--cc=davem@davemloft.net \
--cc=eric.dumazet@gmail.com \
--cc=jbrouer@redhat.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).