Commit 6f481e09 authored by francescomani's avatar francescomani

abort rtx if RI decreased

parent 12a23fb1
...@@ -365,6 +365,18 @@ void nr_store_dlsch_buffer(module_id_t module_id, ...@@ -365,6 +365,18 @@ void nr_store_dlsch_buffer(module_id_t module_id,
} }
} }
void abort_nr_dl_harq(NR_UE_info_t* UE, int8_t harq_pid) {
NR_UE_sched_ctrl_t *sched_ctrl = &UE->UE_sched_ctrl;
NR_UE_harq_t *harq = &sched_ctrl->harq_processes[harq_pid];
harq->ndi ^= 1;
harq->round = 0;
UE->mac_stats.dl.errors++;
add_tail_nr_list(&sched_ctrl->available_dl_harq, harq_pid);
}
bool allocate_dl_retransmission(module_id_t module_id, bool allocate_dl_retransmission(module_id_t module_id,
frame_t frame, frame_t frame,
sub_frame_t slot, sub_frame_t slot,
...@@ -378,6 +390,16 @@ bool allocate_dl_retransmission(module_id_t module_id, ...@@ -378,6 +390,16 @@ bool allocate_dl_retransmission(module_id_t module_id,
NR_UE_sched_ctrl_t *sched_ctrl = &UE->UE_sched_ctrl; NR_UE_sched_ctrl_t *sched_ctrl = &UE->UE_sched_ctrl;
NR_sched_pdsch_t *retInfo = &sched_ctrl->harq_processes[current_harq_pid].sched_pdsch; NR_sched_pdsch_t *retInfo = &sched_ctrl->harq_processes[current_harq_pid].sched_pdsch;
NR_CellGroupConfig_t *cg = UE->CellGroup; NR_CellGroupConfig_t *cg = UE->CellGroup;
NR_pdsch_semi_static_t *ps = &sched_ctrl->pdsch_semi_static;
//TODO remove this and handle retransmission with old nrOfLayers
// once ps structure is removed
if(ps->nrOfLayers < retInfo->nrOfLayers) {
LOG_W(NR_MAC,"Cannot schedule retransmission. RI changed from %d to %d\n",
retInfo->nrOfLayers, ps->nrOfLayers);
abort_nr_dl_harq(UE, current_harq_pid);
return false;
}
NR_BWP_DownlinkDedicated_t *bwpd = NR_BWP_DownlinkDedicated_t *bwpd =
cg && cg &&
...@@ -401,7 +423,6 @@ bool allocate_dl_retransmission(module_id_t module_id, ...@@ -401,7 +423,6 @@ bool allocate_dl_retransmission(module_id_t module_id,
const uint16_t bwpSize = coresetid == 0 ? RC.nrmac[module_id]->cset0_bwp_size : NRRIV2BW(genericParameters->locationAndBandwidth, MAX_BWP_SIZE); const uint16_t bwpSize = coresetid == 0 ? RC.nrmac[module_id]->cset0_bwp_size : NRRIV2BW(genericParameters->locationAndBandwidth, MAX_BWP_SIZE);
int rbStart = 0; // start wrt BWPstart int rbStart = 0; // start wrt BWPstart
NR_pdsch_semi_static_t *ps = &sched_ctrl->pdsch_semi_static;
int rbSize = 0; int rbSize = 0;
const int tda = get_dl_tda(RC.nrmac[module_id], scc, slot); const int tda = get_dl_tda(RC.nrmac[module_id], scc, slot);
AssertFatal(tda>=0,"Unable to find PDSCH time domain allocation in list\n"); AssertFatal(tda>=0,"Unable to find PDSCH time domain allocation in list\n");
...@@ -1355,6 +1376,8 @@ void nr_schedule_ue_spec(module_id_t module_id, ...@@ -1355,6 +1376,8 @@ void nr_schedule_ue_spec(module_id_t module_id,
/* save which time allocation has been used, to be used on /* save which time allocation has been used, to be used on
* retransmissions */ * retransmissions */
harq->sched_pdsch.time_domain_allocation = ps->time_domain_allocation; harq->sched_pdsch.time_domain_allocation = ps->time_domain_allocation;
/* save nr of layers for retransmissions */
harq->sched_pdsch.nrOfLayers = ps->nrOfLayers;
// ta command is sent, values are reset // ta command is sent, values are reset
if (sched_ctrl->ta_apply) { if (sched_ctrl->ta_apply) {
......
...@@ -826,14 +826,8 @@ static void handle_dl_harq(NR_UE_info_t * UE, ...@@ -826,14 +826,8 @@ static void handle_dl_harq(NR_UE_info_t * UE,
harq->ndi ^= 1; harq->ndi ^= 1;
} else if (harq->round >= harq_round_max - 1) { } else if (harq->round >= harq_round_max - 1) {
add_tail_nr_list(&UE->UE_sched_ctrl.available_dl_harq, harq_pid); abort_nr_dl_harq(UE, harq_pid);
harq->round = 0; LOG_D(NR_MAC, "retransmission error for UE %04x (total %"PRIu64")\n", UE->rnti, UE->mac_stats.dl.errors);
harq->ndi ^= 1;
NR_mac_stats_t *stats = &UE->mac_stats;
stats->dl.errors++;
LOG_D(NR_MAC, "retransmission error for UE %04x (total %"PRIu64")\n", UE->rnti, stats->dl.errors);
} else { } else {
LOG_D(PHY,"NACK for: pid %d, ue %04x\n",harq_pid, UE->rnti); LOG_D(PHY,"NACK for: pid %d, ue %04x\n",harq_pid, UE->rnti);
add_tail_nr_list(&UE->UE_sched_ctrl.retrans_dl_harq, harq_pid); add_tail_nr_list(&UE->UE_sched_ctrl.retrans_dl_harq, harq_pid);
......
...@@ -532,4 +532,6 @@ size_t dump_mac_stats(gNB_MAC_INST *gNB, char *output, size_t strlen, bool reset ...@@ -532,4 +532,6 @@ size_t dump_mac_stats(gNB_MAC_INST *gNB, char *output, size_t strlen, bool reset
void process_CellGroup(NR_CellGroupConfig_t *CellGroup, NR_UE_sched_ctrl_t *sched_ctrl); void process_CellGroup(NR_CellGroupConfig_t *CellGroup, NR_UE_sched_ctrl_t *sched_ctrl);
void abort_nr_dl_harq(NR_UE_info_t* UE, int8_t harq_pid);
#endif /*__LAYER2_NR_MAC_PROTO_H__*/ #endif /*__LAYER2_NR_MAC_PROTO_H__*/
...@@ -440,6 +440,7 @@ typedef struct NR_sched_pdsch { ...@@ -440,6 +440,7 @@ typedef struct NR_sched_pdsch {
/// only important for retransmissions; otherwise, the TDA in /// only important for retransmissions; otherwise, the TDA in
/// NR_pdsch_semi_static_t has precedence /// NR_pdsch_semi_static_t has precedence
int time_domain_allocation; int time_domain_allocation;
uint8_t nrOfLayers;
} NR_sched_pdsch_t; } NR_sched_pdsch_t;
typedef struct NR_UE_harq { typedef struct NR_UE_harq {
......
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