aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/bfa/bfa_fcpim.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/bfa/bfa_fcpim.c')
-rw-r--r--drivers/scsi/bfa/bfa_fcpim.c340
1 files changed, 46 insertions, 294 deletions
diff --git a/drivers/scsi/bfa/bfa_fcpim.c b/drivers/scsi/bfa/bfa_fcpim.c
index 506f1d326e5..314c9312298 100644
--- a/drivers/scsi/bfa/bfa_fcpim.c
+++ b/drivers/scsi/bfa/bfa_fcpim.c
@@ -21,11 +21,6 @@
21BFA_TRC_FILE(HAL, FCPIM); 21BFA_TRC_FILE(HAL, FCPIM);
22BFA_MODULE(fcpim); 22BFA_MODULE(fcpim);
23 23
24
25#define bfa_fcpim_add_iostats(__l, __r, __stats) \
26 (__l->__stats += __r->__stats)
27
28
29/* 24/*
30 * BFA ITNIM Related definitions 25 * BFA ITNIM Related definitions
31 */ 26 */
@@ -73,10 +68,8 @@ static void bfa_itnim_update_del_itn_stats(struct bfa_itnim_s *itnim);
73} while (0) 68} while (0)
74 69
75/* 70/*
76 * bfa_itnim_sm BFA itnim state machine 71 * itnim state machine event
77 */ 72 */
78
79
80enum bfa_itnim_event { 73enum bfa_itnim_event {
81 BFA_ITNIM_SM_CREATE = 1, /* itnim is created */ 74 BFA_ITNIM_SM_CREATE = 1, /* itnim is created */
82 BFA_ITNIM_SM_ONLINE = 2, /* itnim is online */ 75 BFA_ITNIM_SM_ONLINE = 2, /* itnim is online */
@@ -228,7 +221,6 @@ static void __bfa_cb_ioim_failed(void *cbarg, bfa_boolean_t complete);
228static void __bfa_cb_ioim_pathtov(void *cbarg, bfa_boolean_t complete); 221static void __bfa_cb_ioim_pathtov(void *cbarg, bfa_boolean_t complete);
229static bfa_boolean_t bfa_ioim_is_abortable(struct bfa_ioim_s *ioim); 222static bfa_boolean_t bfa_ioim_is_abortable(struct bfa_ioim_s *ioim);
230 223
231
232/* 224/*
233 * forward declaration of BFA IO state machine 225 * forward declaration of BFA IO state machine
234 */ 226 */
@@ -256,7 +248,6 @@ static void bfa_ioim_sm_resfree(struct bfa_ioim_s *ioim,
256 enum bfa_ioim_event event); 248 enum bfa_ioim_event event);
257static void bfa_ioim_sm_cmnd_retry(struct bfa_ioim_s *ioim, 249static void bfa_ioim_sm_cmnd_retry(struct bfa_ioim_s *ioim,
258 enum bfa_ioim_event event); 250 enum bfa_ioim_event event);
259
260/* 251/*
261 * forward declaration for BFA TSKIM functions 252 * forward declaration for BFA TSKIM functions
262 */ 253 */
@@ -271,7 +262,6 @@ static bfa_boolean_t bfa_tskim_send(struct bfa_tskim_s *tskim);
271static bfa_boolean_t bfa_tskim_send_abort(struct bfa_tskim_s *tskim); 262static bfa_boolean_t bfa_tskim_send_abort(struct bfa_tskim_s *tskim);
272static void bfa_tskim_iocdisable_ios(struct bfa_tskim_s *tskim); 263static void bfa_tskim_iocdisable_ios(struct bfa_tskim_s *tskim);
273 264
274
275/* 265/*
276 * forward declaration of BFA TSKIM state machine 266 * forward declaration of BFA TSKIM state machine
277 */ 267 */
@@ -289,13 +279,12 @@ static void bfa_tskim_sm_cleanup_qfull(struct bfa_tskim_s *tskim,
289 enum bfa_tskim_event event); 279 enum bfa_tskim_event event);
290static void bfa_tskim_sm_hcb(struct bfa_tskim_s *tskim, 280static void bfa_tskim_sm_hcb(struct bfa_tskim_s *tskim,
291 enum bfa_tskim_event event); 281 enum bfa_tskim_event event);
292
293/* 282/*
294 * BFA FCP Initiator Mode module 283 * BFA FCP Initiator Mode module
295 */ 284 */
296 285
297/* 286/*
298 * Compute and return memory needed by FCP(im) module. 287 * Compute and return memory needed by FCP(im) module.
299 */ 288 */
300static void 289static void
301bfa_fcpim_meminfo(struct bfa_iocfc_cfg_s *cfg, u32 *km_len, 290bfa_fcpim_meminfo(struct bfa_iocfc_cfg_s *cfg, u32 *km_len,
@@ -379,56 +368,6 @@ bfa_fcpim_iocdisable(struct bfa_s *bfa)
379} 368}
380 369
381void 370void
382bfa_fcpim_add_stats(struct bfa_itnim_iostats_s *lstats,
383 struct bfa_itnim_iostats_s *rstats)
384{
385 bfa_fcpim_add_iostats(lstats, rstats, total_ios);
386 bfa_fcpim_add_iostats(lstats, rstats, qresumes);
387 bfa_fcpim_add_iostats(lstats, rstats, no_iotags);
388 bfa_fcpim_add_iostats(lstats, rstats, io_aborts);
389 bfa_fcpim_add_iostats(lstats, rstats, no_tskims);
390 bfa_fcpim_add_iostats(lstats, rstats, iocomp_ok);
391 bfa_fcpim_add_iostats(lstats, rstats, iocomp_underrun);
392 bfa_fcpim_add_iostats(lstats, rstats, iocomp_overrun);
393 bfa_fcpim_add_iostats(lstats, rstats, iocomp_aborted);
394 bfa_fcpim_add_iostats(lstats, rstats, iocomp_timedout);
395 bfa_fcpim_add_iostats(lstats, rstats, iocom_nexus_abort);
396 bfa_fcpim_add_iostats(lstats, rstats, iocom_proto_err);
397 bfa_fcpim_add_iostats(lstats, rstats, iocom_dif_err);
398 bfa_fcpim_add_iostats(lstats, rstats, iocom_sqer_needed);
399 bfa_fcpim_add_iostats(lstats, rstats, iocom_res_free);
400 bfa_fcpim_add_iostats(lstats, rstats, iocom_hostabrts);
401 bfa_fcpim_add_iostats(lstats, rstats, iocom_utags);
402 bfa_fcpim_add_iostats(lstats, rstats, io_cleanups);
403 bfa_fcpim_add_iostats(lstats, rstats, io_tmaborts);
404 bfa_fcpim_add_iostats(lstats, rstats, onlines);
405 bfa_fcpim_add_iostats(lstats, rstats, offlines);
406 bfa_fcpim_add_iostats(lstats, rstats, creates);
407 bfa_fcpim_add_iostats(lstats, rstats, deletes);
408 bfa_fcpim_add_iostats(lstats, rstats, create_comps);
409 bfa_fcpim_add_iostats(lstats, rstats, delete_comps);
410 bfa_fcpim_add_iostats(lstats, rstats, sler_events);
411 bfa_fcpim_add_iostats(lstats, rstats, fw_create);
412 bfa_fcpim_add_iostats(lstats, rstats, fw_delete);
413 bfa_fcpim_add_iostats(lstats, rstats, ioc_disabled);
414 bfa_fcpim_add_iostats(lstats, rstats, cleanup_comps);
415 bfa_fcpim_add_iostats(lstats, rstats, tm_cmnds);
416 bfa_fcpim_add_iostats(lstats, rstats, tm_fw_rsps);
417 bfa_fcpim_add_iostats(lstats, rstats, tm_success);
418 bfa_fcpim_add_iostats(lstats, rstats, tm_failures);
419 bfa_fcpim_add_iostats(lstats, rstats, tm_io_comps);
420 bfa_fcpim_add_iostats(lstats, rstats, tm_qresumes);
421 bfa_fcpim_add_iostats(lstats, rstats, tm_iocdowns);
422 bfa_fcpim_add_iostats(lstats, rstats, tm_cleanups);
423 bfa_fcpim_add_iostats(lstats, rstats, tm_cleanup_comps);
424 bfa_fcpim_add_iostats(lstats, rstats, io_comps);
425 bfa_fcpim_add_iostats(lstats, rstats, input_reqs);
426 bfa_fcpim_add_iostats(lstats, rstats, output_reqs);
427 bfa_fcpim_add_iostats(lstats, rstats, rd_throughput);
428 bfa_fcpim_add_iostats(lstats, rstats, wr_throughput);
429}
430
431void
432bfa_fcpim_path_tov_set(struct bfa_s *bfa, u16 path_tov) 371bfa_fcpim_path_tov_set(struct bfa_s *bfa, u16 path_tov)
433{ 372{
434 struct bfa_fcpim_mod_s *fcpim = BFA_FCPIM_MOD(bfa); 373 struct bfa_fcpim_mod_s *fcpim = BFA_FCPIM_MOD(bfa);
@@ -446,128 +385,6 @@ bfa_fcpim_path_tov_get(struct bfa_s *bfa)
446 return fcpim->path_tov / 1000; 385 return fcpim->path_tov / 1000;
447} 386}
448 387
449bfa_status_t
450bfa_fcpim_port_iostats(struct bfa_s *bfa, struct bfa_itnim_iostats_s *stats,
451 u8 lp_tag)
452{
453 struct bfa_fcpim_mod_s *fcpim = BFA_FCPIM_MOD(bfa);
454 struct list_head *qe, *qen;
455 struct bfa_itnim_s *itnim;
456
457 /* accumulate IO stats from itnim */
458 memset(stats, 0, sizeof(struct bfa_itnim_iostats_s));
459 list_for_each_safe(qe, qen, &fcpim->itnim_q) {
460 itnim = (struct bfa_itnim_s *) qe;
461 if (itnim->rport->rport_info.lp_tag != lp_tag)
462 continue;
463 bfa_fcpim_add_stats(stats, &(itnim->stats));
464 }
465 return BFA_STATUS_OK;
466}
467bfa_status_t
468bfa_fcpim_get_modstats(struct bfa_s *bfa, struct bfa_itnim_iostats_s *modstats)
469{
470 struct bfa_fcpim_mod_s *fcpim = BFA_FCPIM_MOD(bfa);
471 struct list_head *qe, *qen;
472 struct bfa_itnim_s *itnim;
473
474 /* accumulate IO stats from itnim */
475 memset(modstats, 0, sizeof(struct bfa_itnim_iostats_s));
476 list_for_each_safe(qe, qen, &fcpim->itnim_q) {
477 itnim = (struct bfa_itnim_s *) qe;
478 bfa_fcpim_add_stats(modstats, &(itnim->stats));
479 }
480 return BFA_STATUS_OK;
481}
482
483bfa_status_t
484bfa_fcpim_get_del_itn_stats(struct bfa_s *bfa,
485 struct bfa_fcpim_del_itn_stats_s *modstats)
486{
487 struct bfa_fcpim_mod_s *fcpim = BFA_FCPIM_MOD(bfa);
488
489 *modstats = fcpim->del_itn_stats;
490
491 return BFA_STATUS_OK;
492}
493
494
495bfa_status_t
496bfa_fcpim_profile_on(struct bfa_s *bfa, u32 time)
497{
498 struct bfa_itnim_s *itnim;
499 struct bfa_fcpim_mod_s *fcpim = BFA_FCPIM_MOD(bfa);
500 struct list_head *qe, *qen;
501
502 /* accumulate IO stats from itnim */
503 list_for_each_safe(qe, qen, &fcpim->itnim_q) {
504 itnim = (struct bfa_itnim_s *) qe;
505 bfa_itnim_clear_stats(itnim);
506 }
507 fcpim->io_profile = BFA_TRUE;
508 fcpim->io_profile_start_time = time;
509 fcpim->profile_comp = bfa_ioim_profile_comp;
510 fcpim->profile_start = bfa_ioim_profile_start;
511
512 return BFA_STATUS_OK;
513}
514bfa_status_t
515bfa_fcpim_profile_off(struct bfa_s *bfa)
516{
517 struct bfa_fcpim_mod_s *fcpim = BFA_FCPIM_MOD(bfa);
518 fcpim->io_profile = BFA_FALSE;
519 fcpim->io_profile_start_time = 0;
520 fcpim->profile_comp = NULL;
521 fcpim->profile_start = NULL;
522 return BFA_STATUS_OK;
523}
524
525bfa_status_t
526bfa_fcpim_port_clear_iostats(struct bfa_s *bfa, u8 lp_tag)
527{
528 struct bfa_fcpim_mod_s *fcpim = BFA_FCPIM_MOD(bfa);
529 struct list_head *qe, *qen;
530 struct bfa_itnim_s *itnim;
531
532 /* clear IO stats from all active itnims */
533 list_for_each_safe(qe, qen, &fcpim->itnim_q) {
534 itnim = (struct bfa_itnim_s *) qe;
535 if (itnim->rport->rport_info.lp_tag != lp_tag)
536 continue;
537 bfa_itnim_clear_stats(itnim);
538 }
539 return BFA_STATUS_OK;
540
541}
542
543bfa_status_t
544bfa_fcpim_clr_modstats(struct bfa_s *bfa)
545{
546 struct bfa_fcpim_mod_s *fcpim = BFA_FCPIM_MOD(bfa);
547 struct list_head *qe, *qen;
548 struct bfa_itnim_s *itnim;
549
550 /* clear IO stats from all active itnims */
551 list_for_each_safe(qe, qen, &fcpim->itnim_q) {
552 itnim = (struct bfa_itnim_s *) qe;
553 bfa_itnim_clear_stats(itnim);
554 }
555 memset(&fcpim->del_itn_stats, 0,
556 sizeof(struct bfa_fcpim_del_itn_stats_s));
557
558 return BFA_STATUS_OK;
559}
560
561void
562bfa_fcpim_qdepth_set(struct bfa_s *bfa, u16 q_depth)
563{
564 struct bfa_fcpim_mod_s *fcpim = BFA_FCPIM_MOD(bfa);
565
566 bfa_assert(q_depth <= BFA_IOCFC_QDEPTH_MAX);
567
568 fcpim->q_depth = q_depth;
569}
570
571u16 388u16
572bfa_fcpim_qdepth_get(struct bfa_s *bfa) 389bfa_fcpim_qdepth_get(struct bfa_s *bfa)
573{ 390{
@@ -576,32 +393,12 @@ bfa_fcpim_qdepth_get(struct bfa_s *bfa)
576 return fcpim->q_depth; 393 return fcpim->q_depth;
577} 394}
578 395
579void
580bfa_fcpim_update_ioredirect(struct bfa_s *bfa)
581{
582 bfa_boolean_t ioredirect;
583
584 /*
585 * IO redirection is turned off when QoS is enabled and vice versa
586 */
587 ioredirect = bfa_fcport_is_qos_enabled(bfa) ? BFA_FALSE : BFA_TRUE;
588}
589
590void
591bfa_fcpim_set_ioredirect(struct bfa_s *bfa, bfa_boolean_t state)
592{
593 struct bfa_fcpim_mod_s *fcpim = BFA_FCPIM_MOD(bfa);
594 fcpim->ioredirect = state;
595}
596
597
598
599/* 396/*
600 * BFA ITNIM module state machine functions 397 * BFA ITNIM module state machine functions
601 */ 398 */
602 399
603/* 400/*
604 * Beginning/unallocated state - no events expected. 401 * Beginning/unallocated state - no events expected.
605 */ 402 */
606static void 403static void
607bfa_itnim_sm_uninit(struct bfa_itnim_s *itnim, enum bfa_itnim_event event) 404bfa_itnim_sm_uninit(struct bfa_itnim_s *itnim, enum bfa_itnim_event event)
@@ -622,7 +419,7 @@ bfa_itnim_sm_uninit(struct bfa_itnim_s *itnim, enum bfa_itnim_event event)
622} 419}
623 420
624/* 421/*
625 * Beginning state, only online event expected. 422 * Beginning state, only online event expected.
626 */ 423 */
627static void 424static void
628bfa_itnim_sm_created(struct bfa_itnim_s *itnim, enum bfa_itnim_event event) 425bfa_itnim_sm_created(struct bfa_itnim_s *itnim, enum bfa_itnim_event event)
@@ -725,7 +522,7 @@ bfa_itnim_sm_fwcreate_qfull(struct bfa_itnim_s *itnim,
725} 522}
726 523
727/* 524/*
728 * Waiting for itnim create response from firmware, a delete is pending. 525 * Waiting for itnim create response from firmware, a delete is pending.
729 */ 526 */
730static void 527static void
731bfa_itnim_sm_delete_pending(struct bfa_itnim_s *itnim, 528bfa_itnim_sm_delete_pending(struct bfa_itnim_s *itnim,
@@ -753,7 +550,7 @@ bfa_itnim_sm_delete_pending(struct bfa_itnim_s *itnim,
753} 550}
754 551
755/* 552/*
756 * Online state - normal parking state. 553 * Online state - normal parking state.
757 */ 554 */
758static void 555static void
759bfa_itnim_sm_online(struct bfa_itnim_s *itnim, enum bfa_itnim_event event) 556bfa_itnim_sm_online(struct bfa_itnim_s *itnim, enum bfa_itnim_event event)
@@ -795,7 +592,7 @@ bfa_itnim_sm_online(struct bfa_itnim_s *itnim, enum bfa_itnim_event event)
795} 592}
796 593
797/* 594/*
798 * Second level error recovery need. 595 * Second level error recovery need.
799 */ 596 */
800static void 597static void
801bfa_itnim_sm_sler(struct bfa_itnim_s *itnim, enum bfa_itnim_event event) 598bfa_itnim_sm_sler(struct bfa_itnim_s *itnim, enum bfa_itnim_event event)
@@ -826,7 +623,7 @@ bfa_itnim_sm_sler(struct bfa_itnim_s *itnim, enum bfa_itnim_event event)
826} 623}
827 624
828/* 625/*
829 * Going offline. Waiting for active IO cleanup. 626 * Going offline. Waiting for active IO cleanup.
830 */ 627 */
831static void 628static void
832bfa_itnim_sm_cleanup_offline(struct bfa_itnim_s *itnim, 629bfa_itnim_sm_cleanup_offline(struct bfa_itnim_s *itnim,
@@ -863,7 +660,7 @@ bfa_itnim_sm_cleanup_offline(struct bfa_itnim_s *itnim,
863} 660}
864 661
865/* 662/*
866 * Deleting itnim. Waiting for active IO cleanup. 663 * Deleting itnim. Waiting for active IO cleanup.
867 */ 664 */
868static void 665static void
869bfa_itnim_sm_cleanup_delete(struct bfa_itnim_s *itnim, 666bfa_itnim_sm_cleanup_delete(struct bfa_itnim_s *itnim,
@@ -948,7 +745,7 @@ bfa_itnim_sm_fwdelete_qfull(struct bfa_itnim_s *itnim,
948} 745}
949 746
950/* 747/*
951 * Offline state. 748 * Offline state.
952 */ 749 */
953static void 750static void
954bfa_itnim_sm_offline(struct bfa_itnim_s *itnim, enum bfa_itnim_event event) 751bfa_itnim_sm_offline(struct bfa_itnim_s *itnim, enum bfa_itnim_event event)
@@ -979,9 +776,6 @@ bfa_itnim_sm_offline(struct bfa_itnim_s *itnim, enum bfa_itnim_event event)
979 } 776 }
980} 777}
981 778
982/*
983 * IOC h/w failed state.
984 */
985static void 779static void
986bfa_itnim_sm_iocdisable(struct bfa_itnim_s *itnim, 780bfa_itnim_sm_iocdisable(struct bfa_itnim_s *itnim,
987 enum bfa_itnim_event event) 781 enum bfa_itnim_event event)
@@ -1016,7 +810,7 @@ bfa_itnim_sm_iocdisable(struct bfa_itnim_s *itnim,
1016} 810}
1017 811
1018/* 812/*
1019 * Itnim is deleted, waiting for firmware response to delete. 813 * Itnim is deleted, waiting for firmware response to delete.
1020 */ 814 */
1021static void 815static void
1022bfa_itnim_sm_deleting(struct bfa_itnim_s *itnim, enum bfa_itnim_event event) 816bfa_itnim_sm_deleting(struct bfa_itnim_s *itnim, enum bfa_itnim_event event)
@@ -1061,7 +855,7 @@ bfa_itnim_sm_deleting_qfull(struct bfa_itnim_s *itnim,
1061} 855}
1062 856
1063/* 857/*
1064 * Initiate cleanup of all IOs on an IOC failure. 858 * Initiate cleanup of all IOs on an IOC failure.
1065 */ 859 */
1066static void 860static void
1067bfa_itnim_iocdisable_cleanup(struct bfa_itnim_s *itnim) 861bfa_itnim_iocdisable_cleanup(struct bfa_itnim_s *itnim)
@@ -1095,7 +889,7 @@ bfa_itnim_iocdisable_cleanup(struct bfa_itnim_s *itnim)
1095} 889}
1096 890
1097/* 891/*
1098 * IO cleanup completion 892 * IO cleanup completion
1099 */ 893 */
1100static void 894static void
1101bfa_itnim_cleanp_comp(void *itnim_cbarg) 895bfa_itnim_cleanp_comp(void *itnim_cbarg)
@@ -1107,7 +901,7 @@ bfa_itnim_cleanp_comp(void *itnim_cbarg)
1107} 901}
1108 902
1109/* 903/*
1110 * Initiate cleanup of all IOs. 904 * Initiate cleanup of all IOs.
1111 */ 905 */
1112static void 906static void
1113bfa_itnim_cleanup(struct bfa_itnim_s *itnim) 907bfa_itnim_cleanup(struct bfa_itnim_s *itnim)
@@ -1179,9 +973,6 @@ bfa_itnim_qresume(void *cbarg)
1179 bfa_sm_send_event(itnim, BFA_ITNIM_SM_QRESUME); 973 bfa_sm_send_event(itnim, BFA_ITNIM_SM_QRESUME);
1180} 974}
1181 975
1182
1183
1184
1185/* 976/*
1186 * bfa_itnim_public 977 * bfa_itnim_public
1187 */ 978 */
@@ -1449,14 +1240,12 @@ bfa_itnim_update_del_itn_stats(struct bfa_itnim_s *itnim)
1449 fcpim->del_itn_stats.del_tm_iocdowns += itnim->stats.tm_iocdowns; 1240 fcpim->del_itn_stats.del_tm_iocdowns += itnim->stats.tm_iocdowns;
1450} 1241}
1451 1242
1452
1453
1454/* 1243/*
1455 * bfa_itnim_public 1244 * bfa_itnim_public
1456 */ 1245 */
1457 1246
1458/* 1247/*
1459 * Itnim interrupt processing. 1248 * Itnim interrupt processing.
1460 */ 1249 */
1461void 1250void
1462bfa_itnim_isr(struct bfa_s *bfa, struct bfi_msg_s *m) 1251bfa_itnim_isr(struct bfa_s *bfa, struct bfi_msg_s *m)
@@ -1499,10 +1288,8 @@ bfa_itnim_isr(struct bfa_s *bfa, struct bfi_msg_s *m)
1499 } 1288 }
1500} 1289}
1501 1290
1502
1503
1504/* 1291/*
1505 * bfa_itnim_api 1292 * bfa_itnim_api
1506 */ 1293 */
1507 1294
1508struct bfa_itnim_s * 1295struct bfa_itnim_s *
@@ -1575,7 +1362,7 @@ bfa_itnim_clear_stats(struct bfa_itnim_s *itnim)
1575 */ 1362 */
1576 1363
1577/* 1364/*
1578 * IO is not started (unallocated). 1365 * IO is not started (unallocated).
1579 */ 1366 */
1580static void 1367static void
1581bfa_ioim_sm_uninit(struct bfa_ioim_s *ioim, enum bfa_ioim_event event) 1368bfa_ioim_sm_uninit(struct bfa_ioim_s *ioim, enum bfa_ioim_event event)
@@ -1640,7 +1427,7 @@ bfa_ioim_sm_uninit(struct bfa_ioim_s *ioim, enum bfa_ioim_event event)
1640} 1427}
1641 1428
1642/* 1429/*
1643 * IO is waiting for SG pages. 1430 * IO is waiting for SG pages.
1644 */ 1431 */
1645static void 1432static void
1646bfa_ioim_sm_sgalloc(struct bfa_ioim_s *ioim, enum bfa_ioim_event event) 1433bfa_ioim_sm_sgalloc(struct bfa_ioim_s *ioim, enum bfa_ioim_event event)
@@ -1687,7 +1474,7 @@ bfa_ioim_sm_sgalloc(struct bfa_ioim_s *ioim, enum bfa_ioim_event event)
1687} 1474}
1688 1475
1689/* 1476/*
1690 * IO is active. 1477 * IO is active.
1691 */ 1478 */
1692static void 1479static void
1693bfa_ioim_sm_active(struct bfa_ioim_s *ioim, enum bfa_ioim_event event) 1480bfa_ioim_sm_active(struct bfa_ioim_s *ioim, enum bfa_ioim_event event)
@@ -1771,8 +1558,8 @@ bfa_ioim_sm_active(struct bfa_ioim_s *ioim, enum bfa_ioim_event event)
1771} 1558}
1772 1559
1773/* 1560/*
1774* IO is retried with new tag. 1561 * IO is retried with new tag.
1775*/ 1562 */
1776static void 1563static void
1777bfa_ioim_sm_cmnd_retry(struct bfa_ioim_s *ioim, enum bfa_ioim_event event) 1564bfa_ioim_sm_cmnd_retry(struct bfa_ioim_s *ioim, enum bfa_ioim_event event)
1778{ 1565{
@@ -1825,7 +1612,7 @@ bfa_ioim_sm_cmnd_retry(struct bfa_ioim_s *ioim, enum bfa_ioim_event event)
1825} 1612}
1826 1613
1827/* 1614/*
1828 * IO is being aborted, waiting for completion from firmware. 1615 * IO is being aborted, waiting for completion from firmware.
1829 */ 1616 */
1830static void 1617static void
1831bfa_ioim_sm_abort(struct bfa_ioim_s *ioim, enum bfa_ioim_event event) 1618bfa_ioim_sm_abort(struct bfa_ioim_s *ioim, enum bfa_ioim_event event)
@@ -1948,7 +1735,7 @@ bfa_ioim_sm_cleanup(struct bfa_ioim_s *ioim, enum bfa_ioim_event event)
1948} 1735}
1949 1736
1950/* 1737/*
1951 * IO is waiting for room in request CQ 1738 * IO is waiting for room in request CQ
1952 */ 1739 */
1953static void 1740static void
1954bfa_ioim_sm_qfull(struct bfa_ioim_s *ioim, enum bfa_ioim_event event) 1741bfa_ioim_sm_qfull(struct bfa_ioim_s *ioim, enum bfa_ioim_event event)
@@ -1992,7 +1779,7 @@ bfa_ioim_sm_qfull(struct bfa_ioim_s *ioim, enum bfa_ioim_event event)
1992} 1779}
1993 1780
1994/* 1781/*
1995 * Active IO is being aborted, waiting for room in request CQ. 1782 * Active IO is being aborted, waiting for room in request CQ.
1996 */ 1783 */
1997static void 1784static void
1998bfa_ioim_sm_abort_qfull(struct bfa_ioim_s *ioim, enum bfa_ioim_event event) 1785bfa_ioim_sm_abort_qfull(struct bfa_ioim_s *ioim, enum bfa_ioim_event event)
@@ -2043,7 +1830,7 @@ bfa_ioim_sm_abort_qfull(struct bfa_ioim_s *ioim, enum bfa_ioim_event event)
2043} 1830}
2044 1831
2045/* 1832/*
2046 * Active IO is being cleaned up, waiting for room in request CQ. 1833 * Active IO is being cleaned up, waiting for room in request CQ.
2047 */ 1834 */
2048static void 1835static void
2049bfa_ioim_sm_cleanup_qfull(struct bfa_ioim_s *ioim, enum bfa_ioim_event event) 1836bfa_ioim_sm_cleanup_qfull(struct bfa_ioim_s *ioim, enum bfa_ioim_event event)
@@ -2297,7 +2084,7 @@ bfa_ioim_send_ioreq(struct bfa_ioim_s *ioim)
2297{ 2084{
2298 struct bfa_itnim_s *itnim = ioim->itnim; 2085 struct bfa_itnim_s *itnim = ioim->itnim;
2299 struct bfi_ioim_req_s *m; 2086 struct bfi_ioim_req_s *m;
2300 static struct fcp_cmnd_s cmnd_z0 = {{{0}}}; 2087 static struct fcp_cmnd_s cmnd_z0 = { { { 0 } } };
2301 struct bfi_sge_s *sge, *sgpge; 2088 struct bfi_sge_s *sge, *sgpge;
2302 u32 pgdlen = 0; 2089 u32 pgdlen = 0;
2303 u32 fcp_dl; 2090 u32 fcp_dl;
@@ -2553,9 +2340,6 @@ bfa_ioim_is_abortable(struct bfa_ioim_s *ioim)
2553 return BFA_TRUE; 2340 return BFA_TRUE;
2554} 2341}
2555 2342
2556/*
2557 * or after the link comes back.
2558 */
2559void 2343void
2560bfa_ioim_delayed_comp(struct bfa_ioim_s *ioim, bfa_boolean_t iotov) 2344bfa_ioim_delayed_comp(struct bfa_ioim_s *ioim, bfa_boolean_t iotov)
2561{ 2345{
@@ -2750,32 +2534,6 @@ bfa_ioim_good_comp_isr(struct bfa_s *bfa, struct bfi_msg_s *m)
2750 bfa_sm_send_event(ioim, BFA_IOIM_SM_COMP_GOOD); 2534 bfa_sm_send_event(ioim, BFA_IOIM_SM_COMP_GOOD);
2751} 2535}
2752 2536
2753void
2754bfa_ioim_profile_start(struct bfa_ioim_s *ioim)
2755{
2756 ioim->start_time = jiffies;
2757}
2758
2759void
2760bfa_ioim_profile_comp(struct bfa_ioim_s *ioim)
2761{
2762 struct scsi_cmnd *cmnd = (struct scsi_cmnd *) ioim->dio;
2763 u32 fcp_dl = scsi_bufflen(cmnd);
2764 u32 index = bfa_ioim_get_index(fcp_dl);
2765 u64 end_time = jiffies;
2766 struct bfa_itnim_latency_s *io_lat =
2767 &(ioim->itnim->ioprofile.io_latency);
2768 u32 val = (u32)(end_time - ioim->start_time);
2769
2770 bfa_itnim_ioprofile_update(ioim->itnim, index);
2771
2772 io_lat->count[index]++;
2773 io_lat->min[index] = (io_lat->min[index] < val) ?
2774 io_lat->min[index] : val;
2775 io_lat->max[index] = (io_lat->max[index] > val) ?
2776 io_lat->max[index] : val;
2777 io_lat->avg[index] += val;
2778}
2779/* 2537/*
2780 * Called by itnim to clean up IO while going offline. 2538 * Called by itnim to clean up IO while going offline.
2781 */ 2539 */
@@ -2909,13 +2667,12 @@ bfa_ioim_abort(struct bfa_ioim_s *ioim)
2909 return BFA_STATUS_OK; 2667 return BFA_STATUS_OK;
2910} 2668}
2911 2669
2912
2913/* 2670/*
2914 * BFA TSKIM state machine functions 2671 * BFA TSKIM state machine functions
2915 */ 2672 */
2916 2673
2917/* 2674/*
2918 * Task management command beginning state. 2675 * Task management command beginning state.
2919 */ 2676 */
2920static void 2677static void
2921bfa_tskim_sm_uninit(struct bfa_tskim_s *tskim, enum bfa_tskim_event event) 2678bfa_tskim_sm_uninit(struct bfa_tskim_s *tskim, enum bfa_tskim_event event)
@@ -2952,9 +2709,8 @@ bfa_tskim_sm_uninit(struct bfa_tskim_s *tskim, enum bfa_tskim_event event)
2952} 2709}
2953 2710
2954/* 2711/*
2955 * brief 2712 * TM command is active, awaiting completion from firmware to
2956 * TM command is active, awaiting completion from firmware to 2713 * cleanup IO requests in TM scope.
2957 * cleanup IO requests in TM scope.
2958 */ 2714 */
2959static void 2715static void
2960bfa_tskim_sm_active(struct bfa_tskim_s *tskim, enum bfa_tskim_event event) 2716bfa_tskim_sm_active(struct bfa_tskim_s *tskim, enum bfa_tskim_event event)
@@ -2989,8 +2745,8 @@ bfa_tskim_sm_active(struct bfa_tskim_s *tskim, enum bfa_tskim_event event)
2989} 2745}
2990 2746
2991/* 2747/*
2992 * An active TM is being cleaned up since ITN is offline. Awaiting cleanup 2748 * An active TM is being cleaned up since ITN is offline. Awaiting cleanup
2993 * completion event from firmware. 2749 * completion event from firmware.
2994 */ 2750 */
2995static void 2751static void
2996bfa_tskim_sm_cleanup(struct bfa_tskim_s *tskim, enum bfa_tskim_event event) 2752bfa_tskim_sm_cleanup(struct bfa_tskim_s *tskim, enum bfa_tskim_event event)
@@ -3050,7 +2806,7 @@ bfa_tskim_sm_iocleanup(struct bfa_tskim_s *tskim, enum bfa_tskim_event event)
3050} 2806}
3051 2807
3052/* 2808/*
3053 * Task management command is waiting for room in request CQ 2809 * Task management command is waiting for room in request CQ
3054 */ 2810 */
3055static void 2811static void
3056bfa_tskim_sm_qfull(struct bfa_tskim_s *tskim, enum bfa_tskim_event event) 2812bfa_tskim_sm_qfull(struct bfa_tskim_s *tskim, enum bfa_tskim_event event)
@@ -3085,8 +2841,8 @@ bfa_tskim_sm_qfull(struct bfa_tskim_s *tskim, enum bfa_tskim_event event)
3085} 2841}
3086 2842
3087/* 2843/*
3088 * Task management command is active, awaiting for room in request CQ 2844 * Task management command is active, awaiting for room in request CQ
3089 * to send clean up request. 2845 * to send clean up request.
3090 */ 2846 */
3091static void 2847static void
3092bfa_tskim_sm_cleanup_qfull(struct bfa_tskim_s *tskim, 2848bfa_tskim_sm_cleanup_qfull(struct bfa_tskim_s *tskim,
@@ -3098,10 +2854,8 @@ bfa_tskim_sm_cleanup_qfull(struct bfa_tskim_s *tskim,
3098 case BFA_TSKIM_SM_DONE: 2854 case BFA_TSKIM_SM_DONE:
3099 bfa_reqq_wcancel(&tskim->reqq_wait); 2855 bfa_reqq_wcancel(&tskim->reqq_wait);
3100 /* 2856 /*
3101 *
3102 * Fall through !!! 2857 * Fall through !!!
3103 */ 2858 */
3104
3105 case BFA_TSKIM_SM_QRESUME: 2859 case BFA_TSKIM_SM_QRESUME:
3106 bfa_sm_set_state(tskim, bfa_tskim_sm_cleanup); 2860 bfa_sm_set_state(tskim, bfa_tskim_sm_cleanup);
3107 bfa_tskim_send_abort(tskim); 2861 bfa_tskim_send_abort(tskim);
@@ -3120,7 +2874,7 @@ bfa_tskim_sm_cleanup_qfull(struct bfa_tskim_s *tskim,
3120} 2874}
3121 2875
3122/* 2876/*
3123 * BFA callback is pending 2877 * BFA callback is pending
3124 */ 2878 */
3125static void 2879static void
3126bfa_tskim_sm_hcb(struct bfa_tskim_s *tskim, enum bfa_tskim_event event) 2880bfa_tskim_sm_hcb(struct bfa_tskim_s *tskim, enum bfa_tskim_event event)
@@ -3145,7 +2899,6 @@ bfa_tskim_sm_hcb(struct bfa_tskim_s *tskim, enum bfa_tskim_event event)
3145 } 2899 }
3146} 2900}
3147 2901
3148
3149static void 2902static void
3150__bfa_cb_tskim_done(void *cbarg, bfa_boolean_t complete) 2903__bfa_cb_tskim_done(void *cbarg, bfa_boolean_t complete)
3151{ 2904{
@@ -3175,7 +2928,7 @@ __bfa_cb_tskim_failed(void *cbarg, bfa_boolean_t complete)
3175 BFI_TSKIM_STS_FAILED); 2928 BFI_TSKIM_STS_FAILED);
3176} 2929}
3177 2930
3178static bfa_boolean_t 2931static bfa_boolean_t
3179bfa_tskim_match_scope(struct bfa_tskim_s *tskim, struct scsi_lun lun) 2932bfa_tskim_match_scope(struct bfa_tskim_s *tskim, struct scsi_lun lun)
3180{ 2933{
3181 switch (tskim->tm_cmnd) { 2934 switch (tskim->tm_cmnd) {
@@ -3186,7 +2939,7 @@ bfa_tskim_match_scope(struct bfa_tskim_s *tskim, struct scsi_lun lun)
3186 case FCP_TM_CLEAR_TASK_SET: 2939 case FCP_TM_CLEAR_TASK_SET:
3187 case FCP_TM_LUN_RESET: 2940 case FCP_TM_LUN_RESET:
3188 case FCP_TM_CLEAR_ACA: 2941 case FCP_TM_CLEAR_ACA:
3189 return (!memcmp(&tskim->lun, &lun, sizeof(lun))); 2942 return !memcmp(&tskim->lun, &lun, sizeof(lun));
3190 2943
3191 default: 2944 default:
3192 bfa_assert(0); 2945 bfa_assert(0);
@@ -3196,7 +2949,7 @@ bfa_tskim_match_scope(struct bfa_tskim_s *tskim, struct scsi_lun lun)
3196} 2949}
3197 2950
3198/* 2951/*
3199 * Gather affected IO requests and task management commands. 2952 * Gather affected IO requests and task management commands.
3200 */ 2953 */
3201static void 2954static void
3202bfa_tskim_gather_ios(struct bfa_tskim_s *tskim) 2955bfa_tskim_gather_ios(struct bfa_tskim_s *tskim)
@@ -3238,7 +2991,7 @@ bfa_tskim_gather_ios(struct bfa_tskim_s *tskim)
3238} 2991}
3239 2992
3240/* 2993/*
3241 * IO cleanup completion 2994 * IO cleanup completion
3242 */ 2995 */
3243static void 2996static void
3244bfa_tskim_cleanp_comp(void *tskim_cbarg) 2997bfa_tskim_cleanp_comp(void *tskim_cbarg)
@@ -3250,7 +3003,7 @@ bfa_tskim_cleanp_comp(void *tskim_cbarg)
3250} 3003}
3251 3004
3252/* 3005/*
3253 * Gather affected IO requests and task management commands. 3006 * Gather affected IO requests and task management commands.
3254 */ 3007 */
3255static void 3008static void
3256bfa_tskim_cleanup_ios(struct bfa_tskim_s *tskim) 3009bfa_tskim_cleanup_ios(struct bfa_tskim_s *tskim)
@@ -3270,7 +3023,7 @@ bfa_tskim_cleanup_ios(struct bfa_tskim_s *tskim)
3270} 3023}
3271 3024
3272/* 3025/*
3273 * Send task management request to firmware. 3026 * Send task management request to firmware.
3274 */ 3027 */
3275static bfa_boolean_t 3028static bfa_boolean_t
3276bfa_tskim_send(struct bfa_tskim_s *tskim) 3029bfa_tskim_send(struct bfa_tskim_s *tskim)
@@ -3305,7 +3058,7 @@ bfa_tskim_send(struct bfa_tskim_s *tskim)
3305} 3058}
3306 3059
3307/* 3060/*
3308 * Send abort request to cleanup an active TM to firmware. 3061 * Send abort request to cleanup an active TM to firmware.
3309 */ 3062 */
3310static bfa_boolean_t 3063static bfa_boolean_t
3311bfa_tskim_send_abort(struct bfa_tskim_s *tskim) 3064bfa_tskim_send_abort(struct bfa_tskim_s *tskim)
@@ -3336,7 +3089,7 @@ bfa_tskim_send_abort(struct bfa_tskim_s *tskim)
3336} 3089}
3337 3090
3338/* 3091/*
3339 * Call to resume task management cmnd waiting for room in request queue. 3092 * Call to resume task management cmnd waiting for room in request queue.
3340 */ 3093 */
3341static void 3094static void
3342bfa_tskim_qresume(void *cbarg) 3095bfa_tskim_qresume(void *cbarg)
@@ -3362,7 +3115,6 @@ bfa_tskim_iocdisable_ios(struct bfa_tskim_s *tskim)
3362 } 3115 }
3363} 3116}
3364 3117
3365
3366/* 3118/*
3367 * Notification on completions from related ioim. 3119 * Notification on completions from related ioim.
3368 */ 3120 */
@@ -3395,7 +3147,7 @@ bfa_tskim_cleanup(struct bfa_tskim_s *tskim)
3395} 3147}
3396 3148
3397/* 3149/*
3398 * Memory allocation and initialization. 3150 * Memory allocation and initialization.
3399 */ 3151 */
3400void 3152void
3401bfa_tskim_attach(struct bfa_fcpim_mod_s *fcpim, struct bfa_meminfo_s *minfo) 3153bfa_tskim_attach(struct bfa_fcpim_mod_s *fcpim, struct bfa_meminfo_s *minfo)
@@ -3477,7 +3229,7 @@ bfa_tskim_free(struct bfa_tskim_s *tskim)
3477} 3229}
3478 3230
3479/* 3231/*
3480 * Start a task management command. 3232 * Start a task management command.
3481 * 3233 *
3482 * @param[in] tskim BFA task management command instance 3234 * @param[in] tskim BFA task management command instance
3483 * @param[in] itnim i-t nexus for the task management command 3235 * @param[in] itnim i-t nexus for the task management command