FreeBSD/sys/dev/ixl/ixl_pf_main.c
/**
 * Read and update a 48 bit stat from the hw
 *
 * Since the device stats are not reset at PFReset, they likely will not
 * be zeroed when the driver starts.  We'll save the first values read
 * and use them as offsets to be subtracted from the raw values in order
 * to report stats that count from zero.
 **/
Read and update a 48 bit stat from the hw
Since the device stats are not reset at PFReset, they likely will not
be zeroed when the driver starts.  We'll save the first values read
and use them as offsets to be subtracted from the raw values in order
to report stats that count from zero.
Read and update a 48 bit stat from the hw Since the device stats are not reset at PFReset they likely will not be zeroed when the driver starts . We ' ll save the first values read and use them as offsets to be subtracted from the raw values in order to report stats that count from zero .
void
ixl_stat_update48(struct i40e_hw *hw, u32 hireg, u32 loreg,
	bool offset_loaded, u64 *offset, u64 *stat)
{
	u64 new_data;
#if defined(__FreeBSD__) && (__FreeBSD_version >= 1000000) && defined(__amd64__)
	new_data = rd64(hw, loreg);
#else
	new_data = rd32(hw, loreg);
	new_data |= ((u64)(rd32(hw, hireg) & 0xFFFF)) << 32;
#endif
	if (!offset_loaded)
		*offset = new_data;
	if (new_data >= *offset)
		*stat = new_data - *offset;
	else
		*stat = (new_data + ((u64)1 << 48)) - *offset;
	*stat &= 0xFFFFFFFFFFFFULL;
}
void ixl_stat_update48 ( struct i40e_hw * hw , u32 hireg , u32 loreg , bool offset_loaded , u64 * offset , u64 * stat ) { u64 new_data ; #if defined ( __FreeBSD__ ) && ( __FreeBSD_version >= 1000000 ) && defined ( __amd64__ ) new_data = rd64 ( hw , loreg ) ; #else new_data = rd32 ( hw , loreg ) ; new_data |= ( ( u64 ) ( rd32 ( hw , hireg ) & 0xFFFF ) ) << 32 ; #endif if ( ! offset_loaded ) * offset = new_data ; if ( new_data >= * offset ) * stat = new_data - * offset ; else * stat = ( new_data + ( ( u64 ) 1 << 48 ) ) - * offset ; * stat &= 0xFFFFFFFFFFFFULL ; }
Read and update a 48 bit stat from the hw
 Since the device stats are not reset at PFReset, they likely will not
 be zeroed when the driver starts.
Read and update a 48 bit stat from the hw Since the device stats are not reset at PFReset they likely will not be zeroed when the driver starts .
/*
	 * Use two rd32's instead of one rd64; FreeBSD versions before
	 * 10 don't support 64-bit bus reads/writes.
	 */