Re: [Linuxptp-users] master offset is increased in some condition
PTP IEEE 1588 stack for Linux
Brought to you by:
rcochran
From: Takahiro S. <tsh...@gm...> - 2012-03-12 08:05:34
|
Hello Richard, Yes, you are right, for 32 bit machines. > > The problem is that the PHC driver API has the max_adj in ppb, but the > NTP adjtime API has the frequency adjustment field as ppm with a 16 > bit fractional part. > > In the PHC driver API the field is four bytes (type s32), but in the > NTP adjtime API the field is either four or eight bytes (type long), > depending on the machine architecture. > > OK. I understand. > > If I chage the EG20T ptp driver, the result seems OK. > > > > static struct ptp_clock_info ptp_pch_caps = { > > .owner = THIS_MODULE, > > .name = "PCH timer", > > // .max_adj = 50000000, > > .max_adj = 32767999, // Changed the max_adj by TS. > > > > (Question) > > 1. Is my modification correct ? > > 2. Is it better to correct it in another part? > > I think we should change ptp4l to limit the max_adj according to > the driver's max_adj and sizeof(long). > > I will use the original EG20T ptp driver and modify ptp4l as follows temporarily. int phc_max_adj(clockid_t clkid) { int fd = CLOCKID_TO_FD(clkid); struct ptp_clock_caps caps; if (ioctl(fd, PTP_CLOCK_GETCAPS, &caps)) { perror("PTP_CLOCK_GETCAPS"); return 0; } if (caps.max_adj > 32767999) // TS Add here. caps.max_adj = 32767999; // TS Add here. return caps.max_adj; } Thanks, Takahiro Shimizu |