Commit 784736bf authored by Robert Schmidt's avatar Robert Schmidt

Changes to restart while UE is connected

parent 54c6c27d
...@@ -118,6 +118,8 @@ NR_DRB_ToAddModList_t *fill_DRB_configList(gNB_RRC_UE_t *ue) ...@@ -118,6 +118,8 @@ NR_DRB_ToAddModList_t *fill_DRB_configList(gNB_RRC_UE_t *ue)
return NULL; return NULL;
} }
void rrc_gNB_send_NGAP_UE_CONTEXT_RELEASE_COMPLETE(instance_t instance, uint32_t gNB_ue_ngap_id) { };
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
/// static configuration for NR at the moment /// static configuration for NR at the moment
......
...@@ -184,7 +184,10 @@ void nr_schedule_pucch(gNB_MAC_INST *nrmac, ...@@ -184,7 +184,10 @@ void nr_schedule_pucch(gNB_MAC_INST *nrmac,
NR_sched_pucch_t *curr_pucch = &UE->UE_sched_ctrl.sched_pucch[pucch_index]; NR_sched_pucch_t *curr_pucch = &UE->UE_sched_ctrl.sched_pucch[pucch_index];
if (!curr_pucch->active) if (!curr_pucch->active)
continue; continue;
DevAssert(frameP == curr_pucch->frame && slotP == curr_pucch->ul_slot); if (frameP != curr_pucch->frame || slotP != curr_pucch->ul_slot) {
LOG_E(NR_MAC, "PUCCH frame/slot mismatch, not scheduling PUCCH\n");
continue;
}
const uint16_t O_ack = curr_pucch->dai_c; const uint16_t O_ack = curr_pucch->dai_c;
const uint16_t O_csi = curr_pucch->csi_bits; const uint16_t O_csi = curr_pucch->csi_bits;
...@@ -1275,7 +1278,7 @@ int nr_acknack_scheduling(gNB_MAC_INST *mac, ...@@ -1275,7 +1278,7 @@ int nr_acknack_scheduling(gNB_MAC_INST *mac,
return pucch_index; // index of current PUCCH structure return pucch_index; // index of current PUCCH structure
} }
else if (curr_pucch->active) { else if (curr_pucch->active) {
AssertFatal(1==0, "This shouldn't happen! curr_pucch frame.slot %d.%d not matching with computed frame.slot %d.%d\n", LOG_E(NR_MAC, "This shouldn't happen! curr_pucch frame.slot %d.%d not matching with computed frame.slot %d.%d\n",
curr_pucch->frame, curr_pucch->ul_slot, pucch_frame, pucch_slot); curr_pucch->frame, curr_pucch->ul_slot, pucch_frame, pucch_slot);
} }
else { // unoccupied occasion else { // unoccupied occasion
...@@ -1371,7 +1374,7 @@ void nr_sr_reporting(gNB_MAC_INST *nrmac, frame_t SFN, sub_frame_t slot) ...@@ -1371,7 +1374,7 @@ void nr_sr_reporting(gNB_MAC_INST *nrmac, frame_t SFN, sub_frame_t slot)
curr_pucch->resource_indicator == idx) curr_pucch->resource_indicator == idx)
curr_pucch->sr_flag = true; curr_pucch->sr_flag = true;
else if (curr_pucch->active) { else if (curr_pucch->active) {
AssertFatal(1==0, "This shouldn't happen! curr_pucch frame.slot %d.%d not matching with SR function frame.slot %d.%d\n", LOG_E(NR_MAC, "This shouldn't happen! curr_pucch frame.slot %d.%d not matching with SR function frame.slot %d.%d\n",
curr_pucch->frame, curr_pucch->ul_slot, SFN, slot); curr_pucch->frame, curr_pucch->ul_slot, SFN, slot);
continue; continue;
} }
......
...@@ -110,6 +110,19 @@ static inline uint64_t bitStr_to_uint64(BIT_STRING_t *asn); ...@@ -110,6 +110,19 @@ static inline uint64_t bitStr_to_uint64(BIT_STRING_t *asn);
mui_t rrc_gNB_mui = 0; mui_t rrc_gNB_mui = 0;
typedef struct deliver_ue_ctxt_release_data_t {
gNB_RRC_INST *rrc;
f1ap_ue_context_release_cmd_t *release_cmd;
} deliver_ue_ctxt_release_data_t;
static void rrc_deliver_ue_ctxt_release_cmd(void *deliver_pdu_data, ue_id_t ue_id, int srb_id, char *buf, int size, int sdu_id)
{
DevAssert(deliver_pdu_data != NULL);
deliver_ue_ctxt_release_data_t *data = deliver_pdu_data;
data->release_cmd->rrc_container = (uint8_t*) buf;
data->release_cmd->rrc_container_length = size;
data->rrc->mac_rrc.ue_context_release_command(data->release_cmd);
}
///---------------------------------------------------------------------------------------------------------------/// ///---------------------------------------------------------------------------------------------------------------///
///---------------------------------------------------------------------------------------------------------------/// ///---------------------------------------------------------------------------------------------------------------///
...@@ -2002,7 +2015,18 @@ static void rrc_CU_process_ue_context_release_request(MessageDef *msg_p) ...@@ -2002,7 +2015,18 @@ static void rrc_CU_process_ue_context_release_request(MessageDef *msg_p)
gNB_RRC_INST *rrc = RC.nrrrc[instance]; gNB_RRC_INST *rrc = RC.nrrrc[instance];
rrc_gNB_ue_context_t *ue_context_p = rrc_gNB_get_ue_context(rrc, req->gNB_CU_ue_id); rrc_gNB_ue_context_t *ue_context_p = rrc_gNB_get_ue_context(rrc, req->gNB_CU_ue_id);
if (!ue_context_p) { if (!ue_context_p) {
LOG_E(RRC, "could not find UE context for CU UE ID %u, aborting transaction\n", req->gNB_CU_ue_id); LOG_W(RRC, "could not find UE context for CU UE ID %u: auto-generate release command\n", req->gNB_CU_ue_id);
uint8_t buffer[RRC_BUF_SIZE] = {0};
int size = do_NR_RRCRelease(buffer, RRC_BUF_SIZE, rrc_gNB_get_next_transaction_identifier(0));
f1ap_ue_context_release_cmd_t ue_context_release_cmd = {
.gNB_CU_ue_id = req->gNB_CU_ue_id,
.gNB_DU_ue_id = req->gNB_DU_ue_id,
.cause = F1AP_CAUSE_RADIO_NETWORK,
.cause_value = 10, // 10 = F1AP_CauseRadioNetwork_normal_release
.srb_id = DCCH,
};
deliver_ue_ctxt_release_data_t data = {.rrc = rrc, .release_cmd = &ue_context_release_cmd};
nr_pdcp_data_req_srb(req->gNB_CU_ue_id, DCCH, rrc_gNB_mui++, size, buffer, rrc_deliver_ue_ctxt_release_cmd, &data);
return; return;
} }
...@@ -2811,19 +2835,6 @@ rrc_gNB_generate_UECapabilityEnquiry( ...@@ -2811,19 +2835,6 @@ rrc_gNB_generate_UECapabilityEnquiry(
nr_rrc_transfer_protected_rrc_message(rrc, ue, DCCH, buffer, size); nr_rrc_transfer_protected_rrc_message(rrc, ue, DCCH, buffer, size);
} }
typedef struct deliver_ue_ctxt_release_data_t {
gNB_RRC_INST *rrc;
f1ap_ue_context_release_cmd_t *release_cmd;
} deliver_ue_ctxt_release_data_t;
static void rrc_deliver_ue_ctxt_release_cmd(void *deliver_pdu_data, ue_id_t ue_id, int srb_id, char *buf, int size, int sdu_id)
{
DevAssert(deliver_pdu_data != NULL);
deliver_ue_ctxt_release_data_t *data = deliver_pdu_data;
data->release_cmd->rrc_container = (uint8_t*) buf;
data->release_cmd->rrc_container_length = size;
data->rrc->mac_rrc.ue_context_release_command(data->release_cmd);
}
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
/* /*
* Generate the RRC Connection Release to UE. * Generate the RRC Connection Release to UE.
......
...@@ -170,6 +170,16 @@ rrc_gNB_ue_context_t *rrc_gNB_create_ue_context(rnti_t rnti, ...@@ -170,6 +170,16 @@ rrc_gNB_ue_context_t *rrc_gNB_create_ue_context(rnti_t rnti,
gNB_RRC_UE_t *ue = &ue_context_p->ue_context; gNB_RRC_UE_t *ue = &ue_context_p->ue_context;
ue->rnti = rnti; ue->rnti = rnti;
ue->random_ue_identity = ue_identityP; ue->random_ue_identity = ue_identityP;
// restart: we remove/restart the RRC (current limitation, might be overcome
// after merging !2304). Therefore, check if a particular UE we try to add
// exists in F1, and remove it if it is the case. This also affects PDCP and
// NGAP, and yes, this is a GIANT hack
if (cu_exists_f1_ue_data(ue->rrc_ue_id)) {
LOG_W(RRC, "hack: force-remove UE in PDCP and UE ID state\n");
cu_remove_f1_ue_data(ue->rrc_ue_id);
nr_pdcp_remove_UE(ue->rrc_ue_id);
rrc_gNB_send_NGAP_UE_CONTEXT_RELEASE_COMPLETE(0, ue->rrc_ue_id);
}
f1_ue_data_t ue_data = {.secondary_ue = du_ue_id}; f1_ue_data_t ue_data = {.secondary_ue = du_ue_id};
AssertFatal(!cu_exists_f1_ue_data(ue->rrc_ue_id), AssertFatal(!cu_exists_f1_ue_data(ue->rrc_ue_id),
"UE F1 Context for ID %d already exists, logic bug\n", "UE F1 Context for ID %d already exists, logic bug\n",
......
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