qib_mad.h 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  1. /*
  2. * Copyright (c) 2006, 2007, 2008, 2009, 2010 QLogic Corporation.
  3. * All rights reserved.
  4. * Copyright (c) 2005, 2006 PathScale, Inc. All rights reserved.
  5. *
  6. * This software is available to you under a choice of one of two
  7. * licenses. You may choose to be licensed under the terms of the GNU
  8. * General Public License (GPL) Version 2, available from the file
  9. * COPYING in the main directory of this source tree, or the
  10. * OpenIB.org BSD license below:
  11. *
  12. * Redistribution and use in source and binary forms, with or
  13. * without modification, are permitted provided that the following
  14. * conditions are met:
  15. *
  16. * - Redistributions of source code must retain the above
  17. * copyright notice, this list of conditions and the following
  18. * disclaimer.
  19. *
  20. * - Redistributions in binary form must reproduce the above
  21. * copyright notice, this list of conditions and the following
  22. * disclaimer in the documentation and/or other materials
  23. * provided with the distribution.
  24. *
  25. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  26. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  27. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  28. * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  29. * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  30. * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  31. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  32. * SOFTWARE.
  33. */
  34. #include <rdma/ib_pma.h>
  35. #define IB_SMP_UNSUP_VERSION cpu_to_be16(0x0004)
  36. #define IB_SMP_UNSUP_METHOD cpu_to_be16(0x0008)
  37. #define IB_SMP_UNSUP_METH_ATTR cpu_to_be16(0x000C)
  38. #define IB_SMP_INVALID_FIELD cpu_to_be16(0x001C)
  39. struct ib_node_info {
  40. u8 base_version;
  41. u8 class_version;
  42. u8 node_type;
  43. u8 num_ports;
  44. __be64 sys_guid;
  45. __be64 node_guid;
  46. __be64 port_guid;
  47. __be16 partition_cap;
  48. __be16 device_id;
  49. __be32 revision;
  50. u8 local_port_num;
  51. u8 vendor_id[3];
  52. } __attribute__ ((packed));
  53. struct ib_mad_notice_attr {
  54. u8 generic_type;
  55. u8 prod_type_msb;
  56. __be16 prod_type_lsb;
  57. __be16 trap_num;
  58. __be16 issuer_lid;
  59. __be16 toggle_count;
  60. union {
  61. struct {
  62. u8 details[54];
  63. } raw_data;
  64. struct {
  65. __be16 reserved;
  66. __be16 lid; /* where violation happened */
  67. u8 port_num; /* where violation happened */
  68. } __attribute__ ((packed)) ntc_129_131;
  69. struct {
  70. __be16 reserved;
  71. __be16 lid; /* LID where change occurred */
  72. u8 reserved2;
  73. u8 local_changes; /* low bit - local changes */
  74. __be32 new_cap_mask; /* new capability mask */
  75. u8 reserved3;
  76. u8 change_flags; /* low 3 bits only */
  77. } __attribute__ ((packed)) ntc_144;
  78. struct {
  79. __be16 reserved;
  80. __be16 lid; /* lid where sys guid changed */
  81. __be16 reserved2;
  82. __be64 new_sys_guid;
  83. } __attribute__ ((packed)) ntc_145;
  84. struct {
  85. __be16 reserved;
  86. __be16 lid;
  87. __be16 dr_slid;
  88. u8 method;
  89. u8 reserved2;
  90. __be16 attr_id;
  91. __be32 attr_mod;
  92. __be64 mkey;
  93. u8 reserved3;
  94. u8 dr_trunc_hop;
  95. u8 dr_rtn_path[30];
  96. } __attribute__ ((packed)) ntc_256;
  97. struct {
  98. __be16 reserved;
  99. __be16 lid1;
  100. __be16 lid2;
  101. __be32 key;
  102. __be32 sl_qp1; /* SL: high 4 bits */
  103. __be32 qp2; /* high 8 bits reserved */
  104. union ib_gid gid1;
  105. union ib_gid gid2;
  106. } __attribute__ ((packed)) ntc_257_258;
  107. } details;
  108. };
  109. /*
  110. * Generic trap/notice types
  111. */
  112. #define IB_NOTICE_TYPE_FATAL 0x80
  113. #define IB_NOTICE_TYPE_URGENT 0x81
  114. #define IB_NOTICE_TYPE_SECURITY 0x82
  115. #define IB_NOTICE_TYPE_SM 0x83
  116. #define IB_NOTICE_TYPE_INFO 0x84
  117. /*
  118. * Generic trap/notice producers
  119. */
  120. #define IB_NOTICE_PROD_CA cpu_to_be16(1)
  121. #define IB_NOTICE_PROD_SWITCH cpu_to_be16(2)
  122. #define IB_NOTICE_PROD_ROUTER cpu_to_be16(3)
  123. #define IB_NOTICE_PROD_CLASS_MGR cpu_to_be16(4)
  124. /*
  125. * Generic trap/notice numbers
  126. */
  127. #define IB_NOTICE_TRAP_LLI_THRESH cpu_to_be16(129)
  128. #define IB_NOTICE_TRAP_EBO_THRESH cpu_to_be16(130)
  129. #define IB_NOTICE_TRAP_FLOW_UPDATE cpu_to_be16(131)
  130. #define IB_NOTICE_TRAP_CAP_MASK_CHG cpu_to_be16(144)
  131. #define IB_NOTICE_TRAP_SYS_GUID_CHG cpu_to_be16(145)
  132. #define IB_NOTICE_TRAP_BAD_MKEY cpu_to_be16(256)
  133. #define IB_NOTICE_TRAP_BAD_PKEY cpu_to_be16(257)
  134. #define IB_NOTICE_TRAP_BAD_QKEY cpu_to_be16(258)
  135. /*
  136. * Repress trap/notice flags
  137. */
  138. #define IB_NOTICE_REPRESS_LLI_THRESH (1 << 0)
  139. #define IB_NOTICE_REPRESS_EBO_THRESH (1 << 1)
  140. #define IB_NOTICE_REPRESS_FLOW_UPDATE (1 << 2)
  141. #define IB_NOTICE_REPRESS_CAP_MASK_CHG (1 << 3)
  142. #define IB_NOTICE_REPRESS_SYS_GUID_CHG (1 << 4)
  143. #define IB_NOTICE_REPRESS_BAD_MKEY (1 << 5)
  144. #define IB_NOTICE_REPRESS_BAD_PKEY (1 << 6)
  145. #define IB_NOTICE_REPRESS_BAD_QKEY (1 << 7)
  146. /*
  147. * Generic trap/notice other local changes flags (trap 144).
  148. */
  149. #define IB_NOTICE_TRAP_LSE_CHG 0x04 /* Link Speed Enable changed */
  150. #define IB_NOTICE_TRAP_LWE_CHG 0x02 /* Link Width Enable changed */
  151. #define IB_NOTICE_TRAP_NODE_DESC_CHG 0x01
  152. /*
  153. * Generic trap/notice M_Key volation flags in dr_trunc_hop (trap 256).
  154. */
  155. #define IB_NOTICE_TRAP_DR_NOTICE 0x80
  156. #define IB_NOTICE_TRAP_DR_TRUNC 0x40
  157. struct ib_vl_weight_elem {
  158. u8 vl; /* Only low 4 bits, upper 4 bits reserved */
  159. u8 weight;
  160. };
  161. #define IB_VLARB_LOWPRI_0_31 1
  162. #define IB_VLARB_LOWPRI_32_63 2
  163. #define IB_VLARB_HIGHPRI_0_31 3
  164. #define IB_VLARB_HIGHPRI_32_63 4
  165. #define IB_PMA_PORT_COUNTERS_CONG cpu_to_be16(0xFF00)
  166. struct ib_pma_portcounters_cong {
  167. u8 reserved;
  168. u8 reserved1;
  169. __be16 port_check_rate;
  170. __be16 symbol_error_counter;
  171. u8 link_error_recovery_counter;
  172. u8 link_downed_counter;
  173. __be16 port_rcv_errors;
  174. __be16 port_rcv_remphys_errors;
  175. __be16 port_rcv_switch_relay_errors;
  176. __be16 port_xmit_discards;
  177. u8 port_xmit_constraint_errors;
  178. u8 port_rcv_constraint_errors;
  179. u8 reserved2;
  180. u8 link_overrun_errors; /* LocalLink: 7:4, BufferOverrun: 3:0 */
  181. __be16 reserved3;
  182. __be16 vl15_dropped;
  183. __be64 port_xmit_data;
  184. __be64 port_rcv_data;
  185. __be64 port_xmit_packets;
  186. __be64 port_rcv_packets;
  187. __be64 port_xmit_wait;
  188. __be64 port_adr_events;
  189. } __attribute__ ((packed));
  190. #define IB_PMA_CONG_HW_CONTROL_TIMER 0x00
  191. #define IB_PMA_CONG_HW_CONTROL_SAMPLE 0x01
  192. #define QIB_XMIT_RATE_UNSUPPORTED 0x0
  193. #define QIB_XMIT_RATE_PICO 0x7
  194. /* number of 4nsec cycles equaling 2secs */
  195. #define QIB_CONG_TIMER_PSINTERVAL 0x1DCD64EC
  196. #define IB_PMA_SEL_CONG_ALL 0x01
  197. #define IB_PMA_SEL_CONG_PORT_DATA 0x02
  198. #define IB_PMA_SEL_CONG_XMIT 0x04
  199. #define IB_PMA_SEL_CONG_ROUTING 0x08
  200. /*
  201. * The PortSamplesControl.CounterMasks field is an array of 3 bit fields
  202. * which specify the N'th counter's capabilities. See ch. 16.1.3.2.
  203. * We support 5 counters which only count the mandatory quantities.
  204. */
  205. #define COUNTER_MASK(q, n) (q << ((9 - n) * 3))
  206. #define COUNTER_MASK0_9 \
  207. cpu_to_be32(COUNTER_MASK(1, 0) | \
  208. COUNTER_MASK(1, 1) | \
  209. COUNTER_MASK(1, 2) | \
  210. COUNTER_MASK(1, 3) | \
  211. COUNTER_MASK(1, 4))