On Wed, Nov 18, 2020 at 02:43:57PM +0200, Gal Pressman wrote: > On 16/11/2020 22:23, Jason Gunthorpe wrote: > > +int ibv_cmd_query_device_any(struct ibv_context *context, > > + const struct ibv_query_device_ex_input *input, > > + struct ibv_device_attr_ex *attr, size_t attr_size, > > + struct ib_uverbs_ex_query_device_resp *resp, > > + size_t *resp_size) > > +{ > > + struct ib_uverbs_ex_query_device_resp internal_resp; > > + size_t internal_resp_size; > > + int err; > > + > > + if (input && input->comp_mask) > > + return EINVAL; > > + if (attr_size < sizeof(attr->orig_attr)) > > + return EINVAL; > > + > > + if (!resp) { > > + resp = &internal_resp; > > + internal_resp_size = sizeof(internal_resp); > > + resp_size = &internal_resp_size; > > + } > > + memset(attr, 0, attr_size); > > + memset(resp, 0, *resp_size); > > + > > + if (attr_size > sizeof(attr->orig_attr)) { > > + struct ibv_query_device_ex cmd = {}; > > + > > + err = execute_cmd_write_ex(context, > > + IB_USER_VERBS_EX_CMD_QUERY_DEVICE, > > + &cmd, sizeof(cmd), resp, *resp_size); > > + if (err) { > > + if (err != EOPNOTSUPP) > > Are you sure about that? > I think older kernels return ENOSYS. Oh, that is possibly true, we changed those at one point, I didn't test that far back. Jason