[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200820090203.3f56024b@kicinski-fedora-PC1C0HJN>
Date: Thu, 20 Aug 2020 09:02:03 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Luo bin <luobin9@...wei.com>
Cc: <davem@...emloft.net>, <linux-kernel@...r.kernel.org>,
<netdev@...r.kernel.org>, <luoxianjun@...wei.com>,
<yin.yinshi@...wei.com>, <cloud.wangxiaoyun@...wei.com>,
<chiqijun@...wei.com>
Subject: Re: [PATCH net-next] hinic: add debugfs support
On Thu, 20 Aug 2020 20:14:32 +0800 Luo bin wrote:
> +static int hinic_dbg_help(struct hinic_dev *nic_dev, const char *cmd_buf)
> +{
> + netif_info(nic_dev, drv, nic_dev->netdev, "Available commands:\n");
> + netif_info(nic_dev, drv, nic_dev->netdev, "sq info <queue id>\n");
> + netif_info(nic_dev, drv, nic_dev->netdev, "sq wqe info <queue id> <wqe id>\n");
> + netif_info(nic_dev, drv, nic_dev->netdev, "rq info <queue id>\n");
> + netif_info(nic_dev, drv, nic_dev->netdev, "rq wqe info <queue id> <wqe id>\n");
> + netif_info(nic_dev, drv, nic_dev->netdev, "sq ci table <queue id>\n");
> + netif_info(nic_dev, drv, nic_dev->netdev, "rq cqe info <queue id> <cqe id>\n");
> + netif_info(nic_dev, drv, nic_dev->netdev, "mac table\n");
> + netif_info(nic_dev, drv, nic_dev->netdev, "global table\n");
> + netif_info(nic_dev, drv, nic_dev->netdev, "func table\n");
> + netif_info(nic_dev, drv, nic_dev->netdev, "port table\n");
> + return 0;
> +}
> +
> +static const struct hinic_dbg_cmd_info g_hinic_dbg_cmd[] = {
> + {"help", hinic_dbg_help},
> + {"sq info", hinic_dbg_get_sq_info},
> + {"sq wqe info", hinic_dbg_get_sq_wqe_info},
> + {"rq info", hinic_dbg_get_rq_info},
> + {"rq wqe info", hinic_dbg_get_rq_wqe_info},
> + {"sq ci table", hinic_dbg_get_ci_table},
> + {"rq cqe info", hinic_dbg_get_rq_cqe_info},
> + {"mac table", hinic_dbg_get_mac_table},
> + {"global table", hinic_dbg_get_global_table},
> + {"func table", hinic_dbg_get_function_table},
> + {"port table", hinic_dbg_get_port_table},
> +};
Please don't create command interfaces like this.
Instead create a read only file for objects you want to expose.
Split addition of each object into a separate patch and provide example
output in the commit message.
Powered by blists - more mailing lists