ib_pma.h 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  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. #if !defined(IB_PMA_H)
  35. #define IB_PMA_H
  36. #include <rdma/ib_mad.h>
  37. /*
  38. * PMA class portinfo capability mask bits
  39. */
  40. #define IB_PMA_CLASS_CAP_ALLPORTSELECT cpu_to_be16(1 << 8)
  41. #define IB_PMA_CLASS_CAP_EXT_WIDTH cpu_to_be16(1 << 9)
  42. #define IB_PMA_CLASS_CAP_XMIT_WAIT cpu_to_be16(1 << 12)
  43. #define IB_PMA_CLASS_PORT_INFO cpu_to_be16(0x0001)
  44. #define IB_PMA_PORT_SAMPLES_CONTROL cpu_to_be16(0x0010)
  45. #define IB_PMA_PORT_SAMPLES_RESULT cpu_to_be16(0x0011)
  46. #define IB_PMA_PORT_COUNTERS cpu_to_be16(0x0012)
  47. #define IB_PMA_PORT_COUNTERS_EXT cpu_to_be16(0x001D)
  48. #define IB_PMA_PORT_SAMPLES_RESULT_EXT cpu_to_be16(0x001E)
  49. struct ib_pma_mad {
  50. struct ib_mad_hdr mad_hdr;
  51. u8 reserved[40];
  52. u8 data[192];
  53. } __packed;
  54. struct ib_pma_portsamplescontrol {
  55. u8 opcode;
  56. u8 port_select;
  57. u8 tick;
  58. u8 counter_width; /* resv: 7:3, counter width: 2:0 */
  59. __be32 counter_mask0_9; /* 2, 10 3-bit fields */
  60. __be16 counter_mask10_14; /* 1, 5 3-bit fields */
  61. u8 sample_mechanisms;
  62. u8 sample_status; /* only lower 2 bits */
  63. __be64 option_mask;
  64. __be64 vendor_mask;
  65. __be32 sample_start;
  66. __be32 sample_interval;
  67. __be16 tag;
  68. __be16 counter_select[15];
  69. __be32 reserved1;
  70. __be64 samples_only_option_mask;
  71. __be32 reserved2[28];
  72. };
  73. struct ib_pma_portsamplesresult {
  74. __be16 tag;
  75. __be16 sample_status; /* only lower 2 bits */
  76. __be32 counter[15];
  77. };
  78. struct ib_pma_portsamplesresult_ext {
  79. __be16 tag;
  80. __be16 sample_status; /* only lower 2 bits */
  81. __be32 extended_width; /* only upper 2 bits */
  82. __be64 counter[15];
  83. };
  84. struct ib_pma_portcounters {
  85. u8 reserved;
  86. u8 port_select;
  87. __be16 counter_select;
  88. __be16 symbol_error_counter;
  89. u8 link_error_recovery_counter;
  90. u8 link_downed_counter;
  91. __be16 port_rcv_errors;
  92. __be16 port_rcv_remphys_errors;
  93. __be16 port_rcv_switch_relay_errors;
  94. __be16 port_xmit_discards;
  95. u8 port_xmit_constraint_errors;
  96. u8 port_rcv_constraint_errors;
  97. u8 reserved1;
  98. u8 link_overrun_errors; /* LocalLink: 7:4, BufferOverrun: 3:0 */
  99. __be16 reserved2;
  100. __be16 vl15_dropped;
  101. __be32 port_xmit_data;
  102. __be32 port_rcv_data;
  103. __be32 port_xmit_packets;
  104. __be32 port_rcv_packets;
  105. __be32 port_xmit_wait;
  106. } __packed;
  107. #define IB_PMA_SEL_SYMBOL_ERROR cpu_to_be16(0x0001)
  108. #define IB_PMA_SEL_LINK_ERROR_RECOVERY cpu_to_be16(0x0002)
  109. #define IB_PMA_SEL_LINK_DOWNED cpu_to_be16(0x0004)
  110. #define IB_PMA_SEL_PORT_RCV_ERRORS cpu_to_be16(0x0008)
  111. #define IB_PMA_SEL_PORT_RCV_REMPHYS_ERRORS cpu_to_be16(0x0010)
  112. #define IB_PMA_SEL_PORT_XMIT_DISCARDS cpu_to_be16(0x0040)
  113. #define IB_PMA_SEL_LOCAL_LINK_INTEGRITY_ERRORS cpu_to_be16(0x0200)
  114. #define IB_PMA_SEL_EXCESSIVE_BUFFER_OVERRUNS cpu_to_be16(0x0400)
  115. #define IB_PMA_SEL_PORT_VL15_DROPPED cpu_to_be16(0x0800)
  116. #define IB_PMA_SEL_PORT_XMIT_DATA cpu_to_be16(0x1000)
  117. #define IB_PMA_SEL_PORT_RCV_DATA cpu_to_be16(0x2000)
  118. #define IB_PMA_SEL_PORT_XMIT_PACKETS cpu_to_be16(0x4000)
  119. #define IB_PMA_SEL_PORT_RCV_PACKETS cpu_to_be16(0x8000)
  120. struct ib_pma_portcounters_ext {
  121. u8 reserved;
  122. u8 port_select;
  123. __be16 counter_select;
  124. __be32 reserved1;
  125. __be64 port_xmit_data;
  126. __be64 port_rcv_data;
  127. __be64 port_xmit_packets;
  128. __be64 port_rcv_packets;
  129. __be64 port_unicast_xmit_packets;
  130. __be64 port_unicast_rcv_packets;
  131. __be64 port_multicast_xmit_packets;
  132. __be64 port_multicast_rcv_packets;
  133. } __packed;
  134. #define IB_PMA_SELX_PORT_XMIT_DATA cpu_to_be16(0x0001)
  135. #define IB_PMA_SELX_PORT_RCV_DATA cpu_to_be16(0x0002)
  136. #define IB_PMA_SELX_PORT_XMIT_PACKETS cpu_to_be16(0x0004)
  137. #define IB_PMA_SELX_PORT_RCV_PACKETS cpu_to_be16(0x0008)
  138. #define IB_PMA_SELX_PORT_UNI_XMIT_PACKETS cpu_to_be16(0x0010)
  139. #define IB_PMA_SELX_PORT_UNI_RCV_PACKETS cpu_to_be16(0x0020)
  140. #define IB_PMA_SELX_PORT_MULTI_XMIT_PACKETS cpu_to_be16(0x0040)
  141. #define IB_PMA_SELX_PORT_MULTI_RCV_PACKETS cpu_to_be16(0x0080)
  142. #endif /* IB_PMA_H */