Re: Return of PENDING status to SCSI driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 06/16/2009 06:09 PM, Ramya Desai wrote:
>>  >       /* error and abort handlers */
>>  >       .eh_abort_handler =             command_abort,
>>  >       .eh_device_reset_handler =      device_reset,
>>  >       .eh_bus_reset_handler =         bus_reset,
> 
> Currently I have not implemented these functions. I will register a
> transport handler for the above functions and use strategy handler for
> error handling at later point of time.
> 
> Here is my queuecommand implementation. Please let me know if any
> other part of the code is required to find the problem.
> 
> 
> static int queuecommand(struct scsi_cmnd *srb,
> 			void (*done)(struct scsi_cmnd *))
> {
> 		int res = 0;
> 	struct uas_task *task;
> 	struct us_data *us = host_to_us(srb->device->host);
> 	
> 	US_DEBUG(usb_stor_show_command(srb));
> 
> 	/* check for state-transition errors */
> 	if (us->srb != NULL) {
> 		printk(KERN_ERR USB_STORAGE "Error in %s: us->srb = %p\n",
> 			__func__, us->srb);
> 		return SCSI_MLQUEUE_HOST_BUSY;
> 	}
> 

Did you not change this to an array? always true now!

> 	/* fail the command if we are disconnecting */
> 	if (test_bit(US_FLIDX_DISCONNECTING, &us->dflags)) {
> 		US_DEBUGP("Fail command during disconnect\n");
> 		srb->result = DID_NO_CONNECT << 16;
> 		done(srb);
> 		return 0;
> 	}
> 
> 		
> 	/* Create one task per SCSI command */
> 	task = uas_create_task(srb, us, GFP_ATOMIC);
> 	if (!task)
> 	     return -ENOMEM;
> 	

What does that do ?

> 	
> 
> 	/* enqueue the command and wake up the control thread */
> 	srb->scsi_done = done;
> 
>           //us->srb = srb; // eliminated, as a task has been created
> per SCSI command
> 
> 
> 	
> 		/* Queue the above created task */
> 		res = uas_queue(task, us);
> 

Does that return immediately?

> 		/* Examine */
> 		if (res) {
> 			
> 	           //Checking the status of the queue
>                     if (res == -UAS_QUEUE_FULL) {
>         	srb->result = DID_SOFT_ERROR << 16; /* retry */
> 			res = 0;
> 			done(srb);
> 			}
> 			return res;
> 		}
> 	
> 	
> 
> 	printk("MyTag: <%s> <%s> Exit!\n",__FILE__, __FUNCTION__);
> 

So do you see this print?
You should see up to 5 prints before the first done is called
by the uas_queue(task.

what do you see?


> 	return 0;  //Returning 0 to get the next command
> }

Boaz
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux