Commit 264fd77a authored by Tobias Klauser's avatar Tobias Klauser Committed by David S. Miller

am79c961a: Use net_device_stats from struct net_device

struct net_device has its own struct net_device_stats member, so we can
use this one instead of a private copy in the dev_priv struct.

Cc: Kulikov Vasiliy <segooon@gmail.com>
Signed-off-by: default avatarTobias Klauser <tklauser@distanz.ch>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 2154c704
...@@ -300,8 +300,6 @@ am79c961_open(struct net_device *dev) ...@@ -300,8 +300,6 @@ am79c961_open(struct net_device *dev)
struct dev_priv *priv = netdev_priv(dev); struct dev_priv *priv = netdev_priv(dev);
int ret; int ret;
memset (&priv->stats, 0, sizeof (priv->stats));
ret = request_irq(dev->irq, am79c961_interrupt, 0, dev->name, dev); ret = request_irq(dev->irq, am79c961_interrupt, 0, dev->name, dev);
if (ret) if (ret)
return ret; return ret;
...@@ -347,8 +345,7 @@ am79c961_close(struct net_device *dev) ...@@ -347,8 +345,7 @@ am79c961_close(struct net_device *dev)
*/ */
static struct net_device_stats *am79c961_getstats (struct net_device *dev) static struct net_device_stats *am79c961_getstats (struct net_device *dev)
{ {
struct dev_priv *priv = netdev_priv(dev); return &dev->stats;
return &priv->stats;
} }
static void am79c961_mc_hash(char *addr, unsigned short *hash) static void am79c961_mc_hash(char *addr, unsigned short *hash)
...@@ -510,14 +507,14 @@ am79c961_rx(struct net_device *dev, struct dev_priv *priv) ...@@ -510,14 +507,14 @@ am79c961_rx(struct net_device *dev, struct dev_priv *priv)
if ((status & (RMD_ERR|RMD_STP|RMD_ENP)) != (RMD_STP|RMD_ENP)) { if ((status & (RMD_ERR|RMD_STP|RMD_ENP)) != (RMD_STP|RMD_ENP)) {
am_writeword (dev, hdraddr + 2, RMD_OWN); am_writeword (dev, hdraddr + 2, RMD_OWN);
priv->stats.rx_errors ++; dev->stats.rx_errors++;
if (status & RMD_ERR) { if (status & RMD_ERR) {
if (status & RMD_FRAM) if (status & RMD_FRAM)
priv->stats.rx_frame_errors ++; dev->stats.rx_frame_errors++;
if (status & RMD_CRC) if (status & RMD_CRC)
priv->stats.rx_crc_errors ++; dev->stats.rx_crc_errors++;
} else if (status & RMD_STP) } else if (status & RMD_STP)
priv->stats.rx_length_errors ++; dev->stats.rx_length_errors++;
continue; continue;
} }
...@@ -531,12 +528,12 @@ am79c961_rx(struct net_device *dev, struct dev_priv *priv) ...@@ -531,12 +528,12 @@ am79c961_rx(struct net_device *dev, struct dev_priv *priv)
am_writeword(dev, hdraddr + 2, RMD_OWN); am_writeword(dev, hdraddr + 2, RMD_OWN);
skb->protocol = eth_type_trans(skb, dev); skb->protocol = eth_type_trans(skb, dev);
netif_rx(skb); netif_rx(skb);
priv->stats.rx_bytes += len; dev->stats.rx_bytes += len;
priv->stats.rx_packets ++; dev->stats.rx_packets++;
} else { } else {
am_writeword (dev, hdraddr + 2, RMD_OWN); am_writeword (dev, hdraddr + 2, RMD_OWN);
printk (KERN_WARNING "%s: memory squeeze, dropping packet.\n", dev->name); printk (KERN_WARNING "%s: memory squeeze, dropping packet.\n", dev->name);
priv->stats.rx_dropped ++; dev->stats.rx_dropped++;
break; break;
} }
} while (1); } while (1);
...@@ -565,7 +562,7 @@ am79c961_tx(struct net_device *dev, struct dev_priv *priv) ...@@ -565,7 +562,7 @@ am79c961_tx(struct net_device *dev, struct dev_priv *priv)
if (status & TMD_ERR) { if (status & TMD_ERR) {
u_int status2; u_int status2;
priv->stats.tx_errors ++; dev->stats.tx_errors++;
status2 = am_readword (dev, hdraddr + 6); status2 = am_readword (dev, hdraddr + 6);
...@@ -575,18 +572,18 @@ am79c961_tx(struct net_device *dev, struct dev_priv *priv) ...@@ -575,18 +572,18 @@ am79c961_tx(struct net_device *dev, struct dev_priv *priv)
am_writeword (dev, hdraddr + 6, 0); am_writeword (dev, hdraddr + 6, 0);
if (status2 & TST_RTRY) if (status2 & TST_RTRY)
priv->stats.collisions += 16; dev->stats.collisions += 16;
if (status2 & TST_LCOL) if (status2 & TST_LCOL)
priv->stats.tx_window_errors ++; dev->stats.tx_window_errors++;
if (status2 & TST_LCAR) if (status2 & TST_LCAR)
priv->stats.tx_carrier_errors ++; dev->stats.tx_carrier_errors++;
if (status2 & TST_UFLO) if (status2 & TST_UFLO)
priv->stats.tx_fifo_errors ++; dev->stats.tx_fifo_errors++;
continue; continue;
} }
priv->stats.tx_packets ++; dev->stats.tx_packets++;
len = am_readword (dev, hdraddr + 4); len = am_readword (dev, hdraddr + 4);
priv->stats.tx_bytes += -len; dev->stats.tx_bytes += -len;
} while (priv->txtail != priv->txhead); } while (priv->txtail != priv->txhead);
netif_wake_queue(dev); netif_wake_queue(dev);
...@@ -616,7 +613,7 @@ am79c961_interrupt(int irq, void *dev_id) ...@@ -616,7 +613,7 @@ am79c961_interrupt(int irq, void *dev_id)
} }
if (status & CSR0_MISS) { if (status & CSR0_MISS) {
handled = 1; handled = 1;
priv->stats.rx_dropped ++; dev->stats.rx_dropped++;
} }
if (status & CSR0_CERR) { if (status & CSR0_CERR) {
handled = 1; handled = 1;
......
...@@ -130,7 +130,6 @@ ...@@ -130,7 +130,6 @@
#define ISALED0_LNKST 0x8000 #define ISALED0_LNKST 0x8000
struct dev_priv { struct dev_priv {
struct net_device_stats stats;
unsigned long rxbuffer[RX_BUFFERS]; unsigned long rxbuffer[RX_BUFFERS];
unsigned long txbuffer[TX_BUFFERS]; unsigned long txbuffer[TX_BUFFERS];
unsigned char txhead; unsigned char txhead;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment