Lines Matching refs:tskim
42 static bfa_boolean_t bfa_tskim_match_scope(struct bfa_tskim_s *tskim,
44 static void bfa_tskim_gather_ios(struct bfa_tskim_s *tskim);
46 static void bfa_tskim_cleanup_ios(struct bfa_tskim_s *tskim);
47 static bfa_boolean_t bfa_tskim_send(struct bfa_tskim_s *tskim);
48 static bfa_boolean_t bfa_tskim_send_abort(struct bfa_tskim_s *tskim);
49 static void bfa_tskim_iocdisable_ios(struct bfa_tskim_s *tskim);
66 static void bfa_tskim_sm_uninit(struct bfa_tskim_s *tskim,
68 static void bfa_tskim_sm_active(struct bfa_tskim_s *tskim,
70 static void bfa_tskim_sm_cleanup(struct bfa_tskim_s *tskim,
72 static void bfa_tskim_sm_iocleanup(struct bfa_tskim_s *tskim,
74 static void bfa_tskim_sm_qfull(struct bfa_tskim_s *tskim,
76 static void bfa_tskim_sm_cleanup_qfull(struct bfa_tskim_s *tskim,
78 static void bfa_tskim_sm_hcb(struct bfa_tskim_s *tskim,
85 bfa_tskim_sm_uninit(struct bfa_tskim_s *tskim, enum bfa_tskim_event event)
87 bfa_trc(tskim->bfa, event);
91 bfa_sm_set_state(tskim, bfa_tskim_sm_active);
92 bfa_tskim_gather_ios(tskim);
98 if (!bfa_itnim_is_online(tskim->itnim)) {
99 bfa_sm_set_state(tskim, bfa_tskim_sm_iocleanup);
100 tskim->tsk_status = BFI_TSKIM_STS_OK;
101 bfa_tskim_cleanup_ios(tskim);
105 if (!bfa_tskim_send(tskim)) {
106 bfa_sm_set_state(tskim, bfa_tskim_sm_qfull);
107 bfa_reqq_wait(tskim->bfa, tskim->itnim->reqq,
108 &tskim->reqq_wait);
113 bfa_sm_fault(tskim->bfa, event);
123 bfa_tskim_sm_active(struct bfa_tskim_s *tskim, enum bfa_tskim_event event)
125 bfa_trc(tskim->bfa, event);
129 bfa_sm_set_state(tskim, bfa_tskim_sm_iocleanup);
130 bfa_tskim_cleanup_ios(tskim);
134 bfa_sm_set_state(tskim, bfa_tskim_sm_cleanup);
135 if (!bfa_tskim_send_abort(tskim)) {
136 bfa_sm_set_state(tskim, bfa_tskim_sm_cleanup_qfull);
137 bfa_reqq_wait(tskim->bfa, tskim->itnim->reqq,
138 &tskim->reqq_wait);
143 bfa_sm_set_state(tskim, bfa_tskim_sm_hcb);
144 bfa_tskim_iocdisable_ios(tskim);
145 bfa_tskim_qcomp(tskim, __bfa_cb_tskim_failed);
149 bfa_sm_fault(tskim->bfa, event);
158 bfa_tskim_sm_cleanup(struct bfa_tskim_s *tskim, enum bfa_tskim_event event)
160 bfa_trc(tskim->bfa, event);
170 bfa_sm_set_state(tskim, bfa_tskim_sm_iocleanup);
171 bfa_tskim_cleanup_ios(tskim);
175 bfa_sm_set_state(tskim, bfa_tskim_sm_hcb);
176 bfa_tskim_iocdisable_ios(tskim);
177 bfa_tskim_qcomp(tskim, __bfa_cb_tskim_failed);
181 bfa_sm_fault(tskim->bfa, event);
186 bfa_tskim_sm_iocleanup(struct bfa_tskim_s *tskim, enum bfa_tskim_event event)
188 bfa_trc(tskim->bfa, event);
192 bfa_sm_set_state(tskim, bfa_tskim_sm_hcb);
193 bfa_tskim_qcomp(tskim, __bfa_cb_tskim_done);
204 bfa_sm_set_state(tskim, bfa_tskim_sm_hcb);
205 bfa_tskim_iocdisable_ios(tskim);
206 bfa_tskim_qcomp(tskim, __bfa_cb_tskim_failed);
210 bfa_sm_fault(tskim->bfa, event);
218 bfa_tskim_sm_qfull(struct bfa_tskim_s *tskim, enum bfa_tskim_event event)
220 bfa_trc(tskim->bfa, event);
224 bfa_sm_set_state(tskim, bfa_tskim_sm_active);
225 bfa_tskim_send(tskim);
232 bfa_sm_set_state(tskim, bfa_tskim_sm_iocleanup);
233 bfa_reqq_wcancel(&tskim->reqq_wait);
234 bfa_tskim_cleanup_ios(tskim);
238 bfa_sm_set_state(tskim, bfa_tskim_sm_hcb);
239 bfa_reqq_wcancel(&tskim->reqq_wait);
240 bfa_tskim_iocdisable_ios(tskim);
241 bfa_tskim_qcomp(tskim, __bfa_cb_tskim_failed);
245 bfa_sm_fault(tskim->bfa, event);
254 bfa_tskim_sm_cleanup_qfull(struct bfa_tskim_s *tskim,
257 bfa_trc(tskim->bfa, event);
261 bfa_reqq_wcancel(&tskim->reqq_wait);
268 bfa_sm_set_state(tskim, bfa_tskim_sm_cleanup);
269 bfa_tskim_send_abort(tskim);
273 bfa_sm_set_state(tskim, bfa_tskim_sm_hcb);
274 bfa_reqq_wcancel(&tskim->reqq_wait);
275 bfa_tskim_iocdisable_ios(tskim);
276 bfa_tskim_qcomp(tskim, __bfa_cb_tskim_failed);
280 bfa_sm_fault(tskim->bfa, event);
288 bfa_tskim_sm_hcb(struct bfa_tskim_s *tskim, enum bfa_tskim_event event)
290 bfa_trc(tskim->bfa, event);
294 bfa_sm_set_state(tskim, bfa_tskim_sm_uninit);
295 bfa_tskim_free(tskim);
299 bfa_tskim_notify_comp(tskim);
306 bfa_sm_fault(tskim->bfa, event);
319 struct bfa_tskim_s *tskim = cbarg;
322 bfa_sm_send_event(tskim, BFA_TSKIM_SM_HCB);
326 bfa_stats(tskim->itnim, tm_success);
327 bfa_cb_tskim_done(tskim->bfa->bfad, tskim->dtsk, tskim->tsk_status);
333 struct bfa_tskim_s *tskim = cbarg;
336 bfa_sm_send_event(tskim, BFA_TSKIM_SM_HCB);
340 bfa_stats(tskim->itnim, tm_failures);
341 bfa_cb_tskim_done(tskim->bfa->bfad, tskim->dtsk,
346 bfa_tskim_match_scope(struct bfa_tskim_s *tskim, lun_t lun)
348 switch (tskim->tm_cmnd) {
356 return (tskim->lun == lun);
369 bfa_tskim_gather_ios(struct bfa_tskim_s *tskim)
371 struct bfa_itnim_s *itnim = tskim->itnim;
375 INIT_LIST_HEAD(&tskim->io_q);
383 (tskim, bfa_cb_ioim_get_lun(ioim->dio))) {
385 list_add_tail(&ioim->qe, &tskim->io_q);
395 (tskim, bfa_cb_ioim_get_lun(ioim->dio))) {
409 struct bfa_tskim_s *tskim = tskim_cbarg;
411 bfa_stats(tskim->itnim, tm_io_comps);
412 bfa_sm_send_event(tskim, BFA_TSKIM_SM_IOS_DONE);
419 bfa_tskim_cleanup_ios(struct bfa_tskim_s *tskim)
424 bfa_wc_init(&tskim->wc, bfa_tskim_cleanp_comp, tskim);
426 list_for_each_safe(qe, qen, &tskim->io_q) {
428 bfa_wc_up(&tskim->wc);
429 bfa_ioim_cleanup_tm(ioim, tskim);
432 bfa_wc_wait(&tskim->wc);
439 bfa_tskim_send(struct bfa_tskim_s *tskim)
441 struct bfa_itnim_s *itnim = tskim->itnim;
447 m = bfa_reqq_next(tskim->bfa, itnim->reqq);
455 bfa_lpuid(tskim->bfa));
457 m->tsk_tag = bfa_os_htons(tskim->tsk_tag);
458 m->itn_fhdl = tskim->itnim->rport->fw_handle;
459 m->t_secs = tskim->tsecs;
460 m->lun = tskim->lun;
461 m->tm_flags = tskim->tm_cmnd;
466 bfa_reqq_produce(tskim->bfa, itnim->reqq);
474 bfa_tskim_send_abort(struct bfa_tskim_s *tskim)
476 struct bfa_itnim_s *itnim = tskim->itnim;
482 m = bfa_reqq_next(tskim->bfa, itnim->reqq);
490 bfa_lpuid(tskim->bfa));
492 m->tsk_tag = bfa_os_htons(tskim->tsk_tag);
497 bfa_reqq_produce(tskim->bfa, itnim->reqq);
507 struct bfa_tskim_s *tskim = cbarg;
509 bfa_fcpim_stats(tskim->fcpim, qresumes);
510 bfa_stats(tskim->itnim, tm_qresumes);
511 bfa_sm_send_event(tskim, BFA_TSKIM_SM_QRESUME);
518 bfa_tskim_iocdisable_ios(struct bfa_tskim_s *tskim)
523 list_for_each_safe(qe, qen, &tskim->io_q) {
539 bfa_tskim_iodone(struct bfa_tskim_s *tskim)
541 bfa_wc_down(&tskim->wc);
548 bfa_tskim_iocdisable(struct bfa_tskim_s *tskim)
550 tskim->notify = BFA_FALSE;
551 bfa_stats(tskim->itnim, tm_iocdowns);
552 bfa_sm_send_event(tskim, BFA_TSKIM_SM_HWFAIL);
559 bfa_tskim_cleanup(struct bfa_tskim_s *tskim)
561 tskim->notify = BFA_TRUE;
562 bfa_stats(tskim->itnim, tm_cleanups);
563 bfa_sm_send_event(tskim, BFA_TSKIM_SM_CLEANUP);
572 struct bfa_tskim_s *tskim;
577 tskim = (struct bfa_tskim_s *) bfa_meminfo_kva(minfo);
578 fcpim->tskim_arr = tskim;
580 for (i = 0; i < fcpim->num_tskim_reqs; i++, tskim++) {
584 bfa_os_memset(tskim, 0, sizeof(struct bfa_tskim_s));
585 tskim->tsk_tag = i;
586 tskim->bfa = fcpim->bfa;
587 tskim->fcpim = fcpim;
588 tskim->notify = BFA_FALSE;
589 bfa_reqq_winit(&tskim->reqq_wait, bfa_tskim_qresume,
590 tskim);
591 bfa_sm_set_state(tskim, bfa_tskim_sm_uninit);
593 list_add_tail(&tskim->qe, &fcpim->tskim_free_q);
596 bfa_meminfo_kva(minfo) = (u8 *) tskim;
612 struct bfa_tskim_s *tskim;
615 tskim = BFA_TSKIM_FROM_TAG(fcpim, tsk_tag);
616 bfa_assert(tskim->tsk_tag == tsk_tag);
618 tskim->tsk_status = rsp->tsk_status;
625 bfa_stats(tskim->itnim, tm_cleanup_comps);
626 bfa_sm_send_event(tskim, BFA_TSKIM_SM_CLEANUP_DONE);
628 bfa_stats(tskim->itnim, tm_fw_rsps);
629 bfa_sm_send_event(tskim, BFA_TSKIM_SM_DONE);
644 struct bfa_tskim_s *tskim;
646 bfa_q_deq(&fcpim->tskim_free_q, &tskim);
648 if (!tskim)
651 tskim->dtsk = dtsk;
653 return tskim;
657 bfa_tskim_free(struct bfa_tskim_s *tskim)
659 bfa_assert(bfa_q_is_on_q_func(&tskim->itnim->tsk_q, &tskim->qe));
660 list_del(&tskim->qe);
661 list_add_tail(&tskim->qe, &tskim->fcpim->tskim_free_q);
667 * @param[in] tskim BFA task management command instance
676 bfa_tskim_start(struct bfa_tskim_s *tskim, struct bfa_itnim_s *itnim, lun_t lun,
679 tskim->itnim = itnim;
680 tskim->lun = lun;
681 tskim->tm_cmnd = tm_cmnd;
682 tskim->tsecs = tsecs;
683 tskim->notify = BFA_FALSE;
686 list_add_tail(&tskim->qe, &itnim->tsk_q);
687 bfa_sm_send_event(tskim, BFA_TSKIM_SM_START);