netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [net 0/3][pull request] Intel Wired LAN Driver Updates
@ 2013-11-19 15:40 Jeff Kirsher
  2013-11-19 15:40 ` [net 1/3] net: allow netdev_all_upper_get_next_dev_rcu with rtnl lock held Jeff Kirsher
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Jeff Kirsher @ 2013-11-19 15:40 UTC (permalink / raw)
  To: davem; +Cc: Jeff Kirsher, netdev, gospo, sassmann

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(-)

-- 
1.8.3.1

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [net 1/3] net: allow netdev_all_upper_get_next_dev_rcu with rtnl lock held
  2013-11-19 15:40 [net 0/3][pull request] Intel Wired LAN Driver Updates Jeff Kirsher
@ 2013-11-19 15:40 ` Jeff Kirsher
  2013-11-19 17:18   ` John Fastabend
  2013-11-19 15:40 ` [net 2/3] igb: Fixed Wake On Lan support Jeff Kirsher
  2013-11-19 15:40 ` [net 3/3] igb: Update queue reinit function to call dev_close when init of queues fails Jeff Kirsher
  2 siblings, 1 reply; 5+ messages in thread
From: Jeff Kirsher @ 2013-11-19 15:40 UTC (permalink / raw)
  To: davem
  Cc: John Fastabend, netdev, gospo, sassmann, Veaceslav Falico,
	Jeff Kirsher

From: John Fastabend <john.r.fastabend@intel.com>

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.

CC: Veaceslav Falico <vfalico@redhat.com>
Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 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(-)

diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index bd8f523..9eeb6f0 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -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);
 
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 8b3de7c..59872b2 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -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,
diff --git a/net/core/dev.c b/net/core/dev.c
index 7e00a73..79c4c1e 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -4487,6 +4487,21 @@ void *netdev_adjacent_get_private(struct list_head *adj_list)
 }
 EXPORT_SYMBOL(netdev_adjacent_get_private);
 
+static struct net_device *netdev_all_upper_get_next_dev(struct net_device *dev,
+							struct list_head **iter)
+{
+	struct netdev_adjacent *upper;
+
+	upper = list_entry_rcu((*iter)->next, struct netdev_adjacent, list);
+
+	if (&upper->list == &dev->all_adj_list.upper)
+		return NULL;
+
+	*iter = &upper->list;
+
+	return upper->dev;
+}
+
 /**
  * netdev_all_upper_get_next_dev_rcu - Get the next dev from upper list
  * @dev: device
@@ -4498,22 +4513,28 @@ EXPORT_SYMBOL(netdev_adjacent_get_private);
 struct net_device *netdev_all_upper_get_next_dev_rcu(struct net_device *dev,
 						     struct list_head **iter)
 {
-	struct netdev_adjacent *upper;
-
 	WARN_ON_ONCE(!rcu_read_lock_held());
-
-	upper = list_entry_rcu((*iter)->next, struct netdev_adjacent, list);
-
-	if (&upper->list == &dev->all_adj_list.upper)
-		return NULL;
-
-	*iter = &upper->list;
-
-	return upper->dev;
+	return netdev_all_upper_get_next_dev(dev, iter);
 }
 EXPORT_SYMBOL(netdev_all_upper_get_next_dev_rcu);
 
 /**
+ * netdev_all_upper_get_next_dev_rtnl - Get the next dev from upper list
+ * @dev: device
+ * @iter: list_head ** of the current position
+ *
+ * Gets the next device from the dev's upper list, starting from iter
+ * position. The caller must hold RTNL.
+ */
+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());
+	return netdev_all_upper_get_next_dev(dev, iter);
+}
+EXPORT_SYMBOL(netdev_all_upper_get_next_dev_rtnl);
+
+/**
  * netdev_lower_get_next_private - Get the next ->private from the
  *				   lower neighbour list
  * @dev: device
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [net 2/3] igb: Fixed Wake On Lan support
  2013-11-19 15:40 [net 0/3][pull request] Intel Wired LAN Driver Updates Jeff Kirsher
  2013-11-19 15:40 ` [net 1/3] net: allow netdev_all_upper_get_next_dev_rcu with rtnl lock held Jeff Kirsher
@ 2013-11-19 15:40 ` Jeff Kirsher
  2013-11-19 15:40 ` [net 3/3] igb: Update queue reinit function to call dev_close when init of queues fails Jeff Kirsher
  2 siblings, 0 replies; 5+ messages in thread
From: Jeff Kirsher @ 2013-11-19 15:40 UTC (permalink / raw)
  To: davem; +Cc: Akeem G Abodunrin, netdev, gospo, sassmann, Jeff Kirsher

From: Akeem G Abodunrin <akeem.g.abodunrin@intel.com>

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

Signed-off-by: Akeem G Abodunrin <akeem.g.abodunrin@intel.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/igb/igb_ethtool.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/intel/igb/igb_ethtool.c b/drivers/net/ethernet/intel/igb/igb_ethtool.c
index b0f3666..c3143da 100644
--- a/drivers/net/ethernet/intel/igb/igb_ethtool.c
+++ b/drivers/net/ethernet/intel/igb/igb_ethtool.c
@@ -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:
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [net 3/3] igb: Update queue reinit function to call dev_close when init of queues fails
  2013-11-19 15:40 [net 0/3][pull request] Intel Wired LAN Driver Updates Jeff Kirsher
  2013-11-19 15:40 ` [net 1/3] net: allow netdev_all_upper_get_next_dev_rcu with rtnl lock held Jeff Kirsher
  2013-11-19 15:40 ` [net 2/3] igb: Fixed Wake On Lan support Jeff Kirsher
@ 2013-11-19 15:40 ` Jeff Kirsher
  2 siblings, 0 replies; 5+ messages in thread
From: Jeff Kirsher @ 2013-11-19 15:40 UTC (permalink / raw)
  To: davem; +Cc: Carolyn Wyborny, netdev, gospo, sassmann, Jeff Kirsher

From: Carolyn Wyborny <carolyn.wyborny@intel.com>

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.

Signed-off-by: Carolyn Wyborny <carolyn.wyborny@intel.com>
Tested-by: Aaron Brown <aaron.f.brown@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/igb/igb_main.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
index ebe6370..40320bd 100644
--- a/drivers/net/ethernet/intel/igb/igb_main.c
+++ b/drivers/net/ethernet/intel/igb/igb_main.c
@@ -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;
 	}
 
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [net 1/3] net: allow netdev_all_upper_get_next_dev_rcu with rtnl lock held
  2013-11-19 15:40 ` [net 1/3] net: allow netdev_all_upper_get_next_dev_rcu with rtnl lock held Jeff Kirsher
@ 2013-11-19 17:18   ` John Fastabend
  0 siblings, 0 replies; 5+ messages in thread
From: John Fastabend @ 2013-11-19 17:18 UTC (permalink / raw)
  To: Jeff Kirsher
  Cc: davem, John Fastabend, netdev, gospo, sassmann, Veaceslav Falico

On 11/19/2013 07:40 AM, Jeff Kirsher wrote:
> From: John Fastabend <john.r.fastabend@intel.com>
>
> 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.
>
> CC: Veaceslav Falico <vfalico@redhat.com>
> Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
> Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com>
> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
> ---

[...]

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 */

[...]

> +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.

> +	return netdev_all_upper_get_next_dev(dev, iter);
> +}

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

John

-- 
John Fastabend         Intel Corporation

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-11-19 17:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-19 15:40 [net 0/3][pull request] Intel Wired LAN Driver Updates Jeff Kirsher
2013-11-19 15:40 ` [net 1/3] net: allow netdev_all_upper_get_next_dev_rcu with rtnl lock held Jeff Kirsher
2013-11-19 17:18   ` John Fastabend
2013-11-19 15:40 ` [net 2/3] igb: Fixed Wake On Lan support Jeff Kirsher
2013-11-19 15:40 ` [net 3/3] igb: Update queue reinit function to call dev_close when init of queues fails Jeff Kirsher

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).