src/dpdk/drivers/net/e1000/base/e1000_82575.c
s32 e1000_validate_nvm_checksum_with_offset(struct e1000_hw *hw, u16 offset)
{
	s32 ret_val = E1000_SUCCESS;
	u16 checksum = 0;
	u16 i, nvm_data;

	DEBUGFUNC("e1000_validate_nvm_checksum_with_offset");

	for (i = offset; i < ((NVM_CHECKSUM_REG + offset) + 1); i++) {
		ret_val = hw->nvm.ops.read(hw, i, 1, &nvm_data);
		if (ret_val) {
			DEBUGOUT("NVM Read Error\n");
			goto out;
		}
		checksum += nvm_data;
	}

	if (checksum != (u16) NVM_SUM) {
		DEBUGOUT("NVM Checksum Invalid\n");
		ret_val = -E1000_ERR_NVM;
		goto out;
	}

out:
	return ret_val;
}
/**
 *  e1000_validate_nvm_checksum_with_offset - Validate EEPROM
 *  checksum
 *  @hw: pointer to the HW structure
 *  @offset: offset in words of the checksum protected region
 *
 *  Calculates the EEPROM checksum by reading/adding each word of the EEPROM
 *  and then verifies that the sum of the EEPROM is equal to 0xBABA.
 **/
Validate EEPROM
checksum
@hw: pointer to the HW structure
@offset: offset in words of the checksum protected region

Calculates the EEPROM checksum by reading/adding each word of the EEPROM
and then verifies that the sum of the EEPROM is equal to 0xBABA.
Validate EEPROM checksum @hw : pointer to the HW structure @offset : offset in words of the checksum protected region Calculates the EEPROM checksum by reading / adding each word of the EEPROM and then verifies that the sum of the EEPROM is equal to 0xBABA .
s32 e1000_validate_nvm_checksum_with_offset(struct e1000_hw *hw, u16 offset)
{
	s32 ret_val = E1000_SUCCESS;
	u16 checksum = 0;
	u16 i, nvm_data;
	DEBUGFUNC("e1000_validate_nvm_checksum_with_offset");
	for (i = offset; i < ((NVM_CHECKSUM_REG + offset) + 1); i++) {
		ret_val = hw->nvm.ops.read(hw, i, 1, &nvm_data);
		if (ret_val) {
			DEBUGOUT("NVM Read Error\n");
			goto out;
		}
		checksum += nvm_data;
	}
	if (checksum != (u16) NVM_SUM) {
		DEBUGOUT("NVM Checksum Invalid\n");
		ret_val = -E1000_ERR_NVM;
		goto out;
	}
out:
	return ret_val;
}
s32 e1000_validate_nvm_checksum_with_offset ( struct e1000_hw * hw , u16 offset ) { s32 ret_val = E1000_SUCCESS ; u16 checksum = 0 ; u16 i , nvm_data ; DEBUGFUNC ( " " ) ; for ( i = offset ; i < ( ( NVM_CHECKSUM_REG + offset ) + 1 ) ; i ++ ) { ret_val = hw -> nvm . ops . read ( hw , i , 1 , & nvm_data ) ; if ( ret_val ) { DEBUGOUT ( " \n " ) ; goto out ; } checksum += nvm_data ; } if ( checksum != ( u16 ) NVM_SUM ) { DEBUGOUT ( " \n " ) ; ret_val = - E1000_ERR_NVM ; goto out ; } out : return ret_val ; }
e1000_validate_nvm_checksum_with_offset - Validate EEPROM
  checksum
  @hw: pointer to the HW structure
  @offset: offset in words of the checksum protected region
e1000_validate_nvm_checksum_with_offset - Validate EEPROM checksum @hw : pointer to the HW structure @offset : offset in words of the checksum protected region