ib_srpt: Initial SRP Target merge for v3.2-rc1
Subsystems (3)
PATCH 1/1 ib_srpt: Initial SRP Target merge for v3.2-rc1
From: Bart Van Assche <[email protected]>
Hi folks,
This patch adds the kernel module ib_srpt SCSI RDMA Protocol (SRP) target implementation conforming to the SRP r16a specification for the mainline drivers/target infrastructure as requested by Christoph for an initial v3.2-rc1 merge.
This driver was originally developed by Vu Pham and has been optimized by Bart Van Assche and merged into upstream LIO based on his srpt-lio-4.1 branch here:
https://github.com/bvanassche/srpt-lio/commits/srpt-lio-4.1/
This updated patch also contains the following two changes from lio-core-2.6.git/master. One is to fix a bug with 1 >= task->task_sg[] chained mappings in ib_srpt, and the other to convert the configfs control plane to reference IB Port GUID and struct srpt_port directly following mainline v4.x target_core_fabric_configfs.c convertion for ib_srpt to work with rtslib/rtsadmin v2 code.
These seperate patches can be found here:
ib_srpt: Fix bug with chainged SGLs in srpt_map_sg_to_ib_sge
http://www.risingtidesystems.com/git/?p=lio-core-2.6.git;a=commitdiff;h=ea485147563b6555a97dbf811825fbb586519252
ib_srpt: Convert se_wwn endpoint reference to struct srpt_port->port_wwn
http://www.risingtidesystems.com/git/?p=lio-core-2.6.git;a=commitdiff;h=4e544a210acb227df1bb4ca5086e65bdf4e648ea
Note that this patch currently depends upon the target-core series for v3.2-rc1 currently in the queue, and will need to be merged ahead of this patch.
[PATCH 00/37] target: Updates for v3.2-rc1 (round one)
http://marc.info/?l=linux-scsi&m=131855299419466&w=2
Thank you,
--nab
--- drivers/infiniband/Kconfig | 1 + drivers/infiniband/Makefile | 1 + drivers/infiniband/ulp/srpt/Kconfig | 12 + drivers/infiniband/ulp/srpt/Makefile | 2 + drivers/infiniband/ulp/srpt/ib_dm_mad.h | 139 ++ drivers/infiniband/ulp/srpt/ib_srpt.c | 3979 +++++++++++++++++++++++++++++++ drivers/infiniband/ulp/srpt/ib_srpt.h | 409 ++++ 7 files changed, 4543 insertions(+), 0 deletions(-) create mode 100644 drivers/infiniband/ulp/srpt/Kconfig create mode 100644 drivers/infiniband/ulp/srpt/Makefile create mode 100644 drivers/infiniband/ulp/srpt/ib_dm_mad.h create mode 100644 drivers/infiniband/ulp/srpt/ib_srpt.c create mode 100644 drivers/infiniband/ulp/srpt/ib_srpt.h
drivers/infiniband/Kconfig +1 -0
@@ -55,6 +55,7 @@ source "drivers/infiniband/hw/nes/Kconfig" source "drivers/infiniband/ulp/ipoib/Kconfig" source "drivers/infiniband/ulp/srp/Kconfig" +source "drivers/infiniband/ulp/srpt/Kconfig" source "drivers/infiniband/ulp/iser/Kconfig"
drivers/infiniband/Makefile +1 -0
@@ -10,4 +10,5 @@ obj-$(CONFIG_MLX4_INFINIBAND) += hw/mlx4/ obj-$(CONFIG_INFINIBAND_NES) += hw/nes/ obj-$(CONFIG_INFINIBAND_IPOIB) += ulp/ipoib/ obj-$(CONFIG_INFINIBAND_SRP) += ulp/srp/ +obj-$(CONFIG_INFINIBAND_SRPT) += ulp/srpt/ obj-$(CONFIG_INFINIBAND_ISER) += ulp/iser/
drivers/infiniband/ulp/srpt/Kconfig new file +12 -0
@@ -0,0 +1,12 @@ +config INFINIBAND_SRPT + tristate "InfiniBand SCSI RDMA Protocol target support" + depends on INFINIBAND && TARGET_CORE + ---help--- + + Support for the SCSI RDMA Protocol (SRP) Target driver. The + SRP protocol is a protocol that allows an initiator to access + a block storage device on another host (target) over a network + that supports the RDMA protocol. Currently the RDMA protocol is + supported by InfiniBand and by iWarp network hardware. More + information about the SRP protocol can be found on the website + of the INCITS T10 technical committee (http://www.t10.org/).
drivers/infiniband/ulp/srpt/Makefile new file +2 -0
@@ -0,0 +1,2 @@ +ccflags-y := -Idrivers/target +obj-$(CONFIG_INFINIBAND_SRPT) += ib_srpt.o
drivers/infiniband/ulp/srpt/ib_dm_mad.h new file +139 -0
139 lines not on this page · raw message
drivers/infiniband/ulp/srpt/ib_srpt.c new file +3979 -0
2,835 lines not on this page · raw message
drivers/infiniband/ulp/srpt/ib_srpt.h new file +409 -0
409 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
1.5.6.5
Part of the diff is not shown here. View the raw message.
Quoted 4 lines · Nicholas A. Bellinger
This patch adds the kernel module
ib_srptSCSI RDMA Protocol (SRP) target implementation conforming to the SRP r16a specification for the mainlinedrivers/targetinfrastructure as requested by Christoph for an initial v3.2-rc1 merge.
Issues that have been fixed in the SCST source tree but not yet in the LIO source tree:
- Handling error completions for failed multipart RDMA transfers causes trouble (fixed in r3632 in the SCST repository).
- srpt_map can cause memory corruption (fixed in r3262 in the SCST repository).
Issues introduced in the LIO source tree:
- Using 128 bits for identifying a port seems overkill to me - 64 bits is sufficient. Also, there is no guarantee that the formula used for computing the port GID (node GUID + port number) will match the port GID.
- srpt_make_nodeacl() returns 0 instead of an error code if srpt_alloc_fabric_acl() fails.
- The headers of srpt_make_tport() and srpt_drop_tport() should be updated such that these read "$driver/$port" instead of "$driver/$target".
Bart.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 7 lines · Bart Van Assche
Quoted 4 lines · Nicholas A. Bellinger
This patch adds the kernel module
ib_srptSCSI RDMA Protocol (SRP) target implementation conforming to the SRP r16a specification for the mainlinedrivers/targetinfrastructure as requested by Christoph for an initial v3.2-rc1 merge.
Quoted 6 lines
Issues that have been fixed in the SCST source tree but not yet in the LIO source tree:
- Handling error completions for failed multipart RDMA transfers causes trouble (fixed in r3632 in the SCST repository).
-srpt_mapcan cause memory corruption (fixed in r3262 in the SCST repository).
OK thanks for the update here.. I'll have a look at getting these two bugfixes merged into lio-core-2.6.git and respun for an initial ib_srpt merge.
Quoted 3 lines
Issues introduced in the LIO source tree:
- Using 128 bits for identifying a port seems overkill to me - 64 bits is sufficient.
Well, the reason I used 128 bits for the port name is because your original patch used 128 bits for the explict Node ACL port name and I wanted things to be consistent.
That said, using rtslib + targetcli these are automatically extracted from /sys/class/infiniband/*/ports/*/gids/0 via ib_srpt.spec here:
so the end-user does not actually have to type the target port name in manually, ever. I'd much rather keep these two consistent with 128 bit port names following your original code, and let rtslib do the extra formatting as necessary.
Quoted 3 lines
Also, there is no guarantee that the formula used for
computing the port GID (node GUID + port number) will match the port GID.
Not sure what you mean here. Can you be more specific..?
Quoted 2 lines
-
srpt_make_nodeacl()returns 0 instead of an error code ifsrpt_alloc_fabric_acl()fails.
Ok, will get this fixed up..
Quoted 4 lines
- The headers of
srpt_make_tport()andsrpt_drop_tport()should be updated such that these read "$driver/$port" instead of "$driver/$target".
Will do.
Thanks for the feedback!
--nab
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 2 lines · Nicholas A. Bellinger
On Wed, 2011-10-19 at 19:56 +0200, Bart Van Assche wrote:
Not sure what you mean here. Can you be more specific..?
I'm referring to this code:
sprintf(sport->port_guid, "0x0000000000000000%04x%04x%04x%04x",
be16_to_cpu(((__be16 *)&device->node_guid)[0]),
be16_to_cpu(((__be16 *)&device->node_guid)[1]),
be16_to_cpu(((__be16 *)&device->node_guid)[2]),
be16_to_cpu(((__be16*)&device->node_guid)[3]) + i);
There is no guarantee that the above formula will match the numbers assigned by the HCA manufacturer. Also, what will happen if for the last two digits the sum exceeds 2**16 ?
I would like to see the above code to be replaced by something like the following:
snprintf(sport->port_guid, sizeof(sport->port_guid), "0x%016llx",
be64_to_cpu(sport->gid.global.interface_id));Please note that in the InfiniBand Architecture Manual the words "port GUID" refer to a manufacturer-assigned EUI-64. So if you are going to use the name "port GUID" for an 128-bit quantity I'm afraid you are going to really confuse some people.
Bart.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 18 lines · Bart Van Assche
Quoted 2 lines · Nicholas A. Bellinger
On Wed, 2011-10-19 at 19:56 +0200, Bart Van Assche wrote:
Not sure what you mean here. Can you be more specific..?I'm referring to this code:
sprintf(sport->port_guid, "0x0000000000000000%04x%04x%04x%04x", be16_to_cpu(((__be16 *)&device->node_guid)[0]), be16_to_cpu(((__be16 *)&device->node_guid)[1]), be16_to_cpu(((__be16 *)&device->node_guid)[2]), be16_to_cpu(((__be16*)&device->node_guid)[3]) + i);
There is no guarantee that the above formula will match the numbers assigned by the HCA manufacturer. Also, what will happen if for the last two digits the sum exceeds 2**16 ?
Quoted 6 lines
I would like to see the above code to be replaced by something like the following:
snprintf(sport->port_guid, sizeof(sport->port_guid), "0x%016llx", be64_to_cpu(sport->gid.global.interface_id));
Ok, but just to verify.. This change will still allow us to differentiate between different struct srpt_port entries from the perspective of configfs, correct..? This was the reasoning behind the '+ i' offset above, so that we can define an struct se_wwn endpoint for each physical HCA port <-> struct srpt_port mapping..
Are sport->gid.global.interface_id going to be different for each struct srpt_port..?
Quoted 5 lines
Please note that in the InfiniBand Architecture Manual the words "port GUID" refer to a manufacturer-assigned EUI-64. So if you are going to use the name "port GUID" for an 128-bit quantity I'm afraid you are going to really confuse some people.
Like I said before, the reason the 128 bit port name was used is to be consistent with your original explict NodeACL code that uses the same type of formatting..
Also, this is the same format (minus the fe00 prefix and colon seperators) that it comes out of /sys/class/infiniband/*/ports/*/gids/0 that rtslib uses to determine which ports are available.. Obviously we can add any type of sed formatting to wwn_from_files_filter in ib_srpt.spec, but I still don't see why this should be different in configfs from what /sys/class/infiniband/*/ports/*/gids/0 is already doing..?
--nab
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 2 lines · Nicholas A. Bellinger
Are
sport->gid.global.interface_idgoing to be different for each structsrpt_port..?
Infiniband GID suffixes (interface_id) are not guaranteed to be unique. The GID is expected to be unique, the portGUID (which is sometimes the same as the interface_id) is also expected to be unique.
Jason
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 8 lines · Jason Gunthorpe
Quoted 2 lines · Nicholas A. Bellinger
Are
sport->gid.global.interface_idgoing to be different for each structsrpt_port..?Infiniband GID suffixes (
interface_id) are not guaranteed to be unique. The GID is expected to be unique, the portGUID (which is sometimes the same as theinterface_id) is also expected to be unique.
... in general. But according to the InfiniBand Architecture Manual the suffix of GID 0 is always identical to the port GUID. A quote from paragraph 4.1.1:
1) Each endport shall be assigned at least one unicast GID. The first unicast GID assigned shall be created using the manufacturer assigned EUI-64 identifier. This GID is referred to as GID index 0 and is formed by techniques 3(a) or 3(b) described below.
3) A unicast GID shall be created using one or more of the following mechanisms:
a) Concatenation of the default GID prefix with the manufacturer assigned EUI-64 identifier associated with an endport. This GID is referred to as the default GID.
b) Concatenation of a subnet manager assigned 64-bit GID prefix and the manufacturer assigned EUI-64 identifier associated with an endport.
Bart.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 3 lines · Nicholas A. Bellinger
Ok, but just to verify.. This change will still allow us to differentiate between different struct
srpt_portentries from the perspective of configfs, correct..?
Yes.
Quoted 7 lines
Also, this is the same format (minus the fe00 prefix and colon seperators) that it comes out of
/sys/class/infiniband/*/ports/*/gids/0that rtslib uses to determine which ports are available.. Obviously we can add any type of sed formatting towwn_from_files_filterin ib_srpt.spec, but I still don't see why this should be different in configfs from what/sys/class/infiniband/*/ports/*/gids/0is already doing..?
If you have a look at the output of the command ibv_devices -v (maintained by Roland), you will see that in the output of that command ports are identified by a 64-bit GUID.
Bart.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 3 lines · Bart Van Assche
If you have a look at the output of the command
ibv_devices-v (maintained by Roland), you will see that in the output of that command ports are identified by a 64-bit GUID.
Where would I see that? Seriously, I don't know where ibv_devices prints anything about ports. It lists device by "node GUID" which is a globally unique ID, but that is per-adapter (and of course 2-port adapters are very common).
It is true that every port does have a port GUID, but those are not used in most places -- typically we use a port GID. Again, it is true that GID table entry 0 must be formed by taking the subnet prefix (assigned by the subnet manager) and appending the port GUID.
To be honest I've kind of lost track of where this leads: what exactly are we trying to figure out how to identify?
- R.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 16 lines · Bart Van Assche
I'm referring to this code:
sprintf(sport->port_guid, "0x0000000000000000%04x%04x%04x%04x",
be16_to_cpu(((__be16 *)&device->node_guid)[0]),be16_to_cpu(((__be16 *)&device->node_guid)[1]),be16_to_cpu(((__be16 *)&device->node_guid)[2]),be16_to_cpu(((__be16 *)&device->node_guid)[3])+ i);There is no guarantee that the above formula will match the numbers assigned by the HCA manufacturer. Also, what will happen if for the last two digits the sum exceeds 2**16 ?
I would like to see the above code to be replaced by something like the following:
Quoted 7 lines
snprintf(sport->port_guid,
sizeof(sport->port_guid), "0x%016llx",be64_to_cpu(sport->gid.global.interface_id));Please note that in the InfiniBand Architecture Manual the words "port GUID" refer to a manufacturer-assigned EUI-64. So if you are going to use the name "port GUID" for an 128-bit quantity I'm afraid you are going to really confuse some people.
I agree that this looks broken. I think the most sensible thing to do would be to have a port_gid (GID, not GUID) and use GID table entry 0, rather than doing this math on node GUID (that I agree is totally bogus).
- R.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
drivers/infiniband/ulp/srpt/ib_srpt.c line 3809
Quoted 5 lines
drivers/infiniband/ulp/srpt/ib_srpt.c new file +5
-0+static void srpt_drop_tport (struct se_wwn *wwn) +{ + struct srpt_port *sport = container_of(wwn, struct srpt_port, port_wwn); + + pr_debug("drop_tport(%s\n", config_item_name(&sport->port_wwn.wwn_group.cg_item));
A minor comment: the above statement always never prints the port name
- it always prints the following:
ib_srpt drop_tport((null)
Bart.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 11 lines · Bart Van Assche
drivers/infiniband/ulp/srpt/ib_srpt.c line 3809
Quoted 5 lines
drivers/infiniband/ulp/srpt/ib_srpt.c new file +5
-0+static void srpt_drop_tport (struct se_wwn *wwn) +{ + struct srpt_port *sport = container_of(wwn, struct srpt_port, port_wwn); + +pr_debug ("drop_tport(%s\n" ,config_item_name (&sport->port_wwn.wwn_group.cg_item));A minor comment: the above statement always never prints the port name
- it always prints the following:
ib_srptdrop_tport((null)
This comes from modern target_fabric_drop_wwn() -> config_item_put() -> config_group_put() releasing the top level fabric config_group @ port->port_wwn.wwn_group before the last config_item_put() -> struct configfs_group_operations->drop_item() -> TFO->drop_wwn() -> srpt_drop_tport() has been invoked.
The informational config_item_name() also appears in a handful of other fabric TFO->drop_wwn() code, which is really left-over usage from pre v4 target_core_fabric_configfs.c days when struct config_group was setup and released directly by the fabrics.
Anyways, I'll go ahead and drop this legacy usage of config_item_name() tree-wide. Thanks for pointing this out.
--nab
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html