aboutsummaryrefslogtreecommitdiffstats
path: root/include/scsi
diff options
context:
space:
mode:
authorJoe Eykholt <jeykholt@cisco.com>2011-01-28 19:04:02 -0500
committerJames Bottomley <James.Bottomley@suse.de>2011-02-12 12:00:40 -0500
commit96ad846445ae33dcae1805b68752e3d5c840e3ed (patch)
treee73ea227c24d90654d58f0cfbec00f689bdac081 /include/scsi
parent55204909bb687c997d5601e9f24a25cf9e915d78 (diff)
[SCSI] libfc: add hook for FC-4 provider registration
Allow FC-4 provider modules to hook into libfc, mostly for targets. This should allow any FC-4 module to handle PRLI requests and maintain process-association states. Each provider registers its ops with libfc and then will be called for any incoming PRLI for that FC-4 type on any instance. The provider can decide whether to handle that particular instance using any method it likes, such as ACLs or other configuration information. A count is kept of the number of successful PRLIs from the remote port. Providers are called back with an implicit PRLO when the remote port is about to be deleted or has been reset. fc_lport_recv_req() now sends incoming FC-4 requests to FC-4 providers, and there is a built-in provider always registered for handling incoming ELS requests. The call to provider recv() routines uses rcu_read_lock() so that providers aren't removed during the call. That lock is very cheap and shouldn't affect any performance on ELS requests. Providers can rely on the RCU lock to protect a session lookup as well. Signed-off-by: Joe Eykholt <jeykholt@cisco.com> Signed-off-by: Robert Love <robert.w.love@intel.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'include/scsi')
-rw-r--r--include/scsi/libfc.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/include/scsi/libfc.h b/include/scsi/libfc.h
index f53c8e31d5fb..3ae2a760b4f3 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 */
@@ -179,6 +181,7 @@ struct fc_rport_libfc_priv {
179 * @rp_mutex: The mutex that protects the remote port 181 * @rp_mutex: The mutex that protects the remote port
180 * @retry_work: Handle for retries 182 * @retry_work: Handle for retries
181 * @event_callback: Callback when READY, FAILED or LOGO states complete 183 * @event_callback: Callback when READY, FAILED or LOGO states complete
184 * @prli_count: Count of open PRLI sessions in providers
182 * @rcu: Structure used for freeing in an RCU-safe manner 185 * @rcu: Structure used for freeing in an RCU-safe manner
183 */ 186 */
184struct fc_rport_priv { 187struct fc_rport_priv {
@@ -202,6 +205,7 @@ struct fc_rport_priv {
202 struct list_head peers; 205 struct list_head peers;
203 struct work_struct event_work; 206 struct work_struct event_work;
204 u32 supported_classes; 207 u32 supported_classes;
208 u16 prli_count;
205 struct rcu_head rcu; 209 struct rcu_head rcu;
206}; 210};
207 211
@@ -848,6 +852,28 @@ struct fc_lport {
848 struct delayed_work retry_work; 852 struct delayed_work retry_work;
849}; 853};
850 854
855/**
856 * struct fc4_prov - FC-4 provider registration
857 * @prli: Handler for incoming PRLI
858 * @prlo: Handler for session reset
859 * @recv: Handler for incoming request
860 * @module: Pointer to module. May be NULL.
861 */
862struct fc4_prov {
863 int (*prli)(struct fc_rport_priv *, u32 spp_len,
864 const struct fc_els_spp *spp_in,
865 struct fc_els_spp *spp_out);
866 void (*prlo)(struct fc_rport_priv *);
867 void (*recv)(struct fc_lport *, struct fc_frame *);
868 struct module *module;
869};
870
871/*
872 * Register FC-4 provider with libfc.
873 */
874int fc_fc4_register_provider(enum fc_fh_type type, struct fc4_prov *);
875void fc_fc4_deregister_provider(enum fc_fh_type type, struct fc4_prov *);
876
851/* 877/*
852 * FC_LPORT HELPER FUNCTIONS 878 * FC_LPORT HELPER FUNCTIONS
853 *****************************/ 879 *****************************/