All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jiri Pirko <jiri@resnulli.us>
To: netdev@vger.kernel.org
Cc: davem@davemloft.net, idosch@mellanox.com, eladr@mellanox.com,
	yotamg@mellanox.com, ogerlitz@mellanox.com
Subject: [patch net-next 07/26] net: add possibility to pass information about upper device via notifier
Date: Tue,  1 Dec 2015 14:48:45 +0100	[thread overview]
Message-ID: <1448977744-17930-8-git-send-email-jiri@resnulli.us> (raw)
In-Reply-To: <1448977744-17930-1-git-send-email-jiri@resnulli.us>

From: Jiri Pirko <jiri@mellanox.com>

Sometimes the drivers and other code would find it handy to know some
internal information about upper device being changed. So allow upper-code
to pass information down to notifier listeners during linking.

Signed-off-by: Jiri Pirko <jiri@mellanox.com>
---
 drivers/net/bonding/bond_main.c |  2 +-
 drivers/net/team/team.c         |  2 +-
 drivers/net/vrf.c               |  2 +-
 include/linux/netdevice.h       |  3 ++-
 net/batman-adv/hard-interface.c |  2 +-
 net/bridge/br_if.c              |  2 +-
 net/core/dev.c                  | 11 +++++++----
 net/openvswitch/vport-netdev.c  |  2 +-
 8 files changed, 15 insertions(+), 11 deletions(-)

diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 9240157..fa3ed1d 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -1204,7 +1204,7 @@ static int bond_master_upper_dev_link(struct net_device *bond_dev,
 {
 	int err;
 
-	err = netdev_master_upper_dev_link(slave_dev, bond_dev, slave);
+	err = netdev_master_upper_dev_link(slave_dev, bond_dev, slave, NULL);
 	if (err)
 		return err;
 	slave_dev->flags |= IFF_SLAVE;
diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c
index b37f8d1..f7b6ff7 100644
--- a/drivers/net/team/team.c
+++ b/drivers/net/team/team.c
@@ -1083,7 +1083,7 @@ static int team_upper_dev_link(struct net_device *dev,
 {
 	int err;
 
-	err = netdev_master_upper_dev_link(port_dev, dev, NULL);
+	err = netdev_master_upper_dev_link(port_dev, dev, NULL, NULL);
 	if (err)
 		return err;
 	port_dev->priv_flags |= IFF_TEAM_PORT;
diff --git a/drivers/net/vrf.c b/drivers/net/vrf.c
index 59c5bdd..8944a49 100644
--- a/drivers/net/vrf.c
+++ b/drivers/net/vrf.c
@@ -624,7 +624,7 @@ static int do_vrf_add_slave(struct net_device *dev, struct net_device *port_dev)
 		goto out_fail;
 	}
 
-	ret = netdev_master_upper_dev_link(port_dev, dev, NULL);
+	ret = netdev_master_upper_dev_link(port_dev, dev, NULL, NULL);
 	if (ret < 0)
 		goto out_unregister;
 
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index cca4111..a55be5b 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -2161,6 +2161,7 @@ struct netdev_notifier_changeupper_info {
 	struct net_device *upper_dev; /* new upper dev */
 	bool master; /* is upper dev master */
 	bool linking; /* is the nofication for link or unlink */
+	void *upper_info; /* is upper dev info */
 };
 
 static inline void netdev_notifier_info_init(struct netdev_notifier_info *info,
@@ -3618,7 +3619,7 @@ struct net_device *netdev_master_upper_dev_get_rcu(struct net_device *dev);
 int netdev_upper_dev_link(struct net_device *dev, struct net_device *upper_dev);
 int netdev_master_upper_dev_link(struct net_device *dev,
 				 struct net_device *upper_dev,
-				 void *upper_priv);
+				 void *upper_priv, void *upper_info);
 void netdev_upper_dev_unlink(struct net_device *dev,
 			     struct net_device *upper_dev);
 void netdev_adjacent_rename_links(struct net_device *dev, char *oldname);
diff --git a/net/batman-adv/hard-interface.c b/net/batman-adv/hard-interface.c
index a7f4f10..aa8867e 100644
--- a/net/batman-adv/hard-interface.c
+++ b/net/batman-adv/hard-interface.c
@@ -465,7 +465,7 @@ int batadv_hardif_enable_interface(struct batadv_hard_iface *hard_iface,
 	bat_priv = netdev_priv(hard_iface->soft_iface);
 
 	ret = netdev_master_upper_dev_link(hard_iface->net_dev,
-					   soft_iface, NULL);
+					   soft_iface, NULL, NULL);
 	if (ret)
 		goto err_dev;
 
diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c
index 781abc34..8d1d4a2 100644
--- a/net/bridge/br_if.c
+++ b/net/bridge/br_if.c
@@ -493,7 +493,7 @@ int br_add_if(struct net_bridge *br, struct net_device *dev)
 
 	dev->priv_flags |= IFF_BRIDGE_PORT;
 
-	err = netdev_master_upper_dev_link(dev, br->dev, NULL);
+	err = netdev_master_upper_dev_link(dev, br->dev, NULL, NULL);
 	if (err)
 		goto err5;
 
diff --git a/net/core/dev.c b/net/core/dev.c
index d2155c2..3fe1ce2 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -5421,7 +5421,7 @@ static void __netdev_adjacent_dev_unlink_neighbour(struct net_device *dev,
 
 static int __netdev_upper_dev_link(struct net_device *dev,
 				   struct net_device *upper_dev, bool master,
-				   void *upper_priv)
+				   void *upper_priv, void *upper_info)
 {
 	struct netdev_notifier_changeupper_info changeupper_info;
 	struct netdev_adjacent *i, *j, *to_i, *to_j;
@@ -5445,6 +5445,7 @@ static int __netdev_upper_dev_link(struct net_device *dev,
 	changeupper_info.upper_dev = upper_dev;
 	changeupper_info.master = master;
 	changeupper_info.linking = true;
+	changeupper_info.upper_info = upper_info;
 
 	ret = call_netdevice_notifiers_info(NETDEV_PRECHANGEUPPER, dev,
 					    &changeupper_info.info);
@@ -5545,7 +5546,7 @@ rollback_mesh:
 int netdev_upper_dev_link(struct net_device *dev,
 			  struct net_device *upper_dev)
 {
-	return __netdev_upper_dev_link(dev, upper_dev, false, NULL);
+	return __netdev_upper_dev_link(dev, upper_dev, false, NULL, NULL);
 }
 EXPORT_SYMBOL(netdev_upper_dev_link);
 
@@ -5554,6 +5555,7 @@ EXPORT_SYMBOL(netdev_upper_dev_link);
  * @dev: device
  * @upper_dev: new upper device
  * @upper_priv: upper device private
+ * @upper_info: upper info to be passed down via notifier
  *
  * Adds a link to device which is upper to this one. In this case, only
  * one master upper device can be linked, although other non-master devices
@@ -5563,9 +5565,10 @@ EXPORT_SYMBOL(netdev_upper_dev_link);
  */
 int netdev_master_upper_dev_link(struct net_device *dev,
 				 struct net_device *upper_dev,
-				 void *upper_priv)
+				 void *upper_priv, void *upper_info)
 {
-	return __netdev_upper_dev_link(dev, upper_dev, true, upper_priv);
+	return __netdev_upper_dev_link(dev, upper_dev, true,
+				       upper_priv, upper_info);
 }
 EXPORT_SYMBOL(netdev_master_upper_dev_link);
 
diff --git a/net/openvswitch/vport-netdev.c b/net/openvswitch/vport-netdev.c
index 3ee3df1..8f4dd4c 100644
--- a/net/openvswitch/vport-netdev.c
+++ b/net/openvswitch/vport-netdev.c
@@ -105,7 +105,7 @@ struct vport *ovs_netdev_link(struct vport *vport, const char *name)
 
 	rtnl_lock();
 	err = netdev_master_upper_dev_link(vport->dev,
-					   get_dpdev(vport->dp), NULL);
+					   get_dpdev(vport->dp), NULL, NULL);
 	if (err)
 		goto error_unlock;
 
-- 
1.9.3

  parent reply	other threads:[~2015-12-01 13:49 UTC|newest]

Thread overview: 63+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-01 13:48 [patch net-next 00/26] bonding/team offload + mlxsw implementation Jiri Pirko
2015-12-01 13:48 ` [patch net-next 01/26] bonding: add 802.3ad support for 100G speeds Jiri Pirko
2015-12-01 13:48 ` [patch net-next 02/26] net: add netif_is_team_master helper Jiri Pirko
2015-12-01 13:48 ` [patch net-next 03/26] net: add netif_is_team_port helper Jiri Pirko
2015-12-01 13:48 ` [patch net-next 04/26] net: add netif_is_lag_master helper Jiri Pirko
2015-12-01 13:48 ` [patch net-next 05/26] net: add netif_is_lag_port helper Jiri Pirko
2015-12-01 13:48 ` [patch net-next 06/26] net: propagate upper priv via netdev_master_upper_dev_link Jiri Pirko
2015-12-01 13:48 ` Jiri Pirko [this message]
2015-12-02  5:28   ` [patch net-next 07/26] net: add possibility to pass information about upper device via notifier Or Gerlitz
2015-12-02  7:54     ` Jiri Pirko
2015-12-02  8:17       ` Or Gerlitz
2015-12-02 17:29         ` Jiri Pirko
2015-12-01 13:48 ` [patch net-next 08/26] net: add info struct for LAG changeupper Jiri Pirko
2015-12-02 10:59   ` Nikolay Aleksandrov
2015-12-02 11:06     ` Jiri Pirko
2015-12-02 11:07       ` Nikolay Aleksandrov
2015-12-02 11:11         ` Jiri Pirko
2015-12-01 13:48 ` [patch net-next 09/26] team: fill-up LAG changeupper info struct and pass it along Jiri Pirko
2015-12-02  5:36   ` Or Gerlitz
2015-12-02  7:55     ` Jiri Pirko
2015-12-01 13:48 ` [patch net-next 10/26] bonding: " Jiri Pirko
2015-12-02 11:00   ` Nikolay Aleksandrov
2015-12-02 11:07     ` Jiri Pirko
2015-12-01 13:48 ` [patch net-next 11/26] net: introduce change lower state notifier Jiri Pirko
2015-12-01 13:48 ` [patch net-next 12/26] net: introduce lower state changed info structure for LAG lowers Jiri Pirko
2015-12-01 13:48 ` [patch net-next 13/26] team: rtnl_lock for options set Jiri Pirko
2015-12-01 13:48 ` [patch net-next 14/26] team: implement lower state change propagation Jiri Pirko
2015-12-01 13:48 ` [patch net-next 15/26] bonding: allow notifications for bond_set_slave_link_state Jiri Pirko
2015-12-02 11:27   ` Nikolay Aleksandrov
2015-12-02 11:48     ` Jiri Pirko
2015-12-01 13:48 ` [patch net-next 16/26] bonding: implement lower state change propagation Jiri Pirko
2015-12-02 11:40   ` Nikolay Aleksandrov
2015-12-02 11:47     ` Nikolay Aleksandrov
2015-12-02 11:56     ` Jiri Pirko
2015-12-01 13:48 ` [patch net-next 17/26] bonding: set inactive flags on release Jiri Pirko
2015-12-01 13:48 ` [patch net-next 18/26] mlxsw: spectrum: Add set_rx_mode ndo stub Jiri Pirko
2015-12-01 13:48 ` [patch net-next 19/26] mlxsw: core: Add support for packets received from LAG port Jiri Pirko
2015-12-01 13:48 ` [patch net-next 20/26] mlxsw: pci: Implement LAG processing for received packets Jiri Pirko
2015-12-01 13:48 ` [patch net-next 21/26] mlxsw: reg: Add link aggregation configuration registers definitions Jiri Pirko
2015-12-01 13:49 ` [patch net-next 22/26] mlxsw: reg: Add definition of LAG unicast record for SFD register Jiri Pirko
2015-12-01 13:49 ` [patch net-next 23/26] mlxsw: reg: Add definition of LAG unicast record for SFN register Jiri Pirko
2015-12-01 13:49 ` [patch net-next 24/26] mlxsw: spectrum: Implement LAG port join/leave Jiri Pirko
2015-12-02  5:47   ` Or Gerlitz
2015-12-02  7:57     ` Jiri Pirko
2015-12-02 17:30     ` David Miller
2015-12-02 17:35       ` Jiri Pirko
2015-12-02 14:01   ` Andy Gospodarek
2015-12-02 14:10     ` Jiri Pirko
2015-12-02 14:26       ` Andy Gospodarek
2015-12-02 15:28         ` Jiri Pirko
2015-12-01 13:49 ` [patch net-next 25/26] mlxsw: spectrum: Implement FDB add/remove/dump for LAG Jiri Pirko
2015-12-01 13:49 ` [patch net-next 26/26] mlxsw: spectrum: Implement LAG tx enabled lower state change Jiri Pirko
2015-12-01 14:43 ` [patch net-next 00/26] bonding/team offload + mlxsw implementation Jiri Pirko
2015-12-01 15:06   ` Or Gerlitz
2015-12-01 15:12     ` Jiri Pirko
2015-12-01 16:35       ` Or Gerlitz
2015-12-01 16:47         ` Jiri Pirko
2015-12-02  5:53           ` Or Gerlitz
2015-12-02  7:58             ` Jiri Pirko
2015-12-02  8:21               ` Or Gerlitz
2015-12-02  8:25                 ` Jiri Pirko
2015-12-02  8:25               ` Or Gerlitz
2015-12-02 15:27             ` Andrew Lunn

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=1448977744-17930-8-git-send-email-jiri@resnulli.us \
    --to=jiri@resnulli.us \
    --cc=davem@davemloft.net \
    --cc=eladr@mellanox.com \
    --cc=idosch@mellanox.com \
    --cc=netdev@vger.kernel.org \
    --cc=ogerlitz@mellanox.com \
    --cc=yotamg@mellanox.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.