Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 95359
b: refs/heads/master
c: dfd4415
h: refs/heads/master
i:
  95357: e33878f
  95355: f7dccec
  95351: a641ff6
  95343: 670f82f
  95327: 1e4dff0
  95295: 147a742
  95231: 9386f16
v: v3
  • Loading branch information
Paulius Zaleckas authored and Jeff Garzik committed Apr 29, 2008
1 parent aed3f7c commit b582bf7
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 35 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 815f8802d201aba1ce343ba832daf639165f01a1
refs/heads/master: dfd44151e8888b964b7f2400f26794154a58c86b
64 changes: 30 additions & 34 deletions trunk/drivers/net/3c515.c
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,6 @@ struct corkscrew_private {
struct sk_buff *tx_skbuff[TX_RING_SIZE];
unsigned int cur_rx, cur_tx; /* The next free ring entry */
unsigned int dirty_rx, dirty_tx;/* The ring entries to be free()ed. */
struct net_device_stats stats;
struct sk_buff *tx_skb; /* Packet being eaten by bus master ctrl. */
struct timer_list timer; /* Media selection timer. */
int capabilities ; /* Adapter capabilities word. */
Expand Down Expand Up @@ -983,8 +982,8 @@ static void corkscrew_timeout(struct net_device *dev)
break;
outw(TxEnable, ioaddr + EL3_CMD);
dev->trans_start = jiffies;
vp->stats.tx_errors++;
vp->stats.tx_dropped++;
dev->stats.tx_errors++;
dev->stats.tx_dropped++;
netif_wake_queue(dev);
}

Expand Down Expand Up @@ -1050,7 +1049,7 @@ static int corkscrew_start_xmit(struct sk_buff *skb,
}
/* Put out the doubleword header... */
outl(skb->len, ioaddr + TX_FIFO);
vp->stats.tx_bytes += skb->len;
dev->stats.tx_bytes += skb->len;
#ifdef VORTEX_BUS_MASTER
if (vp->bus_master) {
/* Set the bus-master controller to transfer the packet. */
Expand Down Expand Up @@ -1094,9 +1093,9 @@ static int corkscrew_start_xmit(struct sk_buff *skb,
printk("%s: Tx error, status %2.2x.\n",
dev->name, tx_status);
if (tx_status & 0x04)
vp->stats.tx_fifo_errors++;
dev->stats.tx_fifo_errors++;
if (tx_status & 0x38)
vp->stats.tx_aborted_errors++;
dev->stats.tx_aborted_errors++;
if (tx_status & 0x30) {
int j;
outw(TxReset, ioaddr + EL3_CMD);
Expand Down Expand Up @@ -1257,7 +1256,6 @@ static irqreturn_t corkscrew_interrupt(int irq, void *dev_id)

static int corkscrew_rx(struct net_device *dev)
{
struct corkscrew_private *vp = netdev_priv(dev);
int ioaddr = dev->base_addr;
int i;
short rx_status;
Expand All @@ -1271,17 +1269,17 @@ static int corkscrew_rx(struct net_device *dev)
if (corkscrew_debug > 2)
printk(" Rx error: status %2.2x.\n",
rx_error);
vp->stats.rx_errors++;
dev->stats.rx_errors++;
if (rx_error & 0x01)
vp->stats.rx_over_errors++;
dev->stats.rx_over_errors++;
if (rx_error & 0x02)
vp->stats.rx_length_errors++;
dev->stats.rx_length_errors++;
if (rx_error & 0x04)
vp->stats.rx_frame_errors++;
dev->stats.rx_frame_errors++;
if (rx_error & 0x08)
vp->stats.rx_crc_errors++;
dev->stats.rx_crc_errors++;
if (rx_error & 0x10)
vp->stats.rx_length_errors++;
dev->stats.rx_length_errors++;
} else {
/* The packet length: up to 4.5K!. */
short pkt_len = rx_status & 0x1fff;
Expand All @@ -1301,8 +1299,8 @@ static int corkscrew_rx(struct net_device *dev)
skb->protocol = eth_type_trans(skb, dev);
netif_rx(skb);
dev->last_rx = jiffies;
vp->stats.rx_packets++;
vp->stats.rx_bytes += pkt_len;
dev->stats.rx_packets++;
dev->stats.rx_bytes += pkt_len;
/* Wait a limited time to go to next packet. */
for (i = 200; i >= 0; i--)
if (! (inw(ioaddr + EL3_STATUS) & CmdInProgress))
Expand All @@ -1312,7 +1310,7 @@ static int corkscrew_rx(struct net_device *dev)
printk("%s: Couldn't allocate a sk_buff of size %d.\n", dev->name, pkt_len);
}
outw(RxDiscard, ioaddr + EL3_CMD);
vp->stats.rx_dropped++;
dev->stats.rx_dropped++;
/* Wait a limited time to skip this packet. */
for (i = 200; i >= 0; i--)
if (!(inw(ioaddr + EL3_STATUS) & CmdInProgress))
Expand All @@ -1337,23 +1335,23 @@ static int boomerang_rx(struct net_device *dev)
if (corkscrew_debug > 2)
printk(" Rx error: status %2.2x.\n",
rx_error);
vp->stats.rx_errors++;
dev->stats.rx_errors++;
if (rx_error & 0x01)
vp->stats.rx_over_errors++;
dev->stats.rx_over_errors++;
if (rx_error & 0x02)
vp->stats.rx_length_errors++;
dev->stats.rx_length_errors++;
if (rx_error & 0x04)
vp->stats.rx_frame_errors++;
dev->stats.rx_frame_errors++;
if (rx_error & 0x08)
vp->stats.rx_crc_errors++;
dev->stats.rx_crc_errors++;
if (rx_error & 0x10)
vp->stats.rx_length_errors++;
dev->stats.rx_length_errors++;
} else {
/* The packet length: up to 4.5K!. */
short pkt_len = rx_status & 0x1fff;
struct sk_buff *skb;

vp->stats.rx_bytes += pkt_len;
dev->stats.rx_bytes += pkt_len;
if (corkscrew_debug > 4)
printk("Receiving packet size %d status %4.4x.\n",
pkt_len, rx_status);
Expand Down Expand Up @@ -1388,7 +1386,7 @@ static int boomerang_rx(struct net_device *dev)
skb->protocol = eth_type_trans(skb, dev);
netif_rx(skb);
dev->last_rx = jiffies;
vp->stats.rx_packets++;
dev->stats.rx_packets++;
}
entry = (++vp->cur_rx) % RX_RING_SIZE;
}
Expand Down Expand Up @@ -1475,7 +1473,7 @@ static struct net_device_stats *corkscrew_get_stats(struct net_device *dev)
update_stats(dev->base_addr, dev);
spin_unlock_irqrestore(&vp->lock, flags);
}
return &vp->stats;
return &dev->stats;
}

