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.

xsigo.h 9.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406
  1. #ifndef _IPXE_XSIGO_H
  2. #define _IPXE_XSIGO_H
  3. /** @file
  4. *
  5. * Xsigo virtual Ethernet devices
  6. *
  7. */
  8. FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
  9. #include <stdint.h>
  10. #include <ipxe/infiniband.h>
  11. #include <ipxe/eoib.h>
  12. /** Xsigo directory service record name */
  13. #define XDS_SERVICE_NAME "XSIGOXDS"
  14. /** Xsigo configuration manager service ID */
  15. #define XCM_SERVICE_ID { 0x00, 0x00, 0x00, 0x00, 0x02, 0x13, 0x97, 0x01 }
  16. /** Xsigo management class */
  17. #define XSIGO_MGMT_CLASS 0x0b
  18. /** Xsigo management class version */
  19. #define XSIGO_MGMT_CLASS_VERSION 2
  20. /** Xsigo configuration manager request MAD */
  21. #define XSIGO_ATTR_XCM_REQUEST 0xb002
  22. /** Generic operating system type */
  23. #define XSIGO_OS_TYPE_GENERIC 0x40
  24. /** Xsigo virtual Ethernet broadcast GID prefix */
  25. #define XVE_PREFIX 0xff15101cUL
  26. /** Xsigo resource types */
  27. enum xsigo_resource_type {
  28. /** Virtual Ethernet resource type */
  29. XSIGO_RESOURCE_XVE = ( 1 << 6 ),
  30. /** Absence-of-high-availability "resource" type */
  31. XSIGO_RESOURCE_NO_HA = ( 1 << 4 ),
  32. };
  33. /** A Xsigo server identifier */
  34. struct xsigo_server_id {
  35. /** Virtual machine ID */
  36. uint32_t vm;
  37. /** Port GUID */
  38. union ib_guid guid;
  39. } __attribute__ (( packed ));
  40. /** A Xsigo configuration manager identifier */
  41. struct xsigo_manager_id {
  42. /** Port GUID */
  43. union ib_guid guid;
  44. /** LID */
  45. uint16_t lid;
  46. /** Reserved */
  47. uint8_t reserved[10];
  48. } __attribute__ (( packed ));
  49. /** A Xsigo configuration manager request MAD */
  50. struct xsigo_managers_request {
  51. /** MAD header */
  52. struct ib_mad_hdr mad_hdr;
  53. /** Reserved */
  54. uint8_t reserved0[32];
  55. /** Server ID */
  56. struct xsigo_server_id server;
  57. /** Hostname */
  58. char hostname[ 65 /* Seriously, guys? */ ];
  59. /** OS version */
  60. char os_version[32];
  61. /** CPU architecture */
  62. char arch[16];
  63. /** OS type */
  64. uint8_t os_type;
  65. /** Reserved */
  66. uint8_t reserved1[3];
  67. /** Firmware version */
  68. uint64_t firmware_version;
  69. /** Hardware version */
  70. uint32_t hardware_version;
  71. /** Driver version */
  72. uint32_t driver_version;
  73. /** System ID */
  74. union ib_gid system_id;
  75. /** Resource types */
  76. uint16_t resources;
  77. /** Reserved */
  78. uint8_t reserved2[2];
  79. /** Build version */
  80. char build[16];
  81. /** Reserved */
  82. uint8_t reserved3[19];
  83. } __attribute__ (( packed ));
  84. /** Resource types are present */
  85. #define XSIGO_RESOURCES_PRESENT 0x8000
  86. /** A Xsigo configuration manager reply MAD */
  87. struct xsigo_managers_reply {
  88. /** MAD header */
  89. struct ib_mad_hdr mad_hdr;
  90. /** Reserved */
  91. uint8_t reserved0[32];
  92. /** Server ID */
  93. struct xsigo_server_id server;
  94. /** Number of XCM records */
  95. uint8_t count;
  96. /** Version */
  97. uint8_t version;
  98. /** Reserved */
  99. uint8_t reserved1[2];
  100. /** Managers */
  101. struct xsigo_manager_id manager[8];
  102. /** Reserved */
  103. uint8_t reserved2[24];
  104. } __attribute__ (( packed ));
  105. /** A Xsigo MAD */
  106. union xsigo_mad {
  107. /** Generic MAD */
  108. union ib_mad mad;
  109. /** Configuration manager request */
  110. struct xsigo_managers_request request;
  111. /** Configuration manager reply */
  112. struct xsigo_managers_reply reply;
  113. } __attribute__ (( packed ));
  114. /** An XSMP node identifier */
  115. struct xsmp_node_id {
  116. /** Auxiliary ID (never used) */
  117. uint32_t aux;
  118. /** Port GUID */
  119. union ib_guid guid;
  120. } __attribute__ (( packed ));
  121. /** An XSMP message header */
  122. struct xsmp_message_header {
  123. /** Message type */
  124. uint8_t type;
  125. /** Reason code */
  126. uint8_t code;
  127. /** Length */
  128. uint16_t len;
  129. /** Sequence number */
  130. uint32_t seq;
  131. /** Source node ID */
  132. struct xsmp_node_id src;
  133. /** Destination node ID */
  134. struct xsmp_node_id dst;
  135. } __attribute__ (( packed ));
  136. /** XSMP message types */
  137. enum xsmp_message_type {
  138. /** Session message type */
  139. XSMP_TYPE_SESSION = 1,
  140. /** Virtual Ethernet message type */
  141. XSMP_TYPE_XVE = 6,
  142. };
  143. /** An XSMP session message */
  144. struct xsmp_session_message {
  145. /** Message header */
  146. struct xsmp_message_header hdr;
  147. /** Message type */
  148. uint8_t type;
  149. /** Reason code */
  150. uint8_t code;
  151. /** Length (excluding message header) */
  152. uint16_t len;
  153. /** Operating system type */
  154. uint8_t os_type;
  155. /** Reserved */
  156. uint8_t reserved0;
  157. /** Resource types */
  158. uint16_t resources;
  159. /** Driver version */
  160. uint32_t driver_version;
  161. /** Required chassis version */
  162. uint32_t chassis_version;
  163. /** Boot flags */
  164. uint32_t boot;
  165. /** Firmware version */
  166. uint64_t firmware_version;
  167. /** Hardware version */
  168. uint32_t hardware_version;
  169. /** Vendor part ID */
  170. uint32_t vendor;
  171. /** Protocol version */
  172. uint32_t xsmp_version;
  173. /** Chassis name */
  174. char chassis[32];
  175. /** Session name */
  176. char session[32];
  177. /** Reserved */
  178. uint8_t reserved1[120];
  179. } __attribute__ (( packed ));
  180. /** XSMP session message types */
  181. enum xsmp_session_type {
  182. /** Keepalive message */
  183. XSMP_SESSION_TYPE_HELLO = 1,
  184. /** Initial registration message */
  185. XSMP_SESSION_TYPE_REGISTER = 2,
  186. /** Registration confirmation message */
  187. XSMP_SESSION_TYPE_CONFIRM = 3,
  188. /** Registration rejection message */
  189. XSMP_SESSION_TYPE_REJECT = 4,
  190. /** Shutdown message */
  191. XSMP_SESSION_TYPE_SHUTDOWN = 5,
  192. };
  193. /** XSMP boot flags */
  194. enum xsmp_session_boot {
  195. /** PXE boot */
  196. XSMP_BOOT_PXE = ( 1 << 0 ),
  197. };
  198. /** XSMP virtual Ethernet channel adapter parameters */
  199. struct xsmp_xve_ca {
  200. /** Subnet prefix (little-endian) */
  201. union ib_guid prefix_le;
  202. /** Control queue pair number */
  203. uint32_t ctrl;
  204. /** Data queue pair number */
  205. uint32_t data;
  206. /** Partition key */
  207. uint16_t pkey;
  208. /** Queue key */
  209. uint16_t qkey;
  210. } __attribute__ (( packed ));
  211. /** XSMP virtual Ethernet MAC address */
  212. struct xsmp_xve_mac {
  213. /** High 16 bits */
  214. uint16_t high;
  215. /** Low 32 bits */
  216. uint32_t low;
  217. } __attribute__ (( packed ));
  218. /** An XSMP virtual Ethernet message */
  219. struct xsmp_xve_message {
  220. /** Message header */
  221. struct xsmp_message_header hdr;
  222. /** Message type */
  223. uint8_t type;
  224. /** Reason code */
  225. uint8_t code;
  226. /** Length (excluding message header) */
  227. uint16_t len;
  228. /** Update bitmask */
  229. uint32_t update;
  230. /** Resource identifier */
  231. union ib_guid resource;
  232. /** TCA GUID (little-endian) */
  233. union ib_guid guid_le;
  234. /** TCA LID */
  235. uint16_t lid;
  236. /** MAC address (little-endian) */
  237. struct xsmp_xve_mac mac_le;
  238. /** Rate */
  239. uint16_t rate;
  240. /** Administrative state (non-zero = "up") */
  241. uint16_t state;
  242. /** Encapsulation (apparently obsolete and unused) */
  243. uint16_t encap;
  244. /** MTU */
  245. uint16_t mtu;
  246. /** Installation flags (apparently obsolete and unused) */
  247. uint32_t install;
  248. /** Interface name */
  249. char name[16];
  250. /** Service level */
  251. uint16_t sl;
  252. /** Flow control enabled (apparently obsolete and unused) */
  253. uint16_t flow;
  254. /** Committed rate (in Mbps) */
  255. uint16_t committed_mbps;
  256. /** Peak rate (in Mbps) */
  257. uint16_t peak_mbps;
  258. /** Committed burst size (in bytes) */
  259. uint32_t committed_burst;
  260. /** Peak burst size (in bytes) */
  261. uint32_t peak_burst;
  262. /** VMware index */
  263. uint8_t vmware;
  264. /** Reserved */
  265. uint8_t reserved0;
  266. /** Multipath flags */
  267. uint16_t multipath;
  268. /** Multipath group name */
  269. char group[48];
  270. /** Link aggregation flag */
  271. uint8_t agg;
  272. /** Link aggregation policy */
  273. uint8_t policy;
  274. /** Network ID */
  275. uint32_t network;
  276. /** Mode */
  277. uint8_t mode;
  278. /** Uplink type */
  279. uint8_t uplink;
  280. /** Target channel adapter parameters */
  281. struct xsmp_xve_ca tca;
  282. /** Host channel adapter parameters */
  283. struct xsmp_xve_ca hca;
  284. /** Reserved */
  285. uint8_t reserved1[336];
  286. } __attribute__ (( packed ));
  287. /** XSMP virtual Ethernet message types */
  288. enum xsmp_xve_type {
  289. /** Install virtual NIC */
  290. XSMP_XVE_TYPE_INSTALL = 1,
  291. /** Delete virtual NIC */
  292. XSMP_XVE_TYPE_DELETE = 2,
  293. /** Update virtual NIC */
  294. XSMP_XVE_TYPE_UPDATE = 3,
  295. /** Set operational state up */
  296. XSMP_XVE_TYPE_OPER_UP = 6,
  297. /** Set operational state down */
  298. XSMP_XVE_TYPE_OPER_DOWN = 7,
  299. /** Get operational state */
  300. XSMP_XVE_TYPE_OPER_REQ = 15,
  301. /** Virtual NIC is ready */
  302. XSMP_XVE_TYPE_READY = 20,
  303. };
  304. /** XSMP virtual Ethernet message codes */
  305. enum xsmp_xve_code {
  306. /* Something went wrong */
  307. XSMP_XVE_CODE_ERROR = 0x84,
  308. };
  309. /** XSMP virtual Ethernet update bitmask */
  310. enum xsmp_xve_update {
  311. /** Update MTU */
  312. XSMP_XVE_UPDATE_MTU = ( 1 << 2 ),
  313. /** Update administrative state */
  314. XSMP_XVE_UPDATE_STATE = ( 1 << 6 ),
  315. /** Update gateway to mark as down */
  316. XSMP_XVE_UPDATE_GW_DOWN = ( 1 << 30 ),
  317. /** Update gateway information */
  318. XSMP_XVE_UPDATE_GW_CHANGE = ( 1 << 31 ),
  319. };
  320. /** XSMP virtual Ethernet modes */
  321. enum xsmp_xve_mode {
  322. /** Reliable Connected */
  323. XSMP_XVE_MODE_RC = 1,
  324. /** Unreliable Datagram */
  325. XSMP_XVE_MODE_UD = 2,
  326. };
  327. /** XSMP virtual Ethernet uplink types */
  328. enum xsmp_xve_uplink {
  329. /** No uplink */
  330. XSMP_XVE_NO_UPLINK = 1,
  331. /** Has uplink */
  332. XSMP_XVE_UPLINK = 2,
  333. };
  334. /** An XSMP message */
  335. union xsmp_message {
  336. /** Message header */
  337. struct xsmp_message_header hdr;
  338. /** Session message */
  339. struct xsmp_session_message sess;
  340. /** Virtual Ethernet message */
  341. struct xsmp_xve_message xve;
  342. };
  343. /** Delay between attempts to open the Infiniband device
  344. *
  345. * This is a policy decision.
  346. */
  347. #define XSIGO_OPEN_RETRY_DELAY ( 2 * TICKS_PER_SEC )
  348. /** Delay between unsuccessful discovery attempts
  349. *
  350. * This is a policy decision.
  351. */
  352. #define XSIGO_DISCOVERY_FAILURE_DELAY ( 10 * TICKS_PER_SEC )
  353. /** Delay between successful discovery attempts
  354. *
  355. * This is a policy decision.
  356. */
  357. #define XSIGO_DISCOVERY_SUCCESS_DELAY ( 20 * TICKS_PER_SEC )
  358. /** Delay between keepalive requests
  359. *
  360. * This is a policy decision.
  361. */
  362. #define XSIGO_KEEPALIVE_INTERVAL ( 10 * TICKS_PER_SEC )
  363. /** Maximum time to wait for a keepalive response
  364. *
  365. * This is a policy decision.
  366. */
  367. #define XSIGO_KEEPALIVE_MAX_WAIT ( 2 * TICKS_PER_SEC )
  368. #endif /* _IPXE_XSIGO_H */