Commit 663b1d8b authored by Xu Bo's avatar Xu Bo

fix bugs for hundreds_of_ues(UE SCD)

parent 741c87c0
...@@ -63,6 +63,9 @@ ...@@ -63,6 +63,9 @@
#include "signals.h" #include "signals.h"
#include "timer.h" #include "timer.h"
#ifdef UE_EXPANSION
#include "log.h"
#endif
#ifdef RTAI #ifdef RTAI
# include <rtai.h> # include <rtai.h>
...@@ -455,7 +458,21 @@ int itti_send_msg_to_task(task_id_t destination_task_id, instance_t instance, Me ...@@ -455,7 +458,21 @@ int itti_send_msg_to_task(task_id_t destination_task_id, instance_t instance, Me
/* Enqueue message in destination task queue */ /* Enqueue message in destination task queue */
if (lfds611_queue_enqueue(itti_desc.tasks[destination_task_id].message_queue, new) == 0) { if (lfds611_queue_enqueue(itti_desc.tasks[destination_task_id].message_queue, new) == 0) {
#ifdef UE_EXPANSION
LOG_I(UDP_, " Assertion Message %s(id:%d), number %lu with priority %d can not be sent from (%u:%s) to queue (%u:%s). discarding...\n",
itti_desc.messages_info[message_id].name,
message_id,
message_number,
priority,
origin_task_id,
itti_get_task_name(origin_task_id),
destination_task_id,
itti_get_task_name(destination_task_id));
int result = itti_free(origin_task_id, message);
AssertFatal( result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result);
#else
AssertFatal(0, "Error: lfds611_queue_enqueue returns 0, queue is full, exiting\n"); AssertFatal(0, "Error: lfds611_queue_enqueue returns 0, queue is full, exiting\n");
#endif
} }
#if defined(OAI_EMU) || defined(RTAI) #if defined(OAI_EMU) || defined(RTAI)
...@@ -625,7 +642,14 @@ static inline void itti_receive_msg_internal_event_fd(task_id_t task_id, uint8_t ...@@ -625,7 +642,14 @@ static inline void itti_receive_msg_internal_event_fd(task_id_t task_id, uint8_t
if (lfds611_queue_dequeue (itti_desc.tasks[task_id].message_queue, (void **) &message) == 0) { if (lfds611_queue_dequeue (itti_desc.tasks[task_id].message_queue, (void **) &message) == 0) {
/* No element in list -> this should not happen */ /* No element in list -> this should not happen */
#ifdef UE_EXPANSION
LOG_I(UDP_, "Assertion No message in queue for task %d while there are %d events and some for the messages queue!\n", task_id, epoll_ret);
/* Mark that the event has been processed */
itti_desc.threads[thread_id].events[i].events &= ~EPOLLIN;
return;
#else
AssertFatal (0, "No message in queue for task %d while there are %d events and some for the messages queue!\n", task_id, epoll_ret); AssertFatal (0, "No message in queue for task %d while there are %d events and some for the messages queue!\n", task_id, epoll_ret);
#endif
} }
AssertFatal(message != NULL, "Message from message queue is NULL!\n"); AssertFatal(message != NULL, "Message from message queue is NULL!\n");
......
...@@ -2639,8 +2639,15 @@ void fill_ulsch(PHY_VARS_eNB *eNB,int UE_id,nfapi_ul_config_ulsch_pdu *ulsch_pdu ...@@ -2639,8 +2639,15 @@ void fill_ulsch(PHY_VARS_eNB *eNB,int UE_id,nfapi_ul_config_ulsch_pdu *ulsch_pdu
ulsch->harq_processes[harq_pid]->Or1 = 0; ulsch->harq_processes[harq_pid]->Or1 = 0;
ulsch->harq_processes[harq_pid]->Or2 = 0; ulsch->harq_processes[harq_pid]->Or2 = 0;
} }
#ifndef UE_EXPANSION
else ulsch->harq_processes[harq_pid]->round++; else ulsch->harq_processes[harq_pid]->round++;
#else
else {
ulsch->harq_processes[harq_pid]->round++;
ulsch->harq_processes[harq_pid]->TBS = ulsch_pdu->ulsch_pdu_rel8.size<<3;
ulsch->harq_processes[harq_pid]->Msc_initial = 12*ulsch_pdu->ulsch_pdu_rel8.number_of_resource_blocks;
}
#endif
ulsch->rnti = ulsch_pdu->ulsch_pdu_rel8.rnti; ulsch->rnti = ulsch_pdu->ulsch_pdu_rel8.rnti;
LOG_D(PHY,"Filling ULSCH %x (UE_id %d) (new_ulsch %d) for Frame %d, Subframe %d : harq_pid %d, first_rb %d, nb_rb %d, rvidx %d, Qm %d, TBS %d, round %d \n", LOG_D(PHY,"Filling ULSCH %x (UE_id %d) (new_ulsch %d) for Frame %d, Subframe %d : harq_pid %d, first_rb %d, nb_rb %d, rvidx %d, Qm %d, TBS %d, round %d \n",
ulsch->rnti, ulsch->rnti,
......
...@@ -916,8 +916,9 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc, ...@@ -916,8 +916,9 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,
G); G);
//#endif //#endif
#ifndef UE_EXPANSION
if (ulsch_harq->round == 0) { if (ulsch_harq->round == 0) {
#endif
// This is a new packet, so compute quantities regarding segmentation // This is a new packet, so compute quantities regarding segmentation
ulsch_harq->B = A+24; ulsch_harq->B = A+24;
lte_segmentation(NULL, lte_segmentation(NULL,
...@@ -930,8 +931,9 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc, ...@@ -930,8 +931,9 @@ unsigned int ulsch_decoding(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc,
&ulsch_harq->Kminus, &ulsch_harq->Kminus,
&ulsch_harq->F); &ulsch_harq->F);
// CLEAR LLR's HERE for first packet in process // CLEAR LLR's HERE for first packet in process
#ifndef UE_EXPANSION
} }
#endif
// printf("after segmentation c[%d] = %p\n",0,ulsch_harq->c[0]); // printf("after segmentation c[%d] = %p\n",0,ulsch_harq->c[0]);
sumKr = 0; sumKr = 0;
......
...@@ -549,7 +549,7 @@ check_ul_failure(module_id_t module_idP, int CC_id, int UE_id, ...@@ -549,7 +549,7 @@ check_ul_failure(module_id_t module_idP, int CC_id, int UE_id,
UE_list->UE_sched_ctrl[UE_id].ul_failure_timer++; UE_list->UE_sched_ctrl[UE_id].ul_failure_timer++;
// check threshold // check threshold
if (UE_list->UE_sched_ctrl[UE_id].ul_failure_timer > 200) { if (UE_list->UE_sched_ctrl[UE_id].ul_failure_timer > 20000) {
// inform RRC of failure and clear timer // inform RRC of failure and clear timer
LOG_I(MAC, LOG_I(MAC,
"UE %d rnti %x: UL Failure after repeated PDCCH orders: Triggering RRC \n", "UE %d rnti %x: UL Failure after repeated PDCCH orders: Triggering RRC \n",
...@@ -724,7 +724,9 @@ eNB_dlsch_ulsch_scheduler(module_id_t module_idP, frame_t frameP, ...@@ -724,7 +724,9 @@ eNB_dlsch_ulsch_scheduler(module_id_t module_idP, frame_t frameP,
} }
#endif #endif
#ifdef UE_EXPANSION
memset(dlsch_ue_select, 0, sizeof(dlsch_ue_select));
#endif
// This schedules MIB // This schedules MIB
if ((subframeP == 0) && (frameP & 3) == 0) if ((subframeP == 0) && (frameP & 3) == 0)
schedule_mib(module_idP, frameP, subframeP); schedule_mib(module_idP, frameP, subframeP);
......
...@@ -507,6 +507,13 @@ generate_Msg2(module_id_t module_idP, int CC_idP, frame_t frameP, ...@@ -507,6 +507,13 @@ generate_Msg2(module_id_t module_idP, int CC_idP, frame_t frameP,
TX_req->segments[0].segment_data = TX_req->segments[0].segment_data =
cc[CC_idP].RAR_pdu.payload; cc[CC_idP].RAR_pdu.payload;
mac->TX_req[CC_idP].tx_request_body.number_of_pdus++; mac->TX_req[CC_idP].tx_request_body.number_of_pdus++;
#ifdef UE_EXPANSION
dlsch_ue_select[CC_idP].list[dlsch_ue_select[CC_idP].ue_num].ue_priority = SCH_DL_MSG2;
dlsch_ue_select[CC_idP].list[dlsch_ue_select[CC_idP].ue_num].nb_rb = 4;
dlsch_ue_select[CC_idP].list[dlsch_ue_select[CC_idP].ue_num].UE_id = -1;
dlsch_ue_select[CC_idP].list[dlsch_ue_select[CC_idP].ue_num].rnti = ra->rnti;
dlsch_ue_select[CC_idP].ue_num++;
#endif
} }
} }
...@@ -634,6 +641,13 @@ generate_Msg2(module_id_t module_idP, int CC_idP, frame_t frameP, ...@@ -634,6 +641,13 @@ generate_Msg2(module_id_t module_idP, int CC_idP, frame_t frameP,
TX_req->segments[0].segment_data = TX_req->segments[0].segment_data =
cc[CC_idP].RAR_pdu.payload; cc[CC_idP].RAR_pdu.payload;
mac->TX_req[CC_idP].tx_request_body.number_of_pdus++; mac->TX_req[CC_idP].tx_request_body.number_of_pdus++;
#ifdef UE_EXPANSION
dlsch_ue_select[CC_idP].list[dlsch_ue_select[CC_idP].ue_num].ue_priority = SCH_DL_MSG2;
dlsch_ue_select[CC_idP].list[dlsch_ue_select[CC_idP].ue_num].nb_rb = 4;
dlsch_ue_select[CC_idP].list[dlsch_ue_select[CC_idP].ue_num].UE_id = -1;
dlsch_ue_select[CC_idP].list[dlsch_ue_select[CC_idP].ue_num].rnti = ra->rnti;
dlsch_ue_select[CC_idP].ue_num++;
#endif
} // PDCCH CCE allocation is feasible } // PDCCH CCE allocation is feasible
} // Msg2 frame/subframe condition } // Msg2 frame/subframe condition
} // else BL/CE } // else BL/CE
...@@ -1092,6 +1106,13 @@ generate_Msg4(module_id_t module_idP, int CC_idP, frame_t frameP, ...@@ -1092,6 +1106,13 @@ generate_Msg4(module_id_t module_idP, int CC_idP, frame_t frameP,
UE_id), UE_id),
rrc_sdu_length); rrc_sdu_length);
} }
#ifdef UE_EXPANSION
dlsch_ue_select[CC_idP].list[dlsch_ue_select[CC_idP].ue_num].ue_priority = SCH_DL_MSG4;
dlsch_ue_select[CC_idP].list[dlsch_ue_select[CC_idP].ue_num].nb_rb = 4;
dlsch_ue_select[CC_idP].list[dlsch_ue_select[CC_idP].ue_num].UE_id = UE_id;
dlsch_ue_select[CC_idP].list[dlsch_ue_select[CC_idP].ue_num].rnti = ra->rnti;
dlsch_ue_select[CC_idP].ue_num++;
#endif
} // Msg4 frame/subframe } // Msg4 frame/subframe
} // msg4_mpdcch_repetition_count } // msg4_mpdcch_repetition_count
} // rach_resource_type > 0 } // rach_resource_type > 0
...@@ -1293,7 +1314,13 @@ generate_Msg4(module_id_t module_idP, int CC_idP, frame_t frameP, ...@@ -1293,7 +1314,13 @@ generate_Msg4(module_id_t module_idP, int CC_idP, frame_t frameP,
UE_id), UE_id),
rrc_sdu_length); rrc_sdu_length);
} }
#ifdef UE_EXPANSION
dlsch_ue_select[CC_idP].list[dlsch_ue_select[CC_idP].ue_num].ue_priority = SCH_DL_MSG4;
dlsch_ue_select[CC_idP].list[dlsch_ue_select[CC_idP].ue_num].nb_rb = 4;
dlsch_ue_select[CC_idP].list[dlsch_ue_select[CC_idP].ue_num].UE_id = UE_id;
dlsch_ue_select[CC_idP].list[dlsch_ue_select[CC_idP].ue_num].rnti = ra->rnti;
dlsch_ue_select[CC_idP].ue_num++;
#endif
} // CCE Allocation feasible } // CCE Allocation feasible
} // msg4 frame/subframe } // msg4 frame/subframe
} // else rach_resource_type } // else rach_resource_type
...@@ -1431,6 +1458,13 @@ check_Msg4_retransmission(module_id_t module_idP, int CC_idP, ...@@ -1431,6 +1458,13 @@ check_Msg4_retransmission(module_id_t module_idP, int CC_idP,
(cc->p_eNB == 1) ? 1 : 2, // transmission mode (cc->p_eNB == 1) ? 1 : 2, // transmission mode
1, // num_bf_prb_per_subband 1, // num_bf_prb_per_subband
1); // num_bf_vector 1); // num_bf_vector
#ifdef UE_EXPANSION
dlsch_ue_select[CC_idP].list[dlsch_ue_select[CC_idP].ue_num].ue_priority = SCH_DL_MSG4;
dlsch_ue_select[CC_idP].list[dlsch_ue_select[CC_idP].ue_num].nb_rb = 4;
dlsch_ue_select[CC_idP].list[dlsch_ue_select[CC_idP].ue_num].UE_id = UE_id;
dlsch_ue_select[CC_idP].list[dlsch_ue_select[CC_idP].ue_num].rnti = ra->rnti;
dlsch_ue_select[CC_idP].ue_num++;
#endif
} else } else
LOG_D(MAC, LOG_D(MAC,
"msg4 retransmission for rnti %x (round %d) fsf %d/%d CCE allocation failed!\n", "msg4 retransmission for rnti %x (round %d) fsf %d/%d CCE allocation failed!\n",
......
...@@ -511,10 +511,6 @@ schedule_ue_spec(module_id_t module_idP, ...@@ -511,10 +511,6 @@ schedule_ue_spec(module_id_t module_idP,
} }
} }
#ifdef UE_EXPANSION
DLSCH_UE_SELECT dlsch_ue_select[MAX_NUM_CCs];
memset(dlsch_ue_select, 0, sizeof(dlsch_ue_select));
#endif
//weight = get_ue_weight(module_idP,UE_id); //weight = get_ue_weight(module_idP,UE_id);
aggregation = 2; aggregation = 2;
for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) { for (CC_id = 0; CC_id < MAX_NUM_CCs; CC_id++) {
...@@ -546,11 +542,7 @@ schedule_ue_spec(module_id_t module_idP, ...@@ -546,11 +542,7 @@ schedule_ue_spec(module_id_t module_idP,
frameP, frameP,
subframeP, subframeP,
N_RBG, N_RBG,
mbsfn_flag mbsfn_flag);
#ifdef UE_EXPANSION
, dlsch_ue_select
#endif
);
stop_meas(&eNB->schedule_dlsch_preprocessor); stop_meas(&eNB->schedule_dlsch_preprocessor);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_PREPROCESSOR,VCD_FUNCTION_OUT); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DLSCH_PREPROCESSOR,VCD_FUNCTION_OUT);
...@@ -564,11 +556,52 @@ schedule_ue_spec(module_id_t module_idP, ...@@ -564,11 +556,52 @@ schedule_ue_spec(module_id_t module_idP,
#ifdef UE_EXPANSION #ifdef UE_EXPANSION
for (i = 0; i < dlsch_ue_select[CC_id].ue_num; i++) { for (i = 0; i < dlsch_ue_select[CC_id].ue_num; i++) {
if(dlsch_ue_select[CC_id].list[i].ue_priority == SCH_DL_MSG2){
continue;
}
if(dlsch_ue_select[CC_id].list[i].ue_priority == SCH_DL_MSG4){
continue;
}
UE_id = dlsch_ue_select[CC_id].list[i].UE_id; UE_id = dlsch_ue_select[CC_id].list[i].UE_id;
rnti = UE_RNTI(module_idP,UE_id);
if (rnti==NOT_A_RNTI) {
LOG_E(MAC,"Cannot find rnti for UE_id %d (num_UEs %d)\n",UE_id,UE_list->num_UEs);
continue;
}
eNB_UE_stats = &UE_list->eNB_UE_stats[CC_id][UE_id];
ue_sched_ctl = &UE_list->UE_sched_ctrl[UE_id];
switch(get_tmode(module_idP,CC_id,UE_id)){
case 1:
case 2:
case 7:
aggregation = get_aggregation(get_bw_index(module_idP,CC_id),
ue_sched_ctl->dl_cqi[CC_id],
format1);
break;
case 3:
aggregation = get_aggregation(get_bw_index(module_idP,CC_id),
ue_sched_ctl->dl_cqi[CC_id],
format2A);
break;
default:
LOG_W(MAC,"Unsupported transmission mode %d\n", get_tmode(module_idP,CC_id,UE_id));
aggregation = 2;
break;
}
if (cc[CC_id].tdd_Config != NULL) { //TDD
set_ue_dai (subframeP,
UE_id,
CC_id,
cc[CC_id].tdd_Config->subframeAssignment,
UE_list);
// update UL DAI after DLSCH scheduling
set_ul_DAI(module_idP,UE_id,CC_id,frameP,subframeP);
}
#else #else
for (UE_id=UE_list->head; UE_id>=0; UE_id=UE_list->next[UE_id]) { for (UE_id=UE_list->head; UE_id>=0; UE_id=UE_list->next[UE_id]) {
#endif
continue_flag=0; // reset the flag to allow allocation for the remaining UEs continue_flag=0; // reset the flag to allow allocation for the remaining UEs
rnti = UE_RNTI(module_idP,UE_id); rnti = UE_RNTI(module_idP,UE_id);
...@@ -632,6 +665,7 @@ schedule_ue_spec(module_id_t module_idP, ...@@ -632,6 +665,7 @@ schedule_ue_spec(module_id_t module_idP,
CC_id, UE_id, subframeP, S_DL_NONE); CC_id, UE_id, subframeP, S_DL_NONE);
continue; continue;
} }
#endif
#warning RK->CR This old API call has to be revisited for FAPI, or logic must be changed #warning RK->CR This old API call has to be revisited for FAPI, or logic must be changed
#if 0 #if 0
/* add "fake" DCI to have CCE_allocation_infeasible work properly for next allocations */ /* add "fake" DCI to have CCE_allocation_infeasible work properly for next allocations */
...@@ -1415,7 +1449,9 @@ schedule_ue_spec(module_id_t module_idP, ...@@ -1415,7 +1449,9 @@ schedule_ue_spec(module_id_t module_idP,
eNB->pdu_index[CC_id]++; eNB->pdu_index[CC_id]++;
program_dlsch_acknak(module_idP,CC_id,UE_id,frameP,subframeP,dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.cce_idx); program_dlsch_acknak(module_idP,CC_id,UE_id,frameP,subframeP,dl_config_pdu->dci_dl_pdu.dci_dl_pdu_rel8.cce_idx);
#ifdef UE_EXPANSION
last_dlsch_ue_id[CC_id] = UE_id;
#endif
} }
else { else {
LOG_W(MAC,"Frame %d, Subframe %d: Dropping DLSCH allocation for UE %d/%x, infeasible CCE allocations\n", LOG_W(MAC,"Frame %d, Subframe %d: Dropping DLSCH allocation for UE %d/%x, infeasible CCE allocations\n",
...@@ -1434,11 +1470,7 @@ schedule_ue_spec(module_id_t module_idP, ...@@ -1434,11 +1470,7 @@ schedule_ue_spec(module_id_t module_idP,
} // CC_id loop } // CC_id loop
#ifndef UE_EXPANSION
fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_flag); fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_flag);
#else
fill_DLSCH_dci(module_idP,frameP,subframeP,mbsfn_flag,dlsch_ue_select);
#endif
stop_meas(&eNB->schedule_dlsch); stop_meas(&eNB->schedule_dlsch);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_SCHEDULE_DLSCH,VCD_FUNCTION_OUT); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_SCHEDULE_DLSCH,VCD_FUNCTION_OUT);
...@@ -1451,11 +1483,7 @@ fill_DLSCH_dci( ...@@ -1451,11 +1483,7 @@ fill_DLSCH_dci(
module_id_t module_idP, module_id_t module_idP,
frame_t frameP, frame_t frameP,
sub_frame_t subframeP, sub_frame_t subframeP,
int* mbsfn_flagP int* mbsfn_flagP)
#ifdef UE_EXPANSION
, DLSCH_UE_SELECT dlsch_ue_select[MAX_NUM_CCs]
#endif
)
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
{ {
...@@ -1495,6 +1523,12 @@ fill_DLSCH_dci( ...@@ -1495,6 +1523,12 @@ fill_DLSCH_dci(
// UE specific DCIs // UE specific DCIs
#ifdef UE_EXPANSION #ifdef UE_EXPANSION
for (j = 0; j < dlsch_ue_select[CC_id].ue_num; j++) { for (j = 0; j < dlsch_ue_select[CC_id].ue_num; j++) {
if(dlsch_ue_select[CC_id].list[j].ue_priority == SCH_DL_MSG2){
continue;
}
if(dlsch_ue_select[CC_id].list[j].ue_priority == SCH_DL_MSG4){
continue;
}
UE_id = dlsch_ue_select[CC_id].list[j].UE_id; UE_id = dlsch_ue_select[CC_id].list[j].UE_id;
#else #else
for (UE_id=UE_list->head; UE_id>=0; UE_id=UE_list->next[UE_id]) { for (UE_id=UE_list->head; UE_id>=0; UE_id=UE_list->next[UE_id]) {
......
...@@ -933,10 +933,12 @@ schedule_ulsch(module_id_t module_idP, frame_t frameP, ...@@ -933,10 +933,12 @@ schedule_ulsch(module_id_t module_idP, frame_t frameP,
int CC_id; int CC_id;
eNB_MAC_INST *mac = RC.mac[module_idP]; eNB_MAC_INST *mac = RC.mac[module_idP];
COMMON_channels_t *cc; COMMON_channels_t *cc;
int sched_frame=frameP;
start_meas(&mac->schedule_ulsch); start_meas(&mac->schedule_ulsch);
int sched_subframe = (subframeP+4)%10; int sched_subframe = (subframeP+4)%10;
if (sched_subframe < subframeP) sched_frame++;
cc = &mac->common_channels[0]; cc = &mac->common_channels[0];
int tdd_sfa; int tdd_sfa;
...@@ -1051,7 +1053,7 @@ schedule_ulsch(module_id_t module_idP, frame_t frameP, ...@@ -1051,7 +1053,7 @@ schedule_ulsch(module_id_t module_idP, frame_t frameP,
} }
//PRACH //PRACH
if (is_prach_subframe(frame_parms,frameP,subframeP)==1) { if (is_prach_subframe(frame_parms,sched_frame,sched_subframe)==1) {
ulsch_ue_select[CC_id].list[ulsch_ue_select[CC_id].ue_num].ue_priority = SCH_UL_PRACH; ulsch_ue_select[CC_id].list[ulsch_ue_select[CC_id].ue_num].ue_priority = SCH_UL_PRACH;
ulsch_ue_select[CC_id].list[ulsch_ue_select[CC_id].ue_num].start_rb = get_prach_prb_offset( ulsch_ue_select[CC_id].list[ulsch_ue_select[CC_id].ue_num].start_rb = get_prach_prb_offset(
frame_parms, frame_parms,
......
...@@ -102,6 +102,7 @@ extern DCI2_5MHz_2A_TDD_t DLSCH_alloc_pdu2; ...@@ -102,6 +102,7 @@ extern DCI2_5MHz_2A_TDD_t DLSCH_alloc_pdu2;
extern DCI1E_5MHz_2A_M10PRB_TDD_t DLSCH_alloc_pdu1E; extern DCI1E_5MHz_2A_M10PRB_TDD_t DLSCH_alloc_pdu1E;
#ifdef UE_EXPANSION #ifdef UE_EXPANSION
extern DLSCH_UE_SELECT dlsch_ue_select[MAX_NUM_CCs];
extern int last_dlsch_ue_id[MAX_NUM_CCs]; extern int last_dlsch_ue_id[MAX_NUM_CCs];
extern int last_ulsch_ue_id[MAX_NUM_CCs]; extern int last_ulsch_ue_id[MAX_NUM_CCs];
#endif #endif
......
This diff is collapsed.
...@@ -118,11 +118,7 @@ void schedule_ulsch_rnti(module_id_t module_idP, frame_t frameP, sub_frame_t sub ...@@ -118,11 +118,7 @@ void schedule_ulsch_rnti(module_id_t module_idP, frame_t frameP, sub_frame_t sub
@param subframe Index of subframe @param subframe Index of subframe
@param mbsfn_flag Indicates that this subframe is for MCH/MCCH @param mbsfn_flag Indicates that this subframe is for MCH/MCCH
*/ */
#ifndef UE_EXPANSION
void fill_DLSCH_dci(module_id_t module_idP,frame_t frameP,sub_frame_t subframe,int *mbsfn_flag); void fill_DLSCH_dci(module_id_t module_idP,frame_t frameP,sub_frame_t subframe,int *mbsfn_flag);
#else
void fill_DLSCH_dci(module_id_t module_idP,frame_t frameP,sub_frame_t subframe,int *mbsfn_flag, DLSCH_UE_SELECT dlsch_ue_select[MAX_NUM_CCs]);
#endif
/** \brief UE specific DLSCH scheduling. Retrieves next ue to be schduled from round-robin scheduler and gets the appropriate harq_pid for the subframe from PHY. If the process is active and requires a retransmission, it schedules the retransmission with the same PRB count and MCS as the first transmission. Otherwise it consults RLC for DCCH/DTCH SDUs (status with maximum number of available PRBS), builds the MAC header (timing advance sent by default) and copies /** \brief UE specific DLSCH scheduling. Retrieves next ue to be schduled from round-robin scheduler and gets the appropriate harq_pid for the subframe from PHY. If the process is active and requires a retransmission, it schedules the retransmission with the same PRB count and MCS as the first transmission. Otherwise it consults RLC for DCCH/DTCH SDUs (status with maximum number of available PRBS), builds the MAC header (timing advance sent by default) and copies
@param Mod_id Instance ID of eNB @param Mod_id Instance ID of eNB
...@@ -216,11 +212,7 @@ void dlsch_scheduler_pre_processor (module_id_t module_idP, ...@@ -216,11 +212,7 @@ void dlsch_scheduler_pre_processor (module_id_t module_idP,
frame_t frameP, frame_t frameP,
sub_frame_t subframe, sub_frame_t subframe,
int N_RBG[MAX_NUM_CCs], int N_RBG[MAX_NUM_CCs],
int *mbsfn_flag int *mbsfn_flag);
#ifdef UE_EXPANSION
, DLSCH_UE_SELECT dlsch_ue_select[MAX_NUM_CCs]
#endif
);
void dlsch_scheduler_pre_processor_allocate (module_id_t Mod_id, void dlsch_scheduler_pre_processor_allocate (module_id_t Mod_id,
......
...@@ -71,7 +71,7 @@ fill_rar(const module_id_t module_idP, ...@@ -71,7 +71,7 @@ fill_rar(const module_id_t module_idP,
ra->timing_offset /= 16; //T_A = N_TA/16, where N_TA should be on a 30.72Msps ra->timing_offset /= 16; //T_A = N_TA/16, where N_TA should be on a 30.72Msps
rar[0] = (uint8_t) (ra->timing_offset >> (2 + 4)); // 7 MSBs of timing advance + divide by 4 rar[0] = (uint8_t) (ra->timing_offset >> (2 + 4)); // 7 MSBs of timing advance + divide by 4
rar[1] = (uint8_t) (ra->timing_offset << (4 - 2)) & 0xf0; // 4 LSBs of timing advance + divide by 4 rar[1] = (uint8_t) (ra->timing_offset << (4 - 2)) & 0xf0; // 4 LSBs of timing advance + divide by 4
ra->msg3_first_rb = 6; ra->msg3_first_rb = 1;
ra->msg3_nb_rb = 1; ra->msg3_nb_rb = 1;
uint16_t rballoc = mac_computeRIV(N_RB_UL, ra->msg3_first_rb, ra->msg3_nb_rb); // first PRB only for UL Grant uint16_t rballoc = mac_computeRIV(N_RB_UL, ra->msg3_first_rb, ra->msg3_nb_rb); // first PRB only for UL Grant
rar[1] |= (rballoc >> 7) & 7; // Hopping = 0 (bit 3), 3 MSBs of rballoc rar[1] |= (rballoc >> 7) & 7; // Hopping = 0 (bit 3), 3 MSBs of rballoc
......
...@@ -146,6 +146,7 @@ DCI2_5MHz_2A_TDD_t DLSCH_alloc_pdu2; ...@@ -146,6 +146,7 @@ DCI2_5MHz_2A_TDD_t DLSCH_alloc_pdu2;
DCI1E_5MHz_2A_M10PRB_TDD_t DLSCH_alloc_pdu1E; DCI1E_5MHz_2A_M10PRB_TDD_t DLSCH_alloc_pdu1E;
#ifdef UE_EXPANSION #ifdef UE_EXPANSION
DLSCH_UE_SELECT dlsch_ue_select[MAX_NUM_CCs];
int last_dlsch_ue_id[MAX_NUM_CCs] = {-1}; int last_dlsch_ue_id[MAX_NUM_CCs] = {-1};
int last_ulsch_ue_id[MAX_NUM_CCs] = {-1}; int last_ulsch_ue_id[MAX_NUM_CCs] = {-1};
#endif #endif
......
...@@ -438,6 +438,14 @@ typedef struct eNB_RRC_UE_s { ...@@ -438,6 +438,14 @@ typedef struct eNB_RRC_UE_s {
uint32_t ul_failure_timer; uint32_t ul_failure_timer;
uint32_t ue_release_timer; uint32_t ue_release_timer;
uint32_t ue_release_timer_thres; uint32_t ue_release_timer_thres;
#ifdef UE_EXPANSION
uint32_t ue_release_timer_s1;
uint32_t ue_release_timer_thres_s1;
uint32_t ue_release_timer_rrc;
uint32_t ue_release_timer_thres_rrc;
uint32_t ue_reestablishment_timer;
uint32_t ue_reestablishment_timer_thres;
#endif
} eNB_RRC_UE_t; } eNB_RRC_UE_t;
typedef uid_t ue_uid_t; typedef uid_t ue_uid_t;
......
...@@ -333,26 +333,62 @@ rrc_rx_tx( ...@@ -333,26 +333,62 @@ rrc_rx_tx(
RB_FOREACH(ue_context_p, rrc_ue_tree_s, &(RC.rrc[ctxt_pP->module_id]->rrc_ue_head)) { RB_FOREACH(ue_context_p, rrc_ue_tree_s, &(RC.rrc[ctxt_pP->module_id]->rrc_ue_head)) {
if ((ctxt_pP->frame == 0) && (ctxt_pP->subframe==0)) { if ((ctxt_pP->frame == 0) && (ctxt_pP->subframe==0)) {
if (ue_context_p->ue_context.Initialue_identity_s_TMSI.presence == TRUE) { if (ue_context_p->ue_context.Initialue_identity_s_TMSI.presence == TRUE) {
LOG_I(RRC,"UE rnti %x:S-TMSI %x failure timer %d/20000\n", LOG_I(RRC,"UE rnti %x:S-TMSI %x failure timer %d/8\n",
ue_context_p->ue_context.rnti, ue_context_p->ue_context.rnti,
ue_context_p->ue_context.Initialue_identity_s_TMSI.m_tmsi, ue_context_p->ue_context.Initialue_identity_s_TMSI.m_tmsi,
ue_context_p->ue_context.ul_failure_timer); ue_context_p->ue_context.ul_failure_timer);
} }
else { else {
LOG_I(RRC,"UE rnti %x failure timer %d/20000\n", LOG_I(RRC,"UE rnti %x failure timer %d/8\n",
ue_context_p->ue_context.rnti, ue_context_p->ue_context.rnti,
ue_context_p->ue_context.ul_failure_timer); ue_context_p->ue_context.ul_failure_timer);
} }
} }
if (ue_context_p->ue_context.ul_failure_timer>0) { if (ue_context_p->ue_context.ul_failure_timer>0) {
ue_context_p->ue_context.ul_failure_timer++; ue_context_p->ue_context.ul_failure_timer++;
if (ue_context_p->ue_context.ul_failure_timer >= 20000) { if (ue_context_p->ue_context.ul_failure_timer >= 8) {
// remove UE after 20 seconds after MAC has indicated UL failure // remove UE after 20 seconds after MAC has indicated UL failure
LOG_I(RRC,"Removing UE %x instance\n",ue_context_p->ue_context.rnti); LOG_I(RRC,"Removing UE %x instance\n",ue_context_p->ue_context.rnti);
ue_to_be_removed = ue_context_p; ue_to_be_removed = ue_context_p;
break; break;
} }
} }
#ifdef UE_EXPANSION
if (ue_context_p->ue_context.ue_release_timer_s1>0) {
ue_context_p->ue_context.ue_release_timer_s1++;
if (ue_context_p->ue_context.ue_release_timer_s1 >=
ue_context_p->ue_context.ue_release_timer_thres_s1) {
LOG_I(RRC,"Removing UE %x instance Because of UE_CONTEXT_RELEASE_COMMAND not received after %d ms from sending request\n",
ue_context_p->ue_context.rnti, ue_context_p->ue_context.ue_release_timer_thres_s1);
ue_to_be_removed = ue_context_p;
break;
}
}
if (ue_context_p->ue_context.ue_release_timer_rrc>0) {
ue_context_p->ue_context.ue_release_timer_rrc++;
if (ue_context_p->ue_context.ue_release_timer_rrc >=
ue_context_p->ue_context.ue_release_timer_thres_rrc) {
LOG_I(RRC,"Removing UE %x instance After UE_CONTEXT_RELEASE_Complete\n", ue_context_p->ue_context.rnti);
ue_to_be_removed = ue_context_p;
break;
}
}
if (ue_context_p->ue_context.ue_reestablishment_timer>0) {
ue_context_p->ue_context.ue_reestablishment_timer++;
if (ue_context_p->ue_context.ue_reestablishment_timer >=
ue_context_p->ue_context.ue_reestablishment_timer_thres) {
LOG_I(RRC,"UE %d reestablishment_timer max\n",ue_context_p->ue_context.rnti);
ue_context_p->ue_context.ul_failure_timer = 20000;
ue_to_be_removed = ue_context_p;
ue_context_p->ue_context.ue_reestablishment_timer = 0;
break;
}
}
#endif
if (ue_context_p->ue_context.ue_release_timer>0) { if (ue_context_p->ue_context.ue_release_timer>0) {
ue_context_p->ue_context.ue_release_timer++; ue_context_p->ue_context.ue_release_timer++;
if (ue_context_p->ue_context.ue_release_timer >= if (ue_context_p->ue_context.ue_release_timer >=
...@@ -363,9 +399,17 @@ rrc_rx_tx( ...@@ -363,9 +399,17 @@ rrc_rx_tx(
} }
} }
} }
if (ue_to_be_removed) if (ue_to_be_removed) {
#ifdef UE_EXPANSION
if(ue_to_be_removed->ue_context.ul_failure_timer >= 8) {
ue_to_be_removed->ue_context.ue_release_timer_s1 = 1;
ue_to_be_removed->ue_context.ue_release_timer_thres_s1 = 100;
ue_to_be_removed->ue_context.ue_release_timer = 0;
ue_to_be_removed->ue_context.ue_reestablishment_timer = 0;
}
#endif
rrc_eNB_free_UE(ctxt_pP->module_id,ue_to_be_removed); rrc_eNB_free_UE(ctxt_pP->module_id,ue_to_be_removed);
}
#ifdef RRC_LOCALIZATION #ifdef RRC_LOCALIZATION
/* for the localization, only primary CC_id might be relevant*/ /* for the localization, only primary CC_id might be relevant*/
......
This diff is collapsed.
...@@ -1191,6 +1191,9 @@ int rrc_eNB_process_S1AP_UE_CONTEXT_RELEASE_COMMAND (MessageDef *msg_p, const ch ...@@ -1191,6 +1191,9 @@ int rrc_eNB_process_S1AP_UE_CONTEXT_RELEASE_COMMAND (MessageDef *msg_p, const ch
} }
return (-1); return (-1);
} else { } else {
#ifdef UE_EXPANSION
ue_context_p->ue_context.ue_release_timer_s1 = 0;
#endif
PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt, instance, ENB_FLAG_YES, ue_context_p->ue_context.rnti, 0, 0); PROTOCOL_CTXT_SET_BY_INSTANCE(&ctxt, instance, ENB_FLAG_YES, ue_context_p->ue_context.rnti, 0, 0);
rrc_eNB_generate_RRCConnectionRelease(&ctxt, ue_context_p); rrc_eNB_generate_RRCConnectionRelease(&ctxt, ue_context_p);
/* /*
......
...@@ -484,7 +484,11 @@ static int trx_usrp_write(openair0_device *device, openair0_timestamp timestamp, ...@@ -484,7 +484,11 @@ static int trx_usrp_write(openair0_device *device, openair0_timestamp timestamp,
s->tx_md.start_of_burst = false; s->tx_md.start_of_burst = false;
s->tx_md.end_of_burst = false; s->tx_md.end_of_burst = false;
} }
if(flags==10){ // fail safe mode
s->tx_md.has_time_spec = false;
s->tx_md.start_of_burst = false;
s->tx_md.end_of_burst = true;
}
if (cc>1) { if (cc>1) {
std::vector<void *> buff_ptrs; std::vector<void *> buff_ptrs;
for (int i=0; i<cc; i++) for (int i=0; i<cc; i++)
......
...@@ -667,6 +667,20 @@ void fh_if4p5_north_out(RU_t *ru) { ...@@ -667,6 +667,20 @@ void fh_if4p5_north_out(RU_t *ru) {
stop_meas(&ru->tx_fhaul); stop_meas(&ru->tx_fhaul);
} }
/* add fail safe for late command */
typedef enum {
STATE_BURST_NORMAL = 0,
STATE_BURST_TERMINATE = 1,
STATE_BURST_STOP_1 = 2,
STATE_BURST_STOP_2 = 3,
STATE_BURST_RESTART = 4,
} late_control_e;
volatile late_control_e late_control=STATE_BURST_NORMAL;
/* add fail safe for late command end */
void rx_rf(RU_t *ru,int *frame,int *subframe) { void rx_rf(RU_t *ru,int *frame,int *subframe) {
RU_proc_t *proc = &ru->proc; RU_proc_t *proc = &ru->proc;
...@@ -693,8 +707,12 @@ void rx_rf(RU_t *ru,int *frame,int *subframe) { ...@@ -693,8 +707,12 @@ void rx_rf(RU_t *ru,int *frame,int *subframe) {
proc->timestamp_rx = ts-ru->ts_offset; proc->timestamp_rx = ts-ru->ts_offset;
AssertFatal(rxs == fp->samples_per_tti, // AssertFatal(rxs == fp->samples_per_tti,
"rx_rf: Asked for %d samples, got %d from USRP\n",fp->samples_per_tti,rxs); // "rx_rf: Asked for %d samples, got %d from USRP\n",fp->samples_per_tti,rxs);
if(rxs != fp->samples_per_tti){
LOG_E(PHY,"rx_rf: Asked for %d samples, got %d from USRP\n",fp->samples_per_tti,rxs);
late_control=STATE_BURST_TERMINATE;
}
if (proc->first_rx == 1) { if (proc->first_rx == 1) {
ru->ts_offset = proc->timestamp_rx; ru->ts_offset = proc->timestamp_rx;
...@@ -750,8 +768,8 @@ void rx_rf(RU_t *ru,int *frame,int *subframe) { ...@@ -750,8 +768,8 @@ void rx_rf(RU_t *ru,int *frame,int *subframe) {
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TRX_TS, proc->timestamp_rx&0xffffffff ); VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TRX_TS, proc->timestamp_rx&0xffffffff );
if (rxs != fp->samples_per_tti) // if (rxs != fp->samples_per_tti)
exit_fun( "problem receiving samples" ); // exit_fun( "problem receiving samples" );
...@@ -802,7 +820,33 @@ void tx_rf(RU_t *ru) { ...@@ -802,7 +820,33 @@ void tx_rf(RU_t *ru) {
for (i=0; i<ru->nb_tx; i++) for (i=0; i<ru->nb_tx; i++)
txp[i] = (void*)&ru->common.txdata[i][(proc->subframe_tx*fp->samples_per_tti)-sf_extension]; txp[i] = (void*)&ru->common.txdata[i][(proc->subframe_tx*fp->samples_per_tti)-sf_extension];
/* add fail safe for late command */
if(late_control!=STATE_BURST_NORMAL){//stop burst
switch (late_control) {
case STATE_BURST_TERMINATE:
flags=10; // end of burst and no time spec
late_control=STATE_BURST_STOP_1;
break;
case STATE_BURST_STOP_1:
flags=0; // no send
late_control=STATE_BURST_STOP_2;
return;//no send
break;
case STATE_BURST_STOP_2:
flags=0; // no send
late_control=STATE_BURST_RESTART;
return;//no send
break;
case STATE_BURST_RESTART:
flags=2; // start burst
late_control=STATE_BURST_NORMAL;
break;
}
}
/* add fail safe for late command end */
VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TRX_TST, (proc->timestamp_tx-ru->openair0_cfg.tx_sample_advance)&0xffffffff ); VCD_SIGNAL_DUMPER_DUMP_VARIABLE_BY_NAME( VCD_SIGNAL_DUMPER_VARIABLES_TRX_TST, (proc->timestamp_tx-ru->openair0_cfg.tx_sample_advance)&0xffffffff );
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE, 1 ); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE, 1 );
...@@ -820,8 +864,11 @@ void tx_rf(RU_t *ru) { ...@@ -820,8 +864,11 @@ void tx_rf(RU_t *ru) {
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE, 0 ); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_TRX_WRITE, 0 );
AssertFatal(txs == siglen+sf_extension,"TX : Timeout (sent %d/%d)\n",txs, siglen); // AssertFatal(txs == siglen+sf_extension,"TX : Timeout (sent %d/%d)\n",txs, siglen);
if( (txs != siglen+sf_extension) && (late_control==STATE_BURST_NORMAL) ){ /* add fail safe for late command */
late_control=STATE_BURST_TERMINATE;
LOG_E(PHY,"TX : Timeout (sent %d/%d) state =%d\n",txs, siglen,late_control);
}
} }
} }
......
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