/* Update statistics.
Expand All @@ -1487,19 +1485,17 @@ static struct net_device_stats *corkscrew_get_stats(struct net_device *dev)
*/
static void update_stats(int ioaddr, struct net_device *dev)
{
struct corkscrew_private *vp = netdev_priv(dev);

/* Unlike the 3c5x9 we need not turn off stats updates while reading. */
/* Switch to the stats window, and read everything. */
EL3WINDOW(6);
vp->stats.tx_carrier_errors += inb(ioaddr + 0);
vp->stats.tx_heartbeat_errors += inb(ioaddr + 1);
dev->stats.tx_carrier_errors += inb(ioaddr + 0);
dev->stats.tx_heartbeat_errors += inb(ioaddr + 1);
/* Multiple collisions. */ inb(ioaddr + 2);
vp->stats.collisions += inb(ioaddr + 3);
vp->stats.tx_window_errors += inb(ioaddr + 4);
vp->stats.rx_fifo_errors += inb(ioaddr + 5);
vp->stats.tx_packets += inb(ioaddr + 6);
vp->stats.tx_packets += (inb(ioaddr + 9) & 0x30) << 4;
dev->stats.collisions += inb(ioaddr + 3);
dev->stats.tx_window_errors += inb(ioaddr + 4);
dev->stats.rx_fifo_errors += inb(ioaddr + 5);
dev->stats.tx_packets += inb(ioaddr + 6);
dev->stats.tx_packets += (inb(ioaddr + 9) & 0x30) << 4;
/* Rx packets */ inb(ioaddr + 7);
/* Must read to clear */
/* Tx deferrals */ inb(ioaddr + 8);
Expand Down

0 comments on commit b582bf7

Please sign in to comment.