Commit b96df49e authored by francescomani's avatar francescomani

postpone initialization of UL_tti_req_ahead to when sl_ahead is available

parent 9a43678e
...@@ -60,7 +60,7 @@ int nr_phy_init_RU(RU_t *ru) { ...@@ -60,7 +60,7 @@ int nr_phy_init_RU(RU_t *ru) {
for (i=0; i<ru->nb_tx; i++) { for (i=0; i<ru->nb_tx; i++) {
// Allocate 10 subframes of I/Q TX signal data (time) if not // Allocate 10 subframes of I/Q TX signal data (time) if not
ru->common.txdata[i] = (int32_t*)malloc16_clear( ru->sf_extension + (fp->samples_per_frame*sizeof(int32_t) )); ru->common.txdata[i] = (int32_t*)malloc16_clear((ru->sf_extension + fp->samples_per_frame)*sizeof(int32_t));
LOG_I(PHY,"[INIT] common.txdata[%d] = %p (%lu bytes,sf_extension %d)\n",i,ru->common.txdata[i], LOG_I(PHY,"[INIT] common.txdata[%d] = %p (%lu bytes,sf_extension %d)\n",i,ru->common.txdata[i],
(ru->sf_extension + fp->samples_per_frame)*sizeof(int32_t),ru->sf_extension); (ru->sf_extension + fp->samples_per_frame)*sizeof(int32_t),ru->sf_extension);
ru->common.txdata[i] = &ru->common.txdata[i][ru->sf_extension]; ru->common.txdata[i] = &ru->common.txdata[i][ru->sf_extension];
......
...@@ -462,8 +462,7 @@ int nr_mac_enable_ue_rrc_processing_timer(module_id_t Mod_idP, rnti_t rnti, NR_S ...@@ -462,8 +462,7 @@ int nr_mac_enable_ue_rrc_processing_timer(module_id_t Mod_idP, rnti_t rnti, NR_S
return -1; return -1;
} }
NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl; NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl;
const uint16_t sf_ahead = 6/(0x01<<subcarrierSpacing) + ((6%(0x01<<subcarrierSpacing))>0); const uint16_t sl_ahead = RC.nrmac[Mod_idP]->if_inst->sl_ahead;
const uint16_t sl_ahead = sf_ahead * (0x01<<subcarrierSpacing);
sched_ctrl->rrc_processing_timer = (rrc_reconfiguration_delay<<subcarrierSpacing) + sl_ahead; sched_ctrl->rrc_processing_timer = (rrc_reconfiguration_delay<<subcarrierSpacing) + sl_ahead;
LOG_I(NR_MAC, "Activating RRC processing timer for UE %04x with %d ms\n", UE_info->rnti, rrc_reconfiguration_delay); LOG_I(NR_MAC, "Activating RRC processing timer for UE %04x with %d ms\n", UE_info->rnti, rrc_reconfiguration_delay);
...@@ -486,19 +485,7 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP, ...@@ -486,19 +485,7 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP,
if (scc != NULL ) { if (scc != NULL ) {
AssertFatal((scc->ssb_PositionsInBurst->present > 0) && (scc->ssb_PositionsInBurst->present < 4), "SSB Bitmap type %d is not valid\n",scc->ssb_PositionsInBurst->present); AssertFatal((scc->ssb_PositionsInBurst->present > 0) && (scc->ssb_PositionsInBurst->present < 4), "SSB Bitmap type %d is not valid\n",scc->ssb_PositionsInBurst->present);
/* dimension UL_tti_req_ahead for number of slots in frame */
const int n = nr_slots_per_frame[*scc->ssbSubcarrierSpacing]; const int n = nr_slots_per_frame[*scc->ssbSubcarrierSpacing];
RC.nrmac[Mod_idP]->UL_tti_req_ahead[0] = calloc(n, sizeof(nfapi_nr_ul_tti_request_t));
AssertFatal(RC.nrmac[Mod_idP]->UL_tti_req_ahead[0],
"could not allocate memory for RC.nrmac[]->UL_tti_req_ahead[]\n");
/* fill in slot/frame numbers: slot is fixed, frame will be updated by scheduler
* consider that scheduler runs sl_ahead: the first sl_ahead slots are
* already "in the past" and thus we put frame 1 instead of 0! */
for (int i = 0; i < n; ++i) {
nfapi_nr_ul_tti_request_t *req = &RC.nrmac[Mod_idP]->UL_tti_req_ahead[0][i];
req->SFN = i < (RC.nrmac[Mod_idP]->if_inst->sl_ahead-1);
req->Slot = i;
}
RC.nrmac[Mod_idP]->common_channels[0].vrb_map_UL = RC.nrmac[Mod_idP]->common_channels[0].vrb_map_UL =
calloc(n * MAX_BWP_SIZE, sizeof(uint16_t)); calloc(n * MAX_BWP_SIZE, sizeof(uint16_t));
AssertFatal(RC.nrmac[Mod_idP]->common_channels[0].vrb_map_UL, AssertFatal(RC.nrmac[Mod_idP]->common_channels[0].vrb_map_UL,
......
...@@ -68,6 +68,9 @@ void clear_nr_nfapi_information(gNB_MAC_INST * gNB, ...@@ -68,6 +68,9 @@ void clear_nr_nfapi_information(gNB_MAC_INST * gNB,
NR_ServingCellConfigCommon_t *scc = gNB->common_channels->ServingCellConfigCommon; NR_ServingCellConfigCommon_t *scc = gNB->common_channels->ServingCellConfigCommon;
const int num_slots = nr_slots_per_frame[*scc->ssbSubcarrierSpacing]; const int num_slots = nr_slots_per_frame[*scc->ssbSubcarrierSpacing];
if(gNB->init_UL_tti_req_ahead == false)
UL_tti_req_ahead_initialization(gNB, scc, num_slots);
nfapi_nr_dl_tti_request_t *DL_req = &gNB->DL_req[0]; nfapi_nr_dl_tti_request_t *DL_req = &gNB->DL_req[0];
nfapi_nr_dl_tti_pdcch_pdu_rel15_t **pdcch = (nfapi_nr_dl_tti_pdcch_pdu_rel15_t **)gNB->pdcch_pdu_idx[CC_idP]; nfapi_nr_dl_tti_pdcch_pdu_rel15_t **pdcch = (nfapi_nr_dl_tti_pdcch_pdu_rel15_t **)gNB->pdcch_pdu_idx[CC_idP];
nfapi_nr_ul_tti_request_t *future_ul_tti_req = nfapi_nr_ul_tti_request_t *future_ul_tti_req =
......
...@@ -2996,3 +2996,19 @@ void schedule_nr_bwp_switch(module_id_t module_id, ...@@ -2996,3 +2996,19 @@ void schedule_nr_bwp_switch(module_id_t module_id,
} }
} }
} }
void UL_tti_req_ahead_initialization(gNB_MAC_INST * gNB, NR_ServingCellConfigCommon_t *scc, int n) {
gNB->UL_tti_req_ahead[0] = calloc(n, sizeof(nfapi_nr_ul_tti_request_t));
AssertFatal(gNB->UL_tti_req_ahead[0],
"could not allocate memory for RC.nrmac[]->UL_tti_req_ahead[]\n");
/* fill in slot/frame numbers: slot is fixed, frame will be updated by scheduler
* consider that scheduler runs sl_ahead: the first sl_ahead slots are
* already "in the past" and thus we put frame 1 instead of 0! */
for (int i = 0; i < n; ++i) {
nfapi_nr_ul_tti_request_t *req = &gNB->UL_tti_req_ahead[0][i];
req->SFN = i < (gNB->if_inst->sl_ahead-1);
req->Slot = i;
}
gNB->init_UL_tti_req_ahead = true;
}
...@@ -532,6 +532,8 @@ int get_mcs_from_bler(const NR_bler_options_t *bler_options, ...@@ -532,6 +532,8 @@ int get_mcs_from_bler(const NR_bler_options_t *bler_options,
int max_mcs, int max_mcs,
frame_t frame); frame_t frame);
void UL_tti_req_ahead_initialization(gNB_MAC_INST * gNB, NR_ServingCellConfigCommon_t *scc, int n);
void nr_sr_reporting(gNB_MAC_INST *nrmac, frame_t frameP, sub_frame_t slotP); void nr_sr_reporting(gNB_MAC_INST *nrmac, frame_t frameP, sub_frame_t slotP);
void dump_mac_stats(gNB_MAC_INST *gNB, char *output, int strlen, bool reset_rsrp); void dump_mac_stats(gNB_MAC_INST *gNB, char *output, int strlen, bool reset_rsrp);
......
...@@ -850,6 +850,7 @@ typedef struct gNB_MAC_INST_s { ...@@ -850,6 +850,7 @@ typedef struct gNB_MAC_INST_s {
uint8_t harq_round_max; uint8_t harq_round_max;
uint8_t min_grant_prb; uint8_t min_grant_prb;
uint8_t min_grant_mcs; uint8_t min_grant_mcs;
bool init_UL_tti_req_ahead;
} gNB_MAC_INST; } gNB_MAC_INST;
#endif /*__LAYER2_NR_MAC_GNB_H__ */ #endif /*__LAYER2_NR_MAC_GNB_H__ */
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