iw_cxgb4.h 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134
  1. /*
  2. * Copyright (c) 2009-2010 Chelsio, 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. * - Redistributions in binary form must reproduce the above
  18. * copyright notice, this list of conditions and the following
  19. * disclaimer in the documentation and/or other materials
  20. * provided with the distribution.
  21. *
  22. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  23. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  24. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  25. * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  26. * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  27. * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  28. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  29. * SOFTWARE.
  30. */
  31. #ifndef __IW_CXGB4_H__
  32. #define __IW_CXGB4_H__
  33. #include <linux/mutex.h>
  34. #include <linux/list.h>
  35. #include <linux/spinlock.h>
  36. #include <linux/idr.h>
  37. #include <linux/completion.h>
  38. #include <linux/netdevice.h>
  39. #include <linux/sched/mm.h>
  40. #include <linux/pci.h>
  41. #include <linux/dma-mapping.h>
  42. #include <linux/inet.h>
  43. #include <linux/wait.h>
  44. #include <linux/kref.h>
  45. #include <linux/timer.h>
  46. #include <linux/io.h>
  47. #include <linux/workqueue.h>
  48. #include <asm/byteorder.h>
  49. #include <net/net_namespace.h>
  50. #include <rdma/ib_verbs.h>
  51. #include <rdma/iw_cm.h>
  52. #include <rdma/rdma_netlink.h>
  53. #include <rdma/iw_portmap.h>
  54. #include <rdma/restrack.h>
  55. #include "cxgb4.h"
  56. #include "cxgb4_uld.h"
  57. #include "l2t.h"
  58. #include <rdma/cxgb4-abi.h>
  59. #define DRV_NAME "iw_cxgb4"
  60. #define MOD DRV_NAME ":"
  61. #ifdef pr_fmt
  62. #undef pr_fmt
  63. #endif
  64. #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
  65. #include "t4.h"
  66. #define PBL_OFF(rdev_p, a) ((a) - (rdev_p)->lldi.vr->pbl.start)
  67. #define RQT_OFF(rdev_p, a) ((a) - (rdev_p)->lldi.vr->rq.start)
  68. static inline void *cplhdr(struct sk_buff *skb)
  69. {
  70. return skb->data;
  71. }
  72. #define C4IW_ID_TABLE_F_RANDOM 1 /* Pseudo-randomize the id's returned */
  73. #define C4IW_ID_TABLE_F_EMPTY 2 /* Table is initially empty */
  74. struct c4iw_id_table {
  75. u32 flags;
  76. u32 start; /* logical minimal id */
  77. u32 last; /* hint for find */
  78. u32 max;
  79. spinlock_t lock;
  80. unsigned long *table;
  81. };
  82. struct c4iw_resource {
  83. struct c4iw_id_table tpt_table;
  84. struct c4iw_id_table qid_table;
  85. struct c4iw_id_table pdid_table;
  86. struct c4iw_id_table srq_table;
  87. };
  88. struct c4iw_qid_list {
  89. struct list_head entry;
  90. u32 qid;
  91. };
  92. struct c4iw_dev_ucontext {
  93. struct list_head qpids;
  94. struct list_head cqids;
  95. struct mutex lock;
  96. struct kref kref;
  97. };
  98. enum c4iw_rdev_flags {
  99. T4_FATAL_ERROR = (1<<0),
  100. T4_STATUS_PAGE_DISABLED = (1<<1),
  101. };
  102. struct c4iw_stat {
  103. u64 total;
  104. u64 cur;
  105. u64 max;
  106. u64 fail;
  107. };
  108. struct c4iw_stats {
  109. struct mutex lock;
  110. struct c4iw_stat qid;
  111. struct c4iw_stat pd;
  112. struct c4iw_stat stag;
  113. struct c4iw_stat pbl;
  114. struct c4iw_stat rqt;
  115. struct c4iw_stat srqt;
  116. struct c4iw_stat srq;
  117. struct c4iw_stat ocqp;
  118. u64 db_full;
  119. u64 db_empty;
  120. u64 db_drop;
  121. u64 db_state_transitions;
  122. u64 db_fc_interruptions;
  123. u64 tcam_full;
  124. u64 act_ofld_conn_fails;
  125. u64 pas_ofld_conn_fails;
  126. u64 neg_adv;
  127. };
  128. struct c4iw_hw_queue {
  129. int t4_eq_status_entries;
  130. int t4_max_eq_size;
  131. int t4_max_iq_size;
  132. int t4_max_rq_size;
  133. int t4_max_sq_size;
  134. int t4_max_qp_depth;
  135. int t4_max_cq_depth;
  136. int t4_stat_len;
  137. };
  138. struct wr_log_entry {
  139. ktime_t post_host_time;
  140. ktime_t poll_host_time;
  141. u64 post_sge_ts;
  142. u64 cqe_sge_ts;
  143. u64 poll_sge_ts;
  144. u16 qid;
  145. u16 wr_id;
  146. u8 opcode;
  147. u8 valid;
  148. };
  149. struct c4iw_rdev {
  150. struct c4iw_resource resource;
  151. u32 qpmask;
  152. u32 cqmask;
  153. struct c4iw_dev_ucontext uctx;
  154. struct gen_pool *pbl_pool;
  155. struct gen_pool *rqt_pool;
  156. struct gen_pool *ocqp_pool;
  157. u32 flags;
  158. struct cxgb4_lld_info lldi;
  159. unsigned long bar2_pa;
  160. void __iomem *bar2_kva;
  161. unsigned long oc_mw_pa;
  162. void __iomem *oc_mw_kva;
  163. struct c4iw_stats stats;
  164. struct c4iw_hw_queue hw_queue;
  165. struct t4_dev_status_page *status_page;
  166. atomic_t wr_log_idx;
  167. struct wr_log_entry *wr_log;
  168. int wr_log_size;
  169. struct workqueue_struct *free_workq;
  170. struct completion rqt_compl;
  171. struct completion pbl_compl;
  172. struct kref rqt_kref;
  173. struct kref pbl_kref;
  174. };
  175. static inline int c4iw_fatal_error(struct c4iw_rdev *rdev)
  176. {
  177. return rdev->flags & T4_FATAL_ERROR;
  178. }
  179. static inline int c4iw_num_stags(struct c4iw_rdev *rdev)
  180. {
  181. return (int)(rdev->lldi.vr->stag.size >> 5);
  182. }
  183. #define C4IW_WR_TO (60*HZ)
  184. struct c4iw_wr_wait {
  185. struct completion completion;
  186. int ret;
  187. struct kref kref;
  188. };
  189. void _c4iw_free_wr_wait(struct kref *kref);
  190. static inline void c4iw_put_wr_wait(struct c4iw_wr_wait *wr_waitp)
  191. {
  192. pr_debug("wr_wait %p ref before put %u\n", wr_waitp,
  193. kref_read(&wr_waitp->kref));
  194. WARN_ON(kref_read(&wr_waitp->kref) == 0);
  195. kref_put(&wr_waitp->kref, _c4iw_free_wr_wait);
  196. }
  197. static inline void c4iw_get_wr_wait(struct c4iw_wr_wait *wr_waitp)
  198. {
  199. pr_debug("wr_wait %p ref before get %u\n", wr_waitp,
  200. kref_read(&wr_waitp->kref));
  201. WARN_ON(kref_read(&wr_waitp->kref) == 0);
  202. kref_get(&wr_waitp->kref);
  203. }
  204. static inline void c4iw_init_wr_wait(struct c4iw_wr_wait *wr_waitp)
  205. {
  206. wr_waitp->ret = 0;
  207. init_completion(&wr_waitp->completion);
  208. }
  209. static inline void _c4iw_wake_up(struct c4iw_wr_wait *wr_waitp, int ret,
  210. bool deref)
  211. {
  212. wr_waitp->ret = ret;
  213. complete(&wr_waitp->completion);
  214. if (deref)
  215. c4iw_put_wr_wait(wr_waitp);
  216. }
  217. static inline void c4iw_wake_up_noref(struct c4iw_wr_wait *wr_waitp, int ret)
  218. {
  219. _c4iw_wake_up(wr_waitp, ret, false);
  220. }
  221. static inline void c4iw_wake_up_deref(struct c4iw_wr_wait *wr_waitp, int ret)
  222. {
  223. _c4iw_wake_up(wr_waitp, ret, true);
  224. }
  225. static inline int c4iw_wait_for_reply(struct c4iw_rdev *rdev,
  226. struct c4iw_wr_wait *wr_waitp,
  227. u32 hwtid, u32 qpid,
  228. const char *func)
  229. {
  230. int ret;
  231. if (c4iw_fatal_error(rdev)) {
  232. wr_waitp->ret = -EIO;
  233. goto out;
  234. }
  235. ret = wait_for_completion_timeout(&wr_waitp->completion, C4IW_WR_TO);
  236. if (!ret) {
  237. pr_err("%s - Device %s not responding (disabling device) - tid %u qpid %u\n",
  238. func, pci_name(rdev->lldi.pdev), hwtid, qpid);
  239. rdev->flags |= T4_FATAL_ERROR;
  240. wr_waitp->ret = -EIO;
  241. goto out;
  242. }
  243. if (wr_waitp->ret)
  244. pr_debug("%s: FW reply %d tid %u qpid %u\n",
  245. pci_name(rdev->lldi.pdev), wr_waitp->ret, hwtid, qpid);
  246. out:
  247. return wr_waitp->ret;
  248. }
  249. int c4iw_ofld_send(struct c4iw_rdev *rdev, struct sk_buff *skb);
  250. static inline int c4iw_ref_send_wait(struct c4iw_rdev *rdev,
  251. struct sk_buff *skb,
  252. struct c4iw_wr_wait *wr_waitp,
  253. u32 hwtid, u32 qpid,
  254. const char *func)
  255. {
  256. int ret;
  257. pr_debug("%s wr_wait %p hwtid %u qpid %u\n", func, wr_waitp, hwtid,
  258. qpid);
  259. c4iw_get_wr_wait(wr_waitp);
  260. ret = c4iw_ofld_send(rdev, skb);
  261. if (ret) {
  262. c4iw_put_wr_wait(wr_waitp);
  263. return ret;
  264. }
  265. return c4iw_wait_for_reply(rdev, wr_waitp, hwtid, qpid, func);
  266. }
  267. enum db_state {
  268. NORMAL = 0,
  269. FLOW_CONTROL = 1,
  270. RECOVERY = 2,
  271. STOPPED = 3
  272. };
  273. struct c4iw_dev {
  274. struct ib_device ibdev;
  275. struct c4iw_rdev rdev;
  276. u32 device_cap_flags;
  277. struct idr cqidr;
  278. struct idr qpidr;
  279. struct idr mmidr;
  280. spinlock_t lock;
  281. struct mutex db_mutex;
  282. struct dentry *debugfs_root;
  283. enum db_state db_state;
  284. struct idr hwtid_idr;
  285. struct idr atid_idr;
  286. struct idr stid_idr;
  287. struct list_head db_fc_list;
  288. u32 avail_ird;
  289. wait_queue_head_t wait;
  290. };
  291. struct uld_ctx {
  292. struct list_head entry;
  293. struct cxgb4_lld_info lldi;
  294. struct c4iw_dev *dev;
  295. struct work_struct reg_work;
  296. };
  297. static inline struct c4iw_dev *to_c4iw_dev(struct ib_device *ibdev)
  298. {
  299. return container_of(ibdev, struct c4iw_dev, ibdev);
  300. }
  301. static inline struct c4iw_dev *rdev_to_c4iw_dev(struct c4iw_rdev *rdev)
  302. {
  303. return container_of(rdev, struct c4iw_dev, rdev);
  304. }
  305. static inline struct c4iw_cq *get_chp(struct c4iw_dev *rhp, u32 cqid)
  306. {
  307. return idr_find(&rhp->cqidr, cqid);
  308. }
  309. static inline struct c4iw_qp *get_qhp(struct c4iw_dev *rhp, u32 qpid)
  310. {
  311. return idr_find(&rhp->qpidr, qpid);
  312. }
  313. static inline struct c4iw_mr *get_mhp(struct c4iw_dev *rhp, u32 mmid)
  314. {
  315. return idr_find(&rhp->mmidr, mmid);
  316. }
  317. static inline int _insert_handle(struct c4iw_dev *rhp, struct idr *idr,
  318. void *handle, u32 id, int lock)
  319. {
  320. int ret;
  321. if (lock) {
  322. idr_preload(GFP_KERNEL);
  323. spin_lock_irq(&rhp->lock);
  324. }
  325. ret = idr_alloc(idr, handle, id, id + 1, GFP_ATOMIC);
  326. if (lock) {
  327. spin_unlock_irq(&rhp->lock);
  328. idr_preload_end();
  329. }
  330. return ret < 0 ? ret : 0;
  331. }
  332. static inline int insert_handle(struct c4iw_dev *rhp, struct idr *idr,
  333. void *handle, u32 id)
  334. {
  335. return _insert_handle(rhp, idr, handle, id, 1);
  336. }
  337. static inline int insert_handle_nolock(struct c4iw_dev *rhp, struct idr *idr,
  338. void *handle, u32 id)
  339. {
  340. return _insert_handle(rhp, idr, handle, id, 0);
  341. }
  342. static inline void _remove_handle(struct c4iw_dev *rhp, struct idr *idr,
  343. u32 id, int lock)
  344. {
  345. if (lock)
  346. spin_lock_irq(&rhp->lock);
  347. idr_remove(idr, id);
  348. if (lock)
  349. spin_unlock_irq(&rhp->lock);
  350. }
  351. static inline void remove_handle(struct c4iw_dev *rhp, struct idr *idr, u32 id)
  352. {
  353. _remove_handle(rhp, idr, id, 1);
  354. }
  355. static inline void remove_handle_nolock(struct c4iw_dev *rhp,
  356. struct idr *idr, u32 id)
  357. {
  358. _remove_handle(rhp, idr, id, 0);
  359. }
  360. extern uint c4iw_max_read_depth;
  361. static inline int cur_max_read_depth(struct c4iw_dev *dev)
  362. {
  363. return min(dev->rdev.lldi.max_ordird_qp, c4iw_max_read_depth);
  364. }
  365. struct c4iw_pd {
  366. struct ib_pd ibpd;
  367. u32 pdid;
  368. struct c4iw_dev *rhp;
  369. };
  370. static inline struct c4iw_pd *to_c4iw_pd(struct ib_pd *ibpd)
  371. {
  372. return container_of(ibpd, struct c4iw_pd, ibpd);
  373. }
  374. struct tpt_attributes {
  375. u64 len;
  376. u64 va_fbo;
  377. enum fw_ri_mem_perms perms;
  378. u32 stag;
  379. u32 pdid;
  380. u32 qpid;
  381. u32 pbl_addr;
  382. u32 pbl_size;
  383. u32 state:1;
  384. u32 type:2;
  385. u32 rsvd:1;
  386. u32 remote_invaliate_disable:1;
  387. u32 zbva:1;
  388. u32 mw_bind_enable:1;
  389. u32 page_size:5;
  390. };
  391. struct c4iw_mr {
  392. struct ib_mr ibmr;
  393. struct ib_umem *umem;
  394. struct c4iw_dev *rhp;
  395. struct sk_buff *dereg_skb;
  396. u64 kva;
  397. struct tpt_attributes attr;
  398. u64 *mpl;
  399. dma_addr_t mpl_addr;
  400. u32 max_mpl_len;
  401. u32 mpl_len;
  402. struct c4iw_wr_wait *wr_waitp;
  403. };
  404. static inline struct c4iw_mr *to_c4iw_mr(struct ib_mr *ibmr)
  405. {
  406. return container_of(ibmr, struct c4iw_mr, ibmr);
  407. }
  408. struct c4iw_mw {
  409. struct ib_mw ibmw;
  410. struct c4iw_dev *rhp;
  411. struct sk_buff *dereg_skb;
  412. u64 kva;
  413. struct tpt_attributes attr;
  414. struct c4iw_wr_wait *wr_waitp;
  415. };
  416. static inline struct c4iw_mw *to_c4iw_mw(struct ib_mw *ibmw)
  417. {
  418. return container_of(ibmw, struct c4iw_mw, ibmw);
  419. }
  420. struct c4iw_cq {
  421. struct ib_cq ibcq;
  422. struct c4iw_dev *rhp;
  423. struct sk_buff *destroy_skb;
  424. struct t4_cq cq;
  425. spinlock_t lock;
  426. spinlock_t comp_handler_lock;
  427. atomic_t refcnt;
  428. wait_queue_head_t wait;
  429. struct c4iw_wr_wait *wr_waitp;
  430. };
  431. static inline struct c4iw_cq *to_c4iw_cq(struct ib_cq *ibcq)
  432. {
  433. return container_of(ibcq, struct c4iw_cq, ibcq);
  434. }
  435. struct c4iw_mpa_attributes {
  436. u8 initiator;
  437. u8 recv_marker_enabled;
  438. u8 xmit_marker_enabled;
  439. u8 crc_enabled;
  440. u8 enhanced_rdma_conn;
  441. u8 version;
  442. u8 p2p_type;
  443. };
  444. struct c4iw_qp_attributes {
  445. u32 scq;
  446. u32 rcq;
  447. u32 sq_num_entries;
  448. u32 rq_num_entries;
  449. u32 sq_max_sges;
  450. u32 sq_max_sges_rdma_write;
  451. u32 rq_max_sges;
  452. u32 state;
  453. u8 enable_rdma_read;
  454. u8 enable_rdma_write;
  455. u8 enable_bind;
  456. u8 enable_mmid0_fastreg;
  457. u32 max_ord;
  458. u32 max_ird;
  459. u32 pd;
  460. u32 next_state;
  461. char terminate_buffer[52];
  462. u32 terminate_msg_len;
  463. u8 is_terminate_local;
  464. struct c4iw_mpa_attributes mpa_attr;
  465. struct c4iw_ep *llp_stream_handle;
  466. u8 layer_etype;
  467. u8 ecode;
  468. u16 sq_db_inc;
  469. u16 rq_db_inc;
  470. u8 send_term;
  471. };
  472. struct c4iw_qp {
  473. struct ib_qp ibqp;
  474. struct list_head db_fc_entry;
  475. struct c4iw_dev *rhp;
  476. struct c4iw_ep *ep;
  477. struct c4iw_qp_attributes attr;
  478. struct t4_wq wq;
  479. spinlock_t lock;
  480. struct mutex mutex;
  481. struct kref kref;
  482. wait_queue_head_t wait;
  483. int sq_sig_all;
  484. struct c4iw_srq *srq;
  485. struct work_struct free_work;
  486. struct c4iw_ucontext *ucontext;
  487. struct c4iw_wr_wait *wr_waitp;
  488. };
  489. static inline struct c4iw_qp *to_c4iw_qp(struct ib_qp *ibqp)
  490. {
  491. return container_of(ibqp, struct c4iw_qp, ibqp);
  492. }
  493. struct c4iw_srq {
  494. struct ib_srq ibsrq;
  495. struct list_head db_fc_entry;
  496. struct c4iw_dev *rhp;
  497. struct t4_srq wq;
  498. struct sk_buff *destroy_skb;
  499. u32 srq_limit;
  500. u32 pdid;
  501. int idx;
  502. u32 flags;
  503. spinlock_t lock; /* protects srq */
  504. struct c4iw_wr_wait *wr_waitp;
  505. bool armed;
  506. };
  507. static inline struct c4iw_srq *to_c4iw_srq(struct ib_srq *ibsrq)
  508. {
  509. return container_of(ibsrq, struct c4iw_srq, ibsrq);
  510. }
  511. struct c4iw_ucontext {
  512. struct ib_ucontext ibucontext;
  513. struct c4iw_dev_ucontext uctx;
  514. u32 key;
  515. spinlock_t mmap_lock;
  516. struct list_head mmaps;
  517. struct kref kref;
  518. bool is_32b_cqe;
  519. };
  520. static inline struct c4iw_ucontext *to_c4iw_ucontext(struct ib_ucontext *c)
  521. {
  522. return container_of(c, struct c4iw_ucontext, ibucontext);
  523. }
  524. void _c4iw_free_ucontext(struct kref *kref);
  525. static inline void c4iw_put_ucontext(struct c4iw_ucontext *ucontext)
  526. {
  527. kref_put(&ucontext->kref, _c4iw_free_ucontext);
  528. }
  529. static inline void c4iw_get_ucontext(struct c4iw_ucontext *ucontext)
  530. {
  531. kref_get(&ucontext->kref);
  532. }
  533. struct c4iw_mm_entry {
  534. struct list_head entry;
  535. u64 addr;
  536. u32 key;
  537. unsigned len;
  538. };
  539. static inline struct c4iw_mm_entry *remove_mmap(struct c4iw_ucontext *ucontext,
  540. u32 key, unsigned len)
  541. {
  542. struct list_head *pos, *nxt;
  543. struct c4iw_mm_entry *mm;
  544. spin_lock(&ucontext->mmap_lock);
  545. list_for_each_safe(pos, nxt, &ucontext->mmaps) {
  546. mm = list_entry(pos, struct c4iw_mm_entry, entry);
  547. if (mm->key == key && mm->len == len) {
  548. list_del_init(&mm->entry);
  549. spin_unlock(&ucontext->mmap_lock);
  550. pr_debug("key 0x%x addr 0x%llx len %d\n", key,
  551. (unsigned long long)mm->addr, mm->len);
  552. return mm;
  553. }
  554. }
  555. spin_unlock(&ucontext->mmap_lock);
  556. return NULL;
  557. }
  558. static inline void insert_mmap(struct c4iw_ucontext *ucontext,
  559. struct c4iw_mm_entry *mm)
  560. {
  561. spin_lock(&ucontext->mmap_lock);
  562. pr_debug("key 0x%x addr 0x%llx len %d\n",
  563. mm->key, (unsigned long long)mm->addr, mm->len);
  564. list_add_tail(&mm->entry, &ucontext->mmaps);
  565. spin_unlock(&ucontext->mmap_lock);
  566. }
  567. enum c4iw_qp_attr_mask {
  568. C4IW_QP_ATTR_NEXT_STATE = 1 << 0,
  569. C4IW_QP_ATTR_SQ_DB = 1<<1,
  570. C4IW_QP_ATTR_RQ_DB = 1<<2,
  571. C4IW_QP_ATTR_ENABLE_RDMA_READ = 1 << 7,
  572. C4IW_QP_ATTR_ENABLE_RDMA_WRITE = 1 << 8,
  573. C4IW_QP_ATTR_ENABLE_RDMA_BIND = 1 << 9,
  574. C4IW_QP_ATTR_MAX_ORD = 1 << 11,
  575. C4IW_QP_ATTR_MAX_IRD = 1 << 12,
  576. C4IW_QP_ATTR_LLP_STREAM_HANDLE = 1 << 22,
  577. C4IW_QP_ATTR_STREAM_MSG_BUFFER = 1 << 23,
  578. C4IW_QP_ATTR_MPA_ATTR = 1 << 24,
  579. C4IW_QP_ATTR_QP_CONTEXT_ACTIVATE = 1 << 25,
  580. C4IW_QP_ATTR_VALID_MODIFY = (C4IW_QP_ATTR_ENABLE_RDMA_READ |
  581. C4IW_QP_ATTR_ENABLE_RDMA_WRITE |
  582. C4IW_QP_ATTR_MAX_ORD |
  583. C4IW_QP_ATTR_MAX_IRD |
  584. C4IW_QP_ATTR_LLP_STREAM_HANDLE |
  585. C4IW_QP_ATTR_STREAM_MSG_BUFFER |
  586. C4IW_QP_ATTR_MPA_ATTR |
  587. C4IW_QP_ATTR_QP_CONTEXT_ACTIVATE)
  588. };
  589. int c4iw_modify_qp(struct c4iw_dev *rhp,
  590. struct c4iw_qp *qhp,
  591. enum c4iw_qp_attr_mask mask,
  592. struct c4iw_qp_attributes *attrs,
  593. int internal);
  594. enum c4iw_qp_state {
  595. C4IW_QP_STATE_IDLE,
  596. C4IW_QP_STATE_RTS,
  597. C4IW_QP_STATE_ERROR,
  598. C4IW_QP_STATE_TERMINATE,
  599. C4IW_QP_STATE_CLOSING,
  600. C4IW_QP_STATE_TOT
  601. };
  602. static inline int c4iw_convert_state(enum ib_qp_state ib_state)
  603. {
  604. switch (ib_state) {
  605. case IB_QPS_RESET:
  606. case IB_QPS_INIT:
  607. return C4IW_QP_STATE_IDLE;
  608. case IB_QPS_RTS:
  609. return C4IW_QP_STATE_RTS;
  610. case IB_QPS_SQD:
  611. return C4IW_QP_STATE_CLOSING;
  612. case IB_QPS_SQE:
  613. return C4IW_QP_STATE_TERMINATE;
  614. case IB_QPS_ERR:
  615. return C4IW_QP_STATE_ERROR;
  616. default:
  617. return -1;
  618. }
  619. }
  620. static inline int to_ib_qp_state(int c4iw_qp_state)
  621. {
  622. switch (c4iw_qp_state) {
  623. case C4IW_QP_STATE_IDLE:
  624. return IB_QPS_INIT;
  625. case C4IW_QP_STATE_RTS:
  626. return IB_QPS_RTS;
  627. case C4IW_QP_STATE_CLOSING:
  628. return IB_QPS_SQD;
  629. case C4IW_QP_STATE_TERMINATE:
  630. return IB_QPS_SQE;
  631. case C4IW_QP_STATE_ERROR:
  632. return IB_QPS_ERR;
  633. }
  634. return IB_QPS_ERR;
  635. }
  636. static inline u32 c4iw_ib_to_tpt_access(int a)
  637. {
  638. return (a & IB_ACCESS_REMOTE_WRITE ? FW_RI_MEM_ACCESS_REM_WRITE : 0) |
  639. (a & IB_ACCESS_REMOTE_READ ? FW_RI_MEM_ACCESS_REM_READ : 0) |
  640. (a & IB_ACCESS_LOCAL_WRITE ? FW_RI_MEM_ACCESS_LOCAL_WRITE : 0) |
  641. FW_RI_MEM_ACCESS_LOCAL_READ;
  642. }
  643. static inline u32 c4iw_ib_to_tpt_bind_access(int acc)
  644. {
  645. return (acc & IB_ACCESS_REMOTE_WRITE ? FW_RI_MEM_ACCESS_REM_WRITE : 0) |
  646. (acc & IB_ACCESS_REMOTE_READ ? FW_RI_MEM_ACCESS_REM_READ : 0);
  647. }
  648. enum c4iw_mmid_state {
  649. C4IW_STAG_STATE_VALID,
  650. C4IW_STAG_STATE_INVALID
  651. };
  652. #define C4IW_NODE_DESC "cxgb4 Chelsio Communications"
  653. #define MPA_KEY_REQ "MPA ID Req Frame"
  654. #define MPA_KEY_REP "MPA ID Rep Frame"
  655. #define MPA_MAX_PRIVATE_DATA 256
  656. #define MPA_ENHANCED_RDMA_CONN 0x10
  657. #define MPA_REJECT 0x20
  658. #define MPA_CRC 0x40
  659. #define MPA_MARKERS 0x80
  660. #define MPA_FLAGS_MASK 0xE0
  661. #define MPA_V2_PEER2PEER_MODEL 0x8000
  662. #define MPA_V2_ZERO_LEN_FPDU_RTR 0x4000
  663. #define MPA_V2_RDMA_WRITE_RTR 0x8000
  664. #define MPA_V2_RDMA_READ_RTR 0x4000
  665. #define MPA_V2_IRD_ORD_MASK 0x3FFF
  666. #define c4iw_put_ep(ep) { \
  667. pr_debug("put_ep ep %p refcnt %d\n", \
  668. ep, kref_read(&((ep)->kref))); \
  669. WARN_ON(kref_read(&((ep)->kref)) < 1); \
  670. kref_put(&((ep)->kref), _c4iw_free_ep); \
  671. }
  672. #define c4iw_get_ep(ep) { \
  673. pr_debug("get_ep ep %p, refcnt %d\n", \
  674. ep, kref_read(&((ep)->kref))); \
  675. kref_get(&((ep)->kref)); \
  676. }
  677. void _c4iw_free_ep(struct kref *kref);
  678. struct mpa_message {
  679. u8 key[16];
  680. u8 flags;
  681. u8 revision;
  682. __be16 private_data_size;
  683. u8 private_data[0];
  684. };
  685. struct mpa_v2_conn_params {
  686. __be16 ird;
  687. __be16 ord;
  688. };
  689. struct terminate_message {
  690. u8 layer_etype;
  691. u8 ecode;
  692. __be16 hdrct_rsvd;
  693. u8 len_hdrs[0];
  694. };
  695. #define TERM_MAX_LENGTH (sizeof(struct terminate_message) + 2 + 18 + 28)
  696. enum c4iw_layers_types {
  697. LAYER_RDMAP = 0x00,
  698. LAYER_DDP = 0x10,
  699. LAYER_MPA = 0x20,
  700. RDMAP_LOCAL_CATA = 0x00,
  701. RDMAP_REMOTE_PROT = 0x01,
  702. RDMAP_REMOTE_OP = 0x02,
  703. DDP_LOCAL_CATA = 0x00,
  704. DDP_TAGGED_ERR = 0x01,
  705. DDP_UNTAGGED_ERR = 0x02,
  706. DDP_LLP = 0x03
  707. };
  708. enum c4iw_rdma_ecodes {
  709. RDMAP_INV_STAG = 0x00,
  710. RDMAP_BASE_BOUNDS = 0x01,
  711. RDMAP_ACC_VIOL = 0x02,
  712. RDMAP_STAG_NOT_ASSOC = 0x03,
  713. RDMAP_TO_WRAP = 0x04,
  714. RDMAP_INV_VERS = 0x05,
  715. RDMAP_INV_OPCODE = 0x06,
  716. RDMAP_STREAM_CATA = 0x07,
  717. RDMAP_GLOBAL_CATA = 0x08,
  718. RDMAP_CANT_INV_STAG = 0x09,
  719. RDMAP_UNSPECIFIED = 0xff
  720. };
  721. enum c4iw_ddp_ecodes {
  722. DDPT_INV_STAG = 0x00,
  723. DDPT_BASE_BOUNDS = 0x01,
  724. DDPT_STAG_NOT_ASSOC = 0x02,
  725. DDPT_TO_WRAP = 0x03,
  726. DDPT_INV_VERS = 0x04,
  727. DDPU_INV_QN = 0x01,
  728. DDPU_INV_MSN_NOBUF = 0x02,
  729. DDPU_INV_MSN_RANGE = 0x03,
  730. DDPU_INV_MO = 0x04,
  731. DDPU_MSG_TOOBIG = 0x05,
  732. DDPU_INV_VERS = 0x06
  733. };
  734. enum c4iw_mpa_ecodes {
  735. MPA_CRC_ERR = 0x02,
  736. MPA_MARKER_ERR = 0x03,
  737. MPA_LOCAL_CATA = 0x05,
  738. MPA_INSUFF_IRD = 0x06,
  739. MPA_NOMATCH_RTR = 0x07,
  740. };
  741. enum c4iw_ep_state {
  742. IDLE = 0,
  743. LISTEN,
  744. CONNECTING,
  745. MPA_REQ_WAIT,
  746. MPA_REQ_SENT,
  747. MPA_REQ_RCVD,
  748. MPA_REP_SENT,
  749. FPDU_MODE,
  750. ABORTING,
  751. CLOSING,
  752. MORIBUND,
  753. DEAD,
  754. };
  755. enum c4iw_ep_flags {
  756. PEER_ABORT_IN_PROGRESS = 0,
  757. ABORT_REQ_IN_PROGRESS = 1,
  758. RELEASE_RESOURCES = 2,
  759. CLOSE_SENT = 3,
  760. TIMEOUT = 4,
  761. QP_REFERENCED = 5,
  762. STOP_MPA_TIMER = 7,
  763. };
  764. enum c4iw_ep_history {
  765. ACT_OPEN_REQ = 0,
  766. ACT_OFLD_CONN = 1,
  767. ACT_OPEN_RPL = 2,
  768. ACT_ESTAB = 3,
  769. PASS_ACCEPT_REQ = 4,
  770. PASS_ESTAB = 5,
  771. ABORT_UPCALL = 6,
  772. ESTAB_UPCALL = 7,
  773. CLOSE_UPCALL = 8,
  774. ULP_ACCEPT = 9,
  775. ULP_REJECT = 10,
  776. TIMEDOUT = 11,
  777. PEER_ABORT = 12,
  778. PEER_CLOSE = 13,
  779. CONNREQ_UPCALL = 14,
  780. ABORT_CONN = 15,
  781. DISCONN_UPCALL = 16,
  782. EP_DISC_CLOSE = 17,
  783. EP_DISC_ABORT = 18,
  784. CONN_RPL_UPCALL = 19,
  785. ACT_RETRY_NOMEM = 20,
  786. ACT_RETRY_INUSE = 21,
  787. CLOSE_CON_RPL = 22,
  788. EP_DISC_FAIL = 24,
  789. QP_REFED = 25,
  790. QP_DEREFED = 26,
  791. CM_ID_REFED = 27,
  792. CM_ID_DEREFED = 28,
  793. };
  794. enum conn_pre_alloc_buffers {
  795. CN_ABORT_REQ_BUF,
  796. CN_ABORT_RPL_BUF,
  797. CN_CLOSE_CON_REQ_BUF,
  798. CN_DESTROY_BUF,
  799. CN_FLOWC_BUF,
  800. CN_MAX_CON_BUF
  801. };
  802. enum {
  803. FLOWC_LEN = offsetof(struct fw_flowc_wr, mnemval[FW_FLOWC_MNEM_MAX])
  804. };
  805. union cpl_wr_size {
  806. struct cpl_abort_req abrt_req;
  807. struct cpl_abort_rpl abrt_rpl;
  808. struct fw_ri_wr ri_req;
  809. struct cpl_close_con_req close_req;
  810. char flowc_buf[FLOWC_LEN];
  811. };
  812. struct c4iw_ep_common {
  813. struct iw_cm_id *cm_id;
  814. struct c4iw_qp *qp;
  815. struct c4iw_dev *dev;
  816. struct sk_buff_head ep_skb_list;
  817. enum c4iw_ep_state state;
  818. struct kref kref;
  819. struct mutex mutex;
  820. struct sockaddr_storage local_addr;
  821. struct sockaddr_storage remote_addr;
  822. struct c4iw_wr_wait *wr_waitp;
  823. unsigned long flags;
  824. unsigned long history;
  825. };
  826. struct c4iw_listen_ep {
  827. struct c4iw_ep_common com;
  828. unsigned int stid;
  829. int backlog;
  830. };
  831. struct c4iw_ep_stats {
  832. unsigned connect_neg_adv;
  833. unsigned abort_neg_adv;
  834. };
  835. struct c4iw_ep {
  836. struct c4iw_ep_common com;
  837. struct c4iw_ep *parent_ep;
  838. struct timer_list timer;
  839. struct list_head entry;
  840. unsigned int atid;
  841. u32 hwtid;
  842. u32 snd_seq;
  843. u32 rcv_seq;
  844. struct l2t_entry *l2t;
  845. struct dst_entry *dst;
  846. struct sk_buff *mpa_skb;
  847. struct c4iw_mpa_attributes mpa_attr;
  848. u8 mpa_pkt[sizeof(struct mpa_message) + MPA_MAX_PRIVATE_DATA];
  849. unsigned int mpa_pkt_len;
  850. u32 ird;
  851. u32 ord;
  852. u32 smac_idx;
  853. u32 tx_chan;
  854. u32 mtu;
  855. u16 mss;
  856. u16 emss;
  857. u16 plen;
  858. u16 rss_qid;
  859. u16 txq_idx;
  860. u16 ctrlq_idx;
  861. u8 tos;
  862. u8 retry_with_mpa_v1;
  863. u8 tried_with_mpa_v1;
  864. unsigned int retry_count;
  865. int snd_win;
  866. int rcv_win;
  867. u32 snd_wscale;
  868. struct c4iw_ep_stats stats;
  869. };
  870. static inline struct c4iw_ep *to_ep(struct iw_cm_id *cm_id)
  871. {
  872. return cm_id->provider_data;
  873. }
  874. static inline struct c4iw_listen_ep *to_listen_ep(struct iw_cm_id *cm_id)
  875. {
  876. return cm_id->provider_data;
  877. }
  878. static inline int ocqp_supported(const struct cxgb4_lld_info *infop)
  879. {
  880. #if defined(__i386__) || defined(__x86_64__) || defined(CONFIG_PPC64)
  881. return infop->vr->ocq.size > 0;
  882. #else
  883. return 0;
  884. #endif
  885. }
  886. u32 c4iw_id_alloc(struct c4iw_id_table *alloc);
  887. void c4iw_id_free(struct c4iw_id_table *alloc, u32 obj);
  888. int c4iw_id_table_alloc(struct c4iw_id_table *alloc, u32 start, u32 num,
  889. u32 reserved, u32 flags);
  890. void c4iw_id_table_free(struct c4iw_id_table *alloc);
  891. typedef int (*c4iw_handler_func)(struct c4iw_dev *dev, struct sk_buff *skb);
  892. int c4iw_ep_redirect(void *ctx, struct dst_entry *old, struct dst_entry *new,
  893. struct l2t_entry *l2t);
  894. void c4iw_put_qpid(struct c4iw_rdev *rdev, u32 qpid,
  895. struct c4iw_dev_ucontext *uctx);
  896. u32 c4iw_get_resource(struct c4iw_id_table *id_table);
  897. void c4iw_put_resource(struct c4iw_id_table *id_table, u32 entry);
  898. int c4iw_init_resource(struct c4iw_rdev *rdev, u32 nr_tpt,
  899. u32 nr_pdid, u32 nr_srqt);
  900. int c4iw_init_ctrl_qp(struct c4iw_rdev *rdev);
  901. int c4iw_pblpool_create(struct c4iw_rdev *rdev);
  902. int c4iw_rqtpool_create(struct c4iw_rdev *rdev);
  903. int c4iw_ocqp_pool_create(struct c4iw_rdev *rdev);
  904. void c4iw_pblpool_destroy(struct c4iw_rdev *rdev);
  905. void c4iw_rqtpool_destroy(struct c4iw_rdev *rdev);
  906. void c4iw_ocqp_pool_destroy(struct c4iw_rdev *rdev);
  907. void c4iw_destroy_resource(struct c4iw_resource *rscp);
  908. int c4iw_destroy_ctrl_qp(struct c4iw_rdev *rdev);
  909. void c4iw_register_device(struct work_struct *work);
  910. void c4iw_unregister_device(struct c4iw_dev *dev);
  911. int __init c4iw_cm_init(void);
  912. void c4iw_cm_term(void);
  913. void c4iw_release_dev_ucontext(struct c4iw_rdev *rdev,
  914. struct c4iw_dev_ucontext *uctx);
  915. void c4iw_init_dev_ucontext(struct c4iw_rdev *rdev,
  916. struct c4iw_dev_ucontext *uctx);
  917. int c4iw_poll_cq(struct ib_cq *ibcq, int num_entries, struct ib_wc *wc);
  918. int c4iw_post_send(struct ib_qp *ibqp, const struct ib_send_wr *wr,
  919. const struct ib_send_wr **bad_wr);
  920. int c4iw_post_receive(struct ib_qp *ibqp, const struct ib_recv_wr *wr,
  921. const struct ib_recv_wr **bad_wr);
  922. int c4iw_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param);
  923. int c4iw_create_listen(struct iw_cm_id *cm_id, int backlog);
  924. int c4iw_destroy_listen(struct iw_cm_id *cm_id);
  925. int c4iw_accept_cr(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param);
  926. int c4iw_reject_cr(struct iw_cm_id *cm_id, const void *pdata, u8 pdata_len);
  927. void c4iw_qp_add_ref(struct ib_qp *qp);
  928. void c4iw_qp_rem_ref(struct ib_qp *qp);
  929. struct ib_mr *c4iw_alloc_mr(struct ib_pd *pd,
  930. enum ib_mr_type mr_type,
  931. u32 max_num_sg);
  932. int c4iw_map_mr_sg(struct ib_mr *ibmr, struct scatterlist *sg, int sg_nents,
  933. unsigned int *sg_offset);
  934. int c4iw_dealloc_mw(struct ib_mw *mw);
  935. void c4iw_dealloc(struct uld_ctx *ctx);
  936. struct ib_mw *c4iw_alloc_mw(struct ib_pd *pd, enum ib_mw_type type,
  937. struct ib_udata *udata);
  938. struct ib_mr *c4iw_reg_user_mr(struct ib_pd *pd, u64 start,
  939. u64 length, u64 virt, int acc,
  940. struct ib_udata *udata);
  941. struct ib_mr *c4iw_get_dma_mr(struct ib_pd *pd, int acc);
  942. int c4iw_dereg_mr(struct ib_mr *ib_mr);
  943. int c4iw_destroy_cq(struct ib_cq *ib_cq);
  944. struct ib_cq *c4iw_create_cq(struct ib_device *ibdev,
  945. const struct ib_cq_init_attr *attr,
  946. struct ib_ucontext *ib_context,
  947. struct ib_udata *udata);
  948. int c4iw_arm_cq(struct ib_cq *ibcq, enum ib_cq_notify_flags flags);
  949. int c4iw_modify_srq(struct ib_srq *ib_srq, struct ib_srq_attr *attr,
  950. enum ib_srq_attr_mask srq_attr_mask,
  951. struct ib_udata *udata);
  952. int c4iw_destroy_srq(struct ib_srq *ib_srq);
  953. struct ib_srq *c4iw_create_srq(struct ib_pd *pd,
  954. struct ib_srq_init_attr *attrs,
  955. struct ib_udata *udata);
  956. int c4iw_destroy_qp(struct ib_qp *ib_qp);
  957. struct ib_qp *c4iw_create_qp(struct ib_pd *pd,
  958. struct ib_qp_init_attr *attrs,
  959. struct ib_udata *udata);
  960. int c4iw_ib_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,
  961. int attr_mask, struct ib_udata *udata);
  962. int c4iw_ib_query_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr,
  963. int attr_mask, struct ib_qp_init_attr *init_attr);
  964. struct ib_qp *c4iw_get_qp(struct ib_device *dev, int qpn);
  965. u32 c4iw_rqtpool_alloc(struct c4iw_rdev *rdev, int size);
  966. void c4iw_rqtpool_free(struct c4iw_rdev *rdev, u32 addr, int size);
  967. u32 c4iw_pblpool_alloc(struct c4iw_rdev *rdev, int size);
  968. void c4iw_pblpool_free(struct c4iw_rdev *rdev, u32 addr, int size);
  969. u32 c4iw_ocqp_pool_alloc(struct c4iw_rdev *rdev, int size);
  970. void c4iw_ocqp_pool_free(struct c4iw_rdev *rdev, u32 addr, int size);
  971. void c4iw_flush_hw_cq(struct c4iw_cq *chp, struct c4iw_qp *flush_qhp);
  972. void c4iw_count_rcqes(struct t4_cq *cq, struct t4_wq *wq, int *count);
  973. int c4iw_ep_disconnect(struct c4iw_ep *ep, int abrupt, gfp_t gfp);
  974. int c4iw_flush_rq(struct t4_wq *wq, struct t4_cq *cq, int count);
  975. int c4iw_flush_sq(struct c4iw_qp *qhp);
  976. int c4iw_ev_handler(struct c4iw_dev *rnicp, u32 qid);
  977. u16 c4iw_rqes_posted(struct c4iw_qp *qhp);
  978. int c4iw_post_terminate(struct c4iw_qp *qhp, struct t4_cqe *err_cqe);
  979. u32 c4iw_get_cqid(struct c4iw_rdev *rdev, struct c4iw_dev_ucontext *uctx);
  980. void c4iw_put_cqid(struct c4iw_rdev *rdev, u32 qid,
  981. struct c4iw_dev_ucontext *uctx);
  982. u32 c4iw_get_qpid(struct c4iw_rdev *rdev, struct c4iw_dev_ucontext *uctx);
  983. void c4iw_put_qpid(struct c4iw_rdev *rdev, u32 qid,
  984. struct c4iw_dev_ucontext *uctx);
  985. void c4iw_ev_dispatch(struct c4iw_dev *dev, struct t4_cqe *err_cqe);
  986. extern struct cxgb4_client t4c_client;
  987. extern c4iw_handler_func c4iw_handlers[NUM_CPL_CMDS];
  988. void __iomem *c4iw_bar2_addrs(struct c4iw_rdev *rdev, unsigned int qid,
  989. enum cxgb4_bar2_qtype qtype,
  990. unsigned int *pbar2_qid, u64 *pbar2_pa);
  991. int c4iw_alloc_srq_idx(struct c4iw_rdev *rdev);
  992. void c4iw_free_srq_idx(struct c4iw_rdev *rdev, int idx);
  993. extern void c4iw_log_wr_stats(struct t4_wq *wq, struct t4_cqe *cqe);
  994. extern int c4iw_wr_log;
  995. extern int db_fc_threshold;
  996. extern int db_coalescing_threshold;
  997. extern int use_dsgl;
  998. void c4iw_invalidate_mr(struct c4iw_dev *rhp, u32 rkey);
  999. void c4iw_dispatch_srq_limit_reached_event(struct c4iw_srq *srq);
  1000. void c4iw_copy_wr_to_srq(struct t4_srq *srq, union t4_recv_wr *wqe, u8 len16);
  1001. void c4iw_flush_srqidx(struct c4iw_qp *qhp, u32 srqidx);
  1002. int c4iw_post_srq_recv(struct ib_srq *ibsrq, const struct ib_recv_wr *wr,
  1003. const struct ib_recv_wr **bad_wr);
  1004. struct c4iw_wr_wait *c4iw_alloc_wr_wait(gfp_t gfp);
  1005. typedef int c4iw_restrack_func(struct sk_buff *msg,
  1006. struct rdma_restrack_entry *res);
  1007. extern c4iw_restrack_func *c4iw_restrack_funcs[RDMA_RESTRACK_MAX];
  1008. #endif