Re: Return of PENDING status to SCSI driver

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

 



>  >       /* 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;
	}

	/* 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;
	
	

	/* 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);

		/* 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__);

	return 0;  //Returning 0 to get the next command
}
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux