net: congestion notifications are not dropped packets
[safe/jmp/linux-2.6] / drivers / net / fealnx.c
index f66da84..15f4f8d 100644 (file)
@@ -74,7 +74,6 @@ static int full_duplex[MAX_UNITS] = { -1, -1, -1, -1, -1, -1, -1, -1 };
 #include <linux/timer.h>
 #include <linux/errno.h>
 #include <linux/ioport.h>
-#include <linux/slab.h>
 #include <linux/interrupt.h>
 #include <linux/pci.h>
 #include <linux/netdevice.h>
@@ -433,7 +432,7 @@ static void netdev_timer(unsigned long data);
 static void reset_timer(unsigned long data);
 static void fealnx_tx_timeout(struct net_device *dev);
 static void init_ring(struct net_device *dev);
-static int start_tx(struct sk_buff *skb, struct net_device *dev);
+static netdev_tx_t start_tx(struct sk_buff *skb, struct net_device *dev);
 static irqreturn_t intr_handler(int irq, void *dev_instance);
 static int netdev_rx(struct net_device *dev);
 static void set_rx_mode(struct net_device *dev);
@@ -839,7 +838,7 @@ static int netdev_open(struct net_device *dev)
 
        iowrite32(0x00000001, ioaddr + BCR);    /* Reset */
 
-       if (request_irq(dev->irq, &intr_handler, IRQF_SHARED, dev->name, dev))
+       if (request_irq(dev->irq, intr_handler, IRQF_SHARED, dev->name, dev))
                return -EAGAIN;
 
        for (i = 0; i < 3; i++)
@@ -1234,7 +1233,7 @@ static void fealnx_tx_timeout(struct net_device *dev)
 
        spin_unlock_irqrestore(&np->lock, flags);
 
-       dev->trans_start = jiffies;
+       dev->trans_start = jiffies; /* prevent tx timeout */
        np->stats.tx_errors++;
        netif_wake_queue(dev); /* or .._start_.. ?? */
 }
@@ -1305,7 +1304,7 @@ static void init_ring(struct net_device *dev)
 }
 
 
-static int start_tx(struct sk_buff *skb, struct net_device *dev)
+static netdev_tx_t start_tx(struct sk_buff *skb, struct net_device *dev)
 {
        struct netdev_private *np = netdev_priv(dev);
        unsigned long flags;
@@ -1375,7 +1374,6 @@ static int start_tx(struct sk_buff *skb, struct net_device *dev)
                netif_stop_queue(dev);
        ++np->really_tx_count;
        iowrite32(0, np->mem + TXPDR);
-       dev->trans_start = jiffies;
 
        spin_unlock_irqrestore(&np->lock, flags);
        return NETDEV_TX_OK;
@@ -1629,8 +1627,8 @@ static int netdev_rx(struct net_device *dev)
                if (debug)
                        printk(KERN_DEBUG "  netdev_rx() status was %8.8x.\n", rx_status);
 
-               if ((!((rx_status & RXFSD) && (rx_status & RXLSD)))
-                   || (rx_status & ErrorSummary)) {
+               if ((!((rx_status & RXFSD) && (rx_status & RXLSD))) ||
+                   (rx_status & ErrorSummary)) {
                        if (rx_status & ErrorSummary) { /* there was a fatal error */
                                if (debug)
                                        printk(KERN_DEBUG
@@ -1655,8 +1653,8 @@ static int netdev_rx(struct net_device *dev)
                                        cur = np->cur_rx;
                                        while (desno <= np->really_rx_count) {
                                                ++desno;
-                                               if ((!(cur->status & RXOWN))
-                                                   && (cur->status & RXLSD))
+                                               if ((!(cur->status & RXOWN)) &&
+                                                   (cur->status & RXLSD))
                                                        break;
                                                /* goto next rx descriptor */
                                                cur = cur->next_desc_logical;
@@ -1786,20 +1784,18 @@ static void __set_rx_mode(struct net_device *dev)
        if (dev->flags & IFF_PROMISC) { /* Set promiscuous. */
                memset(mc_filter, 0xff, sizeof(mc_filter));
                rx_mode = CR_W_PROM | CR_W_AB | CR_W_AM;
-       } else if ((dev->mc_count > multicast_filter_limit)
-                  || (dev->flags & IFF_ALLMULTI)) {
+       } else if ((netdev_mc_count(dev) > multicast_filter_limit) ||
+                  (dev->flags & IFF_ALLMULTI)) {
                /* Too many to match, or accept all multicasts. */
                memset(mc_filter, 0xff, sizeof(mc_filter));
                rx_mode = CR_W_AB | CR_W_AM;
        } else {
-               struct dev_mc_list *mclist;
-               int i;
+               struct netdev_hw_addr *ha;
 
                memset(mc_filter, 0, sizeof(mc_filter));
-               for (i = 0, mclist = dev->mc_list; mclist && i < dev->mc_count;
-                    i++, mclist = mclist->next) {
+               netdev_for_each_mc_addr(ha, dev) {
                        unsigned int bit;
-                       bit = (ether_crc(ETH_ALEN, mclist->dmi_addr) >> 26) ^ 0x3F;
+                       bit = (ether_crc(ETH_ALEN, ha->addr) >> 26) ^ 0x3F;
                        mc_filter[bit >> 5] |= (1 << bit);
                }
                rx_mode = CR_W_AB | CR_W_AM;
@@ -1941,7 +1937,7 @@ static int netdev_close(struct net_device *dev)
        return 0;
 }
 
-static struct pci_device_id fealnx_pci_tbl[] = {
+static DEFINE_PCI_DEVICE_TABLE(fealnx_pci_tbl) = {
        {0x1516, 0x0800, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
        {0x1516, 0x0803, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 1},
        {0x1516, 0x0891, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 2},