Commit Graph

2527 Commits

Author SHA1 Message Date
Laurent THOMAS
3e6e6f0d27 wrong usage of extern declaration in C files, instead of headers, and fix hidden bugs by this wrong extern declaration duplication
Signed-off-by: Laurent THOMAS <laurent.thomas@open-cells.com>
2026-05-27 12:21:51 +02:00
Raymond Knopp
a53545da38 Align to 64 bytes
Signed-off-by: Robert Schmidt <robert.schmidt@openairinterface.org>
2026-05-22 09:35:07 +02:00
Robert Schmidt
dc3011c298 Remove #ifndef PHYSIM from openairinterface5g_limits.h
git grep -w PHYSIM shows no definition of PHYSIM anywhere.

Signed-off-by: Robert Schmidt <robert.schmidt@openairinterface.org>
2026-05-22 09:35:07 +02:00
Jaroslava Fiedlerova
2d9ed6adc4 Merge remote-tracking branch 'origin/pusch_dmrs_bug_fix' into integration_2026_w20 (!4042)
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>
2026-05-13 11:44:32 +02:00
Alex Jiao
7026366b5d T-tracer: fix UE_PHY_PDSCH_IQ event fields
1. The field was named N_RB_UL and used fp->N_RB_UL in both LTE and NR
  demodulation code, but it should use N_RB_DL for PDSCH
2. The tracer ue.c referenced the wrong buffer field name "pusch_comp"
  instead of "pdsch_comp", causing a crash on startup

Signed-off-by: Alex Jiao <alex.jiao@keysight.com>
2026-05-11 11:15:35 +08:00
Rakesh Mundlamuri
4e6e0e529d Minor fixes and harmonize maximum number of segments for DL and UL
Signed-off-by: Rakesh Mundlamuri <rakesh.mundlamuri@openairinterface.org>
2026-05-09 12:24:03 +05:30
Jaroslava Fiedlerova
3b8f5c7191 Merge remote-tracking branch 'origin/rrc-qos-handling' into integration_2026_w19 (!3810)
Multi-QoS Handling and PDU Session Modify

This MR implements comprehensive QoS flows handling and PDU Session
Modify procedures in the RRC layer, enabling full support for multiple
QoS flows per DRB and dynamic QoS management per 3GPP specs. Key
changes:

1. Multi-QoS Flows Support

- Multiple QoS flows per DRB: Support for multiple QoS flows mapped to a
  single DRB
- Intelligent QoS-to-DRB mapping: Implements resource-type-aware
  multiplexing based on 3GPP TS 23.501 Table 5.7.4-1
  - DC-GBR flows (5QI 82-90): Dedicated DRB, max 1 flow per DRB
  - GBR flows (5QI 1-4, 65-67, 71-76): Max 2 flows per DRB
  - Non-GBR flows (5QI 5-11, 69-70, 79-80): Max 5 flows per DRB
  - Aggregate cap: Maximum 5 flows per DRB
- 5QI validation: Early validation of standardized 5QI values (1-9,
  65-90) during QoS flow setup/modify

2. PDU Session Modify Procedures

- Complete E1AP/RRC integration: Full Bearer Context Modification
  support with DRB lifecycle management
  - DRB To Setup/Modify/Remove lists: Complete support for all DRB
    operations in Bearer Context Modification
- QoS flow operations: Support for QoS flow add, modify, and release
  operations
  - QoS flow mapping: Proper handling of QoS flow modifications in
    DRB To Modify List
- Automatic DRB management: DRB setup, modification, and removal
  based on QoS flow changes. Reuse existing DRBs if the incoming QoS
  flow is compatible.
- Delayed transactions: PDU Session Modify added to delayed
  transactions list for proper sequencing

3. GTP-U Tunnel Refactoring

- Architecture alignment:
  - N3 tunnels: 1 per PDU session with QFI marking, container for
    multiple bearers, supporting multiple QoS flows
  - F1-U tunnels: 1 per DRB without QFI marking
- SDAP ownership of QoS: move QoS management to be fully owned by
  SDAP

4. QoS Enhancements

- Dynamic5QI support: Full support for Dynamic5QI with packet delay
  budget and packet error rate
- GBR QoS flows: Support for Guaranteed Bit Rate QoS flows with
  GFBR/MFBR parameters
- DRB QoS aggregation: DRB-level QoS computed from all mapped QoS
  flows using ARP priority (not 5QI priority)
- QoS priority level refactoring: Proper type definitions per 3GPP
  TS 23.501 (QoS Priority Level: 1-127, ARP Priority Level: 1-15)

Technical Changes

RRC Layer

- Refactored `nr_rrc_add_bearers()` to support intelligent QoS-to-DRB
  mapping
- Added `nr_rrc_update_qos()` for QoS flow add/modify with automatic DRB
  assignment
- Implemented `nr_rrc_update_pdusession()` for QoS flow release and DRB
  cleanup
- Consolidated F1 UE Context Modification Request handling
- Simplified PDU status tracking by removing intermediate states
- Added QoS flow and DRB removal utilities
- Updated RRC bearers tests with comprehensive multi-QoS testing
- Adapted `nr-cuup-load-test.c` to new GTP design

NGAP Layer

- Extended PDU Session Resource Modify Request Transfer with QoS
  add/modify/release lists
- Added proper type definitions (`pdusession_mod_req_transfer_t`,
  `qos_flow_to_release_t`)
- Fixed NGAP PDU Session Modify transfer encoding

GTP-U Layer

- Refactored tunnel creation API: scalar fields instead of arrays
- Split tunnel creation into `n3_gtpu_create()` and
  `f1_drb_gtpu_create()`
- Added bearer-to-QFI mapping structure (`gtpv1u_rb_t`)
- Implemented QFI de-duplication and one-to-one QFI-to-bearer mapping
- Reduced inter-dependencies between LTE and NR

SDAP Layer

- Fixed default DRB tracking: Only one default DRB per SDAP entity per
  PDU session (TS 37.324)
- Set default DRB to first DRB added when creating bearers

F1AP Layer

- Added GBR QoS Flow Information IE handling in CU
- Implemented DRB QoS aggregation from multiple QoS flows
- Extended F1AP test cases to support multiple QoS flows

Code Quality Improvements

- Improved error handling throughout the stack
- Enhanced logging and debugging capabilities
- Added comprehensive unit tests for multi-QoS scenarios
- Improved type safety and validation

Testing

The code was validated with Open5gs v2.7.6, OAI CN5G and COTS UE.

How to reproduce with Open5gs:

1. Start Open5gs
2. From the Open5gs web UI: add multiple QFIs to the same DNN.
3. Restart Open5gs
4. Run gNB and UE

The user will see the following:

1. QoS flows arrive via NGAP PDU Session Setup/Modify requests, each
   with a QFI and 5QI.
2. The gNB assigns each flow to a DRB, creating a new DRB or reusing an
   existing one based on 5QI compatibility (compatible flows, i.e. same
   5QI characteristics, share a DRB)
3. At the SDAP layer, packets are tagged with QFI headers; at the GTP-U
   layer, uplink packets include QFI in the PDU Session Container for
   core network mapping.

Documentation

- Added comprehensive QoS flows handling documentation with 3GPP
  standards references
- Updated PDU Session Modify sequence diagrams

Note

* This implementation aligns with:
  - 3GPP TS 23.501 (QoS framework)
  - 3GPP TS 38.413 (NGAP)
  - 3GPP TS 37.324 (SDAP)
  - 3GPP TS 38.463 (F1AP)
  - 3GPP TS 29.281 (GTP-U)
  - 3GPP TS 38.331 (RRC)
* Multi-QoS and PDU Session Modify are both added to this MR since QoS
  flows update is triggered by PDU Session Modify in some scenarios
  (e.g. with Open5gs, used for validation).
* Core functional changes introduced by commits with prefix "QoS
  Handling" or "PDU Session Modify"
* This MR replaces the old !2703.
* This MR adopts relevant CU changes from !2836, namely:
  * Adds new shared QoS types
  * Add standardized 5QI table and helper
  * Dynamic5QI support + validation
  * Computation of DRB QoS (aggregate QoS) and priority/GBR
  * F1AP DRB-level QoS
* Closes #541 (5QI validation)
* Closes #1075 (Optional NAS-PDU in PDU Session Setup Request)

Signed-off-by: Jaroslava Fiedlerova <jaroslava.fiedlerova@openairinterface.org>
Reviewed-by: Rakesh Mundlamuri <rakesh.mundlamuri@openairinterface.org>
2026-05-07 14:52:10 +02:00
Jaroslava Fiedlerova
ea1376a5c1 Merge remote-tracking branch 'origin/issue-1054-fix' into integration_2026_w19 (!3960)
fix: issue 1054 - Config: Creating New Array members via command line arguments

Before this change, if you wanted to use --rfsimulator.[0].serveraddr
server on the command line but if you had no rfsimulator block in your
config file, it would just ignore it and print:

[CONFIG] unknown option: --rfsimulator.[0].serveraddr
[CONFIG] unknown option: server

This is because the config module only processes array members that
already exist in the config file. If the array is empty, the command
args are never checked.

What I changed is, in config_getlist() in config_userapi.c, after it
finishes processing existing array parameters, it checks whether a new
parameter is needed. If so, it matches with the list of parameters
first, then the highest index is found for that parameter using the
strtol,

"--rfsimulator.[0].serveraddr",
"--rfsimulator.[2].serveraddr",

What I changed is, in config_getlist() in config_userapi.c, after it
finishes processing existing array parameters, it checks whether a new
parameter is needed. If so, it matches with the list of parameters
first, then the highest index is found for that parameter using the
strtol,

"--rfsimulator.[0].serveraddr",
"--rfsimulator.[2].serveraddr",
"--rfsimulator.[4].serverport",
"--rfsimulator.[1].serveraddr",

It sets the index as 4, allocates 4 slots, memory is managed via
standard functions then it fills the gap of all the indices.

this closes #1054

Signed-off-by: Jaroslava Fiedlerova <jaroslava.fiedlerova@openairinterface.org>
Reviewed-by: Bartosz Podrygajlo <bartosz.podrygajlo@openairinterface.org>
2026-05-07 09:36:58 +02:00
Guido Casati
17ff43168f QoS handling: add GBR QoS flow information decoding from NGAP QoS Flow Setup Request List
Implement GBR (Guaranteed Bit Rate) QoS flow information extraction from NGAP.
This enables handling in CU of GBR QoS flows
(e.g., voice, video) that require guaranteed and maximum bit rates.

Changes:
- Define qos_bitrate_t structure to encapsulate GFBR and MFBR
- Define gbr_qos_flow_information_t structure for GBR QoS parameters
- Add optional gbr_qos_flow_information field to pdusession_level_qos_parameter_t
- Extract GBR information from NGAP_QosFlowLevelQosParameters in fill_qos()
- Add NGAP_GBR-QosInformation.h include to ngap_msg_includes.h

