Intel-Wired-Lan Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Intel-wired-lan] [PATCH net-next] igb: Fix PPS input and output using 3rd and 4th SDP
@ 2023-02-01 14:36 Miroslav Lichvar
  2023-02-02  0:25 ` Jacob Keller
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Miroslav Lichvar @ 2023-02-01 14:36 UTC (permalink / raw)
  To: intel-wired-lan; +Cc: Matt Corallo

Fix handling of the tsync interrupt to compare the pin number with
IGB_N_SDP instead of IGB_N_EXTTS/IGB_N_PEROUT and fix the indexing to
the perout array.

Fixes: cf99c1dd7b77 ("igb: move PEROUT and EXTTS isr logic to separate functions")
Reported-by: Matt Corallo <ntp-lists@mattcorallo.com>
Cc: Jacob Keller <jacob.e.keller@intel.com>
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
---
The fix of PPS output was not tested.

 drivers/net/ethernet/intel/igb/igb_main.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
index c56b991fa610..04f06b396e92 100644
--- a/drivers/net/ethernet/intel/igb/igb_main.c
+++ b/drivers/net/ethernet/intel/igb/igb_main.c
@@ -6789,7 +6789,7 @@ static void igb_perout(struct igb_adapter *adapter, int tsintr_tt)
 	struct timespec64 ts;
 	u32 tsauxc;
 
-	if (pin < 0 || pin >= IGB_N_PEROUT)
+	if (pin < 0 || pin >= IGB_N_SDP)
 		return;
 
 	spin_lock(&adapter->tmreg_lock);
@@ -6797,7 +6797,7 @@ static void igb_perout(struct igb_adapter *adapter, int tsintr_tt)
 	if (hw->mac.type == e1000_82580 ||
 	    hw->mac.type == e1000_i354 ||
 	    hw->mac.type == e1000_i350) {
-		s64 ns = timespec64_to_ns(&adapter->perout[pin].period);
+		s64 ns = timespec64_to_ns(&adapter->perout[tsintr_tt].period);
 		u32 systiml, systimh, level_mask, level, rem;
 		u64 systim, now;
 
@@ -6845,8 +6845,8 @@ static void igb_perout(struct igb_adapter *adapter, int tsintr_tt)
 		ts.tv_nsec = (u32)systim;
 		ts.tv_sec  = ((u32)(systim >> 32)) & 0xFF;
 	} else {
-		ts = timespec64_add(adapter->perout[pin].start,
-				    adapter->perout[pin].period);
+		ts = timespec64_add(adapter->perout[tsintr_tt].start,
+				    adapter->perout[tsintr_tt].period);
 	}
 
 	/* u32 conversion of tv_sec is safe until y2106 */
@@ -6855,7 +6855,7 @@ static void igb_perout(struct igb_adapter *adapter, int tsintr_tt)
 	tsauxc = rd32(E1000_TSAUXC);
 	tsauxc |= TSAUXC_EN_TT0;
 	wr32(E1000_TSAUXC, tsauxc);
-	adapter->perout[pin].start = ts;
+	adapter->perout[tsintr_tt].start = ts;
 
 	spin_unlock(&adapter->tmreg_lock);
 }
@@ -6869,7 +6869,7 @@ static void igb_extts(struct igb_adapter *adapter, int tsintr_tt)
 	struct ptp_clock_event event;
 	struct timespec64 ts;
 
-	if (pin < 0 || pin >= IGB_N_EXTTS)
+	if (pin < 0 || pin >= IGB_N_SDP)
 		return;
 
 	if (hw->mac.type == e1000_82580 ||
-- 
2.39.0

_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

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

* Re: [Intel-wired-lan] [PATCH net-next] igb: Fix PPS input and output using 3rd and 4th SDP
  2023-02-01 14:36 [Intel-wired-lan] [PATCH net-next] igb: Fix PPS input and output using 3rd and 4th SDP Miroslav Lichvar
@ 2023-02-02  0:25 ` Jacob Keller
  2023-02-02 17:10 ` Tony Nguyen
  2023-02-13  4:03 ` G, GurucharanX
  2 siblings, 0 replies; 6+ messages in thread
From: Jacob Keller @ 2023-02-02  0:25 UTC (permalink / raw)
  To: Miroslav Lichvar, intel-wired-lan; +Cc: Matt Corallo



