Commit 1f609492 authored by Yunsheng Lin's avatar Yunsheng Lin Committed by David S. Miller

net: hns3: add HNAE3_RESTORE_CLIENT interface in enet module

The HNAE3_INIT_CLIENT interface is also used when changing tc
configuration, vlan/mac hardware table does not need to be restored
when tc configuration changes.

This patch adds a HNAE3_RESTORE_CLIENT interface to restore the
vlan/mac hardware table when resetting.
Signed-off-by: default avatarYunsheng Lin <linyunsheng@huawei.com>
Signed-off-by: default avatarPeng Li <lipeng321@huawei.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent af013903
...@@ -124,6 +124,7 @@ enum hnae3_reset_notify_type { ...@@ -124,6 +124,7 @@ enum hnae3_reset_notify_type {
HNAE3_DOWN_CLIENT, HNAE3_DOWN_CLIENT,
HNAE3_INIT_CLIENT, HNAE3_INIT_CLIENT,
HNAE3_UNINIT_CLIENT, HNAE3_UNINIT_CLIENT,
HNAE3_RESTORE_CLIENT,
}; };
enum hnae3_reset_type { enum hnae3_reset_type {
......
...@@ -4004,35 +4004,8 @@ static int hns3_reset_notify_init_enet(struct hnae3_handle *handle) ...@@ -4004,35 +4004,8 @@ static int hns3_reset_notify_init_enet(struct hnae3_handle *handle)
{ {
struct net_device *netdev = handle->kinfo.netdev; struct net_device *netdev = handle->kinfo.netdev;
struct hns3_nic_priv *priv = netdev_priv(netdev); struct hns3_nic_priv *priv = netdev_priv(netdev);
bool vlan_filter_enable;
int ret; int ret;
ret = hns3_init_mac_addr(netdev, false);
if (ret)
return ret;
ret = hns3_recover_hw_addr(netdev);
if (ret)
return ret;
ret = hns3_update_promisc_mode(netdev, handle->netdev_flags);
if (ret)
return ret;
vlan_filter_enable = netdev->flags & IFF_PROMISC ? false : true;
hns3_enable_vlan_filter(netdev, vlan_filter_enable);
/* Hardware table is only clear when pf resets */
if (!(handle->flags & HNAE3_SUPPORT_VF)) {
ret = hns3_restore_vlan(netdev);
if (ret)
return ret;
}
ret = hns3_restore_fd_rules(netdev);
if (ret)
return ret;
/* Carrier off reporting is important to ethtool even BEFORE open */ /* Carrier off reporting is important to ethtool even BEFORE open */
netif_carrier_off(netdev); netif_carrier_off(netdev);
...@@ -4070,6 +4043,37 @@ static int hns3_reset_notify_init_enet(struct hnae3_handle *handle) ...@@ -4070,6 +4043,37 @@ static int hns3_reset_notify_init_enet(struct hnae3_handle *handle)
return ret; return ret;
} }
static int hns3_reset_notify_restore_enet(struct hnae3_handle *handle)
{
struct net_device *netdev = handle->kinfo.netdev;
bool vlan_filter_enable;
int ret;
ret = hns3_init_mac_addr(netdev, false);
if (ret)
return ret;
ret = hns3_recover_hw_addr(netdev);
if (ret)
return ret;
ret = hns3_update_promisc_mode(netdev, handle->netdev_flags);
if (ret)
return ret;
vlan_filter_enable = netdev->flags & IFF_PROMISC ? false : true;
hns3_enable_vlan_filter(netdev, vlan_filter_enable);
/* Hardware table is only clear when pf resets */
if (!(handle->flags & HNAE3_SUPPORT_VF)) {
ret = hns3_restore_vlan(netdev);
if (ret)
return ret;
}
return hns3_restore_fd_rules(netdev);
}
static int hns3_reset_notify_uninit_enet(struct hnae3_handle *handle) static int hns3_reset_notify_uninit_enet(struct hnae3_handle *handle)
{ {
struct net_device *netdev = handle->kinfo.netdev; struct net_device *netdev = handle->kinfo.netdev;
...@@ -4125,6 +4129,9 @@ static int hns3_reset_notify(struct hnae3_handle *handle, ...@@ -4125,6 +4129,9 @@ static int hns3_reset_notify(struct hnae3_handle *handle,
case HNAE3_UNINIT_CLIENT: case HNAE3_UNINIT_CLIENT:
ret = hns3_reset_notify_uninit_enet(handle); ret = hns3_reset_notify_uninit_enet(handle);
break; break;
case HNAE3_RESTORE_CLIENT:
ret = hns3_reset_notify_restore_enet(handle);
break;
default: default:
break; break;
} }
......
...@@ -2866,6 +2866,10 @@ static void hclge_reset(struct hclge_dev *hdev) ...@@ -2866,6 +2866,10 @@ static void hclge_reset(struct hclge_dev *hdev)
if (ret) if (ret)
goto err_reset_lock; goto err_reset_lock;
ret = hclge_notify_client(hdev, HNAE3_RESTORE_CLIENT);
if (ret)
goto err_reset_lock;
hclge_clear_reset_cause(hdev); hclge_clear_reset_cause(hdev);
ret = hclge_reset_prepare_up(hdev); ret = hclge_reset_prepare_up(hdev);
......
...@@ -1264,7 +1264,7 @@ static int hclgevf_reset_stack(struct hclgevf_dev *hdev) ...@@ -1264,7 +1264,7 @@ static int hclgevf_reset_stack(struct hclgevf_dev *hdev)
if (ret) if (ret)
return ret; return ret;
return 0; return hclgevf_notify_client(hdev, HNAE3_RESTORE_CLIENT);
} }
static int hclgevf_reset_prepare_wait(struct hclgevf_dev *hdev) static int hclgevf_reset_prepare_wait(struct hclgevf_dev *hdev)
......
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