GUI: Fix Tomato RAF theme for all builds. Compilation typo.
[tomato.git] / release / src-rt-6.x.4708 / linux / linux-2.6.36 / drivers / scsi / bfa / bfa_fcpim_priv.h
blob5e5460a5b1400babc693798d88cf603c81e48529
1 /*
2 * Copyright (c) 2005-2009 Brocade Communications Systems, Inc.
3 * All rights reserved
4 * www.brocade.com
6 * Linux driver for Brocade Fibre Channel Host Bus Adapter.
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
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.
18 #ifndef __BFA_FCPIM_PRIV_H__
19 #define __BFA_FCPIM_PRIV_H__
21 #include <bfa_fcpim.h>
22 #include <defs/bfa_defs_fcpim.h>
23 #include <cs/bfa_wc.h>
24 #include "bfa_sgpg_priv.h"
26 #define BFA_ITNIM_MIN 32
27 #define BFA_ITNIM_MAX 1024
29 #define BFA_IOIM_MIN 8
30 #define BFA_IOIM_MAX 2000
32 #define BFA_TSKIM_MIN 4
33 #define BFA_TSKIM_MAX 512
34 #define BFA_FCPIM_PATHTOV_DEF (30 * 1000) /* in millisecs */
35 #define BFA_FCPIM_PATHTOV_MAX (90 * 1000) /* in millisecs */
37 #define bfa_fcpim_stats(__fcpim, __stats) \
38 ((__fcpim)->stats.__stats++)
40 struct bfa_fcpim_mod_s {
41 struct bfa_s *bfa;
42 struct bfa_itnim_s *itnim_arr;
43 struct bfa_ioim_s *ioim_arr;
44 struct bfa_ioim_sp_s *ioim_sp_arr;
45 struct bfa_tskim_s *tskim_arr;
46 struct bfa_dma_s snsbase;
47 int num_itnims;
48 int num_ioim_reqs;
49 int num_tskim_reqs;
50 u32 path_tov;
51 u16 q_depth;
52 u8 reqq; /* Request queue to be used */
53 u8 rsvd;
54 struct list_head itnim_q; /* queue of active itnim */
55 struct list_head ioim_free_q; /* free IO resources */
56 struct list_head ioim_resfree_q; /* IOs waiting for f/w */
57 struct list_head ioim_comp_q; /* IO global comp Q */
58 struct list_head tskim_free_q;
59 u32 ios_active; /* current active IOs */
60 u32 delay_comp;
61 struct bfa_fcpim_stats_s stats;
62 bfa_boolean_t ioredirect;
65 struct bfa_ioim_s;
66 struct bfa_tskim_s;
68 /**
69 * BFA IO (initiator mode)
71 struct bfa_ioim_s {
72 struct list_head qe; /* queue elememt */
73 bfa_sm_t sm; /* BFA ioim state machine */
74 struct bfa_s *bfa; /* BFA module */
75 struct bfa_fcpim_mod_s *fcpim; /* parent fcpim module */
76 struct bfa_itnim_s *itnim; /* i-t-n nexus for this IO */
77 struct bfad_ioim_s *dio; /* driver IO handle */
78 u16 iotag; /* FWI IO tag */
79 u16 abort_tag; /* unqiue abort request tag */
80 u16 nsges; /* number of SG elements */
81 u16 nsgpgs; /* number of SG pages */
82 struct bfa_sgpg_s *sgpg; /* first SG page */
83 struct list_head sgpg_q; /* allocated SG pages */
84 struct bfa_cb_qe_s hcb_qe; /* bfa callback qelem */
85 bfa_cb_cbfn_t io_cbfn; /* IO completion handler */
86 struct bfa_ioim_sp_s *iosp; /* slow-path IO handling */
87 u8 reqq; /* Request queue for I/O */
90 struct bfa_ioim_sp_s {
91 struct bfi_msg_s comp_rspmsg; /* IO comp f/w response */
92 u8 *snsinfo; /* sense info for this IO */
93 struct bfa_sgpg_wqe_s sgpg_wqe; /* waitq elem for sgpg */
94 struct bfa_reqq_wait_s reqq_wait; /* to wait for room in reqq */
95 bfa_boolean_t abort_explicit; /* aborted by OS */
96 struct bfa_tskim_s *tskim; /* Relevant TM cmd */
99 /**
100 * BFA Task management command (initiator mode)
102 struct bfa_tskim_s {
103 struct list_head qe;
104 bfa_sm_t sm;
105 struct bfa_s *bfa; /* BFA module */
106 struct bfa_fcpim_mod_s *fcpim; /* parent fcpim module */
107 struct bfa_itnim_s *itnim; /* i-t-n nexus for this IO */
108 struct bfad_tskim_s *dtsk; /* driver task mgmt cmnd */
109 bfa_boolean_t notify; /* notify itnim on TM comp */
110 lun_t lun; /* lun if applicable */
111 enum fcp_tm_cmnd tm_cmnd; /* task management command */
112 u16 tsk_tag; /* FWI IO tag */
113 u8 tsecs; /* timeout in seconds */
114 struct bfa_reqq_wait_s reqq_wait; /* to wait for room in reqq */
115 struct list_head io_q; /* queue of affected IOs */
116 struct bfa_wc_s wc; /* waiting counter */
117 struct bfa_cb_qe_s hcb_qe; /* bfa callback qelem */
118 enum bfi_tskim_status tsk_status; /* TM status */
122 * BFA i-t-n (initiator mode)
124 struct bfa_itnim_s {
125 struct list_head qe; /* queue element */
126 bfa_sm_t sm; /* i-t-n im BFA state machine */
127 struct bfa_s *bfa; /* bfa instance */
128 struct bfa_rport_s *rport; /* bfa rport */
129 void *ditn; /* driver i-t-n structure */
130 struct bfi_mhdr_s mhdr; /* pre-built mhdr */
131 u8 msg_no; /* itnim/rport firmware handle */
132 u8 reqq; /* CQ for requests */
133 struct bfa_cb_qe_s hcb_qe; /* bfa callback qelem */
134 struct list_head pending_q; /* queue of pending IO requests*/
135 struct list_head io_q; /* queue of active IO requests */
136 struct list_head io_cleanup_q; /* IO being cleaned up */
137 struct list_head tsk_q; /* queue of active TM commands */
138 struct list_head delay_comp_q;/* queue of failed inflight cmds */
139 bfa_boolean_t seq_rec; /* SQER supported */
140 bfa_boolean_t is_online; /* itnim is ONLINE for IO */
141 bfa_boolean_t iotov_active; /* IO TOV timer is active */
142 struct bfa_wc_s wc; /* waiting counter */
143 struct bfa_timer_s timer; /* pending IO TOV */
144 struct bfa_reqq_wait_s reqq_wait; /* to wait for room in reqq */
145 struct bfa_fcpim_mod_s *fcpim; /* fcpim module */
146 struct bfa_itnim_hal_stats_s stats;
147 struct bfa_itnim_latency_s io_latency;
150 #define bfa_itnim_is_online(_itnim) ((_itnim)->is_online)
151 #define BFA_FCPIM_MOD(_hal) (&(_hal)->modules.fcpim_mod)
152 #define BFA_IOIM_FROM_TAG(_fcpim, _iotag) \
153 (&fcpim->ioim_arr[_iotag])
154 #define BFA_TSKIM_FROM_TAG(_fcpim, _tmtag) \
155 (&fcpim->tskim_arr[_tmtag & (fcpim->num_tskim_reqs - 1)])
158 * function prototypes
160 void bfa_ioim_attach(struct bfa_fcpim_mod_s *fcpim,
161 struct bfa_meminfo_s *minfo);
162 void bfa_ioim_detach(struct bfa_fcpim_mod_s *fcpim);
163 void bfa_ioim_isr(struct bfa_s *bfa, struct bfi_msg_s *msg);
164 void bfa_ioim_good_comp_isr(struct bfa_s *bfa,
165 struct bfi_msg_s *msg);
166 void bfa_ioim_cleanup(struct bfa_ioim_s *ioim);
167 void bfa_ioim_cleanup_tm(struct bfa_ioim_s *ioim,
168 struct bfa_tskim_s *tskim);
169 void bfa_ioim_iocdisable(struct bfa_ioim_s *ioim);
170 void bfa_ioim_tov(struct bfa_ioim_s *ioim);
172 void bfa_tskim_attach(struct bfa_fcpim_mod_s *fcpim,
173 struct bfa_meminfo_s *minfo);
174 void bfa_tskim_detach(struct bfa_fcpim_mod_s *fcpim);
175 void bfa_tskim_isr(struct bfa_s *bfa, struct bfi_msg_s *msg);
176 void bfa_tskim_iodone(struct bfa_tskim_s *tskim);
177 void bfa_tskim_iocdisable(struct bfa_tskim_s *tskim);
178 void bfa_tskim_cleanup(struct bfa_tskim_s *tskim);
180 void bfa_itnim_meminfo(struct bfa_iocfc_cfg_s *cfg, u32 *km_len,
181 u32 *dm_len);
182 void bfa_itnim_attach(struct bfa_fcpim_mod_s *fcpim,
183 struct bfa_meminfo_s *minfo);
184 void bfa_itnim_detach(struct bfa_fcpim_mod_s *fcpim);
185 void bfa_itnim_iocdisable(struct bfa_itnim_s *itnim);
186 void bfa_itnim_isr(struct bfa_s *bfa, struct bfi_msg_s *msg);
187 void bfa_itnim_iodone(struct bfa_itnim_s *itnim);
188 void bfa_itnim_tskdone(struct bfa_itnim_s *itnim);
189 bfa_boolean_t bfa_itnim_hold_io(struct bfa_itnim_s *itnim);
191 #endif /* __BFA_FCPIM_PRIV_H__ */