bfa_fcs.c 41 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720
  1. /*
  2. * Copyright (c) 2005-2010 Brocade Communications Systems, Inc.
  3. * All rights reserved
  4. * www.brocade.com
  5. *
  6. * Linux driver for Brocade Fibre Channel Host Bus Adapter.
  7. *
  8. * This program is free software; you can redistribute it and/or modify it
  9. * under the terms of the GNU General Public License (GPL) Version 2 as
  10. * published by the Free Software Foundation
  11. *
  12. * This program is distributed in the hope that it will be useful, but
  13. * WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * General Public License for more details.
  16. */
  17. /*
  18. * bfa_fcs.c BFA FCS main
  19. */
  20. #include "bfad_drv.h"
  21. #include "bfad_im.h"
  22. #include "bfa_fcs.h"
  23. #include "bfa_fcbuild.h"
  24. BFA_TRC_FILE(FCS, FCS);
  25. /*
  26. * FCS sub-modules
  27. */
  28. struct bfa_fcs_mod_s {
  29. void (*attach) (struct bfa_fcs_s *fcs);
  30. void (*modinit) (struct bfa_fcs_s *fcs);
  31. void (*modexit) (struct bfa_fcs_s *fcs);
  32. };
  33. #define BFA_FCS_MODULE(_mod) { _mod ## _modinit, _mod ## _modexit }
  34. static struct bfa_fcs_mod_s fcs_modules[] = {
  35. { bfa_fcs_port_attach, NULL, NULL },
  36. { bfa_fcs_uf_attach, NULL, NULL },
  37. { bfa_fcs_fabric_attach, bfa_fcs_fabric_modinit,
  38. bfa_fcs_fabric_modexit },
  39. };
  40. /*
  41. * fcs_api BFA FCS API
  42. */
  43. static void
  44. bfa_fcs_exit_comp(void *fcs_cbarg)
  45. {
  46. struct bfa_fcs_s *fcs = fcs_cbarg;
  47. struct bfad_s *bfad = fcs->bfad;
  48. complete(&bfad->comp);
  49. }
  50. /*
  51. * fcs_api BFA FCS API
  52. */
  53. /*
  54. * fcs attach -- called once to initialize data structures at driver attach time
  55. */
  56. void
  57. bfa_fcs_attach(struct bfa_fcs_s *fcs, struct bfa_s *bfa, struct bfad_s *bfad,
  58. bfa_boolean_t min_cfg)
  59. {
  60. int i;
  61. struct bfa_fcs_mod_s *mod;
  62. fcs->bfa = bfa;
  63. fcs->bfad = bfad;
  64. fcs->min_cfg = min_cfg;
  65. bfa->fcs = BFA_TRUE;
  66. fcbuild_init();
  67. for (i = 0; i < sizeof(fcs_modules) / sizeof(fcs_modules[0]); i++) {
  68. mod = &fcs_modules[i];
  69. if (mod->attach)
  70. mod->attach(fcs);
  71. }
  72. }
  73. /*
  74. * fcs initialization, called once after bfa initialization is complete
  75. */
  76. void
  77. bfa_fcs_init(struct bfa_fcs_s *fcs)
  78. {
  79. int i;
  80. struct bfa_fcs_mod_s *mod;
  81. for (i = 0; i < sizeof(fcs_modules) / sizeof(fcs_modules[0]); i++) {
  82. mod = &fcs_modules[i];
  83. if (mod->modinit)
  84. mod->modinit(fcs);
  85. }
  86. }
  87. /*
  88. * FCS update cfg - reset the pwwn/nwwn of fabric base logical port
  89. * with values learned during bfa_init firmware GETATTR REQ.
  90. */
  91. void
  92. bfa_fcs_update_cfg(struct bfa_fcs_s *fcs)
  93. {
  94. struct bfa_fcs_fabric_s *fabric = &fcs->fabric;
  95. struct bfa_lport_cfg_s *port_cfg = &fabric->bport.port_cfg;
  96. struct bfa_ioc_s *ioc = &fabric->fcs->bfa->ioc;
  97. port_cfg->nwwn = ioc->attr->nwwn;
  98. port_cfg->pwwn = ioc->attr->pwwn;
  99. }
  100. /*
  101. * Stop FCS operations.
  102. */
  103. void
  104. bfa_fcs_stop(struct bfa_fcs_s *fcs)
  105. {
  106. bfa_wc_init(&fcs->wc, bfa_fcs_exit_comp, fcs);
  107. bfa_wc_up(&fcs->wc);
  108. bfa_fcs_fabric_modstop(fcs);
  109. bfa_wc_wait(&fcs->wc);
  110. }
  111. /*
  112. * fcs pbc vport initialization
  113. */
  114. void
  115. bfa_fcs_pbc_vport_init(struct bfa_fcs_s *fcs)
  116. {
  117. int i, npbc_vports;
  118. struct bfi_pbc_vport_s pbc_vports[BFI_PBC_MAX_VPORTS];
  119. /* Initialize pbc vports */
  120. if (!fcs->min_cfg) {
  121. npbc_vports =
  122. bfa_iocfc_get_pbc_vports(fcs->bfa, pbc_vports);
  123. for (i = 0; i < npbc_vports; i++)
  124. bfa_fcb_pbc_vport_create(fcs->bfa->bfad, pbc_vports[i]);
  125. }
  126. }
  127. /*
  128. * brief
  129. * FCS driver details initialization.
  130. *
  131. * param[in] fcs FCS instance
  132. * param[in] driver_info Driver Details
  133. *
  134. * return None
  135. */
  136. void
  137. bfa_fcs_driver_info_init(struct bfa_fcs_s *fcs,
  138. struct bfa_fcs_driver_info_s *driver_info)
  139. {
  140. fcs->driver_info = *driver_info;
  141. bfa_fcs_fabric_psymb_init(&fcs->fabric);
  142. bfa_fcs_fabric_nsymb_init(&fcs->fabric);
  143. }
  144. /*
  145. * brief
  146. * FCS instance cleanup and exit.
  147. *
  148. * param[in] fcs FCS instance
  149. * return None
  150. */
  151. void
  152. bfa_fcs_exit(struct bfa_fcs_s *fcs)
  153. {
  154. struct bfa_fcs_mod_s *mod;
  155. int nmods, i;
  156. bfa_wc_init(&fcs->wc, bfa_fcs_exit_comp, fcs);
  157. nmods = sizeof(fcs_modules) / sizeof(fcs_modules[0]);
  158. for (i = 0; i < nmods; i++) {
  159. mod = &fcs_modules[i];
  160. if (mod->modexit) {
  161. bfa_wc_up(&fcs->wc);
  162. mod->modexit(fcs);
  163. }
  164. }
  165. bfa_wc_wait(&fcs->wc);
  166. }
  167. /*
  168. * Fabric module implementation.
  169. */
  170. #define BFA_FCS_FABRIC_RETRY_DELAY (2000) /* Milliseconds */
  171. #define BFA_FCS_FABRIC_CLEANUP_DELAY (10000) /* Milliseconds */
  172. #define bfa_fcs_fabric_set_opertype(__fabric) do { \
  173. if (bfa_fcport_get_topology((__fabric)->fcs->bfa) \
  174. == BFA_PORT_TOPOLOGY_P2P) { \
  175. if (fabric->fab_type == BFA_FCS_FABRIC_SWITCHED) \
  176. (__fabric)->oper_type = BFA_PORT_TYPE_NPORT; \
  177. else \
  178. (__fabric)->oper_type = BFA_PORT_TYPE_P2P; \
  179. } else \
  180. (__fabric)->oper_type = BFA_PORT_TYPE_NLPORT; \
  181. } while (0)
  182. /*
  183. * forward declarations
  184. */
  185. static void bfa_fcs_fabric_init(struct bfa_fcs_fabric_s *fabric);
  186. static void bfa_fcs_fabric_login(struct bfa_fcs_fabric_s *fabric);
  187. static void bfa_fcs_fabric_notify_online(struct bfa_fcs_fabric_s *fabric);
  188. static void bfa_fcs_fabric_notify_offline(struct bfa_fcs_fabric_s *fabric);
  189. static void bfa_fcs_fabric_delay(void *cbarg);
  190. static void bfa_fcs_fabric_delete(struct bfa_fcs_fabric_s *fabric);
  191. static void bfa_fcs_fabric_delete_comp(void *cbarg);
  192. static void bfa_fcs_fabric_stop(struct bfa_fcs_fabric_s *fabric);
  193. static void bfa_fcs_fabric_stop_comp(void *cbarg);
  194. static void bfa_fcs_fabric_process_uf(struct bfa_fcs_fabric_s *fabric,
  195. struct fchs_s *fchs, u16 len);
  196. static void bfa_fcs_fabric_process_flogi(struct bfa_fcs_fabric_s *fabric,
  197. struct fchs_s *fchs, u16 len);
  198. static void bfa_fcs_fabric_send_flogi_acc(struct bfa_fcs_fabric_s *fabric);
  199. static void bfa_fcs_fabric_flogiacc_comp(void *fcsarg,
  200. struct bfa_fcxp_s *fcxp, void *cbarg,
  201. bfa_status_t status,
  202. u32 rsp_len,
  203. u32 resid_len,
  204. struct fchs_s *rspfchs);
  205. static u8 bfa_fcs_fabric_oper_bbscn(struct bfa_fcs_fabric_s *fabric);
  206. static bfa_boolean_t bfa_fcs_fabric_is_bbscn_enabled(
  207. struct bfa_fcs_fabric_s *fabric);
  208. static void bfa_fcs_fabric_sm_uninit(struct bfa_fcs_fabric_s *fabric,
  209. enum bfa_fcs_fabric_event event);
  210. static void bfa_fcs_fabric_sm_created(struct bfa_fcs_fabric_s *fabric,
  211. enum bfa_fcs_fabric_event event);
  212. static void bfa_fcs_fabric_sm_linkdown(struct bfa_fcs_fabric_s *fabric,
  213. enum bfa_fcs_fabric_event event);
  214. static void bfa_fcs_fabric_sm_flogi(struct bfa_fcs_fabric_s *fabric,
  215. enum bfa_fcs_fabric_event event);
  216. static void bfa_fcs_fabric_sm_flogi_retry(struct bfa_fcs_fabric_s *fabric,
  217. enum bfa_fcs_fabric_event event);
  218. static void bfa_fcs_fabric_sm_auth(struct bfa_fcs_fabric_s *fabric,
  219. enum bfa_fcs_fabric_event event);
  220. static void bfa_fcs_fabric_sm_nofabric(struct bfa_fcs_fabric_s *fabric,
  221. enum bfa_fcs_fabric_event event);
  222. static void bfa_fcs_fabric_sm_evfp(struct bfa_fcs_fabric_s *fabric,
  223. enum bfa_fcs_fabric_event event);
  224. static void bfa_fcs_fabric_sm_evfp_done(struct bfa_fcs_fabric_s *fabric,
  225. enum bfa_fcs_fabric_event event);
  226. static void bfa_fcs_fabric_sm_isolated(struct bfa_fcs_fabric_s *fabric,
  227. enum bfa_fcs_fabric_event event);
  228. static void bfa_fcs_fabric_sm_deleting(struct bfa_fcs_fabric_s *fabric,
  229. enum bfa_fcs_fabric_event event);
  230. static void bfa_fcs_fabric_sm_stopping(struct bfa_fcs_fabric_s *fabric,
  231. enum bfa_fcs_fabric_event event);
  232. static void bfa_fcs_fabric_sm_cleanup(struct bfa_fcs_fabric_s *fabric,
  233. enum bfa_fcs_fabric_event event);
  234. /*
  235. * Beginning state before fabric creation.
  236. */
  237. static void
  238. bfa_fcs_fabric_sm_uninit(struct bfa_fcs_fabric_s *fabric,
  239. enum bfa_fcs_fabric_event event)
  240. {
  241. bfa_trc(fabric->fcs, fabric->bport.port_cfg.pwwn);
  242. bfa_trc(fabric->fcs, event);
  243. switch (event) {
  244. case BFA_FCS_FABRIC_SM_CREATE:
  245. bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_created);
  246. bfa_fcs_fabric_init(fabric);
  247. bfa_fcs_lport_init(&fabric->bport, &fabric->bport.port_cfg);
  248. break;
  249. case BFA_FCS_FABRIC_SM_LINK_UP:
  250. case BFA_FCS_FABRIC_SM_LINK_DOWN:
  251. break;
  252. default:
  253. bfa_sm_fault(fabric->fcs, event);
  254. }
  255. }
  256. /*
  257. * Beginning state before fabric creation.
  258. */
  259. static void
  260. bfa_fcs_fabric_sm_created(struct bfa_fcs_fabric_s *fabric,
  261. enum bfa_fcs_fabric_event event)
  262. {
  263. bfa_trc(fabric->fcs, fabric->bport.port_cfg.pwwn);
  264. bfa_trc(fabric->fcs, event);
  265. switch (event) {
  266. case BFA_FCS_FABRIC_SM_START:
  267. if (bfa_fcport_is_linkup(fabric->fcs->bfa)) {
  268. bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_flogi);
  269. bfa_fcs_fabric_login(fabric);
  270. } else
  271. bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_linkdown);
  272. break;
  273. case BFA_FCS_FABRIC_SM_LINK_UP:
  274. case BFA_FCS_FABRIC_SM_LINK_DOWN:
  275. break;
  276. case BFA_FCS_FABRIC_SM_DELETE:
  277. bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_deleting);
  278. bfa_fcs_fabric_delete(fabric);
  279. break;
  280. default:
  281. bfa_sm_fault(fabric->fcs, event);
  282. }
  283. }
  284. /*
  285. * Link is down, awaiting LINK UP event from port. This is also the
  286. * first state at fabric creation.
  287. */
  288. static void
  289. bfa_fcs_fabric_sm_linkdown(struct bfa_fcs_fabric_s *fabric,
  290. enum bfa_fcs_fabric_event event)
  291. {
  292. bfa_trc(fabric->fcs, fabric->bport.port_cfg.pwwn);
  293. bfa_trc(fabric->fcs, event);
  294. switch (event) {
  295. case BFA_FCS_FABRIC_SM_LINK_UP:
  296. bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_flogi);
  297. bfa_fcs_fabric_login(fabric);
  298. break;
  299. case BFA_FCS_FABRIC_SM_RETRY_OP:
  300. break;
  301. case BFA_FCS_FABRIC_SM_DELETE:
  302. bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_deleting);
  303. bfa_fcs_fabric_delete(fabric);
  304. break;
  305. case BFA_FCS_FABRIC_SM_STOP:
  306. bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_cleanup);
  307. bfa_fcs_fabric_stop(fabric);
  308. break;
  309. default:
  310. bfa_sm_fault(fabric->fcs, event);
  311. }
  312. }
  313. /*
  314. * FLOGI is in progress, awaiting FLOGI reply.
  315. */
  316. static void
  317. bfa_fcs_fabric_sm_flogi(struct bfa_fcs_fabric_s *fabric,
  318. enum bfa_fcs_fabric_event event)
  319. {
  320. bfa_trc(fabric->fcs, fabric->bport.port_cfg.pwwn);
  321. bfa_trc(fabric->fcs, event);
  322. switch (event) {
  323. case BFA_FCS_FABRIC_SM_CONT_OP:
  324. bfa_fcport_set_tx_bbcredit(fabric->fcs->bfa,
  325. fabric->bb_credit,
  326. bfa_fcs_fabric_oper_bbscn(fabric));
  327. fabric->fab_type = BFA_FCS_FABRIC_SWITCHED;
  328. if (fabric->auth_reqd && fabric->is_auth) {
  329. bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_auth);
  330. bfa_trc(fabric->fcs, event);
  331. } else {
  332. bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_online);
  333. bfa_fcs_fabric_notify_online(fabric);
  334. }
  335. break;
  336. case BFA_FCS_FABRIC_SM_RETRY_OP:
  337. bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_flogi_retry);
  338. bfa_timer_start(fabric->fcs->bfa, &fabric->delay_timer,
  339. bfa_fcs_fabric_delay, fabric,
  340. BFA_FCS_FABRIC_RETRY_DELAY);
  341. break;
  342. case BFA_FCS_FABRIC_SM_LOOPBACK:
  343. bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_loopback);
  344. bfa_sm_send_event(fabric->lps, BFA_LPS_SM_OFFLINE);
  345. bfa_fcs_fabric_set_opertype(fabric);
  346. break;
  347. case BFA_FCS_FABRIC_SM_NO_FABRIC:
  348. fabric->fab_type = BFA_FCS_FABRIC_N2N;
  349. bfa_fcport_set_tx_bbcredit(fabric->fcs->bfa,
  350. fabric->bb_credit,
  351. bfa_fcs_fabric_oper_bbscn(fabric));
  352. bfa_fcs_fabric_notify_online(fabric);
  353. bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_nofabric);
  354. break;
  355. case BFA_FCS_FABRIC_SM_LINK_DOWN:
  356. bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_linkdown);
  357. bfa_sm_send_event(fabric->lps, BFA_LPS_SM_OFFLINE);
  358. break;
  359. case BFA_FCS_FABRIC_SM_DELETE:
  360. bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_deleting);
  361. bfa_sm_send_event(fabric->lps, BFA_LPS_SM_OFFLINE);
  362. bfa_fcs_fabric_delete(fabric);
  363. break;
  364. default:
  365. bfa_sm_fault(fabric->fcs, event);
  366. }
  367. }
  368. static void
  369. bfa_fcs_fabric_sm_flogi_retry(struct bfa_fcs_fabric_s *fabric,
  370. enum bfa_fcs_fabric_event event)
  371. {
  372. bfa_trc(fabric->fcs, fabric->bport.port_cfg.pwwn);
  373. bfa_trc(fabric->fcs, event);
  374. switch (event) {
  375. case BFA_FCS_FABRIC_SM_DELAYED:
  376. bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_flogi);
  377. bfa_fcs_fabric_login(fabric);
  378. break;
  379. case BFA_FCS_FABRIC_SM_LINK_DOWN:
  380. bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_linkdown);
  381. bfa_timer_stop(&fabric->delay_timer);
  382. break;
  383. case BFA_FCS_FABRIC_SM_DELETE:
  384. bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_deleting);
  385. bfa_timer_stop(&fabric->delay_timer);
  386. bfa_fcs_fabric_delete(fabric);
  387. break;
  388. default:
  389. bfa_sm_fault(fabric->fcs, event);
  390. }
  391. }
  392. /*
  393. * Authentication is in progress, awaiting authentication results.
  394. */
  395. static void
  396. bfa_fcs_fabric_sm_auth(struct bfa_fcs_fabric_s *fabric,
  397. enum bfa_fcs_fabric_event event)
  398. {
  399. bfa_trc(fabric->fcs, fabric->bport.port_cfg.pwwn);
  400. bfa_trc(fabric->fcs, event);
  401. switch (event) {
  402. case BFA_FCS_FABRIC_SM_AUTH_FAILED:
  403. bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_auth_failed);
  404. bfa_sm_send_event(fabric->lps, BFA_LPS_SM_OFFLINE);
  405. break;
  406. case BFA_FCS_FABRIC_SM_AUTH_SUCCESS:
  407. bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_online);
  408. bfa_fcs_fabric_notify_online(fabric);
  409. break;
  410. case BFA_FCS_FABRIC_SM_PERF_EVFP:
  411. bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_evfp);
  412. break;
  413. case BFA_FCS_FABRIC_SM_LINK_DOWN:
  414. bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_linkdown);
  415. bfa_sm_send_event(fabric->lps, BFA_LPS_SM_OFFLINE);
  416. break;
  417. case BFA_FCS_FABRIC_SM_DELETE:
  418. bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_deleting);
  419. bfa_fcs_fabric_delete(fabric);
  420. break;
  421. default:
  422. bfa_sm_fault(fabric->fcs, event);
  423. }
  424. }
  425. /*
  426. * Authentication failed
  427. */
  428. void
  429. bfa_fcs_fabric_sm_auth_failed(struct bfa_fcs_fabric_s *fabric,
  430. enum bfa_fcs_fabric_event event)
  431. {
  432. bfa_trc(fabric->fcs, fabric->bport.port_cfg.pwwn);
  433. bfa_trc(fabric->fcs, event);
  434. switch (event) {
  435. case BFA_FCS_FABRIC_SM_LINK_DOWN:
  436. bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_linkdown);
  437. bfa_fcs_fabric_notify_offline(fabric);
  438. break;
  439. case BFA_FCS_FABRIC_SM_DELETE:
  440. bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_deleting);
  441. bfa_fcs_fabric_delete(fabric);
  442. break;
  443. default:
  444. bfa_sm_fault(fabric->fcs, event);
  445. }
  446. }
  447. /*
  448. * Port is in loopback mode.
  449. */
  450. void
  451. bfa_fcs_fabric_sm_loopback(struct bfa_fcs_fabric_s *fabric,
  452. enum bfa_fcs_fabric_event event)
  453. {
  454. bfa_trc(fabric->fcs, fabric->bport.port_cfg.pwwn);
  455. bfa_trc(fabric->fcs, event);
  456. switch (event) {
  457. case BFA_FCS_FABRIC_SM_LINK_DOWN:
  458. bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_linkdown);
  459. bfa_fcs_fabric_notify_offline(fabric);
  460. break;
  461. case BFA_FCS_FABRIC_SM_DELETE:
  462. bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_deleting);
  463. bfa_fcs_fabric_delete(fabric);
  464. break;
  465. default:
  466. bfa_sm_fault(fabric->fcs, event);
  467. }
  468. }
  469. /*
  470. * There is no attached fabric - private loop or NPort-to-NPort topology.
  471. */
  472. static void
  473. bfa_fcs_fabric_sm_nofabric(struct bfa_fcs_fabric_s *fabric,
  474. enum bfa_fcs_fabric_event event)
  475. {
  476. bfa_trc(fabric->fcs, fabric->bport.port_cfg.pwwn);
  477. bfa_trc(fabric->fcs, event);
  478. switch (event) {
  479. case BFA_FCS_FABRIC_SM_LINK_DOWN:
  480. bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_linkdown);
  481. bfa_sm_send_event(fabric->lps, BFA_LPS_SM_OFFLINE);
  482. bfa_fcs_fabric_notify_offline(fabric);
  483. break;
  484. case BFA_FCS_FABRIC_SM_DELETE:
  485. bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_deleting);
  486. bfa_fcs_fabric_delete(fabric);
  487. break;
  488. case BFA_FCS_FABRIC_SM_NO_FABRIC:
  489. bfa_trc(fabric->fcs, fabric->bb_credit);
  490. bfa_fcport_set_tx_bbcredit(fabric->fcs->bfa,
  491. fabric->bb_credit,
  492. bfa_fcs_fabric_oper_bbscn(fabric));
  493. break;
  494. case BFA_FCS_FABRIC_SM_RETRY_OP:
  495. break;
  496. default:
  497. bfa_sm_fault(fabric->fcs, event);
  498. }
  499. }
  500. /*
  501. * Fabric is online - normal operating state.
  502. */
  503. void
  504. bfa_fcs_fabric_sm_online(struct bfa_fcs_fabric_s *fabric,
  505. enum bfa_fcs_fabric_event event)
  506. {
  507. bfa_trc(fabric->fcs, fabric->bport.port_cfg.pwwn);
  508. bfa_trc(fabric->fcs, event);
  509. switch (event) {
  510. case BFA_FCS_FABRIC_SM_LINK_DOWN:
  511. bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_linkdown);
  512. bfa_sm_send_event(fabric->lps, BFA_LPS_SM_OFFLINE);
  513. bfa_fcs_fabric_notify_offline(fabric);
  514. break;
  515. case BFA_FCS_FABRIC_SM_DELETE:
  516. bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_deleting);
  517. bfa_fcs_fabric_delete(fabric);
  518. break;
  519. case BFA_FCS_FABRIC_SM_STOP:
  520. bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_stopping);
  521. bfa_fcs_fabric_stop(fabric);
  522. break;
  523. case BFA_FCS_FABRIC_SM_AUTH_FAILED:
  524. bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_auth_failed);
  525. bfa_sm_send_event(fabric->lps, BFA_LPS_SM_OFFLINE);
  526. break;
  527. case BFA_FCS_FABRIC_SM_AUTH_SUCCESS:
  528. break;
  529. default:
  530. bfa_sm_fault(fabric->fcs, event);
  531. }
  532. }
  533. /*
  534. * Exchanging virtual fabric parameters.
  535. */
  536. static void
  537. bfa_fcs_fabric_sm_evfp(struct bfa_fcs_fabric_s *fabric,
  538. enum bfa_fcs_fabric_event event)
  539. {
  540. bfa_trc(fabric->fcs, fabric->bport.port_cfg.pwwn);
  541. bfa_trc(fabric->fcs, event);
  542. switch (event) {
  543. case BFA_FCS_FABRIC_SM_CONT_OP:
  544. bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_evfp_done);
  545. break;
  546. case BFA_FCS_FABRIC_SM_ISOLATE:
  547. bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_isolated);
  548. break;
  549. default:
  550. bfa_sm_fault(fabric->fcs, event);
  551. }
  552. }
  553. /*
  554. * EVFP exchange complete and VFT tagging is enabled.
  555. */
  556. static void
  557. bfa_fcs_fabric_sm_evfp_done(struct bfa_fcs_fabric_s *fabric,
  558. enum bfa_fcs_fabric_event event)
  559. {
  560. bfa_trc(fabric->fcs, fabric->bport.port_cfg.pwwn);
  561. bfa_trc(fabric->fcs, event);
  562. }
  563. /*
  564. * Port is isolated after EVFP exchange due to VF_ID mismatch (N and F).
  565. */
  566. static void
  567. bfa_fcs_fabric_sm_isolated(struct bfa_fcs_fabric_s *fabric,
  568. enum bfa_fcs_fabric_event event)
  569. {
  570. struct bfad_s *bfad = (struct bfad_s *)fabric->fcs->bfad;
  571. char pwwn_ptr[BFA_STRING_32];
  572. bfa_trc(fabric->fcs, fabric->bport.port_cfg.pwwn);
  573. bfa_trc(fabric->fcs, event);
  574. wwn2str(pwwn_ptr, fabric->bport.port_cfg.pwwn);
  575. BFA_LOG(KERN_INFO, bfad, bfa_log_level,
  576. "Port is isolated due to VF_ID mismatch. "
  577. "PWWN: %s Port VF_ID: %04x switch port VF_ID: %04x.",
  578. pwwn_ptr, fabric->fcs->port_vfid,
  579. fabric->event_arg.swp_vfid);
  580. }
  581. /*
  582. * Fabric is being deleted, awaiting vport delete completions.
  583. */
  584. static void
  585. bfa_fcs_fabric_sm_deleting(struct bfa_fcs_fabric_s *fabric,
  586. enum bfa_fcs_fabric_event event)
  587. {
  588. bfa_trc(fabric->fcs, fabric->bport.port_cfg.pwwn);
  589. bfa_trc(fabric->fcs, event);
  590. switch (event) {
  591. case BFA_FCS_FABRIC_SM_DELCOMP:
  592. bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_uninit);
  593. bfa_wc_down(&fabric->fcs->wc);
  594. break;
  595. case BFA_FCS_FABRIC_SM_LINK_UP:
  596. break;
  597. case BFA_FCS_FABRIC_SM_LINK_DOWN:
  598. bfa_fcs_fabric_notify_offline(fabric);
  599. break;
  600. default:
  601. bfa_sm_fault(fabric->fcs, event);
  602. }
  603. }
  604. /*
  605. * Fabric is being stopped, awaiting vport stop completions.
  606. */
  607. static void
  608. bfa_fcs_fabric_sm_stopping(struct bfa_fcs_fabric_s *fabric,
  609. enum bfa_fcs_fabric_event event)
  610. {
  611. bfa_trc(fabric->fcs, fabric->bport.port_cfg.pwwn);
  612. bfa_trc(fabric->fcs, event);
  613. switch (event) {
  614. case BFA_FCS_FABRIC_SM_STOPCOMP:
  615. bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_cleanup);
  616. bfa_sm_send_event(fabric->lps, BFA_LPS_SM_LOGOUT);
  617. break;
  618. case BFA_FCS_FABRIC_SM_LINK_UP:
  619. break;
  620. case BFA_FCS_FABRIC_SM_LINK_DOWN:
  621. bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_cleanup);
  622. break;
  623. default:
  624. bfa_sm_fault(fabric->fcs, event);
  625. }
  626. }
  627. /*
  628. * Fabric is being stopped, cleanup without FLOGO
  629. */
  630. static void
  631. bfa_fcs_fabric_sm_cleanup(struct bfa_fcs_fabric_s *fabric,
  632. enum bfa_fcs_fabric_event event)
  633. {
  634. bfa_trc(fabric->fcs, fabric->bport.port_cfg.pwwn);
  635. bfa_trc(fabric->fcs, event);
  636. switch (event) {
  637. case BFA_FCS_FABRIC_SM_STOPCOMP:
  638. case BFA_FCS_FABRIC_SM_LOGOCOMP:
  639. bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_created);
  640. bfa_wc_down(&(fabric->fcs)->wc);
  641. break;
  642. case BFA_FCS_FABRIC_SM_LINK_DOWN:
  643. /*
  644. * Ignore - can get this event if we get notified about IOC down
  645. * before the fabric completion callbk is done.
  646. */
  647. break;
  648. default:
  649. bfa_sm_fault(fabric->fcs, event);
  650. }
  651. }
  652. /*
  653. * fcs_fabric_private fabric private functions
  654. */
  655. static void
  656. bfa_fcs_fabric_init(struct bfa_fcs_fabric_s *fabric)
  657. {
  658. struct bfa_lport_cfg_s *port_cfg = &fabric->bport.port_cfg;
  659. port_cfg->roles = BFA_LPORT_ROLE_FCP_IM;
  660. port_cfg->nwwn = fabric->fcs->bfa->ioc.attr->nwwn;
  661. port_cfg->pwwn = fabric->fcs->bfa->ioc.attr->pwwn;
  662. }
  663. /*
  664. * Port Symbolic Name Creation for base port.
  665. */
  666. void
  667. bfa_fcs_fabric_psymb_init(struct bfa_fcs_fabric_s *fabric)
  668. {
  669. struct bfa_lport_cfg_s *port_cfg = &fabric->bport.port_cfg;
  670. char model[BFA_ADAPTER_MODEL_NAME_LEN] = {0};
  671. struct bfa_fcs_driver_info_s *driver_info = &fabric->fcs->driver_info;
  672. bfa_ioc_get_adapter_model(&fabric->fcs->bfa->ioc, model);
  673. /* Model name/number */
  674. strncpy((char *)&port_cfg->sym_name, model,
  675. BFA_FCS_PORT_SYMBNAME_MODEL_SZ);
  676. strncat((char *)&port_cfg->sym_name, BFA_FCS_PORT_SYMBNAME_SEPARATOR,
  677. sizeof(BFA_FCS_PORT_SYMBNAME_SEPARATOR));
  678. /* Driver Version */
  679. strncat((char *)&port_cfg->sym_name, (char *)driver_info->version,
  680. BFA_FCS_PORT_SYMBNAME_VERSION_SZ);
  681. strncat((char *)&port_cfg->sym_name, BFA_FCS_PORT_SYMBNAME_SEPARATOR,
  682. sizeof(BFA_FCS_PORT_SYMBNAME_SEPARATOR));
  683. /* Host machine name */
  684. strncat((char *)&port_cfg->sym_name,
  685. (char *)driver_info->host_machine_name,
  686. BFA_FCS_PORT_SYMBNAME_MACHINENAME_SZ);
  687. strncat((char *)&port_cfg->sym_name, BFA_FCS_PORT_SYMBNAME_SEPARATOR,
  688. sizeof(BFA_FCS_PORT_SYMBNAME_SEPARATOR));
  689. /*
  690. * Host OS Info :
  691. * If OS Patch Info is not there, do not truncate any bytes from the
  692. * OS name string and instead copy the entire OS info string (64 bytes).
  693. */
  694. if (driver_info->host_os_patch[0] == '\0') {
  695. strncat((char *)&port_cfg->sym_name,
  696. (char *)driver_info->host_os_name,
  697. BFA_FCS_OS_STR_LEN);
  698. strncat((char *)&port_cfg->sym_name,
  699. BFA_FCS_PORT_SYMBNAME_SEPARATOR,
  700. sizeof(BFA_FCS_PORT_SYMBNAME_SEPARATOR));
  701. } else {
  702. strncat((char *)&port_cfg->sym_name,
  703. (char *)driver_info->host_os_name,
  704. BFA_FCS_PORT_SYMBNAME_OSINFO_SZ);
  705. strncat((char *)&port_cfg->sym_name,
  706. BFA_FCS_PORT_SYMBNAME_SEPARATOR,
  707. sizeof(BFA_FCS_PORT_SYMBNAME_SEPARATOR));
  708. /* Append host OS Patch Info */
  709. strncat((char *)&port_cfg->sym_name,
  710. (char *)driver_info->host_os_patch,
  711. BFA_FCS_PORT_SYMBNAME_OSPATCH_SZ);
  712. }
  713. /* null terminate */
  714. port_cfg->sym_name.symname[BFA_SYMNAME_MAXLEN - 1] = 0;
  715. }
  716. /*
  717. * Node Symbolic Name Creation for base port and all vports
  718. */
  719. void
  720. bfa_fcs_fabric_nsymb_init(struct bfa_fcs_fabric_s *fabric)
  721. {
  722. struct bfa_lport_cfg_s *port_cfg = &fabric->bport.port_cfg;
  723. char model[BFA_ADAPTER_MODEL_NAME_LEN] = {0};
  724. struct bfa_fcs_driver_info_s *driver_info = &fabric->fcs->driver_info;
  725. bfa_ioc_get_adapter_model(&fabric->fcs->bfa->ioc, model);
  726. /* Model name/number */
  727. strncpy((char *)&port_cfg->node_sym_name, model,
  728. BFA_FCS_PORT_SYMBNAME_MODEL_SZ);
  729. strncat((char *)&port_cfg->node_sym_name,
  730. BFA_FCS_PORT_SYMBNAME_SEPARATOR,
  731. sizeof(BFA_FCS_PORT_SYMBNAME_SEPARATOR));
  732. /* Driver Version */
  733. strncat((char *)&port_cfg->node_sym_name, (char *)driver_info->version,
  734. BFA_FCS_PORT_SYMBNAME_VERSION_SZ);
  735. strncat((char *)&port_cfg->node_sym_name,
  736. BFA_FCS_PORT_SYMBNAME_SEPARATOR,
  737. sizeof(BFA_FCS_PORT_SYMBNAME_SEPARATOR));
  738. /* Host machine name */
  739. strncat((char *)&port_cfg->node_sym_name,
  740. (char *)driver_info->host_machine_name,
  741. BFA_FCS_PORT_SYMBNAME_MACHINENAME_SZ);
  742. strncat((char *)&port_cfg->node_sym_name,
  743. BFA_FCS_PORT_SYMBNAME_SEPARATOR,
  744. sizeof(BFA_FCS_PORT_SYMBNAME_SEPARATOR));
  745. /* null terminate */
  746. port_cfg->node_sym_name.symname[BFA_SYMNAME_MAXLEN - 1] = 0;
  747. }
  748. /*
  749. * bfa lps login completion callback
  750. */
  751. void
  752. bfa_cb_lps_flogi_comp(void *bfad, void *uarg, bfa_status_t status)
  753. {
  754. struct bfa_fcs_fabric_s *fabric = uarg;
  755. bfa_trc(fabric->fcs, fabric->bport.port_cfg.pwwn);
  756. bfa_trc(fabric->fcs, status);
  757. switch (status) {
  758. case BFA_STATUS_OK:
  759. fabric->stats.flogi_accepts++;
  760. break;
  761. case BFA_STATUS_INVALID_MAC:
  762. /* Only for CNA */
  763. fabric->stats.flogi_acc_err++;
  764. bfa_sm_send_event(fabric, BFA_FCS_FABRIC_SM_RETRY_OP);
  765. return;
  766. case BFA_STATUS_EPROTOCOL:
  767. switch (fabric->lps->ext_status) {
  768. case BFA_EPROTO_BAD_ACCEPT:
  769. fabric->stats.flogi_acc_err++;
  770. break;
  771. case BFA_EPROTO_UNKNOWN_RSP:
  772. fabric->stats.flogi_unknown_rsp++;
  773. break;
  774. default:
  775. break;
  776. }
  777. bfa_sm_send_event(fabric, BFA_FCS_FABRIC_SM_RETRY_OP);
  778. return;
  779. case BFA_STATUS_FABRIC_RJT:
  780. fabric->stats.flogi_rejects++;
  781. if (fabric->lps->lsrjt_rsn == FC_LS_RJT_RSN_LOGICAL_ERROR &&
  782. fabric->lps->lsrjt_expl == FC_LS_RJT_EXP_NO_ADDL_INFO)
  783. fabric->fcs->bbscn_flogi_rjt = BFA_TRUE;
  784. bfa_sm_send_event(fabric, BFA_FCS_FABRIC_SM_RETRY_OP);
  785. return;
  786. default:
  787. fabric->stats.flogi_rsp_err++;
  788. bfa_sm_send_event(fabric, BFA_FCS_FABRIC_SM_RETRY_OP);
  789. return;
  790. }
  791. fabric->bb_credit = fabric->lps->pr_bbcred;
  792. bfa_trc(fabric->fcs, fabric->bb_credit);
  793. if (!(fabric->lps->brcd_switch))
  794. fabric->fabric_name = fabric->lps->pr_nwwn;
  795. /*
  796. * Check port type. It should be 1 = F-port.
  797. */
  798. if (fabric->lps->fport) {
  799. fabric->bport.pid = fabric->lps->lp_pid;
  800. fabric->is_npiv = fabric->lps->npiv_en;
  801. fabric->is_auth = fabric->lps->auth_req;
  802. bfa_sm_send_event(fabric, BFA_FCS_FABRIC_SM_CONT_OP);
  803. } else {
  804. /*
  805. * Nport-2-Nport direct attached
  806. */
  807. fabric->bport.port_topo.pn2n.rem_port_wwn =
  808. fabric->lps->pr_pwwn;
  809. fabric->fab_type = BFA_FCS_FABRIC_N2N;
  810. bfa_sm_send_event(fabric, BFA_FCS_FABRIC_SM_NO_FABRIC);
  811. }
  812. bfa_trc(fabric->fcs, fabric->bport.pid);
  813. bfa_trc(fabric->fcs, fabric->is_npiv);
  814. bfa_trc(fabric->fcs, fabric->is_auth);
  815. }
  816. /*
  817. * Allocate and send FLOGI.
  818. */
  819. static void
  820. bfa_fcs_fabric_login(struct bfa_fcs_fabric_s *fabric)
  821. {
  822. struct bfa_s *bfa = fabric->fcs->bfa;
  823. struct bfa_lport_cfg_s *pcfg = &fabric->bport.port_cfg;
  824. u8 alpa = 0, bb_scn = 0;
  825. if (bfa_fcport_get_topology(bfa) == BFA_PORT_TOPOLOGY_LOOP)
  826. alpa = bfa_fcport_get_myalpa(bfa);
  827. if (bfa_fcs_fabric_is_bbscn_enabled(fabric) &&
  828. (!fabric->fcs->bbscn_flogi_rjt))
  829. bb_scn = BFA_FCS_PORT_DEF_BB_SCN;
  830. bfa_lps_flogi(fabric->lps, fabric, alpa, bfa_fcport_get_maxfrsize(bfa),
  831. pcfg->pwwn, pcfg->nwwn, fabric->auth_reqd, bb_scn);
  832. fabric->stats.flogi_sent++;
  833. }
  834. static void
  835. bfa_fcs_fabric_notify_online(struct bfa_fcs_fabric_s *fabric)
  836. {
  837. struct bfa_fcs_vport_s *vport;
  838. struct list_head *qe, *qen;
  839. bfa_trc(fabric->fcs, fabric->fabric_name);
  840. bfa_fcs_fabric_set_opertype(fabric);
  841. fabric->stats.fabric_onlines++;
  842. /*
  843. * notify online event to base and then virtual ports
  844. */
  845. bfa_fcs_lport_online(&fabric->bport);
  846. list_for_each_safe(qe, qen, &fabric->vport_q) {
  847. vport = (struct bfa_fcs_vport_s *) qe;
  848. bfa_fcs_vport_online(vport);
  849. }
  850. }
  851. static void
  852. bfa_fcs_fabric_notify_offline(struct bfa_fcs_fabric_s *fabric)
  853. {
  854. struct bfa_fcs_vport_s *vport;
  855. struct list_head *qe, *qen;
  856. bfa_trc(fabric->fcs, fabric->fabric_name);
  857. fabric->stats.fabric_offlines++;
  858. /*
  859. * notify offline event first to vports and then base port.
  860. */
  861. list_for_each_safe(qe, qen, &fabric->vport_q) {
  862. vport = (struct bfa_fcs_vport_s *) qe;
  863. bfa_fcs_vport_offline(vport);
  864. }
  865. bfa_fcs_lport_offline(&fabric->bport);
  866. fabric->fabric_name = 0;
  867. fabric->fabric_ip_addr[0] = 0;
  868. }
  869. static void
  870. bfa_fcs_fabric_delay(void *cbarg)
  871. {
  872. struct bfa_fcs_fabric_s *fabric = cbarg;
  873. bfa_sm_send_event(fabric, BFA_FCS_FABRIC_SM_DELAYED);
  874. }
  875. /*
  876. * Stop all vports and wait for vport stop completions.
  877. */
  878. static void
  879. bfa_fcs_fabric_stop(struct bfa_fcs_fabric_s *fabric)
  880. {
  881. struct bfa_fcs_vport_s *vport;
  882. struct list_head *qe, *qen;
  883. bfa_wc_init(&fabric->stop_wc, bfa_fcs_fabric_stop_comp, fabric);
  884. list_for_each_safe(qe, qen, &fabric->vport_q) {
  885. vport = (struct bfa_fcs_vport_s *) qe;
  886. bfa_wc_up(&fabric->stop_wc);
  887. bfa_fcs_vport_fcs_stop(vport);
  888. }
  889. bfa_wc_up(&fabric->stop_wc);
  890. bfa_fcs_lport_stop(&fabric->bport);
  891. bfa_wc_wait(&fabric->stop_wc);
  892. }
  893. /*
  894. * Computes operating BB_SCN value
  895. */
  896. static u8
  897. bfa_fcs_fabric_oper_bbscn(struct bfa_fcs_fabric_s *fabric)
  898. {
  899. u8 pr_bbscn = fabric->lps->pr_bbscn;
  900. struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(fabric->fcs->bfa);
  901. if (!(fcport->cfg.bb_scn_state && pr_bbscn))
  902. return 0;
  903. /* return max of local/remote bb_scn values */
  904. return ((pr_bbscn > BFA_FCS_PORT_DEF_BB_SCN) ?
  905. pr_bbscn : BFA_FCS_PORT_DEF_BB_SCN);
  906. }
  907. /*
  908. * Check if BB_SCN can be enabled.
  909. */
  910. static bfa_boolean_t
  911. bfa_fcs_fabric_is_bbscn_enabled(struct bfa_fcs_fabric_s *fabric)
  912. {
  913. struct bfa_fcport_s *fcport = BFA_FCPORT_MOD(fabric->fcs->bfa);
  914. if (bfa_ioc_get_fcmode(&fabric->fcs->bfa->ioc) &&
  915. fcport->cfg.bb_scn_state &&
  916. !bfa_fcport_is_qos_enabled(fabric->fcs->bfa) &&
  917. !bfa_fcport_is_trunk_enabled(fabric->fcs->bfa))
  918. return BFA_TRUE;
  919. else
  920. return BFA_FALSE;
  921. }
  922. /*
  923. * Delete all vports and wait for vport delete completions.
  924. */
  925. static void
  926. bfa_fcs_fabric_delete(struct bfa_fcs_fabric_s *fabric)
  927. {
  928. struct bfa_fcs_vport_s *vport;
  929. struct list_head *qe, *qen;
  930. list_for_each_safe(qe, qen, &fabric->vport_q) {
  931. vport = (struct bfa_fcs_vport_s *) qe;
  932. bfa_fcs_vport_fcs_delete(vport);
  933. }
  934. bfa_fcs_lport_delete(&fabric->bport);
  935. bfa_wc_wait(&fabric->wc);
  936. }
  937. static void
  938. bfa_fcs_fabric_delete_comp(void *cbarg)
  939. {
  940. struct bfa_fcs_fabric_s *fabric = cbarg;
  941. bfa_sm_send_event(fabric, BFA_FCS_FABRIC_SM_DELCOMP);
  942. }
  943. static void
  944. bfa_fcs_fabric_stop_comp(void *cbarg)
  945. {
  946. struct bfa_fcs_fabric_s *fabric = cbarg;
  947. bfa_sm_send_event(fabric, BFA_FCS_FABRIC_SM_STOPCOMP);
  948. }
  949. /*
  950. * fcs_fabric_public fabric public functions
  951. */
  952. /*
  953. * Attach time initialization.
  954. */
  955. void
  956. bfa_fcs_fabric_attach(struct bfa_fcs_s *fcs)
  957. {
  958. struct bfa_fcs_fabric_s *fabric;
  959. fabric = &fcs->fabric;
  960. memset(fabric, 0, sizeof(struct bfa_fcs_fabric_s));
  961. /*
  962. * Initialize base fabric.
  963. */
  964. fabric->fcs = fcs;
  965. INIT_LIST_HEAD(&fabric->vport_q);
  966. INIT_LIST_HEAD(&fabric->vf_q);
  967. fabric->lps = bfa_lps_alloc(fcs->bfa);
  968. WARN_ON(!fabric->lps);
  969. /*
  970. * Initialize fabric delete completion handler. Fabric deletion is
  971. * complete when the last vport delete is complete.
  972. */
  973. bfa_wc_init(&fabric->wc, bfa_fcs_fabric_delete_comp, fabric);
  974. bfa_wc_up(&fabric->wc); /* For the base port */
  975. bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_uninit);
  976. bfa_fcs_lport_attach(&fabric->bport, fabric->fcs, FC_VF_ID_NULL, NULL);
  977. }
  978. void
  979. bfa_fcs_fabric_modinit(struct bfa_fcs_s *fcs)
  980. {
  981. bfa_sm_send_event(&fcs->fabric, BFA_FCS_FABRIC_SM_CREATE);
  982. bfa_trc(fcs, 0);
  983. }
  984. /*
  985. * Module cleanup
  986. */
  987. void
  988. bfa_fcs_fabric_modexit(struct bfa_fcs_s *fcs)
  989. {
  990. struct bfa_fcs_fabric_s *fabric;
  991. bfa_trc(fcs, 0);
  992. /*
  993. * Cleanup base fabric.
  994. */
  995. fabric = &fcs->fabric;
  996. bfa_lps_delete(fabric->lps);
  997. bfa_sm_send_event(fabric, BFA_FCS_FABRIC_SM_DELETE);
  998. }
  999. /*
  1000. * Fabric module stop -- stop FCS actions
  1001. */
  1002. void
  1003. bfa_fcs_fabric_modstop(struct bfa_fcs_s *fcs)
  1004. {
  1005. struct bfa_fcs_fabric_s *fabric;
  1006. bfa_trc(fcs, 0);
  1007. fabric = &fcs->fabric;
  1008. bfa_sm_send_event(fabric, BFA_FCS_FABRIC_SM_STOP);
  1009. }
  1010. /*
  1011. * Fabric module start -- kick starts FCS actions
  1012. */
  1013. void
  1014. bfa_fcs_fabric_modstart(struct bfa_fcs_s *fcs)
  1015. {
  1016. struct bfa_fcs_fabric_s *fabric;
  1017. bfa_trc(fcs, 0);
  1018. fabric = &fcs->fabric;
  1019. bfa_sm_send_event(fabric, BFA_FCS_FABRIC_SM_START);
  1020. }
  1021. /*
  1022. * Link up notification from BFA physical port module.
  1023. */
  1024. void
  1025. bfa_fcs_fabric_link_up(struct bfa_fcs_fabric_s *fabric)
  1026. {
  1027. bfa_trc(fabric->fcs, fabric->bport.port_cfg.pwwn);
  1028. bfa_sm_send_event(fabric, BFA_FCS_FABRIC_SM_LINK_UP);
  1029. }
  1030. /*
  1031. * Link down notification from BFA physical port module.
  1032. */
  1033. void
  1034. bfa_fcs_fabric_link_down(struct bfa_fcs_fabric_s *fabric)
  1035. {
  1036. bfa_trc(fabric->fcs, fabric->bport.port_cfg.pwwn);
  1037. fabric->fcs->bbscn_flogi_rjt = BFA_FALSE;
  1038. bfa_sm_send_event(fabric, BFA_FCS_FABRIC_SM_LINK_DOWN);
  1039. }
  1040. /*
  1041. * A child vport is being created in the fabric.
  1042. *
  1043. * Call from vport module at vport creation. A list of base port and vports
  1044. * belonging to a fabric is maintained to propagate link events.
  1045. *
  1046. * param[in] fabric - Fabric instance. This can be a base fabric or vf.
  1047. * param[in] vport - Vport being created.
  1048. *
  1049. * @return None (always succeeds)
  1050. */
  1051. void
  1052. bfa_fcs_fabric_addvport(struct bfa_fcs_fabric_s *fabric,
  1053. struct bfa_fcs_vport_s *vport)
  1054. {
  1055. /*
  1056. * - add vport to fabric's vport_q
  1057. */
  1058. bfa_trc(fabric->fcs, fabric->vf_id);
  1059. list_add_tail(&vport->qe, &fabric->vport_q);
  1060. fabric->num_vports++;
  1061. bfa_wc_up(&fabric->wc);
  1062. }
  1063. /*
  1064. * A child vport is being deleted from fabric.
  1065. *
  1066. * Vport is being deleted.
  1067. */
  1068. void
  1069. bfa_fcs_fabric_delvport(struct bfa_fcs_fabric_s *fabric,
  1070. struct bfa_fcs_vport_s *vport)
  1071. {
  1072. list_del(&vport->qe);
  1073. fabric->num_vports--;
  1074. bfa_wc_down(&fabric->wc);
  1075. }
  1076. /*
  1077. * Lookup for a vport within a fabric given its pwwn
  1078. */
  1079. struct bfa_fcs_vport_s *
  1080. bfa_fcs_fabric_vport_lookup(struct bfa_fcs_fabric_s *fabric, wwn_t pwwn)
  1081. {
  1082. struct bfa_fcs_vport_s *vport;
  1083. struct list_head *qe;
  1084. list_for_each(qe, &fabric->vport_q) {
  1085. vport = (struct bfa_fcs_vport_s *) qe;
  1086. if (bfa_fcs_lport_get_pwwn(&vport->lport) == pwwn)
  1087. return vport;
  1088. }
  1089. return NULL;
  1090. }
  1091. /*
  1092. * Get OUI of the attached switch.
  1093. *
  1094. * Note : Use of this function should be avoided as much as possible.
  1095. * This function should be used only if there is any requirement
  1096. * to check for FOS version below 6.3.
  1097. * To check if the attached fabric is a brocade fabric, use
  1098. * bfa_lps_is_brcd_fabric() which works for FOS versions 6.3
  1099. * or above only.
  1100. */
  1101. u16
  1102. bfa_fcs_fabric_get_switch_oui(struct bfa_fcs_fabric_s *fabric)
  1103. {
  1104. wwn_t fab_nwwn;
  1105. u8 *tmp;
  1106. u16 oui;
  1107. fab_nwwn = fabric->lps->pr_nwwn;
  1108. tmp = (u8 *)&fab_nwwn;
  1109. oui = (tmp[3] << 8) | tmp[4];
  1110. return oui;
  1111. }
  1112. /*
  1113. * Unsolicited frame receive handling.
  1114. */
  1115. void
  1116. bfa_fcs_fabric_uf_recv(struct bfa_fcs_fabric_s *fabric, struct fchs_s *fchs,
  1117. u16 len)
  1118. {
  1119. u32 pid = fchs->d_id;
  1120. struct bfa_fcs_vport_s *vport;
  1121. struct list_head *qe;
  1122. struct fc_els_cmd_s *els_cmd = (struct fc_els_cmd_s *) (fchs + 1);
  1123. struct fc_logi_s *flogi = (struct fc_logi_s *) els_cmd;
  1124. bfa_trc(fabric->fcs, len);
  1125. bfa_trc(fabric->fcs, pid);
  1126. /*
  1127. * Look for our own FLOGI frames being looped back. This means an
  1128. * external loopback cable is in place. Our own FLOGI frames are
  1129. * sometimes looped back when switch port gets temporarily bypassed.
  1130. */
  1131. if ((pid == bfa_ntoh3b(FC_FABRIC_PORT)) &&
  1132. (els_cmd->els_code == FC_ELS_FLOGI) &&
  1133. (flogi->port_name == bfa_fcs_lport_get_pwwn(&fabric->bport))) {
  1134. bfa_sm_send_event(fabric, BFA_FCS_FABRIC_SM_LOOPBACK);
  1135. return;
  1136. }
  1137. /*
  1138. * FLOGI/EVFP exchanges should be consumed by base fabric.
  1139. */
  1140. if (fchs->d_id == bfa_hton3b(FC_FABRIC_PORT)) {
  1141. bfa_trc(fabric->fcs, pid);
  1142. bfa_fcs_fabric_process_uf(fabric, fchs, len);
  1143. return;
  1144. }
  1145. if (fabric->bport.pid == pid) {
  1146. /*
  1147. * All authentication frames should be routed to auth
  1148. */
  1149. bfa_trc(fabric->fcs, els_cmd->els_code);
  1150. if (els_cmd->els_code == FC_ELS_AUTH) {
  1151. bfa_trc(fabric->fcs, els_cmd->els_code);
  1152. return;
  1153. }
  1154. bfa_trc(fabric->fcs, *(u8 *) ((u8 *) fchs));
  1155. bfa_fcs_lport_uf_recv(&fabric->bport, fchs, len);
  1156. return;
  1157. }
  1158. /*
  1159. * look for a matching local port ID
  1160. */
  1161. list_for_each(qe, &fabric->vport_q) {
  1162. vport = (struct bfa_fcs_vport_s *) qe;
  1163. if (vport->lport.pid == pid) {
  1164. bfa_fcs_lport_uf_recv(&vport->lport, fchs, len);
  1165. return;
  1166. }
  1167. }
  1168. bfa_trc(fabric->fcs, els_cmd->els_code);
  1169. bfa_fcs_lport_uf_recv(&fabric->bport, fchs, len);
  1170. }
  1171. /*
  1172. * Unsolicited frames to be processed by fabric.
  1173. */
  1174. static void
  1175. bfa_fcs_fabric_process_uf(struct bfa_fcs_fabric_s *fabric, struct fchs_s *fchs,
  1176. u16 len)
  1177. {
  1178. struct fc_els_cmd_s *els_cmd = (struct fc_els_cmd_s *) (fchs + 1);
  1179. bfa_trc(fabric->fcs, els_cmd->els_code);
  1180. switch (els_cmd->els_code) {
  1181. case FC_ELS_FLOGI:
  1182. bfa_fcs_fabric_process_flogi(fabric, fchs, len);
  1183. break;
  1184. default:
  1185. /*
  1186. * need to generate a LS_RJT
  1187. */
  1188. break;
  1189. }
  1190. }
  1191. /*
  1192. * Process incoming FLOGI
  1193. */
  1194. static void
  1195. bfa_fcs_fabric_process_flogi(struct bfa_fcs_fabric_s *fabric,
  1196. struct fchs_s *fchs, u16 len)
  1197. {
  1198. struct fc_logi_s *flogi = (struct fc_logi_s *) (fchs + 1);
  1199. struct bfa_fcs_lport_s *bport = &fabric->bport;
  1200. bfa_trc(fabric->fcs, fchs->s_id);
  1201. fabric->stats.flogi_rcvd++;
  1202. /*
  1203. * Check port type. It should be 0 = n-port.
  1204. */
  1205. if (flogi->csp.port_type) {
  1206. /*
  1207. * @todo: may need to send a LS_RJT
  1208. */
  1209. bfa_trc(fabric->fcs, flogi->port_name);
  1210. fabric->stats.flogi_rejected++;
  1211. return;
  1212. }
  1213. fabric->bb_credit = be16_to_cpu(flogi->csp.bbcred);
  1214. fabric->lps->pr_bbscn = (be16_to_cpu(flogi->csp.rxsz) >> 12);
  1215. bport->port_topo.pn2n.rem_port_wwn = flogi->port_name;
  1216. bport->port_topo.pn2n.reply_oxid = fchs->ox_id;
  1217. /*
  1218. * Send a Flogi Acc
  1219. */
  1220. bfa_fcs_fabric_send_flogi_acc(fabric);
  1221. bfa_sm_send_event(fabric, BFA_FCS_FABRIC_SM_NO_FABRIC);
  1222. }
  1223. static void
  1224. bfa_fcs_fabric_send_flogi_acc(struct bfa_fcs_fabric_s *fabric)
  1225. {
  1226. struct bfa_lport_cfg_s *pcfg = &fabric->bport.port_cfg;
  1227. struct bfa_fcs_lport_n2n_s *n2n_port = &fabric->bport.port_topo.pn2n;
  1228. struct bfa_s *bfa = fabric->fcs->bfa;
  1229. struct bfa_fcxp_s *fcxp;
  1230. u16 reqlen;
  1231. struct fchs_s fchs;
  1232. fcxp = bfa_fcs_fcxp_alloc(fabric->fcs, BFA_FALSE);
  1233. /*
  1234. * Do not expect this failure -- expect remote node to retry
  1235. */
  1236. if (!fcxp)
  1237. return;
  1238. reqlen = fc_flogi_acc_build(&fchs, bfa_fcxp_get_reqbuf(fcxp),
  1239. bfa_hton3b(FC_FABRIC_PORT),
  1240. n2n_port->reply_oxid, pcfg->pwwn,
  1241. pcfg->nwwn,
  1242. bfa_fcport_get_maxfrsize(bfa),
  1243. bfa_fcport_get_rx_bbcredit(bfa),
  1244. bfa_fcs_fabric_oper_bbscn(fabric));
  1245. bfa_fcxp_send(fcxp, NULL, fabric->vf_id, fabric->lps->bfa_tag,
  1246. BFA_FALSE, FC_CLASS_3,
  1247. reqlen, &fchs, bfa_fcs_fabric_flogiacc_comp, fabric,
  1248. FC_MAX_PDUSZ, 0);
  1249. }
  1250. /*
  1251. * Flogi Acc completion callback.
  1252. */
  1253. static void
  1254. bfa_fcs_fabric_flogiacc_comp(void *fcsarg, struct bfa_fcxp_s *fcxp, void *cbarg,
  1255. bfa_status_t status, u32 rsp_len,
  1256. u32 resid_len, struct fchs_s *rspfchs)
  1257. {
  1258. struct bfa_fcs_fabric_s *fabric = cbarg;
  1259. bfa_trc(fabric->fcs, status);
  1260. }
  1261. /*
  1262. * Send AEN notification
  1263. */
  1264. static void
  1265. bfa_fcs_fabric_aen_post(struct bfa_fcs_lport_s *port,
  1266. enum bfa_port_aen_event event)
  1267. {
  1268. struct bfad_s *bfad = (struct bfad_s *)port->fabric->fcs->bfad;
  1269. struct bfa_aen_entry_s *aen_entry;
  1270. bfad_get_aen_entry(bfad, aen_entry);
  1271. if (!aen_entry)
  1272. return;
  1273. aen_entry->aen_data.port.pwwn = bfa_fcs_lport_get_pwwn(port);
  1274. aen_entry->aen_data.port.fwwn = bfa_fcs_lport_get_fabric_name(port);
  1275. /* Send the AEN notification */
  1276. bfad_im_post_vendor_event(aen_entry, bfad, ++port->fcs->fcs_aen_seq,
  1277. BFA_AEN_CAT_PORT, event);
  1278. }
  1279. /*
  1280. *
  1281. * @param[in] fabric - fabric
  1282. * @param[in] wwn_t - new fabric name
  1283. *
  1284. * @return - none
  1285. */
  1286. void
  1287. bfa_fcs_fabric_set_fabric_name(struct bfa_fcs_fabric_s *fabric,
  1288. wwn_t fabric_name)
  1289. {
  1290. struct bfad_s *bfad = (struct bfad_s *)fabric->fcs->bfad;
  1291. char pwwn_ptr[BFA_STRING_32];
  1292. char fwwn_ptr[BFA_STRING_32];
  1293. bfa_trc(fabric->fcs, fabric_name);
  1294. if (fabric->fabric_name == 0) {
  1295. /*
  1296. * With BRCD switches, we don't get Fabric Name in FLOGI.
  1297. * Don't generate a fabric name change event in this case.
  1298. */
  1299. fabric->fabric_name = fabric_name;
  1300. } else {
  1301. fabric->fabric_name = fabric_name;
  1302. wwn2str(pwwn_ptr, bfa_fcs_lport_get_pwwn(&fabric->bport));
  1303. wwn2str(fwwn_ptr,
  1304. bfa_fcs_lport_get_fabric_name(&fabric->bport));
  1305. BFA_LOG(KERN_WARNING, bfad, bfa_log_level,
  1306. "Base port WWN = %s Fabric WWN = %s\n",
  1307. pwwn_ptr, fwwn_ptr);
  1308. bfa_fcs_fabric_aen_post(&fabric->bport,
  1309. BFA_PORT_AEN_FABRIC_NAME_CHANGE);
  1310. }
  1311. }
  1312. void
  1313. bfa_cb_lps_flogo_comp(void *bfad, void *uarg)
  1314. {
  1315. struct bfa_fcs_fabric_s *fabric = uarg;
  1316. bfa_sm_send_event(fabric, BFA_FCS_FABRIC_SM_LOGOCOMP);
  1317. }
  1318. /*
  1319. * Returns FCS vf structure for a given vf_id.
  1320. *
  1321. * param[in] vf_id - VF_ID
  1322. *
  1323. * return
  1324. * If lookup succeeds, retuns fcs vf object, otherwise returns NULL
  1325. */
  1326. bfa_fcs_vf_t *
  1327. bfa_fcs_vf_lookup(struct bfa_fcs_s *fcs, u16 vf_id)
  1328. {
  1329. bfa_trc(fcs, vf_id);
  1330. if (vf_id == FC_VF_ID_NULL)
  1331. return &fcs->fabric;
  1332. return NULL;
  1333. }
  1334. /*
  1335. * Return the list of local logical ports present in the given VF.
  1336. *
  1337. * @param[in] vf vf for which logical ports are returned
  1338. * @param[out] lpwwn returned logical port wwn list
  1339. * @param[in,out] nlports in:size of lpwwn list;
  1340. * out:total elements present,
  1341. * actual elements returned is limited by the size
  1342. */
  1343. void
  1344. bfa_fcs_vf_get_ports(bfa_fcs_vf_t *vf, wwn_t lpwwn[], int *nlports)
  1345. {
  1346. struct list_head *qe;
  1347. struct bfa_fcs_vport_s *vport;
  1348. int i = 0;
  1349. struct bfa_fcs_s *fcs;
  1350. if (vf == NULL || lpwwn == NULL || *nlports == 0)
  1351. return;
  1352. fcs = vf->fcs;
  1353. bfa_trc(fcs, vf->vf_id);
  1354. bfa_trc(fcs, (uint32_t) *nlports);
  1355. lpwwn[i++] = vf->bport.port_cfg.pwwn;
  1356. list_for_each(qe, &vf->vport_q) {
  1357. if (i >= *nlports)
  1358. break;
  1359. vport = (struct bfa_fcs_vport_s *) qe;
  1360. lpwwn[i++] = vport->lport.port_cfg.pwwn;
  1361. }
  1362. bfa_trc(fcs, i);
  1363. *nlports = i;
  1364. }
  1365. /*
  1366. * BFA FCS PPORT ( physical port)
  1367. */
  1368. static void
  1369. bfa_fcs_port_event_handler(void *cbarg, enum bfa_port_linkstate event)
  1370. {
  1371. struct bfa_fcs_s *fcs = cbarg;
  1372. bfa_trc(fcs, event);
  1373. switch (event) {
  1374. case BFA_PORT_LINKUP:
  1375. bfa_fcs_fabric_link_up(&fcs->fabric);
  1376. break;
  1377. case BFA_PORT_LINKDOWN:
  1378. bfa_fcs_fabric_link_down(&fcs->fabric);
  1379. break;
  1380. default:
  1381. WARN_ON(1);
  1382. }
  1383. }
  1384. void
  1385. bfa_fcs_port_attach(struct bfa_fcs_s *fcs)
  1386. {
  1387. bfa_fcport_event_register(fcs->bfa, bfa_fcs_port_event_handler, fcs);
  1388. }
  1389. /*
  1390. * BFA FCS UF ( Unsolicited Frames)
  1391. */
  1392. /*
  1393. * BFA callback for unsolicited frame receive handler.
  1394. *
  1395. * @param[in] cbarg callback arg for receive handler
  1396. * @param[in] uf unsolicited frame descriptor
  1397. *
  1398. * @return None
  1399. */
  1400. static void
  1401. bfa_fcs_uf_recv(void *cbarg, struct bfa_uf_s *uf)
  1402. {
  1403. struct bfa_fcs_s *fcs = (struct bfa_fcs_s *) cbarg;
  1404. struct fchs_s *fchs = bfa_uf_get_frmbuf(uf);
  1405. u16 len = bfa_uf_get_frmlen(uf);
  1406. struct fc_vft_s *vft;
  1407. struct bfa_fcs_fabric_s *fabric;
  1408. /*
  1409. * check for VFT header
  1410. */
  1411. if (fchs->routing == FC_RTG_EXT_HDR &&
  1412. fchs->cat_info == FC_CAT_VFT_HDR) {
  1413. bfa_stats(fcs, uf.tagged);
  1414. vft = bfa_uf_get_frmbuf(uf);
  1415. if (fcs->port_vfid == vft->vf_id)
  1416. fabric = &fcs->fabric;
  1417. else
  1418. fabric = bfa_fcs_vf_lookup(fcs, (u16) vft->vf_id);
  1419. /*
  1420. * drop frame if vfid is unknown
  1421. */
  1422. if (!fabric) {
  1423. WARN_ON(1);
  1424. bfa_stats(fcs, uf.vfid_unknown);
  1425. bfa_uf_free(uf);
  1426. return;
  1427. }
  1428. /*
  1429. * skip vft header
  1430. */
  1431. fchs = (struct fchs_s *) (vft + 1);
  1432. len -= sizeof(struct fc_vft_s);
  1433. bfa_trc(fcs, vft->vf_id);
  1434. } else {
  1435. bfa_stats(fcs, uf.untagged);
  1436. fabric = &fcs->fabric;
  1437. }
  1438. bfa_trc(fcs, ((u32 *) fchs)[0]);
  1439. bfa_trc(fcs, ((u32 *) fchs)[1]);
  1440. bfa_trc(fcs, ((u32 *) fchs)[2]);
  1441. bfa_trc(fcs, ((u32 *) fchs)[3]);
  1442. bfa_trc(fcs, ((u32 *) fchs)[4]);
  1443. bfa_trc(fcs, ((u32 *) fchs)[5]);
  1444. bfa_trc(fcs, len);
  1445. bfa_fcs_fabric_uf_recv(fabric, fchs, len);
  1446. bfa_uf_free(uf);
  1447. }
  1448. void
  1449. bfa_fcs_uf_attach(struct bfa_fcs_s *fcs)
  1450. {
  1451. bfa_uf_recv_register(fcs->bfa, bfa_fcs_uf_recv, fcs);
  1452. }