Commit daf0cd44 authored by Cathy Avery's avatar Cathy Avery Committed by Martin K. Petersen

scsi: storvsc: Add support for FC rport.

Included in the current storvsc driver for Hyper-V is the ability to
access luns on an FC fabric via a virtualized fiber channel adapter
exposed by the Hyper-V host. The driver also attaches to the FC
transport to allow host and port names to be published under
/sys/class/fc_host/hostX. Current customer tools running on the VM
require that these names be available in the well known standard
location under fc_host/hostX.

This patch stubs in an rport per fc_host and sets its rport role as
FC_PORT_ROLE_FCP_DUMMY_INITIATOR to indicate to the fc_transport that it
is a pseudo rport in order to scan the scsi stack via echo "- - -" >
/sys/class/scsi_host/hostX/scan.
Signed-off-by: default avatarCathy Avery <cavery@redhat.com>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 0c3ae266
...@@ -478,6 +478,9 @@ struct storvsc_device { ...@@ -478,6 +478,9 @@ struct storvsc_device {
*/ */
u64 node_name; u64 node_name;
u64 port_name; u64 port_name;
#if IS_ENABLED(CONFIG_SCSI_FC_ATTRS)
struct fc_rport *rport;
#endif
}; };
struct hv_host_device { struct hv_host_device {
...@@ -1814,19 +1817,27 @@ static int storvsc_probe(struct hv_device *device, ...@@ -1814,19 +1817,27 @@ static int storvsc_probe(struct hv_device *device,
target = (device->dev_instance.b[5] << 8 | target = (device->dev_instance.b[5] << 8 |
device->dev_instance.b[4]); device->dev_instance.b[4]);
ret = scsi_add_device(host, 0, target, 0); ret = scsi_add_device(host, 0, target, 0);
if (ret) { if (ret)
scsi_remove_host(host); goto err_out3;
goto err_out2;
}
} }
#if IS_ENABLED(CONFIG_SCSI_FC_ATTRS) #if IS_ENABLED(CONFIG_SCSI_FC_ATTRS)
if (host->transportt == fc_transport_template) { if (host->transportt == fc_transport_template) {
struct fc_rport_identifiers ids = {
.roles = FC_PORT_ROLE_FCP_DUMMY_INITIATOR,
};
fc_host_node_name(host) = stor_device->node_name; fc_host_node_name(host) = stor_device->node_name;
fc_host_port_name(host) = stor_device->port_name; fc_host_port_name(host) = stor_device->port_name;
stor_device->rport = fc_remote_port_add(host, 0, &ids);
if (!stor_device->rport)
goto err_out3;
} }
#endif #endif
return 0; return 0;
err_out3:
scsi_remove_host(host);
err_out2: err_out2:
/* /*
* Once we have connected with the host, we would need to * Once we have connected with the host, we would need to
...@@ -1852,8 +1863,10 @@ static int storvsc_remove(struct hv_device *dev) ...@@ -1852,8 +1863,10 @@ static int storvsc_remove(struct hv_device *dev)
struct Scsi_Host *host = stor_device->host; struct Scsi_Host *host = stor_device->host;
#if IS_ENABLED(CONFIG_SCSI_FC_ATTRS) #if IS_ENABLED(CONFIG_SCSI_FC_ATTRS)
if (host->transportt == fc_transport_template) if (host->transportt == fc_transport_template) {
fc_remote_port_delete(stor_device->rport);
fc_remove_host(host); fc_remove_host(host);
}
#endif #endif
scsi_remove_host(host); scsi_remove_host(host);
storvsc_dev_remove(dev); storvsc_dev_remove(dev);
......
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