net: hns3: don't restore rules when flow director is disabled

When user disables flow director, all the rules will be disabled. But
when reset happens, it will restore all the rules again. It's not
reasonable. This patch fixes it by add flow director status check before
restore fules.

Fixes: 6871af29b3 ("net: hns3: Add reset handle for flow director")
Fixes: c17852a893 ("net: hns3: Add support for enable/disable flow director")
Signed-off-by: Jian Shen <shenjian15@huawei.com>
Signed-off-by: Peng Li <lipeng321@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Jian Shen 2018-12-20 11:52:04 +08:00 committed by David S. Miller
parent 0285dbae5d
commit 8edc2285b7
1 changed files with 4 additions and 0 deletions

View File

@ -4808,6 +4808,10 @@ static int hclge_restore_fd_entries(struct hnae3_handle *handle)
if (!hnae3_dev_fd_supported(hdev))
return 0;
/* if fd is disabled, should not restore it when reset */
if (!hdev->fd_cfg.fd_en)
return 0;
hlist_for_each_entry_safe(rule, node, &hdev->fd_rule_list, rule_node) {
ret = hclge_config_action(hdev, HCLGE_FD_STAGE_1, rule);
if (!ret)