Commit a75d2008 authored by matzakos's avatar matzakos

Trigger UE context response from RRC by sending ITTI to F1AP task

-Fix contents of F1AP UE context setup response message
parent 16ea0186
......@@ -45,7 +45,7 @@ MESSAGE_DEF(F1AP_UE_CONTEXT_RELEASE_CMD, MESSAGE_PRIORITY_MED, f1ap_ue_context_r
MESSAGE_DEF(F1AP_DL_RRC_MESSAGE , MESSAGE_PRIORITY_MED, f1ap_dl_rrc_message_t , f1ap_dl_rrc_message )
//MESSAGE_DEF(F1AP_INITIAL_CONTEXT_SETUP_REQ , MESSAGE_PRIORITY_MED, f1ap_initial_context_setup_req_t , f1ap_initial_context_setup_req )
MESSAGE_DEF(F1AP_UE_CONTEXT_SETUP_REQ, MESSAGE_PRIORITY_MED, f1ap_ue_context_setup_req_t, f1ap_ue_context_setup_req)
MESSAGE_DEF(F1AP_UE_CONTEXT_SETUP_RESP, MESSAGE_PRIORITY_MED, f1ap_ue_context_setup_resp_t, f1ap_ue_context_setup_resp)
MESSAGE_DEF(F1AP_UE_CONTEXT_SETUP_RESP, MESSAGE_PRIORITY_MED, f1ap_ue_context_setup_req_t, f1ap_ue_context_setup_resp)
......
......@@ -353,6 +353,8 @@ typedef struct f1ap_ue_context_setup_req_s {
uint32_t servCellId;
uint8_t *cu_to_du_rrc_information;
uint8_t cu_to_du_rrc_information_length;
uint8_t *du_to_cu_rrc_information;
uint8_t du_to_cu_rrc_information_length;
f1ap_drb_to_be_setup_t *drbs_to_be_setup; // BK: need to replace by s1ap_initial_context_setup_req
uint8_t drbs_to_be_setup_length; // BK: need to replace by s1ap_initial_context_setup_req
f1ap_srb_to_be_setup_t *srbs_to_be_setup;
......
......@@ -178,6 +178,10 @@ void *F1AP_DU_task(void *arg) {
break;
case F1AP_UE_CONTEXT_SETUP_RESP:
DU_send_UE_CONTEXT_SETUP_RESPONSE(ITTI_MSG_DESTINATION_INSTANCE(received_msg), &F1AP_UE_CONTEXT_SETUP_RESP(received_msg));
break;
case F1AP_UE_CONTEXT_RELEASE_REQ: // from MAC
LOG_I(F1AP, "DU Task Received F1AP_UE_CONTEXT_RELEASE_REQ\n");
DU_send_UE_CONTEXT_RELEASE_REQUEST(ITTI_MSG_DESTINATION_INSTANCE(received_msg),
......
......@@ -42,22 +42,6 @@
#include "openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h"
#include <openair3/ocp-gtpu/gtp_itf.h>
boolean_t 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;
}
int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, f1ap_ue_context_setup_req_t *req);
int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance,
......@@ -166,7 +150,7 @@ int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance,
break;
}
transport_layer_addr_t addr;
/*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;
drb_p->up_dl_tnl[0].teid=newGtpuCreateTunnel(INSTANCE_DEFAULT,
......@@ -176,7 +160,7 @@ int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance,
drb_p->up_ul_tnl[0].teid,
addr,
2152,
DURecvCb);
DURecvCb);*/
}
}
......@@ -230,7 +214,7 @@ int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance,
LOG_W(F1AP, "can't find RRCContainer in UEContextSetupRequestIEs by id %ld \n", F1AP_ProtocolIE_ID_id_RRCContainer);
}
DU_send_UE_CONTEXT_SETUP_RESPONSE(instance, f1ap_ue_context_setup_req);
//DU_send_UE_CONTEXT_SETUP_RESPONSE(instance, f1ap_ue_context_setup_req);
itti_send_msg_to_task(TASK_RRC_GNB, instance, msg_p);
return 0;
}
......@@ -254,26 +238,26 @@ int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, f1ap_ue_context_setup
ie1->id = F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID;
ie1->criticality = F1AP_Criticality_reject;
ie1->value.present = F1AP_UEContextSetupResponseIEs__value_PR_GNB_CU_UE_F1AP_ID;
ie1->value.choice.GNB_CU_UE_F1AP_ID = req->gNB_CU_ue_id;
ie1->value.choice.GNB_CU_UE_F1AP_ID = req->gNB_CU_ue_id; //f1ap_get_cu_ue_f1ap_id(true, instance, req->rnti);
/* mandatory */
/* c2. GNB_DU_UE_F1AP_ID */
asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextSetupResponseIEs_t, ie2);
ie2->id = F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID;
ie2->criticality = F1AP_Criticality_reject;
ie2->value.present = F1AP_UEContextSetupResponseIEs__value_PR_GNB_DU_UE_F1AP_ID;
ie2->value.choice.GNB_DU_UE_F1AP_ID = req->gNB_DU_ue_id;
ie2->value.choice.GNB_DU_UE_F1AP_ID = f1ap_get_du_ue_f1ap_id(false, instance, req->rnti);
/* mandatory */
/* c3. DUtoCURRCInformation */
if (0) {
//if (0) {
asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextSetupResponseIEs_t, ie3);
ie3->id = F1AP_ProtocolIE_ID_id_DUtoCURRCInformation;
ie3->criticality = F1AP_Criticality_reject;
ie3->value.present = F1AP_UEContextSetupResponseIEs__value_PR_DUtoCURRCInformation;
{
/* cellGroupConfig */
OCTET_STRING_fromBuf(&ie3->value.choice.DUtoCURRCInformation.cellGroupConfig, "asdsa",
strlen("asdsa"));
OCTET_STRING_fromBuf(&ie3->value.choice.DUtoCURRCInformation.cellGroupConfig, (const char *)req->du_to_cu_rrc_information,
req->du_to_cu_rrc_information_length);
/* OPTIONAL */
/* measGapConfig */
......@@ -291,7 +275,7 @@ int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, f1ap_ue_context_setup
OCTET_STRING_fromBuf(tmp, "asdsa", strlen("asdsa"));
}
}
}
//}
/* optional */
/* c4. C_RNTI */
......@@ -332,7 +316,6 @@ int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, f1ap_ue_context_setup
ie7->id = F1AP_ProtocolIE_ID_id_DRBs_Setup_List;
ie7->criticality = F1AP_Criticality_ignore;
ie7->value.present = F1AP_UEContextSetupResponseIEs__value_PR_DRBs_Setup_List;
for (int i=0; i< req->drbs_to_be_setup_length; i++) {
//
asn1cSequenceAdd(ie7->value.choice.DRBs_Setup_List.list,
......@@ -372,6 +355,7 @@ int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, f1ap_ue_context_setup
/* mandatory */
/* c8. SRBs_FailedToBeSetup_List */
if(0){
asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextSetupResponseIEs_t, ie8);
ie8->id = F1AP_ProtocolIE_ID_id_SRBs_FailedToBeSetup_List;
ie8->criticality = F1AP_Criticality_ignore;
......@@ -416,9 +400,11 @@ int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, f1ap_ue_context_setup
break;
} // switch
} // for i
}
/* */
/* c9. DRBs_FailedToBeSetup_List */
if(0){
asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextSetupResponseIEs_t, ie9);
ie9->id = F1AP_ProtocolIE_ID_id_DRBs_FailedToBeSetup_List;
ie9->criticality = F1AP_Criticality_ignore;
......@@ -463,9 +449,11 @@ int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, f1ap_ue_context_setup
break;
} // switch
} // for i
}
// /* */
/* c10. SCell_FailedtoSetup_List */
if(0){
asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextSetupResponseIEs_t, ie10);
ie10->id = F1AP_ProtocolIE_ID_id_SCell_FailedtoSetup_List;
ie10->criticality = F1AP_Criticality_ignore;
......@@ -509,9 +497,30 @@ int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, f1ap_ue_context_setup
break;
} // switch
} // for i
}
/* mandatory */
/* c11. SRBs_Setup_List */
asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextSetupResponseIEs_t, ie11);
ie11->id = F1AP_ProtocolIE_ID_id_SRBs_Setup_List;
ie11->criticality = F1AP_Criticality_ignore;
ie11->value.present = F1AP_UEContextSetupResponseIEs__value_PR_SRBs_Setup_List;
for (int i=0; i< req->srbs_to_be_setup_length; i++) {//
asn1cSequenceAdd(ie11->value.choice.SRBs_Setup_List.list,
F1AP_SRBs_Setup_ItemIEs_t, srbs_setup_item_ies);
srbs_setup_item_ies->id = F1AP_ProtocolIE_ID_id_SRBs_Setup_Item;
srbs_setup_item_ies->criticality = F1AP_Criticality_ignore;
srbs_setup_item_ies->value.present = F1AP_SRBs_Setup_ItemIEs__value_PR_SRBs_Setup_Item;
/* 11.1 SRBs_Setup_Item */
/* ADD */
F1AP_SRBs_Setup_Item_t *srbs_setup_item=&srbs_setup_item_ies->value.choice.SRBs_Setup_Item;
/* sRBID */
srbs_setup_item->sRBID = req->srbs_to_be_setup[i].srb_id;
}
/* Optional */
/* c11. InactivityMonitoringResponse */
/* c12. InactivityMonitoringResponse */
if (0) {
asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextSetupResponseIEs_t, ie11);
ie11->id = F1AP_ProtocolIE_ID_id_InactivityMonitoringResponse;
......@@ -521,7 +530,7 @@ int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, f1ap_ue_context_setup
}
/* Optional */
/* c12. CriticalityDiagnostics */
/* c13. CriticalityDiagnostics */
if (0) {
asn1cSequenceAdd(out->protocolIEs.list, F1AP_UEContextSetupResponseIEs_t, ie12);
ie12->id = F1AP_ProtocolIE_ID_id_CriticalityDiagnostics;
......
......@@ -134,6 +134,23 @@ uint8_t first_rrcreconfiguration = 0;
///---------------------------------------------------------------------------------------------------------------///
///---------------------------------------------------------------------------------------------------------------///
boolean_t 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;
}
void openair_nr_rrc_on(const protocol_ctxt_t *const ctxt_pP) {
LOG_I(NR_RRC, PROTOCOL_NR_RRC_CTXT_FMT" gNB:OPENAIR NR RRC IN....\n",PROTOCOL_NR_RRC_CTXT_ARGS(ctxt_pP));
rrc_config_nr_buffer (&RC.nrrrc[ctxt_pP->module_id]->carrier.SI, BCCH, 1);
......@@ -1365,7 +1382,8 @@ rrc_gNB_process_RRCReconfigurationComplete(
/* Here the callback function used as input is not the right one. Need to create a new one probably for F1-U, not sure
* if the kind of input parameters to the callback function are convenient though for gtp-u over F1-U.*/
ue_context_pP->ue_context.incoming_teid[i] = newGtpuCreateTunnel(INSTANCE_DEFAULT, create_tunnel_req.rnti,
uint32_t incoming_teid;
incoming_teid = newGtpuCreateTunnel(INSTANCE_DEFAULT, create_tunnel_req.rnti,
create_tunnel_req.incoming_rb_id[i],
create_tunnel_req.incoming_rb_id[i],
create_tunnel_req.outgoing_teid[i],
......@@ -1374,7 +1392,7 @@ rrc_gNB_process_RRCReconfigurationComplete(
F1AP_UE_CONTEXT_SETUP_REQ (message_p).drbs_to_be_setup[i].drb_id = DRB_configList->list.array[i]->drb_Identity;
F1AP_UE_CONTEXT_SETUP_REQ (message_p).drbs_to_be_setup[i].rlc_mode = RLC_MODE_AM;
F1AP_UE_CONTEXT_SETUP_REQ (message_p).drbs_to_be_setup[i].up_ul_tnl[0].teid = ue_context_pP->ue_context.incoming_teid[i];
F1AP_UE_CONTEXT_SETUP_REQ (message_p).drbs_to_be_setup[i].up_ul_tnl[0].teid = incoming_teid;
F1AP_UE_CONTEXT_SETUP_REQ (message_p).drbs_to_be_setup[i].up_ul_tnl[0].tl_address = inet_addr(rrc->eth_params_s.my_addr);
F1AP_UE_CONTEXT_SETUP_REQ (message_p).drbs_to_be_setup[i].up_ul_tnl_length = 1;
}
......@@ -3134,8 +3152,13 @@ static void rrc_DU_process_ue_context_setup_request(MessageDef *msg_p, const cha
ctxt.instance = instance;
ctxt.enb_flag = 1;
gNB_RRC_INST *rrc = RC.nrrrc[ctxt.module_id];
gNB_MAC_INST *mac = RC.nrmac[ctxt.module_id];
struct rrc_gNB_ue_context_s *ue_context_p =
rrc_gNB_get_ue_context(rrc, ctxt.rnti);
MessageDef *message_p;
message_p = itti_alloc_new_message (TASK_RRC_GNB, 0, F1AP_UE_CONTEXT_SETUP_RESP);
f1ap_ue_context_setup_req_t * resp=&F1AP_UE_CONTEXT_SETUP_RESP(message_p);
uint32_t incoming_teid = 0;
NR_CellGroupConfig_t *cellGroupConfig;
......@@ -3145,6 +3168,7 @@ static void rrc_DU_process_ue_context_setup_request(MessageDef *msg_p, const cha
/* Configure SRB2 */
NR_SRB_ToAddMod_t *SRB2_config = NULL;
NR_SRB_ToAddModList_t *SRB_configList = ue_context_p->ue_context.SRB_configList;
uint8_t SRBs_before_new_addition = ue_context_p->ue_context.SRB_configList->list.count;
if(SRB_configList != NULL){
for (int i=0; i<req->srbs_to_be_setup_length; i++){
SRB2_config = CALLOC(1, sizeof(*SRB2_config));
......@@ -3167,9 +3191,53 @@ static void rrc_DU_process_ue_context_setup_request(MessageDef *msg_p, const cha
DRB_config = CALLOC(1, sizeof(*DRB_config));
DRB_config->drb_Identity = req->drbs_to_be_setup[i].drb_id;
ASN_SEQUENCE_ADD(&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;
incoming_teid=newGtpuCreateTunnel(INSTANCE_DEFAULT,
req->rnti,
drb_p.drb_id,
drb_p.drb_id,
drb_p.up_ul_tnl[0].teid,
addr,
2152,
DURecvCb);
}
apply_macrlc_config(rrc, ue_context_p, &ctxt);
/* 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.rnti;
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;
}
if(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_E(NR_RRC, "SRB failed to get added \n");
}
resp->du_to_cu_rrc_information = calloc(1,1024*sizeof(uint8_t));
asn_enc_rval_t enc_rval = uper_encode_to_buffer(&asn_DEF_NR_CellGroupConfig,
NULL,
(void *)ue_context_p->ue_context.masterCellGroup,
resp->du_to_cu_rrc_information,
1024);
resp->du_to_cu_rrc_information_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, const char *msg_name, instance_t instance){
......
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