• Vinicius Costa Gomes's avatar
    igc: Work around HW bug causing missing timestamps · c789ad7c
    Vinicius Costa Gomes authored
    There's an hardware issue that can cause missing timestamps. The bug
    is that the interrupt is only cleared if the IGC_TXSTMPH_0 register is
    read.
    
    The bug can cause a race condition if a timestamp is captured at the
    wrong time, and we will miss that timestamp. To reduce the time window
    that the problem is able to happen, in case no timestamp was ready, we
    read the "previous" value of the timestamp registers, and we compare
    with the "current" one, if it didn't change we can be reasonably sure
    that no timestamp was captured. If they are different, we use the new
    value as the captured timestamp.
    
    The HW bug is not easy to reproduce, got to reproduce it when smashing
    the NIC with timestamping requests from multiple applications (e.g.
    multiple ntpperf instances + ptp4l), after 10s of minutes.
    
    This workaround has more impact when multiple timestamp registers are
    used, and the IGC_TXSTMPH_0 register always need to be read, so the
    interrupt is cleared.
    
    Fixes: 2c344ae2 ("igc: Add support for TX timestamping")
    Signed-off-by: default avatarVinicius Costa Gomes <vinicius.gomes@intel.com>
    Tested-by: default avatarNaama Meir <naamax.meir@linux.intel.com>
    Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
    c789ad7c
igc_ptp.c 30.4 KB