提交 0f4250ef 编写于 作者: S shenhao 提交者: Yang Yingliang

net: hns3: add dumping vlan filter config in debugfs

driver inclusion
category: debug
bugzilla: NA
CVE: NA

----------------------------------------------------

This patch adds dumping vlan filter config in debugfs to add more DFX
method about vlan filter.
Signed-off-by: NGuangbin Huang <huangguangbin2@huawei.com>
Signed-off-by: Nshenhao <shenhao21@huawei.com>
Reviewed-by: NZhong Zhaohui <zhongzhaohui@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 3a3c95bb
...@@ -265,6 +265,7 @@ static void hns3_dbg_help(struct hnae3_handle *h) ...@@ -265,6 +265,7 @@ static void hns3_dbg_help(struct hnae3_handle *h)
dev_info(&h->pdev->dev, "dump qs shaper [qs id]\n"); dev_info(&h->pdev->dev, "dump qs shaper [qs id]\n");
dev_info(&h->pdev->dev, "dump uc mac list <func id>\n"); dev_info(&h->pdev->dev, "dump uc mac list <func id>\n");
dev_info(&h->pdev->dev, "dump mc mac list <func id>\n"); dev_info(&h->pdev->dev, "dump mc mac list <func id>\n");
dev_info(&h->pdev->dev, "dump vlan filter <func id>\n");
memset(printf_buf, 0, HNS3_DBG_BUF_LEN); memset(printf_buf, 0, HNS3_DBG_BUF_LEN);
strncat(printf_buf, "dump reg [[bios common] [ssu <port_id>]", strncat(printf_buf, "dump reg [[bios common] [ssu <port_id>]",
......
...@@ -1497,10 +1497,63 @@ static int hclge_dbg_dump_mac_list(struct hclge_dev *hdev, const char *cmd_buf, ...@@ -1497,10 +1497,63 @@ static int hclge_dbg_dump_mac_list(struct hclge_dev *hdev, const char *cmd_buf,
return 0; return 0;
} }
static void hclge_dbg_dump_vlan_filter(struct hclge_dev *hdev,
const char *cmd_buf)
{
struct hclge_vlan_filter_ctrl_cmd *req;
struct hclge_vport *vport;
struct hclge_desc desc;
bool has_vlan_used;
int vf_id;
int ret;
ret = kstrtouint(cmd_buf, 0, &vf_id);
if (ret < 0) {
dev_err(&hdev->pdev->dev,
"dump vlan filter: bad command string, ret=%d\n", ret);
return;
}
if (vf_id >= hdev->num_alloc_vport) {
dev_err(&hdev->pdev->dev,
"vf id(%u) is out of range(0-%u)\n", vf_id,
hdev->num_alloc_vport - 1);
return;
}
hclge_cmd_setup_basic_desc(&desc, HCLGE_OPC_VLAN_FILTER_CTRL, true);
req = (struct hclge_vlan_filter_ctrl_cmd *)desc.data;
req->vf_id = vf_id;
ret = hclge_cmd_send(&hdev->hw, &desc, 1);
if (ret) {
dev_err(&hdev->pdev->dev,
"failed to get vlan filter config, ret=%d\n", ret);
return;
}
vport = &hdev->vport[vf_id];
has_vlan_used = hclge_has_vlan_used(hdev, vport->vport_id);
dev_info(&hdev->pdev->dev, "vf_id:%u\n", req->vf_id);
dev_info(&hdev->pdev->dev, "vlan_type:%u\n", req->vlan_type);
dev_info(&hdev->pdev->dev, "vlan_fe:%u\n", req->vlan_fe);
dev_info(&hdev->pdev->dev, "vf_vlan_en:%u\n", vport->vf_vlan_en);
dev_info(&hdev->pdev->dev, "vlan_mode:%s\n",
(hdev->vlan_mode == HCLGE_VLAN_DEFAULT_MODE) ? "default" :
"dynamic");
dev_info(&hdev->pdev->dev, "netdev_flags:%x\n",
vport->nic.netdev_flags);
dev_info(&hdev->pdev->dev, "has_vlan_used:%s\n",
has_vlan_used ? "true" : "false");
dev_info(&hdev->pdev->dev, "port_base_vlan_cfg_state:%u\n",
vport->port_base_vlan_cfg.state);
}
int hclge_dbg_run_cmd(struct hnae3_handle *handle, const char *cmd_buf) int hclge_dbg_run_cmd(struct hnae3_handle *handle, const char *cmd_buf)
{ {
#define DUMP_REG "dump reg" #define DUMP_REG "dump reg"
#define DUMP_LOOPBACK "dump loopback" #define DUMP_LOOPBACK "dump loopback"
#define DUMP_VLAN_FILTER "dump vlan filter"
struct hclge_vport *vport = hclge_get_vport(handle); struct hclge_vport *vport = hclge_get_vport(handle);
struct hclge_dev *hdev = vport->back; struct hclge_dev *hdev = vport->back;
...@@ -1550,6 +1603,10 @@ int hclge_dbg_run_cmd(struct hnae3_handle *handle, const char *cmd_buf) ...@@ -1550,6 +1603,10 @@ int hclge_dbg_run_cmd(struct hnae3_handle *handle, const char *cmd_buf)
hclge_dbg_dump_mac_list(hdev, hclge_dbg_dump_mac_list(hdev,
&cmd_buf[sizeof("dump mc mac list")], &cmd_buf[sizeof("dump mc mac list")],
false); false);
} else if (strncmp(cmd_buf, DUMP_VLAN_FILTER,
strlen(DUMP_VLAN_FILTER)) == 0) {
hclge_dbg_dump_vlan_filter(hdev,
&cmd_buf[sizeof(DUMP_VLAN_FILTER)]);
} else { } else {
dev_info(&hdev->pdev->dev, "unknown command\n"); dev_info(&hdev->pdev->dev, "unknown command\n");
return -EINVAL; return -EINVAL;
......
...@@ -8989,7 +8989,7 @@ int hclge_en_hw_strip_rxvtag(struct hnae3_handle *handle, bool enable) ...@@ -8989,7 +8989,7 @@ int hclge_en_hw_strip_rxvtag(struct hnae3_handle *handle, bool enable)
return hclge_set_vlan_rx_offload_cfg(vport); return hclge_set_vlan_rx_offload_cfg(vport);
} }
static bool hclge_has_vlan_used(struct hclge_dev *hdev, u16 vport_id) bool hclge_has_vlan_used(struct hclge_dev *hdev, u16 vport_id)
{ {
#define VLAN_CHECK_START_NUM 1 #define VLAN_CHECK_START_NUM 1
u16 vlan_id; u16 vlan_id;
......
...@@ -1045,4 +1045,5 @@ int hclge_query_bd_num_cmd_send(struct hclge_dev *hdev, ...@@ -1045,4 +1045,5 @@ int hclge_query_bd_num_cmd_send(struct hclge_dev *hdev,
struct hclge_desc *desc); struct hclge_desc *desc);
void hclge_inform_vf_promisc_info(struct hclge_vport *vport); void hclge_inform_vf_promisc_info(struct hclge_vport *vport);
void hclge_dbg_dump_rst_info(struct hclge_dev *hdev); void hclge_dbg_dump_rst_info(struct hclge_dev *hdev);
bool hclge_has_vlan_used(struct hclge_dev *hdev, u16 vport_id);
#endif #endif
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册