Commit 5dbfbc40 authored by Tobias Klauser's avatar Tobias Klauser Committed by David S. Miller

ep93xx_eth: Use net_device_stats from struct net_device

struct net_device has its own struct net_device_stats member, so use
this one instead of a private copy in the ep93xx_priv struct. As the new
ndo_get_stats function would just return dev->stats we can omit it.
Signed-off-by: default avatarTobias Klauser <tklauser@distanz.ch>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent b9959c2e
...@@ -175,8 +175,6 @@ struct ep93xx_priv ...@@ -175,8 +175,6 @@ struct ep93xx_priv
struct net_device *dev; struct net_device *dev;
struct napi_struct napi; struct napi_struct napi;
struct net_device_stats stats;
struct mii_if_info mii; struct mii_if_info mii;
u8 mdc_divisor; u8 mdc_divisor;
}; };
...@@ -230,12 +228,6 @@ static void ep93xx_mdio_write(struct net_device *dev, int phy_id, int reg, int d ...@@ -230,12 +228,6 @@ static void ep93xx_mdio_write(struct net_device *dev, int phy_id, int reg, int d
pr_info("mdio write timed out\n"); pr_info("mdio write timed out\n");
} }
static struct net_device_stats *ep93xx_get_stats(struct net_device *dev)
{
struct ep93xx_priv *ep = netdev_priv(dev);
return &(ep->stats);
}
static int ep93xx_rx(struct net_device *dev, int processed, int budget) static int ep93xx_rx(struct net_device *dev, int processed, int budget)
{ {
struct ep93xx_priv *ep = netdev_priv(dev); struct ep93xx_priv *ep = netdev_priv(dev);
...@@ -267,15 +259,15 @@ static int ep93xx_rx(struct net_device *dev, int processed, int budget) ...@@ -267,15 +259,15 @@ static int ep93xx_rx(struct net_device *dev, int processed, int budget)
pr_crit("entry mismatch %.8x %.8x\n", rstat0, rstat1); pr_crit("entry mismatch %.8x %.8x\n", rstat0, rstat1);
if (!(rstat0 & RSTAT0_RWE)) { if (!(rstat0 & RSTAT0_RWE)) {
ep->stats.rx_errors++; dev->stats.rx_errors++;
if (rstat0 & RSTAT0_OE) if (rstat0 & RSTAT0_OE)
ep->stats.rx_fifo_errors++; dev->stats.rx_fifo_errors++;
if (rstat0 & RSTAT0_FE) if (rstat0 & RSTAT0_FE)
ep->stats.rx_frame_errors++; dev->stats.rx_frame_errors++;
if (rstat0 & (RSTAT0_RUNT | RSTAT0_EDATA)) if (rstat0 & (RSTAT0_RUNT | RSTAT0_EDATA))
ep->stats.rx_length_errors++; dev->stats.rx_length_errors++;
if (rstat0 & RSTAT0_CRCE) if (rstat0 & RSTAT0_CRCE)
ep->stats.rx_crc_errors++; dev->stats.rx_crc_errors++;
goto err; goto err;
} }
...@@ -300,10 +292,10 @@ static int ep93xx_rx(struct net_device *dev, int processed, int budget) ...@@ -300,10 +292,10 @@ static int ep93xx_rx(struct net_device *dev, int processed, int budget)
netif_receive_skb(skb); netif_receive_skb(skb);
ep->stats.rx_packets++; dev->stats.rx_packets++;
ep->stats.rx_bytes += length; dev->stats.rx_bytes += length;
} else { } else {
ep->stats.rx_dropped++; dev->stats.rx_dropped++;
} }
err: err:
...@@ -359,7 +351,7 @@ static int ep93xx_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -359,7 +351,7 @@ static int ep93xx_xmit(struct sk_buff *skb, struct net_device *dev)
int entry; int entry;
if (unlikely(skb->len > MAX_PKT_SIZE)) { if (unlikely(skb->len > MAX_PKT_SIZE)) {
ep->stats.tx_dropped++; dev->stats.tx_dropped++;
dev_kfree_skb(skb); dev_kfree_skb(skb);
return NETDEV_TX_OK; return NETDEV_TX_OK;
} }
...@@ -415,17 +407,17 @@ static void ep93xx_tx_complete(struct net_device *dev) ...@@ -415,17 +407,17 @@ static void ep93xx_tx_complete(struct net_device *dev)
if (tstat0 & TSTAT0_TXWE) { if (tstat0 & TSTAT0_TXWE) {
int length = ep->descs->tdesc[entry].tdesc1 & 0xfff; int length = ep->descs->tdesc[entry].tdesc1 & 0xfff;
ep->stats.tx_packets++; dev->stats.tx_packets++;
ep->stats.tx_bytes += length; dev->stats.tx_bytes += length;
} else { } else {
ep->stats.tx_errors++; dev->stats.tx_errors++;
} }
if (tstat0 & TSTAT0_OW) if (tstat0 & TSTAT0_OW)
ep->stats.tx_window_errors++; dev->stats.tx_window_errors++;
if (tstat0 & TSTAT0_TXU) if (tstat0 & TSTAT0_TXU)
ep->stats.tx_fifo_errors++; dev->stats.tx_fifo_errors++;
ep->stats.collisions += (tstat0 >> 16) & 0x1f; dev->stats.collisions += (tstat0 >> 16) & 0x1f;
ep->tx_clean_pointer = (entry + 1) & (TX_QUEUE_ENTRIES - 1); ep->tx_clean_pointer = (entry + 1) & (TX_QUEUE_ENTRIES - 1);
if (ep->tx_pending == TX_QUEUE_ENTRIES) if (ep->tx_pending == TX_QUEUE_ENTRIES)
...@@ -758,7 +750,6 @@ static const struct net_device_ops ep93xx_netdev_ops = { ...@@ -758,7 +750,6 @@ static const struct net_device_ops ep93xx_netdev_ops = {
.ndo_open = ep93xx_open, .ndo_open = ep93xx_open,
.ndo_stop = ep93xx_close, .ndo_stop = ep93xx_close,
.ndo_start_xmit = ep93xx_xmit, .ndo_start_xmit = ep93xx_xmit,
.ndo_get_stats = ep93xx_get_stats,
.ndo_do_ioctl = ep93xx_ioctl, .ndo_do_ioctl = ep93xx_ioctl,
.ndo_validate_addr = eth_validate_addr, .ndo_validate_addr = eth_validate_addr,
.ndo_change_mtu = eth_change_mtu, .ndo_change_mtu = eth_change_mtu,
......
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