Commit 1bc5ad3a authored by Manish Rangankar's avatar Manish Rangankar Committed by Martin K. Petersen

scsi: qla4xxx: skip error recovery in case of register disconnect.

A system crashes when continuously removing/re-adding the storage
controller.
Signed-off-by: default avatarManish Rangankar <manish.rangankar@cavium.com>
Reviewed-by: default avatarEwan D. Milne <emilne@redhat.com>
Reviewed-by: default avatarTomas Henzl <thenzl@redhat.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 00c20cdc
...@@ -168,6 +168,8 @@ ...@@ -168,6 +168,8 @@
#define DEV_DB_NON_PERSISTENT 0 #define DEV_DB_NON_PERSISTENT 0
#define DEV_DB_PERSISTENT 1 #define DEV_DB_PERSISTENT 1
#define QL4_ISP_REG_DISCONNECT 0xffffffffU
#define COPY_ISID(dst_isid, src_isid) { \ #define COPY_ISID(dst_isid, src_isid) { \
int i, j; \ int i, j; \
for (i = 0, j = ISID_SIZE - 1; i < ISID_SIZE;) \ for (i = 0, j = ISID_SIZE - 1; i < ISID_SIZE;) \
......
...@@ -262,6 +262,24 @@ static struct iscsi_transport qla4xxx_iscsi_transport = { ...@@ -262,6 +262,24 @@ static struct iscsi_transport qla4xxx_iscsi_transport = {
static struct scsi_transport_template *qla4xxx_scsi_transport; static struct scsi_transport_template *qla4xxx_scsi_transport;
static int qla4xxx_isp_check_reg(struct scsi_qla_host *ha)
{
u32 reg_val = 0;
int rval = QLA_SUCCESS;
if (is_qla8022(ha))
reg_val = readl(&ha->qla4_82xx_reg->host_status);
else if (is_qla8032(ha) || is_qla8042(ha))
reg_val = qla4_8xxx_rd_direct(ha, QLA8XXX_PEG_ALIVE_COUNTER);
else
reg_val = readw(&ha->reg->ctrl_status);
if (reg_val == QL4_ISP_REG_DISCONNECT)
rval = QLA_ERROR;
return rval;
}
static int qla4xxx_send_ping(struct Scsi_Host *shost, uint32_t iface_num, static int qla4xxx_send_ping(struct Scsi_Host *shost, uint32_t iface_num,
uint32_t iface_type, uint32_t payload_size, uint32_t iface_type, uint32_t payload_size,
uint32_t pid, struct sockaddr *dst_addr) uint32_t pid, struct sockaddr *dst_addr)
...@@ -9186,10 +9204,17 @@ static int qla4xxx_eh_abort(struct scsi_cmnd *cmd) ...@@ -9186,10 +9204,17 @@ static int qla4xxx_eh_abort(struct scsi_cmnd *cmd)
struct srb *srb = NULL; struct srb *srb = NULL;
int ret = SUCCESS; int ret = SUCCESS;
int wait = 0; int wait = 0;
int rval;
ql4_printk(KERN_INFO, ha, "scsi%ld:%d:%llu: Abort command issued cmd=%p, cdb=0x%x\n", ql4_printk(KERN_INFO, ha, "scsi%ld:%d:%llu: Abort command issued cmd=%p, cdb=0x%x\n",
ha->host_no, id, lun, cmd, cmd->cmnd[0]); ha->host_no, id, lun, cmd, cmd->cmnd[0]);
rval = qla4xxx_isp_check_reg(ha);
if (rval != QLA_SUCCESS) {
ql4_printk(KERN_INFO, ha, "PCI/Register disconnect, exiting.\n");
return FAILED;
}
spin_lock_irqsave(&ha->hardware_lock, flags); spin_lock_irqsave(&ha->hardware_lock, flags);
srb = (struct srb *) CMD_SP(cmd); srb = (struct srb *) CMD_SP(cmd);
if (!srb) { if (!srb) {
...@@ -9241,6 +9266,7 @@ static int qla4xxx_eh_device_reset(struct scsi_cmnd *cmd) ...@@ -9241,6 +9266,7 @@ static int qla4xxx_eh_device_reset(struct scsi_cmnd *cmd)
struct scsi_qla_host *ha = to_qla_host(cmd->device->host); struct scsi_qla_host *ha = to_qla_host(cmd->device->host);
struct ddb_entry *ddb_entry = cmd->device->hostdata; struct ddb_entry *ddb_entry = cmd->device->hostdata;
int ret = FAILED, stat; int ret = FAILED, stat;
int rval;
if (!ddb_entry) if (!ddb_entry)
return ret; return ret;
...@@ -9260,6 +9286,12 @@ static int qla4xxx_eh_device_reset(struct scsi_cmnd *cmd) ...@@ -9260,6 +9286,12 @@ static int qla4xxx_eh_device_reset(struct scsi_cmnd *cmd)
cmd, jiffies, cmd->request->timeout / HZ, cmd, jiffies, cmd->request->timeout / HZ,
ha->dpc_flags, cmd->result, cmd->allowed)); ha->dpc_flags, cmd->result, cmd->allowed));
rval = qla4xxx_isp_check_reg(ha);
if (rval != QLA_SUCCESS) {
ql4_printk(KERN_INFO, ha, "PCI/Register disconnect, exiting.\n");
return FAILED;
}
/* FIXME: wait for hba to go online */ /* FIXME: wait for hba to go online */
stat = qla4xxx_reset_lun(ha, ddb_entry, cmd->device->lun); stat = qla4xxx_reset_lun(ha, ddb_entry, cmd->device->lun);
if (stat != QLA_SUCCESS) { if (stat != QLA_SUCCESS) {
...@@ -9303,6 +9335,7 @@ static int qla4xxx_eh_target_reset(struct scsi_cmnd *cmd) ...@@ -9303,6 +9335,7 @@ static int qla4xxx_eh_target_reset(struct scsi_cmnd *cmd)
struct scsi_qla_host *ha = to_qla_host(cmd->device->host); struct scsi_qla_host *ha = to_qla_host(cmd->device->host);
struct ddb_entry *ddb_entry = cmd->device->hostdata; struct ddb_entry *ddb_entry = cmd->device->hostdata;
int stat, ret; int stat, ret;
int rval;
if (!ddb_entry) if (!ddb_entry)
return FAILED; return FAILED;
...@@ -9320,6 +9353,12 @@ static int qla4xxx_eh_target_reset(struct scsi_cmnd *cmd) ...@@ -9320,6 +9353,12 @@ static int qla4xxx_eh_target_reset(struct scsi_cmnd *cmd)
ha->host_no, cmd, jiffies, cmd->request->timeout / HZ, ha->host_no, cmd, jiffies, cmd->request->timeout / HZ,
ha->dpc_flags, cmd->result, cmd->allowed)); ha->dpc_flags, cmd->result, cmd->allowed));
rval = qla4xxx_isp_check_reg(ha);
if (rval != QLA_SUCCESS) {
ql4_printk(KERN_INFO, ha, "PCI/Register disconnect, exiting.\n");
return FAILED;
}
stat = qla4xxx_reset_target(ha, ddb_entry); stat = qla4xxx_reset_target(ha, ddb_entry);
if (stat != QLA_SUCCESS) { if (stat != QLA_SUCCESS) {
starget_printk(KERN_INFO, scsi_target(cmd->device), starget_printk(KERN_INFO, scsi_target(cmd->device),
...@@ -9374,9 +9413,16 @@ static int qla4xxx_eh_host_reset(struct scsi_cmnd *cmd) ...@@ -9374,9 +9413,16 @@ static int qla4xxx_eh_host_reset(struct scsi_cmnd *cmd)
{ {
int return_status = FAILED; int return_status = FAILED;
struct scsi_qla_host *ha; struct scsi_qla_host *ha;
int rval;
ha = to_qla_host(cmd->device->host); ha = to_qla_host(cmd->device->host);
rval = qla4xxx_isp_check_reg(ha);
if (rval != QLA_SUCCESS) {
ql4_printk(KERN_INFO, ha, "PCI/Register disconnect, exiting.\n");
return FAILED;
}
if ((is_qla8032(ha) || is_qla8042(ha)) && ql4xdontresethba) if ((is_qla8032(ha) || is_qla8042(ha)) && ql4xdontresethba)
qla4_83xx_set_idc_dontreset(ha); qla4_83xx_set_idc_dontreset(ha);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment