From: Boaz Harrosh <bharrosh@panasas.com>
To: Ramya Desai <ramya.desai@gmail.com>
Cc: Alan Stern <stern@rowland.harvard.edu>,
USB list <linux-usb@vger.kernel.org>,
linux-scsi@vger.kernel.org
Subject: Re: Return of PENDING status to SCSI driver
Date: Tue, 16 Jun 2009 17:27:40 +0300 [thread overview]
Message-ID: <4A37ABDC.4050308@panasas.com> (raw)
In-Reply-To: <3e7aae30906160635g4d191a4exdb710554a349cac0@mail.gmail.com>
On 06/16/2009 04:35 PM, Ramya Desai wrote:
>> This is bulshit. Get your act together babe. You are hacking and deriving from
>> GPLed code. You are legally bind by that.
>>
>> But you are welcome to remove any lowlevel rocket science from your driver
>> and just post the Linux relevant things. Infact why don't you start with a
>> demo driver that just emulates in SW IO transfers close to what your driver
>> will do. scsi_debug is a good place to look.
>>
>>
>> > But Still I am confused with return status (to SCSI layer) for the
>> > command while it is in progress, to get the next command. Is it some
>> > thing like PENDING?
>> >
>>
>>
>> Look in scsi_debug enable some prints. It queues and completes cmnds
>> asynchronously. Look in Alan's other mail I think you are hit with the
>> usb queue_command posting the commands to a thread. This is unique to
>> usb.
>>
>> > -RD
>>
>>
>> Boaz
>>
>
> At this stage, I can not reveal the complete code without my client’s
> permission. But the entire code will be made public (According to GPL)
> once driver is completed.
>
This is counter productive and stupid. If they are going to release the code,
anyway, and there are no secrets, then the time to release it is now when
there are problems. When the driver is done and everything is working we don't
need the code do we? it's during development that the code is important. When there
is nothing to do there is nothing to do.
> But here I am pasting the template structure code that I am using in my driver.
>
> struct scsi_host_template usb_stor_host_template = {
> /* basic userland interface stuff */
> .name = "usb-storage",
> .proc_name = "usb-storage",
> .proc_info = proc_info,
> .info = host_info,
>
> /* command interface -- queued only */
> .queuecommand = queuecommand,
If this is the unchanged queuecommand from usb-storage then
this will not work. As explained
>
> /* error and abort handlers */
> .eh_abort_handler = command_abort,
> .eh_device_reset_handler = device_reset,
> .eh_bus_reset_handler = bus_reset,
All these currently assume a single command how
did you change them?
>
> /* queue commands only, only one command per LUN */
> .can_queue = 5,
> .cmd_per_lun = 5,
>
Good
> /* unknown initiator id */
> .this_id = -1,
>
> .slave_alloc = slave_alloc,
> .slave_configure = slave_configure,
>
> /* lots of sg segments can be handled */
> .sg_tablesize = SG_ALL,
>
> /* limit the total size of a transfer to 120 KB */
> .max_sectors = 240,
>
> /* merge commands... this seems to help performance, but
> * periodically someone should test to see which setting is more
> * optimal.
> */
> .use_clustering = 1,
>
> /* emulated HBA */
> .emulated = 5,
>
> /* we do our own delay after a device or bus reset */
> .skip_settle_delay = 1,
>
> /* sysfs device attributes */
> .sdev_attrs = sysfs_device_attr_list,
>
> /* module management */
> .module = THIS_MODULE
> };
>
>
> Here I am giving some portion of the data structure us_data I am using
>
> struct us_data {
>
> .......
>
> /* SCSI interfaces */
> struct scsi_cmnd *srb[5]; /* current srb */
> unsigned int tag[5]; /* current dCBWTag */
>
> ...continued.
>
> }
>
> If I call void (*done)(struct scsi_cmnd *) call back immediately after
> receiving a command, will I get another command ?
>
I think you miss understood:
done() can/usually be called asynchronously when you have results, good/bad,
of the executed command, and all memory has been consumed, (can be freed).
scsi will call .queuecommand upto min(can_queue, .cmd_per_lun) times
without any call to done(). Then for each done() called it will call
.queuecommand again. (If more commands are pending)
So in short min(can_queue, .cmd_per_lun) is the maximum number of
commands queued at the target.
>
> Regards,
> RD
Above is all good. Your are doing something bad else where, which
you don't show us. Knowing the current USB code, then that is certainly
the culprit. Lots of places assume one command and other places behave
synchronously (ie. wait for response).
Free Life
Boaz
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2009-06-16 14: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 [this message]
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
[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=4A37ABDC.4050308@panasas.com \
--to=bharrosh@panasas.com \
--cc=linux-scsi@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=ramya.desai@gmail.com \
--cc=stern@rowland.harvard.edu \
/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