1-port CQI report
MR to extend the support for CQI reporting to CSI-RS with single port
Reviewed-By: Robert Schmidt <robert.schmidt@openairinterface.org>
XNAP: Add encode/decode+unit tests for Xn HO Ack, Prep Failure, SN Status Transfer, UE Context Release
This MR extends XnAP message support in accordance with 3GPP TS 38.423 v16.2.0 for the following procedures:
- Xn Handover Request Acknowledge
- Xn Handover Preparation Failure
- Xn SN Status Transfer
- Xn UE Context Release
Additional updates include:
- Implementation of ASN.1 encoder and decoder functions for all listed
procedures
- Addition of equality check helpers for all newly introduced message
structures
- Implementation of memory management (free) helpers
- Extension of XNAP unit tests to cover all implemented procedures
- Harmonization of AS key BIT_STRING conversion macro
Acknowledgement:
> This work was carried out as part of research and development at
> Indian Institute of Science (IISc), Bengaluru.
Reviewed-By: Guido Casati <guido.casati@openairinterface.org>
Most of the encoder/decoder F1 operation has been moved to a library
under openair2/F1AP/lib/. Thus, these includes are not actually
necessary, and are even problematic if code includes this header that is
not linked to F1AP (see next commit).
Remove all header includes, and put only the necessary ones into the
various source files instead (where they belong, as otherwise we get
massive include files that might even affect compile time).
Signed-off-by: Robert Schmidt <robert.schmidt@openairinterface.org>
Replace duplicated KENB_STAR_TO_BIT_STRING and
KGNB_STAR_TO_BIT_STRING macros with the unified
AS_KEY_STAR_TO_BIT_STRING helper across X2AP,
XNAP, M2AP, and M3AP code paths.
Also switch allocation to calloc_or_fail for
safer memory handling.
No functional change intended.
Signed-off-by: Rakesh BB <rakesh.bb@fsid-iisc.in>
- Add Xn SN Status Transfer message type definitions
- Implement encoder and decoder for Xn SN Status Transfer
Xn SN Status Transfer (3GPP TS 38.423v16.2.0 §9.1.1.4)
- Source NG-RAN node UE XnAP ID (M)
- Target NG-RAN node UE XnAP ID (M)
- DRBs Subject To Status Transfer List (M)
- Add equality check and memory management helpers
- Extend XNAP library unit tests to cover SN Status Transfer
Co-authored-by: Venkatareddy Akumalla <venkatareddy@fsid-iisc.in>
Signed-off-by: Rakesh BB <rakesh.bb@fsid-iisc.in>
Add SRS LS and RSRP measurement logging for indoor positioning research
This MR adds measurement logging support for indoor positioning research
based on OAI gNB radio measurements.
The goal is to collect timestamped SRS LS channel estimates and averaged
RSRP values during experiments. These measurements are used offline for
Add T traces to store raw RSRP reports and SRS LS estimates
Reviewed-By: Francesco Mani <email@francescomani.it>
Reviewed-By: Robert Schmidt <robert.schmidt@openairinterface.org>
Reviewed-By: Rakesh Mundlamuri <rakesh.mundlamuri@openairinterface.org
1. Beam index:
So far rxdataF and txdataF had beam number as first index to separate freq
domain samples of antenna ports when mulitple beams are served in a slot.
This works fine when the beam is applied to entire symbol / slot but not
suitable for digital beamforming. This commit removes the beam number index
from the data buffers and the buffers hold all the antenna ports in the first
dimension. The antenna port index to be used for each UE in a MU-MIMO or
concurrent analog beam scenario is signalled by L2 via dedicated fields in
the FAPI PDU.
2. Beam ID array changes:
- The gNB and RU struct has a 2D array to hold beam IDs for all symbols in a
frame and all antenna ports. The order is now changes to first: symbol index
and second: antenna port because the RU access all ports' beam IDs for each
symbol / slot at a time. This ordering is optimal for maximizing cache hits.
- The type is now changed from int to uint16_t. So far the L1 had to deduce
the beam number index (done in beam_index_allocation()) from the beam ID sent
by L2 and this is done by initializing the beam_id array to -1 which denoted
no beam id set. Now since L2 explicitely passes the port indices, there is no
need for denoting if a beam id is assigned or not to a slot in L1. And
uint16_t matches with the type used by FAPI to carry beam ID. Since the type
is uin16_t, beam_id array is initialized to 0 and the check for -1 when
passing beam ID 0 to xran is also removed.
3. Number of antenna ports:
The removal of beam index from rxdataF and txdataF buffers resulted in all
antenna ports to be in a single vector. The number of logical ports passed to
L1 is not N1*N2*XP*number of beams per period. The buffer initialization
function is updated to reflect this change. DAS reference config file is
updated in accordance with these changes.
4. oaioran.c:
Remove the check of beam ID = -1 for setting nPrbElm = 0. This is a hack for
LiteON to supposedely improve performance according to Mario. If it's true
then a proper fix would be to pass allocation information from L1 and use it
instead of beam ID.
Signed-off-by: Sakthivel Velumani <s.velumani@northeastern.edu>
1. Added new config parameter to read RU port indices to be used via config
file.
2. When scheduling multiple UE on different beams in a slot, the antenna ports
used for each UE is explicitely passed down via fapi.
3. Fix dig_bf_interface_list by filling beam id for all logical ports used.
Signed-off-by: Sakthivel Velumani <s.velumani@northeastern.edu>
Add T trace events for SRS least-squares channel estimate samples and individual MAC RSRP reports. These traces support indoor positioning research and offline dataset generation through the existing OAI tracing workflow instead of custom CSV logging.
Signed-off-by: Bingyu Zhou <s240331012@stu.cqupt.edu.cn>
NR_MAC/PHY: align SRS time_start_position semantics between L2 and L1
Problem
nfapi_nr_srs_pdu_t::time_start_position was being interpreted
inconsistently between OAI MAC (the producer) and the various L1
consumers:
- MAC populated the field with SRS-ResourceMapping.startPosition from
the RRC config — the value 3GPP defines as an offset counted backwards
from the end of the slot (TS 38.331).
- L1 consumers (openair1/PHY/NR_TRANSPORT/srs_rx.c,
openair1/SCHED_NR/phy_procedures_nr_gNB.c) and the MAC's own VRB-map
consumer (gNB_scheduler_srs.c) all re-derived the absolute symbol
index with NR_SYMBOLS_PER_SLOT - 1 - time_start_position.
This works for OAI's in-tree soft L1 (every consumer applies the same
inversion), but external FAPI L1s (NVIDIA Aerial / cuBB) treat
time_start_position as the absolute symbol index per the SCF FAPI 222
PDU semantics. The MAC and external L1 therefore disagreed by one symbol
inversion. Net effect: SRS was scheduled on the wrong OFDM symbol, the
RU sampled noise instead of the SRS, and the channel-matrix returned in
SRS.indication was all zeros for almost every occasion. Fix
Move the inversion to the producer side. MAC populates the PDU with the
absolute symbol index (NR_SYMBOLS_PER_SLOT - 1 - startPosition), and
every consumer uses srs_pdu->time_start_position directly as l0.
The two semantics are mathematically equivalent for OAI's soft L1 (l0 =
NR_SYMBOLS_PER_SLOT - 1 - startPosition either way), so the symbol index
used internally is unchanged on non-Aerial builds. External L1 consumers
now receive the value they expect. Testing status
- [x] OAI L1 + L2
- [x] Aerial L1 in CAT-B / mMIMO mode
- [x] Aerial L1 in CAT-A mode
- [x] RFsim / nrUE end-to-end loopback:
Reviewed-By: Rúben Soares Silva <rsilva@allbesmart.pt>
Iterate all NZP-CSI-RS resources per ResourceSet in scheduler
It was necessary to use 2 CSI-RS resources, but it was discovered that
gNB only transmitted the first one.
nr_csirs_scheduling() was comparing nzp_CSI_RS_ResourceId against an
NZP-CSI-RS-ResourceSetId picked from the first entry of the first
matching CSI-ResourceConfig. This silently filtered out every Resource
whose ID did not happen to match the ResourceSet ID, making setups with
more than one NZP-CSI-RS-Resource per UE impossible: only the first
resource was ever transmitted, while the UE kept scheduling reception
for the remaining ones and reported them as missing (RSRP at the noise
floor).
This MR fixes it, and allows multiple Resources per Set.
Reviewed-By: Francesco Mani <email@francescomani.it>
NAS UE Service Request fixes and improvements for Paging
This MR improves the NAS UE Service Request path and makes
paging-related resume handling more robust. It fixes KSI/KgNB
synchronization, corrects 5G-S-TMSI and encoder/decoder length handling,
and adds Service Accept handling in the NAS_CONN_ESTABLI_CNF path.
It also zero-initializes the initial NAS buffer used during RRC setup
complete to avoid carrying stale data into early NAS message handling.
Reviewed-By: Cedric Roux <cedric.roux@eurecom.fr>
Refactor DLSCH/ULSCH scheduler: extract proportional fair policy behind function pointer interface
Motivation
The current `pf_dl()` is a ~600-line monolithic function that mixes
infrastructure concerns (UE iteration, HARQ management, CCE allocation,
MAC PDU generation) with the scheduling policy (PF priority, RB
allocation, MCS selection). This makes it hard to modify the scheduling
strategy, test alternatives, or offload scheduling to a GPU (cuMAC).
This MR refactors the DL and UL schedulers into a clean separation
between **infrastructure** and **policy**, using function pointers for
beam allocation and scheduling decisions. The data structures
(`nr_dl_candidate_t`, `nr_dl_sched_params_t`) are also designed to map
directly to cuMAC's
`cumacCellGrpUeStatus`/`cumacSchdSol`/`CumacCellGrpPrms`, to make future
integration smooth.
Changes
Goodput tracking fix
`dl_thr_ue` now tracks actual goodput in bps (EWMA of SDU byte deltas
per frame) instead of accumulating raw byte counts per slot, which are
not as straightforward to interpret (due to variations in TDD patterns
mostly). The new calculation matches closely with the throughput
measured with e.g. iperf.
Helper extraction from `pf_dl()` and `post_process_dlsch()`
- `find_first_available_rbs()` — first-fit contiguous RB allocation
- `setup_dl_harq_process()` — HARQ process management
- `generate_dl_mac_pdu()` — MAC CE + RLC data + padding
- `fill_dl_tx_request()` — FAPI TX_req filling
New scheduling interface
- **`nr_dl_candidate_t`** — per-UE flat struct with all immutable inputs
(buffer status, BLER, MCS limits, beam, BWP) and outputs (scheduled,
rbStart, rbSize, MCS). Kept relatively minimal for now, but it should
be easy to add more input metrics in the future.
- **`nr_dl_sched_params_t`** — per-beam cell-level context (VRB map,
available RBs, slot bitmap)
Function pointers (DL)
| Pointer | Default implementation | Role |
|---------|----------------------|------|
| `dl_ri_pmi_select` | `nr_dl_ri_pmi_select_default` | Rank/PMI selection |
| `dl_beam_select` | `nr_dl_beam_select_default` | Beam direction assignment |
| `dl_tda_select` | `nr_dl_tda_select_default` | Time-domain allocation |
| `dl_mcs_select` | `nr_dl_mcs_select_default` | MCS from BLER/SINR |
| `dl_rb_alloc` | `nr_dl_proportional_fair` | PRB allocation (PF policy) |
Function pointers (UL)
| Pointer | Default implementation | Role |
|---------|----------------------|------|
| `ul_ri_tpmi_select` | `nr_ul_ri_tpmi_select_default` | Rank/TPMI from SRS feedback |
| `ul_beam_select` | `nr_ul_beam_select_default` | Beam direction assignment |
| `ul_tda_select` | `nr_ul_tda_select_default` | Time-domain allocation |
| `ul_mcs_select` | `nr_ul_mcs_select_default` | MCS from BLER/SINR |
| `ul_rb_alloc` | `nr_ul_proportional_fair` | PRB allocation (retx first, then PF-sorted new-tx) |
All default implementations are in `gNB_scheduler_dlsch.c` (DL) and
`gNB_scheduler_ulsch.c` (UL).
MCS selection flow
The old `get_mcs_from_bler()` entangled two concerns: updating the BLER
estimate from HARQ feedback and deciding the MCS. These are now split:
- **BLER tracking is infrastructure's job**: `collect_dl_candidates()`
calls `update_dl_bler_stats()` which updates the BLER estimate from
HARQ round statistics.
- **MCS selection is the policy's job**: the proportional fair policy
calls `select_mcs_from_bler()` internally to adapt MCS based on the
BLER value. A different policy could use an entirely different MCS
strategy (e.g. cuMAC has its own `mcsSelectionLUT` + OLLA, one could
decide to opportunistically lower the MCS while increasing the PRB
allocation for reliability in some cases, etc).
For retransmissions, MCS/number of PRBs are passed as hints so the
policy can use them as-is if desired, but we don't enforce it (adaptive
HARQ possible too: the standard requires us to maintain TBS but in
theory it could be achieved via changing the MCS and number of RBs if we
wanted to).
Refactored flow
`nr_dl_schedule()` (formerly `pf_dl()`):
```
collect_dl_candidates() → build candidate array from UE list
schedule_dl_ues() → beam alloc + per-beam policy calls
for each scheduled candidate → CCE/PUCCH/TBS validation + post_process
```
Beam allocation and scheduling policy are two separate function
pointers, allowing each to be developed and tested independently (with
the goal in the future to add a parameter in the config file for each,
and telnet commands to hotswap).
`schedule_dl_ues()` wraps both into a single function: it first calls
beam allocation to assign candidates to beams, then iterates over beams
and calls the scheduling policy for each one. cuMAC performs joint beam
+ PRB allocation on the GPU, so when integrating later it will replace
`schedule_dl_ues()`.
Future work
- Channel matrix H from SRS on candidates for beam-aware scheduling
- Per-RB channel magnitude derived from SRS on candidates
- Config file parameters and telnet commands for hotswapping policies
- cuMAC integration via `schedule_dl_ues()` replacement
Reviewed-By: Robert Schmidt <robert.schmidt@openairinterface.org>
this is done to be able to set DL TDA after calling config_sched_ctrlSIB1 and knowing the potential configuration of commonControlResourceSet for MUX pattern 3 which duration doesn't depend on the BWP size
Signed-off-by: Francesco Mani <email@francescomani.it>
3GPP RRC SRS-ResourceMapping.startPosition is defined as an offset
counted backwards from the end of the slot (TS 38.331). OAI MAC was
previously passing the raw RRC value straight into the FAPI SRS PDU's
time_start_position field, and every L1 consumer was then re-deriving
the absolute symbol via NR_SYMBOLS_PER_SLOT - 1 - time_start_position.
External L1 implementations (e.g. NVIDIA Aerial / cuBB) interpret
time_start_position as the absolute symbol index where the SRS lives,
which left the MAC and external L1 disagreeing by one inversion. The
result was SRS being scheduled on the wrong OFDM symbol and the
returned channel matrix being all-zero for most occasions.
Make MAC populate time_start_position with the absolute symbol index
(NR_SYMBOLS_PER_SLOT - 1 - startPosition) and remove the matching
inversion from the L1 consumers so the value flows through unchanged.
The UE side and the shared SRS generator are harmonized to the same
absolute-symbol convention so generate_srs_nr can read nr_srs_info->
l_offset directly regardless of caller (gNB or UE).
* gNB MAC: gNB_scheduler_srs.c invert at PDU-build time; consume the
already-inverted value when computing l0 for the VRB mask.
* gNB PHY: srs_rx.c (fill + get_signal) and SCHED_NR/phy_procedures_
nr_gNB.c use srs_pdu->time_start_position directly as l0.
* UE MAC: nr_ue_scheduler.c invert at PDU-build time.
* UE PHY: phy_procedures_nr_ue.c consumes srs_config_pdu->time_start_
position directly as l0.
* Shared SRS generator: nr_phy_common_srs.c reads nr_srs_info->l_offset
as the absolute symbol index, matching both gNB and UE call sites.
* Simulators: srssim.c and ulsim.c populate both the gNB-side and
UE-side SRS PDUs with the absolute symbol index so the nr_srssim
and nr_ulsim unit tests pass with the new convention.
Signed-off-by: Gabriele Gemmi <g.gemmi@northeastern.edu>
restructuring of UE DLSCH code to handle 2 codewords
While making changes in another MR I realized the mess in the handling
of 2 codewords in UE DLSCH code. The intention of the MR is not much to
support 2 codewords at the UE but the cleanup the code which currently
in many parts is written confusedly in between support and non-support.
The key point is that the two codewords need to be treated separately as
they have their own modulation and coding scheme and their own
retransmission information.
Reviewed-By: Bartosz Podrygajlo <bartosz.podrygajlo@openairinterface.org>
even if 2 codewords are currently not supported and not tested, the way UE handled the possibility of having 2 codewords was messy, in between support and non-support
the intention of this MR is to cleanup the code more than extend the support
Signed-off-by: Francesco Mani <email@francescomani.it>
NR UE: remove hardcoded 64KB limit for UE capability file
When trying to parse UE capability file (xml converted from a COTS UE),
there will be an error:
[NR_RRC] UE Capabilities XER file /home/ue_caps/ue_cap_20260514_172636.xml is too large (65536)
This is fixed by replacing fixed-size stack buffer with heap allocation
sized to the actual file, allowing large UE capability XER files to be
loaded without hitting the previous 65536-byte limit.
Reviewed-by: Robert Schmidt <robert.schmidt@openairinterface.org>
Remove PUCCH formar limitation in PRB size function
F3 can be handled same way as F2 according to 9.2.5.2 of 38.213
Closes#1077
Reviewed-By: Bartosz Podrygajlo <bartosz.podrygajlo@openairinterface.org>
Replace fixed-size stack buffer with heap allocation sized to the
actual file, allowing large UE capability XER files to be loaded
without hitting the previous 65536-byte limit.
Signed-off-by: Alex Jiao <alex.jiao@keysight.com>
Fix Wt (orthogonal code) multiplication for PUSCH DMRS length 2 and
noise power estimation
This MR:
- Introduce PUSCH DMRS length as a configurable parameter in nr_ulsim.
- Fix bugs related to the use of PUSCH DMRS length 2.
- Fix the noise power estimation.
Note:
- Still cannot validate PUSCH DMRS length 4, since we need more than 5
layers (DMRS type 1) / 6 layers (DMRS type 2) to test the orthogonal
spreading over time.
- Yet to implement time domain averaging for PUSCH DMRS length 2 to
separate orthogonally over time.
- The main bug here is the noise power estimation (removes the duplicate
division with the number of antennas).
Reviewed-by: Roberto Louro Magueta <rmagueta@allbesmart.pt>