diff --git a/doc/FEATURE_SET.md b/doc/FEATURE_SET.md index 95aa32166f..bc6ba6b4a3 100644 --- a/doc/FEATURE_SET.md +++ b/doc/FEATURE_SET.md @@ -154,7 +154,7 @@ These modes of operation are supported: - RedCap SIB1 v17 IEs supported - Coexistence of RedCap and Normal UEs - Handling of RedCap capability for small PDCP/RLC SN size -- Scheduling of other SIBs (2, 19) +- Scheduling of other SIBs (2, 3, 4, 19) - NTN - Support downlinkHARQ-FeedbackDisabled-r17 - Support for 32 PDSCH and PUSCH HARQ processes per UE @@ -194,7 +194,7 @@ These modes of operation are supported: - NR RRC (38.331) Rel 17 messages using new [asn1c](https://github.com/mouse07410/asn1c) - LTE RRC (36.331) also updated to Rel 15 -- Generation of system information (SIB2) +- Generation of system information (SIB2, SIB3, SIB4) - RRC can configure PDCP and SDAP (through E1), and RLC and MAC (through F1) - Interface with GTP-U (tunnel creation/handling for S1-U (NSA), N3 (SA), F1 interfaces) - Integration of RRC messages and procedures supporting UE 5G SA connection @@ -380,7 +380,7 @@ These modes of operation are supported: - MIB processing - Scheduling of system information block 1 (SIB1) reception * Other system information - - Scheduling of other system information blocks reception + - Scheduling of other system information blocks reception (SIB2, SIB3, SIB4) * Random access procedure (needs improvement, there is still not a clear separation between MAC and PHY) - Mapping SSBs to multiple ROs - Scheduling of PRACH diff --git a/doc/RRC/rrc-dev.md b/doc/RRC/rrc-dev.md index eee1b861fa..a218997d3a 100644 --- a/doc/RRC/rrc-dev.md +++ b/doc/RRC/rrc-dev.md @@ -633,6 +633,98 @@ sequenceDiagram Note over TargetCU: Then: encode Handover Command, send NGAP HANDOVER REQUEST ACKNOWLEDGE ``` +### Neighbour cells + +#### SIB3/SIB4 and measurement-gap implementation + +The following section documents the implementation-level control flow +for SIB3/SIB4 and measurement-gap handling in current OAI, using the configured +neighbor cell list as a shared input model. + +Briefly, the three procedures are: +- SIB3: CU derives and provides intra-frequency neighbour SI, which DU broadcasts + and UE uses for autonomous idle/inactive intra-frequency reselection. +- SIB4: CU derives and provides inter-frequency carrier/neighbour SI, which DU + broadcasts and UE uses for autonomous idle/inactive inter-frequency reselection. +- MeasGap: CU/DU coordinate dedicated `MeasGapConfig` in UE `MeasConfig`, DU + scheduler interrupts transmission (`nr_measgap_scheduling()`) for the UE to + apply the MeasGap configuration in connected mode for gap-based measurements that + are sent as `MeasurementReport` and processed at CU-CP (`rrc_gNB_process_MeasurementReport()`). + Event-driven reports (for example A3) are used by CU-side mobility logic and can + trigger handover procedures. + +### MeasGap + +```mermaid +sequenceDiagram + participant DM as Data model (neighbour_cell_configuration) + participant CU as CU-CP (RRC) + participant DU as DU (MAC/RRC) + participant UE as UE + + CU-->>DM: Read serving + neighbour frequency/PCI/band data + DM-->>CU: Provide neighbour/frequency inputs for MeasConfig + CU->>CU: nr_rrc_get_measconfig + Note over CU: Build UE MeasConfig + CU->>CU: get_meas_timing_config (cell.mtc, ue.measConfig) + Note over CU: Check distinct ssbFrequency + alt one frequency only + Note over CU: returns NULL, no meas_timing_config sent to DU + else multiple frequencies + CU->>DU: F1AP UE Context Setup Request + Note over CU,DU: Includes cu_to_du_rrc_info.meas_timing_config + DU->>DU: create_measgap_config + DU->>DU: encode_measgap_config + DU-->>CU: F1AP UE Context Setup Response + Note over DU,CU: Includes du_to_cu_rrc_info.meas_gap_config + CU->>CU: get_meas_gap_config + Note over CU: Decode/store gap in UE MeasConfig (UE.measConfig.measGapConfig) + CU->>UE: RRCReconfiguration + Note over CU,UE: Includes MeasConfig.measGapConfig + rect rgba(210, 235, 255, 0.35) + Note over DU,UE: Measurement-gap window + DU->>DU: nr_measgap_scheduling + Note over DU: Interrupt transmission for meas gap + UE->>UE: nr_rrc_handle_meas_indication + Note over UE: Perform gap-based neighbour/inter-frequency measurements + UE-->>CU: MeasurementReport + end + Note over UE,CU: UL-DCCH MeasurementReport for configured events (e.g. A3) + CU->>CU: rrc_gNB_process_MeasurementReport + Note over CU: Run mobility decision logic (may trigger handover) + end +``` + +### SIB3/SIB4 + +```mermaid +sequenceDiagram + participant DM as Data model (neighbour_cell_configuration) + participant CU as CU-CP (RRC) + participant DU as DU + participant UE as UE + + CU->>CU: cp_f1_served_cell_info_to_cell + CU->>DM: get_cell_neighbour_list + DM-->>CU: neighbour_cell_configuration for serving cell + CU->>CU: get_ssb_arfcn + Note over CU: Derive serving_ssb_arfcn from cell MTC + loop for each configured neighbour + Note over CU: Compare neighbour.absoluteFrequencySSB vs serving_ssb_arfcn + alt equal + CU->>CU: get_sib3_intra_freq_neighbors + else different + CU->>CU: get_sib4_inter_freq_neighbors + end + end + CU-->>DU: F1AP F1 Setup Response + DU-->>UE: BCCH-DL-SCH-Message + Note over DU,UE: Broadcast SystemInformation including configured SIB3/SIB4 + UE->>UE: nr_rrc_ue_decode_NR_BCCH_DL_SCH_Message + Note over UE: Evaluate idle/inactive reselection criteria and timers + Note over UE,DU: After reselection, access/registration continues on selected cell DU as needed +``` + ## UE Context UE context information is stored in `gNB_RRC_UE_t`, which includes: diff --git a/doc/RRC/rrc-usage.md b/doc/RRC/rrc-usage.md index 46ff9f061c..e828001d1b 100644 --- a/doc/RRC/rrc-usage.md +++ b/doc/RRC/rrc-usage.md @@ -94,7 +94,81 @@ the [MAC configuration](../MAC/mac-usage.md) as well for SIB configuration. deactivated, a transparent SDAP header is prepended to packets, but no further processing is being done. - `cu_sibs` (default: `[]`) list of SIBs to give to the DU for transmission. - Currently, SIB2 is supported. + Currently supported: + - SIB2: serving-cell reselection parameters (configured in `sib2_config`) + - SIB3: intra-frequency neighbour cell list (neighbours on the same SSB ARFCN as the serving cell) + - SIB4: inter-frequency carriers + neighbour lists, grouped per `(absoluteFrequencySSB, subcarrierSpacing)`. Per-frequency fields (e.g. `cellReselectionPriority`, `threshX_HighP`, `threshX_LowP`, `q_OffsetFreq`) come from `frequency_list` + +Example activation: +``` +cu_sibs = ( 2, 3, 4 ); +``` +SIB2 is configured per-gNB in `sib2_config` (see below). SIB3/SIB4 are derived from the neighbour configuration: +- `neighbour_list` / `neighbour_cell_configuration`: neighbour identity + per-neighbour offsets (`q_OffsetCell`, etc.) +- `frequency_list`: per-frequency SIB4 reselection parameters (priority/thresholds/`q_OffsetFreq`) + +Example `gNBs.[0].sib2_config`: +``` +cu_sibs = ( 2 ); + +sib2_config : { + q_Hyst = 0; + cellReselectionPriority = 0; + threshServingLowP = 0; + threshServingLowQ = 4; + s_NonIntraSearchP = 10; + s_NonIntraSearchQ = 8; + q_RxLevMin = -56; + q_QualMin = -18; + s_IntraSearchP = 22; + s_IntraSearchQ = 20; + t_ReselectionNR = 1; + deriveSSB_IndexFromCell = 1; + + speed_t_Evaluation = 0; + speed_t_HystNormal = 0; + speed_n_CellChangeMedium = 1; + speed_n_CellChangeHigh = 2; + speed_sf_Medium = 1; + speed_sf_High = 0; +}; +``` + +#### SIB3/SIB4 and measurement gaps + +This section summarizes how SIB3/SIB4 and measurement gaps relate in NR and how OAI currently implements them. + +From 3GPP TS 38.331: + +- `SIB3` carries intra-frequency reselection information (`intraFreqNeighCellList`). +- `SIB4` carries inter-frequency reselection information (`interFreqCarrierFreqList` + and per-carrier neighbour lists). +- `MeasGapConfig` is part of dedicated `MeasConfig` (typically sent in + `RRCReconfiguration`) and controls measurement gaps in connected mode. + +In other words: + +- SIB3/SIB4 are broadcast SI for idle/inactive (`RRC_IDLE` / `RRC_INACTIVE`) + reselection behavior: UE performs autonomous cell reselection using broadcast + SI (SIB3 for intra-frequency, SIB4 for inter-frequency). +- `MeasGapConfig` is a dedicated UE measurement behavior and applies to + connected mode (`RRC_CONNECTED`): the network configures what the UE + measures and reports (periodic and event-based, e.g., A3), and those reports + are used by CU-CP mobility logic (including handover decisions). + +MeasGap does not depend on SIB3/SIB4, however they share the same underlying +neighbour/frequency data model, which is the common source of serving + +neighbour frequency information (see also [Neighbor-gNB configuration](#neighbour-gnb-configuration)): + +- SIB3/SIB4 generation is done on the CU-CP side (inside `rrc_gNB_du.c`) from + neighbour/frequency configuration and serving-cell MTC-derived ARFCN. +- Measurement-gap configuration also starts from the same neighbour/frequency + model: CU uses neighbour fields (frequency/PCI/band) to build UE + `MeasConfig` measurement objects, then DU derives/encodes gap parameters + from CU-provided timing (`meas_timing_config`) and returns `meas_gap_config` + for CU forwarding in dedicated `RRCReconfiguration`. + +Detailed implementation flow and sequence diagrams are documented in [`rrc-dev.md`](./rrc-dev.md). #### UE-specific configuration @@ -105,12 +179,64 @@ the [MAC configuration](../MAC/mac-usage.md) as well for SIB configuration. Refer to the [handover tutorial](../handover-tutorial.md) for detailed information about gNB neighbors and handover procedures. +##### Configuration structure and key semantics + +The neighbour configuration is a 2-level structure: + +- Outer list: `neighbour_list` + - Key: `nr_cellid` of the serving cell + - One entry per serving cell +- Inner list: `neighbour_cell_configuration` + - Actual neighbour cells for that serving cell + - Contains neighbour fields such as `gNB_ID`, neighbour `nr_cellid`, `physical_cellId`, frequency, PLMN, etc. + +This same core configuration model is reused by multiple RRC procedures. + +- SIB3/SIB4 generation: uses neighbour identity/frequency/offset fields to derive + intra/inter-frequency SI. +- Connected-mode measurement config: uses neighbour frequency/PCI/band fields to build + UE `MeasConfig` measurement objects. +- Handover-related procedures: reuse neighbour identity fields (e.g., cell ID/PCI/PLMN + TAC, gNB ID) for target selection and for populating target-cell information carried + in NGAP handover messages. + +Conceptually, for each serving cell the RRC keeps: + +- A per-frequency table (`inter_freqs`): one entry per `(absoluteFrequencySSB, + subcarrierSpacing)` used for SIB4, containing the SIB4 per-frequency fields + (priority, thresholds, `q_OffsetFreq`, `q_RxLevMin`, `t_ReselectionNR`). +- A per-neighbour list (`neighbour_cells`): one entry per neighbour, with + identity (cell ID, PCI, PLMN, TAC), frequency (`absoluteFrequencySSB`, + `subcarrierSpacing`, `band`), and SIB3/SIB4 per-neighbour offsets + (`q_OffsetCell`, `q_RxLevMinOffsetCell`, `q_QualMinOffsetCell`). +- A link from neighbours to frequencies: each neighbour implicitly points to + the matching `inter_freqs` entry via its `(absoluteFrequencySSB, + subcarrierSpacing)`; if no such frequency exists, it is treated as having no + SIB4 per-frequency configuration. + +Notes: + +- In `neighbour_list`, only `nr_cellid` is used as the key for lookup. +- `physical_cellId` belongs to neighbour-cell entries in `neighbour_cell_configuration` (inner list). +- `nr_cellid` entries in `neighbour_list` should be unique to avoid ambiguous lookup. +- Intra-frequency neighbours (SIB3) are derived only from the per-cell + `neighbour_cell_configuration` on the serving carrier. + +At configuration time (`gnb_config.c`), neighbours are parsed into `neighbour_cells`, +per-neighbour SIB3/SIB4 offsets are validated, and a per-frequency array `inter_freqs` +is built by grouping neighbours by `(absoluteFrequencySSB, subcarrierSpacing)` and +in-range SIB4 per-frequency fields (`cellReselectionPriority`, `threshX_HighP/L`, +`q_OffsetFreq`) across neighbours on the same ARFCN. At SIB4 build time, the RRC uses +`inter_freqs` to create one `InterFreqCarrierFreqInfo` per ARFCN for inter-frequency +carriers (ARFCN different from the serving SSB ARFCN) and attaches all neighbours whose +`inter_freq_idx` points to that frequency entry. + ##### Required configuration parameters -To define a neighbor cell in the configuration file, the following parameters are required: +To define a neighbour cell in the configuration file, the following parameters are required: -- `gNB_ID` - identifier of the neighbor gNB (e.g., `0xe01`) -- `nr_cellid` - cell identifier of the neighbor cell (e.g., `11111111`) +- `gNB_ID` - identifier of the neighbour gNB (e.g., `0xe01`) +- `nr_cellid` - cell identifier of the neighbour cell (e.g., `11111111`) - `physical_cellId` - physical cell ID for radio identification (e.g., `1`) - `absoluteFrequencySSB` - SSB frequency in ARFCN notation (e.g., `643296`) - `subcarrierSpacing` - numerology index: 0=15kHz, 1=30kHz, 2=60kHz, 3=120kHz @@ -123,19 +249,45 @@ To define a neighbor cell in the configuration file, the following parameters ar Example configuration structure: ``` +# Per-frequency SIB4 configuration (one entry per ARFCN), shared by all cells +frequency_list = ( + { + absoluteFrequencySSB = 643296; + subcarrierSpacing = 1; # 30 kHz + band = 78; + + frequency_config = ( + { + cellReselectionPriority = 5; + threshX_HighP = 10; + threshX_LowP = 6; + q_OffsetFreq = 0; + # Optional: threshX_HighQ, threshX_LowQ, etc. + } + ); + } +); + +# Per-cell neighbour configuration; neighbours reference frequency_list via ARFCN/SCS neighbour_list = ( { nr_cellid = 12345678; + neighbour_cell_configuration = ( { gNB_ID = 0xe01; nr_cellid = 11111111; physical_cellId = 1; - absoluteFrequencySSB = 643296; - subcarrierSpacing = 1; # 30 kHz + absoluteFrequencySSB = 643296; # ARFCN used to look up matching entry in frequency_list + subcarrierSpacing = 1; # 30 kHz band = 78; plmn = { mcc = 001; mnc = 01; mnc_length = 2 }; tracking_area_code = 1; + + # Example per-neighbour offsets (SIB3/SIB4) + q_OffsetCell = 0; + q_RxLevMinOffsetCell = -1; + q_QualMinOffsetCell = -1; } ); } diff --git a/doc/handover-tutorial.md b/doc/handover-tutorial.md index 68e685c83d..02736da931 100644 --- a/doc/handover-tutorial.md +++ b/doc/handover-tutorial.md @@ -512,8 +512,16 @@ configuration, e.g. [neighbour-config-rfsim.conf](../../ci-scripts/conf_files/ne This configuration can also be present in a different file and included in the gNB configuration file with `@include "neighbour-config-rfsim.conf"`. -For each gNB there is a `neighbour_cell_configuration` linked to its serving -cell ID. +The neighbor configuration is nested: + +- `neighbour_list` outer entries are keyed by serving `nr_cellid` +- each outer entry contains `neighbour_cell_configuration`, i.e., the list of neighbor cells for that serving cell + +In this model: + +- outer `nr_cellid` entries should be unique +- neighbor `physical_cellId` values are defined in inner neighbor entries +- the same serving-cell keyed neighbor mapping is used for both F1 and N2 handover logic See the example above for `neighbour-config-ho.conf`. The same configuration is for both F1 and N2 handover.