> On Jan 06, 2017, at 05:04, Miroslav Lichvar <mlich...@redhat.com> wrote:
> 
> On Thu, Jan 05, 2017 at 10:15:08AM -0800, Denny Page wrote:
>> Yes, comp is an abbreviation for compensation. One will always an add and 
>> the other is always a subtract. This is because the timestamps are defined 
>> as being at the php layer (last bit of the SFD), but the timestamps are 
>> being taken at the mii layer. For inbound, the phy layer precedes the mii 
>> layer which means that the timestamp has to be adjusted backward in time, 
>> hence the subtract. For outbound, the phy later succeeds the mii layer which 
>> means that the timestamp has to be adjusted forward in time, hence the add. 
>> Have a look at the igb kernel driver or linuxptp for examples.
> 
> Ok. I thought the drivers were supposed to adjust the timestamp for
> the (minimum?) MAC-PHY error.

That would be nice, but that doesn’t look like it’s going to happen. The only 
Intel driver that has compensation added in the kernel distribution is the 
i210. There is no compensation done for the i211, i350, etc. Notably, the 
official Intel driver, which is module only, does not have compensation for any 
device including the i210. The compensation that was introduced for the i210 in 
the kernel distribution was based on latency estimates from Intel in the i210 
data sheet. While the information for 100Mb is still present, Intel has 
withdrawn the the estimates for 10Mb and 1Gb, and they are no longer in the 
data sheet. Lastly, if one trusts the remaining 100Mb information, the values 
used in the kernel are incorrect. They took the tx compensation from table 
7-62, which is a stand-alone test, and the rx compensation from table 7-63 
which is a partner test. And even there, the numbers appear to have been 
mistyped. The data sheet says “2133” while the kernel has “2213”.  The correct 
numbers for tx/rx compensation according to the data sheet are 1024/2228 for 
stand-alone and 1044/2133 for partner observed. I raised this on the kernel 
Intel wired list twice, with no response so I doubt it’s going to get fixed.

If you want to have a look, see the following links.

Kernel source:
  
https://github.com/torvalds/linux/blob/master/drivers/net/ethernet/intel/igb/igb_ptp.c
 
<https://github.com/torvalds/linux/blob/master/drivers/net/ethernet/intel/igb/igb_ptp.c>
  
https://github.com/torvalds/linux/blob/master/drivers/net/ethernet/intel/igb/igb.h
 
<https://github.com/torvalds/linux/blob/master/drivers/net/ethernet/intel/igb/igb.h>

Intel data sheet:
  
http://www.intel.com/content/dam/www/public/us/en/documents/datasheets/i210-ethernet-controller-datasheet.pdf
 
<http://www.intel.com/content/dam/www/public/us/en/documents/datasheets/i210-ethernet-controller-datasheet.pdf>
 (page 341).

Official Intel driver:
  https://sourceforge.net/projects/e1000/files/igb%20stable/5.3.5.4 
<https://sourceforge.net/projects/e1000/files/igb%20stable/5.3.5.4>

In short, I think it’s much better to go the way of linuxptp and offer 
compensation in user space.

Denny

Reply via email to