aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/lpfc/lpfc_init.c
diff options
context:
space:
mode:
authorJames Bottomley <jejb@mulgrave.(none)>2005-10-29 11:28:33 -0400
committerJames Bottomley <jejb@mulgrave.(none)>2005-10-29 11:28:33 -0400
commit604a3e3042eb89ffaa4f735ef9208281aae786c7 (patch)
tree54c4ad58274b0bb79386c6c57b4849bfb92d4118 /drivers/scsi/lpfc/lpfc_init.c
parent21568f5387636fe2bfb9ee42383d76de11ed99c7 (diff)
[SCSI] lpfc: Fix for "command completion for iotax x?? not found"
From: James Smart <James.Smart@emulex.com> There were scenarios where the error handlers could reuse an iotag value of an active io. Remove all possibility of this by pre-assigning iotag resources to command resources. Signed-off-by: James Smart <James.Smart@emulex.com> Rejections fixed up and Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi/lpfc/lpfc_init.c')
-rw-r--r--drivers/scsi/lpfc/lpfc_init.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
index e591611f98e2..59e244f04c32 100644
--- a/drivers/scsi/lpfc/lpfc_init.c
+++ b/drivers/scsi/lpfc/lpfc_init.c
@@ -886,7 +886,6 @@ lpfc_post_buffer(struct lpfc_hba * phba, struct lpfc_sli_ring * pring, int cnt,
886 pring->missbufcnt = cnt; 886 pring->missbufcnt = cnt;
887 return cnt; 887 return cnt;
888 } 888 }
889 memset(iocb, 0, sizeof (struct lpfc_iocbq));
890 icmd = &iocb->iocb; 889 icmd = &iocb->iocb;
891 890
892 /* 2 buffers can be posted per command */ 891 /* 2 buffers can be posted per command */
@@ -899,7 +898,7 @@ lpfc_post_buffer(struct lpfc_hba * phba, struct lpfc_sli_ring * pring, int cnt,
899 if (mp1) 898 if (mp1)
900 kfree(mp1); 899 kfree(mp1);
901 spin_lock_irq(phba->host->host_lock); 900 spin_lock_irq(phba->host->host_lock);
902 list_add_tail(&iocb->list, lpfc_iocb_list); 901 lpfc_sli_release_iocbq(phba, iocb);
903 spin_unlock_irq(phba->host->host_lock); 902 spin_unlock_irq(phba->host->host_lock);
904 pring->missbufcnt = cnt; 903 pring->missbufcnt = cnt;
905 return cnt; 904 return cnt;
@@ -918,7 +917,7 @@ lpfc_post_buffer(struct lpfc_hba * phba, struct lpfc_sli_ring * pring, int cnt,
918 lpfc_mbuf_free(phba, mp1->virt, mp1->phys); 917 lpfc_mbuf_free(phba, mp1->virt, mp1->phys);
919 kfree(mp1); 918 kfree(mp1);
920 spin_lock_irq(phba->host->host_lock); 919 spin_lock_irq(phba->host->host_lock);
921 list_add_tail(&iocb->list, lpfc_iocb_list); 920 lpfc_sli_release_iocbq(phba, iocb);
922 spin_unlock_irq(phba->host->host_lock); 921 spin_unlock_irq(phba->host->host_lock);
923 pring->missbufcnt = cnt; 922 pring->missbufcnt = cnt;
924 return cnt; 923 return cnt;
@@ -955,7 +954,7 @@ lpfc_post_buffer(struct lpfc_hba * phba, struct lpfc_sli_ring * pring, int cnt,
955 kfree(mp2); 954 kfree(mp2);
956 cnt++; 955 cnt++;
957 } 956 }
958 list_add_tail(&iocb->list, lpfc_iocb_list); 957 lpfc_sli_release_iocbq(phba, iocb);
959 pring->missbufcnt = cnt; 958 pring->missbufcnt = cnt;
960 spin_unlock_irq(phba->host->host_lock); 959 spin_unlock_irq(phba->host->host_lock);
961 return cnt; 960 return cnt;
@@ -1328,6 +1327,7 @@ lpfc_pci_probe_one(struct pci_dev *pdev, const struct pci_device_id *pid)
1328 unsigned long bar0map_len, bar2map_len; 1327 unsigned long bar0map_len, bar2map_len;
1329 int error = -ENODEV, retval; 1328 int error = -ENODEV, retval;
1330 int i; 1329 int i;
1330 uint16_t iotag;
1331 1331
1332 if (pci_enable_device(pdev)) 1332 if (pci_enable_device(pdev))
1333 goto out; 1333 goto out;
@@ -1452,6 +1452,15 @@ lpfc_pci_probe_one(struct pci_dev *pdev, const struct pci_device_id *pid)
1452 } 1452 }
1453 1453
1454 memset(iocbq_entry, 0, sizeof(struct lpfc_iocbq)); 1454 memset(iocbq_entry, 0, sizeof(struct lpfc_iocbq));
1455 iotag = lpfc_sli_next_iotag(phba, iocbq_entry);
1456 if (iotag == 0) {
1457 kfree (iocbq_entry);
1458 printk(KERN_ERR "%s: failed to allocate IOTAG. "
1459 "Unloading driver.\n",
1460 __FUNCTION__);
1461 error = -ENOMEM;
1462 goto out_free_iocbq;
1463 }
1455 spin_lock_irq(phba->host->host_lock); 1464 spin_lock_irq(phba->host->host_lock);
1456 list_add(&iocbq_entry->list, &phba->lpfc_iocb_list); 1465 list_add(&iocbq_entry->list, &phba->lpfc_iocb_list);
1457 phba->total_iocbq_bufs++; 1466 phba->total_iocbq_bufs++;