Lines Matching refs:tgt

52 pppt_tgt_sm_event(pppt_tgt_t *tgt, pppt_tgt_event_t event);
55 tgt_sm_event_locked(pppt_tgt_t *tgt, pppt_tgt_event_t event);
58 tgt_sm_event_dispatch(pppt_tgt_t *tgt, tgt_event_ctx_t *ctx);
61 tgt_sm_created(pppt_tgt_t *tgt, tgt_event_ctx_t *ctx);
64 tgt_sm_onlining(pppt_tgt_t *tgt, tgt_event_ctx_t *ctx);
67 tgt_sm_online(pppt_tgt_t *tgt, tgt_event_ctx_t *ctx);
70 tgt_sm_stmf_online(pppt_tgt_t *tgt, tgt_event_ctx_t *ctx);
73 tgt_sm_deleting_need_offline(pppt_tgt_t *tgt, tgt_event_ctx_t *ctx);
76 tgt_sm_offlining(pppt_tgt_t *tgt, tgt_event_ctx_t *ctx);
79 tgt_sm_offline(pppt_tgt_t *tgt, tgt_event_ctx_t *ctx);
82 tgt_sm_stmf_offline(pppt_tgt_t *tgt, tgt_event_ctx_t *ctx);
85 tgt_sm_deleting_stmf_dereg(pppt_tgt_t *tgt, tgt_event_ctx_t *ctx);
88 tgt_sm_deleting_stmf_dereg_fail(pppt_tgt_t *tgt, tgt_event_ctx_t *ctx);
91 tgt_sm_deleting(pppt_tgt_t *tgt, tgt_event_ctx_t *ctx);
103 tgt_sm_new_state(pppt_tgt_t *tgt, tgt_event_ctx_t *ctx,
203 pppt_tgt_destroy(pppt_tgt_t *tgt)
206 avl_destroy(&tgt->target_sess_list);
207 list_destroy(&tgt->target_events);
208 cv_destroy(&tgt->target_cv);
209 mutex_destroy(&tgt->target_mutex);
210 stmf_free(tgt->target_stmf_lport); /* Also frees "tgt' */
239 pppt_tgt_async_delete(pppt_tgt_t *tgt)
242 pppt_tgt_sm_event(tgt, TE_DELETE);
288 pppt_tgt_sm_event(pppt_tgt_t *tgt, pppt_tgt_event_t event)
290 mutex_enter(&tgt->target_mutex);
291 tgt_sm_event_locked(tgt, event);
292 mutex_exit(&tgt->target_mutex);
296 tgt_sm_event_locked(pppt_tgt_t *tgt, pppt_tgt_event_t event)
301 DTRACE_PROBE2(pppt__tgt__event, pppt_tgt_t *, tgt,
303 stmf_trace("pppt", "pppt_tgt_event: tgt %p event %s(%d)",
304 (void *)tgt, pppt_te_name[event], event);
306 tgt->target_refcount++;
312 list_insert_tail(&tgt->target_events, ctx);
320 if (!tgt->target_sm_busy) {
321 tgt->target_sm_busy = B_TRUE;
322 while (!list_is_empty(&tgt->target_events)) {
323 ctx = list_head(&tgt->target_events);
324 list_remove(&tgt->target_events, ctx);
325 mutex_exit(&tgt->target_mutex);
326 tgt_sm_event_dispatch(tgt, ctx);
327 mutex_enter(&tgt->target_mutex);
329 tgt->target_sm_busy = B_FALSE;
333 tgt->target_refcount--;
334 cv_signal(&tgt->target_cv);
338 tgt_sm_event_dispatch(pppt_tgt_t *tgt, tgt_event_ctx_t *ctx)
340 stmf_trace("pppt", "pppt_tgt_event_dispatch: tgt %p event %s(%d)",
341 (void *)tgt, pppt_te_name[ctx->te_ctx_event], ctx->te_ctx_event);
346 tgt->target_deleting = B_TRUE;
351 switch (tgt->target_state) {
353 tgt_sm_created(tgt, ctx);
356 tgt_sm_onlining(tgt, ctx);
359 tgt_sm_online(tgt, ctx);
362 tgt_sm_stmf_online(tgt, ctx);
365 tgt_sm_deleting_need_offline(tgt, ctx);
368 tgt_sm_offlining(tgt, ctx);
371 tgt_sm_offline(tgt, ctx);
374 tgt_sm_stmf_offline(tgt, ctx);
377 tgt_sm_deleting_stmf_dereg(tgt, ctx);
380 tgt_sm_deleting_stmf_dereg_fail(tgt, ctx);
383 tgt_sm_deleting(tgt, ctx);
393 tgt_sm_created(pppt_tgt_t *tgt, tgt_event_ctx_t *ctx)
399 tgt_sm_new_state(tgt, ctx, TS_ONLINING);
402 tgt_sm_new_state(tgt, ctx, TS_DELETING_STMF_DEREG);
411 tgt_sm_new_state(tgt, ctx, TS_OFFLINE);
413 tgt->target_stmf_lport, &scs);
425 tgt_sm_onlining(pppt_tgt_t *tgt, tgt_event_ctx_t *ctx)
431 tgt_sm_new_state(tgt, ctx, TS_ONLINE);
434 tgt_sm_new_state(tgt, ctx, TS_STMF_OFFLINE);
450 tgt->target_stmf_lport, &scs);
462 tgt_sm_online(pppt_tgt_t *tgt, tgt_event_ctx_t *ctx)
468 if (tgt->target_deleting) {
469 tgt_sm_new_state(tgt, ctx, TS_DELETING_NEED_OFFLINE);
471 tgt_sm_new_state(tgt, ctx, TS_STMF_ONLINE);
488 tgt->target_stmf_lport, &scs);
500 tgt_sm_stmf_online(pppt_tgt_t *tgt, tgt_event_ctx_t *ctx)
506 tgt_sm_new_state(tgt, ctx, TS_DELETING_NEED_OFFLINE);
509 tgt_sm_new_state(tgt, ctx, TS_OFFLINING);
516 tgt->target_stmf_lport, &scs);
529 tgt_sm_deleting_need_offline(pppt_tgt_t *tgt, tgt_event_ctx_t *ctx)
535 tgt_sm_new_state(tgt, ctx, TS_OFFLINING);
547 tgt->target_stmf_lport, &scs);
560 tgt_sm_offlining(pppt_tgt_t *tgt, tgt_event_ctx_t *ctx)
566 tgt_sm_new_state(tgt, ctx, TS_OFFLINE);
582 tgt->target_stmf_lport, &scs);
595 tgt_sm_offline(pppt_tgt_t *tgt, tgt_event_ctx_t *ctx)
601 if (tgt->target_deleting) {
602 tgt_sm_new_state(tgt, ctx, TS_DELETING_STMF_DEREG);
604 tgt_sm_new_state(tgt, ctx, TS_STMF_OFFLINE);
621 tgt->target_stmf_lport, &scs);
633 tgt_sm_stmf_offline(pppt_tgt_t *tgt, tgt_event_ctx_t *ctx)
639 tgt_sm_new_state(tgt, ctx, TS_ONLINING);
642 tgt_sm_new_state(tgt, ctx, TS_DELETING_STMF_DEREG);
649 tgt->target_stmf_lport, &scs);
662 tgt_sm_deleting_stmf_dereg(pppt_tgt_t *tgt, tgt_event_ctx_t *ctx)
678 tgt->target_stmf_lport, &scs);
685 tgt_sm_new_state(tgt, ctx, TS_DELETING);
688 tgt_sm_new_state(tgt, ctx, TS_DELETING_STMF_DEREG_FAIL);
696 tgt_sm_deleting_stmf_dereg_fail(pppt_tgt_t *tgt, tgt_event_ctx_t *ctx)
712 tgt->target_stmf_lport, &scs);
719 tgt_sm_new_state(tgt, ctx, TS_DELETING_STMF_DEREG);
727 tgt_sm_deleting(pppt_tgt_t *tgt, tgt_event_ctx_t *ctx)
743 tgt->target_stmf_lport, &scs);
755 pppt_tgt_offline(pppt_tgt_t *tgt)
758 pppt_tgt_offline_task, tgt, KM_SLEEP);
764 pppt_tgt_t *tgt = arg;
768 stmf_trace("pppt", "pppt_tgt_offline %p", (void *)tgt);
771 mutex_enter(&tgt->target_mutex);
772 for (ps = avl_first(&tgt->target_sess_list); ps != NULL; ps = next_ps) {
773 next_ps = AVL_NEXT(&tgt->target_sess_list, ps);
780 mutex_exit(&tgt->target_mutex);
783 pppt_tgt_sm_event(tgt, TE_OFFLINE_COMPLETE);
788 tgt->target_stmf_lport, &scs);
790 stmf_trace("pppt", "pppt_tgt_offline complete %p", (void *)tgt);
796 pppt_tgt_t *tgt = arg;
805 pppt_tgt_dereg_task, tgt, KM_NOSLEEP) == NULL) {
807 (void) timeout(pppt_tgt_dereg_retry, tgt,
815 pppt_tgt_t *tgt = arg;
817 pppt_tgt_sm_event(tgt, TE_STMF_DEREG_RETRY);
822 tgt_sm_new_state(pppt_tgt_t *tgt, tgt_event_ctx_t *ctx,
825 stmf_local_port_t *lport = tgt->target_stmf_lport;
843 "tgt %p, %s(%d) --> %s(%d)\n",
844 (void *) tgt, pppt_ts_name[tgt->target_state], tgt->target_state,
847 pppt_tgt_t *, tgt, tgt_event_ctx_t *, ctx,
850 mutex_enter(&tgt->target_mutex);
851 tgt->target_last_state = tgt->target_state;
852 tgt->target_state = new_state;
853 cv_signal(&tgt->target_cv);
854 mutex_exit(&tgt->target_mutex);
856 switch (tgt->target_state) {
858 pppt_tgt_sm_event(tgt, TE_ONLINE_SUCCESS);
877 pppt_tgt_offline(tgt);
884 stmfrc = stmf_deregister_local_port(tgt->target_stmf_lport);
886 pppt_tgt_sm_event(tgt, TE_STMF_DEREG_SUCCESS);
888 pppt_tgt_sm_event(tgt, TE_STMF_DEREG_FAIL);
893 (void) timeout(pppt_tgt_dereg_retry, tgt,