ipoib_main.c 31 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277
  1. /*
  2. * Copyright (c) 2004 Topspin Communications. All rights reserved.
  3. * Copyright (c) 2005 Sun Microsystems, Inc. All rights reserved.
  4. * Copyright (c) 2004 Voltaire, Inc. All rights reserved.
  5. *
  6. * This software is available to you under a choice of one of two
  7. * licenses. You may choose to be licensed under the terms of the GNU
  8. * General Public License (GPL) Version 2, available from the file
  9. * COPYING in the main directory of this source tree, or the
  10. * OpenIB.org BSD license below:
  11. *
  12. * Redistribution and use in source and binary forms, with or
  13. * without modification, are permitted provided that the following
  14. * conditions are met:
  15. *
  16. * - Redistributions of source code must retain the above
  17. * copyright notice, this list of conditions and the following
  18. * disclaimer.
  19. *
  20. * - Redistributions in binary form must reproduce the above
  21. * copyright notice, this list of conditions and the following
  22. * disclaimer in the documentation and/or other materials
  23. * provided with the distribution.
  24. *
  25. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  26. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  27. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  28. * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  29. * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  30. * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  31. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  32. * SOFTWARE.
  33. *
  34. * $Id: ipoib_main.c 1377 2004-12-23 19:57:12Z roland $
  35. */
  36. #include "ipoib.h"
  37. #include <linux/module.h>
  38. #include <linux/init.h>
  39. #include <linux/slab.h>
  40. #include <linux/kernel.h>
  41. #include <linux/if_arp.h> /* For ARPHRD_xxx */
  42. #include <linux/ip.h>
  43. #include <linux/in.h>
  44. #include <net/dst.h>
  45. MODULE_AUTHOR("Roland Dreier");
  46. MODULE_DESCRIPTION("IP-over-InfiniBand net driver");
  47. MODULE_LICENSE("Dual BSD/GPL");
  48. int ipoib_sendq_size __read_mostly = IPOIB_TX_RING_SIZE;
  49. int ipoib_recvq_size __read_mostly = IPOIB_RX_RING_SIZE;
  50. module_param_named(send_queue_size, ipoib_sendq_size, int, 0444);
  51. MODULE_PARM_DESC(send_queue_size, "Number of descriptors in send queue");
  52. module_param_named(recv_queue_size, ipoib_recvq_size, int, 0444);
  53. MODULE_PARM_DESC(recv_queue_size, "Number of descriptors in receive queue");
  54. #ifdef CONFIG_INFINIBAND_IPOIB_DEBUG
  55. int ipoib_debug_level;
  56. module_param_named(debug_level, ipoib_debug_level, int, 0644);
  57. MODULE_PARM_DESC(debug_level, "Enable debug tracing if > 0");
  58. #endif
  59. struct ipoib_path_iter {
  60. struct net_device *dev;
  61. struct ipoib_path path;
  62. };
  63. static const u8 ipv4_bcast_addr[] = {
  64. 0x00, 0xff, 0xff, 0xff,
  65. 0xff, 0x12, 0x40, 0x1b, 0x00, 0x00, 0x00, 0x00,
  66. 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff
  67. };
  68. struct workqueue_struct *ipoib_workqueue;
  69. struct ib_sa_client ipoib_sa_client;
  70. static void ipoib_add_one(struct ib_device *device);
  71. static void ipoib_remove_one(struct ib_device *device);
  72. static struct ib_client ipoib_client = {
  73. .name = "ipoib",
  74. .add = ipoib_add_one,
  75. .remove = ipoib_remove_one
  76. };
  77. int ipoib_open(struct net_device *dev)
  78. {
  79. struct ipoib_dev_priv *priv = netdev_priv(dev);
  80. ipoib_dbg(priv, "bringing up interface\n");
  81. set_bit(IPOIB_FLAG_ADMIN_UP, &priv->flags);
  82. if (ipoib_pkey_dev_delay_open(dev))
  83. return 0;
  84. if (ipoib_ib_dev_open(dev))
  85. return -EINVAL;
  86. if (ipoib_ib_dev_up(dev)) {
  87. ipoib_ib_dev_stop(dev);
  88. return -EINVAL;
  89. }
  90. if (!test_bit(IPOIB_FLAG_SUBINTERFACE, &priv->flags)) {
  91. struct ipoib_dev_priv *cpriv;
  92. /* Bring up any child interfaces too */
  93. mutex_lock(&priv->vlan_mutex);
  94. list_for_each_entry(cpriv, &priv->child_intfs, list) {
  95. int flags;
  96. flags = cpriv->dev->flags;
  97. if (flags & IFF_UP)
  98. continue;
  99. dev_change_flags(cpriv->dev, flags | IFF_UP);
  100. }
  101. mutex_unlock(&priv->vlan_mutex);
  102. }
  103. netif_start_queue(dev);
  104. return 0;
  105. }
  106. static int ipoib_stop(struct net_device *dev)
  107. {
  108. struct ipoib_dev_priv *priv = netdev_priv(dev);
  109. ipoib_dbg(priv, "stopping interface\n");
  110. clear_bit(IPOIB_FLAG_ADMIN_UP, &priv->flags);
  111. netif_stop_queue(dev);
  112. clear_bit(IPOIB_FLAG_NETIF_STOPPED, &priv->flags);
  113. /*
  114. * Now flush workqueue to make sure a scheduled task doesn't
  115. * bring our internal state back up.
  116. */
  117. flush_workqueue(ipoib_workqueue);
  118. ipoib_ib_dev_down(dev, 1);
  119. ipoib_ib_dev_stop(dev);
  120. if (!test_bit(IPOIB_FLAG_SUBINTERFACE, &priv->flags)) {
  121. struct ipoib_dev_priv *cpriv;
  122. /* Bring down any child interfaces too */
  123. mutex_lock(&priv->vlan_mutex);
  124. list_for_each_entry(cpriv, &priv->child_intfs, list) {
  125. int flags;
  126. flags = cpriv->dev->flags;
  127. if (!(flags & IFF_UP))
  128. continue;
  129. dev_change_flags(cpriv->dev, flags & ~IFF_UP);
  130. }
  131. mutex_unlock(&priv->vlan_mutex);
  132. }
  133. return 0;
  134. }
  135. static int ipoib_change_mtu(struct net_device *dev, int new_mtu)
  136. {
  137. struct ipoib_dev_priv *priv = netdev_priv(dev);
  138. /* dev->mtu > 2K ==> connected mode */
  139. if (ipoib_cm_admin_enabled(dev) && new_mtu <= IPOIB_CM_MTU) {
  140. if (new_mtu > priv->mcast_mtu)
  141. ipoib_warn(priv, "mtu > %d will cause multicast packet drops.\n",
  142. priv->mcast_mtu);
  143. dev->mtu = new_mtu;
  144. return 0;
  145. }
  146. if (new_mtu > IPOIB_PACKET_SIZE - IPOIB_ENCAP_LEN) {
  147. return -EINVAL;
  148. }
  149. priv->admin_mtu = new_mtu;
  150. dev->mtu = min(priv->mcast_mtu, priv->admin_mtu);
  151. return 0;
  152. }
  153. static struct ipoib_path *__path_find(struct net_device *dev, void *gid)
  154. {
  155. struct ipoib_dev_priv *priv = netdev_priv(dev);
  156. struct rb_node *n = priv->path_tree.rb_node;
  157. struct ipoib_path *path;
  158. int ret;
  159. while (n) {
  160. path = rb_entry(n, struct ipoib_path, rb_node);
  161. ret = memcmp(gid, path->pathrec.dgid.raw,
  162. sizeof (union ib_gid));
  163. if (ret < 0)
  164. n = n->rb_left;
  165. else if (ret > 0)
  166. n = n->rb_right;
  167. else
  168. return path;
  169. }
  170. return NULL;
  171. }
  172. static int __path_add(struct net_device *dev, struct ipoib_path *path)
  173. {
  174. struct ipoib_dev_priv *priv = netdev_priv(dev);
  175. struct rb_node **n = &priv->path_tree.rb_node;
  176. struct rb_node *pn = NULL;
  177. struct ipoib_path *tpath;
  178. int ret;
  179. while (*n) {
  180. pn = *n;
  181. tpath = rb_entry(pn, struct ipoib_path, rb_node);
  182. ret = memcmp(path->pathrec.dgid.raw, tpath->pathrec.dgid.raw,
  183. sizeof (union ib_gid));
  184. if (ret < 0)
  185. n = &pn->rb_left;
  186. else if (ret > 0)
  187. n = &pn->rb_right;
  188. else
  189. return -EEXIST;
  190. }
  191. rb_link_node(&path->rb_node, pn, n);
  192. rb_insert_color(&path->rb_node, &priv->path_tree);
  193. list_add_tail(&path->list, &priv->path_list);
  194. return 0;
  195. }
  196. static void path_free(struct net_device *dev, struct ipoib_path *path)
  197. {
  198. struct ipoib_dev_priv *priv = netdev_priv(dev);
  199. struct ipoib_neigh *neigh, *tn;
  200. struct sk_buff *skb;
  201. unsigned long flags;
  202. while ((skb = __skb_dequeue(&path->queue)))
  203. dev_kfree_skb_irq(skb);
  204. spin_lock_irqsave(&priv->lock, flags);
  205. list_for_each_entry_safe(neigh, tn, &path->neigh_list, list) {
  206. /*
  207. * It's safe to call ipoib_put_ah() inside priv->lock
  208. * here, because we know that path->ah will always
  209. * hold one more reference, so ipoib_put_ah() will
  210. * never do more than decrement the ref count.
  211. */
  212. if (neigh->ah)
  213. ipoib_put_ah(neigh->ah);
  214. ipoib_neigh_free(dev, neigh);
  215. }
  216. spin_unlock_irqrestore(&priv->lock, flags);
  217. if (path->ah)
  218. ipoib_put_ah(path->ah);
  219. kfree(path);
  220. }
  221. #ifdef CONFIG_INFINIBAND_IPOIB_DEBUG
  222. struct ipoib_path_iter *ipoib_path_iter_init(struct net_device *dev)
  223. {
  224. struct ipoib_path_iter *iter;
  225. iter = kmalloc(sizeof *iter, GFP_KERNEL);
  226. if (!iter)
  227. return NULL;
  228. iter->dev = dev;
  229. memset(iter->path.pathrec.dgid.raw, 0, 16);
  230. if (ipoib_path_iter_next(iter)) {
  231. kfree(iter);
  232. return NULL;
  233. }
  234. return iter;
  235. }
  236. int ipoib_path_iter_next(struct ipoib_path_iter *iter)
  237. {
  238. struct ipoib_dev_priv *priv = netdev_priv(iter->dev);
  239. struct rb_node *n;
  240. struct ipoib_path *path;
  241. int ret = 1;
  242. spin_lock_irq(&priv->lock);
  243. n = rb_first(&priv->path_tree);
  244. while (n) {
  245. path = rb_entry(n, struct ipoib_path, rb_node);
  246. if (memcmp(iter->path.pathrec.dgid.raw, path->pathrec.dgid.raw,
  247. sizeof (union ib_gid)) < 0) {
  248. iter->path = *path;
  249. ret = 0;
  250. break;
  251. }
  252. n = rb_next(n);
  253. }
  254. spin_unlock_irq(&priv->lock);
  255. return ret;
  256. }
  257. void ipoib_path_iter_read(struct ipoib_path_iter *iter,
  258. struct ipoib_path *path)
  259. {
  260. *path = iter->path;
  261. }
  262. #endif /* CONFIG_INFINIBAND_IPOIB_DEBUG */
  263. void ipoib_flush_paths(struct net_device *dev)
  264. {
  265. struct ipoib_dev_priv *priv = netdev_priv(dev);
  266. struct ipoib_path *path, *tp;
  267. LIST_HEAD(remove_list);
  268. spin_lock_irq(&priv->tx_lock);
  269. spin_lock(&priv->lock);
  270. list_splice(&priv->path_list, &remove_list);
  271. INIT_LIST_HEAD(&priv->path_list);
  272. list_for_each_entry(path, &remove_list, list)
  273. rb_erase(&path->rb_node, &priv->path_tree);
  274. list_for_each_entry_safe(path, tp, &remove_list, list) {
  275. if (path->query)
  276. ib_sa_cancel_query(path->query_id, path->query);
  277. spin_unlock(&priv->lock);
  278. spin_unlock_irq(&priv->tx_lock);
  279. wait_for_completion(&path->done);
  280. path_free(dev, path);
  281. spin_lock_irq(&priv->tx_lock);
  282. spin_lock(&priv->lock);
  283. }
  284. spin_unlock(&priv->lock);
  285. spin_unlock_irq(&priv->tx_lock);
  286. }
  287. static void path_rec_completion(int status,
  288. struct ib_sa_path_rec *pathrec,
  289. void *path_ptr)
  290. {
  291. struct ipoib_path *path = path_ptr;
  292. struct net_device *dev = path->dev;
  293. struct ipoib_dev_priv *priv = netdev_priv(dev);
  294. struct ipoib_ah *ah = NULL;
  295. struct ipoib_neigh *neigh, *tn;
  296. struct sk_buff_head skqueue;
  297. struct sk_buff *skb;
  298. unsigned long flags;
  299. if (!status)
  300. ipoib_dbg(priv, "PathRec LID 0x%04x for GID " IPOIB_GID_FMT "\n",
  301. be16_to_cpu(pathrec->dlid), IPOIB_GID_ARG(pathrec->dgid));
  302. else
  303. ipoib_dbg(priv, "PathRec status %d for GID " IPOIB_GID_FMT "\n",
  304. status, IPOIB_GID_ARG(path->pathrec.dgid));
  305. skb_queue_head_init(&skqueue);
  306. if (!status) {
  307. struct ib_ah_attr av = {
  308. .dlid = be16_to_cpu(pathrec->dlid),
  309. .sl = pathrec->sl,
  310. .port_num = priv->port,
  311. .static_rate = pathrec->rate
  312. };
  313. ah = ipoib_create_ah(dev, priv->pd, &av);
  314. }
  315. spin_lock_irqsave(&priv->lock, flags);
  316. path->ah = ah;
  317. if (ah) {
  318. path->pathrec = *pathrec;
  319. ipoib_dbg(priv, "created address handle %p for LID 0x%04x, SL %d\n",
  320. ah, be16_to_cpu(pathrec->dlid), pathrec->sl);
  321. while ((skb = __skb_dequeue(&path->queue)))
  322. __skb_queue_tail(&skqueue, skb);
  323. list_for_each_entry_safe(neigh, tn, &path->neigh_list, list) {
  324. kref_get(&path->ah->ref);
  325. neigh->ah = path->ah;
  326. memcpy(&neigh->dgid.raw, &path->pathrec.dgid.raw,
  327. sizeof(union ib_gid));
  328. if (ipoib_cm_enabled(dev, neigh->neighbour)) {
  329. if (!ipoib_cm_get(neigh))
  330. ipoib_cm_set(neigh, ipoib_cm_create_tx(dev,
  331. path,
  332. neigh));
  333. if (!ipoib_cm_get(neigh)) {
  334. list_del(&neigh->list);
  335. if (neigh->ah)
  336. ipoib_put_ah(neigh->ah);
  337. ipoib_neigh_free(dev, neigh);
  338. continue;
  339. }
  340. }
  341. while ((skb = __skb_dequeue(&neigh->queue)))
  342. __skb_queue_tail(&skqueue, skb);
  343. }
  344. }
  345. path->query = NULL;
  346. complete(&path->done);
  347. spin_unlock_irqrestore(&priv->lock, flags);
  348. while ((skb = __skb_dequeue(&skqueue))) {
  349. skb->dev = dev;
  350. if (dev_queue_xmit(skb))
  351. ipoib_warn(priv, "dev_queue_xmit failed "
  352. "to requeue packet\n");
  353. }
  354. }
  355. static struct ipoib_path *path_rec_create(struct net_device *dev, void *gid)
  356. {
  357. struct ipoib_dev_priv *priv = netdev_priv(dev);
  358. struct ipoib_path *path;
  359. path = kzalloc(sizeof *path, GFP_ATOMIC);
  360. if (!path)
  361. return NULL;
  362. path->dev = dev;
  363. skb_queue_head_init(&path->queue);
  364. INIT_LIST_HEAD(&path->neigh_list);
  365. memcpy(path->pathrec.dgid.raw, gid, sizeof (union ib_gid));
  366. path->pathrec.sgid = priv->local_gid;
  367. path->pathrec.pkey = cpu_to_be16(priv->pkey);
  368. path->pathrec.numb_path = 1;
  369. return path;
  370. }
  371. static int path_rec_start(struct net_device *dev,
  372. struct ipoib_path *path)
  373. {
  374. struct ipoib_dev_priv *priv = netdev_priv(dev);
  375. ipoib_dbg(priv, "Start path record lookup for " IPOIB_GID_FMT "\n",
  376. IPOIB_GID_ARG(path->pathrec.dgid));
  377. init_completion(&path->done);
  378. path->query_id =
  379. ib_sa_path_rec_get(&ipoib_sa_client, priv->ca, priv->port,
  380. &path->pathrec,
  381. IB_SA_PATH_REC_DGID |
  382. IB_SA_PATH_REC_SGID |
  383. IB_SA_PATH_REC_NUMB_PATH |
  384. IB_SA_PATH_REC_PKEY,
  385. 1000, GFP_ATOMIC,
  386. path_rec_completion,
  387. path, &path->query);
  388. if (path->query_id < 0) {
  389. ipoib_warn(priv, "ib_sa_path_rec_get failed\n");
  390. path->query = NULL;
  391. return path->query_id;
  392. }
  393. return 0;
  394. }
  395. static void neigh_add_path(struct sk_buff *skb, struct net_device *dev)
  396. {
  397. struct ipoib_dev_priv *priv = netdev_priv(dev);
  398. struct ipoib_path *path;
  399. struct ipoib_neigh *neigh;
  400. neigh = ipoib_neigh_alloc(skb->dst->neighbour);
  401. if (!neigh) {
  402. ++priv->stats.tx_dropped;
  403. dev_kfree_skb_any(skb);
  404. return;
  405. }
  406. /*
  407. * We can only be called from ipoib_start_xmit, so we're
  408. * inside tx_lock -- no need to save/restore flags.
  409. */
  410. spin_lock(&priv->lock);
  411. path = __path_find(dev, skb->dst->neighbour->ha + 4);
  412. if (!path) {
  413. path = path_rec_create(dev, skb->dst->neighbour->ha + 4);
  414. if (!path)
  415. goto err_path;
  416. __path_add(dev, path);
  417. }
  418. list_add_tail(&neigh->list, &path->neigh_list);
  419. if (path->ah) {
  420. kref_get(&path->ah->ref);
  421. neigh->ah = path->ah;
  422. memcpy(&neigh->dgid.raw, &path->pathrec.dgid.raw,
  423. sizeof(union ib_gid));
  424. if (ipoib_cm_enabled(dev, neigh->neighbour)) {
  425. if (!ipoib_cm_get(neigh))
  426. ipoib_cm_set(neigh, ipoib_cm_create_tx(dev, path, neigh));
  427. if (!ipoib_cm_get(neigh)) {
  428. list_del(&neigh->list);
  429. if (neigh->ah)
  430. ipoib_put_ah(neigh->ah);
  431. ipoib_neigh_free(dev, neigh);
  432. goto err_drop;
  433. }
  434. if (skb_queue_len(&neigh->queue) < IPOIB_MAX_PATH_REC_QUEUE)
  435. __skb_queue_tail(&neigh->queue, skb);
  436. else {
  437. ipoib_warn(priv, "queue length limit %d. Packet drop.\n",
  438. skb_queue_len(&neigh->queue));
  439. goto err_drop;
  440. }
  441. } else
  442. ipoib_send(dev, skb, path->ah, IPOIB_QPN(skb->dst->neighbour->ha));
  443. } else {
  444. neigh->ah = NULL;
  445. if (!path->query && path_rec_start(dev, path))
  446. goto err_list;
  447. __skb_queue_tail(&neigh->queue, skb);
  448. }
  449. spin_unlock(&priv->lock);
  450. return;
  451. err_list:
  452. list_del(&neigh->list);
  453. err_path:
  454. ipoib_neigh_free(dev, neigh);
  455. err_drop:
  456. ++priv->stats.tx_dropped;
  457. dev_kfree_skb_any(skb);
  458. spin_unlock(&priv->lock);
  459. }
  460. static void ipoib_path_lookup(struct sk_buff *skb, struct net_device *dev)
  461. {
  462. struct ipoib_dev_priv *priv = netdev_priv(skb->dev);
  463. /* Look up path record for unicasts */
  464. if (skb->dst->neighbour->ha[4] != 0xff) {
  465. neigh_add_path(skb, dev);
  466. return;
  467. }
  468. /* Add in the P_Key for multicasts */
  469. skb->dst->neighbour->ha[8] = (priv->pkey >> 8) & 0xff;
  470. skb->dst->neighbour->ha[9] = priv->pkey & 0xff;
  471. ipoib_mcast_send(dev, skb->dst->neighbour->ha + 4, skb);
  472. }
  473. static void unicast_arp_send(struct sk_buff *skb, struct net_device *dev,
  474. struct ipoib_pseudoheader *phdr)
  475. {
  476. struct ipoib_dev_priv *priv = netdev_priv(dev);
  477. struct ipoib_path *path;
  478. /*
  479. * We can only be called from ipoib_start_xmit, so we're
  480. * inside tx_lock -- no need to save/restore flags.
  481. */
  482. spin_lock(&priv->lock);
  483. path = __path_find(dev, phdr->hwaddr + 4);
  484. if (!path) {
  485. path = path_rec_create(dev, phdr->hwaddr + 4);
  486. if (path) {
  487. /* put pseudoheader back on for next time */
  488. skb_push(skb, sizeof *phdr);
  489. __skb_queue_tail(&path->queue, skb);
  490. if (path_rec_start(dev, path)) {
  491. spin_unlock(&priv->lock);
  492. path_free(dev, path);
  493. return;
  494. } else
  495. __path_add(dev, path);
  496. } else {
  497. ++priv->stats.tx_dropped;
  498. dev_kfree_skb_any(skb);
  499. }
  500. spin_unlock(&priv->lock);
  501. return;
  502. }
  503. if (path->ah) {
  504. ipoib_dbg(priv, "Send unicast ARP to %04x\n",
  505. be16_to_cpu(path->pathrec.dlid));
  506. ipoib_send(dev, skb, path->ah, IPOIB_QPN(phdr->hwaddr));
  507. } else if ((path->query || !path_rec_start(dev, path)) &&
  508. skb_queue_len(&path->queue) < IPOIB_MAX_PATH_REC_QUEUE) {
  509. /* put pseudoheader back on for next time */
  510. skb_push(skb, sizeof *phdr);
  511. __skb_queue_tail(&path->queue, skb);
  512. } else {
  513. ++priv->stats.tx_dropped;
  514. dev_kfree_skb_any(skb);
  515. }
  516. spin_unlock(&priv->lock);
  517. }
  518. static int ipoib_start_xmit(struct sk_buff *skb, struct net_device *dev)
  519. {
  520. struct ipoib_dev_priv *priv = netdev_priv(dev);
  521. struct ipoib_neigh *neigh;
  522. unsigned long flags;
  523. if (unlikely(!spin_trylock_irqsave(&priv->tx_lock, flags)))
  524. return NETDEV_TX_LOCKED;
  525. /*
  526. * Check if our queue is stopped. Since we have the LLTX bit
  527. * set, we can't rely on netif_stop_queue() preventing our
  528. * xmit function from being called with a full queue.
  529. */
  530. if (unlikely(netif_queue_stopped(dev))) {
  531. spin_unlock_irqrestore(&priv->tx_lock, flags);
  532. return NETDEV_TX_BUSY;
  533. }
  534. if (likely(skb->dst && skb->dst->neighbour)) {
  535. if (unlikely(!*to_ipoib_neigh(skb->dst->neighbour))) {
  536. ipoib_path_lookup(skb, dev);
  537. goto out;
  538. }
  539. neigh = *to_ipoib_neigh(skb->dst->neighbour);
  540. if (ipoib_cm_get(neigh)) {
  541. if (ipoib_cm_up(neigh)) {
  542. ipoib_cm_send(dev, skb, ipoib_cm_get(neigh));
  543. goto out;
  544. }
  545. } else if (neigh->ah) {
  546. if (unlikely(memcmp(&neigh->dgid.raw,
  547. skb->dst->neighbour->ha + 4,
  548. sizeof(union ib_gid)))) {
  549. spin_lock(&priv->lock);
  550. /*
  551. * It's safe to call ipoib_put_ah() inside
  552. * priv->lock here, because we know that
  553. * path->ah will always hold one more reference,
  554. * so ipoib_put_ah() will never do more than
  555. * decrement the ref count.
  556. */
  557. ipoib_put_ah(neigh->ah);
  558. list_del(&neigh->list);
  559. ipoib_neigh_free(dev, neigh);
  560. spin_unlock(&priv->lock);
  561. ipoib_path_lookup(skb, dev);
  562. goto out;
  563. }
  564. ipoib_send(dev, skb, neigh->ah, IPOIB_QPN(skb->dst->neighbour->ha));
  565. goto out;
  566. }
  567. if (skb_queue_len(&neigh->queue) < IPOIB_MAX_PATH_REC_QUEUE) {
  568. spin_lock(&priv->lock);
  569. __skb_queue_tail(&neigh->queue, skb);
  570. spin_unlock(&priv->lock);
  571. } else {
  572. ++priv->stats.tx_dropped;
  573. dev_kfree_skb_any(skb);
  574. }
  575. } else {
  576. struct ipoib_pseudoheader *phdr =
  577. (struct ipoib_pseudoheader *) skb->data;
  578. skb_pull(skb, sizeof *phdr);
  579. if (phdr->hwaddr[4] == 0xff) {
  580. /* Add in the P_Key for multicast*/
  581. phdr->hwaddr[8] = (priv->pkey >> 8) & 0xff;
  582. phdr->hwaddr[9] = priv->pkey & 0xff;
  583. ipoib_mcast_send(dev, phdr->hwaddr + 4, skb);
  584. } else {
  585. /* unicast GID -- should be ARP or RARP reply */
  586. if ((be16_to_cpup((__be16 *) skb->data) != ETH_P_ARP) &&
  587. (be16_to_cpup((__be16 *) skb->data) != ETH_P_RARP)) {
  588. ipoib_warn(priv, "Unicast, no %s: type %04x, QPN %06x "
  589. IPOIB_GID_FMT "\n",
  590. skb->dst ? "neigh" : "dst",
  591. be16_to_cpup((__be16 *) skb->data),
  592. IPOIB_QPN(phdr->hwaddr),
  593. IPOIB_GID_RAW_ARG(phdr->hwaddr + 4));
  594. dev_kfree_skb_any(skb);
  595. ++priv->stats.tx_dropped;
  596. goto out;
  597. }
  598. unicast_arp_send(skb, dev, phdr);
  599. }
  600. }
  601. out:
  602. spin_unlock_irqrestore(&priv->tx_lock, flags);
  603. return NETDEV_TX_OK;
  604. }
  605. static struct net_device_stats *ipoib_get_stats(struct net_device *dev)
  606. {
  607. struct ipoib_dev_priv *priv = netdev_priv(dev);
  608. return &priv->stats;
  609. }
  610. static void ipoib_timeout(struct net_device *dev)
  611. {
  612. struct ipoib_dev_priv *priv = netdev_priv(dev);
  613. ipoib_warn(priv, "transmit timeout: latency %d msecs\n",
  614. jiffies_to_msecs(jiffies - dev->trans_start));
  615. ipoib_warn(priv, "queue stopped %d, tx_head %u, tx_tail %u\n",
  616. netif_queue_stopped(dev),
  617. priv->tx_head, priv->tx_tail);
  618. /* XXX reset QP, etc. */
  619. }
  620. static int ipoib_hard_header(struct sk_buff *skb,
  621. struct net_device *dev,
  622. unsigned short type,
  623. void *daddr, void *saddr, unsigned len)
  624. {
  625. struct ipoib_header *header;
  626. header = (struct ipoib_header *) skb_push(skb, sizeof *header);
  627. header->proto = htons(type);
  628. header->reserved = 0;
  629. /*
  630. * If we don't have a neighbour structure, stuff the
  631. * destination address onto the front of the skb so we can
  632. * figure out where to send the packet later.
  633. */
  634. if ((!skb->dst || !skb->dst->neighbour) && daddr) {
  635. struct ipoib_pseudoheader *phdr =
  636. (struct ipoib_pseudoheader *) skb_push(skb, sizeof *phdr);
  637. memcpy(phdr->hwaddr, daddr, INFINIBAND_ALEN);
  638. }
  639. return 0;
  640. }
  641. static void ipoib_set_mcast_list(struct net_device *dev)
  642. {
  643. struct ipoib_dev_priv *priv = netdev_priv(dev);
  644. if (!test_bit(IPOIB_FLAG_OPER_UP, &priv->flags)) {
  645. ipoib_dbg(priv, "IPOIB_FLAG_OPER_UP not set");
  646. return;
  647. }
  648. queue_work(ipoib_workqueue, &priv->restart_task);
  649. }
  650. static void ipoib_neigh_destructor(struct neighbour *n)
  651. {
  652. struct ipoib_neigh *neigh;
  653. struct ipoib_dev_priv *priv = netdev_priv(n->dev);
  654. unsigned long flags;
  655. struct ipoib_ah *ah = NULL;
  656. ipoib_dbg(priv,
  657. "neigh_destructor for %06x " IPOIB_GID_FMT "\n",
  658. IPOIB_QPN(n->ha),
  659. IPOIB_GID_RAW_ARG(n->ha + 4));
  660. spin_lock_irqsave(&priv->lock, flags);
  661. neigh = *to_ipoib_neigh(n);
  662. if (neigh) {
  663. if (neigh->ah)
  664. ah = neigh->ah;
  665. list_del(&neigh->list);
  666. ipoib_neigh_free(n->dev, neigh);
  667. }
  668. spin_unlock_irqrestore(&priv->lock, flags);
  669. if (ah)
  670. ipoib_put_ah(ah);
  671. }
  672. struct ipoib_neigh *ipoib_neigh_alloc(struct neighbour *neighbour)
  673. {
  674. struct ipoib_neigh *neigh;
  675. neigh = kmalloc(sizeof *neigh, GFP_ATOMIC);
  676. if (!neigh)
  677. return NULL;
  678. neigh->neighbour = neighbour;
  679. *to_ipoib_neigh(neighbour) = neigh;
  680. skb_queue_head_init(&neigh->queue);
  681. ipoib_cm_set(neigh, NULL);
  682. return neigh;
  683. }
  684. void ipoib_neigh_free(struct net_device *dev, struct ipoib_neigh *neigh)
  685. {
  686. struct ipoib_dev_priv *priv = netdev_priv(dev);
  687. struct sk_buff *skb;
  688. *to_ipoib_neigh(neigh->neighbour) = NULL;
  689. while ((skb = __skb_dequeue(&neigh->queue))) {
  690. ++priv->stats.tx_dropped;
  691. dev_kfree_skb_any(skb);
  692. }
  693. if (ipoib_cm_get(neigh))
  694. ipoib_cm_destroy_tx(ipoib_cm_get(neigh));
  695. kfree(neigh);
  696. }
  697. static int ipoib_neigh_setup_dev(struct net_device *dev, struct neigh_parms *parms)
  698. {
  699. parms->neigh_destructor = ipoib_neigh_destructor;
  700. return 0;
  701. }
  702. int ipoib_dev_init(struct net_device *dev, struct ib_device *ca, int port)
  703. {
  704. struct ipoib_dev_priv *priv = netdev_priv(dev);
  705. /* Allocate RX/TX "rings" to hold queued skbs */
  706. priv->rx_ring = kzalloc(ipoib_recvq_size * sizeof *priv->rx_ring,
  707. GFP_KERNEL);
  708. if (!priv->rx_ring) {
  709. printk(KERN_WARNING "%s: failed to allocate RX ring (%d entries)\n",
  710. ca->name, ipoib_recvq_size);
  711. goto out;
  712. }
  713. priv->tx_ring = kzalloc(ipoib_sendq_size * sizeof *priv->tx_ring,
  714. GFP_KERNEL);
  715. if (!priv->tx_ring) {
  716. printk(KERN_WARNING "%s: failed to allocate TX ring (%d entries)\n",
  717. ca->name, ipoib_sendq_size);
  718. goto out_rx_ring_cleanup;
  719. }
  720. /* priv->tx_head & tx_tail are already 0 */
  721. if (ipoib_ib_dev_init(dev, ca, port))
  722. goto out_tx_ring_cleanup;
  723. return 0;
  724. out_tx_ring_cleanup:
  725. kfree(priv->tx_ring);
  726. out_rx_ring_cleanup:
  727. kfree(priv->rx_ring);
  728. out:
  729. return -ENOMEM;
  730. }
  731. void ipoib_dev_cleanup(struct net_device *dev)
  732. {
  733. struct ipoib_dev_priv *priv = netdev_priv(dev), *cpriv, *tcpriv;
  734. ipoib_delete_debug_files(dev);
  735. /* Delete any child interfaces first */
  736. list_for_each_entry_safe(cpriv, tcpriv, &priv->child_intfs, list) {
  737. unregister_netdev(cpriv->dev);
  738. ipoib_dev_cleanup(cpriv->dev);
  739. free_netdev(cpriv->dev);
  740. }
  741. ipoib_ib_dev_cleanup(dev);
  742. kfree(priv->rx_ring);
  743. kfree(priv->tx_ring);
  744. priv->rx_ring = NULL;
  745. priv->tx_ring = NULL;
  746. }
  747. static void ipoib_setup(struct net_device *dev)
  748. {
  749. struct ipoib_dev_priv *priv = netdev_priv(dev);
  750. dev->open = ipoib_open;
  751. dev->stop = ipoib_stop;
  752. dev->change_mtu = ipoib_change_mtu;
  753. dev->hard_start_xmit = ipoib_start_xmit;
  754. dev->get_stats = ipoib_get_stats;
  755. dev->tx_timeout = ipoib_timeout;
  756. dev->hard_header = ipoib_hard_header;
  757. dev->set_multicast_list = ipoib_set_mcast_list;
  758. dev->neigh_setup = ipoib_neigh_setup_dev;
  759. dev->watchdog_timeo = HZ;
  760. dev->flags |= IFF_BROADCAST | IFF_MULTICAST;
  761. /*
  762. * We add in INFINIBAND_ALEN to allow for the destination
  763. * address "pseudoheader" for skbs without neighbour struct.
  764. */
  765. dev->hard_header_len = IPOIB_ENCAP_LEN + INFINIBAND_ALEN;
  766. dev->addr_len = INFINIBAND_ALEN;
  767. dev->type = ARPHRD_INFINIBAND;
  768. dev->tx_queue_len = ipoib_sendq_size * 2;
  769. dev->features = NETIF_F_VLAN_CHALLENGED | NETIF_F_LLTX;
  770. /* MTU will be reset when mcast join happens */
  771. dev->mtu = IPOIB_PACKET_SIZE - IPOIB_ENCAP_LEN;
  772. priv->mcast_mtu = priv->admin_mtu = dev->mtu;
  773. memcpy(dev->broadcast, ipv4_bcast_addr, INFINIBAND_ALEN);
  774. netif_carrier_off(dev);
  775. SET_MODULE_OWNER(dev);
  776. priv->dev = dev;
  777. spin_lock_init(&priv->lock);
  778. spin_lock_init(&priv->tx_lock);
  779. mutex_init(&priv->mcast_mutex);
  780. mutex_init(&priv->vlan_mutex);
  781. INIT_LIST_HEAD(&priv->path_list);
  782. INIT_LIST_HEAD(&priv->child_intfs);
  783. INIT_LIST_HEAD(&priv->dead_ahs);
  784. INIT_LIST_HEAD(&priv->multicast_list);
  785. INIT_DELAYED_WORK(&priv->pkey_task, ipoib_pkey_poll);
  786. INIT_DELAYED_WORK(&priv->mcast_task, ipoib_mcast_join_task);
  787. INIT_WORK(&priv->flush_task, ipoib_ib_dev_flush);
  788. INIT_WORK(&priv->restart_task, ipoib_mcast_restart_task);
  789. INIT_DELAYED_WORK(&priv->ah_reap_task, ipoib_reap_ah);
  790. }
  791. struct ipoib_dev_priv *ipoib_intf_alloc(const char *name)
  792. {
  793. struct net_device *dev;
  794. dev = alloc_netdev((int) sizeof (struct ipoib_dev_priv), name,
  795. ipoib_setup);
  796. if (!dev)
  797. return NULL;
  798. return netdev_priv(dev);
  799. }
  800. static ssize_t show_pkey(struct device *dev,
  801. struct device_attribute *attr, char *buf)
  802. {
  803. struct ipoib_dev_priv *priv = netdev_priv(to_net_dev(dev));
  804. return sprintf(buf, "0x%04x\n", priv->pkey);
  805. }
  806. static DEVICE_ATTR(pkey, S_IRUGO, show_pkey, NULL);
  807. static ssize_t create_child(struct device *dev,
  808. struct device_attribute *attr,
  809. const char *buf, size_t count)
  810. {
  811. int pkey;
  812. int ret;
  813. if (sscanf(buf, "%i", &pkey) != 1)
  814. return -EINVAL;
  815. if (pkey < 0 || pkey > 0xffff)
  816. return -EINVAL;
  817. /*
  818. * Set the full membership bit, so that we join the right
  819. * broadcast group, etc.
  820. */
  821. pkey |= 0x8000;
  822. ret = ipoib_vlan_add(to_net_dev(dev), pkey);
  823. return ret ? ret : count;
  824. }
  825. static DEVICE_ATTR(create_child, S_IWUGO, NULL, create_child);
  826. static ssize_t delete_child(struct device *dev,
  827. struct device_attribute *attr,
  828. const char *buf, size_t count)
  829. {
  830. int pkey;
  831. int ret;
  832. if (sscanf(buf, "%i", &pkey) != 1)
  833. return -EINVAL;
  834. if (pkey < 0 || pkey > 0xffff)
  835. return -EINVAL;
  836. ret = ipoib_vlan_delete(to_net_dev(dev), pkey);
  837. return ret ? ret : count;
  838. }
  839. static DEVICE_ATTR(delete_child, S_IWUGO, NULL, delete_child);
  840. int ipoib_add_pkey_attr(struct net_device *dev)
  841. {
  842. return device_create_file(&dev->dev, &dev_attr_pkey);
  843. }
  844. static struct net_device *ipoib_add_port(const char *format,
  845. struct ib_device *hca, u8 port)
  846. {
  847. struct ipoib_dev_priv *priv;
  848. int result = -ENOMEM;
  849. priv = ipoib_intf_alloc(format);
  850. if (!priv)
  851. goto alloc_mem_failed;
  852. SET_NETDEV_DEV(priv->dev, hca->dma_device);
  853. result = ib_query_pkey(hca, port, 0, &priv->pkey);
  854. if (result) {
  855. printk(KERN_WARNING "%s: ib_query_pkey port %d failed (ret = %d)\n",
  856. hca->name, port, result);
  857. goto alloc_mem_failed;
  858. }
  859. /*
  860. * Set the full membership bit, so that we join the right
  861. * broadcast group, etc.
  862. */
  863. priv->pkey |= 0x8000;
  864. priv->dev->broadcast[8] = priv->pkey >> 8;
  865. priv->dev->broadcast[9] = priv->pkey & 0xff;
  866. result = ib_query_gid(hca, port, 0, &priv->local_gid);
  867. if (result) {
  868. printk(KERN_WARNING "%s: ib_query_gid port %d failed (ret = %d)\n",
  869. hca->name, port, result);
  870. goto alloc_mem_failed;
  871. } else
  872. memcpy(priv->dev->dev_addr + 4, priv->local_gid.raw, sizeof (union ib_gid));
  873. result = ipoib_dev_init(priv->dev, hca, port);
  874. if (result < 0) {
  875. printk(KERN_WARNING "%s: failed to initialize port %d (ret = %d)\n",
  876. hca->name, port, result);
  877. goto device_init_failed;
  878. }
  879. INIT_IB_EVENT_HANDLER(&priv->event_handler,
  880. priv->ca, ipoib_event);
  881. result = ib_register_event_handler(&priv->event_handler);
  882. if (result < 0) {
  883. printk(KERN_WARNING "%s: ib_register_event_handler failed for "
  884. "port %d (ret = %d)\n",
  885. hca->name, port, result);
  886. goto event_failed;
  887. }
  888. result = register_netdev(priv->dev);
  889. if (result) {
  890. printk(KERN_WARNING "%s: couldn't register ipoib port %d; error %d\n",
  891. hca->name, port, result);
  892. goto register_failed;
  893. }
  894. ipoib_create_debug_files(priv->dev);
  895. if (ipoib_cm_add_mode_attr(priv->dev))
  896. goto sysfs_failed;
  897. if (ipoib_add_pkey_attr(priv->dev))
  898. goto sysfs_failed;
  899. if (device_create_file(&priv->dev->dev, &dev_attr_create_child))
  900. goto sysfs_failed;
  901. if (device_create_file(&priv->dev->dev, &dev_attr_delete_child))
  902. goto sysfs_failed;
  903. return priv->dev;
  904. sysfs_failed:
  905. ipoib_delete_debug_files(priv->dev);
  906. unregister_netdev(priv->dev);
  907. register_failed:
  908. ib_unregister_event_handler(&priv->event_handler);
  909. flush_scheduled_work();
  910. event_failed:
  911. ipoib_dev_cleanup(priv->dev);
  912. device_init_failed:
  913. free_netdev(priv->dev);
  914. alloc_mem_failed:
  915. return ERR_PTR(result);
  916. }
  917. static void ipoib_add_one(struct ib_device *device)
  918. {
  919. struct list_head *dev_list;
  920. struct net_device *dev;
  921. struct ipoib_dev_priv *priv;
  922. int s, e, p;
  923. if (rdma_node_get_transport(device->node_type) != RDMA_TRANSPORT_IB)
  924. return;
  925. dev_list = kmalloc(sizeof *dev_list, GFP_KERNEL);
  926. if (!dev_list)
  927. return;
  928. INIT_LIST_HEAD(dev_list);
  929. if (device->node_type == RDMA_NODE_IB_SWITCH) {
  930. s = 0;
  931. e = 0;
  932. } else {
  933. s = 1;
  934. e = device->phys_port_cnt;
  935. }
  936. for (p = s; p <= e; ++p) {
  937. dev = ipoib_add_port("ib%d", device, p);
  938. if (!IS_ERR(dev)) {
  939. priv = netdev_priv(dev);
  940. list_add_tail(&priv->list, dev_list);
  941. }
  942. }
  943. ib_set_client_data(device, &ipoib_client, dev_list);
  944. }
  945. static void ipoib_remove_one(struct ib_device *device)
  946. {
  947. struct ipoib_dev_priv *priv, *tmp;
  948. struct list_head *dev_list;
  949. if (rdma_node_get_transport(device->node_type) != RDMA_TRANSPORT_IB)
  950. return;
  951. dev_list = ib_get_client_data(device, &ipoib_client);
  952. list_for_each_entry_safe(priv, tmp, dev_list, list) {
  953. ib_unregister_event_handler(&priv->event_handler);
  954. flush_scheduled_work();
  955. unregister_netdev(priv->dev);
  956. ipoib_dev_cleanup(priv->dev);
  957. free_netdev(priv->dev);
  958. }
  959. kfree(dev_list);
  960. }
  961. static int __init ipoib_init_module(void)
  962. {
  963. int ret;
  964. ipoib_recvq_size = roundup_pow_of_two(ipoib_recvq_size);
  965. ipoib_recvq_size = min(ipoib_recvq_size, IPOIB_MAX_QUEUE_SIZE);
  966. ipoib_recvq_size = max(ipoib_recvq_size, IPOIB_MIN_QUEUE_SIZE);
  967. ipoib_sendq_size = roundup_pow_of_two(ipoib_sendq_size);
  968. ipoib_sendq_size = min(ipoib_sendq_size, IPOIB_MAX_QUEUE_SIZE);
  969. ipoib_sendq_size = max(ipoib_sendq_size, IPOIB_MIN_QUEUE_SIZE);
  970. ret = ipoib_register_debugfs();
  971. if (ret)
  972. return ret;
  973. /*
  974. * We create our own workqueue mainly because we want to be
  975. * able to flush it when devices are being removed. We can't
  976. * use schedule_work()/flush_scheduled_work() because both
  977. * unregister_netdev() and linkwatch_event take the rtnl lock,
  978. * so flush_scheduled_work() can deadlock during device
  979. * removal.
  980. */
  981. ipoib_workqueue = create_singlethread_workqueue("ipoib");
  982. if (!ipoib_workqueue) {
  983. ret = -ENOMEM;
  984. goto err_fs;
  985. }
  986. ib_sa_register_client(&ipoib_sa_client);
  987. ret = ib_register_client(&ipoib_client);
  988. if (ret)
  989. goto err_sa;
  990. return 0;
  991. err_sa:
  992. ib_sa_unregister_client(&ipoib_sa_client);
  993. destroy_workqueue(ipoib_workqueue);
  994. err_fs:
  995. ipoib_unregister_debugfs();
  996. return ret;
  997. }
  998. static void __exit ipoib_cleanup_module(void)
  999. {
  1000. ib_unregister_client(&ipoib_client);
  1001. ib_sa_unregister_client(&ipoib_sa_client);
  1002. ipoib_unregister_debugfs();
  1003. destroy_workqueue(ipoib_workqueue);
  1004. }
  1005. module_init(ipoib_init_module);
  1006. module_exit(ipoib_cleanup_module);