fapi new data indicator as bool and storage of previous NDI value to HARQ structures
This commit is contained in:
@@ -240,9 +240,9 @@ typedef struct {
|
|||||||
|
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
uint8_t rv_index;
|
uint8_t rv_index;
|
||||||
uint8_t harq_process_id;
|
uint8_t harq_process_id;
|
||||||
uint8_t new_data_indicator;
|
bool new_data_indicator;
|
||||||
uint32_t tb_size;
|
uint32_t tb_size;
|
||||||
uint16_t num_cb;
|
uint16_t num_cb;
|
||||||
uint8_t cb_present_and_position[(NFAPI_UE_MAX_NUM_CB+7) / 8];
|
uint8_t cb_present_and_position[(NFAPI_UE_MAX_NUM_CB+7) / 8];
|
||||||
@@ -452,13 +452,13 @@ typedef struct {
|
|||||||
uint8_t rate_matching_ind;
|
uint8_t rate_matching_ind;
|
||||||
uint8_t zp_csi_rs_trigger;
|
uint8_t zp_csi_rs_trigger;
|
||||||
uint8_t mcs;
|
uint8_t mcs;
|
||||||
uint8_t ndi;
|
bool new_data_indicator;
|
||||||
uint8_t rv;
|
uint8_t rv;
|
||||||
uint16_t targetCodeRate;
|
uint16_t targetCodeRate;
|
||||||
uint8_t qamModOrder;
|
uint8_t qamModOrder;
|
||||||
uint32_t TBS;
|
uint32_t TBS;
|
||||||
uint8_t tb2_mcs;
|
uint8_t tb2_mcs;
|
||||||
uint8_t tb2_ndi;
|
bool tb2_new_data_indicator;
|
||||||
uint8_t tb2_rv;
|
uint8_t tb2_rv;
|
||||||
uint8_t harq_process_nbr;
|
uint8_t harq_process_nbr;
|
||||||
vrb_to_prb_mapping_t vrb_to_prb_mapping;
|
vrb_to_prb_mapping_t vrb_to_prb_mapping;
|
||||||
|
|||||||
@@ -104,8 +104,6 @@ typedef struct {
|
|||||||
typedef struct {
|
typedef struct {
|
||||||
/// Indicator of first reception
|
/// Indicator of first reception
|
||||||
uint8_t first_rx;
|
uint8_t first_rx;
|
||||||
/// Last Ndi received for this process on DCI (used for C-RNTI only)
|
|
||||||
uint8_t Ndi;
|
|
||||||
/// DLSCH status flag indicating
|
/// DLSCH status flag indicating
|
||||||
SCH_status_t status;
|
SCH_status_t status;
|
||||||
/// Transport block size
|
/// Transport block size
|
||||||
|
|||||||
@@ -311,14 +311,14 @@ 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) {
|
if (dlsch_config_pdu->new_data_indicator) {
|
||||||
dlsch0_harq->first_rx = true;
|
dlsch0_harq->first_rx = true;
|
||||||
dlsch0_harq->DLround = 0;
|
dlsch0_harq->DLround = 0;
|
||||||
} else {
|
} else {
|
||||||
dlsch0_harq->first_rx = false;
|
dlsch0_harq->first_rx = false;
|
||||||
dlsch0_harq->DLround++;
|
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->new_data_indicator, 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
|
||||||
// Reset the following flag to skip PDSCH procedures in that case and retrasmit harq status
|
// Reset the following flag to skip PDSCH procedures in that case and retrasmit harq status
|
||||||
|
|||||||
@@ -115,7 +115,6 @@ void init_downlink_harq_status(NR_DL_UE_HARQ_t *dl_harq)
|
|||||||
dl_harq->status = SCH_IDLE;
|
dl_harq->status = SCH_IDLE;
|
||||||
dl_harq->first_rx = 1;
|
dl_harq->first_rx = 1;
|
||||||
dl_harq->DLround = 0;
|
dl_harq->DLround = 0;
|
||||||
dl_harq->Ndi = 2; // set to an invalid value
|
|
||||||
dl_harq->ack = DL_ACKNACK_NO_SET;
|
dl_harq->ack = DL_ACKNACK_NO_SET;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -152,31 +151,9 @@ void downlink_harq_process(NR_DL_UE_HARQ_t *dl_harq, int harq_pid, int dci_ndi,
|
|||||||
rv,
|
rv,
|
||||||
dci_ndi,
|
dci_ndi,
|
||||||
rnti_type,
|
rnti_type,
|
||||||
dl_harq->Ndi != dci_ndi ? "yes" : "no");
|
dci_ndi ? "yes" : "no");
|
||||||
AssertFatal(rv<4 && rv>=0, "invalid redondancy version %d\n", rv);
|
AssertFatal(rv<4 && rv>=0, "invalid redondancy version %d\n", rv);
|
||||||
if (dci_ndi!=dl_harq->Ndi) {
|
|
||||||
if (dl_harq->ack == DL_NACK)
|
|
||||||
LOG_D(PHY,"New transmission on a harq pid (%d) never acknowledged\n", harq_pid);
|
|
||||||
else
|
|
||||||
LOG_D(PHY,"Starting new transmission on a harq pid (%d)\n", harq_pid);
|
|
||||||
} else {
|
|
||||||
if (dl_harq->ack != DL_NACK)
|
|
||||||
LOG_D(PHY,"gNB asked for retransmission even if we sent ACK\n");
|
|
||||||
else
|
|
||||||
LOG_D(PHY,"Starting retransmission on a harq pid (%d), rv (%d)\n", harq_pid, rv);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dci_ndi!=dl_harq->Ndi) {
|
|
||||||
dl_harq->first_rx = true;
|
|
||||||
dl_harq->DLround = 0;
|
|
||||||
} else {
|
|
||||||
dl_harq->first_rx = false;
|
|
||||||
dl_harq->DLround++;
|
|
||||||
}
|
|
||||||
|
|
||||||
dl_harq->status = ACTIVE;
|
dl_harq->status = ACTIVE;
|
||||||
|
|
||||||
dl_harq->Ndi = dci_ndi;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -348,11 +348,13 @@ typedef struct {
|
|||||||
int8_t delta_pucch;
|
int8_t delta_pucch;
|
||||||
uint32_t R;
|
uint32_t R;
|
||||||
uint32_t TBS;
|
uint32_t TBS;
|
||||||
|
int last_ndi;
|
||||||
} NR_UE_HARQ_STATUS_t;
|
} NR_UE_HARQ_STATUS_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint32_t R;
|
uint32_t R;
|
||||||
uint32_t TBS;
|
uint32_t TBS;
|
||||||
|
int last_ndi;
|
||||||
} NR_UL_HARQ_INFO_t;
|
} NR_UL_HARQ_INFO_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@@ -499,9 +501,6 @@ typedef struct {
|
|||||||
/// measurements from CSI-RS
|
/// measurements from CSI-RS
|
||||||
fapi_nr_csirs_measurements_t csirs_measurements;
|
fapi_nr_csirs_measurements_t csirs_measurements;
|
||||||
|
|
||||||
/// Last NDI of UL HARQ processes
|
|
||||||
int DL_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;
|
||||||
fapi_nr_dl_config_request_t *dl_config_request;
|
fapi_nr_dl_config_request_t *dl_config_request;
|
||||||
|
|||||||
@@ -80,6 +80,10 @@ void nr_ue_init_mac(module_id_t module_idP)
|
|||||||
memset(&mac->ssb_list[i], 0, sizeof(mac->ssb_list[i]));
|
memset(&mac->ssb_list[i], 0, sizeof(mac->ssb_list[i]));
|
||||||
memset(&mac->prach_assoc_pattern[i], 0, sizeof(mac->prach_assoc_pattern[i]));
|
memset(&mac->prach_assoc_pattern[i], 0, sizeof(mac->prach_assoc_pattern[i]));
|
||||||
}
|
}
|
||||||
|
for (int k = 0; k < NR_MAX_HARQ_PROCESSES; k++) {
|
||||||
|
mac->ul_harq_info[k].last_ndi = -1; // initialize to invalid value
|
||||||
|
mac->dl_harq_info[k].last_ndi = -1; // initialize to invalid value
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void nr_ue_mac_default_configs(NR_UE_MAC_INST_t *mac)
|
void nr_ue_mac_default_configs(NR_UE_MAC_INST_t *mac)
|
||||||
@@ -107,11 +111,6 @@ void nr_ue_mac_default_configs(NR_UE_MAC_INST_t *mac)
|
|||||||
mac->scheduling_info.lc_sched_info[i].LCID_status = LCID_EMPTY;
|
mac->scheduling_info.lc_sched_info[i].LCID_status = LCID_EMPTY;
|
||||||
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
|
|
||||||
mac->DL_ndi[k] = -1; // initialize to invalid value
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NR_UE_MAC_INST_t *nr_l2_init_ue(int nb_inst)
|
NR_UE_MAC_INST_t *nr_l2_init_ue(int nb_inst)
|
||||||
@@ -147,6 +146,7 @@ void reset_mac_inst(NR_UE_MAC_INST_t *nr_mac)
|
|||||||
// MAC reset according to 38.321 Section 5.12
|
// MAC reset according to 38.321 Section 5.12
|
||||||
|
|
||||||
nr_ue_mac_default_configs(nr_mac);
|
nr_ue_mac_default_configs(nr_mac);
|
||||||
|
|
||||||
// initialize Bj for each logical channel to zero
|
// initialize Bj for each logical channel to zero
|
||||||
// Done in default config but to -1 (is that correct?)
|
// Done in default config but to -1 (is that correct?)
|
||||||
|
|
||||||
@@ -158,7 +158,7 @@ void reset_mac_inst(NR_UE_MAC_INST_t *nr_mac)
|
|||||||
|
|
||||||
// set the NDIs for all uplink HARQ processes to the value 0
|
// set the NDIs for all uplink HARQ processes to the value 0
|
||||||
for (int k = 0; k < NR_MAX_HARQ_PROCESSES; k++)
|
for (int k = 0; k < NR_MAX_HARQ_PROCESSES; k++)
|
||||||
nr_mac->UL_ndi[k] = -1; // initialize to invalid value
|
nr_mac->ul_harq_info[k].last_ndi = -1; // initialize to invalid value
|
||||||
|
|
||||||
// stop any ongoing RACH procedure
|
// stop any ongoing RACH procedure
|
||||||
if (nr_mac->ra.ra_state < RA_SUCCEEDED)
|
if (nr_mac->ra.ra_state < RA_SUCCEEDED)
|
||||||
@@ -184,7 +184,8 @@ void reset_mac_inst(NR_UE_MAC_INST_t *nr_mac)
|
|||||||
memset(&nr_mac->dl_harq_info[k], 0, sizeof(NR_UE_HARQ_STATUS_t));
|
memset(&nr_mac->dl_harq_info[k], 0, sizeof(NR_UE_HARQ_STATUS_t));
|
||||||
|
|
||||||
// for each DL HARQ process, consider the next received transmission for a TB as the very first transmission
|
// for each DL HARQ process, consider the next received transmission for a TB as the very first transmission
|
||||||
// TODO there is nothing in the MAC indicating first transmission
|
for (int k = 0; k < NR_MAX_HARQ_PROCESSES; k++)
|
||||||
|
nr_mac->dl_harq_info[k].last_ndi = -1; // initialize to invalid value
|
||||||
|
|
||||||
// release, if any, Temporary C-RNTI
|
// release, if any, Temporary C-RNTI
|
||||||
nr_mac->ra.t_crnti = 0;
|
nr_mac->ra.t_crnti = 0;
|
||||||
|
|||||||
@@ -676,18 +676,18 @@ static int nr_ue_process_dci_dl_10(module_id_t module_id,
|
|||||||
/* NDI (only if CRC scrambled by C-RNTI or CS-RNTI or new-RNTI or TC-RNTI)*/
|
/* 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 ||
|
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 ||
|
dl_conf_req->pdu_type == FAPI_NR_DL_CONFIG_TYPE_RA_DLSCH ||
|
||||||
dci->ndi != mac->DL_ndi[dci->harq_pid]) {
|
dci->ndi != current_harq->last_ndi) {
|
||||||
// new data
|
// new data
|
||||||
dlsch_pdu->ndi = 1;
|
dlsch_pdu->new_data_indicator = true;
|
||||||
current_harq->R = 0;
|
current_harq->R = 0;
|
||||||
current_harq->TBS = 0;
|
current_harq->TBS = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
dlsch_pdu->ndi = 0;
|
dlsch_pdu->new_data_indicator = false;
|
||||||
|
|
||||||
if (dl_conf_req->pdu_type != FAPI_NR_DL_CONFIG_TYPE_SI_DLSCH &&
|
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) {
|
dl_conf_req->pdu_type != FAPI_NR_DL_CONFIG_TYPE_RA_DLSCH) {
|
||||||
mac->DL_ndi[dci->harq_pid] = dci->ndi;
|
current_harq->last_ndi = 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);
|
||||||
@@ -715,10 +715,10 @@ 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) {
|
if (!dlsch_pdu->new_data_indicator && 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",
|
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->TBS, current_harq->TBS);
|
||||||
dlsch_pdu->ndi = 1; // treated as new data
|
dlsch_pdu->new_data_indicator = true; // treated as new data
|
||||||
}
|
}
|
||||||
current_harq->TBS = dlsch_pdu->TBS;
|
current_harq->TBS = dlsch_pdu->TBS;
|
||||||
}
|
}
|
||||||
@@ -817,7 +817,7 @@ static int nr_ue_process_dci_dl_10(module_id_t module_id,
|
|||||||
"scaling_factor_S=%f\n>>> tpc_pucch=%d\n>>> pucch_res_ind=%d\n>>> pdsch_to_harq_feedback_time_ind=%d\n",
|
"scaling_factor_S=%f\n>>> tpc_pucch=%d\n>>> pucch_res_ind=%d\n>>> pdsch_to_harq_feedback_time_ind=%d\n",
|
||||||
dlsch_pdu->vrb_to_prb_mapping,
|
dlsch_pdu->vrb_to_prb_mapping,
|
||||||
dlsch_pdu->mcs,
|
dlsch_pdu->mcs,
|
||||||
dlsch_pdu->ndi,
|
dlsch_pdu->new_data_indicator,
|
||||||
dlsch_pdu->rv,
|
dlsch_pdu->rv,
|
||||||
dlsch_pdu->harq_process_nbr,
|
dlsch_pdu->harq_process_nbr,
|
||||||
dci->dai[0].val,
|
dci->dai[0].val,
|
||||||
@@ -976,22 +976,22 @@ static int nr_ue_process_dci_dl_11(module_id_t module_id,
|
|||||||
dlsch_pdu->mcs = dci->mcs;
|
dlsch_pdu->mcs = dci->mcs;
|
||||||
/* NDI (for transport block 1)*/
|
/* NDI (for transport block 1)*/
|
||||||
NR_UE_HARQ_STATUS_t *current_harq = &mac->dl_harq_info[dci->harq_pid];
|
NR_UE_HARQ_STATUS_t *current_harq = &mac->dl_harq_info[dci->harq_pid];
|
||||||
if (dci->ndi != mac->DL_ndi[dci->harq_pid]) {
|
if (dci->ndi != current_harq->last_ndi) {
|
||||||
// new data
|
// new data
|
||||||
dlsch_pdu->ndi = 1;
|
dlsch_pdu->new_data_indicator = true;
|
||||||
current_harq->R = 0;
|
current_harq->R = 0;
|
||||||
current_harq->TBS = 0;
|
current_harq->TBS = 0;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
dlsch_pdu->ndi = 0;
|
dlsch_pdu->new_data_indicator = false;
|
||||||
}
|
}
|
||||||
mac->DL_ndi[dci->harq_pid] = dci->ndi;
|
current_harq->last_ndi = 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)*/
|
||||||
dlsch_pdu->tb2_mcs = dci->mcs2.val;
|
dlsch_pdu->tb2_mcs = dci->mcs2.val;
|
||||||
/* NDI (for transport block 2)*/
|
/* NDI (for transport block 2)*/
|
||||||
dlsch_pdu->tb2_ndi = dci->ndi2.val;
|
dlsch_pdu->tb2_new_data_indicator = dci->ndi2.val;
|
||||||
/* RV (for transport block 2)*/
|
/* RV (for transport block 2)*/
|
||||||
dlsch_pdu->tb2_rv = dci->rv2.val;
|
dlsch_pdu->tb2_rv = dci->rv2.val;
|
||||||
/* HARQ_PROCESS_NUMBER */
|
/* HARQ_PROCESS_NUMBER */
|
||||||
@@ -1160,10 +1160,10 @@ 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) {
|
if (!dlsch_pdu->new_data_indicator && 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",
|
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->TBS, current_harq->TBS);
|
||||||
dlsch_pdu->ndi = 1; // treated as new data
|
dlsch_pdu->new_data_indicator = true; // 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;
|
||||||
|
|||||||
@@ -627,13 +627,14 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* NDI */
|
/* NDI */
|
||||||
pusch_config_pdu->pusch_data.new_data_indicator = 0;
|
NR_UL_HARQ_INFO_t *harq = &mac->ul_harq_info[dci->harq_pid];
|
||||||
if (dci->ndi != mac->UL_ndi[dci->harq_pid]) {
|
pusch_config_pdu->pusch_data.new_data_indicator = false;
|
||||||
pusch_config_pdu->pusch_data.new_data_indicator = 1;
|
if (dci->ndi != harq->last_ndi) {
|
||||||
|
pusch_config_pdu->pusch_data.new_data_indicator = true;
|
||||||
// if new data reset harq structure
|
// if new data reset harq structure
|
||||||
memset(&mac->ul_harq_info[dci->harq_pid], 0, sizeof(mac->ul_harq_info[dci->harq_pid]));
|
memset(harq, 0, sizeof(*harq));
|
||||||
}
|
}
|
||||||
mac->UL_ndi[dci->harq_pid] = dci->ndi;
|
harq->last_ndi = dci->ndi;
|
||||||
/* RV */
|
/* RV */
|
||||||
pusch_config_pdu->pusch_data.rv_index = dci->rv;
|
pusch_config_pdu->pusch_data.rv_index = dci->rv;
|
||||||
/* HARQ_PROCESS_NUMBER */
|
/* HARQ_PROCESS_NUMBER */
|
||||||
|
|||||||
Reference in New Issue
Block a user