mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-29 23:53:32 +00:00
[SCSI] qla4xxx: Remove hiwat code so scsi eh does not get escalated when we can make progress
Removed unnecessary hiwat code to free up the number available IOCBs. Eliminates unnecessary eh_ escalations due to inability to obtain IOCB pkt for marker. v2. - Remove define not used anymore and fix req_q_coun accounting. Signed-off-by: Karen Higgins <karen.higgins@qlogic.com> [michaelc: ported patch from qlogic.com driver to upstream] Signed-off-by: Mike Christie <michaelc@cs.wisc.edu> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
This commit is contained in:
parent
612f734887
commit
16ed55f9de
3 changed files with 60 additions and 85 deletions
|
@ -100,7 +100,6 @@
|
||||||
#define MAX_SRBS MAX_CMDS_TO_RISC
|
#define MAX_SRBS MAX_CMDS_TO_RISC
|
||||||
#define MBOX_AEN_REG_COUNT 5
|
#define MBOX_AEN_REG_COUNT 5
|
||||||
#define MAX_INIT_RETRIES 5
|
#define MAX_INIT_RETRIES 5
|
||||||
#define IOCB_HIWAT_CUSHION 16
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Buffer sizes
|
* Buffer sizes
|
||||||
|
@ -307,7 +306,6 @@ struct scsi_qla_host {
|
||||||
uint32_t tot_ddbs;
|
uint32_t tot_ddbs;
|
||||||
|
|
||||||
uint16_t iocb_cnt;
|
uint16_t iocb_cnt;
|
||||||
uint16_t iocb_hiwat;
|
|
||||||
|
|
||||||
/* SRB cache. */
|
/* SRB cache. */
|
||||||
#define SRB_MIN_REQ 128
|
#define SRB_MIN_REQ 128
|
||||||
|
|
|
@ -10,9 +10,42 @@
|
||||||
#include "ql4_dbg.h"
|
#include "ql4_dbg.h"
|
||||||
#include "ql4_inline.h"
|
#include "ql4_inline.h"
|
||||||
|
|
||||||
|
|
||||||
#include <scsi/scsi_tcq.h>
|
#include <scsi/scsi_tcq.h>
|
||||||
|
|
||||||
|
static int
|
||||||
|
qla4xxx_space_in_req_ring(struct scsi_qla_host *ha, uint16_t req_cnt)
|
||||||
|
{
|
||||||
|
uint16_t cnt;
|
||||||
|
|
||||||
|
/* Calculate number of free request entries. */
|
||||||
|
if ((req_cnt + 2) >= ha->req_q_count) {
|
||||||
|
cnt = (uint16_t) le32_to_cpu(ha->shadow_regs->req_q_out);
|
||||||
|
if (ha->request_in < cnt)
|
||||||
|
ha->req_q_count = cnt - ha->request_in;
|
||||||
|
else
|
||||||
|
ha->req_q_count = REQUEST_QUEUE_DEPTH -
|
||||||
|
(ha->request_in - cnt);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check if room for request in request ring. */
|
||||||
|
if ((req_cnt + 2) < ha->req_q_count)
|
||||||
|
return 1;
|
||||||
|
else
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void qla4xxx_advance_req_ring_ptr(struct scsi_qla_host *ha)
|
||||||
|
{
|
||||||
|
/* Advance request queue pointer */
|
||||||
|
if (ha->request_in == (REQUEST_QUEUE_DEPTH - 1)) {
|
||||||
|
ha->request_in = 0;
|
||||||
|
ha->request_ptr = ha->request_ring;
|
||||||
|
} else {
|
||||||
|
ha->request_in++;
|
||||||
|
ha->request_ptr++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* qla4xxx_get_req_pkt - returns a valid entry in request queue.
|
* qla4xxx_get_req_pkt - returns a valid entry in request queue.
|
||||||
* @ha: Pointer to host adapter structure.
|
* @ha: Pointer to host adapter structure.
|
||||||
|
@ -26,35 +59,18 @@
|
||||||
static int qla4xxx_get_req_pkt(struct scsi_qla_host *ha,
|
static int qla4xxx_get_req_pkt(struct scsi_qla_host *ha,
|
||||||
struct queue_entry **queue_entry)
|
struct queue_entry **queue_entry)
|
||||||
{
|
{
|
||||||
uint16_t request_in;
|
uint16_t req_cnt = 1;
|
||||||
uint8_t status = QLA_SUCCESS;
|
|
||||||
|
|
||||||
*queue_entry = ha->request_ptr;
|
if (qla4xxx_space_in_req_ring(ha, req_cnt)) {
|
||||||
|
*queue_entry = ha->request_ptr;
|
||||||
/* get the latest request_in and request_out index */
|
|
||||||
request_in = ha->request_in;
|
|
||||||
ha->request_out = (uint16_t) le32_to_cpu(ha->shadow_regs->req_q_out);
|
|
||||||
|
|
||||||
/* Advance request queue pointer and check for queue full */
|
|
||||||
if (request_in == (REQUEST_QUEUE_DEPTH - 1)) {
|
|
||||||
request_in = 0;
|
|
||||||
ha->request_ptr = ha->request_ring;
|
|
||||||
} else {
|
|
||||||
request_in++;
|
|
||||||
ha->request_ptr++;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* request queue is full, try again later */
|
|
||||||
if ((ha->iocb_cnt + 1) >= ha->iocb_hiwat) {
|
|
||||||
/* restore request pointer */
|
|
||||||
ha->request_ptr = *queue_entry;
|
|
||||||
status = QLA_ERROR;
|
|
||||||
} else {
|
|
||||||
ha->request_in = request_in;
|
|
||||||
memset(*queue_entry, 0, sizeof(**queue_entry));
|
memset(*queue_entry, 0, sizeof(**queue_entry));
|
||||||
|
|
||||||
|
qla4xxx_advance_req_ring_ptr(ha);
|
||||||
|
ha->req_q_count -= req_cnt;
|
||||||
|
return QLA_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
return status;
|
return QLA_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -100,21 +116,14 @@ int qla4xxx_send_marker_iocb(struct scsi_qla_host *ha,
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct continuation_t1_entry* qla4xxx_alloc_cont_entry(
|
static struct continuation_t1_entry *
|
||||||
struct scsi_qla_host *ha)
|
qla4xxx_alloc_cont_entry(struct scsi_qla_host *ha)
|
||||||
{
|
{
|
||||||
struct continuation_t1_entry *cont_entry;
|
struct continuation_t1_entry *cont_entry;
|
||||||
|
|
||||||
cont_entry = (struct continuation_t1_entry *)ha->request_ptr;
|
cont_entry = (struct continuation_t1_entry *)ha->request_ptr;
|
||||||
|
|
||||||
/* Advance request queue pointer */
|
qla4xxx_advance_req_ring_ptr(ha);
|
||||||
if (ha->request_in == (REQUEST_QUEUE_DEPTH - 1)) {
|
|
||||||
ha->request_in = 0;
|
|
||||||
ha->request_ptr = ha->request_ring;
|
|
||||||
} else {
|
|
||||||
ha->request_in++;
|
|
||||||
ha->request_ptr++;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Load packet defaults */
|
/* Load packet defaults */
|
||||||
cont_entry->hdr.entryType = ET_CONTINUE;
|
cont_entry->hdr.entryType = ET_CONTINUE;
|
||||||
|
@ -197,13 +206,10 @@ int qla4xxx_send_command_to_isp(struct scsi_qla_host *ha, struct srb * srb)
|
||||||
struct scsi_cmnd *cmd = srb->cmd;
|
struct scsi_cmnd *cmd = srb->cmd;
|
||||||
struct ddb_entry *ddb_entry;
|
struct ddb_entry *ddb_entry;
|
||||||
struct command_t3_entry *cmd_entry;
|
struct command_t3_entry *cmd_entry;
|
||||||
|
|
||||||
int nseg;
|
int nseg;
|
||||||
uint16_t tot_dsds;
|
uint16_t tot_dsds;
|
||||||
uint16_t req_cnt;
|
uint16_t req_cnt;
|
||||||
|
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
uint16_t cnt;
|
|
||||||
uint32_t index;
|
uint32_t index;
|
||||||
char tag[2];
|
char tag[2];
|
||||||
|
|
||||||
|
@ -217,6 +223,19 @@ int qla4xxx_send_command_to_isp(struct scsi_qla_host *ha, struct srb * srb)
|
||||||
|
|
||||||
index = (uint32_t)cmd->request->tag;
|
index = (uint32_t)cmd->request->tag;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check to see if adapter is online before placing request on
|
||||||
|
* request queue. If a reset occurs and a request is in the queue,
|
||||||
|
* the firmware will still attempt to process the request, retrieving
|
||||||
|
* garbage for pointers.
|
||||||
|
*/
|
||||||
|
if (!test_bit(AF_ONLINE, &ha->flags)) {
|
||||||
|
DEBUG2(printk("scsi%ld: %s: Adapter OFFLINE! "
|
||||||
|
"Do not issue command.\n",
|
||||||
|
ha->host_no, __func__));
|
||||||
|
goto queuing_error;
|
||||||
|
}
|
||||||
|
|
||||||
/* Calculate the number of request entries needed. */
|
/* Calculate the number of request entries needed. */
|
||||||
nseg = scsi_dma_map(cmd);
|
nseg = scsi_dma_map(cmd);
|
||||||
if (nseg < 0)
|
if (nseg < 0)
|
||||||
|
@ -224,17 +243,7 @@ int qla4xxx_send_command_to_isp(struct scsi_qla_host *ha, struct srb * srb)
|
||||||
tot_dsds = nseg;
|
tot_dsds = nseg;
|
||||||
|
|
||||||
req_cnt = qla4xxx_calc_request_entries(tot_dsds);
|
req_cnt = qla4xxx_calc_request_entries(tot_dsds);
|
||||||
|
if (!qla4xxx_space_in_req_ring(ha, req_cnt))
|
||||||
if (ha->req_q_count < (req_cnt + 2)) {
|
|
||||||
cnt = (uint16_t) le32_to_cpu(ha->shadow_regs->req_q_out);
|
|
||||||
if (ha->request_in < cnt)
|
|
||||||
ha->req_q_count = cnt - ha->request_in;
|
|
||||||
else
|
|
||||||
ha->req_q_count = REQUEST_QUEUE_DEPTH -
|
|
||||||
(ha->request_in - cnt);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ha->req_q_count < (req_cnt + 2))
|
|
||||||
goto queuing_error;
|
goto queuing_error;
|
||||||
|
|
||||||
/* total iocbs active */
|
/* total iocbs active */
|
||||||
|
@ -286,32 +295,10 @@ int qla4xxx_send_command_to_isp(struct scsi_qla_host *ha, struct srb * srb)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
qla4xxx_advance_req_ring_ptr(ha);
|
||||||
/* Advance request queue pointer */
|
|
||||||
ha->request_in++;
|
|
||||||
if (ha->request_in == REQUEST_QUEUE_DEPTH) {
|
|
||||||
ha->request_in = 0;
|
|
||||||
ha->request_ptr = ha->request_ring;
|
|
||||||
} else
|
|
||||||
ha->request_ptr++;
|
|
||||||
|
|
||||||
|
|
||||||
qla4xxx_build_scsi_iocbs(srb, cmd_entry, tot_dsds);
|
qla4xxx_build_scsi_iocbs(srb, cmd_entry, tot_dsds);
|
||||||
wmb();
|
wmb();
|
||||||
|
|
||||||
/*
|
|
||||||
* Check to see if adapter is online before placing request on
|
|
||||||
* request queue. If a reset occurs and a request is in the queue,
|
|
||||||
* the firmware will still attempt to process the request, retrieving
|
|
||||||
* garbage for pointers.
|
|
||||||
*/
|
|
||||||
if (!test_bit(AF_ONLINE, &ha->flags)) {
|
|
||||||
DEBUG2(printk("scsi%ld: %s: Adapter OFFLINE! "
|
|
||||||
"Do not issue command.\n",
|
|
||||||
ha->host_no, __func__));
|
|
||||||
goto queuing_error;
|
|
||||||
}
|
|
||||||
|
|
||||||
srb->cmd->host_scribble = (unsigned char *)srb;
|
srb->cmd->host_scribble = (unsigned char *)srb;
|
||||||
|
|
||||||
/* update counters */
|
/* update counters */
|
||||||
|
|
|
@ -385,16 +385,6 @@ int qla4xxx_get_firmware_status(struct scsi_qla_host * ha)
|
||||||
mbox_sts[0]));
|
mbox_sts[0]));
|
||||||
return QLA_ERROR;
|
return QLA_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* High-water mark of IOCBs */
|
|
||||||
ha->iocb_hiwat = mbox_sts[2];
|
|
||||||
if (ha->iocb_hiwat > IOCB_HIWAT_CUSHION)
|
|
||||||
ha->iocb_hiwat -= IOCB_HIWAT_CUSHION;
|
|
||||||
else
|
|
||||||
dev_info(&ha->pdev->dev, "WARNING!!! You have less than %d "
|
|
||||||
"firmware IOCBs available (%d).\n",
|
|
||||||
IOCB_HIWAT_CUSHION, ha->iocb_hiwat);
|
|
||||||
|
|
||||||
return QLA_SUCCESS;
|
return QLA_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue