Skip to contentSkip to conversation

Intel Wired LAN Driver Updates

GIT PULL NAK Jeff Kirsher 2 participants 5 messages Nov 19, 2013

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

This series contains updates to net and igb.

John provides a patch against net to be able to walk all upper devices when bringing a device online where the RTNL lock is held.

Akeem provides a igb fix where WOL was being reported as supported on some ethernet devices which did not have that capability.

Carolyn provides a igb fix to add a call to dev_close if the queue reinit fails in order to make it clear to the user that the device is down.

The following are changes since commit d11a347de3f521af62da25e74156ea39e3774f19:
be2net: Delete secondary unicast MAC addresses during be_close
and are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/net master

Akeem G Abodunrin (1):
igb: Fixed Wake On Lan support

Carolyn Wyborny (1):
igb: Update queue reinit function to call dev_close when init of
queues fails

John Fastabend (1):
net: allow netdev_all_upper_get_next_dev_rcu with rtnl lock held

 drivers/net/ethernet/intel/igb/igb_ethtool.c  |  7 +++--
 drivers/net/ethernet/intel/igb/igb_main.c     |  1 +
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c |  6 ++--
 include/linux/netdevice.h                     |  9 ++++++
 net/core/dev.c                                | 43 ++++++++++++++++++++-------
 5 files changed, 49 insertions(+), 17 deletions(-)
Signature · 1 line
1.8.3.1
#1 lore raw

PATCH 1/3 net: allow netdev_all_upper_get_next_dev_rcu with rtnl lock held

From: John Fastabend <[email protected]>

It is useful to be able to walk all upper devices when bringing a device online where the RTNL lock is held. In this case it is safe to walk the all_adj_list because the RTNL lock is used to protect the write side as well.

Here we rearrange the netdev_all_upper_get_next_dev_rcu into three routines:

netdev_all_upper_get_next_dev_rcu()
netdev_all_upper_get_next_dev_rtnl()
netdev_all_upper_get_next_dev()

One for RCU callers, one for RTNL callers and a final routine to implement the work. Both the _rcu and _rtnl variants are exposed. Where the net/ethernet/intel/ixgbe driver is a consumer of the _rtnl variant. netdev_all_upper_get_next_dev() is static.

---
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c |  6 ++--
 include/linux/netdevice.h                     |  9 ++++++
 net/core/dev.c                                | 43 ++++++++++++++++++++-------
 3 files changed, 44 insertions(+), 14 deletions(-)
drivers/net/ethernet/intel/ixgbe/ixgbe_main.c +3 -3
index bd8f523..9eeb6f0 100644
@@ -4336,7 +4336,7 @@ static void ixgbe_configure_dfwd(struct ixgbe_adapter *adapter)
 	struct list_head *iter;
 	int err;
 
-	netdev_for_each_all_upper_dev_rcu(adapter->netdev, upper, iter) {
+	netdev_for_each_all_upper_dev_rtnl(adapter->netdev, upper, iter) {
 		if (netif_is_macvlan(upper)) {
 			struct macvlan_dev *dfwd = netdev_priv(upper);
 			struct ixgbe_fwd_adapter *vadapter = dfwd->fwd_priv;
@@ -4601,7 +4601,7 @@ static void ixgbe_up_complete(struct ixgbe_adapter *adapter)
 	netif_tx_start_all_queues(adapter->netdev);
 
 	/* enable any upper devices */
-	netdev_for_each_all_upper_dev_rcu(adapter->netdev, upper, iter) {
+	netdev_for_each_all_upper_dev_rtnl(adapter->netdev, upper, iter) {
 		if (netif_is_macvlan(upper)) {
 			struct macvlan_dev *vlan = netdev_priv(upper);
 
@@ -4803,7 +4803,7 @@ void ixgbe_down(struct ixgbe_adapter *adapter)
 	netif_tx_disable(netdev);
 
 	/* disable any upper devices */
-	netdev_for_each_all_upper_dev_rcu(adapter->netdev, upper, iter) {
+	netdev_for_each_all_upper_dev_rtnl(adapter->netdev, upper, iter) {
 		if (netif_is_macvlan(upper)) {
 			struct macvlan_dev *vlan = netdev_priv(upper);
 
include/linux/netdevice.h +9 -0
index 8b3de7c..59872b2 100644
@@ -2843,6 +2843,8 @@ bool netdev_has_upper_dev(struct net_device *dev, struct net_device *upper_dev);
 bool netdev_has_any_upper_dev(struct net_device *dev);
 struct net_device *netdev_all_upper_get_next_dev_rcu(struct net_device *dev,
 						     struct list_head **iter);
+struct net_device *netdev_all_upper_get_next_dev_rtnl(struct net_device *dev,
+						      struct list_head **iter);
 
 /* iterate through upper list, must be called under RCU read lock */
 #define netdev_for_each_all_upper_dev_rcu(dev, updev, iter) \
@@ -2851,6 +2853,13 @@ struct net_device *netdev_all_upper_get_next_dev_rcu(struct net_device *dev,
 	     updev; \
 	     updev = netdev_all_upper_get_next_dev_rcu(dev, &(iter)))
 
+/* iterate through upper list, must be called under RTNL */
+#define netdev_for_each_all_upper_dev_rtnl(dev, updev, iter) \
+	for (iter = &(dev)->all_adj_list.upper, \
+	     updev = netdev_all_upper_get_next_dev_rtnl(dev, &(iter)); \
+	     updev; \
+	     updev = netdev_all_upper_get_next_dev_rtnl(dev, &(iter)))
+
 void *netdev_lower_get_next_private(struct net_device *dev,
 				    struct list_head **iter);
 void *netdev_lower_get_next_private_rcu(struct net_device *dev,
net/core/dev.c +32 -11

60 lines not on this page · raw message

Signature · 1 line
1.8.3.1
#2 lore raw

Re: [net 1/3] net: allow netdev_all_upper_get_next_dev_rcu with rtnl lock held

Quoted 19 lines · Jeff Kirsher

From: John Fastabend <[email protected]>

It is useful to be able to walk all upper devices when bringing a device online where the RTNL lock is held. In this case it is safe to walk the all_adj_list because the RTNL lock is used to protect the write side as well.

Here we rearrange the netdev_all_upper_get_next_dev_rcu into three routines:

netdev_all_upper_get_next_dev_rcu()
netdev_all_upper_get_next_dev_rtnl()
netdev_all_upper_get_next_dev()

One for RCU callers, one for RTNL callers and a final routine to implement the work. Both the _rcu and _rtnl variants are exposed. Where the net/ethernet/intel/ixgbe driver is a consumer of the _rtnl variant. netdev_all_upper_get_next_dev() is static.

Quoted 5 lines

---

[...]

NAK, lockdep_rtnl_is_held() is wrapped in CONFIG_PROVE_LOCKING,

	#ifdef CONFIG_PROVE_LOCKING
	extern int lockdep_rtnl_is_held(void);
	#endif /* #ifdef CONFIG_PROVE_LOCKING */

[...]

net/core/dev.c EXPORT_SYMBOL(netdev_adjacent_get_private); · line 4532

Quoted 4 lines
net/core/dev.c +4 -0
+struct net_device *netdev_all_upper_get_next_dev_rtnl(struct net_device *dev,
+						      struct list_head **iter)
+{
+	WARN_ON_ONCE(!lockdep_rtnl_is_held());

so this can cause a build error without CONFIG_PROVE_LOCKING. I can either wrap this in a CONFIG_PROVE_LOCKING or do something like this,

extern int rtnl_is_locked(void);
#ifdef CONFIG_PROVE_LOCKING

 	extern int lockdep_rtnl_is_held(void);
	+#else
	+static inline int lockdep_rtnl_is_held(void)
	+{
	+       return 0;
	+}
	 #endif /* #ifdef CONFIG_PROVE_LOCKING */

The lazy way to do this is to wrap the call site in rcu_read_{un}lock but I would prefer not to do that.

Review

Quoted 2 lines
(quoted diff) +2 -0
+	return netdev_all_upper_get_next_dev(dev, iter);
+}

Sorry for the noise I'll spin a new version.

John

Signature · 1 line
John Fastabend         Intel Corporation
#3 lore raw

PATCH 2/3 igb: Fixed Wake On Lan support

In reply to Jeff Kirsher

From: Akeem G Abodunrin <[email protected]>

This patch fixes Wake on Lan being reported as supported on some Ethernet ports, in contrary to Hardware capability.

---
 drivers/net/ethernet/intel/igb/igb_ethtool.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/net/ethernet/intel/igb/igb_ethtool.c +4 -3
index b0f3666..c3143da 100644
@@ -2062,14 +2062,15 @@ static void igb_get_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
 {
 	struct igb_adapter *adapter = netdev_priv(netdev);
 
-	wol->supported = WAKE_UCAST | WAKE_MCAST |
-			 WAKE_BCAST | WAKE_MAGIC |
-			 WAKE_PHY;
 	wol->wolopts = 0;
 
 	if (!(adapter->flags & IGB_FLAG_WOL_SUPPORTED))
 		return;
 
+	wol->supported = WAKE_UCAST | WAKE_MCAST |
+			 WAKE_BCAST | WAKE_MAGIC |
+			 WAKE_PHY;
+
 	/* apply any specific unsupported masks here */
 	switch (adapter->hw.device_id) {
 	default:
Signature · 1 line
1.8.3.1
#4 lore raw

PATCH 3/3 igb: Update queue reinit function to call dev_close when init of queues fails

In reply to Jeff Kirsher

From: Carolyn Wyborny <[email protected]>

This patch adds a call to dev_close if the queue reinit fails in order to make clearer to the user that the device is down.

---
 drivers/net/ethernet/intel/igb/igb_main.c | 1 +
 1 file changed, 1 insertion(+)
drivers/net/ethernet/intel/igb/igb_main.c +1 -0
index ebe6370..40320bd 100644
@@ -7847,6 +7847,7 @@ int igb_reinit_queues(struct igb_adapter *adapter)
 
 	if (igb_init_interrupt_scheme(adapter, true)) {
 		dev_err(&pdev->dev, "Unable to allocate memory for queues\n");
+		dev_close(netdev);
 		return -ENOMEM;
 	}
 
Signature · 1 line
1.8.3.1