aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-15 11:19:33 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-15 11:19:33 -0400
commitdf3d80f5a5c74168be42788364d13cf6c83c7b9c (patch)
tree892a964c2fd28d028f2fb7471e8543d3f4006a58 /drivers/infiniband
parent3d06f7a5f74a813cee817c4b30b5e6f0398da0be (diff)
parentc8e91b0a8fc8493e3bf3efcb3c8f866e9453cf1c (diff)
Merge master.kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6: (207 commits) [SCSI] gdth: fix CONFIG_ISA build failure [SCSI] esp_scsi: remove __dev{init,exit} [SCSI] gdth: !use_sg cleanup and use of scsi accessors [SCSI] gdth: Move members from SCp to gdth_cmndinfo, stage 2 [SCSI] gdth: Setup proper per-command private data [SCSI] gdth: Remove gdth_ctr_tab[] [SCSI] gdth: switch to modern scsi host registration [SCSI] gdth: gdth_interrupt() gdth_get_status() & gdth_wait() fixes [SCSI] gdth: clean up host private data [SCSI] gdth: Remove virt hosts [SCSI] gdth: Reorder scsi_host_template intitializers [SCSI] gdth: kill gdth_{read,write}[bwl] wrappers [SCSI] gdth: Remove 2.4.x support, in-kernel changelog [SCSI] gdth: split out pci probing [SCSI] gdth: split out eisa probing [SCSI] gdth: split out isa probing gdth: Make one abuse of scsi_cmnd less obvious [SCSI] NCR5380: Use scsi_eh API for REQUEST_SENSE invocation [SCSI] usb storage: use scsi_eh API in REQUEST_SENSE execution [SCSI] scsi_error: Refactoring scsi_error to facilitate in synchronous REQUEST_SENSE ...
Diffstat (limited to 'drivers/infiniband')
-rw-r--r--drivers/infiniband/ulp/srp/Kconfig1
-rw-r--r--drivers/infiniband/ulp/srp/ib_srp.c28
2 files changed, 29 insertions, 0 deletions
diff --git a/drivers/infiniband/ulp/srp/Kconfig b/drivers/infiniband/ulp/srp/Kconfig
index 3432dce2952..c74ee963304 100644
--- a/drivers/infiniband/ulp/srp/Kconfig
+++ b/drivers/infiniband/ulp/srp/Kconfig
@@ -1,6 +1,7 @@
1config INFINIBAND_SRP 1config INFINIBAND_SRP
2 tristate "InfiniBand SCSI RDMA Protocol" 2 tristate "InfiniBand SCSI RDMA Protocol"
3 depends on SCSI 3 depends on SCSI
4 select SCSI_SRP_ATTRS
4 ---help--- 5 ---help---
5 Support for the SCSI RDMA Protocol over InfiniBand. This 6 Support for the SCSI RDMA Protocol over InfiniBand. This
6 allows you to access storage devices that speak SRP over 7 allows you to access storage devices that speak SRP over
diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c
index 9ccc63886d9..950228fb009 100644
--- a/drivers/infiniband/ulp/srp/ib_srp.c
+++ b/drivers/infiniband/ulp/srp/ib_srp.c
@@ -47,6 +47,7 @@
47#include <scsi/scsi_device.h> 47#include <scsi/scsi_device.h>
48#include <scsi/scsi_dbg.h> 48#include <scsi/scsi_dbg.h>
49#include <scsi/srp.h> 49#include <scsi/srp.h>
50#include <scsi/scsi_transport_srp.h>
50 51
51#include <rdma/ib_cache.h> 52#include <rdma/ib_cache.h>
52 53
@@ -86,6 +87,8 @@ static void srp_remove_one(struct ib_device *device);
86static void srp_completion(struct ib_cq *cq, void *target_ptr); 87static void srp_completion(struct ib_cq *cq, void *target_ptr);
87static int srp_cm_handler(struct ib_cm_id *cm_id, struct ib_cm_event *event); 88static int srp_cm_handler(struct ib_cm_id *cm_id, struct ib_cm_event *event);
88 89
90static struct scsi_transport_template *ib_srp_transport_template;
91
89static struct ib_client srp_client = { 92static struct ib_client srp_client = {
90 .name = "srp", 93 .name = "srp",
91 .add = srp_add_one, 94 .add = srp_add_one,
@@ -420,6 +423,7 @@ static void srp_remove_work(struct work_struct *work)
420 list_del(&target->list); 423 list_del(&target->list);
421 spin_unlock(&target->srp_host->target_lock); 424 spin_unlock(&target->srp_host->target_lock);
422 425
426 srp_remove_host(target->scsi_host);
423 scsi_remove_host(target->scsi_host); 427 scsi_remove_host(target->scsi_host);
424 ib_destroy_cm_id(target->cm_id); 428 ib_destroy_cm_id(target->cm_id);
425 srp_free_target_ib(target); 429 srp_free_target_ib(target);
@@ -1544,12 +1548,24 @@ static struct scsi_host_template srp_template = {
1544 1548
1545static int srp_add_target(struct srp_host *host, struct srp_target_port *target) 1549static int srp_add_target(struct srp_host *host, struct srp_target_port *target)
1546{ 1550{
1551 struct srp_rport_identifiers ids;
1552 struct srp_rport *rport;
1553
1547 sprintf(target->target_name, "SRP.T10:%016llX", 1554 sprintf(target->target_name, "SRP.T10:%016llX",
1548 (unsigned long long) be64_to_cpu(target->id_ext)); 1555 (unsigned long long) be64_to_cpu(target->id_ext));
1549 1556
1550 if (scsi_add_host(target->scsi_host, host->dev->dev->dma_device)) 1557 if (scsi_add_host(target->scsi_host, host->dev->dev->dma_device))
1551 return -ENODEV; 1558 return -ENODEV;
1552 1559
1560 memcpy(ids.port_id, &target->id_ext, 8);
1561 memcpy(ids.port_id + 8, &target->ioc_guid, 8);
1562 ids.roles = SRP_RPORT_ROLE_TARGET;
1563 rport = srp_rport_add(target->scsi_host, &ids);
1564 if (IS_ERR(rport)) {
1565 scsi_remove_host(target->scsi_host);
1566 return PTR_ERR(rport);
1567 }
1568
1553 spin_lock(&host->target_lock); 1569 spin_lock(&host->target_lock);
1554 list_add_tail(&target->list, &host->target_list); 1570 list_add_tail(&target->list, &host->target_list);
1555 spin_unlock(&host->target_lock); 1571 spin_unlock(&host->target_lock);
@@ -1775,6 +1791,7 @@ static ssize_t srp_create_target(struct class_device *class_dev,
1775 if (!target_host) 1791 if (!target_host)
1776 return -ENOMEM; 1792 return -ENOMEM;
1777 1793
1794 target_host->transportt = ib_srp_transport_template;
1778 target_host->max_lun = SRP_MAX_LUN; 1795 target_host->max_lun = SRP_MAX_LUN;
1779 target_host->max_cmd_len = sizeof ((struct srp_cmd *) (void *) 0L)->cdb; 1796 target_host->max_cmd_len = sizeof ((struct srp_cmd *) (void *) 0L)->cdb;
1780 1797
@@ -2054,10 +2071,18 @@ static void srp_remove_one(struct ib_device *device)
2054 kfree(srp_dev); 2071 kfree(srp_dev);
2055} 2072}
2056 2073
2074static struct srp_function_template ib_srp_transport_functions = {
2075};
2076
2057static int __init srp_init_module(void) 2077static int __init srp_init_module(void)
2058{ 2078{
2059 int ret; 2079 int ret;
2060 2080
2081 ib_srp_transport_template =
2082 srp_attach_transport(&ib_srp_transport_functions);
2083 if (!ib_srp_transport_template)
2084 return -ENOMEM;
2085
2061 srp_template.sg_tablesize = srp_sg_tablesize; 2086 srp_template.sg_tablesize = srp_sg_tablesize;
2062 srp_max_iu_len = (sizeof (struct srp_cmd) + 2087 srp_max_iu_len = (sizeof (struct srp_cmd) +
2063 sizeof (struct srp_indirect_buf) + 2088 sizeof (struct srp_indirect_buf) +
@@ -2066,6 +2091,7 @@ static int __init srp_init_module(void)
2066 ret = class_register(&srp_class); 2091 ret = class_register(&srp_class);
2067 if (ret) { 2092 if (ret) {
2068 printk(KERN_ERR PFX "couldn't register class infiniband_srp\n"); 2093 printk(KERN_ERR PFX "couldn't register class infiniband_srp\n");
2094 srp_release_transport(ib_srp_transport_template);
2069 return ret; 2095 return ret;
2070 } 2096 }
2071 2097
@@ -2074,6 +2100,7 @@ static int __init srp_init_module(void)
2074 ret = ib_register_client(&srp_client); 2100 ret = ib_register_client(&srp_client);
2075 if (ret) { 2101 if (ret) {
2076 printk(KERN_ERR PFX "couldn't register IB client\n"); 2102 printk(KERN_ERR PFX "couldn't register IB client\n");
2103 srp_release_transport(ib_srp_transport_template);
2077 ib_sa_unregister_client(&srp_sa_client); 2104 ib_sa_unregister_client(&srp_sa_client);
2078 class_unregister(&srp_class); 2105 class_unregister(&srp_class);
2079 return ret; 2106 return ret;
@@ -2087,6 +2114,7 @@ static void __exit srp_cleanup_module(void)
2087 ib_unregister_client(&srp_client); 2114 ib_unregister_client(&srp_client);
2088 ib_sa_unregister_client(&srp_sa_client); 2115 ib_sa_unregister_client(&srp_sa_client);
2089 class_unregister(&srp_class); 2116 class_unregister(&srp_class);
2117 srp_release_transport(ib_srp_transport_template);
2090} 2118}
2091 2119
2092module_init(srp_init_module); 2120module_init(srp_init_module);