Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7bfba0b0 authored by Kulikov Vasiliy's avatar Kulikov Vasiliy Committed by David S. Miller
Browse files

lance: 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: default avatarKulikov Vasiliy <segooon@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent ad6f84b4
Loading
Loading
Loading
Loading
+32 −24
Original line number Original line Diff line number Diff line
@@ -248,7 +248,6 @@ struct lance_private {
	int cur_rx, cur_tx;			/* The next free ring entry */
	int cur_rx, cur_tx;			/* The next free ring entry */
	int dirty_rx, dirty_tx;		/* The ring entries to be free()ed. */
	int dirty_rx, dirty_tx;		/* The ring entries to be free()ed. */
	int dma;
	int dma;
	struct net_device_stats stats;
	unsigned char chip_version;	/* See lance_chip_type. */
	unsigned char chip_version;	/* See lance_chip_type. */
	spinlock_t devlock;
	spinlock_t devlock;
};
};
@@ -925,7 +924,7 @@ static void lance_tx_timeout (struct net_device *dev)
	printk ("%s: transmit timed out, status %4.4x, resetting.\n",
	printk ("%s: transmit timed out, status %4.4x, resetting.\n",
		dev->name, inw (ioaddr + LANCE_DATA));
		dev->name, inw (ioaddr + LANCE_DATA));
	outw (0x0004, ioaddr + LANCE_DATA);
	outw (0x0004, ioaddr + LANCE_DATA);
	lp->stats.tx_errors++;
	dev->stats.tx_errors++;
