ipath_verbs.h 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692
  1. /*
  2. * Copyright (c) 2005, 2006 PathScale, Inc. All rights reserved.
  3. *
  4. * This software is available to you under a choice of one of two
  5. * licenses. You may choose to be licensed under the terms of the GNU
  6. * General Public License (GPL) Version 2, available from the file
  7. * COPYING in the main directory of this source tree, or the
  8. * OpenIB.org BSD license below:
  9. *
  10. * Redistribution and use in source and binary forms, with or
  11. * without modification, are permitted provided that the following
  12. * conditions are met:
  13. *
  14. * - Redistributions of source code must retain the above
  15. * copyright notice, this list of conditions and the following
  16. * disclaimer.
  17. *
  18. * - Redistributions in binary form must reproduce the above
  19. * copyright notice, this list of conditions and the following
  20. * disclaimer in the documentation and/or other materials
  21. * provided with the distribution.
  22. *
  23. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  24. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  25. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  26. * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  27. * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  28. * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  29. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  30. * SOFTWARE.
  31. */
  32. #ifndef IPATH_VERBS_H
  33. #define IPATH_VERBS_H
  34. #include <linux/types.h>
  35. #include <linux/spinlock.h>
  36. #include <linux/kernel.h>
  37. #include <linux/interrupt.h>
  38. #include <rdma/ib_pack.h>
  39. #include "ipath_layer.h"
  40. #include "verbs_debug.h"
  41. #define QPN_MAX (1 << 24)
  42. #define QPNMAP_ENTRIES (QPN_MAX / PAGE_SIZE / BITS_PER_BYTE)
  43. /*
  44. * Increment this value if any changes that break userspace ABI
  45. * compatibility are made.
  46. */
  47. #define IPATH_UVERBS_ABI_VERSION 1
  48. /*
  49. * Define an ib_cq_notify value that is not valid so we know when CQ
  50. * notifications are armed.
  51. */
  52. #define IB_CQ_NONE (IB_CQ_NEXT_COMP + 1)
  53. #define IB_RNR_NAK 0x20
  54. #define IB_NAK_PSN_ERROR 0x60
  55. #define IB_NAK_INVALID_REQUEST 0x61
  56. #define IB_NAK_REMOTE_ACCESS_ERROR 0x62
  57. #define IB_NAK_REMOTE_OPERATIONAL_ERROR 0x63
  58. #define IB_NAK_INVALID_RD_REQUEST 0x64
  59. #define IPATH_POST_SEND_OK 0x01
  60. #define IPATH_POST_RECV_OK 0x02
  61. #define IPATH_PROCESS_RECV_OK 0x04
  62. #define IPATH_PROCESS_SEND_OK 0x08
  63. /* IB Performance Manager status values */
  64. #define IB_PMA_SAMPLE_STATUS_DONE 0x00
  65. #define IB_PMA_SAMPLE_STATUS_STARTED 0x01
  66. #define IB_PMA_SAMPLE_STATUS_RUNNING 0x02
  67. /* Mandatory IB performance counter select values. */
  68. #define IB_PMA_PORT_XMIT_DATA __constant_htons(0x0001)
  69. #define IB_PMA_PORT_RCV_DATA __constant_htons(0x0002)
  70. #define IB_PMA_PORT_XMIT_PKTS __constant_htons(0x0003)
  71. #define IB_PMA_PORT_RCV_PKTS __constant_htons(0x0004)
  72. #define IB_PMA_PORT_XMIT_WAIT __constant_htons(0x0005)
  73. struct ib_reth {
  74. __be64 vaddr;
  75. __be32 rkey;
  76. __be32 length;
  77. } __attribute__ ((packed));
  78. struct ib_atomic_eth {
  79. __be64 vaddr;
  80. __be32 rkey;
  81. __be64 swap_data;
  82. __be64 compare_data;
  83. } __attribute__ ((packed));
  84. struct ipath_other_headers {
  85. __be32 bth[3];
  86. union {
  87. struct {
  88. __be32 deth[2];
  89. __be32 imm_data;
  90. } ud;
  91. struct {
  92. struct ib_reth reth;
  93. __be32 imm_data;
  94. } rc;
  95. struct {
  96. __be32 aeth;
  97. __be64 atomic_ack_eth;
  98. } at;
  99. __be32 imm_data;
  100. __be32 aeth;
  101. struct ib_atomic_eth atomic_eth;
  102. } u;
  103. } __attribute__ ((packed));
  104. /*
  105. * Note that UD packets with a GRH header are 8+40+12+8 = 68 bytes
  106. * long (72 w/ imm_data). Only the first 56 bytes of the IB header
  107. * will be in the eager header buffer. The remaining 12 or 16 bytes
  108. * are in the data buffer.
  109. */
  110. struct ipath_ib_header {
  111. __be16 lrh[4];
  112. union {
  113. struct {
  114. struct ib_grh grh;
  115. struct ipath_other_headers oth;
  116. } l;
  117. struct ipath_other_headers oth;
  118. } u;
  119. } __attribute__ ((packed));
  120. /*
  121. * There is one struct ipath_mcast for each multicast GID.
  122. * All attached QPs are then stored as a list of
  123. * struct ipath_mcast_qp.
  124. */
  125. struct ipath_mcast_qp {
  126. struct list_head list;
  127. struct ipath_qp *qp;
  128. };
  129. struct ipath_mcast {
  130. struct rb_node rb_node;
  131. union ib_gid mgid;
  132. struct list_head qp_list;
  133. wait_queue_head_t wait;
  134. atomic_t refcount;
  135. };
  136. /* Memory region */
  137. struct ipath_mr {
  138. struct ib_mr ibmr;
  139. struct ipath_mregion mr; /* must be last */
  140. };
  141. /* Fast memory region */
  142. struct ipath_fmr {
  143. struct ib_fmr ibfmr;
  144. u8 page_shift;
  145. struct ipath_mregion mr; /* must be last */
  146. };
  147. /* Protection domain */
  148. struct ipath_pd {
  149. struct ib_pd ibpd;
  150. int user; /* non-zero if created from user space */
  151. };
  152. /* Address Handle */
  153. struct ipath_ah {
  154. struct ib_ah ibah;
  155. struct ib_ah_attr attr;
  156. };
  157. /*
  158. * Quick description of our CQ/QP locking scheme:
  159. *
  160. * We have one global lock that protects dev->cq/qp_table. Each
  161. * struct ipath_cq/qp also has its own lock. An individual qp lock
  162. * may be taken inside of an individual cq lock. Both cqs attached to
  163. * a qp may be locked, with the send cq locked first. No other
  164. * nesting should be done.
  165. *
  166. * Each struct ipath_cq/qp also has an atomic_t ref count. The
  167. * pointer from the cq/qp_table to the struct counts as one reference.
  168. * This reference also is good for access through the consumer API, so
  169. * modifying the CQ/QP etc doesn't need to take another reference.
  170. * Access because of a completion being polled does need a reference.
  171. *
  172. * Finally, each struct ipath_cq/qp has a wait_queue_head_t for the
  173. * destroy function to sleep on.
  174. *
  175. * This means that access from the consumer API requires nothing but
  176. * taking the struct's lock.
  177. *
  178. * Access because of a completion event should go as follows:
  179. * - lock cq/qp_table and look up struct
  180. * - increment ref count in struct
  181. * - drop cq/qp_table lock
  182. * - lock struct, do your thing, and unlock struct
  183. * - decrement ref count; if zero, wake up waiters
  184. *
  185. * To destroy a CQ/QP, we can do the following:
  186. * - lock cq/qp_table, remove pointer, unlock cq/qp_table lock
  187. * - decrement ref count
  188. * - wait_event until ref count is zero
  189. *
  190. * It is the consumer's responsibilty to make sure that no QP
  191. * operations (WQE posting or state modification) are pending when the
  192. * QP is destroyed. Also, the consumer must make sure that calls to
  193. * qp_modify are serialized.
  194. *
  195. * Possible optimizations (wait for profile data to see if/where we
  196. * have locks bouncing between CPUs):
  197. * - split cq/qp table lock into n separate (cache-aligned) locks,
  198. * indexed (say) by the page in the table
  199. */
  200. struct ipath_cq {
  201. struct ib_cq ibcq;
  202. struct tasklet_struct comptask;
  203. spinlock_t lock;
  204. u8 notify;
  205. u8 triggered;
  206. u32 head; /* new records added to the head */
  207. u32 tail; /* poll_cq() reads from here. */
  208. struct ib_wc *queue; /* this is actually ibcq.cqe + 1 */
  209. };
  210. /*
  211. * Send work request queue entry.
  212. * The size of the sg_list is determined when the QP is created and stored
  213. * in qp->s_max_sge.
  214. */
  215. struct ipath_swqe {
  216. struct ib_send_wr wr; /* don't use wr.sg_list */
  217. u32 psn; /* first packet sequence number */
  218. u32 lpsn; /* last packet sequence number */
  219. u32 ssn; /* send sequence number */
  220. u32 length; /* total length of data in sg_list */
  221. struct ipath_sge sg_list[0];
  222. };
  223. /*
  224. * Receive work request queue entry.
  225. * The size of the sg_list is determined when the QP is created and stored
  226. * in qp->r_max_sge.
  227. */
  228. struct ipath_rwqe {
  229. u64 wr_id;
  230. u32 length; /* total length of data in sg_list */
  231. u8 num_sge;
  232. struct ipath_sge sg_list[0];
  233. };
  234. struct ipath_rq {
  235. spinlock_t lock;
  236. u32 head; /* new work requests posted to the head */
  237. u32 tail; /* receives pull requests from here. */
  238. u32 size; /* size of RWQE array */
  239. u8 max_sge;
  240. struct ipath_rwqe *wq; /* RWQE array */
  241. };
  242. struct ipath_srq {
  243. struct ib_srq ibsrq;
  244. struct ipath_rq rq;
  245. /* send signal when number of RWQEs < limit */
  246. u32 limit;
  247. };
  248. /*
  249. * Variables prefixed with s_ are for the requester (sender).
  250. * Variables prefixed with r_ are for the responder (receiver).
  251. * Variables prefixed with ack_ are for responder replies.
  252. *
  253. * Common variables are protected by both r_rq.lock and s_lock in that order
  254. * which only happens in modify_qp() or changing the QP 'state'.
  255. */
  256. struct ipath_qp {
  257. struct ib_qp ibqp;
  258. struct ipath_qp *next; /* link list for QPN hash table */
  259. struct list_head piowait; /* link for wait PIO buf */
  260. struct list_head timerwait; /* link for waiting for timeouts */
  261. struct ib_ah_attr remote_ah_attr;
  262. struct ipath_ib_header s_hdr; /* next packet header to send */
  263. atomic_t refcount;
  264. wait_queue_head_t wait;
  265. struct tasklet_struct s_task;
  266. struct ipath_sge_state *s_cur_sge;
  267. struct ipath_sge_state s_sge; /* current send request data */
  268. /* current RDMA read send data */
  269. struct ipath_sge_state s_rdma_sge;
  270. struct ipath_sge_state r_sge; /* current receive data */
  271. spinlock_t s_lock;
  272. unsigned long s_flags;
  273. u32 s_hdrwords; /* size of s_hdr in 32 bit words */
  274. u32 s_cur_size; /* size of send packet in bytes */
  275. u32 s_len; /* total length of s_sge */
  276. u32 s_rdma_len; /* total length of s_rdma_sge */
  277. u32 s_next_psn; /* PSN for next request */
  278. u32 s_last_psn; /* last response PSN processed */
  279. u32 s_psn; /* current packet sequence number */
  280. u32 s_rnr_timeout; /* number of milliseconds for RNR timeout */
  281. u32 s_ack_psn; /* PSN for next ACK or RDMA_READ */
  282. u64 s_ack_atomic; /* data for atomic ACK */
  283. u64 r_wr_id; /* ID for current receive WQE */
  284. u64 r_atomic_data; /* data for last atomic op */
  285. u32 r_atomic_psn; /* PSN of last atomic op */
  286. u32 r_len; /* total length of r_sge */
  287. u32 r_rcv_len; /* receive data len processed */
  288. u32 r_psn; /* expected rcv packet sequence number */
  289. u8 state; /* QP state */
  290. u8 s_state; /* opcode of last packet sent */
  291. u8 s_ack_state; /* opcode of packet to ACK */
  292. u8 s_nak_state; /* non-zero if NAK is pending */
  293. u8 r_state; /* opcode of last packet received */
  294. u8 r_reuse_sge; /* for UC receive errors */
  295. u8 r_sge_inx; /* current index into sg_list */
  296. u8 s_max_sge; /* size of s_wq->sg_list */
  297. u8 qp_access_flags;
  298. u8 s_retry_cnt; /* number of times to retry */
  299. u8 s_rnr_retry_cnt;
  300. u8 s_min_rnr_timer;
  301. u8 s_retry; /* requester retry counter */
  302. u8 s_rnr_retry; /* requester RNR retry counter */
  303. u8 s_pkey_index; /* PKEY index to use */
  304. enum ib_mtu path_mtu;
  305. atomic_t msn; /* message sequence number */
  306. u32 remote_qpn;
  307. u32 qkey; /* QKEY for this QP (for UD or RD) */
  308. u32 s_size; /* send work queue size */
  309. u32 s_head; /* new entries added here */
  310. u32 s_tail; /* next entry to process */
  311. u32 s_cur; /* current work queue entry */
  312. u32 s_last; /* last un-ACK'ed entry */
  313. u32 s_ssn; /* SSN of tail entry */
  314. u32 s_lsn; /* limit sequence number (credit) */
  315. struct ipath_swqe *s_wq; /* send work queue */
  316. struct ipath_rq r_rq; /* receive work queue */
  317. };
  318. /*
  319. * Bit definitions for s_flags.
  320. */
  321. #define IPATH_S_BUSY 0
  322. #define IPATH_S_SIGNAL_REQ_WR 1
  323. /*
  324. * Since struct ipath_swqe is not a fixed size, we can't simply index into
  325. * struct ipath_qp.s_wq. This function does the array index computation.
  326. */
  327. static inline struct ipath_swqe *get_swqe_ptr(struct ipath_qp *qp,
  328. unsigned n)
  329. {
  330. return (struct ipath_swqe *)((char *)qp->s_wq +
  331. (sizeof(struct ipath_swqe) +
  332. qp->s_max_sge *
  333. sizeof(struct ipath_sge)) * n);
  334. }
  335. /*
  336. * Since struct ipath_rwqe is not a fixed size, we can't simply index into
  337. * struct ipath_rq.wq. This function does the array index computation.
  338. */
  339. static inline struct ipath_rwqe *get_rwqe_ptr(struct ipath_rq *rq,
  340. unsigned n)
  341. {
  342. return (struct ipath_rwqe *)
  343. ((char *) rq->wq +
  344. (sizeof(struct ipath_rwqe) +
  345. rq->max_sge * sizeof(struct ipath_sge)) * n);
  346. }
  347. /*
  348. * QPN-map pages start out as NULL, they get allocated upon
  349. * first use and are never deallocated. This way,
  350. * large bitmaps are not allocated unless large numbers of QPs are used.
  351. */
  352. struct qpn_map {
  353. atomic_t n_free;
  354. void *page;
  355. };
  356. struct ipath_qp_table {
  357. spinlock_t lock;
  358. u32 last; /* last QP number allocated */
  359. u32 max; /* size of the hash table */
  360. u32 nmaps; /* size of the map table */
  361. struct ipath_qp **table;
  362. /* bit map of free numbers */
  363. struct qpn_map map[QPNMAP_ENTRIES];
  364. };
  365. struct ipath_lkey_table {
  366. spinlock_t lock;
  367. u32 next; /* next unused index (speeds search) */
  368. u32 gen; /* generation count */
  369. u32 max; /* size of the table */
  370. struct ipath_mregion **table;
  371. };
  372. struct ipath_opcode_stats {
  373. u64 n_packets; /* number of packets */
  374. u64 n_bytes; /* total number of bytes */
  375. };
  376. struct ipath_ibdev {
  377. struct ib_device ibdev;
  378. struct list_head dev_list;
  379. struct ipath_devdata *dd;
  380. int ib_unit; /* This is the device number */
  381. u16 sm_lid; /* in host order */
  382. u8 sm_sl;
  383. u8 mkeyprot_resv_lmc;
  384. /* non-zero when timer is set */
  385. unsigned long mkey_lease_timeout;
  386. /* The following fields are really per port. */
  387. struct ipath_qp_table qp_table;
  388. struct ipath_lkey_table lk_table;
  389. struct list_head pending[3]; /* FIFO of QPs waiting for ACKs */
  390. struct list_head piowait; /* list for wait PIO buf */
  391. /* list of QPs waiting for RNR timer */
  392. struct list_head rnrwait;
  393. spinlock_t pending_lock;
  394. __be64 sys_image_guid; /* in network order */
  395. __be64 gid_prefix; /* in network order */
  396. __be64 mkey;
  397. u64 ipath_sword; /* total dwords sent (sample result) */
  398. u64 ipath_rword; /* total dwords received (sample result) */
  399. u64 ipath_spkts; /* total packets sent (sample result) */
  400. u64 ipath_rpkts; /* total packets received (sample result) */
  401. /* # of ticks no data sent (sample result) */
  402. u64 ipath_xmit_wait;
  403. u64 rcv_errors; /* # of packets with SW detected rcv errs */
  404. u64 n_unicast_xmit; /* total unicast packets sent */
  405. u64 n_unicast_rcv; /* total unicast packets received */
  406. u64 n_multicast_xmit; /* total multicast packets sent */
  407. u64 n_multicast_rcv; /* total multicast packets received */
  408. u64 n_symbol_error_counter; /* starting count for PMA */
  409. u64 n_link_error_recovery_counter; /* starting count for PMA */
  410. u64 n_link_downed_counter; /* starting count for PMA */
  411. u64 n_port_rcv_errors; /* starting count for PMA */
  412. u64 n_port_rcv_remphys_errors; /* starting count for PMA */
  413. u64 n_port_xmit_discards; /* starting count for PMA */
  414. u64 n_port_xmit_data; /* starting count for PMA */
  415. u64 n_port_rcv_data; /* starting count for PMA */
  416. u64 n_port_xmit_packets; /* starting count for PMA */
  417. u64 n_port_rcv_packets; /* starting count for PMA */
  418. u32 n_pkey_violations; /* starting count for PMA */
  419. u32 n_rc_resends;
  420. u32 n_rc_acks;
  421. u32 n_rc_qacks;
  422. u32 n_seq_naks;
  423. u32 n_rdma_seq;
  424. u32 n_rnr_naks;
  425. u32 n_other_naks;
  426. u32 n_timeouts;
  427. u32 n_pkt_drops;
  428. u32 n_wqe_errs;
  429. u32 n_rdma_dup_busy;
  430. u32 n_piowait;
  431. u32 n_no_piobuf;
  432. u32 port_cap_flags;
  433. u32 pma_sample_start;
  434. u32 pma_sample_interval;
  435. __be16 pma_counter_select[5];
  436. u16 pma_tag;
  437. u16 qkey_violations;
  438. u16 mkey_violations;
  439. u16 mkey_lease_period;
  440. u16 pending_index; /* which pending queue is active */
  441. u8 pma_sample_status;
  442. u8 subnet_timeout;
  443. u8 link_width_enabled;
  444. u8 vl_high_limit;
  445. struct ipath_opcode_stats opstats[128];
  446. };
  447. struct ipath_ucontext {
  448. struct ib_ucontext ibucontext;
  449. };
  450. static inline struct ipath_mr *to_imr(struct ib_mr *ibmr)
  451. {
  452. return container_of(ibmr, struct ipath_mr, ibmr);
  453. }
  454. static inline struct ipath_fmr *to_ifmr(struct ib_fmr *ibfmr)
  455. {
  456. return container_of(ibfmr, struct ipath_fmr, ibfmr);
  457. }
  458. static inline struct ipath_pd *to_ipd(struct ib_pd *ibpd)
  459. {
  460. return container_of(ibpd, struct ipath_pd, ibpd);
  461. }
  462. static inline struct ipath_ah *to_iah(struct ib_ah *ibah)
  463. {
  464. return container_of(ibah, struct ipath_ah, ibah);
  465. }
  466. static inline struct ipath_cq *to_icq(struct ib_cq *ibcq)
  467. {
  468. return container_of(ibcq, struct ipath_cq, ibcq);
  469. }
  470. static inline struct ipath_srq *to_isrq(struct ib_srq *ibsrq)
  471. {
  472. return container_of(ibsrq, struct ipath_srq, ibsrq);
  473. }
  474. static inline struct ipath_qp *to_iqp(struct ib_qp *ibqp)
  475. {
  476. return container_of(ibqp, struct ipath_qp, ibqp);
  477. }
  478. static inline struct ipath_ibdev *to_idev(struct ib_device *ibdev)
  479. {
  480. return container_of(ibdev, struct ipath_ibdev, ibdev);
  481. }
  482. int ipath_process_mad(struct ib_device *ibdev,
  483. int mad_flags,
  484. u8 port_num,
  485. struct ib_wc *in_wc,
  486. struct ib_grh *in_grh,
  487. struct ib_mad *in_mad, struct ib_mad *out_mad);
  488. static inline struct ipath_ucontext *to_iucontext(struct ib_ucontext
  489. *ibucontext)
  490. {
  491. return container_of(ibucontext, struct ipath_ucontext, ibucontext);
  492. }
  493. /*
  494. * Compare the lower 24 bits of the two values.
  495. * Returns an integer <, ==, or > than zero.
  496. */
  497. static inline int ipath_cmp24(u32 a, u32 b)
  498. {
  499. return (((int) a) - ((int) b)) << 8;
  500. }
  501. struct ipath_mcast *ipath_mcast_find(union ib_gid *mgid);
  502. int ipath_multicast_attach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid);
  503. int ipath_multicast_detach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid);
  504. int ipath_mcast_tree_empty(void);
  505. __be32 ipath_compute_aeth(struct ipath_qp *qp);
  506. struct ipath_qp *ipath_lookup_qpn(struct ipath_qp_table *qpt, u32 qpn);
  507. struct ib_qp *ipath_create_qp(struct ib_pd *ibpd,
  508. struct ib_qp_init_attr *init_attr,
  509. struct ib_udata *udata);
  510. int ipath_destroy_qp(struct ib_qp *ibqp);
  511. int ipath_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,
  512. int attr_mask);
  513. int ipath_query_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,
  514. int attr_mask, struct ib_qp_init_attr *init_attr);
  515. void ipath_free_all_qps(struct ipath_qp_table *qpt);
  516. int ipath_init_qp_table(struct ipath_ibdev *idev, int size);
  517. void ipath_sqerror_qp(struct ipath_qp *qp, struct ib_wc *wc);
  518. void ipath_get_credit(struct ipath_qp *qp, u32 aeth);
  519. void ipath_do_rc_send(unsigned long data);
  520. void ipath_do_uc_send(unsigned long data);
  521. void ipath_cq_enter(struct ipath_cq *cq, struct ib_wc *entry, int sig);
  522. int ipath_rkey_ok(struct ipath_ibdev *dev, struct ipath_sge_state *ss,
  523. u32 len, u64 vaddr, u32 rkey, int acc);
  524. int ipath_lkey_ok(struct ipath_lkey_table *rkt, struct ipath_sge *isge,
  525. struct ib_sge *sge, int acc);
  526. void ipath_copy_sge(struct ipath_sge_state *ss, void *data, u32 length);
  527. void ipath_skip_sge(struct ipath_sge_state *ss, u32 length);
  528. int ipath_post_rc_send(struct ipath_qp *qp, struct ib_send_wr *wr);
  529. void ipath_uc_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr,
  530. int has_grh, void *data, u32 tlen, struct ipath_qp *qp);
  531. void ipath_rc_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr,
  532. int has_grh, void *data, u32 tlen, struct ipath_qp *qp);
  533. void ipath_restart_rc(struct ipath_qp *qp, u32 psn, struct ib_wc *wc);
  534. int ipath_post_ud_send(struct ipath_qp *qp, struct ib_send_wr *wr);
  535. void ipath_ud_rcv(struct ipath_ibdev *dev, struct ipath_ib_header *hdr,
  536. int has_grh, void *data, u32 tlen, struct ipath_qp *qp);
  537. int ipath_alloc_lkey(struct ipath_lkey_table *rkt,
  538. struct ipath_mregion *mr);
  539. void ipath_free_lkey(struct ipath_lkey_table *rkt, u32 lkey);
  540. int ipath_lkey_ok(struct ipath_lkey_table *rkt, struct ipath_sge *isge,
  541. struct ib_sge *sge, int acc);
  542. int ipath_rkey_ok(struct ipath_ibdev *dev, struct ipath_sge_state *ss,
  543. u32 len, u64 vaddr, u32 rkey, int acc);
  544. int ipath_post_srq_receive(struct ib_srq *ibsrq, struct ib_recv_wr *wr,
  545. struct ib_recv_wr **bad_wr);
  546. struct ib_srq *ipath_create_srq(struct ib_pd *ibpd,
  547. struct ib_srq_init_attr *srq_init_attr,
  548. struct ib_udata *udata);
  549. int ipath_modify_srq(struct ib_srq *ibsrq, struct ib_srq_attr *attr,
  550. enum ib_srq_attr_mask attr_mask);
  551. int ipath_query_srq(struct ib_srq *ibsrq, struct ib_srq_attr *attr);
  552. int ipath_destroy_srq(struct ib_srq *ibsrq);
  553. void ipath_cq_enter(struct ipath_cq *cq, struct ib_wc *entry, int sig);
  554. int ipath_poll_cq(struct ib_cq *ibcq, int num_entries, struct ib_wc *entry);
  555. struct ib_cq *ipath_create_cq(struct ib_device *ibdev, int entries,
  556. struct ib_ucontext *context,
  557. struct ib_udata *udata);
  558. int ipath_destroy_cq(struct ib_cq *ibcq);
  559. int ipath_req_notify_cq(struct ib_cq *ibcq, enum ib_cq_notify notify);
  560. int ipath_resize_cq(struct ib_cq *ibcq, int cqe, struct ib_udata *udata);
  561. struct ib_mr *ipath_get_dma_mr(struct ib_pd *pd, int acc);
  562. struct ib_mr *ipath_reg_phys_mr(struct ib_pd *pd,
  563. struct ib_phys_buf *buffer_list,
  564. int num_phys_buf, int acc, u64 *iova_start);
  565. struct ib_mr *ipath_reg_user_mr(struct ib_pd *pd, struct ib_umem *region,
  566. int mr_access_flags,
  567. struct ib_udata *udata);
  568. int ipath_dereg_mr(struct ib_mr *ibmr);
  569. struct ib_fmr *ipath_alloc_fmr(struct ib_pd *pd, int mr_access_flags,
  570. struct ib_fmr_attr *fmr_attr);
  571. int ipath_map_phys_fmr(struct ib_fmr *ibfmr, u64 * page_list,
  572. int list_len, u64 iova);
  573. int ipath_unmap_fmr(struct list_head *fmr_list);
  574. int ipath_dealloc_fmr(struct ib_fmr *ibfmr);
  575. void ipath_no_bufs_available(struct ipath_qp *qp, struct ipath_ibdev *dev);
  576. void ipath_insert_rnr_queue(struct ipath_qp *qp);
  577. int ipath_get_rwqe(struct ipath_qp *qp, int wr_id_only);
  578. void ipath_ruc_loopback(struct ipath_qp *sqp, struct ib_wc *wc);
  579. extern const enum ib_wc_opcode ib_ipath_wc_opcode[];
  580. extern const u8 ipath_cvt_physportstate[];
  581. extern const int ib_ipath_state_ops[];
  582. extern unsigned int ib_ipath_lkey_table_size;
  583. extern const u32 ib_ipath_rnr_table[];
  584. #endif /* IPATH_VERBS_H */