From 34030a52fed2ffc38167083c1286cc71d4f1e1d5 Mon Sep 17 00:00:00 2001 From: Roland Dreier Date: Thu, 8 Mar 2007 10:05:24 -0800 Subject: [PATCH] Add low-level driver hooks for reregister MR and memory windows Add methods to struct ibv_context_ops to make it possible to implement reregister memory region and alloc/bind/dealloc memory window operations in the future without breaking the libibverbs ABI. Assuming these methods and data structures are designed properly (which is hard to say, absent any real implementation) then it will only be necessary to add new libibverbs functions to call the hooks, which will be source and binary compatible with existing applications and low-level drivers. Applications that want to use the new functions can easily check for their existence at compile time. Signed-off-by: Roland Dreier --- include/infiniband/verbs.h | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/include/infiniband/verbs.h b/include/infiniband/verbs.h index 49cd581..2ae50ab 100644 --- a/include/infiniband/verbs.h +++ b/include/infiniband/verbs.h @@ -1,7 +1,7 @@ /* * Copyright (c) 2004, 2005 Topspin Communications. All rights reserved. * Copyright (c) 2004 Intel Corporation. All rights reserved. - * Copyright (c) 2005, 2006 Cisco Systems, Inc. All rights reserved. + * Copyright (c) 2005, 2006, 2007 Cisco Systems, Inc. All rights reserved. * Copyright (c) 2005 PathScale, Inc. All rights reserved. * * This software is available to you under a choice of one of two @@ -288,6 +288,13 @@ struct ibv_pd { uint32_t handle; }; +enum ibv_rereg_mr_flags { + IBV_REREG_MR_CHANGE_TRANSLATION = (1 << 0), + IBV_REREG_MR_CHANGE_PD = (1 << 1), + IBV_REREG_MR_CHANGE_ACCESS = (1 << 2), + IBV_REREG_MR_KEEP_VALID = (1 << 3) +}; + struct ibv_mr { struct ibv_context *context; struct ibv_pd *pd; @@ -298,6 +305,17 @@ struct ibv_mr { uint32_t rkey; }; +enum ibv_mw_type { + IBV_MW_TYPE_1 = 1, + IBV_MW_TYPE_2 = 2 +}; + +struct ibv_mw { + struct ibv_context *context; + struct ibv_pd *pd; + uint32_t rkey; +}; + struct ibv_global_route { union ibv_gid dgid; uint32_t flow_label; @@ -517,6 +535,15 @@ struct ibv_recv_wr { int num_sge; }; +struct ibv_mw_bind { + uint64_t wr_id; + struct ibv_mr *mr; + void *addr; + size_t length; + enum ibv_send_flags send_flags; + enum ibv_access_flags mw_access_flags; +}; + struct ibv_srq { struct ibv_context *context; void *srq_context; @@ -603,7 +630,16 @@ struct ibv_context_ops { int (*dealloc_pd)(struct ibv_pd *pd); struct ibv_mr * (*reg_mr)(struct ibv_pd *pd, void *addr, size_t length, enum ibv_access_flags access); + struct ibv_mr * (*rereg_mr)(struct ibv_mr *mr, + enum ibv_rereg_mr_flags flags, + struct ibv_pd *pd, void *addr, + size_t length, + enum ibv_access_flags access); int (*dereg_mr)(struct ibv_mr *mr); + struct ibv_mw * (*alloc_mw)(struct ibv_pd *pd, enum ibv_mw_type type); + int (*bind_mw)(struct ibv_qp *qp, struct ibv_mw *mw, + struct ibv_mw_bind *mw_bind); + int (*dealloc_mw)(struct ibv_mw *mw); struct ibv_cq * (*create_cq)(struct ibv_context *context, int cqe, struct ibv_comp_channel *channel, int comp_vector); -- 2.46.0