Skip to contentSkip to conversation

igb: Fix PPS input and output using 3rd and 4th SDP

PATCH In review Miroslav Lichvar 5 participants 6 messages Feb 1, 2023 – Feb 13, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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")
Cc Jacob Keller <[email protected]>

---
The fix of PPS output was not tested.

 drivers/net/ethernet/intel/igb/igb_main.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/net/ethernet/intel/igb/igb_main.c +6 -6
index c56b991fa610..04f06b396e92 100644
@@ -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 ||
Signature · 6 lines
2.39.0

_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Miroslav Lichvar

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")
Cc Jacob Keller <[email protected]>

---

Makes sense, the pins are separate from the functions.

Quoted 48 lines

The fix of PPS output was not tested.

 drivers/net/ethernet/intel/igb/igb_main.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/net/ethernet/intel/igb/igb_main.c +5 -5
index c56b991fa610..04f06b396e92 100644
@@ -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);
 }

drivers/net/ethernet/intel/igb/igb_main.c static void igb_extts(struct igb_adapter *adapter, int tsintr_tt) · line 6875

Quoted 8 lines
drivers/net/ethernet/intel/igb/igb_main.c +1 -1
@@ -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
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

maintainer
#2 lore raw
In reply to Miroslav Lichvar
Quoted 6 lines · Miroslav Lichvar

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

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

Thanks,
Tony

Quoted 51 lines

---
The fix of PPS output was not tested.

  drivers/net/ethernet/intel/igb/igb_main.c | 12 ++++++------
  1 file changed, 6 insertions(+), 6 deletions(-)
drivers/net/ethernet/intel/igb/igb_main.c +5 -5
index c56b991fa610..04f06b396e92 100644
@@ -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);
  }

drivers/net/ethernet/intel/igb/igb_main.c static void igb_extts(struct igb_adapter *adapter, int tsintr_tt) · line 6875

Quoted 8 lines
drivers/net/ethernet/intel/igb/igb_main.c +1 -1
@@ -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
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

#3 lore raw
Quoted 10 lines · Tony Nguyen
Quoted 6 lines · Miroslav Lichvar

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

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,

Signature · 6 lines
Miroslav Lichvar

_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
#4 lore raw
In reply to Tony Nguyen
Quoted 5 lines · Tony Nguyen
Quoted 4 lines · Miroslav Lichvar

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.

Quoted 7 lines
Quoted 2 lines
Fixes cf99c1dd7b77 ("igb: move PEROUT and EXTTS isr logic to separate functions")

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
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan

Tested-by on v1 1/1
#5 lore raw
In reply to Miroslav Lichvar
Quoted 17 lines

-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Miroslav Lichvar
Sent: Wednesday, February 1, 2023 8:07 PM
To: [email protected]
Cc: Matt Corallo <[email protected]>
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")

Quoted 9 lines

---
The fix of PPS output was not tested.

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

_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan