[SCSI] qla2xxx: Determine the number of outstanding commands based on available resou...
[linux-2.6-microblaze.git] / drivers / scsi / qla2xxx / qla_iocb.c
index a481684..6055d96 100644 (file)
@@ -349,14 +349,14 @@ qla2x00_start_scsi(srb_t *sp)
 
        /* Check for room in outstanding command list. */
        handle = req->current_outstanding_cmd;
-       for (index = 1; index < MAX_OUTSTANDING_COMMANDS; index++) {
+       for (index = 1; index < req->num_outstanding_cmds; index++) {
                handle++;
-               if (handle == MAX_OUTSTANDING_COMMANDS)
+               if (handle == req->num_outstanding_cmds)
                        handle = 1;
                if (!req->outstanding_cmds[handle])
                        break;
        }
-       if (index == MAX_OUTSTANDING_COMMANDS)
+       if (index == req->num_outstanding_cmds)
                goto queuing_error;
 
        /* Map the sg table so we have an accurate count of sg entries needed */
@@ -1467,16 +1467,15 @@ qla24xx_start_scsi(srb_t *sp)
 
        /* Check for room in outstanding command list. */
        handle = req->current_outstanding_cmd;
-       for (index = 1; index < MAX_OUTSTANDING_COMMANDS; index++) {
+       for (index = 1; index < req->num_outstanding_cmds; index++) {
                handle++;
-               if (handle == MAX_OUTSTANDING_COMMANDS)
+               if (handle == req->num_outstanding_cmds)
                        handle = 1;
                if (!req->outstanding_cmds[handle])
                        break;
        }
-       if (index == MAX_OUTSTANDING_COMMANDS) {
+       if (index == req->num_outstanding_cmds)
                goto queuing_error;
-       }
 
        /* Map the sg table so we have an accurate count of sg entries needed */
        if (scsi_sg_count(cmd)) {
@@ -1641,15 +1640,15 @@ qla24xx_dif_start_scsi(srb_t *sp)
 
        /* Check for room in outstanding command list. */
        handle = req->current_outstanding_cmd;
-       for (index = 1; index < MAX_OUTSTANDING_COMMANDS; index++) {
+       for (index = 1; index < req->num_outstanding_cmds; index++) {
                handle++;
-               if (handle == MAX_OUTSTANDING_COMMANDS)
+               if (handle == req->num_outstanding_cmds)
                        handle = 1;
                if (!req->outstanding_cmds[handle])
                        break;
        }
 
-       if (index == MAX_OUTSTANDING_COMMANDS)
+       if (index == req->num_outstanding_cmds)
                goto queuing_error;
 
        /* Compute number of required data segments */
@@ -1822,14 +1821,14 @@ qla2x00_alloc_iocbs(scsi_qla_host_t *vha, srb_t *sp)
 
        /* Check for room in outstanding command list. */
        handle = req->current_outstanding_cmd;
-       for (index = 1; index < MAX_OUTSTANDING_COMMANDS; index++) {
+       for (index = 1; req->num_outstanding_cmds; index++) {
                handle++;
-               if (handle == MAX_OUTSTANDING_COMMANDS)
+               if (handle == req->num_outstanding_cmds)
                        handle = 1;
                if (!req->outstanding_cmds[handle])
                        break;
        }
-       if (index == MAX_OUTSTANDING_COMMANDS) {
+       if (index == req->num_outstanding_cmds) {
                ql_log(ql_log_warn, vha, 0x700b,
                    "No room on outstanding cmd array.\n");
                goto queuing_error;
@@ -2263,14 +2262,14 @@ qla82xx_start_scsi(srb_t *sp)
 
        /* Check for room in outstanding command list. */
        handle = req->current_outstanding_cmd;
-       for (index = 1; index < MAX_OUTSTANDING_COMMANDS; index++) {
+       for (index = 1; index < req->num_outstanding_cmds; index++) {
                handle++;
-               if (handle == MAX_OUTSTANDING_COMMANDS)
+               if (handle == req->num_outstanding_cmds)
                        handle = 1;
                if (!req->outstanding_cmds[handle])
                        break;
        }
-       if (index == MAX_OUTSTANDING_COMMANDS)
+       if (index == req->num_outstanding_cmds)
                goto queuing_error;
 
        /* Map the sg table so we have an accurate count of sg entries needed */
@@ -2767,15 +2766,15 @@ qla2x00_start_bidir(srb_t *sp, struct scsi_qla_host *vha, uint32_t tot_dsds)
 
        /* Check for room in outstanding command list. */
        handle = req->current_outstanding_cmd;
-       for (index = 1; index < MAX_OUTSTANDING_COMMANDS; index++) {
+       for (index = 1; index < req->num_outstanding_cmds; index++) {
                handle++;
-       if (handle == MAX_OUTSTANDING_COMMANDS)
+       if (handle == req->num_outstanding_cmds)
                handle = 1;
        if (!req->outstanding_cmds[handle])
                break;
        }
 
-       if (index == MAX_OUTSTANDING_COMMANDS) {
+       if (index == req->num_outstanding_cmds) {
                rval = EXT_STATUS_BUSY;
                goto queuing_error;
        }