Commit e45a051c authored by Sakthivel Velumani's avatar Sakthivel Velumani

Perform CRC check for whole TB

parent 5c6778be
...@@ -51,15 +51,8 @@ ...@@ -51,15 +51,8 @@
#define OAI_UL_LDPC_MAX_NUM_LLR 27000//26112 // NR_LDPC_NCOL_BG1*NR_LDPC_ZMAX = 68*384 #define OAI_UL_LDPC_MAX_NUM_LLR 27000//26112 // NR_LDPC_NCOL_BG1*NR_LDPC_ZMAX = 68*384
//#define OAI_LDPC_MAX_NUM_LLR 27000//26112 // NR_LDPC_NCOL_BG1*NR_LDPC_ZMAX //#define OAI_LDPC_MAX_NUM_LLR 27000//26112 // NR_LDPC_NCOL_BG1*NR_LDPC_ZMAX
static uint64_t nb_total_decod =0;
static uint64_t nb_error_decod =0;
static extended_kpi_ue kpiStructure = {0}; static extended_kpi_ue kpiStructure = {0};
notifiedFIFO_t freeBlocks_dl;
notifiedFIFO_elt_t *msgToPush_dl;
int nbDlProcessing =0;
extended_kpi_ue* getKPIUE(void) { extended_kpi_ue* getKPIUE(void) {
return &kpiStructure; return &kpiStructure;
} }
...@@ -77,7 +70,7 @@ void nr_dlsch_unscrambling(int16_t *llr, uint32_t size, uint8_t q, uint32_t Nid, ...@@ -77,7 +70,7 @@ void nr_dlsch_unscrambling(int16_t *llr, uint32_t size, uint8_t q, uint32_t Nid,
nr_codeword_unscrambling(llr, size, q, Nid, n_RNTI); nr_codeword_unscrambling(llr, size, q, Nid, n_RNTI);
} }
bool nr_ue_postDecode(PHY_VARS_NR_UE *phy_vars_ue, notifiedFIFO_elt_t *req, bool last, notifiedFIFO_t *nf_p, int b_size, uint8_t b[b_size]) { bool nr_ue_postDecode(PHY_VARS_NR_UE *phy_vars_ue, notifiedFIFO_elt_t *req, bool last, notifiedFIFO_t *nf_p, int b_size, uint8_t b[b_size], int *num_seg_ok, UE_nr_rxtx_proc_t *proc) {
ldpcDecode_ue_t *rdata = (ldpcDecode_ue_t*) NotifiedFifoData(req); ldpcDecode_ue_t *rdata = (ldpcDecode_ue_t*) NotifiedFifoData(req);
NR_DL_UE_HARQ_t *harq_process = rdata->harq_process; NR_DL_UE_HARQ_t *harq_process = rdata->harq_process;
NR_UE_DLSCH_t *dlsch = (NR_UE_DLSCH_t *) rdata->dlsch; NR_UE_DLSCH_t *dlsch = (NR_UE_DLSCH_t *) rdata->dlsch;
...@@ -94,6 +87,7 @@ bool nr_ue_postDecode(PHY_VARS_NR_UE *phy_vars_ue, notifiedFIFO_elt_t *req, bool ...@@ -94,6 +87,7 @@ bool nr_ue_postDecode(PHY_VARS_NR_UE *phy_vars_ue, notifiedFIFO_elt_t *req, bool
harq_process->c[r], harq_process->c[r],
rdata->Kr_bytes - (harq_process->F>>3) -((harq_process->C>1)?3:0)); rdata->Kr_bytes - (harq_process->F>>3) -((harq_process->C>1)?3:0));
(*num_seg_ok)++;
} else { } else {
if ( !last ) { if ( !last ) {
int nb=abortTpoolJob(&get_nrUE_params()->Tpool, req->key); int nb=abortTpoolJob(&get_nrUE_params()->Tpool, req->key);
...@@ -111,7 +105,20 @@ bool nr_ue_postDecode(PHY_VARS_NR_UE *phy_vars_ue, notifiedFIFO_elt_t *req, bool ...@@ -111,7 +105,20 @@ bool nr_ue_postDecode(PHY_VARS_NR_UE *phy_vars_ue, notifiedFIFO_elt_t *req, bool
kpiStructure.dl_mcs = dlsch->dlsch_config.mcs; kpiStructure.dl_mcs = dlsch->dlsch_config.mcs;
kpiStructure.nofRBs = dlsch->dlsch_config.number_rbs; kpiStructure.nofRBs = dlsch->dlsch_config.number_rbs;
if (decodeSuccess) { if (*num_seg_ok == harq_process->C) {
if (harq_process->C > 1) {
/* check global CRC */
int A = dlsch->dlsch_config.TBS;
int crc_length = A > 3824 ? 3 : 2;
int crc_type = A > 3824 ? CRC24_A : CRC16;
if (!check_crc(b, A + crc_length*8, 0 /* F - unused */, crc_type)) {
harq_process->ack = 0;
dlsch->last_iteration_cnt = dlsch->max_ldpc_iterations + 1;
LOG_E(PHY, " Frame %d.%d LDPC global CRC fails, but individual LDPC CRC succeeded. %d segs\n", proc->frame_rx, proc->nr_slot_rx, harq_process->C);
LOG_D(PHY, "DLSCH received nok \n");
return true; //stop
}
}
//LOG_D(PHY,"[UE %d] DLSCH: Setting ACK for nr_slot_rx %d TBS %d mcs %d nb_rb %d harq_process->round %d\n", //LOG_D(PHY,"[UE %d] DLSCH: Setting ACK for nr_slot_rx %d TBS %d mcs %d nb_rb %d harq_process->round %d\n",
// phy_vars_ue->Mod_id,nr_slot_rx,harq_process->TBS,harq_process->mcs,harq_process->nb_rb, harq_process->round); // phy_vars_ue->Mod_id,nr_slot_rx,harq_process->TBS,harq_process->mcs,harq_process->nb_rb, harq_process->round);
harq_process->status = SCH_IDLE; harq_process->status = SCH_IDLE;
...@@ -277,7 +284,7 @@ void nr_processDLSegment(void* arg) { ...@@ -277,7 +284,7 @@ void nr_processDLSegment(void* arg) {
if (no_iteration_ldpc > dlsch->max_ldpc_iterations) if (no_iteration_ldpc > dlsch->max_ldpc_iterations)
no_iteration_ldpc = dlsch->max_ldpc_iterations; no_iteration_ldpc = dlsch->max_ldpc_iterations;
} else { } else {
LOG_D(PHY,"CRC NOT OK\n"); LOG_I(PHY,"%d.%d CRC NOT OK\n",rdata->proc->frame_rx,rdata->proc->nr_slot_rx);
no_iteration_ldpc = dlsch->max_ldpc_iterations + 1; no_iteration_ldpc = dlsch->max_ldpc_iterations + 1;
} }
...@@ -287,12 +294,6 @@ void nr_processDLSegment(void* arg) { ...@@ -287,12 +294,6 @@ void nr_processDLSegment(void* arg) {
rdata->decodeIterations = no_iteration_ldpc; rdata->decodeIterations = no_iteration_ldpc;
nb_total_decod++;
if (no_iteration_ldpc > dlsch->max_ldpc_iterations) {
nb_error_decod++;
}
for (int m=0; m < Kr>>3; m ++) { for (int m=0; m < Kr>>3; m ++) {
harq_process->c[r][m]= (uint8_t) llrProcBuf[m]; harq_process->c[r][m]= (uint8_t) llrProcBuf[m];
} }
...@@ -478,6 +479,7 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, ...@@ -478,6 +479,7 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
rdata->offset = offset; rdata->offset = offset;
rdata->dlsch = dlsch; rdata->dlsch = dlsch;
rdata->dlsch_id = 0; rdata->dlsch_id = 0;
rdata->proc = proc;
reset_meas(&rdata->ts_deinterleave); reset_meas(&rdata->ts_deinterleave);
reset_meas(&rdata->ts_rate_unmatch); reset_meas(&rdata->ts_rate_unmatch);
reset_meas(&rdata->ts_ldpc_decode); reset_meas(&rdata->ts_ldpc_decode);
...@@ -488,6 +490,7 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, ...@@ -488,6 +490,7 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
offset += (Kr_bytes - (harq_process->F>>3) - ((harq_process->C>1)?3:0)); offset += (Kr_bytes - (harq_process->F>>3) - ((harq_process->C>1)?3:0));
////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////
} }
int num_seg_ok = 0;
for (r=0; r<nbDecode; r++) { for (r=0; r<nbDecode; r++) {
notifiedFIFO_elt_t *req=pullTpool(&nf, &get_nrUE_params()->Tpool); notifiedFIFO_elt_t *req=pullTpool(&nf, &get_nrUE_params()->Tpool);
if (req == NULL) if (req == NULL)
...@@ -495,7 +498,7 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue, ...@@ -495,7 +498,7 @@ uint32_t nr_dlsch_decoding(PHY_VARS_NR_UE *phy_vars_ue,
bool last = false; bool last = false;
if (r == nbDecode - 1) if (r == nbDecode - 1)
last = true; last = true;
bool stop = nr_ue_postDecode(phy_vars_ue, req, last, &nf, b_size, b); bool stop = nr_ue_postDecode(phy_vars_ue, req, last, &nf, b_size, b, &num_seg_ok, proc);
delNotifiedFIFO_elt(req); delNotifiedFIFO_elt(req);
if (stop) if (stop)
break; break;
......
...@@ -709,6 +709,7 @@ typedef struct LDPCDecode_ue_s { ...@@ -709,6 +709,7 @@ typedef struct LDPCDecode_ue_s {
time_stats_t ts_deinterleave; time_stats_t ts_deinterleave;
time_stats_t ts_rate_unmatch; time_stats_t ts_rate_unmatch;
time_stats_t ts_ldpc_decode; time_stats_t ts_ldpc_decode;
UE_nr_rxtx_proc_t *proc;
} ldpcDecode_ue_t; } ldpcDecode_ue_t;
#include "SIMULATION/ETH_TRANSPORT/defs.h" #include "SIMULATION/ETH_TRANSPORT/defs.h"
......
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