diff options
Diffstat (limited to 'drivers/scsi/bfa/bfa_fcs.c')
-rw-r--r-- | drivers/scsi/bfa/bfa_fcs.c | 133 |
1 files changed, 133 insertions, 0 deletions
diff --git a/drivers/scsi/bfa/bfa_fcs.c b/drivers/scsi/bfa/bfa_fcs.c index 3f71d504e39..671a1a227f9 100644 --- a/drivers/scsi/bfa/bfa_fcs.c +++ b/drivers/scsi/bfa/bfa_fcs.c | |||
@@ -119,6 +119,18 @@ bfa_fcs_update_cfg(struct bfa_fcs_s *fcs) | |||
119 | } | 119 | } |
120 | 120 | ||
121 | /* | 121 | /* |
122 | * Stop FCS operations. | ||
123 | */ | ||
124 | void | ||
125 | bfa_fcs_stop(struct bfa_fcs_s *fcs) | ||
126 | { | ||
127 | bfa_wc_init(&fcs->wc, bfa_fcs_exit_comp, fcs); | ||
128 | bfa_wc_up(&fcs->wc); | ||
129 | bfa_fcs_fabric_modstop(fcs); | ||
130 | bfa_wc_wait(&fcs->wc); | ||
131 | } | ||
132 | |||
133 | /* | ||
122 | * fcs pbc vport initialization | 134 | * fcs pbc vport initialization |
123 | */ | 135 | */ |
124 | void | 136 | void |
@@ -213,6 +225,8 @@ static void bfa_fcs_fabric_notify_offline(struct bfa_fcs_fabric_s *fabric); | |||
213 | static void bfa_fcs_fabric_delay(void *cbarg); | 225 | static void bfa_fcs_fabric_delay(void *cbarg); |
214 | static void bfa_fcs_fabric_delete(struct bfa_fcs_fabric_s *fabric); | 226 | static void bfa_fcs_fabric_delete(struct bfa_fcs_fabric_s *fabric); |
215 | static void bfa_fcs_fabric_delete_comp(void *cbarg); | 227 | static void bfa_fcs_fabric_delete_comp(void *cbarg); |
228 | static void bfa_fcs_fabric_stop(struct bfa_fcs_fabric_s *fabric); | ||
229 | static void bfa_fcs_fabric_stop_comp(void *cbarg); | ||
216 | static void bfa_fcs_fabric_process_uf(struct bfa_fcs_fabric_s *fabric, | 230 | static void bfa_fcs_fabric_process_uf(struct bfa_fcs_fabric_s *fabric, |
217 | struct fchs_s *fchs, u16 len); | 231 | struct fchs_s *fchs, u16 len); |
218 | static void bfa_fcs_fabric_process_flogi(struct bfa_fcs_fabric_s *fabric, | 232 | static void bfa_fcs_fabric_process_flogi(struct bfa_fcs_fabric_s *fabric, |
@@ -250,6 +264,10 @@ static void bfa_fcs_fabric_sm_isolated(struct bfa_fcs_fabric_s *fabric, | |||
250 | enum bfa_fcs_fabric_event event); | 264 | enum bfa_fcs_fabric_event event); |
251 | static void bfa_fcs_fabric_sm_deleting(struct bfa_fcs_fabric_s *fabric, | 265 | static void bfa_fcs_fabric_sm_deleting(struct bfa_fcs_fabric_s *fabric, |
252 | enum bfa_fcs_fabric_event event); | 266 | enum bfa_fcs_fabric_event event); |
267 | static void bfa_fcs_fabric_sm_stopping(struct bfa_fcs_fabric_s *fabric, | ||
268 | enum bfa_fcs_fabric_event event); | ||
269 | static void bfa_fcs_fabric_sm_cleanup(struct bfa_fcs_fabric_s *fabric, | ||
270 | enum bfa_fcs_fabric_event event); | ||
253 | /* | 271 | /* |
254 | * Beginning state before fabric creation. | 272 | * Beginning state before fabric creation. |
255 | */ | 273 | */ |
@@ -334,6 +352,11 @@ bfa_fcs_fabric_sm_linkdown(struct bfa_fcs_fabric_s *fabric, | |||
334 | bfa_fcs_fabric_delete(fabric); | 352 | bfa_fcs_fabric_delete(fabric); |
335 | break; | 353 | break; |
336 | 354 | ||
355 | case BFA_FCS_FABRIC_SM_STOP: | ||
356 | bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_cleanup); | ||
357 | bfa_fcs_fabric_stop(fabric); | ||
358 | break; | ||
359 | |||
337 | default: | 360 | default: |
338 | bfa_sm_fault(fabric->fcs, event); | 361 | bfa_sm_fault(fabric->fcs, event); |
339 | } | 362 | } |
@@ -585,6 +608,11 @@ bfa_fcs_fabric_sm_online(struct bfa_fcs_fabric_s *fabric, | |||
585 | bfa_fcs_fabric_delete(fabric); | 608 | bfa_fcs_fabric_delete(fabric); |
586 | break; | 609 | break; |
587 | 610 | ||
611 | case BFA_FCS_FABRIC_SM_STOP: | ||
612 | bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_stopping); | ||
613 | bfa_fcs_fabric_stop(fabric); | ||
614 | break; | ||
615 | |||
588 | case BFA_FCS_FABRIC_SM_AUTH_FAILED: | 616 | case BFA_FCS_FABRIC_SM_AUTH_FAILED: |
589 | bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_auth_failed); | 617 | bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_auth_failed); |
590 | bfa_sm_send_event(fabric->lps, BFA_LPS_SM_OFFLINE); | 618 | bfa_sm_send_event(fabric->lps, BFA_LPS_SM_OFFLINE); |
@@ -682,7 +710,62 @@ bfa_fcs_fabric_sm_deleting(struct bfa_fcs_fabric_s *fabric, | |||
682 | } | 710 | } |
683 | } | 711 | } |
684 | 712 | ||
713 | /* | ||
714 | * Fabric is being stopped, awaiting vport stop completions. | ||
715 | */ | ||
716 | static void | ||
717 | bfa_fcs_fabric_sm_stopping(struct bfa_fcs_fabric_s *fabric, | ||
718 | enum bfa_fcs_fabric_event event) | ||
719 | { | ||
720 | bfa_trc(fabric->fcs, fabric->bport.port_cfg.pwwn); | ||
721 | bfa_trc(fabric->fcs, event); | ||
722 | |||
723 | switch (event) { | ||
724 | case BFA_FCS_FABRIC_SM_STOPCOMP: | ||
725 | bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_cleanup); | ||
726 | bfa_sm_send_event(fabric->lps, BFA_LPS_SM_LOGOUT); | ||
727 | break; | ||
728 | |||
729 | case BFA_FCS_FABRIC_SM_LINK_UP: | ||
730 | break; | ||
731 | |||
732 | case BFA_FCS_FABRIC_SM_LINK_DOWN: | ||
733 | bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_cleanup); | ||
734 | break; | ||
735 | |||
736 | default: | ||
737 | bfa_sm_fault(fabric->fcs, event); | ||
738 | } | ||
739 | } | ||
740 | |||
741 | /* | ||
742 | * Fabric is being stopped, cleanup without FLOGO | ||
743 | */ | ||
744 | static void | ||
745 | bfa_fcs_fabric_sm_cleanup(struct bfa_fcs_fabric_s *fabric, | ||
746 | enum bfa_fcs_fabric_event event) | ||
747 | { | ||
748 | bfa_trc(fabric->fcs, fabric->bport.port_cfg.pwwn); | ||
749 | bfa_trc(fabric->fcs, event); | ||
750 | |||
751 | switch (event) { | ||
752 | case BFA_FCS_FABRIC_SM_STOPCOMP: | ||
753 | case BFA_FCS_FABRIC_SM_LOGOCOMP: | ||
754 | bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_created); | ||
755 | bfa_wc_down(&(fabric->fcs)->wc); | ||
756 | break; | ||
757 | |||
758 | case BFA_FCS_FABRIC_SM_LINK_DOWN: | ||
759 | /* | ||
760 | * Ignore - can get this event if we get notified about IOC down | ||
761 | * before the fabric completion callbk is done. | ||
762 | */ | ||
763 | break; | ||
685 | 764 | ||
765 | default: | ||
766 | bfa_sm_fault(fabric->fcs, event); | ||
767 | } | ||
768 | } | ||
686 | 769 | ||
687 | /* | 770 | /* |
688 | * fcs_fabric_private fabric private functions | 771 | * fcs_fabric_private fabric private functions |
@@ -919,6 +1002,28 @@ bfa_fcs_fabric_delay(void *cbarg) | |||
919 | } | 1002 | } |
920 | 1003 | ||
921 | /* | 1004 | /* |
1005 | * Stop all vports and wait for vport stop completions. | ||
1006 | */ | ||
1007 | static void | ||
1008 | bfa_fcs_fabric_stop(struct bfa_fcs_fabric_s *fabric) | ||
1009 | { | ||
1010 | struct bfa_fcs_vport_s *vport; | ||
1011 | struct list_head *qe, *qen; | ||
1012 | |||
1013 | bfa_wc_init(&fabric->stop_wc, bfa_fcs_fabric_stop_comp, fabric); | ||
1014 | |||
1015 | list_for_each_safe(qe, qen, &fabric->vport_q) { | ||
1016 | vport = (struct bfa_fcs_vport_s *) qe; | ||
1017 | bfa_wc_up(&fabric->stop_wc); | ||
1018 | bfa_fcs_vport_fcs_stop(vport); | ||
1019 | } | ||
1020 | |||
1021 | bfa_wc_up(&fabric->stop_wc); | ||
1022 | bfa_fcs_lport_stop(&fabric->bport); | ||
1023 | bfa_wc_wait(&fabric->stop_wc); | ||
1024 | } | ||
1025 | |||
1026 | /* | ||
922 | * Computes operating BB_SCN value | 1027 | * Computes operating BB_SCN value |
923 | */ | 1028 | */ |
924 | static u8 | 1029 | static u8 |
@@ -978,6 +1083,14 @@ bfa_fcs_fabric_delete_comp(void *cbarg) | |||
978 | bfa_sm_send_event(fabric, BFA_FCS_FABRIC_SM_DELCOMP); | 1083 | bfa_sm_send_event(fabric, BFA_FCS_FABRIC_SM_DELCOMP); |
979 | } | 1084 | } |
980 | 1085 | ||
1086 | static void | ||
1087 | bfa_fcs_fabric_stop_comp(void *cbarg) | ||
1088 | { | ||
1089 | struct bfa_fcs_fabric_s *fabric = cbarg; | ||
1090 | |||
1091 | bfa_sm_send_event(fabric, BFA_FCS_FABRIC_SM_STOPCOMP); | ||
1092 | } | ||
1093 | |||
981 | /* | 1094 | /* |
982 | * fcs_fabric_public fabric public functions | 1095 | * fcs_fabric_public fabric public functions |
983 | */ | 1096 | */ |
@@ -1039,6 +1152,19 @@ bfa_fcs_fabric_modexit(struct bfa_fcs_s *fcs) | |||
1039 | } | 1152 | } |
1040 | 1153 | ||
1041 | /* | 1154 | /* |
1155 | * Fabric module stop -- stop FCS actions | ||
1156 | */ | ||
1157 | void | ||
1158 | bfa_fcs_fabric_modstop(struct bfa_fcs_s *fcs) | ||
1159 | { | ||
1160 | struct bfa_fcs_fabric_s *fabric; | ||
1161 | |||
1162 | bfa_trc(fcs, 0); | ||
1163 | fabric = &fcs->fabric; | ||
1164 | bfa_sm_send_event(fabric, BFA_FCS_FABRIC_SM_STOP); | ||
1165 | } | ||
1166 | |||
1167 | /* | ||
1042 | * Fabric module start -- kick starts FCS actions | 1168 | * Fabric module start -- kick starts FCS actions |
1043 | */ | 1169 | */ |
1044 | void | 1170 | void |
@@ -1387,6 +1513,13 @@ bfa_fcs_fabric_set_fabric_name(struct bfa_fcs_fabric_s *fabric, | |||
1387 | } | 1513 | } |
1388 | } | 1514 | } |
1389 | 1515 | ||
1516 | void | ||
1517 | bfa_cb_lps_flogo_comp(void *bfad, void *uarg) | ||
1518 | { | ||
1519 | struct bfa_fcs_fabric_s *fabric = uarg; | ||
1520 | bfa_sm_send_event(fabric, BFA_FCS_FABRIC_SM_LOGOCOMP); | ||
1521 | } | ||
1522 | |||
1390 | /* | 1523 | /* |
1391 | * Returns FCS vf structure for a given vf_id. | 1524 | * Returns FCS vf structure for a given vf_id. |
1392 | * | 1525 | * |