Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
From: Leon Romanovsky <leon@kernel.org>
To: Cheng Xu <chengyou@linux.alibaba.com>
Cc: jgg@ziepe.ca, dledford@redhat.com, linux-rdma@vger.kernel.org,
	KaiShen@linux.alibaba.com, tonylu@linux.alibaba.com
Subject: Re: [PATCH rdma-next 09/11] RDMA/erdma: Add the erdma module
Date: Tue, 21 Dec 2021 15:26:23 +0200	[thread overview]
Message-ID: <YcHV/+VeD2xxIU3I@unreal> (raw)
In-Reply-To: <20211221024858.25938-10-chengyou@linux.alibaba.com>

On Tue, Dec 21, 2021 at 10:48:56AM +0800, Cheng Xu wrote:
> Add the main erdma module and debugfs files. The main module provides
> interface to infiniband subsytem, and the debugfs module provides a way
> to allow user can get the core status of the device and set the preferred
> congestion control algorithm.

debugfs is for debug - dump various information.
It is not the right interface to set configuration properties.

> 
> Signed-off-by: Cheng Xu <chengyou@linux.alibaba.com>
> ---
>  drivers/infiniband/hw/erdma/erdma_debug.c | 314 ++++++++++
>  drivers/infiniband/hw/erdma/erdma_debug.h |  18 +
>  drivers/infiniband/hw/erdma/erdma_main.c  | 711 ++++++++++++++++++++++
>  3 files changed, 1043 insertions(+)
>  create mode 100644 drivers/infiniband/hw/erdma/erdma_debug.c
>  create mode 100644 drivers/infiniband/hw/erdma/erdma_debug.h
>  create mode 100644 drivers/infiniband/hw/erdma/erdma_main.c
> 
> diff --git a/drivers/infiniband/hw/erdma/erdma_debug.c b/drivers/infiniband/hw/erdma/erdma_debug.c
> new file mode 100644
> index 000000000000..3cbed4dde0e2
> --- /dev/null
> +++ b/drivers/infiniband/hw/erdma/erdma_debug.c
> @@ -0,0 +1,314 @@
> +// SPDX-License-Identifier: GPL-2.0
> +/*
> + * Authors: Cheng Xu <chengyou@linux.alibaba.com>
> + *          Kai Shen <kaishen@linux.alibaba.com>
> + * Copyright (c) 2020-2021, Alibaba Group.
> + */
> +#include <linux/errno.h>
> +#include <linux/types.h>
> +#include <linux/list.h>
> +#include <linux/debugfs.h>
> +
> +#include <rdma/iw_cm.h>
> +#include <rdma/ib_verbs.h>
> +#include <rdma/ib_smi.h>
> +#include <rdma/ib_user_verbs.h>
> +
> +#include "erdma.h"
> +#include "erdma_cm.h"
> +#include "erdma_debug.h"
> +#include "erdma_verbs.h"
> +
> +char *cc_method_string[ERDMA_CC_METHODS_NUM] = {
> +	[ERDMA_CC_NEWRENO] = "newreno",
> +	[ERDMA_CC_CUBIC] = "cubic",
> +	[ERDMA_CC_HPCC_RTT] = "hpcc_rtt",
> +	[ERDMA_CC_HPCC_ECN] = "hpcc_ecn",
> +	[ERDMA_CC_HPCC_INT] = "hpcc_int"
> +};
> +
> +static struct dentry *erdma_debugfs;
> +
> +
> +static int erdma_dbgfs_file_open(struct inode *inode, struct file *fp)
> +{
> +	fp->private_data = inode->i_private;
> +	return nonseekable_open(inode, fp);
> +}
> +
> +static ssize_t erdma_show_stats(struct file *fp, char __user *buf, size_t space,
> +			      loff_t *ppos)
> +{
> +	struct erdma_dev *dev = fp->private_data;
> +	char *kbuf = NULL;
> +	int len = 0;
> +
> +	if (*ppos)
> +		goto out;
> +
> +	kbuf = kmalloc(space, GFP_KERNEL);
> +	if (!kbuf)
> +		goto out;
> +
> +	len = snprintf(kbuf, space, "Resource Summary of %s:\n"
> +		"%s: %d\n%s: %d\n%s: %d\n%s: %d\n%s: %d\n%s: %d\n",
> +		dev->ibdev.name,
> +		"ucontext ", atomic_read(&dev->num_ctx),
> +		"pd       ", atomic_read(&dev->num_pd),
> +		"qp       ", atomic_read(&dev->num_qp),
> +		"cq       ", atomic_read(&dev->num_cq),
> +		"mr       ", atomic_read(&dev->num_mr),

Why do you need to duplicate "restrack res ..."?

> +		"cep      ", atomic_read(&dev->num_cep));
> +	if (len > space)
> +		len = space;
> +out:
> +	if (len)
> +		len = simple_read_from_buffer(buf, len, ppos, kbuf, len);
> +
> +	kfree(kbuf);
> +	return len;
> +
> +}
> +

