aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorSteffen Klassert <klassert@mathematik.tu-chemnitz.de>2006-02-03 06:03:57 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-02-03 11:32:02 -0500
commit8d1d0340da3fc7d1a8d9198e74e97d2db6c3f86f (patch)
treef2af2677f96339ae550f5c55deb3bb8f259cb854 /drivers/net
parent490d6ab170c94a7a59870f528d765131b8963e79 (diff)
[PATCH] 3c59x: collision statistic fix
Count the total number of packets with collisions during transmission in vp->stats.collisions. Signed-off-by: Steffen Klassert <klassert@mathematik.tu-chemnitz.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/3c59x.c33
1 files changed, 23 insertions, 10 deletions
diff --git a/drivers/net/3c59x.c b/drivers/net/3c59x.c
index 7488ee7f7caf..7f47124f118d 100644
--- a/drivers/net/3c59x.c
+++ b/drivers/net/3c59x.c
@@ -753,9 +753,11 @@ enum tx_desc_status {
753enum ChipCaps { CapBusMaster=0x20, CapPwrMgmt=0x2000 }; 753enum ChipCaps { CapBusMaster=0x20, CapPwrMgmt=0x2000 };
754 754
755struct vortex_extra_stats { 755struct vortex_extra_stats {
756 unsigned long tx_deferred; 756 unsigned long tx_deferred;
757 unsigned long tx_multiple_collisions; 757 unsigned long tx_max_collisions;
758 unsigned long rx_bad_ssd; 758 unsigned long tx_multiple_collisions;
759 unsigned long tx_single_collisions;
760 unsigned long rx_bad_ssd;
759}; 761};
760 762
761struct vortex_private { 763struct vortex_private {
@@ -863,12 +865,14 @@ static struct {
863 const char str[ETH_GSTRING_LEN]; 865 const char str[ETH_GSTRING_LEN];
864} ethtool_stats_keys[] = { 866} ethtool_stats_keys[] = {
865 { "tx_deferred" }, 867 { "tx_deferred" },
868 { "tx_max_collisions" },
866 { "tx_multiple_collisions" }, 869 { "tx_multiple_collisions" },
870 { "tx_single_collisions" },
867 { "rx_bad_ssd" }, 871 { "rx_bad_ssd" },
868}; 872};
869 873
870/* number of ETHTOOL_GSTATS u64's */ 874/* number of ETHTOOL_GSTATS u64's */
871#define VORTEX_NUM_STATS 3 875#define VORTEX_NUM_STATS 5
872 876
873static int vortex_probe1(struct device *gendev, void __iomem *ioaddr, int irq, 877static int vortex_probe1(struct device *gendev, void __iomem *ioaddr, int irq,
874 int chip_idx, int card_idx); 878 int chip_idx, int card_idx);
@@ -2108,9 +2112,12 @@ vortex_error(struct net_device *dev, int status)
2108 iowrite8(0, ioaddr + TxStatus); 2112 iowrite8(0, ioaddr + TxStatus);
2109 if (tx_status & 0x30) { /* txJabber or txUnderrun */ 2113 if (tx_status & 0x30) { /* txJabber or txUnderrun */
2110 do_tx_reset = 1; 2114 do_tx_reset = 1;
2111 } else if ((tx_status & 0x08) && (vp->drv_flags & MAX_COLLISION_RESET)) { /* maxCollisions */ 2115 } else if (tx_status & 0x08) { /* maxCollisions */
2112 do_tx_reset = 1; 2116 vp->xstats.tx_max_collisions++;
2113 reset_mask = 0x0108; /* Reset interface logic, but not download logic */ 2117 if (vp->drv_flags & MAX_COLLISION_RESET) {
2118 do_tx_reset = 1;
2119 reset_mask = 0x0108; /* Reset interface logic, but not download logic */
2120 }
2114 } else { /* Merely re-enable the transmitter. */ 2121 } else { /* Merely re-enable the transmitter. */
2115 iowrite16(TxEnable, ioaddr + EL3_CMD); 2122 iowrite16(TxEnable, ioaddr + EL3_CMD);
2116 } 2123 }
@@ -2926,7 +2933,6 @@ static void update_stats(void __iomem *ioaddr, struct net_device *dev)
2926 EL3WINDOW(6); 2933 EL3WINDOW(6);
2927 vp->stats.tx_carrier_errors += ioread8(ioaddr + 0); 2934 vp->stats.tx_carrier_errors += ioread8(ioaddr + 0);
2928 vp->stats.tx_heartbeat_errors += ioread8(ioaddr + 1); 2935 vp->stats.tx_heartbeat_errors += ioread8(ioaddr + 1);
2929 vp->stats.collisions += ioread8(ioaddr + 3);
2930 vp->stats.tx_window_errors += ioread8(ioaddr + 4); 2936 vp->stats.tx_window_errors += ioread8(ioaddr + 4);
2931 vp->stats.rx_fifo_errors += ioread8(ioaddr + 5); 2937 vp->stats.rx_fifo_errors += ioread8(ioaddr + 5);
2932 vp->stats.tx_packets += ioread8(ioaddr + 6); 2938 vp->stats.tx_packets += ioread8(ioaddr + 6);
@@ -2939,10 +2945,15 @@ static void update_stats(void __iomem *ioaddr, struct net_device *dev)
2939 vp->stats.tx_bytes += ioread16(ioaddr + 12); 2945 vp->stats.tx_bytes += ioread16(ioaddr + 12);
2940 /* Extra stats for get_ethtool_stats() */ 2946 /* Extra stats for get_ethtool_stats() */
2941 vp->xstats.tx_multiple_collisions += ioread8(ioaddr + 2); 2947 vp->xstats.tx_multiple_collisions += ioread8(ioaddr + 2);
2948 vp->xstats.tx_single_collisions += ioread8(ioaddr + 3);
2942 vp->xstats.tx_deferred += ioread8(ioaddr + 8); 2949 vp->xstats.tx_deferred += ioread8(ioaddr + 8);
2943 EL3WINDOW(4); 2950 EL3WINDOW(4);
2944 vp->xstats.rx_bad_ssd += ioread8(ioaddr + 12); 2951 vp->xstats.rx_bad_ssd += ioread8(ioaddr + 12);
2945 2952
2953 vp->stats.collisions = vp->xstats.tx_multiple_collisions
2954 + vp->xstats.tx_single_collisions
2955 + vp->xstats.tx_max_collisions;
2956
2946 { 2957 {
2947 u8 up = ioread8(ioaddr + 13); 2958 u8 up = ioread8(ioaddr + 13);
2948 vp->stats.rx_bytes += (up & 0x0f) << 16; 2959 vp->stats.rx_bytes += (up & 0x0f) << 16;
@@ -3036,8 +3047,10 @@ static void vortex_get_ethtool_stats(struct net_device *dev,
3036 spin_unlock_irqrestore(&vp->lock, flags); 3047 spin_unlock_irqrestore(&vp->lock, flags);
3037 3048
3038 data[0] = vp->xstats.tx_deferred; 3049 data[0] = vp->xstats.tx_deferred;
3039 data[1] = vp->xstats.tx_multiple_collisions; 3050 data[1] = vp->xstats.tx_max_collisions;
3040 data[2] = vp->xstats.rx_bad_ssd; 3051 data[2] = vp->xstats.tx_multiple_collisions;
3052 data[3] = vp->xstats.tx_single_collisions;
3053 data[4] = vp->xstats.rx_bad_ssd;
3041} 3054}
3042 3055
3043 3056