|
|
|
@@ -112,23 +112,6 @@ mui_t rrc_gNB_mui = 0;
|
|
|
|
|
///---------------------------------------------------------------------------------------------------------------///
|
|
|
|
|
///---------------------------------------------------------------------------------------------------------------///
|
|
|
|
|
|
|
|
|
|
bool DURecvCb(protocol_ctxt_t *ctxt_pP,
|
|
|
|
|
const srb_flag_t srb_flagP,
|
|
|
|
|
const rb_id_t rb_idP,
|
|
|
|
|
const mui_t muiP,
|
|
|
|
|
const confirm_t confirmP,
|
|
|
|
|
const sdu_size_t sdu_buffer_sizeP,
|
|
|
|
|
unsigned char *const sdu_buffer_pP,
|
|
|
|
|
const pdcp_transmission_mode_t modeP,
|
|
|
|
|
const uint32_t *sourceL2Id,
|
|
|
|
|
const uint32_t *destinationL2Id) {
|
|
|
|
|
// The buffer comes from the stack in gtp-u thread, we have a make a separate buffer to enqueue in a inter-thread message queue
|
|
|
|
|
mem_block_t *sdu=get_free_mem_block(sdu_buffer_sizeP, __func__);
|
|
|
|
|
memcpy(sdu->data, sdu_buffer_pP, sdu_buffer_sizeP);
|
|
|
|
|
du_rlc_data_req(ctxt_pP,srb_flagP, false, rb_idP,muiP, confirmP, sdu_buffer_sizeP, sdu);
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void nr_rrc_addmod_srbs(int rnti,
|
|
|
|
|
const NR_SRB_ToAddModList_t *srb_list,
|
|
|
|
|
const struct NR_CellGroupConfig__rlc_BearerToAddModList *bearer_list)
|
|
|
|
@@ -642,17 +625,10 @@ void fill_DRB_configList(const protocol_ctxt_t *const ctxt_pP, rrc_gNB_ue_contex
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
void
|
|
|
|
|
rrc_gNB_generate_dedicatedRRCReconfiguration(
|
|
|
|
|
const protocol_ctxt_t *const ctxt_pP,
|
|
|
|
|
rrc_gNB_ue_context_t *ue_context_pP,
|
|
|
|
|
NR_CellGroupConfig_t *cell_groupConfig_from_DU
|
|
|
|
|
)
|
|
|
|
|
void rrc_gNB_generate_dedicatedRRCReconfiguration(const protocol_ctxt_t *const ctxt_pP, rrc_gNB_ue_context_t *ue_context_pP)
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
{
|
|
|
|
|
gNB_RRC_INST *rrc = RC.nrrrc[ctxt_pP->module_id];
|
|
|
|
|
long drb_priority[NGAP_MAX_DRBS_PER_UE];
|
|
|
|
|
NR_CellGroupConfig_t *cellGroupConfig = NULL;
|
|
|
|
|
int xid = -1;
|
|
|
|
|
|
|
|
|
|
int drb_id_to_setup_start = 1;
|
|
|
|
@@ -683,7 +659,6 @@ rrc_gNB_generate_dedicatedRRCReconfiguration(
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
xid = ue_p->pduSession[j].xid;
|
|
|
|
|
drb_priority[DRB_config->drb_Identity - 1] = 13; // For now, we assume only one drb per pdu sessions with a default preiority (will be dynamique in future)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* If list is empty free the list and reset the address */
|
|
|
|
@@ -692,20 +667,7 @@ rrc_gNB_generate_dedicatedRRCReconfiguration(
|
|
|
|
|
dedicatedNAS_MessageList = NULL;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(cell_groupConfig_from_DU == NULL){
|
|
|
|
|
cellGroupConfig = calloc(1, sizeof(NR_CellGroupConfig_t));
|
|
|
|
|
// FIXME: fill_mastercellGroupConfig() won't fill the right priorities
|
|
|
|
|
fill_mastercellGroupConfig(cellGroupConfig,
|
|
|
|
|
ue_p->masterCellGroup,
|
|
|
|
|
rrc->um_on_default_drb,
|
|
|
|
|
(drb_id_to_setup_start < 2) ? 1 : 0,
|
|
|
|
|
DRB_configList,
|
|
|
|
|
drb_priority);
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
LOG_I(NR_RRC, "Master cell group originating from the DU \n");
|
|
|
|
|
cellGroupConfig = cell_groupConfig_from_DU;
|
|
|
|
|
}
|
|
|
|
|
NR_CellGroupConfig_t *cellGroupConfig = ue_p->masterCellGroup;
|
|
|
|
|
|
|
|
|
|
AssertFatal(xid > -1, "Invalid xid %d. No PDU sessions setup to configure.\n", xid);
|
|
|
|
|
NR_SRB_ToAddModList_t *SRB_configList2 = NULL;
|
|
|
|
@@ -2067,6 +2029,7 @@ static void handle_rrcReconfigurationComplete(const protocol_ctxt_t *const ctxt_
|
|
|
|
|
uint8_t xid = reconfig_complete->rrc_TransactionIdentifier;
|
|
|
|
|
rrc_gNB_process_RRCReconfigurationComplete(ctxt_pP, ue_context_p, xid);
|
|
|
|
|
|
|
|
|
|
bool successful_reconfig = true;
|
|
|
|
|
if (get_softmodem_params()->sa) {
|
|
|
|
|
switch (UE->xids[xid]) {
|
|
|
|
|
case RRC_PDUSESSION_RELEASE: {
|
|
|
|
@@ -2085,10 +2048,29 @@ static void handle_rrcReconfigurationComplete(const protocol_ctxt_t *const ctxt_
|
|
|
|
|
case RRC_FIRST_RECONF:
|
|
|
|
|
rrc_gNB_send_NGAP_INITIAL_CONTEXT_SETUP_RESP(ctxt_pP, ue_context_p);
|
|
|
|
|
break;
|
|
|
|
|
case RRC_DEFAULT_RECONF:
|
|
|
|
|
/* nothing to do */
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
LOG_E(RRC, "Received unexpected xid: %d\n", xid);
|
|
|
|
|
successful_reconfig = false;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
gNB_RRC_INST *rrc = RC.nrrrc[0];
|
|
|
|
|
f1ap_ue_context_modif_req_t ue_context_modif_req = {
|
|
|
|
|
.gNB_CU_ue_id = 0xffffffff, /* filled by F1 for the moment */
|
|
|
|
|
.gNB_DU_ue_id = 0xffffffff, /* filled by F1 for the moment */
|
|
|
|
|
.rnti = UE->rnti,
|
|
|
|
|
.mcc = rrc->configuration.mcc[0],
|
|
|
|
|
.mnc = rrc->configuration.mnc[0],
|
|
|
|
|
.mnc_digit_length = rrc->configuration.mnc_digit_length[0],
|
|
|
|
|
.nr_cellid = rrc->nr_cellid,
|
|
|
|
|
.servCellId = 0, /* TODO: correct value? */
|
|
|
|
|
.ReconfigComplOutcome = successful_reconfig ? RRCreconf_success : RRCreconf_failure,
|
|
|
|
|
};
|
|
|
|
|
rrc->mac_rrc.ue_context_modification_request(&ue_context_modif_req);
|
|
|
|
|
}
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
int rrc_gNB_decode_dcch(const protocol_ctxt_t *const ctxt_pP,
|
|
|
|
@@ -2357,158 +2339,9 @@ void rrc_gNB_process_dc_overall_timeout(const module_id_t gnb_mod_idP, x2ap_ENDC
|
|
|
|
|
rrc_remove_nsa_user(rrc, m->rnti);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void rrc_DU_process_ue_context_modification_request(MessageDef *msg_p, instance_t instance)
|
|
|
|
|
{
|
|
|
|
|
f1ap_ue_context_setup_t * req=&F1AP_UE_CONTEXT_MODIFICATION_REQ(msg_p);
|
|
|
|
|
protocol_ctxt_t ctxt = {.rntiMaybeUEid = req->rnti, .module_id = instance, .instance = instance, .enb_flag = 1, .eNB_index = instance};
|
|
|
|
|
gNB_RRC_INST *rrc = RC.nrrrc[ctxt.module_id];
|
|
|
|
|
gNB_MAC_INST *mac = RC.nrmac[ctxt.module_id];
|
|
|
|
|
rrc_gNB_ue_context_t *ue_context_p = rrc_gNB_get_ue_context_by_rnti(rrc, req->rnti);
|
|
|
|
|
gNB_RRC_UE_t *UE = &ue_context_p->ue_context;
|
|
|
|
|
MessageDef *message_p;
|
|
|
|
|
message_p = itti_alloc_new_message (TASK_RRC_GNB, 0, F1AP_UE_CONTEXT_MODIFICATION_RESP);
|
|
|
|
|
f1ap_ue_context_setup_t * resp=&F1AP_UE_CONTEXT_MODIFICATION_RESP(message_p);
|
|
|
|
|
uint32_t incoming_teid = 0;
|
|
|
|
|
NR_CellGroupConfig_t *cellGroupConfig = NULL;
|
|
|
|
|
|
|
|
|
|
/* Configure SRB2 */
|
|
|
|
|
NR_SRB_ToAddMod_t *SRB2_config = NULL;
|
|
|
|
|
NR_SRB_ToAddModList_t *SRB_configList = NULL;
|
|
|
|
|
uint8_t SRBs_before_new_addition = 0;
|
|
|
|
|
|
|
|
|
|
if(req->srbs_to_be_setup_length>0){
|
|
|
|
|
if (UE->SRB_configList == NULL) {
|
|
|
|
|
LOG_W(NR_RRC, "The SRB list of the UE context is empty before the addition of new SRB at the DU \n");
|
|
|
|
|
UE->SRB_configList = CALLOC(1, sizeof(*UE->SRB_configList));
|
|
|
|
|
}
|
|
|
|
|
SRB_configList = UE->SRB_configList;
|
|
|
|
|
SRBs_before_new_addition = SRB_configList->list.count;
|
|
|
|
|
for (int i=0; i<req->srbs_to_be_setup_length; i++){
|
|
|
|
|
SRB2_config = CALLOC(1, sizeof(*SRB2_config));
|
|
|
|
|
SRB2_config->srb_Identity = req->srbs_to_be_setup[i].srb_id;
|
|
|
|
|
asn1cSeqAdd(&SRB_configList->list, SRB2_config);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Configure DRB */
|
|
|
|
|
NR_DRB_ToAddMod_t *DRB_config = NULL;
|
|
|
|
|
NR_DRB_ToAddModList_t *DRB_configList = NULL;
|
|
|
|
|
int drb_id_to_setup_start = 0;
|
|
|
|
|
long drb_priority[NGAP_MAX_DRBS_PER_UE];
|
|
|
|
|
if(req->drbs_to_be_setup_length>0){
|
|
|
|
|
if (UE->DRB_configList == NULL) {
|
|
|
|
|
UE->DRB_configList = CALLOC(1, sizeof(*UE->DRB_configList));
|
|
|
|
|
}
|
|
|
|
|
DRB_configList = UE->DRB_configList;
|
|
|
|
|
for (int i=0; i<req->drbs_to_be_setup_length; i++){
|
|
|
|
|
DRB_config = CALLOC(1, sizeof(*DRB_config));
|
|
|
|
|
DRB_config->drb_Identity = req->drbs_to_be_setup[i].drb_id;
|
|
|
|
|
if (drb_id_to_setup_start == 0) drb_id_to_setup_start = DRB_config->drb_Identity;
|
|
|
|
|
asn1cSeqAdd(&DRB_configList->list, DRB_config);
|
|
|
|
|
f1ap_drb_to_be_setup_t drb_p = req->drbs_to_be_setup[i];
|
|
|
|
|
transport_layer_addr_t addr;
|
|
|
|
|
memcpy(addr.buffer, &drb_p.up_ul_tnl[0].tl_address, sizeof(drb_p.up_ul_tnl[0].tl_address));
|
|
|
|
|
addr.length=sizeof(drb_p.up_ul_tnl[0].tl_address)*8;
|
|
|
|
|
extern instance_t DUuniqInstance;
|
|
|
|
|
if (!drb_id_to_setup_start) drb_id_to_setup_start = drb_p.drb_id;
|
|
|
|
|
incoming_teid = newGtpuCreateTunnel(DUuniqInstance,
|
|
|
|
|
req->rnti,
|
|
|
|
|
drb_p.drb_id,
|
|
|
|
|
drb_p.drb_id,
|
|
|
|
|
drb_p.up_ul_tnl[0].teid,
|
|
|
|
|
-1, // no qfi
|
|
|
|
|
addr,
|
|
|
|
|
drb_p.up_ul_tnl[0].port,
|
|
|
|
|
DURecvCb,
|
|
|
|
|
NULL);
|
|
|
|
|
/* TODO: hardcoded to 13 for the time being, to be changed? */
|
|
|
|
|
drb_priority[DRB_config->drb_Identity-1] = 13;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(req->srbs_to_be_setup_length>0 || req->drbs_to_be_setup_length>0){
|
|
|
|
|
cellGroupConfig = calloc(1, sizeof(NR_CellGroupConfig_t));
|
|
|
|
|
fill_mastercellGroupConfig(cellGroupConfig,
|
|
|
|
|
UE->masterCellGroup,
|
|
|
|
|
rrc->um_on_default_drb,
|
|
|
|
|
drb_id_to_setup_start < 2 ? 1 : 0,
|
|
|
|
|
DRB_configList,
|
|
|
|
|
drb_priority);
|
|
|
|
|
apply_macrlc_config(rrc, ue_context_p, &ctxt);
|
|
|
|
|
}
|
|
|
|
|
if(req->ReconfigComplOutcome == RRCreconf_failure){
|
|
|
|
|
LOG_W(NR_RRC, "CU reporting RRC Reconfiguration failure \n");
|
|
|
|
|
}
|
|
|
|
|
else if(req->ReconfigComplOutcome == RRCreconf_success){
|
|
|
|
|
LOG_I(NR_RRC, "CU reporting RRC Reconfiguration success \n");
|
|
|
|
|
if (UE->DRB_configList != NULL) {
|
|
|
|
|
LOG_I(NR_RRC, "Send first DDD buffer status reporting towards the CU through an ITTI message to gtp-u \n");
|
|
|
|
|
uint8_t drb_id = UE->DRB_configList->list.array[0]->drb_Identity;
|
|
|
|
|
rnti_t rnti = UE->rnti;
|
|
|
|
|
int rlc_tx_buffer_space = nr_rlc_get_available_tx_space(rnti, drb_id + 3);
|
|
|
|
|
LOG_I(NR_RRC, "Reported in DDD drb_id:%d, rnti:%d\n", drb_id, rnti);
|
|
|
|
|
MessageDef *msg = itti_alloc_new_message_sized(TASK_RRC_GNB, 0, GTPV1U_DU_BUFFER_REPORT_REQ,
|
|
|
|
|
sizeof(gtpv1u_tunnel_data_req_t));
|
|
|
|
|
gtpv1u_DU_buffer_report_req_t *req=>PV1U_DU_BUFFER_REPORT_REQ(msg);
|
|
|
|
|
req->pdusession_id = drb_id;
|
|
|
|
|
req->ue_id = rnti;
|
|
|
|
|
req->buffer_availability = rlc_tx_buffer_space; //10000000; //Hardcoding to be removed and read the actual RLC buffer availability instead
|
|
|
|
|
extern instance_t DUuniqInstance;
|
|
|
|
|
itti_send_msg_to_task(TASK_GTPV1_U, DUuniqInstance, msg);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Fill the UE context setup response ITTI message to send to F1AP */
|
|
|
|
|
resp->gNB_CU_ue_id = req->gNB_CU_ue_id;
|
|
|
|
|
resp->rnti = ctxt.rntiMaybeUEid;
|
|
|
|
|
if(DRB_configList){
|
|
|
|
|
if(DRB_configList->list.count > 0){
|
|
|
|
|
resp->drbs_to_be_setup = calloc(1,DRB_configList->list.count*sizeof(f1ap_drb_to_be_setup_t));
|
|
|
|
|
resp->drbs_to_be_setup_length = DRB_configList->list.count;
|
|
|
|
|
for (int i=0; i<DRB_configList->list.count; i++){
|
|
|
|
|
resp->drbs_to_be_setup[i].drb_id = DRB_configList->list.array[i]->drb_Identity;
|
|
|
|
|
resp->drbs_to_be_setup[i].rlc_mode = RLC_MODE_AM;
|
|
|
|
|
resp->drbs_to_be_setup[i].up_dl_tnl[0].teid = incoming_teid;
|
|
|
|
|
resp->drbs_to_be_setup[i].up_dl_tnl[0].tl_address = inet_addr(mac->eth_params_n.my_addr);
|
|
|
|
|
resp->drbs_to_be_setup[i].up_dl_tnl_length = 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
LOG_W(NR_RRC, "No DRB added upon reception of F1 UE context modification request with a DRB to setup list\n");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(SRB_configList){
|
|
|
|
|
if(SRB_configList->list.count >0 && SRBs_before_new_addition < SRB_configList->list.count){
|
|
|
|
|
resp->srbs_to_be_setup = calloc(1,req->srbs_to_be_setup_length*sizeof(f1ap_srb_to_be_setup_t));
|
|
|
|
|
resp->srbs_to_be_setup_length = req->srbs_to_be_setup_length;
|
|
|
|
|
for (int i=SRBs_before_new_addition; i<SRB_configList->list.count; i++){
|
|
|
|
|
resp->srbs_to_be_setup[i-SRBs_before_new_addition].srb_id = SRB_configList->list.array[i]->srb_Identity;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
LOG_W(NR_RRC, "No SRB added upon reception of F1 UE Context modification request at the DU\n");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
LOG_W(NR_RRC, "No SRB added upon reception of F1 UE Context modification request at the DU\n");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//if(cellGroupConfig != NULL) {
|
|
|
|
|
resp->du_to_cu_rrc_information = calloc(1,sizeof(du_to_cu_rrc_information_t));
|
|
|
|
|
resp->du_to_cu_rrc_information->cellGroupConfig = calloc(1,1024);
|
|
|
|
|
asn_enc_rval_t enc_rval = uper_encode_to_buffer(&asn_DEF_NR_CellGroupConfig,
|
|
|
|
|
NULL,
|
|
|
|
|
UE->masterCellGroup, //(void *)cellGroupConfig,
|
|
|
|
|
resp->du_to_cu_rrc_information->cellGroupConfig,
|
|
|
|
|
1024);
|
|
|
|
|
resp->du_to_cu_rrc_information->cellGroupConfig_length = (enc_rval.encoded+7)>>3;
|
|
|
|
|
//}
|
|
|
|
|
itti_send_msg_to_task (TASK_DU_F1, ctxt.module_id, message_p);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void rrc_CU_process_ue_context_setup_response(MessageDef *msg_p, instance_t instance)
|
|
|
|
|
{
|
|
|
|
|
f1ap_ue_context_setup_t * resp=&F1AP_UE_CONTEXT_SETUP_RESP(msg_p);
|
|
|
|
|
f1ap_ue_context_setup_t *resp = &F1AP_UE_CONTEXT_SETUP_RESP(msg_p);
|
|
|
|
|
gNB_RRC_INST *rrc = RC.nrrrc[instance];
|
|
|
|
|
rrc_gNB_ue_context_t *ue_context_p = rrc_gNB_get_ue_context_by_rnti(rrc, resp->rnti);
|
|
|
|
|
gNB_RRC_UE_t *UE = &ue_context_p->ue_context;
|
|
|
|
@@ -2566,75 +2399,52 @@ static void rrc_CU_process_ue_context_release_complete(MessageDef *msg_p)
|
|
|
|
|
|
|
|
|
|
static void rrc_CU_process_ue_context_modification_response(MessageDef *msg_p, instance_t instance)
|
|
|
|
|
{
|
|
|
|
|
f1ap_ue_context_setup_t *resp=&F1AP_UE_CONTEXT_SETUP_RESP(msg_p);
|
|
|
|
|
f1ap_ue_context_modif_resp_t *resp = &F1AP_UE_CONTEXT_MODIFICATION_RESP(msg_p);
|
|
|
|
|
protocol_ctxt_t ctxt = {.rntiMaybeUEid = resp->rnti, .module_id = instance, .instance = instance, .enb_flag = 1, .eNB_index = instance};
|
|
|
|
|
gNB_RRC_INST *rrc = RC.nrrrc[ctxt.module_id];
|
|
|
|
|
rrc_gNB_ue_context_t *ue_context_p = rrc_gNB_get_ue_context_by_rnti(rrc, resp->rnti);
|
|
|
|
|
gNB_RRC_UE_t *UE = &ue_context_p->ue_context;
|
|
|
|
|
|
|
|
|
|
e1ap_bearer_setup_req_t req = {0};
|
|
|
|
|
req.numPDUSessionsMod = UE->nb_of_pdusessions;
|
|
|
|
|
req.gNB_cu_cp_ue_id = UE->gNB_ue_ngap_id;
|
|
|
|
|
req.rnti = UE->rnti;
|
|
|
|
|
for (int i=0; i < req.numPDUSessionsMod; i++) {
|
|
|
|
|
req.pduSessionMod[i].numDRB2Modify = resp->drbs_to_be_setup_length;
|
|
|
|
|
for (int j=0; j < resp->drbs_to_be_setup_length; j++) {
|
|
|
|
|
f1ap_drb_to_be_setup_t *drb_f1 = resp->drbs_to_be_setup + j;
|
|
|
|
|
DRB_nGRAN_to_setup_t *drb_e1 = req.pduSessionMod[i].DRBnGRanModList + j;
|
|
|
|
|
if (resp->drbs_to_be_setup_length > 0) {
|
|
|
|
|
e1ap_bearer_setup_req_t req = {0};
|
|
|
|
|
req.numPDUSessionsMod = UE->nb_of_pdusessions;
|
|
|
|
|
req.gNB_cu_cp_ue_id = UE->gNB_ue_ngap_id;
|
|
|
|
|
req.rnti = UE->rnti;
|
|
|
|
|
for (int i = 0; i < req.numPDUSessionsMod; i++) {
|
|
|
|
|
req.pduSessionMod[i].numDRB2Modify = resp->drbs_to_be_setup_length;
|
|
|
|
|
for (int j = 0; j < resp->drbs_to_be_setup_length; j++) {
|
|
|
|
|
f1ap_drb_to_be_setup_t *drb_f1 = resp->drbs_to_be_setup + j;
|
|
|
|
|
DRB_nGRAN_to_setup_t *drb_e1 = req.pduSessionMod[i].DRBnGRanModList + j;
|
|
|
|
|
|
|
|
|
|
drb_e1->id = drb_f1->drb_id;
|
|
|
|
|
drb_e1->numDlUpParam = drb_f1->up_dl_tnl_length;
|
|
|
|
|
drb_e1->DlUpParamList[0].tlAddress = drb_f1->up_dl_tnl[0].tl_address;
|
|
|
|
|
drb_e1->DlUpParamList[0].teId = drb_f1->up_dl_tnl[0].teid;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// send the F1 response message up to update F1-U tunnel info
|
|
|
|
|
// it seems the rrc transaction id (xid) is not needed here
|
|
|
|
|
rrc->cucp_cuup.bearer_context_mod(&req, instance, 0);
|
|
|
|
|
|
|
|
|
|
NR_CellGroupConfig_t *cellGroupConfig = NULL;
|
|
|
|
|
|
|
|
|
|
if(resp->du_to_cu_rrc_information->cellGroupConfig!=NULL){
|
|
|
|
|
asn_dec_rval_t dec_rval = uper_decode_complete( NULL,
|
|
|
|
|
&asn_DEF_NR_CellGroupConfig,
|
|
|
|
|
(void **)&cellGroupConfig,
|
|
|
|
|
(uint8_t *)resp->du_to_cu_rrc_information->cellGroupConfig,
|
|
|
|
|
(int) resp->du_to_cu_rrc_information->cellGroupConfig_length);
|
|
|
|
|
|
|
|
|
|
if((dec_rval.code != RC_OK) && (dec_rval.consumed == 0)) {
|
|
|
|
|
AssertFatal(1==0,"Cell group config decode error\n");
|
|
|
|
|
// free the memory
|
|
|
|
|
SEQUENCE_free( &asn_DEF_NR_CellGroupConfig, cellGroupConfig, 1 );
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
//xer_fprint(stdout,&asn_DEF_NR_CellGroupConfig, cellGroupConfig);
|
|
|
|
|
|
|
|
|
|
if (UE->masterCellGroup == NULL) {
|
|
|
|
|
UE->masterCellGroup = calloc(1, sizeof(NR_CellGroupConfig_t));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(cellGroupConfig->rlc_BearerToAddModList!=NULL){
|
|
|
|
|
if (UE->masterCellGroup->rlc_BearerToAddModList != NULL) {
|
|
|
|
|
int ue_ctxt_rlc_Bearers = UE->masterCellGroup->rlc_BearerToAddModList->list.count;
|
|
|
|
|
for(int i=ue_ctxt_rlc_Bearers; i<ue_ctxt_rlc_Bearers + cellGroupConfig->rlc_BearerToAddModList->list.count; i++){
|
|
|
|
|
asn1cSeqAdd(&UE->masterCellGroup->rlc_BearerToAddModList->list, cellGroupConfig->rlc_BearerToAddModList->list.array[i - ue_ctxt_rlc_Bearers]);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
LOG_W(NR_RRC, "Empty rlc_BearerToAddModList at ue_context of the CU before filling the updates from UE context setup response \n");
|
|
|
|
|
UE->masterCellGroup->rlc_BearerToAddModList = calloc(1, sizeof(*cellGroupConfig->rlc_BearerToAddModList));
|
|
|
|
|
memcpy(UE->masterCellGroup->rlc_BearerToAddModList, cellGroupConfig->rlc_BearerToAddModList, sizeof(*cellGroupConfig->rlc_BearerToAddModList));
|
|
|
|
|
drb_e1->id = drb_f1->drb_id;
|
|
|
|
|
drb_e1->numDlUpParam = drb_f1->up_dl_tnl_length;
|
|
|
|
|
drb_e1->DlUpParamList[0].tlAddress = drb_f1->up_dl_tnl[0].tl_address;
|
|
|
|
|
drb_e1->DlUpParamList[0].teId = drb_f1->up_dl_tnl[0].teid;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
LOG_I(NR_RRC, "Updated master cell group configuration stored at the UE context of the CU:\n");
|
|
|
|
|
if (LOG_DEBUGFLAG(DEBUG_ASN1)) {
|
|
|
|
|
xer_fprint(stdout, &asn_DEF_NR_CellGroupConfig, UE->masterCellGroup);
|
|
|
|
|
|
|
|
|
|
// send the F1 response message up to update F1-U tunnel info
|
|
|
|
|
// it seems the rrc transaction id (xid) is not needed here
|
|
|
|
|
rrc->cucp_cuup.bearer_context_mod(&req, instance, 0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (resp->du_to_cu_rrc_information != NULL && resp->du_to_cu_rrc_information->cellGroupConfig != NULL) {
|
|
|
|
|
LOG_W(RRC, "UE context modification response contains new CellGroupConfig for UE %04x, triggering reconfiguration\n", UE->rnti);
|
|
|
|
|
NR_CellGroupConfig_t *cellGroupConfig = NULL;
|
|
|
|
|
asn_dec_rval_t dec_rval = uper_decode_complete(NULL,
|
|
|
|
|
&asn_DEF_NR_CellGroupConfig,
|
|
|
|
|
(void **)&cellGroupConfig,
|
|
|
|
|
(uint8_t *)resp->du_to_cu_rrc_information->cellGroupConfig,
|
|
|
|
|
resp->du_to_cu_rrc_information->cellGroupConfig_length);
|
|
|
|
|
AssertFatal(dec_rval.code == RC_OK && dec_rval.consumed > 0, "Cell group config decode error\n");
|
|
|
|
|
|
|
|
|
|
if (UE->masterCellGroup) {
|
|
|
|
|
ASN_STRUCT_FREE(asn_DEF_NR_CellGroupConfig, UE->masterCellGroup);
|
|
|
|
|
LOG_I(RRC, "UE %04x replacing existing CellGroupConfig with new one received from DU\n", UE->rnti);
|
|
|
|
|
}
|
|
|
|
|
UE->masterCellGroup = cellGroupConfig;
|
|
|
|
|
|
|
|
|
|
rrc_gNB_generate_dedicatedRRCReconfiguration(&ctxt, ue_context_p, cellGroupConfig);
|
|
|
|
|
|
|
|
|
|
free(cellGroupConfig->rlc_BearerToAddModList);
|
|
|
|
|
free(cellGroupConfig);
|
|
|
|
|
rrc_gNB_generate_dedicatedRRCReconfiguration(&ctxt, ue_context_p);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -2817,46 +2627,48 @@ int rrc_gNB_process_e1_setup_req(e1ap_setup_req_t *req, instance_t instance) {
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void prepare_and_send_ue_context_modification_f1(rrc_gNB_ue_context_t *ue_context_p,
|
|
|
|
|
e1ap_bearer_setup_resp_t *e1ap_resp) {
|
|
|
|
|
void prepare_and_send_ue_context_modification_f1(rrc_gNB_ue_context_t *ue_context_p, e1ap_bearer_setup_resp_t *e1ap_resp)
|
|
|
|
|
{
|
|
|
|
|
/* Generate a UE context modification request message towards the DU to
|
|
|
|
|
* instruct the DU for SRB2 and DRB configuration and get the updates on
|
|
|
|
|
* master cell group config from the DU*/
|
|
|
|
|
|
|
|
|
|
/*Generate a UE context modification request message towards the DU to instruct the DU
|
|
|
|
|
*for SRB2 and DRB configuration and get the updates on master cell group config from the DU*/
|
|
|
|
|
gNB_RRC_INST *rrc = RC.nrrrc[0];
|
|
|
|
|
gNB_RRC_UE_t *UE = &ue_context_p->ue_context;
|
|
|
|
|
|
|
|
|
|
protocol_ctxt_t ctxt = {0};
|
|
|
|
|
PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt, 0, GNB_FLAG_YES, UE->rnti, 0, 0, 0);
|
|
|
|
|
// TODO: So many hard codings
|
|
|
|
|
MessageDef *message_p;
|
|
|
|
|
message_p = itti_alloc_new_message (TASK_RRC_GNB, 0, F1AP_UE_CONTEXT_MODIFICATION_REQ);
|
|
|
|
|
f1ap_ue_context_setup_t *req=&F1AP_UE_CONTEXT_MODIFICATION_REQ(message_p);
|
|
|
|
|
req->rnti = UE->rnti;
|
|
|
|
|
req->mcc = RC.nrrrc[ctxt.module_id]->configuration.mcc[0];
|
|
|
|
|
req->mnc = RC.nrrrc[ctxt.module_id]->configuration.mnc[0];
|
|
|
|
|
req->mnc_digit_length = RC.nrrrc[ctxt.module_id]->configuration.mnc_digit_length[0];
|
|
|
|
|
req->nr_cellid = RC.nrrrc[ctxt.module_id]->nr_cellid;
|
|
|
|
|
|
|
|
|
|
/*Instruction towards the DU for SRB2 configuration*/
|
|
|
|
|
req->srbs_to_be_setup = malloc(1*sizeof(f1ap_srb_to_be_setup_t));
|
|
|
|
|
req->srbs_to_be_setup_length = 1;
|
|
|
|
|
f1ap_srb_to_be_setup_t *SRBs=req->srbs_to_be_setup;
|
|
|
|
|
SRBs[0].srb_id = 2;
|
|
|
|
|
SRBs[0].lcid = 2;
|
|
|
|
|
|
|
|
|
|
/*Instruction towards the DU for DRB configuration and tunnel creation*/
|
|
|
|
|
req->drbs_to_be_setup_length = e1ap_resp->pduSession[0].numDRBSetup;
|
|
|
|
|
req->drbs_to_be_setup = malloc(1*sizeof(f1ap_drb_to_be_setup_t)*req->drbs_to_be_setup_length);
|
|
|
|
|
for (int i=0; i < e1ap_resp->pduSession[0].numDRBSetup; i++) {
|
|
|
|
|
f1ap_drb_to_be_setup_t *DRBs = req->drbs_to_be_setup + i;
|
|
|
|
|
DRBs[i].drb_id = e1ap_resp->pduSession[0].DRBnGRanList[i].id;
|
|
|
|
|
DRBs[i].rlc_mode = RLC_MODE_AM;
|
|
|
|
|
DRBs[i].up_ul_tnl[0].tl_address = e1ap_resp->pduSession[0].DRBnGRanList[i].UpParamList[0].tlAddress;
|
|
|
|
|
DRBs[i].up_ul_tnl[0].port = RC.nrrrc[ctxt.module_id]->eth_params_s.my_portd;
|
|
|
|
|
DRBs[i].up_ul_tnl[0].teid = e1ap_resp->pduSession[0].DRBnGRanList[i].UpParamList[0].teId;
|
|
|
|
|
DRBs[i].up_ul_tnl_length = 1;
|
|
|
|
|
/* Instruction towards the DU for DRB configuration and tunnel creation */
|
|
|
|
|
int nb_drb = e1ap_resp->pduSession[0].numDRBSetup;
|
|
|
|
|
f1ap_drb_to_be_setup_t drbs[nb_drb];
|
|
|
|
|
for (int i = 0; i < nb_drb; i++) {
|
|
|
|
|
drbs[i].drb_id = e1ap_resp->pduSession[0].DRBnGRanList[i].id;
|
|
|
|
|
drbs[i].rlc_mode = rrc->um_on_default_drb ? RLC_MODE_UM : RLC_MODE_AM;
|
|
|
|
|
drbs[i].up_ul_tnl[0].tl_address = e1ap_resp->pduSession[0].DRBnGRanList[i].UpParamList[0].tlAddress;
|
|
|
|
|
drbs[i].up_ul_tnl[0].port = rrc->eth_params_s.my_portd;
|
|
|
|
|
drbs[i].up_ul_tnl[0].teid = e1ap_resp->pduSession[0].DRBnGRanList[i].UpParamList[0].teId;
|
|
|
|
|
drbs[i].up_ul_tnl_length = 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
itti_send_msg_to_task (TASK_CU_F1, ctxt.module_id, message_p);
|
|
|
|
|
/* Instruction towards the DU for SRB2 configuration */
|
|
|
|
|
int nb_srb = 1;
|
|
|
|
|
f1ap_srb_to_be_setup_t srbs[nb_srb];
|
|
|
|
|
srbs[0].srb_id = 2;
|
|
|
|
|
srbs[0].lcid = 2;
|
|
|
|
|
|
|
|
|
|
f1ap_ue_context_modif_req_t ue_context_modif_req = {
|
|
|
|
|
.gNB_CU_ue_id = 0xffffffff, /* filled by F1 for the moment */
|
|
|
|
|
.gNB_DU_ue_id = 0xffffffff, /* filled by F1 for the moment */
|
|
|
|
|
.rnti = UE->rnti,
|
|
|
|
|
.mcc = rrc->configuration.mcc[0],
|
|
|
|
|
.mnc = rrc->configuration.mnc[0],
|
|
|
|
|
.mnc_digit_length = rrc->configuration.mnc_digit_length[0],
|
|
|
|
|
.nr_cellid = rrc->nr_cellid,
|
|
|
|
|
.servCellId = 0, /* TODO: correct value? */
|
|
|
|
|
.srbs_to_be_setup_length = nb_srb,
|
|
|
|
|
.srbs_to_be_setup = srbs,
|
|
|
|
|
.drbs_to_be_setup_length = nb_drb,
|
|
|
|
|
.drbs_to_be_setup = drbs,
|
|
|
|
|
};
|
|
|
|
|
rrc->mac_rrc.ue_context_modification_request(&ue_context_modif_req);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void rrc_gNB_process_e1_bearer_context_setup_resp(e1ap_bearer_setup_resp_t *resp, instance_t instance) {
|
|
|
|
@@ -3047,10 +2859,6 @@ void *rrc_gnb_task(void *args_p) {
|
|
|
|
|
rrc_CU_process_ue_context_modification_response(msg_p, instance);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case F1AP_UE_CONTEXT_MODIFICATION_REQ:
|
|
|
|
|
rrc_DU_process_ue_context_modification_request(msg_p, instance);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case F1AP_UE_CONTEXT_RELEASE_REQ:
|
|
|
|
|
rrc_CU_process_ue_context_release_request(msg_p);
|
|
|
|
|
break;
|
|
|
|
|