Signed-off-by: Erez Geva <erez.geva....@siemens.com> --- sk.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/sk.c b/sk.c index f18b2bf..de8bf58 100644 --- a/sk.c +++ b/sk.c @@ -55,8 +55,17 @@ static int hwts_init(int fd, const char *device, int rx_filter, int tx_type) strncpy(ifreq.ifr_name, device, sizeof(ifreq.ifr_name) - 1); ifreq.ifr_data = (void *) &cfg; + + if (ioctl(fd, SIOCGHWTSTAMP, &ifreq) < 0) + { + pr_err("ioctl SIOCGHWTSTAMP failed: %m"); + return -1; + } + cfg.tx_type = tx_type; - cfg.rx_filter = rx_filter; + // Do not downgrade the rx filter, as it may be used by an AVB/TSN application + if (cfg.rx_filter != HWTSTAMP_FILTER_ALL) + cfg.rx_filter = rx_filter; req = cfg; err = ioctl(fd, SIOCSHWTSTAMP, &ifreq); if (err < 0) -- 2.17.1 ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ Linuxptp-devel mailing list Linuxptp-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxptp-devel