aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/ethernet/aquantia/atlantic/aq_hw_utils.c12
-rw-r--r--drivers/net/ethernet/aquantia/atlantic/aq_hw_utils.h1
-rw-r--r--drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_llh.c41
-rw-r--r--drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_llh.h31
-rw-r--r--drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_llh_internal.h3
-rw-r--r--drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c12
6 files changed, 36 insertions, 64 deletions
diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_hw_utils.c b/drivers/net/ethernet/aquantia/atlantic/aq_hw_utils.c
index d526c4f19d34..22a1c784dc9c 100644
--- a/drivers/net/ethernet/aquantia/atlantic/aq_hw_utils.c
+++ b/drivers/net/ethernet/aquantia/atlantic/aq_hw_utils.c
@@ -53,6 +53,18 @@ void aq_hw_write_reg(struct aq_hw_s *hw, u32 reg, u32 value)
53 writel(value, hw->mmio + reg); 53 writel(value, hw->mmio + reg);
54} 54}
55 55
56/* Most of 64-bit registers are in LSW, MSW form.
57 Counters are normally implemented by HW as latched pairs:
58 reading LSW first locks MSW, to overcome LSW overflow
59 */
60u64 aq_hw_read_reg64(struct aq_hw_s *hw, u32 reg)
61{
62 u64 value = aq_hw_read_reg(hw, reg);
63
64 value |= (u64)aq_hw_read_reg(hw, reg + 4) << 32;
65 return value;
66}
67
56int aq_hw_err_from_flags(struct aq_hw_s *hw) 68int aq_hw_err_from_flags(struct aq_hw_s *hw)
57{ 69{
58 int err = 0; 70 int err = 0;
diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_hw_utils.h b/drivers/net/ethernet/aquantia/atlantic/aq_hw_utils.h
index bc711238ca0c..bf73428ed689 100644
--- a/drivers/net/ethernet/aquantia/atlantic/aq_hw_utils.h
+++ b/drivers/net/ethernet/aquantia/atlantic/aq_hw_utils.h
@@ -35,6 +35,7 @@ void aq_hw_write_reg_bit(struct aq_hw_s *aq_hw, u32 addr, u32 msk,
35u32 aq_hw_read_reg_bit(struct aq_hw_s *aq_hw, u32 addr, u32 msk, u32 shift); 35u32 aq_hw_read_reg_bit(struct aq_hw_s *aq_hw, u32 addr, u32 msk, u32 shift);
36u32 aq_hw_read_reg(struct aq_hw_s *hw, u32 reg); 36u32 aq_hw_read_reg(struct aq_hw_s *hw, u32 reg);
37void aq_hw_write_reg(struct aq_hw_s *hw, u32 reg, u32 value); 37void aq_hw_write_reg(struct aq_hw_s *hw, u32 reg, u32 value);
38u64 aq_hw_read_reg64(struct aq_hw_s *hw, u32 reg);
38int aq_hw_err_from_flags(struct aq_hw_s *hw); 39int aq_hw_err_from_flags(struct aq_hw_s *hw);
39 40
40#endif /* AQ_HW_UTILS_H */ 41#endif /* AQ_HW_UTILS_H */
diff --git a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_llh.c b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_llh.c
index 9442deff98a8..eaab25cd08b3 100644
--- a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_llh.c
+++ b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_llh.c
@@ -49,11 +49,6 @@ u32 hw_atl_glb_soft_res_get(struct aq_hw_s *aq_hw)
49 HW_ATL_GLB_SOFT_RES_SHIFT); 49 HW_ATL_GLB_SOFT_RES_SHIFT);
50} 50}
51 51
52u32 hw_atl_reg_rx_dma_stat_counter7get(struct aq_hw_s *aq_hw)
53{
54 return aq_hw_read_reg(aq_hw, HW_ATL_RX_DMA_STAT_COUNTER7_ADR);
55}
56
57u32 hw_atl_reg_glb_mif_id_get(struct aq_hw_s *aq_hw) 52u32 hw_atl_reg_glb_mif_id_get(struct aq_hw_s *aq_hw)
58{ 53{
59 return aq_hw_read_reg(aq_hw, HW_ATL_GLB_MIF_ID_ADR); 54 return aq_hw_read_reg(aq_hw, HW_ATL_GLB_MIF_ID_ADR);
@@ -65,44 +60,24 @@ u32 hw_atl_rpb_rx_dma_drop_pkt_cnt_get(struct aq_hw_s *aq_hw)
65 return aq_hw_read_reg(aq_hw, HW_ATL_RPB_RX_DMA_DROP_PKT_CNT_ADR); 60 return aq_hw_read_reg(aq_hw, HW_ATL_RPB_RX_DMA_DROP_PKT_CNT_ADR);
66} 61}
67 62
68u32 hw_atl_stats_rx_dma_good_octet_counterlsw_get(struct aq_hw_s *aq_hw) 63u64 hw_atl_stats_rx_dma_good_octet_counter_get(struct aq_hw_s *aq_hw)
69{
70 return aq_hw_read_reg(aq_hw, HW_ATL_STATS_RX_DMA_GOOD_OCTET_COUNTERLSW);
71}
72
73u32 hw_atl_stats_rx_dma_good_pkt_counterlsw_get(struct aq_hw_s *aq_hw)
74{
75 return aq_hw_read_reg(aq_hw, HW_ATL_STATS_RX_DMA_GOOD_PKT_COUNTERLSW);
76}
77
78u32 hw_atl_stats_tx_dma_good_octet_counterlsw_get(struct aq_hw_s *aq_hw)
79{
80 return aq_hw_read_reg(aq_hw, HW_ATL_STATS_TX_DMA_GOOD_OCTET_COUNTERLSW);
81}
82
83u32 hw_atl_stats_tx_dma_good_pkt_counterlsw_get(struct aq_hw_s *aq_hw)
84{
85 return aq_hw_read_reg(aq_hw, HW_ATL_STATS_TX_DMA_GOOD_PKT_COUNTERLSW);
86}
87
88u32 hw_atl_stats_rx_dma_good_octet_countermsw_get(struct aq_hw_s *aq_hw)
89{ 64{
90 return aq_hw_read_reg(aq_hw, HW_ATL_STATS_RX_DMA_GOOD_OCTET_COUNTERMSW); 65 return aq_hw_read_reg64(aq_hw, HW_ATL_STATS_RX_DMA_GOOD_OCTET_COUNTERLSW);
91} 66}
92 67
93u32 hw_atl_stats_rx_dma_good_pkt_countermsw_get(struct aq_hw_s *aq_hw) 68u64 hw_atl_stats_rx_dma_good_pkt_counter_get(struct aq_hw_s *aq_hw)
94{ 69{
95 return aq_hw_read_reg(aq_hw, HW_ATL_STATS_RX_DMA_GOOD_PKT_COUNTERMSW); 70 return aq_hw_read_reg64(aq_hw, HW_ATL_STATS_RX_DMA_GOOD_PKT_COUNTERLSW);
96} 71}
97 72
98u32 hw_atl_stats_tx_dma_good_octet_countermsw_get(struct aq_hw_s *aq_hw) 73u64 hw_atl_stats_tx_dma_good_octet_counter_get(struct aq_hw_s *aq_hw)
99{ 74{
100 return aq_hw_read_reg(aq_hw, HW_ATL_STATS_TX_DMA_GOOD_OCTET_COUNTERMSW); 75 return aq_hw_read_reg64(aq_hw, HW_ATL_STATS_TX_DMA_GOOD_OCTET_COUNTERLSW);
101} 76}
102 77
103u32 hw_atl_stats_tx_dma_good_pkt_countermsw_get(struct aq_hw_s *aq_hw) 78u64 hw_atl_stats_tx_dma_good_pkt_counter_get(struct aq_hw_s *aq_hw)
104{ 79{
105 return aq_hw_read_reg(aq_hw, HW_ATL_STATS_TX_DMA_GOOD_PKT_COUNTERMSW); 80 return aq_hw_read_reg64(aq_hw, HW_ATL_STATS_TX_DMA_GOOD_PKT_COUNTERLSW);
106} 81}
107 82
108/* interrupt */ 83/* interrupt */
diff --git a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_llh.h b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_llh.h
index 4cfa4bd80ad3..2eb44e1cff70 100644
--- a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_llh.h
+++ b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_llh.h
@@ -40,29 +40,17 @@ u32 hw_atl_glb_soft_res_get(struct aq_hw_s *aq_hw);
40 40
41u32 hw_atl_rpb_rx_dma_drop_pkt_cnt_get(struct aq_hw_s *aq_hw); 41u32 hw_atl_rpb_rx_dma_drop_pkt_cnt_get(struct aq_hw_s *aq_hw);
42 42
43/* get rx dma good octet counter lsw */ 43/* get rx dma good octet counter */
44u32 hw_atl_stats_rx_dma_good_octet_counterlsw_get(struct aq_hw_s *aq_hw); 44u64 hw_atl_stats_rx_dma_good_octet_counter_get(struct aq_hw_s *aq_hw);
45 45
46/* get rx dma good packet counter lsw */ 46/* get rx dma good packet counter */
47u32 hw_atl_stats_rx_dma_good_pkt_counterlsw_get(struct aq_hw_s *aq_hw); 47u64 hw_atl_stats_rx_dma_good_pkt_counter_get(struct aq_hw_s *aq_hw);
48 48
49/* get tx dma good octet counter lsw */ 49/* get tx dma good octet counter */
50u32 hw_atl_stats_tx_dma_good_octet_counterlsw_get(struct aq_hw_s *aq_hw); 50u64 hw_atl_stats_tx_dma_good_octet_counter_get(struct aq_hw_s *aq_hw);
51 51
52/* get tx dma good packet counter lsw */ 52/* get tx dma good packet counter */
53u32 hw_atl_stats_tx_dma_good_pkt_counterlsw_get(struct aq_hw_s *aq_hw); 53u64 hw_atl_stats_tx_dma_good_pkt_counter_get(struct aq_hw_s *aq_hw);
54
55/* get rx dma good octet counter msw */
56u32 hw_atl_stats_rx_dma_good_octet_countermsw_get(struct aq_hw_s *aq_hw);
57
58/* get rx dma good packet counter msw */
59u32 hw_atl_stats_rx_dma_good_pkt_countermsw_get(struct aq_hw_s *aq_hw);
60
61/* get tx dma good octet counter msw */
62u32 hw_atl_stats_tx_dma_good_octet_countermsw_get(struct aq_hw_s *aq_hw);
63
64/* get tx dma good packet counter msw */
65u32 hw_atl_stats_tx_dma_good_pkt_countermsw_get(struct aq_hw_s *aq_hw);
66 54
67/* get msm rx errors counter register */ 55/* get msm rx errors counter register */
68u32 hw_atl_reg_mac_msm_rx_errs_cnt_get(struct aq_hw_s *aq_hw); 56u32 hw_atl_reg_mac_msm_rx_errs_cnt_get(struct aq_hw_s *aq_hw);
@@ -82,9 +70,6 @@ u32 hw_atl_reg_mac_msm_rx_bcst_octets_counter1get(struct aq_hw_s *aq_hw);
82/* get msm rx unicast octets counter register 0 */ 70/* get msm rx unicast octets counter register 0 */
83u32 hw_atl_reg_mac_msm_rx_ucst_octets_counter0get(struct aq_hw_s *aq_hw); 71u32 hw_atl_reg_mac_msm_rx_ucst_octets_counter0get(struct aq_hw_s *aq_hw);
84 72
85/* get rx dma statistics counter 7 */
86u32 hw_atl_reg_rx_dma_stat_counter7get(struct aq_hw_s *aq_hw);
87
88/* get msm tx errors counter register */ 73/* get msm tx errors counter register */
89u32 hw_atl_reg_mac_msm_tx_errs_cnt_get(struct aq_hw_s *aq_hw); 74u32 hw_atl_reg_mac_msm_tx_errs_cnt_get(struct aq_hw_s *aq_hw);
90 75
diff --git a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_llh_internal.h b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_llh_internal.h
index 430bbd45b2f0..b64140924a02 100644
--- a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_llh_internal.h
+++ b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_llh_internal.h
@@ -58,9 +58,6 @@
58/* preprocessor definitions for msm rx unicast octets counter register 0 */ 58/* preprocessor definitions for msm rx unicast octets counter register 0 */
59#define HW_ATL_MAC_MSM_RX_UCST_OCTETS_COUNTER0_ADR 0x000001b8u 59#define HW_ATL_MAC_MSM_RX_UCST_OCTETS_COUNTER0_ADR 0x000001b8u
60 60
61/* preprocessor definitions for rx dma statistics counter 7 */
62#define HW_ATL_RX_DMA_STAT_COUNTER7_ADR 0x00006818u
63
64/* preprocessor definitions for msm tx unicast frames counter register */ 61/* preprocessor definitions for msm tx unicast frames counter register */
65#define HW_ATL_MAC_MSM_TX_UCST_FRM_CNT_ADR 0x00000108u 62#define HW_ATL_MAC_MSM_TX_UCST_FRM_CNT_ADR 0x00000108u
66 63
diff --git a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c
index b521457434fc..1208f7ecdd76 100644
--- a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c
+++ b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c
@@ -545,7 +545,7 @@ void hw_atl_utils_mpi_read_stats(struct aq_hw_s *self,
545 pmbox->stats.ubtc = pmbox->stats.uptc * mtu; 545 pmbox->stats.ubtc = pmbox->stats.uptc * mtu;
546 pmbox->stats.dpc = atomic_read(&self->dpc); 546 pmbox->stats.dpc = atomic_read(&self->dpc);
547 } else { 547 } else {
548 pmbox->stats.dpc = hw_atl_reg_rx_dma_stat_counter7get(self); 548 pmbox->stats.dpc = hw_atl_rpb_rx_dma_drop_pkt_cnt_get(self);
549 } 549 }
550 550
551err_exit:; 551err_exit:;
@@ -763,6 +763,7 @@ static int hw_atl_fw1x_deinit(struct aq_hw_s *self)
763int hw_atl_utils_update_stats(struct aq_hw_s *self) 763int hw_atl_utils_update_stats(struct aq_hw_s *self)
764{ 764{
765 struct hw_atl_utils_mbox mbox; 765 struct hw_atl_utils_mbox mbox;
766 struct aq_stats_s *cs = &self->curr_stats;
766 767
767 hw_atl_utils_mpi_read_stats(self, &mbox); 768 hw_atl_utils_mpi_read_stats(self, &mbox);
768 769
@@ -789,10 +790,11 @@ int hw_atl_utils_update_stats(struct aq_hw_s *self)
789 AQ_SDELTA(dpc); 790 AQ_SDELTA(dpc);
790 } 791 }
791#undef AQ_SDELTA 792#undef AQ_SDELTA
792 self->curr_stats.dma_pkt_rc = hw_atl_stats_rx_dma_good_pkt_counterlsw_get(self); 793
793 self->curr_stats.dma_pkt_tc = hw_atl_stats_tx_dma_good_pkt_counterlsw_get(self); 794 cs->dma_pkt_rc = hw_atl_stats_rx_dma_good_pkt_counter_get(self);
794 self->curr_stats.dma_oct_rc = hw_atl_stats_rx_dma_good_octet_counterlsw_get(self); 795 cs->dma_pkt_tc = hw_atl_stats_tx_dma_good_pkt_counter_get(self);
795 self->curr_stats.dma_oct_tc = hw_atl_stats_tx_dma_good_octet_counterlsw_get(self); 796 cs->dma_oct_rc = hw_atl_stats_rx_dma_good_octet_counter_get(self);
797 cs->dma_oct_tc = hw_atl_stats_tx_dma_good_octet_counter_get(self);
796 798
797 memcpy(&self->last_stats, &mbox.stats, sizeof(mbox.stats)); 799 memcpy(&self->last_stats, &mbox.stats, sizeof(mbox.stats));
798 800