netdev: bfin_mac: add support for IEEE 1588 PTP
[safe/jmp/linux-2.6] / drivers / net / 82596.c
index ea6b139..dd8dc15 100644 (file)
@@ -19,7 +19,7 @@
    TBD:
    * look at deferring rx frames rather than discarding (as per tulip)
    * handle tx ring full as per tulip
-   * performace test to tune rx_copybreak
+   * performance test to tune rx_copybreak
 
    Most of my modifications relate to the braindead big-endian
    implementation by Intel.  When the i596 is operating in
@@ -45,7 +45,6 @@
 #include <linux/string.h>
 #include <linux/errno.h>
 #include <linux/ioport.h>
-#include <linux/slab.h>
 #include <linux/interrupt.h>
 #include <linux/delay.h>
 #include <linux/netdevice.h>
@@ -53,6 +52,7 @@
 #include <linux/skbuff.h>
 #include <linux/init.h>
 #include <linux/bitops.h>
+#include <linux/gfp.h>
 
 #include <asm/io.h>
 #include <asm/dma.h>
@@ -1050,7 +1050,7 @@ static void i596_tx_timeout (struct net_device *dev)
                lp->last_restart = dev->stats.tx_packets;
        }
 
-       dev->trans_start = jiffies;
+       dev->trans_start = jiffies; /* prevent tx timeout */
        netif_wake_queue (dev);
 }
 
@@ -1060,7 +1060,6 @@ static netdev_tx_t i596_start_xmit(struct sk_buff *skb, struct net_device *dev)
        struct tx_cmd *tx_cmd;
        struct i596_tbd *tbd;
        short length = skb->len;
-       dev->trans_start = jiffies;
 
        DEB(DEB_STARTTX,printk(KERN_DEBUG "%s: i596_start_xmit(%x,%p) called\n",
                                dev->name, skb->len, skb->data));
@@ -1505,7 +1504,7 @@ static void set_multicast_list(struct net_device *dev)
        int config = 0, cnt;
 
        DEB(DEB_MULTI,printk(KERN_DEBUG "%s: set multicast list, %d entries, promisc %s, allmulti %s\n",
-               dev->name, dev->mc_count,
+               dev->name, netdev_mc_count(dev),
                dev->flags & IFF_PROMISC  ? "ON" : "OFF",
                dev->flags & IFF_ALLMULTI ? "ON" : "OFF"));
 
@@ -1533,7 +1532,7 @@ static void set_multicast_list(struct net_device *dev)
                i596_add_cmd(dev, &lp->cf_cmd.cmd);
        }
 
-       cnt = dev->mc_count;
+       cnt = netdev_mc_count(dev);
        if (cnt > MAX_MC_CNT)
        {
                cnt = MAX_MC_CNT;
@@ -1541,8 +1540,8 @@ static void set_multicast_list(struct net_device *dev)
                        dev->name, cnt);
        }
 
-       if (dev->mc_count > 0) {
-               struct dev_mc_list *dmi;
+       if (!netdev_mc_empty(dev)) {
+               struct netdev_hw_addr *ha;
                unsigned char *cp;
                struct mc_cmd *cmd;
 
@@ -1550,13 +1549,16 @@ static void set_multicast_list(struct net_device *dev)
                        return;
                cmd = &lp->mc_cmd;
                cmd->cmd.command = CmdMulticastList;
-               cmd->mc_cnt = dev->mc_count * 6;
+               cmd->mc_cnt = cnt * ETH_ALEN;
                cp = cmd->mc_addrs;
-               for (dmi = dev->mc_list; cnt && dmi != NULL; dmi = dmi->next, cnt--, cp += 6) {
-                       memcpy(cp, dmi->dmi_addr, 6);
+               netdev_for_each_mc_addr(ha, dev) {
+                       if (!cnt--)
+                               break;
+                       memcpy(cp, ha->addr, ETH_ALEN);
                        if (i596_debug > 1)
                                DEB(DEB_MULTI,printk(KERN_INFO "%s: Adding address %pM\n",
                                                dev->name, cp));
+                       cp += ETH_ALEN;
                }
                i596_add_cmd(dev, &cmd->cmd);
        }