Great patch Good work :-)
________________________________________ From: Petr Machata [pe...@mellanox.com] Sent: 11 June 2019 18:35 To: linuxptp-devel@lists.sourceforge.net Cc: Petr Machata; Keller, Jacob E; Geva, Erez (ext) (DI PA CI R&D 3) Subject: [PATCH v4] sk: Recognize HWTSTAMP_FILTER_SOME struct hwtstamp_config.rx_filter passed to SIOCSHWTSTAMP can be updated by the kernel with the value of HWTSTAMP_FILTER_SOME. That indicates that all requested packets will be timestamped, and some others as well. Update hwts_init() to recognize this as a valid response in HWTS_FILTER_NORMAL mode, instead of rejecting it as mismatch. Cc: "Keller, Jacob E" <jacob.e.kel...@intel.com> Cc: "Geva, Erez" <erez.geva....@siemens.com> Signed-off-by: Petr Machata <pe...@mellanox.com> --- Notes: v4: - Do not permit HWTSTAMP_FILTER_SOME for HWTS_FILTER_FULL either. v3: - Do not permit HWTSTAMP_FILTER_SOME for SIOCGHWTSTAMP. v2: - Fix whitespace. sk.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sk.c b/sk.c index 93ba77a..e211175 100644 --- a/sk.c +++ b/sk.c @@ -61,6 +61,7 @@ static int hwts_init(int fd, const char *device, int rx_filter, { struct ifreq ifreq; struct hwtstamp_config cfg; + int orig_rx_filter; int err; init_ifreq(&ifreq, &cfg, device); @@ -84,14 +85,14 @@ static int hwts_init(int fd, const char *device, int rx_filter, break; case HWTS_FILTER_NORMAL: cfg.tx_type = tx_type; - cfg.rx_filter = rx_filter; + cfg.rx_filter = orig_rx_filter = rx_filter; err = ioctl(fd, SIOCSHWTSTAMP, &ifreq); if (err < 0) { pr_info("driver rejected most general HWTSTAMP filter"); init_ifreq(&ifreq, &cfg, device); cfg.tx_type = tx_type; - cfg.rx_filter = rx_filter2; + cfg.rx_filter = orig_rx_filter = rx_filter2; err = ioctl(fd, SIOCSHWTSTAMP, &ifreq); if (err < 0) { @@ -99,6 +100,8 @@ static int hwts_init(int fd, const char *device, int rx_filter, return err; } } + if (cfg.rx_filter == HWTSTAMP_FILTER_SOME) + cfg.rx_filter = orig_rx_filter; break; } -- 2.20.1 _______________________________________________ Linuxptp-devel mailing list Linuxptp-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxptp-devel