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/farsync.c | |
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/farsync.c')
-rw-r--r-- | drivers/net/wan/farsync.c | 70 |
1 files changed, 30 insertions, 40 deletions
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; |