@@ -47,71 +47,6 @@
bool verbs_allow_disassociate_destroy;
-static void copy_query_dev_fields(struct ibv_device_attr *device_attr,
- struct ib_uverbs_query_device_resp *resp,
- uint64_t *raw_fw_ver)
-{
- *raw_fw_ver = resp->fw_ver;
- device_attr->node_guid = resp->node_guid;
- device_attr->sys_image_guid = resp->sys_image_guid;
- device_attr->max_mr_size = resp->max_mr_size;
- device_attr->page_size_cap = resp->page_size_cap;
- device_attr->vendor_id = resp->vendor_id;
- device_attr->vendor_part_id = resp->vendor_part_id;
- device_attr->hw_ver = resp->hw_ver;
- device_attr->max_qp = resp->max_qp;
- device_attr->max_qp_wr = resp->max_qp_wr;
- device_attr->device_cap_flags = resp->device_cap_flags;
- device_attr->max_sge = resp->max_sge;
- device_attr->max_sge_rd = resp->max_sge_rd;
- device_attr->max_cq = resp->max_cq;
- device_attr->max_cqe = resp->max_cqe;
- device_attr->max_mr = resp->max_mr;
- device_attr->max_pd = resp->max_pd;
- device_attr->max_qp_rd_atom = resp->max_qp_rd_atom;
- device_attr->max_ee_rd_atom = resp->max_ee_rd_atom;
- device_attr->max_res_rd_atom = resp->max_res_rd_atom;
- device_attr->max_qp_init_rd_atom = resp->max_qp_init_rd_atom;
- device_attr->max_ee_init_rd_atom = resp->max_ee_init_rd_atom;
- device_attr->atomic_cap = resp->atomic_cap;
- device_attr->max_ee = resp->max_ee;
- device_attr->max_rdd = resp->max_rdd;
- device_attr->max_mw = resp->max_mw;
- device_attr->max_raw_ipv6_qp = resp->max_raw_ipv6_qp;
- device_attr->max_raw_ethy_qp = resp->max_raw_ethy_qp;
- device_attr->max_mcast_grp = resp->max_mcast_grp;
- device_attr->max_mcast_qp_attach = resp->max_mcast_qp_attach;
- device_attr->max_total_mcast_qp_attach = resp->max_total_mcast_qp_attach;
- device_attr->max_ah = resp->max_ah;
- device_attr->max_fmr = resp->max_fmr;
- device_attr->max_map_per_fmr = resp->max_map_per_fmr;
- device_attr->max_srq = resp->max_srq;
- device_attr->max_srq_wr = resp->max_srq_wr;
- device_attr->max_srq_sge = resp->max_srq_sge;
- device_attr->max_pkeys = resp->max_pkeys;
- device_attr->local_ca_ack_delay = resp->local_ca_ack_delay;
- device_attr->phys_port_cnt = resp->phys_port_cnt;
-}
-
-int ibv_cmd_query_device(struct ibv_context *context,
- struct ibv_device_attr *device_attr,
- uint64_t *raw_fw_ver,
- struct ibv_query_device *cmd, size_t cmd_size)
-{
- struct ib_uverbs_query_device_resp resp;
- int ret;
-
- ret = execute_cmd_write(context, IB_USER_VERBS_CMD_QUERY_DEVICE, cmd,
- cmd_size, &resp, sizeof(resp));
- if (ret)
- return ret;
-
- memset(device_attr->fw_ver, 0, sizeof device_attr->fw_ver);
- copy_query_dev_fields(device_attr, &resp, raw_fw_ver);
-
- return 0;
-}
-
int ibv_cmd_alloc_pd(struct ibv_context *context, struct ibv_pd *pd,
struct ibv_alloc_pd *cmd, size_t cmd_size,
struct ib_uverbs_alloc_pd_resp *resp, size_t resp_size)
@@ -320,6 +320,7 @@ static void set_lib_ops(struct verbs_context *vctx)
#undef ibv_query_port
vctx->context.ops._compat_query_port = ibv_query_port;
vctx->query_port = __lib_query_port;
+ vctx->context.ops._compat_query_device = ibv_query_device;
/*
* In order to maintain backward/forward binary compatibility
@@ -354,8 +354,6 @@ struct verbs_context_ops {
struct ibv_ops_wr **bad_op);
int (*post_srq_recv)(struct ibv_srq *srq, struct ibv_recv_wr *recv_wr,
struct ibv_recv_wr **bad_recv_wr);
- int (*query_device)(struct ibv_context *context,
- struct ibv_device_attr *device_attr);
int (*query_device_ex)(struct ibv_context *context,
const struct ibv_query_device_ex_input *input,
struct ibv_device_attr_ex *attr,
@@ -449,10 +447,6 @@ int ibv_cmd_get_context(struct verbs_context *context,
struct ib_uverbs_get_context_resp *resp, size_t resp_size);
int ibv_cmd_query_context(struct ibv_context *ctx,
struct ibv_command_buffer *driver);
-int ibv_cmd_query_device(struct ibv_context *context,
- struct ibv_device_attr *device_attr,
- uint64_t *raw_fw_ver,
- struct ibv_query_device *cmd, size_t cmd_size);
int ibv_cmd_create_flow_action_esp(struct ibv_context *ctx,
struct ibv_flow_action_esp_attr *attr,
struct verbs_flow_action *flow_action,
@@ -377,35 +377,11 @@ static int post_srq_recv(struct ibv_srq *srq, struct ibv_recv_wr *recv_wr,
return EOPNOTSUPP;
}
-static int query_device(struct ibv_context *context,
- struct ibv_device_attr *device_attr)
-{
- const struct verbs_context_ops *ops = get_ops(context);
-
- if (!ops->query_device_ex)
- return EOPNOTSUPP;
- return ops->query_device_ex(
- context, NULL,
- container_of(device_attr, struct ibv_device_attr_ex, orig_attr),
- sizeof(*device_attr));
-}
-
-/* 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)
{
- if (input && input->comp_mask)
- return EINVAL;
-
- if (attr_size < sizeof(attr->orig_attr))
- return EOPNOTSUPP;
-
- memset(attr, 0, attr_size);
-
- return ibv_query_device(context, &attr->orig_attr);
+ return EOPNOTSUPP;
}
static int query_ece(struct ibv_qp *qp, struct ibv_ece *ece)
@@ -558,7 +534,6 @@ const struct verbs_context_ops verbs_dummy_ops = {
post_send,
post_srq_ops,
post_srq_recv,
- query_device,
query_device_ex,
query_ece,
query_port,
@@ -680,7 +655,6 @@ void verbs_set_ops(struct verbs_context *vctx,
SET_OP(ctx, post_send);
SET_OP(vctx, post_srq_ops);
SET_OP(ctx, post_srq_recv);
- SET_PRIV_OP(ctx, query_device);
SET_OP(vctx, query_device_ex);
SET_PRIV_OP_IC(vctx, query_ece);
SET_PRIV_OP_IC(ctx, query_port);
@@ -156,7 +156,10 @@ LATEST_SYMVER_FUNC(ibv_query_device, 1_1, "IBVERBS_1.1",
struct ibv_context *context,
struct ibv_device_attr *device_attr)
{
- return get_ops(context)->query_device(context, device_attr);
+ return get_ops(context)->query_device_ex(
+ context, NULL,
+ container_of(device_attr, struct ibv_device_attr_ex, orig_attr),
+ sizeof(*device_attr));
}
int __lib_query_port(struct ibv_context *context, uint8_t port_num,
@@ -1922,7 +1922,8 @@ struct ibv_device {
struct _compat_ibv_port_attr;
struct ibv_context_ops {
- void *(*_compat_query_device)(void);
+ int (*_compat_query_device)(struct ibv_context *context,
+ struct ibv_device_attr *device_attr);
int (*_compat_query_port)(struct ibv_context *context,
uint8_t port_num,
struct _compat_ibv_port_attr *port_attr);
@@ -114,8 +114,6 @@ static struct verbs_context *c4iw_alloc_context(struct ibv_device *ibdev,
struct ibv_get_context cmd;
struct uc4iw_alloc_ucontext_resp resp;
struct c4iw_dev *rhp = to_c4iw_dev(ibdev);
- struct ibv_query_device qcmd;
- uint64_t raw_fw_ver;
struct ibv_device_attr attr;
context = verbs_init_and_alloc_context(ibdev, cmd_fd, context, ibv_ctx,
@@ -143,8 +141,10 @@ static struct verbs_context *c4iw_alloc_context(struct ibv_device *ibdev,
}
verbs_set_ops(&context->ibv_ctx, &c4iw_ctx_common_ops);
- if (ibv_cmd_query_device(&context->ibv_ctx.context, &attr,
- &raw_fw_ver, &qcmd, sizeof(qcmd)))
+ if (c4iw_query_device(&context->ibv_ctx.context, NULL,
+ container_of(&attr, struct ibv_device_attr_ex,
+ orig_attr),
+ sizeof(attr)))
goto err_unmap;
if (!rhp->mmid2ptr) {
Now that all providers only implement the _ex API have the external API call query_device_ex() directly and remove everything to do with the internal query_device op. Signed-off-by: Jason Gunthorpe <jgg@nvidia.com> --- libibverbs/cmd.c | 65 ------------------------------------------ libibverbs/device.c | 1 + libibverbs/driver.h | 6 ---- libibverbs/dummy_ops.c | 28 +----------------- libibverbs/verbs.c | 5 +++- libibverbs/verbs.h | 3 +- providers/cxgb4/dev.c | 8 +++--- 7 files changed, 12 insertions(+), 104 deletions(-)