2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-11-20 16:46:23 +08:00

fealnx: Use the instance of net_device_stats from net_device.

Since net_device has an instance of net_device_stats,
we can remove the instance of this from the adapter structure.

Signed-off-by: Kulikov Vasiliy <segooon@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Kulikov Vasiliy 2010-07-05 02:13:36 +00:00 committed by David S. Miller
parent 78e8c5325a
commit d117b66658

View File

@ -382,8 +382,6 @@ struct netdev_private {
spinlock_t lock; spinlock_t lock;
struct net_device_stats stats;
/* Media monitoring timer. */ /* Media monitoring timer. */
struct timer_list timer; struct timer_list timer;
@ -1234,7 +1232,7 @@ static void fealnx_tx_timeout(struct net_device *dev)
spin_unlock_irqrestore(&np->lock, flags); spin_unlock_irqrestore(&np->lock, flags);
dev->trans_start = jiffies; /* prevent tx timeout */ dev->trans_start = jiffies; /* prevent tx timeout */
np->stats.tx_errors++; dev->stats.tx_errors++;
netif_wake_queue(dev); /* or .._start_.. ?? */ netif_wake_queue(dev); /* or .._start_.. ?? */
} }
@ -1479,10 +1477,11 @@ static irqreturn_t intr_handler(int irq, void *dev_instance)
if (intr_status & CNTOVF) { if (intr_status & CNTOVF) {
/* missed pkts */ /* missed pkts */
np->stats.rx_missed_errors += ioread32(ioaddr + TALLY) & 0x7fff; dev->stats.rx_missed_errors +=
ioread32(ioaddr + TALLY) & 0x7fff;
/* crc error */ /* crc error */
np->stats.rx_crc_errors += dev->stats.rx_crc_errors +=
(ioread32(ioaddr + TALLY) & 0x7fff0000) >> 16; (ioread32(ioaddr + TALLY) & 0x7fff0000) >> 16;
} }
@ -1513,30 +1512,30 @@ static irqreturn_t intr_handler(int irq, void *dev_instance)
if (!(np->crvalue & CR_W_ENH)) { if (!(np->crvalue & CR_W_ENH)) {
if (tx_status & (CSL | LC | EC | UDF | HF)) { if (tx_status & (CSL | LC | EC | UDF | HF)) {
np->stats.tx_errors++; dev->stats.tx_errors++;
if (tx_status & EC) if (tx_status & EC)
np->stats.tx_aborted_errors++; dev->stats.tx_aborted_errors++;
if (tx_status & CSL) if (tx_status & CSL)
np->stats.tx_carrier_errors++; dev->stats.tx_carrier_errors++;
if (tx_status & LC) if (tx_status & LC)
np->stats.tx_window_errors++; dev->stats.tx_window_errors++;
if (tx_status & UDF) if (tx_status & UDF)
np->stats.tx_fifo_errors++; dev->stats.tx_fifo_errors++;
if ((tx_status & HF) && np->mii.full_duplex == 0) if ((tx_status & HF) && np->mii.full_duplex == 0)
np->stats.tx_heartbeat_errors++; dev->stats.tx_heartbeat_errors++;
} else { } else {
np->stats.tx_bytes += dev->stats.tx_bytes +=
((tx_control & PKTSMask) >> PKTSShift); ((tx_control & PKTSMask) >> PKTSShift);
np->stats.collisions += dev->stats.collisions +=
((tx_status & NCRMask) >> NCRShift); ((tx_status & NCRMask) >> NCRShift);
np->stats.tx_packets++; dev->stats.tx_packets++;
} }
} else { } else {
np->stats.tx_bytes += dev->stats.tx_bytes +=
((tx_control & PKTSMask) >> PKTSShift); ((tx_control & PKTSMask) >> PKTSShift);
np->stats.tx_packets++; dev->stats.tx_packets++;
} }
/* Free the original skb. */ /* Free the original skb. */
@ -1564,10 +1563,12 @@ static irqreturn_t intr_handler(int irq, void *dev_instance)
long data; long data;
data = ioread32(ioaddr + TSR); data = ioread32(ioaddr + TSR);
np->stats.tx_errors += (data & 0xff000000) >> 24; dev->stats.tx_errors += (data & 0xff000000) >> 24;
np->stats.tx_aborted_errors += (data & 0xff000000) >> 24; dev->stats.tx_aborted_errors +=
np->stats.tx_window_errors += (data & 0x00ff0000) >> 16; (data & 0xff000000) >> 24;
np->stats.collisions += (data & 0x0000ffff); dev->stats.tx_window_errors +=
(data & 0x00ff0000) >> 16;
dev->stats.collisions += (data & 0x0000ffff);
} }
if (--boguscnt < 0) { if (--boguscnt < 0) {
@ -1593,10 +1594,11 @@ static irqreturn_t intr_handler(int irq, void *dev_instance)
/* read the tally counters */ /* read the tally counters */
/* missed pkts */ /* missed pkts */
np->stats.rx_missed_errors += ioread32(ioaddr + TALLY) & 0x7fff; dev->stats.rx_missed_errors += ioread32(ioaddr + TALLY) & 0x7fff;
/* crc error */ /* crc error */
np->stats.rx_crc_errors += (ioread32(ioaddr + TALLY) & 0x7fff0000) >> 16; dev->stats.rx_crc_errors +=
(ioread32(ioaddr + TALLY) & 0x7fff0000) >> 16;
if (debug) if (debug)
printk(KERN_DEBUG "%s: exiting interrupt, status=%#4.4x.\n", printk(KERN_DEBUG "%s: exiting interrupt, status=%#4.4x.\n",
@ -1635,13 +1637,13 @@ static int netdev_rx(struct net_device *dev)
"%s: Receive error, Rx status %8.8x.\n", "%s: Receive error, Rx status %8.8x.\n",
dev->name, rx_status); dev->name, rx_status);
np->stats.rx_errors++; /* end of a packet. */ dev->stats.rx_errors++; /* end of a packet. */
if (rx_status & (LONG | RUNT)) if (rx_status & (LONG | RUNT))
np->stats.rx_length_errors++; dev->stats.rx_length_errors++;
if (rx_status & RXER) if (rx_status & RXER)
np->stats.rx_frame_errors++; dev->stats.rx_frame_errors++;
if (rx_status & CRC) if (rx_status & CRC)
np->stats.rx_crc_errors++; dev->stats.rx_crc_errors++;
} else { } else {
int need_to_reset = 0; int need_to_reset = 0;
int desno = 0; int desno = 0;
@ -1667,7 +1669,7 @@ static int netdev_rx(struct net_device *dev)
if (need_to_reset == 0) { if (need_to_reset == 0) {
int i; int i;
np->stats.rx_length_errors++; dev->stats.rx_length_errors++;
/* free all rx descriptors related this long pkt */ /* free all rx descriptors related this long pkt */
for (i = 0; i < desno; ++i) { for (i = 0; i < desno; ++i) {
@ -1733,8 +1735,8 @@ static int netdev_rx(struct net_device *dev)
} }
skb->protocol = eth_type_trans(skb, dev); skb->protocol = eth_type_trans(skb, dev);
netif_rx(skb); netif_rx(skb);
np->stats.rx_packets++; dev->stats.rx_packets++;
np->stats.rx_bytes += pkt_len; dev->stats.rx_bytes += pkt_len;
} }
np->cur_rx = np->cur_rx->next_desc_logical; np->cur_rx = np->cur_rx->next_desc_logical;
@ -1754,11 +1756,13 @@ static struct net_device_stats *get_stats(struct net_device *dev)
/* The chip only need report frame silently dropped. */ /* The chip only need report frame silently dropped. */
if (netif_running(dev)) { if (netif_running(dev)) {
np->stats.rx_missed_errors += ioread32(ioaddr + TALLY) & 0x7fff; dev->stats.rx_missed_errors +=
np->stats.rx_crc_errors += (ioread32(ioaddr + TALLY) & 0x7fff0000) >> 16; ioread32(ioaddr + TALLY) & 0x7fff;
dev->stats.rx_crc_errors +=
(ioread32(ioaddr + TALLY) & 0x7fff0000) >> 16;
} }
return &np->stats; return &dev->stats;
} }