Commit 1f6c08c9 authored by Nick Ho's avatar Nick Ho

Receive Authentication response

parent db61edd7
...@@ -1794,13 +1794,13 @@ void decode_NPUSCH_msg_NB_IoT(PHY_VARS_eNB *eNB, ...@@ -1794,13 +1794,13 @@ void decode_NPUSCH_msg_NB_IoT(PHY_VARS_eNB *eNB,
{ {
//fill_crc_indication_NB_IoT(eNB,0,rx_frame,rx_subframe,1); // indicate ACK to MAC //fill_crc_indication_NB_IoT(eNB,0,rx_frame,rx_subframe,1); // indicate ACK to MAC
fill_rx_indication_NB_IoT(eNB,proc,npusch_format,1); fill_rx_indication_NB_IoT(eNB,proc,npusch_format,1);
LOG_I(PHY," decoded ACK of DL Data (include MSG4) \n"); LOG_D(PHY," decoded ACK of DL Data (include MSG4) \n");
} else if (counter_ack<8) { //hard decision } else if (counter_ack<8) { //hard decision
//fill_crc_indication_NB_IoT(eNB,0,rx_frame,rx_subframe,0); // indicate NAK to MAC //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); fill_rx_indication_NB_IoT(eNB,proc,npusch_format,0);
LOG_I(PHY," decoded ACK of DL Data (include MSG4) \n"); LOG_D(PHY," decoded ACK of DL Data (include MSG4) \n");
} else { //when equality (8 bits 0 vs 8 bits 1), soft decision } else { //when equality (8 bits 0 vs 8 bits 1), soft decision
......
...@@ -444,7 +444,7 @@ void schedule_response_NB_IoT(Sched_Rsp_NB_IoT_t *Sched_INFO) ...@@ -444,7 +444,7 @@ void schedule_response_NB_IoT(Sched_Rsp_NB_IoT_t *Sched_INFO)
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
//maybe this condition should be replaced by another test ?! //maybe this condition should be replaced by another test ?!
if((nfapi_parameters_rel13->size < 80)&&(nfapi_parameters_rel13->size != 41)) // msg3 data if((nfapi_parameters_rel13->size == 11)) // msg3 data
{ {
LOG_I(PHY,"MSG3 process at PHY\n"); LOG_I(PHY,"MSG3 process at PHY\n");
nulsch = eNB->ulsch_NB_IoT[0]; nulsch = eNB->ulsch_NB_IoT[0];
......
...@@ -168,6 +168,7 @@ typedef struct { ...@@ -168,6 +168,7 @@ typedef struct {
uint32_t R_dci; uint32_t R_dci;
// MAX repetition // MAX repetition
uint32_t R_max; uint32_t R_max;
uint32_t special_mcs;
// HARQ round // HARQ round
uint32_t HARQ_round; uint32_t HARQ_round;
......
...@@ -253,6 +253,7 @@ void schedule_uss_NB_IoT(module_id_t module_id, eNB_MAC_INST_NB_IoT *mac_inst, u ...@@ -253,6 +253,7 @@ void schedule_uss_NB_IoT(module_id_t module_id, eNB_MAC_INST_NB_IoT *mac_inst, u
DCIFormatN1_t *DCI_N1; DCIFormatN1_t *DCI_N1;
DCIFormatN0_t *DCI_N0; DCIFormatN0_t *DCI_N0;
DCIFormatN0_t *DCI_N0_1; DCIFormatN0_t *DCI_N0_1;
DCIFormatN0_t *DCI_N0_2;
//SCHEDULE_NB_IoT_t *scheduler = &eNB->scheduler; //SCHEDULE_NB_IoT_t *scheduler = &eNB->scheduler;
mac_inst->scheduling_flag.flag_uss[0]=1; mac_inst->scheduling_flag.flag_uss[0]=1;
...@@ -305,6 +306,7 @@ void schedule_uss_NB_IoT(module_id_t module_id, eNB_MAC_INST_NB_IoT *mac_inst, u ...@@ -305,6 +306,7 @@ void schedule_uss_NB_IoT(module_id_t module_id, eNB_MAC_INST_NB_IoT *mac_inst, u
//generate DCI-N0 content //generate DCI-N0 content
fill_DCI_N0(DCI_N0, UE_template_temp, UE_sched_ctrl_info); fill_DCI_N0(DCI_N0, UE_template_temp, UE_sched_ctrl_info);
generate_scheduling_result_UL(UE_sched_ctrl_info->NPDCCH_sf_start, UE_sched_ctrl_info->NPDCCH_sf_end,UE_sched_ctrl_info->NPUSCH_sf_start+3, UE_sched_ctrl_info->NPUSCH_sf_end+3,DCI_N0, UE_template_temp->rnti, str22, str23, 0); generate_scheduling_result_UL(UE_sched_ctrl_info->NPDCCH_sf_start, UE_sched_ctrl_info->NPDCCH_sf_end,UE_sched_ctrl_info->NPUSCH_sf_start+3, UE_sched_ctrl_info->NPUSCH_sf_end+3,DCI_N0, UE_template_temp->rnti, str22, str23, 0);
/*
if (UE_sched_ctrl_info->resent_flag==1) if (UE_sched_ctrl_info->resent_flag==1)
{ {
DCI_N0_1 = (DCIFormatN0_t*)malloc(sizeof(DCIFormatN0_t)); DCI_N0_1 = (DCIFormatN0_t*)malloc(sizeof(DCIFormatN0_t));
...@@ -312,7 +314,15 @@ void schedule_uss_NB_IoT(module_id_t module_id, eNB_MAC_INST_NB_IoT *mac_inst, u ...@@ -312,7 +314,15 @@ void schedule_uss_NB_IoT(module_id_t module_id, eNB_MAC_INST_NB_IoT *mac_inst, u
fill_DCI_N0(DCI_N0_1, UE_template_temp, UE_sched_ctrl_info); fill_DCI_N0(DCI_N0_1, UE_template_temp, UE_sched_ctrl_info);
generate_scheduling_result_UL(UE_sched_ctrl_info->NPDCCH_sf_start+800, UE_sched_ctrl_info->NPDCCH_sf_end+800,UE_sched_ctrl_info->NPUSCH_sf_start+803, UE_sched_ctrl_info->NPUSCH_sf_end+803,DCI_N0_1, UE_template_temp->rnti, str22, str23, 0); generate_scheduling_result_UL(UE_sched_ctrl_info->NPDCCH_sf_start+800, UE_sched_ctrl_info->NPDCCH_sf_end+800,UE_sched_ctrl_info->NPUSCH_sf_start+803, UE_sched_ctrl_info->NPUSCH_sf_end+803,DCI_N0_1, UE_template_temp->rnti, str22, str23, 0);
}
DCI_N0_2 = (DCIFormatN0_t*)malloc(sizeof(DCIFormatN0_t));
UE_sched_ctrl_info->dci_n0_index_ndi = 0;
fill_DCI_N0(DCI_N0_2, UE_template_temp, UE_sched_ctrl_info);
generate_scheduling_result_UL(UE_sched_ctrl_info->NPDCCH_sf_start+1000, UE_sched_ctrl_info->NPDCCH_sf_end+1000,UE_sched_ctrl_info->NPUSCH_sf_start+1003, UE_sched_ctrl_info->NPUSCH_sf_end+1003,DCI_N0_2, UE_template_temp->rnti, str22, str23, 0);
}
*/
//sotre UE_template //sotre UE_template
UE_template_temp->R_dci=UE_sched_ctrl_info->R_dci; UE_template_temp->R_dci=UE_sched_ctrl_info->R_dci;
UE_template_temp->R_ul=UE_sched_ctrl_info->R_ul_data; UE_template_temp->R_ul=UE_sched_ctrl_info->R_ul_data;
......
...@@ -302,7 +302,7 @@ void schedule_rar_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst, int abs_subframe){ ...@@ -302,7 +302,7 @@ void schedule_rar_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst, int abs_subframe){
migrate_node = msg2_nodes; migrate_node = msg2_nodes;
//migrate_node->ue_rnti = tc_rnti; //migrate_node->ue_rnti = tc_rnti;
tc_rnti++; //tc_rnti++;
msg2_nodes = msg2_nodes->next; msg2_nodes = msg2_nodes->next;
// maintain list // maintain list
......
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
unsigned char str20[] = "DCI_uss"; unsigned char str20[] = "DCI_uss";
unsigned char str21[] = "DATA_uss"; unsigned char str21[] = "DATA_uss";
int second_flag = 0;
// scheduling UL // scheduling UL
int schedule_UL_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst,UE_TEMPLATE_NB_IoT *UE_info,uint32_t subframe, uint32_t frame, uint32_t H_SFN, UE_SCHED_CTRL_NB_IoT_t *UE_sched_ctrl_info){ int schedule_UL_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst,UE_TEMPLATE_NB_IoT *UE_info,uint32_t subframe, uint32_t frame, uint32_t H_SFN, UE_SCHED_CTRL_NB_IoT_t *UE_sched_ctrl_info){
...@@ -127,7 +128,7 @@ int schedule_UL_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst,UE_TEMPLATE_NB_IoT *UE_info ...@@ -127,7 +128,7 @@ int schedule_UL_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst,UE_TEMPLATE_NB_IoT *UE_info
{ {
//LOG_D(MAC,"[%04d][UL scheduler][UE:%05d] DCI content = scind : %d ResAssign : %d mcs : %d ndi : %d scheddly : %d RepNum : %d rv : %d DCIRep : %d\n", mac_inst->current_subframe,UE_info->rnti,DCI_N0->scind,DCI_N0->ResAssign,DCI_N0->mcs,DCI_N0->ndi,DCI_N0->Scheddly,DCI_N0->RepNum,DCI_N0->rv,DCI_N0->DCIRep); //LOG_D(MAC,"[%04d][UL scheduler][UE:%05d] DCI content = scind : %d ResAssign : %d mcs : %d ndi : %d scheddly : %d RepNum : %d rv : %d DCIRep : %d\n", mac_inst->current_subframe,UE_info->rnti,DCI_N0->scind,DCI_N0->ResAssign,DCI_N0->mcs,DCI_N0->ndi,DCI_N0->Scheddly,DCI_N0->RepNum,DCI_N0->rv,DCI_N0->DCIRep);
LOG_D(MAC,"[%04d][ULSchedulerUSS][%d][Success] complete scheduling with data size %d\n", mac_inst->current_subframe, UE_info->rnti, UE_info->ul_total_buffer); LOG_I(MAC,"[%04d][ULSchedulerUSS][%d][Success] complete scheduling with data size %d\n", mac_inst->current_subframe, UE_info->rnti, UE_info->ul_total_buffer);
LOG_I(MAC,"[%04d][ULSchedulerUSS][%d] Multi-tone:%d,MCS:%d,TBS:%d,UL_buffer:%d,DL_start:%d,DL_end:%d,N_rep:%d,N_ru:%d,Total_ru:%d\n", mac_inst->current_subframe,UE_info->rnti,UE_info->multi_tone,mcs,TBS,UE_info->ul_total_buffer,NPDCCH_info->sf_start,DL_end,N_rep,Nru,total_ru); LOG_I(MAC,"[%04d][ULSchedulerUSS][%d] Multi-tone:%d,MCS:%d,TBS:%d,UL_buffer:%d,DL_start:%d,DL_end:%d,N_rep:%d,N_ru:%d,Total_ru:%d\n", mac_inst->current_subframe,UE_info->rnti,UE_info->multi_tone,mcs,TBS,UE_info->ul_total_buffer,NPDCCH_info->sf_start,DL_end,N_rep,Nru,total_ru);
//LOG_D(MAC,"[%04d][ULSchedulerUSS][%d][Success] DCI content = scind : %d ResAssign : %d mcs : %d ndi : %d scheddly : %d RepNum : %d rv : %d DCIRep : %d\n", mac_inst->current_subframe, UE_info->rnti, DCI_N0->scind,DCI_N0->ResAssign,DCI_N0->mcs,DCI_N0->ndi,DCI_N0->Scheddly,DCI_N0->RepNum,DCI_N0->rv,DCI_N0->DCIRep); //LOG_D(MAC,"[%04d][ULSchedulerUSS][%d][Success] DCI content = scind : %d ResAssign : %d mcs : %d ndi : %d scheddly : %d RepNum : %d rv : %d DCIRep : %d\n", mac_inst->current_subframe, UE_info->rnti, DCI_N0->scind,DCI_N0->ResAssign,DCI_N0->mcs,DCI_N0->ndi,DCI_N0->Scheddly,DCI_N0->RepNum,DCI_N0->rv,DCI_N0->DCIRep);
...@@ -145,15 +146,15 @@ int schedule_UL_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst,UE_TEMPLATE_NB_IoT *UE_info ...@@ -145,15 +146,15 @@ int schedule_UL_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst,UE_TEMPLATE_NB_IoT *UE_info
return 0; return 0;
*/ */
//Fill result to Output structure //Fill result to Output structure
if(UE_info->ul_total_buffer==39) if(UE_info->ul_total_buffer==14)
{ {
UE_sched_ctrl_info->NPDCCH_sf_end=NPDCCH_info->sf_end+200; UE_sched_ctrl_info->NPDCCH_sf_end=NPDCCH_info->sf_end;
UE_sched_ctrl_info->NPDCCH_sf_start=NPDCCH_info->sf_start+200; UE_sched_ctrl_info->NPDCCH_sf_start=NPDCCH_info->sf_start;
UE_sched_ctrl_info->NPUSCH_sf_end=NPUSCH_info->sf_end+200; UE_sched_ctrl_info->NPUSCH_sf_end=NPUSCH_info->sf_end;
UE_sched_ctrl_info->NPUSCH_sf_start=NPUSCH_info->sf_start+200; UE_sched_ctrl_info->NPUSCH_sf_start=NPUSCH_info->sf_start;
UE_sched_ctrl_info->resent_flag = 1; //UE_sched_ctrl_info->resent_flag = 1;
LOG_N(MAC,"Delay sending the DCI, and receive command\n"); LOG_N(MAC,"Key resent \n");
UE_sched_ctrl_info->dci_n0_index_ndi=0; UE_sched_ctrl_info->dci_n0_index_ndi=1;
}else }else
{ {
...@@ -234,6 +235,10 @@ void rx_sdu_NB_IoT(module_id_t module_id, int CC_id, frame_t frame, sub_frame_t ...@@ -234,6 +235,10 @@ void rx_sdu_NB_IoT(module_id_t module_id, int CC_id, frame_t frame, sub_frame_t
{ {
LOG_I(MAC,"Find UE in CE 2 list, update ul_total_buffer to %d bytes\n",BSR_table[BSR_index]); LOG_I(MAC,"Find UE in CE 2 list, update ul_total_buffer to %d bytes\n",BSR_table[BSR_index]);
UE_info->ul_total_buffer = BSR_table[BSR_index]; UE_info->ul_total_buffer = BSR_table[BSR_index];
if (UE_info->ul_total_buffer >= 10 && UE_info->ul_total_buffer <= 20)
{
second_flag = 1;
}
} }
else else
LOG_E(MAC,"UE info empty\n"); LOG_E(MAC,"UE info empty\n");
...@@ -282,25 +287,36 @@ void rx_sdu_NB_IoT(module_id_t module_id, int CC_id, frame_t frame, sub_frame_t ...@@ -282,25 +287,36 @@ void rx_sdu_NB_IoT(module_id_t module_id, int CC_id, frame_t frame, sub_frame_t
case DCCH0_NB_IoT: case DCCH0_NB_IoT:
case DCCH1_NB_IoT: case DCCH1_NB_IoT:
LOG_I(MAC,"DCCH PDU Here\n"); LOG_I(MAC,"DCCH PDU Here\n");
if(second_flag == 0)
mac_rlc_data_ind( {
module_id, mac_rlc_data_ind(
rnti, module_id,
module_id, rnti,
frame, module_id,
1, frame,
0, 1,
rx_lcids[i], 0,
//1,/* change channel_id equals 1 (SRB) */ rx_lcids[i],
(char *)payload_ptr, //1,/* change channel_id equals 1 (SRB) */
rx_lengths[i], (char *)payload_ptr,
1, rx_lengths[i],
NULL);//(unsigned int*)crc_status); 1,
// trigger DL scheduler NULL);//(unsigned int*)crc_status);
if (UE_info != NULL) // trigger DL scheduler
if (UE_info != NULL)
{
UE_info->direction = 1; //1 for DL scheduler
LOG_I(MAC,"After receive Msg5, change the UE scheduling direction to DL\n");
}
}else if (second_flag == 1)
{ {
UE_info->direction = 1; //1 for DL scheduler LOG_N(MAC,"Here we are for the DCI N0 generating \n");
LOG_I(MAC,"After receive Msg5, change the UE scheduling direction to DL\n"); if (UE_info != NULL)
{
UE_info->direction = 0; //1 for DL scheduler
LOG_I(MAC,"Change direction into 0\n");
}
second_flag = 0;
} }
break; break;
......
...@@ -180,7 +180,7 @@ int output_handler(eNB_MAC_INST_NB_IoT *mac_inst, module_id_t module_id, int CC_ ...@@ -180,7 +180,7 @@ int output_handler(eNB_MAC_INST_NB_IoT *mac_inst, module_id_t module_id, int CC_
dl_config_pdu->npdcch_pdu.npdcch_pdu_rel13.harq_ack_resource = ((DCIFormatN1_t *)DCI_pdu)->HARQackRes; dl_config_pdu->npdcch_pdu.npdcch_pdu_rel13.harq_ack_resource = ((DCIFormatN1_t *)DCI_pdu)->HARQackRes;
dl_config_pdu->npdcch_pdu.npdcch_pdu_rel13.npdcch_order_indication = ((DCIFormatN1_t *)DCI_pdu)->orderIndicator; dl_config_pdu->npdcch_pdu.npdcch_pdu_rel13.npdcch_order_indication = ((DCIFormatN1_t *)DCI_pdu)->orderIndicator;
dl_config_pdu->npdcch_pdu.npdcch_pdu_rel13.dci_subframe_repetition_number = ((DCIFormatN1_t *)DCI_pdu)->DCIRep; dl_config_pdu->npdcch_pdu.npdcch_pdu_rel13.dci_subframe_repetition_number = ((DCIFormatN1_t *)DCI_pdu)->DCIRep;
LOG_N(MAC,"[hypersfn:%2d][frame:%2d][subframe:%2d]NB-IoT fill DL DCI, res:%d, rep:%d\n",hypersfn,frame,subframe,dl_config_pdu->npdcch_pdu.npdcch_pdu_rel13.resource_assignment,((DCIFormatN1_t *)DCI_pdu)->RepNum); LOG_I(MAC,"[hypersfn:%2d][frame:%2d][subframe:%2d]NB-IoT fill DL DCI, res:%d, rep:%d\n",hypersfn,frame,subframe,dl_config_pdu->npdcch_pdu.npdcch_pdu_rel13.resource_assignment,((DCIFormatN1_t *)DCI_pdu)->RepNum);
}else if(schedule_result_list_DL->direction == UL) // DCI for uplink }else if(schedule_result_list_DL->direction == UL) // DCI for uplink
{ {
......
...@@ -105,6 +105,18 @@ void UL_indication_NB_IoT(UL_IND_NB_IoT_t *UL_INFO) ...@@ -105,6 +105,18 @@ void UL_indication_NB_IoT(UL_IND_NB_IoT_t *UL_INFO)
//timing_offset = Timing_advance * 16 //timing_offset = Timing_advance * 16
(UL_INFO->nrach_ind.nrach_pdu_list+i)->nrach_indication_rel13.timing_advance*16 (UL_INFO->nrach_ind.nrach_pdu_list+i)->nrach_indication_rel13.timing_advance*16
); );
}else if (block_rach == 1)
{
LOG_N(MAC,"It is the second time that this UE try to rach\n");
init_RA_NB_IoT(mac_inst,
(UL_INFO->nrach_ind.nrach_pdu_list+i)->nrach_indication_rel13.initial_sc,
(UL_INFO->nrach_ind.nrach_pdu_list+i)->nrach_indication_rel13.nrach_ce_level,
UL_INFO->frame,
//timing_offset = Timing_advance * 16
(UL_INFO->nrach_ind.nrach_pdu_list+i)->nrach_indication_rel13.timing_advance*16
);
//block_rach = 2;
} }
} }
} }
...@@ -140,8 +152,8 @@ void UL_indication_NB_IoT(UL_IND_NB_IoT_t *UL_INFO) ...@@ -140,8 +152,8 @@ void UL_indication_NB_IoT(UL_IND_NB_IoT_t *UL_INFO)
}else }else
{ {
LOG_I(MAC,"This UE get the response of HARQ DL : ACK, update the UL buffer for next message\n"); LOG_I(MAC,"This UE get the response of HARQ DL : ACK, update the UL buffer for next message\n");
ue_info->direction=0; ue_info->direction=-1;
ue_info->ul_total_buffer = 39; //ue_info->ul_total_buffer = 11;
block_rach = 1; block_rach = 1;
//LOG_I(MAC,"This UE get the response of HARQ DL : NACK, and will start the next harq round : %d\n",ue_info->HARQ_round); //LOG_I(MAC,"This UE get the response of HARQ DL : NACK, and will start the next harq round : %d\n",ue_info->HARQ_round);
//ue_info->direction=1; //ue_info->direction=1;
......
...@@ -1115,7 +1115,7 @@ uint8_t do_RRCConnectionSetup_NB_IoT( ...@@ -1115,7 +1115,7 @@ uint8_t do_RRCConnectionSetup_NB_IoT(
//*periodicBSR_Timer = 2; // PeriodicBSR_Timer_NB_r13_pp8 //*periodicBSR_Timer = 2; // PeriodicBSR_Timer_NB_r13_pp8
//logicalChannelSR_Config = CALLOC(1,sizeof(*logicalChannelSR_Config)); //logicalChannelSR_Config = CALLOC(1,sizeof(*logicalChannelSR_Config));
mac_main_config_NB_IoT->choice.explicitValue_r13.logicalChannelSR_Config_r13->choice.setup.logicalChannelSR_ProhibitTimer_r13 = 6;//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 = 5;//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; 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)); //ul_SCH_Config = CALLOC(1,sizeof(*ul_SCH_Config));
......
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