All of lore.kernel.org
 help / color / mirror / Atom feed
* [net-next 00/15][pull request] Intel Wired LAN Driver Updates 2015-11-23
@ 2015-11-23 19:36 Jeff Kirsher
  2015-11-23 19:36 ` [net-next 01/15] fm10k: do not assume VF always has 1 queue Jeff Kirsher
                   ` (15 more replies)
  0 siblings, 16 replies; 20+ messages in thread
From: Jeff Kirsher @ 2015-11-23 19:36 UTC (permalink / raw)
  To: davem; +Cc: Jeff Kirsher, netdev, nhorman, sassmann, jogreene, john.ronciak

This series contains updates to ixgbe, ixgbevf, fm10k, i40e and i40evf.

Jacob fixes an issue where VF could attempt to read queues it does not own,
so prevent this we check queue 0 before we continue.

Matthew fixes the MTU for jumbo frames for fm10k.

Julia Lawall cleans up a unneeded NULL test in ixgbe.

Mark cleans up a redundant header inclusion.  Adds KR mode support for
CS4227 chip.  Cleaned up diagnostic code, which is no longer needed, for
the CS4227 chip.

Jean Sacren fixes kernel documentation for ixgbe.

Alex Duyck fixes an fm10k and ixgbe issue in which the polling routine would
increase the budget for receive to at least 1 per queue if multiple queues were
present.  This would result in receive packets being processed when the budget
was 0 which is meant to indicate that no receive can be handled.  Also fixes
an ixgbevf performance issue where netperf test will starve for memory in the
time form one transmit interrupt to the next, so limit lowest interrupt rate
for adaptive interrupt moderation to 12K.  Fixed up ixgbe and ixgbevf to
use napi_schedule_irqoff() where the drivers were run from hard interrupt
context or with interrupts already disabled in netpoll.

Jesse fixes a compiler warning about an unused variable for i40evf.

John Greene fixes an issue with ixgbevf, where if the VF driver is loaded
while the corresponding PH interface is down, the driver assigns a random
MAC address, can be overwritten with the value of hw->mac.perm_addr which
is 0 at that point.  So avoid this case by initializing hw->mac.perm_addr
to the randomly generated address and do not set it unless we receive an
ACK from ixgbe.

Rasmus Villemoes cleans up some confusing code in i40e debugfs code.

The following are changes since commit 3d40e44361eab3dd6c969241d12dac7466eb7174:
  Merge branch 'dsa-gpio-reset'
and are available in the git repository at:
  git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/next-queue master

Alexander Duyck (4):
  fm10k: Fix handling of NAPI budget when multiple queues are enabled
    per vector
  ixgbe: Fix handling of NAPI budget when multiple queues are enabled
    per vector
  ixgbevf: Limit lowest interrupt rate for adaptive interrupt moderation
    to 12K
  ixgbe/ixgbevf: use napi_schedule_irqoff()

Emil Tantilov (2):
  ixgbevf: use ether_addr_copy instead of memcpy
  ixgbevf: fix spoofed packets with random MAC

Jacob Keller (2):
  fm10k: do not assume VF always has 1 queue
  fm10k: Correct MTU for jumbo frames

Jean Sacren (1):
  ixgbe: fix multiple kernel-doc errors

Jesse Brandeburg (1):
  i40evf: fix compiler warning of unused variable

Julia Lawall (1):
  ixgbe: drop null test before destroy functions

Mark Rustad (3):
  ixgbe: Delete redundant include file
  ixgbe: Add KR mode support for CS4227 chip
  ixgbe: Remove CS4227 diagnostic code

Rasmus Villemoes (1):
  intel: i40e: fix confused code

 drivers/net/ethernet/intel/fm10k/fm10k.h          |   2 +-
 drivers/net/ethernet/intel/fm10k/fm10k_main.c     |   4 +
 drivers/net/ethernet/intel/fm10k/fm10k_type.h     |   1 +
 drivers/net/ethernet/intel/fm10k/fm10k_vf.c       |   7 +-
 drivers/net/ethernet/intel/i40e/i40e_debugfs.c    |  24 ++--
 drivers/net/ethernet/intel/i40evf/i40evf_main.c   |   7 +-
 drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.c     |   3 +-
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c     |  19 +--
 drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c     | 165 ++++++++--------------
 drivers/net/ethernet/intel/ixgbevf/ethtool.c      |   2 +-
 drivers/net/ethernet/intel/ixgbevf/ixgbevf.h      |   3 +-
 drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c |  23 ++-
 drivers/net/ethernet/intel/ixgbevf/vf.c           |   4 +-
 13 files changed, 111 insertions(+), 153 deletions(-)

-- 
2.5.0

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

* [net-next 01/15] fm10k: do not assume VF always has 1 queue
  2015-11-23 19:36 [net-next 00/15][pull request] Intel Wired LAN Driver Updates 2015-11-23 Jeff Kirsher
@ 2015-11-23 19:36 ` Jeff Kirsher
  2015-11-23 19:36 ` [net-next 02/15] fm10k: Correct MTU for jumbo frames Jeff Kirsher
                   ` (14 subsequent siblings)
  15 siblings, 0 replies; 20+ messages in thread
From: Jeff Kirsher @ 2015-11-23 19:36 UTC (permalink / raw)
  To: davem; +Cc: Jacob Keller, netdev, nhorman, sassmann, jogreene, Jeff Kirsher

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

It is possible that the PF has not yet assigned resources to the VF.
Although rare, this could result in the VF attempting to read queues it
does not own and result in FUM or THI faults in the PF. To prevent this,
check queue 0 before we continue in init_hw_vf.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Tested-by: Krishneil Singh <Krishneil.k.singh@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/fm10k/fm10k_type.h | 1 +
 drivers/net/ethernet/intel/fm10k/fm10k_vf.c   | 7 ++++++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_type.h b/drivers/net/ethernet/intel/fm10k/fm10k_type.h
index 318a212..35afd71 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_type.h
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_type.h
@@ -77,6 +77,7 @@ struct fm10k_hw;
 #define FM10K_PCIE_SRIOV_CTRL_VFARI		0x10
 
 #define FM10K_ERR_PARAM				-2
+#define FM10K_ERR_NO_RESOURCES			-3
 #define FM10K_ERR_REQUESTS_PENDING		-4
 #define FM10K_ERR_RESET_REQUESTED		-5
 #define FM10K_ERR_DMA_PENDING			-6
diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_vf.c b/drivers/net/ethernet/intel/fm10k/fm10k_vf.c
index 36c8b0a..3a18ef1 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_vf.c
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_vf.c
@@ -103,7 +103,12 @@ static s32 fm10k_init_hw_vf(struct fm10k_hw *hw)
 	s32 err;
 	u16 i;
 
-	/* assume we always have at least 1 queue */
+	/* verify we have at least 1 queue */
+	if (!~fm10k_read_reg(hw, FM10K_TXQCTL(0)) ||
+	    !~fm10k_read_reg(hw, FM10K_RXQCTL(0)))
+		return FM10K_ERR_NO_RESOURCES;
+
+	/* determine how many queues we have */
 	for (i = 1; tqdloc0 && (i < FM10K_MAX_QUEUES_POOL); i++) {
 		/* verify the Descriptor cache offsets are increasing */
 		tqdloc = ~fm10k_read_reg(hw, FM10K_TQDLOC(i));
-- 
2.5.0

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

* [net-next 02/15] fm10k: Correct MTU for jumbo frames
  2015-11-23 19:36 [net-next 00/15][pull request] Intel Wired LAN Driver Updates 2015-11-23 Jeff Kirsher
  2015-11-23 19:36 ` [net-next 01/15] fm10k: do not assume VF always has 1 queue Jeff Kirsher
