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 18KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703
  1. #ifndef _IPXE_INFINIBAND_H
  2. #define _IPXE_INFINIBAND_H
  3. /** @file
  4. *
  5. * Infiniband protocol
  6. *
  7. */
  8. FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
  9. #include <stdint.h>
  10. #include <ipxe/refcnt.h>
  11. #include <ipxe/device.h>
  12. #include <ipxe/tables.h>
  13. #include <ipxe/ib_packet.h>
  14. #include <ipxe/ib_mad.h>
  15. /** Subnet management interface QPN */
  16. #define IB_QPN_SMI 0
  17. /** Subnet management interface queue key */
  18. #define IB_QKEY_SMI 0
  19. /** General service interface QPN */
  20. #define IB_QPN_GSI 1
  21. /** General service interface queue key */
  22. #define IB_QKEY_GSI 0x80010000UL
  23. /** Broadcast QPN */
  24. #define IB_QPN_BROADCAST 0xffffffUL
  25. /** QPN mask */
  26. #define IB_QPN_MASK 0xffffffUL
  27. /** Default Infiniband partition key */
  28. #define IB_PKEY_DEFAULT 0xffff
  29. /** Infiniband partition key full membership flag */
  30. #define IB_PKEY_FULL 0x8000
  31. /**
  32. * Maximum payload size
  33. *
  34. * This is currently hard-coded in various places (drivers, subnet
  35. * management agent, etc.) to 2048.
  36. */
  37. #define IB_MAX_PAYLOAD_SIZE 2048
  38. struct ib_device;
  39. struct ib_queue_pair;
  40. struct ib_address_vector;
  41. struct ib_completion_queue;
  42. struct ib_mad_interface;
  43. /** Infiniband transmission rates */
  44. enum ib_rate {
  45. IB_RATE_2_5 = 2,
  46. IB_RATE_10 = 3,
  47. IB_RATE_30 = 4,
  48. IB_RATE_5 = 5,
  49. IB_RATE_20 = 6,
  50. IB_RATE_40 = 7,
  51. IB_RATE_60 = 8,
  52. IB_RATE_80 = 9,
  53. IB_RATE_120 = 10,
  54. };
  55. /** An Infiniband Address Vector */
  56. struct ib_address_vector {
  57. /** Queue Pair Number */
  58. unsigned long qpn;
  59. /** Queue key
  60. *
  61. * Not specified for received packets.
  62. */
  63. unsigned long qkey;
  64. /** Local ID */
  65. unsigned int lid;
  66. /** Rate
  67. *
  68. * Not specified for received packets.
  69. */
  70. enum ib_rate rate;
  71. /** Service level */
  72. unsigned int sl;
  73. /** GID is present */
  74. unsigned int gid_present;
  75. /** GID, if present */
  76. union ib_gid gid;
  77. /** VLAN is present */
  78. unsigned int vlan_present;
  79. /** VLAN, if present */
  80. unsigned int vlan;
  81. };
  82. /** An Infiniband Work Queue */
  83. struct ib_work_queue {
  84. /** Containing queue pair */
  85. struct ib_queue_pair *qp;
  86. /** "Is a send queue" flag */
  87. int is_send;
  88. /** Associated completion queue */
  89. struct ib_completion_queue *cq;
  90. /** List of work queues on this completion queue */
  91. struct list_head list;
  92. /** Packet sequence number */
  93. uint32_t psn;
  94. /** Number of work queue entries */
  95. unsigned int num_wqes;
  96. /** Number of occupied work queue entries */
  97. unsigned int fill;
  98. /** Next work queue entry index
  99. *
  100. * This is the index of the next entry to be filled (i.e. the
  101. * first empty entry). This value is not bounded by num_wqes;
  102. * users must logical-AND with (num_wqes-1) to generate an
  103. * array index.
  104. */
  105. unsigned long next_idx;
  106. /** I/O buffers assigned to work queue */
  107. struct io_buffer **iobufs;
  108. /** Driver private data */
  109. void *drv_priv;
  110. };
  111. /** An Infiniband multicast GID */
  112. struct ib_multicast_gid {
  113. /** List of multicast GIDs on this QP */
  114. struct list_head list;
  115. /** Multicast GID */
  116. union ib_gid gid;
  117. };
  118. /** An Infiniband queue pair type */
  119. enum ib_queue_pair_type {
  120. IB_QPT_SMI,
  121. IB_QPT_GSI,
  122. IB_QPT_UD,
  123. IB_QPT_RC,
  124. IB_QPT_ETH,
  125. };
  126. /** Infiniband queue pair operations */
  127. struct ib_queue_pair_operations {
  128. /** Allocate receive I/O buffer
  129. *
  130. * @v len Maximum receive length
  131. * @ret iobuf I/O buffer (or NULL if out of memory)
  132. */
  133. struct io_buffer * ( * alloc_iob ) ( size_t len );
  134. };
  135. /** An Infiniband Queue Pair */
  136. struct ib_queue_pair {
  137. /** Containing Infiniband device */
  138. struct ib_device *ibdev;
  139. /** List of queue pairs on this Infiniband device */
  140. struct list_head list;
  141. /** Queue pair number */
  142. unsigned long qpn;
  143. /** Externally-visible queue pair number
  144. *
  145. * This may differ from the real queue pair number (e.g. when
  146. * the HCA cannot use the management QPNs 0 and 1 as hardware
  147. * QPNs and needs to remap them).
  148. */
  149. unsigned long ext_qpn;
  150. /** Queue pair type */
  151. enum ib_queue_pair_type type;
  152. /** Queue key */
  153. unsigned long qkey;
  154. /** Send queue */
  155. struct ib_work_queue send;
  156. /** Receive queue */
  157. struct ib_work_queue recv;
  158. /** List of multicast GIDs */
  159. struct list_head mgids;
  160. /** Address vector */
  161. struct ib_address_vector av;
  162. /** Queue pair operations */
  163. struct ib_queue_pair_operations *op;
  164. /** Driver private data */
  165. void *drv_priv;
  166. /** Queue owner private data */
  167. void *owner_priv;
  168. };
  169. /** Infiniband completion queue operations */
  170. struct ib_completion_queue_operations {
  171. /**
  172. * Complete Send WQE
  173. *
  174. * @v ibdev Infiniband device
  175. * @v qp Queue pair
  176. * @v iobuf I/O buffer
  177. * @v rc Completion status code
  178. */
  179. void ( * complete_send ) ( struct ib_device *ibdev,
  180. struct ib_queue_pair *qp,
  181. struct io_buffer *iobuf, int rc );
  182. /**
  183. * Complete Receive WQE
  184. *
  185. * @v ibdev Infiniband device
  186. * @v qp Queue pair
  187. * @v dest Destination address vector, or NULL
  188. * @v source Source address vector, or NULL
  189. * @v iobuf I/O buffer
  190. * @v rc Completion status code
  191. */
  192. void ( * complete_recv ) ( struct ib_device *ibdev,
  193. struct ib_queue_pair *qp,
  194. struct ib_address_vector *dest,
  195. struct ib_address_vector *source,
  196. struct io_buffer *iobuf, int rc );
  197. };
  198. /** An Infiniband Completion Queue */
  199. struct ib_completion_queue {
  200. /** Containing Infiniband device */
  201. struct ib_device *ibdev;
  202. /** List of completion queues on this Infiniband device */
  203. struct list_head list;
  204. /** Completion queue number */
  205. unsigned long cqn;
  206. /** Number of completion queue entries */
  207. unsigned int num_cqes;
  208. /** Next completion queue entry index
  209. *
  210. * This is the index of the next entry to be filled (i.e. the
  211. * first empty entry). This value is not bounded by num_wqes;
  212. * users must logical-AND with (num_wqes-1) to generate an
  213. * array index.
  214. */
  215. unsigned long next_idx;
  216. /** List of work queues completing to this queue */
  217. struct list_head work_queues;
  218. /** Completion queue operations */
  219. struct ib_completion_queue_operations *op;
  220. /** Driver private data */
  221. void *drv_priv;
  222. };
  223. /**
  224. * Infiniband device operations
  225. *
  226. * These represent a subset of the Infiniband Verbs.
  227. */
  228. struct ib_device_operations {
  229. /** Create completion queue
  230. *
  231. * @v ibdev Infiniband device
  232. * @v cq Completion queue
  233. * @ret rc Return status code
  234. */
  235. int ( * create_cq ) ( struct ib_device *ibdev,
  236. struct ib_completion_queue *cq );
  237. /** Destroy completion queue
  238. *
  239. * @v ibdev Infiniband device
  240. * @v cq Completion queue
  241. */
  242. void ( * destroy_cq ) ( struct ib_device *ibdev,
  243. struct ib_completion_queue *cq );
  244. /** Create queue pair
  245. *
  246. * @v ibdev Infiniband device
  247. * @v qp Queue pair
  248. * @ret rc Return status code
  249. */
  250. int ( * create_qp ) ( struct ib_device *ibdev,
  251. struct ib_queue_pair *qp );
  252. /** Modify queue pair
  253. *
  254. * @v ibdev Infiniband device
  255. * @v qp Queue pair
  256. * @ret rc Return status code
  257. */
  258. int ( * modify_qp ) ( struct ib_device *ibdev,
  259. struct ib_queue_pair *qp );
  260. /** Destroy queue pair
  261. *
  262. * @v ibdev Infiniband device
  263. * @v qp Queue pair
  264. */
  265. void ( * destroy_qp ) ( struct ib_device *ibdev,
  266. struct ib_queue_pair *qp );
  267. /** Post send work queue entry
  268. *
  269. * @v ibdev Infiniband device
  270. * @v qp Queue pair
  271. * @v dest Destination address vector
  272. * @v iobuf I/O buffer
  273. * @ret rc Return status code
  274. *
  275. * If this method returns success, the I/O buffer remains
  276. * owned by the queue pair. If this method returns failure,
  277. * the I/O buffer is immediately released; the failure is
  278. * interpreted as "failure to enqueue buffer".
  279. */
  280. int ( * post_send ) ( struct ib_device *ibdev,
  281. struct ib_queue_pair *qp,
  282. struct ib_address_vector *dest,
  283. struct io_buffer *iobuf );
  284. /** Post receive work queue entry
  285. *
  286. * @v ibdev Infiniband device
  287. * @v qp Queue pair
  288. * @v iobuf I/O buffer
  289. * @ret rc Return status code
  290. *
  291. * If this method returns success, the I/O buffer remains
  292. * owned by the queue pair. If this method returns failure,
  293. * the I/O buffer is immediately released; the failure is
  294. * interpreted as "failure to enqueue buffer".
  295. */
  296. int ( * post_recv ) ( struct ib_device *ibdev,
  297. struct ib_queue_pair *qp,
  298. struct io_buffer *iobuf );
  299. /** Poll completion queue
  300. *
  301. * @v ibdev Infiniband device
  302. * @v cq Completion queue
  303. *
  304. * The relevant completion handler (specified at completion
  305. * queue creation time) takes ownership of the I/O buffer.
  306. */
  307. void ( * poll_cq ) ( struct ib_device *ibdev,
  308. struct ib_completion_queue *cq );
  309. /**
  310. * Poll event queue
  311. *
  312. * @v ibdev Infiniband device
  313. */
  314. void ( * poll_eq ) ( struct ib_device *ibdev );
  315. /**
  316. * Open port
  317. *
  318. * @v ibdev Infiniband device
  319. * @ret rc Return status code
  320. */
  321. int ( * open ) ( struct ib_device *ibdev );
  322. /**
  323. * Close port
  324. *
  325. * @v ibdev Infiniband device
  326. */
  327. void ( * close ) ( struct ib_device *ibdev );
  328. /** Attach to multicast group
  329. *
  330. * @v ibdev Infiniband device
  331. * @v qp Queue pair
  332. * @v gid Multicast GID
  333. * @ret rc Return status code
  334. */
  335. int ( * mcast_attach ) ( struct ib_device *ibdev,
  336. struct ib_queue_pair *qp,
  337. union ib_gid *gid );
  338. /** Detach from multicast group
  339. *
  340. * @v ibdev Infiniband device
  341. * @v qp Queue pair
  342. * @v gid Multicast GID
  343. */
  344. void ( * mcast_detach ) ( struct ib_device *ibdev,
  345. struct ib_queue_pair *qp,
  346. union ib_gid *gid );
  347. /** Set port information
  348. *
  349. * @v ibdev Infiniband device
  350. * @v mad Set port information MAD
  351. *
  352. * This method is required only by adapters that do not have
  353. * an embedded SMA.
  354. */
  355. int ( * set_port_info ) ( struct ib_device *ibdev, union ib_mad *mad );
  356. /** Set partition key table
  357. *
  358. * @v ibdev Infiniband device
  359. * @v mad Set partition key table MAD
  360. *
  361. * This method is required only by adapters that do not have
  362. * an embedded SMA.
  363. */
  364. int ( * set_pkey_table ) ( struct ib_device *ibdev,
  365. union ib_mad *mad );
  366. };
  367. /** Maximum length of an Infiniband device name */
  368. #define IBDEV_NAME_LEN 8
  369. /** An Infiniband device */
  370. struct ib_device {
  371. /** Reference counter */
  372. struct refcnt refcnt;
  373. /** List of Infiniband devices */
  374. struct list_head list;
  375. /** List of open Infiniband devices */
  376. struct list_head open_list;
  377. /** Index of this Infiniband device */
  378. unsigned int index;
  379. /** Name of this Infiniband device */
  380. char name[IBDEV_NAME_LEN];
  381. /** Underlying device */
  382. struct device *dev;
  383. /** List of completion queues */
  384. struct list_head cqs;
  385. /** List of queue pairs */
  386. struct list_head qps;
  387. /** Infiniband operations */
  388. struct ib_device_operations *op;
  389. /** Port number */
  390. unsigned int port;
  391. /** Port open request counter */
  392. unsigned int open_count;
  393. /** Port state */
  394. uint8_t port_state;
  395. /** Link width supported */
  396. uint8_t link_width_supported;
  397. /** Link width enabled */
  398. uint8_t link_width_enabled;
  399. /** Link width active */
  400. uint8_t link_width_active;
  401. /** Link speed supported */
  402. uint8_t link_speed_supported;
  403. /** Link speed enabled */
  404. uint8_t link_speed_enabled;
  405. /** Link speed active */
  406. uint8_t link_speed_active;
  407. /** Node GUID */
  408. union ib_guid node_guid;
  409. /** Port GID (comprising GID prefix and port GUID) */
  410. union ib_gid gid;
  411. /** Port LID */
  412. uint16_t lid;
  413. /** Subnet manager LID */
  414. uint16_t sm_lid;
  415. /** Subnet manager SL */
  416. uint8_t sm_sl;
  417. /** Partition key */
  418. uint16_t pkey;
  419. /** RDMA key
  420. *
  421. * This is a single key allowing unrestricted access to
  422. * memory.
  423. */
  424. uint32_t rdma_key;
  425. /** Subnet management interface */
  426. struct ib_mad_interface *smi;
  427. /** General services interface */
  428. struct ib_mad_interface *gsi;
  429. /** Driver private data */
  430. void *drv_priv;
  431. };
  432. /** An Infiniband upper-layer driver */
  433. struct ib_driver {
  434. /** Name */
  435. const char *name;
  436. /** Probe device
  437. *
  438. * @v ibdev Infiniband device
  439. * @ret rc Return status code
  440. */
  441. int ( * probe ) ( struct ib_device *ibdev );
  442. /** Notify of device or link state change
  443. *
  444. * @v ibdev Infiniband device
  445. */
  446. void ( * notify ) ( struct ib_device *ibdev );
  447. /** Remove device
  448. *
  449. * @v ibdev Infiniband device
  450. */
  451. void ( * remove ) ( struct ib_device *ibdev );
  452. };
  453. /** Infiniband driver table */
  454. #define IB_DRIVERS __table ( struct ib_driver, "ib_drivers" )
  455. /** Declare an Infiniband driver */
  456. #define __ib_driver __table_entry ( IB_DRIVERS, 01 )
  457. extern struct ib_completion_queue *
  458. ib_create_cq ( struct ib_device *ibdev, unsigned int num_cqes,
  459. struct ib_completion_queue_operations *op );
  460. extern void ib_destroy_cq ( struct ib_device *ibdev,
  461. struct ib_completion_queue *cq );
  462. extern void ib_poll_cq ( struct ib_device *ibdev,
  463. struct ib_completion_queue *cq );
  464. extern struct ib_queue_pair *
  465. ib_create_qp ( struct ib_device *ibdev, enum ib_queue_pair_type type,
  466. unsigned int num_send_wqes, struct ib_completion_queue *send_cq,
  467. unsigned int num_recv_wqes, struct ib_completion_queue *recv_cq,
  468. struct ib_queue_pair_operations *op );
  469. extern int ib_modify_qp ( struct ib_device *ibdev, struct ib_queue_pair *qp );
  470. extern void ib_destroy_qp ( struct ib_device *ibdev,
  471. struct ib_queue_pair *qp );
  472. extern struct ib_queue_pair * ib_find_qp_qpn ( struct ib_device *ibdev,
  473. unsigned long qpn );
  474. extern struct ib_queue_pair * ib_find_qp_mgid ( struct ib_device *ibdev,
  475. union ib_gid *gid );
  476. extern struct ib_work_queue * ib_find_wq ( struct ib_completion_queue *cq,
  477. unsigned long qpn, int is_send );
  478. extern int ib_post_send ( struct ib_device *ibdev, struct ib_queue_pair *qp,
  479. struct ib_address_vector *dest,
  480. struct io_buffer *iobuf );
  481. extern int ib_post_recv ( struct ib_device *ibdev, struct ib_queue_pair *qp,
  482. struct io_buffer *iobuf );
  483. extern void ib_complete_send ( struct ib_device *ibdev,
  484. struct ib_queue_pair *qp,
  485. struct io_buffer *iobuf, int rc );
  486. extern void ib_complete_recv ( struct ib_device *ibdev,
  487. struct ib_queue_pair *qp,
  488. struct ib_address_vector *dest,
  489. struct ib_address_vector *source,
  490. struct io_buffer *iobuf, int rc );
  491. extern void ib_refill_recv ( struct ib_device *ibdev,
  492. struct ib_queue_pair *qp );
  493. extern int ib_open ( struct ib_device *ibdev );
  494. extern void ib_close ( struct ib_device *ibdev );
  495. extern int ib_link_rc ( struct ib_device *ibdev );
  496. extern int ib_mcast_attach ( struct ib_device *ibdev, struct ib_queue_pair *qp,
  497. union ib_gid *gid );
  498. extern void ib_mcast_detach ( struct ib_device *ibdev,
  499. struct ib_queue_pair *qp, union ib_gid *gid );
  500. extern int ib_count_ports ( struct ib_device *ibdev );
  501. extern int ib_set_port_info ( struct ib_device *ibdev, union ib_mad *mad );
  502. extern int ib_set_pkey_table ( struct ib_device *ibdev, union ib_mad *mad );
  503. extern struct ib_device * alloc_ibdev ( size_t priv_size );
  504. extern int register_ibdev ( struct ib_device *ibdev );
  505. extern void unregister_ibdev ( struct ib_device *ibdev );
  506. extern struct ib_device * find_ibdev ( union ib_gid *gid );
  507. extern struct ib_device * last_opened_ibdev ( void );
  508. extern void ib_link_state_changed ( struct ib_device *ibdev );
  509. extern void ib_poll_eq ( struct ib_device *ibdev );
  510. extern struct list_head ib_devices;
  511. /** Iterate over all network devices */
  512. #define for_each_ibdev( ibdev ) \
  513. list_for_each_entry ( (ibdev), &ib_devices, list )
  514. /**
  515. * Check link state of Infiniband device
  516. *
  517. * @v ibdev Infiniband device
  518. * @ret link_up Link is up
  519. */
  520. static inline __always_inline int
  521. ib_link_ok ( struct ib_device *ibdev ) {
  522. return ( ibdev->port_state == IB_PORT_STATE_ACTIVE );
  523. }
  524. /**
  525. * Check whether or not Infiniband device is open
  526. *
  527. * @v ibdev Infiniband device
  528. * @v is_open Infiniband device is open
  529. */
  530. static inline __attribute__ (( always_inline )) int
  531. ib_is_open ( struct ib_device *ibdev ) {
  532. return ( ibdev->open_count > 0 );
  533. }
  534. /**
  535. * Get reference to Infiniband device
  536. *
  537. * @v ibdev Infiniband device
  538. * @ret ibdev Infiniband device
  539. */
  540. static inline __always_inline struct ib_device *
  541. ibdev_get ( struct ib_device *ibdev ) {
  542. ref_get ( &ibdev->refcnt );
  543. return ibdev;
  544. }
  545. /**
  546. * Drop reference to Infiniband device
  547. *
  548. * @v ibdev Infiniband device
  549. */
  550. static inline __always_inline void
  551. ibdev_put ( struct ib_device *ibdev ) {
  552. ref_put ( &ibdev->refcnt );
  553. }
  554. /**
  555. * Set Infiniband work queue driver-private data
  556. *
  557. * @v wq Work queue
  558. * @v priv Private data
  559. */
  560. static inline __always_inline void
  561. ib_wq_set_drvdata ( struct ib_work_queue *wq, void *priv ) {
  562. wq->drv_priv = priv;
  563. }
  564. /**
  565. * Get Infiniband work queue driver-private data
  566. *
  567. * @v wq Work queue
  568. * @ret priv Private data
  569. */
  570. static inline __always_inline void *
  571. ib_wq_get_drvdata ( struct ib_work_queue *wq ) {
  572. return wq->drv_priv;
  573. }
  574. /**
  575. * Set Infiniband queue pair driver-private data
  576. *
  577. * @v qp Queue pair
  578. * @v priv Private data
  579. */
  580. static inline __always_inline void
  581. ib_qp_set_drvdata ( struct ib_queue_pair *qp, void *priv ) {
  582. qp->drv_priv = priv;
  583. }
  584. /**
  585. * Get Infiniband queue pair driver-private data
  586. *
  587. * @v qp Queue pair
  588. * @ret priv Private data
  589. */
  590. static inline __always_inline void *
  591. ib_qp_get_drvdata ( struct ib_queue_pair *qp ) {
  592. return qp->drv_priv;
  593. }
  594. /**
  595. * Set Infiniband queue pair owner-private data
  596. *
  597. * @v qp Queue pair
  598. * @v priv Private data
  599. */
  600. static inline __always_inline void
  601. ib_qp_set_ownerdata ( struct ib_queue_pair *qp, void *priv ) {
  602. qp->owner_priv = priv;
  603. }
  604. /**
  605. * Get Infiniband queue pair owner-private data
  606. *
  607. * @v qp Queue pair
  608. * @ret priv Private data
  609. */
  610. static inline __always_inline void *
  611. ib_qp_get_ownerdata ( struct ib_queue_pair *qp ) {
  612. return qp->owner_priv;
  613. }
  614. /**
  615. * Set Infiniband completion queue driver-private data
  616. *
  617. * @v cq Completion queue
  618. * @v priv Private data
  619. */
  620. static inline __always_inline void
  621. ib_cq_set_drvdata ( struct ib_completion_queue *cq, void *priv ) {
  622. cq->drv_priv = priv;
  623. }
  624. /**
  625. * Get Infiniband completion queue driver-private data
  626. *
  627. * @v cq Completion queue
  628. * @ret priv Private data
  629. */
  630. static inline __always_inline void *
  631. ib_cq_get_drvdata ( struct ib_completion_queue *cq ) {
  632. return cq->drv_priv;
  633. }
  634. /**
  635. * Set Infiniband device driver-private data
  636. *
  637. * @v ibdev Infiniband device
  638. * @v priv Private data
  639. */
  640. static inline __always_inline void
  641. ib_set_drvdata ( struct ib_device *ibdev, void *priv ) {
  642. ibdev->drv_priv = priv;
  643. }
  644. /**
  645. * Get Infiniband device driver-private data
  646. *
  647. * @v ibdev Infiniband device
  648. * @ret priv Private data
  649. */
  650. static inline __always_inline void *
  651. ib_get_drvdata ( struct ib_device *ibdev ) {
  652. return ibdev->drv_priv;
  653. }
  654. #endif /* _IPXE_INFINIBAND_H */