All of lore.kernel.org
 help / color / mirror / Atom feed
* [net-next 00/14][pull request] 40GbE Intel Wired LAN Driver Updates 2017-07-25
@ 2017-07-26 10:31 Jeff Kirsher
  2017-07-26 10:31 ` [net-next 01/14] i40e: fix incorrect variable assignment Jeff Kirsher
                   ` (14 more replies)
  0 siblings, 15 replies; 19+ messages in thread
From: Jeff Kirsher @ 2017-07-26 10:31 UTC (permalink / raw)
  To: davem; +Cc: Jeff Kirsher, netdev, nhorman, sassmann, jogreene

This series contains updates to i40e and i40evf only.

Gustavo Silva fixes a variable assignment, where the incorrect variable
was being used to store the error parameter.

Carolyn provides a fix for a problem found in systems when entering S4
state, by ensuring that the misc vector's IRQ is disabled as well.

Jake removes the single-threaded restriction on the module workqueue,
which was causing issues with events such as CORER.  Does some future
proofing, by changing how the driver displays the UDP tunnel type.

Paul adds a retry in releasing resources if the admin queue times out
during the first attempt to release the resources.

Jesse fixes up references to 32bit timspec, since there are a small set
of errors on 32 bit, so we need to be using the right calls for dealing
with timespec64 variables.  Cleaned up code indentation and corrected
an "if" conditional check, as well as making the code flow more clear.
Cast or changed the types to remove warnings for comparing signed and
unsigned types.  Adds missing includes in i40evf, which were being used
but were not being directly included.

Daniel Borkmann fixes i40e to fill the XDP prog_id with the id just like
other XDP enabled drivers, so that on dump we can retrieve the attached
program based on the id and dump BPF insns, opcodes, etc back to user
space.

Tushar Dave adds le32_to_cpu while evaluating the hardware descriptor
fields, since they are in little-endian format.  Also removed
unnecessary "__packed" to a couple of i40evf structures.

Stefan Assmann fixes an issue when an administratively set MAC was set
and should now be switched back to 00:00:00:00:00:00, the pf_set_mac
flag is not being toggled back to false.

The following are changes since commit 34c8c10a766c8daf42293664f5c9ca5516fa3f41:
  Merge branch 'bnxt_en-Fix-kbuild-errors-and-rename-phys_port_name'
and are available in the git repository at:
  git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/next-queue 40GbE

Carolyn Wyborny (1):
  i40e: Fix for trace found with S4 state

Daniel Borkmann (1):
  i40e: report BPF prog id during XDP_QUERY_PROG

Gustavo A R Silva (1):
  i40e: fix incorrect variable assignment

Jacob Keller (2):
  i40e: remove WQ_UNBOUND and the task limit of our workqueue
  i40e: display correct UDP tunnel type name

Jesse Brandeburg (5):
  i40e: fix up 32 bit timespec references
  i40e: fix odd formatting and indent
  i40e/i40evf: make IPv6 ATR code clearer
  i40e/i40evf: remove mismatched type warnings
  i40evf: add some missing includes

Paul M Stillwell Jr (1):
  i40e: Handle admin Q timeout when releasing NVM

Stefan Assmann (1):
  i40e: handle setting administratively set MAC address back to zero

Tushar Dave (2):
  i40evf: Use le32_to_cpu before evaluating HW desc fields
  i40evf: remove unnecessary __packed

 drivers/net/ethernet/intel/i40e/i40e_ethtool.c     |  6 +--
 drivers/net/ethernet/intel/i40e/i40e_main.c        | 57 ++++++++++++++++------
 drivers/net/ethernet/intel/i40e/i40e_nvm.c         | 21 +++++++-
 drivers/net/ethernet/intel/i40e/i40e_ptp.c         |  5 +-
 drivers/net/ethernet/intel/i40e/i40e_txrx.c        | 18 ++++---
 drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 32 +++++++-----
 drivers/net/ethernet/intel/i40evf/i40e_osdep.h     |  4 +-
 drivers/net/ethernet/intel/i40evf/i40e_txrx.c      |  6 +--
 drivers/net/ethernet/intel/i40evf/i40evf.h         | 11 +++++
 drivers/net/ethernet/intel/i40evf/i40evf_ethtool.c |  4 +-
 drivers/net/ethernet/intel/i40evf/i40evf_main.c    | 14 +++---
 11 files changed, 122 insertions(+), 56 deletions(-)

-- 
2.13.3

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

* [net-next 01/14] i40e: fix incorrect variable assignment
  2017-07-26 10:31 [net-next 00/14][pull request] 40GbE Intel Wired LAN Driver Updates 2017-07-25 Jeff Kirsher
@ 2017-07-26 10:31 ` Jeff Kirsher
  2017-07-26 10:31 ` [net-next 02/14] i40e: Fix for trace found with S4 state Jeff Kirsher
                   ` (13 subsequent siblings)
  14 siblings, 0 replies; 19+ messages in thread
From: Jeff Kirsher @ 2017-07-26 10:31 UTC (permalink / raw)
  To: davem
  Cc: Gustavo A R Silva, netdev, nhorman, sassmann, jogreene, Jeff Kirsher

From: Gustavo A R Silva <garsilva@embeddedor.com>

Fix incorrect variable assignment.
Based on line 1511: aq_ret = I40_ERR_PARAM; the correct variable to be
used in this instance is aq_ret instead of ret. Also, variable ret is
updated at line 1602 just before return, so assigning a value to this
variable in this code block is useless.

Addresses-Coverity-ID: 1397693
Signed-off-by: Gustavo A R Silva <garsilva@embeddedor.com>
Acked-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/i40e/i40e_virtchnl_pf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
index ecbe40ea8ffe..ba327e90f32a 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
@@ -1567,7 +1567,7 @@ static int i40e_vc_get_vf_resources_msg(struct i40e_vf *vf, u8 *msg)
 			dev_err(&pf->pdev->dev,
 				"VF %d requested polling mode: this feature is supported only when the device is running in single function per port (SFP) mode\n",
 				 vf->vf_id);
-			ret = I40E_ERR_PARAM;
+			aq_ret = I40E_ERR_PARAM;
 			goto err;
 		}
 		vfres->vf_offload_flags |= VIRTCHNL_VF_OFFLOAD_RX_POLLING;
-- 
2.13.3

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

* [net-next 02/14] i40e: Fix for trace found with S4 state
  2017-07-26 10:31 [net-next 00/14][pull request] 40GbE Intel Wired LAN Driver Updates 2017-07-25 Jeff Kirsher
  2017-07-26 10:31 ` [net-next 01/14] i40e: fix incorrect variable assignment Jeff Kirsher
