Skip to content

Fix #535, keep the leading-edge chunk when the chunk list is full - #536

Open
SpaceOceanCorp wants to merge 1 commit into
nasa:devfrom
SpaceOceanCorp:fix-535-keep-leading-edge
Open

SpaceOceanCorp wants to merge 1 commit into
nasa:devfrom
SpaceOceanCorp:fix-535-keep-leading-edge

Conversation

@SpaceOceanCorp

Copy link
Copy Markdown

Description of Change

CF_Chunks_Insert now keeps a chunk that lies past every tracked chunk when the list is full, evicting the smallest tracked chunk. Previously such a chunk was kept only if it was larger than the smallest one. The first PDU after each new gap is a single PDU, so it and every later contiguous PDU went untracked and were NAKed again. A chunk inside the tracked range keeps the existing rule. One condition in fsw/src/cf_chunk.c, plus a comment.

Linked Issue

Closes #535

Requirements Impact

  • Requirement ID(s): none changed
  • Requirements updated as necessary
  • Existing requirements are still satisfied by this change

Testing Evidence

Unit Tests (UT Assert)

New Test_CF_Chunk_AddFullKeepsLeadingEdge in unit-test/cf_chunk_tests.c: a small chunk inside the tracked range is still dropped; a small chunk past every tracked chunk replaces the smallest; contiguous data then extends it. Run locally against cf_chunk.c with ASan and UBSan: 140 assertions pass with the change. The new test fails without it (6 assertions), and the existing chunk tests pass both ways. In the cFS bundle (029b3ab, native_std, unit tests enabled) with this branch, CF builds with no warnings and all 14 CF unit-test suites pass.

Simulation and fuzz results are in #535: at 5% loss with the default list, PDUs sent fall from 9,827 to 6,520 and NAK rounds from 8 to 4; 5.8 million random adds show no unreceived byte is ever tracked.

Live run against the cFS bundle

core-cpu1 from the bundle at 029b3ab (CF at dev 0dbc2b7, default tables), with this one condition applied or not. An independent CFDP sender (cfdp-py 0.7.0) uploads a 1 MB file in Class 2 through CI_LAB, as 2,084 file-data PDUs of 480 bytes at 20 PDUs/s, and receives CF's replies through TO_LAB. Every PDU in both directions is dropped with the given probability (seeded). In all 10 runs the received file's SHA-256 matches, the measured loss is within 0.7 percentage points of the target, and there are no Software Bus Msg Limit Err events on CF's input pipe.

Loss Seed File-data PDUs sent, before → after NAK PDUs received, before → after Transfer time (s), before → after
0% 1 2,084 → 2,084 0 → 0 111 → 111
5% 1 3,098 → 2,549 4 → 4 163 → 140
5% 2 3,039 → 2,416 3 → 3 158 → 129
5% 3 2,949 → 2,381 4 → 2 161 → 124
10% 1 4,783 → 3,371 8 → 5 245 → 171

At 5% loss the change removes 17.7 to 20.5% of the file-data PDUs, and at 10% loss 29.5%.

COSMOS Test Suite

N/A: no telemetry, command or table changes.

Areas of Expertise Touched

  • Unit Tests
  • Other: CFDP receive

Author Checklist

  • Linked GitHub issue is referenced above
  • Code has been formatted with .clang-format (cFS dev, clang-format 19.1.7)
  • Static analysis workflows ran and passed
  • Unit tests (UT Assert) updated/added to cover code changes
  • Unit test workflows ran and passed
  • COSMOS test suite was run; tests updated/added if relevant changes were made
  • Requirements have been reviewed; updated or confirmed still satisfied (see above)
  • Testing evidence is included above
  • Self-review of the diff completed

CLA: cFS Apps corporate CLA filed by Space Ocean Corp.

A full chunk list dropped a new chunk unless it was larger than the
smallest tracked chunk. The first PDU after each new gap is a single PDU,
so it and every later contiguous PDU went untracked and were NAKed again.
Keep a chunk that lies past every tracked chunk, evicting the smallest.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CF_Chunks_Insert drops all data after the chunk list fills, so a lossy Class 2 upload is mostly resent

1 participant