[XFS] Fix merge failures
[pandora-kernel.git] / drivers / net / bnx2.c
index 182f241..d4a3dac 100644 (file)
@@ -57,8 +57,8 @@
 
 #define DRV_MODULE_NAME                "bnx2"
 #define PFX DRV_MODULE_NAME    ": "
-#define DRV_MODULE_VERSION     "1.8.2"
-#define DRV_MODULE_RELDATE     "Nov 10, 2008"
+#define DRV_MODULE_VERSION     "1.9.0"
+#define DRV_MODULE_RELDATE     "Dec 16, 2008"
 
 #define RUN_AT(x) (jiffies + (x))
 
@@ -131,7 +131,7 @@ static DEFINE_PCI_DEVICE_TABLE(bnx2_pci_tbl) = {
        { PCI_VENDOR_ID_BROADCOM, 0x163b,
          PCI_ANY_ID, PCI_ANY_ID, 0, 0, BCM5716 },
        { PCI_VENDOR_ID_BROADCOM, 0x163c,
-         PCI_ANY_ID, PCI_ANY_ID, 0, 0, BCM5716 },
+         PCI_ANY_ID, PCI_ANY_ID, 0, 0, BCM5716S },
        { 0, }
 };
 
@@ -547,9 +547,9 @@ bnx2_free_rx_mem(struct bnx2 *bp)
                for (j = 0; j < bp->rx_max_pg_ring; j++) {
                        if (rxr->rx_pg_desc_ring[j])
                                pci_free_consistent(bp->pdev, RXBD_RING_SIZE,
-                                                   rxr->rx_pg_desc_ring[i],
-                                                   rxr->rx_pg_desc_mapping[i]);
-                       rxr->rx_pg_desc_ring[i] = NULL;
+                                                   rxr->rx_pg_desc_ring[j],
+                                                   rxr->rx_pg_desc_mapping[j]);
+                       rxr->rx_pg_desc_ring[j] = NULL;
                }
                if (rxr->rx_pg_ring)
                        vfree(rxr->rx_pg_ring);
