netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
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 17/19] team: ensure correct order of netlink messages delivery
Date: Tue, 19 Jun 2012 17:54:19 +0200	[thread overview]
Message-ID: <1340121261-2966-18-git-send-email-jpirko@redhat.com> (raw)
In-Reply-To: <1340121261-2966-1-git-send-email-jpirko@redhat.com>

currently, when port is created and per-port options are present, there
options are sent to userspace with ifindex of port which userspace does
not know about. Port add message goes right after.

This patch corrects message ordering so userspace would not be confused.

Signed-off-by: Jiri Pirko <jpirko@redhat.com>
---
 drivers/net/team/team.c |   25 +++++--------------------
 1 file changed, 5 insertions(+), 20 deletions(-)

diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c
index 9e9d3e5..a7b391d 100644
--- a/drivers/net/team/team.c
+++ b/drivers/net/team/team.c
@@ -347,24 +347,6 @@ void team_options_unregister(struct team *team,
 }
 EXPORT_SYMBOL(team_options_unregister);
 
-static int team_option_port_add(struct team *team, struct team_port *port)
-{
-	int err;
-
-	err = __team_option_inst_add_port(team, port);
-	if (err)
-		return err;
-	__team_options_change_check(team);
-	return 0;
-}
-
-static void team_option_port_del(struct team *team, struct team_port *port)
-{
-	__team_option_inst_mark_removed_port(team, port);
-	__team_options_change_check(team);
-	__team_option_inst_del_port(team, port);
-}
-
 static int team_option_get(struct team *team,
 			   struct team_option_inst *opt_inst,
 			   struct team_gsetter_ctx *ctx)
@@ -891,7 +873,7 @@ static int team_port_add(struct team *team, struct net_device *port_dev)
 		goto err_handler_register;
 	}
 
-	err = team_option_port_add(team, port);
+	err = __team_option_inst_add_port(team, port);
 	if (err) {
 		netdev_err(dev, "Device %s failed to add per-port options\n",
 			   portname);
@@ -904,6 +886,7 @@ static int team_port_add(struct team *team, struct net_device *port_dev)
 	team_adjust_ops(team);
 	__team_compute_features(team);
 	__team_port_change_check(port, !!netif_carrier_ok(port_dev));
+	__team_options_change_check(team);
 
 	netdev_info(dev, "Port device %s added\n", portname);
 
@@ -947,12 +930,14 @@ static int team_port_del(struct team *team, struct net_device *port_dev)
 		return -ENOENT;
 	}
 
+	__team_option_inst_mark_removed_port(team, port);
+	__team_options_change_check(team);
+	__team_option_inst_del_port(team, port);
 	port->removed = true;
 	__team_port_change_check(port, false);
 	team_port_disable(team, port);
 	list_del_rcu(&port->list);
 	team_adjust_ops(team);
-	team_option_port_del(team, port);
 	netdev_rx_handler_unregister(port_dev);
 	netdev_set_master(port_dev, NULL);
 	vlan_vids_del_by_dev(port_dev, dev);
-- 
1.7.10.2

  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 ` Jiri Pirko [this message]
2012-06-19 15:54 ` [patch net-next 18/19] team: allow to send multiple set events in one message Jiri Pirko
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-18-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).