Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

infiniband.h 18KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705
  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 name */
  142. const char *name;
  143. /** Queue pair number */
  144. unsigned long qpn;
  145. /** Externally-visible queue pair number
  146. *
  147. * This may differ from the real queue pair number (e.g. when
  148. * the HCA cannot use the management QPNs 0 and 1 as hardware
  149. * QPNs and needs to remap them).
  150. */
  151. unsigned long ext_qpn;
  152. /** Queue pair type */
  153. enum ib_queue_pair_type type;
  154. /** Queue key */
  155. unsigned long qkey;
  156. /** Send queue */
  157. struct ib_work_queue send;
  158. /** Receive queue */
  159. struct ib_work_queue recv;
  160. /** List of multicast GIDs */
  161. struct list_head mgids;
  162. /** Address vector */
  163. struct ib_address_vector av;
  164. /** Queue pair operations */
  165. struct ib_queue_pair_operations *op;
  166. /** Driver private data */
  167. void *drv_priv;
  168. /** Queue owner private data */
  169. void *owner_priv;
  170. };
  171. /** Infiniband completion queue operations */
  172. struct ib_completion_queue_operations {
  173. /**
  174. * Complete Send WQE
  175. *
  176. * @v ibdev Infiniband device
  177. * @v qp Queue pair
  178. * @v iobuf I/O buffer
  179. * @v rc Completion status code
  180. */
  181. void ( * complete_send ) ( struct ib_device *ibdev,
  182. struct ib_queue_pair *qp,
  183. struct io_buffer *iobuf, int rc );
  184. /**
  185. * Complete Receive WQE
  186. *
  187. * @v ibdev Infiniband device
  188. * @v qp Queue pair
  189. * @v dest Destination address vector, or NULL
  190. * @v source Source address vector, or NULL
  191. * @v iobuf I/O buffer
  192. * @v rc Completion status code
  193. */
  194. void ( * complete_recv ) ( struct ib_device *ibdev,
  195. struct ib_queue_pair *qp,
  196. struct ib_address_vector *dest,
  197. struct ib_address_vector *source,
  198. struct io_buffer *iobuf, int rc );
  199. };
  200. /** An Infiniband Completion Queue */
  201. struct ib_completion_queue {
  202. /** Containing Infiniband device */
  203. struct ib_device *ibdev;
  204. /** List of completion queues on this Infiniband device */
  205. struct list_head list;
  206. /** Completion queue number */
  207. unsigned long cqn;
  208. /** Number of completion queue entries */
  209. unsigned int num_cqes;
  210. /** Next completion queue entry index
  211. *
  212. * This is the index of the next entry to be filled (i.e. the
  213. * first empty entry). This value is not bounded by num_wqes;
  214. * users must logical-AND with (num_wqes-1) to generate an
  215. * array index.
  216. */
  217. unsigned long next_idx;
  218. /** List of work queues completing to this queue */
  219. struct list_head work_queues;
  220. /** Completion queue operations */
  221. struct ib_completion_queue_operations *op;
  222. /** Driver private data */
  223. void *drv_priv;
  224. };
  225. /**
  226. * Infiniband device operations
  227. *
  228. * These represent a subset of the Infiniband Verbs.
  229. */
  230. struct ib_device_operations {
  231. /** Create completion queue
  232. *
  233. * @v ibdev Infiniband device
  234. * @v cq Completion queue
  235. * @ret rc Return status code
  236. */
  237. int ( * create_cq ) ( struct ib_device *ibdev,
  238. struct ib_completion_queue *cq );
  239. /** Destroy completion queue
  240. *
  241. * @v ibdev Infiniband device
  242. * @v cq Completion queue
  243. */
  244. void ( * destroy_cq ) ( struct ib_device *ibdev,
  245. struct ib_completion_queue *cq );
  246. /** Create queue pair
  247. *
  248. * @v ibdev Infiniband device
  249. * @v qp Queue pair
  250. * @ret rc Return status code
  251. */
  252. int ( * create_qp ) ( struct ib_device *ibdev,
  253. struct ib_queue_pair *qp );
  254. /** Modify queue pair
  255. *
  256. * @v ibdev Infiniband device
  257. * @v qp Queue pair
  258. * @ret rc Return status code
  259. */
  260. int ( * modify_qp ) ( struct ib_device *ibdev,
  261. struct ib_queue_pair *qp );
  262. /** Destroy queue pair
  263. *
  264. * @v ibdev Infiniband device
  265. * @v qp Queue pair
  266. */
  267. void ( * destroy_qp ) ( struct ib_device *ibdev,
  268. struct ib_queue_pair *qp );
  269. /** Post send work queue entry
  270. *
  271. * @v ibdev Infiniband device
  272. * @v qp Queue pair
  273. * @v dest Destination address vector
  274. * @v iobuf I/O buffer
  275. * @ret rc Return status code
  276. *
  277. * If this method returns success, the I/O buffer remains
  278. * owned by the queue pair. If this method returns failure,
  279. * the I/O buffer is immediately released; the failure is
  280. * interpreted as "failure to enqueue buffer".
  281. */
  282. int ( * post_send ) ( struct ib_device *ibdev,
  283. struct ib_queue_pair *qp,
  284. struct ib_address_vector *dest,
  285. struct io_buffer *iobuf );
  286. /** Post receive work queue entry
  287. *
  288. * @v ibdev Infiniband device
  289. * @v qp Queue pair
  290. * @v iobuf I/O buffer
  291. * @ret rc Return status code
  292. *
  293. * If this method returns success, the I/O buffer remains
  294. * owned by the queue pair. If this method returns failure,
  295. * the I/O buffer is immediately released; the failure is
  296. * interpreted as "failure to enqueue buffer".
  297. */
  298. int ( * post_recv ) ( struct ib_device *ibdev,
  299. struct ib_queue_pair *qp,
  300. struct io_buffer *iobuf );
  301. /** Poll completion queue
  302. *
  303. * @v ibdev Infiniband device
  304. * @v cq Completion queue
  305. *
  306. * The relevant completion handler (specified at completion
  307. * queue creation time) takes ownership of the I/O buffer.
  308. */
  309. void ( * poll_cq ) ( struct ib_device *ibdev,
  310. struct ib_completion_queue *cq );
  311. /**
  312. * Poll event queue
  313. *
  314. * @v ibdev Infiniband device
  315. */
  316. void ( * poll_eq ) ( struct ib_device *ibdev );
  317. /**
  318. * Open port
  319. *
  320. * @v ibdev Infiniband device
  321. * @ret rc Return status code
  322. */
  323. int ( * open ) ( struct ib_device *ibdev );
  324. /**
  325. * Close port
  326. *
  327. * @v ibdev Infiniband device
  328. */
  329. void ( * close ) ( struct ib_device *ibdev );
  330. /** Attach to multicast group
  331. *
  332. * @v ibdev Infiniband device
  333. * @v qp Queue pair
  334. * @v gid Multicast GID
  335. * @ret rc Return status code
  336. */
  337. int ( * mcast_attach ) ( struct ib_device *ibdev,
  338. struct ib_queue_pair *qp,
  339. union ib_gid *gid );
  340. /** Detach from multicast group
  341. *
  342. * @v ibdev Infiniband device
  343. * @v qp Queue pair
  344. * @v gid Multicast GID
  345. */
  346. void ( * mcast_detach ) ( struct ib_device *ibdev,
  347. struct ib_queue_pair *qp,
  348. union ib_gid *gid );
  349. /** Set port information
  350. *
  351. * @v ibdev Infiniband device
  352. * @v mad Set port information MAD
  353. *
  354. * This method is required only by adapters that do not have
  355. * an embedded SMA.
  356. */
  357. int ( * set_port_info ) ( struct ib_device *ibdev, union ib_mad *mad );
  358. /** Set partition key table
  359. *
  360. * @v ibdev Infiniband device
  361. * @v mad Set partition key table MAD
  362. *
  363. * This method is required only by adapters that do not have
  364. * an embedded SMA.
  365. */
  366. int ( * set_pkey_table ) ( struct ib_device *ibdev,
  367. union ib_mad *mad );
  368. };
  369. /** Maximum length of an Infiniband device name */
  370. #define IBDEV_NAME_LEN 8
  371. /** An Infiniband device */
  372. struct ib_device {
  373. /** Reference counter */
  374. struct refcnt refcnt;
  375. /** List of Infiniband devices */
  376. struct list_head list;
  377. /** List of open Infiniband devices */
  378. struct list_head open_list;
  379. /** Index of this Infiniband device */
  380. unsigned int index;
  381. /** Name of this Infiniband device */
  382. char name[IBDEV_NAME_LEN];
  383. /** Underlying device */
  384. struct device *dev;
  385. /** List of completion queues */
  386. struct list_head cqs;
  387. /** List of queue pairs */
  388. struct list_head qps;
  389. /** Infiniband operations */
  390. struct ib_device_operations *op;
  391. /** Port number */
  392. unsigned int port;
  393. /** Port open request counter */
  394. unsigned int open_count;
  395. /** Port state */
  396. uint8_t port_state;
  397. /** Link width supported */
  398. uint8_t link_width_supported;
  399. /** Link width enabled */
  400. uint8_t link_width_enabled;
  401. /** Link width active */
  402. uint8_t link_width_active;
  403. /** Link speed supported */
  404. uint8_t link_speed_supported;
  405. /** Link speed enabled */
  406. uint8_t link_speed_enabled;
  407. /** Link speed active */
  408. uint8_t link_speed_active;
  409. /** Node GUID */
  410. union ib_guid node_guid;
  411. /** Port GID (comprising GID prefix and port GUID) */
  412. union ib_gid gid;
  413. /** Port LID */
  414. uint16_t lid;
  415. /** Subnet manager LID */
  416. uint16_t sm_lid;
  417. /** Subnet manager SL */
  418. uint8_t sm_sl;
  419. /** Partition key */
  420. uint16_t pkey;
  421. /** RDMA key
  422. *
  423. * This is a single key allowing unrestricted access to
  424. * memory.
  425. */
  426. uint32_t rdma_key;
  427. /** Subnet management interface */
  428. struct ib_mad_interface *smi;
  429. /** General services interface */
  430. struct ib_mad_interface *gsi;
  431. /** Driver private data */
  432. void *drv_priv;
  433. };
  434. /** An Infiniband upper-layer driver */
  435. struct ib_driver {
  436. /** Name */
  437. const char *name;
  438. /** Probe device
  439. *
  440. * @v ibdev Infiniband device
  441. * @ret rc Return status code
  442. */
  443. int ( * probe ) ( struct ib_device *ibdev );
  444. /** Notify of device or link state change
  445. *
  446. * @v ibdev Infiniband device
  447. */
  448. void ( * notify ) ( struct ib_device *ibdev );
  449. /** Remove device
  450. *
  451. * @v ibdev Infiniband device
  452. */
  453. void ( * remove ) ( struct ib_device *ibdev );
  454. };
  455. /** Infiniband driver table */
  456. #define IB_DRIVERS __table ( struct ib_driver, "ib_drivers" )
  457. /** Declare an Infiniband driver */
  458. #define __ib_driver __table_entry ( IB_DRIVERS, 01 )
  459. extern struct ib_completion_queue *
  460. ib_create_cq ( struct ib_device *ibdev, unsigned int num_cqes,
  461. struct ib_completion_queue_operations *op );
  462. extern void ib_destroy_cq ( struct ib_device *ibdev,
  463. struct ib_completion_queue *cq );
  464. extern void ib_poll_cq ( struct ib_device *ibdev,
  465. struct ib_completion_queue *cq );
  466. extern struct ib_queue_pair *
  467. ib_create_qp ( struct ib_device *ibdev, enum ib_queue_pair_type type,
  468. unsigned int num_send_wqes, struct ib_completion_queue *send_cq,
  469. unsigned int num_recv_wqes, struct ib_completion_queue *recv_cq,
  470. struct ib_queue_pair_operations *op, const char *name );
  471. extern int ib_modify_qp ( struct ib_device *ibdev, struct ib_queue_pair *qp );
  472. extern void ib_destroy_qp ( struct ib_device *ibdev,
  473. struct ib_queue_pair *qp );
  474. extern struct ib_queue_pair * ib_find_qp_qpn ( struct ib_device *ibdev,
  475. unsigned long qpn );
  476. extern struct ib_queue_pair * ib_find_qp_mgid ( struct ib_device *ibdev,
  477. union ib_gid *gid );
  478. extern struct ib_work_queue * ib_find_wq ( struct ib_completion_queue *cq,
  479. unsigned long qpn, int is_send );
  480. extern int ib_post_send ( struct ib_device *ibdev, struct ib_queue_pair *qp,
  481. struct ib_address_vector *dest,
  482. struct io_buffer *iobuf );
  483. extern int ib_post_recv ( struct ib_device *ibdev, struct ib_queue_pair *qp,
  484. struct io_buffer *iobuf );
  485. extern void ib_complete_send ( struct ib_device *ibdev,
  486. struct ib_queue_pair *qp,
  487. struct io_buffer *iobuf, int rc );
  488. extern void ib_complete_recv ( struct ib_device *ibdev,
  489. struct ib_queue_pair *qp,
  490. struct ib_address_vector *dest,
  491. struct ib_address_vector *source,
  492. struct io_buffer *iobuf, int rc );
  493. extern void ib_refill_recv ( struct ib_device *ibdev,
  494. struct ib_queue_pair *qp );
  495. extern int ib_open ( struct ib_device *ibdev );
  496. extern void ib_close ( struct ib_device *ibdev );
  497. extern int ib_link_rc ( struct ib_device *ibdev );
  498. extern int ib_mcast_attach ( struct ib_device *ibdev, struct ib_queue_pair *qp,
  499. union ib_gid *gid );
  500. extern void ib_mcast_detach ( struct ib_device *ibdev,
  501. struct ib_queue_pair *qp, union ib_gid *gid );
  502. extern int ib_count_ports ( struct ib_device *ibdev );
  503. extern int ib_set_port_info ( struct ib_device *ibdev, union ib_mad *mad );
  504. extern int ib_set_pkey_table ( struct ib_device *ibdev, union ib_mad *mad );
  505. extern struct ib_device * alloc_ibdev ( size_t priv_size );
  506. extern int register_ibdev ( struct ib_device *ibdev );
  507. extern void unregister_ibdev ( struct ib_device *ibdev );
  508. extern struct ib_device * find_ibdev ( union ib_gid *gid );
  509. extern struct ib_device * last_opened_ibdev ( void );
  510. extern void ib_link_state_changed ( struct ib_device *ibdev );
  511. extern void ib_poll_eq ( struct ib_device *ibdev );
  512. extern struct list_head ib_devices;
  513. /** Iterate over all network devices */
  514. #define for_each_ibdev( ibdev ) \
  515. list_for_each_entry ( (ibdev), &ib_devices, list )
  516. /**
  517. * Check link state of Infiniband device
  518. *
  519. * @v ibdev Infiniband device
  520. * @ret link_up Link is up
  521. */
  522. static inline __always_inline int
  523. ib_link_ok ( struct ib_device *ibdev ) {
  524. return ( ibdev->port_state == IB_PORT_STATE_ACTIVE );
  525. }
  526. /**
  527. * Check whether or not Infiniband device is open
  528. *
  529. * @v ibdev Infiniband device
  530. * @v is_open Infiniband device is open
  531. */
  532. static inline __attribute__ (( always_inline )) int
  533. ib_is_open ( struct ib_device *ibdev ) {
  534. return ( ibdev->open_count > 0 );
  535. }
  536. /**
  537. * Get reference to Infiniband device
  538. *
  539. * @v ibdev Infiniband device
  540. * @ret ibdev Infiniband device
  541. */
  542. static inline __always_inline struct ib_device *
  543. ibdev_get ( struct ib_device *ibdev ) {
  544. ref_get ( &ibdev->refcnt );
  545. return ibdev;
  546. }
  547. /**
  548. * Drop reference to Infiniband device
  549. *
  550. * @v ibdev Infiniband device
  551. */
  552. static inline __always_inline void
  553. ibdev_put ( struct ib_device *ibdev ) {
  554. ref_put ( &ibdev->refcnt );
  555. }
  556. /**
  557. * Set Infiniband work queue driver-private data
  558. *
  559. * @v wq Work queue
  560. * @v priv Private data
  561. */
  562. static inline __always_inline void
  563. ib_wq_set_drvdata ( struct ib_work_queue *wq, void *priv ) {
  564. wq->drv_priv = priv;
  565. }
  566. /**
  567. * Get Infiniband work queue driver-private data
  568. *
  569. * @v wq Work queue
  570. * @ret priv Private data
  571. */
  572. static inline __always_inline void *
  573. ib_wq_get_drvdata ( struct ib_work_queue *wq ) {
  574. return wq->drv_priv;
  575. }
  576. /**
  577. * Set Infiniband queue pair driver-private data
  578. *
  579. * @v qp Queue pair
  580. * @v priv Private data
  581. */
  582. static inline __always_inline void
  583. ib_qp_set_drvdata ( struct ib_queue_pair *qp, void *priv ) {
  584. qp->drv_priv = priv;
  585. }
  586. /**
  587. * Get Infiniband queue pair driver-private data
  588. *
  589. * @v qp Queue pair
  590. * @ret priv Private data
  591. */
  592. static inline __always_inline void *
  593. ib_qp_get_drvdata ( struct ib_queue_pair *qp ) {
  594. return qp->drv_priv;
  595. }
  596. /**
  597. * Set Infiniband queue pair owner-private data
  598. *
  599. * @v qp Queue pair
  600. * @v priv Private data
  601. */
  602. static inline __always_inline void
  603. ib_qp_set_ownerdata ( struct ib_queue_pair *qp, void *priv ) {
  604. qp->owner_priv = priv;
  605. }
  606. /**
  607. * Get Infiniband queue pair owner-private data
  608. *
  609. * @v qp Queue pair
  610. * @ret priv Private data
  611. */
  612. static inline __always_inline void *
  613. ib_qp_get_ownerdata ( struct ib_queue_pair *qp ) {
  614. return qp->owner_priv;
  615. }
  616. /**
  617. * Set Infiniband completion queue driver-private data
  618. *
  619. * @v cq Completion queue
  620. * @v priv Private data
  621. */
  622. static inline __always_inline void
  623. ib_cq_set_drvdata ( struct ib_completion_queue *cq, void *priv ) {
  624. cq->drv_priv = priv;
  625. }
  626. /**
  627. * Get Infiniband completion queue driver-private data
  628. *
  629. * @v cq Completion queue
  630. * @ret priv Private data
  631. */
  632. static inline __always_inline void *
  633. ib_cq_get_drvdata ( struct ib_completion_queue *cq ) {
  634. return cq->drv_priv;
  635. }
  636. /**
  637. * Set Infiniband device driver-private data
  638. *
  639. * @v ibdev Infiniband device
  640. * @v priv Private data
  641. */
  642. static inline __always_inline void
  643. ib_set_drvdata ( struct ib_device *ibdev, void *priv ) {
  644. ibdev->drv_priv = priv;
  645. }
  646. /**
  647. * Get Infiniband device driver-private data
  648. *
  649. * @v ibdev Infiniband device
  650. * @ret priv Private data
  651. */
  652. static inline __always_inline void *
  653. ib_get_drvdata ( struct ib_device *ibdev ) {
  654. return ibdev->drv_priv;
  655. }
  656. #endif /* _IPXE_INFINIBAND_H */