Instead passes lport pointer lp for each new exch allocation to update lport pointer in fc_exch.
This is required since now one em could be used by more than one lport for a shared em instance across lports. Signed-off-by: Robert Love <[email protected]> Signed-off-by: Vasu Dev <[email protected]> --- drivers/scsi/libfc/fc_exch.c | 20 +++++++++++--------- include/scsi/libfc.h | 6 +++--- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/drivers/scsi/libfc/fc_exch.c b/drivers/scsi/libfc/fc_exch.c index bd6836b..2b9e2af 100644 --- a/drivers/scsi/libfc/fc_exch.c +++ b/drivers/scsi/libfc/fc_exch.c @@ -63,7 +63,6 @@ struct fc_exch_mgr { u16 max_xid; /* max exchange ID */ u32 total_exches; /* total allocated exchanges */ struct list_head ex_list; /* allocated exchanges list */ - struct fc_lport *lp; /* fc device instance */ mempool_t *ep_pool; /* reserve ep's */ /* @@ -461,11 +460,12 @@ static struct fc_seq *fc_seq_alloc(struct fc_exch *ep, u8 seq_id) /* * fc_exch_alloc - allocate an exchange and its exchange id. + * @lp : ptr to the lport * @mp : ptr to the exchange manager * * Returns with exch lock held. */ -struct fc_exch *fc_exch_alloc(struct fc_exch_mgr *mp) +struct fc_exch *fc_exch_alloc(struct fc_lport *lp, struct fc_exch_mgr *mp) { struct fc_exch *ep; u16 min, max, xid; @@ -511,7 +511,7 @@ struct fc_exch *fc_exch_alloc(struct fc_exch_mgr *mp) */ ep->oxid = ep->xid = xid; ep->em = mp; - ep->lp = mp->lp; + ep->lp = lp; ep->f_ctl = FC_FC_FIRST_SEQ; /* next seq is first seq */ ep->rxid = FC_XID_UNKNOWN; ep->class = mp->class; @@ -562,12 +562,14 @@ EXPORT_SYMBOL(fc_exch_done); * Allocate a new exchange as responder. * Sets the responder ID in the frame header. */ -static struct fc_exch *fc_exch_resp(struct fc_exch_mgr *mp, struct fc_frame *fp) +static struct fc_exch *fc_exch_resp(struct fc_lport *lp, + struct fc_exch_mgr *mp, + struct fc_frame *fp) { struct fc_exch *ep; struct fc_frame_header *fh; - ep = mp->lp->tt.exch_get(mp->lp, fp); + ep = lp->tt.exch_get(lp, fp); if (ep) { ep->class = fc_frame_class(fp); @@ -604,6 +606,7 @@ static struct fc_exch *fc_exch_resp(struct fc_exch_mgr *mp, struct fc_frame *fp) * on the ep that should be released by the caller. */ static enum fc_pf_rjt_reason fc_seq_lookup_recip(struct fc_exch_mgr *mp, + struct fc_lport *lp, struct fc_frame *fp) { struct fc_frame_header *fh = fc_frame_header_get(fp); @@ -657,7 +660,7 @@ static enum fc_pf_rjt_reason fc_seq_lookup_recip(struct fc_exch_mgr *mp, reject = FC_RJT_RX_ID; goto rel; } - ep = fc_exch_resp(mp, fp); + ep = fc_exch_resp(lp, mp, fp); if (!ep) { reject = FC_RJT_EXCH_EST; /* XXX */ goto out; @@ -1049,7 +1052,7 @@ static void fc_exch_recv_req(struct fc_lport *lp, struct fc_exch_mgr *mp, enum fc_pf_rjt_reason reject; fr_seq(fp) = NULL; - reject = fc_seq_lookup_recip(mp, fp); + reject = fc_seq_lookup_recip(mp, lp, fp); if (reject == FC_RJT_NONE) { sp = fr_seq(fp); /* sequence will be held */ ep = fc_seq_exch(sp); @@ -1721,7 +1724,6 @@ struct fc_exch_mgr *fc_exch_mgr_alloc(struct fc_lport *lp, mp->class = class; mp->total_exches = 0; mp->exches = (struct fc_exch **)(mp + 1); - mp->lp = lp; /* adjust em exch xid range for offload */ mp->min_xid = min_xid; mp->max_xid = max_xid; @@ -1768,7 +1770,7 @@ struct fc_exch *fc_exch_get(struct fc_lport *lp, struct fc_frame *fp) if (!lp || !lp->emp) return NULL; - return fc_exch_alloc(lp->emp); + return fc_exch_alloc(lp, lp->emp); } EXPORT_SYMBOL(fc_exch_get); diff --git a/include/scsi/libfc.h b/include/scsi/libfc.h index 967f6f6..398a40e 100644 --- a/include/scsi/libfc.h +++ b/include/scsi/libfc.h @@ -86,8 +86,7 @@ do { \ #define FC_EM_DBG(em, fmt, args...) \ FC_CHECK_LOGGING(FC_EM_LOGGING, \ - printk(KERN_INFO "em: %6x: " fmt, \ - fc_host_port_id(em->lp->host), \ + printk(KERN_INFO "em: " fmt, \ ##args);) #define FC_EXCH_DBG(exch, fmt, args...) \ @@ -1057,7 +1056,8 @@ struct fc_exch *fc_exch_get(struct fc_lport *lp, struct fc_frame *fp); /* * Allocate a new exchange and sequence pair. */ -struct fc_exch *fc_exch_alloc(struct fc_exch_mgr *mp); +struct fc_exch *fc_exch_alloc(struct fc_lport *lp, struct fc_exch_mgr *mp); + /* * Start a new sequence on the same exchange as the supplied sequence. */ _______________________________________________ devel mailing list [email protected] http://www.open-fcoe.org/mailman/listinfo/devel
