@@ -7703,6 +7703,62 @@ static void bnxt_shutdown(struct pci_dev *pdev)
7703
7703
rtnl_unlock ();
7704
7704
}
7705
7705
7706
+ #ifdef CONFIG_PM_SLEEP
7707
+ static int bnxt_suspend (struct device * device )
7708
+ {
7709
+ struct pci_dev * pdev = to_pci_dev (device );
7710
+ struct net_device * dev = pci_get_drvdata (pdev );
7711
+ struct bnxt * bp = netdev_priv (dev );
7712
+ int rc = 0 ;
7713
+
7714
+ rtnl_lock ();
7715
+ if (netif_running (dev )) {
7716
+ netif_device_detach (dev );
7717
+ rc = bnxt_close (dev );
7718
+ }
7719
+ bnxt_hwrm_func_drv_unrgtr (bp );
7720
+ rtnl_unlock ();
7721
+ return rc ;
7722
+ }
7723
+
7724
+ static int bnxt_resume (struct device * device )
7725
+ {
7726
+ struct pci_dev * pdev = to_pci_dev (device );
7727
+ struct net_device * dev = pci_get_drvdata (pdev );
7728
+ struct bnxt * bp = netdev_priv (dev );
7729
+ int rc = 0 ;
7730
+
7731
+ rtnl_lock ();
7732
+ if (bnxt_hwrm_ver_get (bp ) || bnxt_hwrm_func_drv_rgtr (bp )) {
7733
+ rc = - ENODEV ;
7734
+ goto resume_exit ;
7735
+ }
7736
+ rc = bnxt_hwrm_func_reset (bp );
7737
+ if (rc ) {
7738
+ rc = - EBUSY ;
7739
+ goto resume_exit ;
7740
+ }
7741
+ bnxt_get_wol_settings (bp );
7742
+ if (netif_running (dev )) {
7743
+ rc = bnxt_open (dev );
7744
+ if (!rc )
7745
+ netif_device_attach (dev );
7746
+ }
7747
+
7748
+ resume_exit :
7749
+ rtnl_unlock ();
7750
+ return rc ;
7751
+ }
7752
+
7753
+ static SIMPLE_DEV_PM_OPS (bnxt_pm_ops , bnxt_suspend , bnxt_resume ) ;
7754
+ #define BNXT_PM_OPS (&bnxt_pm_ops)
7755
+
7756
+ #else
7757
+
7758
+ #define BNXT_PM_OPS NULL
7759
+
7760
+ #endif /* CONFIG_PM_SLEEP */
7761
+
7706
7762
/**
7707
7763
* bnxt_io_error_detected - called when PCI error is detected
7708
7764
* @pdev: Pointer to PCI device
@@ -7820,6 +7876,7 @@ static struct pci_driver bnxt_pci_driver = {
7820
7876
.probe = bnxt_init_one ,
7821
7877
.remove = bnxt_remove_one ,
7822
7878
.shutdown = bnxt_shutdown ,
7879
+ .driver .pm = BNXT_PM_OPS ,
7823
7880
.err_handler = & bnxt_err_handler ,
7824
7881
#if defined(CONFIG_BNXT_SRIOV )
7825
7882
.sriov_configure = bnxt_sriov_configure ,
0 commit comments