ocrdma_main.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577
  1. /*******************************************************************
  2. * This file is part of the Emulex RoCE Device Driver for *
  3. * RoCE (RDMA over Converged Ethernet) adapters. *
  4. * Copyright (C) 2008-2012 Emulex. All rights reserved. *
  5. * EMULEX and SLI are trademarks of Emulex. *
  6. * www.emulex.com *
  7. * *
  8. * This program is free software; you can redistribute it and/or *
  9. * modify it under the terms of version 2 of the GNU General *
  10. * Public License as published by the Free Software Foundation. *
  11. * This program is distributed in the hope that it will be useful. *
  12. * ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND *
  13. * WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY, *
  14. * FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT, ARE *
  15. * DISCLAIMED, EXCEPT TO THE EXTENT THAT SUCH DISCLAIMERS ARE HELD *
  16. * TO BE LEGALLY INVALID. See the GNU General Public License for *
  17. * more details, a copy of which can be found in the file COPYING *
  18. * included with this package. *
  19. *
  20. * Contact Information:
  21. * linux-drivers@emulex.com
  22. *
  23. * Emulex
  24. * 3333 Susan Street
  25. * Costa Mesa, CA 92626
  26. *******************************************************************/
  27. #include <linux/module.h>
  28. #include <linux/version.h>
  29. #include <linux/idr.h>
  30. #include <rdma/ib_verbs.h>
  31. #include <rdma/ib_user_verbs.h>
  32. #include <rdma/ib_addr.h>
  33. #include <linux/netdevice.h>
  34. #include <net/addrconf.h>
  35. #include "ocrdma.h"
  36. #include "ocrdma_verbs.h"
  37. #include "ocrdma_ah.h"
  38. #include "be_roce.h"
  39. #include "ocrdma_hw.h"
  40. MODULE_VERSION(OCRDMA_ROCE_DEV_VERSION);
  41. MODULE_DESCRIPTION("Emulex RoCE HCA Driver");
  42. MODULE_AUTHOR("Emulex Corporation");
  43. MODULE_LICENSE("GPL");
  44. static LIST_HEAD(ocrdma_dev_list);
  45. static DEFINE_SPINLOCK(ocrdma_devlist_lock);
  46. static DEFINE_IDR(ocrdma_dev_id);
  47. static union ib_gid ocrdma_zero_sgid;
  48. static int ocrdma_get_instance(void)
  49. {
  50. int instance = 0;
  51. /* Assign an unused number */
  52. if (!idr_pre_get(&ocrdma_dev_id, GFP_KERNEL))
  53. return -1;
  54. if (idr_get_new(&ocrdma_dev_id, NULL, &instance))
  55. return -1;
  56. return instance;
  57. }
  58. void ocrdma_get_guid(struct ocrdma_dev *dev, u8 *guid)
  59. {
  60. u8 mac_addr[6];
  61. memcpy(&mac_addr[0], &dev->nic_info.mac_addr[0], ETH_ALEN);
  62. guid[0] = mac_addr[0] ^ 2;
  63. guid[1] = mac_addr[1];
  64. guid[2] = mac_addr[2];
  65. guid[3] = 0xff;
  66. guid[4] = 0xfe;
  67. guid[5] = mac_addr[3];
  68. guid[6] = mac_addr[4];
  69. guid[7] = mac_addr[5];
  70. }
  71. static void ocrdma_build_sgid_mac(union ib_gid *sgid, unsigned char *mac_addr,
  72. bool is_vlan, u16 vlan_id)
  73. {
  74. sgid->global.subnet_prefix = cpu_to_be64(0xfe80000000000000LL);
  75. sgid->raw[8] = mac_addr[0] ^ 2;
  76. sgid->raw[9] = mac_addr[1];
  77. sgid->raw[10] = mac_addr[2];
  78. if (is_vlan) {
  79. sgid->raw[11] = vlan_id >> 8;
  80. sgid->raw[12] = vlan_id & 0xff;
  81. } else {
  82. sgid->raw[11] = 0xff;
  83. sgid->raw[12] = 0xfe;
  84. }
  85. sgid->raw[13] = mac_addr[3];
  86. sgid->raw[14] = mac_addr[4];
  87. sgid->raw[15] = mac_addr[5];
  88. }
  89. static void ocrdma_add_sgid(struct ocrdma_dev *dev, unsigned char *mac_addr,
  90. bool is_vlan, u16 vlan_id)
  91. {
  92. int i;
  93. bool found = false;
  94. union ib_gid new_sgid;
  95. int free_idx = OCRDMA_MAX_SGID;
  96. unsigned long flags;
  97. memset(&ocrdma_zero_sgid, 0, sizeof(union ib_gid));
  98. ocrdma_build_sgid_mac(&new_sgid, mac_addr, is_vlan, vlan_id);
  99. spin_lock_irqsave(&dev->sgid_lock, flags);
  100. for (i = 0; i < OCRDMA_MAX_SGID; i++) {
  101. if (!memcmp(&dev->sgid_tbl[i], &ocrdma_zero_sgid,
  102. sizeof(union ib_gid))) {
  103. /* found free entry */
  104. if (!found) {
  105. free_idx = i;
  106. found = true;
  107. break;
  108. }
  109. } else if (!memcmp(&dev->sgid_tbl[i], &new_sgid,
  110. sizeof(union ib_gid))) {
  111. /* entry already present, no addition is required. */
  112. spin_unlock_irqrestore(&dev->sgid_lock, flags);
  113. return;
  114. }
  115. }
  116. /* if entry doesn't exist and if table has some space, add entry */
  117. if (found)
  118. memcpy(&dev->sgid_tbl[free_idx], &new_sgid,
  119. sizeof(union ib_gid));
  120. spin_unlock_irqrestore(&dev->sgid_lock, flags);
  121. }
  122. static bool ocrdma_del_sgid(struct ocrdma_dev *dev, unsigned char *mac_addr,
  123. bool is_vlan, u16 vlan_id)
  124. {
  125. int found = false;
  126. int i;
  127. union ib_gid sgid;
  128. unsigned long flags;
  129. ocrdma_build_sgid_mac(&sgid, mac_addr, is_vlan, vlan_id);
  130. spin_lock_irqsave(&dev->sgid_lock, flags);
  131. /* first is default sgid, which cannot be deleted. */
  132. for (i = 1; i < OCRDMA_MAX_SGID; i++) {
  133. if (!memcmp(&dev->sgid_tbl[i], &sgid, sizeof(union ib_gid))) {
  134. /* found matching entry */
  135. memset(&dev->sgid_tbl[i], 0, sizeof(union ib_gid));
  136. found = true;
  137. break;
  138. }
  139. }
  140. spin_unlock_irqrestore(&dev->sgid_lock, flags);
  141. return found;
  142. }
  143. static void ocrdma_add_default_sgid(struct ocrdma_dev *dev)
  144. {
  145. /* GID Index 0 - Invariant manufacturer-assigned EUI-64 */
  146. union ib_gid *sgid = &dev->sgid_tbl[0];
  147. sgid->global.subnet_prefix = cpu_to_be64(0xfe80000000000000LL);
  148. ocrdma_get_guid(dev, &sgid->raw[8]);
  149. }
  150. static int ocrdma_build_sgid_tbl(struct ocrdma_dev *dev)
  151. {
  152. struct net_device *netdev, *tmp;
  153. u16 vlan_id;
  154. bool is_vlan;
  155. netdev = dev->nic_info.netdev;
  156. ocrdma_add_default_sgid(dev);
  157. rcu_read_lock();
  158. for_each_netdev_rcu(&init_net, tmp) {
  159. if (netdev == tmp || vlan_dev_real_dev(tmp) == netdev) {
  160. if (!netif_running(tmp) || !netif_oper_up(tmp))
  161. continue;
  162. if (netdev != tmp) {
  163. vlan_id = vlan_dev_vlan_id(tmp);
  164. is_vlan = true;
  165. } else {
  166. is_vlan = false;
  167. vlan_id = 0;
  168. tmp = netdev;
  169. }
  170. ocrdma_add_sgid(dev, tmp->dev_addr, is_vlan, vlan_id);
  171. }
  172. }
  173. rcu_read_unlock();
  174. return 0;
  175. }
  176. #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
  177. static int ocrdma_inet6addr_event(struct notifier_block *notifier,
  178. unsigned long event, void *ptr)
  179. {
  180. struct inet6_ifaddr *ifa = (struct inet6_ifaddr *)ptr;
  181. struct net_device *event_netdev = ifa->idev->dev;
  182. struct net_device *netdev = NULL;
  183. struct ib_event gid_event;
  184. struct ocrdma_dev *dev;
  185. bool found = false;
  186. bool is_vlan = false;
  187. u16 vid = 0;
  188. netdev = vlan_dev_real_dev(event_netdev);
  189. if (netdev != event_netdev) {
  190. is_vlan = true;
  191. vid = vlan_dev_vlan_id(event_netdev);
  192. }
  193. rcu_read_lock();
  194. list_for_each_entry_rcu(dev, &ocrdma_dev_list, entry) {
  195. if (dev->nic_info.netdev == netdev) {
  196. found = true;
  197. break;
  198. }
  199. }
  200. rcu_read_unlock();
  201. if (!found)
  202. return NOTIFY_DONE;
  203. if (!rdma_link_local_addr((struct in6_addr *)&ifa->addr))
  204. return NOTIFY_DONE;
  205. mutex_lock(&dev->dev_lock);
  206. switch (event) {
  207. case NETDEV_UP:
  208. ocrdma_add_sgid(dev, netdev->dev_addr, is_vlan, vid);
  209. break;
  210. case NETDEV_DOWN:
  211. found = ocrdma_del_sgid(dev, netdev->dev_addr, is_vlan, vid);
  212. if (found) {
  213. /* found the matching entry, notify
  214. * the consumers about it
  215. */
  216. gid_event.device = &dev->ibdev;
  217. gid_event.element.port_num = 1;
  218. gid_event.event = IB_EVENT_GID_CHANGE;
  219. ib_dispatch_event(&gid_event);
  220. }
  221. break;
  222. default:
  223. break;
  224. }
  225. mutex_unlock(&dev->dev_lock);
  226. return NOTIFY_OK;
  227. }
  228. static struct notifier_block ocrdma_inet6addr_notifier = {
  229. .notifier_call = ocrdma_inet6addr_event
  230. };
  231. #endif /* IPV6 */
  232. static enum rdma_link_layer ocrdma_link_layer(struct ib_device *device,
  233. u8 port_num)
  234. {
  235. return IB_LINK_LAYER_ETHERNET;
  236. }
  237. static int ocrdma_register_device(struct ocrdma_dev *dev)
  238. {
  239. strlcpy(dev->ibdev.name, "ocrdma%d", IB_DEVICE_NAME_MAX);
  240. ocrdma_get_guid(dev, (u8 *)&dev->ibdev.node_guid);
  241. memcpy(dev->ibdev.node_desc, OCRDMA_NODE_DESC,
  242. sizeof(OCRDMA_NODE_DESC));
  243. dev->ibdev.owner = THIS_MODULE;
  244. dev->ibdev.uverbs_cmd_mask =
  245. OCRDMA_UVERBS(GET_CONTEXT) |
  246. OCRDMA_UVERBS(QUERY_DEVICE) |
  247. OCRDMA_UVERBS(QUERY_PORT) |
  248. OCRDMA_UVERBS(ALLOC_PD) |
  249. OCRDMA_UVERBS(DEALLOC_PD) |
  250. OCRDMA_UVERBS(REG_MR) |
  251. OCRDMA_UVERBS(DEREG_MR) |
  252. OCRDMA_UVERBS(CREATE_COMP_CHANNEL) |
  253. OCRDMA_UVERBS(CREATE_CQ) |
  254. OCRDMA_UVERBS(RESIZE_CQ) |
  255. OCRDMA_UVERBS(DESTROY_CQ) |
  256. OCRDMA_UVERBS(REQ_NOTIFY_CQ) |
  257. OCRDMA_UVERBS(CREATE_QP) |
  258. OCRDMA_UVERBS(MODIFY_QP) |
  259. OCRDMA_UVERBS(QUERY_QP) |
  260. OCRDMA_UVERBS(DESTROY_QP) |
  261. OCRDMA_UVERBS(POLL_CQ) |
  262. OCRDMA_UVERBS(POST_SEND) |
  263. OCRDMA_UVERBS(POST_RECV);
  264. dev->ibdev.uverbs_cmd_mask |=
  265. OCRDMA_UVERBS(CREATE_AH) |
  266. OCRDMA_UVERBS(MODIFY_AH) |
  267. OCRDMA_UVERBS(QUERY_AH) |
  268. OCRDMA_UVERBS(DESTROY_AH);
  269. dev->ibdev.node_type = RDMA_NODE_IB_CA;
  270. dev->ibdev.phys_port_cnt = 1;
  271. dev->ibdev.num_comp_vectors = 1;
  272. /* mandatory verbs. */
  273. dev->ibdev.query_device = ocrdma_query_device;
  274. dev->ibdev.query_port = ocrdma_query_port;
  275. dev->ibdev.modify_port = ocrdma_modify_port;
  276. dev->ibdev.query_gid = ocrdma_query_gid;
  277. dev->ibdev.get_link_layer = ocrdma_link_layer;
  278. dev->ibdev.alloc_pd = ocrdma_alloc_pd;
  279. dev->ibdev.dealloc_pd = ocrdma_dealloc_pd;
  280. dev->ibdev.create_cq = ocrdma_create_cq;
  281. dev->ibdev.destroy_cq = ocrdma_destroy_cq;
  282. dev->ibdev.resize_cq = ocrdma_resize_cq;
  283. dev->ibdev.create_qp = ocrdma_create_qp;
  284. dev->ibdev.modify_qp = ocrdma_modify_qp;
  285. dev->ibdev.query_qp = ocrdma_query_qp;
  286. dev->ibdev.destroy_qp = ocrdma_destroy_qp;
  287. dev->ibdev.query_pkey = ocrdma_query_pkey;
  288. dev->ibdev.create_ah = ocrdma_create_ah;
  289. dev->ibdev.destroy_ah = ocrdma_destroy_ah;
  290. dev->ibdev.query_ah = ocrdma_query_ah;
  291. dev->ibdev.modify_ah = ocrdma_modify_ah;
  292. dev->ibdev.poll_cq = ocrdma_poll_cq;
  293. dev->ibdev.post_send = ocrdma_post_send;
  294. dev->ibdev.post_recv = ocrdma_post_recv;
  295. dev->ibdev.req_notify_cq = ocrdma_arm_cq;
  296. dev->ibdev.get_dma_mr = ocrdma_get_dma_mr;
  297. dev->ibdev.dereg_mr = ocrdma_dereg_mr;
  298. dev->ibdev.reg_user_mr = ocrdma_reg_user_mr;
  299. /* mandatory to support user space verbs consumer. */
  300. dev->ibdev.alloc_ucontext = ocrdma_alloc_ucontext;
  301. dev->ibdev.dealloc_ucontext = ocrdma_dealloc_ucontext;
  302. dev->ibdev.mmap = ocrdma_mmap;
  303. dev->ibdev.dma_device = &dev->nic_info.pdev->dev;
  304. dev->ibdev.process_mad = ocrdma_process_mad;
  305. if (dev->nic_info.dev_family == OCRDMA_GEN2_FAMILY) {
  306. dev->ibdev.uverbs_cmd_mask |=
  307. OCRDMA_UVERBS(CREATE_SRQ) |
  308. OCRDMA_UVERBS(MODIFY_SRQ) |
  309. OCRDMA_UVERBS(QUERY_SRQ) |
  310. OCRDMA_UVERBS(DESTROY_SRQ) |
  311. OCRDMA_UVERBS(POST_SRQ_RECV);
  312. dev->ibdev.create_srq = ocrdma_create_srq;
  313. dev->ibdev.modify_srq = ocrdma_modify_srq;
  314. dev->ibdev.query_srq = ocrdma_query_srq;
  315. dev->ibdev.destroy_srq = ocrdma_destroy_srq;
  316. dev->ibdev.post_srq_recv = ocrdma_post_srq_recv;
  317. }
  318. return ib_register_device(&dev->ibdev, NULL);
  319. }
  320. static int ocrdma_alloc_resources(struct ocrdma_dev *dev)
  321. {
  322. mutex_init(&dev->dev_lock);
  323. dev->sgid_tbl = kzalloc(sizeof(union ib_gid) *
  324. OCRDMA_MAX_SGID, GFP_KERNEL);
  325. if (!dev->sgid_tbl)
  326. goto alloc_err;
  327. spin_lock_init(&dev->sgid_lock);
  328. dev->cq_tbl = kzalloc(sizeof(struct ocrdma_cq *) *
  329. OCRDMA_MAX_CQ, GFP_KERNEL);
  330. if (!dev->cq_tbl)
  331. goto alloc_err;
  332. if (dev->attr.max_qp) {
  333. dev->qp_tbl = kzalloc(sizeof(struct ocrdma_qp *) *
  334. OCRDMA_MAX_QP, GFP_KERNEL);
  335. if (!dev->qp_tbl)
  336. goto alloc_err;
  337. }
  338. spin_lock_init(&dev->av_tbl.lock);
  339. spin_lock_init(&dev->flush_q_lock);
  340. return 0;
  341. alloc_err:
  342. ocrdma_err("%s(%d) error.\n", __func__, dev->id);
  343. return -ENOMEM;
  344. }
  345. static void ocrdma_free_resources(struct ocrdma_dev *dev)
  346. {
  347. kfree(dev->qp_tbl);
  348. kfree(dev->cq_tbl);
  349. kfree(dev->sgid_tbl);
  350. }
  351. static struct ocrdma_dev *ocrdma_add(struct be_dev_info *dev_info)
  352. {
  353. int status = 0;
  354. struct ocrdma_dev *dev;
  355. dev = (struct ocrdma_dev *)ib_alloc_device(sizeof(struct ocrdma_dev));
  356. if (!dev) {
  357. ocrdma_err("Unable to allocate ib device\n");
  358. return NULL;
  359. }
  360. dev->mbx_cmd = kzalloc(sizeof(struct ocrdma_mqe_emb_cmd), GFP_KERNEL);
  361. if (!dev->mbx_cmd)
  362. goto idr_err;
  363. memcpy(&dev->nic_info, dev_info, sizeof(*dev_info));
  364. dev->id = ocrdma_get_instance();
  365. if (dev->id < 0)
  366. goto idr_err;
  367. status = ocrdma_init_hw(dev);
  368. if (status)
  369. goto init_err;
  370. status = ocrdma_alloc_resources(dev);
  371. if (status)
  372. goto alloc_err;
  373. status = ocrdma_build_sgid_tbl(dev);
  374. if (status)
  375. goto alloc_err;
  376. status = ocrdma_register_device(dev);
  377. if (status)
  378. goto alloc_err;
  379. spin_lock(&ocrdma_devlist_lock);
  380. list_add_tail_rcu(&dev->entry, &ocrdma_dev_list);
  381. spin_unlock(&ocrdma_devlist_lock);
  382. return dev;
  383. alloc_err:
  384. ocrdma_free_resources(dev);
  385. ocrdma_cleanup_hw(dev);
  386. init_err:
  387. idr_remove(&ocrdma_dev_id, dev->id);
  388. idr_err:
  389. kfree(dev->mbx_cmd);
  390. ib_dealloc_device(&dev->ibdev);
  391. ocrdma_err("%s() leaving. ret=%d\n", __func__, status);
  392. return NULL;
  393. }
  394. static void ocrdma_remove_free(struct rcu_head *rcu)
  395. {
  396. struct ocrdma_dev *dev = container_of(rcu, struct ocrdma_dev, rcu);
  397. ocrdma_free_resources(dev);
  398. ocrdma_cleanup_hw(dev);
  399. idr_remove(&ocrdma_dev_id, dev->id);
  400. kfree(dev->mbx_cmd);
  401. ib_dealloc_device(&dev->ibdev);
  402. }
  403. static void ocrdma_remove(struct ocrdma_dev *dev)
  404. {
  405. /* first unregister with stack to stop all the active traffic
  406. * of the registered clients.
  407. */
  408. ib_unregister_device(&dev->ibdev);
  409. spin_lock(&ocrdma_devlist_lock);
  410. list_del_rcu(&dev->entry);
  411. spin_unlock(&ocrdma_devlist_lock);
  412. call_rcu(&dev->rcu, ocrdma_remove_free);
  413. }
  414. static int ocrdma_open(struct ocrdma_dev *dev)
  415. {
  416. struct ib_event port_event;
  417. port_event.event = IB_EVENT_PORT_ACTIVE;
  418. port_event.element.port_num = 1;
  419. port_event.device = &dev->ibdev;
  420. ib_dispatch_event(&port_event);
  421. return 0;
  422. }
  423. static int ocrdma_close(struct ocrdma_dev *dev)
  424. {
  425. int i;
  426. struct ocrdma_qp *qp, **cur_qp;
  427. struct ib_event err_event;
  428. struct ib_qp_attr attrs;
  429. int attr_mask = IB_QP_STATE;
  430. attrs.qp_state = IB_QPS_ERR;
  431. mutex_lock(&dev->dev_lock);
  432. if (dev->qp_tbl) {
  433. cur_qp = dev->qp_tbl;
  434. for (i = 0; i < OCRDMA_MAX_QP; i++) {
  435. qp = cur_qp[i];
  436. if (qp) {
  437. /* change the QP state to ERROR */
  438. _ocrdma_modify_qp(&qp->ibqp, &attrs, attr_mask);
  439. err_event.event = IB_EVENT_QP_FATAL;
  440. err_event.element.qp = &qp->ibqp;
  441. err_event.device = &dev->ibdev;
  442. ib_dispatch_event(&err_event);
  443. }
  444. }
  445. }
  446. mutex_unlock(&dev->dev_lock);
  447. err_event.event = IB_EVENT_PORT_ERR;
  448. err_event.element.port_num = 1;
  449. err_event.device = &dev->ibdev;
  450. ib_dispatch_event(&err_event);
  451. return 0;
  452. }
  453. /* event handling via NIC driver ensures that all the NIC specific
  454. * initialization done before RoCE driver notifies
  455. * event to stack.
  456. */
  457. static void ocrdma_event_handler(struct ocrdma_dev *dev, u32 event)
  458. {
  459. switch (event) {
  460. case BE_DEV_UP:
  461. ocrdma_open(dev);
  462. break;
  463. case BE_DEV_DOWN:
  464. ocrdma_close(dev);
  465. break;
  466. };
  467. }
  468. static struct ocrdma_driver ocrdma_drv = {
  469. .name = "ocrdma_driver",
  470. .add = ocrdma_add,
  471. .remove = ocrdma_remove,
  472. .state_change_handler = ocrdma_event_handler,
  473. };
  474. static void ocrdma_unregister_inet6addr_notifier(void)
  475. {
  476. #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
  477. unregister_inet6addr_notifier(&ocrdma_inet6addr_notifier);
  478. #endif
  479. }
  480. static int __init ocrdma_init_module(void)
  481. {
  482. int status;
  483. #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
  484. status = register_inet6addr_notifier(&ocrdma_inet6addr_notifier);
  485. if (status)
  486. return status;
  487. #endif
  488. status = be_roce_register_driver(&ocrdma_drv);
  489. if (status)
  490. ocrdma_unregister_inet6addr_notifier();
  491. return status;
  492. }
  493. static void __exit ocrdma_exit_module(void)
  494. {
  495. be_roce_unregister_driver(&ocrdma_drv);
  496. ocrdma_unregister_inet6addr_notifier();
  497. }
  498. module_init(ocrdma_init_module);
  499. module_exit(ocrdma_exit_module);