Skip to content
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

Fix# 1009, Apply consistent alignment pattern #1015

Merged

Conversation

skliper
Copy link
Contributor

@skliper skliper commented Nov 13, 2020

Describe the contribution
Fix #1009
Fix #938 - since it deprecates CFE_SB_SendMsg and the new stubs are documented correctly
Partially addresses #1019 (adds CFE_SB_TransmitMsg, CFE_SB_TransmitBuffer, CFE_SB_ReceiveBuffer)

  • Main change is to utilize CFE_SB_Buffer_t and CFE_MSG_Message_t in a consistent manner to facilitate alignment
  • Deprecates CFE_SB_SendMsg, CFE_SB_PassMsg, CFE_SB_RcvMsg, CFE_SB_ZeroCopyPass, CFE_SB_ZeroCopySend
  • Deprecates CFE_SB_TlmHdr_t, CFE_SB_CmdHdr_t
  • Deprecates CFE_SB_CMD_HDR_SIZE and CFE_SB_TLM_HDR_SIZE
  • Redefines CFE_MSG_Size_t as size_t to minimize duplicated work and facilitate transition to just size_t

See also details in the individual commits.

Why is this necessary?

  • The former implementation wasn't clear on the use of CFE_SB_Msg_t vs CFE_MSG_Message_t, CFE_SB_TlmHdr_t vs CFE_MSG_TelemetryHeader_t, CFE_SB_CmdHdr_t vs CFE_SB_CommandHeader_t
  • Worst case alignment was enforce at the message level, making it impossible to use the message types in cmds/tlm without impacting the sizes of some of the cmds/tlm (they would get rounded up)
  • Still couldn't cast to a command type that contained anything that required more than 32 bit alignment

Now

  • CFE_SB_Buffer_t is aligned for up to a long double, so now for command processing cast alignment warnings are all resolved
  • Clear use of CFE_SB_Buffer_t and removal of duplicated/confusing terms
  • CFE_MSG_Message_t no longer requires any "extra" alignment and is available in the CFE_MSG_TelemetryHeader_t and CFE_MSG_CommandHeader_t structures so no cast is required to use the MSG APIs (just pass in the msg)
  • CFE_MSG_TelemetryHeader_t and CFE_MSG_CommandHeader_t can now be used in the definition of all cmd/tlm structures and avoid casts (no more uint8 header of size *_HDR_SIZE)

Testing performed
Bundle passed CI, unit tests pass.

Expected behavior changes
None, pattern change.

System(s) tested on

Additional context
#777, #998

Third party code
None

Contributor Info - All information REQUIRED for consideration of pull request
Jacob Hageman - NASA/GSFC

EDIT: Also fixed #911

@skliper skliper changed the title Fix# 1009, Apply consistent alignment pattern WIP - Fix# 1009, Apply consistent alignment pattern Nov 13, 2020
@skliper
Copy link
Contributor Author

skliper commented Nov 16, 2020

