net/ice/base: track HW stat registers past rollover
Modify ice_stat_update40 to use rd64 instead of two calls to rd32. Additionally, drop the now unnecessary hireg function parameter. Signed-off-by: Jacob Keller <jacob.e.keller@intel.com> Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com> Signed-off-by: Leyi Rong <leyi.rong@intel.com> Acked-by: Qi Zhang <qi.z.zhang@intel.com>
This commit is contained in:
parent
0c80804082
commit
dc2c385c9b
@ -4004,40 +4004,44 @@ void ice_replay_post(struct ice_hw *hw)
|
||||
/**
|
||||
* ice_stat_update40 - read 40 bit stat from the chip and update stat values
|
||||
* @hw: ptr to the hardware info
|
||||
* @hireg: high 32 bit HW register to read from
|
||||
* @loreg: low 32 bit HW register to read from
|
||||
* @reg: offset of 64 bit HW register to read from
|
||||
* @prev_stat_loaded: bool to specify if previous stats are loaded
|
||||
* @prev_stat: ptr to previous loaded stat value
|
||||
* @cur_stat: ptr to current stat value
|
||||
*/
|
||||
void
|
||||
ice_stat_update40(struct ice_hw *hw, u32 hireg, u32 loreg,
|
||||
bool prev_stat_loaded, u64 *prev_stat, u64 *cur_stat)
|
||||
ice_stat_update40(struct ice_hw *hw, u32 reg, bool prev_stat_loaded,
|
||||
u64 *prev_stat, u64 *cur_stat)
|
||||
{
|
||||
u64 new_data;
|
||||
|
||||
new_data = rd32(hw, loreg);
|
||||
new_data |= ((u64)(rd32(hw, hireg) & 0xFFFF)) << 32;
|
||||
u64 new_data = rd64(hw, reg) & (BIT_ULL(40) - 1);
|
||||
|
||||
/* device stats are not reset at PFR, they likely will not be zeroed
|
||||
* when the driver starts. So 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.
|
||||
* when the driver starts. Thus, save the value from the first read
|
||||
* without adding to the statistic value so that we report stats which
|
||||
* count up from zero.
|
||||
*/
|
||||
if (!prev_stat_loaded)
|
||||
if (!prev_stat_loaded) {
|
||||
*prev_stat = new_data;
|
||||
return;
|
||||
}
|
||||
|
||||
/* Calculate the difference between the new and old values, and then
|
||||
* add it to the software stat value.
|
||||
*/
|
||||
if (new_data >= *prev_stat)
|
||||
*cur_stat = new_data - *prev_stat;
|
||||
*cur_stat += new_data - *prev_stat;
|
||||
else
|
||||
/* to manage the potential roll-over */
|
||||
*cur_stat = (new_data + BIT_ULL(40)) - *prev_stat;
|
||||
*cur_stat &= 0xFFFFFFFFFFULL;
|
||||
*cur_stat += (new_data + BIT_ULL(40)) - *prev_stat;
|
||||
|
||||
/* Update the previously stored value to prepare for next read */
|
||||
*prev_stat = new_data;
|
||||
}
|
||||
|
||||
/**
|
||||
* ice_stat_update32 - read 32 bit stat from the chip and update stat values
|
||||
* @hw: ptr to the hardware info
|
||||
* @reg: HW register to read from
|
||||
* @reg: offset of HW register to read from
|
||||
* @prev_stat_loaded: bool to specify if previous stats are loaded
|
||||
* @prev_stat: ptr to previous loaded stat value
|
||||
* @cur_stat: ptr to current stat value
|
||||
@ -4051,17 +4055,26 @@ ice_stat_update32(struct ice_hw *hw, u32 reg, bool prev_stat_loaded,
|
||||
new_data = rd32(hw, reg);
|
||||
|
||||
/* device stats are not reset at PFR, they likely will not be zeroed
|
||||
* when the driver starts. So 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.
|
||||
* when the driver starts. Thus, save the value from the first read
|
||||
* without adding to the statistic value so that we report stats which
|
||||
* count up from zero.
|
||||
*/
|
||||
if (!prev_stat_loaded)
|
||||
if (!prev_stat_loaded) {
|
||||
*prev_stat = new_data;
|
||||
return;
|
||||
}
|
||||
|
||||
/* Calculate the difference between the new and old values, and then
|
||||
* add it to the software stat value.
|
||||
*/
|
||||
if (new_data >= *prev_stat)
|
||||
*cur_stat = new_data - *prev_stat;
|
||||
*cur_stat += new_data - *prev_stat;
|
||||
else
|
||||
/* to manage the potential roll-over */
|
||||
*cur_stat = (new_data + BIT_ULL(32)) - *prev_stat;
|
||||
*cur_stat += (new_data + BIT_ULL(32)) - *prev_stat;
|
||||
|
||||
/* Update the previously stored value to prepare for next read */
|
||||
*prev_stat = new_data;
|
||||
}
|
||||
|
||||
|
||||
|
@ -6,7 +6,6 @@
|
||||
#define _ICE_COMMON_H_
|
||||
|
||||
#include "ice_type.h"
|
||||
|
||||
#include "ice_flex_pipe.h"
|
||||
#include "ice_switch.h"
|
||||
#include "ice_fdir.h"
|
||||
@ -34,8 +33,7 @@ ice_clean_rq_elem(struct ice_hw *hw, struct ice_ctl_q_info *cq,
|
||||
struct ice_rq_event_info *e, u16 *pending);
|
||||
enum ice_status
|
||||
ice_get_link_status(struct ice_port_info *pi, bool *link_up);
|
||||
enum ice_status
|
||||
ice_update_link_info(struct ice_port_info *pi);
|
||||
enum ice_status ice_update_link_info(struct ice_port_info *pi);
|
||||
enum ice_status
|
||||
ice_acquire_res(struct ice_hw *hw, enum ice_aq_res_ids res,
|
||||
enum ice_aq_res_access_type access, u32 timeout);
|
||||
@ -195,8 +193,8 @@ ice_cfg_tc_node_bw_alloc(struct ice_port_info *pi, u8 tc,
|
||||
enum ice_status ice_cfg_rl_burst_size(struct ice_hw *hw, u32 bytes);
|
||||
void ice_output_fw_log(struct ice_hw *hw, struct ice_aq_desc *desc, void *buf);
|
||||
void
|
||||
ice_stat_update40(struct ice_hw *hw, u32 hireg, u32 loreg,
|
||||
bool prev_stat_loaded, u64 *prev_stat, u64 *cur_stat);
|
||||
ice_stat_update40(struct ice_hw *hw, u32 reg, bool prev_stat_loaded,
|
||||
u64 *prev_stat, u64 *cur_stat);
|
||||
void
|
||||
ice_stat_update32(struct ice_hw *hw, u32 reg, bool prev_stat_loaded,
|
||||
u64 *prev_stat, u64 *cur_stat);
|
||||
|
Loading…
Reference in New Issue
Block a user