diff options
author | Sergei Shtylylov <sshtylyov@ru.mvista.com> | 2006-03-22 01:53:52 -0500 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2006-03-22 20:29:29 -0500 |
commit | c2d3d4b938d1a8df4fd4db73427009dfb9e8b225 (patch) | |
tree | f157ea9132098a4223895d8a0774a51255e93b83 /drivers | |
parent | d97381702d3a2f917cfe935fbca1e850a37b984b (diff) |
[PATCH] AMD Au1xx0: fix Ethernet TX stats
With Au1xx0 Ethernet driver, TX bytes/packets always remain zero. The
problem seems to be that when packet has been transmitted, the length word
in DMA buffer is zero.
The patch updates the TX stats when a buffer is fed to DMA. The initial
2.4 patch was posted to linux-mips@linux-mips.org by Thomas Lange 21 Jan
2005.
Signed-off-by: Thomas Lange <thomas@corelatus.se>
Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Cc: Jordan Crouse <jordan.crouse@amd.com>
Cc: Jeff Garzik <jgarzik@pobox.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/au1000_eth.c | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/drivers/net/au1000_eth.c b/drivers/net/au1000_eth.c index cd0b1dccfb61..1363083b4d83 100644 --- a/drivers/net/au1000_eth.c +++ b/drivers/net/au1000_eth.c | |||
@@ -90,8 +90,6 @@ static void au1000_tx_timeout(struct net_device *); | |||
90 | static int au1000_set_config(struct net_device *dev, struct ifmap *map); | 90 | static int au1000_set_config(struct net_device *dev, struct ifmap *map); |
91 | static void set_rx_mode(struct net_device *); | 91 | static void set_rx_mode(struct net_device *); |
92 | static struct net_device_stats *au1000_get_stats(struct net_device *); | 92 | static struct net_device_stats *au1000_get_stats(struct net_device *); |
93 | static inline void update_tx_stats(struct net_device *, u32, u32); | ||
94 | static inline void update_rx_stats(struct net_device *, u32); | ||
95 | static void au1000_timer(unsigned long); | 93 | static void au1000_timer(unsigned long); |
96 | static int au1000_ioctl(struct net_device *, struct ifreq *, int); | 94 | static int au1000_ioctl(struct net_device *, struct ifreq *, int); |
97 | static int mdio_read(struct net_device *, int, int); | 95 | static int mdio_read(struct net_device *, int, int); |
@@ -1825,16 +1823,11 @@ static void __exit au1000_cleanup_module(void) | |||
1825 | } | 1823 | } |
1826 | } | 1824 | } |
1827 | 1825 | ||
1828 | 1826 | static void update_tx_stats(struct net_device *dev, u32 status) | |
1829 | static inline void | ||
1830 | update_tx_stats(struct net_device *dev, u32 status, u32 pkt_len) | ||
1831 | { | 1827 | { |
1832 | struct au1000_private *aup = (struct au1000_private *) dev->priv; | 1828 | struct au1000_private *aup = (struct au1000_private *) dev->priv; |
1833 | struct net_device_stats *ps = &aup->stats; | 1829 | struct net_device_stats *ps = &aup->stats; |
1834 | 1830 | ||
1835 | ps->tx_packets++; | ||
1836 | ps->tx_bytes += pkt_len; | ||
1837 | |||
1838 | if (status & TX_FRAME_ABORTED) { | 1831 | if (status & TX_FRAME_ABORTED) { |
1839 | if (dev->if_port == IF_PORT_100BASEFX) { | 1832 | if (dev->if_port == IF_PORT_100BASEFX) { |
1840 | if (status & (TX_JAB_TIMEOUT | TX_UNDERRUN)) { | 1833 | if (status & (TX_JAB_TIMEOUT | TX_UNDERRUN)) { |
@@ -1867,7 +1860,7 @@ static void au1000_tx_ack(struct net_device *dev) | |||
1867 | ptxd = aup->tx_dma_ring[aup->tx_tail]; | 1860 | ptxd = aup->tx_dma_ring[aup->tx_tail]; |
1868 | 1861 | ||
1869 | while (ptxd->buff_stat & TX_T_DONE) { | 1862 | while (ptxd->buff_stat & TX_T_DONE) { |
1870 | update_tx_stats(dev, ptxd->status, ptxd->len & 0x3ff); | 1863 | update_tx_stats(dev, ptxd->status); |
1871 | ptxd->buff_stat &= ~TX_T_DONE; | 1864 | ptxd->buff_stat &= ~TX_T_DONE; |
1872 | ptxd->len = 0; | 1865 | ptxd->len = 0; |
1873 | au_sync(); | 1866 | au_sync(); |
@@ -1889,6 +1882,7 @@ static void au1000_tx_ack(struct net_device *dev) | |||
1889 | static int au1000_tx(struct sk_buff *skb, struct net_device *dev) | 1882 | static int au1000_tx(struct sk_buff *skb, struct net_device *dev) |
1890 | { | 1883 | { |
1891 | struct au1000_private *aup = (struct au1000_private *) dev->priv; | 1884 | struct au1000_private *aup = (struct au1000_private *) dev->priv; |
1885 | struct net_device_stats *ps = &aup->stats; | ||
1892 | volatile tx_dma_t *ptxd; | 1886 | volatile tx_dma_t *ptxd; |
1893 | u32 buff_stat; | 1887 | u32 buff_stat; |
1894 | db_dest_t *pDB; | 1888 | db_dest_t *pDB; |
@@ -1908,7 +1902,7 @@ static int au1000_tx(struct sk_buff *skb, struct net_device *dev) | |||
1908 | return 1; | 1902 | return 1; |
1909 | } | 1903 | } |
1910 | else if (buff_stat & TX_T_DONE) { | 1904 | else if (buff_stat & TX_T_DONE) { |
1911 | update_tx_stats(dev, ptxd->status, ptxd->len & 0x3ff); | 1905 | update_tx_stats(dev, ptxd->status); |
1912 | ptxd->len = 0; | 1906 | ptxd->len = 0; |
1913 | } | 1907 | } |
1914 | 1908 | ||
@@ -1928,6 +1922,9 @@ static int au1000_tx(struct sk_buff *skb, struct net_device *dev) | |||
1928 | else | 1922 | else |
1929 | ptxd->len = skb->len; | 1923 | ptxd->len = skb->len; |
1930 | 1924 | ||
1925 | ps->tx_packets++; | ||
1926 | ps->tx_bytes += ptxd->len; | ||
1927 | |||
1931 | ptxd->buff_stat = pDB->dma_addr | TX_DMA_ENABLE; | 1928 | ptxd->buff_stat = pDB->dma_addr | TX_DMA_ENABLE; |
1932 | au_sync(); | 1929 | au_sync(); |
1933 | dev_kfree_skb(skb); | 1930 | dev_kfree_skb(skb); |
@@ -1936,7 +1933,6 @@ static int au1000_tx(struct sk_buff *skb, struct net_device *dev) | |||
1936 | return 0; | 1933 | return 0; |
1937 | } | 1934 | } |
1938 | 1935 | ||
1939 | |||
1940 | static inline void update_rx_stats(struct net_device *dev, u32 status) | 1936 | static inline void update_rx_stats(struct net_device *dev, u32 status) |
1941 | { | 1937 | { |
1942 | struct au1000_private *aup = (struct au1000_private *) dev->priv; | 1938 | struct au1000_private *aup = (struct au1000_private *) dev->priv; |