On Fri, Jul 17, 2020 at 07:24:46PM -0700, Richard Cochran wrote: > On Fri, Jul 17, 2020 at 09:54:07AM +0200, Kurt Kanzenbach wrote: > > I'll post the next version of the hellcreek DSA driver probably next > > week. I can include a generic ptp_header() function if you like in that > > patch series. But, where to put it? ptp core or maybe ptp_classify? > > Either place is fine with me. Maybe it makes most sense in ptp_classify? > Please put the re-factoring in a separate patches, before the new > driver.
And maybe the new header parsing routine should provide a pointer to a structure with the message layout. Something similar to this (from the linuxptp user stack) might work. struct ptp_header { uint8_t tsmt; /* transportSpecific | messageType */ uint8_t ver; /* reserved | versionPTP */ UInteger16 messageLength; UInteger8 domainNumber; Octet reserved1; Octet flagField[2]; Integer64 correction; UInteger32 reserved2; struct PortIdentity sourcePortIdentity; UInteger16 sequenceId; UInteger8 control; Integer8 logMessageInterval; } PACKED; Of course, the structure should use the kernel types that include the big endian annotations. Thanks, Richard