netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] e1000e: Fix 82574/82583 TimeSync errata handling for SYSTIM read
@ 2015-01-14 23:30 Bhavesh Davda
  2015-01-15  0:36 ` [linux-nics] " Jeff Kirsher
  0 siblings, 1 reply; 2+ messages in thread
From: Bhavesh Davda @ 2015-01-14 23:30 UTC (permalink / raw)
  To: linux.nics, netdev
  Cc: nithin, ninad, gyang, smurali, pv-drivers, Bhavesh Davda

In emulated 82574 vNICs, TIMINCA might read as '0', so this change prevents a
divide-by-zero error.

Signed-off-by: Bhavesh Davda <bhavesh@vmware.com>
Acked-by: Nithin Raju <nithin@vmware.com>
Acked-by: Ninad Ghodke <ninad@vmware.com>
Reviewed-by: Guolin Yang <gyang@vmware.com>
Reviewed-by: Srividya Murali <smurali@vmware.com>
---
 drivers/net/ethernet/intel/e1000e/netdev.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c
index e14fd85..a4727e3 100644
--- a/drivers/net/ethernet/intel/e1000e/netdev.c
+++ b/drivers/net/ethernet/intel/e1000e/netdev.c
@@ -4141,6 +4141,8 @@ static cycle_t e1000e_cyclecounter_read(const struct cyclecounter *cc)
 		 * rate and is a multiple of incvalue
 		 */
 		incvalue = er32(TIMINCA) & E1000_TIMINCA_INCVALUE_MASK;
+		if (incvalue == 0)
+			goto out;
 		for (i = 0; i < E1000_MAX_82574_SYSTIM_REREADS; i++) {
 			/* latch SYSTIMH on read of SYSTIML */
 			systim_next = (cycle_t)er32(SYSTIML);
@@ -4157,6 +4159,7 @@ static cycle_t e1000e_cyclecounter_read(const struct cyclecounter *cc)
 				break;
 		}
 	}
+out:
 	return systim;
 }
 
-- 
2.3.0.rc0

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [linux-nics] [PATCH] e1000e: Fix 82574/82583 TimeSync errata handling for SYSTIM read
  2015-01-14 23:30 [PATCH] e1000e: Fix 82574/82583 TimeSync errata handling for SYSTIM read Bhavesh Davda
@ 2015-01-15  0:36 ` Jeff Kirsher
  0 siblings, 0 replies; 2+ messages in thread
From: Jeff Kirsher @ 2015-01-15  0:36 UTC (permalink / raw)
  To: Bhavesh Davda
  Cc: linux.nics, netdev, pv-drivers, nithin, ninad, smurali, gyang

[-- Attachment #1: Type: text/plain, Size: 565 bytes --]

On Wed, 2015-01-14 at 15:30 -0800, Bhavesh Davda wrote:
> In emulated 82574 vNICs, TIMINCA might read as '0', so this change
> prevents a
> divide-by-zero error.
> 
> Signed-off-by: Bhavesh Davda <bhavesh@vmware.com>
> Acked-by: Nithin Raju <nithin@vmware.com>
> Acked-by: Ninad Ghodke <ninad@vmware.com>
> Reviewed-by: Guolin Yang <gyang@vmware.com>
> Reviewed-by: Srividya Murali <smurali@vmware.com>
> ---
>  drivers/net/ethernet/intel/e1000e/netdev.c | 3 +++
>  1 file changed, 3 insertions(+)

Thanks Bhavesh, I will add your patch to my queue.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-01-15  0:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-14 23:30 [PATCH] e1000e: Fix 82574/82583 TimeSync errata handling for SYSTIM read Bhavesh Davda
2015-01-15  0:36 ` [linux-nics] " Jeff Kirsher

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).