hns_roce_eq.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. /*
  2. * Copyright (c) 2016 Hisilicon Limited.
  3. *
  4. * This software is available to you under a choice of one of two
  5. * licenses. You may choose to be licensed under the terms of the GNU
  6. * General Public License (GPL) Version 2, available from the file
  7. * COPYING in the main directory of this source tree, or the
  8. * OpenIB.org BSD license below:
  9. *
  10. * Redistribution and use in source and binary forms, with or
  11. * without modification, are permitted provided that the following
  12. * conditions are met:
  13. *
  14. * - Redistributions of source code must retain the above
  15. * copyright notice, this list of conditions and the following
  16. * disclaimer.
  17. *
  18. * - Redistributions in binary form must reproduce the above
  19. * copyright notice, this list of conditions and the following
  20. * disclaimer in the documentation and/or other materials
  21. * provided with the distribution.
  22. *
  23. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  24. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  25. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  26. * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  27. * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  28. * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  29. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  30. * SOFTWARE.
  31. */
  32. #ifndef _HNS_ROCE_EQ_H
  33. #define _HNS_ROCE_EQ_H
  34. #define HNS_ROCE_CEQ 1
  35. #define HNS_ROCE_AEQ 2
  36. #define HNS_ROCE_CEQ_ENTRY_SIZE 0x4
  37. #define HNS_ROCE_AEQ_ENTRY_SIZE 0x10
  38. #define HNS_ROCE_CEQC_REG_OFFSET 0x18
  39. #define HNS_ROCE_CEQ_DEFAULT_INTERVAL 0x10
  40. #define HNS_ROCE_CEQ_DEFAULT_BURST_NUM 0x10
  41. #define HNS_ROCE_INT_MASK_DISABLE 0
  42. #define HNS_ROCE_INT_MASK_ENABLE 1
  43. #define EQ_ENABLE 1
  44. #define EQ_DISABLE 0
  45. #define CONS_INDEX_MASK 0xffff
  46. #define CEQ_REG_OFFSET 0x18
  47. enum {
  48. HNS_ROCE_EQ_STAT_INVALID = 0,
  49. HNS_ROCE_EQ_STAT_VALID = 2,
  50. };
  51. struct hns_roce_aeqe {
  52. u32 asyn;
  53. union {
  54. struct {
  55. u32 qp;
  56. u32 rsv0;
  57. u32 rsv1;
  58. } qp_event;
  59. struct {
  60. u32 cq;
  61. u32 rsv0;
  62. u32 rsv1;
  63. } cq_event;
  64. struct {
  65. u32 port;
  66. u32 rsv0;
  67. u32 rsv1;
  68. } port_event;
  69. struct {
  70. u32 ceqe;
  71. u32 rsv0;
  72. u32 rsv1;
  73. } ce_event;
  74. struct {
  75. __le64 out_param;
  76. __le16 token;
  77. u8 status;
  78. u8 rsv0;
  79. } __packed cmd;
  80. } event;
  81. };
  82. #define HNS_ROCE_AEQE_U32_4_EVENT_TYPE_S 16
  83. #define HNS_ROCE_AEQE_U32_4_EVENT_TYPE_M \
  84. (((1UL << 8) - 1) << HNS_ROCE_AEQE_U32_4_EVENT_TYPE_S)
  85. #define HNS_ROCE_AEQE_U32_4_EVENT_SUB_TYPE_S 24
  86. #define HNS_ROCE_AEQE_U32_4_EVENT_SUB_TYPE_M \
  87. (((1UL << 7) - 1) << HNS_ROCE_AEQE_U32_4_EVENT_SUB_TYPE_S)
  88. #define HNS_ROCE_AEQE_U32_4_OWNER_S 31
  89. #define HNS_ROCE_AEQE_EVENT_QP_EVENT_QP_QPN_S 0
  90. #define HNS_ROCE_AEQE_EVENT_QP_EVENT_QP_QPN_M \
  91. (((1UL << 24) - 1) << HNS_ROCE_AEQE_EVENT_QP_EVENT_QP_QPN_S)
  92. #define HNS_ROCE_AEQE_EVENT_QP_EVENT_PORT_NUM_S 25
  93. #define HNS_ROCE_AEQE_EVENT_QP_EVENT_PORT_NUM_M \
  94. (((1UL << 3) - 1) << HNS_ROCE_AEQE_EVENT_QP_EVENT_PORT_NUM_S)
  95. #define HNS_ROCE_AEQE_EVENT_CQ_EVENT_CQ_CQN_S 0
  96. #define HNS_ROCE_AEQE_EVENT_CQ_EVENT_CQ_CQN_M \
  97. (((1UL << 16) - 1) << HNS_ROCE_AEQE_EVENT_CQ_EVENT_CQ_CQN_S)
  98. #define HNS_ROCE_AEQE_EVENT_CE_EVENT_CEQE_CEQN_S 0
  99. #define HNS_ROCE_AEQE_EVENT_CE_EVENT_CEQE_CEQN_M \
  100. (((1UL << 5) - 1) << HNS_ROCE_AEQE_EVENT_CE_EVENT_CEQE_CEQN_S)
  101. struct hns_roce_ceqe {
  102. union {
  103. int comp;
  104. } ceqe;
  105. };
  106. #define HNS_ROCE_CEQE_CEQE_COMP_OWNER_S 0
  107. #define HNS_ROCE_CEQE_CEQE_COMP_CQN_S 16
  108. #define HNS_ROCE_CEQE_CEQE_COMP_CQN_M \
  109. (((1UL << 16) - 1) << HNS_ROCE_CEQE_CEQE_COMP_CQN_S)
  110. #endif /* _HNS_ROCE_EQ_H */