]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/net/sky2.c
sky2: backout NAPI reschedule
[linux-2.6-omap-h63xx.git] / drivers / net / sky2.c
index 6673ddf763a4d770f224a5630a4af3f685980785..76da74fbe859b16d44c1ca109c6b77bb747e8f82 100644 (file)
@@ -51,7 +51,7 @@
 #include "sky2.h"
 
 #define DRV_NAME               "sky2"
-#define DRV_VERSION            "1.1"
+#define DRV_VERSION            "1.2"
 #define PFX                    DRV_NAME " "
 
 /*
@@ -925,8 +925,7 @@ static inline struct sk_buff *sky2_alloc_skb(unsigned int size, gfp_t gfp_mask)
        skb = alloc_skb(size + RX_SKB_ALIGN, gfp_mask);
        if (likely(skb)) {
                unsigned long p = (unsigned long) skb->data;
-               skb_reserve(skb,
-                       ((p + RX_SKB_ALIGN - 1) & ~(RX_SKB_ALIGN - 1)) - p);
+               skb_reserve(skb, ALIGN(p, RX_SKB_ALIGN) - p);
        }
 
        return skb;
@@ -1686,13 +1685,12 @@ static void sky2_tx_timeout(struct net_device *dev)
 }
 
 
-#define roundup(x, y)   ((((x)+((y)-1))/(y))*(y))
 /* Want receive buffer size to be multiple of 64 bits
  * and incl room for vlan and truncation
  */
 static inline unsigned sky2_buf_size(int mtu)
 {
-       return roundup(mtu + ETH_HLEN + VLAN_HLEN, 8) + 8;
+       return ALIGN(mtu + ETH_HLEN + VLAN_HLEN, 8) + 8;
 }
 
 static int sky2_change_mtu(struct net_device *dev, int new_mtu)
@@ -2107,7 +2105,6 @@ static int sky2_poll(struct net_device *dev0, int *budget)
        int work_done = 0;
        u32 status = sky2_read32(hw, B0_Y2_SP_EISR);
 
- restart_poll:
        if (unlikely(status & ~Y2_IS_STAT_BMU)) {
                if (status & Y2_IS_HW_ERR)
                        sky2_hw_intr(hw);
@@ -2138,7 +2135,7 @@ static int sky2_poll(struct net_device *dev0, int *budget)
        }
 
        if (status & Y2_IS_STAT_BMU) {
-               work_done += sky2_status_intr(hw, work_limit - work_done);
+               work_done = sky2_status_intr(hw, work_limit);
                *budget -= work_done;
                dev0->quota -= work_done;
 
@@ -2150,22 +2147,9 @@ static int sky2_poll(struct net_device *dev0, int *budget)
 
        mod_timer(&hw->idle_timer, jiffies + HZ);
 
-       local_irq_disable();
-       __netif_rx_complete(dev0);
+       netif_rx_complete(dev0);
 
        status = sky2_read32(hw, B0_Y2_SP_LISR);
-
-       if (unlikely(status)) {
-               /* More work pending, try and keep going */
-               if (__netif_rx_schedule_prep(dev0)) {
-                       __netif_rx_reschedule(dev0, work_done);
-                       status = sky2_read32(hw, B0_Y2_SP_EISR);
-                       local_irq_enable();
-                       goto restart_poll;
-               }
-       }
-
-       local_irq_enable();
        return 0;
 }
 
@@ -2183,6 +2167,8 @@ static irqreturn_t sky2_intr(int irq, void *dev_id, struct pt_regs *regs)
        prefetch(&hw->st_le[hw->st_idx]);
        if (likely(__netif_rx_schedule_prep(dev0)))
                __netif_rx_schedule(dev0);
+       else
+               printk(KERN_DEBUG PFX "irq race detected\n");
 
        return IRQ_HANDLED;
 }
@@ -2221,7 +2207,7 @@ static inline u32 sky2_clk2us(const struct sky2_hw *hw, u32 clk)
 }
 
 
-static int sky2_reset(struct sky2_hw *hw)
+static int __devinit sky2_reset(struct sky2_hw *hw)
 {
        u16 status;
        u8 t8, pmd_type;