aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorEliezer Tamir <eliezert@broadcom.com>2008-02-28 14:54:03 -0500
committerDavid S. Miller <davem@davemloft.net>2008-02-28 14:54:03 -0500
commit0e39e645b3e83873d59b865df2b671c822e2182c (patch)
tree7a035ad0f87efc29f70a652f9aaf4c5827d9fa54 /drivers
parent49d66772112f40554ba18d037e0601ac3da0bf79 (diff)
[BNX2X]: correct statistics
Errors were summed improperly, some stats were missing. Signed-off-by: Eliezer Tamir <eliezert@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/bnx2x.c164
-rw-r--r--drivers/net/bnx2x.h4
2 files changed, 83 insertions, 85 deletions
diff --git a/drivers/net/bnx2x.c b/drivers/net/bnx2x.c
index 103d3e0f24ba..a35feee513db 100644
--- a/drivers/net/bnx2x.c
+++ b/drivers/net/bnx2x.c
@@ -4972,39 +4972,37 @@ static void bnx2x_update_net_stats(struct bnx2x *bp)
4972 4972
4973 nstats->rx_bytes = bnx2x_hilo(&estats->total_bytes_received_hi); 4973 nstats->rx_bytes = bnx2x_hilo(&estats->total_bytes_received_hi);
4974 4974
4975 nstats->tx_bytes = 4975 nstats->tx_bytes = bnx2x_hilo(&estats->total_bytes_transmitted_hi);
4976 bnx2x_hilo(&estats->total_bytes_transmitted_hi);
4977 4976
4978 nstats->rx_dropped = estats->checksum_discard + 4977 nstats->rx_dropped = estats->checksum_discard + estats->mac_discard;
4979 estats->mac_discard;
4980 nstats->tx_dropped = 0; 4978 nstats->tx_dropped = 0;
4981 4979
4982 nstats->multicast = 4980 nstats->multicast =
4983 bnx2x_hilo(&estats->total_multicast_packets_transmitted_hi); 4981 bnx2x_hilo(&estats->total_multicast_packets_transmitted_hi);
4984 4982
4985 nstats->collisions = 4983 nstats->collisions = estats->single_collision_transmit_frames +
4986 estats->single_collision_transmit_frames + 4984 estats->multiple_collision_transmit_frames +
4987 estats->multiple_collision_transmit_frames + 4985 estats->late_collision_frames +
4988 estats->late_collision_frames + 4986 estats->excessive_collision_frames;
4989 estats->excessive_collision_frames;
4990 4987
4991 nstats->rx_length_errors = estats->runt_packets_received + 4988 nstats->rx_length_errors = estats->runt_packets_received +
4992 estats->jabber_packets_received; 4989 estats->jabber_packets_received;
4993 nstats->rx_over_errors = estats->no_buff_discard; 4990 nstats->rx_over_errors = estats->brb_discard +
4991 estats->brb_truncate_discard;
4994 nstats->rx_crc_errors = estats->crc_receive_errors; 4992 nstats->rx_crc_errors = estats->crc_receive_errors;
4995 nstats->rx_frame_errors = estats->alignment_errors; 4993 nstats->rx_frame_errors = estats->alignment_errors;
4996 nstats->rx_fifo_errors = estats->brb_discard + 4994 nstats->rx_fifo_errors = estats->no_buff_discard;
4997 estats->brb_truncate_discard;
4998 nstats->rx_missed_errors = estats->xxoverflow_discard; 4995 nstats->rx_missed_errors = estats->xxoverflow_discard;
4999 4996
5000 nstats->rx_errors = nstats->rx_length_errors + 4997 nstats->rx_errors = nstats->rx_length_errors +
5001 nstats->rx_over_errors + 4998 nstats->rx_over_errors +
5002 nstats->rx_crc_errors + 4999 nstats->rx_crc_errors +
5003 nstats->rx_frame_errors + 5000 nstats->rx_frame_errors +
5004 nstats->rx_fifo_errors; 5001 nstats->rx_fifo_errors +
5002 nstats->rx_missed_errors;
5005 5003
5006 nstats->tx_aborted_errors = estats->late_collision_frames + 5004 nstats->tx_aborted_errors = estats->late_collision_frames +
5007 estats->excessive_collision_frames; 5005 estats->excessive_collision_frames;
5008 nstats->tx_carrier_errors = estats->false_carrier_detections; 5006 nstats->tx_carrier_errors = estats->false_carrier_detections;
5009 nstats->tx_fifo_errors = 0; 5007 nstats->tx_fifo_errors = 0;
5010 nstats->tx_heartbeat_errors = 0; 5008 nstats->tx_heartbeat_errors = 0;
@@ -8755,81 +8753,87 @@ static void bnx2x_self_test(struct net_device *dev,
8755static struct { 8753static struct {
8756 char string[ETH_GSTRING_LEN]; 8754 char string[ETH_GSTRING_LEN];
8757} bnx2x_stats_str_arr[BNX2X_NUM_STATS] = { 8755} bnx2x_stats_str_arr[BNX2X_NUM_STATS] = {
8758 { "rx_bytes"}, /* 0 */ 8756 { "rx_bytes"},
8759 { "rx_error_bytes"}, /* 1 */ 8757 { "rx_error_bytes"},
8760 { "tx_bytes"}, /* 2 */ 8758 { "tx_bytes"},
8761 { "tx_error_bytes"}, /* 3 */ 8759 { "tx_error_bytes"},
8762 { "rx_ucast_packets"}, /* 4 */ 8760 { "rx_ucast_packets"},
8763 { "rx_mcast_packets"}, /* 5 */ 8761 { "rx_mcast_packets"},
8764 { "rx_bcast_packets"}, /* 6 */ 8762 { "rx_bcast_packets"},
8765 { "tx_ucast_packets"}, /* 7 */ 8763 { "tx_ucast_packets"},
8766 { "tx_mcast_packets"}, /* 8 */ 8764 { "tx_mcast_packets"},
8767 { "tx_bcast_packets"}, /* 9 */ 8765 { "tx_bcast_packets"},
8768 { "tx_mac_errors"}, /* 10 */ 8766 { "tx_mac_errors"}, /* 10 */
8769 { "tx_carrier_errors"}, /* 11 */ 8767 { "tx_carrier_errors"},
8770 { "rx_crc_errors"}, /* 12 */ 8768 { "rx_crc_errors"},
8771 { "rx_align_errors"}, /* 13 */ 8769 { "rx_align_errors"},
8772 { "tx_single_collisions"}, /* 14 */ 8770 { "tx_single_collisions"},
8773 { "tx_multi_collisions"}, /* 15 */ 8771 { "tx_multi_collisions"},
8774 { "tx_deferred"}, /* 16 */ 8772 { "tx_deferred"},
8775 { "tx_excess_collisions"}, /* 17 */ 8773 { "tx_excess_collisions"},
8776 { "tx_late_collisions"}, /* 18 */ 8774 { "tx_late_collisions"},
8777 { "tx_total_collisions"}, /* 19 */ 8775 { "tx_total_collisions"},
8778 { "rx_fragments"}, /* 20 */ 8776 { "rx_fragments"}, /* 20 */
8779 { "rx_jabbers"}, /* 21 */ 8777 { "rx_jabbers"},
8780 { "rx_undersize_packets"}, /* 22 */ 8778 { "rx_undersize_packets"},
8781 { "rx_oversize_packets"}, /* 23 */ 8779 { "rx_oversize_packets"},
8782 { "rx_xon_frames"}, /* 24 */ 8780 { "rx_xon_frames"},
8783 { "rx_xoff_frames"}, /* 25 */ 8781 { "rx_xoff_frames"},
8784 { "tx_xon_frames"}, /* 26 */ 8782 { "tx_xon_frames"},
8785 { "tx_xoff_frames"}, /* 27 */ 8783 { "tx_xoff_frames"},
8786 { "rx_mac_ctrl_frames"}, /* 28 */ 8784 { "rx_mac_ctrl_frames"},
8787 { "rx_filtered_packets"}, /* 29 */ 8785 { "rx_filtered_packets"},
8788 { "rx_discards"}, /* 30 */ 8786 { "rx_discards"}, /* 30 */
8787 { "brb_discard"},
8788 { "brb_truncate"},
8789 { "xxoverflow"}
8789}; 8790};
8790 8791
8791#define STATS_OFFSET32(offset_name) \ 8792#define STATS_OFFSET32(offset_name) \
8792 (offsetof(struct bnx2x_eth_stats, offset_name) / 4) 8793 (offsetof(struct bnx2x_eth_stats, offset_name) / 4)
8793 8794
8794static unsigned long bnx2x_stats_offset_arr[BNX2X_NUM_STATS] = { 8795static unsigned long bnx2x_stats_offset_arr[BNX2X_NUM_STATS] = {
8795 STATS_OFFSET32(total_bytes_received_hi), /* 0 */ 8796 STATS_OFFSET32(total_bytes_received_hi),
8796 STATS_OFFSET32(stat_IfHCInBadOctets_hi), /* 1 */ 8797 STATS_OFFSET32(stat_IfHCInBadOctets_hi),
8797 STATS_OFFSET32(total_bytes_transmitted_hi), /* 2 */ 8798 STATS_OFFSET32(total_bytes_transmitted_hi),
8798 STATS_OFFSET32(stat_IfHCOutBadOctets_hi), /* 3 */ 8799 STATS_OFFSET32(stat_IfHCOutBadOctets_hi),
8799 STATS_OFFSET32(total_unicast_packets_received_hi), /* 4 */ 8800 STATS_OFFSET32(total_unicast_packets_received_hi),
8800 STATS_OFFSET32(total_multicast_packets_received_hi), /* 5 */ 8801 STATS_OFFSET32(total_multicast_packets_received_hi),
8801 STATS_OFFSET32(total_broadcast_packets_received_hi), /* 6 */ 8802 STATS_OFFSET32(total_broadcast_packets_received_hi),
8802 STATS_OFFSET32(total_unicast_packets_transmitted_hi), /* 7 */ 8803 STATS_OFFSET32(total_unicast_packets_transmitted_hi),
8803 STATS_OFFSET32(total_multicast_packets_transmitted_hi), /* 8 */ 8804 STATS_OFFSET32(total_multicast_packets_transmitted_hi),
8804 STATS_OFFSET32(total_broadcast_packets_transmitted_hi), /* 9 */ 8805 STATS_OFFSET32(total_broadcast_packets_transmitted_hi),
8805 STATS_OFFSET32(stat_Dot3statsInternalMacTransmitErrors), /* 10 */ 8806 STATS_OFFSET32(stat_Dot3statsInternalMacTransmitErrors), /* 10 */
8806 STATS_OFFSET32(stat_Dot3StatsCarrierSenseErrors), /* 11 */ 8807 STATS_OFFSET32(stat_Dot3StatsCarrierSenseErrors),
8807 STATS_OFFSET32(crc_receive_errors), /* 12 */ 8808 STATS_OFFSET32(crc_receive_errors),
8808 STATS_OFFSET32(alignment_errors), /* 13 */ 8809 STATS_OFFSET32(alignment_errors),
8809 STATS_OFFSET32(single_collision_transmit_frames), /* 14 */ 8810 STATS_OFFSET32(single_collision_transmit_frames),
8810 STATS_OFFSET32(multiple_collision_transmit_frames), /* 15 */ 8811 STATS_OFFSET32(multiple_collision_transmit_frames),
8811 STATS_OFFSET32(stat_Dot3StatsDeferredTransmissions), /* 16 */ 8812 STATS_OFFSET32(stat_Dot3StatsDeferredTransmissions),
8812 STATS_OFFSET32(excessive_collision_frames), /* 17 */ 8813 STATS_OFFSET32(excessive_collision_frames),
8813 STATS_OFFSET32(late_collision_frames), /* 18 */ 8814 STATS_OFFSET32(late_collision_frames),
8814 STATS_OFFSET32(number_of_bugs_found_in_stats_spec), /* 19 */ 8815 STATS_OFFSET32(number_of_bugs_found_in_stats_spec),
8815 STATS_OFFSET32(runt_packets_received), /* 20 */ 8816 STATS_OFFSET32(runt_packets_received), /* 20 */
8816 STATS_OFFSET32(jabber_packets_received), /* 21 */ 8817 STATS_OFFSET32(jabber_packets_received),
8817 STATS_OFFSET32(error_runt_packets_received), /* 22 */ 8818 STATS_OFFSET32(error_runt_packets_received),
8818 STATS_OFFSET32(error_jabber_packets_received), /* 23 */ 8819 STATS_OFFSET32(error_jabber_packets_received),
8819 STATS_OFFSET32(pause_xon_frames_received), /* 24 */ 8820 STATS_OFFSET32(pause_xon_frames_received),
8820 STATS_OFFSET32(pause_xoff_frames_received), /* 25 */ 8821 STATS_OFFSET32(pause_xoff_frames_received),
8821 STATS_OFFSET32(pause_xon_frames_transmitted), /* 26 */ 8822 STATS_OFFSET32(pause_xon_frames_transmitted),
8822 STATS_OFFSET32(pause_xoff_frames_transmitted), /* 27 */ 8823 STATS_OFFSET32(pause_xoff_frames_transmitted),
8823 STATS_OFFSET32(control_frames_received), /* 28 */ 8824 STATS_OFFSET32(control_frames_received),
8824 STATS_OFFSET32(mac_filter_discard), /* 29 */ 8825 STATS_OFFSET32(mac_filter_discard),
8825 STATS_OFFSET32(no_buff_discard), /* 30 */ 8826 STATS_OFFSET32(no_buff_discard), /* 30 */
8827 STATS_OFFSET32(brb_discard),
8828 STATS_OFFSET32(brb_truncate_discard),
8829 STATS_OFFSET32(xxoverflow_discard)
8826}; 8830};
8827 8831
8828static u8 bnx2x_stats_len_arr[BNX2X_NUM_STATS] = { 8832static u8 bnx2x_stats_len_arr[BNX2X_NUM_STATS] = {
8829 8, 0, 8, 0, 8, 8, 8, 8, 8, 8, 8833 8, 0, 8, 0, 8, 8, 8, 8, 8, 8,
8830 4, 0, 4, 4, 4, 4, 4, 4, 4, 4, 8834 4, 0, 4, 4, 4, 4, 4, 4, 4, 4,
8831 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 8835 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
8832 4, 8836 4, 4, 4, 4
8833}; 8837};
8834 8838
8835static void bnx2x_get_strings(struct net_device *dev, u32 stringset, u8 *buf) 8839static void bnx2x_get_strings(struct net_device *dev, u32 stringset, u8 *buf)
@@ -9372,11 +9376,6 @@ static int bnx2x_start_xmit(struct sk_buff *skb, struct net_device *dev)
9372 return NETDEV_TX_OK; 9376 return NETDEV_TX_OK;
9373} 9377}
9374 9378
9375static struct net_device_stats *bnx2x_get_stats(struct net_device *dev)
9376{
9377 return &dev->stats;
9378}
9379
9380/* Called with rtnl_lock */ 9379/* Called with rtnl_lock */
9381static int bnx2x_open(struct net_device *dev) 9380static int bnx2x_open(struct net_device *dev)
9382{ 9381{
@@ -9784,7 +9783,6 @@ static int __devinit bnx2x_init_one(struct pci_dev *pdev,
9784 dev->hard_start_xmit = bnx2x_start_xmit; 9783 dev->hard_start_xmit = bnx2x_start_xmit;
9785 dev->watchdog_timeo = TX_TIMEOUT; 9784 dev->watchdog_timeo = TX_TIMEOUT;
9786 9785
9787 dev->get_stats = bnx2x_get_stats;
9788 dev->ethtool_ops = &bnx2x_ethtool_ops; 9786 dev->ethtool_ops = &bnx2x_ethtool_ops;
9789 dev->open = bnx2x_open; 9787 dev->open = bnx2x_open;
9790 dev->stop = bnx2x_close; 9788 dev->stop = bnx2x_close;
diff --git a/drivers/net/bnx2x.h b/drivers/net/bnx2x.h
index d0e5ab1af444..e2a36e850fc2 100644
--- a/drivers/net/bnx2x.h
+++ b/drivers/net/bnx2x.h
@@ -854,8 +854,8 @@ struct bnx2x {
854#define MAX_SPQ_PENDING 8 854#define MAX_SPQ_PENDING 8
855 855
856 856
857#define BNX2X_NUM_STATS 31 857#define BNX2X_NUM_STATS 34
858#define BNX2X_NUM_TESTS 2 858#define BNX2X_NUM_TESTS 1
859 859
860 860
861#define DPM_TRIGER_TYPE 0x40 861#define DPM_TRIGER_TYPE 0x40