qplib_sp.h 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. /*
  2. * Broadcom NetXtreme-E RoCE driver.
  3. *
  4. * Copyright (c) 2016 - 2017, Broadcom. All rights reserved. The term
  5. * Broadcom refers to Broadcom Limited and/or its subsidiaries.
  6. *
  7. * This software is available to you under a choice of one of two
  8. * licenses. You may choose to be licensed under the terms of the GNU
  9. * General Public License (GPL) Version 2, available from the file
  10. * COPYING in the main directory of this source tree, or the
  11. * BSD license below:
  12. *
  13. * Redistribution and use in source and binary forms, with or without
  14. * modification, are permitted provided that the following conditions
  15. * are met:
  16. *
  17. * 1. Redistributions of source code must retain the above copyright
  18. * notice, this list of conditions and the following disclaimer.
  19. * 2. Redistributions in binary form must reproduce the above copyright
  20. * notice, this list of conditions and the following disclaimer in
  21. * the documentation and/or other materials provided with the
  22. * distribution.
  23. *
  24. * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS''
  25. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
  26. * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  27. * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS
  28. * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  29. * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  30. * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
  31. * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  32. * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
  33. * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
  34. * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  35. *
  36. * Description: Slow Path Operators (header)
  37. *
  38. */
  39. #ifndef __BNXT_QPLIB_SP_H__
  40. #define __BNXT_QPLIB_SP_H__
  41. struct bnxt_qplib_dev_attr {
  42. char fw_ver[32];
  43. u16 max_sgid;
  44. u16 max_mrw;
  45. u32 max_qp;
  46. #define BNXT_QPLIB_MAX_OUT_RD_ATOM 126
  47. u32 max_qp_rd_atom;
  48. u32 max_qp_init_rd_atom;
  49. u32 max_qp_wqes;
  50. u32 max_qp_sges;
  51. u32 max_cq;
  52. u32 max_cq_wqes;
  53. u32 max_cq_sges;
  54. u32 max_mr;
  55. u64 max_mr_size;
  56. u32 max_pd;
  57. u32 max_mw;
  58. u32 max_raw_ethy_qp;
  59. u32 max_ah;
  60. u32 max_fmr;
  61. u32 max_map_per_fmr;
  62. u32 max_srq;
  63. u32 max_srq_wqes;
  64. u32 max_srq_sges;
  65. u32 max_pkey;
  66. u32 max_inline_data;
  67. u32 l2_db_size;
  68. u8 tqm_alloc_reqs[MAX_TQM_ALLOC_REQ];
  69. };
  70. struct bnxt_qplib_pd {
  71. u32 id;
  72. };
  73. struct bnxt_qplib_gid {
  74. u8 data[16];
  75. };
  76. struct bnxt_qplib_ah {
  77. struct bnxt_qplib_gid dgid;
  78. struct bnxt_qplib_pd *pd;
  79. u32 id;
  80. u8 sgid_index;
  81. /* For Query AH if the hw table and SW table are differnt */
  82. u8 host_sgid_index;
  83. u8 traffic_class;
  84. u32 flow_label;
  85. u8 hop_limit;
  86. u8 sl;
  87. u8 dmac[6];
  88. u16 vlan_id;
  89. u8 nw_type;
  90. };
  91. struct bnxt_qplib_mrw {
  92. struct bnxt_qplib_pd *pd;
  93. int type;
  94. u32 flags;
  95. #define BNXT_QPLIB_FR_PMR 0x80000000
  96. u32 lkey;
  97. u32 rkey;
  98. #define BNXT_QPLIB_RSVD_LKEY 0xFFFFFFFF
  99. u64 va;
  100. u64 total_size;
  101. u32 npages;
  102. u64 mr_handle;
  103. struct bnxt_qplib_hwq hwq;
  104. };
  105. struct bnxt_qplib_frpl {
  106. int max_pg_ptrs;
  107. struct bnxt_qplib_hwq hwq;
  108. };
  109. #define BNXT_QPLIB_ACCESS_LOCAL_WRITE BIT(0)
  110. #define BNXT_QPLIB_ACCESS_REMOTE_READ BIT(1)
  111. #define BNXT_QPLIB_ACCESS_REMOTE_WRITE BIT(2)
  112. #define BNXT_QPLIB_ACCESS_REMOTE_ATOMIC BIT(3)
  113. #define BNXT_QPLIB_ACCESS_MW_BIND BIT(4)
  114. #define BNXT_QPLIB_ACCESS_ZERO_BASED BIT(5)
  115. #define BNXT_QPLIB_ACCESS_ON_DEMAND BIT(6)
  116. int bnxt_qplib_get_sgid(struct bnxt_qplib_res *res,
  117. struct bnxt_qplib_sgid_tbl *sgid_tbl, int index,
  118. struct bnxt_qplib_gid *gid);
  119. int bnxt_qplib_del_sgid(struct bnxt_qplib_sgid_tbl *sgid_tbl,
  120. struct bnxt_qplib_gid *gid, bool update);
  121. int bnxt_qplib_add_sgid(struct bnxt_qplib_sgid_tbl *sgid_tbl,
  122. struct bnxt_qplib_gid *gid, u8 *mac, u16 vlan_id,
  123. bool update, u32 *index);
  124. int bnxt_qplib_get_pkey(struct bnxt_qplib_res *res,
  125. struct bnxt_qplib_pkey_tbl *pkey_tbl, u16 index,
  126. u16 *pkey);
  127. int bnxt_qplib_del_pkey(struct bnxt_qplib_res *res,
  128. struct bnxt_qplib_pkey_tbl *pkey_tbl, u16 *pkey,
  129. bool update);
  130. int bnxt_qplib_add_pkey(struct bnxt_qplib_res *res,
  131. struct bnxt_qplib_pkey_tbl *pkey_tbl, u16 *pkey,
  132. bool update);
  133. int bnxt_qplib_get_dev_attr(struct bnxt_qplib_rcfw *rcfw,
  134. struct bnxt_qplib_dev_attr *attr);
  135. int bnxt_qplib_create_ah(struct bnxt_qplib_res *res, struct bnxt_qplib_ah *ah);
  136. int bnxt_qplib_destroy_ah(struct bnxt_qplib_res *res, struct bnxt_qplib_ah *ah);
  137. int bnxt_qplib_alloc_mrw(struct bnxt_qplib_res *res,
  138. struct bnxt_qplib_mrw *mrw);
  139. int bnxt_qplib_dereg_mrw(struct bnxt_qplib_res *res, struct bnxt_qplib_mrw *mrw,
  140. bool block);
  141. int bnxt_qplib_reg_mr(struct bnxt_qplib_res *res, struct bnxt_qplib_mrw *mr,
  142. u64 *pbl_tbl, int num_pbls, bool block);
  143. int bnxt_qplib_free_mrw(struct bnxt_qplib_res *res, struct bnxt_qplib_mrw *mr);
  144. int bnxt_qplib_alloc_fast_reg_mr(struct bnxt_qplib_res *res,
  145. struct bnxt_qplib_mrw *mr, int max);
  146. int bnxt_qplib_alloc_fast_reg_page_list(struct bnxt_qplib_res *res,
  147. struct bnxt_qplib_frpl *frpl, int max);
  148. int bnxt_qplib_free_fast_reg_page_list(struct bnxt_qplib_res *res,
  149. struct bnxt_qplib_frpl *frpl);
  150. int bnxt_qplib_map_tc2cos(struct bnxt_qplib_res *res, u16 *cids);
  151. #endif /* __BNXT_QPLIB_SP_H__*/