You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ib_mad.h 3.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. /*
  2. This software is available to you under a choice of one of two
  3. licenses. You may choose to be licensed under the terms of the GNU
  4. General Public License (GPL) Version 2, available at
  5. <http://www.fsf.org/copyleft/gpl.html>, or the OpenIB.org BSD
  6. license, available in the LICENSE.TXT file accompanying this
  7. software. These details are also available at
  8. <http://openib.org/license.html>.
  9. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  10. EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  11. MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  12. NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  13. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  14. ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  15. CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  16. SOFTWARE.
  17. Copyright (c) 2004 Mellanox Technologies Ltd. All rights reserved.
  18. */
  19. #ifndef __ib_mad_h__
  20. #define __ib_mad_h__
  21. #include "ib_driver.h"
  22. /* Management base version */
  23. #define IB_MGMT_BASE_VERSION 1
  24. /* Management classes */
  25. #define IB_MGMT_CLASS_SUBN_LID_ROUTED 0x01
  26. #define IB_MGMT_CLASS_SUBN_DIRECTED_ROUTE 0x81
  27. #define IB_MGMT_CLASS_SUBN_ADM 0x03
  28. #define IB_MGMT_CLASS_PERF_MGMT 0x04
  29. #define IB_MGMT_CLASS_BM 0x05
  30. #define IB_MGMT_CLASS_DEVICE_MGMT 0x06
  31. #define IB_MGMT_CLASS_CM 0x07
  32. #define IB_MGMT_CLASS_SNMP 0x08
  33. #define IB_MGMT_CLASS_VENDOR_RANGE2_START 0x30
  34. #define IB_MGMT_CLASS_VENDOR_RANGE2_END 0x4F
  35. /* Management methods */
  36. #define IB_MGMT_METHOD_GET 0x01
  37. #define IB_MGMT_METHOD_SET 0x02
  38. #define IB_MGMT_METHOD_GET_RESP 0x81
  39. #define IB_MGMT_METHOD_SEND 0x03
  40. #define IB_MGMT_METHOD_TRAP 0x05
  41. #define IB_MGMT_METHOD_REPORT 0x06
  42. #define IB_MGMT_METHOD_REPORT_RESP 0x86
  43. #define IB_MGMT_METHOD_TRAP_REPRESS 0x07
  44. #define IB_MGMT_METHOD_DELETE 0x15
  45. #define IB_MGMT_METHOD_RESP 0x80
  46. /* Subnet management attributes */
  47. #define IB_SMP_ATTR_NOTICE 0x0002
  48. #define IB_SMP_ATTR_NODE_DESC 0x0010
  49. #define IB_SMP_ATTR_NODE_INFO 0x0011
  50. #define IB_SMP_ATTR_SWITCH_INFO 0x0012
  51. #define IB_SMP_ATTR_GUID_INFO 0x0014
  52. #define IB_SMP_ATTR_PORT_INFO 0x0015
  53. #define IB_SMP_ATTR_PKEY_TABLE 0x0016
  54. #define IB_SMP_ATTR_SL_TO_VL_TABLE 0x0017
  55. #define IB_SMP_ATTR_VL_ARB_TABLE 0x0018
  56. #define IB_SMP_ATTR_LINEAR_FORWARD_TABLE 0x0019
  57. #define IB_SMP_ATTR_RANDOM_FORWARD_TABLE 0x001A
  58. #define IB_SMP_ATTR_MCAST_FORWARD_TABLE 0x001B
  59. #define IB_SMP_ATTR_SM_INFO 0x0020
  60. #define IB_SMP_ATTR_VENDOR_DIAG 0x0030
  61. #define IB_SMP_ATTR_LED_INFO 0x0031
  62. #define IB_SMP_ATTR_VENDOR_MASK 0xFF00
  63. struct ib_mad_hdr_st {
  64. __u8 method;
  65. __u8 class_version;
  66. __u8 mgmt_class;
  67. __u8 base_version;
  68. __u16 class_specific;
  69. __u16 status;
  70. __u32 tid[2];
  71. __u16 resv;
  72. __u16 attr_id;
  73. __u32 attr_mod;
  74. } __attribute__ ((packed));
  75. struct rmpp_hdr_st {
  76. __u32 raw[3];
  77. } __attribute__ ((packed));
  78. struct sa_header_st {
  79. __u32 sm_key[2];
  80. __u16 attrib_offset;
  81. __u16 r0;
  82. __u32 comp_mask[2];
  83. } __attribute__ ((packed));
  84. struct ib_mad_st {
  85. struct ib_mad_hdr_st mad_hdr;
  86. __u8 data[232];
  87. } __attribute__ ((packed));
  88. union mad_u {
  89. __u8 raw[256];
  90. struct ib_mad_st mad;
  91. } __attribute__ ((packed));
  92. static int get_path_record(union ib_gid_u *dgid, __u16 * dlid_p, __u8 * sl_p,
  93. __u8 * rate_p);
  94. #endif /* __ib_mad_h__ */