]> err.no Git - linux-2.6/blobdiff - drivers/scsi/scsi_transport_srp.c
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
[linux-2.6] / drivers / scsi / scsi_transport_srp.c
index 8e5b41ca181d435752d8e22b754672f20880d663..44a340bd937b9fb43752ccceb1427c25341f92bc 100644 (file)
@@ -30,7 +30,7 @@
 #include <scsi/scsi_host.h>
 #include <scsi/scsi_transport.h>
 #include <scsi/scsi_transport_srp.h>
-#include <scsi/scsi_tgt.h>
+#include "scsi_transport_srp_internal.h"
 
 struct srp_host_attrs {
        atomic_t next_port_id;
@@ -222,9 +222,10 @@ struct srp_rport *srp_rport_add(struct Scsi_Host *shost,
                return ERR_PTR(ret);
        }
 
-       if (ids->roles == SRP_RPORT_ROLE_INITIATOR) {
-               ret = scsi_tgt_it_nexus_create(shost, (unsigned long)rport,
-                                              rport->port_id);
+       if (shost->active_mode & MODE_TARGET &&
+           ids->roles == SRP_RPORT_ROLE_INITIATOR) {
+               ret = srp_tgt_it_nexus_create(shost, (unsigned long)rport,
+                                             rport->port_id);
                if (ret) {
                        device_del(&rport->dev);
                        transport_destroy_device(&rport->dev);
@@ -249,10 +250,11 @@ EXPORT_SYMBOL_GPL(srp_rport_add);
 void srp_rport_del(struct srp_rport *rport)
 {
        struct device *dev = &rport->dev;
+       struct Scsi_Host *shost = dev_to_shost(dev->parent);
 
-       if (rport->roles == SRP_RPORT_ROLE_INITIATOR)
-               scsi_tgt_it_nexus_destroy(dev_to_shost(dev->parent),
-                                         (unsigned long)rport);
+       if (shost->active_mode & MODE_TARGET &&
+           rport->roles == SRP_RPORT_ROLE_INITIATOR)
+               srp_tgt_it_nexus_destroy(shost, (unsigned long)rport);
 
        transport_remove_device(dev);
        device_del(dev);
@@ -280,10 +282,17 @@ void srp_remove_host(struct Scsi_Host *shost)
 }
 EXPORT_SYMBOL_GPL(srp_remove_host);
 
-static int srp_it_nexus_response(struct Scsi_Host *shost, u64 id, int result)
+static int srp_tsk_mgmt_response(struct Scsi_Host *shost, u64 nexus, u64 tm_id,
+                                int result)
 {
        struct srp_internal *i = to_srp_internal(shost->transportt);
-       return i->f->it_nexus_response(shost, id, result);
+       return i->f->tsk_mgmt_response(shost, nexus, tm_id, result);
+}
+
+static int srp_it_nexus_response(struct Scsi_Host *shost, u64 nexus, int result)
+{
+       struct srp_internal *i = to_srp_internal(shost->transportt);
+       return i->f->it_nexus_response(shost, nexus, result);
 }
 
 /**
@@ -300,6 +309,7 @@ srp_attach_transport(struct srp_function_template *ft)
        if (!i)
                return NULL;
 
+       i->t.tsk_mgmt_response = srp_tsk_mgmt_response;
        i->t.it_nexus_response = srp_it_nexus_response;
 
        i->t.host_size = sizeof(struct srp_host_attrs);