You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Remove unnecessary buffer allocation/copy in FprimeRouter for file and unknown packets
Instead of allocating a new buffer and copying data for file and unknown
packet types, pass the original buffer directly to the receiver. The
buffer is not returned to the deframer via dataReturnOut until it comes
back on fileBufferReturnIn, at which point an empty context is
constructed for the return.
This eliminates the need for bufferAllocate and bufferDeallocate ports,
as well as the AllocationReason enum and AllocationError event.
Co-Authored-By: michael.d.starch <michael.d.starch@jpl.nasa.gov>
* Remove dangling fprimeRouter buffer allocation connections from subtopologies
Co-Authored-By: michael.d.starch <michael.d.starch@jpl.nasa.gov>
* Move dataReturnOut into each switch case instead of using early returns
Co-Authored-By: michael.d.starch <michael.d.starch@jpl.nasa.gov>
* Fix formatting: remove extra blank line
Co-Authored-By: michael.d.starch <michael.d.starch@jpl.nasa.gov>
* Update Svc/FprimeRouter/docs/sdd.md
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Address review: empty context on all return paths, clarify buffer return contract, document context discard
Co-Authored-By: michael.d.starch <michael.d.starch@jpl.nasa.gov>
* Clarify SDD: receivers must return buffers via fileBufferReturnIn
Co-Authored-By: michael.d.starch <michael.d.starch@jpl.nasa.gov>
---------
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
The `Svc::FprimeRouter` component supports `Fw::ComPacketType::FW_PACKET_COMMAND` and `Fw::ComPacketType::FW_PACKET_FILE` packet types. Unknown packet types are forwarded on the `unknownDataOut` port, which a project-specific component can connect to for custom routing.
8
8
9
-
About memory management, all buffers sent by `Svc::FprimeRouter` on the `fileOut` and `unknownDataOut` ports are expected to be returned to the router through the `fileBufferReturnIn` port for deallocation.
9
+
About memory management, buffers sent by `Svc::FprimeRouter` on the `fileOut` and `unknownDataOut` ports are passed through directly without copying. Receivers of these buffers **must** return them to `Svc::FprimeRouter` through the `fileBufferReturnIn` port when finished processing. The original buffer is not returned to the deframer until this happens.
10
+
11
+
**Note:** The `FrameContext` received on `dataIn` is not preserved across the buffer return path. When buffers are returned via `fileBufferReturnIn`, `Svc::FprimeRouter` constructs an empty `ComCfg::FrameContext` for the `dataReturnOut` call. This applies to all packet types — the context is always discarded on return.
10
12
11
13
## Custom Routing
12
14
13
-
The `Svc::FprimeRouter` component is designed to be extensible through the use of a project-specific router. The `unknownDataOut` port can be connected to a project-specific component that can receive all unknown packet types. This component can then implement custom handling of these unknown packets. After processing, the project-specific component shall return the received buffer to the `Svc::FprimeRouter` component through the `fileBufferReturnIn` port (named this way as it only receives file packets in the common use-case), which will deallocate the buffer.
15
+
The `Svc::FprimeRouter` component is designed to be extensible through the use of a project-specific router. The `unknownDataOut` port can be connected to a project-specific component that can receive all unknown packet types. This component can then implement custom handling of these unknown packets. After processing, the project-specific component shall return the received buffer to the `Svc::FprimeRouter` component through the `fileBufferReturnIn` port (named this way as it only receives file packets in the common use-case), which will return the buffer to the deframer.
14
16
15
17
## Usage Examples
16
18
@@ -32,8 +34,6 @@ In the canonical uplink communications stack, `Svc::FprimeRouter` is connected t
32
34
|`output`|`fileOut`|`Fw.BufferSend`| Port for sending file packets as Fw::Buffer (ownership passed to receiver) |
33
35
|`sync input`|`fileBufferReturnIn`|`Fw.BufferSend`| Receiving back ownership of buffer sent on `fileOut` and `unknownDataOut`|
34
36
|`output`|`unknownDataOut`|`Svc.ComDataWithContext`| Port forwarding unknown data (useful for adding custom routing rules with a project-defined router) |
35
-
|`output`|`bufferAllocate`|`Fw.BufferGet`| Port for allocating buffers, allowing copy of received data |
36
-
|`output`|`bufferDeallocate`|`Fw.BufferSend`| Port for deallocating buffers |
37
37
38
38
## Requirements
39
39
@@ -44,5 +44,5 @@ SVC-ROUTER-002 | `Svc::FprimeRouter` shall route packets of type `Fw::ComPacketT
44
44
SVC-ROUTER-003 | `Svc::FprimeRouter` shall route packets of type `Fw::ComPacketType::FW_PACKET_FILE` to the `fileOut` output port. | Routing file packets | Unit test |
45
45
SVC-ROUTER-004 | `Svc::FprimeRouter` shall route data that is neither `Fw::ComPacketType::FW_PACKET_COMMAND` nor `Fw::ComPacketType::FW_PACKET_FILE` to the `unknownDataOut` output port. | Allows for projects to provide custom routing for additional (project-specific) uplink data types | Unit test |
46
46
SVC-ROUTER-005 | `Svc::FprimeRouter` shall emit warning events if serialization errors occur during processing of incoming packets | Aid in diagnosing uplink issues | Unit test |
47
-
SVC-ROUTER-005 | `Svc::FprimeRouter` shall make a copy of buffers that represent a `FW_PACKET_FILE` | Aid in memory management of file buffers | Unit test |
48
-
SVC-ROUTER-005 | `Svc::FprimeRouter` shall return ownership of all buffers received on `dataIn` through `dataReturnOut` | Memory management | Unit test |
47
+
SVC-ROUTER-006 | `Svc::FprimeRouter` shall pass through buffers for `FW_PACKET_FILE` and unknown packet types without copying, and defer returning them to the deframer until they are returned via `fileBufferReturnIn` | Efficient memory management | Unit test |
48
+
SVC-ROUTER-007 | `Svc::FprimeRouter` shall return ownership of all buffers received on `dataIn` through `dataReturnOut` | Memory management | Unit test |
0 commit comments