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

Commit 4265e669 authored by Kulikov Vasiliy's avatar Kulikov Vasiliy Committed by David S. Miller
Browse files

ni52: 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 e929bc33
Loading
Loading
Loading
Loading
+18 −19
Original line number Original line Diff line number Diff line
@@ -185,7 +185,6 @@ static void ni52_xmt_int(struct net_device *dev);
static void    ni52_rnr_int(struct net_device *dev);
static void    ni52_rnr_int(struct net_device *dev);


struct priv {
struct priv {
	struct net_device_stats stats;
	char __iomem *base;
	char __iomem *base;
	char __iomem *mapped;
	char __iomem *mapped;
	char __iomem *memtop;
	char __iomem *memtop;
@@ -972,10 +971,10 @@ static void ni52_rcv_int(struct net_device *dev)
					memcpy_fromio(skb->data, p->base + readl(&rbd->buffer), totlen);
					memcpy_fromio(skb->data, p->base + readl(&rbd->buffer), totlen);
					skb->protocol = eth_type_trans(skb, dev);
					skb->protocol = eth_type_trans(skb, dev);
					netif_rx(skb);
					netif_rx(skb);
					p->stats.rx_packets++;
					dev->stats.rx_packets++;
					p->stats.rx_bytes += totlen;
					dev->stats.rx_bytes += totlen;
				} else
				} else
					p->stats.rx_dropped++;
					dev->stats.rx_dropped++;
			} else {
			} else {
				int rstat;
				int rstat;
				 /* free all RBD's until RBD_LAST is set */
				 /* free all RBD's until RBD_LAST is set */
@@ -993,12 +992,12 @@ static void ni52_rcv_int(struct net_device *dev)
				writew(0, &rbd->status);
				writew(0, &rbd->status);
				printk(KERN_ERR "%s: received oversized frame! length: %d\n",
				printk(KERN_ERR "%s: received oversized frame! length: %d\n",
					dev->name, totlen);
					dev->name, totlen);
				p->stats.rx_dropped++;
				dev->stats.rx_dropped++;
			 }
			 }
		} else {/* frame !(ok), only with 'save-bad-frames' */
		} else {/* frame !(ok), only with 'save-bad-frames' */
			printk(KERN_ERR "%s: oops! rfd-error-status: %04x\n",
			printk(KERN_ERR "%s: oops! rfd-error-status: %04x\n",
				dev->name, status);
				dev->name, status);
			p->stats.rx_errors++;
			dev->stats.rx_errors++;
		}
		}
		writeb(0, &p->rfd_top->stat_high);
		writeb(0, &p->rfd_top->stat_high);
		writeb(RFD_SUSP, &p->rfd_top->last); /* maybe exchange by RFD_LAST */
		writeb(RFD_SUSP, &p->rfd_top->last); /* maybe exchange by RFD_LAST */
@@ -1043,7 +1042,7 @@ static void ni52_rnr_int(struct net_device *dev)
{
{
	struct priv *p = netdev_priv(dev);
	struct priv *p = netdev_priv(dev);


	p->stats.rx_errors++;
	dev->stats.rx_errors++;


	wait_for_scb_cmd(dev);		/* wait for the last cmd, WAIT_4_FULLSTAT?? */
	wait_for_scb_cmd(dev);		/* wait for the last cmd, WAIT_4_FULLSTAT?? */
	writeb(RUC_ABORT, &p->scb->cmd_ruc); /* usually the RU is in the 'no resource'-state .. abort it now. */
	writeb(RUC_ABORT, &p->scb->cmd_ruc); /* usually the RU is in the 'no resource'-state .. abort it now. */
@@ -1076,29 +1075,29 @@ static void ni52_xmt_int(struct net_device *dev)
		printk(KERN_ERR "%s: strange .. xmit-int without a 'COMPLETE'\n", dev->name);
		printk(KERN_ERR "%s: strange .. xmit-int without a 'COMPLETE'\n", dev->name);


	if (status & STAT_OK) {
	if (status & STAT_OK) {
		p->stats.tx_packets++;
		dev->stats.tx_packets++;
		p->stats.collisions += (status & TCMD_MAXCOLLMASK);
		dev->stats.collisions += (status & TCMD_MAXCOLLMASK);
	} else {
	} else {
		p->stats.tx_errors++;
		dev->stats.tx_errors++;
		if (status & TCMD_LATECOLL) {
		if (status & TCMD_LATECOLL) {
			printk(KERN_ERR "%s: late collision detected.\n",
			printk(KERN_ERR "%s: late collision detected.\n",
				dev->name);
				dev->name);
			p->stats.collisions++;
			dev->stats.collisions++;
		} else if (status & TCMD_NOCARRIER) {
		} else if (status & TCMD_NOCARRIER) {
			p->stats.tx_carrier_errors++;
			dev->stats.tx_carrier_errors++;
			printk(KERN_ERR "%s: no carrier detected.\n",
			printk(KERN_ERR "%s: no carrier detected.\n",
				dev->name);
				dev->name);
		} else if (status & TCMD_LOSTCTS)
		} else if (status & TCMD_LOSTCTS)
			printk(KERN_ERR "%s: loss of CTS detected.\n",
			printk(KERN_ERR "%s: loss of CTS detected.\n",
				dev->name);
				dev->name);
		else if (status & TCMD_UNDERRUN) {
		else if (status & TCMD_UNDERRUN) {
			p->stats.tx_fifo_errors++;
			dev->stats.tx_fifo_errors++;
			printk(KERN_ERR "%s: DMA underrun detected.\n",
			printk(KERN_ERR "%s: DMA underrun detected.\n",
				dev->name);
				dev->name);
		} else if (status & TCMD_MAXCOLL) {
		} else if (status & TCMD_MAXCOLL) {
			printk(KERN_ERR "%s: Max. collisions exceeded.\n",
			printk(KERN_ERR "%s: Max. collisions exceeded.\n",
				dev->name);
				dev->name);
			p->stats.collisions += 16;
			dev->stats.collisions += 16;
		}
		}
	}
	}
#if (NUM_XMIT_BUFFS > 1)
#if (NUM_XMIT_BUFFS > 1)
@@ -1286,12 +1285,12 @@ static struct net_device_stats *ni52_get_stats(struct net_device *dev)
	ovrn = readw(&p->scb->ovrn_errs);
	ovrn = readw(&p->scb->ovrn_errs);
	writew(0, &p->scb->ovrn_errs);
	writew(0, &p->scb->ovrn_errs);


	p->stats.rx_crc_errors += crc;
	dev->stats.rx_crc_errors += crc;
	p->stats.rx_fifo_errors += ovrn;
	dev->stats.rx_fifo_errors += ovrn;
	p->stats.rx_frame_errors += aln;
	dev->stats.rx_frame_errors += aln;
	p->stats.rx_dropped += rsc;
	dev->stats.rx_dropped += rsc;


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


/********************************************************
/********************************************************