Skip to contentSkip to conversation

net: propagate upper priv via netdev_master_upper_dev_link

PATCH Applied Sven Eckelmann 2 participants 6 messages Dec 8, 2015 – Dec 13, 2015 Batman advanced

lore
Share & tools
lore

Sven Eckelmann

author maintainer
#0 lore raw

PATCH 1/3 net: propagate upper priv via netdev_master_upper_dev_link

From: Jiri Pirko <[email protected]>

Eliminate netdev_master_upper_dev_link_private and pass priv directly as a parameter of netdev_master_upper_dev_link.

---
 compat-include/linux/netdevice.h | 7 +++++++
 net/batman-adv/hard-interface.c  | 3 ++-
 2 files changed, 9 insertions(+), 1 deletion(-)
compat-include/linux/netdevice.h +7 -0
index f19f624..a8da7bf 100644
@@ -117,4 +117,11 @@ static inline int batadv_netdev_set_master(struct net_device *slave,
 
 #endif /* < KERNEL_VERSION(3, 19, 0) */
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 5, 0)
+
+#define netdev_master_upper_dev_link(dev, upper_dev, upper_priv) \
+	netdev_master_upper_dev_link(dev, upper_dev)
+
+#endif /* < KERNEL_VERSION(4, 5, 0) */
+
 #endif	/* _NET_BATMAN_ADV_COMPAT_LINUX_NETDEVICE_H_ */
net/batman-adv/hard-interface.c +2 -1
index bef9147..484c50e 100644
@@ -466,7 +466,8 @@ int batadv_hardif_enable_interface(struct batadv_hard_iface *hard_iface,
 	hard_iface->soft_iface = soft_iface;
 	bat_priv = netdev_priv(hard_iface->soft_iface);
 
-	ret = netdev_master_upper_dev_link(hard_iface->net_dev, soft_iface);
+	ret = netdev_master_upper_dev_link(hard_iface->net_dev,
+					   soft_iface, NULL);
 	if (ret)
 		goto err_dev;
 
Signature · 1 line
2.6.2
author maintainer
#1 lore raw

PATCH 2/3 net: add possibility to pass information about upper device via notifier

From: Jiri Pirko <[email protected]>

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.

---
 compat-include/linux/netdevice.h | 2 +-
 net/batman-adv/hard-interface.c  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
compat-include/linux/netdevice.h +1 -1
index a8da7bf..34e5ac7 100644
@@ -119,7 +119,7 @@ static inline int batadv_netdev_set_master(struct net_device *slave,
 
 #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 5, 0)
 
-#define netdev_master_upper_dev_link(dev, upper_dev, upper_priv) \
+#define netdev_master_upper_dev_link(dev, upper_dev, upper_priv, upper_info) \
 	netdev_master_upper_dev_link(dev, upper_dev)
 
 #endif /* < KERNEL_VERSION(4, 5, 0) */
net/batman-adv/hard-interface.c +1 -1
index 484c50e..2d1470f 100644
@@ -467,7 +467,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;
 
Signature · 1 line
2.6.2
#2 lore raw

Re: [B.A.T.M.A.N.] [PATCH-next 2/3] net: add possibility to pass information about upper device via notifier

Quoted 6 lines · On Tuesday, December 08, 2015 21:35:14 Sven Eckelmann wrote:

From: Jiri Pirko <[email protected]>

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.

Quoted 6 lines
---
 compat-include/linux/netdevice.h | 2 +-
 net/batman-adv/hard-interface.c  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Applied in revision 4291a5b.

Thanks,
Marek

author maintainer
#3 lore raw

PATCH 3/3 batman-adv: Act on NETDEV_*_TYPE_CHANGE events

In reply to Sven Eckelmann

From: Andrew Lunn <[email protected]>

A network interface can change type. It may change from a type which batman does not support, e.g. hdlc, to one it does, e.g. hdlc-eth. When an interface changes type, it sends two notifications. Handle these notifications.

---
 compat-include/linux/netdevice.h | 3 +++
 net/batman-adv/hard-interface.c  | 4 +++-
 2 files changed, 6 insertions(+), 1 deletion(-)
compat-include/linux/netdevice.h +3 -0
index 34e5ac7..10253e0 100644
@@ -58,6 +58,9 @@ struct batadv_dev_addr_list {
 	int da_gusers;
 };
 
+#define NETDEV_PRE_TYPE_CHANGE	0x000E
+#define NETDEV_POST_TYPE_CHANGE	0x000F
+
 #endif /* < KERNEL_VERSION(2, 6, 35) */
 
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 36)
net/batman-adv/hard-interface.c +3 -1
index 2d1470f..49e05d2 100644
@@ -714,7 +714,8 @@ static int batadv_hard_if_event(struct notifier_block *this,
 	}
 
 	hard_iface = batadv_hardif_get_by_netdev(net_dev);
-	if (!hard_iface && event == NETDEV_REGISTER)
+	if (!hard_iface && (event == NETDEV_REGISTER ||
+			    event == NETDEV_POST_TYPE_CHANGE))
 		hard_iface = batadv_hardif_add_interface(net_dev);
 
 	if (!hard_iface)
@@ -729,6 +730,7 @@ static int batadv_hard_if_event(struct notifier_block *this,
 		batadv_hardif_deactivate_interface(hard_iface);
 		break;
 	case NETDEV_UNREGISTER:
+	case NETDEV_PRE_TYPE_CHANGE:
 		list_del_rcu(&hard_iface->list);
 
 		batadv_hardif_remove_interface(hard_iface);
Signature · 1 line
2.6.2
#4 lore raw

Re: [B.A.T.M.A.N.] [PATCH-next 3/3] batman-adv: Act on NETDEV_*_TYPE_CHANGE events

Quoted 7 lines · On Tuesday, December 08, 2015 21:35:58 Sven Eckelmann wrote:

From: Andrew Lunn <[email protected]>

A network interface can change type. It may change from a type which batman does not support, e.g. hdlc, to one it does, e.g. hdlc-eth. When an interface changes type, it sends two notifications. Handle these notifications.

Quoted 6 lines
---
 compat-include/linux/netdevice.h | 3 +++
 net/batman-adv/hard-interface.c  | 4 +++-
 2 files changed, 6 insertions(+), 1 deletion(-)

Applied in revision 399bf29.

Thanks,
Marek

#5 lore raw
In reply to Sven Eckelmann
Quoted 11 lines · On Tuesday, December 08, 2015 21:35:13 Sven Eckelmann wrote:

From: Jiri Pirko <[email protected]>

Eliminate netdev_master_upper_dev_link_private and pass priv directly as a parameter of netdev_master_upper_dev_link.

---
 compat-include/linux/netdevice.h | 7 +++++++
 net/batman-adv/hard-interface.c  | 3 ++-
 2 files changed, 9 insertions(+), 1 deletion(-)

Applied in revision d794c1c.

Thanks,
Marek