Commit d28000c4 authored by Robert Schmidt's avatar Robert Schmidt

Restructure NR_UE_sched_ctrl_t: Group PDSCH variables in struct

parent aa298eaa
...@@ -254,9 +254,9 @@ void schedule_control_sib1(module_id_t module_id, ...@@ -254,9 +254,9 @@ void schedule_control_sib1(module_id_t module_id,
} }
gNB_mac->sched_ctrlCommon->active_bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition = NULL; gNB_mac->sched_ctrlCommon->active_bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_AdditionalPosition = NULL;
gNB_mac->sched_ctrlCommon->time_domain_allocation = time_domain_allocation; gNB_mac->sched_ctrlCommon->sched_pdsch.time_domain_allocation = time_domain_allocation;
gNB_mac->sched_ctrlCommon->mcsTableIdx = mcsTableIdx; gNB_mac->sched_ctrlCommon->sched_pdsch.mcsTableIdx = mcsTableIdx;
gNB_mac->sched_ctrlCommon->mcs = mcs; gNB_mac->sched_ctrlCommon->sched_pdsch.mcs = mcs;
gNB_mac->sched_ctrlCommon->num_total_bytes = num_total_bytes; gNB_mac->sched_ctrlCommon->num_total_bytes = num_total_bytes;
uint8_t nr_of_candidates; uint8_t nr_of_candidates;
...@@ -277,18 +277,19 @@ void schedule_control_sib1(module_id_t module_id, ...@@ -277,18 +277,19 @@ void schedule_control_sib1(module_id_t module_id,
// Calculate number of symbols // Calculate number of symbols
struct NR_PDSCH_TimeDomainResourceAllocationList *tdaList = gNB_mac->sched_ctrlCommon->active_bwp->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList; struct NR_PDSCH_TimeDomainResourceAllocationList *tdaList = gNB_mac->sched_ctrlCommon->active_bwp->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList;
const int startSymbolAndLength = tdaList->list.array[gNB_mac->sched_ctrlCommon->time_domain_allocation]->startSymbolAndLength; const int startSymbolAndLength =
tdaList->list.array[gNB_mac->sched_ctrlCommon->sched_pdsch.time_domain_allocation]->startSymbolAndLength;
int startSymbolIndex, nrOfSymbols; int startSymbolIndex, nrOfSymbols;
SLIV2SL(startSymbolAndLength, &startSymbolIndex, &nrOfSymbols); SLIV2SL(startSymbolAndLength, &startSymbolIndex, &nrOfSymbols);
if (nrOfSymbols == 2) { if (nrOfSymbols == 2) {
gNB_mac->sched_ctrlCommon->numDmrsCdmGrpsNoData = 1; gNB_mac->sched_ctrlCommon->sched_pdsch.numDmrsCdmGrpsNoData = 1;
} else { } else {
gNB_mac->sched_ctrlCommon->numDmrsCdmGrpsNoData = 2; gNB_mac->sched_ctrlCommon->sched_pdsch.numDmrsCdmGrpsNoData = 2;
} }
// Calculate number of PRB_DMRS // Calculate number of PRB_DMRS
uint8_t N_PRB_DMRS = gNB_mac->sched_ctrlCommon->numDmrsCdmGrpsNoData * 6; uint8_t N_PRB_DMRS = gNB_mac->sched_ctrlCommon->sched_pdsch.numDmrsCdmGrpsNoData * 6;
uint16_t dlDmrsSymbPos = fill_dmrs_mask(gNB_mac->sched_ctrlCommon->active_bwp->bwp_Dedicated->pdsch_Config->choice.setup, gNB_mac->common_channels->ServingCellConfigCommon->dmrs_TypeA_Position, startSymbolIndex+nrOfSymbols); uint16_t dlDmrsSymbPos = fill_dmrs_mask(gNB_mac->sched_ctrlCommon->active_bwp->bwp_Dedicated->pdsch_Config->choice.setup, gNB_mac->common_channels->ServingCellConfigCommon->dmrs_TypeA_Position, startSymbolIndex+nrOfSymbols);
uint16_t dmrs_length = get_num_dmrs(dlDmrsSymbPos); uint16_t dmrs_length = get_num_dmrs(dlDmrsSymbPos);
...@@ -296,22 +297,24 @@ void schedule_control_sib1(module_id_t module_id, ...@@ -296,22 +297,24 @@ void schedule_control_sib1(module_id_t module_id,
uint32_t TBS = 0; uint32_t TBS = 0;
do { do {
rbSize++; rbSize++;
TBS = nr_compute_tbs(nr_get_Qm_dl(gNB_mac->sched_ctrlCommon->mcs, gNB_mac->sched_ctrlCommon->mcsTableIdx), TBS = nr_compute_tbs(nr_get_Qm_dl(gNB_mac->sched_ctrlCommon->sched_pdsch.mcs,
nr_get_code_rate_dl(gNB_mac->sched_ctrlCommon->mcs, gNB_mac->sched_ctrlCommon->mcsTableIdx), gNB_mac->sched_ctrlCommon->sched_pdsch.mcsTableIdx),
nr_get_code_rate_dl(gNB_mac->sched_ctrlCommon->sched_pdsch.mcs,
gNB_mac->sched_ctrlCommon->sched_pdsch.mcsTableIdx),
rbSize, nrOfSymbols, N_PRB_DMRS * dmrs_length,0, 0,1) >> 3; rbSize, nrOfSymbols, N_PRB_DMRS * dmrs_length,0, 0,1) >> 3;
} while (rbStart + rbSize < bwpSize && !vrb_map[rbStart + rbSize] && TBS < gNB_mac->sched_ctrlCommon->num_total_bytes); } while (rbStart + rbSize < bwpSize && !vrb_map[rbStart + rbSize] && TBS < gNB_mac->sched_ctrlCommon->num_total_bytes);
gNB_mac->sched_ctrlCommon->rbSize = rbSize; gNB_mac->sched_ctrlCommon->sched_pdsch.rbSize = rbSize;
gNB_mac->sched_ctrlCommon->rbStart = 0; gNB_mac->sched_ctrlCommon->sched_pdsch.rbStart = 0;
LOG_D(MAC,"SLIV = %i\n", startSymbolAndLength); LOG_D(MAC,"SLIV = %i\n", startSymbolAndLength);
LOG_D(MAC,"startSymbolIndex = %i\n", startSymbolIndex); LOG_D(MAC,"startSymbolIndex = %i\n", startSymbolIndex);
LOG_D(MAC,"nrOfSymbols = %i\n", nrOfSymbols); LOG_D(MAC,"nrOfSymbols = %i\n", nrOfSymbols);
LOG_D(MAC,"rbSize = %i\n", gNB_mac->sched_ctrlCommon->rbSize); LOG_D(MAC, "rbSize = %i\n", gNB_mac->sched_ctrlCommon->sched_pdsch.rbSize);
LOG_D(MAC,"TBS = %i\n", TBS); LOG_D(MAC,"TBS = %i\n", TBS);
// Mark the corresponding RBs as used // Mark the corresponding RBs as used
for (int rb = 0; rb < gNB_mac->sched_ctrlCommon->rbSize; rb++) { for (int rb = 0; rb < gNB_mac->sched_ctrlCommon->sched_pdsch.rbSize; rb++) {
vrb_map[rb + rbStart] = 1; vrb_map[rb + rbStart] = 1;
} }
} }
...@@ -364,9 +367,9 @@ void nr_fill_nfapi_dl_sib1_pdu(int Mod_idP, ...@@ -364,9 +367,9 @@ void nr_fill_nfapi_dl_sib1_pdu(int Mod_idP,
} }
pdsch_pdu_rel15->NrOfCodewords = 1; pdsch_pdu_rel15->NrOfCodewords = 1;
pdsch_pdu_rel15->targetCodeRate[0] = nr_get_code_rate_dl(gNB_mac->sched_ctrlCommon->mcs,0); pdsch_pdu_rel15->targetCodeRate[0] = nr_get_code_rate_dl(gNB_mac->sched_ctrlCommon->sched_pdsch.mcs, 0);
pdsch_pdu_rel15->qamModOrder[0] = 2; pdsch_pdu_rel15->qamModOrder[0] = 2;
pdsch_pdu_rel15->mcsIndex[0] = gNB_mac->sched_ctrlCommon->mcs; pdsch_pdu_rel15->mcsIndex[0] = gNB_mac->sched_ctrlCommon->sched_pdsch.mcs;
pdsch_pdu_rel15->mcsTable[0] = 0; pdsch_pdu_rel15->mcsTable[0] = 0;
pdsch_pdu_rel15->rvIndex[0] = nr_rv_round_map[0]; pdsch_pdu_rel15->rvIndex[0] = nr_rv_round_map[0];
pdsch_pdu_rel15->dataScramblingId = *scc->physCellId; pdsch_pdu_rel15->dataScramblingId = *scc->physCellId;
...@@ -376,15 +379,16 @@ void nr_fill_nfapi_dl_sib1_pdu(int Mod_idP, ...@@ -376,15 +379,16 @@ void nr_fill_nfapi_dl_sib1_pdu(int Mod_idP,
pdsch_pdu_rel15->dmrsConfigType = gNB_mac->sched_ctrlCommon->active_bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type == NULL ? 0 : 1; pdsch_pdu_rel15->dmrsConfigType = gNB_mac->sched_ctrlCommon->active_bwp->bwp_Dedicated->pdsch_Config->choice.setup->dmrs_DownlinkForPDSCH_MappingTypeA->choice.setup->dmrs_Type == NULL ? 0 : 1;
pdsch_pdu_rel15->dlDmrsScramblingId = *scc->physCellId; pdsch_pdu_rel15->dlDmrsScramblingId = *scc->physCellId;
pdsch_pdu_rel15->SCID = 0; pdsch_pdu_rel15->SCID = 0;
pdsch_pdu_rel15->numDmrsCdmGrpsNoData = gNB_mac->sched_ctrlCommon->numDmrsCdmGrpsNoData; pdsch_pdu_rel15->numDmrsCdmGrpsNoData = gNB_mac->sched_ctrlCommon->sched_pdsch.numDmrsCdmGrpsNoData;
pdsch_pdu_rel15->dmrsPorts = 1; pdsch_pdu_rel15->dmrsPorts = 1;
pdsch_pdu_rel15->resourceAlloc = 1; pdsch_pdu_rel15->resourceAlloc = 1;
pdsch_pdu_rel15->rbStart = gNB_mac->sched_ctrlCommon->rbStart; pdsch_pdu_rel15->rbStart = gNB_mac->sched_ctrlCommon->sched_pdsch.rbStart;
pdsch_pdu_rel15->rbSize = gNB_mac->sched_ctrlCommon->rbSize; pdsch_pdu_rel15->rbSize = gNB_mac->sched_ctrlCommon->sched_pdsch.rbSize;
pdsch_pdu_rel15->VRBtoPRBMapping = 0; pdsch_pdu_rel15->VRBtoPRBMapping = 0;
pdsch_pdu_rel15->qamModOrder[0] = nr_get_Qm_dl(gNB_mac->sched_ctrlCommon->mcs, gNB_mac->sched_ctrlCommon->mcsTableIdx); pdsch_pdu_rel15->qamModOrder[0] =
nr_get_Qm_dl(gNB_mac->sched_ctrlCommon->sched_pdsch.mcs, gNB_mac->sched_ctrlCommon->sched_pdsch.mcsTableIdx);
pdsch_pdu_rel15->TBSize[0] = TBS; pdsch_pdu_rel15->TBSize[0] = TBS;
pdsch_pdu_rel15->mcsTable[0] = gNB_mac->sched_ctrlCommon->mcsTableIdx; pdsch_pdu_rel15->mcsTable[0] = gNB_mac->sched_ctrlCommon->sched_pdsch.mcsTableIdx;
pdsch_pdu_rel15->StartSymbolIndex = StartSymbolIndex; pdsch_pdu_rel15->StartSymbolIndex = StartSymbolIndex;
pdsch_pdu_rel15->NrOfSymbols = NrOfSymbols; pdsch_pdu_rel15->NrOfSymbols = NrOfSymbols;
...@@ -413,8 +417,8 @@ void nr_fill_nfapi_dl_sib1_pdu(int Mod_idP, ...@@ -413,8 +417,8 @@ void nr_fill_nfapi_dl_sib1_pdu(int Mod_idP,
dci_payload.frequency_domain_assignment.val = PRBalloc_to_locationandbandwidth0( dci_payload.frequency_domain_assignment.val = PRBalloc_to_locationandbandwidth0(
pdsch_pdu_rel15->rbSize, pdsch_pdu_rel15->rbStart, gNB_mac->type0_PDCCH_CSS_config.num_rbs); pdsch_pdu_rel15->rbSize, pdsch_pdu_rel15->rbStart, gNB_mac->type0_PDCCH_CSS_config.num_rbs);
dci_payload.time_domain_assignment.val = gNB_mac->sched_ctrlCommon->time_domain_allocation; dci_payload.time_domain_assignment.val = gNB_mac->sched_ctrlCommon->sched_pdsch.time_domain_allocation;
dci_payload.mcs = gNB_mac->sched_ctrlCommon->mcs; dci_payload.mcs = gNB_mac->sched_ctrlCommon->sched_pdsch.mcs;
dci_payload.rv = pdsch_pdu_rel15->rvIndex[0]; dci_payload.rv = pdsch_pdu_rel15->rvIndex[0];
dci_payload.harq_pid = 0; dci_payload.harq_pid = 0;
dci_payload.ndi = 0; dci_payload.ndi = 0;
...@@ -484,17 +488,26 @@ void schedule_nr_sib1(module_id_t module_idP, frame_t frameP, sub_frame_t slotP) ...@@ -484,17 +488,26 @@ void schedule_nr_sib1(module_id_t module_idP, frame_t frameP, sub_frame_t slotP)
// Calculate number of symbols // Calculate number of symbols
int startSymbolIndex, nrOfSymbols; int startSymbolIndex, nrOfSymbols;
struct NR_PDSCH_TimeDomainResourceAllocationList *tdaList = gNB_mac->sched_ctrlCommon->active_bwp->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList; struct NR_PDSCH_TimeDomainResourceAllocationList *tdaList = gNB_mac->sched_ctrlCommon->active_bwp->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList;
const int startSymbolAndLength = tdaList->list.array[gNB_mac->sched_ctrlCommon->time_domain_allocation]->startSymbolAndLength; const int startSymbolAndLength =
tdaList->list.array[gNB_mac->sched_ctrlCommon->sched_pdsch.time_domain_allocation]->startSymbolAndLength;
SLIV2SL(startSymbolAndLength, &startSymbolIndex, &nrOfSymbols); SLIV2SL(startSymbolAndLength, &startSymbolIndex, &nrOfSymbols);
// Calculate number of PRB_DMRS // Calculate number of PRB_DMRS
uint8_t N_PRB_DMRS = gNB_mac->sched_ctrlCommon->numDmrsCdmGrpsNoData * 6; uint8_t N_PRB_DMRS = gNB_mac->sched_ctrlCommon->sched_pdsch.numDmrsCdmGrpsNoData * 6;
uint16_t dlDmrsSymbPos = fill_dmrs_mask(gNB_mac->sched_ctrlCommon->active_bwp->bwp_Dedicated->pdsch_Config->choice.setup, gNB_mac->common_channels->ServingCellConfigCommon->dmrs_TypeA_Position, startSymbolIndex+nrOfSymbols); uint16_t dlDmrsSymbPos = fill_dmrs_mask(gNB_mac->sched_ctrlCommon->active_bwp->bwp_Dedicated->pdsch_Config->choice.setup, gNB_mac->common_channels->ServingCellConfigCommon->dmrs_TypeA_Position, startSymbolIndex+nrOfSymbols);
uint16_t dmrs_length = get_num_dmrs(dlDmrsSymbPos); uint16_t dmrs_length = get_num_dmrs(dlDmrsSymbPos);
const uint32_t TBS = nr_compute_tbs(nr_get_Qm_dl(gNB_mac->sched_ctrlCommon->mcs, gNB_mac->sched_ctrlCommon->mcsTableIdx), const uint32_t TBS = nr_compute_tbs(nr_get_Qm_dl(gNB_mac->sched_ctrlCommon->sched_pdsch.mcs,
nr_get_code_rate_dl(gNB_mac->sched_ctrlCommon->mcs, gNB_mac->sched_ctrlCommon->mcsTableIdx), gNB_mac->sched_ctrlCommon->sched_pdsch.mcsTableIdx),
gNB_mac->sched_ctrlCommon->rbSize, nrOfSymbols, N_PRB_DMRS * dmrs_length,0 ,0 ,1 ) >> 3; nr_get_code_rate_dl(gNB_mac->sched_ctrlCommon->sched_pdsch.mcs,
gNB_mac->sched_ctrlCommon->sched_pdsch.mcsTableIdx),
gNB_mac->sched_ctrlCommon->sched_pdsch.rbSize,
nrOfSymbols,
N_PRB_DMRS * dmrs_length,
0,
0,
1)
>> 3;
nfapi_nr_dl_tti_request_body_t *dl_req = &gNB_mac->DL_req[CC_id].dl_tti_request_body; nfapi_nr_dl_tti_request_body_t *dl_req = &gNB_mac->DL_req[CC_id].dl_tti_request_body;
nr_fill_nfapi_dl_sib1_pdu(module_idP, dl_req, TBS, startSymbolIndex, nrOfSymbols); nr_fill_nfapi_dl_sib1_pdu(module_idP, dl_req, TBS, startSymbolIndex, nrOfSymbols);
......
...@@ -374,12 +374,10 @@ bool allocate_retransmission(module_id_t module_id, ...@@ -374,12 +374,10 @@ bool allocate_retransmission(module_id_t module_id,
int current_harq_pid) { int current_harq_pid) {
NR_UE_info_t *UE_info = &RC.nrmac[module_id]->UE_info; NR_UE_info_t *UE_info = &RC.nrmac[module_id]->UE_info;
NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id];
NR_UE_ret_info_t *retInfo = &sched_ctrl->retInfo[current_harq_pid]; NR_sched_pdsch_t *retInfo = &sched_ctrl->harq_processes[current_harq_pid].sched_pdsch;
const uint16_t bwpSize = NRRIV2BW(sched_ctrl->active_bwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); const uint16_t bwpSize = NRRIV2BW(sched_ctrl->active_bwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
int rbStart = NRRIV2PRBOFFSET(sched_ctrl->active_bwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE); int rbStart = NRRIV2PRBOFFSET(sched_ctrl->active_bwp->bwp_Common->genericParameters.locationAndBandwidth, MAX_BWP_SIZE);
sched_ctrl->time_domain_allocation = retInfo->time_domain_allocation;
/* Check the resource is enough for retransmission */ /* Check the resource is enough for retransmission */
/* ensure that there is a free place for RB allocation */ /* ensure that there is a free place for RB allocation */
int rbSize = 0; int rbSize = 0;
...@@ -426,19 +424,14 @@ bool allocate_retransmission(module_id_t module_id, ...@@ -426,19 +424,14 @@ bool allocate_retransmission(module_id_t module_id,
return false; return false;
} }
/* Allocate retransmission */ /* just reuse from previous scheduling opportunity, set new start RB */
sched_ctrl->rbSize = retInfo->rbSize; sched_ctrl->sched_pdsch = *retInfo;
sched_ctrl->rbStart = rbStart; sched_ctrl->sched_pdsch.rbStart = rbStart;
/* MCS etc: just reuse from previous scheduling opportunity */
sched_ctrl->mcsTableIdx = retInfo->mcsTableIdx;
sched_ctrl->mcs = retInfo->mcs;
sched_ctrl->numDmrsCdmGrpsNoData = retInfo->numDmrsCdmGrpsNoData;
/* retransmissions: directly allocate */ /* retransmissions: directly allocate */
*n_rb_sched -= sched_ctrl->rbSize; *n_rb_sched -= sched_ctrl->sched_pdsch.rbSize;
for (int rb = 0; rb < sched_ctrl->rbSize; rb++) for (int rb = 0; rb < sched_ctrl->sched_pdsch.rbSize; rb++)
rballoc_mask[rb+sched_ctrl->rbStart] = 0; rballoc_mask[rb + sched_ctrl->sched_pdsch.rbStart] = 0;
return true; return true;
} }
...@@ -461,10 +454,11 @@ void pf_dl(module_id_t module_id, ...@@ -461,10 +454,11 @@ void pf_dl(module_id_t module_id,
/* Loop UE_info->list to check retransmission */ /* Loop UE_info->list to check retransmission */
for (int UE_id = UE_list->head; UE_id >= 0; UE_id = UE_list->next[UE_id]) { for (int UE_id = UE_list->head; UE_id >= 0; UE_id = UE_list->next[UE_id]) {
NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id];
NR_sched_pdsch_t *sched_pdsch = &sched_ctrl->sched_pdsch;
sched_ctrl->search_space = get_searchspace(sched_ctrl->active_bwp, NR_SearchSpace__searchSpaceType_PR_ue_Specific); sched_ctrl->search_space = get_searchspace(sched_ctrl->active_bwp, NR_SearchSpace__searchSpaceType_PR_ue_Specific);
sched_ctrl->coreset = get_coreset(sched_ctrl->active_bwp, sched_ctrl->search_space, 1 /* dedicated */); sched_ctrl->coreset = get_coreset(sched_ctrl->active_bwp, sched_ctrl->search_space, 1 /* dedicated */);
/* get the PID of a HARQ process awaiting retrnasmission, or -1 otherwise */ /* get the PID of a HARQ process awaiting retrnasmission, or -1 otherwise */
sched_ctrl->dl_harq_pid = sched_ctrl->retrans_dl_harq.head; sched_pdsch->dl_harq_pid = sched_ctrl->retrans_dl_harq.head;
/* Calculate Throughput */ /* Calculate Throughput */
const float a = 0.0005f; // corresponds to 200ms window const float a = 0.0005f; // corresponds to 200ms window
...@@ -472,15 +466,10 @@ void pf_dl(module_id_t module_id, ...@@ -472,15 +466,10 @@ void pf_dl(module_id_t module_id,
thr_ue[UE_id] = (1 - a) * thr_ue[UE_id] + a * b; thr_ue[UE_id] = (1 - a) * thr_ue[UE_id] + a * b;
/* retransmission */ /* retransmission */
if (sched_ctrl->dl_harq_pid >= 0) { if (sched_pdsch->dl_harq_pid >= 0) {
/* Allocate retransmission */ /* Allocate retransmission */
bool r = allocate_retransmission(module_id, bool r =
frame, allocate_retransmission(module_id, frame, slot, rballoc_mask, &n_rb_sched, UE_id, sched_pdsch->dl_harq_pid);
slot,
rballoc_mask,
&n_rb_sched,
UE_id,
sched_ctrl->dl_harq_pid);
if (!r) { if (!r) {
LOG_D(MAC, "%4d.%2d retransmission can NOT be allocated\n", frame, slot); LOG_D(MAC, "%4d.%2d retransmission can NOT be allocated\n", frame, slot);
continue; continue;
...@@ -494,21 +483,20 @@ void pf_dl(module_id_t module_id, ...@@ -494,21 +483,20 @@ void pf_dl(module_id_t module_id,
continue; continue;
/* Calculate coeff */ /* Calculate coeff */
sched_ctrl->time_domain_allocation = 2; sched_pdsch->time_domain_allocation = 2;
sched_ctrl->mcsTableIdx = 0; sched_pdsch->mcsTableIdx = 0;
sched_ctrl->mcs = 9; sched_pdsch->mcs = 9;
sched_ctrl->numDmrsCdmGrpsNoData = 1; sched_pdsch->numDmrsCdmGrpsNoData = 1;
uint8_t N_PRB_DMRS = uint8_t N_PRB_DMRS = getN_PRB_DMRS(sched_ctrl->active_bwp, sched_ctrl->sched_pdsch.numDmrsCdmGrpsNoData);
getN_PRB_DMRS(sched_ctrl->active_bwp, sched_ctrl->numDmrsCdmGrpsNoData); int nrOfSymbols = getNrOfSymbols(sched_ctrl->active_bwp, sched_pdsch->time_domain_allocation);
int nrOfSymbols = getNrOfSymbols(sched_ctrl->active_bwp, uint32_t tbs = nr_compute_tbs(nr_get_Qm_dl(sched_pdsch->mcs, sched_pdsch->mcsTableIdx),
sched_ctrl->time_domain_allocation); nr_get_code_rate_dl(sched_pdsch->mcs, sched_pdsch->mcsTableIdx),
uint32_t tbs = nr_compute_tbs(nr_get_Qm_dl(sched_ctrl->mcs, sched_ctrl->mcsTableIdx),
nr_get_code_rate_dl(sched_ctrl->mcs, sched_ctrl->mcsTableIdx),
1, // rbSize 1, // rbSize
nrOfSymbols, nrOfSymbols,
N_PRB_DMRS, // FIXME // This should be multiplied by the N_PRB_DMRS, // FIXME // This should be multiplied by the
// number of dmrs symbols // number of dmrs symbols
0 /* N_PRB_oh, 0 for initialBWP */, 0 /* tb_scaling */, 0 /* N_PRB_oh, 0 for initialBWP */,
0 /* tb_scaling */,
1 /* nrOfLayers */) 1 /* nrOfLayers */)
>> 3; >> 3;
coeff_ue[UE_id] = (float) tbs / thr_ue[UE_id]; coeff_ue[UE_id] = (float) tbs / thr_ue[UE_id];
...@@ -573,22 +561,13 @@ void pf_dl(module_id_t module_id, ...@@ -573,22 +561,13 @@ void pf_dl(module_id_t module_id,
return; return;
} }
/* Allocate transmission */ /* MCS, TDA, etc. has been set above */
// Time-domain allocation
sched_ctrl->time_domain_allocation = 2;
// modulation scheme
sched_ctrl->mcsTableIdx = 0;
sched_ctrl->mcs = 9;
sched_ctrl->numDmrsCdmGrpsNoData = 1;
// Freq-demain allocation // Freq-demain allocation
while (rbStart < bwpSize && !rballoc_mask[rbStart]) rbStart++; while (rbStart < bwpSize && !rballoc_mask[rbStart]) rbStart++;
const uint8_t N_PRB_DMRS = const uint8_t N_PRB_DMRS = getN_PRB_DMRS(sched_ctrl->active_bwp, sched_ctrl->sched_pdsch.numDmrsCdmGrpsNoData);
getN_PRB_DMRS(sched_ctrl->active_bwp, sched_ctrl->numDmrsCdmGrpsNoData); const int nrOfSymbols = getNrOfSymbols(sched_ctrl->active_bwp, sched_ctrl->sched_pdsch.time_domain_allocation);
const int nrOfSymbols = getNrOfSymbols(sched_ctrl->active_bwp,
sched_ctrl->time_domain_allocation);
const NR_ServingCellConfigCommon_t *scc = RC.nrmac[module_id]->common_channels->ServingCellConfigCommon; const NR_ServingCellConfigCommon_t *scc = RC.nrmac[module_id]->common_channels->ServingCellConfigCommon;
const uint8_t N_DMRS_SLOT = get_num_dmrs_symbols( const uint8_t N_DMRS_SLOT = get_num_dmrs_symbols(
sched_ctrl->active_bwp->bwp_Dedicated->pdsch_Config->choice.setup, sched_ctrl->active_bwp->bwp_Dedicated->pdsch_Config->choice.setup,
...@@ -599,10 +578,11 @@ void pf_dl(module_id_t module_id, ...@@ -599,10 +578,11 @@ void pf_dl(module_id_t module_id,
uint32_t TBS = 0; uint32_t TBS = 0;
const int oh = 2 + (sched_ctrl->num_total_bytes >= 256) const int oh = 2 + (sched_ctrl->num_total_bytes >= 256)
+ 2 * (frame == (sched_ctrl->ta_frame + 10) % 1024); + 2 * (frame == (sched_ctrl->ta_frame + 10) % 1024);
NR_sched_pdsch_t *sched_pdsch = &sched_ctrl->sched_pdsch;
do { do {
rbSize++; rbSize++;
TBS = nr_compute_tbs(nr_get_Qm_dl(sched_ctrl->mcs, sched_ctrl->mcsTableIdx), TBS = nr_compute_tbs(nr_get_Qm_dl(sched_pdsch->mcs, sched_pdsch->mcsTableIdx),
nr_get_code_rate_dl(sched_ctrl->mcs, sched_ctrl->mcsTableIdx), nr_get_code_rate_dl(sched_pdsch->mcs, sched_pdsch->mcsTableIdx),
rbSize, rbSize,
nrOfSymbols, nrOfSymbols,
N_PRB_DMRS * N_DMRS_SLOT, N_PRB_DMRS * N_DMRS_SLOT,
...@@ -611,13 +591,13 @@ void pf_dl(module_id_t module_id, ...@@ -611,13 +591,13 @@ void pf_dl(module_id_t module_id,
1 /* nrOfLayers */) 1 /* nrOfLayers */)
>> 3; >> 3;
} while (rbStart + rbSize < bwpSize && rballoc_mask[rbStart + rbSize] && TBS < sched_ctrl->num_total_bytes + oh); } while (rbStart + rbSize < bwpSize && rballoc_mask[rbStart + rbSize] && TBS < sched_ctrl->num_total_bytes + oh);
sched_ctrl->rbSize = rbSize; sched_pdsch->rbSize = rbSize;
sched_ctrl->rbStart = rbStart; sched_pdsch->rbStart = rbStart;
/* transmissions: directly allocate */ /* transmissions: directly allocate */
n_rb_sched -= sched_ctrl->rbSize; n_rb_sched -= sched_pdsch->rbSize;
for (int rb = 0; rb < sched_ctrl->rbSize; rb++) for (int rb = 0; rb < sched_pdsch->rbSize; rb++)
rballoc_mask[rb+sched_ctrl->rbStart] = 0; rballoc_mask[rb + sched_pdsch->rbStart] = 0;
} }
} }
...@@ -677,6 +657,7 @@ void nr_schedule_ue_spec(module_id_t module_id, ...@@ -677,6 +657,7 @@ void nr_schedule_ue_spec(module_id_t module_id,
NR_list_t *UE_list = &UE_info->list; NR_list_t *UE_list = &UE_info->list;
for (int UE_id = UE_list->head; UE_id >= 0; UE_id = UE_list->next[UE_id]) { for (int UE_id = UE_list->head; UE_id >= 0; UE_id = UE_list->next[UE_id]) {
NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id]; NR_UE_sched_ctrl_t *sched_ctrl = &UE_info->UE_sched_ctrl[UE_id];
NR_sched_pdsch_t *sched_pdsch = &sched_ctrl->sched_pdsch;
UE_info->mac_stats[UE_id].dlsch_current_bytes = 0; UE_info->mac_stats[UE_id].dlsch_current_bytes = 0;
/* update TA and set ta_apply every 10 frames. /* update TA and set ta_apply every 10 frames.
...@@ -688,7 +669,7 @@ void nr_schedule_ue_spec(module_id_t module_id, ...@@ -688,7 +669,7 @@ void nr_schedule_ue_spec(module_id_t module_id,
LOG_D(MAC, "[UE %d][%d.%d] UL timing alignment procedures: setting flag for Timing Advance command\n", UE_id, frame, slot); LOG_D(MAC, "[UE %d][%d.%d] UL timing alignment procedures: setting flag for Timing Advance command\n", UE_id, frame, slot);
} }
if (sched_ctrl->rbSize <= 0) if (sched_pdsch->rbSize <= 0)
continue; continue;
const rnti_t rnti = UE_info->rnti[UE_id]; const rnti_t rnti = UE_info->rnti[UE_id];
...@@ -696,29 +677,27 @@ void nr_schedule_ue_spec(module_id_t module_id, ...@@ -696,29 +677,27 @@ void nr_schedule_ue_spec(module_id_t module_id,
/* POST processing */ /* POST processing */
struct NR_PDSCH_TimeDomainResourceAllocationList *tdaList = struct NR_PDSCH_TimeDomainResourceAllocationList *tdaList =
sched_ctrl->active_bwp->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList; sched_ctrl->active_bwp->bwp_Common->pdsch_ConfigCommon->choice.setup->pdsch_TimeDomainAllocationList;
AssertFatal(sched_ctrl->time_domain_allocation < tdaList->list.count, AssertFatal(sched_pdsch->time_domain_allocation < tdaList->list.count,
"time_domain_allocation %d>=%d\n", "time_domain_allocation %d>=%d\n",
sched_ctrl->time_domain_allocation, sched_pdsch->time_domain_allocation,
tdaList->list.count); tdaList->list.count);
const int startSymbolAndLength = const int startSymbolAndLength = tdaList->list.array[sched_pdsch->time_domain_allocation]->startSymbolAndLength;
tdaList->list.array[sched_ctrl->time_domain_allocation]->startSymbolAndLength;
int startSymbolIndex, nrOfSymbols; int startSymbolIndex, nrOfSymbols;
SLIV2SL(startSymbolAndLength, &startSymbolIndex, &nrOfSymbols); SLIV2SL(startSymbolAndLength, &startSymbolIndex, &nrOfSymbols);
uint8_t N_PRB_DMRS = uint8_t N_PRB_DMRS = getN_PRB_DMRS(sched_ctrl->active_bwp, sched_pdsch->numDmrsCdmGrpsNoData);
getN_PRB_DMRS(sched_ctrl->active_bwp, sched_ctrl->numDmrsCdmGrpsNoData);
uint8_t N_DMRS_SLOT = get_num_dmrs_symbols(sched_ctrl->active_bwp->bwp_Dedicated->pdsch_Config->choice.setup, uint8_t N_DMRS_SLOT = get_num_dmrs_symbols(sched_ctrl->active_bwp->bwp_Dedicated->pdsch_Config->choice.setup,
RC.nrmac[module_id]->common_channels->ServingCellConfigCommon->dmrs_TypeA_Position , RC.nrmac[module_id]->common_channels->ServingCellConfigCommon->dmrs_TypeA_Position ,
nrOfSymbols); nrOfSymbols);
const nfapi_nr_dmrs_type_e dmrsConfigType = getDmrsConfigType(sched_ctrl->active_bwp); const nfapi_nr_dmrs_type_e dmrsConfigType = getDmrsConfigType(sched_ctrl->active_bwp);
const int nrOfLayers = 1; const int nrOfLayers = 1;
const uint16_t R = nr_get_code_rate_dl(sched_ctrl->mcs, sched_ctrl->mcsTableIdx); /* TODO avoid recomputation! */
const uint8_t Qm = nr_get_Qm_dl(sched_ctrl->mcs, sched_ctrl->mcsTableIdx); const uint16_t R = nr_get_code_rate_dl(sched_pdsch->mcs, sched_pdsch->mcsTableIdx);
const uint32_t TBS = const uint8_t Qm = nr_get_Qm_dl(sched_pdsch->mcs, sched_pdsch->mcsTableIdx);
nr_compute_tbs(nr_get_Qm_dl(sched_ctrl->mcs, sched_ctrl->mcsTableIdx), const uint32_t TBS = nr_compute_tbs(nr_get_Qm_dl(sched_pdsch->mcs, sched_pdsch->mcsTableIdx),
nr_get_code_rate_dl(sched_ctrl->mcs, sched_ctrl->mcsTableIdx), nr_get_code_rate_dl(sched_pdsch->mcs, sched_pdsch->mcsTableIdx),
sched_ctrl->rbSize, sched_pdsch->rbSize,
nrOfSymbols, nrOfSymbols,
N_PRB_DMRS * N_DMRS_SLOT, N_PRB_DMRS * N_DMRS_SLOT,
0 /* N_PRB_oh, 0 for initialBWP */, 0 /* N_PRB_oh, 0 for initialBWP */,
...@@ -726,7 +705,7 @@ void nr_schedule_ue_spec(module_id_t module_id, ...@@ -726,7 +705,7 @@ void nr_schedule_ue_spec(module_id_t module_id,
nrOfLayers) nrOfLayers)
>> 3; >> 3;
int8_t current_harq_pid = sched_ctrl->dl_harq_pid; int8_t current_harq_pid = sched_pdsch->dl_harq_pid;
if (current_harq_pid < 0) { if (current_harq_pid < 0) {
/* PP has not selected a specific HARQ Process, get a new one */ /* PP has not selected a specific HARQ Process, get a new one */
current_harq_pid = sched_ctrl->available_dl_harq.head; current_harq_pid = sched_ctrl->available_dl_harq.head;
...@@ -734,7 +713,7 @@ void nr_schedule_ue_spec(module_id_t module_id, ...@@ -734,7 +713,7 @@ void nr_schedule_ue_spec(module_id_t module_id,
"no free HARQ process available for UE %d\n", "no free HARQ process available for UE %d\n",
UE_id); UE_id);
remove_front_nr_list(&sched_ctrl->available_dl_harq); remove_front_nr_list(&sched_ctrl->available_dl_harq);
sched_ctrl->dl_harq_pid = current_harq_pid; sched_pdsch->dl_harq_pid = current_harq_pid;
} else { } else {
/* PP selected a specific HARQ process. Check whether it will be a new /* PP selected a specific HARQ process. Check whether it will be a new
* transmission or a retransmission, and remove from the corresponding * transmission or a retransmission, and remove from the corresponding
...@@ -758,11 +737,11 @@ void nr_schedule_ue_spec(module_id_t module_id, ...@@ -758,11 +737,11 @@ void nr_schedule_ue_spec(module_id_t module_id,
frame, frame,
slot, slot,
rnti, rnti,
sched_ctrl->rbStart, sched_pdsch->rbStart,
sched_ctrl->rbSize, sched_pdsch->rbSize,
startSymbolIndex, startSymbolIndex,
nrOfSymbols, nrOfSymbols,
sched_ctrl->mcs, sched_pdsch->mcs,
TBS, TBS,
current_harq_pid, current_harq_pid,
harq->round, harq->round,
...@@ -818,8 +797,8 @@ void nr_schedule_ue_spec(module_id_t module_id, ...@@ -818,8 +797,8 @@ void nr_schedule_ue_spec(module_id_t module_id,
pdsch_pdu->NrOfCodewords = 1; pdsch_pdu->NrOfCodewords = 1;
pdsch_pdu->targetCodeRate[0] = R; pdsch_pdu->targetCodeRate[0] = R;
pdsch_pdu->qamModOrder[0] = Qm; pdsch_pdu->qamModOrder[0] = Qm;
pdsch_pdu->mcsIndex[0] = sched_ctrl->mcs; pdsch_pdu->mcsIndex[0] = sched_pdsch->mcs;
pdsch_pdu->mcsTable[0] = sched_ctrl->mcsTableIdx; pdsch_pdu->mcsTable[0] = sched_pdsch->mcsTableIdx;
pdsch_pdu->rvIndex[0] = nr_rv_round_map[harq->round]; pdsch_pdu->rvIndex[0] = nr_rv_round_map[harq->round];
pdsch_pdu->TBSize[0] = TBS; pdsch_pdu->TBSize[0] = TBS;
...@@ -836,13 +815,13 @@ void nr_schedule_ue_spec(module_id_t module_id, ...@@ -836,13 +815,13 @@ void nr_schedule_ue_spec(module_id_t module_id,
pdsch_pdu->dmrsConfigType = dmrsConfigType; pdsch_pdu->dmrsConfigType = dmrsConfigType;
pdsch_pdu->dlDmrsScramblingId = *scc->physCellId; pdsch_pdu->dlDmrsScramblingId = *scc->physCellId;
pdsch_pdu->SCID = 0; pdsch_pdu->SCID = 0;
pdsch_pdu->numDmrsCdmGrpsNoData = sched_ctrl->numDmrsCdmGrpsNoData; pdsch_pdu->numDmrsCdmGrpsNoData = sched_pdsch->numDmrsCdmGrpsNoData;
pdsch_pdu->dmrsPorts = 1; pdsch_pdu->dmrsPorts = 1;
// Pdsch Allocation in frequency domain // Pdsch Allocation in frequency domain
pdsch_pdu->resourceAlloc = 1; pdsch_pdu->resourceAlloc = 1;
pdsch_pdu->rbStart = sched_ctrl->rbStart; pdsch_pdu->rbStart = sched_pdsch->rbStart;
pdsch_pdu->rbSize = sched_ctrl->rbSize; pdsch_pdu->rbSize = sched_pdsch->rbSize;
pdsch_pdu->VRBtoPRBMapping = 1; // non-interleaved, check if this is ok for initialBWP pdsch_pdu->VRBtoPRBMapping = 1; // non-interleaved, check if this is ok for initialBWP
// Resource Allocation in time domain // Resource Allocation in time domain
...@@ -901,8 +880,8 @@ void nr_schedule_ue_spec(module_id_t module_id, ...@@ -901,8 +880,8 @@ void nr_schedule_ue_spec(module_id_t module_id,
pdsch_pdu->rbSize, pdsch_pdu->rbSize,
pdsch_pdu->rbStart, pdsch_pdu->rbStart,
pdsch_pdu->BWPSize); pdsch_pdu->BWPSize);
dci_payload.time_domain_assignment.val = sched_ctrl->time_domain_allocation; dci_payload.time_domain_assignment.val = sched_pdsch->time_domain_allocation;
dci_payload.mcs = sched_ctrl->mcs; dci_payload.mcs = sched_pdsch->mcs;
dci_payload.rv = pdsch_pdu->rvIndex[0]; dci_payload.rv = pdsch_pdu->rvIndex[0];
dci_payload.harq_pid = current_harq_pid; dci_payload.harq_pid = current_harq_pid;
dci_payload.ndi = harq->ndi; dci_payload.ndi = harq->ndi;
...@@ -947,29 +926,7 @@ void nr_schedule_ue_spec(module_id_t module_id, ...@@ -947,29 +926,7 @@ void nr_schedule_ue_spec(module_id_t module_id,
pdcch_pdu->StartSymbolIndex, pdcch_pdu->StartSymbolIndex,
pdcch_pdu->DurationSymbols); pdcch_pdu->DurationSymbols);
NR_UE_ret_info_t *retInfo = &sched_ctrl->retInfo[current_harq_pid];
if (harq->round != 0) { /* retransmission */ if (harq->round != 0) { /* retransmission */
if (sched_ctrl->rbSize != retInfo->rbSize)
LOG_W(MAC,
"retransmission uses different rbSize (%d vs. orig %d)\n",
sched_ctrl->rbSize,
retInfo->rbSize);
if (sched_ctrl->time_domain_allocation != retInfo->time_domain_allocation)
LOG_W(MAC,
"retransmission uses different time_domain_allocation (%d vs. orig %d)\n",
sched_ctrl->time_domain_allocation,
retInfo->time_domain_allocation);
if (sched_ctrl->mcs != retInfo->mcs
|| sched_ctrl->mcsTableIdx != retInfo->mcsTableIdx
|| sched_ctrl->numDmrsCdmGrpsNoData != retInfo->numDmrsCdmGrpsNoData)
LOG_W(MAC,
"retransmission uses different table/MCS/numDmrsCdmGrpsNoData (%d/%d/%d vs. orig %d/%d/%d)\n",
sched_ctrl->mcsTableIdx,
sched_ctrl->mcs,
sched_ctrl->numDmrsCdmGrpsNoData,
retInfo->mcsTableIdx,
retInfo->mcs,
retInfo->numDmrsCdmGrpsNoData);
/* we do not have to do anything, since we do not require to get data /* we do not have to do anything, since we do not require to get data
* from RLC or encode MAC CEs. The TX_req structure is filled below * from RLC or encode MAC CEs. The TX_req structure is filled below
* or copy data to FAPI structures */ * or copy data to FAPI structures */
...@@ -982,7 +939,7 @@ void nr_schedule_ue_spec(module_id_t module_id, ...@@ -982,7 +939,7 @@ void nr_schedule_ue_spec(module_id_t module_id,
current_harq_pid, current_harq_pid,
harq->round, harq->round,
harq->ndi); harq->ndi);
AssertFatal(harq->tb_size == TBS, AssertFatal(harq->sched_pdsch.tb_size == TBS,
"UE %d mismatch between scheduled TBS and buffered TB for HARQ PID %d\n", "UE %d mismatch between scheduled TBS and buffered TB for HARQ PID %d\n",
UE_id, UE_id,
current_harq_pid); current_harq_pid);
...@@ -1098,11 +1055,8 @@ void nr_schedule_ue_spec(module_id_t module_id, ...@@ -1098,11 +1055,8 @@ void nr_schedule_ue_spec(module_id_t module_id,
UE_info->mac_stats[UE_id].dlsch_current_bytes = TBS; UE_info->mac_stats[UE_id].dlsch_current_bytes = TBS;
UE_info->mac_stats[UE_id].lc_bytes_tx[lcid] += dlsch_total_bytes; UE_info->mac_stats[UE_id].lc_bytes_tx[lcid] += dlsch_total_bytes;
retInfo->rbSize = sched_ctrl->rbSize; /* save retransmission information */
retInfo->time_domain_allocation = sched_ctrl->time_domain_allocation; harq->sched_pdsch = *sched_pdsch;
retInfo->mcsTableIdx = sched_ctrl->mcsTableIdx;
retInfo->mcs = sched_ctrl->mcs;
retInfo->numDmrsCdmGrpsNoData = sched_ctrl->numDmrsCdmGrpsNoData;
// ta command is sent, values are reset // ta command is sent, values are reset
if (sched_ctrl->ta_apply) { if (sched_ctrl->ta_apply) {
...@@ -1131,6 +1085,6 @@ void nr_schedule_ue_spec(module_id_t module_id, ...@@ -1131,6 +1085,6 @@ void nr_schedule_ue_spec(module_id_t module_id,
gNB_mac->TX_req[CC_id].Slot = slot; gNB_mac->TX_req[CC_id].Slot = slot;
/* mark UE as scheduled */ /* mark UE as scheduled */
sched_ctrl->rbSize = 0; memset(sched_pdsch, 0, sizeof(*sched_pdsch));
} }
} }
...@@ -351,25 +351,26 @@ void nr_preprocessor_phytest(module_id_t module_id, ...@@ -351,25 +351,26 @@ void nr_preprocessor_phytest(module_id_t module_id,
"could not find uplink slot for PUCCH (RNTI %04x@%d.%d)!\n", "could not find uplink slot for PUCCH (RNTI %04x@%d.%d)!\n",
rnti, frame, slot); rnti, frame, slot);
sched_ctrl->rbStart = rbStart; NR_sched_pdsch_t *sched_pdsch = &sched_ctrl->sched_pdsch;
sched_ctrl->rbSize = rbSize; sched_pdsch->rbStart = rbStart;
sched_ctrl->time_domain_allocation = 2; sched_pdsch->rbSize = rbSize;
sched_pdsch->time_domain_allocation = 2;
if (!UE_info->secondaryCellGroup[UE_id]->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->mcs_Table) if (!UE_info->secondaryCellGroup[UE_id]->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->mcs_Table)
sched_ctrl->mcsTableIdx = 0; sched_pdsch->mcsTableIdx = 0;
else { else {
if (*UE_info->secondaryCellGroup[UE_id]->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->mcs_Table == 0) if (*UE_info->secondaryCellGroup[UE_id]->spCellConfig->spCellConfigDedicated->initialDownlinkBWP->pdsch_Config->choice.setup->mcs_Table == 0)
sched_ctrl->mcsTableIdx = 1; sched_pdsch->mcsTableIdx = 1;
else else
sched_ctrl->mcsTableIdx = 2; sched_pdsch->mcsTableIdx = 2;
} }
sched_ctrl->mcs = 9; sched_pdsch->mcs = 9;
sched_ctrl->numDmrsCdmGrpsNoData = 1; sched_pdsch->numDmrsCdmGrpsNoData = 1;
/* get the PID of a HARQ process awaiting retransmission, or -1 otherwise */ /* get the PID of a HARQ process awaiting retransmission, or -1 otherwise */
sched_ctrl->dl_harq_pid = sched_ctrl->retrans_dl_harq.head; sched_pdsch->dl_harq_pid = sched_ctrl->retrans_dl_harq.head;
/* mark the corresponding RBs as used */ /* mark the corresponding RBs as used */
for (int rb = 0; rb < sched_ctrl->rbSize; rb++) for (int rb = 0; rb < sched_pdsch->rbSize; rb++)
vrb_map[rb + sched_ctrl->rbStart] = 1; vrb_map[rb + sched_pdsch->rbStart] = 1;
} }
bool nr_ul_preprocessor_phytest(module_id_t module_id, bool nr_ul_preprocessor_phytest(module_id_t module_id,
......
...@@ -352,6 +352,23 @@ typedef struct NR_sched_pusch { ...@@ -352,6 +352,23 @@ typedef struct NR_sched_pusch {
int8_t ul_harq_pid; int8_t ul_harq_pid;
} NR_sched_pusch_t; } NR_sched_pusch_t;
typedef struct NR_sched_pdsch {
/// RB allocation within active BWP
uint16_t rbSize;
uint16_t rbStart;
// time-domain allocation for scheduled RBs
int time_domain_allocation;
/// MCS-related infos
uint8_t mcsTableIdx;
uint8_t mcs;
uint8_t numDmrsCdmGrpsNoData;
/// DL HARQ PID to use for this UE, or -1 for "any new"
int8_t dl_harq_pid;
} NR_sched_pdsch_t;
typedef struct NR_UE_harq { typedef struct NR_UE_harq {
bool is_waiting; bool is_waiting;
uint8_t ndi; uint8_t ndi;
...@@ -362,6 +379,9 @@ typedef struct NR_UE_harq { ...@@ -362,6 +379,9 @@ typedef struct NR_UE_harq {
/* Transport block to be sent using this HARQ process */ /* Transport block to be sent using this HARQ process */
uint32_t tb[16384]; uint32_t tb[16384];
uint32_t tb_size; uint32_t tb_size;
//
/// sched_pdsch keeps information on MCS etc used for the initial transmission
NR_sched_pdsch_t sched_pdsch;
} NR_UE_harq_t; } NR_UE_harq_t;
//! fixme : need to enhace for the multiple TB CQI report //! fixme : need to enhace for the multiple TB CQI report
...@@ -442,13 +462,6 @@ typedef struct nr_csi_report { ...@@ -442,13 +462,6 @@ typedef struct nr_csi_report {
From spec 38.214 section 5.2.1.2 For periodic and semi-persistent CSI Resource Settings, the number of CSI-RS Resource Sets configured is limited to S=1 From spec 38.214 section 5.2.1.2 For periodic and semi-persistent CSI Resource Settings, the number of CSI-RS Resource Sets configured is limited to S=1
*/ */
#define MAX_CSI_RESOURCE_SET_IN_CSI_RESOURCE_CONFIG 16 #define MAX_CSI_RESOURCE_SET_IN_CSI_RESOURCE_CONFIG 16
typedef struct NR_UE_old_sched {
uint16_t rbSize;
int time_domain_allocation;
uint8_t mcsTableIdx;
uint8_t mcs;
uint8_t numDmrsCdmGrpsNoData;
} NR_UE_ret_info_t;
typedef enum { typedef enum {
INACTIVE = 0, INACTIVE = 0,
...@@ -469,15 +482,18 @@ typedef struct NR_UE_ul_harq { ...@@ -469,15 +482,18 @@ typedef struct NR_UE_ul_harq {
/*! \brief scheduling control information set through an API */ /*! \brief scheduling control information set through an API */
#define MAX_CSI_REPORTS 48 #define MAX_CSI_REPORTS 48
typedef struct { typedef struct {
/// total amount of data awaiting for this UE
uint32_t num_total_bytes;
/// per-LC status data
mac_rlc_status_resp_t rlc_status[MAX_NUM_LCID];
/// the currently active BWP in DL /// the currently active BWP in DL
NR_BWP_Downlink_t *active_bwp; NR_BWP_Downlink_t *active_bwp;
/// the currently active BWP in UL /// the currently active BWP in UL
NR_BWP_Uplink_t *active_ubwp; NR_BWP_Uplink_t *active_ubwp;
/// CCE index and aggregation, should be coherent with cce_list
NR_SearchSpace_t *search_space;
NR_ControlResourceSet_t *coreset;
/// CCE index and Aggr. Level are shared for PUSCH/PDSCH allocation decisions
/// corresponding to the sched_pusch/sched_pdsch structures below
int cce_index;
uint8_t aggregation_level;
/// PUCCH scheduling information. Array of three, we assume for the moment: /// PUCCH scheduling information. Array of three, we assume for the moment:
/// HARQ in the first field, SR in second, CSI in third (as fixed by RRC /// HARQ in the first field, SR in second, CSI in third (as fixed by RRC
...@@ -485,19 +501,11 @@ typedef struct { ...@@ -485,19 +501,11 @@ typedef struct {
/// nr_acknack_scheduling()! /// nr_acknack_scheduling()!
NR_sched_pucch_t sched_pucch[3]; NR_sched_pucch_t sched_pucch[3];
/// PUSCH save: PUSCH "configuration" that is not cleared across TTIs
NR_sched_pusch_save_t pusch_save; NR_sched_pusch_save_t pusch_save;
/// Sched PDSCH: scheduling decisions, copied into HARQ and cleared every TTI
NR_sched_pusch_t sched_pusch; NR_sched_pusch_t sched_pusch;
/// CCE index and aggregation, should be coherent with cce_list
NR_SearchSpace_t *search_space;
NR_ControlResourceSet_t *coreset;
int cce_index;
uint8_t aggregation_level;
/// RB allocation within active BWP
uint16_t rbSize;
uint16_t rbStart;
/// uplink bytes that are currently scheduled /// uplink bytes that are currently scheduled
int sched_ul_bytes; int sched_ul_bytes;
/// estimation of the UL buffer size /// estimation of the UL buffer size
...@@ -508,18 +516,12 @@ typedef struct { ...@@ -508,18 +516,12 @@ typedef struct {
/// PHR info: nominal UE transmit power levels (dBm) /// PHR info: nominal UE transmit power levels (dBm)
int pcmax; int pcmax;
// time-domain allocation for scheduled RBs NR_sched_pdsch_t sched_pdsch;
int time_domain_allocation;
/// MCS-related infos
uint8_t mcsTableIdx;
uint8_t mcs;
uint8_t numDmrsCdmGrpsNoData;
/// Retransmission-related information /// total amount of data awaiting for this UE
NR_UE_ret_info_t retInfo[NR_MAX_NB_HARQ_PROCESSES]; uint32_t num_total_bytes;
/// DL HARQ PID to use for this UE, or -1 for "any new" /// per-LC status data
int8_t dl_harq_pid; mac_rlc_status_resp_t rlc_status[MAX_NUM_LCID];
uint16_t ta_frame; uint16_t ta_frame;
int16_t ta_update; int16_t ta_update;
......
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