fix encoding error in mbms by regrouping the missing barrier at a single level

tmp
This commit is contained in:
Laurent Thomas
2022-09-20 13:49:43 +02:00
committed by laurent
parent af04fa90c1
commit 5087982997
10 changed files with 92 additions and 199 deletions
+33 -64
View File
@@ -245,43 +245,6 @@ void *te_thread(void *param) {
return(NULL);
}
int dlsch_encoding_all(PHY_VARS_eNB *eNB,
L1_rxtx_proc_t *proc,
unsigned char *a,
uint8_t num_pdcch_symbols,
LTE_eNB_DLSCH_t *dlsch,
int frame,
uint8_t subframe,
time_stats_t *rm_stats,
time_stats_t *te_stats,
time_stats_t *te_wait_stats,
time_stats_t *te_main_stats,
time_stats_t *te_wakeup_stats0,
time_stats_t *te_wakeup_stats1,
time_stats_t *i_stats) {
uint8_t harq_pid = dlsch->harq_ids[frame%2][subframe];
if(harq_pid >= dlsch->Mdlharq) {
LOG_E(PHY,"dlsch_encoding_all illegal harq_pid %d\n", harq_pid);
return(-1);
}
LOG_D(PHY,"B %d, harq_pid %d\n",
dlsch->harq_processes[harq_pid]->B,
dlsch->harq_ids[frame%2][subframe]);
return dlsch_encoding(eNB,
proc,
a,
num_pdcch_symbols,
dlsch,
frame,
subframe,
rm_stats,
te_stats,
i_stats);
}
static void TPencode(void * arg) {
turboEncode_t * rdata=(turboEncode_t *) arg;
unsigned char harq_pid = rdata->harq_pid;
@@ -358,8 +321,7 @@ int dlsch_encoding(PHY_VARS_eNB *eNB,
num_pdcch_symbols,
frame,subframe,beamforming_mode);
proc->nbEncode=0;
int nbEncode = 0;
// if (hadlsch->Ndi == 1) { // this is a new packet
if (hadlsch->round == 0) { // this is a new packet
@@ -386,11 +348,13 @@ int dlsch_encoding(PHY_VARS_eNB *eNB,
&hadlsch->F)<0)
return(-1);
}
notifiedFIFO_t respEncode;
initNotifiedFIFO(&respEncode);
for (int r=0, r_offset=0; r<hadlsch->C; r++) {
union turboReqUnion id= {.s={dlsch->rnti,frame,subframe,r,0}};
notifiedFIFO_elt_t *req=newNotifiedFIFO_elt(sizeof(turboEncode_t), id.p, proc->respEncode, TPencode);
notifiedFIFO_elt_t *req = newNotifiedFIFO_elt(sizeof(turboEncode_t), id.p, &respEncode, TPencode);
turboEncode_t * rdata=(turboEncode_t *) NotifiedFifoData(req);
rdata->input=hadlsch->c[r];
rdata->Kr_bytes= ( r<hadlsch->Cminus ? hadlsch->Kminus : hadlsch->Kplus) >>3;
@@ -404,15 +368,10 @@ int dlsch_encoding(PHY_VARS_eNB *eNB,
rdata->round=hadlsch->round;
rdata->r_offset=r_offset;
rdata->G=G;
if ( proc->threadPool->activated ) {
pushTpool(proc->threadPool,req);
proc->nbEncode++;
} else {
TPencode(rdata);
delNotifiedFIFO_elt(req);
}
pushTpool(proc->threadPool, req);
nbEncode++;
int Qm=hadlsch->Qm;
int C=hadlsch->C;
int Nl=hadlsch->Nl;
@@ -423,6 +382,14 @@ int dlsch_encoding(PHY_VARS_eNB *eNB,
else
r_offset += Nl*Qm * ((GpmodC==0?0:1) + (Gp/C));
}
// Wait all other threads finish to process
while (nbEncode) {
notifiedFIFO_elt_t *res = pullTpool(&respEncode, proc->threadPool);
if (res == NULL)
break; // Tpool has been stopped
delNotifiedFIFO_elt(res);
nbEncode--;
}
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_ENB_DLSCH_ENCODING, VCD_FUNCTION_OUT);
return(0);
}
@@ -462,8 +429,6 @@ int dlsch_encoding_fembms_pmch(PHY_VARS_eNB *eNB,
num_pdcch_symbols,
frame,subframe,beamforming_mode);
proc->nbEncode=0;
// if (hadlsch->Ndi == 1) { // this is a new packet
if (hadlsch->round == 0) { // this is a new packet
// Add 24-bit crc (polynomial A) to payload
@@ -489,11 +454,13 @@ int dlsch_encoding_fembms_pmch(PHY_VARS_eNB *eNB,
&hadlsch->F)<0)
return(-1);
}
int nbEncode = 0;
notifiedFIFO_t respEncode;
initNotifiedFIFO(&respEncode);
for (int r=0, r_offset=0; r<hadlsch->C; r++) {
union turboReqUnion id= {.s={dlsch->rnti,frame,subframe,r,0}};
notifiedFIFO_elt_t *req=newNotifiedFIFO_elt(sizeof(turboEncode_t), id.p, proc->respEncode, TPencode);
notifiedFIFO_elt_t *req = newNotifiedFIFO_elt(sizeof(turboEncode_t), id.p, &respEncode, TPencode);
turboEncode_t * rdata=(turboEncode_t *) NotifiedFifoData(req);
rdata->input=hadlsch->c[r];
rdata->Kr_bytes= ( r<hadlsch->Cminus ? hadlsch->Kminus : hadlsch->Kplus) >>3;
@@ -507,15 +474,10 @@ int dlsch_encoding_fembms_pmch(PHY_VARS_eNB *eNB,
rdata->round=hadlsch->round;
rdata->r_offset=r_offset;
rdata->G=G;
if ( proc->threadPool->activated ) {
pushTpool(proc->threadPool,req);
proc->nbEncode++;
} else {
TPencode(rdata);
delNotifiedFIFO_elt(req);
}
pushTpool(proc->threadPool, req);
nbEncode++;
int Qm=hadlsch->Qm;
int C=hadlsch->C;
int Nl=hadlsch->Nl;
@@ -526,7 +488,14 @@ int dlsch_encoding_fembms_pmch(PHY_VARS_eNB *eNB,
else
r_offset += Nl*Qm * ((GpmodC==0?0:1) + (Gp/C));
}
// Wait all other threads finish to process
while (nbEncode) {
notifiedFIFO_elt_t *res = pullTpool(&respEncode, proc->threadPool);
if (res == NULL)
break; // Tpool has been stopped
delNotifiedFIFO_elt(res);
nbEncode--;
}
return(0);
}