diff options
-rw-r--r-- | Documentation/scsi/scsi_fc_transport.txt | 126 | ||||
-rw-r--r-- | drivers/scsi/scsi_transport_fc.c | 59 | ||||
-rw-r--r-- | include/scsi/scsi_transport_fc.h | 13 |
3 files changed, 105 insertions, 93 deletions
diff --git a/Documentation/scsi/scsi_fc_transport.txt b/Documentation/scsi/scsi_fc_transport.txt index ab057afc757f..d403e46d8463 100644 --- a/Documentation/scsi/scsi_fc_transport.txt +++ b/Documentation/scsi/scsi_fc_transport.txt | |||
@@ -119,67 +119,67 @@ Vport Attributes: | |||
119 | 119 | ||
120 | The new fc_vport class object has the following attributes | 120 | The new fc_vport class object has the following attributes |
121 | 121 | ||
122 | node_name: Read_Only | 122 | node_name: Read_Only |
123 | The WWNN of the vport | 123 | The WWNN of the vport |
124 | 124 | ||
125 | port_name: Read_Only | 125 | port_name: Read_Only |
126 | The WWPN of the vport | 126 | The WWPN of the vport |
127 | 127 | ||
128 | roles: Read_Only | 128 | roles: Read_Only |
129 | Indicates the FC4 roles enabled on the vport. | 129 | Indicates the FC4 roles enabled on the vport. |
130 | 130 | ||
131 | symbolic_name: Read_Write | 131 | symbolic_name: Read_Write |
132 | A string, appended to the driver's symbolic port name string, which | 132 | A string, appended to the driver's symbolic port name string, which |
133 | is registered with the switch to identify the vport. For example, | 133 | is registered with the switch to identify the vport. For example, |
134 | a hypervisor could set this string to "Xen Domain 2 VM 5 Vport 2", | 134 | a hypervisor could set this string to "Xen Domain 2 VM 5 Vport 2", |
135 | and this set of identifiers can be seen on switch management screens | 135 | and this set of identifiers can be seen on switch management screens |
136 | to identify the port. | 136 | to identify the port. |
137 | 137 | ||
138 | vport_delete: Write_Only | 138 | vport_delete: Write_Only |
139 | When written with a "1", will tear down the vport. | 139 | When written with a "1", will tear down the vport. |
140 | 140 | ||
141 | vport_disable: Write_Only | 141 | vport_disable: Write_Only |
142 | When written with a "1", will transition the vport to a disabled. | 142 | When written with a "1", will transition the vport to a disabled. |
143 | state. The vport will still be instantiated with the Linux kernel, | 143 | state. The vport will still be instantiated with the Linux kernel, |
144 | but it will not be active on the FC link. | 144 | but it will not be active on the FC link. |
145 | When written with a "0", will enable the vport. | 145 | When written with a "0", will enable the vport. |
146 | 146 | ||
147 | vport_last_state: Read_Only | 147 | vport_last_state: Read_Only |
148 | Indicates the previous state of the vport. See the section below on | 148 | Indicates the previous state of the vport. See the section below on |
149 | "Vport States". | 149 | "Vport States". |
150 | 150 | ||
151 | vport_state: Read_Only | 151 | vport_state: Read_Only |
152 | Indicates the state of the vport. See the section below on | 152 | Indicates the state of the vport. See the section below on |
153 | "Vport States". | 153 | "Vport States". |
154 | 154 | ||
155 | vport_type: Read_Only | 155 | vport_type: Read_Only |
156 | Reflects the FC mechanism used to create the virtual port. | 156 | Reflects the FC mechanism used to create the virtual port. |
157 | Only NPIV is supported currently. | 157 | Only NPIV is supported currently. |
158 | 158 | ||
159 | 159 | ||
160 | For the fc_host class object, the following attributes are added for vports: | 160 | For the fc_host class object, the following attributes are added for vports: |
161 | 161 | ||
162 | max_npiv_vports: Read_Only | 162 | max_npiv_vports: Read_Only |
163 | Indicates the maximum number of NPIV-based vports that the | 163 | Indicates the maximum number of NPIV-based vports that the |
164 | driver/adapter can support on the fc_host. | 164 | driver/adapter can support on the fc_host. |
165 | 165 | ||
166 | npiv_vports_inuse: Read_Only | 166 | npiv_vports_inuse: Read_Only |
167 | Indicates how many NPIV-based vports have been instantiated on the | 167 | Indicates how many NPIV-based vports have been instantiated on the |
168 | fc_host. | 168 | fc_host. |
169 | 169 | ||
170 | vport_create: Write_Only | 170 | vport_create: Write_Only |
171 | A "simple" create interface to instantiate a vport on an fc_host. | 171 | A "simple" create interface to instantiate a vport on an fc_host. |
172 | A "<WWPN>:<WWNN>" string is written to the attribute. The transport | 172 | A "<WWPN>:<WWNN>" string is written to the attribute. The transport |
173 | then instantiates the vport object and calls the LLDD to create the | 173 | then instantiates the vport object and calls the LLDD to create the |
174 | vport with the role of FCP_Initiator. Each WWN is specified as 16 | 174 | vport with the role of FCP_Initiator. Each WWN is specified as 16 |
175 | hex characters and may *not* contain any prefixes (e.g. 0x, x, etc). | 175 | hex characters and may *not* contain any prefixes (e.g. 0x, x, etc). |
176 | 176 | ||
177 | vport_delete: Write_Only | 177 | vport_delete: Write_Only |
178 | A "simple" delete interface to teardown a vport. A "<WWPN>:<WWNN>" | 178 | A "simple" delete interface to teardown a vport. A "<WWPN>:<WWNN>" |
179 | string is written to the attribute. The transport will locate the | 179 | string is written to the attribute. The transport will locate the |
180 | vport on the fc_host with the same WWNs and tear it down. Each WWN | 180 | vport on the fc_host with the same WWNs and tear it down. Each WWN |
181 | is specified as 16 hex characters and may *not* contain any prefixes | 181 | is specified as 16 hex characters and may *not* contain any prefixes |
182 | (e.g. 0x, x, etc). | 182 | (e.g. 0x, x, etc). |
183 | 183 | ||
184 | 184 | ||
185 | Vport States: | 185 | Vport States: |
@@ -198,23 +198,23 @@ Vport States: | |||
198 | Once a vport has been instantiated with the kernel/LLDD, a vport state | 198 | Once a vport has been instantiated with the kernel/LLDD, a vport state |
199 | can be reported via the sysfs attribute. The following states exist: | 199 | can be reported via the sysfs attribute. The following states exist: |
200 | 200 | ||
201 | FC_VPORT_UNKNOWN - Unknown | 201 | FC_VPORT_UNKNOWN - Unknown |
202 | An temporary state, typically set only while the vport is being | 202 | An temporary state, typically set only while the vport is being |
203 | instantiated with the kernel and LLDD. | 203 | instantiated with the kernel and LLDD. |
204 | 204 | ||
205 | FC_VPORT_ACTIVE - Active | 205 | FC_VPORT_ACTIVE - Active |
206 | The vport has been successfully been created on the FC link. | 206 | The vport has been successfully been created on the FC link. |
207 | It is fully functional. | 207 | It is fully functional. |
208 | 208 | ||
209 | FC_VPORT_DISABLED - Disabled | 209 | FC_VPORT_DISABLED - Disabled |
210 | The vport instantiated, but "disabled". The vport is not instantiated | 210 | The vport instantiated, but "disabled". The vport is not instantiated |
211 | on the FC link. This is equivalent to a physical port with the | 211 | on the FC link. This is equivalent to a physical port with the |
212 | link "down". | 212 | link "down". |
213 | 213 | ||
214 | FC_VPORT_LINKDOWN - Linkdown | 214 | FC_VPORT_LINKDOWN - Linkdown |
215 | The vport is not operational as the physical link is not operational. | 215 | The vport is not operational as the physical link is not operational. |
216 | 216 | ||
217 | FC_VPORT_INITIALIZING - Initializing | 217 | FC_VPORT_INITIALIZING - Initializing |
218 | The vport is in the process of instantiating on the FC link. | 218 | The vport is in the process of instantiating on the FC link. |
219 | The LLDD will set this state just prior to starting the ELS traffic | 219 | The LLDD will set this state just prior to starting the ELS traffic |
220 | to create the vport. This state will persist until the vport is | 220 | to create the vport. This state will persist until the vport is |
@@ -222,65 +222,65 @@ Vport States: | |||
222 | (state is one of the values below). As this state is transitory, | 222 | (state is one of the values below). As this state is transitory, |
223 | it will not be preserved in the "vport_last_state". | 223 | it will not be preserved in the "vport_last_state". |
224 | 224 | ||
225 | FC_VPORT_NO_FABRIC_SUPP - No Fabric Support | 225 | FC_VPORT_NO_FABRIC_SUPP - No Fabric Support |
226 | The vport is not operational. One of the following conditions were | 226 | The vport is not operational. One of the following conditions were |
227 | encountered: | 227 | encountered: |
228 | - The FC topology is not Point-to-Point | 228 | - The FC topology is not Point-to-Point |
229 | - The FC port is not connected to an F_Port | 229 | - The FC port is not connected to an F_Port |
230 | - The F_Port has indicated that NPIV is not supported. | 230 | - The F_Port has indicated that NPIV is not supported. |
231 | 231 | ||
232 | FC_VPORT_NO_FABRIC_RSCS - No Fabric Resources | 232 | FC_VPORT_NO_FABRIC_RSCS - No Fabric Resources |
233 | The vport is not operational. The Fabric failed FDISC with a status | 233 | The vport is not operational. The Fabric failed FDISC with a status |
234 | indicating that it does not have sufficient resources to complete | 234 | indicating that it does not have sufficient resources to complete |
235 | the operation. | 235 | the operation. |
236 | 236 | ||
237 | FC_VPORT_FABRIC_LOGOUT - Fabric Logout | 237 | FC_VPORT_FABRIC_LOGOUT - Fabric Logout |
238 | The vport is not operational. The Fabric has LOGO'd the N_Port_ID | 238 | The vport is not operational. The Fabric has LOGO'd the N_Port_ID |
239 | associated with the vport. | 239 | associated with the vport. |
240 | 240 | ||
241 | FC_VPORT_FABRIC_REJ_WWN - Fabric Rejected WWN | 241 | FC_VPORT_FABRIC_REJ_WWN - Fabric Rejected WWN |
242 | The vport is not operational. The Fabric failed FDISC with a status | 242 | The vport is not operational. The Fabric failed FDISC with a status |
243 | indicating that the WWN's are not valid. | 243 | indicating that the WWN's are not valid. |
244 | 244 | ||
245 | FC_VPORT_FAILED - VPort Failed | 245 | FC_VPORT_FAILED - VPort Failed |
246 | The vport is not operational. This is a catchall for all other | 246 | The vport is not operational. This is a catchall for all other |
247 | error conditions. | 247 | error conditions. |
248 | 248 | ||
249 | 249 | ||
250 | The following state table indicates the different state transitions: | 250 | The following state table indicates the different state transitions: |
251 | 251 | ||
252 | State Event New State | 252 | State Event New State |
253 | -------------------------------------------------------------------- | 253 | -------------------------------------------------------------------- |
254 | n/a Initialization Unknown | 254 | n/a Initialization Unknown |
255 | Unknown: Link Down Linkdown | 255 | Unknown: Link Down Linkdown |
256 | Link Up & Loop No Fabric Support | 256 | Link Up & Loop No Fabric Support |
257 | Link Up & no Fabric No Fabric Support | 257 | Link Up & no Fabric No Fabric Support |
258 | Link Up & FLOGI response No Fabric Support | 258 | Link Up & FLOGI response No Fabric Support |
259 | indicates no NPIV support | 259 | indicates no NPIV support |
260 | Link Up & FDISC being sent Initializing | 260 | Link Up & FDISC being sent Initializing |
261 | Disable request Disable | 261 | Disable request Disable |
262 | Linkdown: Link Up Unknown | 262 | Linkdown: Link Up Unknown |
263 | Initializing: FDISC ACC Active | 263 | Initializing: FDISC ACC Active |
264 | FDISC LS_RJT w/ no resources No Fabric Resources | 264 | FDISC LS_RJT w/ no resources No Fabric Resources |
265 | FDISC LS_RJT w/ invalid Fabric Rejected WWN | 265 | FDISC LS_RJT w/ invalid Fabric Rejected WWN |
266 | pname or invalid nport_id | 266 | pname or invalid nport_id |
267 | FDISC LS_RJT failed for Vport Failed | 267 | FDISC LS_RJT failed for Vport Failed |
268 | other reasons | 268 | other reasons |
269 | Link Down Linkdown | 269 | Link Down Linkdown |
270 | Disable request Disable | 270 | Disable request Disable |
271 | Disable: Enable request Unknown | 271 | Disable: Enable request Unknown |
272 | Active: LOGO received from fabric Fabric Logout | 272 | Active: LOGO received from fabric Fabric Logout |
273 | Link Down Linkdown | 273 | Link Down Linkdown |
274 | Disable request Disable | 274 | Disable request Disable |
275 | Fabric Logout: Link still up Unknown | 275 | Fabric Logout: Link still up Unknown |
276 | 276 | ||
277 | The following 4 error states all have the same transitions: | 277 | The following 4 error states all have the same transitions: |
278 | No Fabric Support: | 278 | No Fabric Support: |
279 | No Fabric Resources: | 279 | No Fabric Resources: |
280 | Fabric Rejected WWN: | 280 | Fabric Rejected WWN: |
281 | Vport Failed: | 281 | Vport Failed: |
282 | Disable request Disable | 282 | Disable request Disable |
283 | Link goes down Linkdown | 283 | Link goes down Linkdown |
284 | 284 | ||
285 | 285 | ||
286 | Transport <-> LLDD Interfaces : | 286 | Transport <-> LLDD Interfaces : |
@@ -303,9 +303,9 @@ Vport Creation: | |||
303 | int vport_create(struct fc_vport *vport, bool disable) | 303 | int vport_create(struct fc_vport *vport, bool disable) |
304 | 304 | ||
305 | where: | 305 | where: |
306 | vport: Is the newly allocated vport object | 306 | vport: Is the newly allocated vport object |
307 | disable: If "true", the vport is to be created in a disabled stated. | 307 | disable: If "true", the vport is to be created in a disabled stated. |
308 | If "false", the vport is to be enabled upon creation. | 308 | If "false", the vport is to be enabled upon creation. |
309 | 309 | ||
310 | When a request is made to create a new vport (via sgio/netlink, or the | 310 | When a request is made to create a new vport (via sgio/netlink, or the |
311 | vport_create fc_host attribute), the transport will validate that the LLDD | 311 | vport_create fc_host attribute), the transport will validate that the LLDD |
@@ -342,7 +342,7 @@ Vport Creation: | |||
342 | - Validate Infrastructure: | 342 | - Validate Infrastructure: |
343 | - If the driver or adapter cannot support another vport, whether | 343 | - If the driver or adapter cannot support another vport, whether |
344 | due to improper firmware, (a lie about) max_npiv, or a lack of | 344 | due to improper firmware, (a lie about) max_npiv, or a lack of |
345 | some other resource - return VPCERR_UNSUPPORTED. | 345 | some other resource - return VPCERR_UNSUPPORTED. |
346 | - If the driver validates the WWN's against those already active on | 346 | - If the driver validates the WWN's against those already active on |
347 | the adapter and detects an overlap - return VPCERR_BAD_WWN. | 347 | the adapter and detects an overlap - return VPCERR_BAD_WWN. |
348 | - If the driver detects the topology is loop, non-fabric, or the | 348 | - If the driver detects the topology is loop, non-fabric, or the |
@@ -351,9 +351,9 @@ Vport Creation: | |||
351 | of memory conditions, return the respective negative Exxx error code. | 351 | of memory conditions, return the respective negative Exxx error code. |
352 | - If the role is FCP Initiator, the LLDD is to : | 352 | - If the role is FCP Initiator, the LLDD is to : |
353 | - Call scsi_host_alloc() to allocate a scsi_host for the vport. | 353 | - Call scsi_host_alloc() to allocate a scsi_host for the vport. |
354 | - Call scsi_add_host(new_shost, &vport->dev) to start the scsi_host | 354 | - Call scsi_add_host(new_shost, &vport->dev) to start the scsi_host |
355 | and bind it as a child of the vport device. | 355 | and bind it as a child of the vport device. |
356 | - Initializes the fc_host attribute values. | 356 | - Initializes the fc_host attribute values. |
357 | - Kick of further vport state transitions based on the disable flag and | 357 | - Kick of further vport state transitions based on the disable flag and |
358 | link state - and return success (zero). | 358 | link state - and return success (zero). |
359 | 359 | ||
@@ -376,9 +376,9 @@ Vport Disable/Enable: | |||
376 | int vport_disable(struct fc_vport *vport, bool disable) | 376 | int vport_disable(struct fc_vport *vport, bool disable) |
377 | 377 | ||
378 | where: | 378 | where: |
379 | vport: Is vport to to be enabled or disabled | 379 | vport: Is vport to to be enabled or disabled |
380 | disable: If "true", the vport is to be disabled. | 380 | disable: If "true", the vport is to be disabled. |
381 | If "false", the vport is to be enabled. | 381 | If "false", the vport is to be enabled. |
382 | 382 | ||
383 | When a request is made to change the disabled state on a vport, the | 383 | When a request is made to change the disabled state on a vport, the |
384 | transport will validate the request against the existing vport state. | 384 | transport will validate the request against the existing vport state. |
@@ -404,7 +404,7 @@ Vport Deletion: | |||
404 | int vport_delete(struct fc_vport *vport) | 404 | int vport_delete(struct fc_vport *vport) |
405 | 405 | ||
406 | where: | 406 | where: |
407 | vport: Is vport to delete | 407 | vport: Is vport to delete |
408 | 408 | ||
409 | When a request is made to delete a vport (via sgio/netlink, or via the | 409 | When a request is made to delete a vport (via sgio/netlink, or via the |
410 | fc_host or fc_vport vport_delete attributes), the transport will call | 410 | fc_host or fc_vport vport_delete attributes), the transport will call |
diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c index 217651468115..4953f0dca029 100644 --- a/drivers/scsi/scsi_transport_fc.c +++ b/drivers/scsi/scsi_transport_fc.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * FiberChannel transport specific attributes exported to sysfs. | 2 | * FiberChannel transport specific attributes exported to sysfs. |
3 | * | 3 | * |
4 | * Copyright (c) 2003 Silicon Graphics, Inc. All rights reserved. | 4 | * Copyright (c) 2003 Silicon Graphics, Inc. All rights reserved. |
@@ -22,6 +22,7 @@ | |||
22 | * Copyright (C) 2004-2007 James Smart, Emulex Corporation | 22 | * Copyright (C) 2004-2007 James Smart, Emulex Corporation |
23 | * Rewrite for host, target, device, and remote port attributes, | 23 | * Rewrite for host, target, device, and remote port attributes, |
24 | * statistics, and service functions... | 24 | * statistics, and service functions... |
25 | * Add vports, etc | ||
25 | * | 26 | * |
26 | */ | 27 | */ |
27 | #include <linux/module.h> | 28 | #include <linux/module.h> |
@@ -37,6 +38,7 @@ | |||
37 | #include "scsi_priv.h" | 38 | #include "scsi_priv.h" |
38 | 39 | ||
39 | static int fc_queue_work(struct Scsi_Host *, struct work_struct *); | 40 | static int fc_queue_work(struct Scsi_Host *, struct work_struct *); |
41 | static void fc_vport_sched_delete(struct work_struct *work); | ||
40 | 42 | ||
41 | /* | 43 | /* |
42 | * This is a temporary carrier for creating a vport. It will eventually | 44 | * This is a temporary carrier for creating a vport. It will eventually |
@@ -377,7 +379,7 @@ static int fc_host_setup(struct transport_container *tc, struct device *dev, | |||
377 | struct Scsi_Host *shost = dev_to_shost(dev); | 379 | struct Scsi_Host *shost = dev_to_shost(dev); |
378 | struct fc_host_attrs *fc_host = shost_to_fc_host(shost); | 380 | struct fc_host_attrs *fc_host = shost_to_fc_host(shost); |
379 | 381 | ||
380 | /* | 382 | /* |
381 | * Set default values easily detected by the midlayer as | 383 | * Set default values easily detected by the midlayer as |
382 | * failure cases. The scsi lldd is responsible for initializing | 384 | * failure cases. The scsi lldd is responsible for initializing |
383 | * all transport attributes to valid values per host. | 385 | * all transport attributes to valid values per host. |
@@ -1198,12 +1200,9 @@ store_fc_vport_delete(struct class_device *cdev, const char *buf, | |||
1198 | size_t count) | 1200 | size_t count) |
1199 | { | 1201 | { |
1200 | struct fc_vport *vport = transport_class_to_vport(cdev); | 1202 | struct fc_vport *vport = transport_class_to_vport(cdev); |
1201 | int stat; | 1203 | struct Scsi_Host *shost = vport_to_shost(vport); |
1202 | |||
1203 | stat = fc_vport_terminate(vport); | ||
1204 | if (stat) | ||
1205 | return stat; | ||
1206 | 1204 | ||
1205 | fc_queue_work(shost, &vport->vport_delete_work); | ||
1207 | return count; | 1206 | return count; |
1208 | } | 1207 | } |
1209 | static FC_CLASS_DEVICE_ATTR(vport, vport_delete, S_IWUSR, | 1208 | static FC_CLASS_DEVICE_ATTR(vport, vport_delete, S_IWUSR, |
@@ -1996,7 +1995,7 @@ fc_attach_transport(struct fc_function_template *ft) | |||
1996 | i->t.eh_timed_out = fc_timed_out; | 1995 | i->t.eh_timed_out = fc_timed_out; |
1997 | 1996 | ||
1998 | i->t.user_scan = fc_user_scan; | 1997 | i->t.user_scan = fc_user_scan; |
1999 | 1998 | ||
2000 | /* | 1999 | /* |
2001 | * Setup SCSI Target Attributes. | 2000 | * Setup SCSI Target Attributes. |
2002 | */ | 2001 | */ |
@@ -2215,23 +2214,12 @@ fc_remove_host(struct Scsi_Host *shost) | |||
2215 | struct workqueue_struct *work_q; | 2214 | struct workqueue_struct *work_q; |
2216 | struct fc_host_attrs *fc_host = shost_to_fc_host(shost); | 2215 | struct fc_host_attrs *fc_host = shost_to_fc_host(shost); |
2217 | unsigned long flags; | 2216 | unsigned long flags; |
2218 | int stat; | ||
2219 | 2217 | ||
2220 | spin_lock_irqsave(shost->host_lock, flags); | 2218 | spin_lock_irqsave(shost->host_lock, flags); |
2221 | 2219 | ||
2222 | /* Remove any vports */ | 2220 | /* Remove any vports */ |
2223 | list_for_each_entry_safe(vport, next_vport, &fc_host->vports, peers) { | 2221 | list_for_each_entry_safe(vport, next_vport, &fc_host->vports, peers) |
2224 | spin_unlock_irqrestore(shost->host_lock, flags); | 2222 | fc_queue_work(shost, &vport->vport_delete_work); |
2225 | /* this must be called synchronously */ | ||
2226 | stat = fc_vport_terminate(vport); | ||
2227 | spin_lock_irqsave(shost->host_lock, flags); | ||
2228 | if (stat) | ||
2229 | dev_printk(KERN_ERR, vport->dev.parent, | ||
2230 | "%s: %s could not be deleted created via " | ||
2231 | "shost%d channel %d\n", __FUNCTION__, | ||
2232 | vport->dev.bus_id, vport->shost->host_no, | ||
2233 | vport->channel); | ||
2234 | } | ||
2235 | 2223 | ||
2236 | /* Remove any remote ports */ | 2224 | /* Remove any remote ports */ |
2237 | list_for_each_entry_safe(rport, next_rport, | 2225 | list_for_each_entry_safe(rport, next_rport, |
@@ -2308,7 +2296,7 @@ fc_rport_final_delete(struct work_struct *work) | |||
2308 | unsigned long flags; | 2296 | unsigned long flags; |
2309 | 2297 | ||
2310 | /* | 2298 | /* |
2311 | * if a scan is pending, flush the SCSI Host work_q so that | 2299 | * if a scan is pending, flush the SCSI Host work_q so that |
2312 | * that we can reclaim the rport scan work element. | 2300 | * that we can reclaim the rport scan work element. |
2313 | */ | 2301 | */ |
2314 | if (rport->flags & FC_RPORT_SCAN_PENDING) | 2302 | if (rport->flags & FC_RPORT_SCAN_PENDING) |
@@ -2858,7 +2846,7 @@ EXPORT_SYMBOL(fc_remote_port_rolechg); | |||
2858 | * fc_timeout_deleted_rport - Timeout handler for a deleted remote port, | 2846 | * fc_timeout_deleted_rport - Timeout handler for a deleted remote port, |
2859 | * which we blocked, and has now failed to return | 2847 | * which we blocked, and has now failed to return |
2860 | * in the allotted time. | 2848 | * in the allotted time. |
2861 | * | 2849 | * |
2862 | * @work: rport target that failed to reappear in the allotted time. | 2850 | * @work: rport target that failed to reappear in the allotted time. |
2863 | **/ | 2851 | **/ |
2864 | static void | 2852 | static void |
@@ -3061,6 +3049,7 @@ fc_vport_create(struct Scsi_Host *shost, int channel, struct device *pdev, | |||
3061 | vport->shost = shost; | 3049 | vport->shost = shost; |
3062 | vport->channel = channel; | 3050 | vport->channel = channel; |
3063 | vport->flags = FC_VPORT_CREATING; | 3051 | vport->flags = FC_VPORT_CREATING; |
3052 | INIT_WORK(&vport->vport_delete_work, fc_vport_sched_delete); | ||
3064 | 3053 | ||
3065 | spin_lock_irqsave(shost->host_lock, flags); | 3054 | spin_lock_irqsave(shost->host_lock, flags); |
3066 | 3055 | ||
@@ -3207,8 +3196,30 @@ fc_vport_terminate(struct fc_vport *vport) | |||
3207 | } | 3196 | } |
3208 | EXPORT_SYMBOL(fc_vport_terminate); | 3197 | EXPORT_SYMBOL(fc_vport_terminate); |
3209 | 3198 | ||
3199 | /** | ||
3200 | * fc_vport_sched_delete - workq-based delete request for a vport | ||
3201 | * | ||
3202 | * @work: vport to be deleted. | ||
3203 | **/ | ||
3204 | static void | ||
3205 | fc_vport_sched_delete(struct work_struct *work) | ||
3206 | { | ||
3207 | struct fc_vport *vport = | ||
3208 | container_of(work, struct fc_vport, vport_delete_work); | ||
3209 | int stat; | ||
3210 | |||
3211 | stat = fc_vport_terminate(vport); | ||
3212 | if (stat) | ||
3213 | dev_printk(KERN_ERR, vport->dev.parent, | ||
3214 | "%s: %s could not be deleted created via " | ||
3215 | "shost%d channel %d - error %d\n", __FUNCTION__, | ||
3216 | vport->dev.bus_id, vport->shost->host_no, | ||
3217 | vport->channel, stat); | ||
3218 | } | ||
3219 | |||
3210 | 3220 | ||
3211 | MODULE_AUTHOR("Martin Hicks"); | 3221 | /* Original Author: Martin Hicks */ |
3222 | MODULE_AUTHOR("James Smart"); | ||
3212 | MODULE_DESCRIPTION("FC Transport Attributes"); | 3223 | MODULE_DESCRIPTION("FC Transport Attributes"); |
3213 | MODULE_LICENSE("GPL"); | 3224 | MODULE_LICENSE("GPL"); |
3214 | 3225 | ||
diff --git a/include/scsi/scsi_transport_fc.h b/include/scsi/scsi_transport_fc.h index 81ea7b4bf81e..a0d80bcaa93d 100644 --- a/include/scsi/scsi_transport_fc.h +++ b/include/scsi/scsi_transport_fc.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * FiberChannel transport specific attributes exported to sysfs. | 2 | * FiberChannel transport specific attributes exported to sysfs. |
3 | * | 3 | * |
4 | * Copyright (c) 2003 Silicon Graphics, Inc. All rights reserved. | 4 | * Copyright (c) 2003 Silicon Graphics, Inc. All rights reserved. |
@@ -104,7 +104,7 @@ enum fc_vport_state { | |||
104 | 104 | ||
105 | 105 | ||
106 | 106 | ||
107 | /* | 107 | /* |
108 | * FC Classes of Service | 108 | * FC Classes of Service |
109 | * Note: values are not enumerated, as they can be "or'd" together | 109 | * Note: values are not enumerated, as they can be "or'd" together |
110 | * for reporting (e.g. report supported_classes). If you alter this list, | 110 | * for reporting (e.g. report supported_classes). If you alter this list, |
@@ -117,7 +117,7 @@ enum fc_vport_state { | |||
117 | #define FC_COS_CLASS4 0x10 | 117 | #define FC_COS_CLASS4 0x10 |
118 | #define FC_COS_CLASS6 0x40 | 118 | #define FC_COS_CLASS6 0x40 |
119 | 119 | ||
120 | /* | 120 | /* |
121 | * FC Port Speeds | 121 | * FC Port Speeds |
122 | * Note: values are not enumerated, as they can be "or'd" together | 122 | * Note: values are not enumerated, as they can be "or'd" together |
123 | * for reporting (e.g. report supported_speeds). If you alter this list, | 123 | * for reporting (e.g. report supported_speeds). If you alter this list, |
@@ -223,6 +223,7 @@ struct fc_vport { | |||
223 | u8 flags; | 223 | u8 flags; |
224 | struct list_head peers; | 224 | struct list_head peers; |
225 | struct device dev; | 225 | struct device dev; |
226 | struct work_struct vport_delete_work; | ||
226 | } __attribute__((aligned(sizeof(unsigned long)))); | 227 | } __attribute__((aligned(sizeof(unsigned long)))); |
227 | 228 | ||
228 | /* bit field values for struct fc_vport "flags" field: */ | 229 | /* bit field values for struct fc_vport "flags" field: */ |
@@ -397,7 +398,7 @@ struct fc_host_statistics { | |||
397 | u64 prim_seq_protocol_err_count; | 398 | u64 prim_seq_protocol_err_count; |
398 | u64 invalid_tx_word_count; | 399 | u64 invalid_tx_word_count; |
399 | u64 invalid_crc_count; | 400 | u64 invalid_crc_count; |
400 | 401 | ||
401 | /* fc4 statistics (only FCP supported currently) */ | 402 | /* fc4 statistics (only FCP supported currently) */ |
402 | u64 fcp_input_requests; | 403 | u64 fcp_input_requests; |
403 | u64 fcp_output_requests; | 404 | u64 fcp_output_requests; |
@@ -592,11 +593,11 @@ struct fc_function_template { | |||
592 | u32 dd_fcrport_size; | 593 | u32 dd_fcrport_size; |
593 | u32 dd_fcvport_size; | 594 | u32 dd_fcvport_size; |
594 | 595 | ||
595 | /* | 596 | /* |
596 | * The driver sets these to tell the transport class it | 597 | * The driver sets these to tell the transport class it |
597 | * wants the attributes displayed in sysfs. If the show_ flag | 598 | * wants the attributes displayed in sysfs. If the show_ flag |
598 | * is not set, the attribute will be private to the transport | 599 | * is not set, the attribute will be private to the transport |
599 | * class | 600 | * class |
600 | */ | 601 | */ |
601 | 602 | ||
602 | /* remote port fixed attributes */ | 603 | /* remote port fixed attributes */ |