Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 21951
b: refs/heads/master
c: 6ecb0c8
h: refs/heads/master
i:
  21949: 60d4e57
  21947: 72ceb4f
  21943: bf1967d
  21935: a038764
  21919: 51358f9
  21887: fafa134
v: v3
  • Loading branch information
Roland Dreier committed Mar 20, 2006
1 parent 3633129 commit a1d1780
Show file tree
Hide file tree
Showing 2 changed files with 84 additions and 2 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: 87fd1a11ae91ab42fac978467667c61fee9f01da
refs/heads/master: 6ecb0c849625e830ab96495d473bb704812c30e1
84 changes: 83 additions & 1 deletion trunk/drivers/infiniband/ulp/srp/ib_srp.c
Original file line number Diff line number Diff line change
Expand Up @@ -1237,6 +1237,87 @@ static int srp_reset_host(struct scsi_cmnd *scmnd)
return ret;
}

static ssize_t show_id_ext(struct class_device *cdev, char *buf)
{
struct srp_target_port *target = host_to_target(class_to_shost(cdev));

if (target->state == SRP_TARGET_DEAD ||
target->state == SRP_TARGET_REMOVED)
return -ENODEV;

return sprintf(buf, "0x%016llx\n",
(unsigned long long) be64_to_cpu(target->id_ext));
}

static ssize_t show_ioc_guid(struct class_device *cdev, char *buf)
{
struct srp_target_port *target = host_to_target(class_to_shost(cdev));

if (target->state == SRP_TARGET_DEAD ||
target->state == SRP_TARGET_REMOVED)
return -ENODEV;

return sprintf(buf, "0x%016llx\n",
(unsigned long long) be64_to_cpu(target->ioc_guid));
}

static ssize_t show_service_id(struct class_device *cdev, char *buf)
{
struct srp_target_port *target = host_to_target(class_to_shost(cdev));

if (target->state == SRP_TARGET_DEAD ||
target->state == SRP_TARGET_REMOVED)
return -ENODEV;

return sprintf(buf, "0x%016llx\n",
(unsigned long long) be64_to_cpu(target->service_id));
}

static ssize_t show_pkey(struct class_device *cdev, char *buf)
{
struct srp_target_port *target = host_to_target(class_to_shost(cdev));

if (target->state == SRP_TARGET_DEAD ||
target->state == SRP_TARGET_REMOVED)
return -ENODEV;

return sprintf(buf, "0x%04x\n", be16_to_cpu(target->path.pkey));
}

static ssize_t show_dgid(struct class_device *cdev, char *buf)
{
struct srp_target_port *target = host_to_target(class_to_shost(cdev));

if (target->state == SRP_TARGET_DEAD ||
target->state == SRP_TARGET_REMOVED)
return -ENODEV;

return sprintf(buf, "%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x\n",
be16_to_cpu(((__be16 *) target->path.dgid.raw)[0]),
be16_to_cpu(((__be16 *) target->path.dgid.raw)[1]),
be16_to_cpu(((__be16 *) target->path.dgid.raw)[2]),
be16_to_cpu(((__be16 *) target->path.dgid.raw)[3]),
be16_to_cpu(((__be16 *) target->path.dgid.raw)[4]),
be16_to_cpu(((__be16 *) target->path.dgid.raw)[5]),
be16_to_cpu(((__be16 *) target->path.dgid.raw)[6]),
be16_to_cpu(((__be16 *) target->path.dgid.raw)[7]));
}

static CLASS_DEVICE_ATTR(id_ext, S_IRUGO, show_id_ext, NULL);
static CLASS_DEVICE_ATTR(ioc_guid, S_IRUGO, show_ioc_guid, NULL);
static CLASS_DEVICE_ATTR(service_id, S_IRUGO, show_service_id, NULL);
static CLASS_DEVICE_ATTR(pkey, S_IRUGO, show_pkey, NULL);
static CLASS_DEVICE_ATTR(dgid, S_IRUGO, show_dgid, NULL);

static struct class_device_attribute *srp_host_attrs[] = {
&class_device_attr_id_ext,
&class_device_attr_ioc_guid,
&class_device_attr_service_id,
&class_device_attr_pkey,
&class_device_attr_dgid,
NULL
};

static struct scsi_host_template srp_template = {
.module = THIS_MODULE,
.name = DRV_NAME,
Expand All @@ -1249,7 +1330,8 @@ static struct scsi_host_template srp_template = {
.this_id = -1,
.sg_tablesize = SRP_MAX_INDIRECT,
.cmd_per_lun = SRP_SQ_SIZE,
.use_clustering = ENABLE_CLUSTERING
.use_clustering = ENABLE_CLUSTERING,
.shost_attrs = srp_host_attrs
};

static int srp_add_target(struct srp_host *host, struct srp_target_port *target)
Expand Down

0 comments on commit a1d1780

Please sign in to comment.