GBR information is optional in NGAP and is only present for GBR flows
(5QI < 5 for NonDynamic5QI, or Dynamic5QI flows with GBR characteristics).
Bit rates are in kbps.

This commit is a refactoring of commit 398ae02ab9 from !2836

Co-authored-by: Sriharsha Korada <sriharsha.korada@iis.fraunhofer.de>

Signed-off-by: Guido Casati <guido.casati@openairinterface.org>
2026-05-04 12:03:27 +02:00
Guido Casati
ef971849bd QoS handling: add Dynamic5QI QoS support/validation, split QoS characteristics by 5QI type
Model non-dynamic vs dynamic 5QI characteristics explicitly and propagate the
new layout through NGAP decode and RRC bearer/QoS handling.

Changes:
- Define `non_dynamic_5qi_t`/`dynamic_5qi_t`, PER/PDB bounds, and embed a
  `qos_characteristics` union in `pdusession_level_qos_parameter_t`
- Populate the new QoS structures in `fill_qos()`, including optional
  allocations for Dynamic 5QI `fiveQI` and NonDynamic `priorityLevelQos`
- Map QoS params to F1AP with `nr_rrc_get_f1_qos_flow_param()` and add range
  validation for dynamic priority/PDB/PER and non-dynamic 5QI
- Populate E1 QoS characteristics from the new layout and update QoS modify
  handling to manage optional pointer fields (`openair2/RRC/NR/rrc_gNB_NGAP.c`)
- Derive a numeric 5QI via `get_qos_fiveqi()`, handle missing-5QI dynamic flows
  conservatively, and extend dedicated-DRB decisions to fall back to dynamic
  characteristics
- Add a 5QI range assert in F1AP QoS encoding and extend bearer tests with a
  Dynamic 5QI flow

Signed-off-by: Guido Casati <guido.casati@openairinterface.org>
2026-05-04 12:03:27 +02:00
Guido Casati
04126759aa QoS handling: add 5QI validation during QoS flow setup/modify
Move 5QI validation from RRC reconfiguration message generation to
where QoS flows are actually added/updated, ensuring validation
happens early in the process.

Changes:
- Remove redundant 5QI validation from rrc_gNB_modify_dedicatedRRCReconfiguration():
  that was checking values right before RRC message generation
- Add 5QI validation in add_qos() to reject unsupported 5QI values
  during PDU session setup
- Add 5QI validation in nr_rrc_update_qos to skip unsupported 5QI
  values during PDU session modify (continues to next flow)
- Add is_5qi_supported() function in rrc_gNB_radio_bearers.c:
  validates standardized 5QI values (1-9, 65-90) per 3GPP TS 23.501
  Table 5.7.4-1 and checks against the classification map

Also, remove remaining limit to 1 QoS flow per DRB.

Closes #541

Signed-off-by: Guido Casati <guido.casati@openairinterface.org>
2026-05-04 12:03:27 +02:00
Guido Casati
8ceb7ec37b QoS Handling: implement intelligent QoS-to-DRB mapping based on 3GPP TS 23.501
Implement QoS flow multiplexing logic that optimizes DRB usage by classifying
5QI values per 3GPP TS 23.501 Table 5.7.4-1 and applying resource-type-aware
multiplexing limits. The changes are adopted in nr_rrc_add_bearers, which
is the RRC function responsible for adding PDU Sessions and DRBs in RRC.

Key features:
- Classify 5QI by resource type (DC-GBR, GBR, Non-GBR)
- Reuse existing DRBs when QoS characteristics are compatible
- Dedicated DRBs for DC-GBR (5QI 82-90) and high-priority services
- Per-type multiplexing limits: DC-GBR=1, GBR=2, Non-GBR=5
- Aggregate cap: max 5 flows per DRB

Implementation:
- nr_rrc_get_5qi_resource_type():
  Maps 5QI values to resource types using lookup table.
  DC-GBR: 5QI 82-90, GBR: 5QI 1-4,65-67,71-76, Non-GBR: 5QI 5-11,69-70,79-80.
  Unknown 5QIs default to Non-GBR with warning.

- nr_rrc_qos_dedicated_drb():
  Identifies 5QIs requiring isolated DRBs (high priority, low-PER).
  Includes: DC-GBR: 5QI 82-90, 5QI 4,6-10 (video), 5QI 70 (mission-critical),
  5QI 71-73 (live streaming), 5QI 80 (low-latency).

- nr_rrc_count_qos_flows_by_type():
  Counts QoS flows mapped to a specific DRB, grouped by resource type.
  Used to check capacity and enforce multiplexing limits.

- nr_rrc_find_suitable_drb_for_qos():
  Searches existing DRBs in the same PDU session for available capacity.
  Checks resource type compatibility, per-type limits, and aggregate cap.
  Returns DRB ID if suitable, -1 if new DRB needed.
  DC-GBR flows always return -1 (require dedicated DRB).

- nr_rrc_assign_drb_to_qos_flow(), which either reuses a DRB
  selected by nr_rrc_find_suitable_drb_for_qos() or creates a new DRB via
  nr_rrc_add_drb, assigns its ID to the QoS flow

Note: this commit is multi-QoS ready.

