• Miroslav Lichvar's avatar
    net: add new control message for incoming HW-timestamped packets · aad9c8c4
    Miroslav Lichvar authored
    Add SOF_TIMESTAMPING_OPT_PKTINFO option to request a new control message
    for incoming packets with hardware timestamps. It contains the index of
    the real interface which received the packet and the length of the
    packet at layer 2.
    
    The index is useful with bonding, bridges and other interfaces, where
    IP_PKTINFO doesn't allow applications to determine which PHC made the
    timestamp. With the L2 length (and link speed) it is possible to
    transpose preamble timestamps to trailer timestamps, which are used in
    the NTP protocol.
    
    While this information could be provided by two new socket options
    independently from timestamping, it doesn't look like they would be very
    useful. With this option any performance impact is limited to hardware
    timestamping.
    
    Use dev_get_by_napi_id() to get the device and its index. On kernels
    with disabled CONFIG_NET_RX_BUSY_POLL or drivers not using NAPI, a zero
    index will be returned in the control message.
    
    CC: Richard Cochran <richardcochran@gmail.com>
    Acked-by: default avatarWillem de Bruijn <willemb@google.com>
    Signed-off-by: default avatarMiroslav Lichvar <mlichvar@redhat.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    aad9c8c4
socket.h 2.13 KB