[SCSI] aic7xxx: remove the completeq

This should finish the spurious queue removal from aic7xxx (there are
other queues that are probably unnecessary, but at least the major and
obviously unnecessary ones are done with).

Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>

authored by James Bottomley and committed by James Bottomley 8e45ebcc 38c29ce0

+5 -133
+2 -119
drivers/scsi/aic7xxx/aic7xxx_osm.c
··· 433 433 static void ahc_linux_dev_timed_unfreeze(u_long arg); 434 434 static int ahc_linux_queue_recovery_cmd(struct scsi_cmnd *cmd, scb_flag flag); 435 435 static void ahc_linux_initialize_scsi_bus(struct ahc_softc *ahc); 436 - static void ahc_linux_thread_run_complete_queue(struct ahc_softc *ahc); 437 436 static u_int ahc_linux_user_tagdepth(struct ahc_softc *ahc, 438 437 struct ahc_devinfo *devinfo); 439 438 static void ahc_linux_device_queue_depth(struct ahc_softc *ahc, ··· 453 454 static aic_option_callback_t ahc_linux_setup_tag_info; 454 455 static int aic7xxx_setup(char *s); 455 456 static int ahc_linux_next_unit(void); 456 - static struct ahc_cmd *ahc_linux_run_complete_queue(struct ahc_softc *ahc); 457 457 458 458 /********************************* Inlines ************************************/ 459 459 static __inline struct ahc_linux_device* 460 460 ahc_linux_get_device(struct ahc_softc *ahc, u_int channel, 461 461 u_int target, u_int lun, int alloc); 462 - static __inline void ahc_schedule_completeq(struct ahc_softc *ahc); 463 462 static __inline void ahc_linux_unmap_scb(struct ahc_softc*, struct scb*); 464 463 465 464 static __inline int ahc_linux_map_seg(struct ahc_softc *ahc, struct scb *scb, 466 465 struct ahc_dma_seg *sg, 467 466 dma_addr_t addr, bus_size_t len); 468 - 469 - static __inline void 470 - ahc_schedule_completeq(struct ahc_softc *ahc) 471 - { 472 - if ((ahc->platform_data->flags & AHC_RUN_CMPLT_Q_TIMER) == 0) { 473 - ahc->platform_data->flags |= AHC_RUN_CMPLT_Q_TIMER; 474 - ahc->platform_data->completeq_timer.expires = jiffies; 475 - add_timer(&ahc->platform_data->completeq_timer); 476 - } 477 - } 478 467 479 468 static __inline struct ahc_linux_device* 480 469 ahc_linux_get_device(struct ahc_softc *ahc, u_int channel, u_int target, ··· 488 501 if (dev == NULL && alloc != 0) 489 502 dev = ahc_linux_alloc_device(ahc, targ, lun); 490 503 return (dev); 491 - } 492 - 493 - #define AHC_LINUX_MAX_RETURNED_ERRORS 4 494 - static struct ahc_cmd * 495 - ahc_linux_run_complete_queue(struct ahc_softc *ahc) 496 - { 497 - struct ahc_cmd *acmd; 498 - int with_errors; 499 - 500 - with_errors = 0; 501 - while ((acmd = TAILQ_FIRST(&ahc->platform_data->completeq)) != NULL) { 502 - struct scsi_cmnd *cmd; 503 - 504 - if (with_errors > AHC_LINUX_MAX_RETURNED_ERRORS) { 505 - /* 506 - * Linux uses stack recursion to requeue 507 - * commands that need to be retried. Avoid 508 - * blowing out the stack by "spoon feeding" 509 - * commands that completed with error back 510 - * the operating system in case they are going 511 - * to be retried. "ick" 512 - */ 513 - ahc_schedule_completeq(ahc); 514 - break; 515 - } 516 - TAILQ_REMOVE(&ahc->platform_data->completeq, 517 - acmd, acmd_links.tqe); 518 - cmd = &acmd_scsi_cmd(acmd); 519 - cmd->host_scribble = NULL; 520 - if (ahc_cmd_get_transaction_status(cmd) != DID_OK 521 - || (cmd->result & 0xFF) != SCSI_STATUS_OK) 522 - with_errors++; 523 - 524 - cmd->scsi_done(cmd); 525 - } 526 - return (acmd); 527 504 } 528 505 529 506 static __inline void ··· 807 856 ahc = *(struct ahc_softc **)cmd->device->host->hostdata; 808 857 found = ahc_reset_channel(ahc, cmd->device->channel + 'A', 809 858 /*initiate reset*/TRUE); 810 - ahc_linux_run_complete_queue(ahc); 811 859 812 860 if (bootverbose) 813 861 printf("%s: SCSI bus reset delivered. " ··· 1281 1331 if (ahc->platform_data == NULL) 1282 1332 return (ENOMEM); 1283 1333 memset(ahc->platform_data, 0, sizeof(struct ahc_platform_data)); 1284 - TAILQ_INIT(&ahc->platform_data->completeq); 1285 1334 ahc->platform_data->irq = AHC_LINUX_NOIRQ; 1286 1335 ahc_lockinit(ahc); 1287 - init_timer(&ahc->platform_data->completeq_timer); 1288 - ahc->platform_data->completeq_timer.data = (u_long)ahc; 1289 - ahc->platform_data->completeq_timer.function = 1290 - (ahc_linux_callback_t *)ahc_linux_thread_run_complete_queue; 1291 1336 init_MUTEX_LOCKED(&ahc->platform_data->eh_sem); 1292 1337 ahc->seltime = (aic7xxx_seltime & 0x3) << 4; 1293 1338 ahc->seltime_b = (aic7xxx_seltime & 0x3) << 4; ··· 1300 1355 int i, j; 1301 1356 1302 1357 if (ahc->platform_data != NULL) { 1303 - del_timer_sync(&ahc->platform_data->completeq_timer); 1304 1358 if (ahc->platform_data->host != NULL) { 1305 1359 scsi_remove_host(ahc->platform_data->host); 1306 1360 scsi_host_put(ahc->platform_data->host); ··· 1446 1502 int lun, u_int tag, role_t role, uint32_t status) 1447 1503 { 1448 1504 return 0; 1449 - } 1450 - 1451 - static void 1452 - ahc_linux_thread_run_complete_queue(struct ahc_softc *ahc) 1453 - { 1454 - u_long flags; 1455 - 1456 - ahc_lock(ahc, &flags); 1457 - del_timer(&ahc->platform_data->completeq_timer); 1458 - ahc->platform_data->flags &= ~AHC_RUN_CMPLT_Q_TIMER; 1459 - ahc_linux_run_complete_queue(ahc); 1460 - ahc_unlock(ahc, &flags); 1461 1505 } 1462 1506 1463 1507 static u_int ··· 1717 1785 ahc = (struct ahc_softc *) dev_id; 1718 1786 ahc_lock(ahc, &flags); 1719 1787 ours = ahc_intr(ahc); 1720 - ahc_linux_run_complete_queue(ahc); 1721 1788 ahc_unlock(ahc, &flags); 1722 1789 return IRQ_RETVAL(ours); 1723 1790 } ··· 1725 1794 ahc_platform_flushwork(struct ahc_softc *ahc) 1726 1795 { 1727 1796 1728 - while (ahc_linux_run_complete_queue(ahc) != NULL) 1729 - ; 1730 1797 } 1731 1798 1732 1799 static struct ahc_linux_target* ··· 2204 2275 ahc_linux_queue_cmd_complete(struct ahc_softc *ahc, struct scsi_cmnd *cmd) 2205 2276 { 2206 2277 /* 2207 - * Typically, the complete queue has very few entries 2208 - * queued to it before the queue is emptied by 2209 - * ahc_linux_run_complete_queue, so sorting the entries 2210 - * by generation number should be inexpensive. 2211 - * We perform the sort so that commands that complete 2212 - * with an error are retuned in the order origionally 2213 - * queued to the controller so that any subsequent retries 2214 - * are performed in order. The underlying ahc routines do 2215 - * not guarantee the order that aborted commands will be 2216 - * returned to us. 2217 - */ 2218 - struct ahc_completeq *completeq; 2219 - struct ahc_cmd *list_cmd; 2220 - struct ahc_cmd *acmd; 2221 - 2222 - /* 2223 2278 * Map CAM error codes into Linux Error codes. We 2224 2279 * avoid the conversion so that the DV code has the 2225 2280 * full error information available when making ··· 2256 2343 new_status = DID_ERROR; 2257 2344 break; 2258 2345 case CAM_REQUEUE_REQ: 2259 - /* 2260 - * If we want the request requeued, make sure there 2261 - * are sufficent retries. In the old scsi error code, 2262 - * we used to be able to specify a result code that 2263 - * bypassed the retry count. Now we must use this 2264 - * hack. We also "fake" a check condition with 2265 - * a sense code of ABORTED COMMAND. This seems to 2266 - * evoke a retry even if this command is being sent 2267 - * via the eh thread. Ick! Ick! Ick! 2268 - */ 2269 - if (cmd->retries > 0) 2270 - cmd->retries--; 2271 - new_status = DID_OK; 2272 - ahc_cmd_set_scsi_status(cmd, SCSI_STATUS_CHECK_COND); 2273 - cmd->result |= (DRIVER_SENSE << 24); 2274 - memset(cmd->sense_buffer, 0, 2275 - sizeof(cmd->sense_buffer)); 2276 - cmd->sense_buffer[0] = SSD_ERRCODE_VALID 2277 - | SSD_CURRENT_ERROR; 2278 - cmd->sense_buffer[2] = SSD_KEY_ABORTED_COMMAND; 2346 + new_status = DID_REQUEUE; 2279 2347 break; 2280 2348 default: 2281 2349 /* We should never get here */ ··· 2267 2373 ahc_cmd_set_transaction_status(cmd, new_status); 2268 2374 } 2269 2375 2270 - completeq = &ahc->platform_data->completeq; 2271 - list_cmd = TAILQ_FIRST(completeq); 2272 - acmd = (struct ahc_cmd *)cmd; 2273 - while (list_cmd != NULL 2274 - && acmd_scsi_cmd(list_cmd).serial_number 2275 - < acmd_scsi_cmd(acmd).serial_number) 2276 - list_cmd = TAILQ_NEXT(list_cmd, acmd_links.tqe); 2277 - if (list_cmd != NULL) 2278 - TAILQ_INSERT_BEFORE(list_cmd, acmd, acmd_links.tqe); 2279 - else 2280 - TAILQ_INSERT_TAIL(completeq, acmd, acmd_links.tqe); 2376 + cmd->scsi_done(cmd); 2281 2377 } 2282 2378 2283 2379 static void ··· 2631 2747 } 2632 2748 spin_lock_irq(&ahc->platform_data->spin_lock); 2633 2749 } 2634 - ahc_linux_run_complete_queue(ahc); 2635 2750 return (retval); 2636 2751 } 2637 2752
+3 -14
drivers/scsi/aic7xxx/aic7xxx_osm.h
··· 436 436 /* 437 437 * Per-SCB OSM storage. 438 438 */ 439 - typedef enum { 440 - AHC_UP_EH_SEMAPHORE = 0x1 441 - } ahc_linux_scb_flags; 442 - 443 439 struct scb_platform_data { 444 440 struct ahc_linux_device *dev; 445 441 dma_addr_t buf_busaddr; 446 442 uint32_t xfer_len; 447 443 uint32_t sense_resid; /* Auto-Sense residual */ 448 - ahc_linux_scb_flags flags; 449 444 }; 450 445 451 446 /* ··· 449 454 * alignment restrictions of the various platforms supported by 450 455 * this driver. 451 456 */ 452 - typedef enum { 453 - AHC_RUN_CMPLT_Q_TIMER = 0x10 454 - } ahc_linux_softc_flags; 455 - 456 - TAILQ_HEAD(ahc_completeq, ahc_cmd); 457 - 458 457 struct ahc_platform_data { 459 458 /* 460 459 * Fields accessed from interrupt context. 461 460 */ 462 461 struct ahc_linux_target *targets[AHC_NUM_TARGETS]; 463 - struct ahc_completeq completeq; 464 462 465 463 spinlock_t spin_lock; 466 464 u_int qfrozen; 467 - struct timer_list completeq_timer; 468 465 struct timer_list reset_timer; 469 466 struct semaphore eh_sem; 470 467 struct Scsi_Host *host; /* pointer to scsi host */ ··· 464 477 uint32_t irq; /* IRQ for this adapter */ 465 478 uint32_t bios_address; 466 479 uint32_t mem_busaddr; /* Mem Base Addr */ 467 - ahc_linux_softc_flags flags; 480 + 481 + #define AHC_UP_EH_SEMAPHORE 0x1 482 + uint32_t flags; 468 483 }; 469 484 470 485 /************************** OS Utility Wrappers *******************************/