[openib-general] Re: [patch][kdapl] integrate dapl_mr_util function into dapl_rmr.c

James Lentini jlentini at netapp.com
Tue Jun 14 17:31:28 PDT 2005


Committed in revision 2608 with a few modifications (I changed the 
dat_mr_ function names to dat_rmr_ for consistency).

On Tue, 14 Jun 2005, Itamar wrote:

>
> Integrate dapl_mr_util functions into dapl_rmr.c
> Delete dapl_mr_util.[h|c] files
> Delete define DAPL_ATS in Makefile (not in use)
>
> Signed-off-by: Itamar Rabenstein <itamar at mellanox.co.il>
>
> Index: Makefile
> ===================================================================
> --- Makefile	(revision 2595)
> +++ Makefile	(working copy)
> @@ -9,7 +9,6 @@
> endif
>
> EXTRA_CFLAGS += 			\
> -    -DDAPL_ATS				\
>     -Idrivers/infiniband/include	\
>     -Idrivers/dat
>
> @@ -26,7 +25,6 @@
>         dapl_ia                  	\
>         dapl_llist                    	\
>         dapl_lmr                 	\
> -        dapl_mr_util                  	\
>         dapl_provider                 	\
>         dapl_pz                         \
>         dapl_ring_buffer_util         	\
> Index: dapl_rmr.c
> ===================================================================
> --- dapl_rmr.c	(revision 2595)
> +++ dapl_rmr.c	(working copy)
> @@ -32,7 +32,6 @@
> #include "dapl.h"
> #include "dapl_ep.h"
> #include "dapl_ia.h"
> -#include "dapl_mr_util.h"
> #include "dapl_hash.h"
> #include "dapl_cookie.h"
> #include "dapl_openib_util.h"
> @@ -92,6 +91,62 @@
> 	kfree(rmr);
> }
>
> +/*
> + * dapl_mr_get_address
> + *
> + * Returns the memory address associated with the given memory descriptor
> + *
> + * Input:
> + * 	desc		memory descriptor
> + * 	type		type of memory represented by desc
> + *
> + * Output:
> + * 	None
> + *
> + */
> +u64 dapl_mr_get_address(DAT_REGION_DESCRIPTION desc, enum dat_mem_type type)
> +{
> +	struct dapl_lmr *lmr;
> +
> +	switch (type) {
> +	case DAT_MEM_TYPE_VIRTUAL:
> +		return (u64) (unsigned long) desc.for_va;
> +	case DAT_MEM_TYPE_LMR:
> +		lmr = (struct dapl_lmr *)desc.for_lmr;
> +
> +		/* Since this function is recoursive we cannot inline it */
> +		return dapl_mr_get_address(lmr->param.region_desc,
> +					   lmr->param.mem_type);
> +	case DAT_MEM_TYPE_PHYSICAL:
> +		return desc.for_pa;
> +	default:
> +		/*
> +		 * The following kDAPL memory types have not been implemented:
> +		 *    DAT_MEM_TYPE_PLATFORM
> +		 *    DAT_MEM_TYPE_IA
> +		 *    DAT_MEM_TYPE_BYPASS
> +		 */
> +		dapl_os_assert(0);
> +		return 0;
> +	}
> +}
> +
> +/*
> + * dapl_mr_bounds_check
> + *
> + * Returns true if region B is contained within region A
> + * and false otherwise
> + *
> + */
> +static inline boolean_t dapl_mr_bounds_check(u64 addr_a, u64 length_a,
> +					     u64 addr_b, u64 length_b)
> +{
> +	if ((addr_a <= addr_b) && (addr_b + length_b) <= (addr_a + length_a))
> +		return TRUE;
> +	else
> +		return FALSE;
> +}
> +
> static inline u32 dapl_rmr_bind_fuse(struct dapl_rmr *rmr,
> 				     const struct dat_lmr_triplet *lmr_triplet,
> 				     enum dat_mem_priv_flags mem_priv,
> Index: dapl_mr_util.c
> ===================================================================
> --- dapl_mr_util.c	(revision 2595)
> +++ dapl_mr_util.c	(working copy)
> @@ -1,79 +0,0 @@
> -/*
> - * Copyright (c) 2002-2005, Network Appliance, Inc. All rights reserved.
> - *
> - * This Software is licensed under one of the following licenses:
> - *
> - * 1) under the terms of the "Common Public License 1.0" a copy of which is
> - *    available from the Open Source Initiative, see
> - *    http://www.opensource.org/licenses/cpl.php.
> - *
> - * 2) under the terms of the "The BSD License" a copy of which is
> - *    available from the Open Source Initiative, see
> - *    http://www.opensource.org/licenses/bsd-license.php.
> - *
> - * 3) under the terms of the "GNU General Public License (GPL) Version 2" a
> - *    copy of which is available from the Open Source Initiative, see
> - *    http://www.opensource.org/licenses/gpl-license.php.
> - *
> - * Licensee has the right to choose one of the above licenses.
> - *
> - * Redistributions of source code must retain the above copyright
> - * notice and one of the license notices.
> - *
> - * Redistributions in binary form must reproduce both the above copyright
> - * notice, one of the license notices in the documentation
> - * and/or other materials provided with the distribution.
> - */
> -
> -#include "dapl_mr_util.h"
> -
> -/*
> - * $Id$
> - */
> -
> -/*********************************************************************
> - *                                                                   *
> - * Function Definitions	                                             *
> - *                                                                   *
> - *********************************************************************/
> -
> -/*
> - * dapl_mr_get_address
> - *
> - * Returns the memory address associated with the given memory descriptor
> - *
> - * Input:
> - * 	desc		memory descriptor
> - * 	type		type of memory represented by desc
> - *
> - * Output:
> - * 	None
> - *
> - */
> -
> -u64 dapl_mr_get_address(DAT_REGION_DESCRIPTION desc, enum dat_mem_type type)
> -{
> -	struct dapl_lmr *lmr;
> -
> -	switch (type) {
> -	case DAT_MEM_TYPE_VIRTUAL:
> -		return (u64) (unsigned long) desc.for_va;
> -	case DAT_MEM_TYPE_LMR:
> -		lmr = (struct dapl_lmr *)desc.for_lmr;
> -
> -		/* Since this function is recoursive we cannot inline it */
> -		return dapl_mr_get_address(lmr->param.region_desc,
> -					   lmr->param.mem_type);
> -	case DAT_MEM_TYPE_PHYSICAL:
> -		return desc.for_pa;
> -	default:
> -		/*
> -		 * The following kDAPL memory types have not been implemented:
> -		 *    DAT_MEM_TYPE_PLATFORM
> -		 *    DAT_MEM_TYPE_IA
> -		 *    DAT_MEM_TYPE_BYPASS
> -		 */
> -		dapl_os_assert(0);
> -		return 0;
> -	}
> -}
> Index: dapl_mr_util.h
> ===================================================================
> --- dapl_mr_util.h	(revision 2595)
> +++ dapl_mr_util.h	(working copy)
> @@ -1,58 +0,0 @@
> -/*
> - * Copyright (c) 2002-2005, Network Appliance, Inc. All rights reserved.
> - *
> - * This Software is licensed under one of the following licenses:
> - *
> - * 1) under the terms of the "Common Public License 1.0" a copy of which is
> - *    available from the Open Source Initiative, see
> - *    http://www.opensource.org/licenses/cpl.php.
> - *
> - * 2) under the terms of the "The BSD License" a copy of which is
> - *    available from the Open Source Initiative, see
> - *    http://www.opensource.org/licenses/bsd-license.php.
> - *
> - * 3) under the terms of the "GNU General Public License (GPL) Version 2" a
> - *    copy of which is available from the Open Source Initiative, see
> - *    http://www.opensource.org/licenses/gpl-license.php.
> - *
> - * Licensee has the right to choose one of the above licenses.
> - *
> - * Redistributions of source code must retain the above copyright
> - * notice and one of the license notices.
> - *
> - * Redistributions in binary form must reproduce both the above copyright
> - * notice, one of the license notices in the documentation
> - * and/or other materials provided with the distribution.
> - */
> -
> -/*
> - * $Id$
> - */
> -
> -#ifndef DAPL_MR_UTIL_H
> -#define DAPL_MR_UTIL_H
> -
> -#include "dapl.h"
> -#include "dapl_hash.h"
> -
> -extern u64 dapl_mr_get_address(DAT_REGION_DESCRIPTION desc,
> -			       enum dat_mem_type type);
> -
> -/*
> - * dapl_mr_bounds_check
> - *
> - * Returns true if region B is contained within region A
> - * and false otherwise
> - *
> - */
> -
> -static inline boolean_t dapl_mr_bounds_check(u64 addr_a, u64 length_a,
> -					     u64 addr_b, u64 length_b)
> -{
> -	if ((addr_a <= addr_b) && (addr_b + length_b) <= (addr_a + length_a))
> -		return TRUE;
> -	else
> -		return FALSE;
> -}
> -
> -#endif				/* DAPL_MR_UTIL_H */
> Index: dapl_provider.c
> ===================================================================
> --- dapl_provider.c	(revision 2595)
> +++ dapl_provider.c	(working copy)
> @@ -36,7 +36,6 @@
> #include "dapl.h"
> #include "dapl_hca_util.h"
> #include "dapl_provider.h"
> -#include "dapl_mr_util.h"
> #include "dapl_util.h"
> #include "dapl_openib_util.h"
>
> -- 
> Itamar
>



More information about the general mailing list