@ 2015-11-23 19:36 ` Jeff Kirsher
  2015-11-23 19:36 ` [net-next 03/15] ixgbe: drop null test before destroy functions Jeff Kirsher
                   ` (13 subsequent siblings)
  15 siblings, 0 replies; 20+ messages in thread
From: Jeff Kirsher @ 2015-11-23 19:36 UTC (permalink / raw)
  To: davem
  Cc: Jacob Keller, netdev, nhorman, sassmann, jogreene, Matthew Vick,
	Jeff Kirsher

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

Based on hardware testing, the host interface supports up to 15368 bytes
as the maximum frame size. To determine the correct MTU, we subtract 8
for the internal switch tag, 14 for the L2 header, and 4 for the
appended FCS header, resulting in 15342 bytes of payload for our maximum
MTU on jumbo frames.

Signed-off-by: Matthew Vick <matthew.vick@intel.com>
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Acked-by: Bruce Allan <bruce.w.allan@intel.com>
Tested-by: Krishneil Singh <krishneil.k.singh@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/fm10k/fm10k.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/intel/fm10k/fm10k.h b/drivers/net/ethernet/intel/fm10k/fm10k.h
index 1444020..48809e5 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k.h
+++ b/drivers/net/ethernet/intel/fm10k/fm10k.h
@@ -33,7 +33,7 @@
 #include "fm10k_pf.h"
 #include "fm10k_vf.h"
 
-#define FM10K_MAX_JUMBO_FRAME_SIZE	15358	/* Maximum supported size 15K */
+#define FM10K_MAX_JUMBO_FRAME_SIZE	15342	/* Maximum supported size 15K */
 
 #define MAX_QUEUES	FM10K_MAX_QUEUES_PF
 
-- 
2.5.0

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

* [net-next 03/15] ixgbe: drop null test before destroy functions
  2015-11-23 19:36 [net-next 00/15][pull request] Intel Wired LAN Driver Updates 2015-11-23 Jeff Kirsher
  2015-11-23 19:36 ` [net-next 01/15] fm10k: do not assume VF always has 1 queue Jeff Kirsher
  2015-11-23 19:36 ` [net-next 02/15] fm10k: Correct MTU for jumbo frames Jeff Kirsher
@ 2015-11-23 19:36 ` Jeff Kirsher
  2015-11-23 19:36 ` [net-next 04/15] ixgbe: Delete redundant include file Jeff Kirsher
                   ` (12 subsequent siblings)
  15 siblings, 0 replies; 20+ messages in thread
From: Jeff Kirsher @ 2015-11-23 19:36 UTC (permalink / raw)
  To: davem
  Cc: Julia Lawall, netdev, nhorman, sassmann, jogreene, Julia Lawall,
	Jeff Kirsher

From: Julia Lawall <julia.lawall@lip6.fr>

Remove unneeded NULL test.

The semantic patch that makes this change is as follows:
(http://coccinelle.lip6.fr/)

// <smpl>
@@ expression x; @@
-if (x != NULL)
  \(kmem_cache_destroy\|mempool_destroy\|dma_pool_destroy\)(x);
// </smpl>

Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Tested-by: Darin Miller <darin.j.miller@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.c
index 631c603..5f98870 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_fcoe.c
@@ -620,8 +620,7 @@ static void ixgbe_fcoe_dma_pool_free(struct ixgbe_fcoe *fcoe, unsigned int cpu)
 	struct ixgbe_fcoe_ddp_pool *ddp_pool;
 
 	ddp_pool = per_cpu_ptr(fcoe->ddp_pool, cpu);
-	if (ddp_pool->pool)
-		dma_pool_destroy(ddp_pool->pool);
+	dma_pool_destroy(ddp_pool->pool);
 	ddp_pool->pool = NULL;
 }
 
-- 
2.5.0

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

* [net-next 04/15] ixgbe: Delete redundant include file
  2015-11-23 19:36 [net-next 00/15][pull request] Intel Wired LAN Driver Updates 2015-11-23 Jeff Kirsher
                   ` (2 preceding siblings ...)
  2015-11-23 19:36 ` [net-next 03/15] ixgbe: drop null test before destroy functions Jeff Kirsher
@ 2015-11-23 19:36 ` Jeff Kirsher
  2015-11-24 18:36   ` Joe Perches
  2015-11-23 19:36 ` [net-next 05/15] ixgbe: fix multiple kernel-doc errors Jeff Kirsher
                   ` (11 subsequent siblings)
  15 siblings, 1 reply; 20+ messages in thread
From: Jeff Kirsher @ 2015-11-23 19:36 UTC (permalink / raw)
  To: davem; +Cc: Mark Rustad, netdev, nhorman, sassmann, jogreene, Jeff Kirsher

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

Delete a redundant include of net/vxlan.h.

Signed-off-by: Mark Rustad <mark.d.rustad@intel.com>
Tested-by: Darin Miller <darin.j.miller@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index 4089d77..450db04 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -65,9 +65,6 @@
 #include "ixgbe_common.h"
 #include "ixgbe_dcb_82599.h"
 #include "ixgbe_sriov.h"
-#ifdef CONFIG_IXGBE_VXLAN
-#include <net/vxlan.h>
-#endif
 
 char ixgbe_driver_name[] = "ixgbe";
 static const char ixgbe_driver_string[] =
-- 
2.5.0

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

* [net-next 05/15] ixgbe: fix multiple kernel-doc errors
  2015-11-23 19:36 [net-next 00/15][pull request] Intel Wired LAN Driver Updates 2015-11-23 Jeff Kirsher
                   ` (3 preceding siblings ...)
  2015-11-23 19:36 ` [net-next 04/15] ixgbe: Delete redundant include file Jeff Kirsher
@ 2015-11-23 19:36 ` Jeff Kirsher
  2015-11-23 19:36 ` [net-next 06/15] fm10k: Fix handling of NAPI budget when multiple queues are enabled per vector Jeff Kirsher
                   ` (10 subsequent siblings)
  15 siblings, 0 replies; 20+ messages in thread
From: Jeff Kirsher @ 2015-11-23 19:36 UTC (permalink / raw)
  To: davem; +Cc: Jean Sacren, netdev, nhorman, sassmann, jogreene, Jeff Kirsher

From: Jean Sacren <sakiwit@gmail.com>

The commit dfaf891dd3e1 ("ixgbe: Refactor the RSS configuration code")
introduced a few kernel-doc errors:

1) The function name is missing;
2) The format is wrong;
3) The short description is redundant.

Fix all the above for the correct execution of the kernel doc.

Signed-off-by: Jean Sacren <sakiwit@gmail.com>
Tested-by: Darin Miller <darin.j.miller@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index 450db04..c9b7e5e 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -3312,8 +3312,7 @@ static void ixgbe_configure_srrctl(struct ixgbe_adapter *adapter,
 }
 
 /**
- * Return a number of entries in the RSS indirection table
- *
+ * ixgbe_rss_indir_tbl_entries - Return RSS indirection table entries
  * @adapter: device handle
  *
  *  - 82598/82599/X540:     128
@@ -3331,8 +3330,7 @@ u32 ixgbe_rss_indir_tbl_entries(struct ixgbe_adapter *adapter)
 }
 
 /**
- * Write the RETA table to HW
- *
+ * ixgbe_store_reta - Write the RETA table to HW
  * @adapter: device handle
  *
  * Write the RSS redirection table stored in adapter.rss_indir_tbl[] to HW.
@@ -3371,8 +3369,7 @@ void ixgbe_store_reta(struct ixgbe_adapter *adapter)
 }
 
 /**
- * Write the RETA table to HW (for x550 devices in SRIOV mode)
- *
+ * ixgbe_store_vfreta - Write the RETA table to HW (x550 devices in SRIOV mode)
  * @adapter: device handle
  *
  * Write the RSS redirection table stored in adapter.rss_indir_tbl[] to HW.
-- 
2.5.0

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

* [net-next 06/15] fm10k: Fix handling of NAPI budget when multiple queues are enabled per vector
  2015-11-23 19:36 [net-next 00/15][pull request] Intel Wired LAN Driver Updates 2015-11-23 Jeff Kirsher
                   ` (4 preceding siblings ...)
  2015-11-23 19:36 ` [net-next 05/15] ixgbe: fix multiple kernel-doc errors Jeff Kirsher
@ 2015-11-23 19:36 ` Jeff Kirsher
  2015-11-23 19:36 ` [net-next 07/15] ixgbe: " Jeff Kirsher
                   ` (9 subsequent siblings)
  15 siblings, 0 replies; 20+ messages in thread
