提交 43915c7c 编写于 作者: N Nick Nunley 提交者: David S. Miller

igb: only read phy specific stats if in internal phy mode

There are a couple statistics registers that are not meant to
be read when in SGMII/serdes mode. This patch adds a check to
verify mode before reading and updating these statistics.
Signed-off-by: NNicholas Nunley <nicholasx.d.nunley@intel.com>
Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 e6bdb6fe
...@@ -3975,7 +3975,7 @@ void igb_update_stats(struct igb_adapter *adapter) ...@@ -3975,7 +3975,7 @@ void igb_update_stats(struct igb_adapter *adapter)
struct net_device_stats *net_stats = igb_get_stats(adapter->netdev); struct net_device_stats *net_stats = igb_get_stats(adapter->netdev);
struct e1000_hw *hw = &adapter->hw; struct e1000_hw *hw = &adapter->hw;
struct pci_dev *pdev = adapter->pdev; struct pci_dev *pdev = adapter->pdev;
u32 rnbc; u32 rnbc, reg;
u16 phy_tmp; u16 phy_tmp;
int i; int i;
u64 bytes, packets; u64 bytes, packets;
...@@ -4072,8 +4072,13 @@ void igb_update_stats(struct igb_adapter *adapter) ...@@ -4072,8 +4072,13 @@ void igb_update_stats(struct igb_adapter *adapter)
adapter->stats.colc += rd32(E1000_COLC); adapter->stats.colc += rd32(E1000_COLC);
adapter->stats.algnerrc += rd32(E1000_ALGNERRC); adapter->stats.algnerrc += rd32(E1000_ALGNERRC);
/* read internal phy specific stats */
reg = rd32(E1000_CTRL_EXT);
if (!(reg & E1000_CTRL_EXT_LINK_MODE_MASK)) {
adapter->stats.rxerrc += rd32(E1000_RXERRC); adapter->stats.rxerrc += rd32(E1000_RXERRC);
adapter->stats.tncrs += rd32(E1000_TNCRS); adapter->stats.tncrs += rd32(E1000_TNCRS);
}
adapter->stats.tsctc += rd32(E1000_TSCTC); adapter->stats.tsctc += rd32(E1000_TSCTC);
adapter->stats.tsctfc += rd32(E1000_TSCTFC); adapter->stats.tsctfc += rd32(E1000_TSCTFC);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册