blob: 6c8a27e7897431f8237c49e0965363e82ef68743 [file] [log] [blame]
Jing Huang7725ccf2009-09-23 17:46:15 -07001/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07002 * Copyright (c) 2005-2010 Brocade Communications Systems, Inc.
Jing Huang7725ccf2009-09-23 17:46:15 -07003 * 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
Jing Huang5fbe25c2010-10-18 17:17:23 -070018/*
Jing Huang7725ccf2009-09-23 17:46:15 -070019 * bfa_fcs.c BFA FCS main
20 */
21
Maggie Zhangf16a1752010-12-09 19:12:32 -080022#include "bfad_drv.h"
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070023#include "bfa_fcs.h"
24#include "bfa_fcbuild.h"
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070025
26BFA_TRC_FILE(FCS, FCS);
Jing Huang7725ccf2009-09-23 17:46:15 -070027
Jing Huang5fbe25c2010-10-18 17:17:23 -070028/*
Jing Huang7725ccf2009-09-23 17:46:15 -070029 * FCS sub-modules
30 */
31struct bfa_fcs_mod_s {
Krishna Gudipati82794a22010-03-03 17:43:30 -080032 void (*attach) (struct bfa_fcs_s *fcs);
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070033 void (*modinit) (struct bfa_fcs_s *fcs);
34 void (*modexit) (struct bfa_fcs_s *fcs);
Jing Huang7725ccf2009-09-23 17:46:15 -070035};
36
37#define BFA_FCS_MODULE(_mod) { _mod ## _modinit, _mod ## _modexit }
38
39static struct bfa_fcs_mod_s fcs_modules[] = {
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070040 { bfa_fcs_port_attach, NULL, NULL },
Krishna Gudipati82794a22010-03-03 17:43:30 -080041 { bfa_fcs_uf_attach, NULL, NULL },
42 { bfa_fcs_fabric_attach, bfa_fcs_fabric_modinit,
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070043 bfa_fcs_fabric_modexit },
Jing Huang7725ccf2009-09-23 17:46:15 -070044};
45
Jing Huang5fbe25c2010-10-18 17:17:23 -070046/*
Jing Huang7725ccf2009-09-23 17:46:15 -070047 * fcs_api BFA FCS API
48 */
49
50static void
51bfa_fcs_exit_comp(void *fcs_cbarg)
52{
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070053 struct bfa_fcs_s *fcs = fcs_cbarg;
54 struct bfad_s *bfad = fcs->bfad;
Jing Huang7725ccf2009-09-23 17:46:15 -070055
56 complete(&bfad->comp);
57}
58
59
60
Jing Huang5fbe25c2010-10-18 17:17:23 -070061/*
Jing Huang7725ccf2009-09-23 17:46:15 -070062 * fcs_api BFA FCS API
63 */
64
Jing Huang5fbe25c2010-10-18 17:17:23 -070065/*
Krishna Gudipati82794a22010-03-03 17:43:30 -080066 * fcs attach -- called once to initialize data structures at driver attach time
Jing Huang7725ccf2009-09-23 17:46:15 -070067 */
68void
Krishna Gudipati82794a22010-03-03 17:43:30 -080069bfa_fcs_attach(struct bfa_fcs_s *fcs, struct bfa_s *bfa, struct bfad_s *bfad,
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070070 bfa_boolean_t min_cfg)
Jing Huang7725ccf2009-09-23 17:46:15 -070071{
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070072 int i;
Jing Huang7725ccf2009-09-23 17:46:15 -070073 struct bfa_fcs_mod_s *mod;
74
75 fcs->bfa = bfa;
76 fcs->bfad = bfad;
77 fcs->min_cfg = min_cfg;
78
Maggie Zhangf7f738122010-12-09 19:08:43 -080079 bfa->fcs = BFA_TRUE;
Jing Huang7725ccf2009-09-23 17:46:15 -070080 fcbuild_init();
81
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070082 for (i = 0; i < sizeof(fcs_modules) / sizeof(fcs_modules[0]); i++) {
Jing Huang7725ccf2009-09-23 17:46:15 -070083 mod = &fcs_modules[i];
Krishna Gudipati82794a22010-03-03 17:43:30 -080084 if (mod->attach)
85 mod->attach(fcs);
86 }
87}
88
Jing Huang5fbe25c2010-10-18 17:17:23 -070089/*
Krishna Gudipati82794a22010-03-03 17:43:30 -080090 * fcs initialization, called once after bfa initialization is complete
91 */
92void
93bfa_fcs_init(struct bfa_fcs_s *fcs)
94{
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070095 int i, npbc_vports;
Krishna Gudipati82794a22010-03-03 17:43:30 -080096 struct bfa_fcs_mod_s *mod;
Jing Huangd9883542010-07-08 19:46:26 -070097 struct bfi_pbc_vport_s pbc_vports[BFI_PBC_MAX_VPORTS];
Krishna Gudipati82794a22010-03-03 17:43:30 -080098
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070099 for (i = 0; i < sizeof(fcs_modules) / sizeof(fcs_modules[0]); i++) {
Krishna Gudipati82794a22010-03-03 17:43:30 -0800100 mod = &fcs_modules[i];
101 if (mod->modinit)
102 mod->modinit(fcs);
Jing Huang7725ccf2009-09-23 17:46:15 -0700103 }
Jing Huangd9883542010-07-08 19:46:26 -0700104 /* Initialize pbc vports */
105 if (!fcs->min_cfg) {
106 npbc_vports =
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700107 bfa_iocfc_get_pbc_vports(fcs->bfa, pbc_vports);
Jing Huangd9883542010-07-08 19:46:26 -0700108 for (i = 0; i < npbc_vports; i++)
109 bfa_fcb_pbc_vport_create(fcs->bfa->bfad, pbc_vports[i]);
110 }
Jing Huang7725ccf2009-09-23 17:46:15 -0700111}
112
Jing Huang7725ccf2009-09-23 17:46:15 -0700113
Jing Huang5fbe25c2010-10-18 17:17:23 -0700114/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700115 * brief
116 * FCS driver details initialization.
Jing Huang7725ccf2009-09-23 17:46:15 -0700117 *
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700118 * param[in] fcs FCS instance
119 * param[in] driver_info Driver Details
Jing Huang7725ccf2009-09-23 17:46:15 -0700120 *
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700121 * return None
Jing Huang7725ccf2009-09-23 17:46:15 -0700122 */
123void
124bfa_fcs_driver_info_init(struct bfa_fcs_s *fcs,
125 struct bfa_fcs_driver_info_s *driver_info)
126{
127
128 fcs->driver_info = *driver_info;
129
130 bfa_fcs_fabric_psymb_init(&fcs->fabric);
131}
132
Jing Huang5fbe25c2010-10-18 17:17:23 -0700133/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700134 * brief
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700135 * FCS instance cleanup and exit.
Jing Huang7725ccf2009-09-23 17:46:15 -0700136 *
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700137 * param[in] fcs FCS instance
138 * return None
Jing Huang7725ccf2009-09-23 17:46:15 -0700139 */
140void
141bfa_fcs_exit(struct bfa_fcs_s *fcs)
142{
143 struct bfa_fcs_mod_s *mod;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700144 int nmods, i;
Jing Huang7725ccf2009-09-23 17:46:15 -0700145
146 bfa_wc_init(&fcs->wc, bfa_fcs_exit_comp, fcs);
147
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700148 nmods = sizeof(fcs_modules) / sizeof(fcs_modules[0]);
149
150 for (i = 0; i < nmods; i++) {
Jing Huang7725ccf2009-09-23 17:46:15 -0700151
152 mod = &fcs_modules[i];
Krishna Gudipati82794a22010-03-03 17:43:30 -0800153 if (mod->modexit) {
154 bfa_wc_up(&fcs->wc);
155 mod->modexit(fcs);
156 }
Jing Huang7725ccf2009-09-23 17:46:15 -0700157 }
158
159 bfa_wc_wait(&fcs->wc);
160}
161
162
Jing Huang5fbe25c2010-10-18 17:17:23 -0700163/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700164 * Fabric module implementation.
165 */
Jing Huang7725ccf2009-09-23 17:46:15 -0700166
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700167#define BFA_FCS_FABRIC_RETRY_DELAY (2000) /* Milliseconds */
168#define BFA_FCS_FABRIC_CLEANUP_DELAY (10000) /* Milliseconds */
169
170#define bfa_fcs_fabric_set_opertype(__fabric) do { \
171 if (bfa_fcport_get_topology((__fabric)->fcs->bfa) \
172 == BFA_PORT_TOPOLOGY_P2P) \
173 (__fabric)->oper_type = BFA_PORT_TYPE_NPORT; \
174 else \
175 (__fabric)->oper_type = BFA_PORT_TYPE_NLPORT; \
176} while (0)
177
178/*
179 * forward declarations
180 */
181static void bfa_fcs_fabric_init(struct bfa_fcs_fabric_s *fabric);
182static void bfa_fcs_fabric_login(struct bfa_fcs_fabric_s *fabric);
183static void bfa_fcs_fabric_notify_online(struct bfa_fcs_fabric_s *fabric);
184static void bfa_fcs_fabric_notify_offline(struct bfa_fcs_fabric_s *fabric);
185static void bfa_fcs_fabric_delay(void *cbarg);
186static void bfa_fcs_fabric_delete(struct bfa_fcs_fabric_s *fabric);
187static void bfa_fcs_fabric_delete_comp(void *cbarg);
188static void bfa_fcs_fabric_process_uf(struct bfa_fcs_fabric_s *fabric,
189 struct fchs_s *fchs, u16 len);
190static void bfa_fcs_fabric_process_flogi(struct bfa_fcs_fabric_s *fabric,
191 struct fchs_s *fchs, u16 len);
192static void bfa_fcs_fabric_send_flogi_acc(struct bfa_fcs_fabric_s *fabric);
193static void bfa_fcs_fabric_flogiacc_comp(void *fcsarg,
194 struct bfa_fcxp_s *fcxp, void *cbarg,
195 bfa_status_t status,
196 u32 rsp_len,
197 u32 resid_len,
198 struct fchs_s *rspfchs);
Krishna Gudipatibe540a92011-06-13 15:53:04 -0700199static u8 bfa_fcs_fabric_oper_bbscn(struct bfa_fcs_fabric_s *fabric);
200static bfa_boolean_t bfa_fcs_fabric_is_bbscn_enabled(
201 struct bfa_fcs_fabric_s *fabric);
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700202
203static void bfa_fcs_fabric_sm_uninit(struct bfa_fcs_fabric_s *fabric,
204 enum bfa_fcs_fabric_event event);
205static void bfa_fcs_fabric_sm_created(struct bfa_fcs_fabric_s *fabric,
206 enum bfa_fcs_fabric_event event);
207static void bfa_fcs_fabric_sm_linkdown(struct bfa_fcs_fabric_s *fabric,
208 enum bfa_fcs_fabric_event event);
209static void bfa_fcs_fabric_sm_flogi(struct bfa_fcs_fabric_s *fabric,
210 enum bfa_fcs_fabric_event event);
211static void bfa_fcs_fabric_sm_flogi_retry(struct bfa_fcs_fabric_s *fabric,
212 enum bfa_fcs_fabric_event event);
213static void bfa_fcs_fabric_sm_auth(struct bfa_fcs_fabric_s *fabric,
214 enum bfa_fcs_fabric_event event);
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700215static void bfa_fcs_fabric_sm_nofabric(struct bfa_fcs_fabric_s *fabric,
216 enum bfa_fcs_fabric_event event);
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700217static void bfa_fcs_fabric_sm_evfp(struct bfa_fcs_fabric_s *fabric,
218 enum bfa_fcs_fabric_event event);
219static void bfa_fcs_fabric_sm_evfp_done(struct bfa_fcs_fabric_s *fabric,
220 enum bfa_fcs_fabric_event event);
221static void bfa_fcs_fabric_sm_isolated(struct bfa_fcs_fabric_s *fabric,
222 enum bfa_fcs_fabric_event event);
223static void bfa_fcs_fabric_sm_deleting(struct bfa_fcs_fabric_s *fabric,
224 enum bfa_fcs_fabric_event event);
Jing Huang5fbe25c2010-10-18 17:17:23 -0700225/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700226 * Beginning state before fabric creation.
227 */
228static void
229bfa_fcs_fabric_sm_uninit(struct bfa_fcs_fabric_s *fabric,
230 enum bfa_fcs_fabric_event event)
231{
232 bfa_trc(fabric->fcs, fabric->bport.port_cfg.pwwn);
233 bfa_trc(fabric->fcs, event);
234
235 switch (event) {
236 case BFA_FCS_FABRIC_SM_CREATE:
237 bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_created);
238 bfa_fcs_fabric_init(fabric);
239 bfa_fcs_lport_init(&fabric->bport, &fabric->bport.port_cfg);
240 break;
241
242 case BFA_FCS_FABRIC_SM_LINK_UP:
243 case BFA_FCS_FABRIC_SM_LINK_DOWN:
244 break;
245
246 default:
247 bfa_sm_fault(fabric->fcs, event);
248 }
249}
250
Jing Huang5fbe25c2010-10-18 17:17:23 -0700251/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700252 * Beginning state before fabric creation.
253 */
254static void
255bfa_fcs_fabric_sm_created(struct bfa_fcs_fabric_s *fabric,
256 enum bfa_fcs_fabric_event event)
257{
258 bfa_trc(fabric->fcs, fabric->bport.port_cfg.pwwn);
259 bfa_trc(fabric->fcs, event);
260
261 switch (event) {
262 case BFA_FCS_FABRIC_SM_START:
263 if (bfa_fcport_is_linkup(fabric->fcs->bfa)) {
264 bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_flogi);
265 bfa_fcs_fabric_login(fabric);
266 } else
267 bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_linkdown);
268 break;
269
270 case BFA_FCS_FABRIC_SM_LINK_UP:
271 case BFA_FCS_FABRIC_SM_LINK_DOWN:
272 break;
273
274 case BFA_FCS_FABRIC_SM_DELETE:
Krishna Gudipatidd5aaf42011-06-13 15:51:24 -0700275 bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_deleting);
276 bfa_fcs_fabric_delete(fabric);
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700277 break;
278
279 default:
280 bfa_sm_fault(fabric->fcs, event);
281 }
282}
283
Jing Huang5fbe25c2010-10-18 17:17:23 -0700284/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700285 * Link is down, awaiting LINK UP event from port. This is also the
286 * first state at fabric creation.
287 */
288static void
289bfa_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
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
301 case BFA_FCS_FABRIC_SM_RETRY_OP:
302 break;
303
304 case BFA_FCS_FABRIC_SM_DELETE:
305 bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_deleting);
306 bfa_fcs_fabric_delete(fabric);
307 break;
308
309 default:
310 bfa_sm_fault(fabric->fcs, event);
311 }
312}
313
Jing Huang5fbe25c2010-10-18 17:17:23 -0700314/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700315 * FLOGI is in progress, awaiting FLOGI reply.
316 */
317static void
318bfa_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
324 switch (event) {
325 case BFA_FCS_FABRIC_SM_CONT_OP:
326
327 bfa_fcport_set_tx_bbcredit(fabric->fcs->bfa,
Krishna Gudipatibe540a92011-06-13 15:53:04 -0700328 fabric->bb_credit,
329 bfa_fcs_fabric_oper_bbscn(fabric));
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700330 fabric->fab_type = BFA_FCS_FABRIC_SWITCHED;
331
332 if (fabric->auth_reqd && fabric->is_auth) {
333 bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_auth);
334 bfa_trc(fabric->fcs, event);
335 } else {
336 bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_online);
337 bfa_fcs_fabric_notify_online(fabric);
338 }
339 break;
340
341 case BFA_FCS_FABRIC_SM_RETRY_OP:
342 bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_flogi_retry);
343 bfa_timer_start(fabric->fcs->bfa, &fabric->delay_timer,
344 bfa_fcs_fabric_delay, fabric,
345 BFA_FCS_FABRIC_RETRY_DELAY);
346 break;
347
348 case BFA_FCS_FABRIC_SM_LOOPBACK:
349 bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_loopback);
Maggie Zhangf7f738122010-12-09 19:08:43 -0800350 bfa_sm_send_event(fabric->lps, BFA_LPS_SM_OFFLINE);
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700351 bfa_fcs_fabric_set_opertype(fabric);
352 break;
353
354 case BFA_FCS_FABRIC_SM_NO_FABRIC:
355 fabric->fab_type = BFA_FCS_FABRIC_N2N;
356 bfa_fcport_set_tx_bbcredit(fabric->fcs->bfa,
Krishna Gudipatibe540a92011-06-13 15:53:04 -0700357 fabric->bb_credit,
358 bfa_fcs_fabric_oper_bbscn(fabric));
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700359 bfa_fcs_fabric_notify_online(fabric);
360 bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_nofabric);
361 break;
362
363 case BFA_FCS_FABRIC_SM_LINK_DOWN:
364 bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_linkdown);
Maggie Zhangf7f738122010-12-09 19:08:43 -0800365 bfa_sm_send_event(fabric->lps, BFA_LPS_SM_OFFLINE);
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700366 break;
367
368 case BFA_FCS_FABRIC_SM_DELETE:
369 bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_deleting);
Maggie Zhangf7f738122010-12-09 19:08:43 -0800370 bfa_sm_send_event(fabric->lps, BFA_LPS_SM_OFFLINE);
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700371 bfa_fcs_fabric_delete(fabric);
372 break;
373
374 default:
375 bfa_sm_fault(fabric->fcs, event);
376 }
377}
378
379
380static void
381bfa_fcs_fabric_sm_flogi_retry(struct bfa_fcs_fabric_s *fabric,
382 enum bfa_fcs_fabric_event event)
383{
384 bfa_trc(fabric->fcs, fabric->bport.port_cfg.pwwn);
385 bfa_trc(fabric->fcs, event);
386
387 switch (event) {
388 case BFA_FCS_FABRIC_SM_DELAYED:
389 bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_flogi);
390 bfa_fcs_fabric_login(fabric);
391 break;
392
393 case BFA_FCS_FABRIC_SM_LINK_DOWN:
394 bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_linkdown);
395 bfa_timer_stop(&fabric->delay_timer);
396 break;
397
398 case BFA_FCS_FABRIC_SM_DELETE:
399 bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_deleting);
400 bfa_timer_stop(&fabric->delay_timer);
401 bfa_fcs_fabric_delete(fabric);
402 break;
403
404 default:
405 bfa_sm_fault(fabric->fcs, event);
406 }
407}
408
Jing Huang5fbe25c2010-10-18 17:17:23 -0700409/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700410 * Authentication is in progress, awaiting authentication results.
411 */
412static void
413bfa_fcs_fabric_sm_auth(struct bfa_fcs_fabric_s *fabric,
414 enum bfa_fcs_fabric_event event)
415{
416 bfa_trc(fabric->fcs, fabric->bport.port_cfg.pwwn);
417 bfa_trc(fabric->fcs, event);
418
419 switch (event) {
420 case BFA_FCS_FABRIC_SM_AUTH_FAILED:
421 bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_auth_failed);
Maggie Zhangf7f738122010-12-09 19:08:43 -0800422 bfa_sm_send_event(fabric->lps, BFA_LPS_SM_OFFLINE);
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700423 break;
424
425 case BFA_FCS_FABRIC_SM_AUTH_SUCCESS:
426 bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_online);
427 bfa_fcs_fabric_notify_online(fabric);
428 break;
429
430 case BFA_FCS_FABRIC_SM_PERF_EVFP:
431 bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_evfp);
432 break;
433
434 case BFA_FCS_FABRIC_SM_LINK_DOWN:
435 bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_linkdown);
Maggie Zhangf7f738122010-12-09 19:08:43 -0800436 bfa_sm_send_event(fabric->lps, BFA_LPS_SM_OFFLINE);
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700437 break;
438
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
444 default:
445 bfa_sm_fault(fabric->fcs, event);
446 }
447}
448
Jing Huang5fbe25c2010-10-18 17:17:23 -0700449/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700450 * Authentication failed
451 */
Maggie Zhangf7f738122010-12-09 19:08:43 -0800452void
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700453bfa_fcs_fabric_sm_auth_failed(struct bfa_fcs_fabric_s *fabric,
454 enum bfa_fcs_fabric_event event)
455{
456 bfa_trc(fabric->fcs, fabric->bport.port_cfg.pwwn);
457 bfa_trc(fabric->fcs, event);
458
459 switch (event) {
460 case BFA_FCS_FABRIC_SM_LINK_DOWN:
461 bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_linkdown);
462 bfa_fcs_fabric_notify_offline(fabric);
463 break;
464
465 case BFA_FCS_FABRIC_SM_DELETE:
466 bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_deleting);
467 bfa_fcs_fabric_delete(fabric);
468 break;
469
470 default:
471 bfa_sm_fault(fabric->fcs, event);
472 }
473}
474
Jing Huang5fbe25c2010-10-18 17:17:23 -0700475/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700476 * Port is in loopback mode.
477 */
Maggie Zhangf7f738122010-12-09 19:08:43 -0800478void
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700479bfa_fcs_fabric_sm_loopback(struct bfa_fcs_fabric_s *fabric,
480 enum bfa_fcs_fabric_event event)
481{
482 bfa_trc(fabric->fcs, fabric->bport.port_cfg.pwwn);
483 bfa_trc(fabric->fcs, event);
484
485 switch (event) {
486 case BFA_FCS_FABRIC_SM_LINK_DOWN:
487 bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_linkdown);
488 bfa_fcs_fabric_notify_offline(fabric);
489 break;
490
491 case BFA_FCS_FABRIC_SM_DELETE:
492 bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_deleting);
493 bfa_fcs_fabric_delete(fabric);
494 break;
495
496 default:
497 bfa_sm_fault(fabric->fcs, event);
498 }
499}
500
Jing Huang5fbe25c2010-10-18 17:17:23 -0700501/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700502 * There is no attached fabric - private loop or NPort-to-NPort topology.
503 */
504static void
505bfa_fcs_fabric_sm_nofabric(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
511 switch (event) {
512 case BFA_FCS_FABRIC_SM_LINK_DOWN:
513 bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_linkdown);
Maggie Zhangf7f738122010-12-09 19:08:43 -0800514 bfa_sm_send_event(fabric->lps, BFA_LPS_SM_OFFLINE);
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700515 bfa_fcs_fabric_notify_offline(fabric);
516 break;
517
518 case BFA_FCS_FABRIC_SM_DELETE:
519 bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_deleting);
520 bfa_fcs_fabric_delete(fabric);
521 break;
522
523 case BFA_FCS_FABRIC_SM_NO_FABRIC:
524 bfa_trc(fabric->fcs, fabric->bb_credit);
525 bfa_fcport_set_tx_bbcredit(fabric->fcs->bfa,
Krishna Gudipatibe540a92011-06-13 15:53:04 -0700526 fabric->bb_credit,
527 bfa_fcs_fabric_oper_bbscn(fabric));
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700528 break;
529
530 default:
531 bfa_sm_fault(fabric->fcs, event);
532 }
533}
534
Jing Huang5fbe25c2010-10-18 17:17:23 -0700535/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700536 * Fabric is online - normal operating state.
537 */
Maggie Zhangf7f738122010-12-09 19:08:43 -0800538void
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700539bfa_fcs_fabric_sm_online(struct bfa_fcs_fabric_s *fabric,
540 enum bfa_fcs_fabric_event event)
541{
542 bfa_trc(fabric->fcs, fabric->bport.port_cfg.pwwn);
543 bfa_trc(fabric->fcs, event);
544
545 switch (event) {
546 case BFA_FCS_FABRIC_SM_LINK_DOWN:
547 bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_linkdown);
Maggie Zhangf7f738122010-12-09 19:08:43 -0800548 bfa_sm_send_event(fabric->lps, BFA_LPS_SM_OFFLINE);
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700549 bfa_fcs_fabric_notify_offline(fabric);
550 break;
551
552 case BFA_FCS_FABRIC_SM_DELETE:
553 bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_deleting);
554 bfa_fcs_fabric_delete(fabric);
555 break;
556
557 case BFA_FCS_FABRIC_SM_AUTH_FAILED:
558 bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_auth_failed);
Maggie Zhangf7f738122010-12-09 19:08:43 -0800559 bfa_sm_send_event(fabric->lps, BFA_LPS_SM_OFFLINE);
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700560 break;
561
562 case BFA_FCS_FABRIC_SM_AUTH_SUCCESS:
563 break;
564
565 default:
566 bfa_sm_fault(fabric->fcs, event);
567 }
568}
569
Jing Huang5fbe25c2010-10-18 17:17:23 -0700570/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700571 * Exchanging virtual fabric parameters.
572 */
573static void
574bfa_fcs_fabric_sm_evfp(struct bfa_fcs_fabric_s *fabric,
575 enum bfa_fcs_fabric_event event)
576{
577 bfa_trc(fabric->fcs, fabric->bport.port_cfg.pwwn);
578 bfa_trc(fabric->fcs, event);
579
580 switch (event) {
581 case BFA_FCS_FABRIC_SM_CONT_OP:
582 bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_evfp_done);
583 break;
584
585 case BFA_FCS_FABRIC_SM_ISOLATE:
586 bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_isolated);
587 break;
588
589 default:
590 bfa_sm_fault(fabric->fcs, event);
591 }
592}
593
Jing Huang5fbe25c2010-10-18 17:17:23 -0700594/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700595 * EVFP exchange complete and VFT tagging is enabled.
596 */
597static void
598bfa_fcs_fabric_sm_evfp_done(struct bfa_fcs_fabric_s *fabric,
599 enum bfa_fcs_fabric_event event)
600{
601 bfa_trc(fabric->fcs, fabric->bport.port_cfg.pwwn);
602 bfa_trc(fabric->fcs, event);
603}
604
Jing Huang5fbe25c2010-10-18 17:17:23 -0700605/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700606 * Port is isolated after EVFP exchange due to VF_ID mismatch (N and F).
607 */
608static void
609bfa_fcs_fabric_sm_isolated(struct bfa_fcs_fabric_s *fabric,
610 enum bfa_fcs_fabric_event event)
611{
612 struct bfad_s *bfad = (struct bfad_s *)fabric->fcs->bfad;
613 char pwwn_ptr[BFA_STRING_32];
614
615 bfa_trc(fabric->fcs, fabric->bport.port_cfg.pwwn);
616 bfa_trc(fabric->fcs, event);
617 wwn2str(pwwn_ptr, fabric->bport.port_cfg.pwwn);
618
Jing Huang88166242010-12-09 17:11:53 -0800619 BFA_LOG(KERN_INFO, bfad, bfa_log_level,
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700620 "Port is isolated due to VF_ID mismatch. "
621 "PWWN: %s Port VF_ID: %04x switch port VF_ID: %04x.",
622 pwwn_ptr, fabric->fcs->port_vfid,
623 fabric->event_arg.swp_vfid);
624}
625
Jing Huang5fbe25c2010-10-18 17:17:23 -0700626/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700627 * Fabric is being deleted, awaiting vport delete completions.
628 */
629static void
630bfa_fcs_fabric_sm_deleting(struct bfa_fcs_fabric_s *fabric,
631 enum bfa_fcs_fabric_event event)
632{
633 bfa_trc(fabric->fcs, fabric->bport.port_cfg.pwwn);
634 bfa_trc(fabric->fcs, event);
635
636 switch (event) {
637 case BFA_FCS_FABRIC_SM_DELCOMP:
638 bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_uninit);
Maggie Zhangf7f738122010-12-09 19:08:43 -0800639 bfa_wc_down(&fabric->fcs->wc);
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700640 break;
641
642 case BFA_FCS_FABRIC_SM_LINK_UP:
643 break;
644
645 case BFA_FCS_FABRIC_SM_LINK_DOWN:
646 bfa_fcs_fabric_notify_offline(fabric);
647 break;
648
649 default:
650 bfa_sm_fault(fabric->fcs, event);
651 }
652}
653
654
655
Jing Huang5fbe25c2010-10-18 17:17:23 -0700656/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700657 * fcs_fabric_private fabric private functions
658 */
659
660static void
661bfa_fcs_fabric_init(struct bfa_fcs_fabric_s *fabric)
662{
663 struct bfa_lport_cfg_s *port_cfg = &fabric->bport.port_cfg;
664
665 port_cfg->roles = BFA_LPORT_ROLE_FCP_IM;
Maggie Zhangf7f738122010-12-09 19:08:43 -0800666 port_cfg->nwwn = fabric->fcs->bfa->ioc.attr->nwwn;
667 port_cfg->pwwn = fabric->fcs->bfa->ioc.attr->pwwn;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700668}
669
Jing Huang5fbe25c2010-10-18 17:17:23 -0700670/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700671 * Port Symbolic Name Creation for base port.
672 */
673void
674bfa_fcs_fabric_psymb_init(struct bfa_fcs_fabric_s *fabric)
675{
676 struct bfa_lport_cfg_s *port_cfg = &fabric->bport.port_cfg;
677 char model[BFA_ADAPTER_MODEL_NAME_LEN] = {0};
678 struct bfa_fcs_driver_info_s *driver_info = &fabric->fcs->driver_info;
679
680 bfa_ioc_get_adapter_model(&fabric->fcs->bfa->ioc, model);
681
682 /* Model name/number */
683 strncpy((char *)&port_cfg->sym_name, model,
684 BFA_FCS_PORT_SYMBNAME_MODEL_SZ);
685 strncat((char *)&port_cfg->sym_name, BFA_FCS_PORT_SYMBNAME_SEPARATOR,
686 sizeof(BFA_FCS_PORT_SYMBNAME_SEPARATOR));
687
688 /* Driver Version */
689 strncat((char *)&port_cfg->sym_name, (char *)driver_info->version,
690 BFA_FCS_PORT_SYMBNAME_VERSION_SZ);
691 strncat((char *)&port_cfg->sym_name, BFA_FCS_PORT_SYMBNAME_SEPARATOR,
692 sizeof(BFA_FCS_PORT_SYMBNAME_SEPARATOR));
693
694 /* Host machine name */
695 strncat((char *)&port_cfg->sym_name,
696 (char *)driver_info->host_machine_name,
697 BFA_FCS_PORT_SYMBNAME_MACHINENAME_SZ);
698 strncat((char *)&port_cfg->sym_name, BFA_FCS_PORT_SYMBNAME_SEPARATOR,
699 sizeof(BFA_FCS_PORT_SYMBNAME_SEPARATOR));
700
701 /*
702 * Host OS Info :
703 * If OS Patch Info is not there, do not truncate any bytes from the
704 * OS name string and instead copy the entire OS info string (64 bytes).
705 */
706 if (driver_info->host_os_patch[0] == '\0') {
707 strncat((char *)&port_cfg->sym_name,
708 (char *)driver_info->host_os_name,
709 BFA_FCS_OS_STR_LEN);
710 strncat((char *)&port_cfg->sym_name,
711 BFA_FCS_PORT_SYMBNAME_SEPARATOR,
712 sizeof(BFA_FCS_PORT_SYMBNAME_SEPARATOR));
713 } else {
714 strncat((char *)&port_cfg->sym_name,
715 (char *)driver_info->host_os_name,
716 BFA_FCS_PORT_SYMBNAME_OSINFO_SZ);
717 strncat((char *)&port_cfg->sym_name,
718 BFA_FCS_PORT_SYMBNAME_SEPARATOR,
719 sizeof(BFA_FCS_PORT_SYMBNAME_SEPARATOR));
720
721 /* Append host OS Patch Info */
722 strncat((char *)&port_cfg->sym_name,
723 (char *)driver_info->host_os_patch,
724 BFA_FCS_PORT_SYMBNAME_OSPATCH_SZ);
725 }
726
727 /* null terminate */
728 port_cfg->sym_name.symname[BFA_SYMNAME_MAXLEN - 1] = 0;
729}
730
Jing Huang5fbe25c2010-10-18 17:17:23 -0700731/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700732 * bfa lps login completion callback
733 */
734void
735bfa_cb_lps_flogi_comp(void *bfad, void *uarg, bfa_status_t status)
736{
737 struct bfa_fcs_fabric_s *fabric = uarg;
738
739 bfa_trc(fabric->fcs, fabric->bport.port_cfg.pwwn);
740 bfa_trc(fabric->fcs, status);
741
742 switch (status) {
743 case BFA_STATUS_OK:
744 fabric->stats.flogi_accepts++;
745 break;
746
747 case BFA_STATUS_INVALID_MAC:
748 /* Only for CNA */
749 fabric->stats.flogi_acc_err++;
750 bfa_sm_send_event(fabric, BFA_FCS_FABRIC_SM_RETRY_OP);
751
752 return;
753
754 case BFA_STATUS_EPROTOCOL:
Maggie Zhangf7f738122010-12-09 19:08:43 -0800755 switch (fabric->lps->ext_status) {
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700756 case BFA_EPROTO_BAD_ACCEPT:
757 fabric->stats.flogi_acc_err++;
758 break;
759
760 case BFA_EPROTO_UNKNOWN_RSP:
761 fabric->stats.flogi_unknown_rsp++;
762 break;
763
764 default:
765 break;
766 }
767 bfa_sm_send_event(fabric, BFA_FCS_FABRIC_SM_RETRY_OP);
768
769 return;
770
771 case BFA_STATUS_FABRIC_RJT:
772 fabric->stats.flogi_rejects++;
Krishna Gudipatibe540a92011-06-13 15:53:04 -0700773 if (fabric->lps->lsrjt_rsn == FC_LS_RJT_RSN_LOGICAL_ERROR &&
774 fabric->lps->lsrjt_expl == FC_LS_RJT_EXP_NO_ADDL_INFO)
775 fabric->fcs->bbscn_flogi_rjt = BFA_TRUE;
776
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700777 bfa_sm_send_event(fabric, BFA_FCS_FABRIC_SM_RETRY_OP);
778 return;
779
780 default:
781 fabric->stats.flogi_rsp_err++;
782 bfa_sm_send_event(fabric, BFA_FCS_FABRIC_SM_RETRY_OP);
783 return;
784 }
785
Maggie Zhangf7f738122010-12-09 19:08:43 -0800786 fabric->bb_credit = fabric->lps->pr_bbcred;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700787 bfa_trc(fabric->fcs, fabric->bb_credit);
788
Maggie Zhangf7f738122010-12-09 19:08:43 -0800789 if (!(fabric->lps->brcd_switch))
790 fabric->fabric_name = fabric->lps->pr_nwwn;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700791
792 /*
793 * Check port type. It should be 1 = F-port.
794 */
Maggie Zhangf7f738122010-12-09 19:08:43 -0800795 if (fabric->lps->fport) {
796 fabric->bport.pid = fabric->lps->lp_pid;
797 fabric->is_npiv = fabric->lps->npiv_en;
798 fabric->is_auth = fabric->lps->auth_req;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700799 bfa_sm_send_event(fabric, BFA_FCS_FABRIC_SM_CONT_OP);
800 } else {
801 /*
802 * Nport-2-Nport direct attached
803 */
804 fabric->bport.port_topo.pn2n.rem_port_wwn =
Maggie Zhangf7f738122010-12-09 19:08:43 -0800805 fabric->lps->pr_pwwn;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700806 bfa_sm_send_event(fabric, BFA_FCS_FABRIC_SM_NO_FABRIC);
807 }
808
809 bfa_trc(fabric->fcs, fabric->bport.pid);
810 bfa_trc(fabric->fcs, fabric->is_npiv);
811 bfa_trc(fabric->fcs, fabric->is_auth);
812}
Jing Huang5fbe25c2010-10-18 17:17:23 -0700813/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700814 * Allocate and send FLOGI.
815 */
816static void
817bfa_fcs_fabric_login(struct bfa_fcs_fabric_s *fabric)
818{
819 struct bfa_s *bfa = fabric->fcs->bfa;
820 struct bfa_lport_cfg_s *pcfg = &fabric->bport.port_cfg;
Krishna Gudipatibe540a92011-06-13 15:53:04 -0700821 u8 alpa = 0, bb_scn = 0;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700822
823 if (bfa_fcport_get_topology(bfa) == BFA_PORT_TOPOLOGY_LOOP)
824 alpa = bfa_fcport_get_myalpa(bfa);
825
Krishna Gudipatibe540a92011-06-13 15:53:04 -0700826 if (bfa_fcs_fabric_is_bbscn_enabled(fabric) &&
827 (!fabric->fcs->bbscn_flogi_rjt))
828 bb_scn = BFA_FCS_PORT_DEF_BB_SCN;
829
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700830 bfa_lps_flogi(fabric->lps, fabric, alpa, bfa_fcport_get_maxfrsize(bfa),
Krishna Gudipatibe540a92011-06-13 15:53:04 -0700831 pcfg->pwwn, pcfg->nwwn, fabric->auth_reqd, bb_scn);
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700832
833 fabric->stats.flogi_sent++;
834}
835
836static void
837bfa_fcs_fabric_notify_online(struct bfa_fcs_fabric_s *fabric)
838{
839 struct bfa_fcs_vport_s *vport;
840 struct list_head *qe, *qen;
841
842 bfa_trc(fabric->fcs, fabric->fabric_name);
843
844 bfa_fcs_fabric_set_opertype(fabric);
845 fabric->stats.fabric_onlines++;
846
Jing Huang5fbe25c2010-10-18 17:17:23 -0700847 /*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700848 * notify online event to base and then virtual ports
849 */
850 bfa_fcs_lport_online(&fabric->bport);
851
852 list_for_each_safe(qe, qen, &fabric->vport_q) {
853 vport = (struct bfa_fcs_vport_s *) qe;
854 bfa_fcs_vport_online(vport);
855 }
856}
857
858static void
859bfa_fcs_fabric_notify_offline(struct bfa_fcs_fabric_s *fabric)
860{
861 struct bfa_fcs_vport_s *vport;
862 struct list_head *qe, *qen;
863
864 bfa_trc(fabric->fcs, fabric->fabric_name);
865 fabric->stats.fabric_offlines++;
866
Jing Huang5fbe25c2010-10-18 17:17:23 -0700867 /*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700868 * notify offline event first to vports and then base port.
869 */
870 list_for_each_safe(qe, qen, &fabric->vport_q) {
871 vport = (struct bfa_fcs_vport_s *) qe;
872 bfa_fcs_vport_offline(vport);
873 }
874
875 bfa_fcs_lport_offline(&fabric->bport);
876
877 fabric->fabric_name = 0;
878 fabric->fabric_ip_addr[0] = 0;
879}
880
881static void
882bfa_fcs_fabric_delay(void *cbarg)
883{
884 struct bfa_fcs_fabric_s *fabric = cbarg;
885
886 bfa_sm_send_event(fabric, BFA_FCS_FABRIC_SM_DELAYED);
887}
888
Jing Huang5fbe25c2010-10-18 17:17:23 -0700889/*
Krishna Gudipatibe540a92011-06-13 15:53:04 -0700890 * Computes operating BB_SCN value
891 */
892static u8
893bfa_fcs_fabric_oper_bbscn(struct bfa_fcs_fabric_s *fabric)
894{
895 u8 pr_bbscn = fabric->lps->pr_bbscn;
896
897 if (!(fabric->fcs->bbscn_enabled && pr_bbscn))
898 return 0;
899
900 /* return max of local/remote bb_scn values */
901 return ((pr_bbscn > BFA_FCS_PORT_DEF_BB_SCN) ?
902 pr_bbscn : BFA_FCS_PORT_DEF_BB_SCN);
903}
904
905/*
906 * Check if BB_SCN can be enabled.
907 */
908static bfa_boolean_t
909bfa_fcs_fabric_is_bbscn_enabled(struct bfa_fcs_fabric_s *fabric)
910{
911 if (bfa_ioc_get_fcmode(&fabric->fcs->bfa->ioc) &&
912 fabric->fcs->bbscn_enabled &&
913 !bfa_fcport_is_qos_enabled(fabric->fcs->bfa) &&
914 !bfa_fcport_is_trunk_enabled(fabric->fcs->bfa))
915 return BFA_TRUE;
916 else
917 return BFA_FALSE;
918}
919
920/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700921 * Delete all vports and wait for vport delete completions.
922 */
923static void
924bfa_fcs_fabric_delete(struct bfa_fcs_fabric_s *fabric)
925{
926 struct bfa_fcs_vport_s *vport;
927 struct list_head *qe, *qen;
928
929 list_for_each_safe(qe, qen, &fabric->vport_q) {
930 vport = (struct bfa_fcs_vport_s *) qe;
931 bfa_fcs_vport_fcs_delete(vport);
932 }
933
934 bfa_fcs_lport_delete(&fabric->bport);
935 bfa_wc_wait(&fabric->wc);
936}
937
938static void
939bfa_fcs_fabric_delete_comp(void *cbarg)
940{
941 struct bfa_fcs_fabric_s *fabric = cbarg;
942
943 bfa_sm_send_event(fabric, BFA_FCS_FABRIC_SM_DELCOMP);
944}
945
Jing Huang5fbe25c2010-10-18 17:17:23 -0700946/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700947 * fcs_fabric_public fabric public functions
948 */
949
Jing Huang5fbe25c2010-10-18 17:17:23 -0700950/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700951 * Attach time initialization.
952 */
953void
954bfa_fcs_fabric_attach(struct bfa_fcs_s *fcs)
955{
956 struct bfa_fcs_fabric_s *fabric;
957
958 fabric = &fcs->fabric;
Jing Huang6a18b162010-10-18 17:08:54 -0700959 memset(fabric, 0, sizeof(struct bfa_fcs_fabric_s));
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700960
Jing Huang5fbe25c2010-10-18 17:17:23 -0700961 /*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700962 * 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);
Jing Huangd4b671c2010-12-26 21:46:35 -0800968 WARN_ON(!fabric->lps);
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700969
Jing Huang5fbe25c2010-10-18 17:17:23 -0700970 /*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700971 * 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
977 bfa_sm_set_state(fabric, bfa_fcs_fabric_sm_uninit);
978 bfa_fcs_lport_attach(&fabric->bport, fabric->fcs, FC_VF_ID_NULL, NULL);
979}
980
981void
982bfa_fcs_fabric_modinit(struct bfa_fcs_s *fcs)
983{
984 bfa_sm_send_event(&fcs->fabric, BFA_FCS_FABRIC_SM_CREATE);
985 bfa_trc(fcs, 0);
986}
987
Jing Huang5fbe25c2010-10-18 17:17:23 -0700988/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700989 * Module cleanup
990 */
991void
992bfa_fcs_fabric_modexit(struct bfa_fcs_s *fcs)
993{
994 struct bfa_fcs_fabric_s *fabric;
995
996 bfa_trc(fcs, 0);
997
Jing Huang5fbe25c2010-10-18 17:17:23 -0700998 /*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700999 * Cleanup base fabric.
1000 */
1001 fabric = &fcs->fabric;
1002 bfa_lps_delete(fabric->lps);
1003 bfa_sm_send_event(fabric, BFA_FCS_FABRIC_SM_DELETE);
1004}
1005
Jing Huang5fbe25c2010-10-18 17:17:23 -07001006/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001007 * Fabric module start -- kick starts FCS actions
1008 */
1009void
1010bfa_fcs_fabric_modstart(struct bfa_fcs_s *fcs)
1011{
1012 struct bfa_fcs_fabric_s *fabric;
1013
1014 bfa_trc(fcs, 0);
1015 fabric = &fcs->fabric;
1016 bfa_sm_send_event(fabric, BFA_FCS_FABRIC_SM_START);
1017}
1018
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001019
Jing Huang5fbe25c2010-10-18 17:17:23 -07001020/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001021 * Link up notification from BFA physical port module.
1022 */
1023void
1024bfa_fcs_fabric_link_up(struct bfa_fcs_fabric_s *fabric)
1025{
1026 bfa_trc(fabric->fcs, fabric->bport.port_cfg.pwwn);
1027 bfa_sm_send_event(fabric, BFA_FCS_FABRIC_SM_LINK_UP);
1028}
1029
Jing Huang5fbe25c2010-10-18 17:17:23 -07001030/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001031 * Link down notification from BFA physical port module.
1032 */
1033void
1034bfa_fcs_fabric_link_down(struct bfa_fcs_fabric_s *fabric)
1035{
1036 bfa_trc(fabric->fcs, fabric->bport.port_cfg.pwwn);
Krishna Gudipatibe540a92011-06-13 15:53:04 -07001037 fabric->fcs->bbscn_flogi_rjt = BFA_FALSE;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001038 bfa_sm_send_event(fabric, BFA_FCS_FABRIC_SM_LINK_DOWN);
1039}
1040
Jing Huang5fbe25c2010-10-18 17:17:23 -07001041/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001042 * 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 */
1052void
1053bfa_fcs_fabric_addvport(struct bfa_fcs_fabric_s *fabric,
1054 struct bfa_fcs_vport_s *vport)
1055{
Jing Huang5fbe25c2010-10-18 17:17:23 -07001056 /*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001057 * - add vport to fabric's vport_q
1058 */
1059 bfa_trc(fabric->fcs, fabric->vf_id);
1060
1061 list_add_tail(&vport->qe, &fabric->vport_q);
1062 fabric->num_vports++;
1063 bfa_wc_up(&fabric->wc);
1064}
1065
Jing Huang5fbe25c2010-10-18 17:17:23 -07001066/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001067 * A child vport is being deleted from fabric.
1068 *
1069 * Vport is being deleted.
1070 */
1071void
1072bfa_fcs_fabric_delvport(struct bfa_fcs_fabric_s *fabric,
1073 struct bfa_fcs_vport_s *vport)
1074{
1075 list_del(&vport->qe);
1076 fabric->num_vports--;
1077 bfa_wc_down(&fabric->wc);
1078}
1079
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001080
Jing Huang5fbe25c2010-10-18 17:17:23 -07001081/*
Lucas De Marchi25985ed2011-03-30 22:57:33 -03001082 * Lookup for a vport within a fabric given its pwwn
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001083 */
1084struct bfa_fcs_vport_s *
1085bfa_fcs_fabric_vport_lookup(struct bfa_fcs_fabric_s *fabric, wwn_t pwwn)
1086{
1087 struct bfa_fcs_vport_s *vport;
1088 struct list_head *qe;
1089
1090 list_for_each(qe, &fabric->vport_q) {
1091 vport = (struct bfa_fcs_vport_s *) qe;
1092 if (bfa_fcs_lport_get_pwwn(&vport->lport) == pwwn)
1093 return vport;
1094 }
1095
1096 return NULL;
1097}
1098
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001099
1100/*
1101 * Get OUI of the attached switch.
1102 *
1103 * Note : Use of this function should be avoided as much as possible.
1104 * This function should be used only if there is any requirement
1105* to check for FOS version below 6.3.
1106 * To check if the attached fabric is a brocade fabric, use
1107 * bfa_lps_is_brcd_fabric() which works for FOS versions 6.3
1108 * or above only.
1109 */
1110
1111u16
1112bfa_fcs_fabric_get_switch_oui(struct bfa_fcs_fabric_s *fabric)
1113{
1114 wwn_t fab_nwwn;
1115 u8 *tmp;
1116 u16 oui;
1117
Maggie Zhangf7f738122010-12-09 19:08:43 -08001118 fab_nwwn = fabric->lps->pr_nwwn;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001119
1120 tmp = (u8 *)&fab_nwwn;
1121 oui = (tmp[3] << 8) | tmp[4];
1122
1123 return oui;
1124}
Jing Huang5fbe25c2010-10-18 17:17:23 -07001125/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001126 * Unsolicited frame receive handling.
1127 */
1128void
1129bfa_fcs_fabric_uf_recv(struct bfa_fcs_fabric_s *fabric, struct fchs_s *fchs,
1130 u16 len)
1131{
1132 u32 pid = fchs->d_id;
1133 struct bfa_fcs_vport_s *vport;
1134 struct list_head *qe;
1135 struct fc_els_cmd_s *els_cmd = (struct fc_els_cmd_s *) (fchs + 1);
1136 struct fc_logi_s *flogi = (struct fc_logi_s *) els_cmd;
1137
1138 bfa_trc(fabric->fcs, len);
1139 bfa_trc(fabric->fcs, pid);
1140
Jing Huang5fbe25c2010-10-18 17:17:23 -07001141 /*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001142 * Look for our own FLOGI frames being looped back. This means an
1143 * external loopback cable is in place. Our own FLOGI frames are
1144 * sometimes looped back when switch port gets temporarily bypassed.
1145 */
Maggie Zhangf16a1752010-12-09 19:12:32 -08001146 if ((pid == bfa_ntoh3b(FC_FABRIC_PORT)) &&
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001147 (els_cmd->els_code == FC_ELS_FLOGI) &&
1148 (flogi->port_name == bfa_fcs_lport_get_pwwn(&fabric->bport))) {
1149 bfa_sm_send_event(fabric, BFA_FCS_FABRIC_SM_LOOPBACK);
1150 return;
1151 }
1152
Jing Huang5fbe25c2010-10-18 17:17:23 -07001153 /*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001154 * FLOGI/EVFP exchanges should be consumed by base fabric.
1155 */
Maggie Zhangf16a1752010-12-09 19:12:32 -08001156 if (fchs->d_id == bfa_hton3b(FC_FABRIC_PORT)) {
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001157 bfa_trc(fabric->fcs, pid);
1158 bfa_fcs_fabric_process_uf(fabric, fchs, len);
1159 return;
1160 }
1161
1162 if (fabric->bport.pid == pid) {
Jing Huang5fbe25c2010-10-18 17:17:23 -07001163 /*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001164 * All authentication frames should be routed to auth
1165 */
1166 bfa_trc(fabric->fcs, els_cmd->els_code);
1167 if (els_cmd->els_code == FC_ELS_AUTH) {
1168 bfa_trc(fabric->fcs, els_cmd->els_code);
1169 return;
1170 }
1171
1172 bfa_trc(fabric->fcs, *(u8 *) ((u8 *) fchs));
1173 bfa_fcs_lport_uf_recv(&fabric->bport, fchs, len);
1174 return;
1175 }
1176
Jing Huang5fbe25c2010-10-18 17:17:23 -07001177 /*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001178 * look for a matching local port ID
1179 */
1180 list_for_each(qe, &fabric->vport_q) {
1181 vport = (struct bfa_fcs_vport_s *) qe;
1182 if (vport->lport.pid == pid) {
1183 bfa_fcs_lport_uf_recv(&vport->lport, fchs, len);
1184 return;
1185 }
1186 }
1187 bfa_trc(fabric->fcs, els_cmd->els_code);
1188 bfa_fcs_lport_uf_recv(&fabric->bport, fchs, len);
1189}
1190
Jing Huang5fbe25c2010-10-18 17:17:23 -07001191/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001192 * Unsolicited frames to be processed by fabric.
1193 */
1194static void
1195bfa_fcs_fabric_process_uf(struct bfa_fcs_fabric_s *fabric, struct fchs_s *fchs,
1196 u16 len)
1197{
1198 struct fc_els_cmd_s *els_cmd = (struct fc_els_cmd_s *) (fchs + 1);
1199
1200 bfa_trc(fabric->fcs, els_cmd->els_code);
1201
1202 switch (els_cmd->els_code) {
1203 case FC_ELS_FLOGI:
1204 bfa_fcs_fabric_process_flogi(fabric, fchs, len);
1205 break;
1206
1207 default:
1208 /*
1209 * need to generate a LS_RJT
1210 */
1211 break;
1212 }
1213}
1214
Jing Huang5fbe25c2010-10-18 17:17:23 -07001215/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001216 * Process incoming FLOGI
1217 */
1218static void
1219bfa_fcs_fabric_process_flogi(struct bfa_fcs_fabric_s *fabric,
1220 struct fchs_s *fchs, u16 len)
1221{
1222 struct fc_logi_s *flogi = (struct fc_logi_s *) (fchs + 1);
1223 struct bfa_fcs_lport_s *bport = &fabric->bport;
1224
1225 bfa_trc(fabric->fcs, fchs->s_id);
1226
1227 fabric->stats.flogi_rcvd++;
1228 /*
1229 * Check port type. It should be 0 = n-port.
1230 */
1231 if (flogi->csp.port_type) {
1232 /*
1233 * @todo: may need to send a LS_RJT
1234 */
1235 bfa_trc(fabric->fcs, flogi->port_name);
1236 fabric->stats.flogi_rejected++;
1237 return;
1238 }
1239
Jing Huangba816ea2010-10-18 17:10:50 -07001240 fabric->bb_credit = be16_to_cpu(flogi->csp.bbcred);
Krishna Gudipatibe540a92011-06-13 15:53:04 -07001241 fabric->lps->pr_bbscn = (be16_to_cpu(flogi->csp.rxsz) >> 12);
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001242 bport->port_topo.pn2n.rem_port_wwn = flogi->port_name;
1243 bport->port_topo.pn2n.reply_oxid = fchs->ox_id;
1244
1245 /*
1246 * Send a Flogi Acc
1247 */
1248 bfa_fcs_fabric_send_flogi_acc(fabric);
1249 bfa_sm_send_event(fabric, BFA_FCS_FABRIC_SM_NO_FABRIC);
1250}
1251
1252static void
1253bfa_fcs_fabric_send_flogi_acc(struct bfa_fcs_fabric_s *fabric)
1254{
1255 struct bfa_lport_cfg_s *pcfg = &fabric->bport.port_cfg;
1256 struct bfa_fcs_lport_n2n_s *n2n_port = &fabric->bport.port_topo.pn2n;
1257 struct bfa_s *bfa = fabric->fcs->bfa;
1258 struct bfa_fcxp_s *fcxp;
1259 u16 reqlen;
1260 struct fchs_s fchs;
1261
1262 fcxp = bfa_fcs_fcxp_alloc(fabric->fcs);
Jing Huang5fbe25c2010-10-18 17:17:23 -07001263 /*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001264 * Do not expect this failure -- expect remote node to retry
1265 */
1266 if (!fcxp)
1267 return;
1268
1269 reqlen = fc_flogi_acc_build(&fchs, bfa_fcxp_get_reqbuf(fcxp),
Maggie Zhangf16a1752010-12-09 19:12:32 -08001270 bfa_hton3b(FC_FABRIC_PORT),
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001271 n2n_port->reply_oxid, pcfg->pwwn,
1272 pcfg->nwwn,
1273 bfa_fcport_get_maxfrsize(bfa),
Krishna Gudipatibe540a92011-06-13 15:53:04 -07001274 bfa_fcport_get_rx_bbcredit(bfa),
1275 bfa_fcs_fabric_oper_bbscn(fabric));
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001276
Maggie Zhangf7f738122010-12-09 19:08:43 -08001277 bfa_fcxp_send(fcxp, NULL, fabric->vf_id, fabric->lps->lp_tag,
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001278 BFA_FALSE, FC_CLASS_3,
1279 reqlen, &fchs, bfa_fcs_fabric_flogiacc_comp, fabric,
1280 FC_MAX_PDUSZ, 0);
1281}
1282
Jing Huang5fbe25c2010-10-18 17:17:23 -07001283/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001284 * Flogi Acc completion callback.
1285 */
1286static void
1287bfa_fcs_fabric_flogiacc_comp(void *fcsarg, struct bfa_fcxp_s *fcxp, void *cbarg,
1288 bfa_status_t status, u32 rsp_len,
1289 u32 resid_len, struct fchs_s *rspfchs)
1290{
1291 struct bfa_fcs_fabric_s *fabric = cbarg;
1292
1293 bfa_trc(fabric->fcs, status);
1294}
1295
1296/*
1297 *
1298 * @param[in] fabric - fabric
1299 * @param[in] wwn_t - new fabric name
1300 *
1301 * @return - none
1302 */
1303void
1304bfa_fcs_fabric_set_fabric_name(struct bfa_fcs_fabric_s *fabric,
1305 wwn_t fabric_name)
1306{
1307 struct bfad_s *bfad = (struct bfad_s *)fabric->fcs->bfad;
1308 char pwwn_ptr[BFA_STRING_32];
1309 char fwwn_ptr[BFA_STRING_32];
1310
1311 bfa_trc(fabric->fcs, fabric_name);
1312
1313 if (fabric->fabric_name == 0) {
1314 /*
1315 * With BRCD switches, we don't get Fabric Name in FLOGI.
1316 * Don't generate a fabric name change event in this case.
1317 */
1318 fabric->fabric_name = fabric_name;
1319 } else {
1320 fabric->fabric_name = fabric_name;
1321 wwn2str(pwwn_ptr, bfa_fcs_lport_get_pwwn(&fabric->bport));
1322 wwn2str(fwwn_ptr,
1323 bfa_fcs_lport_get_fabric_name(&fabric->bport));
Jing Huang88166242010-12-09 17:11:53 -08001324 BFA_LOG(KERN_WARNING, bfad, bfa_log_level,
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001325 "Base port WWN = %s Fabric WWN = %s\n",
1326 pwwn_ptr, fwwn_ptr);
1327 }
1328}
1329
Jing Huang5fbe25c2010-10-18 17:17:23 -07001330/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001331 * Returns FCS vf structure for a given vf_id.
1332 *
1333 * param[in] vf_id - VF_ID
1334 *
1335 * return
1336 * If lookup succeeds, retuns fcs vf object, otherwise returns NULL
1337 */
1338bfa_fcs_vf_t *
1339bfa_fcs_vf_lookup(struct bfa_fcs_s *fcs, u16 vf_id)
1340{
1341 bfa_trc(fcs, vf_id);
1342 if (vf_id == FC_VF_ID_NULL)
1343 return &fcs->fabric;
1344
1345 return NULL;
1346}
1347
Jing Huang5fbe25c2010-10-18 17:17:23 -07001348/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001349 * BFA FCS PPORT ( physical port)
1350 */
1351static void
1352bfa_fcs_port_event_handler(void *cbarg, enum bfa_port_linkstate event)
1353{
1354 struct bfa_fcs_s *fcs = cbarg;
1355
1356 bfa_trc(fcs, event);
1357
1358 switch (event) {
1359 case BFA_PORT_LINKUP:
1360 bfa_fcs_fabric_link_up(&fcs->fabric);
1361 break;
1362
1363 case BFA_PORT_LINKDOWN:
1364 bfa_fcs_fabric_link_down(&fcs->fabric);
1365 break;
1366
1367 default:
Jing Huangd4b671c2010-12-26 21:46:35 -08001368 WARN_ON(1);
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001369 }
1370}
1371
1372void
1373bfa_fcs_port_attach(struct bfa_fcs_s *fcs)
1374{
1375 bfa_fcport_event_register(fcs->bfa, bfa_fcs_port_event_handler, fcs);
1376}
1377
Jing Huang5fbe25c2010-10-18 17:17:23 -07001378/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001379 * BFA FCS UF ( Unsolicited Frames)
1380 */
1381
Jing Huang5fbe25c2010-10-18 17:17:23 -07001382/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001383 * BFA callback for unsolicited frame receive handler.
1384 *
1385 * @param[in] cbarg callback arg for receive handler
1386 * @param[in] uf unsolicited frame descriptor
1387 *
1388 * @return None
1389 */
1390static void
1391bfa_fcs_uf_recv(void *cbarg, struct bfa_uf_s *uf)
1392{
1393 struct bfa_fcs_s *fcs = (struct bfa_fcs_s *) cbarg;
1394 struct fchs_s *fchs = bfa_uf_get_frmbuf(uf);
1395 u16 len = bfa_uf_get_frmlen(uf);
1396 struct fc_vft_s *vft;
1397 struct bfa_fcs_fabric_s *fabric;
1398
Jing Huang5fbe25c2010-10-18 17:17:23 -07001399 /*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001400 * check for VFT header
1401 */
1402 if (fchs->routing == FC_RTG_EXT_HDR &&
1403 fchs->cat_info == FC_CAT_VFT_HDR) {
1404 bfa_stats(fcs, uf.tagged);
1405 vft = bfa_uf_get_frmbuf(uf);
1406 if (fcs->port_vfid == vft->vf_id)
1407 fabric = &fcs->fabric;
1408 else
1409 fabric = bfa_fcs_vf_lookup(fcs, (u16) vft->vf_id);
1410
Jing Huang5fbe25c2010-10-18 17:17:23 -07001411 /*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001412 * drop frame if vfid is unknown
1413 */
1414 if (!fabric) {
Jing Huangd4b671c2010-12-26 21:46:35 -08001415 WARN_ON(1);
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001416 bfa_stats(fcs, uf.vfid_unknown);
1417 bfa_uf_free(uf);
1418 return;
1419 }
1420
Jing Huang5fbe25c2010-10-18 17:17:23 -07001421 /*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001422 * skip vft header
1423 */
1424 fchs = (struct fchs_s *) (vft + 1);
1425 len -= sizeof(struct fc_vft_s);
1426
1427 bfa_trc(fcs, vft->vf_id);
1428 } else {
1429 bfa_stats(fcs, uf.untagged);
1430 fabric = &fcs->fabric;
1431 }
1432
1433 bfa_trc(fcs, ((u32 *) fchs)[0]);
1434 bfa_trc(fcs, ((u32 *) fchs)[1]);
1435 bfa_trc(fcs, ((u32 *) fchs)[2]);
1436 bfa_trc(fcs, ((u32 *) fchs)[3]);
1437 bfa_trc(fcs, ((u32 *) fchs)[4]);
1438 bfa_trc(fcs, ((u32 *) fchs)[5]);
1439 bfa_trc(fcs, len);
1440
1441 bfa_fcs_fabric_uf_recv(fabric, fchs, len);
1442 bfa_uf_free(uf);
1443}
1444
1445void
1446bfa_fcs_uf_attach(struct bfa_fcs_s *fcs)
1447{
1448 bfa_uf_recv_register(fcs->bfa, bfa_fcs_uf_recv, fcs);
1449}