public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Boaz Harrosh <bharrosh-C4P08NqkoRlBDgjK7y7TUQ@public.gmane.org>
To: Ramya Desai <ramya.desai-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: Alan Stern
	<stern-nwvwT67g6+6dFdvTe/nMLpVzexx5G7lz@public.gmane.org>,
	USB list <linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	linux-scsi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: Return of PENDING status to SCSI driver
Date: Tue, 16 Jun 2009 18:27:57 +0300	[thread overview]
Message-ID: <4A37B9FD.6020007@panasas.com> (raw)
In-Reply-To: <3e7aae30906160809y32f0c8f6j3352cd1ec2bfe34a-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

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-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2009-06-16 15:27 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-12  9:29 Return of PENDING status to SCSI driver Ramya Desai
2009-06-12 11:32 ` Jeff Garzik
2009-06-12 12:54   ` Ramya Desai
2009-06-12 17:26     ` Stefan Richter
2009-06-14  9:16     ` Boaz Harrosh
2009-06-15 12:07       ` Ramya Desai
2009-06-15 12:26         ` Matthew Wilcox
2009-06-15 12:29         ` Boaz Harrosh
     [not found]           ` <4A363EB4.8000102-C4P08NqkoRlBDgjK7y7TUQ@public.gmane.org>
2009-06-15 14:01             ` Alan Stern
2009-06-15 14:07               ` Ramya Desai
     [not found]                 ` <3e7aae30906150707we781237o366950971d748b6f-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-06-15 14:33                   ` Boaz Harrosh
2009-06-15 14:42                     ` Ramya Desai
     [not found]                       ` <3e7aae30906150742l18e74a8fua5f08686c2c76454-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-06-15 14:50                         ` Ramya Desai
     [not found]                           ` <3e7aae30906150750m6809aa87v35f739e0a72243d-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-06-15 14:59                             ` Matthew Dharm
2009-06-15 14:59                         ` Alan Stern
2009-06-15 16:31                         ` Boaz Harrosh
     [not found]                           ` <4A36776C.5010208-C4P08NqkoRlBDgjK7y7TUQ@public.gmane.org>
2009-06-16 13:35                             ` Ramya Desai
2009-06-16 13:59                               ` Alan Cox
2009-06-16 14:27                               ` Boaz Harrosh
2009-06-16 14:39                                 ` James Bottomley
     [not found]                                 ` <4A37ABDC.4050308-C4P08NqkoRlBDgjK7y7TUQ@public.gmane.org>
2009-06-16 15:09                                   ` Ramya Desai
2009-06-16 15:22                                     ` Alan Stern
     [not found]                                     ` <3e7aae30906160809y32f0c8f6j3352cd1ec2bfe34a-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-06-16 15:27                                       ` Boaz Harrosh [this message]
     [not found]                               ` <3e7aae30906160635g4d191a4exdb710554a349cac0-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-06-16 15:13                                 ` Alan Stern
2009-06-15 17:19                       ` Jeff Garzik
2009-06-15 14:40                   ` Alan Stern
2009-06-15 14:42               ` Boaz Harrosh
     [not found]                 ` <4A365DCA.2030907-C4P08NqkoRlBDgjK7y7TUQ@public.gmane.org>
2009-06-15 14:49                   ` Alan Stern

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4A37B9FD.6020007@panasas.com \
    --to=bharrosh-c4p08nqkorlbdgjk7y7tuq@public.gmane.org \
    --cc=linux-scsi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=ramya.desai-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=stern-nwvwT67g6+6dFdvTe/nMLpVzexx5G7lz@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox