Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions openair2/GNB_APP/gnb_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -1731,6 +1731,16 @@ void RCconfig_nr_macrlc(configmodule_interface_t *cfg)
else
ul_bler_options->harq_round_max = *gpd(params, np, MACRLC_UL_HARQ_ROUND_MAX)->u8ptr;
RC.nrmac[j]->min_grant_prb = *gpd(params, np, MACRLC_MIN_GRANT_PRB)->u16ptr;
long uses_sc_fdma = 0;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's exactly wrong. check_sc_fdma_rbsize() uses NR_PUSCH_Config__transformPrecoder_enabled to check if SC-FDMA is enabled. that constant is 0, so here, by default and if msg3_transformPrecoder is not set, will be set to enabled when it should be disabled.

please fix

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IOW, initialize with NR_PUSCH_Config__transformPrecoder_disabled

if (RC.nrmac[j]->common_channels[0].ServingCellConfigCommon->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->msg3_transformPrecoder != NULL) {
uses_sc_fdma = *RC.nrmac[j]->common_channels[0].ServingCellConfigCommon->uplinkConfigCommon->initialUplinkBWP->rach_ConfigCommon->choice.setup->msg3_transformPrecoder;
}
int new_min = check_sc_fdma_rbsize(uses_sc_fdma, RC.nrmac[j]->min_grant_prb);
// NR_PUSCH_Config__transformPrecoder_enabled = 0 | NR_PUSCH_Config__transformPrecoder_disabled = 1, so !uses_sc_fdma should be used
if (!uses_sc_fdma && RC.nrmac[j]->min_grant_prb != new_min) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i know that you have that comment, but it's really confusing that !uses_sc_fdma means "we have SC-FDMA"

one suggestion I have is to rename the variable and check

sc_fdma == NR_PUSCH_Config__transformPrecoder_enabled

then it's clear and the 0/1 confusion is not visible

LOG_W(NR_MAC, "min_rb value is set as %d. In SC-FDMA, it should be under format 2^x*3^y*5^z and has been automatically decreased to %d.\n", RC.nrmac[j]->min_grant_prb, new_min);
RC.nrmac[j]->min_grant_prb = new_min;
}
RC.nrmac[j]->identity_pm = *gpd(params, np, MACRLC_IDENTITY_PM)->u8ptr;
// PRB Blacklist
uint16_t prbbl[MAX_BWP_SIZE] = {0};
Expand Down
19 changes: 0 additions & 19 deletions openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c
Original file line number Diff line number Diff line change
Expand Up @@ -677,17 +677,6 @@ bool update_rb_mcs_tbs(NR_sched_pdsch_t *pdsch, uint32_t num_total_bytes, uint16
return true;
}

static bool multiple_2_3_5(int rb)
{
while (rb % 2 == 0)
rb /= 2;
while (rb % 3 == 0)
rb /= 3;
while (rb % 5 == 0)
rb /= 5;

return (rb == 1);
}

