ixgb: 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 private adapter structure. Signed-off-by: Ajit Khaparde <ajitk@serverengines.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
bcc90f555b
commit
0cdc03698f
3 changed files with 43 additions and 44 deletions
|
@ -183,7 +183,6 @@ struct ixgb_adapter {
|
||||||
struct napi_struct napi;
|
struct napi_struct napi;
|
||||||
struct net_device *netdev;
|
struct net_device *netdev;
|
||||||
struct pci_dev *pdev;
|
struct pci_dev *pdev;
|
||||||
struct net_device_stats net_stats;
|
|
||||||
|
|
||||||
/* structs defined in ixgb_hw.h */
|
/* structs defined in ixgb_hw.h */
|
||||||
struct ixgb_hw hw;
|
struct ixgb_hw hw;
|
||||||
|
|
|
@ -42,30 +42,32 @@ struct ixgb_stats {
|
||||||
|
|
||||||
#define IXGB_STAT(m) FIELD_SIZEOF(struct ixgb_adapter, m), \
|
#define IXGB_STAT(m) FIELD_SIZEOF(struct ixgb_adapter, m), \
|
||||||
offsetof(struct ixgb_adapter, m)
|
offsetof(struct ixgb_adapter, m)
|
||||||
|
#define IXGB_NETDEV_STAT(m) FIELD_SIZEOF(struct net_device, m), \
|
||||||
|
offsetof(struct net_device, m)
|
||||||
static struct ixgb_stats ixgb_gstrings_stats[] = {
|
static struct ixgb_stats ixgb_gstrings_stats[] = {
|
||||||
{"rx_packets", IXGB_STAT(net_stats.rx_packets)},
|
{"rx_packets", IXGB_NETDEV_STAT(stats.rx_packets)},
|
||||||
{"tx_packets", IXGB_STAT(net_stats.tx_packets)},
|
{"tx_packets", IXGB_NETDEV_STAT(stats.tx_packets)},
|
||||||
{"rx_bytes", IXGB_STAT(net_stats.rx_bytes)},
|
{"rx_bytes", IXGB_NETDEV_STAT(stats.rx_bytes)},
|
||||||
{"tx_bytes", IXGB_STAT(net_stats.tx_bytes)},
|
{"tx_bytes", IXGB_NETDEV_STAT(stats.tx_bytes)},
|
||||||
{"rx_errors", IXGB_STAT(net_stats.rx_errors)},
|
{"rx_errors", IXGB_NETDEV_STAT(stats.rx_errors)},
|
||||||
{"tx_errors", IXGB_STAT(net_stats.tx_errors)},
|
{"tx_errors", IXGB_NETDEV_STAT(stats.tx_errors)},
|
||||||
{"rx_dropped", IXGB_STAT(net_stats.rx_dropped)},
|
{"rx_dropped", IXGB_NETDEV_STAT(stats.rx_dropped)},
|
||||||
{"tx_dropped", IXGB_STAT(net_stats.tx_dropped)},
|
{"tx_dropped", IXGB_NETDEV_STAT(stats.tx_dropped)},
|
||||||
{"multicast", IXGB_STAT(net_stats.multicast)},
|
{"multicast", IXGB_NETDEV_STAT(stats.multicast)},
|
||||||
{"collisions", IXGB_STAT(net_stats.collisions)},
|
{"collisions", IXGB_NETDEV_STAT(stats.collisions)},
|
||||||
|
|
||||||
/* { "rx_length_errors", IXGB_STAT(net_stats.rx_length_errors) }, */
|
/* { "rx_length_errors", IXGB_NETDEV_STAT(stats.rx_length_errors) }, */
|
||||||
{"rx_over_errors", IXGB_STAT(net_stats.rx_over_errors)},
|
{"rx_over_errors", IXGB_NETDEV_STAT(stats.rx_over_errors)},
|
||||||
{"rx_crc_errors", IXGB_STAT(net_stats.rx_crc_errors)},
|
{"rx_crc_errors", IXGB_NETDEV_STAT(stats.rx_crc_errors)},
|
||||||
{"rx_frame_errors", IXGB_STAT(net_stats.rx_frame_errors)},
|
{"rx_frame_errors", IXGB_NETDEV_STAT(stats.rx_frame_errors)},
|
||||||
{"rx_no_buffer_count", IXGB_STAT(stats.rnbc)},
|
{"rx_no_buffer_count", IXGB_STAT(stats.rnbc)},
|
||||||
{"rx_fifo_errors", IXGB_STAT(net_stats.rx_fifo_errors)},
|
{"rx_fifo_errors", IXGB_NETDEV_STAT(stats.rx_fifo_errors)},
|
||||||
{"rx_missed_errors", IXGB_STAT(net_stats.rx_missed_errors)},
|
{"rx_missed_errors", IXGB_NETDEV_STAT(stats.rx_missed_errors)},
|
||||||
{"tx_aborted_errors", IXGB_STAT(net_stats.tx_aborted_errors)},
|
{"tx_aborted_errors", IXGB_NETDEV_STAT(stats.tx_aborted_errors)},
|
||||||
{"tx_carrier_errors", IXGB_STAT(net_stats.tx_carrier_errors)},
|
{"tx_carrier_errors", IXGB_NETDEV_STAT(stats.tx_carrier_errors)},
|
||||||
{"tx_fifo_errors", IXGB_STAT(net_stats.tx_fifo_errors)},
|
{"tx_fifo_errors", IXGB_NETDEV_STAT(stats.tx_fifo_errors)},
|
||||||
{"tx_heartbeat_errors", IXGB_STAT(net_stats.tx_heartbeat_errors)},
|
{"tx_heartbeat_errors", IXGB_NETDEV_STAT(stats.tx_heartbeat_errors)},
|
||||||
{"tx_window_errors", IXGB_STAT(net_stats.tx_window_errors)},
|
{"tx_window_errors", IXGB_NETDEV_STAT(stats.tx_window_errors)},
|
||||||
{"tx_deferred_ok", IXGB_STAT(stats.dc)},
|
{"tx_deferred_ok", IXGB_STAT(stats.dc)},
|
||||||
{"tx_timeout_count", IXGB_STAT(tx_timeout_count) },
|
{"tx_timeout_count", IXGB_STAT(tx_timeout_count) },
|
||||||
{"tx_restart_queue", IXGB_STAT(restart_queue) },
|
{"tx_restart_queue", IXGB_STAT(restart_queue) },
|
||||||
|
|
|
@ -1537,9 +1537,7 @@ ixgb_tx_timeout_task(struct work_struct *work)
|
||||||
static struct net_device_stats *
|
static struct net_device_stats *
|
||||||
ixgb_get_stats(struct net_device *netdev)
|
ixgb_get_stats(struct net_device *netdev)
|
||||||
{
|
{
|
||||||
struct ixgb_adapter *adapter = netdev_priv(netdev);
|
return &netdev->stats;
|
||||||
|
|
||||||
return &adapter->net_stats;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1676,16 +1674,16 @@ ixgb_update_stats(struct ixgb_adapter *adapter)
|
||||||
|
|
||||||
/* Fill out the OS statistics structure */
|
/* Fill out the OS statistics structure */
|
||||||
|
|
||||||
adapter->net_stats.rx_packets = adapter->stats.gprcl;
|
netdev->stats.rx_packets = adapter->stats.gprcl;
|
||||||
adapter->net_stats.tx_packets = adapter->stats.gptcl;
|
netdev->stats.tx_packets = adapter->stats.gptcl;
|
||||||
adapter->net_stats.rx_bytes = adapter->stats.gorcl;
|
netdev->stats.rx_bytes = adapter->stats.gorcl;
|
||||||
adapter->net_stats.tx_bytes = adapter->stats.gotcl;
|
netdev->stats.tx_bytes = adapter->stats.gotcl;
|
||||||
adapter->net_stats.multicast = adapter->stats.mprcl;
|
netdev->stats.multicast = adapter->stats.mprcl;
|
||||||
adapter->net_stats.collisions = 0;
|
netdev->stats.collisions = 0;
|
||||||
|
|
||||||
/* ignore RLEC as it reports errors for padded (<64bytes) frames
|
/* ignore RLEC as it reports errors for padded (<64bytes) frames
|
||||||
* with a length in the type/len field */
|
* with a length in the type/len field */
|
||||||
adapter->net_stats.rx_errors =
|
netdev->stats.rx_errors =
|
||||||
/* adapter->stats.rnbc + */ adapter->stats.crcerrs +
|
/* adapter->stats.rnbc + */ adapter->stats.crcerrs +
|
||||||
adapter->stats.ruc +
|
adapter->stats.ruc +
|
||||||
adapter->stats.roc /*+ adapter->stats.rlec */ +
|
adapter->stats.roc /*+ adapter->stats.rlec */ +
|
||||||
|
@ -1693,21 +1691,21 @@ ixgb_update_stats(struct ixgb_adapter *adapter)
|
||||||
adapter->stats.ecbc + adapter->stats.mpc;
|
adapter->stats.ecbc + adapter->stats.mpc;
|
||||||
|
|
||||||
/* see above
|
/* see above
|
||||||
* adapter->net_stats.rx_length_errors = adapter->stats.rlec;
|
* netdev->stats.rx_length_errors = adapter->stats.rlec;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
adapter->net_stats.rx_crc_errors = adapter->stats.crcerrs;
|
netdev->stats.rx_crc_errors = adapter->stats.crcerrs;
|
||||||
adapter->net_stats.rx_fifo_errors = adapter->stats.mpc;
|
netdev->stats.rx_fifo_errors = adapter->stats.mpc;
|
||||||
adapter->net_stats.rx_missed_errors = adapter->stats.mpc;
|
netdev->stats.rx_missed_errors = adapter->stats.mpc;
|
||||||
adapter->net_stats.rx_over_errors = adapter->stats.mpc;
|
netdev->stats.rx_over_errors = adapter->stats.mpc;
|
||||||
|
|
||||||
adapter->net_stats.tx_errors = 0;
|
netdev->stats.tx_errors = 0;
|
||||||
adapter->net_stats.rx_frame_errors = 0;
|
netdev->stats.rx_frame_errors = 0;
|
||||||
adapter->net_stats.tx_aborted_errors = 0;
|
netdev->stats.tx_aborted_errors = 0;
|
||||||
adapter->net_stats.tx_carrier_errors = 0;
|
netdev->stats.tx_carrier_errors = 0;
|
||||||
adapter->net_stats.tx_fifo_errors = 0;
|
netdev->stats.tx_fifo_errors = 0;
|
||||||
adapter->net_stats.tx_heartbeat_errors = 0;
|
netdev->stats.tx_heartbeat_errors = 0;
|
||||||
adapter->net_stats.tx_window_errors = 0;
|
netdev->stats.tx_window_errors = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define IXGB_MAX_INTR 10
|
#define IXGB_MAX_INTR 10
|
||||||
|
|
Loading…
Add table
Reference in a new issue