diff options
Diffstat (limited to 'include/scsi/libfc.h')
-rw-r--r-- | include/scsi/libfc.h | 97 |
1 files changed, 83 insertions, 14 deletions
diff --git a/include/scsi/libfc.h b/include/scsi/libfc.h index 14be49b44e84..a3cbda4ddb5c 100644 --- a/include/scsi/libfc.h +++ b/include/scsi/libfc.h | |||
@@ -35,6 +35,8 @@ | |||
35 | 35 | ||
36 | #include <scsi/fc_frame.h> | 36 | #include <scsi/fc_frame.h> |
37 | 37 | ||
38 | #define FC_FC4_PROV_SIZE (FC_TYPE_FCP + 1) /* size of tables */ | ||
39 | |||
38 | /* | 40 | /* |
39 | * libfc error codes | 41 | * libfc error codes |
40 | */ | 42 | */ |
@@ -156,6 +158,7 @@ struct fc_rport_libfc_priv { | |||
156 | #define FC_RP_FLAGS_REC_SUPPORTED (1 << 0) | 158 | #define FC_RP_FLAGS_REC_SUPPORTED (1 << 0) |
157 | #define FC_RP_FLAGS_RETRY (1 << 1) | 159 | #define FC_RP_FLAGS_RETRY (1 << 1) |
158 | #define FC_RP_STARTED (1 << 2) | 160 | #define FC_RP_STARTED (1 << 2) |
161 | #define FC_RP_FLAGS_CONF_REQ (1 << 3) | ||
159 | unsigned int e_d_tov; | 162 | unsigned int e_d_tov; |
160 | unsigned int r_a_tov; | 163 | unsigned int r_a_tov; |
161 | }; | 164 | }; |
@@ -179,6 +182,7 @@ struct fc_rport_libfc_priv { | |||
179 | * @rp_mutex: The mutex that protects the remote port | 182 | * @rp_mutex: The mutex that protects the remote port |
180 | * @retry_work: Handle for retries | 183 | * @retry_work: Handle for retries |
181 | * @event_callback: Callback when READY, FAILED or LOGO states complete | 184 | * @event_callback: Callback when READY, FAILED or LOGO states complete |
185 | * @prli_count: Count of open PRLI sessions in providers | ||
182 | * @rcu: Structure used for freeing in an RCU-safe manner | 186 | * @rcu: Structure used for freeing in an RCU-safe manner |
183 | */ | 187 | */ |
184 | struct fc_rport_priv { | 188 | struct fc_rport_priv { |
@@ -202,7 +206,13 @@ struct fc_rport_priv { | |||
202 | struct list_head peers; | 206 | struct list_head peers; |
203 | struct work_struct event_work; | 207 | struct work_struct event_work; |
204 | u32 supported_classes; | 208 | u32 supported_classes; |
209 | u16 prli_count; | ||
205 | struct rcu_head rcu; | 210 | struct rcu_head rcu; |
211 | u16 sp_features; | ||
212 | u8 spp_type; | ||
213 | void (*lld_event_callback)(struct fc_lport *, | ||
214 | struct fc_rport_priv *, | ||
215 | enum fc_rport_event); | ||
206 | }; | 216 | }; |
207 | 217 | ||
208 | /** | 218 | /** |
@@ -221,8 +231,8 @@ struct fc_rport_priv { | |||
221 | * @InputRequests: Number of input requests | 231 | * @InputRequests: Number of input requests |
222 | * @OutputRequests: Number of output requests | 232 | * @OutputRequests: Number of output requests |
223 | * @ControlRequests: Number of control requests | 233 | * @ControlRequests: Number of control requests |
224 | * @InputMegabytes: Number of received megabytes | 234 | * @InputBytes: Number of received bytes |
225 | * @OutputMegabytes: Number of transmitted megabytes | 235 | * @OutputBytes: Number of transmitted bytes |
226 | * @VLinkFailureCount: Number of virtual link failures | 236 | * @VLinkFailureCount: Number of virtual link failures |
227 | * @MissDiscAdvCount: Number of missing FIP discovery advertisement | 237 | * @MissDiscAdvCount: Number of missing FIP discovery advertisement |
228 | */ | 238 | */ |
@@ -241,8 +251,8 @@ struct fcoe_dev_stats { | |||
241 | u64 InputRequests; | 251 | u64 InputRequests; |
242 | u64 OutputRequests; | 252 | u64 OutputRequests; |
243 | u64 ControlRequests; | 253 | u64 ControlRequests; |
244 | u64 InputMegabytes; | 254 | u64 InputBytes; |
245 | u64 OutputMegabytes; | 255 | u64 OutputBytes; |
246 | u64 VLinkFailureCount; | 256 | u64 VLinkFailureCount; |
247 | u64 MissDiscAdvCount; | 257 | u64 MissDiscAdvCount; |
248 | }; | 258 | }; |
@@ -250,7 +260,7 @@ struct fcoe_dev_stats { | |||
250 | /** | 260 | /** |
251 | * struct fc_seq_els_data - ELS data used for passing ELS specific responses | 261 | * struct fc_seq_els_data - ELS data used for passing ELS specific responses |
252 | * @reason: The reason for rejection | 262 | * @reason: The reason for rejection |
253 | * @explan: The explaination of the rejection | 263 | * @explan: The explanation of the rejection |
254 | * | 264 | * |
255 | * Mainly used by the exchange manager layer. | 265 | * Mainly used by the exchange manager layer. |
256 | */ | 266 | */ |
@@ -263,7 +273,6 @@ struct fc_seq_els_data { | |||
263 | * struct fc_fcp_pkt - FCP request structure (one for each scsi_cmnd request) | 273 | * struct fc_fcp_pkt - FCP request structure (one for each scsi_cmnd request) |
264 | * @lp: The associated local port | 274 | * @lp: The associated local port |
265 | * @state: The state of the I/O | 275 | * @state: The state of the I/O |
266 | * @tgt_flags: Target's flags | ||
267 | * @ref_cnt: Reference count | 276 | * @ref_cnt: Reference count |
268 | * @scsi_pkt_lock: Lock to protect the SCSI packet (must be taken before the | 277 | * @scsi_pkt_lock: Lock to protect the SCSI packet (must be taken before the |
269 | * host_lock if both are to be held at the same time) | 278 | * host_lock if both are to be held at the same time) |
@@ -298,7 +307,6 @@ struct fc_fcp_pkt { | |||
298 | /* Housekeeping information */ | 307 | /* Housekeeping information */ |
299 | struct fc_lport *lp; | 308 | struct fc_lport *lp; |
300 | u16 state; | 309 | u16 state; |
301 | u16 tgt_flags; | ||
302 | atomic_t ref_cnt; | 310 | atomic_t ref_cnt; |
303 | spinlock_t scsi_pkt_lock; | 311 | spinlock_t scsi_pkt_lock; |
304 | 312 | ||
@@ -517,7 +525,7 @@ struct libfc_function_template { | |||
517 | struct fc_frame *); | 525 | struct fc_frame *); |
518 | 526 | ||
519 | /* | 527 | /* |
520 | * Send an ELS response using infomation from the received frame. | 528 | * Send an ELS response using information from the received frame. |
521 | * | 529 | * |
522 | * STATUS: OPTIONAL | 530 | * STATUS: OPTIONAL |
523 | */ | 531 | */ |
@@ -553,6 +561,16 @@ struct libfc_function_template { | |||
553 | struct fc_seq *(*seq_start_next)(struct fc_seq *); | 561 | struct fc_seq *(*seq_start_next)(struct fc_seq *); |
554 | 562 | ||
555 | /* | 563 | /* |
564 | * Set a response handler for the exchange of the sequence. | ||
565 | * | ||
566 | * STATUS: OPTIONAL | ||
567 | */ | ||
568 | void (*seq_set_resp)(struct fc_seq *sp, | ||
569 | void (*resp)(struct fc_seq *, struct fc_frame *, | ||
570 | void *), | ||
571 | void *arg); | ||
572 | |||
573 | /* | ||
556 | * Assign a sequence for an incoming request frame. | 574 | * Assign a sequence for an incoming request frame. |
557 | * | 575 | * |
558 | * STATUS: OPTIONAL | 576 | * STATUS: OPTIONAL |
@@ -560,6 +578,13 @@ struct libfc_function_template { | |||
560 | struct fc_seq *(*seq_assign)(struct fc_lport *, struct fc_frame *); | 578 | struct fc_seq *(*seq_assign)(struct fc_lport *, struct fc_frame *); |
561 | 579 | ||
562 | /* | 580 | /* |
581 | * Release the reference on the sequence returned by seq_assign(). | ||
582 | * | ||
583 | * STATUS: OPTIONAL | ||
584 | */ | ||
585 | void (*seq_release)(struct fc_seq *); | ||
586 | |||
587 | /* | ||
563 | * Reset an exchange manager, completing all sequences and exchanges. | 588 | * Reset an exchange manager, completing all sequences and exchanges. |
564 | * If s_id is non-zero, reset only exchanges originating from that FID. | 589 | * If s_id is non-zero, reset only exchanges originating from that FID. |
565 | * If d_id is non-zero, reset only exchanges sending to that FID. | 590 | * If d_id is non-zero, reset only exchanges sending to that FID. |
@@ -638,7 +663,7 @@ struct libfc_function_template { | |||
638 | int (*rport_logoff)(struct fc_rport_priv *); | 663 | int (*rport_logoff)(struct fc_rport_priv *); |
639 | 664 | ||
640 | /* | 665 | /* |
641 | * Recieve a request from a remote port. | 666 | * Receive a request from a remote port. |
642 | * | 667 | * |
643 | * STATUS: OPTIONAL | 668 | * STATUS: OPTIONAL |
644 | */ | 669 | */ |
@@ -658,6 +683,15 @@ struct libfc_function_template { | |||
658 | void (*rport_destroy)(struct kref *); | 683 | void (*rport_destroy)(struct kref *); |
659 | 684 | ||
660 | /* | 685 | /* |
686 | * Callback routine after the remote port is logged in | ||
687 | * | ||
688 | * STATUS: OPTIONAL | ||
689 | */ | ||
690 | void (*rport_event_callback)(struct fc_lport *, | ||
691 | struct fc_rport_priv *, | ||
692 | enum fc_rport_event); | ||
693 | |||
694 | /* | ||
661 | * Send a fcp cmd from fsp pkt. | 695 | * Send a fcp cmd from fsp pkt. |
662 | * Called with the SCSI host lock unlocked and irqs disabled. | 696 | * Called with the SCSI host lock unlocked and irqs disabled. |
663 | * | 697 | * |
@@ -670,7 +704,7 @@ struct libfc_function_template { | |||
670 | void *)); | 704 | void *)); |
671 | 705 | ||
672 | /* | 706 | /* |
673 | * Cleanup the FCP layer, used durring link down and reset | 707 | * Cleanup the FCP layer, used during link down and reset |
674 | * | 708 | * |
675 | * STATUS: OPTIONAL | 709 | * STATUS: OPTIONAL |
676 | */ | 710 | */ |
@@ -721,7 +755,7 @@ struct libfc_function_template { | |||
721 | * struct fc_disc - Discovery context | 755 | * struct fc_disc - Discovery context |
722 | * @retry_count: Number of retries | 756 | * @retry_count: Number of retries |
723 | * @pending: 1 if discovery is pending, 0 if not | 757 | * @pending: 1 if discovery is pending, 0 if not |
724 | * @requesting: 1 if discovery has been requested, 0 if not | 758 | * @requested: 1 if discovery has been requested, 0 if not |
725 | * @seq_count: Number of sequences used for discovery | 759 | * @seq_count: Number of sequences used for discovery |
726 | * @buf_len: Length of the discovery buffer | 760 | * @buf_len: Length of the discovery buffer |
727 | * @disc_id: Discovery ID | 761 | * @disc_id: Discovery ID |
@@ -751,6 +785,15 @@ struct fc_disc { | |||
751 | enum fc_disc_event); | 785 | enum fc_disc_event); |
752 | }; | 786 | }; |
753 | 787 | ||
788 | /* | ||
789 | * Local port notifier and events. | ||
790 | */ | ||
791 | extern struct blocking_notifier_head fc_lport_notifier_head; | ||
792 | enum fc_lport_event { | ||
793 | FC_LPORT_EV_ADD, | ||
794 | FC_LPORT_EV_DEL, | ||
795 | }; | ||
796 | |||
754 | /** | 797 | /** |
755 | * struct fc_lport - Local port | 798 | * struct fc_lport - Local port |
756 | * @host: The SCSI host associated with a local port | 799 | * @host: The SCSI host associated with a local port |
@@ -791,8 +834,10 @@ struct fc_disc { | |||
791 | * @lso_max: The maximum large offload send size | 834 | * @lso_max: The maximum large offload send size |
792 | * @fcts: FC-4 type mask | 835 | * @fcts: FC-4 type mask |
793 | * @lp_mutex: Mutex to protect the local port | 836 | * @lp_mutex: Mutex to protect the local port |
794 | * @list: Handle for list of local ports | 837 | * @list: Linkage on list of vport peers |
795 | * @retry_work: Handle to local port for delayed retry context | 838 | * @retry_work: Handle to local port for delayed retry context |
839 | * @prov: Pointers available for use by passive FC-4 providers | ||
840 | * @lport_list: Linkage on module-wide list of local ports | ||
796 | */ | 841 | */ |
797 | struct fc_lport { | 842 | struct fc_lport { |
798 | /* Associations */ | 843 | /* Associations */ |
@@ -848,8 +893,32 @@ struct fc_lport { | |||
848 | struct mutex lp_mutex; | 893 | struct mutex lp_mutex; |
849 | struct list_head list; | 894 | struct list_head list; |
850 | struct delayed_work retry_work; | 895 | struct delayed_work retry_work; |
896 | void *prov[FC_FC4_PROV_SIZE]; | ||
897 | struct list_head lport_list; | ||
851 | }; | 898 | }; |
852 | 899 | ||
900 | /** | ||
901 | * struct fc4_prov - FC-4 provider registration | ||
902 | * @prli: Handler for incoming PRLI | ||
903 | * @prlo: Handler for session reset | ||
904 | * @recv: Handler for incoming request | ||
905 | * @module: Pointer to module. May be NULL. | ||
906 | */ | ||
907 | struct fc4_prov { | ||
908 | int (*prli)(struct fc_rport_priv *, u32 spp_len, | ||
909 | const struct fc_els_spp *spp_in, | ||
910 | struct fc_els_spp *spp_out); | ||
911 | void (*prlo)(struct fc_rport_priv *); | ||
912 | void (*recv)(struct fc_lport *, struct fc_frame *); | ||
913 | struct module *module; | ||
914 | }; | ||
915 | |||
916 | /* | ||
917 | * Register FC-4 provider with libfc. | ||
918 | */ | ||
919 | int fc_fc4_register_provider(enum fc_fh_type type, struct fc4_prov *); | ||
920 | void fc_fc4_deregister_provider(enum fc_fh_type type, struct fc4_prov *); | ||
921 | |||
853 | /* | 922 | /* |
854 | * FC_LPORT HELPER FUNCTIONS | 923 | * FC_LPORT HELPER FUNCTIONS |
855 | *****************************/ | 924 | *****************************/ |
@@ -980,6 +1049,7 @@ struct fc_lport *libfc_vport_create(struct fc_vport *, int privsize); | |||
980 | struct fc_lport *fc_vport_id_lookup(struct fc_lport *, u32 port_id); | 1049 | struct fc_lport *fc_vport_id_lookup(struct fc_lport *, u32 port_id); |
981 | int fc_lport_bsg_request(struct fc_bsg_job *); | 1050 | int fc_lport_bsg_request(struct fc_bsg_job *); |
982 | void fc_lport_set_local_id(struct fc_lport *, u32 port_id); | 1051 | void fc_lport_set_local_id(struct fc_lport *, u32 port_id); |
1052 | void fc_lport_iterate(void (*func)(struct fc_lport *, void *), void *); | ||
983 | 1053 | ||
984 | /* | 1054 | /* |
985 | * REMOTE PORT LAYER | 1055 | * REMOTE PORT LAYER |
@@ -1006,8 +1076,7 @@ void fc_fcp_destroy(struct fc_lport *); | |||
1006 | /* | 1076 | /* |
1007 | * SCSI INTERACTION LAYER | 1077 | * SCSI INTERACTION LAYER |
1008 | *****************************/ | 1078 | *****************************/ |
1009 | int fc_queuecommand(struct scsi_cmnd *, | 1079 | int fc_queuecommand(struct Scsi_Host *, struct scsi_cmnd *); |
1010 | void (*done)(struct scsi_cmnd *)); | ||
1011 | int fc_eh_abort(struct scsi_cmnd *); | 1080 | int fc_eh_abort(struct scsi_cmnd *); |
1012 | int fc_eh_device_reset(struct scsi_cmnd *); | 1081 | int fc_eh_device_reset(struct scsi_cmnd *); |
1013 | int fc_eh_host_reset(struct scsi_cmnd *); | 1082 | int fc_eh_host_reset(struct scsi_cmnd *); |