]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
net: hns3: add comments for hclge_dbg_fill_content()
authorHao Chen <chenhao288@hisilicon.com>
Fri, 3 Dec 2021 09:20:56 +0000 (17:20 +0800)
committerDavid S. Miller <davem@davemloft.net>
Fri, 3 Dec 2021 11:00:59 +0000 (11:00 +0000)
When we use hclge_dbg_fill_content() to fill contents with
specific format according to struct hclge_dbg_item *items,
it may cause content cover due to unreasonable items.

So add comments to explain how to avoid it.

Signed-off-by: Hao Chen <chenhao288@hisilicon.com>
Signed-off-by: Guangbin Huang <huangguangbin2@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.c

index 1579ca336d063b19e0130c9b8ccb446a63d95fe0..2557e815cb3de4f38c87a4bea76231cb54368aed 100644 (file)
@@ -77,6 +77,10 @@ static const struct hclge_dbg_reg_type_info hclge_dbg_reg_info[] = {
                       .cmd = HCLGE_OPC_DFX_TQP_REG } },
 };
 
+/* make sure: len(name) + interval >= maxlen(item data) + 2,
+ * for example, name = "pkt_num"(len: 7), the prototype of item data is u32,
+ * and print as "%u"(maxlen: 10), so the interval should be at least 5.
+ */
 static void hclge_dbg_fill_content(char *content, u16 len,
                                   const struct hclge_dbg_item *items,
                                   const char **result, u16 size)