netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
To: davem@davemloft.net
Cc: Maciej Paczkowski <maciej.paczkowski@intel.com>,
	netdev@vger.kernel.org, nhorman@redhat.com, sassmann@redhat.com,
	Andrew Bowers <andrewx.bowers@intel.com>,
	Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Subject: [net-next v2 04/11] i40e: ShadowRAM checksum calculation change
Date: Fri,  3 May 2019 16:09:32 -0700	[thread overview]
Message-ID: <20190503230939.6739-5-jeffrey.t.kirsher@intel.com> (raw)
In-Reply-To: <20190503230939.6739-1-jeffrey.t.kirsher@intel.com>

From: Maciej Paczkowski <maciej.paczkowski@intel.com>

Due to changes in FW the SW is required to perform double SR dump in
some cases.

Implementation adds two new steps to update nvm checksum function:
* recalculate checksum and check if checksum in NVM is correct
* if checksum in NVM is not correct then update it again

Signed-off-by: Maciej Paczkowski <maciej.paczkowski@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 | 29 +++++++++++++++++++---
 1 file changed, 25 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/intel/i40e/i40e_nvm.c b/drivers/net/ethernet/intel/i40e/i40e_nvm.c
index 0299e5bbb902..ee89779a9a6f 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_nvm.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_nvm.c
@@ -574,13 +574,34 @@ static i40e_status i40e_calc_nvm_checksum(struct i40e_hw *hw,
 i40e_status i40e_update_nvm_checksum(struct i40e_hw *hw)
 {
 	i40e_status ret_code;
-	u16 checksum;
+	u16 checksum, checksum_sr;
 	__le16 le_sum;
 
 	ret_code = i40e_calc_nvm_checksum(hw, &checksum);
-	if (!ret_code) {
-		le_sum = cpu_to_le16(checksum);
-		ret_code = i40e_write_nvm_aq(hw, 0x00, I40E_SR_SW_CHECKSUM_WORD,
+	if (ret_code)
+		return ret_code;
+
+	le_sum = cpu_to_le16(checksum);
+	ret_code = i40e_write_nvm_aq(hw, 0x00, I40E_SR_SW_CHECKSUM_WORD,
+				     1, &le_sum, true);
+	if (ret_code)
+		return ret_code;
+
+	/* Due to changes in FW the SW is required to perform double SR-dump
+	 * in some cases. SR-dump is the process when internal shadow RAM is
+	 * dumped into flash bank. It is triggered by setting "last_command"
+	 * argument in i40e_write_nvm_aq function call.
+	 * Since FW 1.8 we need to calculate SR checksum again and update it
+	 * in flash if it is not equal to previously computed checksum.
+	 * This situation would occur only in FW >= 1.8
+	 */
+	ret_code = i40e_calc_nvm_checksum(hw, &checksum_sr);
+	if (ret_code)
+		return ret_code;
+	if (checksum_sr != checksum) {
+		le_sum = cpu_to_le16(checksum_sr);
+		ret_code = i40e_write_nvm_aq(hw, 0x00,
+					     I40E_SR_SW_CHECKSUM_WORD,
 					     1, &le_sum, true);
 	}
 
-- 
2.20.1


  parent reply	other threads:[~2019-05-03 23:09 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-03 23:09 [net-next v2 00/11][pull request] 40GbE Intel Wired LAN Driver Updates 2019-05-03 Jeff Kirsher
2019-05-03 23:09 ` [net-next v2 01/11] i40e: Fix for allowing too many MDD events on VF Jeff Kirsher
2019-05-03 23:09 ` [net-next v2 02/11] i40e: change behavior on PF in response to MDD event Jeff Kirsher
2019-05-03 23:09 ` [net-next v2 03/11] i40e: remove error msg when vf with port vlan tries to remove vlan 0 Jeff Kirsher
2019-05-03 23:09 ` Jeff Kirsher [this message]
2019-05-03 23:09 ` [net-next v2 05/11] i40e: Report advertised link modes on 40GBase_LR4, CR4 and fibre Jeff Kirsher
2019-05-03 23:09 ` [net-next v2 06/11] i40e: Further implementation of LLDP Jeff Kirsher
2019-05-03 23:09 ` [net-next v2 07/11] i40e: remove out-of-range comparisons in i40e_validate_cloud_filter Jeff Kirsher
2019-05-03 23:09 ` [net-next v2 08/11] i40e: update version number Jeff Kirsher
2019-05-03 23:09 ` [net-next v2 09/11] i40e: fix misleading message about promisc setting on un-trusted VF Jeff Kirsher
2019-05-03 23:09 ` [net-next v2 10/11] i40e: print PCI vendor and device ID during probe Jeff Kirsher
2019-05-03 23:09 ` [net-next v2 11/11] i40e: Introduce recovery mode support Jeff Kirsher
2019-05-04 11:35   ` Jakub Kicinski
2019-05-05  1:23     ` Jeff Kirsher
2019-05-07 18:51     ` Michael, Alice
2019-05-07 21:22       ` Jakub Kicinski
2019-05-04  3:32 ` [net-next v2 00/11][pull request] 40GbE Intel Wired LAN Driver Updates 2019-05-03 David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190503230939.6739-5-jeffrey.t.kirsher@intel.com \
    --to=jeffrey.t.kirsher@intel.com \
    --cc=andrewx.bowers@intel.com \
    --cc=davem@davemloft.net \
    --cc=maciej.paczkowski@intel.com \
    --cc=netdev@vger.kernel.org \
    --cc=nhorman@redhat.com \
    --cc=sassmann@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).