Commit c6bacf3a authored by Robert Schmidt's avatar Robert Schmidt

Avoid (useless) tb_size recomputation in DLSCH post-processor

In order to determine the number of RBs, the pre-processor needs to
calculate the TB size (as it depends on how much of data the UE actually
has to send). Before, the pre-processor would calculate this again,
which obviously is superfluous.
parent d28000c4
...@@ -444,7 +444,7 @@ void pf_dl(module_id_t module_id, ...@@ -444,7 +444,7 @@ void pf_dl(module_id_t module_id,
int max_num_ue, int max_num_ue,
int n_rb_sched, int n_rb_sched,
uint8_t *rballoc_mask) { uint8_t *rballoc_mask) {
const NR_ServingCellConfigCommon_t *scc = RC.nrmac[module_id]->common_channels->ServingCellConfigCommon;
NR_UE_info_t *UE_info = &RC.nrmac[module_id]->UE_info; NR_UE_info_t *UE_info = &RC.nrmac[module_id]->UE_info;
float coeff_ue[MAX_MOBILES_PER_GNB]; float coeff_ue[MAX_MOBILES_PER_GNB];
// UEs that could be scheduled // UEs that could be scheduled
...@@ -487,14 +487,17 @@ void pf_dl(module_id_t module_id, ...@@ -487,14 +487,17 @@ void pf_dl(module_id_t module_id,
sched_pdsch->mcsTableIdx = 0; sched_pdsch->mcsTableIdx = 0;
sched_pdsch->mcs = 9; sched_pdsch->mcs = 9;
sched_pdsch->numDmrsCdmGrpsNoData = 1; sched_pdsch->numDmrsCdmGrpsNoData = 1;
uint8_t N_PRB_DMRS = getN_PRB_DMRS(sched_ctrl->active_bwp, sched_ctrl->sched_pdsch.numDmrsCdmGrpsNoData); sched_pdsch->Qm = nr_get_Qm_dl(sched_pdsch->mcs, sched_pdsch->mcsTableIdx);
sched_pdsch->R = nr_get_code_rate_dl(sched_pdsch->mcs, sched_pdsch->mcsTableIdx);
int nrOfSymbols = getNrOfSymbols(sched_ctrl->active_bwp, sched_pdsch->time_domain_allocation); int nrOfSymbols = getNrOfSymbols(sched_ctrl->active_bwp, sched_pdsch->time_domain_allocation);
uint32_t tbs = nr_compute_tbs(nr_get_Qm_dl(sched_pdsch->mcs, sched_pdsch->mcsTableIdx), const uint8_t N_PRB_DMRS = getN_PRB_DMRS(sched_ctrl->active_bwp, sched_ctrl->sched_pdsch.numDmrsCdmGrpsNoData);
nr_get_code_rate_dl(sched_pdsch->mcs, sched_pdsch->mcsTableIdx), const uint8_t N_DMRS_SLOT = get_num_dmrs_symbols(
sched_ctrl->active_bwp->bwp_Dedicated->pdsch_Config->choice.setup, scc->dmrs_TypeA_Position, nrOfSymbols);
uint32_t tbs = nr_compute_tbs(sched_pdsch->Qm,
sched_pdsch->R,
1, // rbSize 1, // rbSize
nrOfSymbols, nrOfSymbols,
N_PRB_DMRS, // FIXME // This should be multiplied by the N_PRB_DMRS * N_DMRS_SLOT,
// number of dmrs symbols
0 /* N_PRB_oh, 0 for initialBWP */, 0 /* N_PRB_oh, 0 for initialBWP */,
0 /* tb_scaling */, 0 /* tb_scaling */,
1 /* nrOfLayers */) 1 /* nrOfLayers */)
...@@ -568,7 +571,6 @@ void pf_dl(module_id_t module_id, ...@@ -568,7 +571,6 @@ void pf_dl(module_id_t module_id,
const uint8_t N_PRB_DMRS = getN_PRB_DMRS(sched_ctrl->active_bwp, sched_ctrl->sched_pdsch.numDmrsCdmGrpsNoData); const uint8_t N_PRB_DMRS = getN_PRB_DMRS(sched_ctrl->active_bwp, sched_ctrl->sched_pdsch.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->sched_pdsch.time_domain_allocation);
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,
scc->dmrs_TypeA_Position, scc->dmrs_TypeA_Position,
...@@ -581,8 +583,8 @@ void pf_dl(module_id_t module_id, ...@@ -581,8 +583,8 @@ void pf_dl(module_id_t module_id,
NR_sched_pdsch_t *sched_pdsch = &sched_ctrl->sched_pdsch; NR_sched_pdsch_t *sched_pdsch = &sched_ctrl->sched_pdsch;
do { do {
rbSize++; rbSize++;
TBS = nr_compute_tbs(nr_get_Qm_dl(sched_pdsch->mcs, sched_pdsch->mcsTableIdx), TBS = nr_compute_tbs(sched_pdsch->Qm,
nr_get_code_rate_dl(sched_pdsch->mcs, sched_pdsch->mcsTableIdx), sched_pdsch->R,
rbSize, rbSize,
nrOfSymbols, nrOfSymbols,
N_PRB_DMRS * N_DMRS_SLOT, N_PRB_DMRS * N_DMRS_SLOT,
...@@ -593,6 +595,7 @@ void pf_dl(module_id_t module_id, ...@@ -593,6 +595,7 @@ void pf_dl(module_id_t module_id,
} 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_pdsch->rbSize = rbSize; sched_pdsch->rbSize = rbSize;
sched_pdsch->rbStart = rbStart; sched_pdsch->rbStart = rbStart;
sched_pdsch->tb_size = TBS;
/* transmissions: directly allocate */ /* transmissions: directly allocate */
n_rb_sched -= sched_pdsch->rbSize; n_rb_sched -= sched_pdsch->rbSize;
...@@ -686,24 +689,11 @@ void nr_schedule_ue_spec(module_id_t module_id, ...@@ -686,24 +689,11 @@ void nr_schedule_ue_spec(module_id_t module_id,
int startSymbolIndex, nrOfSymbols; int startSymbolIndex, nrOfSymbols;
SLIV2SL(startSymbolAndLength, &startSymbolIndex, &nrOfSymbols); SLIV2SL(startSymbolAndLength, &startSymbolIndex, &nrOfSymbols);
uint8_t N_PRB_DMRS = getN_PRB_DMRS(sched_ctrl->active_bwp, sched_pdsch->numDmrsCdmGrpsNoData);
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 ,
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;
/* TODO avoid recomputation! */ const uint16_t R = sched_pdsch->R;
const uint16_t R = nr_get_code_rate_dl(sched_pdsch->mcs, sched_pdsch->mcsTableIdx); const uint8_t Qm = sched_pdsch->Qm;
const uint8_t Qm = nr_get_Qm_dl(sched_pdsch->mcs, sched_pdsch->mcsTableIdx); const uint32_t TBS = sched_pdsch->tb_size;
const uint32_t TBS = nr_compute_tbs(nr_get_Qm_dl(sched_pdsch->mcs, sched_pdsch->mcsTableIdx),
nr_get_code_rate_dl(sched_pdsch->mcs, sched_pdsch->mcsTableIdx),
sched_pdsch->rbSize,
nrOfSymbols,
N_PRB_DMRS * N_DMRS_SLOT,
0 /* N_PRB_oh, 0 for initialBWP */,
0 /* tb_scaling */,
nrOfLayers)
>> 3;
int8_t current_harq_pid = sched_pdsch->dl_harq_pid; int8_t current_harq_pid = sched_pdsch->dl_harq_pid;
if (current_harq_pid < 0) { if (current_harq_pid < 0) {
...@@ -947,7 +937,6 @@ void nr_schedule_ue_spec(module_id_t module_id, ...@@ -947,7 +937,6 @@ void nr_schedule_ue_spec(module_id_t module_id,
LOG_D(MAC, "[%s] Initial HARQ transmission in %d.%d\n", __FUNCTION__, frame, slot); LOG_D(MAC, "[%s] Initial HARQ transmission in %d.%d\n", __FUNCTION__, frame, slot);
harq->tb_size = TBS;
uint8_t *buf = (uint8_t *) harq->tb; uint8_t *buf = (uint8_t *) harq->tb;
/* first, write all CEs that might be there */ /* first, write all CEs that might be there */
......
...@@ -254,6 +254,8 @@ void nr_schedule_css_dlsch_phytest(module_id_t module_idP, ...@@ -254,6 +254,8 @@ void nr_schedule_css_dlsch_phytest(module_id_t module_idP,
} }
} }
extern int getNrOfSymbols(NR_BWP_Downlink_t *bwp, int tda);
extern uint8_t getN_PRB_DMRS(NR_BWP_Downlink_t *bwp, int numDmrsCdmGrpsNoData);
/* schedules whole bandwidth for first user, all the time */ /* schedules whole bandwidth for first user, all the time */
void nr_preprocessor_phytest(module_id_t module_id, void nr_preprocessor_phytest(module_id_t module_id,
frame_t frame, frame_t frame,
...@@ -261,9 +263,10 @@ void nr_preprocessor_phytest(module_id_t module_id, ...@@ -261,9 +263,10 @@ void nr_preprocessor_phytest(module_id_t module_id,
{ {
if (slot != 1) if (slot != 1)
return; return;
const int CC_id = 0;
const NR_ServingCellConfigCommon_t *scc = RC.nrmac[module_id]->common_channels[CC_id].ServingCellConfigCommon;
NR_UE_info_t *UE_info = &RC.nrmac[module_id]->UE_info; NR_UE_info_t *UE_info = &RC.nrmac[module_id]->UE_info;
const int UE_id = 0; const int UE_id = 0;
const int CC_id = 0;
AssertFatal(UE_info->active[UE_id], AssertFatal(UE_info->active[UE_id],
"%s(): expected UE %d to be active\n", "%s(): expected UE %d to be active\n",
__func__, __func__,
...@@ -365,6 +368,22 @@ void nr_preprocessor_phytest(module_id_t module_id, ...@@ -365,6 +368,22 @@ void nr_preprocessor_phytest(module_id_t module_id,
} }
sched_pdsch->mcs = 9; sched_pdsch->mcs = 9;
sched_pdsch->numDmrsCdmGrpsNoData = 1; sched_pdsch->numDmrsCdmGrpsNoData = 1;
sched_pdsch->Qm = nr_get_Qm_dl(sched_pdsch->mcs, sched_pdsch->mcsTableIdx);
sched_pdsch->R = nr_get_code_rate_dl(sched_pdsch->mcs, sched_pdsch->mcsTableIdx);
const int nrOfSymbols = getNrOfSymbols(sched_ctrl->active_bwp, sched_pdsch->time_domain_allocation);
const uint8_t N_PRB_DMRS = getN_PRB_DMRS(sched_ctrl->active_bwp, sched_ctrl->sched_pdsch.numDmrsCdmGrpsNoData);
const uint8_t N_DMRS_SLOT = get_num_dmrs_symbols(
sched_ctrl->active_bwp->bwp_Dedicated->pdsch_Config->choice.setup, scc->dmrs_TypeA_Position, nrOfSymbols);
sched_pdsch->tb_size = nr_compute_tbs(sched_pdsch->Qm,
sched_pdsch->R,
sched_pdsch->rbSize,
nrOfSymbols,
N_PRB_DMRS * N_DMRS_SLOT,
0 /* N_PRB_oh, 0 for initialBWP */,
0 /* tb_scaling */,
1 /* nrOfLayers */)
>> 3;
/* 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_pdsch->dl_harq_pid = sched_ctrl->retrans_dl_harq.head; sched_pdsch->dl_harq_pid = sched_ctrl->retrans_dl_harq.head;
......
...@@ -365,6 +365,11 @@ typedef struct NR_sched_pdsch { ...@@ -365,6 +365,11 @@ typedef struct NR_sched_pdsch {
uint8_t mcs; uint8_t mcs;
uint8_t numDmrsCdmGrpsNoData; uint8_t numDmrsCdmGrpsNoData;
/// TBS-related info
uint16_t R;
uint8_t Qm;
uint32_t tb_size;
/// DL HARQ PID to use for this UE, or -1 for "any new" /// DL HARQ PID to use for this UE, or -1 for "any new"
int8_t dl_harq_pid; int8_t dl_harq_pid;
} NR_sched_pdsch_t; } NR_sched_pdsch_t;
...@@ -376,10 +381,11 @@ typedef struct NR_UE_harq { ...@@ -376,10 +381,11 @@ typedef struct NR_UE_harq {
uint16_t feedback_frame; uint16_t feedback_frame;
uint16_t feedback_slot; uint16_t feedback_slot;
/* Transport block to be sent using this HARQ process */ /* Transport block to be sent using this HARQ process, its size is in
* sched_pdsch */
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 /// sched_pdsch keeps information on MCS etc used for the initial transmission
NR_sched_pdsch_t sched_pdsch; NR_sched_pdsch_t sched_pdsch;
} NR_UE_harq_t; } NR_UE_harq_t;
......
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