]> err.no Git - linux-2.6/commitdiff
[SCSI] lpfc 8.1.7: Add lpfc_sli_flush_mbox_queue() function
authorJames Smart <James.Smart@Emulex.Com>
Thu, 6 Jul 2006 19:50:43 +0000 (15:50 -0400)
committerJames Bottomley <jejb@mulgrave.il.steeleye.com>
Sun, 9 Jul 2006 15:48:38 +0000 (10:48 -0500)
Add lpfc_sli_flush_mbox_queue() function and use it in lpfc_offline() call
to avoid deadlock on thread block.

Signed-off-by: James Smart <James.Smart@emulex.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
drivers/scsi/lpfc/lpfc_crtn.h
drivers/scsi/lpfc/lpfc_init.c
drivers/scsi/lpfc/lpfc_sli.c

index ee22173fce43c664cc2a352b580d8984bf60f718..517e9e4dd461aa15f200ea7858315dbfa6d87ce0 100644 (file)
@@ -147,6 +147,7 @@ int lpfc_sli_hba_setup(struct lpfc_hba *);
 int lpfc_sli_hba_down(struct lpfc_hba *);
 int lpfc_sli_issue_mbox(struct lpfc_hba *, LPFC_MBOXQ_t *, uint32_t);
 int lpfc_sli_handle_mb_event(struct lpfc_hba *);
+int lpfc_sli_flush_mbox_queue(struct lpfc_hba *);
 int lpfc_sli_handle_slow_ring_event(struct lpfc_hba *,
                                    struct lpfc_sli_ring *, uint32_t);
 void lpfc_sli_def_mbox_cmpl(struct lpfc_hba *, LPFC_MBOXQ_t *);
index 2a81df0540223177114e3a1994894a75f52bb86e..ee591c107e1cbaab847d0a2905389607956d5272 100644 (file)
@@ -1353,6 +1353,7 @@ lpfc_offline(struct lpfc_hba * phba)
        psli = &phba->sli;
 
        lpfc_linkdown(phba);
+       lpfc_sli_flush_mbox_queue(phba);
 
        for (i = 0; i < psli->num_rings; i++) {
                pring = &psli->ring[i];
index 8193a384a9fb37e2627eb7946be11c8f98ef1e91..c441e37eb053631b46be62776b2f50ccc7f63e1f 100644 (file)
@@ -578,7 +578,7 @@ lpfc_sli_handle_mb_event(struct lpfc_hba * phba)
                        /* Stray Mailbox Interrupt, mbxCommand <cmd> mbxStatus
                           <status> */
                        lpfc_printf_log(phba,
-                                       KERN_ERR,
+                                       KERN_WARNING,
                                        LOG_MBOX | LOG_SLI,
                                        "%d:0304 Stray Mailbox Interrupt "
                                        "mbxCommand x%x mbxStatus x%x\n",
@@ -3085,6 +3085,24 @@ lpfc_sli_issue_mbox_wait(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmboxq,
        return retval;
 }
 
+int
+lpfc_sli_flush_mbox_queue(struct lpfc_hba * phba)
+{
+       int i = 0;
+
+       while (phba->sli.sli_flag & LPFC_SLI_MBOX_ACTIVE && !phba->stopped) {
+               if (i++ > LPFC_MBOX_TMO * 1000)
+                       return 1;
+
+               if (lpfc_sli_handle_mb_event(phba) == 0)
+                       i = 0;
+
+               msleep(1);
+       }
+
+       return (phba->sli.sli_flag & LPFC_SLI_MBOX_ACTIVE) ? 1 : 0;
+}
+
 irqreturn_t
 lpfc_intr_handler(int irq, void *dev_id, struct pt_regs * regs)
 {