On 16/11/2020 22:23, Jason Gunthorpe wrote: > When the user calls efa_query_device_ex() it should not cause the context > values to be mutated, only the attribute shuld be returned. > > Move this code to a dedicated function that is only called during context > setup. > > Cc: Gal Pressman <galpress@xxxxxxxxxx> > Signed-off-by: Jason Gunthorpe <jgg@xxxxxxxxxx> > --- > providers/efa/efa.c | 14 +------------ > providers/efa/verbs.c | 46 +++++++++++++++++++++++++++++++++++-------- > providers/efa/verbs.h | 1 + > 3 files changed, 40 insertions(+), 21 deletions(-) > > diff --git a/providers/efa/efa.c b/providers/efa/efa.c > index 35f9b246a711ec..b24c14f7fa1fe1 100644 > --- a/providers/efa/efa.c > +++ b/providers/efa/efa.c > @@ -54,10 +54,7 @@ static struct verbs_context *efa_alloc_context(struct ibv_device *vdev, > { > struct efa_alloc_ucontext_resp resp = {}; > struct efa_alloc_ucontext cmd = {}; > - struct ibv_device_attr_ex attr; > - unsigned int qp_table_sz; > struct efa_context *ctx; > - int err; > > cmd.comp_mask |= EFA_ALLOC_UCONTEXT_CMD_COMP_TX_BATCH; > cmd.comp_mask |= EFA_ALLOC_UCONTEXT_CMD_COMP_MIN_SQ_WR; > @@ -86,17 +83,8 @@ static struct verbs_context *efa_alloc_context(struct ibv_device *vdev, > > verbs_set_ops(&ctx->ibvctx, &efa_ctx_ops); > > - err = efa_query_device_ex(&ctx->ibvctx.context, NULL, &attr, > - sizeof(attr)); > - if (err) > + if (!efa_query_device_ctx(ctx)) > goto err_free_spinlock; This return error on success seems to be the issue, will verify.