Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 55198
b: refs/heads/master
c: 2534ba7
h: refs/heads/master
v: v3
  • Loading branch information
James Smart authored and James Bottomley committed May 6, 2007
1 parent d834c6a commit ab48264
Show file tree
Hide file tree
Showing 6 changed files with 117 additions and 149 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 46fa311e6967b526e1fd9b0b44edda6841dcac27
refs/heads/master: 2534ba756ec407d343af45168273d3a64825a7ba
1 change: 1 addition & 0 deletions trunk/drivers/scsi/lpfc/lpfc_crtn.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ void lpfc_disc_start(struct lpfc_hba *);
void lpfc_disc_flush_list(struct lpfc_hba *);
void lpfc_disc_timeout(unsigned long);

struct lpfc_nodelist *__lpfc_findnode_rpi(struct lpfc_hba * phba, uint16_t rpi);
struct lpfc_nodelist *lpfc_findnode_rpi(struct lpfc_hba * phba, uint16_t rpi);

int lpfc_workq_post_event(struct lpfc_hba *, void *, void *, uint32_t);
Expand Down
30 changes: 17 additions & 13 deletions trunk/drivers/scsi/lpfc/lpfc_els.c
Original file line number Diff line number Diff line change
Expand Up @@ -3272,9 +3272,7 @@ lpfc_els_timeout_handler(struct lpfc_hba *phba)

if (cmd->ulpCommand == CMD_GEN_REQUEST64_CR) {
struct lpfc_nodelist *ndlp;
spin_unlock_irq(phba->host->host_lock);
ndlp = lpfc_findnode_rpi(phba, cmd->ulpContext);
spin_lock_irq(phba->host->host_lock);
ndlp = __lpfc_findnode_rpi(phba, cmd->ulpContext);
remote_ID = ndlp->nlp_DID;
} else {
remote_ID = cmd->un.elsreq64.remoteID;
Expand All @@ -3298,6 +3296,7 @@ lpfc_els_timeout_handler(struct lpfc_hba *phba)
void
lpfc_els_flush_cmd(struct lpfc_hba * phba)
{
LIST_HEAD(completions);
struct lpfc_sli_ring *pring;
struct lpfc_iocbq *tmp_iocb, *piocb;
IOCB_t *cmd = NULL;
Expand All @@ -3319,18 +3318,9 @@ lpfc_els_flush_cmd(struct lpfc_hba * phba)
continue;
}

list_del(&piocb->list);
list_move_tail(&piocb->list, &completions);
pring->txq_cnt--;

cmd->ulpStatus = IOSTAT_LOCAL_REJECT;
cmd->un.ulpWord[4] = IOERR_SLI_ABORTED;

if (piocb->iocb_cmpl) {
spin_unlock_irq(phba->host->host_lock);
(piocb->iocb_cmpl) (phba, piocb, piocb);
spin_lock_irq(phba->host->host_lock);
} else
lpfc_sli_release_iocbq(phba, piocb);
}

list_for_each_entry_safe(piocb, tmp_iocb, &pring->txcmplq, list) {
Expand All @@ -3343,6 +3333,20 @@ lpfc_els_flush_cmd(struct lpfc_hba * phba)
lpfc_sli_issue_abort_iotag(phba, pring, piocb);
}
spin_unlock_irq(phba->host->host_lock);

while(!list_empty(&completions)) {
piocb = list_get_first(&completions, struct lpfc_iocbq, list);
cmd = &piocb->iocb;
list_del(&piocb->list);

if (piocb->iocb_cmpl) {
cmd->ulpStatus = IOSTAT_LOCAL_REJECT;
cmd->un.ulpWord[4] = IOERR_SLI_ABORTED;
(piocb->iocb_cmpl) (phba, piocb, piocb);
} else
lpfc_sli_release_iocbq(phba, piocb);
}

return;
}

Expand Down
104 changes: 46 additions & 58 deletions trunk/drivers/scsi/lpfc/lpfc_hbadisc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1473,6 +1473,7 @@ lpfc_check_sli_ndlp(struct lpfc_hba * phba,
static int
lpfc_no_rpi(struct lpfc_hba * phba, struct lpfc_nodelist * ndlp)
{
LIST_HEAD(completions);
struct lpfc_sli *psli;
struct lpfc_sli_ring *pring;
struct lpfc_iocbq *iocb, *next_iocb;
Expand Down Expand Up @@ -1501,29 +1502,29 @@ lpfc_no_rpi(struct lpfc_hba * phba, struct lpfc_nodelist * ndlp)
(phba, pring, iocb, ndlp))) {
/* It matches, so deque and call compl
with an error */
list_del(&iocb->list);
list_move_tail(&iocb->list,
&completions);
pring->txq_cnt--;
if (iocb->iocb_cmpl) {
icmd = &iocb->iocb;
icmd->ulpStatus =
IOSTAT_LOCAL_REJECT;
icmd->un.ulpWord[4] =
IOERR_SLI_ABORTED;
spin_unlock_irq(phba->host->
host_lock);
(iocb->iocb_cmpl) (phba,
iocb, iocb);
spin_lock_irq(phba->host->
host_lock);
} else
lpfc_sli_release_iocbq(phba,
iocb);
}
}
spin_unlock_irq(phba->host->host_lock);

}
}

