aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/atlx/atl2.c
diff options
context:
space:
mode:
authorStephen Hemminger <shemminger@vyatta.com>2008-10-31 19:52:03 -0400
committerJeff Garzik <jgarzik@redhat.com>2008-11-02 07:59:55 -0500
commit02e7173149c3ffcf963075ec2bdc5f7be8335a78 (patch)
treed4206ce6e7f222891f7ccb547eadd01515217950 /drivers/net/atlx/atl2.c
parentae27e98a51526595837ab7498b23d6478a198960 (diff)
atlx: use embedded net_device_stats
There is now a net_device_stats structure inside net_device that should be used if possible by devices. Compile tested only. Signed-off-by: Stephen Hemminger <shemminger@vyatta.com> Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers/net/atlx/atl2.c')
-rw-r--r--drivers/net/atlx/atl2.c55
1 files changed, 22 insertions, 33 deletions
diff --git a/drivers/net/atlx/atl2.c b/drivers/net/atlx/atl2.c
index f5bdc92c1a65..8c5d009ca821 100644
--- a/drivers/net/atlx/atl2.c
+++ b/drivers/net/atlx/atl2.c
@@ -418,7 +418,7 @@ static void atl2_intr_rx(struct atl2_adapter *adapter)
418 * Check that some rx space is free. If not, 418 * Check that some rx space is free. If not,
419 * free one and mark stats->rx_dropped++. 419 * free one and mark stats->rx_dropped++.
420 */ 420 */
421 adapter->net_stats.rx_dropped++; 421 netdev->stats.rx_dropped++;
422 break; 422 break;
423 } 423 }
424 skb_reserve(skb, NET_IP_ALIGN); 424 skb_reserve(skb, NET_IP_ALIGN);
@@ -435,20 +435,20 @@ static void atl2_intr_rx(struct atl2_adapter *adapter)
435 } else 435 } else
436#endif 436#endif
437 netif_rx(skb); 437 netif_rx(skb);
438 adapter->net_stats.rx_bytes += rx_size; 438 netdev->stats.rx_bytes += rx_size;
439 adapter->net_stats.rx_packets++; 439 netdev->stats.rx_packets++;
440 netdev->last_rx = jiffies; 440 netdev->last_rx = jiffies;
441 } else { 441 } else {
442 adapter->net_stats.rx_errors++; 442 netdev->stats.rx_errors++;
443 443
444 if (rxd->status.ok && rxd->status.pkt_size <= 60) 444 if (rxd->status.ok && rxd->status.pkt_size <= 60)
445 adapter->net_stats.rx_length_errors++; 445 netdev->stats.rx_length_errors++;
446 if (rxd->status.mcast) 446 if (rxd->status.mcast)
447 adapter->net_stats.multicast++; 447 netdev->stats.multicast++;
448 if (rxd->status.crc) 448 if (rxd->status.crc)
449 adapter->net_stats.rx_crc_errors++; 449 netdev->stats.rx_crc_errors++;
450 if (rxd->status.align) 450 if (rxd->status.align)
451 adapter->net_stats.rx_frame_errors++; 451 netdev->stats.rx_frame_errors++;
452 } 452 }
453 453
454 /* advance write ptr */ 454 /* advance write ptr */
@@ -463,6 +463,7 @@ static void atl2_intr_rx(struct atl2_adapter *adapter)
463 463
464static void atl2_intr_tx(struct atl2_adapter *adapter) 464static void atl2_intr_tx(struct atl2_adapter *adapter)
465{ 465{
466 struct net_device *netdev = adapter->netdev;
466 u32 txd_read_ptr; 467 u32 txd_read_ptr;
467 u32 txs_write_ptr; 468 u32 txs_write_ptr;
468 struct tx_pkt_status *txs; 469 struct tx_pkt_status *txs;
@@ -522,20 +523,20 @@ static void atl2_intr_tx(struct atl2_adapter *adapter)
522 523
523 /* tx statistics: */ 524 /* tx statistics: */
524 if (txs->ok) { 525 if (txs->ok) {
525 adapter->net_stats.tx_bytes += txs->pkt_size; 526 netdev->stats.tx_bytes += txs->pkt_size;
526 adapter->net_stats.tx_packets++; 527 netdev->stats.tx_packets++;
527 } 528 }
528 else 529 else
529 adapter->net_stats.tx_errors++; 530 netdev->stats.tx_errors++;
530 531
531 if (txs->defer) 532 if (txs->defer)
532 adapter->net_stats.collisions++; 533 netdev->stats.collisions++;
533 if (txs->abort_col) 534 if (txs->abort_col)
534 adapter->net_stats.tx_aborted_errors++; 535 netdev->stats.tx_aborted_errors++;
535 if (txs->late_col) 536 if (txs->late_col)
536 adapter->net_stats.tx_window_errors++; 537 netdev->stats.tx_window_errors++;
537 if (txs->underun) 538 if (txs->underun)
538 adapter->net_stats.tx_fifo_errors++; 539 netdev->stats.tx_fifo_errors++;
539 } while (1); 540 } while (1);
540 541
541 if (free_hole) { 542 if (free_hole) {
@@ -621,7 +622,7 @@ static irqreturn_t atl2_intr(int irq, void *data)
621 622
622 /* link event */ 623 /* link event */
623 if (status & (ISR_PHY | ISR_MANUAL)) { 624 if (status & (ISR_PHY | ISR_MANUAL)) {
624 adapter->net_stats.tx_carrier_errors++; 625 adapter->netdev->stats.tx_carrier_errors++;
625 atl2_check_for_link(adapter); 626 atl2_check_for_link(adapter);
626 } 627 }
627 628
@@ -900,19 +901,6 @@ static int atl2_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
900} 901}
901 902
902/* 903/*
903 * atl2_get_stats - Get System Network Statistics
904 * @netdev: network interface device structure
905 *
906 * Returns the address of the device statistics structure.
907 * The statistics are actually updated from the timer callback.
908 */
909static struct net_device_stats *atl2_get_stats(struct net_device *netdev)
910{
911 struct atl2_adapter *adapter = netdev_priv(netdev);
912 return &adapter->net_stats;
913}
914
915/*
916 * atl2_change_mtu - Change the Maximum Transfer Unit 904 * atl2_change_mtu - Change the Maximum Transfer Unit
917 * @netdev: network interface device structure 905 * @netdev: network interface device structure
918 * @new_mtu: new value for maximum frame size 906 * @new_mtu: new value for maximum frame size
@@ -1050,16 +1038,18 @@ static void atl2_tx_timeout(struct net_device *netdev)
1050static void atl2_watchdog(unsigned long data) 1038static void atl2_watchdog(unsigned long data)
1051{ 1039{
1052 struct atl2_adapter *adapter = (struct atl2_adapter *) data; 1040 struct atl2_adapter *adapter = (struct atl2_adapter *) data;
1053 u32 drop_rxd, drop_rxs;
1054 unsigned long flags;
1055 1041
1056 if (!test_bit(__ATL2_DOWN, &adapter->flags)) { 1042 if (!test_bit(__ATL2_DOWN, &adapter->flags)) {
1043 u32 drop_rxd, drop_rxs;
1044 unsigned long flags;
1045
1057 spin_lock_irqsave(&adapter->stats_lock, flags); 1046 spin_lock_irqsave(&adapter->stats_lock, flags);
1058 drop_rxd = ATL2_READ_REG(&adapter->hw, REG_STS_RXD_OV); 1047 drop_rxd = ATL2_READ_REG(&adapter->hw, REG_STS_RXD_OV);
1059 drop_rxs = ATL2_READ_REG(&adapter->hw, REG_STS_RXS_OV); 1048 drop_rxs = ATL2_READ_REG(&adapter->hw, REG_STS_RXS_OV);
1060 adapter->net_stats.rx_over_errors += (drop_rxd+drop_rxs);
1061 spin_unlock_irqrestore(&adapter->stats_lock, flags); 1049 spin_unlock_irqrestore(&adapter->stats_lock, flags);
1062 1050
1051 adapter->netdev->stats.rx_over_errors += drop_rxd + drop_rxs;
1052
1063 /* Reset the timer */ 1053 /* Reset the timer */
1064 mod_timer(&adapter->watchdog_timer, jiffies + 4 * HZ); 1054 mod_timer(&adapter->watchdog_timer, jiffies + 4 * HZ);
1065 } 1055 }
@@ -1396,7 +1386,6 @@ static int __devinit atl2_probe(struct pci_dev *pdev,
1396 netdev->open = &atl2_open; 1386 netdev->open = &atl2_open;
1397 netdev->stop = &atl2_close; 1387 netdev->stop = &atl2_close;
1398 netdev->hard_start_xmit = &atl2_xmit_frame; 1388 netdev->hard_start_xmit = &atl2_xmit_frame;
1399 netdev->get_stats = &atl2_get_stats;
1400 netdev->set_multicast_list = &atl2_set_multi; 1389 netdev->set_multicast_list = &atl2_set_multi;
1401 netdev->set_mac_address = &atl2_set_mac; 1390 netdev->set_mac_address = &atl2_set_mac;
1402 netdev->change_mtu = &atl2_change_mtu; 1391 netdev->change_mtu = &atl2_change_mtu;