> -----Original Message-----
> From: Petr Machata [mailto:pe...@mellanox.com]
> Sent: Monday, June 10, 2019 7:09 AM
> To: linuxptp-devel@lists.sourceforge.net
> Subject: [Linuxptp-devel] [PATCH] 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>
> ---
>  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);

You can't accept HWTSTAMP_FILTER_SOME from the "get hwtstamp config" ioctl, 
because it's unclear what packets "SOME" actually refers to. I.e. one caller 
could set it to filter V1 packets, the driver could report SOME, and then ptp4l 
could "accept" this filter even though it's not valid.

You can accept it in response to the "set hwtstamp config", I suppose, but it 
is a tad confusing. I never really liked that return value, and just wish the 
API had been "you may timestamp more than requested without reporting it if 
there is no valid filter matching what you timestamp".

Thanks,
Jake
 


_______________________________________________
Linuxptp-devel mailing list
Linuxptp-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxptp-devel

Reply via email to