netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] igb: fix PHC stopping on max freq
@ 2013-03-19 14:42 Jiri Benc
  2013-03-19 21:17 ` Vick, Matthew
  2013-03-20  0:49 ` Jeff Kirsher
  0 siblings, 2 replies; 6+ messages in thread
From: Jiri Benc @ 2013-03-19 14:42 UTC (permalink / raw)
  To: netdev; +Cc: e1000-devel, Jeff Kirsher, Stefan Assmann, Miroslav Lichvar

For 82576 MAC type, max_adj is reported as 1000000000 ppb. However, if
this value is passed to igb_ptp_adjfreq_82576, incvalue overflows out of
INCVALUE_82576_MASK, resulting in setting of zero TIMINCA.incvalue, stopping
the PHC (instead of going at twice the nominal speed).

Fix the advertised max_adj value to the largest value hardware can handle.
As there is no min_adj value available (-max_adj is used instead), this will
also prevent stopping the clock intentionally. It's probably not a big deal,
other igb MAC types don't support stopping the clock, either.

Signed-off-by: Jiri Benc <jbenc@redhat.com>
---
 drivers/net/ethernet/intel/igb/igb_ptp.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/net/ethernet/intel/igb/igb_ptp.c b/drivers/net/ethernet/intel/igb/igb_ptp.c
index 0987822..0a23750 100644
--- a/drivers/net/ethernet/intel/igb/igb_ptp.c
+++ b/drivers/net/ethernet/intel/igb/igb_ptp.c
@@ -740,7 +740,7 @@ void igb_ptp_init(struct igb_adapter *adapter)
 	case e1000_82576:
 		snprintf(adapter->ptp_caps.name, 16, "%pm", netdev->dev_addr);
 		adapter->ptp_caps.owner = THIS_MODULE;
-		adapter->ptp_caps.max_adj = 1000000000;
+		adapter->ptp_caps.max_adj = 999999881;
 		adapter->ptp_caps.n_ext_ts = 0;
 		adapter->ptp_caps.pps = 0;
 		adapter->ptp_caps.adjfreq = igb_ptp_adjfreq_82576;
-- 
1.7.6.5

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

* Re: [PATCH] igb: fix PHC stopping on max freq
  2013-03-19 14:42 [PATCH] igb: fix PHC stopping on max freq Jiri Benc
@ 2013-03-19 21:17 ` Vick, Matthew
  2013-03-20 19:11   ` Jiri Benc
  2013-03-20  0:49 ` Jeff Kirsher
  1 sibling, 1 reply; 6+ messages in thread
From: Vick, Matthew @ 2013-03-19 21:17 UTC (permalink / raw)
  To: Jiri Benc, netdev@vger.kernel.org
  Cc: e1000-devel@lists.sourceforge.net, Miroslav Lichvar,
	Stefan Assmann

On 3/19/13 7:42 AM, "Jiri Benc" <jbenc@redhat.com> wrote:

>For 82576 MAC type, max_adj is reported as 1000000000 ppb. However, if
>this value is passed to igb_ptp_adjfreq_82576, incvalue overflows out of
>INCVALUE_82576_MASK, resulting in setting of zero TIMINCA.incvalue,
>stopping
>the PHC (instead of going at twice the nominal speed).
>
>Fix the advertised max_adj value to the largest value hardware can handle.
>As there is no min_adj value available (-max_adj is used instead), this
>will
>also prevent stopping the clock intentionally. It's probably not a big
>deal,
>other igb MAC types don't support stopping the clock, either.
>
>Signed-off-by: Jiri Benc <jbenc@redhat.com>
>---
> drivers/net/ethernet/intel/igb/igb_ptp.c |    2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
>diff --git a/drivers/net/ethernet/intel/igb/igb_ptp.c
>b/drivers/net/ethernet/intel/igb/igb_ptp.c
>index 0987822..0a23750 100644
>--- a/drivers/net/ethernet/intel/igb/igb_ptp.c
>+++ b/drivers/net/ethernet/intel/igb/igb_ptp.c
>@@ -740,7 +740,7 @@ void igb_ptp_init(struct igb_adapter *adapter)
> 	case e1000_82576:
> 		snprintf(adapter->ptp_caps.name, 16, "%pm", netdev->dev_addr);
> 		adapter->ptp_caps.owner = THIS_MODULE;
>-		adapter->ptp_caps.max_adj = 1000000000;
>+		adapter->ptp_caps.max_adj = 999999881;
> 		adapter->ptp_caps.n_ext_ts = 0;
> 		adapter->ptp_caps.pps = 0;
> 		adapter->ptp_caps.adjfreq = igb_ptp_adjfreq_82576;
>-- 
>1.7.6.5

Good catch on this, Jiri! I know the math works out the same, but I'd
prefer it if you changed the max_adj value to 999999999, since that is
technically what we can accept before we have any issues. If you re-submit
with this change, I'll add my ACK and we can run it through our internal
testing. Thanks!

Matthew

Matthew Vick
Linux Development
Networking Division
Intel Corporation


------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_mar
_______________________________________________
E1000-devel mailing list
E1000-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/e1000-devel
To learn more about Intel&#174; Ethernet, visit http://communities.intel.com/community/wired

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

* Re: [PATCH] igb: fix PHC stopping on max freq
  2013-03-19 14:42 [PATCH] igb: fix PHC stopping on max freq Jiri Benc
  2013-03-19 21:17 ` Vick, Matthew
