• Home
  • Raw
  • Download

Lines Matching refs:mp

276 	struct fc_exch_mgr *mp;  in fc_exch_release()  local
279 mp = ep->em; in fc_exch_release()
283 ep->lp->tt.exch_put(ep->lp, mp, ep->xid); in fc_exch_release()
285 mempool_free(ep, mp->ep_pool); in fc_exch_release()
315 struct fc_exch_mgr *mp; in fc_exch_mgr_delete_ep() local
317 mp = ep->em; in fc_exch_mgr_delete_ep()
318 spin_lock_bh(&mp->em_lock); in fc_exch_mgr_delete_ep()
319 WARN_ON(mp->total_exches <= 0); in fc_exch_mgr_delete_ep()
320 mp->total_exches--; in fc_exch_mgr_delete_ep()
321 mp->exches[ep->xid - mp->min_xid] = NULL; in fc_exch_mgr_delete_ep()
323 spin_unlock_bh(&mp->em_lock); in fc_exch_mgr_delete_ep()
485 static u16 fc_em_alloc_xid(struct fc_exch_mgr *mp, const struct fc_frame *fp) in fc_em_alloc_xid() argument
491 if (mp->max_read) { in fc_em_alloc_xid()
493 min = mp->min_xid; in fc_em_alloc_xid()
494 max = mp->max_read; in fc_em_alloc_xid()
495 plast = &mp->last_read; in fc_em_alloc_xid()
497 min = mp->max_read + 1; in fc_em_alloc_xid()
498 max = mp->max_xid; in fc_em_alloc_xid()
499 plast = &mp->last_xid; in fc_em_alloc_xid()
502 min = mp->min_xid; in fc_em_alloc_xid()
503 max = mp->max_xid; in fc_em_alloc_xid()
504 plast = &mp->last_xid; in fc_em_alloc_xid()
509 ep = mp->exches[xid - mp->min_xid]; in fc_em_alloc_xid()
529 struct fc_exch *fc_exch_alloc(struct fc_exch_mgr *mp, in fc_exch_alloc() argument
535 ep = mempool_alloc(mp->ep_pool, GFP_ATOMIC); in fc_exch_alloc()
537 atomic_inc(&mp->stats.no_free_exch); in fc_exch_alloc()
542 spin_lock_bh(&mp->em_lock); in fc_exch_alloc()
546 xid = fc_em_alloc_xid(mp, fp); in fc_exch_alloc()
562 mp->exches[xid - mp->min_xid] = ep; in fc_exch_alloc()
563 list_add_tail(&ep->ex_list, &mp->ex_list); in fc_exch_alloc()
565 mp->total_exches++; in fc_exch_alloc()
566 spin_unlock_bh(&mp->em_lock); in fc_exch_alloc()
572 ep->em = mp; in fc_exch_alloc()
573 ep->lp = mp->lp; in fc_exch_alloc()
576 ep->class = mp->class; in fc_exch_alloc()
581 spin_unlock_bh(&mp->em_lock); in fc_exch_alloc()
582 atomic_inc(&mp->stats.no_free_exch_xid); in fc_exch_alloc()
583 mempool_free(ep, mp->ep_pool); in fc_exch_alloc()
591 static struct fc_exch *fc_exch_find(struct fc_exch_mgr *mp, u16 xid) in fc_exch_find() argument
595 if ((xid >= mp->min_xid) && (xid <= mp->max_xid)) { in fc_exch_find()
596 spin_lock_bh(&mp->em_lock); in fc_exch_find()
597 ep = mp->exches[xid - mp->min_xid]; in fc_exch_find()
602 spin_unlock_bh(&mp->em_lock); in fc_exch_find()
624 static struct fc_exch *fc_exch_resp(struct fc_exch_mgr *mp, struct fc_frame *fp) in fc_exch_resp() argument
629 ep = mp->lp->tt.exch_get(mp->lp, fp); in fc_exch_resp()
665 static enum fc_pf_rjt_reason fc_seq_lookup_recip(struct fc_exch_mgr *mp, in fc_seq_lookup_recip() argument
683 ep = fc_exch_find(mp, xid); in fc_seq_lookup_recip()
685 atomic_inc(&mp->stats.xid_not_found); in fc_seq_lookup_recip()
712 ep = fc_exch_find(mp, xid); in fc_seq_lookup_recip()
715 atomic_inc(&mp->stats.xid_busy); in fc_seq_lookup_recip()
719 ep = fc_exch_resp(mp, fp); in fc_seq_lookup_recip()
726 atomic_inc(&mp->stats.xid_not_found); in fc_seq_lookup_recip()
747 atomic_inc(&mp->stats.seq_not_found); in fc_seq_lookup_recip()
772 static struct fc_seq *fc_seq_lookup_orig(struct fc_exch_mgr *mp, in fc_seq_lookup_orig() argument
784 ep = fc_exch_find(mp, xid); in fc_seq_lookup_orig()
1099 static void fc_exch_recv_req(struct fc_lport *lp, struct fc_exch_mgr *mp, in fc_exch_recv_req() argument
1111 reject = fc_seq_lookup_recip(mp, fp); in fc_exch_recv_req()
1146 static void fc_exch_recv_seq_resp(struct fc_exch_mgr *mp, struct fc_frame *fp) in fc_exch_recv_seq_resp() argument
1157 ep = fc_exch_find(mp, ntohs(fh->fh_ox_id)); in fc_exch_recv_seq_resp()
1159 atomic_inc(&mp->stats.xid_not_found); in fc_exch_recv_seq_resp()
1165 atomic_inc(&mp->stats.xid_not_found); in fc_exch_recv_seq_resp()
1170 atomic_inc(&mp->stats.xid_not_found); in fc_exch_recv_seq_resp()
1181 atomic_inc(&mp->stats.seq_not_found); in fc_exch_recv_seq_resp()
1234 static void fc_exch_recv_resp(struct fc_exch_mgr *mp, struct fc_frame *fp) in fc_exch_recv_resp() argument
1238 sp = fc_seq_lookup_orig(mp, fp); /* doesn't hold sequence */ in fc_exch_recv_resp()
1240 atomic_inc(&mp->stats.xid_not_found); in fc_exch_recv_resp()
1243 atomic_inc(&mp->stats.non_bls_resp); in fc_exch_recv_resp()
1331 static void fc_exch_recv_bls(struct fc_exch_mgr *mp, struct fc_frame *fp) in fc_exch_recv_bls() argument
1341 ep = fc_exch_find(mp, (f_ctl & FC_FC_EX_CTX) ? in fc_exch_recv_bls()
1472 struct fc_exch_mgr *mp = lp->emp; in fc_exch_mgr_reset() local
1474 spin_lock_bh(&mp->em_lock); in fc_exch_mgr_reset()
1476 list_for_each_entry_safe(ep, next, &mp->ex_list, ex_list) { in fc_exch_mgr_reset()
1480 spin_unlock_bh(&mp->em_lock); in fc_exch_mgr_reset()
1485 spin_lock_bh(&mp->em_lock); in fc_exch_mgr_reset()
1494 spin_unlock_bh(&mp->em_lock); in fc_exch_mgr_reset()
1735 struct fc_exch_mgr *mp; in fc_exch_mgr_alloc() local
1751 mp = kzalloc(len, GFP_ATOMIC); in fc_exch_mgr_alloc()
1752 if (!mp) in fc_exch_mgr_alloc()
1755 mp->class = class; in fc_exch_mgr_alloc()
1756 mp->total_exches = 0; in fc_exch_mgr_alloc()
1757 mp->exches = (struct fc_exch **)(mp + 1); in fc_exch_mgr_alloc()
1758 mp->lp = lp; in fc_exch_mgr_alloc()
1760 mp->min_xid = min_xid; in fc_exch_mgr_alloc()
1761 mp->max_xid = max_xid; in fc_exch_mgr_alloc()
1762 mp->last_xid = min_xid - 1; in fc_exch_mgr_alloc()
1763 mp->max_read = 0; in fc_exch_mgr_alloc()
1764 mp->last_read = 0; in fc_exch_mgr_alloc()
1766 mp->max_read = lp->lro_xid; in fc_exch_mgr_alloc()
1767 mp->last_read = min_xid - 1; in fc_exch_mgr_alloc()
1768 mp->last_xid = mp->max_read; in fc_exch_mgr_alloc()
1774 INIT_LIST_HEAD(&mp->ex_list); in fc_exch_mgr_alloc()
1775 spin_lock_init(&mp->em_lock); in fc_exch_mgr_alloc()
1777 mp->ep_pool = mempool_create_slab_pool(2, fc_em_cachep); in fc_exch_mgr_alloc()
1778 if (!mp->ep_pool) in fc_exch_mgr_alloc()
1781 return mp; in fc_exch_mgr_alloc()
1784 kfree(mp); in fc_exch_mgr_alloc()
1789 void fc_exch_mgr_free(struct fc_exch_mgr *mp) in fc_exch_mgr_free() argument
1791 WARN_ON(!mp); in fc_exch_mgr_free()
1796 WARN_ON(mp->total_exches != 0); in fc_exch_mgr_free()
1797 mempool_destroy(mp->ep_pool); in fc_exch_mgr_free()
1798 kfree(mp); in fc_exch_mgr_free()
1867 void fc_exch_recv(struct fc_lport *lp, struct fc_exch_mgr *mp, in fc_exch_recv() argument
1874 if (!lp || !mp || (lp->state == LPORT_ST_NONE)) { in fc_exch_recv()
1891 fc_exch_recv_bls(mp, fp); in fc_exch_recv()
1894 fc_exch_recv_seq_resp(mp, fp); in fc_exch_recv()
1896 fc_exch_recv_resp(mp, fp); in fc_exch_recv()
1898 fc_exch_recv_req(lp, mp, fp); in fc_exch_recv()