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.keller@intel.com>
Cc: "Geva, Erez" <erez.geva.ext@siemens.com>
Signed-off-by: Petr Machata <petrm@mellanox.com>
master
Petr Machata 2019-06-11 16:35:09 +00:00 committed by Richard Cochran
parent 40e5868e66
commit ba3705a0f0
1 changed files with 5 additions and 2 deletions

7
sk.c
View File

@ -61,6 +61,7 @@ static int hwts_init(int fd, const char *device, int rx_filter,
{ {
struct ifreq ifreq; struct ifreq ifreq;
struct hwtstamp_config cfg; struct hwtstamp_config cfg;
int orig_rx_filter;
int err; int err;
init_ifreq(&ifreq, &cfg, device); init_ifreq(&ifreq, &cfg, device);
@ -84,14 +85,14 @@ static int hwts_init(int fd, const char *device, int rx_filter,
break; break;
case HWTS_FILTER_NORMAL: case HWTS_FILTER_NORMAL:
cfg.tx_type = tx_type; cfg.tx_type = tx_type;
cfg.rx_filter = rx_filter; cfg.rx_filter = orig_rx_filter = rx_filter;
err = ioctl(fd, SIOCSHWTSTAMP, &ifreq); err = ioctl(fd, SIOCSHWTSTAMP, &ifreq);
if (err < 0) { if (err < 0) {
pr_info("driver rejected most general HWTSTAMP filter"); pr_info("driver rejected most general HWTSTAMP filter");
init_ifreq(&ifreq, &cfg, device); init_ifreq(&ifreq, &cfg, device);
cfg.tx_type = tx_type; cfg.tx_type = tx_type;
cfg.rx_filter = rx_filter2; cfg.rx_filter = orig_rx_filter = rx_filter2;
err = ioctl(fd, SIOCSHWTSTAMP, &ifreq); err = ioctl(fd, SIOCSHWTSTAMP, &ifreq);
if (err < 0) { if (err < 0) {
@ -99,6 +100,8 @@ static int hwts_init(int fd, const char *device, int rx_filter,
return err; return err;
} }
} }
if (cfg.rx_filter == HWTSTAMP_FILTER_SOME)
cfg.rx_filter = orig_rx_filter;
break; break;
} }