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
|
* ice_stat_update40 - read 40 bit stat from the chip and update stat values
|
||||||
* @hw: ptr to the hardware info
|
* @hw: ptr to the hardware info
|
||||||
* @hireg: high 32 bit HW register to read from
|
* @reg: offset of 64 bit HW register to read from
|
||||||
* @loreg: low 32 bit HW register to read from
|
|
||||||
* @prev_stat_loaded: bool to specify if previous stats are loaded
|
* @prev_stat_loaded: bool to specify if previous stats are loaded
|
||||||
* @prev_stat: ptr to previous loaded stat value
|
* @prev_stat: ptr to previous loaded stat value
|
||||||
* @cur_stat: ptr to current stat value
|
* @cur_stat: ptr to current stat value
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
ice_stat_update40(struct ice_hw *hw, u32 hireg, u32 loreg,
|
ice_stat_update40(struct ice_hw *hw, u32 reg, bool prev_stat_loaded,
|
||||||
bool prev_stat_loaded, u64 *prev_stat, u64 *cur_stat)
|
u64 *prev_stat, u64 *cur_stat)
|
||||||
{
|
{
|
||||||
u64 new_data;
|
u64 new_data = rd64(hw, reg) & (BIT_ULL(40) - 1);
|
||||||
|
|
||||||
new_data = rd32(hw, loreg);
|
|
||||||
new_data |= ((u64)(rd32(hw, hireg) & 0xFFFF)) << 32;
|
|
||||||
|
|
||||||
/* device stats are not reset at PFR, they likely will not be zeroed
|
/* 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
|
* when the driver starts. Thus, save the value from the first read
|
||||||
* offsets to be subtracted from the raw values in order to report stats
|
* without adding to the statistic value so that we report stats which
|
||||||
* that count from zero.
|
* count up from zero.
|
||||||
*/
|
*/
|
||||||
if (!prev_stat_loaded)
|
if (!prev_stat_loaded) {
|
||||||
*prev_stat = new_data;
|
*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)
|
if (new_data >= *prev_stat)
|
||||||
*cur_stat = new_data - *prev_stat;
|
*cur_stat += new_data - *prev_stat;
|
||||||
else
|
else
|
||||||
/* to manage the potential roll-over */
|
/* to manage the potential roll-over */
|
||||||
*cur_stat = (new_data + BIT_ULL(40)) - *prev_stat;
|
*cur_stat += (new_data + BIT_ULL(40)) - *prev_stat;
|
||||||
*cur_stat &= 0xFFFFFFFFFFULL;
|
|
||||||
|
/* 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
|
* ice_stat_update32 - read 32 bit stat from the chip and update stat values
|
||||||
* @hw: ptr to the hardware info
|
* @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_loaded: bool to specify if previous stats are loaded
|
||||||
* @prev_stat: ptr to previous loaded stat value
|
* @prev_stat: ptr to previous loaded stat value
|
||||||
* @cur_stat: ptr to current 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);
|
new_data = rd32(hw, reg);
|
||||||
|
|
||||||
/* device stats are not reset at PFR, they likely will not be zeroed
|
/* 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
|
* when the driver starts. Thus, save the value from the first read
|
||||||
* offsets to be subtracted from the raw values in order to report stats
|
* without adding to the statistic value so that we report stats which
|
||||||
* that count from zero.
|
* count up from zero.
|
||||||
*/
|
*/
|
||||||
if (!prev_stat_loaded)
|
if (!prev_stat_loaded) {
|
||||||
*prev_stat = new_data;
|
*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)
|
if (new_data >= *prev_stat)
|
||||||
*cur_stat = new_data - *prev_stat;
|
*cur_stat += new_data - *prev_stat;
|
||||||
else
|
else
|
||||||
/* to manage the potential roll-over */
|
/* 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_
|
#define _ICE_COMMON_H_
|
||||||
|
|
||||||
#include "ice_type.h"
|
#include "ice_type.h"
|
||||||
|
|
||||||
#include "ice_flex_pipe.h"
|
#include "ice_flex_pipe.h"
|
||||||
#include "ice_switch.h"
|
#include "ice_switch.h"
|
||||||
#include "ice_fdir.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);
|
struct ice_rq_event_info *e, u16 *pending);
|
||||||
enum ice_status
|
enum ice_status
|
||||||
ice_get_link_status(struct ice_port_info *pi, bool *link_up);
|
ice_get_link_status(struct ice_port_info *pi, bool *link_up);
|
||||||
enum ice_status
|
enum ice_status ice_update_link_info(struct ice_port_info *pi);
|
||||||
ice_update_link_info(struct ice_port_info *pi);
|
|
||||||
enum ice_status
|
enum ice_status
|
||||||
ice_acquire_res(struct ice_hw *hw, enum ice_aq_res_ids res,
|
ice_acquire_res(struct ice_hw *hw, enum ice_aq_res_ids res,
|
||||||
enum ice_aq_res_access_type access, u32 timeout);
|
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);
|
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_output_fw_log(struct ice_hw *hw, struct ice_aq_desc *desc, void *buf);
|
||||||
void
|
void
|
||||||
ice_stat_update40(struct ice_hw *hw, u32 hireg, u32 loreg,
|
ice_stat_update40(struct ice_hw *hw, u32 reg, bool prev_stat_loaded,
|
||||||
bool prev_stat_loaded, u64 *prev_stat, u64 *cur_stat);
|
u64 *prev_stat, u64 *cur_stat);
|
||||||
void
|
void
|
||||||
ice_stat_update32(struct ice_hw *hw, u32 reg, bool prev_stat_loaded,
|
ice_stat_update32(struct ice_hw *hw, u32 reg, bool prev_stat_loaded,
|
||||||
u64 *prev_stat, u64 *cur_stat);
|
u64 *prev_stat, u64 *cur_stat);
|
||||||
|
Loading…
Reference in New Issue
Block a user