igb: Use the instance of net_device_stats from net_device.
Since net_device has an instance of net_device_stats, we can remove the instance of this from the adapter structure. Signed-off-by: Ajit Khaparde <ajitk@serverengines.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
2d86f1393c
commit
8d24e93309
@@ -3534,10 +3534,8 @@ static void igb_reset_task(struct work_struct *work)
|
||||
**/
|
||||
static struct net_device_stats *igb_get_stats(struct net_device *netdev)
|
||||
{
|
||||
struct igb_adapter *adapter = netdev_priv(netdev);
|
||||
|
||||
/* only return the current stats */
|
||||
return &adapter->net_stats;
|
||||
return &netdev->stats;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -3623,6 +3621,7 @@ static int igb_change_mtu(struct net_device *netdev, int new_mtu)
|
||||
|
||||
void igb_update_stats(struct igb_adapter *adapter)
|
||||
{
|
||||
struct net_device *netdev = adapter->netdev;
|
||||
struct e1000_hw *hw = &adapter->hw;
|
||||
struct pci_dev *pdev = adapter->pdev;
|
||||
u16 phy_tmp;
|
||||
@@ -3712,8 +3711,8 @@ void igb_update_stats(struct igb_adapter *adapter)
|
||||
adapter->stats.icrxdmtc += rd32(E1000_ICRXDMTC);
|
||||
|
||||
/* Fill out the OS statistics structure */
|
||||
adapter->net_stats.multicast = adapter->stats.mprc;
|
||||
adapter->net_stats.collisions = adapter->stats.colc;
|
||||
netdev->stats.multicast = adapter->stats.mprc;
|
||||
netdev->stats.collisions = adapter->stats.colc;
|
||||
|
||||
/* Rx Errors */
|
||||
|
||||
@@ -3734,7 +3733,7 @@ void igb_update_stats(struct igb_adapter *adapter)
|
||||
adapter->rx_ring[i].rx_stats.drops += rqdpc_tmp;
|
||||
rqdpc_total += adapter->rx_ring[i].rx_stats.drops;
|
||||
}
|
||||
adapter->net_stats.rx_fifo_errors = rqdpc_total;
|
||||
netdev->stats.rx_fifo_errors = rqdpc_total;
|
||||
}
|
||||
|
||||
/* Note RNBC (Receive No Buffers Count) is an not an exact
|
||||
@@ -3742,26 +3741,26 @@ void igb_update_stats(struct igb_adapter *adapter)
|
||||
* one of the reason for saving it in rx_fifo_errors, as its
|
||||
* potentially not a true drop.
|
||||
*/
|
||||
adapter->net_stats.rx_fifo_errors += adapter->stats.rnbc;
|
||||
netdev->stats.rx_fifo_errors += adapter->stats.rnbc;
|
||||
|
||||
/* RLEC on some newer hardware can be incorrect so build
|
||||
* our own version based on RUC and ROC */
|
||||
adapter->net_stats.rx_errors = adapter->stats.rxerrc +
|
||||
netdev->stats.rx_errors = adapter->stats.rxerrc +
|
||||
adapter->stats.crcerrs + adapter->stats.algnerrc +
|
||||
adapter->stats.ruc + adapter->stats.roc +
|
||||
adapter->stats.cexterr;
|
||||
adapter->net_stats.rx_length_errors = adapter->stats.ruc +
|
||||
netdev->stats.rx_length_errors = adapter->stats.ruc +
|
||||
adapter->stats.roc;
|
||||
adapter->net_stats.rx_crc_errors = adapter->stats.crcerrs;
|
||||
adapter->net_stats.rx_frame_errors = adapter->stats.algnerrc;
|
||||
adapter->net_stats.rx_missed_errors = adapter->stats.mpc;
|
||||
netdev->stats.rx_crc_errors = adapter->stats.crcerrs;
|
||||
netdev->stats.rx_frame_errors = adapter->stats.algnerrc;
|
||||
netdev->stats.rx_missed_errors = adapter->stats.mpc;
|
||||
|
||||
/* Tx Errors */
|
||||
adapter->net_stats.tx_errors = adapter->stats.ecol +
|
||||
netdev->stats.tx_errors = adapter->stats.ecol +
|
||||
adapter->stats.latecol;
|
||||
adapter->net_stats.tx_aborted_errors = adapter->stats.ecol;
|
||||
adapter->net_stats.tx_window_errors = adapter->stats.latecol;
|
||||
adapter->net_stats.tx_carrier_errors = adapter->stats.tncrs;
|
||||
netdev->stats.tx_aborted_errors = adapter->stats.ecol;
|
||||
netdev->stats.tx_window_errors = adapter->stats.latecol;
|
||||
netdev->stats.tx_carrier_errors = adapter->stats.tncrs;
|
||||
|
||||
/* Tx Dropped needs to be maintained elsewhere */
|
||||
|
||||
@@ -4640,8 +4639,8 @@ static bool igb_clean_tx_irq(struct igb_ring *tx_ring)
|
||||
tx_ring->total_packets += total_packets;
|
||||
tx_ring->tx_stats.bytes += total_bytes;
|
||||
tx_ring->tx_stats.packets += total_packets;
|
||||
adapter->net_stats.tx_bytes += total_bytes;
|
||||
adapter->net_stats.tx_packets += total_packets;
|
||||
netdev->stats.tx_bytes += total_bytes;
|
||||
netdev->stats.tx_packets += total_packets;
|
||||
return (count < tx_ring->count);
|
||||
}
|
||||
|
||||
@@ -4884,8 +4883,8 @@ next_desc:
|
||||
rx_ring->total_bytes += total_bytes;
|
||||
rx_ring->rx_stats.packets += total_packets;
|
||||
rx_ring->rx_stats.bytes += total_bytes;
|
||||
adapter->net_stats.rx_bytes += total_bytes;
|
||||
adapter->net_stats.rx_packets += total_packets;
|
||||
netdev->stats.rx_bytes += total_bytes;
|
||||
netdev->stats.rx_packets += total_packets;
|
||||
return cleaned;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user