@@ -3043,7 +3043,6 @@ bnx2_msi(int irq, void *dev_instance)
 {
        struct bnx2_napi *bnapi = dev_instance;
        struct bnx2 *bp = bnapi->bp;
-       struct net_device *dev = bp->dev;
 
        prefetch(bnapi->status_blk.msi);
        REG_WR(bp, BNX2_PCICFG_INT_ACK_CMD,
@@ -3054,7 +3053,7 @@ bnx2_msi(int irq, void *dev_instance)
        if (unlikely(atomic_read(&bp->intr_sem) != 0))
                return IRQ_HANDLED;
 
-       netif_rx_schedule(dev, &bnapi->napi);
+       netif_rx_schedule(&bnapi->napi);
 
        return IRQ_HANDLED;
 }
@@ -3064,7 +3063,6 @@ bnx2_msi_1shot(int irq, void *dev_instance)
 {
        struct bnx2_napi *bnapi = dev_instance;
        struct bnx2 *bp = bnapi->bp;
-       struct net_device *dev = bp->dev;
 
        prefetch(bnapi->status_blk.msi);
 
@@ -3072,7 +3070,7 @@ bnx2_msi_1shot(int irq, void *dev_instance)
        if (unlikely(atomic_read(&bp->intr_sem) != 0))
                return IRQ_HANDLED;
 
-       netif_rx_schedule(dev, &bnapi->napi);
+       netif_rx_schedule(&bnapi->napi);
 
        return IRQ_HANDLED;
 }
@@ -3082,7 +3080,6 @@ bnx2_interrupt(int irq, void *dev_instance)
 {
        struct bnx2_napi *bnapi = dev_instance;
        struct bnx2 *bp = bnapi->bp;
-       struct net_device *dev = bp->dev;
        struct status_block *sblk = bnapi->status_blk.msi;
 
        /* When using INTx, it is possible for the interrupt to arrive
@@ -3109,9 +3106,9 @@ bnx2_interrupt(int irq, void *dev_instance)
        if (unlikely(atomic_read(&bp->intr_sem) != 0))
                return IRQ_HANDLED;
 
-       if (netif_rx_schedule_prep(dev, &bnapi->napi)) {
+       if (netif_rx_schedule_prep(&bnapi->napi)) {
                bnapi->last_status_idx = sblk->status_idx;
-               __netif_rx_schedule(dev, &bnapi->napi);
+               __netif_rx_schedule(&bnapi->napi);
        }
 
        return IRQ_HANDLED;
@@ -3147,6 +3144,28 @@ bnx2_has_work(struct bnx2_napi *bnapi)
        return 0;
 }
 
+static void
+bnx2_chk_missed_msi(struct bnx2 *bp)
+{
+       struct bnx2_napi *bnapi = &bp->bnx2_napi[0];
+       u32 msi_ctrl;
+
+       if (bnx2_has_work(bnapi)) {
+               msi_ctrl = REG_RD(bp, BNX2_PCICFG_MSI_CONTROL);
+               if (!(msi_ctrl & BNX2_PCICFG_MSI_CONTROL_ENABLE))
+                       return;
+
+               if (bnapi->last_status_idx == bp->idle_chk_status_idx) {
+                       REG_WR(bp, BNX2_PCICFG_MSI_CONTROL, msi_ctrl &
+                              ~BNX2_PCICFG_MSI_CONTROL_ENABLE);
+                       REG_WR(bp, BNX2_PCICFG_MSI_CONTROL, msi_ctrl);
+                       bnx2_msi(bp->irq_tbl[0].vector, bnapi);
+               }
+       }
+
+       bp->idle_chk_status_idx = bnapi->last_status_idx;
+}
+
 static void bnx2_poll_link(struct bnx2 *bp, struct bnx2_napi *bnapi)
 {
        struct status_block *sblk = bnapi->status_blk.msi;
@@ -3199,7 +3218,7 @@ static int bnx2_poll_msix(struct napi_struct *napi, int budget)
                rmb();
                if (likely(!bnx2_has_fast_work(bnapi))) {
 
-                       netif_rx_complete(bp->dev, napi);
+                       netif_rx_complete(napi);
                        REG_WR(bp, BNX2_PCICFG_INT_ACK_CMD, bnapi->int_num |
                               BNX2_PCICFG_INT_ACK_CMD_INDEX_VALID |
                               bnapi->last_status_idx);
@@ -3221,17 +3240,18 @@ static int bnx2_poll(struct napi_struct *napi, int budget)
 
                work_done = bnx2_poll_work(bp, bnapi, work_done, budget);
 
-               if (unlikely(work_done >= budget))
-                       break;
-
                /* bnapi->last_status_idx is used below to tell the hw how
                 * much work has been processed, so we must read it before
                 * checking for more work.
                 */
                bnapi->last_status_idx = sblk->status_idx;
+
+               if (unlikely(work_done >= budget))
+                       break;
+
                rmb();
                if (likely(!bnx2_has_work(bnapi))) {
-                       netif_rx_complete(bp->dev, napi);
+                       netif_rx_complete(napi);
                        if (likely(bp->flags & BNX2_FLAG_USING_MSI_OR_MSIX)) {
                                REG_WR(bp, BNX2_PCICFG_INT_ACK_CMD,
                                       BNX2_PCICFG_INT_ACK_CMD_INDEX_VALID |
@@ -4581,6 +4601,8 @@ bnx2_init_chip(struct bnx2 *bp)
        for (i = 0; i < BNX2_MAX_MSIX_VEC; i++)
                bp->bnx2_napi[i].last_status_idx = 0;
 
+       bp->idle_chk_status_idx = 0xffff;
+
        bp->rx_mode = BNX2_EMAC_RX_MODE_SORT_MODE;
 
        /* Set up how to generate a link change interrupt. */
@@ -5729,6 +5751,10 @@ bnx2_timer(unsigned long data)
        if (atomic_read(&bp->intr_sem) != 0)
                goto bnx2_restart_timer;
 
+       if ((bp->flags & (BNX2_FLAG_USING_MSI | BNX2_FLAG_ONE_SHOT_MSI)) ==
+            BNX2_FLAG_USING_MSI)
+               bnx2_chk_missed_msi(bp);
+
        bnx2_send_heart_beat(bp);
 
        bp->stats_blk->stat_FwRxDrop =
@@ -5798,6 +5824,8 @@ bnx2_enable_msix(struct bnx2 *bp, int msix_vecs)
 {
        int i, rc;
        struct msix_entry msix_ent[BNX2_MAX_MSIX_VEC];
+       struct net_device *dev = bp->dev;
+       const int len = sizeof(bp->irq_tbl[0].name);
 
        bnx2_setup_msix_tbl(bp);
        REG_WR(bp, BNX2_PCI_MSIX_CONTROL, BNX2_MAX_MSIX_HW_VEC - 1);
@@ -5808,7 +5836,7 @@ bnx2_enable_msix(struct bnx2 *bp, int msix_vecs)
                msix_ent[i].entry = i;
                msix_ent[i].vector = 0;
 
-               strcpy(bp->irq_tbl[i].name, bp->dev->name);
+               snprintf(bp->irq_tbl[i].name, len, "%s-%d", dev->name, i);
                bp->irq_tbl[i].handler = bnx2_msi_1shot;
        }