Patch "igb: Fix extts capture value format for 82580/i354/i350" has been added to the 6.3-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    igb: Fix extts capture value format for 82580/i354/i350

to the 6.3-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     igb-fix-extts-capture-value-format-for-82580-i354-i3.patch
and it can be found in the queue-6.3 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 39fde3d0c96447977ecc469d1a6cdb32e47dacc6
Author: Yuezhen Luan <eggcar.luan@xxxxxxxxx>
Date:   Wed Jun 7 09:41:16 2023 -0700

    igb: Fix extts capture value format for 82580/i354/i350
    
    [ Upstream commit 6292d7436cf2f0a2ea8800a1d2cbb155d237818a ]
    
    82580/i354/i350 features circle-counter-like timestamp registers
    that are different with newer i210. The EXTTS capture value in
    AUXTSMPx should be converted from raw circle counter value to
    timestamp value in resolution of 1 nanosec by the driver.
    
    This issue can be reproduced on i350 nics, connecting an 1PPS
    signal to a SDP pin, and run 'ts2phc' command to read external
    1PPS timestamp value. On i210 this works fine, but on i350 the
    extts is not correctly converted.
    
    The i350/i354/82580's SYSTIM and other timestamp registers are
    40bit counters, presenting time range of 2^40 ns, that means these
    registers overflows every about 1099s. This causes all these regs
    can't be used directly in contrast to the newer i210/i211s.
    
    The igb driver needs to convert these raw register values to
    valid time stamp format by using kernel timecounter apis for i350s
    families. Here the igb_extts() just forgot to do the convert.
    
    Fixes: 38970eac41db ("igb: support EXTTS on 82580/i354/i350")
    Signed-off-by: Yuezhen Luan <eggcar.luan@xxxxxxxxx>
    Reviewed-by: Jacob Keller <jacob.e.keller@xxxxxxxxx>
    Tested-by: Pucha Himasekhar Reddy <himasekharx.reddy.pucha@xxxxxxxxx> (A Contingent worker at Intel)
    Signed-off-by: Tony Nguyen <anthony.l.nguyen@xxxxxxxxx>
    Reviewed-by: Simon Horman <simon.horman@xxxxxxxxxxxx>
    Link: https://lore.kernel.org/r/20230607164116.3768175-1-anthony.l.nguyen@xxxxxxxxx
    Signed-off-by: Jakub Kicinski <kuba@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
index 274c781b55473..f2f9f81c123b8 100644
--- a/drivers/net/ethernet/intel/igb/igb_main.c
+++ b/drivers/net/ethernet/intel/igb/igb_main.c
@@ -6948,6 +6948,7 @@ static void igb_extts(struct igb_adapter *adapter, int tsintr_tt)
 	struct e1000_hw *hw = &adapter->hw;
 	struct ptp_clock_event event;
 	struct timespec64 ts;
+	unsigned long flags;
 
 	if (pin < 0 || pin >= IGB_N_SDP)
 		return;
@@ -6955,9 +6956,12 @@ static void igb_extts(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 = rd32(auxstmpl);
+		u64 ns = rd32(auxstmpl);
 
-		ns += ((s64)(rd32(auxstmph) & 0xFF)) << 32;
+		ns += ((u64)(rd32(auxstmph) & 0xFF)) << 32;
+		spin_lock_irqsave(&adapter->tmreg_lock, flags);
+		ns = timecounter_cyc2time(&adapter->tc, ns);
+		spin_unlock_irqrestore(&adapter->tmreg_lock, flags);
 		ts = ns_to_timespec64(ns);
 	} else {
 		ts.tv_nsec = rd32(auxstmpl);



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux