linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgg@nvidia.com>
To: Leon Romanovsky <leon@kernel.org>
Cc: Doug Ledford <dledford@redhat.com>,
	Maor Gottlieb <maorg@mellanox.com>, <linux-rdma@vger.kernel.org>
Subject: Re: [PATCH rdma-next v2 08/11] RDMA: Add support to dump resource tracker in RAW format
Date: Thu, 18 Jun 2020 20:20:09 -0300	[thread overview]
Message-ID: <20200618232009.GA2487227@mellanox.com> (raw)
In-Reply-To: <20200616104006.2425549-9-leon@kernel.org>

On Tue, Jun 16, 2020 at 01:40:03PM +0300, Leon Romanovsky wrote:

> +static int fill_res_qp_entry(struct sk_buff *msg, bool has_cap_net_admin,
> +			     struct rdma_restrack_entry *res, uint32_t port,
> +			     bool raw)
> +{
> +	struct ib_qp *qp = container_of(res, struct ib_qp, res);
> +	struct ib_device *dev = qp->device;
> +	int ret;
> +
> +	if (port && port != qp->port)
> +		return -EAGAIN;
> +
> +	/* In create_qp() port is not set yet */
> +	if (qp->port && nla_put_u32(msg, RDMA_NLDEV_ATTR_PORT_INDEX, qp->port))
> +		return -EINVAL;
> +
> +	ret = nla_put_u32(msg, RDMA_NLDEV_ATTR_RES_LQPN, qp->qp_num);
> +	if (ret)
> +		goto err;
> +
>  	if (!rdma_is_kernel_res(res) &&
>  	    nla_put_u32(msg, RDMA_NLDEV_ATTR_RES_PDN, qp->pd->res.id))
>  		goto err;
>  
> -	if (fill_res_name_pid(msg, res))
> +	ret = fill_res_name_pid(msg, res);
> +	if (ret)
>  		goto err;
>  
> -	if (dev->ops.fill_res_qp_entry)
> -		return dev->ops.fill_res_qp_entry(msg, qp);
> -	return 0;
> +	if (!raw)
> +		return fill_res_qp_entry_query(msg, res, dev, qp);

Are you sure the RAW query should duplicate all the stuff the normal
query does? Shouldn't the raw query return only the raw blob?

The rest seems fine, but this is rather odd?

> @@ -1252,9 +1291,11 @@ static int res_get_common_doit(struct sk_buff *skb, struct nlmsghdr *nlh,
>  		goto err_get;
>  	}
>  
> -	nlh = nlmsg_put(msg, NETLINK_CB(skb).portid, nlh->nlmsg_seq,
> -			RDMA_NL_GET_TYPE(RDMA_NL_NLDEV, fe->nldev_cmd),
> -			0, 0);
> +	nlh = nlmsg_put(
> +		msg, NETLINK_CB(skb).portid, nlh->nlmsg_seq,
> +		RDMA_NL_GET_TYPE(RDMA_NL_NLDEV,
> +				 (raw ? fe->nldev_cmd_raw : fe->nldev_cmd)),
> +		0, 0);

Isn't this ternary just RMDA_NL_GET_OP(nlh->nlmsg_type) ?

and I suppose RDMA_NL_GET_TYPE should be named MAKE_TYPE?

Jason

  reply	other threads:[~2020-06-18 23:20 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-16 10:39 [PATCH rdma-next v2 00/11] RAW format dumps through RDMAtool Leon Romanovsky
2020-06-16 10:39 ` [PATCH mlx5-next v2 01/11] net/mlx5: Export resource dump interface Leon Romanovsky
2020-06-16 10:39 ` [PATCH mlx5-next v2 02/11] net/mlx5: Add support in query QP, CQ and MKEY segments Leon Romanovsky
2020-06-16 10:39 ` [PATCH rdma-next v2 03/11] RDMA/core: Don't call fill_res_entry for PD Leon Romanovsky
2020-06-16 10:39 ` [PATCH rdma-next v2 04/11] RDMA: Add dedicated MR resource tracker function Leon Romanovsky
2020-06-16 10:40 ` [PATCH rdma-next v2 05/11] RDMA: Add a dedicated CQ " Leon Romanovsky
2020-06-16 10:40 ` [PATCH rdma-next v2 06/11] RDMA: Add dedicated QP " Leon Romanovsky
2020-06-16 10:40 ` [PATCH rdma-next v2 07/11] RDMA: Add dedicated CM_ID " Leon Romanovsky
2020-06-16 10:40 ` [PATCH rdma-next v2 08/11] RDMA: Add support to dump resource tracker in RAW format Leon Romanovsky
2020-06-18 23:20   ` Jason Gunthorpe [this message]
2020-06-21  7:55     ` Leon Romanovsky
2020-06-22 12:16       ` Jason Gunthorpe
2020-06-16 10:40 ` [PATCH rdma-next v2 09/11] RDMA/mlx5: Add support to get QP resource " Leon Romanovsky
2020-06-16 10:40 ` [PATCH rdma-next v2 10/11] RDMA/mlx5: Add support to get CQ " Leon Romanovsky
2020-06-16 10:40 ` [PATCH rdma-next v2 11/11] RDMA/mlx5: Add support to get MR " Leon Romanovsky

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=20200618232009.GA2487227@mellanox.com \
    --to=jgg@nvidia.com \
    --cc=dledford@redhat.com \
    --cc=leon@kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=maorg@mellanox.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).