提交 0c3ae266 编写于 作者: C Cathy Avery 提交者: Martin K. Petersen

scsi: scsi_transport_fc: Add dummy initiator role to rport

This patch allows scsi drivers that expose virturalized fibre channel
devices but that do not expose rports to successfully rescan the scsi
bus via echo "- - -" > /sys/class/scsi_host/hostX/scan.  Drivers can
create a pseudo rport and indicate FC_PORT_ROLE_FCP_DUMMY_INITIATOR as
the rport's role in fc_rport_identifiers. This insures that a valid
scsi_target_id is assigned to the newly created rport and it can meet
the requirements of fc_user_scan_tgt calling scsi_scan_target.
Signed-off-by: NCathy Avery <cavery@redhat.com>
Reviewed-by: NChristoph Hellwig <hch@lst.de>
Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
上级 25d1d50e
...@@ -289,9 +289,10 @@ static const struct { ...@@ -289,9 +289,10 @@ static const struct {
u32 value; u32 value;
char *name; char *name;
} fc_port_role_names[] = { } fc_port_role_names[] = {
{ FC_PORT_ROLE_FCP_TARGET, "FCP Target" }, { FC_PORT_ROLE_FCP_TARGET, "FCP Target" },
{ FC_PORT_ROLE_FCP_INITIATOR, "FCP Initiator" }, { FC_PORT_ROLE_FCP_INITIATOR, "FCP Initiator" },
{ FC_PORT_ROLE_IP_PORT, "IP Port" }, { FC_PORT_ROLE_IP_PORT, "IP Port" },
{ FC_PORT_ROLE_FCP_DUMMY_INITIATOR, "FCP Dummy Initiator" },
}; };
fc_bitfield_name_search(port_roles, fc_port_role_names) fc_bitfield_name_search(port_roles, fc_port_role_names)
...@@ -2628,7 +2629,8 @@ fc_remote_port_create(struct Scsi_Host *shost, int channel, ...@@ -2628,7 +2629,8 @@ fc_remote_port_create(struct Scsi_Host *shost, int channel,
spin_lock_irqsave(shost->host_lock, flags); spin_lock_irqsave(shost->host_lock, flags);
rport->number = fc_host->next_rport_number++; rport->number = fc_host->next_rport_number++;
if (rport->roles & FC_PORT_ROLE_FCP_TARGET) if ((rport->roles & FC_PORT_ROLE_FCP_TARGET) ||
(rport->roles & FC_PORT_ROLE_FCP_DUMMY_INITIATOR))
rport->scsi_target_id = fc_host->next_target_id++; rport->scsi_target_id = fc_host->next_target_id++;
else else
rport->scsi_target_id = -1; rport->scsi_target_id = -1;
......
...@@ -162,6 +162,7 @@ enum fc_tgtid_binding_type { ...@@ -162,6 +162,7 @@ enum fc_tgtid_binding_type {
#define FC_PORT_ROLE_FCP_TARGET 0x01 #define FC_PORT_ROLE_FCP_TARGET 0x01
#define FC_PORT_ROLE_FCP_INITIATOR 0x02 #define FC_PORT_ROLE_FCP_INITIATOR 0x02
#define FC_PORT_ROLE_IP_PORT 0x04 #define FC_PORT_ROLE_IP_PORT 0x04
#define FC_PORT_ROLE_FCP_DUMMY_INITIATOR 0x08
/* The following are for compatibility */ /* The following are for compatibility */
#define FC_RPORT_ROLE_UNKNOWN FC_PORT_ROLE_UNKNOWN #define FC_RPORT_ROLE_UNKNOWN FC_PORT_ROLE_UNKNOWN
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册