Lines Matching refs:rn

89 csio_is_rnode_ready(struct csio_rnode *rn)  in csio_is_rnode_ready()  argument
91 return csio_match_state(rn, csio_rns_ready); in csio_is_rnode_ready()
95 csio_is_rnode_uninit(struct csio_rnode *rn) in csio_is_rnode_uninit() argument
97 return csio_match_state(rn, csio_rns_uninit); in csio_is_rnode_uninit()
125 struct csio_rnode *rn; in csio_rn_lookup() local
128 rn = (struct csio_rnode *) tmp; in csio_rn_lookup()
129 if (rn->flowid == flowid) in csio_rn_lookup()
130 return rn; in csio_rn_lookup()
149 struct csio_rnode *rn; in csio_rn_lookup_wwpn() local
152 rn = (struct csio_rnode *) tmp; in csio_rn_lookup_wwpn()
153 if (!memcmp(csio_rn_wwpn(rn), wwpn, 8)) in csio_rn_lookup_wwpn()
154 return rn; in csio_rn_lookup_wwpn()
173 struct csio_rnode *rn; in csio_rnode_lookup_portid() local
176 rn = (struct csio_rnode *) tmp; in csio_rnode_lookup_portid()
177 if (rn->nport_id == portid) in csio_rnode_lookup_portid()
178 return rn; in csio_rnode_lookup_portid()
190 struct csio_rnode *rn; in csio_rn_dup_flowid() local
202 rn = (struct csio_rnode *) tmp; in csio_rn_dup_flowid()
203 if (csio_is_rnode_ready(rn)) { in csio_rn_dup_flowid()
204 if (rn->flowid == rdev_flowid) { in csio_rn_dup_flowid()
220 struct csio_rnode *rn = mempool_alloc(hw->rnode_mempool, GFP_ATOMIC); in csio_alloc_rnode() local
221 if (!rn) in csio_alloc_rnode()
224 memset(rn, 0, sizeof(struct csio_rnode)); in csio_alloc_rnode()
225 if (csio_rnode_init(rn, ln)) in csio_alloc_rnode()
230 return rn; in csio_alloc_rnode()
233 mempool_free(rn, hw->rnode_mempool); in csio_alloc_rnode()
240 csio_free_rnode(struct csio_rnode *rn) in csio_free_rnode() argument
242 struct csio_hw *hw = csio_lnode_to_hw(csio_rnode_to_lnode(rn)); in csio_free_rnode()
244 csio_rnode_exit(rn); in csio_free_rnode()
245 CSIO_INC_STATS(rn->lnp, n_rnode_free); in csio_free_rnode()
246 mempool_free(rn, hw->rnode_mempool); in csio_free_rnode()
260 struct csio_rnode *rn; in csio_get_rnode() local
262 rn = csio_rn_lookup(ln, flowid); in csio_get_rnode()
263 if (!rn) { in csio_get_rnode()
264 rn = csio_alloc_rnode(ln); in csio_get_rnode()
265 if (!rn) in csio_get_rnode()
268 rn->flowid = flowid; in csio_get_rnode()
271 return rn; in csio_get_rnode()
283 csio_put_rnode(struct csio_lnode *ln, struct csio_rnode *rn) in csio_put_rnode() argument
285 CSIO_DB_ASSERT(csio_is_rnode_uninit(rn) != 0); in csio_put_rnode()
286 csio_free_rnode(rn); in csio_put_rnode()
304 struct csio_rnode *rn, *match_rn; in csio_confirm_rnode() local
321 rn = csio_rn_lookup(ln, rdev_flowid); in csio_confirm_rnode()
322 if (!rn) { in csio_confirm_rnode()
333 rn = csio_rn_lookup_wwpn(ln, rdevp->wwpn); in csio_confirm_rnode()
334 if (!rn) in csio_confirm_rnode()
343 csio_rn_flowid(rn) = CSIO_INVALID_IDX; in csio_confirm_rnode()
353 if (rn == match_rn) in csio_confirm_rnode()
358 rn->nport_id, in csio_confirm_rnode()
361 if (csio_is_rnode_ready(rn)) { in csio_confirm_rnode()
368 csio_rn_flowid(rn) = CSIO_INVALID_IDX; in csio_confirm_rnode()
369 rn = match_rn; in csio_confirm_rnode()
374 csio_rn_flowid(rn) = CSIO_INVALID_IDX; in csio_confirm_rnode()
379 if (!memcmp(csio_rn_wwpn(rn), rdevp->wwpn, 8)) in csio_confirm_rnode()
390 csio_rn_flowid(rn) = CSIO_INVALID_IDX; in csio_confirm_rnode()
391 rn = match_rn; in csio_confirm_rnode()
397 wwn_to_u64(csio_rn_wwpn(rn))); in csio_confirm_rnode()
398 if (csio_is_rnode_ready(rn)) { in csio_confirm_rnode()
402 wwn_to_u64(csio_rn_wwpn(rn)), in csio_confirm_rnode()
406 csio_rn_flowid(rn) = CSIO_INVALID_IDX; in csio_confirm_rnode()
413 rn, rdev_flowid, wwn_to_u64(rdevp->wwpn)); in csio_confirm_rnode()
416 csio_rn_flowid(rn) = rdev_flowid; in csio_confirm_rnode()
419 rn->rdev_entry = rdevp; in csio_confirm_rnode()
421 return rn; in csio_confirm_rnode()
424 rn = csio_get_rnode(ln, rdev_flowid); in csio_confirm_rnode()
425 if (!rn) in csio_confirm_rnode()
429 rn, rdev_flowid, wwn_to_u64(rdevp->wwpn)); in csio_confirm_rnode()
432 rn->rdev_entry = rdevp; in csio_confirm_rnode()
433 return rn; in csio_confirm_rnode()
444 csio_rn_verify_rparams(struct csio_lnode *ln, struct csio_rnode *rn, in csio_rn_verify_rparams() argument
457 rn->role = CSIO_RNFR_FABRIC; in csio_rn_verify_rparams()
460 csio_rn_flowid(rn)); in csio_rn_verify_rparams()
470 rn->role = CSIO_RNFR_NS; in csio_rn_verify_rparams()
473 csio_rn_flowid(rn)); in csio_rn_verify_rparams()
480 rn->role = CSIO_RNFR_NPORT; in csio_rn_verify_rparams()
485 rn->fcp_flags |= FCP_SPPF_OVLY_ALLOW; in csio_rn_verify_rparams()
488 rn->fcp_flags |= FCP_SPPF_RETRY; in csio_rn_verify_rparams()
491 rn->fcp_flags |= FCP_SPPF_CONF_COMPL; in csio_rn_verify_rparams()
494 rn->role |= CSIO_RNFR_TARGET; in csio_rn_verify_rparams()
497 rn->role |= CSIO_RNFR_INITIATOR; in csio_rn_verify_rparams()
504 rn->role = 0; in csio_rn_verify_rparams()
509 csio_rn_flowid(rn), rport_type); in csio_rn_verify_rparams()
520 csio_rn_flowid(rn), in csio_rn_verify_rparams()
529 csio_rn_flowid(rn), in csio_rn_verify_rparams()
537 rn->nport_id = (ntohl(*did) >> 8) & CSIO_DID_MASK; in csio_rn_verify_rparams()
538 memcpy(csio_rn_wwnn(rn), rdevp->wwnn, 8); in csio_rn_verify_rparams()
539 memcpy(csio_rn_wwpn(rn), rdevp->wwpn, 8); in csio_rn_verify_rparams()
540 rn->rn_sparm.csp.sp_bb_data = rdevp->rcv_fr_sz; in csio_rn_verify_rparams()
542 rn->rn_sparm.clsp[fc_class - 1].cp_class = htons(FC_CPC_VALID); in csio_rn_verify_rparams()
548 __csio_reg_rnode(struct csio_rnode *rn) in __csio_reg_rnode() argument
550 struct csio_lnode *ln = csio_rnode_to_lnode(rn); in __csio_reg_rnode()
554 csio_reg_rnode(rn); in __csio_reg_rnode()
557 if (rn->role & CSIO_RNFR_TARGET) in __csio_reg_rnode()
560 if (rn->nport_id == FC_FID_MGMT_SERV) in __csio_reg_rnode()
561 csio_ln_fdmi_start(ln, (void *) rn); in __csio_reg_rnode()
565 __csio_unreg_rnode(struct csio_rnode *rn) in __csio_unreg_rnode() argument
567 struct csio_lnode *ln = csio_rnode_to_lnode(rn); in __csio_unreg_rnode()
572 if (!list_empty(&rn->host_cmpl_q)) { in __csio_unreg_rnode()
574 list_splice_tail_init(&rn->host_cmpl_q, &tmp_q); in __csio_unreg_rnode()
578 if (rn->role & CSIO_RNFR_TARGET) { in __csio_unreg_rnode()
584 csio_unreg_rnode(rn); in __csio_unreg_rnode()
604 csio_rns_uninit(struct csio_rnode *rn, enum csio_rn_ev evt) in csio_rns_uninit() argument
606 struct csio_lnode *ln = csio_rnode_to_lnode(rn); in csio_rns_uninit()
609 CSIO_INC_STATS(rn, n_evt_sm[evt]); in csio_rns_uninit()
614 ret = csio_rn_verify_rparams(ln, rn, rn->rdev_entry); in csio_rns_uninit()
616 csio_set_state(&rn->sm, csio_rns_ready); in csio_rns_uninit()
617 __csio_reg_rnode(rn); in csio_rns_uninit()
619 CSIO_INC_STATS(rn, n_err_inval); in csio_rns_uninit()
625 "in rn state[uninit]\n", csio_rn_flowid(rn), evt); in csio_rns_uninit()
626 CSIO_INC_STATS(rn, n_evt_drop); in csio_rns_uninit()
631 "in rn state[uninit]\n", csio_rn_flowid(rn), evt); in csio_rns_uninit()
632 CSIO_INC_STATS(rn, n_evt_unexp); in csio_rns_uninit()
644 csio_rns_ready(struct csio_rnode *rn, enum csio_rn_ev evt) in csio_rns_ready() argument
646 struct csio_lnode *ln = csio_rnode_to_lnode(rn); in csio_rns_ready()
649 CSIO_INC_STATS(rn, n_evt_sm[evt]); in csio_rns_ready()
656 "in rn state[ready]\n", csio_rn_flowid(rn), evt, in csio_rns_ready()
657 rn->nport_id); in csio_rns_ready()
658 CSIO_INC_STATS(rn, n_evt_drop); in csio_rns_ready()
663 ret = csio_rn_verify_rparams(ln, rn, rn->rdev_entry); in csio_rns_ready()
665 __csio_reg_rnode(rn); in csio_rns_ready()
667 CSIO_INC_STATS(rn, n_err_inval); in csio_rns_ready()
671 csio_set_state(&rn->sm, csio_rns_offline); in csio_rns_ready()
672 __csio_unreg_rnode(rn); in csio_rns_ready()
680 csio_set_state(&rn->sm, csio_rns_offline); in csio_rns_ready()
682 __csio_unreg_rnode(rn); in csio_rns_ready()
697 csio_set_state(&rn->sm, csio_rns_uninit); in csio_rns_ready()
698 __csio_unreg_rnode(rn); in csio_rns_ready()
702 csio_set_state(&rn->sm, csio_rns_disappeared); in csio_rns_ready()
703 __csio_unreg_rnode(rn); in csio_rns_ready()
715 "in rn state[uninit]\n", csio_rn_flowid(rn), evt, in csio_rns_ready()
716 rn->nport_id); in csio_rns_ready()
717 CSIO_INC_STATS(rn, n_evt_unexp); in csio_rns_ready()
729 csio_rns_offline(struct csio_rnode *rn, enum csio_rn_ev evt) in csio_rns_offline() argument
731 struct csio_lnode *ln = csio_rnode_to_lnode(rn); in csio_rns_offline()
734 CSIO_INC_STATS(rn, n_evt_sm[evt]); in csio_rns_offline()
739 ret = csio_rn_verify_rparams(ln, rn, rn->rdev_entry); in csio_rns_offline()
741 csio_set_state(&rn->sm, csio_rns_ready); in csio_rns_offline()
742 __csio_reg_rnode(rn); in csio_rns_offline()
744 CSIO_INC_STATS(rn, n_err_inval); in csio_rns_offline()
745 csio_post_event(&rn->sm, CSIO_RNFE_CLOSE); in csio_rns_offline()
752 "in rn state[offline]\n", csio_rn_flowid(rn), evt, in csio_rns_offline()
753 rn->nport_id); in csio_rns_offline()
754 CSIO_INC_STATS(rn, n_evt_drop); in csio_rns_offline()
764 csio_set_state(&rn->sm, csio_rns_uninit); in csio_rns_offline()
768 csio_set_state(&rn->sm, csio_rns_disappeared); in csio_rns_offline()
774 "in rn state[offline]\n", csio_rn_flowid(rn), evt, in csio_rns_offline()
775 rn->nport_id); in csio_rns_offline()
776 CSIO_INC_STATS(rn, n_evt_unexp); in csio_rns_offline()
788 csio_rns_disappeared(struct csio_rnode *rn, enum csio_rn_ev evt) in csio_rns_disappeared() argument
790 struct csio_lnode *ln = csio_rnode_to_lnode(rn); in csio_rns_disappeared()
793 CSIO_INC_STATS(rn, n_evt_sm[evt]); in csio_rns_disappeared()
798 ret = csio_rn_verify_rparams(ln, rn, rn->rdev_entry); in csio_rns_disappeared()
800 csio_set_state(&rn->sm, csio_rns_ready); in csio_rns_disappeared()
801 __csio_reg_rnode(rn); in csio_rns_disappeared()
803 CSIO_INC_STATS(rn, n_err_inval); in csio_rns_disappeared()
804 csio_post_event(&rn->sm, CSIO_RNFE_CLOSE); in csio_rns_disappeared()
815 csio_set_state(&rn->sm, csio_rns_uninit); in csio_rns_disappeared()
822 "in rn state[disappeared]\n", csio_rn_flowid(rn), in csio_rns_disappeared()
823 evt, rn->nport_id); in csio_rns_disappeared()
829 "in rn state[disappeared]\n", csio_rn_flowid(rn), in csio_rns_disappeared()
830 evt, rn->nport_id); in csio_rns_disappeared()
831 CSIO_INC_STATS(rn, n_evt_unexp); in csio_rns_disappeared()
847 csio_rnode_devloss_handler(struct csio_rnode *rn) in csio_rnode_devloss_handler() argument
849 struct csio_lnode *ln = csio_rnode_to_lnode(rn); in csio_rnode_devloss_handler()
852 if (csio_is_rnode_ready(rn)) in csio_rnode_devloss_handler()
855 csio_post_event(&rn->sm, CSIO_RNFE_CLOSE); in csio_rnode_devloss_handler()
858 if (csio_is_rnode_uninit(rn)) in csio_rnode_devloss_handler()
859 csio_put_rnode(ln, rn); in csio_rnode_devloss_handler()
868 csio_rnode_fwevt_handler(struct csio_rnode *rn, uint8_t fwevt) in csio_rnode_fwevt_handler() argument
870 struct csio_lnode *ln = csio_rnode_to_lnode(rn); in csio_rnode_fwevt_handler()
876 csio_rn_flowid(rn), fwevt); in csio_rnode_fwevt_handler()
877 CSIO_INC_STATS(rn, n_evt_unexp); in csio_rnode_fwevt_handler()
880 CSIO_INC_STATS(rn, n_evt_fw[fwevt]); in csio_rnode_fwevt_handler()
883 rn->prev_evt = rn->cur_evt; in csio_rnode_fwevt_handler()
884 rn->cur_evt = fwevt; in csio_rnode_fwevt_handler()
887 csio_post_event(&rn->sm, evt); in csio_rnode_fwevt_handler()
890 if (csio_is_rnode_uninit(rn)) in csio_rnode_fwevt_handler()
891 csio_put_rnode(ln, rn); in csio_rnode_fwevt_handler()
903 csio_rnode_init(struct csio_rnode *rn, struct csio_lnode *ln) in csio_rnode_init() argument
905 csio_rnode_to_lnode(rn) = ln; in csio_rnode_init()
906 csio_init_state(&rn->sm, csio_rns_uninit); in csio_rnode_init()
907 INIT_LIST_HEAD(&rn->host_cmpl_q); in csio_rnode_init()
908 csio_rn_flowid(rn) = CSIO_INVALID_IDX; in csio_rnode_init()
911 list_add_tail(&rn->sm.sm_list, &ln->rnhead); in csio_rnode_init()
917 csio_rnode_exit(struct csio_rnode *rn) in csio_rnode_exit() argument
919 list_del_init(&rn->sm.sm_list); in csio_rnode_exit()
920 CSIO_DB_ASSERT(list_empty(&rn->host_cmpl_q)); in csio_rnode_exit()