Geoff Salmon
2012-12-11 04:17:13 UTC
I've been working on implementing all of the management messages. The
recently added changes supporting getting data sets made me realize I
had better get patches ready soon or risk painful merges. While I'm
working on that, I want to tell people what I'm doing and get some
advice on how to proceed.
My code so far contains a few departures from how things are implemented
in linuxptp currently. These are the things I think might be contentious
in getting my changes merged upstream. If anything looks wrong, or
doesn't make sense, let me know.
TLV structs not packed:
Unlike the other parts of the message some TLVs are not fixed length. So
instead of casting the suffix field in a message to the TLV struct, I
add a linked list of TLV structs to each message, and those structs
contain the TLV's data. The TLV data gets written to and read from the
message buffer during msg_pre_send and msg_post_recv.
Supporting multiple TLVs and inserting/removing TLVs:
A side affect of not storing the TLVs packed in the message buffer is
it's easier to implement hooks to modify the TLVs on outgoing messages.
This will be handy for implementing different PTP profiles. For example
the Power Profile adds 2 TLVs to Announce messages.
X Macros for TLV structs, pack/unpack functions:
To implement reading and writing the TLVs, I've used a modified version
of the def files and X Macros used in ptpd. I also use a python script
to generate the functions and structs that #include the def files. It
saved a lot of time upfront, but now I'm often tempted to use 'gcc -E'
and clean up the resulting functions and structs. Do you have strong
feelings on accepting generated code or X Macros and def files into
linuxptp?
Those are the big things I think. I'll continue plugging away at what I
have and try to get patches ready.
- Geoff
recently added changes supporting getting data sets made me realize I
had better get patches ready soon or risk painful merges. While I'm
working on that, I want to tell people what I'm doing and get some
advice on how to proceed.
My code so far contains a few departures from how things are implemented
in linuxptp currently. These are the things I think might be contentious
in getting my changes merged upstream. If anything looks wrong, or
doesn't make sense, let me know.
TLV structs not packed:
Unlike the other parts of the message some TLVs are not fixed length. So
instead of casting the suffix field in a message to the TLV struct, I
add a linked list of TLV structs to each message, and those structs
contain the TLV's data. The TLV data gets written to and read from the
message buffer during msg_pre_send and msg_post_recv.
Supporting multiple TLVs and inserting/removing TLVs:
A side affect of not storing the TLVs packed in the message buffer is
it's easier to implement hooks to modify the TLVs on outgoing messages.
This will be handy for implementing different PTP profiles. For example
the Power Profile adds 2 TLVs to Announce messages.
X Macros for TLV structs, pack/unpack functions:
To implement reading and writing the TLVs, I've used a modified version
of the def files and X Macros used in ptpd. I also use a python script
to generate the functions and structs that #include the def files. It
saved a lot of time upfront, but now I'm often tempted to use 'gcc -E'
and clean up the resulting functions and structs. Do you have strong
feelings on accepting generated code or X Macros and def files into
linuxptp?
Those are the big things I think. I'll continue plugging away at what I
have and try to get patches ready.
- Geoff