Commit 9abeb7d8 authored by Jian Shen's avatar Jian Shen Committed by David S. Miller

net: hns3: keep flow director state unchanged when reset

In orginal codes, driver always enables flow director when
intializing. When user disable flow director with command
ethtool -K, the flow director will be enabled again after
resetting.

This patch fixes it by only enabling it when first initialzing.

Fixes: 6871af29 ("net: hns3: Add reset handle for flow director")
Signed-off-by: default avatarJian Shen <shenjian15@huawei.com>
Signed-off-by: default avatarPeng Li <lipeng321@huawei.com>
Signed-off-by: default avatarHuazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent c59a85c0
...@@ -1007,6 +1007,9 @@ static int hclge_configure(struct hclge_dev *hdev) ...@@ -1007,6 +1007,9 @@ static int hclge_configure(struct hclge_dev *hdev)
hdev->tm_info.hw_pfc_map = 0; hdev->tm_info.hw_pfc_map = 0;
hdev->wanted_umv_size = cfg.umv_space; hdev->wanted_umv_size = cfg.umv_space;
if (hnae3_dev_fd_supported(hdev))
hdev->fd_en = true;
ret = hclge_parse_speed(cfg.default_speed, &hdev->hw.mac.speed); ret = hclge_parse_speed(cfg.default_speed, &hdev->hw.mac.speed);
if (ret) { if (ret) {
dev_err(&hdev->pdev->dev, "Get wrong speed ret=%d.\n", ret); dev_err(&hdev->pdev->dev, "Get wrong speed ret=%d.\n", ret);
...@@ -3973,7 +3976,6 @@ static int hclge_init_fd_config(struct hclge_dev *hdev) ...@@ -3973,7 +3976,6 @@ static int hclge_init_fd_config(struct hclge_dev *hdev)
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
hdev->fd_cfg.fd_en = true;
hdev->fd_cfg.proto_support = hdev->fd_cfg.proto_support =
TCP_V4_FLOW | UDP_V4_FLOW | SCTP_V4_FLOW | TCP_V6_FLOW | TCP_V4_FLOW | UDP_V4_FLOW | SCTP_V4_FLOW | TCP_V6_FLOW |
UDP_V6_FLOW | SCTP_V6_FLOW | IPV4_USER_FLOW | IPV6_USER_FLOW; UDP_V6_FLOW | SCTP_V6_FLOW | IPV4_USER_FLOW | IPV6_USER_FLOW;
...@@ -4731,7 +4733,7 @@ static int hclge_add_fd_entry(struct hnae3_handle *handle, ...@@ -4731,7 +4733,7 @@ static int hclge_add_fd_entry(struct hnae3_handle *handle,
if (!hnae3_dev_fd_supported(hdev)) if (!hnae3_dev_fd_supported(hdev))
return -EOPNOTSUPP; return -EOPNOTSUPP;
if (!hdev->fd_cfg.fd_en) { if (!hdev->fd_en) {
dev_warn(&hdev->pdev->dev, dev_warn(&hdev->pdev->dev,
"Please enable flow director first\n"); "Please enable flow director first\n");
return -EOPNOTSUPP; return -EOPNOTSUPP;
...@@ -4884,7 +4886,7 @@ static int hclge_restore_fd_entries(struct hnae3_handle *handle) ...@@ -4884,7 +4886,7 @@ static int hclge_restore_fd_entries(struct hnae3_handle *handle)
return 0; return 0;
/* if fd is disabled, should not restore it when reset */ /* if fd is disabled, should not restore it when reset */
if (!hdev->fd_cfg.fd_en) if (!hdev->fd_en)
return 0; return 0;
hlist_for_each_entry_safe(rule, node, &hdev->fd_rule_list, rule_node) { hlist_for_each_entry_safe(rule, node, &hdev->fd_rule_list, rule_node) {
...@@ -5170,7 +5172,7 @@ static void hclge_enable_fd(struct hnae3_handle *handle, bool enable) ...@@ -5170,7 +5172,7 @@ static void hclge_enable_fd(struct hnae3_handle *handle, bool enable)
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;
hdev->fd_cfg.fd_en = enable; hdev->fd_en = enable;
if (!enable) if (!enable)
hclge_del_all_fd_entries(handle, false); hclge_del_all_fd_entries(handle, false);
else else
......
...@@ -583,7 +583,6 @@ struct hclge_fd_key_cfg { ...@@ -583,7 +583,6 @@ struct hclge_fd_key_cfg {
struct hclge_fd_cfg { struct hclge_fd_cfg {
u8 fd_mode; u8 fd_mode;
u8 fd_en;
u16 max_key_length; u16 max_key_length;
u32 proto_support; u32 proto_support;
u32 rule_num[2]; /* rule entry number */ u32 rule_num[2]; /* rule entry number */
...@@ -758,6 +757,7 @@ struct hclge_dev { ...@@ -758,6 +757,7 @@ struct hclge_dev {
struct hclge_fd_cfg fd_cfg; struct hclge_fd_cfg fd_cfg;
struct hlist_head fd_rule_list; struct hlist_head fd_rule_list;
u16 hclge_fd_rule_num; u16 hclge_fd_rule_num;
u8 fd_en;
u16 wanted_umv_size; u16 wanted_umv_size;
/* max available unicast mac vlan space */ /* max available unicast mac vlan space */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment