Commit d32bb894 authored by francescomani's avatar francescomani Committed by Laurent THOMAS

MR2496 adapt NDI FAPI configuration to PUSCH and resetting TBS when new data

parent 20cd6d95
...@@ -304,6 +304,13 @@ static void configure_dlsch(NR_UE_DLSCH_t *dlsch0, ...@@ -304,6 +304,13 @@ static void configure_dlsch(NR_UE_DLSCH_t *dlsch0,
if ((dlsch_config_pdu->dmrs_ports>>i)&0x01) Nl += 1; if ((dlsch_config_pdu->dmrs_ports>>i)&0x01) Nl += 1;
} }
dlsch0->Nl = Nl; dlsch0->Nl = Nl;
if (dlsch_config_pdu->ndi) {
dlsch0_harq->first_rx = true;
dlsch0_harq->DLround = 0;
} else {
dlsch0_harq->first_rx = false;
dlsch0_harq->DLround++;
}
downlink_harq_process(dlsch0_harq, current_harq_pid, dlsch_config_pdu->ndi, dlsch_config_pdu->rv, dlsch0->rnti_type); downlink_harq_process(dlsch0_harq, current_harq_pid, dlsch_config_pdu->ndi, dlsch_config_pdu->rv, dlsch0->rnti_type);
if (dlsch0_harq->status != ACTIVE) { if (dlsch0_harq->status != ACTIVE) {
// dlsch0_harq->status not ACTIVE due to false retransmission // dlsch0_harq->status not ACTIVE due to false retransmission
......
...@@ -177,7 +177,6 @@ void downlink_harq_process(NR_DL_UE_HARQ_t *dl_harq, int harq_pid, int dci_ndi, ...@@ -177,7 +177,6 @@ void downlink_harq_process(NR_DL_UE_HARQ_t *dl_harq, int harq_pid, int dci_ndi,
dl_harq->status = ACTIVE; dl_harq->status = ACTIVE;
dl_harq->Ndi = dci_ndi; dl_harq->Ndi = dci_ndi;
//dl_harq->status = SCH_IDLE; }
}
} }
...@@ -504,6 +504,7 @@ typedef struct NR_UE_MAC_INST_s { ...@@ -504,6 +504,7 @@ typedef struct NR_UE_MAC_INST_s {
fapi_nr_csirs_measurements_t csirs_measurements; fapi_nr_csirs_measurements_t csirs_measurements;
/// Last NDI of UL HARQ processes /// Last NDI of UL HARQ processes
int DL_ndi[NR_MAX_HARQ_PROCESSES];
int UL_ndi[NR_MAX_HARQ_PROCESSES]; int UL_ndi[NR_MAX_HARQ_PROCESSES];
//// FAPI-like interface message //// FAPI-like interface message
fapi_nr_ul_config_request_t *ul_config_request; fapi_nr_ul_config_request_t *ul_config_request;
......
...@@ -106,8 +106,11 @@ void nr_ue_mac_default_configs(NR_UE_MAC_INST_t *mac) ...@@ -106,8 +106,11 @@ void nr_ue_mac_default_configs(NR_UE_MAC_INST_t *mac)
mac->scheduling_info.lc_sched_info[i].LCGID = 0; // defaults to 0 irrespective of SRB or DRB mac->scheduling_info.lc_sched_info[i].LCGID = 0; // defaults to 0 irrespective of SRB or DRB
mac->scheduling_info.lc_sched_info[i].LCID_status = false; mac->scheduling_info.lc_sched_info[i].LCID_status = false;
mac->scheduling_info.lc_sched_info[i].LCID_buffer_remain = 0; mac->scheduling_info.lc_sched_info[i].LCID_buffer_remain = 0;
for (int k = 0; k < NR_MAX_HARQ_PROCESSES; k++) }
mac->UL_ndi[k] = -1; // initialize to invalid value
for (int k = 0; k < NR_MAX_HARQ_PROCESSES; k++) {
mac->UL_ndi[k] = -1; // initialize to invalid value
mac->DL_ndi[k] = -1; // initialize to invalid value
} }
} }
......
...@@ -680,13 +680,30 @@ static int nr_ue_process_dci_dl_10(module_id_t module_id, ...@@ -680,13 +680,30 @@ static int nr_ue_process_dci_dl_10(module_id_t module_id,
/* MCS */ /* MCS */
dlsch_pdu->mcs = dci->mcs; dlsch_pdu->mcs = dci->mcs;
NR_UE_HARQ_STATUS_t *current_harq = &mac->dl_harq_info[dci->harq_pid];
/* NDI (only if CRC scrambled by C-RNTI or CS-RNTI or new-RNTI or TC-RNTI)*/
if (dl_conf_req->pdu_type == FAPI_NR_DL_CONFIG_TYPE_SI_DLSCH ||
dl_conf_req->pdu_type == FAPI_NR_DL_CONFIG_TYPE_RA_DLSCH ||
dci->ndi != mac->DL_ndi[dci->harq_pid]) {
// new data
dlsch_pdu->ndi = 1;
current_harq->R = 0;
current_harq->TBS = 0;
}
else
dlsch_pdu->ndi = 0;
if (dl_conf_req->pdu_type != FAPI_NR_DL_CONFIG_TYPE_SI_DLSCH &&
dl_conf_req->pdu_type != FAPI_NR_DL_CONFIG_TYPE_RA_DLSCH) {
mac->DL_ndi[dci->harq_pid] = dci->ndi;
}
dlsch_pdu->qamModOrder = nr_get_Qm_dl(dlsch_pdu->mcs, dlsch_pdu->mcs_table); dlsch_pdu->qamModOrder = nr_get_Qm_dl(dlsch_pdu->mcs, dlsch_pdu->mcs_table);
if (dlsch_pdu->qamModOrder == 0) { if (dlsch_pdu->qamModOrder == 0) {
LOG_W(MAC, "Invalid code rate or Mod order, likely due to unexpected DL DCI.\n"); LOG_W(MAC, "Invalid code rate or Mod order, likely due to unexpected DL DCI.\n");
return -1; return -1;
} }
NR_UE_HARQ_STATUS_t *current_harq = &mac->dl_harq_info[dci->harq_pid];
int R = nr_get_code_rate_dl(dlsch_pdu->mcs, dlsch_pdu->mcs_table); int R = nr_get_code_rate_dl(dlsch_pdu->mcs, dlsch_pdu->mcs_table);
if (R > 0) { if (R > 0) {
dlsch_pdu->targetCodeRate = R; dlsch_pdu->targetCodeRate = R;
...@@ -706,6 +723,11 @@ static int nr_ue_process_dci_dl_10(module_id_t module_id, ...@@ -706,6 +723,11 @@ static int nr_ue_process_dci_dl_10(module_id_t module_id,
1); 1);
// storing for possible retransmissions // storing for possible retransmissions
current_harq->R = dlsch_pdu->targetCodeRate; current_harq->R = dlsch_pdu->targetCodeRate;
if (dlsch_pdu->ndi == 0 && current_harq->TBS != dlsch_pdu->TBS) {
LOG_W(NR_MAC, "NDI indicates re-transmission but computed TBS %d doesn't match with what previously stored %d\n",
dlsch_pdu->TBS, current_harq->TBS);
dlsch_pdu->ndi = 1; // treated as new data
}
current_harq->TBS = dlsch_pdu->TBS; current_harq->TBS = dlsch_pdu->TBS;
} }
else { else {
...@@ -723,8 +745,6 @@ static int nr_ue_process_dci_dl_10(module_id_t module_id, ...@@ -723,8 +745,6 @@ static int nr_ue_process_dci_dl_10(module_id_t module_id,
int bw_tbslbrm = current_DL_BWP ? mac->sc_info.dl_bw_tbslbrm : dlsch_pdu->BWPSize; int bw_tbslbrm = current_DL_BWP ? mac->sc_info.dl_bw_tbslbrm : dlsch_pdu->BWPSize;
dlsch_pdu->tbslbrm = nr_compute_tbslbrm(dlsch_pdu->mcs_table, bw_tbslbrm, 1); dlsch_pdu->tbslbrm = nr_compute_tbslbrm(dlsch_pdu->mcs_table, bw_tbslbrm, 1);
/* NDI (only if CRC scrambled by C-RNTI or CS-RNTI or new-RNTI or TC-RNTI)*/
dlsch_pdu->ndi = dci->ndi;
/* RV (only if CRC scrambled by C-RNTI or CS-RNTI or new-RNTI or TC-RNTI)*/ /* RV (only if CRC scrambled by C-RNTI or CS-RNTI or new-RNTI or TC-RNTI)*/
dlsch_pdu->rv = dci->rv; dlsch_pdu->rv = dci->rv;
/* HARQ_PROCESS_NUMBER (only if CRC scrambled by C-RNTI or CS-RNTI or new-RNTI or TC-RNTI)*/ /* HARQ_PROCESS_NUMBER (only if CRC scrambled by C-RNTI or CS-RNTI or new-RNTI or TC-RNTI)*/
...@@ -965,7 +985,17 @@ static int nr_ue_process_dci_dl_11(module_id_t module_id, ...@@ -965,7 +985,17 @@ static int nr_ue_process_dci_dl_11(module_id_t module_id,
/* MCS (for transport block 1)*/ /* MCS (for transport block 1)*/
dlsch_pdu->mcs = dci->mcs; dlsch_pdu->mcs = dci->mcs;
/* NDI (for transport block 1)*/ /* NDI (for transport block 1)*/
dlsch_pdu->ndi = dci->ndi; NR_UE_HARQ_STATUS_t *current_harq = &mac->dl_harq_info[dci->harq_pid];
if (dci->ndi != mac->DL_ndi[dci->harq_pid]) {
// new data
dlsch_pdu->ndi = 1;
current_harq->R = 0;
current_harq->TBS = 0;
}
else {
dlsch_pdu->ndi = 0;
}
mac->DL_ndi[dci->harq_pid] = dci->ndi;
/* RV (for transport block 1)*/ /* RV (for transport block 1)*/
dlsch_pdu->rv = dci->rv; dlsch_pdu->rv = dci->rv;
/* MCS (for transport block 2)*/ /* MCS (for transport block 2)*/
...@@ -1128,7 +1158,6 @@ static int nr_ue_process_dci_dl_11(module_id_t module_id, ...@@ -1128,7 +1158,6 @@ static int nr_ue_process_dci_dl_11(module_id_t module_id,
nb_rb_oh = 0; nb_rb_oh = 0;
int nb_re_dmrs = ((dmrs_type == NULL) ? 6 : 4) * dlsch_pdu->n_dmrs_cdm_groups; int nb_re_dmrs = ((dmrs_type == NULL) ? 6 : 4) * dlsch_pdu->n_dmrs_cdm_groups;
NR_UE_HARQ_STATUS_t *current_harq = &mac->dl_harq_info[dci->harq_pid];
int R = nr_get_code_rate_dl(dlsch_pdu->mcs, dlsch_pdu->mcs_table); int R = nr_get_code_rate_dl(dlsch_pdu->mcs, dlsch_pdu->mcs_table);
if (R > 0) { if (R > 0) {
dlsch_pdu->targetCodeRate = R; dlsch_pdu->targetCodeRate = R;
...@@ -1141,6 +1170,11 @@ static int nr_ue_process_dci_dl_11(module_id_t module_id, ...@@ -1141,6 +1170,11 @@ static int nr_ue_process_dci_dl_11(module_id_t module_id,
0, 0,
Nl); Nl);
// storing for possible retransmissions // storing for possible retransmissions
if (dlsch_pdu->ndi == 0 && current_harq->TBS != dlsch_pdu->TBS) {
LOG_W(NR_MAC, "NDI indicates re-transmission but computed TBS %d doesn't match with what previously stored %d\n",
dlsch_pdu->TBS, current_harq->TBS);
dlsch_pdu->ndi = 1; // treated as new data
}
current_harq->R = dlsch_pdu->targetCodeRate; current_harq->R = dlsch_pdu->targetCodeRate;
current_harq->TBS = dlsch_pdu->TBS; current_harq->TBS = dlsch_pdu->TBS;
} }
......
...@@ -651,7 +651,12 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac, ...@@ -651,7 +651,12 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac,
} }
/* NDI */ /* NDI */
pusch_config_pdu->pusch_data.new_data_indicator = dci->ndi != mac->UL_ndi[dci->harq_pid] ? 1 : 0; pusch_config_pdu->pusch_data.new_data_indicator = 0;
if (dci->ndi != mac->UL_ndi[dci->harq_pid]) {
pusch_config_pdu->pusch_data.new_data_indicator = 1;
// if new data reset harq structure
memset(&mac->ul_harq_info[dci->harq_pid], 0, sizeof(mac->ul_harq_info[dci->harq_pid]));
}
mac->UL_ndi[dci->harq_pid] = dci->ndi; mac->UL_ndi[dci->harq_pid] = dci->ndi;
/* RV */ /* RV */
pusch_config_pdu->pusch_data.rv_index = dci->rv; pusch_config_pdu->pusch_data.rv_index = dci->rv;
......
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