diff options
author | Krzysztof Halasa <khc@pm.waw.pl> | 2008-06-30 17:26:53 -0400 |
---|---|---|
committer | Jeff Garzik <jgarzik@redhat.com> | 2008-07-04 08:47:41 -0400 |
commit | 198191c4a7ce4daba379608fb38b9bc5a4eedc61 (patch) | |
tree | 3229362a45a15af42628553926bc040e44c39ce0 /drivers/net/wan | |
parent | 844290e56067aed0a54142d756565abb9614136c (diff) |
WAN: convert drivers to use built-in netdev_stats
There is no point in using separate net_device_stats structs when
the one in struct net_device is present. Compiles.
Signed-off-by: Krzysztof HaĆasa <khc@pm.waw.pl>
Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers/net/wan')
-rw-r--r-- | drivers/net/wan/c101.c | 6 | ||||
-rw-r--r-- | drivers/net/wan/dscc4.c | 22 | ||||
-rw-r--r-- | drivers/net/wan/farsync.c | 70 | ||||
-rw-r--r-- | drivers/net/wan/hd6457x.c | 33 | ||||
-rw-r--r-- | drivers/net/wan/hdlc.c | 2 | ||||
-rw-r--r-- | drivers/net/wan/hdlc_cisco.c | 4 | ||||
-rw-r--r-- | drivers/net/wan/hdlc_fr.c | 29 | ||||
-rw-r--r-- | drivers/net/wan/hdlc_raw_eth.c | 2 | ||||
-rw-r--r-- | drivers/net/wan/hdlc_x25.c | 6 | ||||
-rw-r--r-- | drivers/net/wan/pc300_drv.c | 71 | ||||
-rw-r--r-- | drivers/net/wan/pc300_tty.c | 6 | ||||
-rw-r--r-- | drivers/net/wan/wanxl.c | 26 |
12 files changed, 121 insertions, 156 deletions
diff --git a/drivers/net/wan/c101.c b/drivers/net/wan/c101.c index c2cc42f723d5..c8e563106a4a 100644 --- a/drivers/net/wan/c101.c +++ b/drivers/net/wan/c101.c | |||
@@ -133,9 +133,9 @@ static void sca_msci_intr(port_t *port) | |||
133 | sca_out(stat & (ST1_UDRN | ST1_CDCD), MSCI0_OFFSET + ST1, port); | 133 | sca_out(stat & (ST1_UDRN | ST1_CDCD), MSCI0_OFFSET + ST1, port); |
134 | 134 | ||
135 | if (stat & ST1_UDRN) { | 135 | if (stat & ST1_UDRN) { |
136 | struct net_device_stats *stats = hdlc_stats(port_to_dev(port)); | 136 | /* TX Underrun error detected */ |
137 | stats->tx_errors++; /* TX Underrun error detected */ | 137 | port_to_dev(port)->stats.tx_errors++; |
138 | stats->tx_fifo_errors++; | 138 | port_to_dev(port)->stats.tx_fifo_errors++; |
139 | } | 139 | } |
140 | 140 | ||
141 | stat = sca_in(MSCI1_OFFSET + ST1, port); /* read MSCI1 ST1 status */ | 141 | stat = sca_in(MSCI1_OFFSET + ST1, port); /* read MSCI1 ST1 status */ |
diff --git a/drivers/net/wan/dscc4.c b/drivers/net/wan/dscc4.c index c6f26e28e376..50ef5b4efd6d 100644 --- a/drivers/net/wan/dscc4.c +++ b/drivers/net/wan/dscc4.c | |||
@@ -642,7 +642,6 @@ static inline void dscc4_rx_skb(struct dscc4_dev_priv *dpriv, | |||
642 | struct net_device *dev) | 642 | struct net_device *dev) |
643 | { | 643 | { |
644 | struct RxFD *rx_fd = dpriv->rx_fd + dpriv->rx_current%RX_RING_SIZE; | 644 | struct RxFD *rx_fd = dpriv->rx_fd + dpriv->rx_current%RX_RING_SIZE; |
645 | struct net_device_stats *stats = hdlc_stats(dev); | ||
646 | struct pci_dev *pdev = dpriv->pci_priv->pdev; | 645 | struct pci_dev *pdev = dpriv->pci_priv->pdev; |
647 | struct sk_buff *skb; | 646 | struct sk_buff *skb; |
648 | int pkt_len; | 647 | int pkt_len; |
@@ -656,8 +655,8 @@ static inline void dscc4_rx_skb(struct dscc4_dev_priv *dpriv, | |||
656 | pci_unmap_single(pdev, le32_to_cpu(rx_fd->data), | 655 | pci_unmap_single(pdev, le32_to_cpu(rx_fd->data), |
657 | RX_MAX(HDLC_MAX_MRU), PCI_DMA_FROMDEVICE); | 656 | RX_MAX(HDLC_MAX_MRU), PCI_DMA_FROMDEVICE); |
658 | if ((skb->data[--pkt_len] & FrameOk) == FrameOk) { | 657 | if ((skb->data[--pkt_len] & FrameOk) == FrameOk) { |
659 | stats->rx_packets++; | 658 | dev->stats.rx_packets++; |
660 | stats->rx_bytes += pkt_len; | 659 | dev->stats.rx_bytes += pkt_len; |
661 | skb_put(skb, pkt_len); | 660 | skb_put(skb, pkt_len); |
662 | if (netif_running(dev)) | 661 | if (netif_running(dev)) |
663 | skb->protocol = hdlc_type_trans(skb, dev); | 662 | skb->protocol = hdlc_type_trans(skb, dev); |
@@ -665,13 +664,13 @@ static inline void dscc4_rx_skb(struct dscc4_dev_priv *dpriv, | |||
665 | netif_rx(skb); | 664 | netif_rx(skb); |
666 | } else { | 665 | } else { |
667 | if (skb->data[pkt_len] & FrameRdo) | 666 | if (skb->data[pkt_len] & FrameRdo) |
668 | stats->rx_fifo_errors++; | 667 | dev->stats.rx_fifo_errors++; |
669 | else if (!(skb->data[pkt_len] | ~FrameCrc)) | 668 | else if (!(skb->data[pkt_len] | ~FrameCrc)) |
670 | stats->rx_crc_errors++; | 669 | dev->stats.rx_crc_errors++; |
671 | else if (!(skb->data[pkt_len] | ~(FrameVfr | FrameRab))) | 670 | else if (!(skb->data[pkt_len] | ~(FrameVfr | FrameRab))) |
672 | stats->rx_length_errors++; | 671 | dev->stats.rx_length_errors++; |
673 | else | 672 | else |
674 | stats->rx_errors++; | 673 | dev->stats.rx_errors++; |
675 | dev_kfree_skb_irq(skb); | 674 | dev_kfree_skb_irq(skb); |
676 | } | 675 | } |
677 | refill: | 676 | refill: |
@@ -1569,7 +1568,6 @@ try: | |||
1569 | 1568 | ||
1570 | if (state & SccEvt) { | 1569 | if (state & SccEvt) { |
1571 | if (state & Alls) { | 1570 | if (state & Alls) { |
1572 | struct net_device_stats *stats = hdlc_stats(dev); | ||
1573 | struct sk_buff *skb; | 1571 | struct sk_buff *skb; |
1574 | struct TxFD *tx_fd; | 1572 | struct TxFD *tx_fd; |
1575 | 1573 | ||
@@ -1586,8 +1584,8 @@ try: | |||
1586 | pci_unmap_single(ppriv->pdev, le32_to_cpu(tx_fd->data), | 1584 | pci_unmap_single(ppriv->pdev, le32_to_cpu(tx_fd->data), |
1587 | skb->len, PCI_DMA_TODEVICE); | 1585 | skb->len, PCI_DMA_TODEVICE); |
1588 | if (tx_fd->state & FrameEnd) { | 1586 | if (tx_fd->state & FrameEnd) { |
1589 | stats->tx_packets++; | 1587 | dev->stats.tx_packets++; |
1590 | stats->tx_bytes += skb->len; | 1588 | dev->stats.tx_bytes += skb->len; |
1591 | } | 1589 | } |
1592 | dev_kfree_skb_irq(skb); | 1590 | dev_kfree_skb_irq(skb); |
1593 | dpriv->tx_skbuff[cur] = NULL; | 1591 | dpriv->tx_skbuff[cur] = NULL; |
@@ -1698,7 +1696,7 @@ try: | |||
1698 | } | 1696 | } |
1699 | if (state & Err) { | 1697 | if (state & Err) { |
1700 | printk(KERN_INFO "%s: Tx ERR\n", dev->name); | 1698 | printk(KERN_INFO "%s: Tx ERR\n", dev->name); |
1701 | hdlc_stats(dev)->tx_errors++; | 1699 | dev->stats.tx_errors++; |
1702 | state &= ~Err; | 1700 | state &= ~Err; |
1703 | } | 1701 | } |
1704 | } | 1702 | } |
@@ -1834,7 +1832,7 @@ try: | |||
1834 | if (!(rx_fd->state2 & DataComplete)) | 1832 | if (!(rx_fd->state2 & DataComplete)) |
1835 | break; | 1833 | break; |
1836 | if (rx_fd->state2 & FrameAborted) { | 1834 | if (rx_fd->state2 & FrameAborted) { |
1837 | hdlc_stats(dev)->rx_over_errors++; | 1835 | dev->stats.rx_over_errors++; |
1838 | rx_fd->state1 |= Hold; | 1836 | rx_fd->state1 |= Hold; |
1839 | rx_fd->state2 = 0x00000000; | 1837 | rx_fd->state2 = 0x00000000; |
1840 | rx_fd->end = cpu_to_le32(0xbabeface); | 1838 | rx_fd->end = cpu_to_le32(0xbabeface); |
diff --git a/drivers/net/wan/farsync.c b/drivers/net/wan/farsync.c index 547368e9633d..754f00809e3e 100644 --- a/drivers/net/wan/farsync.c +++ b/drivers/net/wan/farsync.c | |||
@@ -845,7 +845,6 @@ fst_tx_dma_complete(struct fst_card_info *card, struct fst_port_info *port, | |||
845 | int len, int txpos) | 845 | int len, int txpos) |
846 | { | 846 | { |
847 | struct net_device *dev = port_to_dev(port); | 847 | struct net_device *dev = port_to_dev(port); |
848 | struct net_device_stats *stats = hdlc_stats(dev); | ||
849 | 848 | ||
850 | /* | 849 | /* |
851 | * Everything is now set, just tell the card to go | 850 | * Everything is now set, just tell the card to go |
@@ -853,8 +852,8 @@ fst_tx_dma_complete(struct fst_card_info *card, struct fst_port_info *port, | |||
853 | dbg(DBG_TX, "fst_tx_dma_complete\n"); | 852 | dbg(DBG_TX, "fst_tx_dma_complete\n"); |
854 | FST_WRB(card, txDescrRing[port->index][txpos].bits, | 853 | FST_WRB(card, txDescrRing[port->index][txpos].bits, |
855 | DMA_OWN | TX_STP | TX_ENP); | 854 | DMA_OWN | TX_STP | TX_ENP); |
856 | stats->tx_packets++; | 855 | dev->stats.tx_packets++; |
857 | stats->tx_bytes += len; | 856 | dev->stats.tx_bytes += len; |
858 | dev->trans_start = jiffies; | 857 | dev->trans_start = jiffies; |
859 | } | 858 | } |
860 | 859 | ||
@@ -876,7 +875,6 @@ fst_rx_dma_complete(struct fst_card_info *card, struct fst_port_info *port, | |||
876 | int len, struct sk_buff *skb, int rxp) | 875 | int len, struct sk_buff *skb, int rxp) |
877 | { | 876 | { |
878 | struct net_device *dev = port_to_dev(port); | 877 | struct net_device *dev = port_to_dev(port); |
879 | struct net_device_stats *stats = hdlc_stats(dev); | ||
880 | int pi; | 878 | int pi; |
881 | int rx_status; | 879 | int rx_status; |
882 | 880 | ||
@@ -888,8 +886,8 @@ fst_rx_dma_complete(struct fst_card_info *card, struct fst_port_info *port, | |||
888 | FST_WRB(card, rxDescrRing[pi][rxp].bits, DMA_OWN); | 886 | FST_WRB(card, rxDescrRing[pi][rxp].bits, DMA_OWN); |
889 | 887 | ||
890 | /* Update stats */ | 888 | /* Update stats */ |
891 | stats->rx_packets++; | 889 | dev->stats.rx_packets++; |
892 | stats->rx_bytes += len; | 890 | dev->stats.rx_bytes += len; |
893 | 891 | ||
894 | /* Push upstream */ | 892 | /* Push upstream */ |
895 | dbg(DBG_RX, "Pushing the frame up the stack\n"); | 893 | dbg(DBG_RX, "Pushing the frame up the stack\n"); |
@@ -900,7 +898,7 @@ fst_rx_dma_complete(struct fst_card_info *card, struct fst_port_info *port, | |||
900 | rx_status = netif_rx(skb); | 898 | rx_status = netif_rx(skb); |
901 | fst_process_rx_status(rx_status, port_to_dev(port)->name); | 899 | fst_process_rx_status(rx_status, port_to_dev(port)->name); |
902 | if (rx_status == NET_RX_DROP) | 900 | if (rx_status == NET_RX_DROP) |
903 | stats->rx_dropped++; | 901 | dev->stats.rx_dropped++; |
904 | dev->last_rx = jiffies; | 902 | dev->last_rx = jiffies; |
905 | } | 903 | } |
906 | 904 | ||
@@ -1163,29 +1161,28 @@ fst_log_rx_error(struct fst_card_info *card, struct fst_port_info *port, | |||
1163 | unsigned char dmabits, int rxp, unsigned short len) | 1161 | unsigned char dmabits, int rxp, unsigned short len) |
1164 | { | 1162 | { |
1165 | struct net_device *dev = port_to_dev(port); | 1163 | struct net_device *dev = port_to_dev(port); |
1166 | struct net_device_stats *stats = hdlc_stats(dev); | ||
1167 | 1164 | ||
1168 | /* | 1165 | /* |
1169 | * Increment the appropriate error counter | 1166 | * Increment the appropriate error counter |
1170 | */ | 1167 | */ |
1171 | stats->rx_errors++; | 1168 | dev->stats.rx_errors++; |
1172 | if (dmabits & RX_OFLO) { | 1169 | if (dmabits & RX_OFLO) { |
1173 | stats->rx_fifo_errors++; | 1170 | dev->stats.rx_fifo_errors++; |
1174 | dbg(DBG_ASS, "Rx fifo error on card %d port %d buffer %d\n", | 1171 | dbg(DBG_ASS, "Rx fifo error on card %d port %d buffer %d\n", |
1175 | card->card_no, port->index, rxp); | 1172 | card->card_no, port->index, rxp); |
1176 | } | 1173 | } |
1177 | if (dmabits & RX_CRC) { | 1174 | if (dmabits & RX_CRC) { |
1178 | stats->rx_crc_errors++; | 1175 | dev->stats.rx_crc_errors++; |
1179 | dbg(DBG_ASS, "Rx crc error on card %d port %d\n", | 1176 | dbg(DBG_ASS, "Rx crc error on card %d port %d\n", |
1180 | card->card_no, port->index); | 1177 | card->card_no, port->index); |
1181 | } | 1178 | } |
1182 | if (dmabits & RX_FRAM) { | 1179 | if (dmabits & RX_FRAM) { |
1183 | stats->rx_frame_errors++; | 1180 | dev->stats.rx_frame_errors++; |
1184 | dbg(DBG_ASS, "Rx frame error on card %d port %d\n", | 1181 | dbg(DBG_ASS, "Rx frame error on card %d port %d\n", |
1185 | card->card_no, port->index); | 1182 | card->card_no, port->index); |
1186 | } | 1183 | } |
1187 | if (dmabits == (RX_STP | RX_ENP)) { | 1184 | if (dmabits == (RX_STP | RX_ENP)) { |
1188 | stats->rx_length_errors++; | 1185 | dev->stats.rx_length_errors++; |
1189 | dbg(DBG_ASS, "Rx length error (%d) on card %d port %d\n", | 1186 | dbg(DBG_ASS, "Rx length error (%d) on card %d port %d\n", |
1190 | len, card->card_no, port->index); | 1187 | len, card->card_no, port->index); |
1191 | } | 1188 | } |
@@ -1242,7 +1239,6 @@ fst_intr_rx(struct fst_card_info *card, struct fst_port_info *port) | |||
1242 | unsigned short len; | 1239 | unsigned short len; |
1243 | struct sk_buff *skb; | 1240 | struct sk_buff *skb; |
1244 | struct net_device *dev = port_to_dev(port); | 1241 | struct net_device *dev = port_to_dev(port); |
1245 | struct net_device_stats *stats = hdlc_stats(dev); | ||
1246 | 1242 | ||
1247 | /* Check we have a buffer to process */ | 1243 | /* Check we have a buffer to process */ |
1248 | pi = port->index; | 1244 | pi = port->index; |
@@ -1291,7 +1287,7 @@ fst_intr_rx(struct fst_card_info *card, struct fst_port_info *port) | |||
1291 | if ((skb = dev_alloc_skb(len)) == NULL) { | 1287 | if ((skb = dev_alloc_skb(len)) == NULL) { |
1292 | dbg(DBG_RX, "intr_rx: can't allocate buffer\n"); | 1288 | dbg(DBG_RX, "intr_rx: can't allocate buffer\n"); |
1293 | 1289 | ||
1294 | stats->rx_dropped++; | 1290 | dev->stats.rx_dropped++; |
1295 | 1291 | ||
1296 | /* Return descriptor to card */ | 1292 | /* Return descriptor to card */ |
1297 | FST_WRB(card, rxDescrRing[pi][rxp].bits, DMA_OWN); | 1293 | FST_WRB(card, rxDescrRing[pi][rxp].bits, DMA_OWN); |
@@ -1316,8 +1312,8 @@ fst_intr_rx(struct fst_card_info *card, struct fst_port_info *port) | |||
1316 | FST_WRB(card, rxDescrRing[pi][rxp].bits, DMA_OWN); | 1312 | FST_WRB(card, rxDescrRing[pi][rxp].bits, DMA_OWN); |
1317 | 1313 | ||
1318 | /* Update stats */ | 1314 | /* Update stats */ |
1319 | stats->rx_packets++; | 1315 | dev->stats.rx_packets++; |
1320 | stats->rx_bytes += len; | 1316 | dev->stats.rx_bytes += len; |
1321 | 1317 | ||
1322 | /* Push upstream */ | 1318 | /* Push upstream */ |
1323 | dbg(DBG_RX, "Pushing frame up the stack\n"); | 1319 | dbg(DBG_RX, "Pushing frame up the stack\n"); |
@@ -1327,9 +1323,8 @@ fst_intr_rx(struct fst_card_info *card, struct fst_port_info *port) | |||
1327 | skb->protocol = hdlc_type_trans(skb, dev); | 1323 | skb->protocol = hdlc_type_trans(skb, dev); |
1328 | rx_status = netif_rx(skb); | 1324 | rx_status = netif_rx(skb); |
1329 | fst_process_rx_status(rx_status, port_to_dev(port)->name); | 1325 | fst_process_rx_status(rx_status, port_to_dev(port)->name); |
1330 | if (rx_status == NET_RX_DROP) { | 1326 | if (rx_status == NET_RX_DROP) |
1331 | stats->rx_dropped++; | 1327 | dev->stats.rx_dropped++; |
1332 | } | ||
1333 | dev->last_rx = jiffies; | 1328 | dev->last_rx = jiffies; |
1334 | } else { | 1329 | } else { |
1335 | card->dma_skb_rx = skb; | 1330 | card->dma_skb_rx = skb; |
@@ -1361,7 +1356,6 @@ do_bottom_half_tx(struct fst_card_info *card) | |||
1361 | struct sk_buff *skb; | 1356 | struct sk_buff *skb; |
1362 | unsigned long flags; | 1357 | unsigned long flags; |
1363 | struct net_device *dev; | 1358 | struct net_device *dev; |
1364 | struct net_device_stats *stats; | ||
1365 | 1359 | ||
1366 | /* | 1360 | /* |
1367 | * Find a free buffer for the transmit | 1361 | * Find a free buffer for the transmit |
@@ -1373,12 +1367,10 @@ do_bottom_half_tx(struct fst_card_info *card) | |||
1373 | if (!port->run) | 1367 | if (!port->run) |
1374 | continue; | 1368 | continue; |
1375 | 1369 | ||
1376 | dev = port_to_dev(port); | 1370 | dev = port_to_dev(port); |
1377 | stats = hdlc_stats(dev); | 1371 | while (!(FST_RDB(card, txDescrRing[pi][port->txpos].bits) & |
1378 | while (! | 1372 | DMA_OWN) |
1379 | (FST_RDB(card, txDescrRing[pi][port->txpos].bits) & | 1373 | && !(card->dmatx_in_progress)) { |
1380 | DMA_OWN) | ||
1381 | && !(card->dmatx_in_progress)) { | ||
1382 | /* | 1374 | /* |
1383 | * There doesn't seem to be a txdone event per-se | 1375 | * There doesn't seem to be a txdone event per-se |
1384 | * We seem to have to deduce it, by checking the DMA_OWN | 1376 | * We seem to have to deduce it, by checking the DMA_OWN |
@@ -1422,8 +1414,8 @@ do_bottom_half_tx(struct fst_card_info *card) | |||
1422 | txDescrRing[pi][port->txpos]. | 1414 | txDescrRing[pi][port->txpos]. |
1423 | bits, | 1415 | bits, |
1424 | DMA_OWN | TX_STP | TX_ENP); | 1416 | DMA_OWN | TX_STP | TX_ENP); |
1425 | stats->tx_packets++; | 1417 | dev->stats.tx_packets++; |
1426 | stats->tx_bytes += skb->len; | 1418 | dev->stats.tx_bytes += skb->len; |
1427 | dev->trans_start = jiffies; | 1419 | dev->trans_start = jiffies; |
1428 | } else { | 1420 | } else { |
1429 | /* Or do it through dma */ | 1421 | /* Or do it through dma */ |
@@ -1628,8 +1620,8 @@ fst_intr(int dummy, void *dev_id) | |||
1628 | * always load up the entire packet for DMA. | 1620 | * always load up the entire packet for DMA. |
1629 | */ | 1621 | */ |
1630 | dbg(DBG_TX, "Tx underflow port %d\n", port->index); | 1622 | dbg(DBG_TX, "Tx underflow port %d\n", port->index); |
1631 | hdlc_stats(port_to_dev(port))->tx_errors++; | 1623 | port_to_dev(port)->stats.tx_errors++; |
1632 | hdlc_stats(port_to_dev(port))->tx_fifo_errors++; | 1624 | port_to_dev(port)->stats.tx_fifo_errors++; |
1633 | dbg(DBG_ASS, "Tx underflow on card %d port %d\n", | 1625 | dbg(DBG_ASS, "Tx underflow on card %d port %d\n", |
1634 | card->card_no, port->index); | 1626 | card->card_no, port->index); |
1635 | break; | 1627 | break; |
@@ -2292,12 +2284,11 @@ fst_tx_timeout(struct net_device *dev) | |||
2292 | { | 2284 | { |
2293 | struct fst_port_info *port; | 2285 | struct fst_port_info *port; |
2294 | struct fst_card_info *card; | 2286 | struct fst_card_info *card; |
2295 | struct net_device_stats *stats = hdlc_stats(dev); | ||
2296 | 2287 | ||
2297 | port = dev_to_port(dev); | 2288 | port = dev_to_port(dev); |
2298 | card = port->card; | 2289 | card = port->card; |
2299 | stats->tx_errors++; | 2290 | dev->stats.tx_errors++; |
2300 | stats->tx_aborted_errors++; | 2291 | dev->stats.tx_aborted_errors++; |
2301 | dbg(DBG_ASS, "Tx timeout card %d port %d\n", | 2292 | dbg(DBG_ASS, "Tx timeout card %d port %d\n", |
2302 | card->card_no, port->index); | 2293 | card->card_no, port->index); |
2303 | fst_issue_cmd(port, ABORTTX); | 2294 | fst_issue_cmd(port, ABORTTX); |
@@ -2312,7 +2303,6 @@ fst_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
2312 | { | 2303 | { |
2313 | struct fst_card_info *card; | 2304 | struct fst_card_info *card; |
2314 | struct fst_port_info *port; | 2305 | struct fst_port_info *port; |
2315 | struct net_device_stats *stats = hdlc_stats(dev); | ||
2316 | unsigned long flags; | 2306 | unsigned long flags; |
2317 | int txq_length; | 2307 | int txq_length; |
2318 | 2308 | ||
@@ -2323,8 +2313,8 @@ fst_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
2323 | /* Drop packet with error if we don't have carrier */ | 2313 | /* Drop packet with error if we don't have carrier */ |
2324 | if (!netif_carrier_ok(dev)) { | 2314 | if (!netif_carrier_ok(dev)) { |
2325 | dev_kfree_skb(skb); | 2315 | dev_kfree_skb(skb); |
2326 | stats->tx_errors++; | 2316 | dev->stats.tx_errors++; |
2327 | stats->tx_carrier_errors++; | 2317 | dev->stats.tx_carrier_errors++; |
2328 | dbg(DBG_ASS, | 2318 | dbg(DBG_ASS, |
2329 | "Tried to transmit but no carrier on card %d port %d\n", | 2319 | "Tried to transmit but no carrier on card %d port %d\n", |
2330 | card->card_no, port->index); | 2320 | card->card_no, port->index); |
@@ -2336,7 +2326,7 @@ fst_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
2336 | dbg(DBG_ASS, "Packet too large %d vs %d\n", skb->len, | 2326 | dbg(DBG_ASS, "Packet too large %d vs %d\n", skb->len, |
2337 | LEN_TX_BUFFER); | 2327 | LEN_TX_BUFFER); |
2338 | dev_kfree_skb(skb); | 2328 | dev_kfree_skb(skb); |
2339 | stats->tx_errors++; | 2329 | dev->stats.tx_errors++; |
2340 | return 0; | 2330 | return 0; |
2341 | } | 2331 | } |
2342 | 2332 | ||
@@ -2368,7 +2358,7 @@ fst_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
2368 | * This shouldn't have happened but such is life | 2358 | * This shouldn't have happened but such is life |
2369 | */ | 2359 | */ |
2370 | dev_kfree_skb(skb); | 2360 | dev_kfree_skb(skb); |
2371 | stats->tx_errors++; | 2361 | dev->stats.tx_errors++; |
2372 | dbg(DBG_ASS, "Tx queue overflow card %d port %d\n", | 2362 | dbg(DBG_ASS, "Tx queue overflow card %d port %d\n", |
2373 | card->card_no, port->index); | 2363 | card->card_no, port->index); |
2374 | return 0; | 2364 | return 0; |
diff --git a/drivers/net/wan/hd6457x.c b/drivers/net/wan/hd6457x.c index 8d0a1f2f00e5..591fb45a7c68 100644 --- a/drivers/net/wan/hd6457x.c +++ b/drivers/net/wan/hd6457x.c | |||
@@ -271,9 +271,9 @@ static inline void sca_msci_intr(port_t *port) | |||
271 | sca_out(stat & (ST1_UDRN | ST1_CDCD), msci + ST1, card); | 271 | sca_out(stat & (ST1_UDRN | ST1_CDCD), msci + ST1, card); |
272 | 272 | ||
273 | if (stat & ST1_UDRN) { | 273 | if (stat & ST1_UDRN) { |
274 | struct net_device_stats *stats = hdlc_stats(port_to_dev(port)); | 274 | /* TX Underrun error detected */ |
275 | stats->tx_errors++; /* TX Underrun error detected */ | 275 | port_to_dev(port)->stats.tx_errors++; |
276 | stats->tx_fifo_errors++; | 276 | port_to_dev(port)->stats.tx_fifo_errors++; |
277 | } | 277 | } |
278 | 278 | ||
279 | if (stat & ST1_CDCD) | 279 | if (stat & ST1_CDCD) |
@@ -286,7 +286,6 @@ static inline void sca_msci_intr(port_t *port) | |||
286 | static inline void sca_rx(card_t *card, port_t *port, pkt_desc __iomem *desc, u16 rxin) | 286 | static inline void sca_rx(card_t *card, port_t *port, pkt_desc __iomem *desc, u16 rxin) |
287 | { | 287 | { |
288 | struct net_device *dev = port_to_dev(port); | 288 | struct net_device *dev = port_to_dev(port); |
289 | struct net_device_stats *stats = hdlc_stats(dev); | ||
290 | struct sk_buff *skb; | 289 | struct sk_buff *skb; |
291 | u16 len; | 290 | u16 len; |
292 | u32 buff; | 291 | u32 buff; |
@@ -298,7 +297,7 @@ static inline void sca_rx(card_t *card, port_t *port, pkt_desc __iomem *desc, u1 | |||
298 | len = readw(&desc->len); | 297 | len = readw(&desc->len); |
299 | skb = dev_alloc_skb(len); | 298 | skb = dev_alloc_skb(len); |
300 | if (!skb) { | 299 | if (!skb) { |
301 | stats->rx_dropped++; | 300 | dev->stats.rx_dropped++; |
302 | return; | 301 | return; |
303 | } | 302 | } |
304 | 303 | ||
@@ -327,8 +326,8 @@ static inline void sca_rx(card_t *card, port_t *port, pkt_desc __iomem *desc, u1 | |||
327 | printk(KERN_DEBUG "%s RX(%i):", dev->name, skb->len); | 326 | printk(KERN_DEBUG "%s RX(%i):", dev->name, skb->len); |
328 | debug_frame(skb); | 327 | debug_frame(skb); |
329 | #endif | 328 | #endif |
330 | stats->rx_packets++; | 329 | dev->stats.rx_packets++; |
331 | stats->rx_bytes += skb->len; | 330 | dev->stats.rx_bytes += skb->len; |
332 | dev->last_rx = jiffies; | 331 | dev->last_rx = jiffies; |
333 | skb->protocol = hdlc_type_trans(skb, dev); | 332 | skb->protocol = hdlc_type_trans(skb, dev); |
334 | netif_rx(skb); | 333 | netif_rx(skb); |
@@ -339,17 +338,18 @@ static inline void sca_rx(card_t *card, port_t *port, pkt_desc __iomem *desc, u1 | |||
339 | /* Receive DMA interrupt service */ | 338 | /* Receive DMA interrupt service */ |
340 | static inline void sca_rx_intr(port_t *port) | 339 | static inline void sca_rx_intr(port_t *port) |
341 | { | 340 | { |
341 | struct net_device *dev = port_to_dev(port); | ||
342 | u16 dmac = get_dmac_rx(port); | 342 | u16 dmac = get_dmac_rx(port); |
343 | card_t *card = port_to_card(port); | 343 | card_t *card = port_to_card(port); |
344 | u8 stat = sca_in(DSR_RX(phy_node(port)), card); /* read DMA Status */ | 344 | u8 stat = sca_in(DSR_RX(phy_node(port)), card); /* read DMA Status */ |
345 | struct net_device_stats *stats = hdlc_stats(port_to_dev(port)); | ||
346 | 345 | ||
347 | /* Reset DSR status bits */ | 346 | /* Reset DSR status bits */ |
348 | sca_out((stat & (DSR_EOT | DSR_EOM | DSR_BOF | DSR_COF)) | DSR_DWE, | 347 | sca_out((stat & (DSR_EOT | DSR_EOM | DSR_BOF | DSR_COF)) | DSR_DWE, |
349 | DSR_RX(phy_node(port)), card); | 348 | DSR_RX(phy_node(port)), card); |
350 | 349 | ||
351 | if (stat & DSR_BOF) | 350 | if (stat & DSR_BOF) |
352 | stats->rx_over_errors++; /* Dropped one or more frames */ | 351 | /* Dropped one or more frames */ |
352 | dev->stats.rx_over_errors++; | ||
353 | 353 | ||
354 | while (1) { | 354 | while (1) { |
355 | u32 desc_off = desc_offset(port, port->rxin, 0); | 355 | u32 desc_off = desc_offset(port, port->rxin, 0); |
@@ -364,12 +364,14 @@ static inline void sca_rx_intr(port_t *port) | |||
364 | if (!(stat & ST_RX_EOM)) | 364 | if (!(stat & ST_RX_EOM)) |
365 | port->rxpart = 1; /* partial frame received */ | 365 | port->rxpart = 1; /* partial frame received */ |
366 | else if ((stat & ST_ERROR_MASK) || port->rxpart) { | 366 | else if ((stat & ST_ERROR_MASK) || port->rxpart) { |
367 | stats->rx_errors++; | 367 | dev->stats.rx_errors++; |
368 | if (stat & ST_RX_OVERRUN) stats->rx_fifo_errors++; | 368 | if (stat & ST_RX_OVERRUN) |
369 | dev->stats.rx_fifo_errors++; | ||
369 | else if ((stat & (ST_RX_SHORT | ST_RX_ABORT | | 370 | else if ((stat & (ST_RX_SHORT | ST_RX_ABORT | |
370 | ST_RX_RESBIT)) || port->rxpart) | 371 | ST_RX_RESBIT)) || port->rxpart) |
371 | stats->rx_frame_errors++; | 372 | dev->stats.rx_frame_errors++; |
372 | else if (stat & ST_RX_CRC) stats->rx_crc_errors++; | 373 | else if (stat & ST_RX_CRC) |
374 | dev->stats.rx_crc_errors++; | ||
373 | if (stat & ST_RX_EOM) | 375 | if (stat & ST_RX_EOM) |
374 | port->rxpart = 0; /* received last fragment */ | 376 | port->rxpart = 0; /* received last fragment */ |
375 | } else | 377 | } else |
@@ -390,7 +392,6 @@ static inline void sca_rx_intr(port_t *port) | |||
390 | static inline void sca_tx_intr(port_t *port) | 392 | static inline void sca_tx_intr(port_t *port) |
391 | { | 393 | { |
392 | struct net_device *dev = port_to_dev(port); | 394 | struct net_device *dev = port_to_dev(port); |
393 | struct net_device_stats *stats = hdlc_stats(dev); | ||
394 | u16 dmac = get_dmac_tx(port); | 395 | u16 dmac = get_dmac_tx(port); |
395 | card_t* card = port_to_card(port); | 396 | card_t* card = port_to_card(port); |
396 | u8 stat; | 397 | u8 stat; |
@@ -412,8 +413,8 @@ static inline void sca_tx_intr(port_t *port) | |||
412 | break; /* Transmitter is/will_be sending this frame */ | 413 | break; /* Transmitter is/will_be sending this frame */ |
413 | 414 | ||
414 | desc = desc_address(port, port->txlast, 1); | 415 | desc = desc_address(port, port->txlast, 1); |
415 | stats->tx_packets++; | 416 | dev->stats.tx_packets++; |
416 | stats->tx_bytes += readw(&desc->len); | 417 | dev->stats.tx_bytes += readw(&desc->len); |
417 | writeb(0, &desc->stat); /* Free descriptor */ | 418 | writeb(0, &desc->stat); /* Free descriptor */ |
418 | port->txlast = next_desc(port, port->txlast, 1); | 419 | port->txlast = next_desc(port, port->txlast, 1); |
419 | } | 420 | } |
diff --git a/drivers/net/wan/hdlc.c b/drivers/net/wan/hdlc.c index 7f984895b0d5..e3a536477c7e 100644 --- a/drivers/net/wan/hdlc.c +++ b/drivers/net/wan/hdlc.c | |||
@@ -57,7 +57,7 @@ static int hdlc_change_mtu(struct net_device *dev, int new_mtu) | |||
57 | 57 | ||
58 | static struct net_device_stats *hdlc_get_stats(struct net_device *dev) | 58 | static struct net_device_stats *hdlc_get_stats(struct net_device *dev) |
59 | { | 59 | { |
60 | return hdlc_stats(dev); | 60 | return &dev->stats; |
61 | } | 61 | } |
62 | 62 | ||
63 | 63 | ||
diff --git a/drivers/net/wan/hdlc_cisco.c b/drivers/net/wan/hdlc_cisco.c index 762d21c1c703..849819c2552d 100644 --- a/drivers/net/wan/hdlc_cisco.c +++ b/drivers/net/wan/hdlc_cisco.c | |||
@@ -252,8 +252,8 @@ static int cisco_rx(struct sk_buff *skb) | |||
252 | dev_kfree_skb_any(skb); | 252 | dev_kfree_skb_any(skb); |
253 | return NET_RX_DROP; | 253 | return NET_RX_DROP; |
254 | 254 | ||
255 | rx_error: | 255 | rx_error: |
256 | dev_to_hdlc(dev)->stats.rx_errors++; /* Mark error */ | 256 | dev->stats.rx_errors++; /* Mark error */ |
257 | dev_kfree_skb_any(skb); | 257 | dev_kfree_skb_any(skb); |
258 | return NET_RX_DROP; | 258 | return NET_RX_DROP; |
259 | } | 259 | } |
diff --git a/drivers/net/wan/hdlc_fr.c b/drivers/net/wan/hdlc_fr.c index 520bb0b1a9a2..cb1b415053eb 100644 --- a/drivers/net/wan/hdlc_fr.c +++ b/drivers/net/wan/hdlc_fr.c | |||
@@ -136,7 +136,6 @@ typedef struct pvc_device_struct { | |||
136 | }pvc_device; | 136 | }pvc_device; |
137 | 137 | ||
138 | struct pvc_desc { | 138 | struct pvc_desc { |
139 | struct net_device_stats stats; | ||
140 | pvc_device *pvc; | 139 | pvc_device *pvc; |
141 | }; | 140 | }; |
142 | 141 | ||
@@ -184,11 +183,6 @@ static inline struct pvc_desc* pvcdev_to_desc(struct net_device *dev) | |||
184 | return dev->priv; | 183 | return dev->priv; |
185 | } | 184 | } |
186 | 185 | ||
187 | static inline struct net_device_stats* pvc_get_stats(struct net_device *dev) | ||
188 | { | ||
189 | return &pvcdev_to_desc(dev)->stats; | ||
190 | } | ||
191 | |||
192 | static inline pvc_device* find_pvc(hdlc_device *hdlc, u16 dlci) | 186 | static inline pvc_device* find_pvc(hdlc_device *hdlc, u16 dlci) |
193 | { | 187 | { |
194 | pvc_device *pvc = state(hdlc)->first_pvc; | 188 | pvc_device *pvc = state(hdlc)->first_pvc; |
@@ -425,7 +419,6 @@ static int pvc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) | |||
425 | static int pvc_xmit(struct sk_buff *skb, struct net_device *dev) | 419 | static int pvc_xmit(struct sk_buff *skb, struct net_device *dev) |
426 | { | 420 | { |
427 | pvc_device *pvc = pvcdev_to_desc(dev)->pvc; | 421 | pvc_device *pvc = pvcdev_to_desc(dev)->pvc; |
428 | struct net_device_stats *stats = pvc_get_stats(dev); | ||
429 | 422 | ||
430 | if (pvc->state.active) { | 423 | if (pvc->state.active) { |
431 | if (dev->type == ARPHRD_ETHER) { | 424 | if (dev->type == ARPHRD_ETHER) { |
@@ -435,7 +428,7 @@ static int pvc_xmit(struct sk_buff *skb, struct net_device *dev) | |||
435 | if (skb_tailroom(skb) < pad) | 428 | if (skb_tailroom(skb) < pad) |
436 | if (pskb_expand_head(skb, 0, pad, | 429 | if (pskb_expand_head(skb, 0, pad, |
437 | GFP_ATOMIC)) { | 430 | GFP_ATOMIC)) { |
438 | stats->tx_dropped++; | 431 | dev->stats.tx_dropped++; |
439 | dev_kfree_skb(skb); | 432 | dev_kfree_skb(skb); |
440 | return 0; | 433 | return 0; |
441 | } | 434 | } |
@@ -445,17 +438,17 @@ static int pvc_xmit(struct sk_buff *skb, struct net_device *dev) | |||
445 | skb->protocol = __constant_htons(ETH_P_802_3); | 438 | skb->protocol = __constant_htons(ETH_P_802_3); |
446 | } | 439 | } |
447 | if (!fr_hard_header(&skb, pvc->dlci)) { | 440 | if (!fr_hard_header(&skb, pvc->dlci)) { |
448 | stats->tx_bytes += skb->len; | 441 | dev->stats.tx_bytes += skb->len; |
449 | stats->tx_packets++; | 442 | dev->stats.tx_packets++; |
450 | if (pvc->state.fecn) /* TX Congestion counter */ | 443 | if (pvc->state.fecn) /* TX Congestion counter */ |
451 | stats->tx_compressed++; | 444 | dev->stats.tx_compressed++; |
452 | skb->dev = pvc->frad; | 445 | skb->dev = pvc->frad; |
453 | dev_queue_xmit(skb); | 446 | dev_queue_xmit(skb); |
454 | return 0; | 447 | return 0; |
455 | } | 448 | } |
456 | } | 449 | } |
457 | 450 | ||
458 | stats->tx_dropped++; | 451 | dev->stats.tx_dropped++; |
459 | dev_kfree_skb(skb); | 452 | dev_kfree_skb(skb); |
460 | return 0; | 453 | return 0; |
461 | } | 454 | } |
@@ -955,7 +948,7 @@ static int fr_rx(struct sk_buff *skb) | |||
955 | 948 | ||
956 | 949 | ||
957 | if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL) { | 950 | if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL) { |
958 | dev_to_hdlc(frad)->stats.rx_dropped++; | 951 | frad->stats.rx_dropped++; |
959 | return NET_RX_DROP; | 952 | return NET_RX_DROP; |
960 | } | 953 | } |
961 | 954 | ||
@@ -1003,11 +996,10 @@ static int fr_rx(struct sk_buff *skb) | |||
1003 | } | 996 | } |
1004 | 997 | ||
1005 | if (dev) { | 998 | if (dev) { |
1006 | struct net_device_stats *stats = pvc_get_stats(dev); | 999 | dev->stats.rx_packets++; /* PVC traffic */ |
1007 | stats->rx_packets++; /* PVC traffic */ | 1000 | dev->stats.rx_bytes += skb->len; |
1008 | stats->rx_bytes += skb->len; | ||
1009 | if (pvc->state.becn) | 1001 | if (pvc->state.becn) |
1010 | stats->rx_compressed++; | 1002 | dev->stats.rx_compressed++; |
1011 | netif_rx(skb); | 1003 | netif_rx(skb); |
1012 | return NET_RX_SUCCESS; | 1004 | return NET_RX_SUCCESS; |
1013 | } else { | 1005 | } else { |
@@ -1016,7 +1008,7 @@ static int fr_rx(struct sk_buff *skb) | |||
1016 | } | 1008 | } |
1017 | 1009 | ||
1018 | rx_error: | 1010 | rx_error: |
1019 | dev_to_hdlc(frad)->stats.rx_errors++; /* Mark error */ | 1011 | frad->stats.rx_errors++; /* Mark error */ |
1020 | dev_kfree_skb_any(skb); | 1012 | dev_kfree_skb_any(skb); |
1021 | return NET_RX_DROP; | 1013 | return NET_RX_DROP; |
1022 | } | 1014 | } |
@@ -1122,7 +1114,6 @@ static int fr_add_pvc(struct net_device *frad, unsigned int dlci, int type) | |||
1122 | dlci_to_q922(dev->broadcast, dlci); | 1114 | dlci_to_q922(dev->broadcast, dlci); |
1123 | } | 1115 | } |
1124 | dev->hard_start_xmit = pvc_xmit; | 1116 | dev->hard_start_xmit = pvc_xmit; |
1125 | dev->get_stats = pvc_get_stats; | ||
1126 | dev->open = pvc_open; | 1117 | dev->open = pvc_open; |
1127 | dev->stop = pvc_close; | 1118 | dev->stop = pvc_close; |
1128 | dev->do_ioctl = pvc_ioctl; | 1119 | dev->do_ioctl = pvc_ioctl; |
diff --git a/drivers/net/wan/hdlc_raw_eth.c b/drivers/net/wan/hdlc_raw_eth.c index d20c685f6711..26dee600506f 100644 --- a/drivers/net/wan/hdlc_raw_eth.c +++ b/drivers/net/wan/hdlc_raw_eth.c | |||
@@ -33,7 +33,7 @@ static int eth_tx(struct sk_buff *skb, struct net_device *dev) | |||
33 | int len = skb->len; | 33 | int len = skb->len; |
34 | if (skb_tailroom(skb) < pad) | 34 | if (skb_tailroom(skb) < pad) |
35 | if (pskb_expand_head(skb, 0, pad, GFP_ATOMIC)) { | 35 | if (pskb_expand_head(skb, 0, pad, GFP_ATOMIC)) { |
36 | hdlc_stats(dev)->tx_dropped++; | 36 | dev->stats.tx_dropped++; |
37 | dev_kfree_skb(skb); | 37 | dev_kfree_skb(skb); |
38 | return 0; | 38 | return 0; |
39 | } | 39 | } |
diff --git a/drivers/net/wan/hdlc_x25.c b/drivers/net/wan/hdlc_x25.c index c15cc11e399b..e808720030ef 100644 --- a/drivers/net/wan/hdlc_x25.c +++ b/drivers/net/wan/hdlc_x25.c | |||
@@ -164,17 +164,15 @@ static void x25_close(struct net_device *dev) | |||
164 | 164 | ||
165 | static int x25_rx(struct sk_buff *skb) | 165 | static int x25_rx(struct sk_buff *skb) |
166 | { | 166 | { |
167 | struct hdlc_device *hdlc = dev_to_hdlc(skb->dev); | ||
168 | |||
169 | if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL) { | 167 | if ((skb = skb_share_check(skb, GFP_ATOMIC)) == NULL) { |
170 | hdlc->stats.rx_dropped++; | 168 | skb->dev->stats.rx_dropped++; |
171 | return NET_RX_DROP; | 169 | return NET_RX_DROP; |
172 | } | 170 | } |
173 | 171 | ||
174 | if (lapb_data_received(skb->dev, skb) == LAPB_OK) | 172 | if (lapb_data_received(skb->dev, skb) == LAPB_OK) |
175 | return NET_RX_SUCCESS; | 173 | return NET_RX_SUCCESS; |
176 | 174 | ||
177 | hdlc->stats.rx_errors++; | 175 | skb->dev->stats.rx_errors++; |
178 | dev_kfree_skb_any(skb); | 176 | dev_kfree_skb_any(skb); |
179 | return NET_RX_DROP; | 177 | return NET_RX_DROP; |
180 | } | 178 | } |
diff --git a/drivers/net/wan/pc300_drv.c b/drivers/net/wan/pc300_drv.c index 57914fbd41d3..334170527755 100644 --- a/drivers/net/wan/pc300_drv.c +++ b/drivers/net/wan/pc300_drv.c | |||
@@ -285,7 +285,6 @@ static void rx_dma_buf_init(pc300_t *, int); | |||
285 | static void tx_dma_buf_check(pc300_t *, int); | 285 | static void tx_dma_buf_check(pc300_t *, int); |
286 | static void rx_dma_buf_check(pc300_t *, int); | 286 | static void rx_dma_buf_check(pc300_t *, int); |
287 | static irqreturn_t cpc_intr(int, void *); | 287 | static irqreturn_t cpc_intr(int, void *); |
288 | static struct net_device_stats *cpc_get_stats(struct net_device *); | ||
289 | static int clock_rate_calc(uclong, uclong, int *); | 288 | static int clock_rate_calc(uclong, uclong, int *); |
290 | static uclong detect_ram(pc300_t *); | 289 | static uclong detect_ram(pc300_t *); |
291 | static void plx_init(pc300_t *); | 290 | static void plx_init(pc300_t *); |
@@ -1775,13 +1774,12 @@ static void cpc_tx_timeout(struct net_device *dev) | |||
1775 | pc300dev_t *d = (pc300dev_t *) dev->priv; | 1774 | pc300dev_t *d = (pc300dev_t *) dev->priv; |
1776 | pc300ch_t *chan = (pc300ch_t *) d->chan; | 1775 | pc300ch_t *chan = (pc300ch_t *) d->chan; |
1777 | pc300_t *card = (pc300_t *) chan->card; | 1776 | pc300_t *card = (pc300_t *) chan->card; |
1778 | struct net_device_stats *stats = hdlc_stats(dev); | ||
1779 | int ch = chan->channel; | 1777 | int ch = chan->channel; |
1780 | unsigned long flags; | 1778 | unsigned long flags; |
1781 | ucchar ilar; | 1779 | ucchar ilar; |
1782 | 1780 | ||
1783 | stats->tx_errors++; | 1781 | dev->stats.tx_errors++; |
1784 | stats->tx_aborted_errors++; | 1782 | dev->stats.tx_aborted_errors++; |
1785 | CPC_LOCK(card, flags); | 1783 | CPC_LOCK(card, flags); |
1786 | if ((ilar = cpc_readb(card->hw.scabase + ILAR)) != 0) { | 1784 | if ((ilar = cpc_readb(card->hw.scabase + ILAR)) != 0) { |
1787 | printk("%s: ILAR=0x%x\n", dev->name, ilar); | 1785 | printk("%s: ILAR=0x%x\n", dev->name, ilar); |
@@ -1803,7 +1801,6 @@ static int cpc_queue_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1803 | pc300dev_t *d = (pc300dev_t *) dev->priv; | 1801 | pc300dev_t *d = (pc300dev_t *) dev->priv; |
1804 | pc300ch_t *chan = (pc300ch_t *) d->chan; | 1802 | pc300ch_t *chan = (pc300ch_t *) d->chan; |
1805 | pc300_t *card = (pc300_t *) chan->card; | 1803 | pc300_t *card = (pc300_t *) chan->card; |
1806 | struct net_device_stats *stats = hdlc_stats(dev); | ||
1807 | int ch = chan->channel; | 1804 | int ch = chan->channel; |
1808 | unsigned long flags; | 1805 | unsigned long flags; |
1809 | #ifdef PC300_DEBUG_TX | 1806 | #ifdef PC300_DEBUG_TX |
@@ -1817,13 +1814,13 @@ static int cpc_queue_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1817 | } else if (!netif_carrier_ok(dev)) { | 1814 | } else if (!netif_carrier_ok(dev)) { |
1818 | /* DCD must be OFF: drop packet */ | 1815 | /* DCD must be OFF: drop packet */ |
1819 | dev_kfree_skb(skb); | 1816 | dev_kfree_skb(skb); |
1820 | stats->tx_errors++; | 1817 | dev->stats.tx_errors++; |
1821 | stats->tx_carrier_errors++; | 1818 | dev->stats.tx_carrier_errors++; |
1822 | return 0; | 1819 | return 0; |
1823 | } else if (cpc_readb(card->hw.scabase + M_REG(ST3, ch)) & ST3_DCD) { | 1820 | } else if (cpc_readb(card->hw.scabase + M_REG(ST3, ch)) & ST3_DCD) { |
1824 | printk("%s: DCD is OFF. Going administrative down.\n", dev->name); | 1821 | printk("%s: DCD is OFF. Going administrative down.\n", dev->name); |
1825 | stats->tx_errors++; | 1822 | dev->stats.tx_errors++; |
1826 | stats->tx_carrier_errors++; | 1823 | dev->stats.tx_carrier_errors++; |
1827 | dev_kfree_skb(skb); | 1824 | dev_kfree_skb(skb); |
1828 | netif_carrier_off(dev); | 1825 | netif_carrier_off(dev); |
1829 | CPC_LOCK(card, flags); | 1826 | CPC_LOCK(card, flags); |
@@ -1843,8 +1840,8 @@ static int cpc_queue_xmit(struct sk_buff *skb, struct net_device *dev) | |||
1843 | // printk("%s: write error. Dropping TX packet.\n", dev->name); | 1840 | // printk("%s: write error. Dropping TX packet.\n", dev->name); |
1844 | netif_stop_queue(dev); | 1841 | netif_stop_queue(dev); |
1845 | dev_kfree_skb(skb); | 1842 | dev_kfree_skb(skb); |
1846 | stats->tx_errors++; | 1843 | dev->stats.tx_errors++; |
1847 | stats->tx_dropped++; | 1844 | dev->stats.tx_dropped++; |
1848 | return 0; | 1845 | return 0; |
1849 | } | 1846 | } |
1850 | #ifdef PC300_DEBUG_TX | 1847 | #ifdef PC300_DEBUG_TX |
@@ -1886,7 +1883,6 @@ static void cpc_net_rx(struct net_device *dev) | |||
1886 | pc300dev_t *d = (pc300dev_t *) dev->priv; | 1883 | pc300dev_t *d = (pc300dev_t *) dev->priv; |
1887 | pc300ch_t *chan = (pc300ch_t *) d->chan; | 1884 | pc300ch_t *chan = (pc300ch_t *) d->chan; |
1888 | pc300_t *card = (pc300_t *) chan->card; | 1885 | pc300_t *card = (pc300_t *) chan->card; |
1889 | struct net_device_stats *stats = hdlc_stats(dev); | ||
1890 | int ch = chan->channel; | 1886 | int ch = chan->channel; |
1891 | #ifdef PC300_DEBUG_RX | 1887 | #ifdef PC300_DEBUG_RX |
1892 | int i; | 1888 | int i; |
@@ -1922,24 +1918,24 @@ static void cpc_net_rx(struct net_device *dev) | |||
1922 | #endif | 1918 | #endif |
1923 | if ((skb == NULL) && (rxb > 0)) { | 1919 | if ((skb == NULL) && (rxb > 0)) { |
1924 | /* rxb > dev->mtu */ | 1920 | /* rxb > dev->mtu */ |
1925 | stats->rx_errors++; | 1921 | dev->stats.rx_errors++; |
1926 | stats->rx_length_errors++; | 1922 | dev->stats.rx_length_errors++; |
1927 | continue; | 1923 | continue; |
1928 | } | 1924 | } |
1929 | 1925 | ||
1930 | if (rxb < 0) { /* Invalid frame */ | 1926 | if (rxb < 0) { /* Invalid frame */ |
1931 | rxb = -rxb; | 1927 | rxb = -rxb; |
1932 | if (rxb & DST_OVR) { | 1928 | if (rxb & DST_OVR) { |
1933 | stats->rx_errors++; | 1929 | dev->stats.rx_errors++; |
1934 | stats->rx_fifo_errors++; | 1930 | dev->stats.rx_fifo_errors++; |
1935 | } | 1931 | } |
1936 | if (rxb & DST_CRC) { | 1932 | if (rxb & DST_CRC) { |
1937 | stats->rx_errors++; | 1933 | dev->stats.rx_errors++; |
1938 | stats->rx_crc_errors++; | 1934 | dev->stats.rx_crc_errors++; |
1939 | } | 1935 | } |
1940 | if (rxb & (DST_RBIT | DST_SHRT | DST_ABT)) { | 1936 | if (rxb & (DST_RBIT | DST_SHRT | DST_ABT)) { |
1941 | stats->rx_errors++; | 1937 | dev->stats.rx_errors++; |
1942 | stats->rx_frame_errors++; | 1938 | dev->stats.rx_frame_errors++; |
1943 | } | 1939 | } |
1944 | } | 1940 | } |
1945 | if (skb) { | 1941 | if (skb) { |
@@ -1948,7 +1944,7 @@ static void cpc_net_rx(struct net_device *dev) | |||
1948 | continue; | 1944 | continue; |
1949 | } | 1945 | } |
1950 | 1946 | ||
1951 | stats->rx_bytes += rxb; | 1947 | dev->stats.rx_bytes += rxb; |
1952 | 1948 | ||
1953 | #ifdef PC300_DEBUG_RX | 1949 | #ifdef PC300_DEBUG_RX |
1954 | printk("%s R:", dev->name); | 1950 | printk("%s R:", dev->name); |
@@ -1959,7 +1955,7 @@ static void cpc_net_rx(struct net_device *dev) | |||
1959 | if (d->trace_on) { | 1955 | if (d->trace_on) { |
1960 | cpc_trace(dev, skb, 'R'); | 1956 | cpc_trace(dev, skb, 'R'); |
1961 | } | 1957 | } |
1962 | stats->rx_packets++; | 1958 | dev->stats.rx_packets++; |
1963 | skb->protocol = hdlc_type_trans(skb, dev); | 1959 | skb->protocol = hdlc_type_trans(skb, dev); |
1964 | netif_rx(skb); | 1960 | netif_rx(skb); |
1965 | } | 1961 | } |
@@ -1974,16 +1970,15 @@ static void sca_tx_intr(pc300dev_t *dev) | |||
1974 | pc300_t *card = (pc300_t *)chan->card; | 1970 | pc300_t *card = (pc300_t *)chan->card; |
1975 | int ch = chan->channel; | 1971 | int ch = chan->channel; |
1976 | volatile pcsca_bd_t __iomem * ptdescr; | 1972 | volatile pcsca_bd_t __iomem * ptdescr; |
1977 | struct net_device_stats *stats = hdlc_stats(dev->dev); | ||
1978 | 1973 | ||
1979 | /* Clean up descriptors from previous transmission */ | 1974 | /* Clean up descriptors from previous transmission */ |
1980 | ptdescr = (card->hw.rambase + | 1975 | ptdescr = (card->hw.rambase + |
1981 | TX_BD_ADDR(ch,chan->tx_first_bd)); | 1976 | TX_BD_ADDR(ch,chan->tx_first_bd)); |
1982 | while ((cpc_readl(card->hw.scabase + DTX_REG(CDAL,ch)) != | 1977 | while ((cpc_readl(card->hw.scabase + DTX_REG(CDAL,ch)) != |
1983 | TX_BD_ADDR(ch,chan->tx_first_bd)) && | 1978 | TX_BD_ADDR(ch,chan->tx_first_bd)) && |
1984 | (cpc_readb(&ptdescr->status) & DST_OSB)) { | 1979 | (cpc_readb(&ptdescr->status) & DST_OSB)) { |
1985 | stats->tx_packets++; | 1980 | dev->dev->stats.tx_packets++; |
1986 | stats->tx_bytes += cpc_readw(&ptdescr->len); | 1981 | dev->dev->stats.tx_bytes += cpc_readw(&ptdescr->len); |
1987 | cpc_writeb(&ptdescr->status, DST_OSB); | 1982 | cpc_writeb(&ptdescr->status, DST_OSB); |
1988 | cpc_writew(&ptdescr->len, 0); | 1983 | cpc_writew(&ptdescr->len, 0); |
1989 | chan->nfree_tx_bd++; | 1984 | chan->nfree_tx_bd++; |
@@ -2048,8 +2043,8 @@ static void sca_intr(pc300_t * card) | |||
2048 | } | 2043 | } |
2049 | cpc_net_rx(dev); | 2044 | cpc_net_rx(dev); |
2050 | /* Discard invalid frames */ | 2045 | /* Discard invalid frames */ |
2051 | hdlc_stats(dev)->rx_errors++; | 2046 | dev->stats.rx_errors++; |
2052 | hdlc_stats(dev)->rx_over_errors++; | 2047 | dev->stats.rx_over_errors++; |
2053 | chan->rx_first_bd = 0; | 2048 | chan->rx_first_bd = 0; |
2054 | chan->rx_last_bd = N_DMA_RX_BUF - 1; | 2049 | chan->rx_last_bd = N_DMA_RX_BUF - 1; |
2055 | rx_dma_start(card, ch); | 2050 | rx_dma_start(card, ch); |
@@ -2115,8 +2110,8 @@ static void sca_intr(pc300_t * card) | |||
2115 | card->hw.cpld_reg2) & | 2110 | card->hw.cpld_reg2) & |
2116 | ~ (CPLD_REG2_FALC_LED1 << (2 * ch))); | 2111 | ~ (CPLD_REG2_FALC_LED1 << (2 * ch))); |
2117 | } | 2112 | } |
2118 | hdlc_stats(dev)->tx_errors++; | 2113 | dev->stats.tx_errors++; |
2119 | hdlc_stats(dev)->tx_fifo_errors++; | 2114 | dev->stats.tx_fifo_errors++; |
2120 | sca_tx_intr(d); | 2115 | sca_tx_intr(d); |
2121 | } | 2116 | } |
2122 | } | 2117 | } |
@@ -2604,7 +2599,7 @@ static int cpc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) | |||
2604 | case SIOCGPC300UTILSTATS: | 2599 | case SIOCGPC300UTILSTATS: |
2605 | { | 2600 | { |
2606 | if (!arg) { /* clear statistics */ | 2601 | if (!arg) { /* clear statistics */ |
2607 | memset(hdlc_stats(dev), 0, sizeof(struct net_device_stats)); | 2602 | memset(&dev->stats, 0, sizeof(dev->stats)); |
2608 | if (card->hw.type == PC300_TE) { | 2603 | if (card->hw.type == PC300_TE) { |
2609 | memset(&chan->falc, 0, sizeof(falc_t)); | 2604 | memset(&chan->falc, 0, sizeof(falc_t)); |
2610 | } | 2605 | } |
@@ -2615,8 +2610,8 @@ static int cpc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) | |||
2615 | pc300stats.hw_type = card->hw.type; | 2610 | pc300stats.hw_type = card->hw.type; |
2616 | pc300stats.line_on = card->chan[ch].d.line_on; | 2611 | pc300stats.line_on = card->chan[ch].d.line_on; |
2617 | pc300stats.line_off = card->chan[ch].d.line_off; | 2612 | pc300stats.line_off = card->chan[ch].d.line_off; |
2618 | memcpy(&pc300stats.gen_stats, hdlc_stats(dev), | 2613 | memcpy(&pc300stats.gen_stats, &dev->stats, |
2619 | sizeof(struct net_device_stats)); | 2614 | sizeof(dev->stats)); |
2620 | if (card->hw.type == PC300_TE) | 2615 | if (card->hw.type == PC300_TE) |
2621 | memcpy(&pc300stats.te_stats,&chan->falc,sizeof(falc_t)); | 2616 | memcpy(&pc300stats.te_stats,&chan->falc,sizeof(falc_t)); |
2622 | if (copy_to_user(arg, &pc300stats, sizeof(pc300stats_t))) | 2617 | if (copy_to_user(arg, &pc300stats, sizeof(pc300stats_t))) |
@@ -2823,11 +2818,6 @@ static int cpc_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) | |||
2823 | } | 2818 | } |
2824 | } | 2819 | } |
2825 | 2820 | ||
2826 | static struct net_device_stats *cpc_get_stats(struct net_device *dev) | ||
2827 | { | ||
2828 | return hdlc_stats(dev); | ||
2829 | } | ||
2830 | |||
2831 | static int clock_rate_calc(uclong rate, uclong clock, int *br_io) | 2821 | static int clock_rate_calc(uclong rate, uclong clock, int *br_io) |
2832 | { | 2822 | { |
2833 | int br, tc; | 2823 | int br, tc; |
@@ -3394,7 +3384,6 @@ static void cpc_init_card(pc300_t * card) | |||
3394 | dev->stop = cpc_close; | 3384 | dev->stop = cpc_close; |
3395 | dev->tx_timeout = cpc_tx_timeout; | 3385 | dev->tx_timeout = cpc_tx_timeout; |
3396 | dev->watchdog_timeo = PC300_TX_TIMEOUT; | 3386 | dev->watchdog_timeo = PC300_TX_TIMEOUT; |
3397 | dev->get_stats = cpc_get_stats; | ||
3398 | dev->set_multicast_list = NULL; | 3387 | dev->set_multicast_list = NULL; |
3399 | dev->set_mac_address = NULL; | 3388 | dev->set_mac_address = NULL; |
3400 | dev->change_mtu = cpc_change_mtu; | 3389 | dev->change_mtu = cpc_change_mtu; |
diff --git a/drivers/net/wan/pc300_tty.c b/drivers/net/wan/pc300_tty.c index e03eef2f2282..eae94ab6b818 100644 --- a/drivers/net/wan/pc300_tty.c +++ b/drivers/net/wan/pc300_tty.c | |||
@@ -458,7 +458,7 @@ static int cpc_tty_write(struct tty_struct *tty, const unsigned char *buf, int c | |||
458 | CPC_TTY_DBG("%s: cpc_tty_write data len=%i\n",cpc_tty->name,count); | 458 | CPC_TTY_DBG("%s: cpc_tty_write data len=%i\n",cpc_tty->name,count); |
459 | 459 | ||
460 | pc300chan = (pc300ch_t *)((pc300dev_t*)cpc_tty->pc300dev)->chan; | 460 | pc300chan = (pc300ch_t *)((pc300dev_t*)cpc_tty->pc300dev)->chan; |
461 | stats = hdlc_stats(((pc300dev_t*)cpc_tty->pc300dev)->dev); | 461 | stats = &cpc_tty->pc300dev->dev->stats; |
462 | card = (pc300_t *) pc300chan->card; | 462 | card = (pc300_t *) pc300chan->card; |
463 | ch = pc300chan->channel; | 463 | ch = pc300chan->channel; |
464 | 464 | ||
@@ -743,7 +743,7 @@ void cpc_tty_receive(pc300dev_t *pc300dev) | |||
743 | pc300_t *card = (pc300_t *)pc300chan->card; | 743 | pc300_t *card = (pc300_t *)pc300chan->card; |
744 | int ch = pc300chan->channel; | 744 | int ch = pc300chan->channel; |
745 | volatile pcsca_bd_t __iomem * ptdescr; | 745 | volatile pcsca_bd_t __iomem * ptdescr; |
746 | struct net_device_stats *stats = hdlc_stats(pc300dev->dev); | 746 | struct net_device_stats *stats = &pc300dev->dev->stats; |
747 | int rx_len, rx_aux; | 747 | int rx_len, rx_aux; |
748 | volatile unsigned char status; | 748 | volatile unsigned char status; |
749 | unsigned short first_bd = pc300chan->rx_first_bd; | 749 | unsigned short first_bd = pc300chan->rx_first_bd; |
@@ -917,7 +917,7 @@ static int cpc_tty_send_to_card(pc300dev_t *dev,void* buf, int len) | |||
917 | pc300ch_t *chan = (pc300ch_t *)dev->chan; | 917 | pc300ch_t *chan = (pc300ch_t *)dev->chan; |
918 | pc300_t *card = (pc300_t *)chan->card; | 918 | pc300_t *card = (pc300_t *)chan->card; |
919 | int ch = chan->channel; | 919 | int ch = chan->channel; |
920 | struct net_device_stats *stats = hdlc_stats(dev->dev); | 920 | struct net_device_stats *stats = &dev->dev->stats; |
921 | unsigned long flags; | 921 | unsigned long flags; |
922 | volatile pcsca_bd_t __iomem *ptdescr; | 922 | volatile pcsca_bd_t __iomem *ptdescr; |
923 | int i, nchar; | 923 | int i, nchar; |
diff --git a/drivers/net/wan/wanxl.c b/drivers/net/wan/wanxl.c index d4aab8a28b61..a8a5ca0ee6c2 100644 --- a/drivers/net/wan/wanxl.c +++ b/drivers/net/wan/wanxl.c | |||
@@ -161,7 +161,6 @@ static inline void wanxl_cable_intr(port_t *port) | |||
161 | static inline void wanxl_tx_intr(port_t *port) | 161 | static inline void wanxl_tx_intr(port_t *port) |
162 | { | 162 | { |
163 | struct net_device *dev = port->dev; | 163 | struct net_device *dev = port->dev; |
164 | struct net_device_stats *stats = hdlc_stats(dev); | ||
165 | while (1) { | 164 | while (1) { |
166 | desc_t *desc = &get_status(port)->tx_descs[port->tx_in]; | 165 | desc_t *desc = &get_status(port)->tx_descs[port->tx_in]; |
167 | struct sk_buff *skb = port->tx_skbs[port->tx_in]; | 166 | struct sk_buff *skb = port->tx_skbs[port->tx_in]; |
@@ -173,13 +172,13 @@ static inline void wanxl_tx_intr(port_t *port) | |||
173 | return; | 172 | return; |
174 | 173 | ||
175 | case PACKET_UNDERRUN: | 174 | case PACKET_UNDERRUN: |
176 | stats->tx_errors++; | 175 | dev->stats.tx_errors++; |
177 | stats->tx_fifo_errors++; | 176 | dev->stats.tx_fifo_errors++; |
178 | break; | 177 | break; |
179 | 178 | ||
180 | default: | 179 | default: |
181 | stats->tx_packets++; | 180 | dev->stats.tx_packets++; |
182 | stats->tx_bytes += skb->len; | 181 | dev->stats.tx_bytes += skb->len; |
183 | } | 182 | } |
184 | desc->stat = PACKET_EMPTY; /* Free descriptor */ | 183 | desc->stat = PACKET_EMPTY; /* Free descriptor */ |
185 | pci_unmap_single(port->card->pdev, desc->address, skb->len, | 184 | pci_unmap_single(port->card->pdev, desc->address, skb->len, |
@@ -205,10 +204,9 @@ static inline void wanxl_rx_intr(card_t *card) | |||
205 | port_t *port = &card->ports[desc->stat & | 204 | port_t *port = &card->ports[desc->stat & |
206 | PACKET_PORT_MASK]; | 205 | PACKET_PORT_MASK]; |
207 | struct net_device *dev = port->dev; | 206 | struct net_device *dev = port->dev; |
208 | struct net_device_stats *stats = hdlc_stats(dev); | ||
209 | 207 | ||
210 | if (!skb) | 208 | if (!skb) |
211 | stats->rx_dropped++; | 209 | dev->stats.rx_dropped++; |
212 | else { | 210 | else { |
213 | pci_unmap_single(card->pdev, desc->address, | 211 | pci_unmap_single(card->pdev, desc->address, |
214 | BUFFER_LENGTH, | 212 | BUFFER_LENGTH, |
@@ -220,8 +218,8 @@ static inline void wanxl_rx_intr(card_t *card) | |||
220 | skb->len); | 218 | skb->len); |
221 | debug_frame(skb); | 219 | debug_frame(skb); |
222 | #endif | 220 | #endif |
223 | stats->rx_packets++; | 221 | dev->stats.rx_packets++; |
224 | stats->rx_bytes += skb->len; | 222 | dev->stats.rx_bytes += skb->len; |
225 | dev->last_rx = jiffies; | 223 | dev->last_rx = jiffies; |
226 | skb->protocol = hdlc_type_trans(skb, dev); | 224 | skb->protocol = hdlc_type_trans(skb, dev); |
227 | netif_rx(skb); | 225 | netif_rx(skb); |
@@ -468,13 +466,13 @@ static int wanxl_close(struct net_device *dev) | |||
468 | 466 | ||
469 | static struct net_device_stats *wanxl_get_stats(struct net_device *dev) | 467 | static struct net_device_stats *wanxl_get_stats(struct net_device *dev) |
470 | { | 468 | { |
471 | struct net_device_stats *stats = hdlc_stats(dev); | ||
472 | port_t *port = dev_to_port(dev); | 469 | port_t *port = dev_to_port(dev); |
473 | 470 | ||
474 | stats->rx_over_errors = get_status(port)->rx_overruns; | 471 | dev->stats.rx_over_errors = get_status(port)->rx_overruns; |
475 | stats->rx_frame_errors = get_status(port)->rx_frame_errors; | 472 | dev->stats.rx_frame_errors = get_status(port)->rx_frame_errors; |
476 | stats->rx_errors = stats->rx_over_errors + stats->rx_frame_errors; | 473 | dev->stats.rx_errors = dev->stats.rx_over_errors + |
477 | return stats; | 474 | dev->stats.rx_frame_errors; |
475 | return &dev->stats; | ||
478 | } | 476 | } |
479 | 477 | ||
480 | 478 | ||