From: Jeff Kirsher @ 2015-11-23 19:36 UTC (permalink / raw)
  To: davem; +Cc: Alexander Duyck, netdev, nhorman, sassmann, jogreene, Jeff Kirsher

From: Alexander Duyck <aduyck@mirantis.com>

This patch corrects an issue in which the polling routine would increase
the budget for Rx to at least 1 per queue if multiple queues were present.
This would result in Rx packets being processed when the budget was 0 which
is meant to indicate that no Rx can be handled.

Signed-off-by: Alexander Duyck <aduyck@mirantis.com>
Tested-by: Krishneil Singh <Krishneil.k.singh@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/fm10k/fm10k_main.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_main.c b/drivers/net/ethernet/intel/fm10k/fm10k_main.c
index e76a44c..746a198 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_main.c
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_main.c
@@ -1428,6 +1428,10 @@ static int fm10k_poll(struct napi_struct *napi, int budget)
 	fm10k_for_each_ring(ring, q_vector->tx)
 		clean_complete &= fm10k_clean_tx_irq(q_vector, ring);
 
+	/* Handle case where we are called by netpoll with a budget of 0 */
+	if (budget <= 0)
+		return budget;
+
 	/* attempt to distribute budget to each queue fairly, but don't
 	 * allow the budget to go below 1 because we'll exit polling
 	 */
-- 
2.5.0

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

* [net-next 07/15] ixgbe: Fix handling of NAPI budget when multiple queues are enabled per vector
  2015-11-23 19:36 [net-next 00/15][pull request] Intel Wired LAN Driver Updates 2015-11-23 Jeff Kirsher
                   ` (5 preceding siblings ...)
  2015-11-23 19:36 ` [net-next 06/15] fm10k: Fix handling of NAPI budget when multiple queues are enabled per vector Jeff Kirsher
@ 2015-11-23 19:36 ` Jeff Kirsher
  2015-11-27  8:25   ` William Dauchy
  2015-11-23 19:36 ` [net-next 08/15] ixgbe: Add KR mode support for CS4227 chip Jeff Kirsher
                   ` (8 subsequent siblings)
  15 siblings, 1 reply; 20+ messages in thread
From: Jeff Kirsher @ 2015-11-23 19:36 UTC (permalink / raw)
  To: davem; +Cc: Alexander Duyck, netdev, nhorman, sassmann, jogreene, Jeff Kirsher

From: Alexander Duyck <aduyck@mirantis.com>

This patch corrects an issue in which the polling routine would increase
the budget for Rx to at least 1 per queue if multiple queues were present.
This would result in Rx packets being processed when the budget was 0 which
is meant to indicate that no Rx can be handled.

Signed-off-by: Alexander Duyck <aduyck@mirantis.com>
Tested-by: Darin Miller <darin.j.miller@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index c9b7e5e..4fa94a3 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -2783,7 +2783,8 @@ int ixgbe_poll(struct napi_struct *napi, int budget)
 	ixgbe_for_each_ring(ring, q_vector->tx)
 		clean_complete &= !!ixgbe_clean_tx_irq(q_vector, ring);
 
-	if (!ixgbe_qv_lock_napi(q_vector))
+	/* Exit if we are called by netpoll or busy polling is active */
+	if ((budget <= 0) || !ixgbe_qv_lock_napi(q_vector))
 		return budget;
 
 	/* attempt to distribute budget to each queue fairly, but don't allow
-- 
2.5.0

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

* [net-next 08/15] ixgbe: Add KR mode support for CS4227 chip
  2015-11-23 19:36 [net-next 00/15][pull request] Intel Wired LAN Driver Updates 2015-11-23 Jeff Kirsher
                   ` (6 preceding siblings ...)
  2015-11-23 19:36 ` [net-next 07/15] ixgbe: " Jeff Kirsher
@ 2015-11-23 19:36 ` Jeff Kirsher
  2015-11-23 19:36 ` [net-next 09/15] ixgbevf: Limit lowest interrupt rate for adaptive interrupt moderation to 12K Jeff Kirsher
                   ` (7 subsequent siblings)
  15 siblings, 0 replies; 20+ messages in thread
From: Jeff Kirsher @ 2015-11-23 19:36 UTC (permalink / raw)
  To: davem; +Cc: Mark Rustad, netdev, nhorman, sassmann, jogreene, Jeff Kirsher

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

KR auto-neg mode is what we will be using going forward. The SW
interface for this mode is different that what was used for iXFI.

Signed-off-by: Mark Rustad <mark.d.rustad@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_x550.c | 85 +++++++++++++++++++--------
 1 file changed, 62 insertions(+), 23 deletions(-)

diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c
index ebe0ac9..005f01b 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c
@@ -26,6 +26,8 @@
 #include "ixgbe_common.h"
 #include "ixgbe_phy.h"
 
+static s32 ixgbe_setup_kr_speed_x550em(struct ixgbe_hw *, ixgbe_link_speed);
+
 static s32 ixgbe_get_invariants_X550_x(struct ixgbe_hw *hw)
 {
 	struct ixgbe_mac_info *mac = &hw->mac;
@@ -1257,31 +1259,71 @@ ixgbe_setup_mac_link_sfp_x550em(struct ixgbe_hw *hw,
 	if (status)
 		return status;
 
-	/* Configure CS4227 LINE side to 10G SR. */
-	slice = IXGBE_CS4227_LINE_SPARE22_MSB + (hw->bus.lan_id << 12);
-	value = IXGBE_CS4227_SPEED_10G;
-	status = ixgbe_write_i2c_combined_generic(hw, IXGBE_CS4227, slice,
-						  value);
-
-	/* Configure CS4227 for HOST connection rate then type. */
-	slice = IXGBE_CS4227_HOST_SPARE22_MSB + (hw->bus.lan_id << 12);
-	value = speed & IXGBE_LINK_SPEED_10GB_FULL ?
-		IXGBE_CS4227_SPEED_10G : IXGBE_CS4227_SPEED_1G;
-	status = ixgbe_write_i2c_combined_generic(hw, IXGBE_CS4227, slice,
-						  value);
+	if (!(hw->phy.nw_mng_if_sel & IXGBE_NW_MNG_IF_SEL_INT_PHY_MODE)) {
+		/* Configure CS4227 LINE side to 10G SR. */
+		slice = IXGBE_CS4227_LINE_SPARE22_MSB + (hw->bus.lan_id << 12);
+		value = IXGBE_CS4227_SPEED_10G;
+		status = ixgbe_write_i2c_combined_generic(hw, IXGBE_CS4227,
+							  slice, value);
+		if (status)
+			goto i2c_err;
 
-	slice = IXGBE_CS4227_HOST_SPARE24_LSB + (hw->bus.lan_id << 12);
-	if (setup_linear)
-		value = (IXGBE_CS4227_EDC_MODE_CX1 << 1) | 1;
-	else
+		slice = IXGBE_CS4227_LINE_SPARE24_LSB + (hw->bus.lan_id << 12);
 		value = (IXGBE_CS4227_EDC_MODE_SR << 1) | 1;
-	status = ixgbe_write_i2c_combined_generic(hw, IXGBE_CS4227, slice,
-						  value);
+		status = ixgbe_write_i2c_combined_generic(hw, IXGBE_CS4227,
+							  slice, value);
+		if (status)
+			goto i2c_err;
+
+		/* Configure CS4227 for HOST connection rate then type. */
+		slice = IXGBE_CS4227_HOST_SPARE22_MSB + (hw->bus.lan_id << 12);
+		value = speed & IXGBE_LINK_SPEED_10GB_FULL ?
+			IXGBE_CS4227_SPEED_10G : IXGBE_CS4227_SPEED_1G;
+		status = ixgbe_write_i2c_combined_generic(hw, IXGBE_CS4227,
+							  slice, value);
+		if (status)
+			goto i2c_err;
 
-	/* If internal link mode is XFI, then setup XFI internal link. */
-	if (!(hw->phy.nw_mng_if_sel & IXGBE_NW_MNG_IF_SEL_INT_PHY_MODE))
+		slice = IXGBE_CS4227_HOST_SPARE24_LSB + (hw->bus.lan_id << 12);
+		if (setup_linear)
+			value = (IXGBE_CS4227_EDC_MODE_CX1 << 1) | 1;
+		else
+			value = (IXGBE_CS4227_EDC_MODE_SR << 1) | 1;
+		status = ixgbe_write_i2c_combined_generic(hw, IXGBE_CS4227,
+							  slice, value);
+		if (status)
+			goto i2c_err;
+
+		/* Setup XFI internal link. */
 		status = ixgbe_setup_ixfi_x550em(hw, &speed);
+		if (status) {
+			hw_dbg(hw, "setup_ixfi failed with %d\n", status);
+			return status;
+		}
+	} else {
+		/* Configure internal PHY for KR/KX. */
+		status = ixgbe_setup_kr_speed_x550em(hw, speed);
+		if (status) {
+			hw_dbg(hw, "setup_kr_speed failed with %d\n", status);
+			return status;
+		}
 
+		/* Configure CS4227 LINE side to proper mode. */
+		slice = IXGBE_CS4227_LINE_SPARE24_LSB + (hw->bus.lan_id << 12);
+		if (setup_linear)
+			value = (IXGBE_CS4227_EDC_MODE_CX1 << 1) | 1;
+		else
+			value = (IXGBE_CS4227_EDC_MODE_SR << 1) | 1;
+		status = ixgbe_write_i2c_combined_generic(hw, IXGBE_CS4227,
+							  slice, value);
+		if (status)
+			goto i2c_err;
+	}
+
+	return 0;
+
+i2c_err:
+	hw_dbg(hw, "combined i2c access failed with %d\n", status);
 	return status;
 }
 
