Commit b202ab7d authored by Robert Schmidt's avatar Robert Schmidt

RA Msg3 allocation: check in vrb_map_UL, allocate in UL_tti_req_ahead

parent e300b072
...@@ -447,8 +447,6 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, ...@@ -447,8 +447,6 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
RC.nrmac[module_idP]->current_slot=slot; RC.nrmac[module_idP]->current_slot=slot;
if (get_softmodem_params()->phy_test == 0) { if (get_softmodem_params()->phy_test == 0) {
nr_schedule_RA(module_idP, frame, slot); nr_schedule_RA(module_idP, frame, slot);
nr_schedule_reception_msg3(module_idP, 0, frame, slot);
} }
// This schedules the DCI for Uplink and subsequently PUSCH // This schedules the DCI for Uplink and subsequently PUSCH
......
...@@ -562,7 +562,9 @@ void nr_schedule_RA(module_id_t module_idP, frame_t frameP, sub_frame_t slotP){ ...@@ -562,7 +562,9 @@ void nr_schedule_RA(module_id_t module_idP, frame_t frameP, sub_frame_t slotP){
stop_meas(&mac->schedule_ra); stop_meas(&mac->schedule_ra);
} }
void nr_get_Msg3alloc(NR_ServingCellConfigCommon_t *scc, void nr_get_Msg3alloc(module_id_t module_id,
int CC_id,
NR_ServingCellConfigCommon_t *scc,
NR_BWP_Uplink_t *ubwp, NR_BWP_Uplink_t *ubwp,
sub_frame_t current_slot, sub_frame_t current_slot,
frame_t current_frame, frame_t current_frame,
...@@ -596,27 +598,25 @@ void nr_get_Msg3alloc(NR_ServingCellConfigCommon_t *scc, ...@@ -596,27 +598,25 @@ void nr_get_Msg3alloc(NR_ServingCellConfigCommon_t *scc,
ra->Msg3_frame = current_frame + (temp_slot/nr_slots_per_frame[mu]); ra->Msg3_frame = current_frame + (temp_slot/nr_slots_per_frame[mu]);
LOG_I(MAC, "[RAPROC] Msg3 slot %d: current slot %u Msg3 frame %u k2 %u Msg3_tda_id %u start symbol index %u\n", ra->Msg3_slot, current_slot, ra->Msg3_frame, k2,ra->Msg3_tda_id, StartSymbolIndex); LOG_I(MAC, "[RAPROC] Msg3 slot %d: current slot %u Msg3 frame %u k2 %u Msg3_tda_id %u start symbol index %u\n", ra->Msg3_slot, current_slot, ra->Msg3_frame, k2,ra->Msg3_tda_id, StartSymbolIndex);
ra->msg3_nb_rb = 18; uint16_t *vrb_map_UL =
ra->msg3_first_rb = 0; &RC.nrmac[module_id]->common_channels[CC_id].vrb_map_UL[ra->Msg3_slot * 275];
} const uint16_t bwpSize = NRRIV2BW(ubwp->bwp_Common->genericParameters.locationAndBandwidth, 275);
/* search 18 free RBs */
int rbSize = 0;
void nr_schedule_reception_msg3(module_id_t module_idP, int CC_id, frame_t frameP, sub_frame_t slotP){ int rbStart = 0;
gNB_MAC_INST *mac = RC.nrmac[module_idP]; while (rbSize < 18) {
nfapi_nr_ul_tti_request_t *ul_req = &mac->UL_tti_req[0]; rbStart += rbSize; /* last iteration rbSize was not enough, skip it */
NR_COMMON_channels_t *cc = &mac->common_channels[CC_id]; rbSize = 0;
NR_RA_t *ra = &cc->ra[0]; while (rbStart < bwpSize && vrb_map_UL[rbStart])
rbStart++;
if (ra->state == WAIT_Msg3) { AssertFatal(rbStart < bwpSize - 18, "no space to allocate Msg 3 for RA!\n");
if ((frameP == ra->Msg3_frame) && (slotP == ra->Msg3_slot) ){ while (rbStart + rbSize < bwpSize
ul_req->SFN = ra->Msg3_frame; && !vrb_map_UL[rbStart + rbSize]
ul_req->Slot = ra->Msg3_slot; && rbSize < 18)
ul_req->pdus_list[ul_req->n_pdus].pdu_type = NFAPI_NR_UL_CONFIG_PUSCH_PDU_TYPE; rbSize++;
ul_req->pdus_list[ul_req->n_pdus].pdu_size = sizeof(nfapi_nr_pusch_pdu_t);
ul_req->pdus_list[ul_req->n_pdus].pusch_pdu = ra->pusch_pdu;
ul_req->n_pdus+=1;
}
} }
ra->msg3_nb_rb = 18;
ra->msg3_first_rb = rbStart;
} }
void nr_add_msg3(module_id_t module_idP, int CC_id, frame_t frameP, sub_frame_t slotP){ void nr_add_msg3(module_id_t module_idP, int CC_id, frame_t frameP, sub_frame_t slotP){
...@@ -631,10 +631,32 @@ void nr_add_msg3(module_id_t module_idP, int CC_id, frame_t frameP, sub_frame_t ...@@ -631,10 +631,32 @@ void nr_add_msg3(module_id_t module_idP, int CC_id, frame_t frameP, sub_frame_t
return; return;
} }
uint16_t *vrb_map_UL =
&RC.nrmac[module_idP]->common_channels[CC_id].vrb_map_UL[ra->Msg3_slot * 275];
for (int i = 0; i < ra->msg3_nb_rb; ++i) {
AssertFatal(!vrb_map_UL[i + ra->msg3_first_rb],
"RB %d in %4d.%2d is already taken, cannot allocate Msg3!\n",
i + ra->msg3_first_rb,
ra->Msg3_frame,
ra->Msg3_slot);
vrb_map_UL[i + ra->msg3_first_rb] = 1;
}
LOG_I(MAC, "[gNB %d][RAPROC] Frame %d, Subframe %d : CC_id %d RA is active, Msg3 in (%d,%d)\n", module_idP, frameP, slotP, CC_id, ra->Msg3_frame, ra->Msg3_slot); LOG_I(MAC, "[gNB %d][RAPROC] Frame %d, Subframe %d : CC_id %d RA is active, Msg3 in (%d,%d)\n", module_idP, frameP, slotP, CC_id, ra->Msg3_frame, ra->Msg3_slot);
nfapi_nr_pusch_pdu_t *pusch_pdu = &ra->pusch_pdu; nfapi_nr_ul_tti_request_t *future_ul_tti_req = &RC.nrmac[module_idP]->UL_tti_req_ahead[CC_id][ra->Msg3_slot];
AssertFatal(future_ul_tti_req->SFN == ra->Msg3_frame
&& future_ul_tti_req->Slot == ra->Msg3_slot,
"future UL_tti_req's frame.slot %d.%d does not match PUSCH %d.%d\n",
future_ul_tti_req->SFN,
future_ul_tti_req->Slot,
ra->Msg3_frame,
ra->Msg3_slot);
future_ul_tti_req->pdus_list[future_ul_tti_req->n_pdus].pdu_type = NFAPI_NR_UL_CONFIG_PUSCH_PDU_TYPE;
future_ul_tti_req->pdus_list[future_ul_tti_req->n_pdus].pdu_size = sizeof(nfapi_nr_pusch_pdu_t);
nfapi_nr_pusch_pdu_t *pusch_pdu = &future_ul_tti_req->pdus_list[future_ul_tti_req->n_pdus].pusch_pdu;
memset(pusch_pdu, 0, sizeof(nfapi_nr_pusch_pdu_t)); memset(pusch_pdu, 0, sizeof(nfapi_nr_pusch_pdu_t));
future_ul_tti_req->n_pdus += 1;
AssertFatal(ra->secondaryCellGroup, AssertFatal(ra->secondaryCellGroup,
"no secondaryCellGroup for RNTI %04x\n", "no secondaryCellGroup for RNTI %04x\n",
...@@ -913,7 +935,7 @@ void nr_generate_Msg2(module_id_t module_idP, ...@@ -913,7 +935,7 @@ void nr_generate_Msg2(module_id_t module_idP,
dl_req->nPDUs+=2; dl_req->nPDUs+=2;
// Program UL processing for Msg3 // Program UL processing for Msg3
nr_get_Msg3alloc(scc, ubwp, slotP, frameP, ra); nr_get_Msg3alloc(module_idP, CC_id, scc, ubwp, slotP, frameP, ra);
LOG_I(MAC, "Frame %d, Subframe %d: Setting Msg3 reception for Frame %d Subframe %d\n", frameP, slotP, ra->Msg3_frame, ra->Msg3_slot); LOG_I(MAC, "Frame %d, Subframe %d: Setting Msg3 reception for Frame %d Subframe %d\n", frameP, slotP, ra->Msg3_frame, ra->Msg3_slot);
nr_add_msg3(module_idP, CC_id, frameP, slotP); nr_add_msg3(module_idP, CC_id, frameP, slotP);
ra->state = WAIT_Msg3; ra->state = WAIT_Msg3;
......
...@@ -115,7 +115,9 @@ void nr_clear_ra_proc(module_id_t module_idP, int CC_id, frame_t frameP); ...@@ -115,7 +115,9 @@ void nr_clear_ra_proc(module_id_t module_idP, int CC_id, frame_t frameP);
int nr_allocate_CCEs(int module_idP, int CC_idP, frame_t frameP, sub_frame_t slotP, int test_only); int nr_allocate_CCEs(int module_idP, int CC_idP, frame_t frameP, sub_frame_t slotP, int test_only);
void nr_get_Msg3alloc(NR_ServingCellConfigCommon_t *scc, void nr_get_Msg3alloc(module_id_t module_id,
int CC_id,
NR_ServingCellConfigCommon_t *scc,
NR_BWP_Uplink_t *ubwp, NR_BWP_Uplink_t *ubwp,
sub_frame_t current_subframe, sub_frame_t current_subframe,
frame_t current_frame, frame_t current_frame,
...@@ -356,8 +358,6 @@ void nr_generate_Msg2(module_id_t module_idP, ...@@ -356,8 +358,6 @@ void nr_generate_Msg2(module_id_t module_idP,
frame_t frameP, frame_t frameP,
sub_frame_t slotP); sub_frame_t slotP);
void nr_schedule_reception_msg3(module_id_t module_idP, int CC_id, frame_t frameP, sub_frame_t slotP);
void nr_process_mac_pdu( void nr_process_mac_pdu(
module_id_t module_idP, module_id_t module_idP,
rnti_t rnti, rnti_t rnti,
......
...@@ -142,8 +142,6 @@ typedef struct { ...@@ -142,8 +142,6 @@ typedef struct {
uint8_t msg3_cqireq; uint8_t msg3_cqireq;
/// Round of Msg3 HARQ /// Round of Msg3 HARQ
uint8_t msg3_round; uint8_t msg3_round;
/// Msg3 pusch pdu
nfapi_nr_pusch_pdu_t pusch_pdu;
/// TBS used for Msg4 /// TBS used for Msg4
int msg4_TBsize; int msg4_TBsize;
/// MCS used for Msg4 /// MCS used for Msg4
......
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