4 #include <sys/socket.h>
5 #include <linux/sockios.h>
6 #include <linux/net_tstamp.h>
7 #include <linux/net_tstamp.h>
8 #include <linux/if_packet.h>
12 #include "tstamping.h"
14 #ifdef __WITH_HARDWARE_TIMESTAMPING
15 int set_sockopt_hwtimestamp(int sock
, const char *dev
)
18 struct hwtstamp_config hwconfig
;
21 if (!strncmp("any", dev
, strlen("any")))
24 memset(&hwconfig
, 0, sizeof(hwconfig
));
25 hwconfig
.tx_type
= HWTSTAMP_TX_OFF
;
26 hwconfig
.rx_filter
= HWTSTAMP_FILTER_ALL
;
28 memset(&ifr
, 0, sizeof(ifr
));
29 strlcpy(ifr
.ifr_name
, dev
, sizeof(ifr
.ifr_name
));
30 ifr
.ifr_data
= &hwconfig
;
32 ret
= ioctl(sock
, SIOCSHWTSTAMP
, &ifr
);
36 timesource
= SOF_TIMESTAMPING_RAW_HARDWARE
;
38 return setsockopt(sock
, SOL_PACKET
, PACKET_TIMESTAMP
, ×ource
,
42 int set_sockopt_hwtimestamp(int sock
, const char *dev
)