Commit d5a7a1a3 authored by Melissa Elkadi's avatar Melissa Elkadi

Filling RACH ind with prach_pdu

Also added logs for handling Msg3 and
initialized ul_config->num_pdus at every
received slot ind instead of every time
we call get_ul_config()
parent 4f0c8fbf
...@@ -145,7 +145,7 @@ void init_nrUE_standalone_thread(int ue_idx) ...@@ -145,7 +145,7 @@ void init_nrUE_standalone_thread(int ue_idx)
pthread_setname_np(phy_thread, "oai:nrue-stand-phy"); pthread_setname_np(phy_thread, "oai:nrue-stand-phy");
} }
static void L1_nsa_prach_procedures(frame_t frame, int slot) static void L1_nsa_prach_procedures(frame_t frame, int slot, fapi_nr_ul_config_prach_pdu *prach_pdu)
{ {
nfapi_nr_rach_indication_t rach_ind; nfapi_nr_rach_indication_t rach_ind;
memset(&rach_ind, 0, sizeof(rach_ind)); memset(&rach_ind, 0, sizeof(rach_ind));
...@@ -156,10 +156,10 @@ static void L1_nsa_prach_procedures(frame_t frame, int slot) ...@@ -156,10 +156,10 @@ static void L1_nsa_prach_procedures(frame_t frame, int slot)
uint8_t pdu_index = 0; uint8_t pdu_index = 0;
rach_ind.pdu_list = CALLOC(1, sizeof(*rach_ind.pdu_list)); rach_ind.pdu_list = CALLOC(1, sizeof(*rach_ind.pdu_list));
rach_ind.number_of_pdus = 1; rach_ind.number_of_pdus = 1;
rach_ind.pdu_list[pdu_index].phy_cell_id = 0; rach_ind.pdu_list[pdu_index].phy_cell_id = prach_pdu->phys_cell_id;
rach_ind.pdu_list[pdu_index].symbol_index = 0; rach_ind.pdu_list[pdu_index].symbol_index = prach_pdu->prach_start_symbol;
rach_ind.pdu_list[pdu_index].slot_index = slot; rach_ind.pdu_list[pdu_index].slot_index = prach_pdu->prach_slot;
rach_ind.pdu_list[pdu_index].freq_index = 0; //Melissa Fill these things from the prach pdu rach_ind.pdu_list[pdu_index].freq_index = prach_pdu->num_ra; //Melissa Fill these things from the prach pdu
rach_ind.pdu_list[pdu_index].avg_rssi = 128; rach_ind.pdu_list[pdu_index].avg_rssi = 128;
rach_ind.pdu_list[pdu_index].avg_snr = 0xff; // invalid for now rach_ind.pdu_list[pdu_index].avg_snr = 0xff; // invalid for now
...@@ -204,11 +204,16 @@ static void *NRUE_phy_stub_standalone_pnf_task(void *arg) ...@@ -204,11 +204,16 @@ static void *NRUE_phy_stub_standalone_pnf_task(void *arg)
} }
mac->ra.generate_nr_prach = 0; mac->ra.generate_nr_prach = 0;
int CC_id = 0;
uint8_t gNB_id = 0;
frame_t frame = NFAPI_SFNSLOT2SFN(sfn_slot); frame_t frame = NFAPI_SFNSLOT2SFN(sfn_slot);
int slot = NFAPI_SFNSLOT2SLOT(sfn_slot); int slot = NFAPI_SFNSLOT2SLOT(sfn_slot);
nr_uplink_indication_t ul_info; nr_uplink_indication_t ul_info;
int slots_per_frame = 20; //30 kHZ subcarrier spacing int slots_per_frame = 20; //30 kHZ subcarrier spacing
int slot_ahead = 6; // Melissa lets make this dynamic int slot_ahead = 6; // Melissa lets make this dynamic
ul_info.cc_id = CC_id;
ul_info.gNB_index = gNB_id;
ul_info.module_id = mod_id;
ul_info.frame_rx = frame; ul_info.frame_rx = frame;
ul_info.slot_rx = slot; ul_info.slot_rx = slot;
ul_info.slot_tx = (slot + slot_ahead) % slots_per_frame; ul_info.slot_tx = (slot + slot_ahead) % slots_per_frame;
...@@ -219,23 +224,34 @@ static void *NRUE_phy_stub_standalone_pnf_task(void *arg) ...@@ -219,23 +224,34 @@ static void *NRUE_phy_stub_standalone_pnf_task(void *arg)
fapi_nr_ul_config_request_t *ul_config = get_ul_config_request(mac, ul_info.slot_tx); fapi_nr_ul_config_request_t *ul_config = get_ul_config_request(mac, ul_info.slot_tx);
if (!ul_config) { if (!ul_config) {
LOG_E(NR_MAC, "mac->ul_config is null! \n"); LOG_E(NR_MAC, "mac->ul_config is null! \n");
return; continue;
} }
int CC_id = 0; ul_config->number_pdus = 0;
uint8_t gNB_id = 0;
fapi_nr_ul_config_prach_pdu *prach_pdu = &ul_config->ul_config_list[ul_config->number_pdus].prach_config_pdu; 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); 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);
if (nr_prach == 1) if (nr_prach == 1)
{ {
L1_nsa_prach_procedures(ul_info.frame_tx, ul_info.slot_tx); L1_nsa_prach_procedures(ul_info.frame_tx, ul_info.slot_tx, prach_pdu);
LOG_I(NR_PHY, "Calling nr_Msg1_transmitted for slot %d\n", ul_info.slot_tx); LOG_I(NR_PHY, "Calling nr_Msg1_transmitted for slot %d\n", ul_info.slot_tx);
nr_Msg1_transmitted(mod_id, CC_id, ul_info.frame_tx, gNB_id); //This is called when phy layer has sent the prach nr_Msg1_transmitted(mod_id, CC_id, ul_info.frame_tx, gNB_id);
} }
else if (nr_prach == 2) else if (nr_prach == 2)
{ {
LOG_I(NR_PHY, "In %s: [UE %d] RA completed, setting UE mode to PUSCH\n", __FUNCTION__, mod_id); LOG_I(NR_PHY, "In %s: [UE %d] RA completed, setting UE mode to PUSCH\n", __FUNCTION__, mod_id);
return NULL;
#if 0
See if we can receive DCI format 0-1; then program ulsch
if (ul_config....msg3 flag == 1 && frame = ulcconfig.frame && slot == ul_config.slot)
{
fill_rx_ind of the gNb(&ul_config or &txdata_req);
nr_Msg3_transmitted(0, 0, frame, gNB_id);
}
// Melissa call this in the right slot and fill rx_ind for gNB: Msg3_transmitted(0, 0, frame, 0);
//UE->UE_mode[0] = PUSCH; //UE->UE_mode[0] = PUSCH;
#endif
} }
else if(nr_prach == 3) else if(nr_prach == 3)
{ {
......
...@@ -467,7 +467,7 @@ void nr_Msg3_transmitted(module_id_t mod_id, uint8_t CC_id, frame_t frameP, uint ...@@ -467,7 +467,7 @@ void nr_Msg3_transmitted(module_id_t mod_id, uint8_t CC_id, frame_t frameP, uint
NR_RACH_ConfigCommon_t *nr_rach_ConfigCommon = mac->scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup; NR_RACH_ConfigCommon_t *nr_rach_ConfigCommon = mac->scc->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup;
RA_config_t *ra = &mac->ra; RA_config_t *ra = &mac->ra;
LOG_D(MAC,"In %s: [UE %d] Frame %d, CB-RA: starting contention resolution timer\n", __FUNCTION__, mod_id, frameP); LOG_I(MAC,"Melissa In %s: [UE %d] Frame %d, CB-RA: starting contention resolution timer\n", __FUNCTION__, mod_id, frameP);
// start contention resolution timer // start contention resolution timer
ra->RA_contention_resolution_cnt = (nr_rach_ConfigCommon->ra_ContentionResolutionTimer + 1) * 8; ra->RA_contention_resolution_cnt = (nr_rach_ConfigCommon->ra_ContentionResolutionTimer + 1) * 8;
......
...@@ -2182,7 +2182,7 @@ int nr_ue_process_rar(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_t ...@@ -2182,7 +2182,7 @@ int nr_ue_process_rar(nr_downlink_indication_t *dl_info, NR_UL_TIME_ALIGNMENT_t
int ret = 0; int ret = 0;
NR_RA_HEADER_RAPID *rarh = (NR_RA_HEADER_RAPID *) dlsch_buffer; // RAR subheader pointer NR_RA_HEADER_RAPID *rarh = (NR_RA_HEADER_RAPID *) dlsch_buffer; // RAR subheader pointer
NR_MAC_RAR *rar = (NR_MAC_RAR *) (dlsch_buffer + 1); // RAR subPDU pointer NR_MAC_RAR *rar = (NR_MAC_RAR *) (dlsch_buffer + 1); // RAR subPDU pointer
uint8_t preamble_index = 63; //Melissa get_ra_PreambleIndex(mod_id, cc_id, gNB_id); //prach_resources->ra_PreambleIndex; uint8_t preamble_index = mac->ra.rach_ConfigDedicated->cfra->resources.choice.ssb->ssb_ResourceList.list.array[0]->ra_PreambleIndex;
LOG_D(MAC, "In %s:[%d.%d]: [UE %d][RAPROC] invoking MAC for received RAR (current preamble %d)\n", __FUNCTION__, frame, slot, mod_id, preamble_index); LOG_D(MAC, "In %s:[%d.%d]: [UE %d][RAPROC] invoking MAC for received RAR (current preamble %d)\n", __FUNCTION__, frame, slot, mod_id, preamble_index);
......
...@@ -61,7 +61,7 @@ void fill_ul_config(fapi_nr_ul_config_request_t *ul_config, frame_t frame_tx, in ...@@ -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->sfn = frame_tx;
ul_config->number_pdus++; ul_config->number_pdus++;
LOG_D(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); 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);
} }
...@@ -141,7 +141,6 @@ fapi_nr_ul_config_request_t *get_ul_config_request(NR_UE_MAC_INST_t *mac, int sl ...@@ -141,7 +141,6 @@ fapi_nr_ul_config_request_t *get_ul_config_request(NR_UE_MAC_INST_t *mac, int sl
if(!mac->ul_config_request) if(!mac->ul_config_request)
return NULL; return NULL;
mac->ul_config_request[index].number_pdus = 0;
return &mac->ul_config_request[index]; return &mac->ul_config_request[index];
} }
...@@ -942,9 +941,10 @@ NR_UE_L2_STATE_t nr_ue_scheduler(nr_downlink_indication_t *dl_info, nr_uplink_in ...@@ -942,9 +941,10 @@ 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_index = j;
tx_req.tx_request_body[0].pdu = ulsch_input_buffer; tx_req.tx_request_body[0].pdu = ulsch_input_buffer;
if (ra->ra_state != RA_SUCCEEDED && !ra->cfra){ if (ra->ra_state == RA_SUCCEEDED && ra->cfra){
nr_Msg3_transmitted(ul_info->module_id, ul_info->cc_id, ul_info->frame_tx, ul_info->gNB_index); nr_Msg3_transmitted(ul_info->module_id, ul_info->cc_id, ul_info->frame_tx, ul_info->gNB_index);
} }
//Melissa, should I send tx_req to gNB here??
} }
} }
...@@ -1023,7 +1023,7 @@ int nr_ue_pusch_scheduler(NR_UE_MAC_INST_t *mac, ...@@ -1023,7 +1023,7 @@ int nr_ue_pusch_scheduler(NR_UE_MAC_INST_t *mac,
} }
LOG_D(MAC, "In %s: currently at [%d.%d] UL transmission in [%d.%d] (k2 %d delta %d)\n", __FUNCTION__, current_frame, current_slot, *frame_tx, *slot_tx, k2, delta); LOG_I(MAC, "Melissa Elkadi In %s: currently at [%d.%d] UL transmission in [%d.%d] (k2 %d delta %d)\n", __FUNCTION__, current_frame, current_slot, *frame_tx, *slot_tx, k2, delta);
return 0; return 0;
......
...@@ -205,7 +205,7 @@ static void copy_tx_data_req_to_dl_info(nr_downlink_indication_t *dl_info, nfapi ...@@ -205,7 +205,7 @@ static void copy_tx_data_req_to_dl_info(nr_downlink_indication_t *dl_info, nfapi
dl_info->rx_ind = CALLOC(1, sizeof(fapi_nr_rx_indication_t)); dl_info->rx_ind = CALLOC(1, sizeof(fapi_nr_rx_indication_t));
dl_info->rx_ind->sfn = tx_data_request->SFN; dl_info->rx_ind->sfn = tx_data_request->SFN;
dl_info->rx_ind->slot = tx_data_request->Slot; dl_info->rx_ind->slot = tx_data_request->Slot;
dl_info->rx_ind->number_pdus = tx_data_request->Number_of_PDUs; //Melissa, not sure we want this set like this dl_info->rx_ind->number_pdus = num_pdus;
for (int i = 0; i < num_pdus; i++) for (int i = 0; i < num_pdus; i++)
{ {
......
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