Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
[pandora-kernel.git] / drivers / net / atlx / atl2.c
index 8571e8c..b8d5857 100644 (file)
@@ -418,7 +418,7 @@ static void atl2_intr_rx(struct atl2_adapter *adapter)
                                 * Check that some rx space is free. If not,
                                 * free one and mark stats->rx_dropped++.
                                 */
-                               adapter->net_stats.rx_dropped++;
+                               netdev->stats.rx_dropped++;
                                break;
                        }
                        skb_reserve(skb, NET_IP_ALIGN);
@@ -435,20 +435,19 @@ static void atl2_intr_rx(struct atl2_adapter *adapter)
                        } else
 #endif
                        netif_rx(skb);
-                       adapter->net_stats.rx_bytes += rx_size;
-                       adapter->net_stats.rx_packets++;
-                       netdev->last_rx = jiffies;
+                       netdev->stats.rx_bytes += rx_size;
+                       netdev->stats.rx_packets++;
                } else {
-                       adapter->net_stats.rx_errors++;
+                       netdev->stats.rx_errors++;
 
                        if (rxd->status.ok && rxd->status.pkt_size <= 60)
-                               adapter->net_stats.rx_length_errors++;
+                               netdev->stats.rx_length_errors++;
                        if (rxd->status.mcast)
-                               adapter->net_stats.multicast++;
+                               netdev->stats.multicast++;
                        if (rxd->status.crc)
-                               adapter->net_stats.rx_crc_errors++;
+                               netdev->stats.rx_crc_errors++;
                        if (rxd->status.align)
-                               adapter->net_stats.rx_frame_errors++;
+                               netdev->stats.rx_frame_errors++;
                }
 
                /* advance write ptr */
@@ -463,6 +462,7 @@ static void atl2_intr_rx(struct atl2_adapter *adapter)
 
 static void atl2_intr_tx(struct atl2_adapter *adapter)
 {
+       struct net_device *netdev = adapter->netdev;
        u32 txd_read_ptr;
        u32 txs_write_ptr;
        struct tx_pkt_status *txs;
@@ -522,20 +522,20 @@ static void atl2_intr_tx(struct atl2_adapter *adapter)
 
                /* tx statistics: */
                if (txs->ok) {
-                       adapter->net_stats.tx_bytes += txs->pkt_size;
-                       adapter->net_stats.tx_packets++;
+                       netdev->stats.tx_bytes += txs->pkt_size;
+                       netdev->stats.tx_packets++;
                }
                else
-                       adapter->net_stats.tx_errors++;
+                       netdev->stats.tx_errors++;
 
                if (txs->defer)
-                       adapter->net_stats.collisions++;
+                       netdev->stats.collisions++;
                if (txs->abort_col)
-                       adapter->net_stats.tx_aborted_errors++;
+                       netdev->stats.tx_aborted_errors++;
                if (txs->late_col)
-                       adapter->net_stats.tx_window_errors++;
+                       netdev->stats.tx_window_errors++;
                if (txs->underun)
-                       adapter->net_stats.tx_fifo_errors++;
+                       netdev->stats.tx_fifo_errors++;
        } while (1);
 
        if (free_hole) {
@@ -621,7 +621,7 @@ static irqreturn_t atl2_intr(int irq, void *data)
 
        /* link event */
        if (status & (ISR_PHY | ISR_MANUAL)) {
-               adapter->net_stats.tx_carrier_errors++;
+               adapter->netdev->stats.tx_carrier_errors++;
                atl2_check_for_link(adapter);
        }
 
@@ -723,7 +723,7 @@ static int atl2_open(struct net_device *netdev)
 
        clear_bit(__ATL2_DOWN, &adapter->flags);
 
-       mod_timer(&adapter->watchdog_timer, jiffies + 4*HZ);
+       mod_timer(&adapter->watchdog_timer, round_jiffies(jiffies + 4*HZ));
 
        val = ATL2_READ_REG(&adapter->hw, REG_MASTER_CTRL);
        ATL2_WRITE_REG(&adapter->hw, REG_MASTER_CTRL,
@@ -899,19 +899,6 @@ static int atl2_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
        return NETDEV_TX_OK;
 }
 
-/*
- * atl2_get_stats - Get System Network Statistics
- * @netdev: network interface device structure
- *
- * Returns the address of the device statistics structure.
- * The statistics are actually updated from the timer callback.
- */
-static struct net_device_stats *atl2_get_stats(struct net_device *netdev)
-{
-       struct atl2_adapter *adapter = netdev_priv(netdev);
-       return &adapter->net_stats;
-}
-
 /*
  * atl2_change_mtu - Change the Maximum Transfer Unit
  * @netdev: network interface device structure
@@ -1050,18 +1037,21 @@ static void atl2_tx_timeout(struct net_device *netdev)
 static void atl2_watchdog(unsigned long data)
 {
        struct atl2_adapter *adapter = (struct atl2_adapter *) data;
-       u32 drop_rxd, drop_rxs;
-       unsigned long flags;
 
        if (!test_bit(__ATL2_DOWN, &adapter->flags)) {
+               u32 drop_rxd, drop_rxs;
+               unsigned long flags;
+
                spin_lock_irqsave(&adapter->stats_lock, flags);
                drop_rxd = ATL2_READ_REG(&adapter->hw, REG_STS_RXD_OV);
                drop_rxs = ATL2_READ_REG(&adapter->hw, REG_STS_RXS_OV);
-               adapter->net_stats.rx_over_errors += (drop_rxd+drop_rxs);
                spin_unlock_irqrestore(&adapter->stats_lock, flags);
 
+               adapter->netdev->stats.rx_over_errors += drop_rxd + drop_rxs;
+
                /* Reset the timer */
-               mod_timer(&adapter->watchdog_timer, jiffies + 4 * HZ);
+               mod_timer(&adapter->watchdog_timer,
+                         round_jiffies(jiffies + 4 * HZ));
        }
 }
 
