Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[SCSI] bfa: Support for FC BB credit recovery

This patch includes changes to 1) Enable/disable fc credit recovery on
Brocade FC adapter port operating at max supported speed. 2) Get credit
recovery status and stats related to credit loss and recovered credits

Signed-off-by: Vijaya Mohan Guvva <vmohan@brocade.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>

authored by

Vijaya Mohan Guvva and committed by
James Bottomley
bbe37a67 32d3d793

+202 -104
+10
drivers/scsi/bfa/bfa_defs.h
··· 185 185 BFA_STATUS_FAA_DISABLED = 198, /* FAA is already disabled */ 186 186 BFA_STATUS_FAA_ACQUIRED = 199, /* FAA is already acquired */ 187 187 BFA_STATUS_FAA_ACQ_ADDR = 200, /* Acquiring addr */ 188 + BFA_STATUS_BBCR_FC_ONLY = 201, /*!< BBCredit Recovery is supported for * 189 + * FC mode only */ 188 190 BFA_STATUS_ERROR_TRUNK_ENABLED = 203, /* Trunk enabled on adapter */ 189 191 BFA_STATUS_MAX_ENTRY_REACHED = 212, /* MAX entry reached */ 190 192 BFA_STATUS_TOPOLOGY_LOOP = 230, /* Topology is set to Loop */ ··· 200 198 BFA_STATUS_CMD_NOTSUPP_MEZZ = 239, /* Cmd not supported for MEZZ card */ 201 199 BFA_STATUS_FRU_NOT_PRESENT = 240, /* fru module not present */ 202 200 BFA_STATUS_DPORT_ERR = 245, /* D-port mode is enabled */ 201 + BFA_STATUS_ERR_BBCR_SPEED_UNSUPPORT = 258, /*!< BB credit recovery is 202 + * supported at max port speed alone */ 203 + BFA_STATUS_ERROR_BBCR_ENABLED = 259, /*!< BB credit recovery 204 + * is enabled */ 205 + BFA_STATUS_INVALID_BBSCN = 260, /*!< Invalid BBSCN value. 206 + * Valid range is [1-15] */ 207 + BFA_STATUS_BBCR_CFG_NO_CHANGE = 265, /*!< BBCR is operational. 208 + * Disable BBCR and try this operation again. */ 203 209 BFA_STATUS_MAX_VAL /* Unknown error code */ 204 210 }; 205 211 #define bfa_status_t enum bfa_status
+40 -9
drivers/scsi/bfa/bfa_defs_svc.h
··· 257 257 u32 nos_tx; /* No. of times NOS tx started */ 258 258 u32 hwsm_lrr_rx; /* No. of times LRR rx-ed by HWSM */ 259 259 u32 hwsm_lr_rx; /* No. of times LR rx-ed by HWSM */ 260 - u32 bbsc_lr; /* LKSM LR tx for credit recovery */ 261 - u32 rsvd; 262 260 }; 263 261 264 262 struct bfa_fw_port_snsm_stats_s { ··· 407 409 u32 rsvd; /* padding for 64 bit alignment */ 408 410 }; 409 411 410 - struct bfa_fw_advsm_stats_s { 412 + struct bfa_fw_aport_stats_s { 411 413 u32 flogi_sent; /* Flogi sent */ 412 414 u32 flogi_acc_recvd; /* Flogi Acc received */ 413 415 u32 flogi_rjt_recvd; /* Flogi rejects received */ ··· 417 419 u32 elp_accepted; /* ELP Accepted */ 418 420 u32 elp_rejected; /* ELP rejected */ 419 421 u32 elp_dropped; /* ELP dropped */ 422 + 423 + u32 bbcr_lr_count; /*!< BBCR Link Resets */ 424 + u32 frame_lost_intrs; /*!< BBCR Frame loss intrs */ 425 + u32 rrdy_lost_intrs; /*!< BBCR Rrdy loss intrs */ 426 + 427 + u32 rsvd; 420 428 }; 421 429 422 430 /* ··· 493 489 struct bfa_fw_fcxchg_stats_s fcxchg_stats; 494 490 struct bfa_fw_lps_stats_s lps_stats; 495 491 struct bfa_fw_trunk_stats_s trunk_stats; 496 - struct bfa_fw_advsm_stats_s advsm_stats; 492 + struct bfa_fw_aport_stats_s aport_stats; 497 493 struct bfa_fw_mac_mod_stats_s macmod_stats; 498 494 struct bfa_fw_ct_mod_stats_s ctmod_stats; 499 495 struct bfa_fw_eth_sndrcv_stats_s ethsndrcv_stats; ··· 547 543 u32 total_bb_cr; /* Total BB Credits */ 548 544 struct bfa_qos_bw_s qos_bw; /* QOS bw cfg */ 549 545 struct bfa_qos_bw_s qos_bw_op; /* QOS bw operational */ 546 + }; 547 + 548 + enum bfa_bbcr_state { 549 + BFA_BBCR_DISABLED, /*!< BBCR is disable */ 550 + BFA_BBCR_ONLINE, /*!< BBCR is online */ 551 + BFA_BBCR_OFFLINE, /*!< BBCR is offline */ 552 + }; 553 + 554 + enum bfa_bbcr_err_reason { 555 + BFA_BBCR_ERR_REASON_NONE, /*!< Unknown */ 556 + BFA_BBCR_ERR_REASON_SPEED_UNSUP, /*!< Port speed < max sup_speed */ 557 + BFA_BBCR_ERR_REASON_PEER_UNSUP, /*!< BBCR is disable on peer port */ 558 + BFA_BBCR_ERR_REASON_NON_BRCD_SW, /*!< Connected to non BRCD switch */ 559 + BFA_BBCR_ERR_REASON_FLOGI_RJT, /*!< Login rejected by the switch */ 560 + }; 561 + 562 + struct bfa_bbcr_attr_s { 563 + u8 state; 564 + u8 peer_bb_scn; 565 + u8 reason; 566 + u8 rsvd; 550 567 }; 551 568 552 569 /* ··· 917 892 u16 rsvd; 918 893 }; 919 894 895 + #define BFA_BB_SCN_DEF 3 896 + #define BFA_BB_SCN_MAX 0x0F 897 + 920 898 /* 921 899 * Physical port configuration 922 900 */ ··· 935 907 u8 tx_bbcredit; /* transmit buffer credits */ 936 908 u8 ratelimit; /* ratelimit enabled or not */ 937 909 u8 trl_def_speed; /* ratelimit default speed */ 938 - u8 bb_scn; /* BB_SCN value from FLOGI Exchg */ 939 - u8 bb_scn_state; /* Config state of BB_SCN */ 910 + u8 bb_cr_enabled; /*!< Config state of BB_SCN */ 911 + u8 bb_scn; /*!< BB_SCN value for FLOGI Exchg */ 940 912 u8 faa_state; /* FAA enabled/disabled */ 941 913 u8 rsvd1; 942 914 u16 path_tov; /* device path timeout */ ··· 1080 1052 struct bfa_qos_attr_s qos_attr; /* QoS Attributes */ 1081 1053 union { 1082 1054 struct bfa_fcport_loop_info_s loop_info; 1055 + struct bfa_bbcr_attr_s bbcr_attr; 1083 1056 union { 1084 1057 struct bfa_qos_vc_attr_s qos_vc_attr; 1085 1058 /* VC info from ELP */ ··· 1244 1215 u64 bad_os_count; /* Invalid ordered sets */ 1245 1216 u64 err_enc_out; /* Encoding err nonframe_8b10b */ 1246 1217 u64 err_enc; /* Encoding err frame_8b10b */ 1247 - u64 bbsc_frames_lost; /* Credit Recovery-Frames Lost */ 1248 - u64 bbsc_credits_lost; /* Credit Recovery-Credits Lost */ 1249 - u64 bbsc_link_resets; /* Credit Recovery-Link Resets */ 1218 + u64 bbcr_frames_lost; /*!< BBCR Frames Lost */ 1219 + u64 bbcr_rrdys_lost; /*!< BBCR RRDYs Lost */ 1220 + u64 bbcr_link_resets; /*!< BBCR Link Resets */ 1221 + u64 bbcr_frame_lost_intrs; /*!< BBCR Frame loss intrs */ 1222 + u64 bbcr_rrdy_lost_intrs; /*!< BBCR Rrdy loss intrs */ 1250 1223 u64 loop_timeouts; /* Loop timeouts */ 1251 1224 }; 1252 1225
+6 -56
drivers/scsi/bfa/bfa_fcs.c
··· 240 240 u32 rsp_len, 241 241 u32 resid_len, 242 242 struct fchs_s *rspfchs); 243 - static u8 bfa_fcs_fabric_oper_bbscn(struct bfa_fcs_fabric_s *fabric); 244 - static bfa_boolean_t bfa_fcs_fabric_is_bbscn_enabled( 245 - struct bfa_fcs_fabric_s *fabric); 246 243 247 244 static void bfa_fcs_fabric_sm_uninit(struct bfa_fcs_fabric_s *fabric, 248 245 enum bfa_fcs_fabric_event event); ··· 401 404 case BFA_FCS_FABRIC_SM_CONT_OP: 402 405 403 406 bfa_fcport_set_tx_bbcredit(fabric->fcs->bfa, 404 - fabric->bb_credit, 405 - bfa_fcs_fabric_oper_bbscn(fabric)); 407 + fabric->bb_credit); 406 408 fabric->fab_type = BFA_FCS_FABRIC_SWITCHED; 407 409 408 410 if (fabric->auth_reqd && fabric->is_auth) { ··· 429 433 case BFA_FCS_FABRIC_SM_NO_FABRIC: 430 434 fabric->fab_type = BFA_FCS_FABRIC_N2N; 431 435 bfa_fcport_set_tx_bbcredit(fabric->fcs->bfa, 432 - fabric->bb_credit, 433 - bfa_fcs_fabric_oper_bbscn(fabric)); 436 + fabric->bb_credit); 434 437 bfa_fcs_fabric_notify_online(fabric); 435 438 bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_nofabric); 436 439 break; ··· 597 602 case BFA_FCS_FABRIC_SM_NO_FABRIC: 598 603 bfa_trc(fabric->fcs, fabric->bb_credit); 599 604 bfa_fcport_set_tx_bbcredit(fabric->fcs->bfa, 600 - fabric->bb_credit, 601 - bfa_fcs_fabric_oper_bbscn(fabric)); 605 + fabric->bb_credit); 602 606 break; 603 607 604 608 case BFA_FCS_FABRIC_SM_RETRY_OP: ··· 959 965 960 966 case BFA_STATUS_FABRIC_RJT: 961 967 fabric->stats.flogi_rejects++; 962 - if (fabric->lps->lsrjt_rsn == FC_LS_RJT_RSN_LOGICAL_ERROR && 963 - fabric->lps->lsrjt_expl == FC_LS_RJT_EXP_NO_ADDL_INFO) 964 - fabric->fcs->bbscn_flogi_rjt = BFA_TRUE; 965 - 966 968 bfa_sm_send_event(fabric, BFA_FCS_FABRIC_SM_RETRY_OP); 967 969 return; 968 970 ··· 1004 1014 { 1005 1015 struct bfa_s *bfa = fabric->fcs->bfa; 1006 1016 struct bfa_lport_cfg_s *pcfg = &fabric->bport.port_cfg; 1007 - u8 alpa = 0, bb_scn = 0; 1017 + u8 alpa = 0; 1008 1018 1009 - if (bfa_fcs_fabric_is_bbscn_enabled(fabric) && 1010 - (!fabric->fcs->bbscn_flogi_rjt)) 1011 - bb_scn = BFA_FCS_PORT_DEF_BB_SCN; 1012 1019 1013 1020 bfa_lps_flogi(fabric->lps, fabric, alpa, bfa_fcport_get_maxfrsize(bfa), 1014 - pcfg->pwwn, pcfg->nwwn, fabric->auth_reqd, bb_scn); 1021 + pcfg->pwwn, pcfg->nwwn, fabric->auth_reqd); 1015 1022 1016 1023 fabric->stats.flogi_sent++; 1017 1024 } ··· 1086 1099 bfa_wc_up(&fabric->stop_wc); 1087 1100 bfa_fcs_lport_stop(&fabric->bport); 1088 1101 bfa_wc_wait(&fabric->stop_wc); 1089 - } 1090 - 1091 - /* 1092 - * Computes operating BB_SCN value 1093 - */ 1094 - static u8 1095 - bfa_fcs_fabric_oper_bbscn(struct bfa_fcs_fabric_s *fabric) 1096 - { 1097 - u8 pr_bbscn = fabric->lps->pr_bbscn; 1098 - struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(fabric->fcs->bfa); 1099 - 1100 - if (!(fcport->cfg.bb_scn_state && pr_bbscn)) 1101 - return 0; 1102 - 1103 - /* return max of local/remote bb_scn values */ 1104 - return ((pr_bbscn > BFA_FCS_PORT_DEF_BB_SCN) ? 1105 - pr_bbscn : BFA_FCS_PORT_DEF_BB_SCN); 1106 - } 1107 - 1108 - /* 1109 - * Check if BB_SCN can be enabled. 1110 - */ 1111 - static bfa_boolean_t 1112 - bfa_fcs_fabric_is_bbscn_enabled(struct bfa_fcs_fabric_s *fabric) 1113 - { 1114 - struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(fabric->fcs->bfa); 1115 - 1116 - if (bfa_ioc_get_fcmode(&fabric->fcs->bfa->ioc) && 1117 - fcport->cfg.bb_scn_state && 1118 - !bfa_fcport_is_qos_enabled(fabric->fcs->bfa) && 1119 - !bfa_fcport_is_trunk_enabled(fabric->fcs->bfa)) 1120 - return BFA_TRUE; 1121 - else 1122 - return BFA_FALSE; 1123 1102 } 1124 1103 1125 1104 /* ··· 1226 1273 bfa_fcs_fabric_link_down(struct bfa_fcs_fabric_s *fabric) 1227 1274 { 1228 1275 bfa_trc(fabric->fcs, fabric->bport.port_cfg.pwwn); 1229 - fabric->fcs->bbscn_flogi_rjt = BFA_FALSE; 1230 1276 bfa_sm_send_event(fabric, BFA_FCS_FABRIC_SM_LINK_DOWN); 1231 1277 } 1232 1278 ··· 1432 1480 } 1433 1481 1434 1482 fabric->bb_credit = be16_to_cpu(flogi->csp.bbcred); 1435 - fabric->lps->pr_bbscn = (be16_to_cpu(flogi->csp.rxsz) >> 12); 1436 1483 bport->port_topo.pn2n.rem_port_wwn = flogi->port_name; 1437 1484 bport->port_topo.pn2n.reply_oxid = fchs->ox_id; 1438 1485 ··· 1464 1513 n2n_port->reply_oxid, pcfg->pwwn, 1465 1514 pcfg->nwwn, 1466 1515 bfa_fcport_get_maxfrsize(bfa), 1467 - bfa_fcport_get_rx_bbcredit(bfa), 1468 - bfa_fcs_fabric_oper_bbscn(fabric)); 1516 + bfa_fcport_get_rx_bbcredit(bfa), 0); 1469 1517 1470 1518 bfa_fcxp_send(fcxp, NULL, fabric->vf_id, fabric->lps->bfa_tag, 1471 1519 BFA_FALSE, FC_CLASS_3,
-5
drivers/scsi/bfa/bfa_fcs.h
··· 258 258 #define BFA_FCS_PORT_SYMBNAME_OSINFO_SZ 48 259 259 #define BFA_FCS_PORT_SYMBNAME_OSPATCH_SZ 16 260 260 261 - /* bb_scn value in 2^bb_scn */ 262 - #define BFA_FCS_PORT_DEF_BB_SCN 3 263 - 264 261 /* 265 262 * Get FC port ID for a logical port. 266 263 */ ··· 680 683 struct bfa_trc_mod_s *trcmod; /* tracing module */ 681 684 bfa_boolean_t vf_enabled; /* VF mode is enabled */ 682 685 bfa_boolean_t fdmi_enabled; /* FDMI is enabled */ 683 - bfa_boolean_t bbscn_enabled; /* Driver Config Parameter */ 684 - bfa_boolean_t bbscn_flogi_rjt;/* FLOGI reject due to BB_SCN */ 685 686 bfa_boolean_t min_cfg; /* min cfg enabled/disabled */ 686 687 u16 port_vfid; /* port default VF ID */ 687 688 struct bfa_fcs_driver_info_s driver_info;
+1 -1
drivers/scsi/bfa/bfa_fcs_rport.c
··· 2577 2577 2578 2578 port->fabric->bb_credit = be16_to_cpu(plogi->csp.bbcred); 2579 2579 bfa_fcport_set_tx_bbcredit(port->fcs->bfa, 2580 - port->fabric->bb_credit, 0); 2580 + port->fabric->bb_credit); 2581 2581 } 2582 2582 2583 2583 }
+85 -10
drivers/scsi/bfa/bfa_svc.c
··· 1614 1614 lps->lp_mac = rsp->lp_mac; 1615 1615 lps->brcd_switch = rsp->brcd_switch; 1616 1616 lps->fcf_mac = rsp->fcf_mac; 1617 - lps->pr_bbscn = rsp->bb_scn; 1618 1617 1619 1618 break; 1620 1619 ··· 1743 1744 m->nwwn = lps->nwwn; 1744 1745 m->fdisc = lps->fdisc; 1745 1746 m->auth_en = lps->auth_en; 1746 - m->bb_scn = lps->bb_scn; 1747 1747 1748 1748 bfa_reqq_produce(lps->bfa, lps->reqq, m->mh); 1749 1749 list_del(&lps->qe); ··· 1938 1940 */ 1939 1941 void 1940 1942 bfa_lps_flogi(struct bfa_lps_s *lps, void *uarg, u8 alpa, u16 pdusz, 1941 - wwn_t pwwn, wwn_t nwwn, bfa_boolean_t auth_en, uint8_t bb_scn) 1943 + wwn_t pwwn, wwn_t nwwn, bfa_boolean_t auth_en) 1942 1944 { 1943 1945 lps->uarg = uarg; 1944 1946 lps->alpa = alpa; ··· 1947 1949 lps->nwwn = nwwn; 1948 1950 lps->fdisc = BFA_FALSE; 1949 1951 lps->auth_en = auth_en; 1950 - lps->bb_scn = bb_scn; 1951 1952 bfa_sm_send_event(lps, BFA_LPS_SM_LOGIN); 1952 1953 } 1953 1954 ··· 3155 3158 fcport->qos_attr = pevent->link_state.qos_attr; 3156 3159 fcport->qos_vc_attr = pevent->link_state.attr.vc_fcf.qos_vc_attr; 3157 3160 3161 + if (fcport->cfg.bb_cr_enabled) 3162 + fcport->bbcr_attr = pevent->link_state.attr.bbcr_attr; 3158 3163 /* 3159 3164 * update trunk state if applicable 3160 3165 */ ··· 3176 3177 { 3177 3178 fcport->speed = BFA_PORT_SPEED_UNKNOWN; 3178 3179 fcport->topology = BFA_PORT_TOPOLOGY_NONE; 3179 - fcport->bbsc_op_state = BFA_FALSE; 3180 3180 } 3181 3181 3182 3182 /* ··· 3627 3629 fcport->qos_attr.qos_bw_op = 3628 3630 i2hmsg.penable_rsp->port_cfg.qos_bw; 3629 3631 3632 + if (fcport->cfg.bb_cr_enabled) 3633 + fcport->bbcr_attr.state = BFA_BBCR_OFFLINE; 3634 + else 3635 + fcport->bbcr_attr.state = BFA_BBCR_DISABLED; 3636 + 3630 3637 bfa_sm_send_event(fcport, BFA_FCPORT_SM_FWRSP); 3631 3638 } 3632 3639 break; ··· 3642 3639 break; 3643 3640 3644 3641 case BFI_FCPORT_I2H_EVENT: 3642 + if (fcport->cfg.bb_cr_enabled) 3643 + fcport->bbcr_attr.state = BFA_BBCR_OFFLINE; 3644 + else 3645 + fcport->bbcr_attr.state = BFA_BBCR_DISABLED; 3646 + 3645 3647 if (i2hmsg.event->link_state.linkstate == BFA_PORT_LINKUP) 3646 3648 bfa_sm_send_event(fcport, BFA_FCPORT_SM_LINKUP); 3647 3649 else { ··· 3972 3964 } 3973 3965 3974 3966 void 3975 - bfa_fcport_set_tx_bbcredit(struct bfa_s *bfa, u16 tx_bbcredit, u8 bb_scn) 3967 + bfa_fcport_set_tx_bbcredit(struct bfa_s *bfa, u16 tx_bbcredit) 3976 3968 { 3977 3969 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa); 3978 3970 3979 3971 fcport->cfg.tx_bbcredit = (u8)tx_bbcredit; 3980 - fcport->cfg.bb_scn = bb_scn; 3981 - if (bb_scn) 3982 - fcport->bbsc_op_state = BFA_TRUE; 3983 3972 } 3984 3973 3985 3974 /* ··· 4026 4021 attr->pport_cfg.path_tov = bfa_fcpim_path_tov_get(bfa); 4027 4022 attr->pport_cfg.q_depth = bfa_fcpim_qdepth_get(bfa); 4028 4023 attr->port_state = bfa_sm_to_state(hal_port_sm_table, fcport->sm); 4029 - attr->bbsc_op_status = fcport->bbsc_op_state; 4030 4024 4031 4025 /* PBC Disabled State */ 4032 4026 if (bfa_fcport_is_pbcdisabled(bfa)) ··· 4219 4215 struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa); 4220 4216 4221 4217 return fcport->cfg.trunked; 4218 + } 4219 + 4220 + bfa_status_t 4221 + bfa_fcport_cfg_bbcr(struct bfa_s *bfa, bfa_boolean_t on_off, u8 bb_scn) 4222 + { 4223 + struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa); 4224 + 4225 + bfa_trc(bfa, on_off); 4226 + 4227 + if (bfa_ioc_get_type(&fcport->bfa->ioc) != BFA_IOC_TYPE_FC) 4228 + return BFA_STATUS_BBCR_FC_ONLY; 4229 + 4230 + if (bfa_mfg_is_mezz(bfa->ioc.attr->card_type) && 4231 + (bfa->ioc.attr->card_type != BFA_MFG_TYPE_CHINOOK)) 4232 + return BFA_STATUS_CMD_NOTSUPP_MEZZ; 4233 + 4234 + if (on_off) { 4235 + if (fcport->cfg.topology == BFA_PORT_TOPOLOGY_LOOP) 4236 + return BFA_STATUS_TOPOLOGY_LOOP; 4237 + 4238 + if (fcport->cfg.qos_enabled) 4239 + return BFA_STATUS_ERROR_QOS_ENABLED; 4240 + 4241 + if (fcport->cfg.trunked) 4242 + return BFA_STATUS_TRUNK_ENABLED; 4243 + 4244 + if ((fcport->cfg.speed != BFA_PORT_SPEED_AUTO) && 4245 + (fcport->cfg.speed < bfa_ioc_speed_sup(&bfa->ioc))) 4246 + return BFA_STATUS_ERR_BBCR_SPEED_UNSUPPORT; 4247 + 4248 + if (bfa_ioc_speed_sup(&bfa->ioc) < BFA_PORT_SPEED_8GBPS) 4249 + return BFA_STATUS_FEATURE_NOT_SUPPORTED; 4250 + 4251 + if (fcport->cfg.bb_cr_enabled) { 4252 + if (bb_scn != fcport->cfg.bb_scn) 4253 + return BFA_STATUS_BBCR_CFG_NO_CHANGE; 4254 + else 4255 + return BFA_STATUS_NO_CHANGE; 4256 + } 4257 + 4258 + if ((bb_scn == 0) || (bb_scn > BFA_BB_SCN_MAX)) 4259 + bb_scn = BFA_BB_SCN_DEF; 4260 + 4261 + fcport->cfg.bb_cr_enabled = on_off; 4262 + fcport->cfg.bb_scn = bb_scn; 4263 + } else { 4264 + if (!fcport->cfg.bb_cr_enabled) 4265 + return BFA_STATUS_NO_CHANGE; 4266 + 4267 + fcport->cfg.bb_cr_enabled = on_off; 4268 + fcport->cfg.bb_scn = 0; 4269 + } 4270 + 4271 + return BFA_STATUS_OK; 4272 + } 4273 + 4274 + bfa_status_t 4275 + bfa_fcport_get_bbcr_attr(struct bfa_s *bfa, 4276 + struct bfa_bbcr_attr_s *bbcr_attr) 4277 + { 4278 + struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(bfa); 4279 + 4280 + if (bfa_ioc_get_type(&fcport->bfa->ioc) != BFA_IOC_TYPE_FC) 4281 + return BFA_STATUS_BBCR_FC_ONLY; 4282 + 4283 + if (fcport->cfg.topology == BFA_PORT_TOPOLOGY_LOOP) 4284 + return BFA_STATUS_TOPOLOGY_LOOP; 4285 + 4286 + *bbcr_attr = fcport->bbcr_attr; 4287 + 4288 + return BFA_STATUS_OK; 4222 4289 } 4223 4290 4224 4291 void
+7 -5
drivers/scsi/bfa/bfa_svc.h
··· 405 405 bfa_status_t status; /* login status */ 406 406 u16 pdusz; /* max receive PDU size */ 407 407 u16 pr_bbcred; /* BB_CREDIT from peer */ 408 - u8 pr_bbscn; /* BB_SCN from peer */ 409 - u8 bb_scn; /* local BB_SCN */ 410 408 u8 lsrjt_rsn; /* LSRJT reason */ 411 409 u8 lsrjt_expl; /* LSRJT explanation */ 412 410 u8 lun_mask; /* LUN mask flag */ ··· 508 510 bfa_boolean_t diag_busy; /* diag busy status */ 509 511 bfa_boolean_t beacon; /* port beacon status */ 510 512 bfa_boolean_t link_e2e_beacon; /* link beacon status */ 511 - bfa_boolean_t bbsc_op_state; /* Cred recov Oper State */ 512 513 struct bfa_fcport_trunk_s trunk; 513 514 u16 fcoe_vlan; 514 515 struct bfa_mem_dma_s fcport_dma; 515 516 bfa_boolean_t stats_dma_ready; 517 + struct bfa_bbcr_attr_s bbcr_attr; 516 518 }; 517 519 518 520 #define BFA_FCPORT_MOD(__bfa) (&(__bfa)->modules.fcport) ··· 554 556 struct bfa_qos_bw_s *qos_bw); 555 557 enum bfa_port_speed bfa_fcport_get_ratelim_speed(struct bfa_s *bfa); 556 558 557 - void bfa_fcport_set_tx_bbcredit(struct bfa_s *bfa, u16 tx_bbcredit, u8 bb_scn); 559 + void bfa_fcport_set_tx_bbcredit(struct bfa_s *bfa, u16 tx_bbcredit); 558 560 bfa_boolean_t bfa_fcport_is_ratelim(struct bfa_s *bfa); 559 561 void bfa_fcport_beacon(void *dev, bfa_boolean_t beacon, 560 562 bfa_boolean_t link_e2e_beacon); ··· 569 571 void bfa_fcport_dportdisable(struct bfa_s *bfa); 570 572 bfa_status_t bfa_fcport_is_pbcdisabled(struct bfa_s *bfa); 571 573 void bfa_fcport_cfg_faa(struct bfa_s *bfa, u8 state); 574 + bfa_status_t bfa_fcport_cfg_bbcr(struct bfa_s *bfa, 575 + bfa_boolean_t on_off, u8 bb_scn); 576 + bfa_status_t bfa_fcport_get_bbcr_attr(struct bfa_s *bfa, 577 + struct bfa_bbcr_attr_s *bbcr_attr); 572 578 573 579 /* 574 580 * bfa rport API functions ··· 669 667 void bfa_lps_delete(struct bfa_lps_s *lps); 670 668 void bfa_lps_flogi(struct bfa_lps_s *lps, void *uarg, u8 alpa, 671 669 u16 pdusz, wwn_t pwwn, wwn_t nwwn, 672 - bfa_boolean_t auth_en, u8 bb_scn); 670 + bfa_boolean_t auth_en); 673 671 void bfa_lps_fdisc(struct bfa_lps_s *lps, void *uarg, u16 pdusz, 674 672 wwn_t pwwn, wwn_t nwwn); 675 673 void bfa_lps_fdisclogo(struct bfa_lps_s *lps);
+34 -13
drivers/scsi/bfa/bfad_bsg.c
··· 402 402 } 403 403 404 404 int 405 - bfad_iocmd_port_cfg_bbsc(struct bfad_s *bfad, void *cmd, unsigned int v_cmd) 405 + bfad_iocmd_port_cfg_bbcr(struct bfad_s *bfad, unsigned int cmd, void *pcmd) 406 406 { 407 - struct bfa_bsg_gen_s *iocmd = (struct bfa_bsg_gen_s *)cmd; 408 - struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(&bfad->bfa); 409 - unsigned long flags; 407 + struct bfa_bsg_bbcr_enable_s *iocmd = 408 + (struct bfa_bsg_bbcr_enable_s *)pcmd; 409 + unsigned long flags; 410 + int rc; 410 411 411 412 spin_lock_irqsave(&bfad->bfad_lock, flags); 412 - if (bfa_ioc_get_type(&bfad->bfa.ioc) == BFA_IOC_TYPE_FC) { 413 - if (v_cmd == IOCMD_PORT_BBSC_ENABLE) 414 - fcport->cfg.bb_scn_state = BFA_TRUE; 415 - else if (v_cmd == IOCMD_PORT_BBSC_DISABLE) 416 - fcport->cfg.bb_scn_state = BFA_FALSE; 413 + if (cmd == IOCMD_PORT_BBCR_ENABLE) 414 + rc = bfa_fcport_cfg_bbcr(&bfad->bfa, BFA_TRUE, iocmd->bb_scn); 415 + else if (cmd == IOCMD_PORT_BBCR_DISABLE) 416 + rc = bfa_fcport_cfg_bbcr(&bfad->bfa, BFA_FALSE, 0); 417 + else { 418 + spin_unlock_irqrestore(&bfad->bfad_lock, flags); 419 + return -EINVAL; 417 420 } 418 421 spin_unlock_irqrestore(&bfad->bfad_lock, flags); 419 422 420 - iocmd->status = BFA_STATUS_OK; 423 + iocmd->status = rc; 421 424 return 0; 422 425 } 426 + 427 + int 428 + bfad_iocmd_port_get_bbcr_attr(struct bfad_s *bfad, void *pcmd) 429 + { 430 + struct bfa_bsg_bbcr_attr_s *iocmd = (struct bfa_bsg_bbcr_attr_s *) pcmd; 431 + unsigned long flags; 432 + 433 + spin_lock_irqsave(&bfad->bfad_lock, flags); 434 + iocmd->status = 435 + bfa_fcport_get_bbcr_attr(&bfad->bfa, &iocmd->attr); 436 + spin_unlock_irqrestore(&bfad->bfad_lock, flags); 437 + 438 + return 0; 439 + } 440 + 423 441 424 442 static int 425 443 bfad_iocmd_lport_get_attr(struct bfad_s *bfad, void *cmd) ··· 2768 2750 case IOCMD_PORT_CFG_MAXFRSZ: 2769 2751 rc = bfad_iocmd_port_cfg_maxfrsize(bfad, iocmd); 2770 2752 break; 2771 - case IOCMD_PORT_BBSC_ENABLE: 2772 - case IOCMD_PORT_BBSC_DISABLE: 2773 - rc = bfad_iocmd_port_cfg_bbsc(bfad, iocmd, cmd); 2753 + case IOCMD_PORT_BBCR_ENABLE: 2754 + case IOCMD_PORT_BBCR_DISABLE: 2755 + rc = bfad_iocmd_port_cfg_bbcr(bfad, cmd, iocmd); 2756 + break; 2757 + case IOCMD_PORT_BBCR_GET_ATTR: 2758 + rc = bfad_iocmd_port_get_bbcr_attr(bfad, iocmd); 2774 2759 break; 2775 2760 case IOCMD_LPORT_GET_ATTR: 2776 2761 rc = bfad_iocmd_lport_get_attr(bfad, iocmd);
+17 -2
drivers/scsi/bfa/bfad_bsg.h
··· 46 46 IOCMD_PORT_CFG_ALPA, 47 47 IOCMD_PORT_CFG_MAXFRSZ, 48 48 IOCMD_PORT_CLR_ALPA, 49 - IOCMD_PORT_BBSC_ENABLE, 50 - IOCMD_PORT_BBSC_DISABLE, 49 + IOCMD_PORT_BBCR_ENABLE, 50 + IOCMD_PORT_BBCR_DISABLE, 51 + IOCMD_PORT_BBCR_GET_ATTR, 51 52 IOCMD_LPORT_GET_ATTR, 52 53 IOCMD_LPORT_GET_RPORTS, 53 54 IOCMD_LPORT_GET_STATS, ··· 494 493 u16 bfad_num; 495 494 u16 instance; 496 495 struct bfa_port_cfg_mode_s cfg; 496 + }; 497 + 498 + struct bfa_bsg_bbcr_enable_s { 499 + bfa_status_t status; 500 + u16 bfad_num; 501 + u8 bb_scn; 502 + u8 rsvd; 503 + }; 504 + 505 + struct bfa_bsg_bbcr_attr_s { 506 + bfa_status_t status; 507 + u16 bfad_num; 508 + u16 rsvd; 509 + struct bfa_bbcr_attr_s attr; 497 510 }; 498 511 499 512 struct bfa_bsg_faa_attr_s {
+2 -3
drivers/scsi/bfa/bfi_ms.h
··· 276 276 struct bfi_fcport_set_svc_params_req_s { 277 277 struct bfi_mhdr_s mh; /* msg header */ 278 278 __be16 tx_bbcredit; /* Tx credits */ 279 - u8 bb_scn; /* BB_SC FC credit recovery */ 280 - u8 rsvd; 279 + u8 rsvd[2]; 281 280 }; 282 281 283 282 /* ··· 445 446 mac_t fcf_mac; 446 447 u8 ext_status; 447 448 u8 brcd_switch; /* attached peer is brcd switch */ 448 - u8 bb_scn; /* atatched port's bb_scn */ 449 449 u8 bfa_tag; 450 + u8 rsvd; 450 451 }; 451 452 452 453 struct bfi_lps_logout_req_s {