aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/bfa/bfa_fcpim.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/bfa/bfa_fcpim.h')
-rw-r--r--drivers/scsi/bfa/bfa_fcpim.h89
1 files changed, 67 insertions, 22 deletions
diff --git a/drivers/scsi/bfa/bfa_fcpim.h b/drivers/scsi/bfa/bfa_fcpim.h
index 1e38dade8423..57b695ad4ee5 100644
--- a/drivers/scsi/bfa/bfa_fcpim.h
+++ b/drivers/scsi/bfa/bfa_fcpim.h
@@ -24,6 +24,34 @@
24#include "bfa_defs_svc.h" 24#include "bfa_defs_svc.h"
25#include "bfa_cs.h" 25#include "bfa_cs.h"
26 26
27/* FCP module related definitions */
28#define BFA_IO_MAX BFI_IO_MAX
29#define BFA_FWTIO_MAX 2000
30
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);
44void bfa_iotag_attach(struct bfa_fcp_mod_s *fcp);
45void bfa_fcp_res_recfg(struct bfa_s *bfa, u16 num_ioim_fw);
46
47#define BFA_FCP_MOD(_hal) (&(_hal)->modules.fcp_mod)
48#define BFA_MEM_FCP_KVA(__bfa) (&(BFA_FCP_MOD(__bfa)->kva_seg))
49#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) \
54 bfa_mem_get_dmabuf_kva(_fcp, _tag, BFI_IOIM_SNSLEN)
27 55
28#define BFA_ITNIM_MIN 32 56#define BFA_ITNIM_MIN 32
29#define BFA_ITNIM_MAX 1024 57#define BFA_ITNIM_MAX 1024
@@ -75,25 +103,24 @@ struct bfad_tskim_s;
75 103
76typedef void (*bfa_fcpim_profile_t) (struct bfa_ioim_s *ioim); 104typedef void (*bfa_fcpim_profile_t) (struct bfa_ioim_s *ioim);
77 105
78struct bfa_fcpim_mod_s { 106struct bfa_fcpim_s {
79 struct bfa_s *bfa; 107 struct bfa_s *bfa;
108 struct bfa_fcp_mod_s *fcp;
80 struct bfa_itnim_s *itnim_arr; 109 struct bfa_itnim_s *itnim_arr;
81 struct bfa_ioim_s *ioim_arr; 110 struct bfa_ioim_s *ioim_arr;
82 struct bfa_ioim_sp_s *ioim_sp_arr; 111 struct bfa_ioim_sp_s *ioim_sp_arr;
83 struct bfa_tskim_s *tskim_arr; 112 struct bfa_tskim_s *tskim_arr;
84 struct bfa_dma_s snsbase;
85 int num_itnims; 113 int num_itnims;
86 int num_ioim_reqs;
87 int num_tskim_reqs; 114 int num_tskim_reqs;
88 u32 path_tov; 115 u32 path_tov;
89 u16 q_depth; 116 u16 q_depth;
90 u8 reqq; /* Request queue to be used */ 117 u8 reqq; /* Request queue to be used */
91 u8 rsvd; 118 u8 rsvd;
92 struct list_head itnim_q; /* queue of active itnim */ 119 struct list_head itnim_q; /* queue of active itnim */
93 struct list_head ioim_free_q; /* free IO resources */
94 struct list_head ioim_resfree_q; /* IOs waiting for f/w */ 120 struct list_head ioim_resfree_q; /* IOs waiting for f/w */
95 struct list_head ioim_comp_q; /* IO global comp Q */ 121 struct list_head ioim_comp_q; /* IO global comp Q */
96 struct list_head tskim_free_q; 122 struct list_head tskim_free_q;
123 struct list_head tskim_unused_q; /* Unused tskim Q */
97 u32 ios_active; /* current active IOs */ 124 u32 ios_active; /* current active IOs */
98 u32 delay_comp; 125 u32 delay_comp;
99 struct bfa_fcpim_del_itn_stats_s del_itn_stats; 126 struct bfa_fcpim_del_itn_stats_s del_itn_stats;
@@ -104,6 +131,25 @@ struct bfa_fcpim_mod_s {
104 bfa_fcpim_profile_t profile_start; 131 bfa_fcpim_profile_t profile_start;
105}; 132};
106 133
134/* Max FCP dma segs required */
135#define BFA_FCP_DMA_SEGS BFI_IOIM_SNSBUF_SEGS
136
137struct bfa_fcp_mod_s {
138 struct bfa_s *bfa;
139 struct list_head iotag_ioim_free_q; /* free IO resources */
140 struct list_head iotag_tio_free_q; /* free IO resources */
141 struct list_head iotag_unused_q; /* unused IO resources*/
142 struct bfa_iotag_s *iotag_arr;
143 struct bfa_itn_s *itn_arr;
144 int num_ioim_reqs;
145 int num_fwtio_reqs;
146 int num_itns;
147 struct bfa_dma_s snsbase[BFA_FCP_DMA_SEGS];
148 struct bfa_fcpim_s fcpim;
149 struct bfa_mem_dma_s dma_seg[BFA_FCP_DMA_SEGS];
150 struct bfa_mem_kva_s kva_seg;
151};
152
107/* 153/*
108 * BFA IO (initiator mode) 154 * BFA IO (initiator mode)
109 */ 155 */
@@ -111,7 +157,7 @@ struct bfa_ioim_s {
111 struct list_head qe; /* queue elememt */ 157 struct list_head qe; /* queue elememt */
112 bfa_sm_t sm; /* BFA ioim state machine */ 158 bfa_sm_t sm; /* BFA ioim state machine */
113 struct bfa_s *bfa; /* BFA module */ 159 struct bfa_s *bfa; /* BFA module */
114 struct bfa_fcpim_mod_s *fcpim; /* parent fcpim module */ 160 struct bfa_fcpim_s *fcpim; /* parent fcpim module */
115 struct bfa_itnim_s *itnim; /* i-t-n nexus for this IO */ 161 struct bfa_itnim_s *itnim; /* i-t-n nexus for this IO */
116 struct bfad_ioim_s *dio; /* driver IO handle */ 162 struct bfad_ioim_s *dio; /* driver IO handle */
117 u16 iotag; /* FWI IO tag */ 163 u16 iotag; /* FWI IO tag */
@@ -129,7 +175,6 @@ struct bfa_ioim_s {
129 175
130struct bfa_ioim_sp_s { 176struct bfa_ioim_sp_s {
131 struct bfi_msg_s comp_rspmsg; /* IO comp f/w response */ 177 struct bfi_msg_s comp_rspmsg; /* IO comp f/w response */
132 u8 *snsinfo; /* sense info for this IO */
133 struct bfa_sgpg_wqe_s sgpg_wqe; /* waitq elem for sgpg */ 178 struct bfa_sgpg_wqe_s sgpg_wqe; /* waitq elem for sgpg */
134 struct bfa_reqq_wait_s reqq_wait; /* to wait for room in reqq */ 179 struct bfa_reqq_wait_s reqq_wait; /* to wait for room in reqq */
135 bfa_boolean_t abort_explicit; /* aborted by OS */ 180 bfa_boolean_t abort_explicit; /* aborted by OS */
@@ -143,7 +188,7 @@ struct bfa_tskim_s {
143 struct list_head qe; 188 struct list_head qe;
144 bfa_sm_t sm; 189 bfa_sm_t sm;
145 struct bfa_s *bfa; /* BFA module */ 190 struct bfa_s *bfa; /* BFA module */
146 struct bfa_fcpim_mod_s *fcpim; /* parent fcpim module */ 191 struct bfa_fcpim_s *fcpim; /* parent fcpim module */
147 struct bfa_itnim_s *itnim; /* i-t-n nexus for this IO */ 192 struct bfa_itnim_s *itnim; /* i-t-n nexus for this IO */
148 struct bfad_tskim_s *dtsk; /* driver task mgmt cmnd */ 193 struct bfad_tskim_s *dtsk; /* driver task mgmt cmnd */
149 bfa_boolean_t notify; /* notify itnim on TM comp */ 194 bfa_boolean_t notify; /* notify itnim on TM comp */
@@ -182,13 +227,13 @@ struct bfa_itnim_s {
182 struct bfa_wc_s wc; /* waiting counter */ 227 struct bfa_wc_s wc; /* waiting counter */
183 struct bfa_timer_s timer; /* pending IO TOV */ 228 struct bfa_timer_s timer; /* pending IO TOV */
184 struct bfa_reqq_wait_s reqq_wait; /* to wait for room in reqq */ 229 struct bfa_reqq_wait_s reqq_wait; /* to wait for room in reqq */
185 struct bfa_fcpim_mod_s *fcpim; /* fcpim module */ 230 struct bfa_fcpim_s *fcpim; /* fcpim module */
186 struct bfa_itnim_iostats_s stats; 231 struct bfa_itnim_iostats_s stats;
187 struct bfa_itnim_ioprofile_s ioprofile; 232 struct bfa_itnim_ioprofile_s ioprofile;
188}; 233};
189 234
190#define bfa_itnim_is_online(_itnim) ((_itnim)->is_online) 235#define bfa_itnim_is_online(_itnim) ((_itnim)->is_online)
191#define BFA_FCPIM_MOD(_hal) (&(_hal)->modules.fcpim_mod) 236#define BFA_FCPIM(_hal) (&(_hal)->modules.fcp_mod.fcpim)
192#define BFA_IOIM_TAG_2_ID(_iotag) ((_iotag) & BFA_IOIM_IOTAG_MASK) 237#define BFA_IOIM_TAG_2_ID(_iotag) ((_iotag) & BFA_IOIM_IOTAG_MASK)
193#define BFA_IOIM_FROM_TAG(_fcpim, _iotag) \ 238#define BFA_IOIM_FROM_TAG(_fcpim, _iotag) \
194 (&fcpim->ioim_arr[(_iotag & BFA_IOIM_IOTAG_MASK)]) 239 (&fcpim->ioim_arr[(_iotag & BFA_IOIM_IOTAG_MASK)])
@@ -196,9 +241,9 @@ struct bfa_itnim_s {
196 (&fcpim->tskim_arr[_tmtag & (fcpim->num_tskim_reqs - 1)]) 241 (&fcpim->tskim_arr[_tmtag & (fcpim->num_tskim_reqs - 1)])
197 242
198#define bfa_io_profile_start_time(_bfa) \ 243#define bfa_io_profile_start_time(_bfa) \
199 (_bfa->modules.fcpim_mod.io_profile_start_time) 244 ((_bfa)->modules.fcp_mod.fcpim.io_profile_start_time)
200#define bfa_fcpim_get_io_profile(_bfa) \ 245#define bfa_fcpim_get_io_profile(_bfa) \
201 (_bfa->modules.fcpim_mod.io_profile) 246 ((_bfa)->modules.fcp_mod.fcpim.io_profile)
202#define bfa_ioim_update_iotag(__ioim) do { \ 247#define bfa_ioim_update_iotag(__ioim) do { \
203 uint16_t k = (__ioim)->iotag >> BFA_IOIM_RETRY_TAG_OFFSET; \ 248 uint16_t k = (__ioim)->iotag >> BFA_IOIM_RETRY_TAG_OFFSET; \
204 k++; (__ioim)->iotag &= BFA_IOIM_IOTAG_MASK; \ 249 k++; (__ioim)->iotag &= BFA_IOIM_IOTAG_MASK; \
@@ -217,8 +262,7 @@ bfa_ioim_maxretry_reached(struct bfa_ioim_s *ioim)
217/* 262/*
218 * function prototypes 263 * function prototypes
219 */ 264 */
220void bfa_ioim_attach(struct bfa_fcpim_mod_s *fcpim, 265void bfa_ioim_attach(struct bfa_fcpim_s *fcpim);
221 struct bfa_meminfo_s *minfo);
222void bfa_ioim_isr(struct bfa_s *bfa, struct bfi_msg_s *msg); 266void bfa_ioim_isr(struct bfa_s *bfa, struct bfi_msg_s *msg);
223void bfa_ioim_good_comp_isr(struct bfa_s *bfa, 267void bfa_ioim_good_comp_isr(struct bfa_s *bfa,
224 struct bfi_msg_s *msg); 268 struct bfi_msg_s *msg);
@@ -228,18 +272,15 @@ void bfa_ioim_cleanup_tm(struct bfa_ioim_s *ioim,
228void bfa_ioim_iocdisable(struct bfa_ioim_s *ioim); 272void bfa_ioim_iocdisable(struct bfa_ioim_s *ioim);
229void bfa_ioim_tov(struct bfa_ioim_s *ioim); 273void bfa_ioim_tov(struct bfa_ioim_s *ioim);
230 274
231void bfa_tskim_attach(struct bfa_fcpim_mod_s *fcpim, 275void bfa_tskim_attach(struct bfa_fcpim_s *fcpim);
232 struct bfa_meminfo_s *minfo);
233void bfa_tskim_isr(struct bfa_s *bfa, struct bfi_msg_s *msg); 276void bfa_tskim_isr(struct bfa_s *bfa, struct bfi_msg_s *msg);
234void bfa_tskim_iodone(struct bfa_tskim_s *tskim); 277void bfa_tskim_iodone(struct bfa_tskim_s *tskim);
235void bfa_tskim_iocdisable(struct bfa_tskim_s *tskim); 278void bfa_tskim_iocdisable(struct bfa_tskim_s *tskim);
236void bfa_tskim_cleanup(struct bfa_tskim_s *tskim); 279void bfa_tskim_cleanup(struct bfa_tskim_s *tskim);
280void bfa_tskim_res_recfg(struct bfa_s *bfa, u16 num_tskim_fw);
237 281
238void bfa_itnim_meminfo(struct bfa_iocfc_cfg_s *cfg, u32 *km_len, 282void bfa_itnim_meminfo(struct bfa_iocfc_cfg_s *cfg, u32 *km_len);
239 u32 *dm_len); 283void bfa_itnim_attach(struct bfa_fcpim_s *fcpim);
240void bfa_itnim_attach(struct bfa_fcpim_mod_s *fcpim,
241 struct bfa_meminfo_s *minfo);
242void bfa_itnim_detach(struct bfa_fcpim_mod_s *fcpim);
243void bfa_itnim_iocdisable(struct bfa_itnim_s *itnim); 284void bfa_itnim_iocdisable(struct bfa_itnim_s *itnim);
244void bfa_itnim_isr(struct bfa_s *bfa, struct bfi_msg_s *msg); 285void bfa_itnim_isr(struct bfa_s *bfa, struct bfi_msg_s *msg);
245void bfa_itnim_iodone(struct bfa_itnim_s *itnim); 286void bfa_itnim_iodone(struct bfa_itnim_s *itnim);
@@ -252,13 +293,17 @@ bfa_boolean_t bfa_itnim_hold_io(struct bfa_itnim_s *itnim);
252void bfa_fcpim_path_tov_set(struct bfa_s *bfa, u16 path_tov); 293void bfa_fcpim_path_tov_set(struct bfa_s *bfa, u16 path_tov);
253u16 bfa_fcpim_path_tov_get(struct bfa_s *bfa); 294u16 bfa_fcpim_path_tov_get(struct bfa_s *bfa);
254u16 bfa_fcpim_qdepth_get(struct bfa_s *bfa); 295u16 bfa_fcpim_qdepth_get(struct bfa_s *bfa);
296bfa_status_t bfa_fcpim_port_iostats(struct bfa_s *bfa,
297 struct bfa_itnim_iostats_s *stats, u8 lp_tag);
298void bfa_fcpim_add_stats(struct bfa_itnim_iostats_s *fcpim_stats,
299 struct bfa_itnim_iostats_s *itnim_stats);
255 300
256#define bfa_fcpim_ioredirect_enabled(__bfa) \ 301#define bfa_fcpim_ioredirect_enabled(__bfa) \
257 (((struct bfa_fcpim_mod_s *)(BFA_FCPIM_MOD(__bfa)))->ioredirect) 302 (((struct bfa_fcpim_s *)(BFA_FCPIM(__bfa)))->ioredirect)
258 303
259#define bfa_fcpim_get_next_reqq(__bfa, __qid) \ 304#define bfa_fcpim_get_next_reqq(__bfa, __qid) \
260{ \ 305{ \
261 struct bfa_fcpim_mod_s *__fcpim = BFA_FCPIM_MOD(__bfa); \ 306 struct bfa_fcpim_s *__fcpim = BFA_FCPIM(__bfa); \
262 __fcpim->reqq++; \ 307 __fcpim->reqq++; \
263 __fcpim->reqq &= (BFI_IOC_MAX_CQS - 1); \ 308 __fcpim->reqq &= (BFI_IOC_MAX_CQS - 1); \
264 *(__qid) = __fcpim->reqq; \ 309 *(__qid) = __fcpim->reqq; \