aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ixgbe/ixgbe_main.c
diff options
context:
space:
mode:
authorAyyappan Veeraiyan <ayyappan.veeraiyan@intel.com>2008-02-01 18:59:14 -0500
committerJeff Garzik <jeff@garzik.org>2008-02-05 13:31:36 -0500
commit6f11eef7790828c33b4f6fc41aed9815ad047e7c (patch)
treefdbfb84e13a25e004873aae01bdbad002ca97330 /drivers/net/ixgbe/ixgbe_main.c
parente59bd25d579c143f1b93a33d3243d67abbb15abe (diff)
ixgbe: fix several counter register errata
Several counters behave differently on 82598 causing them to display incorrect values. Adjust the accounting so the reported numbers make sense and do not double count or represent the wrong item. Signed-off-by: Ayyappan Veeraiyan <ayyappan.veeraiyan@intel.com> Signed-off-by: Auke Kok <auke-jan.h.kok@intel.com> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net/ixgbe/ixgbe_main.c')
-rw-r--r--drivers/net/ixgbe/ixgbe_main.c53
1 files changed, 31 insertions, 22 deletions
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c
index ee5ee10c918f..6e7d90e69b52 100644
--- a/drivers/net/ixgbe/ixgbe_main.c
+++ b/drivers/net/ixgbe/ixgbe_main.c
@@ -2026,22 +2026,26 @@ static int ixgbe_close(struct net_device *netdev)
2026void ixgbe_update_stats(struct ixgbe_adapter *adapter) 2026void ixgbe_update_stats(struct ixgbe_adapter *adapter)
2027{ 2027{
2028 struct ixgbe_hw *hw = &adapter->hw; 2028 struct ixgbe_hw *hw = &adapter->hw;
2029 u64 good_rx, missed_rx, bprc; 2029 u64 total_mpc = 0;
2030 u32 i, missed_rx = 0, mpc, bprc, lxon, lxoff, xon_off_tot;
2030 2031
2031 adapter->stats.crcerrs += IXGBE_READ_REG(hw, IXGBE_CRCERRS); 2032 adapter->stats.crcerrs += IXGBE_READ_REG(hw, IXGBE_CRCERRS);
2032 good_rx = IXGBE_READ_REG(hw, IXGBE_GPRC); 2033 for (i = 0; i < 8; i++) {
2033 missed_rx = IXGBE_READ_REG(hw, IXGBE_MPC(0)); 2034 /* for packet buffers not used, the register should read 0 */
2034 missed_rx += IXGBE_READ_REG(hw, IXGBE_MPC(1)); 2035 mpc = IXGBE_READ_REG(hw, IXGBE_MPC(i));
2035 missed_rx += IXGBE_READ_REG(hw, IXGBE_MPC(2)); 2036 missed_rx += mpc;
2036 missed_rx += IXGBE_READ_REG(hw, IXGBE_MPC(3)); 2037 adapter->stats.mpc[i] += mpc;
2037 missed_rx += IXGBE_READ_REG(hw, IXGBE_MPC(4)); 2038 total_mpc += adapter->stats.mpc[i];
2038 missed_rx += IXGBE_READ_REG(hw, IXGBE_MPC(5)); 2039 adapter->stats.rnbc[i] += IXGBE_READ_REG(hw, IXGBE_RNBC(i));
2039 missed_rx += IXGBE_READ_REG(hw, IXGBE_MPC(6)); 2040 }
2040 missed_rx += IXGBE_READ_REG(hw, IXGBE_MPC(7)); 2041 adapter->stats.gprc += IXGBE_READ_REG(hw, IXGBE_GPRC);
2041 adapter->stats.gprc += (good_rx - missed_rx); 2042 /* work around hardware counting issue */
2042 2043 adapter->stats.gprc -= missed_rx;
2043 adapter->stats.mpc[0] += missed_rx; 2044
2045 /* 82598 hardware only has a 32 bit counter in the high register */
2044 adapter->stats.gorc += IXGBE_READ_REG(hw, IXGBE_GORCH); 2046 adapter->stats.gorc += IXGBE_READ_REG(hw, IXGBE_GORCH);
2047 adapter->stats.gotc += IXGBE_READ_REG(hw, IXGBE_GOTCH);
2048 adapter->stats.tor += IXGBE_READ_REG(hw, IXGBE_TORH);
2045 bprc = IXGBE_READ_REG(hw, IXGBE_BPRC); 2049 bprc = IXGBE_READ_REG(hw, IXGBE_BPRC);
2046 adapter->stats.bprc += bprc; 2050 adapter->stats.bprc += bprc;
2047 adapter->stats.mprc += IXGBE_READ_REG(hw, IXGBE_MPRC); 2051 adapter->stats.mprc += IXGBE_READ_REG(hw, IXGBE_MPRC);
@@ -2053,28 +2057,34 @@ void ixgbe_update_stats(struct ixgbe_adapter *adapter)
2053 adapter->stats.prc511 += IXGBE_READ_REG(hw, IXGBE_PRC511); 2057 adapter->stats.prc511 += IXGBE_READ_REG(hw, IXGBE_PRC511);
2054 adapter->stats.prc1023 += IXGBE_READ_REG(hw, IXGBE_PRC1023); 2058 adapter->stats.prc1023 += IXGBE_READ_REG(hw, IXGBE_PRC1023);
2055 adapter->stats.prc1522 += IXGBE_READ_REG(hw, IXGBE_PRC1522); 2059 adapter->stats.prc1522 += IXGBE_READ_REG(hw, IXGBE_PRC1522);
2056
2057 adapter->stats.rlec += IXGBE_READ_REG(hw, IXGBE_RLEC); 2060 adapter->stats.rlec += IXGBE_READ_REG(hw, IXGBE_RLEC);
2058 adapter->stats.lxonrxc += IXGBE_READ_REG(hw, IXGBE_LXONRXC); 2061 adapter->stats.lxonrxc += IXGBE_READ_REG(hw, IXGBE_LXONRXC);
2059 adapter->stats.lxontxc += IXGBE_READ_REG(hw, IXGBE_LXONTXC);
2060 adapter->stats.lxoffrxc += IXGBE_READ_REG(hw, IXGBE_LXOFFRXC); 2062 adapter->stats.lxoffrxc += IXGBE_READ_REG(hw, IXGBE_LXOFFRXC);
2061 adapter->stats.lxofftxc += IXGBE_READ_REG(hw, IXGBE_LXOFFTXC); 2063 lxon = IXGBE_READ_REG(hw, IXGBE_LXONTXC);
2064 adapter->stats.lxontxc += lxon;
2065 lxoff = IXGBE_READ_REG(hw, IXGBE_LXOFFTXC);
2066 adapter->stats.lxofftxc += lxoff;
2062 adapter->stats.ruc += IXGBE_READ_REG(hw, IXGBE_RUC); 2067 adapter->stats.ruc += IXGBE_READ_REG(hw, IXGBE_RUC);
2063 adapter->stats.gptc += IXGBE_READ_REG(hw, IXGBE_GPTC); 2068 adapter->stats.gptc += IXGBE_READ_REG(hw, IXGBE_GPTC);
2064 adapter->stats.gotc += IXGBE_READ_REG(hw, IXGBE_GOTCH); 2069 adapter->stats.mptc += IXGBE_READ_REG(hw, IXGBE_MPTC);
2065 adapter->stats.rnbc[0] += IXGBE_READ_REG(hw, IXGBE_RNBC(0)); 2070 /*
2071 * 82598 errata - tx of flow control packets is included in tx counters
2072 */
2073 xon_off_tot = lxon + lxoff;
2074 adapter->stats.gptc -= xon_off_tot;
2075 adapter->stats.mptc -= xon_off_tot;
2076 adapter->stats.gotc -= (xon_off_tot * (ETH_ZLEN + ETH_FCS_LEN));
2066 adapter->stats.ruc += IXGBE_READ_REG(hw, IXGBE_RUC); 2077 adapter->stats.ruc += IXGBE_READ_REG(hw, IXGBE_RUC);
2067 adapter->stats.rfc += IXGBE_READ_REG(hw, IXGBE_RFC); 2078 adapter->stats.rfc += IXGBE_READ_REG(hw, IXGBE_RFC);
2068 adapter->stats.rjc += IXGBE_READ_REG(hw, IXGBE_RJC); 2079 adapter->stats.rjc += IXGBE_READ_REG(hw, IXGBE_RJC);
2069 adapter->stats.tor += IXGBE_READ_REG(hw, IXGBE_TORH);
2070 adapter->stats.tpr += IXGBE_READ_REG(hw, IXGBE_TPR); 2080 adapter->stats.tpr += IXGBE_READ_REG(hw, IXGBE_TPR);
2071 adapter->stats.ptc64 += IXGBE_READ_REG(hw, IXGBE_PTC64); 2081 adapter->stats.ptc64 += IXGBE_READ_REG(hw, IXGBE_PTC64);
2082 adapter->stats.ptc64 -= xon_off_tot;
2072 adapter->stats.ptc127 += IXGBE_READ_REG(hw, IXGBE_PTC127); 2083 adapter->stats.ptc127 += IXGBE_READ_REG(hw, IXGBE_PTC127);
2073 adapter->stats.ptc255 += IXGBE_READ_REG(hw, IXGBE_PTC255); 2084 adapter->stats.ptc255 += IXGBE_READ_REG(hw, IXGBE_PTC255);
2074 adapter->stats.ptc511 += IXGBE_READ_REG(hw, IXGBE_PTC511); 2085 adapter->stats.ptc511 += IXGBE_READ_REG(hw, IXGBE_PTC511);
2075 adapter->stats.ptc1023 += IXGBE_READ_REG(hw, IXGBE_PTC1023); 2086 adapter->stats.ptc1023 += IXGBE_READ_REG(hw, IXGBE_PTC1023);
2076 adapter->stats.ptc1522 += IXGBE_READ_REG(hw, IXGBE_PTC1522); 2087 adapter->stats.ptc1522 += IXGBE_READ_REG(hw, IXGBE_PTC1522);
2077 adapter->stats.mptc += IXGBE_READ_REG(hw, IXGBE_MPTC);
2078 adapter->stats.bptc += IXGBE_READ_REG(hw, IXGBE_BPTC); 2088 adapter->stats.bptc += IXGBE_READ_REG(hw, IXGBE_BPTC);
2079 2089
2080 /* Fill out the OS statistics structure */ 2090 /* Fill out the OS statistics structure */
@@ -2090,8 +2100,7 @@ void ixgbe_update_stats(struct ixgbe_adapter *adapter)
2090 adapter->net_stats.rx_dropped = 0; 2100 adapter->net_stats.rx_dropped = 0;
2091 adapter->net_stats.rx_length_errors = adapter->stats.rlec; 2101 adapter->net_stats.rx_length_errors = adapter->stats.rlec;
2092 adapter->net_stats.rx_crc_errors = adapter->stats.crcerrs; 2102 adapter->net_stats.rx_crc_errors = adapter->stats.crcerrs;
2093 adapter->net_stats.rx_missed_errors = adapter->stats.mpc[0]; 2103 adapter->net_stats.rx_missed_errors = total_mpc;
2094
2095} 2104}
2096 2105
2097/** 2106/**