qib_verbs.h 33 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100
  1. /*
  2. * Copyright (c) 2006, 2007, 2008, 2009, 2010 QLogic Corporation.
  3. * All rights reserved.
  4. * Copyright (c) 2005, 2006 PathScale, Inc. All rights reserved.
  5. *
  6. * This software is available to you under a choice of one of two
  7. * licenses. You may choose to be licensed under the terms of the GNU
  8. * General Public License (GPL) Version 2, available from the file
  9. * COPYING in the main directory of this source tree, or the
  10. * OpenIB.org BSD license below:
  11. *
  12. * Redistribution and use in source and binary forms, with or
  13. * without modification, are permitted provided that the following
  14. * conditions are met:
  15. *
  16. * - Redistributions of source code must retain the above
  17. * copyright notice, this list of conditions and the following
  18. * disclaimer.
  19. *
  20. * - Redistributions in binary form must reproduce the above
  21. * copyright notice, this list of conditions and the following
  22. * disclaimer in the documentation and/or other materials
  23. * provided with the distribution.
  24. *
  25. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  26. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  27. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  28. * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  29. * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  30. * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  31. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  32. * SOFTWARE.
  33. */
  34. #ifndef QIB_VERBS_H
  35. #define QIB_VERBS_H
  36. #include <linux/types.h>
  37. #include <linux/spinlock.h>
  38. #include <linux/kernel.h>
  39. #include <linux/interrupt.h>
  40. #include <linux/kref.h>
  41. #include <linux/workqueue.h>
  42. #include <rdma/ib_pack.h>
  43. #include <rdma/ib_user_verbs.h>
  44. struct qib_ctxtdata;
  45. struct qib_pportdata;
  46. struct qib_devdata;
  47. struct qib_verbs_txreq;
  48. #define QIB_MAX_RDMA_ATOMIC 16
  49. #define QIB_GUIDS_PER_PORT 5
  50. #define QPN_MAX (1 << 24)
  51. #define QPNMAP_ENTRIES (QPN_MAX / PAGE_SIZE / BITS_PER_BYTE)
  52. /*
  53. * Increment this value if any changes that break userspace ABI
  54. * compatibility are made.
  55. */
  56. #define QIB_UVERBS_ABI_VERSION 2
  57. /*
  58. * Define an ib_cq_notify value that is not valid so we know when CQ
  59. * notifications are armed.
  60. */
  61. #define IB_CQ_NONE (IB_CQ_NEXT_COMP + 1)
  62. #define IB_SEQ_NAK (3 << 29)
  63. /* AETH NAK opcode values */
  64. #define IB_RNR_NAK 0x20
  65. #define IB_NAK_PSN_ERROR 0x60
  66. #define IB_NAK_INVALID_REQUEST 0x61
  67. #define IB_NAK_REMOTE_ACCESS_ERROR 0x62
  68. #define IB_NAK_REMOTE_OPERATIONAL_ERROR 0x63
  69. #define IB_NAK_INVALID_RD_REQUEST 0x64
  70. /* Flags for checking QP state (see ib_qib_state_ops[]) */
  71. #define QIB_POST_SEND_OK 0x01
  72. #define QIB_POST_RECV_OK 0x02
  73. #define QIB_PROCESS_RECV_OK 0x04
  74. #define QIB_PROCESS_SEND_OK 0x08
  75. #define QIB_PROCESS_NEXT_SEND_OK 0x10
  76. #define QIB_FLUSH_SEND 0x20
  77. #define QIB_FLUSH_RECV 0x40
  78. #define QIB_PROCESS_OR_FLUSH_SEND \
  79. (QIB_PROCESS_SEND_OK | QIB_FLUSH_SEND)
  80. /* IB Performance Manager status values */
  81. #define IB_PMA_SAMPLE_STATUS_DONE 0x00
  82. #define IB_PMA_SAMPLE_STATUS_STARTED 0x01
  83. #define IB_PMA_SAMPLE_STATUS_RUNNING 0x02
  84. /* Mandatory IB performance counter select values. */
  85. #define IB_PMA_PORT_XMIT_DATA cpu_to_be16(0x0001)
  86. #define IB_PMA_PORT_RCV_DATA cpu_to_be16(0x0002)
  87. #define IB_PMA_PORT_XMIT_PKTS cpu_to_be16(0x0003)
  88. #define IB_PMA_PORT_RCV_PKTS cpu_to_be16(0x0004)
  89. #define IB_PMA_PORT_XMIT_WAIT cpu_to_be16(0x0005)
  90. #define QIB_VENDOR_IPG cpu_to_be16(0xFFA0)
  91. #define IB_BTH_REQ_ACK (1 << 31)
  92. #define IB_BTH_SOLICITED (1 << 23)
  93. #define IB_BTH_MIG_REQ (1 << 22)
  94. /* XXX Should be defined in ib_verbs.h enum ib_port_cap_flags */
  95. #define IB_PORT_OTHER_LOCAL_CHANGES_SUP (1 << 26)
  96. #define IB_GRH_VERSION 6
  97. #define IB_GRH_VERSION_MASK 0xF
  98. #define IB_GRH_VERSION_SHIFT 28
  99. #define IB_GRH_TCLASS_MASK 0xFF
  100. #define IB_GRH_TCLASS_SHIFT 20
  101. #define IB_GRH_FLOW_MASK 0xFFFFF
  102. #define IB_GRH_FLOW_SHIFT 0
  103. #define IB_GRH_NEXT_HDR 0x1B
  104. #define IB_DEFAULT_GID_PREFIX cpu_to_be64(0xfe80000000000000ULL)
  105. /* Values for set/get portinfo VLCap OperationalVLs */
  106. #define IB_VL_VL0 1
  107. #define IB_VL_VL0_1 2
  108. #define IB_VL_VL0_3 3
  109. #define IB_VL_VL0_7 4
  110. #define IB_VL_VL0_14 5
  111. static inline int qib_num_vls(int vls)
  112. {
  113. switch (vls) {
  114. default:
  115. case IB_VL_VL0:
  116. return 1;
  117. case IB_VL_VL0_1:
  118. return 2;
  119. case IB_VL_VL0_3:
  120. return 4;
  121. case IB_VL_VL0_7:
  122. return 8;
  123. case IB_VL_VL0_14:
  124. return 15;
  125. }
  126. }
  127. struct ib_reth {
  128. __be64 vaddr;
  129. __be32 rkey;
  130. __be32 length;
  131. } __attribute__ ((packed));
  132. struct ib_atomic_eth {
  133. __be32 vaddr[2]; /* unaligned so access as 2 32-bit words */
  134. __be32 rkey;
  135. __be64 swap_data;
  136. __be64 compare_data;
  137. } __attribute__ ((packed));
  138. struct qib_other_headers {
  139. __be32 bth[3];
  140. union {
  141. struct {
  142. __be32 deth[2];
  143. __be32 imm_data;
  144. } ud;
  145. struct {
  146. struct ib_reth reth;
  147. __be32 imm_data;
  148. } rc;
  149. struct {
  150. __be32 aeth;
  151. __be32 atomic_ack_eth[2];
  152. } at;
  153. __be32 imm_data;
  154. __be32 aeth;
  155. struct ib_atomic_eth atomic_eth;
  156. } u;
  157. } __attribute__ ((packed));
  158. /*
  159. * Note that UD packets with a GRH header are 8+40+12+8 = 68 bytes
  160. * long (72 w/ imm_data). Only the first 56 bytes of the IB header
  161. * will be in the eager header buffer. The remaining 12 or 16 bytes
  162. * are in the data buffer.
  163. */
  164. struct qib_ib_header {
  165. __be16 lrh[4];
  166. union {
  167. struct {
  168. struct ib_grh grh;
  169. struct qib_other_headers oth;
  170. } l;
  171. struct qib_other_headers oth;
  172. } u;
  173. } __attribute__ ((packed));
  174. struct qib_pio_header {
  175. __le32 pbc[2];
  176. struct qib_ib_header hdr;
  177. } __attribute__ ((packed));
  178. /*
  179. * There is one struct qib_mcast for each multicast GID.
  180. * All attached QPs are then stored as a list of
  181. * struct qib_mcast_qp.
  182. */
  183. struct qib_mcast_qp {
  184. struct list_head list;
  185. struct qib_qp *qp;
  186. };
  187. struct qib_mcast {
  188. struct rb_node rb_node;
  189. union ib_gid mgid;
  190. struct list_head qp_list;
  191. wait_queue_head_t wait;
  192. atomic_t refcount;
  193. int n_attached;
  194. };
  195. /* Protection domain */
  196. struct qib_pd {
  197. struct ib_pd ibpd;
  198. int user; /* non-zero if created from user space */
  199. };
  200. /* Address Handle */
  201. struct qib_ah {
  202. struct ib_ah ibah;
  203. struct ib_ah_attr attr;
  204. atomic_t refcount;
  205. };
  206. /*
  207. * This structure is used by qib_mmap() to validate an offset
  208. * when an mmap() request is made. The vm_area_struct then uses
  209. * this as its vm_private_data.
  210. */
  211. struct qib_mmap_info {
  212. struct list_head pending_mmaps;
  213. struct ib_ucontext *context;
  214. void *obj;
  215. __u64 offset;
  216. struct kref ref;
  217. unsigned size;
  218. };
  219. /*
  220. * This structure is used to contain the head pointer, tail pointer,
  221. * and completion queue entries as a single memory allocation so
  222. * it can be mmap'ed into user space.
  223. */
  224. struct qib_cq_wc {
  225. u32 head; /* index of next entry to fill */
  226. u32 tail; /* index of next ib_poll_cq() entry */
  227. union {
  228. /* these are actually size ibcq.cqe + 1 */
  229. struct ib_uverbs_wc uqueue[0];
  230. struct ib_wc kqueue[0];
  231. };
  232. };
  233. /*
  234. * The completion queue structure.
  235. */
  236. struct qib_cq {
  237. struct ib_cq ibcq;
  238. struct work_struct comptask;
  239. spinlock_t lock; /* protect changes in this struct */
  240. u8 notify;
  241. u8 triggered;
  242. struct qib_cq_wc *queue;
  243. struct qib_mmap_info *ip;
  244. };
  245. /*
  246. * A segment is a linear region of low physical memory.
  247. * XXX Maybe we should use phys addr here and kmap()/kunmap().
  248. * Used by the verbs layer.
  249. */
  250. struct qib_seg {
  251. void *vaddr;
  252. size_t length;
  253. };
  254. /* The number of qib_segs that fit in a page. */
  255. #define QIB_SEGSZ (PAGE_SIZE / sizeof(struct qib_seg))
  256. struct qib_segarray {
  257. struct qib_seg segs[QIB_SEGSZ];
  258. };
  259. struct qib_mregion {
  260. struct ib_pd *pd; /* shares refcnt of ibmr.pd */
  261. u64 user_base; /* User's address for this region */
  262. u64 iova; /* IB start address of this region */
  263. size_t length;
  264. u32 lkey;
  265. u32 offset; /* offset (bytes) to start of region */
  266. int access_flags;
  267. u32 max_segs; /* number of qib_segs in all the arrays */
  268. u32 mapsz; /* size of the map array */
  269. u8 page_shift; /* 0 - non unform/non powerof2 sizes */
  270. atomic_t refcount;
  271. struct qib_segarray *map[0]; /* the segments */
  272. };
  273. /*
  274. * These keep track of the copy progress within a memory region.
  275. * Used by the verbs layer.
  276. */
  277. struct qib_sge {
  278. struct qib_mregion *mr;
  279. void *vaddr; /* kernel virtual address of segment */
  280. u32 sge_length; /* length of the SGE */
  281. u32 length; /* remaining length of the segment */
  282. u16 m; /* current index: mr->map[m] */
  283. u16 n; /* current index: mr->map[m]->segs[n] */
  284. };
  285. /* Memory region */
  286. struct qib_mr {
  287. struct ib_mr ibmr;
  288. struct ib_umem *umem;
  289. struct qib_mregion mr; /* must be last */
  290. };
  291. /*
  292. * Send work request queue entry.
  293. * The size of the sg_list is determined when the QP is created and stored
  294. * in qp->s_max_sge.
  295. */
  296. struct qib_swqe {
  297. struct ib_send_wr wr; /* don't use wr.sg_list */
  298. u32 psn; /* first packet sequence number */
  299. u32 lpsn; /* last packet sequence number */
  300. u32 ssn; /* send sequence number */
  301. u32 length; /* total length of data in sg_list */
  302. struct qib_sge sg_list[0];
  303. };
  304. /*
  305. * Receive work request queue entry.
  306. * The size of the sg_list is determined when the QP (or SRQ) is created
  307. * and stored in qp->r_rq.max_sge (or srq->rq.max_sge).
  308. */
  309. struct qib_rwqe {
  310. u64 wr_id;
  311. u8 num_sge;
  312. struct ib_sge sg_list[0];
  313. };
  314. /*
  315. * This structure is used to contain the head pointer, tail pointer,
  316. * and receive work queue entries as a single memory allocation so
  317. * it can be mmap'ed into user space.
  318. * Note that the wq array elements are variable size so you can't
  319. * just index into the array to get the N'th element;
  320. * use get_rwqe_ptr() instead.
  321. */
  322. struct qib_rwq {
  323. u32 head; /* new work requests posted to the head */
  324. u32 tail; /* receives pull requests from here. */
  325. struct qib_rwqe wq[0];
  326. };
  327. struct qib_rq {
  328. struct qib_rwq *wq;
  329. spinlock_t lock; /* protect changes in this struct */
  330. u32 size; /* size of RWQE array */
  331. u8 max_sge;
  332. };
  333. struct qib_srq {
  334. struct ib_srq ibsrq;
  335. struct qib_rq rq;
  336. struct qib_mmap_info *ip;
  337. /* send signal when number of RWQEs < limit */
  338. u32 limit;
  339. };
  340. struct qib_sge_state {
  341. struct qib_sge *sg_list; /* next SGE to be used if any */
  342. struct qib_sge sge; /* progress state for the current SGE */
  343. u32 total_len;
  344. u8 num_sge;
  345. };
  346. /*
  347. * This structure holds the information that the send tasklet needs
  348. * to send a RDMA read response or atomic operation.
  349. */
  350. struct qib_ack_entry {
  351. u8 opcode;
  352. u8 sent;
  353. u32 psn;
  354. u32 lpsn;
  355. union {
  356. struct qib_sge rdma_sge;
  357. u64 atomic_data;
  358. };
  359. };
  360. /*
  361. * Variables prefixed with s_ are for the requester (sender).
  362. * Variables prefixed with r_ are for the responder (receiver).
  363. * Variables prefixed with ack_ are for responder replies.
  364. *
  365. * Common variables are protected by both r_rq.lock and s_lock in that order
  366. * which only happens in modify_qp() or changing the QP 'state'.
  367. */
  368. struct qib_qp {
  369. struct ib_qp ibqp;
  370. struct qib_qp *next; /* link list for QPN hash table */
  371. struct qib_qp *timer_next; /* link list for qib_ib_timer() */
  372. struct list_head iowait; /* link for wait PIO buf */
  373. struct list_head rspwait; /* link for waititing to respond */
  374. struct ib_ah_attr remote_ah_attr;
  375. struct ib_ah_attr alt_ah_attr;
  376. struct qib_ib_header s_hdr; /* next packet header to send */
  377. atomic_t refcount;
  378. wait_queue_head_t wait;
  379. wait_queue_head_t wait_dma;
  380. struct timer_list s_timer;
  381. struct work_struct s_work;
  382. struct qib_mmap_info *ip;
  383. struct qib_sge_state *s_cur_sge;
  384. struct qib_verbs_txreq *s_tx;
  385. struct qib_mregion *s_rdma_mr;
  386. struct qib_sge_state s_sge; /* current send request data */
  387. struct qib_ack_entry s_ack_queue[QIB_MAX_RDMA_ATOMIC + 1];
  388. struct qib_sge_state s_ack_rdma_sge;
  389. struct qib_sge_state s_rdma_read_sge;
  390. struct qib_sge_state r_sge; /* current receive data */
  391. spinlock_t r_lock; /* used for APM */
  392. spinlock_t s_lock;
  393. atomic_t s_dma_busy;
  394. u32 s_flags;
  395. u32 s_cur_size; /* size of send packet in bytes */
  396. u32 s_len; /* total length of s_sge */
  397. u32 s_rdma_read_len; /* total length of s_rdma_read_sge */
  398. u32 s_next_psn; /* PSN for next request */
  399. u32 s_last_psn; /* last response PSN processed */
  400. u32 s_sending_psn; /* lowest PSN that is being sent */
  401. u32 s_sending_hpsn; /* highest PSN that is being sent */
  402. u32 s_psn; /* current packet sequence number */
  403. u32 s_ack_rdma_psn; /* PSN for sending RDMA read responses */
  404. u32 s_ack_psn; /* PSN for acking sends and RDMA writes */
  405. u32 s_rnr_timeout; /* number of milliseconds for RNR timeout */
  406. u32 r_ack_psn; /* PSN for next ACK or atomic ACK */
  407. u64 r_wr_id; /* ID for current receive WQE */
  408. unsigned long r_aflags;
  409. u32 r_len; /* total length of r_sge */
  410. u32 r_rcv_len; /* receive data len processed */
  411. u32 r_psn; /* expected rcv packet sequence number */
  412. u32 r_msn; /* message sequence number */
  413. u16 s_hdrwords; /* size of s_hdr in 32 bit words */
  414. u16 s_rdma_ack_cnt;
  415. u8 state; /* QP state */
  416. u8 s_state; /* opcode of last packet sent */
  417. u8 s_ack_state; /* opcode of packet to ACK */
  418. u8 s_nak_state; /* non-zero if NAK is pending */
  419. u8 r_state; /* opcode of last packet received */
  420. u8 r_nak_state; /* non-zero if NAK is pending */
  421. u8 r_min_rnr_timer; /* retry timeout value for RNR NAKs */
  422. u8 r_flags;
  423. u8 r_max_rd_atomic; /* max number of RDMA read/atomic to receive */
  424. u8 r_head_ack_queue; /* index into s_ack_queue[] */
  425. u8 qp_access_flags;
  426. u8 s_max_sge; /* size of s_wq->sg_list */
  427. u8 s_retry_cnt; /* number of times to retry */
  428. u8 s_rnr_retry_cnt;
  429. u8 s_retry; /* requester retry counter */
  430. u8 s_rnr_retry; /* requester RNR retry counter */
  431. u8 s_pkey_index; /* PKEY index to use */
  432. u8 s_alt_pkey_index; /* Alternate path PKEY index to use */
  433. u8 s_max_rd_atomic; /* max number of RDMA read/atomic to send */
  434. u8 s_num_rd_atomic; /* number of RDMA read/atomic pending */
  435. u8 s_tail_ack_queue; /* index into s_ack_queue[] */
  436. u8 s_srate;
  437. u8 s_draining;
  438. u8 s_mig_state;
  439. u8 timeout; /* Timeout for this QP */
  440. u8 alt_timeout; /* Alternate path timeout for this QP */
  441. u8 port_num;
  442. enum ib_mtu path_mtu;
  443. u32 pmtu; /* decoded from path_mtu */
  444. u32 remote_qpn;
  445. u32 qkey; /* QKEY for this QP (for UD or RD) */
  446. u32 s_size; /* send work queue size */
  447. u32 s_head; /* new entries added here */
  448. u32 s_tail; /* next entry to process */
  449. u32 s_cur; /* current work queue entry */
  450. u32 s_acked; /* last un-ACK'ed entry */
  451. u32 s_last; /* last completed entry */
  452. u32 s_ssn; /* SSN of tail entry */
  453. u32 s_lsn; /* limit sequence number (credit) */
  454. unsigned long timeout_jiffies; /* computed from timeout */
  455. struct qib_swqe *s_wq; /* send work queue */
  456. struct qib_swqe *s_wqe;
  457. struct qib_rq r_rq; /* receive work queue */
  458. struct qib_sge r_sg_list[0]; /* verified SGEs */
  459. };
  460. /*
  461. * Atomic bit definitions for r_aflags.
  462. */
  463. #define QIB_R_WRID_VALID 0
  464. #define QIB_R_REWIND_SGE 1
  465. /*
  466. * Bit definitions for r_flags.
  467. */
  468. #define QIB_R_REUSE_SGE 0x01
  469. #define QIB_R_RDMAR_SEQ 0x02
  470. #define QIB_R_RSP_NAK 0x04
  471. #define QIB_R_RSP_SEND 0x08
  472. #define QIB_R_COMM_EST 0x10
  473. /*
  474. * Bit definitions for s_flags.
  475. *
  476. * QIB_S_SIGNAL_REQ_WR - set if QP send WRs contain completion signaled
  477. * QIB_S_BUSY - send tasklet is processing the QP
  478. * QIB_S_TIMER - the RC retry timer is active
  479. * QIB_S_ACK_PENDING - an ACK is waiting to be sent after RDMA read/atomics
  480. * QIB_S_WAIT_FENCE - waiting for all prior RDMA read or atomic SWQEs
  481. * before processing the next SWQE
  482. * QIB_S_WAIT_RDMAR - waiting for a RDMA read or atomic SWQE to complete
  483. * before processing the next SWQE
  484. * QIB_S_WAIT_RNR - waiting for RNR timeout
  485. * QIB_S_WAIT_SSN_CREDIT - waiting for RC credits to process next SWQE
  486. * QIB_S_WAIT_DMA - waiting for send DMA queue to drain before generating
  487. * next send completion entry not via send DMA
  488. * QIB_S_WAIT_PIO - waiting for a send buffer to be available
  489. * QIB_S_WAIT_TX - waiting for a struct qib_verbs_txreq to be available
  490. * QIB_S_WAIT_DMA_DESC - waiting for DMA descriptors to be available
  491. * QIB_S_WAIT_KMEM - waiting for kernel memory to be available
  492. * QIB_S_WAIT_PSN - waiting for a packet to exit the send DMA queue
  493. * QIB_S_WAIT_ACK - waiting for an ACK packet before sending more requests
  494. * QIB_S_SEND_ONE - send one packet, request ACK, then wait for ACK
  495. */
  496. #define QIB_S_SIGNAL_REQ_WR 0x0001
  497. #define QIB_S_BUSY 0x0002
  498. #define QIB_S_TIMER 0x0004
  499. #define QIB_S_RESP_PENDING 0x0008
  500. #define QIB_S_ACK_PENDING 0x0010
  501. #define QIB_S_WAIT_FENCE 0x0020
  502. #define QIB_S_WAIT_RDMAR 0x0040
  503. #define QIB_S_WAIT_RNR 0x0080
  504. #define QIB_S_WAIT_SSN_CREDIT 0x0100
  505. #define QIB_S_WAIT_DMA 0x0200
  506. #define QIB_S_WAIT_PIO 0x0400
  507. #define QIB_S_WAIT_TX 0x0800
  508. #define QIB_S_WAIT_DMA_DESC 0x1000
  509. #define QIB_S_WAIT_KMEM 0x2000
  510. #define QIB_S_WAIT_PSN 0x4000
  511. #define QIB_S_WAIT_ACK 0x8000
  512. #define QIB_S_SEND_ONE 0x10000
  513. #define QIB_S_UNLIMITED_CREDIT 0x20000
  514. /*
  515. * Wait flags that would prevent any packet type from being sent.
  516. */
  517. #define QIB_S_ANY_WAIT_IO (QIB_S_WAIT_PIO | QIB_S_WAIT_TX | \
  518. QIB_S_WAIT_DMA_DESC | QIB_S_WAIT_KMEM)
  519. /*
  520. * Wait flags that would prevent send work requests from making progress.
  521. */
  522. #define QIB_S_ANY_WAIT_SEND (QIB_S_WAIT_FENCE | QIB_S_WAIT_RDMAR | \
  523. QIB_S_WAIT_RNR | QIB_S_WAIT_SSN_CREDIT | QIB_S_WAIT_DMA | \
  524. QIB_S_WAIT_PSN | QIB_S_WAIT_ACK)
  525. #define QIB_S_ANY_WAIT (QIB_S_ANY_WAIT_IO | QIB_S_ANY_WAIT_SEND)
  526. #define QIB_PSN_CREDIT 16
  527. /*
  528. * Since struct qib_swqe is not a fixed size, we can't simply index into
  529. * struct qib_qp.s_wq. This function does the array index computation.
  530. */
  531. static inline struct qib_swqe *get_swqe_ptr(struct qib_qp *qp,
  532. unsigned n)
  533. {
  534. return (struct qib_swqe *)((char *)qp->s_wq +
  535. (sizeof(struct qib_swqe) +
  536. qp->s_max_sge *
  537. sizeof(struct qib_sge)) * n);
  538. }
  539. /*
  540. * Since struct qib_rwqe is not a fixed size, we can't simply index into
  541. * struct qib_rwq.wq. This function does the array index computation.
  542. */
  543. static inline struct qib_rwqe *get_rwqe_ptr(struct qib_rq *rq, unsigned n)
  544. {
  545. return (struct qib_rwqe *)
  546. ((char *) rq->wq->wq +
  547. (sizeof(struct qib_rwqe) +
  548. rq->max_sge * sizeof(struct ib_sge)) * n);
  549. }
  550. /*
  551. * QPN-map pages start out as NULL, they get allocated upon
  552. * first use and are never deallocated. This way,
  553. * large bitmaps are not allocated unless large numbers of QPs are used.
  554. */
  555. struct qpn_map {
  556. void *page;
  557. };
  558. struct qib_qpn_table {
  559. spinlock_t lock; /* protect changes in this struct */
  560. unsigned flags; /* flags for QP0/1 allocated for each port */
  561. u32 last; /* last QP number allocated */
  562. u32 nmaps; /* size of the map table */
  563. u16 limit;
  564. u16 mask;
  565. /* bit map of free QP numbers other than 0/1 */
  566. struct qpn_map map[QPNMAP_ENTRIES];
  567. };
  568. #define MAX_LKEY_TABLE_BITS 23
  569. struct qib_lkey_table {
  570. spinlock_t lock; /* protect changes in this struct */
  571. u32 next; /* next unused index (speeds search) */
  572. u32 gen; /* generation count */
  573. u32 max; /* size of the table */
  574. struct qib_mregion **table;
  575. };
  576. struct qib_opcode_stats {
  577. u64 n_packets; /* number of packets */
  578. u64 n_bytes; /* total number of bytes */
  579. };
  580. struct qib_ibport {
  581. struct qib_qp *qp0;
  582. struct qib_qp *qp1;
  583. struct ib_mad_agent *send_agent; /* agent for SMI (traps) */
  584. struct qib_ah *sm_ah;
  585. struct qib_ah *smi_ah;
  586. struct rb_root mcast_tree;
  587. spinlock_t lock; /* protect changes in this struct */
  588. /* non-zero when timer is set */
  589. unsigned long mkey_lease_timeout;
  590. unsigned long trap_timeout;
  591. __be64 gid_prefix; /* in network order */
  592. __be64 mkey;
  593. __be64 guids[QIB_GUIDS_PER_PORT - 1]; /* writable GUIDs */
  594. u64 tid; /* TID for traps */
  595. u64 n_unicast_xmit; /* total unicast packets sent */
  596. u64 n_unicast_rcv; /* total unicast packets received */
  597. u64 n_multicast_xmit; /* total multicast packets sent */
  598. u64 n_multicast_rcv; /* total multicast packets received */
  599. u64 z_symbol_error_counter; /* starting count for PMA */
  600. u64 z_link_error_recovery_counter; /* starting count for PMA */
  601. u64 z_link_downed_counter; /* starting count for PMA */
  602. u64 z_port_rcv_errors; /* starting count for PMA */
  603. u64 z_port_rcv_remphys_errors; /* starting count for PMA */
  604. u64 z_port_xmit_discards; /* starting count for PMA */
  605. u64 z_port_xmit_data; /* starting count for PMA */
  606. u64 z_port_rcv_data; /* starting count for PMA */
  607. u64 z_port_xmit_packets; /* starting count for PMA */
  608. u64 z_port_rcv_packets; /* starting count for PMA */
  609. u32 z_local_link_integrity_errors; /* starting count for PMA */
  610. u32 z_excessive_buffer_overrun_errors; /* starting count for PMA */
  611. u32 z_vl15_dropped; /* starting count for PMA */
  612. u32 n_rc_resends;
  613. u32 n_rc_acks;
  614. u32 n_rc_qacks;
  615. u32 n_rc_delayed_comp;
  616. u32 n_seq_naks;
  617. u32 n_rdma_seq;
  618. u32 n_rnr_naks;
  619. u32 n_other_naks;
  620. u32 n_loop_pkts;
  621. u32 n_pkt_drops;
  622. u32 n_vl15_dropped;
  623. u32 n_rc_timeouts;
  624. u32 n_dmawait;
  625. u32 n_unaligned;
  626. u32 n_rc_dupreq;
  627. u32 n_rc_seqnak;
  628. u32 port_cap_flags;
  629. u32 pma_sample_start;
  630. u32 pma_sample_interval;
  631. __be16 pma_counter_select[5];
  632. u16 pma_tag;
  633. u16 pkey_violations;
  634. u16 qkey_violations;
  635. u16 mkey_violations;
  636. u16 mkey_lease_period;
  637. u16 sm_lid;
  638. u16 repress_traps;
  639. u8 sm_sl;
  640. u8 mkeyprot;
  641. u8 subnet_timeout;
  642. u8 vl_high_limit;
  643. u8 sl_to_vl[16];
  644. struct qib_opcode_stats opstats[128];
  645. };
  646. struct qib_ibdev {
  647. struct ib_device ibdev;
  648. struct list_head pending_mmaps;
  649. spinlock_t mmap_offset_lock; /* protect mmap_offset */
  650. u32 mmap_offset;
  651. struct qib_mregion *dma_mr;
  652. /* QP numbers are shared by all IB ports */
  653. struct qib_qpn_table qpn_table;
  654. struct qib_lkey_table lk_table;
  655. struct list_head piowait; /* list for wait PIO buf */
  656. struct list_head dmawait; /* list for wait DMA */
  657. struct list_head txwait; /* list for wait qib_verbs_txreq */
  658. struct list_head memwait; /* list for wait kernel memory */
  659. struct list_head txreq_free;
  660. struct timer_list mem_timer;
  661. struct qib_qp **qp_table;
  662. struct qib_pio_header *pio_hdrs;
  663. dma_addr_t pio_hdrs_phys;
  664. /* list of QPs waiting for RNR timer */
  665. spinlock_t pending_lock; /* protect wait lists, PMA counters, etc. */
  666. u32 qp_table_size; /* size of the hash table */
  667. u32 qp_rnd; /* random bytes for hash */
  668. spinlock_t qpt_lock;
  669. u32 n_piowait;
  670. u32 n_txwait;
  671. u32 n_pds_allocated; /* number of PDs allocated for device */
  672. spinlock_t n_pds_lock;
  673. u32 n_ahs_allocated; /* number of AHs allocated for device */
  674. spinlock_t n_ahs_lock;
  675. u32 n_cqs_allocated; /* number of CQs allocated for device */
  676. spinlock_t n_cqs_lock;
  677. u32 n_qps_allocated; /* number of QPs allocated for device */
  678. spinlock_t n_qps_lock;
  679. u32 n_srqs_allocated; /* number of SRQs allocated for device */
  680. spinlock_t n_srqs_lock;
  681. u32 n_mcast_grps_allocated; /* number of mcast groups allocated */
  682. spinlock_t n_mcast_grps_lock;
  683. };
  684. struct qib_verbs_counters {
  685. u64 symbol_error_counter;
  686. u64 link_error_recovery_counter;
  687. u64 link_downed_counter;
  688. u64 port_rcv_errors;
  689. u64 port_rcv_remphys_errors;
  690. u64 port_xmit_discards;
  691. u64 port_xmit_data;
  692. u64 port_rcv_data;
  693. u64 port_xmit_packets;
  694. u64 port_rcv_packets;
  695. u32 local_link_integrity_errors;
  696. u32 excessive_buffer_overrun_errors;
  697. u32 vl15_dropped;
  698. };
  699. static inline struct qib_mr *to_imr(struct ib_mr *ibmr)
  700. {
  701. return container_of(ibmr, struct qib_mr, ibmr);
  702. }
  703. static inline struct qib_pd *to_ipd(struct ib_pd *ibpd)
  704. {
  705. return container_of(ibpd, struct qib_pd, ibpd);
  706. }
  707. static inline struct qib_ah *to_iah(struct ib_ah *ibah)
  708. {
  709. return container_of(ibah, struct qib_ah, ibah);
  710. }
  711. static inline struct qib_cq *to_icq(struct ib_cq *ibcq)
  712. {
  713. return container_of(ibcq, struct qib_cq, ibcq);
  714. }
  715. static inline struct qib_srq *to_isrq(struct ib_srq *ibsrq)
  716. {
  717. return container_of(ibsrq, struct qib_srq, ibsrq);
  718. }
  719. static inline struct qib_qp *to_iqp(struct ib_qp *ibqp)
  720. {
  721. return container_of(ibqp, struct qib_qp, ibqp);
  722. }
  723. static inline struct qib_ibdev *to_idev(struct ib_device *ibdev)
  724. {
  725. return container_of(ibdev, struct qib_ibdev, ibdev);
  726. }
  727. /*
  728. * Send if not busy or waiting for I/O and either
  729. * a RC response is pending or we can process send work requests.
  730. */
  731. static inline int qib_send_ok(struct qib_qp *qp)
  732. {
  733. return !(qp->s_flags & (QIB_S_BUSY | QIB_S_ANY_WAIT_IO)) &&
  734. (qp->s_hdrwords || (qp->s_flags & QIB_S_RESP_PENDING) ||
  735. !(qp->s_flags & QIB_S_ANY_WAIT_SEND));
  736. }
  737. extern struct workqueue_struct *qib_cq_wq;
  738. /*
  739. * This must be called with s_lock held.
  740. */
  741. static inline void qib_schedule_send(struct qib_qp *qp)
  742. {
  743. if (qib_send_ok(qp))
  744. queue_work(ib_wq, &qp->s_work);
  745. }
  746. static inline int qib_pkey_ok(u16 pkey1, u16 pkey2)
  747. {
  748. u16 p1 = pkey1 & 0x7FFF;
  749. u16 p2 = pkey2 & 0x7FFF;
  750. /*
  751. * Low 15 bits must be non-zero and match, and
  752. * one of the two must be a full member.
  753. */
  754. return p1 && p1 == p2 && ((__s16)pkey1 < 0 || (__s16)pkey2 < 0);
  755. }
  756. void qib_bad_pqkey(struct qib_ibport *ibp, __be16 trap_num, u32 key, u32 sl,
  757. u32 qp1, u32 qp2, __be16 lid1, __be16 lid2);
  758. void qib_cap_mask_chg(struct qib_ibport *ibp);
  759. void qib_sys_guid_chg(struct qib_ibport *ibp);
  760. void qib_node_desc_chg(struct qib_ibport *ibp);
  761. int qib_process_mad(struct ib_device *ibdev, int mad_flags, u8 port_num,
  762. struct ib_wc *in_wc, struct ib_grh *in_grh,
  763. struct ib_mad *in_mad, struct ib_mad *out_mad);
  764. int qib_create_agents(struct qib_ibdev *dev);
  765. void qib_free_agents(struct qib_ibdev *dev);
  766. /*
  767. * Compare the lower 24 bits of the two values.
  768. * Returns an integer <, ==, or > than zero.
  769. */
  770. static inline int qib_cmp24(u32 a, u32 b)
  771. {
  772. return (((int) a) - ((int) b)) << 8;
  773. }
  774. struct qib_mcast *qib_mcast_find(struct qib_ibport *ibp, union ib_gid *mgid);
  775. int qib_snapshot_counters(struct qib_pportdata *ppd, u64 *swords,
  776. u64 *rwords, u64 *spkts, u64 *rpkts,
  777. u64 *xmit_wait);
  778. int qib_get_counters(struct qib_pportdata *ppd,
  779. struct qib_verbs_counters *cntrs);
  780. int qib_multicast_attach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid);
  781. int qib_multicast_detach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid);
  782. int qib_mcast_tree_empty(struct qib_ibport *ibp);
  783. __be32 qib_compute_aeth(struct qib_qp *qp);
  784. struct qib_qp *qib_lookup_qpn(struct qib_ibport *ibp, u32 qpn);
  785. struct ib_qp *qib_create_qp(struct ib_pd *ibpd,
  786. struct ib_qp_init_attr *init_attr,
  787. struct ib_udata *udata);
  788. int qib_destroy_qp(struct ib_qp *ibqp);
  789. int qib_error_qp(struct qib_qp *qp, enum ib_wc_status err);
  790. int qib_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,
  791. int attr_mask, struct ib_udata *udata);
  792. int qib_query_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,
  793. int attr_mask, struct ib_qp_init_attr *init_attr);
  794. unsigned qib_free_all_qps(struct qib_devdata *dd);
  795. void qib_init_qpn_table(struct qib_devdata *dd, struct qib_qpn_table *qpt);
  796. void qib_free_qpn_table(struct qib_qpn_table *qpt);
  797. void qib_get_credit(struct qib_qp *qp, u32 aeth);
  798. unsigned qib_pkt_delay(u32 plen, u8 snd_mult, u8 rcv_mult);
  799. void qib_verbs_sdma_desc_avail(struct qib_pportdata *ppd, unsigned avail);
  800. void qib_put_txreq(struct qib_verbs_txreq *tx);
  801. int qib_verbs_send(struct qib_qp *qp, struct qib_ib_header *hdr,
  802. u32 hdrwords, struct qib_sge_state *ss, u32 len);
  803. void qib_copy_sge(struct qib_sge_state *ss, void *data, u32 length,
  804. int release);
  805. void qib_skip_sge(struct qib_sge_state *ss, u32 length, int release);
  806. void qib_uc_rcv(struct qib_ibport *ibp, struct qib_ib_header *hdr,
  807. int has_grh, void *data, u32 tlen, struct qib_qp *qp);
  808. void qib_rc_rcv(struct qib_ctxtdata *rcd, struct qib_ib_header *hdr,
  809. int has_grh, void *data, u32 tlen, struct qib_qp *qp);
  810. int qib_check_ah(struct ib_device *ibdev, struct ib_ah_attr *ah_attr);
  811. void qib_rc_rnr_retry(unsigned long arg);
  812. void qib_rc_send_complete(struct qib_qp *qp, struct qib_ib_header *hdr);
  813. void qib_rc_error(struct qib_qp *qp, enum ib_wc_status err);
  814. int qib_post_ud_send(struct qib_qp *qp, struct ib_send_wr *wr);
  815. void qib_ud_rcv(struct qib_ibport *ibp, struct qib_ib_header *hdr,
  816. int has_grh, void *data, u32 tlen, struct qib_qp *qp);
  817. int qib_alloc_lkey(struct qib_lkey_table *rkt, struct qib_mregion *mr);
  818. int qib_free_lkey(struct qib_ibdev *dev, struct qib_mregion *mr);
  819. int qib_lkey_ok(struct qib_lkey_table *rkt, struct qib_pd *pd,
  820. struct qib_sge *isge, struct ib_sge *sge, int acc);
  821. int qib_rkey_ok(struct qib_qp *qp, struct qib_sge *sge,
  822. u32 len, u64 vaddr, u32 rkey, int acc);
  823. int qib_post_srq_receive(struct ib_srq *ibsrq, struct ib_recv_wr *wr,
  824. struct ib_recv_wr **bad_wr);
  825. struct ib_srq *qib_create_srq(struct ib_pd *ibpd,
  826. struct ib_srq_init_attr *srq_init_attr,
  827. struct ib_udata *udata);
  828. int qib_modify_srq(struct ib_srq *ibsrq, struct ib_srq_attr *attr,
  829. enum ib_srq_attr_mask attr_mask,
  830. struct ib_udata *udata);
  831. int qib_query_srq(struct ib_srq *ibsrq, struct ib_srq_attr *attr);
  832. int qib_destroy_srq(struct ib_srq *ibsrq);
  833. void qib_cq_enter(struct qib_cq *cq, struct ib_wc *entry, int sig);
  834. int qib_poll_cq(struct ib_cq *ibcq, int num_entries, struct ib_wc *entry);
  835. struct ib_cq *qib_create_cq(struct ib_device *ibdev, int entries,
  836. int comp_vector, struct ib_ucontext *context,
  837. struct ib_udata *udata);
  838. int qib_destroy_cq(struct ib_cq *ibcq);
  839. int qib_req_notify_cq(struct ib_cq *ibcq, enum ib_cq_notify_flags notify_flags);
  840. int qib_resize_cq(struct ib_cq *ibcq, int cqe, struct ib_udata *udata);
  841. struct ib_mr *qib_get_dma_mr(struct ib_pd *pd, int acc);
  842. struct ib_mr *qib_reg_phys_mr(struct ib_pd *pd,
  843. struct ib_phys_buf *buffer_list,
  844. int num_phys_buf, int acc, u64 *iova_start);
  845. struct ib_mr *qib_reg_user_mr(struct ib_pd *pd, u64 start, u64 length,
  846. u64 virt_addr, int mr_access_flags,
  847. struct ib_udata *udata);
  848. int qib_dereg_mr(struct ib_mr *ibmr);
  849. struct ib_mr *qib_alloc_fast_reg_mr(struct ib_pd *pd, int max_page_list_len);
  850. struct ib_fast_reg_page_list *qib_alloc_fast_reg_page_list(
  851. struct ib_device *ibdev, int page_list_len);
  852. void qib_free_fast_reg_page_list(struct ib_fast_reg_page_list *pl);
  853. int qib_fast_reg_mr(struct qib_qp *qp, struct ib_send_wr *wr);
  854. struct ib_fmr *qib_alloc_fmr(struct ib_pd *pd, int mr_access_flags,
  855. struct ib_fmr_attr *fmr_attr);
  856. int qib_map_phys_fmr(struct ib_fmr *ibfmr, u64 *page_list,
  857. int list_len, u64 iova);
  858. int qib_unmap_fmr(struct list_head *fmr_list);
  859. int qib_dealloc_fmr(struct ib_fmr *ibfmr);
  860. void qib_release_mmap_info(struct kref *ref);
  861. struct qib_mmap_info *qib_create_mmap_info(struct qib_ibdev *dev, u32 size,
  862. struct ib_ucontext *context,
  863. void *obj);
  864. void qib_update_mmap_info(struct qib_ibdev *dev, struct qib_mmap_info *ip,
  865. u32 size, void *obj);
  866. int qib_mmap(struct ib_ucontext *context, struct vm_area_struct *vma);
  867. int qib_get_rwqe(struct qib_qp *qp, int wr_id_only);
  868. void qib_migrate_qp(struct qib_qp *qp);
  869. int qib_ruc_check_hdr(struct qib_ibport *ibp, struct qib_ib_header *hdr,
  870. int has_grh, struct qib_qp *qp, u32 bth0);
  871. u32 qib_make_grh(struct qib_ibport *ibp, struct ib_grh *hdr,
  872. struct ib_global_route *grh, u32 hwords, u32 nwords);
  873. void qib_make_ruc_header(struct qib_qp *qp, struct qib_other_headers *ohdr,
  874. u32 bth0, u32 bth2);
  875. void qib_do_send(struct work_struct *work);
  876. void qib_send_complete(struct qib_qp *qp, struct qib_swqe *wqe,
  877. enum ib_wc_status status);
  878. void qib_send_rc_ack(struct qib_qp *qp);
  879. int qib_make_rc_req(struct qib_qp *qp);
  880. int qib_make_uc_req(struct qib_qp *qp);
  881. int qib_make_ud_req(struct qib_qp *qp);
  882. int qib_register_ib_device(struct qib_devdata *);
  883. void qib_unregister_ib_device(struct qib_devdata *);
  884. void qib_ib_rcv(struct qib_ctxtdata *, void *, void *, u32);
  885. void qib_ib_piobufavail(struct qib_devdata *);
  886. unsigned qib_get_npkeys(struct qib_devdata *);
  887. unsigned qib_get_pkey(struct qib_ibport *, unsigned);
  888. extern const enum ib_wc_opcode ib_qib_wc_opcode[];
  889. /*
  890. * Below HCA-independent IB PhysPortState values, returned
  891. * by the f_ibphys_portstate() routine.
  892. */
  893. #define IB_PHYSPORTSTATE_SLEEP 1
  894. #define IB_PHYSPORTSTATE_POLL 2
  895. #define IB_PHYSPORTSTATE_DISABLED 3
  896. #define IB_PHYSPORTSTATE_CFG_TRAIN 4
  897. #define IB_PHYSPORTSTATE_LINKUP 5
  898. #define IB_PHYSPORTSTATE_LINK_ERR_RECOVER 6
  899. #define IB_PHYSPORTSTATE_CFG_DEBOUNCE 8
  900. #define IB_PHYSPORTSTATE_CFG_IDLE 0xB
  901. #define IB_PHYSPORTSTATE_RECOVERY_RETRAIN 0xC
  902. #define IB_PHYSPORTSTATE_RECOVERY_WAITRMT 0xE
  903. #define IB_PHYSPORTSTATE_RECOVERY_IDLE 0xF
  904. #define IB_PHYSPORTSTATE_CFG_ENH 0x10
  905. #define IB_PHYSPORTSTATE_CFG_WAIT_ENH 0x13
  906. extern const int ib_qib_state_ops[];
  907. extern __be64 ib_qib_sys_image_guid; /* in network order */
  908. extern unsigned int ib_qib_lkey_table_size;
  909. extern unsigned int ib_qib_max_cqes;
  910. extern unsigned int ib_qib_max_cqs;
  911. extern unsigned int ib_qib_max_qp_wrs;
  912. extern unsigned int ib_qib_max_qps;
  913. extern unsigned int ib_qib_max_sges;
  914. extern unsigned int ib_qib_max_mcast_grps;
  915. extern unsigned int ib_qib_max_mcast_qp_attached;
  916. extern unsigned int ib_qib_max_srqs;
  917. extern unsigned int ib_qib_max_srq_sges;
  918. extern unsigned int ib_qib_max_srq_wrs;
  919. extern const u32 ib_qib_rnr_table[];
  920. extern struct ib_dma_mapping_ops qib_dma_mapping_ops;
  921. #endif /* QIB_VERBS_H */