Signed-off-by: Guido Casati <guido.casati@openairinterface.org>
2026-05-04 12:03:27 +02:00
Guido Casati
d4c1731e97 Platform types (QoS): refactor QoS Priority Level type per 3GPP TS 23.501
QoS Priority Level range is 1-127, fits in uint8_t (3GPP TS 23.501 §5.7.3.3).

Refactor qos_priority field in pdusession_level_qos_parameter_t to use
qos_priority_level_t typedef (uint8_t) instead of uint64_t. Also,
improve documentation.

Changes:
- Add qos_priority_level_t typedef (uint8_t), more efficient than uint64_t
- Change pdusession_level_qos_parameter_t.qos_priority from uint64_t
  to qos_priority_level_t
- Add MIN_QOS_PRIORITY_LEVEL (1) and MAX_QOS_PRIORITY_LEVEL (127)
  defines for range checks

Signed-off-by: Guido Casati <guido.casati@openairinterface.org>
2026-05-04 12:03:27 +02:00
Guido Casati
6560403d3c Platform types (QoS): refactor ARP priority level type
Since qos_priority_t reprensents the ARP priority level, an integer
(1..15), this commit is renaming it to qos_arp_priority_level_t
typedef (uint8_t) for better clarity and cleaning up unnecessary enum definition.

Changes:
- Rename qos_priority_t to qos_arp_priority_level_t (uint8_t typedef)
  for type safety and semantic meaning
- Remove enum with 15 explicit values (not needed, matches spec as integer)
- Add MIN_QOS_ARP_PRIORITY_LEVEL (1) and MAX_QOS_ARP_PRIORITY_LEVEL (15) defines
  for bound checks, simpler and more efficient
- Update qos_arp_t struct to use new typedef

References:
- 3GPP TS 23.501 §5.7.2.2!

Signed-off-by: Guido Casati <guido.casati@openairinterface.org>
2026-05-04 12:03:27 +02:00
Guido Casati
4b5d5c1ae6 Platform constants: consolidate PDU session limit constants
Replace NGAP_MAX_PDU_SESSION and E1AP_MAX_NUM_PDU_SESSIONS with
shared NR_MAX_NB_PDU_SESSIONS constant. The value (256) is consistent
with both TS 38.331, TS 38.413 and TS 38.463

All protocol layers (NGAP, E1AP, RRC, SDAP) now use a single
shared constant for maximum PDU sessions per UE, ensuring
consistency across the codebase

E1AP_MAX_NUM_PDU_SESSIONS (was 4) is removed from e1ap_messages_types.h

Signed-off-by: Guido Casati <guido.casati@openairinterface.org>
2026-05-04 12:03:27 +02:00
Robert Schmidt
d8962fa270 spsc_q: fix call to spsc_q_alloc() in benchmark
Fixes: 4d67a6e513 ("spsc_q: make compile on older compilers")

Signed-off-by: Robert Schmidt <robert.schmidt@openairinterface.org>
2026-04-30 19:55:09 +02:00
Robert Schmidt
4d67a6e513 spsc_q: make compile on older compilers
While compiling the spsc_q unit tests on some compilers, some
complain with

     /openairinterface5g/common/utils/ds/tests/test_spsc_q.cpp:11:44: error: use of deleted function ‘spsc_q::spsc_q(spsc_q&&)’
     spsc_q_t rb = spsc_q_alloc(2, sizeof(int));
     /openairinterface5g/common/utils/ds/spsc_q.h:19:16: error: use of deleted function ‘std::atomic<long unsigned int>::atomic(const std::atomic<long unsigned int>&)’

These compiles cannot copy the atomic. Change the API to avoid this
copy.

"Older" compiler here means g++-11/12.

Signed-off-by: Robert Schmidt <robert.schmidt@openairinterface.org>
2026-04-28 18:40:24 +02:00
Jaroslava Fiedlerova
0054b496d4 Merge remote-tracking branch 'origin/zmq-radio-3' into integration_2026_w17 (!3975)
ZMQ radio

This is a zmq radio implementation that attempts to integrate NR UE with
the ocudu project.

OAI integration status:
This can currently be used to connect OAI gnb and OAI UE.

Compilation:
cmake --build . --target nr-softmodem nr-uesoftmodem ldpc params_libconfig zmq_radio

Running
- gNB command:
sudo ./nr-softmodem -O ../targets/PROJECTS/GENERIC-NR-5GC/CONF/gnb.sa.band78.fr1.106PRB.usrpb210.conf --gNBs.[0].min_rxtxtime 6 --device.name zmq_radio --zmq.[0].tx_channels tcp://127.0.0.1:4556 --zmq.[0].rx_channels tcp://127.0.0.1:4557

- UE command:
sudo ./nr-uesoftmodem -r 106 --numerology 1 --band 78 -C 3619200000 --ssb 516 --device.name zmq_radio --zmq.[0].tx_channels tcp://127.0.0.1:4557 --zmq.[0].rx_channels tcp://127.0.0.1:4556

A new CI testcase for 2x2 configuration was added.

OCUDU integration status:
The OAI NR UE enters RRC Connected state.

For more details, please refer to the description of MR !3975.
2026-04-24 14:17:12 +02:00
Jaroslava Fiedlerova
6b06bda933 Merge remote-tracking branch 'origin/data_recording_app_optimization_part1' into integration_2026_w17 (!4061)
T-Tracer & Data Recording v1.1: UL PHY trace modularization and recording
enhancements

Based on the plan with @schmidtr  and @roux-cedric, we agreed to enhance
the data recording in two phases:

- Phase 1: Update Data Recording framework to get All internal Massive
  Updates and enhancements through the whole framework public