@@ -1982,12 +2024,9 @@ static s32 ixgbe_init_phy_ops_X550em(struct ixgbe_hw *hw)
 		 * to determine internal PHY mode.
 		 */
 		phy->nw_mng_if_sel = IXGBE_READ_REG(hw, IXGBE_NW_MNG_IF_SEL);
-
-		/* If internal PHY mode is KR, then initialize KR link */
 		if (phy->nw_mng_if_sel & IXGBE_NW_MNG_IF_SEL_INT_PHY_MODE) {
 			speed = IXGBE_LINK_SPEED_10GB_FULL |
 				IXGBE_LINK_SPEED_1GB_FULL;
-			ret_val = ixgbe_setup_kr_speed_x550em(hw, speed);
 		}
 	}
 
-- 
2.5.0

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

* [net-next 09/15] ixgbevf: Limit lowest interrupt rate for adaptive interrupt moderation to 12K
  2015-11-23 19:36 [net-next 00/15][pull request] Intel Wired LAN Driver Updates 2015-11-23 Jeff Kirsher
                   ` (7 preceding siblings ...)
  2015-11-23 19:36 ` [net-next 08/15] ixgbe: Add KR mode support for CS4227 chip Jeff Kirsher
@ 2015-11-23 19:36 ` Jeff Kirsher
  2015-11-23 19:36 ` [net-next 10/15] ixgbe/ixgbevf: use napi_schedule_irqoff() Jeff Kirsher
                   ` (6 subsequent siblings)
  15 siblings, 0 replies; 20+ messages in thread
From: Jeff Kirsher @ 2015-11-23 19:36 UTC (permalink / raw)
  To: davem; +Cc: Alexander Duyck, netdev, nhorman, sassmann, jogreene, Jeff Kirsher

From: Alexander Duyck <aduyck@mirantis.com>

This patch is the ixgbevf version of commit 8ac34f10a5ea4 "ixgbe: Limit
lowest interrupt rate for adaptive interrupt moderation to 12K"

The same logic applies here as well as the same results since a netperf
test will starve for memory in the time from one Tx interrupt to the next.
As a result the ixgbevf driver underperformed when compared to vhost_net.

Signed-off-by: Alexander Duyck <aduyck@mirantis.com>
Tested-by: Darin Miller <darin.j.miller@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/ixgbevf/ethtool.c      | 2 +-
 drivers/net/ethernet/intel/ixgbevf/ixgbevf.h      | 3 +--
 drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c | 6 +++---
 3 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/intel/ixgbevf/ethtool.c b/drivers/net/ethernet/intel/ixgbevf/ethtool.c
index d3e5f5b..c48aef6 100644
--- a/drivers/net/ethernet/intel/ixgbevf/ethtool.c
+++ b/drivers/net/ethernet/intel/ixgbevf/ethtool.c
@@ -774,7 +774,7 @@ static int ixgbevf_set_coalesce(struct net_device *netdev,
 		adapter->tx_itr_setting = ec->tx_coalesce_usecs;
 
 	if (adapter->tx_itr_setting == 1)
-		tx_itr_param = IXGBE_10K_ITR;
+		tx_itr_param = IXGBE_12K_ITR;
 	else
 		tx_itr_param = adapter->tx_itr_setting;
 
diff --git a/drivers/net/ethernet/intel/ixgbevf/ixgbevf.h b/drivers/net/ethernet/intel/ixgbevf/ixgbevf.h
index ec31472..68ec7daa 100644
--- a/drivers/net/ethernet/intel/ixgbevf/ixgbevf.h
+++ b/drivers/net/ethernet/intel/ixgbevf/ixgbevf.h
@@ -326,8 +326,7 @@ static inline bool ixgbevf_qv_disable(struct ixgbevf_q_vector *q_vector)
 #define IXGBE_MIN_RSC_ITR	24
 #define IXGBE_100K_ITR		40
 #define IXGBE_20K_ITR		200
-#define IXGBE_10K_ITR		400
-#define IXGBE_8K_ITR		500
+#define IXGBE_12K_ITR		336
 
 /* Helper macros to switch between ints/sec and what the register uses.
  * And yes, it's the same math going both ways.  The lowest value
diff --git a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
index 2955186..e678178 100644
--- a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
+++ b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
@@ -1138,7 +1138,7 @@ static void ixgbevf_configure_msix(struct ixgbevf_adapter *adapter)
 		if (q_vector->tx.ring && !q_vector->rx.ring) {
 			/* Tx only vector */
 			if (adapter->tx_itr_setting == 1)
-				q_vector->itr = IXGBE_10K_ITR;
+				q_vector->itr = IXGBE_12K_ITR;
 			else
 				q_vector->itr = adapter->tx_itr_setting;
 		} else {
@@ -1196,7 +1196,7 @@ static void ixgbevf_update_itr(struct ixgbevf_q_vector *q_vector,
 	/* simple throttle rate management
 	 *    0-20MB/s lowest (100000 ints/s)
 	 *   20-100MB/s low   (20000 ints/s)
-	 *  100-1249MB/s bulk (8000 ints/s)
+	 *  100-1249MB/s bulk (12000 ints/s)
 	 */
 	/* what was last interrupt timeslice? */
 	timepassed_us = q_vector->itr >> 2;
@@ -1247,7 +1247,7 @@ static void ixgbevf_set_itr(struct ixgbevf_q_vector *q_vector)
 		break;
 	case bulk_latency:
 	default:
-		new_itr = IXGBE_8K_ITR;
+		new_itr = IXGBE_12K_ITR;
 		break;
 	}
 
-- 
2.5.0

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

* [net-next 10/15] ixgbe/ixgbevf: use napi_schedule_irqoff()
  2015-11-23 19:36 [net-next 00/15][pull request] Intel Wired LAN Driver Updates 2015-11-23 Jeff Kirsher
                   ` (8 preceding siblings ...)
  2015-11-23 19:36 ` [net-next 09/15] ixgbevf: Limit lowest interrupt rate for adaptive interrupt moderation to 12K Jeff Kirsher
@ 2015-11-23 19:36 ` Jeff Kirsher
  2015-11-23 19:36 ` [net-next 11/15] ixgbe: Remove CS4227 diagnostic code Jeff Kirsher
                   ` (5 subsequent siblings)
  15 siblings, 0 replies; 20+ messages in thread
