Commit 39f07a0a authored by Guennadi Liakhovetski's avatar Guennadi Liakhovetski Committed by James Bottomley

[PATCH] tmascsim: (resend updated) track_queue_full

Use scsi_track_queue_full(), don't lie about driver's queueing
abilities.
Signed-off-by: default avatarGuennadi Liakhovetski <g.liakhovetski@gmx.de>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
parent b0c5aed8
...@@ -526,21 +526,23 @@ dc390_StartSCSI( struct dc390_acb* pACB, struct dc390_dcb* pDCB, struct dc390_sr ...@@ -526,21 +526,23 @@ dc390_StartSCSI( struct dc390_acb* pACB, struct dc390_dcb* pDCB, struct dc390_sr
DC390_write8 (ScsiCmd, CLEAR_FIFO_CMD); /* Flush FIFO */ DC390_write8 (ScsiCmd, CLEAR_FIFO_CMD); /* Flush FIFO */
DEBUG1(printk (KERN_INFO "DC390: Start SCSI command: %02x (Sync:%02x)\n",\ DEBUG1(printk (KERN_INFO "DC390: Start SCSI command: %02x (Sync:%02x)\n",\
scmd->cmnd[0], pDCB->SyncMode)); scmd->cmnd[0], pDCB->SyncMode));
disc_allowed = pDCB->DevMode & EN_DISCONNECT_;
try_sync_nego = 0;
/* Don't disconnect on AUTO_REQSENSE, cause it might be an /* Don't disconnect on AUTO_REQSENSE, cause it might be an
* Contingent Allegiance Condition (6.6), where no tags should be used. * Contingent Allegiance Condition (6.6), where no tags should be used.
* All other have to be allowed to disconnect to prevent Incorrect * All other have to be allowed to disconnect to prevent Incorrect
* Initiator Connection (6.8.2/6.5.2) */ * Initiator Connection (6.8.2/6.5.2) */
/* Changed KG, 99/06/06 */ /* Changed KG, 99/06/06 */
if( /*(((pSRB->pcmd->cmnd[0] == INQUIRY) || (pSRB->pcmd->cmnd[0] == REQUEST_SENSE) || if (! (pSRB->SRBFlag & AUTO_REQSENSE))
* (pSRB->pcmd->cmnd[0] == TEST_UNIT_READY)) && pACB->scan_devices) disc_allowed = pDCB->DevMode & EN_DISCONNECT_;
||*/ (pSRB->SRBFlag & AUTO_REQSENSE) ) else
disc_allowed = 0; disc_allowed = 0;
if ( (pDCB->SyncMode & SYNC_ENABLE) && (pDCB->TargetLUN == 0) && sdev->sdtr &&
( ( ( (scmd->cmnd[0] == REQUEST_SENSE) || (pSRB->SRBFlag & AUTO_REQSENSE) ) if ((pDCB->SyncMode & SYNC_ENABLE) && pDCB->TargetLUN == 0 && sdev->sdtr &&
&& !(pDCB->SyncMode & SYNC_NEGO_DONE) ) || (scmd->cmnd[0] == INQUIRY) ) ) (((scmd->cmnd[0] == REQUEST_SENSE || (pSRB->SRBFlag & AUTO_REQSENSE)) &&
!(pDCB->SyncMode & SYNC_NEGO_DONE)) || scmd->cmnd[0] == INQUIRY))
try_sync_nego = 1; try_sync_nego = 1;
else
try_sync_nego = 0;
pSRB->MsgCnt = 0; pSRB->MsgCnt = 0;
cmd = SEL_W_ATN; cmd = SEL_W_ATN;
...@@ -548,7 +550,7 @@ dc390_StartSCSI( struct dc390_acb* pACB, struct dc390_dcb* pDCB, struct dc390_sr ...@@ -548,7 +550,7 @@ dc390_StartSCSI( struct dc390_acb* pACB, struct dc390_dcb* pDCB, struct dc390_sr
/* Change 99/05/31: Don't use tags when not disconnecting (BUSY) */ /* Change 99/05/31: Don't use tags when not disconnecting (BUSY) */
if ((pDCB->SyncMode & EN_TAG_QUEUEING) && disc_allowed && scsi_populate_tag_msg(scmd, tag)) { if ((pDCB->SyncMode & EN_TAG_QUEUEING) && disc_allowed && scsi_populate_tag_msg(scmd, tag)) {
DC390_write8(ScsiFifo, tag[0]); DC390_write8(ScsiFifo, tag[0]);
pDCB->TagMask |= (1 << tag[1]); pDCB->TagMask |= 1 << tag[1];
pSRB->TagNumber = tag[1]; pSRB->TagNumber = tag[1];
DC390_write8(ScsiFifo, tag[1]); DC390_write8(ScsiFifo, tag[1]);
DEBUG1(printk(KERN_INFO "DC390: Select w/DisCn for Cmd %li (SRB %p), block tag %02x\n", scmd->pid, pSRB, tag[1])); DEBUG1(printk(KERN_INFO "DC390: Select w/DisCn for Cmd %li (SRB %p), block tag %02x\n", scmd->pid, pSRB, tag[1]));
...@@ -556,7 +558,7 @@ dc390_StartSCSI( struct dc390_acb* pACB, struct dc390_dcb* pDCB, struct dc390_sr ...@@ -556,7 +558,7 @@ dc390_StartSCSI( struct dc390_acb* pACB, struct dc390_dcb* pDCB, struct dc390_sr
} else { } else {
/* No TagQ */ /* No TagQ */
//no_tag: //no_tag:
DEBUG1(printk(KERN_INFO "DC390: Select w%s/DisCn for Cmd %li (SRB %p), No TagQ\n", (disc_allowed ? "" : "o"), scmd->pid, pSRB)); DEBUG1(printk(KERN_INFO "DC390: Select w%s/DisCn for Cmd %li (SRB %p), No TagQ\n", disc_allowed ? "" : "o", scmd->pid, pSRB));
} }
pSRB->SRBState = SRB_START_; pSRB->SRBState = SRB_START_;
...@@ -1461,14 +1463,13 @@ dc390_CommandPhase( struct dc390_acb* pACB, struct dc390_srb* pSRB, u8 *psstatus ...@@ -1461,14 +1463,13 @@ dc390_CommandPhase( struct dc390_acb* pACB, struct dc390_srb* pSRB, u8 *psstatus
} }
else else
{ {
u8 bval = 0;
DC390_write8 (ScsiFifo, REQUEST_SENSE); DC390_write8 (ScsiFifo, REQUEST_SENSE);
pDCB = pACB->pActiveDCB; pDCB = pACB->pActiveDCB;
DC390_write8 (ScsiFifo, pDCB->TargetLUN << 5); DC390_write8 (ScsiFifo, pDCB->TargetLUN << 5);
DC390_write8 (ScsiFifo, bval); DC390_write8 (ScsiFifo, 0);
DC390_write8 (ScsiFifo, bval); DC390_write8 (ScsiFifo, 0);
DC390_write8 (ScsiFifo, sizeof(pSRB->pcmd->sense_buffer)); DC390_write8 (ScsiFifo, sizeof(pSRB->pcmd->sense_buffer));
DC390_write8 (ScsiFifo, bval); DC390_write8 (ScsiFifo, 0);
DEBUG0(printk(KERN_DEBUG "DC390: AutoReqSense (CmndPhase)!\n")); DEBUG0(printk(KERN_DEBUG "DC390: AutoReqSense (CmndPhase)!\n"));
} }
pSRB->SRBState = SRB_COMMAND; pSRB->SRBState = SRB_COMMAND;
...@@ -1773,7 +1774,7 @@ dc390_RequestSense(struct dc390_acb* pACB, struct dc390_dcb* pDCB, struct dc390_ ...@@ -1773,7 +1774,7 @@ dc390_RequestSense(struct dc390_acb* pACB, struct dc390_dcb* pDCB, struct dc390_
static void static void
dc390_SRBdone( struct dc390_acb* pACB, struct dc390_dcb* pDCB, struct dc390_srb* pSRB ) dc390_SRBdone( struct dc390_acb* pACB, struct dc390_dcb* pDCB, struct dc390_srb* pSRB )
{ {
u8 bval, status; u8 status;
struct scsi_cmnd *pcmd; struct scsi_cmnd *pcmd;
pcmd = pSRB->pcmd; pcmd = pSRB->pcmd;
...@@ -1824,9 +1825,7 @@ dc390_SRBdone( struct dc390_acb* pACB, struct dc390_dcb* pDCB, struct dc390_srb* ...@@ -1824,9 +1825,7 @@ dc390_SRBdone( struct dc390_acb* pACB, struct dc390_dcb* pDCB, struct dc390_srb*
} }
else if( status_byte(status) == QUEUE_FULL ) else if( status_byte(status) == QUEUE_FULL )
{ {
bval = (u8) pDCB->GoingSRBCnt; scsi_track_queue_full(pcmd->device, pDCB->GoingSRBCnt - 1);
bval--;
pDCB->MaxCommand = bval;
pcmd->use_sg = pSRB->SavedSGCount; pcmd->use_sg = pSRB->SavedSGCount;
DEBUG0 (printk ("DC390: RETRY pid %li (%02x), target %02i-%02i\n", pcmd->pid, pcmd->cmnd[0], pcmd->device->id, pcmd->device->lun)); DEBUG0 (printk ("DC390: RETRY pid %li (%02x), target %02i-%02i\n", pcmd->pid, pcmd->cmnd[0], pcmd->device->id, pcmd->device->lun));
pSRB->TotalXferredLen = 0; pSRB->TotalXferredLen = 0;
...@@ -1974,7 +1973,7 @@ static int DC390_queuecommand(struct scsi_cmnd *cmd, ...@@ -1974,7 +1973,7 @@ static int DC390_queuecommand(struct scsi_cmnd *cmd,
struct dc390_dcb *dcb = sdev->hostdata; struct dc390_dcb *dcb = sdev->hostdata;
struct dc390_srb *srb; struct dc390_srb *srb;
if (dcb->MaxCommand <= dcb->GoingSRBCnt) if (sdev->queue_depth <= dcb->GoingSRBCnt)
goto device_busy; goto device_busy;
if (acb->pActiveDCB) if (acb->pActiveDCB)
goto host_busy; goto host_busy;
...@@ -2177,7 +2176,6 @@ static int dc390_slave_alloc(struct scsi_device *scsi_device) ...@@ -2177,7 +2176,6 @@ static int dc390_slave_alloc(struct scsi_device *scsi_device)
pDCB->pDCBACB = pACB; pDCB->pDCBACB = pACB;
pDCB->TargetID = id; pDCB->TargetID = id;
pDCB->TargetLUN = lun; pDCB->TargetLUN = lun;
pDCB->MaxCommand = 1;
/* /*
* Some values are for all LUNs: Copy them * Some values are for all LUNs: Copy them
...@@ -2270,8 +2268,7 @@ static int dc390_slave_configure(struct scsi_device *sdev) ...@@ -2270,8 +2268,7 @@ static int dc390_slave_configure(struct scsi_device *sdev)
acb->scan_devices = 0; acb->scan_devices = 0;
if (sdev->tagged_supported && (dcb->DevMode & TAG_QUEUEING_)) { if (sdev->tagged_supported && (dcb->DevMode & TAG_QUEUEING_)) {
dcb->SyncMode |= EN_TAG_QUEUEING; dcb->SyncMode |= EN_TAG_QUEUEING;
dcb->MaxCommand = dcb->pDCBACB->TagMaxNum; scsi_activate_tcq(sdev, acb->TagMaxNum);
scsi_activate_tcq(sdev, dcb->MaxCommand);
} }
return 0; return 0;
...@@ -2287,10 +2284,10 @@ static struct scsi_host_template driver_template = { ...@@ -2287,10 +2284,10 @@ static struct scsi_host_template driver_template = {
.queuecommand = DC390_queuecommand, .queuecommand = DC390_queuecommand,
.eh_abort_handler = DC390_abort, .eh_abort_handler = DC390_abort,
.eh_bus_reset_handler = DC390_bus_reset, .eh_bus_reset_handler = DC390_bus_reset,
.can_queue = 42, .can_queue = 1,
.this_id = 7, .this_id = 7,
.sg_tablesize = SG_ALL, .sg_tablesize = SG_ALL,
.cmd_per_lun = 16, .cmd_per_lun = 1,
.use_clustering = DISABLE_CLUSTERING, .use_clustering = DISABLE_CLUSTERING,
}; };
...@@ -2583,8 +2580,6 @@ static int __devinit dc390_probe_one(struct pci_dev *pdev, ...@@ -2583,8 +2580,6 @@ static int __devinit dc390_probe_one(struct pci_dev *pdev,
io_port = pci_resource_start(pdev, 0); io_port = pci_resource_start(pdev, 0);
shost->can_queue = MAX_CMD_QUEUE;
shost->cmd_per_lun = MAX_CMD_PER_LUN;
shost->this_id = dc390_eepromBuf[dc390_adapterCnt][EE_ADAPT_SCSI_ID]; shost->this_id = dc390_eepromBuf[dc390_adapterCnt][EE_ADAPT_SCSI_ID];
shost->io_port = io_port; shost->io_port = io_port;
shost->n_io_port = 0x80; shost->n_io_port = 0x80;
......
...@@ -15,10 +15,8 @@ ...@@ -15,10 +15,8 @@
#define MAX_ADAPTER_NUM 4 #define MAX_ADAPTER_NUM 4
#define MAX_SG_LIST_BUF 16 /* Not used */ #define MAX_SG_LIST_BUF 16 /* Not used */
#define MAX_CMD_PER_LUN 32
#define MAX_CMD_QUEUE MAX_CMD_PER_LUN+MAX_CMD_PER_LUN/2+1
#define MAX_SCSI_ID 8 #define MAX_SCSI_ID 8
#define MAX_SRB_CNT MAX_CMD_QUEUE+1 /* Max number of started commands */ #define MAX_SRB_CNT 50 /* Max number of started commands */
#define SEL_TIMEOUT 153 /* 250 ms selection timeout (@ 40 MHz) */ #define SEL_TIMEOUT 153 /* 250 ms selection timeout (@ 40 MHz) */
...@@ -91,8 +89,6 @@ struct dc390_srb *pGoingLast; ...@@ -91,8 +89,6 @@ struct dc390_srb *pGoingLast;
struct dc390_srb *pActiveSRB; struct dc390_srb *pActiveSRB;
u8 GoingSRBCnt; u8 GoingSRBCnt;
u8 MaxCommand;
u32 TagMask; u32 TagMask;
u8 TargetID; /*; SCSI Target ID (SCSI Only) */ u8 TargetID; /*; SCSI Target ID (SCSI Only) */
......
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