Commit 829d8c3c authored by Jaroslava Fiedlerova's avatar Jaroslava Fiedlerova

Merge remote-tracking branch 'origin/NR_more_UE_fixes' into integration_2024_w15

parents 2ba79f3f 29c3f228
...@@ -102,10 +102,10 @@ Command line parameters for UE in `--sa` mode: ...@@ -102,10 +102,10 @@ Command line parameters for UE in `--sa` mode:
- `--band` : NR band number (default value 78) - `--band` : NR band number (default value 78)
- `--ssb` : SSB start subcarrier (default value 516) - `--ssb` : SSB start subcarrier (default value 516)
To simplify the configuration for the user testing OAI UE with OAI gNB, the latter prints the following LOG that guides the user to correctly set the UE command line parameters. To simplify the configuration for the user testing OAI UE with OAI gNB, the latter prints the following LOG that guides the user to correctly set some of the UE command line parameters.
``` ```
[PHY] Command line parameters for the UE: -C 3319680000 -r 106 --numerology 1 --band 78 --ssb 516 [PHY] Command line parameters for the UE: -C 3319680000 -r 106 --numerology 1 --ssb 516
``` ```
You can run this, using USRPs, on two separate machines: You can run this, using USRPs, on two separate machines:
......
...@@ -81,20 +81,18 @@ void nr_common_signal_procedures(PHY_VARS_gNB *gNB,int frame,int slot, nfapi_nr_ ...@@ -81,20 +81,18 @@ void nr_common_signal_procedures(PHY_VARS_gNB *gNB,int frame,int slot, nfapi_nr_
fp->print_ue_help_cmdline_log = false; fp->print_ue_help_cmdline_log = false;
if (fp->dl_CarrierFreq != fp->ul_CarrierFreq) if (fp->dl_CarrierFreq != fp->ul_CarrierFreq)
LOG_A(PHY, LOG_A(PHY,
"Command line parameters for the UE: -C %lu --CO %lu -r %d --numerology %d --band %d --ssb %d\n", "Command line parameters for the UE: -C %lu --CO %lu -r %d --numerology %d --ssb %d\n",
fp->dl_CarrierFreq, fp->dl_CarrierFreq,
fp->dl_CarrierFreq - fp->ul_CarrierFreq, fp->dl_CarrierFreq - fp->ul_CarrierFreq,
fp->N_RB_DL, fp->N_RB_DL,
scs, scs,
fp->nr_band,
fp->ssb_start_subcarrier); fp->ssb_start_subcarrier);
else else
LOG_A(PHY, LOG_A(PHY,
"Command line parameters for the UE: -C %lu -r %d --numerology %d --band %d --ssb %d\n", "Command line parameters for the UE: -C %lu -r %d --numerology %d --ssb %d\n",
fp->dl_CarrierFreq, fp->dl_CarrierFreq,
fp->N_RB_DL, fp->N_RB_DL,
scs, scs,
fp->nr_band,
fp->ssb_start_subcarrier); fp->ssb_start_subcarrier);
} }
LOG_D(PHY, LOG_D(PHY,
......
...@@ -1426,7 +1426,7 @@ void nr_rrc_mac_config_req_reset(module_id_t module_id, ...@@ -1426,7 +1426,7 @@ void nr_rrc_mac_config_req_reset(module_id_t module_id,
NR_UE_MAC_INST_t *mac = get_mac_inst(module_id); NR_UE_MAC_INST_t *mac = get_mac_inst(module_id);
switch (cause) { switch (cause) {
case GO_TO_IDLE: case GO_TO_IDLE:
reset_ra(&mac->ra); reset_ra(mac, cause);
release_mac_configuration(mac, cause); release_mac_configuration(mac, cause);
nr_ue_init_mac(mac); nr_ue_init_mac(mac);
nr_ue_mac_default_configs(mac); nr_ue_mac_default_configs(mac);
...@@ -1434,14 +1434,16 @@ void nr_rrc_mac_config_req_reset(module_id_t module_id, ...@@ -1434,14 +1434,16 @@ void nr_rrc_mac_config_req_reset(module_id_t module_id,
nr_ue_send_synch_request(mac, module_id, 0, -1); nr_ue_send_synch_request(mac, module_id, 0, -1);
break; break;
case DETACH: case DETACH:
reset_ra(&mac->ra); LOG_A(NR_MAC, "Received detach indication\n");
reset_ra(mac, cause);
reset_mac_inst(mac); reset_mac_inst(mac);
nr_ue_reset_sync_state(mac); nr_ue_reset_sync_state(mac);
release_mac_configuration(mac, cause); release_mac_configuration(mac, cause);
mac->state = UE_DETACHING;
break; break;
case T300_EXPIRY: case T300_EXPIRY:
reset_ra(mac, cause);
reset_mac_inst(mac); reset_mac_inst(mac);
reset_ra(&mac->ra);
mac->state = UE_SYNC; // still in sync but need to restart RA mac->state = UE_SYNC; // still in sync but need to restart RA
break; break;
case RE_ESTABLISHMENT: case RE_ESTABLISHMENT:
......
...@@ -169,7 +169,8 @@ typedef enum { ...@@ -169,7 +169,8 @@ typedef enum {
UE_NOT_SYNC = 0, UE_NOT_SYNC = 0,
UE_SYNC, UE_SYNC,
UE_PERFORMING_RA, UE_PERFORMING_RA,
UE_CONNECTED UE_CONNECTED,
UE_DETACHING
} NR_UE_L2_STATE_t; } NR_UE_L2_STATE_t;
typedef enum { typedef enum {
......
...@@ -100,7 +100,7 @@ NR_UE_MAC_INST_t * nr_l2_init_ue(int nb_inst); ...@@ -100,7 +100,7 @@ NR_UE_MAC_INST_t * nr_l2_init_ue(int nb_inst);
NR_UE_MAC_INST_t *get_mac_inst(module_id_t module_id); NR_UE_MAC_INST_t *get_mac_inst(module_id_t module_id);
void reset_mac_inst(NR_UE_MAC_INST_t *nr_mac); void reset_mac_inst(NR_UE_MAC_INST_t *nr_mac);
void reset_ra(RA_config_t *ra); void reset_ra(NR_UE_MAC_INST_t *nr_mac, NR_UE_MAC_reset_cause_t cause);
void release_mac_configuration(NR_UE_MAC_INST_t *mac, void release_mac_configuration(NR_UE_MAC_INST_t *mac,
NR_UE_MAC_reset_cause_t cause); NR_UE_MAC_reset_cause_t cause);
...@@ -304,7 +304,7 @@ void init_RA(NR_UE_MAC_INST_t *mac, ...@@ -304,7 +304,7 @@ void init_RA(NR_UE_MAC_INST_t *mac,
NR_RACH_ConfigDedicated_t *rach_ConfigDedicated); NR_RACH_ConfigDedicated_t *rach_ConfigDedicated);
int16_t get_prach_tx_power(NR_UE_MAC_INST_t *mac); int16_t get_prach_tx_power(NR_UE_MAC_INST_t *mac);
void free_rach_structures(NR_UE_MAC_INST_t *nr_mac, int bwp_id);
void nr_Msg1_transmitted(NR_UE_MAC_INST_t *mac); void nr_Msg1_transmitted(NR_UE_MAC_INST_t *mac);
void nr_Msg3_transmitted(NR_UE_MAC_INST_t *mac, uint8_t CC_id, frame_t frameP, slot_t slotP, uint8_t gNB_id); void nr_Msg3_transmitted(NR_UE_MAC_INST_t *mac, uint8_t CC_id, frame_t frameP, slot_t slotP, uint8_t gNB_id);
void nr_get_msg3_payload(NR_UE_MAC_INST_t *mac, uint8_t *buf, int TBS_max); void nr_get_msg3_payload(NR_UE_MAC_INST_t *mac, uint8_t *buf, int TBS_max);
......
...@@ -211,14 +211,6 @@ void reset_mac_inst(NR_UE_MAC_INST_t *nr_mac) ...@@ -211,14 +211,6 @@ void reset_mac_inst(NR_UE_MAC_INST_t *nr_mac)
// release, if any, Temporary C-RNTI // release, if any, Temporary C-RNTI
nr_mac->ra.t_crnti = 0; nr_mac->ra.t_crnti = 0;
// free RACH structs
for (int i = 0; i < MAX_NUM_BWP_UE; i++) {
free(nr_mac->ssb_list[i].tx_ssb);
for (int j = 0; j < MAX_NB_PRACH_CONF_PERIOD_IN_ASSOCIATION_PATTERN_PERIOD; j++)
for (int k = 0; k < MAX_NB_FRAME_IN_PRACH_CONF_PERIOD; k++)
for (int l = 0; l < MAX_NB_SLOT_IN_FRAME; l++)
free(nr_mac->prach_assoc_pattern[i].prach_conf_period_list[j].prach_occasion_slot_map[k][l].prach_occasion);
}
// reset BFI_COUNTER // reset BFI_COUNTER
// TODO beam failure procedure not implemented // TODO beam failure procedure not implemented
...@@ -291,9 +283,26 @@ void release_mac_configuration(NR_UE_MAC_INST_t *mac, ...@@ -291,9 +283,26 @@ void release_mac_configuration(NR_UE_MAC_INST_t *mac,
memset(&mac->ul_time_alignment, 0, sizeof(mac->ul_time_alignment)); memset(&mac->ul_time_alignment, 0, sizeof(mac->ul_time_alignment));
} }
void reset_ra(RA_config_t *ra) void free_rach_structures(NR_UE_MAC_INST_t *nr_mac, int bwp_id)
{ {
for (int j = 0; j < MAX_NB_PRACH_CONF_PERIOD_IN_ASSOCIATION_PATTERN_PERIOD; j++)
for (int k = 0; k < MAX_NB_FRAME_IN_PRACH_CONF_PERIOD; k++)
for (int l = 0; l < MAX_NB_SLOT_IN_FRAME; l++)
free(nr_mac->prach_assoc_pattern[bwp_id].prach_conf_period_list[j].prach_occasion_slot_map[k][l].prach_occasion);
free(nr_mac->ssb_list[bwp_id].tx_ssb);
}
void reset_ra(NR_UE_MAC_INST_t *nr_mac, NR_UE_MAC_reset_cause_t cause)
{
RA_config_t *ra = &nr_mac->ra;
if(ra->rach_ConfigDedicated) if(ra->rach_ConfigDedicated)
asn1cFreeStruc(asn_DEF_NR_RACH_ConfigDedicated, ra->rach_ConfigDedicated); asn1cFreeStruc(asn_DEF_NR_RACH_ConfigDedicated, ra->rach_ConfigDedicated);
memset(ra, 0, sizeof(RA_config_t)); memset(ra, 0, sizeof(RA_config_t));
if (cause == T300_EXPIRY)
return;
for (int i = 0; i < MAX_NUM_BWP_UE; i++)
free_rach_structures(nr_mac, i);
} }
...@@ -2263,7 +2263,10 @@ bool get_downlink_ack(NR_UE_MAC_INST_t *mac, frame_t frame, int slot, PUCCH_sche ...@@ -2263,7 +2263,10 @@ bool get_downlink_ack(NR_UE_MAC_INST_t *mac, frame_t frame, int slot, PUCCH_sche
bool two_transport_blocks = false; bool two_transport_blocks = false;
int number_of_code_word = 1; int number_of_code_word = 1;
if (current_DL_BWP && current_DL_BWP->pdsch_Config && current_DL_BWP->pdsch_Config->maxNrofCodeWordsScheduledByDCI && current_DL_BWP->pdsch_Config->maxNrofCodeWordsScheduledByDCI[0] == 2) { if (current_DL_BWP
&& current_DL_BWP->pdsch_Config
&& current_DL_BWP->pdsch_Config->maxNrofCodeWordsScheduledByDCI
&& current_DL_BWP->pdsch_Config->maxNrofCodeWordsScheduledByDCI[0] == 2) {
two_transport_blocks = true; two_transport_blocks = true;
number_of_code_word = 2; number_of_code_word = 2;
} }
...@@ -2400,9 +2403,8 @@ bool get_downlink_ack(NR_UE_MAC_INST_t *mac, frame_t frame, int slot, PUCCH_sche ...@@ -2400,9 +2403,8 @@ bool get_downlink_ack(NR_UE_MAC_INST_t *mac, frame_t frame, int slot, PUCCH_sche
return false; return false;
} }
NR_PUCCH_Config_t *pucch_Config = current_UL_BWP->pucch_Config; NR_PUCCH_Config_t *pucch_Config = current_UL_BWP ? current_UL_BWP->pucch_Config : NULL;
if (!pucch_Config || !pucch_Config->resourceSetToAddModList if (!(pucch_Config && pucch_Config->resourceSetToAddModList && pucch_Config->resourceSetToAddModList->list.array[0]))
|| pucch_Config->resourceSetToAddModList->list.array[0] == NULL)
configure_initial_pucch(pucch, res_ind); configure_initial_pucch(pucch, res_ind);
else { else {
int resource_set_id = find_pucch_resource_set(pucch_Config, O_ACK); int resource_set_id = find_pucch_resource_set(pucch_Config, O_ACK);
......
...@@ -626,11 +626,11 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac, ...@@ -626,11 +626,11 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac,
/* Transform precoding */ /* Transform precoding */
pusch_config_pdu->transform_precoding = get_transformPrecoding(current_UL_BWP, dci_format, 0); pusch_config_pdu->transform_precoding = get_transformPrecoding(current_UL_BWP, dci_format, 0);
bool tp_enabled = pusch_config_pdu->transform_precoding == NR_PUSCH_Config__transformPrecoder_enabled;
/*DCI format-related configuration*/ /*DCI format-related configuration*/
if (dci_format == NR_UL_DCI_FORMAT_0_0) { if (dci_format == NR_UL_DCI_FORMAT_0_0) {
if ((pusch_config_pdu->transform_precoding == NR_PUSCH_Config__transformPrecoder_disabled) && if (!tp_enabled && pusch_config_pdu->nr_of_symbols < 3)
pusch_config_pdu->nr_of_symbols < 3)
pusch_config_pdu->num_dmrs_cdm_grps_no_data = 1; pusch_config_pdu->num_dmrs_cdm_grps_no_data = 1;
else else
pusch_config_pdu->num_dmrs_cdm_grps_no_data = 2; pusch_config_pdu->num_dmrs_cdm_grps_no_data = 2;
...@@ -653,7 +653,8 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac, ...@@ -653,7 +653,8 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac,
pusch_config_pdu->scid = 0; pusch_config_pdu->scid = 0;
pusch_config_pdu->data_scrambling_id = mac->physCellId; pusch_config_pdu->data_scrambling_id = mac->physCellId;
if (pusch_Config->dataScramblingIdentityPUSCH if (pusch_Config
&& pusch_Config->dataScramblingIdentityPUSCH
&& rnti_type == TYPE_C_RNTI_ && rnti_type == TYPE_C_RNTI_
&& !(dci_format == NR_UL_DCI_FORMAT_0_0 && ss_type == NR_SearchSpace__searchSpaceType_PR_common)) && !(dci_format == NR_UL_DCI_FORMAT_0_0 && ss_type == NR_SearchSpace__searchSpaceType_PR_common))
pusch_config_pdu->data_scrambling_id = *pusch_Config->dataScramblingIdentityPUSCH; pusch_config_pdu->data_scrambling_id = *pusch_Config->dataScramblingIdentityPUSCH;
...@@ -663,7 +664,7 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac, ...@@ -663,7 +664,7 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac,
pusch_config_pdu->scid = dci->dmrs_sequence_initialization.val; pusch_config_pdu->scid = dci->dmrs_sequence_initialization.val;
/* TRANSFORM PRECODING ------------------------------------------------------------------------------------------*/ /* TRANSFORM PRECODING ------------------------------------------------------------------------------------------*/
if (pusch_config_pdu->transform_precoding == NR_PUSCH_Config__transformPrecoder_enabled) { if (tp_enabled) {
uint32_t n_RS_Id = 0; uint32_t n_RS_Id = 0;
if (NR_DMRS_ulconfig->transformPrecodingEnabled && if (NR_DMRS_ulconfig->transformPrecodingEnabled &&
...@@ -712,8 +713,8 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac, ...@@ -712,8 +713,8 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac,
} }
/* FREQ_HOPPING_FLAG */ /* FREQ_HOPPING_FLAG */
if ((pusch_Config != NULL) if (pusch_Config
&& (pusch_Config->frequencyHopping != NULL) && pusch_Config->frequencyHopping
&& (pusch_Config->resourceAllocation != NR_PUSCH_Config__resourceAllocation_resourceAllocationType0)) { && (pusch_Config->resourceAllocation != NR_PUSCH_Config__resourceAllocation_resourceAllocationType0)) {
pusch_config_pdu->frequency_hopping = dci->frequency_hopping_flag.val; pusch_config_pdu->frequency_hopping = dci->frequency_hopping_flag.val;
} }
...@@ -722,8 +723,9 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac, ...@@ -722,8 +723,9 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac,
pusch_config_pdu->mcs_index = dci->mcs; pusch_config_pdu->mcs_index = dci->mcs;
/* MCS TABLE */ /* MCS TABLE */
pusch_config_pdu->mcs_table = get_pusch_mcs_table(pusch_Config ? pusch_Config->mcs_TableTransformPrecoder : NULL, long *mcs_table_config = pusch_Config ? (tp_enabled ? pusch_Config->mcs_TableTransformPrecoder : pusch_Config->mcs_Table) : NULL;
pusch_config_pdu->transform_precoding != NR_PUSCH_Config__transformPrecoder_disabled, pusch_config_pdu->mcs_table = get_pusch_mcs_table(mcs_table_config,
tp_enabled,
dci_format, dci_format,
rnti_type, rnti_type,
ss_type, ss_type,
...@@ -794,7 +796,7 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac, ...@@ -794,7 +796,7 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac,
/* PTRS */ /* PTRS */
if (pusch_Config && pusch_Config->dmrs_UplinkForPUSCH_MappingTypeB && if (pusch_Config && pusch_Config->dmrs_UplinkForPUSCH_MappingTypeB &&
pusch_Config->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup->phaseTrackingRS) { pusch_Config->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup->phaseTrackingRS) {
if (pusch_config_pdu->transform_precoding == NR_PUSCH_Config__transformPrecoder_disabled) { if (!tp_enabled) {
nfapi_nr_ue_ptrs_ports_t ptrs_ports_list; nfapi_nr_ue_ptrs_ports_t ptrs_ports_list;
pusch_config_pdu->pusch_ptrs.ptrs_ports_list = &ptrs_ports_list; pusch_config_pdu->pusch_ptrs.ptrs_ports_list = &ptrs_ports_list;
bool valid_ptrs_setup = set_ul_ptrs_values(pusch_Config->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup->phaseTrackingRS->choice.setup, bool valid_ptrs_setup = set_ul_ptrs_values(pusch_Config->dmrs_UplinkForPUSCH_MappingTypeB->choice.setup->phaseTrackingRS->choice.setup,
...@@ -1086,7 +1088,7 @@ void nr_ue_dl_scheduler(NR_UE_MAC_INST_t *mac, nr_downlink_indication_t *dl_info ...@@ -1086,7 +1088,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->slot = rx_slot;
dl_config->number_pdus = 0; dl_config->number_pdus = 0;
if (mac->state == UE_NOT_SYNC) if (mac->state == UE_NOT_SYNC || mac->state == UE_DETACHING)
return; return;
ue_dci_configuration(mac, dl_config, rx_frame, rx_slot); ue_dci_configuration(mac, dl_config, rx_frame, rx_slot);
...@@ -1241,7 +1243,7 @@ void nr_ue_ul_scheduler(NR_UE_MAC_INST_t *mac, nr_uplink_indication_t *ul_info) ...@@ -1241,7 +1243,7 @@ void nr_ue_ul_scheduler(NR_UE_MAC_INST_t *mac, nr_uplink_indication_t *ul_info)
uint32_t gNB_index = ul_info->gNB_index; uint32_t gNB_index = ul_info->gNB_index;
RA_config_t *ra = &mac->ra; RA_config_t *ra = &mac->ra;
if(mac->state < UE_CONNECTED) { if(mac->state > UE_NOT_SYNC && mac->state < UE_CONNECTED) {
nr_ue_get_rach(mac, cc_id, frame_tx, gNB_index, slot_tx); nr_ue_get_rach(mac, cc_id, frame_tx, gNB_index, slot_tx);
nr_ue_prach_scheduler(mac, frame_tx, slot_tx); nr_ue_prach_scheduler(mac, frame_tx, slot_tx);
} }
...@@ -1325,17 +1327,14 @@ void nr_ue_ul_scheduler(NR_UE_MAC_INST_t *mac, nr_uplink_indication_t *ul_info) ...@@ -1325,17 +1327,14 @@ void nr_ue_ul_scheduler(NR_UE_MAC_INST_t *mac, nr_uplink_indication_t *ul_info)
nr_update_sr(mac); nr_update_sr(mac);
// update Bj for all active lcids before LCP procedure // update Bj for all active lcids before LCP procedure
LOG_D(NR_MAC, "====================[Frame %d][Slot %d]Logical Channel Prioritization===========\n", frame_tx, slot_tx); if (mac->current_UL_BWP) {
LOG_D(NR_MAC, "%4d.%2d Logical Channel Prioritization\n", frame_tx, slot_tx);
for (int i = 0; i < mac->lc_ordered_list.count; i++) { for (int i = 0; i < mac->lc_ordered_list.count; i++) {
nr_lcordered_info_t *lc_info = mac->lc_ordered_list.array[i]; nr_lcordered_info_t *lc_info = mac->lc_ordered_list.array[i];
int lcid = lc_info->lcid; int lcid = lc_info->lcid;
// max amount of data that can be buffered/accumulated in a logical channel buffer // max amount of data that can be buffered/accumulated in a logical channel buffer
uint32_t bucketSize_max = lc_info->bucket_size; uint32_t bucketSize_max = lc_info->bucket_size;
// measure Bj increment the value of Bj by product PBR * T
/*
measure Bj
increment the value of Bj by product PBR * T
*/
NR_LC_SCHEDULING_INFO *sched_info = get_scheduling_info_from_lcid(mac, lcid); NR_LC_SCHEDULING_INFO *sched_info = get_scheduling_info_from_lcid(mac, lcid);
int32_t bj = sched_info->Bj; int32_t bj = sched_info->Bj;
if (lc_info->pbr < UINT_MAX) { if (lc_info->pbr < UINT_MAX) {
...@@ -1346,14 +1345,14 @@ void nr_ue_ul_scheduler(NR_UE_MAC_INST_t *mac, nr_uplink_indication_t *ul_info) ...@@ -1346,14 +1345,14 @@ void nr_ue_ul_scheduler(NR_UE_MAC_INST_t *mac, nr_uplink_indication_t *ul_info)
} }
else else
bj = INT_MAX; bj = INT_MAX;
// bj > max bucket size, set bj to max bucket size, as in ts38.321 5.4.3.1 Logical Channel Prioritization // bj > max bucket size, set bj to max bucket size, as in ts38.321 5.4.3.1 Logical Channel Prioritization
sched_info->Bj = min(bj, bucketSize_max); sched_info->Bj = min(bj, bucketSize_max);
// reset bj timer // reset bj timer
nr_timer_start(&sched_info->Bj_timer); nr_timer_start(&sched_info->Bj_timer);
} }
}
if(mac->state >= UE_PERFORMING_RA) if(mac->state >= UE_PERFORMING_RA && mac->state < UE_DETACHING)
nr_ue_pucch_scheduler(mac, frame_tx, slot_tx, ul_info->phy_data); nr_ue_pucch_scheduler(mac, frame_tx, slot_tx, ul_info->phy_data);
} }
...@@ -1952,6 +1951,7 @@ void build_ssb_to_ro_map(NR_UE_MAC_INST_t *mac) ...@@ -1952,6 +1951,7 @@ void build_ssb_to_ro_map(NR_UE_MAC_INST_t *mac)
{ {
// Clear all the lists and maps // Clear all the lists and maps
const int bwp_id = mac->current_UL_BWP->bwp_id; const int bwp_id = mac->current_UL_BWP->bwp_id;
free_rach_structures(mac, bwp_id);
memset(&mac->ssb_list[bwp_id], 0, sizeof(ssb_list_info_t)); memset(&mac->ssb_list[bwp_id], 0, sizeof(ssb_list_info_t));
memset(&mac->prach_assoc_pattern[bwp_id], 0, sizeof(prach_association_pattern_t)); memset(&mac->prach_assoc_pattern[bwp_id], 0, sizeof(prach_association_pattern_t));
......
...@@ -311,6 +311,7 @@ NR_UE_RRC_INST_t* nr_rrc_init_ue(char* uecap_file, int nb_inst) ...@@ -311,6 +311,7 @@ NR_UE_RRC_INST_t* nr_rrc_init_ue(char* uecap_file, int nb_inst)
rrc->dl_bwp_id = 0; rrc->dl_bwp_id = 0;
rrc->ul_bwp_id = 0; rrc->ul_bwp_id = 0;
rrc->as_security_activated = false; rrc->as_security_activated = false;
rrc->detach_after_release = false;
FILE *f = NULL; FILE *f = NULL;
if (uecap_file) if (uecap_file)
...@@ -1628,6 +1629,8 @@ static int nr_rrc_ue_decode_dcch(NR_UE_RRC_INST_t *rrc, ...@@ -1628,6 +1629,8 @@ static int nr_rrc_ue_decode_dcch(NR_UE_RRC_INST_t *rrc,
LOG_I(NR_RRC, "[UE %ld] Received RRC Release (gNB %d)\n", rrc->ue_id, gNB_indexP); LOG_I(NR_RRC, "[UE %ld] Received RRC Release (gNB %d)\n", rrc->ue_id, gNB_indexP);
// TODO properly implement procedures in 5.3.8.3 of 38.331 // TODO properly implement procedures in 5.3.8.3 of 38.331
NR_Release_Cause_t cause = OTHER; NR_Release_Cause_t cause = OTHER;
if (rrc->detach_after_release)
rrc->nrRrcState = RRC_STATE_DETACH_NR;
nr_rrc_going_to_IDLE(rrc, cause, dl_dcch_msg->message.choice.c1->choice.rrcRelease); nr_rrc_going_to_IDLE(rrc, cause, dl_dcch_msg->message.choice.c1->choice.rrcRelease);
break; break;
...@@ -1786,7 +1789,9 @@ void *rrc_nrue(void *notUsed) ...@@ -1786,7 +1789,9 @@ void *rrc_nrue(void *notUsed)
break; break;
case NAS_DETACH_REQ: case NAS_DETACH_REQ:
if (!NAS_DETACH_REQ(msg_p).wait_release) { if (NAS_DETACH_REQ(msg_p).wait_release)
rrc->detach_after_release = true;
else {
rrc->nrRrcState = RRC_STATE_DETACH_NR; rrc->nrRrcState = RRC_STATE_DETACH_NR;
NR_Release_Cause_t release_cause = OTHER; NR_Release_Cause_t release_cause = OTHER;
nr_rrc_going_to_IDLE(rrc, release_cause, NULL); nr_rrc_going_to_IDLE(rrc, release_cause, NULL);
......
...@@ -216,6 +216,7 @@ typedef struct NR_UE_RRC_INST_s { ...@@ -216,6 +216,7 @@ typedef struct NR_UE_RRC_INST_s {
e_NR_IntegrityProtAlgorithm integrityProtAlgorithm; e_NR_IntegrityProtAlgorithm integrityProtAlgorithm;
long keyToUse; long keyToUse;
bool as_security_activated; bool as_security_activated;
bool detach_after_release;
long selected_plmn_identity; long selected_plmn_identity;
Rrc_State_NR_t nrRrcState; Rrc_State_NR_t nrRrcState;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment