diff options
author | Vasu Dev <vasu.dev@intel.com> | 2009-07-29 20:05:00 -0400 |
---|---|---|
committer | James Bottomley <James.Bottomley@suse.de> | 2009-08-22 18:52:07 -0400 |
commit | 96316099ac3cb259eac2d6891f3c75b38b29d26e (patch) | |
tree | f4ec7001462bd00340de19b3045063872652c5a6 /include/scsi | |
parent | 201e5795b7b9582accb6d83316e30f24d7d40fd3 (diff) |
[SCSI] fcoe, libfc: adds exchange manager(EM) anchor list per lport and related APIs
Adds EM list using a anchor struct fc_exch_mgr_anchor, anchor is used
to allow same EM instance sharing across more than one lport on a eth
device, this implementation is per discussed design posted at
http://www.open-fcoe.org/pipermail/devel/2009-June/002566.html.
The shared EM is required for multiple lports on eth device when
using multiple VLANs or NPIV.
Adds fc_exch_mgr_add API to add a EM to the lport and fc_exch_mgr_del
API to delete previously added EM.
Also adds function fc_exch_mgr_destroy() to destroy allocated EM.
The kref is added to the EM to keep track of EM usage count, the EM is
destroyed when no longer in use upon kref reaching to zero.
The caller can specify match function to fc_exch_mgr_add, this
will be used in determining exchange allocation from its EM or not.
Moved calling of fcoe_em_config below fcoe_libfc_config calling,
so that list head lp->ema_list is initialized before configuring
EM.
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.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/include/scsi/libfc.h b/include/scsi/libfc.h index 04db7a9e631b..b381b1ca9aec 100644 --- a/include/scsi/libfc.h +++ b/include/scsi/libfc.h | |||
@@ -348,6 +348,7 @@ static inline bool fc_fcp_is_read(const struct fc_fcp_pkt *fsp) | |||
348 | */ | 348 | */ |
349 | 349 | ||
350 | struct fc_exch_mgr; | 350 | struct fc_exch_mgr; |
351 | struct fc_exch_mgr_anchor; | ||
351 | 352 | ||
352 | /* | 353 | /* |
353 | * Sequence. | 354 | * Sequence. |
@@ -709,6 +710,7 @@ struct fc_lport { | |||
709 | /* Associations */ | 710 | /* Associations */ |
710 | struct Scsi_Host *host; | 711 | struct Scsi_Host *host; |
711 | struct fc_exch_mgr *emp; | 712 | struct fc_exch_mgr *emp; |
713 | struct list_head ema_list; | ||
712 | struct fc_rport *dns_rp; | 714 | struct fc_rport *dns_rp; |
713 | struct fc_rport *ptp_rp; | 715 | struct fc_rport *ptp_rp; |
714 | void *scsi_priv; | 716 | void *scsi_priv; |
@@ -964,6 +966,28 @@ int fc_elsct_init(struct fc_lport *lp); | |||
964 | int fc_exch_init(struct fc_lport *lp); | 966 | int fc_exch_init(struct fc_lport *lp); |
965 | 967 | ||
966 | /* | 968 | /* |
969 | * Adds Exchange Manager (EM) mp to lport. | ||
970 | * | ||
971 | * Adds specified mp to lport using struct fc_exch_mgr_anchor, | ||
972 | * the struct fc_exch_mgr_anchor allows same EM sharing by | ||
973 | * more than one lport with their specified match function, | ||
974 | * the match function is used in allocating exchange from | ||
975 | * added mp. | ||
976 | */ | ||
977 | struct fc_exch_mgr_anchor *fc_exch_mgr_add(struct fc_lport *lport, | ||
978 | struct fc_exch_mgr *mp, | ||
979 | bool (*match)(struct fc_frame *)); | ||
980 | |||
981 | /* | ||
982 | * Deletes Exchange Manager (EM) from lport by removing | ||
983 | * its anchor ema from lport. | ||
984 | * | ||
985 | * If removed anchor ema was the last user of its associated EM | ||
986 | * then also destroys associated EM. | ||
987 | */ | ||
988 | void fc_exch_mgr_del(struct fc_exch_mgr_anchor *ema); | ||
989 | |||
990 | /* | ||
967 | * Allocates an Exchange Manager (EM). | 991 | * Allocates an Exchange Manager (EM). |
968 | * | 992 | * |
969 | * The EM manages exchanges for their allocation and | 993 | * The EM manages exchanges for their allocation and |