aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/bfa
diff options
context:
space:
mode:
authorKrishna Gudipati <kgudipat@brocade.com>2011-06-13 18:53:58 -0400
committerJames Bottomley <JBottomley@Parallels.com>2011-06-29 16:54:23 -0400
commite2187d7f38967aeaf4148cdbe3498f76f4f71bca (patch)
tree9d04ce87a63d934853cdd61ddc23dcc0c57c8acd /drivers/scsi/bfa
parentbe540a991e2097c313d7304e0daaf89d68011bb9 (diff)
[SCSI] bfa: Enhancement for fcpim and IO tag handling.
- Enhancements to FCPIM module. - Introduced IO tag management to allocate/release IOs to FCPIM module from a free IOtag pool. Signed-off-by: Krishna Gudipati <kgudipat@brocade.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi/bfa')
-rw-r--r--drivers/scsi/bfa/bfa_core.c9
-rw-r--r--drivers/scsi/bfa/bfa_defs_svc.h3
-rw-r--r--drivers/scsi/bfa/bfa_fcpim.c267
-rw-r--r--drivers/scsi/bfa/bfa_fcpim.h69
-rw-r--r--drivers/scsi/bfa/bfa_modules.h5
-rw-r--r--drivers/scsi/bfa/bfi_ms.h3
6 files changed, 263 insertions, 93 deletions
diff --git a/drivers/scsi/bfa/bfa_core.c b/drivers/scsi/bfa/bfa_core.c
index 0dbdd2da5b48..6da615f48822 100644
--- a/drivers/scsi/bfa/bfa_core.c
+++ b/drivers/scsi/bfa/bfa_core.c
@@ -31,7 +31,7 @@ static struct bfa_module_s *hal_mods[] = {
31 &hal_mod_lps, 31 &hal_mod_lps,
32 &hal_mod_uf, 32 &hal_mod_uf,
33 &hal_mod_rport, 33 &hal_mod_rport,
34 &hal_mod_fcpim, 34 &hal_mod_fcp,
35 NULL 35 NULL
36}; 36};
37 37
@@ -51,7 +51,7 @@ static bfa_isr_func_t bfa_isrs[BFI_MC_MAX] = {
51 bfa_fcxp_isr, /* BFI_MC_FCXP */ 51 bfa_fcxp_isr, /* BFI_MC_FCXP */
52 bfa_lps_isr, /* BFI_MC_LPS */ 52 bfa_lps_isr, /* BFI_MC_LPS */
53 bfa_rport_isr, /* BFI_MC_RPORT */ 53 bfa_rport_isr, /* BFI_MC_RPORT */
54 bfa_itnim_isr, /* BFI_MC_ITN */ 54 bfa_itn_isr, /* BFI_MC_ITN */
55 bfa_isr_unhandled, /* BFI_MC_IOIM_READ */ 55 bfa_isr_unhandled, /* BFI_MC_IOIM_READ */
56 bfa_isr_unhandled, /* BFI_MC_IOIM_WRITE */ 56 bfa_isr_unhandled, /* BFI_MC_IOIM_WRITE */
57 bfa_isr_unhandled, /* BFI_MC_IOIM_IO */ 57 bfa_isr_unhandled, /* BFI_MC_IOIM_IO */
@@ -448,6 +448,8 @@ bfa_iocfc_send_cfg(void *bfa_arg)
448 */ 448 */
449 cfg_info->endian_sig = BFI_IOC_ENDIAN_SIG; 449 cfg_info->endian_sig = BFI_IOC_ENDIAN_SIG;
450 cfg_info->num_cqs = cfg->fwcfg.num_cqs; 450 cfg_info->num_cqs = cfg->fwcfg.num_cqs;
451 cfg_info->num_ioim_reqs = cpu_to_be16(cfg->fwcfg.num_ioim_reqs);
452 cfg_info->num_fwtio_reqs = cpu_to_be16(cfg->fwcfg.num_fwtio_reqs);
451 453
452 bfa_dma_be_addr_set(cfg_info->cfgrsp_addr, iocfc->cfgrsp_dma.pa); 454 bfa_dma_be_addr_set(cfg_info->cfgrsp_addr, iocfc->cfgrsp_dma.pa);
453 /* 455 /*
@@ -729,6 +731,7 @@ bfa_iocfc_cfgrsp(struct bfa_s *bfa)
729 731
730 fwcfg->num_cqs = fwcfg->num_cqs; 732 fwcfg->num_cqs = fwcfg->num_cqs;
731 fwcfg->num_ioim_reqs = be16_to_cpu(fwcfg->num_ioim_reqs); 733 fwcfg->num_ioim_reqs = be16_to_cpu(fwcfg->num_ioim_reqs);
734 fwcfg->num_fwtio_reqs = be16_to_cpu(fwcfg->num_fwtio_reqs);
732 fwcfg->num_tskim_reqs = be16_to_cpu(fwcfg->num_tskim_reqs); 735 fwcfg->num_tskim_reqs = be16_to_cpu(fwcfg->num_tskim_reqs);
733 fwcfg->num_fcxp_reqs = be16_to_cpu(fwcfg->num_fcxp_reqs); 736 fwcfg->num_fcxp_reqs = be16_to_cpu(fwcfg->num_fcxp_reqs);
734 fwcfg->num_uf_bufs = be16_to_cpu(fwcfg->num_uf_bufs); 737 fwcfg->num_uf_bufs = be16_to_cpu(fwcfg->num_uf_bufs);
@@ -1272,6 +1275,7 @@ bfa_cfg_get_default(struct bfa_iocfc_cfg_s *cfg)
1272 cfg->fwcfg.num_fcxp_reqs = DEF_CFG_NUM_FCXP_REQS; 1275 cfg->fwcfg.num_fcxp_reqs = DEF_CFG_NUM_FCXP_REQS;
1273 cfg->fwcfg.num_uf_bufs = DEF_CFG_NUM_UF_BUFS; 1276 cfg->fwcfg.num_uf_bufs = DEF_CFG_NUM_UF_BUFS;
1274 cfg->fwcfg.num_cqs = DEF_CFG_NUM_CQS; 1277 cfg->fwcfg.num_cqs = DEF_CFG_NUM_CQS;
1278 cfg->fwcfg.num_fwtio_reqs = 0;
1275 1279
1276 cfg->drvcfg.num_reqq_elems = DEF_CFG_NUM_REQQ_ELEMS; 1280 cfg->drvcfg.num_reqq_elems = DEF_CFG_NUM_REQQ_ELEMS;
1277 cfg->drvcfg.num_rspq_elems = DEF_CFG_NUM_RSPQ_ELEMS; 1281 cfg->drvcfg.num_rspq_elems = DEF_CFG_NUM_RSPQ_ELEMS;
@@ -1293,6 +1297,7 @@ bfa_cfg_get_min(struct bfa_iocfc_cfg_s *cfg)
1293 cfg->fwcfg.num_fcxp_reqs = BFA_FCXP_MIN; 1297 cfg->fwcfg.num_fcxp_reqs = BFA_FCXP_MIN;
1294 cfg->fwcfg.num_uf_bufs = BFA_UF_MIN; 1298 cfg->fwcfg.num_uf_bufs = BFA_UF_MIN;
1295 cfg->fwcfg.num_rports = BFA_RPORT_MIN; 1299 cfg->fwcfg.num_rports = BFA_RPORT_MIN;
1300 cfg->fwcfg.num_fwtio_reqs = 0;
1296 1301
1297 cfg->drvcfg.num_sgpgs = BFA_SGPG_MIN; 1302 cfg->drvcfg.num_sgpgs = BFA_SGPG_MIN;
1298 cfg->drvcfg.num_reqq_elems = BFA_REQQ_NELEMS_MIN; 1303 cfg->drvcfg.num_reqq_elems = BFA_REQQ_NELEMS_MIN;
diff --git a/drivers/scsi/bfa/bfa_defs_svc.h b/drivers/scsi/bfa/bfa_defs_svc.h
index 6934b2d8d857..e1aae51bb974 100644
--- a/drivers/scsi/bfa/bfa_defs_svc.h
+++ b/drivers/scsi/bfa/bfa_defs_svc.h
@@ -47,11 +47,12 @@ struct bfa_iocfc_fwcfg_s {
47 u16 num_rports; /* number of remote ports */ 47 u16 num_rports; /* number of remote ports */
48 u16 num_ioim_reqs; /* number of IO reqs */ 48 u16 num_ioim_reqs; /* number of IO reqs */
49 u16 num_tskim_reqs; /* task management requests */ 49 u16 num_tskim_reqs; /* task management requests */
50 u16 num_fwtio_reqs; /* number of TM IO reqs in FW */
50 u16 num_fcxp_reqs; /* unassisted FC exchanges */ 51 u16 num_fcxp_reqs; /* unassisted FC exchanges */
51 u16 num_uf_bufs; /* unsolicited recv buffers */ 52 u16 num_uf_bufs; /* unsolicited recv buffers */
52 u8 num_cqs; 53 u8 num_cqs;
53 u8 fw_tick_res; /* FW clock resolution in ms */ 54 u8 fw_tick_res; /* FW clock resolution in ms */
54 u8 rsvd[4]; 55 u8 rsvd[2];
55}; 56};
56#pragma pack() 57#pragma pack()
57 58
diff --git a/drivers/scsi/bfa/bfa_fcpim.c b/drivers/scsi/bfa/bfa_fcpim.c
index 874cd79855ea..76d9a00ffb6a 100644
--- a/drivers/scsi/bfa/bfa_fcpim.c
+++ b/drivers/scsi/bfa/bfa_fcpim.c
@@ -19,7 +19,6 @@
19#include "bfa_modules.h" 19#include "bfa_modules.h"
20 20
21BFA_TRC_FILE(HAL, FCPIM); 21BFA_TRC_FILE(HAL, FCPIM);
22BFA_MODULE(fcpim);
23 22
24/* 23/*
25 * BFA ITNIM Related definitions 24 * BFA ITNIM Related definitions
@@ -295,16 +294,9 @@ bfa_fcpim_meminfo(struct bfa_iocfc_cfg_s *cfg, u32 *km_len,
295 /* 294 /*
296 * IO memory 295 * IO memory
297 */ 296 */
298 if (cfg->fwcfg.num_ioim_reqs < BFA_IOIM_MIN)
299 cfg->fwcfg.num_ioim_reqs = BFA_IOIM_MIN;
300 else if (cfg->fwcfg.num_ioim_reqs > BFA_IOIM_MAX)
301 cfg->fwcfg.num_ioim_reqs = BFA_IOIM_MAX;
302
303 *km_len += cfg->fwcfg.num_ioim_reqs * 297 *km_len += cfg->fwcfg.num_ioim_reqs *
304 (sizeof(struct bfa_ioim_s) + sizeof(struct bfa_ioim_sp_s)); 298 (sizeof(struct bfa_ioim_s) + sizeof(struct bfa_ioim_sp_s));
305 299
306 *dm_len += cfg->fwcfg.num_ioim_reqs * BFI_IOIM_SNSLEN;
307
308 /* 300 /*
309 * task management command memory 301 * task management command memory
310 */ 302 */
@@ -315,19 +307,21 @@ bfa_fcpim_meminfo(struct bfa_iocfc_cfg_s *cfg, u32 *km_len,
315 307
316 308
317static void 309static void
318bfa_fcpim_attach(struct bfa_s *bfa, void *bfad, struct bfa_iocfc_cfg_s *cfg, 310bfa_fcpim_attach(struct bfa_fcp_mod_s *fcp, void *bfad,
319 struct bfa_meminfo_s *meminfo, struct bfa_pcidev_s *pcidev) 311 struct bfa_iocfc_cfg_s *cfg, struct bfa_meminfo_s *meminfo,
312 struct bfa_pcidev_s *pcidev)
320{ 313{
321 struct bfa_fcpim_mod_s *fcpim = BFA_FCPIM_MOD(bfa); 314 struct bfa_fcpim_s *fcpim = &fcp->fcpim;
315 struct bfa_s *bfa = fcp->bfa;
322 316
323 bfa_trc(bfa, cfg->drvcfg.path_tov); 317 bfa_trc(bfa, cfg->drvcfg.path_tov);
324 bfa_trc(bfa, cfg->fwcfg.num_rports); 318 bfa_trc(bfa, cfg->fwcfg.num_rports);
325 bfa_trc(bfa, cfg->fwcfg.num_ioim_reqs); 319 bfa_trc(bfa, cfg->fwcfg.num_ioim_reqs);
326 bfa_trc(bfa, cfg->fwcfg.num_tskim_reqs); 320 bfa_trc(bfa, cfg->fwcfg.num_tskim_reqs);
327 321
322 fcpim->fcp = fcp;
328 fcpim->bfa = bfa; 323 fcpim->bfa = bfa;
329 fcpim->num_itnims = cfg->fwcfg.num_rports; 324 fcpim->num_itnims = cfg->fwcfg.num_rports;
330 fcpim->num_ioim_reqs = cfg->fwcfg.num_ioim_reqs;
331 fcpim->num_tskim_reqs = cfg->fwcfg.num_tskim_reqs; 325 fcpim->num_tskim_reqs = cfg->fwcfg.num_tskim_reqs;
332 fcpim->path_tov = cfg->drvcfg.path_tov; 326 fcpim->path_tov = cfg->drvcfg.path_tov;
333 fcpim->delay_comp = cfg->drvcfg.delay_comp; 327 fcpim->delay_comp = cfg->drvcfg.delay_comp;
@@ -340,24 +334,9 @@ bfa_fcpim_attach(struct bfa_s *bfa, void *bfad, struct bfa_iocfc_cfg_s *cfg,
340} 334}
341 335
342static void 336static void
343bfa_fcpim_detach(struct bfa_s *bfa) 337bfa_fcpim_iocdisable(struct bfa_fcp_mod_s *fcp)
344{
345}
346
347static void
348bfa_fcpim_start(struct bfa_s *bfa)
349{
350}
351
352static void
353bfa_fcpim_stop(struct bfa_s *bfa)
354{ 338{
355} 339 struct bfa_fcpim_s *fcpim = &fcp->fcpim;
356
357static void
358bfa_fcpim_iocdisable(struct bfa_s *bfa)
359{
360 struct bfa_fcpim_mod_s *fcpim = BFA_FCPIM_MOD(bfa);
361 struct bfa_itnim_s *itnim; 340 struct bfa_itnim_s *itnim;
362 struct list_head *qe, *qen; 341 struct list_head *qe, *qen;
363 342
@@ -370,7 +349,7 @@ bfa_fcpim_iocdisable(struct bfa_s *bfa)
370void 349void
371bfa_fcpim_path_tov_set(struct bfa_s *bfa, u16 path_tov) 350bfa_fcpim_path_tov_set(struct bfa_s *bfa, u16 path_tov)
372{ 351{
373 struct bfa_fcpim_mod_s *fcpim = BFA_FCPIM_MOD(bfa); 352 struct bfa_fcpim_s *fcpim = BFA_FCPIM(bfa);
374 353
375 fcpim->path_tov = path_tov * 1000; 354 fcpim->path_tov = path_tov * 1000;
376 if (fcpim->path_tov > BFA_FCPIM_PATHTOV_MAX) 355 if (fcpim->path_tov > BFA_FCPIM_PATHTOV_MAX)
@@ -380,7 +359,7 @@ bfa_fcpim_path_tov_set(struct bfa_s *bfa, u16 path_tov)
380u16 359u16
381bfa_fcpim_path_tov_get(struct bfa_s *bfa) 360bfa_fcpim_path_tov_get(struct bfa_s *bfa)
382{ 361{
383 struct bfa_fcpim_mod_s *fcpim = BFA_FCPIM_MOD(bfa); 362 struct bfa_fcpim_s *fcpim = BFA_FCPIM(bfa);
384 363
385 return fcpim->path_tov / 1000; 364 return fcpim->path_tov / 1000;
386} 365}
@@ -388,7 +367,7 @@ bfa_fcpim_path_tov_get(struct bfa_s *bfa)
388u16 367u16
389bfa_fcpim_qdepth_get(struct bfa_s *bfa) 368bfa_fcpim_qdepth_get(struct bfa_s *bfa)
390{ 369{
391 struct bfa_fcpim_mod_s *fcpim = BFA_FCPIM_MOD(bfa); 370 struct bfa_fcpim_s *fcpim = BFA_FCPIM(bfa);
392 371
393 return fcpim->q_depth; 372 return fcpim->q_depth;
394} 373}
@@ -1000,7 +979,7 @@ bfa_itnim_meminfo(struct bfa_iocfc_cfg_s *cfg, u32 *km_len,
1000} 979}
1001 980
1002void 981void
1003bfa_itnim_attach(struct bfa_fcpim_mod_s *fcpim, struct bfa_meminfo_s *minfo) 982bfa_itnim_attach(struct bfa_fcpim_s *fcpim, struct bfa_meminfo_s *minfo)
1004{ 983{
1005 struct bfa_s *bfa = fcpim->bfa; 984 struct bfa_s *bfa = fcpim->bfa;
1006 struct bfa_itnim_s *itnim; 985 struct bfa_itnim_s *itnim;
@@ -1224,7 +1203,7 @@ bfa_itnim_iotov_delete(struct bfa_itnim_s *itnim)
1224static void 1203static void
1225bfa_itnim_update_del_itn_stats(struct bfa_itnim_s *itnim) 1204bfa_itnim_update_del_itn_stats(struct bfa_itnim_s *itnim)
1226{ 1205{
1227 struct bfa_fcpim_mod_s *fcpim = BFA_FCPIM_MOD(itnim->bfa); 1206 struct bfa_fcpim_s *fcpim = BFA_FCPIM(itnim->bfa);
1228 fcpim->del_itn_stats.del_itn_iocomp_aborted += 1207 fcpim->del_itn_stats.del_itn_iocomp_aborted +=
1229 itnim->stats.iocomp_aborted; 1208 itnim->stats.iocomp_aborted;
1230 fcpim->del_itn_stats.del_itn_iocomp_timedout += 1209 fcpim->del_itn_stats.del_itn_iocomp_timedout +=
@@ -1250,7 +1229,7 @@ bfa_itnim_update_del_itn_stats(struct bfa_itnim_s *itnim)
1250void 1229void
1251bfa_itnim_isr(struct bfa_s *bfa, struct bfi_msg_s *m) 1230bfa_itnim_isr(struct bfa_s *bfa, struct bfi_msg_s *m)
1252{ 1231{
1253 struct bfa_fcpim_mod_s *fcpim = BFA_FCPIM_MOD(bfa); 1232 struct bfa_fcpim_s *fcpim = BFA_FCPIM(bfa);
1254 union bfi_itn_i2h_msg_u msg; 1233 union bfi_itn_i2h_msg_u msg;
1255 struct bfa_itnim_s *itnim; 1234 struct bfa_itnim_s *itnim;
1256 1235
@@ -1295,9 +1274,11 @@ bfa_itnim_isr(struct bfa_s *bfa, struct bfi_msg_s *m)
1295struct bfa_itnim_s * 1274struct bfa_itnim_s *
1296bfa_itnim_create(struct bfa_s *bfa, struct bfa_rport_s *rport, void *ditn) 1275bfa_itnim_create(struct bfa_s *bfa, struct bfa_rport_s *rport, void *ditn)
1297{ 1276{
1298 struct bfa_fcpim_mod_s *fcpim = BFA_FCPIM_MOD(bfa); 1277 struct bfa_fcpim_s *fcpim = BFA_FCPIM(bfa);
1299 struct bfa_itnim_s *itnim; 1278 struct bfa_itnim_s *itnim;
1300 1279
1280 bfa_itn_create(bfa, rport, bfa_itnim_isr);
1281
1301 itnim = BFA_ITNIM_FROM_TAG(fcpim, rport->rport_tag); 1282 itnim = BFA_ITNIM_FROM_TAG(fcpim, rport->rport_tag);
1302 WARN_ON(itnim->rport != rport); 1283 WARN_ON(itnim->rport != rport);
1303 1284
@@ -1991,7 +1972,8 @@ __bfa_cb_ioim_comp(void *cbarg, bfa_boolean_t complete)
1991 if ((m->scsi_status == SCSI_STATUS_CHECK_CONDITION) && 1972 if ((m->scsi_status == SCSI_STATUS_CHECK_CONDITION) &&
1992 m->sns_len) { 1973 m->sns_len) {
1993 sns_len = m->sns_len; 1974 sns_len = m->sns_len;
1994 snsinfo = ioim->iosp->snsinfo; 1975 snsinfo = BFA_SNSINFO_FROM_TAG(ioim->fcpim->fcp,
1976 ioim->iotag);
1995 } 1977 }
1996 1978
1997 /* 1979 /*
@@ -2360,46 +2342,31 @@ bfa_ioim_delayed_comp(struct bfa_ioim_s *ioim, bfa_boolean_t iotov)
2360 * Memory allocation and initialization. 2342 * Memory allocation and initialization.
2361 */ 2343 */
2362void 2344void
2363bfa_ioim_attach(struct bfa_fcpim_mod_s *fcpim, struct bfa_meminfo_s *minfo) 2345bfa_ioim_attach(struct bfa_fcpim_s *fcpim, struct bfa_meminfo_s *minfo)
2364{ 2346{
2365 struct bfa_ioim_s *ioim; 2347 struct bfa_ioim_s *ioim;
2366 struct bfa_ioim_sp_s *iosp; 2348 struct bfa_ioim_sp_s *iosp;
2367 u16 i; 2349 u16 i;
2368 u8 *snsinfo;
2369 u32 snsbufsz;
2370 2350
2371 /* 2351 /*
2372 * claim memory first 2352 * claim memory first
2373 */ 2353 */
2374 ioim = (struct bfa_ioim_s *) bfa_meminfo_kva(minfo); 2354 ioim = (struct bfa_ioim_s *) bfa_meminfo_kva(minfo);
2375 fcpim->ioim_arr = ioim; 2355 fcpim->ioim_arr = ioim;
2376 bfa_meminfo_kva(minfo) = (u8 *) (ioim + fcpim->num_ioim_reqs); 2356 bfa_meminfo_kva(minfo) = (u8 *) (ioim + fcpim->fcp->num_ioim_reqs);
2377 2357
2378 iosp = (struct bfa_ioim_sp_s *) bfa_meminfo_kva(minfo); 2358 iosp = (struct bfa_ioim_sp_s *) bfa_meminfo_kva(minfo);
2379 fcpim->ioim_sp_arr = iosp; 2359 fcpim->ioim_sp_arr = iosp;
2380 bfa_meminfo_kva(minfo) = (u8 *) (iosp + fcpim->num_ioim_reqs); 2360 bfa_meminfo_kva(minfo) = (u8 *) (iosp + fcpim->fcp->num_ioim_reqs);
2381
2382 /*
2383 * Claim DMA memory for per IO sense data.
2384 */
2385 snsbufsz = fcpim->num_ioim_reqs * BFI_IOIM_SNSLEN;
2386 fcpim->snsbase.pa = bfa_meminfo_dma_phys(minfo);
2387 bfa_meminfo_dma_phys(minfo) += snsbufsz;
2388
2389 fcpim->snsbase.kva = bfa_meminfo_dma_virt(minfo);
2390 bfa_meminfo_dma_virt(minfo) += snsbufsz;
2391 snsinfo = fcpim->snsbase.kva;
2392 bfa_iocfc_set_snsbase(fcpim->bfa, fcpim->snsbase.pa);
2393 2361
2394 /* 2362 /*
2395 * Initialize ioim free queues 2363 * Initialize ioim free queues
2396 */ 2364 */
2397 INIT_LIST_HEAD(&fcpim->ioim_free_q);
2398 INIT_LIST_HEAD(&fcpim->ioim_resfree_q); 2365 INIT_LIST_HEAD(&fcpim->ioim_resfree_q);
2399 INIT_LIST_HEAD(&fcpim->ioim_comp_q); 2366 INIT_LIST_HEAD(&fcpim->ioim_comp_q);
2400 2367
2401 for (i = 0; i < fcpim->num_ioim_reqs; 2368 for (i = 0; i < fcpim->fcp->num_ioim_reqs;
2402 i++, ioim++, iosp++, snsinfo += BFI_IOIM_SNSLEN) { 2369 i++, ioim++, iosp++) {
2403 /* 2370 /*
2404 * initialize IOIM 2371 * initialize IOIM
2405 */ 2372 */
@@ -2408,22 +2375,19 @@ bfa_ioim_attach(struct bfa_fcpim_mod_s *fcpim, struct bfa_meminfo_s *minfo)
2408 ioim->bfa = fcpim->bfa; 2375 ioim->bfa = fcpim->bfa;
2409 ioim->fcpim = fcpim; 2376 ioim->fcpim = fcpim;
2410 ioim->iosp = iosp; 2377 ioim->iosp = iosp;
2411 iosp->snsinfo = snsinfo;
2412 INIT_LIST_HEAD(&ioim->sgpg_q); 2378 INIT_LIST_HEAD(&ioim->sgpg_q);
2413 bfa_reqq_winit(&ioim->iosp->reqq_wait, 2379 bfa_reqq_winit(&ioim->iosp->reqq_wait,
2414 bfa_ioim_qresume, ioim); 2380 bfa_ioim_qresume, ioim);
2415 bfa_sgpg_winit(&ioim->iosp->sgpg_wqe, 2381 bfa_sgpg_winit(&ioim->iosp->sgpg_wqe,
2416 bfa_ioim_sgpg_alloced, ioim); 2382 bfa_ioim_sgpg_alloced, ioim);
2417 bfa_sm_set_state(ioim, bfa_ioim_sm_uninit); 2383 bfa_sm_set_state(ioim, bfa_ioim_sm_uninit);
2418
2419 list_add_tail(&ioim->qe, &fcpim->ioim_free_q);
2420 } 2384 }
2421} 2385}
2422 2386
2423void 2387void
2424bfa_ioim_isr(struct bfa_s *bfa, struct bfi_msg_s *m) 2388bfa_ioim_isr(struct bfa_s *bfa, struct bfi_msg_s *m)
2425{ 2389{
2426 struct bfa_fcpim_mod_s *fcpim = BFA_FCPIM_MOD(bfa); 2390 struct bfa_fcpim_s *fcpim = BFA_FCPIM(bfa);
2427 struct bfi_ioim_rsp_s *rsp = (struct bfi_ioim_rsp_s *) m; 2391 struct bfi_ioim_rsp_s *rsp = (struct bfi_ioim_rsp_s *) m;
2428 struct bfa_ioim_s *ioim; 2392 struct bfa_ioim_s *ioim;
2429 u16 iotag; 2393 u16 iotag;
@@ -2507,7 +2471,7 @@ bfa_ioim_isr(struct bfa_s *bfa, struct bfi_msg_s *m)
2507void 2471void
2508bfa_ioim_good_comp_isr(struct bfa_s *bfa, struct bfi_msg_s *m) 2472bfa_ioim_good_comp_isr(struct bfa_s *bfa, struct bfi_msg_s *m)
2509{ 2473{
2510 struct bfa_fcpim_mod_s *fcpim = BFA_FCPIM_MOD(bfa); 2474 struct bfa_fcpim_s *fcpim = BFA_FCPIM(bfa);
2511 struct bfi_ioim_rsp_s *rsp = (struct bfi_ioim_rsp_s *) m; 2475 struct bfi_ioim_rsp_s *rsp = (struct bfi_ioim_rsp_s *) m;
2512 struct bfa_ioim_s *ioim; 2476 struct bfa_ioim_s *ioim;
2513 u16 iotag; 2477 u16 iotag;
@@ -2573,18 +2537,21 @@ struct bfa_ioim_s *
2573bfa_ioim_alloc(struct bfa_s *bfa, struct bfad_ioim_s *dio, 2537bfa_ioim_alloc(struct bfa_s *bfa, struct bfad_ioim_s *dio,
2574 struct bfa_itnim_s *itnim, u16 nsges) 2538 struct bfa_itnim_s *itnim, u16 nsges)
2575{ 2539{
2576 struct bfa_fcpim_mod_s *fcpim = BFA_FCPIM_MOD(bfa); 2540 struct bfa_fcpim_s *fcpim = BFA_FCPIM(bfa);
2577 struct bfa_ioim_s *ioim; 2541 struct bfa_ioim_s *ioim;
2542 struct bfa_iotag_s *iotag = NULL;
2578 2543
2579 /* 2544 /*
2580 * alocate IOIM resource 2545 * alocate IOIM resource
2581 */ 2546 */
2582 bfa_q_deq(&fcpim->ioim_free_q, &ioim); 2547 bfa_q_deq(&fcpim->fcp->iotag_ioim_free_q, &iotag);
2583 if (!ioim) { 2548 if (!iotag) {
2584 bfa_stats(itnim, no_iotags); 2549 bfa_stats(itnim, no_iotags);
2585 return NULL; 2550 return NULL;
2586 } 2551 }
2587 2552
2553 ioim = BFA_IOIM_FROM_TAG(fcpim, iotag->tag);
2554
2588 ioim->dio = dio; 2555 ioim->dio = dio;
2589 ioim->itnim = itnim; 2556 ioim->itnim = itnim;
2590 ioim->nsges = nsges; 2557 ioim->nsges = nsges;
@@ -2601,7 +2568,8 @@ bfa_ioim_alloc(struct bfa_s *bfa, struct bfad_ioim_s *dio,
2601void 2568void
2602bfa_ioim_free(struct bfa_ioim_s *ioim) 2569bfa_ioim_free(struct bfa_ioim_s *ioim)
2603{ 2570{
2604 struct bfa_fcpim_mod_s *fcpim = ioim->fcpim; 2571 struct bfa_fcpim_s *fcpim = ioim->fcpim;
2572 struct bfa_iotag_s *iotag;
2605 2573
2606 if (ioim->nsgpgs > 0) 2574 if (ioim->nsgpgs > 0)
2607 bfa_sgpg_mfree(ioim->bfa, &ioim->sgpg_q, ioim->nsgpgs); 2575 bfa_sgpg_mfree(ioim->bfa, &ioim->sgpg_q, ioim->nsgpgs);
@@ -2610,8 +2578,17 @@ bfa_ioim_free(struct bfa_ioim_s *ioim)
2610 fcpim->ios_active--; 2578 fcpim->ios_active--;
2611 2579
2612 ioim->iotag &= BFA_IOIM_IOTAG_MASK; 2580 ioim->iotag &= BFA_IOIM_IOTAG_MASK;
2581
2582 WARN_ON(!(ioim->iotag <
2583 (fcpim->fcp->num_ioim_reqs + fcpim->fcp->num_fwtio_reqs)));
2584 iotag = BFA_IOTAG_FROM_TAG(fcpim->fcp, ioim->iotag);
2585
2586 if (ioim->iotag < fcpim->fcp->num_ioim_reqs)
2587 list_add_tail(&iotag->qe, &fcpim->fcp->iotag_ioim_free_q);
2588 else
2589 list_add_tail(&iotag->qe, &fcpim->fcp->iotag_tio_free_q);
2590
2613 list_del(&ioim->qe); 2591 list_del(&ioim->qe);
2614 list_add_tail(&ioim->qe, &fcpim->ioim_free_q);
2615} 2592}
2616 2593
2617void 2594void
@@ -3129,7 +3106,7 @@ bfa_tskim_cleanup(struct bfa_tskim_s *tskim)
3129 * Memory allocation and initialization. 3106 * Memory allocation and initialization.
3130 */ 3107 */
3131void 3108void
3132bfa_tskim_attach(struct bfa_fcpim_mod_s *fcpim, struct bfa_meminfo_s *minfo) 3109bfa_tskim_attach(struct bfa_fcpim_s *fcpim, struct bfa_meminfo_s *minfo)
3133{ 3110{
3134 struct bfa_tskim_s *tskim; 3111 struct bfa_tskim_s *tskim;
3135 u16 i; 3112 u16 i;
@@ -3161,7 +3138,7 @@ bfa_tskim_attach(struct bfa_fcpim_mod_s *fcpim, struct bfa_meminfo_s *minfo)
3161void 3138void
3162bfa_tskim_isr(struct bfa_s *bfa, struct bfi_msg_s *m) 3139bfa_tskim_isr(struct bfa_s *bfa, struct bfi_msg_s *m)
3163{ 3140{
3164 struct bfa_fcpim_mod_s *fcpim = BFA_FCPIM_MOD(bfa); 3141 struct bfa_fcpim_s *fcpim = BFA_FCPIM(bfa);
3165 struct bfi_tskim_rsp_s *rsp = (struct bfi_tskim_rsp_s *) m; 3142 struct bfi_tskim_rsp_s *rsp = (struct bfi_tskim_rsp_s *) m;
3166 struct bfa_tskim_s *tskim; 3143 struct bfa_tskim_s *tskim;
3167 u16 tsk_tag = be16_to_cpu(rsp->tsk_tag); 3144 u16 tsk_tag = be16_to_cpu(rsp->tsk_tag);
@@ -3188,7 +3165,7 @@ bfa_tskim_isr(struct bfa_s *bfa, struct bfi_msg_s *m)
3188struct bfa_tskim_s * 3165struct bfa_tskim_s *
3189bfa_tskim_alloc(struct bfa_s *bfa, struct bfad_tskim_s *dtsk) 3166bfa_tskim_alloc(struct bfa_s *bfa, struct bfad_tskim_s *dtsk)
3190{ 3167{
3191 struct bfa_fcpim_mod_s *fcpim = BFA_FCPIM_MOD(bfa); 3168 struct bfa_fcpim_s *fcpim = BFA_FCPIM(bfa);
3192 struct bfa_tskim_s *tskim; 3169 struct bfa_tskim_s *tskim;
3193 3170
3194 bfa_q_deq(&fcpim->tskim_free_q, &tskim); 3171 bfa_q_deq(&fcpim->tskim_free_q, &tskim);
@@ -3233,3 +3210,153 @@ bfa_tskim_start(struct bfa_tskim_s *tskim, struct bfa_itnim_s *itnim,
3233 list_add_tail(&tskim->qe, &itnim->tsk_q); 3210 list_add_tail(&tskim->qe, &itnim->tsk_q);
3234 bfa_sm_send_event(tskim, BFA_TSKIM_SM_START); 3211 bfa_sm_send_event(tskim, BFA_TSKIM_SM_START);
3235} 3212}
3213
3214/* BFA FCP module - parent module for fcpim */
3215
3216BFA_MODULE(fcp);
3217
3218static void
3219bfa_fcp_meminfo(struct bfa_iocfc_cfg_s *cfg, u32 *km_len, u32 *dm_len)
3220{
3221 u16 num_io_req;
3222
3223 /*
3224 * ZERO for num_ioim_reqs and num_fwtio_reqs is allowed config value.
3225 * So if the values are non zero, adjust them appropriately.
3226 */
3227 if (cfg->fwcfg.num_ioim_reqs &&
3228 cfg->fwcfg.num_ioim_reqs < BFA_IOIM_MIN)
3229 cfg->fwcfg.num_ioim_reqs = BFA_IOIM_MIN;
3230 else if (cfg->fwcfg.num_ioim_reqs > BFA_IOIM_MAX)
3231 cfg->fwcfg.num_ioim_reqs = BFA_IOIM_MAX;
3232
3233 if (cfg->fwcfg.num_fwtio_reqs > BFA_FWTIO_MAX)
3234 cfg->fwcfg.num_fwtio_reqs = BFA_FWTIO_MAX;
3235
3236 num_io_req = (cfg->fwcfg.num_ioim_reqs + cfg->fwcfg.num_fwtio_reqs);
3237 if (num_io_req > BFA_IO_MAX) {
3238 if (cfg->fwcfg.num_ioim_reqs && cfg->fwcfg.num_fwtio_reqs) {
3239 cfg->fwcfg.num_ioim_reqs = BFA_IO_MAX/2;
3240 cfg->fwcfg.num_fwtio_reqs = BFA_IO_MAX/2;
3241 } else if (cfg->fwcfg.num_fwtio_reqs)
3242 cfg->fwcfg.num_fwtio_reqs = BFA_FWTIO_MAX;
3243 else
3244 cfg->fwcfg.num_ioim_reqs = BFA_IOIM_MAX;
3245 }
3246
3247 bfa_fcpim_meminfo(cfg, km_len, dm_len);
3248
3249 num_io_req = (cfg->fwcfg.num_ioim_reqs + cfg->fwcfg.num_fwtio_reqs);
3250 *km_len += num_io_req * sizeof(struct bfa_iotag_s);
3251 *km_len += cfg->fwcfg.num_rports * sizeof(struct bfa_itn_s);
3252 *dm_len += num_io_req * BFI_IOIM_SNSLEN;
3253}
3254
3255static void
3256bfa_fcp_attach(struct bfa_s *bfa, void *bfad, struct bfa_iocfc_cfg_s *cfg,
3257 struct bfa_meminfo_s *meminfo, struct bfa_pcidev_s *pcidev)
3258{
3259 struct bfa_fcp_mod_s *fcp = BFA_FCP_MOD(bfa);
3260 u32 snsbufsz;
3261
3262 fcp->num_ioim_reqs = cfg->fwcfg.num_ioim_reqs;
3263 fcp->num_fwtio_reqs = cfg->fwcfg.num_fwtio_reqs;
3264 fcp->num_itns = cfg->fwcfg.num_rports;
3265 fcp->bfa = bfa;
3266
3267 snsbufsz = (fcp->num_ioim_reqs + fcp->num_fwtio_reqs) * BFI_IOIM_SNSLEN;
3268 fcp->snsbase.pa = bfa_meminfo_dma_phys(meminfo);
3269 bfa_meminfo_dma_phys(meminfo) += snsbufsz;
3270
3271 fcp->snsbase.kva = bfa_meminfo_dma_virt(meminfo);
3272 bfa_meminfo_dma_virt(meminfo) += snsbufsz;
3273 bfa_iocfc_set_snsbase(bfa, fcp->snsbase.pa);
3274
3275 bfa_fcpim_attach(fcp, bfad, cfg, meminfo, pcidev);
3276
3277 fcp->itn_arr = (struct bfa_itn_s *) bfa_meminfo_kva(meminfo);
3278 bfa_meminfo_kva(meminfo) = (u8 *)fcp->itn_arr +
3279 (fcp->num_itns * sizeof(struct bfa_itn_s));
3280 memset(fcp->itn_arr, 0,
3281 (fcp->num_itns * sizeof(struct bfa_itn_s)));
3282
3283 bfa_iotag_attach(fcp, meminfo);
3284}
3285
3286static void
3287bfa_fcp_detach(struct bfa_s *bfa)
3288{
3289}
3290
3291static void
3292bfa_fcp_start(struct bfa_s *bfa)
3293{
3294}
3295
3296static void
3297bfa_fcp_stop(struct bfa_s *bfa)
3298{
3299}
3300
3301static void
3302bfa_fcp_iocdisable(struct bfa_s *bfa)
3303{
3304 struct bfa_fcp_mod_s *fcp = BFA_FCP_MOD(bfa);
3305
3306 bfa_fcpim_iocdisable(fcp);
3307}
3308
3309void
3310bfa_itn_create(struct bfa_s *bfa, struct bfa_rport_s *rport,
3311 void (*isr)(struct bfa_s *bfa, struct bfi_msg_s *m))
3312{
3313 struct bfa_fcp_mod_s *fcp = BFA_FCP_MOD(bfa);
3314 struct bfa_itn_s *itn;
3315
3316 itn = BFA_ITN_FROM_TAG(fcp, rport->rport_tag);
3317 itn->isr = isr;
3318}
3319
3320/*
3321 * Itn interrupt processing.
3322 */
3323void
3324bfa_itn_isr(struct bfa_s *bfa, struct bfi_msg_s *m)
3325{
3326 struct bfa_fcp_mod_s *fcp = BFA_FCP_MOD(bfa);
3327 union bfi_itn_i2h_msg_u msg;
3328 struct bfa_itn_s *itn;
3329
3330 msg.msg = m;
3331 itn = BFA_ITN_FROM_TAG(fcp, msg.create_rsp->bfa_handle);
3332
3333 if (itn->isr)
3334 itn->isr(bfa, m);
3335 else
3336 WARN_ON(1);
3337}
3338
3339void
3340bfa_iotag_attach(struct bfa_fcp_mod_s *fcp, struct bfa_meminfo_s *minfo)
3341{
3342 struct bfa_iotag_s *iotag;
3343 u16 num_io_req, i;
3344
3345 iotag = (struct bfa_iotag_s *) bfa_meminfo_kva(minfo);
3346 fcp->iotag_arr = iotag;
3347
3348 INIT_LIST_HEAD(&fcp->iotag_ioim_free_q);
3349 INIT_LIST_HEAD(&fcp->iotag_tio_free_q);
3350
3351 num_io_req = fcp->num_ioim_reqs + fcp->num_fwtio_reqs;
3352 for (i = 0; i < num_io_req; i++, iotag++) {
3353 memset(iotag, 0, sizeof(struct bfa_iotag_s));
3354 iotag->tag = i;
3355 if (i < fcp->num_ioim_reqs)
3356 list_add_tail(&iotag->qe, &fcp->iotag_ioim_free_q);
3357 else
3358 list_add_tail(&iotag->qe, &fcp->iotag_tio_free_q);
3359 }
3360
3361 bfa_meminfo_kva(minfo) = (u8 *) iotag;
3362}
diff --git a/drivers/scsi/bfa/bfa_fcpim.h b/drivers/scsi/bfa/bfa_fcpim.h
index 1e38dade8423..e1e3221fda43 100644
--- a/drivers/scsi/bfa/bfa_fcpim.h
+++ b/drivers/scsi/bfa/bfa_fcpim.h
@@ -24,6 +24,32 @@
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 2000
29#define BFA_FWTIO_MAX 0
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, 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))
27 53
28#define BFA_ITNIM_MIN 32 54#define BFA_ITNIM_MIN 32
29#define BFA_ITNIM_MAX 1024 55#define BFA_ITNIM_MAX 1024
@@ -75,22 +101,20 @@ struct bfad_tskim_s;
75 101
76typedef void (*bfa_fcpim_profile_t) (struct bfa_ioim_s *ioim); 102typedef void (*bfa_fcpim_profile_t) (struct bfa_ioim_s *ioim);
77 103
78struct bfa_fcpim_mod_s { 104struct bfa_fcpim_s {
79 struct bfa_s *bfa; 105 struct bfa_s *bfa;
106 struct bfa_fcp_mod_s *fcp;
80 struct bfa_itnim_s *itnim_arr; 107 struct bfa_itnim_s *itnim_arr;
81 struct bfa_ioim_s *ioim_arr; 108 struct bfa_ioim_s *ioim_arr;
82 struct bfa_ioim_sp_s *ioim_sp_arr; 109 struct bfa_ioim_sp_s *ioim_sp_arr;
83 struct bfa_tskim_s *tskim_arr; 110 struct bfa_tskim_s *tskim_arr;
84 struct bfa_dma_s snsbase;
85 int num_itnims; 111 int num_itnims;
86 int num_ioim_reqs;
87 int num_tskim_reqs; 112 int num_tskim_reqs;
88 u32 path_tov; 113 u32 path_tov;
89 u16 q_depth; 114 u16 q_depth;
90 u8 reqq; /* Request queue to be used */ 115 u8 reqq; /* Request queue to be used */
91 u8 rsvd; 116 u8 rsvd;
92 struct list_head itnim_q; /* queue of active itnim */ 117 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 */ 118 struct list_head ioim_resfree_q; /* IOs waiting for f/w */
95 struct list_head ioim_comp_q; /* IO global comp Q */ 119 struct list_head ioim_comp_q; /* IO global comp Q */
96 struct list_head tskim_free_q; 120 struct list_head tskim_free_q;
@@ -104,6 +128,19 @@ struct bfa_fcpim_mod_s {
104 bfa_fcpim_profile_t profile_start; 128 bfa_fcpim_profile_t profile_start;
105}; 129};
106 130
131struct 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
107/* 144/*
108 * BFA IO (initiator mode) 145 * BFA IO (initiator mode)
109 */ 146 */
@@ -111,7 +148,7 @@ struct bfa_ioim_s {
111 struct list_head qe; /* queue elememt */ 148 struct list_head qe; /* queue elememt */
112 bfa_sm_t sm; /* BFA ioim state machine */ 149 bfa_sm_t sm; /* BFA ioim state machine */
113 struct bfa_s *bfa; /* BFA module */ 150 struct bfa_s *bfa; /* BFA module */
114 struct bfa_fcpim_mod_s *fcpim; /* parent fcpim module */ 151 struct bfa_fcpim_s *fcpim; /* parent fcpim module */
115 struct bfa_itnim_s *itnim; /* i-t-n nexus for this IO */ 152 struct bfa_itnim_s *itnim; /* i-t-n nexus for this IO */
116 struct bfad_ioim_s *dio; /* driver IO handle */ 153 struct bfad_ioim_s *dio; /* driver IO handle */
117 u16 iotag; /* FWI IO tag */ 154 u16 iotag; /* FWI IO tag */
@@ -129,7 +166,6 @@ struct bfa_ioim_s {
129 166
130struct bfa_ioim_sp_s { 167struct bfa_ioim_sp_s {
131 struct bfi_msg_s comp_rspmsg; /* IO comp f/w response */ 168 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 */ 169 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 */ 170 struct bfa_reqq_wait_s reqq_wait; /* to wait for room in reqq */
135 bfa_boolean_t abort_explicit; /* aborted by OS */ 171 bfa_boolean_t abort_explicit; /* aborted by OS */
@@ -143,7 +179,7 @@ struct bfa_tskim_s {
143 struct list_head qe; 179 struct list_head qe;
144 bfa_sm_t sm; 180 bfa_sm_t sm;
145 struct bfa_s *bfa; /* BFA module */ 181 struct bfa_s *bfa; /* BFA module */
146 struct bfa_fcpim_mod_s *fcpim; /* parent fcpim module */ 182 struct bfa_fcpim_s *fcpim; /* parent fcpim module */
147 struct bfa_itnim_s *itnim; /* i-t-n nexus for this IO */ 183 struct bfa_itnim_s *itnim; /* i-t-n nexus for this IO */
148 struct bfad_tskim_s *dtsk; /* driver task mgmt cmnd */ 184 struct bfad_tskim_s *dtsk; /* driver task mgmt cmnd */
149 bfa_boolean_t notify; /* notify itnim on TM comp */ 185 bfa_boolean_t notify; /* notify itnim on TM comp */
@@ -182,13 +218,13 @@ struct bfa_itnim_s {
182 struct bfa_wc_s wc; /* waiting counter */ 218 struct bfa_wc_s wc; /* waiting counter */
183 struct bfa_timer_s timer; /* pending IO TOV */ 219 struct bfa_timer_s timer; /* pending IO TOV */
184 struct bfa_reqq_wait_s reqq_wait; /* to wait for room in reqq */ 220 struct bfa_reqq_wait_s reqq_wait; /* to wait for room in reqq */
185 struct bfa_fcpim_mod_s *fcpim; /* fcpim module */ 221 struct bfa_fcpim_s *fcpim; /* fcpim module */
186 struct bfa_itnim_iostats_s stats; 222 struct bfa_itnim_iostats_s stats;
187 struct bfa_itnim_ioprofile_s ioprofile; 223 struct bfa_itnim_ioprofile_s ioprofile;
188}; 224};
189 225
190#define bfa_itnim_is_online(_itnim) ((_itnim)->is_online) 226#define bfa_itnim_is_online(_itnim) ((_itnim)->is_online)
191#define BFA_FCPIM_MOD(_hal) (&(_hal)->modules.fcpim_mod) 227#define BFA_FCPIM(_hal) (&(_hal)->modules.fcp_mod.fcpim)
192#define BFA_IOIM_TAG_2_ID(_iotag) ((_iotag) & BFA_IOIM_IOTAG_MASK) 228#define BFA_IOIM_TAG_2_ID(_iotag) ((_iotag) & BFA_IOIM_IOTAG_MASK)
193#define BFA_IOIM_FROM_TAG(_fcpim, _iotag) \ 229#define BFA_IOIM_FROM_TAG(_fcpim, _iotag) \
194 (&fcpim->ioim_arr[(_iotag & BFA_IOIM_IOTAG_MASK)]) 230 (&fcpim->ioim_arr[(_iotag & BFA_IOIM_IOTAG_MASK)])
@@ -196,9 +232,9 @@ struct bfa_itnim_s {
196 (&fcpim->tskim_arr[_tmtag & (fcpim->num_tskim_reqs - 1)]) 232 (&fcpim->tskim_arr[_tmtag & (fcpim->num_tskim_reqs - 1)])
197 233
198#define bfa_io_profile_start_time(_bfa) \ 234#define bfa_io_profile_start_time(_bfa) \
199 (_bfa->modules.fcpim_mod.io_profile_start_time) 235 ((_bfa)->modules.fcp_mod.fcpim.io_profile_start_time)
200#define bfa_fcpim_get_io_profile(_bfa) \ 236#define bfa_fcpim_get_io_profile(_bfa) \
201 (_bfa->modules.fcpim_mod.io_profile) 237 ((_bfa)->modules.fcp_mod.fcpim.io_profile)
202#define bfa_ioim_update_iotag(__ioim) do { \ 238#define bfa_ioim_update_iotag(__ioim) do { \
203 uint16_t k = (__ioim)->iotag >> BFA_IOIM_RETRY_TAG_OFFSET; \ 239 uint16_t k = (__ioim)->iotag >> BFA_IOIM_RETRY_TAG_OFFSET; \
204 k++; (__ioim)->iotag &= BFA_IOIM_IOTAG_MASK; \ 240 k++; (__ioim)->iotag &= BFA_IOIM_IOTAG_MASK; \
@@ -217,7 +253,7 @@ bfa_ioim_maxretry_reached(struct bfa_ioim_s *ioim)
217/* 253/*
218 * function prototypes 254 * function prototypes
219 */ 255 */
220void bfa_ioim_attach(struct bfa_fcpim_mod_s *fcpim, 256void bfa_ioim_attach(struct bfa_fcpim_s *fcpim,
221 struct bfa_meminfo_s *minfo); 257 struct bfa_meminfo_s *minfo);
222void bfa_ioim_isr(struct bfa_s *bfa, struct bfi_msg_s *msg); 258void bfa_ioim_isr(struct bfa_s *bfa, struct bfi_msg_s *msg);
223void bfa_ioim_good_comp_isr(struct bfa_s *bfa, 259void bfa_ioim_good_comp_isr(struct bfa_s *bfa,
@@ -228,7 +264,7 @@ void bfa_ioim_cleanup_tm(struct bfa_ioim_s *ioim,
228void bfa_ioim_iocdisable(struct bfa_ioim_s *ioim); 264void bfa_ioim_iocdisable(struct bfa_ioim_s *ioim);
229void bfa_ioim_tov(struct bfa_ioim_s *ioim); 265void bfa_ioim_tov(struct bfa_ioim_s *ioim);
230 266
231void bfa_tskim_attach(struct bfa_fcpim_mod_s *fcpim, 267void bfa_tskim_attach(struct bfa_fcpim_s *fcpim,
232 struct bfa_meminfo_s *minfo); 268 struct bfa_meminfo_s *minfo);
233void bfa_tskim_isr(struct bfa_s *bfa, struct bfi_msg_s *msg); 269void bfa_tskim_isr(struct bfa_s *bfa, struct bfi_msg_s *msg);
234void bfa_tskim_iodone(struct bfa_tskim_s *tskim); 270void bfa_tskim_iodone(struct bfa_tskim_s *tskim);
@@ -237,9 +273,8 @@ void bfa_tskim_cleanup(struct bfa_tskim_s *tskim);
237 273
238void bfa_itnim_meminfo(struct bfa_iocfc_cfg_s *cfg, u32 *km_len, 274void bfa_itnim_meminfo(struct bfa_iocfc_cfg_s *cfg, u32 *km_len,
239 u32 *dm_len); 275 u32 *dm_len);
240void bfa_itnim_attach(struct bfa_fcpim_mod_s *fcpim, 276void bfa_itnim_attach(struct bfa_fcpim_s *fcpim,
241 struct bfa_meminfo_s *minfo); 277 struct bfa_meminfo_s *minfo);
242void bfa_itnim_detach(struct bfa_fcpim_mod_s *fcpim);
243void bfa_itnim_iocdisable(struct bfa_itnim_s *itnim); 278void bfa_itnim_iocdisable(struct bfa_itnim_s *itnim);
244void bfa_itnim_isr(struct bfa_s *bfa, struct bfi_msg_s *msg); 279void bfa_itnim_isr(struct bfa_s *bfa, struct bfi_msg_s *msg);
245void bfa_itnim_iodone(struct bfa_itnim_s *itnim); 280void bfa_itnim_iodone(struct bfa_itnim_s *itnim);
@@ -254,11 +289,11 @@ u16 bfa_fcpim_path_tov_get(struct bfa_s *bfa);
254u16 bfa_fcpim_qdepth_get(struct bfa_s *bfa); 289u16 bfa_fcpim_qdepth_get(struct bfa_s *bfa);
255 290
256#define bfa_fcpim_ioredirect_enabled(__bfa) \ 291#define bfa_fcpim_ioredirect_enabled(__bfa) \
257 (((struct bfa_fcpim_mod_s *)(BFA_FCPIM_MOD(__bfa)))->ioredirect) 292 (((struct bfa_fcpim_s *)(BFA_FCPIM(__bfa)))->ioredirect)
258 293
259#define bfa_fcpim_get_next_reqq(__bfa, __qid) \ 294#define bfa_fcpim_get_next_reqq(__bfa, __qid) \
260{ \ 295{ \
261 struct bfa_fcpim_mod_s *__fcpim = BFA_FCPIM_MOD(__bfa); \ 296 struct bfa_fcpim_s *__fcpim = BFA_FCPIM(__bfa); \
262 __fcpim->reqq++; \ 297 __fcpim->reqq++; \
263 __fcpim->reqq &= (BFI_IOC_MAX_CQS - 1); \ 298 __fcpim->reqq &= (BFI_IOC_MAX_CQS - 1); \
264 *(__qid) = __fcpim->reqq; \ 299 *(__qid) = __fcpim->reqq; \
diff --git a/drivers/scsi/bfa/bfa_modules.h b/drivers/scsi/bfa/bfa_modules.h
index 4b67ea2ea407..0fc23f645057 100644
--- a/drivers/scsi/bfa/bfa_modules.h
+++ b/drivers/scsi/bfa/bfa_modules.h
@@ -34,7 +34,7 @@ struct bfa_modules_s {
34 struct bfa_lps_mod_s lps_mod; /* fcxp module */ 34 struct bfa_lps_mod_s lps_mod; /* fcxp module */
35 struct bfa_uf_mod_s uf_mod; /* unsolicited frame module */ 35 struct bfa_uf_mod_s uf_mod; /* unsolicited frame module */
36 struct bfa_rport_mod_s rport_mod; /* remote port module */ 36 struct bfa_rport_mod_s rport_mod; /* remote port module */
37 struct bfa_fcpim_mod_s fcpim_mod; /* FCP initiator module */ 37 struct bfa_fcp_mod_s fcp_mod; /* FCP initiator module */
38 struct bfa_sgpg_mod_s sgpg_mod; /* SG page module */ 38 struct bfa_sgpg_mod_s sgpg_mod; /* SG page module */
39 struct bfa_port_s port; /* Physical port module */ 39 struct bfa_port_s port; /* Physical port module */
40}; 40};
@@ -51,7 +51,6 @@ enum {
51 BFA_TRC_HAL_IOCFC_CB = 5, 51 BFA_TRC_HAL_IOCFC_CB = 5,
52}; 52};
53 53
54
55/* 54/*
56 * Macro to define a new BFA module 55 * Macro to define a new BFA module
57 */ 56 */
@@ -122,6 +121,6 @@ extern struct bfa_module_s hal_mod_fcxp;
122extern struct bfa_module_s hal_mod_lps; 121extern struct bfa_module_s hal_mod_lps;
123extern struct bfa_module_s hal_mod_uf; 122extern struct bfa_module_s hal_mod_uf;
124extern struct bfa_module_s hal_mod_rport; 123extern struct bfa_module_s hal_mod_rport;
125extern struct bfa_module_s hal_mod_fcpim; 124extern struct bfa_module_s hal_mod_fcp;
126 125
127#endif /* __BFA_MODULES_H__ */ 126#endif /* __BFA_MODULES_H__ */
diff --git a/drivers/scsi/bfa/bfi_ms.h b/drivers/scsi/bfa/bfi_ms.h
index edb92561dde9..263631dcfa7c 100644
--- a/drivers/scsi/bfa/bfi_ms.h
+++ b/drivers/scsi/bfa/bfi_ms.h
@@ -40,6 +40,9 @@ struct bfi_iocfc_cfg_s {
40 u8 sense_buf_len; /* SCSI sense length */ 40 u8 sense_buf_len; /* SCSI sense length */
41 u16 rsvd_1; 41 u16 rsvd_1;
42 u32 endian_sig; /* endian signature of host */ 42 u32 endian_sig; /* endian signature of host */
43 __be16 num_ioim_reqs;
44 __be16 num_fwtio_reqs;
45 u8 rsvd[4];
43 46
44 /* 47 /*
45 * Request and response circular queue base addresses, size and 48 * Request and response circular queue base addresses, size and