netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [net-next 00/11][pull request] Intel Wired LAN Driver Updates 2014-09-18
@ 2014-09-18 12:26 Jeff Kirsher
  2014-09-18 12:26 ` [net-next 01/11] ixgbevf: remove useless bd_number from struct ixgbevf_adapter Jeff Kirsher
                   ` (11 more replies)
  0 siblings, 12 replies; 13+ messages in thread
From: Jeff Kirsher @ 2014-09-18 12:26 UTC (permalink / raw)
  To: davem; +Cc: Jeff Kirsher, netdev, nhorman, sassmann, jogreene

This series contains updates to ixgbe and ixgbevf.

Ethan Zhao cleans up ixgbe and ixgbevf by removing bd_number from the
adapter struct because it is not longer useful.

Mark fixes ixgbe where if a hardware transmit timestamp is requested,
an uninitialized workqueue entry may be scheduled.  Added a check for
a PTP clock to avoid that.

Jacob provides a number of cleanups for ixgbe.  Since we may call
ixgbe_acquire_msix_vectors() prior to registering our netdevice, we
should not use the netdevice specific printk and use e_dev_warn()
instead.  Similar to how ixgbevf handles acquiring MSI-X vectors, we
can return an error code instead of relying on the flag being set.
This makes it more clear that we have failed to setup MSI-X mode and
will make it easier to consolidate MSI-X related code into a single
function.  In the case of disabling DCB, it is not an error since we
still can function, we just have to let the user know.  So use
e_dev_warn() instead of e_err().  Added warnings for other features
that are disabled when we are without MSI-X support.  Cleanup flags
that are no longer used or needed.

The following are changes since commit bf3c228d36c6b3c90074f928e84e318621969cc6:
  net: fec: fix build error at m68k platform
and are available in the git repository at:
  git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/net-next master

Ethan Zhao (2):
  ixgbevf: remove useless bd_number from struct ixgbevf_adapter
  ixgbe: remove useless bd_number from adapter struct

Jacob Keller (8):
  ixgbe: use e_dev_warn instead of netif_printk
  ixgbe: return integer from ixgbe_acquire_msix_vectors
  ixgbe: move msix_entries allocation into ixgbe_acquire_msix_vectors
  ixgbe: determine vector count inside ixgbe_acquire_msix_vectors
  ixgbe: use e_dev_warn instead of e_err for displaying warning
  ixgbe: use e_dev_warn instead of netif_printk
  ixgbe: add warnings for other disabled features without MSI-X support
  ixgbe: remove IXGBE_FLAG_MSI(X)_CAPABLE flags

Mark Rustad (1):
  ixgbe: Do not schedule an uninitialized workqueue entry

 drivers/net/ethernet/intel/ixgbe/ixgbe.h          |   4 -
 drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c      | 151 +++++++++++-----------
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c     |  11 +-
 drivers/net/ethernet/intel/ixgbevf/ixgbevf.h      |   1 -
 drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c |   4 -
 5 files changed, 83 insertions(+), 88 deletions(-)

-- 
1.9.3

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

* [net-next 01/11] ixgbevf: remove useless bd_number from struct ixgbevf_adapter
  2014-09-18 12:26 [net-next 00/11][pull request] Intel Wired LAN Driver Updates 2014-09-18 Jeff Kirsher
