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

Commit 174afef4 authored by Kulikov Vasiliy's avatar Kulikov Vasiliy Committed by David S. Miller
Browse files

mac89x0: 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 2321e80a
Loading
Loading
Loading
Loading
+29 −23
Original line number Original line Diff line number Diff line
@@ -110,7 +110,6 @@ static unsigned int net_debug = NET_DEBUG;


/* Information that need to be kept for each board. */
/* Information that need to be kept for each board. */
struct net_local {
struct net_local {
	struct net_device_stats stats;
	int chip_type;		/* one of: CS8900, CS8920, CS8920M */
	int chip_type;		/* one of: CS8900, CS8920, CS8920M */
	char chip_revision;	/* revision letter of the chip ('A'...) */
	char chip_revision;	/* revision letter of the chip ('A'...) */
	int send_cmd;		/* the propercommand used to send a packet. */
	int send_cmd;		/* the propercommand used to send a packet. */
@@ -444,13 +443,18 @@ static irqreturn_t net_interrupt(int irq, void *dev_id)
			net_rx(dev);
			net_rx(dev);
			break;
			break;
		case ISQ_TRANSMITTER_EVENT:
		case ISQ_TRANSMITTER_EVENT:
			lp->stats.tx_packets++;
			dev->stats.tx_packets++;
			netif_wake_queue(dev);
			netif_wake_queue(dev);
			if ((status & TX_OK) == 0) lp->stats.tx_errors++;
			if ((status & TX_OK) == 0)
			if (status & TX_LOST_CRS) lp->stats.tx_carrier_errors++;
				dev->stats.tx_errors++;
			if (status & TX_SQE_ERROR) lp->stats.tx_heartbeat_errors++;
			if (status & TX_LOST_CRS)
			if (status & TX_LATE_COL) lp->stats.tx_window_errors++;
				dev->stats.tx_carrier_errors++;
			if (status & TX_16_COL) lp->stats.tx_aborted_errors++;
			if (status & TX_SQE_ERROR)
				dev->stats.tx_heartbeat_errors++;
			if (status & TX_LATE_COL)
				dev->stats.tx_window_errors++;
			if (status & TX_16_COL)
				dev->stats.tx_aborted_errors++;
			break;
			break;
		case ISQ_BUFFER_EVENT:
		case ISQ_BUFFER_EVENT:
			if (status & READY_FOR_TX) {
			if (status & READY_FOR_TX) {
@@ -469,10 +473,10 @@ static irqreturn_t net_interrupt(int irq, void *dev_id)
                        }
                        }
			break;
			break;
		case ISQ_RX_MISS_EVENT:
		case ISQ_RX_MISS_EVENT:
			lp->stats.rx_missed_errors += (status >>6);
			dev->stats.rx_missed_errors += (status >> 6);
			break;
			break;
		case ISQ_TX_COL_EVENT:
		case ISQ_TX_COL_EVENT:
			lp->stats.collisions += (status >>6);
			dev->stats.collisions += (status >> 6);
			break;
			break;
		}
		}
	}
	}
@@ -483,19 +487,22 @@ static irqreturn_t net_interrupt(int irq, void *dev_id)
static void
static void
net_rx(struct net_device *dev)
net_rx(struct net_device *dev)
{
{
	struct net_local *lp = netdev_priv(dev);
	struct sk_buff *skb;
	struct sk_buff *skb;
	int status, length;
	int status, length;


	status = readreg(dev, PP_RxStatus);
	status = readreg(dev, PP_RxStatus);
	if ((status & RX_OK) == 0) {
	if ((status & RX_OK) == 0) {
		lp->stats.rx_errors++;
		dev->stats.rx_errors++;
		if (status & RX_RUNT) lp->stats.rx_length_errors++;
		if (status & RX_RUNT)
		if (status & RX_EXTRA_DATA) lp->stats.rx_length_errors++;
				dev->stats.rx_length_errors++;
		if (status & RX_CRC_ERROR) if (!(status & (RX_EXTRA_DATA|RX_RUNT)))
		if (status & RX_EXTRA_DATA)
				dev->stats.rx_length_errors++;
		if ((status & RX_CRC_ERROR) &&
		    !(status & (RX_EXTRA_DATA|RX_RUNT)))
			/* per str 172 */
			/* per str 172 */
			lp->stats.rx_crc_errors++;
			dev->stats.rx_crc_errors++;
		if (status & RX_DRIBBLE) lp->stats.rx_frame_errors++;
		if (status & RX_DRIBBLE)
				dev->stats.rx_frame_errors++;
		return;
		return;
	}
	}


@@ -504,7 +511,7 @@ net_rx(struct net_device *dev)
	skb = alloc_skb(length, GFP_ATOMIC);
	skb = alloc_skb(length, GFP_ATOMIC);
	if (skb == NULL) {
	if (skb == NULL) {
		printk("%s: Memory squeeze, dropping packet.\n", dev->name);
		printk("%s: Memory squeeze, dropping packet.\n", dev->name);
		lp->stats.rx_dropped++;
		dev->stats.rx_dropped++;
		return;
		return;
	}
	}
	skb_put(skb, length);
	skb_put(skb, length);
@@ -519,8 +526,8 @@ net_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);
	lp->stats.rx_packets++;
	dev->stats.rx_packets++;
	lp->stats.rx_bytes += length;
	dev->stats.rx_bytes += length;
}
}


/* The inverse routine to net_open(). */
/* The inverse routine to net_open(). */
@@ -548,16 +555,15 @@ net_close(struct net_device *dev)
static struct net_device_stats *
static struct net_device_stats *
net_get_stats(struct net_device *dev)
net_get_stats(struct net_device *dev)
{
{
	struct net_local *lp = netdev_priv(dev);
	unsigned long flags;
	unsigned long flags;


	local_irq_save(flags);
	local_irq_save(flags);
	/* Update the statistics from the device registers. */
	/* Update the statistics from the device registers. */
	lp->stats.rx_missed_errors += (readreg(dev, PP_RxMiss) >> 6);
	dev->stats.rx_missed_errors += (readreg(dev, PP_RxMiss) >> 6);
	lp->stats.collisions += (readreg(dev, PP_TxCol) >> 6);
	dev->stats.collisions += (readreg(dev, PP_TxCol) >> 6);
	local_irq_restore(flags);
	local_irq_restore(flags);


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


static void set_multicast_list(struct net_device *dev)
static void set_multicast_list(struct net_device *dev)