Index: amd64/conf/NOTES =================================================================== --- amd64/conf/NOTES (revision 234175) +++ amd64/conf/NOTES (working copy) @@ -90,6 +90,19 @@ options BPF_JITTER +# OpenFabrics Enterprise Distribution (Infiniband). +options OFED +options OFED_DEBUG_INIT + +# Sockets Direct Protocol +options SDP +options SDP_DEBUG + +# IP over Inifiband +options IPOIB +options IPOIB_DEBUG +options IPOIB_CM + ##################################################################### # CLOCK OPTIONS @@ -290,6 +303,9 @@ # Requires the iwi firmware module # iwn: Intel Wireless WiFi Link 4965/1000/5000/6000 802.11 network adapters # Requires the iwn firmware module +# mlx4ib: Mellanox ConnectX HCA InfiniBand +# mlxen: Mellanox ConnectX HCA Ethernet +# mthca: Mellanox HCA InfiniBand # mwl: Marvell 88W8363 IEEE 802.11 adapter # Requires the mwl firmware module # nfe: nVidia nForce MCP on-board Ethernet Networking (BSD open source) @@ -305,6 +321,9 @@ device ipw # Intel 2100 wireless NICs. device iwi # Intel 2200BG/2225BG/2915ABG wireless NICs. device iwn # Intel 4965/1000/5000/6000 wireless NICs. +device mlx4ib # Mellanox ConnectX HCA InfiniBand +device mlxen # Mellanox ConnectX HCA Ethernet +device mthca # Mellanox HCA InfiniBand device mwl # Marvell 88W8363 802.11n wireless NICs. device nfe # nVidia nForce MCP on-board Ethernet device nve # nVidia nForce MCP on-board Ethernet Networking Index: conf/files =================================================================== --- conf/files (revision 234175) +++ conf/files (working copy) @@ -3215,19 +3215,19 @@ # no-depend \ # compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/ulp/ipoib/" -ofed/drivers/infiniband/ulp/sdp/sdp_bcopy.c optional sdp \ +ofed/drivers/infiniband/ulp/sdp/sdp_bcopy.c optional sdp inet \ no-depend \ compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/ulp/sdp/" -ofed/drivers/infiniband/ulp/sdp/sdp_main.c optional sdp \ +ofed/drivers/infiniband/ulp/sdp/sdp_main.c optional sdp inet \ no-depend \ compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/ulp/sdp/" -ofed/drivers/infiniband/ulp/sdp/sdp_rx.c optional sdp \ +ofed/drivers/infiniband/ulp/sdp/sdp_rx.c optional sdp inet \ no-depend \ compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/ulp/sdp/" -ofed/drivers/infiniband/ulp/sdp/sdp_cma.c optional sdp \ +ofed/drivers/infiniband/ulp/sdp/sdp_cma.c optional sdp inet \ no-depend \ compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/ulp/sdp/" -ofed/drivers/infiniband/ulp/sdp/sdp_tx.c optional sdp \ +ofed/drivers/infiniband/ulp/sdp/sdp_tx.c optional sdp inet \ no-depend \ compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/ulp/sdp/" Index: i386/conf/NOTES =================================================================== --- i386/conf/NOTES (revision 234175) +++ i386/conf/NOTES (working copy) @@ -260,6 +260,19 @@ options BPF_JITTER +# OpenFabrics Enterprise Distribution (Infiniband). +options OFED +options OFED_DEBUG_INIT + +# Sockets Direct Protocol +options SDP +options SDP_DEBUG + +# IP over Inifiband +options IPOIB +options IPOIB_DEBUG +options IPOIB_CM + ##################################################################### # CLOCK OPTIONS @@ -561,6 +574,9 @@ # Requires the iwi firmware module # iwn: Intel Wireless WiFi Link 4965AGN 802.11 network adapters # Requires the iwn firmware module +# mlx4ib: Mellanox ConnectX HCA InfiniBand +# mlxen: Mellanox ConnectX HCA Ethernet +# mthca: Mellanox HCA InfiniBand # mwl: Marvell 88W8363 IEEE 802.11 adapter # Requires the mwl firmware module # nfe: nVidia nForce MCP on-board Ethernet Networking (BSD open source) @@ -605,6 +621,9 @@ hint.le.0.port="0x280" hint.le.0.irq="10" hint.le.0.drq="0" +device mlx4ib # Mellanox ConnectX HCA InfiniBand +device mlxen # Mellanox ConnectX HCA Ethernet +device mthca # Mellanox HCA InfiniBand device mwl # Marvell 88W8363 802.11n wireless NICs. device nfe # nVidia nForce MCP on-board Ethernet device nve # nVidia nForce MCP on-board Ethernet Networking Index: ofed/include/linux/in.h =================================================================== --- ofed/include/linux/in.h (revision 234175) +++ ofed/include/linux/in.h (working copy) @@ -28,6 +28,8 @@ #ifndef _LINUX_IN_H_ #define _LINUX_IN_H_ +#include "opt_inet.h" + #include #include Index: ofed/include/linux/in6.h =================================================================== --- ofed/include/linux/in6.h (revision 234175) +++ ofed/include/linux/in6.h (working copy) @@ -29,8 +29,6 @@ #ifndef _LINUX_IN6_H_ #define _LINUX_IN6_H_ -#ifndef KLD_MODULE #include "opt_inet6.h" -#endif #endif /* _LINUX_IN6_H_ */ Index: ofed/include/net/ipv6.h =================================================================== --- ofed/include/net/ipv6.h (revision 234175) +++ ofed/include/net/ipv6.h (working copy) @@ -29,9 +29,7 @@ #ifndef _LINUX_NET_IPV6_H_ #define _LINUX_NET_IPV6_H_ -#ifndef KLD_MODULE #include "opt_inet6.h" -#endif #define ipv6_addr_loopback IN6_IS_ADDR_LOOPBACK #define ipv6_addr_copy(dst, src) \ Index: ofed/include/net/ip.h =================================================================== --- ofed/include/net/ip.h (revision 234175) +++ ofed/include/net/ip.h (working copy) @@ -29,6 +29,8 @@ #ifndef _LINUX_NET_IP_H_ #define _LINUX_NET_IP_H_ +#include "opt_inet.h" + #include #include @@ -39,6 +41,7 @@ #include #include +#ifdef INET static inline void inet_get_local_port_range(int *low, int *high) { *low = V_ipport_firstauto; @@ -73,5 +76,6 @@ buf[18] = (addr >> 8) & 0xff; buf[19] = addr & 0xff; } +#endif #endif /* _LINUX_NET_IP_H_ */ Index: ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c =================================================================== --- ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c (revision 234182) +++ ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c (working copy) @@ -1247,7 +1247,9 @@ cm.mb_task); struct mbuf *mb; unsigned long flags; +#if defined(INET) || defined(INET6) unsigned mtu = priv->mcast_mtu; +#endif uint16_t proto; spin_lock_irqsave(&priv->lock, flags); @@ -1260,14 +1262,20 @@ proto = htons(*mtod(mb, uint16_t *)); m_adj(mb, IPOIB_ENCAP_LEN); - if (proto == ETHERTYPE_IP) + switch (proto) { +#if defined(INET) + case ETHERTYPE_IP: icmp_error(mb, ICMP_UNREACH, ICMP_UNREACH_NEEDFRAG, 0, mtu); + break; +#endif #if defined(INET6) - else if (proto == ETHERTYPE_IPV6) + case ETHERTYPE_IPV6: icmp6_error(mb, ICMP6_PACKET_TOO_BIG, 0, mtu); + break; #endif - else + default: m_freem(mb); + } spin_lock_irqsave(&priv->lock, flags); } Index: ofed/drivers/infiniband/core/addr.c =================================================================== --- ofed/drivers/infiniband/core/addr.c (revision 234175) +++ ofed/drivers/infiniband/core/addr.c (working copy) @@ -136,6 +136,7 @@ } switch (addr->sa_family) { +#ifdef INET case AF_INET: dev = ip_dev_find(NULL, ((struct sockaddr_in *) addr)->sin_addr.s_addr); @@ -146,6 +147,7 @@ ret = rdma_copy_addr(dev_addr, dev, NULL); dev_put(dev); break; +#endif #if defined(INET6) case AF_INET6: @@ -346,7 +348,9 @@ struct sockaddr_in6 *sin6; struct ifaddr *ifa; struct ifnet *ifp; +#if defined(INET) || defined(INET6) struct llentry *lle; +#endif struct rtentry *rte; in_port_t port; u_char edst[MAX_ADDR_LEN]; @@ -365,6 +369,7 @@ ifp = NULL; rte = NULL; switch (dst_in->sa_family) { +#ifdef INET case AF_INET: sin = (struct sockaddr_in *)dst_in; if (sin->sin_addr.s_addr == INADDR_BROADCAST) @@ -383,6 +388,7 @@ } else src_in = NULL; break; +#endif #ifdef INET6 case AF_INET6: sin6 = (struct sockaddr_in6 *)dst_in; @@ -459,12 +465,21 @@ /* * Resolve the link local address. */ + switch (dst_in->sa_family) { +#ifdef INET + case AF_INET: + error = arpresolve(ifp, rte, NULL, dst_in, edst, &lle); + break; +#endif #ifdef INET6 - if (dst_in->sa_family == AF_INET6) + case AF_INET6: error = nd6_storelladdr(ifp, NULL, dst_in, (u_char *)edst, &lle); - else + break; #endif - error = arpresolve(ifp, rte, NULL, dst_in, edst, &lle); + default: + /* XXX: Shouldn't happen. */ + error = -EINVAL; + } RTFREE(rte); if (error == 0) return rdma_copy_addr(addr, ifp, edst); Index: ofed/drivers/infiniband/core/cma.c =================================================================== --- ofed/drivers/infiniband/core/cma.c (revision 234175) +++ ofed/drivers/infiniband/core/cma.c (working copy) @@ -96,7 +96,9 @@ static DEFINE_IDR(tcp_ps); static DEFINE_IDR(udp_ps); static DEFINE_IDR(ipoib_ps); +#if defined(INET) static int next_port; +#endif struct cma_device { struct list_head list; @@ -2137,6 +2139,7 @@ static int cma_alloc_any_port(struct idr *ps, struct rdma_id_private *id_priv) { +#if defined(INET) struct rdma_bind_list *bind_list; int port, ret, low, high; @@ -2178,6 +2181,9 @@ err1: kfree(bind_list); return ret; +#else + return -ENOSPC; +#endif } static int cma_use_port(struct idr *ps, struct rdma_id_private *id_priv) @@ -2919,9 +2925,13 @@ static void cma_set_mgid(struct rdma_id_private *id_priv, struct sockaddr *addr, union ib_gid *mgid) { +#if defined(INET) || defined(INET6) unsigned char mc_map[MAX_ADDR_LEN]; struct rdma_dev_addr *dev_addr = &id_priv->id.route.addr.dev_addr; +#endif +#ifdef INET struct sockaddr_in *sin = (struct sockaddr_in *) addr; +#endif #ifdef INET6 struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *) addr; #endif @@ -2940,11 +2950,13 @@ mc_map[7] = 0x01; /* Use RDMA CM signature */ *mgid = *(union ib_gid *) (mc_map + 4); #endif +#ifdef INET } else { ip_ib_mc_map(sin->sin_addr.s_addr, dev_addr->broadcast, mc_map); if (id_priv->id.ps == RDMA_PS_UDP) mc_map[7] = 0x01; /* Use RDMA CM signature */ *mgid = *(union ib_gid *) (mc_map + 4); +#endif } } @@ -3347,12 +3359,15 @@ static int cma_init(void) { - int ret, low, high, remaining; + int ret; +#if defined(INET) + int low, high, remaining; get_random_bytes(&next_port, sizeof next_port); inet_get_local_port_range(&low, &high); remaining = (high - low) + 1; next_port = ((unsigned int) next_port % remaining) + low; +#endif cma_wq = create_singlethread_workqueue("rdma_cm"); if (!cma_wq) Index: ofed/drivers/net/mlx4/en_frag.c =================================================================== --- ofed/drivers/net/mlx4/en_frag.c (revision 234175) +++ ofed/drivers/net/mlx4/en_frag.c (working copy) @@ -31,8 +31,11 @@ * */ +#include "opt_inet.h" #include "mlx4_en.h" +#ifdef INET + #include #include #include @@ -186,3 +189,4 @@ flush_session(priv, session, IP_MF); } } +#endif Index: ofed/drivers/net/mlx4/en_rx.c =================================================================== --- ofed/drivers/net/mlx4/en_rx.c (revision 234175) +++ ofed/drivers/net/mlx4/en_rx.c (working copy) @@ -31,6 +31,7 @@ * */ +#include "opt_inet.h" #include "mlx4_en.h" #include @@ -287,6 +288,7 @@ /* Initailize all descriptors */ for (i = 0; i < ring->size; i++) mlx4_en_init_rx_desc(priv, ring, i); +#ifdef INET /* Configure lro mngr */ if (priv->dev->if_capenable & IFCAP_LRO) { if (tcp_lro_init(&ring->lro)) @@ -294,6 +296,7 @@ else ring->lro.ifp = priv->dev; } +#endif } err = mlx4_en_fill_rx_buffers(priv); if (err) @@ -330,7 +333,9 @@ void mlx4_en_deactivate_rx_ring(struct mlx4_en_priv *priv, struct mlx4_en_rx_ring *ring) { +#ifdef INET tcp_lro_free(&ring->lro); +#endif mlx4_en_free_rx_buf(priv, ring); if (ring->stride <= TXBB_SIZE) ring->buf -= TXBB_SIZE; @@ -446,7 +451,9 @@ struct mbuf **mb_list; struct mlx4_en_rx_desc *rx_desc; struct mbuf *mb; +#ifdef INET struct lro_entry *queued; +#endif int index; unsigned int length; int polled = 0; @@ -515,22 +522,26 @@ * - without IP options * - not an IP fragment */ +#ifdef INET if (mlx4_en_can_lro(cqe->status) && (dev->if_capenable & IFCAP_LRO)) { if (ring->lro.lro_cnt != 0 && tcp_lro_rx(&ring->lro, mb, 0) == 0) goto next; } +#endif /* LRO not possible, complete processing here */ INC_PERF_COUNTER(priv->pstats.lro_misses); } else { mb->m_pkthdr.csum_flags = 0; priv->port_stats.rx_chksum_none++; +#ifdef INET if (priv->ip_reasm && cqe->status & cpu_to_be16(MLX4_CQE_STATUS_IPV4) && !mlx4_en_rx_frags(priv, ring, mb, cqe)) goto next; +#endif } /* Push it up the stack */ @@ -545,11 +556,13 @@ } /* Flush all pending IP reassembly sessions */ out: +#ifdef INET mlx4_en_flush_frags(priv, ring); while ((queued = SLIST_FIRST(&ring->lro.lro_active)) != NULL) { SLIST_REMOVE_HEAD(&ring->lro.lro_active, next); tcp_lro_flush(&ring->lro, queued); } +#endif AVG_PERF_COUNTER(priv->pstats.rx_coal_avg, polled); mlx4_cq_set_ci(&cq->mcq); wmb(); /* ensure HW sees CQ consumer before we post new buffers */ Index: modules/mlx4/Makefile =================================================================== --- modules/mlx4/Makefile (revision 234175) +++ modules/mlx4/Makefile (working copy) @@ -1,14 +1,29 @@ # $FreeBSD$ .PATH: ${.CURDIR}/../../ofed/drivers/net/mlx4 + +.include + KMOD = mlx4 SRCS = device_if.h bus_if.h pci_if.h vnode_if.h SRCS+= alloc.c catas.c cmd.c cq.c eq.c fw.c icm.c intf.c main.c mcg.c mr.c SRCS+= pd.c port.c profile.c qp.c reset.c sense.c srq.c xrcd.c +SRCS+= opt_inet.h opt_inet6.h CFLAGS+= -I${.CURDIR}/../../ofed/drivers/net/mlx4 CFLAGS+= -I${.CURDIR}/../../ofed/include/ -CFLAGS+= -DINET6 +.if !defined(KERNBUILDDIR) +.if ${MK_INET_SUPPORT} != "no" +opt_inet.h: + @echo "#define INET 1" > ${.TARGET} +.endif + +.if ${MK_INET6_SUPPORT} != "no" +opt_inet6.h: + @echo "#define INET6 1" > ${.TARGET} +.endif +.endif + .include CFLAGS+= -Wno-cast-qual -Wno-pointer-arith -fms-extensions Index: modules/mthca/Makefile =================================================================== --- modules/mthca/Makefile (revision 234175) +++ modules/mthca/Makefile (working copy) @@ -1,15 +1,31 @@ # $FreeBSD$ .PATH: ${.CURDIR}/../../ofed/drivers/infiniband/hw/mthca + +.include + KMOD = mthca SRCS = device_if.h bus_if.h pci_if.h vnode_if.h SRCS+= mthca_allocator.c mthca_av.c mthca_catas.c mthca_cmd.c mthca_cq.c SRCS+= mthca_eq.c mthca_mad.c mthca_main.c mthca_mcg.c mthca_memfree.c SRCS+= mthca_mr.c mthca_pd.c mthca_profile.c mthca_provider.c mthca_qp.c SRCS+= mthca_reset.c mthca_srq.c mthca_uar.c +SRCS+= opt_inet.h opt_inet6.h -CFLAGS+= -I${.CURDIR}/../../ofed/include/ -DINET6 +CFLAGS+= -I${.CURDIR}/../../ofed/include +.if !defined(KERNBUILDDIR) +.if ${MK_INET_SUPPORT} != "no" +opt_inet.h: + @echo "#define INET 1" > ${.TARGET} +.endif + +.if ${MK_INET6_SUPPORT} != "no" +opt_inet6.h: + @echo "#define INET6 1" > ${.TARGET} +.endif +.endif + .include CFLAGS+= -Wno-cast-qual -Wno-pointer-arith -fms-extensions Index: modules/mlx4ib/Makefile =================================================================== --- modules/mlx4ib/Makefile (revision 234175) +++ modules/mlx4ib/Makefile (working copy) @@ -1,11 +1,27 @@ # $FreeBSD$ .PATH: ${.CURDIR}/../../ofed/drivers/infiniband/hw/mlx4 + +.include + KMOD = mlx4ib SRCS = device_if.h bus_if.h pci_if.h vnode_if.h SRCS+= ah.c cq.c doorbell.c mad.c main.c mr.c qp.c srq.c wc.c +SRCS+= opt_inet.h opt_inet6.h -CFLAGS+= -I${.CURDIR}/../../ofed/include/ -DINET6 +CFLAGS+= -I${.CURDIR}/../../ofed/include/ +.if !defined(KERNBUILDDIR) +.if ${MK_INET_SUPPORT} != "no" +opt_inet.h: + @echo "#define INET 1" > ${.TARGET} +.endif + +.if ${MK_INET6_SUPPORT} != "no" +opt_inet6.h: + @echo "#define INET6 1" > ${.TARGET} +.endif +.endif + .include CFLAGS+= -Wno-cast-qual -Wno-pointer-arith -fms-extensions Index: modules/mlxen/Makefile =================================================================== --- modules/mlxen/Makefile (revision 234175) +++ modules/mlxen/Makefile (working copy) @@ -1,13 +1,28 @@ # $FreeBSD$ .PATH: ${.CURDIR}/../../ofed/drivers/net/mlx4 + +.include + KMOD = mlxen SRCS = device_if.h bus_if.h pci_if.h vnode_if.h SRCS += en_cq.c en_frag.c en_main.c en_netdev.c en_port.c en_resources.c SRCS += en_rx.c en_tx.c +SRCS += opt_inet.h opt_inet6.h CFLAGS+= -I${.CURDIR}/../../ofed/drivers/net/mlx4 CFLAGS+= -I${.CURDIR}/../../ofed/include/ -CFLAGS+= -DINET6 +.if !defined(KERNBUILDDIR) +.if ${MK_INET_SUPPORT} != "no" +opt_inet.h: + @echo "#define INET 1" > ${.TARGET} +.endif + +.if ${MK_INET6_SUPPORT} != "no" +opt_inet6.h: + @echo "#define INET6 1" > ${.TARGET} +.endif +.endif + .include CFLAGS+= -Wno-cast-qual -Wno-pointer-arith -fms-extensions