- Phase2: Restructure T-Tracer Apps and remove all Mems in gNB and UE
  Softmodems to Get data on T-tarcer Apps for all activated Messages
  symbol-by-symbol, and related Meta-data, then do the aggregation on
  the T-tracer App. So, there is No Memory Creation at all on the 5G NR
  Stack.

This Merge Request is for Phase 1. We address the comments given in: !3632

Summary: Refactor T-Tracer instrumentation for UL PHY data capture and
improve the data recording application (v1.0 → v1.1). This MR extracts
inline T() macro calls into modular wrapper functions, adds Unix timestamp
fields to trace messages, implements a 4-state shared memory protocol for
gNB/UE tracers, and delivers an improved synchronized recording architecture
in Python.

Changes:
- T-Tracer: Modular UL PHY trace wrappers
  - Add T_messages_creator.c/.h with 7 wrapper functions (log_ul_fd_dmrs,
    log_ul_fd_chan_est_dmrs_pos, log_ul_fd_pusch_iq,
    log_ul_fd_chan_est_dmrs_interpl, log_ul_payload_rx_bits,
    log_ul_payload_tx_bits, log_ul_scrambled_tx_bits) and a static
    log_ul_common() helper
  - Register T_messages_creator.c in the T library CMake build
  - Update T_messages.txt definitions: Remove string timestamps and get
    time stamp directly from sending_time of T-macro.
  - PHY: Replace inline T() calls with wrappers
  - gNB (nr_ulsch_demodulation.c, nr_ul_channel_estimation.c,
    phy_procedures_nr_gNB.c): replace inline T() calls with
    T_messages_creator wrappers
  - UE (nr_ulsch_coding.c, nr_ulsch_ue.c): replace inline T() calls with
    log_ul_payload_tx_bits and log_ul_scrambled_tx_bits wrappers
  - Remove deprecated log_tools.c/.h and its CMake reference

- T-Tracer gNB & UE apps: Enhancements
  - Implement 4-state shared memory protocol (WAIT → CONFIG → RECORD → STOP)
    for coordination with the data recording app
  - Add event_trace_msg_ul_data struct with 27 UL metadata fields
  - Refactor event loop to poll()-based with proper signal handling
  - Separate project IDs (gNB=2335, UE=2336) and ftok paths for independent
    shared memory segments
  - Update shared memory sizing: Limit number of records to
    NUM_MESSAGES_PER_SLOT=5, 100 slots

- Data Recording App v1.1
  - Improved architecture with thread pool and barrier synchronization
  - Frame/slot-based message grouping with per-slot validation
  - atexit/signal-based cleanup for graceful shared memory detach
  - Delete legacy data_recording_app_v1.0.py

- Library improvements
  - config_interface.py: remove legacy YAML config reader, streamline to
    JSON-only
  - shared_memory_interface.py: new module for shared memory
    attach/read/protocol
  - wireless_parameters_mapper.py: new module for NR parameter mapping
  - data_recording_messages_def.py: updated message definitions for
    27-field struct
  - sigmf_interface.py, sync_service.py, common_utils.py: remove unused
    imports and dead code

- Documentation
  - Update data_recording.md for v1.1 architecture and usage
2026-04-24 14:09:41 +02:00
abgaber
2f23dd2444 data-recording v1.1: Major rewrite of the synchronized real-time data recording system.
Application (v1.1):
- Generic N-node architecture replacing hardcoded gNB/UE structure
- Node-based JSON config with per-node shared memory paths
- Thread pool with barrier sync for multi-node recording
- Frame/slot-based message grouping in read_and_store_tracer_messages()
- Robust cleanup via atexit and signal handlers
- Remove v1.0 legacy application

Shared Memory Interface (new):
- System V shared memory attach/detach/remove with ftok-based keys
- Structured binary read/write for tracer control messages
- Frame/slot-aware data reading with configurable timeout

Config Interface:
- JSON-based config with node definitions (id, type, shared_mem_config)
- Per-node tracer message parsing and index resolution

SigMF Interface:
- Timestamp refactor: Unix epoch sec/nsec with nanosecond precision
- Wireless parameter mapping via YAML-driven parameter map
- System components metadata (TX/channel/RX) in SigMF annotations

Sync Service:
- Generic multi-node sync replacing 2-node sync
- Frame-wrap-aware comparison (1024-frame wrap)

