4 #include <sys/socket.h>
5 #include <linux/sockios.h>
6 #include <linux/net_tstamp.h>
7 #include <linux/if_packet.h>
11 #include "tstamping.h"
13 int set_sockopt_hwtimestamp(int sock
, const char *dev
)
16 struct hwtstamp_config hwconfig
;
19 if (!strncmp("any", dev
, strlen("any")))
22 memset(&hwconfig
, 0, sizeof(hwconfig
));
23 hwconfig
.tx_type
= HWTSTAMP_TX_OFF
;
24 hwconfig
.rx_filter
= HWTSTAMP_FILTER_ALL
;
26 memset(&ifr
, 0, sizeof(ifr
));
27 strlcpy(ifr
.ifr_name
, dev
, sizeof(ifr
.ifr_name
));
28 ifr
.ifr_data
= &hwconfig
;
30 ret
= ioctl(sock
, SIOCSHWTSTAMP
, &ifr
);
34 timesource
= SOF_TIMESTAMPING_RAW_HARDWARE
;
36 return setsockopt(sock
, SOL_PACKET
, PACKET_TIMESTAMP
, ×ource
,