On 2/1/2023 6:36 AM, Miroslav Lichvar wrote:
> Fix handling of the tsync interrupt to compare the pin number with
> IGB_N_SDP instead of IGB_N_EXTTS/IGB_N_PEROUT and fix the indexing to
> the perout array.
> 
> Fixes: cf99c1dd7b77 ("igb: move PEROUT and EXTTS isr logic to separate functions")
> Reported-by: Matt Corallo <ntp-lists@mattcorallo.com>
> Cc: Jacob Keller <jacob.e.keller@intel.com>
> Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
> ---

Makes sense, the pins are separate from the functions.

Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>

> The fix of PPS output was not tested.
> 
>  drivers/net/ethernet/intel/igb/igb_main.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
> index c56b991fa610..04f06b396e92 100644
> --- a/drivers/net/ethernet/intel/igb/igb_main.c
> +++ b/drivers/net/ethernet/intel/igb/igb_main.c
> @@ -6789,7 +6789,7 @@ static void igb_perout(struct igb_adapter *adapter, int tsintr_tt)
>  	struct timespec64 ts;
>  	u32 tsauxc;
>  
> -	if (pin < 0 || pin >= IGB_N_PEROUT)
> +	if (pin < 0 || pin >= IGB_N_SDP)
>  		return;
>  
>  	spin_lock(&adapter->tmreg_lock);
> @@ -6797,7 +6797,7 @@ static void igb_perout(struct igb_adapter *adapter, int tsintr_tt)
>  	if (hw->mac.type == e1000_82580 ||
>  	    hw->mac.type == e1000_i354 ||
>  	    hw->mac.type == e1000_i350) {
> -		s64 ns = timespec64_to_ns(&adapter->perout[pin].period);
> +		s64 ns = timespec64_to_ns(&adapter->perout[tsintr_tt].period);
>  		u32 systiml, systimh, level_mask, level, rem;
>  		u64 systim, now;
>  
> @@ -6845,8 +6845,8 @@ static void igb_perout(struct igb_adapter *adapter, int tsintr_tt)
>  		ts.tv_nsec = (u32)systim;
>  		ts.tv_sec  = ((u32)(systim >> 32)) & 0xFF;
>  	} else {
> -		ts = timespec64_add(adapter->perout[pin].start,
> -				    adapter->perout[pin].period);
> +		ts = timespec64_add(adapter->perout[tsintr_tt].start,
> +				    adapter->perout[tsintr_tt].period);
>  	}
>  
>  	/* u32 conversion of tv_sec is safe until y2106 */
> @@ -6855,7 +6855,7 @@ static void igb_perout(struct igb_adapter *adapter, int tsintr_tt)
>  	tsauxc = rd32(E1000_TSAUXC);
>  	tsauxc |= TSAUXC_EN_TT0;
>  	wr32(E1000_TSAUXC, tsauxc);
> -	adapter->perout[pin].start = ts;
> +	adapter->perout[tsintr_tt].start = ts;
>  
>  	spin_unlock(&adapter->tmreg_lock);
>  }
> @@ -6869,7 +6869,7 @@ static void igb_extts(struct igb_adapter *adapter, int tsintr_tt)
>  	struct ptp_clock_event event;
>  	struct timespec64 ts;
>  
> -	if (pin < 0 || pin >= IGB_N_EXTTS)
> +	if (pin < 0 || pin >= IGB_N_SDP)
>  		return;
>  
>  	if (hw->mac.type == e1000_82580 ||
_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

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

* Re: [Intel-wired-lan] [PATCH net-next] igb: Fix PPS input and output using 3rd and 4th SDP
  2023-02-01 14:36 [Intel-wired-lan] [PATCH net-next] igb: Fix PPS input and output using 3rd and 4th SDP Miroslav Lichvar
  2023-02-02  0:25 ` Jacob Keller
@ 2023-02-02 17:10 ` Tony Nguyen
  2023-02-02 17:34   ` Matt Corallo
  2023-02-02 17:34   ` Miroslav Lichvar
  2023-02-13  4:03 ` G, GurucharanX
  2 siblings, 2 replies; 6+ messages in thread
From: Tony Nguyen @ 2023-02-02 17:10 UTC (permalink / raw)
  To: Miroslav Lichvar, intel-wired-lan; +Cc: Matt Corallo

On 2/1/2023 6:36 AM, Miroslav Lichvar wrote:
> Fix handling of the tsync interrupt to compare the pin number with
> IGB_N_SDP instead of IGB_N_EXTTS/IGB_N_PEROUT and fix the indexing to
> the perout array.
> 
> Fixes: cf99c1dd7b77 ("igb: move PEROUT and EXTTS isr logic to separate functions")
> Reported-by: Matt Corallo <ntp-lists@mattcorallo.com>

This is marked for net-next but with the fixes and reported-by, should 
this be net?

Thanks,
Tony

> Cc: Jacob Keller <jacob.e.keller@intel.com>
> Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
> ---
> The fix of PPS output was not tested.
> 
>   drivers/net/ethernet/intel/igb/igb_main.c | 12 ++++++------
>   1 file changed, 6 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
> index c56b991fa610..04f06b396e92 100644
> --- a/drivers/net/ethernet/intel/igb/igb_main.c
> +++ b/drivers/net/ethernet/intel/igb/igb_main.c
> @@ -6789,7 +6789,7 @@ static void igb_perout(struct igb_adapter *adapter, int tsintr_tt)
>   	struct timespec64 ts;
>   	u32 tsauxc;
>   
> -	if (pin < 0 || pin >= IGB_N_PEROUT)
> +	if (pin < 0 || pin >= IGB_N_SDP)
>   		return;
>   
>   	spin_lock(&adapter->tmreg_lock);
> @@ -6797,7 +6797,7 @@ static void igb_perout(struct igb_adapter *adapter, int tsintr_tt)
>   	if (hw->mac.type == e1000_82580 ||
>   	    hw->mac.type == e1000_i354 ||
>   	    hw->mac.type == e1000_i350) {
> -		s64 ns = timespec64_to_ns(&adapter->perout[pin].period);
> +		s64 ns = timespec64_to_ns(&adapter->perout[tsintr_tt].period);
>   		u32 systiml, systimh, level_mask, level, rem;
>   		u64 systim, now;
>   
> @@ -6845,8 +6845,8 @@ static void igb_perout(struct igb_adapter *adapter, int tsintr_tt)
>   		ts.tv_nsec = (u32)systim;
>   		ts.tv_sec  = ((u32)(systim >> 32)) & 0xFF;
>   	} else {
> -		ts = timespec64_add(adapter->perout[pin].start,
> -				    adapter->perout[pin].period);
> +		ts = timespec64_add(adapter->perout[tsintr_tt].start,
> +				    adapter->perout[tsintr_tt].period);
>   	}
>   
>   	/* u32 conversion of tv_sec is safe until y2106 */
> @@ -6855,7 +6855,7 @@ static void igb_perout(struct igb_adapter *adapter, int tsintr_tt)
>   	tsauxc = rd32(E1000_TSAUXC);
>   	tsauxc |= TSAUXC_EN_TT0;
>   	wr32(E1000_TSAUXC, tsauxc);
> -	adapter->perout[pin].start = ts;
> +	adapter->perout[tsintr_tt].start = ts;
>   
>   	spin_unlock(&adapter->tmreg_lock);
>   }
> @@ -6869,7 +6869,7 @@ static void igb_extts(struct igb_adapter *adapter, int tsintr_tt)
>   	struct ptp_clock_event event;
>   	struct timespec64 ts;
>   
> -	if (pin < 0 || pin >= IGB_N_EXTTS)
> +	if (pin < 0 || pin >= IGB_N_SDP)
>   		return;
>   
>   	if (hw->mac.type == e1000_82580 ||
_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

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

* Re: [Intel-wired-lan] [PATCH net-next] igb: Fix PPS input and output using 3rd and 4th SDP
  2023-02-02 17:10 ` Tony Nguyen
@ 2023-02-02 17:34   ` Matt Corallo
  2023-02-02 17:34   ` Miroslav Lichvar
  1 sibling, 0 replies; 6+ messages in thread
From: Matt Corallo @ 2023-02-02 17:34 UTC (permalink / raw)
  To: Tony Nguyen, Miroslav Lichvar, intel-wired-lan



On 2/2/23 9:10 AM, Tony Nguyen wrote:
> On 2/1/2023 6:36 AM, Miroslav Lichvar wrote:
>> Fix handling of the tsync interrupt to compare the pin number with
>> IGB_N_SDP instead of IGB_N_EXTTS/IGB_N_PEROUT and fix the indexing to
>> the perout array.
>>
>> Fixes: cf99c1dd7b77 ("igb: move PEROUT and EXTTS isr logic to separate functions")
>> Reported-by: Matt Corallo <ntp-lists@mattcorallo.com>
> 
> This is marked for net-next but with the fixes and reported-by, should this be net?
> 
> Thanks,
> Tony

This at least fixes a bug I saw on 6.1, so ideally it does, and goes into stable.

Thanks,
Matt
_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

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

* Re: [Intel-wired-lan] [PATCH net-next] igb: Fix PPS input and output using 3rd and 4th SDP
  2023-02-02 17:10 ` Tony Nguyen
  2023-02-02 17:34   ` Matt Corallo
@ 2023-02-02 17:34   ` Miroslav Lichvar
  1 sibling, 0 replies; 6+ messages in thread
From: Miroslav Lichvar @ 2023-02-02 17:34 UTC (permalink / raw)
  To: Tony Nguyen; +Cc: Matt Corallo, intel-wired-lan

On Thu, Feb 02, 2023 at 09:10:57AM -0800, Tony Nguyen wrote:
> On 2/1/2023 6:36 AM, Miroslav Lichvar wrote:
> > Fix handling of the tsync interrupt to compare the pin number with
> > IGB_N_SDP instead of IGB_N_EXTTS/IGB_N_PEROUT and fix the indexing to
> > the perout array.
> > 
> > Fixes: cf99c1dd7b77 ("igb: move PEROUT and EXTTS isr logic to separate functions")
> > Reported-by: Matt Corallo <ntp-lists@mattcorallo.com>
> 
> This is marked for net-next but with the fixes and reported-by, should this
> be net?

I wasn't sure with net as the PPS output feature wasn't tested yet and
it touched new code added for I350 since the buggy commit. If that's
ok, make it net.

Thanks,

-- 
Miroslav Lichvar

_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

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

* Re: [Intel-wired-lan] [PATCH net-next] igb: Fix PPS input and output using 3rd and 4th SDP
  2023-02-01 14:36 [Intel-wired-lan] [PATCH net-next] igb: Fix PPS input and output using 3rd and 4th SDP Miroslav Lichvar
  2023-02-02  0:25 ` Jacob Keller
  2023-02-02 17:10 ` Tony Nguyen
@ 2023-02-13  4:03 ` G, GurucharanX
  2 siblings, 0 replies; 6+ messages in thread
From: G, GurucharanX @ 2023-02-13  4:03 UTC (permalink / raw)
  To: Miroslav Lichvar, intel-wired-lan@lists.osuosl.org; +Cc: Matt Corallo



> -----Original Message-----
> From: Intel-wired-lan <intel-wired-lan-bounces@osuosl.org> On Behalf Of
> Miroslav Lichvar
> Sent: Wednesday, February 1, 2023 8:07 PM
> To: intel-wired-lan@lists.osuosl.org
> Cc: Matt Corallo <ntp-lists@mattcorallo.com>
> Subject: [Intel-wired-lan] [PATCH net-next] igb: Fix PPS input and output
> using 3rd and 4th SDP
> 
> Fix handling of the tsync interrupt to compare the pin number with
> IGB_N_SDP instead of IGB_N_EXTTS/IGB_N_PEROUT and fix the indexing to
> the perout array.
> 
> Fixes: cf99c1dd7b77 ("igb: move PEROUT and EXTTS isr logic to separate
> functions")
> Reported-by: Matt Corallo <ntp-lists@mattcorallo.com>
> Cc: Jacob Keller <jacob.e.keller@intel.com>
> Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
> ---
> The fix of PPS output was not tested.
> 
>  drivers/net/ethernet/intel/igb/igb_main.c | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 

Tested-by: Gurucharan G <gurucharanx.g@intel.com> (A Contingent worker at Intel)
_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

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

end of thread, other threads:[~2023-02-13  4:04 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-01 14:36 [Intel-wired-lan] [PATCH net-next] igb: Fix PPS input and output using 3rd and 4th SDP Miroslav Lichvar
2023-02-02  0:25 ` Jacob Keller
2023-02-02 17:10 ` Tony Nguyen
2023-02-02 17:34   ` Matt Corallo
2023-02-02 17:34   ` Miroslav Lichvar
2023-02-13  4:03 ` G, GurucharanX

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox