net: hns3: add suspend and resume pm_ops
authorJiaran Zhang <zhangjiaran@huawei.com>
Thu, 8 Apr 2021 03:40:05 +0000 (11:40 +0800)
committerDavid S. Miller <davem@davemloft.net>
Thu, 8 Apr 2021 20:23:01 +0000 (13:23 -0700)
commit715c58e94f0d78907bfccde12c2ca5236502c53e
treeb648b9a20273ebd53c421df7ee17d53a826f10dd
parentbb1890d5f97425766a865d75f99fd556d5dc6893
net: hns3: add suspend and resume pm_ops

To implement the system suspend/resume functions, the NIC driver needs
to support:
1. When the system enters the suspend mode, the driver needs to
implement the suspend callback function of the NIC device. The driver
needs to mute the device, stop all RX/TX activities of the device, and
unmap the interrupt.
2. When the system enters the resume mode, the driver needs to
implement the resume callback function of the NIC device and restore
the device to the state before suspension.

When the system enters the suspend and resume mode, the NIC driver
actually executes the PF function reset process.

When the PFs are suspending/resuming, VFs also enter the suspend/resume
state because the PFs trigger the VFs to reset, therefore no operation
is required when the VF pci_driver is suspending or resuming.

Signed-off-by: Jiaran Zhang <zhangjiaran@huawei.com>
Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/hisilicon/hns3/hns3_enet.c
drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.c