Commit f45e8bbe authored by Robert Schmidt's avatar Robert Schmidt

UL_tti_req_ahead: Create PUSCH PDU directly within nr_fill_nfapi_ul_pdu()

Use a "future" UL_tti_req structure to save in between scheduling and
reception slots. Should also work for FDD.
parent ee9268fe
...@@ -322,6 +322,13 @@ int rrc_mac_config_req_gNB(module_id_t Mod_idP, ...@@ -322,6 +322,13 @@ 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 uint8_t slots_per_frame[5] = {10, 20, 40, 80, 160};
const int n = 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");
LOG_I(MAC,"Configuring common parameters from NR ServingCellConfig\n"); LOG_I(MAC,"Configuring common parameters from NR ServingCellConfig\n");
config_common(Mod_idP, config_common(Mod_idP,
......
...@@ -285,26 +285,34 @@ void schedule_nr_SRS(module_id_t module_idP, frame_t frameP, sub_frame_t subfram ...@@ -285,26 +285,34 @@ void schedule_nr_SRS(module_id_t module_idP, frame_t frameP, sub_frame_t subfram
*/ */
void nr_schedule_pusch(int Mod_idP, void nr_schedule_pusch(int mod_id, frame_t frame, sub_frame_t slot) {
int UE_id, nfapi_nr_ul_tti_request_t *ul_tti_req = &RC.nrmac[mod_id]->UL_tti_req[0];
int num_slots_per_tdd, nfapi_nr_ul_tti_request_t *future_ul_tti_req =
int ul_slots, &RC.nrmac[mod_id]->UL_tti_req_ahead[0][slot];
frame_t frameP,
sub_frame_t slotP) { if (future_ul_tti_req->Slot == slot
&& future_ul_tti_req->SFN == frame
nfapi_nr_ul_tti_request_t *UL_tti_req = &RC.nrmac[Mod_idP]->UL_tti_req[0]; && future_ul_tti_req->n_pdus > 0) {
NR_UE_info_t *UE_info = &RC.nrmac[Mod_idP]->UE_info; LOG_D(MAC, "%4d.%2d copy %d PDUs from future_ul_tti_req\n", frame, slot, future_ul_tti_req->n_pdus);
int k = slotP + ul_slots - num_slots_per_tdd; /* the future_UL_tti_req_has data for the current frame/slot pair, copy
NR_sched_pusch *pusch = &UE_info->UE_sched_ctrl[UE_id].sched_pusch[k]; * everything into the "real" UL_tti_req */
if ((pusch->active == true) && (frameP == pusch->frame) && (slotP == pusch->slot)) { ul_tti_req->SFN = future_ul_tti_req->SFN;
UL_tti_req->SFN = pusch->frame; ul_tti_req->Slot = future_ul_tti_req->Slot;
UL_tti_req->Slot = pusch->slot; ul_tti_req->n_pdus = future_ul_tti_req->n_pdus;
UL_tti_req->pdus_list[UL_tti_req->n_pdus].pdu_type = NFAPI_NR_UL_CONFIG_PUSCH_PDU_TYPE; ul_tti_req->rach_present = future_ul_tti_req->rach_present;
UL_tti_req->pdus_list[UL_tti_req->n_pdus].pdu_size = sizeof(nfapi_nr_pusch_pdu_t); ul_tti_req->n_ulsch = future_ul_tti_req->n_ulsch;
UL_tti_req->pdus_list[UL_tti_req->n_pdus].pusch_pdu = pusch->pusch_pdu; ul_tti_req->n_ulcch = future_ul_tti_req->n_ulcch;
UL_tti_req->n_pdus+=1; ul_tti_req->n_group = future_ul_tti_req->n_group;
memset((void *) &UE_info->UE_sched_ctrl[UE_id].sched_pusch[k], memcpy(ul_tti_req->pdus_list,
0, sizeof(NR_sched_pusch)); future_ul_tti_req->pdus_list,
ul_tti_req->n_pdus * sizeof(nfapi_nr_ul_tti_request_number_of_pdus_t));
memcpy(ul_tti_req->groups_list,
future_ul_tti_req->groups_list,
ul_tti_req->n_group * sizeof(nfapi_nr_ul_tti_request_number_of_groups_t));
future_ul_tti_req->n_pdus = 0;
future_ul_tti_req->n_ulsch = 0;
future_ul_tti_req->n_ulcch = 0;
future_ul_tti_req->n_group = 0;
} }
} }
...@@ -433,9 +441,9 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP, ...@@ -433,9 +441,9 @@ void gNB_dlsch_ulsch_scheduler(module_id_t module_idP,
// inside // inside
if (UE_info->active[UE_id] && slot < 10) { if (UE_info->active[UE_id] && slot < 10) {
nr_schedule_ulsch(module_idP, frame, slot, num_slots_per_tdd, nr_ulmix_slots, ulsch_in_slot_bitmap); nr_schedule_ulsch(module_idP, frame, slot, num_slots_per_tdd, nr_ulmix_slots, ulsch_in_slot_bitmap);
nr_schedule_pusch(module_idP, UE_id, num_slots_per_tdd, nr_ulmix_slots, frame, slot);
} }
nr_schedule_pusch(module_idP, frame, slot);
if (UE_info->active[UE_id] if (UE_info->active[UE_id]
&& (is_xlsch_in_slot(dlsch_in_slot_bitmap, slot % num_slots_per_tdd)) && (is_xlsch_in_slot(dlsch_in_slot_bitmap, slot % num_slots_per_tdd))
......
...@@ -499,9 +499,10 @@ void nr_schedule_ulsch(module_id_t module_id, ...@@ -499,9 +499,10 @@ void nr_schedule_ulsch(module_id_t module_id,
* period, slot 8 (for K2=2, this is at slot 6 in the gNB; because of UE * period, slot 8 (for K2=2, this is at slot 6 in the gNB; because of UE
* limitations). Note that if K2 or the TDD configuration is changed, below * limitations). Note that if K2 or the TDD configuration is changed, below
* conditions might exclude each other and never be true */ * conditions might exclude each other and never be true */
const int slot_idx = (slot + K2) % num_slots_per_tdd; const int sched_frame = frame + (slot + K2 >= num_slots_per_tdd);
if (is_xlsch_in_slot(ulsch_in_slot_bitmap, slot_idx) const int sched_slot = (slot + K2) % num_slots_per_tdd;
&& (!get_softmodem_params()->phy_test || slot_idx == 8)) { if (is_xlsch_in_slot(ulsch_in_slot_bitmap, sched_slot)
&& (!get_softmodem_params()->phy_test || sched_slot == 8)) {
const int target_ss = NR_SearchSpace__searchSpaceType_PR_ue_Specific; const int target_ss = NR_SearchSpace__searchSpaceType_PR_ue_Specific;
NR_SearchSpace_t *ss = get_searchspace(bwp, target_ss); NR_SearchSpace_t *ss = get_searchspace(bwp, target_ss);
...@@ -536,15 +537,20 @@ void nr_schedule_ulsch(module_id_t module_id, ...@@ -536,15 +537,20 @@ void nr_schedule_ulsch(module_id_t module_id,
uint16_t rnti = UE_info->rnti[UE_id]; uint16_t rnti = UE_info->rnti[UE_id];
int first_ul_slot = num_slots_per_tdd - ul_slots; /* PUSCH in a later slot, but corresponding DCI now! */
NR_sched_pusch *pusch_sched = &UE_info->UE_sched_ctrl[UE_id].sched_pusch[slot+K2-first_ul_slot]; nfapi_nr_ul_tti_request_t *future_ul_tti_req = &RC.nrmac[module_id]->UL_tti_req_ahead[0][sched_slot];
pusch_sched->frame = frame; future_ul_tti_req->SFN = sched_frame;
pusch_sched->slot = slot + K2; future_ul_tti_req->Slot = sched_slot;
pusch_sched->active = true; nfapi_nr_ul_dci_request_t *ul_dci_req = &RC.nrmac[module_id]->UL_dci_req[0];
ul_dci_req->SFN = frame;
LOG_D(MAC, "Scheduling UE specific PUSCH\n"); ul_dci_req->Slot = slot;
//UL_tti_req = &nr_mac->UL_tti_req[CC_id]; 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));
future_ul_tti_req->n_pdus += 1;
LOG_D(MAC, "%4d.%2d Scheduling UE specific PUSCH\n", frame, slot);
int dci_formats[2]; int dci_formats[2];
if (ss->searchSpaceType->choice.ue_Specific->dci_Formats) if (ss->searchSpaceType->choice.ue_Specific->dci_Formats)
...@@ -554,8 +560,6 @@ void nr_schedule_ulsch(module_id_t module_id, ...@@ -554,8 +560,6 @@ void nr_schedule_ulsch(module_id_t module_id,
int rnti_types[2] = { NR_RNTI_C, 0 }; int rnti_types[2] = { NR_RNTI_C, 0 };
nfapi_nr_pusch_pdu_t *pusch_pdu = &pusch_sched->pusch_pdu;
memset(pusch_pdu,0,sizeof(nfapi_nr_pusch_pdu_t));
//Resource Allocation in time domain //Resource Allocation in time domain
const int startSymbolAndLength = tdaList->list.array[tda]->startSymbolAndLength; const int startSymbolAndLength = tdaList->list.array[tda]->startSymbolAndLength;
int StartSymbolIndex, NrOfSymbols; int StartSymbolIndex, NrOfSymbols;
...@@ -709,7 +713,7 @@ void nr_schedule_ulsch(module_id_t module_id, ...@@ -709,7 +713,7 @@ void nr_schedule_ulsch(module_id_t module_id,
pusch_pdu->pusch_data.rv_index = nr_rv_round_map[cur_harq->round]; pusch_pdu->pusch_data.rv_index = nr_rv_round_map[cur_harq->round];
cur_harq->state = ACTIVE_SCHED; cur_harq->state = ACTIVE_SCHED;
cur_harq->last_tx_slot = pusch_sched->slot; cur_harq->last_tx_slot = sched_slot;
uint8_t num_dmrs_symb = 0; uint8_t num_dmrs_symb = 0;
for(int i = pusch_pdu->start_symbol_index; i < pusch_pdu->start_symbol_index + pusch_pdu->nr_of_symbols; i++) for(int i = pusch_pdu->start_symbol_index; i < pusch_pdu->start_symbol_index + pusch_pdu->nr_of_symbols; i++)
......
...@@ -178,12 +178,7 @@ void config_uldci(NR_BWP_Uplink_t *ubwp, ...@@ -178,12 +178,7 @@ void config_uldci(NR_BWP_Uplink_t *ubwp,
int time_domain_assignment, uint8_t tpc, int time_domain_assignment, uint8_t tpc,
int n_ubwp, int bwp_id); int n_ubwp, int bwp_id);
void nr_schedule_pusch(int Mod_idP, void nr_schedule_pusch(int Mod_idP, frame_t frameP, sub_frame_t slotP);
int UE_id,
int num_slots_per_tdd,
int ul_slots,
frame_t frameP,
sub_frame_t slotP);
void nr_schedule_pucch(int Mod_idP, void nr_schedule_pucch(int Mod_idP,
int UE_id, int UE_id,
......
...@@ -469,6 +469,9 @@ typedef struct gNB_MAC_INST_s { ...@@ -469,6 +469,9 @@ typedef struct gNB_MAC_INST_s {
nfapi_nr_dl_tti_request_t DL_req[NFAPI_CC_MAX]; nfapi_nr_dl_tti_request_t DL_req[NFAPI_CC_MAX];
/// NFAPI UL TTI Request Structure (this is from the new SCF specs) /// NFAPI UL TTI Request Structure (this is from the new SCF specs)
nfapi_nr_ul_tti_request_t UL_tti_req[NFAPI_CC_MAX]; nfapi_nr_ul_tti_request_t UL_tti_req[NFAPI_CC_MAX];
/// NFAPI UL TTI Request Structure for future TTIs, dynamically allocated
/// because length depends on number of slots
nfapi_nr_ul_tti_request_t *UL_tti_req_ahead[NFAPI_CC_MAX];
/// NFAPI HI/DCI0 Config Request Structure /// NFAPI HI/DCI0 Config Request Structure
nfapi_nr_ul_dci_request_t UL_dci_req[NFAPI_CC_MAX]; nfapi_nr_ul_dci_request_t UL_dci_req[NFAPI_CC_MAX];
/// NFAPI DL PDU structure /// NFAPI DL PDU structure
......
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