aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorliuzhongzhu <liuzhongzhu@huawei.com>2018-11-22 09:09:48 -0500
committerDavid S. Miller <davem@davemloft.net>2018-11-23 20:29:00 -0500
commit7d9d7f8864bacdf5afd68daa737f4f082fd724c8 (patch)
tree1fccae57d979247d53f0e3a761d942ec24d115a0
parent6fc2244057b0edf77d697a172e0cd6be97344de5 (diff)
net: hns3: Add "qos buffer" config info query function
This patch prints qos buffer config information. debugfs command: echo dump qos buf cfg > cmd Sample Command: root@(none)# echo dump qos buf cfg > cmd hns3 0000:7d:00.0: dump qos buf cfg hns3 0000:7d:00.0: tx_packet_buf_tc_0: 0x1aa hns3 0000:7d:00.0: tx_packet_buf_tc_1: 0x0 hns3 0000:7d:00.0: tx_packet_buf_tc_2: 0x0 hns3 0000:7d:00.0: tx_packet_buf_tc_3: 0x0 hns3 0000:7d:00.0: tx_packet_buf_tc_4: 0x0 hns3 0000:7d:00.0: tx_packet_buf_tc_5: 0x0 hns3 0000:7d:00.0: tx_packet_buf_tc_6: 0x0 hns3 0000:7d:00.0: tx_packet_buf_tc_7: 0x0 hns3 0000:7d:00.0: hns3 0000:7d:00.0: rx_packet_buf_tc_0: 0x130 hns3 0000:7d:00.0: rx_packet_buf_tc_1: 0x0 hns3 0000:7d:00.0: rx_packet_buf_tc_2: 0x0 hns3 0000:7d:00.0: rx_packet_buf_tc_3: 0x0 hns3 0000:7d:00.0: rx_packet_buf_tc_4: 0x0 hns3 0000:7d:00.0: rx_packet_buf_tc_5: 0x0 hns3 0000:7d:00.0: rx_packet_buf_tc_6: 0x0 hns3 0000:7d:00.0: rx_packet_buf_tc_7: 0x0 hns3 0000:7d:00.0: rx_share_buf: 0x1e0e root@(none)# Signed-off-by: liuzhongzhu <liuzhongzhu@huawei.com> Signed-off-by: Salil Mehta <salil.mehta@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c1
-rw-r--r--drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.c115
2 files changed, 116 insertions, 0 deletions
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c b/drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c
index ce284c8ddefc..86d667a3730a 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3_debugfs.c
@@ -134,6 +134,7 @@ static void hns3_dbg_help(struct hnae3_handle *h)
134 dev_info(&h->pdev->dev, "dump tm\n"); 134 dev_info(&h->pdev->dev, "dump tm\n");
135 dev_info(&h->pdev->dev, "dump qos pause cfg\n"); 135 dev_info(&h->pdev->dev, "dump qos pause cfg\n");
136 dev_info(&h->pdev->dev, "dump qos pri map\n"); 136 dev_info(&h->pdev->dev, "dump qos pri map\n");
137 dev_info(&h->pdev->dev, "dump qos buf cfg\n");
137} 138}
138 139
139static ssize_t hns3_dbg_cmd_read(struct file *filp, char __user *buffer, 140static ssize_t hns3_dbg_cmd_read(struct file *filp, char __user *buffer,
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.c b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.c
index 477acf7299ba..14577bbf3e11 100644
--- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.c
+++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.c
@@ -294,6 +294,119 @@ static void hclge_dbg_dump_qos_pri_map(struct hclge_dev *hdev)
294 dev_info(&hdev->pdev->dev, "pri_7_to_tc: 0x%x\n", pri_map->pri7_tc); 294 dev_info(&hdev->pdev->dev, "pri_7_to_tc: 0x%x\n", pri_map->pri7_tc);
295} 295}
296 296
297static void hclge_dbg_dump_qos_buf_cfg(struct hclge_dev *hdev)
298{
299 struct hclge_tx_buff_alloc_cmd *tx_buf_cmd;
300 struct hclge_rx_priv_buff_cmd *rx_buf_cmd;
301 struct hclge_rx_priv_wl_buf *rx_priv_wl;
302 struct hclge_rx_com_wl *rx_packet_cnt;
303 struct hclge_rx_com_thrd *rx_com_thrd;
304 struct hclge_rx_com_wl *rx_com_wl;
305 enum hclge_opcode_type cmd;
306 struct hclge_desc desc[2];
307 int i, ret;
308
309 cmd = HCLGE_OPC_TX_BUFF_ALLOC;
310 hclge_cmd_setup_basic_desc(desc, cmd, true);
311 ret = hclge_cmd_send(&hdev->hw, desc, 1);
312 if (ret)
313 goto err_qos_cmd_send;
314
315 dev_info(&hdev->pdev->dev, "dump qos buf cfg\n");
316
317 tx_buf_cmd = (struct hclge_tx_buff_alloc_cmd *)desc[0].data;
318 for (i = 0; i < HCLGE_TC_NUM; i++)
319 dev_info(&hdev->pdev->dev, "tx_packet_buf_tc_%d: 0x%x\n", i,
320 tx_buf_cmd->tx_pkt_buff[i]);
321
322 cmd = HCLGE_OPC_RX_PRIV_BUFF_ALLOC;
323 hclge_cmd_setup_basic_desc(desc, cmd, true);
324 ret = hclge_cmd_send(&hdev->hw, desc, 1);
325 if (ret)
326 goto err_qos_cmd_send;
327
328 dev_info(&hdev->pdev->dev, "\n");
329 rx_buf_cmd = (struct hclge_rx_priv_buff_cmd *)desc[0].data;
330 for (i = 0; i < HCLGE_TC_NUM; i++)
331 dev_info(&hdev->pdev->dev, "rx_packet_buf_tc_%d: 0x%x\n", i,
332 rx_buf_cmd->buf_num[i]);
333
334 dev_info(&hdev->pdev->dev, "rx_share_buf: 0x%x\n",
335 rx_buf_cmd->shared_buf);
336
337 cmd = HCLGE_OPC_RX_PRIV_WL_ALLOC;
338 hclge_cmd_setup_basic_desc(&desc[0], cmd, true);
339 desc[0].flag |= cpu_to_le16(HCLGE_CMD_FLAG_NEXT);
340 hclge_cmd_setup_basic_desc(&desc[1], cmd, true);
341 ret = hclge_cmd_send(&hdev->hw, desc, 2);
342 if (ret)
343 goto err_qos_cmd_send;
344
345 dev_info(&hdev->pdev->dev, "\n");
346 rx_priv_wl = (struct hclge_rx_priv_wl_buf *)desc[0].data;
347 for (i = 0; i < HCLGE_TC_NUM_ONE_DESC; i++)
348 dev_info(&hdev->pdev->dev,
349 "rx_priv_wl_tc_%d: high: 0x%x, low: 0x%x\n", i,
350 rx_priv_wl->tc_wl[i].high, rx_priv_wl->tc_wl[i].low);
351
352 rx_priv_wl = (struct hclge_rx_priv_wl_buf *)desc[1].data;
353 for (i = 0; i < HCLGE_TC_NUM_ONE_DESC; i++)
354 dev_info(&hdev->pdev->dev,
355 "rx_priv_wl_tc_%d: high: 0x%x, low: 0x%x\n", i + 4,
356 rx_priv_wl->tc_wl[i].high, rx_priv_wl->tc_wl[i].low);
357
358 cmd = HCLGE_OPC_RX_COM_THRD_ALLOC;
359 hclge_cmd_setup_basic_desc(&desc[0], cmd, true);
360 desc[0].flag |= cpu_to_le16(HCLGE_CMD_FLAG_NEXT);
361 hclge_cmd_setup_basic_desc(&desc[1], cmd, true);
362 ret = hclge_cmd_send(&hdev->hw, desc, 2);
363 if (ret)
364 goto err_qos_cmd_send;
365
366 dev_info(&hdev->pdev->dev, "\n");
367 rx_com_thrd = (struct hclge_rx_com_thrd *)desc[0].data;
368 for (i = 0; i < HCLGE_TC_NUM_ONE_DESC; i++)
369 dev_info(&hdev->pdev->dev,
370 "rx_com_thrd_tc_%d: high: 0x%x, low: 0x%x\n", i,
371 rx_com_thrd->com_thrd[i].high,
372 rx_com_thrd->com_thrd[i].low);
373
374 rx_com_thrd = (struct hclge_rx_com_thrd *)desc[1].data;
375 for (i = 0; i < HCLGE_TC_NUM_ONE_DESC; i++)
376 dev_info(&hdev->pdev->dev,
377 "rx_com_thrd_tc_%d: high: 0x%x, low: 0x%x\n", i + 4,
378 rx_com_thrd->com_thrd[i].high,
379 rx_com_thrd->com_thrd[i].low);
380
381 cmd = HCLGE_OPC_RX_COM_WL_ALLOC;
382 hclge_cmd_setup_basic_desc(desc, cmd, true);
383 ret = hclge_cmd_send(&hdev->hw, desc, 1);
384 if (ret)
385 goto err_qos_cmd_send;
386
387 rx_com_wl = (struct hclge_rx_com_wl *)desc[0].data;
388 dev_info(&hdev->pdev->dev, "\n");
389 dev_info(&hdev->pdev->dev, "rx_com_wl: high: 0x%x, low: 0x%x\n",
390 rx_com_wl->com_wl.high, rx_com_wl->com_wl.low);
391
392 cmd = HCLGE_OPC_RX_GBL_PKT_CNT;
393 hclge_cmd_setup_basic_desc(desc, cmd, true);
394 ret = hclge_cmd_send(&hdev->hw, desc, 1);
395 if (ret)
396 goto err_qos_cmd_send;
397
398 rx_packet_cnt = (struct hclge_rx_com_wl *)desc[0].data;
399 dev_info(&hdev->pdev->dev,
400 "rx_global_packet_cnt: high: 0x%x, low: 0x%x\n",
401 rx_packet_cnt->com_wl.high, rx_packet_cnt->com_wl.low);
402
403 return;
404
405err_qos_cmd_send:
406 dev_err(&hdev->pdev->dev,
407 "dump qos buf cfg fail(0x%x), status is %d\n", cmd, ret);
408}
409
297static void hclge_dbg_fd_tcam_read(struct hclge_dev *hdev, u8 stage, 410static void hclge_dbg_fd_tcam_read(struct hclge_dev *hdev, u8 stage,
298 bool sel_x, u32 loc) 411 bool sel_x, u32 loc)
299{ 412{
@@ -363,6 +476,8 @@ int hclge_dbg_run_cmd(struct hnae3_handle *handle, char *cmd_buf)
363 hclge_dbg_dump_qos_pause_cfg(hdev); 476 hclge_dbg_dump_qos_pause_cfg(hdev);
364 } else if (strncmp(cmd_buf, "dump qos pri map", 16) == 0) { 477 } else if (strncmp(cmd_buf, "dump qos pri map", 16) == 0) {
365 hclge_dbg_dump_qos_pri_map(hdev); 478 hclge_dbg_dump_qos_pri_map(hdev);
479 } else if (strncmp(cmd_buf, "dump qos buf cfg", 16) == 0) {
480 hclge_dbg_dump_qos_buf_cfg(hdev);
366 } else { 481 } else {
367 dev_info(&hdev->pdev->dev, "unknown command\n"); 482 dev_info(&hdev->pdev->dev, "unknown command\n");
368 return -EINVAL; 483 return -EINVAL;