Path: blob/main/sys/ofed/include/rdma/ib_fmr_pool.h
39483 views
/*-1* SPDX-License-Identifier: BSD-2-Clause OR GPL-2.02*3* Copyright (c) 2004 Topspin Corporation. All rights reserved.4* Copyright (c) 2005 Sun Microsystems, Inc. All rights reserved.5*6* This software is available to you under a choice of one of two7* licenses. You may choose to be licensed under the terms of the GNU8* General Public License (GPL) Version 2, available from the file9* COPYING in the main directory of this source tree, or the10* OpenIB.org BSD license below:11*12* Redistribution and use in source and binary forms, with or13* without modification, are permitted provided that the following14* conditions are met:15*16* - Redistributions of source code must retain the above17* copyright notice, this list of conditions and the following18* disclaimer.19*20* - Redistributions in binary form must reproduce the above21* copyright notice, this list of conditions and the following22* disclaimer in the documentation and/or other materials23* provided with the distribution.24*25* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,26* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF27* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND28* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS29* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN30* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN31* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE32* SOFTWARE.33*/3435#if !defined(IB_FMR_POOL_H)36#define IB_FMR_POOL_H3738#include <rdma/ib_verbs.h>3940struct ib_fmr_pool;4142/**43* struct ib_fmr_pool_param - Parameters for creating FMR pool44* @max_pages_per_fmr:Maximum number of pages per map request.45* @page_shift: Log2 of sizeof "pages" mapped by this fmr46* @access:Access flags for FMRs in pool.47* @pool_size:Number of FMRs to allocate for pool.48* @dirty_watermark:Flush is triggered when @dirty_watermark dirty49* FMRs are present.50* @flush_function:Callback called when unmapped FMRs are flushed and51* more FMRs are possibly available for mapping52* @flush_arg:Context passed to user's flush function.53* @cache:If set, FMRs may be reused after unmapping for identical map54* requests.55*/56struct ib_fmr_pool_param {57int max_pages_per_fmr;58int page_shift;59enum ib_access_flags access;60int pool_size;61int dirty_watermark;62void (*flush_function)(struct ib_fmr_pool *pool,63void *arg);64void *flush_arg;65unsigned cache:1;66};6768struct ib_pool_fmr {69struct ib_fmr *fmr;70struct ib_fmr_pool *pool;71struct list_head list;72struct hlist_node cache_node;73int ref_count;74int remap_count;75u64 io_virtual_address;76int page_list_len;77u64 page_list[0];78};7980struct ib_fmr_pool *ib_create_fmr_pool(struct ib_pd *pd,81struct ib_fmr_pool_param *params);8283void ib_destroy_fmr_pool(struct ib_fmr_pool *pool);8485int ib_flush_fmr_pool(struct ib_fmr_pool *pool);8687struct ib_pool_fmr *ib_fmr_pool_map_phys(struct ib_fmr_pool *pool_handle,88u64 *page_list,89int list_len,90u64 io_virtual_address);9192int ib_fmr_pool_unmap(struct ib_pool_fmr *fmr);9394#endif /* IB_FMR_POOL_H */959697