Skip to contentSkip to conversation

i40e/i40evf updates

PATCH New Catherine Sullivan 4 participants 40 messages Aug 28, 2015 – Sep 16, 2015 1 message not in the archive

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

cover i40e/i40evf updates

Catherine fixes check_tx_hang, which was missing an else statement.

Greg adds support for a FW CEE DCB nibble swap.

Jesse cleans up some code, refactors code to remove indent, adds a print to show vxlan support at init, and fixes ip-ip GRE encapulation.

Mitch adds code to detect resets more reliably, changes i40evf to use capabilities flags properly, and adds code to pass QOS handle to VF.

Shannon adds handling of the writeback descriptor, adds the GetStatus command for nvmupdate, adds wait states to NVM state machine, adds exec_aq command to nvmupdate utility, and adds get AQ result command to nvmupdate utility.

 drivers/net/ethernet/intel/i40e/i40e_adminq.c      |  19 +-
 drivers/net/ethernet/intel/i40e/i40e_common.c      |   9 +-
 drivers/net/ethernet/intel/i40e/i40e_dcb.c         |  13 +-
 drivers/net/ethernet/intel/i40e/i40e_dcb_nl.c      |   1 +
 drivers/net/ethernet/intel/i40e/i40e_debugfs.c     | 124 +++++----
 drivers/net/ethernet/intel/i40e/i40e_ethtool.c     |   3 +-
 drivers/net/ethernet/intel/i40e/i40e_fcoe.c        |   1 -
 drivers/net/ethernet/intel/i40e/i40e_lan_hmc.c     |   3 +-
 drivers/net/ethernet/intel/i40e/i40e_main.c        | 162 +++++++-----
 drivers/net/ethernet/intel/i40e/i40e_nvm.c         | 276 +++++++++++++++++++--
 drivers/net/ethernet/intel/i40e/i40e_ptp.c         |   3 +-
 drivers/net/ethernet/intel/i40e/i40e_txrx.c        |   6 +-
 drivers/net/ethernet/intel/i40e/i40e_txrx.h        |   1 +
 drivers/net/ethernet/intel/i40e/i40e_type.h        |  10 +-
 drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c |  19 +-
 drivers/net/ethernet/intel/i40evf/i40e_adminq.c    |   6 +-
 drivers/net/ethernet/intel/i40evf/i40e_common.c    |   8 +-
 drivers/net/ethernet/intel/i40evf/i40e_txrx.c      |   8 +-
 drivers/net/ethernet/intel/i40evf/i40e_txrx.h      |   1 +
 drivers/net/ethernet/intel/i40evf/i40e_type.h      |  10 +-
 drivers/net/ethernet/intel/i40evf/i40evf.h         |   5 +-
 drivers/net/ethernet/intel/i40evf/i40evf_main.c    |  48 ++--
 22 files changed, 531 insertions(+), 205 deletions(-)
Signature · 1 line
1.9.3
#1 lore raw

PATCH 1/15 i40e/i40evf: add handling of writeback descriptor

From: Shannon Nelson <[email protected]>

If the writeback descriptor buffer was previously created, this gives it to the AQ command request to be used to save the results.

Change-ID I8c8a1af81e6ebed6d0a15ed31697fe1a6c4e3708
---
 drivers/net/ethernet/intel/i40e/i40e_nvm.c    | 26 ++++++++++++++++++++++----
 drivers/net/ethernet/intel/i40e/i40e_type.h   |  1 +
 drivers/net/ethernet/intel/i40evf/i40e_type.h |  1 +
 3 files changed, 24 insertions(+), 4 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_nvm.c +22 -4
index 5475454..13534b3 100644
@@ -418,6 +418,10 @@ static i40e_status i40e_write_nvm_aq(struct i40e_hw *hw, u8 module_pointer,
 				     bool last_command)
 {
 	i40e_status ret_code = I40E_ERR_NVM;
+	struct i40e_asq_cmd_details cmd_details;
+
+	memset(&cmd_details, 0, sizeof(cmd_details));
+	cmd_details.wb_desc = &hw->nvm_wb_desc;
 
 	/* Here we are checking the SR limit only for the flat memory model.
 	 * We cannot do it for the module-based model, as we did not acquire
@@ -443,7 +447,7 @@ static i40e_status i40e_write_nvm_aq(struct i40e_hw *hw, u8 module_pointer,
 		ret_code = i40e_aq_update_nvm(hw, module_pointer,
 					      2 * offset,  /*bytes*/
 					      2 * words,   /*bytes*/
-					      data, last_command, NULL);
+					      data, last_command, &cmd_details);
 
 	return ret_code;
 }
