diff options
Diffstat (limited to 'drivers/scsi/bfa/bfa_fcpim_priv.h')
-rw-r--r-- | drivers/scsi/bfa/bfa_fcpim_priv.h | 188 |
1 files changed, 188 insertions, 0 deletions
diff --git a/drivers/scsi/bfa/bfa_fcpim_priv.h b/drivers/scsi/bfa/bfa_fcpim_priv.h new file mode 100644 index 000000000000..153206cfb37a --- /dev/null +++ b/drivers/scsi/bfa/bfa_fcpim_priv.h | |||
@@ -0,0 +1,188 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2005-2009 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_PRIV_H__ | ||
19 | #define __BFA_FCPIM_PRIV_H__ | ||
20 | |||
21 | #include <bfa_fcpim.h> | ||
22 | #include <defs/bfa_defs_fcpim.h> | ||
23 | #include <cs/bfa_wc.h> | ||
24 | #include "bfa_sgpg_priv.h" | ||
25 | |||
26 | #define BFA_ITNIM_MIN 32 | ||
27 | #define BFA_ITNIM_MAX 1024 | ||
28 | |||
29 | #define BFA_IOIM_MIN 8 | ||
30 | #define BFA_IOIM_MAX 2000 | ||
31 | |||
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 */ | ||
36 | |||
37 | #define bfa_fcpim_stats(__fcpim, __stats) \ | ||
38 | (__fcpim)->stats.__stats ++ | ||
39 | |||
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 | u16 rsvd; | ||
53 | struct list_head itnim_q; /* queue of active itnim */ | ||
54 | struct list_head ioim_free_q; /* free IO resources */ | ||
55 | struct list_head ioim_resfree_q; /* IOs waiting for f/w */ | ||
56 | struct list_head ioim_comp_q; /* IO global comp Q */ | ||
57 | struct list_head tskim_free_q; | ||
58 | u32 ios_active; /* current active IOs */ | ||
59 | u32 delay_comp; | ||
60 | struct bfa_fcpim_stats_s stats; | ||
61 | }; | ||
62 | |||
63 | struct bfa_ioim_s; | ||
64 | struct bfa_tskim_s; | ||
65 | |||
66 | /** | ||
67 | * BFA IO (initiator mode) | ||
68 | */ | ||
69 | struct bfa_ioim_s { | ||
70 | struct list_head qe; /* queue elememt */ | ||
71 | bfa_sm_t sm; /* BFA ioim state machine */ | ||
72 | struct bfa_s *bfa; /* BFA module */ | ||
73 | struct bfa_fcpim_mod_s *fcpim; /* parent fcpim module */ | ||
74 | struct bfa_itnim_s *itnim; /* i-t-n nexus for this IO */ | ||
75 | struct bfad_ioim_s *dio; /* driver IO handle */ | ||
76 | u16 iotag; /* FWI IO tag */ | ||
77 | u16 abort_tag; /* unqiue abort request tag */ | ||
78 | u16 nsges; /* number of SG elements */ | ||
79 | u16 nsgpgs; /* number of SG pages */ | ||
80 | struct bfa_sgpg_s *sgpg; /* first SG page */ | ||
81 | struct list_head sgpg_q; /* allocated SG pages */ | ||
82 | struct bfa_cb_qe_s hcb_qe; /* bfa callback qelem */ | ||
83 | bfa_cb_cbfn_t io_cbfn; /* IO completion handler */ | ||
84 | struct bfa_ioim_sp_s *iosp; /* slow-path IO handling */ | ||
85 | }; | ||
86 | |||
87 | struct bfa_ioim_sp_s { | ||
88 | struct bfi_msg_s comp_rspmsg; /* IO comp f/w response */ | ||
89 | u8 *snsinfo; /* sense info for this IO */ | ||
90 | struct bfa_sgpg_wqe_s sgpg_wqe; /* waitq elem for sgpg */ | ||
91 | struct bfa_reqq_wait_s reqq_wait; /* to wait for room in reqq */ | ||
92 | bfa_boolean_t abort_explicit; /* aborted by OS */ | ||
93 | struct bfa_tskim_s *tskim; /* Relevant TM cmd */ | ||
94 | }; | ||
95 | |||
96 | /** | ||
97 | * BFA Task management command (initiator mode) | ||
98 | */ | ||
99 | struct bfa_tskim_s { | ||
100 | struct list_head qe; | ||
101 | bfa_sm_t sm; | ||
102 | struct bfa_s *bfa; /* BFA module */ | ||
103 | struct bfa_fcpim_mod_s *fcpim; /* parent fcpim module */ | ||
104 | struct bfa_itnim_s *itnim; /* i-t-n nexus for this IO */ | ||
105 | struct bfad_tskim_s *dtsk; /* driver task mgmt cmnd */ | ||
106 | bfa_boolean_t notify; /* notify itnim on TM comp */ | ||
107 | lun_t lun; /* lun if applicable */ | ||
108 | enum fcp_tm_cmnd tm_cmnd; /* task management command */ | ||
109 | u16 tsk_tag; /* FWI IO tag */ | ||
110 | u8 tsecs; /* timeout in seconds */ | ||
111 | struct bfa_reqq_wait_s reqq_wait; /* to wait for room in reqq */ | ||
112 | struct list_head io_q; /* queue of affected IOs */ | ||
113 | struct bfa_wc_s wc; /* waiting counter */ | ||
114 | struct bfa_cb_qe_s hcb_qe; /* bfa callback qelem */ | ||
115 | enum bfi_tskim_status tsk_status; /* TM status */ | ||
116 | }; | ||
117 | |||
118 | /** | ||
119 | * BFA i-t-n (initiator mode) | ||
120 | */ | ||
121 | struct bfa_itnim_s { | ||
122 | struct list_head qe; /* queue element */ | ||
123 | bfa_sm_t sm; /* i-t-n im BFA state machine */ | ||
124 | struct bfa_s *bfa; /* bfa instance */ | ||
125 | struct bfa_rport_s *rport; /* bfa rport */ | ||
126 | void *ditn; /* driver i-t-n structure */ | ||
127 | struct bfi_mhdr_s mhdr; /* pre-built mhdr */ | ||
128 | u8 msg_no; /* itnim/rport firmware handle */ | ||
129 | u8 reqq; /* CQ for requests */ | ||
130 | struct bfa_cb_qe_s hcb_qe; /* bfa callback qelem */ | ||
131 | struct list_head pending_q; /* queue of pending IO requests*/ | ||
132 | struct list_head io_q; /* queue of active IO requests */ | ||
133 | struct list_head io_cleanup_q; /* IO being cleaned up */ | ||
134 | struct list_head tsk_q; /* queue of active TM commands */ | ||
135 | struct list_head delay_comp_q;/* queue of failed inflight cmds */ | ||
136 | bfa_boolean_t seq_rec; /* SQER supported */ | ||
137 | bfa_boolean_t is_online; /* itnim is ONLINE for IO */ | ||
138 | bfa_boolean_t iotov_active; /* IO TOV timer is active */ | ||
139 | struct bfa_wc_s wc; /* waiting counter */ | ||
140 | struct bfa_timer_s timer; /* pending IO TOV */ | ||
141 | struct bfa_reqq_wait_s reqq_wait; /* to wait for room in reqq */ | ||
142 | struct bfa_fcpim_mod_s *fcpim; /* fcpim module */ | ||
143 | struct bfa_itnim_hal_stats_s stats; | ||
144 | }; | ||
145 | |||
146 | #define bfa_itnim_is_online(_itnim) (_itnim)->is_online | ||
147 | #define BFA_FCPIM_MOD(_hal) (&(_hal)->modules.fcpim_mod) | ||
148 | #define BFA_IOIM_FROM_TAG(_fcpim, _iotag) \ | ||
149 | (&fcpim->ioim_arr[_iotag]) | ||
150 | #define BFA_TSKIM_FROM_TAG(_fcpim, _tmtag) \ | ||
151 | (&fcpim->tskim_arr[_tmtag & (fcpim->num_tskim_reqs - 1)]) | ||
152 | |||
153 | /* | ||
154 | * function prototypes | ||
155 | */ | ||
156 | void bfa_ioim_attach(struct bfa_fcpim_mod_s *fcpim, | ||
157 | struct bfa_meminfo_s *minfo); | ||
158 | void bfa_ioim_detach(struct bfa_fcpim_mod_s *fcpim); | ||
159 | void bfa_ioim_isr(struct bfa_s *bfa, struct bfi_msg_s *msg); | ||
160 | void bfa_ioim_good_comp_isr(struct bfa_s *bfa, | ||
161 | struct bfi_msg_s *msg); | ||
162 | void bfa_ioim_cleanup(struct bfa_ioim_s *ioim); | ||
163 | void bfa_ioim_cleanup_tm(struct bfa_ioim_s *ioim, | ||
164 | struct bfa_tskim_s *tskim); | ||
165 | void bfa_ioim_iocdisable(struct bfa_ioim_s *ioim); | ||
166 | void bfa_ioim_tov(struct bfa_ioim_s *ioim); | ||
167 | |||
168 | void bfa_tskim_attach(struct bfa_fcpim_mod_s *fcpim, | ||
169 | struct bfa_meminfo_s *minfo); | ||
170 | void bfa_tskim_detach(struct bfa_fcpim_mod_s *fcpim); | ||
171 | void bfa_tskim_isr(struct bfa_s *bfa, struct bfi_msg_s *msg); | ||
172 | void bfa_tskim_iodone(struct bfa_tskim_s *tskim); | ||
173 | void bfa_tskim_iocdisable(struct bfa_tskim_s *tskim); | ||
174 | void bfa_tskim_cleanup(struct bfa_tskim_s *tskim); | ||
175 | |||
176 | void bfa_itnim_meminfo(struct bfa_iocfc_cfg_s *cfg, u32 *km_len, | ||
177 | u32 *dm_len); | ||
178 | void bfa_itnim_attach(struct bfa_fcpim_mod_s *fcpim, | ||
179 | struct bfa_meminfo_s *minfo); | ||
180 | void bfa_itnim_detach(struct bfa_fcpim_mod_s *fcpim); | ||
181 | void bfa_itnim_iocdisable(struct bfa_itnim_s *itnim); | ||
182 | void bfa_itnim_isr(struct bfa_s *bfa, struct bfi_msg_s *msg); | ||
183 | void bfa_itnim_iodone(struct bfa_itnim_s *itnim); | ||
184 | void bfa_itnim_tskdone(struct bfa_itnim_s *itnim); | ||
185 | bfa_boolean_t bfa_itnim_hold_io(struct bfa_itnim_s *itnim); | ||
186 | |||
187 | #endif /* __BFA_FCPIM_PRIV_H__ */ | ||
188 | |||