Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

infiniband.h 18KB

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