Lines Matching refs:rport

12  *  rport.c Remote port implementation.
36 static void bfa_fcs_rport_free(struct bfa_fcs_rport_s *rport);
37 static void bfa_fcs_rport_hal_online(struct bfa_fcs_rport_s *rport);
38 static void bfa_fcs_rport_fcs_online_action(struct bfa_fcs_rport_s *rport);
39 static void bfa_fcs_rport_hal_online_action(struct bfa_fcs_rport_s *rport);
40 static void bfa_fcs_rport_fcs_offline_action(struct bfa_fcs_rport_s *rport);
41 static void bfa_fcs_rport_hal_offline_action(struct bfa_fcs_rport_s *rport);
42 static void bfa_fcs_rport_update(struct bfa_fcs_rport_s *rport,
72 static void bfa_fcs_rport_process_prli(struct bfa_fcs_rport_s *rport,
74 static void bfa_fcs_rport_send_ls_rjt(struct bfa_fcs_rport_s *rport,
77 static void bfa_fcs_rport_process_adisc(struct bfa_fcs_rport_s *rport,
79 static void bfa_fcs_rport_send_prlo_acc(struct bfa_fcs_rport_s *rport);
80 static void bfa_fcs_rport_hal_offline(struct bfa_fcs_rport_s *rport);
82 static void bfa_fcs_rport_sm_uninit(struct bfa_fcs_rport_s *rport,
84 static void bfa_fcs_rport_sm_plogi_sending(struct bfa_fcs_rport_s *rport,
86 static void bfa_fcs_rport_sm_plogiacc_sending(struct bfa_fcs_rport_s *rport,
88 static void bfa_fcs_rport_sm_plogi_retry(struct bfa_fcs_rport_s *rport,
90 static void bfa_fcs_rport_sm_plogi(struct bfa_fcs_rport_s *rport,
92 static void bfa_fcs_rport_sm_fc4_fcs_online(struct bfa_fcs_rport_s *rport,
94 static void bfa_fcs_rport_sm_hal_online(struct bfa_fcs_rport_s *rport,
96 static void bfa_fcs_rport_sm_online(struct bfa_fcs_rport_s *rport,
98 static void bfa_fcs_rport_sm_nsquery_sending(struct bfa_fcs_rport_s *rport,
100 static void bfa_fcs_rport_sm_nsquery(struct bfa_fcs_rport_s *rport,
103 struct bfa_fcs_rport_s *rport, enum rport_event event);
104 static void bfa_fcs_rport_sm_adisc_online(struct bfa_fcs_rport_s *rport,
107 *rport, enum rport_event event);
108 static void bfa_fcs_rport_sm_adisc_offline(struct bfa_fcs_rport_s *rport,
110 static void bfa_fcs_rport_sm_fc4_logorcv(struct bfa_fcs_rport_s *rport,
112 static void bfa_fcs_rport_sm_fc4_logosend(struct bfa_fcs_rport_s *rport,
114 static void bfa_fcs_rport_sm_fc4_offline(struct bfa_fcs_rport_s *rport,
116 static void bfa_fcs_rport_sm_hcb_offline(struct bfa_fcs_rport_s *rport,
118 static void bfa_fcs_rport_sm_hcb_logorcv(struct bfa_fcs_rport_s *rport,
120 static void bfa_fcs_rport_sm_hcb_logosend(struct bfa_fcs_rport_s *rport,
122 static void bfa_fcs_rport_sm_logo_sending(struct bfa_fcs_rport_s *rport,
124 static void bfa_fcs_rport_sm_offline(struct bfa_fcs_rport_s *rport,
126 static void bfa_fcs_rport_sm_nsdisc_sending(struct bfa_fcs_rport_s *rport,
128 static void bfa_fcs_rport_sm_nsdisc_retry(struct bfa_fcs_rport_s *rport,
130 static void bfa_fcs_rport_sm_nsdisc_sent(struct bfa_fcs_rport_s *rport,
132 static void bfa_fcs_rport_sm_nsdisc_sent(struct bfa_fcs_rport_s *rport,
134 static void bfa_fcs_rport_sm_fc4_off_delete(struct bfa_fcs_rport_s *rport,
136 static void bfa_fcs_rport_sm_delete_pending(struct bfa_fcs_rport_s *rport,
187 bfa_fcs_rport_sm_uninit(struct bfa_fcs_rport_s *rport, enum rport_event event)
189 bfa_trc(rport->fcs, rport->pwwn);
190 bfa_trc(rport->fcs, rport->pid);
191 bfa_trc(rport->fcs, event);
195 bfa_sm_set_state(rport, bfa_fcs_rport_sm_plogi_sending);
196 rport->plogi_retries = 0;
197 bfa_fcs_rport_send_plogi(rport, NULL);
201 bfa_sm_set_state(rport, bfa_fcs_rport_sm_plogiacc_sending);
202 bfa_fcs_rport_send_plogiacc(rport, NULL);
206 bfa_sm_set_state(rport, bfa_fcs_rport_sm_hal_online);
207 bfa_fcs_rport_hal_online(rport);
212 bfa_sm_set_state(rport, bfa_fcs_rport_sm_nsdisc_sending);
213 rport->ns_retries = 0;
214 bfa_fcs_rport_send_nsdisc(rport, NULL);
217 bfa_sm_fault(rport->fcs, event);
225 bfa_fcs_rport_sm_plogi_sending(struct bfa_fcs_rport_s *rport,
228 bfa_trc(rport->fcs, rport->pwwn);
229 bfa_trc(rport->fcs, rport->pid);
230 bfa_trc(rport->fcs, event);
234 bfa_sm_set_state(rport, bfa_fcs_rport_sm_plogi);
238 bfa_sm_set_state(rport, bfa_fcs_rport_sm_uninit);
239 bfa_fcxp_walloc_cancel(rport->fcs->bfa, &rport->fcxp_wqe);
240 bfa_fcs_rport_free(rport);
244 bfa_sm_set_state(rport, bfa_fcs_rport_sm_plogiacc_sending);
245 bfa_fcxp_walloc_cancel(rport->fcs->bfa, &rport->fcxp_wqe);
246 bfa_fcs_rport_send_plogiacc(rport, NULL);
250 bfa_sm_set_state(rport, bfa_fcs_rport_sm_offline);
251 bfa_fcxp_walloc_cancel(rport->fcs->bfa, &rport->fcxp_wqe);
252 bfa_timer_start(rport->fcs->bfa, &rport->timer,
253 bfa_fcs_rport_timeout, rport,
259 bfa_fcxp_walloc_cancel(rport->fcs->bfa, &rport->fcxp_wqe);
260 WARN_ON(!(bfa_fcport_get_topology(rport->port->fcs->bfa) !=
262 bfa_sm_set_state(rport, bfa_fcs_rport_sm_nsdisc_sending);
263 rport->ns_retries = 0;
264 bfa_fcs_rport_send_nsdisc(rport, NULL);
268 rport->pid = 0;
269 bfa_sm_set_state(rport, bfa_fcs_rport_sm_offline);
270 bfa_fcxp_walloc_cancel(rport->fcs->bfa, &rport->fcxp_wqe);
271 bfa_timer_start(rport->fcs->bfa, &rport->timer,
272 bfa_fcs_rport_timeout, rport,
278 bfa_sm_fault(rport->fcs, event);
286 bfa_fcs_rport_sm_plogiacc_sending(struct bfa_fcs_rport_s *rport,
289 bfa_trc(rport->fcs, rport->pwwn);
290 bfa_trc(rport->fcs, rport->pid);
291 bfa_trc(rport->fcs, event);
295 bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_fcs_online);
296 bfa_fcs_rport_fcs_online_action(rport);
300 bfa_sm_set_state(rport, bfa_fcs_rport_sm_uninit);
301 bfa_fcxp_walloc_cancel(rport->fcs->bfa, &rport->fcxp_wqe);
302 bfa_fcs_rport_free(rport);
314 bfa_sm_set_state(rport, bfa_fcs_rport_sm_offline);
315 bfa_fcxp_walloc_cancel(rport->fcs->bfa, &rport->fcxp_wqe);
316 bfa_timer_start(rport->fcs->bfa, &rport->timer,
317 bfa_fcs_rport_timeout, rport,
322 bfa_fcxp_walloc_cancel(rport->fcs->bfa, &rport->fcxp_wqe);
323 bfa_sm_set_state(rport, bfa_fcs_rport_sm_nsdisc_sending);
324 rport->ns_retries = 0;
325 bfa_fcs_rport_send_nsdisc(rport, NULL);
329 rport->pid = 0;
330 bfa_sm_set_state(rport, bfa_fcs_rport_sm_offline);
331 bfa_fcxp_walloc_cancel(rport->fcs->bfa, &rport->fcxp_wqe);
332 bfa_timer_start(rport->fcs->bfa, &rport->timer,
333 bfa_fcs_rport_timeout, rport,
344 bfa_sm_fault(rport->fcs, event);
352 bfa_fcs_rport_sm_plogi_retry(struct bfa_fcs_rport_s *rport,
355 bfa_trc(rport->fcs, rport->pwwn);
356 bfa_trc(rport->fcs, rport->pid);
357 bfa_trc(rport->fcs, event);
361 bfa_sm_set_state(rport, bfa_fcs_rport_sm_plogi_sending);
362 bfa_fcs_rport_send_plogi(rport, NULL);
366 bfa_sm_set_state(rport, bfa_fcs_rport_sm_uninit);
367 bfa_timer_stop(&rport->timer);
368 bfa_fcs_rport_free(rport);
376 bfa_sm_set_state(rport, bfa_fcs_rport_sm_plogiacc_sending);
377 bfa_timer_stop(&rport->timer);
378 bfa_fcs_rport_send_plogiacc(rport, NULL);
382 bfa_sm_set_state(rport, bfa_fcs_rport_sm_offline);
383 bfa_timer_stop(&rport->timer);
384 bfa_timer_start(rport->fcs->bfa, &rport->timer,
385 bfa_fcs_rport_timeout, rport,
391 bfa_timer_stop(&rport->timer);
392 WARN_ON(!(bfa_fcport_get_topology(rport->port->fcs->bfa) !=
394 bfa_sm_set_state(rport, bfa_fcs_rport_sm_nsdisc_sending);
395 rport->ns_retries = 0;
396 bfa_fcs_rport_send_nsdisc(rport, NULL);
400 rport->pid = 0;
401 bfa_sm_set_state(rport, bfa_fcs_rport_sm_offline);
402 bfa_timer_stop(&rport->timer);
403 bfa_timer_start(rport->fcs->bfa, &rport->timer,
404 bfa_fcs_rport_timeout, rport,
409 bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_fcs_online);
410 bfa_timer_stop(&rport->timer);
411 bfa_fcs_rport_fcs_online_action(rport);
415 bfa_sm_fault(rport->fcs, event);
423 bfa_fcs_rport_sm_plogi(struct bfa_fcs_rport_s *rport, enum rport_event event)
425 bfa_trc(rport->fcs, rport->pwwn);
426 bfa_trc(rport->fcs, rport->pid);
427 bfa_trc(rport->fcs, event);
431 bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_fcs_online);
432 rport->plogi_retries = 0;
433 bfa_fcs_rport_fcs_online_action(rport);
437 bfa_fcs_rport_send_logo_acc(rport);
440 if (rport->prlo == BFA_TRUE)
441 bfa_fcs_rport_send_prlo_acc(rport);
443 bfa_fcxp_discard(rport->fcxp);
446 if (rport->plogi_retries < BFA_FCS_RPORT_MAX_RETRIES) {
447 rport->plogi_retries++;
448 bfa_sm_set_state(rport, bfa_fcs_rport_sm_plogi_retry);
449 bfa_timer_start(rport->fcs->bfa, &rport->timer,
450 bfa_fcs_rport_timeout, rport,
453 bfa_stats(rport->port, rport_del_max_plogi_retry);
454 rport->old_pid = rport->pid;
455 rport->pid = 0;
456 bfa_sm_set_state(rport, bfa_fcs_rport_sm_offline);
457 bfa_timer_start(rport->fcs->bfa, &rport->timer,
458 bfa_fcs_rport_timeout, rport,
467 bfa_sm_set_state(rport, bfa_fcs_rport_sm_offline);
468 bfa_fcxp_discard(rport->fcxp);
469 bfa_timer_start(rport->fcs->bfa, &rport->timer,
470 bfa_fcs_rport_timeout, rport,
475 rport->plogi_retries = 0;
476 bfa_sm_set_state(rport, bfa_fcs_rport_sm_plogi_retry);
477 bfa_timer_start(rport->fcs->bfa, &rport->timer,
478 bfa_fcs_rport_timeout, rport,
483 rport->pid = 0;
484 bfa_sm_set_state(rport, bfa_fcs_rport_sm_offline);
485 bfa_fcxp_discard(rport->fcxp);
486 bfa_timer_start(rport->fcs->bfa, &rport->timer,
487 bfa_fcs_rport_timeout, rport,
493 bfa_fcxp_discard(rport->fcxp);
494 WARN_ON(!(bfa_fcport_get_topology(rport->port->fcs->bfa) !=
496 bfa_sm_set_state(rport, bfa_fcs_rport_sm_nsdisc_sending);
497 rport->ns_retries = 0;
498 bfa_fcs_rport_send_nsdisc(rport, NULL);
502 bfa_sm_set_state(rport, bfa_fcs_rport_sm_plogiacc_sending);
503 bfa_fcxp_discard(rport->fcxp);
504 bfa_fcs_rport_send_plogiacc(rport, NULL);
508 bfa_sm_set_state(rport, bfa_fcs_rport_sm_uninit);
509 bfa_fcxp_discard(rport->fcxp);
510 bfa_fcs_rport_free(rport);
514 bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_fcs_online);
515 bfa_fcxp_discard(rport->fcxp);
516 bfa_fcs_rport_fcs_online_action(rport);
520 bfa_sm_fault(rport->fcs, event);
528 bfa_fcs_rport_sm_fc4_fcs_online(struct bfa_fcs_rport_s *rport,
531 bfa_trc(rport->fcs, rport->pwwn);
532 bfa_trc(rport->fcs, rport->pid);
533 bfa_trc(rport->fcs, event);
537 if (rport->scsi_function == BFA_RPORT_INITIATOR) {
538 if (!BFA_FCS_PID_IS_WKA(rport->pid))
539 bfa_fcs_rpf_rport_online(rport);
540 bfa_sm_set_state(rport, bfa_fcs_rport_sm_online);
544 if (!rport->bfa_rport)
545 rport->bfa_rport =
546 bfa_rport_create(rport->fcs->bfa, rport);
548 if (rport->bfa_rport) {
549 bfa_sm_set_state(rport, bfa_fcs_rport_sm_hal_online);
550 bfa_fcs_rport_hal_online(rport);
552 bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_logosend);
553 bfa_fcs_rport_fcs_offline_action(rport);
558 bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_offline);
559 rport->plogi_pending = BFA_TRUE;
560 bfa_fcs_rport_fcs_offline_action(rport);
568 bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_offline);
569 bfa_fcs_rport_fcs_offline_action(rport);
574 bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_logorcv);
575 bfa_fcs_rport_fcs_offline_action(rport);
579 bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_logosend);
580 bfa_fcs_rport_fcs_offline_action(rport);
584 bfa_sm_fault(rport->fcs, event);
590 * PLOGI is complete. Awaiting BFA rport online callback. FC-4s
594 bfa_fcs_rport_sm_hal_online(struct bfa_fcs_rport_s *rport,
597 bfa_trc(rport->fcs, rport->pwwn);
598 bfa_trc(rport->fcs, rport->pid);
599 bfa_trc(rport->fcs, event);
603 bfa_sm_set_state(rport, bfa_fcs_rport_sm_online);
604 bfa_fcs_rport_hal_online_action(rport);
612 bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_logorcv);
613 bfa_fcs_rport_fcs_offline_action(rport);
620 bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_offline);
621 bfa_fcs_rport_fcs_offline_action(rport);
625 rport->plogi_pending = BFA_TRUE;
626 bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_offline);
627 bfa_fcs_rport_fcs_offline_action(rport);
631 bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_logosend);
632 bfa_fcs_rport_fcs_offline_action(rport);
636 bfa_sm_fault(rport->fcs, event);
644 bfa_fcs_rport_sm_online(struct bfa_fcs_rport_s *rport, enum rport_event event)
646 bfa_trc(rport->fcs, rport->pwwn);
647 bfa_trc(rport->fcs, rport->pid);
648 bfa_trc(rport->fcs, event);
652 if (bfa_fcs_fabric_is_switched(rport->port->fabric)) {
653 bfa_sm_set_state(rport,
655 rport->ns_retries = 0;
656 bfa_fcs_rport_send_nsdisc(rport, NULL);
658 bfa_sm_set_state(rport,
660 bfa_fcs_rport_send_adisc(rport, NULL);
668 bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_offline);
669 bfa_fcs_rport_hal_offline_action(rport);
673 bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_logosend);
674 bfa_fcs_rport_hal_offline_action(rport);
679 bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_logorcv);
680 bfa_fcs_rport_hal_offline_action(rport);
688 bfa_sm_fault(rport->fcs, event);
694 * prior to ADISC authentication with rport. FC-4s are paused.
697 bfa_fcs_rport_sm_nsquery_sending(struct bfa_fcs_rport_s *rport,
700 bfa_trc(rport->fcs, rport->pwwn);
701 bfa_trc(rport->fcs, rport->pid);
702 bfa_trc(rport->fcs, event);
706 bfa_sm_set_state(rport, bfa_fcs_rport_sm_nsquery);
710 bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_logosend);
711 bfa_fcxp_walloc_cancel(rport->fcs->bfa, &rport->fcxp_wqe);
712 bfa_fcs_rport_hal_offline_action(rport);
723 bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_logorcv);
724 bfa_fcxp_walloc_cancel(rport->fcs->bfa, &rport->fcxp_wqe);
725 bfa_fcs_rport_hal_offline_action(rport);
732 bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_offline);
733 bfa_fcxp_walloc_cancel(rport->fcs->bfa, &rport->fcxp_wqe);
734 bfa_fcs_rport_hal_offline_action(rport);
738 bfa_sm_fault(rport->fcs, event);
743 * An SCN event is received in ONLINE state. NS query is sent to rport.
747 bfa_fcs_rport_sm_nsquery(struct bfa_fcs_rport_s *rport, enum rport_event event)
749 bfa_trc(rport->fcs, rport->pwwn);
750 bfa_trc(rport->fcs, rport->pid);
751 bfa_trc(rport->fcs, event);
755 bfa_sm_set_state(rport, bfa_fcs_rport_sm_adisc_online_sending);
756 bfa_fcs_rport_send_adisc(rport, NULL);
760 rport->ns_retries++;
761 if (rport->ns_retries < BFA_FCS_RPORT_MAX_RETRIES) {
762 bfa_sm_set_state(rport,
764 bfa_fcs_rport_send_nsdisc(rport, NULL);
766 bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_offline);
767 bfa_fcs_rport_hal_offline_action(rport);
772 bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_logosend);
773 bfa_fcxp_discard(rport->fcxp);
774 bfa_fcs_rport_hal_offline_action(rport);
782 bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_logorcv);
783 bfa_fcxp_discard(rport->fcxp);
784 bfa_fcs_rport_hal_offline_action(rport);
791 bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_offline);
792 bfa_fcxp_discard(rport->fcxp);
793 bfa_fcs_rport_hal_offline_action(rport);
797 bfa_sm_fault(rport->fcs, event);
803 * authenticating with rport. FC-4s are paused.
806 bfa_fcs_rport_sm_adisc_online_sending(struct bfa_fcs_rport_s *rport,
809 bfa_trc(rport->fcs, rport->pwwn);
810 bfa_trc(rport->fcs, rport->pid);
811 bfa_trc(rport->fcs, event);
815 bfa_sm_set_state(rport, bfa_fcs_rport_sm_adisc_online);
819 bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_logosend);
820 bfa_fcxp_walloc_cancel(rport->fcs->bfa, &rport->fcxp_wqe);
821 bfa_fcs_rport_hal_offline_action(rport);
826 bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_offline);
827 bfa_fcxp_walloc_cancel(rport->fcs->bfa, &rport->fcxp_wqe);
828 bfa_fcs_rport_hal_offline_action(rport);
833 bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_logorcv);
834 bfa_fcxp_walloc_cancel(rport->fcs->bfa, &rport->fcxp_wqe);
835 bfa_fcs_rport_hal_offline_action(rport);
842 bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_offline);
843 bfa_fcxp_walloc_cancel(rport->fcs->bfa, &rport->fcxp_wqe);
844 bfa_fcs_rport_hal_offline_action(rport);
848 bfa_sm_fault(rport->fcs, event);
853 * An SCN event is received in ONLINE state. ADISC is to rport.
857 bfa_fcs_rport_sm_adisc_online(struct bfa_fcs_rport_s *rport,
860 bfa_trc(rport->fcs, rport->pwwn);
861 bfa_trc(rport->fcs, rport->pid);
862 bfa_trc(rport->fcs, event);
866 bfa_sm_set_state(rport, bfa_fcs_rport_sm_online);
871 * Too complex to cleanup FC-4 & rport and then acc to PLOGI.
874 bfa_fcxp_discard(rport->fcxp);
879 bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_offline);
880 bfa_fcs_rport_hal_offline_action(rport);
884 bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_logosend);
885 bfa_fcxp_discard(rport->fcxp);
886 bfa_fcs_rport_hal_offline_action(rport);
896 bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_offline);
897 bfa_fcxp_discard(rport->fcxp);
898 bfa_fcs_rport_hal_offline_action(rport);
903 bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_logorcv);
904 bfa_fcxp_discard(rport->fcxp);
905 bfa_fcs_rport_hal_offline_action(rport);
909 bfa_sm_fault(rport->fcs, event);
914 * ADISC is being sent for authenticating with rport
918 bfa_fcs_rport_sm_adisc_offline_sending(struct bfa_fcs_rport_s *rport,
921 bfa_trc(rport->fcs, rport->pwwn);
922 bfa_trc(rport->fcs, rport->pid);
923 bfa_trc(rport->fcs, event);
927 bfa_sm_set_state(rport, bfa_fcs_rport_sm_adisc_offline);
935 bfa_sm_set_state(rport, bfa_fcs_rport_sm_offline);
936 bfa_fcxp_walloc_cancel(rport->fcs->bfa,
937 &rport->fcxp_wqe);
938 bfa_timer_start(rport->fcs->bfa, &rport->timer,
939 bfa_fcs_rport_timeout, rport,
944 bfa_sm_set_state(rport, bfa_fcs_rport_sm_plogiacc_sending);
945 bfa_fcxp_walloc_cancel(rport->fcs->bfa, &rport->fcxp_wqe);
946 bfa_fcs_rport_send_plogiacc(rport, NULL);
950 bfa_sm_fault(rport->fcs, event);
955 * ADISC to rport
959 bfa_fcs_rport_sm_adisc_offline(struct bfa_fcs_rport_s *rport,
962 bfa_trc(rport->fcs, rport->pwwn);
963 bfa_trc(rport->fcs, rport->pid);
964 bfa_trc(rport->fcs, event);
968 bfa_sm_set_state(rport, bfa_fcs_rport_sm_hal_online);
969 bfa_fcs_rport_hal_online(rport);
973 bfa_sm_set_state(rport, bfa_fcs_rport_sm_plogiacc_sending);
974 bfa_fcxp_discard(rport->fcxp);
975 bfa_fcs_rport_send_plogiacc(rport, NULL);
979 bfa_sm_set_state(rport, bfa_fcs_rport_sm_offline);
980 bfa_timer_start(rport->fcs->bfa, &rport->timer,
981 bfa_fcs_rport_timeout, rport,
990 bfa_sm_set_state(rport, bfa_fcs_rport_sm_offline);
991 bfa_fcxp_discard(rport->fcxp);
992 bfa_timer_start(rport->fcs->bfa, &rport->timer,
993 bfa_fcs_rport_timeout, rport,
998 bfa_sm_fault(rport->fcs, event);
1006 bfa_fcs_rport_sm_fc4_logorcv(struct bfa_fcs_rport_s *rport,
1009 bfa_trc(rport->fcs, rport->pwwn);
1010 bfa_trc(rport->fcs, rport->pid);
1011 bfa_trc(rport->fcs, event);
1015 bfa_sm_set_state(rport, bfa_fcs_rport_sm_hcb_logorcv);
1016 bfa_fcs_rport_hal_offline(rport);
1020 if (rport->pid && (rport->prlo == BFA_TRUE))
1021 bfa_fcs_rport_send_prlo_acc(rport);
1022 if (rport->pid && (rport->prlo == BFA_FALSE))
1023 bfa_fcs_rport_send_logo_acc(rport);
1025 bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_off_delete);
1037 bfa_sm_fault(rport->fcs, event);
1042 * LOGO needs to be sent to rport. Awaiting FC-4 offline completion
1046 bfa_fcs_rport_sm_fc4_logosend(struct bfa_fcs_rport_s *rport,
1049 bfa_trc(rport->fcs, rport->pwwn);
1050 bfa_trc(rport->fcs, rport->pid);
1051 bfa_trc(rport->fcs, event);
1055 bfa_sm_set_state(rport, bfa_fcs_rport_sm_hcb_logosend);
1056 bfa_fcs_rport_hal_offline(rport);
1060 bfa_fcs_rport_send_logo_acc(rport);
1063 if (rport->prlo == BFA_TRUE)
1064 bfa_fcs_rport_send_prlo_acc(rport);
1065 bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_off_delete);
1074 bfa_sm_fault(rport->fcs, event);
1082 bfa_fcs_rport_sm_fc4_offline(struct bfa_fcs_rport_s *rport,
1085 bfa_trc(rport->fcs, rport->pwwn);
1086 bfa_trc(rport->fcs, rport->pid);
1087 bfa_trc(rport->fcs, event);
1091 bfa_sm_set_state(rport, bfa_fcs_rport_sm_hcb_offline);
1092 bfa_fcs_rport_hal_offline(rport);
1101 bfa_fcs_rport_send_logo_acc(rport);
1105 bfa_fcs_rport_send_prlo_acc(rport);
1114 * rport is already going offline.
1120 bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_logosend);
1124 bfa_sm_fault(rport->fcs, event);
1129 * Rport is offline. FC-4s are offline. Awaiting BFA rport offline
1133 bfa_fcs_rport_sm_hcb_offline(struct bfa_fcs_rport_s *rport,
1136 bfa_trc(rport->fcs, rport->pwwn);
1137 bfa_trc(rport->fcs, rport->pid);
1138 bfa_trc(rport->fcs, event);
1142 if (bfa_fcs_lport_is_online(rport->port) &&
1143 (rport->plogi_pending)) {
1144 rport->plogi_pending = BFA_FALSE;
1145 bfa_sm_set_state(rport,
1147 bfa_fcs_rport_send_plogiacc(rport, NULL);
1153 if (!bfa_fcs_lport_is_online(rport->port)) {
1154 rport->pid = 0;
1155 bfa_sm_set_state(rport, bfa_fcs_rport_sm_offline);
1156 bfa_timer_start(rport->fcs->bfa, &rport->timer,
1157 bfa_fcs_rport_timeout, rport,
1161 if (bfa_fcs_fabric_is_switched(rport->port->fabric)) {
1162 bfa_sm_set_state(rport,
1164 rport->ns_retries = 0;
1165 bfa_fcs_rport_send_nsdisc(rport, NULL);
1166 } else if (bfa_fcport_get_topology(rport->port->fcs->bfa) ==
1168 if (rport->scn_online) {
1169 bfa_sm_set_state(rport,
1171 bfa_fcs_rport_send_adisc(rport, NULL);
1173 bfa_sm_set_state(rport,
1175 bfa_timer_start(rport->fcs->bfa, &rport->timer,
1176 bfa_fcs_rport_timeout, rport,
1180 bfa_sm_set_state(rport, bfa_fcs_rport_sm_plogi_sending);
1181 rport->plogi_retries = 0;
1182 bfa_fcs_rport_send_plogi(rport, NULL);
1187 bfa_sm_set_state(rport, bfa_fcs_rport_sm_uninit);
1188 bfa_fcs_rport_free(rport);
1204 bfa_sm_fault(rport->fcs, event);
1209 * Rport is offline. FC-4s are offline. Awaiting BFA rport offline
1213 bfa_fcs_rport_sm_hcb_logorcv(struct bfa_fcs_rport_s *rport,
1216 bfa_trc(rport->fcs, rport->pwwn);
1217 bfa_trc(rport->fcs, rport->pid);
1218 bfa_trc(rport->fcs, event);
1223 if (rport->pid && (rport->prlo == BFA_TRUE))
1224 bfa_fcs_rport_send_prlo_acc(rport);
1225 if (rport->pid && (rport->prlo == BFA_FALSE))
1226 bfa_fcs_rport_send_logo_acc(rport);
1228 * If the lport is online and if the rport is not a well
1232 if (bfa_fcs_lport_is_online(rport->port) &&
1233 (!BFA_FCS_PID_IS_WKA(rport->pid))) {
1234 if (bfa_fcs_fabric_is_switched(rport->port->fabric)) {
1235 bfa_sm_set_state(rport,
1237 rport->ns_retries = 0;
1238 bfa_fcs_rport_send_nsdisc(rport, NULL);
1241 bfa_sm_set_state(rport,
1243 rport->plogi_retries = 0;
1244 bfa_fcs_rport_send_plogi(rport, NULL);
1251 if (!BFA_FCS_PID_IS_WKA(rport->pid))
1252 rport->pid = 0;
1253 bfa_sm_set_state(rport, bfa_fcs_rport_sm_offline);
1254 bfa_timer_start(rport->fcs->bfa, &rport->timer,
1255 bfa_fcs_rport_timeout, rport,
1261 bfa_sm_set_state(rport, bfa_fcs_rport_sm_delete_pending);
1262 if (rport->pid && (rport->prlo == BFA_TRUE))
1263 bfa_fcs_rport_send_prlo_acc(rport);
1264 if (rport->pid && (rport->prlo == BFA_FALSE))
1265 bfa_fcs_rport_send_logo_acc(rport);
1269 bfa_sm_set_state(rport, bfa_fcs_rport_sm_hcb_offline);
1282 bfa_sm_fault(rport->fcs, event);
1288 * Awaiting BFA rport offline
1292 bfa_fcs_rport_sm_hcb_logosend(struct bfa_fcs_rport_s *rport,
1295 bfa_trc(rport->fcs, rport->pwwn);
1296 bfa_trc(rport->fcs, rport->pid);
1297 bfa_trc(rport->fcs, event);
1301 bfa_sm_set_state(rport, bfa_fcs_rport_sm_logo_sending);
1302 bfa_fcs_rport_send_logo(rport, NULL);
1306 bfa_fcs_rport_send_logo_acc(rport);
1309 if (rport->prlo == BFA_TRUE)
1310 bfa_fcs_rport_send_prlo_acc(rport);
1312 bfa_sm_set_state(rport, bfa_fcs_rport_sm_delete_pending);
1321 bfa_sm_fault(rport->fcs, event);
1329 bfa_fcs_rport_sm_logo_sending(struct bfa_fcs_rport_s *rport,
1332 bfa_trc(rport->fcs, rport->pwwn);
1333 bfa_trc(rport->fcs, rport->pid);
1334 bfa_trc(rport->fcs, event);
1339 bfa_sm_set_state(rport, bfa_fcs_rport_sm_uninit);
1340 bfa_fcs_rport_free(rport);
1350 bfa_fcs_rport_send_logo_acc(rport);
1353 if (rport->prlo == BFA_TRUE)
1354 bfa_fcs_rport_send_prlo_acc(rport);
1356 bfa_sm_set_state(rport, bfa_fcs_rport_sm_uninit);
1357 bfa_fcxp_walloc_cancel(rport->fcs->bfa, &rport->fcxp_wqe);
1358 bfa_fcs_rport_free(rport);
1362 bfa_sm_fault(rport->fcs, event);
1367 * Rport is offline. FC-4s are offline. BFA rport is offline.
1368 * Timer active to delete stale rport.
1371 bfa_fcs_rport_sm_offline(struct bfa_fcs_rport_s *rport, enum rport_event event)
1373 bfa_trc(rport->fcs, rport->pwwn);
1374 bfa_trc(rport->fcs, rport->pid);
1375 bfa_trc(rport->fcs, event);
1379 bfa_sm_set_state(rport, bfa_fcs_rport_sm_uninit);
1380 bfa_fcs_rport_free(rport);
1385 bfa_timer_stop(&rport->timer);
1386 WARN_ON(!(bfa_fcport_get_topology(rport->port->fcs->bfa) !=
1388 bfa_sm_set_state(rport, bfa_fcs_rport_sm_nsdisc_sending);
1389 rport->ns_retries = 0;
1390 bfa_fcs_rport_send_nsdisc(rport, NULL);
1394 bfa_sm_set_state(rport, bfa_fcs_rport_sm_uninit);
1395 bfa_timer_stop(&rport->timer);
1396 bfa_fcs_rport_free(rport);
1400 bfa_sm_set_state(rport, bfa_fcs_rport_sm_plogiacc_sending);
1401 bfa_timer_stop(&rport->timer);
1402 bfa_fcs_rport_send_plogiacc(rport, NULL);
1412 bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_fcs_online);
1413 bfa_timer_stop(&rport->timer);
1414 bfa_fcs_rport_fcs_online_action(rport);
1418 bfa_timer_stop(&rport->timer);
1419 bfa_sm_set_state(rport, bfa_fcs_rport_sm_plogi_sending);
1420 bfa_fcs_rport_send_plogi(rport, NULL);
1424 bfa_timer_stop(&rport->timer);
1425 bfa_sm_set_state(rport, bfa_fcs_rport_sm_plogi_sending);
1426 rport->plogi_retries = 0;
1427 bfa_fcs_rport_send_plogi(rport, NULL);
1431 bfa_sm_fault(rport->fcs, event);
1439 bfa_fcs_rport_sm_nsdisc_sending(struct bfa_fcs_rport_s *rport,
1442 bfa_trc(rport->fcs, rport->pwwn);
1443 bfa_trc(rport->fcs, rport->pid);
1444 bfa_trc(rport->fcs, event);
1448 bfa_sm_set_state(rport, bfa_fcs_rport_sm_nsdisc_sent);
1452 bfa_sm_set_state(rport, bfa_fcs_rport_sm_uninit);
1453 bfa_fcxp_walloc_cancel(rport->fcs->bfa, &rport->fcxp_wqe);
1454 bfa_fcs_rport_free(rport);
1458 bfa_sm_set_state(rport, bfa_fcs_rport_sm_plogiacc_sending);
1459 bfa_fcxp_walloc_cancel(rport->fcs->bfa, &rport->fcxp_wqe);
1460 bfa_fcs_rport_send_plogiacc(rport, NULL);
1470 rport->ns_retries = 0; /* reset the retry count */
1474 bfa_sm_set_state(rport, bfa_fcs_rport_sm_offline);
1475 bfa_fcxp_walloc_cancel(rport->fcs->bfa, &rport->fcxp_wqe);
1476 bfa_timer_start(rport->fcs->bfa, &rport->timer,
1477 bfa_fcs_rport_timeout, rport,
1482 bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_fcs_online);
1483 bfa_fcxp_walloc_cancel(rport->fcs->bfa, &rport->fcxp_wqe);
1484 bfa_fcs_rport_fcs_online_action(rport);
1488 bfa_sm_fault(rport->fcs, event);
1496 bfa_fcs_rport_sm_nsdisc_retry(struct bfa_fcs_rport_s *rport,
1499 bfa_trc(rport->fcs, rport->pwwn);
1500 bfa_trc(rport->fcs, rport->pid);
1501 bfa_trc(rport->fcs, event);
1505 bfa_sm_set_state(rport, bfa_fcs_rport_sm_nsdisc_sending);
1506 bfa_fcs_rport_send_nsdisc(rport, NULL);
1511 bfa_sm_set_state(rport, bfa_fcs_rport_sm_nsdisc_sending);
1512 bfa_timer_stop(&rport->timer);
1513 rport->ns_retries = 0;
1514 bfa_fcs_rport_send_nsdisc(rport, NULL);
1518 bfa_sm_set_state(rport, bfa_fcs_rport_sm_uninit);
1519 bfa_timer_stop(&rport->timer);
1520 bfa_fcs_rport_free(rport);
1524 bfa_sm_set_state(rport, bfa_fcs_rport_sm_plogiacc_sending);
1525 bfa_timer_stop(&rport->timer);
1526 bfa_fcs_rport_send_plogiacc(rport, NULL);
1530 rport->pid = 0;
1531 bfa_sm_set_state(rport, bfa_fcs_rport_sm_offline);
1532 bfa_timer_stop(&rport->timer);
1533 bfa_timer_start(rport->fcs->bfa, &rport->timer,
1534 bfa_fcs_rport_timeout, rport,
1539 bfa_fcs_rport_send_logo_acc(rport);
1542 bfa_fcs_rport_send_prlo_acc(rport);
1546 bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_fcs_online);
1547 bfa_timer_stop(&rport->timer);
1548 bfa_fcs_rport_fcs_online_action(rport);
1552 bfa_sm_fault(rport->fcs, event);
1560 bfa_fcs_rport_sm_nsdisc_sent(struct bfa_fcs_rport_s *rport,
1563 bfa_trc(rport->fcs, rport->pwwn);
1564 bfa_trc(rport->fcs, rport->pid);
1565 bfa_trc(rport->fcs, event);
1570 if (rport->pid) {
1571 bfa_sm_set_state(rport, bfa_fcs_rport_sm_plogi_sending);
1572 bfa_fcs_rport_send_plogi(rport, NULL);
1574 bfa_sm_set_state(rport,
1576 rport->ns_retries = 0;
1577 bfa_fcs_rport_send_nsdisc(rport, NULL);
1582 rport->ns_retries++;
1583 if (rport->ns_retries < BFA_FCS_RPORT_MAX_RETRIES) {
1584 bfa_sm_set_state(rport,
1586 bfa_fcs_rport_send_nsdisc(rport, NULL);
1588 rport->old_pid = rport->pid;
1589 rport->pid = 0;
1590 bfa_sm_set_state(rport, bfa_fcs_rport_sm_offline);
1591 bfa_timer_start(rport->fcs->bfa, &rport->timer,
1592 bfa_fcs_rport_timeout, rport,
1598 bfa_sm_set_state(rport, bfa_fcs_rport_sm_uninit);
1599 bfa_fcxp_discard(rport->fcxp);
1600 bfa_fcs_rport_free(rport);
1604 bfa_sm_set_state(rport, bfa_fcs_rport_sm_plogiacc_sending);
1605 bfa_fcxp_discard(rport->fcxp);
1606 bfa_fcs_rport_send_plogiacc(rport, NULL);
1610 rport->pid = 0;
1611 bfa_sm_set_state(rport, bfa_fcs_rport_sm_offline);
1612 bfa_fcxp_discard(rport->fcxp);
1613 bfa_timer_start(rport->fcs->bfa, &rport->timer,
1614 bfa_fcs_rport_timeout, rport,
1620 bfa_fcs_rport_send_prlo_acc(rport);
1632 bfa_fcs_rport_send_logo_acc(rport);
1636 bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_fcs_online);
1637 bfa_fcxp_discard(rport->fcxp);
1638 bfa_fcs_rport_fcs_online_action(rport);
1642 bfa_sm_fault(rport->fcs, event);
1651 bfa_fcs_rport_sm_fc4_off_delete(struct bfa_fcs_rport_s *rport,
1654 bfa_trc(rport->fcs, rport->pwwn);
1655 bfa_trc(rport->fcs, rport->pid);
1656 bfa_trc(rport->fcs, event);
1660 bfa_sm_set_state(rport, bfa_fcs_rport_sm_delete_pending);
1661 bfa_fcs_rport_hal_offline(rport);
1670 bfa_sm_fault(rport->fcs, event);
1680 bfa_fcs_rport_sm_delete_pending(struct bfa_fcs_rport_s *rport,
1683 bfa_trc(rport->fcs, rport->pwwn);
1684 bfa_trc(rport->fcs, rport->pid);
1685 bfa_trc(rport->fcs, event);
1689 bfa_sm_set_state(rport, bfa_fcs_rport_sm_uninit);
1690 bfa_fcs_rport_free(rport);
1700 bfa_sm_fault(rport->fcs, event);
1711 struct bfa_fcs_rport_s *rport = rport_cbarg;
1712 struct bfa_fcs_lport_s *port = rport->port;
1717 bfa_trc(rport->fcs, rport->pwwn);
1722 bfa_fcs_fcxp_alloc_wait(port->fcs->bfa, &rport->fcxp_wqe,
1723 bfa_fcs_rport_send_plogi, rport, BFA_TRUE);
1726 rport->fcxp = fcxp;
1728 len = fc_plogi_build(&fchs, bfa_fcxp_get_reqbuf(fcxp), rport->pid,
1736 (void *)rport, FC_MAX_PDUSZ, FC_ELS_TOV);
1738 rport->stats.plogis++;
1739 bfa_sm_send_event(rport, RPSM_EVENT_FCXP_SENT);
1747 struct bfa_fcs_rport_s *rport = (struct bfa_fcs_rport_s *) cbarg;
1753 bfa_trc(rport->fcs, rport->pwwn);
1759 bfa_trc(rport->fcs, req_status);
1760 rport->stats.plogi_failed++;
1761 bfa_sm_send_event(rport, RPSM_EVENT_FAILED);
1773 bfa_trc(rport->fcs, ls_rjt->reason_code);
1774 bfa_trc(rport->fcs, ls_rjt->reason_code_expl);
1778 rport->stats.rjt_insuff_res++;
1779 bfa_sm_send_event(rport, RPSM_EVENT_PLOGI_RETRY);
1783 rport->stats.plogi_rejects++;
1784 bfa_sm_send_event(rport, RPSM_EVENT_FAILED);
1792 list_for_each(qe, &rport->port->rport_q) {
1794 if (twin == rport)
1796 if (!rport->pwwn && (plogi_rsp->port_name == twin->pwwn)) {
1797 bfa_trc(rport->fcs, twin->pid);
1798 bfa_trc(rport->fcs, rport->pid);
1801 twin->stats.plogis += rport->stats.plogis;
1803 rport->stats.plogi_rejects;
1805 rport->stats.plogi_timeouts;
1807 rport->stats.plogi_failed;
1808 twin->stats.plogi_rcvd += rport->stats.plogi_rcvd;
1811 bfa_sm_send_event(rport, RPSM_EVENT_DELETE);
1823 rport->stats.plogi_accs++;
1824 bfa_fcs_rport_update(rport, plogi_rsp);
1825 bfa_sm_send_event(rport, RPSM_EVENT_ACCEPTED);
1831 struct bfa_fcs_rport_s *rport = rport_cbarg;
1832 struct bfa_fcs_lport_s *port = rport->port;
1837 bfa_trc(rport->fcs, rport->pwwn);
1838 bfa_trc(rport->fcs, rport->reply_oxid);
1843 bfa_fcs_fcxp_alloc_wait(port->fcs->bfa, &rport->fcxp_wqe,
1844 bfa_fcs_rport_send_plogiacc, rport, BFA_FALSE);
1847 rport->fcxp = fcxp;
1850 rport->pid, bfa_fcs_lport_get_fcid(port),
1851 rport->reply_oxid, port->port_cfg.pwwn,
1859 bfa_sm_send_event(rport, RPSM_EVENT_FCXP_SENT);
1865 struct bfa_fcs_rport_s *rport = rport_cbarg;
1866 struct bfa_fcs_lport_s *port = rport->port;
1871 bfa_trc(rport->fcs, rport->pwwn);
1876 bfa_fcs_fcxp_alloc_wait(port->fcs->bfa, &rport->fcxp_wqe,
1877 bfa_fcs_rport_send_adisc, rport, BFA_TRUE);
1880 rport->fcxp = fcxp;
1882 len = fc_adisc_build(&fchs, bfa_fcxp_get_reqbuf(fcxp), rport->pid,
1888 rport, FC_MAX_PDUSZ, FC_ELS_TOV);
1890 rport->stats.adisc_sent++;
1891 bfa_sm_send_event(rport, RPSM_EVENT_FCXP_SENT);
1899 struct bfa_fcs_rport_s *rport = (struct bfa_fcs_rport_s *) cbarg;
1904 bfa_trc(rport->fcs, req_status);
1905 rport->stats.adisc_failed++;
1906 bfa_sm_send_event(rport, RPSM_EVENT_FAILED);
1910 if (fc_adisc_rsp_parse((struct fc_adisc_s *)pld, rsp_len, rport->pwwn,
1911 rport->nwwn) == FC_PARSE_OK) {
1912 rport->stats.adisc_accs++;
1913 bfa_sm_send_event(rport, RPSM_EVENT_ACCEPTED);
1917 rport->stats.adisc_rejects++;
1919 bfa_trc(rport->fcs, ls_rjt->els_cmd.els_code);
1920 bfa_trc(rport->fcs, ls_rjt->reason_code);
1921 bfa_trc(rport->fcs, ls_rjt->reason_code_expl);
1922 bfa_sm_send_event(rport, RPSM_EVENT_FAILED);
1928 struct bfa_fcs_rport_s *rport = rport_cbarg;
1929 struct bfa_fcs_lport_s *port = rport->port;
1935 bfa_trc(rport->fcs, rport->pid);
1940 bfa_fcs_fcxp_alloc_wait(port->fcs->bfa, &rport->fcxp_wqe,
1941 bfa_fcs_rport_send_nsdisc, rport, BFA_TRUE);
1944 rport->fcxp = fcxp;
1946 if (rport->pwwn) {
1948 bfa_fcs_lport_get_fcid(port), 0, rport->pwwn);
1952 bfa_fcs_lport_get_fcid(port), 0, rport->pid);
1958 (void *)rport, FC_MAX_PDUSZ, FC_FCCT_TOV);
1960 bfa_sm_send_event(rport, RPSM_EVENT_FCXP_SENT);
1968 struct bfa_fcs_rport_s *rport = (struct bfa_fcs_rport_s *) cbarg;
1974 bfa_trc(rport->fcs, rport->pwwn);
1983 if (gidpn_rsp->dap == rport->pid) {
1985 bfa_sm_send_event(rport, RPSM_EVENT_ACCEPTED);
1993 list_for_each(qe, &rport->port->rport_q) {
1995 if (twin == rport)
1998 bfa_trc(rport->fcs, twin->pid);
1999 bfa_trc(rport->fcs, rport->pid);
2006 rport->pid = gidpn_rsp->dap;
2007 bfa_sm_send_event(rport, RPSM_EVENT_ADDRESS_CHANGE);
2020 bfa_sm_send_event(rport, RPSM_EVENT_TIMEOUT);
2027 bfa_sm_send_event(rport, RPSM_EVENT_FAILED);
2031 bfa_sm_send_event(rport, RPSM_EVENT_FAILED);
2041 struct bfa_fcs_rport_s *rport = (struct bfa_fcs_rport_s *) cbarg;
2044 bfa_trc(rport->fcs, rport->pwwn);
2050 bfa_sm_send_event(rport, RPSM_EVENT_ACCEPTED);
2062 bfa_sm_send_event(rport, RPSM_EVENT_TIMEOUT);
2069 bfa_sm_send_event(rport, RPSM_EVENT_FAILED);
2073 bfa_sm_send_event(rport, RPSM_EVENT_FAILED);
2079 * Called to send a logout to the rport.
2084 struct bfa_fcs_rport_s *rport = rport_cbarg;
2090 bfa_trc(rport->fcs, rport->pid);
2092 port = rport->port;
2097 bfa_fcs_fcxp_alloc_wait(port->fcs->bfa, &rport->fcxp_wqe,
2098 bfa_fcs_rport_send_logo, rport, BFA_FALSE);
2101 rport->fcxp = fcxp;
2103 len = fc_logo_build(&fchs, bfa_fcxp_get_reqbuf(fcxp), rport->pid,
2109 rport, FC_MAX_PDUSZ, FC_ELS_TOV);
2111 rport->stats.logos++;
2112 bfa_fcxp_discard(rport->fcxp);
2113 bfa_sm_send_event(rport, RPSM_EVENT_FCXP_SENT);
2122 struct bfa_fcs_rport_s *rport = rport_cbarg;
2128 bfa_trc(rport->fcs, rport->pid);
2130 port = rport->port;
2136 rport->stats.logo_rcvd++;
2138 rport->pid, bfa_fcs_lport_get_fcid(port),
2139 rport->reply_oxid);
2149 * param[in] rport - pointer to bfa_fcs_lport_ns_t.
2162 struct bfa_fcs_rport_s *rport = (struct bfa_fcs_rport_s *) arg;
2164 rport->stats.plogi_timeouts++;
2165 bfa_stats(rport->port, rport_plogi_timeouts);
2166 bfa_sm_send_event(rport, RPSM_EVENT_TIMEOUT);
2170 bfa_fcs_rport_process_prli(struct bfa_fcs_rport_s *rport,
2175 struct bfa_fcs_lport_s *port = rport->port;
2181 rport->stats.prli_rcvd++;
2196 rport->scsi_function = BFA_RPORT_TARGET;
2198 bfa_trc(rport->fcs, prli->parampage.type);
2199 rport->scsi_function = BFA_RPORT_INITIATOR;
2200 bfa_fcs_itnim_is_initiator(rport->itnim);
2216 bfa_fcs_rport_process_rpsc(struct bfa_fcs_rport_s *rport,
2221 struct bfa_fcs_lport_s *port = rport->port;
2228 rport->stats.rpsc_rcvd++;
2253 bfa_fcs_rport_process_adisc(struct bfa_fcs_rport_s *rport,
2258 struct bfa_fcs_lport_s *port = rport->port;
2263 rport->stats.adisc_rcvd++;
2266 * Accept if the itnim for this rport is online.
2269 if (bfa_fcs_itnim_get_online_state(rport->itnim) == BFA_STATUS_OK) {
2284 rport->stats.adisc_rejected++;
2285 bfa_fcs_rport_send_ls_rjt(rport, rx_fchs,
2292 bfa_fcs_rport_hal_online(struct bfa_fcs_rport_s *rport)
2294 struct bfa_fcs_lport_s *port = rport->port;
2297 rport_info.pid = rport->pid;
2302 rport_info.fc_class = rport->fc_cos;
2303 rport_info.cisc = rport->cisc;
2304 rport_info.max_frmsz = rport->maxfrsize;
2305 bfa_rport_online(rport->bfa_rport, &rport_info);
2309 bfa_fcs_rport_hal_offline(struct bfa_fcs_rport_s *rport)
2311 if (rport->bfa_rport)
2312 bfa_sm_send_event(rport->bfa_rport, BFA_RPORT_SM_OFFLINE);
2314 bfa_cb_rport_offline(rport);
2321 struct bfa_fcs_rport_s *rport;
2325 * allocate rport
2332 if (bfa_fcb_rport_alloc(fcs->bfad, &rport, &rport_drv)
2341 rport->port = port;
2342 rport->fcs = fcs;
2343 rport->rp_drv = rport_drv;
2344 rport->pid = rpid;
2345 rport->pwwn = pwwn;
2346 rport->old_pid = 0;
2348 rport->bfa_rport = NULL;
2356 rport->itnim = bfa_fcs_itnim_create(rport);
2357 if (!rport->itnim) {
2364 bfa_fcs_lport_add_rport(port, rport);
2367 bfa_sm_set_state(rport, bfa_fcs_rport_sm_uninit);
2370 if (!BFA_FCS_PID_IS_WKA(rport->pid))
2371 bfa_fcs_rpf_init(rport);
2373 return rport;
2378 bfa_fcs_rport_free(struct bfa_fcs_rport_s *rport)
2380 struct bfa_fcs_lport_s *port = rport->port;
2385 * - delete BFA rport
2388 rport->plogi_pending = BFA_FALSE;
2391 bfa_fcs_itnim_delete(rport->itnim);
2392 if (rport->pid != 0 && !BFA_FCS_PID_IS_WKA(rport->pid))
2393 bfa_fcs_rpf_rport_offline(rport);
2396 if (rport->bfa_rport) {
2397 bfa_sm_send_event(rport->bfa_rport, BFA_RPORT_SM_DELETE);
2398 rport->bfa_rport = NULL;
2401 bfa_fcs_lport_del_rport(port, rport);
2403 kfree(rport->rp_drv);
2407 bfa_fcs_rport_aen_post(struct bfa_fcs_rport_s *rport,
2411 struct bfa_fcs_lport_s *port = rport->port;
2420 aen_entry->aen_data.rport.priv.qos = data->priv.qos;
2422 aen_entry->aen_data.rport.priv.qos = data->priv.qos;
2424 aen_entry->aen_data.rport.vf_id = rport->port->fabric->vf_id;
2425 aen_entry->aen_data.rport.ppwwn = bfa_fcs_lport_get_pwwn(
2426 bfa_fcs_get_base_port(rport->fcs));
2427 aen_entry->aen_data.rport.lpwwn = bfa_fcs_lport_get_pwwn(rport->port);
2428 aen_entry->aen_data.rport.rpwwn = rport->pwwn;
2431 bfad_im_post_vendor_event(aen_entry, bfad, ++rport->fcs->fcs_aen_seq,
2436 bfa_fcs_rport_fcs_online_action(struct bfa_fcs_rport_s *rport)
2438 if ((!rport->pid) || (!rport->pwwn)) {
2439 bfa_trc(rport->fcs, rport->pid);
2440 bfa_sm_fault(rport->fcs, rport->pid);
2443 bfa_sm_send_event(rport->itnim, BFA_FCS_ITNIM_SM_FCS_ONLINE);
2447 bfa_fcs_rport_hal_online_action(struct bfa_fcs_rport_s *rport)
2449 struct bfa_fcs_lport_s *port = rport->port;
2454 rport->stats.onlines++;
2456 if ((!rport->pid) || (!rport->pwwn)) {
2457 bfa_trc(rport->fcs, rport->pid);
2458 bfa_sm_fault(rport->fcs, rport->pid);
2462 bfa_fcs_itnim_brp_online(rport->itnim);
2463 if (!BFA_FCS_PID_IS_WKA(rport->pid))
2464 bfa_fcs_rpf_rport_online(rport);
2468 wwn2str(rpwwn_buf, rport->pwwn);
2469 if (!BFA_FCS_PID_IS_WKA(rport->pid)) {
2473 bfa_fcs_rport_aen_post(rport, BFA_RPORT_AEN_ONLINE, NULL);
2478 bfa_fcs_rport_fcs_offline_action(struct bfa_fcs_rport_s *rport)
2480 if (!BFA_FCS_PID_IS_WKA(rport->pid))
2481 bfa_fcs_rpf_rport_offline(rport);
2483 bfa_fcs_itnim_rport_offline(rport->itnim);
2487 bfa_fcs_rport_hal_offline_action(struct bfa_fcs_rport_s *rport)
2489 struct bfa_fcs_lport_s *port = rport->port;
2494 if (!rport->bfa_rport) {
2495 bfa_fcs_rport_fcs_offline_action(rport);
2499 rport->stats.offlines++;
2502 wwn2str(rpwwn_buf, rport->pwwn);
2503 if (!BFA_FCS_PID_IS_WKA(rport->pid)) {
2504 if (bfa_fcs_lport_is_online(rport->port) == BFA_TRUE) {
2509 bfa_fcs_rport_aen_post(rport,
2516 bfa_fcs_rport_aen_post(rport,
2522 bfa_fcs_itnim_rport_offline(rport->itnim);
2523 if (!BFA_FCS_PID_IS_WKA(rport->pid))
2524 bfa_fcs_rpf_rport_offline(rport);
2529 * Update rport parameters from PLOGI or PLOGI accept.
2532 bfa_fcs_rport_update(struct bfa_fcs_rport_s *rport, struct fc_logi_s *plogi)
2534 bfa_fcs_lport_t *port = rport->port;
2540 rport->pwwn = plogi->port_name;
2541 rport->nwwn = plogi->node_name;
2546 rport->fc_cos = 0;
2548 rport->fc_cos = FC_CLASS_3;
2551 rport->fc_cos |= FC_CLASS_2;
2557 rport->cisc = plogi->csp.cisc;
2559 rport->maxfrsize = be16_to_cpu(plogi->class3.rxsz);
2561 rport->maxfrsize = be16_to_cpu(plogi->csp.rxsz);
2590 bfa_fcs_rport_process_logo(struct bfa_fcs_rport_s *rport, struct fchs_s *fchs)
2592 rport->reply_oxid = fchs->ox_id;
2593 bfa_trc(rport->fcs, rport->reply_oxid);
2595 rport->prlo = BFA_FALSE;
2596 rport->stats.logo_rcvd++;
2597 bfa_sm_send_event(rport, RPSM_EVENT_LOGO_RCVD);
2603 * fcs_rport_public FCS rport public interfaces
2618 struct bfa_fcs_rport_s *rport;
2621 rport = bfa_fcs_rport_alloc(port, WWN_NULL, rpid);
2622 if (!rport)
2625 bfa_sm_send_event(rport, RPSM_EVENT_PLOGI_SEND);
2626 return rport;
2630 * Called to create a rport for which only the wwn is known.
2640 struct bfa_fcs_rport_s *rport;
2642 rport = bfa_fcs_rport_alloc(port, rpwwn, 0);
2643 if (!rport)
2646 bfa_sm_send_event(rport, RPSM_EVENT_ADDRESS_DISC);
2647 return rport;
2651 * rport has been discovered and plogi has been completed.
2660 struct bfa_fcs_rport_s *rport;
2662 rport = bfa_fcs_rport_alloc(port, WWN_NULL, fchs->s_id);
2663 if (!rport)
2666 bfa_fcs_rport_update(rport, plogi);
2668 bfa_sm_send_event(rport, RPSM_EVENT_PLOGI_COMP);
2673 * If an existing rport does a plogi, it will be handled separately.
2679 struct bfa_fcs_rport_s *rport;
2681 rport = bfa_fcs_rport_alloc(port, plogi->port_name, fchs->s_id);
2682 if (!rport)
2685 bfa_fcs_rport_update(rport, plogi);
2687 rport->reply_oxid = fchs->ox_id;
2688 bfa_trc(rport->fcs, rport->reply_oxid);
2690 rport->stats.plogi_rcvd++;
2691 bfa_sm_send_event(rport, RPSM_EVENT_PLOGI_RCVD);
2699 bfa_fcs_rport_plogi(struct bfa_fcs_rport_s *rport, struct fchs_s *rx_fchs,
2706 bfa_fcs_rport_update(rport, plogi);
2708 rport->reply_oxid = rx_fchs->ox_id;
2709 bfa_trc(rport->fcs, rport->reply_oxid);
2711 rport->pid = rx_fchs->s_id;
2712 bfa_trc(rport->fcs, rport->pid);
2714 rport->stats.plogi_rcvd++;
2715 bfa_sm_send_event(rport, RPSM_EVENT_PLOGI_RCVD);
2723 bfa_fcs_rport_scn(struct bfa_fcs_rport_s *rport)
2725 rport->stats.rscns++;
2726 bfa_sm_send_event(rport, RPSM_EVENT_FAB_SCN);
2733 * param[in] cb_arg - rport struct.
2746 struct bfa_fcs_rport_s *rport = (struct bfa_fcs_rport_s *) cbarg;
2748 bfa_trc(rport->fcs, rport->pwwn);
2749 bfa_sm_send_event(rport, RPSM_EVENT_HCB_ONLINE);
2756 * param[in] rport -
2768 struct bfa_fcs_rport_s *rport = (struct bfa_fcs_rport_s *) cbarg;
2770 bfa_trc(rport->fcs, rport->pwwn);
2771 bfa_sm_send_event(rport, RPSM_EVENT_HCB_OFFLINE);
2779 * param[in] rport -
2793 struct bfa_fcs_rport_s *rport = (struct bfa_fcs_rport_s *) cbarg;
2796 bfa_trc(rport->fcs, rport->pwwn);
2798 bfa_fcs_rport_aen_post(rport, BFA_RPORT_AEN_QOS_FLOWID, &aen_data);
2820 bfa_cb_rport_scn_no_dev(void *rport)
2822 struct bfa_fcs_rport_s *rp = rport;
2848 * param[in] rport -
2862 struct bfa_fcs_rport_s *rport = (struct bfa_fcs_rport_s *) cbarg;
2865 bfa_trc(rport->fcs, rport->pwwn);
2867 bfa_fcs_rport_aen_post(rport, BFA_RPORT_AEN_QOS_PRIO, &aen_data);
2874 bfa_fcs_rport_uf_recv(struct bfa_fcs_rport_s *rport,
2877 struct bfa_fcs_lport_s *port = rport->port;
2880 bfa_trc(rport->fcs, fchs->s_id);
2881 bfa_trc(rport->fcs, fchs->d_id);
2882 bfa_trc(rport->fcs, fchs->type);
2889 bfa_trc(rport->fcs, els_cmd->els_code);
2894 bfa_fcs_rport_process_logo(rport, fchs);
2899 bfa_fcs_rport_process_adisc(rport, fchs, len);
2905 bfa_fcs_fcpim_uf_recv(rport->itnim, fchs, len);
2910 bfa_fcs_rport_process_prli(rport, fchs, len);
2915 bfa_fcs_rport_process_rpsc(rport, fchs, len);
2920 bfa_fcs_rport_send_ls_rjt(rport, fchs,
2929 bfa_fcs_rport_send_prlo_acc(struct bfa_fcs_rport_s *rport)
2931 struct bfa_fcs_lport_s *port = rport->port;
2936 bfa_trc(rport->fcs, rport->pid);
2942 rport->pid, bfa_fcs_lport_get_fcid(port),
2943 rport->reply_oxid, 0);
2945 bfa_fcxp_send(fcxp, rport->bfa_rport, port->fabric->vf_id,
2954 bfa_fcs_rport_send_ls_rjt(struct bfa_fcs_rport_s *rport, struct fchs_s *rx_fchs,
2957 struct bfa_fcs_lport_s *port = rport->port;
2962 bfa_trc(rport->fcs, rx_fchs->s_id);
2964 fcxp = bfa_fcs_fcxp_alloc(rport->fcs, BFA_FALSE);
2978 * Return state of rport.
2981 bfa_fcs_rport_get_state(struct bfa_fcs_rport_s *rport)
2983 return bfa_rport_sm_to_state(rport_sm_table, rport->sm);
2989 * Called by the Driver to set rport delete/ageout timeout
2991 * param[in] rport timeout value in seconds.
3003 bfa_fcs_rport_prlo(struct bfa_fcs_rport_s *rport, __be16 ox_id)
3005 bfa_trc(rport->fcs, rport->pid);
3007 rport->prlo = BFA_TRUE;
3008 rport->reply_oxid = ox_id;
3009 bfa_sm_send_event(rport, RPSM_EVENT_PRLO_RCVD);
3024 bfa_fcs_rport_get_attr(struct bfa_fcs_rport_s *rport,
3028 struct bfa_fcs_lport_s *port = rport->port;
3029 bfa_port_speed_t rport_speed = rport->rpf.rpsc_speed;
3032 bfa_fcport_get_attr(rport->fcs->bfa, &port_attr);
3037 rport_attr->pid = rport->pid;
3038 rport_attr->pwwn = rport->pwwn;
3039 rport_attr->nwwn = rport->nwwn;
3040 rport_attr->cos_supported = rport->fc_cos;
3041 rport_attr->df_sz = rport->maxfrsize;
3042 rport_attr->state = bfa_fcs_rport_get_state(rport);
3043 rport_attr->fc_cos = rport->fc_cos;
3044 rport_attr->cisc = rport->cisc;
3045 rport_attr->scsi_function = rport->scsi_function;
3046 rport_attr->curr_speed = rport->rpf.rpsc_speed;
3047 rport_attr->assigned_speed = rport->rpf.assigned_speed;
3049 if (rport->bfa_rport) {
3050 qos_attr.qos_priority = rport->bfa_rport->qos_attr.qos_priority;
3052 cpu_to_be32(rport->bfa_rport->qos_attr.qos_flow_id);
3058 (rport->scsi_function == BFA_RPORT_TARGET)) {
3061 bfa_fcport_get_ratelim_speed(rport->fcs->bfa);
3074 * fcs_rport_api FCS rport API.
3080 struct bfa_fcs_rport_s *rport;
3082 rport = bfa_fcs_lport_get_rport_by_pwwn(port, rpwwn);
3083 if (rport == NULL) {
3089 return rport;
3095 struct bfa_fcs_rport_s *rport;
3097 rport = bfa_fcs_lport_get_rport_by_nwwn(port, rnwwn);
3098 if (rport == NULL) {
3104 return rport;
3142 struct bfa_fcs_rport_s *rport = rpf->rport;
3143 struct bfa_fcs_fabric_s *fabric = &rport->fcs->fabric;
3145 bfa_trc(rport->fcs, rport->pwwn);
3146 bfa_trc(rport->fcs, rport->pid);
3147 bfa_trc(rport->fcs, event);
3152 if ((!BFA_FCS_PID_IS_WKA(rport->pid)) &&
3153 ((rport->port->fabric->lps->brcd_switch) ||
3166 bfa_sm_fault(rport->fcs, event);
3173 struct bfa_fcs_rport_s *rport = rpf->rport;
3175 bfa_trc(rport->fcs, event);
3184 bfa_fcxp_walloc_cancel(rport->fcs->bfa, &rpf->fcxp_wqe);
3189 bfa_sm_fault(rport->fcs, event);
3196 struct bfa_fcs_rport_s *rport = rpf->rport;
3198 bfa_trc(rport->fcs, rport->pid);
3199 bfa_trc(rport->fcs, event);
3206 bfa_rport_speed(rport->bfa_rport, rpf->rpsc_speed);
3208 bfa_rport_speed(rport->bfa_rport, rpf->assigned_speed);
3212 /* RPSC not supported by rport */
3219 bfa_timer_start(rport->fcs->bfa, &rpf->timer,
3235 bfa_sm_fault(rport->fcs, event);
3242 struct bfa_fcs_rport_s *rport = rpf->rport;
3244 bfa_trc(rport->fcs, rport->pid);
3245 bfa_trc(rport->fcs, event);
3261 bfa_sm_fault(rport->fcs, event);
3268 struct bfa_fcs_rport_s *rport = rpf->rport;
3270 bfa_trc(rport->fcs, rport->pwwn);
3271 bfa_trc(rport->fcs, rport->pid);
3272 bfa_trc(rport->fcs, event);
3281 bfa_sm_fault(rport->fcs, event);
3288 struct bfa_fcs_rport_s *rport = rpf->rport;
3290 bfa_trc(rport->fcs, rport->pwwn);
3291 bfa_trc(rport->fcs, rport->pid);
3292 bfa_trc(rport->fcs, event);
3304 bfa_sm_fault(rport->fcs, event);
3311 bfa_fcs_rpf_init(struct bfa_fcs_rport_s *rport)
3313 struct bfa_fcs_rpf_s *rpf = &rport->rpf;
3315 bfa_trc(rport->fcs, rport->pid);
3316 rpf->rport = rport;
3325 bfa_fcs_rpf_rport_online(struct bfa_fcs_rport_s *rport)
3327 bfa_trc(rport->fcs, rport->pid);
3329 if (__fcs_min_cfg(rport->port->fcs))
3332 if (bfa_fcs_fabric_is_switched(rport->port->fabric))
3333 bfa_sm_send_event(&rport->rpf, RPFSM_EVENT_RPORT_ONLINE);
3340 bfa_fcs_rpf_rport_offline(struct bfa_fcs_rport_s *rport)
3342 bfa_trc(rport->fcs, rport->pid);
3344 if (__fcs_min_cfg(rport->port->fcs))
3347 rport->rpf.rpsc_speed = 0;
3348 bfa_sm_send_event(&rport->rpf, RPFSM_EVENT_RPORT_OFFLINE);
3355 struct bfa_fcs_rport_s *rport = rpf->rport;
3357 bfa_trc(rport->fcs, rport->pid);
3365 struct bfa_fcs_rport_s *rport = rpf->rport;
3366 struct bfa_fcs_lport_s *port = rport->port;
3371 bfa_trc(rport->fcs, rport->pwwn);
3382 len = fc_rpsc2_build(&fchs, bfa_fcxp_get_reqbuf(fcxp), rport->pid,
3383 bfa_fcs_lport_get_fcid(port), &rport->pid, 1);
3388 rport->stats.rpsc_sent++;
3399 struct bfa_fcs_rport_s *rport = rpf->rport;
3404 bfa_trc(rport->fcs, req_status);
3407 bfa_trc(rport->fcs, req_status);
3409 rport->stats.rpsc_failed++;
3416 rport->stats.rpsc_accs++;
3418 bfa_trc(rport->fcs, num_ents);
3421 bfa_ntoh3b(rport->pid));
3422 bfa_trc(rport->fcs,
3424 bfa_trc(rport->fcs,
3426 bfa_trc(rport->fcs,
3428 bfa_trc(rport->fcs,
3443 bfa_trc(rport->fcs, ls_rjt->reason_code);
3444 bfa_trc(rport->fcs, ls_rjt->reason_code_expl);
3445 rport->stats.rpsc_rejects++;