blob: c224987b9c30dc0d94ea5224a81f66ebd832acef [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_FCPIM_H__
19#define __BFA_FCPIM_H__
20
21#include "bfa.h"
22#include "bfa_svc.h"
23#include "bfi_ms.h"
24#include "bfa_defs_svc.h"
25#include "bfa_cs.h"
26
Krishna Gudipatie2187d72011-06-13 15:53:58 -070027/* FCP module related definitions */
Krishna Gudipati45070252011-06-24 20:24:29 -070028#define BFA_IO_MAX BFI_IO_MAX
29#define BFA_FWTIO_MAX 2000
Krishna Gudipatie2187d72011-06-13 15:53:58 -070030
31struct bfa_fcp_mod_s;
32struct bfa_iotag_s {
33 struct list_head qe; /* queue element */
34 u16 tag; /* FW IO tag */
35};
36
37struct bfa_itn_s {
38 bfa_isr_func_t isr;
39};
40
41void bfa_itn_create(struct bfa_s *bfa, struct bfa_rport_s *rport,
42 void (*isr)(struct bfa_s *bfa, struct bfi_msg_s *m));
43void bfa_itn_isr(struct bfa_s *bfa, struct bfi_msg_s *m);
Krishna Gudipati45070252011-06-24 20:24:29 -070044void bfa_iotag_attach(struct bfa_fcp_mod_s *fcp);
Krishna Gudipati3fd45982011-06-24 20:24:08 -070045void bfa_fcp_res_recfg(struct bfa_s *bfa, u16 num_ioim_fw);
Krishna Gudipatie2187d72011-06-13 15:53:58 -070046
47#define BFA_FCP_MOD(_hal) (&(_hal)->modules.fcp_mod)
Krishna Gudipati45070252011-06-24 20:24:29 -070048#define BFA_MEM_FCP_KVA(__bfa) (&(BFA_FCP_MOD(__bfa)->kva_seg))
Krishna Gudipatie2187d72011-06-13 15:53:58 -070049#define BFA_IOTAG_FROM_TAG(_fcp, _tag) \
50 (&(_fcp)->iotag_arr[(_tag & BFA_IOIM_IOTAG_MASK)])
51#define BFA_ITN_FROM_TAG(_fcp, _tag) \
52 ((_fcp)->itn_arr + ((_tag) & ((_fcp)->num_itns - 1)))
53#define BFA_SNSINFO_FROM_TAG(_fcp, _tag) \
Krishna Gudipati45070252011-06-24 20:24:29 -070054 bfa_mem_get_dmabuf_kva(_fcp, _tag, BFI_IOIM_SNSLEN)
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070055
56#define BFA_ITNIM_MIN 32
57#define BFA_ITNIM_MAX 1024
58
59#define BFA_IOIM_MIN 8
60#define BFA_IOIM_MAX 2000
61
62#define BFA_TSKIM_MIN 4
63#define BFA_TSKIM_MAX 512
64#define BFA_FCPIM_PATHTOV_DEF (30 * 1000) /* in millisecs */
65#define BFA_FCPIM_PATHTOV_MAX (90 * 1000) /* in millisecs */
66
67
68#define bfa_itnim_ioprofile_update(__itnim, __index) \
69 (__itnim->ioprofile.iocomps[__index]++)
70
71#define BFA_IOIM_RETRY_TAG_OFFSET 11
Krishna Gudipati15821f02010-12-13 16:23:27 -080072#define BFA_IOIM_IOTAG_MASK 0x07ff /* 2K IOs */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070073#define BFA_IOIM_RETRY_MAX 7
74
75/* Buckets are are 512 bytes to 2MB */
76static inline u32
77bfa_ioim_get_index(u32 n) {
78 int pos = 0;
79 if (n >= (1UL)<<22)
80 return BFA_IOBUCKET_MAX - 1;
81 n >>= 8;
Krishna Gudipati42a8e6e2011-07-20 17:01:52 -070082 if (n >= (1UL)<<16) {
83 n >>= 16;
84 pos += 16;
85 }
86 if (n >= 1 << 8) {
87 n >>= 8;
88 pos += 8;
89 }
90 if (n >= 1 << 4) {
91 n >>= 4;
92 pos += 4;
93 }
94 if (n >= 1 << 2) {
95 n >>= 2;
96 pos += 2;
97 }
Krishna Gudipatia36c61f2010-09-15 11:50:55 -070098 if (n >= 1 << 1)
99 pos += 1;
100
101 return (n == 0) ? (0) : pos;
102}
103
104/*
105 * forward declarations
106 */
107struct bfa_ioim_s;
108struct bfa_tskim_s;
109struct bfad_ioim_s;
110struct bfad_tskim_s;
111
112typedef void (*bfa_fcpim_profile_t) (struct bfa_ioim_s *ioim);
113
Krishna Gudipatie2187d72011-06-13 15:53:58 -0700114struct bfa_fcpim_s {
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700115 struct bfa_s *bfa;
Krishna Gudipatie2187d72011-06-13 15:53:58 -0700116 struct bfa_fcp_mod_s *fcp;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700117 struct bfa_itnim_s *itnim_arr;
118 struct bfa_ioim_s *ioim_arr;
119 struct bfa_ioim_sp_s *ioim_sp_arr;
120 struct bfa_tskim_s *tskim_arr;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700121 int num_itnims;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700122 int num_tskim_reqs;
123 u32 path_tov;
124 u16 q_depth;
125 u8 reqq; /* Request queue to be used */
126 u8 rsvd;
127 struct list_head itnim_q; /* queue of active itnim */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700128 struct list_head ioim_resfree_q; /* IOs waiting for f/w */
129 struct list_head ioim_comp_q; /* IO global comp Q */
130 struct list_head tskim_free_q;
Krishna Gudipati3fd45982011-06-24 20:24:08 -0700131 struct list_head tskim_unused_q; /* Unused tskim Q */
Maggie Zhangda99dcc2010-12-09 19:13:20 -0800132 u32 ios_active; /* current active IOs */
133 u32 delay_comp;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700134 struct bfa_fcpim_del_itn_stats_s del_itn_stats;
135 bfa_boolean_t ioredirect;
136 bfa_boolean_t io_profile;
Maggie Zhangda99dcc2010-12-09 19:13:20 -0800137 u32 io_profile_start_time;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700138 bfa_fcpim_profile_t profile_comp;
139 bfa_fcpim_profile_t profile_start;
140};
141
Krishna Gudipati45070252011-06-24 20:24:29 -0700142/* Max FCP dma segs required */
143#define BFA_FCP_DMA_SEGS BFI_IOIM_SNSBUF_SEGS
144
Krishna Gudipatie2187d72011-06-13 15:53:58 -0700145struct bfa_fcp_mod_s {
146 struct bfa_s *bfa;
147 struct list_head iotag_ioim_free_q; /* free IO resources */
148 struct list_head iotag_tio_free_q; /* free IO resources */
Krishna Gudipati3fd45982011-06-24 20:24:08 -0700149 struct list_head iotag_unused_q; /* unused IO resources*/
Krishna Gudipatie2187d72011-06-13 15:53:58 -0700150 struct bfa_iotag_s *iotag_arr;
151 struct bfa_itn_s *itn_arr;
152 int num_ioim_reqs;
153 int num_fwtio_reqs;
154 int num_itns;
Krishna Gudipati45070252011-06-24 20:24:29 -0700155 struct bfa_dma_s snsbase[BFA_FCP_DMA_SEGS];
Krishna Gudipatie2187d72011-06-13 15:53:58 -0700156 struct bfa_fcpim_s fcpim;
Krishna Gudipati45070252011-06-24 20:24:29 -0700157 struct bfa_mem_dma_s dma_seg[BFA_FCP_DMA_SEGS];
158 struct bfa_mem_kva_s kva_seg;
Krishna Gudipatie2187d72011-06-13 15:53:58 -0700159};
160
Jing Huangacdc79a2010-10-18 17:15:55 -0700161/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700162 * BFA IO (initiator mode)
163 */
164struct bfa_ioim_s {
165 struct list_head qe; /* queue elememt */
166 bfa_sm_t sm; /* BFA ioim state machine */
167 struct bfa_s *bfa; /* BFA module */
Krishna Gudipatie2187d72011-06-13 15:53:58 -0700168 struct bfa_fcpim_s *fcpim; /* parent fcpim module */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700169 struct bfa_itnim_s *itnim; /* i-t-n nexus for this IO */
170 struct bfad_ioim_s *dio; /* driver IO handle */
Maggie Zhangda99dcc2010-12-09 19:13:20 -0800171 u16 iotag; /* FWI IO tag */
172 u16 abort_tag; /* unqiue abort request tag */
173 u16 nsges; /* number of SG elements */
174 u16 nsgpgs; /* number of SG pages */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700175 struct bfa_sgpg_s *sgpg; /* first SG page */
176 struct list_head sgpg_q; /* allocated SG pages */
177 struct bfa_cb_qe_s hcb_qe; /* bfa callback qelem */
178 bfa_cb_cbfn_t io_cbfn; /* IO completion handler */
Maggie Zhangda99dcc2010-12-09 19:13:20 -0800179 struct bfa_ioim_sp_s *iosp; /* slow-path IO handling */
180 u8 reqq; /* Request queue for I/O */
181 u64 start_time; /* IO's Profile start val */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700182};
183
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700184struct bfa_ioim_sp_s {
185 struct bfi_msg_s comp_rspmsg; /* IO comp f/w response */
Maggie Zhangda99dcc2010-12-09 19:13:20 -0800186 struct bfa_sgpg_wqe_s sgpg_wqe; /* waitq elem for sgpg */
187 struct bfa_reqq_wait_s reqq_wait; /* to wait for room in reqq */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700188 bfa_boolean_t abort_explicit; /* aborted by OS */
189 struct bfa_tskim_s *tskim; /* Relevant TM cmd */
190};
191
Jing Huangacdc79a2010-10-18 17:15:55 -0700192/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700193 * BFA Task management command (initiator mode)
194 */
195struct bfa_tskim_s {
196 struct list_head qe;
197 bfa_sm_t sm;
Maggie Zhangda99dcc2010-12-09 19:13:20 -0800198 struct bfa_s *bfa; /* BFA module */
Krishna Gudipatie2187d72011-06-13 15:53:58 -0700199 struct bfa_fcpim_s *fcpim; /* parent fcpim module */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700200 struct bfa_itnim_s *itnim; /* i-t-n nexus for this IO */
Maggie Zhangf3148782010-12-09 19:11:39 -0800201 struct bfad_tskim_s *dtsk; /* driver task mgmt cmnd */
Maggie Zhangda99dcc2010-12-09 19:13:20 -0800202 bfa_boolean_t notify; /* notify itnim on TM comp */
Maggie Zhangf3148782010-12-09 19:11:39 -0800203 struct scsi_lun lun; /* lun if applicable */
Maggie Zhangda99dcc2010-12-09 19:13:20 -0800204 enum fcp_tm_cmnd tm_cmnd; /* task management command */
205 u16 tsk_tag; /* FWI IO tag */
206 u8 tsecs; /* timeout in seconds */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700207 struct bfa_reqq_wait_s reqq_wait; /* to wait for room in reqq */
208 struct list_head io_q; /* queue of affected IOs */
Maggie Zhangda99dcc2010-12-09 19:13:20 -0800209 struct bfa_wc_s wc; /* waiting counter */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700210 struct bfa_cb_qe_s hcb_qe; /* bfa callback qelem */
211 enum bfi_tskim_status tsk_status; /* TM status */
212};
213
Jing Huangacdc79a2010-10-18 17:15:55 -0700214/*
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700215 * BFA i-t-n (initiator mode)
216 */
217struct bfa_itnim_s {
Maggie Zhangda99dcc2010-12-09 19:13:20 -0800218 struct list_head qe; /* queue element */
219 bfa_sm_t sm; /* i-t-n im BFA state machine */
220 struct bfa_s *bfa; /* bfa instance */
221 struct bfa_rport_s *rport; /* bfa rport */
222 void *ditn; /* driver i-t-n structure */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700223 struct bfi_mhdr_s mhdr; /* pre-built mhdr */
Maggie Zhangda99dcc2010-12-09 19:13:20 -0800224 u8 msg_no; /* itnim/rport firmware handle */
225 u8 reqq; /* CQ for requests */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700226 struct bfa_cb_qe_s hcb_qe; /* bfa callback qelem */
227 struct list_head pending_q; /* queue of pending IO requests */
228 struct list_head io_q; /* queue of active IO requests */
229 struct list_head io_cleanup_q; /* IO being cleaned up */
230 struct list_head tsk_q; /* queue of active TM commands */
231 struct list_head delay_comp_q; /* queue of failed inflight cmds */
232 bfa_boolean_t seq_rec; /* SQER supported */
233 bfa_boolean_t is_online; /* itnim is ONLINE for IO */
234 bfa_boolean_t iotov_active; /* IO TOV timer is active */
Maggie Zhangda99dcc2010-12-09 19:13:20 -0800235 struct bfa_wc_s wc; /* waiting counter */
236 struct bfa_timer_s timer; /* pending IO TOV */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700237 struct bfa_reqq_wait_s reqq_wait; /* to wait for room in reqq */
Krishna Gudipatie2187d72011-06-13 15:53:58 -0700238 struct bfa_fcpim_s *fcpim; /* fcpim module */
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700239 struct bfa_itnim_iostats_s stats;
240 struct bfa_itnim_ioprofile_s ioprofile;
241};
242
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700243#define bfa_itnim_is_online(_itnim) ((_itnim)->is_online)
Krishna Gudipatie2187d72011-06-13 15:53:58 -0700244#define BFA_FCPIM(_hal) (&(_hal)->modules.fcp_mod.fcpim)
Krishna Gudipati15821f02010-12-13 16:23:27 -0800245#define BFA_IOIM_TAG_2_ID(_iotag) ((_iotag) & BFA_IOIM_IOTAG_MASK)
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700246#define BFA_IOIM_FROM_TAG(_fcpim, _iotag) \
Krishna Gudipati15821f02010-12-13 16:23:27 -0800247 (&fcpim->ioim_arr[(_iotag & BFA_IOIM_IOTAG_MASK)])
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700248#define BFA_TSKIM_FROM_TAG(_fcpim, _tmtag) \
249 (&fcpim->tskim_arr[_tmtag & (fcpim->num_tskim_reqs - 1)])
250
251#define bfa_io_profile_start_time(_bfa) \
Krishna Gudipatie2187d72011-06-13 15:53:58 -0700252 ((_bfa)->modules.fcp_mod.fcpim.io_profile_start_time)
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700253#define bfa_fcpim_get_io_profile(_bfa) \
Krishna Gudipatie2187d72011-06-13 15:53:58 -0700254 ((_bfa)->modules.fcp_mod.fcpim.io_profile)
Krishna Gudipati15821f02010-12-13 16:23:27 -0800255#define bfa_ioim_update_iotag(__ioim) do { \
256 uint16_t k = (__ioim)->iotag >> BFA_IOIM_RETRY_TAG_OFFSET; \
257 k++; (__ioim)->iotag &= BFA_IOIM_IOTAG_MASK; \
258 (__ioim)->iotag |= k << BFA_IOIM_RETRY_TAG_OFFSET; \
259} while (0)
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700260
261static inline bfa_boolean_t
Krishna Gudipati15821f02010-12-13 16:23:27 -0800262bfa_ioim_maxretry_reached(struct bfa_ioim_s *ioim)
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700263{
Krishna Gudipati15821f02010-12-13 16:23:27 -0800264 uint16_t k = ioim->iotag >> BFA_IOIM_RETRY_TAG_OFFSET;
265 if (k < BFA_IOIM_RETRY_MAX)
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700266 return BFA_FALSE;
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700267 return BFA_TRUE;
268}
Krishna Gudipati15821f02010-12-13 16:23:27 -0800269
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700270/*
271 * function prototypes
272 */
Krishna Gudipati45070252011-06-24 20:24:29 -0700273void bfa_ioim_attach(struct bfa_fcpim_s *fcpim);
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700274void bfa_ioim_isr(struct bfa_s *bfa, struct bfi_msg_s *msg);
275void bfa_ioim_good_comp_isr(struct bfa_s *bfa,
276 struct bfi_msg_s *msg);
277void bfa_ioim_cleanup(struct bfa_ioim_s *ioim);
278void bfa_ioim_cleanup_tm(struct bfa_ioim_s *ioim,
279 struct bfa_tskim_s *tskim);
280void bfa_ioim_iocdisable(struct bfa_ioim_s *ioim);
281void bfa_ioim_tov(struct bfa_ioim_s *ioim);
282
Krishna Gudipati45070252011-06-24 20:24:29 -0700283void bfa_tskim_attach(struct bfa_fcpim_s *fcpim);
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700284void bfa_tskim_isr(struct bfa_s *bfa, struct bfi_msg_s *msg);
285void bfa_tskim_iodone(struct bfa_tskim_s *tskim);
286void bfa_tskim_iocdisable(struct bfa_tskim_s *tskim);
287void bfa_tskim_cleanup(struct bfa_tskim_s *tskim);
Krishna Gudipati3fd45982011-06-24 20:24:08 -0700288void bfa_tskim_res_recfg(struct bfa_s *bfa, u16 num_tskim_fw);
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700289
Krishna Gudipati45070252011-06-24 20:24:29 -0700290void bfa_itnim_meminfo(struct bfa_iocfc_cfg_s *cfg, u32 *km_len);
291void bfa_itnim_attach(struct bfa_fcpim_s *fcpim);
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700292void bfa_itnim_iocdisable(struct bfa_itnim_s *itnim);
293void bfa_itnim_isr(struct bfa_s *bfa, struct bfi_msg_s *msg);
294void bfa_itnim_iodone(struct bfa_itnim_s *itnim);
295void bfa_itnim_tskdone(struct bfa_itnim_s *itnim);
296bfa_boolean_t bfa_itnim_hold_io(struct bfa_itnim_s *itnim);
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700297
298/*
299 * bfa fcpim module API functions
300 */
Maggie Zhangda99dcc2010-12-09 19:13:20 -0800301void bfa_fcpim_path_tov_set(struct bfa_s *bfa, u16 path_tov);
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700302u16 bfa_fcpim_path_tov_get(struct bfa_s *bfa);
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700303u16 bfa_fcpim_qdepth_get(struct bfa_s *bfa);
Krishna Gudipati60138062011-06-24 20:25:15 -0700304bfa_status_t bfa_fcpim_port_iostats(struct bfa_s *bfa,
305 struct bfa_itnim_iostats_s *stats, u8 lp_tag);
306void bfa_fcpim_add_stats(struct bfa_itnim_iostats_s *fcpim_stats,
307 struct bfa_itnim_iostats_s *itnim_stats);
Krishna Gudipati42a8e6e2011-07-20 17:01:52 -0700308bfa_status_t bfa_fcpim_profile_on(struct bfa_s *bfa, u32 time);
309bfa_status_t bfa_fcpim_profile_off(struct bfa_s *bfa);
Maggie Zhangda99dcc2010-12-09 19:13:20 -0800310
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700311#define bfa_fcpim_ioredirect_enabled(__bfa) \
Krishna Gudipatie2187d72011-06-13 15:53:58 -0700312 (((struct bfa_fcpim_s *)(BFA_FCPIM(__bfa)))->ioredirect)
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700313
314#define bfa_fcpim_get_next_reqq(__bfa, __qid) \
315{ \
Krishna Gudipatie2187d72011-06-13 15:53:58 -0700316 struct bfa_fcpim_s *__fcpim = BFA_FCPIM(__bfa); \
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700317 __fcpim->reqq++; \
318 __fcpim->reqq &= (BFI_IOC_MAX_CQS - 1); \
319 *(__qid) = __fcpim->reqq; \
320}
321
322#define bfa_iocfc_map_msg_to_qid(__msg, __qid) \
323 *(__qid) = (u8)((__msg) & (BFI_IOC_MAX_CQS - 1));
324/*
325 * bfa itnim API functions
326 */
327struct bfa_itnim_s *bfa_itnim_create(struct bfa_s *bfa,
Maggie Zhangda99dcc2010-12-09 19:13:20 -0800328 struct bfa_rport_s *rport, void *itnim);
329void bfa_itnim_delete(struct bfa_itnim_s *itnim);
330void bfa_itnim_online(struct bfa_itnim_s *itnim, bfa_boolean_t seq_rec);
331void bfa_itnim_offline(struct bfa_itnim_s *itnim);
332void bfa_itnim_clear_stats(struct bfa_itnim_s *itnim);
333bfa_status_t bfa_itnim_get_ioprofile(struct bfa_itnim_s *itnim,
334 struct bfa_itnim_ioprofile_s *ioprofile);
335
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700336#define bfa_itnim_get_reqq(__ioim) (((struct bfa_ioim_s *)__ioim)->itnim->reqq)
337
Jing Huangacdc79a2010-10-18 17:15:55 -0700338/*
Maggie Zhangda99dcc2010-12-09 19:13:20 -0800339 * BFA completion callback for bfa_itnim_online().
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700340 */
341void bfa_cb_itnim_online(void *itnim);
342
Jing Huangacdc79a2010-10-18 17:15:55 -0700343/*
Maggie Zhangda99dcc2010-12-09 19:13:20 -0800344 * BFA completion callback for bfa_itnim_offline().
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700345 */
346void bfa_cb_itnim_offline(void *itnim);
347void bfa_cb_itnim_tov_begin(void *itnim);
348void bfa_cb_itnim_tov(void *itnim);
349
Jing Huangacdc79a2010-10-18 17:15:55 -0700350/*
Maggie Zhangda99dcc2010-12-09 19:13:20 -0800351 * BFA notification to FCS/driver for second level error recovery.
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700352 * Atleast one I/O request has timedout and target is unresponsive to
353 * repeated abort requests. Second level error recovery should be initiated
354 * by starting implicit logout and recovery procedures.
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700355 */
356void bfa_cb_itnim_sler(void *itnim);
357
358/*
359 * bfa ioim API functions
360 */
361struct bfa_ioim_s *bfa_ioim_alloc(struct bfa_s *bfa,
362 struct bfad_ioim_s *dio,
363 struct bfa_itnim_s *itnim,
364 u16 nsgles);
365
366void bfa_ioim_free(struct bfa_ioim_s *ioim);
367void bfa_ioim_start(struct bfa_ioim_s *ioim);
368bfa_status_t bfa_ioim_abort(struct bfa_ioim_s *ioim);
369void bfa_ioim_delayed_comp(struct bfa_ioim_s *ioim,
370 bfa_boolean_t iotov);
Jing Huangacdc79a2010-10-18 17:15:55 -0700371/*
Maggie Zhangda99dcc2010-12-09 19:13:20 -0800372 * I/O completion notification.
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700373 *
374 * @param[in] dio driver IO structure
375 * @param[in] io_status IO completion status
376 * @param[in] scsi_status SCSI status returned by target
377 * @param[in] sns_len SCSI sense length, 0 if none
378 * @param[in] sns_info SCSI sense data, if any
379 * @param[in] residue Residual length
380 *
381 * @return None
382 */
Maggie Zhangda99dcc2010-12-09 19:13:20 -0800383void bfa_cb_ioim_done(void *bfad, struct bfad_ioim_s *dio,
384 enum bfi_ioim_status io_status,
385 u8 scsi_status, int sns_len,
386 u8 *sns_info, s32 residue);
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700387
Jing Huangacdc79a2010-10-18 17:15:55 -0700388/*
Maggie Zhangda99dcc2010-12-09 19:13:20 -0800389 * I/O good completion notification.
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700390 */
Maggie Zhangda99dcc2010-12-09 19:13:20 -0800391void bfa_cb_ioim_good_comp(void *bfad, struct bfad_ioim_s *dio);
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700392
Jing Huangacdc79a2010-10-18 17:15:55 -0700393/*
Maggie Zhangda99dcc2010-12-09 19:13:20 -0800394 * I/O abort completion notification
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700395 */
Maggie Zhangda99dcc2010-12-09 19:13:20 -0800396void bfa_cb_ioim_abort(void *bfad, struct bfad_ioim_s *dio);
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700397
398/*
399 * bfa tskim API functions
400 */
Maggie Zhangda99dcc2010-12-09 19:13:20 -0800401struct bfa_tskim_s *bfa_tskim_alloc(struct bfa_s *bfa,
402 struct bfad_tskim_s *dtsk);
403void bfa_tskim_free(struct bfa_tskim_s *tskim);
404void bfa_tskim_start(struct bfa_tskim_s *tskim,
405 struct bfa_itnim_s *itnim, struct scsi_lun lun,
406 enum fcp_tm_cmnd tm, u8 t_secs);
407void bfa_cb_tskim_done(void *bfad, struct bfad_tskim_s *dtsk,
408 enum bfi_tskim_status tsk_status);
Krishna Gudipatia36c61f2010-09-15 11:50:55 -0700409
410#endif /* __BFA_FCPIM_H__ */