Lines Matching defs:itnim
40 static void bfa_fcs_itnim_free(struct bfa_fcs_itnim_s *itnim);
50 static void bfa_fcs_itnim_aen_post(struct bfa_fcs_itnim_s *itnim,
54 * fcs_itnim_sm FCS itnim state machine events
71 static void bfa_fcs_itnim_sm_offline(struct bfa_fcs_itnim_s *itnim,
73 static void bfa_fcs_itnim_sm_prli_send(struct bfa_fcs_itnim_s *itnim,
75 static void bfa_fcs_itnim_sm_prli(struct bfa_fcs_itnim_s *itnim,
77 static void bfa_fcs_itnim_sm_prli_retry(struct bfa_fcs_itnim_s *itnim,
79 static void bfa_fcs_itnim_sm_hcb_online(struct bfa_fcs_itnim_s *itnim,
81 static void bfa_fcs_itnim_sm_online(struct bfa_fcs_itnim_s *itnim,
83 static void bfa_fcs_itnim_sm_hcb_offline(struct bfa_fcs_itnim_s *itnim,
85 static void bfa_fcs_itnim_sm_initiator(struct bfa_fcs_itnim_s *itnim,
100 * fcs_itnim_sm FCS itnim state machine
104 bfa_fcs_itnim_sm_offline(struct bfa_fcs_itnim_s *itnim,
107 bfa_trc(itnim->fcs, itnim->rport->pwwn);
108 bfa_trc(itnim->fcs, event);
112 bfa_sm_set_state(itnim, bfa_fcs_itnim_sm_prli_send);
113 itnim->prli_retries = 0;
114 bfa_fcs_itnim_send_prli(itnim, NULL);
118 bfa_fcs_rport_itnim_ack(itnim->rport);
122 bfa_sm_set_state(itnim, bfa_fcs_itnim_sm_initiator);
126 bfa_fcs_itnim_free(itnim);
130 bfa_sm_fault(itnim->fcs, event);
136 bfa_fcs_itnim_sm_prli_send(struct bfa_fcs_itnim_s *itnim,
139 bfa_trc(itnim->fcs, itnim->rport->pwwn);
140 bfa_trc(itnim->fcs, event);
144 bfa_sm_set_state(itnim, bfa_fcs_itnim_sm_prli);
148 bfa_sm_set_state(itnim, bfa_fcs_itnim_sm_initiator);
149 bfa_fcxp_walloc_cancel(itnim->fcs->bfa, &itnim->fcxp_wqe);
153 bfa_sm_set_state(itnim, bfa_fcs_itnim_sm_offline);
154 bfa_fcxp_walloc_cancel(itnim->fcs->bfa, &itnim->fcxp_wqe);
155 bfa_fcs_rport_itnim_ack(itnim->rport);
159 bfa_sm_set_state(itnim, bfa_fcs_itnim_sm_offline);
160 bfa_fcxp_walloc_cancel(itnim->fcs->bfa, &itnim->fcxp_wqe);
161 bfa_fcs_itnim_free(itnim);
165 bfa_sm_fault(itnim->fcs, event);
170 bfa_fcs_itnim_sm_prli(struct bfa_fcs_itnim_s *itnim,
173 bfa_trc(itnim->fcs, itnim->rport->pwwn);
174 bfa_trc(itnim->fcs, event);
178 if (itnim->rport->scsi_function == BFA_RPORT_INITIATOR) {
179 bfa_sm_set_state(itnim, bfa_fcs_itnim_sm_initiator);
181 bfa_sm_set_state(itnim, bfa_fcs_itnim_sm_hcb_online);
182 bfa_itnim_online(itnim->bfa_itnim, itnim->seq_rec);
187 bfa_sm_set_state(itnim, bfa_fcs_itnim_sm_prli_retry);
188 bfa_timer_start(itnim->fcs->bfa, &itnim->timer,
189 bfa_fcs_itnim_timeout, itnim,
194 bfa_sm_set_state(itnim, bfa_fcs_itnim_sm_offline);
195 bfa_fcxp_discard(itnim->fcxp);
196 bfa_fcs_rport_itnim_ack(itnim->rport);
200 bfa_sm_set_state(itnim, bfa_fcs_itnim_sm_initiator);
201 bfa_fcxp_discard(itnim->fcxp);
205 bfa_sm_set_state(itnim, bfa_fcs_itnim_sm_offline);
206 bfa_fcxp_discard(itnim->fcxp);
207 bfa_fcs_itnim_free(itnim);
211 bfa_sm_fault(itnim->fcs, event);
216 bfa_fcs_itnim_sm_prli_retry(struct bfa_fcs_itnim_s *itnim,
219 bfa_trc(itnim->fcs, itnim->rport->pwwn);
220 bfa_trc(itnim->fcs, event);
224 if (itnim->prli_retries < BFA_FCS_RPORT_MAX_RETRIES) {
225 itnim->prli_retries++;
226 bfa_trc(itnim->fcs, itnim->prli_retries);
227 bfa_sm_set_state(itnim, bfa_fcs_itnim_sm_prli_send);
228 bfa_fcs_itnim_send_prli(itnim, NULL);
231 bfa_sm_set_state(itnim, bfa_fcs_itnim_sm_offline);
232 bfa_fcs_rport_logo_imp(itnim->rport);
237 bfa_sm_set_state(itnim, bfa_fcs_itnim_sm_offline);
238 bfa_timer_stop(&itnim->timer);
239 bfa_fcs_rport_itnim_ack(itnim->rport);
243 bfa_sm_set_state(itnim, bfa_fcs_itnim_sm_initiator);
244 bfa_timer_stop(&itnim->timer);
248 bfa_sm_set_state(itnim, bfa_fcs_itnim_sm_offline);
249 bfa_timer_stop(&itnim->timer);
250 bfa_fcs_itnim_free(itnim);
254 bfa_sm_fault(itnim->fcs, event);
259 bfa_fcs_itnim_sm_hcb_online(struct bfa_fcs_itnim_s *itnim,
262 bfa_trc(itnim->fcs, itnim->rport->pwwn);
263 bfa_trc(itnim->fcs, event);
267 bfa_sm_set_state(itnim, bfa_fcs_itnim_sm_online);
268 bfa_fcb_itnim_online(itnim->itnim_drv);
269 bfa_fcs_itnim_aen_post(itnim, BFA_ITNIM_AEN_ONLINE);
273 bfa_sm_set_state(itnim, bfa_fcs_itnim_sm_offline);
274 bfa_itnim_offline(itnim->bfa_itnim);
275 bfa_fcs_rport_itnim_ack(itnim->rport);
279 bfa_sm_set_state(itnim, bfa_fcs_itnim_sm_offline);
280 bfa_fcs_itnim_free(itnim);
284 bfa_sm_fault(itnim->fcs, event);
289 bfa_fcs_itnim_sm_online(struct bfa_fcs_itnim_s *itnim,
292 bfa_trc(itnim->fcs, itnim->rport->pwwn);
293 bfa_trc(itnim->fcs, event);
297 bfa_sm_set_state(itnim, bfa_fcs_itnim_sm_hcb_offline);
298 bfa_fcb_itnim_offline(itnim->itnim_drv);
299 bfa_itnim_offline(itnim->bfa_itnim);
300 if (bfa_fcs_port_is_online(itnim->rport->port) == BFA_TRUE)
301 bfa_fcs_itnim_aen_post(itnim, BFA_ITNIM_AEN_DISCONNECT);
303 bfa_fcs_itnim_aen_post(itnim, BFA_ITNIM_AEN_OFFLINE);
307 bfa_sm_set_state(itnim, bfa_fcs_itnim_sm_offline);
308 bfa_fcs_itnim_free(itnim);
312 bfa_sm_fault(itnim->fcs, event);
317 bfa_fcs_itnim_sm_hcb_offline(struct bfa_fcs_itnim_s *itnim,
320 bfa_trc(itnim->fcs, itnim->rport->pwwn);
321 bfa_trc(itnim->fcs, event);
325 bfa_sm_set_state(itnim, bfa_fcs_itnim_sm_offline);
326 bfa_fcs_rport_itnim_ack(itnim->rport);
330 bfa_sm_set_state(itnim, bfa_fcs_itnim_sm_offline);
331 bfa_fcs_itnim_free(itnim);
335 bfa_sm_fault(itnim->fcs, event);
345 bfa_fcs_itnim_sm_initiator(struct bfa_fcs_itnim_s *itnim,
348 bfa_trc(itnim->fcs, itnim->rport->pwwn);
349 bfa_trc(itnim->fcs, event);
353 bfa_sm_set_state(itnim, bfa_fcs_itnim_sm_offline);
354 bfa_fcs_rport_itnim_ack(itnim->rport);
363 bfa_sm_set_state(itnim, bfa_fcs_itnim_sm_offline);
364 bfa_fcs_itnim_free(itnim);
368 bfa_sm_fault(itnim->fcs, event);
379 bfa_fcs_itnim_aen_post(struct bfa_fcs_itnim_s *itnim,
382 struct bfa_fcs_rport_s *rport = itnim->rport;
402 aen_data.itnim.vf_id = rport->port->fabric->vf_id;
403 aen_data.itnim.ppwwn =
404 bfa_fcs_port_get_pwwn(bfa_fcs_get_base_port(itnim->fcs));
405 aen_data.itnim.lpwwn = lpwwn;
406 aen_data.itnim.rpwwn = rpwwn;
412 struct bfa_fcs_itnim_s *itnim = itnim_cbarg;
413 struct bfa_fcs_rport_s *rport = itnim->rport;
419 bfa_trc(itnim->fcs, itnim->rport->pwwn);
423 itnim->stats.fcxp_alloc_wait++;
424 bfa_fcxp_alloc_wait(port->fcs->bfa, &itnim->fcxp_wqe,
425 bfa_fcs_itnim_send_prli, itnim);
428 itnim->fcxp = fcxp;
430 len = fc_prli_build(&fchs, bfa_fcxp_get_reqbuf(fcxp), itnim->rport->pid,
435 bfa_fcs_itnim_prli_response, (void *)itnim, FC_MAX_PDUSZ,
438 itnim->stats.prli_sent++;
439 bfa_sm_send_event(itnim, BFA_FCS_ITNIM_SM_FRMSENT);
447 struct bfa_fcs_itnim_s *itnim = (struct bfa_fcs_itnim_s *)cbarg;
453 bfa_trc(itnim->fcs, req_status);
459 itnim->stats.prli_rsp_err++;
460 bfa_sm_send_event(itnim, BFA_FCS_ITNIM_SM_RSP_ERROR);
470 bfa_trc(itnim->fcs, rsp_len);
476 bfa_trc(itnim->fcs, prli_resp->parampage.type);
477 itnim->rport->scsi_function =
479 itnim->stats.prli_rsp_acc++;
480 bfa_sm_send_event(itnim,
485 itnim->stats.prli_rsp_parse_err++;
488 itnim->rport->scsi_function = BFA_RPORT_TARGET;
491 itnim->seq_rec = sparams->retry;
492 itnim->rec_support = sparams->rec_support;
493 itnim->task_retry_id = sparams->task_retry_id;
494 itnim->conf_comp = sparams->confirm;
496 itnim->stats.prli_rsp_acc++;
497 bfa_sm_send_event(itnim, BFA_FCS_ITNIM_SM_RSP_OK);
501 bfa_trc(itnim->fcs, ls_rjt->reason_code);
502 bfa_trc(itnim->fcs, ls_rjt->reason_code_expl);
504 itnim->stats.prli_rsp_rjt++;
505 bfa_sm_send_event(itnim, BFA_FCS_ITNIM_SM_RSP_ERROR);
512 struct bfa_fcs_itnim_s *itnim = (struct bfa_fcs_itnim_s *)arg;
514 itnim->stats.timeout++;
515 bfa_sm_send_event(itnim, BFA_FCS_ITNIM_SM_TIMEOUT);
519 bfa_fcs_itnim_free(struct bfa_fcs_itnim_s *itnim)
521 bfa_itnim_delete(itnim->bfa_itnim);
522 bfa_fcb_itnim_free(itnim->fcs->bfad, itnim->itnim_drv);
540 struct bfa_fcs_itnim_s *itnim;
545 * call bfad to allocate the itnim
547 bfa_fcb_itnim_alloc(port->fcs->bfad, &itnim, &itnim_drv);
548 if (itnim == NULL) {
554 * Initialize itnim
556 itnim->rport = rport;
557 itnim->fcs = rport->fcs;
558 itnim->itnim_drv = itnim_drv;
561 * call BFA to create the itnim
563 bfa_itnim = bfa_itnim_create(port->fcs->bfa, rport->bfa_rport, itnim);
572 itnim->bfa_itnim = bfa_itnim;
573 itnim->seq_rec = BFA_FALSE;
574 itnim->rec_support = BFA_FALSE;
575 itnim->conf_comp = BFA_FALSE;
576 itnim->task_retry_id = BFA_FALSE;
581 bfa_sm_set_state(itnim, bfa_fcs_itnim_sm_offline);
583 return itnim;
592 bfa_fcs_itnim_delete(struct bfa_fcs_itnim_s *itnim)
594 bfa_trc(itnim->fcs, itnim->rport->pid);
595 bfa_sm_send_event(itnim, BFA_FCS_ITNIM_SM_DELETE);
602 bfa_fcs_itnim_rport_online(struct bfa_fcs_itnim_s *itnim)
604 itnim->stats.onlines++;
606 if (!BFA_FCS_PID_IS_WKA(itnim->rport->pid)) {
607 bfa_sm_send_event(itnim, BFA_FCS_ITNIM_SM_ONLINE);
610 * For well known addresses, we set the itnim to initiator
613 itnim->stats.initiator++;
614 bfa_sm_send_event(itnim, BFA_FCS_ITNIM_SM_INITIATOR);
622 bfa_fcs_itnim_rport_offline(struct bfa_fcs_itnim_s *itnim)
624 itnim->stats.offlines++;
625 bfa_sm_send_event(itnim, BFA_FCS_ITNIM_SM_OFFLINE);
633 bfa_fcs_itnim_is_initiator(struct bfa_fcs_itnim_s *itnim)
635 bfa_trc(itnim->fcs, itnim->rport->pid);
636 itnim->stats.initiator++;
637 bfa_sm_send_event(itnim, BFA_FCS_ITNIM_SM_INITIATOR);
641 * Called by rport to check if the itnim is online.
644 bfa_fcs_itnim_get_online_state(struct bfa_fcs_itnim_s *itnim)
646 bfa_trc(itnim->fcs, itnim->rport->pid);
647 switch (bfa_sm_to_state(itnim_sm_table, itnim->sm)) {
664 struct bfa_fcs_itnim_s *itnim = (struct bfa_fcs_itnim_s *)cbarg;
666 bfa_trc(itnim->fcs, itnim->rport->pwwn);
667 bfa_sm_send_event(itnim, BFA_FCS_ITNIM_SM_HCB_ONLINE);
676 struct bfa_fcs_itnim_s *itnim = (struct bfa_fcs_itnim_s *)cb_arg;
678 bfa_trc(itnim->fcs, itnim->rport->pwwn);
679 bfa_sm_send_event(itnim, BFA_FCS_ITNIM_SM_HCB_OFFLINE);
689 struct bfa_fcs_itnim_s *itnim = (struct bfa_fcs_itnim_s *)cb_arg;
691 bfa_trc(itnim->fcs, itnim->rport->pwwn);
700 struct bfa_fcs_itnim_s *itnim = (struct bfa_fcs_itnim_s *)cb_arg;
702 bfa_trc(itnim->fcs, itnim->rport->pwwn);
703 bfa_fcb_itnim_tov(itnim->itnim_drv);
716 struct bfa_fcs_itnim_s *itnim = (struct bfa_fcs_itnim_s *)cb_arg;
718 itnim->stats.sler++;
719 bfa_trc(itnim->fcs, itnim->rport->pwwn);
720 bfa_fcs_rport_logo_imp(itnim->rport);
732 bfa_assert(rport->itnim != NULL);
733 return rport->itnim;
740 struct bfa_fcs_itnim_s *itnim = NULL;
742 itnim = bfa_fcs_itnim_lookup(port, rpwwn);
744 if (itnim == NULL)
747 attr->state = bfa_sm_to_state(itnim_sm_table, itnim->sm);
748 attr->retry = itnim->seq_rec;
749 attr->rec_support = itnim->rec_support;
750 attr->conf_comp = itnim->conf_comp;
751 attr->task_retry_id = itnim->task_retry_id;
761 struct bfa_fcs_itnim_s *itnim = NULL;
765 itnim = bfa_fcs_itnim_lookup(port, rpwwn);
767 if (itnim == NULL)
770 bfa_os_memcpy(stats, &itnim->stats, sizeof(struct bfa_itnim_stats_s));
778 struct bfa_fcs_itnim_s *itnim = NULL;
782 itnim = bfa_fcs_itnim_lookup(port, rpwwn);
784 if (itnim == NULL)
787 bfa_os_memset(&itnim->stats, 0, sizeof(struct bfa_itnim_stats_s));
792 bfa_fcs_fcpim_uf_recv(struct bfa_fcs_itnim_s *itnim, struct fchs_s *fchs,
797 bfa_trc(itnim->fcs, fchs->type);
804 bfa_trc(itnim->fcs, els_cmd->els_code);
808 bfa_fcs_rport_prlo(itnim->rport, fchs->ox_id);
817 bfa_fcs_itnim_pause(struct bfa_fcs_itnim_s *itnim)
822 bfa_fcs_itnim_resume(struct bfa_fcs_itnim_s *itnim)