#ifndef final_version
#ifndef final_version
	if (lance_debug > 3) {
	if (lance_debug > 3) {
		int i;
		int i;
@@ -989,7 +988,7 @@ static netdev_tx_t lance_start_xmit(struct sk_buff *skb,


	lp->tx_ring[entry].misc = 0x0000;
	lp->tx_ring[entry].misc = 0x0000;


	lp->stats.tx_bytes += skb->len;
	dev->stats.tx_bytes += skb->len;


	/* If any part of this buffer is >16M we must copy it to a low-memory
	/* If any part of this buffer is >16M we must copy it to a low-memory
	   buffer. */
	   buffer. */
@@ -1062,13 +1061,16 @@ static irqreturn_t lance_interrupt(int irq, void *dev_id)
				if (status & 0x40000000) {
				if (status & 0x40000000) {
					/* There was an major error, log it. */
					/* There was an major error, log it. */
					int err_status = lp->tx_ring[entry].misc;
					int err_status = lp->tx_ring[entry].misc;
					lp->stats.tx_errors++;
					dev->stats.tx_errors++;
					if (err_status & 0x0400) lp->stats.tx_aborted_errors++;
					if (err_status & 0x0400)
					if (err_status & 0x0800) lp->stats.tx_carrier_errors++;
						dev->stats.tx_aborted_errors++;
					if (err_status & 0x1000) lp->stats.tx_window_errors++;
					if (err_status & 0x0800)
						dev->stats.tx_carrier_errors++;
					if (err_status & 0x1000)
						dev->stats.tx_window_errors++;
					if (err_status & 0x4000) {
					if (err_status & 0x4000) {
						/* Ackk!  On FIFO errors the Tx unit is turned off! */
						/* Ackk!  On FIFO errors the Tx unit is turned off! */
						lp->stats.tx_fifo_errors++;
						dev->stats.tx_fifo_errors++;
						/* Remove this verbosity later! */
						/* Remove this verbosity later! */
						printk("%s: Tx FIFO error! Status %4.4x.\n",
						printk("%s: Tx FIFO error! Status %4.4x.\n",
							   dev->name, csr0);
							   dev->name, csr0);
@@ -1077,8 +1079,8 @@ static irqreturn_t lance_interrupt(int irq, void *dev_id)
					}
					}
				} else {
				} else {
					if (status & 0x18000000)
					if (status & 0x18000000)
						lp->stats.collisions++;
						dev->stats.collisions++;
					lp->stats.tx_packets++;
					dev->stats.tx_packets++;
				}
				}


				/* We must free the original skb if it's not a data-only copy
				/* We must free the original skb if it's not a data-only copy
@@ -1108,8 +1110,10 @@ static irqreturn_t lance_interrupt(int irq, void *dev_id)
		}
		}


		/* Log misc errors. */
		/* Log misc errors. */
		if (csr0 & 0x4000) lp->stats.tx_errors++; /* Tx babble. */
		if (csr0 & 0x4000)
		if (csr0 & 0x1000) lp->stats.rx_errors++; /* Missed a Rx frame. */
			dev->stats.tx_errors++; /* Tx babble. */
		if (csr0 & 0x1000)
			dev->stats.rx_errors++; /* Missed a Rx frame. */
		if (csr0 & 0x0800) {
		if (csr0 & 0x0800) {
			printk("%s: Bus master arbitration failure, status %4.4x.\n",
			printk("%s: Bus master arbitration failure, status %4.4x.\n",
				   dev->name, csr0);
				   dev->name, csr0);
@@ -1155,11 +1159,15 @@ lance_rx(struct net_device *dev)
			   buffers it's possible for a jabber packet to use two
			   buffers it's possible for a jabber packet to use two
			   buffers, with only the last correctly noting the error. */
			   buffers, with only the last correctly noting the error. */
			if (status & 0x01)	/* Only count a general error at the */
			if (status & 0x01)	/* Only count a general error at the */
				lp->stats.rx_errors++; /* end of a packet.*/
				dev->stats.rx_errors++; /* end of a packet.*/
			if (status & 0x20) lp->stats.rx_frame_errors++;
			if (status & 0x20)
			if (status & 0x10) lp->stats.rx_over_errors++;
				dev->stats.rx_frame_errors++;
			if (status & 0x08) lp->stats.rx_crc_errors++;
			if (status & 0x10)
			if (status & 0x04) lp->stats.rx_fifo_errors++;
				dev->stats.rx_over_errors++;
			if (status & 0x08)
				dev->stats.rx_crc_errors++;
			if (status & 0x04)
				dev->stats.rx_fifo_errors++;
			lp->rx_ring[entry].base &= 0x03ffffff;
			lp->rx_ring[entry].base &= 0x03ffffff;
		}
		}
		else
		else
@@ -1171,7 +1179,7 @@ lance_rx(struct net_device *dev)
			if(pkt_len<60)
			if(pkt_len<60)
			{
			{
				printk("%s: Runt packet!\n",dev->name);
				printk("%s: Runt packet!\n",dev->name);
				lp->stats.rx_errors++;
				dev->stats.rx_errors++;
			}
			}
			else
			else
			{
			{
@@ -1185,7 +1193,7 @@ lance_rx(struct net_device *dev)


					if (i > RX_RING_SIZE -2)
					if (i > RX_RING_SIZE -2)
					{
					{
						lp->stats.rx_dropped++;
						dev->stats.rx_dropped++;
						lp->rx_ring[entry].base |= 0x80000000;
						lp->rx_ring[entry].base |= 0x80000000;
						lp->cur_rx++;
						lp->cur_rx++;
					}
					}
@@ -1198,8 +1206,8 @@ lance_rx(struct net_device *dev)
					pkt_len);
					pkt_len);
				skb->protocol=eth_type_trans(skb,dev);
				skb->protocol=eth_type_trans(skb,dev);
				netif_rx(skb);
				netif_rx(skb);
				lp->stats.rx_packets++;
				dev->stats.rx_packets++;
				lp->stats.rx_bytes+=pkt_len;
				dev->stats.rx_bytes += pkt_len;
			}
			}
		}
		}
		/* The docs say that the buffer length isn't touched, but Andrew Boyd
		/* The docs say that the buffer length isn't touched, but Andrew Boyd
@@ -1225,7 +1233,7 @@ lance_close(struct net_device *dev)


	if (chip_table[lp->chip_version].flags & LANCE_HAS_MISSED_FRAME) {
	if (chip_table[lp->chip_version].flags & LANCE_HAS_MISSED_FRAME) {
		outw(112, ioaddr+LANCE_ADDR);
		outw(112, ioaddr+LANCE_ADDR);
		lp->stats.rx_missed_errors = inw(ioaddr+LANCE_DATA);
		dev->stats.rx_missed_errors = inw(ioaddr+LANCE_DATA);
	}
	}
	outw(0, ioaddr+LANCE_ADDR);
	outw(0, ioaddr+LANCE_ADDR);


@@ -1262,12 +1270,12 @@ static struct net_device_stats *lance_get_stats(struct net_device *dev)
		spin_lock_irqsave(&lp->devlock, flags);
		spin_lock_irqsave(&lp->devlock, flags);
		saved_addr = inw(ioaddr+LANCE_ADDR);
		saved_addr = inw(ioaddr+LANCE_ADDR);
		outw(112, ioaddr+LANCE_ADDR);
		outw(112, ioaddr+LANCE_ADDR);
		lp->stats.rx_missed_errors = inw(ioaddr+LANCE_DATA);
		dev->stats.rx_missed_errors = inw(ioaddr+LANCE_DATA);
		outw(saved_addr, ioaddr+LANCE_ADDR);
		outw(saved_addr, ioaddr+LANCE_ADDR);
		spin_unlock_irqrestore(&lp->devlock, flags);
		spin_unlock_irqrestore(&lp->devlock, flags);
	}
	}


	return &lp->stats;
	return &dev->stats;
}
}


/* Set or clear the multicast filter for this adaptor.
/* Set or clear the multicast filter for this adaptor.