diff options
Diffstat (limited to 'drivers/scsi/bfa/bfa_fcs_rport.c')
-rw-r--r-- | drivers/scsi/bfa/bfa_fcs_rport.c | 466 |
1 files changed, 344 insertions, 122 deletions
diff --git a/drivers/scsi/bfa/bfa_fcs_rport.c b/drivers/scsi/bfa/bfa_fcs_rport.c index fe0463a1db04..cc43b2a58ce3 100644 --- a/drivers/scsi/bfa/bfa_fcs_rport.c +++ b/drivers/scsi/bfa/bfa_fcs_rport.c | |||
@@ -30,14 +30,22 @@ static u32 | |||
30 | bfa_fcs_rport_del_timeout = BFA_FCS_RPORT_DEF_DEL_TIMEOUT * 1000; | 30 | bfa_fcs_rport_del_timeout = BFA_FCS_RPORT_DEF_DEL_TIMEOUT * 1000; |
31 | /* In millisecs */ | 31 | /* In millisecs */ |
32 | /* | 32 | /* |
33 | * bfa_fcs_rport_max_logins is max count of bfa_fcs_rports | ||
34 | * whereas DEF_CFG_NUM_RPORTS is max count of bfa_rports | ||
35 | */ | ||
36 | static u32 bfa_fcs_rport_max_logins = BFA_FCS_MAX_RPORT_LOGINS; | ||
37 | |||
38 | /* | ||
33 | * forward declarations | 39 | * forward declarations |
34 | */ | 40 | */ |
35 | static struct bfa_fcs_rport_s *bfa_fcs_rport_alloc( | 41 | static struct bfa_fcs_rport_s *bfa_fcs_rport_alloc( |
36 | struct bfa_fcs_lport_s *port, wwn_t pwwn, u32 rpid); | 42 | struct bfa_fcs_lport_s *port, wwn_t pwwn, u32 rpid); |
37 | static void bfa_fcs_rport_free(struct bfa_fcs_rport_s *rport); | 43 | static void bfa_fcs_rport_free(struct bfa_fcs_rport_s *rport); |
38 | static void bfa_fcs_rport_hal_online(struct bfa_fcs_rport_s *rport); | 44 | static void bfa_fcs_rport_hal_online(struct bfa_fcs_rport_s *rport); |
39 | static void bfa_fcs_rport_online_action(struct bfa_fcs_rport_s *rport); | 45 | static void bfa_fcs_rport_fcs_online_action(struct bfa_fcs_rport_s *rport); |
40 | static void bfa_fcs_rport_offline_action(struct bfa_fcs_rport_s *rport); | 46 | static void bfa_fcs_rport_hal_online_action(struct bfa_fcs_rport_s *rport); |
47 | static void bfa_fcs_rport_fcs_offline_action(struct bfa_fcs_rport_s *rport); | ||
48 | static void bfa_fcs_rport_hal_offline_action(struct bfa_fcs_rport_s *rport); | ||
41 | static void bfa_fcs_rport_update(struct bfa_fcs_rport_s *rport, | 49 | static void bfa_fcs_rport_update(struct bfa_fcs_rport_s *rport, |
42 | struct fc_logi_s *plogi); | 50 | struct fc_logi_s *plogi); |
43 | static void bfa_fcs_rport_timeout(void *arg); | 51 | static void bfa_fcs_rport_timeout(void *arg); |
@@ -76,6 +84,7 @@ static void bfa_fcs_rport_send_ls_rjt(struct bfa_fcs_rport_s *rport, | |||
76 | static void bfa_fcs_rport_process_adisc(struct bfa_fcs_rport_s *rport, | 84 | static void bfa_fcs_rport_process_adisc(struct bfa_fcs_rport_s *rport, |
77 | struct fchs_s *rx_fchs, u16 len); | 85 | struct fchs_s *rx_fchs, u16 len); |
78 | static void bfa_fcs_rport_send_prlo_acc(struct bfa_fcs_rport_s *rport); | 86 | static void bfa_fcs_rport_send_prlo_acc(struct bfa_fcs_rport_s *rport); |
87 | static void bfa_fcs_rport_hal_offline(struct bfa_fcs_rport_s *rport); | ||
79 | 88 | ||
80 | static void bfa_fcs_rport_sm_uninit(struct bfa_fcs_rport_s *rport, | 89 | static void bfa_fcs_rport_sm_uninit(struct bfa_fcs_rport_s *rport, |
81 | enum rport_event event); | 90 | enum rport_event event); |
@@ -87,6 +96,8 @@ static void bfa_fcs_rport_sm_plogi_retry(struct bfa_fcs_rport_s *rport, | |||
87 | enum rport_event event); | 96 | enum rport_event event); |
88 | static void bfa_fcs_rport_sm_plogi(struct bfa_fcs_rport_s *rport, | 97 | static void bfa_fcs_rport_sm_plogi(struct bfa_fcs_rport_s *rport, |
89 | enum rport_event event); | 98 | enum rport_event event); |
99 | static void bfa_fcs_rport_sm_fc4_fcs_online(struct bfa_fcs_rport_s *rport, | ||
100 | enum rport_event event); | ||
90 | static void bfa_fcs_rport_sm_hal_online(struct bfa_fcs_rport_s *rport, | 101 | static void bfa_fcs_rport_sm_hal_online(struct bfa_fcs_rport_s *rport, |
91 | enum rport_event event); | 102 | enum rport_event event); |
92 | static void bfa_fcs_rport_sm_online(struct bfa_fcs_rport_s *rport, | 103 | static void bfa_fcs_rport_sm_online(struct bfa_fcs_rport_s *rport, |
@@ -123,6 +134,10 @@ static void bfa_fcs_rport_sm_nsdisc_sent(struct bfa_fcs_rport_s *rport, | |||
123 | enum rport_event event); | 134 | enum rport_event event); |
124 | static void bfa_fcs_rport_sm_nsdisc_sent(struct bfa_fcs_rport_s *rport, | 135 | static void bfa_fcs_rport_sm_nsdisc_sent(struct bfa_fcs_rport_s *rport, |
125 | enum rport_event event); | 136 | enum rport_event event); |
137 | static void bfa_fcs_rport_sm_fc4_off_delete(struct bfa_fcs_rport_s *rport, | ||
138 | enum rport_event event); | ||
139 | static void bfa_fcs_rport_sm_delete_pending(struct bfa_fcs_rport_s *rport, | ||
140 | enum rport_event event); | ||
126 | 141 | ||
127 | static struct bfa_sm_table_s rport_sm_table[] = { | 142 | static struct bfa_sm_table_s rport_sm_table[] = { |
128 | {BFA_SM(bfa_fcs_rport_sm_uninit), BFA_RPORT_UNINIT}, | 143 | {BFA_SM(bfa_fcs_rport_sm_uninit), BFA_RPORT_UNINIT}, |
@@ -130,6 +145,7 @@ static struct bfa_sm_table_s rport_sm_table[] = { | |||
130 | {BFA_SM(bfa_fcs_rport_sm_plogiacc_sending), BFA_RPORT_ONLINE}, | 145 | {BFA_SM(bfa_fcs_rport_sm_plogiacc_sending), BFA_RPORT_ONLINE}, |
131 | {BFA_SM(bfa_fcs_rport_sm_plogi_retry), BFA_RPORT_PLOGI_RETRY}, | 146 | {BFA_SM(bfa_fcs_rport_sm_plogi_retry), BFA_RPORT_PLOGI_RETRY}, |
132 | {BFA_SM(bfa_fcs_rport_sm_plogi), BFA_RPORT_PLOGI}, | 147 | {BFA_SM(bfa_fcs_rport_sm_plogi), BFA_RPORT_PLOGI}, |
148 | {BFA_SM(bfa_fcs_rport_sm_fc4_fcs_online), BFA_RPORT_ONLINE}, | ||
133 | {BFA_SM(bfa_fcs_rport_sm_hal_online), BFA_RPORT_ONLINE}, | 149 | {BFA_SM(bfa_fcs_rport_sm_hal_online), BFA_RPORT_ONLINE}, |
134 | {BFA_SM(bfa_fcs_rport_sm_online), BFA_RPORT_ONLINE}, | 150 | {BFA_SM(bfa_fcs_rport_sm_online), BFA_RPORT_ONLINE}, |
135 | {BFA_SM(bfa_fcs_rport_sm_nsquery_sending), BFA_RPORT_NSQUERY}, | 151 | {BFA_SM(bfa_fcs_rport_sm_nsquery_sending), BFA_RPORT_NSQUERY}, |
@@ -167,8 +183,8 @@ bfa_fcs_rport_sm_uninit(struct bfa_fcs_rport_s *rport, enum rport_event event) | |||
167 | break; | 183 | break; |
168 | 184 | ||
169 | case RPSM_EVENT_PLOGI_RCVD: | 185 | case RPSM_EVENT_PLOGI_RCVD: |
170 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_plogiacc_sending); | 186 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_fcs_online); |
171 | bfa_fcs_rport_send_plogiacc(rport, NULL); | 187 | bfa_fcs_rport_fcs_online_action(rport); |
172 | break; | 188 | break; |
173 | 189 | ||
174 | case RPSM_EVENT_PLOGI_COMP: | 190 | case RPSM_EVENT_PLOGI_COMP: |
@@ -252,8 +268,8 @@ bfa_fcs_rport_sm_plogiacc_sending(struct bfa_fcs_rport_s *rport, | |||
252 | 268 | ||
253 | switch (event) { | 269 | switch (event) { |
254 | case RPSM_EVENT_FCXP_SENT: | 270 | case RPSM_EVENT_FCXP_SENT: |
255 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_hal_online); | 271 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_fcs_online); |
256 | bfa_fcs_rport_hal_online(rport); | 272 | bfa_fcs_rport_fcs_online_action(rport); |
257 | break; | 273 | break; |
258 | 274 | ||
259 | case RPSM_EVENT_DELETE: | 275 | case RPSM_EVENT_DELETE: |
@@ -348,9 +364,9 @@ bfa_fcs_rport_sm_plogi_retry(struct bfa_fcs_rport_s *rport, | |||
348 | break; | 364 | break; |
349 | 365 | ||
350 | case RPSM_EVENT_PLOGI_COMP: | 366 | case RPSM_EVENT_PLOGI_COMP: |
351 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_hal_online); | 367 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_fcs_online); |
352 | bfa_timer_stop(&rport->timer); | 368 | bfa_timer_stop(&rport->timer); |
353 | bfa_fcs_rport_hal_online(rport); | 369 | bfa_fcs_rport_fcs_online_action(rport); |
354 | break; | 370 | break; |
355 | 371 | ||
356 | default: | 372 | default: |
@@ -370,9 +386,9 @@ bfa_fcs_rport_sm_plogi(struct bfa_fcs_rport_s *rport, enum rport_event event) | |||
370 | 386 | ||
371 | switch (event) { | 387 | switch (event) { |
372 | case RPSM_EVENT_ACCEPTED: | 388 | case RPSM_EVENT_ACCEPTED: |
373 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_hal_online); | 389 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_fcs_online); |
374 | rport->plogi_retries = 0; | 390 | rport->plogi_retries = 0; |
375 | bfa_fcs_rport_hal_online(rport); | 391 | bfa_fcs_rport_fcs_online_action(rport); |
376 | break; | 392 | break; |
377 | 393 | ||
378 | case RPSM_EVENT_LOGO_RCVD: | 394 | case RPSM_EVENT_LOGO_RCVD: |
@@ -397,6 +413,7 @@ bfa_fcs_rport_sm_plogi(struct bfa_fcs_rport_s *rport, enum rport_event event) | |||
397 | BFA_FCS_RETRY_TIMEOUT); | 413 | BFA_FCS_RETRY_TIMEOUT); |
398 | } else { | 414 | } else { |
399 | bfa_stats(rport->port, rport_del_max_plogi_retry); | 415 | bfa_stats(rport->port, rport_del_max_plogi_retry); |
416 | rport->old_pid = rport->pid; | ||
400 | rport->pid = 0; | 417 | rport->pid = 0; |
401 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_offline); | 418 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_offline); |
402 | bfa_timer_start(rport->fcs->bfa, &rport->timer, | 419 | bfa_timer_start(rport->fcs->bfa, &rport->timer, |
@@ -443,13 +460,77 @@ bfa_fcs_rport_sm_plogi(struct bfa_fcs_rport_s *rport, enum rport_event event) | |||
443 | break; | 460 | break; |
444 | 461 | ||
445 | case RPSM_EVENT_PLOGI_COMP: | 462 | case RPSM_EVENT_PLOGI_COMP: |
446 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_hal_online); | 463 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_fcs_online); |
447 | bfa_fcxp_discard(rport->fcxp); | 464 | bfa_fcxp_discard(rport->fcxp); |
448 | bfa_fcs_rport_hal_online(rport); | 465 | bfa_fcs_rport_fcs_online_action(rport); |
466 | break; | ||
467 | |||
468 | default: | ||
469 | bfa_sm_fault(rport->fcs, event); | ||
470 | } | ||
471 | } | ||
472 | |||
473 | /* | ||
474 | * PLOGI is done. Await bfa_fcs_itnim to ascertain the scsi function | ||
475 | */ | ||
476 | static void | ||
477 | bfa_fcs_rport_sm_fc4_fcs_online(struct bfa_fcs_rport_s *rport, | ||
478 | enum rport_event event) | ||
479 | { | ||
480 | bfa_trc(rport->fcs, rport->pwwn); | ||
481 | bfa_trc(rport->fcs, rport->pid); | ||
482 | bfa_trc(rport->fcs, event); | ||
483 | |||
484 | switch (event) { | ||
485 | case RPSM_EVENT_FC4_FCS_ONLINE: | ||
486 | if (rport->scsi_function == BFA_RPORT_INITIATOR) { | ||
487 | if (!BFA_FCS_PID_IS_WKA(rport->pid)) | ||
488 | bfa_fcs_rpf_rport_online(rport); | ||
489 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_online); | ||
490 | break; | ||
491 | } | ||
492 | |||
493 | if (!rport->bfa_rport) | ||
494 | rport->bfa_rport = | ||
495 | bfa_rport_create(rport->fcs->bfa, rport); | ||
496 | |||
497 | if (rport->bfa_rport) { | ||
498 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_hal_online); | ||
499 | bfa_fcs_rport_hal_online(rport); | ||
500 | } else { | ||
501 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_logosend); | ||
502 | bfa_fcs_rport_fcs_offline_action(rport); | ||
503 | } | ||
504 | break; | ||
505 | |||
506 | case RPSM_EVENT_PLOGI_RCVD: | ||
507 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_offline); | ||
508 | rport->plogi_pending = BFA_TRUE; | ||
509 | bfa_fcs_rport_fcs_offline_action(rport); | ||
510 | break; | ||
511 | |||
512 | case RPSM_EVENT_PLOGI_COMP: | ||
513 | case RPSM_EVENT_LOGO_IMP: | ||
514 | case RPSM_EVENT_ADDRESS_CHANGE: | ||
515 | case RPSM_EVENT_SCN: | ||
516 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_offline); | ||
517 | bfa_fcs_rport_fcs_offline_action(rport); | ||
518 | break; | ||
519 | |||
520 | case RPSM_EVENT_LOGO_RCVD: | ||
521 | case RPSM_EVENT_PRLO_RCVD: | ||
522 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_logorcv); | ||
523 | bfa_fcs_rport_fcs_offline_action(rport); | ||
524 | break; | ||
525 | |||
526 | case RPSM_EVENT_DELETE: | ||
527 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_logosend); | ||
528 | bfa_fcs_rport_fcs_offline_action(rport); | ||
449 | break; | 529 | break; |
450 | 530 | ||
451 | default: | 531 | default: |
452 | bfa_sm_fault(rport->fcs, event); | 532 | bfa_sm_fault(rport->fcs, event); |
533 | break; | ||
453 | } | 534 | } |
454 | } | 535 | } |
455 | 536 | ||
@@ -468,41 +549,34 @@ bfa_fcs_rport_sm_hal_online(struct bfa_fcs_rport_s *rport, | |||
468 | switch (event) { | 549 | switch (event) { |
469 | case RPSM_EVENT_HCB_ONLINE: | 550 | case RPSM_EVENT_HCB_ONLINE: |
470 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_online); | 551 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_online); |
471 | bfa_fcs_rport_online_action(rport); | 552 | bfa_fcs_rport_hal_online_action(rport); |
472 | break; | 553 | break; |
473 | 554 | ||
474 | case RPSM_EVENT_PRLO_RCVD: | ||
475 | case RPSM_EVENT_PLOGI_COMP: | 555 | case RPSM_EVENT_PLOGI_COMP: |
476 | break; | 556 | break; |
477 | 557 | ||
558 | case RPSM_EVENT_PRLO_RCVD: | ||
478 | case RPSM_EVENT_LOGO_RCVD: | 559 | case RPSM_EVENT_LOGO_RCVD: |
479 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_hcb_logorcv); | 560 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_logorcv); |
480 | bfa_sm_send_event(rport->bfa_rport, BFA_RPORT_SM_OFFLINE); | 561 | bfa_fcs_rport_fcs_offline_action(rport); |
481 | break; | 562 | break; |
482 | 563 | ||
564 | case RPSM_EVENT_SCN: | ||
483 | case RPSM_EVENT_LOGO_IMP: | 565 | case RPSM_EVENT_LOGO_IMP: |
484 | case RPSM_EVENT_ADDRESS_CHANGE: | 566 | case RPSM_EVENT_ADDRESS_CHANGE: |
485 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_hcb_offline); | 567 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_offline); |
486 | bfa_sm_send_event(rport->bfa_rport, BFA_RPORT_SM_OFFLINE); | 568 | bfa_fcs_rport_fcs_offline_action(rport); |
487 | break; | 569 | break; |
488 | 570 | ||
489 | case RPSM_EVENT_PLOGI_RCVD: | 571 | case RPSM_EVENT_PLOGI_RCVD: |
490 | rport->plogi_pending = BFA_TRUE; | 572 | rport->plogi_pending = BFA_TRUE; |
491 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_hcb_offline); | 573 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_offline); |
492 | bfa_sm_send_event(rport->bfa_rport, BFA_RPORT_SM_OFFLINE); | 574 | bfa_fcs_rport_fcs_offline_action(rport); |
493 | break; | 575 | break; |
494 | 576 | ||
495 | case RPSM_EVENT_DELETE: | 577 | case RPSM_EVENT_DELETE: |
496 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_hcb_logosend); | 578 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_logosend); |
497 | bfa_sm_send_event(rport->bfa_rport, BFA_RPORT_SM_OFFLINE); | 579 | bfa_fcs_rport_fcs_offline_action(rport); |
498 | break; | ||
499 | |||
500 | case RPSM_EVENT_SCN: | ||
501 | /* | ||
502 | * @todo | ||
503 | * Ignore SCN - PLOGI just completed, FC-4 login should detect | ||
504 | * device failures. | ||
505 | */ | ||
506 | break; | 580 | break; |
507 | 581 | ||
508 | default: | 582 | default: |
@@ -537,18 +611,18 @@ bfa_fcs_rport_sm_online(struct bfa_fcs_rport_s *rport, enum rport_event event) | |||
537 | case RPSM_EVENT_LOGO_IMP: | 611 | case RPSM_EVENT_LOGO_IMP: |
538 | case RPSM_EVENT_ADDRESS_CHANGE: | 612 | case RPSM_EVENT_ADDRESS_CHANGE: |
539 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_offline); | 613 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_offline); |
540 | bfa_fcs_rport_offline_action(rport); | 614 | bfa_fcs_rport_hal_offline_action(rport); |
541 | break; | 615 | break; |
542 | 616 | ||
543 | case RPSM_EVENT_DELETE: | 617 | case RPSM_EVENT_DELETE: |
544 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_logosend); | 618 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_logosend); |
545 | bfa_fcs_rport_offline_action(rport); | 619 | bfa_fcs_rport_hal_offline_action(rport); |
546 | break; | 620 | break; |
547 | 621 | ||
548 | case RPSM_EVENT_LOGO_RCVD: | 622 | case RPSM_EVENT_LOGO_RCVD: |
549 | case RPSM_EVENT_PRLO_RCVD: | 623 | case RPSM_EVENT_PRLO_RCVD: |
550 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_logorcv); | 624 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_logorcv); |
551 | bfa_fcs_rport_offline_action(rport); | 625 | bfa_fcs_rport_hal_offline_action(rport); |
552 | break; | 626 | break; |
553 | 627 | ||
554 | case RPSM_EVENT_PLOGI_COMP: | 628 | case RPSM_EVENT_PLOGI_COMP: |
@@ -579,7 +653,7 @@ bfa_fcs_rport_sm_nsquery_sending(struct bfa_fcs_rport_s *rport, | |||
579 | case RPSM_EVENT_DELETE: | 653 | case RPSM_EVENT_DELETE: |
580 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_logosend); | 654 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_logosend); |
581 | bfa_fcxp_walloc_cancel(rport->fcs->bfa, &rport->fcxp_wqe); | 655 | bfa_fcxp_walloc_cancel(rport->fcs->bfa, &rport->fcxp_wqe); |
582 | bfa_fcs_rport_offline_action(rport); | 656 | bfa_fcs_rport_hal_offline_action(rport); |
583 | break; | 657 | break; |
584 | 658 | ||
585 | case RPSM_EVENT_SCN: | 659 | case RPSM_EVENT_SCN: |
@@ -592,24 +666,16 @@ bfa_fcs_rport_sm_nsquery_sending(struct bfa_fcs_rport_s *rport, | |||
592 | case RPSM_EVENT_PRLO_RCVD: | 666 | case RPSM_EVENT_PRLO_RCVD: |
593 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_logorcv); | 667 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_logorcv); |
594 | bfa_fcxp_walloc_cancel(rport->fcs->bfa, &rport->fcxp_wqe); | 668 | bfa_fcxp_walloc_cancel(rport->fcs->bfa, &rport->fcxp_wqe); |
595 | bfa_fcs_rport_offline_action(rport); | 669 | bfa_fcs_rport_hal_offline_action(rport); |
596 | break; | 670 | break; |
597 | 671 | ||
598 | case RPSM_EVENT_LOGO_IMP: | 672 | case RPSM_EVENT_LOGO_IMP: |
599 | rport->pid = 0; | ||
600 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_offline); | ||
601 | bfa_fcxp_walloc_cancel(rport->fcs->bfa, &rport->fcxp_wqe); | ||
602 | bfa_timer_start(rport->fcs->bfa, &rport->timer, | ||
603 | bfa_fcs_rport_timeout, rport, | ||
604 | bfa_fcs_rport_del_timeout); | ||
605 | break; | ||
606 | |||
607 | case RPSM_EVENT_PLOGI_RCVD: | 673 | case RPSM_EVENT_PLOGI_RCVD: |
608 | case RPSM_EVENT_ADDRESS_CHANGE: | 674 | case RPSM_EVENT_ADDRESS_CHANGE: |
609 | case RPSM_EVENT_PLOGI_COMP: | 675 | case RPSM_EVENT_PLOGI_COMP: |
610 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_offline); | 676 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_offline); |
611 | bfa_fcxp_walloc_cancel(rport->fcs->bfa, &rport->fcxp_wqe); | 677 | bfa_fcxp_walloc_cancel(rport->fcs->bfa, &rport->fcxp_wqe); |
612 | bfa_fcs_rport_offline_action(rport); | 678 | bfa_fcs_rport_hal_offline_action(rport); |
613 | break; | 679 | break; |
614 | 680 | ||
615 | default: | 681 | default: |
@@ -642,14 +708,14 @@ bfa_fcs_rport_sm_nsquery(struct bfa_fcs_rport_s *rport, enum rport_event event) | |||
642 | bfa_fcs_rport_send_nsdisc(rport, NULL); | 708 | bfa_fcs_rport_send_nsdisc(rport, NULL); |
643 | } else { | 709 | } else { |
644 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_offline); | 710 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_offline); |
645 | bfa_fcs_rport_offline_action(rport); | 711 | bfa_fcs_rport_hal_offline_action(rport); |
646 | } | 712 | } |
647 | break; | 713 | break; |
648 | 714 | ||
649 | case RPSM_EVENT_DELETE: | 715 | case RPSM_EVENT_DELETE: |
650 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_logosend); | 716 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_logosend); |
651 | bfa_fcxp_discard(rport->fcxp); | 717 | bfa_fcxp_discard(rport->fcxp); |
652 | bfa_fcs_rport_offline_action(rport); | 718 | bfa_fcs_rport_hal_offline_action(rport); |
653 | break; | 719 | break; |
654 | 720 | ||
655 | case RPSM_EVENT_SCN: | 721 | case RPSM_EVENT_SCN: |
@@ -659,7 +725,7 @@ bfa_fcs_rport_sm_nsquery(struct bfa_fcs_rport_s *rport, enum rport_event event) | |||
659 | case RPSM_EVENT_PRLO_RCVD: | 725 | case RPSM_EVENT_PRLO_RCVD: |
660 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_logorcv); | 726 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_logorcv); |
661 | bfa_fcxp_discard(rport->fcxp); | 727 | bfa_fcxp_discard(rport->fcxp); |
662 | bfa_fcs_rport_offline_action(rport); | 728 | bfa_fcs_rport_hal_offline_action(rport); |
663 | break; | 729 | break; |
664 | 730 | ||
665 | case RPSM_EVENT_PLOGI_COMP: | 731 | case RPSM_EVENT_PLOGI_COMP: |
@@ -668,7 +734,7 @@ bfa_fcs_rport_sm_nsquery(struct bfa_fcs_rport_s *rport, enum rport_event event) | |||
668 | case RPSM_EVENT_LOGO_IMP: | 734 | case RPSM_EVENT_LOGO_IMP: |
669 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_offline); | 735 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_offline); |
670 | bfa_fcxp_discard(rport->fcxp); | 736 | bfa_fcxp_discard(rport->fcxp); |
671 | bfa_fcs_rport_offline_action(rport); | 737 | bfa_fcs_rport_hal_offline_action(rport); |
672 | break; | 738 | break; |
673 | 739 | ||
674 | default: | 740 | default: |
@@ -696,21 +762,21 @@ bfa_fcs_rport_sm_adisc_sending(struct bfa_fcs_rport_s *rport, | |||
696 | case RPSM_EVENT_DELETE: | 762 | case RPSM_EVENT_DELETE: |
697 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_logosend); | 763 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_logosend); |
698 | bfa_fcxp_walloc_cancel(rport->fcs->bfa, &rport->fcxp_wqe); | 764 | bfa_fcxp_walloc_cancel(rport->fcs->bfa, &rport->fcxp_wqe); |
699 | bfa_fcs_rport_offline_action(rport); | 765 | bfa_fcs_rport_hal_offline_action(rport); |
700 | break; | 766 | break; |
701 | 767 | ||
702 | case RPSM_EVENT_LOGO_IMP: | 768 | case RPSM_EVENT_LOGO_IMP: |
703 | case RPSM_EVENT_ADDRESS_CHANGE: | 769 | case RPSM_EVENT_ADDRESS_CHANGE: |
704 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_offline); | 770 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_offline); |
705 | bfa_fcxp_walloc_cancel(rport->fcs->bfa, &rport->fcxp_wqe); | 771 | bfa_fcxp_walloc_cancel(rport->fcs->bfa, &rport->fcxp_wqe); |
706 | bfa_fcs_rport_offline_action(rport); | 772 | bfa_fcs_rport_hal_offline_action(rport); |
707 | break; | 773 | break; |
708 | 774 | ||
709 | case RPSM_EVENT_LOGO_RCVD: | 775 | case RPSM_EVENT_LOGO_RCVD: |
710 | case RPSM_EVENT_PRLO_RCVD: | 776 | case RPSM_EVENT_PRLO_RCVD: |
711 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_logorcv); | 777 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_logorcv); |
712 | bfa_fcxp_walloc_cancel(rport->fcs->bfa, &rport->fcxp_wqe); | 778 | bfa_fcxp_walloc_cancel(rport->fcs->bfa, &rport->fcxp_wqe); |
713 | bfa_fcs_rport_offline_action(rport); | 779 | bfa_fcs_rport_hal_offline_action(rport); |
714 | break; | 780 | break; |
715 | 781 | ||
716 | case RPSM_EVENT_SCN: | 782 | case RPSM_EVENT_SCN: |
@@ -719,7 +785,7 @@ bfa_fcs_rport_sm_adisc_sending(struct bfa_fcs_rport_s *rport, | |||
719 | case RPSM_EVENT_PLOGI_RCVD: | 785 | case RPSM_EVENT_PLOGI_RCVD: |
720 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_offline); | 786 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_offline); |
721 | bfa_fcxp_walloc_cancel(rport->fcs->bfa, &rport->fcxp_wqe); | 787 | bfa_fcxp_walloc_cancel(rport->fcs->bfa, &rport->fcxp_wqe); |
722 | bfa_fcs_rport_offline_action(rport); | 788 | bfa_fcs_rport_hal_offline_action(rport); |
723 | break; | 789 | break; |
724 | 790 | ||
725 | default: | 791 | default: |
@@ -756,13 +822,13 @@ bfa_fcs_rport_sm_adisc(struct bfa_fcs_rport_s *rport, enum rport_event event) | |||
756 | case RPSM_EVENT_FAILED: | 822 | case RPSM_EVENT_FAILED: |
757 | case RPSM_EVENT_ADDRESS_CHANGE: | 823 | case RPSM_EVENT_ADDRESS_CHANGE: |
758 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_offline); | 824 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_offline); |
759 | bfa_fcs_rport_offline_action(rport); | 825 | bfa_fcs_rport_hal_offline_action(rport); |
760 | break; | 826 | break; |
761 | 827 | ||
762 | case RPSM_EVENT_DELETE: | 828 | case RPSM_EVENT_DELETE: |
763 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_logosend); | 829 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_logosend); |
764 | bfa_fcxp_discard(rport->fcxp); | 830 | bfa_fcxp_discard(rport->fcxp); |
765 | bfa_fcs_rport_offline_action(rport); | 831 | bfa_fcs_rport_hal_offline_action(rport); |
766 | break; | 832 | break; |
767 | 833 | ||
768 | case RPSM_EVENT_SCN: | 834 | case RPSM_EVENT_SCN: |
@@ -774,14 +840,14 @@ bfa_fcs_rport_sm_adisc(struct bfa_fcs_rport_s *rport, enum rport_event event) | |||
774 | case RPSM_EVENT_LOGO_IMP: | 840 | case RPSM_EVENT_LOGO_IMP: |
775 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_offline); | 841 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_offline); |
776 | bfa_fcxp_discard(rport->fcxp); | 842 | bfa_fcxp_discard(rport->fcxp); |
777 | bfa_fcs_rport_offline_action(rport); | 843 | bfa_fcs_rport_hal_offline_action(rport); |
778 | break; | 844 | break; |
779 | 845 | ||
780 | case RPSM_EVENT_LOGO_RCVD: | 846 | case RPSM_EVENT_LOGO_RCVD: |
781 | case RPSM_EVENT_PRLO_RCVD: | 847 | case RPSM_EVENT_PRLO_RCVD: |
782 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_logorcv); | 848 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_logorcv); |
783 | bfa_fcxp_discard(rport->fcxp); | 849 | bfa_fcxp_discard(rport->fcxp); |
784 | bfa_fcs_rport_offline_action(rport); | 850 | bfa_fcs_rport_hal_offline_action(rport); |
785 | break; | 851 | break; |
786 | 852 | ||
787 | default: | 853 | default: |
@@ -803,13 +869,19 @@ bfa_fcs_rport_sm_fc4_logorcv(struct bfa_fcs_rport_s *rport, | |||
803 | switch (event) { | 869 | switch (event) { |
804 | case RPSM_EVENT_FC4_OFFLINE: | 870 | case RPSM_EVENT_FC4_OFFLINE: |
805 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_hcb_logorcv); | 871 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_hcb_logorcv); |
806 | bfa_sm_send_event(rport->bfa_rport, BFA_RPORT_SM_OFFLINE); | 872 | bfa_fcs_rport_hal_offline(rport); |
807 | break; | 873 | break; |
808 | 874 | ||
809 | case RPSM_EVENT_DELETE: | 875 | case RPSM_EVENT_DELETE: |
810 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_logosend); | 876 | if (rport->pid && (rport->prlo == BFA_TRUE)) |
877 | bfa_fcs_rport_send_prlo_acc(rport); | ||
878 | if (rport->pid && (rport->prlo == BFA_FALSE)) | ||
879 | bfa_fcs_rport_send_logo_acc(rport); | ||
880 | |||
881 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_off_delete); | ||
811 | break; | 882 | break; |
812 | 883 | ||
884 | case RPSM_EVENT_HCB_ONLINE: | ||
813 | case RPSM_EVENT_LOGO_RCVD: | 885 | case RPSM_EVENT_LOGO_RCVD: |
814 | case RPSM_EVENT_PRLO_RCVD: | 886 | case RPSM_EVENT_PRLO_RCVD: |
815 | case RPSM_EVENT_ADDRESS_CHANGE: | 887 | case RPSM_EVENT_ADDRESS_CHANGE: |
@@ -835,7 +907,20 @@ bfa_fcs_rport_sm_fc4_logosend(struct bfa_fcs_rport_s *rport, | |||
835 | switch (event) { | 907 | switch (event) { |
836 | case RPSM_EVENT_FC4_OFFLINE: | 908 | case RPSM_EVENT_FC4_OFFLINE: |
837 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_hcb_logosend); | 909 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_hcb_logosend); |
838 | bfa_sm_send_event(rport->bfa_rport, BFA_RPORT_SM_OFFLINE); | 910 | bfa_fcs_rport_hal_offline(rport); |
911 | break; | ||
912 | |||
913 | case RPSM_EVENT_LOGO_RCVD: | ||
914 | bfa_fcs_rport_send_logo_acc(rport); | ||
915 | case RPSM_EVENT_PRLO_RCVD: | ||
916 | if (rport->prlo == BFA_TRUE) | ||
917 | bfa_fcs_rport_send_prlo_acc(rport); | ||
918 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_off_delete); | ||
919 | break; | ||
920 | |||
921 | case RPSM_EVENT_HCB_ONLINE: | ||
922 | case RPSM_EVENT_DELETE: | ||
923 | /* Rport is being deleted */ | ||
839 | break; | 924 | break; |
840 | 925 | ||
841 | default: | 926 | default: |
@@ -857,13 +942,23 @@ bfa_fcs_rport_sm_fc4_offline(struct bfa_fcs_rport_s *rport, | |||
857 | switch (event) { | 942 | switch (event) { |
858 | case RPSM_EVENT_FC4_OFFLINE: | 943 | case RPSM_EVENT_FC4_OFFLINE: |
859 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_hcb_offline); | 944 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_hcb_offline); |
860 | bfa_sm_send_event(rport->bfa_rport, BFA_RPORT_SM_OFFLINE); | 945 | bfa_fcs_rport_hal_offline(rport); |
861 | break; | 946 | break; |
862 | 947 | ||
863 | case RPSM_EVENT_SCN: | ||
864 | case RPSM_EVENT_LOGO_IMP: | ||
865 | case RPSM_EVENT_LOGO_RCVD: | 948 | case RPSM_EVENT_LOGO_RCVD: |
949 | /* | ||
950 | * Rport is going offline. Just ack the logo | ||
951 | */ | ||
952 | bfa_fcs_rport_send_logo_acc(rport); | ||
953 | break; | ||
954 | |||
866 | case RPSM_EVENT_PRLO_RCVD: | 955 | case RPSM_EVENT_PRLO_RCVD: |
956 | bfa_fcs_rport_send_prlo_acc(rport); | ||
957 | break; | ||
958 | |||
959 | case RPSM_EVENT_HCB_ONLINE: | ||
960 | case RPSM_EVENT_SCN: | ||
961 | case RPSM_EVENT_LOGO_IMP: | ||
867 | case RPSM_EVENT_ADDRESS_CHANGE: | 962 | case RPSM_EVENT_ADDRESS_CHANGE: |
868 | /* | 963 | /* |
869 | * rport is already going offline. | 964 | * rport is already going offline. |
@@ -907,24 +1002,23 @@ bfa_fcs_rport_sm_hcb_offline(struct bfa_fcs_rport_s *rport, | |||
907 | */ | 1002 | */ |
908 | 1003 | ||
909 | case RPSM_EVENT_ADDRESS_CHANGE: | 1004 | case RPSM_EVENT_ADDRESS_CHANGE: |
910 | if (bfa_fcs_lport_is_online(rport->port)) { | 1005 | if (!bfa_fcs_lport_is_online(rport->port)) { |
911 | if (bfa_fcs_fabric_is_switched(rport->port->fabric)) { | ||
912 | bfa_sm_set_state(rport, | ||
913 | bfa_fcs_rport_sm_nsdisc_sending); | ||
914 | rport->ns_retries = 0; | ||
915 | bfa_fcs_rport_send_nsdisc(rport, NULL); | ||
916 | } else { | ||
917 | bfa_sm_set_state(rport, | ||
918 | bfa_fcs_rport_sm_plogi_sending); | ||
919 | rport->plogi_retries = 0; | ||
920 | bfa_fcs_rport_send_plogi(rport, NULL); | ||
921 | } | ||
922 | } else { | ||
923 | rport->pid = 0; | 1006 | rport->pid = 0; |
924 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_offline); | 1007 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_offline); |
925 | bfa_timer_start(rport->fcs->bfa, &rport->timer, | 1008 | bfa_timer_start(rport->fcs->bfa, &rport->timer, |
926 | bfa_fcs_rport_timeout, rport, | 1009 | bfa_fcs_rport_timeout, rport, |
927 | bfa_fcs_rport_del_timeout); | 1010 | bfa_fcs_rport_del_timeout); |
1011 | break; | ||
1012 | } | ||
1013 | if (bfa_fcs_fabric_is_switched(rport->port->fabric)) { | ||
1014 | bfa_sm_set_state(rport, | ||
1015 | bfa_fcs_rport_sm_nsdisc_sending); | ||
1016 | rport->ns_retries = 0; | ||
1017 | bfa_fcs_rport_send_nsdisc(rport, NULL); | ||
1018 | } else { | ||
1019 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_plogi_sending); | ||
1020 | rport->plogi_retries = 0; | ||
1021 | bfa_fcs_rport_send_plogi(rport, NULL); | ||
928 | } | 1022 | } |
929 | break; | 1023 | break; |
930 | 1024 | ||
@@ -1001,7 +1095,11 @@ bfa_fcs_rport_sm_hcb_logorcv(struct bfa_fcs_rport_s *rport, | |||
1001 | break; | 1095 | break; |
1002 | 1096 | ||
1003 | case RPSM_EVENT_DELETE: | 1097 | case RPSM_EVENT_DELETE: |
1004 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_hcb_logosend); | 1098 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_delete_pending); |
1099 | if (rport->pid && (rport->prlo == BFA_TRUE)) | ||
1100 | bfa_fcs_rport_send_prlo_acc(rport); | ||
1101 | if (rport->pid && (rport->prlo == BFA_FALSE)) | ||
1102 | bfa_fcs_rport_send_logo_acc(rport); | ||
1005 | break; | 1103 | break; |
1006 | 1104 | ||
1007 | case RPSM_EVENT_LOGO_IMP: | 1105 | case RPSM_EVENT_LOGO_IMP: |
@@ -1040,7 +1138,14 @@ bfa_fcs_rport_sm_hcb_logosend(struct bfa_fcs_rport_s *rport, | |||
1040 | break; | 1138 | break; |
1041 | 1139 | ||
1042 | case RPSM_EVENT_LOGO_RCVD: | 1140 | case RPSM_EVENT_LOGO_RCVD: |
1141 | bfa_fcs_rport_send_logo_acc(rport); | ||
1043 | case RPSM_EVENT_PRLO_RCVD: | 1142 | case RPSM_EVENT_PRLO_RCVD: |
1143 | if (rport->prlo == BFA_TRUE) | ||
1144 | bfa_fcs_rport_send_prlo_acc(rport); | ||
1145 | |||
1146 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_delete_pending); | ||
1147 | break; | ||
1148 | |||
1044 | case RPSM_EVENT_ADDRESS_CHANGE: | 1149 | case RPSM_EVENT_ADDRESS_CHANGE: |
1045 | break; | 1150 | break; |
1046 | 1151 | ||
@@ -1072,7 +1177,11 @@ bfa_fcs_rport_sm_logo_sending(struct bfa_fcs_rport_s *rport, | |||
1072 | break; | 1177 | break; |
1073 | 1178 | ||
1074 | case RPSM_EVENT_LOGO_RCVD: | 1179 | case RPSM_EVENT_LOGO_RCVD: |
1180 | bfa_fcs_rport_send_logo_acc(rport); | ||
1075 | case RPSM_EVENT_PRLO_RCVD: | 1181 | case RPSM_EVENT_PRLO_RCVD: |
1182 | if (rport->prlo == BFA_TRUE) | ||
1183 | bfa_fcs_rport_send_prlo_acc(rport); | ||
1184 | |||
1076 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_uninit); | 1185 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_uninit); |
1077 | bfa_fcxp_walloc_cancel(rport->fcs->bfa, &rport->fcxp_wqe); | 1186 | bfa_fcxp_walloc_cancel(rport->fcs->bfa, &rport->fcxp_wqe); |
1078 | bfa_fcs_rport_free(rport); | 1187 | bfa_fcs_rport_free(rport); |
@@ -1126,9 +1235,9 @@ bfa_fcs_rport_sm_offline(struct bfa_fcs_rport_s *rport, enum rport_event event) | |||
1126 | break; | 1235 | break; |
1127 | 1236 | ||
1128 | case RPSM_EVENT_PLOGI_COMP: | 1237 | case RPSM_EVENT_PLOGI_COMP: |
1129 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_hal_online); | 1238 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_fcs_online); |
1130 | bfa_timer_stop(&rport->timer); | 1239 | bfa_timer_stop(&rport->timer); |
1131 | bfa_fcs_rport_hal_online(rport); | 1240 | bfa_fcs_rport_fcs_online_action(rport); |
1132 | break; | 1241 | break; |
1133 | 1242 | ||
1134 | case RPSM_EVENT_PLOGI_SEND: | 1243 | case RPSM_EVENT_PLOGI_SEND: |
@@ -1190,9 +1299,9 @@ bfa_fcs_rport_sm_nsdisc_sending(struct bfa_fcs_rport_s *rport, | |||
1190 | break; | 1299 | break; |
1191 | 1300 | ||
1192 | case RPSM_EVENT_PLOGI_COMP: | 1301 | case RPSM_EVENT_PLOGI_COMP: |
1193 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_hal_online); | 1302 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_fcs_online); |
1194 | bfa_fcxp_walloc_cancel(rport->fcs->bfa, &rport->fcxp_wqe); | 1303 | bfa_fcxp_walloc_cancel(rport->fcs->bfa, &rport->fcxp_wqe); |
1195 | bfa_fcs_rport_hal_online(rport); | 1304 | bfa_fcs_rport_fcs_online_action(rport); |
1196 | break; | 1305 | break; |
1197 | 1306 | ||
1198 | default: | 1307 | default: |
@@ -1254,9 +1363,9 @@ bfa_fcs_rport_sm_nsdisc_retry(struct bfa_fcs_rport_s *rport, | |||
1254 | break; | 1363 | break; |
1255 | 1364 | ||
1256 | case RPSM_EVENT_PLOGI_COMP: | 1365 | case RPSM_EVENT_PLOGI_COMP: |
1257 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_hal_online); | 1366 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_fcs_online); |
1258 | bfa_timer_stop(&rport->timer); | 1367 | bfa_timer_stop(&rport->timer); |
1259 | bfa_fcs_rport_hal_online(rport); | 1368 | bfa_fcs_rport_fcs_online_action(rport); |
1260 | break; | 1369 | break; |
1261 | 1370 | ||
1262 | default: | 1371 | default: |
@@ -1296,6 +1405,7 @@ bfa_fcs_rport_sm_nsdisc_sent(struct bfa_fcs_rport_s *rport, | |||
1296 | bfa_fcs_rport_sm_nsdisc_sending); | 1405 | bfa_fcs_rport_sm_nsdisc_sending); |
1297 | bfa_fcs_rport_send_nsdisc(rport, NULL); | 1406 | bfa_fcs_rport_send_nsdisc(rport, NULL); |
1298 | } else { | 1407 | } else { |
1408 | rport->old_pid = rport->pid; | ||
1299 | rport->pid = 0; | 1409 | rport->pid = 0; |
1300 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_offline); | 1410 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_offline); |
1301 | bfa_timer_start(rport->fcs->bfa, &rport->timer, | 1411 | bfa_timer_start(rport->fcs->bfa, &rport->timer, |
@@ -1343,9 +1453,9 @@ bfa_fcs_rport_sm_nsdisc_sent(struct bfa_fcs_rport_s *rport, | |||
1343 | break; | 1453 | break; |
1344 | 1454 | ||
1345 | case RPSM_EVENT_PLOGI_COMP: | 1455 | case RPSM_EVENT_PLOGI_COMP: |
1346 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_hal_online); | 1456 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_fc4_fcs_online); |
1347 | bfa_fcxp_discard(rport->fcxp); | 1457 | bfa_fcxp_discard(rport->fcxp); |
1348 | bfa_fcs_rport_hal_online(rport); | 1458 | bfa_fcs_rport_fcs_online_action(rport); |
1349 | break; | 1459 | break; |
1350 | 1460 | ||
1351 | default: | 1461 | default: |
@@ -1353,7 +1463,63 @@ bfa_fcs_rport_sm_nsdisc_sent(struct bfa_fcs_rport_s *rport, | |||
1353 | } | 1463 | } |
1354 | } | 1464 | } |
1355 | 1465 | ||
1466 | /* | ||
1467 | * Rport needs to be deleted | ||
1468 | * waiting for ITNIM clean up to finish | ||
1469 | */ | ||
1470 | static void | ||
1471 | bfa_fcs_rport_sm_fc4_off_delete(struct bfa_fcs_rport_s *rport, | ||
1472 | enum rport_event event) | ||
1473 | { | ||
1474 | bfa_trc(rport->fcs, rport->pwwn); | ||
1475 | bfa_trc(rport->fcs, rport->pid); | ||
1476 | bfa_trc(rport->fcs, event); | ||
1356 | 1477 | ||
1478 | switch (event) { | ||
1479 | case RPSM_EVENT_FC4_OFFLINE: | ||
1480 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_delete_pending); | ||
1481 | bfa_fcs_rport_hal_offline(rport); | ||
1482 | break; | ||
1483 | |||
1484 | case RPSM_EVENT_DELETE: | ||
1485 | case RPSM_EVENT_PLOGI_RCVD: | ||
1486 | /* Ignore these events */ | ||
1487 | break; | ||
1488 | |||
1489 | default: | ||
1490 | bfa_sm_fault(rport->fcs, event); | ||
1491 | break; | ||
1492 | } | ||
1493 | } | ||
1494 | |||
1495 | /* | ||
1496 | * RPort needs to be deleted | ||
1497 | * waiting for BFA/FW to finish current processing | ||
1498 | */ | ||
1499 | static void | ||
1500 | bfa_fcs_rport_sm_delete_pending(struct bfa_fcs_rport_s *rport, | ||
1501 | enum rport_event event) | ||
1502 | { | ||
1503 | bfa_trc(rport->fcs, rport->pwwn); | ||
1504 | bfa_trc(rport->fcs, rport->pid); | ||
1505 | bfa_trc(rport->fcs, event); | ||
1506 | |||
1507 | switch (event) { | ||
1508 | case RPSM_EVENT_HCB_OFFLINE: | ||
1509 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_uninit); | ||
1510 | bfa_fcs_rport_free(rport); | ||
1511 | break; | ||
1512 | |||
1513 | case RPSM_EVENT_DELETE: | ||
1514 | case RPSM_EVENT_LOGO_IMP: | ||
1515 | case RPSM_EVENT_PLOGI_RCVD: | ||
1516 | /* Ignore these events */ | ||
1517 | break; | ||
1518 | |||
1519 | default: | ||
1520 | bfa_sm_fault(rport->fcs, event); | ||
1521 | } | ||
1522 | } | ||
1357 | 1523 | ||
1358 | /* | 1524 | /* |
1359 | * fcs_rport_private FCS RPORT provate functions | 1525 | * fcs_rport_private FCS RPORT provate functions |
@@ -1370,10 +1536,11 @@ bfa_fcs_rport_send_plogi(void *rport_cbarg, struct bfa_fcxp_s *fcxp_alloced) | |||
1370 | 1536 | ||
1371 | bfa_trc(rport->fcs, rport->pwwn); | 1537 | bfa_trc(rport->fcs, rport->pwwn); |
1372 | 1538 | ||
1373 | fcxp = fcxp_alloced ? fcxp_alloced : bfa_fcs_fcxp_alloc(port->fcs); | 1539 | fcxp = fcxp_alloced ? fcxp_alloced : |
1540 | bfa_fcs_fcxp_alloc(port->fcs, BFA_TRUE); | ||
1374 | if (!fcxp) { | 1541 | if (!fcxp) { |
1375 | bfa_fcs_fcxp_alloc_wait(port->fcs->bfa, &rport->fcxp_wqe, | 1542 | bfa_fcs_fcxp_alloc_wait(port->fcs->bfa, &rport->fcxp_wqe, |
1376 | bfa_fcs_rport_send_plogi, rport); | 1543 | bfa_fcs_rport_send_plogi, rport, BFA_TRUE); |
1377 | return; | 1544 | return; |
1378 | } | 1545 | } |
1379 | rport->fcxp = fcxp; | 1546 | rport->fcxp = fcxp; |
@@ -1490,10 +1657,11 @@ bfa_fcs_rport_send_plogiacc(void *rport_cbarg, struct bfa_fcxp_s *fcxp_alloced) | |||
1490 | bfa_trc(rport->fcs, rport->pwwn); | 1657 | bfa_trc(rport->fcs, rport->pwwn); |
1491 | bfa_trc(rport->fcs, rport->reply_oxid); | 1658 | bfa_trc(rport->fcs, rport->reply_oxid); |
1492 | 1659 | ||
1493 | fcxp = fcxp_alloced ? fcxp_alloced : bfa_fcs_fcxp_alloc(port->fcs); | 1660 | fcxp = fcxp_alloced ? fcxp_alloced : |
1661 | bfa_fcs_fcxp_alloc(port->fcs, BFA_FALSE); | ||
1494 | if (!fcxp) { | 1662 | if (!fcxp) { |
1495 | bfa_fcs_fcxp_alloc_wait(port->fcs->bfa, &rport->fcxp_wqe, | 1663 | bfa_fcs_fcxp_alloc_wait(port->fcs->bfa, &rport->fcxp_wqe, |
1496 | bfa_fcs_rport_send_plogiacc, rport); | 1664 | bfa_fcs_rport_send_plogiacc, rport, BFA_FALSE); |
1497 | return; | 1665 | return; |
1498 | } | 1666 | } |
1499 | rport->fcxp = fcxp; | 1667 | rport->fcxp = fcxp; |
@@ -1522,10 +1690,11 @@ bfa_fcs_rport_send_adisc(void *rport_cbarg, struct bfa_fcxp_s *fcxp_alloced) | |||
1522 | 1690 | ||
1523 | bfa_trc(rport->fcs, rport->pwwn); | 1691 | bfa_trc(rport->fcs, rport->pwwn); |
1524 | 1692 | ||
1525 | fcxp = fcxp_alloced ? fcxp_alloced : bfa_fcs_fcxp_alloc(port->fcs); | 1693 | fcxp = fcxp_alloced ? fcxp_alloced : |
1694 | bfa_fcs_fcxp_alloc(port->fcs, BFA_TRUE); | ||
1526 | if (!fcxp) { | 1695 | if (!fcxp) { |
1527 | bfa_fcs_fcxp_alloc_wait(port->fcs->bfa, &rport->fcxp_wqe, | 1696 | bfa_fcs_fcxp_alloc_wait(port->fcs->bfa, &rport->fcxp_wqe, |
1528 | bfa_fcs_rport_send_adisc, rport); | 1697 | bfa_fcs_rport_send_adisc, rport, BFA_TRUE); |
1529 | return; | 1698 | return; |
1530 | } | 1699 | } |
1531 | rport->fcxp = fcxp; | 1700 | rport->fcxp = fcxp; |
@@ -1585,10 +1754,11 @@ bfa_fcs_rport_send_nsdisc(void *rport_cbarg, struct bfa_fcxp_s *fcxp_alloced) | |||
1585 | 1754 | ||
1586 | bfa_trc(rport->fcs, rport->pid); | 1755 | bfa_trc(rport->fcs, rport->pid); |
1587 | 1756 | ||
1588 | fcxp = fcxp_alloced ? fcxp_alloced : bfa_fcs_fcxp_alloc(port->fcs); | 1757 | fcxp = fcxp_alloced ? fcxp_alloced : |
1758 | bfa_fcs_fcxp_alloc(port->fcs, BFA_TRUE); | ||
1589 | if (!fcxp) { | 1759 | if (!fcxp) { |
1590 | bfa_fcs_fcxp_alloc_wait(port->fcs->bfa, &rport->fcxp_wqe, | 1760 | bfa_fcs_fcxp_alloc_wait(port->fcs->bfa, &rport->fcxp_wqe, |
1591 | bfa_fcs_rport_send_nsdisc, rport); | 1761 | bfa_fcs_rport_send_nsdisc, rport, BFA_TRUE); |
1592 | return; | 1762 | return; |
1593 | } | 1763 | } |
1594 | rport->fcxp = fcxp; | 1764 | rport->fcxp = fcxp; |
@@ -1741,10 +1911,11 @@ bfa_fcs_rport_send_logo(void *rport_cbarg, struct bfa_fcxp_s *fcxp_alloced) | |||
1741 | 1911 | ||
1742 | port = rport->port; | 1912 | port = rport->port; |
1743 | 1913 | ||
1744 | fcxp = fcxp_alloced ? fcxp_alloced : bfa_fcs_fcxp_alloc(port->fcs); | 1914 | fcxp = fcxp_alloced ? fcxp_alloced : |
1915 | bfa_fcs_fcxp_alloc(port->fcs, BFA_FALSE); | ||
1745 | if (!fcxp) { | 1916 | if (!fcxp) { |
1746 | bfa_fcs_fcxp_alloc_wait(port->fcs->bfa, &rport->fcxp_wqe, | 1917 | bfa_fcs_fcxp_alloc_wait(port->fcs->bfa, &rport->fcxp_wqe, |
1747 | bfa_fcs_rport_send_logo, rport); | 1918 | bfa_fcs_rport_send_logo, rport, BFA_FALSE); |
1748 | return; | 1919 | return; |
1749 | } | 1920 | } |
1750 | rport->fcxp = fcxp; | 1921 | rport->fcxp = fcxp; |
@@ -1778,7 +1949,7 @@ bfa_fcs_rport_send_logo_acc(void *rport_cbarg) | |||
1778 | 1949 | ||
1779 | port = rport->port; | 1950 | port = rport->port; |
1780 | 1951 | ||
1781 | fcxp = bfa_fcs_fcxp_alloc(port->fcs); | 1952 | fcxp = bfa_fcs_fcxp_alloc(port->fcs, BFA_FALSE); |
1782 | if (!fcxp) | 1953 | if (!fcxp) |
1783 | return; | 1954 | return; |
1784 | 1955 | ||
@@ -1849,7 +2020,7 @@ bfa_fcs_rport_process_prli(struct bfa_fcs_rport_s *rport, | |||
1849 | bfa_fcs_itnim_is_initiator(rport->itnim); | 2020 | bfa_fcs_itnim_is_initiator(rport->itnim); |
1850 | } | 2021 | } |
1851 | 2022 | ||
1852 | fcxp = bfa_fcs_fcxp_alloc(port->fcs); | 2023 | fcxp = bfa_fcs_fcxp_alloc(port->fcs, BFA_FALSE); |
1853 | if (!fcxp) | 2024 | if (!fcxp) |
1854 | return; | 2025 | return; |
1855 | 2026 | ||
@@ -1886,7 +2057,7 @@ bfa_fcs_rport_process_rpsc(struct bfa_fcs_rport_s *rport, | |||
1886 | 2057 | ||
1887 | speeds.port_op_speed = fc_bfa_speed_to_rpsc_operspeed(pport_attr.speed); | 2058 | speeds.port_op_speed = fc_bfa_speed_to_rpsc_operspeed(pport_attr.speed); |
1888 | 2059 | ||
1889 | fcxp = bfa_fcs_fcxp_alloc(port->fcs); | 2060 | fcxp = bfa_fcs_fcxp_alloc(port->fcs, BFA_FALSE); |
1890 | if (!fcxp) | 2061 | if (!fcxp) |
1891 | return; | 2062 | return; |
1892 | 2063 | ||
@@ -1920,7 +2091,7 @@ bfa_fcs_rport_process_adisc(struct bfa_fcs_rport_s *rport, | |||
1920 | */ | 2091 | */ |
1921 | if (bfa_fcs_itnim_get_online_state(rport->itnim) == BFA_STATUS_OK) { | 2092 | if (bfa_fcs_itnim_get_online_state(rport->itnim) == BFA_STATUS_OK) { |
1922 | 2093 | ||
1923 | fcxp = bfa_fcs_fcxp_alloc(port->fcs); | 2094 | fcxp = bfa_fcs_fcxp_alloc(port->fcs, BFA_FALSE); |
1924 | if (!fcxp) | 2095 | if (!fcxp) |
1925 | return; | 2096 | return; |
1926 | 2097 | ||
@@ -1957,6 +2128,15 @@ bfa_fcs_rport_hal_online(struct bfa_fcs_rport_s *rport) | |||
1957 | bfa_rport_online(rport->bfa_rport, &rport_info); | 2128 | bfa_rport_online(rport->bfa_rport, &rport_info); |
1958 | } | 2129 | } |
1959 | 2130 | ||
2131 | static void | ||
2132 | bfa_fcs_rport_hal_offline(struct bfa_fcs_rport_s *rport) | ||
2133 | { | ||
2134 | if (rport->bfa_rport) | ||
2135 | bfa_sm_send_event(rport->bfa_rport, BFA_RPORT_SM_OFFLINE); | ||
2136 | else | ||
2137 | bfa_cb_rport_offline(rport); | ||
2138 | } | ||
2139 | |||
1960 | static struct bfa_fcs_rport_s * | 2140 | static struct bfa_fcs_rport_s * |
1961 | bfa_fcs_rport_alloc(struct bfa_fcs_lport_s *port, wwn_t pwwn, u32 rpid) | 2141 | bfa_fcs_rport_alloc(struct bfa_fcs_lport_s *port, wwn_t pwwn, u32 rpid) |
1962 | { | 2142 | { |
@@ -1967,6 +2147,11 @@ bfa_fcs_rport_alloc(struct bfa_fcs_lport_s *port, wwn_t pwwn, u32 rpid) | |||
1967 | /* | 2147 | /* |
1968 | * allocate rport | 2148 | * allocate rport |
1969 | */ | 2149 | */ |
2150 | if (fcs->num_rport_logins >= bfa_fcs_rport_max_logins) { | ||
2151 | bfa_trc(fcs, rpid); | ||
2152 | return NULL; | ||
2153 | } | ||
2154 | |||
1970 | if (bfa_fcb_rport_alloc(fcs->bfad, &rport, &rport_drv) | 2155 | if (bfa_fcb_rport_alloc(fcs->bfad, &rport, &rport_drv) |
1971 | != BFA_STATUS_OK) { | 2156 | != BFA_STATUS_OK) { |
1972 | bfa_trc(fcs, rpid); | 2157 | bfa_trc(fcs, rpid); |
@@ -1981,16 +2166,9 @@ bfa_fcs_rport_alloc(struct bfa_fcs_lport_s *port, wwn_t pwwn, u32 rpid) | |||
1981 | rport->rp_drv = rport_drv; | 2166 | rport->rp_drv = rport_drv; |
1982 | rport->pid = rpid; | 2167 | rport->pid = rpid; |
1983 | rport->pwwn = pwwn; | 2168 | rport->pwwn = pwwn; |
2169 | rport->old_pid = 0; | ||
1984 | 2170 | ||
1985 | /* | 2171 | rport->bfa_rport = NULL; |
1986 | * allocate BFA rport | ||
1987 | */ | ||
1988 | rport->bfa_rport = bfa_rport_create(port->fcs->bfa, rport); | ||
1989 | if (!rport->bfa_rport) { | ||
1990 | bfa_trc(fcs, rpid); | ||
1991 | kfree(rport_drv); | ||
1992 | return NULL; | ||
1993 | } | ||
1994 | 2172 | ||
1995 | /* | 2173 | /* |
1996 | * allocate FC-4s | 2174 | * allocate FC-4s |
@@ -2001,14 +2179,13 @@ bfa_fcs_rport_alloc(struct bfa_fcs_lport_s *port, wwn_t pwwn, u32 rpid) | |||
2001 | rport->itnim = bfa_fcs_itnim_create(rport); | 2179 | rport->itnim = bfa_fcs_itnim_create(rport); |
2002 | if (!rport->itnim) { | 2180 | if (!rport->itnim) { |
2003 | bfa_trc(fcs, rpid); | 2181 | bfa_trc(fcs, rpid); |
2004 | bfa_sm_send_event(rport->bfa_rport, | ||
2005 | BFA_RPORT_SM_DELETE); | ||
2006 | kfree(rport_drv); | 2182 | kfree(rport_drv); |
2007 | return NULL; | 2183 | return NULL; |
2008 | } | 2184 | } |
2009 | } | 2185 | } |
2010 | 2186 | ||
2011 | bfa_fcs_lport_add_rport(port, rport); | 2187 | bfa_fcs_lport_add_rport(port, rport); |
2188 | fcs->num_rport_logins++; | ||
2012 | 2189 | ||
2013 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_uninit); | 2190 | bfa_sm_set_state(rport, bfa_fcs_rport_sm_uninit); |
2014 | 2191 | ||
@@ -2024,20 +2201,28 @@ static void | |||
2024 | bfa_fcs_rport_free(struct bfa_fcs_rport_s *rport) | 2201 | bfa_fcs_rport_free(struct bfa_fcs_rport_s *rport) |
2025 | { | 2202 | { |
2026 | struct bfa_fcs_lport_s *port = rport->port; | 2203 | struct bfa_fcs_lport_s *port = rport->port; |
2204 | struct bfa_fcs_s *fcs = port->fcs; | ||
2027 | 2205 | ||
2028 | /* | 2206 | /* |
2029 | * - delete FC-4s | 2207 | * - delete FC-4s |
2030 | * - delete BFA rport | 2208 | * - delete BFA rport |
2031 | * - remove from queue of rports | 2209 | * - remove from queue of rports |
2032 | */ | 2210 | */ |
2211 | rport->plogi_pending = BFA_FALSE; | ||
2212 | |||
2033 | if (bfa_fcs_lport_is_initiator(port)) { | 2213 | if (bfa_fcs_lport_is_initiator(port)) { |
2034 | bfa_fcs_itnim_delete(rport->itnim); | 2214 | bfa_fcs_itnim_delete(rport->itnim); |
2035 | if (rport->pid != 0 && !BFA_FCS_PID_IS_WKA(rport->pid)) | 2215 | if (rport->pid != 0 && !BFA_FCS_PID_IS_WKA(rport->pid)) |
2036 | bfa_fcs_rpf_rport_offline(rport); | 2216 | bfa_fcs_rpf_rport_offline(rport); |
2037 | } | 2217 | } |
2038 | 2218 | ||
2039 | bfa_sm_send_event(rport->bfa_rport, BFA_RPORT_SM_DELETE); | 2219 | if (rport->bfa_rport) { |
2220 | bfa_sm_send_event(rport->bfa_rport, BFA_RPORT_SM_DELETE); | ||
2221 | rport->bfa_rport = NULL; | ||
2222 | } | ||
2223 | |||
2040 | bfa_fcs_lport_del_rport(port, rport); | 2224 | bfa_fcs_lport_del_rport(port, rport); |
2225 | fcs->num_rport_logins--; | ||
2041 | kfree(rport->rp_drv); | 2226 | kfree(rport->rp_drv); |
2042 | } | 2227 | } |
2043 | 2228 | ||
@@ -2071,7 +2256,18 @@ bfa_fcs_rport_aen_post(struct bfa_fcs_rport_s *rport, | |||
2071 | } | 2256 | } |
2072 | 2257 | ||
2073 | static void | 2258 | static void |
2074 | bfa_fcs_rport_online_action(struct bfa_fcs_rport_s *rport) | 2259 | bfa_fcs_rport_fcs_online_action(struct bfa_fcs_rport_s *rport) |
2260 | { | ||
2261 | if ((!rport->pid) || (!rport->pwwn)) { | ||
2262 | bfa_trc(rport->fcs, rport->pid); | ||
2263 | bfa_sm_fault(rport->fcs, rport->pid); | ||
2264 | } | ||
2265 | |||
2266 | bfa_sm_send_event(rport->itnim, BFA_FCS_ITNIM_SM_FCS_ONLINE); | ||
2267 | } | ||
2268 | |||
2269 | static void | ||
2270 | bfa_fcs_rport_hal_online_action(struct bfa_fcs_rport_s *rport) | ||
2075 | { | 2271 | { |
2076 | struct bfa_fcs_lport_s *port = rport->port; | 2272 | struct bfa_fcs_lport_s *port = rport->port; |
2077 | struct bfad_s *bfad = (struct bfad_s *)port->fcs->bfad; | 2273 | struct bfad_s *bfad = (struct bfad_s *)port->fcs->bfad; |
@@ -2086,7 +2282,7 @@ bfa_fcs_rport_online_action(struct bfa_fcs_rport_s *rport) | |||
2086 | } | 2282 | } |
2087 | 2283 | ||
2088 | if (bfa_fcs_lport_is_initiator(port)) { | 2284 | if (bfa_fcs_lport_is_initiator(port)) { |
2089 | bfa_fcs_itnim_rport_online(rport->itnim); | 2285 | bfa_fcs_itnim_brp_online(rport->itnim); |
2090 | if (!BFA_FCS_PID_IS_WKA(rport->pid)) | 2286 | if (!BFA_FCS_PID_IS_WKA(rport->pid)) |
2091 | bfa_fcs_rpf_rport_online(rport); | 2287 | bfa_fcs_rpf_rport_online(rport); |
2092 | }; | 2288 | }; |
@@ -2102,15 +2298,28 @@ bfa_fcs_rport_online_action(struct bfa_fcs_rport_s *rport) | |||
2102 | } | 2298 | } |
2103 | 2299 | ||
2104 | static void | 2300 | static void |
2105 | bfa_fcs_rport_offline_action(struct bfa_fcs_rport_s *rport) | 2301 | bfa_fcs_rport_fcs_offline_action(struct bfa_fcs_rport_s *rport) |
2302 | { | ||
2303 | if (!BFA_FCS_PID_IS_WKA(rport->pid)) | ||
2304 | bfa_fcs_rpf_rport_offline(rport); | ||
2305 | |||
2306 | bfa_fcs_itnim_rport_offline(rport->itnim); | ||
2307 | } | ||
2308 | |||
2309 | static void | ||
2310 | bfa_fcs_rport_hal_offline_action(struct bfa_fcs_rport_s *rport) | ||
2106 | { | 2311 | { |
2107 | struct bfa_fcs_lport_s *port = rport->port; | 2312 | struct bfa_fcs_lport_s *port = rport->port; |
2108 | struct bfad_s *bfad = (struct bfad_s *)port->fcs->bfad; | 2313 | struct bfad_s *bfad = (struct bfad_s *)port->fcs->bfad; |
2109 | char lpwwn_buf[BFA_STRING_32]; | 2314 | char lpwwn_buf[BFA_STRING_32]; |
2110 | char rpwwn_buf[BFA_STRING_32]; | 2315 | char rpwwn_buf[BFA_STRING_32]; |
2111 | 2316 | ||
2317 | if (!rport->bfa_rport) { | ||
2318 | bfa_fcs_rport_fcs_offline_action(rport); | ||
2319 | return; | ||
2320 | } | ||
2321 | |||
2112 | rport->stats.offlines++; | 2322 | rport->stats.offlines++; |
2113 | rport->plogi_pending = BFA_FALSE; | ||
2114 | 2323 | ||
2115 | wwn2str(lpwwn_buf, bfa_fcs_lport_get_pwwn(port)); | 2324 | wwn2str(lpwwn_buf, bfa_fcs_lport_get_pwwn(port)); |
2116 | wwn2str(rpwwn_buf, rport->pwwn); | 2325 | wwn2str(rpwwn_buf, rport->pwwn); |
@@ -2340,7 +2549,6 @@ bfa_fcs_rport_scn(struct bfa_fcs_rport_s *rport) | |||
2340 | bfa_sm_send_event(rport, RPSM_EVENT_SCN); | 2549 | bfa_sm_send_event(rport, RPSM_EVENT_SCN); |
2341 | } | 2550 | } |
2342 | 2551 | ||
2343 | |||
2344 | /* | 2552 | /* |
2345 | * brief | 2553 | * brief |
2346 | * This routine BFA callback for bfa_rport_online() call. | 2554 | * This routine BFA callback for bfa_rport_online() call. |
@@ -2508,7 +2716,7 @@ bfa_fcs_rport_send_prlo_acc(struct bfa_fcs_rport_s *rport) | |||
2508 | 2716 | ||
2509 | bfa_trc(rport->fcs, rport->pid); | 2717 | bfa_trc(rport->fcs, rport->pid); |
2510 | 2718 | ||
2511 | fcxp = bfa_fcs_fcxp_alloc(port->fcs); | 2719 | fcxp = bfa_fcs_fcxp_alloc(port->fcs, BFA_FALSE); |
2512 | if (!fcxp) | 2720 | if (!fcxp) |
2513 | return; | 2721 | return; |
2514 | len = fc_prlo_acc_build(&fchs, bfa_fcxp_get_reqbuf(fcxp), | 2722 | len = fc_prlo_acc_build(&fchs, bfa_fcxp_get_reqbuf(fcxp), |
@@ -2534,7 +2742,7 @@ bfa_fcs_rport_send_ls_rjt(struct bfa_fcs_rport_s *rport, struct fchs_s *rx_fchs, | |||
2534 | 2742 | ||
2535 | bfa_trc(rport->fcs, rx_fchs->s_id); | 2743 | bfa_trc(rport->fcs, rx_fchs->s_id); |
2536 | 2744 | ||
2537 | fcxp = bfa_fcs_fcxp_alloc(rport->fcs); | 2745 | fcxp = bfa_fcs_fcxp_alloc(rport->fcs, BFA_FALSE); |
2538 | if (!fcxp) | 2746 | if (!fcxp) |
2539 | return; | 2747 | return; |
2540 | 2748 | ||
@@ -2582,6 +2790,17 @@ bfa_fcs_rport_prlo(struct bfa_fcs_rport_s *rport, __be16 ox_id) | |||
2582 | bfa_sm_send_event(rport, RPSM_EVENT_PRLO_RCVD); | 2790 | bfa_sm_send_event(rport, RPSM_EVENT_PRLO_RCVD); |
2583 | } | 2791 | } |
2584 | 2792 | ||
2793 | /* | ||
2794 | * Called by BFAD to set the max limit on number of bfa_fcs_rport allocation | ||
2795 | * which limits number of concurrent logins to remote ports | ||
2796 | */ | ||
2797 | void | ||
2798 | bfa_fcs_rport_set_max_logins(u32 max_logins) | ||
2799 | { | ||
2800 | if (max_logins > 0) | ||
2801 | bfa_fcs_rport_max_logins = max_logins; | ||
2802 | } | ||
2803 | |||
2585 | void | 2804 | void |
2586 | bfa_fcs_rport_get_attr(struct bfa_fcs_rport_s *rport, | 2805 | bfa_fcs_rport_get_attr(struct bfa_fcs_rport_s *rport, |
2587 | struct bfa_rport_attr_s *rport_attr) | 2806 | struct bfa_rport_attr_s *rport_attr) |
@@ -2605,9 +2824,11 @@ bfa_fcs_rport_get_attr(struct bfa_fcs_rport_s *rport, | |||
2605 | rport_attr->curr_speed = rport->rpf.rpsc_speed; | 2824 | rport_attr->curr_speed = rport->rpf.rpsc_speed; |
2606 | rport_attr->assigned_speed = rport->rpf.assigned_speed; | 2825 | rport_attr->assigned_speed = rport->rpf.assigned_speed; |
2607 | 2826 | ||
2608 | qos_attr.qos_priority = rport->bfa_rport->qos_attr.qos_priority; | 2827 | if (rport->bfa_rport) { |
2609 | qos_attr.qos_flow_id = | 2828 | qos_attr.qos_priority = rport->bfa_rport->qos_attr.qos_priority; |
2610 | cpu_to_be32(rport->bfa_rport->qos_attr.qos_flow_id); | 2829 | qos_attr.qos_flow_id = |
2830 | cpu_to_be32(rport->bfa_rport->qos_attr.qos_flow_id); | ||
2831 | } | ||
2611 | rport_attr->qos_attr = qos_attr; | 2832 | rport_attr->qos_attr = qos_attr; |
2612 | 2833 | ||
2613 | rport_attr->trl_enforced = BFA_FALSE; | 2834 | rport_attr->trl_enforced = BFA_FALSE; |
@@ -2940,10 +3161,11 @@ bfa_fcs_rpf_send_rpsc2(void *rpf_cbarg, struct bfa_fcxp_s *fcxp_alloced) | |||
2940 | 3161 | ||
2941 | bfa_trc(rport->fcs, rport->pwwn); | 3162 | bfa_trc(rport->fcs, rport->pwwn); |
2942 | 3163 | ||
2943 | fcxp = fcxp_alloced ? fcxp_alloced : bfa_fcs_fcxp_alloc(port->fcs); | 3164 | fcxp = fcxp_alloced ? fcxp_alloced : |
3165 | bfa_fcs_fcxp_alloc(port->fcs, BFA_TRUE); | ||
2944 | if (!fcxp) { | 3166 | if (!fcxp) { |
2945 | bfa_fcs_fcxp_alloc_wait(port->fcs->bfa, &rpf->fcxp_wqe, | 3167 | bfa_fcs_fcxp_alloc_wait(port->fcs->bfa, &rpf->fcxp_wqe, |
2946 | bfa_fcs_rpf_send_rpsc2, rpf); | 3168 | bfa_fcs_rpf_send_rpsc2, rpf, BFA_TRUE); |
2947 | return; | 3169 | return; |
2948 | } | 3170 | } |
2949 | rpf->fcxp = fcxp; | 3171 | rpf->fcxp = fcxp; |