various improvements and fixes
This commit is contained in:
@@ -673,7 +673,7 @@ typedef struct
|
||||
} fapi_nr_prach_config_t;
|
||||
|
||||
typedef struct {
|
||||
uint16_t target_Nid_cell;
|
||||
int16_t target_Nid_cell;
|
||||
} fapi_nr_synch_request_t;
|
||||
|
||||
typedef struct {
|
||||
|
||||
@@ -675,9 +675,8 @@ static int lcid_cmp(const void *lc1, const void *lc2, void *mac_inst)
|
||||
return (lc_config[id1 - 1]->ul_SpecificParameters->priority - lc_config[id2 - 1]->ul_SpecificParameters->priority);
|
||||
}
|
||||
|
||||
void nr_release_mac_config_logicalChannelBearer(module_id_t module_id, long channel_identity)
|
||||
void nr_release_mac_config_logicalChannelBearer(NR_UE_MAC_INST_t *mac, long channel_identity)
|
||||
{
|
||||
NR_UE_MAC_INST_t *mac = get_mac_inst(module_id);
|
||||
if (mac->logicalChannelConfig[channel_identity - 1] != NULL) {
|
||||
ASN_STRUCT_FREE(asn_DEF_NR_LogicalChannelConfig, mac->logicalChannelConfig[channel_identity - 1]);
|
||||
mac->logicalChannelConfig[channel_identity - 1] = NULL;
|
||||
@@ -750,7 +749,7 @@ void nr_rrc_mac_config_req_ue_logicalChannelBearer(module_id_t module_id,
|
||||
for (int i = 0; i < rlc_torelease_list->list.count; i++) {
|
||||
if (rlc_torelease_list->list.array[i]) {
|
||||
int lc_identity = *rlc_torelease_list->list.array[i];
|
||||
nr_release_mac_config_logicalChannelBearer(module_id, lc_identity);
|
||||
nr_release_mac_config_logicalChannelBearer(mac, lc_identity);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1351,19 +1350,20 @@ static void configure_common_BWP_ul(NR_UE_MAC_INST_t *mac, int bwp_id, NR_BWP_Up
|
||||
}
|
||||
}
|
||||
|
||||
void nr_rrc_mac_config_req_reset(module_id_t module_id)
|
||||
void nr_rrc_mac_config_req_reset(module_id_t module_id,
|
||||
NR_UE_MAC_reset_cause_t reset_cause)
|
||||
{
|
||||
NR_UE_MAC_INST_t *mac = get_mac_inst(module_id);
|
||||
reset_mac_inst(mac);
|
||||
}
|
||||
|
||||
void nr_rrc_mac_config_req_release(module_id_t module_id)
|
||||
{
|
||||
NR_UE_MAC_INST_t *mac = get_mac_inst(module_id);
|
||||
|
||||
reset_ra(&mac->ra);
|
||||
|
||||
release_mac_configuration(mac);
|
||||
|
||||
for (int i = 0; i < NR_MAX_NUM_LCID; i++) {
|
||||
nr_release_mac_config_logicalChannelBearer(mac, i + 1);
|
||||
memset(&mac->lc_ordered_info[i], 0, sizeof(nr_lcordered_info_t));
|
||||
}
|
||||
|
||||
mac->first_sync_frame = -1;
|
||||
mac->get_sib1 = false;
|
||||
mac->phy_config_request_sent = false;
|
||||
@@ -1375,6 +1375,7 @@ void nr_rrc_mac_config_req_release(module_id_t module_id)
|
||||
mac->synch_request.CC_id = 0;
|
||||
mac->synch_request.synch_req.target_Nid_cell = -1;
|
||||
mac->if_module->synch_request(&mac->synch_request);
|
||||
|
||||
}
|
||||
|
||||
void nr_rrc_mac_config_req_sib1(module_id_t module_id,
|
||||
|
||||
@@ -165,6 +165,11 @@ typedef enum {
|
||||
UE_CONNECTED
|
||||
} NR_UE_L2_STATE_t;
|
||||
|
||||
typedef enum {
|
||||
GO_TO_IDLE,
|
||||
RE_ESTABLISHMENT
|
||||
} NR_UE_MAC_reset_cause_t;
|
||||
|
||||
typedef enum {
|
||||
RA_2STEP = 0,
|
||||
RA_4STEP
|
||||
|
||||
@@ -170,8 +170,7 @@ void nr_rrc_mac_config_req_sib1(module_id_t module_id,
|
||||
NR_SI_SchedulingInfo_t *si_SchedulingInfo,
|
||||
NR_ServingCellConfigCommonSIB_t *scc);
|
||||
|
||||
void nr_rrc_mac_config_req_reset(module_id_t module_id);
|
||||
void nr_rrc_mac_config_req_release(module_id_t module_id);
|
||||
void nr_rrc_mac_config_req_reset(module_id_t module_id, NR_UE_MAC_reset_cause_t cause);
|
||||
|
||||
/**\brief initialization NR UE MAC instance(s), total number of MAC instance based on NB_NR_UE_MAC_INST*/
|
||||
NR_UE_MAC_INST_t * nr_l2_init_ue();
|
||||
|
||||
@@ -181,17 +181,21 @@ void reset_mac_inst(NR_UE_MAC_INST_t *nr_mac)
|
||||
|
||||
void release_mac_configuration(NR_UE_MAC_INST_t *mac)
|
||||
{
|
||||
if(mac->mib)
|
||||
if(mac->mib) {
|
||||
ASN_STRUCT_FREE(asn_DEF_NR_MIB, mac->mib);
|
||||
mac->mib = NULL;
|
||||
}
|
||||
for (int i = 0; i < 5; i++) {
|
||||
NR_BWP_PDCCH_t *pdcch = &mac->config_BWP_PDCCH[5];
|
||||
release_common_ss_cset(pdcch);
|
||||
for (int j = 0; j < pdcch->list_Coreset.count; j++)
|
||||
asn_sequence_del(&pdcch->list_Coreset, j, 1);
|
||||
for (int j = 0; j < pdcch->list_SS.count; j++)
|
||||
asn_sequence_del(&pdcch->list_SS, j, 1);
|
||||
asn_sequence_del(&pdcch->list_SS, j, 1);
|
||||
}
|
||||
|
||||
memset(&mac->current_DL_BWP, 0, sizeof(mac->current_DL_BWP));
|
||||
memset(&mac->current_UL_BWP, 0, sizeof(mac->current_UL_BWP));
|
||||
memset(&mac->ssb_measurements, 0, sizeof(mac->ssb_measurements));
|
||||
memset(&mac->csirs_measurements, 0, sizeof(mac->csirs_measurements));
|
||||
memset(&mac->ul_time_alignment, 0, sizeof(mac->ul_time_alignment));
|
||||
|
||||
@@ -62,7 +62,7 @@ static void release_rlc_entity_from_lcid(nr_rlc_ue_t *ue, logical_chan_id_t chan
|
||||
return;
|
||||
if (rb->type == NR_RLC_SRB) {
|
||||
int id = rb->choice.srb_id - 1;
|
||||
AssertFatal(id > 0, "logic bug: impossible to have srb0 here\n");
|
||||
AssertFatal(id >= 0, "logic bug: impossible to have srb0 here\n");
|
||||
if (ue->srb[id]) {
|
||||
ue->srb[id]->delete_entity(ue->srb[id]);
|
||||
ue->srb[id] = NULL;
|
||||
|
||||
@@ -49,7 +49,6 @@
|
||||
#include "rrc_defs.h"
|
||||
#include "rrc_proto.h"
|
||||
#include "LAYER2/NR_MAC_UE/mac_proto.h"
|
||||
#include "COMMON/mac_rrc_primitives.h"
|
||||
|
||||
#include "intertask_interface.h"
|
||||
|
||||
@@ -1846,8 +1845,7 @@ void nr_rrc_going_to_IDLE(instance_t instance,
|
||||
{
|
||||
NR_UE_RRC_INST_t *rrc = &NR_UE_rrc_inst[instance];
|
||||
NR_UE_Timers_Constants_t *tac = &rrc->timers_and_constants;
|
||||
// reset MAC
|
||||
nr_rrc_mac_config_req_reset(instance);
|
||||
|
||||
// if going to RRC_IDLE was triggered by reception
|
||||
// of the RRCRelease message including a waitTime
|
||||
NR_RejectWaitTime_t *waitTime = NULL;
|
||||
@@ -1915,11 +1913,30 @@ void nr_rrc_going_to_IDLE(instance_t instance,
|
||||
// discard the keys (only kgnb is stored)
|
||||
memset(rrc->kgnb, 0, sizeof(rrc->kgnb));
|
||||
|
||||
// TODO release all radio resources, including release of the RLC entity,
|
||||
// release all radio resources, including release of the RLC entity,
|
||||
// the MAC configuration and the associated PDCP entity
|
||||
// and SDAP for all established RBs
|
||||
nr_pdcp_remove_UE(rrc->rnti);
|
||||
nr_rlc_remove_ue(rrc->rnti);
|
||||
for (int j = 0; j < NB_CNX_UE; j++) {
|
||||
rrcPerNB_t *nb = &rrc->perNB[j];
|
||||
for (int i = 0; i < MAX_DRBS_PER_UE; i++) {
|
||||
if (nb->status_DRBs[i] != RB_NOT_PRESENT) {
|
||||
nb->status_DRBs[i] = RB_NOT_PRESENT;
|
||||
nr_pdcp_release_drb(rrc->rnti, i);
|
||||
}
|
||||
}
|
||||
for (int i = 1; i < NR_NUM_SRB; i++) {
|
||||
if (nb->Srb[i] != RB_NOT_PRESENT) {
|
||||
nb->Srb[i] = RB_NOT_PRESENT;
|
||||
nr_pdcp_release_srb(rrc->rnti, i);
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < NR_MAX_NUM_LCID; i++) {
|
||||
if (nb->active_RLC_entity[i]) {
|
||||
nb->active_RLC_entity[i] = false;
|
||||
nr_rlc_release_entity(rrc->rnti, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(rrc->meas_config) {
|
||||
ASN_STRUCT_FREE(asn_DEF_NR_MeasConfig, rrc->meas_config);
|
||||
@@ -1987,7 +2004,9 @@ void nr_rrc_going_to_IDLE(instance_t instance,
|
||||
}
|
||||
}
|
||||
|
||||
nr_rrc_mac_config_req_release(instance);
|
||||
// reset MAC
|
||||
NR_UE_MAC_reset_cause_t cause = GO_TO_IDLE;
|
||||
nr_rrc_mac_config_req_reset(instance, cause);
|
||||
|
||||
// enter RRC_IDLE
|
||||
rrc->nrRrcState = RRC_STATE_IDLE_NR;
|
||||
|
||||
@@ -491,7 +491,7 @@ bool nr_sdap_delete_entity(ue_id_t ue_id, int pdusession_id)
|
||||
int upperBound = 0;
|
||||
|
||||
if (entityPtr == NULL && (pdusession_id) * (pdusession_id - NGAP_MAX_PDU_SESSION) > 0) {
|
||||
LOG_W(SDAP, "SDAP entities not established or Invalid range of pdusession_id [0, 256].\n");
|
||||
LOG_E(SDAP, "SDAP entities not established or Invalid range of pdusession_id [0, 256].\n");
|
||||
return ret;
|
||||
}
|
||||
LOG_D(SDAP, "Deleting SDAP entity for UE %lx and PDU Session id %d\n", ue_id, entityPtr->pdusession_id);
|
||||
@@ -516,7 +516,7 @@ bool nr_sdap_delete_entity(ue_id_t ue_id, int pdusession_id)
|
||||
ret = true;
|
||||
}
|
||||
}
|
||||
LOG_W(SDAP, "Entity does not exist or it was not found.\n");
|
||||
LOG_E(SDAP, "Entity does not exist or it was not found.\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user