ocrdma_main.c 15 KB

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