diff options
Diffstat (limited to 'drivers/scsi/bfa/fabric.c')
-rw-r--r-- | drivers/scsi/bfa/fabric.c | 59 |
1 files changed, 31 insertions, 28 deletions
diff --git a/drivers/scsi/bfa/fabric.c b/drivers/scsi/bfa/fabric.c index a4b5dd449573..8166e9745ec0 100644 --- a/drivers/scsi/bfa/fabric.c +++ b/drivers/scsi/bfa/fabric.c | |||
@@ -37,7 +37,7 @@ BFA_TRC_FILE(FCS, FABRIC); | |||
37 | #define BFA_FCS_FABRIC_CLEANUP_DELAY (10000) /* Milliseconds */ | 37 | #define BFA_FCS_FABRIC_CLEANUP_DELAY (10000) /* Milliseconds */ |
38 | 38 | ||
39 | #define bfa_fcs_fabric_set_opertype(__fabric) do { \ | 39 | #define bfa_fcs_fabric_set_opertype(__fabric) do { \ |
40 | if (bfa_pport_get_topology((__fabric)->fcs->bfa) \ | 40 | if (bfa_fcport_get_topology((__fabric)->fcs->bfa) \ |
41 | == BFA_PPORT_TOPOLOGY_P2P) \ | 41 | == BFA_PPORT_TOPOLOGY_P2P) \ |
42 | (__fabric)->oper_type = BFA_PPORT_TYPE_NPORT; \ | 42 | (__fabric)->oper_type = BFA_PPORT_TYPE_NPORT; \ |
43 | else \ | 43 | else \ |
@@ -136,8 +136,7 @@ bfa_fcs_fabric_sm_uninit(struct bfa_fcs_fabric_s *fabric, | |||
136 | case BFA_FCS_FABRIC_SM_CREATE: | 136 | case BFA_FCS_FABRIC_SM_CREATE: |
137 | bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_created); | 137 | bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_created); |
138 | bfa_fcs_fabric_init(fabric); | 138 | bfa_fcs_fabric_init(fabric); |
139 | bfa_fcs_lport_init(&fabric->bport, fabric->fcs, FC_VF_ID_NULL, | 139 | bfa_fcs_lport_init(&fabric->bport, &fabric->bport.port_cfg); |
140 | &fabric->bport.port_cfg, NULL); | ||
141 | break; | 140 | break; |
142 | 141 | ||
143 | case BFA_FCS_FABRIC_SM_LINK_UP: | 142 | case BFA_FCS_FABRIC_SM_LINK_UP: |
@@ -161,7 +160,7 @@ bfa_fcs_fabric_sm_created(struct bfa_fcs_fabric_s *fabric, | |||
161 | 160 | ||
162 | switch (event) { | 161 | switch (event) { |
163 | case BFA_FCS_FABRIC_SM_START: | 162 | case BFA_FCS_FABRIC_SM_START: |
164 | if (bfa_pport_is_linkup(fabric->fcs->bfa)) { | 163 | if (bfa_fcport_is_linkup(fabric->fcs->bfa)) { |
165 | bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_flogi); | 164 | bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_flogi); |
166 | bfa_fcs_fabric_login(fabric); | 165 | bfa_fcs_fabric_login(fabric); |
167 | } else | 166 | } else |
@@ -225,7 +224,7 @@ bfa_fcs_fabric_sm_flogi(struct bfa_fcs_fabric_s *fabric, | |||
225 | switch (event) { | 224 | switch (event) { |
226 | case BFA_FCS_FABRIC_SM_CONT_OP: | 225 | case BFA_FCS_FABRIC_SM_CONT_OP: |
227 | 226 | ||
228 | bfa_pport_set_tx_bbcredit(fabric->fcs->bfa, fabric->bb_credit); | 227 | bfa_fcport_set_tx_bbcredit(fabric->fcs->bfa, fabric->bb_credit); |
229 | fabric->fab_type = BFA_FCS_FABRIC_SWITCHED; | 228 | fabric->fab_type = BFA_FCS_FABRIC_SWITCHED; |
230 | 229 | ||
231 | if (fabric->auth_reqd && fabric->is_auth) { | 230 | if (fabric->auth_reqd && fabric->is_auth) { |
@@ -252,7 +251,7 @@ bfa_fcs_fabric_sm_flogi(struct bfa_fcs_fabric_s *fabric, | |||
252 | 251 | ||
253 | case BFA_FCS_FABRIC_SM_NO_FABRIC: | 252 | case BFA_FCS_FABRIC_SM_NO_FABRIC: |
254 | fabric->fab_type = BFA_FCS_FABRIC_N2N; | 253 | fabric->fab_type = BFA_FCS_FABRIC_N2N; |
255 | bfa_pport_set_tx_bbcredit(fabric->fcs->bfa, fabric->bb_credit); | 254 | bfa_fcport_set_tx_bbcredit(fabric->fcs->bfa, fabric->bb_credit); |
256 | bfa_fcs_fabric_notify_online(fabric); | 255 | bfa_fcs_fabric_notify_online(fabric); |
257 | bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_nofabric); | 256 | bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_nofabric); |
258 | break; | 257 | break; |
@@ -419,7 +418,7 @@ bfa_fcs_fabric_sm_nofabric(struct bfa_fcs_fabric_s *fabric, | |||
419 | 418 | ||
420 | case BFA_FCS_FABRIC_SM_NO_FABRIC: | 419 | case BFA_FCS_FABRIC_SM_NO_FABRIC: |
421 | bfa_trc(fabric->fcs, fabric->bb_credit); | 420 | bfa_trc(fabric->fcs, fabric->bb_credit); |
422 | bfa_pport_set_tx_bbcredit(fabric->fcs->bfa, fabric->bb_credit); | 421 | bfa_fcport_set_tx_bbcredit(fabric->fcs->bfa, fabric->bb_credit); |
423 | break; | 422 | break; |
424 | 423 | ||
425 | default: | 424 | default: |
@@ -563,17 +562,15 @@ void | |||
563 | bfa_fcs_fabric_psymb_init(struct bfa_fcs_fabric_s *fabric) | 562 | bfa_fcs_fabric_psymb_init(struct bfa_fcs_fabric_s *fabric) |
564 | { | 563 | { |
565 | struct bfa_port_cfg_s *port_cfg = &fabric->bport.port_cfg; | 564 | struct bfa_port_cfg_s *port_cfg = &fabric->bport.port_cfg; |
566 | struct bfa_adapter_attr_s adapter_attr; | 565 | char model[BFA_ADAPTER_MODEL_NAME_LEN] = {0}; |
567 | struct bfa_fcs_driver_info_s *driver_info = &fabric->fcs->driver_info; | 566 | struct bfa_fcs_driver_info_s *driver_info = &fabric->fcs->driver_info; |
568 | 567 | ||
569 | bfa_os_memset((void *)&adapter_attr, 0, | 568 | bfa_ioc_get_adapter_model(&fabric->fcs->bfa->ioc, model); |
570 | sizeof(struct bfa_adapter_attr_s)); | ||
571 | bfa_ioc_get_adapter_attr(&fabric->fcs->bfa->ioc, &adapter_attr); | ||
572 | 569 | ||
573 | /* | 570 | /* |
574 | * Model name/number | 571 | * Model name/number |
575 | */ | 572 | */ |
576 | strncpy((char *)&port_cfg->sym_name, adapter_attr.model, | 573 | strncpy((char *)&port_cfg->sym_name, model, |
577 | BFA_FCS_PORT_SYMBNAME_MODEL_SZ); | 574 | BFA_FCS_PORT_SYMBNAME_MODEL_SZ); |
578 | strncat((char *)&port_cfg->sym_name, BFA_FCS_PORT_SYMBNAME_SEPARATOR, | 575 | strncat((char *)&port_cfg->sym_name, BFA_FCS_PORT_SYMBNAME_SEPARATOR, |
579 | sizeof(BFA_FCS_PORT_SYMBNAME_SEPARATOR)); | 576 | sizeof(BFA_FCS_PORT_SYMBNAME_SEPARATOR)); |
@@ -719,10 +716,10 @@ bfa_fcs_fabric_login(struct bfa_fcs_fabric_s *fabric) | |||
719 | struct bfa_port_cfg_s *pcfg = &fabric->bport.port_cfg; | 716 | struct bfa_port_cfg_s *pcfg = &fabric->bport.port_cfg; |
720 | u8 alpa = 0; | 717 | u8 alpa = 0; |
721 | 718 | ||
722 | if (bfa_pport_get_topology(bfa) == BFA_PPORT_TOPOLOGY_LOOP) | 719 | if (bfa_fcport_get_topology(bfa) == BFA_PPORT_TOPOLOGY_LOOP) |
723 | alpa = bfa_pport_get_myalpa(bfa); | 720 | alpa = bfa_fcport_get_myalpa(bfa); |
724 | 721 | ||
725 | bfa_lps_flogi(fabric->lps, fabric, alpa, bfa_pport_get_maxfrsize(bfa), | 722 | bfa_lps_flogi(fabric->lps, fabric, alpa, bfa_fcport_get_maxfrsize(bfa), |
726 | pcfg->pwwn, pcfg->nwwn, fabric->auth_reqd); | 723 | pcfg->pwwn, pcfg->nwwn, fabric->auth_reqd); |
727 | 724 | ||
728 | fabric->stats.flogi_sent++; | 725 | fabric->stats.flogi_sent++; |
@@ -814,10 +811,10 @@ bfa_fcs_fabric_delete_comp(void *cbarg) | |||
814 | */ | 811 | */ |
815 | 812 | ||
816 | /** | 813 | /** |
817 | * Module initialization | 814 | * Attach time initialization |
818 | */ | 815 | */ |
819 | void | 816 | void |
820 | bfa_fcs_fabric_modinit(struct bfa_fcs_s *fcs) | 817 | bfa_fcs_fabric_attach(struct bfa_fcs_s *fcs) |
821 | { | 818 | { |
822 | struct bfa_fcs_fabric_s *fabric; | 819 | struct bfa_fcs_fabric_s *fabric; |
823 | 820 | ||
@@ -841,7 +838,13 @@ bfa_fcs_fabric_modinit(struct bfa_fcs_s *fcs) | |||
841 | bfa_wc_up(&fabric->wc); /* For the base port */ | 838 | bfa_wc_up(&fabric->wc); /* For the base port */ |
842 | 839 | ||
843 | bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_uninit); | 840 | bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_uninit); |
844 | bfa_sm_send_event(fabric, BFA_FCS_FABRIC_SM_CREATE); | 841 | bfa_fcs_lport_attach(&fabric->bport, fabric->fcs, FC_VF_ID_NULL, NULL); |
842 | } | ||
843 | |||
844 | void | ||
845 | bfa_fcs_fabric_modinit(struct bfa_fcs_s *fcs) | ||
846 | { | ||
847 | bfa_sm_send_event(&fcs->fabric, BFA_FCS_FABRIC_SM_CREATE); | ||
845 | bfa_trc(fcs, 0); | 848 | bfa_trc(fcs, 0); |
846 | } | 849 | } |
847 | 850 | ||
@@ -890,6 +893,12 @@ bfa_fcs_fabric_is_loopback(struct bfa_fcs_fabric_s *fabric) | |||
890 | return bfa_sm_cmp_state(fabric, bfa_fcs_fabric_sm_loopback); | 893 | return bfa_sm_cmp_state(fabric, bfa_fcs_fabric_sm_loopback); |
891 | } | 894 | } |
892 | 895 | ||
896 | bfa_boolean_t | ||
897 | bfa_fcs_fabric_is_auth_failed(struct bfa_fcs_fabric_s *fabric) | ||
898 | { | ||
899 | return bfa_sm_cmp_state(fabric, bfa_fcs_fabric_sm_auth_failed); | ||
900 | } | ||
901 | |||
893 | enum bfa_pport_type | 902 | enum bfa_pport_type |
894 | bfa_fcs_fabric_port_type(struct bfa_fcs_fabric_s *fabric) | 903 | bfa_fcs_fabric_port_type(struct bfa_fcs_fabric_s *fabric) |
895 | { | 904 | { |
@@ -1165,8 +1174,8 @@ bfa_fcs_fabric_send_flogi_acc(struct bfa_fcs_fabric_s *fabric) | |||
1165 | reqlen = fc_flogi_acc_build(&fchs, bfa_fcxp_get_reqbuf(fcxp), | 1174 | reqlen = fc_flogi_acc_build(&fchs, bfa_fcxp_get_reqbuf(fcxp), |
1166 | bfa_os_hton3b(FC_FABRIC_PORT), | 1175 | bfa_os_hton3b(FC_FABRIC_PORT), |
1167 | n2n_port->reply_oxid, pcfg->pwwn, | 1176 | n2n_port->reply_oxid, pcfg->pwwn, |
1168 | pcfg->nwwn, bfa_pport_get_maxfrsize(bfa), | 1177 | pcfg->nwwn, bfa_fcport_get_maxfrsize(bfa), |
1169 | bfa_pport_get_rx_bbcredit(bfa)); | 1178 | bfa_fcport_get_rx_bbcredit(bfa)); |
1170 | 1179 | ||
1171 | bfa_fcxp_send(fcxp, NULL, fabric->vf_id, bfa_lps_get_tag(fabric->lps), | 1180 | bfa_fcxp_send(fcxp, NULL, fabric->vf_id, bfa_lps_get_tag(fabric->lps), |
1172 | BFA_FALSE, FC_CLASS_3, reqlen, &fchs, | 1181 | BFA_FALSE, FC_CLASS_3, reqlen, &fchs, |
@@ -1224,14 +1233,8 @@ bfa_fcs_fabric_aen_post(struct bfa_fcs_port_s *port, | |||
1224 | wwn2str(pwwn_ptr, pwwn); | 1233 | wwn2str(pwwn_ptr, pwwn); |
1225 | wwn2str(fwwn_ptr, fwwn); | 1234 | wwn2str(fwwn_ptr, fwwn); |
1226 | 1235 | ||
1227 | switch (event) { | 1236 | bfa_log(logmod, BFA_LOG_CREATE_ID(BFA_AEN_CAT_PORT, event), |
1228 | case BFA_PORT_AEN_FABRIC_NAME_CHANGE: | 1237 | pwwn_ptr, fwwn_ptr); |
1229 | bfa_log(logmod, BFA_AEN_PORT_FABRIC_NAME_CHANGE, pwwn_ptr, | ||
1230 | fwwn_ptr); | ||
1231 | break; | ||
1232 | default: | ||
1233 | break; | ||
1234 | } | ||
1235 | 1238 | ||
1236 | aen_data.port.pwwn = pwwn; | 1239 | aen_data.port.pwwn = pwwn; |
1237 | aen_data.port.fwwn = fwwn; | 1240 | aen_data.port.fwwn = fwwn; |