Hi, The "cfg.rx_filter != HWTSTAMP_FILTER_ALL)) { " line catch both filter mode is "HWTS_FILTER_FULL, and the fact that the filter could is in a higher state for both HWTS_FILTER_NORMAL, HWTS_FILTER_CHECK.
Could you be more specific what does the HWTSTAMP_FILTER_SOME means? For me, the HWTSTAMP_FILTER_SOME might be good when using filter mode "HWTS_FILTER_NORMAL". But when filter mode is "HWTS_FILTER_FULL" I would accept that the flag will be HWTSTAMP_FILTER_ALL only. What would you accept on filter mode HWTS_FILTER_CHECK? Full state machine: HWTS_FILTER_CHECK get config check if RX filter one of Rx filter 1, Rx filter 2, HWTSTAMP_FILTER_ALL As HWTSTAMP_FILTER_ALL is a higher state HWTS_FILTER_NORMAL set Rx filter 1 if fail set Rx filter 2 check if RX filter one of Rx filter 1, Rx filter 2, HWTSTAMP_FILTER_ALL As HWTSTAMP_FILTER_ALL is a higher state HWTS_FILTER_FULL set Rx filter HWTSTAMP_FILTER_ALL check if RX filter one of Rx filter 1, Rx filter 2, HWTSTAMP_FILTER_ALL Filter should be HWTSTAMP_FILTER_ALL, but if NIc driver only set filter to be one of Rx filter 1, Rx filter 2 then the PTP daemon may proceed normally. Erez ________________________________________ From: Petr Machata [pe...@mellanox.com] Sent: 10 June 2019 15:56 To: linuxptp-devel@lists.sourceforge.net Subject: [Linuxptp-devel] [PATCH v2] 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, instead of rejecting it as mismatch. Signed-off-by: Petr Machata <pe...@mellanox.com> --- Notes: v2: Fix whitespace. sk.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sk.c b/sk.c index 93ba77a..416d784 100644 --- a/sk.c +++ b/sk.c @@ -105,7 +105,8 @@ static int hwts_init(int fd, const char *device, int rx_filter, if (cfg.tx_type != tx_type || (cfg.rx_filter != rx_filter && cfg.rx_filter != rx_filter2 && - cfg.rx_filter != HWTSTAMP_FILTER_ALL)) { + cfg.rx_filter != HWTSTAMP_FILTER_ALL && + cfg.rx_filter != HWTSTAMP_FILTER_SOME)) { pr_debug("tx_type %d not %d", cfg.tx_type, tx_type); pr_debug("rx_filter %d not %d or %d", cfg.rx_filter, rx_filter, rx_filter2); -- 2.20.1 _______________________________________________ Linuxptp-devel mailing list Linuxptp-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxptp-devel _______________________________________________ Linuxptp-devel mailing list Linuxptp-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxptp-devel