Commit 777bcc6c authored by Melissa Elkadi's avatar Melissa Elkadi

Saving DCI format to mac instance to fill in stub

parent 17222c91
......@@ -229,7 +229,7 @@ static void *NRUE_phy_stub_standalone_pnf_task(void *arg)
if (mac->ra.ra_state == RA_SUCCEEDED)
continue;
AssertFatal(ul_config->number_pdus < sizeof(ul_config->ul_config_list) / sizeof(ul_config->ul_config_list[0]),
"Number of PDUS in ul_config > ul_config_list num elements");
"Number of PDUS in ul_config = %d > ul_config_list num elements", ul_config->number_pdus);
fapi_nr_ul_config_prach_pdu *prach_pdu = &ul_config->ul_config_list[ul_config->number_pdus].prach_config_pdu;
uint8_t nr_prach = nr_ue_get_rach(&prach_resources, prach_pdu, mod_id, CC_id, ul_info.frame_tx, gNB_id, ul_info.slot_tx);
......
......@@ -136,6 +136,12 @@ void config_dci_pdu(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_dci_dl_pdu_rel15_t
rel15->SubcarrierSpacing = bwp_Common->genericParameters.subcarrierSpacing;
for (int i = 0; i < rel15->num_dci_options; i++) {
rel15->dci_length_options[i] = nr_dci_size(scc, mac->scg, def_dci_pdu_rel15+i, rel15->dci_format_options[i], NR_RNTI_C, rel15->BWPSize, bwp_id);
AssertFatal(mac->dl_config_request.number_pdus <
sizeof(mac->dl_config_request.dl_config_list) / sizeof(mac->dl_config_request.dl_config_list[0]),
"mac->dl_config_request.number_pdus (%d) exceeds dl_config_list size\n", mac->dl_config_request.number_pdus);
for (int j = 0; j < mac->dl_config_request.number_pdus; j++) {
mac->dl_config_request.dl_config_list[j].dci_config_pdu.dci_config_rel15.dci_length_options[i] = rel15->dci_length_options[i];
}
}
break;
case NR_RNTI_RA:
......@@ -147,6 +153,12 @@ void config_dci_pdu(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_dci_dl_pdu_rel15_t
rel15->BWPStart = NRRIV2PRBOFFSET(bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); //NRRIV2PRBOFFSET(initialDownlinkBWP->genericParameters.locationAndBandwidth, 275);
rel15->SubcarrierSpacing = initialDownlinkBWP->genericParameters.subcarrierSpacing;
rel15->dci_length_options[0] = nr_dci_size(scc, mac->scg, def_dci_pdu_rel15, rel15->dci_format_options[0], NR_RNTI_RA, rel15->BWPSize, bwp_id);
AssertFatal(mac->dl_config_request.number_pdus <
sizeof(mac->dl_config_request.dl_config_list) / sizeof(mac->dl_config_request.dl_config_list[0]),
"mac->dl_config_request.number_pdus (%d) exceeds dl_config_list size\n", mac->dl_config_request.number_pdus);
for (int i = 0; i < mac->dl_config_request.number_pdus; i++) {
mac->dl_config_request.dl_config_list[i].dci_config_pdu.dci_config_rel15.dci_length_options[0] = rel15->dci_length_options[0];
}
break;
case NR_RNTI_P:
break;
......@@ -249,6 +261,14 @@ void ue_dci_configuration(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_request_t *dl
rel15->num_dci_options = 1;
rel15->dci_format_options[0] = NR_DL_DCI_FORMAT_1_0;
config_dci_pdu(mac, rel15, dl_config, NR_RNTI_RA, ss_id);
AssertFatal(mac->dl_config_request.number_pdus <
sizeof(mac->dl_config_request.dl_config_list) / sizeof(mac->dl_config_request.dl_config_list[0]),
"mac->dl_config_request.number_pdus (%d) exceeds dl_config_list size\n", mac->dl_config_request.number_pdus);
for (int i = 0; i < mac->dl_config_request.number_pdus; i++) {
mac->dl_config_request.dl_config_list[i].dci_config_pdu.dci_config_rel15.num_dci_options = 1;
mac->dl_config_request.dl_config_list[i].dci_config_pdu.dci_config_rel15.dci_length_options[0] = rel15->dci_length_options[0];
mac->dl_config_request.dl_config_list[i].dci_config_pdu.dci_config_rel15.dci_format_options[0] = NR_DL_DCI_FORMAT_1_0;
}
fill_dci_search_candidates(ss, rel15);
break;
case WAIT_CONTENTION_RESOLUTION:
......@@ -322,6 +342,14 @@ void ue_dci_configuration(NR_UE_MAC_INST_t *mac, fapi_nr_dl_config_request_t *dl
rel15->num_dci_options = 2;
rel15->dci_format_options[0] = NR_DL_DCI_FORMAT_1_1;
rel15->dci_format_options[1] = NR_UL_DCI_FORMAT_0_1;
AssertFatal(mac->dl_config_request.number_pdus <
sizeof(mac->dl_config_request.dl_config_list) / sizeof(mac->dl_config_request.dl_config_list[0]),
"mac->dl_config_request.number_pdus (%d) exceeds dl_config_list size\n", mac->dl_config_request.number_pdus);
for (int i = 0; i < mac->dl_config_request.number_pdus; i++) {
mac->dl_config_request.dl_config_list[i].dci_config_pdu.dci_config_rel15.num_dci_options = 2;
mac->dl_config_request.dl_config_list[i].dci_config_pdu.dci_config_rel15.dci_format_options[0] = NR_DL_DCI_FORMAT_1_1;
mac->dl_config_request.dl_config_list[i].dci_config_pdu.dci_config_rel15.dci_format_options[1] = NR_UL_DCI_FORMAT_0_1;
}
config_dci_pdu(mac, rel15, dl_config, NR_RNTI_C, ss_id);
fill_dci_search_candidates(ss, rel15);
......
......@@ -508,7 +508,7 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr
return -1;
}
AssertFatal(ul_config->number_pdus < sizeof(ul_config->ul_config_list) / sizeof(ul_config->ul_config_list[0]),
"Number of PDUS in ul_config > ul_config_list num elements");
"Number of PDUS in ul_config = %d > ul_config_list num elements", ul_config->number_pdus);
nfapi_nr_ue_pusch_pdu_t *pusch_config_pdu = &ul_config->ul_config_list[ul_config->number_pdus].pusch_config_pdu;
fill_ul_config(ul_config, frame_tx, slot_tx, FAPI_NR_UL_CONFIG_TYPE_PUSCH);
......@@ -571,8 +571,9 @@ int8_t nr_ue_process_dci(module_id_t module_id, int cc_id, uint8_t gNB_index, fr
LOG_W(MAC, "In %s: ul_config request is NULL. Probably due to unexpected UL DCI in frame.slot %d.%d. Ignoring DCI!\n", __FUNCTION__, frame, slot);
return -1;
}
ul_config->number_pdus = 0;
AssertFatal(ul_config->number_pdus < sizeof(ul_config->ul_config_list) / sizeof(ul_config->ul_config_list[0]),
"Number of PDUS in ul_config > ul_config_list num elements");
"Number of PDUS in ul_config = %d > ul_config_list num elements", ul_config->number_pdus);
nfapi_nr_ue_pusch_pdu_t *pusch_config_pdu = &ul_config->ul_config_list[ul_config->number_pdus].pusch_config_pdu;
fill_ul_config(ul_config, frame_tx, slot_tx, FAPI_NR_UL_CONFIG_TYPE_PUSCH);
......@@ -1155,12 +1156,10 @@ 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
......@@ -2312,7 +2311,7 @@ int nr_ue_process_rar(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_t
return -1;
}
AssertFatal(ul_config->number_pdus < sizeof(ul_config->ul_config_list) / sizeof(ul_config->ul_config_list[0]),
"Number of PDUS in ul_config > ul_config_list num elements");
"Number of PDUS in ul_config = %d > ul_config_list num elements", ul_config->number_pdus);
nfapi_nr_ue_pusch_pdu_t *pusch_config_pdu = &ul_config->ul_config_list[ul_config->number_pdus].pusch_config_pdu;
fill_ul_config(ul_config, frame_tx, slot_tx, FAPI_NR_UL_CONFIG_TYPE_PUSCH);
......
......@@ -57,7 +57,7 @@ static ssb_list_info_t ssb_list;
void fill_ul_config(fapi_nr_ul_config_request_t *ul_config, frame_t frame_tx, int slot_tx, uint8_t pdu_type){
AssertFatal(ul_config->number_pdus < sizeof(ul_config->ul_config_list) / sizeof(ul_config->ul_config_list[0]),
"Number of PDUS in ul_config > ul_config_list num elements");
"Number of PDUS in ul_config = %d > ul_config_list num elements", ul_config->number_pdus);
ul_config->ul_config_list[ul_config->number_pdus].pdu_type = pdu_type;
ul_config->slot = slot_tx;
ul_config->sfn = frame_tx;
......@@ -812,7 +812,6 @@ NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_in
// Type0 PDCCH search space
if((search_space_mask & type0_pdcch) || ( mac->type0_pdcch_consecutive_slots != 0 )){
mac->type0_pdcch_consecutive_slots = mac->type0_pdcch_consecutive_slots - 1;
dl_config->dl_config_list[dl_config->number_pdus].dci_config_pdu.dci_config_rel15 = mac->type0_pdcch_dci_config;
dl_config->dl_config_list[dl_config->number_pdus].pdu_type = FAPI_NR_DL_CONFIG_TYPE_DCI;
......@@ -943,7 +942,7 @@ NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_in
tx_req.tx_request_body[0].pdu_index = j;
tx_req.tx_request_body[0].pdu = ulsch_input_buffer;
if ((ra->ra_state != RA_SUCCEEDED && !ra->cfra) || (get_softmodem_params()->nsa && ra->cfra && ra->ra_state==RA_SUCCEEDED)){
if ((ra->ra_state != RA_SUCCEEDED && !ra->cfra) || (get_softmodem_params()->nsa && ra->cfra && ra->ra_state == RA_SUCCEEDED)){
nr_Msg3_transmitted(ul_info->module_id, ul_info->cc_id, ul_info->frame_tx, ul_info->gNB_index);
}
}
......@@ -1691,7 +1690,7 @@ void nr_ue_prach_scheduler(module_id_t module_idP, frame_t frameP, sub_frame_t s
format0 = format & 0xff; // single PRACH format
format1 = (format >> 8) & 0xff; // dual PRACH format
AssertFatal(ul_config->number_pdus < sizeof(ul_config->ul_config_list) / sizeof(ul_config->ul_config_list[0]),
"Number of PDUS in ul_config > ul_config_list num elements");
"Number of PDUS in ul_config = %d > ul_config_list num elements", ul_config->number_pdus);
prach_config_pdu = &ul_config->ul_config_list[ul_config->number_pdus].prach_config_pdu;
memset(prach_config_pdu, 0, sizeof(*prach_config_pdu));
ul_config->number_pdus += 1;
......
......@@ -200,6 +200,47 @@ void send_nsa_standalone_msg(NR_UL_IND_t *UL_INFO, uint16_t msg_id)
}
}
static void set_dci_format(fapi_nr_dci_indication_pdu_t *dci_list, NR_UE_MAC_INST_t *UE_mac)
{
/* Melissa: If the dci_list comes in slot 7, and has a PDCCH payload then it must be the RAR.
If it is the RAR, we have not handled the RX_IND from the tx_data request yet, so the
mac->dl_config_request in the mac instance hasnt been updated with the num_pdus > 0, meaning
that when we try to fill this dci_format in the function call below, the num_pdus = 0 and we never
fill it. Since the dci_format field is initialized to zero this is not incorrectly setting the format,
but it is also not explicityly setting it, which I think is bad.
Maybe we just set dci_format = NR_DL_DCI_FORMAT_1_0 since we know this is the RAR? */
int num_pdus = UE_mac->dl_config_request.number_pdus;
if (num_pdus <= 0)
{
LOG_E(NR_PHY, "%s: dl_config_request number of PDUS (%d) <= 0\n", __FUNCTION__, num_pdus);
return;
}
AssertFatal(num_pdus < sizeof(UE_mac->dl_config_request.dl_config_list) / sizeof(UE_mac->dl_config_request.dl_config_list[0]),
"Number of PDUs (%d) exceeds dl_config_pdu list size.", num_pdus);
for (int i = 0; i < num_pdus; i++)
{
fapi_nr_dl_config_dci_dl_pdu_rel15_t *rel15_dci = &UE_mac->dl_config_request.dl_config_list[i].dci_config_pdu.dci_config_rel15;
int num_dci_options = rel15_dci->num_dci_options;
LOG_I(NR_MAC, "Melissa this is the num_dci_opts %d\n", rel15_dci->num_dci_options);
int len = sizeof(rel15_dci->dci_length_options) / sizeof(rel15_dci->dci_length_options[0]);
AssertFatal(len <= sizeof(rel15_dci->dci_length_options) / sizeof(rel15_dci->dci_length_options[0]),
"num_dci_options %d > dci_options array\n", num_dci_options);
AssertFatal(len <= sizeof(rel15_dci->dci_format_options) / sizeof(rel15_dci->dci_format_options[0]),
"num_dci_options %d > dci_options array\n", num_dci_options);
for (int j = 0; j < len; j++)
{
LOG_I(NR_PHY, "Received len %d, length options[%d] %d, format assigned %d, format options[%d] %d\n",
dci_list->payloadSize, j, rel15_dci->dci_length_options[j],
dci_list->dci_format, j, rel15_dci->dci_format_options[j]);
if (rel15_dci->dci_length_options[j] == dci_list->payloadSize)
{
dci_list->dci_format = rel15_dci->dci_format_options[j];
}
}
}
}
static void copy_dl_tti_req_to_dl_info(nr_downlink_indication_t *dl_info, nfapi_nr_dl_tti_request_t *dl_tti_request)
{
int num_pdus = dl_tti_request->dl_tti_request_body.nPDUs;
......@@ -209,6 +250,7 @@ static void copy_dl_tti_req_to_dl_info(nr_downlink_indication_t *dl_info, nfapi_
abort();
}
NR_UE_MAC_INST_t *UE_mac = get_mac_inst(0);
for (int i = 0; i < num_pdus; i++)
{
nfapi_nr_dl_tti_request_pdu_t *pdu_list = &dl_tti_request->dl_tti_request_body.dl_tti_pdu_list[i];
......@@ -248,6 +290,7 @@ static void copy_dl_tti_req_to_dl_info(nr_downlink_indication_t *dl_info, nfapi_
dl_info->dci_ind->dci_list[j].dci_format = 7;
if (dci_pdu_list->PayloadSizeBits == 46) //Melissa: hack. This size is for DLSCH
dl_info->dci_ind->dci_list[j].dci_format = 1;
//set_dci_format(&dl_info->dci_ind->dci_list[j], UE_mac);
}
}
}
......@@ -301,11 +344,13 @@ static void copy_ul_dci_data_req_to_dl_info(nr_downlink_indication_t *dl_info, n
LOG_E(NR_PHY, "%s: ul_dci_request number of PDUS <= 0\n", __FUNCTION__);
abort();
}
NR_UE_MAC_INST_t *UE_mac = get_mac_inst(0);
for (int i = 0; i < num_pdus; i++)
{
nfapi_nr_ul_dci_request_pdus_t *pdu_list = &ul_dci_req->ul_dci_pdu_list[i];
AssertFatal(pdu_list->PDUType == 0, "ul_dci_req pdu type != PUCCH");
LOG_I(NR_PHY, "[%d %d] PUCCH PDU in ul_dci for rnti %x\n", ul_dci_req->SFN, ul_dci_req->SFN, pdu_list->pdcch_pdu.pdcch_pdu_rel15.dci_pdu->RNTI);
LOG_I(NR_PHY, "[%d %d] PUCCH PDU in ul_dci for rnti %x\n", ul_dci_req->SFN, ul_dci_req->Slot, pdu_list->pdcch_pdu.pdcch_pdu_rel15.dci_pdu->RNTI);
uint16_t num_dci = pdu_list->pdcch_pdu.pdcch_pdu_rel15.numDlDci;
if (num_dci > 0)
{
......@@ -332,6 +377,7 @@ static void copy_ul_dci_data_req_to_dl_info(nr_downlink_indication_t *dl_info, n
dl_info->dci_ind->dci_list[j].dci_format = 7;
if (dci_pdu_list->PayloadSizeBits == 46) //Melissa: hack. This size is for DLSCH
dl_info->dci_ind->dci_list[j].dci_format = 1;
//set_dci_format(&dl_info->dci_ind->dci_list[j], UE_mac);
}
}
}
......@@ -602,7 +648,7 @@ int nr_ue_dl_indication(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_
NR_UE_MAC_INST_t *mac = get_mac_inst(module_id);
fapi_nr_dl_config_request_t *dl_config = &mac->dl_config_request;
if (!dl_info->dci_ind && !dl_info->rx_ind || !def_dci_pdu_rel15) { //Melissa review this with Raymond
if ((!dl_info->dci_ind && !dl_info->rx_ind) || (!def_dci_pdu_rel15)) { //Melissa review this with Raymond
// UL indication to schedule DCI reception
nr_ue_scheduler(dl_info, NULL);
} else {
......
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