aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/bfa/bfa_fcs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/bfa/bfa_fcs.c')
-rw-r--r--drivers/scsi/bfa/bfa_fcs.c62
1 files changed, 6 insertions, 56 deletions
diff --git a/drivers/scsi/bfa/bfa_fcs.c b/drivers/scsi/bfa/bfa_fcs.c
index d428808fb37e..a3ab5cce4208 100644
--- a/drivers/scsi/bfa/bfa_fcs.c
+++ b/drivers/scsi/bfa/bfa_fcs.c
@@ -240,9 +240,6 @@ static void bfa_fcs_fabric_flogiacc_comp(void *fcsarg,
240 u32 rsp_len, 240 u32 rsp_len,
241 u32 resid_len, 241 u32 resid_len,
242 struct fchs_s *rspfchs); 242 struct fchs_s *rspfchs);
243static u8 bfa_fcs_fabric_oper_bbscn(struct bfa_fcs_fabric_s *fabric);
244static bfa_boolean_t bfa_fcs_fabric_is_bbscn_enabled(
245 struct bfa_fcs_fabric_s *fabric);
246 243
247static void bfa_fcs_fabric_sm_uninit(struct bfa_fcs_fabric_s *fabric, 244static void bfa_fcs_fabric_sm_uninit(struct bfa_fcs_fabric_s *fabric,
248 enum bfa_fcs_fabric_event event); 245 enum bfa_fcs_fabric_event event);
@@ -404,8 +401,7 @@ bfa_fcs_fabric_sm_flogi(struct bfa_fcs_fabric_s *fabric,
404 case BFA_FCS_FABRIC_SM_CONT_OP: 401 case BFA_FCS_FABRIC_SM_CONT_OP:
405 402
406 bfa_fcport_set_tx_bbcredit(fabric->fcs->bfa, 403 bfa_fcport_set_tx_bbcredit(fabric->fcs->bfa,
407 fabric->bb_credit, 404 fabric->bb_credit);
408 bfa_fcs_fabric_oper_bbscn(fabric));
409 fabric->fab_type = BFA_FCS_FABRIC_SWITCHED; 405 fabric->fab_type = BFA_FCS_FABRIC_SWITCHED;
410 406
411 if (fabric->auth_reqd && fabric->is_auth) { 407 if (fabric->auth_reqd && fabric->is_auth) {
@@ -433,8 +429,7 @@ bfa_fcs_fabric_sm_flogi(struct bfa_fcs_fabric_s *fabric,
433 case BFA_FCS_FABRIC_SM_NO_FABRIC: 429 case BFA_FCS_FABRIC_SM_NO_FABRIC:
434 fabric->fab_type = BFA_FCS_FABRIC_N2N; 430 fabric->fab_type = BFA_FCS_FABRIC_N2N;
435 bfa_fcport_set_tx_bbcredit(fabric->fcs->bfa, 431 bfa_fcport_set_tx_bbcredit(fabric->fcs->bfa,
436 fabric->bb_credit, 432 fabric->bb_credit);
437 bfa_fcs_fabric_oper_bbscn(fabric));
438 bfa_fcs_fabric_notify_online(fabric); 433 bfa_fcs_fabric_notify_online(fabric);
439 bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_nofabric); 434 bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_nofabric);
440 break; 435 break;
@@ -602,8 +597,7 @@ bfa_fcs_fabric_sm_nofabric(struct bfa_fcs_fabric_s *fabric,
602 case BFA_FCS_FABRIC_SM_NO_FABRIC: 597 case BFA_FCS_FABRIC_SM_NO_FABRIC:
603 bfa_trc(fabric->fcs, fabric->bb_credit); 598 bfa_trc(fabric->fcs, fabric->bb_credit);
604 bfa_fcport_set_tx_bbcredit(fabric->fcs->bfa, 599 bfa_fcport_set_tx_bbcredit(fabric->fcs->bfa,
605 fabric->bb_credit, 600 fabric->bb_credit);
606 bfa_fcs_fabric_oper_bbscn(fabric));
607 break; 601 break;
608 602
609 case BFA_FCS_FABRIC_SM_RETRY_OP: 603 case BFA_FCS_FABRIC_SM_RETRY_OP:
@@ -965,10 +959,6 @@ bfa_cb_lps_flogi_comp(void *bfad, void *uarg, bfa_status_t status)
965 959
966 case BFA_STATUS_FABRIC_RJT: 960 case BFA_STATUS_FABRIC_RJT:
967 fabric->stats.flogi_rejects++; 961 fabric->stats.flogi_rejects++;
968 if (fabric->lps->lsrjt_rsn == FC_LS_RJT_RSN_LOGICAL_ERROR &&
969 fabric->lps->lsrjt_expl == FC_LS_RJT_EXP_NO_ADDL_INFO)
970 fabric->fcs->bbscn_flogi_rjt = BFA_TRUE;
971
972 bfa_sm_send_event(fabric, BFA_FCS_FABRIC_SM_RETRY_OP); 962 bfa_sm_send_event(fabric, BFA_FCS_FABRIC_SM_RETRY_OP);
973 return; 963 return;
974 964
@@ -1014,14 +1004,11 @@ bfa_fcs_fabric_login(struct bfa_fcs_fabric_s *fabric)
1014{ 1004{
1015 struct bfa_s *bfa = fabric->fcs->bfa; 1005 struct bfa_s *bfa = fabric->fcs->bfa;
1016 struct bfa_lport_cfg_s *pcfg = &fabric->bport.port_cfg; 1006 struct bfa_lport_cfg_s *pcfg = &fabric->bport.port_cfg;
1017 u8 alpa = 0, bb_scn = 0; 1007 u8 alpa = 0;
1018 1008
1019 if (bfa_fcs_fabric_is_bbscn_enabled(fabric) &&
1020 (!fabric->fcs->bbscn_flogi_rjt))
1021 bb_scn = BFA_FCS_PORT_DEF_BB_SCN;
1022 1009
1023 bfa_lps_flogi(fabric->lps, fabric, alpa, bfa_fcport_get_maxfrsize(bfa), 1010 bfa_lps_flogi(fabric->lps, fabric, alpa, bfa_fcport_get_maxfrsize(bfa),
1024 pcfg->pwwn, pcfg->nwwn, fabric->auth_reqd, bb_scn); 1011 pcfg->pwwn, pcfg->nwwn, fabric->auth_reqd);
1025 1012
1026 fabric->stats.flogi_sent++; 1013 fabric->stats.flogi_sent++;
1027} 1014}
@@ -1102,40 +1089,6 @@ bfa_fcs_fabric_stop(struct bfa_fcs_fabric_s *fabric)
1102} 1089}
1103 1090
1104/* 1091/*
1105 * Computes operating BB_SCN value
1106 */
1107static u8
1108bfa_fcs_fabric_oper_bbscn(struct bfa_fcs_fabric_s *fabric)
1109{
1110 u8 pr_bbscn = fabric->lps->pr_bbscn;
1111 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(fabric->fcs->bfa);
1112
1113 if (!(fcport->cfg.bb_scn_state && pr_bbscn))
1114 return 0;
1115
1116 /* return max of local/remote bb_scn values */
1117 return ((pr_bbscn > BFA_FCS_PORT_DEF_BB_SCN) ?
1118 pr_bbscn : BFA_FCS_PORT_DEF_BB_SCN);
1119}
1120
1121/*
1122 * Check if BB_SCN can be enabled.
1123 */
1124static bfa_boolean_t
1125bfa_fcs_fabric_is_bbscn_enabled(struct bfa_fcs_fabric_s *fabric)
1126{
1127 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(fabric->fcs->bfa);
1128
1129 if (bfa_ioc_get_fcmode(&fabric->fcs->bfa->ioc) &&
1130 fcport->cfg.bb_scn_state &&
1131 !bfa_fcport_is_qos_enabled(fabric->fcs->bfa) &&
1132 !bfa_fcport_is_trunk_enabled(fabric->fcs->bfa))
1133 return BFA_TRUE;
1134 else
1135 return BFA_FALSE;
1136}
1137
1138/*
1139 * Delete all vports and wait for vport delete completions. 1092 * Delete all vports and wait for vport delete completions.
1140 */ 1093 */
1141static void 1094static void
@@ -1273,7 +1226,6 @@ void
1273bfa_fcs_fabric_link_down(struct bfa_fcs_fabric_s *fabric) 1226bfa_fcs_fabric_link_down(struct bfa_fcs_fabric_s *fabric)
1274{ 1227{
1275 bfa_trc(fabric->fcs, fabric->bport.port_cfg.pwwn); 1228 bfa_trc(fabric->fcs, fabric->bport.port_cfg.pwwn);
1276 fabric->fcs->bbscn_flogi_rjt = BFA_FALSE;
1277 bfa_sm_send_event(fabric, BFA_FCS_FABRIC_SM_LINK_DOWN); 1229 bfa_sm_send_event(fabric, BFA_FCS_FABRIC_SM_LINK_DOWN);
1278} 1230}
1279 1231
@@ -1480,7 +1432,6 @@ bfa_fcs_fabric_process_flogi(struct bfa_fcs_fabric_s *fabric,
1480 } 1432 }
1481 1433
1482 fabric->bb_credit = be16_to_cpu(flogi->csp.bbcred); 1434 fabric->bb_credit = be16_to_cpu(flogi->csp.bbcred);
1483 fabric->lps->pr_bbscn = (be16_to_cpu(flogi->csp.rxsz) >> 12);
1484 bport->port_topo.pn2n.rem_port_wwn = flogi->port_name; 1435 bport->port_topo.pn2n.rem_port_wwn = flogi->port_name;
1485 bport->port_topo.pn2n.reply_oxid = fchs->ox_id; 1436 bport->port_topo.pn2n.reply_oxid = fchs->ox_id;
1486 1437
@@ -1513,8 +1464,7 @@ bfa_fcs_fabric_send_flogi_acc(struct bfa_fcs_fabric_s *fabric)
1513 n2n_port->reply_oxid, pcfg->pwwn, 1464 n2n_port->reply_oxid, pcfg->pwwn,
1514 pcfg->nwwn, 1465 pcfg->nwwn,
1515 bfa_fcport_get_maxfrsize(bfa), 1466 bfa_fcport_get_maxfrsize(bfa),
1516 bfa_fcport_get_rx_bbcredit(bfa), 1467 bfa_fcport_get_rx_bbcredit(bfa), 0);
1517 bfa_fcs_fabric_oper_bbscn(fabric));
1518 1468
1519 bfa_fcxp_send(fcxp, NULL, fabric->vf_id, fabric->lps->bfa_tag, 1469 bfa_fcxp_send(fcxp, NULL, fabric->vf_id, fabric->lps->bfa_tag,
1520 BFA_FALSE, FC_CLASS_3, 1470 BFA_FALSE, FC_CLASS_3,