Commit 52dafe61 authored by Melissa Elkadi's avatar Melissa Elkadi

Fixed a bug in rx and crc filling in the NR UE

Also, there is not a field for dci_format in
nFAPI so there is a way it is detected by the NR UE.
For now, we have hardcoded the value in the stub when
we receive the DCI. Lastly, updated the nr_harq_handling
in the gNB.
parent 2b698b77
......@@ -74,16 +74,19 @@ int8_t nr_ue_scheduled_response_stub(nr_scheduled_response_t *scheduled_response
rx_ind->sfn = scheduled_response->tx_request->sfn;
rx_ind->number_of_pdus = scheduled_response->tx_request->number_of_pdus;
fapi_nr_tx_request_body_t *tx_req_body = &scheduled_response->tx_request->tx_request_body[i];
rx_ind->pdu_list = CALLOC(1, sizeof(*rx_ind->pdu_list));
rx_ind->pdu_list[i].handle = pusch_config_pdu->handle;
rx_ind->pdu_list[i].harq_id = pusch_config_pdu->pusch_data.harq_process_id;
rx_ind->pdu_list[i].pdu = tx_req_body->pdu;
rx_ind->pdu_list[i].pdu_length = tx_req_body->pdu_length;
rx_ind->pdu_list[i].rnti = pusch_config_pdu->rnti;
rx_ind->pdu_list[i].timing_advance = 0;
rx_ind->pdu_list[i].ul_cqi = 27;
LOG_I(PHY, "In %s: Filled rx_indwith tx_req \n", __FUNCTION__);
rx_ind->pdu_list = CALLOC(1, sizeof(*rx_ind->pdu_list) * rx_ind->number_of_pdus);
for (int j = 0; j < rx_ind->number_of_pdus; j++)
{
fapi_nr_tx_request_body_t *tx_req_body = &scheduled_response->tx_request->tx_request_body[j];
rx_ind->pdu_list[j].handle = pusch_config_pdu->handle;
rx_ind->pdu_list[j].harq_id = pusch_config_pdu->pusch_data.harq_process_id;
rx_ind->pdu_list[j].pdu = tx_req_body->pdu;
rx_ind->pdu_list[j].pdu_length = tx_req_body->pdu_length;
rx_ind->pdu_list[j].rnti = pusch_config_pdu->rnti;
rx_ind->pdu_list[j].timing_advance = scheduled_response->tx_request->tx_config.timing_advance;
rx_ind->pdu_list[j].ul_cqi = scheduled_response->tx_request->tx_config.ul_cqi;
}
LOG_I(PHY, "In %s: Filled rx_ind with tx_req \n", __FUNCTION__);
scheduled_response->tx_request->number_of_pdus = 0;
send_nsa_standalone_msg(&UL_INFO, rx_ind->header.message_id);
......@@ -97,15 +100,19 @@ int8_t nr_ue_scheduled_response_stub(nr_scheduled_response_t *scheduled_response
crc_ind->sfn = scheduled_response->ul_config->sfn;
crc_ind->slot = scheduled_response->ul_config->slot;
crc_ind->crc_list = CALLOC(1, sizeof(*crc_ind->crc_list));
crc_ind->crc_list[i].handle = pusch_config_pdu->handle;
crc_ind->crc_list[i].harq_id = pusch_config_pdu->pusch_data.harq_process_id;
crc_ind->crc_list[i].num_cb = pusch_config_pdu->pusch_data.num_cb;
crc_ind->crc_list[i].rnti = pusch_config_pdu->rnti;
crc_ind->crc_list[i].tb_crc_status = 0;
crc_ind->crc_list[i].timing_advance = 0;
crc_ind->crc_list[i].ul_cqi = 27;
LOG_I(PHY, "In %s: Filled crc_indwith ulconfig\n", __FUNCTION__);
crc_ind->crc_list = CALLOC(1, sizeof(*crc_ind->crc_list) * crc_ind->number_crcs);
for (int j = 0; j < crc_ind->number_crcs; j++)
{
crc_ind->crc_list[j].handle = pusch_config_pdu->handle;
crc_ind->crc_list[j].harq_id = 1; //pusch_config_pdu->pusch_data.harq_process_id;
crc_ind->crc_list[j].num_cb = pusch_config_pdu->pusch_data.num_cb;
crc_ind->crc_list[j].rnti = pusch_config_pdu->rnti;
crc_ind->crc_list[j].tb_crc_status = 0;
crc_ind->crc_list[j].timing_advance = scheduled_response->tx_request->tx_config.timing_advance;
crc_ind->crc_list[j].ul_cqi = scheduled_response->tx_request->tx_config.ul_cqi;
}
LOG_I(PHY, "Melissa In %s: Filled crc_ind with ulconfig. \n", __FUNCTION__);
scheduled_response->ul_config->number_pdus = 0;
send_nsa_standalone_msg(&UL_INFO, crc_ind->header.message_id);
......
......@@ -1153,10 +1153,12 @@ uint8_t nr_extract_dci_info(NR_UE_MAC_INST_t *mac,
}
else if (dci_format == NR_UL_DCI_FORMAT_0_1 || dci_format == NR_DL_DCI_FORMAT_1_1) {
// In case the sizes of formats 0_1 and 1_1 happen to be the same
#if 0
if (dci_pdu_rel15->format_indicator == 0)
dci_format = NR_UL_DCI_FORMAT_0_1;
else
dci_format = NR_DL_DCI_FORMAT_1_1;
#endif
}
}
#ifdef DEBUG_EXTRACT_DCI
......
......@@ -61,7 +61,7 @@ void fill_ul_config(fapi_nr_ul_config_request_t *ul_config, frame_t frame_tx, in
ul_config->sfn = frame_tx;
ul_config->number_pdus++;
LOG_I(MAC, "Melissa Elkadi In %s: Set config request for UL transmission in [%d.%d], number of UL PDUs: %d\n", __FUNCTION__, ul_config->sfn, ul_config->slot, ul_config->number_pdus);
LOG_I(MAC, "In %s: Set config request for UL transmission in [%d.%d], number of UL PDUs: %d\n", __FUNCTION__, ul_config->sfn, ul_config->slot, ul_config->number_pdus);
}
......
......@@ -306,6 +306,24 @@ void nr_process_mac_pdu(
}
}
void abort_nr_ul_harq(module_id_t mod_id, int UE_id, int8_t harq_pid)
{
NR_UE_info_t *UE_info = &RC.nrmac[mod_id]->UE_info;
NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id];
NR_UE_ul_harq_t *harq = &sched_ctrl->ul_harq_processes[harq_pid];
harq->ndi ^= 1;
harq->round = 0;
UE_info->mac_stats[UE_id].ulsch_errors++;
add_tail_nr_list(&sched_ctrl->available_ul_harq, harq_pid);
/* the transmission failed: the UE won't send the data we expected initially,
* so retrieve to correctly schedule after next BSR */
sched_ctrl->sched_ul_bytes -= harq->sched_pusch.tb_size;
if (sched_ctrl->sched_ul_bytes < 0)
sched_ctrl->sched_ul_bytes = 0;
}
void handle_nr_ul_harq(module_id_t mod_id,
frame_t frame,
sub_frame_t slot,
......@@ -330,8 +348,13 @@ void handle_nr_ul_harq(module_id_t mod_id,
return;
remove_front_nr_list(&sched_ctrl->feedback_ul_harq);
sched_ctrl->ul_harq_processes[harq_pid].round++;
add_tail_nr_list(&sched_ctrl->retrans_ul_harq, harq_pid);
sched_ctrl->ul_harq_processes[harq_pid].is_waiting = false;
if(sched_ctrl->ul_harq_processes[harq_pid].round >= MAX_HARQ_ROUNDS - 1) {
abort_nr_ul_harq(mod_id, UE_id, harq_pid);
} else {
sched_ctrl->ul_harq_processes[harq_pid].round++;
add_tail_nr_list(&sched_ctrl->retrans_ul_harq, harq_pid);
}
harq_pid = sched_ctrl->feedback_ul_harq.head;
}
remove_front_nr_list(&sched_ctrl->feedback_ul_harq);
......@@ -347,15 +370,12 @@ void handle_nr_ul_harq(module_id_t mod_id,
harq_pid,
crc_pdu->rnti);
add_tail_nr_list(&sched_ctrl->available_ul_harq, harq_pid);
} else if (harq->round == MAX_HARQ_ROUNDS) {
harq->ndi ^= 1;
harq->round = 0;
} else if (harq->round >= MAX_HARQ_ROUNDS - 1) {
abort_nr_ul_harq(mod_id, UE_id, harq_pid);
LOG_D(MAC,
"RNTI %04x: Ulharq id %d crc failed in all rounds\n",
crc_pdu->rnti,
harq_pid);
UE_info->mac_stats[UE_id].ulsch_errors++;
add_tail_nr_list(&sched_ctrl->available_ul_harq, harq_pid);
} else {
harq->round++;
LOG_D(MAC,
......@@ -984,6 +1004,7 @@ void nr_schedule_ulsch(module_id_t module_id,
NR_sched_pusch_save_t *ps = &sched_ctrl->pusch_save;
/* Statistics */
AssertFatal(cur_harq->round < 8, "Indexing ulsch_rounds[%d] is out of bounds\n", cur_harq->round);
UE_info->mac_stats[UE_id].ulsch_rounds[cur_harq->round]++;
if (cur_harq->round == 0) {
UE_info->mac_stats[UE_id].ulsch_total_bytes_scheduled += sched_pusch->tb_size;
......@@ -1102,6 +1123,7 @@ void nr_schedule_ulsch(module_id_t module_id,
pusch_pdu->nr_of_symbols = ps->nrOfSymbols;
/* PUSCH PDU */
AssertFatal(cur_harq->round < 4, "Indexing nr_rv_round_map[%d] is out of bounds\n", cur_harq->round);
pusch_pdu->pusch_data.rv_index = nr_rv_round_map[cur_harq->round];
pusch_pdu->pusch_data.harq_process_id = harq_id;
pusch_pdu->pusch_data.new_data_indicator = cur_harq->ndi;
......
......@@ -383,6 +383,8 @@ void nr_rx_sdu(const module_id_t gnb_mod_idP,
const uint8_t ul_cqi,
const uint16_t rssi);
void abort_nr_ul_harq(module_id_t mod_id, int UE_id, int8_t harq_pid);
void handle_nr_ul_harq(module_id_t mod_id,
frame_t frame,
sub_frame_t slot,
......
......@@ -214,7 +214,7 @@ static void copy_dl_tti_req_to_dl_info(nr_downlink_indication_t *dl_info, nfapi_
nfapi_nr_dl_tti_request_pdu_t *pdu_list = &dl_tti_request->dl_tti_request_body.dl_tti_pdu_list[i];
if (pdu_list->PDUType == NFAPI_NR_DL_TTI_PDSCH_PDU_TYPE)
{
LOG_I(NR_PHY, "[%d, %d] PDSCH (RAR transmission configuration)for rnti %x in \n",
LOG_I(NR_PHY, "[%d, %d] PDSCH PDU for rnti %x in \n",
dl_tti_request->SFN, dl_tti_request->Slot, pdu_list->pdsch_pdu.pdsch_pdu_rel15.rnti);
}
......@@ -230,14 +230,17 @@ static void copy_dl_tti_req_to_dl_info(nr_downlink_indication_t *dl_info, nfapi_
for (int j = 0; j < num_dcis; j++)
{
nfapi_nr_dl_dci_pdu_t *dci_pdu_list = &pdu_list->pdcch_pdu.pdcch_pdu_rel15.dci_pdu[j];
LOG_I(NR_PHY, "[%d, %d] PDCCH DCI (Payload) for rnti %x.\n",
dl_tti_request->SFN, dl_tti_request->Slot, dci_pdu_list->RNTI);
LOG_I(NR_PHY, "[%d, %d] PDCCH DCI (Payload) for rnti %x with PayloadSizeBits %d\n",
dl_tti_request->SFN, dl_tti_request->Slot, dci_pdu_list->RNTI, dci_pdu_list->PayloadSizeBits);
for (int k = 0; k < DCI_PAYLOAD_BYTE_LEN; k++)
{
dl_info->dci_ind->dci_list->payloadBits[k] = dci_pdu_list->Payload[k];
LOG_I(NR_MAC, "PDCCH DCI PDU payload[%d] = %d\n", k, dci_pdu_list->Payload[k]);
dl_info->dci_ind->dci_list[j].payloadBits[k] = dci_pdu_list->Payload[k];
}
dl_info->dci_ind->dci_list->payloadSize = dci_pdu_list->PayloadSizeBits;
dl_info->dci_ind->dci_list->rnti = dci_pdu_list->RNTI;
dl_info->dci_ind->dci_list[j].payloadSize = dci_pdu_list->PayloadSizeBits;
dl_info->dci_ind->dci_list[j].rnti = dci_pdu_list->RNTI;
if (dci_pdu_list->PayloadSizeBits != 37) //Melissa: hack. This size is for RAR
dl_info->dci_ind->dci_list[j].dci_format = 7;
}
}
}
......@@ -271,7 +274,12 @@ static void copy_tx_data_req_to_dl_info(nr_downlink_indication_t *dl_info, nfapi
else if (!pdu_list->TLVs[j].tag)
dl_info->rx_ind->rx_indication_body[i].pdsch_pdu.pdu = pdu_list->TLVs[j].value.direct;
dl_info->rx_ind->rx_indication_body[i].pdsch_pdu.pdu_length = pdu_list->TLVs[j].length;
dl_info->rx_ind->rx_indication_body[i].pdu_type = FAPI_NR_RX_PDU_TYPE_RAR;
if (tx_data_request->Slot == 7) { //Melissa this means we have an RAR, sorta hacky though
dl_info->rx_ind->rx_indication_body[i].pdu_type = FAPI_NR_RX_PDU_TYPE_RAR;
}
else if (tx_data_request->Slot != 7 && get_softmodem_params()->nsa) {
dl_info->rx_ind->rx_indication_body[i].pdu_type = FAPI_NR_RX_PDU_TYPE_DLSCH;
}
}
}
dl_info->slot = tx_data_request->Slot;
......
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