Fix #1020, refactor SB buffer descriptor object #1154
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Describe the contribution
Refactor the SB buffer descriptor object (
CFE_SB_BufferD_t
) and simplify the zero-copy buffer paradigm.Combine the zero-copy and the normal CFE buffer descriptor into a single unified CFE_SB_BufferD_t object. This cleans up a bunch of extra logic related to zero-copy buffers, including the extra descriptor object. The result is a simpler zero-copy design that is much less different from the standard (non-zero-copy) message path.
All message descriptor objects are now tracked in a list by SB, not just the zero-copy descriptors (for consistency - if any buffers need to be tracked, they should all be tracked).
This notably puts the buffer content as a member within the descriptor, rather than a calculated pointer, so it will be aligned properly.
Fixes #1020
Testing performed
Build and run all unit tests
Sanity check CFE
Expected behavior changes
All changes are internal to SB. This does not affect API or behavior of any existing APIs (but see note)
It also ensures that zero-copy buffers (and the associated CFE_SB_TransmitBuffer API) behave as similarly as possible to the normal CFE_SB_TransmitMsg API. Notably this corrects a minor issue where the MsgSendErrorCounter would get incremented if there were no subscribers, but only in the zero copy API.
System(s) tested on
Ubuntu 20.04
Additional context
This does not change public API in any way. However now there is no extra descriptor for the "zero copy" buffers - they are all just buffer descriptors, regardless of whether they were allocated on the fly or pre-allocated by the application.
This means that the
CFE_SB_ZeroCopyHandle_t
value that is output fromCFE_SB_ZeroCopyGetPtr()
and others is now largely redundant. It is equal to the buffer descriptor address, but it can be easily determined from the buffer content pointer too, so it is really not necessary to pass around two values for zero copy buffers. This can be simplified in a future change - but that will change the public API.Contributor Info - All information REQUIRED for consideration of pull request
Joseph Hickey, Vantage Systems, Inc.