Merge branch 'develop' of https://gitlab.eurecom.fr/oai/openairinterface5g into develop
This commit is contained in:
@@ -1102,8 +1102,12 @@ int generate_eNB_dlsch_params_from_dci(int frame,
|
||||
|
||||
dlsch[0]->harq_ids[subframe] = harq_pid;
|
||||
|
||||
if (dlsch0_harq->round == 0)
|
||||
if (dlsch0_harq->round == 0) {
|
||||
/* necessary test? */
|
||||
if (dlsch0_harq->status == SCH_IDLE)
|
||||
remove_harq_pid_from_freelist(dlsch[0], harq_pid);
|
||||
dlsch0_harq->status = ACTIVE;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
@@ -1237,6 +1241,9 @@ int generate_eNB_dlsch_params_from_dci(int frame,
|
||||
|
||||
|
||||
if (dlsch0_harq->round == 0) {
|
||||
/* necessary test? */
|
||||
if (dlsch0_harq->status == SCH_IDLE)
|
||||
remove_harq_pid_from_freelist(dlsch[0], harq_pid);
|
||||
dlsch0_harq->status = ACTIVE;
|
||||
// printf("Setting DLSCH process %d to ACTIVE\n",harq_pid);
|
||||
// MCS and TBS don't change across HARQ rounds
|
||||
@@ -1605,10 +1612,16 @@ int generate_eNB_dlsch_params_from_dci(int frame,
|
||||
|
||||
// reset HARQ process if this is the first transmission
|
||||
if (dlsch0_harq->round == 0) {
|
||||
/* necessary test? */
|
||||
if (dlsch0_harq->status == SCH_IDLE)
|
||||
remove_harq_pid_from_freelist(dlsch0, harq_pid);
|
||||
dlsch0_harq->status = ACTIVE;
|
||||
}
|
||||
|
||||
if (dlsch1_harq->round == 0) {
|
||||
/* necessary test? */
|
||||
if (dlsch1_harq->status == SCH_IDLE)
|
||||
remove_harq_pid_from_freelist(dlsch1, harq_pid);
|
||||
dlsch1_harq->status = ACTIVE;
|
||||
}
|
||||
|
||||
@@ -1986,10 +1999,16 @@ int generate_eNB_dlsch_params_from_dci(int frame,
|
||||
|
||||
// reset HARQ process if this is the first transmission
|
||||
if ((dlsch0->active==1) && (dlsch0_harq->round == 0)) {
|
||||
/* necessary test? */
|
||||
if (dlsch0_harq->status == SCH_IDLE)
|
||||
remove_harq_pid_from_freelist(dlsch0, harq_pid);
|
||||
dlsch0_harq->status = ACTIVE;
|
||||
}
|
||||
|
||||
if ((dlsch1->active==1) && (dlsch1_harq->round == 0)) {
|
||||
/* necessary test? */
|
||||
if (dlsch1_harq->status == SCH_IDLE)
|
||||
remove_harq_pid_from_freelist(dlsch1, harq_pid);
|
||||
dlsch1_harq->status = ACTIVE;
|
||||
}
|
||||
|
||||
@@ -2131,16 +2150,23 @@ int generate_eNB_dlsch_params_from_dci(int frame,
|
||||
// check if either TB is disabled (see 36-213 V8.6 p. 26)
|
||||
|
||||
|
||||
if ((dlsch0_harq->rvidx == 1) && (dlsch0_harq->mcs == 0))
|
||||
if ((dlsch0_harq->rvidx == 1) && (dlsch0_harq->mcs == 0)) {
|
||||
LOG_W(PHY, "what to do with respect to remove_harq_pid_from_freelist?\n");
|
||||
dlsch0_harq->status = DISABLED;
|
||||
}
|
||||
|
||||
if ((dlsch1_harq->rvidx == 1) && (dlsch1_harq->mcs == 0))
|
||||
if ((dlsch1_harq->rvidx == 1) && (dlsch1_harq->mcs == 0)) {
|
||||
LOG_W(PHY, "what to do with respect to remove_harq_pid_from_freelist?\n");
|
||||
dlsch1_harq->status = DISABLED;
|
||||
}
|
||||
|
||||
dlsch0_harq->Nl = 1;
|
||||
|
||||
|
||||
if (dlsch0_harq->round == 0) {
|
||||
/* necessary test? */
|
||||
if (dlsch0_harq->status == SCH_IDLE)
|
||||
remove_harq_pid_from_freelist(dlsch0, harq_pid);
|
||||
dlsch0_harq->status = ACTIVE;
|
||||
// printf("Setting DLSCH process %d to ACTIVE\n",harq_pid);
|
||||
}
|
||||
@@ -2305,11 +2331,17 @@ int generate_eNB_dlsch_params_from_dci(int frame,
|
||||
|
||||
|
||||
if ((dlsch0_harq->round == 0) && (dlsch0->active == 1) ) {
|
||||
/* necessary test? */
|
||||
if (dlsch0_harq->status == SCH_IDLE)
|
||||
remove_harq_pid_from_freelist(dlsch0, harq_pid);
|
||||
dlsch0_harq->status = ACTIVE;
|
||||
dlsch0_harq->mcs = mcs1;
|
||||
}
|
||||
|
||||
if ((dlsch1_harq->round == 0) && (dlsch1->active == 1) ) {
|
||||
/* necessary test? */
|
||||
if (dlsch1_harq->status == SCH_IDLE)
|
||||
remove_harq_pid_from_freelist(dlsch1, harq_pid);
|
||||
dlsch1_harq->status = ACTIVE;
|
||||
dlsch1_harq->mcs = mcs2;
|
||||
}
|
||||
@@ -2473,6 +2505,9 @@ int generate_eNB_dlsch_params_from_dci(int frame,
|
||||
|
||||
|
||||
if (dlsch0_harq->round == 0) {
|
||||
/* necessary test? */
|
||||
if (dlsch0_harq->status == SCH_IDLE)
|
||||
remove_harq_pid_from_freelist(dlsch0, harq_pid);
|
||||
dlsch0_harq->status = ACTIVE;
|
||||
// printf("Setting DLSCH process %d to ACTIVE\n",harq_pid);
|
||||
}
|
||||
@@ -2602,6 +2637,9 @@ int generate_eNB_dlsch_params_from_dci(int frame,
|
||||
|
||||
// dlsch0_harq->Ndi = ((DCI1E_5MHz_2A_M10PRB_TDD_t *)dci_pdu)->ndi;
|
||||
if (dlsch0_harq->round == 0) {
|
||||
/* necessary test? */
|
||||
if (dlsch0_harq->status == SCH_IDLE)
|
||||
remove_harq_pid_from_freelist(dlsch0, harq_pid);
|
||||
dlsch0_harq->status = ACTIVE;
|
||||
// printf("Setting DLSCH process %d to ACTIVE\n",harq_pid);
|
||||
}
|
||||
|
||||
@@ -258,6 +258,13 @@ typedef struct {
|
||||
uint8_t error_threshold;
|
||||
/// Pointers to 8 HARQ processes for the DLSCH
|
||||
LTE_DL_eNB_HARQ_t *harq_processes[8];
|
||||
/// circular list of free harq PIDs (the oldest come first)
|
||||
/// (10 is arbitrary value, must be > to max number of DL HARQ processes in LTE)
|
||||
int harq_pid_freelist[10];
|
||||
/// the head position of the free list (if list is free then head=tail)
|
||||
int head_freelist;
|
||||
/// the tail position of the free list
|
||||
int tail_freelist;
|
||||
/// Number of soft channel bits
|
||||
uint32_t G;
|
||||
/// Codebook index for this dlsch (0,1,2,3)
|
||||
|
||||
@@ -152,6 +152,9 @@ LTE_eNB_DLSCH_t *new_eNB_dlsch(unsigned char Kmimo,unsigned char Mdlharq,unsigne
|
||||
for (i=0; i<10; i++)
|
||||
dlsch->harq_ids[i] = Mdlharq;
|
||||
|
||||
dlsch->head_freelist = 0;
|
||||
dlsch->tail_freelist = 0;
|
||||
|
||||
for (i=0; i<Mdlharq; i++) {
|
||||
dlsch->harq_processes[i] = (LTE_DL_eNB_HARQ_t *)malloc16(sizeof(LTE_DL_eNB_HARQ_t));
|
||||
LOG_T(PHY, "Required mem size %d (bw scaling %d), dlsch->harq_processes[%d] %p\n",
|
||||
@@ -192,6 +195,8 @@ LTE_eNB_DLSCH_t *new_eNB_dlsch(unsigned char Kmimo,unsigned char Mdlharq,unsigne
|
||||
msg("Can't get harq_p %d\n",i);
|
||||
exit_flag=3;
|
||||
}
|
||||
|
||||
put_harq_pid_in_freelist(dlsch, i);
|
||||
}
|
||||
|
||||
if (exit_flag==0) {
|
||||
|
||||
@@ -401,6 +401,8 @@ uint16_t get_Np(uint8_t N_RB_DL,uint8_t nCCE,uint8_t plus1);
|
||||
|
||||
int get_nCCE_offset(unsigned char L, int nCCE, int common_dci, unsigned short rnti, unsigned char subframe);
|
||||
|
||||
void put_harq_pid_in_freelist(LTE_eNB_DLSCH_t *DLSCH_ptr, int harq_pid);
|
||||
void remove_harq_pid_from_freelist(LTE_eNB_DLSCH_t *DLSCH_ptr, int harq_pid);
|
||||
|
||||
int8_t find_ue(uint16_t rnti, PHY_VARS_eNB *phy_vars_eNB);
|
||||
int32_t add_ue(int16_t rnti, PHY_VARS_eNB *phy_vars_eNB);
|
||||
|
||||
@@ -136,6 +136,30 @@ uint8_t is_SR_subframe(PHY_VARS_eNB *phy_vars_eNB,uint8_t UE_id,uint8_t sched_su
|
||||
return(0);
|
||||
}
|
||||
|
||||
void put_harq_pid_in_freelist(LTE_eNB_DLSCH_t *DLSCH_ptr, int harq_pid)
|
||||
{
|
||||
DLSCH_ptr->harq_pid_freelist[DLSCH_ptr->tail_freelist] = harq_pid;
|
||||
DLSCH_ptr->tail_freelist = (DLSCH_ptr->tail_freelist + 1) % 10;
|
||||
}
|
||||
|
||||
void remove_harq_pid_from_freelist(LTE_eNB_DLSCH_t *DLSCH_ptr, int harq_pid)
|
||||
{
|
||||
if (DLSCH_ptr->head_freelist == DLSCH_ptr->tail_freelist) {
|
||||
LOG_E(PHY, "%s:%d: you cannot read this!\n", __FILE__, __LINE__);
|
||||
abort();
|
||||
}
|
||||
/* basic check, in case several threads deal with the free list at the same time
|
||||
* in normal situations it should not happen, that's also why we don't use any
|
||||
* locking mechanism to protect the free list
|
||||
* to be refined in case things don't work properly
|
||||
*/
|
||||
if (harq_pid != DLSCH_ptr->harq_pid_freelist[DLSCH_ptr->head_freelist]) {
|
||||
LOG_E(PHY, "%s:%d: critical error, get in touch with the authors\n", __FILE__, __LINE__);
|
||||
abort();
|
||||
}
|
||||
DLSCH_ptr->head_freelist = (DLSCH_ptr->head_freelist + 1) % 10;
|
||||
}
|
||||
|
||||
int32_t add_ue(int16_t rnti, PHY_VARS_eNB *phy_vars_eNB)
|
||||
{
|
||||
uint8_t i;
|
||||
@@ -178,6 +202,7 @@ int32_t add_ue(int16_t rnti, PHY_VARS_eNB *phy_vars_eNB)
|
||||
int32_t remove_ue(uint16_t rnti, PHY_VARS_eNB *phy_vars_eNB, uint8_t abstraction_flag)
|
||||
{
|
||||
uint8_t i;
|
||||
int j;
|
||||
|
||||
for (i=0; i<NUMBER_OF_UE_MAX; i++) {
|
||||
if ((phy_vars_eNB->dlsch_eNB[i]==NULL) || (phy_vars_eNB->ulsch_eNB[i]==NULL)) {
|
||||
@@ -196,6 +221,13 @@ int32_t remove_ue(uint16_t rnti, PHY_VARS_eNB *phy_vars_eNB, uint8_t abstraction
|
||||
//phy_vars_eNB->eNB_UE_stats[i].crnti = 0;
|
||||
memset(&phy_vars_eNB->eNB_UE_stats[i],0,sizeof(LTE_eNB_UE_stats));
|
||||
// mac_exit_wrapper("Removing UE");
|
||||
|
||||
/* clear the harq pid freelist */
|
||||
phy_vars_eNB->dlsch_eNB[i][0]->head_freelist = 0;
|
||||
phy_vars_eNB->dlsch_eNB[i][0]->tail_freelist = 0;
|
||||
for (j = 0; j < 8; j++)
|
||||
put_harq_pid_in_freelist(phy_vars_eNB->dlsch_eNB[i][0], j);
|
||||
|
||||
return(i);
|
||||
}
|
||||
}
|
||||
@@ -224,14 +256,12 @@ int8_t find_next_ue_index(PHY_VARS_eNB *phy_vars_eNB)
|
||||
|
||||
int get_ue_active_harq_pid(const uint8_t Mod_id,const uint8_t CC_id,const uint16_t rnti, const int frame, const uint8_t subframe,uint8_t *harq_pid,uint8_t *round,const uint8_t ul_flag)
|
||||
{
|
||||
|
||||
LTE_eNB_DLSCH_t *DLSCH_ptr;
|
||||
LTE_eNB_ULSCH_t *ULSCH_ptr;
|
||||
uint8_t ulsch_subframe,ulsch_frame;
|
||||
uint8_t i;
|
||||
int8_t UE_id = find_ue(rnti,PHY_vars_eNB_g[Mod_id][CC_id]);
|
||||
int sf1=(10*frame)+subframe,sf2,sfdiff,sfdiff_max=7;
|
||||
int first_proc_found=0;
|
||||
|
||||
if (UE_id==-1) {
|
||||
LOG_D(PHY,"Cannot find UE with rnti %x (Mod_id %d, CC_id %d)\n",rnti, Mod_id, CC_id);
|
||||
@@ -247,18 +277,7 @@ int get_ue_active_harq_pid(const uint8_t Mod_id,const uint8_t CC_id,const uint16
|
||||
|
||||
for (i=0; i<DLSCH_ptr->Mdlharq; i++) {
|
||||
if (DLSCH_ptr->harq_processes[i]!=NULL) {
|
||||
if (DLSCH_ptr->harq_processes[i]->status != ACTIVE) {
|
||||
// store first inactive process
|
||||
if (first_proc_found == 0) {
|
||||
first_proc_found = 1;
|
||||
*harq_pid = i;
|
||||
*round = 0;
|
||||
LOG_D(PHY,"process %d is first free process\n",i);
|
||||
}
|
||||
else {
|
||||
LOG_D(PHY,"process %d is free\n",i);
|
||||
}
|
||||
} else {
|
||||
if (DLSCH_ptr->harq_processes[i]->status == ACTIVE) {
|
||||
sf2 = (DLSCH_ptr->harq_processes[i]->frame*10) + DLSCH_ptr->harq_processes[i]->subframe;
|
||||
if (sf2<=sf1)
|
||||
sfdiff = sf1-sf2;
|
||||
@@ -270,7 +289,6 @@ int get_ue_active_harq_pid(const uint8_t Mod_id,const uint8_t CC_id,const uint16
|
||||
sfdiff_max = sfdiff;
|
||||
*harq_pid = i;
|
||||
*round = DLSCH_ptr->harq_processes[i]->round;
|
||||
first_proc_found = 1;
|
||||
}
|
||||
}
|
||||
} else { // a process is not defined
|
||||
@@ -278,6 +296,14 @@ int get_ue_active_harq_pid(const uint8_t Mod_id,const uint8_t CC_id,const uint16
|
||||
return(-1);
|
||||
}
|
||||
}
|
||||
|
||||
/* if no active harq pid, get the oldest in the freelist, if any */
|
||||
if (*harq_pid == 255 && DLSCH_ptr->head_freelist != DLSCH_ptr->tail_freelist) {
|
||||
*harq_pid = DLSCH_ptr->harq_pid_freelist[DLSCH_ptr->head_freelist];
|
||||
*round = 0;
|
||||
LOG_D(PHY,"process %d is first free process\n", *harq_pid);
|
||||
}
|
||||
|
||||
LOG_D(PHY,"get_ue_active_harq_pid DL => Frame %d, Subframe %d : harq_pid %d\n",
|
||||
frame,subframe,*harq_pid);
|
||||
} else { // This is a UL request
|
||||
@@ -296,7 +322,6 @@ int get_ue_active_harq_pid(const uint8_t Mod_id,const uint8_t CC_id,const uint16
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
int CCE_table[800];
|
||||
|
||||
void init_nCCE_table(void)
|
||||
@@ -2868,6 +2893,7 @@ void process_HARQ_feedback(uint8_t UE_id,
|
||||
dlsch_harq_proc->round = 0;
|
||||
ue_stats->dlsch_l2_errors[dl_harq_pid[m]]++;
|
||||
dlsch_harq_proc->status = SCH_IDLE;
|
||||
put_harq_pid_in_freelist(dlsch, dl_harq_pid[m]);
|
||||
dlsch->harq_ids[dl_subframe] = dlsch->Mdlharq;
|
||||
}
|
||||
} else {
|
||||
@@ -2880,6 +2906,7 @@ void process_HARQ_feedback(uint8_t UE_id,
|
||||
// Received ACK so set round to 0 and set dlsch_harq_pid IDLE
|
||||
dlsch_harq_proc->round = 0;
|
||||
dlsch_harq_proc->status = SCH_IDLE;
|
||||
put_harq_pid_in_freelist(dlsch, dl_harq_pid[m]);
|
||||
dlsch->harq_ids[dl_subframe] = dlsch->Mdlharq;
|
||||
|
||||
ue_stats->total_TBS = ue_stats->total_TBS +
|
||||
@@ -3949,6 +3976,9 @@ void phy_procedures_eNB_RX(const unsigned char sched_subframe,PHY_VARS_eNB *phy_
|
||||
phy_vars_eNB->eNB_UE_stats[i].sr_received++;
|
||||
|
||||
if (phy_vars_eNB->first_sr[i] == 1) { // this is the first request for uplink after Connection Setup, so clear HARQ process 0 use for Msg4
|
||||
/* is this test necessary? */
|
||||
if (phy_vars_eNB->dlsch_eNB[i][0]->harq_processes[0]->status != SCH_IDLE)
|
||||
put_harq_pid_in_freelist(phy_vars_eNB->dlsch_eNB[i][0], 0);
|
||||
phy_vars_eNB->first_sr[i] = 0;
|
||||
phy_vars_eNB->dlsch_eNB[i][0]->harq_processes[0]->round=0;
|
||||
phy_vars_eNB->dlsch_eNB[i][0]->harq_processes[0]->status=SCH_IDLE;
|
||||
|
||||
Reference in New Issue
Block a user