/*1* Copyright (c) 2004 Topspin Corporation. All rights reserved.2* Copyright (c) 2005 Sun Microsystems, Inc. All rights reserved.3*4* This software is available to you under a choice of one of two5* licenses. You may choose to be licensed under the terms of the GNU6* General Public License (GPL) Version 2, available from the file7* COPYING in the main directory of this source tree, or the8* OpenIB.org BSD license below:9*10* Redistribution and use in source and binary forms, with or11* without modification, are permitted provided that the following12* conditions are met:13*14* - Redistributions of source code must retain the above15* copyright notice, this list of conditions and the following16* disclaimer.17*18* - Redistributions in binary form must reproduce the above19* copyright notice, this list of conditions and the following20* disclaimer in the documentation and/or other materials21* provided with the distribution.22*23* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,24* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF25* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND26* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS27* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN28* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN29* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE30* SOFTWARE.31*/3233#if !defined(IB_FMR_POOL_H)34#define IB_FMR_POOL_H3536#include <rdma/ib_verbs.h>3738struct ib_fmr_pool;3940/**41* struct ib_fmr_pool_param - Parameters for creating FMR pool42* @max_pages_per_fmr:Maximum number of pages per map request.43* @page_shift: Log2 of sizeof "pages" mapped by this fmr44* @access:Access flags for FMRs in pool.45* @pool_size:Number of FMRs to allocate for pool.46* @dirty_watermark:Flush is triggered when @dirty_watermark dirty47* FMRs are present.48* @flush_function:Callback called when unmapped FMRs are flushed and49* more FMRs are possibly available for mapping50* @flush_arg:Context passed to user's flush function.51* @cache:If set, FMRs may be reused after unmapping for identical map52* requests.53*/54struct ib_fmr_pool_param {55int max_pages_per_fmr;56int page_shift;57enum ib_access_flags access;58int pool_size;59int dirty_watermark;60void (*flush_function)(struct ib_fmr_pool *pool,61void *arg);62void *flush_arg;63unsigned cache:1;64};6566struct ib_pool_fmr {67struct ib_fmr *fmr;68struct ib_fmr_pool *pool;69struct list_head list;70struct hlist_node cache_node;71int ref_count;72int remap_count;73u64 io_virtual_address;74int page_list_len;75u64 page_list[0];76};7778struct ib_fmr_pool *ib_create_fmr_pool(struct ib_pd *pd,79struct ib_fmr_pool_param *params);8081void ib_destroy_fmr_pool(struct ib_fmr_pool *pool);8283int ib_flush_fmr_pool(struct ib_fmr_pool *pool);8485struct ib_pool_fmr *ib_fmr_pool_map_phys(struct ib_fmr_pool *pool_handle,86u64 *page_list,87int list_len,88u64 io_virtual_address);8990int ib_fmr_pool_unmap(struct ib_pool_fmr *fmr);9192#endif /* IB_FMR_POOL_H */939495