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: Yunsheng Lin <linyunsheng@huawei.com> Signed-off-by: Peng Li <lipeng321@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
af013903c5
commit
1f60949297
@ -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)
|
|||||||
{
|
{
|
||||||
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 @@ err_put_ring:
|
|||||||
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,
|
|||||||
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)
|
|||||||
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)
|
|||||||
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)
|
||||||
|
Loading…
Reference in New Issue
Block a user