@@ -1043,6 +1047,7 @@ static i40e_status i40e_nvmupd_nvm_read(struct i40e_hw *hw,
 					struct i40e_nvm_access *cmd,
 					u8 *bytes, int *perrno)
 {
+	struct i40e_asq_cmd_details cmd_details;
 	i40e_status status;
 	u8 module, transaction;
 	bool last;
@@ -1051,8 +1056,11 @@ static i40e_status i40e_nvmupd_nvm_read(struct i40e_hw *hw,
 	module = i40e_nvmupd_get_module(cmd->config);
 	last = (transaction == I40E_NVM_LCB) || (transaction == I40E_NVM_SA);
 
+	memset(&cmd_details, 0, sizeof(cmd_details));
+	cmd_details.wb_desc = &hw->nvm_wb_desc;
+
 	status = i40e_aq_read_nvm(hw, module, cmd->offset, (u16)cmd->data_size,
-				  bytes, last, NULL);
+				  bytes, last, &cmd_details);
 	if (status) {
 		i40e_debug(hw, I40E_DEBUG_NVM,
 			   "i40e_nvmupd_nvm_read mod 0x%x  off 0x%x  len 0x%x\n",
@@ -1079,14 +1087,19 @@ static i40e_status i40e_nvmupd_nvm_erase(struct i40e_hw *hw,
 					 int *perrno)
 {
 	i40e_status status = 0;
+	struct i40e_asq_cmd_details cmd_details;
 	u8 module, transaction;
 	bool last;
 
 	transaction = i40e_nvmupd_get_transaction(cmd->config);
 	module = i40e_nvmupd_get_module(cmd->config);
 	last = (transaction & I40E_NVM_LCB);
+
+	memset(&cmd_details, 0, sizeof(cmd_details));
+	cmd_details.wb_desc = &hw->nvm_wb_desc;
+
 	status = i40e_aq_erase_nvm(hw, module, cmd->offset, (u16)cmd->data_size,
-				   last, NULL);
+				   last, &cmd_details);
 	if (status) {
 		i40e_debug(hw, I40E_DEBUG_NVM,
 			   "i40e_nvmupd_nvm_erase mod 0x%x  off 0x%x len 0x%x\n",
@@ -1114,6 +1127,7 @@ static i40e_status i40e_nvmupd_nvm_write(struct i40e_hw *hw,
 					 u8 *bytes, int *perrno)
 {
 	i40e_status status = 0;
+	struct i40e_asq_cmd_details cmd_details;
 	u8 module, transaction;
 	bool last;
 
@@ -1121,8 +1135,12 @@ static i40e_status i40e_nvmupd_nvm_write(struct i40e_hw *hw,
 	module = i40e_nvmupd_get_module(cmd->config);
 	last = (transaction & I40E_NVM_LCB);
 
+	memset(&cmd_details, 0, sizeof(cmd_details));
+	cmd_details.wb_desc = &hw->nvm_wb_desc;
+
 	status = i40e_aq_update_nvm(hw, module, cmd->offset,
-				    (u16)cmd->data_size, bytes, last, NULL);
+				    (u16)cmd->data_size, bytes, last,
+				    &cmd_details);
 	if (status) {
 		i40e_debug(hw, I40E_DEBUG_NVM,
 			   "i40e_nvmupd_nvm_write mod 0x%x off 0x%x len 0x%x\n",
drivers/net/ethernet/intel/i40e/i40e_type.h +1 -0
index 4d88224..d3558e1 100644
@@ -494,6 +494,7 @@ struct i40e_hw {
 
 	/* state of nvm update process */
 	enum i40e_nvmupd_state nvmupd_state;
+	struct i40e_aq_desc nvm_wb_desc;
 
 	/* HMC info */
 	struct i40e_hmc_info hmc; /* HMC info struct */
drivers/net/ethernet/intel/i40evf/i40e_type.h +1 -0
index b7ef8aa..c811081 100644
@@ -488,6 +488,7 @@ struct i40e_hw {
 
 	/* state of nvm update process */
 	enum i40e_nvmupd_state nvmupd_state;
+	struct i40e_aq_desc nvm_wb_desc;
 
 	/* HMC info */
 	struct i40e_hmc_info hmc; /* HMC info struct */
Signature · 1 line
1.9.3
#2 lore raw

PATCH 1/15 i40e/i40evf: add handling of writeback descriptor

Quoted 13 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Catherine Sullivan
Sent: Friday, August 28, 2015 2:56 PM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S13 01/15] i40e/i40evf: add handling of writeback descriptor

From: Shannon Nelson <[email protected]>

If the writeback descriptor buffer was previously created, this gives it to the AQ command request to be used to save the results.

Quoted 8 lines
Change-ID I8c8a1af81e6ebed6d0a15ed31697fe1a6c4e3708
---
 drivers/net/ethernet/intel/i40e/i40e_nvm.c    | 26
++++++++++++++++++++++----
 drivers/net/ethernet/intel/i40e/i40e_type.h   |  1 +
 drivers/net/ethernet/intel/i40evf/i40e_type.h |  1 +
 3 files changed, 24 insertions(+), 4 deletions(-)

Code changes present in tree, admin queue data written and read correctly.

#3 lore raw

PATCH 2/15 i40e/i40evf: add GetStatus command for nvmupdate

In reply to Catherine Sullivan

From: Shannon Nelson <[email protected]>

This adds a new GetStatus command so that the NVM update tool can query the current status instead of doing fake write requests to probe for readiness.

Change-ID I671ec6ccd4dfc9dbac3a03b964589d693fda5cd8
---
 drivers/net/ethernet/intel/i40e/i40e_nvm.c    | 42 ++++++++++++++++++++-------
 drivers/net/ethernet/intel/i40e/i40e_type.h   |  2 ++
 drivers/net/ethernet/intel/i40evf/i40e_type.h |  2 ++
 3 files changed, 35 insertions(+), 11 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_nvm.c +31 -11
index 13534b3..034e27a 100644
@@ -640,6 +640,7 @@ static char *i40e_nvm_update_state_str[] = {
 	"I40E_NVMUPD_CSUM_CON",
 	"I40E_NVMUPD_CSUM_SA",
 	"I40E_NVMUPD_CSUM_LCB",
+	"I40E_NVMUPD_STATUS",
 };
 
 /**
@@ -656,10 +657,34 @@ i40e_status i40e_nvmupd_command(struct i40e_hw *hw,
 				u8 *bytes, int *perrno)
 {
 	i40e_status status;
+	enum i40e_nvmupd_cmd upd_cmd;
 
 	/* assume success */
 	*perrno = 0;
 
+	/* early check for status command and debug msgs */
+	upd_cmd = i40e_nvmupd_validate_command(hw, cmd, perrno);
+
+	i40e_debug(hw, I40E_DEBUG_NVM, "%s state %d nvm_release_on_hold %d\n",
+		   i40e_nvm_update_state_str[upd_cmd],
+		   hw->nvmupd_state,
+		   hw->aq.nvm_release_on_done);
+
+	if (upd_cmd == I40E_NVMUPD_INVALID) {
+		*perrno = -EFAULT;
+		i40e_debug(hw, I40E_DEBUG_NVM,
+			   "i40e_nvmupd_validate_command returns %d errno %d\n",
+			   upd_cmd, *perrno);
+	}
+
+	/* a status request returns immediately rather than
+	 * going into the state machine
+	 */
+	if (upd_cmd == I40E_NVMUPD_STATUS) {
+		bytes[0] = hw->nvmupd_state;
+		return 0;
+	}
+
 	switch (hw->nvmupd_state) {
 	case I40E_NVMUPD_STATE_INIT:
 		status = i40e_nvmupd_state_init(hw, cmd, bytes, perrno);
@@ -956,12 +981,13 @@ static enum i40e_nvmupd_cmd i40e_nvmupd_validate_command(struct i40e_hw *hw,
 						 int *perrno)
 {
 	enum i40e_nvmupd_cmd upd_cmd;
-	u8 transaction;
+	u8 module, transaction;
 
 	/* anything that doesn't match a recognized case is an error */
 	upd_cmd = I40E_NVMUPD_INVALID;
 
 	transaction = i40e_nvmupd_get_transaction(cmd->config);
+	module = i40e_nvmupd_get_module(cmd->config);
 
 	/* limits on data size */
 	if ((cmd->data_size < 1) ||
@@ -988,6 +1014,10 @@ static enum i40e_nvmupd_cmd i40e_nvmupd_validate_command(struct i40e_hw *hw,
 		case I40E_NVM_SA:
 			upd_cmd = I40E_NVMUPD_READ_SA;
 			break;
+		case I40E_NVM_EXEC:
+			if (module == 0xf)
+				upd_cmd = I40E_NVMUPD_STATUS;
+			break;
 		}
 		break;
 
@@ -1020,17 +1050,7 @@ static enum i40e_nvmupd_cmd i40e_nvmupd_validate_command(struct i40e_hw *hw,
 		}
 		break;
 	}
-	i40e_debug(hw, I40E_DEBUG_NVM, "%s state %d nvm_release_on_hold %d\n",
-		   i40e_nvm_update_state_str[upd_cmd],
-		   hw->nvmupd_state,
-		   hw->aq.nvm_release_on_done);
 
-	if (upd_cmd == I40E_NVMUPD_INVALID) {
-		*perrno = -EFAULT;
-		i40e_debug(hw, I40E_DEBUG_NVM,
-			   "i40e_nvmupd_validate_command returns %d errno %d\n",
-			   upd_cmd, *perrno);
-	}
 	return upd_cmd;
 }
 
drivers/net/ethernet/intel/i40e/i40e_type.h +2 -0
index d3558e1..20e16ed 100644
@@ -307,6 +307,7 @@ enum i40e_nvmupd_cmd {
 	I40E_NVMUPD_CSUM_CON,
 	I40E_NVMUPD_CSUM_SA,
 	I40E_NVMUPD_CSUM_LCB,
+	I40E_NVMUPD_STATUS,
 };
 
 enum i40e_nvmupd_state {
@@ -331,6 +332,7 @@ enum i40e_nvmupd_state {
 #define I40E_NVM_SA		(I40E_NVM_SNT | I40E_NVM_LCB)
 #define I40E_NVM_ERA		0x4
 #define I40E_NVM_CSUM		0x8
+#define I40E_NVM_EXEC		0xf
 
 #define I40E_NVM_ADAPT_SHIFT	16
 #define I40E_NVM_ADAPT_MASK	(0xffff << I40E_NVM_ADAPT_SHIFT)
drivers/net/ethernet/intel/i40evf/i40e_type.h +2 -0
index c811081..ee02e25 100644
@@ -306,6 +306,7 @@ enum i40e_nvmupd_cmd {
 	I40E_NVMUPD_CSUM_CON,
 	I40E_NVMUPD_CSUM_SA,
 	I40E_NVMUPD_CSUM_LCB,
+	I40E_NVMUPD_STATUS,
 };
 
 enum i40e_nvmupd_state {
@@ -330,6 +331,7 @@ enum i40e_nvmupd_state {
 #define I40E_NVM_SA		(I40E_NVM_SNT | I40E_NVM_LCB)
 #define I40E_NVM_ERA		0x4
 #define I40E_NVM_CSUM		0x8
+#define I40E_NVM_EXEC		0xf
 
 #define I40E_NVM_ADAPT_SHIFT	16
 #define I40E_NVM_ADAPT_MASK	(0xffff << I40E_NVM_ADAPT_SHIFT)
Signature · 1 line
1.9.3
#4 lore raw

PATCH 2/15 i40e/i40evf: add GetStatus command for nvmupdate

Quoted 14 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Catherine Sullivan
Sent: Friday, August 28, 2015 2:56 PM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S13 02/15] i40e/i40evf: add GetStatus command for nvmupdate

From: Shannon Nelson <[email protected]>

This adds a new GetStatus command so that the NVM update tool can query the current status instead of doing fake write requests to probe for readiness.

Quoted 8 lines
Change-ID I671ec6ccd4dfc9dbac3a03b964589d693fda5cd8
---
 drivers/net/ethernet/intel/i40e/i40e_nvm.c    | 42
++++++++++++++++++++-------
 drivers/net/ethernet/intel/i40e/i40e_type.h   |  2 ++
 drivers/net/ethernet/intel/i40evf/i40e_type.h |  2 ++
 3 files changed, 35 insertions(+), 11 deletions(-)

Code changes present in tree

#5 lore raw

PATCH 3/15 i40e/i40evf: add wait states to NVM state machine

In reply to Catherine Sullivan

From: Shannon Nelson <[email protected]>

This adds wait states to the NVM update state machine to signify when waiting for an update operation to finish, whether we're in the middle of a set of Write operations, or we're now idle but waiting.

Change-ID Iabe91d6579ef6a2ea560647e374035656211ab43
---
 drivers/net/ethernet/intel/i40e/i40e_adminq.c | 13 ++++++++
 drivers/net/ethernet/intel/i40e/i40e_nvm.c    | 48 ++++++++++++++++++++-------
 drivers/net/ethernet/intel/i40e/i40e_type.h   |  4 ++-
 drivers/net/ethernet/intel/i40evf/i40e_type.h |  4 ++-
 4 files changed, 55 insertions(+), 14 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_adminq.c +13 -0
index 00404fe..8ba4b60 100644
@@ -1020,6 +1020,19 @@ clean_arq_element_out:
 			i40e_release_nvm(hw);
 			hw->aq.nvm_release_on_done = false;
 		}
+
+		switch (hw->nvmupd_state) {
+		case I40E_NVMUPD_STATE_INIT_WAIT:
+			hw->nvmupd_state = I40E_NVMUPD_STATE_INIT;
+			break;
+
+		case I40E_NVMUPD_STATE_WRITE_WAIT:
+			hw->nvmupd_state = I40E_NVMUPD_STATE_WRITING;
+			break;
+
+		default:
+			break;
+		}
 	}
 
 	return ret_code;
drivers/net/ethernet/intel/i40e/i40e_nvm.c +36 -12

121 lines not on this page · raw message

drivers/net/ethernet/intel/i40e/i40e_type.h +3 -1
index 20e16ed..dd0f709 100644
@@ -313,7 +313,9 @@ enum i40e_nvmupd_cmd {
 enum i40e_nvmupd_state {
 	I40E_NVMUPD_STATE_INIT,
 	I40E_NVMUPD_STATE_READING,
-	I40E_NVMUPD_STATE_WRITING
+	I40E_NVMUPD_STATE_WRITING,
+	I40E_NVMUPD_STATE_INIT_WAIT,
+	I40E_NVMUPD_STATE_WRITE_WAIT,
 };
 
 /* nvm_access definition and its masks/shifts need to be accessible to
drivers/net/ethernet/intel/i40evf/i40e_type.h +3 -1
index ee02e25..00f4956 100644
@@ -312,7 +312,9 @@ enum i40e_nvmupd_cmd {
 enum i40e_nvmupd_state {
 	I40E_NVMUPD_STATE_INIT,
 	I40E_NVMUPD_STATE_READING,
-	I40E_NVMUPD_STATE_WRITING
+	I40E_NVMUPD_STATE_WRITING,
+	I40E_NVMUPD_STATE_INIT_WAIT,
+	I40E_NVMUPD_STATE_WRITE_WAIT,
 };
 
 /* nvm_access definition and its masks/shifts need to be accessible to
Signature · 1 line
1.9.3
#6 lore raw

PATCH 3/15 i40e/i40evf: add wait states to NVM state machine

Quoted 16 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Catherine Sullivan
Sent: Friday, August 28, 2015 2:56 PM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S13 03/15] i40e/i40evf: add wait states to NVM state machine

From: Shannon Nelson <[email protected]>

This adds wait states to the NVM update state machine to signify when waiting for an update operation to finish, whether we're in the middle of a set of Write operations, or we're now idle but waiting.

Change-ID Iabe91d6579ef6a2ea560647e374035656211ab43
Quoted 7 lines
---
 drivers/net/ethernet/intel/i40e/i40e_adminq.c | 13 ++++++++
 drivers/net/ethernet/intel/i40e/i40e_nvm.c    | 48
++++++++++++++++++++-------
 drivers/net/ethernet/intel/i40e/i40e_type.h   |  4 ++-
 drivers/net/ethernet/intel/i40evf/i40e_type.h |  4 ++-
 4 files changed, 55 insertions(+), 14 deletions(-)

Code changes present in tree

#7 lore raw

PATCH 4/15 i40e/i40evf: add exec_aq command to nvmupdate utility

In reply to Catherine Sullivan

From: Shannon Nelson <[email protected]>

Add a facility to run AQ commands through the nvmupdate utility in order to allow the update tools to interact with the FW and do special commands needed for updates and configuration changes.

Change-ID I5c41523e4055b37f8e4ee479f7a0574368f4a588
---
 drivers/net/ethernet/intel/i40e/i40e_adminq.c   |  3 +
 drivers/net/ethernet/intel/i40e/i40e_nvm.c      | 83 +++++++++++++++++++++++++
 drivers/net/ethernet/intel/i40e/i40e_type.h     |  2 +
 drivers/net/ethernet/intel/i40evf/i40e_adminq.c |  3 +
 drivers/net/ethernet/intel/i40evf/i40e_type.h   |  2 +
 5 files changed, 93 insertions(+)
drivers/net/ethernet/intel/i40e/i40e_adminq.c +3 -0
index 8ba4b60..3e1f0b2 100644
@@ -657,6 +657,9 @@ i40e_status i40e_shutdown_adminq(struct i40e_hw *hw)
 
 	/* destroy the locks */
 
+	if (hw->nvm_buff.va)
+		i40e_free_virt_mem(hw, &hw->nvm_buff);
+
 	return ret_code;
 }
 
drivers/net/ethernet/intel/i40e/i40e_nvm.c +83 -0

113 lines not on this page · raw message

drivers/net/ethernet/intel/i40e/i40e_type.h +2 -0
index dd0f709..cb36b2a 100644
@@ -308,6 +308,7 @@ enum i40e_nvmupd_cmd {
 	I40E_NVMUPD_CSUM_SA,
 	I40E_NVMUPD_CSUM_LCB,
 	I40E_NVMUPD_STATUS,
+	I40E_NVMUPD_EXEC_AQ,
 };
 
 enum i40e_nvmupd_state {
@@ -499,6 +500,7 @@ struct i40e_hw {
 	/* state of nvm update process */
 	enum i40e_nvmupd_state nvmupd_state;
 	struct i40e_aq_desc nvm_wb_desc;
+	struct i40e_virt_mem nvm_buff;
 
 	/* HMC info */
 	struct i40e_hmc_info hmc; /* HMC info struct */
drivers/net/ethernet/intel/i40evf/i40e_adminq.c +3 -0
index 48cce43f..cb21e01 100644
@@ -596,6 +596,9 @@ i40e_status i40evf_shutdown_adminq(struct i40e_hw *hw)
 
 	/* destroy the locks */
 
+	if (hw->nvm_buff.va)
+		i40e_free_virt_mem(hw, &hw->nvm_buff);
+
 	return ret_code;
 }
 
drivers/net/ethernet/intel/i40evf/i40e_type.h +2 -0
index 00f4956..5510220 100644
@@ -307,6 +307,7 @@ enum i40e_nvmupd_cmd {
 	I40E_NVMUPD_CSUM_SA,
 	I40E_NVMUPD_CSUM_LCB,
 	I40E_NVMUPD_STATUS,
+	I40E_NVMUPD_EXEC_AQ,
 };
 
 enum i40e_nvmupd_state {
@@ -493,6 +494,7 @@ struct i40e_hw {
 	/* state of nvm update process */
 	enum i40e_nvmupd_state nvmupd_state;
 	struct i40e_aq_desc nvm_wb_desc;
+	struct i40e_virt_mem nvm_buff;
 
 	/* HMC info */
 	struct i40e_hmc_info hmc; /* HMC info struct */
Signature · 1 line
1.9.3
#8 lore raw

PATCH 4/15 i40e/i40evf: add exec_aq command to nvmupdate utility

Quoted 16 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Catherine Sullivan
Sent: Friday, August 28, 2015 2:56 PM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S13 04/15] i40e/i40evf: add exec_aq command to nvmupdate utility

From: Shannon Nelson <[email protected]>

Add a facility to run AQ commands through the nvmupdate utility in order to allow the update tools to interact with the FW and do special commands needed for updates and configuration changes.

Change-ID I5c41523e4055b37f8e4ee479f7a0574368f4a588
Quoted 8 lines
---
 drivers/net/ethernet/intel/i40e/i40e_adminq.c   |  3 +
 drivers/net/ethernet/intel/i40e/i40e_nvm.c      | 83
+++++++++++++++++++++++++
 drivers/net/ethernet/intel/i40e/i40e_type.h     |  2 +
 drivers/net/ethernet/intel/i40evf/i40e_adminq.c |  3 +
 drivers/net/ethernet/intel/i40evf/i40e_type.h   |  2 +
 5 files changed, 93 insertions(+)

Code changes present in tree

#9 lore raw

PATCH 5/15 i40e/i40evf: add get AQ result command to nvmupdate utility

In reply to Catherine Sullivan

From: Shannon Nelson <[email protected]>

Add a facility to recover the result of a previously run AQ command.

Change-ID I21afec2c20c1a5e6ba60c7fbfcbedfff78c10e45
---
 drivers/net/ethernet/intel/i40e/i40e_nvm.c    | 79 +++++++++++++++++++++++++++
 drivers/net/ethernet/intel/i40e/i40e_type.h   |  1 +
 drivers/net/ethernet/intel/i40evf/i40e_type.h |  1 +
 3 files changed, 81 insertions(+)
drivers/net/ethernet/intel/i40e/i40e_nvm.c +79 -0
index f91294de..2142e10 100644
@@ -620,6 +620,9 @@ static i40e_status i40e_nvmupd_nvm_read(struct i40e_hw *hw,
 static i40e_status i40e_nvmupd_exec_aq(struct i40e_hw *hw,
 				       struct i40e_nvm_access *cmd,
 				       u8 *bytes, int *perrno);
+static i40e_status i40e_nvmupd_get_aq_result(struct i40e_hw *hw,
+					     struct i40e_nvm_access *cmd,
+					     u8 *bytes, int *perrno);
 static inline u8 i40e_nvmupd_get_module(u32 val)
 {
 	return (u8)(val & I40E_NVM_MOD_PNT_MASK);
@@ -645,6 +648,7 @@ static char *i40e_nvm_update_state_str[] = {
 	"I40E_NVMUPD_CSUM_LCB",
 	"I40E_NVMUPD_STATUS",
 	"I40E_NVMUPD_EXEC_AQ",
+	"I40E_NVMUPD_GET_AQ_RESULT",
 };
 
 /**
@@ -834,6 +838,10 @@ static i40e_status i40e_nvmupd_state_init(struct i40e_hw *hw,
 		status = i40e_nvmupd_exec_aq(hw, cmd, bytes, perrno);
 		break;
 
+	case I40E_NVMUPD_GET_AQ_RESULT:
+		status = i40e_nvmupd_get_aq_result(hw, cmd, bytes, perrno);
+		break;
+
 	default:
 		i40e_debug(hw, I40E_DEBUG_NVM,
 			   "NVMUPD: bad cmd %s in init state\n",
@@ -1049,6 +1057,8 @@ static enum i40e_nvmupd_cmd i40e_nvmupd_validate_command(struct i40e_hw *hw,
 		case I40E_NVM_EXEC:
 			if (module == 0xf)
 				upd_cmd = I40E_NVMUPD_STATUS;
+			else if (module == 0)
+				upd_cmd = I40E_NVMUPD_GET_AQ_RESULT;
 			break;
 		}
 		break;
@@ -1162,6 +1172,75 @@ static i40e_status i40e_nvmupd_exec_aq(struct i40e_hw *hw,
 }
 
 /**
+ * i40e_nvmupd_get_aq_result - Get the results from the previous exec_aq
+ * @hw: pointer to hardware structure
+ * @cmd: pointer to nvm update command buffer
+ * @bytes: pointer to the data buffer
+ * @perrno: pointer to return error code
+ *
+ * cmd structure contains identifiers and data buffer
+ **/
+static i40e_status i40e_nvmupd_get_aq_result(struct i40e_hw *hw,
+					     struct i40e_nvm_access *cmd,
+					     u8 *bytes, int *perrno)
+{
+	u32 aq_total_len;
+	u32 aq_desc_len;
+	int remainder;
+	u8 *buff;
+
+	i40e_debug(hw, I40E_DEBUG_NVM, "NVMUPD: %s\n", __func__);
+
+	aq_desc_len = sizeof(struct i40e_aq_desc);
+	aq_total_len = aq_desc_len + le16_to_cpu(hw->nvm_wb_desc.datalen);
+
+	/* check offset range */
+	if (cmd->offset > aq_total_len) {
+		i40e_debug(hw, I40E_DEBUG_NVM, "%s: offset too big %d > %d\n",
+			   __func__, cmd->offset, aq_total_len);
+		*perrno = -EINVAL;
+		return I40E_ERR_PARAM;
+	}
+
+	/* check copylength range */
+	if (cmd->data_size > (aq_total_len - cmd->offset)) {
+		int new_len = aq_total_len - cmd->offset;
+
+		i40e_debug(hw, I40E_DEBUG_NVM, "%s: copy length %d too big, trimming to %d\n",
+			   __func__, cmd->data_size, new_len);
+		cmd->data_size = new_len;
+	}
+
+	remainder = cmd->data_size;
+	if (cmd->offset < aq_desc_len) {
+		u32 len = aq_desc_len - cmd->offset;
+
+		len = min(len, cmd->data_size);
+		i40e_debug(hw, I40E_DEBUG_NVM, "%s: aq_desc bytes %d to %d\n",
+			   __func__, cmd->offset, cmd->offset + len);
+
+		buff = ((u8 *)&hw->nvm_wb_desc) + cmd->offset;
+		memcpy(bytes, buff, len);
+
+		bytes += len;
+		remainder -= len;
+		buff = hw->nvm_buff.va;
+	} else {
+		buff = hw->nvm_buff.va + (cmd->offset - aq_desc_len);
+	}
+
+	if (remainder > 0) {
+		int start_byte = buff - (u8 *)hw->nvm_buff.va;
+
+		i40e_debug(hw, I40E_DEBUG_NVM, "%s: databuf bytes %d to %d\n",
+			   __func__, start_byte, start_byte + remainder);
+		memcpy(bytes, buff, remainder);
+	}
+
+	return 0;
+}
+
+/**
  * i40e_nvmupd_nvm_read - Read NVM
  * @hw: pointer to hardware structure
  * @cmd: pointer to nvm update command buffer
drivers/net/ethernet/intel/i40e/i40e_type.h +1 -0
index cb36b2a..d1ec5a4 100644
@@ -309,6 +309,7 @@ enum i40e_nvmupd_cmd {
 	I40E_NVMUPD_CSUM_LCB,
 	I40E_NVMUPD_STATUS,
 	I40E_NVMUPD_EXEC_AQ,
+	I40E_NVMUPD_GET_AQ_RESULT,
 };
 
 enum i40e_nvmupd_state {
drivers/net/ethernet/intel/i40evf/i40e_type.h +1 -0
index 5510220..a59b60f 100644
@@ -308,6 +308,7 @@ enum i40e_nvmupd_cmd {
 	I40E_NVMUPD_CSUM_LCB,
 	I40E_NVMUPD_STATUS,
 	I40E_NVMUPD_EXEC_AQ,
+	I40E_NVMUPD_GET_AQ_RESULT,
 };
 
 enum i40e_nvmupd_state {
Signature · 1 line
1.9.3
#10 lore raw

PATCH 5/15 i40e/i40evf: add get AQ result command to nvmupdate utility

Quoted 12 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Catherine Sullivan
Sent: Friday, August 28, 2015 2:56 PM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S13 05/15] i40e/i40evf: add get AQ result command to nvmupdate utility

From: Shannon Nelson <[email protected]>

Add a facility to recover the result of a previously run AQ command.

Quoted 8 lines
Change-ID I21afec2c20c1a5e6ba60c7fbfcbedfff78c10e45
---
 drivers/net/ethernet/intel/i40e/i40e_nvm.c    | 79
+++++++++++++++++++++++++++
 drivers/net/ethernet/intel/i40e/i40e_type.h   |  1 +
 drivers/net/ethernet/intel/i40evf/i40e_type.h |  1 +
 3 files changed, 81 insertions(+)

Code changes present in tree

#11 lore raw

PATCH 6/15 i40e: Support FW CEE DCB UP to TC map nibble swap

In reply to Catherine Sullivan

From: Greg Bowers <[email protected]>

Changes parsing of AQ command Get CEE DCBX OPER CFG (0x0A07). Change is required because FW creates the oper_prio_tc nibbles reversed from those in the CEE Priority Group sub-TLV.

Change-ID I7d9d8641bb430d30e286fc3fac909866ef8a0de8
---
 drivers/net/ethernet/intel/i40e/i40e_dcb.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_dcb.c +8 -5
index fbec7d7..6fa07ef 100644
@@ -681,15 +681,18 @@ static void i40e_cee_to_dcb_config(
 	/* CEE PG data to ETS config */
 	dcbcfg->etscfg.maxtcs = cee_cfg->oper_num_tc;
 
+	/* Note that the FW creates the oper_prio_tc nibbles reversed
+	 * from those in the CEE Priority Group sub-TLV.
+	 */
 	for (i = 0; i < 4; i++) {
 		tc = (u8)((cee_cfg->oper_prio_tc[i] &
-			 I40E_CEE_PGID_PRIO_1_MASK) >>
-			 I40E_CEE_PGID_PRIO_1_SHIFT);
-		dcbcfg->etscfg.prioritytable[i*2] =  tc;
-		tc = (u8)((cee_cfg->oper_prio_tc[i] &
 			 I40E_CEE_PGID_PRIO_0_MASK) >>
 			 I40E_CEE_PGID_PRIO_0_SHIFT);
-		dcbcfg->etscfg.prioritytable[i*2 + 1] = tc;
+		dcbcfg->etscfg.prioritytable[i * 2] =  tc;
+		tc = (u8)((cee_cfg->oper_prio_tc[i] &
+			 I40E_CEE_PGID_PRIO_1_MASK) >>
+			 I40E_CEE_PGID_PRIO_1_SHIFT);
+		dcbcfg->etscfg.prioritytable[i * 2 + 1] = tc;
 	}
 
 	for (i = 0; i < I40E_MAX_TRAFFIC_CLASS; i++)
Signature · 1 line
1.9.3
#12 lore raw

PATCH 6/15 i40e: Support FW CEE DCB UP to TC map nibble swap

Quoted 15 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Catherine Sullivan
Sent: Friday, August 28, 2015 2:56 PM
To: intel-wired-lan at lists.osuosl.org
Cc: Bowers, Gregory J
Subject: [Intel-wired-lan] [next PATCH S13 06/15] i40e: Support FW CEE DCB UP to TC map nibble swap

From: Greg Bowers <[email protected]>

Changes parsing of AQ command Get CEE DCBX OPER CFG (0x0A07). Change is required because FW creates the oper_prio_tc nibbles reversed from those in the CEE Priority Group sub-TLV.

Quoted 5 lines
Change-ID I7d9d8641bb430d30e286fc3fac909866ef8a0de8
---
 drivers/net/ethernet/intel/i40e/i40e_dcb.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

Code changes present in tree

#13 lore raw

PATCH 7/15 i40evf: detect reset more reliably

In reply to Catherine Sullivan

From: Mitch Williams <[email protected]>

Using VFGEN_RSTAT to detect a VF reset is an endeavor that is fraught with peril. It's entirely too easy to miss a reset because none of the bits are sticky. By the time the VF driver reads the register, the reset may have been processed and cleaned up by the PF driver, leaving the register in the same state that it was before the reset.

Instead, detect a reset with the VF_ARQLEN register. When the VF is reset, the enable bit in this register is cleared, and it stays cleared until the VF driver processes the reset and re-enables the admin queue.

Because we now deal with multiple registers in the reset and watchdog tasks, rename the rstat_val variable to reg_val.

Change-ID Id1df17045c0992e607da0162d31807f7fc20d199
---
 drivers/net/ethernet/intel/i40evf/i40evf_main.c | 36 +++++++++++--------------
 1 file changed, 16 insertions(+), 20 deletions(-)
drivers/net/ethernet/intel/i40evf/i40evf_main.c +16 -20
index 897e1ac..53ecc09 100644
@@ -1419,16 +1419,16 @@ static void i40evf_watchdog_task(struct work_struct *work)
 						      struct i40evf_adapter,
 						      watchdog_task);
 	struct i40e_hw *hw = &adapter->hw;
-	uint32_t rstat_val;
+	u32 reg_val;
 
 	if (test_and_set_bit(__I40EVF_IN_CRITICAL_TASK, &adapter->crit_section))
 		goto restart_watchdog;
 
 	if (adapter->flags & I40EVF_FLAG_PF_COMMS_FAILED) {
-		rstat_val = rd32(hw, I40E_VFGEN_RSTAT) &
-			    I40E_VFGEN_RSTAT_VFR_STATE_MASK;
-		if ((rstat_val == I40E_VFR_VFACTIVE) ||
-		    (rstat_val == I40E_VFR_COMPLETED)) {
+		reg_val = rd32(hw, I40E_VFGEN_RSTAT) &
+			  I40E_VFGEN_RSTAT_VFR_STATE_MASK;
+		if ((reg_val == I40E_VFR_VFACTIVE) ||
+		    (reg_val == I40E_VFR_COMPLETED)) {
 			/* A chance for redemption! */
 			dev_err(&adapter->pdev->dev, "Hardware came out of reset. Attempting reinit.\n");
 			adapter->state = __I40EVF_STARTUP;
@@ -1453,11 +1453,8 @@ static void i40evf_watchdog_task(struct work_struct *work)
 		goto watchdog_done;
 
 	/* check for reset */
-	rstat_val = rd32(hw, I40E_VFGEN_RSTAT) &
-		    I40E_VFGEN_RSTAT_VFR_STATE_MASK;
-	if (!(adapter->flags & I40EVF_FLAG_RESET_PENDING) &&
-	    (rstat_val != I40E_VFR_VFACTIVE) &&
-	    (rstat_val != I40E_VFR_COMPLETED)) {
+	reg_val = rd32(hw, I40E_VF_ARQLEN1) & I40E_VF_ARQLEN1_ARQENABLE_MASK;
+	if (!(adapter->flags & I40EVF_FLAG_RESET_PENDING) && !reg_val) {
 		adapter->state = __I40EVF_RESETTING;
 		adapter->flags |= I40EVF_FLAG_RESET_PENDING;
 		dev_err(&adapter->pdev->dev, "Hardware reset detected\n");
@@ -1572,7 +1569,7 @@ static void i40evf_reset_task(struct work_struct *work)
 	struct net_device *netdev = adapter->netdev;
 	struct i40e_hw *hw = &adapter->hw;
 	struct i40evf_mac_filter *f;
-	uint32_t rstat_val;
+	u32 reg_val;
 	int i = 0, err;
 
 	while (test_and_set_bit(__I40EVF_IN_CRITICAL_TASK,
@@ -1593,12 +1590,11 @@ static void i40evf_reset_task(struct work_struct *work)
 
 	/* poll until we see the reset actually happen */
 	for (i = 0; i < I40EVF_RESET_WAIT_COUNT; i++) {
-		rstat_val = rd32(hw, I40E_VFGEN_RSTAT) &
-			    I40E_VFGEN_RSTAT_VFR_STATE_MASK;
-		if ((rstat_val != I40E_VFR_VFACTIVE) &&
-		    (rstat_val != I40E_VFR_COMPLETED))
+		reg_val = rd32(hw, I40E_VF_ARQLEN1) &
+			  I40E_VF_ARQLEN1_ARQENABLE_MASK;
+		if (!reg_val)
 			break;
-		usleep_range(500, 1000);
+		usleep_range(5000, 10000);
 	}
 	if (i == I40EVF_RESET_WAIT_COUNT) {
 		dev_info(&adapter->pdev->dev, "Never saw reset\n");
@@ -1607,9 +1603,9 @@ static void i40evf_reset_task(struct work_struct *work)
 
 	/* wait until the reset is complete and the PF is responding to us */
 	for (i = 0; i < I40EVF_RESET_WAIT_COUNT; i++) {
-		rstat_val = rd32(hw, I40E_VFGEN_RSTAT) &
-			    I40E_VFGEN_RSTAT_VFR_STATE_MASK;
-		if (rstat_val == I40E_VFR_VFACTIVE)
+		reg_val = rd32(hw, I40E_VFGEN_RSTAT) &
+			  I40E_VFGEN_RSTAT_VFR_STATE_MASK;
+		if (reg_val == I40E_VFR_VFACTIVE)
 			break;
 		msleep(I40EVF_RESET_WAIT_MS);
 	}
@@ -1621,7 +1617,7 @@ static void i40evf_reset_task(struct work_struct *work)
 
 		/* reset never finished */
 		dev_err(&adapter->pdev->dev, "Reset never finished (%x)\n",
-			rstat_val);
+			reg_val);
 		adapter->flags |= I40EVF_FLAG_PF_COMMS_FAILED;
 
 		if (netif_running(adapter->netdev)) {
Signature · 1 line
1.9.3
#14 lore raw

PATCH 7/15 i40evf: detect reset more reliably

Quoted 23 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Catherine Sullivan
Sent: Friday, August 28, 2015 2:56 PM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S13 07/15] i40evf: detect reset more reliably

From: Mitch Williams <[email protected]>

Using VFGEN_RSTAT to detect a VF reset is an endeavor that is fraught with peril. It's entirely too easy to miss a reset because none of the bits are sticky. By the time the VF driver reads the register, the reset may have been processed and cleaned up by the PF driver, leaving the register in the same state that it was before the reset.

Instead, detect a reset with the VF_ARQLEN register. When the VF is reset, the enable bit in this register is cleared, and it stays cleared until the VF driver processes the reset and re-enables the admin queue.

Because we now deal with multiple registers in the reset and watchdog tasks, rename the rstat_val variable to reg_val.

Quoted 6 lines
Change-ID Id1df17045c0992e607da0162d31807f7fc20d199
---
 drivers/net/ethernet/intel/i40evf/i40evf_main.c | 36 +++++++++++----------
----
 1 file changed, 16 insertions(+), 20 deletions(-)

Code changes present in tree.

#15 lore raw

PATCH 8/15 i40e/i40evf: clean up some code

In reply to Catherine Sullivan

From: Jesse Brandeburg <[email protected]>

Add missings spaces after declarations, remove another __func__ use, remove uncessary braces, remove unneeded breaks, and useless returns, and generally fix up some code.

Change-ID Ie715d6b64976c50e1c21531685fe0a2bd38c4244
---
 drivers/net/ethernet/intel/i40e/i40e_adminq.c      |   3 +-
 drivers/net/ethernet/intel/i40e/i40e_common.c      |   9 +-
 drivers/net/ethernet/intel/i40e/i40e_dcb_nl.c      |   1 +
 drivers/net/ethernet/intel/i40e/i40e_debugfs.c     | 124 ++++++++++++---------
 drivers/net/ethernet/intel/i40e/i40e_ethtool.c     |   3 +-
 drivers/net/ethernet/intel/i40e/i40e_fcoe.c        |   1 -
 drivers/net/ethernet/intel/i40e/i40e_lan_hmc.c     |   3 +-
 drivers/net/ethernet/intel/i40e/i40e_main.c        |  39 ++++---
 drivers/net/ethernet/intel/i40e/i40e_ptp.c         |   3 +-
 drivers/net/ethernet/intel/i40e/i40e_txrx.c        |   6 +-
 drivers/net/ethernet/intel/i40e/i40e_txrx.h        |   1 +
 drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c |  13 ++-
 drivers/net/ethernet/intel/i40evf/i40e_adminq.c    |   3 +-
 drivers/net/ethernet/intel/i40evf/i40e_common.c    |   8 +-
 drivers/net/ethernet/intel/i40evf/i40e_txrx.c      |   6 +-
 drivers/net/ethernet/intel/i40evf/i40e_txrx.h      |   1 +
 drivers/net/ethernet/intel/i40evf/i40evf.h         |   4 -
 17 files changed, 125 insertions(+), 103 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_adminq.c +1 -2
index 3e1f0b2..bfe8979 100644
@@ -681,8 +681,7 @@ static u16 i40e_clean_asq(struct i40e_hw *hw)
 	details = I40E_ADMINQ_DETAILS(*asq, ntc);
 	while (rd32(hw, hw->aq.asq.head) != ntc) {
 		i40e_debug(hw, I40E_DEBUG_AQ_MESSAGE,
-			   "%s: ntc %d head %d.\n", __func__, ntc,
-			   rd32(hw, hw->aq.asq.head));
+			   "ntc %d head %d.\n", ntc, rd32(hw, hw->aq.asq.head));
 
 		if (details->callback) {
 			I40E_ADMINQ_CALLBACK cb_func =
drivers/net/ethernet/intel/i40e/i40e_common.c +5 -4
index 2839ea5..2d012d9 100644
@@ -1035,7 +1035,7 @@ i40e_status i40e_get_mac_addr(struct i40e_hw *hw, u8 *mac_addr)
 	status = i40e_aq_mac_address_read(hw, &flags, &addrs, NULL);
 
 	if (flags & I40E_AQC_LAN_ADDR_VALID)
-		memcpy(mac_addr, &addrs.pf_lan_mac, sizeof(addrs.pf_lan_mac));
+		ether_addr_copy(mac_addr, addrs.pf_lan_mac);
 
 	return status;
 }
@@ -1058,7 +1058,7 @@ i40e_status i40e_get_port_mac_addr(struct i40e_hw *hw, u8 *mac_addr)
 		return status;
 
 	if (flags & I40E_AQC_PORT_ADDR_VALID)
-		memcpy(mac_addr, &addrs.port_mac, sizeof(addrs.port_mac));
+		ether_addr_copy(mac_addr, addrs.port_mac);
 	else
 		status = I40E_ERR_INVALID_MAC_ADDR;
 
@@ -1116,7 +1116,7 @@ i40e_status i40e_get_san_mac_addr(struct i40e_hw *hw, u8 *mac_addr)
 		return status;
 
 	if (flags & I40E_AQC_SAN_ADDR_VALID)
-		memcpy(mac_addr, &addrs.pf_san_mac, sizeof(addrs.pf_san_mac));
+		ether_addr_copy(mac_addr, addrs.pf_san_mac);
 	else
 		status = I40E_ERR_INVALID_MAC_ADDR;
 
@@ -2363,6 +2363,7 @@ i40e_status i40e_aq_get_veb_parameters(struct i40e_hw *hw,
 		*vebs_free = le16_to_cpu(cmd_resp->vebs_free);
 	if (floating) {
 		u16 flags = le16_to_cpu(cmd_resp->veb_flags);
+
 		if (flags & I40E_AQC_ADD_VEB_FLOATING)
 			*floating = true;
 		else
@@ -3777,7 +3778,7 @@ i40e_status i40e_aq_add_rem_control_packet_filter(struct i40e_hw *hw,
 	}
 
 	if (mac_addr)
-		memcpy(cmd->mac, mac_addr, ETH_ALEN);
+		ether_addr_copy(cmd->mac, mac_addr);
 
 	cmd->etype = cpu_to_le16(ethtype);
 	cmd->flags = cpu_to_le16(flags);
drivers/net/ethernet/intel/i40e/i40e_dcb_nl.c +1 -0
index dbadad7..7c42d13 100644
@@ -236,6 +236,7 @@ static void i40e_dcbnl_del_app(struct i40e_pf *pf,
 			       struct i40e_dcb_app_priority_table *app)
 {
 	int v, err;
+
 	for (v = 0; v < pf->num_alloc_vsi; v++) {
 		if (pf->vsi[v] && pf->vsi[v]->netdev) {
 			err = i40e_dcbnl_vsi_del_app(pf->vsi[v], app);
drivers/net/ethernet/intel/i40e/i40e_debugfs.c +72 -52

274 lines not on this page · raw message

drivers/net/ethernet/intel/i40e/i40e_ethtool.c +2 -1
index 5a726f2..148f614 100644
@@ -1360,6 +1360,7 @@ static void i40e_get_ethtool_stats(struct net_device *netdev,
 	if ((pf->lan_veb != I40E_NO_VEB) &&
 	    (pf->flags & I40E_FLAG_VEB_STATS_ENABLED)) {
 		struct i40e_veb *veb = pf->veb[pf->lan_veb];
+
 		for (j = 0; j < I40E_VEB_STATS_LEN; j++) {
 			p = (char *)veb;
 			p += i40e_gstrings_veb_stats[j].stat_offset;
@@ -1607,7 +1608,7 @@ static inline bool i40e_active_vfs(struct i40e_pf *pf)
 	int i;
 
 	for (i = 0; i < pf->num_alloc_vfs; i++)
-		if (vfs[i].vf_states & I40E_VF_STAT_ACTIVE)
+		if (test_bit(I40E_VF_STAT_ACTIVE, &vfs[i].vf_states))
 			return true;
 	return false;
 }
drivers/net/ethernet/intel/i40e/i40e_fcoe.c +0 -1
index 2398d9b..eaedc1f 100644
@@ -324,7 +324,6 @@ void i40e_init_pf_fcoe(struct i40e_pf *pf)
 	wr32(hw, I40E_GLFCOE_RCTL, val);
 
 	dev_info(&pf->pdev->dev, "FCoE is supported.\n");
-	return;
 }
 
 /**
drivers/net/ethernet/intel/i40e/i40e_lan_hmc.c +1 -2
index fa371a2..79ae7be 100644
@@ -431,9 +431,8 @@ exit_sd_error:
 			pd_idx1 = max(pd_idx,
 				      ((j - 1) * I40E_HMC_MAX_BP_COUNT));
 			pd_lmt1 = min(pd_lmt, (j * I40E_HMC_MAX_BP_COUNT));
-			for (i = pd_idx1; i < pd_lmt1; i++) {
+			for (i = pd_idx1; i < pd_lmt1; i++)
 				i40e_remove_pd_bp(hw, info->hmc_info, i);
-			}
 			i40e_remove_pd_page(hw, info->hmc_info, (j - 1));
 			break;
 		case I40E_SD_TYPE_DIRECT:
drivers/net/ethernet/intel/i40e/i40e_main.c +21 -18
index 2ea4cdd..87ad491 100644
@@ -216,10 +216,10 @@ static int i40e_get_lump(struct i40e_pf *pf, struct i40e_lump_tracking *pile,
 			ret = i;
 			pile->search_hint = i + j;
 			break;
-		} else {
-			/* not enough, so skip over it and continue looking */
-			i += j;
 		}
+
+		/* not enough, so skip over it and continue looking */
+		i += j;
 	}
 
 	return ret;
@@ -460,11 +460,11 @@ void i40e_vsi_reset_stats(struct i40e_vsi *vsi)
 	memset(&vsi->eth_stats_offsets, 0, sizeof(vsi->eth_stats_offsets));
 	if (vsi->rx_rings && vsi->rx_rings[0]) {
 		for (i = 0; i < vsi->num_queue_pairs; i++) {
-			memset(&vsi->rx_rings[i]->stats, 0 ,
+			memset(&vsi->rx_rings[i]->stats, 0,
 			       sizeof(vsi->rx_rings[i]->stats));
-			memset(&vsi->rx_rings[i]->rx_stats, 0 ,
+			memset(&vsi->rx_rings[i]->rx_stats, 0,
 			       sizeof(vsi->rx_rings[i]->rx_stats));
-			memset(&vsi->tx_rings[i]->stats, 0 ,
+			memset(&vsi->tx_rings[i]->stats, 0,
 			       sizeof(vsi->tx_rings[i]->stats));
 			memset(&vsi->tx_rings[i]->tx_stats, 0,
 			       sizeof(vsi->tx_rings[i]->tx_stats));
@@ -782,6 +782,7 @@ static void i40e_update_link_xoff_rx(struct i40e_pf *pf)
 
 		for (i = 0; i < vsi->num_queue_pairs; i++) {
 			struct i40e_ring *ring = vsi->tx_rings[i];
+
 			clear_bit(__I40E_HANG_CHECK_ARMED, &ring->state);
 		}
 	}
@@ -813,6 +814,7 @@ static void i40e_update_prio_xoff_rx(struct i40e_pf *pf)
 
 	for (i = 0; i < I40E_MAX_USER_PRIORITY; i++) {
 		u64 prio_xoff = nsd->priority_xoff_rx[i];
+
 		i40e_stat_update32(hw, I40E_GLPRT_PXOFFRXC(hw->port, i),
 				   pf->stat_offsets_loaded,
 				   &osd->priority_xoff_rx[i],
@@ -1426,6 +1428,7 @@ void i40e_del_filter(struct i40e_vsi *vsi,
 	} else {
 		/* make sure we don't remove a filter in use by VF or netdev */
 		int min_f = 0;
+
 		min_f += (f->is_vf ? 1 : 0);
 		min_f += (f->is_netdev ? 1 : 0);
 
@@ -1484,6 +1487,7 @@ static int i40e_set_mac(struct net_device *netdev, void *p)
 
 	if (vsi->type == I40E_VSI_MAIN) {
 		i40e_status ret;
+
 		ret = i40e_aq_mac_address_write(&vsi->back->hw,
 						I40E_AQC_WRITE_TYPE_LAA_WOL,
 						addr->sa_data, NULL);
@@ -1918,6 +1922,7 @@ int i40e_sync_vsi_filters(struct i40e_vsi *vsi)
 	/* check for changes in promiscuous modes */
 	if (changed_flags & IFF_ALLMULTI) {
 		bool cur_multipromisc;
+
 		cur_multipromisc = !!(vsi->current_netdev_flags & IFF_ALLMULTI);
 		ret = i40e_aq_set_vsi_multicast_promiscuous(&vsi->back->hw,
 							    vsi->seid,
@@ -1932,6 +1937,7 @@ int i40e_sync_vsi_filters(struct i40e_vsi *vsi)
 	}
 	if ((changed_flags & IFF_PROMISC) || promisc_forced_on) {
 		bool cur_promisc;
+
 		cur_promisc = (!!(vsi->current_netdev_flags & IFF_PROMISC) ||
 			       test_bit(__I40E_FILTER_OVERFLOW_PROMISC,
 					&vsi->state));
@@ -3222,6 +3228,7 @@ static irqreturn_t i40e_intr(int irq, void *data)
 
 		/* temporarily disable queue cause for NAPI processing */
 		u32 qval = rd32(hw, I40E_QINT_RQCTL(0));
+
 		qval &= ~I40E_QINT_RQCTL_CAUSE_ENA_MASK;
 		wr32(hw, I40E_QINT_RQCTL(0), qval);
 
@@ -3391,9 +3398,9 @@ static bool i40e_clean_fdir_tx_irq(struct i40e_ring *tx_ring, int budget)
 	i += tx_ring->count;
 	tx_ring->next_to_clean = i;
 
-	if (vsi->back->flags & I40E_FLAG_MSIX_ENABLED) {
+	if (vsi->back->flags & I40E_FLAG_MSIX_ENABLED)
 		i40e_irq_dynamic_enable(vsi, tx_ring->q_vector->v_idx);
-	}
+
 	return budget > 0;
 }
 
@@ -3996,11 +4003,10 @@ static void i40e_quiesce_vsi(struct i40e_vsi *vsi)
 	}
 
 	set_bit(__I40E_NEEDS_RESTART, &vsi->state);
-	if (vsi->netdev && netif_running(vsi->netdev)) {
+	if (vsi->netdev && netif_running(vsi->netdev))
 		vsi->netdev->netdev_ops->ndo_stop(vsi->netdev);
-	} else {
+	else
 		i40e_vsi_close(vsi);
-	}
 }
 
 /**
@@ -5173,15 +5179,13 @@ void i40e_do_reset(struct i40e_pf *pf, u32 reset_flags)
 			 "VSI reinit requested\n");
 		for (v = 0; v < pf->num_alloc_vsi; v++) {
 			struct i40e_vsi *vsi = pf->vsi[v];
+
 			if (vsi != NULL &&
 			    test_bit(__I40E_REINIT_REQUESTED, &vsi->state)) {
 				i40e_vsi_reinit_locked(pf->vsi[v]);
 				clear_bit(__I40E_REINIT_REQUESTED, &vsi->state);
 			}
 		}
-
-		/* no further action needed, so return now */
-		return;
 	} else if (reset_flags & BIT_ULL(__I40E_DOWN_REQUESTED)) {
 		int v;
 
@@ -5189,6 +5193,7 @@ void i40e_do_reset(struct i40e_pf *pf, u32 reset_flags)
 		dev_info(&pf->pdev->dev, "VSI down requested\n");
 		for (v = 0; v < pf->num_alloc_vsi; v++) {
 			struct i40e_vsi *vsi = pf->vsi[v];
+
 			if (vsi != NULL &&
 			    test_bit(__I40E_DOWN_REQUESTED, &vsi->state)) {
 				set_bit(__I40E_DOWN, &vsi->state);
@@ -5196,13 +5201,9 @@ void i40e_do_reset(struct i40e_pf *pf, u32 reset_flags)
 				clear_bit(__I40E_DOWN_REQUESTED, &vsi->state);
 			}
 		}
-
-		/* no further action needed, so return now */
-		return;
 	} else {
 		dev_info(&pf->pdev->dev,
 			 "bad reset request 0x%08x\n", reset_flags);
-		return;
 	}
 }
 
@@ -6209,6 +6210,7 @@ static int i40e_reconstitute_veb(struct i40e_veb *veb)
 
 		if (pf->vsi[v]->veb_idx == veb->idx) {
 			struct i40e_vsi *vsi = pf->vsi[v];
+
 			vsi->uplink_seid = veb->seid;
 			ret = i40e_add_vsi(vsi);
 			if (ret) {
@@ -9699,6 +9701,7 @@ static int i40e_setup_pf_switch(struct i40e_pf *pf, bool reinit)
 	} else {
 		/* force a reset of TC and queue layout configurations */
 		u8 enabled_tc = pf->vsi[pf->lan_vsi]->tc_config.enabled_tc;
+
 		pf->vsi[pf->lan_vsi]->tc_config.enabled_tc = 0;
 		pf->vsi[pf->lan_vsi]->seid = pf->main_vsi_seid;
 		i40e_vsi_config_tc(pf->vsi[pf->lan_vsi], enabled_tc);
drivers/net/ethernet/intel/i40e/i40e_ptp.c +1 -2
index 8c40d6e..552c84e 100644
@@ -618,9 +618,8 @@ static long i40e_ptp_create_clock(struct i40e_pf *pf)
 
 	/* Attempt to register the clock before enabling the hardware. */
 	pf->ptp_clock = ptp_clock_register(&pf->ptp_caps, &pf->pdev->dev);
-	if (IS_ERR(pf->ptp_clock)) {
+	if (IS_ERR(pf->ptp_clock))
 		return PTR_ERR(pf->ptp_clock);
-	}
 
 	/* clear the hwtstamp settings here during clock create, instead of
 	 * during regular init, so that we can maintain settings across a
drivers/net/ethernet/intel/i40e/i40e_txrx.c +3 -3
index 4232217..2144f58 100644
@@ -1599,6 +1599,7 @@ static int i40e_clean_rx_irq_ps(struct i40e_ring *rx_ring, int budget)
 		cleaned_count++;
 		if (rx_hbo || rx_sph) {
 			int len;
+
 			if (rx_hbo)
 				len = I40E_RX_HDR_SIZE;
 			else
@@ -1784,9 +1785,6 @@ static int i40e_clean_rx_irq_1buf(struct i40e_ring *rx_ring, int budget)
 		/* ERR_MASK will only have valid bits if EOP set */
 		if (unlikely(rx_error & BIT(I40E_RX_DESC_ERROR_RXE_SHIFT))) {
 			dev_kfree_skb_any(skb);
-			/* TODO: shouldn't we increment a counter indicating the
-			 * drop?
-			 */
 			continue;
 		}
 
@@ -2158,6 +2156,7 @@ static inline int i40e_tx_prepare_vlan_flags(struct sk_buff *skb,
 	/* else if it is a SW VLAN, check the next protocol and store the tag */
 	} else if (protocol == htons(ETH_P_8021Q)) {
 		struct vlan_hdr *vhdr, _vhdr;
+
 		vhdr = skb_header_pointer(skb, ETH_HLEN, sizeof(_vhdr), &_vhdr);
 		if (!vhdr)
 			return -EINVAL;
@@ -2778,6 +2777,7 @@ static netdev_tx_t i40e_xmit_frame_ring(struct sk_buff *skb,
 	u8 hdr_len = 0;
 	int tsyn;
 	int tso;
+
 	if (0 == i40e_xmit_descriptor_count(skb, tx_ring))
 		return NETDEV_TX_BUSY;
 
drivers/net/ethernet/intel/i40e/i40e_txrx.h +1 -0
index c6d2995..12612ee 100644
@@ -165,6 +165,7 @@ struct i40e_tx_buffer {
 	};
 	unsigned int bytecount;
 	unsigned short gso_segs;
+
 	DEFINE_DMA_UNMAP_ADDR(dma);
 	DEFINE_DMA_UNMAP_LEN(len);
 	u32 tx_flags;
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +8 -5
index aa4e44c..f42c7c1 100644
@@ -536,6 +536,7 @@ static int i40e_alloc_vsi_res(struct i40e_vf *vf, enum i40e_vsi_type type)
 	}
 	if (type == I40E_VSI_SRIOV) {
 		u8 brdcast[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
+
 		vf->lan_vsi_idx = vsi->idx;
 		vf->lan_vsi_id = vsi->id;
 		/* If the port VLAN has been configured and then the
@@ -605,6 +606,7 @@ static void i40e_enable_vf_mappings(struct i40e_vf *vf)
 	/* map PF queues to VF queues */
 	for (j = 0; j < pf->vsi[vf->lan_vsi_idx]->alloc_queue_pairs; j++) {
 		u16 qid = i40e_vc_get_pf_queue_id(vf, vf->lan_vsi_id, j);
+
 		reg = (qid & I40E_VPLAN_QTABLE_QINDEX_MASK);
 		wr32(hw, I40E_VPLAN_QTABLE(total_queue_pairs, vf->vf_id), reg);
 		total_queue_pairs++;
@@ -991,7 +993,7 @@ static int i40e_pci_sriov_enable(struct pci_dev *pdev, int num_vfs)
 	int pre_existing_vfs = pci_num_vf(pdev);
 	int err = 0;
 
-	if (pf->state & __I40E_TESTING) {
+	if (test_bit(__I40E_TESTING, &pf->state)) {
 		dev_warn(&pdev->dev,
 			 "Cannot enable SR-IOV virtual functions while the device is undergoing diagnostic testing\n");
 		err = -EPERM;
@@ -1210,8 +1212,8 @@ static int i40e_vc_get_vf_resources_msg(struct i40e_vf *vf, u8 *msg)
 		vfres->vsi_res[i].vsi_type = I40E_VSI_SRIOV;
 		vfres->vsi_res[i].num_queue_pairs =
 		    pf->vsi[vf->lan_vsi_idx]->alloc_queue_pairs;
-		memcpy(vfres->vsi_res[i].default_mac_addr,
-		       vf->default_lan_addr.addr, ETH_ALEN);
+		ether_addr_copy(vfres->vsi_res[i].default_mac_addr,
+				vf->default_lan_addr.addr);
 		i++;
 	}
 	set_bit(I40E_VF_STAT_ACTIVE, &vf->vf_states);
@@ -1715,6 +1717,7 @@ static int i40e_vc_add_vlan_msg(struct i40e_vf *vf, u8 *msg, u16 msglen)
 	for (i = 0; i < vfl->num_elements; i++) {
 		/* add new VLAN filter */
 		int ret = i40e_vsi_add_vlan(vsi, vfl->vlan_id[i]);
+
 		if (ret)
 			dev_err(&pf->pdev->dev,
 				"Unable to add VF vlan filter %d, error %d\n",
@@ -1766,6 +1769,7 @@ static int i40e_vc_remove_vlan_msg(struct i40e_vf *vf, u8 *msg, u16 msglen)
 
 	for (i = 0; i < vfl->num_elements; i++) {
 		int ret = i40e_vsi_kill_vlan(vsi, vfl->vlan_id[i]);
+
 		if (ret)
 			dev_err(&pf->pdev->dev,
 				"Unable to delete VF vlan filter %d, error %d\n",
@@ -1877,7 +1881,6 @@ static int i40e_vc_validate_vf_msg(struct i40e_vf *vf, u32 v_opcode,
 	case I40E_VIRTCHNL_OP_UNKNOWN:
 	default:
 		return -EPERM;
-		break;
 	}
 	/* few more checks */
 	if ((valid_len != msglen) || (err_msg_format)) {
@@ -2316,7 +2319,7 @@ int i40e_ndo_get_vf_config(struct net_device *netdev,
 
 	ivi->vf = vf_id;
 
-	memcpy(&ivi->mac, vf->default_lan_addr.addr, ETH_ALEN);
+	ether_addr_copy(ivi->mac, vf->default_lan_addr.addr);
 
 	ivi->max_tx_rate = vf->tx_rate;
 	ivi->min_tx_rate = 0;
drivers/net/ethernet/intel/i40evf/i40e_adminq.c +1 -2
index cb21e01..7b5993b 100644
@@ -620,8 +620,7 @@ static u16 i40e_clean_asq(struct i40e_hw *hw)
 	details = I40E_ADMINQ_DETAILS(*asq, ntc);
 	while (rd32(hw, hw->aq.asq.head) != ntc) {
 		i40e_debug(hw, I40E_DEBUG_AQ_MESSAGE,
-			   "%s: ntc %d head %d.\n", __func__, ntc,
-			   rd32(hw, hw->aq.asq.head));
+			   "ntc %d head %d.\n", ntc, rd32(hw, hw->aq.asq.head));
 
 		if (details->callback) {
 			I40E_ADMINQ_CALLBACK cb_func =
drivers/net/ethernet/intel/i40evf/i40e_common.c +4 -4
index 96e48ee..b98b642 100644
@@ -992,10 +992,10 @@ void i40e_vf_parse_hw_config(struct i40e_hw *hw,
 			     I40E_VIRTCHNL_VF_OFFLOAD_FCOE) ? 1 : 0;
 	for (i = 0; i < msg->num_vsis; i++) {
 		if (vsi_res->vsi_type == I40E_VSI_SRIOV) {
-			memcpy(hw->mac.perm_addr, vsi_res->default_mac_addr,
-			       ETH_ALEN);
-			memcpy(hw->mac.addr, vsi_res->default_mac_addr,
-			       ETH_ALEN);
+			ether_addr_copy(hw->mac.perm_addr,
+					vsi_res->default_mac_addr);
+			ether_addr_copy(hw->mac.addr,
+					vsi_res->default_mac_addr);
 		}
 		vsi_res++;
 	}
drivers/net/ethernet/intel/i40evf/i40e_txrx.c +3 -3
index 1d0e38f..45260c2 100644
@@ -1065,6 +1065,7 @@ static int i40e_clean_rx_irq_ps(struct i40e_ring *rx_ring, int budget)
 		cleaned_count++;
 		if (rx_hbo || rx_sph) {
 			int len;
+
 			if (rx_hbo)
 				len = I40E_RX_HDR_SIZE;
 			else
@@ -1238,9 +1239,6 @@ static int i40e_clean_rx_irq_1buf(struct i40e_ring *rx_ring, int budget)
 		/* ERR_MASK will only have valid bits if EOP set */
 		if (unlikely(rx_error & BIT(I40E_RX_DESC_ERROR_RXE_SHIFT))) {
 			dev_kfree_skb_any(skb);
-			/* TODO: shouldn't we increment a counter indicating the
-			 * drop?
-			 */
 			continue;
 		}
 
@@ -1436,6 +1434,7 @@ static inline int i40evf_tx_prepare_vlan_flags(struct sk_buff *skb,
 	/* else if it is a SW VLAN, check the next protocol and store the tag */
 	} else if (protocol == htons(ETH_P_8021Q)) {
 		struct vlan_hdr *vhdr, _vhdr;
+
 		vhdr = skb_header_pointer(skb, ETH_HLEN, sizeof(_vhdr), &_vhdr);
 		if (!vhdr)
 			return -EINVAL;
@@ -1978,6 +1977,7 @@ static netdev_tx_t i40e_xmit_frame_ring(struct sk_buff *skb,
 	u32 td_cmd = 0;
 	u8 hdr_len = 0;
 	int tso;
+
 	if (0 == i40evf_xmit_descriptor_count(skb, tx_ring))
 		return NETDEV_TX_BUSY;
 
drivers/net/ethernet/intel/i40evf/i40e_txrx.h +1 -0
index e8dd651..26fc85f 100644
@@ -164,6 +164,7 @@ struct i40e_tx_buffer {
 	};
 	unsigned int bytecount;
 	unsigned short gso_segs;
+
 	DEFINE_DMA_UNMAP_ADDR(dma);
 	DEFINE_DMA_UNMAP_LEN(len);
 	u32 tx_flags;
drivers/net/ethernet/intel/i40evf/i40evf.h +0 -4
index 3817cbb..27dc3fe 100644
@@ -48,10 +48,6 @@
 
 #define DEFAULT_DEBUG_LEVEL_SHIFT 3
 #define PFX "i40evf: "
-#define DPRINTK(nlevel, klevel, fmt, args...) \
-	((void)((NETIF_MSG_##nlevel & adapter->msg_enable) && \
-	printk(KERN_##klevel PFX "%s: %s: " fmt, adapter->netdev->name, \
-		__func__ , ## args)))
 
 /* dummy struct to make common code less painful */
 struct i40e_vsi {
Signature · 1 line
1.9.3
#16 lore raw

PATCH 8/15 i40e/i40evf: clean up some code

Quoted 29 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Catherine Sullivan
Sent: Friday, August 28, 2015 2:56 PM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S13 08/15] i40e/i40evf: clean up some code

From: Jesse Brandeburg <[email protected]>

Add missings spaces after declarations, remove another __func__ use, remove uncessary braces, remove unneeded breaks, and useless returns, and generally fix up some code.

Change-ID Ie715d6b64976c50e1c21531685fe0a2bd38c4244
---
 drivers/net/ethernet/intel/i40e/i40e_adminq.c      |   3 +-
 drivers/net/ethernet/intel/i40e/i40e_common.c      |   9 +-
 drivers/net/ethernet/intel/i40e/i40e_dcb_nl.c      |   1 +
 drivers/net/ethernet/intel/i40e/i40e_debugfs.c     | 124 ++++++++++++-----
----
 drivers/net/ethernet/intel/i40e/i40e_ethtool.c     |   3 +-
 drivers/net/ethernet/intel/i40e/i40e_fcoe.c        |   1 -
 drivers/net/ethernet/intel/i40e/i40e_lan_hmc.c     |   3 +-
 drivers/net/ethernet/intel/i40e/i40e_main.c        |  39 ++++---
 drivers/net/ethernet/intel/i40e/i40e_ptp.c         |   3 +-
 drivers/net/ethernet/intel/i40e/i40e_txrx.c        |   6 +-
Quoted 8 lines
 drivers/net/ethernet/intel/i40e/i40e_txrx.h        |   1 +
 drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c |  13 ++-
 drivers/net/ethernet/intel/i40evf/i40e_adminq.c    |   3 +-
 drivers/net/ethernet/intel/i40evf/i40e_common.c    |   8 +-
 drivers/net/ethernet/intel/i40evf/i40e_txrx.c      |   6 +-
 drivers/net/ethernet/intel/i40evf/i40e_txrx.h      |   1 +
 drivers/net/ethernet/intel/i40evf/i40evf.h         |   4 -
 17 files changed, 125 insertions(+), 103 deletions(-)

Code changes present in tree

#17 lore raw

PATCH 9/15 i40evf: Fix check_tx_hang

In reply to Catherine Sullivan

We were missing an else so add it back in.

---
 drivers/net/ethernet/intel/i40evf/i40e_txrx.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/net/ethernet/intel/i40evf/i40e_txrx.c +2 -0
index 45260c2..7b20f53 100644
@@ -191,6 +191,8 @@ static bool i40e_check_tx_hang(struct i40e_ring *tx_ring)
 				       &tx_ring->state);
 	} else if (tx_done_old == tx_done &&
 		   (tx_pending < I40E_MIN_DESC_PENDING) && (tx_pending > 0)) {
+		/* do nothing */
+	} else {
 		/* update completed stats and disarm the hang check */
 		tx_ring->tx_stats.tx_done_old = tx_done;
 		clear_bit(__I40E_HANG_CHECK_ARMED, &tx_ring->state);
Signature · 1 line
1.9.3
#18 lore raw

PATCH 9/15 i40evf: Fix check_tx_hang

Quoted 7 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Catherine Sullivan
Sent: Friday, August 28, 2015 2:56 PM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S13 09/15] i40evf: Fix check_tx_hang

Quoted 6 lines

We were missing an else so add it back in.

---
 drivers/net/ethernet/intel/i40evf/i40e_txrx.c | 2 ++
 1 file changed, 2 insertions(+)

Code changes present in tree

#19 lore raw

PATCH 10/15 i40e: refactor code to remove indent

In reply to Catherine Sullivan

From: Jesse Brandeburg <[email protected]>

I found a code indent that was avoidable because a whole function is inside an if block, reverse the if and move the code back a tab.

Change-ID I9989c8750ee61678fbf96a3b0fd7bf7cc7ef300a
---
 drivers/net/ethernet/intel/i40e/i40e_main.c | 82 +++++++++++++++--------------
 1 file changed, 42 insertions(+), 40 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_main.c +42 -40
index 87ad491..2771259 100644
@@ -5540,49 +5540,51 @@ static void i40e_fdir_flush_and_replay(struct i40e_pf *pf)
 	if (!(pf->flags & (I40E_FLAG_FD_SB_ENABLED | I40E_FLAG_FD_ATR_ENABLED)))
 		return;
 
-	if (time_after(jiffies, pf->fd_flush_timestamp +
-				(I40E_MIN_FD_FLUSH_INTERVAL * HZ))) {
-		/* If the flush is happening too quick and we have mostly
-		 * SB rules we should not re-enable ATR for some time.
-		 */
-		min_flush_time = pf->fd_flush_timestamp
-				+ (I40E_MIN_FD_FLUSH_SB_ATR_UNSTABLE * HZ);
-		fd_room = pf->fdir_pf_filter_count - pf->fdir_pf_active_filters;
+	if (!time_after(jiffies, pf->fd_flush_timestamp +
+				 (I40E_MIN_FD_FLUSH_INTERVAL * HZ)))
+		return;
 
-		if (!(time_after(jiffies, min_flush_time)) &&
-		    (fd_room < I40E_FDIR_BUFFER_HEAD_ROOM_FOR_ATR)) {
-			if (I40E_DEBUG_FD & pf->hw.debug_mask)
-				dev_info(&pf->pdev->dev, "ATR disabled, not enough FD filter space.\n");
-			disable_atr = true;
-		}
+	/* If the flush is happening too quick and we have mostly SB rules we
+	 * should not re-enable ATR for some time.
+	 */
+	min_flush_time = pf->fd_flush_timestamp +
+			 (I40E_MIN_FD_FLUSH_SB_ATR_UNSTABLE * HZ);
+	fd_room = pf->fdir_pf_filter_count - pf->fdir_pf_active_filters;
 
-		pf->fd_flush_timestamp = jiffies;
-		pf->flags &= ~I40E_FLAG_FD_ATR_ENABLED;
-		/* flush all filters */
-		wr32(&pf->hw, I40E_PFQF_CTL_1,
-		     I40E_PFQF_CTL_1_CLEARFDTABLE_MASK);
-		i40e_flush(&pf->hw);
-		pf->fd_flush_cnt++;
-		pf->fd_add_err = 0;
-		do {
-			/* Check FD flush status every 5-6msec */
-			usleep_range(5000, 6000);
-			reg = rd32(&pf->hw, I40E_PFQF_CTL_1);
-			if (!(reg & I40E_PFQF_CTL_1_CLEARFDTABLE_MASK))
-				break;
-		} while (flush_wait_retry--);
-		if (reg & I40E_PFQF_CTL_1_CLEARFDTABLE_MASK) {
-			dev_warn(&pf->pdev->dev, "FD table did not flush, needs more time\n");
-		} else {
-			/* replay sideband filters */
-			i40e_fdir_filter_restore(pf->vsi[pf->lan_vsi]);
-			if (!disable_atr)
-				pf->flags |= I40E_FLAG_FD_ATR_ENABLED;
-			clear_bit(__I40E_FD_FLUSH_REQUESTED, &pf->state);
-			if (I40E_DEBUG_FD & pf->hw.debug_mask)
-				dev_info(&pf->pdev->dev, "FD Filter table flushed and FD-SB replayed.\n");
-		}
+	if (!(time_after(jiffies, min_flush_time)) &&
+	    (fd_room < I40E_FDIR_BUFFER_HEAD_ROOM_FOR_ATR)) {
+		if (I40E_DEBUG_FD & pf->hw.debug_mask)
+			dev_info(&pf->pdev->dev, "ATR disabled, not enough FD filter space.\n");
+		disable_atr = true;
+	}
+
+	pf->fd_flush_timestamp = jiffies;
+	pf->flags &= ~I40E_FLAG_FD_ATR_ENABLED;
+	/* flush all filters */
+	wr32(&pf->hw, I40E_PFQF_CTL_1,
+	     I40E_PFQF_CTL_1_CLEARFDTABLE_MASK);
+	i40e_flush(&pf->hw);
+	pf->fd_flush_cnt++;
+	pf->fd_add_err = 0;
+	do {
+		/* Check FD flush status every 5-6msec */
+		usleep_range(5000, 6000);
+		reg = rd32(&pf->hw, I40E_PFQF_CTL_1);
+		if (!(reg & I40E_PFQF_CTL_1_CLEARFDTABLE_MASK))
+			break;
+	} while (flush_wait_retry--);
+	if (reg & I40E_PFQF_CTL_1_CLEARFDTABLE_MASK) {
+		dev_warn(&pf->pdev->dev, "FD table did not flush, needs more time\n");
+	} else {
+		/* replay sideband filters */
+		i40e_fdir_filter_restore(pf->vsi[pf->lan_vsi]);
+		if (!disable_atr)
+			pf->flags |= I40E_FLAG_FD_ATR_ENABLED;
+		clear_bit(__I40E_FD_FLUSH_REQUESTED, &pf->state);
+		if (I40E_DEBUG_FD & pf->hw.debug_mask)
+			dev_info(&pf->pdev->dev, "FD Filter table flushed and FD-SB replayed.\n");
 	}
+
 }
 
 /**
Signature · 1 line
1.9.3
#20 lore raw

PATCH 10/15 i40e: refactor code to remove indent

Quoted 13 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Catherine Sullivan
Sent: Friday, August 28, 2015 2:56 PM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S13 10/15] i40e: refactor code to remove indent

From: Jesse Brandeburg <[email protected]>

I found a code indent that was avoidable because a whole function is inside an if block, reverse the if and move the code back a tab.

Quoted 6 lines
Change-ID I9989c8750ee61678fbf96a3b0fd7bf7cc7ef300a
---
 drivers/net/ethernet/intel/i40e/i40e_main.c | 82 +++++++++++++++--------
------
 1 file changed, 42 insertions(+), 40 deletions(-)

Code changes present in tree

#21 lore raw

PATCH 11/15 i40evf: use capabilities flags properly

In reply to Catherine Sullivan

From: Mitch Williams <[email protected]>

Use the capabilities passed to us by the PF driver to control VF driver behavior. In the process, clean up the VLAN add/remove code so it's not a horrible morass of ifdefs.

Change-ID I1050eaf12b658a26fea6813047c9964163c70a73
---
 drivers/net/ethernet/intel/i40evf/i40evf_main.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/i40evf/i40evf_main.c +7 -2
index 53ecc09..4eff523 100644
@@ -730,6 +730,8 @@ static int i40evf_vlan_rx_add_vid(struct net_device *netdev,
 {
 	struct i40evf_adapter *adapter = netdev_priv(netdev);
 
+	if (!VLAN_ALLOWED(adapter))
+		return -EIO;
 	if (i40evf_add_vlan(adapter, vid) == NULL)
 		return -ENOMEM;
 	return 0;
@@ -745,8 +747,11 @@ static int i40evf_vlan_rx_kill_vid(struct net_device *netdev,
 {
 	struct i40evf_adapter *adapter = netdev_priv(netdev);
 
-	i40evf_del_vlan(adapter, vid);
-	return 0;
+	if (VLAN_ALLOWED(adapter)) {
+		i40evf_del_vlan(adapter, vid);
+		return 0;
+	}
+	return -EIO;
 }
 
 /**
Signature · 1 line
1.9.3
#22 lore raw

PATCH 11/15 i40evf: use capabilities flags properly

Quoted 5 lines · On Fri, 28 Aug 2015 17:55:57 -0400 Catherine Sullivan…

From: Mitch Williams <[email protected]>

Use the capabilities passed to us by the PF driver to control VF driver behavior. In the process, clean up the VLAN add/remove code so it's not a horrible morass of ifdefs.

In this case I think the description should read:
Use the capabilities passed to us by the PF driver to control VF driver behavior.

And drop the second sentence as it doesn't make sense.

Quoted 34 lines
Change-ID I1050eaf12b658a26fea6813047c9964163c70a73
---
 drivers/net/ethernet/intel/i40evf/i40evf_main.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/i40evf/i40evf_main.c +7 -2
index 53ecc09..4eff523 100644
@@ -730,6 +730,8 @@ static int i40evf_vlan_rx_add_vid(struct net_device *netdev,
 {
 	struct i40evf_adapter *adapter = netdev_priv(netdev);
 
+	if (!VLAN_ALLOWED(adapter))
+		return -EIO;
 	if (i40evf_add_vlan(adapter, vid) == NULL)
 		return -ENOMEM;
 	return 0;
@@ -745,8 +747,11 @@ static int i40evf_vlan_rx_kill_vid(struct net_device *netdev,
 {
 	struct i40evf_adapter *adapter = netdev_priv(netdev);
 
-	i40evf_del_vlan(adapter, vid);
-	return 0;
+	if (VLAN_ALLOWED(adapter)) {
+		i40evf_del_vlan(adapter, vid);
+		return 0;
+	}
+	return -EIO;
 }
 
 /**
#23 lore raw

PATCH 11/15 i40evf: use capabilities flags properly

In reply to Catherine Sullivan
Quoted 14 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Catherine Sullivan
Sent: Friday, August 28, 2015 2:56 PM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S13 11/15] i40evf: use capabilities flags properly

From: Mitch Williams <[email protected]>

Use the capabilities passed to us by the PF driver to control VF driver behavior. In the process, clean up the VLAN add/remove code so it's not a horrible morass of ifdefs.

Quoted 5 lines
Change-ID I1050eaf12b658a26fea6813047c9964163c70a73
---
 drivers/net/ethernet/intel/i40evf/i40evf_main.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

Code changes present in tree

#24 lore raw

PATCH 12/15 i40e/i40evf: pass QOS handle to VF

In reply to Catherine Sullivan

From: Mitch Williams <[email protected]>

The VF really doesn't care about the QOS handle but it will in the future. Since the VF only uses TC0, send it that handle. On the VF side, save the handle and use it to populate the QOS params when we call into the client interface.

Change-ID I76f41b070baeaa09b19383e9168bc677837e0761
---
 drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 6 ++++--
 drivers/net/ethernet/intel/i40evf/i40evf.h         | 1 +
 drivers/net/ethernet/intel/i40evf/i40evf_main.c    | 1 +
 3 files changed, 6 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +4 -2
index f42c7c1..9065d40 100644
@@ -1210,8 +1210,10 @@ static int i40e_vc_get_vf_resources_msg(struct i40e_vf *vf, u8 *msg)
 	if (vf->lan_vsi_idx) {
 		vfres->vsi_res[i].vsi_id = vf->lan_vsi_id;
 		vfres->vsi_res[i].vsi_type = I40E_VSI_SRIOV;
-		vfres->vsi_res[i].num_queue_pairs =
-		    pf->vsi[vf->lan_vsi_idx]->alloc_queue_pairs;
+		vfres->vsi_res[i].num_queue_pairs = vsi->alloc_queue_pairs;
+		/* VFs only use TC 0 */
+		vfres->vsi_res[i].qset_handle
+					  = le16_to_cpu(vsi->info.qs_handle[0]);
 		ether_addr_copy(vfres->vsi_res[i].default_mac_addr,
 				vf->default_lan_addr.addr);
 		i++;
drivers/net/ethernet/intel/i40evf/i40evf.h +1 -0
index 27dc3fe..e7a223e 100644
@@ -66,6 +66,7 @@ struct i40e_vsi {
 	 */
 	u16 rx_itr_setting;
 	u16 tx_itr_setting;
+	u16 qs_handle;
 };
 
 /* How many Rx Buffers do we bundle into one write to the hardware ? */
drivers/net/ethernet/intel/i40evf/i40evf_main.c +1 -0
index 4eff523..9c19189 100644
@@ -2115,6 +2115,7 @@ int i40evf_process_config(struct i40evf_adapter *adapter)
 	adapter->vsi.tx_itr_setting = (I40E_ITR_DYNAMIC |
 				       ITR_REG_TO_USEC(I40E_ITR_TX_DEF));
 	adapter->vsi.netdev = adapter->netdev;
+	adapter->vsi.qs_handle = adapter->vsi_res->qset_handle;
 	return 0;
 }
 
Signature · 1 line
1.9.3
#25 lore raw

PATCH 12/15 i40e/i40evf: pass QOS handle to VF

Quoted 15 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Catherine Sullivan
Sent: Friday, August 28, 2015 2:56 PM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S13 12/15] i40e/i40evf: pass QOS handle to VF

From: Mitch Williams <[email protected]>

The VF really doesn't care about the QOS handle but it will in the future. Since the VF only uses TC0, send it that handle. On the VF side, save the handle and use it to populate the QOS params when we call into the client interface.

Quoted 7 lines
Change-ID I76f41b070baeaa09b19383e9168bc677837e0761
---
 drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 6 ++++--
 drivers/net/ethernet/intel/i40evf/i40evf.h         | 1 +
 drivers/net/ethernet/intel/i40evf/i40evf_main.c    | 1 +
 3 files changed, 6 insertions(+), 2 deletions(-)

Code changes present in tree

#26 lore raw

PATCH 13/15 i40e: print neato new features

In reply to Catherine Sullivan

From: Jesse Brandeburg <[email protected]>

To help users and developers know what compile options and hardware features are enabled at compile time, print VxLAN is available.

Change-ID I3162f3b7678dc725a597f964217920eb218b480b
---
 drivers/net/ethernet/intel/i40e/i40e_main.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/net/ethernet/intel/i40e/i40e_main.c +3 -0
index 2771259..469e1d5 100644
@@ -9914,6 +9914,9 @@ static void i40e_print_features(struct i40e_pf *pf)
 	}
 	if (pf->flags & I40E_FLAG_DCB_CAPABLE)
 		buf += sprintf(buf, "DCB ");
+#if IS_ENABLED(CONFIG_VXLAN)
+	buf += sprintf(buf, "VxLAN ");
+#endif
 	if (pf->flags & I40E_FLAG_PTP)
 		buf += sprintf(buf, "PTP ");
 #ifdef I40E_FCOE
Signature · 1 line
1.9.3
#27 lore raw

PATCH 13/15 i40e: print neato new features

Quoted 10 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Catherine Sullivan
Sent: Friday, August 28, 2015 2:56 PM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S13 13/15] i40e: print neato new features

From: Jesse Brandeburg <[email protected]>

Quoted 8 lines

To help users and developers know what compile options and hardware features are enabled at compile time, print VxLAN is available.

Change-ID I3162f3b7678dc725a597f964217920eb218b480b
---
 drivers/net/ethernet/intel/i40e/i40e_main.c | 3 +++
 1 file changed, 3 insertions(+)

Code changes present in tree, VxLAN printed at init with VxLAN enabled at compile time

#28 lore raw

PATCH 14/15 i40e: fix ip-ip GRE encapulation

In reply to Catherine Sullivan

From: Jesse Brandeburg <[email protected]>

The i40e driver will soon be capable of offloading GRE traffic but in the meantime, don't let the driver tell the OS that it can offload types of traffic it cannot.

This fixes a bug where if you stack a GRE MAC in IP tunnel over i40e, all TSO packets will be sent with invalid checksums causing really bad throughput.

NOTE: I still see some retransmits that are unexplained when testing with vxlan or ip/mac tunnels (GRE) but the throughput is more like what is expected with multi-gigabit on a single flow.

Change-ID Ie31843b150695b2b1889e306b8c33c1d2da29a9e
---
 drivers/net/ethernet/intel/i40e/i40e_main.c | 36 ++++++++++++++++++++++++++---
 1 file changed, 33 insertions(+), 3 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_main.c +33 -3
index 469e1d5..b686450 100644
@@ -30,6 +30,7 @@
 #if defined(CONFIG_VXLAN) || defined(CONFIG_VXLAN_MODULE)
 #include <net/vxlan.h>
 #endif
+#include <net/gre.h>
 
 const char i40e_driver_name[] = "i40e";
 static const char i40e_driver_string[] =
@@ -8372,12 +8373,41 @@ static netdev_features_t i40e_features_check(struct sk_buff *skb,
 					     struct net_device *dev,
 					     netdev_features_t features)
 {
-	if (skb->encapsulation &&
-	    (skb_inner_mac_header(skb) - skb_transport_header(skb) >
-	     I40E_MAX_TUNNEL_HDR_LEN))
+	u8 protocol = 0;
+	int hlen;
+
+	if (!skb->encapsulation)
+		return features;
+
+	/* prevent tunnel headers that are too long to offload from
+	 * being sent to the hardware
+	 */
+	if (skb_inner_mac_header(skb) - skb_transport_header(skb) >
+	    I40E_MAX_TUNNEL_HDR_LEN)
+		return features & ~(NETIF_F_ALL_CSUM | NETIF_F_GSO_MASK);
+
+	switch (vlan_get_protocol(skb)) {
+	case htons(ETH_P_IP):
+		protocol = ip_hdr(skb)->protocol;
+		break;
+	case htons(ETH_P_IPV6):
+		protocol = ipv6_hdr(skb)->nexthdr;
+		break;
+	}
+
+	hlen = skb_inner_mac_header(skb) - skb_transport_header(skb);
+	if ((protocol == IPPROTO_GRE) &&
+	    (skb->inner_protocol_type != ENCAP_TYPE_ETHER ||
+	     skb->inner_protocol != htons(ETH_P_TEB) ||
+	     hlen < sizeof(struct gre_base_hdr) ||
+	     hlen > (sizeof(struct gre_base_hdr) + 12)))
 		return features & ~(NETIF_F_ALL_CSUM | NETIF_F_GSO_MASK);
 
+#if IS_ENABLED(CONFIG_VXLAN)
+	return vxlan_features_check(skb, features);
+#else
 	return features;
+#endif
 }
 
 static const struct net_device_ops i40e_netdev_ops = {
Signature · 1 line
1.9.3
#29 lore raw

PATCH 14/15 i40e: fix ip-ip GRE encapulation

Quoted 4 lines · Catherine Sullivan
drivers/net/ethernet/intel/i40e/i40e_main.c +0 -0
index 469e1d5..b686450 100644

[...]

drivers/net/ethernet/intel/i40e/i40e_main.c static netdev_features_t i40e_features_check(struct sk_buff *skb, · line 8410

Quoted 5 lines
drivers/net/ethernet/intel/i40e/i40e_main.c +4 -0
+#if IS_ENABLED(CONFIG_VXLAN)
+       return vxlan_features_check(skb, features);
+#else
        return features;
+#endif

I don't think this is right - when VXLAN is compiled in, it will restrict offload capabilities to that of VXLAN. But when there is no VXLAN support, all tunnel types will be allowed. Presumably, there is some underlying hardware capability here for both situations (and maybe even for GRE as well).

A message that is not in the archive (sent off-list or not yet received): E8A77B2FB54C194393A5C2A8E3ED1678266F3BA6@CRSMSX102.amr.corp.intel.com

#31 lore raw

PATCH 14/15 i40e: fix ip-ip GRE encapulation

Quoted 7 lines
Quoted 5 lines

From: Jesse Gross [mailto:jesse at nicira.com]
Sent: Friday, August 28, 2015 4:03 PM
To: Sullivan, Catherine
Cc: intel-wired-lan
Subject: Re: [Intel-wired-lan] [next PATCH S13 14/15] i40e: fix ip-ip

GRE

Quoted 1 line

encapulation

Hi Jesse, thanks for looking at these. Please excuse this late response and possibly mangled headers, I just got back from sabbatical and am looking at old mail...

Quoted 15 lines
Quoted 9 lines
Quoted 5 lines · Catherine Sullivan
drivers/net/ethernet/intel/i40e/i40e_main.c +0 -0
index 469e1d5..b686450 100644

[...]

Quoted 6 lines

drivers/net/ethernet/intel/i40e/i40e_main.c static netdev_features_t i40e_features_check(struct sk_buff *skb, · line 8410

Quoted 4 lines
drivers/net/ethernet/intel/i40e/i40e_main.c +3 -0
+#if IS_ENABLED(CONFIG_VXLAN)
+       return vxlan_features_check(skb, features); #else
        return features;
+#endif

I don't think this is right - when VXLAN is compiled in, it will

Quoted 5 lines

restrict offload

Quoted 1 line

capabilities to that of VXLAN. But when there is no VXLAN support, all

tunnel

Quoted 2 lines

types will be allowed. Presumably, there is some underlying hardware capability here for both situations (and maybe even for GRE as well).

I don't understand where you this restriction. Looking at the code in vxlan_features_check(), it looks to me that the features bits are mangled only if IPPROTO_UDP is set AND the other header parameters don't match VXLAN needs. If there is no encapsulation, or it is something other than IPPROTO_UDP (e.g. IPPROTO_GRE), then there is no change to the features bits.

If you are referring to other tunneling protocols that might call themselves IPROTO_UDP, then I would think there is a problem in the implementation of vxlan_features_check(), not in how we call it. In that case, vxlan_features_check() should be looking at some additional flag to assure VXLAN before verifying the other header parameters.

What am I missing? Are you thinking that our calling code should look for some additional VXLAN flag before calling vxlan_features_check()?

Thanks,
sln

#32 lore raw

PATCH 14/15 i40e: fix ip-ip GRE encapulation

Quoted 18 lines · Shannon
Quoted 18 lines
Quoted 9 lines

From: Jesse Gross [mailto:jesse at nicira.com]

Quoted 5 lines · Catherine Sullivan
drivers/net/ethernet/intel/i40e/i40e_main.c +0 -0
index 469e1d5..b686450 100644

[...]

Quoted 6 lines

drivers/net/ethernet/intel/i40e/i40e_main.c static netdev_features_t i40e_features_check(struct sk_buff *skb, · line 8410

Quoted 4 lines
drivers/net/ethernet/intel/i40e/i40e_main.c +3 -0
+#if IS_ENABLED(CONFIG_VXLAN)
+       return vxlan_features_check(skb, features); #else
        return features;
+#endif

I don't think this is right - when VXLAN is compiled in, it will

restrict offload

Quoted 1 line

capabilities to that of VXLAN. But when there is no VXLAN support, all

tunnel

Quoted 8 lines
Quoted 2 lines
Quoted 2 lines

types will be allowed. Presumably, there is some underlying hardware capability here for both situations (and maybe even for GRE as well).

I don't understand where you this restriction. Looking at the code in vxlan_features_check(), it looks to me that the features bits are mangled only if IPPROTO_UDP is set AND the other header parameters don't match VXLAN needs. If there is no encapsulation, or it is something other than IPPROTO_UDP (e.g. IPPROTO_GRE), then there is no change to the features bits.

If you are referring to other tunneling protocols that might call themselves IPROTO_UDP, then I would think there is a problem in the implementation of vxlan_features_check(), not in how we call it. In that case, vxlan_features_check() should be looking at some additional flag to assure VXLAN before verifying the other header parameters.

What am I missing? Are you thinking that our calling code should look for some additional VXLAN flag before calling vxlan_features_check()?

VXLAN is not the only UDP based encapsulation, so there are other protocols that call themselves that. (I'm not quite sure what you mean by this, it seems to imply that these protocols are somehow spoofing something. They're not - they and VXLAN are all layered under UDP). However, I don't think that's really the issue.

The point that I was trying to make is that there is an underlying hardware capability as far as the types of protocols that are understood, lengths of headers, etc. and the goal of this function is to remove any offload features that can't be supported so the core stack doesn't use them. vxlan_features_check() will do this by chopping down the general NETIF_F_GSO_UDP_TUNNEL feature to only allow headers that look like VXLAN. However, if VXLAN is not compiled in, then with this patch that restriction won't take place and the driver will actually receive packets with more offloads than it otherwise would. These can come from other UDP protocols which can still be enabled even if VXLAN is not. In this case, these protocols will break.

That being said, I also happen to know that the underlying hardware is capable of supporting more than just VXLAN. In particular, it supports Geneve, which is also a UDP based protocol. Using vxlan_features_check() here will remove offload support for at least some types of Geneve packets, so this is a little heavy handed.

To make a long story short, it looks like the actual problem here is that only UDP tunnels are supported (since that is all that is checked in i40e_tx_enable_csum()). In that case, I think you could simply do:

if ((protocol != IPPROTO_UDP))

    return features & ~(NETIF_F_ALL_CSUM | NETIF_F_GSO_MASK);

And that would solve the above concerns as well as catch some additional problematic cases.

#33 lore raw

PATCH 14/15 i40e: fix ip-ip GRE encapulation

Quoted 2 lines

From: Jesse Gross [mailto:jesse at nicira.com]
Sent: Wednesday, September 09, 2015 5:52 PM

[...]

Quoted 40 lines
Quoted 9 lines · Shannon
Quoted 9 lines
Quoted 9 lines

From: Jesse Gross [mailto:jesse at nicira.com]

Quoted 5 lines · Catherine Sullivan
drivers/net/ethernet/intel/i40e/i40e_main.c +0 -0
index 469e1d5..b686450 100644

[...]

Quoted 8 lines
Quoted 8 lines
Quoted 6 lines

drivers/net/ethernet/intel/i40e/i40e_main.c static netdev_features_t i40e_features_check(struct sk_buff *skb, · line 8410

Quoted 4 lines
drivers/net/ethernet/intel/i40e/i40e_main.c +3 -0
+#if IS_ENABLED(CONFIG_VXLAN)
+       return vxlan_features_check(skb, features); #else
        return features;
+#endif

I don't think this is right - when VXLAN is compiled in, it will

restrict offload

Quoted 1 line

capabilities to that of VXLAN. But when there is no VXLAN support,

all

Quoted 2 lines
Quoted 2 lines

tunnel

Quoted 1 line

types will be allowed. Presumably, there is some underlying

hardware

Quoted 1 line
Quoted 1 line
Quoted 1 line

capability here for both situations (and maybe even for GRE as

well).

Quoted 2 lines

I don't understand where you this restriction. Looking at the code in

vxlan_features_check(), it looks to me that the features bits are mangled only if IPPROTO_UDP is set AND the other header parameters don't match VXLAN needs. If there is no encapsulation, or it is something other than IPPROTO_UDP (e.g. IPPROTO_GRE), then there is no change to the features bits.

Quoted 2 lines

If you are referring to other tunneling protocols that might call

themselves IPROTO_UDP, then I would think there is a problem in the implementation of vxlan_features_check(), not in how we call it. In that case, vxlan_features_check() should be looking at some additional flag to assure VXLAN before verifying the other header parameters.

Quoted 1 line
Quoted 8 lines
Quoted 1 line

What am I missing? Are you thinking that our calling code should look

for some additional VXLAN flag before calling vxlan_features_check()?

VXLAN is not the only UDP based encapsulation, so there are other protocols that call themselves that. (I'm not quite sure what you mean by this, it seems to imply that these protocols are somehow spoofing something. They're not - they and VXLAN are all layered under UDP). However, I don't think that's really the issue.

[...]

Okay, so we are on the same page, just different paragraphs...

Quoted 5 lines

That being said, I also happen to know that the underlying hardware is capable of supporting more than just VXLAN. In particular, it supports Geneve, which is also a UDP based protocol. Using vxlan_features_check() here will remove offload support for at least some types of Geneve packets, so this is a little heavy handed.

It becomes an issue if you rely on vxlan_features_check(), as we are currently doing, to filter the IPPROTO_UDP. Yes, there are other UDP encapsulations, we're just not implementing them quite yet... tho' I believe you've already seen the newer Geneve patches that were just posted. This patch is from before that.

Quoted 6 lines

To make a long story short, it looks like the actual problem here is that only UDP tunnels are supported (since that is all that is checked in i40e_tx_enable_csum()). In that case, I think you could simply do:

if ((protocol != IPPROTO_UDP))

    return features & ~(NETIF_F_ALL_CSUM | NETIF_F_GSO_MASK);

The GRE encapsulation uses a different IPPROTO_xxx value, which is what we're dealing with in this particular patch, so we're checking that in our own function, then using the kernel's vxlan check the IPPROTO_UDP encapsulation. Yes, this is heavy handed, and as we expand the tunnels to be supported (E>G> Geneve), we're going to need to discern each encapsulation and check them individually.

I'd like to suggest that we use this patch as is, and continue refining the driver's feature checks as we add support for more encapsulations.

In the future, as these encapsulations become supported by more devices and drivers, and the checks are coded and debugged, we'll want to move these checks into the kernel stack for all to use, along with the vxlan check.

sln

#34 lore raw

PATCH 14/15 i40e: fix ip-ip GRE encapulation

Quoted 56 lines · Shannon
Quoted 2 lines

From: Jesse Gross [mailto:jesse at nicira.com]
Sent: Wednesday, September 09, 2015 5:52 PM

[...]

Quoted 40 lines
Quoted 9 lines · Shannon
Quoted 9 lines
Quoted 9 lines

From: Jesse Gross [mailto:jesse at nicira.com]

Quoted 5 lines · Catherine Sullivan
drivers/net/ethernet/intel/i40e/i40e_main.c +0 -0
index 469e1d5..b686450 100644

[...]

Quoted 8 lines
Quoted 8 lines
Quoted 6 lines

drivers/net/ethernet/intel/i40e/i40e_main.c static netdev_features_t i40e_features_check(struct sk_buff *skb, · line 8410

Quoted 4 lines
drivers/net/ethernet/intel/i40e/i40e_main.c +3 -0
+#if IS_ENABLED(CONFIG_VXLAN)
+       return vxlan_features_check(skb, features); #else
        return features;
+#endif

I don't think this is right - when VXLAN is compiled in, it will

restrict offload

Quoted 1 line

capabilities to that of VXLAN. But when there is no VXLAN support,

all

Quoted 2 lines
Quoted 2 lines

tunnel

Quoted 1 line

types will be allowed. Presumably, there is some underlying

hardware

Quoted 1 line
Quoted 1 line
Quoted 1 line

capability here for both situations (and maybe even for GRE as

well).

Quoted 2 lines

I don't understand where you this restriction. Looking at the code in

vxlan_features_check(), it looks to me that the features bits are mangled only if IPPROTO_UDP is set AND the other header parameters don't match VXLAN needs. If there is no encapsulation, or it is something other than IPPROTO_UDP (e.g. IPPROTO_GRE), then there is no change to the features bits.

Quoted 2 lines

If you are referring to other tunneling protocols that might call

themselves IPROTO_UDP, then I would think there is a problem in the implementation of vxlan_features_check(), not in how we call it. In that case, vxlan_features_check() should be looking at some additional flag to assure VXLAN before verifying the other header parameters.

Quoted 1 line
Quoted 8 lines
Quoted 1 line

What am I missing? Are you thinking that our calling code should look

for some additional VXLAN flag before calling vxlan_features_check()?

VXLAN is not the only UDP based encapsulation, so there are other protocols that call themselves that. (I'm not quite sure what you mean by this, it seems to imply that these protocols are somehow spoofing something. They're not - they and VXLAN are all layered under UDP). However, I don't think that's really the issue.

[...]

Okay, so we are on the same page, just different paragraphs...

Quoted 7 lines
Quoted 5 lines

That being said, I also happen to know that the underlying hardware is capable of supporting more than just VXLAN. In particular, it supports Geneve, which is also a UDP based protocol. Using vxlan_features_check() here will remove offload support for at least some types of Geneve packets, so this is a little heavy handed.

It becomes an issue if you rely on vxlan_features_check(), as we are currently doing, to filter the IPPROTO_UDP. Yes, there are other UDP encapsulations, we're just not implementing them quite yet... tho' I believe you've already seen the newer Geneve patches that were just posted. This patch is from before that.

I understand that but I believe those are only on the receive side and I don't think there is any overlap here.

Quoted 10 lines
Quoted 6 lines

To make a long story short, it looks like the actual problem here is that only UDP tunnels are supported (since that is all that is checked in i40e_tx_enable_csum()). In that case, I think you could simply do:

if ((protocol != IPPROTO_UDP))

    return features & ~(NETIF_F_ALL_CSUM | NETIF_F_GSO_MASK);

The GRE encapsulation uses a different IPPROTO_xxx value, which is what we're dealing with in this particular patch, so we're checking that in our own function, then using the kernel's vxlan check the IPPROTO_UDP encapsulation. Yes, this is heavy handed, and as we expand the tunnels to be supported (E>G> Geneve), we're going to need to discern each encapsulation and check them individually.

I'd like to suggest that we use this patch as is, and continue refining the driver's feature checks as we add support for more encapsulations.

Unfortunately, I don't think that is a good idea as this patch introduces bugs. The stack already implements these other protocols and by not supporting them here that means there are no restrictions on them. For example, it seems that Ethernet over GRE, IPIP, or Geneve when VXLAN is not compiled in will all go out with checksum errors. Even if you don't want to support offloads yet, you can't just send the packets with errors.

Since the actual restriction in the driver is that non-UDP protocols are not offloaded, I believe that the code that I suggested is the only way to avoid dropping packets.

Quoted 1 line

In the future, as these encapsulations become supported by more devices and drivers, and the checks are coded and debugged, we'll want to move these checks into the kernel stack for all to use, along with the vxlan check.

To be honest, there is no way that is going to happen. The goal of the core network stack is to be as generic as possible and the push is going to be to have the drivers be more general rather than the core kernel have more specific protocol knowledge.

#35 lore raw

PATCH 14/15 i40e: fix ip-ip GRE encapulation

Quoted 3 lines

From: Jesse Gross [mailto:jesse at nicira.com]
Sent: Wednesday, September 09, 2015 11:02 PM

Thanks, Jesse, for your perseverance.

Quoted 7 lines
Quoted 2 lines
Quoted 2 lines

To make a long story short, it looks like the actual problem here is that only UDP tunnels are supported (since that is all that is

checked

Quoted 4 lines
Quoted 4 lines

in i40e_tx_enable_csum()). In that case, I think you could simply do:

if ((protocol != IPPROTO_UDP))

    return features & ~(NETIF_F_ALL_CSUM | NETIF_F_GSO_MASK);

Ah, now I see that the GRE support patch for i40e_tx_enable_csum() hasn't been pushed out yet. This explains some of this discussion. Okay - for the moment we're dropping this patch, to be reworked when the other patch gets pushed.

I think you're right about simply dropping the use of vxlan_features_check() as it is too specific for our needs. This will be part of the rework.

sln

#36 lore raw

PATCH 14/15 i40e: fix ip-ip GRE encapulation

Quoted 9 lines · Shannon
Quoted 3 lines

From: Jesse Gross [mailto:jesse at nicira.com]
Sent: Wednesday, September 09, 2015 11:02 PM

Thanks, Jesse, for your perseverance.

Quoted 3 lines
Quoted 2 lines
Quoted 2 lines

To make a long story short, it looks like the actual problem here is that only UDP tunnels are supported (since that is all that is

checked

Quoted 8 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines

in i40e_tx_enable_csum()). In that case, I think you could simply do:

if ((protocol != IPPROTO_UDP))

    return features & ~(NETIF_F_ALL_CSUM | NETIF_F_GSO_MASK);

Ah, now I see that the GRE support patch for i40e_tx_enable_csum() hasn't been pushed out yet. This explains some of this discussion. Okay - for the moment we're dropping this patch, to be reworked when the other patch gets pushed.

I think you're right about simply dropping the use of vxlan_features_check() as it is too specific for our needs. This will be part of the rework.

Thanks a lot for taking a look at it. Not trying to be a pain here - I just want to make sure things work for all protocols/users.

#37 lore raw

PATCH 14/15 i40e: fix ip-ip GRE encapulation

In reply to Catherine Sullivan
Quoted 21 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Catherine Sullivan
Sent: Friday, August 28, 2015 2:56 PM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S13 14/15] i40e: fix ip-ip GRE encapulation

From: Jesse Brandeburg <[email protected]>

The i40e driver will soon be capable of offloading GRE traffic but in the meantime, don't let the driver tell the OS that it can offload types of traffic it cannot.

This fixes a bug where if you stack a GRE MAC in IP tunnel over i40e, all TSO packets will be sent with invalid checksums causing really bad throughput.

NOTE: I still see some retransmits that are unexplained when testing with vxlan or ip/mac tunnels (GRE) but the throughput is more like what is expected with multi-gigabit on a single flow.

Quoted 8 lines
Change-ID Ie31843b150695b2b1889e306b8c33c1d2da29a9e
---
 drivers/net/ethernet/intel/i40e/i40e_main.c | 36
++++++++++++++++++++++++++---
 1 file changed, 33 insertions(+), 3 deletions(-)

Code changes present in tree, patch breaks build of kernel. Builds normally with patch reverted. Error received is "drivers/net/ethernet/intel/i40e/i40e_main.c:8351:2: error: implicit declaration of function 'vxlan_features_check' [-Werror=implicit-function-declaration]"make

#38 lore raw

PATCH 14/15 i40e: fix ip-ip GRE encapulation

Jeff, please drop this patch for now. We will re-work it and send it in a future series.

Thanks,
Catherine

#39 lore raw

PATCH 15/15 i40e/i40evf: Bump i40e to 1.3.2l and i40evf to 1.3.13

In reply to Catherine Sullivan

Bump.

Change-ID If7ce84218361defa209142d1d8c6f69d48c2d7ad
---
 drivers/net/ethernet/intel/i40e/i40e_main.c     | 2 +-
 drivers/net/ethernet/intel/i40evf/i40evf_main.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_main.c +1 -1
index b686450..4e497a7 100644
@@ -40,7 +40,7 @@ static const char i40e_driver_string[] =
 
 #define DRV_VERSION_MAJOR 1
 #define DRV_VERSION_MINOR 3
-#define DRV_VERSION_BUILD 18
+#define DRV_VERSION_BUILD 21
 #define DRV_VERSION __stringify(DRV_VERSION_MAJOR) "." \
 	     __stringify(DRV_VERSION_MINOR) "." \
 	     __stringify(DRV_VERSION_BUILD)    DRV_KERN
drivers/net/ethernet/intel/i40evf/i40evf_main.c +1 -1
index 9c19189..c00e495 100644
@@ -34,7 +34,7 @@ char i40evf_driver_name[] = "i40evf";
 static const char i40evf_driver_string[] =
 	"Intel(R) XL710/X710 Virtual Function Network Driver";
 
-#define DRV_VERSION "1.3.10"
+#define DRV_VERSION "1.3.13"
 const char i40evf_driver_version[] = DRV_VERSION;
 static const char i40evf_copyright[] =
 	"Copyright (c) 2013 - 2015 Intel Corporation.";
Signature · 1 line
1.9.3
#40 lore raw

PATCH 15/15 i40e/i40evf: Bump i40e to 1.3.2l and i40evf to 1.3.13

Quoted 8 lines

-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Catherine Sullivan
Sent: Friday, August 28, 2015 2:56 PM
To: intel-wired-lan at lists.osuosl.org
Subject: [Intel-wired-lan] [next PATCH S13 15/15] i40e/i40evf: Bump i40e to 1.3.2l and i40evf to 1.3.13

Quoted 8 lines

Bump.

Change-ID If7ce84218361defa209142d1d8c6f69d48c2d7ad
---
 drivers/net/ethernet/intel/i40e/i40e_main.c     | 2 +-
 drivers/net/ethernet/intel/i40evf/i40evf_main.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Code changes present in tree, superseded by subsequent version bump to 1.3.25 and 1.3.17