while (!list_empty(&completions)) {
iocb = list_get_first(&completions, struct lpfc_iocbq, list);
list_del(&iocb->list);

if (iocb->iocb_cmpl) {
icmd = &iocb->iocb;
icmd->ulpStatus = IOSTAT_LOCAL_REJECT;
icmd->un.ulpWord[4] = IOERR_SLI_ABORTED;
(iocb->iocb_cmpl) (phba, iocb, iocb);
} else
lpfc_sli_release_iocbq(phba, iocb);
}

return 0;
}

Expand Down Expand Up @@ -1951,18 +1952,19 @@ lpfc_disc_start(struct lpfc_hba * phba)
static void
lpfc_free_tx(struct lpfc_hba * phba, struct lpfc_nodelist * ndlp)
{
LIST_HEAD(completions);
struct lpfc_sli *psli;
IOCB_t *icmd;
struct lpfc_iocbq *iocb, *next_iocb;
struct lpfc_sli_ring *pring;
struct lpfc_dmabuf *mp;

psli = &phba->sli;
pring = &psli->ring[LPFC_ELS_RING];

/* Error matching iocb on txq or txcmplq
* First check the txq.
*/
spin_lock_irq(phba->host->host_lock);
list_for_each_entry_safe(iocb, next_iocb, &pring->txq, list) {
if (iocb->context1 != ndlp) {
continue;
Expand All @@ -1971,9 +1973,8 @@ lpfc_free_tx(struct lpfc_hba * phba, struct lpfc_nodelist * ndlp)
if ((icmd->ulpCommand == CMD_ELS_REQUEST64_CR) ||
(icmd->ulpCommand == CMD_XMIT_ELS_RSP64_CX)) {

list_del(&iocb->list);
list_move_tail(&iocb->list, &completions);
pring->txq_cnt--;
lpfc_els_free_iocb(phba, iocb);
}
}

Expand All @@ -1985,43 +1986,22 @@ lpfc_free_tx(struct lpfc_hba * phba, struct lpfc_nodelist * ndlp)
icmd = &iocb->iocb;
if ((icmd->ulpCommand == CMD_ELS_REQUEST64_CR) ||
(icmd->ulpCommand == CMD_XMIT_ELS_RSP64_CX)) {
lpfc_sli_issue_abort_iotag(phba, pring, iocb);
}
}
spin_unlock_irq(phba->host->host_lock);

iocb->iocb_cmpl = NULL;
/* context2 = cmd, context2->next = rsp, context3 =
bpl */
if (iocb->context2) {
/* Free the response IOCB before handling the
command. */

mp = (struct lpfc_dmabuf *) (iocb->context2);
mp = list_get_first(&mp->list,
struct lpfc_dmabuf,
list);
if (mp) {
/* Delay before releasing rsp buffer to
* give UNREG mbox a chance to take
* effect.
*/
list_add(&mp->list,
&phba->freebufList);
}
lpfc_mbuf_free(phba,
((struct lpfc_dmabuf *)
iocb->context2)->virt,
((struct lpfc_dmabuf *)
iocb->context2)->phys);
kfree(iocb->context2);
}
while (!list_empty(&completions)) {
iocb = list_get_first(&completions, struct lpfc_iocbq, list);
list_del(&iocb->list);

if (iocb->context3) {
lpfc_mbuf_free(phba,
((struct lpfc_dmabuf *)
iocb->context3)->virt,
((struct lpfc_dmabuf *)
iocb->context3)->phys);
kfree(iocb->context3);
}
}
if (iocb->iocb_cmpl) {
icmd = &iocb->iocb;
icmd->ulpStatus = IOSTAT_LOCAL_REJECT;
icmd->un.ulpWord[4] = IOERR_SLI_ABORTED;
(iocb->iocb_cmpl) (phba, iocb, iocb);
} else
lpfc_sli_release_iocbq(phba, iocb);
}

return;
Expand Down Expand Up @@ -2354,7 +2334,7 @@ lpfc_mbx_cmpl_fdmi_reg_login(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmb)
* else return NULL.
*/
struct lpfc_nodelist *
lpfc_findnode_rpi(struct lpfc_hba * phba, uint16_t rpi)
__lpfc_findnode_rpi(struct lpfc_hba * phba, uint16_t rpi)
{
struct lpfc_nodelist *ndlp;
struct list_head * lists[]={&phba->fc_nlpunmap_list,
Expand All @@ -2364,17 +2344,25 @@ lpfc_findnode_rpi(struct lpfc_hba * phba, uint16_t rpi)
&phba->fc_reglogin_list};
int i;

spin_lock_irq(phba->host->host_lock);
for (i = 0; i < ARRAY_SIZE(lists); i++ )
list_for_each_entry(ndlp, lists[i], nlp_listp)
if (ndlp->nlp_rpi == rpi) {
spin_unlock_irq(phba->host->host_lock);
return ndlp;
}
spin_unlock_irq(phba->host->host_lock);
return NULL;
}

struct lpfc_nodelist *
lpfc_findnode_rpi(struct lpfc_hba * phba, uint16_t rpi)
{
struct lpfc_nodelist *ndlp;

spin_lock_irq(phba->host->host_lock);
ndlp = __lpfc_findnode_rpi(phba, rpi);
spin_unlock_irq(phba->host->host_lock);
return ndlp;
}

/*
* This routine looks up the ndlp lists
* for the given WWPN. If WWPN found
Expand Down
57 changes: 26 additions & 31 deletions trunk/drivers/scsi/lpfc/lpfc_nportdisc.c
Original file line number Diff line number Diff line change
Expand Up @@ -170,11 +170,11 @@ lpfc_check_elscmpl_iocb(struct lpfc_hba * phba,
int
lpfc_els_abort(struct lpfc_hba * phba, struct lpfc_nodelist * ndlp)
{
LIST_HEAD(completions);
struct lpfc_sli *psli;
struct lpfc_sli_ring *pring;
struct lpfc_iocbq *iocb, *next_iocb;
IOCB_t *icmd;
int found = 0;
IOCB_t *cmd;

/* Abort outstanding I/O on NPort <nlp_DID> */
lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY,
Expand All @@ -187,45 +187,40 @@ lpfc_els_abort(struct lpfc_hba * phba, struct lpfc_nodelist * ndlp)
pring = &psli->ring[LPFC_ELS_RING];

/* First check the txq */
do {
found = 0;
spin_lock_irq(phba->host->host_lock);
list_for_each_entry_safe(iocb, next_iocb, &pring->txq, list) {
/* Check to see if iocb matches the nport we are looking
for */
if ((lpfc_check_sli_ndlp(phba, pring, iocb, ndlp))) {
found = 1;
/* It matches, so deque and call compl with an
error */
list_del(&iocb->list);
pring->txq_cnt--;
if (iocb->iocb_cmpl) {
icmd = &iocb->iocb;
icmd->ulpStatus = IOSTAT_LOCAL_REJECT;
icmd->un.ulpWord[4] = IOERR_SLI_ABORTED;
spin_unlock_irq(phba->host->host_lock);
(iocb->iocb_cmpl) (phba, iocb, iocb);
spin_lock_irq(phba->host->host_lock);
} else
lpfc_sli_release_iocbq(phba, iocb);
break;
}
spin_lock_irq(phba->host->host_lock);
list_for_each_entry_safe(iocb, next_iocb, &pring->txq, list) {
/* Check to see if iocb matches the nport we are looking
for */
if (lpfc_check_sli_ndlp(phba, pring, iocb, ndlp)) {
/* It matches, so deque and call compl with an
error */
list_move_tail(&iocb->list, &completions);
pring->txq_cnt--;
}
spin_unlock_irq(phba->host->host_lock);
} while (found);
}

/* Next check the txcmplq */
spin_lock_irq(phba->host->host_lock);
list_for_each_entry_safe(iocb, next_iocb, &pring->txcmplq, list) {
/* Check to see if iocb matches the nport we are looking
for */
if ((lpfc_check_sli_ndlp (phba, pring, iocb, ndlp))) {
icmd = &iocb->iocb;
if (lpfc_check_sli_ndlp(phba, pring, iocb, ndlp))
lpfc_sli_issue_abort_iotag(phba, pring, iocb);
}
}
spin_unlock_irq(phba->host->host_lock);

while (!list_empty(&completions)) {
iocb = list_get_first(&completions, struct lpfc_iocbq, list);
cmd = &iocb->iocb;
list_del(&iocb->list);

if (iocb->iocb_cmpl) {
cmd->ulpStatus = IOSTAT_LOCAL_REJECT;
cmd->un.ulpWord[4] = IOERR_SLI_ABORTED;
(iocb->iocb_cmpl) (phba, iocb, iocb);
} else
lpfc_sli_release_iocbq(phba, iocb);
}

/* If we are delaying issuing an ELS command, cancel it */
if (ndlp->nlp_flag & NLP_DELAY_TMO)
lpfc_cancel_retry_delay_tmo(phba, ndlp);
Expand Down
Loading

0 comments on commit ab48264

Please sign in to comment.