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.

infiniband.h 20KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797
  1. #ifndef _GPXE_INFINIBAND_H
  2. #define _GPXE_INFINIBAND_H
  3. /** @file
  4. *
  5. * Infiniband protocol
  6. *
  7. */
  8. #include <stdint.h>
  9. #include <gpxe/refcnt.h>
  10. #include <gpxe/device.h>
  11. /** Subnet administrator QPN */
  12. #define IB_SA_QPN 1
  13. /** Broadcast QPN */
  14. #define IB_BROADCAST_QPN 0xffffffUL
  15. /** Subnet administrator queue key */
  16. #define IB_GLOBAL_QKEY 0x80010000UL
  17. /** An Infiniband Global Identifier */
  18. struct ib_gid {
  19. union {
  20. uint8_t bytes[16];
  21. uint16_t words[8];
  22. uint32_t dwords[4];
  23. } u;
  24. };
  25. /** An Infiniband Global Route Header */
  26. struct ib_global_route_header {
  27. /** IP version, traffic class, and flow label
  28. *
  29. * 4 bits : Version of the GRH
  30. * 8 bits : Traffic class
  31. * 20 bits : Flow label
  32. */
  33. uint32_t ipver_tclass_flowlabel;
  34. /** Payload length */
  35. uint16_t paylen;
  36. /** Next header */
  37. uint8_t nxthdr;
  38. /** Hop limit */
  39. uint8_t hoplmt;
  40. /** Source GID */
  41. struct ib_gid sgid;
  42. /** Destiniation GID */
  43. struct ib_gid dgid;
  44. } __attribute__ (( packed ));
  45. struct ib_device;
  46. struct ib_queue_pair;
  47. struct ib_address_vector;
  48. struct ib_completion_queue;
  49. /** An Infiniband Work Queue */
  50. struct ib_work_queue {
  51. /** Containing queue pair */
  52. struct ib_queue_pair *qp;
  53. /** "Is a send queue" flag */
  54. int is_send;
  55. /** Associated completion queue */
  56. struct ib_completion_queue *cq;
  57. /** List of work queues on this completion queue */
  58. struct list_head list;
  59. /** Number of work queue entries */
  60. unsigned int num_wqes;
  61. /** Number of occupied work queue entries */
  62. unsigned int fill;
  63. /** Next work queue entry index
  64. *
  65. * This is the index of the next entry to be filled (i.e. the
  66. * first empty entry). This value is not bounded by num_wqes;
  67. * users must logical-AND with (num_wqes-1) to generate an
  68. * array index.
  69. */
  70. unsigned long next_idx;
  71. /** I/O buffers assigned to work queue */
  72. struct io_buffer **iobufs;
  73. /** Driver private data */
  74. void *drv_priv;
  75. };
  76. /** An Infiniband Queue Pair */
  77. struct ib_queue_pair {
  78. /** Queue Pair Number */
  79. unsigned long qpn;
  80. /** Queue key */
  81. unsigned long qkey;
  82. /** Send queue */
  83. struct ib_work_queue send;
  84. /** Receive queue */
  85. struct ib_work_queue recv;
  86. /** Driver private data */
  87. void *drv_priv;
  88. /** Queue owner private data */
  89. void *owner_priv;
  90. };
  91. /** Infiniband queue pair modification flags */
  92. enum ib_queue_pair_mods {
  93. IB_MODIFY_QKEY = 0x0001,
  94. };
  95. /** An Infiniband Address Vector */
  96. struct ib_address_vector {
  97. /** Queue Pair Number */
  98. unsigned long qpn;
  99. /** Queue key
  100. *
  101. * Not specified for received packets.
  102. */
  103. unsigned long qkey;
  104. /** Local ID */
  105. unsigned int lid;
  106. /** Rate
  107. *
  108. * Not specified for received packets.
  109. */
  110. unsigned int rate;
  111. /** Service level */
  112. unsigned int sl;
  113. /** GID is present */
  114. unsigned int gid_present;
  115. /** GID, if present */
  116. struct ib_gid gid;
  117. };
  118. /** Infiniband completion queue operations */
  119. struct ib_completion_queue_operations {
  120. /**
  121. * Complete Send WQE
  122. *
  123. * @v ibdev Infiniband device
  124. * @v qp Queue pair
  125. * @v iobuf I/O buffer
  126. * @v rc Completion status code
  127. */
  128. void ( * complete_send ) ( struct ib_device *ibdev,
  129. struct ib_queue_pair *qp,
  130. struct io_buffer *iobuf, int rc );
  131. /**
  132. * Complete Receive WQE
  133. *
  134. * @v ibdev Infiniband device
  135. * @v qp Queue pair
  136. * @v av Address vector, or NULL
  137. * @v iobuf I/O buffer
  138. * @v rc Completion status code
  139. */
  140. void ( * complete_recv ) ( struct ib_device *ibdev,
  141. struct ib_queue_pair *qp,
  142. struct ib_address_vector *av,
  143. struct io_buffer *iobuf, int rc );
  144. };
  145. /** An Infiniband Completion Queue */
  146. struct ib_completion_queue {
  147. /** Completion queue number */
  148. unsigned long cqn;
  149. /** Number of completion queue entries */
  150. unsigned int num_cqes;
  151. /** Next completion queue entry index
  152. *
  153. * This is the index of the next entry to be filled (i.e. the
  154. * first empty entry). This value is not bounded by num_wqes;
  155. * users must logical-AND with (num_wqes-1) to generate an
  156. * array index.
  157. */
  158. unsigned long next_idx;
  159. /** List of work queues completing to this queue */
  160. struct list_head work_queues;
  161. /** Completion queue operations */
  162. struct ib_completion_queue_operations *op;
  163. /** Driver private data */
  164. void *drv_priv;
  165. };
  166. struct ib_mad_hdr;
  167. /**
  168. * Infiniband device operations
  169. *
  170. * These represent a subset of the Infiniband Verbs.
  171. */
  172. struct ib_device_operations {
  173. /** Create completion queue
  174. *
  175. * @v ibdev Infiniband device
  176. * @v cq Completion queue
  177. * @ret rc Return status code
  178. */
  179. int ( * create_cq ) ( struct ib_device *ibdev,
  180. struct ib_completion_queue *cq );
  181. /** Destroy completion queue
  182. *
  183. * @v ibdev Infiniband device
  184. * @v cq Completion queue
  185. */
  186. void ( * destroy_cq ) ( struct ib_device *ibdev,
  187. struct ib_completion_queue *cq );
  188. /** Create queue pair
  189. *
  190. * @v ibdev Infiniband device
  191. * @v qp Queue pair
  192. * @ret rc Return status code
  193. */
  194. int ( * create_qp ) ( struct ib_device *ibdev,
  195. struct ib_queue_pair *qp );
  196. /** Modify queue pair
  197. *
  198. * @v ibdev Infiniband device
  199. * @v qp Queue pair
  200. * @v mod_list Modification list
  201. * @ret rc Return status code
  202. */
  203. int ( * modify_qp ) ( struct ib_device *ibdev,
  204. struct ib_queue_pair *qp,
  205. unsigned long mod_list );
  206. /** Destroy queue pair
  207. *
  208. * @v ibdev Infiniband device
  209. * @v qp Queue pair
  210. */
  211. void ( * destroy_qp ) ( struct ib_device *ibdev,
  212. struct ib_queue_pair *qp );
  213. /** Post send work queue entry
  214. *
  215. * @v ibdev Infiniband device
  216. * @v qp Queue pair
  217. * @v av Address vector
  218. * @v iobuf I/O buffer
  219. * @ret rc Return status code
  220. *
  221. * If this method returns success, the I/O buffer remains
  222. * owned by the queue pair. If this method returns failure,
  223. * the I/O buffer is immediately released; the failure is
  224. * interpreted as "failure to enqueue buffer".
  225. */
  226. int ( * post_send ) ( struct ib_device *ibdev,
  227. struct ib_queue_pair *qp,
  228. struct ib_address_vector *av,
  229. struct io_buffer *iobuf );
  230. /** Post receive work queue entry
  231. *
  232. * @v ibdev Infiniband device
  233. * @v qp Queue pair
  234. * @v iobuf I/O buffer
  235. * @ret rc Return status code
  236. *
  237. * If this method returns success, the I/O buffer remains
  238. * owned by the queue pair. If this method returns failure,
  239. * the I/O buffer is immediately released; the failure is
  240. * interpreted as "failure to enqueue buffer".
  241. */
  242. int ( * post_recv ) ( struct ib_device *ibdev,
  243. struct ib_queue_pair *qp,
  244. struct io_buffer *iobuf );
  245. /** Poll completion queue
  246. *
  247. * @v ibdev Infiniband device
  248. * @v cq Completion queue
  249. *
  250. * The relevant completion handler (specified at completion
  251. * queue creation time) takes ownership of the I/O buffer.
  252. */
  253. void ( * poll_cq ) ( struct ib_device *ibdev,
  254. struct ib_completion_queue *cq );
  255. /**
  256. * Poll event queue
  257. *
  258. * @v ibdev Infiniband device
  259. */
  260. void ( * poll_eq ) ( struct ib_device *ibdev );
  261. /**
  262. * Open port
  263. *
  264. * @v ibdev Infiniband device
  265. * @ret rc Return status code
  266. */
  267. int ( * open ) ( struct ib_device *ibdev );
  268. /**
  269. * Close port
  270. *
  271. * @v ibdev Infiniband device
  272. */
  273. void ( * close ) ( struct ib_device *ibdev );
  274. /** Attach to multicast group
  275. *
  276. * @v ibdev Infiniband device
  277. * @v qp Queue pair
  278. * @v gid Multicast GID
  279. * @ret rc Return status code
  280. */
  281. int ( * mcast_attach ) ( struct ib_device *ibdev,
  282. struct ib_queue_pair *qp,
  283. struct ib_gid *gid );
  284. /** Detach from multicast group
  285. *
  286. * @v ibdev Infiniband device
  287. * @v qp Queue pair
  288. * @v gid Multicast GID
  289. */
  290. void ( * mcast_detach ) ( struct ib_device *ibdev,
  291. struct ib_queue_pair *qp,
  292. struct ib_gid *gid );
  293. /**
  294. * Issue management datagram
  295. *
  296. * @v ibdev Infiniband device
  297. * @v mad Management datagram
  298. * @v len Length of management datagram
  299. * @ret rc Return status code
  300. */
  301. int ( * mad ) ( struct ib_device *ibdev, struct ib_mad_hdr *mad,
  302. size_t len );
  303. };
  304. /** An Infiniband device */
  305. struct ib_device {
  306. /** Reference counter */
  307. struct refcnt refcnt;
  308. /** List of Infiniband devices */
  309. struct list_head list;
  310. /** Underlying device */
  311. struct device *dev;
  312. /** Infiniband operations */
  313. struct ib_device_operations *op;
  314. /** Port number */
  315. unsigned int port;
  316. /** Link state */
  317. int link_up;
  318. /** Port GID */
  319. struct ib_gid port_gid;
  320. /** Subnet manager LID */
  321. unsigned long sm_lid;
  322. /** Partition key */
  323. unsigned int pkey;
  324. /** Driver private data */
  325. void *drv_priv;
  326. /** Owner private data */
  327. void *owner_priv;
  328. };
  329. extern struct ib_completion_queue *
  330. ib_create_cq ( struct ib_device *ibdev, unsigned int num_cqes,
  331. struct ib_completion_queue_operations *op );
  332. extern void ib_destroy_cq ( struct ib_device *ibdev,
  333. struct ib_completion_queue *cq );
  334. extern struct ib_queue_pair *
  335. ib_create_qp ( struct ib_device *ibdev, unsigned int num_send_wqes,
  336. struct ib_completion_queue *send_cq, unsigned int num_recv_wqes,
  337. struct ib_completion_queue *recv_cq, unsigned long qkey );
  338. extern int ib_modify_qp ( struct ib_device *ibdev, struct ib_queue_pair *qp,
  339. unsigned long mod_list, unsigned long qkey );
  340. extern void ib_destroy_qp ( struct ib_device *ibdev,
  341. struct ib_queue_pair *qp );
  342. extern struct ib_work_queue * ib_find_wq ( struct ib_completion_queue *cq,
  343. unsigned long qpn, int is_send );
  344. extern int ib_post_send ( struct ib_device *ibdev, struct ib_queue_pair *qp,
  345. struct ib_address_vector *av,
  346. struct io_buffer *iobuf );
  347. extern int ib_post_recv ( struct ib_device *ibdev, struct ib_queue_pair *qp,
  348. struct io_buffer *iobuf );
  349. extern void ib_complete_send ( struct ib_device *ibdev,
  350. struct ib_queue_pair *qp,
  351. struct io_buffer *iobuf, int rc );
  352. extern void ib_complete_recv ( struct ib_device *ibdev,
  353. struct ib_queue_pair *qp,
  354. struct ib_address_vector *av,
  355. struct io_buffer *iobuf, int rc );
  356. extern struct ib_device * alloc_ibdev ( size_t priv_size );
  357. extern int register_ibdev ( struct ib_device *ibdev );
  358. extern void unregister_ibdev ( struct ib_device *ibdev );
  359. extern void ib_link_state_changed ( struct ib_device *ibdev );
  360. /**
  361. * Poll completion queue
  362. *
  363. * @v ibdev Infiniband device
  364. * @v cq Completion queue
  365. */
  366. static inline __attribute__ (( always_inline )) void
  367. ib_poll_cq ( struct ib_device *ibdev, struct ib_completion_queue *cq ) {
  368. ibdev->op->poll_cq ( ibdev, cq );
  369. }
  370. /**
  371. * Open port
  372. *
  373. * @v ibdev Infiniband device
  374. * @ret rc Return status code
  375. */
  376. static inline __attribute__ (( always_inline )) int
  377. ib_open ( struct ib_device *ibdev ) {
  378. return ibdev->op->open ( ibdev );
  379. }
  380. /**
  381. * Close port
  382. *
  383. * @v ibdev Infiniband device
  384. */
  385. static inline __attribute__ (( always_inline )) void
  386. ib_close ( struct ib_device *ibdev ) {
  387. ibdev->op->close ( ibdev );
  388. }
  389. /**
  390. * Attach to multicast group
  391. *
  392. * @v ibdev Infiniband device
  393. * @v qp Queue pair
  394. * @v gid Multicast GID
  395. * @ret rc Return status code
  396. */
  397. static inline __attribute__ (( always_inline )) int
  398. ib_mcast_attach ( struct ib_device *ibdev, struct ib_queue_pair *qp,
  399. struct ib_gid *gid ) {
  400. return ibdev->op->mcast_attach ( ibdev, qp, gid );
  401. }
  402. /**
  403. * Detach from multicast group
  404. *
  405. * @v ibdev Infiniband device
  406. * @v qp Queue pair
  407. * @v gid Multicast GID
  408. */
  409. static inline __attribute__ (( always_inline )) void
  410. ib_mcast_detach ( struct ib_device *ibdev, struct ib_queue_pair *qp,
  411. struct ib_gid *gid ) {
  412. ibdev->op->mcast_detach ( ibdev, qp, gid );
  413. }
  414. /**
  415. * Issue management datagram
  416. *
  417. * @v ibdev Infiniband device
  418. * @v mad Management datagram
  419. * @v len Length of management datagram
  420. * @ret rc Return status code
  421. */
  422. static inline __attribute__ (( always_inline )) int
  423. ib_mad ( struct ib_device *ibdev, struct ib_mad_hdr *mad, size_t len ) {
  424. return ibdev->op->mad ( ibdev, mad, len );
  425. }
  426. /**
  427. * Get reference to Infiniband device
  428. *
  429. * @v ibdev Infiniband device
  430. * @ret ibdev Infiniband device
  431. */
  432. static inline __attribute__ (( always_inline )) struct ib_device *
  433. ibdev_get ( struct ib_device *ibdev ) {
  434. ref_get ( &ibdev->refcnt );
  435. return ibdev;
  436. }
  437. /**
  438. * Drop reference to Infiniband device
  439. *
  440. * @v ibdev Infiniband device
  441. */
  442. static inline __attribute__ (( always_inline )) void
  443. ibdev_put ( struct ib_device *ibdev ) {
  444. ref_put ( &ibdev->refcnt );
  445. }
  446. /**
  447. * Set Infiniband work queue driver-private data
  448. *
  449. * @v wq Work queue
  450. * @v priv Private data
  451. */
  452. static inline __attribute__ (( always_inline )) void
  453. ib_wq_set_drvdata ( struct ib_work_queue *wq, void *priv ) {
  454. wq->drv_priv = priv;
  455. }
  456. /**
  457. * Get Infiniband work queue driver-private data
  458. *
  459. * @v wq Work queue
  460. * @ret priv Private data
  461. */
  462. static inline __attribute__ (( always_inline )) void *
  463. ib_wq_get_drvdata ( struct ib_work_queue *wq ) {
  464. return wq->drv_priv;
  465. }
  466. /**
  467. * Set Infiniband queue pair driver-private data
  468. *
  469. * @v qp Queue pair
  470. * @v priv Private data
  471. */
  472. static inline __attribute__ (( always_inline )) void
  473. ib_qp_set_drvdata ( struct ib_queue_pair *qp, void *priv ) {
  474. qp->drv_priv = priv;
  475. }
  476. /**
  477. * Get Infiniband queue pair driver-private data
  478. *
  479. * @v qp Queue pair
  480. * @ret priv Private data
  481. */
  482. static inline __attribute__ (( always_inline )) void *
  483. ib_qp_get_drvdata ( struct ib_queue_pair *qp ) {
  484. return qp->drv_priv;
  485. }
  486. /**
  487. * Set Infiniband queue pair owner-private data
  488. *
  489. * @v qp Queue pair
  490. * @v priv Private data
  491. */
  492. static inline __attribute__ (( always_inline )) void
  493. ib_qp_set_ownerdata ( struct ib_queue_pair *qp, void *priv ) {
  494. qp->owner_priv = priv;
  495. }
  496. /**
  497. * Get Infiniband queue pair owner-private data
  498. *
  499. * @v qp Queue pair
  500. * @ret priv Private data
  501. */
  502. static inline __attribute__ (( always_inline )) void *
  503. ib_qp_get_ownerdata ( struct ib_queue_pair *qp ) {
  504. return qp->owner_priv;
  505. }
  506. /**
  507. * Set Infiniband completion queue driver-private data
  508. *
  509. * @v cq Completion queue
  510. * @v priv Private data
  511. */
  512. static inline __attribute__ (( always_inline )) void
  513. ib_cq_set_drvdata ( struct ib_completion_queue *cq, void *priv ) {
  514. cq->drv_priv = priv;
  515. }
  516. /**
  517. * Get Infiniband completion queue driver-private data
  518. *
  519. * @v cq Completion queue
  520. * @ret priv Private data
  521. */
  522. static inline __attribute__ (( always_inline )) void *
  523. ib_cq_get_drvdata ( struct ib_completion_queue *cq ) {
  524. return cq->drv_priv;
  525. }
  526. /**
  527. * Set Infiniband device driver-private data
  528. *
  529. * @v ibdev Infiniband device
  530. * @v priv Private data
  531. */
  532. static inline __attribute__ (( always_inline )) void
  533. ib_set_drvdata ( struct ib_device *ibdev, void *priv ) {
  534. ibdev->drv_priv = priv;
  535. }
  536. /**
  537. * Get Infiniband device driver-private data
  538. *
  539. * @v ibdev Infiniband device
  540. * @ret priv Private data
  541. */
  542. static inline __attribute__ (( always_inline )) void *
  543. ib_get_drvdata ( struct ib_device *ibdev ) {
  544. return ibdev->drv_priv;
  545. }
  546. /**
  547. * Set Infiniband device owner-private data
  548. *
  549. * @v ibdev Infiniband device
  550. * @v priv Private data
  551. */
  552. static inline __attribute__ (( always_inline )) void
  553. ib_set_ownerdata ( struct ib_device *ibdev, void *priv ) {
  554. ibdev->owner_priv = priv;
  555. }
  556. /**
  557. * Get Infiniband device owner-private data
  558. *
  559. * @v ibdev Infiniband device
  560. * @ret priv Private data
  561. */
  562. static inline __attribute__ (( always_inline )) void *
  563. ib_get_ownerdata ( struct ib_device *ibdev ) {
  564. return ibdev->owner_priv;
  565. }
  566. /*****************************************************************************
  567. *
  568. * Management datagrams
  569. *
  570. * Portions Copyright (c) 2004 Mellanox Technologies Ltd. All rights
  571. * reserved.
  572. *
  573. */
  574. /* Management base version */
  575. #define IB_MGMT_BASE_VERSION 1
  576. /* Management classes */
  577. #define IB_MGMT_CLASS_SUBN_LID_ROUTED 0x01
  578. #define IB_MGMT_CLASS_SUBN_DIRECTED_ROUTE 0x81
  579. #define IB_MGMT_CLASS_SUBN_ADM 0x03
  580. #define IB_MGMT_CLASS_PERF_MGMT 0x04
  581. #define IB_MGMT_CLASS_BM 0x05
  582. #define IB_MGMT_CLASS_DEVICE_MGMT 0x06
  583. #define IB_MGMT_CLASS_CM 0x07
  584. #define IB_MGMT_CLASS_SNMP 0x08
  585. #define IB_MGMT_CLASS_VENDOR_RANGE2_START 0x30
  586. #define IB_MGMT_CLASS_VENDOR_RANGE2_END 0x4F
  587. /* Management methods */
  588. #define IB_MGMT_METHOD_GET 0x01
  589. #define IB_MGMT_METHOD_SET 0x02
  590. #define IB_MGMT_METHOD_GET_RESP 0x81
  591. #define IB_MGMT_METHOD_SEND 0x03
  592. #define IB_MGMT_METHOD_TRAP 0x05
  593. #define IB_MGMT_METHOD_REPORT 0x06
  594. #define IB_MGMT_METHOD_REPORT_RESP 0x86
  595. #define IB_MGMT_METHOD_TRAP_REPRESS 0x07
  596. #define IB_MGMT_METHOD_DELETE 0x15
  597. #define IB_MGMT_METHOD_RESP 0x80
  598. /* Subnet management attributes */
  599. #define IB_SMP_ATTR_NOTICE 0x0002
  600. #define IB_SMP_ATTR_NODE_DESC 0x0010
  601. #define IB_SMP_ATTR_NODE_INFO 0x0011
  602. #define IB_SMP_ATTR_SWITCH_INFO 0x0012
  603. #define IB_SMP_ATTR_GUID_INFO 0x0014
  604. #define IB_SMP_ATTR_PORT_INFO 0x0015
  605. #define IB_SMP_ATTR_PKEY_TABLE 0x0016
  606. #define IB_SMP_ATTR_SL_TO_VL_TABLE 0x0017
  607. #define IB_SMP_ATTR_VL_ARB_TABLE 0x0018
  608. #define IB_SMP_ATTR_LINEAR_FORWARD_TABLE 0x0019
  609. #define IB_SMP_ATTR_RANDOM_FORWARD_TABLE 0x001A
  610. #define IB_SMP_ATTR_MCAST_FORWARD_TABLE 0x001B
  611. #define IB_SMP_ATTR_SM_INFO 0x0020
  612. #define IB_SMP_ATTR_VENDOR_DIAG 0x0030
  613. #define IB_SMP_ATTR_LED_INFO 0x0031
  614. #define IB_SMP_ATTR_VENDOR_MASK 0xFF00
  615. #define IB_SA_ATTR_MC_MEMBER_REC 0x38
  616. #define IB_SA_ATTR_PATH_REC 0x35
  617. #define IB_SA_MCMEMBER_REC_MGID (1<<0)
  618. #define IB_SA_MCMEMBER_REC_PORT_GID (1<<1)
  619. #define IB_SA_MCMEMBER_REC_QKEY (1<<2)
  620. #define IB_SA_MCMEMBER_REC_MLID (1<<3)
  621. #define IB_SA_MCMEMBER_REC_MTU_SELECTOR (1<<4)
  622. #define IB_SA_MCMEMBER_REC_MTU (1<<5)
  623. #define IB_SA_MCMEMBER_REC_TRAFFIC_CLASS (1<<6)
  624. #define IB_SA_MCMEMBER_REC_PKEY (1<<7)
  625. #define IB_SA_MCMEMBER_REC_RATE_SELECTOR (1<<8)
  626. #define IB_SA_MCMEMBER_REC_RATE (1<<9)
  627. #define IB_SA_MCMEMBER_REC_PACKET_LIFE_TIME_SELECTOR (1<<10)
  628. #define IB_SA_MCMEMBER_REC_PACKET_LIFE_TIME (1<<11)
  629. #define IB_SA_MCMEMBER_REC_SL (1<<12)
  630. #define IB_SA_MCMEMBER_REC_FLOW_LABEL (1<<13)
  631. #define IB_SA_MCMEMBER_REC_HOP_LIMIT (1<<14)
  632. #define IB_SA_MCMEMBER_REC_SCOPE (1<<15)
  633. #define IB_SA_MCMEMBER_REC_JOIN_STATE (1<<16)
  634. #define IB_SA_MCMEMBER_REC_PROXY_JOIN (1<<17)
  635. #define IB_SA_PATH_REC_DGID (1<<2)
  636. #define IB_SA_PATH_REC_SGID (1<<3)
  637. struct ib_mad_hdr {
  638. uint8_t base_version;
  639. uint8_t mgmt_class;
  640. uint8_t class_version;
  641. uint8_t method;
  642. uint16_t status;
  643. uint16_t class_specific;
  644. uint32_t tid[2];
  645. uint16_t attr_id;
  646. uint16_t resv;
  647. uint32_t attr_mod;
  648. } __attribute__ (( packed ));
  649. struct ib_sa_hdr {
  650. uint32_t sm_key[2];
  651. uint16_t reserved;
  652. uint16_t attrib_offset;
  653. uint32_t comp_mask[2];
  654. } __attribute__ (( packed ));
  655. struct ib_rmpp_hdr {
  656. uint32_t raw[3];
  657. } __attribute__ (( packed ));
  658. struct ib_mad_data {
  659. struct ib_mad_hdr mad_hdr;
  660. uint8_t data[232];
  661. } __attribute__ (( packed ));
  662. struct ib_mad_guid_info {
  663. struct ib_mad_hdr mad_hdr;
  664. uint32_t mkey[2];
  665. uint32_t reserved[8];
  666. uint8_t gid_local[8];
  667. } __attribute__ (( packed ));
  668. struct ib_mad_port_info {
  669. struct ib_mad_hdr mad_hdr;
  670. uint32_t mkey[2];
  671. uint32_t reserved[8];
  672. uint32_t mkey2[2];
  673. uint8_t gid_prefix[8];
  674. uint16_t lid;
  675. uint16_t mastersm_lid;
  676. uint32_t cap_mask;
  677. uint16_t diag_code;
  678. uint16_t mkey_lease_period;
  679. uint8_t local_port_num;
  680. uint8_t link_width_enabled;
  681. uint8_t link_width_supported;
  682. uint8_t link_width_active;
  683. uint8_t port_state__link_speed_supported;
  684. uint8_t link_down_def_state__port_phys_state;
  685. uint8_t lmc__r1__mkey_prot_bits;
  686. uint8_t link_speed_enabled__link_speed_active;
  687. } __attribute__ (( packed ));
  688. struct ib_mad_pkey_table {
  689. struct ib_mad_hdr mad_hdr;
  690. uint32_t mkey[2];
  691. uint32_t reserved[8];
  692. uint16_t pkey[16][2];
  693. } __attribute__ (( packed ));
  694. struct ib_mad_path_record {
  695. struct ib_mad_hdr mad_hdr;
  696. struct ib_rmpp_hdr rmpp_hdr;
  697. struct ib_sa_hdr sa_hdr;
  698. uint32_t reserved0[2];
  699. struct ib_gid dgid;
  700. struct ib_gid sgid;
  701. uint16_t dlid;
  702. uint16_t slid;
  703. uint32_t hop_limit__flow_label__raw_traffic;
  704. uint32_t pkey__numb_path__reversible__tclass;
  705. uint8_t reserved1;
  706. uint8_t reserved__sl;
  707. uint8_t mtu_selector__mtu;
  708. uint8_t rate_selector__rate;
  709. uint32_t preference__packet_lifetime__packet_lifetime_selector;
  710. uint32_t reserved2[35];
  711. } __attribute__ (( packed ));
  712. struct ib_mad_mc_member_record {
  713. struct ib_mad_hdr mad_hdr;
  714. struct ib_rmpp_hdr rmpp_hdr;
  715. struct ib_sa_hdr sa_hdr;
  716. struct ib_gid mgid;
  717. struct ib_gid port_gid;
  718. uint32_t qkey;
  719. uint16_t mlid;
  720. uint8_t mtu_selector__mtu;
  721. uint8_t tclass;
  722. uint16_t pkey;
  723. uint8_t rate_selector__rate;
  724. uint8_t packet_lifetime_selector__packet_lifetime;
  725. uint32_t sl__flow_label__hop_limit;
  726. uint8_t scope__join_state;
  727. uint8_t proxy_join__reserved;
  728. uint16_t reserved0;
  729. uint32_t reserved1[37];
  730. } __attribute__ (( packed ));
  731. union ib_mad {
  732. struct ib_mad_hdr mad_hdr;
  733. struct ib_mad_data data;
  734. struct ib_mad_guid_info guid_info;
  735. struct ib_mad_port_info port_info;
  736. struct ib_mad_pkey_table pkey_table;
  737. struct ib_mad_path_record path_record;
  738. struct ib_mad_mc_member_record mc_member_record;
  739. } __attribute__ (( packed ));
  740. #endif /* _GPXE_INFINIBAND_H */