-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
net: hns3: Add "FD flow table" info query function
All the Flow Director rules are stored in tcam blocks. For each bit of tcam entry, the match value depends on two input value(x, y). debugfs command: echo dump fd tcam > cmd Sample output: root@(none)# echo dump fd tcam > cmd hns3 0000:7d:00.0: read result tcam key x(31): hns3 0000:7d:00.0: 00000000 hns3 0000:7d:00.0: 00000000 hns3 0000:7d:00.0: 00000000 hns3 0000:7d:00.0: 08000000 hns3 0000:7d:00.0: 00000600 hns3 0000:7d:00.0: 00000000 hns3 0000:7d:00.0: 00000000 hns3 0000:7d:00.0: 00000000 hns3 0000:7d:00.0: 00000000 hns3 0000:7d:00.0: 00000000 hns3 0000:7d:00.0: 00000000 hns3 0000:7d:00.0: 00000000 hns3 0000:7d:00.0: 00000000 hns3 0000:7d:00.0: read result tcam key y(31): hns3 0000:7d:00.0: 00000000 hns3 0000:7d:00.0: 00000000 hns3 0000:7d:00.0: 00000000 hns3 0000:7d:00.0: f7ff0000 hns3 0000:7d:00.0: 0000f900 hns3 0000:7d:00.0: 00000000 hns3 0000:7d:00.0: 00000000 hns3 0000:7d:00.0: 00000000 hns3 0000:7d:00.0: 00000000 hns3 0000:7d:00.0: 00000000 hns3 0000:7d:00.0: 00000000 hns3 0000:7d:00.0: 00000000 hns3 0000:7d:00.0: 0000fff8 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>
- Loading branch information
liuzhongzhu
authored and
David S. Miller
committed
Nov 24, 2018
1 parent
57ceee2
commit 3c666b5
Showing
6 changed files
with
83 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
77 changes: 77 additions & 0 deletions
77
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_debugfs.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
// SPDX-License-Identifier: GPL-2.0+ | ||
/* Copyright (c) 2018-2019 Hisilicon Limited. */ | ||
|
||
#include <linux/device.h> | ||
|
||
#include "hclge_cmd.h" | ||
#include "hclge_main.h" | ||
#include "hnae3.h" | ||
|
||
static void hclge_dbg_fd_tcam_read(struct hclge_dev *hdev, u8 stage, | ||
bool sel_x, u32 loc) | ||
{ | ||
struct hclge_fd_tcam_config_1_cmd *req1; | ||
struct hclge_fd_tcam_config_2_cmd *req2; | ||
struct hclge_fd_tcam_config_3_cmd *req3; | ||
struct hclge_desc desc[3]; | ||
int ret, i; | ||
u32 *req; | ||
|
||
hclge_cmd_setup_basic_desc(&desc[0], HCLGE_OPC_FD_TCAM_OP, true); | ||
desc[0].flag |= cpu_to_le16(HCLGE_CMD_FLAG_NEXT); | ||
hclge_cmd_setup_basic_desc(&desc[1], HCLGE_OPC_FD_TCAM_OP, true); | ||
desc[1].flag |= cpu_to_le16(HCLGE_CMD_FLAG_NEXT); | ||
hclge_cmd_setup_basic_desc(&desc[2], HCLGE_OPC_FD_TCAM_OP, true); | ||
|
||
req1 = (struct hclge_fd_tcam_config_1_cmd *)desc[0].data; | ||
req2 = (struct hclge_fd_tcam_config_2_cmd *)desc[1].data; | ||
req3 = (struct hclge_fd_tcam_config_3_cmd *)desc[2].data; | ||
|
||
req1->stage = stage; | ||
req1->xy_sel = sel_x ? 1 : 0; | ||
req1->index = cpu_to_le32(loc); | ||
|
||
ret = hclge_cmd_send(&hdev->hw, desc, 3); | ||
if (ret) | ||
return; | ||
|
||
dev_info(&hdev->pdev->dev, " read result tcam key %s(%u):\n", | ||
sel_x ? "x" : "y", loc); | ||
|
||
req = (u32 *)req1->tcam_data; | ||
for (i = 0; i < 2; i++) | ||
dev_info(&hdev->pdev->dev, "%08x\n", *req++); | ||
|
||
req = (u32 *)req2->tcam_data; | ||
for (i = 0; i < 6; i++) | ||
dev_info(&hdev->pdev->dev, "%08x\n", *req++); | ||
|
||
req = (u32 *)req3->tcam_data; | ||
for (i = 0; i < 5; i++) | ||
dev_info(&hdev->pdev->dev, "%08x\n", *req++); | ||
} | ||
|
||
static void hclge_dbg_fd_tcam(struct hclge_dev *hdev) | ||
{ | ||
u32 i; | ||
|
||
for (i = 0; i < hdev->fd_cfg.rule_num[0]; i++) { | ||
hclge_dbg_fd_tcam_read(hdev, 0, true, i); | ||
hclge_dbg_fd_tcam_read(hdev, 0, false, i); | ||
} | ||
} | ||
|
||
int hclge_dbg_run_cmd(struct hnae3_handle *handle, char *cmd_buf) | ||
{ | ||
struct hclge_vport *vport = hclge_get_vport(handle); | ||
struct hclge_dev *hdev = vport->back; | ||
|
||
if (strncmp(cmd_buf, "dump fd tcam", 12) == 0) { | ||
hclge_dbg_fd_tcam(hdev); | ||
} else { | ||
dev_info(&hdev->pdev->dev, "unknown command\n"); | ||
return -EINVAL; | ||
} | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters