src/dpdk/drivers/net/ixgbe/base/ixgbe_x540.c
s32 ixgbe_validate_eeprom_checksum_X540(struct ixgbe_hw *hw,
					u16 *checksum_val)
{
	s32 status;
	u16 checksum;
	u16 read_checksum = 0;

	DEBUGFUNC("ixgbe_validate_eeprom_checksum_X540");

	/* 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
	 */
	status = hw->eeprom.ops.read(hw, 0, &checksum);
	if (status) {
		DEBUGOUT("EEPROM read failed\n");
		return status;
	}

	if (hw->mac.ops.acquire_swfw_sync(hw, IXGBE_GSSR_EEP_SM))
		return IXGBE_ERR_SWFW_SYNC;

	status = hw->eeprom.ops.calc_checksum(hw);
	if (status < 0)
		goto out;

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

	/* Do not use hw->eeprom.ops.read because we do not want to take
	 * the synchronization semaphores twice here.
	 */
	status = ixgbe_read_eerd_generic(hw, IXGBE_EEPROM_CHECKSUM,
					 &read_checksum);
	if (status)
		goto out;

	/* Verify read checksum from EEPROM is the same as
	 * calculated checksum
	 */
	if (read_checksum != checksum) {
		ERROR_REPORT1(IXGBE_ERROR_INVALID_STATE,
			     "Invalid EEPROM checksum");
		status = IXGBE_ERR_EEPROM_CHECKSUM;
	}

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

out:
	hw->mac.ops.release_swfw_sync(hw, IXGBE_GSSR_EEP_SM);

	return status;
}
/**
 * ixgbe_validate_eeprom_checksum_X540 - 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 ixgbe_validate_eeprom_checksum_X540(struct ixgbe_hw *hw,
					u16 *checksum_val)
{
	s32 status;
	u16 checksum;
	u16 read_checksum = 0;
	DEBUGFUNC("ixgbe_validate_eeprom_checksum_X540");
	status = hw->eeprom.ops.read(hw, 0, &checksum);
	if (status) {
		DEBUGOUT("EEPROM read failed\n");
		return status;
	}
	if (hw->mac.ops.acquire_swfw_sync(hw, IXGBE_GSSR_EEP_SM))
		return IXGBE_ERR_SWFW_SYNC;
	status = hw->eeprom.ops.calc_checksum(hw);
	if (status < 0)
		goto out;
	checksum = (u16)(status & 0xffff);
	status = ixgbe_read_eerd_generic(hw, IXGBE_EEPROM_CHECKSUM,
					 &read_checksum);
	if (status)
		goto out;
	if (read_checksum != checksum) {
		ERROR_REPORT1(IXGBE_ERROR_INVALID_STATE,
			     "Invalid EEPROM checksum");
		status = IXGBE_ERR_EEPROM_CHECKSUM;
	}
	if (checksum_val)
		*checksum_val = checksum;
out:
	hw->mac.ops.release_swfw_sync(hw, IXGBE_GSSR_EEP_SM);
	return status;
}
s32 ixgbe_validate_eeprom_checksum_X540 ( struct ixgbe_hw * hw , u16 * checksum_val ) { s32 status ; u16 checksum ; u16 read_checksum = 0 ; DEBUGFUNC ( " " ) ; status = hw -> eeprom . ops . read ( hw , 0 , & checksum ) ; if ( status ) { DEBUGOUT ( " \n " ) ; return status ; } if ( hw -> mac . ops . acquire_swfw_sync ( hw , IXGBE_GSSR_EEP_SM ) ) return IXGBE_ERR_SWFW_SYNC ; status = hw -> eeprom . ops . calc_checksum ( hw ) ; if ( status < 0 ) goto out ; checksum = ( u16 ) ( status & 0xffff ) ; status = ixgbe_read_eerd_generic ( hw , IXGBE_EEPROM_CHECKSUM , & read_checksum ) ; if ( status ) goto out ; if ( read_checksum != checksum ) { ERROR_REPORT1 ( IXGBE_ERROR_INVALID_STATE , " " ) ; status = IXGBE_ERR_EEPROM_CHECKSUM ; } if ( checksum_val ) * checksum_val = checksum ; out : hw -> mac . ops . release_swfw_sync ( hw , IXGBE_GSSR_EEP_SM ) ; return status ; }
ixgbe_validate_eeprom_checksum_X540 - Validate EEPROM checksum
 @hw: pointer to hardware structure
 @checksum_val: calculated checksum
ixgbe_validate_eeprom_checksum_X540 - 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
	 */ /* Do not use hw->eeprom.ops.read because we do not want to take
	 * the synchronization semaphores twice here.
	 */ /* Verify read checksum from EEPROM is the same as
	 * calculated checksum
	 */ /* If the user cares, return the calculated checksum */