Commit 09f75cd7 authored by Jeff Garzik's avatar Jeff Garzik Committed by David S. Miller
Browse files

[NET] drivers/net: statistics cleanup #1 -- save memory and shrink code


We now have struct net_device_stats embedded in struct net_device,
and the default ->get_stats() hook does the obvious thing for us.

Run through drivers/net/* and remove the driver-local storage of
statistics, and driver-local ->get_stats() hook where applicable.

This was just the low-hanging fruit in drivers/net; plenty more drivers
remain to be updated.

[ Resolved conflicts with napi_struct changes and fix sunqe build
  regression... -DaveM ]
Signed-off-by: default avatarJeff Garzik <jeff@garzik.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent ff8ac609
......@@ -315,7 +315,6 @@ static int __init el1_probe1(struct net_device *dev, int ioaddr)
dev->tx_timeout = &el_timeout;
dev->watchdog_timeo = HZ;
dev->stop = &el1_close;
dev->get_stats = &el1_get_stats;
dev->set_multicast_list = &set_multicast_list;
dev->ethtool_ops = &netdev_ethtool_ops;
return 0;
......@@ -374,7 +373,7 @@ static void el_timeout(struct net_device *dev)
if (el_debug)
printk (KERN_DEBUG "%s: transmit timed out, txsr %#2x axsr=%02x rxsr=%02x.\n",
dev->name, inb(TX_STATUS), inb(AX_STATUS), inb(RX_STATUS));
lp->stats.tx_errors++;
dev->stats.tx_errors++;
outb(TX_NORM, TX_CMD);
outb(RX_NORM, RX_CMD);
outb(AX_OFF, AX_CMD); /* Just trigger a false interrupt. */
......@@ -441,7 +440,7 @@ static int el_start_xmit(struct sk_buff *skb, struct net_device *dev)
lp->tx_pkt_start = gp_start;
lp->collisions = 0;
lp->stats.tx_bytes += skb->len;
dev->stats.tx_bytes += skb->len;
/*
* Command mode with status cleared should [in theory]
......@@ -588,7 +587,7 @@ static irqreturn_t el_interrupt(int irq, void *dev_id)
printk (KERN_DEBUG "%s: Transmit failed 16 times, Ethernet jammed?\n",dev->name);
outb(AX_SYS, AX_CMD);
lp->txing = 0;
lp->stats.tx_aborted_errors++;
dev->stats.tx_aborted_errors++;
netif_wake_queue(dev);
}
else if (txsr & TX_COLLISION)
......@@ -606,7 +605,7 @@ static irqreturn_t el_interrupt(int irq, void *dev_id)
outb(AX_SYS, AX_CMD);
outw(lp->tx_pkt_start, GP_LOW);
outb(AX_XMIT, AX_CMD);
lp->stats.collisions++;
dev->stats.collisions++;
spin_unlock(&lp->lock);
goto out;
}
......@@ -615,7 +614,7 @@ static irqreturn_t el_interrupt(int irq, void *dev_id)
/*
* It worked.. we will now fall through and receive
*/
lp->stats.tx_packets++;
dev->stats.tx_packets++;
if (el_debug > 6)
printk(KERN_DEBUG " Tx succeeded %s\n",
(txsr & TX_RDY) ? "." : "but tx is busy!");
......@@ -640,10 +639,10 @@ static irqreturn_t el_interrupt(int irq, void *dev_id)
* Just reading rx_status fixes most errors.
*/
if (rxsr & RX_MISSED)
lp->stats.rx_missed_errors++;
dev->stats.rx_missed_errors++;
else if (rxsr & RX_RUNT)
{ /* Handled to avoid board lock-up. */
lp->stats.rx_length_errors++;
dev->stats.rx_length_errors++;
if (el_debug > 5)
printk(KERN_DEBUG " runt.\n");
}
......@@ -694,7 +693,6 @@ static irqreturn_t el_interrupt(int irq, void *dev_id)
static void el_receive(struct net_device *dev)
{
struct net_local *lp = netdev_priv(dev);
int ioaddr = dev->base_addr;
int pkt_len;
struct sk_buff *skb;
......@@ -708,7 +706,7 @@ static void el_receive(struct net_device *dev)
{
if (el_debug)
printk(KERN_DEBUG "%s: bogus packet, length=%d\n", dev->name, pkt_len);
lp->stats.rx_over_errors++;
dev->stats.rx_over_errors++;
return;
}
......@@ -727,7 +725,7 @@ static void el_receive(struct net_device *dev)
if (skb == NULL)
{
printk(KERN_INFO "%s: Memory squeeze, dropping packet.\n", dev->name);
lp->stats.rx_dropped++;
dev->stats.rx_dropped++;
return;
}
else
......@@ -742,8 +740,8 @@ static void el_receive(struct net_device *dev)
skb->protocol=eth_type_trans(skb,dev);
netif_rx(skb);
dev->last_rx = jiffies;
lp->stats.rx_packets++;
lp->stats.rx_bytes+=pkt_len;
dev->stats.rx_packets++;
dev->stats.rx_bytes+=pkt_len;
}
return;
}
......@@ -810,23 +808,6 @@ static int el1_close(struct net_device *dev)
return 0;
}
/**
* el1_get_stats:
* @dev: The card to get the statistics for
*
* In smarter devices this function is needed to pull statistics off the
* board itself. The 3c501 has no hardware statistics. We maintain them all
* so they are by definition always up to date.
*
* Returns the statistics for the card from the card private data
*/
static struct net_device_stats *el1_get_stats(struct net_device *dev)
{
struct net_local *lp = netdev_priv(dev);
return &lp->stats;
}
/**
* set_multicast_list:
* @dev: The device to adjust
......
......@@ -11,7 +11,6 @@ static irqreturn_t el_interrupt(int irq, void *dev_id);
static void el_receive(struct net_device *dev);
static void el_reset(struct net_device *dev);
static int el1_close(struct net_device *dev);
static struct net_device_stats *el1_get_stats(struct net_device *dev);
static void set_multicast_list(struct net_device *dev);
static const struct ethtool_ops netdev_ethtool_ops;
......@@ -29,7 +28,6 @@ static int el_debug = EL_DEBUG;
struct net_local
{
struct net_device_stats stats;
int tx_pkt_start; /* The length of the current Tx packet. */
int collisions; /* Tx collisions this packet */
int loading; /* Spot buffer load collisions */
......
......@@ -118,7 +118,6 @@ enum commands {
/* Information that need to be kept for each board. */
struct net_local {
struct net_device_stats stats;
int last_restart;
ushort rx_head;
ushort rx_tail;
......@@ -289,7 +288,6 @@ static int el16_send_packet(struct sk_buff *skb, struct net_device *dev);
static irqreturn_t el16_interrupt(int irq, void *dev_id);
static void el16_rx(struct net_device *dev);
static int el16_close(struct net_device *dev);
static struct net_device_stats *el16_get_stats(struct net_device *dev);
static void el16_tx_timeout (struct net_device *dev);
static void hardware_send_packet(struct net_device *dev, void *buf, short length, short pad);
......@@ -455,7 +453,6 @@ static int __init el16_probe1(struct net_device *dev, int ioaddr)
dev->open = el16_open;
dev->stop = el16_close;
dev->hard_start_xmit = el16_send_packet;
dev->get_stats = el16_get_stats;
dev->tx_timeout = el16_tx_timeout;
dev->watchdog_timeo = TX_TIMEOUT;
dev->ethtool_ops = &netdev_ethtool_ops;
......@@ -489,7 +486,7 @@ static void el16_tx_timeout (struct net_device *dev)
readw(shmem + iSCB_STATUS) & 0x8000 ? "IRQ conflict" :
"network cable problem");
/* Try to restart the adaptor. */
if (lp->last_restart == lp->stats.tx_packets) {
if (lp->last_restart == dev->stats.tx_packets) {
if (net_debug > 1)
printk ("Resetting board.\n");
/* Completely reset the adaptor. */
......@@ -501,7 +498,7 @@ static void el16_tx_timeout (struct net_device *dev)
printk ("Kicking board.\n");
writew(0xf000 | CUC_START | RX_START, shmem + iSCB_CMD);
outb (0, ioaddr + SIGNAL_CA); /* Issue channel-attn. */
lp->last_restart = lp->stats.tx_packets;
lp->last_restart = dev->stats.tx_packets;
}
dev->trans_start = jiffies;
netif_wake_queue (dev);
......@@ -520,7 +517,7 @@ static int el16_send_packet (struct sk_buff *skb, struct net_device *dev)
spin_lock_irqsave (&lp->lock, flags);
lp->stats.tx_bytes += length;
dev->stats.tx_bytes += length;
/* Disable the 82586's input to the interrupt line. */
outb (0x80, ioaddr + MISC_CTRL);
......@@ -579,14 +576,14 @@ static irqreturn_t el16_interrupt(int irq, void *dev_id)
}
/* Tx unsuccessful or some interesting status bit set. */
if (!(tx_status & 0x2000) || (tx_status & 0x0f3f)) {
lp->stats.tx_errors++;
if (tx_status & 0x0600) lp->stats.tx_carrier_errors++;
if (tx_status & 0x0100) lp->stats.tx_fifo_errors++;
if (!(tx_status & 0x0040)) lp->stats.tx_heartbeat_errors++;
if (tx_status & 0x0020) lp->stats.tx_aborted_errors++;
lp->stats.collisions += tx_status & 0xf;
dev->stats.tx_errors++;
if (tx_status & 0x0600) dev->stats.tx_carrier_errors++;
if (tx_status & 0x0100) dev->stats.tx_fifo_errors++;
if (!(tx_status & 0x0040)) dev->stats.tx_heartbeat_errors++;
if (tx_status & 0x0020) dev->stats.tx_aborted_errors++;
dev->stats.collisions += tx_status & 0xf;
}
lp->stats.tx_packets++;
dev->stats.tx_packets++;
if (net_debug > 5)
printk("Reaped %x, Tx status %04x.\n" , lp->tx_reap, tx_status);
lp->tx_reap += TX_BUF_SIZE;
......@@ -665,17 +662,6 @@ static int el16_close(struct net_device *dev)
return 0;
}
/* Get the current statistics. This may be called with the card open or
closed. */
static struct net_device_stats *el16_get_stats(struct net_device *dev)
{
struct net_local *lp = netdev_priv(dev);
/* ToDo: decide if there are any useful statistics from the SCB. */
return &lp->stats;
}
/* Initialize the Rx-block list. */
static void init_rx_bufs(struct net_device *dev)
{
......@@ -852,12 +838,12 @@ static void el16_rx(struct net_device *dev)
pkt_len);
} else if ((frame_status & 0x2000) == 0) {
/* Frame Rxed, but with error. */
lp->stats.rx_errors++;
if (frame_status & 0x0800) lp->stats.rx_crc_errors++;
if (frame_status & 0x0400) lp->stats.rx_frame_errors++;
if (frame_status & 0x0200) lp->stats.rx_fifo_errors++;
if (frame_status & 0x0100) lp->stats.rx_over_errors++;
if (frame_status & 0x0080) lp->stats.rx_length_errors++;
dev->stats.rx_errors++;
if (frame_status & 0x0800) dev->stats.rx_crc_errors++;
if (frame_status & 0x0400) dev->stats.rx_frame_errors++;
if (frame_status & 0x0200) dev->stats.rx_fifo_errors++;
if (frame_status & 0x0100) dev->stats.rx_over_errors++;
if (frame_status & 0x0080) dev->stats.rx_length_errors++;
} else {
/* Malloc up new buffer. */
struct sk_buff *skb;
......@@ -866,7 +852,7 @@ static void el16_rx(struct net_device *dev)
skb = dev_alloc_skb(pkt_len+2);
if (skb == NULL) {
printk("%s: Memory squeeze, dropping packet.\n", dev->name);
lp->stats.rx_dropped++;
dev->stats.rx_dropped++;
break;
}
......@@ -878,8 +864,8 @@ static void el16_rx(struct net_device *dev)
skb->protocol=eth_type_trans(skb,dev);
netif_rx(skb);
dev->last_rx = jiffies;
lp->stats.rx_packets++;
lp->stats.rx_bytes += pkt_len;
dev->stats.rx_packets++;
dev->stats.rx_bytes += pkt_len;
}
/* Clear the status word and set End-of-List on the rx frame. */
......
......@@ -305,18 +305,18 @@ static int lance_rx (struct net_device *dev)
/* We got an incomplete frame? */
if ((bits & LE_R1_POK) != LE_R1_POK) {
lp->stats.rx_over_errors++;
lp->stats.rx_errors++;
dev->stats.rx_over_errors++;
dev->stats.rx_errors++;
continue;
} else if (bits & LE_R1_ERR) {
/* Count only the end frame as a rx error,
* not the beginning
*/
if (bits & LE_R1_BUF) lp->stats.rx_fifo_errors++;
if (bits & LE_R1_CRC) lp->stats.rx_crc_errors++;
if (bits & LE_R1_OFL) lp->stats.rx_over_errors++;
if (bits & LE_R1_FRA) lp->stats.rx_frame_errors++;
if (bits & LE_R1_EOP) lp->stats.rx_errors++;
if (bits & LE_R1_BUF) dev->stats.rx_fifo_errors++;
if (bits & LE_R1_CRC) dev->stats.rx_crc_errors++;
if (bits & LE_R1_OFL) dev->stats.rx_over_errors++;
if (bits & LE_R1_FRA) dev->stats.rx_frame_errors++;
if (bits & LE_R1_EOP) dev->stats.rx_errors++;
} else {
len = (rd->mblength & 0xfff) - 4;
skb = dev_alloc_skb (len+2);
......@@ -324,7 +324,7 @@ static int lance_rx (struct net_device *dev)
if (skb == 0) {
printk ("%s: Memory squeeze, deferring packet.\n",
dev->name);
lp->stats.rx_dropped++;
dev->stats.rx_dropped++;
rd->mblength = 0;
rd->rmd1_bits = LE_R1_OWN;
lp->rx_new = (lp->rx_new + 1) & lp->rx_ring_mod_mask;
......@@ -339,8 +339,8 @@ static int lance_rx (struct net_device *dev)
skb->protocol = eth_type_trans (skb, dev);
netif_rx (skb);
dev->last_rx = jiffies;
lp->stats.rx_packets++;
lp->stats.rx_bytes += len;
dev->stats.rx_packets++;
dev->stats.rx_bytes += len;
}
/* Return the packet to the pool */
......@@ -377,12 +377,12 @@ static int lance_tx (struct net_device *dev)
if (td->tmd1_bits & LE_T1_ERR) {
status = td->misc;
lp->stats.tx_errors++;
if (status & LE_T3_RTY) lp->stats.tx_aborted_errors++;
if (status & LE_T3_LCOL) lp->stats.tx_window_errors++;
dev->stats.tx_errors++;
if (status & LE_T3_RTY) dev->stats.tx_aborted_errors++;
if (status & LE_T3_LCOL) dev->stats.tx_window_errors++;
if (status & LE_T3_CLOS) {
lp->stats.tx_carrier_errors++;
dev->stats.tx_carrier_errors++;
if (lp->auto_select) {
lp->tpe = 1 - lp->tpe;
printk("%s: Carrier Lost, trying %s\n",
......@@ -400,7 +400,7 @@ static int lance_tx (struct net_device *dev)
/* buffer errors and underflows turn off the transmitter */
/* Restart the adapter */
if (status & (LE_T3_BUF|LE_T3_UFL)) {
lp->stats.tx_fifo_errors++;
dev->stats.tx_fifo_errors++;
printk ("%s: Tx: ERR_BUF|ERR_UFL, restarting\n",
dev->name);
......@@ -420,13 +420,13 @@ static int lance_tx (struct net_device *dev)
/* One collision before packet was sent. */
if (td->tmd1_bits & LE_T1_EONE)
lp->stats.collisions++;
dev->stats.collisions++;
/* More than one collision, be optimistic. */
if (td->tmd1_bits & LE_T1_EMORE)
lp->stats.collisions += 2;
dev->stats.collisions += 2;
lp->stats.tx_packets++;
dev->stats.tx_packets++;
}
j = (j + 1) & lp->tx_ring_mod_mask;
......@@ -471,9 +471,9 @@ lance_interrupt (int irq, void *dev_id)
/* Log misc errors. */
if (csr0 & LE_C0_BABL)
lp->stats.tx_errors++; /* Tx babble. */
dev->stats.tx_errors++; /* Tx babble. */
if (csr0 & LE_C0_MISS)
lp->stats.rx_errors++; /* Missed a Rx frame. */
dev->stats.rx_errors++; /* Missed a Rx frame. */
if (csr0 & LE_C0_MERR) {
printk("%s: Bus master arbitration failure, status %4.4x.\n",
dev->name, csr0);
......@@ -589,13 +589,6 @@ int lance_start_xmit (struct sk_buff *skb, struct net_device *dev)
return 0;
}
struct net_device_stats *lance_get_stats (struct net_device *dev)
{
struct lance_private *lp = netdev_priv(dev);
return &lp->stats;
}
/* taken from the depca driver via a2065.c */
static void lance_load_multicast (struct net_device *dev)
{
......
......@@ -111,7 +111,6 @@ struct lance_private
int lance_log_rx_bufs, lance_log_tx_bufs;
int rx_ring_mod_mask, tx_ring_mod_mask;
struct net_device_stats stats;
int tpe; /* TPE is selected */
int auto_select; /* cable-selection is by carrier */
unsigned short busmaster_regval;
......@@ -246,7 +245,6 @@ struct lance_private
extern int lance_open(struct net_device *dev);
extern int lance_close (struct net_device *dev);
extern int lance_start_xmit (struct sk_buff *skb, struct net_device *dev);
extern struct net_device_stats *lance_get_stats (struct net_device *dev);
extern void lance_set_multicast (struct net_device *dev);
extern void lance_tx_timeout(struct net_device *dev);
#ifdef CONFIG_NET_POLL_CONTROLLER
......
......@@ -326,7 +326,6 @@ struct i596_private {
struct i596_cmd *cmd_head;
int cmd_backlog;
unsigned long last_cmd;
struct net_device_stats stats;
struct i596_rfd rfds[RX_RING_SIZE];
struct i596_rbd rbds[RX_RING_SIZE];
struct tx_cmd tx_cmds[TX_RING_SIZE];
......@@ -360,7 +359,6 @@ static int i596_open(struct net_device *dev);
static int i596_start_xmit(struct sk_buff *skb, struct net_device *dev);
static irqreturn_t i596_interrupt(int irq, void *dev_id);
static int i596_close(struct net_device *dev);
static struct net_device_stats *i596_get_stats(struct net_device *dev);
static void i596_add_cmd(struct net_device *dev, struct i596_cmd *cmd);
static void i596_tx_timeout (struct net_device *dev);
static void print_eth(unsigned char *buf, char *str);
......@@ -828,7 +826,7 @@ static inline int i596_rx(struct net_device *dev)
if (skb == NULL) {
/* XXX tulip.c can defer packets here!! */
printk(KERN_WARNING "%s: i596_rx Memory squeeze, dropping packet.\n", dev->name);
lp->stats.rx_dropped++;
dev->stats.rx_dropped++;
}
else {
if (!rx_in_place) {
......@@ -844,28 +842,28 @@ static inline int i596_rx(struct net_device *dev)
#endif
netif_rx(skb);
dev->last_rx = jiffies;
lp->stats.rx_packets++;
lp->stats.rx_bytes+=pkt_len;
dev->stats.rx_packets++;
dev->stats.rx_bytes+=pkt_len;
}
}
else {
DEB(DEB_ERRORS, printk(KERN_DEBUG "%s: Error, rfd.stat = 0x%04x\n",
dev->name, rfd->stat));
lp->stats.rx_errors++;
dev->stats.rx_errors++;
if ((rfd->stat) & 0x0001)
lp->stats.collisions++;
dev->stats.collisions++;
if ((rfd->stat) & 0x0080)
lp->stats.rx_length_errors++;
dev->stats.rx_length_errors++;
if ((rfd->stat) & 0x0100)
lp->stats.rx_over_errors++;
dev->stats.rx_over_errors++;
if ((rfd->stat) & 0x0200)
lp->stats.rx_fifo_errors++;
dev->stats.rx_fifo_errors++;
if ((rfd->stat) & 0x0400)
lp->stats.rx_frame_errors++;
dev->stats.rx_frame_errors++;
if ((rfd->stat) & 0x0800)
lp->stats.rx_crc_errors++;
dev->stats.rx_crc_errors++;
if ((rfd->stat) & 0x1000)
lp->stats.rx_length_errors++;
dev->stats.rx_length_errors++;
}
/* Clear the buffer descriptor count and EOF + F flags */
......@@ -916,8 +914,8 @@ static void i596_cleanup_cmd(struct net_device *dev, struct i596_private *lp)
dev_kfree_skb(skb);
lp->stats.tx_errors++;
lp->stats.tx_aborted_errors++;
dev->stats.tx_errors++;
dev->stats.tx_aborted_errors++;
ptr->v_next = ptr->b_next = I596_NULL;
tx_cmd->cmd.command = 0; /* Mark as free */
......@@ -1038,10 +1036,10 @@ static void i596_tx_timeout (struct net_device *dev)
DEB(DEB_ERRORS,printk(KERN_ERR "%s: transmit timed out, status resetting.\n",
dev->name));
lp->stats.tx_errors++;
dev->stats.tx_errors++;
/* Try to restart the adaptor */
if (lp->last_restart == lp->stats.tx_packets) {
if (lp->last_restart == dev->stats.tx_packets) {
DEB(DEB_ERRORS,printk(KERN_ERR "Resetting board.\n"));
/* Shutdown and restart */
i596_reset (dev, lp, ioaddr);
......@@ -1050,7 +1048,7 @@ static void i596_tx_timeout (struct net_device *dev)
DEB(DEB_ERRORS,printk(KERN_ERR "Kicking board.\n"));
lp->scb.command = CUC_START | RX_START;
CA (dev);
lp->last_restart = lp->stats.tx_packets;
lp->last_restart = dev->stats.tx_packets;
}
dev->trans_start = jiffies;
......@@ -1082,7 +1080,7 @@ static int i596_start_xmit(struct sk_buff *skb, struct net_device *dev)
if (tx_cmd->cmd.command) {
printk(KERN_NOTICE "%s: xmit ring full, dropping packet.\n",
dev->name);
lp->stats.tx_dropped++;
dev->stats.tx_dropped++;
dev_kfree_skb(skb);
} else {
......@@ -1107,8 +1105,8 @@ static int i596_start_xmit(struct sk_buff *skb, struct net_device *dev)
DEB(DEB_TXADDR,print_eth(skb->data, "tx-queued"));
i596_add_cmd(dev, &tx_cmd->cmd);
lp->stats.tx_packets++;
lp->stats.tx_bytes += length;
dev->stats.tx_packets++;
dev->stats.tx_bytes += length;
}
netif_start_queue(dev);
......@@ -1237,7 +1235,6 @@ struct net_device * __init i82596_probe(int unit)
dev->open = i596_open;
dev->stop = i596_close;
dev->hard_start_xmit = i596_start_xmit;
dev->get_stats = i596_get_stats;
dev->set_multicast_list = set_multicast_list;
dev->tx_timeout = i596_tx_timeout;
dev->watchdog_timeo = TX_TIMEOUT;
......@@ -1343,17 +1340,17 @@ static irqreturn_t i596_interrupt(int irq, void *dev_id)
if ((ptr->status) & STAT_OK) {
DEB(DEB_TXADDR,print_eth(skb->data, "tx-done"));
} else {
lp->stats.tx_errors++;
dev->stats.tx_errors++;
if ((ptr->status) & 0x0020)
lp->stats.collisions++;
dev->stats.collisions++;
if (!((ptr->status) & 0x0040))
lp->stats.tx_heartbeat_errors++;
dev->stats.tx_heartbeat_errors++;
if ((ptr->status) & 0x0400)
lp->stats.tx_carrier_errors++;
dev->stats.tx_carrier_errors++;
if ((ptr->status) & 0x0800)
lp->stats.collisions++;
dev->stats.collisions++;
if ((ptr->status) & 0x1000)
lp->stats.tx_aborted_errors++;
dev->stats.tx_aborted_errors++;
}
dev_kfree_skb_irq(skb);
......@@ -1408,8 +1405,8 @@ static irqreturn_t i596_interrupt(int irq, void *dev_id)
if (netif_running(dev)) {
DEB(DEB_ERRORS,printk(KERN_ERR "%s: i596 interrupt receive unit inactive, status 0x%x\n", dev->name, status));
ack_cmd |= RX_START;
lp->stats.rx_errors++;
lp->stats.rx_fifo_errors++;
dev->stats.rx_errors++;
dev->stats.rx_fifo_errors++;
rebuild_rx_bufs(dev);
}
}
......@@ -1492,14 +1489,6 @@ static int i596_close(struct net_device *dev)
return 0;
}
static struct net_device_stats *
i596_get_stats(struct net_device *dev)
{
struct i596_private *lp = dev->priv;
return &lp->stats;
}
/*
* Set or clear the multicast filter for this adaptor.
*/
......
......@@ -119,7 +119,6 @@ struct lance_private {
int lance_log_rx_bufs, lance_log_tx_bufs;
int rx_ring_mod_mask, tx_ring_mod_mask;
struct net_device_stats stats;
int tpe; /* cable-selection is TPE */
int auto_select; /* cable-selection by carrier */
unsigned short busmaster_regval;
......@@ -294,18 +293,18 @@ static int lance_rx (struct net_device *dev)
/* We got an incomplete frame? */
if ((bits & LE_R1_POK) != LE_R1_POK) {
lp->stats.rx_over_errors++;
lp->stats.rx_errors++;
dev->stats.rx_over_errors++;
dev->stats.rx_errors++;
continue;
} else if (bits & LE_R1_ERR) {
/* Count only the end frame as a rx error,
* not the beginning
*/
if (bits & LE_R1_BUF) lp->stats.rx_fifo_errors++;
if (bits & LE_R1_CRC) lp->stats.rx_crc_errors++;
if (bits & LE_R1_OFL) lp->stats.rx_over_errors++;
if (bits & LE_R1_FRA) lp->stats.rx_frame_errors++;
if (bits & LE_R1_EOP) lp->stats.rx_errors++;
if (bits & LE_R1_BUF) dev->stats.rx_fifo_errors++;
if (bits & LE_R1_CRC) dev->stats.rx_crc_errors++;
if (bits & LE_R1_OFL) dev->stats.rx_over_errors++;
if (bits & LE_R1_FRA) dev->stats.rx_frame_errors++;
if (bits & LE_R1_EOP) dev->stats.rx_errors++;
} else {
len = (rd->mblength & 0xfff) - 4;
skb = dev_alloc_skb (len+2);
......@@ -313,7 +312,7 @@ static int lance_rx (struct net_device *dev)
if (skb == 0) {
printk(KERN_WARNING "%s: Memory squeeze, "
"deferring packet.\n", dev->name);
lp->stats.rx_dropped++;
dev->stats.rx_dropped++;
rd->mblength = 0;
rd->rmd1_bits = LE_R1_OWN;
lp->rx_new = (lp->rx_new + 1) & lp->rx_ring_mod_mask;
......@@ -328,8 +327,8 @@ static int lance_rx (struct net_device *dev)
skb->protocol = eth_type_trans (skb, dev);
netif_rx (skb);
dev->last_rx = jiffies;
lp->stats.rx_packets++;
lp->stats.rx_bytes += len;
dev->stats.rx_packets++;
dev->stats.rx_bytes += len;
}
/* Return the packet to the pool */
......@@ -364,12 +363,12 @@ static int lance_tx (struct net_device *dev)
if (td->tmd1_bits & LE_T1_ERR) {
status = td->misc;
lp->stats.tx_errors++;
if (status & LE_T3_RTY) lp->stats.tx_aborted_errors++;
if (status & LE_T3_LCOL) lp->stats.tx_window_errors++;
dev->stats.tx_errors++;
if (status & LE_T3_RTY) dev->stats.tx_aborted_errors++;
if (status & LE_T3_LCOL) dev->stats.tx_window_errors++;
if (status & LE_T3_CLOS) {
lp->stats.tx_carrier_errors++;
dev->stats.tx_carrier_errors++;
if (lp->auto_select) {
lp->tpe = 1 - lp->tpe;
printk(KERN_ERR "%s: Carrier Lost, "
......@@ -388,7 +387,7 @@ static int lance_tx (struct net_device *dev)
/* buffer errors and underflows turn off the transmitter */
/* Restart the adapter */
if (status & (LE_T3_BUF|LE_T3_UFL)) {
lp->stats.tx_fifo_errors++;
dev->stats.tx_fifo_errors++;
printk(KERN_ERR "%s: Tx: ERR_BUF|ERR_UFL, "
"restarting\n", dev->name);
......@@ -408,13 +407,13 @@ static int lance_tx (struct net_device *dev)
/* One collision before packet was sent. */
if (td->tmd1_bits & LE_T1_EONE)
lp->stats.collisions++;
dev->stats.collisions++;
/* More than one collision, be optimistic. */
if (td->tmd1_bits & LE_T1_EMORE)
lp->stats.collisions += 2;
dev->stats.collisions += 2;
lp->stats.tx_packets++;
dev->stats.tx_packets++;
}
j = (j + 1) & lp->tx_ring_mod_mask;
......@@ -459,9 +458,9 @@ static irqreturn_t lance_interrupt (int irq, void *dev_id)
/* Log misc errors. */
if (csr0 & LE_C0_BABL)
lp->stats.tx_errors++; /* Tx babble. */
dev->stats.tx_errors++; /* Tx babble. */
if (csr0 & LE_C0_MISS)
lp->stats.rx_errors++; /* Missed a Rx frame. */
dev->stats.rx_errors++; /* Missed a Rx frame. */
if (csr0 & LE_C0_MERR) {
printk(KERN_ERR "%s: Bus master arbitration failure, status "
"%4.4x.\n", dev->name, csr0);
......@@ -606,7 +605,7 @@ static int lance_start_xmit (struct sk_buff *skb, struct net_device *dev)
/* Now, give the packet to the lance */
ib->btx_ring [entry].tmd1_bits = (LE_T1_POK|LE_T1_OWN);
lp->tx_new = (lp->tx_new+1) & lp->tx_ring_mod_mask;
lp->stats.tx_bytes += skblen;
dev->stats.tx_bytes += skblen;
if (TX_BUFFS_AVAIL <= 0)
netif_stop_queue(dev);
......@@ -621,13 +620,6 @@ static int lance_start_xmit (struct sk_buff *skb, struct net_device *dev)
return status;
}
static struct net_device_stats *lance_get_stats (struct net_device *dev)
{
struct lance_private *lp = netdev_priv(dev);
return &lp->stats;
}
/* taken from the depca driver */
static void lance_load_multicast (struct net_device *dev)
{
......@@ -782,7 +774,6 @@ static int __devinit a2065_init_one(struct zorro_dev *z,
dev->hard_start_xmit = &lance_start_xmit;
dev->tx_timeout = &lance_tx_timeout;
dev->watchdog_timeo = 5*HZ;
dev->get_stats = &lance_get_stats;
dev->set_multicast_list = &lance_set_multicast;
dev->dma = 0;
......
......@@ -109,7 +109,6 @@ typedef unsigned char uchar;
/* Information that need to be kept for each board. */
struct net_local {
struct net_device_stats stats;
spinlock_t lock;
unsigned char mc_filter[8];
uint jumpered:1; /* Set iff the board has jumper config. */
......@@ -164,7 +163,6 @@ static int net_send_packet(struct sk_buff *skb, struct net_device *dev);
static irqreturn_t net_interrupt(int irq, void *dev_id);
static void net_rx(struct net_device *dev);
static int net_close(struct net_device *dev);
static struct net_device_stats *net_get_stats(struct net_device *dev);
static void set_rx_mode(struct net_device *dev);
static void net_tx_timeout (struct net_device *dev);
......@@ -456,7 +454,6 @@ static int __init at1700_probe1(struct net_device *dev, int ioaddr)
dev->open = net_open;
dev->stop = net_close;
dev->hard_start_xmit = net_send_packet;
dev->get_stats = net_get_stats;
dev->set_multicast_list = &set_rx_mode;
dev->tx_timeout = net_tx_timeout;
dev->watchdog_timeo = TX_TIMEOUT;
......@@ -571,7 +568,7 @@ static void net_tx_timeout (struct net_device *dev)
dev->name, inw(ioaddr + TX_STATUS), inw(ioaddr + TX_INTR), inw(ioaddr + TX_MODE),
inw(ioaddr + CONFIG_0), inw(ioaddr + DATAPORT), inw(ioaddr + TX_START),
inw(ioaddr + MODE13 - 1), inw(ioaddr + RX_CTRL));
lp->stats.tx_errors++;
dev->stats.tx_errors++;
/* ToDo: We should try to restart the adaptor... */
outw(0xffff, ioaddr + MODE24);
outw (0xffff, ioaddr + TX_STATUS);
......@@ -691,10 +688,10 @@ static irqreturn_t net_interrupt(int irq, void *dev_id)
printk("%s: 16 Collision occur during Txing.\n", dev->name);
/* Cancel sending a packet. */
outb(0x03, ioaddr + COL16CNTL);
lp->stats.collisions++;
dev->stats.collisions++;
}
if (status & 0x82) {
lp->stats.tx_packets++;
dev->stats.tx_packets++;
/* The Tx queue has any packets and is not being
transferred a packet from the host, start
transmitting. */
......@@ -719,7 +716,6 @@ static irqreturn_t net_interrupt(int irq, void *dev_id)
static void
net_rx(struct net_device *dev)
{
struct net_local *lp = netdev_priv(dev);
int ioaddr = dev->base_addr;
int boguscount = 5;
......@@ -738,11 +734,11 @@ net_rx(struct net_device *dev)
#endif
if ((status & 0xF0) != 0x20) { /* There was an error. */
lp->stats.rx_errors++;
if (status & 0x08) lp->stats.rx_length_errors++;
if (status & 0x04) lp->stats.rx_frame_errors++;
if (status & 0x02) lp->stats.rx_crc_errors++;
if (status & 0x01) lp->stats.rx_over_errors++;
dev->stats.rx_errors++;
if (status & 0x08) dev->stats.rx_length_errors++;
if (status & 0x04) dev->stats.rx_frame_errors++;
if (status & 0x02) dev->stats.rx_crc_errors++;
if (status & 0x01) dev->stats.rx_over_errors++;
} else {
/* Malloc up new buffer. */
struct sk_buff *skb;
......@@ -753,7 +749,7 @@ net_rx(struct net_device *dev)
/* Prime the FIFO and then flush the packet. */
inw(ioaddr + DATAPORT); inw(ioaddr + DATAPORT);
outb(0x05, ioaddr + RX_CTRL);
lp->stats.rx_errors++;
dev->stats.rx_errors++;
break;
}
skb = dev_alloc_skb(pkt_len+3);
......@@ -763,7 +759,7 @@ net_rx(struct net_device *dev)
/* Prime the FIFO and then flush the packet. */
inw(ioaddr + DATAPORT); inw(ioaddr + DATAPORT);
outb(0x05, ioaddr + RX_CTRL);
lp->stats.rx_dropped++;
dev->stats.rx_dropped++;
break;
}
skb_reserve(skb,2);
......@@ -772,8 +768,8 @@ net_rx(struct net_device *dev)
skb->protocol=eth_type_trans(skb, dev);
netif_rx(skb);
dev->last_rx = jiffies;
lp->stats.rx_packets++;
lp->stats.rx_bytes += pkt_len;
dev->stats.rx_packets++;
dev->stats.rx_bytes += pkt_len;
}
if (--boguscount <= 0)
break;
......@@ -822,17 +818,6 @@ static int net_close(struct net_device *dev)
return 0;
}
/* Get the current statistics.
This may be called with the card open or closed.
There are no on-chip counters, so this function is trivial.
*/
static struct net_device_stats *
net_get_stats(struct net_device *dev)
{
struct net_local *lp = netdev_priv(dev);
return &lp->stats;
}
/*
Set the multicast/promiscuous mode for this adaptor.
*/
......
......@@ -224,7 +224,6 @@ struct lance_private {
int dirty_tx; /* Ring entries to be freed. */
/* copy function */
void *(*memcpy_f)( void *, const void *, size_t );
struct net_device_stats stats;
/* This must be long for set_bit() */
long tx_full;
spinlock_t devlock;
......@@ -347,7 +346,6 @@ static int lance_start_xmit( struct sk_buff *skb, struct net_device *dev );
static irqreturn_t lance_interrupt( int irq, void *dev_id );
static int lance_rx( struct net_device *dev );
static int lance_close( struct net_device *dev );
static struct net_device_stats *lance_get_stats( struct net_device *dev );
static void set_multicast_list( struct net_device *dev );
static int lance_set_mac_address( struct net_device *dev, void *addr );
static void lance_tx_timeout (struct net_device *dev);
......@@ -631,7 +629,6 @@ static unsigned long __init lance_probe1( struct net_device *dev,
dev->open = &lance_open;
dev->hard_start_xmit = &lance_start_xmit;
dev->stop = &lance_close;
dev->get_stats = &lance_get_stats;
dev->set_multicast_list = &set_multicast_list;
dev->set_mac_address = &lance_set_mac_address;
......@@ -639,13 +636,6 @@ static unsigned long __init lance_probe1( struct net_device *dev,
dev->tx_timeout = lance_tx_timeout;
dev->watchdog_timeo = TX_TIMEOUT;
#if 0
dev->start = 0;
#endif
memset( &lp->stats, 0, sizeof(lp->stats) );
return( 1 );
}
......@@ -753,7 +743,7 @@ static void lance_tx_timeout (struct net_device *dev)
* little endian mode.
*/
REGA( CSR3 ) = CSR3_BSWP | (lp->cardtype == PAM_CARD ? CSR3_ACON : 0);
lp->stats.tx_errors++;
dev->stats.tx_errors++;
#ifndef final_version
{ int i;
DPRINTK( 2, ( "Ring data: dirty_tx %d cur_tx %d%s cur_rx %d\n",
......@@ -841,7 +831,7 @@ static int lance_start_xmit( struct sk_buff *skb, struct net_device *dev )
head->misc = 0;
lp->memcpy_f( PKTBUF_ADDR(head), (void *)skb->data, skb->len );
head->flag = TMD1_OWN_CHIP | TMD1_ENP | TMD1_STP;
lp->stats.tx_bytes += skb->len;
dev->stats.tx_bytes += skb->len;
dev_kfree_skb( skb );
lp->cur_tx++;
while( lp->cur_tx >= TX_RING_SIZE && lp->dirty_tx >= TX_RING_SIZE ) {
......@@ -912,13 +902,13 @@ static irqreturn_t lance_interrupt( int irq, void *dev_id )
if (status & TMD1_ERR) {
/* There was an major error, log it. */
int err_status = MEM->tx_head[entry].misc;
lp->stats.tx_errors++;
if (err_status & TMD3_RTRY) lp->stats.tx_aborted_errors++;
if (err_status & TMD3_LCAR) lp->stats.tx_carrier_errors++;
if (err_status & TMD3_LCOL) lp->stats.tx_window_errors++;
dev->stats.tx_errors++;
if (err_status & TMD3_RTRY) dev->stats.tx_aborted_errors++;
if (err_status & TMD3_LCAR) dev->stats.tx_carrier_errors++;
if (err_status & TMD3_LCOL) dev->stats.tx_window_errors++;
if (err_status & TMD3_UFLO) {
/* Ackk! On FIFO errors the Tx unit is turned off! */
lp->stats.tx_fifo_errors++;
dev->stats.tx_fifo_errors++;
/* Remove this verbosity later! */
DPRINTK( 1, ( "%s: Tx FIFO error! Status %04x\n",
dev->name, csr0 ));
......@@ -927,8 +917,8 @@ static irqreturn_t lance_interrupt( int irq, void *dev_id )
}
} else {
if (status & (TMD1_MORE | TMD1_ONE | TMD1_DEF))
lp->stats.collisions++;
lp->stats.tx_packets++;
dev->stats.collisions++;
dev->stats.tx_packets++;
}
/* XXX MSch: free skb?? */
......@@ -955,8 +945,8 @@ static irqreturn_t lance_interrupt( int irq, void *dev_id )
}
/* Log misc errors. */
if (csr0 & CSR0_BABL) lp->stats.tx_errors++; /* Tx babble. */
if (csr0 & CSR0_MISS) lp->stats.rx_errors++; /* Missed a Rx frame. */
if (csr0 & CSR0_BABL) dev->stats.tx_errors++; /* Tx babble. */
if (csr0 & CSR0_MISS) dev->stats.rx_errors++; /* Missed a Rx frame. */
if (csr0 & CSR0_MERR) {
DPRINTK( 1, ( "%s: Bus master arbitration failure (?!?), "
"status %04x.\n", dev->name, csr0 ));
......@@ -997,11 +987,11 @@ static int lance_rx( struct net_device *dev )
buffers it's possible for a jabber packet to use two
buffers, with only the last correctly noting the error. */
if (status & RMD1_ENP) /* Only count a general error at the */
lp->stats.rx_errors++; /* end of a packet.*/
if (status & RMD1_FRAM) lp->stats.rx_frame_errors++;
if (status & RMD1_OFLO) lp->stats.rx_over_errors++;
if (status & RMD1_CRC) lp->stats.rx_crc_errors++;
if (status & RMD1_BUFF) lp->stats.rx_fifo_errors++;
dev->stats.rx_errors++; /* end of a packet.*/
if (status & RMD1_FRAM) dev->stats.rx_frame_errors++;
if (status & RMD1_OFLO) dev->stats.rx_over_errors++;
if (status & RMD1_CRC) dev->stats.rx_crc_errors++;
if (status & RMD1_BUFF) dev->stats.rx_fifo_errors++;
head->flag &= (RMD1_ENP|RMD1_STP);
} else {
/* Malloc up new buffer, compatible with net-3. */
......@@ -1010,7 +1000,7 @@ static int lance_rx( struct net_device *dev )
if (pkt_len < 60) {
printk( "%s: Runt packet!\n", dev->name );
lp->stats.rx_errors++;
dev->stats.rx_errors++;
}
else {
skb = dev_alloc_skb( pkt_len+2 );
......@@ -1023,7 +1013,7 @@ static int lance_rx( struct net_device *dev )
break;
if (i > RX_RING_SIZE - 2) {
lp->stats.rx_dropped++;
dev->stats.rx_dropped++;
head->flag |= RMD1_OWN_CHIP;
lp->cur_rx++;
}
......@@ -1052,8 +1042,8 @@ static int lance_rx( struct net_device *dev )
skb->protocol = eth_type_trans( skb, dev );
netif_rx( skb );
dev->last_rx = jiffies;
lp->stats.rx_packets++;
lp->stats.rx_bytes += pkt_len;
dev->stats.rx_packets++;
dev->stats.rx_bytes += pkt_len;
}
}
......@@ -1090,14 +1080,6 @@ static int lance_close( struct net_device *dev )
}
static struct net_device_stats *lance_get_stats( struct net_device *dev )
{ struct lance_private *lp = (struct lance_private *)dev->priv;
return &lp->stats;
}
/* Set or clear the multicast filter for this adaptor.
num_addrs == -1 Promiscuous mode, receive all packets
num_addrs == 0 Normal mode, clear multicast list
......
......@@ -171,7 +171,6 @@ static char mux_8012[] = { 0xff, 0xf7, 0xff, 0xfb, 0xf3, 0xfb, 0xff, 0xf7,};
struct net_local {
spinlock_t lock;
struct net_device *next_module;
struct net_device_stats stats;
struct timer_list timer; /* Media selection timer. */
long last_rx_time; /* Last Rx, in jiffies, to handle Rx hang. */
int saved_tx_size;
......@@ -205,7 +204,6 @@ static irqreturn_t atp_interrupt(int irq, void *dev_id);
static void net_rx(struct net_device *dev);
static void read_block(long ioaddr, int length, unsigned char *buffer, int data_mode);
static int net_close(struct net_device *dev);
static struct net_device_stats *net_get_stats(struct net_device *dev);
static void set_rx_mode_8002(struct net_device *dev);
static void set_rx_mode_8012(struct net_device *dev);
static void tx_timeout(struct net_device *dev);
......@@ -348,7 +346,6 @@ static int __init atp_probe1(long ioaddr)
dev->open = net_open;
dev->stop = net_close;
dev->hard_start_xmit = atp_send_packet;
dev->get_stats = net_get_stats;
dev->set_multicast_list =
lp->chip_type == RTL8002 ? &set_rx_mode_8002 : &set_rx_mode_8012;
dev->tx_timeout = tx_timeout;
......@@ -538,18 +535,17 @@ static void write_packet(long ioaddr, int length, unsigned char *packet, int pad
static void tx_timeout(struct net_device *dev)
{
struct net_local *np = netdev_priv(dev);
long ioaddr = dev->base_addr;
printk(KERN_WARNING "%s: Transmit timed out, %s?\n", dev->name,
inb(ioaddr + PAR_CONTROL) & 0x10 ? "network cable problem"
: "IRQ conflict");
np->stats.tx_errors++;
dev->stats.tx_errors++;
/* Try to restart the adapter. */
hardware_init(dev);
dev->trans_start = jiffies;
netif_wake_queue(dev);
np->stats.tx_errors++;
dev->stats.tx_errors++;
}
static int atp_send_packet(struct sk_buff *skb, struct net_device *dev)
......@@ -629,7 +625,7 @@ static irqreturn_t atp_interrupt(int irq, void *dev_instance)
/* We acknowledged the normal Rx interrupt, so if the interrupt
is still outstanding we must have a Rx error. */
if (read_status & (CMR1_IRQ << 3)) { /* Overrun. */
lp->stats.rx_over_errors++;
dev->stats.rx_over_errors++;
/* Set to no-accept mode long enough to remove a packet. */
write_reg_high(ioaddr, CMR2, CMR2h_OFF);
net_rx(dev);
......@@ -649,9 +645,9 @@ static irqreturn_t atp_interrupt(int irq, void *dev_instance)
and reinitialize the adapter. */
write_reg(ioaddr, ISR, ISR_TxErr + ISR_TxOK);
if (status & (ISR_TxErr<<3)) {
lp->stats.collisions++;
dev->stats.collisions++;
if (++lp->re_tx > 15) {
lp->stats.tx_aborted_errors++;
dev->stats.tx_aborted_errors++;
hardware_init(dev);
break;
}
......@@ -660,7 +656,7 @@ static irqreturn_t atp_interrupt(int irq, void *dev_instance)
write_reg(ioaddr, CMR1, CMR1_ReXmit + CMR1_Xmit);
} else {
/* Finish up the transmit. */
lp->stats.tx_packets++;
dev->stats.tx_packets++;
lp->pac_cnt_in_tx_buf--;
if ( lp->saved_tx_size) {
trigger_send(ioaddr, lp->saved_tx_size);
......@@ -678,7 +674,7 @@ static irqreturn_t atp_interrupt(int irq, void *dev_instance)
"%ld jiffies status %02x CMR1 %02x.\n", dev->name,
num_tx_since_rx, jiffies - dev->last_rx, status,
(read_nibble(ioaddr, CMR1) >> 3) & 15);
lp->stats.rx_missed_errors++;
dev->stats.rx_missed_errors++;
hardware_init(dev);
num_tx_since_rx = 0;
break;
......@@ -735,13 +731,13 @@ static void atp_timed_checker(unsigned long data)
struct net_local *lp = netdev_priv(atp_timed_dev);
write_reg_byte(ioaddr, PAR0 + i, atp_timed_dev->dev_addr[i]);
if (i == 2)
lp->stats.tx_errors++;
dev->stats.tx_errors++;
else if (i == 3)
lp->stats.tx_dropped++;
dev->stats.tx_dropped++;
else if (i == 4)
lp->stats.collisions++;
dev->stats.collisions++;
else
lp->stats.rx_errors++;
dev->stats.rx_errors++;
}
#endif
}
......@@ -765,14 +761,14 @@ static void net_rx(struct net_device *dev)
printk(KERN_DEBUG " rx_count %04x %04x %04x %04x..", rx_head.pad,
rx_head.rx_count, rx_head.rx_status, rx_head.cur_addr);
if ((rx_head.rx_status & 0x77) != 0x01) {
lp->stats.rx_errors++;
if (rx_head.rx_status & 0x0004) lp->stats.rx_frame_errors++;
else if (rx_head.rx_status & 0x0002) lp->stats.rx_crc_errors++;
dev->stats.rx_errors++;
if (rx_head.rx_status & 0x0004) dev->stats.rx_frame_errors++;
else if (rx_head.rx_status & 0x0002) dev->stats.rx_crc_errors++;
if (net_debug > 3)
printk(KERN_DEBUG "%s: Unknown ATP Rx error %04x.\n",
dev->name, rx_head.rx_status);
if (rx_head.rx_status & 0x0020) {
lp->stats.rx_fifo_errors++;
dev->stats.rx_fifo_errors++;
write_reg_high(ioaddr, CMR1, CMR1h_TxENABLE);
write_reg_high(ioaddr, CMR1, CMR1h_RxENABLE | CMR1h_TxENABLE);
} else if (rx_head.rx_status & 0x0050)
......@@ -787,7 +783,7 @@ static void net_rx(struct net_device *dev)
if (skb == NULL) {
printk(KERN_ERR "%s: Memory squeeze, dropping packet.\n",
dev->name);
lp->stats.rx_dropped++;
dev->stats.rx_dropped++;
goto done;
}
......@@ -796,8 +792,8 @@ static void net_rx(struct net_device *dev)
skb->protocol = eth_type_trans(skb, dev);
netif_rx(skb);
dev->last_rx = jiffies;
lp->stats.rx_packets++;
lp->stats.rx_bytes += pkt_len;
dev->stats.rx_packets++;
dev->stats.rx_bytes += pkt_len;
}
done:
write_reg(ioaddr, CMR1, CMR1_NextPkt);
......@@ -849,15 +845,6 @@ net_close(struct net_device *dev)
return 0;
}
/* Get the current statistics. This may be called with the card open or
closed. */
static struct net_device_stats *
net_get_stats(struct net_device *dev)
{
struct net_local *lp = netdev_priv(dev);
return &lp->stats;
}
/*
* Set or clear the multicast filter for this adapter.
*/
......
......@@ -90,7 +90,6 @@ static int au1000_rx(struct net_device *);
static irqreturn_t au1000_interrupt(int, void *);
static void au1000_tx_timeout(struct net_device *);
static void set_rx_mode(struct net_device *);
static struct net_device_stats *au1000_get_stats(struct net_device *);
static int au1000_ioctl(struct net_device *, struct ifreq *, int);
static int mdio_read(struct net_device *, int, int);
static void mdio_write(struct net_device *, int, int, u16);
......@@ -772,7 +771,6 @@ static struct net_device * au1000_probe(int port_num)
dev->open = au1000_open;
dev->hard_start_xmit = au1000_tx;
dev->stop = au1000_close;
dev->get_stats = au1000_get_stats;
dev->set_multicast_list = &set_rx_mode;
dev->do_ioctl = &au1000_ioctl;
SET_ETHTOOL_OPS(dev, &au1000_ethtool_ops);
......@@ -1038,7 +1036,7 @@ static void __exit au1000_cleanup_module(void)
static void update_tx_stats(struct net_device *dev, u32 status)
{
struct au1000_private *aup = (struct au1000_private *) dev->priv;
struct net_device_stats *ps = &aup->stats;
struct net_device_stats *ps = &dev->stats;
if (status & TX_FRAME_ABORTED) {
if (!aup->phy_dev || (DUPLEX_FULL == aup->phy_dev->duplex)) {
......@@ -1094,7 +1092,7 @@ static void au1000_tx_ack(struct net_device *dev)
static int au1000_tx(struct sk_buff *skb, struct net_device *dev)
{
struct au1000_private *aup = (struct au1000_private *) dev->priv;
struct net_device_stats *ps = &aup->stats;
struct net_device_stats *ps = &dev->stats;
volatile tx_dma_t *ptxd;
u32 buff_stat;
db_dest_t *pDB;
......@@ -1148,7 +1146,7 @@ static int au1000_tx(struct sk_buff *skb, struct net_device *dev)
static inline void update_rx_stats(struct net_device *dev, u32 status)
{
struct au1000_private *aup = (struct au1000_private *) dev->priv;
struct net_device_stats *ps = &aup->stats;
struct net_device_stats *ps = &dev->stats;
ps->rx_packets++;
if (status & RX_MCAST_FRAME)
......@@ -1201,7 +1199,7 @@ static int au1000_rx(struct net_device *dev)
printk(KERN_ERR
"%s: Memory squeeze, dropping packet.\n",
dev->name);
aup->stats.rx_dropped++;
dev->stats.rx_dropped++;
continue;
}
skb_reserve(skb, 2); /* 16 byte IP header align */
......@@ -1324,18 +1322,5 @@ static int au1000_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
return phy_mii_ioctl(aup->phy_dev, if_mii(rq), cmd);
}
static struct net_device_stats *au1000_get_stats(struct net_device *dev)
{
struct au1000_private *aup = (struct au1000_private *) dev->priv;
if (au1000_debug > 4)
printk("%s: au1000_get_stats: dev=%p\n", dev->name, dev);
if (netif_device_present(dev)) {
return &aup->stats;
}
return 0;
}
module_init(au1000_init_module);
module_exit(au1000_cleanup_module);
......@@ -115,6 +115,5 @@ struct au1000_private {
u32 vaddr; /* virtual address of rx/tx buffers */
dma_addr_t dma_addr; /* dma address of rx/tx buffers */
struct net_device_stats stats;
spinlock_t lock; /* Serialise access to device */
};
......@@ -579,8 +579,8 @@ static int bf537mac_hard_start_xmit(struct sk_buff *skb,
adjust_tx_list();
current_tx_ptr = current_tx_ptr->next;
dev->trans_start = jiffies;
lp->stats.tx_packets++;
lp->stats.tx_bytes += (skb->len);
dev->stats.tx_packets++;
dev->stats.tx_bytes += (skb->len);
return 0;
}
......@@ -596,7 +596,7 @@ static void bf537mac_rx(struct net_device *dev)
if (!new_skb) {
printk(KERN_NOTICE DRV_NAME
": rx: low on mem - packet dropped\n");
lp->stats.rx_dropped++;
dev->stats.rx_dropped++;
goto out;
}
/* reserve 2 bytes for RXDWA padding */
......@@ -618,8 +618,8 @@ static void bf537mac_rx(struct net_device *dev)
#endif
netif_rx(skb);
lp->stats.rx_packets++;
lp->stats.rx_bytes += len;
dev->stats.rx_packets++;
dev->stats.rx_bytes += len;
current_rx_ptr->status.status_word = 0x00000000;
current_rx_ptr = current_rx_ptr->next;
......@@ -732,20 +732,6 @@ static void bf537mac_timeout(struct net_device *dev)
netif_wake_queue(dev);
}
/*
* Get the current statistics.
* This may be called with the card open or closed.
*/
static struct net_device_stats *bf537mac_query_statistics(struct net_device
*dev)
{
struct bf537mac_local *lp = netdev_priv(dev);
pr_debug("%s: %s\n", dev->name, __FUNCTION__);
return &lp->stats;
}
/*
* This routine will, depending on the values passed to it,
* either make it accept multicast packets, go into
......@@ -891,7 +877,6 @@ static int __init bf537mac_probe(struct net_device *dev)
dev->stop = bf537mac_close;
dev->hard_start_xmit = bf537mac_hard_start_xmit;
dev->tx_timeout = bf537mac_timeout;
dev->get_stats = bf537mac_query_statistics;
dev->set_multicast_list = bf537mac_set_multicast_list;
#ifdef CONFIG_NET_POLL_CONTROLLER
dev->poll_controller = bf537mac_poll;
......
......@@ -104,8 +104,6 @@ struct bf537mac_local {
* can find out semi-useless statistics of how well the card is
* performing
*/
struct net_device_stats stats;
int version;
int FlowEnabled; /* record if data flow is active */
......
......@@ -75,7 +75,6 @@ struct bmac_data {
int tx_fill;
int tx_empty;
unsigned char tx_fullup;
struct net_device_stats stats;
struct timer_list tx_timeout;
int timeout_active;
int sleeping;
......@@ -145,7 +144,6 @@ static unsigned char *bmac_emergency_rxbuf;
static int bmac_open(struct net_device *dev);
static int bmac_close(struct net_device *dev);
static int bmac_transmit_packet(struct sk_buff *skb, struct net_device *dev);
static struct net_device_stats *bmac_stats(struct net_device *dev);
static void bmac_set_multicast(struct net_device *dev);
static void bmac_reset_and_enable(struct net_device *dev);
static void bmac_start_chip(struct net_device *dev);
......@@ -668,7 +666,7 @@ static int bmac_transmit_packet(struct sk_buff *skb, struct net_device *dev)
bp->tx_bufs[bp->tx_fill] = skb;
bp->tx_fill = i;
bp->stats.tx_bytes += skb->len;
dev->stats.tx_bytes += skb->len;
dbdma_continue(td);
......@@ -707,8 +705,8 @@ static irqreturn_t bmac_rxdma_intr(int irq, void *dev_id)
nb = RX_BUFLEN - residual - 2;
if (nb < (ETHERMINPACKET - ETHERCRC)) {
skb = NULL;
bp->stats.rx_length_errors++;
bp->stats.rx_errors++;
dev->stats.rx_length_errors++;
dev->stats.rx_errors++;
} else {
skb = bp->rx_bufs[i];
bp->rx_bufs[i] = NULL;
......@@ -719,10 +717,10 @@ static irqreturn_t bmac_rxdma_intr(int irq, void *dev_id)
skb->protocol = eth_type_trans(skb, dev);
netif_rx(skb);
dev->last_rx = jiffies;
++bp->stats.rx_packets;
bp->stats.rx_bytes += nb;
++dev->stats.rx_packets;
dev->stats.rx_bytes += nb;
} else {
++bp->stats.rx_dropped;
++dev->stats.rx_dropped;
}
dev->last_rx = jiffies;
if ((skb = bp->rx_bufs[i]) == NULL) {
......@@ -785,7 +783,7 @@ static irqreturn_t bmac_txdma_intr(int irq, void *dev_id)
}
if (bp->tx_bufs[bp->tx_empty]) {
++bp->stats.tx_packets;
++dev->stats.tx_packets;
dev_kfree_skb_irq(bp->tx_bufs[bp->tx_empty]);
}
bp->tx_bufs[bp->tx_empty] = NULL;
......@@ -807,13 +805,6 @@ static irqreturn_t bmac_txdma_intr(int irq, void *dev_id)
return IRQ_HANDLED;
}
static struct net_device_stats *bmac_stats(struct net_device *dev)
{
struct bmac_data *p = netdev_priv(dev);
return &p->stats;
}
#ifndef SUNHME_MULTICAST
/* Real fast bit-reversal algorithm, 6-bit values */
static int reverse6[64] = {
......@@ -1080,17 +1071,17 @@ static irqreturn_t bmac_misc_intr(int irq, void *dev_id)
}
/* XXDEBUG(("bmac_misc_intr, status=%#08x\n", status)); */
/* bmac_txdma_intr_inner(irq, dev_id); */
/* if (status & FrameReceived) bp->stats.rx_dropped++; */
if (status & RxErrorMask) bp->stats.rx_errors++;
if (status & RxCRCCntExp) bp->stats.rx_crc_errors++;
if (status & RxLenCntExp) bp->stats.rx_length_errors++;
if (status & RxOverFlow) bp->stats.rx_over_errors++;
if (status & RxAlignCntExp) bp->stats.rx_frame_errors++;
/* if (status & FrameSent) bp->stats.tx_dropped++; */
if (status & TxErrorMask) bp->stats.tx_errors++;
if (status & TxUnderrun) bp->stats.tx_fifo_errors++;
if (status & TxNormalCollExp) bp->stats.collisions++;
/* if (status & FrameReceived) dev->stats.rx_dropped++; */
if (status & RxErrorMask) dev->stats.rx_errors++;
if (status & RxCRCCntExp) dev->stats.rx_crc_errors++;
if (status & RxLenCntExp) dev->stats.rx_length_errors++;
if (status & RxOverFlow) dev->stats.rx_over_errors++;
if (status & RxAlignCntExp) dev->stats.rx_frame_errors++;
/* if (status & FrameSent) dev->stats.tx_dropped++; */
if (status & TxErrorMask) dev->stats.tx_errors++;
if (status & TxUnderrun) dev->stats.tx_fifo_errors++;
if (status & TxNormalCollExp) dev->stats.collisions++;
return IRQ_HANDLED;
}
......@@ -1324,7 +1315,6 @@ static int __devinit bmac_probe(struct macio_dev *mdev, const struct of_device_i
dev->stop = bmac_close;
dev->ethtool_ops = &bmac_ethtool_ops;
dev->hard_start_xmit = bmac_output;
dev->get_stats = bmac_stats;
dev->set_multicast_list = bmac_set_multicast;
dev->set_mac_address = bmac_set_address;
......@@ -1542,7 +1532,7 @@ static void bmac_tx_timeout(unsigned long data)
XXDEBUG((KERN_DEBUG "bmac: tx empty=%d fill=%d fullup=%d\n",
bp->tx_empty, bp->tx_fill, bp->tx_fullup));
i = bp->tx_empty;
++bp->stats.tx_errors;
++dev->stats.tx_errors;
if (i != bp->tx_fill) {
dev_kfree_skb(bp->tx_bufs[i]);
bp->tx_bufs[i] = NULL;
......
......@@ -154,11 +154,6 @@ static int de600_close(struct net_device *dev)
return 0;
}
static struct net_device_stats *get_stats(struct net_device *dev)
{
return (struct net_device_stats *)(dev->priv);
}
static inline void trigger_interrupt(struct net_device *dev)
{
de600_put_command(FLIP_IRQ);
......@@ -308,7 +303,7 @@ static int de600_tx_intr(struct net_device *dev, int irq_status)
if (!(irq_status & TX_FAILED16)) {
tx_fifo_out = (tx_fifo_out + 1) % TX_PAGES;
++free_tx_pages;
((struct net_device_stats *)(dev->priv))->tx_packets++;
dev->stats.tx_packets++;
netif_wake_queue(dev);
}
......@@ -375,8 +370,8 @@ static void de600_rx_intr(struct net_device *dev)
/* update stats */
dev->last_rx = jiffies;
((struct net_device_stats *)(dev->priv))->rx_packets++; /* count all receives */
((struct net_device_stats *)(dev->priv))->rx_bytes += size; /* count all received bytes */
dev->stats.rx_packets++; /* count all receives */
dev->stats.rx_bytes += size; /* count all received bytes */
/*
* If any worth-while packets have been received, netif_rx()
......@@ -390,7 +385,7 @@ static struct net_device * __init de600_probe(void)
struct net_device *dev;
int err;
dev = alloc_etherdev(sizeof(struct net_device_stats));
dev = alloc_etherdev(0);
if (!dev)
return ERR_PTR(-ENOMEM);
......@@ -448,8 +443,6 @@ static struct net_device * __init de600_probe(void)
printk(":%02X",dev->dev_addr[i]);
printk("\n");
dev->get_stats = get_stats;
dev->open = de600_open;
dev->stop = de600_close;
dev->hard_start_xmit = &de600_start_xmit;
......
......@@ -121,7 +121,6 @@ static u8 de600_read_byte(unsigned char type, struct net_device *dev);
/* Put in the device structure. */
static int de600_open(struct net_device *dev);
static int de600_close(struct net_device *dev);
static struct net_device_stats *get_stats(struct net_device *dev);
static int de600_start_xmit(struct sk_buff *skb, struct net_device *dev);
/* Dispatch from interrupts. */
......
......@@ -216,7 +216,6 @@ MODULE_PARM_DESC(de620_debug, "DE-620 debug level (0-2)");
/* Put in the device structure. */
static int de620_open(struct net_device *);
static int de620_close(struct net_device *);
static struct net_device_stats *get_stats(struct net_device *);
static void de620_set_multicast_list(struct net_device *);
static int de620_start_xmit(struct sk_buff *, struct net_device *);
......@@ -478,16 +477,6 @@ static int de620_close(struct net_device *dev)
return 0;
}
/*********************************************
*
* Return current statistics
*
*/
static struct net_device_stats *get_stats(struct net_device *dev)
{
return (struct net_device_stats *)(dev->priv);
}
/*********************************************
*
* Set or clear the multicast filter for this adaptor.
......@@ -579,7 +568,7 @@ static int de620_start_xmit(struct sk_buff *skb, struct net_device *dev)
if(!(using_txbuf == (TXBF0 | TXBF1)))
netif_wake_queue(dev);
((struct net_device_stats *)(dev->priv))->tx_packets++;
dev->stats.tx_packets++;
spin_unlock_irqrestore(&de620_lock, flags);
dev_kfree_skb (skb);
return 0;
......@@ -660,7 +649,7 @@ static int de620_rx_intr(struct net_device *dev)
/* You win some, you lose some. And sometimes plenty... */
adapter_init(dev);
netif_wake_queue(dev);
((struct net_device_stats *)(dev->priv))->rx_over_errors++;
dev->stats.rx_over_errors++;
return 0;
}
......@@ -680,7 +669,7 @@ static int de620_rx_intr(struct net_device *dev)
next_rx_page = header_buf.Rx_NextPage; /* at least a try... */
de620_send_command(dev, W_DUMMY);
de620_set_register(dev, W_NPRF, next_rx_page);
((struct net_device_stats *)(dev->priv))->rx_over_errors++;
dev->stats.rx_over_errors++;
return 0;
}
next_rx_page = pagelink;
......@@ -693,7 +682,7 @@ static int de620_rx_intr(struct net_device *dev)
skb = dev_alloc_skb(size+2);
if (skb == NULL) { /* Yeah, but no place to put it... */
printk(KERN_WARNING "%s: Couldn't allocate a sk_buff of size %d.\n", dev->name, size);
((struct net_device_stats *)(dev->priv))->rx_dropped++;
dev->stats.rx_dropped++;
}
else { /* Yep! Go get it! */
skb_reserve(skb,2); /* Align */
......@@ -706,8 +695,8 @@ static int de620_rx_intr(struct net_device *dev)
netif_rx(skb); /* deliver it "upstairs" */
dev->last_rx = jiffies;
/* count all receives */
((struct net_device_stats *)(dev->priv))->rx_packets++;
((struct net_device_stats *)(dev->priv))->rx_bytes += size;
dev->stats.rx_packets++;
dev->stats.rx_bytes += size;
}
}
......@@ -819,7 +808,7 @@ struct net_device * __init de620_probe(int unit)
int err = -ENOMEM;
int i;
dev = alloc_etherdev(sizeof(struct net_device_stats));
dev = alloc_etherdev(0);
if (!dev)
goto out;
......@@ -879,7 +868,6 @@ struct net_device * __init de620_probe(int unit)
else
printk(" UTP)\n");
dev->get_stats = get_stats;
dev->open = de620_open;
dev->stop = de620_close;
dev->hard_start_xmit = de620_start_xmit;
......
......@@ -258,8 +258,6 @@ struct lance_private {
int rx_new, tx_new;
int rx_old, tx_old;
struct net_device_stats stats;
unsigned short busmaster_regval;
struct timer_list multicast_timer;
......@@ -583,22 +581,22 @@ static int lance_rx(struct net_device *dev)
/* We got an incomplete frame? */
if ((bits & LE_R1_POK) != LE_R1_POK) {
lp->stats.rx_over_errors++;
lp->stats.rx_errors++;
dev->stats.rx_over_errors++;
dev->stats.rx_errors++;
} else if (bits & LE_R1_ERR) {
/* Count only the end frame as a rx error,
* not the beginning
*/
if (bits & LE_R1_BUF)
lp->stats.rx_fifo_errors++;
dev->stats.rx_fifo_errors++;
if (bits & LE_R1_CRC)
lp->stats.rx_crc_errors++;
dev->stats.rx_crc_errors++;
if (bits & LE_R1_OFL)
lp->stats.rx_over_errors++;
dev->stats.rx_over_errors++;
if (bits & LE_R1_FRA)
lp->stats.rx_frame_errors++;
dev->stats.rx_frame_errors++;
if (bits & LE_R1_EOP)
lp->stats.rx_errors++;
dev->stats.rx_errors++;
} else {
len = (*rds_ptr(rd, mblength, lp->type) & 0xfff) - 4;
skb = dev_alloc_skb(len + 2);
......@@ -606,7 +604,7 @@ static int lance_rx(struct net_device *dev)
if (skb == 0) {
printk("%s: Memory squeeze, deferring packet.\n",
dev->name);
lp->stats.rx_dropped++;
dev->stats.rx_dropped++;
*rds_ptr(rd, mblength, lp->type) = 0;
*rds_ptr(rd, rmd1, lp->type) =
((lp->rx_buf_ptr_lnc[entry] >> 16) &
......@@ -614,7 +612,7 @@ static int lance_rx(struct net_device *dev)
lp->rx_new = (entry + 1) & RX_RING_MOD_MASK;
return 0;
}
lp->stats.rx_bytes += len;
dev->stats.rx_bytes += len;
skb_reserve(skb, 2); /* 16 byte align */
skb_put(skb, len); /* make room */
......@@ -625,7 +623,7 @@ static int lance_rx(struct net_device *dev)
skb->protocol = eth_type_trans(skb, dev);
netif_rx(skb);
dev->last_rx = jiffies;
lp->stats.rx_packets++;
dev->stats.rx_packets++;
}
/* Return the packet to the pool */
......@@ -660,14 +658,14 @@ static void lance_tx(struct net_device *dev)
if (*tds_ptr(td, tmd1, lp->type) & LE_T1_ERR) {
status = *tds_ptr(td, misc, lp->type);
lp->stats.tx_errors++;
dev->stats.tx_errors++;
if (status & LE_T3_RTY)
lp->stats.tx_aborted_errors++;
dev->stats.tx_aborted_errors++;
if (status & LE_T3_LCOL)
lp->stats.tx_window_errors++;
dev->stats.tx_window_errors++;
if (status & LE_T3_CLOS) {
lp->stats.tx_carrier_errors++;
dev->stats.tx_carrier_errors++;
printk("%s: Carrier Lost\n", dev->name);
/* Stop the lance */
writereg(&ll->rap, LE_CSR0);
......@@ -681,7 +679,7 @@ static void lance_tx(struct net_device *dev)
* transmitter, restart the adapter.
*/
if (status & (LE_T3_BUF | LE_T3_UFL)) {
lp->stats.tx_fifo_errors++;
dev->stats.tx_fifo_errors++;
printk("%s: Tx: ERR_BUF|ERR_UFL, restarting\n",
dev->name);
......@@ -702,13 +700,13 @@ static void lance_tx(struct net_device *dev)
/* One collision before packet was sent. */
if (*tds_ptr(td, tmd1, lp->type) & LE_T1_EONE)
lp->stats.collisions++;
dev->stats.collisions++;
/* More than one collision, be optimistic. */
if (*tds_ptr(td, tmd1, lp->type) & LE_T1_EMORE)
lp->stats.collisions += 2;
dev->stats.collisions += 2;
lp->stats.tx_packets++;
dev->stats.tx_packets++;
}
j = (j + 1) & TX_RING_MOD_MASK;
}
......@@ -754,10 +752,10 @@ static irqreturn_t lance_interrupt(const int irq, void *dev_id)
lance_tx(dev);
if (csr0 & LE_C0_BABL)
lp->stats.tx_errors++;
dev->stats.tx_errors++;
if (csr0 & LE_C0_MISS)
lp->stats.rx_errors++;
dev->stats.rx_errors++;
if (csr0 & LE_C0_MERR) {
printk("%s: Memory error, status %04x\n", dev->name, csr0);
......@@ -912,7 +910,7 @@ static int lance_start_xmit(struct sk_buff *skb, struct net_device *dev)
len = ETH_ZLEN;
}
lp->stats.tx_bytes += len;
dev->stats.tx_bytes += len;
entry = lp->tx_new;
*lib_ptr(ib, btx_ring[entry].length, lp->type) = (-len);
......@@ -938,13 +936,6 @@ static int lance_start_xmit(struct sk_buff *skb, struct net_device *dev)
return 0;
}
static struct net_device_stats *lance_get_stats(struct net_device *dev)
{
struct lance_private *lp = netdev_priv(dev);
return &lp->stats;
}
static void lance_load_multicast(struct net_device *dev)
{
struct lance_private *lp = netdev_priv(dev);
......@@ -1244,7 +1235,6 @@ static int __init dec_lance_probe(struct device *bdev, const int type)
dev->hard_start_xmit = &lance_start_xmit;
dev->tx_timeout = &lance_tx_timeout;
dev->watchdog_timeo = 5*HZ;
dev->get_stats = &lance_get_stats;
dev->set_multicast_list = &lance_set_multicast;
/* lp->ll is the location of the registers for lance card */
......
......@@ -485,7 +485,6 @@ struct depca_private {
/* Kernel-only (not device) fields */
int rx_new, tx_new; /* The next free ring entry */
int rx_old, tx_old; /* The ring entries to be free()ed. */
struct net_device_stats stats;
spinlock_t lock;
struct { /* Private stats counters */
u32 bins[DEPCA_PKT_STAT_SZ];
......@@ -522,7 +521,6 @@ static irqreturn_t depca_interrupt(int irq, void *dev_id);
static int depca_close(struct net_device *dev);
static int depca_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
static void depca_tx_timeout(struct net_device *dev);
static struct net_device_stats *depca_get_stats(struct net_device *dev);
static void set_multicast_list(struct net_device *dev);
/*
......@@ -801,7 +799,6 @@ static int __init depca_hw_init (struct net_device *dev, struct device *device)
dev->open = &depca_open;
dev->hard_start_xmit = &depca_start_xmit;
dev->stop = &depca_close;
dev->get_stats = &depca_get_stats;
dev->set_multicast_list = &set_multicast_list;
dev->do_ioctl = &depca_ioctl;
dev->tx_timeout = depca_tx_timeout;
......@@ -1026,15 +1023,15 @@ static int depca_rx(struct net_device *dev)
}
if (status & R_ENP) { /* Valid frame status */
if (status & R_ERR) { /* There was an error. */
lp->stats.rx_errors++; /* Update the error stats. */
dev->stats.rx_errors++; /* Update the error stats. */
if (status & R_FRAM)
lp->stats.rx_frame_errors++;
dev->stats.rx_frame_errors++;
if (status & R_OFLO)
lp->stats.rx_over_errors++;
dev->stats.rx_over_errors++;
if (status & R_CRC)
lp->stats.rx_crc_errors++;
dev->stats.rx_crc_errors++;
if (status & R_BUFF)
lp->stats.rx_fifo_errors++;
dev->stats.rx_fifo_errors++;
} else {
short len, pkt_len = readw(&lp->rx_ring[entry].msg_length) - 4;
struct sk_buff *skb;
......@@ -1063,8 +1060,8 @@ static int depca_rx(struct net_device *dev)
** Update stats
*/
dev->last_rx = jiffies;
lp->stats.rx_packets++;
lp->stats.rx_bytes += pkt_len;
dev->stats.rx_packets++;
dev->stats.rx_bytes += pkt_len;
for (i = 1; i < DEPCA_PKT_STAT_SZ - 1; i++) {
if (pkt_len < (i * DEPCA_PKT_BIN_SZ)) {
lp->pktStats.bins[i]++;
......@@ -1087,7 +1084,7 @@ static int depca_rx(struct net_device *dev)
}
} else {
printk("%s: Memory squeeze, deferring packet.\n", dev->name);
lp->stats.rx_dropped++; /* Really, deferred. */
dev->stats.rx_dropped++; /* Really, deferred. */
break;
}
}
......@@ -1125,24 +1122,24 @@ static int depca_tx(struct net_device *dev)
break;
} else if (status & T_ERR) { /* An error occurred. */
status = readl(&lp->tx_ring[entry].misc);
lp->stats.tx_errors++;
dev->stats.tx_errors++;
if (status & TMD3_RTRY)
lp->stats.tx_aborted_errors++;
dev->stats.tx_aborted_errors++;
if (status & TMD3_LCAR)
lp->stats.tx_carrier_errors++;
dev->stats.tx_carrier_errors++;
if (status & TMD3_LCOL)
lp->stats.tx_window_errors++;
dev->stats.tx_window_errors++;
if (status & TMD3_UFLO)
lp->stats.tx_fifo_errors++;
dev->stats.tx_fifo_errors++;
if (status & (TMD3_BUFF | TMD3_UFLO)) {
/* Trigger an immediate send demand. */
outw(CSR0, DEPCA_ADDR);
outw(INEA | TDMD, DEPCA_DATA);
}
} else if (status & (T_MORE | T_ONE)) {
lp->stats.collisions++;
dev->stats.collisions++;
} else {
lp->stats.tx_packets++;
dev->stats.tx_packets++;
}
/* Update all the pointers */
......@@ -1234,15 +1231,6 @@ static int InitRestartDepca(struct net_device *dev)
return status;
}
static struct net_device_stats *depca_get_stats(struct net_device *dev)
{
struct depca_private *lp = (struct depca_private *) dev->priv;
/* Null body since there is no framing error counter */
return &lp->stats;
}
/*
** Set or clear the multicast filter for this adaptor.
*/
......
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