Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=6006f7f517b9a754e4c4628755c62872e322c68a
Commit:     6006f7f517b9a754e4c4628755c62872e322c68a
Parent:     a816c7c712ff9f6770168b91facb9bfa9f0acd48
Author:     Sergei Shtylyov <[EMAIL PROTECTED]>
AuthorDate: Tue Mar 6 00:10:08 2007 +0400
Committer:  Jeff Garzik <[EMAIL PROTECTED]>
CommitDate: Tue Mar 6 06:10:01 2007 -0500

    natsemi: netpoll fixes
    
    Fix two issues in this driver's netpoll path: one usual, with 
spin_unlock_irq()
    enabling interrupts which nobody asks it to do (that has been fixed 
recently in
    a number of drivers) and one unusual, with poll_controller() method possibly
    causing loss of interrupts due to the interrupt status register being 
cleared
    by a simple read and the interrpupt handler simply storing it, not 
accumulating.
    
    Signed-off-by: Sergei Shtylyov <[EMAIL PROTECTED]>
    Signed-off-by: Jeff Garzik <[EMAIL PROTECTED]>
---
 drivers/net/natsemi.c |   24 +++++++++++++++++++-----
 1 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/drivers/net/natsemi.c b/drivers/net/natsemi.c
index 5c57433..c6172a7 100644
--- a/drivers/net/natsemi.c
+++ b/drivers/net/natsemi.c
@@ -2024,6 +2024,7 @@ static int start_tx(struct sk_buff *skb, struct 
net_device *dev)
        struct netdev_private *np = netdev_priv(dev);
        void __iomem * ioaddr = ns_ioaddr(dev);
        unsigned entry;
+       unsigned long flags;
 
        /* Note: Ordering is important here, set the field with the
           "ownership" bit last, and only then increment cur_tx. */
@@ -2037,7 +2038,7 @@ static int start_tx(struct sk_buff *skb, struct 
net_device *dev)
 
        np->tx_ring[entry].addr = cpu_to_le32(np->tx_dma[entry]);
 
-       spin_lock_irq(&np->lock);
+       spin_lock_irqsave(&np->lock, flags);
 
        if (!np->hands_off) {
                np->tx_ring[entry].cmd_status = cpu_to_le32(DescOwn | skb->len);
@@ -2056,7 +2057,7 @@ static int start_tx(struct sk_buff *skb, struct 
net_device *dev)
                dev_kfree_skb_irq(skb);
                np->stats.tx_dropped++;
        }
-       spin_unlock_irq(&np->lock);
+       spin_unlock_irqrestore(&np->lock, flags);
 
        dev->trans_start = jiffies;
 
@@ -2222,6 +2223,8 @@ static void netdev_rx(struct net_device *dev, int 
*work_done, int work_to_do)
                pkt_len = (desc_status & DescSizeMask) - 4;
                if ((desc_status&(DescMore|DescPktOK|DescRxLong)) != DescPktOK){
                        if (desc_status & DescMore) {
+                               unsigned long flags;
+
                                if (netif_msg_rx_err(np))
                                        printk(KERN_WARNING
                                                "%s: Oversized(?) Ethernet "
@@ -2236,12 +2239,12 @@ static void netdev_rx(struct net_device *dev, int 
*work_done, int work_to_do)
                                 * reset procedure documented in
                                 * AN-1287. */
 
-                               spin_lock_irq(&np->lock);
+                               spin_lock_irqsave(&np->lock, flags);
                                reset_rx(dev);
                                reinit_rx(dev);
                                writel(np->ring_dma, ioaddr + RxRingPtr);
                                check_link(dev);
-                               spin_unlock_irq(&np->lock);
+                               spin_unlock_irqrestore(&np->lock, flags);
 
                                /* We'll enable RX on exit from this
                                 * function. */
@@ -2396,8 +2399,19 @@ static struct net_device_stats *get_stats(struct 
net_device *dev)
 #ifdef CONFIG_NET_POLL_CONTROLLER
 static void natsemi_poll_controller(struct net_device *dev)
 {
+       struct netdev_private *np = netdev_priv(dev);
+
        disable_irq(dev->irq);
-       intr_handler(dev->irq, dev);
+
+       /*
+        * A real interrupt might have already reached us at this point
+        * but NAPI might still haven't called us back.  As the interrupt
+        * status register is cleared by reading, we should prevent an
+        * interrupt loss in this case...
+        */
+       if (!np->intr_status)
+               intr_handler(dev->irq, dev);
+
        enable_irq(dev->irq);
 }
 #endif
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to