Lines Matching defs:itnim
67 static void bfa_itnim_iocdisable_cleanup(struct bfa_itnim_s *itnim);
68 static bfa_boolean_t bfa_itnim_send_fwcreate(struct bfa_itnim_s *itnim);
69 static bfa_boolean_t bfa_itnim_send_fwdelete(struct bfa_itnim_s *itnim);
71 static void bfa_itnim_cleanup(struct bfa_itnim_s *itnim);
75 static void bfa_itnim_iotov_online(struct bfa_itnim_s *itnim);
76 static void bfa_itnim_iotov_cleanup(struct bfa_itnim_s *itnim);
78 static void bfa_itnim_iotov_start(struct bfa_itnim_s *itnim);
79 static void bfa_itnim_iotov_stop(struct bfa_itnim_s *itnim);
80 static void bfa_itnim_iotov_delete(struct bfa_itnim_s *itnim);
83 * bfa_itnim_sm BFA itnim state machine
88 BFA_ITNIM_SM_CREATE = 1, /* itnim is created */
89 BFA_ITNIM_SM_ONLINE = 2, /* itnim is online */
90 BFA_ITNIM_SM_OFFLINE = 3, /* itnim is offline */
92 BFA_ITNIM_SM_DELETE = 5, /* deleting an existing itnim */
99 static void bfa_itnim_sm_uninit(struct bfa_itnim_s *itnim,
101 static void bfa_itnim_sm_created(struct bfa_itnim_s *itnim,
103 static void bfa_itnim_sm_fwcreate(struct bfa_itnim_s *itnim,
105 static void bfa_itnim_sm_delete_pending(struct bfa_itnim_s *itnim,
107 static void bfa_itnim_sm_online(struct bfa_itnim_s *itnim,
109 static void bfa_itnim_sm_sler(struct bfa_itnim_s *itnim,
111 static void bfa_itnim_sm_cleanup_offline(struct bfa_itnim_s *itnim,
113 static void bfa_itnim_sm_cleanup_delete(struct bfa_itnim_s *itnim,
115 static void bfa_itnim_sm_fwdelete(struct bfa_itnim_s *itnim,
117 static void bfa_itnim_sm_offline(struct bfa_itnim_s *itnim,
119 static void bfa_itnim_sm_iocdisable(struct bfa_itnim_s *itnim,
121 static void bfa_itnim_sm_deleting(struct bfa_itnim_s *itnim,
123 static void bfa_itnim_sm_fwcreate_qfull(struct bfa_itnim_s *itnim,
125 static void bfa_itnim_sm_fwdelete_qfull(struct bfa_itnim_s *itnim,
127 static void bfa_itnim_sm_deleting_qfull(struct bfa_itnim_s *itnim,
134 bfa_itnim_sm_uninit(struct bfa_itnim_s *itnim, enum bfa_itnim_event event)
136 bfa_trc(itnim->bfa, itnim->rport->rport_tag);
137 bfa_trc(itnim->bfa, event);
141 bfa_sm_set_state(itnim, bfa_itnim_sm_created);
142 itnim->is_online = BFA_FALSE;
143 bfa_fcpim_additn(itnim);
147 bfa_sm_fault(itnim->bfa, event);
155 bfa_itnim_sm_created(struct bfa_itnim_s *itnim, enum bfa_itnim_event event)
157 bfa_trc(itnim->bfa, itnim->rport->rport_tag);
158 bfa_trc(itnim->bfa, event);
162 if (bfa_itnim_send_fwcreate(itnim))
163 bfa_sm_set_state(itnim, bfa_itnim_sm_fwcreate);
165 bfa_sm_set_state(itnim, bfa_itnim_sm_fwcreate_qfull);
169 bfa_sm_set_state(itnim, bfa_itnim_sm_uninit);
170 bfa_fcpim_delitn(itnim);
174 bfa_sm_set_state(itnim, bfa_itnim_sm_iocdisable);
178 bfa_sm_fault(itnim->bfa, event);
183 * Waiting for itnim create response from firmware.
186 bfa_itnim_sm_fwcreate(struct bfa_itnim_s *itnim, enum bfa_itnim_event event)
188 bfa_trc(itnim->bfa, itnim->rport->rport_tag);
189 bfa_trc(itnim->bfa, event);
193 bfa_sm_set_state(itnim, bfa_itnim_sm_online);
194 itnim->is_online = BFA_TRUE;
195 bfa_itnim_iotov_online(itnim);
196 bfa_itnim_online_cb(itnim);
200 bfa_sm_set_state(itnim, bfa_itnim_sm_delete_pending);
204 if (bfa_itnim_send_fwdelete(itnim))
205 bfa_sm_set_state(itnim, bfa_itnim_sm_fwdelete);
207 bfa_sm_set_state(itnim, bfa_itnim_sm_fwdelete_qfull);
211 bfa_sm_set_state(itnim, bfa_itnim_sm_iocdisable);
215 bfa_sm_fault(itnim->bfa, event);
220 bfa_itnim_sm_fwcreate_qfull(struct bfa_itnim_s *itnim,
223 bfa_trc(itnim->bfa, itnim->rport->rport_tag);
224 bfa_trc(itnim->bfa, event);
228 bfa_sm_set_state(itnim, bfa_itnim_sm_fwcreate);
229 bfa_itnim_send_fwcreate(itnim);
233 bfa_sm_set_state(itnim, bfa_itnim_sm_uninit);
234 bfa_reqq_wcancel(&itnim->reqq_wait);
235 bfa_fcpim_delitn(itnim);
239 bfa_sm_set_state(itnim, bfa_itnim_sm_offline);
240 bfa_reqq_wcancel(&itnim->reqq_wait);
241 bfa_itnim_offline_cb(itnim);
245 bfa_sm_set_state(itnim, bfa_itnim_sm_iocdisable);
246 bfa_reqq_wcancel(&itnim->reqq_wait);
250 bfa_sm_fault(itnim->bfa, event);
255 * Waiting for itnim create response from firmware, a delete is pending.
258 bfa_itnim_sm_delete_pending(struct bfa_itnim_s *itnim,
261 bfa_trc(itnim->bfa, itnim->rport->rport_tag);
262 bfa_trc(itnim->bfa, event);
266 if (bfa_itnim_send_fwdelete(itnim))
267 bfa_sm_set_state(itnim, bfa_itnim_sm_deleting);
269 bfa_sm_set_state(itnim, bfa_itnim_sm_deleting_qfull);
273 bfa_sm_set_state(itnim, bfa_itnim_sm_uninit);
274 bfa_fcpim_delitn(itnim);
278 bfa_sm_fault(itnim->bfa, event);
286 bfa_itnim_sm_online(struct bfa_itnim_s *itnim, enum bfa_itnim_event event)
288 bfa_trc(itnim->bfa, itnim->rport->rport_tag);
289 bfa_trc(itnim->bfa, event);
293 bfa_sm_set_state(itnim, bfa_itnim_sm_cleanup_offline);
294 itnim->is_online = BFA_FALSE;
295 bfa_itnim_iotov_start(itnim);
296 bfa_itnim_cleanup(itnim);
300 bfa_sm_set_state(itnim, bfa_itnim_sm_cleanup_delete);
301 itnim->is_online = BFA_FALSE;
302 bfa_itnim_cleanup(itnim);
306 bfa_sm_set_state(itnim, bfa_itnim_sm_sler);
307 itnim->is_online = BFA_FALSE;
308 bfa_itnim_iotov_start(itnim);
309 bfa_itnim_sler_cb(itnim);
313 bfa_sm_set_state(itnim, bfa_itnim_sm_iocdisable);
314 itnim->is_online = BFA_FALSE;
315 bfa_itnim_iotov_start(itnim);
316 bfa_itnim_iocdisable_cleanup(itnim);
320 bfa_sm_fault(itnim->bfa, event);
328 bfa_itnim_sm_sler(struct bfa_itnim_s *itnim, enum bfa_itnim_event event)
330 bfa_trc(itnim->bfa, itnim->rport->rport_tag);
331 bfa_trc(itnim->bfa, event);
335 bfa_sm_set_state(itnim, bfa_itnim_sm_cleanup_offline);
336 bfa_itnim_cleanup(itnim);
340 bfa_sm_set_state(itnim, bfa_itnim_sm_cleanup_delete);
341 bfa_itnim_cleanup(itnim);
342 bfa_itnim_iotov_delete(itnim);
346 bfa_sm_set_state(itnim, bfa_itnim_sm_iocdisable);
347 bfa_itnim_iocdisable_cleanup(itnim);
351 bfa_sm_fault(itnim->bfa, event);
359 bfa_itnim_sm_cleanup_offline(struct bfa_itnim_s *itnim,
362 bfa_trc(itnim->bfa, itnim->rport->rport_tag);
363 bfa_trc(itnim->bfa, event);
367 if (bfa_itnim_send_fwdelete(itnim))
368 bfa_sm_set_state(itnim, bfa_itnim_sm_fwdelete);
370 bfa_sm_set_state(itnim, bfa_itnim_sm_fwdelete_qfull);
374 bfa_sm_set_state(itnim, bfa_itnim_sm_cleanup_delete);
375 bfa_itnim_iotov_delete(itnim);
379 bfa_sm_set_state(itnim, bfa_itnim_sm_iocdisable);
380 bfa_itnim_iocdisable_cleanup(itnim);
381 bfa_itnim_offline_cb(itnim);
388 bfa_sm_fault(itnim->bfa, event);
393 * Deleting itnim. Waiting for active IO cleanup.
396 bfa_itnim_sm_cleanup_delete(struct bfa_itnim_s *itnim,
399 bfa_trc(itnim->bfa, itnim->rport->rport_tag);
400 bfa_trc(itnim->bfa, event);
404 if (bfa_itnim_send_fwdelete(itnim))
405 bfa_sm_set_state(itnim, bfa_itnim_sm_deleting);
407 bfa_sm_set_state(itnim, bfa_itnim_sm_deleting_qfull);
411 bfa_sm_set_state(itnim, bfa_itnim_sm_iocdisable);
412 bfa_itnim_iocdisable_cleanup(itnim);
416 bfa_sm_fault(itnim->bfa, event);
421 * Rport offline. Fimrware itnim is being deleted - awaiting f/w response.
424 bfa_itnim_sm_fwdelete(struct bfa_itnim_s *itnim, enum bfa_itnim_event event)
426 bfa_trc(itnim->bfa, itnim->rport->rport_tag);
427 bfa_trc(itnim->bfa, event);
431 bfa_sm_set_state(itnim, bfa_itnim_sm_offline);
432 bfa_itnim_offline_cb(itnim);
436 bfa_sm_set_state(itnim, bfa_itnim_sm_deleting);
440 bfa_sm_set_state(itnim, bfa_itnim_sm_iocdisable);
441 bfa_itnim_offline_cb(itnim);
445 bfa_sm_fault(itnim->bfa, event);
450 bfa_itnim_sm_fwdelete_qfull(struct bfa_itnim_s *itnim,
453 bfa_trc(itnim->bfa, itnim->rport->rport_tag);
454 bfa_trc(itnim->bfa, event);
458 bfa_sm_set_state(itnim, bfa_itnim_sm_fwdelete);
459 bfa_itnim_send_fwdelete(itnim);
463 bfa_sm_set_state(itnim, bfa_itnim_sm_deleting_qfull);
467 bfa_sm_set_state(itnim, bfa_itnim_sm_iocdisable);
468 bfa_reqq_wcancel(&itnim->reqq_wait);
469 bfa_itnim_offline_cb(itnim);
473 bfa_sm_fault(itnim->bfa, event);
481 bfa_itnim_sm_offline(struct bfa_itnim_s *itnim, enum bfa_itnim_event event)
483 bfa_trc(itnim->bfa, itnim->rport->rport_tag);
484 bfa_trc(itnim->bfa, event);
488 bfa_sm_set_state(itnim, bfa_itnim_sm_uninit);
489 bfa_itnim_iotov_delete(itnim);
490 bfa_fcpim_delitn(itnim);
494 if (bfa_itnim_send_fwcreate(itnim))
495 bfa_sm_set_state(itnim, bfa_itnim_sm_fwcreate);
497 bfa_sm_set_state(itnim, bfa_itnim_sm_fwcreate_qfull);
501 bfa_sm_set_state(itnim, bfa_itnim_sm_iocdisable);
505 bfa_sm_fault(itnim->bfa, event);
513 bfa_itnim_sm_iocdisable(struct bfa_itnim_s *itnim,
516 bfa_trc(itnim->bfa, itnim->rport->rport_tag);
517 bfa_trc(itnim->bfa, event);
521 bfa_sm_set_state(itnim, bfa_itnim_sm_uninit);
522 bfa_itnim_iotov_delete(itnim);
523 bfa_fcpim_delitn(itnim);
527 bfa_itnim_offline_cb(itnim);
531 if (bfa_itnim_send_fwcreate(itnim))
532 bfa_sm_set_state(itnim, bfa_itnim_sm_fwcreate);
534 bfa_sm_set_state(itnim, bfa_itnim_sm_fwcreate_qfull);
541 bfa_sm_fault(itnim->bfa, event);
549 bfa_itnim_sm_deleting(struct bfa_itnim_s *itnim, enum bfa_itnim_event event)
551 bfa_trc(itnim->bfa, itnim->rport->rport_tag);
552 bfa_trc(itnim->bfa, event);
557 bfa_sm_set_state(itnim, bfa_itnim_sm_uninit);
558 bfa_fcpim_delitn(itnim);
562 bfa_sm_fault(itnim->bfa, event);
567 bfa_itnim_sm_deleting_qfull(struct bfa_itnim_s *itnim,
570 bfa_trc(itnim->bfa, itnim->rport->rport_tag);
571 bfa_trc(itnim->bfa, event);
575 bfa_sm_set_state(itnim, bfa_itnim_sm_deleting);
576 bfa_itnim_send_fwdelete(itnim);
580 bfa_sm_set_state(itnim, bfa_itnim_sm_uninit);
581 bfa_reqq_wcancel(&itnim->reqq_wait);
582 bfa_fcpim_delitn(itnim);
586 bfa_sm_fault(itnim->bfa, event);
600 bfa_itnim_iocdisable_cleanup(struct bfa_itnim_s *itnim)
606 list_for_each_safe(qe, qen, &itnim->tsk_q) {
611 list_for_each_safe(qe, qen, &itnim->io_q) {
619 list_for_each_safe(qe, qen, &itnim->pending_q) {
624 list_for_each_safe(qe, qen, &itnim->io_cleanup_q) {
636 struct bfa_itnim_s *itnim = itnim_cbarg;
638 bfa_stats(itnim, cleanup_comps);
639 bfa_sm_send_event(itnim, BFA_ITNIM_SM_CLEANUP);
646 bfa_itnim_cleanup(struct bfa_itnim_s *itnim)
652 bfa_wc_init(&itnim->wc, bfa_itnim_cleanp_comp, itnim);
654 list_for_each_safe(qe, qen, &itnim->io_q) {
662 list_add_tail(&ioim->qe, &itnim->io_cleanup_q);
664 bfa_wc_up(&itnim->wc);
668 list_for_each_safe(qe, qen, &itnim->tsk_q) {
670 bfa_wc_up(&itnim->wc);
674 bfa_wc_wait(&itnim->wc);
680 struct bfa_itnim_s *itnim = cbarg;
683 bfa_cb_itnim_online(itnim->ditn);
689 struct bfa_itnim_s *itnim = cbarg;
692 bfa_cb_itnim_offline(itnim->ditn);
698 struct bfa_itnim_s *itnim = cbarg;
701 bfa_cb_itnim_sler(itnim->ditn);
710 struct bfa_itnim_s *itnim = cbarg;
712 bfa_sm_send_event(itnim, BFA_ITNIM_SM_QRESUME);
723 bfa_itnim_iodone(struct bfa_itnim_s *itnim)
725 bfa_wc_down(&itnim->wc);
729 bfa_itnim_tskdone(struct bfa_itnim_s *itnim)
731 bfa_wc_down(&itnim->wc);
748 struct bfa_itnim_s *itnim;
753 itnim = (struct bfa_itnim_s *) bfa_meminfo_kva(minfo);
754 fcpim->itnim_arr = itnim;
756 for (i = 0; i < fcpim->num_itnims; i++, itnim++) {
757 bfa_os_memset(itnim, 0, sizeof(struct bfa_itnim_s));
758 itnim->bfa = bfa;
759 itnim->fcpim = fcpim;
760 itnim->reqq = BFA_REQQ_QOS_LO;
761 itnim->rport = BFA_RPORT_FROM_TAG(bfa, i);
762 itnim->iotov_active = BFA_FALSE;
763 bfa_reqq_winit(&itnim->reqq_wait, bfa_itnim_qresume, itnim);
765 INIT_LIST_HEAD(&itnim->io_q);
766 INIT_LIST_HEAD(&itnim->io_cleanup_q);
767 INIT_LIST_HEAD(&itnim->pending_q);
768 INIT_LIST_HEAD(&itnim->tsk_q);
769 INIT_LIST_HEAD(&itnim->delay_comp_q);
770 bfa_sm_set_state(itnim, bfa_itnim_sm_uninit);
773 bfa_meminfo_kva(minfo) = (u8 *) itnim;
777 bfa_itnim_iocdisable(struct bfa_itnim_s *itnim)
779 bfa_stats(itnim, ioc_disabled);
780 bfa_sm_send_event(itnim, BFA_ITNIM_SM_HWFAIL);
784 bfa_itnim_send_fwcreate(struct bfa_itnim_s *itnim)
788 itnim->msg_no++;
793 m = bfa_reqq_next(itnim->bfa, itnim->reqq);
795 bfa_reqq_wait(itnim->bfa, itnim->reqq, &itnim->reqq_wait);
800 bfa_lpuid(itnim->bfa));
801 m->fw_handle = itnim->rport->fw_handle;
803 m->seq_rec = itnim->seq_rec;
804 m->msg_no = itnim->msg_no;
809 bfa_reqq_produce(itnim->bfa, itnim->reqq);
814 bfa_itnim_send_fwdelete(struct bfa_itnim_s *itnim)
821 m = bfa_reqq_next(itnim->bfa, itnim->reqq);
823 bfa_reqq_wait(itnim->bfa, itnim->reqq, &itnim->reqq_wait);
828 bfa_lpuid(itnim->bfa));
829 m->fw_handle = itnim->rport->fw_handle;
834 bfa_reqq_produce(itnim->bfa, itnim->reqq);
842 bfa_itnim_delayed_comp(struct bfa_itnim_s *itnim, bfa_boolean_t iotov)
847 list_for_each_safe(qe, qen, &itnim->delay_comp_q) {
857 bfa_itnim_iotov_online(struct bfa_itnim_s *itnim)
861 bfa_itnim_iotov_stop(itnim);
866 bfa_itnim_delayed_comp(itnim, BFA_FALSE);
871 while (!list_empty(&itnim->pending_q)) {
872 bfa_q_deq(&itnim->pending_q, &ioim);
873 list_add_tail(&ioim->qe, &itnim->io_q);
882 bfa_itnim_iotov_cleanup(struct bfa_itnim_s *itnim)
889 bfa_itnim_delayed_comp(itnim, BFA_TRUE);
894 while (!list_empty(&itnim->pending_q)) {
895 bfa_q_deq(&itnim->pending_q, &ioim);
907 struct bfa_itnim_s *itnim = itnim_arg;
909 itnim->iotov_active = BFA_FALSE;
911 bfa_cb_itnim_tov_begin(itnim->ditn);
912 bfa_itnim_iotov_cleanup(itnim);
913 bfa_cb_itnim_tov(itnim->ditn);
920 bfa_itnim_iotov_start(struct bfa_itnim_s *itnim)
922 if (itnim->fcpim->path_tov > 0) {
924 itnim->iotov_active = BFA_TRUE;
925 bfa_assert(bfa_itnim_hold_io(itnim));
926 bfa_timer_start(itnim->bfa, &itnim->timer,
927 bfa_itnim_iotov, itnim, itnim->fcpim->path_tov);
935 bfa_itnim_iotov_stop(struct bfa_itnim_s *itnim)
937 if (itnim->iotov_active) {
938 itnim->iotov_active = BFA_FALSE;
939 bfa_timer_stop(&itnim->timer);
947 bfa_itnim_iotov_delete(struct bfa_itnim_s *itnim)
951 if (itnim->iotov_active)
954 bfa_itnim_iotov_stop(itnim);
956 bfa_cb_itnim_tov_begin(itnim->ditn);
957 bfa_itnim_iotov_cleanup(itnim);
959 bfa_cb_itnim_tov(itnim->ditn);
976 struct bfa_itnim_s *itnim;
984 itnim = BFA_ITNIM_FROM_TAG(fcpim,
987 bfa_stats(itnim, create_comps);
988 bfa_sm_send_event(itnim, BFA_ITNIM_SM_FWRSP);
992 itnim = BFA_ITNIM_FROM_TAG(fcpim,
995 bfa_stats(itnim, delete_comps);
996 bfa_sm_send_event(itnim, BFA_ITNIM_SM_FWRSP);
1000 itnim = BFA_ITNIM_FROM_TAG(fcpim,
1002 bfa_stats(itnim, sler_events);
1003 bfa_sm_send_event(itnim, BFA_ITNIM_SM_SLER);
1022 struct bfa_itnim_s *itnim;
1024 itnim = BFA_ITNIM_FROM_TAG(fcpim, rport->rport_tag);
1025 bfa_assert(itnim->rport == rport);
1027 itnim->ditn = ditn;
1029 bfa_stats(itnim, creates);
1030 bfa_sm_send_event(itnim, BFA_ITNIM_SM_CREATE);
1032 return itnim;
1036 bfa_itnim_delete(struct bfa_itnim_s *itnim)
1038 bfa_stats(itnim, deletes);
1039 bfa_sm_send_event(itnim, BFA_ITNIM_SM_DELETE);
1043 bfa_itnim_online(struct bfa_itnim_s *itnim, bfa_boolean_t seq_rec)
1045 itnim->seq_rec = seq_rec;
1046 bfa_stats(itnim, onlines);
1047 bfa_sm_send_event(itnim, BFA_ITNIM_SM_ONLINE);
1051 bfa_itnim_offline(struct bfa_itnim_s *itnim)
1053 bfa_stats(itnim, offlines);
1054 bfa_sm_send_event(itnim, BFA_ITNIM_SM_OFFLINE);
1058 * Return true if itnim is considered offline for holding off IO request.
1059 * IO is not held if itnim is being deleted.
1062 bfa_itnim_hold_io(struct bfa_itnim_s *itnim)
1065 itnim->fcpim->path_tov && itnim->iotov_active &&
1066 (bfa_sm_cmp_state(itnim, bfa_itnim_sm_fwcreate) ||
1067 bfa_sm_cmp_state(itnim, bfa_itnim_sm_sler) ||
1068 bfa_sm_cmp_state(itnim, bfa_itnim_sm_cleanup_offline) ||
1069 bfa_sm_cmp_state(itnim, bfa_itnim_sm_fwdelete) ||
1070 bfa_sm_cmp_state(itnim, bfa_itnim_sm_offline) ||
1071 bfa_sm_cmp_state(itnim, bfa_itnim_sm_iocdisable))
1076 bfa_itnim_get_stats(struct bfa_itnim_s *itnim,
1079 *stats = itnim->stats;
1083 bfa_itnim_clear_stats(struct bfa_itnim_s *itnim)
1085 bfa_os_memset(&itnim->stats, 0, sizeof(itnim->stats));