Thanks

  reply	other threads:[~2021-12-21 13:26 UTC|newest]

Thread overview: 49+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-21  2:48 [PATCH rdma-next 00/11] Elastic RDMA Adapter (ERDMA) driver Cheng Xu
2021-12-21  2:48 ` [PATCH rdma-next 01/11] RDMA: Add ERDMA to rdma_driver_id definition Cheng Xu
2021-12-21  2:48 ` [PATCH rdma-next 02/11] RDMA/erdma: Add the hardware related definitions Cheng Xu
2021-12-21  2:48 ` [PATCH rdma-next 03/11] RDMA/erdma: Add main include file Cheng Xu
2021-12-21  2:48 ` [PATCH rdma-next 04/11] RDMA/erdma: Add cmdq implementation Cheng Xu
2021-12-21  2:48 ` [PATCH rdma-next 05/11] RDMA/erdma: Add event queue implementation Cheng Xu
2021-12-21  2:48 ` [PATCH rdma-next 06/11] RDMA/erdma: Add verbs header file Cheng Xu
2021-12-21 13:28   ` Leon Romanovsky
2021-12-22  2:36     ` Cheng Xu
2021-12-21  2:48 ` [PATCH rdma-next 07/11] RDMA/erdma: Add verbs implementation Cheng Xu
2021-12-21 13:32   ` Leon Romanovsky
2021-12-21 15:20     ` Bernard Metzler
2021-12-22  3:11       ` Cheng Xu
2021-12-22  4:18         ` Cheng Xu
2021-12-22 12:46         ` Bernard Metzler
2021-12-23  8:38           ` Cheng Xu
2021-12-22  2:50     ` Cheng Xu
2021-12-21  2:48 ` [PATCH rdma-next 08/11] RDMA/erdma: Add connection management (CM) support Cheng Xu
2021-12-21  2:48 ` [PATCH rdma-next 09/11] RDMA/erdma: Add the erdma module Cheng Xu
2021-12-21 13:26   ` Leon Romanovsky [this message]
2021-12-22  2:33     ` Cheng Xu
2021-12-21  2:48 ` [PATCH rdma-next 10/11] RDMA/erdma: Add the ABI definitions Cheng Xu
2021-12-21 11:57   ` kernel test robot
2021-12-22 16:14   ` kernel test robot
2021-12-23 15:46   ` Yanjun Zhu
2021-12-23 18:45     ` Leon Romanovsky
2021-12-23 22:55       ` Yanjun Zhu
2021-12-24  6:04         ` Leon Romanovsky
2021-12-24  7:54           ` Yanjun Zhu
2021-12-24 18:11             ` Leon Romanovsky
2021-12-24  7:12         ` Cheng Xu
2021-12-24  8:02           ` Yanjun Zhu
2021-12-24 18:19           ` Leon Romanovsky
2021-12-25  0:03             ` Yanjun Zhu
2021-12-25  3:36             ` Cheng Xu
2021-12-21  2:48 ` [PATCH rdma-next 11/11] RDMA/erdma: Add driver to kernel build environment Cheng Xu
2021-12-22  0:58   ` kernel test robot
2021-12-21 13:09 ` [PATCH rdma-next 00/11] Elastic RDMA Adapter (ERDMA) driver Leon Romanovsky
2021-12-22  3:35   ` Cheng Xu
2021-12-23 10:23     ` Leon Romanovsky
2021-12-23 12:59       ` Cheng Xu
2021-12-23 13:44         ` Leon Romanovsky
2021-12-24  7:07           ` Cheng Xu
2021-12-24 18:26             ` Leon Romanovsky
2021-12-25  2:54               ` Cheng Xu
2021-12-25  2:57               ` Cheng Xu
2021-12-25  3:03               ` [Please ignore the two former responses]Re: " Cheng Xu
2022-01-07 14:24         ` Jason Gunthorpe
2022-01-10 10:07           ` Cheng Xu

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=YcHV/+VeD2xxIU3I@unreal \
    --to=leon@kernel.org \
    --cc=KaiShen@linux.alibaba.com \
    --cc=chengyou@linux.alibaba.com \
    --cc=dledford@redhat.com \
    --cc=jgg@ziepe.ca \
    --cc=linux-rdma@vger.kernel.org \
    --cc=tonylu@linux.alibaba.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