ehca_main.c 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101
  1. /*
  2. * IBM eServer eHCA Infiniband device driver for Linux on POWER
  3. *
  4. * module start stop, hca detection
  5. *
  6. * Authors: Heiko J Schick <schickhj@de.ibm.com>
  7. * Hoang-Nam Nguyen <hnguyen@de.ibm.com>
  8. * Joachim Fenkes <fenkes@de.ibm.com>
  9. *
  10. * Copyright (c) 2005 IBM Corporation
  11. *
  12. * All rights reserved.
  13. *
  14. * This source code is distributed under a dual license of GPL v2.0 and OpenIB
  15. * BSD.
  16. *
  17. * OpenIB BSD License
  18. *
  19. * Redistribution and use in source and binary forms, with or without
  20. * modification, are permitted provided that the following conditions are met:
  21. *
  22. * Redistributions of source code must retain the above copyright notice, this
  23. * list of conditions and the following disclaimer.
  24. *
  25. * Redistributions in binary form must reproduce the above copyright notice,
  26. * this list of conditions and the following disclaimer in the documentation
  27. * and/or other materials
  28. * provided with the distribution.
  29. *
  30. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  31. * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  32. * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  33. * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
  34. * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  35. * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  36. * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
  37. * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
  38. * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  39. * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  40. * POSSIBILITY OF SUCH DAMAGE.
  41. */
  42. #ifdef CONFIG_PPC_64K_PAGES
  43. #include <linux/slab.h>
  44. #endif
  45. #include <linux/notifier.h>
  46. #include <linux/memory.h>
  47. #include "ehca_classes.h"
  48. #include "ehca_iverbs.h"
  49. #include "ehca_mrmw.h"
  50. #include "ehca_tools.h"
  51. #include "hcp_if.h"
  52. #define HCAD_VERSION "0029"
  53. MODULE_LICENSE("Dual BSD/GPL");
  54. MODULE_AUTHOR("Christoph Raisch <raisch@de.ibm.com>");
  55. MODULE_DESCRIPTION("IBM eServer HCA InfiniBand Device Driver");
  56. MODULE_VERSION(HCAD_VERSION);
  57. static bool ehca_open_aqp1 = 0;
  58. static int ehca_hw_level = 0;
  59. static bool ehca_poll_all_eqs = 1;
  60. int ehca_debug_level = 0;
  61. int ehca_nr_ports = -1;
  62. bool ehca_use_hp_mr = 0;
  63. int ehca_port_act_time = 30;
  64. int ehca_static_rate = -1;
  65. bool ehca_scaling_code = 0;
  66. int ehca_lock_hcalls = -1;
  67. int ehca_max_cq = -1;
  68. int ehca_max_qp = -1;
  69. module_param_named(open_aqp1, ehca_open_aqp1, bool, S_IRUGO);
  70. module_param_named(debug_level, ehca_debug_level, int, S_IRUGO);
  71. module_param_named(hw_level, ehca_hw_level, int, S_IRUGO);
  72. module_param_named(nr_ports, ehca_nr_ports, int, S_IRUGO);
  73. module_param_named(use_hp_mr, ehca_use_hp_mr, bool, S_IRUGO);
  74. module_param_named(port_act_time, ehca_port_act_time, int, S_IRUGO);
  75. module_param_named(poll_all_eqs, ehca_poll_all_eqs, bool, S_IRUGO);
  76. module_param_named(static_rate, ehca_static_rate, int, S_IRUGO);
  77. module_param_named(scaling_code, ehca_scaling_code, bool, S_IRUGO);
  78. module_param_named(lock_hcalls, ehca_lock_hcalls, bint, S_IRUGO);
  79. module_param_named(number_of_cqs, ehca_max_cq, int, S_IRUGO);
  80. module_param_named(number_of_qps, ehca_max_qp, int, S_IRUGO);
  81. MODULE_PARM_DESC(open_aqp1,
  82. "Open AQP1 on startup (default: no)");
  83. MODULE_PARM_DESC(debug_level,
  84. "Amount of debug output (0: none (default), 1: traces, "
  85. "2: some dumps, 3: lots)");
  86. MODULE_PARM_DESC(hw_level,
  87. "Hardware level (0: autosensing (default), "
  88. "0x10..0x14: eHCA, 0x20..0x23: eHCA2)");
  89. MODULE_PARM_DESC(nr_ports,
  90. "number of connected ports (-1: autodetect (default), "
  91. "1: port one only, 2: two ports)");
  92. MODULE_PARM_DESC(use_hp_mr,
  93. "Use high performance MRs (default: no)");
  94. MODULE_PARM_DESC(port_act_time,
  95. "Time to wait for port activation (default: 30 sec)");
  96. MODULE_PARM_DESC(poll_all_eqs,
  97. "Poll all event queues periodically (default: yes)");
  98. MODULE_PARM_DESC(static_rate,
  99. "Set permanent static rate (default: no static rate)");
  100. MODULE_PARM_DESC(scaling_code,
  101. "Enable scaling code (default: no)");
  102. MODULE_PARM_DESC(lock_hcalls,
  103. "Serialize all hCalls made by the driver "
  104. "(default: autodetect)");
  105. MODULE_PARM_DESC(number_of_cqs,
  106. "Max number of CQs which can be allocated "
  107. "(default: autodetect)");
  108. MODULE_PARM_DESC(number_of_qps,
  109. "Max number of QPs which can be allocated "
  110. "(default: autodetect)");
  111. DEFINE_RWLOCK(ehca_qp_idr_lock);
  112. DEFINE_RWLOCK(ehca_cq_idr_lock);
  113. DEFINE_IDR(ehca_qp_idr);
  114. DEFINE_IDR(ehca_cq_idr);
  115. static LIST_HEAD(shca_list); /* list of all registered ehcas */
  116. DEFINE_SPINLOCK(shca_list_lock);
  117. static struct timer_list poll_eqs_timer;
  118. #ifdef CONFIG_PPC_64K_PAGES
  119. static struct kmem_cache *ctblk_cache;
  120. void *ehca_alloc_fw_ctrlblock(gfp_t flags)
  121. {
  122. void *ret = kmem_cache_zalloc(ctblk_cache, flags);
  123. if (!ret)
  124. ehca_gen_err("Out of memory for ctblk");
  125. return ret;
  126. }
  127. void ehca_free_fw_ctrlblock(void *ptr)
  128. {
  129. if (ptr)
  130. kmem_cache_free(ctblk_cache, ptr);
  131. }
  132. #endif
  133. int ehca2ib_return_code(u64 ehca_rc)
  134. {
  135. switch (ehca_rc) {
  136. case H_SUCCESS:
  137. return 0;
  138. case H_RESOURCE: /* Resource in use */
  139. case H_BUSY:
  140. return -EBUSY;
  141. case H_NOT_ENOUGH_RESOURCES: /* insufficient resources */
  142. case H_CONSTRAINED: /* resource constraint */
  143. case H_NO_MEM:
  144. return -ENOMEM;
  145. default:
  146. return -EINVAL;
  147. }
  148. }
  149. static int ehca_create_slab_caches(void)
  150. {
  151. int ret;
  152. ret = ehca_init_pd_cache();
  153. if (ret) {
  154. ehca_gen_err("Cannot create PD SLAB cache.");
  155. return ret;
  156. }
  157. ret = ehca_init_cq_cache();
  158. if (ret) {
  159. ehca_gen_err("Cannot create CQ SLAB cache.");
  160. goto create_slab_caches2;
  161. }
  162. ret = ehca_init_qp_cache();
  163. if (ret) {
  164. ehca_gen_err("Cannot create QP SLAB cache.");
  165. goto create_slab_caches3;
  166. }
  167. ret = ehca_init_av_cache();
  168. if (ret) {
  169. ehca_gen_err("Cannot create AV SLAB cache.");
  170. goto create_slab_caches4;
  171. }
  172. ret = ehca_init_mrmw_cache();
  173. if (ret) {
  174. ehca_gen_err("Cannot create MR&MW SLAB cache.");
  175. goto create_slab_caches5;
  176. }
  177. ret = ehca_init_small_qp_cache();
  178. if (ret) {
  179. ehca_gen_err("Cannot create small queue SLAB cache.");
  180. goto create_slab_caches6;
  181. }
  182. #ifdef CONFIG_PPC_64K_PAGES
  183. ctblk_cache = kmem_cache_create("ehca_cache_ctblk",
  184. EHCA_PAGESIZE, H_CB_ALIGNMENT,
  185. SLAB_HWCACHE_ALIGN,
  186. NULL);
  187. if (!ctblk_cache) {
  188. ehca_gen_err("Cannot create ctblk SLAB cache.");
  189. ehca_cleanup_small_qp_cache();
  190. goto create_slab_caches6;
  191. }
  192. #endif
  193. return 0;
  194. create_slab_caches6:
  195. ehca_cleanup_mrmw_cache();
  196. create_slab_caches5:
  197. ehca_cleanup_av_cache();
  198. create_slab_caches4:
  199. ehca_cleanup_qp_cache();
  200. create_slab_caches3:
  201. ehca_cleanup_cq_cache();
  202. create_slab_caches2:
  203. ehca_cleanup_pd_cache();
  204. return ret;
  205. }
  206. static void ehca_destroy_slab_caches(void)
  207. {
  208. ehca_cleanup_small_qp_cache();
  209. ehca_cleanup_mrmw_cache();
  210. ehca_cleanup_av_cache();
  211. ehca_cleanup_qp_cache();
  212. ehca_cleanup_cq_cache();
  213. ehca_cleanup_pd_cache();
  214. #ifdef CONFIG_PPC_64K_PAGES
  215. if (ctblk_cache)
  216. kmem_cache_destroy(ctblk_cache);
  217. #endif
  218. }
  219. #define EHCA_HCAAVER EHCA_BMASK_IBM(32, 39)
  220. #define EHCA_REVID EHCA_BMASK_IBM(40, 63)
  221. static struct cap_descr {
  222. u64 mask;
  223. char *descr;
  224. } hca_cap_descr[] = {
  225. { HCA_CAP_AH_PORT_NR_CHECK, "HCA_CAP_AH_PORT_NR_CHECK" },
  226. { HCA_CAP_ATOMIC, "HCA_CAP_ATOMIC" },
  227. { HCA_CAP_AUTO_PATH_MIG, "HCA_CAP_AUTO_PATH_MIG" },
  228. { HCA_CAP_BAD_P_KEY_CTR, "HCA_CAP_BAD_P_KEY_CTR" },
  229. { HCA_CAP_SQD_RTS_PORT_CHANGE, "HCA_CAP_SQD_RTS_PORT_CHANGE" },
  230. { HCA_CAP_CUR_QP_STATE_MOD, "HCA_CAP_CUR_QP_STATE_MOD" },
  231. { HCA_CAP_INIT_TYPE, "HCA_CAP_INIT_TYPE" },
  232. { HCA_CAP_PORT_ACTIVE_EVENT, "HCA_CAP_PORT_ACTIVE_EVENT" },
  233. { HCA_CAP_Q_KEY_VIOL_CTR, "HCA_CAP_Q_KEY_VIOL_CTR" },
  234. { HCA_CAP_WQE_RESIZE, "HCA_CAP_WQE_RESIZE" },
  235. { HCA_CAP_RAW_PACKET_MCAST, "HCA_CAP_RAW_PACKET_MCAST" },
  236. { HCA_CAP_SHUTDOWN_PORT, "HCA_CAP_SHUTDOWN_PORT" },
  237. { HCA_CAP_RC_LL_QP, "HCA_CAP_RC_LL_QP" },
  238. { HCA_CAP_SRQ, "HCA_CAP_SRQ" },
  239. { HCA_CAP_UD_LL_QP, "HCA_CAP_UD_LL_QP" },
  240. { HCA_CAP_RESIZE_MR, "HCA_CAP_RESIZE_MR" },
  241. { HCA_CAP_MINI_QP, "HCA_CAP_MINI_QP" },
  242. { HCA_CAP_H_ALLOC_RES_SYNC, "HCA_CAP_H_ALLOC_RES_SYNC" },
  243. };
  244. static int ehca_sense_attributes(struct ehca_shca *shca)
  245. {
  246. int i, ret = 0;
  247. u64 h_ret;
  248. struct hipz_query_hca *rblock;
  249. struct hipz_query_port *port;
  250. const char *loc_code;
  251. static const u32 pgsize_map[] = {
  252. HCA_CAP_MR_PGSIZE_4K, 0x1000,
  253. HCA_CAP_MR_PGSIZE_64K, 0x10000,
  254. HCA_CAP_MR_PGSIZE_1M, 0x100000,
  255. HCA_CAP_MR_PGSIZE_16M, 0x1000000,
  256. };
  257. ehca_gen_dbg("Probing adapter %s...",
  258. shca->ofdev->dev.of_node->full_name);
  259. loc_code = of_get_property(shca->ofdev->dev.of_node, "ibm,loc-code",
  260. NULL);
  261. if (loc_code)
  262. ehca_gen_dbg(" ... location lode=%s", loc_code);
  263. rblock = ehca_alloc_fw_ctrlblock(GFP_KERNEL);
  264. if (!rblock) {
  265. ehca_gen_err("Cannot allocate rblock memory.");
  266. return -ENOMEM;
  267. }
  268. h_ret = hipz_h_query_hca(shca->ipz_hca_handle, rblock);
  269. if (h_ret != H_SUCCESS) {
  270. ehca_gen_err("Cannot query device properties. h_ret=%lli",
  271. h_ret);
  272. ret = -EPERM;
  273. goto sense_attributes1;
  274. }
  275. if (ehca_nr_ports == 1)
  276. shca->num_ports = 1;
  277. else
  278. shca->num_ports = (u8)rblock->num_ports;
  279. ehca_gen_dbg(" ... found %x ports", rblock->num_ports);
  280. if (ehca_hw_level == 0) {
  281. u32 hcaaver;
  282. u32 revid;
  283. hcaaver = EHCA_BMASK_GET(EHCA_HCAAVER, rblock->hw_ver);
  284. revid = EHCA_BMASK_GET(EHCA_REVID, rblock->hw_ver);
  285. ehca_gen_dbg(" ... hardware version=%x:%x", hcaaver, revid);
  286. if (hcaaver == 1) {
  287. if (revid <= 3)
  288. shca->hw_level = 0x10 | (revid + 1);
  289. else
  290. shca->hw_level = 0x14;
  291. } else if (hcaaver == 2) {
  292. if (revid == 0)
  293. shca->hw_level = 0x21;
  294. else if (revid == 0x10)
  295. shca->hw_level = 0x22;
  296. else if (revid == 0x20 || revid == 0x21)
  297. shca->hw_level = 0x23;
  298. }
  299. if (!shca->hw_level) {
  300. ehca_gen_warn("unknown hardware version"
  301. " - assuming default level");
  302. shca->hw_level = 0x22;
  303. }
  304. } else
  305. shca->hw_level = ehca_hw_level;
  306. ehca_gen_dbg(" ... hardware level=%x", shca->hw_level);
  307. shca->hca_cap = rblock->hca_cap_indicators;
  308. ehca_gen_dbg(" ... HCA capabilities:");
  309. for (i = 0; i < ARRAY_SIZE(hca_cap_descr); i++)
  310. if (EHCA_BMASK_GET(hca_cap_descr[i].mask, shca->hca_cap))
  311. ehca_gen_dbg(" %s", hca_cap_descr[i].descr);
  312. /* Autodetect hCall locking -- the "H_ALLOC_RESOURCE synced" flag is
  313. * a firmware property, so it's valid across all adapters
  314. */
  315. if (ehca_lock_hcalls == -1)
  316. ehca_lock_hcalls = !EHCA_BMASK_GET(HCA_CAP_H_ALLOC_RES_SYNC,
  317. shca->hca_cap);
  318. /* translate supported MR page sizes; always support 4K */
  319. shca->hca_cap_mr_pgsize = EHCA_PAGESIZE;
  320. for (i = 0; i < ARRAY_SIZE(pgsize_map); i += 2)
  321. if (rblock->memory_page_size_supported & pgsize_map[i])
  322. shca->hca_cap_mr_pgsize |= pgsize_map[i + 1];
  323. /* Set maximum number of CQs and QPs to calculate EQ size */
  324. if (shca->max_num_qps == -1)
  325. shca->max_num_qps = min_t(int, rblock->max_qp,
  326. EHCA_MAX_NUM_QUEUES);
  327. else if (shca->max_num_qps < 1 || shca->max_num_qps > rblock->max_qp) {
  328. ehca_gen_warn("The requested number of QPs is out of range "
  329. "(1 - %i) specified by HW. Value is set to %i",
  330. rblock->max_qp, rblock->max_qp);
  331. shca->max_num_qps = rblock->max_qp;
  332. }
  333. if (shca->max_num_cqs == -1)
  334. shca->max_num_cqs = min_t(int, rblock->max_cq,
  335. EHCA_MAX_NUM_QUEUES);
  336. else if (shca->max_num_cqs < 1 || shca->max_num_cqs > rblock->max_cq) {
  337. ehca_gen_warn("The requested number of CQs is out of range "
  338. "(1 - %i) specified by HW. Value is set to %i",
  339. rblock->max_cq, rblock->max_cq);
  340. }
  341. /* query max MTU from first port -- it's the same for all ports */
  342. port = (struct hipz_query_port *)rblock;
  343. h_ret = hipz_h_query_port(shca->ipz_hca_handle, 1, port);
  344. if (h_ret != H_SUCCESS) {
  345. ehca_gen_err("Cannot query port properties. h_ret=%lli",
  346. h_ret);
  347. ret = -EPERM;
  348. goto sense_attributes1;
  349. }
  350. shca->max_mtu = port->max_mtu;
  351. sense_attributes1:
  352. ehca_free_fw_ctrlblock(rblock);
  353. return ret;
  354. }
  355. static int init_node_guid(struct ehca_shca *shca)
  356. {
  357. int ret = 0;
  358. struct hipz_query_hca *rblock;
  359. rblock = ehca_alloc_fw_ctrlblock(GFP_KERNEL);
  360. if (!rblock) {
  361. ehca_err(&shca->ib_device, "Can't allocate rblock memory.");
  362. return -ENOMEM;
  363. }
  364. if (hipz_h_query_hca(shca->ipz_hca_handle, rblock) != H_SUCCESS) {
  365. ehca_err(&shca->ib_device, "Can't query device properties");
  366. ret = -EINVAL;
  367. goto init_node_guid1;
  368. }
  369. memcpy(&shca->ib_device.node_guid, &rblock->node_guid, sizeof(u64));
  370. init_node_guid1:
  371. ehca_free_fw_ctrlblock(rblock);
  372. return ret;
  373. }
  374. static int ehca_init_device(struct ehca_shca *shca)
  375. {
  376. int ret;
  377. ret = init_node_guid(shca);
  378. if (ret)
  379. return ret;
  380. strlcpy(shca->ib_device.name, "ehca%d", IB_DEVICE_NAME_MAX);
  381. shca->ib_device.owner = THIS_MODULE;
  382. shca->ib_device.uverbs_abi_ver = 8;
  383. shca->ib_device.uverbs_cmd_mask =
  384. (1ull << IB_USER_VERBS_CMD_GET_CONTEXT) |
  385. (1ull << IB_USER_VERBS_CMD_QUERY_DEVICE) |
  386. (1ull << IB_USER_VERBS_CMD_QUERY_PORT) |
  387. (1ull << IB_USER_VERBS_CMD_ALLOC_PD) |
  388. (1ull << IB_USER_VERBS_CMD_DEALLOC_PD) |
  389. (1ull << IB_USER_VERBS_CMD_REG_MR) |
  390. (1ull << IB_USER_VERBS_CMD_DEREG_MR) |
  391. (1ull << IB_USER_VERBS_CMD_CREATE_COMP_CHANNEL) |
  392. (1ull << IB_USER_VERBS_CMD_CREATE_CQ) |
  393. (1ull << IB_USER_VERBS_CMD_DESTROY_CQ) |
  394. (1ull << IB_USER_VERBS_CMD_CREATE_QP) |
  395. (1ull << IB_USER_VERBS_CMD_MODIFY_QP) |
  396. (1ull << IB_USER_VERBS_CMD_QUERY_QP) |
  397. (1ull << IB_USER_VERBS_CMD_DESTROY_QP) |
  398. (1ull << IB_USER_VERBS_CMD_ATTACH_MCAST) |
  399. (1ull << IB_USER_VERBS_CMD_DETACH_MCAST);
  400. shca->ib_device.node_type = RDMA_NODE_IB_CA;
  401. shca->ib_device.phys_port_cnt = shca->num_ports;
  402. shca->ib_device.num_comp_vectors = 1;
  403. shca->ib_device.dma_device = &shca->ofdev->dev;
  404. shca->ib_device.query_device = ehca_query_device;
  405. shca->ib_device.query_port = ehca_query_port;
  406. shca->ib_device.query_gid = ehca_query_gid;
  407. shca->ib_device.query_pkey = ehca_query_pkey;
  408. /* shca->in_device.modify_device = ehca_modify_device */
  409. shca->ib_device.modify_port = ehca_modify_port;
  410. shca->ib_device.alloc_ucontext = ehca_alloc_ucontext;
  411. shca->ib_device.dealloc_ucontext = ehca_dealloc_ucontext;
  412. shca->ib_device.alloc_pd = ehca_alloc_pd;
  413. shca->ib_device.dealloc_pd = ehca_dealloc_pd;
  414. shca->ib_device.create_ah = ehca_create_ah;
  415. /* shca->ib_device.modify_ah = ehca_modify_ah; */
  416. shca->ib_device.query_ah = ehca_query_ah;
  417. shca->ib_device.destroy_ah = ehca_destroy_ah;
  418. shca->ib_device.create_qp = ehca_create_qp;
  419. shca->ib_device.modify_qp = ehca_modify_qp;
  420. shca->ib_device.query_qp = ehca_query_qp;
  421. shca->ib_device.destroy_qp = ehca_destroy_qp;
  422. shca->ib_device.post_send = ehca_post_send;
  423. shca->ib_device.post_recv = ehca_post_recv;
  424. shca->ib_device.create_cq = ehca_create_cq;
  425. shca->ib_device.destroy_cq = ehca_destroy_cq;
  426. shca->ib_device.resize_cq = ehca_resize_cq;
  427. shca->ib_device.poll_cq = ehca_poll_cq;
  428. /* shca->ib_device.peek_cq = ehca_peek_cq; */
  429. shca->ib_device.req_notify_cq = ehca_req_notify_cq;
  430. /* shca->ib_device.req_ncomp_notif = ehca_req_ncomp_notif; */
  431. shca->ib_device.get_dma_mr = ehca_get_dma_mr;
  432. shca->ib_device.reg_phys_mr = ehca_reg_phys_mr;
  433. shca->ib_device.reg_user_mr = ehca_reg_user_mr;
  434. shca->ib_device.query_mr = ehca_query_mr;
  435. shca->ib_device.dereg_mr = ehca_dereg_mr;
  436. shca->ib_device.rereg_phys_mr = ehca_rereg_phys_mr;
  437. shca->ib_device.alloc_mw = ehca_alloc_mw;
  438. shca->ib_device.bind_mw = ehca_bind_mw;
  439. shca->ib_device.dealloc_mw = ehca_dealloc_mw;
  440. shca->ib_device.alloc_fmr = ehca_alloc_fmr;
  441. shca->ib_device.map_phys_fmr = ehca_map_phys_fmr;
  442. shca->ib_device.unmap_fmr = ehca_unmap_fmr;
  443. shca->ib_device.dealloc_fmr = ehca_dealloc_fmr;
  444. shca->ib_device.attach_mcast = ehca_attach_mcast;
  445. shca->ib_device.detach_mcast = ehca_detach_mcast;
  446. shca->ib_device.process_mad = ehca_process_mad;
  447. shca->ib_device.mmap = ehca_mmap;
  448. shca->ib_device.dma_ops = &ehca_dma_mapping_ops;
  449. if (EHCA_BMASK_GET(HCA_CAP_SRQ, shca->hca_cap)) {
  450. shca->ib_device.uverbs_cmd_mask |=
  451. (1ull << IB_USER_VERBS_CMD_CREATE_SRQ) |
  452. (1ull << IB_USER_VERBS_CMD_MODIFY_SRQ) |
  453. (1ull << IB_USER_VERBS_CMD_QUERY_SRQ) |
  454. (1ull << IB_USER_VERBS_CMD_DESTROY_SRQ);
  455. shca->ib_device.create_srq = ehca_create_srq;
  456. shca->ib_device.modify_srq = ehca_modify_srq;
  457. shca->ib_device.query_srq = ehca_query_srq;
  458. shca->ib_device.destroy_srq = ehca_destroy_srq;
  459. shca->ib_device.post_srq_recv = ehca_post_srq_recv;
  460. }
  461. return ret;
  462. }
  463. static int ehca_create_aqp1(struct ehca_shca *shca, u32 port)
  464. {
  465. struct ehca_sport *sport = &shca->sport[port - 1];
  466. struct ib_cq *ibcq;
  467. struct ib_qp *ibqp;
  468. struct ib_qp_init_attr qp_init_attr;
  469. int ret;
  470. if (sport->ibcq_aqp1) {
  471. ehca_err(&shca->ib_device, "AQP1 CQ is already created.");
  472. return -EPERM;
  473. }
  474. ibcq = ib_create_cq(&shca->ib_device, NULL, NULL, (void *)(-1), 10, 0);
  475. if (IS_ERR(ibcq)) {
  476. ehca_err(&shca->ib_device, "Cannot create AQP1 CQ.");
  477. return PTR_ERR(ibcq);
  478. }
  479. sport->ibcq_aqp1 = ibcq;
  480. if (sport->ibqp_sqp[IB_QPT_GSI]) {
  481. ehca_err(&shca->ib_device, "AQP1 QP is already created.");
  482. ret = -EPERM;
  483. goto create_aqp1;
  484. }
  485. memset(&qp_init_attr, 0, sizeof(struct ib_qp_init_attr));
  486. qp_init_attr.send_cq = ibcq;
  487. qp_init_attr.recv_cq = ibcq;
  488. qp_init_attr.sq_sig_type = IB_SIGNAL_ALL_WR;
  489. qp_init_attr.cap.max_send_wr = 100;
  490. qp_init_attr.cap.max_recv_wr = 100;
  491. qp_init_attr.cap.max_send_sge = 2;
  492. qp_init_attr.cap.max_recv_sge = 1;
  493. qp_init_attr.qp_type = IB_QPT_GSI;
  494. qp_init_attr.port_num = port;
  495. qp_init_attr.qp_context = NULL;
  496. qp_init_attr.event_handler = NULL;
  497. qp_init_attr.srq = NULL;
  498. ibqp = ib_create_qp(&shca->pd->ib_pd, &qp_init_attr);
  499. if (IS_ERR(ibqp)) {
  500. ehca_err(&shca->ib_device, "Cannot create AQP1 QP.");
  501. ret = PTR_ERR(ibqp);
  502. goto create_aqp1;
  503. }
  504. sport->ibqp_sqp[IB_QPT_GSI] = ibqp;
  505. return 0;
  506. create_aqp1:
  507. ib_destroy_cq(sport->ibcq_aqp1);
  508. return ret;
  509. }
  510. static int ehca_destroy_aqp1(struct ehca_sport *sport)
  511. {
  512. int ret;
  513. ret = ib_destroy_qp(sport->ibqp_sqp[IB_QPT_GSI]);
  514. if (ret) {
  515. ehca_gen_err("Cannot destroy AQP1 QP. ret=%i", ret);
  516. return ret;
  517. }
  518. ret = ib_destroy_cq(sport->ibcq_aqp1);
  519. if (ret)
  520. ehca_gen_err("Cannot destroy AQP1 CQ. ret=%i", ret);
  521. return ret;
  522. }
  523. static ssize_t ehca_show_debug_level(struct device_driver *ddp, char *buf)
  524. {
  525. return snprintf(buf, PAGE_SIZE, "%d\n", ehca_debug_level);
  526. }
  527. static ssize_t ehca_store_debug_level(struct device_driver *ddp,
  528. const char *buf, size_t count)
  529. {
  530. int value = (*buf) - '0';
  531. if (value >= 0 && value <= 9)
  532. ehca_debug_level = value;
  533. return 1;
  534. }
  535. static DRIVER_ATTR(debug_level, S_IRUSR | S_IWUSR,
  536. ehca_show_debug_level, ehca_store_debug_level);
  537. static struct attribute *ehca_drv_attrs[] = {
  538. &driver_attr_debug_level.attr,
  539. NULL
  540. };
  541. static struct attribute_group ehca_drv_attr_grp = {
  542. .attrs = ehca_drv_attrs
  543. };
  544. static const struct attribute_group *ehca_drv_attr_groups[] = {
  545. &ehca_drv_attr_grp,
  546. NULL,
  547. };
  548. #define EHCA_RESOURCE_ATTR(name) \
  549. static ssize_t ehca_show_##name(struct device *dev, \
  550. struct device_attribute *attr, \
  551. char *buf) \
  552. { \
  553. struct ehca_shca *shca; \
  554. struct hipz_query_hca *rblock; \
  555. int data; \
  556. \
  557. shca = dev_get_drvdata(dev); \
  558. \
  559. rblock = ehca_alloc_fw_ctrlblock(GFP_KERNEL); \
  560. if (!rblock) { \
  561. dev_err(dev, "Can't allocate rblock memory.\n"); \
  562. return 0; \
  563. } \
  564. \
  565. if (hipz_h_query_hca(shca->ipz_hca_handle, rblock) != H_SUCCESS) { \
  566. dev_err(dev, "Can't query device properties\n"); \
  567. ehca_free_fw_ctrlblock(rblock); \
  568. return 0; \
  569. } \
  570. \
  571. data = rblock->name; \
  572. ehca_free_fw_ctrlblock(rblock); \
  573. \
  574. if ((strcmp(#name, "num_ports") == 0) && (ehca_nr_ports == 1)) \
  575. return snprintf(buf, 256, "1\n"); \
  576. else \
  577. return snprintf(buf, 256, "%d\n", data); \
  578. \
  579. } \
  580. static DEVICE_ATTR(name, S_IRUGO, ehca_show_##name, NULL);
  581. EHCA_RESOURCE_ATTR(num_ports);
  582. EHCA_RESOURCE_ATTR(hw_ver);
  583. EHCA_RESOURCE_ATTR(max_eq);
  584. EHCA_RESOURCE_ATTR(cur_eq);
  585. EHCA_RESOURCE_ATTR(max_cq);
  586. EHCA_RESOURCE_ATTR(cur_cq);
  587. EHCA_RESOURCE_ATTR(max_qp);
  588. EHCA_RESOURCE_ATTR(cur_qp);
  589. EHCA_RESOURCE_ATTR(max_mr);
  590. EHCA_RESOURCE_ATTR(cur_mr);
  591. EHCA_RESOURCE_ATTR(max_mw);
  592. EHCA_RESOURCE_ATTR(cur_mw);
  593. EHCA_RESOURCE_ATTR(max_pd);
  594. EHCA_RESOURCE_ATTR(max_ah);
  595. static ssize_t ehca_show_adapter_handle(struct device *dev,
  596. struct device_attribute *attr,
  597. char *buf)
  598. {
  599. struct ehca_shca *shca = dev_get_drvdata(dev);
  600. return sprintf(buf, "%llx\n", shca->ipz_hca_handle.handle);
  601. }
  602. static DEVICE_ATTR(adapter_handle, S_IRUGO, ehca_show_adapter_handle, NULL);
  603. static struct attribute *ehca_dev_attrs[] = {
  604. &dev_attr_adapter_handle.attr,
  605. &dev_attr_num_ports.attr,
  606. &dev_attr_hw_ver.attr,
  607. &dev_attr_max_eq.attr,
  608. &dev_attr_cur_eq.attr,
  609. &dev_attr_max_cq.attr,
  610. &dev_attr_cur_cq.attr,
  611. &dev_attr_max_qp.attr,
  612. &dev_attr_cur_qp.attr,
  613. &dev_attr_max_mr.attr,
  614. &dev_attr_cur_mr.attr,
  615. &dev_attr_max_mw.attr,
  616. &dev_attr_cur_mw.attr,
  617. &dev_attr_max_pd.attr,
  618. &dev_attr_max_ah.attr,
  619. NULL
  620. };
  621. static struct attribute_group ehca_dev_attr_grp = {
  622. .attrs = ehca_dev_attrs
  623. };
  624. static int __devinit ehca_probe(struct platform_device *dev,
  625. const struct of_device_id *id)
  626. {
  627. struct ehca_shca *shca;
  628. const u64 *handle;
  629. struct ib_pd *ibpd;
  630. int ret, i, eq_size;
  631. unsigned long flags;
  632. handle = of_get_property(dev->dev.of_node, "ibm,hca-handle", NULL);
  633. if (!handle) {
  634. ehca_gen_err("Cannot get eHCA handle for adapter: %s.",
  635. dev->dev.of_node->full_name);
  636. return -ENODEV;
  637. }
  638. if (!(*handle)) {
  639. ehca_gen_err("Wrong eHCA handle for adapter: %s.",
  640. dev->dev.of_node->full_name);
  641. return -ENODEV;
  642. }
  643. shca = (struct ehca_shca *)ib_alloc_device(sizeof(*shca));
  644. if (!shca) {
  645. ehca_gen_err("Cannot allocate shca memory.");
  646. return -ENOMEM;
  647. }
  648. mutex_init(&shca->modify_mutex);
  649. atomic_set(&shca->num_cqs, 0);
  650. atomic_set(&shca->num_qps, 0);
  651. shca->max_num_qps = ehca_max_qp;
  652. shca->max_num_cqs = ehca_max_cq;
  653. for (i = 0; i < ARRAY_SIZE(shca->sport); i++)
  654. spin_lock_init(&shca->sport[i].mod_sqp_lock);
  655. shca->ofdev = dev;
  656. shca->ipz_hca_handle.handle = *handle;
  657. dev_set_drvdata(&dev->dev, shca);
  658. ret = ehca_sense_attributes(shca);
  659. if (ret < 0) {
  660. ehca_gen_err("Cannot sense eHCA attributes.");
  661. goto probe1;
  662. }
  663. ret = ehca_init_device(shca);
  664. if (ret) {
  665. ehca_gen_err("Cannot init ehca device struct");
  666. goto probe1;
  667. }
  668. eq_size = 2 * shca->max_num_cqs + 4 * shca->max_num_qps;
  669. /* create event queues */
  670. ret = ehca_create_eq(shca, &shca->eq, EHCA_EQ, eq_size);
  671. if (ret) {
  672. ehca_err(&shca->ib_device, "Cannot create EQ.");
  673. goto probe1;
  674. }
  675. ret = ehca_create_eq(shca, &shca->neq, EHCA_NEQ, 513);
  676. if (ret) {
  677. ehca_err(&shca->ib_device, "Cannot create NEQ.");
  678. goto probe3;
  679. }
  680. /* create internal protection domain */
  681. ibpd = ehca_alloc_pd(&shca->ib_device, (void *)(-1), NULL);
  682. if (IS_ERR(ibpd)) {
  683. ehca_err(&shca->ib_device, "Cannot create internal PD.");
  684. ret = PTR_ERR(ibpd);
  685. goto probe4;
  686. }
  687. shca->pd = container_of(ibpd, struct ehca_pd, ib_pd);
  688. shca->pd->ib_pd.device = &shca->ib_device;
  689. /* create internal max MR */
  690. ret = ehca_reg_internal_maxmr(shca, shca->pd, &shca->maxmr);
  691. if (ret) {
  692. ehca_err(&shca->ib_device, "Cannot create internal MR ret=%i",
  693. ret);
  694. goto probe5;
  695. }
  696. ret = ib_register_device(&shca->ib_device, NULL);
  697. if (ret) {
  698. ehca_err(&shca->ib_device,
  699. "ib_register_device() failed ret=%i", ret);
  700. goto probe6;
  701. }
  702. /* create AQP1 for port 1 */
  703. if (ehca_open_aqp1 == 1) {
  704. shca->sport[0].port_state = IB_PORT_DOWN;
  705. ret = ehca_create_aqp1(shca, 1);
  706. if (ret) {
  707. ehca_err(&shca->ib_device,
  708. "Cannot create AQP1 for port 1.");
  709. goto probe7;
  710. }
  711. }
  712. /* create AQP1 for port 2 */
  713. if ((ehca_open_aqp1 == 1) && (shca->num_ports == 2)) {
  714. shca->sport[1].port_state = IB_PORT_DOWN;
  715. ret = ehca_create_aqp1(shca, 2);
  716. if (ret) {
  717. ehca_err(&shca->ib_device,
  718. "Cannot create AQP1 for port 2.");
  719. goto probe8;
  720. }
  721. }
  722. ret = sysfs_create_group(&dev->dev.kobj, &ehca_dev_attr_grp);
  723. if (ret) /* only complain; we can live without attributes */
  724. ehca_err(&shca->ib_device,
  725. "Cannot create device attributes ret=%d", ret);
  726. spin_lock_irqsave(&shca_list_lock, flags);
  727. list_add(&shca->shca_list, &shca_list);
  728. spin_unlock_irqrestore(&shca_list_lock, flags);
  729. return 0;
  730. probe8:
  731. ret = ehca_destroy_aqp1(&shca->sport[0]);
  732. if (ret)
  733. ehca_err(&shca->ib_device,
  734. "Cannot destroy AQP1 for port 1. ret=%i", ret);
  735. probe7:
  736. ib_unregister_device(&shca->ib_device);
  737. probe6:
  738. ret = ehca_dereg_internal_maxmr(shca);
  739. if (ret)
  740. ehca_err(&shca->ib_device,
  741. "Cannot destroy internal MR. ret=%x", ret);
  742. probe5:
  743. ret = ehca_dealloc_pd(&shca->pd->ib_pd);
  744. if (ret)
  745. ehca_err(&shca->ib_device,
  746. "Cannot destroy internal PD. ret=%x", ret);
  747. probe4:
  748. ret = ehca_destroy_eq(shca, &shca->neq);
  749. if (ret)
  750. ehca_err(&shca->ib_device,
  751. "Cannot destroy NEQ. ret=%x", ret);
  752. probe3:
  753. ret = ehca_destroy_eq(shca, &shca->eq);
  754. if (ret)
  755. ehca_err(&shca->ib_device,
  756. "Cannot destroy EQ. ret=%x", ret);
  757. probe1:
  758. ib_dealloc_device(&shca->ib_device);
  759. return -EINVAL;
  760. }
  761. static int __devexit ehca_remove(struct platform_device *dev)
  762. {
  763. struct ehca_shca *shca = dev_get_drvdata(&dev->dev);
  764. unsigned long flags;
  765. int ret;
  766. sysfs_remove_group(&dev->dev.kobj, &ehca_dev_attr_grp);
  767. if (ehca_open_aqp1 == 1) {
  768. int i;
  769. for (i = 0; i < shca->num_ports; i++) {
  770. ret = ehca_destroy_aqp1(&shca->sport[i]);
  771. if (ret)
  772. ehca_err(&shca->ib_device,
  773. "Cannot destroy AQP1 for port %x "
  774. "ret=%i", ret, i);
  775. }
  776. }
  777. ib_unregister_device(&shca->ib_device);
  778. ret = ehca_dereg_internal_maxmr(shca);
  779. if (ret)
  780. ehca_err(&shca->ib_device,
  781. "Cannot destroy internal MR. ret=%i", ret);
  782. ret = ehca_dealloc_pd(&shca->pd->ib_pd);
  783. if (ret)
  784. ehca_err(&shca->ib_device,
  785. "Cannot destroy internal PD. ret=%i", ret);
  786. ret = ehca_destroy_eq(shca, &shca->eq);
  787. if (ret)
  788. ehca_err(&shca->ib_device, "Cannot destroy EQ. ret=%i", ret);
  789. ret = ehca_destroy_eq(shca, &shca->neq);
  790. if (ret)
  791. ehca_err(&shca->ib_device, "Canot destroy NEQ. ret=%i", ret);
  792. ib_dealloc_device(&shca->ib_device);
  793. spin_lock_irqsave(&shca_list_lock, flags);
  794. list_del(&shca->shca_list);
  795. spin_unlock_irqrestore(&shca_list_lock, flags);
  796. return ret;
  797. }
  798. static struct of_device_id ehca_device_table[] =
  799. {
  800. {
  801. .name = "lhca",
  802. .compatible = "IBM,lhca",
  803. },
  804. {},
  805. };
  806. MODULE_DEVICE_TABLE(of, ehca_device_table);
  807. static struct of_platform_driver ehca_driver = {
  808. .probe = ehca_probe,
  809. .remove = ehca_remove,
  810. .driver = {
  811. .name = "ehca",
  812. .owner = THIS_MODULE,
  813. .groups = ehca_drv_attr_groups,
  814. .of_match_table = ehca_device_table,
  815. },
  816. };
  817. void ehca_poll_eqs(unsigned long data)
  818. {
  819. struct ehca_shca *shca;
  820. spin_lock(&shca_list_lock);
  821. list_for_each_entry(shca, &shca_list, shca_list) {
  822. if (shca->eq.is_initialized) {
  823. /* call deadman proc only if eq ptr does not change */
  824. struct ehca_eq *eq = &shca->eq;
  825. int max = 3;
  826. volatile u64 q_ofs, q_ofs2;
  827. unsigned long flags;
  828. spin_lock_irqsave(&eq->spinlock, flags);
  829. q_ofs = eq->ipz_queue.current_q_offset;
  830. spin_unlock_irqrestore(&eq->spinlock, flags);
  831. do {
  832. spin_lock_irqsave(&eq->spinlock, flags);
  833. q_ofs2 = eq->ipz_queue.current_q_offset;
  834. spin_unlock_irqrestore(&eq->spinlock, flags);
  835. max--;
  836. } while (q_ofs == q_ofs2 && max > 0);
  837. if (q_ofs == q_ofs2)
  838. ehca_process_eq(shca, 0);
  839. }
  840. }
  841. mod_timer(&poll_eqs_timer, round_jiffies(jiffies + HZ));
  842. spin_unlock(&shca_list_lock);
  843. }
  844. static int ehca_mem_notifier(struct notifier_block *nb,
  845. unsigned long action, void *data)
  846. {
  847. static unsigned long ehca_dmem_warn_time;
  848. unsigned long flags;
  849. switch (action) {
  850. case MEM_CANCEL_OFFLINE:
  851. case MEM_CANCEL_ONLINE:
  852. case MEM_ONLINE:
  853. case MEM_OFFLINE:
  854. return NOTIFY_OK;
  855. case MEM_GOING_ONLINE:
  856. case MEM_GOING_OFFLINE:
  857. /* only ok if no hca is attached to the lpar */
  858. spin_lock_irqsave(&shca_list_lock, flags);
  859. if (list_empty(&shca_list)) {
  860. spin_unlock_irqrestore(&shca_list_lock, flags);
  861. return NOTIFY_OK;
  862. } else {
  863. spin_unlock_irqrestore(&shca_list_lock, flags);
  864. if (printk_timed_ratelimit(&ehca_dmem_warn_time,
  865. 30 * 1000))
  866. ehca_gen_err("DMEM operations are not allowed"
  867. "in conjunction with eHCA");
  868. return NOTIFY_BAD;
  869. }
  870. }
  871. return NOTIFY_OK;
  872. }
  873. static struct notifier_block ehca_mem_nb = {
  874. .notifier_call = ehca_mem_notifier,
  875. };
  876. static int __init ehca_module_init(void)
  877. {
  878. int ret;
  879. printk(KERN_INFO "eHCA Infiniband Device Driver "
  880. "(Version " HCAD_VERSION ")\n");
  881. ret = ehca_create_comp_pool();
  882. if (ret) {
  883. ehca_gen_err("Cannot create comp pool.");
  884. return ret;
  885. }
  886. ret = ehca_create_slab_caches();
  887. if (ret) {
  888. ehca_gen_err("Cannot create SLAB caches");
  889. ret = -ENOMEM;
  890. goto module_init1;
  891. }
  892. ret = ehca_create_busmap();
  893. if (ret) {
  894. ehca_gen_err("Cannot create busmap.");
  895. goto module_init2;
  896. }
  897. ret = ibmebus_register_driver(&ehca_driver);
  898. if (ret) {
  899. ehca_gen_err("Cannot register eHCA device driver");
  900. ret = -EINVAL;
  901. goto module_init3;
  902. }
  903. ret = register_memory_notifier(&ehca_mem_nb);
  904. if (ret) {
  905. ehca_gen_err("Failed registering memory add/remove notifier");
  906. goto module_init4;
  907. }
  908. if (ehca_poll_all_eqs != 1) {
  909. ehca_gen_err("WARNING!!!");
  910. ehca_gen_err("It is possible to lose interrupts.");
  911. } else {
  912. init_timer(&poll_eqs_timer);
  913. poll_eqs_timer.function = ehca_poll_eqs;
  914. poll_eqs_timer.expires = jiffies + HZ;
  915. add_timer(&poll_eqs_timer);
  916. }
  917. return 0;
  918. module_init4:
  919. ibmebus_unregister_driver(&ehca_driver);
  920. module_init3:
  921. ehca_destroy_busmap();
  922. module_init2:
  923. ehca_destroy_slab_caches();
  924. module_init1:
  925. ehca_destroy_comp_pool();
  926. return ret;
  927. };
  928. static void __exit ehca_module_exit(void)
  929. {
  930. if (ehca_poll_all_eqs == 1)
  931. del_timer_sync(&poll_eqs_timer);
  932. ibmebus_unregister_driver(&ehca_driver);
  933. unregister_memory_notifier(&ehca_mem_nb);
  934. ehca_destroy_busmap();
  935. ehca_destroy_slab_caches();
  936. ehca_destroy_comp_pool();
  937. idr_destroy(&ehca_cq_idr);
  938. idr_destroy(&ehca_qp_idr);
  939. };
  940. module_init(ehca_module_init);
  941. module_exit(ehca_module_exit);