qed_cxt.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. /* QLogic qed NIC Driver
  2. * Copyright (c) 2015 QLogic Corporation
  3. *
  4. * This software is available under the terms of the GNU General Public License
  5. * (GPL) Version 2, available from the file COPYING in the main directory of
  6. * this source tree.
  7. */
  8. #ifndef _QED_CXT_H
  9. #define _QED_CXT_H
  10. #include <linux/types.h>
  11. #include <linux/slab.h>
  12. #include <linux/qed/qed_if.h>
  13. #include "qed_hsi.h"
  14. #include "qed.h"
  15. struct qed_cxt_info {
  16. void *p_cxt;
  17. u32 iid;
  18. enum protocol_type type;
  19. };
  20. #define MAX_TID_BLOCKS 512
  21. struct qed_tid_mem {
  22. u32 tid_size;
  23. u32 num_tids_per_block;
  24. u32 waste;
  25. u8 *blocks[MAX_TID_BLOCKS]; /* 4K */
  26. };
  27. /**
  28. * @brief qed_cxt_acquire - Acquire a new cid of a specific protocol type
  29. *
  30. * @param p_hwfn
  31. * @param type
  32. * @param p_cid
  33. *
  34. * @return int
  35. */
  36. int qed_cxt_acquire_cid(struct qed_hwfn *p_hwfn,
  37. enum protocol_type type,
  38. u32 *p_cid);
  39. /**
  40. * @brief qedo_cid_get_cxt_info - Returns the context info for a specific cid
  41. *
  42. *
  43. * @param p_hwfn
  44. * @param p_info in/out
  45. *
  46. * @return int
  47. */
  48. int qed_cxt_get_cid_info(struct qed_hwfn *p_hwfn,
  49. struct qed_cxt_info *p_info);
  50. /**
  51. * @brief qed_cxt_get_tid_mem_info
  52. *
  53. * @param p_hwfn
  54. * @param p_info
  55. *
  56. * @return int
  57. */
  58. int qed_cxt_get_tid_mem_info(struct qed_hwfn *p_hwfn,
  59. struct qed_tid_mem *p_info);
  60. #define QED_CXT_ISCSI_TID_SEG PROTOCOLID_ISCSI
  61. #define QED_CXT_ROCE_TID_SEG PROTOCOLID_ROCE
  62. enum qed_cxt_elem_type {
  63. QED_ELEM_CXT,
  64. QED_ELEM_SRQ,
  65. QED_ELEM_TASK
  66. };
  67. u32 qed_cxt_get_proto_cid_count(struct qed_hwfn *p_hwfn,
  68. enum protocol_type type, u32 *vf_cid);
  69. /**
  70. * @brief qed_cxt_set_pf_params - Set the PF params for cxt init
  71. *
  72. * @param p_hwfn
  73. *
  74. * @return int
  75. */
  76. int qed_cxt_set_pf_params(struct qed_hwfn *p_hwfn);
  77. /**
  78. * @brief qed_cxt_cfg_ilt_compute - compute ILT init parameters
  79. *
  80. * @param p_hwfn
  81. *
  82. * @return int
  83. */
  84. int qed_cxt_cfg_ilt_compute(struct qed_hwfn *p_hwfn);
  85. /**
  86. * @brief qed_cxt_mngr_alloc - Allocate and init the context manager struct
  87. *
  88. * @param p_hwfn
  89. *
  90. * @return int
  91. */
  92. int qed_cxt_mngr_alloc(struct qed_hwfn *p_hwfn);
  93. /**
  94. * @brief qed_cxt_mngr_free
  95. *
  96. * @param p_hwfn
  97. */
  98. void qed_cxt_mngr_free(struct qed_hwfn *p_hwfn);
  99. /**
  100. * @brief qed_cxt_tables_alloc - Allocate ILT shadow, Searcher T2, acquired map
  101. *
  102. * @param p_hwfn
  103. *
  104. * @return int
  105. */
  106. int qed_cxt_tables_alloc(struct qed_hwfn *p_hwfn);
  107. /**
  108. * @brief qed_cxt_mngr_setup - Reset the acquired CIDs
  109. *
  110. * @param p_hwfn
  111. */
  112. void qed_cxt_mngr_setup(struct qed_hwfn *p_hwfn);
  113. /**
  114. * @brief qed_cxt_hw_init_common - Initailze ILT and DQ, common phase, per path.
  115. *
  116. *
  117. *
  118. * @param p_hwfn
  119. */
  120. void qed_cxt_hw_init_common(struct qed_hwfn *p_hwfn);
  121. /**
  122. * @brief qed_cxt_hw_init_pf - Initailze ILT and DQ, PF phase, per path.
  123. *
  124. *
  125. *
  126. * @param p_hwfn
  127. */
  128. void qed_cxt_hw_init_pf(struct qed_hwfn *p_hwfn);
  129. /**
  130. * @brief qed_qm_init_pf - Initailze the QM PF phase, per path
  131. *
  132. * @param p_hwfn
  133. */
  134. void qed_qm_init_pf(struct qed_hwfn *p_hwfn);
  135. /**
  136. * @brief Reconfigures QM pf on the fly
  137. *
  138. * @param p_hwfn
  139. * @param p_ptt
  140. *
  141. * @return int
  142. */
  143. int qed_qm_reconf(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt);
  144. /**
  145. * @brief qed_cxt_release - Release a cid
  146. *
  147. * @param p_hwfn
  148. * @param cid
  149. */
  150. void qed_cxt_release_cid(struct qed_hwfn *p_hwfn,
  151. u32 cid);
  152. int qed_cxt_dynamic_ilt_alloc(struct qed_hwfn *p_hwfn,
  153. enum qed_cxt_elem_type elem_type, u32 iid);
  154. u32 qed_cxt_get_proto_tid_count(struct qed_hwfn *p_hwfn,
  155. enum protocol_type type);
  156. u32 qed_cxt_get_proto_cid_start(struct qed_hwfn *p_hwfn,
  157. enum protocol_type type);
  158. int qed_cxt_free_proto_ilt(struct qed_hwfn *p_hwfn, enum protocol_type proto);
  159. #define QED_CTX_WORKING_MEM 0
  160. #define QED_CTX_FL_MEM 1
  161. #endif