aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/message/fusion/mptbase.c
diff options
context:
space:
mode:
authorKashyap, Desai <kashyap.desai@lsi.com>2009-05-29 07:14:48 -0400
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2009-06-09 18:28:30 -0400
commit1ba9ab2eb2c53df52e498779e14cf4e5ea77b0ad (patch)
tree494361505cc5556ba4b843714c05d681506a846b /drivers/message/fusion/mptbase.c
parent37c60f374a855974c27bd30d5662a8fa5e933792 (diff)
[SCSI] mpt fusion: rewrite taskmgmt request and completion routines
1.) rewrite taskmanagement request and completion routines, making them single threaded and using the generic MPT_MGMT struct, deleting mptscsih_TMHandler, replacing with single request TM handler mptscsih_IssueTaskMgmt, and killing the watchdog timer functions. 2.) cleanup ioc_reset callback handlers, introducing wrappers for synchronizing error recovery (mpt_set_taskmgmt_in_progress_flag, mpt_clear_taskmgmt_in_progress_flag), as the fusion firmware only handles one task management request at a time Signed-off-by: Kashyap Desai <kadesai@lsi.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers/message/fusion/mptbase.c')
-rw-r--r--drivers/message/fusion/mptbase.c80
1 files changed, 66 insertions, 14 deletions
diff --git a/drivers/message/fusion/mptbase.c b/drivers/message/fusion/mptbase.c
index d8d5231f484e..af862bf6386f 100644
--- a/drivers/message/fusion/mptbase.c
+++ b/drivers/message/fusion/mptbase.c
@@ -341,7 +341,7 @@ mpt_fault_reset_work(struct work_struct *work)
341 int rc; 341 int rc;
342 unsigned long flags; 342 unsigned long flags;
343 343
344 if (ioc->diagPending || !ioc->active) 344 if (ioc->ioc_reset_in_progress || !ioc->active)
345 goto out; 345 goto out;
346 346
347 ioc_raw_state = mpt_GetIocState(ioc, 0); 347 ioc_raw_state = mpt_GetIocState(ioc, 0);
@@ -1771,14 +1771,15 @@ mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id)
1771 ioc->reply_sz = MPT_REPLY_FRAME_SIZE; 1771 ioc->reply_sz = MPT_REPLY_FRAME_SIZE;
1772 1772
1773 ioc->pcidev = pdev; 1773 ioc->pcidev = pdev;
1774 ioc->diagPending = 0;
1775 spin_lock_init(&ioc->diagLock);
1776 spin_lock_init(&ioc->initializing_hba_lock); 1774 spin_lock_init(&ioc->initializing_hba_lock);
1777 1775
1776 spin_lock_init(&ioc->taskmgmt_lock);
1778 mutex_init(&ioc->internal_cmds.mutex); 1777 mutex_init(&ioc->internal_cmds.mutex);
1779 init_completion(&ioc->internal_cmds.done); 1778 init_completion(&ioc->internal_cmds.done);
1780 mutex_init(&ioc->mptbase_cmds.mutex); 1779 mutex_init(&ioc->mptbase_cmds.mutex);
1781 init_completion(&ioc->mptbase_cmds.done); 1780 init_completion(&ioc->mptbase_cmds.done);
1781 mutex_init(&ioc->taskmgmt_cmds.mutex);
1782 init_completion(&ioc->taskmgmt_cmds.done);
1782 1783
1783 /* Initialize the event logging. 1784 /* Initialize the event logging.
1784 */ 1785 */
@@ -6572,6 +6573,53 @@ mpt_print_ioc_summary(MPT_ADAPTER *ioc, char *buffer, int *size, int len, int sh
6572 6573
6573 *size = y; 6574 *size = y;
6574} 6575}
6576/**
6577 * mpt_set_taskmgmt_in_progress_flag - set flags associated with task managment
6578 * @ioc: Pointer to MPT_ADAPTER structure
6579 *
6580 * Returns 0 for SUCCESS or -1 if FAILED.
6581 *
6582 * If -1 is return, then it was not possible to set the flags
6583 **/
6584int
6585mpt_set_taskmgmt_in_progress_flag(MPT_ADAPTER *ioc)
6586{
6587 unsigned long flags;
6588 int retval;
6589
6590 spin_lock_irqsave(&ioc->taskmgmt_lock, flags);
6591 if (ioc->ioc_reset_in_progress || ioc->taskmgmt_in_progress ||
6592 (ioc->alt_ioc && ioc->alt_ioc->taskmgmt_in_progress)) {
6593 retval = -1;
6594 goto out;
6595 }
6596 retval = 0;
6597 ioc->taskmgmt_in_progress = 1;
6598 if (ioc->alt_ioc)
6599 ioc->alt_ioc->taskmgmt_in_progress = 1;
6600 out:
6601 spin_unlock_irqrestore(&ioc->taskmgmt_lock, flags);
6602 return retval;
6603}
6604EXPORT_SYMBOL(mpt_set_taskmgmt_in_progress_flag);
6605
6606/**
6607 * mpt_clear_taskmgmt_in_progress_flag - clear flags associated with task managment
6608 * @ioc: Pointer to MPT_ADAPTER structure
6609 *
6610 **/
6611void
6612mpt_clear_taskmgmt_in_progress_flag(MPT_ADAPTER *ioc)
6613{
6614 unsigned long flags;
6615
6616 spin_lock_irqsave(&ioc->taskmgmt_lock, flags);
6617 ioc->taskmgmt_in_progress = 0;
6618 if (ioc->alt_ioc)
6619 ioc->alt_ioc->taskmgmt_in_progress = 0;
6620 spin_unlock_irqrestore(&ioc->taskmgmt_lock, flags);
6621}
6622EXPORT_SYMBOL(mpt_clear_taskmgmt_in_progress_flag);
6575 6623
6576 6624
6577/** 6625/**
@@ -6638,14 +6686,15 @@ mpt_HardResetHandler(MPT_ADAPTER *ioc, int sleepFlag)
6638 /* Reset the adapter. Prevent more than 1 call to 6686 /* Reset the adapter. Prevent more than 1 call to
6639 * mpt_do_ioc_recovery at any instant in time. 6687 * mpt_do_ioc_recovery at any instant in time.
6640 */ 6688 */
6641 spin_lock_irqsave(&ioc->diagLock, flags); 6689 spin_lock_irqsave(&ioc->taskmgmt_lock, flags);
6642 if ((ioc->diagPending) || (ioc->alt_ioc && ioc->alt_ioc->diagPending)){ 6690 if (ioc->ioc_reset_in_progress) {
6643 spin_unlock_irqrestore(&ioc->diagLock, flags); 6691 spin_unlock_irqrestore(&ioc->taskmgmt_lock, flags);
6644 return 0; 6692 return 0;
6645 } else {
6646 ioc->diagPending = 1;
6647 } 6693 }
6648 spin_unlock_irqrestore(&ioc->diagLock, flags); 6694 ioc->ioc_reset_in_progress = 1;
6695 if (ioc->alt_ioc)
6696 ioc->alt_ioc->ioc_reset_in_progress = 1;
6697 spin_unlock_irqrestore(&ioc->taskmgmt_lock, flags);
6649 6698
6650 /* FIXME: If do_ioc_recovery fails, repeat.... 6699 /* FIXME: If do_ioc_recovery fails, repeat....
6651 */ 6700 */
@@ -6680,11 +6729,14 @@ mpt_HardResetHandler(MPT_ADAPTER *ioc, int sleepFlag)
6680 if (ioc->alt_ioc) 6729 if (ioc->alt_ioc)
6681 ioc->alt_ioc->reload_fw = 0; 6730 ioc->alt_ioc->reload_fw = 0;
6682 6731
6683 spin_lock_irqsave(&ioc->diagLock, flags); 6732 spin_lock_irqsave(&ioc->taskmgmt_lock, flags);
6684 ioc->diagPending = 0; 6733 ioc->ioc_reset_in_progress = 0;
6685 if (ioc->alt_ioc) 6734 ioc->taskmgmt_in_progress = 0;
6686 ioc->alt_ioc->diagPending = 0; 6735 if (ioc->alt_ioc) {
6687 spin_unlock_irqrestore(&ioc->diagLock, flags); 6736 ioc->alt_ioc->ioc_reset_in_progress = 0;
6737 ioc->alt_ioc->taskmgmt_in_progress = 0;
6738 }
6739 spin_unlock_irqrestore(&ioc->taskmgmt_lock, flags);
6688 6740
6689 dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT "HardResetHandler rc = %d!\n", ioc->name, rc)); 6741 dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT "HardResetHandler rc = %d!\n", ioc->name, rc));
6690 6742