Skip to content

Commit d59daf6

Browse files
IronShendavem330
authored andcommitted
net: hns3: add support for dumping MAC umv counter in debugfs
This patch adds support of dumping MAC umv counter in debugfs, which will be helpful for debugging. The display style is below: $ cat umv_info num_alloc_vport : 2 max_umv_size : 256 wanted_umv_size : 256 priv_umv_size : 85 share_umv_size : 86 vport(0) used_umv_num : 1 vport(1) used_umv_num : 1 Signed-off-by: Jian Shen <[email protected]> Signed-off-by: Guangbin Huang <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 03a92fe commit d59daf6

File tree

3 files changed

+42
-0
lines changed

3 files changed

+42
-0
lines changed

drivers/net/ethernet/hisilicon/hns3/hnae3.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,7 @@ enum hnae3_dbg_cmd {
293293
HNAE3_DBG_CMD_FD_COUNTER,
294294
HNAE3_DBG_CMD_MAC_TNL_STATUS,
295295
HNAE3_DBG_CMD_SERV_INFO,
296+
HNAE3_DBG_CMD_UMV_INFO,
296297
HNAE3_DBG_CMD_UNKNOWN,
297298
};
298299

drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,13 @@ static struct hns3_dbg_cmd_info hns3_dbg_cmd[] = {
330330
.buf_len = HNS3_DBG_READ_LEN,
331331
.init = hns3_dbg_common_file_init,
332332
},
333+
{
334+
.name = "umv_info",
335+
.cmd = HNAE3_DBG_CMD_UMV_INFO,
336+
.dentry = HNS3_DBG_DENTRY_COMMON,
337+
.buf_len = HNS3_DBG_READ_LEN,
338+
.init = hns3_dbg_common_file_init,
339+
},
333340
};
334341

335342
static struct hns3_dbg_cap_info hns3_dbg_cap[] = {

drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.c

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1927,6 +1927,36 @@ static void hclge_dbg_dump_mac_list(struct hclge_dev *hdev, char *buf, int len,
19271927
}
19281928
}
19291929

1930+
static int hclge_dbg_dump_umv_info(struct hclge_dev *hdev, char *buf, int len)
1931+
{
1932+
u8 func_num = pci_num_vf(hdev->pdev) + 1;
1933+
struct hclge_vport *vport;
1934+
int pos = 0;
1935+
u8 i;
1936+
1937+
pos += scnprintf(buf, len, "num_alloc_vport : %u\n",
1938+
hdev->num_alloc_vport);
1939+
pos += scnprintf(buf + pos, len - pos, "max_umv_size : %u\n",
1940+
hdev->max_umv_size);
1941+
pos += scnprintf(buf + pos, len - pos, "wanted_umv_size : %u\n",
1942+
hdev->wanted_umv_size);
1943+
pos += scnprintf(buf + pos, len - pos, "priv_umv_size : %u\n",
1944+
hdev->priv_umv_size);
1945+
1946+
mutex_lock(&hdev->vport_lock);
1947+
pos += scnprintf(buf + pos, len - pos, "share_umv_size : %u\n",
1948+
hdev->share_umv_size);
1949+
for (i = 0; i < func_num; i++) {
1950+
vport = &hdev->vport[i];
1951+
pos += scnprintf(buf + pos, len - pos,
1952+
"vport(%u) used_umv_num : %u\n",
1953+
i, vport->used_umv_num);
1954+
}
1955+
mutex_unlock(&hdev->vport_lock);
1956+
1957+
return 0;
1958+
}
1959+
19301960
static int hclge_get_vlan_rx_offload_cfg(struct hclge_dev *hdev, u8 vf_id,
19311961
struct hclge_dbg_vlan_cfg *vlan_cfg)
19321962
{
@@ -2412,6 +2442,10 @@ static const struct hclge_dbg_func hclge_dbg_cmd_func[] = {
24122442
.cmd = HNAE3_DBG_CMD_FD_COUNTER,
24132443
.dbg_dump = hclge_dbg_dump_fd_counter,
24142444
},
2445+
{
2446+
.cmd = HNAE3_DBG_CMD_UMV_INFO,
2447+
.dbg_dump = hclge_dbg_dump_umv_info,
2448+
},
24152449
};
24162450

24172451
int hclge_dbg_read_cmd(struct hnae3_handle *handle, enum hnae3_dbg_cmd cmd,

0 commit comments

Comments
 (0)