@ 2017-07-26 10:31 ` Jeff Kirsher
  2017-07-26 10:31 ` [net-next 03/14] i40e: remove WQ_UNBOUND and the task limit of our workqueue Jeff Kirsher
                   ` (12 subsequent siblings)
  14 siblings, 0 replies; 19+ messages in thread
From: Jeff Kirsher @ 2017-07-26 10:31 UTC (permalink / raw)
  To: davem; +Cc: Carolyn Wyborny, netdev, nhorman, sassmann, jogreene, Jeff Kirsher

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

This patch fixes a problem found in systems when entering
S4 state.  This patch fixes the problem by ensuring that
the misc vector's IRQ is disabled as well.  Without this
patch a stack trace can be seen upon entering S4 state.

Signed-off-by: Carolyn Wyborny <carolyn.wyborny@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/i40e/i40e_main.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index 2db93d3f6d23..933b8e357ee4 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -12089,7 +12089,10 @@ static int i40e_suspend(struct pci_dev *pdev, pm_message_t state)
 	wr32(hw, I40E_PFPM_WUFC, (pf->wol_en ? I40E_PFPM_WUFC_MAG_MASK : 0));
 
 	i40e_stop_misc_vector(pf);
-
+	if (pf->msix_entries) {
+		synchronize_irq(pf->msix_entries[0].vector);
+		free_irq(pf->msix_entries[0].vector, pf);
+	}
 	retval = pci_save_state(pdev);
 	if (retval)
 		return retval;
@@ -12129,6 +12132,15 @@ static int i40e_resume(struct pci_dev *pdev)
 	/* handling the reset will rebuild the device state */
 	if (test_and_clear_bit(__I40E_SUSPENDED, pf->state)) {
 		clear_bit(__I40E_DOWN, pf->state);
+		if (pf->msix_entries) {
+			err = request_irq(pf->msix_entries[0].vector,
+					  i40e_intr, 0, pf->int_name, pf);
+			if (err) {
+				dev_err(&pf->pdev->dev,
+					"request_irq for %s failed: %d\n",
+					pf->int_name, err);
+			}
+		}
 		i40e_reset_and_rebuild(pf, false, false);
 	}
 
-- 
2.13.3

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

* [net-next 03/14] i40e: remove WQ_UNBOUND and the task limit of our workqueue
  2017-07-26 10:31 [net-next 00/14][pull request] 40GbE Intel Wired LAN Driver Updates 2017-07-25 Jeff Kirsher
  2017-07-26 10:31 ` [net-next 01/14] i40e: fix incorrect variable assignment Jeff Kirsher
  2017-07-26 10:31 ` [net-next 02/14] i40e: Fix for trace found with S4 state Jeff Kirsher
@ 2017-07-26 10:31 ` Jeff Kirsher
  2017-07-26 10:31 ` [net-next 04/14] i40e: Handle admin Q timeout when releasing NVM Jeff Kirsher
                   ` (11 subsequent siblings)
  14 siblings, 0 replies; 19+ messages in thread
From: Jeff Kirsher @ 2017-07-26 10:31 UTC (permalink / raw)
  To: davem; +Cc: Jacob Keller, netdev, nhorman, sassmann, jogreene, Jeff Kirsher

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

During certain events such as a CORER, multiple devices will run a work
task to handle some cleanup. This can cause issues due to
a single-threaded workqueue which can mean that a device doesn't cleanup
in time. Prevent this by removing the single-threaded restriction on the
module workqueue. This avoids the need to add more complex yielding
logic in our service task routine. This is also similar to what other
drivers such as fm10k do.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/i40e/i40e_main.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index 933b8e357ee4..22e60841cb22 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -12180,12 +12180,14 @@ static int __init i40e_init_module(void)
 		i40e_driver_string, i40e_driver_version_str);
 	pr_info("%s: %s\n", i40e_driver_name, i40e_copyright);
 
-	/* we will see if single thread per module is enough for now,
-	 * it can't be any worse than using the system workqueue which
-	 * was already single threaded
+	/* There is no need to throttle the number of active tasks because
+	 * each device limits its own task using a state bit for scheduling
+	 * the service task, and the device tasks do not interfere with each
+	 * other, so we don't set a max task limit. We must set WQ_MEM_RECLAIM
+	 * since we need to be able to guarantee forward progress even under
+	 * memory pressure.
 	 */
