Commit 48aa1f03 authored by Laurent THOMAS's avatar Laurent THOMAS Committed by laurent

improve code of dci decoding and add tracing for all dci fields

parent bb58ffd7
...@@ -497,6 +497,7 @@ int logInit (void) ...@@ -497,6 +497,7 @@ int logInit (void)
register_log_component("GNB_APP","log",GNB_APP); register_log_component("GNB_APP","log",GNB_APP);
register_log_component("NR_RRC","log",NR_RRC); register_log_component("NR_RRC","log",NR_RRC);
register_log_component("NR_MAC","log",NR_MAC); register_log_component("NR_MAC","log",NR_MAC);
register_log_component("NR_DCI", "log", NR_DCI);
register_log_component("NR_PHY","log",NR_PHY); register_log_component("NR_PHY","log",NR_PHY);
register_log_component("NGAP","",NGAP); register_log_component("NGAP","",NGAP);
register_log_component("ITTI","log",ITTI); register_log_component("ITTI","log",ITTI);
......
...@@ -215,6 +215,7 @@ typedef enum { ...@@ -215,6 +215,7 @@ typedef enum {
GNB_APP, GNB_APP,
NR_RRC, NR_RRC,
NR_MAC, NR_MAC,
NR_DCI,
NR_PHY, NR_PHY,
LOADER, LOADER,
ASN1, ASN1,
...@@ -223,8 +224,7 @@ typedef enum { ...@@ -223,8 +224,7 @@ typedef enum {
ITTI, ITTI,
UTIL, UTIL,
MAX_LOG_PREDEF_COMPONENTS, MAX_LOG_PREDEF_COMPONENTS,
} } comp_name_t;
comp_name_t;
#define MAX_LOG_DYNALLOC_COMPONENTS 20 #define MAX_LOG_DYNALLOC_COMPONENTS 20
#define MAX_LOG_COMPONENTS (MAX_LOG_PREDEF_COMPONENTS + MAX_LOG_DYNALLOC_COMPONENTS) #define MAX_LOG_COMPONENTS (MAX_LOG_PREDEF_COMPONENTS + MAX_LOG_DYNALLOC_COMPONENTS)
......
...@@ -361,6 +361,27 @@ ID = LEGACY_NR_MAC_TRACE ...@@ -361,6 +361,27 @@ ID = LEGACY_NR_MAC_TRACE
GROUP = ALL:LEGACY_NR_MAC:LEGACY_GROUP_TRACE:LEGACY GROUP = ALL:LEGACY_NR_MAC:LEGACY_GROUP_TRACE:LEGACY
FORMAT = string,log FORMAT = string,log
ID = LEGACY_NR_DCI_INFO
DESC = NR_MAC legacy logs - info level
GROUP = ALL:LEGACY_NR_MAC:LEGACY_GROUP_INFO:LEGACY
FORMAT = string,log
ID = LEGACY_NR_DCI_ERROR
DESC = NR_MAC legacy logs - error level
GROUP = ALL:LEGACY_NR_MAC:LEGACY_GROUP_ERROR:LEGACY
FORMAT = string,log
ID = LEGACY_NR_DCI_WARNING
DESC = NR_MAC legacy logs - warning level
GROUP = ALL:LEGACY_NR_MAC:LEGACY_GROUP_WARNING:LEGACY
FORMAT = string,log
ID = LEGACY_NR_DCI_DEBUG
DESC = NR_MAC legacy logs - debug level
GROUP = ALL:LEGACY_NR_MAC:LEGACY_GROUP_DEBUG:LEGACY
FORMAT = string,log
ID = LEGACY_NR_DCI_TRACE
DESC = NR_MAC legacy logs - trace level
GROUP = ALL:LEGACY_NR_MAC:LEGACY_GROUP_TRACE:LEGACY
FORMAT = string,log
ID = LEGACY_PHY_INFO ID = LEGACY_PHY_INFO
DESC = PHY legacy logs - info level DESC = PHY legacy logs - info level
GROUP = ALL:LEGACY_PHY:LEGACY_GROUP_INFO:LEGACY GROUP = ALL:LEGACY_PHY:LEGACY_GROUP_INFO:LEGACY
......
...@@ -716,16 +716,14 @@ static uint16_t nr_dci_false_detection(uint64_t *dci, ...@@ -716,16 +716,14 @@ static uint16_t nr_dci_false_detection(uint64_t *dci,
return x; return x;
} }
uint8_t nr_dci_decoding_procedure(PHY_VARS_NR_UE *ue, void nr_dci_decoding_procedure(PHY_VARS_NR_UE *ue,
const UE_nr_rxtx_proc_t *proc, const UE_nr_rxtx_proc_t *proc,
c16_t *pdcch_e_rx, c16_t *pdcch_e_rx,
fapi_nr_dci_indication_t *dci_ind, fapi_nr_dci_indication_t *dci_ind,
fapi_nr_dl_config_dci_dl_pdu_rel15_t *rel15) fapi_nr_dl_config_dci_dl_pdu_rel15_t *rel15)
{ {
//int gNB_id = 0;
int16_t tmp_e[16*108];
rnti_t n_rnti;
int e_rx_cand_idx = 0; int e_rx_cand_idx = 0;
*dci_ind = (fapi_nr_dci_indication_t){.SFN = proc->frame_rx, .slot = proc->nr_slot_rx};
for (int j=0;j<rel15->number_of_candidates;j++) { for (int j=0;j<rel15->number_of_candidates;j++) {
int CCEind = rel15->CCE[j]; int CCEind = rel15->CCE[j];
...@@ -736,15 +734,13 @@ uint8_t nr_dci_decoding_procedure(PHY_VARS_NR_UE *ue, ...@@ -736,15 +734,13 @@ uint8_t nr_dci_decoding_procedure(PHY_VARS_NR_UE *ue,
for (int k = 0; k < rel15->num_dci_options; k++) { for (int k = 0; k < rel15->num_dci_options; k++) {
// skip this candidate if we've already found one with the // skip this candidate if we've already found one with the
// same rnti and format at a different aggregation level // same rnti and format at a different aggregation level
int dci_found=0; int ind;
for (int ind=0;ind < dci_ind->number_of_dcis ; ind++) { for (ind = 0; ind < dci_ind->number_of_dcis; ind++) {
if (rel15->rnti== dci_ind->dci_list[ind].rnti && if (rel15->rnti == dci_ind->dci_list[ind].rnti && rel15->dci_format_options[k] == dci_ind->dci_list[ind].dci_format) {
rel15->dci_format_options[k]==dci_ind->dci_list[ind].dci_format) {
dci_found=1;
break; break;
} }
} }
if (dci_found == 1) if (ind < dci_ind->number_of_dcis)
continue; continue;
int dci_length = rel15->dci_length_options[k]; int dci_length = rel15->dci_length_options[k];
uint64_t dci_estimation[2]= {0}; uint64_t dci_estimation[2]= {0};
...@@ -752,46 +748,47 @@ uint8_t nr_dci_decoding_procedure(PHY_VARS_NR_UE *ue, ...@@ -752,46 +748,47 @@ uint8_t nr_dci_decoding_procedure(PHY_VARS_NR_UE *ue,
LOG_D(PHY, "(%i.%i) Trying DCI candidate %d of %d number of candidates, CCE %d (%d), L %d, length %d, format %s\n", LOG_D(PHY, "(%i.%i) Trying DCI candidate %d of %d number of candidates, CCE %d (%d), L %d, length %d, format %s\n",
proc->frame_rx, proc->nr_slot_rx, j, rel15->number_of_candidates, CCEind, e_rx_cand_idx, L, dci_length, nr_dci_format_string[rel15->dci_format_options[k]]); proc->frame_rx, proc->nr_slot_rx, j, rel15->number_of_candidates, CCEind, e_rx_cand_idx, L, dci_length, nr_dci_format_string[rel15->dci_format_options[k]]);
int16_t tmp_e[16 * 108];
nr_pdcch_unscrambling(&pdcch_e_rx[e_rx_cand_idx], rel15->coreset.scrambling_rnti, L*108, rel15->coreset.pdcch_dmrs_scrambling_id, tmp_e); nr_pdcch_unscrambling(&pdcch_e_rx[e_rx_cand_idx], rel15->coreset.scrambling_rnti, L*108, rel15->coreset.pdcch_dmrs_scrambling_id, tmp_e);
// this polar version decodes 64 bits max, dci_estimation[1] will never be filled
uint16_t crc = polar_decoder_int16(tmp_e, uint16_t crc = polar_decoder_int16(tmp_e,
dci_estimation, dci_estimation,
1, 1,
NR_POLAR_DCI_MESSAGE_TYPE, dci_length, L); NR_POLAR_DCI_MESSAGE_TYPE, dci_length, L);
n_rnti = rel15->rnti; rnti_t n_rnti = rel15->rnti;
LOG_D(PHY, LOG_D(PHY,
"(%i.%i) dci indication (rnti %x,dci format %s,n_CCE %d,payloadSize %d,payload %llx )\n", "(%i.%i) dci indication (rnti %x,dci format %s,n_CCE %d,payloadSize %d,payload %lx, is rnti: %d )\n",
proc->frame_rx, proc->frame_rx,
proc->nr_slot_rx, proc->nr_slot_rx,
n_rnti, n_rnti,
nr_dci_format_string[rel15->dci_format_options[k]], nr_dci_format_string[rel15->dci_format_options[k]],
CCEind, CCEind,
dci_length, dci_length,
*(unsigned long long *)dci_estimation); dci_estimation[0],
crc == n_rnti);
if (crc == n_rnti) { if (crc == n_rnti) {
LOG_D(PHY, "(%i.%i) Received dci indication (rnti %x,dci format %s,n_CCE %d,payloadSize %d,payload %llx)\n",
proc->frame_rx, proc->nr_slot_rx,n_rnti,nr_dci_format_string[rel15->dci_format_options[k]],CCEind,dci_length,*(unsigned long long*)dci_estimation);
uint16_t mb = nr_dci_false_detection(dci_estimation,tmp_e,L*108,n_rnti, NR_POLAR_DCI_MESSAGE_TYPE, dci_length, L); uint16_t mb = nr_dci_false_detection(dci_estimation,tmp_e,L*108,n_rnti, NR_POLAR_DCI_MESSAGE_TYPE, dci_length, L);
ue->dci_thres = (ue->dci_thres + mb) / 2; ue->dci_thres = (ue->dci_thres + mb) / 2;
if (mb > (ue->dci_thres+30)) { if (mb > (ue->dci_thres+30)) {
LOG_W(PHY,"DCI false positive. Dropping DCI index %d. Mismatched bits: %d/%d. Current DCI threshold: %d\n",j,mb,L*108,ue->dci_thres); LOG_W(PHY,"DCI false positive. Dropping DCI index %d. Mismatched bits: %d/%d. Current DCI threshold: %d\n",j,mb,L*108,ue->dci_thres);
continue; continue;
} else { } else {
dci_ind->SFN = proc->frame_rx; AssertFatal(dci_ind->number_of_dcis < sizeofArray(dci_ind->dci_list), "Fix allocation\n");
dci_ind->slot = proc->nr_slot_rx; fapi_nr_dci_indication_pdu_t *dci = dci_ind->dci_list + dci_ind->number_of_dcis;
dci_ind->dci_list[dci_ind->number_of_dcis].rnti = n_rnti; *dci = (fapi_nr_dci_indication_pdu_t){
dci_ind->dci_list[dci_ind->number_of_dcis].n_CCE = CCEind; .rnti = n_rnti,
dci_ind->dci_list[dci_ind->number_of_dcis].N_CCE = L; .n_CCE = CCEind,
dci_ind->dci_list[dci_ind->number_of_dcis].dci_format = rel15->dci_format_options[k]; .N_CCE = L,
dci_ind->dci_list[dci_ind->number_of_dcis].ss_type = rel15->ss_type_options[k]; .dci_format = rel15->dci_format_options[k],
dci_ind->dci_list[dci_ind->number_of_dcis].coreset_type = rel15->coreset.CoreSetType; .ss_type = rel15->ss_type_options[k],
.coreset_type = rel15->coreset.CoreSetType,
};
int n_rb, rb_offset; int n_rb, rb_offset;
get_coreset_rballoc(rel15->coreset.frequency_domain_resource, &n_rb, &rb_offset); get_coreset_rballoc(rel15->coreset.frequency_domain_resource, &n_rb, &rb_offset);
dci_ind->dci_list[dci_ind->number_of_dcis].cset_start = rel15->BWPStart + rb_offset; dci->cset_start = rel15->BWPStart + rb_offset;
dci_ind->dci_list[dci_ind->number_of_dcis].payloadSize = dci_length; dci->payloadSize = dci_length;
memcpy((void*)dci_ind->dci_list[dci_ind->number_of_dcis].payloadBits,(void*)dci_estimation,8); memcpy(dci->payloadBits, dci_estimation, (dci_length + 7) / 8);
dci_ind->number_of_dcis++; dci_ind->number_of_dcis++;
break; // If DCI is found, no need to check for remaining DCI lengths break; // If DCI is found, no need to check for remaining DCI lengths
} }
...@@ -801,5 +798,4 @@ uint8_t nr_dci_decoding_procedure(PHY_VARS_NR_UE *ue, ...@@ -801,5 +798,4 @@ uint8_t nr_dci_decoding_procedure(PHY_VARS_NR_UE *ue,
} }
e_rx_cand_idx += 9 * L * 6; // e_rx index for next candidate (L CCEs, 6 REGs per CCE and 9 REs per REG ) e_rx_cand_idx += 9 * L * 6; // e_rx index for next candidate (L CCEs, 6 REGs per CCE and 9 REs per REG )
} }
return(dci_ind->number_of_dcis);
} }
...@@ -361,7 +361,7 @@ void nr_sl_rf_card_config_freq(PHY_VARS_NR_UE *ue, ...@@ -361,7 +361,7 @@ void nr_sl_rf_card_config_freq(PHY_VARS_NR_UE *ue,
openair0_config_t *openair0_cfg, openair0_config_t *openair0_cfg,
int freq_offset); int freq_offset);
uint8_t nr_dci_decoding_procedure(PHY_VARS_NR_UE *ue, void nr_dci_decoding_procedure(PHY_VARS_NR_UE *ue,
const UE_nr_rxtx_proc_t *proc, const UE_nr_rxtx_proc_t *proc,
c16_t *pdcch_e_rx, c16_t *pdcch_e_rx,
fapi_nr_dci_indication_t *dci_ind, fapi_nr_dci_indication_t *dci_ind,
......
...@@ -433,9 +433,6 @@ int nr_ue_pdcch_procedures(PHY_VARS_NR_UE *ue, ...@@ -433,9 +433,6 @@ int nr_ue_pdcch_procedures(PHY_VARS_NR_UE *ue,
{ {
int frame_rx = proc->frame_rx; int frame_rx = proc->frame_rx;
int nr_slot_rx = proc->nr_slot_rx; int nr_slot_rx = proc->nr_slot_rx;
unsigned int dci_cnt=0;
fapi_nr_dci_indication_t dci_ind = {0};
nr_downlink_indication_t dl_indication;
NR_UE_PDCCH_CONFIG *phy_pdcch_config = &phy_data->phy_pdcch_config; NR_UE_PDCCH_CONFIG *phy_pdcch_config = &phy_data->phy_pdcch_config;
fapi_nr_dl_config_dci_dl_pdu_rel15_t *rel15 = &phy_pdcch_config->pdcch_config[n_ss]; fapi_nr_dl_config_dci_dl_pdu_rel15_t *rel15 = &phy_pdcch_config->pdcch_config[n_ss];
...@@ -446,37 +443,24 @@ int nr_ue_pdcch_procedures(PHY_VARS_NR_UE *ue, ...@@ -446,37 +443,24 @@ int nr_ue_pdcch_procedures(PHY_VARS_NR_UE *ue,
int32_t pdcch_e_rx_size = NR_MAX_PDCCH_SIZE; int32_t pdcch_e_rx_size = NR_MAX_PDCCH_SIZE;
c16_t pdcch_e_rx[pdcch_e_rx_size]; c16_t pdcch_e_rx[pdcch_e_rx_size];
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RX_PDCCH, VCD_FUNCTION_IN);
nr_rx_pdcch(ue, proc, pdcch_est_size, pdcch_dl_ch_estimates, pdcch_e_rx, rel15, rxdataF); nr_rx_pdcch(ue, proc, pdcch_est_size, pdcch_dl_ch_estimates, pdcch_e_rx, rel15, rxdataF);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_RX_PDCCH, VCD_FUNCTION_OUT);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DCI_DECODING, VCD_FUNCTION_IN); fapi_nr_dci_indication_t dci_ind;
nr_dci_decoding_procedure(ue, proc, pdcch_e_rx, &dci_ind, rel15);
#ifdef NR_PDCCH_SCHED_DEBUG
printf("<-NR_PDCCH_PHY_PROCEDURES_LTE_UE (nr_ue_pdcch_procedures)-> Entering function nr_dci_decoding_procedure for search space %d)\n",
n_ss);
#endif
dci_cnt = nr_dci_decoding_procedure(ue, proc, pdcch_e_rx, &dci_ind, rel15);
#ifdef NR_PDCCH_SCHED_DEBUG
LOG_I(PHY,"<-NR_PDCCH_PHY_PROCEDURES_LTE_UE (nr_ue_pdcch_procedures)-> Ending function nr_dci_decoding_procedure() -> dci_cnt=%u\n",dci_cnt);
#endif
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_DCI_DECODING, VCD_FUNCTION_OUT); for (int i = 0; i < dci_ind.number_of_dcis; i++) {
LOG_D(PHY,
for (int i=0; i<dci_cnt; i++) { "[UE %d] AbsSubFrame %d.%d: DCI %i of %d total DCIs found --> rnti %x : format %d\n",
LOG_D(PHY,"[UE %d] AbsSubFrame %d.%d: DCI %i of %d total DCIs found --> rnti %x : format %d\n", ue->Mod_id,
ue->Mod_id,frame_rx%1024,nr_slot_rx, frame_rx % 1024,
nr_slot_rx,
i + 1, i + 1,
dci_cnt, dci_ind.number_of_dcis,
dci_ind.dci_list[i].rnti, dci_ind.dci_list[i].rnti,
dci_ind.dci_list[i].dci_format); dci_ind.dci_list[i].dci_format);
} }
dci_ind.number_of_dcis = dci_cnt; nr_downlink_indication_t dl_indication;
// fill dl_indication message // fill dl_indication message
nr_fill_dl_indication(&dl_indication, &dci_ind, NULL, proc, ue, phy_data); nr_fill_dl_indication(&dl_indication, &dci_ind, NULL, proc, ue, phy_data);
// send to mac // send to mac
...@@ -485,7 +469,7 @@ int nr_ue_pdcch_procedures(PHY_VARS_NR_UE *ue, ...@@ -485,7 +469,7 @@ int nr_ue_pdcch_procedures(PHY_VARS_NR_UE *ue,
stop_meas(&ue->dlsch_rx_pdcch_stats); stop_meas(&ue->dlsch_rx_pdcch_stats);
VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_PDCCH_PROCEDURES, VCD_FUNCTION_OUT); VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME(VCD_SIGNAL_DUMPER_FUNCTIONS_UE_PDCCH_PROCEDURES, VCD_FUNCTION_OUT);
return(dci_cnt); return (dci_ind.number_of_dcis);
} }
static int nr_ue_pdsch_procedures(PHY_VARS_NR_UE *ue, static int nr_ue_pdsch_procedures(PHY_VARS_NR_UE *ue,
......
...@@ -495,7 +495,7 @@ int nr_ue_pusch_scheduler(const NR_UE_MAC_INST_t *mac, ...@@ -495,7 +495,7 @@ int nr_ue_pusch_scheduler(const NR_UE_MAC_INST_t *mac,
int *slot_tx, int *slot_tx,
const long k2); const long k2);
int get_rnti_type(NR_UE_MAC_INST_t *mac, uint16_t rnti); int get_rnti_type(const NR_UE_MAC_INST_t *mac, const uint16_t rnti);
// Configuration of Msg3 PDU according to clauses: // Configuration of Msg3 PDU according to clauses:
// - 8.3 of 3GPP TS 38.213 version 16.3.0 Release 16 // - 8.3 of 3GPP TS 38.213 version 16.3.0 Release 16
......
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