Skip to content

Commit

Permalink
i40e: little endian only valid checksums
Browse files Browse the repository at this point in the history
The calculation of the checksum can fail.
So move converting the checksum to little endian
to inside the return status check.

Signed-off-by: Tom Rix <trix@redhat.com>
Tested-by: Gurucharan G <gurucharanx.g@intel.com> (A Contingent worker at Intel)
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
  • Loading branch information
Tom Rix authored and Tony Nguyen committed Mar 17, 2022
1 parent 1abea24 commit ad739d0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drivers/net/ethernet/intel/i40e/i40e_nvm.c
Original file line number Diff line number Diff line change
Expand Up @@ -682,10 +682,11 @@ i40e_status i40e_update_nvm_checksum(struct i40e_hw *hw)
__le16 le_sum;

ret_code = i40e_calc_nvm_checksum(hw, &checksum);
le_sum = cpu_to_le16(checksum);
if (!ret_code)
if (!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);
}

return ret_code;
}
Expand Down

0 comments on commit ad739d0

Please sign in to comment.