Skip to content

Commit 2eeae3a

Browse files
committed
Merge branch 'hns3-next'
Guangbin Huang says: ==================== net: hns3: add new debugfs commands This series adds three new debugfs commands for the HNS3 ethernet driver. change log: V1 -> V2: 1. remove patch "net: hns3: add support for link diagnosis info in debugfs" and use ethtool extended link state to implement similar function according to Jakub Kicinski's opinion. ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents c948b46 + d59daf6 commit 2eeae3a

File tree

5 files changed

+104
-2
lines changed

5 files changed

+104
-2
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,8 +290,10 @@ enum hnae3_dbg_cmd {
290290
HNAE3_DBG_CMD_RX_QUEUE_INFO,
291291
HNAE3_DBG_CMD_TX_QUEUE_INFO,
292292
HNAE3_DBG_CMD_FD_TCAM,
293+
HNAE3_DBG_CMD_FD_COUNTER,
293294
HNAE3_DBG_CMD_MAC_TNL_STATUS,
294295
HNAE3_DBG_CMD_SERV_INFO,
296+
HNAE3_DBG_CMD_UMV_INFO,
295297
HNAE3_DBG_CMD_UNKNOWN,
296298
};
297299

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,20 @@ static struct hns3_dbg_cmd_info hns3_dbg_cmd[] = {
323323
.buf_len = HNS3_DBG_READ_LEN,
324324
.init = hns3_dbg_common_file_init,
325325
},
326+
{
327+
.name = "fd_counter",
328+
.cmd = HNAE3_DBG_CMD_FD_COUNTER,
329+
.dentry = HNS3_DBG_DENTRY_FD,
330+
.buf_len = HNS3_DBG_READ_LEN,
331+
.init = hns3_dbg_common_file_init,
332+
},
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+
},
326340
};
327341

328342
static struct hns3_dbg_cap_info hns3_dbg_cap[] = {

drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_cmd.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,7 @@ enum hclge_opcode_type {
248248
HCLGE_OPC_FD_KEY_CONFIG = 0x1202,
249249
HCLGE_OPC_FD_TCAM_OP = 0x1203,
250250
HCLGE_OPC_FD_AD_OP = 0x1204,
251+
HCLGE_OPC_FD_CNT_OP = 0x1205,
251252
HCLGE_OPC_FD_USER_DEF_OP = 0x1207,
252253

253254
/* MDIO command */
@@ -1109,6 +1110,14 @@ struct hclge_fd_ad_config_cmd {
11091110
u8 rsv2[8];
11101111
};
11111112

1113+
struct hclge_fd_ad_cnt_read_cmd {
1114+
u8 rsv0[4];
1115+
__le16 index;
1116+
u8 rsv1[2];
1117+
__le64 cnt;
1118+
u8 rsv2[8];
1119+
};
1120+
11121121
#define HCLGE_FD_USER_DEF_OFT_S 0
11131122
#define HCLGE_FD_USER_DEF_OFT_M GENMASK(14, 0)
11141123
#define HCLGE_FD_USER_DEF_EN_B 15

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

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1549,6 +1549,39 @@ static int hclge_dbg_dump_fd_tcam(struct hclge_dev *hdev, char *buf, int len)
15491549
return ret;
15501550
}
15511551

1552+
static int hclge_dbg_dump_fd_counter(struct hclge_dev *hdev, char *buf, int len)
1553+
{
1554+
u8 func_num = pci_num_vf(hdev->pdev) + 1; /* pf and enabled vf num */
1555+
struct hclge_fd_ad_cnt_read_cmd *req;
1556+
char str_id[HCLGE_DBG_ID_LEN];
1557+
struct hclge_desc desc;
1558+
int pos = 0;
1559+
int ret;
1560+
u64 cnt;
1561+
u8 i;
1562+
1563+
pos += scnprintf(buf + pos, len - pos,
1564+
"func_id\thit_times\n");
1565+
1566+
for (i = 0; i < func_num; i++) {
1567+
hclge_cmd_setup_basic_desc(&desc, HCLGE_OPC_FD_CNT_OP, true);
1568+
req = (struct hclge_fd_ad_cnt_read_cmd *)desc.data;
1569+
req->index = cpu_to_le16(i);
1570+
ret = hclge_cmd_send(&hdev->hw, &desc, 1);
1571+
if (ret) {
1572+
dev_err(&hdev->pdev->dev, "failed to get fd counter, ret = %d\n",
1573+
ret);
1574+
return ret;
1575+
}
1576+
cnt = le64_to_cpu(req->cnt);
1577+
hclge_dbg_get_func_id_str(str_id, i);
1578+
pos += scnprintf(buf + pos, len - pos,
1579+
"%s\t%llu\n", str_id, cnt);
1580+
}
1581+
1582+
return 0;
1583+
}
1584+
15521585
int hclge_dbg_dump_rst_info(struct hclge_dev *hdev, char *buf, int len)
15531586
{
15541587
int pos = 0;
@@ -1894,6 +1927,36 @@ static void hclge_dbg_dump_mac_list(struct hclge_dev *hdev, char *buf, int len,
18941927
}
18951928
}
18961929

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+
18971960
static int hclge_get_vlan_rx_offload_cfg(struct hclge_dev *hdev, u8 vf_id,
18981961
struct hclge_dbg_vlan_cfg *vlan_cfg)
18991962
{
@@ -2375,6 +2438,14 @@ static const struct hclge_dbg_func hclge_dbg_cmd_func[] = {
23752438
.cmd = HNAE3_DBG_CMD_VLAN_CONFIG,
23762439
.dbg_dump = hclge_dbg_dump_vlan_config,
23772440
},
2441+
{
2442+
.cmd = HNAE3_DBG_CMD_FD_COUNTER,
2443+
.dbg_dump = hclge_dbg_dump_fd_counter,
2444+
},
2445+
{
2446+
.cmd = HNAE3_DBG_CMD_UMV_INFO,
2447+
.dbg_dump = hclge_dbg_dump_umv_info,
2448+
},
23782449
};
23792450

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

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6000,8 +6000,14 @@ static int hclge_config_action(struct hclge_dev *hdev, u8 stage,
60006000
ad_data.queue_id = rule->queue_id;
60016001
}
60026002

6003-
ad_data.use_counter = false;
6004-
ad_data.counter_id = 0;
6003+
if (hdev->fd_cfg.cnt_num[HCLGE_FD_STAGE_1]) {
6004+
ad_data.use_counter = true;
6005+
ad_data.counter_id = rule->vf_id %
6006+
hdev->fd_cfg.cnt_num[HCLGE_FD_STAGE_1];
6007+
} else {
6008+
ad_data.use_counter = false;
6009+
ad_data.counter_id = 0;
6010+
}
60056011

60066012
ad_data.use_next_stage = false;
60076013
ad_data.next_input_key = 0;

0 commit comments

Comments
 (0)