pdu: Allow PDU to Tagged Stream to write partial PDUs #7028
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.
Description
The
tagged_stream_block
class is a wrapper to help make Tagged Stream blocks. Unfortunately, it causes problems for the scheduler by refusing to produce any output unless the input and output buffers are long enough to contain an entire PDU:gnuradio/gnuradio-runtime/lib/tagged_stream_block.cc
Lines 107 to 109 in 4d3eb9f
gnuradio/gnuradio-runtime/lib/tagged_stream_block.cc
Lines 112 to 116 in 4d3eb9f
If the scheduler observes that a block refuses to produce output and all of its upstream blocks are finished (i.e. won't produce any more output), then it concludes that the block is finished and terminates its worker thread.
For the PDU to Tagged Stream block in particular, this is problematic because the scheduler can terminate it while it still has PDUs waiting in its input queue. This causes test failures in the
qa_fecapi_*
tests, as noted in #6628. Failures can readily be reproduced by increasingrep
to 7 in this test:gnuradio/gr-fec/python/fec/qa_fecapi_repetition.py
Line 161 in 4d3eb9f
Prior to #323, the PDU to Tagged Stream block did not have this problematic behaviour; if it had PDUs in its input queue, it would always produce output. If there wasn't enough room to write out a full PDU, it would store the rest for later. Here I've rewritten the block to behave as it did before.
Related Issue
Fixes #6628.
Reverts #323.
Which blocks/areas does this affect?
Testing Done
I verified that all tests that use the PDU to Tagged Stream block still pass, and that the
qa_fecapi_repetition
test passes even ifrep
orframe_size
are increased.Checklist
I have updated the documentation where necessary.I have added tests to cover my changes, and all previous tests pass.