nes_context.h 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. /*
  2. * Copyright (c) 2006 - 2011 Intel Corporation. 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 NES_CONTEXT_H
  33. #define NES_CONTEXT_H
  34. struct nes_qp_context {
  35. __le32 misc;
  36. __le32 cqs;
  37. __le32 sq_addr_low;
  38. __le32 sq_addr_high;
  39. __le32 rq_addr_low;
  40. __le32 rq_addr_high;
  41. __le32 misc2;
  42. __le16 tcpPorts[2];
  43. __le32 ip0;
  44. __le32 ip1;
  45. __le32 ip2;
  46. __le32 ip3;
  47. __le32 mss;
  48. __le32 arp_index_vlan;
  49. __le32 tcp_state_flow_label;
  50. __le32 pd_index_wscale;
  51. __le32 keepalive;
  52. u32 ts_recent;
  53. u32 ts_age;
  54. __le32 snd_nxt;
  55. __le32 snd_wnd;
  56. __le32 rcv_nxt;
  57. __le32 rcv_wnd;
  58. __le32 snd_max;
  59. __le32 snd_una;
  60. u32 srtt;
  61. __le32 rttvar;
  62. __le32 ssthresh;
  63. __le32 cwnd;
  64. __le32 snd_wl1;
  65. __le32 snd_wl2;
  66. __le32 max_snd_wnd;
  67. __le32 ts_val_delta;
  68. u32 retransmit;
  69. u32 probe_cnt;
  70. u32 hte_index;
  71. __le32 q2_addr_low;
  72. __le32 q2_addr_high;
  73. __le32 ird_index;
  74. u32 Rsvd3;
  75. __le32 ird_ord_sizes;
  76. u32 mrkr_offset;
  77. __le32 aeq_token_low;
  78. __le32 aeq_token_high;
  79. };
  80. /* QP Context Misc Field */
  81. #define NES_QPCONTEXT_MISC_IWARP_VER_MASK 0x00000003
  82. #define NES_QPCONTEXT_MISC_IWARP_VER_SHIFT 0
  83. #define NES_QPCONTEXT_MISC_EFB_SIZE_MASK 0x000000C0
  84. #define NES_QPCONTEXT_MISC_EFB_SIZE_SHIFT 6
  85. #define NES_QPCONTEXT_MISC_RQ_SIZE_MASK 0x00000300
  86. #define NES_QPCONTEXT_MISC_RQ_SIZE_SHIFT 8
  87. #define NES_QPCONTEXT_MISC_SQ_SIZE_MASK 0x00000c00
  88. #define NES_QPCONTEXT_MISC_SQ_SIZE_SHIFT 10
  89. #define NES_QPCONTEXT_MISC_PCI_FCN_MASK 0x00007000
  90. #define NES_QPCONTEXT_MISC_PCI_FCN_SHIFT 12
  91. #define NES_QPCONTEXT_MISC_DUP_ACKS_MASK 0x00070000
  92. #define NES_QPCONTEXT_MISC_DUP_ACKS_SHIFT 16
  93. enum nes_qp_context_misc_bits {
  94. NES_QPCONTEXT_MISC_RX_WQE_SIZE = 0x00000004,
  95. NES_QPCONTEXT_MISC_IPV4 = 0x00000008,
  96. NES_QPCONTEXT_MISC_DO_NOT_FRAG = 0x00000010,
  97. NES_QPCONTEXT_MISC_INSERT_VLAN = 0x00000020,
  98. NES_QPCONTEXT_MISC_DROS = 0x00008000,
  99. NES_QPCONTEXT_MISC_WSCALE = 0x00080000,
  100. NES_QPCONTEXT_MISC_KEEPALIVE = 0x00100000,
  101. NES_QPCONTEXT_MISC_TIMESTAMP = 0x00200000,
  102. NES_QPCONTEXT_MISC_SACK = 0x00400000,
  103. NES_QPCONTEXT_MISC_RDMA_WRITE_EN = 0x00800000,
  104. NES_QPCONTEXT_MISC_RDMA_READ_EN = 0x01000000,
  105. NES_QPCONTEXT_MISC_WBIND_EN = 0x10000000,
  106. NES_QPCONTEXT_MISC_FAST_REGISTER_EN = 0x20000000,
  107. NES_QPCONTEXT_MISC_PRIV_EN = 0x40000000,
  108. NES_QPCONTEXT_MISC_NO_NAGLE = 0x80000000
  109. };
  110. enum nes_qp_acc_wq_sizes {
  111. HCONTEXT_TSA_WQ_SIZE_4 = 0,
  112. HCONTEXT_TSA_WQ_SIZE_32 = 1,
  113. HCONTEXT_TSA_WQ_SIZE_128 = 2,
  114. HCONTEXT_TSA_WQ_SIZE_512 = 3
  115. };
  116. /* QP Context Misc2 Fields */
  117. #define NES_QPCONTEXT_MISC2_TTL_MASK 0x000000ff
  118. #define NES_QPCONTEXT_MISC2_TTL_SHIFT 0
  119. #define NES_QPCONTEXT_MISC2_HOP_LIMIT_MASK 0x000000ff
  120. #define NES_QPCONTEXT_MISC2_HOP_LIMIT_SHIFT 0
  121. #define NES_QPCONTEXT_MISC2_LIMIT_MASK 0x00000300
  122. #define NES_QPCONTEXT_MISC2_LIMIT_SHIFT 8
  123. #define NES_QPCONTEXT_MISC2_NIC_INDEX_MASK 0x0000fc00
  124. #define NES_QPCONTEXT_MISC2_NIC_INDEX_SHIFT 10
  125. #define NES_QPCONTEXT_MISC2_SRC_IP_MASK 0x001f0000
  126. #define NES_QPCONTEXT_MISC2_SRC_IP_SHIFT 16
  127. #define NES_QPCONTEXT_MISC2_TOS_MASK 0xff000000
  128. #define NES_QPCONTEXT_MISC2_TOS_SHIFT 24
  129. #define NES_QPCONTEXT_MISC2_TRAFFIC_CLASS_MASK 0xff000000
  130. #define NES_QPCONTEXT_MISC2_TRAFFIC_CLASS_SHIFT 24
  131. /* QP Context Tcp State/Flow Label Fields */
  132. #define NES_QPCONTEXT_TCPFLOW_FLOW_LABEL_MASK 0x000fffff
  133. #define NES_QPCONTEXT_TCPFLOW_FLOW_LABEL_SHIFT 0
  134. #define NES_QPCONTEXT_TCPFLOW_TCP_STATE_MASK 0xf0000000
  135. #define NES_QPCONTEXT_TCPFLOW_TCP_STATE_SHIFT 28
  136. enum nes_qp_tcp_state {
  137. NES_QPCONTEXT_TCPSTATE_CLOSED = 1,
  138. NES_QPCONTEXT_TCPSTATE_EST = 5,
  139. NES_QPCONTEXT_TCPSTATE_TIME_WAIT = 11,
  140. };
  141. /* QP Context PD Index/wscale Fields */
  142. #define NES_QPCONTEXT_PDWSCALE_RCV_WSCALE_MASK 0x0000000f
  143. #define NES_QPCONTEXT_PDWSCALE_RCV_WSCALE_SHIFT 0
  144. #define NES_QPCONTEXT_PDWSCALE_SND_WSCALE_MASK 0x00000f00
  145. #define NES_QPCONTEXT_PDWSCALE_SND_WSCALE_SHIFT 8
  146. #define NES_QPCONTEXT_PDWSCALE_PDINDEX_MASK 0xffff0000
  147. #define NES_QPCONTEXT_PDWSCALE_PDINDEX_SHIFT 16
  148. /* QP Context Keepalive Fields */
  149. #define NES_QPCONTEXT_KEEPALIVE_DELTA_MASK 0x0000ffff
  150. #define NES_QPCONTEXT_KEEPALIVE_DELTA_SHIFT 0
  151. #define NES_QPCONTEXT_KEEPALIVE_PROBE_CNT_MASK 0x00ff0000
  152. #define NES_QPCONTEXT_KEEPALIVE_PROBE_CNT_SHIFT 16
  153. #define NES_QPCONTEXT_KEEPALIVE_INTV_MASK 0xff000000
  154. #define NES_QPCONTEXT_KEEPALIVE_INTV_SHIFT 24
  155. /* QP Context ORD/IRD Fields */
  156. #define NES_QPCONTEXT_ORDIRD_ORDSIZE_MASK 0x0000007f
  157. #define NES_QPCONTEXT_ORDIRD_ORDSIZE_SHIFT 0
  158. #define NES_QPCONTEXT_ORDIRD_IRDSIZE_MASK 0x00030000
  159. #define NES_QPCONTEXT_ORDIRD_IRDSIZE_SHIFT 16
  160. #define NES_QPCONTEXT_ORDIRD_IWARP_MODE_MASK 0x30000000
  161. #define NES_QPCONTEXT_ORDIRD_IWARP_MODE_SHIFT 28
  162. enum nes_ord_ird_bits {
  163. NES_QPCONTEXT_ORDIRD_WRPDU = 0x02000000,
  164. NES_QPCONTEXT_ORDIRD_LSMM_PRESENT = 0x04000000,
  165. NES_QPCONTEXT_ORDIRD_ALSMM = 0x08000000,
  166. NES_QPCONTEXT_ORDIRD_AAH = 0x40000000,
  167. NES_QPCONTEXT_ORDIRD_RNMC = 0x80000000
  168. };
  169. enum nes_iwarp_qp_state {
  170. NES_QPCONTEXT_IWARP_STATE_NONEXIST = 0,
  171. NES_QPCONTEXT_IWARP_STATE_IDLE = 1,
  172. NES_QPCONTEXT_IWARP_STATE_RTS = 2,
  173. NES_QPCONTEXT_IWARP_STATE_CLOSING = 3,
  174. NES_QPCONTEXT_IWARP_STATE_TERMINATE = 5,
  175. NES_QPCONTEXT_IWARP_STATE_ERROR = 6
  176. };
  177. #endif /* NES_CONTEXT_H */