From: Jeff Kirsher @ 2015-11-23 19:36 UTC (permalink / raw)
  To: davem; +Cc: Alexander Duyck, netdev, nhorman, sassmann, jogreene, Jeff Kirsher

From: Alexander Duyck <aduyck@mirantis.com>

The ixgbe_intr and ixgbe/ixgbevf_msix_clean_rings functions run from hard
interrupt context or with interrupts already disabled in netpoll.

They can use napi_schedule_irqoff() instead of napi_schedule()

Signed-off-by: Alexander Duyck <aduyck@mirantis.com>
Tested-by: Darin Miller <darin.j.miller@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c     | 4 ++--
 drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index 4fa94a3..c95042e 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -2754,7 +2754,7 @@ static irqreturn_t ixgbe_msix_clean_rings(int irq, void *data)
 	/* EIAM disabled interrupts (on this vector) for us */
 
 	if (q_vector->rx.ring || q_vector->tx.ring)
-		napi_schedule(&q_vector->napi);
+		napi_schedule_irqoff(&q_vector->napi);
 
 	return IRQ_HANDLED;
 }
@@ -2948,7 +2948,7 @@ static irqreturn_t ixgbe_intr(int irq, void *data)
 		ixgbe_ptp_check_pps_event(adapter, eicr);
 
 	/* would disable interrupts here but EIAM disabled it */
-	napi_schedule(&q_vector->napi);
+	napi_schedule_irqoff(&q_vector->napi);
 
 	/*
 	 * re-enable link(maybe) and non-queue interrupts, no flush.
diff --git a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
index e678178..1b15f95 100644
--- a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
+++ b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
@@ -1288,7 +1288,7 @@ static irqreturn_t ixgbevf_msix_clean_rings(int irq, void *data)
 
 	/* EIAM disabled interrupts (on this vector) for us */
 	if (q_vector->rx.ring || q_vector->tx.ring)
-		napi_schedule(&q_vector->napi);
+		napi_schedule_irqoff(&q_vector->napi);
 
 	return IRQ_HANDLED;
 }
-- 
2.5.0

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

* [net-next 11/15] ixgbe: Remove CS4227 diagnostic code
  2015-11-23 19:36 [net-next 00/15][pull request] Intel Wired LAN Driver Updates 2015-11-23 Jeff Kirsher
                   ` (9 preceding siblings ...)
  2015-11-23 19:36 ` [net-next 10/15] ixgbe/ixgbevf: use napi_schedule_irqoff() Jeff Kirsher
