Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
[linux-block.git] / drivers / net / via-rhine.c
index 45daba726b665fd753a1338244536595a00099f6..46eb618bbc90cf5bc011ccd8543935359c206afd 100644 (file)
@@ -388,7 +388,6 @@ struct rhine_private {
        long pioaddr;
        struct net_device *dev;
        struct napi_struct napi;
-       struct net_device_stats stats;
        spinlock_t lock;
 
        /* Frequently used values: keep some adjacent for cache effect. */
@@ -622,6 +621,7 @@ static const struct net_device_ops rhine_netdev_ops = {
        .ndo_start_xmit          = rhine_start_tx,
        .ndo_get_stats           = rhine_get_stats,
        .ndo_set_multicast_list  = rhine_set_rx_mode,
+       .ndo_change_mtu          = eth_change_mtu,
        .ndo_validate_addr       = eth_validate_addr,
        .ndo_set_mac_address     = eth_mac_addr,
        .ndo_do_ioctl            = netdev_ioctl,
@@ -1209,7 +1209,7 @@ static void rhine_tx_timeout(struct net_device *dev)
        enable_irq(rp->pdev->irq);
 
        dev->trans_start = jiffies;
-       rp->stats.tx_errors++;
+       dev->stats.tx_errors++;
        netif_wake_queue(dev);
 }
 
@@ -1226,7 +1226,7 @@ static int rhine_start_tx(struct sk_buff *skb, struct net_device *dev)
        entry = rp->cur_tx % TX_RING_SIZE;
 
        if (skb_padto(skb, ETH_ZLEN))
-               return 0;
+               return NETDEV_TX_OK;
 
        rp->tx_skbuff[entry] = skb;
 
@@ -1237,8 +1237,8 @@ static int rhine_start_tx(struct sk_buff *skb, struct net_device *dev)
                        /* packet too long, drop it */
                        dev_kfree_skb(skb);
                        rp->tx_skbuff[entry] = NULL;
-                       rp->stats.tx_dropped++;
-                       return 0;
+                       dev->stats.tx_dropped++;
+                       return NETDEV_TX_OK;
                }
 
                /* Padding is not copied and so must be redone. */
@@ -1286,7 +1286,7 @@ static int rhine_start_tx(struct sk_buff *skb, struct net_device *dev)
                printk(KERN_DEBUG "%s: Transmit frame #%d queued in slot %d.\n",
                       dev->name, rp->cur_tx-1, entry);
        }