@ 2013-03-20  0:49 ` Jeff Kirsher
  2013-04-09 13:26   ` [E1000-devel] " Richard Cochran
  1 sibling, 1 reply; 6+ messages in thread
From: Jeff Kirsher @ 2013-03-20  0:49 UTC (permalink / raw)
  To: Jiri Benc; +Cc: netdev, e1000-devel, Stefan Assmann, Miroslav Lichvar

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

On Tue, 2013-03-19 at 15:42 +0100, Jiri Benc wrote:
> For 82576 MAC type, max_adj is reported as 1000000000 ppb. However, if
> this value is passed to igb_ptp_adjfreq_82576, incvalue overflows out
> of
> INCVALUE_82576_MASK, resulting in setting of zero TIMINCA.incvalue,
> stopping
> the PHC (instead of going at twice the nominal speed).
> 
> Fix the advertised max_adj value to the largest value hardware can
> handle.
> As there is no min_adj value available (-max_adj is used instead),
> this will
> also prevent stopping the clock intentionally. It's probably not a big
> deal,
> other igb MAC types don't support stopping the clock, either.
> 
> Signed-off-by: Jiri Benc <jbenc@redhat.com>
> ---
>  drivers/net/ethernet/intel/igb/igb_ptp.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-) 

Thanks Jiri, I have added the patch to my igb queue

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

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

* Re: [PATCH] igb: fix PHC stopping on max freq
  2013-03-19 21:17 ` Vick, Matthew
@ 2013-03-20 19:11   ` Jiri Benc
  2013-03-20 22:55     ` Vick, Matthew
  0 siblings, 1 reply; 6+ messages in thread
From: Jiri Benc @ 2013-03-20 19:11 UTC (permalink / raw)
  To: Vick, Matthew
  Cc: netdev@vger.kernel.org, e1000-devel@lists.sourceforge.net,
	Kirsher, Jeffrey T, Stefan Assmann, Miroslav Lichvar

On Tue, 19 Mar 2013 21:17:25 +0000, Vick, Matthew wrote:
> Good catch on this, Jiri! I know the math works out the same, but I'd
> prefer it if you changed the max_adj value to 999999999, since that is
> technically what we can accept before we have any issues. If you re-submit
> with this change, I'll add my ACK and we can run it through our internal
> testing. Thanks!

But the real maximum value is actually 999999881, as anything higher
than that would be capped to 999999881 by the driver. I don't think the
driver should advertise higher max_adj than it is able to fulfill,
otherwise there would be no need for the field.

 Jiri

-- 
Jiri Benc

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

* Re: [PATCH] igb: fix PHC stopping on max freq
  2013-03-20 19:11   ` Jiri Benc
@ 2013-03-20 22:55     ` Vick, Matthew
  0 siblings, 0 replies; 6+ messages in thread
From: Vick, Matthew @ 2013-03-20 22:55 UTC (permalink / raw)
  To: Jiri Benc
  Cc: netdev@vger.kernel.org, e1000-devel@lists.sourceforge.net,
	Kirsher, Jeffrey T, Stefan Assmann, Miroslav Lichvar

On 3/20/13 12:11 PM, "Jiri Benc" <jbenc@redhat.com> wrote:

>On Tue, 19 Mar 2013 21:17:25 +0000, Vick, Matthew wrote:
>> Good catch on this, Jiri! I know the math works out the same, but I'd
>> prefer it if you changed the max_adj value to 999999999, since that is
>> technically what we can accept before we have any issues. If you
>>re-submit
>> with this change, I'll add my ACK and we can run it through our internal
>> testing. Thanks!
>
>But the real maximum value is actually 999999881, as anything higher
>than that would be capped to 999999881 by the driver. I don't think the
>driver should advertise higher max_adj than it is able to fulfill,
>otherwise there would be no need for the field.

I prefer 999999999 as it's something that looks slightly less "magic
number"-y (plus looks like the other devices in igb) and is still
technically something that can be passed down without error. Ultimately
not a big deal and I can understand your argument, so I'm okay putting my
personal preference aside on this one.

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

* Re: [E1000-devel] [PATCH] igb: fix PHC stopping on max freq
  2013-03-20  0:49 ` Jeff Kirsher
@ 2013-04-09 13:26   ` Richard Cochran
  0 siblings, 0 replies; 6+ messages in thread
From: Richard Cochran @ 2013-04-09 13:26 UTC (permalink / raw)
  To: Jeff Kirsher
  Cc: Jiri Benc, e1000-devel, netdev, Miroslav Lichvar, Stefan, Assmann

On Tue, Mar 19, 2013 at 05:49:12PM -0700, Jeff Kirsher wrote:
> 
> Thanks Jiri, I have added the patch to my igb queue

Can this patch also go into stable, since v3.5, please?

Thanks,
Richard

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

end of thread, other threads:[~2013-04-09 13:26 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-19 14:42 [PATCH] igb: fix PHC stopping on max freq Jiri Benc
2013-03-19 21:17 ` Vick, Matthew
2013-03-20 19:11   ` Jiri Benc
2013-03-20 22:55     ` Vick, Matthew
2013-03-20  0:49 ` Jeff Kirsher
2013-04-09 13:26   ` [E1000-devel] " Richard Cochran

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).