How about renaming CFE_SB_Msg_t to CFE_SB_Buffer_t (since it's really a buffer that contains a message), and SendMsg could just take the "raw" message since it does a copy (no need to union the buffer on a normal send). The only place that needs to locally handle the buffer is for zero copy, and when receiving the message (update to ES coming that does the receive more appropriately).

EDIT - There's already a buffer descriptor type...

@skliper skliper force-pushed the fix1009-alignment-pattern branch 3 times, most recently from c7bdbfe to 6a7e6c3 Compare November 16, 2020 15:45
@skliper
Copy link
Contributor Author

skliper commented Nov 16, 2020

6a7e6c3 - implements the latest strawman for ES

  • CFE_SB_SendMsg uses CFE_MSG_Message_t (apps no longer need alignment union)
  • Didn't convert MemStatsPacket or OneAppPacket to use zero copy, but these would be ideal candidates

astrogeco pushed a commit to astrogeco/cFE that referenced this pull request Nov 23, 2020
Fix nasa#777, Use MSG APIs - Core software
Fix nasa#777, Use MSG APIs - Docs
Fix nasa#777, Use MSG APIs - Unit tests

See nasa#998 for more details
astrogeco added a commit to astrogeco/cFS that referenced this pull request Nov 23, 2020
astrogeco added a commit to astrogeco/cFS that referenced this pull request Nov 23, 2020
@skliper skliper force-pushed the fix1009-alignment-pattern branch 2 times, most recently from c51f1d0 to ebcb7a2 Compare November 30, 2020 16:14
@skliper skliper changed the title WIP - Fix# 1009, Apply consistent alignment pattern Fix# 1009, Apply consistent alignment pattern Nov 30, 2020
@skliper skliper force-pushed the fix1009-alignment-pattern branch 2 times, most recently from 2ccfcb3 to 8be745f Compare November 30, 2020 17:42
@skliper skliper marked this pull request as ready for review November 30, 2020 18:12
@skliper skliper added CCB:Ready Ready for discussion at the Configuration Control Board (CCB) Priority: Mission Feature or bug related to stakeholder needs enhancement labels Nov 30, 2020
docs/src/cfe_sb.dox Outdated Show resolved Hide resolved
docs/src/cfe_sb.dox Outdated Show resolved Hide resolved
@skliper
Copy link
Contributor Author

skliper commented Dec 8, 2020

@astrogeco There's no open issues against merging this that I can tell. Let me know if I'm mistaken.

@astrogeco astrogeco changed the base branch from main to integration-candidate December 8, 2020 14:51
@astrogeco
Copy link
Contributor

@astrogeco There's no open issues against merging this that I can tell. Let me know if I'm mistaken.

Should have changed the base yesterday... We got conflicts now :/

- Documentation updates for applying the alignment pattern
- Added Cmd to all command types
- Updated example code
- Converted Syslog to SysLog for consistency
- CFE_SB_RcvMsg now CFE_SB_ReceiveBuffer
- Replaced references to deprecated CFE_SB API's with MSG API's
- CFE_MSG_Message_t no longer worst case alignment
- CFE_MSG_CommandHeader_t and CFE_MSG_TelemetryHeader_t now
  contain the base message type, CFE_MSG_Message_t
- Fixed size type issue in CFE_MSG_ComputeChecksum
- Replaced CFE_SB_TlmHdr_t and CFE_SB_CmdHdr_t with
  CFE_MSG_CommandHeader_t and CFE_MSG_TelemetryHeader_t
- Using CFE_SB_Buffer_t where appropriate
- Replaced CFE_SB_CMD_HDR_SIZE and CFE_SB_TLM_HDR_SIZE
  with sizeof the appropriate type
- Deprecated CFE_SB_SendMsg, CFE_SB_RcvMsg stubs
- Added CFE_SB_TransmitBuffer, CFE_SB_TransmitMsg, and
  CFE_SB_ReceiveBuffer stubs
- Replaced CFE_SB_SendMsg and CFE_SB_PassMsg with CFE_SB_TransmitMsg
- Replaced CFE_SB_ZeroCopySend and CFE_SB_ZeroCopyPass with
  CFE_SB_TransmitBuffer
- Replaced CFE_SB_RcvMsg with CFE_SB_ReceiveBuffer
- Used CFE_SB_Buffer_t and CFE_MSG_Message_t where appropriate
- Added Cmd to all command types
- Changed Syslog to SysLog for consistency
- Removed "see also" blocks in documentation, APIs are already grouped
  and these typically don't add anything useful (simplifies maintenance)
- Added CFE_SB_TransmitMsg, CFE_SB_TransmitBuffer,
  CFE_SB_ReceiveBuffer (partial nasa#1019 fix)
- Replace CFE_SB_RcvMsg with CFE_SB_ReceiveBuffer
- Deprecated CFE_SB_SendMsg, CFE_SB_PassMsg, CFE_SB_RcvMsg
  CFE_SB_ZeroCopyPass, CFE_SB_ZeroCopySend
- Use CFE_SB_Buffer_t for receiving and casting to command types
- Use CFE_MSG_CommandHeader_t and CFE_MSG_TelemetryHeader_t in
  command and telemetry type definitions
- Use CFE_SB_TransmitMsg to copy the command and telemetry
  into a CFE_SB_Buffer_t and send it where needed
- Avoids need to create send buffers within the app (or union
  the packet types with CFE_SB_Buffer_t)
- Eliminates references to CFE_SB_CmdHdr_t and CFE_SB_TlmHdr_t
  that formerly enforced alignment since these had potential
  to change the actual packet sizes
- No need to cast to CFE_MSG_Message_t anywhere since it's
  available in the CFE_SB_Buffer_t union
- CFE_MSG_Size_t redefined as size_t to simplify future
  transition
- Replaced Syslog with SysLog for consistency
- Added Cmd to all command typedefs
- Replaced CFE_SB_CMD_HDR_SIZE and CFE_SB_TLM_HDR_SIZE
  with sizeof the appropriate type
@skliper
Copy link
Contributor Author

skliper commented Dec 8, 2020

@astrogeco fixed conflict.

@astrogeco astrogeco merged commit d1ea3c4 into nasa:integration-candidate Dec 8, 2020
astrogeco added a commit to nasa/cFS that referenced this pull request Dec 8, 2020
astrogeco added a commit to nasa/cFS that referenced this pull request Dec 9, 2020
@skliper skliper linked an issue Jan 11, 2021 that may be closed by this pull request
@skliper skliper linked an issue Jan 15, 2021 that may be closed by this pull request
@skliper skliper deleted the fix1009-alignment-pattern branch February 1, 2021 22:05
@skliper skliper added this to the 7.0.0 milestone Sep 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Priority: Mission Feature or bug related to stakeholder needs
Projects
None yet
4 participants