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

net: hns3: add debug information for flow table when failed

driver inclusion
category: bugfix
bugzilla: NA
CVE: NA

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

Add some debug information for processing flow table if failed.
Signed-off-by: NGuojia Liao <liaoguojia@huawei.com>
Signed-off-by: Nshenhao <shenhao21@huawei.com>
Reviewed-by: NZhong Zhaohui <zhongzhaohui@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 dd27503f
...@@ -5508,21 +5508,29 @@ static int hclge_fd_check_ext_tuple(struct hclge_dev *hdev, ...@@ -5508,21 +5508,29 @@ static int hclge_fd_check_ext_tuple(struct hclge_dev *hdev,
u32 *unused_tuple) u32 *unused_tuple)
{ {
if (fs->flow_type & FLOW_EXT) { if (fs->flow_type & FLOW_EXT) {
if (fs->h_ext.vlan_etype) if (fs->h_ext.vlan_etype) {
dev_err(&hdev->pdev->dev, "vlan-etype does not support on this device!\n");
return -EOPNOTSUPP; return -EOPNOTSUPP;
}
if (!fs->h_ext.vlan_tci) if (!fs->h_ext.vlan_tci)
*unused_tuple |= BIT(INNER_VLAN_TAG_FST); *unused_tuple |= BIT(INNER_VLAN_TAG_FST);
if (fs->m_ext.vlan_tci && if (fs->m_ext.vlan_tci &&
be16_to_cpu(fs->h_ext.vlan_tci) >= VLAN_N_VID) be16_to_cpu(fs->h_ext.vlan_tci) >= VLAN_N_VID) {
dev_err(&hdev->pdev->dev, "failed to config vlan_tci, invalid vlan_tci: %u, max is %u.\n",
ntohs(fs->h_ext.vlan_tci), VLAN_N_VID - 1);
return -EINVAL; return -EINVAL;
}
} else { } else {
*unused_tuple |= BIT(INNER_VLAN_TAG_FST); *unused_tuple |= BIT(INNER_VLAN_TAG_FST);
} }
if (fs->flow_type & FLOW_MAC_EXT) { if (fs->flow_type & FLOW_MAC_EXT) {
if (!(hdev->fd_cfg.proto_support & BIT(ETHER_FLOW))) if (!(hdev->fd_cfg.proto_support & BIT(ETHER_FLOW))) {
dev_err(&hdev->pdev->dev, "unsupported protocol of ETHER_FLOW on this device.\n");
return -EOPNOTSUPP; return -EOPNOTSUPP;
}
if (is_zero_ether_addr(fs->h_ext.h_dest)) if (is_zero_ether_addr(fs->h_ext.h_dest))
*unused_tuple |= BIT(INNER_DST_MAC); *unused_tuple |= BIT(INNER_DST_MAC);
...@@ -5540,12 +5548,19 @@ static int hclge_fd_check_spec(struct hclge_dev *hdev, ...@@ -5540,12 +5548,19 @@ static int hclge_fd_check_spec(struct hclge_dev *hdev,
u32 flow_type; u32 flow_type;
int ret = 0; int ret = 0;
if (fs->location >= hdev->fd_cfg.rule_num[HCLGE_FD_STAGE_1]) if (fs->location >= hdev->fd_cfg.rule_num[HCLGE_FD_STAGE_1]) {
dev_err(&hdev->pdev->dev, "failed to config fd rules, invalid rule location: %u, max is %u\n.",
fs->location,
hdev->fd_cfg.rule_num[HCLGE_FD_STAGE_1] - 1);
return -EINVAL; return -EINVAL;
}
flow_type = fs->flow_type & ~(FLOW_EXT | FLOW_MAC_EXT); flow_type = fs->flow_type & ~(FLOW_EXT | FLOW_MAC_EXT);
if (!(BIT(flow_type) & hdev->fd_cfg.proto_support)) if (!(BIT(flow_type) & hdev->fd_cfg.proto_support)) {
dev_err(&hdev->pdev->dev, "unsupported protocol type, protocol type = 0x%x\n",
flow_type);
return -EOPNOTSUPP; return -EOPNOTSUPP;
}
if ((fs->flow_type & FLOW_EXT) && if ((fs->flow_type & FLOW_EXT) &&
(fs->h_ext.data[0] != 0 || fs->h_ext.data[1] != 0)) { (fs->h_ext.data[0] != 0 || fs->h_ext.data[1] != 0)) {
...@@ -5582,12 +5597,13 @@ static int hclge_fd_check_spec(struct hclge_dev *hdev, ...@@ -5582,12 +5597,13 @@ static int hclge_fd_check_spec(struct hclge_dev *hdev,
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
if (ret) if (ret) {
dev_err(&hdev->pdev->dev, "failed to check flow tuple, ret = %d\n",
ret);
return ret; return ret;
}
ret = hclge_fd_check_ext_tuple(hdev, fs, unused_tuple); return hclge_fd_check_ext_tuple(hdev, fs, unused_tuple);
return ret;
} }
static bool hclge_fd_rule_exist(struct hclge_dev *hdev, u16 location) static bool hclge_fd_rule_exist(struct hclge_dev *hdev, u16 location)
...@@ -5853,22 +5869,22 @@ static int hclge_add_fd_entry(struct hnae3_handle *handle, ...@@ -5853,22 +5869,22 @@ static int hclge_add_fd_entry(struct hnae3_handle *handle,
u8 action; u8 action;
int ret; int ret;
if (!hnae3_dev_fd_supported(hdev)) if (!hnae3_dev_fd_supported(hdev)) {
dev_err(&hdev->pdev->dev, "Flow Table Director is unsupported\n");
return -EOPNOTSUPP; return -EOPNOTSUPP;
}
if (!hdev->fd_en) { if (!hdev->fd_en) {
dev_warn(&hdev->pdev->dev, dev_err(&hdev->pdev->dev,
"Please enable flow director first\n"); "Please enable flow director first\n");
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
fs = (struct ethtool_rx_flow_spec *)&cmd->fs; fs = (struct ethtool_rx_flow_spec *)&cmd->fs;
ret = hclge_fd_check_spec(hdev, fs, &unused); ret = hclge_fd_check_spec(hdev, fs, &unused);
if (ret) { if (ret)
dev_err(&hdev->pdev->dev, "Check fd spec failed\n");
return ret; return ret;
}
if (fs->ring_cookie == RX_CLS_FLOW_DISC) { if (fs->ring_cookie == RX_CLS_FLOW_DISC) {
action = HCLGE_FD_ACTION_DROP_PACKET; action = HCLGE_FD_ACTION_DROP_PACKET;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册