Repository navigation
Apply a dApp's PRB block in the gNB's scheduler - #17
Merged
Merged
Conversation
Two problems in how the SM types were generated, both hidden so far: - asn1c generated BER and JER code for our types, while libe3's runtime is built without them. asn_config.h sets the layout of the type tables from that codec set, so our tables could be laid out differently from the runtime they link against. Generate with -no-gen-OER -no-gen-BER -no-gen-JER, like libe3. - cleanup_asn1c.cmake runs with -P, where CMAKE_BINARY_DIR is the working directory (<build>/src/e3sm/asn), not the build root. It looked for a directory that does not exist and returned, so the whole asn1c runtime stayed next to our types, asn_config.h included, and could shadow libe3's. The directory is now passed in, and a missing one is an error. Assisted-by: Claude Opus 5.5 <noreply@anthropic.com>
The dApp, the controller and the xApp all encode Spectrum types, and the
xApp decodes the dApp's reports with OAI's grammar. Ours was an older one.
e3sm_spectrum.asn is now the copy in wineslab/spear-flexric
(src/sm/dapp_sm/e3/service_models/spectrum_sm/asn/defs/e3sm_spectrum.asn),
unchanged, plus a marked section at the end with Spectrum-IQDataIndication,
which only the legacy eCPRI IQ path uses. Its bytes do not change.
- RAN function data goes out in the agent's encoding: APER, or in JSON
the same fields as an object, as OAI's Spectrum SM sends it.
- A dApp control is Spectrum-DAppControlData in APER, or OAI's JSON
envelope ({"controlType":"prbBlacklist","controlPayload":{...}}).
Only control id 1 (PRB blacklist) is accepted; the other ids and payloads
get a NACK. The blacklist is still only logged and acknowledged.
- Spectrum-SensingPolicyControl has a BOOLEAN and libe3 ships no BOOLEAN
runtime, so asn1c's is compiled with libe3's codec set, only while
libe3 has none.
- tests/test_spectrum_sm.cpp (E3C_BUILD_TESTS=ON): the legacy IQ
indication against bytes from the previous grammar, APER controls
against vectors encoded by hand, and the JSON controls the dApp builds.
Assisted-by: Claude Opus 5.5 <noreply@anthropic.com>
A spectrum-sharing dApp sends a Spectrum SM PRB blacklist control (RAN function 1, control 1) with the PRBs where it detected an incumbent. OAI's gNB keeps every data allocation off them, in every slot, UL and DL, until the next control replaces the list. The controller only logged and acknowledged it. With prb_block.enabled it now reaches ocudu's scheduler, so the same dApp works with both gNBs. - e3sm_spectrum.asn is OAI's current grammar (c2fc976521). It adds Spectrum-CellConfigIndication and two dApp control alternatives; the PRB blacklist control is unchanged and the legacy Spectrum-IQDataIndication section stays. Only control 1 is applied, the others still get a NACK. - The first RAN function 1 subscription loads the prb_block codelet on ocudu's sched_prb_block hook, instead of the eCPRI IQ pipeline; the last one unloads it, which clears the block. A PRB index outside the radio's carrier, a full queue or a missing codelet is a NACK. - PrbBlockRelay hands the newest queued block to the codelet from the main loop and ACKs it, superseded ones too, once it is in the gNB, as OAI ACKs on install. The codelet reports the first scheduler slot that applies each block. - jbpf_e3_prb_block_api.h is a new shared header, byte-identical with ocudu's copy. - Stage records for the closed loop, from the gNB's capture of the slot the dApp decided on to the scheduler slot that applies the block, with OAI's stage names; tools/latrec_closed_loop.py joins the controller's and the dApp's rings. - prb_block.enabled defaults to false, which keeps today's behaviour. Assisted-by: Claude Opus 5.5 <noreply@anthropic.com>
aferaudo
force-pushed
the
feat/prb-block
branch
from
November 9, 2026 19:41
5d86247 to
e61d7fd
Compare
This was referenced Nov 9, 2026
Describe what this code does rather than what another gNB does. Where a comparison carried information, keep the information: the ACK means the block is in the RAN, and a block lasts until the next one replaces it. Spell out the JSON form of the dApp control instead of calling it an envelope. jbpf_e3_prb_block_api.h is shared with ocudu, which changes its copy the same way: the two copies must stay byte-identical. Assisted-by: Claude Opus 5.5 <noreply@anthropic.com>
ocudu sends a Msg3 retransmission on the RBs of the first transmission whenever no other channel uses them, so a block that starts in between does not move it. Assisted-by: Claude Opus 5.5 <noreply@anthropic.com>
libe3 0.2.5 deletes every SM inside agent.stop(), but main() still used two of them afterwards: spectrum_ptr->stop(), so every Ctrl-C ended in a segfault, and layer1_ptr->drops_summary(), a read of freed memory. Stop the slot pipeline first, take the summary, then stop the agent; the prb_block codelet is unloaded through main's own relay, which outlives the SM. With slot_filter.ue_free_only every UL slot a UE transmits in is a ue_busy drop, so the per-second drop line printed for as long as a UE was attached. The counters stay: the shutdown summary prints them by reason, and logging.drops_log_path still writes one CSV row per second. Fixes #19. Assisted-by: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
prb_block.enabled, off by default): a dApp's Spectrum SM PRB blacklist control (RAN function 1, control 1) now reaches ocudu's scheduler. The scheduler keeps every PDSCH and PUSCH allocation off those PRBs, in every slot, DL and UL, until the next control replaces the list, as OAI's gNB does, so the same dApp works with both gNBs. PUCCH, PDCCH, SSB, PRACH, SRS and CSI-RS keep their PRBs (docs/known-limitations.md).prb_blockcodelet on ocudu'ssched_prb_blockhook, instead of the eCPRI IQ pipeline; the last one unloads it, which clears the block.PrbBlockRelayhands the newest block to the gNB from the main loop and ACKs it then, as OAI ACKs on install; the codelet reports the first scheduler slot that applies it. A PRB outside the carrier, a full queue or no codelet is a NACK.e3sm_spectrum.asn(c2fc976521), plus the legacySpectrum-IQDataIndicationsection, whose bytes do not change. Includes Send dApp reports to the xApps through the gNB's E2SM-DAPP #14's two Spectrum commits, now the same commits in both PRs (9ec5cae, b1ba0e9): whichever PR merges second only replays its own.tools/latrec_closed_loop.py, which joins the controller's and the dApp's rings (docs/stage-records.md).mainon 2026-11-09, after Publish only the uplink slots no UE transmits in, on the L1-KPM v2 grammar #16 merged. The only conflicts were in two lists, insrc/e3sm/asn/CMakeLists.txtanddocs/architecture.md.Tested (x86 gNB with the ocudu PR, Foxconn RU, no UE; the adaptive_cpu dApp with its detector off, sending blocks of PRBs 100–149, then 150–199, then
[], every 200 ms):2 runs × 300 blocks, with
slot_filter.ue_free_onlytrue and false: received = sent to the gNB = applied = 300, 0 NACKs, and the gNB logged 200 blocks and 100 clears with the same ids. Stopping the dApp unloaded the codelet, and the gNB cleared the block in force.From the gNB's capture of the slot the dApp decided on to the first scheduler slot that applies the block, in µs, run 1 / run 2:
Run 2's two maxima are the first control and one slow dApp IQ read. The dApp gets its ACK 92.0 / 98.5 µs (p50) after sending. On air, DL is under the block 7 slots (3.5 ms) after the slot the dApp read (8 slots for 3 of run 2's blocks); UL 11 slots (5.5 ms) for about 90 % of the blocks and 19–20 slots for the rest, when the dApp read the second of the two UL slots (k2 = 4).
Each commit builds on its own (x86, latrec on) and passes
test_l1_kpm_smandtest_spectrum_sm. New cases: a PRB list → the gNB's mask (word edges, a repeated PRB,[]= clear, PRBs past the mask), and OAI's controls 3 and 4 → unsupported. Codelets verified (prb_blockwithin 645 instructions). CI builds the head with latrec off and on.Not run:
prb_block.enabled: falsewith a dApp, a UE with traffic under a block, an APER control from a dApp (test vectors only), arm64, OAI's gNB.After the rebase, on x86 (Ubuntu 22.04, GCC 11.4, Release): the controller and the gNB of the rebased wineslab/ocudu-e3-private#8 build, the three codelets pass the verifier and are byte-identical to the committed objects, and
test_l1_kpm_sm(59) andtest_spectrum_sm(47) pass. The runs above were not repeated.Type of change
Linked issue
None.
Twin-repo coordination
Paired PR(s): https://github.com/wineslab/ocudu-e3-private/pull/8 (the scheduler hook, same
jbpf_e3_prb_block_api.h, byte-identical). The dApp needs no change: it already sends OAI's control.🤖 Generated with Claude Code