rxe_opcode.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. /*
  2. * Copyright (c) 2016 Mellanox Technologies Ltd. All rights reserved.
  3. * Copyright (c) 2015 System Fabric Works, Inc. All rights reserved.
  4. *
  5. * This software is available to you under a choice of one of two
  6. * licenses. You may choose to be licensed under the terms of the GNU
  7. * General Public License (GPL) Version 2, available from the file
  8. * COPYING in the main directory of this source tree, or the
  9. * OpenIB.org BSD license below:
  10. *
  11. * Redistribution and use in source and binary forms, with or
  12. * without modification, are permitted provided that the following
  13. * conditions are met:
  14. *
  15. * - Redistributions of source code must retain the above
  16. * copyright notice, this list of conditions and the following
  17. * disclaimer.
  18. *
  19. * - Redistributions in binary form must reproduce the above
  20. * copyright notice, this list of conditions and the following
  21. * disclaimer in the documentation and/or other materials
  22. * provided with the distribution.
  23. *
  24. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  25. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  26. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  27. * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  28. * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  29. * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  30. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  31. * SOFTWARE.
  32. */
  33. #ifndef RXE_OPCODE_H
  34. #define RXE_OPCODE_H
  35. /*
  36. * contains header bit mask definitions and header lengths
  37. * declaration of the rxe_opcode_info struct and
  38. * rxe_wr_opcode_info struct
  39. */
  40. enum rxe_wr_mask {
  41. WR_INLINE_MASK = BIT(0),
  42. WR_ATOMIC_MASK = BIT(1),
  43. WR_SEND_MASK = BIT(2),
  44. WR_READ_MASK = BIT(3),
  45. WR_WRITE_MASK = BIT(4),
  46. WR_LOCAL_MASK = BIT(5),
  47. WR_REG_MASK = BIT(6),
  48. WR_READ_OR_WRITE_MASK = WR_READ_MASK | WR_WRITE_MASK,
  49. WR_READ_WRITE_OR_SEND_MASK = WR_READ_OR_WRITE_MASK | WR_SEND_MASK,
  50. WR_WRITE_OR_SEND_MASK = WR_WRITE_MASK | WR_SEND_MASK,
  51. WR_ATOMIC_OR_READ_MASK = WR_ATOMIC_MASK | WR_READ_MASK,
  52. };
  53. #define WR_MAX_QPT (8)
  54. struct rxe_wr_opcode_info {
  55. char *name;
  56. enum rxe_wr_mask mask[WR_MAX_QPT];
  57. };
  58. extern struct rxe_wr_opcode_info rxe_wr_opcode_info[];
  59. enum rxe_hdr_type {
  60. RXE_LRH,
  61. RXE_GRH,
  62. RXE_BTH,
  63. RXE_RETH,
  64. RXE_AETH,
  65. RXE_ATMETH,
  66. RXE_ATMACK,
  67. RXE_IETH,
  68. RXE_RDETH,
  69. RXE_DETH,
  70. RXE_IMMDT,
  71. RXE_PAYLOAD,
  72. NUM_HDR_TYPES
  73. };
  74. enum rxe_hdr_mask {
  75. RXE_LRH_MASK = BIT(RXE_LRH),
  76. RXE_GRH_MASK = BIT(RXE_GRH),
  77. RXE_BTH_MASK = BIT(RXE_BTH),
  78. RXE_IMMDT_MASK = BIT(RXE_IMMDT),
  79. RXE_RETH_MASK = BIT(RXE_RETH),
  80. RXE_AETH_MASK = BIT(RXE_AETH),
  81. RXE_ATMETH_MASK = BIT(RXE_ATMETH),
  82. RXE_ATMACK_MASK = BIT(RXE_ATMACK),
  83. RXE_IETH_MASK = BIT(RXE_IETH),
  84. RXE_RDETH_MASK = BIT(RXE_RDETH),
  85. RXE_DETH_MASK = BIT(RXE_DETH),
  86. RXE_PAYLOAD_MASK = BIT(RXE_PAYLOAD),
  87. RXE_REQ_MASK = BIT(NUM_HDR_TYPES + 0),
  88. RXE_ACK_MASK = BIT(NUM_HDR_TYPES + 1),
  89. RXE_SEND_MASK = BIT(NUM_HDR_TYPES + 2),
  90. RXE_WRITE_MASK = BIT(NUM_HDR_TYPES + 3),
  91. RXE_READ_MASK = BIT(NUM_HDR_TYPES + 4),
  92. RXE_ATOMIC_MASK = BIT(NUM_HDR_TYPES + 5),
  93. RXE_RWR_MASK = BIT(NUM_HDR_TYPES + 6),
  94. RXE_COMP_MASK = BIT(NUM_HDR_TYPES + 7),
  95. RXE_START_MASK = BIT(NUM_HDR_TYPES + 8),
  96. RXE_MIDDLE_MASK = BIT(NUM_HDR_TYPES + 9),
  97. RXE_END_MASK = BIT(NUM_HDR_TYPES + 10),
  98. RXE_LOOPBACK_MASK = BIT(NUM_HDR_TYPES + 12),
  99. RXE_READ_OR_ATOMIC = (RXE_READ_MASK | RXE_ATOMIC_MASK),
  100. RXE_WRITE_OR_SEND = (RXE_WRITE_MASK | RXE_SEND_MASK),
  101. };
  102. #define OPCODE_NONE (-1)
  103. #define RXE_NUM_OPCODE 256
  104. struct rxe_opcode_info {
  105. char *name;
  106. enum rxe_hdr_mask mask;
  107. int length;
  108. int offset[NUM_HDR_TYPES];
  109. };
  110. extern struct rxe_opcode_info rxe_opcode[RXE_NUM_OPCODE];
  111. #endif /* RXE_OPCODE_H */