@ 2015-11-23 19:36 ` Jeff Kirsher
  2015-11-23 19:36 ` [net-next 12/15] i40evf: fix compiler warning of unused variable Jeff Kirsher
                   ` (4 subsequent siblings)
  15 siblings, 0 replies; 20+ messages in thread
From: Jeff Kirsher @ 2015-11-23 19:36 UTC (permalink / raw)
  To: davem; +Cc: Mark Rustad, netdev, nhorman, sassmann, jogreene, Jeff Kirsher

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

Testing has now shown that the diagnostic code used with the CS4227
is no longer needed, so remove it.

Signed-off-by: Mark Rustad <mark.d.rustad@intel.com>
Tested-by: Darin Miller <darin.j.miller@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c | 80 ---------------------------
 1 file changed, 80 deletions(-)

diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c
index 005f01b..bf2ae8d 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_x550.c
@@ -87,79 +87,6 @@ static s32 ixgbe_write_cs4227(struct ixgbe_hw *hw, u16 reg, u16 value)
 }
 
 /**
- * ixgbe_check_cs4227_reg - Perform diag on a CS4227 register
- * @hw: pointer to hardware structure
- * @reg: the register to check
- *
- * Performs a diagnostic on a register in the CS4227 chip. Returns an error
- * if it is not operating correctly.
- * This function assumes that the caller has acquired the proper semaphore.
- */
-static s32 ixgbe_check_cs4227_reg(struct ixgbe_hw *hw, u16 reg)
-{
-	s32 status;
-	u32 retry;
-	u16 reg_val;
-
-	reg_val = (IXGBE_CS4227_EDC_MODE_DIAG << 1) | 1;
-	status = ixgbe_write_cs4227(hw, reg, reg_val);
-	if (status)
-		return status;
-	for (retry = 0; retry < IXGBE_CS4227_RETRIES; retry++) {
-		msleep(IXGBE_CS4227_CHECK_DELAY);
-		reg_val = 0xFFFF;
-		ixgbe_read_cs4227(hw, reg, &reg_val);
-		if (!reg_val)
-			break;
-	}
-	if (reg_val) {
-		hw_err(hw, "CS4227 reg 0x%04X failed diagnostic\n", reg);
-		return status;
-	}
-
-	return 0;
-}
-
-/**
- * ixgbe_get_cs4227_status - Return CS4227 status
- * @hw: pointer to hardware structure
- *
- * Performs a diagnostic on the CS4227 chip. Returns an error if it is
- * not operating correctly.
- * This function assumes that the caller has acquired the proper semaphore.
- */
-static s32 ixgbe_get_cs4227_status(struct ixgbe_hw *hw)
-{
-	s32 status;
-	u16 value = 0;
-
-	/* Exit if the diagnostic has already been performed. */
-	status = ixgbe_read_cs4227(hw, IXGBE_CS4227_SCRATCH, &value);
-	if (status)
-		return status;
-	if (value == IXGBE_CS4227_RESET_COMPLETE)
-		return 0;
-
-	/* Check port 0. */
-	status = ixgbe_check_cs4227_reg(hw, IXGBE_CS4227_LINE_SPARE24_LSB);
-	if (status)
-		return status;
-
-	status = ixgbe_check_cs4227_reg(hw, IXGBE_CS4227_HOST_SPARE24_LSB);
-	if (status)
-		return status;
-
-	/* Check port 1. */
-	status = ixgbe_check_cs4227_reg(hw, IXGBE_CS4227_LINE_SPARE24_LSB +
-					(1 << 12));
-	if (status)
-		return status;
-
-	return ixgbe_check_cs4227_reg(hw, IXGBE_CS4227_HOST_SPARE24_LSB +
-				      (1 << 12));
-}
-
-/**
  * ixgbe_read_pe - Read register from port expander
  * @hw: pointer to hardware structure
  * @reg: register number to read
@@ -328,13 +255,6 @@ static void ixgbe_check_cs4227(struct ixgbe_hw *hw)
 		return;
 	}
 
-	/* Is the CS4227 working correctly? */
-	status = ixgbe_get_cs4227_status(hw);
-	if (status) {
-		hw_err(hw, "CS4227 status failed: %d", status);
-		goto out;
-	}
-
 	/* Record completion for next time. */
 	status = ixgbe_write_cs4227(hw, IXGBE_CS4227_SCRATCH,
 				    IXGBE_CS4227_RESET_COMPLETE);
-- 
2.5.0

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

* [net-next 12/15] i40evf: fix compiler warning of unused variable
  2015-11-23 19:36 [net-next 00/15][pull request] Intel Wired LAN Driver Updates 2015-11-23 Jeff Kirsher
                   ` (10 preceding siblings ...)
  2015-11-23 19:36 ` [net-next 11/15] ixgbe: Remove CS4227 diagnostic code Jeff Kirsher
@ 2015-11-23 19:36 ` Jeff Kirsher
  2015-11-26 14:03   ` Sergei Shtylyov
  2015-11-23 19:36 ` [net-next 13/15] ixgbevf: use ether_addr_copy instead of memcpy Jeff Kirsher
                   ` (3 subsequent siblings)
  15 siblings, 1 reply; 20+ messages in thread
From: Jeff Kirsher @ 2015-11-23 19:36 UTC (permalink / raw)
  To: davem; +Cc: Jesse Brandeburg, netdev, nhorman, sassmann, jogreene, Jeff Kirsher

From: Jesse Brandeburg <jesse.brandeburg@intel.com>

Compiler complained of an unused variable, which the driver was just
using to store the result of a rd32 which is used to clear a register
unconditionally.  Just drop the unused variable and re-use one.

Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/i40evf/i40evf_main.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/intel/i40evf/i40evf_main.c b/drivers/net/ethernet/intel/i40evf/i40evf_main.c
index d962164..6ad6265 100644
--- a/drivers/net/ethernet/intel/i40evf/i40evf_main.c
+++ b/drivers/net/ethernet/intel/i40evf/i40evf_main.c
@@ -307,10 +307,9 @@ static irqreturn_t i40evf_msix_aq(int irq, void *data)
 	struct i40e_hw *hw = &adapter->hw;
 	u32 val;
 
-	/* handle non-queue interrupts */
-	rd32(hw, I40E_VFINT_ICR01);
-	rd32(hw, I40E_VFINT_ICR0_ENA1);
-
+	/* handle non-queue interrupts, these reads clear the registers */
+	val = rd32(hw, I40E_VFINT_ICR01);
+	val = rd32(hw, I40E_VFINT_ICR0_ENA1);
 
 	val = rd32(hw, I40E_VFINT_DYN_CTL01) |
 	      I40E_VFINT_DYN_CTL01_CLEARPBA_MASK;
-- 
2.5.0

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

* [net-next 13/15] ixgbevf: use ether_addr_copy instead of memcpy
  2015-11-23 19:36 [net-next 00/15][pull request] Intel Wired LAN Driver Updates 2015-11-23 Jeff Kirsher
                   ` (11 preceding siblings ...)
  2015-11-23 19:36 ` [net-next 12/15] i40evf: fix compiler warning of unused variable Jeff Kirsher
@ 2015-11-23 19:36 ` Jeff Kirsher
  2015-11-23 19:36 ` [net-next 14/15] ixgbevf: fix spoofed packets with random MAC Jeff Kirsher
                   ` (2 subsequent siblings)
  15 siblings, 0 replies; 20+ messages in thread
From: Jeff Kirsher @ 2015-11-23 19:36 UTC (permalink / raw)
  To: davem; +Cc: Emil Tantilov, netdev, nhorman, sassmann, jogreene, Jeff Kirsher

From: Emil Tantilov <emil.s.tantilov@intel.com>

replace some instances of memcpy for setting up the mac address with
ether_addr_copy()

Signed-off-by: Emil Tantilov <emil.s.tantilov@intel.com>
Tested-by: Darin Miller <darin.j.miller@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
index 1b15f95..47c71e1 100644
--- a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
+++ b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
@@ -2260,10 +2260,8 @@ void ixgbevf_reset(struct ixgbevf_adapter *adapter)
 	}
 
 	if (is_valid_ether_addr(adapter->hw.mac.addr)) {
-		memcpy(netdev->dev_addr, adapter->hw.mac.addr,
-		       netdev->addr_len);
-		memcpy(netdev->perm_addr, adapter->hw.mac.addr,
-		       netdev->addr_len);
+		ether_addr_copy(netdev->dev_addr, adapter->hw.mac.addr);
+		ether_addr_copy(netdev->perm_addr, adapter->hw.mac.addr);
 	}
 
 	adapter->last_reset = jiffies;
@@ -2659,13 +2657,13 @@ static int ixgbevf_sw_init(struct ixgbevf_adapter *adapter)
 		else if (is_zero_ether_addr(adapter->hw.mac.addr))
 			dev_info(&pdev->dev,
 				 "MAC address not assigned by administrator.\n");
-		memcpy(netdev->dev_addr, hw->mac.addr, netdev->addr_len);
+		ether_addr_copy(netdev->dev_addr, hw->mac.addr);
 	}
 
 	if (!is_valid_ether_addr(netdev->dev_addr)) {
 		dev_info(&pdev->dev, "Assigning random MAC address\n");
 		eth_hw_addr_random(netdev);
-		memcpy(hw->mac.addr, netdev->dev_addr, netdev->addr_len);
+		ether_addr_copy(hw->mac.addr, netdev->dev_addr);
 	}
 
 	/* Enable dynamic interrupt throttling rates */
@@ -3695,8 +3693,8 @@ static int ixgbevf_set_mac(struct net_device *netdev, void *p)
 	if (!is_valid_ether_addr(addr->sa_data))
 		return -EADDRNOTAVAIL;
 
-	memcpy(netdev->dev_addr, addr->sa_data, netdev->addr_len);
-	memcpy(hw->mac.addr, addr->sa_data, netdev->addr_len);
+	ether_addr_copy(netdev->dev_addr, addr->sa_data);
+	ether_addr_copy(hw->mac.addr, addr->sa_data);
 
 	spin_lock_bh(&adapter->mbx_lock);
 
-- 
2.5.0

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

* [net-next 14/15] ixgbevf: fix spoofed packets with random MAC
  2015-11-23 19:36 [net-next 00/15][pull request] Intel Wired LAN Driver Updates 2015-11-23 Jeff Kirsher
                   ` (12 preceding siblings ...)
  2015-11-23 19:36 ` [net-next 13/15] ixgbevf: use ether_addr_copy instead of memcpy Jeff Kirsher
