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

From: Jakub Kicinski
Date: Thu Aug 20 2020 - 12:02:29 EST


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.