Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion libibverbs/dummy_ops.c
Original file line number Diff line number Diff line change
Expand Up @@ -369,11 +369,22 @@ static int query_device(struct ibv_context *context,
return EOPNOTSUPP;
}

/* Provide a generic implementation for all providers that don't implement
* query_device_ex.
*/
static int query_device_ex(struct ibv_context *context,
const struct ibv_query_device_ex_input *input,
struct ibv_device_attr_ex *attr, size_t attr_size)
{
return EOPNOTSUPP;
if (input && input->comp_mask)
return EINVAL;

if (attr_size < sizeof(attr->orig_attr))
return EOPNOTSUPP;

memset(&attr->orig_attr, 0, sizeof(attr->orig_attr));

return ibv_query_device(context, &attr->orig_attr);
}

static int query_port(struct ibv_context *context, uint8_t port_num,
Expand Down
7 changes: 6 additions & 1 deletion libibverbs/man/ibv_query_device_ex.3
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,24 @@
.\"
.TH IBV_QUERY_DEVICE_EX 3 2014-12-17 libibverbs "Libibverbs Programmer's Manual"
.SH "NAME"
ibv_query_device_ex \- query an RDMA device's attributes
ibv_query_device_ex \- query an RDMA device's attributes including extended
device properties.
.SH "SYNOPSIS"
.nf
.B #include <infiniband/verbs.h>
.sp
.BI "int ibv_query_device_ex(struct ibv_context " "*context",
.BI " struct ibv_query_device_ex_input " "*input",
.BI " struct ibv_device_attr_ex " "*attr" );
.fi
.SH "DESCRIPTION"
.B ibv_query_device_ex()
returns the attributes of the device with context
.I context\fR.
The argument
.I input
is a pointer to an ibv_query_device_ex_input structure, used for future extensions
The argument
.I attr
is a pointer to an ibv_device_attr_ex struct, as defined in <infiniband/verbs.h>.
.PP
Expand Down
5 changes: 4 additions & 1 deletion libibverbs/verbs.h
Original file line number Diff line number Diff line change
Expand Up @@ -2962,12 +2962,15 @@ ibv_query_device_ex(struct ibv_context *context,
struct verbs_context *vctx;
int ret;

if (input && input->comp_mask)
return EINVAL;

vctx = verbs_get_ctx_op(context, query_device_ex);
if (!vctx)
goto legacy;

ret = vctx->query_device_ex(context, input, attr, sizeof(*attr));
if (ret == EOPNOTSUPP)
if (ret == EOPNOTSUPP || ret == ENOSYS)
goto legacy;

return ret;
Expand Down