diff options
author | Shrikrishna Khare <skhare@vmware.com> | 2015-01-09 18:19:14 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-01-12 16:43:58 -0500 |
commit | 5ec82c1e4c86cf2fa115a2ae6d3576a100b47c42 (patch) | |
tree | 08680c0a14adb519c4a913a2e82e1ede2e649486 /drivers/net/vmxnet3 | |
parent | 7bfa014500ceffa8b787ffc3a6e00252443631d0 (diff) |
Driver: Vmxnet3: Reinitialize vmxnet3 backend on wakeup from hibernate
Failing to reinitialize on wakeup results in loss of network connectivity for
vmxnet3 interface.
Signed-off-by: Srividya Murali <smurali@vmware.com>
Signed-off-by: Shrikrishna Khare <skhare@vmware.com>
Reviewed-by: Shreyas N Bhatewara <sbhatewara@vmware.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/vmxnet3')
-rw-r--r-- | drivers/net/vmxnet3/vmxnet3_drv.c | 44 | ||||
-rw-r--r-- | drivers/net/vmxnet3/vmxnet3_int.h | 4 |
2 files changed, 27 insertions, 21 deletions
diff --git a/drivers/net/vmxnet3/vmxnet3_drv.c b/drivers/net/vmxnet3/vmxnet3_drv.c index 7af1f5cfa87a..31439818c27e 100644 --- a/drivers/net/vmxnet3/vmxnet3_drv.c +++ b/drivers/net/vmxnet3/vmxnet3_drv.c | |||
@@ -3290,27 +3290,15 @@ skip_arp: | |||
3290 | static int | 3290 | static int |
3291 | vmxnet3_resume(struct device *device) | 3291 | vmxnet3_resume(struct device *device) |
3292 | { | 3292 | { |
3293 | int err, i = 0; | 3293 | int err; |
3294 | unsigned long flags; | 3294 | unsigned long flags; |
3295 | struct pci_dev *pdev = to_pci_dev(device); | 3295 | struct pci_dev *pdev = to_pci_dev(device); |
3296 | struct net_device *netdev = pci_get_drvdata(pdev); | 3296 | struct net_device *netdev = pci_get_drvdata(pdev); |
3297 | struct vmxnet3_adapter *adapter = netdev_priv(netdev); | 3297 | struct vmxnet3_adapter *adapter = netdev_priv(netdev); |
3298 | struct Vmxnet3_PMConf *pmConf; | ||
3299 | 3298 | ||
3300 | if (!netif_running(netdev)) | 3299 | if (!netif_running(netdev)) |
3301 | return 0; | 3300 | return 0; |
3302 | 3301 | ||
3303 | /* Destroy wake-up filters. */ | ||
3304 | pmConf = adapter->pm_conf; | ||
3305 | memset(pmConf, 0, sizeof(*pmConf)); | ||
3306 | |||
3307 | adapter->shared->devRead.pmConfDesc.confVer = cpu_to_le32(1); | ||
3308 | adapter->shared->devRead.pmConfDesc.confLen = cpu_to_le32(sizeof( | ||
3309 | *pmConf)); | ||
3310 | adapter->shared->devRead.pmConfDesc.confPA = | ||
3311 | cpu_to_le64(adapter->pm_conf_pa); | ||
3312 | |||
3313 | netif_device_attach(netdev); | ||
3314 | pci_set_power_state(pdev, PCI_D0); | 3302 | pci_set_power_state(pdev, PCI_D0); |
3315 | pci_restore_state(pdev); | 3303 | pci_restore_state(pdev); |
3316 | err = pci_enable_device_mem(pdev); | 3304 | err = pci_enable_device_mem(pdev); |
@@ -3319,15 +3307,31 @@ vmxnet3_resume(struct device *device) | |||
3319 | 3307 | ||
3320 | pci_enable_wake(pdev, PCI_D0, 0); | 3308 | pci_enable_wake(pdev, PCI_D0, 0); |
3321 | 3309 | ||
3310 | vmxnet3_alloc_intr_resources(adapter); | ||
3311 | |||
3312 | /* During hibernate and suspend, device has to be reinitialized as the | ||
3313 | * device state need not be preserved. | ||
3314 | */ | ||
3315 | |||
3316 | /* Need not check adapter state as other reset tasks cannot run during | ||
3317 | * device resume. | ||
3318 | */ | ||
3322 | spin_lock_irqsave(&adapter->cmd_lock, flags); | 3319 | spin_lock_irqsave(&adapter->cmd_lock, flags); |
3323 | VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD, | 3320 | VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD, |
3324 | VMXNET3_CMD_UPDATE_PMCFG); | 3321 | VMXNET3_CMD_QUIESCE_DEV); |
3325 | spin_unlock_irqrestore(&adapter->cmd_lock, flags); | 3322 | spin_unlock_irqrestore(&adapter->cmd_lock, flags); |
3326 | vmxnet3_alloc_intr_resources(adapter); | 3323 | vmxnet3_tq_cleanup_all(adapter); |
3327 | vmxnet3_request_irqs(adapter); | 3324 | vmxnet3_rq_cleanup_all(adapter); |
3328 | for (i = 0; i < adapter->num_rx_queues; i++) | 3325 | |
3329 | napi_enable(&adapter->rx_queue[i].napi); | 3326 | vmxnet3_reset_dev(adapter); |
3330 | vmxnet3_enable_all_intrs(adapter); | 3327 | err = vmxnet3_activate_dev(adapter); |
3328 | if (err != 0) { | ||
3329 | netdev_err(netdev, | ||
3330 | "failed to re-activate on resume, error: %d", err); | ||
3331 | vmxnet3_force_close(adapter); | ||
3332 | return err; | ||
3333 | } | ||
3334 | netif_device_attach(netdev); | ||
3331 | 3335 | ||
3332 | return 0; | 3336 | return 0; |
3333 | } | 3337 | } |
@@ -3335,6 +3339,8 @@ vmxnet3_resume(struct device *device) | |||
3335 | static const struct dev_pm_ops vmxnet3_pm_ops = { | 3339 | static const struct dev_pm_ops vmxnet3_pm_ops = { |
3336 | .suspend = vmxnet3_suspend, | 3340 | .suspend = vmxnet3_suspend, |
3337 | .resume = vmxnet3_resume, | 3341 | .resume = vmxnet3_resume, |
3342 | .freeze = vmxnet3_suspend, | ||
3343 | .restore = vmxnet3_resume, | ||
3338 | }; | 3344 | }; |
3339 | #endif | 3345 | #endif |
3340 | 3346 | ||
diff --git a/drivers/net/vmxnet3/vmxnet3_int.h b/drivers/net/vmxnet3/vmxnet3_int.h index 048f02058ec9..6297d9fb0ae5 100644 --- a/drivers/net/vmxnet3/vmxnet3_int.h +++ b/drivers/net/vmxnet3/vmxnet3_int.h | |||
@@ -69,10 +69,10 @@ | |||
69 | /* | 69 | /* |
70 | * Version numbers | 70 | * Version numbers |
71 | */ | 71 | */ |
72 | #define VMXNET3_DRIVER_VERSION_STRING "1.3.1.0-k" | 72 | #define VMXNET3_DRIVER_VERSION_STRING "1.3.2.0-k" |
73 | 73 | ||
74 | /* a 32-bit int, each byte encode a verion number in VMXNET3_DRIVER_VERSION */ | 74 | /* a 32-bit int, each byte encode a verion number in VMXNET3_DRIVER_VERSION */ |
75 | #define VMXNET3_DRIVER_VERSION_NUM 0x01030100 | 75 | #define VMXNET3_DRIVER_VERSION_NUM 0x01030200 |
76 | 76 | ||
77 | #if defined(CONFIG_PCI_MSI) | 77 | #if defined(CONFIG_PCI_MSI) |
78 | /* RSS only makes sense if MSI-X is supported. */ | 78 | /* RSS only makes sense if MSI-X is supported. */ |