blob: 6c4377cb287f1eec93791c8d56bd401c28a5f731 [file] [log] [blame]
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001/*
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#ifndef __BFA_FCS_H__
19#define __BFA_FCS_H__
20
21#include "bfa_cs.h"
22#include "bfa_defs.h"
23#include "bfa_defs_fcs.h"
24#include "bfa_modules.h"
25#include "bfa_fc.h"
26
27#define BFA_FCS_OS_STR_LEN 64
28
29/*
Maggie Zhangf7f738122010-12-09 19:08:43 -080030 * lps_pvt BFA LPS private functions
31 */
32
33enum bfa_lps_event {
34 BFA_LPS_SM_LOGIN = 1, /* login request from user */
35 BFA_LPS_SM_LOGOUT = 2, /* logout request from user */
36 BFA_LPS_SM_FWRSP = 3, /* f/w response to login/logout */
37 BFA_LPS_SM_RESUME = 4, /* space present in reqq queue */
38 BFA_LPS_SM_DELETE = 5, /* lps delete from user */
39 BFA_LPS_SM_OFFLINE = 6, /* Link is offline */
40 BFA_LPS_SM_RX_CVL = 7, /* Rx clear virtual link */
Krishna Gudipatib7044952010-12-13 16:17:42 -080041 BFA_LPS_SM_SET_N2N_PID = 8, /* Set assigned PID for n2n */
Maggie Zhangf7f738122010-12-09 19:08:43 -080042};
43
44
45/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070046 * !!! Only append to the enums defined here to avoid any versioning
47 * !!! needed between trace utility and driver version
48 */
49enum {
50 BFA_TRC_FCS_FCS = 1,
51 BFA_TRC_FCS_PORT = 2,
52 BFA_TRC_FCS_RPORT = 3,
53 BFA_TRC_FCS_FCPIM = 4,
54};
55
56
57struct bfa_fcs_s;
58
59#define __fcs_min_cfg(__fcs) ((__fcs)->min_cfg)
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070060
61#define BFA_FCS_BRCD_SWITCH_OUI 0x051e
62#define N2N_LOCAL_PID 0x010000
63#define N2N_REMOTE_PID 0x020000
64#define BFA_FCS_RETRY_TIMEOUT 2000
Krishna Gudipatice7242b2012-08-22 19:52:43 -070065#define BFA_FCS_MAX_NS_RETRIES 5
Maggie Zhangf16a1752010-12-09 19:12:32 -080066#define BFA_FCS_PID_IS_WKA(pid) ((bfa_ntoh3b(pid) > 0xFFF000) ? 1 : 0)
Krishna Gudipati61ba4392012-08-22 19:52:58 -070067#define BFA_FCS_MAX_RPORT_LOGINS 1024
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070068
69struct bfa_fcs_lport_ns_s {
70 bfa_sm_t sm; /* state machine */
71 struct bfa_timer_s timer;
72 struct bfa_fcs_lport_s *port; /* parent port */
73 struct bfa_fcxp_s *fcxp;
74 struct bfa_fcxp_wqe_s fcxp_wqe;
Krishna Gudipatice7242b2012-08-22 19:52:43 -070075 u8 num_rnnid_retries;
76 u8 num_rsnn_nn_retries;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070077};
78
79
80struct bfa_fcs_lport_scn_s {
81 bfa_sm_t sm; /* state machine */
82 struct bfa_timer_s timer;
83 struct bfa_fcs_lport_s *port; /* parent port */
84 struct bfa_fcxp_s *fcxp;
85 struct bfa_fcxp_wqe_s fcxp_wqe;
86};
87
88
89struct bfa_fcs_lport_fdmi_s {
90 bfa_sm_t sm; /* state machine */
91 struct bfa_timer_s timer;
92 struct bfa_fcs_lport_ms_s *ms; /* parent ms */
93 struct bfa_fcxp_s *fcxp;
94 struct bfa_fcxp_wqe_s fcxp_wqe;
95 u8 retry_cnt; /* retry count */
96 u8 rsvd[3];
97};
98
99
100struct bfa_fcs_lport_ms_s {
101 bfa_sm_t sm; /* state machine */
102 struct bfa_timer_s timer;
103 struct bfa_fcs_lport_s *port; /* parent port */
104 struct bfa_fcxp_s *fcxp;
105 struct bfa_fcxp_wqe_s fcxp_wqe;
106 struct bfa_fcs_lport_fdmi_s fdmi; /* FDMI component of MS */
107 u8 retry_cnt; /* retry count */
108 u8 rsvd[3];
109};
110
111
112struct bfa_fcs_lport_fab_s {
113 struct bfa_fcs_lport_ns_s ns; /* NS component of port */
114 struct bfa_fcs_lport_scn_s scn; /* scn component of port */
115 struct bfa_fcs_lport_ms_s ms; /* MS component of port */
116};
117
118#define MAX_ALPA_COUNT 127
119
120struct bfa_fcs_lport_loop_s {
121 u8 num_alpa; /* Num of ALPA entries in the map */
122 u8 alpa_pos_map[MAX_ALPA_COUNT]; /* ALPA Positional
123 *Map */
124 struct bfa_fcs_lport_s *port; /* parent port */
125};
126
127struct bfa_fcs_lport_n2n_s {
128 u32 rsvd;
Maggie50444a32010-11-29 18:26:32 -0800129 __be16 reply_oxid; /* ox_id from the req flogi to be
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700130 *used in flogi acc */
131 wwn_t rem_port_wwn; /* Attached port's wwn */
132};
133
134
135union bfa_fcs_lport_topo_u {
136 struct bfa_fcs_lport_fab_s pfab;
137 struct bfa_fcs_lport_loop_s ploop;
138 struct bfa_fcs_lport_n2n_s pn2n;
139};
140
141
142struct bfa_fcs_lport_s {
143 struct list_head qe; /* used by port/vport */
144 bfa_sm_t sm; /* state machine */
145 struct bfa_fcs_fabric_s *fabric; /* parent fabric */
146 struct bfa_lport_cfg_s port_cfg; /* port configuration */
147 struct bfa_timer_s link_timer; /* timer for link offline */
148 u32 pid:24; /* FC address */
149 u8 lp_tag; /* lport tag */
150 u16 num_rports; /* Num of r-ports */
151 struct list_head rport_q; /* queue of discovered r-ports */
152 struct bfa_fcs_s *fcs; /* FCS instance */
153 union bfa_fcs_lport_topo_u port_topo; /* fabric/loop/n2n details */
154 struct bfad_port_s *bfad_port; /* driver peer instance */
155 struct bfa_fcs_vport_s *vport; /* NULL for base ports */
156 struct bfa_fcxp_s *fcxp;
157 struct bfa_fcxp_wqe_s fcxp_wqe;
158 struct bfa_lport_stats_s stats;
159 struct bfa_wc_s wc; /* waiting counter for events */
160};
161#define BFA_FCS_GET_HAL_FROM_PORT(port) (port->fcs->bfa)
162#define BFA_FCS_GET_NS_FROM_PORT(port) (&port->port_topo.pfab.ns)
163#define BFA_FCS_GET_SCN_FROM_PORT(port) (&port->port_topo.pfab.scn)
164#define BFA_FCS_GET_MS_FROM_PORT(port) (&port->port_topo.pfab.ms)
165#define BFA_FCS_GET_FDMI_FROM_PORT(port) (&port->port_topo.pfab.ms.fdmi)
166#define BFA_FCS_VPORT_IS_INITIATOR_MODE(port) \
167 (port->port_cfg.roles & BFA_LPORT_ROLE_FCP_IM)
168
169/*
170 * forward declaration
171 */
172struct bfad_vf_s;
173
174enum bfa_fcs_fabric_type {
175 BFA_FCS_FABRIC_UNKNOWN = 0,
176 BFA_FCS_FABRIC_SWITCHED = 1,
177 BFA_FCS_FABRIC_N2N = 2,
178};
179
180
181struct bfa_fcs_fabric_s {
182 struct list_head qe; /* queue element */
183 bfa_sm_t sm; /* state machine */
184 struct bfa_fcs_s *fcs; /* FCS instance */
185 struct bfa_fcs_lport_s bport; /* base logical port */
186 enum bfa_fcs_fabric_type fab_type; /* fabric type */
187 enum bfa_port_type oper_type; /* current link topology */
188 u8 is_vf; /* is virtual fabric? */
189 u8 is_npiv; /* is NPIV supported ? */
190 u8 is_auth; /* is Security/Auth supported ? */
191 u16 bb_credit; /* BB credit from fabric */
192 u16 vf_id; /* virtual fabric ID */
193 u16 num_vports; /* num vports */
194 u16 rsvd;
195 struct list_head vport_q; /* queue of virtual ports */
196 struct list_head vf_q; /* queue of virtual fabrics */
197 struct bfad_vf_s *vf_drv; /* driver vf structure */
198 struct bfa_timer_s link_timer; /* Link Failure timer. Vport */
199 wwn_t fabric_name; /* attached fabric name */
200 bfa_boolean_t auth_reqd; /* authentication required */
201 struct bfa_timer_s delay_timer; /* delay timer */
202 union {
203 u16 swp_vfid;/* switch port VF id */
204 } event_arg;
205 struct bfa_wc_s wc; /* wait counter for delete */
206 struct bfa_vf_stats_s stats; /* fabric/vf stats */
207 struct bfa_lps_s *lps; /* lport login services */
208 u8 fabric_ip_addr[BFA_FCS_FABRIC_IPADDR_SZ];
209 /* attached fabric's ip addr */
Krishna Gudipati881c1b32012-08-22 19:52:02 -0700210 struct bfa_wc_s stop_wc; /* wait counter for stop */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700211};
212
213#define bfa_fcs_fabric_npiv_capable(__f) ((__f)->is_npiv)
214#define bfa_fcs_fabric_is_switched(__f) \
215 ((__f)->fab_type == BFA_FCS_FABRIC_SWITCHED)
216
Jing Huangacdc79a2010-10-18 17:15:55 -0700217/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700218 * The design calls for a single implementation of base fabric and vf.
219 */
220#define bfa_fcs_vf_t struct bfa_fcs_fabric_s
221
222struct bfa_vf_event_s {
223 u32 undefined;
224};
225
226struct bfa_fcs_s;
227struct bfa_fcs_fabric_s;
228
229/*
230 * @todo : need to move to a global config file.
231 * Maximum Rports supported per port (physical/logical).
232 */
233#define BFA_FCS_MAX_RPORTS_SUPP 256 /* @todo : tentative value */
234
235#define bfa_fcs_lport_t struct bfa_fcs_lport_s
236
Jing Huangacdc79a2010-10-18 17:15:55 -0700237/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700238 * Symbolic Name related defines
239 * Total bytes 255.
240 * Physical Port's symbolic name 128 bytes.
241 * For Vports, Vport's symbolic name is appended to the Physical port's
242 * Symbolic Name.
243 *
244 * Physical Port's symbolic name Format : (Total 128 bytes)
245 * Adapter Model number/name : 12 bytes
246 * Driver Version : 10 bytes
247 * Host Machine Name : 30 bytes
248 * Host OS Info : 48 bytes
249 * Host OS PATCH Info : 16 bytes
250 * ( remaining 12 bytes reserved to be used for separator)
251 */
252#define BFA_FCS_PORT_SYMBNAME_SEPARATOR " | "
253
254#define BFA_FCS_PORT_SYMBNAME_MODEL_SZ 12
255#define BFA_FCS_PORT_SYMBNAME_VERSION_SZ 10
256#define BFA_FCS_PORT_SYMBNAME_MACHINENAME_SZ 30
257#define BFA_FCS_PORT_SYMBNAME_OSINFO_SZ 48
258#define BFA_FCS_PORT_SYMBNAME_OSPATCH_SZ 16
259
Krishna Gudipatibe540a92011-06-13 15:53:04 -0700260/* bb_scn value in 2^bb_scn */
261#define BFA_FCS_PORT_DEF_BB_SCN 3
262
Jing Huangacdc79a2010-10-18 17:15:55 -0700263/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700264 * Get FC port ID for a logical port.
265 */
266#define bfa_fcs_lport_get_fcid(_lport) ((_lport)->pid)
267#define bfa_fcs_lport_get_pwwn(_lport) ((_lport)->port_cfg.pwwn)
268#define bfa_fcs_lport_get_nwwn(_lport) ((_lport)->port_cfg.nwwn)
269#define bfa_fcs_lport_get_psym_name(_lport) ((_lport)->port_cfg.sym_name)
Krishna Gudipatice7242b2012-08-22 19:52:43 -0700270#define bfa_fcs_lport_get_nsym_name(_lport) ((_lport)->port_cfg.node_sym_name)
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700271#define bfa_fcs_lport_is_initiator(_lport) \
272 ((_lport)->port_cfg.roles & BFA_LPORT_ROLE_FCP_IM)
273#define bfa_fcs_lport_get_nrports(_lport) \
274 ((_lport) ? (_lport)->num_rports : 0)
275
276static inline struct bfad_port_s *
277bfa_fcs_lport_get_drvport(struct bfa_fcs_lport_s *port)
278{
279 return port->bfad_port;
280}
281
282#define bfa_fcs_lport_get_opertype(_lport) ((_lport)->fabric->oper_type)
283#define bfa_fcs_lport_get_fabric_name(_lport) ((_lport)->fabric->fabric_name)
284#define bfa_fcs_lport_get_fabric_ipaddr(_lport) \
285 ((_lport)->fabric->fabric_ip_addr)
286
Jing Huangacdc79a2010-10-18 17:15:55 -0700287/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700288 * bfa fcs port public functions
289 */
290
291bfa_boolean_t bfa_fcs_lport_is_online(struct bfa_fcs_lport_s *port);
292struct bfa_fcs_lport_s *bfa_fcs_get_base_port(struct bfa_fcs_s *fcs);
Krishna Gudipatiee1a4a42012-08-22 19:50:43 -0700293void bfa_fcs_lport_get_rport_quals(struct bfa_fcs_lport_s *port,
294 struct bfa_rport_qualifier_s rport[], int *nrports);
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700295wwn_t bfa_fcs_lport_get_rport(struct bfa_fcs_lport_s *port, wwn_t wwn,
296 int index, int nrports, bfa_boolean_t bwwn);
297
298struct bfa_fcs_lport_s *bfa_fcs_lookup_port(struct bfa_fcs_s *fcs,
299 u16 vf_id, wwn_t lpwwn);
300
301void bfa_fcs_lport_get_info(struct bfa_fcs_lport_s *port,
302 struct bfa_lport_info_s *port_info);
303void bfa_fcs_lport_get_attr(struct bfa_fcs_lport_s *port,
304 struct bfa_lport_attr_s *port_attr);
305void bfa_fcs_lport_get_stats(struct bfa_fcs_lport_s *fcs_port,
306 struct bfa_lport_stats_s *port_stats);
307void bfa_fcs_lport_clear_stats(struct bfa_fcs_lport_s *fcs_port);
308enum bfa_port_speed bfa_fcs_lport_get_rport_max_speed(
309 struct bfa_fcs_lport_s *port);
310
311/* MS FCS routines */
312void bfa_fcs_lport_ms_init(struct bfa_fcs_lport_s *port);
313void bfa_fcs_lport_ms_offline(struct bfa_fcs_lport_s *port);
314void bfa_fcs_lport_ms_online(struct bfa_fcs_lport_s *port);
315void bfa_fcs_lport_ms_fabric_rscn(struct bfa_fcs_lport_s *port);
316
317/* FDMI FCS routines */
318void bfa_fcs_lport_fdmi_init(struct bfa_fcs_lport_ms_s *ms);
319void bfa_fcs_lport_fdmi_offline(struct bfa_fcs_lport_ms_s *ms);
320void bfa_fcs_lport_fdmi_online(struct bfa_fcs_lport_ms_s *ms);
321void bfa_fcs_lport_uf_recv(struct bfa_fcs_lport_s *lport, struct fchs_s *fchs,
322 u16 len);
323void bfa_fcs_lport_attach(struct bfa_fcs_lport_s *lport, struct bfa_fcs_s *fcs,
324 u16 vf_id, struct bfa_fcs_vport_s *vport);
325void bfa_fcs_lport_init(struct bfa_fcs_lport_s *lport,
326 struct bfa_lport_cfg_s *port_cfg);
327void bfa_fcs_lport_online(struct bfa_fcs_lport_s *port);
328void bfa_fcs_lport_offline(struct bfa_fcs_lport_s *port);
329void bfa_fcs_lport_delete(struct bfa_fcs_lport_s *port);
Krishna Gudipati881c1b32012-08-22 19:52:02 -0700330void bfa_fcs_lport_stop(struct bfa_fcs_lport_s *port);
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700331struct bfa_fcs_rport_s *bfa_fcs_lport_get_rport_by_pid(
332 struct bfa_fcs_lport_s *port, u32 pid);
Krishna Gudipatiee1a4a42012-08-22 19:50:43 -0700333struct bfa_fcs_rport_s *bfa_fcs_lport_get_rport_by_old_pid(
334 struct bfa_fcs_lport_s *port, u32 pid);
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700335struct bfa_fcs_rport_s *bfa_fcs_lport_get_rport_by_pwwn(
336 struct bfa_fcs_lport_s *port, wwn_t pwwn);
337struct bfa_fcs_rport_s *bfa_fcs_lport_get_rport_by_nwwn(
338 struct bfa_fcs_lport_s *port, wwn_t nwwn);
Krishna Gudipatiee1a4a42012-08-22 19:50:43 -0700339struct bfa_fcs_rport_s *bfa_fcs_lport_get_rport_by_qualifier(
340 struct bfa_fcs_lport_s *port, wwn_t pwwn, u32 pid);
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700341void bfa_fcs_lport_add_rport(struct bfa_fcs_lport_s *port,
342 struct bfa_fcs_rport_s *rport);
343void bfa_fcs_lport_del_rport(struct bfa_fcs_lport_s *port,
344 struct bfa_fcs_rport_s *rport);
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700345void bfa_fcs_lport_ns_init(struct bfa_fcs_lport_s *vport);
346void bfa_fcs_lport_ns_offline(struct bfa_fcs_lport_s *vport);
347void bfa_fcs_lport_ns_online(struct bfa_fcs_lport_s *vport);
348void bfa_fcs_lport_ns_query(struct bfa_fcs_lport_s *port);
Krishna Gudipatiebfe8392012-08-22 19:50:20 -0700349void bfa_fcs_lport_ns_util_send_rspn_id(void *cbarg,
350 struct bfa_fcxp_s *fcxp_alloced);
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700351void bfa_fcs_lport_scn_init(struct bfa_fcs_lport_s *vport);
352void bfa_fcs_lport_scn_offline(struct bfa_fcs_lport_s *vport);
353void bfa_fcs_lport_scn_online(struct bfa_fcs_lport_s *vport);
354void bfa_fcs_lport_scn_process_rscn(struct bfa_fcs_lport_s *port,
355 struct fchs_s *rx_frame, u32 len);
356
357struct bfa_fcs_vport_s {
358 struct list_head qe; /* queue elem */
359 bfa_sm_t sm; /* state machine */
360 bfa_fcs_lport_t lport; /* logical port */
361 struct bfa_timer_s timer;
362 struct bfad_vport_s *vport_drv; /* Driver private */
363 struct bfa_vport_stats_s vport_stats; /* vport statistics */
364 struct bfa_lps_s *lps; /* Lport login service*/
365 int fdisc_retries;
366};
367
368#define bfa_fcs_vport_get_port(vport) \
369 ((struct bfa_fcs_lport_s *)(&vport->port))
370
Jing Huangacdc79a2010-10-18 17:15:55 -0700371/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700372 * bfa fcs vport public functions
373 */
374bfa_status_t bfa_fcs_vport_create(struct bfa_fcs_vport_s *vport,
375 struct bfa_fcs_s *fcs, u16 vf_id,
376 struct bfa_lport_cfg_s *port_cfg,
377 struct bfad_vport_s *vport_drv);
378bfa_status_t bfa_fcs_pbc_vport_create(struct bfa_fcs_vport_s *vport,
379 struct bfa_fcs_s *fcs, u16 vf_id,
380 struct bfa_lport_cfg_s *port_cfg,
381 struct bfad_vport_s *vport_drv);
382bfa_boolean_t bfa_fcs_is_pbc_vport(struct bfa_fcs_vport_s *vport);
383bfa_status_t bfa_fcs_vport_delete(struct bfa_fcs_vport_s *vport);
384bfa_status_t bfa_fcs_vport_start(struct bfa_fcs_vport_s *vport);
385bfa_status_t bfa_fcs_vport_stop(struct bfa_fcs_vport_s *vport);
386void bfa_fcs_vport_get_attr(struct bfa_fcs_vport_s *vport,
387 struct bfa_vport_attr_s *vport_attr);
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700388struct bfa_fcs_vport_s *bfa_fcs_vport_lookup(struct bfa_fcs_s *fcs,
389 u16 vf_id, wwn_t vpwwn);
390void bfa_fcs_vport_cleanup(struct bfa_fcs_vport_s *vport);
391void bfa_fcs_vport_online(struct bfa_fcs_vport_s *vport);
392void bfa_fcs_vport_offline(struct bfa_fcs_vport_s *vport);
393void bfa_fcs_vport_delete_comp(struct bfa_fcs_vport_s *vport);
394void bfa_fcs_vport_fcs_delete(struct bfa_fcs_vport_s *vport);
Krishna Gudipati881c1b32012-08-22 19:52:02 -0700395void bfa_fcs_vport_fcs_stop(struct bfa_fcs_vport_s *vport);
Krishna Gudipatidd5aaf42011-06-13 15:51:24 -0700396void bfa_fcs_vport_stop_comp(struct bfa_fcs_vport_s *vport);
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700397
398#define BFA_FCS_RPORT_DEF_DEL_TIMEOUT 90 /* in secs */
399#define BFA_FCS_RPORT_MAX_RETRIES (5)
400
401/*
402 * forward declarations
403 */
404struct bfad_rport_s;
405
406struct bfa_fcs_itnim_s;
407struct bfa_fcs_tin_s;
408struct bfa_fcs_iprp_s;
409
410/* Rport Features (RPF) */
411struct bfa_fcs_rpf_s {
412 bfa_sm_t sm; /* state machine */
413 struct bfa_fcs_rport_s *rport; /* parent rport */
414 struct bfa_timer_s timer; /* general purpose timer */
415 struct bfa_fcxp_s *fcxp; /* FCXP needed for discarding */
416 struct bfa_fcxp_wqe_s fcxp_wqe; /* fcxp wait queue element */
417 int rpsc_retries; /* max RPSC retry attempts */
418 enum bfa_port_speed rpsc_speed;
419 /* Current Speed from RPSC. O if RPSC fails */
420 enum bfa_port_speed assigned_speed;
Jing Huangacdc79a2010-10-18 17:15:55 -0700421 /*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700422 * Speed assigned by the user. will be used if RPSC is
423 * not supported by the rport.
424 */
425};
426
427struct bfa_fcs_rport_s {
428 struct list_head qe; /* used by port/vport */
429 struct bfa_fcs_lport_s *port; /* parent FCS port */
430 struct bfa_fcs_s *fcs; /* fcs instance */
431 struct bfad_rport_s *rp_drv; /* driver peer instance */
432 u32 pid; /* port ID of rport */
Krishna Gudipatiee1a4a42012-08-22 19:50:43 -0700433 u32 old_pid; /* PID before rport goes offline */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700434 u16 maxfrsize; /* maximum frame size */
Maggie50444a32010-11-29 18:26:32 -0800435 __be16 reply_oxid; /* OX_ID of inbound requests */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700436 enum fc_cos fc_cos; /* FC classes of service supp */
437 bfa_boolean_t cisc; /* CISC capable device */
438 bfa_boolean_t prlo; /* processing prlo or LOGO */
Krishna Gudipatid7be54c2011-06-24 20:24:52 -0700439 bfa_boolean_t plogi_pending; /* Rx Plogi Pending */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700440 wwn_t pwwn; /* port wwn of rport */
441 wwn_t nwwn; /* node wwn of rport */
442 struct bfa_rport_symname_s psym_name; /* port symbolic name */
443 bfa_sm_t sm; /* state machine */
444 struct bfa_timer_s timer; /* general purpose timer */
445 struct bfa_fcs_itnim_s *itnim; /* ITN initiator mode role */
446 struct bfa_fcs_tin_s *tin; /* ITN initiator mode role */
447 struct bfa_fcs_iprp_s *iprp; /* IP/FC role */
448 struct bfa_rport_s *bfa_rport; /* BFA Rport */
449 struct bfa_fcxp_s *fcxp; /* FCXP needed for discarding */
450 int plogi_retries; /* max plogi retry attempts */
451 int ns_retries; /* max NS query retry attempts */
452 struct bfa_fcxp_wqe_s fcxp_wqe; /* fcxp wait queue element */
453 struct bfa_rport_stats_s stats; /* rport stats */
454 enum bfa_rport_function scsi_function; /* Initiator/Target */
455 struct bfa_fcs_rpf_s rpf; /* Rport features module */
456};
457
458static inline struct bfa_rport_s *
459bfa_fcs_rport_get_halrport(struct bfa_fcs_rport_s *rport)
460{
461 return rport->bfa_rport;
462}
463
Jing Huangacdc79a2010-10-18 17:15:55 -0700464/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700465 * bfa fcs rport API functions
466 */
Krishna Gudipati60138062011-06-24 20:25:15 -0700467void bfa_fcs_rport_get_attr(struct bfa_fcs_rport_s *rport,
468 struct bfa_rport_attr_s *attr);
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700469struct bfa_fcs_rport_s *bfa_fcs_rport_lookup(struct bfa_fcs_lport_s *port,
470 wwn_t rpwwn);
471struct bfa_fcs_rport_s *bfa_fcs_rport_lookup_by_nwwn(
472 struct bfa_fcs_lport_s *port, wwn_t rnwwn);
473void bfa_fcs_rport_set_del_timeout(u8 rport_tmo);
Krishna Gudipati61ba4392012-08-22 19:52:58 -0700474void bfa_fcs_rport_set_max_logins(u32 max_logins);
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700475void bfa_fcs_rport_uf_recv(struct bfa_fcs_rport_s *rport,
476 struct fchs_s *fchs, u16 len);
477void bfa_fcs_rport_scn(struct bfa_fcs_rport_s *rport);
478
479struct bfa_fcs_rport_s *bfa_fcs_rport_create(struct bfa_fcs_lport_s *port,
480 u32 pid);
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700481void bfa_fcs_rport_start(struct bfa_fcs_lport_s *port, struct fchs_s *rx_fchs,
482 struct fc_logi_s *plogi_rsp);
483void bfa_fcs_rport_plogi_create(struct bfa_fcs_lport_s *port,
484 struct fchs_s *rx_fchs,
485 struct fc_logi_s *plogi);
486void bfa_fcs_rport_plogi(struct bfa_fcs_rport_s *rport, struct fchs_s *fchs,
487 struct fc_logi_s *plogi);
Maggie50444a32010-11-29 18:26:32 -0800488void bfa_fcs_rport_prlo(struct bfa_fcs_rport_s *rport, __be16 ox_id);
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700489
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700490void bfa_fcs_rport_itntm_ack(struct bfa_fcs_rport_s *rport);
491void bfa_fcs_rport_fcptm_offline_done(struct bfa_fcs_rport_s *rport);
492int bfa_fcs_rport_get_state(struct bfa_fcs_rport_s *rport);
493struct bfa_fcs_rport_s *bfa_fcs_rport_create_by_wwn(
494 struct bfa_fcs_lport_s *port, wwn_t wwn);
495void bfa_fcs_rpf_init(struct bfa_fcs_rport_s *rport);
496void bfa_fcs_rpf_rport_online(struct bfa_fcs_rport_s *rport);
497void bfa_fcs_rpf_rport_offline(struct bfa_fcs_rport_s *rport);
498
499/*
500 * forward declarations
501 */
502struct bfad_itnim_s;
503
504struct bfa_fcs_itnim_s {
505 bfa_sm_t sm; /* state machine */
506 struct bfa_fcs_rport_s *rport; /* parent remote rport */
507 struct bfad_itnim_s *itnim_drv; /* driver peer instance */
508 struct bfa_fcs_s *fcs; /* fcs instance */
509 struct bfa_timer_s timer; /* timer functions */
510 struct bfa_itnim_s *bfa_itnim; /* BFA itnim struct */
511 u32 prli_retries; /* max prli retry attempts */
512 bfa_boolean_t seq_rec; /* seq recovery support */
513 bfa_boolean_t rec_support; /* REC supported */
514 bfa_boolean_t conf_comp; /* FCP_CONF support */
515 bfa_boolean_t task_retry_id; /* task retry id supp */
516 struct bfa_fcxp_wqe_s fcxp_wqe; /* wait qelem for fcxp */
517 struct bfa_fcxp_s *fcxp; /* FCXP in use */
518 struct bfa_itnim_stats_s stats; /* itn statistics */
519};
Krishna Gudipatic3f1b122012-08-22 19:51:08 -0700520#define bfa_fcs_fcxp_alloc(__fcs, __req) \
521 bfa_fcxp_req_rsp_alloc(NULL, (__fcs)->bfa, 0, 0, \
522 NULL, NULL, NULL, NULL, __req)
523#define bfa_fcs_fcxp_alloc_wait(__bfa, __wqe, __alloc_cbfn, \
524 __alloc_cbarg, __req) \
525 bfa_fcxp_req_rsp_alloc_wait(__bfa, __wqe, __alloc_cbfn, \
526 __alloc_cbarg, NULL, 0, 0, NULL, NULL, NULL, NULL, __req)
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700527
528static inline struct bfad_port_s *
529bfa_fcs_itnim_get_drvport(struct bfa_fcs_itnim_s *itnim)
530{
531 return itnim->rport->port->bfad_port;
532}
533
534
535static inline struct bfa_fcs_lport_s *
536bfa_fcs_itnim_get_port(struct bfa_fcs_itnim_s *itnim)
537{
538 return itnim->rport->port;
539}
540
541
542static inline wwn_t
543bfa_fcs_itnim_get_nwwn(struct bfa_fcs_itnim_s *itnim)
544{
545 return itnim->rport->nwwn;
546}
547
548
549static inline wwn_t
550bfa_fcs_itnim_get_pwwn(struct bfa_fcs_itnim_s *itnim)
551{
552 return itnim->rport->pwwn;
553}
554
555
556static inline u32
557bfa_fcs_itnim_get_fcid(struct bfa_fcs_itnim_s *itnim)
558{
559 return itnim->rport->pid;
560}
561
562
563static inline u32
564bfa_fcs_itnim_get_maxfrsize(struct bfa_fcs_itnim_s *itnim)
565{
566 return itnim->rport->maxfrsize;
567}
568
569
570static inline enum fc_cos
571bfa_fcs_itnim_get_cos(struct bfa_fcs_itnim_s *itnim)
572{
573 return itnim->rport->fc_cos;
574}
575
576
577static inline struct bfad_itnim_s *
578bfa_fcs_itnim_get_drvitn(struct bfa_fcs_itnim_s *itnim)
579{
580 return itnim->itnim_drv;
581}
582
583
584static inline struct bfa_itnim_s *
585bfa_fcs_itnim_get_halitn(struct bfa_fcs_itnim_s *itnim)
586{
587 return itnim->bfa_itnim;
588}
589
Jing Huangacdc79a2010-10-18 17:15:55 -0700590/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700591 * bfa fcs FCP Initiator mode API functions
592 */
593void bfa_fcs_itnim_get_attr(struct bfa_fcs_itnim_s *itnim,
594 struct bfa_itnim_attr_s *attr);
595void bfa_fcs_itnim_get_stats(struct bfa_fcs_itnim_s *itnim,
596 struct bfa_itnim_stats_s *stats);
597struct bfa_fcs_itnim_s *bfa_fcs_itnim_lookup(struct bfa_fcs_lport_s *port,
598 wwn_t rpwwn);
599bfa_status_t bfa_fcs_itnim_attr_get(struct bfa_fcs_lport_s *port, wwn_t rpwwn,
600 struct bfa_itnim_attr_s *attr);
601bfa_status_t bfa_fcs_itnim_stats_get(struct bfa_fcs_lport_s *port, wwn_t rpwwn,
602 struct bfa_itnim_stats_s *stats);
603bfa_status_t bfa_fcs_itnim_stats_clear(struct bfa_fcs_lport_s *port,
604 wwn_t rpwwn);
605struct bfa_fcs_itnim_s *bfa_fcs_itnim_create(struct bfa_fcs_rport_s *rport);
606void bfa_fcs_itnim_delete(struct bfa_fcs_itnim_s *itnim);
607void bfa_fcs_itnim_rport_offline(struct bfa_fcs_itnim_s *itnim);
Krishna Gudipati61ba4392012-08-22 19:52:58 -0700608void bfa_fcs_itnim_brp_online(struct bfa_fcs_itnim_s *itnim);
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700609bfa_status_t bfa_fcs_itnim_get_online_state(struct bfa_fcs_itnim_s *itnim);
610void bfa_fcs_itnim_is_initiator(struct bfa_fcs_itnim_s *itnim);
611void bfa_fcs_fcpim_uf_recv(struct bfa_fcs_itnim_s *itnim,
612 struct fchs_s *fchs, u16 len);
613
Krishna Gudipatid7be54c2011-06-24 20:24:52 -0700614#define BFA_FCS_FDMI_SUPP_SPEEDS_4G (FDMI_TRANS_SPEED_1G | \
615 FDMI_TRANS_SPEED_2G | \
616 FDMI_TRANS_SPEED_4G)
617
618#define BFA_FCS_FDMI_SUPP_SPEEDS_8G (FDMI_TRANS_SPEED_1G | \
619 FDMI_TRANS_SPEED_2G | \
620 FDMI_TRANS_SPEED_4G | \
621 FDMI_TRANS_SPEED_8G)
622
623#define BFA_FCS_FDMI_SUPP_SPEEDS_16G (FDMI_TRANS_SPEED_2G | \
624 FDMI_TRANS_SPEED_4G | \
625 FDMI_TRANS_SPEED_8G | \
626 FDMI_TRANS_SPEED_16G)
627
628#define BFA_FCS_FDMI_SUPP_SPEEDS_10G FDMI_TRANS_SPEED_10G
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700629
630/*
631 * HBA Attribute Block : BFA internal representation. Note : Some variable
632 * sizes have been trimmed to suit BFA For Ex : Model will be "Brocade". Based
633 * on this the size has been reduced to 16 bytes from the standard's 64 bytes.
634 */
635struct bfa_fcs_fdmi_hba_attr_s {
636 wwn_t node_name;
637 u8 manufacturer[64];
638 u8 serial_num[64];
639 u8 model[16];
640 u8 model_desc[256];
641 u8 hw_version[8];
642 u8 driver_version[8];
643 u8 option_rom_ver[BFA_VERSION_LEN];
644 u8 fw_version[8];
645 u8 os_name[256];
Maggie50444a32010-11-29 18:26:32 -0800646 __be32 max_ct_pyld;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700647};
648
649/*
650 * Port Attribute Block
651 */
652struct bfa_fcs_fdmi_port_attr_s {
653 u8 supp_fc4_types[32]; /* supported FC4 types */
Maggie50444a32010-11-29 18:26:32 -0800654 __be32 supp_speed; /* supported speed */
655 __be32 curr_speed; /* current Speed */
656 __be32 max_frm_size; /* max frame size */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700657 u8 os_device_name[256]; /* OS device Name */
658 u8 host_name[256]; /* host name */
659};
660
661struct bfa_fcs_stats_s {
662 struct {
663 u32 untagged; /* untagged receive frames */
664 u32 tagged; /* tagged receive frames */
665 u32 vfid_unknown; /* VF id is unknown */
666 } uf;
667};
668
669struct bfa_fcs_driver_info_s {
670 u8 version[BFA_VERSION_LEN]; /* Driver Version */
671 u8 host_machine_name[BFA_FCS_OS_STR_LEN];
672 u8 host_os_name[BFA_FCS_OS_STR_LEN]; /* OS name and version */
673 u8 host_os_patch[BFA_FCS_OS_STR_LEN]; /* patch or service pack */
674 u8 os_device_name[BFA_FCS_OS_STR_LEN]; /* Driver Device Name */
675};
676
677struct bfa_fcs_s {
678 struct bfa_s *bfa; /* corresponding BFA bfa instance */
679 struct bfad_s *bfad; /* corresponding BDA driver instance */
680 struct bfa_trc_mod_s *trcmod; /* tracing module */
681 bfa_boolean_t vf_enabled; /* VF mode is enabled */
682 bfa_boolean_t fdmi_enabled; /* FDMI is enabled */
Krishna Gudipatibe540a92011-06-13 15:53:04 -0700683 bfa_boolean_t bbscn_enabled; /* Driver Config Parameter */
684 bfa_boolean_t bbscn_flogi_rjt;/* FLOGI reject due to BB_SCN */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700685 bfa_boolean_t min_cfg; /* min cfg enabled/disabled */
686 u16 port_vfid; /* port default VF ID */
687 struct bfa_fcs_driver_info_s driver_info;
688 struct bfa_fcs_fabric_s fabric; /* base fabric state machine */
689 struct bfa_fcs_stats_s stats; /* FCS statistics */
690 struct bfa_wc_s wc; /* waiting counter */
Krishna Gudipati7826f302011-07-20 16:59:13 -0700691 int fcs_aen_seq;
Krishna Gudipati61ba4392012-08-22 19:52:58 -0700692 u32 num_rport_logins;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700693};
694
695/*
Maggie Zhangf7f738122010-12-09 19:08:43 -0800696 * fcs_fabric_sm fabric state machine functions
697 */
698
699/*
700 * Fabric state machine events
701 */
702enum bfa_fcs_fabric_event {
703 BFA_FCS_FABRIC_SM_CREATE = 1, /* create from driver */
704 BFA_FCS_FABRIC_SM_DELETE = 2, /* delete from driver */
705 BFA_FCS_FABRIC_SM_LINK_DOWN = 3, /* link down from port */
706 BFA_FCS_FABRIC_SM_LINK_UP = 4, /* link up from port */
707 BFA_FCS_FABRIC_SM_CONT_OP = 5, /* flogi/auth continue op */
708 BFA_FCS_FABRIC_SM_RETRY_OP = 6, /* flogi/auth retry op */
709 BFA_FCS_FABRIC_SM_NO_FABRIC = 7, /* from flogi/auth */
710 BFA_FCS_FABRIC_SM_PERF_EVFP = 8, /* from flogi/auth */
711 BFA_FCS_FABRIC_SM_ISOLATE = 9, /* from EVFP processing */
712 BFA_FCS_FABRIC_SM_NO_TAGGING = 10, /* no VFT tagging from EVFP */
713 BFA_FCS_FABRIC_SM_DELAYED = 11, /* timeout delay event */
714 BFA_FCS_FABRIC_SM_AUTH_FAILED = 12, /* auth failed */
715 BFA_FCS_FABRIC_SM_AUTH_SUCCESS = 13, /* auth successful */
716 BFA_FCS_FABRIC_SM_DELCOMP = 14, /* all vports deleted event */
717 BFA_FCS_FABRIC_SM_LOOPBACK = 15, /* Received our own FLOGI */
718 BFA_FCS_FABRIC_SM_START = 16, /* from driver */
Krishna Gudipati881c1b32012-08-22 19:52:02 -0700719 BFA_FCS_FABRIC_SM_STOP = 17, /* Stop from driver */
720 BFA_FCS_FABRIC_SM_STOPCOMP = 18, /* Stop completion */
721 BFA_FCS_FABRIC_SM_LOGOCOMP = 19, /* FLOGO completion */
Maggie Zhangf7f738122010-12-09 19:08:43 -0800722};
723
724/*
725 * fcs_rport_sm FCS rport state machine events
726 */
727
728enum rport_event {
729 RPSM_EVENT_PLOGI_SEND = 1, /* new rport; start with PLOGI */
730 RPSM_EVENT_PLOGI_RCVD = 2, /* Inbound PLOGI from remote port */
731 RPSM_EVENT_PLOGI_COMP = 3, /* PLOGI completed to rport */
732 RPSM_EVENT_LOGO_RCVD = 4, /* LOGO from remote device */
733 RPSM_EVENT_LOGO_IMP = 5, /* implicit logo for SLER */
734 RPSM_EVENT_FCXP_SENT = 6, /* Frame from has been sent */
735 RPSM_EVENT_DELETE = 7, /* RPORT delete request */
736 RPSM_EVENT_SCN = 8, /* state change notification */
737 RPSM_EVENT_ACCEPTED = 9, /* Good response from remote device */
738 RPSM_EVENT_FAILED = 10, /* Request to rport failed. */
739 RPSM_EVENT_TIMEOUT = 11, /* Rport SM timeout event */
740 RPSM_EVENT_HCB_ONLINE = 12, /* BFA rport online callback */
741 RPSM_EVENT_HCB_OFFLINE = 13, /* BFA rport offline callback */
742 RPSM_EVENT_FC4_OFFLINE = 14, /* FC-4 offline complete */
743 RPSM_EVENT_ADDRESS_CHANGE = 15, /* Rport's PID has changed */
744 RPSM_EVENT_ADDRESS_DISC = 16, /* Need to Discover rport's PID */
745 RPSM_EVENT_PRLO_RCVD = 17, /* PRLO from remote device */
Lucas De Marchi25985ed2011-03-30 22:57:33 -0300746 RPSM_EVENT_PLOGI_RETRY = 18, /* Retry PLOGI continuously */
Krishna Gudipati61ba4392012-08-22 19:52:58 -0700747 RPSM_EVENT_FC4_FCS_ONLINE = 19, /*!< FC-4 FCS online complete */
748};
749
750/*
751 * fcs_itnim_sm FCS itnim state machine events
752 */
753enum bfa_fcs_itnim_event {
754 BFA_FCS_ITNIM_SM_FCS_ONLINE = 1, /* rport online event */
755 BFA_FCS_ITNIM_SM_OFFLINE = 2, /* rport offline */
756 BFA_FCS_ITNIM_SM_FRMSENT = 3, /* prli frame is sent */
757 BFA_FCS_ITNIM_SM_RSP_OK = 4, /* good response */
758 BFA_FCS_ITNIM_SM_RSP_ERROR = 5, /* error response */
759 BFA_FCS_ITNIM_SM_TIMEOUT = 6, /* delay timeout */
760 BFA_FCS_ITNIM_SM_HCB_OFFLINE = 7, /* BFA online callback */
761 BFA_FCS_ITNIM_SM_HCB_ONLINE = 8, /* BFA offline callback */
762 BFA_FCS_ITNIM_SM_INITIATOR = 9, /* rport is initiator */
763 BFA_FCS_ITNIM_SM_DELETE = 10, /* delete event from rport */
764 BFA_FCS_ITNIM_SM_PRLO = 11, /* delete event from rport */
765 BFA_FCS_ITNIM_SM_RSP_NOT_SUPP = 12, /* cmd not supported rsp */
766 BFA_FCS_ITNIM_SM_HAL_ONLINE = 13, /*!< bfa rport online event */
Maggie Zhangf7f738122010-12-09 19:08:43 -0800767};
768
769/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700770 * bfa fcs API functions
771 */
772void bfa_fcs_attach(struct bfa_fcs_s *fcs, struct bfa_s *bfa,
773 struct bfad_s *bfad,
774 bfa_boolean_t min_cfg);
775void bfa_fcs_init(struct bfa_fcs_s *fcs);
Krishna Gudipati75332a72011-06-13 15:54:31 -0700776void bfa_fcs_pbc_vport_init(struct bfa_fcs_s *fcs);
777void bfa_fcs_update_cfg(struct bfa_fcs_s *fcs);
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700778void bfa_fcs_driver_info_init(struct bfa_fcs_s *fcs,
779 struct bfa_fcs_driver_info_s *driver_info);
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700780void bfa_fcs_exit(struct bfa_fcs_s *fcs);
Krishna Gudipati881c1b32012-08-22 19:52:02 -0700781void bfa_fcs_stop(struct bfa_fcs_s *fcs);
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700782
Jing Huangacdc79a2010-10-18 17:15:55 -0700783/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700784 * bfa fcs vf public functions
785 */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700786bfa_fcs_vf_t *bfa_fcs_vf_lookup(struct bfa_fcs_s *fcs, u16 vf_id);
Krishna Gudipatib85daaf2011-06-13 15:55:11 -0700787void bfa_fcs_vf_get_ports(bfa_fcs_vf_t *vf, wwn_t vpwwn[], int *nports);
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700788
789/*
790 * fabric protected interface functions
791 */
792void bfa_fcs_fabric_attach(struct bfa_fcs_s *fcs);
793void bfa_fcs_fabric_modinit(struct bfa_fcs_s *fcs);
794void bfa_fcs_fabric_modexit(struct bfa_fcs_s *fcs);
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700795void bfa_fcs_fabric_link_up(struct bfa_fcs_fabric_s *fabric);
796void bfa_fcs_fabric_link_down(struct bfa_fcs_fabric_s *fabric);
797void bfa_fcs_fabric_addvport(struct bfa_fcs_fabric_s *fabric,
798 struct bfa_fcs_vport_s *vport);
799void bfa_fcs_fabric_delvport(struct bfa_fcs_fabric_s *fabric,
800 struct bfa_fcs_vport_s *vport);
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700801struct bfa_fcs_vport_s *bfa_fcs_fabric_vport_lookup(
802 struct bfa_fcs_fabric_s *fabric, wwn_t pwwn);
803void bfa_fcs_fabric_modstart(struct bfa_fcs_s *fcs);
804void bfa_fcs_fabric_uf_recv(struct bfa_fcs_fabric_s *fabric,
805 struct fchs_s *fchs, u16 len);
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700806void bfa_fcs_fabric_psymb_init(struct bfa_fcs_fabric_s *fabric);
Krishna Gudipatice7242b2012-08-22 19:52:43 -0700807void bfa_fcs_fabric_nsymb_init(struct bfa_fcs_fabric_s *fabric);
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700808void bfa_fcs_fabric_set_fabric_name(struct bfa_fcs_fabric_s *fabric,
809 wwn_t fabric_name);
810u16 bfa_fcs_fabric_get_switch_oui(struct bfa_fcs_fabric_s *fabric);
811void bfa_fcs_uf_attach(struct bfa_fcs_s *fcs);
812void bfa_fcs_port_attach(struct bfa_fcs_s *fcs);
Krishna Gudipati881c1b32012-08-22 19:52:02 -0700813void bfa_fcs_fabric_modstop(struct bfa_fcs_s *fcs);
Maggie Zhangf7f738122010-12-09 19:08:43 -0800814void bfa_fcs_fabric_sm_online(struct bfa_fcs_fabric_s *fabric,
815 enum bfa_fcs_fabric_event event);
816void bfa_fcs_fabric_sm_loopback(struct bfa_fcs_fabric_s *fabric,
817 enum bfa_fcs_fabric_event event);
818void bfa_fcs_fabric_sm_auth_failed(struct bfa_fcs_fabric_s *fabric,
819 enum bfa_fcs_fabric_event event);
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700820
Jing Huangacdc79a2010-10-18 17:15:55 -0700821/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700822 * BFA FCS callback interfaces
823 */
824
Jing Huangacdc79a2010-10-18 17:15:55 -0700825/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700826 * fcb Main fcs callbacks
827 */
828
829struct bfad_port_s;
830struct bfad_vf_s;
831struct bfad_vport_s;
832struct bfad_rport_s;
833
Jing Huangacdc79a2010-10-18 17:15:55 -0700834/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700835 * lport callbacks
836 */
837struct bfad_port_s *bfa_fcb_lport_new(struct bfad_s *bfad,
838 struct bfa_fcs_lport_s *port,
839 enum bfa_lport_role roles,
840 struct bfad_vf_s *vf_drv,
841 struct bfad_vport_s *vp_drv);
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700842
Jing Huangacdc79a2010-10-18 17:15:55 -0700843/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700844 * vport callbacks
845 */
846void bfa_fcb_pbc_vport_create(struct bfad_s *bfad, struct bfi_pbc_vport_s);
847
Jing Huangacdc79a2010-10-18 17:15:55 -0700848/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700849 * rport callbacks
850 */
851bfa_status_t bfa_fcb_rport_alloc(struct bfad_s *bfad,
852 struct bfa_fcs_rport_s **rport,
853 struct bfad_rport_s **rport_drv);
854
Jing Huangacdc79a2010-10-18 17:15:55 -0700855/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700856 * itnim callbacks
857 */
858void bfa_fcb_itnim_alloc(struct bfad_s *bfad, struct bfa_fcs_itnim_s **itnim,
859 struct bfad_itnim_s **itnim_drv);
860void bfa_fcb_itnim_free(struct bfad_s *bfad,
861 struct bfad_itnim_s *itnim_drv);
862void bfa_fcb_itnim_online(struct bfad_itnim_s *itnim_drv);
863void bfa_fcb_itnim_offline(struct bfad_itnim_s *itnim_drv);
864
865#endif /* __BFA_FCS_H__ */