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

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