@ 2015-11-23 19:36 ` Jeff Kirsher
  2015-11-23 19:36 ` [net-next 15/15] intel: i40e: fix confused code Jeff Kirsher
  2015-11-24 15:39 ` [net-next 00/15][pull request] Intel Wired LAN Driver Updates 2015-11-23 David Miller
  15 siblings, 0 replies; 20+ messages in thread
From: Jeff Kirsher @ 2015-11-23 19:36 UTC (permalink / raw)
  To: davem; +Cc: Emil Tantilov, netdev, nhorman, sassmann, jogreene, Jeff Kirsher

From: Emil Tantilov <emil.s.tantilov@intel.com>

If ixgbevf is loaded while the corresponding PF interface is down
and the driver assigns a random MAC address, that address can be
overwritten with the value of hw->mac.perm_addr, which would be 0 at
that point.

To avoid this case we init hw->mac.perm_addr to the randomly generated
address and do not set it unless we receive ACK from ixgbe.

Reported-by: John Greene <jogreene@redhat.com>
Signed-off-by: Emil Tantilov <emil.s.tantilov@intel.com>
Tested-by: Krishneil Singh <Krishneil.k.singh@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c | 1 +
 drivers/net/ethernet/intel/ixgbevf/vf.c           | 4 +++-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
index 47c71e1..dbbd1be 100644
--- a/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
+++ b/drivers/net/ethernet/intel/ixgbevf/ixgbevf_main.c
@@ -2664,6 +2664,7 @@ static int ixgbevf_sw_init(struct ixgbevf_adapter *adapter)
 		dev_info(&pdev->dev, "Assigning random MAC address\n");
 		eth_hw_addr_random(netdev);
 		ether_addr_copy(hw->mac.addr, netdev->dev_addr);
+		ether_addr_copy(hw->mac.perm_addr, netdev->dev_addr);
 	}
 
 	/* Enable dynamic interrupt throttling rates */
diff --git a/drivers/net/ethernet/intel/ixgbevf/vf.c b/drivers/net/ethernet/intel/ixgbevf/vf.c
index 427f360..61a98f4 100644
--- a/drivers/net/ethernet/intel/ixgbevf/vf.c
+++ b/drivers/net/ethernet/intel/ixgbevf/vf.c
@@ -117,7 +117,9 @@ static s32 ixgbevf_reset_hw_vf(struct ixgbe_hw *hw)
 	    msgbuf[0] != (IXGBE_VF_RESET | IXGBE_VT_MSGTYPE_NACK))
 		return IXGBE_ERR_INVALID_MAC_ADDR;
 
-	ether_addr_copy(hw->mac.perm_addr, addr);
+	if (msgbuf[0] == (IXGBE_VF_RESET | IXGBE_VT_MSGTYPE_ACK))
+		ether_addr_copy(hw->mac.perm_addr, addr);
+
 	hw->mac.mc_filter_type = msgbuf[IXGBE_VF_MC_TYPE_WORD];
 
 	return 0;
-- 
2.5.0

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

* [net-next 15/15] intel: i40e: fix confused code
  2015-11-23 19:36 [net-next 00/15][pull request] Intel Wired LAN Driver Updates 2015-11-23 Jeff Kirsher
                   ` (13 preceding siblings ...)
  2015-11-23 19:36 ` [net-next 14/15] ixgbevf: fix spoofed packets with random MAC Jeff Kirsher
@ 2015-11-23 19:36 ` Jeff Kirsher
  2015-11-24 15:39 ` [net-next 00/15][pull request] Intel Wired LAN Driver Updates 2015-11-23 David Miller
  15 siblings, 0 replies; 20+ messages in thread
From: Jeff Kirsher @ 2015-11-23 19:36 UTC (permalink / raw)
  To: davem; +Cc: Rasmus Villemoes, netdev, nhorman, sassmann, jogreene, Jeff Kirsher

From: Rasmus Villemoes <linux@rasmusvillemoes.dk>

This code is pretty confused. The variable name 'bytes_not_copied'
clearly indicates that the programmer knew the semantics of
copy_{to,from}_user, but then the return value is checked for being
negative and used as a -Exxx return value.

I'm not sure this is the proper fix, but at least we get rid of the
dead code which pretended to check for access faults.

Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Acked-by: Shannon Nelson <shannon.nelson@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/i40e/i40e_debugfs.c | 24 ++++++++++--------------
 1 file changed, 10 insertions(+), 14 deletions(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_debugfs.c b/drivers/net/ethernet/intel/i40e/i40e_debugfs.c
index d4b7af9..d1a91c8 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_debugfs.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_debugfs.c
@@ -103,8 +103,8 @@ static ssize_t i40e_dbg_dump_read(struct file *filp, char __user *buffer,
 	len = min_t(int, count, (i40e_dbg_dump_data_len - *ppos));
 
 	bytes_not_copied = copy_to_user(buffer, &i40e_dbg_dump_buf[*ppos], len);
-	if (bytes_not_copied < 0)
-		return bytes_not_copied;
+	if (bytes_not_copied)
+		return -EFAULT;
 
 	*ppos += len;
 	return len;
@@ -353,8 +353,8 @@ static ssize_t i40e_dbg_command_read(struct file *filp, char __user *buffer,
 	bytes_not_copied = copy_to_user(buffer, buf, len);
 	kfree(buf);
 
-	if (bytes_not_copied < 0)
-		return bytes_not_copied;
+	if (bytes_not_copied)
+		return -EFAULT;
 
 	*ppos = len;
 	return len;
@@ -981,12 +981,10 @@ static ssize_t i40e_dbg_command_write(struct file *filp,
 	if (!cmd_buf)
 		return count;
 	bytes_not_copied = copy_from_user(cmd_buf, buffer, count);
-	if (bytes_not_copied < 0) {
+	if (bytes_not_copied) {
 		kfree(cmd_buf);
-		return bytes_not_copied;
+		return -EFAULT;
 	}
-	if (bytes_not_copied > 0)
-		count -= bytes_not_copied;
 	cmd_buf[count] = '\0';
 
 	cmd_buf_tmp = strchr(cmd_buf, '\n');
@@ -2034,8 +2032,8 @@ static ssize_t i40e_dbg_netdev_ops_read(struct file *filp, char __user *buffer,
 	bytes_not_copied = copy_to_user(buffer, buf, len);
 	kfree(buf);
 
-	if (bytes_not_copied < 0)
-		return bytes_not_copied;
+	if (bytes_not_copied)
+		return -EFAULT;
 
 	*ppos = len;
 	return len;
@@ -2068,10 +2066,8 @@ static ssize_t i40e_dbg_netdev_ops_write(struct file *filp,
 	memset(i40e_dbg_netdev_ops_buf, 0, sizeof(i40e_dbg_netdev_ops_buf));
 	bytes_not_copied = copy_from_user(i40e_dbg_netdev_ops_buf,
 					  buffer, count);
-	if (bytes_not_copied < 0)
-		return bytes_not_copied;
-	else if (bytes_not_copied > 0)
-		count -= bytes_not_copied;
+	if (bytes_not_copied)
+		return -EFAULT;
 	i40e_dbg_netdev_ops_buf[count] = '\0';
 
 	buf_tmp = strchr(i40e_dbg_netdev_ops_buf, '\n');
-- 
2.5.0

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

* Re: [net-next 00/15][pull request] Intel Wired LAN Driver Updates 2015-11-23
  2015-11-23 19:36 [net-next 00/15][pull request] Intel Wired LAN Driver Updates 2015-11-23 Jeff Kirsher
                   ` (14 preceding siblings ...)
  2015-11-23 19:36 ` [net-next 15/15] intel: i40e: fix confused code Jeff Kirsher
@ 2015-11-24 15:39 ` David Miller
  15 siblings, 0 replies; 20+ messages in thread
From: David Miller @ 2015-11-24 15:39 UTC (permalink / raw)
  To: jeffrey.t.kirsher; +Cc: netdev, nhorman, sassmann, jogreene, john.ronciak

From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Date: Mon, 23 Nov 2015 11:36:01 -0800

> This series contains updates to ixgbe, ixgbevf, fm10k, i40e and i40evf.
 ...
> The following are changes since commit 3d40e44361eab3dd6c969241d12dac7466eb7174:
>   Merge branch 'dsa-gpio-reset'
> and are available in the git repository at:
>   git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/next-queue master