@ 2014-09-18 12:26 ` Jeff Kirsher
  2014-09-18 12:26 ` [net-next 02/11] ixgbe: remove useless bd_number from adapter struct Jeff Kirsher
                   ` (10 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Jeff Kirsher @ 2014-09-18 12:26 UTC (permalink / raw)
  To: davem; +Cc: Ethan Zhao, netdev, nhorman, sassmann, jogreene, Jeff Kirsher

From: Ethan Zhao <ethan.zhao@oracle.com>

It is useless and buggy, just remove it.

Signed-off-by: Ethan Zhao <ethan.zhao@oracle.com>
Tested-by: Phil Schmitt <phillip.j.schmitt@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/ixgbevf/ixgbevf.h      | 1 -
 drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c | 4 ----
 2 files changed, 5 deletions(-)

diff --git a/drivers/net/ethernet/intel/ixgbevf/ixgbevf.h b/drivers/net/ethernet/intel/ixgbevf/ixgbevf.h
index a0a1de9..ba96cb5 100644
--- a/drivers/net/ethernet/intel/ixgbevf/ixgbevf.h
+++ b/drivers/net/ethernet/intel/ixgbevf/ixgbevf.h
@@ -385,7 +385,6 @@ struct ixgbevf_adapter {
 	/* structs defined in ixgbe_vf.h */
 	struct ixgbe_hw hw;
 	u16 msg_enable;
-	u16 bd_number;
 	/* Interrupt Throttle Rate */
 	u32 eitr_param;
 
diff --git a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
index c22a00c..030a219 100644
--- a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
+++ b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
@@ -3464,7 +3464,6 @@ static int ixgbevf_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 	struct ixgbevf_adapter *adapter = NULL;
 	struct ixgbe_hw *hw = NULL;
 	const struct ixgbevf_info *ii = ixgbevf_info_tbl[ent->driver_data];
-	static int cards_found;
 	int err, pci_using_dac;
 
 	err = pci_enable_device(pdev);
@@ -3525,8 +3524,6 @@ static int ixgbevf_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 
 	ixgbevf_assign_netdev_ops(netdev);
 
-	adapter->bd_number = cards_found;
-
 	/* Setup hw api */
 	memcpy(&hw->mac.ops, ii->mac_ops, sizeof(hw->mac.ops));
 	hw->mac.type  = ii->mac;
@@ -3601,7 +3598,6 @@ static int ixgbevf_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 	hw_dbg(hw, "MAC: %d\n", hw->mac.type);
 
 	hw_dbg(hw, "Intel(R) 82599 Virtual Function\n");
-	cards_found++;
 	return 0;
 
 err_register:
-- 
1.9.3

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

* [net-next 02/11] ixgbe: remove useless bd_number from adapter struct
  2014-09-18 12:26 [net-next 00/11][pull request] Intel Wired LAN Driver Updates 2014-09-18 Jeff Kirsher
  2014-09-18 12:26 ` [net-next 01/11] ixgbevf: remove useless bd_number from struct ixgbevf_adapter Jeff Kirsher
