net: can: mttcan: fix mttcan close in case of PXE

When mttcan
- is set into DAR (Disable Automatic Retransmission) mode
- and Protocol Exception Handling is enabled
- and PXE (Protocol Exeception Event) is generated
then no TCF (Transmission cancellation Finished) event is generated.
This leads to mismatch between internal driver state and mttcan HW
state. This results in "no buffer space available" error.

This patch clears the driver internal state in close callback to
handle this situation.

Bug 200502350

Change-Id: Ie9f8fcc902a8d9b6c65662888904be5ad9aae49e
Signed-off-by: Abhijit <abhijit@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvidia/+/2854706
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/2921328
Tested-by: Manish Bhardwaj <mbhardwaj@nvidia.com>
Reviewed-by: Manish Bhardwaj <mbhardwaj@nvidia.com>
Reviewed-by: Suresh Venkatachalam <skathirampat@nvidia.com>
Reviewed-by: Sandeep Trasi <strasi@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
Abhijit
2019-04-09 16:47:23 +05:30
committed by mobile promotions
parent 37af2918e5
commit 16a076bf64

View File

@@ -1359,7 +1359,14 @@ static int mttcan_close(struct net_device *dev)
napi_disable(&priv->napi); napi_disable(&priv->napi);
mttcan_stop(priv); mttcan_stop(priv);
free_irq(dev->irq, dev); free_irq(dev->irq, dev);
/* When we do power_down, it resets the mttcan HW by setting
* INIT bit. This clears the internal state of mttcan HW.
* We also then need to clear the internal states of driver.
*/
priv->ttcan->tx_object = 0;
priv->hwts_rx_en = false; priv->hwts_rx_en = false;
close_candev(dev); close_candev(dev);
mttcan_power_down(dev); mttcan_power_down(dev);
mttcan_pm_runtime_put_sync(priv); mttcan_pm_runtime_put_sync(priv);