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.c206
1 files changed, 34 insertions, 172 deletions
diff --git a/drivers/scsi/bfa/bfa_fcs.c b/drivers/scsi/bfa/bfa_fcs.c
index 045d7e87b632..f674f9318629 100644
--- a/drivers/scsi/bfa/bfa_fcs.c
+++ b/drivers/scsi/bfa/bfa_fcs.c
@@ -19,9 +19,9 @@
19 * bfa_fcs.c BFA FCS main 19 * bfa_fcs.c BFA FCS main
20 */ 20 */
21 21
22#include "bfad_drv.h"
22#include "bfa_fcs.h" 23#include "bfa_fcs.h"
23#include "bfa_fcbuild.h" 24#include "bfa_fcbuild.h"
24#include "bfad_drv.h"
25 25
26BFA_TRC_FILE(FCS, FCS); 26BFA_TRC_FILE(FCS, FCS);
27 27
@@ -76,7 +76,7 @@ bfa_fcs_attach(struct bfa_fcs_s *fcs, struct bfa_s *bfa, struct bfad_s *bfad,
76 fcs->bfad = bfad; 76 fcs->bfad = bfad;
77 fcs->min_cfg = min_cfg; 77 fcs->min_cfg = min_cfg;
78 78
79 bfa_attach_fcs(bfa); 79 bfa->fcs = BFA_TRUE;
80 fcbuild_init(); 80 fcbuild_init();
81 81
82 for (i = 0; i < sizeof(fcs_modules) / sizeof(fcs_modules[0]); i++) { 82 for (i = 0; i < sizeof(fcs_modules) / sizeof(fcs_modules[0]); i++) {
@@ -110,14 +110,6 @@ bfa_fcs_init(struct bfa_fcs_s *fcs)
110 } 110 }
111} 111}
112 112
113/*
114 * Start FCS operations.
115 */
116void
117bfa_fcs_start(struct bfa_fcs_s *fcs)
118{
119 bfa_fcs_fabric_modstart(fcs);
120}
121 113
122/* 114/*
123 * brief 115 * brief
@@ -140,22 +132,6 @@ bfa_fcs_driver_info_init(struct bfa_fcs_s *fcs,
140 132
141/* 133/*
142 * brief 134 * brief
143 * FCS FDMI Driver Parameter Initialization
144 *
145 * param[in] fcs FCS instance
146 * param[in] fdmi_enable TRUE/FALSE
147 *
148 * return None
149 */
150void
151bfa_fcs_set_fdmi_param(struct bfa_fcs_s *fcs, bfa_boolean_t fdmi_enable)
152{
153
154 fcs->fdmi_enabled = fdmi_enable;
155
156}
157/*
158 * brief
159 * FCS instance cleanup and exit. 135 * FCS instance cleanup and exit.
160 * 136 *
161 * param[in] fcs FCS instance 137 * param[in] fcs FCS instance
@@ -184,18 +160,6 @@ bfa_fcs_exit(struct bfa_fcs_s *fcs)
184} 160}
185 161
186 162
187void
188bfa_fcs_trc_init(struct bfa_fcs_s *fcs, struct bfa_trc_mod_s *trcmod)
189{
190 fcs->trcmod = trcmod;
191}
192
193void
194bfa_fcs_modexit_comp(struct bfa_fcs_s *fcs)
195{
196 bfa_wc_down(&fcs->wc);
197}
198
199/* 163/*
200 * Fabric module implementation. 164 * Fabric module implementation.
201 */ 165 */
@@ -232,31 +196,6 @@ static void bfa_fcs_fabric_flogiacc_comp(void *fcsarg,
232 u32 rsp_len, 196 u32 rsp_len,
233 u32 resid_len, 197 u32 resid_len,
234 struct fchs_s *rspfchs); 198 struct fchs_s *rspfchs);
235/*
236 * fcs_fabric_sm fabric state machine functions
237 */
238
239/*
240 * Fabric state machine events
241 */
242enum bfa_fcs_fabric_event {
243 BFA_FCS_FABRIC_SM_CREATE = 1, /* create from driver */
244 BFA_FCS_FABRIC_SM_DELETE = 2, /* delete from driver */
245 BFA_FCS_FABRIC_SM_LINK_DOWN = 3, /* link down from port */
246 BFA_FCS_FABRIC_SM_LINK_UP = 4, /* link up from port */
247 BFA_FCS_FABRIC_SM_CONT_OP = 5, /* flogi/auth continue op */
248 BFA_FCS_FABRIC_SM_RETRY_OP = 6, /* flogi/auth retry op */
249 BFA_FCS_FABRIC_SM_NO_FABRIC = 7, /* from flogi/auth */
250 BFA_FCS_FABRIC_SM_PERF_EVFP = 8, /* from flogi/auth */
251 BFA_FCS_FABRIC_SM_ISOLATE = 9, /* from EVFP processing */
252 BFA_FCS_FABRIC_SM_NO_TAGGING = 10, /* no VFT tagging from EVFP */
253 BFA_FCS_FABRIC_SM_DELAYED = 11, /* timeout delay event */
254 BFA_FCS_FABRIC_SM_AUTH_FAILED = 12, /* auth failed */
255 BFA_FCS_FABRIC_SM_AUTH_SUCCESS = 13, /* auth successful */
256 BFA_FCS_FABRIC_SM_DELCOMP = 14, /* all vports deleted event */
257 BFA_FCS_FABRIC_SM_LOOPBACK = 15, /* Received our own FLOGI */
258 BFA_FCS_FABRIC_SM_START = 16, /* from driver */
259};
260 199
261static void bfa_fcs_fabric_sm_uninit(struct bfa_fcs_fabric_s *fabric, 200static void bfa_fcs_fabric_sm_uninit(struct bfa_fcs_fabric_s *fabric,
262 enum bfa_fcs_fabric_event event); 201 enum bfa_fcs_fabric_event event);
@@ -270,14 +209,8 @@ static void bfa_fcs_fabric_sm_flogi_retry(struct bfa_fcs_fabric_s *fabric,
270 enum bfa_fcs_fabric_event event); 209 enum bfa_fcs_fabric_event event);
271static void bfa_fcs_fabric_sm_auth(struct bfa_fcs_fabric_s *fabric, 210static void bfa_fcs_fabric_sm_auth(struct bfa_fcs_fabric_s *fabric,
272 enum bfa_fcs_fabric_event event); 211 enum bfa_fcs_fabric_event event);
273static void bfa_fcs_fabric_sm_auth_failed(struct bfa_fcs_fabric_s *fabric,
274 enum bfa_fcs_fabric_event event);
275static void bfa_fcs_fabric_sm_loopback(struct bfa_fcs_fabric_s *fabric,
276 enum bfa_fcs_fabric_event event);
277static void bfa_fcs_fabric_sm_nofabric(struct bfa_fcs_fabric_s *fabric, 212static void bfa_fcs_fabric_sm_nofabric(struct bfa_fcs_fabric_s *fabric,
278 enum bfa_fcs_fabric_event event); 213 enum bfa_fcs_fabric_event event);
279static void bfa_fcs_fabric_sm_online(struct bfa_fcs_fabric_s *fabric,
280 enum bfa_fcs_fabric_event event);
281static void bfa_fcs_fabric_sm_evfp(struct bfa_fcs_fabric_s *fabric, 214static void bfa_fcs_fabric_sm_evfp(struct bfa_fcs_fabric_s *fabric,
282 enum bfa_fcs_fabric_event event); 215 enum bfa_fcs_fabric_event event);
283static void bfa_fcs_fabric_sm_evfp_done(struct bfa_fcs_fabric_s *fabric, 216static void bfa_fcs_fabric_sm_evfp_done(struct bfa_fcs_fabric_s *fabric,
@@ -337,7 +270,7 @@ bfa_fcs_fabric_sm_created(struct bfa_fcs_fabric_s *fabric,
337 270
338 case BFA_FCS_FABRIC_SM_DELETE: 271 case BFA_FCS_FABRIC_SM_DELETE:
339 bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_uninit); 272 bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_uninit);
340 bfa_fcs_modexit_comp(fabric->fcs); 273 bfa_wc_down(&fabric->fcs->wc);
341 break; 274 break;
342 275
343 default: 276 default:
@@ -410,7 +343,7 @@ bfa_fcs_fabric_sm_flogi(struct bfa_fcs_fabric_s *fabric,
410 343
411 case BFA_FCS_FABRIC_SM_LOOPBACK: 344 case BFA_FCS_FABRIC_SM_LOOPBACK:
412 bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_loopback); 345 bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_loopback);
413 bfa_lps_discard(fabric->lps); 346 bfa_sm_send_event(fabric->lps, BFA_LPS_SM_OFFLINE);
414 bfa_fcs_fabric_set_opertype(fabric); 347 bfa_fcs_fabric_set_opertype(fabric);
415 break; 348 break;
416 349
@@ -424,12 +357,12 @@ bfa_fcs_fabric_sm_flogi(struct bfa_fcs_fabric_s *fabric,
424 357
425 case BFA_FCS_FABRIC_SM_LINK_DOWN: 358 case BFA_FCS_FABRIC_SM_LINK_DOWN:
426 bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_linkdown); 359 bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_linkdown);
427 bfa_lps_discard(fabric->lps); 360 bfa_sm_send_event(fabric->lps, BFA_LPS_SM_OFFLINE);
428 break; 361 break;
429 362
430 case BFA_FCS_FABRIC_SM_DELETE: 363 case BFA_FCS_FABRIC_SM_DELETE:
431 bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_deleting); 364 bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_deleting);
432 bfa_lps_discard(fabric->lps); 365 bfa_sm_send_event(fabric->lps, BFA_LPS_SM_OFFLINE);
433 bfa_fcs_fabric_delete(fabric); 366 bfa_fcs_fabric_delete(fabric);
434 break; 367 break;
435 368
@@ -481,7 +414,7 @@ bfa_fcs_fabric_sm_auth(struct bfa_fcs_fabric_s *fabric,
481 switch (event) { 414 switch (event) {
482 case BFA_FCS_FABRIC_SM_AUTH_FAILED: 415 case BFA_FCS_FABRIC_SM_AUTH_FAILED:
483 bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_auth_failed); 416 bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_auth_failed);
484 bfa_lps_discard(fabric->lps); 417 bfa_sm_send_event(fabric->lps, BFA_LPS_SM_OFFLINE);
485 break; 418 break;
486 419
487 case BFA_FCS_FABRIC_SM_AUTH_SUCCESS: 420 case BFA_FCS_FABRIC_SM_AUTH_SUCCESS:
@@ -495,7 +428,7 @@ bfa_fcs_fabric_sm_auth(struct bfa_fcs_fabric_s *fabric,
495 428
496 case BFA_FCS_FABRIC_SM_LINK_DOWN: 429 case BFA_FCS_FABRIC_SM_LINK_DOWN:
497 bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_linkdown); 430 bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_linkdown);
498 bfa_lps_discard(fabric->lps); 431 bfa_sm_send_event(fabric->lps, BFA_LPS_SM_OFFLINE);
499 break; 432 break;
500 433
501 case BFA_FCS_FABRIC_SM_DELETE: 434 case BFA_FCS_FABRIC_SM_DELETE:
@@ -511,7 +444,7 @@ bfa_fcs_fabric_sm_auth(struct bfa_fcs_fabric_s *fabric,
511/* 444/*
512 * Authentication failed 445 * Authentication failed
513 */ 446 */
514static void 447void
515bfa_fcs_fabric_sm_auth_failed(struct bfa_fcs_fabric_s *fabric, 448bfa_fcs_fabric_sm_auth_failed(struct bfa_fcs_fabric_s *fabric,
516 enum bfa_fcs_fabric_event event) 449 enum bfa_fcs_fabric_event event)
517{ 450{
@@ -537,7 +470,7 @@ bfa_fcs_fabric_sm_auth_failed(struct bfa_fcs_fabric_s *fabric,
537/* 470/*
538 * Port is in loopback mode. 471 * Port is in loopback mode.
539 */ 472 */
540static void 473void
541bfa_fcs_fabric_sm_loopback(struct bfa_fcs_fabric_s *fabric, 474bfa_fcs_fabric_sm_loopback(struct bfa_fcs_fabric_s *fabric,
542 enum bfa_fcs_fabric_event event) 475 enum bfa_fcs_fabric_event event)
543{ 476{
@@ -573,7 +506,7 @@ bfa_fcs_fabric_sm_nofabric(struct bfa_fcs_fabric_s *fabric,
573 switch (event) { 506 switch (event) {
574 case BFA_FCS_FABRIC_SM_LINK_DOWN: 507 case BFA_FCS_FABRIC_SM_LINK_DOWN:
575 bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_linkdown); 508 bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_linkdown);
576 bfa_lps_discard(fabric->lps); 509 bfa_sm_send_event(fabric->lps, BFA_LPS_SM_OFFLINE);
577 bfa_fcs_fabric_notify_offline(fabric); 510 bfa_fcs_fabric_notify_offline(fabric);
578 break; 511 break;
579 512
@@ -596,7 +529,7 @@ bfa_fcs_fabric_sm_nofabric(struct bfa_fcs_fabric_s *fabric,
596/* 529/*
597 * Fabric is online - normal operating state. 530 * Fabric is online - normal operating state.
598 */ 531 */
599static void 532void
600bfa_fcs_fabric_sm_online(struct bfa_fcs_fabric_s *fabric, 533bfa_fcs_fabric_sm_online(struct bfa_fcs_fabric_s *fabric,
601 enum bfa_fcs_fabric_event event) 534 enum bfa_fcs_fabric_event event)
602{ 535{
@@ -606,7 +539,7 @@ bfa_fcs_fabric_sm_online(struct bfa_fcs_fabric_s *fabric,
606 switch (event) { 539 switch (event) {
607 case BFA_FCS_FABRIC_SM_LINK_DOWN: 540 case BFA_FCS_FABRIC_SM_LINK_DOWN:
608 bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_linkdown); 541 bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_linkdown);
609 bfa_lps_discard(fabric->lps); 542 bfa_sm_send_event(fabric->lps, BFA_LPS_SM_OFFLINE);
610 bfa_fcs_fabric_notify_offline(fabric); 543 bfa_fcs_fabric_notify_offline(fabric);
611 break; 544 break;
612 545
@@ -617,7 +550,7 @@ bfa_fcs_fabric_sm_online(struct bfa_fcs_fabric_s *fabric,
617 550
618 case BFA_FCS_FABRIC_SM_AUTH_FAILED: 551 case BFA_FCS_FABRIC_SM_AUTH_FAILED:
619 bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_auth_failed); 552 bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_auth_failed);
620 bfa_lps_discard(fabric->lps); 553 bfa_sm_send_event(fabric->lps, BFA_LPS_SM_OFFLINE);
621 break; 554 break;
622 555
623 case BFA_FCS_FABRIC_SM_AUTH_SUCCESS: 556 case BFA_FCS_FABRIC_SM_AUTH_SUCCESS:
@@ -697,7 +630,7 @@ bfa_fcs_fabric_sm_deleting(struct bfa_fcs_fabric_s *fabric,
697 switch (event) { 630 switch (event) {
698 case BFA_FCS_FABRIC_SM_DELCOMP: 631 case BFA_FCS_FABRIC_SM_DELCOMP:
699 bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_uninit); 632 bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_uninit);
700 bfa_fcs_modexit_comp(fabric->fcs); 633 bfa_wc_down(&fabric->fcs->wc);
701 break; 634 break;
702 635
703 case BFA_FCS_FABRIC_SM_LINK_UP: 636 case BFA_FCS_FABRIC_SM_LINK_UP:
@@ -724,8 +657,8 @@ bfa_fcs_fabric_init(struct bfa_fcs_fabric_s *fabric)
724 struct bfa_lport_cfg_s *port_cfg = &fabric->bport.port_cfg; 657 struct bfa_lport_cfg_s *port_cfg = &fabric->bport.port_cfg;
725 658
726 port_cfg->roles = BFA_LPORT_ROLE_FCP_IM; 659 port_cfg->roles = BFA_LPORT_ROLE_FCP_IM;
727 port_cfg->nwwn = bfa_ioc_get_nwwn(&fabric->fcs->bfa->ioc); 660 port_cfg->nwwn = fabric->fcs->bfa->ioc.attr->nwwn;
728 port_cfg->pwwn = bfa_ioc_get_pwwn(&fabric->fcs->bfa->ioc); 661 port_cfg->pwwn = fabric->fcs->bfa->ioc.attr->pwwn;
729} 662}
730 663
731/* 664/*
@@ -813,7 +746,7 @@ bfa_cb_lps_flogi_comp(void *bfad, void *uarg, bfa_status_t status)
813 return; 746 return;
814 747
815 case BFA_STATUS_EPROTOCOL: 748 case BFA_STATUS_EPROTOCOL:
816 switch (bfa_lps_get_extstatus(fabric->lps)) { 749 switch (fabric->lps->ext_status) {
817 case BFA_EPROTO_BAD_ACCEPT: 750 case BFA_EPROTO_BAD_ACCEPT:
818 fabric->stats.flogi_acc_err++; 751 fabric->stats.flogi_acc_err++;
819 break; 752 break;
@@ -840,26 +773,26 @@ bfa_cb_lps_flogi_comp(void *bfad, void *uarg, bfa_status_t status)
840 return; 773 return;
841 } 774 }
842 775
843 fabric->bb_credit = bfa_lps_get_peer_bbcredit(fabric->lps); 776 fabric->bb_credit = fabric->lps->pr_bbcred;
844 bfa_trc(fabric->fcs, fabric->bb_credit); 777 bfa_trc(fabric->fcs, fabric->bb_credit);
845 778
846 if (!bfa_lps_is_brcd_fabric(fabric->lps)) 779 if (!(fabric->lps->brcd_switch))
847 fabric->fabric_name = bfa_lps_get_peer_nwwn(fabric->lps); 780 fabric->fabric_name = fabric->lps->pr_nwwn;
848 781
849 /* 782 /*
850 * Check port type. It should be 1 = F-port. 783 * Check port type. It should be 1 = F-port.
851 */ 784 */
852 if (bfa_lps_is_fport(fabric->lps)) { 785 if (fabric->lps->fport) {
853 fabric->bport.pid = bfa_lps_get_pid(fabric->lps); 786 fabric->bport.pid = fabric->lps->lp_pid;
854 fabric->is_npiv = bfa_lps_is_npiv_en(fabric->lps); 787 fabric->is_npiv = fabric->lps->npiv_en;
855 fabric->is_auth = bfa_lps_is_authreq(fabric->lps); 788 fabric->is_auth = fabric->lps->auth_req;
856 bfa_sm_send_event(fabric, BFA_FCS_FABRIC_SM_CONT_OP); 789 bfa_sm_send_event(fabric, BFA_FCS_FABRIC_SM_CONT_OP);
857 } else { 790 } else {
858 /* 791 /*
859 * Nport-2-Nport direct attached 792 * Nport-2-Nport direct attached
860 */ 793 */
861 fabric->bport.port_topo.pn2n.rem_port_wwn = 794 fabric->bport.port_topo.pn2n.rem_port_wwn =
862 bfa_lps_get_peer_pwwn(fabric->lps); 795 fabric->lps->pr_pwwn;
863 bfa_sm_send_event(fabric, BFA_FCS_FABRIC_SM_NO_FABRIC); 796 bfa_sm_send_event(fabric, BFA_FCS_FABRIC_SM_NO_FABRIC);
864 } 797 }
865 798
@@ -987,7 +920,7 @@ bfa_fcs_fabric_attach(struct bfa_fcs_s *fcs)
987 INIT_LIST_HEAD(&fabric->vport_q); 920 INIT_LIST_HEAD(&fabric->vport_q);
988 INIT_LIST_HEAD(&fabric->vf_q); 921 INIT_LIST_HEAD(&fabric->vf_q);
989 fabric->lps = bfa_lps_alloc(fcs->bfa); 922 fabric->lps = bfa_lps_alloc(fcs->bfa);
990 bfa_assert(fabric->lps); 923 WARN_ON(!fabric->lps);
991 924
992 /* 925 /*
993 * Initialize fabric delete completion handler. Fabric deletion is 926 * Initialize fabric delete completion handler. Fabric deletion is
@@ -1038,31 +971,6 @@ bfa_fcs_fabric_modstart(struct bfa_fcs_s *fcs)
1038 bfa_sm_send_event(fabric, BFA_FCS_FABRIC_SM_START); 971 bfa_sm_send_event(fabric, BFA_FCS_FABRIC_SM_START);
1039} 972}
1040 973
1041/*
1042 * Suspend fabric activity as part of driver suspend.
1043 */
1044void
1045bfa_fcs_fabric_modsusp(struct bfa_fcs_s *fcs)
1046{
1047}
1048
1049bfa_boolean_t
1050bfa_fcs_fabric_is_loopback(struct bfa_fcs_fabric_s *fabric)
1051{
1052 return bfa_sm_cmp_state(fabric, bfa_fcs_fabric_sm_loopback);
1053}
1054
1055bfa_boolean_t
1056bfa_fcs_fabric_is_auth_failed(struct bfa_fcs_fabric_s *fabric)
1057{
1058 return bfa_sm_cmp_state(fabric, bfa_fcs_fabric_sm_auth_failed);
1059}
1060
1061enum bfa_port_type
1062bfa_fcs_fabric_port_type(struct bfa_fcs_fabric_s *fabric)
1063{
1064 return fabric->oper_type;
1065}
1066 974
1067/* 975/*
1068 * Link up notification from BFA physical port module. 976 * Link up notification from BFA physical port module.
@@ -1123,40 +1031,6 @@ bfa_fcs_fabric_delvport(struct bfa_fcs_fabric_s *fabric,
1123 bfa_wc_down(&fabric->wc); 1031 bfa_wc_down(&fabric->wc);
1124} 1032}
1125 1033
1126/*
1127 * Base port is deleted.
1128 */
1129void
1130bfa_fcs_fabric_port_delete_comp(struct bfa_fcs_fabric_s *fabric)
1131{
1132 bfa_wc_down(&fabric->wc);
1133}
1134
1135
1136/*
1137 * Check if fabric is online.
1138 *
1139 * param[in] fabric - Fabric instance. This can be a base fabric or vf.
1140 *
1141 * @return TRUE/FALSE
1142 */
1143int
1144bfa_fcs_fabric_is_online(struct bfa_fcs_fabric_s *fabric)
1145{
1146 return bfa_sm_cmp_state(fabric, bfa_fcs_fabric_sm_online);
1147}
1148
1149/*
1150 * brief
1151 *
1152 */
1153bfa_status_t
1154bfa_fcs_fabric_addvf(struct bfa_fcs_fabric_s *vf, struct bfa_fcs_s *fcs,
1155 struct bfa_lport_cfg_s *port_cfg, struct bfad_vf_s *vf_drv)
1156{
1157 bfa_sm_set_state(vf, bfa_fcs_fabric_sm_uninit);
1158 return BFA_STATUS_OK;
1159}
1160 1034
1161/* 1035/*
1162 * Lookup for a vport withing a fabric given its pwwn 1036 * Lookup for a vport withing a fabric given its pwwn
@@ -1176,18 +1050,6 @@ bfa_fcs_fabric_vport_lookup(struct bfa_fcs_fabric_s *fabric, wwn_t pwwn)
1176 return NULL; 1050 return NULL;
1177} 1051}
1178 1052
1179/*
1180 * In a given fabric, return the number of lports.
1181 *
1182 * param[in] fabric - Fabric instance. This can be a base fabric or vf.
1183 *
1184 * @return : 1 or more.
1185 */
1186u16
1187bfa_fcs_fabric_vport_count(struct bfa_fcs_fabric_s *fabric)
1188{
1189 return fabric->num_vports;
1190}
1191 1053
1192/* 1054/*
1193 * Get OUI of the attached switch. 1055 * Get OUI of the attached switch.
@@ -1207,7 +1069,7 @@ bfa_fcs_fabric_get_switch_oui(struct bfa_fcs_fabric_s *fabric)
1207 u8 *tmp; 1069 u8 *tmp;
1208 u16 oui; 1070 u16 oui;
1209 1071
1210 fab_nwwn = bfa_lps_get_peer_nwwn(fabric->lps); 1072 fab_nwwn = fabric->lps->pr_nwwn;
1211 1073
1212 tmp = (u8 *)&fab_nwwn; 1074 tmp = (u8 *)&fab_nwwn;
1213 oui = (tmp[3] << 8) | tmp[4]; 1075 oui = (tmp[3] << 8) | tmp[4];
@@ -1235,7 +1097,7 @@ bfa_fcs_fabric_uf_recv(struct bfa_fcs_fabric_s *fabric, struct fchs_s *fchs,
1235 * external loopback cable is in place. Our own FLOGI frames are 1097 * external loopback cable is in place. Our own FLOGI frames are
1236 * sometimes looped back when switch port gets temporarily bypassed. 1098 * sometimes looped back when switch port gets temporarily bypassed.
1237 */ 1099 */
1238 if ((pid == bfa_os_ntoh3b(FC_FABRIC_PORT)) && 1100 if ((pid == bfa_ntoh3b(FC_FABRIC_PORT)) &&
1239 (els_cmd->els_code == FC_ELS_FLOGI) && 1101 (els_cmd->els_code == FC_ELS_FLOGI) &&
1240 (flogi->port_name == bfa_fcs_lport_get_pwwn(&fabric->bport))) { 1102 (flogi->port_name == bfa_fcs_lport_get_pwwn(&fabric->bport))) {
1241 bfa_sm_send_event(fabric, BFA_FCS_FABRIC_SM_LOOPBACK); 1103 bfa_sm_send_event(fabric, BFA_FCS_FABRIC_SM_LOOPBACK);
@@ -1245,7 +1107,7 @@ bfa_fcs_fabric_uf_recv(struct bfa_fcs_fabric_s *fabric, struct fchs_s *fchs,
1245 /* 1107 /*
1246 * FLOGI/EVFP exchanges should be consumed by base fabric. 1108 * FLOGI/EVFP exchanges should be consumed by base fabric.
1247 */ 1109 */
1248 if (fchs->d_id == bfa_os_hton3b(FC_FABRIC_PORT)) { 1110 if (fchs->d_id == bfa_hton3b(FC_FABRIC_PORT)) {
1249 bfa_trc(fabric->fcs, pid); 1111 bfa_trc(fabric->fcs, pid);
1250 bfa_fcs_fabric_process_uf(fabric, fchs, len); 1112 bfa_fcs_fabric_process_uf(fabric, fchs, len);
1251 return; 1113 return;
@@ -1358,13 +1220,13 @@ bfa_fcs_fabric_send_flogi_acc(struct bfa_fcs_fabric_s *fabric)
1358 return; 1220 return;
1359 1221
1360 reqlen = fc_flogi_acc_build(&fchs, bfa_fcxp_get_reqbuf(fcxp), 1222 reqlen = fc_flogi_acc_build(&fchs, bfa_fcxp_get_reqbuf(fcxp),
1361 bfa_os_hton3b(FC_FABRIC_PORT), 1223 bfa_hton3b(FC_FABRIC_PORT),
1362 n2n_port->reply_oxid, pcfg->pwwn, 1224 n2n_port->reply_oxid, pcfg->pwwn,
1363 pcfg->nwwn, 1225 pcfg->nwwn,
1364 bfa_fcport_get_maxfrsize(bfa), 1226 bfa_fcport_get_maxfrsize(bfa),
1365 bfa_fcport_get_rx_bbcredit(bfa)); 1227 bfa_fcport_get_rx_bbcredit(bfa));
1366 1228
1367 bfa_fcxp_send(fcxp, NULL, fabric->vf_id, bfa_lps_get_tag(fabric->lps), 1229 bfa_fcxp_send(fcxp, NULL, fabric->vf_id, fabric->lps->lp_tag,
1368 BFA_FALSE, FC_CLASS_3, 1230 BFA_FALSE, FC_CLASS_3,
1369 reqlen, &fchs, bfa_fcs_fabric_flogiacc_comp, fabric, 1231 reqlen, &fchs, bfa_fcs_fabric_flogiacc_comp, fabric,
1370 FC_MAX_PDUSZ, 0); 1232 FC_MAX_PDUSZ, 0);
@@ -1455,7 +1317,7 @@ bfa_fcs_port_event_handler(void *cbarg, enum bfa_port_linkstate event)
1455 break; 1317 break;
1456 1318
1457 default: 1319 default:
1458 bfa_assert(0); 1320 WARN_ON(1);
1459 } 1321 }
1460} 1322}
1461 1323
@@ -1502,7 +1364,7 @@ bfa_fcs_uf_recv(void *cbarg, struct bfa_uf_s *uf)
1502 * drop frame if vfid is unknown 1364 * drop frame if vfid is unknown
1503 */ 1365 */
1504 if (!fabric) { 1366 if (!fabric) {
1505 bfa_assert(0); 1367 WARN_ON(1);
1506 bfa_stats(fcs, uf.vfid_unknown); 1368 bfa_stats(fcs, uf.vfid_unknown);
1507 bfa_uf_free(uf); 1369 bfa_uf_free(uf);
1508 return; 1370 return;