When the filter used by the driver is different from the requested
filter, don't print the warning if the driver reports that the requested
filter is not supported, i.e. it is expected that it will be changed to
a more general filter.

Signed-off-by: Miroslav Lichvar <mlich...@redhat.com>
---
 sk.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/sk.c b/sk.c
index 2c7593b..8a258b9 100644
--- a/sk.c
+++ b/sk.c
@@ -47,6 +47,7 @@ static int hwts_init(int fd, const char *device, int 
rx_filter, int one_step)
 {
        struct ifreq ifreq;
        struct hwtstamp_config cfg, req;
+       struct sk_ts_info ts_info;
        int err;
 
        memset(&ifreq, 0, sizeof(ifreq));
@@ -63,10 +64,16 @@ static int hwts_init(int fd, const char *device, int 
rx_filter, int one_step)
                return err;
 
        if (memcmp(&cfg, &req, sizeof(cfg))) {
-
-               pr_warning("driver changed our HWTSTAMP options");
-               pr_warning("tx_type   %d not %d", cfg.tx_type, req.tx_type);
-               pr_warning("rx_filter %d not %d", cfg.rx_filter, req.rx_filter);
+               if (cfg.tx_type != req.tx_type ||
+                   (cfg.rx_filter != req.rx_filter &&
+                    (sk_get_ts_info(device, &ts_info) ||
+                     ts_info.rx_filters & 1 << req.rx_filter))) {
+                       pr_warning("driver changed our HWTSTAMP options");
+                       pr_warning("tx_type   %d (expected %d)",
+                                  cfg.tx_type, req.tx_type);
+                       pr_warning("rx_filter %d (expected %d)",
+                                  cfg.rx_filter, req.rx_filter);
+               }
 
                if (cfg.tx_type != req.tx_type ||
                    (cfg.rx_filter != HWTSTAMP_FILTER_ALL &&
-- 
2.9.5


------------------------------------------------------------------------------
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

Reply via email to