Commit ded7f1a1 authored by Ishai Rabinovitz's avatar Ishai Rabinovitz Committed by Roland Dreier

IB/srp: Add port/device attributes

Add local_ib_device and local_ib_port attributes to srp scsi_host.
These are needed when we want to connect to the same target through
multiple distinct ports.
Signed-off-by: default avatarIshai Rabinovitz <ishai@mellanox.co.il>
Signed-off-by: default avatarMichael S. Tsirkin <mst@mellanox.co.il>
Signed-off-by: default avatarRoland Dreier <rolandd@cisco.com>
parent 2a214182
...@@ -1449,12 +1449,28 @@ static ssize_t show_zero_req_lim(struct class_device *cdev, char *buf) ...@@ -1449,12 +1449,28 @@ static ssize_t show_zero_req_lim(struct class_device *cdev, char *buf)
return sprintf(buf, "%d\n", target->zero_req_lim); return sprintf(buf, "%d\n", target->zero_req_lim);
} }
static CLASS_DEVICE_ATTR(id_ext, S_IRUGO, show_id_ext, NULL); static ssize_t show_local_ib_port(struct class_device *cdev, char *buf)
static CLASS_DEVICE_ATTR(ioc_guid, S_IRUGO, show_ioc_guid, NULL); {
static CLASS_DEVICE_ATTR(service_id, S_IRUGO, show_service_id, NULL); struct srp_target_port *target = host_to_target(class_to_shost(cdev));
static CLASS_DEVICE_ATTR(pkey, S_IRUGO, show_pkey, NULL);
static CLASS_DEVICE_ATTR(dgid, S_IRUGO, show_dgid, NULL); return sprintf(buf, "%d\n", target->srp_host->port);
static CLASS_DEVICE_ATTR(zero_req_lim, S_IRUGO, show_zero_req_lim, NULL); }
static ssize_t show_local_ib_device(struct class_device *cdev, char *buf)
{
struct srp_target_port *target = host_to_target(class_to_shost(cdev));
return sprintf(buf, "%s\n", target->srp_host->dev->dev->name);
}
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 CLASS_DEVICE_ATTR(zero_req_lim, S_IRUGO, show_zero_req_lim, NULL);
static CLASS_DEVICE_ATTR(local_ib_port, S_IRUGO, show_local_ib_port, NULL);
static CLASS_DEVICE_ATTR(local_ib_device, S_IRUGO, show_local_ib_device, NULL);
static struct class_device_attribute *srp_host_attrs[] = { static struct class_device_attribute *srp_host_attrs[] = {
&class_device_attr_id_ext, &class_device_attr_id_ext,
...@@ -1463,6 +1479,8 @@ static struct class_device_attribute *srp_host_attrs[] = { ...@@ -1463,6 +1479,8 @@ static struct class_device_attribute *srp_host_attrs[] = {
&class_device_attr_pkey, &class_device_attr_pkey,
&class_device_attr_dgid, &class_device_attr_dgid,
&class_device_attr_zero_req_lim, &class_device_attr_zero_req_lim,
&class_device_attr_local_ib_port,
&class_device_attr_local_ib_device,
NULL NULL
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment