aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKulikov Vasiliy <segooon@gmail.com>2010-07-04 22:13:20 -0400
committerDavid S. Miller <davem@davemloft.net>2010-07-05 22:41:14 -0400
commit275defc958acc9bf5bc81eb46209346d3aebe0fa (patch)
tree24cabe5f2366781af817f57865c150062aa7546f
parent57616ee4405b82c3ba4d20111697a4416f3967a6 (diff)
epic100: 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: Kulikov Vasiliy <segooon@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/epic100.c47
1 files changed, 22 insertions, 25 deletions
diff --git a/drivers/net/epic100.c b/drivers/net/epic100.c
index 4c274657283c..57c8ac0ef3f1 100644
--- a/drivers/net/epic100.c
+++ b/drivers/net/epic100.c
@@ -278,7 +278,6 @@ struct epic_private {
278 struct pci_dev *pci_dev; /* PCI bus location. */ 278 struct pci_dev *pci_dev; /* PCI bus location. */
279 int chip_id, chip_flags; 279 int chip_id, chip_flags;
280 280
281 struct net_device_stats stats;
282 struct timer_list timer; /* Media selection timer. */ 281 struct timer_list timer; /* Media selection timer. */
283 int tx_threshold; 282 int tx_threshold;
284 unsigned char mc_filter[8]; 283 unsigned char mc_filter[8];
@@ -770,7 +769,6 @@ static int epic_open(struct net_device *dev)
770static void epic_pause(struct net_device *dev) 769static void epic_pause(struct net_device *dev)
771{ 770{
772 long ioaddr = dev->base_addr; 771 long ioaddr = dev->base_addr;
773 struct epic_private *ep = netdev_priv(dev);
774 772
775 netif_stop_queue (dev); 773 netif_stop_queue (dev);
776 774
@@ -781,9 +779,9 @@ static void epic_pause(struct net_device *dev)
781 779
782 /* Update the error counts. */ 780 /* Update the error counts. */
783 if (inw(ioaddr + COMMAND) != 0xffff) { 781 if (inw(ioaddr + COMMAND) != 0xffff) {
784 ep->stats.rx_missed_errors += inb(ioaddr + MPCNT); 782 dev->stats.rx_missed_errors += inb(ioaddr + MPCNT);
785 ep->stats.rx_frame_errors += inb(ioaddr + ALICNT); 783 dev->stats.rx_frame_errors += inb(ioaddr + ALICNT);
786 ep->stats.rx_crc_errors += inb(ioaddr + CRCCNT); 784 dev->stats.rx_crc_errors += inb(ioaddr + CRCCNT);
787 } 785 }
788 786
789 /* Remove the packets on the Rx queue. */ 787 /* Remove the packets on the Rx queue. */
@@ -900,7 +898,7 @@ static void epic_tx_timeout(struct net_device *dev)
900 } 898 }
901 } 899 }
902 if (inw(ioaddr + TxSTAT) & 0x10) { /* Tx FIFO underflow. */ 900 if (inw(ioaddr + TxSTAT) & 0x10) { /* Tx FIFO underflow. */
903 ep->stats.tx_fifo_errors++; 901 dev->stats.tx_fifo_errors++;
904 outl(RestartTx, ioaddr + COMMAND); 902 outl(RestartTx, ioaddr + COMMAND);
905 } else { 903 } else {
906 epic_restart(dev); 904 epic_restart(dev);
@@ -908,7 +906,7 @@ static void epic_tx_timeout(struct net_device *dev)
908 } 906 }
909 907
910 dev->trans_start = jiffies; /* prevent tx timeout */ 908 dev->trans_start = jiffies; /* prevent tx timeout */
911 ep->stats.tx_errors++; 909 dev->stats.tx_errors++;
912 if (!ep->tx_full) 910 if (!ep->tx_full)
913 netif_wake_queue(dev); 911 netif_wake_queue(dev);
914} 912}
@@ -1016,7 +1014,7 @@ static netdev_tx_t epic_start_xmit(struct sk_buff *skb, struct net_device *dev)
1016static void epic_tx_error(struct net_device *dev, struct epic_private *ep, 1014static void epic_tx_error(struct net_device *dev, struct epic_private *ep,
1017 int status) 1015 int status)
1018{ 1016{
1019 struct net_device_stats *stats = &ep->stats; 1017 struct net_device_stats *stats = &dev->stats;
1020 1018
1021#ifndef final_version 1019#ifndef final_version
1022 /* There was an major error, log it. */ 1020 /* There was an major error, log it. */
@@ -1053,9 +1051,9 @@ static void epic_tx(struct net_device *dev, struct epic_private *ep)
1053 break; /* It still hasn't been Txed */ 1051 break; /* It still hasn't been Txed */
1054 1052
1055 if (likely(txstatus & 0x0001)) { 1053 if (likely(txstatus & 0x0001)) {
1056 ep->stats.collisions += (txstatus >> 8) & 15; 1054 dev->stats.collisions += (txstatus >> 8) & 15;
1057 ep->stats.tx_packets++; 1055 dev->stats.tx_packets++;
1058 ep->stats.tx_bytes += ep->tx_skbuff[entry]->len; 1056 dev->stats.tx_bytes += ep->tx_skbuff[entry]->len;
1059 } else 1057 } else
1060 epic_tx_error(dev, ep, txstatus); 1058 epic_tx_error(dev, ep, txstatus);
1061 1059
@@ -1125,12 +1123,12 @@ static irqreturn_t epic_interrupt(int irq, void *dev_instance)
1125 goto out; 1123 goto out;
1126 1124
1127 /* Always update the error counts to avoid overhead later. */ 1125 /* Always update the error counts to avoid overhead later. */
1128 ep->stats.rx_missed_errors += inb(ioaddr + MPCNT); 1126 dev->stats.rx_missed_errors += inb(ioaddr + MPCNT);
1129 ep->stats.rx_frame_errors += inb(ioaddr + ALICNT); 1127 dev->stats.rx_frame_errors += inb(ioaddr + ALICNT);
1130 ep->stats.rx_crc_errors += inb(ioaddr + CRCCNT); 1128 dev->stats.rx_crc_errors += inb(ioaddr + CRCCNT);
1131 1129
1132 if (status & TxUnderrun) { /* Tx FIFO underflow. */ 1130 if (status & TxUnderrun) { /* Tx FIFO underflow. */
1133 ep->stats.tx_fifo_errors++; 1131 dev->stats.tx_fifo_errors++;
1134 outl(ep->tx_threshold += 128, ioaddr + TxThresh); 1132 outl(ep->tx_threshold += 128, ioaddr + TxThresh);
1135 /* Restart the transmit process. */ 1133 /* Restart the transmit process. */
1136 outl(RestartTx, ioaddr + COMMAND); 1134 outl(RestartTx, ioaddr + COMMAND);
@@ -1183,10 +1181,10 @@ static int epic_rx(struct net_device *dev, int budget)
1183 if (status & 0x2000) { 1181 if (status & 0x2000) {
1184 printk(KERN_WARNING "%s: Oversized Ethernet frame spanned " 1182 printk(KERN_WARNING "%s: Oversized Ethernet frame spanned "
1185 "multiple buffers, status %4.4x!\n", dev->name, status); 1183 "multiple buffers, status %4.4x!\n", dev->name, status);
1186 ep->stats.rx_length_errors++; 1184 dev->stats.rx_length_errors++;
1187 } else if (status & 0x0006) 1185 } else if (status & 0x0006)
1188 /* Rx Frame errors are counted in hardware. */ 1186 /* Rx Frame errors are counted in hardware. */
1189 ep->stats.rx_errors++; 1187 dev->stats.rx_errors++;
1190 } else { 1188 } else {
1191 /* Malloc up new buffer, compatible with net-2e. */ 1189 /* Malloc up new buffer, compatible with net-2e. */
1192 /* Omit the four octet CRC from the length. */ 1190 /* Omit the four octet CRC from the length. */
@@ -1223,8 +1221,8 @@ static int epic_rx(struct net_device *dev, int budget)
1223 } 1221 }
1224 skb->protocol = eth_type_trans(skb, dev); 1222 skb->protocol = eth_type_trans(skb, dev);
1225 netif_receive_skb(skb); 1223 netif_receive_skb(skb);
1226 ep->stats.rx_packets++; 1224 dev->stats.rx_packets++;
1227 ep->stats.rx_bytes += pkt_len; 1225 dev->stats.rx_bytes += pkt_len;
1228 } 1226 }
1229 work_done++; 1227 work_done++;
1230 entry = (++ep->cur_rx) % RX_RING_SIZE; 1228 entry = (++ep->cur_rx) % RX_RING_SIZE;
@@ -1259,7 +1257,7 @@ static void epic_rx_err(struct net_device *dev, struct epic_private *ep)
1259 if (status == EpicRemoved) 1257 if (status == EpicRemoved)
1260 return; 1258 return;
1261 if (status & RxOverflow) /* Missed a Rx frame. */ 1259 if (status & RxOverflow) /* Missed a Rx frame. */
1262 ep->stats.rx_errors++; 1260 dev->stats.rx_errors++;
1263 if (status & (RxOverflow | RxFull)) 1261 if (status & (RxOverflow | RxFull))
1264 outw(RxQueued, ioaddr + COMMAND); 1262 outw(RxQueued, ioaddr + COMMAND);
1265} 1263}
@@ -1357,17 +1355,16 @@ static int epic_close(struct net_device *dev)
1357 1355
1358static struct net_device_stats *epic_get_stats(struct net_device *dev) 1356static struct net_device_stats *epic_get_stats(struct net_device *dev)
1359{ 1357{
1360 struct epic_private *ep = netdev_priv(dev);
1361 long ioaddr = dev->base_addr; 1358 long ioaddr = dev->base_addr;
1362 1359
1363 if (netif_running(dev)) { 1360 if (netif_running(dev)) {
1364 /* Update the error counts. */ 1361 /* Update the error counts. */
1365 ep->stats.rx_missed_errors += inb(ioaddr + MPCNT); 1362 dev->stats.rx_missed_errors += inb(ioaddr + MPCNT);
1366 ep->stats.rx_frame_errors += inb(ioaddr + ALICNT); 1363 dev->stats.rx_frame_errors += inb(ioaddr + ALICNT);
1367 ep->stats.rx_crc_errors += inb(ioaddr + CRCCNT); 1364 dev->stats.rx_crc_errors += inb(ioaddr + CRCCNT);
1368 } 1365 }
1369 1366
1370 return &ep->stats; 1367 return &dev->stats;
1371} 1368}
1372 1369
1373/* Set or clear the multicast filter for this adaptor. 1370/* Set or clear the multicast filter for this adaptor.