diff options
author | Sabrina Dubroca <sd@queasysnail.net> | 2014-01-09 04:09:29 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-01-11 23:52:58 -0500 |
commit | 5665dc6488902606b2d80ed640bb1e189aabddfe (patch) | |
tree | 7130f6d0c8800d1f99e87a0cfd5ad1a5aa2cb184 | |
parent | ac45a23c53b224d3957008643cf508cd7f2fece3 (diff) |
alx: add stats update function
Signed-off-by: Sabrina Dubroca <sd@queasysnail.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/ethernet/atheros/alx/hw.c | 58 | ||||
-rw-r--r-- | drivers/net/ethernet/atheros/alx/hw.h | 4 |
2 files changed, 62 insertions, 0 deletions
diff --git a/drivers/net/ethernet/atheros/alx/hw.c b/drivers/net/ethernet/atheros/alx/hw.c index 1e8c24a3cb4e..7712f068f6d4 100644 --- a/drivers/net/ethernet/atheros/alx/hw.c +++ b/drivers/net/ethernet/atheros/alx/hw.c | |||
@@ -1050,3 +1050,61 @@ bool alx_get_phy_info(struct alx_hw *hw) | |||
1050 | 1050 | ||
1051 | return true; | 1051 | return true; |
1052 | } | 1052 | } |
1053 | |||
1054 | void alx_update_hw_stats(struct alx_hw *hw) | ||
1055 | { | ||
1056 | /* RX stats */ | ||
1057 | hw->stats.rx_ok += alx_read_mem32(hw, ALX_MIB_RX_OK); | ||
1058 | hw->stats.rx_bcast += alx_read_mem32(hw, ALX_MIB_RX_BCAST); | ||
1059 | hw->stats.rx_mcast += alx_read_mem32(hw, ALX_MIB_RX_MCAST); | ||
1060 | hw->stats.rx_pause += alx_read_mem32(hw, ALX_MIB_RX_PAUSE); | ||
1061 | hw->stats.rx_ctrl += alx_read_mem32(hw, ALX_MIB_RX_CTRL); | ||
1062 | hw->stats.rx_fcs_err += alx_read_mem32(hw, ALX_MIB_RX_FCS_ERR); | ||
1063 | hw->stats.rx_len_err += alx_read_mem32(hw, ALX_MIB_RX_LEN_ERR); | ||
1064 | hw->stats.rx_byte_cnt += alx_read_mem32(hw, ALX_MIB_RX_BYTE_CNT); | ||
1065 | hw->stats.rx_runt += alx_read_mem32(hw, ALX_MIB_RX_RUNT); | ||
1066 | hw->stats.rx_frag += alx_read_mem32(hw, ALX_MIB_RX_FRAG); | ||
1067 | hw->stats.rx_sz_64B += alx_read_mem32(hw, ALX_MIB_RX_SZ_64B); | ||
1068 | hw->stats.rx_sz_127B += alx_read_mem32(hw, ALX_MIB_RX_SZ_127B); | ||
1069 | hw->stats.rx_sz_255B += alx_read_mem32(hw, ALX_MIB_RX_SZ_255B); | ||
1070 | hw->stats.rx_sz_511B += alx_read_mem32(hw, ALX_MIB_RX_SZ_511B); | ||
1071 | hw->stats.rx_sz_1023B += alx_read_mem32(hw, ALX_MIB_RX_SZ_1023B); | ||
1072 | hw->stats.rx_sz_1518B += alx_read_mem32(hw, ALX_MIB_RX_SZ_1518B); | ||
1073 | hw->stats.rx_sz_max += alx_read_mem32(hw, ALX_MIB_RX_SZ_MAX); | ||
1074 | hw->stats.rx_ov_sz += alx_read_mem32(hw, ALX_MIB_RX_OV_SZ); | ||
1075 | hw->stats.rx_ov_rxf += alx_read_mem32(hw, ALX_MIB_RX_OV_RXF); | ||
1076 | hw->stats.rx_ov_rrd += alx_read_mem32(hw, ALX_MIB_RX_OV_RRD); | ||
1077 | hw->stats.rx_align_err += alx_read_mem32(hw, ALX_MIB_RX_ALIGN_ERR); | ||
1078 | hw->stats.rx_bc_byte_cnt += alx_read_mem32(hw, ALX_MIB_RX_BCCNT); | ||
1079 | hw->stats.rx_mc_byte_cnt += alx_read_mem32(hw, ALX_MIB_RX_MCCNT); | ||
1080 | hw->stats.rx_err_addr += alx_read_mem32(hw, ALX_MIB_RX_ERRADDR); | ||
1081 | |||
1082 | /* TX stats */ | ||
1083 | hw->stats.tx_ok += alx_read_mem32(hw, ALX_MIB_TX_OK); | ||
1084 | hw->stats.tx_bcast += alx_read_mem32(hw, ALX_MIB_TX_BCAST); | ||
1085 | hw->stats.tx_mcast += alx_read_mem32(hw, ALX_MIB_TX_MCAST); | ||
1086 | hw->stats.tx_pause += alx_read_mem32(hw, ALX_MIB_TX_PAUSE); | ||
1087 | hw->stats.tx_exc_defer += alx_read_mem32(hw, ALX_MIB_TX_EXC_DEFER); | ||
1088 | hw->stats.tx_ctrl += alx_read_mem32(hw, ALX_MIB_TX_CTRL); | ||
1089 | hw->stats.tx_defer += alx_read_mem32(hw, ALX_MIB_TX_DEFER); | ||
1090 | hw->stats.tx_byte_cnt += alx_read_mem32(hw, ALX_MIB_TX_BYTE_CNT); | ||
1091 | hw->stats.tx_sz_64B += alx_read_mem32(hw, ALX_MIB_TX_SZ_64B); | ||
1092 | hw->stats.tx_sz_127B += alx_read_mem32(hw, ALX_MIB_TX_SZ_127B); | ||
1093 | hw->stats.tx_sz_255B += alx_read_mem32(hw, ALX_MIB_TX_SZ_255B); | ||
1094 | hw->stats.tx_sz_511B += alx_read_mem32(hw, ALX_MIB_TX_SZ_511B); | ||
1095 | hw->stats.tx_sz_1023B += alx_read_mem32(hw, ALX_MIB_TX_SZ_1023B); | ||
1096 | hw->stats.tx_sz_1518B += alx_read_mem32(hw, ALX_MIB_TX_SZ_1518B); | ||
1097 | hw->stats.tx_sz_max += alx_read_mem32(hw, ALX_MIB_TX_SZ_MAX); | ||
1098 | hw->stats.tx_single_col += alx_read_mem32(hw, ALX_MIB_TX_SINGLE_COL); | ||
1099 | hw->stats.tx_multi_col += alx_read_mem32(hw, ALX_MIB_TX_MULTI_COL); | ||
1100 | hw->stats.tx_late_col += alx_read_mem32(hw, ALX_MIB_TX_LATE_COL); | ||
1101 | hw->stats.tx_abort_col += alx_read_mem32(hw, ALX_MIB_TX_ABORT_COL); | ||
1102 | hw->stats.tx_underrun += alx_read_mem32(hw, ALX_MIB_TX_UNDERRUN); | ||
1103 | hw->stats.tx_trd_eop += alx_read_mem32(hw, ALX_MIB_TX_TRD_EOP); | ||
1104 | hw->stats.tx_len_err += alx_read_mem32(hw, ALX_MIB_TX_LEN_ERR); | ||
1105 | hw->stats.tx_trunc += alx_read_mem32(hw, ALX_MIB_TX_TRUNC); | ||
1106 | hw->stats.tx_bc_byte_cnt += alx_read_mem32(hw, ALX_MIB_TX_BCCNT); | ||
1107 | hw->stats.tx_mc_byte_cnt += alx_read_mem32(hw, ALX_MIB_TX_MCCNT); | ||
1108 | |||
1109 | hw->stats.update += alx_read_mem32(hw, ALX_MIB_UPDATE); | ||
1110 | } | ||
diff --git a/drivers/net/ethernet/atheros/alx/hw.h b/drivers/net/ethernet/atheros/alx/hw.h index 872b3628a678..854d80704f12 100644 --- a/drivers/net/ethernet/atheros/alx/hw.h +++ b/drivers/net/ethernet/atheros/alx/hw.h | |||
@@ -486,6 +486,9 @@ struct alx_hw { | |||
486 | 486 | ||
487 | /* PHY link patch flag */ | 487 | /* PHY link patch flag */ |
488 | bool lnk_patch; | 488 | bool lnk_patch; |
489 | |||
490 | /* cumulated stats from the hardware (registers are cleared on read) */ | ||
491 | struct alx_hw_stats stats; | ||
489 | }; | 492 | }; |
490 | 493 | ||
491 | static inline int alx_hw_revision(struct alx_hw *hw) | 494 | static inline int alx_hw_revision(struct alx_hw *hw) |
@@ -553,6 +556,7 @@ bool alx_phy_configured(struct alx_hw *hw); | |||
553 | void alx_configure_basic(struct alx_hw *hw); | 556 | void alx_configure_basic(struct alx_hw *hw); |
554 | void alx_disable_rss(struct alx_hw *hw); | 557 | void alx_disable_rss(struct alx_hw *hw); |
555 | bool alx_get_phy_info(struct alx_hw *hw); | 558 | bool alx_get_phy_info(struct alx_hw *hw); |
559 | void alx_update_hw_stats(struct alx_hw *hw); | ||
556 | 560 | ||
557 | static inline u32 alx_speed_to_ethadv(int speed, u8 duplex) | 561 | static inline u32 alx_speed_to_ethadv(int speed, u8 duplex) |
558 | { | 562 | { |