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.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720
  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. /** An Infiniband device */
  368. struct ib_device {
  369. /** Reference counter */
  370. struct refcnt refcnt;
  371. /** List of Infiniband devices */
  372. struct list_head list;
  373. /** List of open Infiniband devices */
  374. struct list_head open_list;
  375. /** Underlying device */
  376. struct device *dev;
  377. /** List of completion queues */
  378. struct list_head cqs;
  379. /** List of queue pairs */
  380. struct list_head qps;
  381. /** Infiniband operations */
  382. struct ib_device_operations *op;
  383. /** Port number */
  384. unsigned int port;
  385. /** Port open request counter */
  386. unsigned int open_count;
  387. /** Port state */
  388. uint8_t port_state;
  389. /** Link width supported */
  390. uint8_t link_width_supported;
  391. /** Link width enabled */
  392. uint8_t link_width_enabled;
  393. /** Link width active */
  394. uint8_t link_width_active;
  395. /** Link speed supported */
  396. uint8_t link_speed_supported;
  397. /** Link speed enabled */
  398. uint8_t link_speed_enabled;
  399. /** Link speed active */
  400. uint8_t link_speed_active;
  401. /** Node GUID */
  402. union ib_guid node_guid;
  403. /** Port GID (comprising GID prefix and port GUID) */
  404. union ib_gid gid;
  405. /** Port LID */
  406. uint16_t lid;
  407. /** Subnet manager LID */
  408. uint16_t sm_lid;
  409. /** Subnet manager SL */
  410. uint8_t sm_sl;
  411. /** Partition key */
  412. uint16_t pkey;
  413. /** RDMA key
  414. *
  415. * This is a single key allowing unrestricted access to
  416. * memory.
  417. */
  418. uint32_t rdma_key;
  419. /** Subnet management interface */
  420. struct ib_mad_interface *smi;
  421. /** General services interface */
  422. struct ib_mad_interface *gsi;
  423. /** Driver private data */
  424. void *drv_priv;
  425. /** Owner private data */
  426. void *owner_priv;
  427. };
  428. /** An Infiniband upper-layer driver */
  429. struct ib_driver {
  430. /** Name */
  431. const char *name;
  432. /** Probe device
  433. *
  434. * @v ibdev Infiniband device
  435. * @ret rc Return status code
  436. */
  437. int ( * probe ) ( struct ib_device *ibdev );
  438. /** Notify of device or link state change
  439. *
  440. * @v ibdev Infiniband device
  441. */
  442. void ( * notify ) ( struct ib_device *ibdev );
  443. /** Remove device
  444. *
  445. * @v ibdev Infiniband device
  446. */
  447. void ( * remove ) ( struct ib_device *ibdev );
  448. };
  449. /** Infiniband driver table */
  450. #define IB_DRIVERS __table ( struct ib_driver, "ib_drivers" )
  451. /** Declare an Infiniband driver */
  452. #define __ib_driver __table_entry ( IB_DRIVERS, 01 )
  453. extern struct ib_completion_queue *
  454. ib_create_cq ( struct ib_device *ibdev, unsigned int num_cqes,
  455. struct ib_completion_queue_operations *op );
  456. extern void ib_destroy_cq ( struct ib_device *ibdev,
  457. struct ib_completion_queue *cq );
  458. extern void ib_poll_cq ( struct ib_device *ibdev,
  459. struct ib_completion_queue *cq );
  460. extern struct ib_queue_pair *
  461. ib_create_qp ( struct ib_device *ibdev, enum ib_queue_pair_type type,
  462. unsigned int num_send_wqes, struct ib_completion_queue *send_cq,
  463. unsigned int num_recv_wqes, struct ib_completion_queue *recv_cq,
  464. struct ib_queue_pair_operations *op );
  465. extern int ib_modify_qp ( struct ib_device *ibdev, struct ib_queue_pair *qp );
  466. extern void ib_destroy_qp ( struct ib_device *ibdev,
  467. struct ib_queue_pair *qp );
  468. extern struct ib_queue_pair * ib_find_qp_qpn ( struct ib_device *ibdev,
  469. unsigned long qpn );
  470. extern struct ib_queue_pair * ib_find_qp_mgid ( struct ib_device *ibdev,
  471. union ib_gid *gid );
  472. extern struct ib_work_queue * ib_find_wq ( struct ib_completion_queue *cq,
  473. unsigned long qpn, int is_send );
  474. extern int ib_post_send ( struct ib_device *ibdev, struct ib_queue_pair *qp,
  475. struct ib_address_vector *dest,
  476. struct io_buffer *iobuf );
  477. extern int ib_post_recv ( struct ib_device *ibdev, struct ib_queue_pair *qp,
  478. struct io_buffer *iobuf );
  479. extern void ib_complete_send ( struct ib_device *ibdev,
  480. struct ib_queue_pair *qp,
  481. struct io_buffer *iobuf, int rc );
  482. extern void ib_complete_recv ( struct ib_device *ibdev,
  483. struct ib_queue_pair *qp,
  484. struct ib_address_vector *dest,
  485. struct ib_address_vector *source,
  486. struct io_buffer *iobuf, int rc );
  487. extern void ib_refill_recv ( struct ib_device *ibdev,
  488. struct ib_queue_pair *qp );
  489. extern int ib_open ( struct ib_device *ibdev );
  490. extern void ib_close ( struct ib_device *ibdev );
  491. extern int ib_link_rc ( struct ib_device *ibdev );
  492. extern int ib_mcast_attach ( struct ib_device *ibdev, struct ib_queue_pair *qp,
  493. union ib_gid *gid );
  494. extern void ib_mcast_detach ( struct ib_device *ibdev,
  495. struct ib_queue_pair *qp, union ib_gid *gid );
  496. extern int ib_count_ports ( struct ib_device *ibdev );
  497. extern int ib_set_port_info ( struct ib_device *ibdev, union ib_mad *mad );
  498. extern int ib_set_pkey_table ( struct ib_device *ibdev, union ib_mad *mad );
  499. extern struct ib_device * alloc_ibdev ( size_t priv_size );
  500. extern int register_ibdev ( struct ib_device *ibdev );
  501. extern void unregister_ibdev ( struct ib_device *ibdev );
  502. extern struct ib_device * find_ibdev ( union ib_gid *gid );
  503. extern struct ib_device * last_opened_ibdev ( void );
  504. extern void ib_link_state_changed ( struct ib_device *ibdev );
  505. extern void ib_poll_eq ( struct ib_device *ibdev );
  506. extern struct list_head ib_devices;
  507. /** Iterate over all network devices */
  508. #define for_each_ibdev( ibdev ) \
  509. list_for_each_entry ( (ibdev), &ib_devices, list )
  510. /**
  511. * Check link state of Infiniband device
  512. *
  513. * @v ibdev Infiniband device
  514. * @ret link_up Link is up
  515. */
  516. static inline __always_inline int
  517. ib_link_ok ( struct ib_device *ibdev ) {
  518. return ( ibdev->port_state == IB_PORT_STATE_ACTIVE );
  519. }
  520. /**
  521. * Check whether or not Infiniband device is open
  522. *
  523. * @v ibdev Infiniband device
  524. * @v is_open Infiniband device is open
  525. */
  526. static inline __attribute__ (( always_inline )) int
  527. ib_is_open ( struct ib_device *ibdev ) {
  528. return ( ibdev->open_count > 0 );
  529. }
  530. /**
  531. * Get reference to Infiniband device
  532. *
  533. * @v ibdev Infiniband device
  534. * @ret ibdev Infiniband device
  535. */
  536. static inline __always_inline struct ib_device *
  537. ibdev_get ( struct ib_device *ibdev ) {
  538. ref_get ( &ibdev->refcnt );
  539. return ibdev;
  540. }
  541. /**
  542. * Drop reference to Infiniband device
  543. *
  544. * @v ibdev Infiniband device
  545. */
  546. static inline __always_inline void
  547. ibdev_put ( struct ib_device *ibdev ) {
  548. ref_put ( &ibdev->refcnt );
  549. }
  550. /**
  551. * Set Infiniband work queue driver-private data
  552. *
  553. * @v wq Work queue
  554. * @v priv Private data
  555. */
  556. static inline __always_inline void
  557. ib_wq_set_drvdata ( struct ib_work_queue *wq, void *priv ) {
  558. wq->drv_priv = priv;
  559. }
  560. /**
  561. * Get Infiniband work queue driver-private data
  562. *
  563. * @v wq Work queue
  564. * @ret priv Private data
  565. */
  566. static inline __always_inline void *
  567. ib_wq_get_drvdata ( struct ib_work_queue *wq ) {
  568. return wq->drv_priv;
  569. }
  570. /**
  571. * Set Infiniband queue pair driver-private data
  572. *
  573. * @v qp Queue pair
  574. * @v priv Private data
  575. */
  576. static inline __always_inline void
  577. ib_qp_set_drvdata ( struct ib_queue_pair *qp, void *priv ) {
  578. qp->drv_priv = priv;
  579. }
  580. /**
  581. * Get Infiniband queue pair driver-private data
  582. *
  583. * @v qp Queue pair
  584. * @ret priv Private data
  585. */
  586. static inline __always_inline void *
  587. ib_qp_get_drvdata ( struct ib_queue_pair *qp ) {
  588. return qp->drv_priv;
  589. }
  590. /**
  591. * Set Infiniband queue pair owner-private data
  592. *
  593. * @v qp Queue pair
  594. * @v priv Private data
  595. */
  596. static inline __always_inline void
  597. ib_qp_set_ownerdata ( struct ib_queue_pair *qp, void *priv ) {
  598. qp->owner_priv = priv;
  599. }
  600. /**
  601. * Get Infiniband queue pair owner-private data
  602. *
  603. * @v qp Queue pair
  604. * @ret priv Private data
  605. */
  606. static inline __always_inline void *
  607. ib_qp_get_ownerdata ( struct ib_queue_pair *qp ) {
  608. return qp->owner_priv;
  609. }
  610. /**
  611. * Set Infiniband completion queue driver-private data
  612. *
  613. * @v cq Completion queue
  614. * @v priv Private data
  615. */
  616. static inline __always_inline void
  617. ib_cq_set_drvdata ( struct ib_completion_queue *cq, void *priv ) {
  618. cq->drv_priv = priv;
  619. }
  620. /**
  621. * Get Infiniband completion queue driver-private data
  622. *
  623. * @v cq Completion queue
  624. * @ret priv Private data
  625. */
  626. static inline __always_inline void *
  627. ib_cq_get_drvdata ( struct ib_completion_queue *cq ) {
  628. return cq->drv_priv;
  629. }
  630. /**
  631. * Set Infiniband device driver-private data
  632. *
  633. * @v ibdev Infiniband device
  634. * @v priv Private data
  635. */
  636. static inline __always_inline void
  637. ib_set_drvdata ( struct ib_device *ibdev, void *priv ) {
  638. ibdev->drv_priv = priv;
  639. }
  640. /**
  641. * Get Infiniband device driver-private data
  642. *
  643. * @v ibdev Infiniband device
  644. * @ret priv Private data
  645. */
  646. static inline __always_inline void *
  647. ib_get_drvdata ( struct ib_device *ibdev ) {
  648. return ibdev->drv_priv;
  649. }
  650. /**
  651. * Set Infiniband device owner-private data
  652. *
  653. * @v ibdev Infiniband device
  654. * @v priv Private data
  655. */
  656. static inline __always_inline void
  657. ib_set_ownerdata ( struct ib_device *ibdev, void *priv ) {
  658. ibdev->owner_priv = priv;
  659. }
  660. /**
  661. * Get Infiniband device owner-private data
  662. *
  663. * @v ibdev Infiniband device
  664. * @ret priv Private data
  665. */
  666. static inline __always_inline void *
  667. ib_get_ownerdata ( struct ib_device *ibdev ) {
  668. return ibdev->owner_priv;
  669. }
  670. #endif /* _IPXE_INFINIBAND_H */