On Tue, May 2, 2023 at 10:56 PM Martin Pecka <pecka...@fel.cvut.cz> wrote: > > Fixes issue "Bug caused by commit afeabf3 "ptp4l: add VLAN over bond support" > on kernel 4.9" reported on linuxptp-devel. > > SIOCGHWTSTAMP ioctl is optional according to Linux timestamping.txt document, > but the code failed to set any HW timestamping when the ioctl was actually > not supported. For now, VLAN over bond support requires that the driver > supports SIOCGHWTSTAMP ioctl (but this limitation can be removed in the > future). > > Signed-off-by: Martin Pecka <pecka...@fel.cvut.cz>
Acked-by: Hangbin Liu <liuhang...@gmail.com> > --- > sk.c | 17 ++++++++++++++--- > 1 file changed, 14 insertions(+), 3 deletions(-) > > diff --git a/sk.c b/sk.c > index 6a9e5b8..a72aca3 100644 > --- a/sk.c > +++ b/sk.c > @@ -66,10 +66,21 @@ static int hwts_init(int fd, const char *device, int > rx_filter, > > init_ifreq(&ifreq, &cfg, device); > > + /* Test if VLAN over bond is supported. */ > cfg.flags = HWTSTAMP_FLAG_BONDED_PHC_INDEX; > - /* Fall back without flag if user run new build on old kernel */ > - if (ioctl(fd, SIOCGHWTSTAMP, &ifreq) == -EINVAL) > - init_ifreq(&ifreq, &cfg, device); > + err = ioctl(fd, SIOCGHWTSTAMP, &ifreq); > + if (err < 0) { > + /* > + * Fall back without flag if user runs new build on old kernel > + * or if driver does not support SIOCGHWTSTAMP ioctl. > + */ > + if (errno == EINVAL || errno == EOPNOTSUPP) { > + init_ifreq(&ifreq, &cfg, device); > + } else { > + pr_err("ioctl SIOCGHWTSTAMP failed: %m"); > + return err; > + } > + } > > switch (sk_hwts_filter_mode) { > case HWTS_FILTER_CHECK: > -- > 2.17.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