Question: Where are scsi commands encapsulated?

28 views
Skip to first unread message

whls...@gmail.com

unread,
May 13, 2016, 12:52:45 PM5/13/16
to open-iscsi
Hi,

I am recently looking into the process of iSCSI initiator. I wonder where the source codes are that receive the scsi commands and encapsulate them into iscsi format. I have walked through the interaction between iscsiadm and iscsid, but I did find that. I thought it may be written in qtask structure, but it seems the payload_len is never set within the code.

Could anyone help answer this question?

Thanks.

Chris Leech

unread,
May 20, 2016, 7:19:01 PM5/20/16
to whls...@gmail.com, open-iscsi
The userspace tools only handle iSCSI session management tasks. The
SCSI command handling is done in the Linux kernel drivers, which
interact with the kernel SCSI subsystem.

- Chris

hao wen

unread,
May 20, 2016, 7:33:46 PM5/20/16
to Chris Leech, Hao Wen, open-iscsi
Hi Chris,

Thank you for you reply. 
Just to be specific, can I get the scsi commands and try to do some process on it in function like iscsi_data_xmit(struct iscsi_conn *conn) before the scsi commands are finally transmitted to the iscsi target?

Thanks

Chris Leech

unread,
Jun 1, 2016, 6:27:32 PM6/1/16
to open-...@googlegroups.com, Hao Wen
On Fri, May 20, 2016 at 06:33:25PM -0500, hao wen wrote:
> Hi Chris,
>
> Thank you for you reply.
> Just to be specific, can I get the scsi commands and try to do some process
> on it in function like iscsi_data_xmit*(struct* iscsi_conn ***conn*) *before
> the scsi commands are finally transmitted to the iscsi target?

Look at the .queuecommand field in the scsi_host_template used by your
driver, it will point to the top level function that takes commands from
the SCSI midlayer to send to the target.

For iscsi_tcp, that's iscsi_queuecommand. You can follow the calls down
from there, but that's the interface where SCSI transports take
commands.

- Chris

> 2016-05-20 18:18 GMT-05:00 Chris Leech <cle...@redhat.com>:
>
> > On Mon, May 09, 2016 at 08:32:54AM -0700, whls...@gmail.com wrote:
> > > Hi,
> > >
> > > I am recently looking into the process of iSCSI initiator. I wonder where
> > > the source codes are that receive the scsi commands and encapsulate them
> > > into iscsi format. I have walked through the interaction between iscsiadm
> > > and iscsid, but I did find that. I thought it may be written in qtask
> > > structure, but it seems the payload_len is never set within the code.
> > >
> > > Could anyone help answer this question?
> >
> > The userspace tools only handle iSCSI session management tasks. The
> > SCSI command handling is done in the Linux kernel drivers, which
> > interact with the kernel SCSI subsystem.
> >
> > - Chris
> >
>
> --
> You received this message because you are subscribed to the Google Groups "open-iscsi" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to open-iscsi+...@googlegroups.com.
> To post to this group, send email to open-...@googlegroups.com.
> Visit this group at https://groups.google.com/group/open-iscsi.
> For more options, visit https://groups.google.com/d/optout.

Bobby

unread,
Jan 21, 2020, 12:32:05 PM1/21/20
to open-iscsi
Hi Chris,

very good explanation. Can you also please tell where does scsi-mq (multi-queue) comes into play in this flow? Where exactly one can see multi-queue in the code?

Thanks !
> To unsubscribe from this group and stop receiving emails from it, send an email to open-...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages