Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 68799
b: refs/heads/master
c: 3236822
h: refs/heads/master
i:
  68797: 7e23024
  68795: 3e41be7
  68791: 02c1549
  68783: abbe729
  68767: 6f8c8d9
  68735: 1eae619
v: v3
  • Loading branch information
FUJITA Tomonori authored and James Bottomley committed Oct 12, 2007
1 parent 557e2da commit 3f76141
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 4d68041907b150b07640b607c6c626391cf3fe8b
refs/heads/master: 3236822b1c9b67ad10745d965515b528818f1120
1 change: 1 addition & 0 deletions trunk/drivers/infiniband/ulp/srp/Kconfig
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
config INFINIBAND_SRP
tristate "InfiniBand SCSI RDMA Protocol"
depends on SCSI
select SCSI_SRP_ATTRS
---help---
Support for the SCSI RDMA Protocol over InfiniBand. This
allows you to access storage devices that speak SRP over
Expand Down
27 changes: 27 additions & 0 deletions trunk/drivers/infiniband/ulp/srp/ib_srp.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
#include <scsi/scsi_device.h>
#include <scsi/scsi_dbg.h>
#include <scsi/srp.h>
#include <scsi/scsi_transport_srp.h>

#include <rdma/ib_cache.h>

Expand Down Expand Up @@ -90,6 +91,8 @@ static void srp_remove_one(struct ib_device *device);
static void srp_completion(struct ib_cq *cq, void *target_ptr);
static int srp_cm_handler(struct ib_cm_id *cm_id, struct ib_cm_event *event);

static struct scsi_transport_template *ib_srp_transport_template;

static struct ib_client srp_client = {
.name = "srp",
.add = srp_add_one,
Expand Down Expand Up @@ -405,6 +408,7 @@ static void srp_remove_work(struct work_struct *work)
list_del(&target->list);
spin_unlock(&target->srp_host->target_lock);

srp_remove_host(target->scsi_host);
scsi_remove_host(target->scsi_host);
ib_destroy_cm_id(target->cm_id);
srp_free_target_ib(target);
Expand Down Expand Up @@ -1530,12 +1534,23 @@ static struct scsi_host_template srp_template = {

static int srp_add_target(struct srp_host *host, struct srp_target_port *target)
{
struct srp_rport_identifiers ids;
struct srp_rport *rport;

sprintf(target->target_name, "SRP.T10:%016llX",
(unsigned long long) be64_to_cpu(target->id_ext));

if (scsi_add_host(target->scsi_host, host->dev->dev->dma_device))
return -ENODEV;

memcpy(ids.port_id, &target->id_ext, 8);
memcpy(ids.port_id + 8, &target->ioc_guid, 8);
rport = srp_rport_add(target->scsi_host, &ids);
if (IS_ERR(rport)) {
scsi_remove_host(target->scsi_host);
return PTR_ERR(rport);
}

spin_lock(&host->target_lock);
list_add_tail(&target->list, &host->target_list);
spin_unlock(&host->target_lock);
Expand Down Expand Up @@ -1760,6 +1775,7 @@ static ssize_t srp_create_target(struct class_device *class_dev,
if (!target_host)
return -ENOMEM;

target_host->transportt = ib_srp_transport_template;
target_host->max_lun = SRP_MAX_LUN;
target_host->max_cmd_len = sizeof ((struct srp_cmd *) (void *) 0L)->cdb;

Expand Down Expand Up @@ -2039,10 +2055,18 @@ static void srp_remove_one(struct ib_device *device)
kfree(srp_dev);
}

static struct srp_function_template ib_srp_transport_functions = {
};

static int __init srp_init_module(void)
{
int ret;

ib_srp_transport_template =
srp_attach_transport(&ib_srp_transport_functions);
if (!ib_srp_transport_template)
return -ENOMEM;

srp_template.sg_tablesize = srp_sg_tablesize;
srp_max_iu_len = (sizeof (struct srp_cmd) +
sizeof (struct srp_indirect_buf) +
Expand All @@ -2051,6 +2075,7 @@ static int __init srp_init_module(void)
ret = class_register(&srp_class);
if (ret) {
printk(KERN_ERR PFX "couldn't register class infiniband_srp\n");
srp_release_transport(ib_srp_transport_template);
return ret;
}

Expand All @@ -2059,6 +2084,7 @@ static int __init srp_init_module(void)
ret = ib_register_client(&srp_client);
if (ret) {
printk(KERN_ERR PFX "couldn't register IB client\n");
srp_release_transport(ib_srp_transport_template);
ib_sa_unregister_client(&srp_sa_client);
class_unregister(&srp_class);
return ret;
Expand All @@ -2072,6 +2098,7 @@ static void __exit srp_cleanup_module(void)
ib_unregister_client(&srp_client);
ib_sa_unregister_client(&srp_sa_client);
class_unregister(&srp_class);
srp_release_transport(ib_srp_transport_template);
}

module_init(srp_init_module);
Expand Down

0 comments on commit 3f76141

Please sign in to comment.