qib_verbs.h 34 KB

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