bfa_fcs.c 41 KB

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