Commit 207ce626 authored by Miroslav Lichvar's avatar Miroslav Lichvar Committed by Jakub Kicinski

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: cf99c1dd ("igb: move PEROUT and EXTTS isr logic to separate functions")
Reported-by: default avatarMatt Corallo <ntp-lists@mattcorallo.com>
Signed-off-by: default avatarMiroslav Lichvar <mlichvar@redhat.com>
Reviewed-by: default avatarJacob Keller <jacob.e.keller@intel.com>
Tested-by: Gurucharan G <gurucharanx.g@intel.com> (A Contingent worker at Intel)
Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
Link: https://lore.kernel.org/r/20230213185822.3960072-1-anthony.l.nguyen@intel.comSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent d3a37346
...@@ -6794,7 +6794,7 @@ static void igb_perout(struct igb_adapter *adapter, int tsintr_tt) ...@@ -6794,7 +6794,7 @@ static void igb_perout(struct igb_adapter *adapter, int tsintr_tt)
struct timespec64 ts; struct timespec64 ts;
u32 tsauxc; u32 tsauxc;
if (pin < 0 || pin >= IGB_N_PEROUT) if (pin < 0 || pin >= IGB_N_SDP)
return; return;
spin_lock(&adapter->tmreg_lock); spin_lock(&adapter->tmreg_lock);
...@@ -6802,7 +6802,7 @@ static void igb_perout(struct igb_adapter *adapter, int tsintr_tt) ...@@ -6802,7 +6802,7 @@ static void igb_perout(struct igb_adapter *adapter, int tsintr_tt)
if (hw->mac.type == e1000_82580 || if (hw->mac.type == e1000_82580 ||
hw->mac.type == e1000_i354 || hw->mac.type == e1000_i354 ||
hw->mac.type == e1000_i350) { 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; u32 systiml, systimh, level_mask, level, rem;
u64 systim, now; u64 systim, now;
...@@ -6850,8 +6850,8 @@ static void igb_perout(struct igb_adapter *adapter, int tsintr_tt) ...@@ -6850,8 +6850,8 @@ static void igb_perout(struct igb_adapter *adapter, int tsintr_tt)
ts.tv_nsec = (u32)systim; ts.tv_nsec = (u32)systim;
ts.tv_sec = ((u32)(systim >> 32)) & 0xFF; ts.tv_sec = ((u32)(systim >> 32)) & 0xFF;
} else { } else {
ts = timespec64_add(adapter->perout[pin].start, ts = timespec64_add(adapter->perout[tsintr_tt].start,
adapter->perout[pin].period); adapter->perout[tsintr_tt].period);
} }
/* u32 conversion of tv_sec is safe until y2106 */ /* u32 conversion of tv_sec is safe until y2106 */
...@@ -6860,7 +6860,7 @@ static void igb_perout(struct igb_adapter *adapter, int tsintr_tt) ...@@ -6860,7 +6860,7 @@ static void igb_perout(struct igb_adapter *adapter, int tsintr_tt)
tsauxc = rd32(E1000_TSAUXC); tsauxc = rd32(E1000_TSAUXC);
tsauxc |= TSAUXC_EN_TT0; tsauxc |= TSAUXC_EN_TT0;
wr32(E1000_TSAUXC, tsauxc); wr32(E1000_TSAUXC, tsauxc);
adapter->perout[pin].start = ts; adapter->perout[tsintr_tt].start = ts;
spin_unlock(&adapter->tmreg_lock); spin_unlock(&adapter->tmreg_lock);
} }
...@@ -6874,7 +6874,7 @@ static void igb_extts(struct igb_adapter *adapter, int tsintr_tt) ...@@ -6874,7 +6874,7 @@ static void igb_extts(struct igb_adapter *adapter, int tsintr_tt)
struct ptp_clock_event event; struct ptp_clock_event event;
struct timespec64 ts; struct timespec64 ts;
if (pin < 0 || pin >= IGB_N_EXTTS) if (pin < 0 || pin >= IGB_N_SDP)
return; return;
if (hw->mac.type == e1000_82580 || if (hw->mac.type == e1000_82580 ||
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment