Commit 30bd3fbe authored by Nick Ho's avatar Nick Ho

Debug on DL msg transfer

parent 04d2e40c
......@@ -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_rx_indication_NB_IoT(eNB,proc,npusch_format,1);
printf(" decoded ACK of DL Data (include MSG4): ACK \n");
printf(" decoded ACK of DL Data (include MSG4) \n");
} else if (counter_ack<8) { //hard decision
//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(" decoded ACK of DL Data (include MSG4): NACK \n");
printf(" decoded ACK of DL Data (include MSG4) \n");
} else { //when equality (8 bits 0 vs 8 bits 1), soft decision
......
......@@ -75,9 +75,11 @@ int schedule_DL_NB_IoT(module_id_t module_id, eNB_MAC_INST_NB_IoT *mac_inst, UE_
int HARQ_delay=0;
uint32_t data_size;
uint32_t mac_sdu_size; //
uint32_t mac_sdu_size2; //
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;
......@@ -87,6 +89,7 @@ int schedule_DL_NB_IoT(module_id_t module_id, eNB_MAC_INST_NB_IoT *mac_inst, UE_
uint32_t search_space_end_sf, h_temp, f_temp, sf_temp;
mac_rlc_status_resp_t rlc_status; //Declare rlc_status
mac_rlc_status_resp_t rlc_status2; //Declare rlc_status
I_mcs = get_I_mcs(UE_info->CE_level);
//I_mcs = 6;
......@@ -139,15 +142,46 @@ int schedule_DL_NB_IoT(module_id_t module_id, eNB_MAC_INST_NB_IoT *mac_inst, UE_
LOG_I(MAC,"[NB-IoT][DCCH] Got %d bytes from RLC\n",mac_sdu_size);
//Get RLC status
rlc_status2 = mac_rlc_status_ind(
module_id,
UE_info->rnti,
module_id,
frame_start,
subframe_start,
1,
0,
DCCH0_NB_IoT,
TBS-subheader_length-mac_sdu_size);
mac_sdu_size2 = mac_rlc_data_req(
module_id,
UE_info->rnti,
module_id,
frame_start,
1,
0,
DCCH0_NB_IoT,
TBS, //not used
(char *)&sdu_temp2[0]);
printf("print the second RLC DATA PDU payload, we have %d byte \n",mac_sdu_size2);
int y;
for (y=0;y<mac_sdu_size2;y++){
printf("%02x ",sdu_temp2[y]);
}
printf("\n");
//Generate header
payload_offset = generate_dlsch_header_NB_IoT(UE_info->DLSCH_pdu.payload, 1, &logical_channel, &mac_sdu_size, 0, 0, TBS);
payload_offset = generate_dlsch_header_NB_IoT(UE_info->DLSCH_pdu.payload, 1, &logical_channel, &mac_sdu_size2, 0, 0, TBS);
//Complete MAC PDU
memcpy(UE_info->DLSCH_pdu.payload+payload_offset, sdu_temp, mac_sdu_size);
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);
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;y++){
//int y;
for (y=0;y<mac_sdu_size+payload_offset+mac_sdu_size2;y++){
//for (y=0;y<payload_offset+mac_sdu_size2;y++){
printf("%02x ",UE_info->DLSCH_pdu.payload[y]);
}
printf("\n");
......@@ -519,6 +553,17 @@ uint32_t generate_dlsch_header_NB_IoT(uint8_t *pdu, uint32_t num_sdu, logical_ch
offset++;
mac_header+=1;*/
((SCH_SUBHEADER_SHORT_NB_IoT*)mac_header)->LCID = DCCH0_NB_IoT;
((SCH_SUBHEADER_SHORT_NB_IoT*)mac_header)->F2=0;
((SCH_SUBHEADER_SHORT_NB_IoT*)mac_header)->R=0;
((SCH_SUBHEADER_SHORT_NB_IoT*)mac_header)->E=1;
//((SCH_SUBHEADER_SHORT_NB_IoT*)mac_header)->E=1;
((SCH_SUBHEADER_SHORT_NB_IoT*)mac_header)->F=0;
((SCH_SUBHEADER_SHORT_NB_IoT*)mac_header)->L=2;
//num_subheader--;
mac_header+=2;
offset+=2;
((SCH_SUBHEADER_SHORT_NB_IoT*)mac_header)->LCID = DCCH0_NB_IoT;
((SCH_SUBHEADER_SHORT_NB_IoT*)mac_header)->F2=0;
......
......@@ -57,7 +57,7 @@ int schedule_UL_NB_IoT(eNB_MAC_INST_NB_IoT *mac_inst,UE_TEMPLATE_NB_IoT *UE_info
}
TBS=get_TBS_UL_NB_IoT(mcs,UE_info->multi_tone,Iru);
LOG_D(MAC,"Initial TBS : %d UL_buffer: %d\n", TBS, UE_info->ul_total_buffer);
LOG_I(MAC,"Initial TBS : %d UL_buffer: %d\n", TBS, UE_info->ul_total_buffer);
sched_temp_UL_NB_IoT_t *NPUSCH_info = (sched_temp_UL_NB_IoT_t*)malloc(sizeof(sched_temp_UL_NB_IoT_t));
......
......@@ -420,9 +420,24 @@ rlc_am_get_pdus (
break;
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);
/*
/*
if ((rlc_pP->nb_bytes_requested_by_mac > 2) && (rlc_pP->sdu_buffer_occupancy) && (rlc_pP->vt_s != rlc_pP->vt_ms)) {
LOG_I(RLC,"[NB-IoT] RLC SEND NEW DATA PDU\n");
rlc_am_segment_10(ctxt_pP, rlc_pP);
list_add_list (&rlc_pP->segmentation_pdu_list, &rlc_pP->pdus_to_mac_layer);
if (rlc_pP->pdus_to_mac_layer.head != NULL) {
rlc_pP->stat_tx_data_pdu += 1;
rlc_pP->stat_tx_data_bytes += (((struct mac_tb_req*)(rlc_pP->pdus_to_mac_layer.head->data))->tb_size);
return;
}
}
*/
// TRY TO SEND CONTROL PDU FIRST
if ((rlc_pP->nb_bytes_requested_by_mac >= 2) &&
((rlc_pP->status_requested) && !(rlc_pP->status_requested & RLC_AM_STATUS_NO_TX_MASK))) {
......@@ -453,7 +468,7 @@ rlc_am_get_pdus (
PROTOCOL_RLC_AM_CTXT_ARGS(ctxt_pP,rlc_pP),
rlc_pP->nb_bytes_requested_by_mac,rlc_pP->t_status_prohibit.ms_time_out,(rlc_pP->status_requested & RLC_AM_STATUS_TRIGGERED_DELAYED));
}
*/
// THEN TRY TO SEND RETRANS PDU
if ((rlc_pP->retrans_num_bytes_to_retransmit) && (rlc_pP->nb_bytes_requested_by_mac > 2)) {
LOG_I(RLC,"[NB-IoT] RLC SEND RETRANS DATA PDU\n");
......@@ -468,6 +483,7 @@ rlc_am_get_pdus (
}
}
LOG_N(RLC,"First condition: %d, second : %d \n",rlc_pP->sdu_buffer_occupancy,rlc_pP->vt_s != rlc_pP->vt_ms);
// THEN TRY TO SEND NEW DATA PDU
if ((rlc_pP->nb_bytes_requested_by_mac > 2) && (rlc_pP->sdu_buffer_occupancy) && (rlc_pP->vt_s != rlc_pP->vt_ms)) {
LOG_I(RLC,"[NB-IoT] RLC SEND NEW DATA PDU\n");
......@@ -697,8 +713,8 @@ rlc_am_mac_data_request (
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);
printf("***********head_3=%x (in rlc_am.c)***********\n",&l_rlc_p->pdus_to_mac_layer.head);
//printf("*******nb_elements_3=%d (in rlc_am.c)***************\n",data_req.data.nb_elements);
//printf("***********head_3=%x (in rlc_am.c)***********\n",&l_rlc_p->pdus_to_mac_layer.head);
//((rlc_am_entity_t *) rlc_pP)->tx_pdus += data_req.data.nb_elements;
if ((nb_bytes_requested_by_mac + data_req.data.nb_elements) > 0) {
......
......@@ -196,7 +196,7 @@ tbs_size_t mac_rlc_data_req(
//if (!enb_flagP) rlc_am_set_nb_bytes_requested_by_mac(&rlc_union_p->rlc.am,tb_sizeP);
data_request = rlc_am_mac_data_request(&ctxt, &rlc_union_p->rlc.am,enb_flagP);
ret_tb_size =mac_rlc_serialize_tb(buffer_pP, data_request.data);
printf("****************data_request=%d (in rlc_mac.c)****************\n",data_request);
//printf("****************data_request=%d (in rlc_mac.c)****************\n",data_request);
break;
case RLC_MODE_UM:
......
......@@ -3,6 +3,7 @@
#include "LAYER2/MAC/extern_NB_IoT.h"
int tmp = 0;
int block_rach = 0;
void simulate_preamble(UL_IND_NB_IoT_t *UL_INFO, int CE, int sc)
{
......@@ -92,15 +93,18 @@ void UL_indication_NB_IoT(UL_IND_NB_IoT_t *UL_INFO)
//for(i=0;i<UL_INFO->nrach_ind.number_of_initial_scs_detected;i++)
for(i=0;i<1;i++)
{
// initiate_ra here, some useful inforamtion :
LOG_D(MAC,"Init_RA_NB_IoT in, index of sc = %d\n",(UL_INFO->nrach_ind.nrach_pdu_list+i)->nrach_indication_rel13.initial_sc);
init_RA_NB_IoT(mac_inst,
if(block_rach == 0)
{
// initiate_ra here, some useful inforamtion :
LOG_D(MAC,"Init_RA_NB_IoT in, index of sc = %d\n",(UL_INFO->nrach_ind.nrach_pdu_list+i)->nrach_indication_rel13.initial_sc);
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
);
}
}
}
......@@ -134,10 +138,13 @@ void UL_indication_NB_IoT(UL_IND_NB_IoT_t *UL_INFO)
ue_info->direction=0;
}else
{
ue_info->direction=1;
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);
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->ul_total_buffer = 64;
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);
//ue_info->direction=1;
//ue_info->HARQ_round++;
}
}
else
......
......@@ -953,6 +953,7 @@ uint8_t do_RRCConnectionSetup_NB_IoT(
BOOLEAN_t* npusch_AllSymbols = NULL;
long* npusch_repetitions = NULL;
long* group_hopping_disabled = NULL;
long* srpro = NULL;
// At the first moment of MSG4 testing we set NULL to those optional
......@@ -1037,9 +1038,13 @@ uint8_t do_RRCConnectionSetup_NB_IoT(
SRB1bis_lchan_config_NB_IoT = CALLOC(1,sizeof(*SRB1bis_lchan_config_NB_IoT));
SRB1bis_config_NB_IoT->logicalChannelConfig_r13 = SRB1bis_lchan_config_NB_IoT;
//SRB1bis_lchan_config_NB_IoT->present = SRB_ToAddMod_NB_r13__logicalChannelConfig_r13_PR_explicitValue;
SRB1bis_lchan_config_NB_IoT->present = SRB_ToAddMod_NB_r13__logicalChannelConfig_r13_PR_defaultValue;
/*
srpro = CALLOC(1,sizeof(long));
*srpro = 3;
SRB1bis_lchan_config_NB_IoT->choice.explicitValue.priority_r13 = srpro;
*/
//prioritySRB1bis = CALLOC(1, sizeof(long));
//*prioritySRB1bis = 1; //same as SRB1?
//SRB1bis_lchan_config_NB_IoT->choice.explicitValue.priority_r13 = prioritySRB1bis;
......
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