Forum Topic - Ethernet packet timestamping: (7 Items)
   
Ethernet packet timestamping  
How can I get the timestamp that when ethernet packets arrived at NIC? Are there any relevant interfaces here?  I used 
bpf to receive ethernet packet but the bpf header does not support passing timestamp to users. Is there any way can I 
get the timestamp when Ethernet packets sent or received?
Re: Ethernet packet timestamping  
The BPF header does include the timestamp in the bh_tstamp field.

If you are using normal sockets rather than BPF then you can use the SO_TIMESTAMP socket option to timestamp packets.

If you are looking for accurate packet times used with PTP then these can be retrieved with the PTP_GET_RX_TIMESTAMP and
 PTP_GET_TX_TIMESTAMP on supported network interfaces.
Re: Ethernet packet timestamping  
> The BPF header does include the timestamp in the bh_tstamp field.
> 
> If you are using normal sockets rather than BPF then you can use the 
> SO_TIMESTAMP socket option to timestamp packets.
> 
> If you are looking for accurate packet times used with PTP then these can be 
> retrieved with the PTP_GET_RX_TIMESTAMP and PTP_GET_TX_TIMESTAMP on supported 
> network interfaces.



I am trying to send/receive a raw data frame. So I used the bpf module instead of socket. Is there any example show that
 how to use raw socket(like SOCK_RAW in linux) to send/receive a raw data frame.
Re: Ethernet packet timestamping  
> > The BPF header does include the timestamp in the bh_tstamp field.
> > 
> > If you are using normal sockets rather than BPF then you can use the 
> > SO_TIMESTAMP socket option to timestamp packets.
> > 
> > If you are looking for accurate packet times used with PTP then these can be
>  
> > retrieved with the PTP_GET_RX_TIMESTAMP and PTP_GET_TX_TIMESTAMP on 
> supported 
> > network interfaces.
> 
> 
> 
> I am trying to send/receive a raw data frame. So I used the bpf module instead
>  of socket. Is there any example show that how to use raw socket(like SOCK_RAW
>  in linux) to send/receive a raw data frame.


I mean the socket domin is PF_PACKET for processing ethernet packet frame in data Link Layer.
Re: Ethernet packet timestamping  
> The BPF header does include the timestamp in the bh_tstamp field.
> 
> If you are using normal sockets rather than BPF then you can use the 
> SO_TIMESTAMP socket option to timestamp packets.
> 
> If you are looking for accurate packet times used with PTP then these can be 
> retrieved with the PTP_GET_RX_TIMESTAMP and PTP_GET_TX_TIMESTAMP on supported 
> network interfaces.

Yes. I am looking for the accurate packet times used with PTP. Where can I find those interfaces. 
Re: Ethernet packet timestamping  
For raw Ethernet then BPF is the correct interface, we don't support raw sockets in io-pkt.

The PTP API is in ptp.h

We ship and support two PTP implementations:
 - "ptpd" supports PTPv2 in UDP in IPv4
 - "ptpd-avb" supports PTPv2 in Ethernet (802.1AS).

N.B. Only certain network hardware supports hardware timestamping, and we have implemented PTP support only in some 
specific network drivers. Running either "ptpd" or "ptpd-avb" on hardware without support will result in it using the 
system clock for timestamping, which will not result in the accuracy that PTP is capable of. If run with logging to the 
console, both "ptpd" and "ptpd-avb" will report the hardware support status when they start.

If you are looking for PTP support on certain hardware and a certain QNX version, I would suggest getting in touch with 
your local QNX support representative and they should be able to help determine if it is supported or not.
Re: Ethernet packet timestamping  
Thanks a lot. If I want to use the accurate time for my own time sync module which will get accurate time from each sent
/received raw data packet, I have to use the limited interfaces from ptpd-avb?