@ 2014-09-18 12:26 ` Jeff Kirsher
  2014-09-18 12:26 ` [net-next 03/11] ixgbe: Do not schedule an uninitialized workqueue entry Jeff Kirsher
                   ` (9 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Jeff Kirsher @ 2014-09-18 12:26 UTC (permalink / raw)
  To: davem; +Cc: Ethan Zhao, netdev, nhorman, sassmann, jogreene, Jeff Kirsher

From: Ethan Zhao <ethan.zhao@oracle.com>

Because bd_number is not useful anymore, so remove it from adapter struct, or
if keep it, we have to fix the boards driven counter bug in ixgbe_remove() and
ixgbe_probe() only for trivial debug purpose -- other output is enough.

Signed-off-by: Ethan Zhao <ethan.zhao@oracle.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.h      | 2 --
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 4 ----
 2 files changed, 6 deletions(-)

diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe.h b/drivers/net/ethernet/intel/ixgbe/ixgbe.h
index 06744f8..75a56fa 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe.h
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe.h
@@ -728,8 +728,6 @@ struct ixgbe_adapter {
 	u8 __iomem *io_addr; /* Mainly for iounmap use */
 	u32 wol;
 
-	u16 bd_number;
-
 	u16 eeprom_verh;
 	u16 eeprom_verl;
 	u16 eeprom_cap;
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index 6a12bb1..bcd697c 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -7981,7 +7981,6 @@ static int ixgbe_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 	struct ixgbe_adapter *adapter = NULL;
 	struct ixgbe_hw *hw;
 	const struct ixgbe_info *ii = ixgbe_info_tbl[ent->driver_data];
-	static int cards_found;
 	int i, err, pci_using_dac, expected_gts;
 	unsigned int indices = MAX_TX_QUEUES;
 	u8 part_str[IXGBE_PBANUM_LENGTH];
@@ -8067,8 +8066,6 @@ static int ixgbe_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 	netdev->watchdog_timeo = 5 * HZ;
 	strlcpy(netdev->name, pci_name(pdev), sizeof(netdev->name));
 
-	adapter->bd_number = cards_found;
-
 	/* Setup hw api */
 	memcpy(&hw->mac.ops, ii->mac_ops, sizeof(hw->mac.ops));
 	hw->mac.type  = ii->mac;
@@ -8352,7 +8349,6 @@ skip_sriov:
 	ixgbe_add_sanmac_netdev(netdev);
 
 	e_dev_info("%s\n", ixgbe_default_device_descr);
-	cards_found++;
 
 #ifdef CONFIG_IXGBE_HWMON
 	if (ixgbe_sysfs_init(adapter))
-- 
1.9.3

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

* [net-next 03/11] ixgbe: Do not schedule an uninitialized workqueue entry
  2014-09-18 12:26 [net-next 00/11][pull request] Intel Wired LAN Driver Updates 2014-09-18 Jeff Kirsher
  2014-09-18 12:26 ` [net-next 01/11] ixgbevf: remove useless bd_number from struct ixgbevf_adapter Jeff Kirsher
  2014-09-18 12:26 ` [net-next 02/11] ixgbe: remove useless bd_number from adapter struct Jeff Kirsher
@ 2014-09-18 12:26 ` Jeff Kirsher
  2014-09-18 12:26 ` [net-next 04/11] ixgbe: use e_dev_warn instead of netif_printk Jeff Kirsher
                   ` (8 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Jeff Kirsher @ 2014-09-18 12:26 UTC (permalink / raw)
  To: davem; +Cc: Mark Rustad, netdev, nhorman, sassmann, jogreene, Jeff Kirsher

From: Mark Rustad <mark.d.rustad@intel.com>

If a hardware Tx timestamp is requested, an uninitialized
workqueue entry may be scheduled, especially on an 82598 adapter.
Add a check for a PTP clock to avoid that. Also only apply the
unlikely to the first term of the conditional. That will make the
rest of the checks be in the cold path.

Signed-off-by: Mark Rustad <mark.d.rustad@intel.com>
Acked-by: Matthew Vick <matthew.vick@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 | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index bcd697c..06ef5a3 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -7108,9 +7108,10 @@ netdev_tx_t ixgbe_xmit_frame_ring(struct sk_buff *skb,
 		tx_flags |= IXGBE_TX_FLAGS_SW_VLAN;
 	}
 
-	if (unlikely(skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP &&
-		     !test_and_set_bit_lock(__IXGBE_PTP_TX_IN_PROGRESS,
-					    &adapter->state))) {
+	if (unlikely(skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP) &&
+	    adapter->ptp_clock &&
+	    !test_and_set_bit_lock(__IXGBE_PTP_TX_IN_PROGRESS,
+				   &adapter->state)) {
 		skb_shinfo(skb)->tx_flags |= SKBTX_IN_PROGRESS;
 		tx_flags |= IXGBE_TX_FLAGS_TSTAMP;
 
-- 
1.9.3

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

* [net-next 04/11] ixgbe: use e_dev_warn instead of netif_printk
  2014-09-18 12:26 [net-next 00/11][pull request] Intel Wired LAN Driver Updates 2014-09-18 Jeff Kirsher
                   ` (2 preceding siblings ...)
  2014-09-18 12:26 ` [net-next 03/11] ixgbe: Do not schedule an uninitialized workqueue entry Jeff Kirsher
@ 2014-09-18 12:26 ` Jeff Kirsher
  2014-09-18 12:26 ` [net-next 05/11] ixgbe: return integer from ixgbe_acquire_msix_vectors Jeff Kirsher
                   ` (7 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Jeff Kirsher @ 2014-09-18 12:26 UTC (permalink / raw)
  To: davem; +Cc: Jacob Keller, netdev, nhorman, sassmann, jogreene, Jeff Kirsher

From: Jacob Keller <jacob.e.keller@intel.com>

The netif_printk relies on our netdevice structure to be registered
already. We may call ixgbe_acquire_msix_vectors prior to registering our
netdevice, so we should not use the netdevice specific printk.

Signed-off-by: Jacob Keller <jacob.e.keller@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_lib.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c
index 7ecd99c..5d085d5 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c
@@ -717,12 +717,12 @@ static void ixgbe_acquire_msix_vectors(struct ixgbe_adapter *adapter,
 					vector_threshold, vectors);
 
 	if (vectors < 0) {
-		/* Can't allocate enough MSI-X interrupts?  Oh well.
-		 * This just means we'll go with either a single MSI
-		 * vector or fall back to legacy interrupts.
+		/* A negative count of allocated vectors indicates an error in
+		 * acquiring within the specified range of MSI-X vectors
 		 */
-		netif_printk(adapter, hw, KERN_DEBUG, adapter->netdev,
-			     "Unable to allocate MSI-X interrupts\n");
+		e_dev_warn("Failed to allocate MSI-X interrupts. Err: %d\n",
+			   vectors);
+
 		adapter->flags &= ~IXGBE_FLAG_MSIX_ENABLED;
 		kfree(adapter->msix_entries);
 		adapter->msix_entries = NULL;
-- 
1.9.3

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

* [net-next 05/11] ixgbe: return integer from ixgbe_acquire_msix_vectors
  2014-09-18 12:26 [net-next 00/11][pull request] Intel Wired LAN Driver Updates 2014-09-18 Jeff Kirsher
                   ` (3 preceding siblings ...)
  2014-09-18 12:26 ` [net-next 04/11] ixgbe: use e_dev_warn instead of netif_printk Jeff Kirsher
@ 2014-09-18 12:26 ` Jeff Kirsher
  2014-09-18 12:26 ` [net-next 06/11] ixgbe: move msix_entries allocation into ixgbe_acquire_msix_vectors Jeff Kirsher
                   ` (6 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Jeff Kirsher @ 2014-09-18 12:26 UTC (permalink / raw)
  To: davem; +Cc: Jacob Keller, netdev, nhorman, sassmann, jogreene, Jeff Kirsher

From: Jacob Keller <jacob.e.keller@intel.com>

Similar to how ixgbevf handles acquiring MSI-X vectors, we can return an
error code instead of relying on the flag being set. This makes it more
clear that we have failed to setup MSI-X mode, and also will make it
easier to consolidate MSI-X related code all into the single function.

Signed-off-by: Jacob Keller <jacob.e.keller@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_lib.c | 32 ++++++++++++++++------------
 1 file changed, 18 insertions(+), 14 deletions(-)

diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c
index 5d085d5..2a38894 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c
@@ -696,8 +696,8 @@ static void ixgbe_set_num_queues(struct ixgbe_adapter *adapter)
 	ixgbe_set_rss_queues(adapter);
 }
 
-static void ixgbe_acquire_msix_vectors(struct ixgbe_adapter *adapter,
-				       int vectors)
+static int ixgbe_acquire_msix_vectors(struct ixgbe_adapter *adapter,
+				      int vectors)
 {
 	int vector_threshold;
 
@@ -726,16 +726,22 @@ static void ixgbe_acquire_msix_vectors(struct ixgbe_adapter *adapter,
 		adapter->flags &= ~IXGBE_FLAG_MSIX_ENABLED;
 		kfree(adapter->msix_entries);
 		adapter->msix_entries = NULL;
-	} else {
-		adapter->flags |= IXGBE_FLAG_MSIX_ENABLED; /* Woot! */
-		/*
-		 * Adjust for only the vectors we'll use, which is minimum
-		 * of max_msix_q_vectors + NON_Q_VECTORS, or the number of
-		 * vectors we were allocated.
-		 */
-		vectors -= NON_Q_VECTORS;
-		adapter->num_q_vectors = min(vectors, adapter->max_q_vectors);
+
+		return vectors;
 	}
+
+	/* we successfully allocated some number of vectors within our
+	 * requested range.
+	 */
+	adapter->flags |= IXGBE_FLAG_MSIX_ENABLED;
+
+	/* Adjust for only the vectors we'll use, which is minimum
+	 * of max_q_vectors, or the number of vectors we were allocated.
+	 */
+	vectors -= NON_Q_VECTORS;
+	adapter->num_q_vectors = min_t(int, vectors, adapter->max_q_vectors);
+
+	return 0;
 }
 
 static void ixgbe_add_ring(struct ixgbe_ring *ring,
@@ -1085,9 +1091,7 @@ static void ixgbe_set_interrupt_capability(struct ixgbe_adapter *adapter)
 		for (vector = 0; vector < v_budget; vector++)
 			adapter->msix_entries[vector].entry = vector;
 
-		ixgbe_acquire_msix_vectors(adapter, v_budget);
-
-		if (adapter->flags & IXGBE_FLAG_MSIX_ENABLED)
+		if (!ixgbe_acquire_msix_vectors(adapter, v_budget))
 			return;
 	}
 
-- 
1.9.3

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

* [net-next 06/11] ixgbe: move msix_entries allocation into ixgbe_acquire_msix_vectors
  2014-09-18 12:26 [net-next 00/11][pull request] Intel Wired LAN Driver Updates 2014-09-18 Jeff Kirsher
                   ` (4 preceding siblings ...)
  2014-09-18 12:26 ` [net-next 05/11] ixgbe: return integer from ixgbe_acquire_msix_vectors Jeff Kirsher
@ 2014-09-18 12:26 ` Jeff Kirsher
  2014-09-18 12:26 ` [net-next 07/11] ixgbe: determine vector count inside ixgbe_acquire_msix_vectors Jeff Kirsher
                   ` (5 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Jeff Kirsher @ 2014-09-18 12:26 UTC (permalink / raw)
  To: davem; +Cc: Jacob Keller, netdev, nhorman, sassmann, jogreene, Jeff Kirsher

From: Jacob Keller <jacob.e.keller@intel.com>

We already have to kfree this value if we fail, and this is only part of
MSI-X mode, so we should simply allocate the value where we need it.
This is cleaner, and makes it a lot more obvious why we are freeing it
inside of ixgbe_acquire_msix_vectors.

Signed-off-by: Jacob Keller <jacob.e.keller@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_lib.c | 24 +++++++++++++-----------
 1 file changed, 13 insertions(+), 11 deletions(-)

diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c
index 2a38894..f504faf 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c
@@ -699,7 +699,7 @@ static void ixgbe_set_num_queues(struct ixgbe_adapter *adapter)
 static int ixgbe_acquire_msix_vectors(struct ixgbe_adapter *adapter,
 				      int vectors)
 {
-	int vector_threshold;
+	int i, vector_threshold;
 
 	/* We'll want at least 2 (vector_threshold):
 	 * 1) TxQ[0] + RxQ[0] handler
@@ -713,6 +713,15 @@ static int ixgbe_acquire_msix_vectors(struct ixgbe_adapter *adapter,
 	 * Right now, we simply care about how many we'll get; we'll
 	 * set them up later while requesting irq's.
 	 */
+	adapter->msix_entries = kcalloc(vectors,
+					sizeof(struct msix_entry),
+					GFP_KERNEL);
+	if (!adapter->msix_entries)
+		return -ENOMEM;
+
+	for (i = 0; i < vectors; i++)
+		adapter->msix_entries[i].entry = i;
+
 	vectors = pci_enable_msix_range(adapter->pdev, adapter->msix_entries,
 					vector_threshold, vectors);
 
@@ -1061,7 +1070,7 @@ static void ixgbe_reset_interrupt_capability(struct ixgbe_adapter *adapter)
 static void ixgbe_set_interrupt_capability(struct ixgbe_adapter *adapter)
 {
 	struct ixgbe_hw *hw = &adapter->hw;
-	int vector, v_budget, err;
+	int v_budget, err;
 
 	/*
 	 * It's easy to be greedy for MSI-X vectors, but it really
@@ -1085,15 +1094,8 @@ static void ixgbe_set_interrupt_capability(struct ixgbe_adapter *adapter)
 
 	/* A failure in MSI-X entry allocation isn't fatal, but it does
 	 * mean we disable MSI-X capabilities of the adapter. */
-	adapter->msix_entries = kcalloc(v_budget,
-					sizeof(struct msix_entry), GFP_KERNEL);
-	if (adapter->msix_entries) {
-		for (vector = 0; vector < v_budget; vector++)
-			adapter->msix_entries[vector].entry = vector;
-
-		if (!ixgbe_acquire_msix_vectors(adapter, v_budget))
-			return;
-	}
+	if (!ixgbe_acquire_msix_vectors(adapter, v_budget))
+		return;
 
 	/* At this point, we do not have MSI-X capabilities. We need to
 	 * reconfigure or disable various features which require MSI-X
-- 
1.9.3

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

* [net-next 07/11] ixgbe: determine vector count inside ixgbe_acquire_msix_vectors
  2014-09-18 12:26 [net-next 00/11][pull request] Intel Wired LAN Driver Updates 2014-09-18 Jeff Kirsher
                   ` (5 preceding siblings ...)
  2014-09-18 12:26 ` [net-next 06/11] ixgbe: move msix_entries allocation into ixgbe_acquire_msix_vectors Jeff Kirsher
@ 2014-09-18 12:26 ` Jeff Kirsher
  2014-09-18 12:26 ` [net-next 08/11] ixgbe: use e_dev_warn instead of e_err for displaying warning Jeff Kirsher
                   ` (4 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Jeff Kirsher @ 2014-09-18 12:26 UTC (permalink / raw)
  To: davem; +Cc: Jacob Keller, netdev, nhorman, sassmann, jogreene, Jeff Kirsher

From: Jacob Keller <jacob.e.keller@intel.com>

Our calculated v_budget doesn't matter except if we allocate MSI-X
vectors. We shouldn't need to calculate this outside of the function, so
don't. Instead, only calculate it once we attempt to acquire MSI-X
vectors. This helps collocate all of the MSI-X vector code together.

Signed-off-by: Jacob Keller <jacob.e.keller@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_lib.c | 74 ++++++++++++++--------------
 1 file changed, 37 insertions(+), 37 deletions(-)

diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c
index f504faf..39df14f 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c
@@ -696,23 +696,45 @@ static void ixgbe_set_num_queues(struct ixgbe_adapter *adapter)
 	ixgbe_set_rss_queues(adapter);
 }
 
-static int ixgbe_acquire_msix_vectors(struct ixgbe_adapter *adapter,
-				      int vectors)
+/**
+ * ixgbe_acquire_msix_vectors - acquire MSI-X vectors
+ * @adapter: board private structure
+ *
+ * Attempts to acquire a suitable range of MSI-X vector interrupts. Will
+ * return a negative error code if unable to acquire MSI-X vectors for any
+ * reason.
+ */
+static int ixgbe_acquire_msix_vectors(struct ixgbe_adapter *adapter)
 {
-	int i, vector_threshold;
+	struct ixgbe_hw *hw = &adapter->hw;
+	int i, vectors, vector_threshold;
+
+	/* We start by asking for one vector per queue pair */
+	vectors = max(adapter->num_rx_queues, adapter->num_tx_queues);
 
-	/* We'll want at least 2 (vector_threshold):
-	 * 1) TxQ[0] + RxQ[0] handler
-	 * 2) Other (Link Status Change, etc.)
+	/* It is easy to be greedy for MSI-X vectors. However, it really
+	 * doesn't do much good if we have a lot more vectors than CPUs. We'll
+	 * be somewhat conservative and only ask for (roughly) the same number
+	 * of vectors as there are CPUs.
 	 */
-	vector_threshold = MIN_MSIX_COUNT;
+	vectors = min_t(int, vectors, num_online_cpus());
 
-	/*
-	 * The more we get, the more we will assign to Tx/Rx Cleanup
-	 * for the separate queues...where Rx Cleanup >= Tx Cleanup.
-	 * Right now, we simply care about how many we'll get; we'll
-	 * set them up later while requesting irq's.
+	/* Some vectors are necessary for non-queue interrupts */
+	vectors += NON_Q_VECTORS;
+
+	/* Hardware can only support a maximum of hw.mac->max_msix_vectors.
+	 * With features such as RSS and VMDq, we can easily surpass the
+	 * number of Rx and Tx descriptor queues supported by our device.
+	 * Thus, we cap the maximum in the rare cases where the CPU count also
+	 * exceeds our vector limit
+	 */
+	vectors = min_t(int, vectors, hw->mac.max_msix_vectors);
+
+	/* We want a minimum of two MSI-X vectors for (1) a TxQ[0] + RxQ[0]
+	 * handler, and (2) an Other (Link Status Change, etc.) handler.
 	 */
+	vector_threshold = MIN_MSIX_COUNT;
+
 	adapter->msix_entries = kcalloc(vectors,
 					sizeof(struct msix_entry),
 					GFP_KERNEL);
@@ -1069,32 +1091,10 @@ static void ixgbe_reset_interrupt_capability(struct ixgbe_adapter *adapter)
  **/
 static void ixgbe_set_interrupt_capability(struct ixgbe_adapter *adapter)
 {
-	struct ixgbe_hw *hw = &adapter->hw;
-	int v_budget, err;
-
-	/*
-	 * It's easy to be greedy for MSI-X vectors, but it really
-	 * doesn't do us much good if we have a lot more vectors
-	 * than CPU's.  So let's be conservative and only ask for
-	 * (roughly) the same number of vectors as there are CPU's.
-	 * The default is to use pairs of vectors.
-	 */
-	v_budget = max(adapter->num_rx_queues, adapter->num_tx_queues);
-	v_budget = min_t(int, v_budget, num_online_cpus());
-	v_budget += NON_Q_VECTORS;
-
-	/*
-	 * At the same time, hardware can only support a maximum of
-	 * hw.mac->max_msix_vectors vectors.  With features
-	 * such as RSS and VMDq, we can easily surpass the number of Rx and Tx
-	 * descriptor queues supported by our device.  Thus, we cap it off in
-	 * those rare cases where the cpu count also exceeds our vector limit.
-	 */
-	v_budget = min_t(int, v_budget, hw->mac.max_msix_vectors);
+	int err;
 
-	/* A failure in MSI-X entry allocation isn't fatal, but it does
-	 * mean we disable MSI-X capabilities of the adapter. */
-	if (!ixgbe_acquire_msix_vectors(adapter, v_budget))
+	/* We will try to get MSI-X interrupts first */
+	if (!ixgbe_acquire_msix_vectors(adapter))
 		return;
 
 	/* At this point, we do not have MSI-X capabilities. We need to
-- 
1.9.3

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

* [net-next 08/11] ixgbe: use e_dev_warn instead of e_err for displaying warning
  2014-09-18 12:26 [net-next 00/11][pull request] Intel Wired LAN Driver Updates 2014-09-18 Jeff Kirsher
                   ` (6 preceding siblings ...)
  2014-09-18 12:26 ` [net-next 07/11] ixgbe: determine vector count inside ixgbe_acquire_msix_vectors Jeff Kirsher
@ 2014-09-18 12:26 ` Jeff Kirsher
  2014-09-18 12:26 ` [net-next 09/11] ixgbe: use e_dev_warn instead of netif_printk Jeff Kirsher
                   ` (3 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Jeff Kirsher @ 2014-09-18 12:26 UTC (permalink / raw)
  To: davem; +Cc: Jacob Keller, netdev, nhorman, sassmann, jogreene, Jeff Kirsher

From: Jacob Keller <jacob.e.keller@intel.com>

In this case, disabling DCB is not an error. We can still function, but
we just have to let the user know. In addition, since we call this
during probe before allocating our netdevice structure, we should use
e_dev_warn instead of e_warn.

Signed-off-by: Jacob Keller <jacob.e.keller@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_lib.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c
index 39df14f..969b979 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c
@@ -1102,9 +1102,9 @@ static void ixgbe_set_interrupt_capability(struct ixgbe_adapter *adapter)
 	 * capability.
 	 */
 
-	/* disable DCB if number of TCs exceeds 1 */
+	/* Disable DCB unless we only have a single traffic class */
 	if (netdev_get_num_tc(adapter->netdev) > 1) {
-		e_err(probe, "num TCs exceeds number of queues - disabling DCB\n");
+		e_dev_warn("Number of DCB TCs exceeds number of available queues. Disabling DCB support.\n");
 		netdev_reset_tc(adapter->netdev);
 
 		if (adapter->hw.mac.type == ixgbe_mac_82598EB)
-- 
1.9.3

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

* [net-next 09/11] ixgbe: use e_dev_warn instead of netif_printk
  2014-09-18 12:26 [net-next 00/11][pull request] Intel Wired LAN Driver Updates 2014-09-18 Jeff Kirsher
                   ` (7 preceding siblings ...)
  2014-09-18 12:26 ` [net-next 08/11] ixgbe: use e_dev_warn instead of e_err for displaying warning Jeff Kirsher
@ 2014-09-18 12:26 ` Jeff Kirsher
  2014-09-18 12:27 ` [net-next 10/11] ixgbe: add warnings for other disabled features without MSI-X support Jeff Kirsher
                   ` (2 subsequent siblings)
  11 siblings, 0 replies; 13+ messages in thread
From: Jeff Kirsher @ 2014-09-18 12:26 UTC (permalink / raw)
  To: davem; +Cc: Jacob Keller, netdev, nhorman, sassmann, jogreene, Jeff Kirsher

From: Jacob Keller <jacob.e.keller@intel.com>

Again, we should not be directly using netif_printk, as we have our own
error print routines that we generate. In addition, instead of using an
early return we can just use the else block of this one line if
statement.

Signed-off-by: Jacob Keller <jacob.e.keller@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_lib.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c
index 969b979..0ec22d8 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c
@@ -1130,13 +1130,11 @@ static void ixgbe_set_interrupt_capability(struct ixgbe_adapter *adapter)
 	adapter->num_q_vectors = 1;
 
 	err = pci_enable_msi(adapter->pdev);
-	if (err) {
-		netif_printk(adapter, hw, KERN_DEBUG, adapter->netdev,
-			     "Unable to allocate MSI interrupt, falling back to legacy.  Error: %d\n",
-			     err);
-		return;
-	}
-	adapter->flags |= IXGBE_FLAG_MSI_ENABLED;
+	if (err)
+		e_dev_warn("Failed to allocate MSI interrupt, falling back to legacy. Error: %d\n",
+			   err);
+	else
+		adapter->flags |= IXGBE_FLAG_MSI_ENABLED;
 }
 
 /**
-- 
1.9.3

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

* [net-next 10/11] ixgbe: add warnings for other disabled features without MSI-X support
  2014-09-18 12:26 [net-next 00/11][pull request] Intel Wired LAN Driver Updates 2014-09-18 Jeff Kirsher
                   ` (8 preceding siblings ...)
  2014-09-18 12:26 ` [net-next 09/11] ixgbe: use e_dev_warn instead of netif_printk Jeff Kirsher
@ 2014-09-18 12:27 ` Jeff Kirsher
  2014-09-18 12:27 ` [net-next 11/11] ixgbe: remove IXGBE_FLAG_MSI(X)_CAPABLE flags Jeff Kirsher
  2014-09-19 21:36 ` [net-next 00/11][pull request] Intel Wired LAN Driver Updates 2014-09-18 David Miller
  11 siblings, 0 replies; 13+ messages in thread
From: Jeff Kirsher @ 2014-09-18 12:27 UTC (permalink / raw)
  To: davem; +Cc: Jacob Keller, netdev, nhorman, sassmann, jogreene, Jeff Kirsher

From: Jacob Keller <jacob.e.keller@intel.com>

When we can't get MSI-X vectors, we disable a few features which require
MSI-X vectors. Print warnings just like we do when disabling DCB.

Signed-off-by: Jacob Keller <jacob.e.keller@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_lib.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c
index 0ec22d8..ce40c77 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_lib.c
@@ -1114,13 +1114,16 @@ static void ixgbe_set_interrupt_capability(struct ixgbe_adapter *adapter)
 		adapter->temp_dcb_cfg.pfc_mode_enable = false;
 		adapter->dcb_cfg.pfc_mode_enable = false;
 	}
+
 	adapter->dcb_cfg.num_tcs.pg_tcs = 1;
 	adapter->dcb_cfg.num_tcs.pfc_tcs = 1;
 
-	/* disable SR-IOV */
+	/* Disable SR-IOV support */
+	e_dev_warn("Disabling SR-IOV support\n");
 	ixgbe_disable_sriov(adapter);
 
-	/* disable RSS */
+	/* Disable RSS */
+	e_dev_warn("Disabling RSS support\n");
 	adapter->ring_feature[RING_F_RSS].limit = 1;
 
 	/* recalculate number of queues now that many features have been
-- 
1.9.3

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

* [net-next 11/11] ixgbe: remove IXGBE_FLAG_MSI(X)_CAPABLE flags
  2014-09-18 12:26 [net-next 00/11][pull request] Intel Wired LAN Driver Updates 2014-09-18 Jeff Kirsher
                   ` (9 preceding siblings ...)
  2014-09-18 12:27 ` [net-next 10/11] ixgbe: add warnings for other disabled features without MSI-X support Jeff Kirsher
@ 2014-09-18 12:27 ` Jeff Kirsher
  2014-09-19 21:36 ` [net-next 00/11][pull request] Intel Wired LAN Driver Updates 2014-09-18 David Miller
  11 siblings, 0 replies; 13+ messages in thread
From: Jeff Kirsher @ 2014-09-18 12:27 UTC (permalink / raw)
  To: davem; +Cc: Jacob Keller, netdev, nhorman, sassmann, jogreene, Jeff Kirsher

From: Jacob Keller <jacob.e.keller@intel.com>

They were not used, and we don't need them, so we shouldn't bother with
keeping values in the flags field that could be misleading.

Signed-off-by: Jacob Keller <jacob.e.keller@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.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe.h b/drivers/net/ethernet/intel/ixgbe/ixgbe.h
index 75a56fa..673d820 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe.h
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe.h
@@ -611,9 +611,7 @@ struct ixgbe_adapter {
 	 * thus the additional *_CAPABLE flags.
 	 */
 	u32 flags;
-#define IXGBE_FLAG_MSI_CAPABLE                  (u32)(1 << 0)
 #define IXGBE_FLAG_MSI_ENABLED                  (u32)(1 << 1)
-#define IXGBE_FLAG_MSIX_CAPABLE                 (u32)(1 << 2)
 #define IXGBE_FLAG_MSIX_ENABLED                 (u32)(1 << 3)
 #define IXGBE_FLAG_RX_1BUF_CAPABLE              (u32)(1 << 4)
 #define IXGBE_FLAG_RX_PS_CAPABLE                (u32)(1 << 5)
-- 
1.9.3

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

* Re: [net-next 00/11][pull request] Intel Wired LAN Driver Updates 2014-09-18
  2014-09-18 12:26 [net-next 00/11][pull request] Intel Wired LAN Driver Updates 2014-09-18 Jeff Kirsher
                   ` (10 preceding siblings ...)
  2014-09-18 12:27 ` [net-next 11/11] ixgbe: remove IXGBE_FLAG_MSI(X)_CAPABLE flags Jeff Kirsher
@ 2014-09-19 21:36 ` David Miller
  11 siblings, 0 replies; 13+ messages in thread
From: David Miller @ 2014-09-19 21:36 UTC (permalink / raw)
  To: jeffrey.t.kirsher; +Cc: netdev, nhorman, sassmann, jogreene

From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Date: Thu, 18 Sep 2014 05:26:50 -0700

> This series contains updates to ixgbe and ixgbevf.

Pulled, thanks Jeff.

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

end of thread, other threads:[~2014-09-19 21:36 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-18 12:26 [net-next 00/11][pull request] Intel Wired LAN Driver Updates 2014-09-18 Jeff Kirsher
2014-09-18 12:26 ` [net-next 01/11] ixgbevf: remove useless bd_number from struct ixgbevf_adapter Jeff Kirsher
2014-09-18 12:26 ` [net-next 02/11] ixgbe: remove useless bd_number from adapter struct Jeff Kirsher
2014-09-18 12:26 ` [net-next 03/11] ixgbe: Do not schedule an uninitialized workqueue entry Jeff Kirsher
2014-09-18 12:26 ` [net-next 04/11] ixgbe: use e_dev_warn instead of netif_printk Jeff Kirsher
2014-09-18 12:26 ` [net-next 05/11] ixgbe: return integer from ixgbe_acquire_msix_vectors Jeff Kirsher
2014-09-18 12:26 ` [net-next 06/11] ixgbe: move msix_entries allocation into ixgbe_acquire_msix_vectors Jeff Kirsher
2014-09-18 12:26 ` [net-next 07/11] ixgbe: determine vector count inside ixgbe_acquire_msix_vectors Jeff Kirsher
2014-09-18 12:26 ` [net-next 08/11] ixgbe: use e_dev_warn instead of e_err for displaying warning Jeff Kirsher
2014-09-18 12:26 ` [net-next 09/11] ixgbe: use e_dev_warn instead of netif_printk Jeff Kirsher
2014-09-18 12:27 ` [net-next 10/11] ixgbe: add warnings for other disabled features without MSI-X support Jeff Kirsher
2014-09-18 12:27 ` [net-next 11/11] ixgbe: remove IXGBE_FLAG_MSI(X)_CAPABLE flags Jeff Kirsher
2014-09-19 21:36 ` [net-next 00/11][pull request] Intel Wired LAN Driver Updates 2014-09-18 David Miller

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