4 * Interface to Linux SCSI midlayer.
6 * Copyright IBM Corporation 2002, 2010
9 #define KMSG_COMPONENT "zfcp"
10 #define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
12 #include <linux/types.h>
13 #include <linux/slab.h>
14 #include <scsi/fc/fc_fcp.h>
15 #include <scsi/scsi_eh.h>
16 #include <asm/atomic.h>
20 #include "zfcp_reqlist.h"
22 static unsigned int default_depth
= 32;
23 module_param_named(queue_depth
, default_depth
, uint
, 0600);
24 MODULE_PARM_DESC(queue_depth
, "Default queue depth for new SCSI devices");
26 static bool enable_dif
;
28 #ifdef CONFIG_ZFCP_DIF
29 module_param_named(dif
, enable_dif
, bool, 0600);
30 MODULE_PARM_DESC(dif
, "Enable DIF/DIX data integrity support");
33 static int zfcp_scsi_change_queue_depth(struct scsi_device
*sdev
, int depth
,
37 case SCSI_QDEPTH_DEFAULT
:
38 scsi_adjust_queue_depth(sdev
, scsi_get_tag_type(sdev
), depth
);
40 case SCSI_QDEPTH_QFULL
:
41 scsi_track_queue_full(sdev
, depth
);
43 case SCSI_QDEPTH_RAMP_UP
:
44 scsi_adjust_queue_depth(sdev
, scsi_get_tag_type(sdev
), depth
);
49 return sdev
->queue_depth
;
52 static void zfcp_scsi_slave_destroy(struct scsi_device
*sdpnt
)
54 struct zfcp_unit
*unit
= (struct zfcp_unit
*) sdpnt
->hostdata
;
56 put_device(&unit
->dev
);
59 static int zfcp_scsi_slave_configure(struct scsi_device
*sdp
)
61 if (sdp
->tagged_supported
)
62 scsi_adjust_queue_depth(sdp
, MSG_SIMPLE_TAG
, default_depth
);
64 scsi_adjust_queue_depth(sdp
, 0, 1);
68 static void zfcp_scsi_command_fail(struct scsi_cmnd
*scpnt
, int result
)
70 struct zfcp_adapter
*adapter
=
71 (struct zfcp_adapter
*) scpnt
->device
->host
->hostdata
[0];
73 set_host_byte(scpnt
, result
);
74 zfcp_dbf_scsi_fail_send(adapter
->dbf
, scpnt
);
75 scpnt
->scsi_done(scpnt
);
78 static int zfcp_scsi_queuecommand(struct scsi_cmnd
*scpnt
,
79 void (*done
) (struct scsi_cmnd
*))
81 struct zfcp_unit
*unit
;
82 struct zfcp_adapter
*adapter
;
83 int status
, scsi_result
, ret
;
84 struct fc_rport
*rport
= starget_to_rport(scsi_target(scpnt
->device
));
86 /* reset the status for this request */
88 scpnt
->host_scribble
= NULL
;
89 scpnt
->scsi_done
= done
;
92 * figure out adapter and target device
93 * (stored there by zfcp_scsi_slave_alloc)
95 adapter
= (struct zfcp_adapter
*) scpnt
->device
->host
->hostdata
[0];
96 unit
= scpnt
->device
->hostdata
;
98 scsi_result
= fc_remote_port_chkready(rport
);
99 if (unlikely(scsi_result
)) {
100 scpnt
->result
= scsi_result
;
101 zfcp_dbf_scsi_fail_send(adapter
->dbf
, scpnt
);
102 scpnt
->scsi_done(scpnt
);
106 status
= atomic_read(&unit
->status
);
107 if (unlikely(status
& ZFCP_STATUS_COMMON_ERP_FAILED
) &&
108 !(atomic_read(&unit
->port
->status
) &
109 ZFCP_STATUS_COMMON_ERP_FAILED
)) {
110 /* only unit access denied, but port is good
111 * not covered by FC transport, have to fail here */
112 zfcp_scsi_command_fail(scpnt
, DID_ERROR
);
116 if (unlikely(!(status
& ZFCP_STATUS_COMMON_UNBLOCKED
))) {
117 /* This could be either
118 * open unit pending: this is temporary, will result in
119 * open unit or ERP_FAILED, so retry command
120 * call to rport_delete pending: mimic retry from
121 * fc_remote_port_chkready until rport is BLOCKED
123 zfcp_scsi_command_fail(scpnt
, DID_IMM_RETRY
);
127 ret
= zfcp_fsf_send_fcp_command_task(unit
, scpnt
);
128 if (unlikely(ret
== -EBUSY
))
129 return SCSI_MLQUEUE_DEVICE_BUSY
;
130 else if (unlikely(ret
< 0))
131 return SCSI_MLQUEUE_HOST_BUSY
;
136 static struct zfcp_unit
*zfcp_unit_lookup(struct zfcp_adapter
*adapter
,
137 unsigned int id
, u64 lun
)
140 struct zfcp_port
*port
;
141 struct zfcp_unit
*unit
= NULL
;
143 read_lock_irqsave(&adapter
->port_list_lock
, flags
);
144 list_for_each_entry(port
, &adapter
->port_list
, list
) {
145 if (!port
->rport
|| (id
!= port
->rport
->scsi_target_id
))
147 unit
= zfcp_unit_find(port
, lun
);
151 read_unlock_irqrestore(&adapter
->port_list_lock
, flags
);
156 static int zfcp_scsi_slave_alloc(struct scsi_device
*sdp
)
158 struct zfcp_adapter
*adapter
;
159 struct zfcp_unit
*unit
;
162 adapter
= (struct zfcp_adapter
*) sdp
->host
->hostdata
[0];
166 int_to_scsilun(sdp
->lun
, (struct scsi_lun
*)&lun
);
167 unit
= zfcp_unit_lookup(adapter
, sdp
->id
, lun
);
169 sdp
->hostdata
= unit
;
177 static int zfcp_scsi_eh_abort_handler(struct scsi_cmnd
*scpnt
)
179 struct Scsi_Host
*scsi_host
= scpnt
->device
->host
;
180 struct zfcp_adapter
*adapter
=
181 (struct zfcp_adapter
*) scsi_host
->hostdata
[0];
182 struct zfcp_unit
*unit
= scpnt
->device
->hostdata
;
183 struct zfcp_fsf_req
*old_req
, *abrt_req
;
185 unsigned long old_reqid
= (unsigned long) scpnt
->host_scribble
;
186 int retval
= SUCCESS
, ret
;
190 /* avoid race condition between late normal completion and abort */
191 write_lock_irqsave(&adapter
->abort_lock
, flags
);
193 old_req
= zfcp_reqlist_find(adapter
->req_list
, old_reqid
);
195 write_unlock_irqrestore(&adapter
->abort_lock
, flags
);
196 zfcp_dbf_scsi_abort("lte1", adapter
->dbf
, scpnt
, NULL
,
198 return FAILED
; /* completion could be in progress */
200 old_req
->data
= NULL
;
202 /* don't access old fsf_req after releasing the abort_lock */
203 write_unlock_irqrestore(&adapter
->abort_lock
, flags
);
206 abrt_req
= zfcp_fsf_abort_fcp_command(old_reqid
, unit
);
210 zfcp_erp_wait(adapter
);
211 ret
= fc_block_scsi_eh(scpnt
);
214 if (!(atomic_read(&adapter
->status
) &
215 ZFCP_STATUS_COMMON_RUNNING
)) {
216 zfcp_dbf_scsi_abort("nres", adapter
->dbf
, scpnt
, NULL
,
224 wait_for_completion(&abrt_req
->completion
);
226 if (abrt_req
->status
& ZFCP_STATUS_FSFREQ_ABORTSUCCEEDED
)
228 else if (abrt_req
->status
& ZFCP_STATUS_FSFREQ_ABORTNOTNEEDED
)
234 zfcp_dbf_scsi_abort(dbf_tag
, adapter
->dbf
, scpnt
, abrt_req
, old_reqid
);
235 zfcp_fsf_req_free(abrt_req
);
239 static int zfcp_task_mgmt_function(struct scsi_cmnd
*scpnt
, u8 tm_flags
)
241 struct zfcp_unit
*unit
= scpnt
->device
->hostdata
;
242 struct zfcp_adapter
*adapter
= unit
->port
->adapter
;
243 struct zfcp_fsf_req
*fsf_req
= NULL
;
244 int retval
= SUCCESS
, ret
;
248 fsf_req
= zfcp_fsf_send_fcp_ctm(unit
, tm_flags
);
252 zfcp_erp_wait(adapter
);
253 ret
= fc_block_scsi_eh(scpnt
);
257 if (!(atomic_read(&adapter
->status
) &
258 ZFCP_STATUS_COMMON_RUNNING
)) {
259 zfcp_dbf_scsi_devreset("nres", tm_flags
, unit
, scpnt
);
266 wait_for_completion(&fsf_req
->completion
);
268 if (fsf_req
->status
& ZFCP_STATUS_FSFREQ_TMFUNCFAILED
) {
269 zfcp_dbf_scsi_devreset("fail", tm_flags
, unit
, scpnt
);
272 zfcp_dbf_scsi_devreset("okay", tm_flags
, unit
, scpnt
);
274 zfcp_fsf_req_free(fsf_req
);
278 static int zfcp_scsi_eh_device_reset_handler(struct scsi_cmnd
*scpnt
)
280 return zfcp_task_mgmt_function(scpnt
, FCP_TMF_LUN_RESET
);
283 static int zfcp_scsi_eh_target_reset_handler(struct scsi_cmnd
*scpnt
)
285 return zfcp_task_mgmt_function(scpnt
, FCP_TMF_TGT_RESET
);
288 static int zfcp_scsi_eh_host_reset_handler(struct scsi_cmnd
*scpnt
)
290 struct zfcp_unit
*unit
= scpnt
->device
->hostdata
;
291 struct zfcp_adapter
*adapter
= unit
->port
->adapter
;
294 zfcp_erp_adapter_reopen(adapter
, 0, "schrh_1", scpnt
);
295 zfcp_erp_wait(adapter
);
296 ret
= fc_block_scsi_eh(scpnt
);
303 int zfcp_adapter_scsi_register(struct zfcp_adapter
*adapter
)
305 struct ccw_dev_id dev_id
;
307 if (adapter
->scsi_host
)
310 ccw_device_get_id(adapter
->ccw_device
, &dev_id
);
311 /* register adapter as SCSI host with mid layer of SCSI stack */
312 adapter
->scsi_host
= scsi_host_alloc(&zfcp_data
.scsi_host_template
,
313 sizeof (struct zfcp_adapter
*));
314 if (!adapter
->scsi_host
) {
315 dev_err(&adapter
->ccw_device
->dev
,
316 "Registering the FCP device with the "
317 "SCSI stack failed\n");
321 /* tell the SCSI stack some characteristics of this adapter */
322 adapter
->scsi_host
->max_id
= 1;
323 adapter
->scsi_host
->max_lun
= 1;
324 adapter
->scsi_host
->max_channel
= 0;
325 adapter
->scsi_host
->unique_id
= dev_id
.devno
;
326 adapter
->scsi_host
->max_cmd_len
= 16; /* in struct fcp_cmnd */
327 adapter
->scsi_host
->transportt
= zfcp_data
.scsi_transport_template
;
329 adapter
->scsi_host
->hostdata
[0] = (unsigned long) adapter
;
331 if (scsi_add_host(adapter
->scsi_host
, &adapter
->ccw_device
->dev
)) {
332 scsi_host_put(adapter
->scsi_host
);
339 void zfcp_adapter_scsi_unregister(struct zfcp_adapter
*adapter
)
341 struct Scsi_Host
*shost
;
342 struct zfcp_port
*port
;
344 shost
= adapter
->scsi_host
;
348 read_lock_irq(&adapter
->port_list_lock
);
349 list_for_each_entry(port
, &adapter
->port_list
, list
)
351 read_unlock_irq(&adapter
->port_list_lock
);
353 fc_remove_host(shost
);
354 scsi_remove_host(shost
);
355 scsi_host_put(shost
);
356 adapter
->scsi_host
= NULL
;
361 static struct fc_host_statistics
*
362 zfcp_init_fc_host_stats(struct zfcp_adapter
*adapter
)
364 struct fc_host_statistics
*fc_stats
;
366 if (!adapter
->fc_stats
) {
367 fc_stats
= kmalloc(sizeof(*fc_stats
), GFP_KERNEL
);
370 adapter
->fc_stats
= fc_stats
; /* freed in adapter_release */
372 memset(adapter
->fc_stats
, 0, sizeof(*adapter
->fc_stats
));
373 return adapter
->fc_stats
;
376 static void zfcp_adjust_fc_host_stats(struct fc_host_statistics
*fc_stats
,
377 struct fsf_qtcb_bottom_port
*data
,
378 struct fsf_qtcb_bottom_port
*old
)
380 fc_stats
->seconds_since_last_reset
=
381 data
->seconds_since_last_reset
- old
->seconds_since_last_reset
;
382 fc_stats
->tx_frames
= data
->tx_frames
- old
->tx_frames
;
383 fc_stats
->tx_words
= data
->tx_words
- old
->tx_words
;
384 fc_stats
->rx_frames
= data
->rx_frames
- old
->rx_frames
;
385 fc_stats
->rx_words
= data
->rx_words
- old
->rx_words
;
386 fc_stats
->lip_count
= data
->lip
- old
->lip
;
387 fc_stats
->nos_count
= data
->nos
- old
->nos
;
388 fc_stats
->error_frames
= data
->error_frames
- old
->error_frames
;
389 fc_stats
->dumped_frames
= data
->dumped_frames
- old
->dumped_frames
;
390 fc_stats
->link_failure_count
= data
->link_failure
- old
->link_failure
;
391 fc_stats
->loss_of_sync_count
= data
->loss_of_sync
- old
->loss_of_sync
;
392 fc_stats
->loss_of_signal_count
=
393 data
->loss_of_signal
- old
->loss_of_signal
;
394 fc_stats
->prim_seq_protocol_err_count
=
395 data
->psp_error_counts
- old
->psp_error_counts
;
396 fc_stats
->invalid_tx_word_count
=
397 data
->invalid_tx_words
- old
->invalid_tx_words
;
398 fc_stats
->invalid_crc_count
= data
->invalid_crcs
- old
->invalid_crcs
;
399 fc_stats
->fcp_input_requests
=
400 data
->input_requests
- old
->input_requests
;
401 fc_stats
->fcp_output_requests
=
402 data
->output_requests
- old
->output_requests
;
403 fc_stats
->fcp_control_requests
=
404 data
->control_requests
- old
->control_requests
;
405 fc_stats
->fcp_input_megabytes
= data
->input_mb
- old
->input_mb
;
406 fc_stats
->fcp_output_megabytes
= data
->output_mb
- old
->output_mb
;
409 static void zfcp_set_fc_host_stats(struct fc_host_statistics
*fc_stats
,
410 struct fsf_qtcb_bottom_port
*data
)
412 fc_stats
->seconds_since_last_reset
= data
->seconds_since_last_reset
;
413 fc_stats
->tx_frames
= data
->tx_frames
;
414 fc_stats
->tx_words
= data
->tx_words
;
415 fc_stats
->rx_frames
= data
->rx_frames
;
416 fc_stats
->rx_words
= data
->rx_words
;
417 fc_stats
->lip_count
= data
->lip
;
418 fc_stats
->nos_count
= data
->nos
;
419 fc_stats
->error_frames
= data
->error_frames
;
420 fc_stats
->dumped_frames
= data
->dumped_frames
;
421 fc_stats
->link_failure_count
= data
->link_failure
;
422 fc_stats
->loss_of_sync_count
= data
->loss_of_sync
;
423 fc_stats
->loss_of_signal_count
= data
->loss_of_signal
;
424 fc_stats
->prim_seq_protocol_err_count
= data
->psp_error_counts
;
425 fc_stats
->invalid_tx_word_count
= data
->invalid_tx_words
;
426 fc_stats
->invalid_crc_count
= data
->invalid_crcs
;
427 fc_stats
->fcp_input_requests
= data
->input_requests
;
428 fc_stats
->fcp_output_requests
= data
->output_requests
;
429 fc_stats
->fcp_control_requests
= data
->control_requests
;
430 fc_stats
->fcp_input_megabytes
= data
->input_mb
;
431 fc_stats
->fcp_output_megabytes
= data
->output_mb
;
434 static struct fc_host_statistics
*zfcp_get_fc_host_stats(struct Scsi_Host
*host
)
436 struct zfcp_adapter
*adapter
;
437 struct fc_host_statistics
*fc_stats
;
438 struct fsf_qtcb_bottom_port
*data
;
441 adapter
= (struct zfcp_adapter
*)host
->hostdata
[0];
442 fc_stats
= zfcp_init_fc_host_stats(adapter
);
446 data
= kzalloc(sizeof(*data
), GFP_KERNEL
);
450 ret
= zfcp_fsf_exchange_port_data_sync(adapter
->qdio
, data
);
456 if (adapter
->stats_reset
&&
457 ((jiffies
/HZ
- adapter
->stats_reset
) <
458 data
->seconds_since_last_reset
))
459 zfcp_adjust_fc_host_stats(fc_stats
, data
,
460 adapter
->stats_reset_data
);
462 zfcp_set_fc_host_stats(fc_stats
, data
);
468 static void zfcp_reset_fc_host_stats(struct Scsi_Host
*shost
)
470 struct zfcp_adapter
*adapter
;
471 struct fsf_qtcb_bottom_port
*data
;
474 adapter
= (struct zfcp_adapter
*)shost
->hostdata
[0];
475 data
= kzalloc(sizeof(*data
), GFP_KERNEL
);
479 ret
= zfcp_fsf_exchange_port_data_sync(adapter
->qdio
, data
);
483 adapter
->stats_reset
= jiffies
/HZ
;
484 kfree(adapter
->stats_reset_data
);
485 adapter
->stats_reset_data
= data
; /* finally freed in
490 static void zfcp_get_host_port_state(struct Scsi_Host
*shost
)
492 struct zfcp_adapter
*adapter
=
493 (struct zfcp_adapter
*)shost
->hostdata
[0];
494 int status
= atomic_read(&adapter
->status
);
496 if ((status
& ZFCP_STATUS_COMMON_RUNNING
) &&
497 !(status
& ZFCP_STATUS_ADAPTER_LINK_UNPLUGGED
))
498 fc_host_port_state(shost
) = FC_PORTSTATE_ONLINE
;
499 else if (status
& ZFCP_STATUS_ADAPTER_LINK_UNPLUGGED
)
500 fc_host_port_state(shost
) = FC_PORTSTATE_LINKDOWN
;
501 else if (status
& ZFCP_STATUS_COMMON_ERP_FAILED
)
502 fc_host_port_state(shost
) = FC_PORTSTATE_ERROR
;
504 fc_host_port_state(shost
) = FC_PORTSTATE_UNKNOWN
;
507 static void zfcp_set_rport_dev_loss_tmo(struct fc_rport
*rport
, u32 timeout
)
509 rport
->dev_loss_tmo
= timeout
;
513 * zfcp_scsi_terminate_rport_io - Terminate all I/O on a rport
514 * @rport: The FC rport where to teminate I/O
516 * Abort all pending SCSI commands for a port by closing the
517 * port. Using a reopen avoids a conflict with a shutdown
518 * overwriting a reopen. The "forced" ensures that a disappeared port
519 * is not opened again as valid due to the cached plogi data in
522 static void zfcp_scsi_terminate_rport_io(struct fc_rport
*rport
)
524 struct zfcp_port
*port
;
525 struct Scsi_Host
*shost
= rport_to_shost(rport
);
526 struct zfcp_adapter
*adapter
=
527 (struct zfcp_adapter
*)shost
->hostdata
[0];
529 port
= zfcp_get_port_by_wwpn(adapter
, rport
->port_name
);
532 zfcp_erp_port_forced_reopen(port
, 0, "sctrpi1", NULL
);
533 put_device(&port
->dev
);
537 static void zfcp_scsi_rport_register(struct zfcp_port
*port
)
539 struct fc_rport_identifiers ids
;
540 struct fc_rport
*rport
;
545 ids
.node_name
= port
->wwnn
;
546 ids
.port_name
= port
->wwpn
;
547 ids
.port_id
= port
->d_id
;
548 ids
.roles
= FC_RPORT_ROLE_FCP_TARGET
;
550 rport
= fc_remote_port_add(port
->adapter
->scsi_host
, 0, &ids
);
552 dev_err(&port
->adapter
->ccw_device
->dev
,
553 "Registering port 0x%016Lx failed\n",
554 (unsigned long long)port
->wwpn
);
558 rport
->maxframe_size
= port
->maxframe_size
;
559 rport
->supported_classes
= port
->supported_classes
;
561 port
->starget_id
= rport
->scsi_target_id
;
563 zfcp_unit_queue_scsi_scan(port
);
566 static void zfcp_scsi_rport_block(struct zfcp_port
*port
)
568 struct fc_rport
*rport
= port
->rport
;
571 fc_remote_port_delete(rport
);
576 void zfcp_scsi_schedule_rport_register(struct zfcp_port
*port
)
578 get_device(&port
->dev
);
579 port
->rport_task
= RPORT_ADD
;
581 if (!queue_work(port
->adapter
->work_queue
, &port
->rport_work
))
582 put_device(&port
->dev
);
585 void zfcp_scsi_schedule_rport_block(struct zfcp_port
*port
)
587 get_device(&port
->dev
);
588 port
->rport_task
= RPORT_DEL
;
590 if (port
->rport
&& queue_work(port
->adapter
->work_queue
,
594 put_device(&port
->dev
);
597 void zfcp_scsi_schedule_rports_block(struct zfcp_adapter
*adapter
)
600 struct zfcp_port
*port
;
602 read_lock_irqsave(&adapter
->port_list_lock
, flags
);
603 list_for_each_entry(port
, &adapter
->port_list
, list
)
604 zfcp_scsi_schedule_rport_block(port
);
605 read_unlock_irqrestore(&adapter
->port_list_lock
, flags
);
608 void zfcp_scsi_rport_work(struct work_struct
*work
)
610 struct zfcp_port
*port
= container_of(work
, struct zfcp_port
,
613 while (port
->rport_task
) {
614 if (port
->rport_task
== RPORT_ADD
) {
615 port
->rport_task
= RPORT_NONE
;
616 zfcp_scsi_rport_register(port
);
618 port
->rport_task
= RPORT_NONE
;
619 zfcp_scsi_rport_block(port
);
623 put_device(&port
->dev
);
627 * zfcp_scsi_set_prot - Configure DIF/DIX support in scsi_host
628 * @adapter: The adapter where to configure DIF/DIX for the SCSI host
630 void zfcp_scsi_set_prot(struct zfcp_adapter
*adapter
)
632 unsigned int mask
= 0;
633 unsigned int data_div
;
634 struct Scsi_Host
*shost
= adapter
->scsi_host
;
636 data_div
= atomic_read(&adapter
->status
) &
637 ZFCP_STATUS_ADAPTER_DATA_DIV_ENABLED
;
640 adapter
->adapter_features
& FSF_FEATURE_DIF_PROT_TYPE1
)
641 mask
|= SHOST_DIF_TYPE1_PROTECTION
;
643 if (enable_dif
&& data_div
&&
644 adapter
->adapter_features
& FSF_FEATURE_DIX_PROT_TCPIP
) {
645 mask
|= SHOST_DIX_TYPE1_PROTECTION
;
646 scsi_host_set_guard(shost
, SHOST_DIX_GUARD_IP
);
647 shost
->sg_tablesize
= ZFCP_QDIO_MAX_SBALES_PER_REQ
/ 2;
648 shost
->max_sectors
= ZFCP_QDIO_MAX_SBALES_PER_REQ
* 8 / 2;
651 scsi_host_set_prot(shost
, mask
);
655 * zfcp_scsi_dif_sense_error - Report DIF/DIX error as driver sense error
656 * @scmd: The SCSI command to report the error for
657 * @ascq: The ASCQ to put in the sense buffer
659 * See the error handling in sd_done for the sense codes used here.
660 * Set DID_SOFT_ERROR to retry the request, if possible.
662 void zfcp_scsi_dif_sense_error(struct scsi_cmnd
*scmd
, int ascq
)
664 scsi_build_sense_buffer(1, scmd
->sense_buffer
,
665 ILLEGAL_REQUEST
, 0x10, ascq
);
666 set_driver_byte(scmd
, DRIVER_SENSE
);
667 scmd
->result
|= SAM_STAT_CHECK_CONDITION
;
668 set_host_byte(scmd
, DID_SOFT_ERROR
);
671 struct fc_function_template zfcp_transport_functions
= {
672 .show_starget_port_id
= 1,
673 .show_starget_port_name
= 1,
674 .show_starget_node_name
= 1,
675 .show_rport_supported_classes
= 1,
676 .show_rport_maxframe_size
= 1,
677 .show_rport_dev_loss_tmo
= 1,
678 .show_host_node_name
= 1,
679 .show_host_port_name
= 1,
680 .show_host_permanent_port_name
= 1,
681 .show_host_supported_classes
= 1,
682 .show_host_supported_fc4s
= 1,
683 .show_host_supported_speeds
= 1,
684 .show_host_maxframe_size
= 1,
685 .show_host_serial_number
= 1,
686 .get_fc_host_stats
= zfcp_get_fc_host_stats
,
687 .reset_fc_host_stats
= zfcp_reset_fc_host_stats
,
688 .set_rport_dev_loss_tmo
= zfcp_set_rport_dev_loss_tmo
,
689 .get_host_port_state
= zfcp_get_host_port_state
,
690 .terminate_rport_io
= zfcp_scsi_terminate_rport_io
,
691 .show_host_port_state
= 1,
692 .show_host_active_fc4s
= 1,
693 .bsg_request
= zfcp_fc_exec_bsg_job
,
694 .bsg_timeout
= zfcp_fc_timeout_bsg_job
,
695 /* no functions registered for following dynamic attributes but
696 directly set by LLDD */
697 .show_host_port_type
= 1,
698 .show_host_speed
= 1,
699 .show_host_port_id
= 1,
700 .disable_target_scan
= 1,
701 .dd_bsg_size
= sizeof(struct zfcp_fsf_ct_els
),
704 struct zfcp_data zfcp_data
= {
705 .scsi_host_template
= {
707 .module
= THIS_MODULE
,
709 .change_queue_depth
= zfcp_scsi_change_queue_depth
,
710 .slave_alloc
= zfcp_scsi_slave_alloc
,
711 .slave_configure
= zfcp_scsi_slave_configure
,
712 .slave_destroy
= zfcp_scsi_slave_destroy
,
713 .queuecommand
= zfcp_scsi_queuecommand
,
714 .eh_abort_handler
= zfcp_scsi_eh_abort_handler
,
715 .eh_device_reset_handler
= zfcp_scsi_eh_device_reset_handler
,
716 .eh_target_reset_handler
= zfcp_scsi_eh_target_reset_handler
,
717 .eh_host_reset_handler
= zfcp_scsi_eh_host_reset_handler
,
720 .sg_tablesize
= ZFCP_QDIO_MAX_SBALES_PER_REQ
,
723 .sdev_attrs
= zfcp_sysfs_sdev_attrs
,
724 .max_sectors
= (ZFCP_QDIO_MAX_SBALES_PER_REQ
* 8),
725 .dma_boundary
= ZFCP_QDIO_SBALE_LEN
- 1,
726 .shost_attrs
= zfcp_sysfs_shost_attrs
,