From owner-svn-src-head@FreeBSD.ORG Tue Oct 1 15:42:40 2013 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 0CA66491; Tue, 1 Oct 2013 15:42:40 +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 DE55124A3; Tue, 1 Oct 2013 15:42:39 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r91FgdFg034374; Tue, 1 Oct 2013 15:42:39 GMT (envelope-from alfred@svn.freebsd.org) Received: (from alfred@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r91FgdrZ034371; Tue, 1 Oct 2013 15:42:39 GMT (envelope-from alfred@svn.freebsd.org) Message-Id: <201310011542.r91FgdrZ034371@svn.freebsd.org> From: Alfred Perlstein Date: Tue, 1 Oct 2013 15:42:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r255972 - in head/sys/ofed: drivers/infiniband/core drivers/infiniband/hw/mlx4 include/rdma X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Oct 2013 15:42:40 -0000 Author: alfred Date: Tue Oct 1 15:42:38 2013 New Revision: 255972 URL: http://svnweb.freebsd.org/changeset/base/255972 Log: Enable ib_dev.mmap function Removed the ifdef linux from this function. Added stub function for contiguous pages to avoid compilation errors. Submitted by: Orit Moskovich (oritm mellanox.com) Approved by: re Modified: head/sys/ofed/drivers/infiniband/core/umem.c head/sys/ofed/drivers/infiniband/hw/mlx4/main.c head/sys/ofed/include/rdma/ib_umem.h Modified: head/sys/ofed/drivers/infiniband/core/umem.c ============================================================================== --- head/sys/ofed/drivers/infiniband/core/umem.c Tue Oct 1 15:40:27 2013 (r255971) +++ head/sys/ofed/drivers/infiniband/core/umem.c Tue Oct 1 15:42:38 2013 (r255972) @@ -530,3 +530,46 @@ int ib_umem_page_count(struct ib_umem *u return n; } EXPORT_SYMBOL(ib_umem_page_count); + +/**********************************************/ +/* + * Stub functions for contiguous pages - + * We currently do not support this feature + */ +/**********************************************/ + +/** + * ib_cmem_release_contiguous_pages - release memory allocated by + * ib_cmem_alloc_contiguous_pages. + * @cmem: cmem struct to release + */ +void ib_cmem_release_contiguous_pages(struct ib_cmem *cmem) +{ +} +EXPORT_SYMBOL(ib_cmem_release_contiguous_pages); + +/** + * * ib_cmem_alloc_contiguous_pages - allocate contiguous pages + * * @context: userspace context to allocate memory for + * * @total_size: total required size for that allocation. + * * @page_size_order: order of one contiguous page. + * */ +struct ib_cmem *ib_cmem_alloc_contiguous_pages(struct ib_ucontext *context, + unsigned long total_size, + unsigned long page_size_order) +{ + return NULL; +} +EXPORT_SYMBOL(ib_cmem_alloc_contiguous_pages); + +/** + * * ib_cmem_map_contiguous_pages_to_vma - map contiguous pages into VMA + * * @ib_cmem: cmem structure returned by ib_cmem_alloc_contiguous_pages + * * @vma: VMA to inject pages into. + * */ +int ib_cmem_map_contiguous_pages_to_vma(struct ib_cmem *ib_cmem, + struct vm_area_struct *vma) +{ + return 0; +} +EXPORT_SYMBOL(ib_cmem_map_contiguous_pages_to_vma); Modified: head/sys/ofed/drivers/infiniband/hw/mlx4/main.c ============================================================================== --- head/sys/ofed/drivers/infiniband/hw/mlx4/main.c Tue Oct 1 15:40:27 2013 (r255971) +++ head/sys/ofed/drivers/infiniband/hw/mlx4/main.c Tue Oct 1 15:42:38 2013 (r255972) @@ -726,6 +726,7 @@ full_search: addr = ALIGN(vma->vm_end, 1 << page_size_order); } } +#endif static int mlx4_ib_mmap(struct ib_ucontext *context, struct vm_area_struct *vma) { @@ -780,7 +781,6 @@ static int mlx4_ib_mmap(struct ib_uconte return 0; } -#endif static struct ib_pd *mlx4_ib_alloc_pd(struct ib_device *ibdev, struct ib_ucontext *context, @@ -1984,8 +1984,8 @@ static void *mlx4_ib_add(struct mlx4_dev ibdev->ib_dev.modify_port = mlx4_ib_modify_port; ibdev->ib_dev.alloc_ucontext = mlx4_ib_alloc_ucontext; ibdev->ib_dev.dealloc_ucontext = mlx4_ib_dealloc_ucontext; -#ifdef __linux__ ibdev->ib_dev.mmap = mlx4_ib_mmap; +#ifdef __linux__ ibdev->ib_dev.get_unmapped_area = mlx4_ib_get_unmapped_area; #endif ibdev->ib_dev.alloc_pd = mlx4_ib_alloc_pd; Modified: head/sys/ofed/include/rdma/ib_umem.h ============================================================================== --- head/sys/ofed/include/rdma/ib_umem.h Tue Oct 1 15:40:27 2013 (r255971) +++ head/sys/ofed/include/rdma/ib_umem.h Tue Oct 1 15:42:38 2013 (r255972) @@ -57,6 +57,24 @@ struct ib_umem { unsigned long diff; }; +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_umem_chunk { struct list_head list; int nents; @@ -70,4 +88,14 @@ struct ib_umem *ib_umem_get(struct ib_uc 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); + + #endif /* IB_UMEM_H */