Commit 403db5b5 authored by Navid Nikaein's avatar Navid Nikaein

Fix the issue in sending UE Initial Context Setup Response

parent 3d41f5cb
......@@ -345,10 +345,11 @@ int CU_send_F1_SETUP_RESPONSE(instance_t instance,
cells_to_be_activated_list_itemExtIEs->extensionValue.present = F1AP_Cells_to_be_Activated_List_ItemExtIEs__extensionValue_PR_GNB_CUSystemInformation;
F1AP_GNB_CUSystemInformation_t *gNB_CUSystemInformation = (F1AP_GNB_CUSystemInformation_t *)calloc(1, sizeof(F1AP_GNB_CUSystemInformation_t));
#ifdef F1AP_DEBUG
LOG_D(CU_F1AP, "SI %d: ",i);
for (int n=0;n<f1ap_setup_resp->SI_container_length[i][0];n++) LOG_D(CU_F1AP, "%2x ",f1ap_setup_resp->SI_container[i][0][n]);
for (int n=0;n<f1ap_setup_resp->SI_container_length[i][0];n++) printf("%2x ",f1ap_setup_resp->SI_container[i][0][n]);
LOG_D(CU_F1AP, "\n");
#endif
OCTET_STRING_fromBuf(&gNB_CUSystemInformation->sImessage,
(const char*)f1ap_setup_resp->SI_container[i][0],
f1ap_setup_resp->SI_container_length[i][0]);
......
......@@ -121,9 +121,11 @@ int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instance,
ccch_sdu_len = ie->value.choice.RRCContainer.size;
memcpy(RRC_MAC_CCCH_DATA_IND (message_p).sdu, ie->value.choice.RRCContainer.buf,
ccch_sdu_len);
LOG_D(CU_F1AP, "RRCContainer(CCCH) :");
for (int i=0;i<ie->value.choice.RRCContainer.size;i++) LOG_D(CU_F1AP, "%2x ",RRC_MAC_CCCH_DATA_IND (message_p).sdu[i]);
LOG_D(CU_F1AP, "\n");
#ifdef F1AP_DEBUG
LOG_I(CU_F1AP, "RRCContainer(CCCH) :");
for (int i=0;i<ie->value.choice.RRCContainer.size;i++) printf("%2x ",RRC_MAC_CCCH_DATA_IND (message_p).sdu[i]);
LOG_I(CU_F1AP, "\n");
#endif
// Find instance from nr_cellid
int rrc_inst = -1;
for (int i=0;i<RC.nb_inst;i++) {
......
......@@ -33,7 +33,7 @@
#include "f1ap_common.h"
#include "f1ap_decoder.h"
int asn1_decoder_xer_print = 1;
int asn1_decoder_xer_print = 0;
static int f1ap_decode_initiating_message(F1AP_F1AP_PDU_t *pdu)
{
......
......@@ -197,27 +197,27 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance,
switch (dl_ccch_msg->message.choice.c1.present) {
case DL_CCCH_MessageType__c1_PR_NOTHING:
LOG_I(RRC, "Received PR_NOTHING on DL-CCCH-Message\n");
LOG_I(DU_F1AP, "Received PR_NOTHING on DL-CCCH-Message\n");
break;
case DL_CCCH_MessageType__c1_PR_rrcConnectionReestablishment:
LOG_I(RRC,
LOG_I(DU_F1AP,
"Logical Channel DL-CCCH (SRB0), Received RRCConnectionReestablishment\n");
break;
case DL_CCCH_MessageType__c1_PR_rrcConnectionReestablishmentReject:
LOG_I(RRC,
LOG_I(DU_F1AP,
"Logical Channel DL-CCCH (SRB0), Received RRCConnectionReestablishmentReject\n");
break;
case DL_CCCH_MessageType__c1_PR_rrcConnectionReject:
LOG_I(RRC,
LOG_I(DU_F1AP,
"Logical Channel DL-CCCH (SRB0), Received RRCConnectionReject \n");
break;
case DL_CCCH_MessageType__c1_PR_rrcConnectionSetup:
{
LOG_I(RRC,
LOG_I(DU_F1AP,
"Logical Channel DL-CCCH (SRB0), Received RRCConnectionSetup DU_ID %x/RNTI %x\n",
du_ue_f1ap_id,
f1ap_get_rnti_by_du_id(&f1ap_du_ue[instance],du_ue_f1ap_id));
......@@ -409,9 +409,9 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance,
else if (SRB_configList->list.array[i]->srb_Identity == 2 ) {
ue_context_p->ue_context.Srb2.Active=1;
ue_context_p->ue_context.Srb2.Srb_info.Srb_id=2;
LOG_I(RRC,"[DU %d] SRB2 is now active\n",ctxt.module_id);
LOG_I(DU_F1AP,"[DU %d] SRB2 is now active\n",ctxt.module_id);
} else {
LOG_W(RRC,"[DU %d] invalide SRB identity %ld\n",ctxt.module_id,
LOG_W(DU_F1AP,"[DU %d] invalide SRB identity %ld\n",ctxt.module_id,
SRB_configList->list.array[i]->srb_Identity);
}
}
......@@ -421,7 +421,7 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance,
for (i = 0; i < DRB_configList->list.count; i++) { // num max DRB (11-3-8)
if (DRB_configList->list.array[i]) {
drb_id = (int)DRB_configList->list.array[i]->drb_Identity;
LOG_I(RRC,
LOG_I(DU_F1AP,
"[DU %d] Logical Channel UL-DCCH, Received RRCConnectionReconfiguration for UE rnti %x, reconfiguring DRB %d/LCID %d\n",
ctxt.module_id,
ctxt.rnti,
......@@ -542,27 +542,27 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance,
);
switch (rlc_status) {
case RLC_OP_STATUS_OK:
LOG_D(PDCP, "Data sending request over RLC succeeded!\n");
LOG_I(DU_F1AP, "Data sending request over RLC succeeded!\n");
ret=TRUE;
break;
case RLC_OP_STATUS_BAD_PARAMETER:
LOG_W(PDCP, "Data sending request over RLC failed with 'Bad Parameter' reason!\n");
LOG_W(DU_F1AP, "Data sending request over RLC failed with 'Bad Parameter' reason!\n");
ret= FALSE;
break;
case RLC_OP_STATUS_INTERNAL_ERROR:
LOG_W(PDCP, "Data sending request over RLC failed with 'Internal Error' reason!\n");
LOG_W(DU_F1AP, "Data sending request over RLC failed with 'Internal Error' reason!\n");
ret= FALSE;
break;
case RLC_OP_STATUS_OUT_OF_RESSOURCES:
LOG_W(PDCP, "Data sending request over RLC failed with 'Out of Resources' reason!\n");
LOG_W(DU_F1AP, "Data sending request over RLC failed with 'Out of Resources' reason!\n");
ret= FALSE;
break;
default:
LOG_W(PDCP, "RLC returned an unknown status code after PDCP placed the order to send some data (Status Code:%d)\n", rlc_status);
LOG_W(DU_F1AP, "RLC returned an unknown status code after PDCP placed the order to send some data (Status Code:%d)\n", rlc_status);
ret= FALSE;
break;
} // switch case
......@@ -591,7 +591,7 @@ int DU_send_UL_RRC_MESSAGE_TRANSFER(const protocol_ctxt_t* const ctxt_pP,
uint32_t len;
LOG_I(RRC,"[DU %d] Received UL_RRC_MESSAGE_TRANSFER : size %d UE RNTI %x in SRB %d\n",
LOG_I(DU_F1AP,"[DU %d] Received UL_RRC_MESSAGE_TRANSFER : size %d UE RNTI %x in SRB %d\n",
ctxt_pP->module_id, sdu_sizeP, rnti, rb_idP);
struct rrc_eNB_ue_context_s* ue_context_p = rrc_eNB_get_ue_context(
......@@ -666,7 +666,7 @@ int DU_send_UL_RRC_MESSAGE_TRANSFER(const protocol_ctxt_t* const ctxt_pP,
if ((dec_rval.code != RC_OK) && (dec_rval.consumed == 0))
LOG_E(DU_F1AP," Failed to decode UL-DCCH (%zu bytes)\n",dec_rval.consumed);
else
LOG_D(RRC, "Received message: present %d and c1 present %d\n",
LOG_I(DU_F1AP, "Received message: present %d and c1 present %d\n",
ul_dcch_msg->message.present, ul_dcch_msg->message.choice.c1.present);
if (ul_dcch_msg->message.present == UL_DCCH_MessageType_PR_c1) {
......@@ -688,7 +688,7 @@ int DU_send_UL_RRC_MESSAGE_TRANSFER(const protocol_ctxt_t* const ctxt_pP,
break;
case UL_DCCH_MessageType__c1_PR_rrcConnectionSetupComplete:
LOG_I(RRC,"[MSG] RRC UL rrcConnectionSetupComplete \n");
LOG_I(DU_F1AP,"[MSG] RRC UL rrcConnectionSetupComplete \n");
if(!ue_context_p){
LOG_E(DU_F1AP, "Did not find the UE context associated with UE RNTOI %x, ue_context_p is NULL\n", ctxt_pP->rnti);
}else {
......@@ -698,21 +698,21 @@ int DU_send_UL_RRC_MESSAGE_TRANSFER(const protocol_ctxt_t* const ctxt_pP,
break;
case UL_DCCH_MessageType__c1_PR_securityModeComplete:
LOG_I(RRC,"[MSG] RRC securityModeComplete \n");
LOG_I(DU_F1AP,"[MSG] RRC securityModeComplete \n");
break;
case UL_DCCH_MessageType__c1_PR_securityModeFailure:
break;
case UL_DCCH_MessageType__c1_PR_ueCapabilityInformation:
LOG_I(RRC,"[MSG] RRC ueCapabilityInformation \n");
LOG_I(DU_F1AP,"[MSG] RRC ueCapabilityInformation \n");
break;
case UL_DCCH_MessageType__c1_PR_ulHandoverPreparationTransfer:
break;
case UL_DCCH_MessageType__c1_PR_ulInformationTransfer:
LOG_I(RRC,"[MSG] RRC UL Information Transfer \n");
LOG_I(DU_F1AP,"[MSG] RRC UL Information Transfer \n");
break;
case UL_DCCH_MessageType__c1_PR_counterCheckResponse:
......
......@@ -33,7 +33,7 @@
#include "f1ap_common.h"
#include "f1ap_encoder.h"
int asn1_encoder_xer_print = 1;
int asn1_encoder_xer_print = 0;
/*
static inline int f1ap_encode_initiating(f1ap_message *message,
......
......@@ -5570,6 +5570,7 @@ rrc_eNB_process_RRCConnectionReconfigurationComplete(
#endif
);
}
// set the SRB active in Ue context
if (SRB_configList != NULL) {
for (i = 0; (i < SRB_configList->list.count) && (i < 3); i++) {
......@@ -5626,7 +5627,6 @@ rrc_eNB_process_RRCConnectionReconfigurationComplete(
RADIO_ACCESS_BEARER,Rlc_info_um);
*/
ue_context_pP->ue_context.DRB_active[drb_id] = 1;
LOG_D(RRC,
"[eNB %d] Frame %d: Establish RLC UM Bidirectional, DRB %d Active\n",
ctxt_pP->module_id, ctxt_pP->frame, (int)DRB_configList->list.array[i]->drb_Identity);
......@@ -5710,7 +5710,7 @@ rrc_eNB_process_RRCConnectionReconfigurationComplete(
}
} else { // remove LCHAN from MAC/PHY
if (ue_context_pP->ue_context.DRB_active[drb_id] == 1) {
if (ue_context_pP->ue_context.DRB_active[drb_id] == 1) {
// DRB has just been removed so remove RLC + PDCP for DRB
/* rrc_pdcp_config_req (ctxt_pP->module_id, frameP, 1, CONFIG_ACTION_REMOVE,
(ue_mod_idP * NB_RB_MAX) + DRB2LCHAN[i],UNDEF_SECURITY_MODE);
......@@ -6297,7 +6297,9 @@ rrc_eNB_decode_ccch(
rrc_eNB_process_RRCConnectionReconfigurationComplete(&ctxt_old_p,
ue_context_p,
ue_context_p->ue_context.reestablishment_xid);
LOG_E(RRC, "RRRCConnectionReconfigurationComplete: ue_context_p->ue_context.nb_of_e_rabs = %d \n", ue_context_p->ue_context.nb_of_e_rabs);
for (uint8_t e_rab = 0; e_rab < ue_context_p->ue_context.nb_of_e_rabs; e_rab++) {
LOG_E(RRC, "RRRCConnectionReconfigurationComplete: ue_context_p->ue_context.e_rab[e_rab].status = %d \n", ue_context_p->ue_context.e_rab[e_rab].status);
if (ue_context_p->ue_context.e_rab[e_rab].status == E_RAB_STATUS_DONE) {
ue_context_p->ue_context.e_rab[e_rab].status = E_RAB_STATUS_ESTABLISHED;
} else {
......@@ -6427,6 +6429,7 @@ rrc_eNB_decode_ccch(
ctxt_pP->rnti);
if (ue_context_p != NULL) {
LOG_D(RRC,"ue_context_p already exist %p %d %x \n", ue_context_p, ctxt_pP->module_id, ctxt_pP->rnti);
// erase content
rrc_eNB_free_mem_UE_context(ctxt_pP, ue_context_p);
......@@ -6461,7 +6464,14 @@ rrc_eNB_decode_ccch(
ue_context_p->ue_context.ul_failure_timer = 20000;
}
ue_context_p = rrc_eNB_get_next_free_ue_context(ctxt_pP, random_value);
ue_context_p->ue_context.Srb0.Active=1;
ue_context_p->ue_context.Srb0.Srb_id=0;
ue_context_p->ue_context.Srb0.Active=1;
memcpy(ue_context_p->ue_context.Srb0.Rx_buffer.Payload,
buffer,
buffer_length);
ue_context_p->ue_context.Srb0.Rx_buffer.payload_size=buffer_length;
} else if (InitialUE_Identity_PR_s_TMSI == rrcConnectionRequest->ue_Identity.present) {
/* Save s-TMSI */
S_TMSI_t s_TMSI = rrcConnectionRequest->ue_Identity.choice.s_TMSI;
......@@ -6542,7 +6552,6 @@ rrc_eNB_decode_ccch(
if (ue_context_p != NULL) {
#if defined(ENABLE_ITTI)
ue_context_p->ue_context.establishment_cause = rrcConnectionRequest->establishmentCause;
ue_context_p->ue_context.reestablishment_cause = ReestablishmentCause_spare1;
......@@ -6807,9 +6816,9 @@ rrc_eNB_decode_dcch(
/*FK: left the condition as is for the case MME is used (S1 mode) but setting dedicated_DRB = 1 otherwise (noS1 mode) so that no second RRCReconfiguration message activationg more DRB is sent as this causes problems with the nasmesh driver.*/
if (EPC_MODE_ENABLED) {
if (ue_context_p->ue_context.Status == RRC_RECONFIGURED){
//dedicated_DRB = 1;
dedicated_DRB = 1;
LOG_I(RRC,
PROTOCOL_RRC_CTXT_UE_FMT" UE State = RRC_RECONFIGURED (dedicated DRB, xid %ld)\n",
PROTOCOL_RRC_CTXT_UE_FMT" UE State = RRC_RECONFIGURED (reconfigure default DRB /dedicated DRB, xid %ld)\n",
PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.rrc_TransactionIdentifier);
//clear
// FIX ME: MAC context does not exist in CU
......@@ -6847,10 +6856,9 @@ rrc_eNB_decode_dcch(
}
ue_context_p->ue_context.reestablishment_xid = -1;
} else {
//dedicated_DRB = 1;
ue_context_p->ue_context.Status = RRC_RECONFIGURED;
LOG_I(RRC,
PROTOCOL_RRC_CTXT_UE_FMT" UE State = RRC_RECONFIGURED (dedicated DRB, xid %ld)\n",
PROTOCOL_RRC_CTXT_UE_FMT" UE State = RRC_RECONFIGURED (default DRB, xid %ld)\n",
PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.rrc_TransactionIdentifier);
}
}
......@@ -6911,11 +6919,14 @@ if (ue_context_p->ue_context.nb_of_modify_e_rabs > 0) {
ul_dcch_msg->message.choice.c1.choice.rrcConnectionReconfigurationComplete.rrc_TransactionIdentifier);
}
}else if(dedicated_DRB == 0){
if(ue_context_p->ue_context.reestablishment_cause == ReestablishmentCause_spare1){
LOG_I(RRC, "Sending rrc_eNB_send_S1AP_INITIAL_CONTEXT_SETUP_RESP\n");
rrc_eNB_send_S1AP_INITIAL_CONTEXT_SETUP_RESP(ctxt_pP,
LOG_D(RRC, "Sending rrc_eNB_send_S1AP_INITIAL_CONTEXT_SETUP_RESP, establishment cause %d\n",
ue_context_p->ue_context.reestablishment_cause );
// NN: not sure what we need to send S1AP_INITIAL_CONTEXT_SETUP_RESP only with this cause?
//if(ue_context_p->ue_context.reestablishment_cause == ReestablishmentCause_spare1){
rrc_eNB_send_S1AP_INITIAL_CONTEXT_SETUP_RESP(ctxt_pP,
ue_context_p);
} else {
// } else
{
ue_context_p->ue_context.reestablishment_cause = ReestablishmentCause_spare1;
for (uint8_t e_rab = 0; e_rab < ue_context_p->ue_context.nb_of_e_rabs; e_rab++) {
if (ue_context_p->ue_context.e_rab[e_rab].status == E_RAB_STATUS_DONE) {
......@@ -7593,6 +7604,8 @@ rrc_enb_task(
PROTOCOL_RRC_CTXT_UE_ARGS(&ctxt),
msg_name_p);
// this part will be done in rrc_eNB_decode_ccch
/*
struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_ue_context(RC.rrc[rrc_inst],
RRC_MAC_CCCH_DATA_IND(msg_p).rnti);
......@@ -7604,16 +7617,13 @@ rrc_enb_task(
);
}
CC_id = RRC_MAC_CCCH_DATA_IND(msg_p).CC_id;
eNB_RRC_UE_t *ue_p = &ue_context_p->ue_context;
srb_info_p = &ue_p->Srb0;
LOG_I(RRC,"Decoding CCCH : inst %d, CC_id %d, ue_context %p (rnti %x), sib_info_p->Rx_buffer.payload_size %d\n",
rrc_inst,CC_id,ue_p, ue_p->rnti,RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size);
if (RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size >= RRC_BUFFER_SIZE_MAX) {
LOG_I(RRC, "CCCH message has size %d > %d\n",RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size,RRC_BUFFER_SIZE_MAX);
break;
}
CC_id = RRC_MAC_CCCH_DATA_IND(msg_p).CC_id;
memcpy(srb_info_p->Rx_buffer.Payload,
RRC_MAC_CCCH_DATA_IND(msg_p).sdu,
RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size);
......@@ -7621,6 +7631,14 @@ rrc_enb_task(
srb_info_p->Active = 1;
rrc_eNB_decode_ccch(&ctxt, (uint8_t*)srb_info_p->Rx_buffer.Payload,srb_info_p->Rx_buffer.payload_size, CC_id);
*/
if (RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size >= RRC_BUFFER_SIZE_MAX) {
LOG_W(RRC, "CCCH message has size %d > %d\n",RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size,RRC_BUFFER_SIZE_MAX);
}
rrc_eNB_decode_ccch(&ctxt,
(uint8_t*)RRC_MAC_CCCH_DATA_IND(msg_p).sdu,
RRC_MAC_CCCH_DATA_IND(msg_p).sdu_size,
RRC_MAC_CCCH_DATA_IND(msg_p).CC_id);
break;
/* Messages from PDCP */
......
......@@ -983,6 +983,7 @@ int rrc_eNB_process_S1AP_INITIAL_CONTEXT_SETUP_REQ(MessageDef *msg_p, const char
memset(&create_tunnel_req, 0 , sizeof(create_tunnel_req));
ue_context_p->ue_context.nb_of_e_rabs = S1AP_INITIAL_CONTEXT_SETUP_REQ (msg_p).nb_of_e_rabs;
LOG_E(RRC, "rrc_eNB_process_S1AP_INITIAL_CONTEXT_SETUP_REQ: ue_context_p->ue_context.nb_of_e_rabs = %d \n", ue_context_p->ue_context.nb_of_e_rabs);
for (i = 0; i < ue_context_p->ue_context.nb_of_e_rabs; i++) {
ue_context_p->ue_context.e_rab[i].status = E_RAB_STATUS_NEW;
ue_context_p->ue_context.e_rab[i].param = S1AP_INITIAL_CONTEXT_SETUP_REQ (msg_p).e_rab_param[i];
......
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