@@ -1265,7 +1255,8 @@ static int atl2_check_link(struct atl2_adapter *adapter)
         * (if interval smaller than 5 seconds, something strange) */
        if (!test_bit(__ATL2_DOWN, &adapter->flags)) {
                if (!test_and_set_bit(0, &adapter->cfg_phy))
-                       mod_timer(&adapter->phy_config_timer, jiffies + 5 * HZ);
+                       mod_timer(&adapter->phy_config_timer,
+                                 round_jiffies(jiffies + 5 * HZ));
        }
 
        return 0;
@@ -1320,6 +1311,22 @@ static void atl2_poll_controller(struct net_device *netdev)
 }
 #endif
 
+
+static const struct net_device_ops atl2_netdev_ops = {
+       .ndo_open               = atl2_open,
+       .ndo_stop               = atl2_close,
+       .ndo_set_multicast_list = atl2_set_multi,
+       .ndo_validate_addr      = eth_validate_addr,
+       .ndo_set_mac_address    = atl2_set_mac,
+       .ndo_change_mtu         = atl2_change_mtu,
+       .ndo_do_ioctl           = atl2_ioctl,
+       .ndo_tx_timeout         = atl2_tx_timeout,
+       .ndo_vlan_rx_register   = atl2_vlan_rx_register,
+#ifdef CONFIG_NET_POLL_CONTROLLER
+       .ndo_poll_controller    = atl2_poll_controller,
+#endif
+};
+
 /*
  * atl2_probe - Device Initialization Routine
  * @pdev: PCI device information struct
@@ -1393,26 +1400,10 @@ static int __devinit atl2_probe(struct pci_dev *pdev,
 
        atl2_setup_pcicmd(pdev);
 
-       netdev->open = &atl2_open;
-       netdev->stop = &atl2_close;
        netdev->hard_start_xmit = &atl2_xmit_frame;
-       netdev->get_stats = &atl2_get_stats;
-       netdev->set_multicast_list = &atl2_set_multi;
-       netdev->set_mac_address = &atl2_set_mac;
-       netdev->change_mtu = &atl2_change_mtu;
-       netdev->do_ioctl = &atl2_ioctl;
+       netdev->netdev_ops = &atl2_netdev_ops;
        atl2_set_ethtool_ops(netdev);
-
-#ifdef CONFIG_NET_POLL_CONTROLLER
-       netdev->poll_controller = atl2_poll_controller;
-#endif
-#ifdef HAVE_TX_TIMEOUT
-       netdev->tx_timeout = &atl2_tx_timeout;
        netdev->watchdog_timeo = 5 * HZ;
-#endif
-#ifdef NETIF_F_HW_VLAN_TX
-       netdev->vlan_rx_register = atl2_vlan_rx_register;
-#endif
        strncpy(netdev->name, pci_name(pdev), sizeof(netdev->name) - 1);
 
        netdev->mem_start = mmio_start;