ib_smi.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. /* SPDX-License-Identifier: GPL-2.0 OR Linux-OpenIB */
  2. /*
  3. * Copyright (c) 2004 Mellanox Technologies Ltd. All rights reserved.
  4. * Copyright (c) 2004 Infinicon Corporation. All rights reserved.
  5. * Copyright (c) 2004 Intel Corporation. All rights reserved.
  6. * Copyright (c) 2004 Topspin Corporation. All rights reserved.
  7. * Copyright (c) 2004 Voltaire Corporation. All rights reserved.
  8. */
  9. #ifndef IB_SMI_H
  10. #define IB_SMI_H
  11. #include <rdma/ib_mad.h>
  12. #define IB_SMP_DATA_SIZE 64
  13. #define IB_SMP_MAX_PATH_HOPS 64
  14. struct ib_smp {
  15. u8 base_version;
  16. u8 mgmt_class;
  17. u8 class_version;
  18. u8 method;
  19. __be16 status;
  20. u8 hop_ptr;
  21. u8 hop_cnt;
  22. __be64 tid;
  23. __be16 attr_id;
  24. __be16 resv;
  25. __be32 attr_mod;
  26. __be64 mkey;
  27. __be16 dr_slid;
  28. __be16 dr_dlid;
  29. u8 reserved[28];
  30. u8 data[IB_SMP_DATA_SIZE];
  31. u8 initial_path[IB_SMP_MAX_PATH_HOPS];
  32. u8 return_path[IB_SMP_MAX_PATH_HOPS];
  33. } __packed;
  34. #define IB_SMP_DIRECTION cpu_to_be16(0x8000)
  35. /* Subnet management attributes */
  36. #define IB_SMP_ATTR_NOTICE cpu_to_be16(0x0002)
  37. #define IB_SMP_ATTR_NODE_DESC cpu_to_be16(0x0010)
  38. #define IB_SMP_ATTR_NODE_INFO cpu_to_be16(0x0011)
  39. #define IB_SMP_ATTR_SWITCH_INFO cpu_to_be16(0x0012)
  40. #define IB_SMP_ATTR_GUID_INFO cpu_to_be16(0x0014)
  41. #define IB_SMP_ATTR_PORT_INFO cpu_to_be16(0x0015)
  42. #define IB_SMP_ATTR_PKEY_TABLE cpu_to_be16(0x0016)
  43. #define IB_SMP_ATTR_SL_TO_VL_TABLE cpu_to_be16(0x0017)
  44. #define IB_SMP_ATTR_VL_ARB_TABLE cpu_to_be16(0x0018)
  45. #define IB_SMP_ATTR_LINEAR_FORWARD_TABLE cpu_to_be16(0x0019)
  46. #define IB_SMP_ATTR_RANDOM_FORWARD_TABLE cpu_to_be16(0x001A)
  47. #define IB_SMP_ATTR_MCAST_FORWARD_TABLE cpu_to_be16(0x001B)
  48. #define IB_SMP_ATTR_SM_INFO cpu_to_be16(0x0020)
  49. #define IB_SMP_ATTR_VENDOR_DIAG cpu_to_be16(0x0030)
  50. #define IB_SMP_ATTR_LED_INFO cpu_to_be16(0x0031)
  51. #define IB_SMP_ATTR_VENDOR_MASK cpu_to_be16(0xFF00)
  52. struct ib_port_info {
  53. __be64 mkey;
  54. __be64 gid_prefix;
  55. __be16 lid;
  56. __be16 sm_lid;
  57. __be32 cap_mask;
  58. __be16 diag_code;
  59. __be16 mkey_lease_period;
  60. u8 local_port_num;
  61. u8 link_width_enabled;
  62. u8 link_width_supported;
  63. u8 link_width_active;
  64. u8 linkspeed_portstate; /* 4 bits, 4 bits */
  65. u8 portphysstate_linkdown; /* 4 bits, 4 bits */
  66. u8 mkeyprot_resv_lmc; /* 2 bits, 3, 3 */
  67. u8 linkspeedactive_enabled; /* 4 bits, 4 bits */
  68. u8 neighbormtu_mastersmsl; /* 4 bits, 4 bits */
  69. u8 vlcap_inittype; /* 4 bits, 4 bits */
  70. u8 vl_high_limit;
  71. u8 vl_arb_high_cap;
  72. u8 vl_arb_low_cap;
  73. u8 inittypereply_mtucap; /* 4 bits, 4 bits */
  74. u8 vlstallcnt_hoqlife; /* 3 bits, 5 bits */
  75. u8 operationalvl_pei_peo_fpi_fpo; /* 4 bits, 1, 1, 1, 1 */
  76. __be16 mkey_violations;
  77. __be16 pkey_violations;
  78. __be16 qkey_violations;
  79. u8 guid_cap;
  80. u8 clientrereg_resv_subnetto; /* 1 bit, 2 bits, 5 */
  81. u8 resv_resptimevalue; /* 3 bits, 5 bits */
  82. u8 localphyerrors_overrunerrors; /* 4 bits, 4 bits */
  83. __be16 max_credit_hint;
  84. u8 resv;
  85. u8 link_roundtrip_latency[3];
  86. };
  87. struct ib_node_info {
  88. u8 base_version;
  89. u8 class_version;
  90. u8 node_type;
  91. u8 num_ports;
  92. __be64 sys_guid;
  93. __be64 node_guid;
  94. __be64 port_guid;
  95. __be16 partition_cap;
  96. __be16 device_id;
  97. __be32 revision;
  98. u8 local_port_num;
  99. u8 vendor_id[3];
  100. } __packed;
  101. struct ib_vl_weight_elem {
  102. u8 vl; /* IB: VL is low 4 bits, upper 4 bits reserved */
  103. /* OPA: VL is low 5 bits, upper 3 bits reserved */
  104. u8 weight;
  105. };
  106. static inline u8
  107. ib_get_smp_direction(struct ib_smp *smp)
  108. {
  109. return ((smp->status & IB_SMP_DIRECTION) == IB_SMP_DIRECTION);
  110. }
  111. /*
  112. * SM Trap/Notice numbers
  113. */
  114. #define IB_NOTICE_TRAP_LLI_THRESH cpu_to_be16(129)
  115. #define IB_NOTICE_TRAP_EBO_THRESH cpu_to_be16(130)
  116. #define IB_NOTICE_TRAP_FLOW_UPDATE cpu_to_be16(131)
  117. #define IB_NOTICE_TRAP_CAP_MASK_CHG cpu_to_be16(144)
  118. #define IB_NOTICE_TRAP_SYS_GUID_CHG cpu_to_be16(145)
  119. #define IB_NOTICE_TRAP_BAD_MKEY cpu_to_be16(256)
  120. #define IB_NOTICE_TRAP_BAD_PKEY cpu_to_be16(257)
  121. #define IB_NOTICE_TRAP_BAD_QKEY cpu_to_be16(258)
  122. /*
  123. * Other local changes flags (trap 144).
  124. */
  125. #define IB_NOTICE_TRAP_LSE_CHG 0x04 /* Link Speed Enable changed */
  126. #define IB_NOTICE_TRAP_LWE_CHG 0x02 /* Link Width Enable changed */
  127. #define IB_NOTICE_TRAP_NODE_DESC_CHG 0x01
  128. /*
  129. * M_Key volation flags in dr_trunc_hop (trap 256).
  130. */
  131. #define IB_NOTICE_TRAP_DR_NOTICE 0x80
  132. #define IB_NOTICE_TRAP_DR_TRUNC 0x40
  133. #endif /* IB_SMI_H */