bool nr_find_nb_rb(uint16_t Qm,
uint16_t R,
Expand All @@ -701,10 +690,6 @@ bool nr_find_nb_rb(uint16_t Qm,
uint32_t *tbs,
uint16_t *nb_rb)
{
// for transform precoding only RB = 2^a_2 * 3^a_3 * 5^a_5 is allowed with a non-negative
while (transform_precoding == NR_PUSCH_Config__transformPrecoder_enabled && !multiple_2_3_5(nb_rb_max))
nb_rb_max--;

/* is the maximum (not even) enough? */
*nb_rb = nb_rb_max;
*tbs = nr_compute_tbs(Qm, R, *nb_rb, nb_symb_sch, nb_dmrs_prb, 0, 0, nrOfLayers) >> 3;
Expand All @@ -726,10 +711,6 @@ bool nr_find_nb_rb(uint16_t Qm,
int hi = nb_rb_max;
int lo = nb_rb_min;
for (int p = (hi + lo) / 2; lo + 1 < hi; p = (hi + lo) / 2) {
// for transform precoding only RB = 2^a_2 * 3^a_3 * 5^a_5 is allowed with a non-negative
while(transform_precoding == NR_PUSCH_Config__transformPrecoder_enabled &&
!multiple_2_3_5(p))
p++;

// If by increasing p for transform precoding we already hit the high, break to avoid infinite loop
if (p == hi)
Expand Down
43 changes: 39 additions & 4 deletions openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_ulsch.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,42 @@
#include <openair2/UTIL/OPT/opt.h>
#include "LAYER2/nr_rlc/nr_rlc_oai_api.h"

static const uint16_t NR_TRANSFORM_PRECODE_RB_LUT[274] = {
Comment thread
rorsc marked this conversation as resolved.
0, 1, 2, 3, 4, 5, 6, 6, 8, 9, 10, 10, 12, 12, 12, 15,
16, 16, 18, 18, 20, 20, 20, 20, 24, 25, 25, 27, 27, 27, 30, 30,
32, 32, 32, 32, 36, 36, 36, 36, 40, 40, 40, 40, 40, 45, 45, 45,
48, 48, 50, 50, 50, 50, 54, 54, 54, 54, 54, 54, 60, 60, 60, 60,
64, 64, 64, 64, 64, 64, 64, 64, 72, 72, 72, 75, 75, 75, 75, 75,
80, 81, 81, 81, 81, 81, 81, 81, 81, 81, 90, 90, 90, 90, 90, 90,
96, 96, 96, 96, 100, 100, 100, 100, 100, 100, 100, 100, 108, 108, 108, 108,
108, 108, 108, 108, 108, 108, 108, 108, 120, 120, 120, 120, 120, 125, 125, 125,
128, 128, 128, 128, 128, 128, 128, 135, 135, 135, 135, 135, 135, 135, 135, 135,
144, 144, 144, 144, 144, 144, 150, 150, 150, 150, 150, 150, 150, 150, 150, 150,
160, 160, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162, 162,
162, 162, 162, 162, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180, 180,
192, 192, 192, 192, 192, 192, 192, 192, 200, 200, 200, 200, 200, 200, 200, 200,
200, 200, 200, 200, 200, 200, 200, 200, 216, 216, 216, 216, 216, 216, 216, 216,
216, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225, 225,
240, 240, 240, 243, 243, 243, 243, 243, 243, 243, 250, 250, 250, 250, 250, 250,
256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 270, 270,
270, 270
};

//#define SRS_IND_DEBUG
#define MAX_NUM_DATA_IND 1024


// With SC-FDMA the scheduler in uplink needs to schedule N_PRB=2^x3^y5^z
Comment thread
rorsc marked this conversation as resolved.
// Check 6.3.1.4 of 38.211
int check_sc_fdma_rbsize(long transform_precoding, uint16_t rb)
{
if (transform_precoding == NR_PUSCH_Config__transformPrecoder_enabled) {
return rb < 274 ? NR_TRANSFORM_PRECODE_RB_LUT[rb] : NR_TRANSFORM_PRECODE_RB_LUT[273];

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if it makes sense to check RB < 274 since the max BWP is 273 RBs. I would have rather put an assertion. But it's not a blocking point.

}
return rb;
}


/* \brief Get the number of UL TDAs that could be used in slot, reachable
* via specific k2. The output parameter first_idx is a pointer to the first
* suitable TDA, and the function returns the number of suitable TDAs, or 0. */
Expand Down Expand Up @@ -1760,11 +1793,11 @@ static int apply_ul_retransmission(gNB_MAC_INST *nrmac,
} else {
/* TDA changed vs original retx: recompute DMRS and TB size for new TDA */
NR_pusch_dmrs_t dmrs_info = get_ul_dmrs_params(scc, current_BWP, tda_info, nrOfLayers);
new_sched.rbSize = cand->sched_pusch.rbSize;
new_sched.rbSize = check_sc_fdma_rbsize(current_BWP->transform_precoding, cand->sched_pusch.rbSize);
new_sched.rbStart = cand->sched_pusch.rbStart;
new_sched.tb_size = nr_compute_tbs(retInfo->Qm,
retInfo->R,
cand->sched_pusch.rbSize,
new_sched.rbSize,
tda_info->nrOfSymbols,
dmrs_info.N_PRB_DMRS * dmrs_info.num_dmrs_symb,
0,
Expand Down Expand Up @@ -1819,6 +1852,7 @@ static int apply_ul_new_transmission(gNB_MAC_INST *nrmac,
* time_domain_allocation, tda_info already set by pipeline stages).
* Fill remaining dispatch fields: R, Qm, tb_size, dmrs_info, bwp_info. */
NR_sched_pusch_t sched = cand->sched_pusch;
sched.rbSize = check_sc_fdma_rbsize(current_BWP->transform_precoding, sched.rbSize);
sched.frame = sched_frame;
sched.slot = sched_slot;
sched.ul_harq_pid = -1;
Expand Down Expand Up @@ -2625,6 +2659,7 @@ bool nr_ul_check_phr(const nr_ul_sched_params_t *params,
pot.dmrs_info = dmrs_info;
pot.nrOfLayers = cand->sched_pusch.nrOfLayers;
pot.rbSize = rbSize;
pot.rbSize = check_sc_fdma_rbsize(current_BWP->transform_precoding, pot.rbSize);
pot.mcs = mcs;

uint16_t R;
Expand All @@ -2646,8 +2681,8 @@ bool nr_ul_check_phr(const nr_ul_sched_params_t *params,
NR_sched_pusch_t p1 = pot;
int tp = tx_power;

while (cand->ph < tp && p1.rbSize > params->min_rb) {
p1.rbSize--;
while (cand->ph < tp && p1.rbSize > params->min_rb && check_sc_fdma_rbsize(current_BWP->transform_precoding, p1.rbSize-1) >= params->min_rb) {
p1.rbSize = check_sc_fdma_rbsize(current_BWP->transform_precoding, --p1.rbSize);
p1.tb_size = nr_compute_tbs(p1.Qm, p1.R, p1.rbSize, p1.tda_info.nrOfSymbols, n_dmrs, 0, 0, p1.nrOfLayers) >> 3;
tp = compute_ph_rb_factor(current_BWP->scs, p1.rbSize) + (hasDeltaMCS ? compute_ph_mcs_factor(&p1) : 0);
}
Expand Down
2 changes: 2 additions & 0 deletions openair2/LAYER2/NR_MAC_gNB/mac_proto.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ void nr_schedule_ulsch(module_id_t module_id, frame_t frame, slot_t slot, nfapi_
/* \brief default UL preprocessor */
void nr_ulsch_preprocessor(gNB_MAC_INST *nr_mac, post_process_pusch_t *pp_pusch);

int check_sc_fdma_rbsize(long transform_precoding, uint16_t rb);

void nr_mac_pcch_queue_init(NR_COMMON_channels_t *cc);
void nr_mac_pcch_queue_free(NR_COMMON_channels_t *cc);
void nr_mac_pcch_enqueue(module_id_t module_id, uint64_t fiveg_s_tmsi, uint16_t ue_id);
Expand Down