Commit 0e6431a7 authored by Louis Adrien Dufrene's avatar Louis Adrien Dufrene

Moved code for HARQ process from PHY layer to MAC layer

parent fbcc7ad2
......@@ -1498,12 +1498,9 @@ static void do_release_harq(PHY_VARS_eNB *eNB,
LTE_eNB_DLSCH_t *dlsch1 = NULL;
LTE_DL_eNB_HARQ_t *dlsch0_harq = NULL;
LTE_DL_eNB_HARQ_t *dlsch1_harq = NULL;
int UE_id_mac = -1;
int harq_pid;
int subframe_tx;
int frame_tx;
UE_sched_ctrl *UE_scheduling_control = NULL;
UE_list_t *UE_list = NULL;
AssertFatal(UE_id != -1, "No existing dlsch context\n");
AssertFatal(UE_id < NUMBER_OF_UE_MAX, "Returned UE_id %d >= %d (NUMBER_OF_UE_MAX)\n", UE_id, NUMBER_OF_UE_MAX);
......@@ -1511,24 +1508,6 @@ static void do_release_harq(PHY_VARS_eNB *eNB,
dlsch0 = eNB->dlsch[UE_id][0];
dlsch1 = eNB->dlsch[UE_id][1];
if (RC.mac != NULL) { /* dlsim does not use RC.mac context */
UE_list = &(RC.mac[eNB->Mod_id]->UE_list);
/* Replicate "find_UE_id" from openair2/LAYER2/MAC/mac_proto.h */
for (int UE_id_temp = 0; UE_id_temp < MAX_MOBILES_PER_ENB; UE_id_temp++) {
if (UE_list->active[UE_id_temp] == TRUE) {
if (UE_list->UE_template[UE_list->pCC_id[UE_id_temp]][UE_id_temp].rnti == dlsch0->rnti) {
UE_id_mac = UE_id_temp;
break;
}
}
}
if (UE_id_mac != -1) {
UE_scheduling_control = &(UE_list->UE_sched_ctrl[UE_id_mac]);
}
}
if (eNB->frame_parms.frame_type == FDD) {
subframe_tx = (subframe + 6) % 10;
frame_tx = ul_ACK_subframe2_dl_frame(&eNB->frame_parms,
......@@ -1568,11 +1547,6 @@ static void do_release_harq(PHY_VARS_eNB *eNB,
if (dlsch0_harq->round >= after_rounds) {
dlsch0_harq->status = SCH_IDLE;
dlsch0->harq_mask &= ~(1 << harq_pid);
if (UE_scheduling_control != NULL) {
/* CDRX: PUCCH gives an ACK or no more repetitions, so reset corresponding HARQ RTT */
UE_scheduling_control->harq_rtt_timer[eNB->CC_id][harq_pid] = 0;
}
}
} else {
......
......@@ -4153,18 +4153,25 @@ extract_harq(module_id_t mod_idP,
if (pdu[0] == 1) { // ACK
sched_ctl->round[CC_idP][harq_pid] = 8; // release HARQ process
sched_ctl->tbcnt[CC_idP][harq_pid] = 0;
/* CDRX: PUCCH gives an ACK, so reset corresponding HARQ RTT */
sched_ctl->harq_rtt_timer[CC_idP][harq_pid] = 0;
} else if (pdu[0] == 2 || pdu[0] == 4) { // NAK (treat DTX as NAK)
sched_ctl->round[CC_idP][harq_pid]++; // increment round
if (sched_ctl->round[CC_idP][harq_pid] == 4) {
sched_ctl->round[CC_idP][harq_pid] = 8; // release HARQ process
sched_ctl->tbcnt[CC_idP][harq_pid] = 0;
/* CDRX: PUCCH gives an NACK and max number of repetitions reached so reset corresponding HARQ RTT */
sched_ctl->harq_rtt_timer[CC_idP][harq_pid] = 0;
}
if (sched_ctl->round[CC_idP][harq_pid] == 8) {
for (uint8_t ra_i = 0; ra_i < NB_RA_PROC_MAX; ra_i++) {
if((ra[ra_i].rnti == rnti) && (ra[ra_i].state == WAITMSG4ACK)) {
//Msg NACK num to MAC ,remove UE
// Msg NACK num to MAC ,remove UE
// add UE info to freeList
LOG_I(RRC, "put UE %x into freeList\n",
rnti);
......@@ -4183,6 +4190,9 @@ extract_harq(module_id_t mod_idP,
if (num_ack_nak == 2 && sched_ctl->round[CC_idP][harq_pid] < 8 && sched_ctl->tbcnt[CC_idP][harq_pid] == 1 && pdu[0] == 1 && pdu[1] == 1) {
sched_ctl->round[CC_idP][harq_pid] = 8;
sched_ctl->tbcnt[CC_idP][harq_pid] = 0;
/* CDRX: PUCCH gives an ACK, so reset corresponding HARQ RTT */
sched_ctl->harq_rtt_timer[CC_idP][harq_pid] = 0;
}
if ((num_ack_nak == 2)
......@@ -4194,6 +4204,9 @@ extract_harq(module_id_t mod_idP,
if (sched_ctl->round[CC_idP][harq_pid] == 4) {
sched_ctl->round[CC_idP][harq_pid] = 8; // release HARQ process
sched_ctl->tbcnt[CC_idP][harq_pid] = 0;
/* CDRX: PUCCH gives an NACK and max number of repetitions reached so reset corresponding HARQ RTT */
sched_ctl->harq_rtt_timer[CC_idP][harq_pid] = 0;
}
} else if (((num_ack_nak == 2)
&& (sched_ctl->round[CC_idP][harq_pid] < 8)
......@@ -4209,6 +4222,9 @@ extract_harq(module_id_t mod_idP,
if (sched_ctl->round[CC_idP][harq_pid] == 4) {
sched_ctl->round[CC_idP][harq_pid] = 8; // release HARQ process
sched_ctl->tbcnt[CC_idP][harq_pid] = 0; /* TODO: do we have to set it to 0? */
/* CDRX: PUCCH gives an NACK and max number of repetitions reached so reset corresponding HARQ RTT */
sched_ctl->harq_rtt_timer[CC_idP][harq_pid] = 0;
}
} else if ((num_ack_nak == 2)
&& (sched_ctl->round[CC_idP][harq_pid] < 8)
......@@ -4219,6 +4235,9 @@ extract_harq(module_id_t mod_idP,
if (sched_ctl->round[CC_idP][harq_pid] == 4) {
sched_ctl->round[CC_idP][harq_pid] = 8; // release HARQ process
sched_ctl->tbcnt[CC_idP][harq_pid] = 0;
/* CDRX: PUCCH gives an NACK and max number of repetitions reached so reset corresponding HARQ RTT */
sched_ctl->harq_rtt_timer[CC_idP][harq_pid] = 0;
}
} else
AssertFatal(1 == 0, "Illegal ACK/NAK/round combination (%d,%d,%d,%d,%d) for harq_pid %d, UE %d/%x\n",
......
......@@ -115,7 +115,7 @@ void handle_cqi(UL_IND_t *UL_info) {
void handle_harq(UL_IND_t *UL_info) {
if (NFAPI_MODE == NFAPI_MODE_PNF && UL_info->harq_ind.harq_indication_body.number_of_harqs > 0) { // PNF
//LOG_D(PHY, "UL_info->harq_ind.harq_indication_body.number_of_harqs:%d Send to VNF\n", UL_info->harq_ind.harq_indication_body.number_of_harqs);
LOG_E(PHY, "UL_info->harq_ind.harq_indication_body.number_of_harqs:%d Send to VNF\n", UL_info->harq_ind.harq_indication_body.number_of_harqs);
int retval = oai_nfapi_harq_indication(&UL_info->harq_ind);
if (retval != 0) {
......@@ -125,6 +125,7 @@ void handle_harq(UL_IND_t *UL_info) {
UL_info->harq_ind.harq_indication_body.number_of_harqs = 0;
} else {
LOG_E(PHY, "UL_info->harq_ind.harq_indication_body.number_of_harqs:%d Received by VNF\n", UL_info->harq_ind.harq_indication_body.number_of_harqs);
for (int i=0; i < UL_info->harq_ind.harq_indication_body.number_of_harqs; i++)
harq_indication(UL_info->module_id,
UL_info->CC_id,
......
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