FreeBSD/sys/dev/nxge/xgehal/xgehal-stats.c
/*
 * __hal_stats_pcim_update_latest - Update hw ER stats counters, based on the
 * real hardware maintained counters and the stored "reset" values.
 */
Update hw ER stats counters, based on the
real hardware maintained counters and the stored "reset" values.
Update hw ER stats counters based on the real hardware maintained counters and the stored " reset " values .
static void
__hal_stats_pcim_update_latest(xge_hal_device_h devh)
{
	xge_hal_device_t *hldev = (xge_hal_device_t *)devh;
	int i;
#define set_latest_stat_link_cnt(_link, _p)                   \
	    hldev->stats.pcim_info_latest->link_info[_link]._p =              \
	((hldev->stats.pcim_info->link_info[_link]._p >=                  \
	    hldev->stats.pcim_info_saved->link_info[_link]._p) ?          \
	    hldev->stats.pcim_info->link_info[_link]._p -             \
	        hldev->stats.pcim_info_saved->link_info[_link]._p :   \
	    ((-1) - hldev->stats.pcim_info_saved->link_info[_link]._p) +  \
	        hldev->stats.pcim_info->link_info[_link]._p)
#define set_latest_stat_aggr_cnt(_aggr, _p)                   \
	    hldev->stats.pcim_info_latest->aggr_info[_aggr]._p =              \
	((hldev->stats.pcim_info->aggr_info[_aggr]._p >=              \
	    hldev->stats.pcim_info_saved->aggr_info[_aggr]._p) ?          \
	    hldev->stats.pcim_info->aggr_info[_aggr]._p -             \
	        hldev->stats.pcim_info_saved->aggr_info[_aggr]._p :   \
	    ((-1) - hldev->stats.pcim_info_saved->aggr_info[_aggr]._p) +  \
	        hldev->stats.pcim_info->aggr_info[_aggr]._p)
	for (i = 0; i < XGE_HAL_MAC_LINKS; i++) {
	    set_latest_stat_link_cnt(i, tx_frms);
	    set_latest_stat_link_cnt(i, tx_ttl_eth_octets);
	    set_latest_stat_link_cnt(i, tx_data_octets);
	    set_latest_stat_link_cnt(i, tx_mcst_frms);
	    set_latest_stat_link_cnt(i, tx_bcst_frms);
	    set_latest_stat_link_cnt(i, tx_ucst_frms);
	    set_latest_stat_link_cnt(i, tx_tagged_frms);
	    set_latest_stat_link_cnt(i, tx_vld_ip);
	    set_latest_stat_link_cnt(i, tx_vld_ip_octets);
	    set_latest_stat_link_cnt(i, tx_icmp);
	    set_latest_stat_link_cnt(i, tx_tcp);
	    set_latest_stat_link_cnt(i, tx_rst_tcp);
	    set_latest_stat_link_cnt(i, tx_udp);
	    set_latest_stat_link_cnt(i, tx_unknown_protocol);
	    set_latest_stat_link_cnt(i, tx_parse_error);
	    set_latest_stat_link_cnt(i, tx_pause_ctrl_frms);
	    set_latest_stat_link_cnt(i, tx_lacpdu_frms);
	    set_latest_stat_link_cnt(i, tx_marker_pdu_frms);
	    set_latest_stat_link_cnt(i, tx_marker_resp_pdu_frms);
	    set_latest_stat_link_cnt(i, tx_drop_ip);
	    set_latest_stat_link_cnt(i, tx_xgmii_char1_match);
	    set_latest_stat_link_cnt(i, tx_xgmii_char2_match);
	    set_latest_stat_link_cnt(i, tx_xgmii_column1_match);
	    set_latest_stat_link_cnt(i, tx_xgmii_column2_match);
	    set_latest_stat_link_cnt(i, tx_drop_frms);
	    set_latest_stat_link_cnt(i, tx_any_err_frms);
	    set_latest_stat_link_cnt(i, rx_ttl_frms);
	    set_latest_stat_link_cnt(i, rx_vld_frms);
	    set_latest_stat_link_cnt(i, rx_offld_frms);
	    set_latest_stat_link_cnt(i, rx_ttl_eth_octets);
	    set_latest_stat_link_cnt(i, rx_data_octets);
	    set_latest_stat_link_cnt(i, rx_offld_octets);
	    set_latest_stat_link_cnt(i, rx_vld_mcst_frms);
	    set_latest_stat_link_cnt(i, rx_vld_bcst_frms);
	    set_latest_stat_link_cnt(i, rx_accepted_ucst_frms);
	    set_latest_stat_link_cnt(i, rx_accepted_nucst_frms);
	    set_latest_stat_link_cnt(i, rx_tagged_frms);
	    set_latest_stat_link_cnt(i, rx_long_frms);
	    set_latest_stat_link_cnt(i, rx_usized_frms);
	    set_latest_stat_link_cnt(i, rx_osized_frms);
	    set_latest_stat_link_cnt(i, rx_frag_frms);
	    set_latest_stat_link_cnt(i, rx_jabber_frms);
	    set_latest_stat_link_cnt(i, rx_ttl_64_frms);
	    set_latest_stat_link_cnt(i, rx_ttl_65_127_frms);
	    set_latest_stat_link_cnt(i, rx_ttl_128_255_frms);
	    set_latest_stat_link_cnt(i, rx_ttl_256_511_frms);
	    set_latest_stat_link_cnt(i, rx_ttl_512_1023_frms);
	    set_latest_stat_link_cnt(i, rx_ttl_1024_1518_frms);
	    set_latest_stat_link_cnt(i, rx_ttl_1519_4095_frms);
	    set_latest_stat_link_cnt(i, rx_ttl_40956_8191_frms);
	    set_latest_stat_link_cnt(i, rx_ttl_8192_max_frms);
	    set_latest_stat_link_cnt(i, rx_ttl_gt_max_frms);
	    set_latest_stat_link_cnt(i, rx_ip);
	    set_latest_stat_link_cnt(i, rx_ip_octets);
	    set_latest_stat_link_cnt(i, rx_hdr_err_ip);
	    set_latest_stat_link_cnt(i, rx_icmp);
	    set_latest_stat_link_cnt(i, rx_tcp);
	    set_latest_stat_link_cnt(i, rx_udp);
	    set_latest_stat_link_cnt(i, rx_err_tcp);
	    set_latest_stat_link_cnt(i, rx_pause_cnt);
	    set_latest_stat_link_cnt(i, rx_pause_ctrl_frms);
	    set_latest_stat_link_cnt(i, rx_unsup_ctrl_frms);
	    set_latest_stat_link_cnt(i, rx_in_rng_len_err_frms);
	    set_latest_stat_link_cnt(i, rx_out_rng_len_err_frms);
	    set_latest_stat_link_cnt(i, rx_drop_frms);
	    set_latest_stat_link_cnt(i, rx_discarded_frms);
	    set_latest_stat_link_cnt(i, rx_drop_ip);
	    set_latest_stat_link_cnt(i, rx_err_drp_udp);
	    set_latest_stat_link_cnt(i, rx_lacpdu_frms);
	    set_latest_stat_link_cnt(i, rx_marker_pdu_frms);
	    set_latest_stat_link_cnt(i, rx_marker_resp_pdu_frms);
	    set_latest_stat_link_cnt(i, rx_unknown_pdu_frms);
	    set_latest_stat_link_cnt(i, rx_illegal_pdu_frms);
	    set_latest_stat_link_cnt(i, rx_fcs_discard);
	    set_latest_stat_link_cnt(i, rx_len_discard);
	    set_latest_stat_link_cnt(i, rx_pf_discard);
	    set_latest_stat_link_cnt(i, rx_trash_discard);
	    set_latest_stat_link_cnt(i, rx_rts_discard);
	    set_latest_stat_link_cnt(i, rx_wol_discard);
	    set_latest_stat_link_cnt(i, rx_red_discard);
	    set_latest_stat_link_cnt(i, rx_ingm_full_discard);
	    set_latest_stat_link_cnt(i, rx_xgmii_data_err_cnt);
	    set_latest_stat_link_cnt(i, rx_xgmii_ctrl_err_cnt);
	    set_latest_stat_link_cnt(i, rx_xgmii_err_sym);
	    set_latest_stat_link_cnt(i, rx_xgmii_char1_match);
	    set_latest_stat_link_cnt(i, rx_xgmii_char2_match);
	    set_latest_stat_link_cnt(i, rx_xgmii_column1_match);
	    set_latest_stat_link_cnt(i, rx_xgmii_column2_match);
	    set_latest_stat_link_cnt(i, rx_local_fault);
	    set_latest_stat_link_cnt(i, rx_remote_fault);
	    set_latest_stat_link_cnt(i, rx_queue_full);
	}
	for (i = 0; i < XGE_HAL_MAC_AGGREGATORS; i++) {
	    set_latest_stat_aggr_cnt(i, tx_frms);
	    set_latest_stat_aggr_cnt(i, tx_mcst_frms);
	    set_latest_stat_aggr_cnt(i, tx_bcst_frms);
	    set_latest_stat_aggr_cnt(i, tx_discarded_frms);
	    set_latest_stat_aggr_cnt(i, tx_errored_frms);
	    set_latest_stat_aggr_cnt(i, rx_frms);
	    set_latest_stat_aggr_cnt(i, rx_data_octets);
	    set_latest_stat_aggr_cnt(i, rx_mcst_frms);
	    set_latest_stat_aggr_cnt(i, rx_bcst_frms);
	    set_latest_stat_aggr_cnt(i, rx_discarded_frms);
	    set_latest_stat_aggr_cnt(i, rx_errored_frms);
	    set_latest_stat_aggr_cnt(i, rx_unknown_protocol_frms);
	}
	return;
}
static void __hal_stats_pcim_update_latest ( xge_hal_device_h devh ) { xge_hal_device_t * hldev = ( xge_hal_device_t * ) devh ; int i ; #define set_latest_stat_link_cnt ( _link , _p )                    \
	    hldev->stats.pcim_info_latest->link_info[_link]._p =              \
	((hldev->stats.pcim_info->link_info[_link]._p >=                  \
	    hldev->stats.pcim_info_saved->link_info[_link]._p) ?          \
	    hldev->stats.pcim_info->link_info[_link]._p -             \
	        hldev->stats.pcim_info_saved->link_info[_link]._p :   \
	    ((-1) - hldev->stats.pcim_info_saved->link_info[_link]._p) +  \
	        hldev->stats.pcim_info->link_info[_link]._p) #define set_latest_stat_aggr_cnt ( _aggr , _p )                    \
	    hldev->stats.pcim_info_latest->aggr_info[_aggr]._p =              \
	((hldev->stats.pcim_info->aggr_info[_aggr]._p >=              \
	    hldev->stats.pcim_info_saved->aggr_info[_aggr]._p) ?          \
	    hldev->stats.pcim_info->aggr_info[_aggr]._p -             \
	        hldev->stats.pcim_info_saved->aggr_info[_aggr]._p :   \
	    ((-1) - hldev->stats.pcim_info_saved->aggr_info[_aggr]._p) +  \
	        hldev->stats.pcim_info->aggr_info[_aggr]._p) for ( i = 0 ; i < XGE_HAL_MAC_LINKS ; i ++ ) { set_latest_stat_link_cnt ( i , tx_frms ) ; set_latest_stat_link_cnt ( i , tx_ttl_eth_octets ) ; set_latest_stat_link_cnt ( i , tx_data_octets ) ; set_latest_stat_link_cnt ( i , tx_mcst_frms ) ; set_latest_stat_link_cnt ( i , tx_bcst_frms ) ; set_latest_stat_link_cnt ( i , tx_ucst_frms ) ; set_latest_stat_link_cnt ( i , tx_tagged_frms ) ; set_latest_stat_link_cnt ( i , tx_vld_ip ) ; set_latest_stat_link_cnt ( i , tx_vld_ip_octets ) ; set_latest_stat_link_cnt ( i , tx_icmp ) ; set_latest_stat_link_cnt ( i , tx_tcp ) ; set_latest_stat_link_cnt ( i , tx_rst_tcp ) ; set_latest_stat_link_cnt ( i , tx_udp ) ; set_latest_stat_link_cnt ( i , tx_unknown_protocol ) ; set_latest_stat_link_cnt ( i , tx_parse_error ) ; set_latest_stat_link_cnt ( i , tx_pause_ctrl_frms ) ; set_latest_stat_link_cnt ( i , tx_lacpdu_frms ) ; set_latest_stat_link_cnt ( i , tx_marker_pdu_frms ) ; set_latest_stat_link_cnt ( i , tx_marker_resp_pdu_frms ) ; set_latest_stat_link_cnt ( i , tx_drop_ip ) ; set_latest_stat_link_cnt ( i , tx_xgmii_char1_match ) ; set_latest_stat_link_cnt ( i , tx_xgmii_char2_match ) ; set_latest_stat_link_cnt ( i , tx_xgmii_column1_match ) ; set_latest_stat_link_cnt ( i , tx_xgmii_column2_match ) ; set_latest_stat_link_cnt ( i , tx_drop_frms ) ; set_latest_stat_link_cnt ( i , tx_any_err_frms ) ; set_latest_stat_link_cnt ( i , rx_ttl_frms ) ; set_latest_stat_link_cnt ( i , rx_vld_frms ) ; set_latest_stat_link_cnt ( i , rx_offld_frms ) ; set_latest_stat_link_cnt ( i , rx_ttl_eth_octets ) ; set_latest_stat_link_cnt ( i , rx_data_octets ) ; set_latest_stat_link_cnt ( i , rx_offld_octets ) ; set_latest_stat_link_cnt ( i , rx_vld_mcst_frms ) ; set_latest_stat_link_cnt ( i , rx_vld_bcst_frms ) ; set_latest_stat_link_cnt ( i , rx_accepted_ucst_frms ) ; set_latest_stat_link_cnt ( i , rx_accepted_nucst_frms ) ; set_latest_stat_link_cnt ( i , rx_tagged_frms ) ; set_latest_stat_link_cnt ( i , rx_long_frms ) ; set_latest_stat_link_cnt ( i , rx_usized_frms ) ; set_latest_stat_link_cnt ( i , rx_osized_frms ) ; set_latest_stat_link_cnt ( i , rx_frag_frms ) ; set_latest_stat_link_cnt ( i , rx_jabber_frms ) ; set_latest_stat_link_cnt ( i , rx_ttl_64_frms ) ; set_latest_stat_link_cnt ( i , rx_ttl_65_127_frms ) ; set_latest_stat_link_cnt ( i , rx_ttl_128_255_frms ) ; set_latest_stat_link_cnt ( i , rx_ttl_256_511_frms ) ; set_latest_stat_link_cnt ( i , rx_ttl_512_1023_frms ) ; set_latest_stat_link_cnt ( i , rx_ttl_1024_1518_frms ) ; set_latest_stat_link_cnt ( i , rx_ttl_1519_4095_frms ) ; set_latest_stat_link_cnt ( i , rx_ttl_40956_8191_frms ) ; set_latest_stat_link_cnt ( i , rx_ttl_8192_max_frms ) ; set_latest_stat_link_cnt ( i , rx_ttl_gt_max_frms ) ; set_latest_stat_link_cnt ( i , rx_ip ) ; set_latest_stat_link_cnt ( i , rx_ip_octets ) ; set_latest_stat_link_cnt ( i , rx_hdr_err_ip ) ; set_latest_stat_link_cnt ( i , rx_icmp ) ; set_latest_stat_link_cnt ( i , rx_tcp ) ; set_latest_stat_link_cnt ( i , rx_udp ) ; set_latest_stat_link_cnt ( i , rx_err_tcp ) ; set_latest_stat_link_cnt ( i , rx_pause_cnt ) ; set_latest_stat_link_cnt ( i , rx_pause_ctrl_frms ) ; set_latest_stat_link_cnt ( i , rx_unsup_ctrl_frms ) ; set_latest_stat_link_cnt ( i , rx_in_rng_len_err_frms ) ; set_latest_stat_link_cnt ( i , rx_out_rng_len_err_frms ) ; set_latest_stat_link_cnt ( i , rx_drop_frms ) ; set_latest_stat_link_cnt ( i , rx_discarded_frms ) ; set_latest_stat_link_cnt ( i , rx_drop_ip ) ; set_latest_stat_link_cnt ( i , rx_err_drp_udp ) ; set_latest_stat_link_cnt ( i , rx_lacpdu_frms ) ; set_latest_stat_link_cnt ( i , rx_marker_pdu_frms ) ; set_latest_stat_link_cnt ( i , rx_marker_resp_pdu_frms ) ; set_latest_stat_link_cnt ( i , rx_unknown_pdu_frms ) ; set_latest_stat_link_cnt ( i , rx_illegal_pdu_frms ) ; set_latest_stat_link_cnt ( i , rx_fcs_discard ) ; set_latest_stat_link_cnt ( i , rx_len_discard ) ; set_latest_stat_link_cnt ( i , rx_pf_discard ) ; set_latest_stat_link_cnt ( i , rx_trash_discard ) ; set_latest_stat_link_cnt ( i , rx_rts_discard ) ; set_latest_stat_link_cnt ( i , rx_wol_discard ) ; set_latest_stat_link_cnt ( i , rx_red_discard ) ; set_latest_stat_link_cnt ( i , rx_ingm_full_discard ) ; set_latest_stat_link_cnt ( i , rx_xgmii_data_err_cnt ) ; set_latest_stat_link_cnt ( i , rx_xgmii_ctrl_err_cnt ) ; set_latest_stat_link_cnt ( i , rx_xgmii_err_sym ) ; set_latest_stat_link_cnt ( i , rx_xgmii_char1_match ) ; set_latest_stat_link_cnt ( i , rx_xgmii_char2_match ) ; set_latest_stat_link_cnt ( i , rx_xgmii_column1_match ) ; set_latest_stat_link_cnt ( i , rx_xgmii_column2_match ) ; set_latest_stat_link_cnt ( i , rx_local_fault ) ; set_latest_stat_link_cnt ( i , rx_remote_fault ) ; set_latest_stat_link_cnt ( i , rx_queue_full ) ; } for ( i = 0 ; i < XGE_HAL_MAC_AGGREGATORS ; i ++ ) { set_latest_stat_aggr_cnt ( i , tx_frms ) ; set_latest_stat_aggr_cnt ( i , tx_mcst_frms ) ; set_latest_stat_aggr_cnt ( i , tx_bcst_frms ) ; set_latest_stat_aggr_cnt ( i , tx_discarded_frms ) ; set_latest_stat_aggr_cnt ( i , tx_errored_frms ) ; set_latest_stat_aggr_cnt ( i , rx_frms ) ; set_latest_stat_aggr_cnt ( i , rx_data_octets ) ; set_latest_stat_aggr_cnt ( i , rx_mcst_frms ) ; set_latest_stat_aggr_cnt ( i , rx_bcst_frms ) ; set_latest_stat_aggr_cnt ( i , rx_discarded_frms ) ; set_latest_stat_aggr_cnt ( i , rx_errored_frms ) ; set_latest_stat_aggr_cnt ( i , rx_unknown_protocol_frms ) ; } return ; }
__hal_stats_pcim_update_latest - Update hw ER stats counters, based on the
 real hardware maintained counters and the stored "reset" values.
__hal_stats_pcim_update_latest - Update hw ER stats counters based on the real hardware maintained counters and the stored " reset " values .