Wireless Parameters Mapper (new):
- YAML-driven OAI-to-SigMF parameter mapping
- 5G NR metadata derivation (DMRS, modulation, link direction)
2026-04-24 10:31:38 +02:00
abgaber
46a4097f6a T-Tracer: update shared memory sizing for 5 messages/slot
Set NUM_MESSAGES_PER_SLOT=5, 100 slots buffer depth (~234 MiB).
Add separate project IDs and ftok paths for gNB and UE.
2026-04-24 10:31:38 +02:00
abgaber
b242eb3093 T-Tracer gNB and UE: massive enhancements
- refactor timestamp handling
- Replace string-based SENDING_TIME with integer SEC/NSEC fields.
- Designed the shared memory protocol with a 4-state machine (STATE_WAIT=0, STATE_CONFIG=1, STATE_RECORD=2, STATE_STOP=3) for command/control between the recording app and the T-Tracer service
- Implemented two shared memory segments: one for reading commands (addr_rd) and one for writing captured data (addr_wr)
- Created event_trace_msg_ul_data struct mapping all 27 UL metadata fields (frame, slot, datetime, MCS, DMRS parameters, etc.) by name from the T-Tracer database
- Implemented setup_trace_msg_ul_data() using the G() macro to map field names to indices at startup
- Wrote the main event loop using poll() to avoid busy-waiting, with get_event() to receive T-Tracer events from the softmodem socket
2026-04-24 10:31:38 +02:00
abgaber
c70ed20ca7 T-Tracer: update trace message definitions with Unix timestamp fields
Sending time field of T() is used as a time stamp
2026-04-24 10:31:38 +02:00
abgaber
80ad56af63 T-Tracer: add T_messages_creator.c to T library build 2026-04-24 10:31:38 +02:00
abgaber
b75ddf0e85 T-Tracer: add T_messages_creator wrapper functions for UL PHY trace logging
Introduce T_messages_creator.h/.c with 7 modular wrapper functions
(log_ul_fd_dmrs, log_ul_fd_pusch_iq, log_ul_fd_chan_est_dmrs_pos,
log_ul_fd_chan_est_dmrs_interpl, log_ul_payload_rx_bits,
log_ul_payload_tx_bits, log_ul_scrambled_tx_bits) that encapsulate
T() macro calls with structured PHY metadata fields.
Replaces scattered inline T() calls across PHY source files.
2026-04-24 10:31:38 +02:00
Jaroslava Fiedlerova
430e336e15 Merge remote-tracking branch 'origin/ctest-physim-sanitizers' into integration_2026_w17 (!4069)
ctest: fix tests when compiling with sanitizers, ignore build directories,
fix spsc_q build

- Fix the directory to the current build directory to enable running with
  sanitizers with ctest
- add build* to .gitignore to close #1074
- fix spsc_q compilation on non-C++23 compilers to close #1073
2026-04-24 00:23:42 +02:00
Aswanth KC
ef0b4460b6 Config: Creating New Array members via command line arguments
Before this change, if you wanted to use --rfsimulator.[0].serveraddr server
on the command line but if you had no rfsimulator block in your config file,
it would just ignore it and print:
[CONFIG] unknown option: --rfsimulator.[0].serveraddr
[CONFIG] unknown option: server

This is because the config module only processes array members that already
exist in the config file. If the array is empty, the command args are never checked.

What I changed is, in config_getlist() in config_userapi.c, after it finishes
processing existing array parameters, it checks whether a new parameter is given
in CLI.

The array number in the parameter(num) should match with the valid index of
that specific array

--cfg.[0].value 1 creates one array with one element
valid_index = num = 1

--cfg.[0].value 1 --cfg.[0].value 2 creates an array with two elements
if the previous CLI number repeats increments the "num"
valid_index = num = 2

--cfg.[1].value 1 --cfg.[0].value 2 error
valid_index < num, expects 0.
2026-04-23 17:45:34 +00:00
Robert Schmidt
74bc9bf0cc spsc_q: fix use of stdatomic.h
stdatomic.h is a C++23 feature [1]. Thus, "older" compilers such as
gcc-11 (default in Ubuntu 22) do not know this, and can therefore not
correctly compile spsc_q. Fix this by alternatively including atomic for
C++.

Fixes errors such as

    stdatomic.h:40:9: error: ‘_Atomic’ does not name a type

[1] https://en.cppreference.com/cpp/header/stdatomic.h

Signed-off-by: Robert Schmidt <robert.schmidt@openairinterface.org>
2026-04-23 14:31:51 +02:00
Jaroslava Fiedlerova
0ecfd11d92 Merge remote-tracking branch 'origin/type0dlsch' into integration_2026_w17 (!3762)
L1 gNB type0 PDSCH

PDSCH type0 allows frequency allocation via PRB bitmap (type1 is via
start and number of PRBs) allowing for non contiguous allocation in
frequency domain
2026-04-23 10:19:40 +02:00
Bartosz Podrygajlo
46c120651f ZMQ radio
This commit introduces ZMQ-based radio library. Each pair of RX/TX antennas is
represented by a ZMQ REQ/REP socket pair which streams continuous IQ samples
from radio start until stop.

Usage:
Simplest configuration is to connect OAI NR UE to OAI GNB with the same number
of antennas - by inverting the RX and TX channels in ZMQ radio configuration the
gNBs TX is mapped to UEs RX antennas and vice versa.
2026-04-22 22:34:02 +02:00
Guido Casati
210b9089b9 Fix clang warning: remove extra semicolon in time_meas.h line 36
- Fixed [-Wextra-semi] warning by removing duplicate semicolon
2026-04-21 17:39:57 +02:00
francescomani
29457abe71 reworking the handling of freq_alloc_bitmap_t to make it more efficient
Co-Authored-By: @schmidtr
Assisted-by: Gemini:3 Flash
2026-04-20 19:15:27 +02:00
francescomani
27158b9244 rename reverse_bits to bits and move functions to count bits in there 2026-04-18 09:48:39 +02:00
Robert Schmidt
463a3ad1cf Merge remote-tracking branch 'origin/l1-rx-use-queues' into integration_2026_w16 (!3991)
L1 RX: use queues instead of arrays and linear search for PUCCH, PUSCH, SRS, PRACH

This MR is an attempt to reduce the time L1 RX searches in array for the
next job to process, and instead use a queue. This queue is a FIFO,
because the various jobs (FAPI messages) to process come in order, and
need to be processed in order. The MR (hopefully, to be measured)
reduces the amount of time spent searching for the next UE (because the
next job is always at the beginning of the queue), and should scale
better for many UEs.

