2005-04-17 14:05:31 -07:00
|
|
|
/*******************************************************************
|
|
|
|
* This file is part of the Emulex Linux Device Driver for *
|
2005-06-25 07:34:39 -07:00
|
|
|
* Fibre Channel Host Bus Adapters. *
|
2007-04-25 06:53:35 -07:00
|
|
|
* Copyright (C) 2004-2007 Emulex. All rights reserved. *
|
2005-06-25 07:34:39 -07:00
|
|
|
* EMULEX and SLI are trademarks of Emulex. *
|
2005-04-17 14:05:31 -07:00
|
|
|
* www.emulex.com *
|
2005-06-25 07:34:39 -07:00
|
|
|
* Portions Copyright (C) 2004-2005 Christoph Hellwig *
|
2005-04-17 14:05:31 -07:00
|
|
|
* *
|
|
|
|
* This program is free software; you can redistribute it and/or *
|
2005-06-25 07:34:39 -07:00
|
|
|
* modify it under the terms of version 2 of the GNU General *
|
|
|
|
* Public License as published by the Free Software Foundation. *
|
|
|
|
* This program is distributed in the hope that it will be useful. *
|
|
|
|
* ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND *
|
|
|
|
* WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, *
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT, ARE *
|
|
|
|
* DISCLAIMED, EXCEPT TO THE EXTENT THAT SUCH DISCLAIMERS ARE HELD *
|
|
|
|
* TO BE LEGALLY INVALID. See the GNU General Public License for *
|
|
|
|
* more details, a copy of which can be found in the file COPYING *
|
|
|
|
* included with this package. *
|
2005-04-17 14:05:31 -07:00
|
|
|
*******************************************************************/
|
|
|
|
|
|
|
|
#include <linux/blkdev.h>
|
|
|
|
#include <linux/pci.h>
|
|
|
|
#include <linux/interrupt.h>
|
|
|
|
#include <linux/delay.h>
|
|
|
|
|
2005-08-10 12:03:09 -07:00
|
|
|
#include <scsi/scsi.h>
|
2005-04-17 14:05:31 -07:00
|
|
|
#include <scsi/scsi_cmnd.h>
|
|
|
|
#include <scsi/scsi_device.h>
|
|
|
|
#include <scsi/scsi_host.h>
|
2005-08-10 12:03:01 -07:00
|
|
|
#include <scsi/scsi_transport_fc.h>
|
2005-04-17 14:05:31 -07:00
|
|
|
|
|
|
|
#include "lpfc_hw.h"
|
|
|
|
#include "lpfc_sli.h"
|
|
|
|
#include "lpfc_disc.h"
|
|
|
|
#include "lpfc_scsi.h"
|
|
|
|
#include "lpfc.h"
|
|
|
|
#include "lpfc_crtn.h"
|
|
|
|
#include "lpfc_logmsg.h"
|
|
|
|
#include "lpfc_compat.h"
|
2007-06-17 17:56:39 -07:00
|
|
|
#include "lpfc_debugfs.h"
|
2005-04-17 14:05:31 -07:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Define macro to log: Mailbox command x%x cannot issue Data
|
|
|
|
* This allows multiple uses of lpfc_msgBlk0311
|
|
|
|
* w/o perturbing log msg utility.
|
|
|
|
*/
|
2007-06-17 17:56:38 -07:00
|
|
|
#define LOG_MBOX_CANNOT_ISSUE_DATA(phba, pmbox, psli, flag) \
|
2005-04-17 14:05:31 -07:00
|
|
|
lpfc_printf_log(phba, \
|
|
|
|
KERN_INFO, \
|
|
|
|
LOG_MBOX | LOG_SLI, \
|
2007-08-02 08:10:09 -07:00
|
|
|
"(%d):0311 Mailbox command x%x cannot " \
|
2007-06-17 17:56:38 -07:00
|
|
|
"issue Data: x%x x%x x%x\n", \
|
|
|
|
pmbox->vport ? pmbox->vport->vpi : 0, \
|
|
|
|
pmbox->mb.mbxCommand, \
|
2007-06-17 17:56:36 -07:00
|
|
|
phba->pport->port_state, \
|
2005-04-17 14:05:31 -07:00
|
|
|
psli->sli_flag, \
|
2007-06-17 17:56:36 -07:00
|
|
|
flag)
|
2005-04-17 14:05:31 -07:00
|
|
|
|
|
|
|
|
|
|
|
/* There are only four IOCB completion types. */
|
|
|
|
typedef enum _lpfc_iocb_type {
|
|
|
|
LPFC_UNKNOWN_IOCB,
|
|
|
|
LPFC_UNSOL_IOCB,
|
|
|
|
LPFC_SOL_IOCB,
|
|
|
|
LPFC_ABORT_IOCB
|
|
|
|
} lpfc_iocb_type;
|
|
|
|
|
2007-06-17 17:56:38 -07:00
|
|
|
/* SLI-2/SLI-3 provide different sized iocbs. Given a pointer
|
|
|
|
* to the start of the ring, and the slot number of the
|
|
|
|
* desired iocb entry, calc a pointer to that entry.
|
|
|
|
*/
|
2007-06-17 17:56:37 -07:00
|
|
|
static inline IOCB_t *
|
|
|
|
lpfc_cmd_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring)
|
|
|
|
{
|
|
|
|
return (IOCB_t *) (((char *) pring->cmdringaddr) +
|
|
|
|
pring->cmdidx * phba->iocb_cmd_size);
|
|
|
|
}
|
|
|
|
|
|
|
|
static inline IOCB_t *
|
|
|
|
lpfc_resp_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring)
|
|
|
|
{
|
|
|
|
return (IOCB_t *) (((char *) pring->rspringaddr) +
|
|
|
|
pring->rspidx * phba->iocb_rsp_size);
|
|
|
|
}
|
|
|
|
|
2007-06-17 17:56:36 -07:00
|
|
|
static struct lpfc_iocbq *
|
|
|
|
__lpfc_sli_get_iocbq(struct lpfc_hba *phba)
|
2005-10-28 17:30:02 -07:00
|
|
|
{
|
|
|
|
struct list_head *lpfc_iocb_list = &phba->lpfc_iocb_list;
|
|
|
|
struct lpfc_iocbq * iocbq = NULL;
|
|
|
|
|
|
|
|
list_remove_head(lpfc_iocb_list, iocbq, struct lpfc_iocbq, list);
|
|
|
|
return iocbq;
|
|
|
|
}
|
|
|
|
|
2007-06-17 17:56:36 -07:00
|
|
|
struct lpfc_iocbq *
|
|
|
|
lpfc_sli_get_iocbq(struct lpfc_hba *phba)
|
|
|
|
{
|
|
|
|
struct lpfc_iocbq * iocbq = NULL;
|
|
|
|
unsigned long iflags;
|
|
|
|
|
|
|
|
spin_lock_irqsave(&phba->hbalock, iflags);
|
|
|
|
iocbq = __lpfc_sli_get_iocbq(phba);
|
|
|
|
spin_unlock_irqrestore(&phba->hbalock, iflags);
|
|
|
|
return iocbq;
|
|
|
|
}
|
|
|
|
|
2007-11-05 10:07:33 -07:00
|
|
|
static void
|
2007-06-17 17:56:36 -07:00
|
|
|
__lpfc_sli_release_iocbq(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq)
|
2005-10-29 08:28:33 -07:00
|
|
|
{
|
2007-06-17 17:56:36 -07:00
|
|
|
size_t start_clean = offsetof(struct lpfc_iocbq, iocb);
|
2005-10-29 08:28:33 -07:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Clean all volatile data fields, preserve iotag and node struct.
|
|
|
|
*/
|
|
|
|
memset((char*)iocbq + start_clean, 0, sizeof(*iocbq) - start_clean);
|
|
|
|
list_add_tail(&iocbq->list, &phba->lpfc_iocb_list);
|
|
|
|
}
|
|
|
|
|
2007-06-17 17:56:36 -07:00
|
|
|
void
|
|
|
|
lpfc_sli_release_iocbq(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq)
|
|
|
|
{
|
|
|
|
unsigned long iflags;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Clean all volatile data fields, preserve iotag and node struct.
|
|
|
|
*/
|
|
|
|
spin_lock_irqsave(&phba->hbalock, iflags);
|
|
|
|
__lpfc_sli_release_iocbq(phba, iocbq);
|
|
|
|
spin_unlock_irqrestore(&phba->hbalock, iflags);
|
|
|
|
}
|
|
|
|
|
2005-04-17 14:05:31 -07:00
|
|
|
/*
|
|
|
|
* Translate the iocb command to an iocb command type used to decide the final
|
|
|
|
* disposition of each completed IOCB.
|
|
|
|
*/
|
|
|
|
static lpfc_iocb_type
|
|
|
|
lpfc_sli_iocb_cmd_type(uint8_t iocb_cmnd)
|
|
|
|
{
|
|
|
|
lpfc_iocb_type type = LPFC_UNKNOWN_IOCB;
|
|
|
|
|
|
|
|
if (iocb_cmnd > CMD_MAX_IOCB_CMD)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
switch (iocb_cmnd) {
|
|
|
|
case CMD_XMIT_SEQUENCE_CR:
|
|
|
|
case CMD_XMIT_SEQUENCE_CX:
|
|
|
|
case CMD_XMIT_BCAST_CN:
|
|
|
|
case CMD_XMIT_BCAST_CX:
|
|
|
|
case CMD_ELS_REQUEST_CR:
|
|
|
|
case CMD_ELS_REQUEST_CX:
|
|
|
|
case CMD_CREATE_XRI_CR:
|
|
|
|
case CMD_CREATE_XRI_CX:
|
|
|
|
case CMD_GET_RPI_CN:
|
|
|
|
case CMD_XMIT_ELS_RSP_CX:
|
|
|
|
case CMD_GET_RPI_CR:
|
|
|
|
case CMD_FCP_IWRITE_CR:
|
|
|
|
case CMD_FCP_IWRITE_CX:
|
|
|
|
case CMD_FCP_IREAD_CR:
|
|
|
|
case CMD_FCP_IREAD_CX:
|
|
|
|
case CMD_FCP_ICMND_CR:
|
|
|
|
case CMD_FCP_ICMND_CX:
|
2006-12-02 11:35:43 -07:00
|
|
|
case CMD_FCP_TSEND_CX:
|
|
|
|
case CMD_FCP_TRSP_CX:
|
|
|
|
case CMD_FCP_TRECEIVE_CX:
|
|
|
|
case CMD_FCP_AUTO_TRSP_CX:
|
2005-04-17 14:05:31 -07:00
|
|
|
case CMD_ADAPTER_MSG:
|
|
|
|
case CMD_ADAPTER_DUMP:
|
|
|
|
case CMD_XMIT_SEQUENCE64_CR:
|
|
|
|
case CMD_XMIT_SEQUENCE64_CX:
|
|
|
|
case CMD_XMIT_BCAST64_CN:
|
|
|
|
case CMD_XMIT_BCAST64_CX:
|
|
|
|
case CMD_ELS_REQUEST64_CR:
|
|
|
|
case CMD_ELS_REQUEST64_CX:
|
|
|
|
case CMD_FCP_IWRITE64_CR:
|
|
|
|
case CMD_FCP_IWRITE64_CX:
|
|
|
|
case CMD_FCP_IREAD64_CR:
|
|
|
|
case CMD_FCP_IREAD64_CX:
|
|
|
|
case CMD_FCP_ICMND64_CR:
|
|
|
|
case CMD_FCP_ICMND64_CX:
|
2006-12-02 11:35:43 -07:00
|
|
|
case CMD_FCP_TSEND64_CX:
|
|
|
|
case CMD_FCP_TRSP64_CX:
|
|
|
|
case CMD_FCP_TRECEIVE64_CX:
|
2005-04-17 14:05:31 -07:00
|
|
|
case CMD_GEN_REQUEST64_CR:
|
|
|
|
case CMD_GEN_REQUEST64_CX:
|
|
|
|
case CMD_XMIT_ELS_RSP64_CX:
|
|
|
|
type = LPFC_SOL_IOCB;
|
|
|
|
break;
|
|
|
|
case CMD_ABORT_XRI_CN:
|
|
|
|
case CMD_ABORT_XRI_CX:
|
|
|
|
case CMD_CLOSE_XRI_CN:
|
|
|
|
case CMD_CLOSE_XRI_CX:
|
|
|
|
case CMD_XRI_ABORTED_CX:
|
|
|
|
case CMD_ABORT_MXRI64_CN:
|
|
|
|
type = LPFC_ABORT_IOCB;
|
|
|
|
break;
|
|
|
|
case CMD_RCV_SEQUENCE_CX:
|
|
|
|
case CMD_RCV_ELS_REQ_CX:
|
|
|
|
case CMD_RCV_SEQUENCE64_CX:
|
|
|
|
case CMD_RCV_ELS_REQ64_CX:
|
2007-10-27 10:37:05 -07:00
|
|
|
case CMD_ASYNC_STATUS:
|
2007-06-17 17:56:37 -07:00
|
|
|
case CMD_IOCB_RCV_SEQ64_CX:
|
|
|
|
case CMD_IOCB_RCV_ELS64_CX:
|
|
|
|
case CMD_IOCB_RCV_CONT64_CX:
|
2005-04-17 14:05:31 -07:00
|
|
|
type = LPFC_UNSOL_IOCB;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
type = LPFC_UNKNOWN_IOCB;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return type;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2007-06-17 17:56:37 -07:00
|
|
|
lpfc_sli_ring_map(struct lpfc_hba *phba)
|
2005-04-17 14:05:31 -07:00
|
|
|
{
|
|
|
|
struct lpfc_sli *psli = &phba->sli;
|
2007-06-17 17:56:37 -07:00
|
|
|
LPFC_MBOXQ_t *pmb;
|
|
|
|
MAILBOX_t *pmbox;
|
|
|
|
int i, rc, ret = 0;
|
2005-04-17 14:05:31 -07:00
|
|
|
|
2007-06-17 17:56:37 -07:00
|
|
|
pmb = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL);
|
|
|
|
if (!pmb)
|
|
|
|
return -ENOMEM;
|
|
|
|
pmbox = &pmb->mb;
|
|
|
|
phba->link_state = LPFC_INIT_MBX_CMDS;
|
2005-04-17 14:05:31 -07:00
|
|
|
for (i = 0; i < psli->num_rings; i++) {
|
|
|
|
lpfc_config_ring(phba, i, pmb);
|
|
|
|
rc = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL);
|
|
|
|
if (rc != MBX_SUCCESS) {
|
2007-06-17 17:56:38 -07:00
|
|
|
lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
|
2007-08-02 08:10:09 -07:00
|
|
|
"0446 Adapter failed to init (%d), "
|
2005-04-17 14:05:31 -07:00
|
|
|
"mbxCmd x%x CFG_RING, mbxStatus x%x, "
|
|
|
|
"ring %d\n",
|
2007-08-02 08:10:09 -07:00
|
|
|
rc, pmbox->mbxCommand,
|
|
|
|
pmbox->mbxStatus, i);
|
2007-06-17 17:56:36 -07:00
|
|
|
phba->link_state = LPFC_HBA_ERROR;
|
2007-06-17 17:56:37 -07:00
|
|
|
ret = -ENXIO;
|
|
|
|
break;
|
2005-04-17 14:05:31 -07:00
|
|
|
}
|
|
|
|
}
|
2007-06-17 17:56:37 -07:00
|
|
|
mempool_free(pmb, phba->mbox_mem_pool);
|
|
|
|
return ret;
|
2005-04-17 14:05:31 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2007-06-17 17:56:36 -07:00
|
|
|
lpfc_sli_ringtxcmpl_put(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
|
|
|
|
struct lpfc_iocbq *piocb)
|
2005-04-17 14:05:31 -07:00
|
|
|
{
|
|
|
|
list_add_tail(&piocb->list, &pring->txcmplq);
|
|
|
|
pring->txcmplq_cnt++;
|
2007-06-17 17:56:38 -07:00
|
|
|
if ((unlikely(pring->ringno == LPFC_ELS_RING)) &&
|
|
|
|
(piocb->iocb.ulpCommand != CMD_ABORT_XRI_CN) &&
|
|
|
|
(piocb->iocb.ulpCommand != CMD_CLOSE_XRI_CN)) {
|
|
|
|
if (!piocb->vport)
|
|
|
|
BUG();
|
|
|
|
else
|
|
|
|
mod_timer(&piocb->vport->els_tmofunc,
|
|
|
|
jiffies + HZ * (phba->fc_ratov << 1));
|
|
|
|
}
|
|
|
|
|
2005-04-17 14:05:31 -07:00
|
|
|
|
2007-06-17 17:56:36 -07:00
|
|
|
return 0;
|
2005-04-17 14:05:31 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static struct lpfc_iocbq *
|
2007-06-17 17:56:36 -07:00
|
|
|
lpfc_sli_ringtx_get(struct lpfc_hba *phba, struct lpfc_sli_ring *pring)
|
2005-04-17 14:05:31 -07:00
|
|
|
{
|
|
|
|
struct lpfc_iocbq *cmd_iocb;
|
|
|
|
|
2007-06-17 17:56:39 -07:00
|
|
|
list_remove_head((&pring->txq), cmd_iocb, struct lpfc_iocbq, list);
|
|
|
|
if (cmd_iocb != NULL)
|
2005-04-17 14:05:31 -07:00
|
|
|
pring->txq_cnt--;
|
2007-06-17 17:56:36 -07:00
|
|
|
return cmd_iocb;
|
2005-04-17 14:05:31 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static IOCB_t *
|
|
|
|
lpfc_sli_next_iocb_slot (struct lpfc_hba *phba, struct lpfc_sli_ring *pring)
|
|
|
|
{
|
2007-06-17 17:56:37 -07:00
|
|
|
struct lpfc_pgp *pgp = (phba->sli_rev == 3) ?
|
|
|
|
&phba->slim2p->mbx.us.s3_pgp.port[pring->ringno] :
|
|
|
|
&phba->slim2p->mbx.us.s2.port[pring->ringno];
|
2005-04-17 14:05:31 -07:00
|
|
|
uint32_t max_cmd_idx = pring->numCiocb;
|
|
|
|
|
|
|
|
if ((pring->next_cmdidx == pring->cmdidx) &&
|
|
|
|
(++pring->next_cmdidx >= max_cmd_idx))
|
|
|
|
pring->next_cmdidx = 0;
|
|
|
|
|
|
|
|
if (unlikely(pring->local_getidx == pring->next_cmdidx)) {
|
|
|
|
|
|
|
|
pring->local_getidx = le32_to_cpu(pgp->cmdGetInx);
|
|
|
|
|
|
|
|
if (unlikely(pring->local_getidx >= max_cmd_idx)) {
|
|
|
|
lpfc_printf_log(phba, KERN_ERR, LOG_SLI,
|
2007-08-02 08:10:09 -07:00
|
|
|
"0315 Ring %d issue: portCmdGet %d "
|
2005-04-17 14:05:31 -07:00
|
|
|
"is bigger then cmd ring %d\n",
|
2007-08-02 08:10:09 -07:00
|
|
|
pring->ringno,
|
2005-04-17 14:05:31 -07:00
|
|
|
pring->local_getidx, max_cmd_idx);
|
|
|
|
|
2007-06-17 17:56:36 -07:00
|
|
|
phba->link_state = LPFC_HBA_ERROR;
|
2005-04-17 14:05:31 -07:00
|
|
|
/*
|
|
|
|
* All error attention handlers are posted to
|
|
|
|
* worker thread
|
|
|
|
*/
|
|
|
|
phba->work_ha |= HA_ERATT;
|
|
|
|
phba->work_hs = HS_FFER3;
|
2007-06-17 17:56:38 -07:00
|
|
|
|
|
|
|
/* hbalock should already be held */
|
2005-04-17 14:05:31 -07:00
|
|
|
if (phba->work_wait)
|
2007-06-17 17:56:38 -07:00
|
|
|
lpfc_worker_wake_up(phba);
|
2005-04-17 14:05:31 -07:00
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pring->local_getidx == pring->next_cmdidx)
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2007-06-17 17:56:37 -07:00
|
|
|
return lpfc_cmd_iocb(phba, pring);
|
2005-04-17 14:05:31 -07:00
|
|
|
}
|
|
|
|
|
2005-10-29 08:28:33 -07:00
|
|
|
uint16_t
|
2007-06-17 17:56:36 -07:00
|
|
|
lpfc_sli_next_iotag(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq)
|
2005-04-17 14:05:31 -07:00
|
|
|
{
|
2007-06-17 17:56:36 -07:00
|
|
|
struct lpfc_iocbq **new_arr;
|
|
|
|
struct lpfc_iocbq **old_arr;
|
2005-10-29 08:28:33 -07:00
|
|
|
size_t new_len;
|
|
|
|
struct lpfc_sli *psli = &phba->sli;
|
|
|
|
uint16_t iotag;
|
2005-04-17 14:05:31 -07:00
|
|
|
|
2007-06-17 17:56:36 -07:00
|
|
|
spin_lock_irq(&phba->hbalock);
|
2005-10-29 08:28:33 -07:00
|
|
|
iotag = psli->last_iotag;
|
|
|
|
if(++iotag < psli->iocbq_lookup_len) {
|
|
|
|
psli->last_iotag = iotag;
|
|
|
|
psli->iocbq_lookup[iotag] = iocbq;
|
2007-06-17 17:56:36 -07:00
|
|
|
spin_unlock_irq(&phba->hbalock);
|
2005-10-29 08:28:33 -07:00
|
|
|
iocbq->iotag = iotag;
|
|
|
|
return iotag;
|
2007-06-17 17:56:36 -07:00
|
|
|
} else if (psli->iocbq_lookup_len < (0xffff
|
2005-10-29 08:28:33 -07:00
|
|
|
- LPFC_IOCBQ_LOOKUP_INCREMENT)) {
|
|
|
|
new_len = psli->iocbq_lookup_len + LPFC_IOCBQ_LOOKUP_INCREMENT;
|
2007-06-17 17:56:36 -07:00
|
|
|
spin_unlock_irq(&phba->hbalock);
|
|
|
|
new_arr = kzalloc(new_len * sizeof (struct lpfc_iocbq *),
|
2005-10-29 08:28:33 -07:00
|
|
|
GFP_KERNEL);
|
|
|
|
if (new_arr) {
|
2007-06-17 17:56:36 -07:00
|
|
|
spin_lock_irq(&phba->hbalock);
|
2005-10-29 08:28:33 -07:00
|
|
|
old_arr = psli->iocbq_lookup;
|
|
|
|
if (new_len <= psli->iocbq_lookup_len) {
|
|
|
|
/* highly unprobable case */
|
|
|
|
kfree(new_arr);
|
|
|
|
iotag = psli->last_iotag;
|
|
|
|
if(++iotag < psli->iocbq_lookup_len) {
|
|
|
|
psli->last_iotag = iotag;
|
|
|
|
psli->iocbq_lookup[iotag] = iocbq;
|
2007-06-17 17:56:36 -07:00
|
|
|
spin_unlock_irq(&phba->hbalock);
|
2005-10-29 08:28:33 -07:00
|
|
|
iocbq->iotag = iotag;
|
|
|
|
return iotag;
|
|
|
|
}
|
2007-06-17 17:56:36 -07:00
|
|
|
spin_unlock_irq(&phba->hbalock);
|
2005-10-29 08:28:33 -07:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
if (psli->iocbq_lookup)
|
|
|
|
memcpy(new_arr, old_arr,
|
|
|
|
((psli->last_iotag + 1) *
|
2007-08-02 08:10:37 -07:00
|
|
|
sizeof (struct lpfc_iocbq *)));
|
2005-10-29 08:28:33 -07:00
|
|
|
psli->iocbq_lookup = new_arr;
|
|
|
|
psli->iocbq_lookup_len = new_len;
|
|
|
|
psli->last_iotag = iotag;
|
|
|
|
psli->iocbq_lookup[iotag] = iocbq;
|
2007-06-17 17:56:36 -07:00
|
|
|
spin_unlock_irq(&phba->hbalock);
|
2005-10-29 08:28:33 -07:00
|
|
|
iocbq->iotag = iotag;
|
|
|
|
kfree(old_arr);
|
|
|
|
return iotag;
|
|
|
|
}
|
2006-08-01 04:34:00 -07:00
|
|
|
} else
|
2007-06-17 17:56:36 -07:00
|
|
|
spin_unlock_irq(&phba->hbalock);
|
2005-04-17 14:05:31 -07:00
|
|
|
|
2005-10-29 08:28:33 -07:00
|
|
|
lpfc_printf_log(phba, KERN_ERR,LOG_SLI,
|
2007-08-02 08:10:09 -07:00
|
|
|
"0318 Failed to allocate IOTAG.last IOTAG is %d\n",
|
|
|
|
psli->last_iotag);
|
2005-04-17 14:05:31 -07:00
|
|
|
|
2005-10-29 08:28:33 -07:00
|
|
|
return 0;
|
2005-04-17 14:05:31 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
lpfc_sli_submit_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
|
|
|
|
IOCB_t *iocb, struct lpfc_iocbq *nextiocb)
|
|
|
|
{
|
|
|
|
/*
|
2005-10-29 08:28:33 -07:00
|
|
|
* Set up an iotag
|
2005-04-17 14:05:31 -07:00
|
|
|
*/
|
2005-10-29 08:28:33 -07:00
|
|
|
nextiocb->iocb.ulpIoTag = (nextiocb->iocb_cmpl) ? nextiocb->iotag : 0;
|
2005-04-17 14:05:31 -07:00
|
|
|
|
2007-08-02 08:09:43 -07:00
|
|
|
if (pring->ringno == LPFC_ELS_RING) {
|
|
|
|
lpfc_debugfs_slow_ring_trc(phba,
|
|
|
|
"IOCB cmd ring: wd4:x%08x wd6:x%08x wd7:x%08x",
|
|
|
|
*(((uint32_t *) &nextiocb->iocb) + 4),
|
|
|
|
*(((uint32_t *) &nextiocb->iocb) + 6),
|
|
|
|
*(((uint32_t *) &nextiocb->iocb) + 7));
|
|
|
|
}
|
|
|
|
|
2005-04-17 14:05:31 -07:00
|
|
|
/*
|
|
|
|
* Issue iocb command to adapter
|
|
|
|
*/
|
2007-06-17 17:56:38 -07:00
|
|
|
lpfc_sli_pcimem_bcopy(&nextiocb->iocb, iocb, phba->iocb_cmd_size);
|
2005-04-17 14:05:31 -07:00
|
|
|
wmb();
|
|
|
|
pring->stats.iocb_cmd++;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* If there is no completion routine to call, we can release the
|
|
|
|
* IOCB buffer back right now. For IOCBs, like QUE_RING_BUF,
|
|
|
|
* that have no rsp ring completion, iocb_cmpl MUST be NULL.
|
|
|
|
*/
|
|
|
|
if (nextiocb->iocb_cmpl)
|
|
|
|
lpfc_sli_ringtxcmpl_put(phba, pring, nextiocb);
|
2005-10-29 08:28:33 -07:00
|
|
|
else
|
2007-06-17 17:56:36 -07:00
|
|
|
__lpfc_sli_release_iocbq(phba, nextiocb);
|
2005-04-17 14:05:31 -07:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Let the HBA know what IOCB slot will be the next one the
|
|
|
|
* driver will put a command into.
|
|
|
|
*/
|
|
|
|
pring->cmdidx = pring->next_cmdidx;
|
2007-06-17 17:56:37 -07:00
|
|
|
writel(pring->cmdidx, &phba->host_gp[pring->ringno].cmdPutInx);
|
2005-04-17 14:05:31 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2007-06-17 17:56:36 -07:00
|
|
|
lpfc_sli_update_full_ring(struct lpfc_hba *phba, struct lpfc_sli_ring *pring)
|
2005-04-17 14:05:31 -07:00
|
|
|
{
|
|
|
|
int ringno = pring->ringno;
|
|
|
|
|
|
|
|
pring->flag |= LPFC_CALL_RING_AVAILABLE;
|
|
|
|
|
|
|
|
wmb();
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Set ring 'ringno' to SET R0CE_REQ in Chip Att register.
|
|
|
|
* The HBA will tell us when an IOCB entry is available.
|
|
|
|
*/
|
|
|
|
writel((CA_R0ATT|CA_R0CE_REQ) << (ringno*4), phba->CAregaddr);
|
|
|
|
readl(phba->CAregaddr); /* flush */
|
|
|
|
|
|
|
|
pring->stats.iocb_cmd_full++;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2007-06-17 17:56:36 -07:00
|
|
|
lpfc_sli_update_ring(struct lpfc_hba *phba, struct lpfc_sli_ring *pring)
|
2005-04-17 14:05:31 -07:00
|
|
|
{
|
|
|
|
int ringno = pring->ringno;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Tell the HBA that there is work to do in this ring.
|
|
|
|
*/
|
|
|
|
wmb();
|
|
|
|
writel(CA_R0ATT << (ringno * 4), phba->CAregaddr);
|
|
|
|
readl(phba->CAregaddr); /* flush */
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2007-06-17 17:56:36 -07:00
|
|
|
lpfc_sli_resume_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring)
|
2005-04-17 14:05:31 -07:00
|
|
|
{
|
|
|
|
IOCB_t *iocb;
|
|
|
|
struct lpfc_iocbq *nextiocb;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Check to see if:
|
|
|
|
* (a) there is anything on the txq to send
|
|
|
|
* (b) link is up
|
|
|
|
* (c) link attention events can be processed (fcp ring only)
|
|
|
|
* (d) IOCB processing is not blocked by the outstanding mbox command.
|
|
|
|
*/
|
|
|
|
if (pring->txq_cnt &&
|
2007-06-17 17:56:36 -07:00
|
|
|
lpfc_is_link_up(phba) &&
|
2005-04-17 14:05:31 -07:00
|
|
|
(pring->ringno != phba->sli.fcp_ring ||
|
2007-10-27 10:37:25 -07:00
|
|
|
phba->sli.sli_flag & LPFC_PROCESS_LA)) {
|
2005-04-17 14:05:31 -07:00
|
|
|
|
|
|
|
while ((iocb = lpfc_sli_next_iocb_slot(phba, pring)) &&
|
|
|
|
(nextiocb = lpfc_sli_ringtx_get(phba, pring)))
|
|
|
|
lpfc_sli_submit_iocb(phba, pring, iocb, nextiocb);
|
|
|
|
|
|
|
|
if (iocb)
|
|
|
|
lpfc_sli_update_ring(phba, pring);
|
|
|
|
else
|
|
|
|
lpfc_sli_update_full_ring(phba, pring);
|
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2007-11-05 10:07:33 -07:00
|
|
|
static struct lpfc_hbq_entry *
|
2007-06-17 17:56:37 -07:00
|
|
|
lpfc_sli_next_hbq_slot(struct lpfc_hba *phba, uint32_t hbqno)
|
|
|
|
{
|
|
|
|
struct hbq_s *hbqp = &phba->hbqs[hbqno];
|
|
|
|
|
|
|
|
if (hbqp->next_hbqPutIdx == hbqp->hbqPutIdx &&
|
|
|
|
++hbqp->next_hbqPutIdx >= hbqp->entry_count)
|
|
|
|
hbqp->next_hbqPutIdx = 0;
|
|
|
|
|
|
|
|
if (unlikely(hbqp->local_hbqGetIdx == hbqp->next_hbqPutIdx)) {
|
2007-06-17 17:56:38 -07:00
|
|
|
uint32_t raw_index = phba->hbq_get[hbqno];
|
2007-06-17 17:56:37 -07:00
|
|
|
uint32_t getidx = le32_to_cpu(raw_index);
|
|
|
|
|
|
|
|
hbqp->local_hbqGetIdx = getidx;
|
|
|
|
|
|
|
|
if (unlikely(hbqp->local_hbqGetIdx >= hbqp->entry_count)) {
|
|
|
|
lpfc_printf_log(phba, KERN_ERR,
|
2007-06-17 17:56:38 -07:00
|
|
|
LOG_SLI | LOG_VPORT,
|
2007-08-02 08:10:09 -07:00
|
|
|
"1802 HBQ %d: local_hbqGetIdx "
|
2007-06-17 17:56:37 -07:00
|
|
|
"%u is > than hbqp->entry_count %u\n",
|
2007-08-02 08:10:09 -07:00
|
|
|
hbqno, hbqp->local_hbqGetIdx,
|
2007-06-17 17:56:37 -07:00
|
|
|
hbqp->entry_count);
|
|
|
|
|
|
|
|
phba->link_state = LPFC_HBA_ERROR;
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (hbqp->local_hbqGetIdx == hbqp->next_hbqPutIdx)
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2007-08-02 08:10:31 -07:00
|
|
|
return (struct lpfc_hbq_entry *) phba->hbqs[hbqno].hbq_virt +
|
|
|
|
hbqp->hbqPutIdx;
|
2007-06-17 17:56:37 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
lpfc_sli_hbqbuf_free_all(struct lpfc_hba *phba)
|
|
|
|
{
|
2007-06-17 17:56:38 -07:00
|
|
|
struct lpfc_dmabuf *dmabuf, *next_dmabuf;
|
|
|
|
struct hbq_dmabuf *hbq_buf;
|
2007-08-02 08:10:31 -07:00
|
|
|
int i, hbq_count;
|
2007-06-17 17:56:37 -07:00
|
|
|
|
2007-08-02 08:10:31 -07:00
|
|
|
hbq_count = lpfc_sli_hbq_count();
|
2007-06-17 17:56:37 -07:00
|
|
|
/* Return all memory used by all HBQs */
|
2007-08-02 08:10:31 -07:00
|
|
|
for (i = 0; i < hbq_count; ++i) {
|
|
|
|
list_for_each_entry_safe(dmabuf, next_dmabuf,
|
|
|
|
&phba->hbqs[i].hbq_buffer_list, list) {
|
|
|
|
hbq_buf = container_of(dmabuf, struct hbq_dmabuf, dbuf);
|
|
|
|
list_del(&hbq_buf->dbuf.list);
|
|
|
|
(phba->hbqs[i].hbq_free_buffer)(phba, hbq_buf);
|
|
|
|
}
|
2007-10-27 10:37:53 -07:00
|
|
|
phba->hbqs[i].buffer_count = 0;
|
2007-06-17 17:56:37 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-08-02 08:10:31 -07:00
|
|
|
static struct lpfc_hbq_entry *
|
2007-06-17 17:56:37 -07:00
|
|
|
lpfc_sli_hbq_to_firmware(struct lpfc_hba *phba, uint32_t hbqno,
|
2007-06-17 17:56:38 -07:00
|
|
|
struct hbq_dmabuf *hbq_buf)
|
2007-06-17 17:56:37 -07:00
|
|
|
{
|
|
|
|
struct lpfc_hbq_entry *hbqe;
|
2007-06-17 17:56:38 -07:00
|
|
|
dma_addr_t physaddr = hbq_buf->dbuf.phys;
|
2007-06-17 17:56:37 -07:00
|
|
|
|
|
|
|
/* Get next HBQ entry slot to use */
|
|
|
|
hbqe = lpfc_sli_next_hbq_slot(phba, hbqno);
|
|
|
|
if (hbqe) {
|
|
|
|
struct hbq_s *hbqp = &phba->hbqs[hbqno];
|
|
|
|
|
2007-06-17 17:56:38 -07:00
|
|
|
hbqe->bde.addrHigh = le32_to_cpu(putPaddrHigh(physaddr));
|
|
|
|
hbqe->bde.addrLow = le32_to_cpu(putPaddrLow(physaddr));
|
2007-08-02 08:10:31 -07:00
|
|
|
hbqe->bde.tus.f.bdeSize = hbq_buf->size;
|
2007-06-17 17:56:37 -07:00
|
|
|
hbqe->bde.tus.f.bdeFlags = 0;
|
2007-06-17 17:56:38 -07:00
|
|
|
hbqe->bde.tus.w = le32_to_cpu(hbqe->bde.tus.w);
|
|
|
|
hbqe->buffer_tag = le32_to_cpu(hbq_buf->tag);
|
|
|
|
/* Sync SLIM */
|
2007-06-17 17:56:37 -07:00
|
|
|
hbqp->hbqPutIdx = hbqp->next_hbqPutIdx;
|
|
|
|
writel(hbqp->hbqPutIdx, phba->hbq_put + hbqno);
|
2007-06-17 17:56:38 -07:00
|
|
|
/* flush */
|
2007-06-17 17:56:37 -07:00
|
|
|
readl(phba->hbq_put + hbqno);
|
2007-08-02 08:10:31 -07:00
|
|
|
list_add_tail(&hbq_buf->dbuf.list, &hbqp->hbq_buffer_list);
|
2007-06-17 17:56:37 -07:00
|
|
|
}
|
2007-08-02 08:10:31 -07:00
|
|
|
return hbqe;
|
2007-06-17 17:56:37 -07:00
|
|
|
}
|
|
|
|
|
2007-06-17 17:56:38 -07:00
|
|
|
static struct lpfc_hbq_init lpfc_els_hbq = {
|
|
|
|
.rn = 1,
|
|
|
|
.entry_count = 200,
|
|
|
|
.mask_count = 0,
|
|
|
|
.profile = 0,
|
2007-08-02 08:10:31 -07:00
|
|
|
.ring_mask = (1 << LPFC_ELS_RING),
|
2007-06-17 17:56:38 -07:00
|
|
|
.buffer_count = 0,
|
|
|
|
.init_count = 20,
|
|
|
|
.add_count = 5,
|
|
|
|
};
|
2007-06-17 17:56:37 -07:00
|
|
|
|
2007-08-02 08:10:31 -07:00
|
|
|
static struct lpfc_hbq_init lpfc_extra_hbq = {
|
|
|
|
.rn = 1,
|
|
|
|
.entry_count = 200,
|
|
|
|
.mask_count = 0,
|
|
|
|
.profile = 0,
|
|
|
|
.ring_mask = (1 << LPFC_EXTRA_RING),
|
|
|
|
.buffer_count = 0,
|
|
|
|
.init_count = 0,
|
|
|
|
.add_count = 5,
|
|
|
|
};
|
|
|
|
|
2007-08-02 08:10:21 -07:00
|
|
|
struct lpfc_hbq_init *lpfc_hbq_defs[] = {
|
2007-06-17 17:56:38 -07:00
|
|
|
&lpfc_els_hbq,
|
2007-08-02 08:10:31 -07:00
|
|
|
&lpfc_extra_hbq,
|
2007-06-17 17:56:38 -07:00
|
|
|
};
|
2007-06-17 17:56:37 -07:00
|
|
|
|
2007-08-02 08:10:37 -07:00
|
|
|
static int
|
2007-06-17 17:56:38 -07:00
|
|
|
lpfc_sli_hbqbuf_fill_hbqs(struct lpfc_hba *phba, uint32_t hbqno, uint32_t count)
|
2007-06-17 17:56:37 -07:00
|
|
|
{
|
2007-06-17 17:56:38 -07:00
|
|
|
uint32_t i, start, end;
|
|
|
|
struct hbq_dmabuf *hbq_buffer;
|
2007-06-17 17:56:37 -07:00
|
|
|
|
2007-08-02 08:10:31 -07:00
|
|
|
if (!phba->hbqs[hbqno].hbq_alloc_buffer) {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2007-10-27 10:37:53 -07:00
|
|
|
start = phba->hbqs[hbqno].buffer_count;
|
|
|
|
end = count + start;
|
2007-06-17 17:56:38 -07:00
|
|
|
if (end > lpfc_hbq_defs[hbqno]->entry_count) {
|
|
|
|
end = lpfc_hbq_defs[hbqno]->entry_count;
|
|
|
|
}
|
2007-06-17 17:56:37 -07:00
|
|
|
|
|
|
|
/* Populate HBQ entries */
|
2007-06-17 17:56:38 -07:00
|
|
|
for (i = start; i < end; i++) {
|
2007-08-02 08:10:31 -07:00
|
|
|
hbq_buffer = (phba->hbqs[hbqno].hbq_alloc_buffer)(phba);
|
2007-06-17 17:56:38 -07:00
|
|
|
if (!hbq_buffer)
|
|
|
|
return 1;
|
|
|
|
hbq_buffer->tag = (i | (hbqno << 16));
|
2007-08-02 08:10:31 -07:00
|
|
|
if (lpfc_sli_hbq_to_firmware(phba, hbqno, hbq_buffer))
|
2007-10-27 10:37:53 -07:00
|
|
|
phba->hbqs[hbqno].buffer_count++;
|
2007-08-02 08:10:31 -07:00
|
|
|
else
|
|
|
|
(phba->hbqs[hbqno].hbq_free_buffer)(phba, hbq_buffer);
|
2007-06-17 17:56:37 -07:00
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2007-06-17 17:56:38 -07:00
|
|
|
int
|
|
|
|
lpfc_sli_hbqbuf_add_hbqs(struct lpfc_hba *phba, uint32_t qno)
|
2007-06-17 17:56:37 -07:00
|
|
|
{
|
2007-06-17 17:56:38 -07:00
|
|
|
return(lpfc_sli_hbqbuf_fill_hbqs(phba, qno,
|
|
|
|
lpfc_hbq_defs[qno]->add_count));
|
|
|
|
}
|
2007-06-17 17:56:37 -07:00
|
|
|
|
2007-11-05 10:07:33 -07:00
|
|
|
static int
|
2007-06-17 17:56:38 -07:00
|
|
|
lpfc_sli_hbqbuf_init_hbqs(struct lpfc_hba *phba, uint32_t qno)
|
|
|
|
{
|
|
|
|
return(lpfc_sli_hbqbuf_fill_hbqs(phba, qno,
|
|
|
|
lpfc_hbq_defs[qno]->init_count));
|
2007-06-17 17:56:37 -07:00
|
|
|
}
|
|
|
|
|
2007-11-05 10:07:33 -07:00
|
|
|
static struct hbq_dmabuf *
|
2007-06-17 17:56:38 -07:00
|
|
|
lpfc_sli_hbqbuf_find(struct lpfc_hba *phba, uint32_t tag)
|
2007-06-17 17:56:37 -07:00
|
|
|
{
|
2007-06-17 17:56:38 -07:00
|
|
|
struct lpfc_dmabuf *d_buf;
|
|
|
|
struct hbq_dmabuf *hbq_buf;
|
2007-08-02 08:10:31 -07:00
|
|
|
uint32_t hbqno;
|
|
|
|
|
|
|
|
hbqno = tag >> 16;
|
2007-08-09 11:47:15 -07:00
|
|
|
if (hbqno >= LPFC_MAX_HBQS)
|
2007-08-02 08:10:31 -07:00
|
|
|
return NULL;
|
2007-06-17 17:56:37 -07:00
|
|
|
|
2007-08-02 08:10:31 -07:00
|
|
|
list_for_each_entry(d_buf, &phba->hbqs[hbqno].hbq_buffer_list, list) {
|
2007-06-17 17:56:38 -07:00
|
|
|
hbq_buf = container_of(d_buf, struct hbq_dmabuf, dbuf);
|
2007-08-02 08:10:31 -07:00
|
|
|
if (hbq_buf->tag == tag) {
|
2007-06-17 17:56:38 -07:00
|
|
|
return hbq_buf;
|
2007-06-17 17:56:37 -07:00
|
|
|
}
|
|
|
|
}
|
2007-06-17 17:56:38 -07:00
|
|
|
lpfc_printf_log(phba, KERN_ERR, LOG_SLI | LOG_VPORT,
|
2007-08-02 08:10:09 -07:00
|
|
|
"1803 Bad hbq tag. Data: x%x x%x\n",
|
2007-10-27 10:37:53 -07:00
|
|
|
tag, phba->hbqs[tag >> 16].buffer_count);
|
2007-06-17 17:56:38 -07:00
|
|
|
return NULL;
|
2007-06-17 17:56:37 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2007-08-02 08:10:31 -07:00
|
|
|
lpfc_sli_free_hbq(struct lpfc_hba *phba, struct hbq_dmabuf *hbq_buffer)
|
2007-06-17 17:56:37 -07:00
|
|
|
{
|
|
|
|
uint32_t hbqno;
|
|
|
|
|
2007-08-02 08:10:31 -07:00
|
|
|
if (hbq_buffer) {
|
|
|
|
hbqno = hbq_buffer->tag >> 16;
|
|
|
|
if (!lpfc_sli_hbq_to_firmware(phba, hbqno, hbq_buffer)) {
|
|
|
|
(phba->hbqs[hbqno].hbq_free_buffer)(phba, hbq_buffer);
|
|
|
|
}
|
2007-06-17 17:56:37 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-04-17 14:05:31 -07:00
|
|
|
static int
|
|
|
|
lpfc_sli_chk_mbx_command(uint8_t mbxCommand)
|
|
|
|
{
|
|
|
|
uint8_t ret;
|
|
|
|
|
|
|
|
switch (mbxCommand) {
|
|
|
|
case MBX_LOAD_SM:
|
|
|
|
case MBX_READ_NV:
|
|
|
|
case MBX_WRITE_NV:
|
2007-10-27 10:37:53 -07:00
|
|
|
case MBX_WRITE_VPARMS:
|
2005-04-17 14:05:31 -07:00
|
|
|
case MBX_RUN_BIU_DIAG:
|
|
|
|
case MBX_INIT_LINK:
|
|
|
|
case MBX_DOWN_LINK:
|
|
|
|
case MBX_CONFIG_LINK:
|
|
|
|
case MBX_CONFIG_RING:
|
|
|
|
case MBX_RESET_RING:
|
|
|
|
case MBX_READ_CONFIG:
|
|
|
|
case MBX_READ_RCONFIG:
|
|
|
|
case MBX_READ_SPARM:
|
|
|
|
case MBX_READ_STATUS:
|
|
|
|
case MBX_READ_RPI:
|
|
|
|
case MBX_READ_XRI:
|
|
|
|
case MBX_READ_REV:
|
|
|
|
case MBX_READ_LNK_STAT:
|
|
|
|
case MBX_REG_LOGIN:
|
|
|
|
case MBX_UNREG_LOGIN:
|
|
|
|
case MBX_READ_LA:
|
|
|
|
case MBX_CLEAR_LA:
|
|
|
|
case MBX_DUMP_MEMORY:
|
|
|
|
case MBX_DUMP_CONTEXT:
|
|
|
|
case MBX_RUN_DIAGS:
|
|
|
|
case MBX_RESTART:
|
|
|
|
case MBX_UPDATE_CFG:
|
|
|
|
case MBX_DOWN_LOAD:
|
|
|
|
case MBX_DEL_LD_ENTRY:
|
|
|
|
case MBX_RUN_PROGRAM:
|
|
|
|
case MBX_SET_MASK:
|
|
|
|
case MBX_SET_SLIM:
|
|
|
|
case MBX_UNREG_D_ID:
|
2006-02-28 17:25:27 -07:00
|
|
|
case MBX_KILL_BOARD:
|
2005-04-17 14:05:31 -07:00
|
|
|
case MBX_CONFIG_FARP:
|
2006-02-28 17:25:27 -07:00
|
|
|
case MBX_BEACON:
|
2005-04-17 14:05:31 -07:00
|
|
|
case MBX_LOAD_AREA:
|
|
|
|
case MBX_RUN_BIU_DIAG64:
|
|
|
|
case MBX_CONFIG_PORT:
|
|
|
|
case MBX_READ_SPARM64:
|
|
|
|
case MBX_READ_RPI64:
|
|
|
|
case MBX_REG_LOGIN64:
|
|
|
|
case MBX_READ_LA64:
|
|
|
|
case MBX_FLASH_WR_ULA:
|
|
|
|
case MBX_SET_DEBUG:
|
|
|
|
case MBX_LOAD_EXP_ROM:
|
2007-10-27 10:37:05 -07:00
|
|
|
case MBX_ASYNCEVT_ENABLE:
|
2007-06-17 17:56:38 -07:00
|
|
|
case MBX_REG_VPI:
|
|
|
|
case MBX_UNREG_VPI:
|
2007-06-17 17:56:39 -07:00
|
|
|
case MBX_HEARTBEAT:
|
2005-04-17 14:05:31 -07:00
|
|
|
ret = mbxCommand;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
ret = MBX_SHUTDOWN;
|
|
|
|
break;
|
|
|
|
}
|
2007-06-17 17:56:36 -07:00
|
|
|
return ret;
|
2005-04-17 14:05:31 -07:00
|
|
|
}
|
|
|
|
static void
|
2007-06-17 17:56:36 -07:00
|
|
|
lpfc_sli_wake_mbox_wait(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmboxq)
|
2005-04-17 14:05:31 -07:00
|
|
|
{
|
|
|
|
wait_queue_head_t *pdone_q;
|
2007-06-17 17:56:39 -07:00
|
|
|
unsigned long drvr_flag;
|
2005-04-17 14:05:31 -07:00
|
|
|
|
|
|
|
/*
|
|
|
|
* If pdone_q is empty, the driver thread gave up waiting and
|
|
|
|
* continued running.
|
|
|
|
*/
|
2007-04-25 06:52:34 -07:00
|
|
|
pmboxq->mbox_flag |= LPFC_MBX_WAKE;
|
2007-06-17 17:56:39 -07:00
|
|
|
spin_lock_irqsave(&phba->hbalock, drvr_flag);
|
2005-04-17 14:05:31 -07:00
|
|
|
pdone_q = (wait_queue_head_t *) pmboxq->context1;
|
|
|
|
if (pdone_q)
|
|
|
|
wake_up_interruptible(pdone_q);
|
2007-06-17 17:56:39 -07:00
|
|
|
spin_unlock_irqrestore(&phba->hbalock, drvr_flag);
|
2005-04-17 14:05:31 -07:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2007-06-17 17:56:36 -07:00
|
|
|
lpfc_sli_def_mbox_cmpl(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
|
2005-04-17 14:05:31 -07:00
|
|
|
{
|
|
|
|
struct lpfc_dmabuf *mp;
|
2007-04-25 06:52:34 -07:00
|
|
|
uint16_t rpi;
|
|
|
|
int rc;
|
|
|
|
|
2005-04-17 14:05:31 -07:00
|
|
|
mp = (struct lpfc_dmabuf *) (pmb->context1);
|
2007-04-25 06:52:34 -07:00
|
|
|
|
2005-04-17 14:05:31 -07:00
|
|
|
if (mp) {
|
|
|
|
lpfc_mbuf_free(phba, mp->virt, mp->phys);
|
|
|
|
kfree(mp);
|
|
|
|
}
|
2007-04-25 06:52:34 -07:00
|
|
|
|
|
|
|
/*
|
|
|
|
* If a REG_LOGIN succeeded after node is destroyed or node
|
|
|
|
* is in re-discovery driver need to cleanup the RPI.
|
|
|
|
*/
|
2007-06-17 17:56:36 -07:00
|
|
|
if (!(phba->pport->load_flag & FC_UNLOADING) &&
|
|
|
|
pmb->mb.mbxCommand == MBX_REG_LOGIN64 &&
|
|
|
|
!pmb->mb.mbxStatus) {
|
2007-04-25 06:52:34 -07:00
|
|
|
|
|
|
|
rpi = pmb->mb.un.varWords[0];
|
2007-06-17 17:56:38 -07:00
|
|
|
lpfc_unreg_login(phba, pmb->mb.un.varRegLogin.vpi, rpi, pmb);
|
|
|
|
pmb->mbox_cmpl = lpfc_sli_def_mbox_cmpl;
|
2007-04-25 06:52:34 -07:00
|
|
|
rc = lpfc_sli_issue_mbox(phba, pmb, MBX_NOWAIT);
|
|
|
|
if (rc != MBX_NOT_FINISHED)
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2007-06-17 17:56:36 -07:00
|
|
|
mempool_free(pmb, phba->mbox_mem_pool);
|
2005-04-17 14:05:31 -07:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2007-06-17 17:56:36 -07:00
|
|
|
lpfc_sli_handle_mb_event(struct lpfc_hba *phba)
|
2005-04-17 14:05:31 -07:00
|
|
|
{
|
2007-06-17 17:56:38 -07:00
|
|
|
MAILBOX_t *pmbox;
|
2005-04-17 14:05:31 -07:00
|
|
|
LPFC_MBOXQ_t *pmb;
|
2007-06-17 17:56:38 -07:00
|
|
|
int rc;
|
|
|
|
LIST_HEAD(cmplq);
|
2005-04-17 14:05:31 -07:00
|
|
|
|
|
|
|
phba->sli.slistat.mbox_event++;
|
|
|
|
|
2007-06-17 17:56:38 -07:00
|
|
|
/* Get all completed mailboxe buffers into the cmplq */
|
|
|
|
spin_lock_irq(&phba->hbalock);
|
|
|
|
list_splice_init(&phba->sli.mboxq_cmpl, &cmplq);
|
|
|
|
spin_unlock_irq(&phba->hbalock);
|
2005-04-17 14:05:31 -07:00
|
|
|
|
2007-06-17 17:56:38 -07:00
|
|
|
/* Get a Mailbox buffer to setup mailbox commands for callback */
|
|
|
|
do {
|
|
|
|
list_remove_head(&cmplq, pmb, LPFC_MBOXQ_t, list);
|
|
|
|
if (pmb == NULL)
|
|
|
|
break;
|
2007-06-17 17:56:36 -07:00
|
|
|
|
2007-06-17 17:56:38 -07:00
|
|
|
pmbox = &pmb->mb;
|
2005-04-17 14:05:31 -07:00
|
|
|
|
2007-06-17 17:56:39 -07:00
|
|
|
if (pmbox->mbxCommand != MBX_HEARTBEAT) {
|
|
|
|
if (pmb->vport) {
|
|
|
|
lpfc_debugfs_disc_trc(pmb->vport,
|
|
|
|
LPFC_DISC_TRC_MBOX_VPORT,
|
|
|
|
"MBOX cmpl vport: cmd:x%x mb:x%x x%x",
|
|
|
|
(uint32_t)pmbox->mbxCommand,
|
|
|
|
pmbox->un.varWords[0],
|
|
|
|
pmbox->un.varWords[1]);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
lpfc_debugfs_disc_trc(phba->pport,
|
|
|
|
LPFC_DISC_TRC_MBOX,
|
|
|
|
"MBOX cmpl: cmd:x%x mb:x%x x%x",
|
|
|
|
(uint32_t)pmbox->mbxCommand,
|
|
|
|
pmbox->un.varWords[0],
|
|
|
|
pmbox->un.varWords[1]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-04-17 14:05:31 -07:00
|
|
|
/*
|
|
|
|
* It is a fatal error if unknown mbox command completion.
|
|
|
|
*/
|
|
|
|
if (lpfc_sli_chk_mbx_command(pmbox->mbxCommand) ==
|
|
|
|
MBX_SHUTDOWN) {
|
|
|
|
/* Unknow mailbox command compl */
|
2007-06-17 17:56:38 -07:00
|
|
|
lpfc_printf_log(phba, KERN_ERR, LOG_MBOX | LOG_SLI,
|
2007-08-02 08:10:09 -07:00
|
|
|
"(%d):0323 Unknown Mailbox command "
|
2007-06-17 17:56:38 -07:00
|
|
|
"%x Cmpl\n",
|
|
|
|
pmb->vport ? pmb->vport->vpi : 0,
|
|
|
|
pmbox->mbxCommand);
|
2007-06-17 17:56:36 -07:00
|
|
|
phba->link_state = LPFC_HBA_ERROR;
|
2005-04-17 14:05:31 -07:00
|
|
|
phba->work_hs = HS_FFER3;
|
|
|
|
lpfc_handle_eratt(phba);
|
2007-06-17 17:56:38 -07:00
|
|
|
continue;
|
2005-04-17 14:05:31 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
if (pmbox->mbxStatus) {
|
|
|
|
phba->sli.slistat.mbox_stat_err++;
|
|
|
|
if (pmbox->mbxStatus == MBXERR_NO_RESOURCES) {
|
|
|
|
/* Mbox cmd cmpl error - RETRYing */
|
2007-06-17 17:56:38 -07:00
|
|
|
lpfc_printf_log(phba, KERN_INFO,
|
|
|
|
LOG_MBOX | LOG_SLI,
|
2007-08-02 08:10:09 -07:00
|
|
|
"(%d):0305 Mbox cmd cmpl "
|
2007-06-17 17:56:38 -07:00
|
|
|
"error - RETRYing Data: x%x "
|
|
|
|
"x%x x%x x%x\n",
|
|
|
|
pmb->vport ? pmb->vport->vpi :0,
|
|
|
|
pmbox->mbxCommand,
|
|
|
|
pmbox->mbxStatus,
|
|
|
|
pmbox->un.varWords[0],
|
|
|
|
pmb->vport->port_state);
|
2005-04-17 14:05:31 -07:00
|
|
|
pmbox->mbxStatus = 0;
|
|
|
|
pmbox->mbxOwner = OWN_HOST;
|
2007-06-17 17:56:36 -07:00
|
|
|
spin_lock_irq(&phba->hbalock);
|
2005-04-17 14:05:31 -07:00
|
|
|
phba->sli.sli_flag &= ~LPFC_SLI_MBOX_ACTIVE;
|
2007-06-17 17:56:36 -07:00
|
|
|
spin_unlock_irq(&phba->hbalock);
|
2005-04-17 14:05:31 -07:00
|
|
|
rc = lpfc_sli_issue_mbox(phba, pmb, MBX_NOWAIT);
|
|
|
|
if (rc == MBX_SUCCESS)
|
2007-06-17 17:56:38 -07:00
|
|
|
continue;
|
2005-04-17 14:05:31 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Mailbox cmd <cmd> Cmpl <cmpl> */
|
2007-06-17 17:56:38 -07:00
|
|
|
lpfc_printf_log(phba, KERN_INFO, LOG_MBOX | LOG_SLI,
|
2007-08-02 08:10:09 -07:00
|
|
|
"(%d):0307 Mailbox cmd x%x Cmpl x%p "
|
2005-04-17 14:05:31 -07:00
|
|
|
"Data: x%x x%x x%x x%x x%x x%x x%x x%x x%x\n",
|
2007-06-17 17:56:38 -07:00
|
|
|
pmb->vport ? pmb->vport->vpi : 0,
|
2005-04-17 14:05:31 -07:00
|
|
|
pmbox->mbxCommand,
|
|
|
|
pmb->mbox_cmpl,
|
|
|
|
*((uint32_t *) pmbox),
|
|
|
|
pmbox->un.varWords[0],
|
|
|
|
pmbox->un.varWords[1],
|
|
|
|
pmbox->un.varWords[2],
|
|
|
|
pmbox->un.varWords[3],
|
|
|
|
pmbox->un.varWords[4],
|
|
|
|
pmbox->un.varWords[5],
|
|
|
|
pmbox->un.varWords[6],
|
|
|
|
pmbox->un.varWords[7]);
|
|
|
|
|
2007-06-17 17:56:38 -07:00
|
|
|
if (pmb->mbox_cmpl)
|
2005-04-17 14:05:31 -07:00
|
|
|
pmb->mbox_cmpl(phba,pmb);
|
2007-06-17 17:56:38 -07:00
|
|
|
} while (1);
|
|
|
|
return 0;
|
|
|
|
}
|
2005-04-17 14:05:31 -07:00
|
|
|
|
2007-06-17 17:56:38 -07:00
|
|
|
static struct lpfc_dmabuf *
|
|
|
|
lpfc_sli_replace_hbqbuff(struct lpfc_hba *phba, uint32_t tag)
|
|
|
|
{
|
|
|
|
struct hbq_dmabuf *hbq_entry, *new_hbq_entry;
|
2007-08-02 08:10:31 -07:00
|
|
|
uint32_t hbqno;
|
|
|
|
void *virt; /* virtual address ptr */
|
|
|
|
dma_addr_t phys; /* mapped address */
|
2005-04-17 14:05:31 -07:00
|
|
|
|
2007-06-17 17:56:38 -07:00
|
|
|
hbq_entry = lpfc_sli_hbqbuf_find(phba, tag);
|
|
|
|
if (hbq_entry == NULL)
|
|
|
|
return NULL;
|
|
|
|
list_del(&hbq_entry->dbuf.list);
|
2007-08-02 08:10:31 -07:00
|
|
|
|
|
|
|
hbqno = tag >> 16;
|
|
|
|
new_hbq_entry = (phba->hbqs[hbqno].hbq_alloc_buffer)(phba);
|
2007-06-17 17:56:38 -07:00
|
|
|
if (new_hbq_entry == NULL)
|
|
|
|
return &hbq_entry->dbuf;
|
|
|
|
new_hbq_entry->tag = -1;
|
2007-08-02 08:10:31 -07:00
|
|
|
phys = new_hbq_entry->dbuf.phys;
|
|
|
|
virt = new_hbq_entry->dbuf.virt;
|
|
|
|
new_hbq_entry->dbuf.phys = hbq_entry->dbuf.phys;
|
|
|
|
new_hbq_entry->dbuf.virt = hbq_entry->dbuf.virt;
|
|
|
|
hbq_entry->dbuf.phys = phys;
|
|
|
|
hbq_entry->dbuf.virt = virt;
|
2007-06-17 17:56:38 -07:00
|
|
|
lpfc_sli_free_hbq(phba, hbq_entry);
|
|
|
|
return &new_hbq_entry->dbuf;
|
2005-04-17 14:05:31 -07:00
|
|
|
}
|
2007-06-17 17:56:38 -07:00
|
|
|
|
2007-10-27 10:38:00 -07:00
|
|
|
static struct lpfc_dmabuf *
|
|
|
|
lpfc_sli_get_buff(struct lpfc_hba *phba,
|
|
|
|
struct lpfc_sli_ring *pring,
|
|
|
|
uint32_t tag)
|
|
|
|
{
|
|
|
|
if (tag & QUE_BUFTAG_BIT)
|
|
|
|
return lpfc_sli_ring_taggedbuf_get(phba, pring, tag);
|
|
|
|
else
|
|
|
|
return lpfc_sli_replace_hbqbuff(phba, tag);
|
|
|
|
}
|
2007-10-27 10:37:05 -07:00
|
|
|
|
2005-04-17 14:05:31 -07:00
|
|
|
static int
|
|
|
|
lpfc_sli_process_unsol_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
|
|
|
|
struct lpfc_iocbq *saveq)
|
|
|
|
{
|
|
|
|
IOCB_t * irsp;
|
|
|
|
WORD5 * w5p;
|
|
|
|
uint32_t Rctl, Type;
|
|
|
|
uint32_t match, i;
|
2007-10-27 10:38:00 -07:00
|
|
|
struct lpfc_iocbq *iocbq;
|
2005-04-17 14:05:31 -07:00
|
|
|
|
|
|
|
match = 0;
|
|
|
|
irsp = &(saveq->iocb);
|
2007-10-27 10:37:05 -07:00
|
|
|
|
|
|
|
if (irsp->ulpCommand == CMD_ASYNC_STATUS) {
|
|
|
|
if (pring->lpfc_sli_rcv_async_status)
|
|
|
|
pring->lpfc_sli_rcv_async_status(phba, pring, saveq);
|
|
|
|
else
|
|
|
|
lpfc_printf_log(phba,
|
|
|
|
KERN_WARNING,
|
|
|
|
LOG_SLI,
|
|
|
|
"0316 Ring %d handler: unexpected "
|
|
|
|
"ASYNC_STATUS iocb received evt_code "
|
|
|
|
"0x%x\n",
|
|
|
|
pring->ringno,
|
|
|
|
irsp->un.asyncstat.evt_code);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2005-04-17 14:05:31 -07:00
|
|
|
if ((irsp->ulpCommand == CMD_RCV_ELS_REQ64_CX)
|
2007-06-17 17:56:37 -07:00
|
|
|
|| (irsp->ulpCommand == CMD_RCV_ELS_REQ_CX)
|
|
|
|
|| (irsp->ulpCommand == CMD_IOCB_RCV_ELS64_CX)
|
|
|
|
|| (irsp->ulpCommand == CMD_IOCB_RCV_CONT64_CX)) {
|
2005-04-17 14:05:31 -07:00
|
|
|
Rctl = FC_ELS_REQ;
|
|
|
|
Type = FC_ELS_DATA;
|
|
|
|
} else {
|
|
|
|
w5p =
|
|
|
|
(WORD5 *) & (saveq->iocb.un.
|
|
|
|
ulpWord[5]);
|
|
|
|
Rctl = w5p->hcsw.Rctl;
|
|
|
|
Type = w5p->hcsw.Type;
|
|
|
|
|
|
|
|
/* Firmware Workaround */
|
|
|
|
if ((Rctl == 0) && (pring->ringno == LPFC_ELS_RING) &&
|
2007-06-17 17:56:38 -07:00
|
|
|
(irsp->ulpCommand == CMD_RCV_SEQUENCE64_CX ||
|
|
|
|
irsp->ulpCommand == CMD_IOCB_RCV_SEQ64_CX)) {
|
2005-04-17 14:05:31 -07:00
|
|
|
Rctl = FC_ELS_REQ;
|
|
|
|
Type = FC_ELS_DATA;
|
|
|
|
w5p->hcsw.Rctl = Rctl;
|
|
|
|
w5p->hcsw.Type = Type;
|
|
|
|
}
|
|
|
|
}
|
2007-06-17 17:56:38 -07:00
|
|
|
|
|
|
|
if (phba->sli3_options & LPFC_SLI3_HBQ_ENABLED) {
|
2007-10-27 10:38:00 -07:00
|
|
|
struct lpfc_hbq_entry *hbqe_1, *hbqe_2;
|
|
|
|
hbqe_1 = (struct lpfc_hbq_entry *) &saveq->iocb.un.ulpWord[0];
|
|
|
|
hbqe_2 = (struct lpfc_hbq_entry *) &saveq->iocb.
|
|
|
|
unsli3.sli3Words[4];
|
|
|
|
|
|
|
|
if (irsp->ulpBdeCount != 0) {
|
|
|
|
saveq->context2 = lpfc_sli_get_buff(phba, pring,
|
|
|
|
irsp->un.ulpWord[3]);
|
|
|
|
if (!saveq->context2)
|
|
|
|
lpfc_printf_log(phba,
|
|
|
|
KERN_ERR,
|
|
|
|
LOG_SLI,
|
|
|
|
"0341 Ring %d Cannot find buffer for "
|
|
|
|
"an unsolicited iocb. tag 0x%x\n",
|
|
|
|
pring->ringno,
|
|
|
|
irsp->un.ulpWord[3]);
|
|
|
|
|
|
|
|
}
|
|
|
|
if (irsp->ulpBdeCount == 2) {
|
|
|
|
saveq->context3 = lpfc_sli_get_buff(phba, pring,
|
|
|
|
irsp->unsli3.sli3Words[7]);
|
|
|
|
if (!saveq->context3)
|
|
|
|
lpfc_printf_log(phba,
|
|
|
|
KERN_ERR,
|
|
|
|
LOG_SLI,
|
|
|
|
"0342 Ring %d Cannot find buffer for an"
|
|
|
|
" unsolicited iocb. tag 0x%x\n",
|
|
|
|
pring->ringno,
|
|
|
|
irsp->unsli3.sli3Words[7]);
|
|
|
|
}
|
|
|
|
list_for_each_entry(iocbq, &saveq->list, list) {
|
|
|
|
hbqe_1 = (struct lpfc_hbq_entry *) &iocbq->iocb.
|
|
|
|
un.ulpWord[0];
|
|
|
|
hbqe_2 = (struct lpfc_hbq_entry *) &iocbq->iocb.
|
|
|
|
unsli3.sli3Words[4];
|
|
|
|
irsp = &(iocbq->iocb);
|
|
|
|
|
|
|
|
if (irsp->ulpBdeCount != 0) {
|
|
|
|
iocbq->context2 = lpfc_sli_get_buff(phba, pring,
|
|
|
|
irsp->un.ulpWord[3]);
|
|
|
|
if (!saveq->context2)
|
|
|
|
lpfc_printf_log(phba,
|
|
|
|
KERN_ERR,
|
|
|
|
LOG_SLI,
|
|
|
|
"0343 Ring %d Cannot find "
|
|
|
|
"buffer for an unsolicited iocb"
|
|
|
|
". tag 0x%x\n", pring->ringno,
|
2007-06-17 17:56:38 -07:00
|
|
|
irsp->un.ulpWord[3]);
|
2007-10-27 10:38:00 -07:00
|
|
|
}
|
|
|
|
if (irsp->ulpBdeCount == 2) {
|
|
|
|
iocbq->context3 = lpfc_sli_get_buff(phba, pring,
|
2007-08-02 08:10:31 -07:00
|
|
|
irsp->unsli3.sli3Words[7]);
|
2007-10-27 10:38:00 -07:00
|
|
|
if (!saveq->context3)
|
|
|
|
lpfc_printf_log(phba,
|
|
|
|
KERN_ERR,
|
|
|
|
LOG_SLI,
|
|
|
|
"0344 Ring %d Cannot find "
|
|
|
|
"buffer for an unsolicited "
|
|
|
|
"iocb. tag 0x%x\n",
|
|
|
|
pring->ringno,
|
|
|
|
irsp->unsli3.sli3Words[7]);
|
|
|
|
}
|
|
|
|
}
|
2007-06-17 17:56:38 -07:00
|
|
|
}
|
|
|
|
|
2005-04-17 14:05:31 -07:00
|
|
|
/* unSolicited Responses */
|
|
|
|
if (pring->prt[0].profile) {
|
2006-02-28 20:33:08 -07:00
|
|
|
if (pring->prt[0].lpfc_sli_rcv_unsol_event)
|
|
|
|
(pring->prt[0].lpfc_sli_rcv_unsol_event) (phba, pring,
|
|
|
|
saveq);
|
2005-04-17 14:05:31 -07:00
|
|
|
match = 1;
|
|
|
|
} else {
|
|
|
|
/* We must search, based on rctl / type
|
|
|
|
for the right routine */
|
|
|
|
for (i = 0; i < pring->num_mask;
|
|
|
|
i++) {
|
|
|
|
if ((pring->prt[i].rctl ==
|
|
|
|
Rctl)
|
|
|
|
&& (pring->prt[i].
|
|
|
|
type == Type)) {
|
2006-02-28 20:33:08 -07:00
|
|
|
if (pring->prt[i].lpfc_sli_rcv_unsol_event)
|
|
|
|
(pring->prt[i].lpfc_sli_rcv_unsol_event)
|
|
|
|
(phba, pring, saveq);
|
2005-04-17 14:05:31 -07:00
|
|
|
match = 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (match == 0) {
|
|
|
|
/* Unexpected Rctl / Type received */
|
|
|
|
/* Ring <ringno> handler: unexpected
|
|
|
|
Rctl <Rctl> Type <Type> received */
|
2007-06-17 17:56:38 -07:00
|
|
|
lpfc_printf_log(phba, KERN_WARNING, LOG_SLI,
|
2007-08-02 08:10:09 -07:00
|
|
|
"0313 Ring %d handler: unexpected Rctl x%x "
|
2007-06-17 17:56:38 -07:00
|
|
|
"Type x%x received\n",
|
2007-08-02 08:10:09 -07:00
|
|
|
pring->ringno, Rctl, Type);
|
2005-04-17 14:05:31 -07:00
|
|
|
}
|
2007-06-17 17:56:38 -07:00
|
|
|
return 1;
|
2005-04-17 14:05:31 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static struct lpfc_iocbq *
|
2007-06-17 17:56:36 -07:00
|
|
|
lpfc_sli_iocbq_lookup(struct lpfc_hba *phba,
|
|
|
|
struct lpfc_sli_ring *pring,
|
|
|
|
struct lpfc_iocbq *prspiocb)
|
2005-04-17 14:05:31 -07:00
|
|
|
{
|
|
|
|
struct lpfc_iocbq *cmd_iocb = NULL;
|
|
|
|
uint16_t iotag;
|
|
|
|
|
2005-10-29 08:28:33 -07:00
|
|
|
iotag = prspiocb->iocb.ulpIoTag;
|
|
|
|
|
|
|
|
if (iotag != 0 && iotag <= phba->sli.last_iotag) {
|
|
|
|
cmd_iocb = phba->sli.iocbq_lookup[iotag];
|
2007-06-17 17:56:38 -07:00
|
|
|
list_del_init(&cmd_iocb->list);
|
2005-10-29 08:28:33 -07:00
|
|
|
pring->txcmplq_cnt--;
|
|
|
|
return cmd_iocb;
|
2005-04-17 14:05:31 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
lpfc_printf_log(phba, KERN_ERR, LOG_SLI,
|
2007-08-02 08:10:09 -07:00
|
|
|
"0317 iotag x%x is out off "
|
2005-10-29 08:28:33 -07:00
|
|
|
"range: max iotag x%x wd0 x%x\n",
|
2007-08-02 08:10:09 -07:00
|
|
|
iotag, phba->sli.last_iotag,
|
2005-10-29 08:28:33 -07:00
|
|
|
*(((uint32_t *) &prspiocb->iocb) + 7));
|
2005-04-17 14:05:31 -07:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2007-06-17 17:56:36 -07:00
|
|
|
lpfc_sli_process_sol_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
|
2005-04-17 14:05:31 -07:00
|
|
|
struct lpfc_iocbq *saveq)
|
|
|
|
{
|
2007-06-17 17:56:36 -07:00
|
|
|
struct lpfc_iocbq *cmdiocbp;
|
2005-04-17 14:05:31 -07:00
|
|
|
int rc = 1;
|
|
|
|
unsigned long iflag;
|
|
|
|
|
|
|
|
/* Based on the iotag field, get the cmd IOCB from the txcmplq */
|
2007-06-17 17:56:36 -07:00
|
|
|
spin_lock_irqsave(&phba->hbalock, iflag);
|
2005-10-29 08:28:33 -07:00
|
|
|
cmdiocbp = lpfc_sli_iocbq_lookup(phba, pring, saveq);
|
2007-06-17 17:56:36 -07:00
|
|
|
spin_unlock_irqrestore(&phba->hbalock, iflag);
|
|
|
|
|
2005-04-17 14:05:31 -07:00
|
|
|
if (cmdiocbp) {
|
|
|
|
if (cmdiocbp->iocb_cmpl) {
|
|
|
|
/*
|
|
|
|
* Post all ELS completions to the worker thread.
|
|
|
|
* All other are passed to the completion callback.
|
|
|
|
*/
|
|
|
|
if (pring->ringno == LPFC_ELS_RING) {
|
2007-04-25 06:51:38 -07:00
|
|
|
if (cmdiocbp->iocb_flag & LPFC_DRIVER_ABORTED) {
|
|
|
|
cmdiocbp->iocb_flag &=
|
|
|
|
~LPFC_DRIVER_ABORTED;
|
|
|
|
saveq->iocb.ulpStatus =
|
|
|
|
IOSTAT_LOCAL_REJECT;
|
|
|
|
saveq->iocb.un.ulpWord[4] =
|
|
|
|
IOERR_SLI_ABORTED;
|
2008-01-10 23:52:36 -07:00
|
|
|
|
|
|
|
/* Firmware could still be in progress
|
|
|
|
* of DMAing payload, so don't free data
|
|
|
|
* buffer till after a hbeat.
|
|
|
|
*/
|
|
|
|
saveq->iocb_flag |= LPFC_DELAY_MEM_FREE;
|
2007-04-25 06:51:38 -07:00
|
|
|
}
|
2005-04-17 14:05:31 -07:00
|
|
|
}
|
2007-06-17 17:56:36 -07:00
|
|
|
(cmdiocbp->iocb_cmpl) (phba, cmdiocbp, saveq);
|
2005-10-29 08:28:33 -07:00
|
|
|
} else
|
|
|
|
lpfc_sli_release_iocbq(phba, cmdiocbp);
|
2005-04-17 14:05:31 -07:00
|
|
|
} else {
|
|
|
|
/*
|
|
|
|
* Unknown initiating command based on the response iotag.
|
|
|
|
* This could be the case on the ELS ring because of
|
|
|
|
* lpfc_els_abort().
|
|
|
|
*/
|
|
|
|
if (pring->ringno != LPFC_ELS_RING) {
|
|
|
|
/*
|
|
|
|
* Ring <ringno> handler: unexpected completion IoTag
|
|
|
|
* <IoTag>
|
|
|
|
*/
|
2007-08-02 08:10:09 -07:00
|
|
|
lpfc_printf_vlog(cmdiocbp->vport, KERN_WARNING, LOG_SLI,
|
|
|
|
"0322 Ring %d handler: "
|
|
|
|
"unexpected completion IoTag x%x "
|
|
|
|
"Data: x%x x%x x%x x%x\n",
|
|
|
|
pring->ringno,
|
|
|
|
saveq->iocb.ulpIoTag,
|
|
|
|
saveq->iocb.ulpStatus,
|
|
|
|
saveq->iocb.un.ulpWord[4],
|
|
|
|
saveq->iocb.ulpCommand,
|
|
|
|
saveq->iocb.ulpContext);
|
2005-04-17 14:05:31 -07:00
|
|
|
}
|
|
|
|
}
|
2005-10-28 17:29:47 -07:00
|
|
|
|
2005-04-17 14:05:31 -07:00
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
2007-06-17 17:56:36 -07:00
|
|
|
static void
|
|
|
|
lpfc_sli_rsp_pointers_error(struct lpfc_hba *phba, struct lpfc_sli_ring *pring)
|
[SCSI] lpfc 8.1.1 : Add polled-mode support
- Add functionality to run in polled mode only. Includes run time
attribute to enable mode.
- Enable runtime writable hba settings for coallescing and delay parameters
Customers have requested a mode in the driver to run strictly polled.
This is generally to support an environment where the server is extremely
loaded and is looking to reclaim some cpu cycles from adapter interrupt
handling.
This patch adds a new "poll" attribute, and the following behavior:
if value is 0 (default):
The driver uses the normal method for i/o completion. It uses the
firmware feature of interrupt coalesing. The firmware allows a
minimum number of i/o completions before an interrupt, or a maximum
time delay between interrupts. By default, the driver sets these
to no delay (disabled) or 1 i/o - meaning coalescing is disabled.
Attributes were provided to change the coalescing values, but it was
a module-load time only and global across all adapters.
This patch allows them to be writable on a per-adapter basis.
if value is 1 :
Interrupts are left enabled, expecting that the user has tuned the
interrupt coalescing values. When this setting is enabled, the driver
will attempt to service completed i/o whenever new i/o is submitted
to the adapter. If the coalescing values are large, and the i/o
generation rate steady, an interrupt will be avoided by servicing
completed i/o prior to the coalescing thresholds kicking in. However,
if the i/o completion load is high enough or i/o generation slow, the
coalescion values will ensure that completed i/o is serviced in a timely
fashion.
if value is 3 :
Turns off FCP i/o interrupts altogether. The coalescing values now have
no effect. A new attribute "poll_tmo" (default 10ms) exists to set
the polling interval for i/o completion. When this setting is enabled,
the driver will attempt to service completed i/o and restart the
interval timer whenever new i/o is submitted. This behavior allows for
servicing of completed i/o sooner than the interval timer, but ensures
that if no i/o is being issued, then the interval timer will kick in
to service the outstanding i/o.
Signed-off-by: James Smart <James.Smart@emulex.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-11-29 14:32:13 -07:00
|
|
|
{
|
2007-06-17 17:56:37 -07:00
|
|
|
struct lpfc_pgp *pgp = (phba->sli_rev == 3) ?
|
|
|
|
&phba->slim2p->mbx.us.s3_pgp.port[pring->ringno] :
|
|
|
|
&phba->slim2p->mbx.us.s2.port[pring->ringno];
|
[SCSI] lpfc 8.1.1 : Add polled-mode support
- Add functionality to run in polled mode only. Includes run time
attribute to enable mode.
- Enable runtime writable hba settings for coallescing and delay parameters
Customers have requested a mode in the driver to run strictly polled.
This is generally to support an environment where the server is extremely
loaded and is looking to reclaim some cpu cycles from adapter interrupt
handling.
This patch adds a new "poll" attribute, and the following behavior:
if value is 0 (default):
The driver uses the normal method for i/o completion. It uses the
firmware feature of interrupt coalesing. The firmware allows a
minimum number of i/o completions before an interrupt, or a maximum
time delay between interrupts. By default, the driver sets these
to no delay (disabled) or 1 i/o - meaning coalescing is disabled.
Attributes were provided to change the coalescing values, but it was
a module-load time only and global across all adapters.
This patch allows them to be writable on a per-adapter basis.
if value is 1 :
Interrupts are left enabled, expecting that the user has tuned the
interrupt coalescing values. When this setting is enabled, the driver
will attempt to service completed i/o whenever new i/o is submitted
to the adapter. If the coalescing values are large, and the i/o
generation rate steady, an interrupt will be avoided by servicing
completed i/o prior to the coalescing thresholds kicking in. However,
if the i/o completion load is high enough or i/o generation slow, the
coalescion values will ensure that completed i/o is serviced in a timely
fashion.
if value is 3 :
Turns off FCP i/o interrupts altogether. The coalescing values now have
no effect. A new attribute "poll_tmo" (default 10ms) exists to set
the polling interval for i/o completion. When this setting is enabled,
the driver will attempt to service completed i/o and restart the
interval timer whenever new i/o is submitted. This behavior allows for
servicing of completed i/o sooner than the interval timer, but ensures
that if no i/o is being issued, then the interval timer will kick in
to service the outstanding i/o.
Signed-off-by: James Smart <James.Smart@emulex.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-11-29 14:32:13 -07:00
|
|
|
/*
|
|
|
|
* Ring <ringno> handler: portRspPut <portRspPut> is bigger then
|
|
|
|
* rsp ring <portRspMax>
|
|
|
|
*/
|
|
|
|
lpfc_printf_log(phba, KERN_ERR, LOG_SLI,
|
2007-08-02 08:10:09 -07:00
|
|
|
"0312 Ring %d handler: portRspPut %d "
|
[SCSI] lpfc 8.1.1 : Add polled-mode support
- Add functionality to run in polled mode only. Includes run time
attribute to enable mode.
- Enable runtime writable hba settings for coallescing and delay parameters
Customers have requested a mode in the driver to run strictly polled.
This is generally to support an environment where the server is extremely
loaded and is looking to reclaim some cpu cycles from adapter interrupt
handling.
This patch adds a new "poll" attribute, and the following behavior:
if value is 0 (default):
The driver uses the normal method for i/o completion. It uses the
firmware feature of interrupt coalesing. The firmware allows a
minimum number of i/o completions before an interrupt, or a maximum
time delay between interrupts. By default, the driver sets these
to no delay (disabled) or 1 i/o - meaning coalescing is disabled.
Attributes were provided to change the coalescing values, but it was
a module-load time only and global across all adapters.
This patch allows them to be writable on a per-adapter basis.
if value is 1 :
Interrupts are left enabled, expecting that the user has tuned the
interrupt coalescing values. When this setting is enabled, the driver
will attempt to service completed i/o whenever new i/o is submitted
to the adapter. If the coalescing values are large, and the i/o
generation rate steady, an interrupt will be avoided by servicing
completed i/o prior to the coalescing thresholds kicking in. However,
if the i/o completion load is high enough or i/o generation slow, the
coalescion values will ensure that completed i/o is serviced in a timely
fashion.
if value is 3 :
Turns off FCP i/o interrupts altogether. The coalescing values now have
no effect. A new attribute "poll_tmo" (default 10ms) exists to set
the polling interval for i/o completion. When this setting is enabled,
the driver will attempt to service completed i/o and restart the
interval timer whenever new i/o is submitted. This behavior allows for
servicing of completed i/o sooner than the interval timer, but ensures
that if no i/o is being issued, then the interval timer will kick in
to service the outstanding i/o.
Signed-off-by: James Smart <James.Smart@emulex.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-11-29 14:32:13 -07:00
|
|
|
"is bigger then rsp ring %d\n",
|
2007-08-02 08:10:09 -07:00
|
|
|
pring->ringno, le32_to_cpu(pgp->rspPutInx),
|
[SCSI] lpfc 8.1.1 : Add polled-mode support
- Add functionality to run in polled mode only. Includes run time
attribute to enable mode.
- Enable runtime writable hba settings for coallescing and delay parameters
Customers have requested a mode in the driver to run strictly polled.
This is generally to support an environment where the server is extremely
loaded and is looking to reclaim some cpu cycles from adapter interrupt
handling.
This patch adds a new "poll" attribute, and the following behavior:
if value is 0 (default):
The driver uses the normal method for i/o completion. It uses the
firmware feature of interrupt coalesing. The firmware allows a
minimum number of i/o completions before an interrupt, or a maximum
time delay between interrupts. By default, the driver sets these
to no delay (disabled) or 1 i/o - meaning coalescing is disabled.
Attributes were provided to change the coalescing values, but it was
a module-load time only and global across all adapters.
This patch allows them to be writable on a per-adapter basis.
if value is 1 :
Interrupts are left enabled, expecting that the user has tuned the
interrupt coalescing values. When this setting is enabled, the driver
will attempt to service completed i/o whenever new i/o is submitted
to the adapter. If the coalescing values are large, and the i/o
generation rate steady, an interrupt will be avoided by servicing
completed i/o prior to the coalescing thresholds kicking in. However,
if the i/o completion load is high enough or i/o generation slow, the
coalescion values will ensure that completed i/o is serviced in a timely
fashion.
if value is 3 :
Turns off FCP i/o interrupts altogether. The coalescing values now have
no effect. A new attribute "poll_tmo" (default 10ms) exists to set
the polling interval for i/o completion. When this setting is enabled,
the driver will attempt to service completed i/o and restart the
interval timer whenever new i/o is submitted. This behavior allows for
servicing of completed i/o sooner than the interval timer, but ensures
that if no i/o is being issued, then the interval timer will kick in
to service the outstanding i/o.
Signed-off-by: James Smart <James.Smart@emulex.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-11-29 14:32:13 -07:00
|
|
|
pring->numRiocb);
|
|
|
|
|
2007-06-17 17:56:36 -07:00
|
|
|
phba->link_state = LPFC_HBA_ERROR;
|
[SCSI] lpfc 8.1.1 : Add polled-mode support
- Add functionality to run in polled mode only. Includes run time
attribute to enable mode.
- Enable runtime writable hba settings for coallescing and delay parameters
Customers have requested a mode in the driver to run strictly polled.
This is generally to support an environment where the server is extremely
loaded and is looking to reclaim some cpu cycles from adapter interrupt
handling.
This patch adds a new "poll" attribute, and the following behavior:
if value is 0 (default):
The driver uses the normal method for i/o completion. It uses the
firmware feature of interrupt coalesing. The firmware allows a
minimum number of i/o completions before an interrupt, or a maximum
time delay between interrupts. By default, the driver sets these
to no delay (disabled) or 1 i/o - meaning coalescing is disabled.
Attributes were provided to change the coalescing values, but it was
a module-load time only and global across all adapters.
This patch allows them to be writable on a per-adapter basis.
if value is 1 :
Interrupts are left enabled, expecting that the user has tuned the
interrupt coalescing values. When this setting is enabled, the driver
will attempt to service completed i/o whenever new i/o is submitted
to the adapter. If the coalescing values are large, and the i/o
generation rate steady, an interrupt will be avoided by servicing
completed i/o prior to the coalescing thresholds kicking in. However,
if the i/o completion load is high enough or i/o generation slow, the
coalescion values will ensure that completed i/o is serviced in a timely
fashion.
if value is 3 :
Turns off FCP i/o interrupts altogether. The coalescing values now have
no effect. A new attribute "poll_tmo" (default 10ms) exists to set
the polling interval for i/o completion. When this setting is enabled,
the driver will attempt to service completed i/o and restart the
interval timer whenever new i/o is submitted. This behavior allows for
servicing of completed i/o sooner than the interval timer, but ensures
that if no i/o is being issued, then the interval timer will kick in
to service the outstanding i/o.
Signed-off-by: James Smart <James.Smart@emulex.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-11-29 14:32:13 -07:00
|
|
|
|
|
|
|
/*
|
|
|
|
* All error attention handlers are posted to
|
|
|
|
* worker thread
|
|
|
|
*/
|
|
|
|
phba->work_ha |= HA_ERATT;
|
|
|
|
phba->work_hs = HS_FFER3;
|
2007-06-17 17:56:38 -07:00
|
|
|
|
|
|
|
/* hbalock should already be held */
|
[SCSI] lpfc 8.1.1 : Add polled-mode support
- Add functionality to run in polled mode only. Includes run time
attribute to enable mode.
- Enable runtime writable hba settings for coallescing and delay parameters
Customers have requested a mode in the driver to run strictly polled.
This is generally to support an environment where the server is extremely
loaded and is looking to reclaim some cpu cycles from adapter interrupt
handling.
This patch adds a new "poll" attribute, and the following behavior:
if value is 0 (default):
The driver uses the normal method for i/o completion. It uses the
firmware feature of interrupt coalesing. The firmware allows a
minimum number of i/o completions before an interrupt, or a maximum
time delay between interrupts. By default, the driver sets these
to no delay (disabled) or 1 i/o - meaning coalescing is disabled.
Attributes were provided to change the coalescing values, but it was
a module-load time only and global across all adapters.
This patch allows them to be writable on a per-adapter basis.
if value is 1 :
Interrupts are left enabled, expecting that the user has tuned the
interrupt coalescing values. When this setting is enabled, the driver
will attempt to service completed i/o whenever new i/o is submitted
to the adapter. If the coalescing values are large, and the i/o
generation rate steady, an interrupt will be avoided by servicing
completed i/o prior to the coalescing thresholds kicking in. However,
if the i/o completion load is high enough or i/o generation slow, the
coalescion values will ensure that completed i/o is serviced in a timely
fashion.
if value is 3 :
Turns off FCP i/o interrupts altogether. The coalescing values now have
no effect. A new attribute "poll_tmo" (default 10ms) exists to set
the polling interval for i/o completion. When this setting is enabled,
the driver will attempt to service completed i/o and restart the
interval timer whenever new i/o is submitted. This behavior allows for
servicing of completed i/o sooner than the interval timer, but ensures
that if no i/o is being issued, then the interval timer will kick in
to service the outstanding i/o.
Signed-off-by: James Smart <James.Smart@emulex.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-11-29 14:32:13 -07:00
|
|
|
if (phba->work_wait)
|
2007-06-17 17:56:38 -07:00
|
|
|
lpfc_worker_wake_up(phba);
|
[SCSI] lpfc 8.1.1 : Add polled-mode support
- Add functionality to run in polled mode only. Includes run time
attribute to enable mode.
- Enable runtime writable hba settings for coallescing and delay parameters
Customers have requested a mode in the driver to run strictly polled.
This is generally to support an environment where the server is extremely
loaded and is looking to reclaim some cpu cycles from adapter interrupt
handling.
This patch adds a new "poll" attribute, and the following behavior:
if value is 0 (default):
The driver uses the normal method for i/o completion. It uses the
firmware feature of interrupt coalesing. The firmware allows a
minimum number of i/o completions before an interrupt, or a maximum
time delay between interrupts. By default, the driver sets these
to no delay (disabled) or 1 i/o - meaning coalescing is disabled.
Attributes were provided to change the coalescing values, but it was
a module-load time only and global across all adapters.
This patch allows them to be writable on a per-adapter basis.
if value is 1 :
Interrupts are left enabled, expecting that the user has tuned the
interrupt coalescing values. When this setting is enabled, the driver
will attempt to service completed i/o whenever new i/o is submitted
to the adapter. If the coalescing values are large, and the i/o
generation rate steady, an interrupt will be avoided by servicing
completed i/o prior to the coalescing thresholds kicking in. However,
if the i/o completion load is high enough or i/o generation slow, the
coalescion values will ensure that completed i/o is serviced in a timely
fashion.
if value is 3 :
Turns off FCP i/o interrupts altogether. The coalescing values now have
no effect. A new attribute "poll_tmo" (default 10ms) exists to set
the polling interval for i/o completion. When this setting is enabled,
the driver will attempt to service completed i/o and restart the
interval timer whenever new i/o is submitted. This behavior allows for
servicing of completed i/o sooner than the interval timer, but ensures
that if no i/o is being issued, then the interval timer will kick in
to service the outstanding i/o.
Signed-off-by: James Smart <James.Smart@emulex.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-11-29 14:32:13 -07:00
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2007-06-17 17:56:36 -07:00
|
|
|
void lpfc_sli_poll_fcp_ring(struct lpfc_hba *phba)
|
[SCSI] lpfc 8.1.1 : Add polled-mode support
- Add functionality to run in polled mode only. Includes run time
attribute to enable mode.
- Enable runtime writable hba settings for coallescing and delay parameters
Customers have requested a mode in the driver to run strictly polled.
This is generally to support an environment where the server is extremely
loaded and is looking to reclaim some cpu cycles from adapter interrupt
handling.
This patch adds a new "poll" attribute, and the following behavior:
if value is 0 (default):
The driver uses the normal method for i/o completion. It uses the
firmware feature of interrupt coalesing. The firmware allows a
minimum number of i/o completions before an interrupt, or a maximum
time delay between interrupts. By default, the driver sets these
to no delay (disabled) or 1 i/o - meaning coalescing is disabled.
Attributes were provided to change the coalescing values, but it was
a module-load time only and global across all adapters.
This patch allows them to be writable on a per-adapter basis.
if value is 1 :
Interrupts are left enabled, expecting that the user has tuned the
interrupt coalescing values. When this setting is enabled, the driver
will attempt to service completed i/o whenever new i/o is submitted
to the adapter. If the coalescing values are large, and the i/o
generation rate steady, an interrupt will be avoided by servicing
completed i/o prior to the coalescing thresholds kicking in. However,
if the i/o completion load is high enough or i/o generation slow, the
coalescion values will ensure that completed i/o is serviced in a timely
fashion.
if value is 3 :
Turns off FCP i/o interrupts altogether. The coalescing values now have
no effect. A new attribute "poll_tmo" (default 10ms) exists to set
the polling interval for i/o completion. When this setting is enabled,
the driver will attempt to service completed i/o and restart the
interval timer whenever new i/o is submitted. This behavior allows for
servicing of completed i/o sooner than the interval timer, but ensures
that if no i/o is being issued, then the interval timer will kick in
to service the outstanding i/o.
Signed-off-by: James Smart <James.Smart@emulex.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-11-29 14:32:13 -07:00
|
|
|
{
|
2007-06-17 17:56:36 -07:00
|
|
|
struct lpfc_sli *psli = &phba->sli;
|
|
|
|
struct lpfc_sli_ring *pring = &psli->ring[LPFC_FCP_RING];
|
[SCSI] lpfc 8.1.1 : Add polled-mode support
- Add functionality to run in polled mode only. Includes run time
attribute to enable mode.
- Enable runtime writable hba settings for coallescing and delay parameters
Customers have requested a mode in the driver to run strictly polled.
This is generally to support an environment where the server is extremely
loaded and is looking to reclaim some cpu cycles from adapter interrupt
handling.
This patch adds a new "poll" attribute, and the following behavior:
if value is 0 (default):
The driver uses the normal method for i/o completion. It uses the
firmware feature of interrupt coalesing. The firmware allows a
minimum number of i/o completions before an interrupt, or a maximum
time delay between interrupts. By default, the driver sets these
to no delay (disabled) or 1 i/o - meaning coalescing is disabled.
Attributes were provided to change the coalescing values, but it was
a module-load time only and global across all adapters.
This patch allows them to be writable on a per-adapter basis.
if value is 1 :
Interrupts are left enabled, expecting that the user has tuned the
interrupt coalescing values. When this setting is enabled, the driver
will attempt to service completed i/o whenever new i/o is submitted
to the adapter. If the coalescing values are large, and the i/o
generation rate steady, an interrupt will be avoided by servicing
completed i/o prior to the coalescing thresholds kicking in. However,
if the i/o completion load is high enough or i/o generation slow, the
coalescion values will ensure that completed i/o is serviced in a timely
fashion.
if value is 3 :
Turns off FCP i/o interrupts altogether. The coalescing values now have
no effect. A new attribute "poll_tmo" (default 10ms) exists to set
the polling interval for i/o completion. When this setting is enabled,
the driver will attempt to service completed i/o and restart the
interval timer whenever new i/o is submitted. This behavior allows for
servicing of completed i/o sooner than the interval timer, but ensures
that if no i/o is being issued, then the interval timer will kick in
to service the outstanding i/o.
Signed-off-by: James Smart <James.Smart@emulex.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-11-29 14:32:13 -07:00
|
|
|
IOCB_t *irsp = NULL;
|
|
|
|
IOCB_t *entry = NULL;
|
|
|
|
struct lpfc_iocbq *cmdiocbq = NULL;
|
|
|
|
struct lpfc_iocbq rspiocbq;
|
|
|
|
struct lpfc_pgp *pgp;
|
|
|
|
uint32_t status;
|
|
|
|
uint32_t portRspPut, portRspMax;
|
|
|
|
int type;
|
|
|
|
uint32_t rsp_cmpl = 0;
|
|
|
|
uint32_t ha_copy;
|
2007-06-17 17:56:36 -07:00
|
|
|
unsigned long iflags;
|
[SCSI] lpfc 8.1.1 : Add polled-mode support
- Add functionality to run in polled mode only. Includes run time
attribute to enable mode.
- Enable runtime writable hba settings for coallescing and delay parameters
Customers have requested a mode in the driver to run strictly polled.
This is generally to support an environment where the server is extremely
loaded and is looking to reclaim some cpu cycles from adapter interrupt
handling.
This patch adds a new "poll" attribute, and the following behavior:
if value is 0 (default):
The driver uses the normal method for i/o completion. It uses the
firmware feature of interrupt coalesing. The firmware allows a
minimum number of i/o completions before an interrupt, or a maximum
time delay between interrupts. By default, the driver sets these
to no delay (disabled) or 1 i/o - meaning coalescing is disabled.
Attributes were provided to change the coalescing values, but it was
a module-load time only and global across all adapters.
This patch allows them to be writable on a per-adapter basis.
if value is 1 :
Interrupts are left enabled, expecting that the user has tuned the
interrupt coalescing values. When this setting is enabled, the driver
will attempt to service completed i/o whenever new i/o is submitted
to the adapter. If the coalescing values are large, and the i/o
generation rate steady, an interrupt will be avoided by servicing
completed i/o prior to the coalescing thresholds kicking in. However,
if the i/o completion load is high enough or i/o generation slow, the
coalescion values will ensure that completed i/o is serviced in a timely
fashion.
if value is 3 :
Turns off FCP i/o interrupts altogether. The coalescing values now have
no effect. A new attribute "poll_tmo" (default 10ms) exists to set
the polling interval for i/o completion. When this setting is enabled,
the driver will attempt to service completed i/o and restart the
interval timer whenever new i/o is submitted. This behavior allows for
servicing of completed i/o sooner than the interval timer, but ensures
that if no i/o is being issued, then the interval timer will kick in
to service the outstanding i/o.
Signed-off-by: James Smart <James.Smart@emulex.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-11-29 14:32:13 -07:00
|
|
|
|
|
|
|
pring->stats.iocb_event++;
|
|
|
|
|
2007-06-17 17:56:37 -07:00
|
|
|
pgp = (phba->sli_rev == 3) ?
|
|
|
|
&phba->slim2p->mbx.us.s3_pgp.port[pring->ringno] :
|
|
|
|
&phba->slim2p->mbx.us.s2.port[pring->ringno];
|
|
|
|
|
[SCSI] lpfc 8.1.1 : Add polled-mode support
- Add functionality to run in polled mode only. Includes run time
attribute to enable mode.
- Enable runtime writable hba settings for coallescing and delay parameters
Customers have requested a mode in the driver to run strictly polled.
This is generally to support an environment where the server is extremely
loaded and is looking to reclaim some cpu cycles from adapter interrupt
handling.
This patch adds a new "poll" attribute, and the following behavior:
if value is 0 (default):
The driver uses the normal method for i/o completion. It uses the
firmware feature of interrupt coalesing. The firmware allows a
minimum number of i/o completions before an interrupt, or a maximum
time delay between interrupts. By default, the driver sets these
to no delay (disabled) or 1 i/o - meaning coalescing is disabled.
Attributes were provided to change the coalescing values, but it was
a module-load time only and global across all adapters.
This patch allows them to be writable on a per-adapter basis.
if value is 1 :
Interrupts are left enabled, expecting that the user has tuned the
interrupt coalescing values. When this setting is enabled, the driver
will attempt to service completed i/o whenever new i/o is submitted
to the adapter. If the coalescing values are large, and the i/o
generation rate steady, an interrupt will be avoided by servicing
completed i/o prior to the coalescing thresholds kicking in. However,
if the i/o completion load is high enough or i/o generation slow, the
coalescion values will ensure that completed i/o is serviced in a timely
fashion.
if value is 3 :
Turns off FCP i/o interrupts altogether. The coalescing values now have
no effect. A new attribute "poll_tmo" (default 10ms) exists to set
the polling interval for i/o completion. When this setting is enabled,
the driver will attempt to service completed i/o and restart the
interval timer whenever new i/o is submitted. This behavior allows for
servicing of completed i/o sooner than the interval timer, but ensures
that if no i/o is being issued, then the interval timer will kick in
to service the outstanding i/o.
Signed-off-by: James Smart <James.Smart@emulex.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-11-29 14:32:13 -07:00
|
|
|
|
|
|
|
/*
|
|
|
|
* The next available response entry should never exceed the maximum
|
|
|
|
* entries. If it does, treat it as an adapter hardware error.
|
|
|
|
*/
|
|
|
|
portRspMax = pring->numRiocb;
|
|
|
|
portRspPut = le32_to_cpu(pgp->rspPutInx);
|
|
|
|
if (unlikely(portRspPut >= portRspMax)) {
|
|
|
|
lpfc_sli_rsp_pointers_error(phba, pring);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
rmb();
|
|
|
|
while (pring->rspidx != portRspPut) {
|
2007-06-17 17:56:37 -07:00
|
|
|
entry = lpfc_resp_iocb(phba, pring);
|
[SCSI] lpfc 8.1.1 : Add polled-mode support
- Add functionality to run in polled mode only. Includes run time
attribute to enable mode.
- Enable runtime writable hba settings for coallescing and delay parameters
Customers have requested a mode in the driver to run strictly polled.
This is generally to support an environment where the server is extremely
loaded and is looking to reclaim some cpu cycles from adapter interrupt
handling.
This patch adds a new "poll" attribute, and the following behavior:
if value is 0 (default):
The driver uses the normal method for i/o completion. It uses the
firmware feature of interrupt coalesing. The firmware allows a
minimum number of i/o completions before an interrupt, or a maximum
time delay between interrupts. By default, the driver sets these
to no delay (disabled) or 1 i/o - meaning coalescing is disabled.
Attributes were provided to change the coalescing values, but it was
a module-load time only and global across all adapters.
This patch allows them to be writable on a per-adapter basis.
if value is 1 :
Interrupts are left enabled, expecting that the user has tuned the
interrupt coalescing values. When this setting is enabled, the driver
will attempt to service completed i/o whenever new i/o is submitted
to the adapter. If the coalescing values are large, and the i/o
generation rate steady, an interrupt will be avoided by servicing
completed i/o prior to the coalescing thresholds kicking in. However,
if the i/o completion load is high enough or i/o generation slow, the
coalescion values will ensure that completed i/o is serviced in a timely
fashion.
if value is 3 :
Turns off FCP i/o interrupts altogether. The coalescing values now have
no effect. A new attribute "poll_tmo" (default 10ms) exists to set
the polling interval for i/o completion. When this setting is enabled,
the driver will attempt to service completed i/o and restart the
interval timer whenever new i/o is submitted. This behavior allows for
servicing of completed i/o sooner than the interval timer, but ensures
that if no i/o is being issued, then the interval timer will kick in
to service the outstanding i/o.
Signed-off-by: James Smart <James.Smart@emulex.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-11-29 14:32:13 -07:00
|
|
|
if (++pring->rspidx >= portRspMax)
|
|
|
|
pring->rspidx = 0;
|
|
|
|
|
|
|
|
lpfc_sli_pcimem_bcopy((uint32_t *) entry,
|
|
|
|
(uint32_t *) &rspiocbq.iocb,
|
2007-06-17 17:56:38 -07:00
|
|
|
phba->iocb_rsp_size);
|
[SCSI] lpfc 8.1.1 : Add polled-mode support
- Add functionality to run in polled mode only. Includes run time
attribute to enable mode.
- Enable runtime writable hba settings for coallescing and delay parameters
Customers have requested a mode in the driver to run strictly polled.
This is generally to support an environment where the server is extremely
loaded and is looking to reclaim some cpu cycles from adapter interrupt
handling.
This patch adds a new "poll" attribute, and the following behavior:
if value is 0 (default):
The driver uses the normal method for i/o completion. It uses the
firmware feature of interrupt coalesing. The firmware allows a
minimum number of i/o completions before an interrupt, or a maximum
time delay between interrupts. By default, the driver sets these
to no delay (disabled) or 1 i/o - meaning coalescing is disabled.
Attributes were provided to change the coalescing values, but it was
a module-load time only and global across all adapters.
This patch allows them to be writable on a per-adapter basis.
if value is 1 :
Interrupts are left enabled, expecting that the user has tuned the
interrupt coalescing values. When this setting is enabled, the driver
will attempt to service completed i/o whenever new i/o is submitted
to the adapter. If the coalescing values are large, and the i/o
generation rate steady, an interrupt will be avoided by servicing
completed i/o prior to the coalescing thresholds kicking in. However,
if the i/o completion load is high enough or i/o generation slow, the
coalescion values will ensure that completed i/o is serviced in a timely
fashion.
if value is 3 :
Turns off FCP i/o interrupts altogether. The coalescing values now have
no effect. A new attribute "poll_tmo" (default 10ms) exists to set
the polling interval for i/o completion. When this setting is enabled,
the driver will attempt to service completed i/o and restart the
interval timer whenever new i/o is submitted. This behavior allows for
servicing of completed i/o sooner than the interval timer, but ensures
that if no i/o is being issued, then the interval timer will kick in
to service the outstanding i/o.
Signed-off-by: James Smart <James.Smart@emulex.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-11-29 14:32:13 -07:00
|
|
|
irsp = &rspiocbq.iocb;
|
|
|
|
type = lpfc_sli_iocb_cmd_type(irsp->ulpCommand & CMD_IOCB_MASK);
|
|
|
|
pring->stats.iocb_rsp++;
|
|
|
|
rsp_cmpl++;
|
|
|
|
|
|
|
|
if (unlikely(irsp->ulpStatus)) {
|
|
|
|
/* Rsp ring <ringno> error: IOCB */
|
|
|
|
lpfc_printf_log(phba, KERN_WARNING, LOG_SLI,
|
2007-08-02 08:10:09 -07:00
|
|
|
"0326 Rsp Ring %d error: IOCB Data: "
|
[SCSI] lpfc 8.1.1 : Add polled-mode support
- Add functionality to run in polled mode only. Includes run time
attribute to enable mode.
- Enable runtime writable hba settings for coallescing and delay parameters
Customers have requested a mode in the driver to run strictly polled.
This is generally to support an environment where the server is extremely
loaded and is looking to reclaim some cpu cycles from adapter interrupt
handling.
This patch adds a new "poll" attribute, and the following behavior:
if value is 0 (default):
The driver uses the normal method for i/o completion. It uses the
firmware feature of interrupt coalesing. The firmware allows a
minimum number of i/o completions before an interrupt, or a maximum
time delay between interrupts. By default, the driver sets these
to no delay (disabled) or 1 i/o - meaning coalescing is disabled.
Attributes were provided to change the coalescing values, but it was
a module-load time only and global across all adapters.
This patch allows them to be writable on a per-adapter basis.
if value is 1 :
Interrupts are left enabled, expecting that the user has tuned the
interrupt coalescing values. When this setting is enabled, the driver
will attempt to service completed i/o whenever new i/o is submitted
to the adapter. If the coalescing values are large, and the i/o
generation rate steady, an interrupt will be avoided by servicing
completed i/o prior to the coalescing thresholds kicking in. However,
if the i/o completion load is high enough or i/o generation slow, the
coalescion values will ensure that completed i/o is serviced in a timely
fashion.
if value is 3 :
Turns off FCP i/o interrupts altogether. The coalescing values now have
no effect. A new attribute "poll_tmo" (default 10ms) exists to set
the polling interval for i/o completion. When this setting is enabled,
the driver will attempt to service completed i/o and restart the
interval timer whenever new i/o is submitted. This behavior allows for
servicing of completed i/o sooner than the interval timer, but ensures
that if no i/o is being issued, then the interval timer will kick in
to service the outstanding i/o.
Signed-off-by: James Smart <James.Smart@emulex.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-11-29 14:32:13 -07:00
|
|
|
"x%x x%x x%x x%x x%x x%x x%x x%x\n",
|
2007-08-02 08:10:09 -07:00
|
|
|
pring->ringno,
|
[SCSI] lpfc 8.1.1 : Add polled-mode support
- Add functionality to run in polled mode only. Includes run time
attribute to enable mode.
- Enable runtime writable hba settings for coallescing and delay parameters
Customers have requested a mode in the driver to run strictly polled.
This is generally to support an environment where the server is extremely
loaded and is looking to reclaim some cpu cycles from adapter interrupt
handling.
This patch adds a new "poll" attribute, and the following behavior:
if value is 0 (default):
The driver uses the normal method for i/o completion. It uses the
firmware feature of interrupt coalesing. The firmware allows a
minimum number of i/o completions before an interrupt, or a maximum
time delay between interrupts. By default, the driver sets these
to no delay (disabled) or 1 i/o - meaning coalescing is disabled.
Attributes were provided to change the coalescing values, but it was
a module-load time only and global across all adapters.
This patch allows them to be writable on a per-adapter basis.
if value is 1 :
Interrupts are left enabled, expecting that the user has tuned the
interrupt coalescing values. When this setting is enabled, the driver
will attempt to service completed i/o whenever new i/o is submitted
to the adapter. If the coalescing values are large, and the i/o
generation rate steady, an interrupt will be avoided by servicing
completed i/o prior to the coalescing thresholds kicking in. However,
if the i/o completion load is high enough or i/o generation slow, the
coalescion values will ensure that completed i/o is serviced in a timely
fashion.
if value is 3 :
Turns off FCP i/o interrupts altogether. The coalescing values now have
no effect. A new attribute "poll_tmo" (default 10ms) exists to set
the polling interval for i/o completion. When this setting is enabled,
the driver will attempt to service completed i/o and restart the
interval timer whenever new i/o is submitted. This behavior allows for
servicing of completed i/o sooner than the interval timer, but ensures
that if no i/o is being issued, then the interval timer will kick in
to service the outstanding i/o.
Signed-off-by: James Smart <James.Smart@emulex.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-11-29 14:32:13 -07:00
|
|
|
irsp->un.ulpWord[0],
|
|
|
|
irsp->un.ulpWord[1],
|
|
|
|
irsp->un.ulpWord[2],
|
|
|
|
irsp->un.ulpWord[3],
|
|
|
|
irsp->un.ulpWord[4],
|
|
|
|
irsp->un.ulpWord[5],
|
|
|
|
*(((uint32_t *) irsp) + 6),
|
|
|
|
*(((uint32_t *) irsp) + 7));
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (type) {
|
|
|
|
case LPFC_ABORT_IOCB:
|
|
|
|
case LPFC_SOL_IOCB:
|
|
|
|
/*
|
|
|
|
* Idle exchange closed via ABTS from port. No iocb
|
|
|
|
* resources need to be recovered.
|
|
|
|
*/
|
|
|
|
if (unlikely(irsp->ulpCommand == CMD_XRI_ABORTED_CX)) {
|
2006-08-01 04:34:08 -07:00
|
|
|
lpfc_printf_log(phba, KERN_INFO, LOG_SLI,
|
2007-08-02 08:10:09 -07:00
|
|
|
"0314 IOCB cmd 0x%x "
|
|
|
|
"processed. Skipping "
|
|
|
|
"completion",
|
2006-08-01 04:34:08 -07:00
|
|
|
irsp->ulpCommand);
|
[SCSI] lpfc 8.1.1 : Add polled-mode support
- Add functionality to run in polled mode only. Includes run time
attribute to enable mode.
- Enable runtime writable hba settings for coallescing and delay parameters
Customers have requested a mode in the driver to run strictly polled.
This is generally to support an environment where the server is extremely
loaded and is looking to reclaim some cpu cycles from adapter interrupt
handling.
This patch adds a new "poll" attribute, and the following behavior:
if value is 0 (default):
The driver uses the normal method for i/o completion. It uses the
firmware feature of interrupt coalesing. The firmware allows a
minimum number of i/o completions before an interrupt, or a maximum
time delay between interrupts. By default, the driver sets these
to no delay (disabled) or 1 i/o - meaning coalescing is disabled.
Attributes were provided to change the coalescing values, but it was
a module-load time only and global across all adapters.
This patch allows them to be writable on a per-adapter basis.
if value is 1 :
Interrupts are left enabled, expecting that the user has tuned the
interrupt coalescing values. When this setting is enabled, the driver
will attempt to service completed i/o whenever new i/o is submitted
to the adapter. If the coalescing values are large, and the i/o
generation rate steady, an interrupt will be avoided by servicing
completed i/o prior to the coalescing thresholds kicking in. However,
if the i/o completion load is high enough or i/o generation slow, the
coalescion values will ensure that completed i/o is serviced in a timely
fashion.
if value is 3 :
Turns off FCP i/o interrupts altogether. The coalescing values now have
no effect. A new attribute "poll_tmo" (default 10ms) exists to set
the polling interval for i/o completion. When this setting is enabled,
the driver will attempt to service completed i/o and restart the
interval timer whenever new i/o is submitted. This behavior allows for
servicing of completed i/o sooner than the interval timer, but ensures
that if no i/o is being issued, then the interval timer will kick in
to service the outstanding i/o.
Signed-off-by: James Smart <James.Smart@emulex.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-11-29 14:32:13 -07:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2007-06-17 17:56:36 -07:00
|
|
|
spin_lock_irqsave(&phba->hbalock, iflags);
|
[SCSI] lpfc 8.1.1 : Add polled-mode support
- Add functionality to run in polled mode only. Includes run time
attribute to enable mode.
- Enable runtime writable hba settings for coallescing and delay parameters
Customers have requested a mode in the driver to run strictly polled.
This is generally to support an environment where the server is extremely
loaded and is looking to reclaim some cpu cycles from adapter interrupt
handling.
This patch adds a new "poll" attribute, and the following behavior:
if value is 0 (default):
The driver uses the normal method for i/o completion. It uses the
firmware feature of interrupt coalesing. The firmware allows a
minimum number of i/o completions before an interrupt, or a maximum
time delay between interrupts. By default, the driver sets these
to no delay (disabled) or 1 i/o - meaning coalescing is disabled.
Attributes were provided to change the coalescing values, but it was
a module-load time only and global across all adapters.
This patch allows them to be writable on a per-adapter basis.
if value is 1 :
Interrupts are left enabled, expecting that the user has tuned the
interrupt coalescing values. When this setting is enabled, the driver
will attempt to service completed i/o whenever new i/o is submitted
to the adapter. If the coalescing values are large, and the i/o
generation rate steady, an interrupt will be avoided by servicing
completed i/o prior to the coalescing thresholds kicking in. However,
if the i/o completion load is high enough or i/o generation slow, the
coalescion values will ensure that completed i/o is serviced in a timely
fashion.
if value is 3 :
Turns off FCP i/o interrupts altogether. The coalescing values now have
no effect. A new attribute "poll_tmo" (default 10ms) exists to set
the polling interval for i/o completion. When this setting is enabled,
the driver will attempt to service completed i/o and restart the
interval timer whenever new i/o is submitted. This behavior allows for
servicing of completed i/o sooner than the interval timer, but ensures
that if no i/o is being issued, then the interval timer will kick in
to service the outstanding i/o.
Signed-off-by: James Smart <James.Smart@emulex.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-11-29 14:32:13 -07:00
|
|
|
cmdiocbq = lpfc_sli_iocbq_lookup(phba, pring,
|
|
|
|
&rspiocbq);
|
2007-06-17 17:56:36 -07:00
|
|
|
spin_unlock_irqrestore(&phba->hbalock, iflags);
|
[SCSI] lpfc 8.1.1 : Add polled-mode support
- Add functionality to run in polled mode only. Includes run time
attribute to enable mode.
- Enable runtime writable hba settings for coallescing and delay parameters
Customers have requested a mode in the driver to run strictly polled.
This is generally to support an environment where the server is extremely
loaded and is looking to reclaim some cpu cycles from adapter interrupt
handling.
This patch adds a new "poll" attribute, and the following behavior:
if value is 0 (default):
The driver uses the normal method for i/o completion. It uses the
firmware feature of interrupt coalesing. The firmware allows a
minimum number of i/o completions before an interrupt, or a maximum
time delay between interrupts. By default, the driver sets these
to no delay (disabled) or 1 i/o - meaning coalescing is disabled.
Attributes were provided to change the coalescing values, but it was
a module-load time only and global across all adapters.
This patch allows them to be writable on a per-adapter basis.
if value is 1 :
Interrupts are left enabled, expecting that the user has tuned the
interrupt coalescing values. When this setting is enabled, the driver
will attempt to service completed i/o whenever new i/o is submitted
to the adapter. If the coalescing values are large, and the i/o
generation rate steady, an interrupt will be avoided by servicing
completed i/o prior to the coalescing thresholds kicking in. However,
if the i/o completion load is high enough or i/o generation slow, the
coalescion values will ensure that completed i/o is serviced in a timely
fashion.
if value is 3 :
Turns off FCP i/o interrupts altogether. The coalescing values now have
no effect. A new attribute "poll_tmo" (default 10ms) exists to set
the polling interval for i/o completion. When this setting is enabled,
the driver will attempt to service completed i/o and restart the
interval timer whenever new i/o is submitted. This behavior allows for
servicing of completed i/o sooner than the interval timer, but ensures
that if no i/o is being issued, then the interval timer will kick in
to service the outstanding i/o.
Signed-off-by: James Smart <James.Smart@emulex.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-11-29 14:32:13 -07:00
|
|
|
if ((cmdiocbq) && (cmdiocbq->iocb_cmpl)) {
|
|
|
|
(cmdiocbq->iocb_cmpl)(phba, cmdiocbq,
|
|
|
|
&rspiocbq);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
if (irsp->ulpCommand == CMD_ADAPTER_MSG) {
|
|
|
|
char adaptermsg[LPFC_MAX_ADPTMSG];
|
|
|
|
memset(adaptermsg, 0, LPFC_MAX_ADPTMSG);
|
|
|
|
memcpy(&adaptermsg[0], (uint8_t *) irsp,
|
|
|
|
MAX_MSG_DATA);
|
2007-10-18 03:06:30 -07:00
|
|
|
dev_warn(&((phba->pcidev)->dev),
|
|
|
|
"lpfc%d: %s\n",
|
[SCSI] lpfc 8.1.1 : Add polled-mode support
- Add functionality to run in polled mode only. Includes run time
attribute to enable mode.
- Enable runtime writable hba settings for coallescing and delay parameters
Customers have requested a mode in the driver to run strictly polled.
This is generally to support an environment where the server is extremely
loaded and is looking to reclaim some cpu cycles from adapter interrupt
handling.
This patch adds a new "poll" attribute, and the following behavior:
if value is 0 (default):
The driver uses the normal method for i/o completion. It uses the
firmware feature of interrupt coalesing. The firmware allows a
minimum number of i/o completions before an interrupt, or a maximum
time delay between interrupts. By default, the driver sets these
to no delay (disabled) or 1 i/o - meaning coalescing is disabled.
Attributes were provided to change the coalescing values, but it was
a module-load time only and global across all adapters.
This patch allows them to be writable on a per-adapter basis.
if value is 1 :
Interrupts are left enabled, expecting that the user has tuned the
interrupt coalescing values. When this setting is enabled, the driver
will attempt to service completed i/o whenever new i/o is submitted
to the adapter. If the coalescing values are large, and the i/o
generation rate steady, an interrupt will be avoided by servicing
completed i/o prior to the coalescing thresholds kicking in. However,
if the i/o completion load is high enough or i/o generation slow, the
coalescion values will ensure that completed i/o is serviced in a timely
fashion.
if value is 3 :
Turns off FCP i/o interrupts altogether. The coalescing values now have
no effect. A new attribute "poll_tmo" (default 10ms) exists to set
the polling interval for i/o completion. When this setting is enabled,
the driver will attempt to service completed i/o and restart the
interval timer whenever new i/o is submitted. This behavior allows for
servicing of completed i/o sooner than the interval timer, but ensures
that if no i/o is being issued, then the interval timer will kick in
to service the outstanding i/o.
Signed-off-by: James Smart <James.Smart@emulex.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-11-29 14:32:13 -07:00
|
|
|
phba->brd_no, adaptermsg);
|
|
|
|
} else {
|
|
|
|
/* Unknown IOCB command */
|
|
|
|
lpfc_printf_log(phba, KERN_ERR, LOG_SLI,
|
2007-08-02 08:10:09 -07:00
|
|
|
"0321 Unknown IOCB command "
|
[SCSI] lpfc 8.1.1 : Add polled-mode support
- Add functionality to run in polled mode only. Includes run time
attribute to enable mode.
- Enable runtime writable hba settings for coallescing and delay parameters
Customers have requested a mode in the driver to run strictly polled.
This is generally to support an environment where the server is extremely
loaded and is looking to reclaim some cpu cycles from adapter interrupt
handling.
This patch adds a new "poll" attribute, and the following behavior:
if value is 0 (default):
The driver uses the normal method for i/o completion. It uses the
firmware feature of interrupt coalesing. The firmware allows a
minimum number of i/o completions before an interrupt, or a maximum
time delay between interrupts. By default, the driver sets these
to no delay (disabled) or 1 i/o - meaning coalescing is disabled.
Attributes were provided to change the coalescing values, but it was
a module-load time only and global across all adapters.
This patch allows them to be writable on a per-adapter basis.
if value is 1 :
Interrupts are left enabled, expecting that the user has tuned the
interrupt coalescing values. When this setting is enabled, the driver
will attempt to service completed i/o whenever new i/o is submitted
to the adapter. If the coalescing values are large, and the i/o
generation rate steady, an interrupt will be avoided by servicing
completed i/o prior to the coalescing thresholds kicking in. However,
if the i/o completion load is high enough or i/o generation slow, the
coalescion values will ensure that completed i/o is serviced in a timely
fashion.
if value is 3 :
Turns off FCP i/o interrupts altogether. The coalescing values now have
no effect. A new attribute "poll_tmo" (default 10ms) exists to set
the polling interval for i/o completion. When this setting is enabled,
the driver will attempt to service completed i/o and restart the
interval timer whenever new i/o is submitted. This behavior allows for
servicing of completed i/o sooner than the interval timer, but ensures
that if no i/o is being issued, then the interval timer will kick in
to service the outstanding i/o.
Signed-off-by: James Smart <James.Smart@emulex.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-11-29 14:32:13 -07:00
|
|
|
"Data: x%x, x%x x%x x%x x%x\n",
|
2007-08-02 08:10:09 -07:00
|
|
|
type, irsp->ulpCommand,
|
[SCSI] lpfc 8.1.1 : Add polled-mode support
- Add functionality to run in polled mode only. Includes run time
attribute to enable mode.
- Enable runtime writable hba settings for coallescing and delay parameters
Customers have requested a mode in the driver to run strictly polled.
This is generally to support an environment where the server is extremely
loaded and is looking to reclaim some cpu cycles from adapter interrupt
handling.
This patch adds a new "poll" attribute, and the following behavior:
if value is 0 (default):
The driver uses the normal method for i/o completion. It uses the
firmware feature of interrupt coalesing. The firmware allows a
minimum number of i/o completions before an interrupt, or a maximum
time delay between interrupts. By default, the driver sets these
to no delay (disabled) or 1 i/o - meaning coalescing is disabled.
Attributes were provided to change the coalescing values, but it was
a module-load time only and global across all adapters.
This patch allows them to be writable on a per-adapter basis.
if value is 1 :
Interrupts are left enabled, expecting that the user has tuned the
interrupt coalescing values. When this setting is enabled, the driver
will attempt to service completed i/o whenever new i/o is submitted
to the adapter. If the coalescing values are large, and the i/o
generation rate steady, an interrupt will be avoided by servicing
completed i/o prior to the coalescing thresholds kicking in. However,
if the i/o completion load is high enough or i/o generation slow, the
coalescion values will ensure that completed i/o is serviced in a timely
fashion.
if value is 3 :
Turns off FCP i/o interrupts altogether. The coalescing values now have
no effect. A new attribute "poll_tmo" (default 10ms) exists to set
the polling interval for i/o completion. When this setting is enabled,
the driver will attempt to service completed i/o and restart the
interval timer whenever new i/o is submitted. This behavior allows for
servicing of completed i/o sooner than the interval timer, but ensures
that if no i/o is being issued, then the interval timer will kick in
to service the outstanding i/o.
Signed-off-by: James Smart <James.Smart@emulex.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-11-29 14:32:13 -07:00
|
|
|
irsp->ulpStatus,
|
|
|
|
irsp->ulpIoTag,
|
|
|
|
irsp->ulpContext);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* The response IOCB has been processed. Update the ring
|
|
|
|
* pointer in SLIM. If the port response put pointer has not
|
|
|
|
* been updated, sync the pgp->rspPutInx and fetch the new port
|
|
|
|
* response put pointer.
|
|
|
|
*/
|
2007-06-17 17:56:37 -07:00
|
|
|
writel(pring->rspidx, &phba->host_gp[pring->ringno].rspGetInx);
|
[SCSI] lpfc 8.1.1 : Add polled-mode support
- Add functionality to run in polled mode only. Includes run time
attribute to enable mode.
- Enable runtime writable hba settings for coallescing and delay parameters
Customers have requested a mode in the driver to run strictly polled.
This is generally to support an environment where the server is extremely
loaded and is looking to reclaim some cpu cycles from adapter interrupt
handling.
This patch adds a new "poll" attribute, and the following behavior:
if value is 0 (default):
The driver uses the normal method for i/o completion. It uses the
firmware feature of interrupt coalesing. The firmware allows a
minimum number of i/o completions before an interrupt, or a maximum
time delay between interrupts. By default, the driver sets these
to no delay (disabled) or 1 i/o - meaning coalescing is disabled.
Attributes were provided to change the coalescing values, but it was
a module-load time only and global across all adapters.
This patch allows them to be writable on a per-adapter basis.
if value is 1 :
Interrupts are left enabled, expecting that the user has tuned the
interrupt coalescing values. When this setting is enabled, the driver
will attempt to service completed i/o whenever new i/o is submitted
to the adapter. If the coalescing values are large, and the i/o
generation rate steady, an interrupt will be avoided by servicing
completed i/o prior to the coalescing thresholds kicking in. However,
if the i/o completion load is high enough or i/o generation slow, the
coalescion values will ensure that completed i/o is serviced in a timely
fashion.
if value is 3 :
Turns off FCP i/o interrupts altogether. The coalescing values now have
no effect. A new attribute "poll_tmo" (default 10ms) exists to set
the polling interval for i/o completion. When this setting is enabled,
the driver will attempt to service completed i/o and restart the
interval timer whenever new i/o is submitted. This behavior allows for
servicing of completed i/o sooner than the interval timer, but ensures
that if no i/o is being issued, then the interval timer will kick in
to service the outstanding i/o.
Signed-off-by: James Smart <James.Smart@emulex.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-11-29 14:32:13 -07:00
|
|
|
|
|
|
|
if (pring->rspidx == portRspPut)
|
|
|
|
portRspPut = le32_to_cpu(pgp->rspPutInx);
|
|
|
|
}
|
|
|
|
|
|
|
|
ha_copy = readl(phba->HAregaddr);
|
|
|
|
ha_copy >>= (LPFC_FCP_RING * 4);
|
|
|
|
|
|
|
|
if ((rsp_cmpl > 0) && (ha_copy & HA_R0RE_REQ)) {
|
2007-06-17 17:56:36 -07:00
|
|
|
spin_lock_irqsave(&phba->hbalock, iflags);
|
[SCSI] lpfc 8.1.1 : Add polled-mode support
- Add functionality to run in polled mode only. Includes run time
attribute to enable mode.
- Enable runtime writable hba settings for coallescing and delay parameters
Customers have requested a mode in the driver to run strictly polled.
This is generally to support an environment where the server is extremely
loaded and is looking to reclaim some cpu cycles from adapter interrupt
handling.
This patch adds a new "poll" attribute, and the following behavior:
if value is 0 (default):
The driver uses the normal method for i/o completion. It uses the
firmware feature of interrupt coalesing. The firmware allows a
minimum number of i/o completions before an interrupt, or a maximum
time delay between interrupts. By default, the driver sets these
to no delay (disabled) or 1 i/o - meaning coalescing is disabled.
Attributes were provided to change the coalescing values, but it was
a module-load time only and global across all adapters.
This patch allows them to be writable on a per-adapter basis.
if value is 1 :
Interrupts are left enabled, expecting that the user has tuned the
interrupt coalescing values. When this setting is enabled, the driver
will attempt to service completed i/o whenever new i/o is submitted
to the adapter. If the coalescing values are large, and the i/o
generation rate steady, an interrupt will be avoided by servicing
completed i/o prior to the coalescing thresholds kicking in. However,
if the i/o completion load is high enough or i/o generation slow, the
coalescion values will ensure that completed i/o is serviced in a timely
fashion.
if value is 3 :
Turns off FCP i/o interrupts altogether. The coalescing values now have
no effect. A new attribute "poll_tmo" (default 10ms) exists to set
the polling interval for i/o completion. When this setting is enabled,
the driver will attempt to service completed i/o and restart the
interval timer whenever new i/o is submitted. This behavior allows for
servicing of completed i/o sooner than the interval timer, but ensures
that if no i/o is being issued, then the interval timer will kick in
to service the outstanding i/o.
Signed-off-by: James Smart <James.Smart@emulex.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-11-29 14:32:13 -07:00
|
|
|
pring->stats.iocb_rsp_full++;
|
|
|
|
status = ((CA_R0ATT | CA_R0RE_RSP) << (LPFC_FCP_RING * 4));
|
|
|
|
writel(status, phba->CAregaddr);
|
|
|
|
readl(phba->CAregaddr);
|
2007-06-17 17:56:36 -07:00
|
|
|
spin_unlock_irqrestore(&phba->hbalock, iflags);
|
[SCSI] lpfc 8.1.1 : Add polled-mode support
- Add functionality to run in polled mode only. Includes run time
attribute to enable mode.
- Enable runtime writable hba settings for coallescing and delay parameters
Customers have requested a mode in the driver to run strictly polled.
This is generally to support an environment where the server is extremely
loaded and is looking to reclaim some cpu cycles from adapter interrupt
handling.
This patch adds a new "poll" attribute, and the following behavior:
if value is 0 (default):
The driver uses the normal method for i/o completion. It uses the
firmware feature of interrupt coalesing. The firmware allows a
minimum number of i/o completions before an interrupt, or a maximum
time delay between interrupts. By default, the driver sets these
to no delay (disabled) or 1 i/o - meaning coalescing is disabled.
Attributes were provided to change the coalescing values, but it was
a module-load time only and global across all adapters.
This patch allows them to be writable on a per-adapter basis.
if value is 1 :
Interrupts are left enabled, expecting that the user has tuned the
interrupt coalescing values. When this setting is enabled, the driver
will attempt to service completed i/o whenever new i/o is submitted
to the adapter. If the coalescing values are large, and the i/o
generation rate steady, an interrupt will be avoided by servicing
completed i/o prior to the coalescing thresholds kicking in. However,
if the i/o completion load is high enough or i/o generation slow, the
coalescion values will ensure that completed i/o is serviced in a timely
fashion.
if value is 3 :
Turns off FCP i/o interrupts altogether. The coalescing values now have
no effect. A new attribute "poll_tmo" (default 10ms) exists to set
the polling interval for i/o completion. When this setting is enabled,
the driver will attempt to service completed i/o and restart the
interval timer whenever new i/o is submitted. This behavior allows for
servicing of completed i/o sooner than the interval timer, but ensures
that if no i/o is being issued, then the interval timer will kick in
to service the outstanding i/o.
Signed-off-by: James Smart <James.Smart@emulex.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-11-29 14:32:13 -07:00
|
|
|
}
|
|
|
|
if ((ha_copy & HA_R0CE_RSP) &&
|
|
|
|
(pring->flag & LPFC_CALL_RING_AVAILABLE)) {
|
2007-06-17 17:56:36 -07:00
|
|
|
spin_lock_irqsave(&phba->hbalock, iflags);
|
[SCSI] lpfc 8.1.1 : Add polled-mode support
- Add functionality to run in polled mode only. Includes run time
attribute to enable mode.
- Enable runtime writable hba settings for coallescing and delay parameters
Customers have requested a mode in the driver to run strictly polled.
This is generally to support an environment where the server is extremely
loaded and is looking to reclaim some cpu cycles from adapter interrupt
handling.
This patch adds a new "poll" attribute, and the following behavior:
if value is 0 (default):
The driver uses the normal method for i/o completion. It uses the
firmware feature of interrupt coalesing. The firmware allows a
minimum number of i/o completions before an interrupt, or a maximum
time delay between interrupts. By default, the driver sets these
to no delay (disabled) or 1 i/o - meaning coalescing is disabled.
Attributes were provided to change the coalescing values, but it was
a module-load time only and global across all adapters.
This patch allows them to be writable on a per-adapter basis.
if value is 1 :
Interrupts are left enabled, expecting that the user has tuned the
interrupt coalescing values. When this setting is enabled, the driver
will attempt to service completed i/o whenever new i/o is submitted
to the adapter. If the coalescing values are large, and the i/o
generation rate steady, an interrupt will be avoided by servicing
completed i/o prior to the coalescing thresholds kicking in. However,
if the i/o completion load is high enough or i/o generation slow, the
coalescion values will ensure that completed i/o is serviced in a timely
fashion.
if value is 3 :
Turns off FCP i/o interrupts altogether. The coalescing values now have
no effect. A new attribute "poll_tmo" (default 10ms) exists to set
the polling interval for i/o completion. When this setting is enabled,
the driver will attempt to service completed i/o and restart the
interval timer whenever new i/o is submitted. This behavior allows for
servicing of completed i/o sooner than the interval timer, but ensures
that if no i/o is being issued, then the interval timer will kick in
to service the outstanding i/o.
Signed-off-by: James Smart <James.Smart@emulex.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-11-29 14:32:13 -07:00
|
|
|
pring->flag &= ~LPFC_CALL_RING_AVAILABLE;
|
|
|
|
pring->stats.iocb_cmd_empty++;
|
|
|
|
|
|
|
|
/* Force update of the local copy of cmdGetInx */
|
|
|
|
pring->local_getidx = le32_to_cpu(pgp->cmdGetInx);
|
|
|
|
lpfc_sli_resume_iocb(phba, pring);
|
|
|
|
|
|
|
|
if ((pring->lpfc_sli_cmd_available))
|
|
|
|
(pring->lpfc_sli_cmd_available) (phba, pring);
|
|
|
|
|
2007-06-17 17:56:36 -07:00
|
|
|
spin_unlock_irqrestore(&phba->hbalock, iflags);
|
[SCSI] lpfc 8.1.1 : Add polled-mode support
- Add functionality to run in polled mode only. Includes run time
attribute to enable mode.
- Enable runtime writable hba settings for coallescing and delay parameters
Customers have requested a mode in the driver to run strictly polled.
This is generally to support an environment where the server is extremely
loaded and is looking to reclaim some cpu cycles from adapter interrupt
handling.
This patch adds a new "poll" attribute, and the following behavior:
if value is 0 (default):
The driver uses the normal method for i/o completion. It uses the
firmware feature of interrupt coalesing. The firmware allows a
minimum number of i/o completions before an interrupt, or a maximum
time delay between interrupts. By default, the driver sets these
to no delay (disabled) or 1 i/o - meaning coalescing is disabled.
Attributes were provided to change the coalescing values, but it was
a module-load time only and global across all adapters.
This patch allows them to be writable on a per-adapter basis.
if value is 1 :
Interrupts are left enabled, expecting that the user has tuned the
interrupt coalescing values. When this setting is enabled, the driver
will attempt to service completed i/o whenever new i/o is submitted
to the adapter. If the coalescing values are large, and the i/o
generation rate steady, an interrupt will be avoided by servicing
completed i/o prior to the coalescing thresholds kicking in. However,
if the i/o completion load is high enough or i/o generation slow, the
coalescion values will ensure that completed i/o is serviced in a timely
fashion.
if value is 3 :
Turns off FCP i/o interrupts altogether. The coalescing values now have
no effect. A new attribute "poll_tmo" (default 10ms) exists to set
the polling interval for i/o completion. When this setting is enabled,
the driver will attempt to service completed i/o and restart the
interval timer whenever new i/o is submitted. This behavior allows for
servicing of completed i/o sooner than the interval timer, but ensures
that if no i/o is being issued, then the interval timer will kick in
to service the outstanding i/o.
Signed-off-by: James Smart <James.Smart@emulex.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-11-29 14:32:13 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2005-04-17 14:05:31 -07:00
|
|
|
/*
|
|
|
|
* This routine presumes LPFC_FCP_RING handling and doesn't bother
|
|
|
|
* to check it explicitly.
|
|
|
|
*/
|
|
|
|
static int
|
2007-06-17 17:56:36 -07:00
|
|
|
lpfc_sli_handle_fast_ring_event(struct lpfc_hba *phba,
|
|
|
|
struct lpfc_sli_ring *pring, uint32_t mask)
|
2005-04-17 14:05:31 -07:00
|
|
|
{
|
2007-06-17 17:56:37 -07:00
|
|
|
struct lpfc_pgp *pgp = (phba->sli_rev == 3) ?
|
|
|
|
&phba->slim2p->mbx.us.s3_pgp.port[pring->ringno] :
|
|
|
|
&phba->slim2p->mbx.us.s2.port[pring->ringno];
|
2005-04-17 14:05:31 -07:00
|
|
|
IOCB_t *irsp = NULL;
|
2005-06-25 07:34:13 -07:00
|
|
|
IOCB_t *entry = NULL;
|
2005-04-17 14:05:31 -07:00
|
|
|
struct lpfc_iocbq *cmdiocbq = NULL;
|
|
|
|
struct lpfc_iocbq rspiocbq;
|
|
|
|
uint32_t status;
|
|
|
|
uint32_t portRspPut, portRspMax;
|
|
|
|
int rc = 1;
|
|
|
|
lpfc_iocb_type type;
|
|
|
|
unsigned long iflag;
|
|
|
|
uint32_t rsp_cmpl = 0;
|
|
|
|
|
2007-06-17 17:56:36 -07:00
|
|
|
spin_lock_irqsave(&phba->hbalock, iflag);
|
2005-04-17 14:05:31 -07:00
|
|
|
pring->stats.iocb_event++;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* The next available response entry should never exceed the maximum
|
|
|
|
* entries. If it does, treat it as an adapter hardware error.
|
|
|
|
*/
|
|
|
|
portRspMax = pring->numRiocb;
|
|
|
|
portRspPut = le32_to_cpu(pgp->rspPutInx);
|
|
|
|
if (unlikely(portRspPut >= portRspMax)) {
|
[SCSI] lpfc 8.1.1 : Add polled-mode support
- Add functionality to run in polled mode only. Includes run time
attribute to enable mode.
- Enable runtime writable hba settings for coallescing and delay parameters
Customers have requested a mode in the driver to run strictly polled.
This is generally to support an environment where the server is extremely
loaded and is looking to reclaim some cpu cycles from adapter interrupt
handling.
This patch adds a new "poll" attribute, and the following behavior:
if value is 0 (default):
The driver uses the normal method for i/o completion. It uses the
firmware feature of interrupt coalesing. The firmware allows a
minimum number of i/o completions before an interrupt, or a maximum
time delay between interrupts. By default, the driver sets these
to no delay (disabled) or 1 i/o - meaning coalescing is disabled.
Attributes were provided to change the coalescing values, but it was
a module-load time only and global across all adapters.
This patch allows them to be writable on a per-adapter basis.
if value is 1 :
Interrupts are left enabled, expecting that the user has tuned the
interrupt coalescing values. When this setting is enabled, the driver
will attempt to service completed i/o whenever new i/o is submitted
to the adapter. If the coalescing values are large, and the i/o
generation rate steady, an interrupt will be avoided by servicing
completed i/o prior to the coalescing thresholds kicking in. However,
if the i/o completion load is high enough or i/o generation slow, the
coalescion values will ensure that completed i/o is serviced in a timely
fashion.
if value is 3 :
Turns off FCP i/o interrupts altogether. The coalescing values now have
no effect. A new attribute "poll_tmo" (default 10ms) exists to set
the polling interval for i/o completion. When this setting is enabled,
the driver will attempt to service completed i/o and restart the
interval timer whenever new i/o is submitted. This behavior allows for
servicing of completed i/o sooner than the interval timer, but ensures
that if no i/o is being issued, then the interval timer will kick in
to service the outstanding i/o.
Signed-off-by: James Smart <James.Smart@emulex.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-11-29 14:32:13 -07:00
|
|
|
lpfc_sli_rsp_pointers_error(phba, pring);
|
2007-06-17 17:56:36 -07:00
|
|
|
spin_unlock_irqrestore(&phba->hbalock, iflag);
|
2005-04-17 14:05:31 -07:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
rmb();
|
|
|
|
while (pring->rspidx != portRspPut) {
|
2005-06-25 07:34:13 -07:00
|
|
|
/*
|
|
|
|
* Fetch an entry off the ring and copy it into a local data
|
|
|
|
* structure. The copy involves a byte-swap since the
|
|
|
|
* network byte order and pci byte orders are different.
|
|
|
|
*/
|
2007-06-17 17:56:37 -07:00
|
|
|
entry = lpfc_resp_iocb(phba, pring);
|
2007-06-17 17:56:39 -07:00
|
|
|
phba->last_completion_time = jiffies;
|
[SCSI] lpfc 8.1.1 : Add polled-mode support
- Add functionality to run in polled mode only. Includes run time
attribute to enable mode.
- Enable runtime writable hba settings for coallescing and delay parameters
Customers have requested a mode in the driver to run strictly polled.
This is generally to support an environment where the server is extremely
loaded and is looking to reclaim some cpu cycles from adapter interrupt
handling.
This patch adds a new "poll" attribute, and the following behavior:
if value is 0 (default):
The driver uses the normal method for i/o completion. It uses the
firmware feature of interrupt coalesing. The firmware allows a
minimum number of i/o completions before an interrupt, or a maximum
time delay between interrupts. By default, the driver sets these
to no delay (disabled) or 1 i/o - meaning coalescing is disabled.
Attributes were provided to change the coalescing values, but it was
a module-load time only and global across all adapters.
This patch allows them to be writable on a per-adapter basis.
if value is 1 :
Interrupts are left enabled, expecting that the user has tuned the
interrupt coalescing values. When this setting is enabled, the driver
will attempt to service completed i/o whenever new i/o is submitted
to the adapter. If the coalescing values are large, and the i/o
generation rate steady, an interrupt will be avoided by servicing
completed i/o prior to the coalescing thresholds kicking in. However,
if the i/o completion load is high enough or i/o generation slow, the
coalescion values will ensure that completed i/o is serviced in a timely
fashion.
if value is 3 :
Turns off FCP i/o interrupts altogether. The coalescing values now have
no effect. A new attribute "poll_tmo" (default 10ms) exists to set
the polling interval for i/o completion. When this setting is enabled,
the driver will attempt to service completed i/o and restart the
interval timer whenever new i/o is submitted. This behavior allows for
servicing of completed i/o sooner than the interval timer, but ensures
that if no i/o is being issued, then the interval timer will kick in
to service the outstanding i/o.
Signed-off-by: James Smart <James.Smart@emulex.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-11-29 14:32:13 -07:00
|
|
|
|
|
|
|
if (++pring->rspidx >= portRspMax)
|
|
|
|
pring->rspidx = 0;
|
|
|
|
|
2005-06-25 07:34:13 -07:00
|
|
|
lpfc_sli_pcimem_bcopy((uint32_t *) entry,
|
|
|
|
(uint32_t *) &rspiocbq.iocb,
|
2007-06-17 17:56:37 -07:00
|
|
|
phba->iocb_rsp_size);
|
2006-12-02 11:34:16 -07:00
|
|
|
INIT_LIST_HEAD(&(rspiocbq.list));
|
2005-06-25 07:34:13 -07:00
|
|
|
irsp = &rspiocbq.iocb;
|
|
|
|
|
2005-04-17 14:05:31 -07:00
|
|
|
type = lpfc_sli_iocb_cmd_type(irsp->ulpCommand & CMD_IOCB_MASK);
|
|
|
|
pring->stats.iocb_rsp++;
|
|
|
|
rsp_cmpl++;
|
|
|
|
|
|
|
|
if (unlikely(irsp->ulpStatus)) {
|
2007-06-17 17:56:38 -07:00
|
|
|
/*
|
|
|
|
* If resource errors reported from HBA, reduce
|
|
|
|
* queuedepths of the SCSI device.
|
|
|
|
*/
|
|
|
|
if ((irsp->ulpStatus == IOSTAT_LOCAL_REJECT) &&
|
|
|
|
(irsp->un.ulpWord[4] == IOERR_NO_RESOURCES)) {
|
|
|
|
spin_unlock_irqrestore(&phba->hbalock, iflag);
|
|
|
|
lpfc_adjust_queue_depth(phba);
|
|
|
|
spin_lock_irqsave(&phba->hbalock, iflag);
|
|
|
|
}
|
|
|
|
|
2005-04-17 14:05:31 -07:00
|
|
|
/* Rsp ring <ringno> error: IOCB */
|
|
|
|
lpfc_printf_log(phba, KERN_WARNING, LOG_SLI,
|
2007-08-02 08:10:09 -07:00
|
|
|
"0336 Rsp Ring %d error: IOCB Data: "
|
2007-06-17 17:56:38 -07:00
|
|
|
"x%x x%x x%x x%x x%x x%x x%x x%x\n",
|
2007-08-02 08:10:09 -07:00
|
|
|
pring->ringno,
|
2007-06-17 17:56:38 -07:00
|
|
|
irsp->un.ulpWord[0],
|
|
|
|
irsp->un.ulpWord[1],
|
|
|
|
irsp->un.ulpWord[2],
|
|
|
|
irsp->un.ulpWord[3],
|
|
|
|
irsp->un.ulpWord[4],
|
|
|
|
irsp->un.ulpWord[5],
|
|
|
|
*(((uint32_t *) irsp) + 6),
|
|
|
|
*(((uint32_t *) irsp) + 7));
|
2005-04-17 14:05:31 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
switch (type) {
|
|
|
|
case LPFC_ABORT_IOCB:
|
|
|
|
case LPFC_SOL_IOCB:
|
|
|
|
/*
|
|
|
|
* Idle exchange closed via ABTS from port. No iocb
|
|
|
|
* resources need to be recovered.
|
|
|
|
*/
|
|
|
|
if (unlikely(irsp->ulpCommand == CMD_XRI_ABORTED_CX)) {
|
2006-08-01 04:34:08 -07:00
|
|
|
lpfc_printf_log(phba, KERN_INFO, LOG_SLI,
|
2007-08-02 08:10:09 -07:00
|
|
|
"0333 IOCB cmd 0x%x"
|
2006-08-01 04:34:08 -07:00
|
|
|
" processed. Skipping"
|
2007-06-17 17:56:38 -07:00
|
|
|
" completion\n",
|
2006-08-01 04:34:08 -07:00
|
|
|
irsp->ulpCommand);
|
2005-04-17 14:05:31 -07:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2005-10-29 08:28:33 -07:00
|
|
|
cmdiocbq = lpfc_sli_iocbq_lookup(phba, pring,
|
|
|
|
&rspiocbq);
|
2005-04-17 14:05:31 -07:00
|
|
|
if ((cmdiocbq) && (cmdiocbq->iocb_cmpl)) {
|
2006-02-28 20:33:12 -07:00
|
|
|
if (phba->cfg_poll & ENABLE_FCP_RING_POLLING) {
|
|
|
|
(cmdiocbq->iocb_cmpl)(phba, cmdiocbq,
|
|
|
|
&rspiocbq);
|
|
|
|
} else {
|
2007-06-17 17:56:36 -07:00
|
|
|
spin_unlock_irqrestore(&phba->hbalock,
|
|
|
|
iflag);
|
2006-02-28 20:33:12 -07:00
|
|
|
(cmdiocbq->iocb_cmpl)(phba, cmdiocbq,
|
|
|
|
&rspiocbq);
|
2007-06-17 17:56:36 -07:00
|
|
|
spin_lock_irqsave(&phba->hbalock,
|
2006-02-28 20:33:12 -07:00
|
|
|
iflag);
|
|
|
|
}
|
2005-04-17 14:05:31 -07:00
|
|
|
}
|
|
|
|
break;
|
2006-12-02 11:34:16 -07:00
|
|
|
case LPFC_UNSOL_IOCB:
|
2007-06-17 17:56:36 -07:00
|
|
|
spin_unlock_irqrestore(&phba->hbalock, iflag);
|
2006-12-02 11:34:16 -07:00
|
|
|
lpfc_sli_process_unsol_iocb(phba, pring, &rspiocbq);
|
2007-06-17 17:56:36 -07:00
|
|
|
spin_lock_irqsave(&phba->hbalock, iflag);
|
2006-12-02 11:34:16 -07:00
|
|
|
break;
|
2005-04-17 14:05:31 -07:00
|
|
|
default:
|
|
|
|
if (irsp->ulpCommand == CMD_ADAPTER_MSG) {
|
|
|
|
char adaptermsg[LPFC_MAX_ADPTMSG];
|
|
|
|
memset(adaptermsg, 0, LPFC_MAX_ADPTMSG);
|
|
|
|
memcpy(&adaptermsg[0], (uint8_t *) irsp,
|
|
|
|
MAX_MSG_DATA);
|
2007-10-18 03:06:30 -07:00
|
|
|
dev_warn(&((phba->pcidev)->dev),
|
|
|
|
"lpfc%d: %s\n",
|
2005-04-17 14:05:31 -07:00
|
|
|
phba->brd_no, adaptermsg);
|
|
|
|
} else {
|
|
|
|
/* Unknown IOCB command */
|
|
|
|
lpfc_printf_log(phba, KERN_ERR, LOG_SLI,
|
2007-08-02 08:10:09 -07:00
|
|
|
"0334 Unknown IOCB command "
|
2007-06-17 17:56:38 -07:00
|
|
|
"Data: x%x, x%x x%x x%x x%x\n",
|
2007-08-02 08:10:09 -07:00
|
|
|
type, irsp->ulpCommand,
|
2007-06-17 17:56:38 -07:00
|
|
|
irsp->ulpStatus,
|
|
|
|
irsp->ulpIoTag,
|
|
|
|
irsp->ulpContext);
|
2005-04-17 14:05:31 -07:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* The response IOCB has been processed. Update the ring
|
|
|
|
* pointer in SLIM. If the port response put pointer has not
|
|
|
|
* been updated, sync the pgp->rspPutInx and fetch the new port
|
|
|
|
* response put pointer.
|
|
|
|
*/
|
2007-06-17 17:56:37 -07:00
|
|
|
writel(pring->rspidx, &phba->host_gp[pring->ringno].rspGetInx);
|
2005-04-17 14:05:31 -07:00
|
|
|
|
|
|
|
if (pring->rspidx == portRspPut)
|
|
|
|
portRspPut = le32_to_cpu(pgp->rspPutInx);
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((rsp_cmpl > 0) && (mask & HA_R0RE_REQ)) {
|
|
|
|
pring->stats.iocb_rsp_full++;
|
|
|
|
status = ((CA_R0ATT | CA_R0RE_RSP) << (pring->ringno * 4));
|
|
|
|
writel(status, phba->CAregaddr);
|
|
|
|
readl(phba->CAregaddr);
|
|
|
|
}
|
|
|
|
if ((mask & HA_R0CE_RSP) && (pring->flag & LPFC_CALL_RING_AVAILABLE)) {
|
|
|
|
pring->flag &= ~LPFC_CALL_RING_AVAILABLE;
|
|
|
|
pring->stats.iocb_cmd_empty++;
|
|
|
|
|
|
|
|
/* Force update of the local copy of cmdGetInx */
|
|
|
|
pring->local_getidx = le32_to_cpu(pgp->cmdGetInx);
|
|
|
|
lpfc_sli_resume_iocb(phba, pring);
|
|
|
|
|
|
|
|
if ((pring->lpfc_sli_cmd_available))
|
|
|
|
(pring->lpfc_sli_cmd_available) (phba, pring);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2007-06-17 17:56:36 -07:00
|
|
|
spin_unlock_irqrestore(&phba->hbalock, iflag);
|
2005-04-17 14:05:31 -07:00
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2007-06-17 17:56:36 -07:00
|
|
|
lpfc_sli_handle_slow_ring_event(struct lpfc_hba *phba,
|
|
|
|
struct lpfc_sli_ring *pring, uint32_t mask)
|
2005-04-17 14:05:31 -07:00
|
|
|
{
|
2007-06-17 17:56:37 -07:00
|
|
|
struct lpfc_pgp *pgp = (phba->sli_rev == 3) ?
|
|
|
|
&phba->slim2p->mbx.us.s3_pgp.port[pring->ringno] :
|
|
|
|
&phba->slim2p->mbx.us.s2.port[pring->ringno];
|
2005-04-17 14:05:31 -07:00
|
|
|
IOCB_t *entry;
|
|
|
|
IOCB_t *irsp = NULL;
|
|
|
|
struct lpfc_iocbq *rspiocbp = NULL;
|
|
|
|
struct lpfc_iocbq *next_iocb;
|
|
|
|
struct lpfc_iocbq *cmdiocbp;
|
|
|
|
struct lpfc_iocbq *saveq;
|
|
|
|
uint8_t iocb_cmd_type;
|
|
|
|
lpfc_iocb_type type;
|
|
|
|
uint32_t status, free_saveq;
|
|
|
|
uint32_t portRspPut, portRspMax;
|
|
|
|
int rc = 1;
|
|
|
|
unsigned long iflag;
|
|
|
|
|
2007-06-17 17:56:36 -07:00
|
|
|
spin_lock_irqsave(&phba->hbalock, iflag);
|
2005-04-17 14:05:31 -07:00
|
|
|
pring->stats.iocb_event++;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* The next available response entry should never exceed the maximum
|
|
|
|
* entries. If it does, treat it as an adapter hardware error.
|
|
|
|
*/
|
|
|
|
portRspMax = pring->numRiocb;
|
|
|
|
portRspPut = le32_to_cpu(pgp->rspPutInx);
|
|
|
|
if (portRspPut >= portRspMax) {
|
|
|
|
/*
|
|
|
|
* Ring <ringno> handler: portRspPut <portRspPut> is bigger then
|
|
|
|
* rsp ring <portRspMax>
|
|
|
|
*/
|
2007-06-17 17:56:37 -07:00
|
|
|
lpfc_printf_log(phba, KERN_ERR, LOG_SLI,
|
2007-08-02 08:10:09 -07:00
|
|
|
"0303 Ring %d handler: portRspPut %d "
|
2005-04-17 14:05:31 -07:00
|
|
|
"is bigger then rsp ring %d\n",
|
2007-08-02 08:10:09 -07:00
|
|
|
pring->ringno, portRspPut, portRspMax);
|
2005-04-17 14:05:31 -07:00
|
|
|
|
2007-06-17 17:56:36 -07:00
|
|
|
phba->link_state = LPFC_HBA_ERROR;
|
|
|
|
spin_unlock_irqrestore(&phba->hbalock, iflag);
|
2005-04-17 14:05:31 -07:00
|
|
|
|
|
|
|
phba->work_hs = HS_FFER3;
|
|
|
|
lpfc_handle_eratt(phba);
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
rmb();
|
|
|
|
while (pring->rspidx != portRspPut) {
|
|
|
|
/*
|
|
|
|
* Build a completion list and call the appropriate handler.
|
|
|
|
* The process is to get the next available response iocb, get
|
|
|
|
* a free iocb from the list, copy the response data into the
|
|
|
|
* free iocb, insert to the continuation list, and update the
|
|
|
|
* next response index to slim. This process makes response
|
|
|
|
* iocb's in the ring available to DMA as fast as possible but
|
|
|
|
* pays a penalty for a copy operation. Since the iocb is
|
|
|
|
* only 32 bytes, this penalty is considered small relative to
|
|
|
|
* the PCI reads for register values and a slim write. When
|
|
|
|
* the ulpLe field is set, the entire Command has been
|
|
|
|
* received.
|
|
|
|
*/
|
2007-06-17 17:56:37 -07:00
|
|
|
entry = lpfc_resp_iocb(phba, pring);
|
|
|
|
|
2007-06-17 17:56:39 -07:00
|
|
|
phba->last_completion_time = jiffies;
|
2007-06-17 17:56:36 -07:00
|
|
|
rspiocbp = __lpfc_sli_get_iocbq(phba);
|
2005-04-17 14:05:31 -07:00
|
|
|
if (rspiocbp == NULL) {
|
|
|
|
printk(KERN_ERR "%s: out of buffers! Failing "
|
|
|
|
"completion.\n", __FUNCTION__);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2007-06-17 17:56:37 -07:00
|
|
|
lpfc_sli_pcimem_bcopy(entry, &rspiocbp->iocb,
|
|
|
|
phba->iocb_rsp_size);
|
2005-04-17 14:05:31 -07:00
|
|
|
irsp = &rspiocbp->iocb;
|
|
|
|
|
|
|
|
if (++pring->rspidx >= portRspMax)
|
|
|
|
pring->rspidx = 0;
|
|
|
|
|
2007-08-02 08:09:43 -07:00
|
|
|
if (pring->ringno == LPFC_ELS_RING) {
|
|
|
|
lpfc_debugfs_slow_ring_trc(phba,
|
|
|
|
"IOCB rsp ring: wd4:x%08x wd6:x%08x wd7:x%08x",
|
|
|
|
*(((uint32_t *) irsp) + 4),
|
|
|
|
*(((uint32_t *) irsp) + 6),
|
|
|
|
*(((uint32_t *) irsp) + 7));
|
|
|
|
}
|
|
|
|
|
2007-06-17 17:56:37 -07:00
|
|
|
writel(pring->rspidx, &phba->host_gp[pring->ringno].rspGetInx);
|
2005-04-17 14:05:31 -07:00
|
|
|
|
|
|
|
if (list_empty(&(pring->iocb_continueq))) {
|
|
|
|
list_add(&rspiocbp->list, &(pring->iocb_continueq));
|
|
|
|
} else {
|
|
|
|
list_add_tail(&rspiocbp->list,
|
|
|
|
&(pring->iocb_continueq));
|
|
|
|
}
|
|
|
|
|
|
|
|
pring->iocb_continueq_cnt++;
|
|
|
|
if (irsp->ulpLe) {
|
|
|
|
/*
|
|
|
|
* By default, the driver expects to free all resources
|
|
|
|
* associated with this iocb completion.
|
|
|
|
*/
|
|
|
|
free_saveq = 1;
|
|
|
|
saveq = list_get_first(&pring->iocb_continueq,
|
|
|
|
struct lpfc_iocbq, list);
|
|
|
|
irsp = &(saveq->iocb);
|
|
|
|
list_del_init(&pring->iocb_continueq);
|
|
|
|
pring->iocb_continueq_cnt = 0;
|
|
|
|
|
|
|
|
pring->stats.iocb_rsp++;
|
|
|
|
|
2007-06-17 17:56:38 -07:00
|
|
|
/*
|
|
|
|
* If resource errors reported from HBA, reduce
|
|
|
|
* queuedepths of the SCSI device.
|
|
|
|
*/
|
|
|
|
if ((irsp->ulpStatus == IOSTAT_LOCAL_REJECT) &&
|
|
|
|
(irsp->un.ulpWord[4] == IOERR_NO_RESOURCES)) {
|
|
|
|
spin_unlock_irqrestore(&phba->hbalock, iflag);
|
|
|
|
lpfc_adjust_queue_depth(phba);
|
|
|
|
spin_lock_irqsave(&phba->hbalock, iflag);
|
|
|
|
}
|
|
|
|
|
2005-04-17 14:05:31 -07:00
|
|
|
if (irsp->ulpStatus) {
|
|
|
|
/* Rsp ring <ringno> error: IOCB */
|
2007-06-17 17:56:37 -07:00
|
|
|
lpfc_printf_log(phba, KERN_WARNING, LOG_SLI,
|
2007-08-02 08:10:09 -07:00
|
|
|
"0328 Rsp Ring %d error: "
|
2007-06-17 17:56:37 -07:00
|
|
|
"IOCB Data: "
|
|
|
|
"x%x x%x x%x x%x "
|
|
|
|
"x%x x%x x%x x%x "
|
|
|
|
"x%x x%x x%x x%x "
|
|
|
|
"x%x x%x x%x x%x\n",
|
|
|
|
pring->ringno,
|
|
|
|
irsp->un.ulpWord[0],
|
|
|
|
irsp->un.ulpWord[1],
|
|
|
|
irsp->un.ulpWord[2],
|
|
|
|
irsp->un.ulpWord[3],
|
|
|
|
irsp->un.ulpWord[4],
|
|
|
|
irsp->un.ulpWord[5],
|
|
|
|
*(((uint32_t *) irsp) + 6),
|
|
|
|
*(((uint32_t *) irsp) + 7),
|
|
|
|
*(((uint32_t *) irsp) + 8),
|
|
|
|
*(((uint32_t *) irsp) + 9),
|
|
|
|
*(((uint32_t *) irsp) + 10),
|
|
|
|
*(((uint32_t *) irsp) + 11),
|
|
|
|
*(((uint32_t *) irsp) + 12),
|
|
|
|
*(((uint32_t *) irsp) + 13),
|
|
|
|
*(((uint32_t *) irsp) + 14),
|
|
|
|
*(((uint32_t *) irsp) + 15));
|
2005-04-17 14:05:31 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Fetch the IOCB command type and call the correct
|
|
|
|
* completion routine. Solicited and Unsolicited
|
|
|
|
* IOCBs on the ELS ring get freed back to the
|
|
|
|
* lpfc_iocb_list by the discovery kernel thread.
|
|
|
|
*/
|
|
|
|
iocb_cmd_type = irsp->ulpCommand & CMD_IOCB_MASK;
|
|
|
|
type = lpfc_sli_iocb_cmd_type(iocb_cmd_type);
|
|
|
|
if (type == LPFC_SOL_IOCB) {
|
2007-06-17 17:56:36 -07:00
|
|
|
spin_unlock_irqrestore(&phba->hbalock,
|
2005-04-17 14:05:31 -07:00
|
|
|
iflag);
|
|
|
|
rc = lpfc_sli_process_sol_iocb(phba, pring,
|
2007-06-17 17:56:36 -07:00
|
|
|
saveq);
|
|
|
|
spin_lock_irqsave(&phba->hbalock, iflag);
|
2005-04-17 14:05:31 -07:00
|
|
|
} else if (type == LPFC_UNSOL_IOCB) {
|
2007-06-17 17:56:36 -07:00
|
|
|
spin_unlock_irqrestore(&phba->hbalock,
|
2005-04-17 14:05:31 -07:00
|
|
|
iflag);
|
|
|
|
rc = lpfc_sli_process_unsol_iocb(phba, pring,
|
2007-06-17 17:56:36 -07:00
|
|
|
saveq);
|
|
|
|
spin_lock_irqsave(&phba->hbalock, iflag);
|
2005-04-17 14:05:31 -07:00
|
|
|
} else if (type == LPFC_ABORT_IOCB) {
|
|
|
|
if ((irsp->ulpCommand != CMD_XRI_ABORTED_CX) &&
|
|
|
|
((cmdiocbp =
|
2005-10-29 08:28:33 -07:00
|
|
|
lpfc_sli_iocbq_lookup(phba, pring,
|
|
|
|
saveq)))) {
|
2005-04-17 14:05:31 -07:00
|
|
|
/* Call the specified completion
|
|
|
|
routine */
|
|
|
|
if (cmdiocbp->iocb_cmpl) {
|
|
|
|
spin_unlock_irqrestore(
|
2007-06-17 17:56:36 -07:00
|
|
|
&phba->hbalock,
|
2005-04-17 14:05:31 -07:00
|
|
|
iflag);
|
|
|
|
(cmdiocbp->iocb_cmpl) (phba,
|
|
|
|
cmdiocbp, saveq);
|
|
|
|
spin_lock_irqsave(
|
2007-06-17 17:56:36 -07:00
|
|
|
&phba->hbalock,
|
2005-04-17 14:05:31 -07:00
|
|
|
iflag);
|
2005-10-29 08:28:33 -07:00
|
|
|
} else
|
2007-06-17 17:56:36 -07:00
|
|
|
__lpfc_sli_release_iocbq(phba,
|
2005-10-29 08:28:33 -07:00
|
|
|
cmdiocbp);
|
2005-04-17 14:05:31 -07:00
|
|
|
}
|
|
|
|
} else if (type == LPFC_UNKNOWN_IOCB) {
|
|
|
|
if (irsp->ulpCommand == CMD_ADAPTER_MSG) {
|
|
|
|
|
|
|
|
char adaptermsg[LPFC_MAX_ADPTMSG];
|
|
|
|
|
|
|
|
memset(adaptermsg, 0,
|
|
|
|
LPFC_MAX_ADPTMSG);
|
|
|
|
memcpy(&adaptermsg[0], (uint8_t *) irsp,
|
|
|
|
MAX_MSG_DATA);
|
|
|
|
dev_warn(&((phba->pcidev)->dev),
|
2007-10-18 03:06:30 -07:00
|
|
|
"lpfc%d: %s\n",
|
2005-04-17 14:05:31 -07:00
|
|
|
phba->brd_no, adaptermsg);
|
|
|
|
} else {
|
|
|
|
/* Unknown IOCB command */
|
2007-06-17 17:56:38 -07:00
|
|
|
lpfc_printf_log(phba, KERN_ERR, LOG_SLI,
|
2007-08-02 08:10:09 -07:00
|
|
|
"0335 Unknown IOCB "
|
2007-06-17 17:56:38 -07:00
|
|
|
"command Data: x%x "
|
|
|
|
"x%x x%x x%x\n",
|
|
|
|
irsp->ulpCommand,
|
|
|
|
irsp->ulpStatus,
|
|
|
|
irsp->ulpIoTag,
|
|
|
|
irsp->ulpContext);
|
2005-04-17 14:05:31 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (free_saveq) {
|
2007-06-17 17:56:36 -07:00
|
|
|
list_for_each_entry_safe(rspiocbp, next_iocb,
|
|
|
|
&saveq->list, list) {
|
|
|
|
list_del(&rspiocbp->list);
|
|
|
|
__lpfc_sli_release_iocbq(phba,
|
|
|
|
rspiocbp);
|
2005-04-17 14:05:31 -07:00
|
|
|
}
|
2007-06-17 17:56:36 -07:00
|
|
|
__lpfc_sli_release_iocbq(phba, saveq);
|
2005-04-17 14:05:31 -07:00
|
|
|
}
|
2007-06-17 17:56:38 -07:00
|
|
|
rspiocbp = NULL;
|
2005-04-17 14:05:31 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* If the port response put pointer has not been updated, sync
|
|
|
|
* the pgp->rspPutInx in the MAILBOX_tand fetch the new port
|
|
|
|
* response put pointer.
|
|
|
|
*/
|
|
|
|
if (pring->rspidx == portRspPut) {
|
|
|
|
portRspPut = le32_to_cpu(pgp->rspPutInx);
|
|
|
|
}
|
|
|
|
} /* while (pring->rspidx != portRspPut) */
|
|
|
|
|
2007-06-17 17:56:38 -07:00
|
|
|
if ((rspiocbp != NULL) && (mask & HA_R0RE_REQ)) {
|
2005-04-17 14:05:31 -07:00
|
|
|
/* At least one response entry has been freed */
|
|
|
|
pring->stats.iocb_rsp_full++;
|
|
|
|
/* SET RxRE_RSP in Chip Att register */
|
|
|
|
status = ((CA_R0ATT | CA_R0RE_RSP) << (pring->ringno * 4));
|
|
|
|
writel(status, phba->CAregaddr);
|
|
|
|
readl(phba->CAregaddr); /* flush */
|
|
|
|
}
|
|
|
|
if ((mask & HA_R0CE_RSP) && (pring->flag & LPFC_CALL_RING_AVAILABLE)) {
|
|
|
|
pring->flag &= ~LPFC_CALL_RING_AVAILABLE;
|
|
|
|
pring->stats.iocb_cmd_empty++;
|
|
|
|
|
|
|
|
/* Force update of the local copy of cmdGetInx */
|
|
|
|
pring->local_getidx = le32_to_cpu(pgp->cmdGetInx);
|
|
|
|
lpfc_sli_resume_iocb(phba, pring);
|
|
|
|
|
|
|
|
if ((pring->lpfc_sli_cmd_available))
|
|
|
|
(pring->lpfc_sli_cmd_available) (phba, pring);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2007-06-17 17:56:36 -07:00
|
|
|
spin_unlock_irqrestore(&phba->hbalock, iflag);
|
2005-04-17 14:05:31 -07:00
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
2007-06-17 17:56:36 -07:00
|
|
|
void
|
2005-04-17 14:05:31 -07:00
|
|
|
lpfc_sli_abort_iocb_ring(struct lpfc_hba *phba, struct lpfc_sli_ring *pring)
|
|
|
|
{
|
2007-04-25 06:52:20 -07:00
|
|
|
LIST_HEAD(completions);
|
2005-04-17 14:05:31 -07:00
|
|
|
struct lpfc_iocbq *iocb, *next_iocb;
|
2007-04-25 06:52:20 -07:00
|
|
|
IOCB_t *cmd = NULL;
|
2005-04-17 14:05:31 -07:00
|
|
|
|
2007-06-17 17:56:38 -07:00
|
|
|
if (pring->ringno == LPFC_ELS_RING) {
|
|
|
|
lpfc_fabric_abort_hba(phba);
|
|
|
|
}
|
|
|
|
|
2005-04-17 14:05:31 -07:00
|
|
|
/* Error everything on txq and txcmplq
|
|
|
|
* First do the txq.
|
|
|
|
*/
|
2007-06-17 17:56:36 -07:00
|
|
|
spin_lock_irq(&phba->hbalock);
|
2007-04-25 06:52:20 -07:00
|
|
|
list_splice_init(&pring->txq, &completions);
|
2005-04-17 14:05:31 -07:00
|
|
|
pring->txq_cnt = 0;
|
|
|
|
|
|
|
|
/* Next issue ABTS for everything on the txcmplq */
|
2007-04-25 06:52:20 -07:00
|
|
|
list_for_each_entry_safe(iocb, next_iocb, &pring->txcmplq, list)
|
|
|
|
lpfc_sli_issue_abort_iotag(phba, pring, iocb);
|
2005-04-17 14:05:31 -07:00
|
|
|
|
2007-06-17 17:56:36 -07:00
|
|
|
spin_unlock_irq(&phba->hbalock);
|
2005-04-17 14:05:31 -07:00
|
|
|
|
2007-04-25 06:52:20 -07:00
|
|
|
while (!list_empty(&completions)) {
|
|
|
|
iocb = list_get_first(&completions, struct lpfc_iocbq, list);
|
|
|
|
cmd = &iocb->iocb;
|
2007-06-17 17:56:38 -07:00
|
|
|
list_del_init(&iocb->list);
|
2005-04-17 14:05:31 -07:00
|
|
|
|
2007-06-17 17:56:36 -07:00
|
|
|
if (!iocb->iocb_cmpl)
|
|
|
|
lpfc_sli_release_iocbq(phba, iocb);
|
|
|
|
else {
|
2005-04-17 14:05:31 -07:00
|
|
|
cmd->ulpStatus = IOSTAT_LOCAL_REJECT;
|
|
|
|
cmd->un.ulpWord[4] = IOERR_SLI_ABORTED;
|
|
|
|
(iocb->iocb_cmpl) (phba, iocb, iocb);
|
2007-06-17 17:56:36 -07:00
|
|
|
}
|
2005-04-17 14:05:31 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-02-28 17:25:27 -07:00
|
|
|
int
|
2007-06-17 17:56:36 -07:00
|
|
|
lpfc_sli_brdready(struct lpfc_hba *phba, uint32_t mask)
|
2005-04-17 14:05:31 -07:00
|
|
|
{
|
2006-02-28 17:25:27 -07:00
|
|
|
uint32_t status;
|
|
|
|
int i = 0;
|
|
|
|
int retval = 0;
|
2005-04-17 14:05:31 -07:00
|
|
|
|
2006-02-28 17:25:27 -07:00
|
|
|
/* Read the HBA Host Status Register */
|
|
|
|
status = readl(phba->HSregaddr);
|
2005-04-17 14:05:31 -07:00
|
|
|
|
2006-02-28 17:25:27 -07:00
|
|
|
/*
|
|
|
|
* Check status register every 100ms for 5 retries, then every
|
|
|
|
* 500ms for 5, then every 2.5 sec for 5, then reset board and
|
|
|
|
* every 2.5 sec for 4.
|
|
|
|
* Break our of the loop if errors occurred during init.
|
|
|
|
*/
|
|
|
|
while (((status & mask) != mask) &&
|
|
|
|
!(status & HS_FFERM) &&
|
|
|
|
i++ < 20) {
|
2005-04-17 14:05:31 -07:00
|
|
|
|
2006-02-28 17:25:27 -07:00
|
|
|
if (i <= 5)
|
|
|
|
msleep(10);
|
|
|
|
else if (i <= 10)
|
|
|
|
msleep(500);
|
|
|
|
else
|
|
|
|
msleep(2500);
|
2005-04-17 14:05:31 -07:00
|
|
|
|
2006-02-28 17:25:27 -07:00
|
|
|
if (i == 15) {
|
2007-06-17 17:56:36 -07:00
|
|
|
/* Do post */
|
2007-06-17 17:56:38 -07:00
|
|
|
phba->pport->port_state = LPFC_VPORT_UNKNOWN;
|
2006-02-28 17:25:27 -07:00
|
|
|
lpfc_sli_brdrestart(phba);
|
|
|
|
}
|
|
|
|
/* Read the HBA Host Status Register */
|
|
|
|
status = readl(phba->HSregaddr);
|
|
|
|
}
|
2005-04-17 14:05:31 -07:00
|
|
|
|
2006-02-28 17:25:27 -07:00
|
|
|
/* Check to see if any errors occurred during init */
|
|
|
|
if ((status & HS_FFERM) || (i >= 20)) {
|
2007-06-17 17:56:36 -07:00
|
|
|
phba->link_state = LPFC_HBA_ERROR;
|
2006-02-28 17:25:27 -07:00
|
|
|
retval = 1;
|
2005-04-17 14:05:31 -07:00
|
|
|
}
|
|
|
|
|
2006-02-28 17:25:27 -07:00
|
|
|
return retval;
|
|
|
|
}
|
2005-04-17 14:05:31 -07:00
|
|
|
|
2006-03-07 13:04:13 -07:00
|
|
|
#define BARRIER_TEST_PATTERN (0xdeadbeef)
|
|
|
|
|
2007-06-17 17:56:36 -07:00
|
|
|
void lpfc_reset_barrier(struct lpfc_hba *phba)
|
2006-03-07 13:04:13 -07:00
|
|
|
{
|
2006-07-06 12:50:50 -07:00
|
|
|
uint32_t __iomem *resp_buf;
|
|
|
|
uint32_t __iomem *mbox_buf;
|
2006-03-07 13:04:13 -07:00
|
|
|
volatile uint32_t mbox;
|
|
|
|
uint32_t hc_copy;
|
|
|
|
int i;
|
|
|
|
uint8_t hdrtype;
|
|
|
|
|
|
|
|
pci_read_config_byte(phba->pcidev, PCI_HEADER_TYPE, &hdrtype);
|
|
|
|
if (hdrtype != 0x80 ||
|
|
|
|
(FC_JEDEC_ID(phba->vpd.rev.biuRev) != HELIOS_JEDEC_ID &&
|
|
|
|
FC_JEDEC_ID(phba->vpd.rev.biuRev) != THOR_JEDEC_ID))
|
|
|
|
return;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Tell the other part of the chip to suspend temporarily all
|
|
|
|
* its DMA activity.
|
|
|
|
*/
|
2006-07-06 12:50:50 -07:00
|
|
|
resp_buf = phba->MBslimaddr;
|
2006-03-07 13:04:13 -07:00
|
|
|
|
|
|
|
/* Disable the error attention */
|
|
|
|
hc_copy = readl(phba->HCregaddr);
|
|
|
|
writel((hc_copy & ~HC_ERINT_ENA), phba->HCregaddr);
|
|
|
|
readl(phba->HCregaddr); /* flush */
|
2007-06-17 17:56:36 -07:00
|
|
|
phba->link_flag |= LS_IGNORE_ERATT;
|
2006-03-07 13:04:13 -07:00
|
|
|
|
|
|
|
if (readl(phba->HAregaddr) & HA_ERATT) {
|
|
|
|
/* Clear Chip error bit */
|
|
|
|
writel(HA_ERATT, phba->HAregaddr);
|
2007-06-17 17:56:36 -07:00
|
|
|
phba->pport->stopped = 1;
|
2006-03-07 13:04:13 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
mbox = 0;
|
|
|
|
((MAILBOX_t *)&mbox)->mbxCommand = MBX_KILL_BOARD;
|
|
|
|
((MAILBOX_t *)&mbox)->mbxOwner = OWN_CHIP;
|
|
|
|
|
|
|
|
writel(BARRIER_TEST_PATTERN, (resp_buf + 1));
|
2006-07-06 12:50:50 -07:00
|
|
|
mbox_buf = phba->MBslimaddr;
|
2006-03-07 13:04:13 -07:00
|
|
|
writel(mbox, mbox_buf);
|
|
|
|
|
|
|
|
for (i = 0;
|
|
|
|
readl(resp_buf + 1) != ~(BARRIER_TEST_PATTERN) && i < 50; i++)
|
|
|
|
mdelay(1);
|
|
|
|
|
|
|
|
if (readl(resp_buf + 1) != ~(BARRIER_TEST_PATTERN)) {
|
|
|
|
if (phba->sli.sli_flag & LPFC_SLI2_ACTIVE ||
|
2007-06-17 17:56:36 -07:00
|
|
|
phba->pport->stopped)
|
2006-03-07 13:04:13 -07:00
|
|
|
goto restore_hc;
|
|
|
|
else
|
|
|
|
goto clear_errat;
|
|
|
|
}
|
|
|
|
|
|
|
|
((MAILBOX_t *)&mbox)->mbxOwner = OWN_HOST;
|
|
|
|
for (i = 0; readl(resp_buf) != mbox && i < 500; i++)
|
|
|
|
mdelay(1);
|
|
|
|
|
|
|
|
clear_errat:
|
|
|
|
|
|
|
|
while (!(readl(phba->HAregaddr) & HA_ERATT) && ++i < 500)
|
|
|
|
mdelay(1);
|
|
|
|
|
|
|
|
if (readl(phba->HAregaddr) & HA_ERATT) {
|
|
|
|
writel(HA_ERATT, phba->HAregaddr);
|
2007-06-17 17:56:36 -07:00
|
|
|
phba->pport->stopped = 1;
|
2006-03-07 13:04:13 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
restore_hc:
|
2007-06-17 17:56:36 -07:00
|
|
|
phba->link_flag &= ~LS_IGNORE_ERATT;
|
2006-03-07 13:04:13 -07:00
|
|
|
writel(hc_copy, phba->HCregaddr);
|
|
|
|
readl(phba->HCregaddr); /* flush */
|
|
|
|
}
|
|
|
|
|
2006-02-28 17:25:27 -07:00
|
|
|
int
|
2007-06-17 17:56:36 -07:00
|
|
|
lpfc_sli_brdkill(struct lpfc_hba *phba)
|
2006-02-28 17:25:27 -07:00
|
|
|
{
|
|
|
|
struct lpfc_sli *psli;
|
|
|
|
LPFC_MBOXQ_t *pmb;
|
|
|
|
uint32_t status;
|
|
|
|
uint32_t ha_copy;
|
|
|
|
int retval;
|
|
|
|
int i = 0;
|
2005-04-17 14:05:31 -07:00
|
|
|
|
2006-02-28 17:25:27 -07:00
|
|
|
psli = &phba->sli;
|
2005-04-17 14:05:31 -07:00
|
|
|
|
2006-02-28 17:25:27 -07:00
|
|
|
/* Kill HBA */
|
2007-06-17 17:56:37 -07:00
|
|
|
lpfc_printf_log(phba, KERN_INFO, LOG_SLI,
|
2007-08-02 08:10:09 -07:00
|
|
|
"0329 Kill HBA Data: x%x x%x\n",
|
|
|
|
phba->pport->port_state, psli->sli_flag);
|
2006-02-28 17:25:27 -07:00
|
|
|
|
2007-10-27 10:37:33 -07:00
|
|
|
pmb = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL);
|
|
|
|
if (!pmb)
|
2006-02-28 17:25:27 -07:00
|
|
|
return 1;
|
|
|
|
|
|
|
|
/* Disable the error attention */
|
2007-06-17 17:56:36 -07:00
|
|
|
spin_lock_irq(&phba->hbalock);
|
2006-02-28 17:25:27 -07:00
|
|
|
status = readl(phba->HCregaddr);
|
|
|
|
status &= ~HC_ERINT_ENA;
|
|
|
|
writel(status, phba->HCregaddr);
|
|
|
|
readl(phba->HCregaddr); /* flush */
|
2007-06-17 17:56:36 -07:00
|
|
|
phba->link_flag |= LS_IGNORE_ERATT;
|
|
|
|
spin_unlock_irq(&phba->hbalock);
|
2006-02-28 17:25:27 -07:00
|
|
|
|
|
|
|
lpfc_kill_board(phba, pmb);
|
|
|
|
pmb->mbox_cmpl = lpfc_sli_def_mbox_cmpl;
|
|
|
|
retval = lpfc_sli_issue_mbox(phba, pmb, MBX_NOWAIT);
|
|
|
|
|
|
|
|
if (retval != MBX_SUCCESS) {
|
|
|
|
if (retval != MBX_BUSY)
|
|
|
|
mempool_free(pmb, phba->mbox_mem_pool);
|
2007-06-17 17:56:36 -07:00
|
|
|
spin_lock_irq(&phba->hbalock);
|
|
|
|
phba->link_flag &= ~LS_IGNORE_ERATT;
|
|
|
|
spin_unlock_irq(&phba->hbalock);
|
2006-02-28 17:25:27 -07:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2006-03-07 13:04:13 -07:00
|
|
|
psli->sli_flag &= ~LPFC_SLI2_ACTIVE;
|
|
|
|
|
2006-02-28 17:25:27 -07:00
|
|
|
mempool_free(pmb, phba->mbox_mem_pool);
|
|
|
|
|
|
|
|
/* There is no completion for a KILL_BOARD mbox cmd. Check for an error
|
|
|
|
* attention every 100ms for 3 seconds. If we don't get ERATT after
|
|
|
|
* 3 seconds we still set HBA_ERROR state because the status of the
|
|
|
|
* board is now undefined.
|
|
|
|
*/
|
|
|
|
ha_copy = readl(phba->HAregaddr);
|
|
|
|
|
|
|
|
while ((i++ < 30) && !(ha_copy & HA_ERATT)) {
|
|
|
|
mdelay(100);
|
|
|
|
ha_copy = readl(phba->HAregaddr);
|
|
|
|
}
|
|
|
|
|
|
|
|
del_timer_sync(&psli->mbox_tmo);
|
2006-03-07 13:04:13 -07:00
|
|
|
if (ha_copy & HA_ERATT) {
|
|
|
|
writel(HA_ERATT, phba->HAregaddr);
|
2007-06-17 17:56:36 -07:00
|
|
|
phba->pport->stopped = 1;
|
2006-03-07 13:04:13 -07:00
|
|
|
}
|
2007-06-17 17:56:36 -07:00
|
|
|
spin_lock_irq(&phba->hbalock);
|
2006-02-28 17:25:27 -07:00
|
|
|
psli->sli_flag &= ~LPFC_SLI_MBOX_ACTIVE;
|
2007-06-17 17:56:36 -07:00
|
|
|
phba->link_flag &= ~LS_IGNORE_ERATT;
|
|
|
|
spin_unlock_irq(&phba->hbalock);
|
2006-02-28 17:25:27 -07:00
|
|
|
|
|
|
|
psli->mbox_active = NULL;
|
|
|
|
lpfc_hba_down_post(phba);
|
2007-06-17 17:56:36 -07:00
|
|
|
phba->link_state = LPFC_HBA_ERROR;
|
2006-02-28 17:25:27 -07:00
|
|
|
|
2007-06-17 17:56:36 -07:00
|
|
|
return ha_copy & HA_ERATT ? 0 : 1;
|
2005-04-17 14:05:31 -07:00
|
|
|
}
|
|
|
|
|
2006-02-28 17:25:27 -07:00
|
|
|
int
|
2007-06-17 17:56:36 -07:00
|
|
|
lpfc_sli_brdreset(struct lpfc_hba *phba)
|
2005-04-17 14:05:31 -07:00
|
|
|
{
|
2006-02-28 17:25:27 -07:00
|
|
|
struct lpfc_sli *psli;
|
2005-04-17 14:05:31 -07:00
|
|
|
struct lpfc_sli_ring *pring;
|
2006-02-28 17:25:27 -07:00
|
|
|
uint16_t cfg_value;
|
2005-04-17 14:05:31 -07:00
|
|
|
int i;
|
|
|
|
|
2006-02-28 17:25:27 -07:00
|
|
|
psli = &phba->sli;
|
2005-04-17 14:05:31 -07:00
|
|
|
|
2006-02-28 17:25:27 -07:00
|
|
|
/* Reset HBA */
|
|
|
|
lpfc_printf_log(phba, KERN_INFO, LOG_SLI,
|
2007-08-02 08:10:09 -07:00
|
|
|
"0325 Reset HBA Data: x%x x%x\n",
|
2007-06-17 17:56:36 -07:00
|
|
|
phba->pport->port_state, psli->sli_flag);
|
2005-04-17 14:05:31 -07:00
|
|
|
|
|
|
|
/* perform board reset */
|
|
|
|
phba->fc_eventTag = 0;
|
2007-06-17 17:56:36 -07:00
|
|
|
phba->pport->fc_myDID = 0;
|
|
|
|
phba->pport->fc_prevDID = 0;
|
2005-04-17 14:05:31 -07:00
|
|
|
|
2006-02-28 17:25:27 -07:00
|
|
|
/* Turn off parity checking and serr during the physical reset */
|
|
|
|
pci_read_config_word(phba->pcidev, PCI_COMMAND, &cfg_value);
|
|
|
|
pci_write_config_word(phba->pcidev, PCI_COMMAND,
|
|
|
|
(cfg_value &
|
|
|
|
~(PCI_COMMAND_PARITY | PCI_COMMAND_SERR)));
|
|
|
|
|
2006-08-01 04:33:52 -07:00
|
|
|
psli->sli_flag &= ~(LPFC_SLI2_ACTIVE | LPFC_PROCESS_LA);
|
2006-02-28 17:25:27 -07:00
|
|
|
/* Now toggle INITFF bit in the Host Control Register */
|
|
|
|
writel(HC_INITFF, phba->HCregaddr);
|
|
|
|
mdelay(1);
|
|
|
|
readl(phba->HCregaddr); /* flush */
|
|
|
|
writel(0, phba->HCregaddr);
|
|
|
|
readl(phba->HCregaddr); /* flush */
|
|
|
|
|
|
|
|
/* Restore PCI cmd register */
|
|
|
|
pci_write_config_word(phba->pcidev, PCI_COMMAND, cfg_value);
|
2005-04-17 14:05:31 -07:00
|
|
|
|
|
|
|
/* Initialize relevant SLI info */
|
2006-02-28 17:25:27 -07:00
|
|
|
for (i = 0; i < psli->num_rings; i++) {
|
|
|
|
pring = &psli->ring[i];
|
2005-04-17 14:05:31 -07:00
|
|
|
pring->flag = 0;
|
|
|
|
pring->rspidx = 0;
|
|
|
|
pring->next_cmdidx = 0;
|
|
|
|
pring->local_getidx = 0;
|
|
|
|
pring->cmdidx = 0;
|
|
|
|
pring->missbufcnt = 0;
|
|
|
|
}
|
|
|
|
|
2007-06-17 17:56:36 -07:00
|
|
|
phba->link_state = LPFC_WARM_START;
|
2006-02-28 17:25:27 -07:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2007-06-17 17:56:36 -07:00
|
|
|
lpfc_sli_brdrestart(struct lpfc_hba *phba)
|
2006-02-28 17:25:27 -07:00
|
|
|
{
|
|
|
|
MAILBOX_t *mb;
|
|
|
|
struct lpfc_sli *psli;
|
|
|
|
uint16_t skip_post;
|
|
|
|
volatile uint32_t word0;
|
|
|
|
void __iomem *to_slim;
|
|
|
|
|
2007-06-17 17:56:36 -07:00
|
|
|
spin_lock_irq(&phba->hbalock);
|
2006-02-28 17:25:27 -07:00
|
|
|
|
|
|
|
psli = &phba->sli;
|
|
|
|
|
|
|
|
/* Restart HBA */
|
|
|
|
lpfc_printf_log(phba, KERN_INFO, LOG_SLI,
|
2007-08-02 08:10:09 -07:00
|
|
|
"0337 Restart HBA Data: x%x x%x\n",
|
2007-06-17 17:56:36 -07:00
|
|
|
phba->pport->port_state, psli->sli_flag);
|
2006-02-28 17:25:27 -07:00
|
|
|
|
|
|
|
word0 = 0;
|
|
|
|
mb = (MAILBOX_t *) &word0;
|
|
|
|
mb->mbxCommand = MBX_RESTART;
|
|
|
|
mb->mbxHc = 1;
|
|
|
|
|
2006-03-07 13:04:13 -07:00
|
|
|
lpfc_reset_barrier(phba);
|
|
|
|
|
2006-02-28 17:25:27 -07:00
|
|
|
to_slim = phba->MBslimaddr;
|
|
|
|
writel(*(uint32_t *) mb, to_slim);
|
|
|
|
readl(to_slim); /* flush */
|
|
|
|
|
|
|
|
/* Only skip post after fc_ffinit is completed */
|
2007-06-17 17:56:36 -07:00
|
|
|
if (phba->pport->port_state) {
|
2006-02-28 17:25:27 -07:00
|
|
|
skip_post = 1;
|
|
|
|
word0 = 1; /* This is really setting up word1 */
|
2005-04-17 14:05:31 -07:00
|
|
|
} else {
|
2006-02-28 17:25:27 -07:00
|
|
|
skip_post = 0;
|
|
|
|
word0 = 0; /* This is really setting up word1 */
|
2005-04-17 14:05:31 -07:00
|
|
|
}
|
2006-07-06 12:50:50 -07:00
|
|
|
to_slim = phba->MBslimaddr + sizeof (uint32_t);
|
2006-02-28 17:25:27 -07:00
|
|
|
writel(*(uint32_t *) mb, to_slim);
|
|
|
|
readl(to_slim); /* flush */
|
2005-04-17 14:05:31 -07:00
|
|
|
|
2006-02-28 17:25:27 -07:00
|
|
|
lpfc_sli_brdreset(phba);
|
2007-06-17 17:56:36 -07:00
|
|
|
phba->pport->stopped = 0;
|
|
|
|
phba->link_state = LPFC_INIT_START;
|
2006-02-28 17:25:27 -07:00
|
|
|
|
2007-06-17 17:56:36 -07:00
|
|
|
spin_unlock_irq(&phba->hbalock);
|
2006-02-28 17:25:27 -07:00
|
|
|
|
2006-08-02 12:24:34 -07:00
|
|
|
memset(&psli->lnk_stat_offsets, 0, sizeof(psli->lnk_stat_offsets));
|
|
|
|
psli->stats_start = get_seconds();
|
|
|
|
|
2006-02-28 17:25:27 -07:00
|
|
|
if (skip_post)
|
|
|
|
mdelay(100);
|
|
|
|
else
|
|
|
|
mdelay(2000);
|
|
|
|
|
|
|
|
lpfc_hba_down_post(phba);
|
2005-04-17 14:05:31 -07:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
lpfc_sli_chipset_init(struct lpfc_hba *phba)
|
|
|
|
{
|
|
|
|
uint32_t status, i = 0;
|
|
|
|
|
|
|
|
/* Read the HBA Host Status Register */
|
|
|
|
status = readl(phba->HSregaddr);
|
|
|
|
|
|
|
|
/* Check status register to see what current state is */
|
|
|
|
i = 0;
|
|
|
|
while ((status & (HS_FFRDY | HS_MBRDY)) != (HS_FFRDY | HS_MBRDY)) {
|
|
|
|
|
|
|
|
/* Check every 100ms for 5 retries, then every 500ms for 5, then
|
|
|
|
* every 2.5 sec for 5, then reset board and every 2.5 sec for
|
|
|
|
* 4.
|
|
|
|
*/
|
|
|
|
if (i++ >= 20) {
|
|
|
|
/* Adapter failed to init, timeout, status reg
|
|
|
|
<status> */
|
2007-06-17 17:56:37 -07:00
|
|
|
lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
|
2007-08-02 08:10:09 -07:00
|
|
|
"0436 Adapter failed to init, "
|
|
|
|
"timeout, status reg x%x\n", status);
|
2007-06-17 17:56:36 -07:00
|
|
|
phba->link_state = LPFC_HBA_ERROR;
|
2005-04-17 14:05:31 -07:00
|
|
|
return -ETIMEDOUT;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Check to see if any errors occurred during init */
|
|
|
|
if (status & HS_FFERM) {
|
|
|
|
/* ERROR: During chipset initialization */
|
|
|
|
/* Adapter failed to init, chipset, status reg
|
|
|
|
<status> */
|
2007-06-17 17:56:37 -07:00
|
|
|
lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
|
2007-08-02 08:10:09 -07:00
|
|
|
"0437 Adapter failed to init, "
|
|
|
|
"chipset, status reg x%x\n", status);
|
2007-06-17 17:56:36 -07:00
|
|
|
phba->link_state = LPFC_HBA_ERROR;
|
2005-04-17 14:05:31 -07:00
|
|
|
return -EIO;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (i <= 5) {
|
|
|
|
msleep(10);
|
|
|
|
} else if (i <= 10) {
|
|
|
|
msleep(500);
|
|
|
|
} else {
|
|
|
|
msleep(2500);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (i == 15) {
|
2007-06-17 17:56:36 -07:00
|
|
|
/* Do post */
|
2007-06-17 17:56:38 -07:00
|
|
|
phba->pport->port_state = LPFC_VPORT_UNKNOWN;
|
2006-02-28 17:25:27 -07:00
|
|
|
lpfc_sli_brdrestart(phba);
|
2005-04-17 14:05:31 -07:00
|
|
|
}
|
|
|
|
/* Read the HBA Host Status Register */
|
|
|
|
status = readl(phba->HSregaddr);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Check to see if any errors occurred during init */
|
|
|
|
if (status & HS_FFERM) {
|
|
|
|
/* ERROR: During chipset initialization */
|
|
|
|
/* Adapter failed to init, chipset, status reg <status> */
|
2007-06-17 17:56:37 -07:00
|
|
|
lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
|
2007-08-02 08:10:09 -07:00
|
|
|
"0438 Adapter failed to init, chipset, "
|
|
|
|
"status reg x%x\n", status);
|
2007-06-17 17:56:36 -07:00
|
|
|
phba->link_state = LPFC_HBA_ERROR;
|
2005-04-17 14:05:31 -07:00
|
|
|
return -EIO;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Clear all interrupt enable conditions */
|
|
|
|
writel(0, phba->HCregaddr);
|
|
|
|
readl(phba->HCregaddr); /* flush */
|
|
|
|
|
|
|
|
/* setup host attn register */
|
|
|
|
writel(0xffffffff, phba->HAregaddr);
|
|
|
|
readl(phba->HAregaddr); /* flush */
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2007-08-02 08:10:21 -07:00
|
|
|
int
|
2007-06-17 17:56:37 -07:00
|
|
|
lpfc_sli_hbq_count(void)
|
|
|
|
{
|
2007-06-17 17:56:38 -07:00
|
|
|
return ARRAY_SIZE(lpfc_hbq_defs);
|
2007-06-17 17:56:37 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
lpfc_sli_hbq_entry_count(void)
|
|
|
|
{
|
|
|
|
int hbq_count = lpfc_sli_hbq_count();
|
|
|
|
int count = 0;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < hbq_count; ++i)
|
2007-06-17 17:56:38 -07:00
|
|
|
count += lpfc_hbq_defs[i]->entry_count;
|
2007-06-17 17:56:37 -07:00
|
|
|
return count;
|
|
|
|
}
|
|
|
|
|
2005-04-17 14:05:31 -07:00
|
|
|
int
|
2007-06-17 17:56:37 -07:00
|
|
|
lpfc_sli_hbq_size(void)
|
|
|
|
{
|
|
|
|
return lpfc_sli_hbq_entry_count() * sizeof(struct lpfc_hbq_entry);
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
lpfc_sli_hbq_setup(struct lpfc_hba *phba)
|
|
|
|
{
|
|
|
|
int hbq_count = lpfc_sli_hbq_count();
|
|
|
|
LPFC_MBOXQ_t *pmb;
|
|
|
|
MAILBOX_t *pmbox;
|
|
|
|
uint32_t hbqno;
|
|
|
|
uint32_t hbq_entry_index;
|
|
|
|
|
2007-06-17 17:56:38 -07:00
|
|
|
/* Get a Mailbox buffer to setup mailbox
|
|
|
|
* commands for HBA initialization
|
|
|
|
*/
|
2007-06-17 17:56:37 -07:00
|
|
|
pmb = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL);
|
|
|
|
|
|
|
|
if (!pmb)
|
|
|
|
return -ENOMEM;
|
|
|
|
|
|
|
|
pmbox = &pmb->mb;
|
|
|
|
|
|
|
|
/* Initialize the struct lpfc_sli_hbq structure for each hbq */
|
|
|
|
phba->link_state = LPFC_INIT_MBX_CMDS;
|
|
|
|
|
|
|
|
hbq_entry_index = 0;
|
|
|
|
for (hbqno = 0; hbqno < hbq_count; ++hbqno) {
|
|
|
|
phba->hbqs[hbqno].next_hbqPutIdx = 0;
|
|
|
|
phba->hbqs[hbqno].hbqPutIdx = 0;
|
|
|
|
phba->hbqs[hbqno].local_hbqGetIdx = 0;
|
|
|
|
phba->hbqs[hbqno].entry_count =
|
2007-06-17 17:56:38 -07:00
|
|
|
lpfc_hbq_defs[hbqno]->entry_count;
|
2007-08-02 08:10:31 -07:00
|
|
|
lpfc_config_hbq(phba, hbqno, lpfc_hbq_defs[hbqno],
|
|
|
|
hbq_entry_index, pmb);
|
2007-06-17 17:56:37 -07:00
|
|
|
hbq_entry_index += phba->hbqs[hbqno].entry_count;
|
|
|
|
|
|
|
|
if (lpfc_sli_issue_mbox(phba, pmb, MBX_POLL) != MBX_SUCCESS) {
|
|
|
|
/* Adapter failed to init, mbxCmd <cmd> CFG_RING,
|
|
|
|
mbxStatus <status>, ring <num> */
|
|
|
|
|
|
|
|
lpfc_printf_log(phba, KERN_ERR,
|
2007-06-17 17:56:38 -07:00
|
|
|
LOG_SLI | LOG_VPORT,
|
2007-08-02 08:10:09 -07:00
|
|
|
"1805 Adapter failed to init. "
|
2007-06-17 17:56:37 -07:00
|
|
|
"Data: x%x x%x x%x\n",
|
2007-08-02 08:10:09 -07:00
|
|
|
pmbox->mbxCommand,
|
2007-06-17 17:56:37 -07:00
|
|
|
pmbox->mbxStatus, hbqno);
|
|
|
|
|
|
|
|
phba->link_state = LPFC_HBA_ERROR;
|
|
|
|
mempool_free(pmb, phba->mbox_mem_pool);
|
|
|
|
return ENXIO;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
phba->hbq_count = hbq_count;
|
|
|
|
|
|
|
|
mempool_free(pmb, phba->mbox_mem_pool);
|
|
|
|
|
2007-06-17 17:56:38 -07:00
|
|
|
/* Initially populate or replenish the HBQs */
|
|
|
|
for (hbqno = 0; hbqno < hbq_count; ++hbqno) {
|
|
|
|
if (lpfc_sli_hbqbuf_init_hbqs(phba, hbqno))
|
|
|
|
return -ENOMEM;
|
|
|
|
}
|
2007-06-17 17:56:37 -07:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
|
|
|
lpfc_do_config_port(struct lpfc_hba *phba, int sli_mode)
|
2005-04-17 14:05:31 -07:00
|
|
|
{
|
|
|
|
LPFC_MBOXQ_t *pmb;
|
|
|
|
uint32_t resetcount = 0, rc = 0, done = 0;
|
|
|
|
|
|
|
|
pmb = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL);
|
|
|
|
if (!pmb) {
|
2007-06-17 17:56:36 -07:00
|
|
|
phba->link_state = LPFC_HBA_ERROR;
|
2005-04-17 14:05:31 -07:00
|
|
|
return -ENOMEM;
|
|
|
|
}
|
|
|
|
|
2007-06-17 17:56:37 -07:00
|
|
|
phba->sli_rev = sli_mode;
|
2005-04-17 14:05:31 -07:00
|
|
|
while (resetcount < 2 && !done) {
|
2007-06-17 17:56:36 -07:00
|
|
|
spin_lock_irq(&phba->hbalock);
|
2006-08-01 04:33:52 -07:00
|
|
|
phba->sli.sli_flag |= LPFC_SLI_MBOX_ACTIVE;
|
2007-06-17 17:56:36 -07:00
|
|
|
spin_unlock_irq(&phba->hbalock);
|
2007-06-17 17:56:38 -07:00
|
|
|
phba->pport->port_state = LPFC_VPORT_UNKNOWN;
|
2006-02-28 17:25:27 -07:00
|
|
|
lpfc_sli_brdrestart(phba);
|
2005-04-17 14:05:31 -07:00
|
|
|
msleep(2500);
|
|
|
|
rc = lpfc_sli_chipset_init(phba);
|
|
|
|
if (rc)
|
|
|
|
break;
|
|
|
|
|
2007-06-17 17:56:36 -07:00
|
|
|
spin_lock_irq(&phba->hbalock);
|
2006-08-01 04:33:52 -07:00
|
|
|
phba->sli.sli_flag &= ~LPFC_SLI_MBOX_ACTIVE;
|
2007-06-17 17:56:36 -07:00
|
|
|
spin_unlock_irq(&phba->hbalock);
|
2005-04-17 14:05:31 -07:00
|
|
|
resetcount++;
|
|
|
|
|
2007-06-17 17:56:37 -07:00
|
|
|
/* Call pre CONFIG_PORT mailbox command initialization. A
|
|
|
|
* value of 0 means the call was successful. Any other
|
|
|
|
* nonzero value is a failure, but if ERESTART is returned,
|
|
|
|
* the driver may reset the HBA and try again.
|
|
|
|
*/
|
2005-04-17 14:05:31 -07:00
|
|
|
rc = lpfc_config_port_prep(phba);
|
|
|
|
if (rc == -ERESTART) {
|
2007-06-17 17:56:37 -07:00
|
|
|
phba->link_state = LPFC_LINK_UNKNOWN;
|
2005-04-17 14:05:31 -07:00
|
|
|
continue;
|
|
|
|
} else if (rc) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2007-06-17 17:56:36 -07:00
|
|
|
phba->link_state = LPFC_INIT_MBX_CMDS;
|
2005-04-17 14:05:31 -07:00
|
|
|
lpfc_config_port(phba, pmb);
|
|
|
|
rc = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL);
|
2007-06-17 17:56:37 -07:00
|
|
|
if (rc != MBX_SUCCESS) {
|
2005-04-17 14:05:31 -07:00
|
|
|
lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
|
2007-08-02 08:10:09 -07:00
|
|
|
"0442 Adapter failed to init, mbxCmd x%x "
|
2007-06-17 17:56:38 -07:00
|
|
|
"CONFIG_PORT, mbxStatus x%x Data: x%x\n",
|
2007-08-02 08:10:09 -07:00
|
|
|
pmb->mb.mbxCommand, pmb->mb.mbxStatus, 0);
|
2007-06-17 17:56:36 -07:00
|
|
|
spin_lock_irq(&phba->hbalock);
|
2005-04-17 14:05:31 -07:00
|
|
|
phba->sli.sli_flag &= ~LPFC_SLI2_ACTIVE;
|
2007-06-17 17:56:36 -07:00
|
|
|
spin_unlock_irq(&phba->hbalock);
|
|
|
|
rc = -ENXIO;
|
2007-06-17 17:56:37 -07:00
|
|
|
} else {
|
|
|
|
done = 1;
|
2007-06-17 17:56:38 -07:00
|
|
|
phba->max_vpi = (phba->max_vpi &&
|
|
|
|
pmb->mb.un.varCfgPort.gmv) != 0
|
|
|
|
? pmb->mb.un.varCfgPort.max_vpi
|
|
|
|
: 0;
|
2005-04-17 14:05:31 -07:00
|
|
|
}
|
|
|
|
}
|
2007-06-17 17:56:37 -07:00
|
|
|
|
|
|
|
if (!done) {
|
|
|
|
rc = -EINVAL;
|
|
|
|
goto do_prep_failed;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((pmb->mb.un.varCfgPort.sli_mode == 3) &&
|
2007-06-17 17:56:38 -07:00
|
|
|
(!pmb->mb.un.varCfgPort.cMA)) {
|
2007-06-17 17:56:37 -07:00
|
|
|
rc = -ENXIO;
|
|
|
|
goto do_prep_failed;
|
|
|
|
}
|
|
|
|
return rc;
|
|
|
|
|
2007-06-17 17:56:38 -07:00
|
|
|
do_prep_failed:
|
2007-06-17 17:56:37 -07:00
|
|
|
mempool_free(pmb, phba->mbox_mem_pool);
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
lpfc_sli_hba_setup(struct lpfc_hba *phba)
|
|
|
|
{
|
|
|
|
uint32_t rc;
|
2007-06-17 17:56:38 -07:00
|
|
|
int mode = 3;
|
2007-06-17 17:56:37 -07:00
|
|
|
|
|
|
|
switch (lpfc_sli_mode) {
|
|
|
|
case 2:
|
2007-08-02 08:10:21 -07:00
|
|
|
if (phba->cfg_enable_npiv) {
|
2007-06-17 17:56:38 -07:00
|
|
|
lpfc_printf_log(phba, KERN_ERR, LOG_INIT | LOG_VPORT,
|
2007-08-02 08:10:09 -07:00
|
|
|
"1824 NPIV enabled: Override lpfc_sli_mode "
|
2007-06-17 17:56:38 -07:00
|
|
|
"parameter (%d) to auto (0).\n",
|
2007-08-02 08:10:09 -07:00
|
|
|
lpfc_sli_mode);
|
2007-06-17 17:56:38 -07:00
|
|
|
break;
|
|
|
|
}
|
2007-06-17 17:56:37 -07:00
|
|
|
mode = 2;
|
|
|
|
break;
|
|
|
|
case 0:
|
|
|
|
case 3:
|
|
|
|
break;
|
|
|
|
default:
|
2007-06-17 17:56:38 -07:00
|
|
|
lpfc_printf_log(phba, KERN_ERR, LOG_INIT | LOG_VPORT,
|
2007-08-02 08:10:09 -07:00
|
|
|
"1819 Unrecognized lpfc_sli_mode "
|
|
|
|
"parameter: %d.\n", lpfc_sli_mode);
|
2007-06-17 17:56:37 -07:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
rc = lpfc_do_config_port(phba, mode);
|
|
|
|
if (rc && lpfc_sli_mode == 3)
|
2007-06-17 17:56:38 -07:00
|
|
|
lpfc_printf_log(phba, KERN_ERR, LOG_INIT | LOG_VPORT,
|
2007-08-02 08:10:09 -07:00
|
|
|
"1820 Unable to select SLI-3. "
|
|
|
|
"Not supported by adapter.\n");
|
2007-06-17 17:56:37 -07:00
|
|
|
if (rc && mode != 2)
|
|
|
|
rc = lpfc_do_config_port(phba, 2);
|
|
|
|
if (rc)
|
2005-04-17 14:05:31 -07:00
|
|
|
goto lpfc_sli_hba_setup_error;
|
|
|
|
|
2007-06-17 17:56:37 -07:00
|
|
|
if (phba->sli_rev == 3) {
|
|
|
|
phba->iocb_cmd_size = SLI3_IOCB_CMD_SIZE;
|
|
|
|
phba->iocb_rsp_size = SLI3_IOCB_RSP_SIZE;
|
|
|
|
phba->sli3_options |= LPFC_SLI3_ENABLED;
|
|
|
|
phba->sli3_options |= LPFC_SLI3_HBQ_ENABLED;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
phba->iocb_cmd_size = SLI2_IOCB_CMD_SIZE;
|
|
|
|
phba->iocb_rsp_size = SLI2_IOCB_RSP_SIZE;
|
2007-06-17 17:56:38 -07:00
|
|
|
phba->sli3_options = 0;
|
2007-06-17 17:56:37 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
lpfc_printf_log(phba, KERN_INFO, LOG_INIT,
|
2007-08-02 08:10:09 -07:00
|
|
|
"0444 Firmware in SLI %x mode. Max_vpi %d\n",
|
|
|
|
phba->sli_rev, phba->max_vpi);
|
2007-06-17 17:56:37 -07:00
|
|
|
rc = lpfc_sli_ring_map(phba);
|
2005-04-17 14:05:31 -07:00
|
|
|
|
|
|
|
if (rc)
|
|
|
|
goto lpfc_sli_hba_setup_error;
|
|
|
|
|
2007-06-17 17:56:38 -07:00
|
|
|
/* Init HBQs */
|
2007-06-17 17:56:37 -07:00
|
|
|
|
|
|
|
if (phba->sli3_options & LPFC_SLI3_HBQ_ENABLED) {
|
|
|
|
rc = lpfc_sli_hbq_setup(phba);
|
|
|
|
if (rc)
|
|
|
|
goto lpfc_sli_hba_setup_error;
|
|
|
|
}
|
|
|
|
|
2005-04-17 14:05:31 -07:00
|
|
|
phba->sli.sli_flag |= LPFC_PROCESS_LA;
|
|
|
|
|
|
|
|
rc = lpfc_config_port_post(phba);
|
|
|
|
if (rc)
|
|
|
|
goto lpfc_sli_hba_setup_error;
|
|
|
|
|
2007-06-17 17:56:37 -07:00
|
|
|
return rc;
|
|
|
|
|
2007-06-17 17:56:38 -07:00
|
|
|
lpfc_sli_hba_setup_error:
|
2007-06-17 17:56:36 -07:00
|
|
|
phba->link_state = LPFC_HBA_ERROR;
|
2007-06-17 17:56:37 -07:00
|
|
|
lpfc_printf_log(phba, KERN_INFO, LOG_INIT,
|
2007-08-02 08:10:09 -07:00
|
|
|
"0445 Firmware initialization failed\n");
|
2005-04-17 14:05:31 -07:00
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*! lpfc_mbox_timeout
|
|
|
|
*
|
|
|
|
* \pre
|
|
|
|
* \post
|
|
|
|
* \param hba Pointer to per struct lpfc_hba structure
|
|
|
|
* \param l1 Pointer to the driver's mailbox queue.
|
|
|
|
* \return
|
|
|
|
* void
|
|
|
|
*
|
|
|
|
* \b Description:
|
|
|
|
*
|
|
|
|
* This routine handles mailbox timeout events at timer interrupt context.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
lpfc_mbox_timeout(unsigned long ptr)
|
|
|
|
{
|
2007-06-17 17:56:38 -07:00
|
|
|
struct lpfc_hba *phba = (struct lpfc_hba *) ptr;
|
2005-04-17 14:05:31 -07:00
|
|
|
unsigned long iflag;
|
2007-06-17 17:56:36 -07:00
|
|
|
uint32_t tmo_posted;
|
2005-04-17 14:05:31 -07:00
|
|
|
|
2007-06-17 17:56:36 -07:00
|
|
|
spin_lock_irqsave(&phba->pport->work_port_lock, iflag);
|
2007-06-17 17:56:38 -07:00
|
|
|
tmo_posted = phba->pport->work_port_events & WORKER_MBOX_TMO;
|
2007-06-17 17:56:36 -07:00
|
|
|
if (!tmo_posted)
|
|
|
|
phba->pport->work_port_events |= WORKER_MBOX_TMO;
|
|
|
|
spin_unlock_irqrestore(&phba->pport->work_port_lock, iflag);
|
|
|
|
|
|
|
|
if (!tmo_posted) {
|
2007-06-17 17:56:38 -07:00
|
|
|
spin_lock_irqsave(&phba->hbalock, iflag);
|
2005-04-17 14:05:31 -07:00
|
|
|
if (phba->work_wait)
|
2007-06-17 17:56:38 -07:00
|
|
|
lpfc_worker_wake_up(phba);
|
|
|
|
spin_unlock_irqrestore(&phba->hbalock, iflag);
|
2005-04-17 14:05:31 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
lpfc_mbox_timeout_handler(struct lpfc_hba *phba)
|
|
|
|
{
|
2007-06-17 17:56:36 -07:00
|
|
|
LPFC_MBOXQ_t *pmbox = phba->sli.mbox_active;
|
|
|
|
MAILBOX_t *mb = &pmbox->mb;
|
2007-04-25 06:51:30 -07:00
|
|
|
struct lpfc_sli *psli = &phba->sli;
|
|
|
|
struct lpfc_sli_ring *pring;
|
2005-04-17 14:05:31 -07:00
|
|
|
|
2007-06-17 17:56:36 -07:00
|
|
|
if (!(phba->pport->work_port_events & WORKER_MBOX_TMO)) {
|
2005-04-17 14:05:31 -07:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Mbox cmd <mbxCommand> timeout */
|
2007-06-17 17:56:37 -07:00
|
|
|
lpfc_printf_log(phba, KERN_ERR, LOG_MBOX | LOG_SLI,
|
2007-08-02 08:10:09 -07:00
|
|
|
"0310 Mailbox command x%x timeout Data: x%x x%x x%p\n",
|
2007-06-17 17:56:38 -07:00
|
|
|
mb->mbxCommand,
|
|
|
|
phba->pport->port_state,
|
|
|
|
phba->sli.sli_flag,
|
|
|
|
phba->sli.mbox_active);
|
2005-04-17 14:05:31 -07:00
|
|
|
|
2007-04-25 06:51:30 -07:00
|
|
|
/* Setting state unknown so lpfc_sli_abort_iocb_ring
|
|
|
|
* would get IOCB_ERROR from lpfc_sli_issue_iocb, allowing
|
|
|
|
* it to fail all oustanding SCSI IO.
|
|
|
|
*/
|
2007-06-17 17:56:36 -07:00
|
|
|
spin_lock_irq(&phba->pport->work_port_lock);
|
|
|
|
phba->pport->work_port_events &= ~WORKER_MBOX_TMO;
|
|
|
|
spin_unlock_irq(&phba->pport->work_port_lock);
|
|
|
|
spin_lock_irq(&phba->hbalock);
|
|
|
|
phba->link_state = LPFC_LINK_UNKNOWN;
|
|
|
|
phba->pport->fc_flag |= FC_ESTABLISH_LINK;
|
2007-04-25 06:51:30 -07:00
|
|
|
psli->sli_flag &= ~LPFC_SLI2_ACTIVE;
|
2007-06-17 17:56:36 -07:00
|
|
|
spin_unlock_irq(&phba->hbalock);
|
2007-04-25 06:51:30 -07:00
|
|
|
|
|
|
|
pring = &psli->ring[psli->fcp_ring];
|
|
|
|
lpfc_sli_abort_iocb_ring(phba, pring);
|
|
|
|
|
|
|
|
lpfc_printf_log(phba, KERN_ERR, LOG_MBOX | LOG_SLI,
|
2007-10-27 10:38:00 -07:00
|
|
|
"0345 Resetting board due to mailbox timeout\n");
|
2007-04-25 06:51:30 -07:00
|
|
|
/*
|
|
|
|
* lpfc_offline calls lpfc_sli_hba_down which will clean up
|
|
|
|
* on oustanding mailbox commands.
|
|
|
|
*/
|
|
|
|
lpfc_offline_prep(phba);
|
|
|
|
lpfc_offline(phba);
|
|
|
|
lpfc_sli_brdrestart(phba);
|
|
|
|
if (lpfc_online(phba) == 0) /* Initialize the HBA */
|
|
|
|
mod_timer(&phba->fc_estabtmo, jiffies + HZ * 60);
|
|
|
|
lpfc_unblock_mgmt_io(phba);
|
2005-04-17 14:05:31 -07:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2007-06-17 17:56:36 -07:00
|
|
|
lpfc_sli_issue_mbox(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmbox, uint32_t flag)
|
2005-04-17 14:05:31 -07:00
|
|
|
{
|
|
|
|
MAILBOX_t *mb;
|
2007-06-17 17:56:36 -07:00
|
|
|
struct lpfc_sli *psli = &phba->sli;
|
2005-04-17 14:05:31 -07:00
|
|
|
uint32_t status, evtctr;
|
|
|
|
uint32_t ha_copy;
|
|
|
|
int i;
|
|
|
|
unsigned long drvr_flag = 0;
|
|
|
|
volatile uint32_t word0, ldata;
|
|
|
|
void __iomem *to_slim;
|
|
|
|
|
2007-06-17 17:56:37 -07:00
|
|
|
if (pmbox->mbox_cmpl && pmbox->mbox_cmpl != lpfc_sli_def_mbox_cmpl &&
|
2007-06-17 17:56:38 -07:00
|
|
|
pmbox->mbox_cmpl != lpfc_sli_wake_mbox_wait) {
|
2007-06-17 17:56:37 -07:00
|
|
|
if(!pmbox->vport) {
|
|
|
|
lpfc_printf_log(phba, KERN_ERR,
|
2007-06-17 17:56:38 -07:00
|
|
|
LOG_MBOX | LOG_VPORT,
|
2007-08-02 08:10:09 -07:00
|
|
|
"1806 Mbox x%x failed. No vport\n",
|
2007-06-17 17:56:37 -07:00
|
|
|
pmbox->mb.mbxCommand);
|
|
|
|
dump_stack();
|
|
|
|
return MBXERR_ERROR;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-06-17 17:56:38 -07:00
|
|
|
|
2007-02-14 13:28:36 -07:00
|
|
|
/* If the PCI channel is in offline state, do not post mbox. */
|
|
|
|
if (unlikely(pci_channel_offline(phba->pcidev)))
|
|
|
|
return MBX_NOT_FINISHED;
|
|
|
|
|
2007-06-17 17:56:36 -07:00
|
|
|
spin_lock_irqsave(&phba->hbalock, drvr_flag);
|
2005-04-17 14:05:31 -07:00
|
|
|
psli = &phba->sli;
|
2007-06-17 17:56:38 -07:00
|
|
|
|
|
|
|
|
2005-04-17 14:05:31 -07:00
|
|
|
mb = &pmbox->mb;
|
|
|
|
status = MBX_SUCCESS;
|
|
|
|
|
2007-06-17 17:56:36 -07:00
|
|
|
if (phba->link_state == LPFC_HBA_ERROR) {
|
|
|
|
spin_unlock_irqrestore(&phba->hbalock, drvr_flag);
|
2006-02-28 17:25:27 -07:00
|
|
|
|
|
|
|
/* Mbox command <mbxCommand> cannot issue */
|
2007-06-17 17:56:38 -07:00
|
|
|
LOG_MBOX_CANNOT_ISSUE_DATA(phba, pmbox, psli, flag)
|
2007-06-17 17:56:36 -07:00
|
|
|
return MBX_NOT_FINISHED;
|
2006-02-28 17:25:27 -07:00
|
|
|
}
|
|
|
|
|
2006-03-07 13:04:13 -07:00
|
|
|
if (mb->mbxCommand != MBX_KILL_BOARD && flag & MBX_NOWAIT &&
|
|
|
|
!(readl(phba->HCregaddr) & HC_MBINT_ENA)) {
|
2007-06-17 17:56:36 -07:00
|
|
|
spin_unlock_irqrestore(&phba->hbalock, drvr_flag);
|
2007-06-17 17:56:38 -07:00
|
|
|
LOG_MBOX_CANNOT_ISSUE_DATA(phba, pmbox, psli, flag)
|
2007-06-17 17:56:36 -07:00
|
|
|
return MBX_NOT_FINISHED;
|
2006-03-07 13:04:13 -07:00
|
|
|
}
|
|
|
|
|
2005-04-17 14:05:31 -07:00
|
|
|
if (psli->sli_flag & LPFC_SLI_MBOX_ACTIVE) {
|
|
|
|
/* Polling for a mbox command when another one is already active
|
|
|
|
* is not allowed in SLI. Also, the driver must have established
|
|
|
|
* SLI2 mode to queue and process multiple mbox commands.
|
|
|
|
*/
|
|
|
|
|
|
|
|
if (flag & MBX_POLL) {
|
2007-06-17 17:56:36 -07:00
|
|
|
spin_unlock_irqrestore(&phba->hbalock, drvr_flag);
|
2005-04-17 14:05:31 -07:00
|
|
|
|
|
|
|
/* Mbox command <mbxCommand> cannot issue */
|
2007-06-17 17:56:38 -07:00
|
|
|
LOG_MBOX_CANNOT_ISSUE_DATA(phba, pmbox, psli, flag);
|
2007-06-17 17:56:36 -07:00
|
|
|
return MBX_NOT_FINISHED;
|
2005-04-17 14:05:31 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
if (!(psli->sli_flag & LPFC_SLI2_ACTIVE)) {
|
2007-06-17 17:56:36 -07:00
|
|
|
spin_unlock_irqrestore(&phba->hbalock, drvr_flag);
|
2005-04-17 14:05:31 -07:00
|
|
|
/* Mbox command <mbxCommand> cannot issue */
|
2007-06-17 17:56:38 -07:00
|
|
|
LOG_MBOX_CANNOT_ISSUE_DATA(phba, pmbox, psli, flag);
|
2007-06-17 17:56:36 -07:00
|
|
|
return MBX_NOT_FINISHED;
|
2005-04-17 14:05:31 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Another mailbox command is still being processed, queue this
|
|
|
|
* command to be processed later.
|
|
|
|
*/
|
|
|
|
lpfc_mbox_put(phba, pmbox);
|
|
|
|
|
|
|
|
/* Mbox cmd issue - BUSY */
|
2007-06-17 17:56:37 -07:00
|
|
|
lpfc_printf_log(phba, KERN_INFO, LOG_MBOX | LOG_SLI,
|
2007-08-02 08:10:09 -07:00
|
|
|
"(%d):0308 Mbox cmd issue - BUSY Data: "
|
2007-06-17 17:56:38 -07:00
|
|
|
"x%x x%x x%x x%x\n",
|
|
|
|
pmbox->vport ? pmbox->vport->vpi : 0xffffff,
|
|
|
|
mb->mbxCommand, phba->pport->port_state,
|
|
|
|
psli->sli_flag, flag);
|
2005-04-17 14:05:31 -07:00
|
|
|
|
|
|
|
psli->slistat.mbox_busy++;
|
2007-06-17 17:56:36 -07:00
|
|
|
spin_unlock_irqrestore(&phba->hbalock, drvr_flag);
|
2005-04-17 14:05:31 -07:00
|
|
|
|
2007-06-17 17:56:39 -07:00
|
|
|
if (pmbox->vport) {
|
|
|
|
lpfc_debugfs_disc_trc(pmbox->vport,
|
|
|
|
LPFC_DISC_TRC_MBOX_VPORT,
|
|
|
|
"MBOX Bsy vport: cmd:x%x mb:x%x x%x",
|
|
|
|
(uint32_t)mb->mbxCommand,
|
|
|
|
mb->un.varWords[0], mb->un.varWords[1]);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
lpfc_debugfs_disc_trc(phba->pport,
|
|
|
|
LPFC_DISC_TRC_MBOX,
|
|
|
|
"MBOX Bsy: cmd:x%x mb:x%x x%x",
|
|
|
|
(uint32_t)mb->mbxCommand,
|
|
|
|
mb->un.varWords[0], mb->un.varWords[1]);
|
|
|
|
}
|
|
|
|
|
2007-06-17 17:56:36 -07:00
|
|
|
return MBX_BUSY;
|
2005-04-17 14:05:31 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
psli->sli_flag |= LPFC_SLI_MBOX_ACTIVE;
|
|
|
|
|
|
|
|
/* If we are not polling, we MUST be in SLI2 mode */
|
|
|
|
if (flag != MBX_POLL) {
|
2006-02-28 17:25:27 -07:00
|
|
|
if (!(psli->sli_flag & LPFC_SLI2_ACTIVE) &&
|
|
|
|
(mb->mbxCommand != MBX_KILL_BOARD)) {
|
2005-04-17 14:05:31 -07:00
|
|
|
psli->sli_flag &= ~LPFC_SLI_MBOX_ACTIVE;
|
2007-06-17 17:56:36 -07:00
|
|
|
spin_unlock_irqrestore(&phba->hbalock, drvr_flag);
|
2005-04-17 14:05:31 -07:00
|
|
|
/* Mbox command <mbxCommand> cannot issue */
|
2007-06-17 17:56:38 -07:00
|
|
|
LOG_MBOX_CANNOT_ISSUE_DATA(phba, pmbox, psli, flag);
|
2007-06-17 17:56:36 -07:00
|
|
|
return MBX_NOT_FINISHED;
|
2005-04-17 14:05:31 -07:00
|
|
|
}
|
|
|
|
/* timeout active mbox command */
|
2006-08-01 04:33:43 -07:00
|
|
|
mod_timer(&psli->mbox_tmo, (jiffies +
|
|
|
|
(HZ * lpfc_mbox_tmo_val(phba, mb->mbxCommand))));
|
2005-04-17 14:05:31 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Mailbox cmd <cmd> issue */
|
2007-06-17 17:56:37 -07:00
|
|
|
lpfc_printf_log(phba, KERN_INFO, LOG_MBOX | LOG_SLI,
|
2007-08-02 08:10:09 -07:00
|
|
|
"(%d):0309 Mailbox cmd x%x issue Data: x%x x%x "
|
2007-06-17 17:56:38 -07:00
|
|
|
"x%x\n",
|
2007-08-02 08:10:09 -07:00
|
|
|
pmbox->vport ? pmbox->vport->vpi : 0,
|
2007-06-17 17:56:38 -07:00
|
|
|
mb->mbxCommand, phba->pport->port_state,
|
|
|
|
psli->sli_flag, flag);
|
2005-04-17 14:05:31 -07:00
|
|
|
|
2007-06-17 17:56:39 -07:00
|
|
|
if (mb->mbxCommand != MBX_HEARTBEAT) {
|
|
|
|
if (pmbox->vport) {
|
|
|
|
lpfc_debugfs_disc_trc(pmbox->vport,
|
|
|
|
LPFC_DISC_TRC_MBOX_VPORT,
|
|
|
|
"MBOX Send vport: cmd:x%x mb:x%x x%x",
|
|
|
|
(uint32_t)mb->mbxCommand,
|
|
|
|
mb->un.varWords[0], mb->un.varWords[1]);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
lpfc_debugfs_disc_trc(phba->pport,
|
|
|
|
LPFC_DISC_TRC_MBOX,
|
|
|
|
"MBOX Send: cmd:x%x mb:x%x x%x",
|
|
|
|
(uint32_t)mb->mbxCommand,
|
|
|
|
mb->un.varWords[0], mb->un.varWords[1]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-04-17 14:05:31 -07:00
|
|
|
psli->slistat.mbox_cmd++;
|
|
|
|
evtctr = psli->slistat.mbox_event;
|
|
|
|
|
|
|
|
/* next set own bit for the adapter and copy over command word */
|
|
|
|
mb->mbxOwner = OWN_CHIP;
|
|
|
|
|
|
|
|
if (psli->sli_flag & LPFC_SLI2_ACTIVE) {
|
|
|
|
/* First copy command data to host SLIM area */
|
2005-06-25 07:34:00 -07:00
|
|
|
lpfc_sli_pcimem_bcopy(mb, &phba->slim2p->mbx, MAILBOX_CMD_SIZE);
|
2005-04-17 14:05:31 -07:00
|
|
|
} else {
|
2006-03-07 13:04:13 -07:00
|
|
|
if (mb->mbxCommand == MBX_CONFIG_PORT) {
|
2005-04-17 14:05:31 -07:00
|
|
|
/* copy command data into host mbox for cmpl */
|
2005-06-25 07:34:00 -07:00
|
|
|
lpfc_sli_pcimem_bcopy(mb, &phba->slim2p->mbx,
|
2007-06-17 17:56:38 -07:00
|
|
|
MAILBOX_CMD_SIZE);
|
2005-04-17 14:05:31 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/* First copy mbox command data to HBA SLIM, skip past first
|
|
|
|
word */
|
|
|
|
to_slim = phba->MBslimaddr + sizeof (uint32_t);
|
|
|
|
lpfc_memcpy_to_slim(to_slim, &mb->un.varWords[0],
|
|
|
|
MAILBOX_CMD_SIZE - sizeof (uint32_t));
|
|
|
|
|
|
|
|
/* Next copy over first word, with mbxOwner set */
|
|
|
|
ldata = *((volatile uint32_t *)mb);
|
|
|
|
to_slim = phba->MBslimaddr;
|
|
|
|
writel(ldata, to_slim);
|
|
|
|
readl(to_slim); /* flush */
|
|
|
|
|
|
|
|
if (mb->mbxCommand == MBX_CONFIG_PORT) {
|
|
|
|
/* switch over to host mailbox */
|
|
|
|
psli->sli_flag |= LPFC_SLI2_ACTIVE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
wmb();
|
|
|
|
/* interrupt board to doit right away */
|
|
|
|
writel(CA_MBATT, phba->CAregaddr);
|
|
|
|
readl(phba->CAregaddr); /* flush */
|
|
|
|
|
|
|
|
switch (flag) {
|
|
|
|
case MBX_NOWAIT:
|
|
|
|
/* Don't wait for it to finish, just return */
|
|
|
|
psli->mbox_active = pmbox;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case MBX_POLL:
|
|
|
|
psli->mbox_active = NULL;
|
|
|
|
if (psli->sli_flag & LPFC_SLI2_ACTIVE) {
|
|
|
|
/* First read mbox status word */
|
2005-06-25 07:34:00 -07:00
|
|
|
word0 = *((volatile uint32_t *)&phba->slim2p->mbx);
|
2005-04-17 14:05:31 -07:00
|
|
|
word0 = le32_to_cpu(word0);
|
|
|
|
} else {
|
|
|
|
/* First read mbox status word */
|
|
|
|
word0 = readl(phba->MBslimaddr);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Read the HBA Host Attention Register */
|
|
|
|
ha_copy = readl(phba->HAregaddr);
|
|
|
|
|
2006-08-01 04:33:43 -07:00
|
|
|
i = lpfc_mbox_tmo_val(phba, mb->mbxCommand);
|
|
|
|
i *= 1000; /* Convert to ms */
|
|
|
|
|
2005-04-17 14:05:31 -07:00
|
|
|
/* Wait for command to complete */
|
2006-02-28 17:25:27 -07:00
|
|
|
while (((word0 & OWN_CHIP) == OWN_CHIP) ||
|
|
|
|
(!(ha_copy & HA_MBATT) &&
|
2007-06-17 17:56:36 -07:00
|
|
|
(phba->link_state > LPFC_WARM_START))) {
|
2006-08-01 04:33:43 -07:00
|
|
|
if (i-- <= 0) {
|
2005-04-17 14:05:31 -07:00
|
|
|
psli->sli_flag &= ~LPFC_SLI_MBOX_ACTIVE;
|
2007-06-17 17:56:36 -07:00
|
|
|
spin_unlock_irqrestore(&phba->hbalock,
|
2005-04-17 14:05:31 -07:00
|
|
|
drvr_flag);
|
2007-06-17 17:56:36 -07:00
|
|
|
return MBX_NOT_FINISHED;
|
2005-04-17 14:05:31 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Check if we took a mbox interrupt while we were
|
|
|
|
polling */
|
|
|
|
if (((word0 & OWN_CHIP) != OWN_CHIP)
|
|
|
|
&& (evtctr != psli->slistat.mbox_event))
|
|
|
|
break;
|
|
|
|
|
2007-06-17 17:56:36 -07:00
|
|
|
spin_unlock_irqrestore(&phba->hbalock,
|
2005-04-17 14:05:31 -07:00
|
|
|
drvr_flag);
|
|
|
|
|
2007-04-25 06:51:30 -07:00
|
|
|
msleep(1);
|
2005-04-17 14:05:31 -07:00
|
|
|
|
2007-06-17 17:56:36 -07:00
|
|
|
spin_lock_irqsave(&phba->hbalock, drvr_flag);
|
2005-04-17 14:05:31 -07:00
|
|
|
|
|
|
|
if (psli->sli_flag & LPFC_SLI2_ACTIVE) {
|
|
|
|
/* First copy command data */
|
2005-06-25 07:34:00 -07:00
|
|
|
word0 = *((volatile uint32_t *)
|
|
|
|
&phba->slim2p->mbx);
|
2005-04-17 14:05:31 -07:00
|
|
|
word0 = le32_to_cpu(word0);
|
|
|
|
if (mb->mbxCommand == MBX_CONFIG_PORT) {
|
|
|
|
MAILBOX_t *slimmb;
|
|
|
|
volatile uint32_t slimword0;
|
|
|
|
/* Check real SLIM for any errors */
|
|
|
|
slimword0 = readl(phba->MBslimaddr);
|
|
|
|
slimmb = (MAILBOX_t *) & slimword0;
|
|
|
|
if (((slimword0 & OWN_CHIP) != OWN_CHIP)
|
|
|
|
&& slimmb->mbxStatus) {
|
|
|
|
psli->sli_flag &=
|
|
|
|
~LPFC_SLI2_ACTIVE;
|
|
|
|
word0 = slimword0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
/* First copy command data */
|
|
|
|
word0 = readl(phba->MBslimaddr);
|
|
|
|
}
|
|
|
|
/* Read the HBA Host Attention Register */
|
|
|
|
ha_copy = readl(phba->HAregaddr);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (psli->sli_flag & LPFC_SLI2_ACTIVE) {
|
|
|
|
/* copy results back to user */
|
2005-06-25 07:34:00 -07:00
|
|
|
lpfc_sli_pcimem_bcopy(&phba->slim2p->mbx, mb,
|
2007-06-17 17:56:38 -07:00
|
|
|
MAILBOX_CMD_SIZE);
|
2005-04-17 14:05:31 -07:00
|
|
|
} else {
|
|
|
|
/* First copy command data */
|
|
|
|
lpfc_memcpy_from_slim(mb, phba->MBslimaddr,
|
|
|
|
MAILBOX_CMD_SIZE);
|
|
|
|
if ((mb->mbxCommand == MBX_DUMP_MEMORY) &&
|
|
|
|
pmbox->context2) {
|
2007-06-17 17:56:38 -07:00
|
|
|
lpfc_memcpy_from_slim((void *)pmbox->context2,
|
2005-04-17 14:05:31 -07:00
|
|
|
phba->MBslimaddr + DMP_RSP_OFFSET,
|
|
|
|
mb->un.varDmp.word_cnt);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
writel(HA_MBATT, phba->HAregaddr);
|
|
|
|
readl(phba->HAregaddr); /* flush */
|
|
|
|
|
|
|
|
psli->sli_flag &= ~LPFC_SLI_MBOX_ACTIVE;
|
|
|
|
status = mb->mbxStatus;
|
|
|
|
}
|
|
|
|
|
2007-06-17 17:56:36 -07:00
|
|
|
spin_unlock_irqrestore(&phba->hbalock, drvr_flag);
|
|
|
|
return status;
|
2005-04-17 14:05:31 -07:00
|
|
|
}
|
|
|
|
|
2007-06-17 17:56:38 -07:00
|
|
|
/*
|
|
|
|
* Caller needs to hold lock.
|
|
|
|
*/
|
2007-06-17 17:56:39 -07:00
|
|
|
static void
|
2007-06-17 17:56:38 -07:00
|
|
|
__lpfc_sli_ringtx_put(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
|
2007-06-17 17:56:36 -07:00
|
|
|
struct lpfc_iocbq *piocb)
|
2005-04-17 14:05:31 -07:00
|
|
|
{
|
|
|
|
/* Insert the caller's iocb in the txq tail for later processing. */
|
|
|
|
list_add_tail(&piocb->list, &pring->txq);
|
|
|
|
pring->txq_cnt++;
|
|
|
|
}
|
|
|
|
|
|
|
|
static struct lpfc_iocbq *
|
|
|
|
lpfc_sli_next_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
|
2007-06-17 17:56:36 -07:00
|
|
|
struct lpfc_iocbq **piocb)
|
2005-04-17 14:05:31 -07:00
|
|
|
{
|
|
|
|
struct lpfc_iocbq * nextiocb;
|
|
|
|
|
|
|
|
nextiocb = lpfc_sli_ringtx_get(phba, pring);
|
|
|
|
if (!nextiocb) {
|
|
|
|
nextiocb = *piocb;
|
|
|
|
*piocb = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return nextiocb;
|
|
|
|
}
|
|
|
|
|
2007-06-17 17:56:38 -07:00
|
|
|
/*
|
|
|
|
* Lockless version of lpfc_sli_issue_iocb.
|
|
|
|
*/
|
2007-10-27 10:37:33 -07:00
|
|
|
static int
|
2007-06-17 17:56:38 -07:00
|
|
|
__lpfc_sli_issue_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
|
2005-04-17 14:05:31 -07:00
|
|
|
struct lpfc_iocbq *piocb, uint32_t flag)
|
|
|
|
{
|
|
|
|
struct lpfc_iocbq *nextiocb;
|
|
|
|
IOCB_t *iocb;
|
|
|
|
|
2007-06-17 17:56:38 -07:00
|
|
|
if (piocb->iocb_cmpl && (!piocb->vport) &&
|
|
|
|
(piocb->iocb.ulpCommand != CMD_ABORT_XRI_CN) &&
|
|
|
|
(piocb->iocb.ulpCommand != CMD_CLOSE_XRI_CN)) {
|
|
|
|
lpfc_printf_log(phba, KERN_ERR,
|
|
|
|
LOG_SLI | LOG_VPORT,
|
2007-08-02 08:10:09 -07:00
|
|
|
"1807 IOCB x%x failed. No vport\n",
|
2007-06-17 17:56:38 -07:00
|
|
|
piocb->iocb.ulpCommand);
|
|
|
|
dump_stack();
|
|
|
|
return IOCB_ERROR;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-02-14 13:28:36 -07:00
|
|
|
/* If the PCI channel is in offline state, do not post iocbs. */
|
|
|
|
if (unlikely(pci_channel_offline(phba->pcidev)))
|
|
|
|
return IOCB_ERROR;
|
|
|
|
|
2005-04-17 14:05:31 -07:00
|
|
|
/*
|
|
|
|
* We should never get an IOCB if we are in a < LINK_DOWN state
|
|
|
|
*/
|
2007-06-17 17:56:36 -07:00
|
|
|
if (unlikely(phba->link_state < LPFC_LINK_DOWN))
|
2005-04-17 14:05:31 -07:00
|
|
|
return IOCB_ERROR;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Check to see if we are blocking IOCB processing because of a
|
2007-10-27 10:37:25 -07:00
|
|
|
* outstanding event.
|
2005-04-17 14:05:31 -07:00
|
|
|
*/
|
2007-10-27 10:37:25 -07:00
|
|
|
if (unlikely(pring->flag & LPFC_STOP_IOCB_EVENT))
|
2005-04-17 14:05:31 -07:00
|
|
|
goto iocb_busy;
|
|
|
|
|
2007-06-17 17:56:36 -07:00
|
|
|
if (unlikely(phba->link_state == LPFC_LINK_DOWN)) {
|
2005-04-17 14:05:31 -07:00
|
|
|
/*
|
2007-04-25 06:52:55 -07:00
|
|
|
* Only CREATE_XRI, CLOSE_XRI, and QUE_RING_BUF
|
2005-04-17 14:05:31 -07:00
|
|
|
* can be issued if the link is not up.
|
|
|
|
*/
|
|
|
|
switch (piocb->iocb.ulpCommand) {
|
|
|
|
case CMD_QUE_RING_BUF_CN:
|
|
|
|
case CMD_QUE_RING_BUF64_CN:
|
|
|
|
/*
|
|
|
|
* For IOCBs, like QUE_RING_BUF, that have no rsp ring
|
|
|
|
* completion, iocb_cmpl MUST be 0.
|
|
|
|
*/
|
|
|
|
if (piocb->iocb_cmpl)
|
|
|
|
piocb->iocb_cmpl = NULL;
|
|
|
|
/*FALLTHROUGH*/
|
|
|
|
case CMD_CREATE_XRI_CR:
|
2007-04-25 06:52:55 -07:00
|
|
|
case CMD_CLOSE_XRI_CN:
|
|
|
|
case CMD_CLOSE_XRI_CX:
|
2005-04-17 14:05:31 -07:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
goto iocb_busy;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* For FCP commands, we must be in a state where we can process link
|
|
|
|
* attention events.
|
|
|
|
*/
|
|
|
|
} else if (unlikely(pring->ringno == phba->sli.fcp_ring &&
|
2007-06-17 17:56:38 -07:00
|
|
|
!(phba->sli.sli_flag & LPFC_PROCESS_LA))) {
|
2005-04-17 14:05:31 -07:00
|
|
|
goto iocb_busy;
|
2007-06-17 17:56:38 -07:00
|
|
|
}
|
2005-04-17 14:05:31 -07:00
|
|
|
|
|
|
|
while ((iocb = lpfc_sli_next_iocb_slot(phba, pring)) &&
|
|
|
|
(nextiocb = lpfc_sli_next_iocb(phba, pring, &piocb)))
|
|
|
|
lpfc_sli_submit_iocb(phba, pring, iocb, nextiocb);
|
|
|
|
|
|
|
|
if (iocb)
|
|
|
|
lpfc_sli_update_ring(phba, pring);
|
|
|
|
else
|
|
|
|
lpfc_sli_update_full_ring(phba, pring);
|
|
|
|
|
|
|
|
if (!piocb)
|
|
|
|
return IOCB_SUCCESS;
|
|
|
|
|
|
|
|
goto out_busy;
|
|
|
|
|
|
|
|
iocb_busy:
|
|
|
|
pring->stats.iocb_cmd_delay++;
|
|
|
|
|
|
|
|
out_busy:
|
|
|
|
|
|
|
|
if (!(flag & SLI_IOCB_RET_IOCB)) {
|
2007-06-17 17:56:38 -07:00
|
|
|
__lpfc_sli_ringtx_put(phba, pring, piocb);
|
2005-04-17 14:05:31 -07:00
|
|
|
return IOCB_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
return IOCB_BUSY;
|
|
|
|
}
|
|
|
|
|
2007-06-17 17:56:38 -07:00
|
|
|
|
|
|
|
int
|
|
|
|
lpfc_sli_issue_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
|
|
|
|
struct lpfc_iocbq *piocb, uint32_t flag)
|
|
|
|
{
|
|
|
|
unsigned long iflags;
|
|
|
|
int rc;
|
|
|
|
|
|
|
|
spin_lock_irqsave(&phba->hbalock, iflags);
|
|
|
|
rc = __lpfc_sli_issue_iocb(phba, pring, piocb, flag);
|
|
|
|
spin_unlock_irqrestore(&phba->hbalock, iflags);
|
|
|
|
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
2006-02-28 20:33:08 -07:00
|
|
|
static int
|
|
|
|
lpfc_extra_ring_setup( struct lpfc_hba *phba)
|
|
|
|
{
|
|
|
|
struct lpfc_sli *psli;
|
|
|
|
struct lpfc_sli_ring *pring;
|
|
|
|
|
|
|
|
psli = &phba->sli;
|
|
|
|
|
|
|
|
/* Adjust cmd/rsp ring iocb entries more evenly */
|
2006-12-02 11:34:16 -07:00
|
|
|
|
|
|
|
/* Take some away from the FCP ring */
|
2006-02-28 20:33:08 -07:00
|
|
|
pring = &psli->ring[psli->fcp_ring];
|
|
|
|
pring->numCiocb -= SLI2_IOCB_CMD_R1XTRA_ENTRIES;
|
|
|
|
pring->numRiocb -= SLI2_IOCB_RSP_R1XTRA_ENTRIES;
|
|
|
|
pring->numCiocb -= SLI2_IOCB_CMD_R3XTRA_ENTRIES;
|
|
|
|
pring->numRiocb -= SLI2_IOCB_RSP_R3XTRA_ENTRIES;
|
|
|
|
|
2006-12-02 11:34:16 -07:00
|
|
|
/* and give them to the extra ring */
|
|
|
|
pring = &psli->ring[psli->extra_ring];
|
|
|
|
|
2006-02-28 20:33:08 -07:00
|
|
|
pring->numCiocb += SLI2_IOCB_CMD_R1XTRA_ENTRIES;
|
|
|
|
pring->numRiocb += SLI2_IOCB_RSP_R1XTRA_ENTRIES;
|
|
|
|
pring->numCiocb += SLI2_IOCB_CMD_R3XTRA_ENTRIES;
|
|
|
|
pring->numRiocb += SLI2_IOCB_RSP_R3XTRA_ENTRIES;
|
|
|
|
|
|
|
|
/* Setup default profile for this ring */
|
|
|
|
pring->iotag_max = 4096;
|
|
|
|
pring->num_mask = 1;
|
|
|
|
pring->prt[0].profile = 0; /* Mask 0 */
|
2006-12-02 11:34:16 -07:00
|
|
|
pring->prt[0].rctl = phba->cfg_multi_ring_rctl;
|
|
|
|
pring->prt[0].type = phba->cfg_multi_ring_type;
|
2006-02-28 20:33:08 -07:00
|
|
|
pring->prt[0].lpfc_sli_rcv_unsol_event = NULL;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2007-10-27 10:37:33 -07:00
|
|
|
static void
|
2007-10-27 10:37:05 -07:00
|
|
|
lpfc_sli_async_event_handler(struct lpfc_hba * phba,
|
|
|
|
struct lpfc_sli_ring * pring, struct lpfc_iocbq * iocbq)
|
|
|
|
{
|
|
|
|
IOCB_t *icmd;
|
|
|
|
uint16_t evt_code;
|
|
|
|
uint16_t temp;
|
|
|
|
struct temp_event temp_event_data;
|
|
|
|
struct Scsi_Host *shost;
|
|
|
|
|
|
|
|
icmd = &iocbq->iocb;
|
|
|
|
evt_code = icmd->un.asyncstat.evt_code;
|
|
|
|
temp = icmd->ulpContext;
|
|
|
|
|
|
|
|
if ((evt_code != ASYNC_TEMP_WARN) &&
|
|
|
|
(evt_code != ASYNC_TEMP_SAFE)) {
|
|
|
|
lpfc_printf_log(phba,
|
|
|
|
KERN_ERR,
|
|
|
|
LOG_SLI,
|
2007-10-27 10:38:00 -07:00
|
|
|
"0346 Ring %d handler: unexpected ASYNC_STATUS"
|
2007-10-27 10:37:05 -07:00
|
|
|
" evt_code 0x%x\n",
|
|
|
|
pring->ringno,
|
|
|
|
icmd->un.asyncstat.evt_code);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
temp_event_data.data = (uint32_t)temp;
|
|
|
|
temp_event_data.event_type = FC_REG_TEMPERATURE_EVENT;
|
|
|
|
if (evt_code == ASYNC_TEMP_WARN) {
|
|
|
|
temp_event_data.event_code = LPFC_THRESHOLD_TEMP;
|
|
|
|
lpfc_printf_log(phba,
|
|
|
|
KERN_WARNING,
|
|
|
|
LOG_TEMP,
|
2007-10-27 10:38:00 -07:00
|
|
|
"0347 Adapter is very hot, please take "
|
2007-10-27 10:37:05 -07:00
|
|
|
"corrective action. temperature : %d Celsius\n",
|
|
|
|
temp);
|
|
|
|
}
|
|
|
|
if (evt_code == ASYNC_TEMP_SAFE) {
|
|
|
|
temp_event_data.event_code = LPFC_NORMAL_TEMP;
|
|
|
|
lpfc_printf_log(phba,
|
|
|
|
KERN_INFO,
|
|
|
|
LOG_TEMP,
|
|
|
|
"0340 Adapter temperature is OK now. "
|
|
|
|
"temperature : %d Celsius\n",
|
|
|
|
temp);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Send temperature change event to applications */
|
|
|
|
shost = lpfc_shost_from_vport(phba->pport);
|
|
|
|
fc_host_post_vendor_event(shost, fc_get_event_number(),
|
|
|
|
sizeof(temp_event_data), (char *) &temp_event_data,
|
|
|
|
SCSI_NL_VID_TYPE_PCI | PCI_VENDOR_ID_EMULEX);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-04-17 14:05:31 -07:00
|
|
|
int
|
|
|
|
lpfc_sli_setup(struct lpfc_hba *phba)
|
|
|
|
{
|
2007-06-17 17:56:37 -07:00
|
|
|
int i, totiocbsize = 0;
|
2005-04-17 14:05:31 -07:00
|
|
|
struct lpfc_sli *psli = &phba->sli;
|
|
|
|
struct lpfc_sli_ring *pring;
|
|
|
|
|
|
|
|
psli->num_rings = MAX_CONFIGURED_RINGS;
|
|
|
|
psli->sli_flag = 0;
|
|
|
|
psli->fcp_ring = LPFC_FCP_RING;
|
|
|
|
psli->next_ring = LPFC_FCP_NEXT_RING;
|
2006-12-02 11:34:16 -07:00
|
|
|
psli->extra_ring = LPFC_EXTRA_RING;
|
2005-04-17 14:05:31 -07:00
|
|
|
|
2005-10-29 08:28:33 -07:00
|
|
|
psli->iocbq_lookup = NULL;
|
|
|
|
psli->iocbq_lookup_len = 0;
|
|
|
|
psli->last_iotag = 0;
|
|
|
|
|
2005-04-17 14:05:31 -07:00
|
|
|
for (i = 0; i < psli->num_rings; i++) {
|
|
|
|
pring = &psli->ring[i];
|
|
|
|
switch (i) {
|
|
|
|
case LPFC_FCP_RING: /* ring 0 - FCP */
|
|
|
|
/* numCiocb and numRiocb are used in config_port */
|
|
|
|
pring->numCiocb = SLI2_IOCB_CMD_R0_ENTRIES;
|
|
|
|
pring->numRiocb = SLI2_IOCB_RSP_R0_ENTRIES;
|
|
|
|
pring->numCiocb += SLI2_IOCB_CMD_R1XTRA_ENTRIES;
|
|
|
|
pring->numRiocb += SLI2_IOCB_RSP_R1XTRA_ENTRIES;
|
|
|
|
pring->numCiocb += SLI2_IOCB_CMD_R3XTRA_ENTRIES;
|
|
|
|
pring->numRiocb += SLI2_IOCB_RSP_R3XTRA_ENTRIES;
|
2007-06-17 17:56:37 -07:00
|
|
|
pring->sizeCiocb = (phba->sli_rev == 3) ?
|
2007-06-17 17:56:38 -07:00
|
|
|
SLI3_IOCB_CMD_SIZE :
|
|
|
|
SLI2_IOCB_CMD_SIZE;
|
2007-06-17 17:56:37 -07:00
|
|
|
pring->sizeRiocb = (phba->sli_rev == 3) ?
|
2007-06-17 17:56:38 -07:00
|
|
|
SLI3_IOCB_RSP_SIZE :
|
|
|
|
SLI2_IOCB_RSP_SIZE;
|
2005-04-17 14:05:31 -07:00
|
|
|
pring->iotag_ctr = 0;
|
|
|
|
pring->iotag_max =
|
2007-06-17 17:56:38 -07:00
|
|
|
(phba->cfg_hba_queue_depth * 2);
|
2005-04-17 14:05:31 -07:00
|
|
|
pring->fast_iotag = pring->iotag_max;
|
|
|
|
pring->num_mask = 0;
|
|
|
|
break;
|
2006-12-02 11:34:16 -07:00
|
|
|
case LPFC_EXTRA_RING: /* ring 1 - EXTRA */
|
2005-04-17 14:05:31 -07:00
|
|
|
/* numCiocb and numRiocb are used in config_port */
|
|
|
|
pring->numCiocb = SLI2_IOCB_CMD_R1_ENTRIES;
|
|
|
|
pring->numRiocb = SLI2_IOCB_RSP_R1_ENTRIES;
|
2007-06-17 17:56:37 -07:00
|
|
|
pring->sizeCiocb = (phba->sli_rev == 3) ?
|
2007-06-17 17:56:38 -07:00
|
|
|
SLI3_IOCB_CMD_SIZE :
|
|
|
|
SLI2_IOCB_CMD_SIZE;
|
2007-06-17 17:56:37 -07:00
|
|
|
pring->sizeRiocb = (phba->sli_rev == 3) ?
|
2007-06-17 17:56:38 -07:00
|
|
|
SLI3_IOCB_RSP_SIZE :
|
|
|
|
SLI2_IOCB_RSP_SIZE;
|
2007-06-17 17:56:36 -07:00
|
|
|
pring->iotag_max = phba->cfg_hba_queue_depth;
|
2005-04-17 14:05:31 -07:00
|
|
|
pring->num_mask = 0;
|
|
|
|
break;
|
|
|
|
case LPFC_ELS_RING: /* ring 2 - ELS / CT */
|
|
|
|
/* numCiocb and numRiocb are used in config_port */
|
|
|
|
pring->numCiocb = SLI2_IOCB_CMD_R2_ENTRIES;
|
|
|
|
pring->numRiocb = SLI2_IOCB_RSP_R2_ENTRIES;
|
2007-06-17 17:56:37 -07:00
|
|
|
pring->sizeCiocb = (phba->sli_rev == 3) ?
|
2007-06-17 17:56:38 -07:00
|
|
|
SLI3_IOCB_CMD_SIZE :
|
|
|
|
SLI2_IOCB_CMD_SIZE;
|
2007-06-17 17:56:37 -07:00
|
|
|
pring->sizeRiocb = (phba->sli_rev == 3) ?
|
2007-06-17 17:56:38 -07:00
|
|
|
SLI3_IOCB_RSP_SIZE :
|
|
|
|
SLI2_IOCB_RSP_SIZE;
|
2005-04-17 14:05:31 -07:00
|
|
|
pring->fast_iotag = 0;
|
|
|
|
pring->iotag_ctr = 0;
|
|
|
|
pring->iotag_max = 4096;
|
2007-10-27 10:37:05 -07:00
|
|
|
pring->lpfc_sli_rcv_async_status =
|
|
|
|
lpfc_sli_async_event_handler;
|
2005-04-17 14:05:31 -07:00
|
|
|
pring->num_mask = 4;
|
|
|
|
pring->prt[0].profile = 0; /* Mask 0 */
|
|
|
|
pring->prt[0].rctl = FC_ELS_REQ;
|
|
|
|
pring->prt[0].type = FC_ELS_DATA;
|
|
|
|
pring->prt[0].lpfc_sli_rcv_unsol_event =
|
2007-06-17 17:56:38 -07:00
|
|
|
lpfc_els_unsol_event;
|
2005-04-17 14:05:31 -07:00
|
|
|
pring->prt[1].profile = 0; /* Mask 1 */
|
|
|
|
pring->prt[1].rctl = FC_ELS_RSP;
|
|
|
|
pring->prt[1].type = FC_ELS_DATA;
|
|
|
|
pring->prt[1].lpfc_sli_rcv_unsol_event =
|
2007-06-17 17:56:38 -07:00
|
|
|
lpfc_els_unsol_event;
|
2005-04-17 14:05:31 -07:00
|
|
|
pring->prt[2].profile = 0; /* Mask 2 */
|
|
|
|
/* NameServer Inquiry */
|
|
|
|
pring->prt[2].rctl = FC_UNSOL_CTL;
|
|
|
|
/* NameServer */
|
|
|
|
pring->prt[2].type = FC_COMMON_TRANSPORT_ULP;
|
|
|
|
pring->prt[2].lpfc_sli_rcv_unsol_event =
|
2007-06-17 17:56:38 -07:00
|
|
|
lpfc_ct_unsol_event;
|
2005-04-17 14:05:31 -07:00
|
|
|
pring->prt[3].profile = 0; /* Mask 3 */
|
|
|
|
/* NameServer response */
|
|
|
|
pring->prt[3].rctl = FC_SOL_CTL;
|
|
|
|
/* NameServer */
|
|
|
|
pring->prt[3].type = FC_COMMON_TRANSPORT_ULP;
|
|
|
|
pring->prt[3].lpfc_sli_rcv_unsol_event =
|
2007-06-17 17:56:38 -07:00
|
|
|
lpfc_ct_unsol_event;
|
2005-04-17 14:05:31 -07:00
|
|
|
break;
|
|
|
|
}
|
2007-06-17 17:56:37 -07:00
|
|
|
totiocbsize += (pring->numCiocb * pring->sizeCiocb) +
|
2007-06-17 17:56:38 -07:00
|
|
|
(pring->numRiocb * pring->sizeRiocb);
|
2005-04-17 14:05:31 -07:00
|
|
|
}
|
2007-06-17 17:56:37 -07:00
|
|
|
if (totiocbsize > MAX_SLIM_IOCB_SIZE) {
|
2005-04-17 14:05:31 -07:00
|
|
|
/* Too many cmd / rsp ring entries in SLI2 SLIM */
|
2007-08-02 08:10:09 -07:00
|
|
|
printk(KERN_ERR "%d:0462 Too many cmd / rsp ring entries in "
|
|
|
|
"SLI2 SLIM Data: x%x x%lx\n",
|
|
|
|
phba->brd_no, totiocbsize,
|
|
|
|
(unsigned long) MAX_SLIM_IOCB_SIZE);
|
2005-04-17 14:05:31 -07:00
|
|
|
}
|
2006-02-28 20:33:08 -07:00
|
|
|
if (phba->cfg_multi_ring_support == 2)
|
|
|
|
lpfc_extra_ring_setup(phba);
|
2005-04-17 14:05:31 -07:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2007-06-17 17:56:36 -07:00
|
|
|
lpfc_sli_queue_setup(struct lpfc_hba *phba)
|
2005-04-17 14:05:31 -07:00
|
|
|
{
|
|
|
|
struct lpfc_sli *psli;
|
|
|
|
struct lpfc_sli_ring *pring;
|
2005-10-29 08:28:33 -07:00
|
|
|
int i;
|
2005-04-17 14:05:31 -07:00
|
|
|
|
|
|
|
psli = &phba->sli;
|
2007-06-17 17:56:36 -07:00
|
|
|
spin_lock_irq(&phba->hbalock);
|
2005-04-17 14:05:31 -07:00
|
|
|
INIT_LIST_HEAD(&psli->mboxq);
|
2007-06-17 17:56:38 -07:00
|
|
|
INIT_LIST_HEAD(&psli->mboxq_cmpl);
|
2005-04-17 14:05:31 -07:00
|
|
|
/* Initialize list headers for txq and txcmplq as double linked lists */
|
|
|
|
for (i = 0; i < psli->num_rings; i++) {
|
|
|
|
pring = &psli->ring[i];
|
|
|
|
pring->ringno = i;
|
|
|
|
pring->next_cmdidx = 0;
|
|
|
|
pring->local_getidx = 0;
|
|
|
|
pring->cmdidx = 0;
|
|
|
|
INIT_LIST_HEAD(&pring->txq);
|
|
|
|
INIT_LIST_HEAD(&pring->txcmplq);
|
|
|
|
INIT_LIST_HEAD(&pring->iocb_continueq);
|
|
|
|
INIT_LIST_HEAD(&pring->postbufq);
|
|
|
|
}
|
2007-06-17 17:56:36 -07:00
|
|
|
spin_unlock_irq(&phba->hbalock);
|
|
|
|
return 1;
|
2005-04-17 14:05:31 -07:00
|
|
|
}
|
|
|
|
|
2007-06-17 17:56:38 -07:00
|
|
|
int
|
|
|
|
lpfc_sli_host_down(struct lpfc_vport *vport)
|
|
|
|
{
|
2007-06-17 17:56:39 -07:00
|
|
|
LIST_HEAD(completions);
|
2007-06-17 17:56:38 -07:00
|
|
|
struct lpfc_hba *phba = vport->phba;
|
|
|
|
struct lpfc_sli *psli = &phba->sli;
|
|
|
|
struct lpfc_sli_ring *pring;
|
|
|
|
struct lpfc_iocbq *iocb, *next_iocb;
|
|
|
|
int i;
|
|
|
|
unsigned long flags = 0;
|
|
|
|
uint16_t prev_pring_flag;
|
|
|
|
|
|
|
|
lpfc_cleanup_discovery_resources(vport);
|
|
|
|
|
|
|
|
spin_lock_irqsave(&phba->hbalock, flags);
|
|
|
|
for (i = 0; i < psli->num_rings; i++) {
|
|
|
|
pring = &psli->ring[i];
|
|
|
|
prev_pring_flag = pring->flag;
|
2007-06-17 17:56:39 -07:00
|
|
|
if (pring->ringno == LPFC_ELS_RING) /* Only slow rings */
|
|
|
|
pring->flag |= LPFC_DEFERRED_RING_EVENT;
|
2007-06-17 17:56:38 -07:00
|
|
|
/*
|
|
|
|
* Error everything on the txq since these iocbs have not been
|
|
|
|
* given to the FW yet.
|
|
|
|
*/
|
|
|
|
list_for_each_entry_safe(iocb, next_iocb, &pring->txq, list) {
|
|
|
|
if (iocb->vport != vport)
|
|
|
|
continue;
|
2007-06-17 17:56:39 -07:00
|
|
|
list_move_tail(&iocb->list, &completions);
|
2007-06-17 17:56:38 -07:00
|
|
|
pring->txq_cnt--;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Next issue ABTS for everything on the txcmplq */
|
|
|
|
list_for_each_entry_safe(iocb, next_iocb, &pring->txcmplq,
|
|
|
|
list) {
|
|
|
|
if (iocb->vport != vport)
|
|
|
|
continue;
|
|
|
|
lpfc_sli_issue_abort_iotag(phba, pring, iocb);
|
|
|
|
}
|
|
|
|
|
|
|
|
pring->flag = prev_pring_flag;
|
|
|
|
}
|
|
|
|
|
|
|
|
spin_unlock_irqrestore(&phba->hbalock, flags);
|
|
|
|
|
2007-06-17 17:56:39 -07:00
|
|
|
while (!list_empty(&completions)) {
|
|
|
|
list_remove_head(&completions, iocb, struct lpfc_iocbq, list);
|
|
|
|
|
|
|
|
if (!iocb->iocb_cmpl)
|
|
|
|
lpfc_sli_release_iocbq(phba, iocb);
|
|
|
|
else {
|
|
|
|
iocb->iocb.ulpStatus = IOSTAT_LOCAL_REJECT;
|
|
|
|
iocb->iocb.un.ulpWord[4] = IOERR_SLI_DOWN;
|
|
|
|
(iocb->iocb_cmpl) (phba, iocb, iocb);
|
|
|
|
}
|
|
|
|
}
|
2007-06-17 17:56:38 -07:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2005-04-17 14:05:31 -07:00
|
|
|
int
|
2007-06-17 17:56:36 -07:00
|
|
|
lpfc_sli_hba_down(struct lpfc_hba *phba)
|
2005-04-17 14:05:31 -07:00
|
|
|
{
|
2007-04-25 06:52:20 -07:00
|
|
|
LIST_HEAD(completions);
|
2007-06-17 17:56:36 -07:00
|
|
|
struct lpfc_sli *psli = &phba->sli;
|
2005-04-17 14:05:31 -07:00
|
|
|
struct lpfc_sli_ring *pring;
|
2008-01-10 23:52:36 -07:00
|
|
|
struct lpfc_dmabuf *buf_ptr;
|
2005-04-17 14:05:31 -07:00
|
|
|
LPFC_MBOXQ_t *pmb;
|
2007-04-25 06:52:20 -07:00
|
|
|
struct lpfc_iocbq *iocb;
|
|
|
|
IOCB_t *cmd = NULL;
|
2005-04-17 14:05:31 -07:00
|
|
|
int i;
|
|
|
|
unsigned long flags = 0;
|
|
|
|
|
|
|
|
lpfc_hba_down_prep(phba);
|
|
|
|
|
2007-06-17 17:56:38 -07:00
|
|
|
lpfc_fabric_abort_hba(phba);
|
|
|
|
|
2007-06-17 17:56:36 -07:00
|
|
|
spin_lock_irqsave(&phba->hbalock, flags);
|
2005-04-17 14:05:31 -07:00
|
|
|
for (i = 0; i < psli->num_rings; i++) {
|
|
|
|
pring = &psli->ring[i];
|
2007-06-17 17:56:39 -07:00
|
|
|
if (pring->ringno == LPFC_ELS_RING) /* Only slow rings */
|
|
|
|
pring->flag |= LPFC_DEFERRED_RING_EVENT;
|
2005-04-17 14:05:31 -07:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Error everything on the txq since these iocbs have not been
|
|
|
|
* given to the FW yet.
|
|
|
|
*/
|
2007-04-25 06:52:20 -07:00
|
|
|
list_splice_init(&pring->txq, &completions);
|
2005-04-17 14:05:31 -07:00
|
|
|
pring->txq_cnt = 0;
|
|
|
|
|
2007-04-25 06:52:20 -07:00
|
|
|
}
|
2007-06-17 17:56:36 -07:00
|
|
|
spin_unlock_irqrestore(&phba->hbalock, flags);
|
2005-04-17 14:05:31 -07:00
|
|
|
|
2007-04-25 06:52:20 -07:00
|
|
|
while (!list_empty(&completions)) {
|
2007-06-17 17:56:38 -07:00
|
|
|
list_remove_head(&completions, iocb, struct lpfc_iocbq, list);
|
2007-04-25 06:52:20 -07:00
|
|
|
cmd = &iocb->iocb;
|
2005-04-17 14:05:31 -07:00
|
|
|
|
2007-06-17 17:56:36 -07:00
|
|
|
if (!iocb->iocb_cmpl)
|
|
|
|
lpfc_sli_release_iocbq(phba, iocb);
|
|
|
|
else {
|
2007-04-25 06:52:20 -07:00
|
|
|
cmd->ulpStatus = IOSTAT_LOCAL_REJECT;
|
|
|
|
cmd->un.ulpWord[4] = IOERR_SLI_DOWN;
|
|
|
|
(iocb->iocb_cmpl) (phba, iocb, iocb);
|
2007-06-17 17:56:36 -07:00
|
|
|
}
|
2005-04-17 14:05:31 -07:00
|
|
|
}
|
|
|
|
|
2008-01-10 23:52:36 -07:00
|
|
|
spin_lock_irqsave(&phba->hbalock, flags);
|
|
|
|
list_splice_init(&phba->elsbuf, &completions);
|
|
|
|
phba->elsbuf_cnt = 0;
|
|
|
|
phba->elsbuf_prev_cnt = 0;
|
|
|
|
spin_unlock_irqrestore(&phba->hbalock, flags);
|
|
|
|
|
|
|
|
while (!list_empty(&completions)) {
|
|
|
|
list_remove_head(&completions, buf_ptr,
|
|
|
|
struct lpfc_dmabuf, list);
|
|
|
|
lpfc_mbuf_free(phba, buf_ptr->virt, buf_ptr->phys);
|
|
|
|
kfree(buf_ptr);
|
|
|
|
}
|
|
|
|
|
2005-04-17 14:05:31 -07:00
|
|
|
/* Return any active mbox cmds */
|
|
|
|
del_timer_sync(&psli->mbox_tmo);
|
2007-06-17 17:56:38 -07:00
|
|
|
spin_lock_irqsave(&phba->hbalock, flags);
|
2007-06-17 17:56:36 -07:00
|
|
|
|
2007-06-17 17:56:38 -07:00
|
|
|
spin_lock(&phba->pport->work_port_lock);
|
2007-06-17 17:56:36 -07:00
|
|
|
phba->pport->work_port_events &= ~WORKER_MBOX_TMO;
|
2007-06-17 17:56:38 -07:00
|
|
|
spin_unlock(&phba->pport->work_port_lock);
|
2007-06-17 17:56:36 -07:00
|
|
|
|
2007-06-17 17:56:38 -07:00
|
|
|
if (psli->mbox_active) {
|
|
|
|
list_add_tail(&psli->mbox_active->list, &completions);
|
2007-06-17 17:56:36 -07:00
|
|
|
psli->mbox_active = NULL;
|
|
|
|
psli->sli_flag &= ~LPFC_SLI_MBOX_ACTIVE;
|
2005-04-17 14:05:31 -07:00
|
|
|
}
|
|
|
|
|
2007-06-17 17:56:38 -07:00
|
|
|
/* Return any pending or completed mbox cmds */
|
|
|
|
list_splice_init(&phba->sli.mboxq, &completions);
|
|
|
|
list_splice_init(&phba->sli.mboxq_cmpl, &completions);
|
|
|
|
INIT_LIST_HEAD(&psli->mboxq);
|
|
|
|
INIT_LIST_HEAD(&psli->mboxq_cmpl);
|
|
|
|
|
|
|
|
spin_unlock_irqrestore(&phba->hbalock, flags);
|
|
|
|
|
|
|
|
while (!list_empty(&completions)) {
|
|
|
|
list_remove_head(&completions, pmb, LPFC_MBOXQ_t, list);
|
2005-04-17 14:05:31 -07:00
|
|
|
pmb->mb.mbxStatus = MBX_NOT_FINISHED;
|
|
|
|
if (pmb->mbox_cmpl) {
|
|
|
|
pmb->mbox_cmpl(phba,pmb);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
lpfc_sli_pcimem_bcopy(void *srcp, void *destp, uint32_t cnt)
|
|
|
|
{
|
|
|
|
uint32_t *src = srcp;
|
|
|
|
uint32_t *dest = destp;
|
|
|
|
uint32_t ldata;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < (int)cnt; i += sizeof (uint32_t)) {
|
|
|
|
ldata = *src;
|
|
|
|
ldata = le32_to_cpu(ldata);
|
|
|
|
*dest = ldata;
|
|
|
|
src++;
|
|
|
|
dest++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2007-06-17 17:56:36 -07:00
|
|
|
lpfc_sli_ringpostbuf_put(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
|
|
|
|
struct lpfc_dmabuf *mp)
|
2005-04-17 14:05:31 -07:00
|
|
|
{
|
|
|
|
/* Stick struct lpfc_dmabuf at end of postbufq so driver can look it up
|
|
|
|
later */
|
2007-06-17 17:56:36 -07:00
|
|
|
spin_lock_irq(&phba->hbalock);
|
2005-04-17 14:05:31 -07:00
|
|
|
list_add_tail(&mp->list, &pring->postbufq);
|
|
|
|
pring->postbufq_cnt++;
|
2007-06-17 17:56:36 -07:00
|
|
|
spin_unlock_irq(&phba->hbalock);
|
2005-04-17 14:05:31 -07:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2007-10-27 10:38:00 -07:00
|
|
|
uint32_t
|
|
|
|
lpfc_sli_get_buffer_tag(struct lpfc_hba *phba)
|
|
|
|
{
|
|
|
|
spin_lock_irq(&phba->hbalock);
|
|
|
|
phba->buffer_tag_count++;
|
|
|
|
/*
|
|
|
|
* Always set the QUE_BUFTAG_BIT to distiguish between
|
|
|
|
* a tag assigned by HBQ.
|
|
|
|
*/
|
|
|
|
phba->buffer_tag_count |= QUE_BUFTAG_BIT;
|
|
|
|
spin_unlock_irq(&phba->hbalock);
|
|
|
|
return phba->buffer_tag_count;
|
|
|
|
}
|
|
|
|
|
|
|
|
struct lpfc_dmabuf *
|
|
|
|
lpfc_sli_ring_taggedbuf_get(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
|
|
|
|
uint32_t tag)
|
|
|
|
{
|
|
|
|
struct lpfc_dmabuf *mp, *next_mp;
|
|
|
|
struct list_head *slp = &pring->postbufq;
|
|
|
|
|
|
|
|
/* Search postbufq, from the begining, looking for a match on tag */
|
|
|
|
spin_lock_irq(&phba->hbalock);
|
|
|
|
list_for_each_entry_safe(mp, next_mp, &pring->postbufq, list) {
|
|
|
|
if (mp->buffer_tag == tag) {
|
|
|
|
list_del_init(&mp->list);
|
|
|
|
pring->postbufq_cnt--;
|
|
|
|
spin_unlock_irq(&phba->hbalock);
|
|
|
|
return mp;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
spin_unlock_irq(&phba->hbalock);
|
|
|
|
lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
|
|
|
|
"0410 Cannot find virtual addr for buffer tag on "
|
|
|
|
"ring %d Data x%lx x%p x%p x%x\n",
|
|
|
|
pring->ringno, (unsigned long) tag,
|
|
|
|
slp->next, slp->prev, pring->postbufq_cnt);
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
2005-04-17 14:05:31 -07:00
|
|
|
|
|
|
|
struct lpfc_dmabuf *
|
|
|
|
lpfc_sli_ringpostbuf_get(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
|
|
|
|
dma_addr_t phys)
|
|
|
|
{
|
|
|
|
struct lpfc_dmabuf *mp, *next_mp;
|
|
|
|
struct list_head *slp = &pring->postbufq;
|
|
|
|
|
|
|
|
/* Search postbufq, from the begining, looking for a match on phys */
|
2007-06-17 17:56:36 -07:00
|
|
|
spin_lock_irq(&phba->hbalock);
|
2005-04-17 14:05:31 -07:00
|
|
|
list_for_each_entry_safe(mp, next_mp, &pring->postbufq, list) {
|
|
|
|
if (mp->phys == phys) {
|
|
|
|
list_del_init(&mp->list);
|
|
|
|
pring->postbufq_cnt--;
|
2007-06-17 17:56:36 -07:00
|
|
|
spin_unlock_irq(&phba->hbalock);
|
2005-04-17 14:05:31 -07:00
|
|
|
return mp;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-06-17 17:56:36 -07:00
|
|
|
spin_unlock_irq(&phba->hbalock);
|
2005-04-17 14:05:31 -07:00
|
|
|
lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
|
2007-08-02 08:10:09 -07:00
|
|
|
"0410 Cannot find virtual addr for mapped buf on "
|
2005-04-17 14:05:31 -07:00
|
|
|
"ring %d Data x%llx x%p x%p x%x\n",
|
2007-08-02 08:10:09 -07:00
|
|
|
pring->ringno, (unsigned long long)phys,
|
2005-04-17 14:05:31 -07:00
|
|
|
slp->next, slp->prev, pring->postbufq_cnt);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2007-06-17 17:56:36 -07:00
|
|
|
lpfc_sli_abort_els_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
|
|
|
|
struct lpfc_iocbq *rspiocb)
|
2005-04-17 14:05:31 -07:00
|
|
|
{
|
2007-06-17 17:56:36 -07:00
|
|
|
IOCB_t *irsp = &rspiocb->iocb;
|
2007-04-25 06:52:55 -07:00
|
|
|
uint16_t abort_iotag, abort_context;
|
2007-06-17 17:56:38 -07:00
|
|
|
struct lpfc_iocbq *abort_iocb;
|
2007-04-25 06:52:55 -07:00
|
|
|
struct lpfc_sli_ring *pring = &phba->sli.ring[LPFC_ELS_RING];
|
|
|
|
|
|
|
|
abort_iocb = NULL;
|
|
|
|
|
|
|
|
if (irsp->ulpStatus) {
|
|
|
|
abort_context = cmdiocb->iocb.un.acxri.abortContextTag;
|
|
|
|
abort_iotag = cmdiocb->iocb.un.acxri.abortIoTag;
|
|
|
|
|
2007-06-17 17:56:36 -07:00
|
|
|
spin_lock_irq(&phba->hbalock);
|
2007-04-25 06:52:55 -07:00
|
|
|
if (abort_iotag != 0 && abort_iotag <= phba->sli.last_iotag)
|
|
|
|
abort_iocb = phba->sli.iocbq_lookup[abort_iotag];
|
|
|
|
|
2007-06-17 17:56:38 -07:00
|
|
|
lpfc_printf_log(phba, KERN_INFO, LOG_ELS | LOG_SLI,
|
2007-08-02 08:10:09 -07:00
|
|
|
"0327 Cannot abort els iocb %p "
|
2007-06-17 17:56:38 -07:00
|
|
|
"with tag %x context %x, abort status %x, "
|
|
|
|
"abort code %x\n",
|
2007-08-02 08:10:09 -07:00
|
|
|
abort_iocb, abort_iotag, abort_context,
|
|
|
|
irsp->ulpStatus, irsp->un.ulpWord[4]);
|
2007-04-25 06:52:55 -07:00
|
|
|
|
|
|
|
/*
|
|
|
|
* make sure we have the right iocbq before taking it
|
|
|
|
* off the txcmplq and try to call completion routine.
|
|
|
|
*/
|
2007-06-17 17:56:36 -07:00
|
|
|
if (!abort_iocb ||
|
|
|
|
abort_iocb->iocb.ulpContext != abort_context ||
|
|
|
|
(abort_iocb->iocb_flag & LPFC_DRIVER_ABORTED) == 0)
|
|
|
|
spin_unlock_irq(&phba->hbalock);
|
|
|
|
else {
|
2007-06-17 17:56:38 -07:00
|
|
|
list_del_init(&abort_iocb->list);
|
2007-04-25 06:52:55 -07:00
|
|
|
pring->txcmplq_cnt--;
|
2007-06-17 17:56:36 -07:00
|
|
|
spin_unlock_irq(&phba->hbalock);
|
2007-04-25 06:52:55 -07:00
|
|
|
|
2008-01-10 23:52:36 -07:00
|
|
|
/* Firmware could still be in progress of DMAing
|
|
|
|
* payload, so don't free data buffer till after
|
|
|
|
* a hbeat.
|
|
|
|
*/
|
|
|
|
abort_iocb->iocb_flag |= LPFC_DELAY_MEM_FREE;
|
|
|
|
|
2007-06-17 17:56:38 -07:00
|
|
|
abort_iocb->iocb_flag &= ~LPFC_DRIVER_ABORTED;
|
|
|
|
abort_iocb->iocb.ulpStatus = IOSTAT_LOCAL_REJECT;
|
|
|
|
abort_iocb->iocb.un.ulpWord[4] = IOERR_SLI_ABORTED;
|
|
|
|
(abort_iocb->iocb_cmpl)(phba, abort_iocb, abort_iocb);
|
2007-04-25 06:52:55 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-10-29 08:28:33 -07:00
|
|
|
lpfc_sli_release_iocbq(phba, cmdiocb);
|
2005-04-17 14:05:31 -07:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2007-06-17 17:56:38 -07:00
|
|
|
static void
|
|
|
|
lpfc_ignore_els_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
|
|
|
|
struct lpfc_iocbq *rspiocb)
|
|
|
|
{
|
|
|
|
IOCB_t *irsp = &rspiocb->iocb;
|
|
|
|
|
|
|
|
/* ELS cmd tag <ulpIoTag> completes */
|
|
|
|
lpfc_printf_log(phba, KERN_INFO, LOG_ELS,
|
2007-08-02 08:10:09 -07:00
|
|
|
"0133 Ignoring ELS cmd tag x%x completion Data: "
|
2007-06-17 17:56:38 -07:00
|
|
|
"x%x x%x x%x\n",
|
2007-08-02 08:10:09 -07:00
|
|
|
irsp->ulpIoTag, irsp->ulpStatus,
|
2007-06-17 17:56:38 -07:00
|
|
|
irsp->un.ulpWord[4], irsp->ulpTimeout);
|
2007-06-17 17:56:39 -07:00
|
|
|
if (cmdiocb->iocb.ulpCommand == CMD_GEN_REQUEST64_CR)
|
|
|
|
lpfc_ct_free_iocb(phba, cmdiocb);
|
|
|
|
else
|
|
|
|
lpfc_els_free_iocb(phba, cmdiocb);
|
2007-06-17 17:56:38 -07:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2005-04-17 14:05:31 -07:00
|
|
|
int
|
2007-06-17 17:56:36 -07:00
|
|
|
lpfc_sli_issue_abort_iotag(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
|
|
|
|
struct lpfc_iocbq *cmdiocb)
|
2005-04-17 14:05:31 -07:00
|
|
|
{
|
2007-06-17 17:56:36 -07:00
|
|
|
struct lpfc_vport *vport = cmdiocb->vport;
|
2005-10-28 17:30:02 -07:00
|
|
|
struct lpfc_iocbq *abtsiocbp;
|
2005-04-17 14:05:31 -07:00
|
|
|
IOCB_t *icmd = NULL;
|
|
|
|
IOCB_t *iabt = NULL;
|
2007-04-25 06:51:38 -07:00
|
|
|
int retval = IOCB_ERROR;
|
|
|
|
|
2007-06-17 17:56:38 -07:00
|
|
|
/*
|
|
|
|
* There are certain command types we don't want to abort. And we
|
|
|
|
* don't want to abort commands that are already in the process of
|
|
|
|
* being aborted.
|
2007-04-25 06:51:38 -07:00
|
|
|
*/
|
|
|
|
icmd = &cmdiocb->iocb;
|
2007-06-17 17:56:36 -07:00
|
|
|
if (icmd->ulpCommand == CMD_ABORT_XRI_CN ||
|
2007-06-17 17:56:38 -07:00
|
|
|
icmd->ulpCommand == CMD_CLOSE_XRI_CN ||
|
|
|
|
(cmdiocb->iocb_flag & LPFC_DRIVER_ABORTED) != 0)
|
2007-04-25 06:51:38 -07:00
|
|
|
return 0;
|
|
|
|
|
2007-06-17 17:56:39 -07:00
|
|
|
/* If we're unloading, don't abort iocb on the ELS ring, but change the
|
|
|
|
* callback so that nothing happens when it finishes.
|
2007-04-25 06:51:38 -07:00
|
|
|
*/
|
2007-06-17 17:56:39 -07:00
|
|
|
if ((vport->load_flag & FC_UNLOADING) &&
|
|
|
|
(pring->ringno == LPFC_ELS_RING)) {
|
2007-06-17 17:56:38 -07:00
|
|
|
if (cmdiocb->iocb_flag & LPFC_IO_FABRIC)
|
|
|
|
cmdiocb->fabric_iocb_cmpl = lpfc_ignore_els_cmpl;
|
|
|
|
else
|
|
|
|
cmdiocb->iocb_cmpl = lpfc_ignore_els_cmpl;
|
2007-04-25 06:51:38 -07:00
|
|
|
goto abort_iotag_exit;
|
2007-06-17 17:56:38 -07:00
|
|
|
}
|
2005-04-17 14:05:31 -07:00
|
|
|
|
|
|
|
/* issue ABTS for this IOCB based on iotag */
|
2007-06-17 17:56:38 -07:00
|
|
|
abtsiocbp = __lpfc_sli_get_iocbq(phba);
|
2005-04-17 14:05:31 -07:00
|
|
|
if (abtsiocbp == NULL)
|
|
|
|
return 0;
|
|
|
|
|
2007-04-25 06:51:38 -07:00
|
|
|
/* This signals the response to set the correct status
|
|
|
|
* before calling the completion handler.
|
|
|
|
*/
|
|
|
|
cmdiocb->iocb_flag |= LPFC_DRIVER_ABORTED;
|
|
|
|
|
2005-04-17 14:05:31 -07:00
|
|
|
iabt = &abtsiocbp->iocb;
|
2007-04-25 06:51:38 -07:00
|
|
|
iabt->un.acxri.abortType = ABORT_TYPE_ABTS;
|
|
|
|
iabt->un.acxri.abortContextTag = icmd->ulpContext;
|
|
|
|
iabt->un.acxri.abortIoTag = icmd->ulpIoTag;
|
|
|
|
iabt->ulpLe = 1;
|
|
|
|
iabt->ulpClass = icmd->ulpClass;
|
2005-04-17 14:05:31 -07:00
|
|
|
|
2007-06-17 17:56:36 -07:00
|
|
|
if (phba->link_state >= LPFC_LINK_UP)
|
2007-04-25 06:51:38 -07:00
|
|
|
iabt->ulpCommand = CMD_ABORT_XRI_CN;
|
|
|
|
else
|
|
|
|
iabt->ulpCommand = CMD_CLOSE_XRI_CN;
|
2005-04-17 14:05:31 -07:00
|
|
|
|
2007-04-25 06:51:38 -07:00
|
|
|
abtsiocbp->iocb_cmpl = lpfc_sli_abort_els_cmpl;
|
2007-04-25 06:52:49 -07:00
|
|
|
|
2007-08-02 08:10:09 -07:00
|
|
|
lpfc_printf_vlog(vport, KERN_INFO, LOG_SLI,
|
|
|
|
"0339 Abort xri x%x, original iotag x%x, "
|
|
|
|
"abort cmd iotag x%x\n",
|
|
|
|
iabt->un.acxri.abortContextTag,
|
|
|
|
iabt->un.acxri.abortIoTag, abtsiocbp->iotag);
|
2007-06-17 17:56:38 -07:00
|
|
|
retval = __lpfc_sli_issue_iocb(phba, pring, abtsiocbp, 0);
|
2005-04-17 14:05:31 -07:00
|
|
|
|
2007-04-25 06:51:38 -07:00
|
|
|
abort_iotag_exit:
|
2007-06-17 17:56:36 -07:00
|
|
|
/*
|
|
|
|
* Caller to this routine should check for IOCB_ERROR
|
|
|
|
* and handle it properly. This routine no longer removes
|
|
|
|
* iocb off txcmplq and call compl in case of IOCB_ERROR.
|
2007-04-25 06:51:38 -07:00
|
|
|
*/
|
2007-06-17 17:56:36 -07:00
|
|
|
return retval;
|
2005-04-17 14:05:31 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2007-08-02 08:10:31 -07:00
|
|
|
lpfc_sli_validate_fcp_iocb(struct lpfc_iocbq *iocbq, struct lpfc_vport *vport,
|
|
|
|
uint16_t tgt_id, uint64_t lun_id,
|
2005-10-28 17:30:02 -07:00
|
|
|
lpfc_ctx_cmd ctx_cmd)
|
2005-04-17 14:05:31 -07:00
|
|
|
{
|
2005-10-28 17:30:02 -07:00
|
|
|
struct lpfc_scsi_buf *lpfc_cmd;
|
|
|
|
struct scsi_cmnd *cmnd;
|
2005-04-17 14:05:31 -07:00
|
|
|
int rc = 1;
|
|
|
|
|
2005-10-28 17:30:02 -07:00
|
|
|
if (!(iocbq->iocb_flag & LPFC_IO_FCP))
|
|
|
|
return rc;
|
|
|
|
|
2007-08-02 08:10:31 -07:00
|
|
|
if (iocbq->vport != vport)
|
|
|
|
return rc;
|
|
|
|
|
2005-10-28 17:30:02 -07:00
|
|
|
lpfc_cmd = container_of(iocbq, struct lpfc_scsi_buf, cur_iocbq);
|
|
|
|
cmnd = lpfc_cmd->pCmd;
|
|
|
|
|
|
|
|
if (cmnd == NULL)
|
2005-04-17 14:05:31 -07:00
|
|
|
return rc;
|
|
|
|
|
|
|
|
switch (ctx_cmd) {
|
|
|
|
case LPFC_CTX_LUN:
|
2005-10-28 17:30:02 -07:00
|
|
|
if ((cmnd->device->id == tgt_id) &&
|
|
|
|
(cmnd->device->lun == lun_id))
|
2005-04-17 14:05:31 -07:00
|
|
|
rc = 0;
|
|
|
|
break;
|
|
|
|
case LPFC_CTX_TGT:
|
2005-10-28 17:30:02 -07:00
|
|
|
if (cmnd->device->id == tgt_id)
|
2005-04-17 14:05:31 -07:00
|
|
|
rc = 0;
|
|
|
|
break;
|
|
|
|
case LPFC_CTX_HOST:
|
|
|
|
rc = 0;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
printk(KERN_ERR "%s: Unknown context cmd type, value %d\n",
|
|
|
|
__FUNCTION__, ctx_cmd);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2007-08-02 08:10:31 -07:00
|
|
|
lpfc_sli_sum_iocb(struct lpfc_vport *vport, uint16_t tgt_id, uint64_t lun_id,
|
|
|
|
lpfc_ctx_cmd ctx_cmd)
|
2005-04-17 14:05:31 -07:00
|
|
|
{
|
2007-08-02 08:10:31 -07:00
|
|
|
struct lpfc_hba *phba = vport->phba;
|
2005-10-28 17:30:02 -07:00
|
|
|
struct lpfc_iocbq *iocbq;
|
|
|
|
int sum, i;
|
2005-04-17 14:05:31 -07:00
|
|
|
|
2005-10-28 17:30:02 -07:00
|
|
|
for (i = 1, sum = 0; i <= phba->sli.last_iotag; i++) {
|
|
|
|
iocbq = phba->sli.iocbq_lookup[i];
|
2005-04-17 14:05:31 -07:00
|
|
|
|
2007-08-02 08:10:31 -07:00
|
|
|
if (lpfc_sli_validate_fcp_iocb (iocbq, vport, tgt_id, lun_id,
|
|
|
|
ctx_cmd) == 0)
|
2005-10-28 17:30:02 -07:00
|
|
|
sum++;
|
2005-04-17 14:05:31 -07:00
|
|
|
}
|
2005-10-28 17:30:02 -07:00
|
|
|
|
2005-04-17 14:05:31 -07:00
|
|
|
return sum;
|
|
|
|
}
|
|
|
|
|
2005-06-25 07:34:30 -07:00
|
|
|
void
|
2007-06-17 17:56:36 -07:00
|
|
|
lpfc_sli_abort_fcp_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
|
|
|
|
struct lpfc_iocbq *rspiocb)
|
2005-06-25 07:34:30 -07:00
|
|
|
{
|
2005-10-29 08:28:33 -07:00
|
|
|
lpfc_sli_release_iocbq(phba, cmdiocb);
|
2005-06-25 07:34:30 -07:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2005-04-17 14:05:31 -07:00
|
|
|
int
|
2007-08-02 08:10:31 -07:00
|
|
|
lpfc_sli_abort_iocb(struct lpfc_vport *vport, struct lpfc_sli_ring *pring,
|
|
|
|
uint16_t tgt_id, uint64_t lun_id, lpfc_ctx_cmd abort_cmd)
|
2005-04-17 14:05:31 -07:00
|
|
|
{
|
2007-08-02 08:10:31 -07:00
|
|
|
struct lpfc_hba *phba = vport->phba;
|
2005-10-28 17:30:02 -07:00
|
|
|
struct lpfc_iocbq *iocbq;
|
|
|
|
struct lpfc_iocbq *abtsiocb;
|
2005-04-17 14:05:31 -07:00
|
|
|
IOCB_t *cmd = NULL;
|
|
|
|
int errcnt = 0, ret_val = 0;
|
2005-10-28 17:30:02 -07:00
|
|
|
int i;
|
2005-04-17 14:05:31 -07:00
|
|
|
|
2005-10-28 17:30:02 -07:00
|
|
|
for (i = 1; i <= phba->sli.last_iotag; i++) {
|
|
|
|
iocbq = phba->sli.iocbq_lookup[i];
|
2005-04-17 14:05:31 -07:00
|
|
|
|
2007-08-02 08:10:31 -07:00
|
|
|
if (lpfc_sli_validate_fcp_iocb(iocbq, vport, tgt_id, lun_id,
|
2007-06-17 17:56:36 -07:00
|
|
|
abort_cmd) != 0)
|
2005-04-17 14:05:31 -07:00
|
|
|
continue;
|
|
|
|
|
|
|
|
/* issue ABTS for this IOCB based on iotag */
|
2005-10-28 17:30:02 -07:00
|
|
|
abtsiocb = lpfc_sli_get_iocbq(phba);
|
2005-04-17 14:05:31 -07:00
|
|
|
if (abtsiocb == NULL) {
|
|
|
|
errcnt++;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2005-10-28 17:30:02 -07:00
|
|
|
cmd = &iocbq->iocb;
|
2005-04-17 14:05:31 -07:00
|
|
|
abtsiocb->iocb.un.acxri.abortType = ABORT_TYPE_ABTS;
|
|
|
|
abtsiocb->iocb.un.acxri.abortContextTag = cmd->ulpContext;
|
|
|
|
abtsiocb->iocb.un.acxri.abortIoTag = cmd->ulpIoTag;
|
|
|
|
abtsiocb->iocb.ulpLe = 1;
|
|
|
|
abtsiocb->iocb.ulpClass = cmd->ulpClass;
|
2007-06-17 17:56:36 -07:00
|
|
|
abtsiocb->vport = phba->pport;
|
2005-04-17 14:05:31 -07:00
|
|
|
|
2007-06-17 17:56:36 -07:00
|
|
|
if (lpfc_is_link_up(phba))
|
2005-04-17 14:05:31 -07:00
|
|
|
abtsiocb->iocb.ulpCommand = CMD_ABORT_XRI_CN;
|
|
|
|
else
|
|
|
|
abtsiocb->iocb.ulpCommand = CMD_CLOSE_XRI_CN;
|
|
|
|
|
2005-06-25 07:34:30 -07:00
|
|
|
/* Setup callback routine and issue the command. */
|
|
|
|
abtsiocb->iocb_cmpl = lpfc_sli_abort_fcp_cmpl;
|
2005-04-17 14:05:31 -07:00
|
|
|
ret_val = lpfc_sli_issue_iocb(phba, pring, abtsiocb, 0);
|
|
|
|
if (ret_val == IOCB_ERROR) {
|
2005-10-29 08:28:33 -07:00
|
|
|
lpfc_sli_release_iocbq(phba, abtsiocb);
|
2005-04-17 14:05:31 -07:00
|
|
|
errcnt++;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return errcnt;
|
|
|
|
}
|
|
|
|
|
2005-10-28 17:29:47 -07:00
|
|
|
static void
|
|
|
|
lpfc_sli_wake_iocb_wait(struct lpfc_hba *phba,
|
|
|
|
struct lpfc_iocbq *cmdiocbq,
|
|
|
|
struct lpfc_iocbq *rspiocbq)
|
2005-04-17 14:05:31 -07:00
|
|
|
{
|
2005-10-28 17:29:47 -07:00
|
|
|
wait_queue_head_t *pdone_q;
|
|
|
|
unsigned long iflags;
|
2005-04-17 14:05:31 -07:00
|
|
|
|
2007-06-17 17:56:36 -07:00
|
|
|
spin_lock_irqsave(&phba->hbalock, iflags);
|
2005-10-28 17:29:47 -07:00
|
|
|
cmdiocbq->iocb_flag |= LPFC_IO_WAKE;
|
|
|
|
if (cmdiocbq->context2 && rspiocbq)
|
|
|
|
memcpy(&((struct lpfc_iocbq *)cmdiocbq->context2)->iocb,
|
|
|
|
&rspiocbq->iocb, sizeof(IOCB_t));
|
|
|
|
|
|
|
|
pdone_q = cmdiocbq->context_un.wait_queue;
|
|
|
|
if (pdone_q)
|
|
|
|
wake_up(pdone_q);
|
2007-06-17 17:56:39 -07:00
|
|
|
spin_unlock_irqrestore(&phba->hbalock, iflags);
|
2005-04-17 14:05:31 -07:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2005-10-28 17:29:47 -07:00
|
|
|
/*
|
|
|
|
* Issue the caller's iocb and wait for its completion, but no longer than the
|
|
|
|
* caller's timeout. Note that iocb_flags is cleared before the
|
|
|
|
* lpfc_sli_issue_call since the wake routine sets a unique value and by
|
|
|
|
* definition this is a wait function.
|
|
|
|
*/
|
2007-06-17 17:56:38 -07:00
|
|
|
|
2005-04-17 14:05:31 -07:00
|
|
|
int
|
2007-06-17 17:56:36 -07:00
|
|
|
lpfc_sli_issue_iocb_wait(struct lpfc_hba *phba,
|
|
|
|
struct lpfc_sli_ring *pring,
|
|
|
|
struct lpfc_iocbq *piocb,
|
|
|
|
struct lpfc_iocbq *prspiocbq,
|
2005-10-28 17:29:47 -07:00
|
|
|
uint32_t timeout)
|
2005-04-17 14:05:31 -07:00
|
|
|
{
|
2006-10-29 23:46:36 -07:00
|
|
|
DECLARE_WAIT_QUEUE_HEAD_ONSTACK(done_q);
|
2005-10-28 17:29:47 -07:00
|
|
|
long timeleft, timeout_req = 0;
|
|
|
|
int retval = IOCB_SUCCESS;
|
[SCSI] lpfc 8.1.1 : Add polled-mode support
- Add functionality to run in polled mode only. Includes run time
attribute to enable mode.
- Enable runtime writable hba settings for coallescing and delay parameters
Customers have requested a mode in the driver to run strictly polled.
This is generally to support an environment where the server is extremely
loaded and is looking to reclaim some cpu cycles from adapter interrupt
handling.
This patch adds a new "poll" attribute, and the following behavior:
if value is 0 (default):
The driver uses the normal method for i/o completion. It uses the
firmware feature of interrupt coalesing. The firmware allows a
minimum number of i/o completions before an interrupt, or a maximum
time delay between interrupts. By default, the driver sets these
to no delay (disabled) or 1 i/o - meaning coalescing is disabled.
Attributes were provided to change the coalescing values, but it was
a module-load time only and global across all adapters.
This patch allows them to be writable on a per-adapter basis.
if value is 1 :
Interrupts are left enabled, expecting that the user has tuned the
interrupt coalescing values. When this setting is enabled, the driver
will attempt to service completed i/o whenever new i/o is submitted
to the adapter. If the coalescing values are large, and the i/o
generation rate steady, an interrupt will be avoided by servicing
completed i/o prior to the coalescing thresholds kicking in. However,
if the i/o completion load is high enough or i/o generation slow, the
coalescion values will ensure that completed i/o is serviced in a timely
fashion.
if value is 3 :
Turns off FCP i/o interrupts altogether. The coalescing values now have
no effect. A new attribute "poll_tmo" (default 10ms) exists to set
the polling interval for i/o completion. When this setting is enabled,
the driver will attempt to service completed i/o and restart the
interval timer whenever new i/o is submitted. This behavior allows for
servicing of completed i/o sooner than the interval timer, but ensures
that if no i/o is being issued, then the interval timer will kick in
to service the outstanding i/o.
Signed-off-by: James Smart <James.Smart@emulex.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-11-29 14:32:13 -07:00
|
|
|
uint32_t creg_val;
|
2005-04-17 14:05:31 -07:00
|
|
|
|
|
|
|
/*
|
2005-10-28 17:29:47 -07:00
|
|
|
* If the caller has provided a response iocbq buffer, then context2
|
|
|
|
* is NULL or its an error.
|
2005-04-17 14:05:31 -07:00
|
|
|
*/
|
2005-10-28 17:29:47 -07:00
|
|
|
if (prspiocbq) {
|
|
|
|
if (piocb->context2)
|
|
|
|
return IOCB_ERROR;
|
|
|
|
piocb->context2 = prspiocbq;
|
2005-04-17 14:05:31 -07:00
|
|
|
}
|
|
|
|
|
2005-10-28 17:29:47 -07:00
|
|
|
piocb->iocb_cmpl = lpfc_sli_wake_iocb_wait;
|
|
|
|
piocb->context_un.wait_queue = &done_q;
|
|
|
|
piocb->iocb_flag &= ~LPFC_IO_WAKE;
|
2005-04-17 14:05:31 -07:00
|
|
|
|
[SCSI] lpfc 8.1.1 : Add polled-mode support
- Add functionality to run in polled mode only. Includes run time
attribute to enable mode.
- Enable runtime writable hba settings for coallescing and delay parameters
Customers have requested a mode in the driver to run strictly polled.
This is generally to support an environment where the server is extremely
loaded and is looking to reclaim some cpu cycles from adapter interrupt
handling.
This patch adds a new "poll" attribute, and the following behavior:
if value is 0 (default):
The driver uses the normal method for i/o completion. It uses the
firmware feature of interrupt coalesing. The firmware allows a
minimum number of i/o completions before an interrupt, or a maximum
time delay between interrupts. By default, the driver sets these
to no delay (disabled) or 1 i/o - meaning coalescing is disabled.
Attributes were provided to change the coalescing values, but it was
a module-load time only and global across all adapters.
This patch allows them to be writable on a per-adapter basis.
if value is 1 :
Interrupts are left enabled, expecting that the user has tuned the
interrupt coalescing values. When this setting is enabled, the driver
will attempt to service completed i/o whenever new i/o is submitted
to the adapter. If the coalescing values are large, and the i/o
generation rate steady, an interrupt will be avoided by servicing
completed i/o prior to the coalescing thresholds kicking in. However,
if the i/o completion load is high enough or i/o generation slow, the
coalescion values will ensure that completed i/o is serviced in a timely
fashion.
if value is 3 :
Turns off FCP i/o interrupts altogether. The coalescing values now have
no effect. A new attribute "poll_tmo" (default 10ms) exists to set
the polling interval for i/o completion. When this setting is enabled,
the driver will attempt to service completed i/o and restart the
interval timer whenever new i/o is submitted. This behavior allows for
servicing of completed i/o sooner than the interval timer, but ensures
that if no i/o is being issued, then the interval timer will kick in
to service the outstanding i/o.
Signed-off-by: James Smart <James.Smart@emulex.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-11-29 14:32:13 -07:00
|
|
|
if (phba->cfg_poll & DISABLE_FCP_RING_INT) {
|
|
|
|
creg_val = readl(phba->HCregaddr);
|
|
|
|
creg_val |= (HC_R0INT_ENA << LPFC_FCP_RING);
|
|
|
|
writel(creg_val, phba->HCregaddr);
|
|
|
|
readl(phba->HCregaddr); /* flush */
|
|
|
|
}
|
|
|
|
|
2005-10-28 17:29:47 -07:00
|
|
|
retval = lpfc_sli_issue_iocb(phba, pring, piocb, 0);
|
|
|
|
if (retval == IOCB_SUCCESS) {
|
|
|
|
timeout_req = timeout * HZ;
|
|
|
|
timeleft = wait_event_timeout(done_q,
|
|
|
|
piocb->iocb_flag & LPFC_IO_WAKE,
|
|
|
|
timeout_req);
|
2005-04-17 14:05:31 -07:00
|
|
|
|
2007-04-25 06:52:34 -07:00
|
|
|
if (piocb->iocb_flag & LPFC_IO_WAKE) {
|
|
|
|
lpfc_printf_log(phba, KERN_INFO, LOG_SLI,
|
2007-08-02 08:10:09 -07:00
|
|
|
"0331 IOCB wake signaled\n");
|
2007-04-25 06:52:34 -07:00
|
|
|
} else if (timeleft == 0) {
|
2005-10-28 17:29:47 -07:00
|
|
|
lpfc_printf_log(phba, KERN_ERR, LOG_SLI,
|
2007-08-02 08:10:09 -07:00
|
|
|
"0338 IOCB wait timeout error - no "
|
|
|
|
"wake response Data x%x\n", timeout);
|
2005-10-28 17:29:47 -07:00
|
|
|
retval = IOCB_TIMEDOUT;
|
2007-04-25 06:52:34 -07:00
|
|
|
} else {
|
2005-10-28 17:29:47 -07:00
|
|
|
lpfc_printf_log(phba, KERN_ERR, LOG_SLI,
|
2007-08-02 08:10:09 -07:00
|
|
|
"0330 IOCB wake NOT set, "
|
|
|
|
"Data x%x x%lx\n",
|
2005-10-28 17:29:47 -07:00
|
|
|
timeout, (timeleft / jiffies));
|
|
|
|
retval = IOCB_TIMEDOUT;
|
2005-04-17 14:05:31 -07:00
|
|
|
}
|
2005-10-28 17:29:47 -07:00
|
|
|
} else {
|
|
|
|
lpfc_printf_log(phba, KERN_INFO, LOG_SLI,
|
2007-08-02 08:10:09 -07:00
|
|
|
":0332 IOCB wait issue failed, Data x%x\n",
|
|
|
|
retval);
|
2005-10-28 17:29:47 -07:00
|
|
|
retval = IOCB_ERROR;
|
2005-04-17 14:05:31 -07:00
|
|
|
}
|
|
|
|
|
[SCSI] lpfc 8.1.1 : Add polled-mode support
- Add functionality to run in polled mode only. Includes run time
attribute to enable mode.
- Enable runtime writable hba settings for coallescing and delay parameters
Customers have requested a mode in the driver to run strictly polled.
This is generally to support an environment where the server is extremely
loaded and is looking to reclaim some cpu cycles from adapter interrupt
handling.
This patch adds a new "poll" attribute, and the following behavior:
if value is 0 (default):
The driver uses the normal method for i/o completion. It uses the
firmware feature of interrupt coalesing. The firmware allows a
minimum number of i/o completions before an interrupt, or a maximum
time delay between interrupts. By default, the driver sets these
to no delay (disabled) or 1 i/o - meaning coalescing is disabled.
Attributes were provided to change the coalescing values, but it was
a module-load time only and global across all adapters.
This patch allows them to be writable on a per-adapter basis.
if value is 1 :
Interrupts are left enabled, expecting that the user has tuned the
interrupt coalescing values. When this setting is enabled, the driver
will attempt to service completed i/o whenever new i/o is submitted
to the adapter. If the coalescing values are large, and the i/o
generation rate steady, an interrupt will be avoided by servicing
completed i/o prior to the coalescing thresholds kicking in. However,
if the i/o completion load is high enough or i/o generation slow, the
coalescion values will ensure that completed i/o is serviced in a timely
fashion.
if value is 3 :
Turns off FCP i/o interrupts altogether. The coalescing values now have
no effect. A new attribute "poll_tmo" (default 10ms) exists to set
the polling interval for i/o completion. When this setting is enabled,
the driver will attempt to service completed i/o and restart the
interval timer whenever new i/o is submitted. This behavior allows for
servicing of completed i/o sooner than the interval timer, but ensures
that if no i/o is being issued, then the interval timer will kick in
to service the outstanding i/o.
Signed-off-by: James Smart <James.Smart@emulex.com>
Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
2005-11-29 14:32:13 -07:00
|
|
|
if (phba->cfg_poll & DISABLE_FCP_RING_INT) {
|
|
|
|
creg_val = readl(phba->HCregaddr);
|
|
|
|
creg_val &= ~(HC_R0INT_ENA << LPFC_FCP_RING);
|
|
|
|
writel(creg_val, phba->HCregaddr);
|
|
|
|
readl(phba->HCregaddr); /* flush */
|
|
|
|
}
|
|
|
|
|
2005-10-28 17:29:47 -07:00
|
|
|
if (prspiocbq)
|
|
|
|
piocb->context2 = NULL;
|
|
|
|
|
|
|
|
piocb->context_un.wait_queue = NULL;
|
|
|
|
piocb->iocb_cmpl = NULL;
|
2005-04-17 14:05:31 -07:00
|
|
|
return retval;
|
|
|
|
}
|
2005-10-28 17:29:47 -07:00
|
|
|
|
2005-04-17 14:05:31 -07:00
|
|
|
int
|
2007-06-17 17:56:36 -07:00
|
|
|
lpfc_sli_issue_mbox_wait(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmboxq,
|
2005-04-17 14:05:31 -07:00
|
|
|
uint32_t timeout)
|
|
|
|
{
|
2006-10-29 23:46:36 -07:00
|
|
|
DECLARE_WAIT_QUEUE_HEAD_ONSTACK(done_q);
|
2005-04-17 14:05:31 -07:00
|
|
|
int retval;
|
2007-06-17 17:56:39 -07:00
|
|
|
unsigned long flag;
|
2005-04-17 14:05:31 -07:00
|
|
|
|
|
|
|
/* The caller must leave context1 empty. */
|
2007-10-27 10:37:33 -07:00
|
|
|
if (pmboxq->context1)
|
2007-06-17 17:56:36 -07:00
|
|
|
return MBX_NOT_FINISHED;
|
2005-04-17 14:05:31 -07:00
|
|
|
|
|
|
|
/* setup wake call as IOCB callback */
|
|
|
|
pmboxq->mbox_cmpl = lpfc_sli_wake_mbox_wait;
|
|
|
|
/* setup context field to pass wait_queue pointer to wake function */
|
|
|
|
pmboxq->context1 = &done_q;
|
|
|
|
|
|
|
|
/* now issue the command */
|
|
|
|
retval = lpfc_sli_issue_mbox(phba, pmboxq, MBX_NOWAIT);
|
|
|
|
|
|
|
|
if (retval == MBX_BUSY || retval == MBX_SUCCESS) {
|
2007-04-25 06:52:34 -07:00
|
|
|
wait_event_interruptible_timeout(done_q,
|
|
|
|
pmboxq->mbox_flag & LPFC_MBX_WAKE,
|
|
|
|
timeout * HZ);
|
|
|
|
|
2007-06-17 17:56:39 -07:00
|
|
|
spin_lock_irqsave(&phba->hbalock, flag);
|
2005-04-17 14:05:31 -07:00
|
|
|
pmboxq->context1 = NULL;
|
2007-04-25 06:52:34 -07:00
|
|
|
/*
|
|
|
|
* if LPFC_MBX_WAKE flag is set the mailbox is completed
|
|
|
|
* else do not free the resources.
|
|
|
|
*/
|
|
|
|
if (pmboxq->mbox_flag & LPFC_MBX_WAKE)
|
2005-04-17 14:05:31 -07:00
|
|
|
retval = MBX_SUCCESS;
|
2007-06-17 17:56:39 -07:00
|
|
|
else {
|
2007-04-25 06:52:34 -07:00
|
|
|
retval = MBX_TIMEOUT;
|
2007-06-17 17:56:39 -07:00
|
|
|
pmboxq->mbox_cmpl = lpfc_sli_def_mbox_cmpl;
|
|
|
|
}
|
|
|
|
spin_unlock_irqrestore(&phba->hbalock, flag);
|
2005-04-17 14:05:31 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
2006-07-06 12:50:43 -07:00
|
|
|
int
|
|
|
|
lpfc_sli_flush_mbox_queue(struct lpfc_hba * phba)
|
|
|
|
{
|
2007-06-17 17:56:36 -07:00
|
|
|
struct lpfc_vport *vport = phba->pport;
|
2006-07-06 12:50:43 -07:00
|
|
|
int i = 0;
|
2007-06-17 17:56:37 -07:00
|
|
|
uint32_t ha_copy;
|
2006-07-06 12:50:43 -07:00
|
|
|
|
2007-06-17 17:56:36 -07:00
|
|
|
while (phba->sli.sli_flag & LPFC_SLI_MBOX_ACTIVE && !vport->stopped) {
|
2006-07-06 12:50:43 -07:00
|
|
|
if (i++ > LPFC_MBOX_TMO * 1000)
|
|
|
|
return 1;
|
|
|
|
|
2007-06-17 17:56:37 -07:00
|
|
|
/*
|
|
|
|
* Call lpfc_sli_handle_mb_event only if a mailbox cmd
|
|
|
|
* did finish. This way we won't get the misleading
|
|
|
|
* "Stray Mailbox Interrupt" message.
|
|
|
|
*/
|
|
|
|
spin_lock_irq(&phba->hbalock);
|
|
|
|
ha_copy = phba->work_ha;
|
|
|
|
phba->work_ha &= ~HA_MBATT;
|
|
|
|
spin_unlock_irq(&phba->hbalock);
|
|
|
|
|
|
|
|
if (ha_copy & HA_MBATT)
|
|
|
|
if (lpfc_sli_handle_mb_event(phba) == 0)
|
|
|
|
i = 0;
|
2006-07-06 12:50:43 -07:00
|
|
|
|
|
|
|
msleep(1);
|
|
|
|
}
|
|
|
|
|
|
|
|
return (phba->sli.sli_flag & LPFC_SLI_MBOX_ACTIVE) ? 1 : 0;
|
|
|
|
}
|
|
|
|
|
2005-04-17 14:05:31 -07:00
|
|
|
irqreturn_t
|
IRQ: Maintain regs pointer globally rather than passing to IRQ handlers
Maintain a per-CPU global "struct pt_regs *" variable which can be used instead
of passing regs around manually through all ~1800 interrupt handlers in the
Linux kernel.
The regs pointer is used in few places, but it potentially costs both stack
space and code to pass it around. On the FRV arch, removing the regs parameter
from all the genirq function results in a 20% speed up of the IRQ exit path
(ie: from leaving timer_interrupt() to leaving do_IRQ()).
Where appropriate, an arch may override the generic storage facility and do
something different with the variable. On FRV, for instance, the address is
maintained in GR28 at all times inside the kernel as part of general exception
handling.
Having looked over the code, it appears that the parameter may be handed down
through up to twenty or so layers of functions. Consider a USB character
device attached to a USB hub, attached to a USB controller that posts its
interrupts through a cascaded auxiliary interrupt controller. A character
device driver may want to pass regs to the sysrq handler through the input
layer which adds another few layers of parameter passing.
I've build this code with allyesconfig for x86_64 and i386. I've runtested the
main part of the code on FRV and i386, though I can't test most of the drivers.
I've also done partial conversion for powerpc and MIPS - these at least compile
with minimal configurations.
This will affect all archs. Mostly the changes should be relatively easy.
Take do_IRQ(), store the regs pointer at the beginning, saving the old one:
struct pt_regs *old_regs = set_irq_regs(regs);
And put the old one back at the end:
set_irq_regs(old_regs);
Don't pass regs through to generic_handle_irq() or __do_IRQ().
In timer_interrupt(), this sort of change will be necessary:
- update_process_times(user_mode(regs));
- profile_tick(CPU_PROFILING, regs);
+ update_process_times(user_mode(get_irq_regs()));
+ profile_tick(CPU_PROFILING);
I'd like to move update_process_times()'s use of get_irq_regs() into itself,
except that i386, alone of the archs, uses something other than user_mode().
Some notes on the interrupt handling in the drivers:
(*) input_dev() is now gone entirely. The regs pointer is no longer stored in
the input_dev struct.
(*) finish_unlinks() in drivers/usb/host/ohci-q.c needs checking. It does
something different depending on whether it's been supplied with a regs
pointer or not.
(*) Various IRQ handler function pointers have been moved to type
irq_handler_t.
Signed-Off-By: David Howells <dhowells@redhat.com>
(cherry picked from 1b16e7ac850969f38b375e511e3fa2f474a33867 commit)
2006-10-05 06:55:46 -07:00
|
|
|
lpfc_intr_handler(int irq, void *dev_id)
|
2005-04-17 14:05:31 -07:00
|
|
|
{
|
2007-06-17 17:56:36 -07:00
|
|
|
struct lpfc_hba *phba;
|
2005-04-17 14:05:31 -07:00
|
|
|
uint32_t ha_copy;
|
|
|
|
uint32_t work_ha_copy;
|
|
|
|
unsigned long status;
|
|
|
|
uint32_t control;
|
|
|
|
|
2007-06-17 17:56:38 -07:00
|
|
|
MAILBOX_t *mbox, *pmbox;
|
2007-06-17 17:56:39 -07:00
|
|
|
struct lpfc_vport *vport;
|
|
|
|
struct lpfc_nodelist *ndlp;
|
|
|
|
struct lpfc_dmabuf *mp;
|
2007-06-17 17:56:38 -07:00
|
|
|
LPFC_MBOXQ_t *pmb;
|
|
|
|
int rc;
|
|
|
|
|
2005-04-17 14:05:31 -07:00
|
|
|
/*
|
|
|
|
* Get the driver's phba structure from the dev_id and
|
|
|
|
* assume the HBA is not interrupting.
|
|
|
|
*/
|
|
|
|
phba = (struct lpfc_hba *) dev_id;
|
|
|
|
|
|
|
|
if (unlikely(!phba))
|
|
|
|
return IRQ_NONE;
|
|
|
|
|
2007-02-14 13:28:36 -07:00
|
|
|
/* If the pci channel is offline, ignore all the interrupts. */
|
|
|
|
if (unlikely(pci_channel_offline(phba->pcidev)))
|
|
|
|
return IRQ_NONE;
|
|
|
|
|
2005-04-17 14:05:31 -07:00
|
|
|
phba->sli.slistat.sli_intr++;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Call the HBA to see if it is interrupting. If not, don't claim
|
|
|
|
* the interrupt
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* Ignore all interrupts during initialization. */
|
2007-06-17 17:56:36 -07:00
|
|
|
if (unlikely(phba->link_state < LPFC_LINK_DOWN))
|
2005-04-17 14:05:31 -07:00
|
|
|
return IRQ_NONE;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Read host attention register to determine interrupt source
|
|
|
|
* Clear Attention Sources, except Error Attention (to
|
|
|
|
* preserve status) and Link Attention
|
|
|
|
*/
|
2007-06-17 17:56:36 -07:00
|
|
|
spin_lock(&phba->hbalock);
|
2005-04-17 14:05:31 -07:00
|
|
|
ha_copy = readl(phba->HAregaddr);
|
2007-04-25 06:53:15 -07:00
|
|
|
/* If somebody is waiting to handle an eratt don't process it
|
|
|
|
* here. The brdkill function will do this.
|
|
|
|
*/
|
2007-06-17 17:56:36 -07:00
|
|
|
if (phba->link_flag & LS_IGNORE_ERATT)
|
2007-04-25 06:53:15 -07:00
|
|
|
ha_copy &= ~HA_ERATT;
|
2005-04-17 14:05:31 -07:00
|
|
|
writel((ha_copy & ~(HA_LATT | HA_ERATT)), phba->HAregaddr);
|
|
|
|
readl(phba->HAregaddr); /* flush */
|
2007-06-17 17:56:36 -07:00
|
|
|
spin_unlock(&phba->hbalock);
|
2005-04-17 14:05:31 -07:00
|
|
|
|
|
|
|
if (unlikely(!ha_copy))
|
|
|
|
return IRQ_NONE;
|
|
|
|
|
|
|
|
work_ha_copy = ha_copy & phba->work_ha_mask;
|
|
|
|
|
|
|
|
if (unlikely(work_ha_copy)) {
|
|
|
|
if (work_ha_copy & HA_LATT) {
|
|
|
|
if (phba->sli.sli_flag & LPFC_PROCESS_LA) {
|
|
|
|
/*
|
|
|
|
* Turn off Link Attention interrupts
|
|
|
|
* until CLEAR_LA done
|
|
|
|
*/
|
2007-06-17 17:56:36 -07:00
|
|
|
spin_lock(&phba->hbalock);
|
2005-04-17 14:05:31 -07:00
|
|
|
phba->sli.sli_flag &= ~LPFC_PROCESS_LA;
|
|
|
|
control = readl(phba->HCregaddr);
|
|
|
|
control &= ~HC_LAINT_ENA;
|
|
|
|
writel(control, phba->HCregaddr);
|
|
|
|
readl(phba->HCregaddr); /* flush */
|
2007-06-17 17:56:36 -07:00
|
|
|
spin_unlock(&phba->hbalock);
|
2005-04-17 14:05:31 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
work_ha_copy &= ~HA_LATT;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (work_ha_copy & ~(HA_ERATT|HA_MBATT|HA_LATT)) {
|
2007-06-17 17:56:39 -07:00
|
|
|
/*
|
|
|
|
* Turn off Slow Rings interrupts, LPFC_ELS_RING is
|
|
|
|
* the only slow ring.
|
|
|
|
*/
|
|
|
|
status = (work_ha_copy &
|
|
|
|
(HA_RXMASK << (4*LPFC_ELS_RING)));
|
|
|
|
status >>= (4*LPFC_ELS_RING);
|
|
|
|
if (status & HA_RXMASK) {
|
|
|
|
spin_lock(&phba->hbalock);
|
|
|
|
control = readl(phba->HCregaddr);
|
2007-08-02 08:09:43 -07:00
|
|
|
|
|
|
|
lpfc_debugfs_slow_ring_trc(phba,
|
|
|
|
"ISR slow ring: ctl:x%x stat:x%x isrcnt:x%x",
|
|
|
|
control, status,
|
|
|
|
(uint32_t)phba->sli.slistat.sli_intr);
|
|
|
|
|
2007-06-17 17:56:39 -07:00
|
|
|
if (control & (HC_R0INT_ENA << LPFC_ELS_RING)) {
|
2007-08-02 08:09:43 -07:00
|
|
|
lpfc_debugfs_slow_ring_trc(phba,
|
|
|
|
"ISR Disable ring:"
|
|
|
|
"pwork:x%x hawork:x%x wait:x%x",
|
|
|
|
phba->work_ha, work_ha_copy,
|
|
|
|
(uint32_t)((unsigned long)
|
|
|
|
phba->work_wait));
|
|
|
|
|
2007-06-17 17:56:39 -07:00
|
|
|
control &=
|
|
|
|
~(HC_R0INT_ENA << LPFC_ELS_RING);
|
2005-04-17 14:05:31 -07:00
|
|
|
writel(control, phba->HCregaddr);
|
|
|
|
readl(phba->HCregaddr); /* flush */
|
|
|
|
}
|
2007-08-02 08:09:43 -07:00
|
|
|
else {
|
|
|
|
lpfc_debugfs_slow_ring_trc(phba,
|
|
|
|
"ISR slow ring: pwork:"
|
|
|
|
"x%x hawork:x%x wait:x%x",
|
|
|
|
phba->work_ha, work_ha_copy,
|
|
|
|
(uint32_t)((unsigned long)
|
|
|
|
phba->work_wait));
|
|
|
|
}
|
2007-06-17 17:56:39 -07:00
|
|
|
spin_unlock(&phba->hbalock);
|
2005-04-17 14:05:31 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (work_ha_copy & HA_ERATT) {
|
2007-06-17 17:56:36 -07:00
|
|
|
phba->link_state = LPFC_HBA_ERROR;
|
2005-04-17 14:05:31 -07:00
|
|
|
/*
|
|
|
|
* There was a link/board error. Read the
|
|
|
|
* status register to retrieve the error event
|
|
|
|
* and process it.
|
|
|
|
*/
|
|
|
|
phba->sli.slistat.err_attn_event++;
|
|
|
|
/* Save status info */
|
|
|
|
phba->work_hs = readl(phba->HSregaddr);
|
|
|
|
phba->work_status[0] = readl(phba->MBslimaddr + 0xa8);
|
|
|
|
phba->work_status[1] = readl(phba->MBslimaddr + 0xac);
|
|
|
|
|
|
|
|
/* Clear Chip error bit */
|
|
|
|
writel(HA_ERATT, phba->HAregaddr);
|
|
|
|
readl(phba->HAregaddr); /* flush */
|
2007-06-17 17:56:36 -07:00
|
|
|
phba->pport->stopped = 1;
|
2005-04-17 14:05:31 -07:00
|
|
|
}
|
|
|
|
|
2007-06-17 17:56:38 -07:00
|
|
|
if ((work_ha_copy & HA_MBATT) &&
|
|
|
|
(phba->sli.mbox_active)) {
|
|
|
|
pmb = phba->sli.mbox_active;
|
|
|
|
pmbox = &pmb->mb;
|
|
|
|
mbox = &phba->slim2p->mbx;
|
2007-06-17 17:56:39 -07:00
|
|
|
vport = pmb->vport;
|
2007-06-17 17:56:38 -07:00
|
|
|
|
|
|
|
/* First check out the status word */
|
|
|
|
lpfc_sli_pcimem_bcopy(mbox, pmbox, sizeof(uint32_t));
|
|
|
|
if (pmbox->mbxOwner != OWN_HOST) {
|
|
|
|
/*
|
|
|
|
* Stray Mailbox Interrupt, mbxCommand <cmd>
|
|
|
|
* mbxStatus <status>
|
|
|
|
*/
|
|
|
|
lpfc_printf_log(phba, KERN_WARNING, LOG_MBOX |
|
|
|
|
LOG_SLI,
|
2007-08-02 08:10:09 -07:00
|
|
|
"(%d):0304 Stray Mailbox "
|
2007-06-17 17:56:38 -07:00
|
|
|
"Interrupt mbxCommand x%x "
|
|
|
|
"mbxStatus x%x\n",
|
2007-08-02 08:10:09 -07:00
|
|
|
(vport ? vport->vpi : 0),
|
2007-06-17 17:56:38 -07:00
|
|
|
pmbox->mbxCommand,
|
|
|
|
pmbox->mbxStatus);
|
|
|
|
}
|
2007-06-17 17:56:39 -07:00
|
|
|
phba->last_completion_time = jiffies;
|
2007-06-17 17:56:38 -07:00
|
|
|
del_timer_sync(&phba->sli.mbox_tmo);
|
|
|
|
|
|
|
|
phba->sli.mbox_active = NULL;
|
|
|
|
if (pmb->mbox_cmpl) {
|
|
|
|
lpfc_sli_pcimem_bcopy(mbox, pmbox,
|
|
|
|
MAILBOX_CMD_SIZE);
|
|
|
|
}
|
2007-06-17 17:56:39 -07:00
|
|
|
if (pmb->mbox_flag & LPFC_MBX_IMED_UNREG) {
|
|
|
|
pmb->mbox_flag &= ~LPFC_MBX_IMED_UNREG;
|
|
|
|
|
|
|
|
lpfc_debugfs_disc_trc(vport,
|
|
|
|
LPFC_DISC_TRC_MBOX_VPORT,
|
|
|
|
"MBOX dflt rpi: : status:x%x rpi:x%x",
|
|
|
|
(uint32_t)pmbox->mbxStatus,
|
|
|
|
pmbox->un.varWords[0], 0);
|
|
|
|
|
|
|
|
if ( !pmbox->mbxStatus) {
|
|
|
|
mp = (struct lpfc_dmabuf *)
|
|
|
|
(pmb->context1);
|
|
|
|
ndlp = (struct lpfc_nodelist *)
|
|
|
|
pmb->context2;
|
|
|
|
|
|
|
|
/* Reg_LOGIN of dflt RPI was successful.
|
|
|
|
* new lets get rid of the RPI using the
|
|
|
|
* same mbox buffer.
|
|
|
|
*/
|
|
|
|
lpfc_unreg_login(phba, vport->vpi,
|
|
|
|
pmbox->un.varWords[0], pmb);
|
|
|
|
pmb->mbox_cmpl = lpfc_mbx_cmpl_dflt_rpi;
|
|
|
|
pmb->context1 = mp;
|
|
|
|
pmb->context2 = ndlp;
|
|
|
|
pmb->vport = vport;
|
|
|
|
spin_lock(&phba->hbalock);
|
|
|
|
phba->sli.sli_flag &=
|
|
|
|
~LPFC_SLI_MBOX_ACTIVE;
|
|
|
|
spin_unlock(&phba->hbalock);
|
|
|
|
goto send_current_mbox;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
spin_lock(&phba->pport->work_port_lock);
|
|
|
|
phba->pport->work_port_events &= ~WORKER_MBOX_TMO;
|
|
|
|
spin_unlock(&phba->pport->work_port_lock);
|
2007-06-17 17:56:38 -07:00
|
|
|
lpfc_mbox_cmpl_put(phba, pmb);
|
|
|
|
}
|
|
|
|
if ((work_ha_copy & HA_MBATT) &&
|
|
|
|
(phba->sli.mbox_active == NULL)) {
|
|
|
|
send_next_mbox:
|
|
|
|
spin_lock(&phba->hbalock);
|
|
|
|
phba->sli.sli_flag &= ~LPFC_SLI_MBOX_ACTIVE;
|
|
|
|
pmb = lpfc_mbox_get(phba);
|
|
|
|
spin_unlock(&phba->hbalock);
|
2007-06-17 17:56:39 -07:00
|
|
|
send_current_mbox:
|
2007-06-17 17:56:38 -07:00
|
|
|
/* Process next mailbox command if there is one */
|
|
|
|
if (pmb != NULL) {
|
|
|
|
rc = lpfc_sli_issue_mbox(phba, pmb, MBX_NOWAIT);
|
|
|
|
if (rc == MBX_NOT_FINISHED) {
|
|
|
|
pmb->mb.mbxStatus = MBX_NOT_FINISHED;
|
|
|
|
lpfc_mbox_cmpl_put(phba, pmb);
|
|
|
|
goto send_next_mbox;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2007-06-17 17:56:36 -07:00
|
|
|
spin_lock(&phba->hbalock);
|
2005-04-17 14:05:31 -07:00
|
|
|
phba->work_ha |= work_ha_copy;
|
|
|
|
if (phba->work_wait)
|
2007-06-17 17:56:38 -07:00
|
|
|
lpfc_worker_wake_up(phba);
|
2007-06-17 17:56:36 -07:00
|
|
|
spin_unlock(&phba->hbalock);
|
2005-04-17 14:05:31 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
ha_copy &= ~(phba->work_ha_mask);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Process all events on FCP ring. Take the optimized path for
|
|
|
|
* FCP IO. Any other IO is slow path and is handled by
|
|
|
|
* the worker thread.
|
|
|
|
*/
|
|
|
|
status = (ha_copy & (HA_RXMASK << (4*LPFC_FCP_RING)));
|
|
|
|
status >>= (4*LPFC_FCP_RING);
|
2007-06-17 17:56:39 -07:00
|
|
|
if (status & HA_RXMASK)
|
2005-04-17 14:05:31 -07:00
|
|
|
lpfc_sli_handle_fast_ring_event(phba,
|
|
|
|
&phba->sli.ring[LPFC_FCP_RING],
|
|
|
|
status);
|
2006-12-02 11:34:16 -07:00
|
|
|
|
|
|
|
if (phba->cfg_multi_ring_support == 2) {
|
|
|
|
/*
|
|
|
|
* Process all events on extra ring. Take the optimized path
|
|
|
|
* for extra ring IO. Any other IO is slow path and is handled
|
|
|
|
* by the worker thread.
|
|
|
|
*/
|
|
|
|
status = (ha_copy & (HA_RXMASK << (4*LPFC_EXTRA_RING)));
|
|
|
|
status >>= (4*LPFC_EXTRA_RING);
|
2007-06-17 17:56:39 -07:00
|
|
|
if (status & HA_RXMASK) {
|
2006-12-02 11:34:16 -07:00
|
|
|
lpfc_sli_handle_fast_ring_event(phba,
|
|
|
|
&phba->sli.ring[LPFC_EXTRA_RING],
|
|
|
|
status);
|
|
|
|
}
|
|
|
|
}
|
2005-04-17 14:05:31 -07:00
|
|
|
return IRQ_HANDLED;
|
|
|
|
|
|
|
|
} /* lpfc_intr_handler */
|