bfa_fcpim.h 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. /*
  2. * Copyright (c) 2005-2009 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. #ifndef __BFA_FCPIM_H__
  18. #define __BFA_FCPIM_H__
  19. #include <bfa.h>
  20. #include <bfa_svc.h>
  21. #include <bfi/bfi_fcpim.h>
  22. #include <defs/bfa_defs_fcpim.h>
  23. /*
  24. * forward declarations
  25. */
  26. struct bfa_itnim_s;
  27. struct bfa_ioim_s;
  28. struct bfa_tskim_s;
  29. struct bfad_ioim_s;
  30. struct bfad_tskim_s;
  31. /*
  32. * bfa fcpim module API functions
  33. */
  34. void bfa_fcpim_path_tov_set(struct bfa_s *bfa, u16 path_tov);
  35. u16 bfa_fcpim_path_tov_get(struct bfa_s *bfa);
  36. void bfa_fcpim_qdepth_set(struct bfa_s *bfa, u16 q_depth);
  37. u16 bfa_fcpim_qdepth_get(struct bfa_s *bfa);
  38. bfa_status_t bfa_fcpim_get_modstats(struct bfa_s *bfa,
  39. struct bfa_fcpim_stats_s *modstats);
  40. bfa_status_t bfa_fcpim_clr_modstats(struct bfa_s *bfa);
  41. /*
  42. * bfa itnim API functions
  43. */
  44. struct bfa_itnim_s *bfa_itnim_create(struct bfa_s *bfa,
  45. struct bfa_rport_s *rport, void *itnim);
  46. void bfa_itnim_delete(struct bfa_itnim_s *itnim);
  47. void bfa_itnim_online(struct bfa_itnim_s *itnim,
  48. bfa_boolean_t seq_rec);
  49. void bfa_itnim_offline(struct bfa_itnim_s *itnim);
  50. void bfa_itnim_get_stats(struct bfa_itnim_s *itnim,
  51. struct bfa_itnim_hal_stats_s *stats);
  52. void bfa_itnim_clear_stats(struct bfa_itnim_s *itnim);
  53. /**
  54. * BFA completion callback for bfa_itnim_online().
  55. *
  56. * @param[in] itnim FCS or driver itnim instance
  57. *
  58. * return None
  59. */
  60. void bfa_cb_itnim_online(void *itnim);
  61. /**
  62. * BFA completion callback for bfa_itnim_offline().
  63. *
  64. * @param[in] itnim FCS or driver itnim instance
  65. *
  66. * return None
  67. */
  68. void bfa_cb_itnim_offline(void *itnim);
  69. void bfa_cb_itnim_tov_begin(void *itnim);
  70. void bfa_cb_itnim_tov(void *itnim);
  71. /**
  72. * BFA notification to FCS/driver for second level error recovery.
  73. *
  74. * Atleast one I/O request has timedout and target is unresponsive to
  75. * repeated abort requests. Second level error recovery should be initiated
  76. * by starting implicit logout and recovery procedures.
  77. *
  78. * @param[in] itnim FCS or driver itnim instance
  79. *
  80. * return None
  81. */
  82. void bfa_cb_itnim_sler(void *itnim);
  83. /*
  84. * bfa ioim API functions
  85. */
  86. struct bfa_ioim_s *bfa_ioim_alloc(struct bfa_s *bfa,
  87. struct bfad_ioim_s *dio,
  88. struct bfa_itnim_s *itnim,
  89. u16 nsgles);
  90. void bfa_ioim_free(struct bfa_ioim_s *ioim);
  91. void bfa_ioim_start(struct bfa_ioim_s *ioim);
  92. void bfa_ioim_abort(struct bfa_ioim_s *ioim);
  93. void bfa_ioim_delayed_comp(struct bfa_ioim_s *ioim,
  94. bfa_boolean_t iotov);
  95. /**
  96. * I/O completion notification.
  97. *
  98. * @param[in] dio driver IO structure
  99. * @param[in] io_status IO completion status
  100. * @param[in] scsi_status SCSI status returned by target
  101. * @param[in] sns_len SCSI sense length, 0 if none
  102. * @param[in] sns_info SCSI sense data, if any
  103. * @param[in] residue Residual length
  104. *
  105. * @return None
  106. */
  107. void bfa_cb_ioim_done(void *bfad, struct bfad_ioim_s *dio,
  108. enum bfi_ioim_status io_status,
  109. u8 scsi_status, int sns_len,
  110. u8 *sns_info, s32 residue);
  111. /**
  112. * I/O good completion notification.
  113. *
  114. * @param[in] dio driver IO structure
  115. *
  116. * @return None
  117. */
  118. void bfa_cb_ioim_good_comp(void *bfad, struct bfad_ioim_s *dio);
  119. /**
  120. * I/O abort completion notification
  121. *
  122. * @param[in] dio driver IO that was aborted
  123. *
  124. * @return None
  125. */
  126. void bfa_cb_ioim_abort(void *bfad, struct bfad_ioim_s *dio);
  127. void bfa_cb_ioim_resfree(void *hcb_bfad);
  128. void bfa_cb_ioim_resfree(void *hcb_bfad);
  129. /*
  130. * bfa tskim API functions
  131. */
  132. struct bfa_tskim_s *bfa_tskim_alloc(struct bfa_s *bfa,
  133. struct bfad_tskim_s *dtsk);
  134. void bfa_tskim_free(struct bfa_tskim_s *tskim);
  135. void bfa_tskim_start(struct bfa_tskim_s *tskim,
  136. struct bfa_itnim_s *itnim, lun_t lun,
  137. enum fcp_tm_cmnd tm, u8 t_secs);
  138. void bfa_cb_tskim_done(void *bfad, struct bfad_tskim_s *dtsk,
  139. enum bfi_tskim_status tsk_status);
  140. #endif /* __BFA_FCPIM_H__ */