Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 68802
b: refs/heads/master
c: 62fe882
h: refs/heads/master
v: v3
  • Loading branch information
FUJITA Tomonori authored and James Bottomley committed Oct 12, 2007
1 parent 57a3cf8 commit c2cf86e
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 2c47f9efbedbe5749b6bb16e59bc11d6e460855f
refs/heads/master: 62fe88261b9d865264d857777cf58a0335513151
2 changes: 1 addition & 1 deletion trunk/drivers/scsi/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ source "drivers/scsi/libsas/Kconfig"

config SCSI_SRP_ATTRS
tristate "SRP Transport Attributes"
depends on SCSI
depends on SCSI && SCSI_TGT
help
If you wish to export transport-specific information about
each attached SRP device to sysfs, say Y.
Expand Down
24 changes: 24 additions & 0 deletions trunk/drivers/scsi/scsi_transport_srp.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
#include <scsi/scsi_host.h>
#include <scsi/scsi_transport.h>
#include <scsi/scsi_transport_srp.h>
#include <scsi/scsi_tgt.h>

struct srp_host_attrs {
atomic_t next_port_id;
Expand Down Expand Up @@ -221,6 +222,17 @@ 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 (ret) {
device_del(&rport->dev);
transport_destroy_device(&rport->dev);
put_device(&rport->dev);
return ERR_PTR(ret);
}
}

transport_add_device(&rport->dev);
transport_configure_device(&rport->dev);

Expand All @@ -238,6 +250,10 @@ void srp_rport_del(struct srp_rport *rport)
{
struct device *dev = &rport->dev;

if (rport->roles == SRP_RPORT_ROLE_INITIATOR)
scsi_tgt_it_nexus_destroy(dev_to_shost(dev->parent),
(unsigned long)rport);

transport_remove_device(dev);
device_del(dev);
transport_destroy_device(dev);
Expand All @@ -264,6 +280,12 @@ 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)
{
struct srp_internal *i = to_srp_internal(shost->transportt);
return i->f->it_nexus_response(shost, id, result);
}

/**
* srp_attach_transport -- instantiate SRP transport template
* @ft: SRP transport class function template
Expand All @@ -278,6 +300,8 @@ srp_attach_transport(struct srp_function_template *ft)
if (!i)
return NULL;

i->t.it_nexus_response = srp_it_nexus_response;

i->t.host_size = sizeof(struct srp_host_attrs);
i->t.host_attrs.ac.attrs = &i->host_attrs[0];
i->t.host_attrs.ac.class = &srp_host_class.class;
Expand Down
3 changes: 2 additions & 1 deletion trunk/include/scsi/scsi_transport_srp.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ struct srp_rport {
};

struct srp_function_template {
/* later */
/* for target drivers */
int (* it_nexus_response)(struct Scsi_Host *, u64, int);
};

extern struct scsi_transport_template *
Expand Down

0 comments on commit c2cf86e

Please sign in to comment.