aboutsummaryrefslogtreecommitdiffstats
path: root/include/scsi
diff options
context:
space:
mode:
authorVasu Dev <vasu.dev@intel.com>2009-07-29 20:05:10 -0400
committerJames Bottomley <James.Bottomley@suse.de>2009-08-22 18:52:08 -0400
commit52ff878c912215210f53c0a080552dd6ba3055a2 (patch)
treeefaf0c6a6585aedc02af5faa3b47f4f4685fc783 /include/scsi
parentd459b7ea1b4c7aa3dacfeee174d02b2f7a95850d (diff)
[SCSI] fcoe, fnic, libfc: modifies current code paths to use EM anchor list
Modifies current code to use EM anchor list in EM allocation, EM free, EM reset, exch allocation and exch lookup code paths. 1. Modifies fc_exch_mgr_alloc to accept EM match function and then have allocated EM added to the lport using fc_exch_mgr_add API while also updating EM kref for newly added EM. 2. Updates fc_exch_mgr_free API to accept only lport pointer instead EM and then have this API free all EMs of the lport from EM anchor list. 3. Removes single lport pointer link from the EM, which was used in associating lport pointer in newly allocated exchange. Instead have lport pointer passed along new exchange allocation call path and then store passed lport pointer in newly allocated exchange, this will allow a single EM instance to be used across more than one lport and used in EM reset to reset only lport specific exchanges. 4. Modifies fc_exch_mgr_reset to reset all EMs from the EM anchor list of the lport, adds additional exch lport pointer (ep->lp) check for shared EM case to reset exchange specific to a lport requested reset. 5. Updates exch allocation API fc_exch_alloc to use EM anchor list and its anchor match func pointer. The fc_exch_alloc will walk the list of EMs until it finds a match, a match will be either null match func pointer or call to match function returning true value. 6. Updates fc_exch_recv to accept incoming frame on local port using only lport pointer and frame pointer without specifying EM instance of incoming frame. Instead modified fc_exch_recv to locate EM for the incoming frame by matching xid of incoming frame against a EM xid range. This change was required to use EM list in libfc Rx path and after this change the lport fc_exch_mgr pointer emp is not needed anymore, so removed emp pointer. 7. Updates fnic for removed lport emp pointer and above modified libfc APIs fc_exch_recv, fc_exch_mgr_alloc and fc_exch_mgr_free. 8. Removes exch_get and exch_put from libfc_function_template as these are no longer needed with EM anchor list and its match function use. Also removes its default function fc_exch_get. A defect this patch introduced regarding the libfc initialization order in the fnic driver was fixed by Joe Eykholt <jeykholt@cisco.com>. Signed-off-by: Vasu Dev <vasu.dev@intel.com> Signed-off-by: Robert Love <robert.w.love@intel.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'include/scsi')
-rw-r--r--include/scsi/libfc.h48
1 files changed, 8 insertions, 40 deletions
diff --git a/include/scsi/libfc.h b/include/scsi/libfc.h
index f1bde91f98a2..c2b928cfafb9 100644
--- a/include/scsi/libfc.h
+++ b/include/scsi/libfc.h
@@ -518,25 +518,6 @@ struct libfc_function_template {
518 void (*exch_done)(struct fc_seq *sp); 518 void (*exch_done)(struct fc_seq *sp);
519 519
520 /* 520 /*
521 * Assigns a EM and a free XID for an new exchange and then
522 * allocates a new exchange and sequence pair.
523 * The fp can be used to determine free XID.
524 *
525 * STATUS: OPTIONAL
526 */
527 struct fc_exch *(*exch_get)(struct fc_lport *lp, struct fc_frame *fp);
528
529 /*
530 * Release previously assigned XID by exch_get API.
531 * The LLD may implement this if XID is assigned by LLD
532 * in exch_get().
533 *
534 * STATUS: OPTIONAL
535 */
536 void (*exch_put)(struct fc_lport *lp, struct fc_exch_mgr *mp,
537 u16 ex_id);
538
539 /*
540 * Start a new sequence on the same exchange/sequence tuple. 521 * Start a new sequence on the same exchange/sequence tuple.
541 * 522 *
542 * STATUS: OPTIONAL 523 * STATUS: OPTIONAL
@@ -703,7 +684,6 @@ struct fc_lport {
703 684
704 /* Associations */ 685 /* Associations */
705 struct Scsi_Host *host; 686 struct Scsi_Host *host;
706 struct fc_exch_mgr *emp;
707 struct list_head ema_list; 687 struct list_head ema_list;
708 struct fc_rport *dns_rp; 688 struct fc_rport *dns_rp;
709 struct fc_rport *ptp_rp; 689 struct fc_rport *ptp_rp;
@@ -996,27 +976,25 @@ void fc_exch_mgr_del(struct fc_exch_mgr_anchor *ema);
996 * a new exchange. 976 * a new exchange.
997 * The LLD may choose to have multiple EMs, 977 * The LLD may choose to have multiple EMs,
998 * e.g. one EM instance per CPU receive thread in LLD. 978 * e.g. one EM instance per CPU receive thread in LLD.
999 * The LLD can use exch_get() of struct libfc_function_template
1000 * to specify XID for a new exchange within
1001 * a specified EM instance.
1002 * 979 *
1003 * The em_idx to uniquely identify an EM instance. 980 * Specified match function is used in allocating exchanges
981 * from newly allocated EM.
1004 */ 982 */
1005struct fc_exch_mgr *fc_exch_mgr_alloc(struct fc_lport *lp, 983struct fc_exch_mgr *fc_exch_mgr_alloc(struct fc_lport *lp,
1006 enum fc_class class, 984 enum fc_class class,
1007 u16 min_xid, 985 u16 min_xid,
1008 u16 max_xid); 986 u16 max_xid,
987 bool (*match)(struct fc_frame *));
1009 988
1010/* 989/*
1011 * Free an exchange manager. 990 * Free all exchange managers of a lport.
1012 */ 991 */
1013void fc_exch_mgr_free(struct fc_exch_mgr *mp); 992void fc_exch_mgr_free(struct fc_lport *lport);
1014 993
1015/* 994/*
1016 * Receive a frame on specified local port and exchange manager. 995 * Receive a frame on specified local port and exchange manager.
1017 */ 996 */
1018void fc_exch_recv(struct fc_lport *lp, struct fc_exch_mgr *mp, 997void fc_exch_recv(struct fc_lport *lp, struct fc_frame *fp);
1019 struct fc_frame *fp);
1020 998
1021/* 999/*
1022 * This function is for exch_seq_send function pointer in 1000 * This function is for exch_seq_send function pointer in
@@ -1058,19 +1036,9 @@ int fc_seq_exch_abort(const struct fc_seq *req_sp, unsigned int timer_msec);
1058void fc_exch_done(struct fc_seq *sp); 1036void fc_exch_done(struct fc_seq *sp);
1059 1037
1060/* 1038/*
1061 * Assigns a EM and XID for a frame and then allocates
1062 * a new exchange and sequence pair.
1063 * The fp can be used to determine free XID.
1064 */
1065struct fc_exch *fc_exch_get(struct fc_lport *lp, struct fc_frame *fp);
1066
1067/*
1068 * Allocate a new exchange and sequence pair. 1039 * Allocate a new exchange and sequence pair.
1069 * if ex_id is zero then next free exchange id
1070 * from specified exchange manger mp will be assigned.
1071 */ 1040 */
1072struct fc_exch *fc_exch_alloc(struct fc_exch_mgr *mp, 1041struct fc_exch *fc_exch_alloc(struct fc_lport *lport, struct fc_frame *fp);
1073 struct fc_frame *fp, u16 ex_id);
1074/* 1042/*
1075 * Start a new sequence on the same exchange as the supplied sequence. 1043 * Start a new sequence on the same exchange as the supplied sequence.
1076 */ 1044 */