Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 1 | /* |
| 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 Gudipati | e2187d7 | 2011-06-13 15:53:58 -0700 | [diff] [blame^] | 27 | /* FCP module related definitions */ |
| 28 | #define BFA_IO_MAX 2000 |
| 29 | #define BFA_FWTIO_MAX 0 |
| 30 | |
| 31 | struct bfa_fcp_mod_s; |
| 32 | struct bfa_iotag_s { |
| 33 | struct list_head qe; /* queue element */ |
| 34 | u16 tag; /* FW IO tag */ |
| 35 | }; |
| 36 | |
| 37 | struct bfa_itn_s { |
| 38 | bfa_isr_func_t isr; |
| 39 | }; |
| 40 | |
| 41 | void bfa_itn_create(struct bfa_s *bfa, struct bfa_rport_s *rport, |
| 42 | void (*isr)(struct bfa_s *bfa, struct bfi_msg_s *m)); |
| 43 | void bfa_itn_isr(struct bfa_s *bfa, struct bfi_msg_s *m); |
| 44 | void bfa_iotag_attach(struct bfa_fcp_mod_s *fcp, struct bfa_meminfo_s *minfo); |
| 45 | |
| 46 | #define BFA_FCP_MOD(_hal) (&(_hal)->modules.fcp_mod) |
| 47 | #define BFA_IOTAG_FROM_TAG(_fcp, _tag) \ |
| 48 | (&(_fcp)->iotag_arr[(_tag & BFA_IOIM_IOTAG_MASK)]) |
| 49 | #define BFA_ITN_FROM_TAG(_fcp, _tag) \ |
| 50 | ((_fcp)->itn_arr + ((_tag) & ((_fcp)->num_itns - 1))) |
| 51 | #define BFA_SNSINFO_FROM_TAG(_fcp, _tag) \ |
| 52 | (((u8 *)(_fcp)->snsbase.kva) + (_tag * BFI_IOIM_SNSLEN)) |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 53 | |
| 54 | #define BFA_ITNIM_MIN 32 |
| 55 | #define BFA_ITNIM_MAX 1024 |
| 56 | |
| 57 | #define BFA_IOIM_MIN 8 |
| 58 | #define BFA_IOIM_MAX 2000 |
| 59 | |
| 60 | #define BFA_TSKIM_MIN 4 |
| 61 | #define BFA_TSKIM_MAX 512 |
| 62 | #define BFA_FCPIM_PATHTOV_DEF (30 * 1000) /* in millisecs */ |
| 63 | #define BFA_FCPIM_PATHTOV_MAX (90 * 1000) /* in millisecs */ |
| 64 | |
| 65 | |
| 66 | #define bfa_itnim_ioprofile_update(__itnim, __index) \ |
| 67 | (__itnim->ioprofile.iocomps[__index]++) |
| 68 | |
| 69 | #define BFA_IOIM_RETRY_TAG_OFFSET 11 |
Krishna Gudipati | 15821f0 | 2010-12-13 16:23:27 -0800 | [diff] [blame] | 70 | #define BFA_IOIM_IOTAG_MASK 0x07ff /* 2K IOs */ |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 71 | #define BFA_IOIM_RETRY_MAX 7 |
| 72 | |
| 73 | /* Buckets are are 512 bytes to 2MB */ |
| 74 | static inline u32 |
| 75 | bfa_ioim_get_index(u32 n) { |
| 76 | int pos = 0; |
| 77 | if (n >= (1UL)<<22) |
| 78 | return BFA_IOBUCKET_MAX - 1; |
| 79 | n >>= 8; |
| 80 | if (n >= (1UL)<<16) |
| 81 | n >>= 16; pos += 16; |
| 82 | if (n >= 1 << 8) |
| 83 | n >>= 8; pos += 8; |
| 84 | if (n >= 1 << 4) |
| 85 | n >>= 4; pos += 4; |
| 86 | if (n >= 1 << 2) |
| 87 | n >>= 2; pos += 2; |
| 88 | if (n >= 1 << 1) |
| 89 | pos += 1; |
| 90 | |
| 91 | return (n == 0) ? (0) : pos; |
| 92 | } |
| 93 | |
| 94 | /* |
| 95 | * forward declarations |
| 96 | */ |
| 97 | struct bfa_ioim_s; |
| 98 | struct bfa_tskim_s; |
| 99 | struct bfad_ioim_s; |
| 100 | struct bfad_tskim_s; |
| 101 | |
| 102 | typedef void (*bfa_fcpim_profile_t) (struct bfa_ioim_s *ioim); |
| 103 | |
Krishna Gudipati | e2187d7 | 2011-06-13 15:53:58 -0700 | [diff] [blame^] | 104 | struct bfa_fcpim_s { |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 105 | struct bfa_s *bfa; |
Krishna Gudipati | e2187d7 | 2011-06-13 15:53:58 -0700 | [diff] [blame^] | 106 | struct bfa_fcp_mod_s *fcp; |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 107 | struct bfa_itnim_s *itnim_arr; |
| 108 | struct bfa_ioim_s *ioim_arr; |
| 109 | struct bfa_ioim_sp_s *ioim_sp_arr; |
| 110 | struct bfa_tskim_s *tskim_arr; |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 111 | int num_itnims; |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 112 | int num_tskim_reqs; |
| 113 | u32 path_tov; |
| 114 | u16 q_depth; |
| 115 | u8 reqq; /* Request queue to be used */ |
| 116 | u8 rsvd; |
| 117 | struct list_head itnim_q; /* queue of active itnim */ |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 118 | struct list_head ioim_resfree_q; /* IOs waiting for f/w */ |
| 119 | struct list_head ioim_comp_q; /* IO global comp Q */ |
| 120 | struct list_head tskim_free_q; |
Maggie Zhang | da99dcc | 2010-12-09 19:13:20 -0800 | [diff] [blame] | 121 | u32 ios_active; /* current active IOs */ |
| 122 | u32 delay_comp; |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 123 | struct bfa_fcpim_del_itn_stats_s del_itn_stats; |
| 124 | bfa_boolean_t ioredirect; |
| 125 | bfa_boolean_t io_profile; |
Maggie Zhang | da99dcc | 2010-12-09 19:13:20 -0800 | [diff] [blame] | 126 | u32 io_profile_start_time; |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 127 | bfa_fcpim_profile_t profile_comp; |
| 128 | bfa_fcpim_profile_t profile_start; |
| 129 | }; |
| 130 | |
Krishna Gudipati | e2187d7 | 2011-06-13 15:53:58 -0700 | [diff] [blame^] | 131 | struct bfa_fcp_mod_s { |
| 132 | struct bfa_s *bfa; |
| 133 | struct list_head iotag_ioim_free_q; /* free IO resources */ |
| 134 | struct list_head iotag_tio_free_q; /* free IO resources */ |
| 135 | struct bfa_iotag_s *iotag_arr; |
| 136 | struct bfa_itn_s *itn_arr; |
| 137 | int num_ioim_reqs; |
| 138 | int num_fwtio_reqs; |
| 139 | int num_itns; |
| 140 | struct bfa_dma_s snsbase; |
| 141 | struct bfa_fcpim_s fcpim; |
| 142 | }; |
| 143 | |
Jing Huang | acdc79a | 2010-10-18 17:15:55 -0700 | [diff] [blame] | 144 | /* |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 145 | * BFA IO (initiator mode) |
| 146 | */ |
| 147 | struct bfa_ioim_s { |
| 148 | struct list_head qe; /* queue elememt */ |
| 149 | bfa_sm_t sm; /* BFA ioim state machine */ |
| 150 | struct bfa_s *bfa; /* BFA module */ |
Krishna Gudipati | e2187d7 | 2011-06-13 15:53:58 -0700 | [diff] [blame^] | 151 | struct bfa_fcpim_s *fcpim; /* parent fcpim module */ |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 152 | struct bfa_itnim_s *itnim; /* i-t-n nexus for this IO */ |
| 153 | struct bfad_ioim_s *dio; /* driver IO handle */ |
Maggie Zhang | da99dcc | 2010-12-09 19:13:20 -0800 | [diff] [blame] | 154 | u16 iotag; /* FWI IO tag */ |
| 155 | u16 abort_tag; /* unqiue abort request tag */ |
| 156 | u16 nsges; /* number of SG elements */ |
| 157 | u16 nsgpgs; /* number of SG pages */ |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 158 | struct bfa_sgpg_s *sgpg; /* first SG page */ |
| 159 | struct list_head sgpg_q; /* allocated SG pages */ |
| 160 | struct bfa_cb_qe_s hcb_qe; /* bfa callback qelem */ |
| 161 | bfa_cb_cbfn_t io_cbfn; /* IO completion handler */ |
Maggie Zhang | da99dcc | 2010-12-09 19:13:20 -0800 | [diff] [blame] | 162 | struct bfa_ioim_sp_s *iosp; /* slow-path IO handling */ |
| 163 | u8 reqq; /* Request queue for I/O */ |
| 164 | u64 start_time; /* IO's Profile start val */ |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 165 | }; |
| 166 | |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 167 | struct bfa_ioim_sp_s { |
| 168 | struct bfi_msg_s comp_rspmsg; /* IO comp f/w response */ |
Maggie Zhang | da99dcc | 2010-12-09 19:13:20 -0800 | [diff] [blame] | 169 | struct bfa_sgpg_wqe_s sgpg_wqe; /* waitq elem for sgpg */ |
| 170 | struct bfa_reqq_wait_s reqq_wait; /* to wait for room in reqq */ |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 171 | bfa_boolean_t abort_explicit; /* aborted by OS */ |
| 172 | struct bfa_tskim_s *tskim; /* Relevant TM cmd */ |
| 173 | }; |
| 174 | |
Jing Huang | acdc79a | 2010-10-18 17:15:55 -0700 | [diff] [blame] | 175 | /* |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 176 | * BFA Task management command (initiator mode) |
| 177 | */ |
| 178 | struct bfa_tskim_s { |
| 179 | struct list_head qe; |
| 180 | bfa_sm_t sm; |
Maggie Zhang | da99dcc | 2010-12-09 19:13:20 -0800 | [diff] [blame] | 181 | struct bfa_s *bfa; /* BFA module */ |
Krishna Gudipati | e2187d7 | 2011-06-13 15:53:58 -0700 | [diff] [blame^] | 182 | struct bfa_fcpim_s *fcpim; /* parent fcpim module */ |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 183 | struct bfa_itnim_s *itnim; /* i-t-n nexus for this IO */ |
Maggie Zhang | f314878 | 2010-12-09 19:11:39 -0800 | [diff] [blame] | 184 | struct bfad_tskim_s *dtsk; /* driver task mgmt cmnd */ |
Maggie Zhang | da99dcc | 2010-12-09 19:13:20 -0800 | [diff] [blame] | 185 | bfa_boolean_t notify; /* notify itnim on TM comp */ |
Maggie Zhang | f314878 | 2010-12-09 19:11:39 -0800 | [diff] [blame] | 186 | struct scsi_lun lun; /* lun if applicable */ |
Maggie Zhang | da99dcc | 2010-12-09 19:13:20 -0800 | [diff] [blame] | 187 | enum fcp_tm_cmnd tm_cmnd; /* task management command */ |
| 188 | u16 tsk_tag; /* FWI IO tag */ |
| 189 | u8 tsecs; /* timeout in seconds */ |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 190 | struct bfa_reqq_wait_s reqq_wait; /* to wait for room in reqq */ |
| 191 | struct list_head io_q; /* queue of affected IOs */ |
Maggie Zhang | da99dcc | 2010-12-09 19:13:20 -0800 | [diff] [blame] | 192 | struct bfa_wc_s wc; /* waiting counter */ |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 193 | struct bfa_cb_qe_s hcb_qe; /* bfa callback qelem */ |
| 194 | enum bfi_tskim_status tsk_status; /* TM status */ |
| 195 | }; |
| 196 | |
Jing Huang | acdc79a | 2010-10-18 17:15:55 -0700 | [diff] [blame] | 197 | /* |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 198 | * BFA i-t-n (initiator mode) |
| 199 | */ |
| 200 | struct bfa_itnim_s { |
Maggie Zhang | da99dcc | 2010-12-09 19:13:20 -0800 | [diff] [blame] | 201 | struct list_head qe; /* queue element */ |
| 202 | bfa_sm_t sm; /* i-t-n im BFA state machine */ |
| 203 | struct bfa_s *bfa; /* bfa instance */ |
| 204 | struct bfa_rport_s *rport; /* bfa rport */ |
| 205 | void *ditn; /* driver i-t-n structure */ |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 206 | struct bfi_mhdr_s mhdr; /* pre-built mhdr */ |
Maggie Zhang | da99dcc | 2010-12-09 19:13:20 -0800 | [diff] [blame] | 207 | u8 msg_no; /* itnim/rport firmware handle */ |
| 208 | u8 reqq; /* CQ for requests */ |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 209 | struct bfa_cb_qe_s hcb_qe; /* bfa callback qelem */ |
| 210 | struct list_head pending_q; /* queue of pending IO requests */ |
| 211 | struct list_head io_q; /* queue of active IO requests */ |
| 212 | struct list_head io_cleanup_q; /* IO being cleaned up */ |
| 213 | struct list_head tsk_q; /* queue of active TM commands */ |
| 214 | struct list_head delay_comp_q; /* queue of failed inflight cmds */ |
| 215 | bfa_boolean_t seq_rec; /* SQER supported */ |
| 216 | bfa_boolean_t is_online; /* itnim is ONLINE for IO */ |
| 217 | bfa_boolean_t iotov_active; /* IO TOV timer is active */ |
Maggie Zhang | da99dcc | 2010-12-09 19:13:20 -0800 | [diff] [blame] | 218 | struct bfa_wc_s wc; /* waiting counter */ |
| 219 | struct bfa_timer_s timer; /* pending IO TOV */ |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 220 | struct bfa_reqq_wait_s reqq_wait; /* to wait for room in reqq */ |
Krishna Gudipati | e2187d7 | 2011-06-13 15:53:58 -0700 | [diff] [blame^] | 221 | struct bfa_fcpim_s *fcpim; /* fcpim module */ |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 222 | struct bfa_itnim_iostats_s stats; |
| 223 | struct bfa_itnim_ioprofile_s ioprofile; |
| 224 | }; |
| 225 | |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 226 | #define bfa_itnim_is_online(_itnim) ((_itnim)->is_online) |
Krishna Gudipati | e2187d7 | 2011-06-13 15:53:58 -0700 | [diff] [blame^] | 227 | #define BFA_FCPIM(_hal) (&(_hal)->modules.fcp_mod.fcpim) |
Krishna Gudipati | 15821f0 | 2010-12-13 16:23:27 -0800 | [diff] [blame] | 228 | #define BFA_IOIM_TAG_2_ID(_iotag) ((_iotag) & BFA_IOIM_IOTAG_MASK) |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 229 | #define BFA_IOIM_FROM_TAG(_fcpim, _iotag) \ |
Krishna Gudipati | 15821f0 | 2010-12-13 16:23:27 -0800 | [diff] [blame] | 230 | (&fcpim->ioim_arr[(_iotag & BFA_IOIM_IOTAG_MASK)]) |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 231 | #define BFA_TSKIM_FROM_TAG(_fcpim, _tmtag) \ |
| 232 | (&fcpim->tskim_arr[_tmtag & (fcpim->num_tskim_reqs - 1)]) |
| 233 | |
| 234 | #define bfa_io_profile_start_time(_bfa) \ |
Krishna Gudipati | e2187d7 | 2011-06-13 15:53:58 -0700 | [diff] [blame^] | 235 | ((_bfa)->modules.fcp_mod.fcpim.io_profile_start_time) |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 236 | #define bfa_fcpim_get_io_profile(_bfa) \ |
Krishna Gudipati | e2187d7 | 2011-06-13 15:53:58 -0700 | [diff] [blame^] | 237 | ((_bfa)->modules.fcp_mod.fcpim.io_profile) |
Krishna Gudipati | 15821f0 | 2010-12-13 16:23:27 -0800 | [diff] [blame] | 238 | #define bfa_ioim_update_iotag(__ioim) do { \ |
| 239 | uint16_t k = (__ioim)->iotag >> BFA_IOIM_RETRY_TAG_OFFSET; \ |
| 240 | k++; (__ioim)->iotag &= BFA_IOIM_IOTAG_MASK; \ |
| 241 | (__ioim)->iotag |= k << BFA_IOIM_RETRY_TAG_OFFSET; \ |
| 242 | } while (0) |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 243 | |
| 244 | static inline bfa_boolean_t |
Krishna Gudipati | 15821f0 | 2010-12-13 16:23:27 -0800 | [diff] [blame] | 245 | bfa_ioim_maxretry_reached(struct bfa_ioim_s *ioim) |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 246 | { |
Krishna Gudipati | 15821f0 | 2010-12-13 16:23:27 -0800 | [diff] [blame] | 247 | uint16_t k = ioim->iotag >> BFA_IOIM_RETRY_TAG_OFFSET; |
| 248 | if (k < BFA_IOIM_RETRY_MAX) |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 249 | return BFA_FALSE; |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 250 | return BFA_TRUE; |
| 251 | } |
Krishna Gudipati | 15821f0 | 2010-12-13 16:23:27 -0800 | [diff] [blame] | 252 | |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 253 | /* |
| 254 | * function prototypes |
| 255 | */ |
Krishna Gudipati | e2187d7 | 2011-06-13 15:53:58 -0700 | [diff] [blame^] | 256 | void bfa_ioim_attach(struct bfa_fcpim_s *fcpim, |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 257 | struct bfa_meminfo_s *minfo); |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 258 | void bfa_ioim_isr(struct bfa_s *bfa, struct bfi_msg_s *msg); |
| 259 | void bfa_ioim_good_comp_isr(struct bfa_s *bfa, |
| 260 | struct bfi_msg_s *msg); |
| 261 | void bfa_ioim_cleanup(struct bfa_ioim_s *ioim); |
| 262 | void bfa_ioim_cleanup_tm(struct bfa_ioim_s *ioim, |
| 263 | struct bfa_tskim_s *tskim); |
| 264 | void bfa_ioim_iocdisable(struct bfa_ioim_s *ioim); |
| 265 | void bfa_ioim_tov(struct bfa_ioim_s *ioim); |
| 266 | |
Krishna Gudipati | e2187d7 | 2011-06-13 15:53:58 -0700 | [diff] [blame^] | 267 | void bfa_tskim_attach(struct bfa_fcpim_s *fcpim, |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 268 | struct bfa_meminfo_s *minfo); |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 269 | void bfa_tskim_isr(struct bfa_s *bfa, struct bfi_msg_s *msg); |
| 270 | void bfa_tskim_iodone(struct bfa_tskim_s *tskim); |
| 271 | void bfa_tskim_iocdisable(struct bfa_tskim_s *tskim); |
| 272 | void bfa_tskim_cleanup(struct bfa_tskim_s *tskim); |
| 273 | |
| 274 | void bfa_itnim_meminfo(struct bfa_iocfc_cfg_s *cfg, u32 *km_len, |
| 275 | u32 *dm_len); |
Krishna Gudipati | e2187d7 | 2011-06-13 15:53:58 -0700 | [diff] [blame^] | 276 | void bfa_itnim_attach(struct bfa_fcpim_s *fcpim, |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 277 | struct bfa_meminfo_s *minfo); |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 278 | void bfa_itnim_iocdisable(struct bfa_itnim_s *itnim); |
| 279 | void bfa_itnim_isr(struct bfa_s *bfa, struct bfi_msg_s *msg); |
| 280 | void bfa_itnim_iodone(struct bfa_itnim_s *itnim); |
| 281 | void bfa_itnim_tskdone(struct bfa_itnim_s *itnim); |
| 282 | bfa_boolean_t bfa_itnim_hold_io(struct bfa_itnim_s *itnim); |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 283 | |
| 284 | /* |
| 285 | * bfa fcpim module API functions |
| 286 | */ |
Maggie Zhang | da99dcc | 2010-12-09 19:13:20 -0800 | [diff] [blame] | 287 | void bfa_fcpim_path_tov_set(struct bfa_s *bfa, u16 path_tov); |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 288 | u16 bfa_fcpim_path_tov_get(struct bfa_s *bfa); |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 289 | u16 bfa_fcpim_qdepth_get(struct bfa_s *bfa); |
Maggie Zhang | da99dcc | 2010-12-09 19:13:20 -0800 | [diff] [blame] | 290 | |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 291 | #define bfa_fcpim_ioredirect_enabled(__bfa) \ |
Krishna Gudipati | e2187d7 | 2011-06-13 15:53:58 -0700 | [diff] [blame^] | 292 | (((struct bfa_fcpim_s *)(BFA_FCPIM(__bfa)))->ioredirect) |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 293 | |
| 294 | #define bfa_fcpim_get_next_reqq(__bfa, __qid) \ |
| 295 | { \ |
Krishna Gudipati | e2187d7 | 2011-06-13 15:53:58 -0700 | [diff] [blame^] | 296 | struct bfa_fcpim_s *__fcpim = BFA_FCPIM(__bfa); \ |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 297 | __fcpim->reqq++; \ |
| 298 | __fcpim->reqq &= (BFI_IOC_MAX_CQS - 1); \ |
| 299 | *(__qid) = __fcpim->reqq; \ |
| 300 | } |
| 301 | |
| 302 | #define bfa_iocfc_map_msg_to_qid(__msg, __qid) \ |
| 303 | *(__qid) = (u8)((__msg) & (BFI_IOC_MAX_CQS - 1)); |
| 304 | /* |
| 305 | * bfa itnim API functions |
| 306 | */ |
| 307 | struct bfa_itnim_s *bfa_itnim_create(struct bfa_s *bfa, |
Maggie Zhang | da99dcc | 2010-12-09 19:13:20 -0800 | [diff] [blame] | 308 | struct bfa_rport_s *rport, void *itnim); |
| 309 | void bfa_itnim_delete(struct bfa_itnim_s *itnim); |
| 310 | void bfa_itnim_online(struct bfa_itnim_s *itnim, bfa_boolean_t seq_rec); |
| 311 | void bfa_itnim_offline(struct bfa_itnim_s *itnim); |
| 312 | void bfa_itnim_clear_stats(struct bfa_itnim_s *itnim); |
| 313 | bfa_status_t bfa_itnim_get_ioprofile(struct bfa_itnim_s *itnim, |
| 314 | struct bfa_itnim_ioprofile_s *ioprofile); |
| 315 | |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 316 | #define bfa_itnim_get_reqq(__ioim) (((struct bfa_ioim_s *)__ioim)->itnim->reqq) |
| 317 | |
Jing Huang | acdc79a | 2010-10-18 17:15:55 -0700 | [diff] [blame] | 318 | /* |
Maggie Zhang | da99dcc | 2010-12-09 19:13:20 -0800 | [diff] [blame] | 319 | * BFA completion callback for bfa_itnim_online(). |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 320 | */ |
| 321 | void bfa_cb_itnim_online(void *itnim); |
| 322 | |
Jing Huang | acdc79a | 2010-10-18 17:15:55 -0700 | [diff] [blame] | 323 | /* |
Maggie Zhang | da99dcc | 2010-12-09 19:13:20 -0800 | [diff] [blame] | 324 | * BFA completion callback for bfa_itnim_offline(). |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 325 | */ |
| 326 | void bfa_cb_itnim_offline(void *itnim); |
| 327 | void bfa_cb_itnim_tov_begin(void *itnim); |
| 328 | void bfa_cb_itnim_tov(void *itnim); |
| 329 | |
Jing Huang | acdc79a | 2010-10-18 17:15:55 -0700 | [diff] [blame] | 330 | /* |
Maggie Zhang | da99dcc | 2010-12-09 19:13:20 -0800 | [diff] [blame] | 331 | * BFA notification to FCS/driver for second level error recovery. |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 332 | * Atleast one I/O request has timedout and target is unresponsive to |
| 333 | * repeated abort requests. Second level error recovery should be initiated |
| 334 | * by starting implicit logout and recovery procedures. |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 335 | */ |
| 336 | void bfa_cb_itnim_sler(void *itnim); |
| 337 | |
| 338 | /* |
| 339 | * bfa ioim API functions |
| 340 | */ |
| 341 | struct bfa_ioim_s *bfa_ioim_alloc(struct bfa_s *bfa, |
| 342 | struct bfad_ioim_s *dio, |
| 343 | struct bfa_itnim_s *itnim, |
| 344 | u16 nsgles); |
| 345 | |
| 346 | void bfa_ioim_free(struct bfa_ioim_s *ioim); |
| 347 | void bfa_ioim_start(struct bfa_ioim_s *ioim); |
| 348 | bfa_status_t bfa_ioim_abort(struct bfa_ioim_s *ioim); |
| 349 | void bfa_ioim_delayed_comp(struct bfa_ioim_s *ioim, |
| 350 | bfa_boolean_t iotov); |
Jing Huang | acdc79a | 2010-10-18 17:15:55 -0700 | [diff] [blame] | 351 | /* |
Maggie Zhang | da99dcc | 2010-12-09 19:13:20 -0800 | [diff] [blame] | 352 | * I/O completion notification. |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 353 | * |
| 354 | * @param[in] dio driver IO structure |
| 355 | * @param[in] io_status IO completion status |
| 356 | * @param[in] scsi_status SCSI status returned by target |
| 357 | * @param[in] sns_len SCSI sense length, 0 if none |
| 358 | * @param[in] sns_info SCSI sense data, if any |
| 359 | * @param[in] residue Residual length |
| 360 | * |
| 361 | * @return None |
| 362 | */ |
Maggie Zhang | da99dcc | 2010-12-09 19:13:20 -0800 | [diff] [blame] | 363 | void bfa_cb_ioim_done(void *bfad, struct bfad_ioim_s *dio, |
| 364 | enum bfi_ioim_status io_status, |
| 365 | u8 scsi_status, int sns_len, |
| 366 | u8 *sns_info, s32 residue); |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 367 | |
Jing Huang | acdc79a | 2010-10-18 17:15:55 -0700 | [diff] [blame] | 368 | /* |
Maggie Zhang | da99dcc | 2010-12-09 19:13:20 -0800 | [diff] [blame] | 369 | * I/O good completion notification. |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 370 | */ |
Maggie Zhang | da99dcc | 2010-12-09 19:13:20 -0800 | [diff] [blame] | 371 | void bfa_cb_ioim_good_comp(void *bfad, struct bfad_ioim_s *dio); |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 372 | |
Jing Huang | acdc79a | 2010-10-18 17:15:55 -0700 | [diff] [blame] | 373 | /* |
Maggie Zhang | da99dcc | 2010-12-09 19:13:20 -0800 | [diff] [blame] | 374 | * I/O abort completion notification |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 375 | */ |
Maggie Zhang | da99dcc | 2010-12-09 19:13:20 -0800 | [diff] [blame] | 376 | void bfa_cb_ioim_abort(void *bfad, struct bfad_ioim_s *dio); |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 377 | |
| 378 | /* |
| 379 | * bfa tskim API functions |
| 380 | */ |
Maggie Zhang | da99dcc | 2010-12-09 19:13:20 -0800 | [diff] [blame] | 381 | struct bfa_tskim_s *bfa_tskim_alloc(struct bfa_s *bfa, |
| 382 | struct bfad_tskim_s *dtsk); |
| 383 | void bfa_tskim_free(struct bfa_tskim_s *tskim); |
| 384 | void bfa_tskim_start(struct bfa_tskim_s *tskim, |
| 385 | struct bfa_itnim_s *itnim, struct scsi_lun lun, |
| 386 | enum fcp_tm_cmnd tm, u8 t_secs); |
| 387 | void bfa_cb_tskim_done(void *bfad, struct bfad_tskim_s *dtsk, |
| 388 | enum bfi_tskim_status tsk_status); |
Krishna Gudipati | a36c61f | 2010-09-15 11:50:55 -0700 | [diff] [blame] | 389 | |
| 390 | #endif /* __BFA_FCPIM_H__ */ |