Remove an assert on successful dup() of a socket. At least when running
in phy-test mode without noS1, the socket does not exist, and the call
to dup() fails. In that case, we should carry on instead of simply
failing, similarly how the process does not abort when TUN setup fails.
Fixes: 8d2895463b ("Paging UE (SDAP): reattach TUN after idle reset")
Signed-off-by: Robert Schmidt <robert.schmidt@openairinterface.org>
CI: Add UE timing phytest (#188)
Add a new XML file to also measure UE timings, similarly how we do with
gNB.
Reviewed-by: Robert Schmidt <robert.schmidt@openairinterface.org>
Check timing thresholds on both UE and gNB side. If this commit works as
expected, it can replace xml_files/gnb_phytest_usrp_run.xml.
Signed-off-by: Jaroslava Fiedlerova <jaroslava.fiedlerova@openairinterface.org>
Allow XML test cases to specify one or more files with timing stats that
define which container log paths to collect and analyze. AnalyzeRTStatsObject
loops over the provided list, falling back to the default gNB files
(nrL1_stats.log, nrMAC_stats.log) when none are specified.
Assisted-by: Claude:claude-sonnet-4-6
Signed-off-by: Jaroslava Fiedlerova <jaroslava.fiedlerova@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>
- Add a LOG_I to 'nr_sdap_add_entity' to inform the user
a SDAP entity is being created
- Add LOG_W to `nr_sdap_get_entity` to warn about
empty SDAP entity list
Signed-off-by: Guido Casati <guido.casati@openairinterface.org>
Add an RRC telnet command that sends a RAN-initiated NGAP UE Context Release
Request with a user-inactivity cause.
Register ctx_rel_req in the RRC telnet command table.
Signed-off-by: Guido Casati <guido.casati@openairinterface.org>
After the UE answers a network page with a NAS Service Request, it waits
in 5GMM-SERVICE-REQUEST-INITIATED until the AMF replies or the radio
connection drops.
While that wait is active, duplicate pages must be ignored. When SR ends,
NAS must return to 5GMM-REGISTERED so a later page can start a new SR
(TS 24.501).
Changes:
- handle_service_accept(): set FGS_REGISTERED on SERVICE ACCEPT (TS 24.501 §5.6.1.4)
- handle_service_reject(): if SR was pending, set FGS_REGISTERED (§5.6.1.5)
- NR_NAS_CONN_RELEASE_IND: if SR was pending, set FGS_REGISTERED (§5.3.1.3 and §5.6.1.7 l)
Signed-off-by: Guido Casati <guido.casati@openairinterface.org>
UE paging can recreate the AS-side SDAP entity while NAS still keeps the
PDU session established. Per TS 38.304 clause 7.1 and TS 24.501 clauses
5.6.2.2.1,5.6.1.2 paging/service request restores user-plane resources
for an established PDU session, it does not imply deleting the UE IP/TUN
interface.
Deleting the UE TUN with SDAP entity teardown breaks user-plane continuity
after re-attach. We need SDAP entity lifetime and UE TUN lifetime to be
decoupled. This commit keeps a UE/PDU-session TUN registry outside the
SDAP entity lifetime. When a UE SDAP entity is recreated, reattach it
to the preserved TUN socket and restart the reader thread. On first PDU
session setup, NAS registers the TUN before attaching the reader.
The sequence is the following: (1) NAS register the iface
(2) sdap entity attaches to the iface (3) UE goes IDLE, SDAP
entity is destroyed, iface is deatched and brought down (4)
UE Service Request, SDAP entity is created (5) iface reattaches
to the SDAP entity and is brought up
UE reattach assumes the PDU session TUN interface was registered
before the SDAP entity is recreated.
DL/UL data is intentionally dropped when SDAP is not yet attached
or QFI is unavailable, rather than queued in this layer.
Changes:
- `nr_sdap.c`: keep a UE/PDU-session TUN registry, duplicate the stored
socket into each SDAP entity, and add attach/detach/destroy helpers.
- `nr_sdap_entity.c`: detach SDAP entities from their TUN reader on
deletion, preserve UE TUN interfaces across idle cleanup, and destroy
gNB TUN interfaces when the gNB entity is removed. Drop downlink SDUs
if the UE SDAP entity is not attached to a TUN socket yet.
- `openair3/NAS/NR_UE/nr_nas_msg.c`: set QFI before UE TUN creation so
first attach can pick up cached QFI.
- `common/utils/tuntap_if.c`: add `tuntap_set_up`/`tuntap_set_down` helpers
for UE interface state reflection and initialize `flags` in `tuntap_destroy`
to avoid maybe-uninitialized build failures.
Signed-off-by: Guido Casati <guido.casati@openairinterface.org>
Fix UE PUCCH resource multiplexing (#154)
TS 38.213 9.5.2 specifies that if the UE wants to send HARQ-ACK and CSI
report on format 2/3/4, then the resource is selected by the PUCCH
resource indicator for sending HARQ-ACK.
In this case the resource set must be >= 1 because O_UCI has HARQ-ACK
and CSI report and is > 2.
So far we use the PUCCH resource of CSI report if HARQ-ACK format is < 2
and CSI report is >= 2. This PR fixes it.
Closes: #90
Reviewed-by: Francesco Mani <email@francescomani.it>
XNAP: Add encode/decode+unit tests for Xn HO Cancel, HO Success, RAN Paging (#178)
Extends the XNAP encode/decode library with three class 2 procedures
from 3GPP TS 38.423 v16.2.0, each with full encode/decode/eq/free
support and an APER round-trip unit test.
Handover Cancel (§9.1.1.6): Sent by the source node to abort an
in-progress handover before the UE has accessed the target cell.
- Source NG-RAN node UE XnAP ID (M)
- Cause (M)
Handover Success (§9.1.1.12): Sent by the target node to confirm the UE
has successfully accessed the target cell.
- Source NG-RAN node UE XnAP ID (M)
- Target NG-RAN node UE XnAP ID (M)
- Requested Target Cell Global ID (M)
RAN Paging (§9.1.1.7): Requests a neighbouring NG-RAN node to page a UE
in RRC_INACTIVE state.
- UE Identity Index Value (M) â 10-bit BIT STRING
- UE RAN Paging Identity (M) â 40-bit I-RNTI BIT STRING
- Paging DRX (M)
- RAN Paging Area (M) â cell-list variant, one PLMN + NR cell IDs
Reviewed-by: Robert Schmidt <robert.schmidt@openairinterface.org>
Reviewed-By: Guido Casati <guido.casati@openairinterface.org>
- Add RAN Paging message type definitions, including paging DRX
enumeration (§9.2.3.66) and RAN paging area cell-list
structure (§9.2.3.38)
- Implement encoder and decoder for RAN Paging
RAN Paging (3GPP TS 38.423v16.2.0 §9.1.1.7)
- UE Identity Index Value (M)
- UE RAN Paging Identity (M)
- Paging DRX (M)
- RAN Paging Area (M)
- Add equality check and memory management helpers
- Add required ASN.1 header includes for RAN Paging IEs
- Extend XNAP library unit tests to cover RAN Paging
Reviewed-by: Venkatareddy Akumalla <venkatareddy.akumalla@openairinterface.org>
Signed-off-by: Mohammed Safwan <mohammed.safwan@openairinterface.org>
Fix vrtsim antenna configs (#144)
This PR fixes three issues: #130#125, and an unreported issue related
to flaky vrtsim tests. With the new unix domain socket initialization
the unit test framework should be much more robust and not fail
randomly.
Reviewed-By: Merkebu Girmay <merkebu.girmay@openairinterface.org>
Reviewed-by: Robert Schmidt <robert.schmidt@openairinterface.org>
Change ambigous language in Aerial_FAPI_Split_Tutorial.md (#176)
This PR addresses Issue 1103
(https://gitlab.eurecom.fr/oai/openairinterface5g/-/work_items/1103),
changing one note in Aerial_FAPI_Split_Tutorial.md regarding CN core
allocation when running on the same server. The original wording could
be interpreted as allocating a separate core to each of the core network
functions, when that's not the intended interpretation.
Reviewed-by: Jaroslava Fiedlerova <jaroslava.fiedlerova@openairinterface.org>
As per 38.213 9.5.2 when multiplexing pucch resources of harq ack and csi
report, the resource is selected from the set id >= 1.
Closes: 90
Signed-off-by: Sakthivel Velumani <s.velumani@northeastern.edu>
Refactored the function merge_resources() to minimize code repetition.
The function logic is unchanged.
Assisted-by: Claude Sonnet 4.6
Signed-off-by: Sakthivel Velumani <s.velumani@northeastern.edu>
- Fix vrtsim uneven antenna configurations
- Fix shm_td_iq_channel client-server SHM race
- Set shm size to 2G in unit test docker run to prevent out-of-memory errors
Closes: #130
Signed-off-by: Bartosz Podrygajlo <bartosz.podrygajlo@openairinterface.org>
Move the initial IPC from file-based to Unix Domain Socket. The server
keeps a lightweights UDS accept / write thread while the clients attempt
to connect / read from the socket. This makes the communication more robust
because if the server process exits, it will always result in a failure to
connect from the client. With file-based IPC this was not always the case.
Assisted-by: Gemini-3.5:Flash
Closes: #125
Signed-off-by: Bartosz Podrygajlo <bartosz.podrygajlo@openairinterface.org>
Prior commits stored PCCH parameters and can decode P-RNTI,
this commit schedules PDCCH monitoring at the right TTIs.
In camped idle the UE must listen for network paging on P-RNTI only on
the correct paging frame (PF) and paging occasion (PO), only if the
paging common search space is set.
On monitor_paging_dci() success it adds P-RNTI to the downlink DCI
config for the existing PHY/MAC paging decode path.
Changes:
- Add monitor_paging_dci():
- resolve paging_SS_id, call config_dci_pdu(TYPE_P_RNTI_) only
when monitor_paging_dci() is true.
- require is_ss_monitor_occasion on the paging search space
- validate T/N/Ns from mac->paging_cfg
- apply TS 38.304 §7.1 PF and i_s
- PF via nr_pcch_sfn_is_pf
- PO index i_s via nr_pcch_po_index
- non-zero type-2 PO window via nr_pcch_type2_po_mo_in_range
Refs:
- 3GPP TS 38.304 §7.1 (PF/PO)
- 3GPP TS 38.213 §10.1 (PDCCH monitoring for paging)
Signed-off-by: Guido Casati <guido.casati@openairinterface.org>
Keep normal no-redirection RRCRelease on the acquired
camped-cell context while preserving the existing full
GO_TO_IDLE cell-selection path for other idle transitions.
Changes:
- Add UE_IDLE and GO_TO_IDLE_KEEP_CAMPED to represent camped
idle without starting RA.
- Map no-redirection RRCRelease to GO_TO_IDLE_KEEP_CAMPED and
keep SIB1 validity for that path.
- Release connected-mode MAC/BWP0 dedicated config while
preserving common BWP0 and paging PDCCH context.
- Keep the existing full GO_TO_IDLE cleanup for idle transitions
that must perform cell selection.
Refs:
- TS 38.331 §5.3.11
- TS 38.304 §5.2.5, §5.2.6, §7.1
- TS 38.321 §5.12
Signed-off-by: Guido Casati <guido.casati@openairinterface.org>
Route paging-triggered Service Request through NAS_INITIAL_UL_TRANSFER_REQ so
RRC can buffer the PDU for RRCSetupComplete (dedicatedNAS-Message, TS 38.331)
when no UL-DCCH SRB exists, start MAC RA from RRC_IDLE, or drop the ITTI PDU
with LOG_W if SRB1/SRB2 is already established (NAS paging path is 5GMM-IDLE
only).
Changes:
- Define ITTI NAS_INITIAL_UL_TRANSFER_REQ and
NAS_INITIAL_UL_TRANSFER_REQ() (rrc_messages_def.h,
rrc_messages_types.h).
- Extend NR_UE_RRC_INST_t with pending_initial_nas for setup-complete
transport (rrc_defs.h).
- Refactor ULInformationTransfer+PDCP send into
nr_rrc_ue_send_ul_information_transfer_nas(): on NAS_UPLINK_DATA_REQ,
refuse PDCP when neither SRB1 nor SRB2 is established (free PDU).
- On NAS_INITIAL_UL_TRANSFER_REQ: store NAS in pending_initial_nas when
no SRB, in RRC_STATE_IDLE_NR set ra_trigger to RRC_CONNECTION_SETUP,
call nr_rrc_ue_prepare_RRCSetupRequest(), and nr_rrc_send_msg_to_mac()
with NR_MAC_RRC_START_RA, otherwise replace pending and send on SRB.
- Use forwarded initial NAS messafe in rrc_ue_generate_RRCSetupComplete():
if pending_initial_nas is set, move it into the NAS payload and refresh
security keys when integrity context exists, else generateRegistrationRequest().
- In nr_nas_msg.c, add send_nas_initial_ul_transfer_req() and use it for
paging Service Request instead of send_nas_uplink_data_req()
Refs: TS 24.501, TS 38.331 §5.3.3.4, TS 33.501 §6.8.1.2
Signed-off-by: Guido Casati <guido.casati@openairinterface.org>
RRC starts random access via NR_MAC_RRC_START_RA with an explicit
cause. RA trigger is no longer piggybacked on NR_MAC_RRC_CONFIG_RESET.
T300 expiry and RRC re-establishment are the call sites switched in this
commit. MAC handles setup/T300 and re-establishment paths in
nr_mac_start_ra().
Changes:
- Add nr_mac_rrc_types.h (nr_mac_ra_start_cause_t)
- Add nr_mac_rrc_start_ra_t in rrc_messages_types.h
- In rrc_UE.c, add nr_rrc_trigger_mac_ra(), call it from
handle_t300_expiry and nr_rrc_initiate_rrcReestablishment
- In config_ue.c:
- add nr_mac_start_ra() entry point with causes switch
- add nr_rrc_mac_start_ra() handler
- remove T300_EXPIRY, RE_ESTABLISHMENT reset handling
in nr_rrc_mac_config_req_reset, now delegated to
nr_mac_start_ra
- mac_defs.h: drop T300_EXPIRY from NR_UE_MAC_reset_cause_t
Signed-off-by: Guido Casati <guido.casati@openairinterface.org>
Transfer UE-side paging matches from RRC to NAS so a registered idle UE
can generate and send a Service Request after `NAS_PAGING_IND`. Guard
the path with explicit cause, identity, state, and mode checks so
unsupported cases are logged and ignored.
Changes:
- in `rrc_UE.c`, send `NAS_PAGING_IND` to TASK_NAS_NRUE with cause
`AS_CONNECTION_ESTABLISH` from `rrc_nrue()` when a paging match is found
- in `nr_nas_msg.c`, implement `NAS_PAGING_IND` handling in `nas_nrue()`
- accept only paging indications with cause
`AS_CONNECTION_ESTABLISH`, then require `nas->guti`,
`FGS_REGISTERED`, and `FGS_IDLE` before proceeding
- generate the Service Request with `generateServiceRequest()` and send
it through `send_nas_uplink_data_req()`
Refs:
- TS 23.502 §4.2.3.3 (Network Triggered Service Request)
- TS 24.501 §5.6.2.2.1 (Paging for 5GS services)
Signed-off-by: Guido Casati <guido.casati@openairinterface.org>