src/dpdk/drivers/net/txgbe/base/txgbe_eeprom.c
s32 txgbe_validate_eeprom_checksum(struct txgbe_hw *hw,
					   u16 *checksum_val)
{
	u16 checksum;
	u16 read_checksum = 0;
	int err;

	DEBUGFUNC("txgbe_validate_eeprom_checksum");

	/* Read the first word from the EEPROM. If this times out or fails, do
	 * not continue or we could be in for a very long wait while every
	 * EEPROM read fails
	 */
	err = hw->rom.read16(hw, 0, &checksum);
	if (err) {
		DEBUGOUT("EEPROM read failed\n");
		return err;
	}

	err = hw->rom.calc_checksum(hw);
	if (err < 0)
		return err;

	checksum = (u16)(err & 0xffff);

	err = hw->rom.readw_sw(hw, TXGBE_EEPROM_CHECKSUM, &read_checksum);
	if (err) {
		DEBUGOUT("EEPROM read failed\n");
		return err;
	}

	/* Verify read checksum from EEPROM is the same as
	 * calculated checksum
	 */
	if (read_checksum != checksum) {
		err = TXGBE_ERR_EEPROM_CHECKSUM;
		DEBUGOUT("EEPROM checksum error\n");
	}

	/* If the user cares, return the calculated checksum */
	if (checksum_val)
		*checksum_val = checksum;

	return err;
}
/**
 *  txgbe_validate_eeprom_checksum - Validate EEPROM checksum
 *  @hw: pointer to hardware structure
 *  @checksum_val: calculated checksum
 *
 *  Performs checksum calculation and validates the EEPROM checksum.  If the
 *  caller does not need checksum_val, the value can be NULL.
 **/
Validate EEPROM checksum
@hw: pointer to hardware structure
@checksum_val: calculated checksum

Performs checksum calculation and validates the EEPROM checksum.  If the
caller does not need checksum_val, the value can be NULL.
Validate EEPROM checksum @hw : pointer to hardware structure @checksum_val : calculated checksum Performs checksum calculation and validates the EEPROM checksum . If the caller does not need checksum_val the value can be NULL .
s32 txgbe_validate_eeprom_checksum(struct txgbe_hw *hw,
					   u16 *checksum_val)
{
	u16 checksum;
	u16 read_checksum = 0;
	int err;
	DEBUGFUNC("txgbe_validate_eeprom_checksum");
	err = hw->rom.read16(hw, 0, &checksum);
	if (err) {
		DEBUGOUT("EEPROM read failed\n");
		return err;
	}
	err = hw->rom.calc_checksum(hw);
	if (err < 0)
		return err;
	checksum = (u16)(err & 0xffff);
	err = hw->rom.readw_sw(hw, TXGBE_EEPROM_CHECKSUM, &read_checksum);
	if (err) {
		DEBUGOUT("EEPROM read failed\n");
		return err;
	}
	if (read_checksum != checksum) {
		err = TXGBE_ERR_EEPROM_CHECKSUM;
		DEBUGOUT("EEPROM checksum error\n");
	}
	if (checksum_val)
		*checksum_val = checksum;
	return err;
}
s32 txgbe_validate_eeprom_checksum ( struct txgbe_hw * hw , u16 * checksum_val ) { u16 checksum ; u16 read_checksum = 0 ; int err ; DEBUGFUNC ( " " ) ; err = hw -> rom . read16 ( hw , 0 , & checksum ) ; if ( err ) { DEBUGOUT ( " \n " ) ; return err ; } err = hw -> rom . calc_checksum ( hw ) ; if ( err < 0 ) return err ; checksum = ( u16 ) ( err & 0xffff ) ; err = hw -> rom . readw_sw ( hw , TXGBE_EEPROM_CHECKSUM , & read_checksum ) ; if ( err ) { DEBUGOUT ( " \n " ) ; return err ; } if ( read_checksum != checksum ) { err = TXGBE_ERR_EEPROM_CHECKSUM ; DEBUGOUT ( " \n " ) ; } if ( checksum_val ) * checksum_val = checksum ; return err ; }
txgbe_validate_eeprom_checksum - Validate EEPROM checksum
  @hw: pointer to hardware structure
  @checksum_val: calculated checksum
txgbe_validate_eeprom_checksum - Validate EEPROM checksum @hw : pointer to hardware structure @checksum_val : calculated checksum
/* Read the first word from the EEPROM. If this times out or fails, do
	 * not continue or we could be in for a very long wait while every
	 * EEPROM read fails
	 */ /* Verify read checksum from EEPROM is the same as
	 * calculated checksum
	 */ /* If the user cares, return the calculated checksum */