mirror of
https://gitlab.com/chrony/chrony.git
synced 2025-12-03 16:45:07 -05:00
ntp: check supported flags before enabling HW timestamping
This commit is contained in:
@@ -103,7 +103,7 @@ add_interface(CNF_HwTsInterface *conf_iface)
|
||||
struct ethtool_ts_info ts_info;
|
||||
struct hwtstamp_config ts_config;
|
||||
struct ifreq req;
|
||||
int sock_fd, if_index, phc_fd;
|
||||
int sock_fd, if_index, phc_fd, req_hwts_flags;
|
||||
unsigned int i;
|
||||
struct Interface *iface;
|
||||
|
||||
@@ -143,6 +143,14 @@ add_interface(CNF_HwTsInterface *conf_iface)
|
||||
return 0;
|
||||
}
|
||||
|
||||
req_hwts_flags = SOF_TIMESTAMPING_RX_HARDWARE | SOF_TIMESTAMPING_TX_HARDWARE |
|
||||
SOF_TIMESTAMPING_RAW_HARDWARE;
|
||||
if ((ts_info.so_timestamping & req_hwts_flags) != req_hwts_flags) {
|
||||
DEBUG_LOG(LOGF_NtpIOLinux, "HW timestamping not supported on %s", req.ifr_name);
|
||||
close(sock_fd);
|
||||
return 0;
|
||||
}
|
||||
|
||||
ts_config.flags = 0;
|
||||
ts_config.tx_type = HWTSTAMP_TX_ON;
|
||||
ts_config.rx_filter = HWTSTAMP_FILTER_ALL;
|
||||
|
||||
Reference in New Issue
Block a user