Pulled, thanks a lot Jeff.

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

* Re: [net-next 04/15] ixgbe: Delete redundant include file
  2015-11-23 19:36 ` [net-next 04/15] ixgbe: Delete redundant include file Jeff Kirsher
@ 2015-11-24 18:36   ` Joe Perches
  0 siblings, 0 replies; 20+ messages in thread
From: Joe Perches @ 2015-11-24 18:36 UTC (permalink / raw)
  To: Jeff Kirsher, davem; +Cc: Mark Rustad, netdev, nhorman, sassmann, jogreene

On Mon, 2015-11-23 at 11:36 -0800, Jeff Kirsher wrote:
> Delete a redundant include of net/vxlan.h.

unrelated trivia:

> diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
[]
>  char ixgbe_driver_name[] = "ixgbe";

This could be const or a #define

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

* Re: [net-next 12/15] i40evf: fix compiler warning of unused variable
  2015-11-23 19:36 ` [net-next 12/15] i40evf: fix compiler warning of unused variable Jeff Kirsher
@ 2015-11-26 14:03   ` Sergei Shtylyov
  0 siblings, 0 replies; 20+ messages in thread
From: Sergei Shtylyov @ 2015-11-26 14:03 UTC (permalink / raw)
  To: Jeff Kirsher, davem; +Cc: Jesse Brandeburg, netdev, nhorman, sassmann, jogreene

Hello.

On 11/23/2015 10:36 PM, Jeff Kirsher wrote:

> From: Jesse Brandeburg <jesse.brandeburg@intel.com>
>
> Compiler complained of an unused variable, which the driver was just
> using to store the result of a rd32 which is used to clear a register
> unconditionally.  Just drop the unused variable and re-use one.

   I don't see Jesse dropping anything...

> Signed-off-by: Jesse Brandeburg <jesse.brandeburg@intel.com>
> Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
> ---
>   drivers/net/ethernet/intel/i40evf/i40evf_main.c | 7 +++----
>   1 file changed, 3 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/ethernet/intel/i40evf/i40evf_main.c b/drivers/net/ethernet/intel/i40evf/i40evf_main.c
> index d962164..6ad6265 100644
> --- a/drivers/net/ethernet/intel/i40evf/i40evf_main.c
> +++ b/drivers/net/ethernet/intel/i40evf/i40evf_main.c
> @@ -307,10 +307,9 @@ static irqreturn_t i40evf_msix_aq(int irq, void *data)
>   	struct i40e_hw *hw = &adapter->hw;
>   	u32 val;
>
> -	/* handle non-queue interrupts */
> -	rd32(hw, I40E_VFINT_ICR01);
> -	rd32(hw, I40E_VFINT_ICR0_ENA1);
> -
> +	/* handle non-queue interrupts, these reads clear the registers */
> +	val = rd32(hw, I40E_VFINT_ICR01);
> +	val = rd32(hw, I40E_VFINT_ICR0_ENA1);

    Why if it's ignored anyway?

>
>   	val = rd32(hw, I40E_VFINT_DYN_CTL01) |
>   	      I40E_VFINT_DYN_CTL01_CLEARPBA_MASK;


MBR, Sergei

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

* Re: [net-next 07/15] ixgbe: Fix handling of NAPI budget when multiple queues are enabled per vector
  2015-11-23 19:36 ` [net-next 07/15] ixgbe: " Jeff Kirsher
@ 2015-11-27  8:25   ` William Dauchy
  0 siblings, 0 replies; 20+ messages in thread
From: William Dauchy @ 2015-11-27  8:25 UTC (permalink / raw)
  To: Jeff Kirsher
  Cc: David S. Miller, Alexander Duyck, NETDEV, nhorman, sassmann, jogreene

Hello Jeff,

There is also the equivalent patch for ixgbevf
http://patchwork.ozlabs.org/patch/539065/


On Mon, Nov 23, 2015 at 8:36 PM, Jeff Kirsher
<jeffrey.t.kirsher@intel.com> wrote:
> From: Alexander Duyck <aduyck@mirantis.com>
>
> This patch corrects an issue in which the polling routine would increase
> the budget for Rx to at least 1 per queue if multiple queues were present.
> This would result in Rx packets being processed when the budget was 0 which
> is meant to indicate that no Rx can be handled.
>
> Signed-off-by: Alexander Duyck <aduyck@mirantis.com>
> Tested-by: Darin Miller <darin.j.miller@intel.com>
> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
> ---
>  drivers/net/ethernet/intel/ixgbe/ixgbe_main.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
> index c9b7e5e..4fa94a3 100644
> --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
> +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
> @@ -2783,7 +2783,8 @@ int ixgbe_poll(struct napi_struct *napi, int budget)
>         ixgbe_for_each_ring(ring, q_vector->tx)
>                 clean_complete &= !!ixgbe_clean_tx_irq(q_vector, ring);
>
> -       if (!ixgbe_qv_lock_napi(q_vector))
> +       /* Exit if we are called by netpoll or busy polling is active */
> +       if ((budget <= 0) || !ixgbe_qv_lock_napi(q_vector))
>                 return budget;
>
>         /* attempt to distribute budget to each queue fairly, but don't allow
> --
> 2.5.0

-- 
William

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

end of thread, other threads:[~2015-11-27  8:25 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-23 19:36 [net-next 00/15][pull request] Intel Wired LAN Driver Updates 2015-11-23 Jeff Kirsher
2015-11-23 19:36 ` [net-next 01/15] fm10k: do not assume VF always has 1 queue Jeff Kirsher
2015-11-23 19:36 ` [net-next 02/15] fm10k: Correct MTU for jumbo frames Jeff Kirsher
2015-11-23 19:36 ` [net-next 03/15] ixgbe: drop null test before destroy functions Jeff Kirsher
2015-11-23 19:36 ` [net-next 04/15] ixgbe: Delete redundant include file Jeff Kirsher
2015-11-24 18:36   ` Joe Perches
2015-11-23 19:36 ` [net-next 05/15] ixgbe: fix multiple kernel-doc errors Jeff Kirsher
2015-11-23 19:36 ` [net-next 06/15] fm10k: Fix handling of NAPI budget when multiple queues are enabled per vector Jeff Kirsher
2015-11-23 19:36 ` [net-next 07/15] ixgbe: " Jeff Kirsher
2015-11-27  8:25   ` William Dauchy
2015-11-23 19:36 ` [net-next 08/15] ixgbe: Add KR mode support for CS4227 chip Jeff Kirsher
2015-11-23 19:36 ` [net-next 09/15] ixgbevf: Limit lowest interrupt rate for adaptive interrupt moderation to 12K Jeff Kirsher
2015-11-23 19:36 ` [net-next 10/15] ixgbe/ixgbevf: use napi_schedule_irqoff() Jeff Kirsher
2015-11-23 19:36 ` [net-next 11/15] ixgbe: Remove CS4227 diagnostic code Jeff Kirsher
2015-11-23 19:36 ` [net-next 12/15] i40evf: fix compiler warning of unused variable Jeff Kirsher
2015-11-26 14:03   ` Sergei Shtylyov
2015-11-23 19:36 ` [net-next 13/15] ixgbevf: use ether_addr_copy instead of memcpy Jeff Kirsher
2015-11-23 19:36 ` [net-next 14/15] ixgbevf: fix spoofed packets with random MAC Jeff Kirsher
2015-11-23 19:36 ` [net-next 15/15] intel: i40e: fix confused code Jeff Kirsher
2015-11-24 15:39 ` [net-next 00/15][pull request] Intel Wired LAN Driver Updates 2015-11-23 David Miller

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.