Commit 4711c841 authored by Paulius Zaleckas's avatar Paulius Zaleckas Committed by Jeff Garzik

3c527: use netstats in net_device structure

Use net_device_stats from net_device structure instead of local.
Signed-off-by: default avatarPaulius Zaleckas <paulius.zaleckas@teltonika.lt>
Signed-off-by: default avatarJeff Garzik <jgarzik@redhat.com>
parent aa50911a
...@@ -158,7 +158,6 @@ struct mc32_local ...@@ -158,7 +158,6 @@ struct mc32_local
int slot; int slot;
u32 base; u32 base;
struct net_device_stats net_stats;
volatile struct mc32_mailbox *rx_box; volatile struct mc32_mailbox *rx_box;
volatile struct mc32_mailbox *tx_box; volatile struct mc32_mailbox *tx_box;
volatile struct mc32_mailbox *exec_box; volatile struct mc32_mailbox *exec_box;
...@@ -1093,24 +1092,24 @@ static void mc32_update_stats(struct net_device *dev) ...@@ -1093,24 +1092,24 @@ static void mc32_update_stats(struct net_device *dev)
u32 rx_errors=0; u32 rx_errors=0;
rx_errors+=lp->net_stats.rx_crc_errors +=st->rx_crc_errors; rx_errors+=dev->stats.rx_crc_errors +=st->rx_crc_errors;
st->rx_crc_errors=0; st->rx_crc_errors=0;
rx_errors+=lp->net_stats.rx_fifo_errors +=st->rx_overrun_errors; rx_errors+=dev->stats.rx_fifo_errors +=st->rx_overrun_errors;
st->rx_overrun_errors=0; st->rx_overrun_errors=0;
rx_errors+=lp->net_stats.rx_frame_errors +=st->rx_alignment_errors; rx_errors+=dev->stats.rx_frame_errors +=st->rx_alignment_errors;
st->rx_alignment_errors=0; st->rx_alignment_errors=0;
rx_errors+=lp->net_stats.rx_length_errors+=st->rx_tooshort_errors; rx_errors+=dev->stats.rx_length_errors+=st->rx_tooshort_errors;
st->rx_tooshort_errors=0; st->rx_tooshort_errors=0;
rx_errors+=lp->net_stats.rx_missed_errors+=st->rx_outofresource_errors; rx_errors+=dev->stats.rx_missed_errors+=st->rx_outofresource_errors;
st->rx_outofresource_errors=0; st->rx_outofresource_errors=0;
lp->net_stats.rx_errors=rx_errors; dev->stats.rx_errors=rx_errors;
/* Number of packets which saw one collision */ /* Number of packets which saw one collision */
lp->net_stats.collisions+=st->dataC[10]; dev->stats.collisions+=st->dataC[10];
st->dataC[10]=0; st->dataC[10]=0;
/* Number of packets which saw 2--15 collisions */ /* Number of packets which saw 2--15 collisions */
lp->net_stats.collisions+=st->dataC[11]; dev->stats.collisions+=st->dataC[11];
st->dataC[11]=0; st->dataC[11]=0;
} }
...@@ -1178,7 +1177,7 @@ static void mc32_rx_ring(struct net_device *dev) ...@@ -1178,7 +1177,7 @@ static void mc32_rx_ring(struct net_device *dev)
skb=dev_alloc_skb(length+2); skb=dev_alloc_skb(length+2);
if(skb==NULL) { if(skb==NULL) {
lp->net_stats.rx_dropped++; dev->stats.rx_dropped++;
goto dropped; goto dropped;
} }
...@@ -1189,8 +1188,8 @@ static void mc32_rx_ring(struct net_device *dev) ...@@ -1189,8 +1188,8 @@ static void mc32_rx_ring(struct net_device *dev)
skb->protocol=eth_type_trans(skb,dev); skb->protocol=eth_type_trans(skb,dev);
dev->last_rx = jiffies; dev->last_rx = jiffies;
lp->net_stats.rx_packets++; dev->stats.rx_packets++;
lp->net_stats.rx_bytes += length; dev->stats.rx_bytes += length;
netif_rx(skb); netif_rx(skb);
} }
...@@ -1253,34 +1252,34 @@ static void mc32_tx_ring(struct net_device *dev) ...@@ -1253,34 +1252,34 @@ static void mc32_tx_ring(struct net_device *dev)
/* Not COMPLETED */ /* Not COMPLETED */
break; break;
} }
lp->net_stats.tx_packets++; dev->stats.tx_packets++;
if(!(np->status & (1<<6))) /* Not COMPLETED_OK */ if(!(np->status & (1<<6))) /* Not COMPLETED_OK */
{ {
lp->net_stats.tx_errors++; dev->stats.tx_errors++;
switch(np->status&0x0F) switch(np->status&0x0F)
{ {
case 1: case 1:
lp->net_stats.tx_aborted_errors++; dev->stats.tx_aborted_errors++;
break; /* Max collisions */ break; /* Max collisions */
case 2: case 2:
lp->net_stats.tx_fifo_errors++; dev->stats.tx_fifo_errors++;
break; break;
case 3: case 3:
lp->net_stats.tx_carrier_errors++; dev->stats.tx_carrier_errors++;
break; break;
case 4: case 4:
lp->net_stats.tx_window_errors++; dev->stats.tx_window_errors++;
break; /* CTS Lost */ break; /* CTS Lost */
case 5: case 5:
lp->net_stats.tx_aborted_errors++; dev->stats.tx_aborted_errors++;
break; /* Transmit timeout */ break; /* Transmit timeout */
} }
} }
/* Packets are sent in order - this is /* Packets are sent in order - this is
basically a FIFO queue of buffers matching basically a FIFO queue of buffers matching
the card ring */ the card ring */
lp->net_stats.tx_bytes+=lp->tx_ring[t].skb->len; dev->stats.tx_bytes+=lp->tx_ring[t].skb->len;
dev_kfree_skb_irq(lp->tx_ring[t].skb); dev_kfree_skb_irq(lp->tx_ring[t].skb);
lp->tx_ring[t].skb=NULL; lp->tx_ring[t].skb=NULL;
atomic_inc(&lp->tx_count); atomic_inc(&lp->tx_count);
...@@ -1367,7 +1366,7 @@ static irqreturn_t mc32_interrupt(int irq, void *dev_id) ...@@ -1367,7 +1366,7 @@ static irqreturn_t mc32_interrupt(int irq, void *dev_id)
case 6: case 6:
/* Out of RX buffers stat */ /* Out of RX buffers stat */
/* Must restart rx */ /* Must restart rx */
lp->net_stats.rx_dropped++; dev->stats.rx_dropped++;
mc32_rx_ring(dev); mc32_rx_ring(dev);
mc32_start_transceiver(dev); mc32_start_transceiver(dev);
break; break;
...@@ -1489,10 +1488,8 @@ static int mc32_close(struct net_device *dev) ...@@ -1489,10 +1488,8 @@ static int mc32_close(struct net_device *dev)
static struct net_device_stats *mc32_get_stats(struct net_device *dev) static struct net_device_stats *mc32_get_stats(struct net_device *dev)
{ {
struct mc32_local *lp = netdev_priv(dev);
mc32_update_stats(dev); mc32_update_stats(dev);
return &lp->net_stats; return &dev->stats;
} }
......
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