NR UE: add assert for reserved bits per symbol not multiple of Qm (#258)
map_overlapped_ack() divides num_reserved_bits_on_sym by Qm to get the
number of reserved REs. Add assertion to catch cases where the reserved
bit count is not a multiple of Qm, which would indicate a bug in the
upstream UCI-on-PUSCH mapping.
This is a follow-up of comment after PR #221
Reviewed-by: Robert Schmidt <robert.schmidt@openairinterface.org>
Clean up openair0_device, remove eth_params usage in L2/L3 (#243)
This PR has three goals
- Remove the usage of eth_params in L2/L3 code, and replace with
tailored data structures for IP connectivity where necessary
- Remove many of the includes of common_lib.h where possible
- Slightly clean up openair0_device and in particular move fields to
eth_state_t where appropriate
Reviewed-by: Bartosz Podrygajlo <bartosz.podrygajlo@openairinterface.org>
Reviewed-by: Teodora Vladić <teodora.vladic@openairinterface.org>
minorfix(imscope): moving alignas from struct type to atomic variable (#238)
I was receiving the note below when I built with "imscope_record", so
this is the simplest PR to avoid the psABI note while signing the new
individual CLA.
[194/11156] Building CXX object openair1/PHY/TOOLS/imscope/CMakeFiles/imscope_record.dir/imscope_record.cpp.o
In file included from /home/turker/Documents/OpenAirInterface/26w25/openair1/PHY/defs_nr_UE.h:12,
from /home/turker/Documents/OpenAirInterface/26w25/openair1/PHY/TOOLS/imscope/imscope_internal.h:12,
from /home/turker/Documents/OpenAirInterface/26w25/openair1/PHY/TOOLS/imscope/imscope_record.cpp:5:
/usr/include/c++/13/atomic: In member function ‘_Tp std::atomic<_Tp>::exchange(_Tp, std::memory_order) [with _Tp = ImScopeDumpInstruction]’:
/usr/include/c++/13/atomic:311:7: note: the ABI for passing parameters with 64-byte alignment has changed in GCC 4.6
311 | exchange(_Tp __i, memory_order __m = memory_order_seq_cst) noexcept
| ^~~~~~~~
Reviewed-by: Bartosz Podrygajlo <bartosz.podrygajlo@openairinterface.org>
DLSIM test for type0 PDSCH frequency allocation (#192)
Adding the test requires some changes in gNB L2 structures but it
doesn't implement the full support of type0 allocation in L2
Reviewed-by: Robert Schmidt <robert.schmidt@openairinterface.org>
fix(NR_UE): gate half-frame PBCH mirror on caller-provided ssb_period (#220)
is_ssb_in_symbol() read cfg->ssb_table.ssb_period directly, but before
the FAPI PHY config request arrives (received_config_request == false)
that field is still 0, which it interprets as a 5ms period and enables
the half-frame PBCH mirror. get_ssb_index_in_symbol() already assumes
the 20ms default period for its frame-periodicity test, so the two
disagree and the UE attempts a spurious PBCH decode in the second
half-frame (slot 5 for mu=0) before being configured.
Closes: #219
Reviewed-by: Francesco Mani <email@francescomani.it>
Fix function init_context_sss_nr() (#239)
Reduce of the size of the d_sss matrix. This PR resolves a regression
found in the PR #152
Reviewed-by: Laurent THOMAS <laurent.thomas@open-cells.com>
map_overlapped_ack() divides num_reserved_bits_on_sym by Qm to get the
number of reserved REs. Add assertion to catch cases where the reserved
bit count is not a multiple of Qm, which would indicate a bug in the
upstream UCI-on-PUSCH mapping.
Signed-off-by: Alex Jiao <alex.jiao@keysight.com>
After having removed eth_params_t from all L2/L3 files, we can reduce
the scope of common_lib.h, and remove the include from many files.
Signed-off-by: Robert Schmidt <robert.schmidt@openairinterface.org>
In 4G, it's not used.
In 5G, there is no need, as we can pass it directly to the CU task.
Signed-off-by: Robert Schmidt <robert.schmidt@openairinterface.org>
Add NR O-RU (#211)
This is a PR that will add a functional vrtsim-based nr-oru to the build
system. This is only slightly different SW to the one being presented at
the OAI summer 2026 workshop.
Reviewed-by: Robert Schmidt <robert.schmidt@openairinterface.org>
Reviewed-By: Merkebu Girmay <merkebu.girmay@openairinterface.org>
Bugfix PUCCH Format 2 (#224)
Fix RE offset computation in PUCCH format 2 generation. This fixes DL
retx with OCUDU in the CI.
Reviewed-by: Bartosz Podrygajlo <bartosz.podrygajlo@openairinterface.org>
When O_ACK <= 2, the reserved HARQ-ACK positions are selected from
the codeword using a d-factor stepping algorithm. The d-factor was
computed and applied at bit granularity, causing it to step through
the flat positions array mid-modulation-group when Qm > 1.
This scattered ACK/placeholder bits across more REs than intended,
mismatching the RE selection of the demultiplexer which operates at
RE granularity. As a result, placeholder positions were marked on
REs that the gNB treats as pure ULSCH, causing those positions to be
transmitted without the normal scrambling sequence XOR. This corrupts
the ULSCH soft bits at the gNB side, leading to PUSCH CRC failure.
Fix: compute the d-factor in RE units and step through the positions
array in strides of d_factor_re * Qm so that whole Qm-bit modulation
groups are always selected or skipped together.
Observed with O_ACK=1, MCS27 (256QAM), beta_offset_idx=11 where
Q_dash_ACK=6 (reserved) vs Q_dash_ACK_actual=3, giving d_factor=2.
PUSCH CRC was KO at third-party signal analyzers (MATLAB/WaveJudge)
while the OCUDU gNB could still decode due to soft LDPC margin.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Signed-off-by: Alex Jiao <alex.jiao@keysight.com>
is_ssb_in_symbol() read cfg->ssb_table.ssb_period directly, but before the FAPI PHY config request arrives (received_config_request == false) that field is still 0, which it interprets as a 5ms period and enables the half-frame PBCH mirror. get_ssb_index_in_symbol() already assumes the 20ms default period for its frame-periodicity test, so the two disagree and the UE attempts a spurious PBCH decode in the second half-frame (slot 5 for mu=0) before being configured.
Closes: #219
Signed-off-by: ChrisAB <cristianbatrin@gmail.com>
Added initialization of frame params according to configuration added
in the new ORUs section. Only one ORU is supported right now.
Added example config that allows starting the ORU and verifying manually
that the config is read.
Signed-off-by: Bartosz Podrygajlo <bartosz.podrygajlo@openairinterface.org>
Improvements in UCI on PUSCH implementation at UE (#139)
This MR improves the implementation of UCI on PUSCH at UE side and fixes
some issues found while testing and fixing the revised version.
Tested in ULSIM with MATLAB vectors provided by @sakthivelvelumani in
the following scenarios (bits)
- 2 ACK no CSI
- 7 CSI part1 no ACK no CSI part2
- 1 ACK 7 CSI part1 7 CSI part2
- 3 ACK 4 CSI part1 4 CSI part2
using the command line
./nr_ulsim -m 27 -u 1 -R 51 -r 51 -s 30 -o(path to the file containing the vector)
Closes: #181
Reviewed-by: Robert Schmidt <robert.schmidt@openairinterface.org>
Reviewed-by: Sakthivel Velumani <s.velumani@northeastern.edu>
Complete NR L2/L3 Paging path from F1AP to NAS (gNB and UE) (#151)
This MR wires a 5G‑NR paging flow across the stack, from F1AP Paging on
the DU down to PCCH scheduling in MAC/RLC, RRC/ASN encode/decode, and
UE‑side NAS Service Request triggering, including the NR UE changes in
L1/L2.
It centralises paging PF/PO computation and PCCH scheduling in MAC,
using shared SSB/Type0‑PDCCH and common PDSCH helpers that are also
reused by SIB1. On the UE, it enables decoding of NR PCCH messages,
matching ng‑5G‑S‑TMSI/fullI‑RNTI, and conditionally initiating a
network‑triggered Service Request when 5GMM state allows it. The change
set includes focused refactors and ASN.1 tests to validate the new
paging encode/decode path.
Changes:
- MAC gNB common helpers: Move SSB/Type0‑PDCCH utilities from the
BCH scheduler into shared MAC primitives and introduce a reusable
Type0‑occasion helper and common PDSCH RB/MCS/TBS sizing
- MAC paging PF/PO responsibility: Add a dedicated PCCH scheduler module
that implements TS 38.304 §7 PF/PO computation (defaultPagingCycle,
nAndPagingFrameOffset, Ns, SFN‑based PF formula and PO slot mapping)
and owns the “is this (frame,slot) a paging occasion for UE_ID?”
decision.
- F1AP -> MAC -> RLC PCCH path (gNB/DU): Have the DU decode F1AP Paging
with CN UE identity, build an NR RRC Paging message (PCCH) in MAC, and
hand it to RLC as a dedicated PCCH SDU together with UE_ID (5G‑S‑TMSI
mod 1024), using per‑module PCCH storage. RAN UE paging identity
is explicitly rejected.
- Direct CU to DU paging path: Implement direct F1 Paging handling
in the NR RRC DL direct interface for RLC PCCH storage for later
scheduling.
- PCCH scheduling and NFAPI integration (gNB MAC): Integrate
schedule_nr_pcch() into the DL scheduler so that when a stored PCCH
SDU exists and the current (frame,slot) is a paging occasion, MAC
resolves the paging search space and CORESET, selects a beam (from SSB),
allocates CCEs and PDSCH resources, builds NFAPI DL_TTI PDUs
(PDCCH + PDSCH with P‑RNTI, DCI 1_0), and populates the matching
TX_DATA PDU, then clears the cached PCCH.
- DCI handling for P‑RNTI paging: Adjust DCI payload preparation
to treat P‑RNTI specially, returning after setting DMRS and antenna
ports and skipping HARQ and UE scheduling state that do not exist for
paging, so paging DCIs no longer touch UE HARQ data structures.
- PHY UE RX Chain: DCI handling for P‑RNTI on UE, monitor DCI on Paging
Occasions, process DCI 1_0 with CRC scrambled by P‑RNTI on the paging
search space, trigger PDSCH decoding for PCCH based on that DCI, deliver
decoded PCCH to upper layers from the PHY/MAC side
- RRC/ASN paging encode API: Replace the legacy buffer‑based do_NR_Paging
with a nr_paging_params_t‑based API returning a byte_array_t,
supporting both ng‑5G‑S‑TMSI and fullI‑RNTI identities, and optional IEs
(e.g. accessType non‑3GPP and pagingCause v17), and encoding via
uper_encode_to_new_buffer, with ownership and failure semantics clearly
defined for callers.
- UE‑side PCCH reception and matching: Add UE MAC to RRC logic
to deliver PCCH SDUs to RRC, decode NR PCCH via a new nr_pcch_decode()
helper into an array of nr_paging_params_t, iterate PagingRecordList on
the UE, compare M‑TMSI/fullI‑RNTI against local identity, and log whether
a paging match was found.
- NAS integration for network‑triggered Service Request: On a UE paging
match, send a NAS_PAGING_IND from RRC to NAS and, when the UE has a
GUTI, is 5GMM‑REGISTERED and in 5GMM‑IDLE, generate and send a Service
Request uplink NAS message
- Tests and validation helpers: Extend nr_asn1 paging tests
to encode Paging via do_NR_Paging, decode it via nr_pcch_decode,
and verify round‑trips for multiple ng‑5G‑S‑TMSI values, accessType,
and fullI‑RNTI bit patterns, using a shared encode/decode helper that
exercises the same decoder path used by the UE.
Notes:
Paging handling currently supports CN UE paging
identity (5G‑S‑TMSI) only. RAN UE paging identity is logged and ignored.
A paging match triggers a Service Request only when the UE has a GUTI,
is 5GMM‑REGISTERED, and in 5GMM‑IDLE. T3346 and suspend‑indication
handling are documented as future work and not implemented here.
Testing:
Tested with Open5gs. How to trigger Paging in Open5GS lab setup:
- Use gNB telnet to request NGAP UE Context Release: `rrc ctx_rel_req
<RRC_UE_ID>`
- Wait until AMF reports CM-IDLE (for example gNB-UEs is now 0).
- Generate downlink data from the Linux host to the UE IP: `ping
<UE_IP>`
- Host-originated downlink data will trigger paging.
Closes#74
Reviewed-by: Robert Schmidt <robert.schmidt@openairinterface.org>
Reviewed-by: Francesco Mani <email@francescomani.it>
we need to remove the reserved elements from the pool of the avalable ones to compute position of the CSIp1 elements
Signed-off-by: Francesco Mani <email@francescomani.it>
Map P-RNTI scheduled DLSCH to the UE DLSCH receive indication flow so
paging traffic is also classified like DLSCH together with C-RNTI.
Changes:
- Set `dlsch0->rnti_type` from DLSCH RNTI in scheduled response, using
`TYPE_P_RNTI_` when RNTI is `P_RNTI`
- Extend `nr_ue_dlsch_procedures()` RX indication mapping to include
`TYPE_P_RNTI_` in the DLSCH indication case
Signed-off-by: Guido Casati <guido.casati@openairinterface.org>
Local ssb detection (#171)
PSS/SSS detection in the UE code uses a global structure that describe
the cell parameters it is not logical because we will populate this
information from what we read in the MIB and the SIB1 later it also
blocks us to make a cell scanner in a logical manner, just calling pss
detection function with a set of detection parameters and a buffer of
digital radio
this MR fixes this and simplifies the code.
Reviewed-by: Sakthivel Velumani <s.velumani@northeastern.edu>