blob: ea2278bc78a8d44f497a5985357dcd9ce28c9625 [file] [log] [blame]
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07001/*
Anil Gurumurthy889d0d42015-11-26 03:54:45 -05002 * Copyright (c) 2005-2014 Brocade Communications Systems, Inc.
3 * Copyright (c) 2014- QLogic Corporation.
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07004 * All rights reserved
Anil Gurumurthy889d0d42015-11-26 03:54:45 -05005 * www.qlogic.com
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07006 *
Anil Gurumurthy31e1d562015-11-26 03:54:46 -05007 * Linux driver for QLogic BR-series Fibre Channel Host Bus Adapter.
Krishna Gudipatia36c61f2010-09-15 11:50:55 -07008 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License (GPL) Version 2 as
11 * published by the Free Software Foundation
12 *
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
17 */
18
19#ifndef __BFA_SVC_H__
20#define __BFA_SVC_H__
21
22#include "bfa_cs.h"
23#include "bfi_ms.h"
24
25
Jing Huangacdc79a2010-10-18 17:15:55 -070026/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070027 * Scatter-gather DMA related defines
28 */
29#define BFA_SGPG_MIN (16)
Krishna Gudipati45070252011-06-24 20:24:29 -070030#define BFA_SGPG_MAX (8192)
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070031
Jing Huangacdc79a2010-10-18 17:15:55 -070032/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070033 * Alignment macro for SG page allocation
34 */
35#define BFA_SGPG_ROUNDUP(_l) (((_l) + (sizeof(struct bfi_sgpg_s) - 1)) \
36 & ~(sizeof(struct bfi_sgpg_s) - 1))
37
38struct bfa_sgpg_wqe_s {
39 struct list_head qe; /* queue sg page element */
40 int nsgpg; /* pages to be allocated */
41 int nsgpg_total; /* total pages required */
42 void (*cbfn) (void *cbarg); /* callback function */
43 void *cbarg; /* callback arg */
44 struct list_head sgpg_q; /* queue of alloced sgpgs */
45};
46
47struct bfa_sgpg_s {
48 struct list_head qe; /* queue sg page element */
49 struct bfi_sgpg_s *sgpg; /* va of SG page */
50 union bfi_addr_u sgpg_pa; /* pa of SG page */
51};
52
Jing Huangacdc79a2010-10-18 17:15:55 -070053/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070054 * Given number of SG elements, BFA_SGPG_NPAGE() returns the number of
55 * SG pages required.
56 */
57#define BFA_SGPG_NPAGE(_nsges) (((_nsges) / BFI_SGPG_DATA_SGES) + 1)
58
Krishna Gudipati45070252011-06-24 20:24:29 -070059/* Max SGPG dma segs required */
60#define BFA_SGPG_DMA_SEGS \
61 BFI_MEM_DMA_NSEGS(BFA_SGPG_MAX, (uint32_t)sizeof(struct bfi_sgpg_s))
62
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070063struct bfa_sgpg_mod_s {
64 struct bfa_s *bfa;
65 int num_sgpgs; /* number of SG pages */
66 int free_sgpgs; /* number of free SG pages */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070067 struct list_head sgpg_q; /* queue of free SG pages */
68 struct list_head sgpg_wait_q; /* wait queue for SG pages */
Krishna Gudipati45070252011-06-24 20:24:29 -070069 struct bfa_mem_dma_s dma_seg[BFA_SGPG_DMA_SEGS];
70 struct bfa_mem_kva_s kva_seg;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070071};
72#define BFA_SGPG_MOD(__bfa) (&(__bfa)->modules.sgpg_mod)
Krishna Gudipati45070252011-06-24 20:24:29 -070073#define BFA_MEM_SGPG_KVA(__bfa) (&(BFA_SGPG_MOD(__bfa)->kva_seg))
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070074
75bfa_status_t bfa_sgpg_malloc(struct bfa_s *bfa, struct list_head *sgpg_q,
76 int nsgpgs);
77void bfa_sgpg_mfree(struct bfa_s *bfa, struct list_head *sgpg_q, int nsgpgs);
78void bfa_sgpg_winit(struct bfa_sgpg_wqe_s *wqe,
79 void (*cbfn) (void *cbarg), void *cbarg);
80void bfa_sgpg_wait(struct bfa_s *bfa, struct bfa_sgpg_wqe_s *wqe, int nsgpgs);
81void bfa_sgpg_wcancel(struct bfa_s *bfa, struct bfa_sgpg_wqe_s *wqe);
82
83
Jing Huangacdc79a2010-10-18 17:15:55 -070084/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070085 * FCXP related defines
86 */
87#define BFA_FCXP_MIN (1)
Krishna Gudipati45070252011-06-24 20:24:29 -070088#define BFA_FCXP_MAX (256)
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070089#define BFA_FCXP_MAX_IBUF_SZ (2 * 1024 + 256)
90#define BFA_FCXP_MAX_LBUF_SZ (4 * 1024 + 256)
91
Krishna Gudipati45070252011-06-24 20:24:29 -070092/* Max FCXP dma segs required */
93#define BFA_FCXP_DMA_SEGS \
94 BFI_MEM_DMA_NSEGS(BFA_FCXP_MAX, \
95 (u32)BFA_FCXP_MAX_IBUF_SZ + BFA_FCXP_MAX_LBUF_SZ)
96
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070097struct bfa_fcxp_mod_s {
98 struct bfa_s *bfa; /* backpointer to BFA */
99 struct bfa_fcxp_s *fcxp_list; /* array of FCXPs */
100 u16 num_fcxps; /* max num FCXP requests */
Krishna Gudipatic3f1b122012-08-22 19:51:08 -0700101 struct list_head fcxp_req_free_q; /* free FCXPs used for sending req */
102 struct list_head fcxp_rsp_free_q; /* free FCXPs used for sending req */
103 struct list_head fcxp_active_q; /* active FCXPs */
104 struct list_head req_wait_q; /* wait queue for free req_fcxp */
105 struct list_head rsp_wait_q; /* wait queue for free rsp_fcxp */
106 struct list_head fcxp_req_unused_q; /* unused req_fcxps */
107 struct list_head fcxp_rsp_unused_q; /* unused rsp_fcxps */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700108 u32 req_pld_sz;
109 u32 rsp_pld_sz;
Krishna Gudipati45070252011-06-24 20:24:29 -0700110 struct bfa_mem_dma_s dma_seg[BFA_FCXP_DMA_SEGS];
111 struct bfa_mem_kva_s kva_seg;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700112};
113
114#define BFA_FCXP_MOD(__bfa) (&(__bfa)->modules.fcxp_mod)
115#define BFA_FCXP_FROM_TAG(__mod, __tag) (&(__mod)->fcxp_list[__tag])
Krishna Gudipati45070252011-06-24 20:24:29 -0700116#define BFA_MEM_FCXP_KVA(__bfa) (&(BFA_FCXP_MOD(__bfa)->kva_seg))
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700117
118typedef void (*fcxp_send_cb_t) (struct bfa_s *ioc, struct bfa_fcxp_s *fcxp,
119 void *cb_arg, bfa_status_t req_status,
120 u32 rsp_len, u32 resid_len,
121 struct fchs_s *rsp_fchs);
122
123typedef u64 (*bfa_fcxp_get_sgaddr_t) (void *bfad_fcxp, int sgeid);
124typedef u32 (*bfa_fcxp_get_sglen_t) (void *bfad_fcxp, int sgeid);
125typedef void (*bfa_cb_fcxp_send_t) (void *bfad_fcxp, struct bfa_fcxp_s *fcxp,
126 void *cbarg, enum bfa_status req_status,
127 u32 rsp_len, u32 resid_len,
128 struct fchs_s *rsp_fchs);
129typedef void (*bfa_fcxp_alloc_cbfn_t) (void *cbarg, struct bfa_fcxp_s *fcxp);
130
131
132
Jing Huangacdc79a2010-10-18 17:15:55 -0700133/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700134 * Information needed for a FCXP request
135 */
136struct bfa_fcxp_req_info_s {
137 struct bfa_rport_s *bfa_rport;
Jing Huangacdc79a2010-10-18 17:15:55 -0700138 /* Pointer to the bfa rport that was
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700139 * returned from bfa_rport_create().
140 * This could be left NULL for WKA or
141 * for FCXP interactions before the
142 * rport nexus is established
143 */
144 struct fchs_s fchs; /* request FC header structure */
Lucas De Marchi25985ed2011-03-30 22:57:33 -0300145 u8 cts; /* continuous sequence */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700146 u8 class; /* FC class for the request/response */
147 u16 max_frmsz; /* max send frame size */
148 u16 vf_id; /* vsan tag if applicable */
149 u8 lp_tag; /* lport tag */
150 u32 req_tot_len; /* request payload total length */
151};
152
153struct bfa_fcxp_rsp_info_s {
154 struct fchs_s rsp_fchs;
Jing Huangacdc79a2010-10-18 17:15:55 -0700155 /* Response frame's FC header will
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700156 * be sent back in this field */
157 u8 rsp_timeout;
Jing Huangacdc79a2010-10-18 17:15:55 -0700158 /* timeout in seconds, 0-no response */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700159 u8 rsvd2[3];
160 u32 rsp_maxlen; /* max response length expected */
161};
162
163struct bfa_fcxp_s {
164 struct list_head qe; /* fcxp queue element */
165 bfa_sm_t sm; /* state machine */
166 void *caller; /* driver or fcs */
167 struct bfa_fcxp_mod_s *fcxp_mod;
168 /* back pointer to fcxp mod */
169 u16 fcxp_tag; /* internal tag */
170 struct bfa_fcxp_req_info_s req_info;
171 /* request info */
172 struct bfa_fcxp_rsp_info_s rsp_info;
173 /* response info */
174 u8 use_ireqbuf; /* use internal req buf */
175 u8 use_irspbuf; /* use internal rsp buf */
176 u32 nreq_sgles; /* num request SGLEs */
177 u32 nrsp_sgles; /* num response SGLEs */
178 struct list_head req_sgpg_q; /* SG pages for request buf */
179 struct list_head req_sgpg_wqe; /* wait queue for req SG page */
180 struct list_head rsp_sgpg_q; /* SG pages for response buf */
181 struct list_head rsp_sgpg_wqe; /* wait queue for rsp SG page */
182
183 bfa_fcxp_get_sgaddr_t req_sga_cbfn;
184 /* SG elem addr user function */
185 bfa_fcxp_get_sglen_t req_sglen_cbfn;
186 /* SG elem len user function */
187 bfa_fcxp_get_sgaddr_t rsp_sga_cbfn;
188 /* SG elem addr user function */
189 bfa_fcxp_get_sglen_t rsp_sglen_cbfn;
190 /* SG elem len user function */
191 bfa_cb_fcxp_send_t send_cbfn; /* send completion callback */
192 void *send_cbarg; /* callback arg */
193 struct bfa_sge_s req_sge[BFA_FCXP_MAX_SGES];
194 /* req SG elems */
195 struct bfa_sge_s rsp_sge[BFA_FCXP_MAX_SGES];
196 /* rsp SG elems */
197 u8 rsp_status; /* comp: rsp status */
198 u32 rsp_len; /* comp: actual response len */
199 u32 residue_len; /* comp: residual rsp length */
200 struct fchs_s rsp_fchs; /* comp: response fchs */
201 struct bfa_cb_qe_s hcb_qe; /* comp: callback qelem */
202 struct bfa_reqq_wait_s reqq_wqe;
203 bfa_boolean_t reqq_waiting;
Krishna Gudipatic3f1b122012-08-22 19:51:08 -0700204 bfa_boolean_t req_rsp; /* Used to track req/rsp fcxp */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700205};
206
207struct bfa_fcxp_wqe_s {
208 struct list_head qe;
209 bfa_fcxp_alloc_cbfn_t alloc_cbfn;
210 void *alloc_cbarg;
211 void *caller;
212 struct bfa_s *bfa;
213 int nreq_sgles;
214 int nrsp_sgles;
215 bfa_fcxp_get_sgaddr_t req_sga_cbfn;
216 bfa_fcxp_get_sglen_t req_sglen_cbfn;
217 bfa_fcxp_get_sgaddr_t rsp_sga_cbfn;
218 bfa_fcxp_get_sglen_t rsp_sglen_cbfn;
219};
220
221#define BFA_FCXP_REQ_PLD(_fcxp) (bfa_fcxp_get_reqbuf(_fcxp))
222#define BFA_FCXP_RSP_FCHS(_fcxp) (&((_fcxp)->rsp_info.fchs))
223#define BFA_FCXP_RSP_PLD(_fcxp) (bfa_fcxp_get_rspbuf(_fcxp))
224
Krishna Gudipati45070252011-06-24 20:24:29 -0700225#define BFA_FCXP_REQ_PLD_PA(_fcxp) \
226 bfa_mem_get_dmabuf_pa((_fcxp)->fcxp_mod, (_fcxp)->fcxp_tag, \
227 (_fcxp)->fcxp_mod->req_pld_sz + (_fcxp)->fcxp_mod->rsp_pld_sz)
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700228
Krishna Gudipati45070252011-06-24 20:24:29 -0700229/* fcxp_buf = req_buf + rsp_buf :- add req_buf_sz to get to rsp_buf */
230#define BFA_FCXP_RSP_PLD_PA(_fcxp) \
231 (bfa_mem_get_dmabuf_pa((_fcxp)->fcxp_mod, (_fcxp)->fcxp_tag, \
232 (_fcxp)->fcxp_mod->req_pld_sz + (_fcxp)->fcxp_mod->rsp_pld_sz) + \
233 (_fcxp)->fcxp_mod->req_pld_sz)
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700234
235void bfa_fcxp_isr(struct bfa_s *bfa, struct bfi_msg_s *msg);
236
237
Jing Huangacdc79a2010-10-18 17:15:55 -0700238/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700239 * RPORT related defines
240 */
Maggie Zhangf7f738122010-12-09 19:08:43 -0800241enum bfa_rport_event {
242 BFA_RPORT_SM_CREATE = 1, /* rport create event */
243 BFA_RPORT_SM_DELETE = 2, /* deleting an existing rport */
244 BFA_RPORT_SM_ONLINE = 3, /* rport is online */
245 BFA_RPORT_SM_OFFLINE = 4, /* rport is offline */
246 BFA_RPORT_SM_FWRSP = 5, /* firmware response */
247 BFA_RPORT_SM_HWFAIL = 6, /* IOC h/w failure */
248 BFA_RPORT_SM_QOS_SCN = 7, /* QoS SCN from firmware */
249 BFA_RPORT_SM_SET_SPEED = 8, /* Set Rport Speed */
250 BFA_RPORT_SM_QRESUME = 9, /* space in requeue queue */
251};
252
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700253#define BFA_RPORT_MIN 4
254
255struct bfa_rport_mod_s {
256 struct bfa_rport_s *rps_list; /* list of rports */
257 struct list_head rp_free_q; /* free bfa_rports */
258 struct list_head rp_active_q; /* free bfa_rports */
Krishna Gudipati3fd45982011-06-24 20:24:08 -0700259 struct list_head rp_unused_q; /* unused bfa rports */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700260 u16 num_rports; /* number of rports */
Krishna Gudipati45070252011-06-24 20:24:29 -0700261 struct bfa_mem_kva_s kva_seg;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700262};
263
264#define BFA_RPORT_MOD(__bfa) (&(__bfa)->modules.rport_mod)
Krishna Gudipati45070252011-06-24 20:24:29 -0700265#define BFA_MEM_RPORT_KVA(__bfa) (&(BFA_RPORT_MOD(__bfa)->kva_seg))
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700266
Jing Huangacdc79a2010-10-18 17:15:55 -0700267/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700268 * Convert rport tag to RPORT
269 */
270#define BFA_RPORT_FROM_TAG(__bfa, _tag) \
271 (BFA_RPORT_MOD(__bfa)->rps_list + \
272 ((_tag) & (BFA_RPORT_MOD(__bfa)->num_rports - 1)))
273
274/*
275 * protected functions
276 */
277void bfa_rport_isr(struct bfa_s *bfa, struct bfi_msg_s *msg);
Krishna Gudipati3fd45982011-06-24 20:24:08 -0700278void bfa_rport_res_recfg(struct bfa_s *bfa, u16 num_rport_fw);
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700279
Jing Huangacdc79a2010-10-18 17:15:55 -0700280/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700281 * BFA rport information.
282 */
283struct bfa_rport_info_s {
284 u16 max_frmsz; /* max rcv pdu size */
285 u32 pid:24, /* remote port ID */
286 lp_tag:8; /* tag */
287 u32 local_pid:24, /* local port ID */
288 cisc:8; /* CIRO supported */
289 u8 fc_class; /* supported FC classes. enum fc_cos */
290 u8 vf_en; /* virtual fabric enable */
291 u16 vf_id; /* virtual fabric ID */
292 enum bfa_port_speed speed; /* Rport's current speed */
293};
294
Jing Huangacdc79a2010-10-18 17:15:55 -0700295/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700296 * BFA rport data structure
297 */
298struct bfa_rport_s {
299 struct list_head qe; /* queue element */
300 bfa_sm_t sm; /* state machine */
301 struct bfa_s *bfa; /* backpointer to BFA */
302 void *rport_drv; /* fcs/driver rport object */
303 u16 fw_handle; /* firmware rport handle */
304 u16 rport_tag; /* BFA rport tag */
Krishna Gudipati83763d52011-07-20 17:04:03 -0700305 u8 lun_mask; /* LUN mask flag */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700306 struct bfa_rport_info_s rport_info; /* rport info from fcs/driver */
307 struct bfa_reqq_wait_s reqq_wait; /* to wait for room in reqq */
308 struct bfa_cb_qe_s hcb_qe; /* BFA callback qelem */
309 struct bfa_rport_hal_stats_s stats; /* BFA rport statistics */
310 struct bfa_rport_qos_attr_s qos_attr;
311 union a {
312 bfa_status_t status; /* f/w status */
313 void *fw_msg; /* QoS scn event */
314 } event_arg;
315};
316#define BFA_RPORT_FC_COS(_rport) ((_rport)->rport_info.fc_class)
317
318
Jing Huangacdc79a2010-10-18 17:15:55 -0700319/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700320 * UF - unsolicited receive related defines
321 */
322
323#define BFA_UF_MIN (4)
Krishna Gudipati45070252011-06-24 20:24:29 -0700324#define BFA_UF_MAX (256)
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700325
326struct bfa_uf_s {
327 struct list_head qe; /* queue element */
328 struct bfa_s *bfa; /* bfa instance */
329 u16 uf_tag; /* identifying tag fw msgs */
330 u16 vf_id;
331 u16 src_rport_handle;
332 u16 rsvd;
333 u8 *data_ptr;
334 u16 data_len; /* actual receive length */
335 u16 pb_len; /* posted buffer length */
336 void *buf_kva; /* buffer virtual address */
337 u64 buf_pa; /* buffer physical address */
338 struct bfa_cb_qe_s hcb_qe; /* comp: BFA comp qelem */
339 struct bfa_sge_s sges[BFI_SGE_INLINE_MAX];
340};
341
Jing Huangacdc79a2010-10-18 17:15:55 -0700342/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700343 * Callback prototype for unsolicited frame receive handler.
344 *
345 * @param[in] cbarg callback arg for receive handler
346 * @param[in] uf unsolicited frame descriptor
347 *
348 * @return None
349 */
350typedef void (*bfa_cb_uf_recv_t) (void *cbarg, struct bfa_uf_s *uf);
351
Krishna Gudipati45070252011-06-24 20:24:29 -0700352#define BFA_UF_BUFSZ (2 * 1024 + 256)
353
354struct bfa_uf_buf_s {
355 u8 d[BFA_UF_BUFSZ];
356};
357
358#define BFA_PER_UF_DMA_SZ \
359 (u32)BFA_ROUNDUP(sizeof(struct bfa_uf_buf_s), BFA_DMA_ALIGN_SZ)
360
361/* Max UF dma segs required */
362#define BFA_UF_DMA_SEGS BFI_MEM_DMA_NSEGS(BFA_UF_MAX, BFA_PER_UF_DMA_SZ)
363
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700364struct bfa_uf_mod_s {
365 struct bfa_s *bfa; /* back pointer to BFA */
366 struct bfa_uf_s *uf_list; /* array of UFs */
367 u16 num_ufs; /* num unsolicited rx frames */
368 struct list_head uf_free_q; /* free UFs */
369 struct list_head uf_posted_q; /* UFs posted to IOC */
Krishna Gudipati3fd45982011-06-24 20:24:08 -0700370 struct list_head uf_unused_q; /* unused UF's */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700371 struct bfi_uf_buf_post_s *uf_buf_posts;
372 /* pre-built UF post msgs */
373 bfa_cb_uf_recv_t ufrecv; /* uf recv handler function */
374 void *cbarg; /* uf receive handler arg */
Krishna Gudipati45070252011-06-24 20:24:29 -0700375 struct bfa_mem_dma_s dma_seg[BFA_UF_DMA_SEGS];
376 struct bfa_mem_kva_s kva_seg;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700377};
378
379#define BFA_UF_MOD(__bfa) (&(__bfa)->modules.uf_mod)
Krishna Gudipati45070252011-06-24 20:24:29 -0700380#define BFA_MEM_UF_KVA(__bfa) (&(BFA_UF_MOD(__bfa)->kva_seg))
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700381
382#define ufm_pbs_pa(_ufmod, _uftag) \
Krishna Gudipati45070252011-06-24 20:24:29 -0700383 bfa_mem_get_dmabuf_pa(_ufmod, _uftag, BFA_PER_UF_DMA_SZ)
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700384
385void bfa_uf_isr(struct bfa_s *bfa, struct bfi_msg_s *msg);
Krishna Gudipati3fd45982011-06-24 20:24:08 -0700386void bfa_uf_res_recfg(struct bfa_s *bfa, u16 num_uf_fw);
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700387
Jing Huangacdc79a2010-10-18 17:15:55 -0700388/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700389 * LPS - bfa lport login/logout service interface
390 */
391struct bfa_lps_s {
392 struct list_head qe; /* queue element */
393 struct bfa_s *bfa; /* parent bfa instance */
394 bfa_sm_t sm; /* finite state machine */
Krishna Gudipati3fd45982011-06-24 20:24:08 -0700395 u8 bfa_tag; /* lport tag */
396 u8 fw_tag; /* lport fw tag */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700397 u8 reqq; /* lport request queue */
398 u8 alpa; /* ALPA for loop topologies */
399 u32 lp_pid; /* lport port ID */
400 bfa_boolean_t fdisc; /* snd FDISC instead of FLOGI */
401 bfa_boolean_t auth_en; /* enable authentication */
402 bfa_boolean_t auth_req; /* authentication required */
403 bfa_boolean_t npiv_en; /* NPIV is allowed by peer */
404 bfa_boolean_t fport; /* attached peer is F_PORT */
405 bfa_boolean_t brcd_switch; /* attached peer is brcd sw */
406 bfa_status_t status; /* login status */
407 u16 pdusz; /* max receive PDU size */
408 u16 pr_bbcred; /* BB_CREDIT from peer */
409 u8 lsrjt_rsn; /* LSRJT reason */
410 u8 lsrjt_expl; /* LSRJT explanation */
Krishna Gudipati83763d52011-07-20 17:04:03 -0700411 u8 lun_mask; /* LUN mask flag */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700412 wwn_t pwwn; /* port wwn of lport */
413 wwn_t nwwn; /* node wwn of lport */
414 wwn_t pr_pwwn; /* port wwn of lport peer */
415 wwn_t pr_nwwn; /* node wwn of lport peer */
416 mac_t lp_mac; /* fpma/spma MAC for lport */
417 mac_t fcf_mac; /* FCF MAC of lport */
418 struct bfa_reqq_wait_s wqe; /* request wait queue element */
419 void *uarg; /* user callback arg */
420 struct bfa_cb_qe_s hcb_qe; /* comp: callback qelem */
421 struct bfi_lps_login_rsp_s *loginrsp;
422 bfa_eproto_status_t ext_status;
423};
424
425struct bfa_lps_mod_s {
426 struct list_head lps_free_q;
427 struct list_head lps_active_q;
Krishna Gudipati3fd45982011-06-24 20:24:08 -0700428 struct list_head lps_login_q;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700429 struct bfa_lps_s *lps_arr;
430 int num_lps;
Krishna Gudipati45070252011-06-24 20:24:29 -0700431 struct bfa_mem_kva_s kva_seg;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700432};
433
434#define BFA_LPS_MOD(__bfa) (&(__bfa)->modules.lps_mod)
435#define BFA_LPS_FROM_TAG(__mod, __tag) (&(__mod)->lps_arr[__tag])
Krishna Gudipati45070252011-06-24 20:24:29 -0700436#define BFA_MEM_LPS_KVA(__bfa) (&(BFA_LPS_MOD(__bfa)->kva_seg))
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700437
438/*
439 * external functions
440 */
441void bfa_lps_isr(struct bfa_s *bfa, struct bfi_msg_s *msg);
442
443
Jing Huangacdc79a2010-10-18 17:15:55 -0700444/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700445 * FCPORT related defines
446 */
447
448#define BFA_FCPORT(_bfa) (&((_bfa)->modules.port))
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700449
Jing Huangacdc79a2010-10-18 17:15:55 -0700450/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700451 * Link notification data structure
452 */
453struct bfa_fcport_ln_s {
454 struct bfa_fcport_s *fcport;
455 bfa_sm_t sm;
456 struct bfa_cb_qe_s ln_qe; /* BFA callback queue elem for ln */
457 enum bfa_port_linkstate ln_event; /* ln event for callback */
458};
459
460struct bfa_fcport_trunk_s {
461 struct bfa_trunk_attr_s attr;
462};
463
Jing Huangacdc79a2010-10-18 17:15:55 -0700464/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700465 * BFA FC port data structure
466 */
467struct bfa_fcport_s {
468 struct bfa_s *bfa; /* parent BFA instance */
469 bfa_sm_t sm; /* port state machine */
470 wwn_t nwwn; /* node wwn of physical port */
471 wwn_t pwwn; /* port wwn of physical oprt */
472 enum bfa_port_speed speed_sup;
473 /* supported speeds */
474 enum bfa_port_speed speed; /* current speed */
475 enum bfa_port_topology topology; /* current topology */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700476 u8 rsvd[3];
Krishna Gudipatibc0e2c22012-09-21 17:23:59 -0700477 u8 myalpa; /* my ALPA in LOOP topology */
478 u8 alpabm_valid; /* alpa bitmap valid or not */
479 struct fc_alpabm_s alpabm; /* alpa bitmap */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700480 struct bfa_port_cfg_s cfg; /* current port configuration */
Krishna Gudipatif3a060c2010-12-13 16:16:50 -0800481 bfa_boolean_t use_flash_cfg; /* get port cfg from flash */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700482 struct bfa_qos_attr_s qos_attr; /* QoS Attributes */
483 struct bfa_qos_vc_attr_s qos_vc_attr; /* VC info from ELP */
484 struct bfa_reqq_wait_s reqq_wait;
485 /* to wait for room in reqq */
486 struct bfa_reqq_wait_s svcreq_wait;
487 /* to wait for room in reqq */
488 struct bfa_reqq_wait_s stats_reqq_wait;
489 /* to wait for room in reqq (stats) */
490 void *event_cbarg;
491 void (*event_cbfn) (void *cbarg,
492 enum bfa_port_linkstate event);
493 union {
494 union bfi_fcport_i2h_msg_u i2hmsg;
495 } event_arg;
496 void *bfad; /* BFA driver handle */
497 struct bfa_fcport_ln_s ln; /* Link Notification */
498 struct bfa_cb_qe_s hcb_qe; /* BFA callback queue elem */
499 struct bfa_timer_s timer; /* timer */
500 u32 msgtag; /* fimrware msg tag for reply */
501 u8 *stats_kva;
502 u64 stats_pa;
503 union bfa_fcport_stats_u *stats;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700504 bfa_status_t stats_status; /* stats/statsclr status */
Krishna Gudipati37ea0552011-07-20 17:02:11 -0700505 struct list_head stats_pending_q;
506 struct list_head statsclr_pending_q;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700507 bfa_boolean_t stats_qfull;
508 u32 stats_reset_time; /* stats reset time stamp */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700509 bfa_boolean_t diag_busy; /* diag busy status */
510 bfa_boolean_t beacon; /* port beacon status */
511 bfa_boolean_t link_e2e_beacon; /* link beacon status */
512 struct bfa_fcport_trunk_s trunk;
513 u16 fcoe_vlan;
Krishna Gudipati45070252011-06-24 20:24:29 -0700514 struct bfa_mem_dma_s fcport_dma;
Krishna Gudipati6894f012012-09-21 17:26:31 -0700515 bfa_boolean_t stats_dma_ready;
Vijaya Mohan Guvvabbe37a62013-05-13 02:33:19 -0700516 struct bfa_bbcr_attr_s bbcr_attr;
Vijaya Mohan Guvva4e1e0d82013-05-13 02:33:20 -0700517 enum bfa_fec_state_s fec_state;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700518};
519
520#define BFA_FCPORT_MOD(__bfa) (&(__bfa)->modules.fcport)
Krishna Gudipati45070252011-06-24 20:24:29 -0700521#define BFA_MEM_FCPORT_DMA(__bfa) (&(BFA_FCPORT_MOD(__bfa)->fcport_dma))
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700522
523/*
524 * protected functions
525 */
526void bfa_fcport_init(struct bfa_s *bfa);
527void bfa_fcport_isr(struct bfa_s *bfa, struct bfi_msg_s *msg);
528
529/*
530 * bfa fcport API functions
531 */
532bfa_status_t bfa_fcport_enable(struct bfa_s *bfa);
533bfa_status_t bfa_fcport_disable(struct bfa_s *bfa);
534bfa_status_t bfa_fcport_cfg_speed(struct bfa_s *bfa,
535 enum bfa_port_speed speed);
536enum bfa_port_speed bfa_fcport_get_speed(struct bfa_s *bfa);
537bfa_status_t bfa_fcport_cfg_topology(struct bfa_s *bfa,
538 enum bfa_port_topology topo);
539enum bfa_port_topology bfa_fcport_get_topology(struct bfa_s *bfa);
Krishna Gudipatibc0e2c22012-09-21 17:23:59 -0700540enum bfa_port_topology bfa_fcport_get_cfg_topology(struct bfa_s *bfa);
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700541bfa_status_t bfa_fcport_cfg_hardalpa(struct bfa_s *bfa, u8 alpa);
542bfa_boolean_t bfa_fcport_get_hardalpa(struct bfa_s *bfa, u8 *alpa);
543u8 bfa_fcport_get_myalpa(struct bfa_s *bfa);
544bfa_status_t bfa_fcport_clr_hardalpa(struct bfa_s *bfa);
545bfa_status_t bfa_fcport_cfg_maxfrsize(struct bfa_s *bfa, u16 maxsize);
546u16 bfa_fcport_get_maxfrsize(struct bfa_s *bfa);
547u8 bfa_fcport_get_rx_bbcredit(struct bfa_s *bfa);
548void bfa_fcport_get_attr(struct bfa_s *bfa, struct bfa_port_attr_s *attr);
549wwn_t bfa_fcport_get_wwn(struct bfa_s *bfa, bfa_boolean_t node);
550void bfa_fcport_event_register(struct bfa_s *bfa,
551 void (*event_cbfn) (void *cbarg,
552 enum bfa_port_linkstate event), void *event_cbarg);
553bfa_boolean_t bfa_fcport_is_disabled(struct bfa_s *bfa);
Krishna Gudipatie3535462012-09-21 17:26:07 -0700554bfa_boolean_t bfa_fcport_is_dport(struct bfa_s *bfa);
Vijaya Mohan Guvva1a898a72013-05-13 02:33:21 -0700555bfa_boolean_t bfa_fcport_is_ddport(struct bfa_s *bfa);
Krishna Gudipati6894f012012-09-21 17:26:31 -0700556bfa_status_t bfa_fcport_set_qos_bw(struct bfa_s *bfa,
557 struct bfa_qos_bw_s *qos_bw);
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700558enum bfa_port_speed bfa_fcport_get_ratelim_speed(struct bfa_s *bfa);
559
Vijaya Mohan Guvvabbe37a62013-05-13 02:33:19 -0700560void bfa_fcport_set_tx_bbcredit(struct bfa_s *bfa, u16 tx_bbcredit);
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700561bfa_boolean_t bfa_fcport_is_ratelim(struct bfa_s *bfa);
Krishna Gudipati3d7fc662011-06-24 20:28:17 -0700562void bfa_fcport_beacon(void *dev, bfa_boolean_t beacon,
563 bfa_boolean_t link_e2e_beacon);
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700564bfa_boolean_t bfa_fcport_is_linkup(struct bfa_s *bfa);
565bfa_status_t bfa_fcport_get_stats(struct bfa_s *bfa,
Krishna Gudipati37ea0552011-07-20 17:02:11 -0700566 struct bfa_cb_pending_q_s *cb);
567bfa_status_t bfa_fcport_clear_stats(struct bfa_s *bfa,
568 struct bfa_cb_pending_q_s *cb);
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700569bfa_boolean_t bfa_fcport_is_qos_enabled(struct bfa_s *bfa);
Krishna Gudipatibe540a92011-06-13 15:53:04 -0700570bfa_boolean_t bfa_fcport_is_trunk_enabled(struct bfa_s *bfa);
Krishna Gudipatie3535462012-09-21 17:26:07 -0700571void bfa_fcport_dportenable(struct bfa_s *bfa);
572void bfa_fcport_dportdisable(struct bfa_s *bfa);
Krishna Gudipati43ffdf42011-06-13 15:46:21 -0700573bfa_status_t bfa_fcport_is_pbcdisabled(struct bfa_s *bfa);
Krishna Gudipatia7141342011-06-24 20:23:19 -0700574void bfa_fcport_cfg_faa(struct bfa_s *bfa, u8 state);
Vijaya Mohan Guvvabbe37a62013-05-13 02:33:19 -0700575bfa_status_t bfa_fcport_cfg_bbcr(struct bfa_s *bfa,
576 bfa_boolean_t on_off, u8 bb_scn);
577bfa_status_t bfa_fcport_get_bbcr_attr(struct bfa_s *bfa,
578 struct bfa_bbcr_attr_s *bbcr_attr);
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700579
580/*
581 * bfa rport API functions
582 */
583struct bfa_rport_s *bfa_rport_create(struct bfa_s *bfa, void *rport_drv);
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700584void bfa_rport_online(struct bfa_rport_s *rport,
585 struct bfa_rport_info_s *rport_info);
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700586void bfa_rport_speed(struct bfa_rport_s *rport, enum bfa_port_speed speed);
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700587void bfa_cb_rport_online(void *rport);
588void bfa_cb_rport_offline(void *rport);
589void bfa_cb_rport_qos_scn_flowid(void *rport,
590 struct bfa_rport_qos_attr_s old_qos_attr,
591 struct bfa_rport_qos_attr_s new_qos_attr);
Krishna Gudipatibc0e2c22012-09-21 17:23:59 -0700592void bfa_cb_rport_scn_online(struct bfa_s *bfa);
593void bfa_cb_rport_scn_offline(struct bfa_s *bfa);
594void bfa_cb_rport_scn_no_dev(void *rp);
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700595void bfa_cb_rport_qos_scn_prio(void *rport,
596 struct bfa_rport_qos_attr_s old_qos_attr,
597 struct bfa_rport_qos_attr_s new_qos_attr);
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700598
599/*
Krishna Gudipati83763d52011-07-20 17:04:03 -0700600 * Rport LUN masking related
601 */
602#define BFA_RPORT_TAG_INVALID 0xffff
603#define BFA_LP_TAG_INVALID 0xff
604void bfa_rport_set_lunmask(struct bfa_s *bfa, struct bfa_rport_s *rp);
605void bfa_rport_unset_lunmask(struct bfa_s *bfa, struct bfa_rport_s *rp);
Krishna Gudipati83763d52011-07-20 17:04:03 -0700606
607/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700608 * bfa fcxp API functions
609 */
Krishna Gudipatic3f1b122012-08-22 19:51:08 -0700610struct bfa_fcxp_s *bfa_fcxp_req_rsp_alloc(void *bfad_fcxp, struct bfa_s *bfa,
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700611 int nreq_sgles, int nrsp_sgles,
612 bfa_fcxp_get_sgaddr_t get_req_sga,
613 bfa_fcxp_get_sglen_t get_req_sglen,
614 bfa_fcxp_get_sgaddr_t get_rsp_sga,
Krishna Gudipatic3f1b122012-08-22 19:51:08 -0700615 bfa_fcxp_get_sglen_t get_rsp_sglen,
616 bfa_boolean_t req);
617void bfa_fcxp_req_rsp_alloc_wait(struct bfa_s *bfa, struct bfa_fcxp_wqe_s *wqe,
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700618 bfa_fcxp_alloc_cbfn_t alloc_cbfn,
619 void *cbarg, void *bfad_fcxp,
620 int nreq_sgles, int nrsp_sgles,
621 bfa_fcxp_get_sgaddr_t get_req_sga,
622 bfa_fcxp_get_sglen_t get_req_sglen,
623 bfa_fcxp_get_sgaddr_t get_rsp_sga,
Krishna Gudipatic3f1b122012-08-22 19:51:08 -0700624 bfa_fcxp_get_sglen_t get_rsp_sglen,
625 bfa_boolean_t req);
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700626void bfa_fcxp_walloc_cancel(struct bfa_s *bfa,
627 struct bfa_fcxp_wqe_s *wqe);
628void bfa_fcxp_discard(struct bfa_fcxp_s *fcxp);
629
630void *bfa_fcxp_get_reqbuf(struct bfa_fcxp_s *fcxp);
631void *bfa_fcxp_get_rspbuf(struct bfa_fcxp_s *fcxp);
632
633void bfa_fcxp_free(struct bfa_fcxp_s *fcxp);
634
635void bfa_fcxp_send(struct bfa_fcxp_s *fcxp, struct bfa_rport_s *rport,
636 u16 vf_id, u8 lp_tag,
637 bfa_boolean_t cts, enum fc_cos cos,
638 u32 reqlen, struct fchs_s *fchs,
639 bfa_cb_fcxp_send_t cbfn,
640 void *cbarg,
641 u32 rsp_maxlen, u8 rsp_timeout);
642bfa_status_t bfa_fcxp_abort(struct bfa_fcxp_s *fcxp);
643u32 bfa_fcxp_get_reqbufsz(struct bfa_fcxp_s *fcxp);
644u32 bfa_fcxp_get_maxrsp(struct bfa_s *bfa);
Krishna Gudipati3fd45982011-06-24 20:24:08 -0700645void bfa_fcxp_res_recfg(struct bfa_s *bfa, u16 num_fcxp_fw);
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700646
647static inline void *
648bfa_uf_get_frmbuf(struct bfa_uf_s *uf)
649{
650 return uf->data_ptr;
651}
652
653static inline u16
654bfa_uf_get_frmlen(struct bfa_uf_s *uf)
655{
656 return uf->data_len;
657}
658
659/*
660 * bfa uf API functions
661 */
662void bfa_uf_recv_register(struct bfa_s *bfa, bfa_cb_uf_recv_t ufrecv,
663 void *cbarg);
664void bfa_uf_free(struct bfa_uf_s *uf);
665
Jing Huangacdc79a2010-10-18 17:15:55 -0700666/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700667 * bfa lport service api
668 */
669
670u32 bfa_lps_get_max_vport(struct bfa_s *bfa);
671struct bfa_lps_s *bfa_lps_alloc(struct bfa_s *bfa);
672void bfa_lps_delete(struct bfa_lps_s *lps);
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700673void bfa_lps_flogi(struct bfa_lps_s *lps, void *uarg, u8 alpa,
674 u16 pdusz, wwn_t pwwn, wwn_t nwwn,
Vijaya Mohan Guvvabbe37a62013-05-13 02:33:19 -0700675 bfa_boolean_t auth_en);
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700676void bfa_lps_fdisc(struct bfa_lps_s *lps, void *uarg, u16 pdusz,
677 wwn_t pwwn, wwn_t nwwn);
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700678void bfa_lps_fdisclogo(struct bfa_lps_s *lps);
Krishna Gudipatib7044952010-12-13 16:17:42 -0800679void bfa_lps_set_n2n_pid(struct bfa_lps_s *lps, u32 n2n_pid);
Krishna Gudipati3fd45982011-06-24 20:24:08 -0700680u8 bfa_lps_get_fwtag(struct bfa_s *bfa, u8 lp_tag);
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700681u32 bfa_lps_get_base_pid(struct bfa_s *bfa);
682u8 bfa_lps_get_tag_from_pid(struct bfa_s *bfa, u32 pid);
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700683void bfa_cb_lps_flogi_comp(void *bfad, void *uarg, bfa_status_t status);
Krishna Gudipati881c1b32012-08-22 19:52:02 -0700684void bfa_cb_lps_flogo_comp(void *bfad, void *uarg);
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700685void bfa_cb_lps_fdisc_comp(void *bfad, void *uarg, bfa_status_t status);
686void bfa_cb_lps_fdisclogo_comp(void *bfad, void *uarg);
687void bfa_cb_lps_cvl_event(void *bfad, void *uarg);
688
Krishna Gudipatia7141342011-06-24 20:23:19 -0700689/* FAA specific APIs */
Krishna Gudipatia7141342011-06-24 20:23:19 -0700690bfa_status_t bfa_faa_query(struct bfa_s *bfa, struct bfa_faa_attr_s *attr,
691 bfa_cb_iocfc_t cbfn, void *cbarg);
692
Krishna Gudipati3d7fc662011-06-24 20:28:17 -0700693/*
694 * FC DIAG data structure
695 */
696struct bfa_fcdiag_qtest_s {
697 struct bfa_diag_qtest_result_s *result;
698 bfa_cb_diag_t cbfn;
699 void *cbarg;
700 struct bfa_timer_s timer;
701 u32 status;
702 u32 count;
703 u8 lock;
704 u8 queue;
705 u8 all;
706 u8 timer_active;
707};
708
709struct bfa_fcdiag_lb_s {
710 bfa_cb_diag_t cbfn;
711 void *cbarg;
712 void *result;
713 bfa_boolean_t lock;
714 u32 status;
715};
716
Krishna Gudipatie3535462012-09-21 17:26:07 -0700717struct bfa_dport_s {
718 struct bfa_s *bfa; /* Back pointer to BFA */
719 bfa_sm_t sm; /* finite state machine */
Krishna Gudipatie3535462012-09-21 17:26:07 -0700720 struct bfa_reqq_wait_s reqq_wait;
721 bfa_cb_diag_t cbfn;
722 void *cbarg;
Vijaya Mohan Guvva1a898a72013-05-13 02:33:21 -0700723 union bfi_diag_dport_msg_u i2hmsg;
724 u8 test_state; /* enum dport_test_state */
725 u8 dynamic; /* boolean_t */
726 u8 rsvd[2];
727 u32 lpcnt;
728 u32 payload; /* user defined payload pattern */
729 wwn_t rp_pwwn;
730 wwn_t rp_nwwn;
731 struct bfa_diag_dport_result_s result;
Krishna Gudipatie3535462012-09-21 17:26:07 -0700732};
733
Krishna Gudipati3d7fc662011-06-24 20:28:17 -0700734struct bfa_fcdiag_s {
735 struct bfa_s *bfa; /* Back pointer to BFA */
736 struct bfa_trc_mod_s *trcmod;
737 struct bfa_fcdiag_lb_s lb;
738 struct bfa_fcdiag_qtest_s qtest;
Krishna Gudipatie3535462012-09-21 17:26:07 -0700739 struct bfa_dport_s dport;
Krishna Gudipati3d7fc662011-06-24 20:28:17 -0700740};
741
742#define BFA_FCDIAG_MOD(__bfa) (&(__bfa)->modules.fcdiag)
743
744void bfa_fcdiag_intr(struct bfa_s *bfa, struct bfi_msg_s *msg);
745
746bfa_status_t bfa_fcdiag_loopback(struct bfa_s *bfa,
747 enum bfa_port_opmode opmode,
748 enum bfa_port_speed speed, u32 lpcnt, u32 pat,
749 struct bfa_diag_loopback_result_s *result,
750 bfa_cb_diag_t cbfn, void *cbarg);
751bfa_status_t bfa_fcdiag_queuetest(struct bfa_s *bfa, u32 ignore,
752 u32 queue, struct bfa_diag_qtest_result_s *result,
753 bfa_cb_diag_t cbfn, void *cbarg);
754bfa_status_t bfa_fcdiag_lb_is_running(struct bfa_s *bfa);
Vijaya Mohan Guvva1a898a72013-05-13 02:33:21 -0700755bfa_status_t bfa_dport_enable(struct bfa_s *bfa, u32 lpcnt, u32 pat,
756 bfa_cb_diag_t cbfn, void *cbarg);
Krishna Gudipatie3535462012-09-21 17:26:07 -0700757bfa_status_t bfa_dport_disable(struct bfa_s *bfa, bfa_cb_diag_t cbfn,
758 void *cbarg);
Vijaya Mohan Guvva1a898a72013-05-13 02:33:21 -0700759bfa_status_t bfa_dport_start(struct bfa_s *bfa, u32 lpcnt, u32 pat,
760 bfa_cb_diag_t cbfn, void *cbarg);
761bfa_status_t bfa_dport_show(struct bfa_s *bfa,
762 struct bfa_diag_dport_result_s *result);
Krishna Gudipati3d7fc662011-06-24 20:28:17 -0700763
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700764#endif /* __BFA_SVC_H__ */