From: Gal Pressman <galpress@amazon.com>
To: Jason Gunthorpe <jgg@nvidia.com>, <linux-rdma@vger.kernel.org>,
Bob Pearson <rpearsonhpe@gmail.com>
Subject: Re: [PATCH 2/9] verbs: Add ibv_cmd_query_device_any()
Date: Wed, 18 Nov 2020 14:43:57 +0200 [thread overview]
Message-ID: <bdb30557-27fa-3ea4-39a9-4bdb136ff798@amazon.com> (raw)
In-Reply-To: <2-v1-34e141ddf17e+89-query_device_ex_jgg@nvidia.com>
On 16/11/2020 22:23, Jason Gunthorpe wrote:
> This implements all the query_device command flows under a single call.
>
> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
> ---
> libibverbs/cmd_device.c | 155 +++++++++++++++++++++++++++++++++++
> libibverbs/driver.h | 5 ++
> libibverbs/libibverbs.map.in | 1 +
> 3 files changed, 161 insertions(+)
>
> diff --git a/libibverbs/cmd_device.c b/libibverbs/cmd_device.c
> index 6c8e01ec9866a9..0019784ee779c1 100644
> --- a/libibverbs/cmd_device.c
> +++ b/libibverbs/cmd_device.c
> @@ -35,6 +35,7 @@
> #include <stdlib.h>
> #include <dirent.h>
> #include <infiniband/cmd_write.h>
> +#include <util/util.h>
>
> #include <net/if.h>
>
> @@ -516,3 +517,157 @@ ssize_t _ibv_query_gid_table(struct ibv_context *context,
>
> return num_entries;
> }
> +
> +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.
next prev parent reply other threads:[~2020-11-18 12:44 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-16 20:23 [PATCH 0/9] Simplify query_device() in libibverbs Jason Gunthorpe
2020-11-16 20:23 ` [PATCH 1/9] verbs: Simplify query_device_ex Jason Gunthorpe
2020-11-16 20:23 ` [PATCH 2/9] verbs: Add ibv_cmd_query_device_any() Jason Gunthorpe
2020-11-18 12:43 ` Gal Pressman [this message]
2020-11-18 12:45 ` Jason Gunthorpe
2020-11-16 20:23 ` [PATCH 3/9] mlx5: Move context initialization out of mlx5_query_device_ex() Jason Gunthorpe
2020-11-17 17:24 ` Yishai Hadas
2020-11-17 19:08 ` Jason Gunthorpe
2020-11-16 20:23 ` [PATCH 4/9] efa: Move the context intialization out of efa_query_device_ex() Jason Gunthorpe
2020-11-18 7:39 ` Gal Pressman
2020-11-18 8:07 ` Gal Pressman
2020-11-18 12:45 ` Gal Pressman
2020-11-18 20:59 ` Jason Gunthorpe
2020-11-16 20:23 ` [PATCH 5/9] mlx4: Move the context intialization out of mlx4_query_device_ex() Jason Gunthorpe
2020-11-16 20:23 ` [PATCH 6/9] providers: Remove normal query_device() from providers that have _ex Jason Gunthorpe
2020-11-18 12:47 ` Gal Pressman
2020-11-16 20:23 ` [PATCH 7/9] providers: Convert all providers to implement query_device_ex Jason Gunthorpe
2020-11-16 20:23 ` [PATCH 8/9] verbs: Remove dead code Jason Gunthorpe
2020-11-18 12:46 ` Gal Pressman
2020-11-18 12:53 ` Jason Gunthorpe
2020-11-16 20:23 ` [PATCH 9/9] verbs: Delete query_device() internal support Jason Gunthorpe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=bdb30557-27fa-3ea4-39a9-4bdb136ff798@amazon.com \
--to=galpress@amazon.com \
--cc=jgg@nvidia.com \
--cc=linux-rdma@vger.kernel.org \
--cc=rpearsonhpe@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).