libibverbs: Introduce struct ibv_buf for common buffer description Add struct ibv_buf with addr and size fields to provide a common abstraction for buffer metadata that providers can embed in their internal buffer structures. Introduce an init helper alongside. Signed-off-by: Jiri Pirko <jiri@nvidia.com>
diff --git a/libibverbs/driver.h b/libibverbs/driver.h index e618772..45a0b1d 100644 --- a/libibverbs/driver.h +++ b/libibverbs/driver.h
@@ -49,6 +49,21 @@ struct verbs_device; +/* Must change the PRIVATE IBVERBS_PRIVATE_ symbol if this is changed */ +struct ibv_buf { + void *addr; + size_t size; + struct ibv_pd *pd; +}; + +static inline void ibv_buf_init(struct ibv_buf *buf, struct ibv_pd *pd, + void *addr, size_t size) +{ + buf->pd = pd; + buf->addr = addr; + buf->size = size; +} + enum { VERBS_LOG_LEVEL_NONE, VERBS_LOG_ERR,
diff --git a/libibverbs/verbs.h b/libibverbs/verbs.h index 36d120e..63a6faa 100644 --- a/libibverbs/verbs.h +++ b/libibverbs/verbs.h
@@ -636,6 +636,8 @@ struct ibv_context *context; }; +struct ibv_buf; + struct ibv_pd { struct ibv_context *context; uint32_t handle;