opcode.h 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. /*
  2. * Copyright (c) 2005 Topspin Communications. All rights reserved.
  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 INFINIBAND_OPCODE_H
  33. #define INFINIBAND_OPCODE_H
  34. /*
  35. * This macro cleans up the definitions of constants for BTH opcodes.
  36. * It is used to define constants such as IBV_OPCODE_UD_SEND_ONLY,
  37. * which becomes IBV_OPCODE_UD + IBV_OPCODE_SEND_ONLY, and this gives
  38. * the correct value.
  39. *
  40. * In short, user code should use the constants defined using the
  41. * macro rather than worrying about adding together other constants.
  42. */
  43. #define IBV_OPCODE(transport, op) \
  44. IBV_OPCODE_ ## transport ## _ ## op = \
  45. IBV_OPCODE_ ## transport + IBV_OPCODE_ ## op
  46. enum {
  47. /* transport types -- just used to define real constants */
  48. IBV_OPCODE_RC = 0x00,
  49. IBV_OPCODE_UC = 0x20,
  50. IBV_OPCODE_RD = 0x40,
  51. IBV_OPCODE_UD = 0x60,
  52. /* operations -- just used to define real constants */
  53. IBV_OPCODE_SEND_FIRST = 0x00,
  54. IBV_OPCODE_SEND_MIDDLE = 0x01,
  55. IBV_OPCODE_SEND_LAST = 0x02,
  56. IBV_OPCODE_SEND_LAST_WITH_IMMEDIATE = 0x03,
  57. IBV_OPCODE_SEND_ONLY = 0x04,
  58. IBV_OPCODE_SEND_ONLY_WITH_IMMEDIATE = 0x05,
  59. IBV_OPCODE_RDMA_WRITE_FIRST = 0x06,
  60. IBV_OPCODE_RDMA_WRITE_MIDDLE = 0x07,
  61. IBV_OPCODE_RDMA_WRITE_LAST = 0x08,
  62. IBV_OPCODE_RDMA_WRITE_LAST_WITH_IMMEDIATE = 0x09,
  63. IBV_OPCODE_RDMA_WRITE_ONLY = 0x0a,
  64. IBV_OPCODE_RDMA_WRITE_ONLY_WITH_IMMEDIATE = 0x0b,
  65. IBV_OPCODE_RDMA_READ_REQUEST = 0x0c,
  66. IBV_OPCODE_RDMA_READ_RESPONSE_FIRST = 0x0d,
  67. IBV_OPCODE_RDMA_READ_RESPONSE_MIDDLE = 0x0e,
  68. IBV_OPCODE_RDMA_READ_RESPONSE_LAST = 0x0f,
  69. IBV_OPCODE_RDMA_READ_RESPONSE_ONLY = 0x10,
  70. IBV_OPCODE_ACKNOWLEDGE = 0x11,
  71. IBV_OPCODE_ATOMIC_ACKNOWLEDGE = 0x12,
  72. IBV_OPCODE_COMPARE_SWAP = 0x13,
  73. IBV_OPCODE_FETCH_ADD = 0x14,
  74. /* real constants follow -- see comment about above IBV_OPCODE()
  75. macro for more details */
  76. /* RC */
  77. IBV_OPCODE(RC, SEND_FIRST),
  78. IBV_OPCODE(RC, SEND_MIDDLE),
  79. IBV_OPCODE(RC, SEND_LAST),
  80. IBV_OPCODE(RC, SEND_LAST_WITH_IMMEDIATE),
  81. IBV_OPCODE(RC, SEND_ONLY),
  82. IBV_OPCODE(RC, SEND_ONLY_WITH_IMMEDIATE),
  83. IBV_OPCODE(RC, RDMA_WRITE_FIRST),
  84. IBV_OPCODE(RC, RDMA_WRITE_MIDDLE),
  85. IBV_OPCODE(RC, RDMA_WRITE_LAST),
  86. IBV_OPCODE(RC, RDMA_WRITE_LAST_WITH_IMMEDIATE),
  87. IBV_OPCODE(RC, RDMA_WRITE_ONLY),
  88. IBV_OPCODE(RC, RDMA_WRITE_ONLY_WITH_IMMEDIATE),
  89. IBV_OPCODE(RC, RDMA_READ_REQUEST),
  90. IBV_OPCODE(RC, RDMA_READ_RESPONSE_FIRST),
  91. IBV_OPCODE(RC, RDMA_READ_RESPONSE_MIDDLE),
  92. IBV_OPCODE(RC, RDMA_READ_RESPONSE_LAST),
  93. IBV_OPCODE(RC, RDMA_READ_RESPONSE_ONLY),
  94. IBV_OPCODE(RC, ACKNOWLEDGE),
  95. IBV_OPCODE(RC, ATOMIC_ACKNOWLEDGE),
  96. IBV_OPCODE(RC, COMPARE_SWAP),
  97. IBV_OPCODE(RC, FETCH_ADD),
  98. /* UC */
  99. IBV_OPCODE(UC, SEND_FIRST),
  100. IBV_OPCODE(UC, SEND_MIDDLE),
  101. IBV_OPCODE(UC, SEND_LAST),
  102. IBV_OPCODE(UC, SEND_LAST_WITH_IMMEDIATE),
  103. IBV_OPCODE(UC, SEND_ONLY),
  104. IBV_OPCODE(UC, SEND_ONLY_WITH_IMMEDIATE),
  105. IBV_OPCODE(UC, RDMA_WRITE_FIRST),
  106. IBV_OPCODE(UC, RDMA_WRITE_MIDDLE),
  107. IBV_OPCODE(UC, RDMA_WRITE_LAST),
  108. IBV_OPCODE(UC, RDMA_WRITE_LAST_WITH_IMMEDIATE),
  109. IBV_OPCODE(UC, RDMA_WRITE_ONLY),
  110. IBV_OPCODE(UC, RDMA_WRITE_ONLY_WITH_IMMEDIATE),
  111. /* RD */
  112. IBV_OPCODE(RD, SEND_FIRST),
  113. IBV_OPCODE(RD, SEND_MIDDLE),
  114. IBV_OPCODE(RD, SEND_LAST),
  115. IBV_OPCODE(RD, SEND_LAST_WITH_IMMEDIATE),
  116. IBV_OPCODE(RD, SEND_ONLY),
  117. IBV_OPCODE(RD, SEND_ONLY_WITH_IMMEDIATE),
  118. IBV_OPCODE(RD, RDMA_WRITE_FIRST),
  119. IBV_OPCODE(RD, RDMA_WRITE_MIDDLE),
  120. IBV_OPCODE(RD, RDMA_WRITE_LAST),
  121. IBV_OPCODE(RD, RDMA_WRITE_LAST_WITH_IMMEDIATE),
  122. IBV_OPCODE(RD, RDMA_WRITE_ONLY),
  123. IBV_OPCODE(RD, RDMA_WRITE_ONLY_WITH_IMMEDIATE),
  124. IBV_OPCODE(RD, RDMA_READ_REQUEST),
  125. IBV_OPCODE(RD, RDMA_READ_RESPONSE_FIRST),
  126. IBV_OPCODE(RD, RDMA_READ_RESPONSE_MIDDLE),
  127. IBV_OPCODE(RD, RDMA_READ_RESPONSE_LAST),
  128. IBV_OPCODE(RD, RDMA_READ_RESPONSE_ONLY),
  129. IBV_OPCODE(RD, ACKNOWLEDGE),
  130. IBV_OPCODE(RD, ATOMIC_ACKNOWLEDGE),
  131. IBV_OPCODE(RD, COMPARE_SWAP),
  132. IBV_OPCODE(RD, FETCH_ADD),
  133. /* UD */
  134. IBV_OPCODE(UD, SEND_ONLY),
  135. IBV_OPCODE(UD, SEND_ONLY_WITH_IMMEDIATE)
  136. };
  137. #endif /* INFINIBAND_OPCODE_H */