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$");
42 static int ipoib_resolvemulti(struct ifnet *, struct sockaddr **,
46 #include <linux/module.h>
48 #include <linux/slab.h>
49 #include <linux/kernel.h>
50 #include <linux/vmalloc.h>
52 #include <linux/if_arp.h> /* For ARPHRD_xxx */
53 #include <linux/if_vlan.h>
57 #include <rdma/ib_cache.h>
59 MODULE_AUTHOR("Roland Dreier");
60 MODULE_DESCRIPTION("IP-over-InfiniBand net driver");
61 MODULE_LICENSE("Dual BSD/GPL");
63 int ipoib_sendq_size = IPOIB_TX_RING_SIZE;
64 int ipoib_recvq_size = IPOIB_RX_RING_SIZE;
66 module_param_named(send_queue_size, ipoib_sendq_size, int, 0444);
67 MODULE_PARM_DESC(send_queue_size, "Number of descriptors in send queue");
68 module_param_named(recv_queue_size, ipoib_recvq_size, int, 0444);
69 MODULE_PARM_DESC(recv_queue_size, "Number of descriptors in receive queue");
71 #ifdef CONFIG_INFINIBAND_IPOIB_DEBUG
72 int ipoib_debug_level = 1;
74 module_param_named(debug_level, ipoib_debug_level, int, 0644);
75 MODULE_PARM_DESC(debug_level, "Enable debug tracing if > 0");
78 struct ipoib_path_iter {
79 struct ipoib_dev_priv *priv;
80 struct ipoib_path path;
83 static const u8 ipv4_bcast_addr[] = {
84 0x00, 0xff, 0xff, 0xff,
85 0xff, 0x12, 0x40, 0x1b, 0x00, 0x00, 0x00, 0x00,
86 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff
89 struct workqueue_struct *ipoib_workqueue;
91 struct ib_sa_client ipoib_sa_client;
93 static void ipoib_add_one(struct ib_device *device);
94 static void ipoib_remove_one(struct ib_device *device, void *client_data);
95 static struct net_device *ipoib_get_net_dev_by_params(
96 struct ib_device *dev, u8 port, u16 pkey,
97 const union ib_gid *gid, const struct sockaddr *addr,
99 static void ipoib_start(struct ifnet *dev);
100 static int ipoib_output(struct ifnet *ifp, struct mbuf *m,
101 const struct sockaddr *dst, struct route *ro);
102 static int ipoib_ioctl(struct ifnet *ifp, u_long command, caddr_t data);
103 static void ipoib_input(struct ifnet *ifp, struct mbuf *m);
105 #define IPOIB_MTAP(_ifp, _m) \
107 if (bpf_peers_present((_ifp)->if_bpf)) { \
109 ipoib_mtap_mb((_ifp), (_m)); \
113 static struct unrhdr *ipoib_unrhdr;
116 ipoib_unrhdr_init(void *arg)
119 ipoib_unrhdr = new_unrhdr(0, 65535, NULL);
121 SYSINIT(ipoib_unrhdr_init, SI_SUB_KLD - 1, SI_ORDER_ANY, ipoib_unrhdr_init, NULL);
124 ipoib_unrhdr_uninit(void *arg)
127 if (ipoib_unrhdr != NULL) {
136 SYSUNINIT(ipoib_unrhdr_uninit, SI_SUB_KLD - 1, SI_ORDER_ANY, ipoib_unrhdr_uninit, NULL);
139 * This is for clients that have an ipoib_header in the mbuf.
142 ipoib_mtap_mb(struct ifnet *ifp, struct mbuf *mb)
144 struct ipoib_header *ih;
145 struct ether_header eh;
147 ih = mtod(mb, struct ipoib_header *);
148 eh.ether_type = ih->proto;
149 bcopy(ih->hwaddr, &eh.ether_dhost, ETHER_ADDR_LEN);
150 bzero(&eh.ether_shost, ETHER_ADDR_LEN);
151 mb->m_data += sizeof(struct ipoib_header);
152 mb->m_len -= sizeof(struct ipoib_header);
153 bpf_mtap2(ifp->if_bpf, &eh, sizeof(eh), mb);
154 mb->m_data -= sizeof(struct ipoib_header);
155 mb->m_len += sizeof(struct ipoib_header);
159 ipoib_mtap_proto(struct ifnet *ifp, struct mbuf *mb, uint16_t proto)
161 struct ether_header eh;
163 eh.ether_type = proto;
164 bzero(&eh.ether_shost, ETHER_ADDR_LEN);
165 bzero(&eh.ether_dhost, ETHER_ADDR_LEN);
166 bpf_mtap2(ifp->if_bpf, &eh, sizeof(eh), mb);
169 static struct ib_client ipoib_client = {
171 .add = ipoib_add_one,
172 .remove = ipoib_remove_one,
173 .get_net_dev_by_params = ipoib_get_net_dev_by_params,
177 ipoib_open(struct ipoib_dev_priv *priv)
179 struct ifnet *dev = priv->dev;
181 ipoib_dbg(priv, "bringing up interface\n");
183 set_bit(IPOIB_FLAG_ADMIN_UP, &priv->flags);
185 if (ipoib_pkey_dev_delay_open(priv))
188 if (ipoib_ib_dev_open(priv))
191 if (ipoib_ib_dev_up(priv))
194 if (!test_bit(IPOIB_FLAG_SUBINTERFACE, &priv->flags)) {
195 struct ipoib_dev_priv *cpriv;
197 /* Bring up any child interfaces too */
198 mutex_lock(&priv->vlan_mutex);
199 list_for_each_entry(cpriv, &priv->child_intfs, list)
200 if ((cpriv->dev->if_drv_flags & IFF_DRV_RUNNING) == 0)
202 mutex_unlock(&priv->vlan_mutex);
204 dev->if_drv_flags |= IFF_DRV_RUNNING;
205 dev->if_drv_flags &= ~IFF_DRV_OACTIVE;
210 ipoib_ib_dev_stop(priv, 1);
213 clear_bit(IPOIB_FLAG_ADMIN_UP, &priv->flags);
219 ipoib_init(void *arg)
222 struct ipoib_dev_priv *priv;
226 if ((dev->if_drv_flags & IFF_DRV_RUNNING) == 0)
228 queue_work(ipoib_workqueue, &priv->flush_light);
233 ipoib_stop(struct ipoib_dev_priv *priv)
235 struct ifnet *dev = priv->dev;
237 ipoib_dbg(priv, "stopping interface\n");
239 clear_bit(IPOIB_FLAG_ADMIN_UP, &priv->flags);
241 dev->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE);
243 ipoib_ib_dev_down(priv, 0);
244 ipoib_ib_dev_stop(priv, 0);
246 if (!test_bit(IPOIB_FLAG_SUBINTERFACE, &priv->flags)) {
247 struct ipoib_dev_priv *cpriv;
249 /* Bring down any child interfaces too */
250 mutex_lock(&priv->vlan_mutex);
251 list_for_each_entry(cpriv, &priv->child_intfs, list)
252 if ((cpriv->dev->if_drv_flags & IFF_DRV_RUNNING) != 0)
254 mutex_unlock(&priv->vlan_mutex);
261 ipoib_propagate_ifnet_mtu(struct ipoib_dev_priv *priv, int new_mtu,
269 if (ifp->if_mtu == new_mtu)
272 strlcpy(ifr.ifr_name, if_name(ifp), IFNAMSIZ);
273 ifr.ifr_mtu = new_mtu;
274 CURVNET_SET(ifp->if_vnet);
275 error = ifhwioctl(SIOCSIFMTU, ifp, (caddr_t)&ifr, curthread);
278 ifp->if_mtu = new_mtu;
285 ipoib_change_mtu(struct ipoib_dev_priv *priv, int new_mtu, bool propagate)
287 int error, prev_admin_mtu;
289 /* dev->if_mtu > 2K ==> connected mode */
290 if (ipoib_cm_admin_enabled(priv)) {
291 if (new_mtu > IPOIB_CM_MTU(ipoib_cm_max_mtu(priv)))
294 if (new_mtu > priv->mcast_mtu)
295 ipoib_warn(priv, "mtu > %d will cause multicast packet drops.\n",
298 return (ipoib_propagate_ifnet_mtu(priv, new_mtu, propagate));
301 if (new_mtu > IPOIB_UD_MTU(priv->max_ib_mtu))
304 prev_admin_mtu = priv->admin_mtu;
305 priv->admin_mtu = new_mtu;
306 error = ipoib_propagate_ifnet_mtu(priv, min(priv->mcast_mtu,
307 priv->admin_mtu), propagate);
309 /* check for MTU change to avoid infinite loop */
310 if (prev_admin_mtu != new_mtu)
311 queue_work(ipoib_workqueue, &priv->flush_light);
313 priv->admin_mtu = prev_admin_mtu;
318 ipoib_ioctl(struct ifnet *ifp, u_long command, caddr_t data)
320 struct ipoib_dev_priv *priv = ifp->if_softc;
321 struct ifaddr *ifa = (struct ifaddr *) data;
322 struct ifreq *ifr = (struct ifreq *) data;
325 /* check if detaching */
326 if (priv == NULL || priv->gone != 0)
331 if (ifp->if_flags & IFF_UP) {
332 if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0)
333 error = -ipoib_open(priv);
335 if (ifp->if_drv_flags & IFF_DRV_RUNNING)
340 if (ifp->if_drv_flags & IFF_DRV_RUNNING)
341 queue_work(ipoib_workqueue, &priv->restart_task);
344 ifp->if_flags |= IFF_UP;
346 switch (ifa->ifa_addr->sa_family) {
349 ifp->if_init(ifp->if_softc); /* before arpwhohas */
350 arp_ifinit(ifp, ifa);
354 ifp->if_init(ifp->if_softc);
360 bcopy(IF_LLADDR(ifp), &ifr->ifr_addr.sa_data[0],
366 * Set the interface MTU.
368 error = -ipoib_change_mtu(priv, ifr->ifr_mtu, false);
378 static struct ipoib_path *
379 __path_find(struct ipoib_dev_priv *priv, void *gid)
381 struct rb_node *n = priv->path_tree.rb_node;
382 struct ipoib_path *path;
386 path = rb_entry(n, struct ipoib_path, rb_node);
388 ret = memcmp(gid, path->pathrec.dgid.raw,
389 sizeof (union ib_gid));
403 __path_add(struct ipoib_dev_priv *priv, struct ipoib_path *path)
405 struct rb_node **n = &priv->path_tree.rb_node;
406 struct rb_node *pn = NULL;
407 struct ipoib_path *tpath;
412 tpath = rb_entry(pn, struct ipoib_path, rb_node);
414 ret = memcmp(path->pathrec.dgid.raw, tpath->pathrec.dgid.raw,
415 sizeof (union ib_gid));
424 rb_link_node(&path->rb_node, pn, n);
425 rb_insert_color(&path->rb_node, &priv->path_tree);
427 list_add_tail(&path->list, &priv->path_list);
433 ipoib_path_free(struct ipoib_dev_priv *priv, struct ipoib_path *path)
436 _IF_DRAIN(&path->queue);
439 ipoib_put_ah(path->ah);
440 if (ipoib_cm_get(path))
441 ipoib_cm_destroy_tx(ipoib_cm_get(path));
446 #ifdef CONFIG_INFINIBAND_IPOIB_DEBUG
448 struct ipoib_path_iter *
449 ipoib_path_iter_init(struct ipoib_dev_priv *priv)
451 struct ipoib_path_iter *iter;
453 iter = kmalloc(sizeof *iter, GFP_KERNEL);
458 memset(iter->path.pathrec.dgid.raw, 0, 16);
460 if (ipoib_path_iter_next(iter)) {
469 ipoib_path_iter_next(struct ipoib_path_iter *iter)
471 struct ipoib_dev_priv *priv = iter->priv;
473 struct ipoib_path *path;
476 spin_lock_irq(&priv->lock);
478 n = rb_first(&priv->path_tree);
481 path = rb_entry(n, struct ipoib_path, rb_node);
483 if (memcmp(iter->path.pathrec.dgid.raw, path->pathrec.dgid.raw,
484 sizeof (union ib_gid)) < 0) {
493 spin_unlock_irq(&priv->lock);
499 ipoib_path_iter_read(struct ipoib_path_iter *iter, struct ipoib_path *path)
504 #endif /* CONFIG_INFINIBAND_IPOIB_DEBUG */
507 ipoib_mark_paths_invalid(struct ipoib_dev_priv *priv)
509 struct ipoib_path *path, *tp;
511 spin_lock_irq(&priv->lock);
513 list_for_each_entry_safe(path, tp, &priv->path_list, list) {
514 ipoib_dbg(priv, "mark path LID 0x%04x GID %16D invalid\n",
515 be16_to_cpu(path->pathrec.dlid),
516 path->pathrec.dgid.raw, ":");
520 spin_unlock_irq(&priv->lock);
524 ipoib_flush_paths(struct ipoib_dev_priv *priv)
526 struct ipoib_path *path, *tp;
527 LIST_HEAD(remove_list);
530 spin_lock_irqsave(&priv->lock, flags);
532 list_splice_init(&priv->path_list, &remove_list);
534 list_for_each_entry(path, &remove_list, list)
535 rb_erase(&path->rb_node, &priv->path_tree);
537 list_for_each_entry_safe(path, tp, &remove_list, list) {
539 ib_sa_cancel_query(path->query_id, path->query);
540 spin_unlock_irqrestore(&priv->lock, flags);
541 wait_for_completion(&path->done);
542 ipoib_path_free(priv, path);
543 spin_lock_irqsave(&priv->lock, flags);
546 spin_unlock_irqrestore(&priv->lock, flags);
550 path_rec_completion(int status, struct ib_sa_path_rec *pathrec, void *path_ptr)
552 struct ipoib_path *path = path_ptr;
553 struct ipoib_dev_priv *priv = path->priv;
554 struct ifnet *dev = priv->dev;
555 struct ipoib_ah *ah = NULL;
556 struct ipoib_ah *old_ah = NULL;
557 struct ifqueue mbqueue;
562 ipoib_dbg(priv, "PathRec LID 0x%04x for GID %16D\n",
563 be16_to_cpu(pathrec->dlid), pathrec->dgid.raw, ":");
565 ipoib_dbg(priv, "PathRec status %d for GID %16D\n",
566 status, path->pathrec.dgid.raw, ":");
568 bzero(&mbqueue, sizeof(mbqueue));
571 struct ib_ah_attr av;
573 if (!ib_init_ah_from_path(priv->ca, priv->port, pathrec, &av))
574 ah = ipoib_create_ah(priv, priv->pd, &av);
577 spin_lock_irqsave(&priv->lock, flags);
580 path->pathrec = *pathrec;
585 ipoib_dbg(priv, "created address handle %p for LID 0x%04x, SL %d\n",
586 ah, be16_to_cpu(pathrec->dlid), pathrec->sl);
589 _IF_DEQUEUE(&path->queue, mb);
592 _IF_ENQUEUE(&mbqueue, mb);
595 #ifdef CONFIG_INFINIBAND_IPOIB_CM
596 if (ipoib_cm_enabled(priv, path->hwaddr) && !ipoib_cm_get(path))
597 ipoib_cm_set(path, ipoib_cm_create_tx(priv, path));
604 complete(&path->done);
606 spin_unlock_irqrestore(&priv->lock, flags);
609 ipoib_put_ah(old_ah);
612 _IF_DEQUEUE(&mbqueue, mb);
615 mb->m_pkthdr.rcvif = dev;
616 if (dev->if_transmit(dev, mb))
617 ipoib_warn(priv, "dev_queue_xmit failed "
618 "to requeue packet\n");
622 static struct ipoib_path *
623 path_rec_create(struct ipoib_dev_priv *priv, uint8_t *hwaddr)
625 struct ipoib_path *path;
627 if (!priv->broadcast)
630 path = kzalloc(sizeof *path, GFP_ATOMIC);
636 bzero(&path->queue, sizeof(path->queue));
638 #ifdef CONFIG_INFINIBAND_IPOIB_CM
639 memcpy(&path->hwaddr, hwaddr, INFINIBAND_ALEN);
641 memcpy(path->pathrec.dgid.raw, &hwaddr[4], sizeof (union ib_gid));
642 path->pathrec.sgid = priv->local_gid;
643 path->pathrec.pkey = cpu_to_be16(priv->pkey);
644 path->pathrec.numb_path = 1;
645 path->pathrec.traffic_class = priv->broadcast->mcmember.traffic_class;
651 path_rec_start(struct ipoib_dev_priv *priv, struct ipoib_path *path)
653 struct ifnet *dev = priv->dev;
655 ib_sa_comp_mask comp_mask = IB_SA_PATH_REC_MTU_SELECTOR | IB_SA_PATH_REC_MTU;
656 struct ib_sa_path_rec p_rec;
658 p_rec = path->pathrec;
659 p_rec.mtu_selector = IB_SA_GT;
661 switch (roundup_pow_of_two(dev->if_mtu + IPOIB_ENCAP_LEN)) {
663 p_rec.mtu = IB_MTU_256;
666 p_rec.mtu = IB_MTU_512;
669 p_rec.mtu = IB_MTU_1024;
672 p_rec.mtu = IB_MTU_2048;
675 /* Wildcard everything */
678 p_rec.mtu_selector = 0;
681 ipoib_dbg(priv, "Start path record lookup for %16D MTU > %d\n",
683 comp_mask ? ib_mtu_enum_to_int(p_rec.mtu) : 0);
685 init_completion(&path->done);
688 ib_sa_path_rec_get(&ipoib_sa_client, priv->ca, priv->port,
690 IB_SA_PATH_REC_DGID |
691 IB_SA_PATH_REC_SGID |
692 IB_SA_PATH_REC_NUMB_PATH |
693 IB_SA_PATH_REC_TRAFFIC_CLASS |
698 if (path->query_id < 0) {
699 ipoib_warn(priv, "ib_sa_path_rec_get failed: %d\n", path->query_id);
701 complete(&path->done);
702 return path->query_id;
709 ipoib_unicast_send(struct mbuf *mb, struct ipoib_dev_priv *priv, struct ipoib_header *eh)
711 struct ipoib_path *path;
713 path = __path_find(priv, eh->hwaddr + 4);
714 if (!path || !path->valid) {
718 path = path_rec_create(priv, eh->hwaddr);
722 if (_IF_QLEN(&path->queue) < IPOIB_MAX_PATH_REC_QUEUE)
723 _IF_ENQUEUE(&path->queue, mb);
725 if_inc_counter(priv->dev, IFCOUNTER_OERRORS, 1);
729 if (!path->query && path_rec_start(priv, path)) {
730 spin_unlock_irqrestore(&priv->lock, flags);
732 ipoib_path_free(priv, path);
735 __path_add(priv, path);
737 if_inc_counter(priv->dev, IFCOUNTER_OERRORS, 1);
744 if (ipoib_cm_get(path) && ipoib_cm_up(path)) {
745 ipoib_cm_send(priv, mb, ipoib_cm_get(path));
746 } else if (path->ah) {
747 ipoib_send(priv, mb, path->ah, IPOIB_QPN(eh->hwaddr));
748 } else if ((path->query || !path_rec_start(priv, path)) &&
749 path->queue.ifq_len < IPOIB_MAX_PATH_REC_QUEUE) {
750 _IF_ENQUEUE(&path->queue, mb);
752 if_inc_counter(priv->dev, IFCOUNTER_OERRORS, 1);
758 ipoib_send_one(struct ipoib_dev_priv *priv, struct mbuf *mb)
760 struct ipoib_header *eh;
762 eh = mtod(mb, struct ipoib_header *);
763 if (IPOIB_IS_MULTICAST(eh->hwaddr)) {
764 /* Add in the P_Key for multicast*/
765 eh->hwaddr[8] = (priv->pkey >> 8) & 0xff;
766 eh->hwaddr[9] = priv->pkey & 0xff;
768 ipoib_mcast_send(priv, eh->hwaddr + 4, mb);
770 ipoib_unicast_send(mb, priv, eh);
777 _ipoib_start(struct ifnet *dev, struct ipoib_dev_priv *priv)
781 if ((dev->if_drv_flags & (IFF_DRV_RUNNING|IFF_DRV_OACTIVE)) !=
785 spin_lock(&priv->lock);
786 while (!IFQ_DRV_IS_EMPTY(&dev->if_snd) &&
787 (dev->if_drv_flags & IFF_DRV_OACTIVE) == 0) {
788 IFQ_DRV_DEQUEUE(&dev->if_snd, mb);
792 ipoib_send_one(priv, mb);
794 spin_unlock(&priv->lock);
798 ipoib_start(struct ifnet *dev)
800 _ipoib_start(dev, dev->if_softc);
804 ipoib_vlan_start(struct ifnet *dev)
806 struct ipoib_dev_priv *priv;
809 priv = VLAN_COOKIE(dev);
811 return _ipoib_start(dev, priv);
812 while (!IFQ_DRV_IS_EMPTY(&dev->if_snd)) {
813 IFQ_DRV_DEQUEUE(&dev->if_snd, mb);
817 if_inc_counter(dev, IFCOUNTER_OERRORS, 1);
822 ipoib_dev_init(struct ipoib_dev_priv *priv, struct ib_device *ca, int port)
825 /* Allocate RX/TX "rings" to hold queued mbs */
826 priv->rx_ring = kzalloc(ipoib_recvq_size * sizeof *priv->rx_ring,
828 if (!priv->rx_ring) {
829 printk(KERN_WARNING "%s: failed to allocate RX ring (%d entries)\n",
830 ca->name, ipoib_recvq_size);
834 priv->tx_ring = kzalloc(ipoib_sendq_size * sizeof *priv->tx_ring, GFP_KERNEL);
835 if (!priv->tx_ring) {
836 printk(KERN_WARNING "%s: failed to allocate TX ring (%d entries)\n",
837 ca->name, ipoib_sendq_size);
838 goto out_rx_ring_cleanup;
840 memset(priv->tx_ring, 0, ipoib_sendq_size * sizeof *priv->tx_ring);
842 /* priv->tx_head, tx_tail & tx_outstanding are already 0 */
844 if (ipoib_ib_dev_init(priv, ca, port))
845 goto out_tx_ring_cleanup;
850 kfree(priv->tx_ring);
853 kfree(priv->rx_ring);
860 ipoib_detach(struct ipoib_dev_priv *priv)
865 if (!test_bit(IPOIB_FLAG_SUBINTERFACE, &priv->flags)) {
870 free_unr(ipoib_unrhdr, priv->unit);
872 VLAN_SETCOOKIE(priv->dev, NULL);
878 ipoib_dev_cleanup(struct ipoib_dev_priv *priv)
880 struct ipoib_dev_priv *cpriv, *tcpriv;
882 /* Delete any child interfaces first */
883 list_for_each_entry_safe(cpriv, tcpriv, &priv->child_intfs, list) {
884 ipoib_dev_cleanup(cpriv);
888 ipoib_ib_dev_cleanup(priv);
890 kfree(priv->rx_ring);
891 kfree(priv->tx_ring);
893 priv->rx_ring = NULL;
894 priv->tx_ring = NULL;
897 static struct ipoib_dev_priv *
898 ipoib_priv_alloc(void)
900 struct ipoib_dev_priv *priv;
902 priv = malloc(sizeof(struct ipoib_dev_priv), M_TEMP, M_ZERO|M_WAITOK);
903 spin_lock_init(&priv->lock);
904 spin_lock_init(&priv->drain_lock);
905 mutex_init(&priv->vlan_mutex);
906 INIT_LIST_HEAD(&priv->path_list);
907 INIT_LIST_HEAD(&priv->child_intfs);
908 INIT_LIST_HEAD(&priv->dead_ahs);
909 INIT_LIST_HEAD(&priv->multicast_list);
910 INIT_DELAYED_WORK(&priv->pkey_poll_task, ipoib_pkey_poll);
911 INIT_DELAYED_WORK(&priv->mcast_task, ipoib_mcast_join_task);
912 INIT_WORK(&priv->carrier_on_task, ipoib_mcast_carrier_on_task);
913 INIT_WORK(&priv->flush_light, ipoib_ib_dev_flush_light);
914 INIT_WORK(&priv->flush_normal, ipoib_ib_dev_flush_normal);
915 INIT_WORK(&priv->flush_heavy, ipoib_ib_dev_flush_heavy);
916 INIT_WORK(&priv->restart_task, ipoib_mcast_restart_task);
917 INIT_DELAYED_WORK(&priv->ah_reap_task, ipoib_reap_ah);
918 memcpy(priv->broadcastaddr, ipv4_bcast_addr, INFINIBAND_ALEN);
923 struct ipoib_dev_priv *
924 ipoib_intf_alloc(const char *name)
926 struct ipoib_dev_priv *priv;
927 struct sockaddr_dl *sdl;
930 priv = ipoib_priv_alloc();
931 dev = priv->dev = if_alloc(IFT_INFINIBAND);
936 dev->if_softc = priv;
937 priv->unit = alloc_unr(ipoib_unrhdr);
938 if (priv->unit == -1) {
943 if_initname(dev, name, priv->unit);
944 dev->if_flags = IFF_BROADCAST | IFF_MULTICAST;
945 dev->if_addrlen = INFINIBAND_ALEN;
946 dev->if_hdrlen = IPOIB_HEADER_LEN;
948 dev->if_init = ipoib_init;
949 dev->if_ioctl = ipoib_ioctl;
950 dev->if_start = ipoib_start;
951 dev->if_output = ipoib_output;
952 dev->if_input = ipoib_input;
953 dev->if_resolvemulti = ipoib_resolvemulti;
954 dev->if_baudrate = IF_Gbps(10);
955 dev->if_broadcastaddr = priv->broadcastaddr;
956 dev->if_snd.ifq_maxlen = ipoib_sendq_size * 2;
957 sdl = (struct sockaddr_dl *)dev->if_addr->ifa_addr;
958 sdl->sdl_type = IFT_INFINIBAND;
959 sdl->sdl_alen = dev->if_addrlen;
961 if_link_state_change(dev, LINK_STATE_DOWN);
962 bpfattach(dev, DLT_EN10MB, ETHER_HDR_LEN);
964 return dev->if_softc;
968 ipoib_set_dev_features(struct ipoib_dev_priv *priv, struct ib_device *hca)
970 struct ib_device_attr *device_attr = &hca->attrs;
972 priv->hca_caps = device_attr->device_cap_flags;
974 priv->dev->if_hwassist = 0;
975 priv->dev->if_capabilities = 0;
977 #ifndef CONFIG_INFINIBAND_IPOIB_CM
978 if (priv->hca_caps & IB_DEVICE_UD_IP_CSUM) {
979 set_bit(IPOIB_FLAG_CSUM, &priv->flags);
980 priv->dev->if_hwassist = CSUM_IP | CSUM_TCP | CSUM_UDP;
981 priv->dev->if_capabilities = IFCAP_HWCSUM | IFCAP_VLAN_HWCSUM;
985 if (priv->dev->features & NETIF_F_SG && priv->hca_caps & IB_DEVICE_UD_TSO) {
986 priv->dev->if_capabilities |= IFCAP_TSO4;
987 priv->dev->if_hwassist |= CSUM_TSO;
991 priv->dev->if_capabilities |=
992 IFCAP_VLAN_HWTAGGING | IFCAP_VLAN_MTU | IFCAP_LINKSTATE;
993 priv->dev->if_capenable = priv->dev->if_capabilities;
999 static struct ifnet *
1000 ipoib_add_port(const char *format, struct ib_device *hca, u8 port)
1002 struct ipoib_dev_priv *priv;
1003 struct ib_port_attr attr;
1004 int result = -ENOMEM;
1006 priv = ipoib_intf_alloc(format);
1008 goto alloc_mem_failed;
1010 if (!ib_query_port(hca, port, &attr))
1011 priv->max_ib_mtu = ib_mtu_enum_to_int(attr.max_mtu);
1013 printk(KERN_WARNING "%s: ib_query_port %d failed\n",
1015 goto device_init_failed;
1018 /* MTU will be reset when mcast join happens */
1019 priv->dev->if_mtu = IPOIB_UD_MTU(priv->max_ib_mtu);
1020 priv->mcast_mtu = priv->admin_mtu = priv->dev->if_mtu;
1022 result = ib_query_pkey(hca, port, 0, &priv->pkey);
1024 printk(KERN_WARNING "%s: ib_query_pkey port %d failed (ret = %d)\n",
1025 hca->name, port, result);
1026 goto device_init_failed;
1029 if (ipoib_set_dev_features(priv, hca))
1030 goto device_init_failed;
1033 * Set the full membership bit, so that we join the right
1034 * broadcast group, etc.
1036 priv->pkey |= 0x8000;
1038 priv->broadcastaddr[8] = priv->pkey >> 8;
1039 priv->broadcastaddr[9] = priv->pkey & 0xff;
1041 result = ib_query_gid(hca, port, 0, &priv->local_gid, NULL);
1043 printk(KERN_WARNING "%s: ib_query_gid port %d failed (ret = %d)\n",
1044 hca->name, port, result);
1045 goto device_init_failed;
1047 memcpy(IF_LLADDR(priv->dev) + 4, priv->local_gid.raw, sizeof (union ib_gid));
1049 result = ipoib_dev_init(priv, hca, port);
1051 printk(KERN_WARNING "%s: failed to initialize port %d (ret = %d)\n",
1052 hca->name, port, result);
1053 goto device_init_failed;
1055 if (ipoib_cm_admin_enabled(priv))
1056 priv->dev->if_mtu = IPOIB_CM_MTU(ipoib_cm_max_mtu(priv));
1058 INIT_IB_EVENT_HANDLER(&priv->event_handler,
1059 priv->ca, ipoib_event);
1060 result = ib_register_event_handler(&priv->event_handler);
1062 printk(KERN_WARNING "%s: ib_register_event_handler failed for "
1063 "port %d (ret = %d)\n",
1064 hca->name, port, result);
1067 if_printf(priv->dev, "Attached to %s port %d\n", hca->name, port);
1072 ipoib_dev_cleanup(priv);
1078 return ERR_PTR(result);
1082 ipoib_add_one(struct ib_device *device)
1084 struct list_head *dev_list;
1086 struct ipoib_dev_priv *priv;
1089 if (rdma_node_get_transport(device->node_type) != RDMA_TRANSPORT_IB)
1092 dev_list = kmalloc(sizeof *dev_list, GFP_KERNEL);
1096 INIT_LIST_HEAD(dev_list);
1098 if (device->node_type == RDMA_NODE_IB_SWITCH) {
1103 e = device->phys_port_cnt;
1106 for (p = s; p <= e; ++p) {
1107 if (rdma_port_get_link_layer(device, p) != IB_LINK_LAYER_INFINIBAND)
1109 dev = ipoib_add_port("ib", device, p);
1111 priv = dev->if_softc;
1112 list_add_tail(&priv->list, dev_list);
1116 ib_set_client_data(device, &ipoib_client, dev_list);
1120 ipoib_remove_one(struct ib_device *device, void *client_data)
1122 struct ipoib_dev_priv *priv, *tmp;
1123 struct list_head *dev_list = client_data;
1128 if (rdma_node_get_transport(device->node_type) != RDMA_TRANSPORT_IB)
1131 list_for_each_entry_safe(priv, tmp, dev_list, list) {
1132 if (rdma_port_get_link_layer(device, priv->port) != IB_LINK_LAYER_INFINIBAND)
1137 ib_unregister_event_handler(&priv->event_handler);
1139 /* dev_change_flags(priv->dev, priv->dev->flags & ~IFF_UP); */
1141 flush_workqueue(ipoib_workqueue);
1143 ipoib_dev_cleanup(priv);
1151 ipoib_match_dev_addr(const struct sockaddr *addr, struct net_device *dev)
1153 struct epoch_tracker et;
1157 CURVNET_SET(dev->if_vnet);
1158 NET_EPOCH_ENTER(et);
1159 CK_STAILQ_FOREACH(ifa, &dev->if_addrhead, ifa_link) {
1160 if (ifa->ifa_addr == NULL ||
1161 ifa->ifa_addr->sa_family != addr->sa_family ||
1162 ifa->ifa_addr->sa_len != addr->sa_len) {
1165 if (memcmp(ifa->ifa_addr, addr, addr->sa_len) == 0) {
1177 * ipoib_match_gid_pkey_addr - returns the number of IPoIB netdevs on
1178 * top a given ipoib device matching a pkey_index and address, if one
1181 * @found_net_dev: contains a matching net_device if the return value
1182 * >= 1, with a reference held.
1185 ipoib_match_gid_pkey_addr(struct ipoib_dev_priv *priv,
1186 const union ib_gid *gid, u16 pkey_index, const struct sockaddr *addr,
1187 struct net_device **found_net_dev)
1189 struct ipoib_dev_priv *child_priv;
1192 if (priv->pkey_index == pkey_index &&
1193 (!gid || !memcmp(gid, &priv->local_gid, sizeof(*gid)))) {
1194 if (addr == NULL || ipoib_match_dev_addr(addr, priv->dev) != 0) {
1195 if (*found_net_dev == NULL) {
1196 struct net_device *net_dev;
1198 if (priv->parent != NULL)
1199 net_dev = priv->parent;
1201 net_dev = priv->dev;
1202 *found_net_dev = net_dev;
1209 /* Check child interfaces */
1210 mutex_lock(&priv->vlan_mutex);
1211 list_for_each_entry(child_priv, &priv->child_intfs, list) {
1212 matches += ipoib_match_gid_pkey_addr(child_priv, gid,
1213 pkey_index, addr, found_net_dev);
1217 mutex_unlock(&priv->vlan_mutex);
1223 * __ipoib_get_net_dev_by_params - returns the number of matching
1224 * net_devs found (between 0 and 2). Also return the matching
1225 * net_device in the @net_dev parameter, holding a reference to the
1226 * net_device, if the number of matches >= 1
1229 __ipoib_get_net_dev_by_params(struct list_head *dev_list, u8 port,
1230 u16 pkey_index, const union ib_gid *gid,
1231 const struct sockaddr *addr, struct net_device **net_dev)
1233 struct ipoib_dev_priv *priv;
1238 list_for_each_entry(priv, dev_list, list) {
1239 if (priv->port != port)
1242 matches += ipoib_match_gid_pkey_addr(priv, gid, pkey_index,
1252 static struct net_device *
1253 ipoib_get_net_dev_by_params(struct ib_device *dev, u8 port, u16 pkey,
1254 const union ib_gid *gid, const struct sockaddr *addr, void *client_data)
1256 struct net_device *net_dev;
1257 struct list_head *dev_list = client_data;
1262 if (!rdma_protocol_ib(dev, port))
1265 ret = ib_find_cached_pkey(dev, port, pkey, &pkey_index);
1272 /* See if we can find a unique device matching the L2 parameters */
1273 matches = __ipoib_get_net_dev_by_params(dev_list, port, pkey_index,
1274 gid, NULL, &net_dev);
1285 /* Couldn't find a unique device with L2 parameters only. Use L3
1286 * address to uniquely match the net device */
1287 matches = __ipoib_get_net_dev_by_params(dev_list, port, pkey_index,
1288 gid, addr, &net_dev);
1293 dev_warn_ratelimited(&dev->dev,
1294 "duplicate IP address detected\n");
1302 ipoib_config_vlan(void *arg, struct ifnet *ifp, u_int16_t vtag)
1304 struct ipoib_dev_priv *parent;
1305 struct ipoib_dev_priv *priv;
1310 if (ifp->if_type != IFT_INFINIBAND)
1312 dev = VLAN_DEVAT(ifp, vtag);
1317 parent = ifp->if_softc;
1318 /* We only support 15 bits of pkey. */
1321 pkey = vtag | 0x8000; /* Set full membership bit. */
1322 if (pkey == parent->pkey)
1324 /* Check for dups */
1325 mutex_lock(&parent->vlan_mutex);
1326 list_for_each_entry(priv, &parent->child_intfs, list) {
1327 if (priv->pkey == pkey) {
1333 priv = ipoib_priv_alloc();
1335 priv->max_ib_mtu = parent->max_ib_mtu;
1336 priv->mcast_mtu = priv->admin_mtu = parent->dev->if_mtu;
1337 set_bit(IPOIB_FLAG_SUBINTERFACE, &priv->flags);
1338 error = ipoib_set_dev_features(priv, parent->ca);
1342 priv->broadcastaddr[8] = pkey >> 8;
1343 priv->broadcastaddr[9] = pkey & 0xff;
1344 dev->if_broadcastaddr = priv->broadcastaddr;
1345 error = ipoib_dev_init(priv, parent->ca, parent->port);
1348 priv->parent = parent->dev;
1349 list_add_tail(&priv->list, &parent->child_intfs);
1350 VLAN_SETCOOKIE(dev, priv);
1351 dev->if_start = ipoib_vlan_start;
1352 dev->if_drv_flags &= ~IFF_DRV_RUNNING;
1353 dev->if_hdrlen = IPOIB_HEADER_LEN;
1354 if (ifp->if_drv_flags & IFF_DRV_RUNNING)
1356 mutex_unlock(&parent->vlan_mutex);
1359 mutex_unlock(&parent->vlan_mutex);
1364 "failed to initialize subinterface: device %s, port %d vtag 0x%X",
1365 parent->ca->name, parent->port, vtag);
1370 ipoib_unconfig_vlan(void *arg, struct ifnet *ifp, u_int16_t vtag)
1372 struct ipoib_dev_priv *parent;
1373 struct ipoib_dev_priv *priv;
1377 if (ifp->if_type != IFT_INFINIBAND)
1380 dev = VLAN_DEVAT(ifp, vtag);
1382 VLAN_SETCOOKIE(dev, NULL);
1383 pkey = vtag | 0x8000;
1384 parent = ifp->if_softc;
1385 mutex_lock(&parent->vlan_mutex);
1386 list_for_each_entry(priv, &parent->child_intfs, list) {
1387 if (priv->pkey == pkey) {
1388 ipoib_dev_cleanup(priv);
1389 list_del(&priv->list);
1393 mutex_unlock(&parent->vlan_mutex);
1396 eventhandler_tag ipoib_vlan_attach;
1397 eventhandler_tag ipoib_vlan_detach;
1400 ipoib_init_module(void)
1404 ipoib_recvq_size = roundup_pow_of_two(ipoib_recvq_size);
1405 ipoib_recvq_size = min(ipoib_recvq_size, IPOIB_MAX_QUEUE_SIZE);
1406 ipoib_recvq_size = max(ipoib_recvq_size, IPOIB_MIN_QUEUE_SIZE);
1408 ipoib_sendq_size = roundup_pow_of_two(ipoib_sendq_size);
1409 ipoib_sendq_size = min(ipoib_sendq_size, IPOIB_MAX_QUEUE_SIZE);
1410 ipoib_sendq_size = max(ipoib_sendq_size, max(2 * MAX_SEND_CQE,
1411 IPOIB_MIN_QUEUE_SIZE));
1412 #ifdef CONFIG_INFINIBAND_IPOIB_CM
1413 ipoib_max_conn_qp = min(ipoib_max_conn_qp, IPOIB_CM_MAX_CONN_QP);
1416 ipoib_vlan_attach = EVENTHANDLER_REGISTER(vlan_config,
1417 ipoib_config_vlan, NULL, EVENTHANDLER_PRI_FIRST);
1418 ipoib_vlan_detach = EVENTHANDLER_REGISTER(vlan_unconfig,
1419 ipoib_unconfig_vlan, NULL, EVENTHANDLER_PRI_FIRST);
1422 * We create our own workqueue mainly because we want to be
1423 * able to flush it when devices are being removed. We can't
1424 * use schedule_work()/flush_scheduled_work() because both
1425 * unregister_netdev() and linkwatch_event take the rtnl lock,
1426 * so flush_scheduled_work() can deadlock during device
1429 ipoib_workqueue = create_singlethread_workqueue("ipoib");
1430 if (!ipoib_workqueue) {
1435 ib_sa_register_client(&ipoib_sa_client);
1437 ret = ib_register_client(&ipoib_client);
1444 ib_sa_unregister_client(&ipoib_sa_client);
1445 destroy_workqueue(ipoib_workqueue);
1452 ipoib_cleanup_module(void)
1455 EVENTHANDLER_DEREGISTER(vlan_config, ipoib_vlan_attach);
1456 EVENTHANDLER_DEREGISTER(vlan_unconfig, ipoib_vlan_detach);
1457 ib_unregister_client(&ipoib_client);
1458 ib_sa_unregister_client(&ipoib_sa_client);
1459 destroy_workqueue(ipoib_workqueue);
1463 * Infiniband output routine.
1466 ipoib_output(struct ifnet *ifp, struct mbuf *m,
1467 const struct sockaddr *dst, struct route *ro)
1469 u_char edst[INFINIBAND_ALEN];
1470 #if defined(INET) || defined(INET6)
1471 struct llentry *lle = NULL;
1473 struct ipoib_header *eh;
1474 int error = 0, is_gw = 0;
1478 is_gw = (ro->ro_flags & RT_HAS_GW) != 0;
1480 error = mac_ifnet_check_transmit(ifp, m);
1486 if (ifp->if_flags & IFF_MONITOR) {
1490 if (!((ifp->if_flags & IFF_UP) &&
1491 (ifp->if_drv_flags & IFF_DRV_RUNNING))) {
1496 switch (dst->sa_family) {
1499 if (lle != NULL && (lle->la_flags & LLE_VALID))
1500 memcpy(edst, lle->ll_addr, sizeof(edst));
1501 else if (m->m_flags & M_MCAST)
1502 ip_ib_mc_map(((struct sockaddr_in *)dst)->sin_addr.s_addr, ifp->if_broadcastaddr, edst);
1504 error = arpresolve(ifp, is_gw, m, dst, edst, NULL, NULL);
1506 return (error == EWOULDBLOCK ? 0 : error);
1507 type = htons(ETHERTYPE_IP);
1512 ah = mtod(m, struct arphdr *);
1513 ah->ar_hrd = htons(ARPHRD_INFINIBAND);
1515 switch(ntohs(ah->ar_op)) {
1516 case ARPOP_REVREQUEST:
1517 case ARPOP_REVREPLY:
1518 type = htons(ETHERTYPE_REVARP);
1523 type = htons(ETHERTYPE_ARP);
1527 if (m->m_flags & M_BCAST)
1528 bcopy(ifp->if_broadcastaddr, edst, INFINIBAND_ALEN);
1530 bcopy(ar_tha(ah), edst, INFINIBAND_ALEN);
1537 if (lle != NULL && (lle->la_flags & LLE_VALID))
1538 memcpy(edst, lle->ll_addr, sizeof(edst));
1539 else if (m->m_flags & M_MCAST)
1540 ipv6_ib_mc_map(&((struct sockaddr_in6 *)dst)->sin6_addr, ifp->if_broadcastaddr, edst);
1542 error = nd6_resolve(ifp, is_gw, m, dst, edst, NULL, NULL);
1545 type = htons(ETHERTYPE_IPV6);
1550 if_printf(ifp, "can't handle af%d\n", dst->sa_family);
1551 error = EAFNOSUPPORT;
1556 * Add local net header. If no space in first mbuf,
1559 M_PREPEND(m, IPOIB_HEADER_LEN, M_NOWAIT);
1564 eh = mtod(m, struct ipoib_header *);
1565 (void)memcpy(&eh->proto, &type, sizeof(eh->proto));
1566 (void)memcpy(&eh->hwaddr, edst, sizeof (edst));
1569 * Queue message on interface, update output statistics if
1570 * successful, and start output if interface not yet active.
1572 return ((ifp->if_transmit)(ifp, m));
1580 * Upper layer processing for a received Infiniband packet.
1583 ipoib_demux(struct ifnet *ifp, struct mbuf *m, u_short proto)
1589 * Tag the mbuf with an appropriate MAC label before any other
1590 * consumers can get to it.
1592 mac_ifnet_create_mbuf(ifp, m);
1594 /* Allow monitor mode to claim this frame, after stats are updated. */
1595 if (ifp->if_flags & IFF_MONITOR) {
1596 if_printf(ifp, "discard frame at IFF_MONITOR\n");
1601 * Dispatch frame to upper layer.
1610 if (ifp->if_flags & IFF_NOARP) {
1611 /* Discard packet if ARP is disabled on interface */
1619 case ETHERTYPE_IPV6:
1626 netisr_dispatch(isr, m);
1634 * Process a received Infiniband packet.
1637 ipoib_input(struct ifnet *ifp, struct mbuf *m)
1639 struct ipoib_header *eh;
1641 if ((ifp->if_flags & IFF_UP) == 0) {
1645 CURVNET_SET_QUIET(ifp->if_vnet);
1647 /* Let BPF have it before we strip the header. */
1649 eh = mtod(m, struct ipoib_header *);
1651 * Reset layer specific mbuf flags to avoid confusing upper layers.
1652 * Strip off Infiniband header.
1654 m->m_flags &= ~M_VLANTAG;
1656 m_adj(m, IPOIB_HEADER_LEN);
1658 if (IPOIB_IS_MULTICAST(eh->hwaddr)) {
1659 if (memcmp(eh->hwaddr, ifp->if_broadcastaddr,
1660 ifp->if_addrlen) == 0)
1661 m->m_flags |= M_BCAST;
1663 m->m_flags |= M_MCAST;
1664 if_inc_counter(ifp, IFCOUNTER_IMCASTS, 1);
1667 ipoib_demux(ifp, m, ntohs(eh->proto));
1672 ipoib_resolvemulti(struct ifnet *ifp, struct sockaddr **llsa,
1673 struct sockaddr *sa)
1675 struct sockaddr_dl *sdl;
1677 struct sockaddr_in *sin;
1680 struct sockaddr_in6 *sin6;
1684 switch(sa->sa_family) {
1687 * No mapping needed. Just check that it's a valid MC address.
1689 sdl = (struct sockaddr_dl *)sa;
1690 e_addr = LLADDR(sdl);
1691 if (!IPOIB_IS_MULTICAST(e_addr))
1692 return EADDRNOTAVAIL;
1698 sin = (struct sockaddr_in *)sa;
1699 if (!IN_MULTICAST(ntohl(sin->sin_addr.s_addr)))
1700 return EADDRNOTAVAIL;
1701 sdl = link_init_sdl(ifp, *llsa, IFT_INFINIBAND);
1702 sdl->sdl_alen = INFINIBAND_ALEN;
1703 e_addr = LLADDR(sdl);
1704 ip_ib_mc_map(sin->sin_addr.s_addr, ifp->if_broadcastaddr,
1706 *llsa = (struct sockaddr *)sdl;
1711 sin6 = (struct sockaddr_in6 *)sa;
1713 * An IP6 address of 0 means listen to all
1714 * of the multicast address used for IP6.
1715 * This has no meaning in ipoib.
1717 if (IN6_IS_ADDR_UNSPECIFIED(&sin6->sin6_addr))
1718 return EADDRNOTAVAIL;
1719 if (!IN6_IS_ADDR_MULTICAST(&sin6->sin6_addr))
1720 return EADDRNOTAVAIL;
1721 sdl = link_init_sdl(ifp, *llsa, IFT_INFINIBAND);
1722 sdl->sdl_alen = INFINIBAND_ALEN;
1723 e_addr = LLADDR(sdl);
1724 ipv6_ib_mc_map(&sin6->sin6_addr, ifp->if_broadcastaddr, e_addr);
1725 *llsa = (struct sockaddr *)sdl;
1730 return EAFNOSUPPORT;
1734 module_init(ipoib_init_module);
1735 module_exit(ipoib_cleanup_module);
1738 ipoib_evhand(module_t mod, int event, void *arg)
1743 static moduledata_t ipoib_mod = {
1745 .evhand = ipoib_evhand,
1748 DECLARE_MODULE(ipoib, ipoib_mod, SI_SUB_LAST, SI_ORDER_ANY);
1749 MODULE_DEPEND(ipoib, ibcore, 1, 1, 1);
1750 MODULE_DEPEND(ipoib, linuxkpi, 1, 1, 1);