-	i40e_wq = alloc_workqueue("%s", WQ_UNBOUND | WQ_MEM_RECLAIM, 1,
-				  i40e_driver_name);
+	i40e_wq = alloc_workqueue("%s", WQ_MEM_RECLAIM, 0, i40e_driver_name);
 	if (!i40e_wq) {
 		pr_err("%s: Failed to create workqueue\n", i40e_driver_name);
 		return -ENOMEM;
-- 
2.13.3

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

* [net-next 04/14] i40e: Handle admin Q timeout when releasing NVM
  2017-07-26 10:31 [net-next 00/14][pull request] 40GbE Intel Wired LAN Driver Updates 2017-07-25 Jeff Kirsher
                   ` (2 preceding siblings ...)
  2017-07-26 10:31 ` [net-next 03/14] i40e: remove WQ_UNBOUND and the task limit of our workqueue Jeff Kirsher
@ 2017-07-26 10:31 ` Jeff Kirsher
  2017-07-26 10:31 ` [net-next 05/14] i40e: fix up 32 bit timespec references Jeff Kirsher
                   ` (10 subsequent siblings)
  14 siblings, 0 replies; 19+ messages in thread
From: Jeff Kirsher @ 2017-07-26 10:31 UTC (permalink / raw)
  To: davem
  Cc: Paul M Stillwell Jr, netdev, nhorman, sassmann, jogreene, Jeff Kirsher

From: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>

There are some rare cases where the release resource call will return an
admin Q timeout. In these cases the code needs to try to release the
resource again until it succeeds or it times out.

Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/i40e/i40e_nvm.c | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_nvm.c b/drivers/net/ethernet/intel/i40e/i40e_nvm.c
index 800bd55d0159..17607a2c0a65 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_nvm.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_nvm.c
@@ -134,8 +134,25 @@ i40e_status i40e_acquire_nvm(struct i40e_hw *hw,
  **/
 void i40e_release_nvm(struct i40e_hw *hw)
 {
-	if (!hw->nvm.blank_nvm_mode)
-		i40e_aq_release_resource(hw, I40E_NVM_RESOURCE_ID, 0, NULL);
+	i40e_status ret_code = I40E_SUCCESS;
+	u32 total_delay = 0;
+
+	if (hw->nvm.blank_nvm_mode)
+		return;
+
+	ret_code = i40e_aq_release_resource(hw, I40E_NVM_RESOURCE_ID, 0, NULL);
+
+	/* there are some rare cases when trying to release the resource
+	 * results in an admin Q timeout, so handle them correctly
+	 */
+	while ((ret_code == I40E_ERR_ADMIN_QUEUE_TIMEOUT) &&
+	       (total_delay < hw->aq.asq_cmd_timeout)) {
+		usleep_range(1000, 2000);
+		ret_code = i40e_aq_release_resource(hw,
+						    I40E_NVM_RESOURCE_ID,
+						    0, NULL);
+		total_delay++;
+	}
 }
 
 /**
-- 
2.13.3

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

* [net-next 05/14] i40e: fix up 32 bit timespec references
  2017-07-26 10:31 [net-next 00/14][pull request] 40GbE Intel Wired LAN Driver Updates 2017-07-25 Jeff Kirsher
                   ` (3 preceding siblings ...)
  2017-07-26 10:31 ` [net-next 04/14] i40e: Handle admin Q timeout when releasing NVM Jeff Kirsher
@ 2017-07-26 10:31 ` Jeff Kirsher
  2019-02-25 14:46   ` Arnd Bergmann
  2017-07-26 10:31 ` [net-next 06/14] i40e: fix odd formatting and indent Jeff Kirsher
                   ` (9 subsequent siblings)
  14 siblings, 1 reply; 19+ messages in thread
From: Jeff Kirsher @ 2017-07-26 10:31 UTC (permalink / raw)
  To: davem; +Cc: Jesse Brandeburg, netdev, nhorman, sassmann, jogreene, Jeff Kirsher

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

As it turns out there was only a small set of errors
on 32 bit, and we just needed to be using the right calls
for dealing with timespec64 variables.

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/i40e/i40e_ptp.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_ptp.c b/drivers/net/ethernet/intel/i40e/i40e_ptp.c
index 1a0be835fa06..0129ed3b78ec 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_ptp.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_ptp.c
@@ -158,13 +158,12 @@ static int i40e_ptp_adjfreq(struct ptp_clock_info *ptp, s32 ppb)
 static int i40e_ptp_adjtime(struct ptp_clock_info *ptp, s64 delta)
 {
 	struct i40e_pf *pf = container_of(ptp, struct i40e_pf, ptp_caps);
-	struct timespec64 now, then;
+	struct timespec64 now;
 
-	then = ns_to_timespec64(delta);
 	mutex_lock(&pf->tmreg_lock);
 
 	i40e_ptp_read(pf, &now);
-	now = timespec64_add(now, then);
+	timespec64_add_ns(&now, delta);
 	i40e_ptp_write(pf, (const struct timespec64 *)&now);
 
 	mutex_unlock(&pf->tmreg_lock);
-- 
2.13.3

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

* [net-next 06/14] i40e: fix odd formatting and indent
  2017-07-26 10:31 [net-next 00/14][pull request] 40GbE Intel Wired LAN Driver Updates 2017-07-25 Jeff Kirsher
                   ` (4 preceding siblings ...)
  2017-07-26 10:31 ` [net-next 05/14] i40e: fix up 32 bit timespec references Jeff Kirsher
@ 2017-07-26 10:31 ` Jeff Kirsher
  2017-07-26 10:31 ` [net-next 07/14] i40e/i40evf: make IPv6 ATR code clearer Jeff Kirsher
                   ` (8 subsequent siblings)
  14 siblings, 0 replies; 19+ messages in thread
From: Jeff Kirsher @ 2017-07-26 10:31 UTC (permalink / raw)
  To: davem; +Cc: Jesse Brandeburg, netdev, nhorman, sassmann, jogreene, Jeff Kirsher

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

The compiler warned on an oddly indented bit of code, and when
investigating that, noted that the functions themselves had
an odd flow. The if condition was checked, and would exclude
a call to AQ, but then the aq_ret would be checked unconditionally
which just looks really weird, and is likely to cause objections.

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/i40e/i40e_virtchnl_pf.c | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
index ba327e90f32a..2e261bb59d10 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
@@ -1741,16 +1741,14 @@ static int i40e_vc_config_promiscuous_mode_msg(struct i40e_vf *vf,
 							    NULL);
 	} else if (i40e_getnum_vf_vsi_vlan_filters(vsi)) {
 		hash_for_each(vsi->mac_filter_hash, bkt, f, hlist) {
-			aq_ret = 0;
-			if (f->vlan >= 0 && f->vlan <= I40E_MAX_VLANID) {
-				aq_ret =
-				i40e_aq_set_vsi_uc_promisc_on_vlan(hw,
-								   vsi->seid,
-								   alluni,
-								   f->vlan,
-								   NULL);
-				aq_err = pf->hw.aq.asq_last_status;
-			}
+			if (f->vlan < 0 || f->vlan > I40E_MAX_VLANID)
+				continue;
+			aq_ret = i40e_aq_set_vsi_uc_promisc_on_vlan(hw,
+								    vsi->seid,
+								    alluni,
+								    f->vlan,
+								    NULL);
+			aq_err = pf->hw.aq.asq_last_status;
 			if (aq_ret)
 				dev_err(&pf->pdev->dev,
 					"Could not add VLAN %d to Unicast promiscuous domain err %s aq_err %s\n",
-- 
2.13.3

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

* [net-next 07/14] i40e/i40evf: make IPv6 ATR code clearer
  2017-07-26 10:31 [net-next 00/14][pull request] 40GbE Intel Wired LAN Driver Updates 2017-07-25 Jeff Kirsher
                   ` (5 preceding siblings ...)
  2017-07-26 10:31 ` [net-next 06/14] i40e: fix odd formatting and indent Jeff Kirsher
@ 2017-07-26 10:31 ` Jeff Kirsher
  2017-07-26 10:31 ` [net-next 08/14] i40e/i40evf: remove mismatched type warnings Jeff Kirsher
                   ` (7 subsequent siblings)
  14 siblings, 0 replies; 19+ messages in thread
From: Jeff Kirsher @ 2017-07-26 10:31 UTC (permalink / raw)
  To: davem; +Cc: Jesse Brandeburg, netdev, nhorman, sassmann, jogreene, Jeff Kirsher

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

This just reorders some local vars and makes the code flow
clearer.

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/i40e/i40e_txrx.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.c b/drivers/net/ethernet/intel/i40e/i40e_txrx.c
index b936febc315a..c9a149678926 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_txrx.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.c
@@ -2451,9 +2451,15 @@ static void i40e_atr(struct i40e_ring *tx_ring, struct sk_buff *skb,
 		hlen = (hdr.network[0] & 0x0F) << 2;
 		l4_proto = hdr.ipv4->protocol;
 	} else {
-		hlen = hdr.network - skb->data;
-		l4_proto = ipv6_find_hdr(skb, &hlen, IPPROTO_TCP, NULL, NULL);
-		hlen -= hdr.network - skb->data;
+		/* find the start of the innermost ipv6 header */
+		unsigned int inner_hlen = hdr.network - skb->data;
+		unsigned int h_offset = inner_hlen;
+
+		/* this function updates h_offset to the end of the header */
+		l4_proto =
+		  ipv6_find_hdr(skb, &h_offset, IPPROTO_TCP, NULL, NULL);
+		/* hlen will contain our best estimate of the tcp header */
+		hlen = h_offset - inner_hlen;
 	}
 
 	if (l4_proto != IPPROTO_TCP)
-- 
2.13.3

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

* [net-next 08/14] i40e/i40evf: remove mismatched type warnings
  2017-07-26 10:31 [net-next 00/14][pull request] 40GbE Intel Wired LAN Driver Updates 2017-07-25 Jeff Kirsher
                   ` (6 preceding siblings ...)
  2017-07-26 10:31 ` [net-next 07/14] i40e/i40evf: make IPv6 ATR code clearer Jeff Kirsher
@ 2017-07-26 10:31 ` Jeff Kirsher
  2017-07-26 10:31 ` [net-next 09/14] i40e: display correct UDP tunnel type name Jeff Kirsher
                   ` (6 subsequent siblings)
  14 siblings, 0 replies; 19+ messages in thread
From: Jeff Kirsher @ 2017-07-26 10:31 UTC (permalink / raw)
  To: davem; +Cc: Jesse Brandeburg, netdev, nhorman, sassmann, jogreene, Jeff Kirsher

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

Compiler reported several places where driver compared
signed and unsigned types.  Cast or change the types to remove
the warnings.

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/i40e/i40e_ethtool.c     | 6 +++---
 drivers/net/ethernet/intel/i40e/i40e_main.c        | 2 +-
 drivers/net/ethernet/intel/i40e/i40e_txrx.c        | 6 +++---
 drivers/net/ethernet/intel/i40evf/i40e_txrx.c      | 6 +++---
 drivers/net/ethernet/intel/i40evf/i40evf_ethtool.c | 4 ++--
 5 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
index 9692a5294fa3..1d29152256fe 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_ethtool.c
@@ -1091,7 +1091,7 @@ static void i40e_get_regs(struct net_device *netdev, struct ethtool_regs *regs,
 	struct i40e_pf *pf = np->vsi->back;
 	struct i40e_hw *hw = &pf->hw;
 	u32 *reg_buf = p;
-	int i, j, ri;
+	unsigned int i, j, ri;
 	u32 reg;
 
 	/* Tell ethtool which driver-version-specific regs output we have.
@@ -1550,9 +1550,9 @@ static void i40e_get_ethtool_stats(struct net_device *netdev,
 	struct i40e_ring *tx_ring, *rx_ring;
 	struct i40e_vsi *vsi = np->vsi;
 	struct i40e_pf *pf = vsi->back;
+	unsigned int j;
 	int i = 0;
 	char *p;
-	int j;
 	struct rtnl_link_stats64 *net_stats = i40e_get_vsi_stats_struct(vsi);
 	unsigned int start;
 
@@ -1637,7 +1637,7 @@ static void i40e_get_strings(struct net_device *netdev, u32 stringset,
 	struct i40e_vsi *vsi = np->vsi;
 	struct i40e_pf *pf = vsi->back;
 	char *p = (char *)data;
-	int i;
+	unsigned int i;
 
 	switch (stringset) {
 	case ETH_SS_TEST:
diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index 22e60841cb22..a2d665161def 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -4773,7 +4773,7 @@ static void i40e_detect_recover_hung(struct i40e_pf *pf)
 {
 	struct net_device *netdev;
 	struct i40e_vsi *vsi;
-	int i;
+	unsigned int i;
 
 	/* Only for LAN VSI */
 	vsi = pf->vsi[pf->lan_vsi];
diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.c b/drivers/net/ethernet/intel/i40e/i40e_txrx.c
index c9a149678926..d464fceb300f 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_txrx.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.c
@@ -860,7 +860,7 @@ static bool i40e_clean_tx_irq(struct i40e_vsi *vsi,
 	netdev_tx_completed_queue(txring_txq(tx_ring),
 				  total_packets, total_bytes);
 
-#define TX_WAKE_THRESHOLD (DESC_NEEDED * 2)
+#define TX_WAKE_THRESHOLD ((s16)(DESC_NEEDED * 2))
 	if (unlikely(total_packets && netif_carrier_ok(tx_ring->netdev) &&
 		     (I40E_DESC_UNUSED(tx_ring) >= TX_WAKE_THRESHOLD))) {
 		/* Make sure that anybody stopping the queue after this
@@ -2063,7 +2063,7 @@ static int i40e_clean_rx_irq(struct i40e_ring *rx_ring, int budget)
 	u16 cleaned_count = I40E_DESC_UNUSED(rx_ring);
 	bool failure = false, xdp_xmit = false;
 
-	while (likely(total_rx_packets < budget)) {
+	while (likely(total_rx_packets < (unsigned int)budget)) {
 		struct i40e_rx_buffer *rx_buffer;
 		union i40e_rx_desc *rx_desc;
 		struct xdp_buff xdp;
@@ -2196,7 +2196,7 @@ static int i40e_clean_rx_irq(struct i40e_ring *rx_ring, int budget)
 	rx_ring->q_vector->rx.total_bytes += total_rx_bytes;
 
 	/* guarantee a trip back through this routine if there was a failure */
-	return failure ? budget : total_rx_packets;
+	return failure ? budget : (int)total_rx_packets;
 }
 
 static u32 i40e_buildreg_itr(const int type, const u16 itr)
diff --git a/drivers/net/ethernet/intel/i40evf/i40e_txrx.c b/drivers/net/ethernet/intel/i40evf/i40e_txrx.c
index 12b02e530503..d91676ccf125 100644
--- a/drivers/net/ethernet/intel/i40evf/i40e_txrx.c
+++ b/drivers/net/ethernet/intel/i40evf/i40e_txrx.c
@@ -275,7 +275,7 @@ static bool i40e_clean_tx_irq(struct i40e_vsi *vsi,
 	netdev_tx_completed_queue(txring_txq(tx_ring),
 				  total_packets, total_bytes);
 
-#define TX_WAKE_THRESHOLD (DESC_NEEDED * 2)
+#define TX_WAKE_THRESHOLD ((s16)(DESC_NEEDED * 2))
 	if (unlikely(total_packets && netif_carrier_ok(tx_ring->netdev) &&
 		     (I40E_DESC_UNUSED(tx_ring) >= TX_WAKE_THRESHOLD))) {
 		/* Make sure that anybody stopping the queue after this
@@ -1299,7 +1299,7 @@ static int i40e_clean_rx_irq(struct i40e_ring *rx_ring, int budget)
 	u16 cleaned_count = I40E_DESC_UNUSED(rx_ring);
 	bool failure = false;
 
-	while (likely(total_rx_packets < budget)) {
+	while (likely(total_rx_packets < (unsigned int)budget)) {
 		struct i40e_rx_buffer *rx_buffer;
 		union i40e_rx_desc *rx_desc;
 		unsigned int size;
@@ -1406,7 +1406,7 @@ static int i40e_clean_rx_irq(struct i40e_ring *rx_ring, int budget)
 	rx_ring->q_vector->rx.total_bytes += total_rx_bytes;
 
 	/* guarantee a trip back through this routine if there was a failure */
-	return failure ? budget : total_rx_packets;
+	return failure ? budget : (int)total_rx_packets;
 }
 
 static u32 i40e_buildreg_itr(const int type, const u16 itr)
diff --git a/drivers/net/ethernet/intel/i40evf/i40evf_ethtool.c b/drivers/net/ethernet/intel/i40evf/i40evf_ethtool.c
index 9bb2cc7dd4e4..76fd89c1dbb2 100644
--- a/drivers/net/ethernet/intel/i40evf/i40evf_ethtool.c
+++ b/drivers/net/ethernet/intel/i40evf/i40evf_ethtool.c
@@ -165,7 +165,7 @@ static void i40evf_get_ethtool_stats(struct net_device *netdev,
 				     struct ethtool_stats *stats, u64 *data)
 {
 	struct i40evf_adapter *adapter = netdev_priv(netdev);
-	int i, j;
+	unsigned int i, j;
 	char *p;
 
 	for (i = 0; i < I40EVF_GLOBAL_STATS_LEN; i++) {
@@ -197,7 +197,7 @@ static void i40evf_get_strings(struct net_device *netdev, u32 sset, u8 *data)
 	int i;
 
 	if (sset == ETH_SS_STATS) {
-		for (i = 0; i < I40EVF_GLOBAL_STATS_LEN; i++) {
+		for (i = 0; i < (int)I40EVF_GLOBAL_STATS_LEN; i++) {
 			memcpy(p, i40evf_gstrings_stats[i].stat_string,
 			       ETH_GSTRING_LEN);
 			p += ETH_GSTRING_LEN;
-- 
2.13.3

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

* [net-next 09/14] i40e: display correct UDP tunnel type name
  2017-07-26 10:31 [net-next 00/14][pull request] 40GbE Intel Wired LAN Driver Updates 2017-07-25 Jeff Kirsher
                   ` (7 preceding siblings ...)
  2017-07-26 10:31 ` [net-next 08/14] i40e/i40evf: remove mismatched type warnings Jeff Kirsher
@ 2017-07-26 10:31 ` Jeff Kirsher
  2017-07-26 10:31 ` [net-next 10/14] i40evf: add some missing includes Jeff Kirsher
                   ` (5 subsequent siblings)
  14 siblings, 0 replies; 19+ messages in thread
From: Jeff Kirsher @ 2017-07-26 10:31 UTC (permalink / raw)
  To: davem; +Cc: Jacob Keller, netdev, nhorman, sassmann, jogreene, Jeff Kirsher

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

The i40e driver attempts to display the UDP tunnel name by doing a check
against the type, where for non-zero types we use "vxlan" and for zero
type we use "geneve". This is not future proof, because if new tunnel
types get added, we'll incorrectly label them. It also depends on the
value of UDP_TUNNEL_TYPE_GENEVE == 0, which is brittle.

Instead, replace this with a function that can return a constant string
depending on the type. For now we'll use "unknown" for types we don't
know about, and we can expand this in the future if new types get added.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/i40e/i40e_main.c | 28 ++++++++++++++++++++--------
 1 file changed, 20 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index a2d665161def..2b115b0c5296 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -7520,6 +7520,18 @@ static void i40e_handle_mdd_event(struct i40e_pf *pf)
 	i40e_flush(hw);
 }
 
+static const char *i40e_tunnel_name(struct i40e_udp_port_config *port)
+{
+	switch (port->type) {
+	case UDP_TUNNEL_TYPE_VXLAN:
+		return "vxlan";
+	case UDP_TUNNEL_TYPE_GENEVE:
+		return "geneve";
+	default:
+		return "unknown";
+	}
+}
+
 /**
  * i40e_sync_udp_filters - Trigger a sync event for existing UDP filters
  * @pf: board private structure
@@ -7565,14 +7577,14 @@ static void i40e_sync_udp_filters_subtask(struct i40e_pf *pf)
 				ret = i40e_aq_del_udp_tunnel(hw, i, NULL);
 
 			if (ret) {
-				dev_dbg(&pf->pdev->dev,
-					"%s %s port %d, index %d failed, err %s aq_err %s\n",
-					pf->udp_ports[i].type ? "vxlan" : "geneve",
-					port ? "add" : "delete",
-					port, i,
-					i40e_stat_str(&pf->hw, ret),
-					i40e_aq_str(&pf->hw,
-						    pf->hw.aq.asq_last_status));
+				dev_info(&pf->pdev->dev,
+					 "%s %s port %d, index %d failed, err %s aq_err %s\n",
+					 i40e_tunnel_name(&pf->udp_ports[i]),
+					 port ? "add" : "delete",
+					 port, i,
+					 i40e_stat_str(&pf->hw, ret),
+					 i40e_aq_str(&pf->hw,
+						     pf->hw.aq.asq_last_status));
 				pf->udp_ports[i].port = 0;
 			}
 		}
-- 
2.13.3

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

* [net-next 10/14] i40evf: add some missing includes
  2017-07-26 10:31 [net-next 00/14][pull request] 40GbE Intel Wired LAN Driver Updates 2017-07-25 Jeff Kirsher
                   ` (8 preceding siblings ...)
  2017-07-26 10:31 ` [net-next 09/14] i40e: display correct UDP tunnel type name Jeff Kirsher
@ 2017-07-26 10:31 ` Jeff Kirsher
  2017-07-26 10:31 ` [net-next 11/14] i40e: report BPF prog id during XDP_QUERY_PROG Jeff Kirsher
                   ` (4 subsequent siblings)
  14 siblings, 0 replies; 19+ messages in thread
From: Jeff Kirsher @ 2017-07-26 10:31 UTC (permalink / raw)
  To: davem; +Cc: Jesse Brandeburg, netdev, nhorman, sassmann, jogreene, Jeff Kirsher

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

These includes were all being used in the driver, but weren't
being directly included.

Since the current advised method is to directly include anything
that you need, this implements that.

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.h | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/net/ethernet/intel/i40evf/i40evf.h b/drivers/net/ethernet/intel/i40evf/i40evf.h
index 6cc92089fecb..7901cc85cbe5 100644
--- a/drivers/net/ethernet/intel/i40evf/i40evf.h
+++ b/drivers/net/ethernet/intel/i40evf/i40evf.h
@@ -39,6 +39,17 @@
 #include <linux/tcp.h>
 #include <linux/sctp.h>
 #include <linux/ipv6.h>
+#include <linux/kernel.h>
+#include <linux/bitops.h>
+#include <linux/timer.h>
+#include <linux/workqueue.h>
+#include <linux/delay.h>
+#include <linux/gfp.h>
+#include <linux/skbuff.h>
+#include <linux/dma-mapping.h>
+#include <linux/etherdevice.h>
+#include <linux/socket.h>
+#include <linux/jiffies.h>
 #include <net/ip6_checksum.h>
 #include <net/udp.h>
 
-- 
2.13.3

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

* [net-next 11/14] i40e: report BPF prog id during XDP_QUERY_PROG
  2017-07-26 10:31 [net-next 00/14][pull request] 40GbE Intel Wired LAN Driver Updates 2017-07-25 Jeff Kirsher
                   ` (9 preceding siblings ...)
  2017-07-26 10:31 ` [net-next 10/14] i40evf: add some missing includes Jeff Kirsher
@ 2017-07-26 10:31 ` Jeff Kirsher
  2017-07-26 10:31 ` [net-next 12/14] i40evf: Use le32_to_cpu before evaluating HW desc fields Jeff Kirsher
                   ` (3 subsequent siblings)
  14 siblings, 0 replies; 19+ messages in thread
From: Jeff Kirsher @ 2017-07-26 10:31 UTC (permalink / raw)
  To: davem; +Cc: Daniel Borkmann, netdev, nhorman, sassmann, jogreene, Jeff Kirsher

From: Daniel Borkmann <daniel@iogearbox.net>

Fill the XDP prog_id with the id just like we do in other XDP enabled
drivers such as ixgbe. This is needed so that on dump we can retrieve
the attached program based on the id, and dump BPF insns, opcodes, etc
back to user space. Only XDP driver missing this is currently i40e.

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: John Fastabend <john.fastabend@gmail.com>
Acked-by: Alexander Duyck <alexander.h.duyck@intel.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/i40e/i40e_main.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
index 2b115b0c5296..4104944ea367 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_main.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_main.c
@@ -9601,6 +9601,7 @@ static int i40e_xdp(struct net_device *dev,
 		return i40e_xdp_setup(vsi, xdp->prog);
 	case XDP_QUERY_PROG:
 		xdp->prog_attached = i40e_enabled_xdp_vsi(vsi);
+		xdp->prog_id = vsi->xdp_prog ? vsi->xdp_prog->aux->id : 0;
 		return 0;
 	default:
 		return -EINVAL;
-- 
2.13.3

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

* [net-next 12/14] i40evf: Use le32_to_cpu before evaluating HW desc fields
  2017-07-26 10:31 [net-next 00/14][pull request] 40GbE Intel Wired LAN Driver Updates 2017-07-25 Jeff Kirsher
                   ` (10 preceding siblings ...)
  2017-07-26 10:31 ` [net-next 11/14] i40e: report BPF prog id during XDP_QUERY_PROG Jeff Kirsher
@ 2017-07-26 10:31 ` Jeff Kirsher
  2017-07-26 10:31 ` [net-next 13/14] i40evf: remove unnecessary __packed Jeff Kirsher
                   ` (2 subsequent siblings)
  14 siblings, 0 replies; 19+ messages in thread
From: Jeff Kirsher @ 2017-07-26 10:31 UTC (permalink / raw)
  To: davem; +Cc: Tushar Dave, netdev, nhorman, sassmann, jogreene, Jeff Kirsher

From: Tushar Dave <tushar.n.dave@oracle.com>

i40e hardware descriptor fields are in little-endian format. Driver
must use le32_to_cpu while evaluating these fields otherwise on
big-endian arch we end up evaluating incorrect values, cause errors
like:
i40evf 0000:03:0a.0: Expected response 24 from PF, received 402653184
i40evf 0000:03:0a.1: Expected response 7 from PF, received 117440512

Signed-off-by: Tushar Dave <tushar.n.dave@oracle.com>
Reviewed-by: Shannon Nelson <shannon.nelson@oracle.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 | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ethernet/intel/i40evf/i40evf_main.c b/drivers/net/ethernet/intel/i40evf/i40evf_main.c
index 7c213a347909..93536b9fc629 100644
--- a/drivers/net/ethernet/intel/i40evf/i40evf_main.c
+++ b/drivers/net/ethernet/intel/i40evf/i40evf_main.c
@@ -1957,8 +1957,8 @@ static void i40evf_adminq_task(struct work_struct *work)
 		container_of(work, struct i40evf_adapter, adminq_task);
 	struct i40e_hw *hw = &adapter->hw;
 	struct i40e_arq_event_info event;
-	struct virtchnl_msg *v_msg;
-	i40e_status ret;
+	enum virtchnl_ops v_op;
+	i40e_status ret, v_ret;
 	u32 val, oldval;
 	u16 pending;
 
@@ -1970,15 +1970,15 @@ static void i40evf_adminq_task(struct work_struct *work)
 	if (!event.msg_buf)
 		goto out;
 
-	v_msg = (struct virtchnl_msg *)&event.desc;
 	do {
 		ret = i40evf_clean_arq_element(hw, &event, &pending);
-		if (ret || !v_msg->v_opcode)
+		v_op = (enum virtchnl_ops)le32_to_cpu(event.desc.cookie_high);
+		v_ret = (i40e_status)le32_to_cpu(event.desc.cookie_low);
+
+		if (ret || !v_op)
 			break; /* No event to process or error cleaning ARQ */
 
-		i40evf_virtchnl_completion(adapter, v_msg->v_opcode,
-					   (i40e_status)v_msg->v_retval,
-					   event.msg_buf,
+		i40evf_virtchnl_completion(adapter, v_op, v_ret, event.msg_buf,
 					   event.msg_len);
 		if (pending != 0)
 			memset(event.msg_buf, 0, I40EVF_MAX_AQ_BUF_SIZE);
-- 
2.13.3

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

* [net-next 13/14] i40evf: remove unnecessary __packed
  2017-07-26 10:31 [net-next 00/14][pull request] 40GbE Intel Wired LAN Driver Updates 2017-07-25 Jeff Kirsher
                   ` (11 preceding siblings ...)
  2017-07-26 10:31 ` [net-next 12/14] i40evf: Use le32_to_cpu before evaluating HW desc fields Jeff Kirsher
@ 2017-07-26 10:31 ` Jeff Kirsher
  2017-07-26 10:31 ` [net-next 14/14] i40e: handle setting administratively set MAC address back to zero Jeff Kirsher
  2017-07-26 23:59 ` [net-next 00/14][pull request] 40GbE Intel Wired LAN Driver Updates 2017-07-25 David Miller
  14 siblings, 0 replies; 19+ messages in thread
From: Jeff Kirsher @ 2017-07-26 10:31 UTC (permalink / raw)
  To: davem; +Cc: Tushar Dave, netdev, nhorman, sassmann, jogreene, Jeff Kirsher

From: Tushar Dave <tushar.n.dave@oracle.com>

This is similar to 'commit 9588397d24eec ("i40e: remove unnecessary
__packed")' to avoid unaligned access.

Signed-off-by: Tushar Dave <tushar.n.dave@oracle.com>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/i40evf/i40e_osdep.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/intel/i40evf/i40e_osdep.h b/drivers/net/ethernet/intel/i40evf/i40e_osdep.h
index 5e314fd3c016..a90737786c34 100644
--- a/drivers/net/ethernet/intel/i40evf/i40e_osdep.h
+++ b/drivers/net/ethernet/intel/i40evf/i40e_osdep.h
@@ -54,7 +54,7 @@ struct i40e_dma_mem {
 	void *va;
 	dma_addr_t pa;
 	u32 size;
-} __packed;
+};
 
 #define i40e_allocate_dma_mem(h, m, unused, s, a) \
 	i40evf_allocate_dma_mem_d(h, m, s, a)
@@ -63,7 +63,7 @@ struct i40e_dma_mem {
 struct i40e_virt_mem {
 	void *va;
 	u32 size;
-} __packed;
+};
 #define i40e_allocate_virt_mem(h, m, s) i40evf_allocate_virt_mem_d(h, m, s)
 #define i40e_free_virt_mem(h, m) i40evf_free_virt_mem_d(h, m)
 
-- 
2.13.3

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

* [net-next 14/14] i40e: handle setting administratively set MAC address back to zero
  2017-07-26 10:31 [net-next 00/14][pull request] 40GbE Intel Wired LAN Driver Updates 2017-07-25 Jeff Kirsher
                   ` (12 preceding siblings ...)
  2017-07-26 10:31 ` [net-next 13/14] i40evf: remove unnecessary __packed Jeff Kirsher
@ 2017-07-26 10:31 ` Jeff Kirsher
  2017-07-26 23:59 ` [net-next 00/14][pull request] 40GbE Intel Wired LAN Driver Updates 2017-07-25 David Miller
  14 siblings, 0 replies; 19+ messages in thread
From: Jeff Kirsher @ 2017-07-26 10:31 UTC (permalink / raw)
  To: davem; +Cc: Stefan Assmann, netdev, nhorman, sassmann, jogreene, Jeff Kirsher

From: Stefan Assmann <sassmann@kpanic.de>

When an administratively set MAC was previously set and should now be
switched back to 00:00:00:00:00:00 the pf_set_mac flag did not get
toggled back to false.
As a result VFs were still treated as if an administratively set MAC was
present.

Signed-off-by: Stefan Assmann <sassmann@kpanic.de>
Tested-by: Andrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
 drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
index 2e261bb59d10..979110d59f67 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c
@@ -2762,7 +2762,6 @@ int i40e_ndo_set_vf_mac(struct net_device *netdev, int vf_id, u8 *mac)
 
 	spin_unlock_bh(&vsi->mac_filter_hash_lock);
 
-	dev_info(&pf->pdev->dev, "Setting MAC %pM on VF %d\n", mac, vf_id);
 	/* program mac filter */
 	if (i40e_sync_vsi_filters(vsi)) {
 		dev_err(&pf->pdev->dev, "Unable to program ucast filters\n");
@@ -2770,7 +2769,16 @@ int i40e_ndo_set_vf_mac(struct net_device *netdev, int vf_id, u8 *mac)
 		goto error_param;
 	}
 	ether_addr_copy(vf->default_lan_addr.addr, mac);
-	vf->pf_set_mac = true;
+
+	if (is_zero_ether_addr(mac)) {
+		vf->pf_set_mac = false;
+		dev_info(&pf->pdev->dev, "Removing MAC on VF %d\n", vf_id);
+	} else {
+		vf->pf_set_mac = true;
+		dev_info(&pf->pdev->dev, "Setting MAC %pM on VF %d\n",
+			 mac, vf_id);
+	}
+
 	/* Force the VF driver stop so it has to reload with new MAC address */
 	i40e_vc_disable_vf(pf, vf);
 	dev_info(&pf->pdev->dev, "Reload the VF driver to make this change effective.\n");
-- 
2.13.3

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

* Re: [net-next 00/14][pull request] 40GbE Intel Wired LAN Driver Updates 2017-07-25
  2017-07-26 10:31 [net-next 00/14][pull request] 40GbE Intel Wired LAN Driver Updates 2017-07-25 Jeff Kirsher
                   ` (13 preceding siblings ...)
  2017-07-26 10:31 ` [net-next 14/14] i40e: handle setting administratively set MAC address back to zero Jeff Kirsher
@ 2017-07-26 23:59 ` David Miller
  14 siblings, 0 replies; 19+ messages in thread
From: David Miller @ 2017-07-26 23:59 UTC (permalink / raw)
  To: jeffrey.t.kirsher; +Cc: netdev, nhorman, sassmann, jogreene

From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Date: Wed, 26 Jul 2017 03:31:09 -0700

> This series contains updates to i40e and i40evf only.
> 
> Gustavo Silva fixes a variable assignment, where the incorrect variable
> was being used to store the error parameter.
> 
> Carolyn provides a fix for a problem found in systems when entering S4
> state, by ensuring that the misc vector's IRQ is disabled as well.
> 
> Jake removes the single-threaded restriction on the module workqueue,
> which was causing issues with events such as CORER.  Does some future
> proofing, by changing how the driver displays the UDP tunnel type.
> 
> Paul adds a retry in releasing resources if the admin queue times out
> during the first attempt to release the resources.
> 
> Jesse fixes up references to 32bit timspec, since there are a small set
> of errors on 32 bit, so we need to be using the right calls for dealing
> with timespec64 variables.  Cleaned up code indentation and corrected
> an "if" conditional check, as well as making the code flow more clear.
> Cast or changed the types to remove warnings for comparing signed and
> unsigned types.  Adds missing includes in i40evf, which were being used
> but were not being directly included.
> 
> Daniel Borkmann fixes i40e to fill the XDP prog_id with the id just like
> other XDP enabled drivers, so that on dump we can retrieve the attached
> program based on the id and dump BPF insns, opcodes, etc back to user
> space.
> 
> Tushar Dave adds le32_to_cpu while evaluating the hardware descriptor
> fields, since they are in little-endian format.  Also removed
> unnecessary "__packed" to a couple of i40evf structures.
> 
> Stefan Assmann fixes an issue when an administratively set MAC was set
> and should now be switched back to 00:00:00:00:00:00, the pf_set_mac
> flag is not being toggled back to false.
 ...
>   git://git.kernel.org/pub/scm/linux/kernel/git/jkirsher/next-queue 40GbE

Also pulled, thanks Jeff.

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

* Re: [net-next 05/14] i40e: fix up 32 bit timespec references
  2017-07-26 10:31 ` [net-next 05/14] i40e: fix up 32 bit timespec references Jeff Kirsher
@ 2019-02-25 14:46   ` Arnd Bergmann
  2019-02-25 16:47     ` Jesse Brandeburg
  2019-02-25 19:20     ` Keller, Jacob E
  0 siblings, 2 replies; 19+ messages in thread
From: Arnd Bergmann @ 2019-02-25 14:46 UTC (permalink / raw)
  To: Jeff Kirsher
  Cc: David Miller, Jesse Brandeburg, Networking, nhorman, sassmann, jogreene

On Wed, Jul 26, 2017 at 12:33 PM Jeff Kirsher
<jeffrey.t.kirsher@intel.com> wrote:
>
> From: Jesse Brandeburg <jesse.brandeburg@intel.com>
>
> As it turns out there was only a small set of errors
> on 32 bit, and we just needed to be using the right calls
> for dealing with timespec64 variables.

I just stumbled over code added by this older patch, and can't make sense
of the commit description here. Was this an attempt to fix a bug, or
just a cleanup?

>
> -       then = ns_to_timespec64(delta);
>         mutex_lock(&pf->tmreg_lock);
>
>         i40e_ptp_read(pf, &now);
> -       now = timespec64_add(now, then);
> +       timespec64_add_ns(&now, delta);
>         i40e_ptp_write(pf, (const struct timespec64 *)&now);

The problem I noticed here is that 'delta' is a user provided 64-bit
number from clock_adjtime(), and timespec64_add_ns() performs uses
a repeated addition instead of a div/mod pair. When the number
is large, we may end up adding a single second 8 billion times,
which may take a while even on a fast CPU.

Should the commit 0ac30ce43323 ("i40e: fix up 32 bit timespec
references") just be reverted?

      Arnd

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

* Re: [net-next 05/14] i40e: fix up 32 bit timespec references
  2019-02-25 14:46   ` Arnd Bergmann
@ 2019-02-25 16:47     ` Jesse Brandeburg
  2019-02-25 19:20     ` Keller, Jacob E
  1 sibling, 0 replies; 19+ messages in thread
From: Jesse Brandeburg @ 2019-02-25 16:47 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Jeff Kirsher, David Miller, Networking, nhorman, sassmann,
	jogreene, jacob.e.keller

On Mon, 25 Feb 2019 15:46:18 +0100
Arnd Bergmann <arnd@arndb.de> wrote:
> I just stumbled over code added by this older patch, and can't make sense
> of the commit description here. Was this an attempt to fix a bug, or
> just a cleanup?

Thanks Arnd for mentioning/posting this! This was an attempt at a clean
up, unfortunately I made a mistake which introduced a bug.

> > -       then = ns_to_timespec64(delta);
> >         mutex_lock(&pf->tmreg_lock);
> >
> >         i40e_ptp_read(pf, &now);
> > -       now = timespec64_add(now, then);
> > +       timespec64_add_ns(&now, delta);
> >         i40e_ptp_write(pf, (const struct timespec64 *)&now);
> 
> The problem I noticed here is that 'delta' is a user provided 64-bit
> number from clock_adjtime(), and timespec64_add_ns() performs uses
> a repeated addition instead of a div/mod pair. When the number
> is large, we may end up adding a single second 8 billion times,
> which may take a while even on a fast CPU.
> 
> Should the commit 0ac30ce43323 ("i40e: fix up 32 bit timespec
> references") just be reverted?

Interestingly, we just were discussing this fix this past Friday, and
have a patch internally to fix the issue correctly. Either way it
is a commit (revert or fix) so we might as well just send the fix ASAP.

Our team should have something posted to intel-wired-lan/netdev shortly,
and we'll get the patch officially to netdev  after a brief test.

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

* RE: [net-next 05/14] i40e: fix up 32 bit timespec references
  2019-02-25 14:46   ` Arnd Bergmann
  2019-02-25 16:47     ` Jesse Brandeburg
@ 2019-02-25 19:20     ` Keller, Jacob E
  1 sibling, 0 replies; 19+ messages in thread
From: Keller, Jacob E @ 2019-02-25 19:20 UTC (permalink / raw)
  To: Arnd Bergmann, Kirsher, Jeffrey T
  Cc: David Miller, Brandeburg, Jesse, Networking, nhorman, sassmann, jogreene

> -----Original Message-----
> From: netdev-owner@vger.kernel.org [mailto:netdev-owner@vger.kernel.org] On
> Behalf Of Arnd Bergmann
> Sent: Monday, February 25, 2019 6:46 AM
> To: Kirsher, Jeffrey T <jeffrey.t.kirsher@intel.com>
> Cc: David Miller <davem@davemloft.net>; Brandeburg, Jesse
> <jesse.brandeburg@intel.com>; Networking <netdev@vger.kernel.org>;
> nhorman@redhat.com; sassmann@redhat.com; jogreene@redhat.com
> Subject: Re: [net-next 05/14] i40e: fix up 32 bit timespec references
> 
> On Wed, Jul 26, 2017 at 12:33 PM Jeff Kirsher
> <jeffrey.t.kirsher@intel.com> wrote:
> >
> > From: Jesse Brandeburg <jesse.brandeburg@intel.com>
> >
> > As it turns out there was only a small set of errors
> > on 32 bit, and we just needed to be using the right calls
> > for dealing with timespec64 variables.
> 
> I just stumbled over code added by this older patch, and can't make sense
> of the commit description here. Was this an attempt to fix a bug, or
> just a cleanup?
> 
> >
> > -       then = ns_to_timespec64(delta);
> >         mutex_lock(&pf->tmreg_lock);
> >
> >         i40e_ptp_read(pf, &now);
> > -       now = timespec64_add(now, then);
> > +       timespec64_add_ns(&now, delta);
> >         i40e_ptp_write(pf, (const struct timespec64 *)&now);
> 
> The problem I noticed here is that 'delta' is a user provided 64-bit
> number from clock_adjtime(), and timespec64_add_ns() performs uses
> a repeated addition instead of a div/mod pair. When the number
> is large, we may end up adding a single second 8 billion times,
> which may take a while even on a fast CPU.
> 

It looked like the timespec64_add_ns does a div/mod pair...? Or am I mis-reading how the function is implemented? Quite probably.

Either way, the code is incorrect, because timespec64_add_ns doesn't actually work with signed values. A negative delta actually ends up resulting in a significant positive addition. Woops!

> Should the commit 0ac30ce43323 ("i40e: fix up 32 bit timespec
> references") just be reverted?
> 

Yea, let's revert it.

Thanks,
Jake

>       Arnd



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

end of thread, other threads:[~2019-02-25 19:20 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-26 10:31 [net-next 00/14][pull request] 40GbE Intel Wired LAN Driver Updates 2017-07-25 Jeff Kirsher
2017-07-26 10:31 ` [net-next 01/14] i40e: fix incorrect variable assignment Jeff Kirsher
2017-07-26 10:31 ` [net-next 02/14] i40e: Fix for trace found with S4 state Jeff Kirsher
2017-07-26 10:31 ` [net-next 03/14] i40e: remove WQ_UNBOUND and the task limit of our workqueue Jeff Kirsher
2017-07-26 10:31 ` [net-next 04/14] i40e: Handle admin Q timeout when releasing NVM Jeff Kirsher
2017-07-26 10:31 ` [net-next 05/14] i40e: fix up 32 bit timespec references Jeff Kirsher
2019-02-25 14:46   ` Arnd Bergmann
2019-02-25 16:47     ` Jesse Brandeburg
2019-02-25 19:20     ` Keller, Jacob E
2017-07-26 10:31 ` [net-next 06/14] i40e: fix odd formatting and indent Jeff Kirsher
2017-07-26 10:31 ` [net-next 07/14] i40e/i40evf: make IPv6 ATR code clearer Jeff Kirsher
2017-07-26 10:31 ` [net-next 08/14] i40e/i40evf: remove mismatched type warnings Jeff Kirsher
2017-07-26 10:31 ` [net-next 09/14] i40e: display correct UDP tunnel type name Jeff Kirsher
2017-07-26 10:31 ` [net-next 10/14] i40evf: add some missing includes Jeff Kirsher
2017-07-26 10:31 ` [net-next 11/14] i40e: report BPF prog id during XDP_QUERY_PROG Jeff Kirsher
2017-07-26 10:31 ` [net-next 12/14] i40evf: Use le32_to_cpu before evaluating HW desc fields Jeff Kirsher
2017-07-26 10:31 ` [net-next 13/14] i40evf: remove unnecessary __packed Jeff Kirsher
2017-07-26 10:31 ` [net-next 14/14] i40e: handle setting administratively set MAC address back to zero Jeff Kirsher
2017-07-26 23:59 ` [net-next 00/14][pull request] 40GbE Intel Wired LAN Driver Updates 2017-07-25 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.