aboutsummaryrefslogtreecommitdiffstats
path: root/include/scsi/scsi_transport_fc.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/scsi/scsi_transport_fc.h')
-rw-r--r--include/scsi/scsi_transport_fc.h80
1 files changed, 68 insertions, 12 deletions
diff --git a/include/scsi/scsi_transport_fc.h b/include/scsi/scsi_transport_fc.h
index 6d28b0317657..fd352323378b 100644
--- a/include/scsi/scsi_transport_fc.h
+++ b/include/scsi/scsi_transport_fc.h
@@ -29,6 +29,7 @@
29 29
30#include <linux/sched.h> 30#include <linux/sched.h>
31#include <scsi/scsi.h> 31#include <scsi/scsi.h>
32#include <scsi/scsi_netlink.h>
32 33
33struct scsi_transport_template; 34struct scsi_transport_template;
34 35
@@ -194,6 +195,7 @@ struct fc_rport { /* aka fc_starget_attrs */
194 u32 roles; 195 u32 roles;
195 enum fc_port_state port_state; /* Will only be ONLINE or UNKNOWN */ 196 enum fc_port_state port_state; /* Will only be ONLINE or UNKNOWN */
196 u32 scsi_target_id; 197 u32 scsi_target_id;
198 u32 fast_io_fail_tmo;
197 199
198 /* exported data */ 200 /* exported data */
199 void *dd_data; /* Used for driver-specific storage */ 201 void *dd_data; /* Used for driver-specific storage */
@@ -206,6 +208,7 @@ struct fc_rport { /* aka fc_starget_attrs */
206 struct device dev; 208 struct device dev;
207 struct work_struct dev_loss_work; 209 struct work_struct dev_loss_work;
208 struct work_struct scan_work; 210 struct work_struct scan_work;
211 struct work_struct fail_io_work;
209 struct work_struct stgt_delete_work; 212 struct work_struct stgt_delete_work;
210 struct work_struct rport_delete_work; 213 struct work_struct rport_delete_work;
211} __attribute__((aligned(sizeof(unsigned long)))); 214} __attribute__((aligned(sizeof(unsigned long))));
@@ -284,6 +287,30 @@ struct fc_host_statistics {
284 287
285 288
286/* 289/*
290 * FC Event Codes - Polled and Async, following FC HBAAPI v2.0 guidelines
291 */
292
293/*
294 * fc_host_event_code: If you alter this, you also need to alter
295 * scsi_transport_fc.c (for the ascii descriptions).
296 */
297enum fc_host_event_code {
298 FCH_EVT_LIP = 0x1,
299 FCH_EVT_LINKUP = 0x2,
300 FCH_EVT_LINKDOWN = 0x3,
301 FCH_EVT_LIPRESET = 0x4,
302 FCH_EVT_RSCN = 0x5,
303 FCH_EVT_ADAPTER_CHANGE = 0x103,
304 FCH_EVT_PORT_UNKNOWN = 0x200,
305 FCH_EVT_PORT_OFFLINE = 0x201,
306 FCH_EVT_PORT_ONLINE = 0x202,
307 FCH_EVT_PORT_FABRIC = 0x204,
308 FCH_EVT_LINK_UNKNOWN = 0x500,
309 FCH_EVT_VENDOR_UNIQUE = 0xffff,
310};
311
312
313/*
287 * FC Local Port (Host) Attributes 314 * FC Local Port (Host) Attributes
288 * 315 *
289 * Attributes are based on HBAAPI V2.0 definitions. 316 * Attributes are based on HBAAPI V2.0 definitions.
@@ -312,7 +339,6 @@ struct fc_host_attrs {
312 u64 permanent_port_name; 339 u64 permanent_port_name;
313 u32 supported_classes; 340 u32 supported_classes;
314 u8 supported_fc4s[FC_FC4_LIST_SIZE]; 341 u8 supported_fc4s[FC_FC4_LIST_SIZE];
315 char symbolic_name[FC_SYMBOLIC_NAME_SIZE];
316 u32 supported_speeds; 342 u32 supported_speeds;
317 u32 maxframe_size; 343 u32 maxframe_size;
318 char serial_number[FC_SERIAL_NUMBER_SIZE]; 344 char serial_number[FC_SERIAL_NUMBER_SIZE];
@@ -324,6 +350,8 @@ struct fc_host_attrs {
324 u8 active_fc4s[FC_FC4_LIST_SIZE]; 350 u8 active_fc4s[FC_FC4_LIST_SIZE];
325 u32 speed; 351 u32 speed;
326 u64 fabric_name; 352 u64 fabric_name;
353 char symbolic_name[FC_SYMBOLIC_NAME_SIZE];
354 char system_hostname[FC_SYMBOLIC_NAME_SIZE];
327 355
328 /* Private (Transport-managed) Attributes */ 356 /* Private (Transport-managed) Attributes */
329 enum fc_tgtid_binding_type tgtid_bind_type; 357 enum fc_tgtid_binding_type tgtid_bind_type;
@@ -354,8 +382,6 @@ struct fc_host_attrs {
354 (((struct fc_host_attrs *)(x)->shost_data)->supported_classes) 382 (((struct fc_host_attrs *)(x)->shost_data)->supported_classes)
355#define fc_host_supported_fc4s(x) \ 383#define fc_host_supported_fc4s(x) \
356 (((struct fc_host_attrs *)(x)->shost_data)->supported_fc4s) 384 (((struct fc_host_attrs *)(x)->shost_data)->supported_fc4s)
357#define fc_host_symbolic_name(x) \
358 (((struct fc_host_attrs *)(x)->shost_data)->symbolic_name)
359#define fc_host_supported_speeds(x) \ 385#define fc_host_supported_speeds(x) \
360 (((struct fc_host_attrs *)(x)->shost_data)->supported_speeds) 386 (((struct fc_host_attrs *)(x)->shost_data)->supported_speeds)
361#define fc_host_maxframe_size(x) \ 387#define fc_host_maxframe_size(x) \
@@ -374,6 +400,10 @@ struct fc_host_attrs {
374 (((struct fc_host_attrs *)(x)->shost_data)->speed) 400 (((struct fc_host_attrs *)(x)->shost_data)->speed)
375#define fc_host_fabric_name(x) \ 401#define fc_host_fabric_name(x) \
376 (((struct fc_host_attrs *)(x)->shost_data)->fabric_name) 402 (((struct fc_host_attrs *)(x)->shost_data)->fabric_name)
403#define fc_host_symbolic_name(x) \
404 (((struct fc_host_attrs *)(x)->shost_data)->symbolic_name)
405#define fc_host_system_hostname(x) \
406 (((struct fc_host_attrs *)(x)->shost_data)->system_hostname)
377#define fc_host_tgtid_bind_type(x) \ 407#define fc_host_tgtid_bind_type(x) \
378 (((struct fc_host_attrs *)(x)->shost_data)->tgtid_bind_type) 408 (((struct fc_host_attrs *)(x)->shost_data)->tgtid_bind_type)
379#define fc_host_rports(x) \ 409#define fc_host_rports(x) \
@@ -409,12 +439,17 @@ struct fc_function_template {
409 void (*get_host_active_fc4s)(struct Scsi_Host *); 439 void (*get_host_active_fc4s)(struct Scsi_Host *);
410 void (*get_host_speed)(struct Scsi_Host *); 440 void (*get_host_speed)(struct Scsi_Host *);
411 void (*get_host_fabric_name)(struct Scsi_Host *); 441 void (*get_host_fabric_name)(struct Scsi_Host *);
442 void (*get_host_symbolic_name)(struct Scsi_Host *);
443 void (*set_host_system_hostname)(struct Scsi_Host *);
412 444
413 struct fc_host_statistics * (*get_fc_host_stats)(struct Scsi_Host *); 445 struct fc_host_statistics * (*get_fc_host_stats)(struct Scsi_Host *);
414 void (*reset_fc_host_stats)(struct Scsi_Host *); 446 void (*reset_fc_host_stats)(struct Scsi_Host *);
415 447
416 int (*issue_fc_host_lip)(struct Scsi_Host *); 448 int (*issue_fc_host_lip)(struct Scsi_Host *);
417 449
450 void (*dev_loss_tmo_callbk)(struct fc_rport *);
451 void (*terminate_rport_io)(struct fc_rport *);
452
418 /* allocation lengths for host-specific data */ 453 /* allocation lengths for host-specific data */
419 u32 dd_fcrport_size; 454 u32 dd_fcrport_size;
420 455
@@ -445,7 +480,6 @@ struct fc_function_template {
445 unsigned long show_host_permanent_port_name:1; 480 unsigned long show_host_permanent_port_name:1;
446 unsigned long show_host_supported_classes:1; 481 unsigned long show_host_supported_classes:1;
447 unsigned long show_host_supported_fc4s:1; 482 unsigned long show_host_supported_fc4s:1;
448 unsigned long show_host_symbolic_name:1;
449 unsigned long show_host_supported_speeds:1; 483 unsigned long show_host_supported_speeds:1;
450 unsigned long show_host_maxframe_size:1; 484 unsigned long show_host_maxframe_size:1;
451 unsigned long show_host_serial_number:1; 485 unsigned long show_host_serial_number:1;
@@ -456,6 +490,8 @@ struct fc_function_template {
456 unsigned long show_host_active_fc4s:1; 490 unsigned long show_host_active_fc4s:1;
457 unsigned long show_host_speed:1; 491 unsigned long show_host_speed:1;
458 unsigned long show_host_fabric_name:1; 492 unsigned long show_host_fabric_name:1;
493 unsigned long show_host_symbolic_name:1;
494 unsigned long show_host_system_hostname:1;
459}; 495};
460 496
461 497
@@ -491,6 +527,25 @@ fc_remote_port_chkready(struct fc_rport *rport)
491 return result; 527 return result;
492} 528}
493 529
530static inline u64 wwn_to_u64(u8 *wwn)
531{
532 return (u64)wwn[0] << 56 | (u64)wwn[1] << 48 |
533 (u64)wwn[2] << 40 | (u64)wwn[3] << 32 |
534 (u64)wwn[4] << 24 | (u64)wwn[5] << 16 |
535 (u64)wwn[6] << 8 | (u64)wwn[7];
536}
537
538static inline void u64_to_wwn(u64 inm, u8 *wwn)
539{
540 wwn[0] = (inm >> 56) & 0xff;
541 wwn[1] = (inm >> 48) & 0xff;
542 wwn[2] = (inm >> 40) & 0xff;
543 wwn[3] = (inm >> 32) & 0xff;
544 wwn[4] = (inm >> 24) & 0xff;
545 wwn[5] = (inm >> 16) & 0xff;
546 wwn[6] = (inm >> 8) & 0xff;
547 wwn[7] = inm & 0xff;
548}
494 549
495struct scsi_transport_template *fc_attach_transport( 550struct scsi_transport_template *fc_attach_transport(
496 struct fc_function_template *); 551 struct fc_function_template *);
@@ -501,13 +556,14 @@ struct fc_rport *fc_remote_port_add(struct Scsi_Host *shost,
501void fc_remote_port_delete(struct fc_rport *rport); 556void fc_remote_port_delete(struct fc_rport *rport);
502void fc_remote_port_rolechg(struct fc_rport *rport, u32 roles); 557void fc_remote_port_rolechg(struct fc_rport *rport, u32 roles);
503int scsi_is_fc_rport(const struct device *); 558int scsi_is_fc_rport(const struct device *);
504 559u32 fc_get_event_number(void);
505static inline u64 wwn_to_u64(u8 *wwn) 560void fc_host_post_event(struct Scsi_Host *shost, u32 event_number,
506{ 561 enum fc_host_event_code event_code, u32 event_data);
507 return (u64)wwn[0] << 56 | (u64)wwn[1] << 48 | 562void fc_host_post_vendor_event(struct Scsi_Host *shost, u32 event_number,
508 (u64)wwn[2] << 40 | (u64)wwn[3] << 32 | 563 u32 data_len, char * data_buf, u64 vendor_id);
509 (u64)wwn[4] << 24 | (u64)wwn[5] << 16 | 564 /* Note: when specifying vendor_id to fc_host_post_vendor_event()
510 (u64)wwn[6] << 8 | (u64)wwn[7]; 565 * be sure to read the Vendor Type and ID formatting requirements
511} 566 * specified in scsi_netlink.h
567 */
512 568
513#endif /* SCSI_TRANSPORT_FC_H */ 569#endif /* SCSI_TRANSPORT_FC_H */