From owner-svn-src-all@FreeBSD.ORG Sun Sep 29 00:35:07 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 44F2914A; Sun, 29 Sep 2013 00:35:07 +0000 (UTC) (envelope-from alfred@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 2F97F2BB6; Sun, 29 Sep 2013 00:35:07 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r8T0Z7vI072749; Sun, 29 Sep 2013 00:35:07 GMT (envelope-from alfred@svn.freebsd.org) Received: (from alfred@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r8T0Z3Ng072724; Sun, 29 Sep 2013 00:35:03 GMT (envelope-from alfred@svn.freebsd.org) Message-Id: <201309290035.r8T0Z3Ng072724@svn.freebsd.org> From: Alfred Perlstein Date: Sun, 29 Sep 2013 00:35:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r255932 - in head/sys: conf contrib/rdma dev/cxgb/ulp/iw_cxgb modules modules/ibcore modules/ipoib modules/mlx4 modules/mlx4ib ofed/drivers/infiniband/core ofed/drivers/infiniband/hw/ml... X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Sep 2013 00:35:07 -0000 Author: alfred Date: Sun Sep 29 00:35:03 2013 New Revision: 255932 URL: http://svnweb.freebsd.org/changeset/base/255932 Log: Update OFED to Linux 3.7 and update Mellanox drivers. Update the OFED Infiniband core to the version supplied in Linux version 3.7. The update to OFED is nearly all additional defines and functions with the exception of the addition of additional parameters to ib_register_device() and the reg_user_mr callback. In addition the ibcore (Infiniband core) and ipoib (IP over Infiniband) have both been made into completely loadable modules to facilitate testing of the OFED stack in FreeBSD. Finally the Mellanox Infiniband drivers are now updated to the latest version shipping with Linux 3.7. Submitted by: Mellanox FreeBSD driver team: Oded Shanoon (odeds mellanox.com), Meny Yossefi (menyy mellanox.com), Orit Moskovich (oritm mellanox.com) Approved by: re Added: head/sys/modules/ibcore/ head/sys/modules/ibcore/Makefile (contents, props changed) head/sys/modules/ipoib/ head/sys/modules/ipoib/Makefile (contents, props changed) head/sys/ofed/drivers/infiniband/hw/mlx4/alias_GUID.c (contents, props changed) head/sys/ofed/drivers/infiniband/hw/mlx4/cm.c (contents, props changed) head/sys/ofed/drivers/infiniband/hw/mlx4/mcg.c (contents, props changed) head/sys/ofed/drivers/infiniband/hw/mlx4/sysfs.c (contents, props changed) head/sys/ofed/drivers/net/mlx4/resource_tracker.c (contents, props changed) head/sys/ofed/drivers/net/mlx4/sys_tune.c (contents, props changed) head/sys/ofed/include/linux/atomic.h (contents, props changed) head/sys/ofed/include/linux/clocksource.h (contents, props changed) head/sys/ofed/include/rdma/ib_pma.h (contents, props changed) Modified: head/sys/conf/files head/sys/contrib/rdma/ib_umem.h head/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_provider.c head/sys/modules/Makefile head/sys/modules/mlx4/Makefile head/sys/modules/mlx4ib/Makefile head/sys/ofed/drivers/infiniband/core/addr.c head/sys/ofed/drivers/infiniband/core/cma.c head/sys/ofed/drivers/infiniband/core/core_priv.h head/sys/ofed/drivers/infiniband/core/device.c head/sys/ofed/drivers/infiniband/core/sa_query.c head/sys/ofed/drivers/infiniband/core/sysfs.c head/sys/ofed/drivers/infiniband/core/uverbs_cmd.c head/sys/ofed/drivers/infiniband/core/uverbs_main.c head/sys/ofed/drivers/infiniband/core/verbs.c head/sys/ofed/drivers/infiniband/hw/mlx4/Kconfig head/sys/ofed/drivers/infiniband/hw/mlx4/Makefile head/sys/ofed/drivers/infiniband/hw/mlx4/ah.c head/sys/ofed/drivers/infiniband/hw/mlx4/cq.c head/sys/ofed/drivers/infiniband/hw/mlx4/mad.c head/sys/ofed/drivers/infiniband/hw/mlx4/main.c head/sys/ofed/drivers/infiniband/hw/mlx4/mlx4_ib.h head/sys/ofed/drivers/infiniband/hw/mlx4/mr.c head/sys/ofed/drivers/infiniband/hw/mlx4/qp.c head/sys/ofed/drivers/infiniband/hw/mlx4/srq.c head/sys/ofed/drivers/infiniband/hw/mlx4/user.h head/sys/ofed/drivers/infiniband/hw/mlx4/wc.c head/sys/ofed/drivers/infiniband/hw/mthca/mthca_cmd.c head/sys/ofed/drivers/infiniband/hw/mthca/mthca_main.c head/sys/ofed/drivers/infiniband/hw/mthca/mthca_memfree.c head/sys/ofed/drivers/infiniband/hw/mthca/mthca_provider.c head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib.h head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c head/sys/ofed/drivers/net/mlx4/Makefile head/sys/ofed/drivers/net/mlx4/alloc.c head/sys/ofed/drivers/net/mlx4/catas.c head/sys/ofed/drivers/net/mlx4/cmd.c head/sys/ofed/drivers/net/mlx4/cq.c head/sys/ofed/drivers/net/mlx4/en_cq.c head/sys/ofed/drivers/net/mlx4/en_main.c head/sys/ofed/drivers/net/mlx4/en_netdev.c head/sys/ofed/drivers/net/mlx4/en_port.c head/sys/ofed/drivers/net/mlx4/en_port.h head/sys/ofed/drivers/net/mlx4/en_rx.c head/sys/ofed/drivers/net/mlx4/en_tx.c head/sys/ofed/drivers/net/mlx4/eq.c head/sys/ofed/drivers/net/mlx4/fw.c head/sys/ofed/drivers/net/mlx4/fw.h head/sys/ofed/drivers/net/mlx4/icm.c head/sys/ofed/drivers/net/mlx4/icm.h head/sys/ofed/drivers/net/mlx4/intf.c head/sys/ofed/drivers/net/mlx4/main.c head/sys/ofed/drivers/net/mlx4/mcg.c head/sys/ofed/drivers/net/mlx4/mlx4.h head/sys/ofed/drivers/net/mlx4/mlx4_en.h head/sys/ofed/drivers/net/mlx4/mr.c head/sys/ofed/drivers/net/mlx4/pd.c head/sys/ofed/drivers/net/mlx4/port.c head/sys/ofed/drivers/net/mlx4/profile.c head/sys/ofed/drivers/net/mlx4/qp.c head/sys/ofed/drivers/net/mlx4/reset.c head/sys/ofed/drivers/net/mlx4/sense.c head/sys/ofed/drivers/net/mlx4/srq.c head/sys/ofed/include/asm/atomic.h head/sys/ofed/include/asm/byteorder.h head/sys/ofed/include/linux/bitops.h head/sys/ofed/include/linux/compat.h head/sys/ofed/include/linux/device.h head/sys/ofed/include/linux/dma-mapping.h head/sys/ofed/include/linux/gfp.h head/sys/ofed/include/linux/idr.h head/sys/ofed/include/linux/if_ether.h head/sys/ofed/include/linux/in6.h head/sys/ofed/include/linux/kernel.h head/sys/ofed/include/linux/linux_compat.c head/sys/ofed/include/linux/list.h head/sys/ofed/include/linux/log2.h head/sys/ofed/include/linux/mlx4/cmd.h head/sys/ofed/include/linux/mlx4/cq.h head/sys/ofed/include/linux/mlx4/device.h head/sys/ofed/include/linux/mlx4/driver.h head/sys/ofed/include/linux/mlx4/qp.h head/sys/ofed/include/linux/mlx4/srq.h head/sys/ofed/include/linux/moduleparam.h head/sys/ofed/include/linux/pci.h head/sys/ofed/include/linux/sysfs.h head/sys/ofed/include/linux/types.h head/sys/ofed/include/linux/workqueue.h head/sys/ofed/include/rdma/ib_cm.h head/sys/ofed/include/rdma/ib_mad.h head/sys/ofed/include/rdma/ib_sa.h head/sys/ofed/include/rdma/ib_user_verbs.h head/sys/ofed/include/rdma/ib_verbs.h Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Sat Sep 28 23:03:40 2013 (r255931) +++ head/sys/conf/files Sun Sep 29 00:35:03 2013 (r255932) @@ -3542,6 +3542,18 @@ ofed/drivers/infiniband/ulp/sdp/sdp_tx.c no-depend \ compile-with "${OFED_C} -I$S/ofed/drivers/infiniband/ulp/sdp/" +ofed/drivers/infiniband/hw/mlx4/alias_GUID.c optional mlx4ib \ + no-depend obj-prefix "mlx4ib_" \ + compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/infiniband/hw/mlx4/" +ofed/drivers/infiniband/hw/mlx4/mcg.c optional mlx4ib \ + no-depend obj-prefix "mlx4ib_" \ + compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/infiniband/hw/mlx4/" +ofed/drivers/infiniband/hw/mlx4/sysfs.c optional mlx4ib \ + no-depend obj-prefix "mlx4ib_" \ + compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/infiniband/hw/mlx4/" +ofed/drivers/infiniband/hw/mlx4/cm.c optional mlx4ib \ + no-depend obj-prefix "mlx4ib_" \ + compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/infiniband/hw/mlx4/" ofed/drivers/infiniband/hw/mlx4/ah.c optional mlx4ib \ no-depend obj-prefix "mlx4ib_" \ compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/infiniband/hw/mlx4/" @@ -3624,7 +3636,10 @@ ofed/drivers/net/mlx4/sense.c optional ofed/drivers/net/mlx4/srq.c optional mlx4ib | mlxen \ no-depend obj-prefix "mlx4_" \ compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/" -ofed/drivers/net/mlx4/xrcd.c optional mlx4ib | mlxen \ +ofed/drivers/net/mlx4/resource_tracker.c optional mlx4ib | mlxen \ + no-depend obj-prefix "mlx4_" \ + compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/" +ofed/drivers/net/mlx4/sys_tune.c optional mlx4ib | mlxen \ no-depend obj-prefix "mlx4_" \ compile-with "${OFED_C_NOIMP} -I$S/ofed/drivers/net/mlx4/" Modified: head/sys/contrib/rdma/ib_umem.h ============================================================================== --- head/sys/contrib/rdma/ib_umem.h Sat Sep 28 23:03:40 2013 (r255931) +++ head/sys/contrib/rdma/ib_umem.h Sun Sep 29 00:35:03 2013 (r255932) @@ -28,21 +28,17 @@ * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. - * - * $FreeBSD$ */ #ifndef IB_UMEM_H #define IB_UMEM_H -struct ib_ucontext; +#include +#include +#include +#include -struct ib_umem_chunk { - TAILQ_ENTRY(ib_umem_chunk) entry; - int nents; - int nmap; - struct rdma_scatterlist page_list[0]; -}; +struct ib_ucontext; struct ib_umem { struct ib_ucontext *context; @@ -50,28 +46,76 @@ struct ib_umem { int offset; int page_size; int writable; - TAILQ_HEAD(, ib_umem_chunk) chunk_list; -#ifdef notyet + int hugetlb; + struct list_head chunk_list; struct work_struct work; struct mm_struct *mm; -#endif unsigned long diff; }; +/* contiguous memory structure */ +struct ib_cmem { + + struct ib_ucontext *context; + size_t length; + /* Link list of contiguous blocks being part of that cmem */ + struct list_head ib_cmem_block; + + /* Order of cmem block, 2^ block_order will equal number + of physical pages per block + */ + unsigned long block_order; + /* Refernce counter for that memory area + - When value became 0 pages will be returned to the kernel. + */ + struct kref refcount; +}; + + +struct ib_cmem_block { + + struct list_head list; + /* page will point to the page struct of the head page + in the current compound page. + block order is saved once as part of ib_cmem. + */ + struct page *page; +}; + + + +struct ib_umem_chunk { + struct list_head list; + int nents; + int nmap; + struct dma_attrs attrs; + struct scatterlist page_list[0]; +}; + #ifdef CONFIG_INFINIBAND_USER_MEM struct ib_umem *ib_umem_get(struct ib_ucontext *context, unsigned long addr, - size_t size, int access); + size_t size, int access, int dmasync); void ib_umem_release(struct ib_umem *umem); int ib_umem_page_count(struct ib_umem *umem); +int ib_cmem_map_contiguous_pages_to_vma(struct ib_cmem *ib_cmem, + struct vm_area_struct *vma); +struct ib_cmem *ib_cmem_alloc_contiguous_pages(struct ib_ucontext *context, + unsigned long total_size, + unsigned long page_size_order); +void ib_cmem_release_contiguous_pages(struct ib_cmem *cmem); +int ib_umem_map_to_vma(struct ib_umem *umem, + struct vm_area_struct *vma); + #else /* CONFIG_INFINIBAND_USER_MEM */ +#include static inline struct ib_umem *ib_umem_get(struct ib_ucontext *context, unsigned long addr, size_t size, - int access) { - return ERR_PTR(EINVAL); + int access, int dmasync) { + return ERR_PTR(-EINVAL); } static inline void ib_umem_release(struct ib_umem *umem) { } static inline int ib_umem_page_count(struct ib_umem *umem) { return 0; } Modified: head/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_provider.c ============================================================================== --- head/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_provider.c Sat Sep 28 23:03:40 2013 (r255931) +++ head/sys/dev/cxgb/ulp/iw_cxgb/iw_cxgb_provider.c Sun Sep 29 00:35:03 2013 (r255932) @@ -541,7 +541,8 @@ static int iwch_reregister_phys_mem(stru static struct ib_mr *iwch_reg_user_mr(struct ib_pd *pd, u64 start, u64 length, - u64 virt, int acc, struct ib_udata *udata) + u64 virt, int acc, struct ib_udata *udata, + int mr_id) { __be64 *pages; int shift, i, n; @@ -1136,7 +1137,7 @@ int iwch_register_device(struct iwch_dev dev->ibdev.iwcm->rem_ref = iwch_qp_rem_ref; dev->ibdev.iwcm->get_qp = iwch_get_qp; - ret = ib_register_device(&dev->ibdev); + ret = ib_register_device(&dev->ibdev, NULL); if (ret) goto bail1; Modified: head/sys/modules/Makefile ============================================================================== --- head/sys/modules/Makefile Sat Sep 28 23:03:40 2013 (r255931) +++ head/sys/modules/Makefile Sun Sep 29 00:35:03 2013 (r255932) @@ -128,6 +128,7 @@ SUBDIR= \ hwpmc \ ${_hyperv} \ ${_i2c} \ + ${_ibcore} \ ${_ibcs2} \ ${_ichwd} \ ${_ida} \ @@ -149,6 +150,7 @@ SUBDIR= \ ${_igb} \ ${_iir} \ ${_io} \ + ${_ipoib} \ ${_ipdivert} \ ${_ipfilter} \ ${_ipfw} \ @@ -499,11 +501,17 @@ _fe= fe _glxiic= glxiic _glxsb= glxsb _i2c= i2c +.if ${MK_OFED} != "no" || defined(ALL_MODULES) +_ibcore= ibcore +.endif _ibcs2= ibcs2 _ie= ie _if_ndis= if_ndis _igb= igb _io= io +.if ${MK_OFED} != "no" || defined(ALL_MODULES) +_ipoib= ipoib +.endif _lindev= lindev _linprocfs= linprocfs _linsysfs= linsysfs @@ -675,6 +683,9 @@ _hptrr= hptrr .endif _hyperv= hyperv _i2c= i2c +.if ${MK_OFED} != "no" || defined(ALL_MODULES) +_ibcore= ibcore +.endif _ichwd= ichwd _ida= ida _if_ndis= if_ndis @@ -682,6 +693,9 @@ _igb= igb _iir= iir _io= io _ipmi= ipmi +.if ${MK_OFED} != "no" || defined(ALL_MODULES) +_ipoib= ipoib +.endif _ips= ips _ipw= ipw .if ${MK_SOURCELESS_UCODE} != "no" Added: head/sys/modules/ibcore/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/modules/ibcore/Makefile Sun Sep 29 00:35:03 2013 (r255932) @@ -0,0 +1,23 @@ +# $FreeBSD$ +.PATH: ${.CURDIR}/../../ofed/drivers/infiniband/core +.PATH: ${.CURDIR}/../../ofed/include/linux + +.include + +KMOD = ibcore +SRCS = addr.c cm_msgs.h iwcm.c mad_rmpp.h sa_query.c ucma.c uverbs_cmd.c +SRCS+= agent.c local_sa.c iwcm.h multicast.c smi.c ud_header.c uverbs_main.c +SRCS+= agent.h core_priv.h mad.c notice.c smi.h umem.c uverbs_marshall.c +SRCS+= cache.c device.c mad_priv.h packer.c sysfs.c user_mad.c verbs.c +SRCS+= cm.c fmr_pool.c mad_rmpp.c sa.h ucm.c uverbs.h cma.c +SRCS+= linux_compat.c linux_radix.c linux_idr.c +SRCS+= vnode_if.h device_if.h bus_if.h pci_if.h opt_inet.h + +CFLAGS+= -I${.CURDIR}/../../ofed/drivers/infiniband/core +CFLAGS+= -I${.CURDIR}/../mlx4ib +CFLAGS+= -I${.CURDIR}/../../ofed/include/ +CFLAGS+= -DINET6 -DINET -DOFED + +.include + +CFLAGS+= -Wno-cast-qual -Wno-pointer-arith -fms-extensions Added: head/sys/modules/ipoib/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/modules/ipoib/Makefile Sun Sep 29 00:35:03 2013 (r255932) @@ -0,0 +1,31 @@ +# $FreeBSD$ +.PATH: ${.CURDIR}/../../ofed/drivers/infiniband/ulp/ipoib +.PATH: ${.CURDIR}/../../ofed/include/linux + +.include + +KMOD = ipoib +SRCS = device_if.h bus_if.h opt_ofed.h vnode_if.h opt_inet.h opt_inet6.h +SRCS += ipoib_cm.c ipoib_ib.c ipoib_main.c ipoib_multicast.c ipoib_verbs.c ipoib.h +SRCS+= linux_compat.c linux_radix.c linux_idr.c + +CFLAGS+= -I${.CURDIR}/../../ofed/drivers/infiniband/ulp/ipoib +CFLAGS+= -I${.CURDIR}/../ibcore +CFLAGS+= -I${.CURDIR}/../../ofed/include/ +CFLAGS+= -DINET6 -DINET -DOFED + +.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 Modified: head/sys/modules/mlx4/Makefile ============================================================================== --- head/sys/modules/mlx4/Makefile Sat Sep 28 23:03:40 2013 (r255931) +++ head/sys/modules/mlx4/Makefile Sun Sep 29 00:35:03 2013 (r255932) @@ -3,11 +3,11 @@ .include +.PATH: ${.CURDIR}/../../ofed/include/linux 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 +SRCS+= alloc.c catas.c cmd.c cq.c eq.c fw.c icm.c intf.c main.c mcg.c mr.c linux_compat.c linux_radix.c linux_idr.c +SRCS+= pd.c port.c profile.c qp.c reset.c sense.c srq.c resource_tracker.c sys_tune.c CFLAGS+= -I${.CURDIR}/../../ofed/drivers/net/mlx4 CFLAGS+= -I${.CURDIR}/../../ofed/include/ Modified: head/sys/modules/mlx4ib/Makefile ============================================================================== --- head/sys/modules/mlx4ib/Makefile Sat Sep 28 23:03:40 2013 (r255931) +++ head/sys/modules/mlx4ib/Makefile Sun Sep 29 00:35:03 2013 (r255932) @@ -1,14 +1,21 @@ # $FreeBSD$ .PATH: ${.CURDIR}/../../ofed/drivers/infiniband/hw/mlx4 +.PATH: ${.CURDIR}/../../ofed/include/linux .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+= linux_compat.c linux_radix.c linux_idr.c +SRCS+= alias_GUID.c mcg.c sysfs.c ah.c cq.c doorbell.c mad.c main.c mr.c qp.c srq.c wc.c cm.c SRCS+= opt_inet.h opt_inet6.h +#CFLAGS+= -I${.CURDIR}/../../ofed/include/ +#CFLAGS+= -I${.CURDIR}/../../../../include +CFLAGS+= -I${.CURDIR}/../../ofed/drivers/infiniband/hw/mlx4 CFLAGS+= -I${.CURDIR}/../../ofed/include/ +CFLAGS+= -DCONFIG_INFINIBAND_USER_MEM +CFLAGS+= -DINET6 -DINET -DOFED .if !defined(KERNBUILDDIR) .if ${MK_INET_SUPPORT} != "no" Modified: head/sys/ofed/drivers/infiniband/core/addr.c ============================================================================== --- head/sys/ofed/drivers/infiniband/core/addr.c Sat Sep 28 23:03:40 2013 (r255931) +++ head/sys/ofed/drivers/infiniband/core/addr.c Sun Sep 29 00:35:03 2013 (r255932) @@ -356,7 +356,7 @@ static int addr_resolve(struct sockaddr u_char edst[MAX_ADDR_LEN]; int multi; int bcast; - int error; + int error = 0; /* * Determine whether the address is unicast, multicast, or broadcast Modified: head/sys/ofed/drivers/infiniband/core/cma.c ============================================================================== --- head/sys/ofed/drivers/infiniband/core/cma.c Sat Sep 28 23:03:40 2013 (r255931) +++ head/sys/ofed/drivers/infiniband/core/cma.c Sun Sep 29 00:35:03 2013 (r255932) @@ -2957,7 +2957,7 @@ static void cma_set_mgid(struct rdma_id_ 0xFF10A01B)) { /* IPv6 address is an SA assigned MGID. */ memcpy(mgid, &sin6->sin6_addr, sizeof *mgid); - } else if ((addr->sa_family == AF_INET6)) { + } else if (addr->sa_family == AF_INET6) { ipv6_ib_mc_map(&sin6->sin6_addr, dev_addr->broadcast, mc_map); if (id_priv->id.ps == RDMA_PS_UDP) mc_map[7] = 0x01; /* Use RDMA CM signature */ Modified: head/sys/ofed/drivers/infiniband/core/core_priv.h ============================================================================== --- head/sys/ofed/drivers/infiniband/core/core_priv.h Sat Sep 28 23:03:40 2013 (r255931) +++ head/sys/ofed/drivers/infiniband/core/core_priv.h Sun Sep 29 00:35:03 2013 (r255932) @@ -38,7 +38,8 @@ #include -int ib_device_register_sysfs(struct ib_device *device); +int ib_device_register_sysfs(struct ib_device *device, int (*port_callback)(struct ib_device *, + u8, struct kobject *)); void ib_device_unregister_sysfs(struct ib_device *device); int ib_sysfs_setup(void); Modified: head/sys/ofed/drivers/infiniband/core/device.c ============================================================================== --- head/sys/ofed/drivers/infiniband/core/device.c Sat Sep 28 23:03:40 2013 (r255931) +++ head/sys/ofed/drivers/infiniband/core/device.c Sun Sep 29 00:35:03 2013 (r255932) @@ -273,7 +273,9 @@ out: * callback for each device that is added. @device must be allocated * with ib_alloc_device(). */ -int ib_register_device(struct ib_device *device) +int ib_register_device(struct ib_device *device, + int (*port_callback)(struct ib_device *, + u8, struct kobject *)) { int ret; @@ -294,8 +296,6 @@ int ib_register_device(struct ib_device INIT_LIST_HEAD(&device->client_data_list); spin_lock_init(&device->event_handler_lock); spin_lock_init(&device->client_data_lock); - device->ib_uverbs_xrcd_table = RB_ROOT; - mutex_init(&device->xrcd_table_mutex); ret = read_port_table_lengths(device); if (ret) { @@ -304,7 +304,7 @@ int ib_register_device(struct ib_device goto out; } - ret = ib_device_register_sysfs(device); + ret = ib_device_register_sysfs(device, port_callback); if (ret) { printk(KERN_WARNING "Couldn't register device %s with driver model\n", device->name); @@ -752,3 +752,19 @@ static void __exit ib_core_cleanup(void) module_init(ib_core_init); module_exit(ib_core_cleanup); + +#undef MODULE_VERSION +#include +static int +ibcore_evhand(module_t mod, int event, void *arg) +{ + return (0); +} + +static moduledata_t ibcore_mod = { + .name = "ibcore", + .evhand = ibcore_evhand, +}; + +MODULE_VERSION(ibcore, 1); +DECLARE_MODULE(ibcore, ibcore_mod, SI_SUB_SMP, SI_ORDER_ANY); Modified: head/sys/ofed/drivers/infiniband/core/sa_query.c ============================================================================== --- head/sys/ofed/drivers/infiniband/core/sa_query.c Sat Sep 28 23:03:40 2013 (r255931) +++ head/sys/ofed/drivers/infiniband/core/sa_query.c Sun Sep 29 00:35:03 2013 (r255932) @@ -1105,6 +1105,27 @@ static void ib_sa_inform_release(struct kfree(container_of(sa_query, struct ib_sa_inform_query, sa_query)); } +int ib_sa_guid_info_rec_query(struct ib_sa_client *client, + struct ib_device *device, u8 port_num, + struct ib_sa_guidinfo_rec *rec, + ib_sa_comp_mask comp_mask, u8 method, + int timeout_ms, gfp_t gfp_mask, + void (*callback)(int status, + struct ib_sa_guidinfo_rec *resp, + void *context), + void *context, + struct ib_sa_query **sa_query) +{ + // stub function - + // called originally from mad.c under mlx4_ib_init_sriov() + // which calls mlx4_ib_init_alias_guid_service() in alias_GUID.c + // which goes down to this function + + printk("ERROR: function should be called only in SRIOV flow!!!"); + + return 0; +} + /** * ib_sa_informinfo_query - Start an InformInfo registration. * @client:SA client Modified: head/sys/ofed/drivers/infiniband/core/sysfs.c ============================================================================== --- head/sys/ofed/drivers/infiniband/core/sysfs.c Sat Sep 28 23:03:40 2013 (r255931) +++ head/sys/ofed/drivers/infiniband/core/sysfs.c Sun Sep 29 00:35:03 2013 (r255932) @@ -38,6 +38,7 @@ #include #include +#include struct ib_port { struct kobject kobj; @@ -103,7 +104,7 @@ static ssize_t state_show(struct ib_port return ret; return sprintf(buf, "%d: %s\n", attr.state, - attr.state >= 0 && attr.state < ARRAY_SIZE(state_name) ? + attr.state < ARRAY_SIZE(state_name) ? state_name[attr.state] : "UNKNOWN"); } @@ -292,118 +293,124 @@ static ssize_t show_port_pkey(struct ib_ return sprintf(buf, "0x%04x\n", pkey); } -#define PORT_PMA_ATTR(_name, _counter, _width, _offset) \ -struct port_table_attribute port_pma_attr_##_name = { \ - .attr = __ATTR(_name, S_IRUGO, show_pma_counter, NULL), \ - .index = (_offset) | ((_width) << 16) | ((_counter) << 24) \ -} - -static ssize_t show_pma_counter(struct ib_port *p, struct port_attribute *attr, - char *buf) +static ssize_t get_pma_counters(struct ib_port *p, struct port_attribute *attr, + char *buf, int c_ext) { - struct port_table_attribute *tab_attr = - container_of(attr, struct port_table_attribute, attr); - int offset = tab_attr->index & 0xffff; - int width = (tab_attr->index >> 16) & 0xff; - struct ib_mad *in_mad = NULL; - struct ib_mad *out_mad = NULL; - ssize_t ret; + struct port_table_attribute *tab_attr = + container_of(attr, struct port_table_attribute, attr); + int offset = tab_attr->index & 0xffff; + int width = (tab_attr->index >> 16) & 0xff; + struct ib_mad *in_mad = NULL; + struct ib_mad *out_mad = NULL; + ssize_t ret; + + if (!p->ibdev->process_mad) + return -ENXIO; + + in_mad = kzalloc(sizeof *in_mad, GFP_KERNEL); + out_mad = kmalloc(sizeof *out_mad, GFP_KERNEL); + if (!in_mad || !out_mad) { + ret = -ENOMEM; + goto out; + } + + in_mad->mad_hdr.base_version = 1; + in_mad->mad_hdr.mgmt_class = IB_MGMT_CLASS_PERF_MGMT; + in_mad->mad_hdr.class_version = 1; + in_mad->mad_hdr.method = IB_MGMT_METHOD_GET; + if (c_ext) + in_mad->mad_hdr.attr_id = IB_PMA_PORT_COUNTERS_EXT; + else + in_mad->mad_hdr.attr_id = IB_PMA_PORT_COUNTERS; + + in_mad->data[41] = p->port_num; /* PortSelect field */ + + if ((p->ibdev->process_mad(p->ibdev, IB_MAD_IGNORE_MKEY, + p->port_num, NULL, NULL, in_mad, out_mad) & + (IB_MAD_RESULT_SUCCESS | IB_MAD_RESULT_REPLY)) != + (IB_MAD_RESULT_SUCCESS | IB_MAD_RESULT_REPLY)) { + ret = -EINVAL; + goto out; + } + + switch (width) { + case 4: + ret = sprintf(buf, "%u\n", (out_mad->data[40 + offset / 8] >> + (4 - (offset % 8))) & 0xf); + break; + case 8: + ret = sprintf(buf, "%u\n", out_mad->data[40 + offset / 8]); + break; + case 16: + ret = sprintf(buf, "%u\n", + be16_to_cpup((__be16 *)(out_mad->data + 40 + offset / 8))); + break; + case 32: + ret = sprintf(buf, "%u\n", + be32_to_cpup((__be32 *)(out_mad->data + 40 + offset / 8))); + break; + case 64: + ret = sprintf(buf, "%llu\n", (unsigned long long) + be64_to_cpup((__be64 *)(out_mad->data + 40 + offset / 8))); + break; + default: + ret = 0; + } - if (!p->ibdev->process_mad) - return sprintf(buf, "N/A (no PMA)\n"); - - in_mad = kzalloc(sizeof *in_mad, GFP_KERNEL); - out_mad = kmalloc(sizeof *out_mad, GFP_KERNEL); - if (!in_mad || !out_mad) { - ret = -ENOMEM; - goto out; - } +out: + kfree(in_mad); + kfree(out_mad); - in_mad->mad_hdr.base_version = 1; - in_mad->mad_hdr.mgmt_class = IB_MGMT_CLASS_PERF_MGMT; - in_mad->mad_hdr.class_version = 1; - in_mad->mad_hdr.method = IB_MGMT_METHOD_GET; - in_mad->mad_hdr.attr_id = cpu_to_be16(0x12); /* PortCounters */ - - in_mad->data[41] = p->port_num; /* PortSelect field */ - - if ((p->ibdev->process_mad(p->ibdev, IB_MAD_IGNORE_MKEY, - p->port_num, NULL, NULL, in_mad, out_mad) & - (IB_MAD_RESULT_SUCCESS | IB_MAD_RESULT_REPLY)) != - (IB_MAD_RESULT_SUCCESS | IB_MAD_RESULT_REPLY)) { - ret = -EINVAL; - goto out; - } - - switch (width) { - case 4: - ret = sprintf(buf, "%u\n", (out_mad->data[40 + offset / 8] >> - (4 - (offset % 8))) & 0xf); - break; - case 8: - ret = sprintf(buf, "%u\n", out_mad->data[40 + offset / 8]); - break; - case 16: - ret = sprintf(buf, "%u\n", - be16_to_cpup((__be16 *)(out_mad->data + 40 + offset / 8))); - break; - case 32: - ret = sprintf(buf, "%u\n", - be32_to_cpup((__be32 *)(out_mad->data + 40 + offset / 8))); - break; - default: - ret = 0; - } + return ret; +} -out: - kfree(in_mad); - kfree(out_mad); +#define PORT_PMA_ATTR(_name, _counter, _width, _offset) \ +struct port_table_attribute port_pma_attr_##_name = { \ + .attr = __ATTR(_name, S_IRUGO, show_pma_counter, NULL), \ + .index = (_offset) | ((_width) << 16) | ((_counter) << 24) \ +} - return ret; +static ssize_t show_pma_counter(struct ib_port *p, struct port_attribute *attr, + char *buf) +{ + return get_pma_counters(p, attr, buf, 0); } -static PORT_PMA_ATTR(symbol_error , 0, 16, 32); -static PORT_PMA_ATTR(link_error_recovery , 1, 8, 48); -static PORT_PMA_ATTR(link_downed , 2, 8, 56); -static PORT_PMA_ATTR(port_rcv_errors , 3, 16, 64); +static PORT_PMA_ATTR(symbol_error , 0, 16, 32); +static PORT_PMA_ATTR(link_error_recovery , 1, 8, 48); +static PORT_PMA_ATTR(link_downed , 2, 8, 56); +static PORT_PMA_ATTR(port_rcv_errors , 3, 16, 64); static PORT_PMA_ATTR(port_rcv_remote_physical_errors, 4, 16, 80); static PORT_PMA_ATTR(port_rcv_switch_relay_errors , 5, 16, 96); -static PORT_PMA_ATTR(port_xmit_discards , 6, 16, 112); +static PORT_PMA_ATTR(port_xmit_discards , 6, 16, 112); static PORT_PMA_ATTR(port_xmit_constraint_errors , 7, 8, 128); -static PORT_PMA_ATTR(port_rcv_constraint_errors , 8, 8, 136); +static PORT_PMA_ATTR(port_rcv_constraint_errors , 8, 8, 136); static PORT_PMA_ATTR(local_link_integrity_errors , 9, 4, 152); static PORT_PMA_ATTR(excessive_buffer_overrun_errors, 10, 4, 156); -static PORT_PMA_ATTR(VL15_dropped , 11, 16, 176); -static PORT_PMA_ATTR(port_xmit_data , 12, 32, 192); -static PORT_PMA_ATTR(port_rcv_data , 13, 32, 224); -static PORT_PMA_ATTR(port_xmit_packets , 14, 32, 256); -static PORT_PMA_ATTR(port_rcv_packets , 15, 32, 288); -/* - * There is no bit allocated for port_xmit_wait in the CounterSelect field - * (IB spec). However, since this bit is ignored when reading - * (show_pma_counter), the _counter field of port_xmit_wait can be set to zero. - */ -static PORT_PMA_ATTR(port_xmit_wait , 0, 32, 320); +static PORT_PMA_ATTR(VL15_dropped , 11, 16, 176); +static PORT_PMA_ATTR(port_xmit_data , 12, 32, 192); +static PORT_PMA_ATTR(port_rcv_data , 13, 32, 224); +static PORT_PMA_ATTR(port_xmit_packets , 14, 32, 256); +static PORT_PMA_ATTR(port_rcv_packets , 15, 32, 288); static struct attribute *pma_attrs[] = { - &port_pma_attr_symbol_error.attr.attr, - &port_pma_attr_link_error_recovery.attr.attr, - &port_pma_attr_link_downed.attr.attr, - &port_pma_attr_port_rcv_errors.attr.attr, - &port_pma_attr_port_rcv_remote_physical_errors.attr.attr, - &port_pma_attr_port_rcv_switch_relay_errors.attr.attr, - &port_pma_attr_port_xmit_discards.attr.attr, - &port_pma_attr_port_xmit_constraint_errors.attr.attr, - &port_pma_attr_port_rcv_constraint_errors.attr.attr, - &port_pma_attr_local_link_integrity_errors.attr.attr, - &port_pma_attr_excessive_buffer_overrun_errors.attr.attr, - &port_pma_attr_VL15_dropped.attr.attr, - &port_pma_attr_port_xmit_data.attr.attr, - &port_pma_attr_port_rcv_data.attr.attr, - &port_pma_attr_port_xmit_packets.attr.attr, - &port_pma_attr_port_rcv_packets.attr.attr, - &port_pma_attr_port_xmit_wait.attr.attr, - NULL + &port_pma_attr_symbol_error.attr.attr, + &port_pma_attr_link_error_recovery.attr.attr, + &port_pma_attr_link_downed.attr.attr, + &port_pma_attr_port_rcv_errors.attr.attr, + &port_pma_attr_port_rcv_remote_physical_errors.attr.attr, + &port_pma_attr_port_rcv_switch_relay_errors.attr.attr, + &port_pma_attr_port_xmit_discards.attr.attr, + &port_pma_attr_port_xmit_constraint_errors.attr.attr, + &port_pma_attr_port_rcv_constraint_errors.attr.attr, + &port_pma_attr_local_link_integrity_errors.attr.attr, + &port_pma_attr_excessive_buffer_overrun_errors.attr.attr, + &port_pma_attr_VL15_dropped.attr.attr, + &port_pma_attr_port_xmit_data.attr.attr, + &port_pma_attr_port_rcv_data.attr.attr, + &port_pma_attr_port_xmit_packets.attr.attr, + &port_pma_attr_port_rcv_packets.attr.attr, + NULL }; static struct attribute_group pma_group = { @@ -411,6 +418,44 @@ static struct attribute_group pma_group .attrs = pma_attrs }; +#define PORT_PMA_ATTR_EXT(_name, _counter, _width, _offset) \ +struct port_table_attribute port_pma_attr_ext_##_name = { \ + .attr = __ATTR(_name, S_IRUGO, show_pma_counter_ext, NULL), \ + .index = (_offset) | ((_width) << 16) | ((_counter) << 24) \ +} + +static ssize_t show_pma_counter_ext(struct ib_port *p, + struct port_attribute *attr, char *buf) +{ + return get_pma_counters(p, attr, buf, 1); +} + +static PORT_PMA_ATTR_EXT(port_xmit_data_64 , 0, 64, 64); +static PORT_PMA_ATTR_EXT(port_rcv_data_64 , 0, 64, 128); +static PORT_PMA_ATTR_EXT(port_xmit_packets_64 , 0, 64, 192); +static PORT_PMA_ATTR_EXT(port_rcv_packets_64 , 0, 64, 256); +static PORT_PMA_ATTR_EXT(port_unicast_xmit_packets , 0, 64, 320); +static PORT_PMA_ATTR_EXT(port_unicast_rcv_packets , 0, 64, 384); +static PORT_PMA_ATTR_EXT(port_multicast_xmit_packets , 0, 64, 448); +static PORT_PMA_ATTR_EXT(port_multicast_rcv_packets , 0, 64, 512); + +static struct attribute *pma_attrs_ext[] = { + &port_pma_attr_ext_port_xmit_data_64.attr.attr, + &port_pma_attr_ext_port_rcv_data_64.attr.attr, + &port_pma_attr_ext_port_xmit_packets_64.attr.attr, + &port_pma_attr_ext_port_rcv_packets_64.attr.attr, + &port_pma_attr_ext_port_unicast_xmit_packets.attr.attr, + &port_pma_attr_ext_port_unicast_rcv_packets.attr.attr, + &port_pma_attr_ext_port_multicast_xmit_packets.attr.attr, + &port_pma_attr_ext_port_multicast_rcv_packets.attr.attr, + NULL +}; + +static struct attribute_group pma_ext_group = { + .name = "counters_ext", + .attrs = pma_attrs_ext +}; + static void ib_port_release(struct kobject *kobj) { struct ib_port *p = container_of(kobj, struct ib_port, kobj); @@ -503,7 +548,9 @@ err: return NULL; } -static int add_port(struct ib_device *device, int port_num) +static int add_port(struct ib_device *device, int port_num, + int (*port_callback)(struct ib_device *, + u8, struct kobject *)) { struct ib_port *p; struct ib_port_attr attr; @@ -522,7 +569,7 @@ static int add_port(struct ib_device *de p->port_num = port_num; ret = kobject_init_and_add(&p->kobj, &port_type, - device->ports_parent, + kobject_get(device->ports_parent), "%d", port_num); if (ret) goto err_put; @@ -531,10 +578,14 @@ static int add_port(struct ib_device *de if (ret) goto err_put; + ret = sysfs_create_group(&p->kobj, &pma_ext_group); + if (ret) + goto err_remove_pma; + p->gid_group.name = "gids"; p->gid_group.attrs = alloc_group_attrs(show_port_gid, attr.gid_tbl_len); if (!p->gid_group.attrs) - goto err_remove_pma; + goto err_remove_pma_ext; ret = sysfs_create_group(&p->kobj, &p->gid_group); if (ret) @@ -550,6 +601,12 @@ static int add_port(struct ib_device *de if (ret) goto err_free_pkey; + if (port_callback) { + ret = port_callback(device, port_num, &p->kobj); + if (ret) + goto err_remove_pkey; + } + list_add_tail(&p->kobj.entry, &device->port_list); #ifdef __linux__ @@ -557,6 +614,9 @@ static int add_port(struct ib_device *de #endif return 0; +err_remove_pkey: + sysfs_remove_group(&p->kobj, &p->pkey_group); + err_free_pkey: for (i = 0; i < attr.pkey_tbl_len; ++i) kfree(p->pkey_group.attrs[i]); @@ -572,6 +632,9 @@ err_free_gid: kfree(p->gid_group.attrs); +err_remove_pma_ext: + sysfs_remove_group(&p->kobj, &pma_ext_group); + err_remove_pma: sysfs_remove_group(&p->kobj, &pma_group); @@ -786,16 +849,17 @@ static struct attribute_group iw_stats_g .attrs = iw_proto_stats_attrs, }; -int ib_device_register_sysfs(struct ib_device *device) +int ib_device_register_sysfs(struct ib_device *device, + int (*port_callback)(struct ib_device *, u8, struct kobject *)) { struct device *class_dev = &device->dev; int ret; int i; class_dev->class = &ib_class; - class_dev->driver_data = device; class_dev->parent = device->dma_device; - dev_set_name(class_dev, device->name); + dev_set_name(class_dev, device->name); + dev_set_drvdata(class_dev, device); INIT_LIST_HEAD(&device->port_list); @@ -810,19 +874,19 @@ int ib_device_register_sysfs(struct ib_d } device->ports_parent = kobject_create_and_add("ports", - &class_dev->kobj); - if (!device->ports_parent) { + kobject_get(&class_dev->kobj)); + if (!device->ports_parent) { ret = -ENOMEM; goto err_put; } if (device->node_type == RDMA_NODE_IB_SWITCH) { - ret = add_port(device, 0); + ret = add_port(device, 0, port_callback); if (ret) goto err_put; } else { for (i = 1; i <= device->phys_port_cnt; ++i) { - ret = add_port(device, i); + ret = add_port(device, i, port_callback); if (ret) goto err_put; } @@ -864,10 +928,15 @@ void ib_device_unregister_sysfs(struct i { struct kobject *p, *t; struct ib_port *port; + int i; /* Hold kobject until ib_dealloc_device() */ kobject_get(&device->dev.kobj); + for (i = 0; i < ARRAY_SIZE(ib_class_attributes); ++i) { + device_remove_file(&device->dev, ib_class_attributes[i]); + } + list_for_each_entry_safe(p, t, &device->port_list, entry) { list_del(&p->entry); port = container_of(p, struct ib_port, kobj); @@ -891,7 +960,7 @@ void ib_sysfs_cleanup(void) class_unregister(&ib_class); } -int ib_sysfs_create_port_files(struct ib_device *device, +/*int ib_sysfs_create_port_files(struct ib_device *device, int (*create)(struct ib_device *dev, u8 port_num, struct kobject *kobj)) { @@ -908,4 +977,4 @@ int ib_sysfs_create_port_files(struct ib return ret; } -EXPORT_SYMBOL(ib_sysfs_create_port_files); +EXPORT_SYMBOL(ib_sysfs_create_port_files);*/ Modified: head/sys/ofed/drivers/infiniband/core/uverbs_cmd.c ============================================================================== --- head/sys/ofed/drivers/infiniband/core/uverbs_cmd.c Sat Sep 28 23:03:40 2013 (r255931) +++ head/sys/ofed/drivers/infiniband/core/uverbs_cmd.c Sun Sep 29 00:35:03 2013 (r255932) @@ -312,7 +312,7 @@ ssize_t ib_uverbs_get_context(struct ib_ INIT_LIST_HEAD(&ucontext->qp_list); INIT_LIST_HEAD(&ucontext->srq_list); INIT_LIST_HEAD(&ucontext->ah_list); - INIT_LIST_HEAD(&ucontext->xrc_domain_list); + INIT_LIST_HEAD(&ucontext->xrcd_list); ucontext->closing = 0; resp.num_comp_vectors = file->device->num_comp_vectors; @@ -633,7 +633,7 @@ ssize_t ib_uverbs_reg_mr(struct ib_uverb } mr = pd->device->reg_user_mr(pd, cmd.start, cmd.length, cmd.hca_va, - cmd.access_flags, &udata); + cmd.access_flags, &udata, 0); if (IS_ERR(mr)) { ret = PTR_ERR(mr); goto err_put; @@ -1087,7 +1087,7 @@ ssize_t ib_uverbs_create_qp(struct ib_uv attr.srq = srq; attr.sq_sig_type = cmd.sq_sig_all ? IB_SIGNAL_ALL_WR : IB_SIGNAL_REQ_WR; attr.qp_type = cmd.qp_type; - attr.xrc_domain = xrcd; + attr.xrcd = xrcd; attr.create_flags = 0; attr.cap.max_send_wr = cmd.max_send_wr; @@ -1115,14 +1115,14 @@ ssize_t ib_uverbs_create_qp(struct ib_uv qp->event_handler = attr.event_handler; qp->qp_context = attr.qp_context; qp->qp_type = attr.qp_type; - qp->xrcd = attr.xrc_domain; + qp->xrcd = attr.xrcd; atomic_inc(&pd->usecnt); atomic_inc(&attr.send_cq->usecnt); atomic_inc(&attr.recv_cq->usecnt); if (attr.srq) atomic_inc(&attr.srq->usecnt); - else if (attr.xrc_domain) - atomic_inc(&attr.xrc_domain->usecnt); + else if (attr.xrcd) + atomic_inc(&attr.xrcd->usecnt); obj->uevent.uobject.object = qp; ret = idr_add_uobj(&ib_uverbs_qp_idr, &obj->uevent.uobject); @@ -2032,8 +2032,8 @@ ssize_t ib_uverbs_create_srq(struct ib_u srq->uobject = &obj->uobject; srq->event_handler = attr.event_handler; srq->srq_context = attr.srq_context; - srq->xrc_cq = NULL; - srq->xrcd = NULL; + srq->ext.xrc.cq = NULL; + srq->ext.xrc.xrcd = NULL; atomic_inc(&pd->usecnt); atomic_set(&srq->usecnt, 0); @@ -2083,7 +2083,7 @@ ssize_t ib_uverbs_create_xrc_srq(struct const char __user *buf, int in_len, int out_len) { - struct ib_uverbs_create_xrc_srq cmd; + struct ib_uverbs_create_xsrq cmd; struct ib_uverbs_create_srq_resp resp; struct ib_udata udata; struct ib_uevent_object *obj; @@ -2119,7 +2119,7 @@ ssize_t ib_uverbs_create_xrc_srq(struct goto err; } - xrc_cq = idr_read_cq(cmd.xrc_cq, file->ucontext, 0); + xrc_cq = idr_read_cq(cmd.cq_handle, file->ucontext, 0); if (!xrc_cq) { ret = -EINVAL; goto err_put_pd; @@ -2152,8 +2152,8 @@ ssize_t ib_uverbs_create_xrc_srq(struct srq->uobject = &obj->uobject; srq->event_handler = attr.event_handler; srq->srq_context = attr.srq_context; - srq->xrc_cq = xrc_cq; - srq->xrcd = xrcd; + srq->ext.xrc.cq = xrc_cq; + srq->ext.xrc.xrcd = xrcd; atomic_inc(&pd->usecnt); atomic_inc(&xrc_cq->usecnt); atomic_inc(&xrcd->usecnt); @@ -2528,7 +2528,7 @@ ssize_t ib_uverbs_open_xrc_domain(struct INIT_LIST_HEAD(&xrcd_uobj->xrc_reg_qp_list); mutex_lock(&file->mutex); - list_add_tail(&uobj->list, &file->ucontext->xrc_domain_list); + list_add_tail(&uobj->list, &file->ucontext->xrcd_list); mutex_unlock(&file->mutex); uobj->live = 1; @@ -2598,7 +2598,7 @@ ssize_t ib_uverbs_close_xrc_domain(struc if (!ret) { list_for_each_entry(t_uobj, &file->ucontext->srq_list, list) { struct ib_srq *srq = t_uobj->object; - if (srq->xrcd && srq->xrcd == uobj->object) { + if (srq->ext.xrc.xrcd && srq->ext.xrc.xrcd == uobj->object) { ret = -EBUSY; break; } @@ -2702,7 +2702,7 @@ ssize_t ib_uverbs_create_xrc_rcv_qp(stru init_attr.sq_sig_type = cmd.sq_sig_all ? IB_SIGNAL_ALL_WR : IB_SIGNAL_REQ_WR; init_attr.qp_type = IB_QPT_XRC; - init_attr.xrc_domain = xrcd; + init_attr.xrcd = xrcd; init_attr.cap.max_send_wr = 1; init_attr.cap.max_recv_wr = 0; Modified: head/sys/ofed/drivers/infiniband/core/uverbs_main.c ============================================================================== --- head/sys/ofed/drivers/infiniband/core/uverbs_main.c Sat Sep 28 23:03:40 2013 (r255931) +++ head/sys/ofed/drivers/infiniband/core/uverbs_main.c Sun Sep 29 00:35:03 2013 (r255932) @@ -110,8 +110,8 @@ static ssize_t (*uverbs_cmd_table[])(str [IB_USER_VERBS_CMD_QUERY_SRQ] = ib_uverbs_query_srq, [IB_USER_VERBS_CMD_DESTROY_SRQ] = ib_uverbs_destroy_srq, [IB_USER_VERBS_CMD_CREATE_XRC_SRQ] = ib_uverbs_create_xrc_srq, - [IB_USER_VERBS_CMD_OPEN_XRC_DOMAIN] = ib_uverbs_open_xrc_domain, - [IB_USER_VERBS_CMD_CLOSE_XRC_DOMAIN] = ib_uverbs_close_xrc_domain, + [IB_USER_VERBS_CMD_OPEN_XRCD] = ib_uverbs_open_xrc_domain, + [IB_USER_VERBS_CMD_CLOSE_XRCD] = ib_uverbs_close_xrc_domain, [IB_USER_VERBS_CMD_CREATE_XRC_RCV_QP] = ib_uverbs_create_xrc_rcv_qp, [IB_USER_VERBS_CMD_MODIFY_XRC_RCV_QP] = ib_uverbs_modify_xrc_rcv_qp, [IB_USER_VERBS_CMD_QUERY_XRC_RCV_QP] = ib_uverbs_query_xrc_rcv_qp, @@ -258,7 +258,7 @@ static int ib_uverbs_cleanup_ucontext(st } *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***