Thread (3 messages) flat view 3 messages, 2 authors, 2020-08-21

Re: [PATCH net-next] hinic: add debugfs support

From: Jakub Kicinski <kuba@kernel.org>
Date: 2020-08-20 16:02:29
Also in: lkml

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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help