Merge remote-tracking branch 'origin/ue_ho_improve' into integration_2025_w50

This commit is contained in:
francescomani
2025-12-09 11:06:52 +01:00
15 changed files with 306 additions and 209 deletions
+46 -28
View File
@@ -260,8 +260,6 @@ static void config_common_ue_sa(NR_UE_MAC_INST_t *mac, NR_ServingCellConfigCommo
mac->frequency_range);
//prach_fd_occasion->num_unused_root_sequences = ???
}
cfg->prach_config.ssb_per_rach = rach_ConfigCommon->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->present-1;
}
// prepare data for orbit propagation based on SIB19 ephemeris data to be able to compute the round-trip-time between ue and sat
@@ -548,7 +546,6 @@ static void config_common_ue(NR_UE_MAC_INST_t *mac, NR_ServingCellConfigCommon_t
prach_fd_occasion->num_root_sequences =
compute_nr_root_seq(rach_ConfigCommon, nb_preambles, frame_type, mac->frequency_range);
cfg->prach_config.ssb_per_rach = rach_ConfigCommon->ssb_perRACH_OccasionAndCB_PreamblesPerSSB->present - 1;
// prach_fd_occasion->num_unused_root_sequences = ???
}
}
@@ -887,7 +884,8 @@ static void nr_configure_lc_config(NR_UE_MAC_INST_t *mac,
nr_lcid_rb_t rb)
{
NR_LC_SCHEDULING_INFO *lc_sched_info = get_scheduling_info_from_lcid(mac, lc_info->lcid);
lc_info->rb = rb;
if (rb.type != NR_LCID_NONE)
lc_info->rb = rb;
lc_info->rb_suspended = false;
if (rb.type == NR_LCID_SRB && !mac_lc_config->ul_SpecificParameters) {
// release configuration and reset to default
@@ -915,6 +913,12 @@ static void nr_configure_lc_config(NR_UE_MAC_INST_t *mac,
static nr_lcid_rb_t configure_lcid_rb(NR_RLC_BearerConfig_t *rlc_bearer)
{
nr_lcid_rb_t rb;
if (!rlc_bearer->servedRadioBearer) {
LOG_W(NR_MAC, "RLC bearer config does not contain servedRadioBearer.\n");
rb.type = NR_LCID_NONE;
return rb;
}
if (rlc_bearer->servedRadioBearer->present == NR_RLC_BearerConfig__servedRadioBearer_PR_srb_Identity) {
rb.type = NR_LCID_SRB;
rb.choice.srb_id = rlc_bearer->servedRadioBearer->choice.srb_Identity;
@@ -954,8 +958,6 @@ static void configure_logicalChannelBearer(NR_UE_MAC_INST_t *mac,
for (int i = 0; i < rlc_toadd_list->list.count; i++) {
NR_RLC_BearerConfig_t *rlc_bearer = rlc_toadd_list->list.array[i];
nr_lcid_rb_t rb = configure_lcid_rb(rlc_bearer);
if (rb.type == NR_LCID_NONE)
continue;
int lc_identity = rlc_bearer->logicalChannelIdentity;
NR_LogicalChannelConfig_t *mac_lc_config = rlc_bearer->mac_LogicalChannelConfig;
int j;
@@ -1023,7 +1025,21 @@ static bool is_cset0_present(frequency_range_t const fr, uint8_t const kssb)
return (fr == FR1) ? (kssb < 24) : (kssb < 12);
}
void nr_rrc_mac_config_req_mib(module_id_t module_id, int cc_idP, NR_MIB_t *mib, int sched_sib, bool barred)
void nr_rrc_mac_sched_sib(module_id_t module_id, int sched_sib)
{
NR_UE_MAC_INST_t *mac = get_mac_inst(module_id);
if (sched_sib == 1) {
bool const is_c0 = is_cset0_present(mac->frequency_range, mac->ssb_subcarrier_offset);
mac->get_sib1 = is_c0;
AssertFatal(is_c0, "RRC scheduling SIB1 reception but MIB indicates no SIB1 present in current cell\n");
} else if (sched_sib > 1)
mac->get_otherSI[sched_sib - 2] = true;
if (mac->state == UE_NOT_SYNC && mac->get_sib1)
mac->state = UE_RECEIVING_SIB;
}
void nr_rrc_mac_config_req_mib(module_id_t module_id, int cc_idP, NR_MIB_t *mib, bool barred)
{
NR_UE_MAC_INST_t *mac = get_mac_inst(module_id);
int ret = pthread_mutex_lock(&mac->if_mutex);
@@ -1043,22 +1059,10 @@ void nr_rrc_mac_config_req_mib(module_id_t module_id, int cc_idP, NR_MIB_t *mib,
mac->phy_config.CC_id = cc_idP;
nr_ue_decode_mib(mac, cc_idP);
if (sched_sib == 1) {
bool const is_c0 = is_cset0_present(mac->frequency_range, mac->ssb_subcarrier_offset);
mac->get_sib1 = is_c0;
AssertFatal(is_c0, "RRC scheduling SIB1 reception but MIB indicates no SIB1 present in current cell\n");
} else if (sched_sib > 1)
mac->get_otherSI[sched_sib - 2] = true;
if (get_softmodem_params()->phy_test)
mac->state = UE_CONNECTED;
else if (mac->state == UE_NOT_SYNC) {
if (IS_SA_MODE(get_softmodem_params()) && mac->get_sib1)
mac->state = UE_RECEIVING_SIB;
else
mac->state = UE_PERFORMING_RA;
}
else if (mac->state == UE_NOT_SYNC_RECONF)
mac->state = UE_PERFORMING_RA;
ret = pthread_mutex_unlock(&mac->if_mutex);
AssertFatal(!ret, "mutex failed %d\n", ret);
@@ -1714,10 +1718,13 @@ static void configure_common_BWP_ul(NR_UE_MAC_INST_t *mac, int bwp_id, NR_BWP_Up
mac->sc_info.initial_ul_BWPStart = bwp->BWPStart;
}
if (ul_common->rach_ConfigCommon) {
HANDLE_SETUPRELEASE_DIRECT(bwp->rach_ConfigCommon,
ul_common->rach_ConfigCommon,
NR_RACH_ConfigCommon_t,
asn_DEF_NR_RACH_ConfigCommon);
// ssb_perRACH_OccasionAndCB_PreamblesPerSSB is need M
// if NULL we need to maintain the information
NR_SetupRelease_RACH_ConfigCommon_t *rachcommon = ul_common->rach_ConfigCommon;
if (rachcommon->present == NR_SetupRelease_RACH_ConfigCommon_PR_setup
&& rachcommon->choice.setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB)
mac->ssb_ro_preambles = get_ssb_ro_preambles_4step(rachcommon->choice.setup->ssb_perRACH_OccasionAndCB_PreamblesPerSSB);
HANDLE_SETUPRELEASE_DIRECT(bwp->rach_ConfigCommon, rachcommon, NR_RACH_ConfigCommon_t, asn_DEF_NR_RACH_ConfigCommon);
}
if (ul_common->ext1 && ul_common->ext1->msgA_ConfigCommon_r16) {
HANDLE_SETUPRELEASE_DIRECT(bwp->msgA_ConfigCommon_r16,
@@ -1805,7 +1812,7 @@ void nr_rrc_mac_config_req_reset(module_id_t module_id, NR_UE_MAC_reset_cause_t
LOG_A(NR_MAC, "Received detach indication\n");
reset_ra(mac, true);
reset_mac_inst(mac);
nr_ue_reset_sync_state(mac);
nr_ue_reset_sync_state(mac, false);
release_mac_configuration(mac, cause);
mac->state = UE_DETACHING;
break;
@@ -1822,7 +1829,7 @@ void nr_rrc_mac_config_req_reset(module_id_t module_id, NR_UE_MAC_reset_cause_t
case RE_ESTABLISHMENT:
reset_mac_inst(mac);
nr_ue_mac_default_configs(mac);
nr_ue_reset_sync_state(mac);
nr_ue_reset_sync_state(mac, true);
release_mac_configuration(mac, cause);
// suspend all RBs except SRB0
for (int j = 0; j < mac->lc_ordered_list.count; j++) {
@@ -1976,12 +1983,23 @@ static void handle_reconfiguration_with_sync(NR_UE_MAC_INST_t *mac,
LOG_I(NR_MAC, "Configuring CRNTI %x\n", mac->crnti);
RA_config_t *ra = &mac->ra;
bool is_cfra = false;
if (reconfWithSync->rach_ConfigDedicated) {
AssertFatal(reconfWithSync->rach_ConfigDedicated->present == NR_ReconfigurationWithSync__rach_ConfigDedicated_PR_uplink,
"RACH on supplementaryUplink not supported\n");
NR_RACH_ConfigDedicated_t *rach_ConfigDedicated = reconfWithSync->rach_ConfigDedicated->choice.uplink;
if (rach_ConfigDedicated->cfra)
is_cfra = true;
if (rach_ConfigDedicated->ext1 && rach_ConfigDedicated->ext1->cfra_TwoStep_r16)
is_cfra = true;
UPDATE_IE(ra->rach_ConfigDedicated, reconfWithSync->rach_ConfigDedicated->choice.uplink, NR_RACH_ConfigDedicated_t);
}
// in case of CBRA and reconfiguration with sync (handover)
// the UE sends MSG3 with C-RNTI to identify itself
if (!is_cfra)
mac->msg3_C_RNTI = true;
if (reconfWithSync->spCellConfigCommon) {
NR_ServingCellConfigCommon_t *scc = reconfWithSync->spCellConfigCommon;
if (scc->physCellId)
@@ -2000,7 +2018,7 @@ static void handle_reconfiguration_with_sync(NR_UE_MAC_INST_t *mac,
configure_common_BWP_ul(mac, bwp_id, scc->uplinkConfigCommon->initialUplinkBWP);
}
mac->state = UE_NOT_SYNC;
mac->state = UE_NOT_SYNC_RECONF;
ra->ra_state = nrRA_UE_IDLE;
nr_ue_mac_default_configs(mac);
+2
View File
@@ -150,6 +150,7 @@
// Define the UE L2 states with X-Macro
#define NR_UE_L2_STATES \
UE_STATE(UE_NOT_SYNC) \
UE_STATE(UE_NOT_SYNC_RECONF) \
UE_STATE(UE_BARRED) \
UE_STATE(UE_RECEIVING_SIB) \
UE_STATE(UE_PERFORMING_RA) \
@@ -644,6 +645,7 @@ typedef struct NR_UE_MAC_INST_s {
NR_SSB_meas_t ssb_measurements[MAX_NB_SSB];
NR_CSIRS_meas_t csirs_measurements;
ssb_ro_preambles_t ssb_ro_preambles;
dci_pdu_rel15_t def_dci_pdu_rel15[NR_MAX_SLOTS_PER_FRAME][8];
+4 -4
View File
@@ -88,8 +88,8 @@ void nr_rrc_mac_config_req_cg(module_id_t module_id,
NR_CellGroupConfig_t *cell_group_config,
NR_UE_NR_Capability_t *ue_Capability);
void nr_rrc_mac_config_req_mib(module_id_t module_id, int cc_idP, NR_MIB_t *mibP, int sched_sib1, bool barred);
void nr_rrc_mac_config_req_mib(module_id_t module_id, int cc_idP, NR_MIB_t *mibP, bool barred);
void nr_rrc_mac_sched_sib(module_id_t module_id, int sched_sib);
void nr_rrc_mac_config_req_sib1(module_id_t module_id, int cc_idP, NR_SIB1_t *sib1, bool can_start_ra);
struct position; /* forward declaration */
@@ -255,7 +255,7 @@ void nr_get_RA_window(NR_UE_MAC_INST_t *mac);
void prepare_msg4_msgb_feedback(NR_UE_MAC_INST_t *mac, int pid, int ack_nack);
void configure_initial_pucch(PUCCH_sched_t *pucch, int res_ind);
void release_PUCCH_SRS(NR_UE_MAC_INST_t *mac);
void nr_ue_reset_sync_state(NR_UE_MAC_INST_t *mac);
void nr_ue_reset_sync_state(NR_UE_MAC_INST_t *mac, bool reconf);
void nr_ue_send_synch_request(NR_UE_MAC_INST_t *mac, module_id_t module_id, int cc_id, const fapi_nr_synch_request_t *sync_req);
bool is_ss_monitor_occasion(const int frame, const int slot, const int slots_per_frame, const NR_SearchSpace_t *ss);
@@ -363,5 +363,5 @@ int sl_nr_ue_slot_select(const sl_nr_phy_config_request_t *cfg, int nr_slot, uin
void nr_ue_sidelink_scheduler(nr_sidelink_indication_t *sl_ind, NR_UE_MAC_INST_t *mac);
NR_SearchSpace_t *get_common_search_space(const NR_UE_MAC_INST_t *mac, const NR_SearchSpaceId_t ss_id);
ssb_ro_preambles_t get_ssb_ro_preambles_4step(struct NR_RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB *config);
#endif
+3 -3
View File
@@ -54,7 +54,7 @@ void send_srb0_rrc(int ue_id, const uint8_t *sdu, sdu_size_t sdu_len, void *data
void nr_ue_init_mac(NR_UE_MAC_INST_t *mac)
{
LOG_I(NR_MAC, "[UE%d] Initializing MAC\n", mac->ue_id);
nr_ue_reset_sync_state(mac);
nr_ue_reset_sync_state(mac, false);
mac->get_sib1 = false;
for (int i = 0; i < MAX_SI_GROUPS; i++)
mac->get_otherSI[i] = false;
@@ -117,10 +117,10 @@ void nr_ue_send_synch_request(NR_UE_MAC_INST_t *mac, module_id_t module_id, int
mac->if_module->synch_request(&mac->synch_request);
}
void nr_ue_reset_sync_state(NR_UE_MAC_INST_t *mac)
void nr_ue_reset_sync_state(NR_UE_MAC_INST_t *mac, bool reconf)
{
// reset synchornization status
mac->state = UE_NOT_SYNC;
mac->state = reconf ? UE_NOT_SYNC_RECONF : UE_NOT_SYNC;
mac->ra.ra_state = nrRA_UE_IDLE;
}
+3 -5
View File
@@ -190,7 +190,7 @@ static void select_preamble_group(NR_UE_MAC_INST_t *mac)
// else if Msg3 is being retransmitted, we keep what used in first transmission of Msg3
}
static ssb_ro_preambles_t get_ssb_ro_preambles_4step(struct NR_RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB *config)
ssb_ro_preambles_t get_ssb_ro_preambles_4step(struct NR_RACH_ConfigCommon__ssb_perRACH_OccasionAndCB_PreamblesPerSSB *config)
{
ssb_ro_preambles_t ret = {0};
switch (config->present) {
@@ -293,9 +293,7 @@ static void config_preamble_index(NR_UE_MAC_INST_t *mac)
bool groupBconfigured = false;
int preamb_ga = 0;
if (ra->ra_type == RA_4_STEP) {
AssertFatal(nr_rach_ConfigCommon->ssb_perRACH_OccasionAndCB_PreamblesPerSSB,
"Not expeting ssb_perRACH_OccasionAndCB_PreamblesPerSSB to be NULL here\n");
ra->ssb_ro_config = get_ssb_ro_preambles_4step(nr_rach_ConfigCommon->ssb_perRACH_OccasionAndCB_PreamblesPerSSB);
ra->ssb_ro_config = mac->ssb_ro_preambles;
if (nr_rach_ConfigCommon->totalNumberOfRA_Preambles)
nb_of_preambles = *nr_rach_ConfigCommon->totalNumberOfRA_Preambles;
// Amongst the contention-based Random Access Preambles associated with an SSB the first numberOfRA-PreamblesGroupA
@@ -321,7 +319,7 @@ static void config_preamble_index(NR_UE_MAC_INST_t *mac)
if (twostep->msgA_SSB_PerRACH_OccasionAndCB_PreamblesPerSSB_r16)
ra->ssb_ro_config = get_ssb_ro_preambles_2step(twostep->msgA_SSB_PerRACH_OccasionAndCB_PreamblesPerSSB_r16);
else
ra->ssb_ro_config = get_ssb_ro_preambles_4step(nr_rach_ConfigCommon->ssb_perRACH_OccasionAndCB_PreamblesPerSSB);
ra->ssb_ro_config = mac->ssb_ro_preambles;
if (twostep->msgA_TotalNumberOfRA_Preambles_r16)
nb_of_preambles = *twostep->msgA_TotalNumberOfRA_Preambles_r16;
}
@@ -480,6 +480,15 @@ void ue_dci_configuration(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_request_t *dl
}
config_dci_pdu(mac, dl_config, rnti_type, slot, ra_SS);
}
// If Msg3 has C-RNTI MAC CE, also monitor dedicated search spaces during contention resolution
// according to TS 38.321 section 5.1.5
if (ra->ra_state == nrRA_WAIT_CONTENTION_RESOLUTION && mac->msg3_C_RNTI) {
for (int i = 0; i < pdcch_config->list_SS.count; i++) {
NR_SearchSpace_t *ss = pdcch_config->list_SS.array[i];
if (is_ss_monitor_occasion(frame, slot, slots_per_frame, ss))
config_dci_pdu(mac, dl_config, TYPE_C_RNTI_, slot, ss);
}
}
} else if (mac->state == UE_CONNECTED) {
/*
In RRC Connected state, the UE monitors for fallback DCI with C-RNTI in common and UE-specific SS.
+1 -1
View File
@@ -1145,7 +1145,7 @@ void nr_ue_dl_scheduler(NR_UE_MAC_INST_t *mac, nr_downlink_indication_t *dl_info
dl_config->slot = rx_slot;
dl_config->number_pdus = 0;
if (mac->state == UE_NOT_SYNC || mac->state == UE_DETACHING)
if (mac->state == UE_NOT_SYNC || mac->state == UE_NOT_SYNC_RECONF || mac->state == UE_DETACHING)
return;
if (mac->state == UE_CONNECTED) {