It does the following:

- introduce two helper libraries for (1) Frame.Slot calculation (sfn_t),
  already introduced in !3521 (merged) commit 3102068e, and (2) a ring
  buffer with fixed size
- use sfn_t and ring buffer (gNB->pucch_queue) to remove the linear
  array for PUCCH (gNB->pucch)
- use sfn_t and ring buffer (gNB->pusch_queue) for some PUSCH lookups.
  Because we need to still store PUSCH contexts, gNB->pusch is still
  there
- use sfn_t and ring buffer (gNB->srs_queue) to remove the linear array
  for SRS (gNB->srs)
- use sfn_t and ring buffers (gNB->prach_ru_queue and
  gNB->prach_l1rx_queue) to remove the linear array for PRACH
  (gNB->prach_list)
- some minor cleanups, e.g., additional loops over the PUSCH array,
  using const, using pointers instead of indices, etc
2026-04-16 13:50:53 +02:00
Robert Schmidt
c1d0e836b4 Merge remote-tracking branch 'origin/some_fixes' into integration_2026_w16 (!4030)
Miscellaneous code improvements

- A fix in a yaml config file as reported by @Abdo-Gaber
- proper positioning of static functions in a couple of gNB scheduler
  files
- some effort to split NR from LTE code in compilation
- harmonization of macros for unused variables
2026-04-16 12:43:06 +02:00
Robert Schmidt
dc550ebaf6 Merge remote-tracking branch 'origin/rrc-sibs' into integration_2026_w16 (!3983)
Add SIB 3,4 support, configurable SIB2 and refactor CU/DU SIB management

This MR makes neighbour and inter-frequency configuration drive how
SIB2/SIB3/SIB4 are built and sent from CU to DUs. It standardizes SIB
payloads as byte_array_t with typed SIB IDs across RRC, F1AP and MAC,
reducing ad‑hoc buffer handling. Neighbour parsing, validation and
lookup are tightened.

Changes

- Minor refactor to gNB neighbour parsing and storage (shared PLMN
  extraction, safer allocation, etc).
- Represent SIB containers uniformly as byte_array_t plus nr_sib_type_t,
  and adapt F1AP, MAC and RRC users to the new container API.
- Make SIB2 cell-reselection information fully config-driven with
  explicit bounds checking and SIB2 ASN.1 building from that config.
- Generate SIB3 intra-frequency neighbours from the per-cell neighbour
  list and propagate them from CU to DU over F1, with MAC
  decoding/attaching them to SystemInformation.
- Generate SIB4 inter-frequency neighbours from a new frequency_list
  plus neighbour SIB3/SIB4 offsets, and propagate them from CU to DU
  over F1, with MAC decoding/attaching them.
- Add basic ASN.1 round-trip tests for SIB2/SIB3/SIB4 and SIB4 range
  checks, and update RRC docs to describe the neighbour/inter-frequency
  configuration model.

Testing:

1. in gNB conf file:

    cu_sibs = (2, 3, 4);

2. Update neighbour config file with SIB3/SIB4 conf:

    (see documentation)

3. run gNB and UE as usual

---

Logs & configs: see MR on Gitlab
2026-04-16 12:42:42 +02:00
Robert Schmidt
b15d394212 Improve spsc_q through atomics
Because it is SPSC, atomic variables are enough to synchronize the two
threads. Concretely put() is modified to ensure that read_idx is
"acquired" so that the read index has been written, including memory, by
the other thread. "Release" ensures that the write operation (including
the memory to the buffer) is written before it is visible to the other
thread in get() (which in turn "acquires" it). For more information, see
also [1].

The rest of the library has been simplified to work only with put() and
get(), reducing total code and the surface for possible bugs.

This (and the previous) version has been tested with the
threadSanitizer:

    TSAN_OPTIONS=halt_on_error=1 ./common/utils/ds/tests/test_spsc_q_perf

On my machine, using Google Benchmark, I measure a considerable 5x speed
improvement:

    $ /tmp/benchmark/tools/compare.py benchmarks pthread.json atomic.json
    Comparing pthread.json to atomic.json
    Benchmark                         Time             CPU      Time Old      Time New       CPU Old       CPU New
    --------------------------------------------------------------------------------------------------------------
    BM_spsc_q/10                   -0.8201         -0.0740     266779912      47989020         52387         48512
    BM_spsc_q/16                   -0.8301         -0.0520     249656592      42428540         51462         48784
    BM_spsc_q/32                   -0.8003         -0.0841     230248798      45972155         53841         49311
    BM_spsc_q/64                   -0.7995         -0.0506     210429791      42199674         50690         48124
    BM_spsc_q/128                  -0.7930         -0.1101     205212273      42483155         52745         46936
    BM_spsc_q/160                  -0.7880         -0.1663     216644738      45938247         53400         44518
    OVERALL_GEOMEAN                -0.8057         -0.0904             0             0             0             0

[1] https://en.cppreference.com/w/c/atomic/memory_order.html

Assisted-By: Claude:claude-sonnet-4-6
Signed-off-by: Robert Schmidt <robert.schmidt@openairinterface.org>
2026-04-16 11:53:19 +02:00
francescomani
3ff08f25ca remove UNUSED_VARIABLE and replace with UNUSED 2026-04-15 12:29:58 +02:00
Robert Schmidt
34aad5d276 Add spsc_q data structure library
This data structure is designed to support the use cases of the L1,
i.e., provide a queue which can be quickly used to order L1 jobs in FIFO
order with simple iteration of jobs to treat. It is a Single-Consumer
Single-Producer queue library.

