Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Ajit Khaparde and committed by
David S. Miller
0cdc0369 bcc90f55

+43 -44
-1
drivers/net/ixgb/ixgb.h
··· 183 183 struct napi_struct napi; 184 184 struct net_device *netdev; 185 185 struct pci_dev *pdev; 186 - struct net_device_stats net_stats; 187 186 188 187 /* structs defined in ixgb_hw.h */ 189 188 struct ixgb_hw hw;
+23 -21
drivers/net/ixgb/ixgb_ethtool.c
··· 42 42 43 43 #define IXGB_STAT(m) FIELD_SIZEOF(struct ixgb_adapter, m), \ 44 44 offsetof(struct ixgb_adapter, m) 45 + #define IXGB_NETDEV_STAT(m) FIELD_SIZEOF(struct net_device, m), \ 46 + offsetof(struct net_device, m) 45 47 static struct ixgb_stats ixgb_gstrings_stats[] = { 46 - {"rx_packets", IXGB_STAT(net_stats.rx_packets)}, 47 - {"tx_packets", IXGB_STAT(net_stats.tx_packets)}, 48 - {"rx_bytes", IXGB_STAT(net_stats.rx_bytes)}, 49 - {"tx_bytes", IXGB_STAT(net_stats.tx_bytes)}, 50 - {"rx_errors", IXGB_STAT(net_stats.rx_errors)}, 51 - {"tx_errors", IXGB_STAT(net_stats.tx_errors)}, 52 - {"rx_dropped", IXGB_STAT(net_stats.rx_dropped)}, 53 - {"tx_dropped", IXGB_STAT(net_stats.tx_dropped)}, 54 - {"multicast", IXGB_STAT(net_stats.multicast)}, 55 - {"collisions", IXGB_STAT(net_stats.collisions)}, 48 + {"rx_packets", IXGB_NETDEV_STAT(stats.rx_packets)}, 49 + {"tx_packets", IXGB_NETDEV_STAT(stats.tx_packets)}, 50 + {"rx_bytes", IXGB_NETDEV_STAT(stats.rx_bytes)}, 51 + {"tx_bytes", IXGB_NETDEV_STAT(stats.tx_bytes)}, 52 + {"rx_errors", IXGB_NETDEV_STAT(stats.rx_errors)}, 53 + {"tx_errors", IXGB_NETDEV_STAT(stats.tx_errors)}, 54 + {"rx_dropped", IXGB_NETDEV_STAT(stats.rx_dropped)}, 55 + {"tx_dropped", IXGB_NETDEV_STAT(stats.tx_dropped)}, 56 + {"multicast", IXGB_NETDEV_STAT(stats.multicast)}, 57 + {"collisions", IXGB_NETDEV_STAT(stats.collisions)}, 56 58 57 - /* { "rx_length_errors", IXGB_STAT(net_stats.rx_length_errors) }, */ 58 - {"rx_over_errors", IXGB_STAT(net_stats.rx_over_errors)}, 59 - {"rx_crc_errors", IXGB_STAT(net_stats.rx_crc_errors)}, 60 - {"rx_frame_errors", IXGB_STAT(net_stats.rx_frame_errors)}, 59 + /* { "rx_length_errors", IXGB_NETDEV_STAT(stats.rx_length_errors) }, */ 60 + {"rx_over_errors", IXGB_NETDEV_STAT(stats.rx_over_errors)}, 61 + {"rx_crc_errors", IXGB_NETDEV_STAT(stats.rx_crc_errors)}, 62 + {"rx_frame_errors", IXGB_NETDEV_STAT(stats.rx_frame_errors)}, 61 63 {"rx_no_buffer_count", IXGB_STAT(stats.rnbc)}, 62 - {"rx_fifo_errors", IXGB_STAT(net_stats.rx_fifo_errors)}, 63 - {"rx_missed_errors", IXGB_STAT(net_stats.rx_missed_errors)}, 64 - {"tx_aborted_errors", IXGB_STAT(net_stats.tx_aborted_errors)}, 65 - {"tx_carrier_errors", IXGB_STAT(net_stats.tx_carrier_errors)}, 66 - {"tx_fifo_errors", IXGB_STAT(net_stats.tx_fifo_errors)}, 67 - {"tx_heartbeat_errors", IXGB_STAT(net_stats.tx_heartbeat_errors)}, 68 - {"tx_window_errors", IXGB_STAT(net_stats.tx_window_errors)}, 64 + {"rx_fifo_errors", IXGB_NETDEV_STAT(stats.rx_fifo_errors)}, 65 + {"rx_missed_errors", IXGB_NETDEV_STAT(stats.rx_missed_errors)}, 66 + {"tx_aborted_errors", IXGB_NETDEV_STAT(stats.tx_aborted_errors)}, 67 + {"tx_carrier_errors", IXGB_NETDEV_STAT(stats.tx_carrier_errors)}, 68 + {"tx_fifo_errors", IXGB_NETDEV_STAT(stats.tx_fifo_errors)}, 69 + {"tx_heartbeat_errors", IXGB_NETDEV_STAT(stats.tx_heartbeat_errors)}, 70 + {"tx_window_errors", IXGB_NETDEV_STAT(stats.tx_window_errors)}, 69 71 {"tx_deferred_ok", IXGB_STAT(stats.dc)}, 70 72 {"tx_timeout_count", IXGB_STAT(tx_timeout_count) }, 71 73 {"tx_restart_queue", IXGB_STAT(restart_queue) },
+20 -22
drivers/net/ixgb/ixgb_main.c
··· 1537 1537 static struct net_device_stats * 1538 1538 ixgb_get_stats(struct net_device *netdev) 1539 1539 { 1540 - struct ixgb_adapter *adapter = netdev_priv(netdev); 1541 - 1542 - return &adapter->net_stats; 1540 + return &netdev->stats; 1543 1541 } 1544 1542 1545 1543 /** ··· 1674 1676 1675 1677 /* Fill out the OS statistics structure */ 1676 1678 1677 - adapter->net_stats.rx_packets = adapter->stats.gprcl; 1678 - adapter->net_stats.tx_packets = adapter->stats.gptcl; 1679 - adapter->net_stats.rx_bytes = adapter->stats.gorcl; 1680 - adapter->net_stats.tx_bytes = adapter->stats.gotcl; 1681 - adapter->net_stats.multicast = adapter->stats.mprcl; 1682 - adapter->net_stats.collisions = 0; 1679 + netdev->stats.rx_packets = adapter->stats.gprcl; 1680 + netdev->stats.tx_packets = adapter->stats.gptcl; 1681 + netdev->stats.rx_bytes = adapter->stats.gorcl; 1682 + netdev->stats.tx_bytes = adapter->stats.gotcl; 1683 + netdev->stats.multicast = adapter->stats.mprcl; 1684 + netdev->stats.collisions = 0; 1683 1685 1684 1686 /* ignore RLEC as it reports errors for padded (<64bytes) frames 1685 1687 * with a length in the type/len field */ 1686 - adapter->net_stats.rx_errors = 1688 + netdev->stats.rx_errors = 1687 1689 /* adapter->stats.rnbc + */ adapter->stats.crcerrs + 1688 1690 adapter->stats.ruc + 1689 1691 adapter->stats.roc /*+ adapter->stats.rlec */ + ··· 1691 1693 adapter->stats.ecbc + adapter->stats.mpc; 1692 1694 1693 1695 /* see above 1694 - * adapter->net_stats.rx_length_errors = adapter->stats.rlec; 1696 + * netdev->stats.rx_length_errors = adapter->stats.rlec; 1695 1697 */ 1696 1698 1697 - adapter->net_stats.rx_crc_errors = adapter->stats.crcerrs; 1698 - adapter->net_stats.rx_fifo_errors = adapter->stats.mpc; 1699 - adapter->net_stats.rx_missed_errors = adapter->stats.mpc; 1700 - adapter->net_stats.rx_over_errors = adapter->stats.mpc; 1699 + netdev->stats.rx_crc_errors = adapter->stats.crcerrs; 1700 + netdev->stats.rx_fifo_errors = adapter->stats.mpc; 1701 + netdev->stats.rx_missed_errors = adapter->stats.mpc; 1702 + netdev->stats.rx_over_errors = adapter->stats.mpc; 1701 1703 1702 - adapter->net_stats.tx_errors = 0; 1703 - adapter->net_stats.rx_frame_errors = 0; 1704 - adapter->net_stats.tx_aborted_errors = 0; 1705 - adapter->net_stats.tx_carrier_errors = 0; 1706 - adapter->net_stats.tx_fifo_errors = 0; 1707 - adapter->net_stats.tx_heartbeat_errors = 0; 1708 - adapter->net_stats.tx_window_errors = 0; 1704 + netdev->stats.tx_errors = 0; 1705 + netdev->stats.rx_frame_errors = 0; 1706 + netdev->stats.tx_aborted_errors = 0; 1707 + netdev->stats.tx_carrier_errors = 0; 1708 + netdev->stats.tx_fifo_errors = 0; 1709 + netdev->stats.tx_heartbeat_errors = 0; 1710 + netdev->stats.tx_window_errors = 0; 1709 1711 } 1710 1712 1711 1713 #define IXGB_MAX_INTR 10