-       return 0;
+       return NETDEV_TX_OK;
 }
 
 /* The interrupt handler does all of the Rx thread work and cleans up
@@ -1378,29 +1378,33 @@ static void rhine_tx(struct net_device *dev)
                                printk(KERN_DEBUG "%s: Transmit error, "
                                       "Tx status %8.8x.\n",
                                       dev->name, txstatus);
-                       rp->stats.tx_errors++;
-                       if (txstatus & 0x0400) rp->stats.tx_carrier_errors++;
-                       if (txstatus & 0x0200) rp->stats.tx_window_errors++;
-                       if (txstatus & 0x0100) rp->stats.tx_aborted_errors++;
-                       if (txstatus & 0x0080) rp->stats.tx_heartbeat_errors++;
+                       dev->stats.tx_errors++;
+                       if (txstatus & 0x0400)
+                               dev->stats.tx_carrier_errors++;
+                       if (txstatus & 0x0200)
+                               dev->stats.tx_window_errors++;
+                       if (txstatus & 0x0100)
+                               dev->stats.tx_aborted_errors++;
+                       if (txstatus & 0x0080)
+                               dev->stats.tx_heartbeat_errors++;
                        if (((rp->quirks & rqRhineI) && txstatus & 0x0002) ||
                            (txstatus & 0x0800) || (txstatus & 0x1000)) {
-                               rp->stats.tx_fifo_errors++;
+                               dev->stats.tx_fifo_errors++;
                                rp->tx_ring[entry].tx_status = cpu_to_le32(DescOwn);
                                break; /* Keep the skb - we try again */
                        }
                        /* Transmitter restarted in 'abnormal' handler. */
                } else {
                        if (rp->quirks & rqRhineI)
-                               rp->stats.collisions += (txstatus >> 3) & 0x0F;
+                               dev->stats.collisions += (txstatus >> 3) & 0x0F;
                        else
-                               rp->stats.collisions += txstatus & 0x0F;
+                               dev->stats.collisions += txstatus & 0x0F;
                        if (debug > 6)
                                printk(KERN_DEBUG "collisions: %1.1x:%1.1x\n",
                                       (txstatus >> 3) & 0xF,
                                       txstatus & 0xF);
-                       rp->stats.tx_bytes += rp->tx_skbuff[entry]->len;
-                       rp->stats.tx_packets++;
+                       dev->stats.tx_bytes += rp->tx_skbuff[entry]->len;
+                       dev->stats.tx_packets++;
                }
                /* Free the original skb. */
                if (rp->tx_skbuff_dma[entry]) {
@@ -1455,21 +1459,24 @@ static int rhine_rx(struct net_device *dev, int limit)
                                printk(KERN_WARNING "%s: Oversized Ethernet "
                                       "frame %p vs %p.\n", dev->name,
                                       rp->rx_head_desc, &rp->rx_ring[entry]);
-                               rp->stats.rx_length_errors++;
+                               dev->stats.rx_length_errors++;
                        } else if (desc_status & RxErr) {
                                /* There was a error. */
                                if (debug > 2)
                                        printk(KERN_DEBUG "rhine_rx() Rx "
                                               "error was %8.8x.\n",
                                               desc_status);
-                               rp->stats.rx_errors++;
-                               if (desc_status & 0x0030) rp->stats.rx_length_errors++;
-                               if (desc_status & 0x0048) rp->stats.rx_fifo_errors++;
-                               if (desc_status & 0x0004) rp->stats.rx_frame_errors++;
+                               dev->stats.rx_errors++;
+                               if (desc_status & 0x0030)
+                                       dev->stats.rx_length_errors++;
+                               if (desc_status & 0x0048)
+                                       dev->stats.rx_fifo_errors++;
+                               if (desc_status & 0x0004)
+                                       dev->stats.rx_frame_errors++;
                                if (desc_status & 0x0002) {
                                        /* this can also be updated outside the interrupt handler */
                                        spin_lock(&rp->lock);
-                                       rp->stats.rx_crc_errors++;
+                                       dev->stats.rx_crc_errors++;
                                        spin_unlock(&rp->lock);
                                }
                        }
@@ -1513,8 +1520,8 @@ static int rhine_rx(struct net_device *dev, int limit)
                        }
                        skb->protocol = eth_type_trans(skb, dev);
                        netif_receive_skb(skb);
-                       rp->stats.rx_bytes += pkt_len;
-                       rp->stats.rx_packets++;
+                       dev->stats.rx_bytes += pkt_len;
+                       dev->stats.rx_packets++;
                }
                entry = (++rp->cur_rx) % RX_RING_SIZE;
                rp->rx_head_desc = &rp->rx_ring[entry];
@@ -1599,8 +1606,8 @@ static void rhine_error(struct net_device *dev, int intr_status)
        if (intr_status & IntrLinkChange)
                rhine_check_media(dev, 0);
        if (intr_status & IntrStatsMax) {
-               rp->stats.rx_crc_errors += ioread16(ioaddr + RxCRCErrs);
-               rp->stats.rx_missed_errors += ioread16(ioaddr + RxMissed);
+               dev->stats.rx_crc_errors += ioread16(ioaddr + RxCRCErrs);
+               dev->stats.rx_missed_errors += ioread16(ioaddr + RxMissed);
                clear_tally_counters(ioaddr);
        }
        if (intr_status & IntrTxAborted) {
@@ -1654,12 +1661,12 @@ static struct net_device_stats *rhine_get_stats(struct net_device *dev)
        unsigned long flags;
 
        spin_lock_irqsave(&rp->lock, flags);
-       rp->stats.rx_crc_errors += ioread16(ioaddr + RxCRCErrs);
-       rp->stats.rx_missed_errors += ioread16(ioaddr + RxMissed);
+       dev->stats.rx_crc_errors += ioread16(ioaddr + RxCRCErrs);
+       dev->stats.rx_missed_errors += ioread16(ioaddr + RxMissed);
        clear_tally_counters(ioaddr);
        spin_unlock_irqrestore(&rp->lock, flags);
 
-       return &rp->stats;
+       return &dev->stats;
 }
 
 static void rhine_set_rx_mode(struct net_device *dev)