• S
    sock: accept SO_TIMESTAMPING flags in socket cmsg · 3dd17e63
    Soheil Hassas Yeganeh 提交于
    Accept SO_TIMESTAMPING in control messages of the SOL_SOCKET level
    as a basis to accept timestamping requests per write.
    
    This implementation only accepts TX recording flags (i.e.,
    SOF_TIMESTAMPING_TX_HARDWARE, SOF_TIMESTAMPING_TX_SOFTWARE,
    SOF_TIMESTAMPING_TX_SCHED, and SOF_TIMESTAMPING_TX_ACK) in
    control messages. Users need to set reporting flags (e.g.,
    SOF_TIMESTAMPING_OPT_ID) per socket via socket options.
    
    This commit adds a tsflags field in sockcm_cookie which is
    set in __sock_cmsg_send. It only override the SOF_TIMESTAMPING_TX_*
    bits in sockcm_cookie.tsflags allowing the control message
    to override the recording behavior per write, yet maintaining
    the value of other flags.
    
    This patch implements validating the control message and setting
    tsflags in struct sockcm_cookie. Next commits in this series will
    actually implement timestamping per write for different protocols.
    Signed-off-by: NSoheil Hassas Yeganeh <soheil@google.com>
    Acked-by: NWillem de Bruijn <willemb@google.com>
    Signed-off-by: NDavid S. Miller <davem@davemloft.net>
    3dd17e63
sock.c 74.3 KB