Commit 47e96132 authored by Melissa Elkadi's avatar Melissa Elkadi

Handling multiple DCIs in a single DL_TTI and TX_REQ

parent 1b2d8b52
...@@ -434,7 +434,9 @@ typedef struct { ...@@ -434,7 +434,9 @@ typedef struct {
// Defined for abstracted mode // Defined for abstracted mode
nr_downlink_indication_t dl_info; nr_downlink_indication_t dl_info;
NR_UE_HARQ_STATUS_t dl_harq_info[16]; NR_UE_HARQ_STATUS_t dl_harq_info[16];
bool expected_dci; bool expected_dci;
bool index_has_dci[16];
pthread_mutex_t mutex_dl_info; pthread_mutex_t mutex_dl_info;
......
...@@ -2757,7 +2757,7 @@ uint8_t nr_extract_dci_info(NR_UE_MAC_INST_t *mac, ...@@ -2757,7 +2757,7 @@ uint8_t nr_extract_dci_info(NR_UE_MAC_INST_t *mac,
// check BWP id // check BWP id
if (mac->DLbwp[0]) N_RB=NRRIV2BW(mac->DLbwp[0]->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); if (mac->DLbwp[0]) N_RB=NRRIV2BW(mac->DLbwp[0]->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
else N_RB=mac->type0_PDCCH_CSS_config.num_rbs; else N_RB=mac->type0_PDCCH_CSS_config.num_rbs;
;
// indicating a DL DCI format 1bit // indicating a DL DCI format 1bit
pos++; pos++;
......
...@@ -229,6 +229,7 @@ static void copy_dl_tti_req_to_dl_info(nr_downlink_indication_t *dl_info, nfapi_ ...@@ -229,6 +229,7 @@ static void copy_dl_tti_req_to_dl_info(nr_downlink_indication_t *dl_info, nfapi_
{ {
NR_UE_MAC_INST_t *mac = get_mac_inst(dl_info->module_id); NR_UE_MAC_INST_t *mac = get_mac_inst(dl_info->module_id);
mac->expected_dci = false; mac->expected_dci = false;
memset(mac->index_has_dci, 0, sizeof(*mac->index_has_dci));
int pdu_idx = 0; int pdu_idx = 0;
int num_pdus = dl_tti_request->dl_tti_request_body.nPDUs; int num_pdus = dl_tti_request->dl_tti_request_body.nPDUs;
...@@ -271,6 +272,8 @@ static void copy_dl_tti_req_to_dl_info(nr_downlink_indication_t *dl_info, nfapi_ ...@@ -271,6 +272,8 @@ static void copy_dl_tti_req_to_dl_info(nr_downlink_indication_t *dl_info, nfapi_
} }
fill_dl_info_with_pdcch(dl_info->dci_ind, dci_pdu_list, pdu_idx); fill_dl_info_with_pdcch(dl_info->dci_ind, dci_pdu_list, pdu_idx);
mac->expected_dci = true; mac->expected_dci = true;
LOG_D(NR_MAC, "Setting index_has_dci[%d] = true\n", j);
mac->index_has_dci[j] = true;
pdu_idx++; pdu_idx++;
} }
} }
...@@ -280,25 +283,8 @@ static void copy_dl_tti_req_to_dl_info(nr_downlink_indication_t *dl_info, nfapi_ ...@@ -280,25 +283,8 @@ static void copy_dl_tti_req_to_dl_info(nr_downlink_indication_t *dl_info, nfapi_
dl_info->frame = dl_tti_request->SFN; dl_info->frame = dl_tti_request->SFN;
} }
static void copy_tx_data_req_to_dl_info(nr_downlink_indication_t *dl_info, nfapi_nr_tx_data_request_t *tx_data_request) static void fill_rx_ind(nfapi_nr_pdu_t *pdu_list, fapi_nr_rx_indication_t *rx_ind, int pdu_idx, int pdu_type)
{ {
NR_UE_MAC_INST_t *mac = get_mac_inst(dl_info->module_id);
int num_pdus = tx_data_request->Number_of_PDUs;
if (num_pdus <= 0)
{
LOG_E(NR_PHY, "%s: tx_data_request number of PDUS <= 0\n", __FUNCTION__);
abort();
}
dl_info->rx_ind = CALLOC(1, sizeof(fapi_nr_rx_indication_t));
AssertFatal(dl_info->rx_ind != NULL, "%s: Out of memory in calloc", __FUNCTION__);
dl_info->rx_ind->sfn = tx_data_request->SFN;
dl_info->rx_ind->slot = tx_data_request->Slot;
dl_info->rx_ind->number_pdus = num_pdus;
for (int i = 0; i < num_pdus; i++)
{
nfapi_nr_pdu_t *pdu_list = &tx_data_request->pdu_list[i];
AssertFatal(pdu_list->num_TLV < sizeof(pdu_list->TLVs) / sizeof(pdu_list->TLVs[0]), "Num TLVs exceeds TLV array size"); AssertFatal(pdu_list->num_TLV < sizeof(pdu_list->TLVs) / sizeof(pdu_list->TLVs[0]), "Num TLVs exceeds TLV array size");
int length = 0; int length = 0;
for (int j = 0; j < pdu_list->num_TLV; j++) for (int j = 0; j < pdu_list->num_TLV; j++)
...@@ -306,10 +292,10 @@ static void copy_tx_data_req_to_dl_info(nr_downlink_indication_t *dl_info, nfapi ...@@ -306,10 +292,10 @@ static void copy_tx_data_req_to_dl_info(nr_downlink_indication_t *dl_info, nfapi
length += pdu_list->TLVs[j].length; length += pdu_list->TLVs[j].length;
} }
LOG_I(NR_PHY, "%s: num_tlv %d and length %d, pdu index %d\n", LOG_I(NR_PHY, "%s: num_tlv %d and length %d, pdu index %d\n",
__FUNCTION__, pdu_list->num_TLV, length, i); __FUNCTION__, pdu_list->num_TLV, length, pdu_idx);
uint8_t *pdu = malloc(length); uint8_t *pdu = malloc(length);
AssertFatal(pdu != NULL, "%s: Out of memory in malloc", __FUNCTION__); AssertFatal(pdu != NULL, "%s: Out of memory in malloc", __FUNCTION__);
dl_info->rx_ind->rx_indication_body[i].pdsch_pdu.pdu = pdu; rx_ind->rx_indication_body[pdu_idx].pdsch_pdu.pdu = pdu;
for (int j = 0; j < pdu_list->num_TLV; j++) for (int j = 0; j < pdu_list->num_TLV; j++)
{ {
const uint32_t *ptr; const uint32_t *ptr;
...@@ -320,17 +306,53 @@ static void copy_tx_data_req_to_dl_info(nr_downlink_indication_t *dl_info, nfapi ...@@ -320,17 +306,53 @@ static void copy_tx_data_req_to_dl_info(nr_downlink_indication_t *dl_info, nfapi
memcpy(pdu, ptr, pdu_list->TLVs[j].length); memcpy(pdu, ptr, pdu_list->TLVs[j].length);
pdu += pdu_list->TLVs[j].length; pdu += pdu_list->TLVs[j].length;
} }
dl_info->rx_ind->rx_indication_body[i].pdsch_pdu.ack_nack = 1; // Melissa we will come back during channel modelling rx_ind->rx_indication_body[pdu_idx].pdsch_pdu.ack_nack = 1;
dl_info->rx_ind->rx_indication_body[i].pdsch_pdu.pdu_length = length; rx_ind->rx_indication_body[pdu_idx].pdsch_pdu.pdu_length = length;
if (tx_data_request->Slot == 7 && mac->ra.ra_state <= WAIT_RAR) { //Melissa this means we have an RAR, sorta hacky though rx_ind->rx_indication_body[pdu_idx].pdu_type = pdu_type;
dl_info->rx_ind->rx_indication_body[i].pdu_type = FAPI_NR_RX_PDU_TYPE_RAR;
}
static void copy_tx_data_req_to_dl_info(nr_downlink_indication_t *dl_info, nfapi_nr_tx_data_request_t *tx_data_request)
{
NR_UE_MAC_INST_t *mac = get_mac_inst(dl_info->module_id);
int num_pdus = tx_data_request->Number_of_PDUs;
if (num_pdus <= 0)
{
LOG_E(NR_PHY, "%s: tx_data_request number of PDUS <= 0\n", __FUNCTION__);
abort();
} }
else {
dl_info->rx_ind->rx_indication_body[i].pdu_type = FAPI_NR_RX_PDU_TYPE_DLSCH; dl_info->rx_ind = CALLOC(1, sizeof(fapi_nr_rx_indication_t));
AssertFatal(dl_info->rx_ind != NULL, "%s: Out of memory in calloc", __FUNCTION__);
fapi_nr_rx_indication_t *rx_ind = dl_info->rx_ind;
rx_ind->sfn = tx_data_request->SFN;
rx_ind->slot = tx_data_request->Slot;
int pdu_idx = 0;
for (int i = 0; i < num_pdus; i++)
{
nfapi_nr_pdu_t *pdu_list = &tx_data_request->pdu_list[i];
if(mac->ra.ra_state <= WAIT_RAR)
{
fill_rx_ind(pdu_list, rx_ind, pdu_idx, FAPI_NR_RX_PDU_TYPE_RAR);
pdu_idx++;
}
else if (mac->index_has_dci[i])
{
fill_rx_ind(pdu_list, rx_ind, pdu_idx, FAPI_NR_RX_PDU_TYPE_DLSCH);
pdu_idx++;
} }
else
{
LOG_D(NR_MAC, "mac->index_has_dci[%d] = 0, so this index contained a DCI for a different UE\n", i);
}
} }
dl_info->slot = tx_data_request->Slot; dl_info->slot = tx_data_request->Slot;
dl_info->frame = tx_data_request->SFN; dl_info->frame = tx_data_request->SFN;
dl_info->rx_ind->number_pdus = pdu_idx;
} }
static void copy_ul_dci_data_req_to_dl_info(nr_downlink_indication_t *dl_info, nfapi_nr_ul_dci_request_t *ul_dci_req) static void copy_ul_dci_data_req_to_dl_info(nr_downlink_indication_t *dl_info, nfapi_nr_ul_dci_request_t *ul_dci_req)
...@@ -587,16 +609,6 @@ static void check_and_process_dci(nfapi_nr_dl_tti_request_t *dl_tti_request, ...@@ -587,16 +609,6 @@ static void check_and_process_dci(nfapi_nr_dl_tti_request_t *dl_tti_request,
{ {
nr_ue_ul_indication(&ul_info); nr_ue_ul_indication(&ul_info);
} }
#if 0 //Melissa may want to free this
free(dl_info.dci_ind);
dl_info.dci_ind = NULL;
free(dl_info.rx_ind);
dl_info.rx_ind = NULL;
#endif
} }
static void save_nr_measurement_info(nfapi_nr_dl_tti_request_t *dl_tti_request) static void save_nr_measurement_info(nfapi_nr_dl_tti_request_t *dl_tti_request)
...@@ -955,6 +967,8 @@ int nr_ue_dl_indication(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_ ...@@ -955,6 +967,8 @@ int nr_ue_dl_indication(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_
} }
memset(def_dci_pdu_rel15, 0, sizeof(*def_dci_pdu_rel15)); memset(def_dci_pdu_rel15, 0, sizeof(*def_dci_pdu_rel15));
} }
free(dl_info->dci_ind);
dl_info->dci_ind = NULL;
} }
if (dl_info->rx_ind != NULL) { if (dl_info->rx_ind != NULL) {
...@@ -995,6 +1009,8 @@ int nr_ue_dl_indication(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_ ...@@ -995,6 +1009,8 @@ int nr_ue_dl_indication(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_
break; break;
} }
} }
free(dl_info->rx_ind);
dl_info->rx_ind = NULL;
} }
//clean up nr_downlink_indication_t *dl_info //clean up nr_downlink_indication_t *dl_info
......
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