aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/scsi/scsi_fc_transport.txt36
-rw-r--r--drivers/scsi/scsi_transport_fc.c54
-rw-r--r--include/scsi/scsi_transport_fc.h23
3 files changed, 84 insertions, 29 deletions
diff --git a/Documentation/scsi/scsi_fc_transport.txt b/Documentation/scsi/scsi_fc_transport.txt
index 75143f0c23b6..38d324d62b25 100644
--- a/Documentation/scsi/scsi_fc_transport.txt
+++ b/Documentation/scsi/scsi_fc_transport.txt
@@ -436,6 +436,42 @@ Other:
436 was updated to remove all vports for the fc_host as well. 436 was updated to remove all vports for the fc_host as well.
437 437
438 438
439Transport supplied functions
440----------------------------
441
442The following functions are supplied by the FC-transport for use by LLDs.
443
444 fc_vport_create - create a vport
445 fc_vport_terminate - detach and remove a vport
446
447Details:
448
449/**
450 * fc_vport_create - Admin App or LLDD requests creation of a vport
451 * @shost: scsi host the virtual port is connected to.
452 * @ids: The world wide names, FC4 port roles, etc for
453 * the virtual port.
454 *
455 * Notes:
456 * This routine assumes no locks are held on entry.
457 */
458struct fc_vport *
459fc_vport_create(struct Scsi_Host *shost, struct fc_vport_identifiers *ids)
460
461/**
462 * fc_vport_terminate - Admin App or LLDD requests termination of a vport
463 * @vport: fc_vport to be terminated
464 *
465 * Calls the LLDD vport_delete() function, then deallocates and removes
466 * the vport from the shost and object tree.
467 *
468 * Notes:
469 * This routine assumes no locks are held on entry.
470 */
471int
472fc_vport_terminate(struct fc_vport *vport)
473
474
439Credits 475Credits
440======= 476=======
441The following people have contributed to this document: 477The following people have contributed to this document:
diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c
index 56823fd1fb84..cb971f0b784d 100644
--- a/drivers/scsi/scsi_transport_fc.c
+++ b/drivers/scsi/scsi_transport_fc.c
@@ -40,31 +40,7 @@
40 40
41static int fc_queue_work(struct Scsi_Host *, struct work_struct *); 41static int fc_queue_work(struct Scsi_Host *, struct work_struct *);
42static void fc_vport_sched_delete(struct work_struct *work); 42static void fc_vport_sched_delete(struct work_struct *work);
43 43static int fc_vport_setup(struct Scsi_Host *shost, int channel,
44/*
45 * This is a temporary carrier for creating a vport. It will eventually
46 * be replaced by a real message definition for sgio or netlink.
47 *
48 * fc_vport_identifiers: This set of data contains all elements
49 * to uniquely identify and instantiate a FC virtual port.
50 *
51 * Notes:
52 * symbolic_name: The driver is to append the symbolic_name string data
53 * to the symbolic_node_name data that it generates by default.
54 * the resulting combination should then be registered with the switch.
55 * It is expected that things like Xen may stuff a VM title into
56 * this field.
57 */
58struct fc_vport_identifiers {
59 u64 node_name;
60 u64 port_name;
61 u32 roles;
62 bool disable;
63 enum fc_port_type vport_type; /* only FC_PORTTYPE_NPIV allowed */
64 char symbolic_name[FC_VPORT_SYMBOLIC_NAMELEN];
65};
66
67static int fc_vport_create(struct Scsi_Host *shost, int channel,
68 struct device *pdev, struct fc_vport_identifiers *ids, 44 struct device *pdev, struct fc_vport_identifiers *ids,
69 struct fc_vport **vport); 45 struct fc_vport **vport);
70 46
@@ -1760,7 +1736,7 @@ store_fc_host_vport_create(struct device *dev, struct device_attribute *attr,
1760 vid.disable = false; /* always enabled */ 1736 vid.disable = false; /* always enabled */
1761 1737
1762 /* we only allow support on Channel 0 !!! */ 1738 /* we only allow support on Channel 0 !!! */
1763 stat = fc_vport_create(shost, 0, &shost->shost_gendev, &vid, &vport); 1739 stat = fc_vport_setup(shost, 0, &shost->shost_gendev, &vid, &vport);
1764 return stat ? stat : count; 1740 return stat ? stat : count;
1765} 1741}
1766static FC_DEVICE_ATTR(host, vport_create, S_IWUSR, NULL, 1742static FC_DEVICE_ATTR(host, vport_create, S_IWUSR, NULL,
@@ -3103,7 +3079,7 @@ fc_scsi_scan_rport(struct work_struct *work)
3103 3079
3104 3080
3105/** 3081/**
3106 * fc_vport_create - allocates and creates a FC virtual port. 3082 * fc_vport_setup - allocates and creates a FC virtual port.
3107 * @shost: scsi host the virtual port is connected to. 3083 * @shost: scsi host the virtual port is connected to.
3108 * @channel: Channel on shost port connected to. 3084 * @channel: Channel on shost port connected to.
3109 * @pdev: parent device for vport 3085 * @pdev: parent device for vport
@@ -3118,7 +3094,7 @@ fc_scsi_scan_rport(struct work_struct *work)
3118 * This routine assumes no locks are held on entry. 3094 * This routine assumes no locks are held on entry.
3119 */ 3095 */
3120static int 3096static int
3121fc_vport_create(struct Scsi_Host *shost, int channel, struct device *pdev, 3097fc_vport_setup(struct Scsi_Host *shost, int channel, struct device *pdev,
3122 struct fc_vport_identifiers *ids, struct fc_vport **ret_vport) 3098 struct fc_vport_identifiers *ids, struct fc_vport **ret_vport)
3123{ 3099{
3124 struct fc_host_attrs *fc_host = shost_to_fc_host(shost); 3100 struct fc_host_attrs *fc_host = shost_to_fc_host(shost);
@@ -3231,6 +3207,28 @@ delete_vport:
3231 return error; 3207 return error;
3232} 3208}
3233 3209
3210/**
3211 * fc_vport_create - Admin App or LLDD requests creation of a vport
3212 * @shost: scsi host the virtual port is connected to.
3213 * @channel: channel on shost port connected to.
3214 * @ids: The world wide names, FC4 port roles, etc for
3215 * the virtual port.
3216 *
3217 * Notes:
3218 * This routine assumes no locks are held on entry.
3219 */
3220struct fc_vport *
3221fc_vport_create(struct Scsi_Host *shost, int channel,
3222 struct fc_vport_identifiers *ids)
3223{
3224 int stat;
3225 struct fc_vport *vport;
3226
3227 stat = fc_vport_setup(shost, channel, &shost->shost_gendev,
3228 ids, &vport);
3229 return stat ? NULL : vport;
3230}
3231EXPORT_SYMBOL(fc_vport_create);
3234 3232
3235/** 3233/**
3236 * fc_vport_terminate - Admin App or LLDD requests termination of a vport 3234 * fc_vport_terminate - Admin App or LLDD requests termination of a vport
diff --git a/include/scsi/scsi_transport_fc.h b/include/scsi/scsi_transport_fc.h
index 878373c32ef7..21018a4df452 100644
--- a/include/scsi/scsi_transport_fc.h
+++ b/include/scsi/scsi_transport_fc.h
@@ -167,6 +167,26 @@ enum fc_tgtid_binding_type {
167struct device_attribute dev_attr_vport_##_name = \ 167struct device_attribute dev_attr_vport_##_name = \
168 __ATTR(_name,_mode,_show,_store) 168 __ATTR(_name,_mode,_show,_store)
169 169
170/*
171 * fc_vport_identifiers: This set of data contains all elements
172 * to uniquely identify and instantiate a FC virtual port.
173 *
174 * Notes:
175 * symbolic_name: The driver is to append the symbolic_name string data
176 * to the symbolic_node_name data that it generates by default.
177 * the resulting combination should then be registered with the switch.
178 * It is expected that things like Xen may stuff a VM title into
179 * this field.
180 */
181#define FC_VPORT_SYMBOLIC_NAMELEN 64
182struct fc_vport_identifiers {
183 u64 node_name;
184 u64 port_name;
185 u32 roles;
186 bool disable;
187 enum fc_port_type vport_type; /* only FC_PORTTYPE_NPIV allowed */
188 char symbolic_name[FC_VPORT_SYMBOLIC_NAMELEN];
189};
170 190
171/* 191/*
172 * FC Virtual Port Attributes 192 * FC Virtual Port Attributes
@@ -197,7 +217,6 @@ struct device_attribute dev_attr_vport_##_name = \
197 * managed by the transport w/o driver interaction. 217 * managed by the transport w/o driver interaction.
198 */ 218 */
199 219
200#define FC_VPORT_SYMBOLIC_NAMELEN 64
201struct fc_vport { 220struct fc_vport {
202 /* Fixed Attributes */ 221 /* Fixed Attributes */
203 222
@@ -732,6 +751,8 @@ void fc_host_post_vendor_event(struct Scsi_Host *shost, u32 event_number,
732 * be sure to read the Vendor Type and ID formatting requirements 751 * be sure to read the Vendor Type and ID formatting requirements
733 * specified in scsi_netlink.h 752 * specified in scsi_netlink.h
734 */ 753 */
754struct fc_vport *fc_vport_create(struct Scsi_Host *shost, int channel,
755 struct fc_vport_identifiers *);
735int fc_vport_terminate(struct fc_vport *vport); 756int fc_vport_terminate(struct fc_vport *vport);
736 757
737#endif /* SCSI_TRANSPORT_FC_H */ 758#endif /* SCSI_TRANSPORT_FC_H */