ib_pma.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. /* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
  2. /*
  3. * Copyright (c) 2006, 2007, 2008, 2009, 2010 QLogic Corporation.
  4. * All rights reserved.
  5. * Copyright (c) 2005, 2006 PathScale, Inc. All rights reserved.
  6. */
  7. #ifndef IB_PMA_H
  8. #define IB_PMA_H
  9. #include <rdma/ib_mad.h>
  10. /*
  11. * PMA class portinfo capability mask bits
  12. */
  13. #define IB_PMA_CLASS_CAP_ALLPORTSELECT cpu_to_be16(1 << 8)
  14. #define IB_PMA_CLASS_CAP_EXT_WIDTH cpu_to_be16(1 << 9)
  15. #define IB_PMA_CLASS_CAP_EXT_WIDTH_NOIETF cpu_to_be16(1 << 10)
  16. #define IB_PMA_CLASS_CAP_XMIT_WAIT cpu_to_be16(1 << 12)
  17. #define IB_PMA_CLASS_PORT_INFO cpu_to_be16(0x0001)
  18. #define IB_PMA_PORT_SAMPLES_CONTROL cpu_to_be16(0x0010)
  19. #define IB_PMA_PORT_SAMPLES_RESULT cpu_to_be16(0x0011)
  20. #define IB_PMA_PORT_COUNTERS cpu_to_be16(0x0012)
  21. #define IB_PMA_PORT_COUNTERS_EXT cpu_to_be16(0x001D)
  22. #define IB_PMA_PORT_SAMPLES_RESULT_EXT cpu_to_be16(0x001E)
  23. struct ib_pma_mad {
  24. struct ib_mad_hdr mad_hdr;
  25. u8 reserved[40];
  26. u8 data[192];
  27. } __packed;
  28. struct ib_pma_portsamplescontrol {
  29. u8 opcode;
  30. u8 port_select;
  31. u8 tick;
  32. u8 counter_width; /* resv: 7:3, counter width: 2:0 */
  33. __be32 counter_mask0_9; /* 2, 10 3-bit fields */
  34. __be16 counter_mask10_14; /* 1, 5 3-bit fields */
  35. u8 sample_mechanisms;
  36. u8 sample_status; /* only lower 2 bits */
  37. __be64 option_mask;
  38. __be64 vendor_mask;
  39. __be32 sample_start;
  40. __be32 sample_interval;
  41. __be16 tag;
  42. __be16 counter_select[15];
  43. __be32 reserved1;
  44. __be64 samples_only_option_mask;
  45. __be32 reserved2[28];
  46. };
  47. struct ib_pma_portsamplesresult {
  48. __be16 tag;
  49. __be16 sample_status; /* only lower 2 bits */
  50. __be32 counter[15];
  51. };
  52. struct ib_pma_portsamplesresult_ext {
  53. __be16 tag;
  54. __be16 sample_status; /* only lower 2 bits */
  55. __be32 extended_width; /* only upper 2 bits */
  56. __be64 counter[15];
  57. };
  58. struct ib_pma_portcounters {
  59. u8 reserved;
  60. u8 port_select;
  61. __be16 counter_select;
  62. __be16 symbol_error_counter;
  63. u8 link_error_recovery_counter;
  64. u8 link_downed_counter;
  65. __be16 port_rcv_errors;
  66. __be16 port_rcv_remphys_errors;
  67. __be16 port_rcv_switch_relay_errors;
  68. __be16 port_xmit_discards;
  69. u8 port_xmit_constraint_errors;
  70. u8 port_rcv_constraint_errors;
  71. u8 reserved1;
  72. u8 link_overrun_errors; /* LocalLink: 7:4, BufferOverrun: 3:0 */
  73. __be16 reserved2;
  74. __be16 vl15_dropped;
  75. __be32 port_xmit_data;
  76. __be32 port_rcv_data;
  77. __be32 port_xmit_packets;
  78. __be32 port_rcv_packets;
  79. __be32 port_xmit_wait;
  80. } __packed;
  81. #define IB_PMA_SEL_SYMBOL_ERROR cpu_to_be16(0x0001)
  82. #define IB_PMA_SEL_LINK_ERROR_RECOVERY cpu_to_be16(0x0002)
  83. #define IB_PMA_SEL_LINK_DOWNED cpu_to_be16(0x0004)
  84. #define IB_PMA_SEL_PORT_RCV_ERRORS cpu_to_be16(0x0008)
  85. #define IB_PMA_SEL_PORT_RCV_REMPHYS_ERRORS cpu_to_be16(0x0010)
  86. #define IB_PMA_SEL_PORT_XMIT_DISCARDS cpu_to_be16(0x0040)
  87. #define IB_PMA_SEL_LOCAL_LINK_INTEGRITY_ERRORS cpu_to_be16(0x0200)
  88. #define IB_PMA_SEL_EXCESSIVE_BUFFER_OVERRUNS cpu_to_be16(0x0400)
  89. #define IB_PMA_SEL_PORT_VL15_DROPPED cpu_to_be16(0x0800)
  90. #define IB_PMA_SEL_PORT_XMIT_DATA cpu_to_be16(0x1000)
  91. #define IB_PMA_SEL_PORT_RCV_DATA cpu_to_be16(0x2000)
  92. #define IB_PMA_SEL_PORT_XMIT_PACKETS cpu_to_be16(0x4000)
  93. #define IB_PMA_SEL_PORT_RCV_PACKETS cpu_to_be16(0x8000)
  94. struct ib_pma_portcounters_ext {
  95. u8 reserved;
  96. u8 port_select;
  97. __be16 counter_select;
  98. __be32 reserved1;
  99. __be64 port_xmit_data;
  100. __be64 port_rcv_data;
  101. __be64 port_xmit_packets;
  102. __be64 port_rcv_packets;
  103. __be64 port_unicast_xmit_packets;
  104. __be64 port_unicast_rcv_packets;
  105. __be64 port_multicast_xmit_packets;
  106. __be64 port_multicast_rcv_packets;
  107. } __packed;
  108. #define IB_PMA_SELX_PORT_XMIT_DATA cpu_to_be16(0x0001)
  109. #define IB_PMA_SELX_PORT_RCV_DATA cpu_to_be16(0x0002)
  110. #define IB_PMA_SELX_PORT_XMIT_PACKETS cpu_to_be16(0x0004)
  111. #define IB_PMA_SELX_PORT_RCV_PACKETS cpu_to_be16(0x0008)
  112. #define IB_PMA_SELX_PORT_UNI_XMIT_PACKETS cpu_to_be16(0x0010)
  113. #define IB_PMA_SELX_PORT_UNI_RCV_PACKETS cpu_to_be16(0x0020)
  114. #define IB_PMA_SELX_PORT_MULTI_XMIT_PACKETS cpu_to_be16(0x0040)
  115. #define IB_PMA_SELX_PORT_MULTI_RCV_PACKETS cpu_to_be16(0x0080)
  116. #endif /* IB_PMA_H */