| 1 |
/* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 |
/* |
| 3 |
* Copyright (c) 2005-2014 Brocade Communications Systems, Inc. |
| 4 |
* Copyright (c) 2014- QLogic Corporation. |
| 5 |
* All rights reserved |
| 6 |
* www.qlogic.com |
| 7 |
* |
| 8 |
* Linux driver for QLogic BR-series Fibre Channel Host Bus Adapter. |
| 9 |
*/ |
| 10 |
|
| 11 |
#ifndef __BFA_FCPIM_H__ |
| 12 |
#define __BFA_FCPIM_H__ |
| 13 |
|
| 14 |
#include "bfa.h" |
| 15 |
#include "bfa_svc.h" |
| 16 |
#include "bfi_ms.h" |
| 17 |
#include "bfa_defs_svc.h" |
| 18 |
#include "bfa_cs.h" |
| 19 |
|
| 20 |
/* FCP module related definitions */ |
| 21 |
#define BFA_IO_MAX BFI_IO_MAX |
| 22 |
#define BFA_FWTIO_MAX 2000 |
| 23 |
|
| 24 |
struct bfa_fcp_mod_s; |
| 25 |
struct bfa_iotag_s { |
| 26 |
struct list_head qe; /* queue element */ |
| 27 |
u16 tag; /* FW IO tag */ |
| 28 |
}; |
| 29 |
|
| 30 |
struct bfa_itn_s { |
| 31 |
bfa_isr_func_t isr; |
| 32 |
}; |
| 33 |
|
| 34 |
void bfa_itn_create(struct bfa_s *bfa, struct bfa_rport_s *rport, |
| 35 |
void (*isr)(struct bfa_s *bfa, struct bfi_msg_s *m)); |
| 36 |
void bfa_itn_isr(struct bfa_s *bfa, struct bfi_msg_s *m); |
| 37 |
void bfa_iotag_attach(struct bfa_fcp_mod_s *fcp); |
| 38 |
void bfa_fcp_res_recfg(struct bfa_s *bfa, u16 num_ioim_fw, u16 max_ioim_fw); |
| 39 |
|
| 40 |
#define BFA_FCP_MOD(_hal) (&(_hal)->modules.fcp_mod) |
| 41 |
#define BFA_MEM_FCP_KVA(__bfa) (&(BFA_FCP_MOD(__bfa)->kva_seg)) |
| 42 |
#define BFA_IOTAG_FROM_TAG(_fcp, _tag) \ |
| 43 |
(&(_fcp)->iotag_arr[(_tag & BFA_IOIM_IOTAG_MASK)]) |
| 44 |
#define BFA_ITN_FROM_TAG(_fcp, _tag) \ |
| 45 |
((_fcp)->itn_arr + ((_tag) & ((_fcp)->num_itns - 1))) |
| 46 |
#define BFA_SNSINFO_FROM_TAG(_fcp, _tag) \ |
| 47 |
bfa_mem_get_dmabuf_kva(_fcp, (_tag & BFA_IOIM_IOTAG_MASK), \ |
| 48 |
BFI_IOIM_SNSLEN) |
| 49 |
|
| 50 |
|
| 51 |
#define BFA_ITNIM_MIN 32 |
| 52 |
#define BFA_ITNIM_MAX 1024 |
| 53 |
|
| 54 |
#define BFA_IOIM_MIN 8 |
| 55 |
#define BFA_IOIM_MAX 2000 |
| 56 |
|
| 57 |
#define BFA_TSKIM_MIN 4 |
| 58 |
#define BFA_TSKIM_MAX 512 |
| 59 |
#define BFA_FCPIM_PATHTOV_DEF (30 * 1000) /* in millisecs */ |
| 60 |
#define BFA_FCPIM_PATHTOV_MAX (90 * 1000) /* in millisecs */ |
| 61 |
|
| 62 |
|
| 63 |
#define bfa_itnim_ioprofile_update(__itnim, __index) \ |
| 64 |
(__itnim->ioprofile.iocomps[__index]++) |
| 65 |
|
| 66 |
#define BFA_IOIM_RETRY_TAG_OFFSET 11 |
| 67 |
#define BFA_IOIM_IOTAG_MASK 0x07ff /* 2K IOs */ |
| 68 |
#define BFA_IOIM_RETRY_MAX 7 |
| 69 |
|
| 70 |
/* Buckets are are 512 bytes to 2MB */ |
| 71 |
static inline u32 |
| 72 |
bfa_ioim_get_index(u32 n) { |
| 73 |
int pos = 0; |
| 74 |
if (n >= (1UL)<<22) |
| 75 |
return BFA_IOBUCKET_MAX - 1; |
| 76 |
n >>= 8; |
| 77 |
if (n >= (1UL)<<16) { |
| 78 |
n >>= 16; |
| 79 |
pos += 16; |
| 80 |
} |
| 81 |
if (n >= 1 << 8) { |
| 82 |
n >>= 8; |
| 83 |
pos += 8; |
| 84 |
} |
| 85 |
if (n >= 1 << 4) { |
| 86 |
n >>= 4; |
| 87 |
pos += 4; |
| 88 |
} |
| 89 |
if (n >= 1 << 2) { |
| 90 |
n >>= 2; |
| 91 |
pos += 2; |
| 92 |
} |
| 93 |
if (n >= 1 << 1) |
| 94 |
pos += 1; |
| 95 |
|
| 96 |
return (n == 0) ? (0) : pos; |
| 97 |
} |
| 98 |
|
| 99 |
/* |
| 100 |
* forward declarations |
| 101 |
*/ |
| 102 |
struct bfa_ioim_s; |
| 103 |
struct bfa_tskim_s; |
| 104 |
struct bfad_ioim_s; |
| 105 |
struct bfad_tskim_s; |
| 106 |
|
| 107 |
typedef void (*bfa_fcpim_profile_t) (struct bfa_ioim_s *ioim); |
| 108 |
|
| 109 |
struct bfa_fcpim_s { |
| 110 |
struct bfa_s *bfa; |
| 111 |
struct bfa_fcp_mod_s *fcp; |
| 112 |
struct bfa_itnim_s *itnim_arr; |
| 113 |
struct bfa_ioim_s *ioim_arr; |
| 114 |
struct bfa_ioim_sp_s *ioim_sp_arr; |
| 115 |
struct bfa_tskim_s *tskim_arr; |
| 116 |
int num_itnims; |
| 117 |
int num_tskim_reqs; |
| 118 |
u32 path_tov; |
| 119 |
u16 q_depth; |
| 120 |
u8 reqq; /* Request queue to be used */ |
| 121 |
struct list_head itnim_q; /* queue of active itnim */ |
| 122 |
struct list_head ioim_resfree_q; /* IOs waiting for f/w */ |
| 123 |
struct list_head ioim_comp_q; /* IO global comp Q */ |
| 124 |
struct list_head tskim_free_q; |
| 125 |
struct list_head tskim_unused_q; /* Unused tskim Q */ |
| 126 |
u32 ios_active; /* current active IOs */ |
| 127 |
u32 delay_comp; |
| 128 |
struct bfa_fcpim_del_itn_stats_s del_itn_stats; |
| 129 |
bfa_boolean_t ioredirect; |
| 130 |
bfa_boolean_t io_profile; |
| 131 |
time64_t io_profile_start_time; |
| 132 |
bfa_fcpim_profile_t profile_comp; |
| 133 |
bfa_fcpim_profile_t profile_start; |
| 134 |
}; |
| 135 |
|
| 136 |
/* Max FCP dma segs required */ |
| 137 |
#define BFA_FCP_DMA_SEGS BFI_IOIM_SNSBUF_SEGS |
| 138 |
|
| 139 |
struct bfa_fcp_mod_s { |
| 140 |
struct bfa_s *bfa; |
| 141 |
struct list_head iotag_ioim_free_q; /* free IO resources */ |
| 142 |
struct list_head iotag_tio_free_q; /* free IO resources */ |
| 143 |
struct list_head iotag_unused_q; /* unused IO resources*/ |
| 144 |
struct bfa_iotag_s *iotag_arr; |
| 145 |
struct bfa_itn_s *itn_arr; |
| 146 |
int max_ioim_reqs; |
| 147 |
int num_ioim_reqs; |
| 148 |
int num_fwtio_reqs; |
| 149 |
int num_itns; |
| 150 |
struct bfa_dma_s snsbase[BFA_FCP_DMA_SEGS]; |
| 151 |
struct bfa_fcpim_s fcpim; |
| 152 |
struct bfa_mem_dma_s dma_seg[BFA_FCP_DMA_SEGS]; |
| 153 |
struct bfa_mem_kva_s kva_seg; |
| 154 |
int throttle_update_required; |
| 155 |
}; |
| 156 |
|
| 157 |
/* |
| 158 |
* IO state machine events |
| 159 |
*/ |
| 160 |
enum bfa_ioim_event { |
| 161 |
BFA_IOIM_SM_START = 1, /* io start request from host */ |
| 162 |
BFA_IOIM_SM_COMP_GOOD = 2, /* io good comp, resource free */ |
| 163 |
BFA_IOIM_SM_COMP = 3, /* io comp, resource is free */ |
| 164 |
BFA_IOIM_SM_COMP_UTAG = 4, /* io comp, resource is free */ |
| 165 |
BFA_IOIM_SM_DONE = 5, /* io comp, resource not free */ |
| 166 |
BFA_IOIM_SM_FREE = 6, /* io resource is freed */ |
| 167 |
BFA_IOIM_SM_ABORT = 7, /* abort request from scsi stack */ |
| 168 |
BFA_IOIM_SM_ABORT_COMP = 8, /* abort from f/w */ |
| 169 |
BFA_IOIM_SM_ABORT_DONE = 9, /* abort completion from f/w */ |
| 170 |
BFA_IOIM_SM_QRESUME = 10, /* CQ space available to queue IO */ |
| 171 |
BFA_IOIM_SM_SGALLOCED = 11, /* SG page allocation successful */ |
| 172 |
BFA_IOIM_SM_SQRETRY = 12, /* sequence recovery retry */ |
| 173 |
BFA_IOIM_SM_HCB = 13, /* bfa callback complete */ |
| 174 |
BFA_IOIM_SM_CLEANUP = 14, /* IO cleanup from itnim */ |
| 175 |
BFA_IOIM_SM_TMSTART = 15, /* IO cleanup from tskim */ |
| 176 |
BFA_IOIM_SM_TMDONE = 16, /* IO cleanup from tskim */ |
| 177 |
BFA_IOIM_SM_HWFAIL = 17, /* IOC h/w failure event */ |
| 178 |
BFA_IOIM_SM_IOTOV = 18, /* ITN offline TOV */ |
| 179 |
}; |
| 180 |
|
| 181 |
struct bfa_ioim_s; |
| 182 |
typedef void (*bfa_ioim_sm_t)(struct bfa_ioim_s *, enum bfa_ioim_event); |
| 183 |
|
| 184 |
/* |
| 185 |
* BFA IO (initiator mode) |
| 186 |
*/ |
| 187 |
struct bfa_ioim_s { |
| 188 |
struct list_head qe; /* queue elememt */ |
| 189 |
bfa_ioim_sm_t sm; /* BFA ioim state machine */ |
| 190 |
struct bfa_s *bfa; /* BFA module */ |
| 191 |
struct bfa_fcpim_s *fcpim; /* parent fcpim module */ |
| 192 |
struct bfa_itnim_s *itnim; /* i-t-n nexus for this IO */ |
| 193 |
struct bfad_ioim_s *dio; /* driver IO handle */ |
| 194 |
u16 iotag; /* FWI IO tag */ |
| 195 |
u16 abort_tag; /* unqiue abort request tag */ |
| 196 |
u16 nsges; /* number of SG elements */ |
| 197 |
u16 nsgpgs; /* number of SG pages */ |
| 198 |
struct bfa_sgpg_s *sgpg; /* first SG page */ |
| 199 |
struct list_head sgpg_q; /* allocated SG pages */ |
| 200 |
struct bfa_cb_qe_s hcb_qe; /* bfa callback qelem */ |
| 201 |
bfa_cb_cbfn_t io_cbfn; /* IO completion handler */ |
| 202 |
struct bfa_ioim_sp_s *iosp; /* slow-path IO handling */ |
| 203 |
u8 reqq; /* Request queue for I/O */ |
| 204 |
u8 mode; /* IO is passthrough or not */ |
| 205 |
u64 start_time; /* IO's Profile start val */ |
| 206 |
}; |
| 207 |
|
| 208 |
struct bfa_ioim_sp_s { |
| 209 |
struct bfi_msg_s comp_rspmsg; /* IO comp f/w response */ |
| 210 |
struct bfa_sgpg_wqe_s sgpg_wqe; /* waitq elem for sgpg */ |
| 211 |
struct bfa_reqq_wait_s reqq_wait; /* to wait for room in reqq */ |
| 212 |
bfa_boolean_t abort_explicit; /* aborted by OS */ |
| 213 |
struct bfa_tskim_s *tskim; /* Relevant TM cmd */ |
| 214 |
}; |
| 215 |
|
| 216 |
enum bfa_tskim_event { |
| 217 |
BFA_TSKIM_SM_START = 1, /* TM command start */ |
| 218 |
BFA_TSKIM_SM_DONE = 2, /* TM completion */ |
| 219 |
BFA_TSKIM_SM_QRESUME = 3, /* resume after qfull */ |
| 220 |
BFA_TSKIM_SM_HWFAIL = 5, /* IOC h/w failure event */ |
| 221 |
BFA_TSKIM_SM_HCB = 6, /* BFA callback completion */ |
| 222 |
BFA_TSKIM_SM_IOS_DONE = 7, /* IO and sub TM completions */ |
| 223 |
BFA_TSKIM_SM_CLEANUP = 8, /* TM cleanup on ITN offline */ |
| 224 |
BFA_TSKIM_SM_CLEANUP_DONE = 9, /* TM abort completion */ |
| 225 |
BFA_TSKIM_SM_UTAG = 10, /* TM completion unknown tag */ |
| 226 |
}; |
| 227 |
|
| 228 |
struct bfa_tskim_s; |
| 229 |
typedef void (*bfa_tskim_sm_t)(struct bfa_tskim_s *, enum bfa_tskim_event); |
| 230 |
|
| 231 |
/* |
| 232 |
* BFA Task management command (initiator mode) |
| 233 |
*/ |
| 234 |
struct bfa_tskim_s { |
| 235 |
struct list_head qe; |
| 236 |
bfa_tskim_sm_t sm; |
| 237 |
struct bfa_s *bfa; /* BFA module */ |
| 238 |
struct bfa_fcpim_s *fcpim; /* parent fcpim module */ |
| 239 |
struct bfa_itnim_s *itnim; /* i-t-n nexus for this IO */ |
| 240 |
struct bfad_tskim_s *dtsk; /* driver task mgmt cmnd */ |
| 241 |
bfa_boolean_t notify; /* notify itnim on TM comp */ |
| 242 |
struct scsi_lun lun; /* lun if applicable */ |
| 243 |
enum fcp_tm_cmnd tm_cmnd; /* task management command */ |
| 244 |
u16 tsk_tag; /* FWI IO tag */ |
| 245 |
u8 tsecs; /* timeout in seconds */ |
| 246 |
struct bfa_reqq_wait_s reqq_wait; /* to wait for room in reqq */ |
| 247 |
struct list_head io_q; /* queue of affected IOs */ |
| 248 |
struct bfa_wc_s wc; /* waiting counter */ |
| 249 |
struct bfa_cb_qe_s hcb_qe; /* bfa callback qelem */ |
| 250 |
enum bfi_tskim_status tsk_status; /* TM status */ |
| 251 |
}; |
| 252 |
|
| 253 |
/* |
| 254 |
* itnim state machine event |
| 255 |
*/ |
| 256 |
enum bfa_itnim_event { |
| 257 |
BFA_ITNIM_SM_CREATE = 1, /* itnim is created */ |
| 258 |
BFA_ITNIM_SM_ONLINE = 2, /* itnim is online */ |
| 259 |
BFA_ITNIM_SM_OFFLINE = 3, /* itnim is offline */ |
| 260 |
BFA_ITNIM_SM_FWRSP = 4, /* firmware response */ |
| 261 |
BFA_ITNIM_SM_DELETE = 5, /* deleting an existing itnim */ |
| 262 |
BFA_ITNIM_SM_CLEANUP = 6, /* IO cleanup completion */ |
| 263 |
BFA_ITNIM_SM_SLER = 7, /* second level error recovery */ |
| 264 |
BFA_ITNIM_SM_HWFAIL = 8, /* IOC h/w failure event */ |
| 265 |
BFA_ITNIM_SM_QRESUME = 9, /* queue space available */ |
| 266 |
}; |
| 267 |
|
| 268 |
struct bfa_itnim_s; |
| 269 |
typedef void (*bfa_itnim_sm_t)(struct bfa_itnim_s *, enum bfa_itnim_event); |
| 270 |
|
| 271 |
/* |
| 272 |
* BFA i-t-n (initiator mode) |
| 273 |
*/ |
| 274 |
struct bfa_itnim_s { |
| 275 |
struct list_head qe; /* queue element */ |
| 276 |
bfa_itnim_sm_t sm; /* i-t-n im BFA state machine */ |
| 277 |
struct bfa_s *bfa; /* bfa instance */ |
| 278 |
struct bfa_rport_s *rport; /* bfa rport */ |
| 279 |
void *ditn; /* driver i-t-n structure */ |
| 280 |
struct bfi_mhdr_s mhdr; /* pre-built mhdr */ |
| 281 |
u8 msg_no; /* itnim/rport firmware handle */ |
| 282 |
u8 reqq; /* CQ for requests */ |
| 283 |
struct bfa_cb_qe_s hcb_qe; /* bfa callback qelem */ |
| 284 |
struct list_head pending_q; /* queue of pending IO requests */ |
| 285 |
struct list_head io_q; /* queue of active IO requests */ |
| 286 |
struct list_head io_cleanup_q; /* IO being cleaned up */ |
| 287 |
struct list_head tsk_q; /* queue of active TM commands */ |
| 288 |
struct list_head delay_comp_q; /* queue of failed inflight cmds */ |
| 289 |
bfa_boolean_t seq_rec; /* SQER supported */ |
| 290 |
bfa_boolean_t is_online; /* itnim is ONLINE for IO */ |
| 291 |
bfa_boolean_t iotov_active; /* IO TOV timer is active */ |
| 292 |
struct bfa_wc_s wc; /* waiting counter */ |
| 293 |
struct bfa_timer_s timer; /* pending IO TOV */ |
| 294 |
struct bfa_reqq_wait_s reqq_wait; /* to wait for room in reqq */ |
| 295 |
struct bfa_fcpim_s *fcpim; /* fcpim module */ |
| 296 |
struct bfa_itnim_iostats_s stats; |
| 297 |
struct bfa_itnim_ioprofile_s ioprofile; |
| 298 |
}; |
| 299 |
|
| 300 |
#define bfa_itnim_is_online(_itnim) ((_itnim)->is_online) |
| 301 |
#define BFA_FCPIM(_hal) (&(_hal)->modules.fcp_mod.fcpim) |
| 302 |
#define BFA_IOIM_TAG_2_ID(_iotag) ((_iotag) & BFA_IOIM_IOTAG_MASK) |
| 303 |
#define BFA_IOIM_FROM_TAG(_fcpim, _iotag) \ |
| 304 |
(&fcpim->ioim_arr[(_iotag & BFA_IOIM_IOTAG_MASK)]) |
| 305 |
#define BFA_TSKIM_FROM_TAG(_fcpim, _tmtag) \ |
| 306 |
(&fcpim->tskim_arr[_tmtag & (fcpim->num_tskim_reqs - 1)]) |
| 307 |
|
| 308 |
#define bfa_io_profile_start_time(_bfa) \ |
| 309 |
((_bfa)->modules.fcp_mod.fcpim.io_profile_start_time) |
| 310 |
#define bfa_fcpim_get_io_profile(_bfa) \ |
| 311 |
((_bfa)->modules.fcp_mod.fcpim.io_profile) |
| 312 |
#define bfa_ioim_update_iotag(__ioim) do { \ |
| 313 |
uint16_t k = (__ioim)->iotag >> BFA_IOIM_RETRY_TAG_OFFSET; \ |
| 314 |
k++; (__ioim)->iotag &= BFA_IOIM_IOTAG_MASK; \ |
| 315 |
(__ioim)->iotag |= k << BFA_IOIM_RETRY_TAG_OFFSET; \ |
| 316 |
} while (0) |
| 317 |
|
| 318 |
static inline bfa_boolean_t |
| 319 |
bfa_ioim_maxretry_reached(struct bfa_ioim_s *ioim) |
| 320 |
{ |
| 321 |
uint16_t k = ioim->iotag >> BFA_IOIM_RETRY_TAG_OFFSET; |
| 322 |
if (k < BFA_IOIM_RETRY_MAX) |
| 323 |
return BFA_FALSE; |
| 324 |
return BFA_TRUE; |
| 325 |
} |
| 326 |
|
| 327 |
/* |
| 328 |
* function prototypes |
| 329 |
*/ |
| 330 |
void bfa_ioim_attach(struct bfa_fcpim_s *fcpim); |
| 331 |
void bfa_ioim_isr(struct bfa_s *bfa, struct bfi_msg_s *msg); |
| 332 |
void bfa_ioim_good_comp_isr(struct bfa_s *bfa, |
| 333 |
struct bfi_msg_s *msg); |
| 334 |
void bfa_ioim_cleanup(struct bfa_ioim_s *ioim); |
| 335 |
void bfa_ioim_cleanup_tm(struct bfa_ioim_s *ioim, |
| 336 |
struct bfa_tskim_s *tskim); |
| 337 |
void bfa_ioim_iocdisable(struct bfa_ioim_s *ioim); |
| 338 |
void bfa_ioim_tov(struct bfa_ioim_s *ioim); |
| 339 |
|
| 340 |
void bfa_tskim_attach(struct bfa_fcpim_s *fcpim); |
| 341 |
void bfa_tskim_isr(struct bfa_s *bfa, struct bfi_msg_s *msg); |
| 342 |
void bfa_tskim_iocdisable(struct bfa_tskim_s *tskim); |
| 343 |
void bfa_tskim_cleanup(struct bfa_tskim_s *tskim); |
| 344 |
void bfa_tskim_res_recfg(struct bfa_s *bfa, u16 num_tskim_fw); |
| 345 |
|
| 346 |
void bfa_itnim_meminfo(struct bfa_iocfc_cfg_s *cfg, u32 *km_len); |
| 347 |
void bfa_itnim_attach(struct bfa_fcpim_s *fcpim); |
| 348 |
void bfa_itnim_iocdisable(struct bfa_itnim_s *itnim); |
| 349 |
void bfa_itnim_isr(struct bfa_s *bfa, struct bfi_msg_s *msg); |
| 350 |
void bfa_itnim_iodone(struct bfa_itnim_s *itnim); |
| 351 |
void bfa_itnim_tskdone(struct bfa_itnim_s *itnim); |
| 352 |
bfa_boolean_t bfa_itnim_hold_io(struct bfa_itnim_s *itnim); |
| 353 |
|
| 354 |
/* |
| 355 |
* bfa fcpim module API functions |
| 356 |
*/ |
| 357 |
void bfa_fcpim_path_tov_set(struct bfa_s *bfa, u16 path_tov); |
| 358 |
u16 bfa_fcpim_path_tov_get(struct bfa_s *bfa); |
| 359 |
u16 bfa_fcpim_qdepth_get(struct bfa_s *bfa); |
| 360 |
bfa_status_t bfa_fcpim_port_iostats(struct bfa_s *bfa, |
| 361 |
struct bfa_itnim_iostats_s *stats, u8 lp_tag); |
| 362 |
void bfa_fcpim_add_stats(struct bfa_itnim_iostats_s *fcpim_stats, |
| 363 |
struct bfa_itnim_iostats_s *itnim_stats); |
| 364 |
bfa_status_t bfa_fcpim_profile_on(struct bfa_s *bfa, time64_t time); |
| 365 |
bfa_status_t bfa_fcpim_profile_off(struct bfa_s *bfa); |
| 366 |
|
| 367 |
#define bfa_fcpim_ioredirect_enabled(__bfa) \ |
| 368 |
(((struct bfa_fcpim_s *)(BFA_FCPIM(__bfa)))->ioredirect) |
| 369 |
|
| 370 |
#define bfa_fcpim_get_next_reqq(__bfa, __qid) \ |
| 371 |
{ \ |
| 372 |
struct bfa_fcpim_s *__fcpim = BFA_FCPIM(__bfa); \ |
| 373 |
__fcpim->reqq++; \ |
| 374 |
__fcpim->reqq &= (BFI_IOC_MAX_CQS - 1); \ |
| 375 |
*(__qid) = __fcpim->reqq; \ |
| 376 |
} |
| 377 |
|
| 378 |
#define bfa_iocfc_map_msg_to_qid(__msg, __qid) \ |
| 379 |
*(__qid) = (u8)((__msg) & (BFI_IOC_MAX_CQS - 1)); |
| 380 |
/* |
| 381 |
* bfa itnim API functions |
| 382 |
*/ |
| 383 |
struct bfa_itnim_s *bfa_itnim_create(struct bfa_s *bfa, |
| 384 |
struct bfa_rport_s *rport, void *itnim); |
| 385 |
void bfa_itnim_delete(struct bfa_itnim_s *itnim); |
| 386 |
void bfa_itnim_online(struct bfa_itnim_s *itnim, bfa_boolean_t seq_rec); |
| 387 |
void bfa_itnim_offline(struct bfa_itnim_s *itnim); |
| 388 |
void bfa_itnim_clear_stats(struct bfa_itnim_s *itnim); |
| 389 |
bfa_status_t bfa_itnim_get_ioprofile(struct bfa_itnim_s *itnim, |
| 390 |
struct bfa_itnim_ioprofile_s *ioprofile); |
| 391 |
|
| 392 |
#define bfa_itnim_get_reqq(__ioim) (((struct bfa_ioim_s *)__ioim)->itnim->reqq) |
| 393 |
|
| 394 |
/* |
| 395 |
* BFA completion callback for bfa_itnim_online(). |
| 396 |
*/ |
| 397 |
void bfa_cb_itnim_online(void *itnim); |
| 398 |
|
| 399 |
/* |
| 400 |
* BFA completion callback for bfa_itnim_offline(). |
| 401 |
*/ |
| 402 |
void bfa_cb_itnim_offline(void *itnim); |
| 403 |
void bfa_cb_itnim_tov_begin(void *itnim); |
| 404 |
void bfa_cb_itnim_tov(void *itnim); |
| 405 |
|
| 406 |
/* |
| 407 |
* BFA notification to FCS/driver for second level error recovery. |
| 408 |
* Atleast one I/O request has timedout and target is unresponsive to |
| 409 |
* repeated abort requests. Second level error recovery should be initiated |
| 410 |
* by starting implicit logout and recovery procedures. |
| 411 |
*/ |
| 412 |
void bfa_cb_itnim_sler(void *itnim); |
| 413 |
|
| 414 |
/* |
| 415 |
* bfa ioim API functions |
| 416 |
*/ |
| 417 |
struct bfa_ioim_s *bfa_ioim_alloc(struct bfa_s *bfa, |
| 418 |
struct bfad_ioim_s *dio, |
| 419 |
struct bfa_itnim_s *itnim, |
| 420 |
u16 nsgles); |
| 421 |
|
| 422 |
void bfa_ioim_free(struct bfa_ioim_s *ioim); |
| 423 |
void bfa_ioim_start(struct bfa_ioim_s *ioim); |
| 424 |
bfa_status_t bfa_ioim_abort(struct bfa_ioim_s *ioim); |
| 425 |
void bfa_ioim_delayed_comp(struct bfa_ioim_s *ioim, |
| 426 |
bfa_boolean_t iotov); |
| 427 |
/* |
| 428 |
* I/O completion notification. |
| 429 |
* |
| 430 |
* @param[in] dio driver IO structure |
| 431 |
* @param[in] io_status IO completion status |
| 432 |
* @param[in] scsi_status SCSI status returned by target |
| 433 |
* @param[in] sns_len SCSI sense length, 0 if none |
| 434 |
* @param[in] sns_info SCSI sense data, if any |
| 435 |
* @param[in] residue Residual length |
| 436 |
* |
| 437 |
* @return None |
| 438 |
*/ |
| 439 |
void bfa_cb_ioim_done(void *bfad, struct bfad_ioim_s *dio, |
| 440 |
enum bfi_ioim_status io_status, |
| 441 |
u8 scsi_status, int sns_len, |
| 442 |
u8 *sns_info, s32 residue); |
| 443 |
|
| 444 |
/* |
| 445 |
* I/O good completion notification. |
| 446 |
*/ |
| 447 |
void bfa_cb_ioim_good_comp(void *bfad, struct bfad_ioim_s *dio); |
| 448 |
|
| 449 |
/* |
| 450 |
* I/O abort completion notification |
| 451 |
*/ |
| 452 |
void bfa_cb_ioim_abort(void *bfad, struct bfad_ioim_s *dio); |
| 453 |
|
| 454 |
/* |
| 455 |
* bfa tskim API functions |
| 456 |
*/ |
| 457 |
struct bfa_tskim_s *bfa_tskim_alloc(struct bfa_s *bfa, |
| 458 |
struct bfad_tskim_s *dtsk); |
| 459 |
void bfa_tskim_free(struct bfa_tskim_s *tskim); |
| 460 |
void bfa_tskim_start(struct bfa_tskim_s *tskim, |
| 461 |
struct bfa_itnim_s *itnim, struct scsi_lun lun, |
| 462 |
enum fcp_tm_cmnd tm, u8 t_secs); |
| 463 |
void bfa_cb_tskim_done(void *bfad, struct bfad_tskim_s *dtsk, |
| 464 |
enum bfi_tskim_status tsk_status); |
| 465 |
|
| 466 |
void bfa_fcpim_lunmask_rp_update(struct bfa_s *bfa, wwn_t lp_wwn, |
| 467 |
wwn_t rp_wwn, u16 rp_tag, u8 lp_tag); |
| 468 |
bfa_status_t bfa_fcpim_lunmask_update(struct bfa_s *bfa, u32 on_off); |
| 469 |
bfa_status_t bfa_fcpim_lunmask_query(struct bfa_s *bfa, void *buf); |
| 470 |
bfa_status_t bfa_fcpim_lunmask_delete(struct bfa_s *bfa, u16 vf_id, |
| 471 |
wwn_t *pwwn, wwn_t rpwwn, struct scsi_lun lun); |
| 472 |
bfa_status_t bfa_fcpim_lunmask_add(struct bfa_s *bfa, u16 vf_id, |
| 473 |
wwn_t *pwwn, wwn_t rpwwn, struct scsi_lun lun); |
| 474 |
bfa_status_t bfa_fcpim_lunmask_clear(struct bfa_s *bfa); |
| 475 |
u16 bfa_fcpim_read_throttle(struct bfa_s *bfa); |
| 476 |
bfa_status_t bfa_fcpim_write_throttle(struct bfa_s *bfa, u16 value); |
| 477 |
bfa_status_t bfa_fcpim_throttle_set(struct bfa_s *bfa, u16 value); |
| 478 |
bfa_status_t bfa_fcpim_throttle_get(struct bfa_s *bfa, void *buf); |
| 479 |
u16 bfa_fcpim_get_throttle_cfg(struct bfa_s *bfa, u16 drv_cfg_param); |
| 480 |
|
| 481 |
#endif /* __BFA_FCPIM_H__ */ |