2 * SPDX-License-Identifier: BSD-2-Clause OR GPL-2.0
4 * Copyright (c) 2004 Topspin Communications. All rights reserved.
5 * Copyright (c) 2005 Sun Microsystems, Inc. All rights reserved.
6 * Copyright (c) 2004 Voltaire, Inc. All rights reserved.
8 * This software is available to you under a choice of one of two
9 * licenses. You may choose to be licensed under the terms of the GNU
10 * General Public License (GPL) Version 2, available from the file
11 * COPYING in the main directory of this source tree, or the
12 * OpenIB.org BSD license below:
14 * Redistribution and use in source and binary forms, with or
15 * without modification, are permitted provided that the following
18 * - Redistributions of source code must retain the above
19 * copyright notice, this list of conditions and the following
22 * - Redistributions in binary form must reproduce the above
23 * copyright notice, this list of conditions and the following
24 * disclaimer in the documentation and/or other materials
25 * provided with the distribution.
27 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
28 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
29 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
30 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
31 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
32 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
33 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
37 #include <sys/cdefs.h>
38 __FBSDID("$FreeBSD$");
41 #include <sys/eventhandler.h>
43 static int ipoib_resolvemulti(struct ifnet *, struct sockaddr **,
47 #include <linux/module.h>
49 #include <linux/slab.h>
50 #include <linux/kernel.h>
51 #include <linux/vmalloc.h>
53 #include <linux/if_arp.h> /* For ARPHRD_xxx */
54 #include <linux/if_vlan.h>
58 #include <rdma/ib_cache.h>
60 MODULE_AUTHOR("Roland Dreier");
61 MODULE_DESCRIPTION("IP-over-InfiniBand net driver");
62 MODULE_LICENSE("Dual BSD/GPL");
64 int ipoib_sendq_size = IPOIB_TX_RING_SIZE;
65 int ipoib_recvq_size = IPOIB_RX_RING_SIZE;
67 module_param_named(send_queue_size, ipoib_sendq_size, int, 0444);
68 MODULE_PARM_DESC(send_queue_size, "Number of descriptors in send queue");
69 module_param_named(recv_queue_size, ipoib_recvq_size, int, 0444);
70 MODULE_PARM_DESC(recv_queue_size, "Number of descriptors in receive queue");
72 #ifdef CONFIG_INFINIBAND_IPOIB_DEBUG
73 int ipoib_debug_level = 1;
75 module_param_named(debug_level, ipoib_debug_level, int, 0644);
76 MODULE_PARM_DESC(debug_level, "Enable debug tracing if > 0");
79 struct ipoib_path_iter {
80 struct ipoib_dev_priv *priv;
81 struct ipoib_path path;
84 static const u8 ipv4_bcast_addr[] = {
85 0x00, 0xff, 0xff, 0xff,
86 0xff, 0x12, 0x40, 0x1b, 0x00, 0x00, 0x00, 0x00,
87 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff
90 struct workqueue_struct *ipoib_workqueue;
92 struct ib_sa_client ipoib_sa_client;
94 static void ipoib_add_one(struct ib_device *device);
95 static void ipoib_remove_one(struct ib_device *device, void *client_data);
96 static struct net_device *ipoib_get_net_dev_by_params(
97 struct ib_device *dev, u8 port, u16 pkey,
98 const union ib_gid *gid, const struct sockaddr *addr,
100 static void ipoib_start(struct ifnet *dev);
101 static int ipoib_output(struct ifnet *ifp, struct mbuf *m,
102 const struct sockaddr *dst, struct route *ro);
103 static int ipoib_ioctl(struct ifnet *ifp, u_long command, caddr_t data);
104 static void ipoib_input(struct ifnet *ifp, struct mbuf *m);
106 #define IPOIB_MTAP(_ifp, _m) \
108 if (bpf_peers_present((_ifp)->if_bpf)) { \
110 ipoib_mtap_mb((_ifp), (_m)); \
114 static struct unrhdr *ipoib_unrhdr;
117 ipoib_unrhdr_init(void *arg)
120 ipoib_unrhdr = new_unrhdr(0, 65535, NULL);
122 SYSINIT(ipoib_unrhdr_init, SI_SUB_KLD - 1, SI_ORDER_ANY, ipoib_unrhdr_init, NULL);
125 ipoib_unrhdr_uninit(void *arg)
128 if (ipoib_unrhdr != NULL) {
137 SYSUNINIT(ipoib_unrhdr_uninit, SI_SUB_KLD - 1, SI_ORDER_ANY, ipoib_unrhdr_uninit, NULL);
140 * This is for clients that have an ipoib_header in the mbuf.
143 ipoib_mtap_mb(struct ifnet *ifp, struct mbuf *mb)
145 struct ipoib_header *ih;
146 struct ether_header eh;
148 ih = mtod(mb, struct ipoib_header *);
149 eh.ether_type = ih->proto;
150 bcopy(ih->hwaddr, &eh.ether_dhost, ETHER_ADDR_LEN);
151 bzero(&eh.ether_shost, ETHER_ADDR_LEN);
152 mb->m_data += sizeof(struct ipoib_header);
153 mb->m_len -= sizeof(struct ipoib_header);
154 bpf_mtap2(ifp->if_bpf, &eh, sizeof(eh), mb);
155 mb->m_data -= sizeof(struct ipoib_header);
156 mb->m_len += sizeof(struct ipoib_header);
160 ipoib_mtap_proto(struct ifnet *ifp, struct mbuf *mb, uint16_t proto)
162 struct ether_header eh;
164 eh.ether_type = proto;
165 bzero(&eh.ether_shost, ETHER_ADDR_LEN);
166 bzero(&eh.ether_dhost, ETHER_ADDR_LEN);
167 bpf_mtap2(ifp->if_bpf, &eh, sizeof(eh), mb);
170 static struct ib_client ipoib_client = {
172 .add = ipoib_add_one,
173 .remove = ipoib_remove_one,
174 .get_net_dev_by_params = ipoib_get_net_dev_by_params,
178 ipoib_open(struct ipoib_dev_priv *priv)
180 struct ifnet *dev = priv->dev;
182 ipoib_dbg(priv, "bringing up interface\n");
184 set_bit(IPOIB_FLAG_ADMIN_UP, &priv->flags);
186 if (ipoib_pkey_dev_delay_open(priv))
189 if (ipoib_ib_dev_open(priv))
192 if (ipoib_ib_dev_up(priv))
195 if (!test_bit(IPOIB_FLAG_SUBINTERFACE, &priv->flags)) {
196 struct ipoib_dev_priv *cpriv;
198 /* Bring up any child interfaces too */
199 mutex_lock(&priv->vlan_mutex);
200 list_for_each_entry(cpriv, &priv->child_intfs, list)
201 if ((cpriv->dev->if_drv_flags & IFF_DRV_RUNNING) == 0)
203 mutex_unlock(&priv->vlan_mutex);
205 dev->if_drv_flags |= IFF_DRV_RUNNING;
206 dev->if_drv_flags &= ~IFF_DRV_OACTIVE;
211 ipoib_ib_dev_stop(priv, 1);
214 clear_bit(IPOIB_FLAG_ADMIN_UP, &priv->flags);
220 ipoib_init(void *arg)
223 struct ipoib_dev_priv *priv;
227 if ((dev->if_drv_flags & IFF_DRV_RUNNING) == 0)
229 queue_work(ipoib_workqueue, &priv->flush_light);
234 ipoib_stop(struct ipoib_dev_priv *priv)
236 struct ifnet *dev = priv->dev;
238 ipoib_dbg(priv, "stopping interface\n");
240 clear_bit(IPOIB_FLAG_ADMIN_UP, &priv->flags);
242 dev->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE);
244 ipoib_ib_dev_down(priv, 0);
245 ipoib_ib_dev_stop(priv, 0);
247 if (!test_bit(IPOIB_FLAG_SUBINTERFACE, &priv->flags)) {
248 struct ipoib_dev_priv *cpriv;
250 /* Bring down any child interfaces too */
251 mutex_lock(&priv->vlan_mutex);
252 list_for_each_entry(cpriv, &priv->child_intfs, list)
253 if ((cpriv->dev->if_drv_flags & IFF_DRV_RUNNING) != 0)
255 mutex_unlock(&priv->vlan_mutex);
262 ipoib_propagate_ifnet_mtu(struct ipoib_dev_priv *priv, int new_mtu,
270 if (ifp->if_mtu == new_mtu)
273 strlcpy(ifr.ifr_name, if_name(ifp), IFNAMSIZ);
274 ifr.ifr_mtu = new_mtu;
275 CURVNET_SET(ifp->if_vnet);
276 error = ifhwioctl(SIOCSIFMTU, ifp, (caddr_t)&ifr, curthread);
279 ifp->if_mtu = new_mtu;
286 ipoib_change_mtu(struct ipoib_dev_priv *priv, int new_mtu, bool propagate)
288 int error, prev_admin_mtu;
290 /* dev->if_mtu > 2K ==> connected mode */
291 if (ipoib_cm_admin_enabled(priv)) {
292 if (new_mtu > IPOIB_CM_MTU(ipoib_cm_max_mtu(priv)))
295 if (new_mtu > priv->mcast_mtu)
296 ipoib_warn(priv, "mtu > %d will cause multicast packet drops.\n",
299 return (ipoib_propagate_ifnet_mtu(priv, new_mtu, propagate));
302 if (new_mtu > IPOIB_UD_MTU(priv->max_ib_mtu))
305 prev_admin_mtu = priv->admin_mtu;
306 priv->admin_mtu = new_mtu;
307 error = ipoib_propagate_ifnet_mtu(priv, min(priv->mcast_mtu,
308 priv->admin_mtu), propagate);
310 /* check for MTU change to avoid infinite loop */
311 if (prev_admin_mtu != new_mtu)
312 queue_work(ipoib_workqueue, &priv->flush_light);
314 priv->admin_mtu = prev_admin_mtu;
319 ipoib_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
321 struct ipoib_dev_priv *priv = ifp->if_softc;
322 struct ifaddr *ifa = (struct ifaddr *) data;
323 struct ifreq *ifr = (struct ifreq *) data;
326 /* check if detaching */
327 if (priv == NULL || priv->gone != 0)
332 if (ifp->if_flags & IFF_UP) {
333 if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0)
334 error = -ipoib_open(priv);
336 if (ifp->if_drv_flags & IFF_DRV_RUNNING)
341 if (ifp->if_drv_flags & IFF_DRV_RUNNING)
342 queue_work(ipoib_workqueue, &priv->restart_task);
345 ifp->if_flags |= IFF_UP;
347 switch (ifa->ifa_addr->sa_family) {
350 ifp->if_init(ifp->if_softc); /* before arpwhohas */
351 arp_ifinit(ifp, ifa);
355 ifp->if_init(ifp->if_softc);
361 bcopy(IF_LLADDR(ifp), &ifr->ifr_addr.sa_data[0],
367 * Set the interface MTU.
369 error = -ipoib_change_mtu(priv, ifr->ifr_mtu, false);
379 static struct ipoib_path *
380 __path_find(struct ipoib_dev_priv *priv, void *gid)
382 struct rb_node *n = priv->path_tree.rb_node;
383 struct ipoib_path *path;
387 path = rb_entry(n, struct ipoib_path, rb_node);
389 ret = memcmp(gid, path->pathrec.dgid.raw,
390 sizeof (union ib_gid));
404 __path_add(struct ipoib_dev_priv *priv, struct ipoib_path *path)
406 struct rb_node **n = &priv->path_tree.rb_node;
407 struct rb_node *pn = NULL;
408 struct ipoib_path *tpath;
413 tpath = rb_entry(pn, struct ipoib_path, rb_node);
415 ret = memcmp(path->pathrec.dgid.raw, tpath->pathrec.dgid.raw,
416 sizeof (union ib_gid));
425 rb_link_node(&path->rb_node, pn, n);
426 rb_insert_color(&path->rb_node, &priv->path_tree);
428 list_add_tail(&path->list, &priv->path_list);
434 ipoib_path_free(struct ipoib_dev_priv *priv, struct ipoib_path *path)
437 _IF_DRAIN(&path->queue);
440 ipoib_put_ah(path->ah);
441 if (ipoib_cm_get(path))
442 ipoib_cm_destroy_tx(ipoib_cm_get(path));
447 #ifdef CONFIG_INFINIBAND_IPOIB_DEBUG
449 struct ipoib_path_iter *
450 ipoib_path_iter_init(struct ipoib_dev_priv *priv)
452 struct ipoib_path_iter *iter;
454 iter = kmalloc(sizeof *iter, GFP_KERNEL);
459 memset(iter->path.pathrec.dgid.raw, 0, 16);
461 if (ipoib_path_iter_next(iter)) {
470 ipoib_path_iter_next(struct ipoib_path_iter *iter)
472 struct ipoib_dev_priv *priv = iter->priv;
474 struct ipoib_path *path;
477 spin_lock_irq(&priv->lock);
479 n = rb_first(&priv->path_tree);
482 path = rb_entry(n, struct ipoib_path, rb_node);
484 if (memcmp(iter->path.pathrec.dgid.raw, path->pathrec.dgid.raw,
485 sizeof (union ib_gid)) < 0) {
494 spin_unlock_irq(&priv->lock);
500 ipoib_path_iter_read(struct ipoib_path_iter *iter, struct ipoib_path *path)
505 #endif /* CONFIG_INFINIBAND_IPOIB_DEBUG */
508 ipoib_mark_paths_invalid(struct ipoib_dev_priv *priv)
510 struct ipoib_path *path, *tp;
512 spin_lock_irq(&priv->lock);
514 list_for_each_entry_safe(path, tp, &priv->path_list, list) {
515 ipoib_dbg(priv, "mark path LID 0x%04x GID %16D invalid\n",
516 be16_to_cpu(path->pathrec.dlid),
517 path->pathrec.dgid.raw, ":");
521 spin_unlock_irq(&priv->lock);
525 ipoib_flush_paths(struct ipoib_dev_priv *priv)
527 struct ipoib_path *path, *tp;
528 LIST_HEAD(remove_list);
531 spin_lock_irqsave(&priv->lock, flags);
533 list_splice_init(&priv->path_list, &remove_list);
535 list_for_each_entry(path, &remove_list, list)
536 rb_erase(&path->rb_node, &priv->path_tree);
538 list_for_each_entry_safe(path, tp, &remove_list, list) {
540 ib_sa_cancel_query(path->query_id, path->query);
541 spin_unlock_irqrestore(&priv->lock, flags);
542 wait_for_completion(&path->done);
543 ipoib_path_free(priv, path);
544 spin_lock_irqsave(&priv->lock, flags);
547 spin_unlock_irqrestore(&priv->lock, flags);
551 path_rec_completion(int status, struct ib_sa_path_rec *pathrec, void *path_ptr)
553 struct ipoib_path *path = path_ptr;
554 struct ipoib_dev_priv *priv = path->priv;
555 struct ifnet *dev = priv->dev;
556 struct ipoib_ah *ah = NULL;
557 struct ipoib_ah *old_ah = NULL;
558 struct ifqueue mbqueue;
563 ipoib_dbg(priv, "PathRec LID 0x%04x for GID %16D\n",
564 be16_to_cpu(pathrec->dlid), pathrec->dgid.raw, ":");
566 ipoib_dbg(priv, "PathRec status %d for GID %16D\n",
567 status, path->pathrec.dgid.raw, ":");
569 bzero(&mbqueue, sizeof(mbqueue));
572 struct ib_ah_attr av;
574 if (!ib_init_ah_from_path(priv->ca, priv->port, pathrec, &av))
575 ah = ipoib_create_ah(priv, priv->pd, &av);
578 spin_lock_irqsave(&priv->lock, flags);
581 path->pathrec = *pathrec;
586 ipoib_dbg(priv, "created address handle %p for LID 0x%04x, SL %d\n",
587 ah, be16_to_cpu(pathrec->dlid), pathrec->sl);
590 _IF_DEQUEUE(&path->queue, mb);
593 _IF_ENQUEUE(&mbqueue, mb);
596 #ifdef CONFIG_INFINIBAND_IPOIB_CM
597 if (ipoib_cm_enabled(priv, path->hwaddr) && !ipoib_cm_get(path))
598 ipoib_cm_set(path, ipoib_cm_create_tx(priv, path));
605 complete(&path->done);
607 spin_unlock_irqrestore(&priv->lock, flags);
610 ipoib_put_ah(old_ah);
613 _IF_DEQUEUE(&mbqueue, mb);
616 mb->m_pkthdr.rcvif = dev;
617 if (dev->if_transmit(dev, mb))
618 ipoib_warn(priv, "dev_queue_xmit failed "
619 "to requeue packet\n");
623 static struct ipoib_path *
624 path_rec_create(struct ipoib_dev_priv *priv, uint8_t *hwaddr)
626 struct ipoib_path *path;
628 if (!priv->broadcast)
631 path = kzalloc(sizeof *path, GFP_ATOMIC);
637 bzero(&path->queue, sizeof(path->queue));
639 #ifdef CONFIG_INFINIBAND_IPOIB_CM
640 memcpy(&path->hwaddr, hwaddr, INFINIBAND_ALEN);
642 memcpy(path->pathrec.dgid.raw, &hwaddr[4], sizeof (union ib_gid));
643 path->pathrec.sgid = priv->local_gid;
644 path->pathrec.pkey = cpu_to_be16(priv->pkey);
645 path->pathrec.numb_path = 1;
646 path->pathrec.traffic_class = priv->broadcast->mcmember.traffic_class;
652 path_rec_start(struct ipoib_dev_priv *priv, struct ipoib_path *path)
654 struct ifnet *dev = priv->dev;
656 ib_sa_comp_mask comp_mask = IB_SA_PATH_REC_MTU_SELECTOR | IB_SA_PATH_REC_MTU;
657 struct ib_sa_path_rec p_rec;
659 p_rec = path->pathrec;
660 p_rec.mtu_selector = IB_SA_GT;
662 switch (roundup_pow_of_two(dev->if_mtu + IPOIB_ENCAP_LEN)) {
664 p_rec.mtu = IB_MTU_256;
667 p_rec.mtu = IB_MTU_512;
670 p_rec.mtu = IB_MTU_1024;
673 p_rec.mtu = IB_MTU_2048;
676 /* Wildcard everything */
679 p_rec.mtu_selector = 0;
682 ipoib_dbg(priv, "Start path record lookup for %16D MTU > %d\n",
684 comp_mask ? ib_mtu_enum_to_int(p_rec.mtu) : 0);
686 init_completion(&path->done);
689 ib_sa_path_rec_get(&ipoib_sa_client, priv->ca, priv->port,
691 IB_SA_PATH_REC_DGID |
692 IB_SA_PATH_REC_SGID |
693 IB_SA_PATH_REC_NUMB_PATH |
694 IB_SA_PATH_REC_TRAFFIC_CLASS |
699 if (path->query_id < 0) {
700 ipoib_warn(priv, "ib_sa_path_rec_get failed: %d\n", path->query_id);
702 complete(&path->done);
703 return path->query_id;
710 ipoib_unicast_send(struct mbuf *mb, struct ipoib_dev_priv *priv, struct ipoib_header *eh)
712 struct ipoib_path *path;
714 path = __path_find(priv, eh->hwaddr + 4);
715 if (!path || !path->valid) {
719 path = path_rec_create(priv, eh->hwaddr);
723 if (_IF_QLEN(&path->queue) < IPOIB_MAX_PATH_REC_QUEUE)
724 _IF_ENQUEUE(&path->queue, mb);
726 if_inc_counter(priv->dev, IFCOUNTER_OERRORS, 1);
730 if (!path->query && path_rec_start(priv, path)) {
731 spin_unlock_irqrestore(&priv->lock, flags);
733 ipoib_path_free(priv, path);
736 __path_add(priv, path);
738 if_inc_counter(priv->dev, IFCOUNTER_OERRORS, 1);
745 if (ipoib_cm_get(path) && ipoib_cm_up(path)) {
746 ipoib_cm_send(priv, mb, ipoib_cm_get(path));
747 } else if (path->ah) {
748 ipoib_send(priv, mb, path->ah, IPOIB_QPN(eh->hwaddr));
749 } else if ((path->query || !path_rec_start(priv, path)) &&
750 path->queue.ifq_len < IPOIB_MAX_PATH_REC_QUEUE) {
751 _IF_ENQUEUE(&path->queue, mb);
753 if_inc_counter(priv->dev, IFCOUNTER_OERRORS, 1);
759 ipoib_send_one(struct ipoib_dev_priv *priv, struct mbuf *mb)
761 struct ipoib_header *eh;
763 eh = mtod(mb, struct ipoib_header *);
764 if (IPOIB_IS_MULTICAST(eh->hwaddr)) {
765 /* Add in the P_Key for multicast*/
766 eh->hwaddr[8] = (priv->pkey >> 8) & 0xff;
767 eh->hwaddr[9] = priv->pkey & 0xff;
769 ipoib_mcast_send(priv, eh->hwaddr + 4, mb);
771 ipoib_unicast_send(mb, priv, eh);
778 _ipoib_start(struct ifnet *dev, struct ipoib_dev_priv *priv)
782 if ((dev->if_drv_flags & (IFF_DRV_RUNNING|IFF_DRV_OACTIVE)) !=
786 spin_lock(&priv->lock);
787 while (!IFQ_DRV_IS_EMPTY(&dev->if_snd) &&
788 (dev->if_drv_flags & IFF_DRV_OACTIVE) == 0) {
789 IFQ_DRV_DEQUEUE(&dev->if_snd, mb);
793 ipoib_send_one(priv, mb);
795 spin_unlock(&priv->lock);
799 ipoib_start(struct ifnet *dev)
801 _ipoib_start(dev, dev->if_softc);
805 ipoib_vlan_start(struct ifnet *dev)
807 struct ipoib_dev_priv *priv;
810 priv = VLAN_COOKIE(dev);
812 return _ipoib_start(dev, priv);
813 while (!IFQ_DRV_IS_EMPTY(&dev->if_snd)) {
814 IFQ_DRV_DEQUEUE(&dev->if_snd, mb);
818 if_inc_counter(dev, IFCOUNTER_OERRORS, 1);
823 ipoib_dev_init(struct ipoib_dev_priv *priv, struct ib_device *ca, int port)
826 /* Allocate RX/TX "rings" to hold queued mbs */
827 priv->rx_ring = kzalloc(ipoib_recvq_size * sizeof *priv->rx_ring,
829 if (!priv->rx_ring) {
830 printk(KERN_WARNING "%s: failed to allocate RX ring (%d entries)\n",
831 ca->name, ipoib_recvq_size);
835 priv->tx_ring = kzalloc(ipoib_sendq_size * sizeof *priv->tx_ring, GFP_KERNEL);
836 if (!priv->tx_ring) {
837 printk(KERN_WARNING "%s: failed to allocate TX ring (%d entries)\n",
838 ca->name, ipoib_sendq_size);
839 goto out_rx_ring_cleanup;
841 memset(priv->tx_ring, 0, ipoib_sendq_size * sizeof *priv->tx_ring);
843 /* priv->tx_head, tx_tail & tx_outstanding are already 0 */
845 if (ipoib_ib_dev_init(priv, ca, port))
846 goto out_tx_ring_cleanup;
851 kfree(priv->tx_ring);
854 kfree(priv->rx_ring);
861 ipoib_detach(struct ipoib_dev_priv *priv)
866 if (!test_bit(IPOIB_FLAG_SUBINTERFACE, &priv->flags)) {
871 free_unr(ipoib_unrhdr, priv->unit);
873 VLAN_SETCOOKIE(priv->dev, NULL);
879 ipoib_dev_cleanup(struct ipoib_dev_priv *priv)
881 struct ipoib_dev_priv *cpriv, *tcpriv;
883 /* Delete any child interfaces first */
884 list_for_each_entry_safe(cpriv, tcpriv, &priv->child_intfs, list) {
885 ipoib_dev_cleanup(cpriv);
889 ipoib_ib_dev_cleanup(priv);
891 kfree(priv->rx_ring);
892 kfree(priv->tx_ring);
894 priv->rx_ring = NULL;
895 priv->tx_ring = NULL;
898 static struct ipoib_dev_priv *
899 ipoib_priv_alloc(void)
901 struct ipoib_dev_priv *priv;
903 priv = malloc(sizeof(struct ipoib_dev_priv), M_TEMP, M_ZERO|M_WAITOK);
904 spin_lock_init(&priv->lock);
905 spin_lock_init(&priv->drain_lock);
906 mutex_init(&priv->vlan_mutex);
907 INIT_LIST_HEAD(&priv->path_list);
908 INIT_LIST_HEAD(&priv->child_intfs);
909 INIT_LIST_HEAD(&priv->dead_ahs);
910 INIT_LIST_HEAD(&priv->multicast_list);
911 INIT_DELAYED_WORK(&priv->pkey_poll_task, ipoib_pkey_poll);
912 INIT_DELAYED_WORK(&priv->mcast_task, ipoib_mcast_join_task);
913 INIT_WORK(&priv->carrier_on_task, ipoib_mcast_carrier_on_task);
914 INIT_WORK(&priv->flush_light, ipoib_ib_dev_flush_light);
915 INIT_WORK(&priv->flush_normal, ipoib_ib_dev_flush_normal);
916 INIT_WORK(&priv->flush_heavy, ipoib_ib_dev_flush_heavy);
917 INIT_WORK(&priv->restart_task, ipoib_mcast_restart_task);
918 INIT_DELAYED_WORK(&priv->ah_reap_task, ipoib_reap_ah);
919 memcpy(priv->broadcastaddr, ipv4_bcast_addr, INFINIBAND_ALEN);
924 struct ipoib_dev_priv *
925 ipoib_intf_alloc(const char *name)
927 struct ipoib_dev_priv *priv;
928 struct sockaddr_dl *sdl;
931 priv = ipoib_priv_alloc();
932 dev = priv->dev = if_alloc(IFT_INFINIBAND);
937 dev->if_softc = priv;
938 priv->unit = alloc_unr(ipoib_unrhdr);
939 if (priv->unit == -1) {
944 if_initname(dev, name, priv->unit);
945 dev->if_flags = IFF_BROADCAST | IFF_MULTICAST;
946 dev->if_addrlen = INFINIBAND_ALEN;
947 dev->if_hdrlen = IPOIB_HEADER_LEN;
949 dev->if_init = ipoib_init;
950 dev->if_ioctl = ipoib_ioctl;
951 dev->if_start = ipoib_start;
952 dev->if_output = ipoib_output;
953 dev->if_input = ipoib_input;
954 dev->if_resolvemulti = ipoib_resolvemulti;
955 dev->if_baudrate = IF_Gbps(10);
956 dev->if_broadcastaddr = priv->broadcastaddr;
957 dev->if_snd.ifq_maxlen = ipoib_sendq_size * 2;
958 sdl = (struct sockaddr_dl *)dev->if_addr->ifa_addr;
959 sdl->sdl_type = IFT_INFINIBAND;
960 sdl->sdl_alen = dev->if_addrlen;
962 if_link_state_change(dev, LINK_STATE_DOWN);
963 bpfattach(dev, DLT_EN10MB, ETHER_HDR_LEN);
965 return dev->if_softc;
969 ipoib_set_dev_features(struct ipoib_dev_priv *priv, struct ib_device *hca)
971 struct ib_device_attr *device_attr = &hca->attrs;
973 priv->hca_caps = device_attr->device_cap_flags;
975 priv->dev->if_hwassist = 0;
976 priv->dev->if_capabilities = 0;
978 #ifndef CONFIG_INFINIBAND_IPOIB_CM
979 if (priv->hca_caps & IB_DEVICE_UD_IP_CSUM) {
980 set_bit(IPOIB_FLAG_CSUM, &priv->flags);
981 priv->dev->if_hwassist = CSUM_IP | CSUM_TCP | CSUM_UDP;
982 priv->dev->if_capabilities = IFCAP_HWCSUM | IFCAP_VLAN_HWCSUM;
986 if (priv->dev->features & NETIF_F_SG && priv->hca_caps & IB_DEVICE_UD_TSO) {
987 priv->dev->if_capabilities |= IFCAP_TSO4;
988 priv->dev->if_hwassist |= CSUM_TSO;
992 priv->dev->if_capabilities |=
993 IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_MTU | IFCAP_LINKSTATE;
994 priv->dev->if_capenable = priv->dev->if_capabilities;
1000 static struct ifnet *
1001 ipoib_add_port(const char *format, struct ib_device *hca, u8 port)
1003 struct ipoib_dev_priv *priv;
1004 struct ib_port_attr attr;
1005 int result = -ENOMEM;
1007 priv = ipoib_intf_alloc(format);
1009 goto alloc_mem_failed;
1011 if (!ib_query_port(hca, port, &attr))
1012 priv->max_ib_mtu = ib_mtu_enum_to_int(attr.max_mtu);
1014 printk(KERN_WARNING "%s: ib_query_port %d failed\n",
1016 goto device_init_failed;
1019 /* MTU will be reset when mcast join happens */
1020 priv->dev->if_mtu = IPOIB_UD_MTU(priv->max_ib_mtu);
1021 priv->mcast_mtu = priv->admin_mtu = priv->dev->if_mtu;
1023 result = ib_query_pkey(hca, port, 0, &priv->pkey);
1025 printk(KERN_WARNING "%s: ib_query_pkey port %d failed (ret = %d)\n",
1026 hca->name, port, result);
1027 goto device_init_failed;
1030 if (ipoib_set_dev_features(priv, hca))
1031 goto device_init_failed;
1034 * Set the full membership bit, so that we join the right
1035 * broadcast group, etc.
1037 priv->pkey |= 0x8000;
1039 priv->broadcastaddr[8] = priv->pkey >> 8;
1040 priv->broadcastaddr[9] = priv->pkey & 0xff;
1042 result = ib_query_gid(hca, port, 0, &priv->local_gid, NULL);
1044 printk(KERN_WARNING "%s: ib_query_gid port %d failed (ret = %d)\n",
1045 hca->name, port, result);
1046 goto device_init_failed;
1048 memcpy(IF_LLADDR(priv->dev) + 4, priv->local_gid.raw, sizeof (union ib_gid));
1050 result = ipoib_dev_init(priv, hca, port);
1052 printk(KERN_WARNING "%s: failed to initialize port %d (ret = %d)\n",
1053 hca->name, port, result);
1054 goto device_init_failed;
1056 if (ipoib_cm_admin_enabled(priv))
1057 priv->dev->if_mtu = IPOIB_CM_MTU(ipoib_cm_max_mtu(priv));
1059 INIT_IB_EVENT_HANDLER(&priv->event_handler,
1060 priv->ca, ipoib_event);
1061 result = ib_register_event_handler(&priv->event_handler);
1063 printk(KERN_WARNING "%s: ib_register_event_handler failed for "
1064 "port %d (ret = %d)\n",
1065 hca->name, port, result);
1068 if_printf(priv->dev, "Attached to %s port %d\n", hca->name, port);
1073 ipoib_dev_cleanup(priv);
1079 return ERR_PTR(result);
1083 ipoib_add_one(struct ib_device *device)
1085 struct list_head *dev_list;
1087 struct ipoib_dev_priv *priv;
1090 if (rdma_node_get_transport(device->node_type) != RDMA_TRANSPORT_IB)
1093 dev_list = kmalloc(sizeof *dev_list, GFP_KERNEL);
1097 INIT_LIST_HEAD(dev_list);
1099 if (device->node_type == RDMA_NODE_IB_SWITCH) {
1104 e = device->phys_port_cnt;
1107 for (p = s; p <= e; ++p) {
1108 if (rdma_port_get_link_layer(device, p) != IB_LINK_LAYER_INFINIBAND)
1110 dev = ipoib_add_port("ib", device, p);
1112 priv = dev->if_softc;
1113 list_add_tail(&priv->list, dev_list);
1117 ib_set_client_data(device, &ipoib_client, dev_list);
1121 ipoib_remove_one(struct ib_device *device, void *client_data)
1123 struct ipoib_dev_priv *priv, *tmp;
1124 struct list_head *dev_list = client_data;
1129 if (rdma_node_get_transport(device->node_type) != RDMA_TRANSPORT_IB)
1132 list_for_each_entry_safe(priv, tmp, dev_list, list) {
1133 if (rdma_port_get_link_layer(device, priv->port) != IB_LINK_LAYER_INFINIBAND)
1138 ib_unregister_event_handler(&priv->event_handler);
1140 /* dev_change_flags(priv->dev, priv->dev->flags & ~IFF_UP); */
1142 flush_workqueue(ipoib_workqueue);
1144 ipoib_dev_cleanup(priv);
1152 ipoib_match_dev_addr(const struct sockaddr *addr, struct net_device *dev)
1154 struct epoch_tracker et;
1158 CURVNET_SET(dev->if_vnet);
1159 NET_EPOCH_ENTER(et);
1160 CK_STAILQ_FOREACH(ifa, &dev->if_addrhead, ifa_link) {
1161 if (ifa->ifa_addr == NULL ||
1162 ifa->ifa_addr->sa_family != addr->sa_family ||
1163 ifa->ifa_addr->sa_len != addr->sa_len) {
1166 if (memcmp(ifa->ifa_addr, addr, addr->sa_len) == 0) {
1178 * ipoib_match_gid_pkey_addr - returns the number of IPoIB netdevs on
1179 * top a given ipoib device matching a pkey_index and address, if one
1182 * @found_net_dev: contains a matching net_device if the return value
1183 * >= 1, with a reference held.
1186 ipoib_match_gid_pkey_addr(struct ipoib_dev_priv *priv,
1187 const union ib_gid *gid, u16 pkey_index, const struct sockaddr *addr,
1188 struct net_device **found_net_dev)
1190 struct ipoib_dev_priv *child_priv;
1193 if (priv->pkey_index == pkey_index &&
1194 (!gid || !memcmp(gid, &priv->local_gid, sizeof(*gid)))) {
1195 if (addr == NULL || ipoib_match_dev_addr(addr, priv->dev) != 0) {
1196 if (*found_net_dev == NULL) {
1197 struct net_device *net_dev;
1199 if (priv->parent != NULL)
1200 net_dev = priv->parent;
1202 net_dev = priv->dev;
1203 *found_net_dev = net_dev;
1210 /* Check child interfaces */
1211 mutex_lock(&priv->vlan_mutex);
1212 list_for_each_entry(child_priv, &priv->child_intfs, list) {
1213 matches += ipoib_match_gid_pkey_addr(child_priv, gid,
1214 pkey_index, addr, found_net_dev);
1218 mutex_unlock(&priv->vlan_mutex);
1224 * __ipoib_get_net_dev_by_params - returns the number of matching
1225 * net_devs found (between 0 and 2). Also return the matching
1226 * net_device in the @net_dev parameter, holding a reference to the
1227 * net_device, if the number of matches >= 1
1230 __ipoib_get_net_dev_by_params(struct list_head *dev_list, u8 port,
1231 u16 pkey_index, const union ib_gid *gid,
1232 const struct sockaddr *addr, struct net_device **net_dev)
1234 struct ipoib_dev_priv *priv;
1239 list_for_each_entry(priv, dev_list, list) {
1240 if (priv->port != port)
1243 matches += ipoib_match_gid_pkey_addr(priv, gid, pkey_index,
1253 static struct net_device *
1254 ipoib_get_net_dev_by_params(struct ib_device *dev, u8 port, u16 pkey,
1255 const union ib_gid *gid, const struct sockaddr *addr, void *client_data)
1257 struct net_device *net_dev;
1258 struct list_head *dev_list = client_data;
1263 if (!rdma_protocol_ib(dev, port))
1266 ret = ib_find_cached_pkey(dev, port, pkey, &pkey_index);
1273 /* See if we can find a unique device matching the L2 parameters */
1274 matches = __ipoib_get_net_dev_by_params(dev_list, port, pkey_index,
1275 gid, NULL, &net_dev);
1286 /* Couldn't find a unique device with L2 parameters only. Use L3
1287 * address to uniquely match the net device */
1288 matches = __ipoib_get_net_dev_by_params(dev_list, port, pkey_index,
1289 gid, addr, &net_dev);
1294 dev_warn_ratelimited(&dev->dev,
1295 "duplicate IP address detected\n");
1303 ipoib_config_vlan(void *arg, struct ifnet *ifp, u_int16_t vtag)
1305 struct ipoib_dev_priv *parent;
1306 struct ipoib_dev_priv *priv;
1311 if (ifp->if_type != IFT_INFINIBAND)
1313 dev = VLAN_DEVAT(ifp, vtag);
1318 parent = ifp->if_softc;
1319 /* We only support 15 bits of pkey. */
1322 pkey = vtag | 0x8000; /* Set full membership bit. */
1323 if (pkey == parent->pkey)
1325 /* Check for dups */
1326 mutex_lock(&parent->vlan_mutex);
1327 list_for_each_entry(priv, &parent->child_intfs, list) {
1328 if (priv->pkey == pkey) {
1334 priv = ipoib_priv_alloc();
1336 priv->max_ib_mtu = parent->max_ib_mtu;
1337 priv->mcast_mtu = priv->admin_mtu = parent->dev->if_mtu;
1338 set_bit(IPOIB_FLAG_SUBINTERFACE, &priv->flags);
1339 error = ipoib_set_dev_features(priv, parent->ca);
1343 priv->broadcastaddr[8] = pkey >> 8;
1344 priv->broadcastaddr[9] = pkey & 0xff;
1345 dev->if_broadcastaddr = priv->broadcastaddr;
1346 error = ipoib_dev_init(priv, parent->ca, parent->port);
1349 priv->parent = parent->dev;
1350 list_add_tail(&priv->list, &parent->child_intfs);
1351 VLAN_SETCOOKIE(dev, priv);
1352 dev->if_start = ipoib_vlan_start;
1353 dev->if_drv_flags &= ~IFF_DRV_RUNNING;
1354 dev->if_hdrlen = IPOIB_HEADER_LEN;
1355 if (ifp->if_drv_flags & IFF_DRV_RUNNING)
1357 mutex_unlock(&parent->vlan_mutex);
1360 mutex_unlock(&parent->vlan_mutex);
1365 "failed to initialize subinterface: device %s, port %d vtag 0x%X",
1366 parent->ca->name, parent->port, vtag);
1371 ipoib_unconfig_vlan(void *arg, struct ifnet *ifp, u_int16_t vtag)
1373 struct ipoib_dev_priv *parent;
1374 struct ipoib_dev_priv *priv;
1378 if (ifp->if_type != IFT_INFINIBAND)
1381 dev = VLAN_DEVAT(ifp, vtag);
1383 VLAN_SETCOOKIE(dev, NULL);
1384 pkey = vtag | 0x8000;
1385 parent = ifp->if_softc;
1386 mutex_lock(&parent->vlan_mutex);
1387 list_for_each_entry(priv, &parent->child_intfs, list) {
1388 if (priv->pkey == pkey) {
1389 ipoib_dev_cleanup(priv);
1390 list_del(&priv->list);
1394 mutex_unlock(&parent->vlan_mutex);
1397 eventhandler_tag ipoib_vlan_attach;
1398 eventhandler_tag ipoib_vlan_detach;
1401 ipoib_init_module(void)
1405 ipoib_recvq_size = roundup_pow_of_two(ipoib_recvq_size);
1406 ipoib_recvq_size = min(ipoib_recvq_size, IPOIB_MAX_QUEUE_SIZE);
1407 ipoib_recvq_size = max(ipoib_recvq_size, IPOIB_MIN_QUEUE_SIZE);
1409 ipoib_sendq_size = roundup_pow_of_two(ipoib_sendq_size);
1410 ipoib_sendq_size = min(ipoib_sendq_size, IPOIB_MAX_QUEUE_SIZE);
1411 ipoib_sendq_size = max(ipoib_sendq_size, max(2 * MAX_SEND_CQE,
1412 IPOIB_MIN_QUEUE_SIZE));
1413 #ifdef CONFIG_INFINIBAND_IPOIB_CM
1414 ipoib_max_conn_qp = min(ipoib_max_conn_qp, IPOIB_CM_MAX_CONN_QP);
1417 ipoib_vlan_attach = EVENTHANDLER_REGISTER(vlan_config,
1418 ipoib_config_vlan, NULL, EVENTHANDLER_PRI_FIRST);
1419 ipoib_vlan_detach = EVENTHANDLER_REGISTER(vlan_unconfig,
1420 ipoib_unconfig_vlan, NULL, EVENTHANDLER_PRI_FIRST);
1423 * We create our own workqueue mainly because we want to be
1424 * able to flush it when devices are being removed. We can't
1425 * use schedule_work()/flush_scheduled_work() because both
1426 * unregister_netdev() and linkwatch_event take the rtnl lock,
1427 * so flush_scheduled_work() can deadlock during device
1430 ipoib_workqueue = create_singlethread_workqueue("ipoib");
1431 if (!ipoib_workqueue) {
1436 ib_sa_register_client(&ipoib_sa_client);
1438 ret = ib_register_client(&ipoib_client);
1445 ib_sa_unregister_client(&ipoib_sa_client);
1446 destroy_workqueue(ipoib_workqueue);
1453 ipoib_cleanup_module(void)
1456 EVENTHANDLER_DEREGISTER(vlan_config, ipoib_vlan_attach);
1457 EVENTHANDLER_DEREGISTER(vlan_unconfig, ipoib_vlan_detach);
1458 ib_unregister_client(&ipoib_client);
1459 ib_sa_unregister_client(&ipoib_sa_client);
1460 destroy_workqueue(ipoib_workqueue);
1464 * Infiniband output routine.
1467 ipoib_output(struct ifnet *ifp, struct mbuf *m,
1468 const struct sockaddr *dst, struct route *ro)
1470 u_char edst[INFINIBAND_ALEN];
1471 #if defined(INET) || defined(INET6)
1472 struct llentry *lle = NULL;
1474 struct ipoib_header *eh;
1475 int error = 0, is_gw = 0;
1479 is_gw = (ro->ro_flags & RT_HAS_GW) != 0;
1481 error = mac_ifnet_check_transmit(ifp, m);
1487 if (ifp->if_flags & IFF_MONITOR) {
1491 if (!((ifp->if_flags & IFF_UP) &&
1492 (ifp->if_drv_flags & IFF_DRV_RUNNING))) {
1497 switch (dst->sa_family) {
1500 if (lle != NULL && (lle->la_flags & LLE_VALID))
1501 memcpy(edst, lle->ll_addr, sizeof(edst));
1502 else if (m->m_flags & M_MCAST)
1503 ip_ib_mc_map(((struct sockaddr_in *)dst)->sin_addr.s_addr, ifp->if_broadcastaddr, edst);
1505 error = arpresolve(ifp, is_gw, m, dst, edst, NULL, NULL);
1507 return (error == EWOULDBLOCK ? 0 : error);
1508 type = htons(ETHERTYPE_IP);
1513 ah = mtod(m, struct arphdr *);
1514 ah->ar_hrd = htons(ARPHRD_INFINIBAND);
1516 switch(ntohs(ah->ar_op)) {
1517 case ARPOP_REVREQUEST:
1518 case ARPOP_REVREPLY:
1519 type = htons(ETHERTYPE_REVARP);
1524 type = htons(ETHERTYPE_ARP);
1528 if (m->m_flags & M_BCAST)
1529 bcopy(ifp->if_broadcastaddr, edst, INFINIBAND_ALEN);
1531 bcopy(ar_tha(ah), edst, INFINIBAND_ALEN);
1538 if (lle != NULL && (lle->la_flags & LLE_VALID))
1539 memcpy(edst, lle->ll_addr, sizeof(edst));
1540 else if (m->m_flags & M_MCAST)
1541 ipv6_ib_mc_map(&((struct sockaddr_in6 *)dst)->sin6_addr, ifp->if_broadcastaddr, edst);
1543 error = nd6_resolve(ifp, is_gw, m, dst, edst, NULL, NULL);
1546 type = htons(ETHERTYPE_IPV6);
1551 if_printf(ifp, "can't handle af%d\n", dst->sa_family);
1552 error = EAFNOSUPPORT;
1557 * Add local net header. If no space in first mbuf,
1560 M_PREPEND(m, IPOIB_HEADER_LEN, M_NOWAIT);
1565 eh = mtod(m, struct ipoib_header *);
1566 (void)memcpy(&eh->proto, &type, sizeof(eh->proto));
1567 (void)memcpy(&eh->hwaddr, edst, sizeof (edst));
1570 * Queue message on interface, update output statistics if
1571 * successful, and start output if interface not yet active.
1573 return ((ifp->if_transmit)(ifp, m));
1581 * Upper layer processing for a received Infiniband packet.
1584 ipoib_demux(struct ifnet *ifp, struct mbuf *m, u_short proto)
1590 * Tag the mbuf with an appropriate MAC label before any other
1591 * consumers can get to it.
1593 mac_ifnet_create_mbuf(ifp, m);
1595 /* Allow monitor mode to claim this frame, after stats are updated. */
1596 if (ifp->if_flags & IFF_MONITOR) {
1597 if_printf(ifp, "discard frame at IFF_MONITOR\n");
1602 * Dispatch frame to upper layer.
1611 if (ifp->if_flags & IFF_NOARP) {
1612 /* Discard packet if ARP is disabled on interface */
1620 case ETHERTYPE_IPV6:
1627 netisr_dispatch(isr, m);
1635 * Process a received Infiniband packet.
1638 ipoib_input(struct ifnet *ifp, struct mbuf *m)
1640 struct ipoib_header *eh;
1642 if ((ifp->if_flags & IFF_UP) == 0) {
1646 CURVNET_SET_QUIET(ifp->if_vnet);
1648 /* Let BPF have it before we strip the header. */
1650 eh = mtod(m, struct ipoib_header *);
1652 * Reset layer specific mbuf flags to avoid confusing upper layers.
1653 * Strip off Infiniband header.
1655 m->m_flags &= ~M_VLANTAG;
1657 m_adj(m, IPOIB_HEADER_LEN);
1659 if (IPOIB_IS_MULTICAST(eh->hwaddr)) {
1660 if (memcmp(eh->hwaddr, ifp->if_broadcastaddr,
1661 ifp->if_addrlen) == 0)
1662 m->m_flags |= M_BCAST;
1664 m->m_flags |= M_MCAST;
1665 if_inc_counter(ifp, IFCOUNTER_IMCASTS, 1);
1668 ipoib_demux(ifp, m, ntohs(eh->proto));
1673 ipoib_resolvemulti(struct ifnet *ifp, struct sockaddr **llsa,
1674 struct sockaddr *sa)
1676 struct sockaddr_dl *sdl;
1678 struct sockaddr_in *sin;
1681 struct sockaddr_in6 *sin6;
1685 switch(sa->sa_family) {
1688 * No mapping needed. Just check that it's a valid MC address.
1690 sdl = (struct sockaddr_dl *)sa;
1691 e_addr = LLADDR(sdl);
1692 if (!IPOIB_IS_MULTICAST(e_addr))
1693 return EADDRNOTAVAIL;
1699 sin = (struct sockaddr_in *)sa;
1700 if (!IN_MULTICAST(ntohl(sin->sin_addr.s_addr)))
1701 return EADDRNOTAVAIL;
1702 sdl = link_init_sdl(ifp, *llsa, IFT_INFINIBAND);
1703 sdl->sdl_alen = INFINIBAND_ALEN;
1704 e_addr = LLADDR(sdl);
1705 ip_ib_mc_map(sin->sin_addr.s_addr, ifp->if_broadcastaddr,
1707 *llsa = (struct sockaddr *)sdl;
1712 sin6 = (struct sockaddr_in6 *)sa;
1714 * An IP6 address of 0 means listen to all
1715 * of the multicast address used for IP6.
1716 * This has no meaning in ipoib.
1718 if (IN6_IS_ADDR_UNSPECIFIED(&sin6->sin6_addr))
1719 return EADDRNOTAVAIL;
1720 if (!IN6_IS_ADDR_MULTICAST(&sin6->sin6_addr))
1721 return EADDRNOTAVAIL;
1722 sdl = link_init_sdl(ifp, *llsa, IFT_INFINIBAND);
1723 sdl->sdl_alen = INFINIBAND_ALEN;
1724 e_addr = LLADDR(sdl);
1725 ipv6_ib_mc_map(&sin6->sin6_addr, ifp->if_broadcastaddr, e_addr);
1726 *llsa = (struct sockaddr *)sdl;
1731 return EAFNOSUPPORT;
1735 module_init(ipoib_init_module);
1736 module_exit(ipoib_cleanup_module);
1739 ipoib_evhand(module_t mod, int event, void *arg)
1744 static moduledata_t ipoib_mod = {
1746 .evhand = ipoib_evhand,
1749 DECLARE_MODULE(ipoib, ipoib_mod, SI_SUB_LAST, SI_ORDER_ANY);
1750 MODULE_DEPEND(ipoib, ibcore, 1, 1, 1);
1751 MODULE_DEPEND(ipoib, linuxkpi, 1, 1, 1);