From ca821002fe3ae2bd250d80310d39a87825aaa6c1 Mon Sep 17 00:00:00 2001 From: jhb Date: Mon, 27 Aug 2012 19:37:02 +0000 Subject: [PATCH] MFC 233040,233198,233870,234183: Add OFED and the associated options and drivers to x86 LINT builds: - Fix build with INET6 disabled. - Fix build of OFED bits with debugging options enabled. - Fix build on i386. - Mark 'sdp' as requiring 'inet'. - Always include "opt_inet.h" and "opt_inet6.h" and modify the IB driver Makefiles to honor WITH/WITHOUT_INET/INET6/_SUPPORT options to determine what should be enabled during a module build. - Fix the mlxen(4) driver and the core IB code to compile without if INET is disabled (including when both INET and INET6 are disabled). git-svn-id: svn://svn.freebsd.org/base/stable/9@239748 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- sys/amd64/conf/NOTES | 19 +++++++++++++++ sys/conf/files | 10 ++++---- sys/i386/conf/NOTES | 19 +++++++++++++++ sys/modules/mlx4/Makefile | 17 +++++++++++++- sys/modules/mlx4ib/Makefile | 18 ++++++++++++++- sys/modules/mlxen/Makefile | 17 +++++++++++++- sys/modules/mthca/Makefile | 18 ++++++++++++++- sys/ofed/drivers/infiniband/core/addr.c | 19 +++++++++++++-- sys/ofed/drivers/infiniband/core/cma.c | 23 ++++++++++++++++++- sys/ofed/drivers/infiniband/core/fmr_pool.c | 2 +- .../drivers/infiniband/ulp/ipoib/ipoib_cm.c | 14 ++++++++--- .../drivers/infiniband/ulp/ipoib/ipoib_main.c | 2 +- .../drivers/infiniband/ulp/sdp/sdp_main.c | 2 +- sys/ofed/drivers/net/mlx4/en_frag.c | 4 ++++ sys/ofed/drivers/net/mlx4/en_rx.c | 13 +++++++++++ sys/ofed/include/linux/in.h | 2 ++ sys/ofed/include/linux/in6.h | 2 -- sys/ofed/include/net/ip.h | 4 ++++ sys/ofed/include/net/ipv6.h | 2 -- 19 files changed, 185 insertions(+), 22 deletions(-) diff --git a/sys/amd64/conf/NOTES b/sys/amd64/conf/NOTES index 887e26021..573250c5e 100644 --- a/sys/amd64/conf/NOTES +++ b/sys/amd64/conf/NOTES @@ -90,6 +90,19 @@ options DEVICE_POLLING 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 @@ options DRM_DEBUG # Include debug printfs (slow) # 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 @@ options ED_SIC 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 diff --git a/sys/conf/files b/sys/conf/files index d43e6d4c1..05b04663a 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -3077,19 +3077,19 @@ ofed/drivers/infiniband/ulp/ipoib/ipoib_verbs.c optional ipoib \ # 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/" diff --git a/sys/i386/conf/NOTES b/sys/i386/conf/NOTES index a7810032b..4a8c2686b 100644 --- a/sys/i386/conf/NOTES +++ b/sys/i386/conf/NOTES @@ -260,6 +260,19 @@ options DEVICE_POLLING 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 @@ hint.mse.0.irq="5" # 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.at="isa" 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 diff --git a/sys/modules/mlx4/Makefile b/sys/modules/mlx4/Makefile index 8ea3340ed..ccaf3c3fc 100644 --- a/sys/modules/mlx4/Makefile +++ b/sys/modules/mlx4/Makefile @@ -1,13 +1,28 @@ # $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 diff --git a/sys/modules/mlx4ib/Makefile b/sys/modules/mlx4ib/Makefile index 5fe01e733..3ab6d6f80 100644 --- a/sys/modules/mlx4ib/Makefile +++ b/sys/modules/mlx4ib/Makefile @@ -1,10 +1,26 @@ # $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/ + +.if !defined(KERNBUILDDIR) +.if ${MK_INET_SUPPORT} != "no" +opt_inet.h: + @echo "#define INET 1" > ${.TARGET} +.endif -CFLAGS+= -I${.CURDIR}/../../ofed/include/ -DINET6 +.if ${MK_INET6_SUPPORT} != "no" +opt_inet6.h: + @echo "#define INET6 1" > ${.TARGET} +.endif +.endif .include diff --git a/sys/modules/mlxen/Makefile b/sys/modules/mlxen/Makefile index b83b4a534..cf05cddc4 100644 --- a/sys/modules/mlxen/Makefile +++ b/sys/modules/mlxen/Makefile @@ -1,12 +1,27 @@ # $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 diff --git a/sys/modules/mthca/Makefile b/sys/modules/mthca/Makefile index de860fe9d..9b56499f3 100644 --- a/sys/modules/mthca/Makefile +++ b/sys/modules/mthca/Makefile @@ -1,14 +1,30 @@ # $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 + +.if !defined(KERNBUILDDIR) +.if ${MK_INET_SUPPORT} != "no" +opt_inet.h: + @echo "#define INET 1" > ${.TARGET} +.endif -CFLAGS+= -I${.CURDIR}/../../ofed/include/ -DINET6 +.if ${MK_INET6_SUPPORT} != "no" +opt_inet6.h: + @echo "#define INET6 1" > ${.TARGET} +.endif +.endif .include diff --git a/sys/ofed/drivers/infiniband/core/addr.c b/sys/ofed/drivers/infiniband/core/addr.c index cde403747..a4678072d 100644 --- a/sys/ofed/drivers/infiniband/core/addr.c +++ b/sys/ofed/drivers/infiniband/core/addr.c @@ -136,6 +136,7 @@ int rdma_translate_ip(struct sockaddr *addr, struct rdma_dev_addr *dev_addr) } 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 @@ int rdma_translate_ip(struct sockaddr *addr, struct rdma_dev_addr *dev_addr) ret = rdma_copy_addr(dev_addr, dev, NULL); dev_put(dev); break; +#endif #if defined(INET6) case AF_INET6: @@ -346,7 +348,9 @@ static int addr_resolve(struct sockaddr *src_in, 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 @@ static int addr_resolve(struct sockaddr *src_in, 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 @@ static int addr_resolve(struct sockaddr *src_in, } else src_in = NULL; break; +#endif #ifdef INET6 case AF_INET6: sin6 = (struct sockaddr_in6 *)dst_in; @@ -459,12 +465,21 @@ mcast: /* * Resolve the link local address. */ - if (dst_in->sa_family == AF_INET) + switch (dst_in->sa_family) { +#ifdef INET + case AF_INET: error = arpresolve(ifp, rte, NULL, dst_in, edst, &lle); + break; +#endif #ifdef INET6 - else + case AF_INET6: error = nd6_storelladdr(ifp, NULL, dst_in, (u_char *)edst, &lle); + break; #endif + default: + /* XXX: Shouldn't happen. */ + error = -EINVAL; + } RTFREE(rte); if (error == 0) return rdma_copy_addr(addr, ifp, edst); diff --git a/sys/ofed/drivers/infiniband/core/cma.c b/sys/ofed/drivers/infiniband/core/cma.c index c016451ba..750d2d54c 100644 --- a/sys/ofed/drivers/infiniband/core/cma.c +++ b/sys/ofed/drivers/infiniband/core/cma.c @@ -96,7 +96,9 @@ static DEFINE_IDR(sdp_ps); 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; @@ -1242,7 +1244,9 @@ static void cma_set_compare_data(enum rdma_port_space ps, struct sockaddr *addr, struct cma_hdr *cma_data, *cma_mask; struct sdp_hh *sdp_data, *sdp_mask; __be32 ip4_addr; +#ifdef INET6 struct in6_addr ip6_addr; +#endif memset(compare, 0, sizeof *compare); cma_data = (void *) compare->data; @@ -2135,6 +2139,7 @@ err1: 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; @@ -2176,6 +2181,9 @@ err2: err1: kfree(bind_list); return ret; +#else + return -ENOSPC; +#endif } static int cma_use_port(struct idr *ps, struct rdma_id_private *id_priv) @@ -2917,13 +2925,20 @@ static int cma_ib_mc_handler(int status, struct ib_sa_multicast *multicast) 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 if (cma_any_addr(addr)) { memset(mgid, 0, sizeof *mgid); +#ifdef INET6 } else if ((addr->sa_family == AF_INET6) && ((be32_to_cpu(sin6->sin6_addr.s6_addr32[0]) & 0xFFF0FFFF) == 0xFF10A01B)) { @@ -2934,11 +2949,14 @@ static void cma_set_mgid(struct rdma_id_private *id_priv, if (id_priv->id.ps == RDMA_PS_UDP) 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 } } @@ -3341,12 +3359,15 @@ static void cma_remove_one(struct ib_device *device) 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) diff --git a/sys/ofed/drivers/infiniband/core/fmr_pool.c b/sys/ofed/drivers/infiniband/core/fmr_pool.c index 4507043d2..c22583344 100644 --- a/sys/ofed/drivers/infiniband/core/fmr_pool.c +++ b/sys/ofed/drivers/infiniband/core/fmr_pool.c @@ -150,7 +150,7 @@ static void ib_fmr_batch_release(struct ib_fmr_pool *pool) #ifdef DEBUG if (fmr->ref_count !=0) { - printk(KERN_WARNING PFX "Unmapping FMR 0x%08x with ref count %d\n", + printk(KERN_WARNING PFX "Unmapping FMR %p with ref count %d\n", fmr, fmr->ref_count); } #endif diff --git a/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c b/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c index 47818bfc1..2a9326973 100644 --- a/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c +++ b/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_cm.c @@ -1247,7 +1247,9 @@ static void ipoib_cm_mb_reap(struct work_struct *work) 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 @@ static void ipoib_cm_mb_reap(struct work_struct *work) 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); } diff --git a/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c b/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c index ab1bb3997..0ff11d2c4 100644 --- a/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c +++ b/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c @@ -876,7 +876,7 @@ ipoib_intf_alloc(const char *name) dev->if_output = ipoib_output; dev->if_input = ipoib_input; dev->if_resolvemulti = ipoib_resolvemulti; - dev->if_baudrate = IF_Gbps(10LL); + dev->if_baudrate = IF_Gbps(10UL); dev->if_broadcastaddr = priv->broadcastaddr; dev->if_snd.ifq_maxlen = ipoib_sendq_size * 2; sdl = (struct sockaddr_dl *)dev->if_addr->ifa_addr; diff --git a/sys/ofed/drivers/infiniband/ulp/sdp/sdp_main.c b/sys/ofed/drivers/infiniband/ulp/sdp/sdp_main.c index fe747af77..4a23ff928 100644 --- a/sys/ofed/drivers/infiniband/ulp/sdp/sdp_main.c +++ b/sys/ofed/drivers/infiniband/ulp/sdp/sdp_main.c @@ -855,7 +855,7 @@ sdp_append(struct sdp_sock *ssk, struct sockbuf *sb, struct mbuf *mb, int cnt) int ncnt; SOCKBUF_LOCK_ASSERT(sb); - SBLASTRECORDCHK(sb) + SBLASTRECORDCHK(sb); KASSERT(mb->m_flags & M_PKTHDR, ("sdp_append: %p Missing packet header.\n", mb)); n = sb->sb_lastrecord; diff --git a/sys/ofed/drivers/net/mlx4/en_frag.c b/sys/ofed/drivers/net/mlx4/en_frag.c index 6c6bac4a9..57c6368fd 100644 --- a/sys/ofed/drivers/net/mlx4/en_frag.c +++ b/sys/ofed/drivers/net/mlx4/en_frag.c @@ -31,8 +31,11 @@ * */ +#include "opt_inet.h" #include "mlx4_en.h" +#ifdef INET + #include #include #include @@ -186,3 +189,4 @@ void mlx4_en_flush_frags(struct mlx4_en_priv *priv, flush_session(priv, session, IP_MF); } } +#endif diff --git a/sys/ofed/drivers/net/mlx4/en_rx.c b/sys/ofed/drivers/net/mlx4/en_rx.c index d913cb041..cf85615d2 100644 --- a/sys/ofed/drivers/net/mlx4/en_rx.c +++ b/sys/ofed/drivers/net/mlx4/en_rx.c @@ -31,6 +31,7 @@ * */ +#include "opt_inet.h" #include "mlx4_en.h" #include @@ -287,6 +288,7 @@ int mlx4_en_activate_rx_rings(struct mlx4_en_priv *priv) /* 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 @@ int mlx4_en_activate_rx_rings(struct mlx4_en_priv *priv) else ring->lro.ifp = priv->dev; } +#endif } err = mlx4_en_fill_rx_buffers(priv); if (err) @@ -330,7 +333,9 @@ void mlx4_en_destroy_rx_ring(struct mlx4_en_priv *priv, 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 @@ int mlx4_en_process_rx_cq(struct net_device *dev, struct mlx4_en_cq *cq, int bud 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 @@ int mlx4_en_process_rx_cq(struct net_device *dev, struct mlx4_en_cq *cq, int bud * - 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 @@ next: } /* 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 */ diff --git a/sys/ofed/include/linux/in.h b/sys/ofed/include/linux/in.h index 8fa3dc2a2..803ef2b02 100644 --- a/sys/ofed/include/linux/in.h +++ b/sys/ofed/include/linux/in.h @@ -28,6 +28,8 @@ #ifndef _LINUX_IN_H_ #define _LINUX_IN_H_ +#include "opt_inet.h" + #include #include diff --git a/sys/ofed/include/linux/in6.h b/sys/ofed/include/linux/in6.h index 2032b6179..925c7ed3a 100644 --- a/sys/ofed/include/linux/in6.h +++ b/sys/ofed/include/linux/in6.h @@ -29,8 +29,6 @@ #ifndef _LINUX_IN6_H_ #define _LINUX_IN6_H_ -#ifndef KLD_MODULE #include "opt_inet6.h" -#endif #endif /* _LINUX_IN6_H_ */ diff --git a/sys/ofed/include/net/ip.h b/sys/ofed/include/net/ip.h index 8b29d6279..d9d64d539 100644 --- a/sys/ofed/include/net/ip.h +++ b/sys/ofed/include/net/ip.h @@ -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 @@ ip_ib_mc_map(uint32_t addr, const unsigned char *bcast, char *buf) buf[18] = (addr >> 8) & 0xff; buf[19] = addr & 0xff; } +#endif #endif /* _LINUX_NET_IP_H_ */ diff --git a/sys/ofed/include/net/ipv6.h b/sys/ofed/include/net/ipv6.h index 6f02555e9..74bbe778a 100644 --- a/sys/ofed/include/net/ipv6.h +++ b/sys/ofed/include/net/ipv6.h @@ -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) \ -- 2.45.0