Commit 7bdee0c7 authored by oai's avatar oai

RRC forward authentication_rsp & security_mode_cmd to MAC

parent 1f6c08c9
......@@ -1653,6 +1653,32 @@ uint32_t turbo_decoding_NB_IoT(PHY_VARS_eNB *eNB,
fill_rx_indication_NB_IoT(eNB,proc,npusch_format,1);
printf(" NPUSCH OK\n");
} else {
if (r<ulsch_harq->Cminus)
{
Kr = ulsch_harq->Kminus;
} else {
Kr = ulsch_harq->Kplus;
Kr_bytes = Kr>>3;
}
if (r==0)
{
memcpy(ulsch_harq->b,
&ulsch_harq->c[0][(ulsch_harq->F>>3)],
Kr_bytes - (ulsch_harq->F>>3) - ((ulsch_harq->C>1)?3:0));
offset = Kr_bytes - (ulsch_harq->F>>3) - ((ulsch_harq->C>1)?3:0);
} else {
memcpy(ulsch_harq->b+offset,
ulsch_harq->c[r],
Kr_bytes - ((ulsch_harq->C>1)?3:0));
offset += (Kr_bytes- ((ulsch_harq->C>1)?3:0));
}
int x = 0;
LOG_N(PHY,"Show the undecoded data: ");
for (x = 0; x < 18; x ++)
printf("%02x ",ulsch_harq->b[x]);
printf("\n");
fill_crc_indication_NB_IoT(eNB,0,rx_frame,rx_subframe,0); // indicate NAK to MAC
fill_rx_indication_NB_IoT(eNB,proc,npusch_format,0);
printf(" NPUSCH NOT OK\n");
......
......@@ -294,8 +294,8 @@ void schedule_uss_NB_IoT(module_id_t module_id, eNB_MAC_INST_NB_IoT *mac_inst, u
UE_template_temp->R_dl=UE_sched_ctrl_info->R_dl_data;
UE_template_temp->I_mcs_dl=UE_sched_ctrl_info->dci_n1_index_mcs;
UE_template_temp->DLSCH_pdu_size=UE_sched_ctrl_info->TBS;
if(UE_template_temp->HARQ_round==0)
UE_template_temp->oldNDI_DL=(UE_template_temp->oldNDI_DL+1)%2;
//if(UE_template_temp->HARQ_round==0)
//UE_template_temp->oldNDI_DL=(UE_template_temp->oldNDI_DL+1)%2;
UE_template_temp->direction = 3;
break;
case 0: // Uplink
......
......@@ -54,13 +54,6 @@ int schedule_DL_NB_IoT(module_id_t module_id, eNB_MAC_INST_NB_IoT *mac_inst, UE_
sched_temp_DL_NB_IoT_t *NPDSCH_info = (sched_temp_DL_NB_IoT_t*)malloc(sizeof(sched_temp_DL_NB_IoT_t));
sched_temp_UL_NB_IoT_t *HARQ_info = (sched_temp_UL_NB_IoT_t*)malloc(sizeof(sched_temp_UL_NB_IoT_t));
//DCI N1
//DCIFormatN1_t *DCI_N1 = (DCIFormatN1_t*)malloc(sizeof(DCIFormatN1_t));
//RLC Status
//mac_rlc_status_resp_NB_IoT_t rlc_status;
/*Index in DCI_N1*/
uint32_t I_mcs, I_tbs, I_delay, I_sf;
/*value for corresponding index*/
......@@ -73,16 +66,18 @@ int schedule_DL_NB_IoT(module_id_t module_id, eNB_MAC_INST_NB_IoT *mac_inst, UE_
int flag_retransmission=0;
int HARQ_delay=0;
uint32_t data_size;
uint32_t mac_sdu_size; //
uint32_t mac_sdu_size2; //
uint32_t size_indicated_from_rlc=0;
uint32_t data_size=0;
uint32_t rlc_control_pdu_size=0; //
uint32_t rlc_data_pdu_size=0; //
uint32_t padding_size=0; //
uint8_t sdu_temp[SCH_PAYLOAD_SIZE_MAX_NB_IoT]; //
uint8_t sdu_temp2[SCH_PAYLOAD_SIZE_MAX_NB_IoT]; //
logical_chan_id_t logical_channel; //
uint32_t subheader_length=3;
uint32_t subheader_length=2;
uint32_t payload_offset; //
......@@ -125,10 +120,10 @@ int schedule_DL_NB_IoT(module_id_t module_id, eNB_MAC_INST_NB_IoT *mac_inst, UE_
0,
DCCH0_NB_IoT,
TBS-subheader_length);
data_size = rlc_status.bytes_in_buffer;
LOG_N(MAC,"[NB-IoT] RLC indicate to MAC that the data size is : %d\n",data_size);
size_indicated_from_rlc = rlc_status.bytes_in_buffer;
LOG_D(MAC,"[NB-IoT] RLC indicate to MAC that the data size is : %d\n",size_indicated_from_rlc);
mac_sdu_size = mac_rlc_data_req(
rlc_control_pdu_size = mac_rlc_data_req(
module_id,
UE_info->rnti,
module_id,
......@@ -140,7 +135,7 @@ int schedule_DL_NB_IoT(module_id_t module_id, eNB_MAC_INST_NB_IoT *mac_inst, UE_
(char *)&sdu_temp[0]);
LOG_I(MAC,"[NB-IoT][DCCH] Got %d bytes from RLC\n",mac_sdu_size);
//LOG_I(MAC,"[NB-IoT][DCCH] Got %d bytes from RLC\n",rlc_control_pdu_size);
//Get RLC status
rlc_status2 = mac_rlc_status_ind(
......@@ -152,8 +147,8 @@ int schedule_DL_NB_IoT(module_id_t module_id, eNB_MAC_INST_NB_IoT *mac_inst, UE_
1,
0,
DCCH0_NB_IoT,
TBS-subheader_length-mac_sdu_size);
mac_sdu_size2 = mac_rlc_data_req(
TBS-subheader_length-rlc_control_pdu_size);
rlc_data_pdu_size = mac_rlc_data_req(
module_id,
UE_info->rnti,
module_id,
......@@ -164,23 +159,40 @@ int schedule_DL_NB_IoT(module_id_t module_id, eNB_MAC_INST_NB_IoT *mac_inst, UE_
TBS, //not used
(char *)&sdu_temp2[0]);
printf("print the second RLC DATA PDU payload, we have %d byte \n",mac_sdu_size2);
printf("print the second RLC DATA PDU payload, we have %d byte \n",rlc_data_pdu_size);
int y;
for (y=0;y<mac_sdu_size2;y++){
for (y=0;y<rlc_data_pdu_size;y++){
printf("%02x ",sdu_temp2[y]);
}
printf("\n");
data_size = rlc_data_pdu_size + rlc_control_pdu_size;
if(data_size == 0)
{
LOG_D(MAC,"[%04d][DLSchedulerUSS][Fail] No data in DCCH0_NB_IoT\n", mac_inst->current_subframe);
return -1;
}
if(data_size>127)
{
subheader_length=3;
}
if(TBS > data_size+subheader_length*2) // control and data
{
TBS = get_tbs(data_size, I_tbs, &I_sf);
LOG_I(MAC,"[%04d][DLSchedulerUSS] TBS change to %d because data size is smaller than previous TBS\n", mac_inst->current_subframe, TBS);
}
padding_size = TBS - subheader_length*2 - data_size;
//Generate header
payload_offset = generate_dlsch_header_NB_IoT(UE_info->DLSCH_pdu.payload, 1, &logical_channel, &mac_sdu_size2, 0, 0, TBS);
payload_offset = generate_dlsch_header_NB_IoT(UE_info->DLSCH_pdu.payload, 1, &logical_channel, &rlc_data_pdu_size, 0, 0, TBS, padding_size);
//Complete MAC PDU
memcpy(UE_info->DLSCH_pdu.payload+payload_offset, sdu_temp, mac_sdu_size);
memcpy(UE_info->DLSCH_pdu.payload+payload_offset+mac_sdu_size, sdu_temp2, mac_sdu_size2);
memcpy(UE_info->DLSCH_pdu.payload+payload_offset, sdu_temp, rlc_control_pdu_size);
memcpy(UE_info->DLSCH_pdu.payload+payload_offset+rlc_control_pdu_size, sdu_temp2, rlc_data_pdu_size);
printf("print the MAC DATA PDU including length payload, we have header %d byte \n",payload_offset);
//int y;
for (y=0;y<mac_sdu_size+payload_offset+mac_sdu_size2;y++){
for (y=0;y<TBS;y++){
//for (y=0;y<payload_offset+mac_sdu_size2;y++){
printf("%02x ",UE_info->DLSCH_pdu.payload[y]);
}
......@@ -200,29 +212,12 @@ int schedule_DL_NB_IoT(module_id_t module_id, eNB_MAC_INST_NB_IoT *mac_inst, UE_
}
#endif
//data_size=200; //for testing
//LOG_I(MAC,"[%04d][DLSchedulerUSS] UE data size %d\n", mac_inst->current_subframe, data_size);
//Have DCCH data
if(data_size == 0)
{
LOG_D(MAC,"[%04d][DLSchedulerUSS][Fail] No data in DCCH0_NB_IoT\n", mac_inst->current_subframe);
return -1;
}
if(data_size>127)
{
subheader_length=3;
}
if(TBS > data_size+subheader_length)
{
TBS = get_tbs(data_size, I_tbs, &I_sf);
LOG_I(MAC,"[%04d][DLSchedulerUSS] TBS change to %d because data size is smaller than previous TBS\n", mac_inst->current_subframe, TBS);
}
search_space_end_sf=cal_num_dlsf(mac_inst, hyperSF_start, frame_start, subframe_start, &h_temp, &f_temp, &sf_temp, UE_info->R_max);
LOG_D(MAC,"[%04d][DLSchedulerUSS] Search_space_start_sf %d Search_space_end_sf %d\n", convert_system_number_sf(hyperSF_start, frame_start, subframe_start), mac_inst->current_subframe, search_space_end_sf);
//LOG_D(MAC,"[%04d][DLSchedulerUSS][%d] Search_space_start_sf %d Search_space_end_sf %d\n", mac_inst->current_subframe, UE_info->rnti, mac_inst->current_subframe, convert_system_number_sf(hyperSF_start, frame_start, subframe_start), search_space_end_sf);
/*Loop all NPDCCH candidate position*/
for(cdd_num=0;cdd_num<UE_info->R_max/UE_sched_ctrl_info->R_dci;++cdd_num)
{
LOG_I(MAC,"[%04d][DLSchedulerUSS] Candidate num %d DCI Rep %d DCI Rmax: %d rep : %d\n",mac_inst->current_subframe, cdd_num, UE_sched_ctrl_info->R_dci,UE_info->R_max,UE_sched_ctrl_info->R_dl_data);
......@@ -255,11 +250,7 @@ int schedule_DL_NB_IoT(module_id_t module_id, eNB_MAC_INST_NB_IoT *mac_inst, UE_
if(search_space_end_sf<NPDCCH_info->sf_end+get_scheduling_delay(I_delay, UE_info->R_max)+5)
{
end_flagSCH = check_resource_NPDSCH_NB_IoT(mac_inst, NPDSCH_info, NPDCCH_info->sf_end, I_delay, UE_info->R_max, UE_sched_ctrl_info->R_dl_data, n_sf);
int x;
for (x=0;x<data_size;x++){
printf("%02x ",UE_info->DLSCH_pdu.payload[x]);
}
printf("\n");
//Have available resource
/*Check HARQ resource*/
if(end_flagSCH!=-1)
......@@ -277,7 +268,11 @@ int schedule_DL_NB_IoT(module_id_t module_id, eNB_MAC_INST_NB_IoT *mac_inst, UE_
//toggle NDI
if(flag_retransmission==0)
{
UE_info->oldNDI_DL=(UE_info->oldNDI_DL+1)%2;
if(TBS==26)
{
UE_info->oldNDI_DL=1;
}else
UE_info->oldNDI_DL=(UE_info->oldNDI_DL+1)%2;
//New transmission need to request data from RLC and generate new MAC PDU
UE_info->I_mcs_dl = I_mcs;
......@@ -461,15 +456,14 @@ int check_resource_DL_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst, uint32_t hyperSF_sta
return -1;
}
uint32_t generate_dlsch_header_NB_IoT(uint8_t *pdu, uint32_t num_sdu, logical_chan_id_t *logical_channel, uint32_t *sdu_length, uint8_t flag_drx, uint8_t flag_ta, uint32_t TBS)
uint32_t generate_dlsch_header_NB_IoT(uint8_t *pdu, uint32_t num_sdu, logical_chan_id_t *logical_channel, uint32_t *sdu_length, uint8_t flag_drx, uint8_t flag_ta, uint32_t TBS, uint32_t padding_size)
{
int i;
uint32_t total_sdu_size=0;
//uint32_t total_sdu_size=0;
//number of control element
uint32_t num_ce=0;
uint32_t num_subheader=0;
uint32_t num_sdu_L_15;
int32_t padding_size;
uint8_t flag_end_padding=0;
SCH_SUBHEADER_FIXED_NB_IoT *mac_header=(SCH_SUBHEADER_FIXED_NB_IoT*)pdu;
uint32_t offset=0;
......@@ -481,21 +475,21 @@ uint32_t generate_dlsch_header_NB_IoT(uint8_t *pdu, uint32_t num_sdu, logical_ch
{
num_sdu_L_15++;
}
total_sdu_size+=sdu_length[i];
//total_sdu_size+=sdu_length[i];
}
if(flag_drx==1)
num_ce++;
if(flag_ta==1)
num_ce++;
num_subheader=num_ce+num_sdu;
padding_size = TBS-total_sdu_size-num_ce;
num_subheader=num_ce+num_sdu+1;
//padding_size = TBS-total_sdu_size-num_ce;
if(padding_size<0)
{
LOG_D(MAC,"[ERROR]TBS less than require subheader and control element\n");
return -1;
}
LOG_D(MAC,"total SDU size %d\n", total_sdu_size);
LOG_D(MAC,"padding size %d\n", padding_size);
//LOG_D(MAC,"total SDU size %d\n", total_sdu_size);
LOG_I(MAC,"padding size %d\n", padding_size);
if(padding_size>2)
{
flag_end_padding=1;
......
......@@ -210,7 +210,7 @@ uint32_t convert_system_number_sf(uint32_t hyperSF, uint32_t frame, uint32_t sub
/*input start position amd num_dlsf DL subframe, caculate the last subframe number*/
uint32_t cal_num_dlsf(eNB_MAC_INST_NB_IoT *mac_inst, uint32_t hyperSF, uint32_t frame, uint32_t subframe, uint32_t* hyperSF_result, uint32_t* frame_result, uint32_t* subframe_result, uint32_t num_dlsf_require);
void init_dlsf_info(eNB_MAC_INST_NB_IoT *mac_inst, DLSF_INFO_t *DLSF_info);
uint32_t generate_dlsch_header_NB_IoT(uint8_t *pdu, uint32_t num_sdu, logical_chan_id_t *logical_channel, uint32_t *sdu_length, uint8_t flag_drx, uint8_t flag_ta, uint32_t TBS);
uint32_t generate_dlsch_header_NB_IoT(uint8_t *pdu, uint32_t num_sdu, logical_chan_id_t *logical_channel, uint32_t *sdu_length, uint8_t flag_drx, uint8_t flag_ta, uint32_t TBS, uint32_t padding_size);
void maintain_resource_DL(eNB_MAC_INST_NB_IoT *mac_inst, sched_temp_DL_NB_IoT_t *NPDCCH_info, sched_temp_DL_NB_IoT_t *NPDSCH_info);
void init_tool_sib1(eNB_MAC_INST_NB_IoT *mac_inst);
//int is_dlsf(eNB_MAC_INST_NB_IoT *mac_inst, int abs_subframe);
......
......@@ -421,8 +421,8 @@ rlc_am_get_pdus (
case RLC_DATA_TRANSFER_READY_STATE:
printf("rlc_pP->nb_bytes_requested_by_mac=%d\n",rlc_pP->nb_bytes_requested_by_mac);
printf("rlc_pP->status_requested=%u\n",rlc_pP->status_requested);
//printf("rlc_pP->nb_bytes_requested_by_mac=%d\n",rlc_pP->nb_bytes_requested_by_mac);
//printf("rlc_pP->status_requested=%u\n",rlc_pP->status_requested);
/*
if ((rlc_pP->nb_bytes_requested_by_mac > 2) && (rlc_pP->sdu_buffer_occupancy) && (rlc_pP->vt_s != rlc_pP->vt_ms)) {
......@@ -710,7 +710,7 @@ rlc_am_mac_data_request (
#endif
list_init (&data_req.data, NULL);
printf("l_rlc_p->nb_bytes_requested_by_mac=%d (in rlc_am.c)\n",l_rlc_p->nb_bytes_requested_by_mac);
//printf("l_rlc_p->nb_bytes_requested_by_mac=%d (in rlc_am.c)\n",l_rlc_p->nb_bytes_requested_by_mac);
rlc_am_get_pdus (ctxt_pP, l_rlc_p);
list_add_list (&l_rlc_p->pdus_to_mac_layer, &data_req.data);
//printf("*******nb_elements_3=%d (in rlc_am.c)***************\n",data_req.data.nb_elements);
......@@ -921,7 +921,7 @@ rlc_am_mac_data_request (
}
#endif
printf("=========data_req.data=%d=======\n",data_req.data);
//printf("=========data_req.data=%d=======\n",data_req.data);
return data_req;
}
//-----------------------------------------------------------------------------
......
......@@ -1115,7 +1115,7 @@ uint8_t do_RRCConnectionSetup_NB_IoT(
//*periodicBSR_Timer = 2; // PeriodicBSR_Timer_NB_r13_pp8
//logicalChannelSR_Config = CALLOC(1,sizeof(*logicalChannelSR_Config));
mac_main_config_NB_IoT->choice.explicitValue_r13.logicalChannelSR_Config_r13->choice.setup.logicalChannelSR_ProhibitTimer_r13 = 5;//MAC_MainConfig_NB_r13__logicalChannelSR_Config_r13__setup__logicalChannelSR_ProhibitTimer_r13_pp8
mac_main_config_NB_IoT->choice.explicitValue_r13.logicalChannelSR_Config_r13->choice.setup.logicalChannelSR_ProhibitTimer_r13 = 4;//MAC_MainConfig_NB_r13__logicalChannelSR_Config_r13__setup__logicalChannelSR_ProhibitTimer_r13_pp8
mac_main_config_NB_IoT->choice.explicitValue_r13.logicalChannelSR_Config_r13->present = MAC_MainConfig_NB_r13__logicalChannelSR_Config_r13_PR_setup;
//ul_SCH_Config = CALLOC(1,sizeof(*ul_SCH_Config));
......
......@@ -5037,8 +5037,7 @@ int rrc_eNB_decode_dcch_NB_IoT(
)
//-----------------------------------------------------------------------------
{
asn_dec_rval_t dec_rval;
UL_DCCH_Message_NB_t *ul_dcch_msg_NB_IoT = NULL;
UE_Capability_NB_r13_t *UE_Capability_NB = NULL;
......@@ -5105,7 +5104,7 @@ int rrc_eNB_decode_dcch_NB_IoT(
case UL_DCCH_MessageType_NB__c1_PR_rrcConnectionSetupComplete_r13:
//MP: Ts 36.331 V14.2.1 RRCConnectionSetupComplete is transmitted over SRB1bis (pag 585)
#ifdef RRC_MSG_PRINT
LOG_F(RRC,"[MSG] RRCConnectionSetupComplete-NB\n");
......@@ -5154,6 +5153,255 @@ int rrc_eNB_decode_dcch_NB_IoT(
break;
case UL_DCCH_MessageType_NB__c1_PR_ulInformationTransfer_r13:
T(T_ENB_RRC_UL_INFORMATION_TRANSFER, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame),
T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti));
#ifdef RRC_MSG_PRINT
LOG_F(RRC,"[MSG] RRC UL Information Transfer \n");
for (i = 0; i < sdu_sizeP; i++) {
LOG_F(RRC,"%02x ", ((uint8_t*)Rx_sdu)[i]);
}
LOG_F(RRC,"\n");
#endif
MSC_LOG_RX_MESSAGE(
MSC_RRC_ENB,
MSC_RRC_UE,
Rx_sdu,
sdu_sizeP,
MSC_AS_TIME_FMT" ulInformationTransfer UE %x size %u",
MSC_AS_TIME_ARGS(ctxt_pP),
ue_context_p->ue_context.rnti,
sdu_sizeP);
#if defined(ENABLE_USE_MME)
if (EPC_MODE_ENABLED == 1) {
rrc_eNB_send_S1AP_UPLINK_NAS(ctxt_pP,
ue_context_p,
ul_dcch_msg_NB_IoT);
}
#endif
break;
case UL_DCCH_MessageType_NB__c1_PR_rrcConnectionReconfigurationComplete_r13:
#ifdef RRC_MSG_PRINT
LOG_F(RRC,"[MSG] RRC Connection Reconfiguration Complete\n");
for (i = 0; i < sdu_sizeP; i++) {
LOG_F(RRC,"%02x ", ((uint8_t*)Rx_sdu)[i]);
}
LOG_F(RRC,"\n");
#endif
MSC_LOG_RX_MESSAGE(
MSC_RRC_ENB,
MSC_RRC_UE,
Rx_sdu,
sdu_sizeP,
MSC_AS_TIME_FMT" RRCConnectionReconfigurationComplete UE %x size %u",
MSC_AS_TIME_ARGS(ctxt_pP),
ue_context_p->ue_context.rnti,
sdu_sizeP);
LOG_D(RRC,
PROTOCOL_RRC_CTXT_UE_FMT" RLC RB %02d --- RLC_DATA_IND %d bytes "
"(RRCConnectionReconfigurationComplete) ---> RRC_eNB]\n",
PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
DCCH0_NB_IoT,
sdu_sizeP);
if (ul_dcch_msg_NB_IoT->message.choice.c1.choice.rrcConnectionReconfigurationComplete_r13.criticalExtensions.
present ==
RRCConnectionReconfigurationComplete_NB__criticalExtensions_PR_rrcConnectionReconfigurationComplete_r13) {
/*NN: revise the condition */
if (ue_context_p->ue_context.Status == RRC_RECONFIGURED_NB_IoT){
dedicated_DRB = 1;
LOG_I(RRC,
PROTOCOL_RRC_CTXT_UE_FMT" UE State = RRC_RECONFIGURED (dedicated DRB, xid %ld)\n",
PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),ul_dcch_msg_NB_IoT->message.choice.c1.choice.rrcConnectionReconfigurationComplete_r13.rrc_TransactionIdentifier);
}else {
dedicated_DRB = 0;
ue_context_p->ue_context.Status = RRC_RECONFIGURED_NB_IoT;
LOG_I(RRC,
PROTOCOL_RRC_CTXT_UE_FMT" UE State = RRC_RECONFIGURED (default DRB, xid %ld)\n",
PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),ul_dcch_msg_NB_IoT->message.choice.c1.choice.rrcConnectionReconfigurationComplete_r13.rrc_TransactionIdentifier);
}
rrc_eNB_process_RRCConnectionReconfigurationComplete(
ctxt_pP,
ue_context_p,
ul_dcch_msg_NB_IoT->message.choice.c1.choice.rrcConnectionReconfigurationComplete_r13.rrc_TransactionIdentifier);
#if defined(FLEXRAN_AGENT_SB_IF)
//WARNING:Inform the controller about the UE activation. Should be moved to RRC agent in the future
if (mac_agent_registered[ctxt_pP->module_id]) {
agent_mac_xface[ctxt_pP->eNB_index]->flexran_agent_notify_ue_state_change(ctxt_pP->module_id,
ue_context_p->ue_id_rnti,
PROTOCOL__FLEX_UE_STATE_CHANGE_TYPE__FLUESC_UPDATED);
}
#endif
}
#if defined(ENABLE_ITTI)
# if defined(ENABLE_USE_MME)
if (EPC_MODE_ENABLED == 1) {
if (dedicated_DRB == 1){
rrc_eNB_send_S1AP_E_RAB_SETUP_RESP(ctxt_pP,
ue_context_p,
ul_dcch_msg_NB_IoT->message.choice.c1.choice.rrcConnectionReconfigurationComplete_r13.rrc_TransactionIdentifier);
}else {
rrc_eNB_send_S1AP_INITIAL_CONTEXT_SETUP_RESP(ctxt_pP,
ue_context_p);
}
}
#else // establish a dedicated bearer
if (dedicated_DRB == 0 ) {
// ue_context_p->ue_context.e_rab[0].status = E_RAB_STATUS_ESTABLISHED;
rrc_eNB_reconfigure_DRBs(ctxt_pP,ue_context_p);
}
#endif
#endif
break;
case UL_DCCH_MessageType_NB__c1_PR_securityModeComplete_r13:
T(T_ENB_RRC_SECURITY_MODE_COMPLETE, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame),
T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti));
//NOT SURE becasue the pussch_vars
#ifdef RRC_MSG_PRINT
LOG_F(RRC,"[MSG] NB-IoT RRC Security Mode Complete\n");
for (i = 0; i < sdu_sizeP; i++) eNB->pusch_vars[UE_id]{
LOG_F(RRC,"%02x ", ((uint8_t*)Rx_sdu)[i]);
}
LOG_F(RRC,"\n");
#endif
MSC_LOG_RX_MESSAGE(
MSC_RRC_ENB,
MSC_RRC_UE,
Rx_sdu,
sdu_sizeP,
MSC_AS_TIME_FMT" securityModeComplete-NB UE %x size %u",
MSC_AS_TIME_ARGS(ctxt_pP),
ue_context_p->ue_context.rnti,
sdu_sizeP);
LOG_I(RRC,
PROTOCOL_RRC_CTXT_UE_FMT" received securityModeComplete on UL-DCCH-NB %d from UE\n",
PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
DCCH0_NB_IoT);
LOG_D(RRC,
PROTOCOL_RRC_CTXT_UE_FMT" RLC RB %02d --- RLC_DATA_IND %d bytes "
"(securityModeComplete-NB) ---> RRC_eNB\n",
PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
DCCH0_NB_IoT,
sdu_sizeP);
#ifdef XER_PRINT
xer_fprint(stdout, &asn_DEF_UL_DCCH_Message_NB, (void *)ul_dcch_msg_NB_IoT);
#endif
// confirm with PDCP about the security mode for DCCH
//rrc_pdcp_config_req (enb_mod_idP, frameP, 1,CONFIG_ACTION_SET_SECURITY_MODE, (ue_mod_idP * NB_RB_MAX) + DCCH, 0x77);
// continue the procedure
rrc_eNB_generate_UECapabilityEnquiry(
ctxt_pP,
ue_context_p);
break;
case UL_DCCH_MessageType_NB__c1_PR_ueCapabilityInformation_r13:
T(T_ENB_RRC_UE_CAPABILITY_INFORMATION, T_INT(ctxt_pP->module_id), T_INT(ctxt_pP->frame),
T_INT(ctxt_pP->subframe), T_INT(ctxt_pP->rnti));
#ifdef RRC_MSG_PRINT
LOG_F(RRC,"[MSG] RRC UECapablility Information \n");
for (i = 0; i < sdu_sizeP; i++) {
LOG_F(RRC,"%02x ", ((uint8_t*)Rx_sdu)[i]);
}
LOG_F(RRC,"\n");
#endif
MSC_LOG_RX_MESSAGE(
MSC_RRC_ENB,
MSC_RRC_UE,
Rx_sdu,
sdu_sizeP,
MSC_AS_TIME_FMT" ueCapabilityInformation UE %x size %u",
MSC_AS_TIME_ARGS(ctxt_pP),
ue_context_p->ue_context.rnti,
sdu_sizeP);
LOG_I(RRC,
PROTOCOL_RRC_CTXT_UE_FMT" received ueCapabilityInformation on UL-DCCH %d from UE\n",
PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
DCCH);
LOG_D(RRC,
PROTOCOL_RRC_CTXT_UE_FMT" RLC RB %02d --- RLC_DATA_IND %d bytes "
"(UECapabilityInformation) ---> RRC_eNB\n",
PROTOCOL_RRC_CTXT_UE_ARGS(ctxt_pP),
DCCH,
sdu_sizeP);
#ifdef XER_PRINT
xer_fprint(stdout, &asn_DEF_UL_DCCH_Message_NB, (void *)ul_dcch_msg_NB_IoT);
#endif
LOG_I(RRC, "got UE capabilities for UE %x\n", ctxt_pP->rnti);
//dec_rval = uper_decode(NULL,
// &asn_DEF_UE_EUTRA_Capability,
// (void **)&UE_Capability_NB,
// ul_dcch_msg_NB_IoT->message.choice.c1.choice.ueCapabilityInformation_r13.criticalExtensions.
// choice.ueCapabilityInformation_r13.ue_Capability_Container_r13.rf_Parameters_r13.
// supportedBandList_r13.list.array[0]->SupportedBand_NB_r13.buf,
// ul_dcch_msg_NB_IoT->message.choice.c1.choice.ueCapabilityInformation_r13.criticalExtensions.
// choice.ueCapabilityInformation_r13.ue_Capability_Container_r13.rf_Parameters_r13.
// supportedBandList_r13.list.array[0]->SupportedBand_NB_r13.size, 0, 0);
//FIXME
dec_rval = uper_decode(
NULL,
&asn_DEF_UL_DCCH_Message_NB,
(void**)&ul_dcch_msg_NB_IoT,
Rx_sdu,
sdu_sizeP,
0,
0);
//#ifdef XER_PRINT
//xer_fprint(stdout, &asn_DEF_UE_EUTRA_Capability, (void *)UE_EUTRA_Capability);
//#endif
#if defined(ENABLE_USE_MME)
if (EPC_MODE_ENABLED == 1) {
rrc_eNB_send_S1AP_UE_CAPABILITIES_IND(ctxt_pP,
ue_context_p,
ul_dcch_msg_NB_IoT);
}
#else
ue_context_p->ue_context.nb_of_e_rabs = 1;
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.e_rab_id = 1+i;
ue_context_p->ue_context.e_rab[i].param.qos.qci=9;
}
ue_context_p->ue_context.setup_e_rabs =ue_context_p->ue_context.nb_of_e_rabs;
#endif
rrc_eNB_generate_defaultRRCConnectionReconfiguration(ctxt_pP,
ue_context_p,
eNB_rrc_inst[ctxt_pP->module_id].HO_flag);
break;
default:
......
......@@ -33,7 +33,9 @@
# include "extern.h"
# include "RRC/L2_INTERFACE/openair_rrc_L2_interface.h"
# include "RRC/LITE/MESSAGES/asn1_msg.h"
# include "RRC/LITE/MESSAGES/asn1_msg_NB_IoT.h"
# include "RRC/LITE/defs.h"
# include "RRC/LITE/defs_NB_IoT.h"
# include "rrc_eNB_UE_context.h"
# include "rrc_eNB_S1AP.h"
# include "enb_config.h"
......@@ -507,29 +509,23 @@ void
rrc_eNB_send_S1AP_UPLINK_NAS(
const protocol_ctxt_t* const ctxt_pP,
rrc_eNB_ue_context_t* const ue_context_pP,
UL_DCCH_Message_t* const ul_dcch_msg
UL_DCCH_Message_NB_t* const ul_dcch_msg //UL_DCCH_Message_t
)
//------------------------------------------------------------------------------
{
#if defined(ENABLE_ITTI)
{
ULInformationTransfer_t *ulInformationTransfer = &ul_dcch_msg->message.choice.c1.choice.ulInformationTransfer;
if ((ulInformationTransfer->criticalExtensions.present == ULInformationTransfer__criticalExtensions_PR_c1)
&& (ulInformationTransfer->criticalExtensions.choice.c1.present
== ULInformationTransfer__criticalExtensions__c1_PR_ulInformationTransfer_r8)
&& (ulInformationTransfer->criticalExtensions.choice.c1.choice.ulInformationTransfer_r8.dedicatedInfoType.present
== ULInformationTransfer_r8_IEs__dedicatedInfoType_PR_dedicatedInfoNAS)) {
/* This message hold a dedicated info NAS payload, forward it to NAS */
struct ULInformationTransfer_r8_IEs__dedicatedInfoType *dedicatedInfoType =
&ulInformationTransfer->criticalExtensions.choice.c1.choice.ulInformationTransfer_r8.dedicatedInfoType;
ULInformationTransfer_NB_t *ulInformationTransfer = &ul_dcch_msg->message.choice.c1.choice.ulInformationTransfer_r13;
if (ulInformationTransfer->criticalExtensions.present == ULInformationTransfer_NB__criticalExtensions_PR_ulInformationTransfer_r13) {
struct ULInformationTransfer_NB_r13_IEs *ULInformationTransfer_NB_r13_IEs_t =
&ulInformationTransfer->criticalExtensions.choice.ulInformationTransfer_r13;
uint32_t pdu_length;
uint8_t *pdu_buffer;
MessageDef *msg_p;
pdu_length = dedicatedInfoType->choice.dedicatedInfoNAS.size;
pdu_buffer = dedicatedInfoType->choice.dedicatedInfoNAS.buf;
pdu_length = ULInformationTransfer_NB_r13_IEs_t->dedicatedInfoNAS_r13.size;
pdu_buffer = ULInformationTransfer_NB_r13_IEs_t->dedicatedInfoNAS_r13.buf;
msg_p = itti_alloc_new_message (TASK_RRC_ENB, S1AP_UPLINK_NAS);
S1AP_UPLINK_NAS (msg_p).eNB_ue_s1ap_id = ue_context_pP->ue_context.eNB_ue_s1ap_id;
S1AP_UPLINK_NAS (msg_p).nas_pdu.length = pdu_length;
......@@ -540,33 +536,22 @@ rrc_eNB_send_S1AP_UPLINK_NAS(
}
#else
{
ULInformationTransfer_t *ulInformationTransfer;
ULInformationTransfer_NB_t *ulInformationTransfer;
ulInformationTransfer =
&ul_dcch_msg->message.choice.c1.choice.
ulInformationTransfer;
if (ulInformationTransfer->criticalExtensions.present ==
ULInformationTransfer__criticalExtensions_PR_c1) {
if (ulInformationTransfer->criticalExtensions.choice.c1.present ==
ULInformationTransfer__criticalExtensions__c1_PR_ulInformationTransfer_r8) {
ULInformationTransfer_r8_IEs_t
*ulInformationTransferR8;
ulInformationTransferR8 =
ULInformationTransfer_NB__criticalExtensions_PR_ulInformationTransfer_r13) {
ULInformationTransfer_NB_r13_IEs_t
*ulInformationTransferR13;
ulInformationTransferR13 =
&ulInformationTransfer->criticalExtensions.choice.
c1.choice.ulInformationTransfer_r8;
ulInformationTransfer_r13;
if (ulInformationTransferR8->dedicatedInfoType.
present ==
ULInformationTransfer_r8_IEs__dedicatedInfoType_PR_dedicatedInfoNAS)
s1ap_eNB_new_data_request (mod_id, ue_index,
ulInformationTransferR8->
dedicatedInfoType.choice.
dedicatedInfoNAS.buf,
ulInformationTransferR8->
dedicatedInfoType.choice.
dedicatedInfoNAS.size);
}
ulInformationTransferR13.buf,
ulInformationTransferR13.size);
}
}
#endif
......
......@@ -35,6 +35,9 @@
#include "defs.h"
#include "UL-DCCH-Message.h"
// NB-IoT Section
#include "UL-DCCH-Message-NB.h"
/* Up link procedures */
......@@ -102,7 +105,7 @@ void
rrc_eNB_send_S1AP_UPLINK_NAS(
const protocol_ctxt_t* const ctxt_pP,
rrc_eNB_ue_context_t* const ue_context_pP,
UL_DCCH_Message_t* const ul_dcch_msg
UL_DCCH_Message_NB_t* const ul_dcch_msg
);
/*! \fn void rrc_eNB_send_S1AP_UE_CAPABILITIES_IND(const protocol_ctxt_t * const ctxt_pP, eNB_RRC_UE_t * const ue_context_pP, UL_DCCH_Message_t *ul_dcch_msg)
......
......@@ -234,7 +234,7 @@ list_add_list (list_t * sublistP, list_t * listP)
sublistP->head = NULL;
sublistP->tail = NULL;
listP->nb_elements = listP->nb_elements + sublistP->nb_elements;
printf("=============listp->nb_elements=%d (in list.c)=============\n",listP->nb_elements);
//printf("=============listp->nb_elements=%d (in list.c)=============\n",listP->nb_elements);
sublistP->nb_elements = 0;
}
}
......
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