Add proper STGT <-> bs_sg passthrough v3
cover Add proper STGT <-> bs_sg passthrough v3
From: Nicholas Bellinger <[email protected]>
Greeting STGT folks,
This is the third round of patches for adding proper LUN passthrough support into STGT using struct scsi_lu->cmd_perform() and struct scsi_lu->cmd_done() callers with existing SG_IO and the new BSG v4 backstores.
Following Tomo-san's input, the changelog between v2 -> v3 is as follows:
1) Add struct device_type_template sg_template for SG_IO and BSG in usr/bs_sg.c instead of making changes to usr/sbc.c
2) Add struct backingstore_template->bs_passthrough member of type int for SG_IO and BSG.
3) In usr/target.c:tgt_device_create() pass bst->bs_passthrough into device_type_lookup() and for passthrough case use the new device_type_passthrough() to locate struct device_type_template sg_template.
4) Remove unnecessary post_cmd_done() from usr/target.c:__cmd_done_passthrough()
This patch series has been tested with STGT/iSCSI using 'sg'+'bsg' and 'rdwr' for non passthrough mode backstores into TCM_Loop LLD emulated iSCSI target ports.
Best,
Nicholas Bellinger (3):
[tgt]: Add proper STGT LUN backstore passthrough support (rev 3) [tgt]: Add bs_sg struct device_type_template sg_template and struct
backingstore_template->bs_init()
[tgt]: Add BSG v4 backstore support to usr/bs_sg.c
usr/bs_sg.c | 247 ++++++++++++++++++++++++++++++++++++++++++++++++++++-- usr/scsi_cmnd.h | 7 ++ usr/target.c | 113 +++++++++++++++++++++++--- usr/tgtd.h | 16 ++++ 4 files changed, 362 insertions(+), 21 deletions(-)
Quoted 31 lines · On Sun, 6 Jun 2010 20:50:15 -0700 "Nicholas A. Bellinger"…
From: Nicholas Bellinger <[email protected]>
Greeting STGT folks,
This is the third round of patches for adding proper LUN passthrough support into STGT using struct
scsi_lu->cmd_perform()and structscsi_lu->cmd_done()callers with existingSG_IOand the new BSG v4 backstores.Following Tomo-san's input, the changelog between v2 -> v3 is as follows:
1) Add struct
device_type_templatesg_templateforSG_IOand BSG inusr/bs_sg.cinstead of making changes tousr/sbc.c2) Add struct
backingstore_template->bs_passthroughmember of type int forSG_IOand BSG.3) In usr/target.c:tgt_device_create() pass
bst->bs_passthroughintodevice_type_lookup()and for passthrough case use the newdevice_type_passthrough()to locate structdevice_type_templatesg_template.4) Remove unnecessary
post_cmd_done()from usr/target.c:__cmd_done_passthrough()This patch series has been tested with STGT/iSCSI using 'sg'+'bsg' and 'rdwr' for non passthrough mode backstores into
TCM_LoopLLD emulated iSCSI target ports.Best,
Signed-off-by Nicholas A. Bellinger <[email protected]Nicholas Bellinger (3):
[tgt]: Add proper STGT LUN backstore passthrough support (rev 3) [tgt]: Addbs_sgstructdevice_type_templatesg_templateand struct
Quoted 8 lines
backingstore_template->bs_init()[tgt]: Add BSG v4 backstore support to
usr/bs_sg.cusr/bs_sg.c | 247 ++++++++++++++++++++++++++++++++++++++++++++++++++++-- usr/scsi_cmnd.h | 7 ++ usr/target.c | 113 +++++++++++++++++++++++--- usr/tgtd.h | 16 ++++ 4 files changed, 362 insertions(+), 21 deletions(-)
The first and second patches Look fine overall. I have some comments and wrote some cleanup patches.
I've put the first two patches with my cleanups:
git://git.kernel.org/pub/scm/linux/kernel/git/tomo/tgt.git pass
Can you confirm that it works for you? Then I can merge them into master.
Let's leave bsg support alone and focus on the sg support for now.
Quoted 46 lines · FUJITA Tomonori
Quoted 31 lines · On Sun, 6 Jun 2010 20:50:15 -0700 "Nicholas A. Bellinger"…
From: Nicholas Bellinger <[email protected]>
Greeting STGT folks,
This is the third round of patches for adding proper LUN passthrough support into STGT using struct
scsi_lu->cmd_perform()and structscsi_lu->cmd_done()callers with existingSG_IOand the new BSG v4 backstores.Following Tomo-san's input, the changelog between v2 -> v3 is as follows:
1) Add struct
device_type_templatesg_templateforSG_IOand BSG inusr/bs_sg.cinstead of making changes tousr/sbc.c2) Add struct
backingstore_template->bs_passthroughmember of type int forSG_IOand BSG.3) In usr/target.c:tgt_device_create() pass
bst->bs_passthroughintodevice_type_lookup()and for passthrough case use the newdevice_type_passthrough()to locate structdevice_type_templatesg_template.4) Remove unnecessary
post_cmd_done()from usr/target.c:__cmd_done_passthrough()This patch series has been tested with STGT/iSCSI using 'sg'+'bsg' and 'rdwr' for non passthrough mode backstores into
TCM_LoopLLD emulated iSCSI target ports.Best,
Signed-off-by Nicholas A. Bellinger <[email protected]Nicholas Bellinger (3):
[tgt]: Add proper STGT LUN backstore passthrough support (rev 3) [tgt]: Addbs_sgstructdevice_type_templatesg_templateand structQuoted 8 lines
backingstore_template->bs_init()[tgt]: Add BSG v4 backstore support to
usr/bs_sg.cusr/bs_sg.c | 247 ++++++++++++++++++++++++++++++++++++++++++++++++++++-- usr/scsi_cmnd.h | 7 ++ usr/target.c | 113 +++++++++++++++++++++++--- usr/tgtd.h | 16 ++++ 4 files changed, 362 insertions(+), 21 deletions(-)The first and second patches Look fine overall. I have some comments and wrote some cleanup patches.
Quoted 6 lines
I've put the first two patches with my cleanups:
git://git.kernel.org/pub/scm/linux/kernel/git/tomo/tgt.gitpassCan you confirm that it works for you? Then I can merge them into master.
The pass branch works fine using '-E sg -Y pt' for SG_IO backstore <-> fabric LUN assocation with TCM_Loop LLD Target Ports. Thanks for cleaning things up to use TYPE_PT btw, I should have asked about that earlier. ;)
Quoted 3 lines
Let's leave bsg support alone and focus on the sg support for now. --
Ok, I just fixed some minor breakage and applied patch 3 on top of tgt.git/pass in my local tree and everything appears to work with '-E bsg -Y pt'.
Please let me know if you have any other comments on the BSG bits or if you would like me to send along a updated patch 3 seperately.
Thanks Tomo!
--nab
Quoted 6 lines · On Mon, 07 Jun 2010 01:27:16 -0700 "Nicholas A. Bellinger"…
Ok, I just fixed some minor breakage and applied patch 3 on top of tgt.git/pass in my local tree and everything appears to work with '-E bsg -Y pt'.
Please let me know if you have any other comments on the BSG bits or if you would like me to send along a updated patch 3 seperately.
Please send patches except for bsg first.
About bsg support, we need both sg and bsg? Just bsg is not enough?
Quoted 7 lines · FUJITA Tomonori
Quoted 4 lines · On Mon, 07 Jun 2010 01:27:16 -0700 "Nicholas A. Bellinger"…
Ok, I just fixed some minor breakage and applied patch 3 on top of tgt.git/pass in my local tree and everything appears to work with '-E bsg -Y pt'.
Quoted 6 lines
Quoted 2 lines
Please let me know if you have any other comments on the BSG bits or if you would like me to send along a updated patch 3 seperately.
Please send patches except for bsg first.
About bsg support, we need both sg and bsg? Just bsg is not enough?
I figured you would still like legacy support w/o bsg for the forseeable future with older production kernels. I don't recall which kernel BSG support was added or if this code has already been backported to the various distro kernels.
Best,
--nab
Quoted 11 lines · On Mon, 07 Jun 2010 02:07:09 -0700 "Nicholas A. Bellinger"…
Quoted 10 lines · FUJITA Tomonori
Quoted 6 lines · On Mon, 07 Jun 2010 01:27:16 -0700 "Nicholas A. Bellinger"…
Ok, I just fixed some minor breakage and applied patch 3 on top of tgt.git/pass in my local tree and everything appears to work with '-E bsg -Y pt'.
Please let me know if you have any other comments on the BSG bits or if you would like me to send along a updated patch 3 seperately.
Quoted 8 lines
Quoted 3 lines
Please send patches except for bsg first.
About bsg support, we need both sg and bsg? Just bsg is not enough?
I figured you would still like legacy support w/o bsg for the forseeable future with older production kernels. I don't recall which kernel BSG support was added or if this code has already been backported to the various distro kernels.
I prefer to support only bsg (until someone tells me to support sg).
btw, if you look for a tool to generate a bidi command, my sgv4-tools might work for you.
git://git.kernel.org/pub/scm/linux/kernel/git/tomo/sgv4-tools.git
try sgv4_xdwriteread (note that it's not useful at all except for generating bidi).
Quoted 16 lines · FUJITA Tomonori
Quoted 13 lines · On Mon, 07 Jun 2010 02:07:09 -0700 "Nicholas A. Bellinger"…
Quoted 12 lines · FUJITA Tomonori
Quoted 6 lines · On Mon, 07 Jun 2010 01:27:16 -0700 "Nicholas A. Bellinger"…
Ok, I just fixed some minor breakage and applied patch 3 on top of tgt.git/pass in my local tree and everything appears to work with '-E bsg -Y pt'.
Please let me know if you have any other comments on the BSG bits or if you would like me to send along a updated patch 3 seperately.
Please send patches except for bsg first.
Quoted 9 lines
Quoted 6 lines
Quoted 1 line
About bsg support, we need both sg and bsg? Just bsg is not enough?
I figured you would still like legacy support w/o bsg for the forseeable future with older production kernels. I don't recall which kernel BSG support was added or if this code has already been backported to the various distro kernels.
I prefer to support only bsg (until someone tells me to support sg).
Ok, if that is the case I will respin a patch on top of tgt.git/pass to remove SG and use BSG exclusively. Please let me know if you have any more recommendations in this area.
Quoted 8 lines
btw, if you look for a tool to generate a bidi command, my sgv4-tools might work for you.
git://git.kernel.org/pub/scm/linux/kernel/git/tomo/sgv4-tools.gittry
sgv4_xdwriteread(note that it's not useful at all except for generating bidi).
Ah perfect, this is exactly what I am looking for. Many thanks.
Best,
--nab
Quoted 51 lines · On Mon, 07 Jun 2010 01:27:16 -0700 "Nicholas A. Bellinger"…
Quoted 50 lines · FUJITA Tomonori
Quoted 31 lines · On Sun, 6 Jun 2010 20:50:15 -0700 "Nicholas A. Bellinger"…
From: Nicholas Bellinger <[email protected]>
Greeting STGT folks,
This is the third round of patches for adding proper LUN passthrough support into STGT using struct
scsi_lu->cmd_perform()and structscsi_lu->cmd_done()callers with existingSG_IOand the new BSG v4 backstores.Following Tomo-san's input, the changelog between v2 -> v3 is as follows:
1) Add struct
device_type_templatesg_templateforSG_IOand BSG inusr/bs_sg.cinstead of making changes tousr/sbc.c2) Add struct
backingstore_template->bs_passthroughmember of type int forSG_IOand BSG.3) In usr/target.c:tgt_device_create() pass
bst->bs_passthroughintodevice_type_lookup()and for passthrough case use the newdevice_type_passthrough()to locate structdevice_type_templatesg_template.4) Remove unnecessary
post_cmd_done()from usr/target.c:__cmd_done_passthrough()This patch series has been tested with STGT/iSCSI using 'sg'+'bsg' and 'rdwr' for non passthrough mode backstores into
TCM_LoopLLD emulated iSCSI target ports.Best,
Signed-off-by Nicholas A. Bellinger <[email protected]Nicholas Bellinger (3):
[tgt]: Add proper STGT LUN backstore passthrough support (rev 3) [tgt]: Addbs_sgstructdevice_type_templatesg_templateand structQuoted 8 lines
backingstore_template->bs_init()[tgt]: Add BSG v4 backstore support to
usr/bs_sg.cusr/bs_sg.c | 247 ++++++++++++++++++++++++++++++++++++++++++++++++++++-- usr/scsi_cmnd.h | 7 ++ usr/target.c | 113 +++++++++++++++++++++++--- usr/tgtd.h | 16 ++++ 4 files changed, 362 insertions(+), 21 deletions(-)The first and second patches Look fine overall. I have some comments and wrote some cleanup patches.
I've put the first two patches with my cleanups:
git://git.kernel.org/pub/scm/linux/kernel/git/tomo/tgt.gitpass
Quoted 7 lines
Quoted 2 lines
Can you confirm that it works for you? Then I can merge them into master.
The pass branch works fine using '-E sg -Y pt' for
SG_IObackstore <-> fabric LUN assocation withTCM_LoopLLD Target Ports. Thanks for cleaning things up to useTYPE_PTbtw, I should have asked about that earlier. ;)
Thanks for the confirmation. I've merged these patches into master.
I'll merge your bsg patch if nobody complains about dropping sg support in a few days.
Thanks,
Quoted 62 lines · FUJITA Tomonori
Quoted 51 lines · On Mon, 07 Jun 2010 01:27:16 -0700 "Nicholas A. Bellinger"…
Quoted 50 lines · FUJITA Tomonori
Quoted 31 lines · On Sun, 6 Jun 2010 20:50:15 -0700 "Nicholas A. Bellinger"…
From: Nicholas Bellinger <[email protected]>
Greeting STGT folks,
This is the third round of patches for adding proper LUN passthrough support into STGT using struct
scsi_lu->cmd_perform()and structscsi_lu->cmd_done()callers with existingSG_IOand the new BSG v4 backstores.Following Tomo-san's input, the changelog between v2 -> v3 is as follows:
1) Add struct
device_type_templatesg_templateforSG_IOand BSG inusr/bs_sg.cinstead of making changes tousr/sbc.c2) Add struct
backingstore_template->bs_passthroughmember of type int forSG_IOand BSG.3) In usr/target.c:tgt_device_create() pass
bst->bs_passthroughintodevice_type_lookup()and for passthrough case use the newdevice_type_passthrough()to locate structdevice_type_templatesg_template.4) Remove unnecessary
post_cmd_done()from usr/target.c:__cmd_done_passthrough()This patch series has been tested with STGT/iSCSI using 'sg'+'bsg' and 'rdwr' for non passthrough mode backstores into
TCM_LoopLLD emulated iSCSI target ports.Best,
Signed-off-by Nicholas A. Bellinger <[email protected]Nicholas Bellinger (3):
[tgt]: Add proper STGT LUN backstore passthrough support (rev 3) [tgt]: Addbs_sgstructdevice_type_templatesg_templateand structQuoted 8 lines
backingstore_template->bs_init()[tgt]: Add BSG v4 backstore support to
usr/bs_sg.cusr/bs_sg.c | 247 ++++++++++++++++++++++++++++++++++++++++++++++++++++-- usr/scsi_cmnd.h | 7 ++ usr/target.c | 113 +++++++++++++++++++++++--- usr/tgtd.h | 16 ++++ 4 files changed, 362 insertions(+), 21 deletions(-)The first and second patches Look fine overall. I have some comments and wrote some cleanup patches.
I've put the first two patches with my cleanups:
git://git.kernel.org/pub/scm/linux/kernel/git/tomo/tgt.gitpassQuoted 7 lines
Quoted 2 lines
Can you confirm that it works for you? Then I can merge them into master.
The pass branch works fine using '-E sg -Y pt' for
SG_IObackstore <-> fabric LUN assocation withTCM_LoopLLD Target Ports. Thanks for cleaning things up to useTYPE_PTbtw, I should have asked about that earlier. ;)
Quoted 5 lines
Thanks for the confirmation. I've merged these patches into master.
I'll merge your bsg patch if nobody complains about dropping sg support in a few days.
Perfect, thank you Tomo-san.
Best,
--nab
Quoted 63 lines · Nicholas A. Bellinger
Quoted 62 lines · FUJITA Tomonori
Quoted 58 lines · On Mon, 07 Jun 2010 01:27:16 -0700 "Nicholas A. Bellinger"…
Quoted 46 lines · FUJITA Tomonori
Quoted 31 lines · On Sun, 6 Jun 2010 20:50:15 -0700 "Nicholas A. Bellinger"…
From: Nicholas Bellinger <[email protected]>
Greeting STGT folks,
This is the third round of patches for adding proper LUN passthrough support into STGT using struct
scsi_lu->cmd_perform()and structscsi_lu->cmd_done()callers with existingSG_IOand the new BSG v4 backstores.Following Tomo-san's input, the changelog between v2 -> v3 is as follows:
1) Add struct
device_type_templatesg_templateforSG_IOand BSG inusr/bs_sg.cinstead of making changes tousr/sbc.c2) Add struct
backingstore_template->bs_passthroughmember of type int forSG_IOand BSG.3) In usr/target.c:tgt_device_create() pass
bst->bs_passthroughintodevice_type_lookup()and for passthrough case use the newdevice_type_passthrough()to locate structdevice_type_templatesg_template.4) Remove unnecessary
post_cmd_done()from usr/target.c:__cmd_done_passthrough()This patch series has been tested with STGT/iSCSI using 'sg'+'bsg' and 'rdwr' for non passthrough mode backstores into
TCM_LoopLLD emulated iSCSI target ports.Best,
Signed-off-by Nicholas A. Bellinger <[email protected]Nicholas Bellinger (3):
[tgt]: Add proper STGT LUN backstore passthrough support (rev 3) [tgt]: Addbs_sgstructdevice_type_templatesg_templateand structQuoted 8 lines
backingstore_template->bs_init()[tgt]: Add BSG v4 backstore support to
usr/bs_sg.cusr/bs_sg.c | 247 ++++++++++++++++++++++++++++++++++++++++++++++++++++-- usr/scsi_cmnd.h | 7 ++ usr/target.c | 113 +++++++++++++++++++++++--- usr/tgtd.h | 16 ++++ 4 files changed, 362 insertions(+), 21 deletions(-)The first and second patches Look fine overall. I have some comments and wrote some cleanup patches.
Quoted 6 lines
I've put the first two patches with my cleanups:
git://git.kernel.org/pub/scm/linux/kernel/git/tomo/tgt.gitpassCan you confirm that it works for you? Then I can merge them into master.
The pass branch works fine using '-E sg -Y pt' for
SG_IObackstore <-> fabric LUN assocation withTCM_LoopLLD Target Ports. Thanks for cleaning things up to useTYPE_PTbtw, I should have asked about that earlier. ;)
Quoted 7 lines
Quoted 5 lines
Thanks for the confirmation. I've merged these patches into master.
I'll merge your bsg patch if nobody complains about dropping sg support in a few days.
Perfect, thank you Tomo-san.
Ping on this ... is it actually all working and we could remove the STGT code in favour of this?
James
Quoted 66 lines · James Bottomley
Quoted 65 lines · Nicholas A. Bellinger
Quoted 64 lines · FUJITA Tomonori
Quoted 51 lines · On Mon, 07 Jun 2010 01:27:16 -0700 "Nicholas A. Bellinger"…
Quoted 50 lines · FUJITA Tomonori
Quoted 31 lines · On Sun, 6 Jun 2010 20:50:15 -0700 "Nicholas A. Bellinger"…
From: Nicholas Bellinger <[email protected]>
Greeting STGT folks,
This is the third round of patches for adding proper LUN passthrough support into STGT using struct
scsi_lu->cmd_perform()and structscsi_lu->cmd_done()callers with existingSG_IOand the new BSG v4 backstores.Following Tomo-san's input, the changelog between v2 -> v3 is as follows:
1) Add struct
device_type_templatesg_templateforSG_IOand BSG inusr/bs_sg.cinstead of making changes tousr/sbc.c2) Add struct
backingstore_template->bs_passthroughmember of type int forSG_IOand BSG.3) In usr/target.c:tgt_device_create() pass
bst->bs_passthroughintodevice_type_lookup()and for passthrough case use the newdevice_type_passthrough()to locate structdevice_type_templatesg_template.4) Remove unnecessary
post_cmd_done()from usr/target.c:__cmd_done_passthrough()This patch series has been tested with STGT/iSCSI using 'sg'+'bsg' and 'rdwr' for non passthrough mode backstores into
TCM_LoopLLD emulated iSCSI target ports.Best,
Signed-off-by Nicholas A. Bellinger <[email protected]Nicholas Bellinger (3):
[tgt]: Add proper STGT LUN backstore passthrough support (rev 3) [tgt]: Addbs_sgstructdevice_type_templatesg_templateand structQuoted 8 lines
backingstore_template->bs_init()[tgt]: Add BSG v4 backstore support to
usr/bs_sg.cusr/bs_sg.c | 247 ++++++++++++++++++++++++++++++++++++++++++++++++++++-- usr/scsi_cmnd.h | 7 ++ usr/target.c | 113 +++++++++++++++++++++++--- usr/tgtd.h | 16 ++++ 4 files changed, 362 insertions(+), 21 deletions(-)The first and second patches Look fine overall. I have some comments and wrote some cleanup patches.
I've put the first two patches with my cleanups:
git://git.kernel.org/pub/scm/linux/kernel/git/tomo/tgt.gitpassQuoted 7 lines
Quoted 2 lines
Can you confirm that it works for you? Then I can merge them into master.
The pass branch works fine using '-E sg -Y pt' for
SG_IObackstore <-> fabric LUN assocation withTCM_LoopLLD Target Ports. Thanks for cleaning things up to useTYPE_PTbtw, I should have asked about that earlier. ;)Thanks for the confirmation. I've merged these patches into master.
Quoted 9 lines
Quoted 5 lines
Quoted 3 lines
I'll merge your bsg patch if nobody complains about dropping sg support in a few days.
Perfect, thank you Tomo-san.
Ping on this ... is it actually all working and we could remove the STGT code in favour of this?
Hi James,
Using TCM_Loop with SG_IO and BSG with LUN level passthrough and explict I_T nexus and port configuration
using /sys/kernel/config/target/loopback is still functioning as expected with userspace STGT/iSCSI. Note that TCM_Loop v4 supports multi-fabric port level emulation for FC, SAS and iSCSI, and will configure itself to return CDB level $PROTO_IDENT based on the /sys/kernel/config/target/loopback/$WWPN prefix. So it should work with those the STGT/OpenFCoE userspace fabric as well.
Also just FYI, I am not planning to removing any STGT kernel code at this point from lio-core-2.6.git with mainline push of TCM in order to use userspace STGT fabric modules with TCM_Loop. Actually, I would like to (eventually) adapt it to function as a seperate TCM backstore subsystem plugin to allow fabric level ports access to userspace CDB processing capability.
So yes, I think that drivers/scsi/scsi_tgt_* is still be of use for us when doing kernel level fabric <-> userspace CDB processing. If you will recall there was some time spent trying to get userspace CDB backstore passthrough as a seperate TCM subsystem module, but had been left out the TCM scsi-misc.git tree for the v2.6.35 push, which is here:
I was hoping to get up this up running with drivers/scsi/scsi_tgt_* by the end of the year for the next round so that the kernel -> userspace CDB passthrough logic can be used for doing PCI and VirtIO HW target mode emulation with QEMU/KVM. Also, I know that jgarzik is interested in something like this for HAIL as well.
Best,
--nab