-
Notifications
You must be signed in to change notification settings - Fork 500
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue #222: v1 platform layer #223
Issue #222: v1 platform layer #223
Conversation
Interim PR here but I wanted to get this through review before it got too big. Things of interest: 1. Coverage build logic is complete. 2. Better definition around the LVS (Libuavcan Validation Suite) 3. Start of the "media" layer for CAN. 4. More sadness that it isn't five years from now and we could just use C++14.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some of my comments are not meant for fixing in this PR but should be looked at eventually (in the near future perhaps?). For example, my notes about dropping support for standard frames and branch annotations.
Just to make sure I recall our earlier discussions properly: we're not going to implement any toString()
methods or streaming <<
operators, right? Because I don't think they were needed in the first place and discarding them is actually a good thing.
Co-Authored-By: Pavel Kirienko <[email protected]>
Correct. |
Co-Authored-By: Pavel Kirienko <[email protected]>
So as I work on finishing this PR I begin to wonder about this picture: Here is the journey of a CAN frame up to the transport layer. What we see is we've incurred two copies into and then across system memory before the application gets the data. This seems sub-optimal. Perhaps |
What I learned recently by reading a mildly related FAA publication is that contrary to my expectations, zero-copy stacks are not considered unsafe or otherwise undesirable:
So we should definitely explore this design option. Frankly I don't yet know how to approach this in our hard real-time setting. My PyUAVCAN rewrite is zero-copy, but that is trivial to implement because I can use the free store as much as I want. In libuavcan, we may need to coordinate data allocation and deallocation with the driver, which may be tricky. |
Co-Authored-By: Pavel Kirienko <[email protected]>
I'm becoming convinced that this will be a significant improvement to the library but I don't think we are ready to build this just yet. I'm going to open a task to revisit this once I have NXP's driver since I can look at my MCAN driver for Atmel and compare it to the NXP Flex-CAN implementation and finally consider socketCAN to come up with a design that will be relevant and portable. Not only will this improve performance for microcontrollers but it may actually simplify implementing libuavcan for them. My assumption is that, by defining how to coordinate DMA access, we'll provide a stronger media layer contract that will make it obvious how to port it to a given peripheral. But we'll see if I'm right sometime after this review is posted. For now I'm providing careful guidance on and visibility into the library's use of CPU for moving things though system memory. (Perhaps this will become a menu of options for porting the media layer where linux wants to use what we have here and microcontrollers want something else?) |
6788b94
to
e77f2b6
Compare
90cf618
to
95cfb5c
Compare
Is there anything blocking your signoff on this PR now @pavel-kirienko ? |
I am working on Libcanard atm and I felt like going back to this discussion and mentioning that this part is trivially resolvable if there is an O(1) memory allocator available:
The library can allocate a buffer using the constant-complexity deterministic free store, and then pass the buffer up and down the protocol stack as needed without copying. Such free store can be accessed from an interrupt context as well, although I don't immediately see how that can be practical yet. This is also compatible with the FAA considerations about aviation databuses. Stand by for my Libcanard PR. |
Interim PR here but I wanted to get this through review before it got
too big. Things of interest:
C++14.