Signed-off-by: Robert Schmidt <robert.schmidt@openairinterface.org>
2026-04-15 11:26:21 +02:00
Robert Schmidt
51e17fd7c8 Add test_tpool_vs_actors to unit tests
Signed-off-by: Robert Schmidt <robert.schmidt@openairinterface.org>
2026-04-15 10:27:19 +02:00
Robert Schmidt
449910dbc7 Add fsn lib to simplify frame/slot handling
Refactor existing code, and harmonize interface. Add a couple of tests.

Signed-off-by: Robert Schmidt <robert.schmidt@openairinterface.org>
2026-04-15 10:26:53 +02:00
Sagar Arora
9fe14b784f fix(record_db doc): correct the path for T_messages.txt and mention use of ninja/make
Signed-off-by: Sagar Arora <sagar.arora@openairinterface.org>
2026-04-14 09:42:15 +02:00
Robert Schmidt
90ec531554 Hashtable: remove unused code
Signed-off-by: Robert Schmidt <robert.schmidt@openairinterface.org>
2026-04-13 17:21:29 +02:00
francescomani
a1ab732111 adding separated NR_PHY_RU library split from LTE one 2026-04-10 11:07:03 +02:00
Guido Casati
e27f8c24cf Refactor (F1AP/RRC): convert SIB containers to byte_array_t
Unify SIB container handling by introducing a typed SIB enum and storing
SIB payloads as byte_array_t across common NR types, F1AP helpers, MAC,
and RRC DU setup code.

Changes:
- Include byte_array support in nr_common.h, add nr_sib_type_t (NR_SIB_1–NR_SIB_21),
  and change nr_SIBs_t to hold only nr_sib_type_t SIB_type.
- Switch f1ap_sib_msg_t in f1ap_messages_types.h to use a byte_array_t SI_container
  instead of raw pointer and length fields.
- Update F1AP encode/decode, equality, copy, and free helpers in
  f1ap_interface_management.c to work on SI_container.buf / SI_container.len and
  use eq_byte_array, copy_byte_array, and free_byte_array.
- Adapt F1AP tests in f1ap_lib_test.c to build and inspect SIB containers via
  SI_container.buf and SI_container.len.
- Replace magic SIB numbers with nr_sib_type_t values in gnb_config.c
  (get_sys_info and fill_du_sibs) to validate and configure DU SIBs.
- Rework nr_mac_configure_other_sib in NR_MAC_gNB/config.c to decode SIB2
  from a byte_array_t container, fix freeing by releasing the decoded sib2 on
  failure, and use NR_SIB_2 / NR_SIB_19 for CU/DU SIB selection.
- Add an add_si_msg helper in rrc_gNB_du.c and refactor the SIB2 branch of
  rrc_gNB_process_f1_setup_req to populate cell->SI_msg from encoded local
  byte array while iterating SIBs with FOR_EACH_SEQ_ARR.
2026-04-10 10:22:50 +02:00
Guido Casati
425ea41ba5 fix (Config API): make config integer checks type-correct and add unsigned range validator
Change 1: config_check_intval() now uses the correct integer pointer for TYPE_INT

Problem: config_check_intval() previously dereferenced param->uptr regardless
of param->type. For parameters declared as signed (TYPE_INT / TYPE_INT32), the
active union member is param->iptr, and param->uptr may be NULL -> using uptr
makes validation unsafe and type-inconsistent.

What changed: Updated config_check_intval() behavior (signature unchanged).
Handle both param->type, param->iptr and param->uptr.

Change 1: new config_check_uintrange() for unsigned range constraints

Problem: there was a signed range checker (config_check_intrange()) that reads
param->iptr, but there was no dedicated unsigned range validator using param->uptr.

What changed: added config_check_uintrange() in config_userapi.h/.c
The new function reads param->uptr as uint32_t and validates against
param->chkPptr->s2.okintrange[] endpoints.

Change 3: constify input params for f2 function pointers

Problem: checkedparam_t.s2.f2 was typed with non-const input params, even though
range checks only read. A safer const-safe signature is required.

What changed: s2.f2 now takes const configmodule_interface_t *
and const paramdef_t *. config_check_intrange() and config_check_uintrange() use
the same const-qualified parameters.
2026-04-10 10:22:48 +02:00
Guido Casati
dc260bd4d9 Fix (config API): print correct integer pointer in range check
Use the integer pointer when reporting invalid integer values:
in `config_check_intrange()` error print from `param->uptr` to
`param->iptr`.
2026-04-10 10:21:56 +02:00
Jaroslava Fiedlerova
83ffa53ccc fix compilation of T tracers with 'make'
Modification required after !3977 is merged.
2026-04-09 16:30:42 +02:00
Robert Schmidt
90ff73798a Merge remote-tracking branch 'origin/record_db-doc' into integration_2026_w15 (!4038)
doc(record_db): explain how to use record_db

Documentation for how to use record_db
2026-04-09 09:43:47 +02:00
Sagar Arora
51d8441927 doc(record_db): explain how to use record_db
Signed-off-by: Sagar Arora <sagar.arora@openairinterface.org>
Reviewed-by: Nick Hedberg <nhedberg@nvidia.com>
Reviewed-by: Robert Schmidt <robert.schmidt@openairinterface.org>
Assisted-by: gpt-5.4
2026-04-09 09:36:09 +02:00