diff options
author | Yufeng Mo <moyufeng@huawei.com> | 2021-05-20 10:21:31 +0800 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2021-05-20 15:01:03 -0700 |
commit | 365e860aa7a74afe1ba7157b3bfc547551c5795e (patch) | |
tree | 09c92bfe20866a4b101930790192dd377434e026 /drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c | |
parent | net: hns3: refactor dump reg of debugfs (diff) | |
download | linux-dev-365e860aa7a74afe1ba7157b3bfc547551c5795e.tar.xz linux-dev-365e860aa7a74afe1ba7157b3bfc547551c5795e.zip |
net: hns3: refactor dump reg dcb info of debugfs
Currently, the debugfs command for reg dcb info is implemented by
"echo xxxx > cmd", and record the information in dmesg. It's
unnecessary and heavy. To improve it, create a single file
"dcb" for it, and query it by command "cat dcb",
return the result to userspace, rather than record in dmesg.
The display style is below:
$ cat dcb
qset_id roce_qset_mask nic_qset_mask qset_shaping_pass qset_bp_status
0000 0x1 0x1 0x1 0x0
0001 0x1 0x1 0x1 0x0
0002 0x1 0x1 0x1 0x0
0003 0x1 0x1 0x1 0x0
0004 0x1 0x1 0x1 0x0
0005 0x1 0x1 0x1 0x0
0006 0x1 0x1 0x1 0x0
0007 0x1 0x1 0x1 0x0
pri_id pri_mask pri_cshaping_pass pri_pshaping_pass
000 0x1 0x0 0x1
001 0x1 0x0 0x0
002 0x1 0x0 0x0
003 0x1 0x0 0x0
004 0x1 0x0 0x0
005 0x1 0x0 0x0
006 0x1 0x0 0x0
007 0x1 0x0 0x0
pg_id pg_mask pg_cshaping_pass pg_pshaping_pass
000 0x1 0x0 0x1
Signed-off-by: Yufeng Mo <moyufeng@huawei.com>
Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c')
-rw-r--r-- | drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c b/drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c index af0751e53f79..9add38948e98 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c @@ -205,6 +205,13 @@ static struct hns3_dbg_cmd_info hns3_dbg_cmd[] = { .buf_len = HNS3_DBG_READ_LEN, .init = hns3_dbg_common_file_init, }, + { + .name = "dcb", + .cmd = HNAE3_DBG_CMD_REG_DCB, + .dentry = HNS3_DBG_DENTRY_REG, + .buf_len = HNS3_DBG_READ_LEN, + .init = hns3_dbg_common_file_init, + }, }; static struct hns3_dbg_cap_info hns3_dbg_cap[] = { @@ -581,10 +588,6 @@ static int hns3_dbg_tx_bd_info(struct hns3_dbg_data *d, char *buf, int len) static void hns3_dbg_help(struct hnae3_handle *h) { -#define HNS3_DBG_BUF_LEN 256 - - char printf_buf[HNS3_DBG_BUF_LEN]; - dev_info(&h->pdev->dev, "available commands\n"); dev_info(&h->pdev->dev, "queue info <number>\n"); dev_info(&h->pdev->dev, "queue map\n"); @@ -601,13 +604,6 @@ static void hns3_dbg_help(struct hnae3_handle *h) dev_info(&h->pdev->dev, "dump qos buf cfg\n"); dev_info(&h->pdev->dev, "dump mac tnl status\n"); dev_info(&h->pdev->dev, "dump qs shaper [qs id]\n"); - - memset(printf_buf, 0, HNS3_DBG_BUF_LEN); - strncat(printf_buf, "dump reg dcb <port_id> <pri_id> <pg_id>", - HNS3_DBG_BUF_LEN - 1); - strncat(printf_buf + strlen(printf_buf), " <rq_id> <nq_id> <qset_id>\n", - HNS3_DBG_BUF_LEN - strlen(printf_buf) - 1); - dev_info(&h->pdev->dev, "%s", printf_buf); } static void |