fm10k: avoid divide by zero in rare cases when device is resetting
authorJacob Keller <jacob.e.keller@intel.com>
Mon, 10 Jul 2017 20:23:11 +0000 (13:23 -0700)
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>
Mon, 2 Oct 2017 15:07:57 +0000 (08:07 -0700)
commitdd5eede2b711350f684e8510300cb3762a821ae6
treeda5b73b3d8b1196005720936259895ada83f0771
parentd876c1583bb1b7f7264880265b824e88b791aa5d
fm10k: avoid divide by zero in rare cases when device is resetting

It is possible that under rare circumstances the device is undergoing
a reset, such as when a PFLR occurs, and the device may be transmitting
simultaneously. In this case, we might attempt to divide by zero when
finding the proper r_idx. Instead, lets read the num_tx_queues once,
and make sure it's non-zero.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Tested-by: Krishneil Singh <krishneil.k.singh@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
drivers/net/ethernet/intel/fm10k/fm10k_netdev.c