Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
26 changes: 18 additions & 8 deletions openair2/GNB_APP/gnb_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -687,7 +687,7 @@ void RCconfig_nr_prs(void)
for (int l = 0; l < PRS_ParamList.paramarray[j][PRS_MUTING_PATTERN1_LIST].numelt; l++)
{
prs_config->MutingPattern1[l] = PRS_ParamList.paramarray[j][PRS_MUTING_PATTERN1_LIST].uptr[l];
if (k == 0) // print only for 0th resource
if (k == 0) // print only for 0th resource
snprintf(str[5]+strlen(str[5]),sizeof(str[5])-strlen(str[5]),"%d, ",prs_config->MutingPattern1[l]);
}
for (int l = 0; l < PRS_ParamList.paramarray[j][PRS_MUTING_PATTERN2_LIST].numelt; l++)
Expand Down 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 Expand Up @@ -1817,7 +1827,7 @@ void RCconfig_nr_macrlc(configmodule_interface_t *cfg)

if (IS_SA_MODE(get_softmodem_params()))
nr_mac_configure_sib1(RC.nrmac[0], &info.plmn, info.nr_cellid, *info.tac);

// read F1 Setup information from config and generated MIB/SIB1
// and store it at MAC for sending later
NR_BCCH_BCH_Message_t *mib = RC.nrmac[0]->common_channels[0].mib;
Expand Down Expand Up @@ -2398,7 +2408,7 @@ gNB_RRC_INST *RCconfig_NRRRC()
}

if (strcmp(*(GNBParamList.paramarray[i][GNB_TRANSPORT_S_PREFERENCE_IDX].strptr), "local_mac") == 0) {

} else if (strcmp(*(GNBParamList.paramarray[i][GNB_TRANSPORT_S_PREFERENCE_IDX].strptr), "cudu") == 0) {
rrc->eth_params_s.my_addr = strdup(*(GNBParamList.paramarray[i][GNB_LOCAL_S_ADDRESS_IDX].strptr));
rrc->eth_params_s.remote_addr = strdup(*(GNBParamList.paramarray[i][GNB_REMOTE_S_ADDRESS_IDX].strptr));
Expand All @@ -2408,10 +2418,10 @@ gNB_RRC_INST *RCconfig_NRRRC()
rrc->eth_params_s.remote_portd = *(GNBParamList.paramarray[i][GNB_REMOTE_S_PORTD_IDX].uptr);
rrc->eth_params_s.transp_preference = ETH_UDP_MODE;
} else { // other midhaul
}
}

// search if in active list

nr_rrc_config_t nrrrc_config = {0};
for (k=0; k <num_gnbs ; k++) {
if (strcmp(GNBSParams[GNB_ACTIVE_GNBS_IDX].strlistptr[k], *(GNBParamList.paramarray[i][GNB_GNB_NAME_IDX].strptr) )== 0) {
Expand Down Expand Up @@ -2758,7 +2768,7 @@ int gNB_app_handle_f1ap_gnb_cu_configuration_update(f1ap_gnb_cu_configuration_up
// generate gNB_CU_CONFIGURATION_UPDATE_ACKNOWLEDGE
msg_ack_p = itti_alloc_new_message (TASK_GNB_APP, 0, F1AP_GNB_CU_CONFIGURATION_UPDATE_ACKNOWLEDGE);
F1AP_GNB_CU_CONFIGURATION_UPDATE_ACKNOWLEDGE(msg_ack_p).num_cells_failed_to_be_activated = 0;
F1AP_GNB_CU_CONFIGURATION_UPDATE_ACKNOWLEDGE(msg_ack_p).have_criticality = 0;
F1AP_GNB_CU_CONFIGURATION_UPDATE_ACKNOWLEDGE(msg_ack_p).have_criticality = 0;
F1AP_GNB_CU_CONFIGURATION_UPDATE_ACKNOWLEDGE(msg_ack_p).noofTNLAssociations_to_setup =0;
F1AP_GNB_CU_CONFIGURATION_UPDATE_ACKNOWLEDGE(msg_ack_p).noofTNLAssociations_failed = 0;
F1AP_GNB_CU_CONFIGURATION_UPDATE_ACKNOWLEDGE(msg_ack_p).noofDedicatedSIDeliveryNeededUEs = 0;
Expand All @@ -2781,7 +2791,7 @@ int gNB_app_handle_f1ap_gnb_cu_configuration_update(f1ap_gnb_cu_configuration_up
ngran_node_t get_node_type(void)
{
GET_PARAMS_LIST(GNBParamList, GNBParams, GNBPARAMS_DESC, GNB_CONFIG_STRING_GNB_LIST, NULL);
if (GNBParamList.numelt == 0) // We have no valid configuration, let's return a default
if (GNBParamList.numelt == 0) // We have no valid configuration, let's return a default
return ngran_gNB;

// MAC/RLC params
Expand Down
27 changes: 4 additions & 23 deletions openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ static void get_coreset_rb_params(const NR_ControlResourceSet_t *coreset, uint16
AssertFatal(!coreset->ext1 || !coreset->ext1->rb_Offset_r16, "rb-Offset in coreset configuration not handled\n");
*n_rb = 0;
*rb_start = 0;

for (int i = 0; i < 6; i++) {
for (int t = 0; t < 8; t++) {
if ((coreset->frequencyDomainResources.buf[i] >> (7 - t)) & 1) {
Expand Down 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 Expand Up @@ -2433,11 +2414,11 @@ int get_spf(nfapi_nr_config_request_scf_t *cfg) {
AssertFatal(mu>=0&&mu<4,"Illegal scs %d\n",mu);

return(10 * (1<<mu));
}
}

int to_absslot(nfapi_nr_config_request_scf_t *cfg,int frame,int slot) {

return(get_spf(cfg)*frame) + slot;
return(get_spf(cfg)*frame) + slot;

}

Expand Down Expand Up @@ -3722,7 +3703,7 @@ void nr_mac_trigger_release_complete(gNB_MAC_INST *mac, int rnti)
// table. This can happen, e.g., on Msg.3 with C-RNTI, where we create a UE
// MAC context, decode the PDU, find the C-RNTI MAC CE, and then throw the
// newly created context away. See also in _nr_rx_sdu() and commit 93f59a3c6e56f
if (!du_exists_f1_ue_data(rnti))
if (!du_exists_f1_ue_data(rnti))
return;

// unlock the scheduler temporarily to prevent possible deadlocks with
Expand Down
45 changes: 40 additions & 5 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 @@ -998,7 +1031,7 @@ static void _nr_rx_sdu(const module_id_t gnb_mod_idP,
}
}
handle_nr_ul_harq(gNB_mac, UE, current_rnti, harq_pid, sduP == NULL);
} else {
} else {
nr_rx_ra_sdu(gnb_mod_idP, CC_idP, frameP, slotP, current_rnti, sduP, sdu_lenP, harq_pid, timing_advance, ul_cqi, rssi);
}
}
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
6 changes: 4 additions & 2 deletions openair2/LAYER2/NR_MAC_gNB/mac_proto.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ void schedule_nr_other_sib(module_id_t module_idP,
slot_t slot,
nfapi_nr_dl_tti_request_t *DL_req,
nfapi_nr_tx_data_request_t *TX_req);

struct NR_SchedulingInfo2_r17* find_sib19_sched_info(const struct NR_SI_SchedulingInfo_v1700*);

void schedule_nr_mib(module_id_t module_idP, frame_t frameP, slot_t slotP, nfapi_nr_dl_tti_request_t *DL_req);
Expand All @@ -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 Expand Up @@ -199,7 +201,7 @@ int nr_acknack_scheduling(gNB_MAC_INST *mac,
int get_pdsch_to_harq_feedback(NR_PUCCH_Config_t *pucch_Config,
nr_dci_format_t dci_format,
uint8_t *pdsch_to_harq_feedback);

int nr_get_pucch_resource(NR_ControlResourceSet_t *coreset,
NR_PUCCH_Config_t *pucch_Config,
int CCEIndex);
Expand Down
8 changes: 4 additions & 4 deletions openair2/LAYER2/NR_MAC_gNB/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -259,21 +259,21 @@ void mac_top_init_gNB(ngran_node_t node_type,
if (RC.nb_nr_macrlc_inst > 0) {

RC.nrmac = (gNB_MAC_INST **) malloc16(RC.nb_nr_macrlc_inst *sizeof(gNB_MAC_INST *));

AssertFatal(RC.nrmac != NULL,"can't ALLOCATE %zu Bytes for %d gNB_MAC_INST with size %zu \n",
RC.nb_nr_macrlc_inst * sizeof(gNB_MAC_INST *),
RC.nb_nr_macrlc_inst, sizeof(gNB_MAC_INST));

for (module_id_t i = 0; i < RC.nb_nr_macrlc_inst; i++) {

RC.nrmac[i] = (gNB_MAC_INST *) malloc16(sizeof(gNB_MAC_INST));

AssertFatal(RC.nrmac != NULL,"can't ALLOCATE %zu Bytes for %d gNB_MAC_INST with size %zu \n",
RC.nb_nr_macrlc_inst * sizeof(gNB_MAC_INST *),
RC.nb_nr_macrlc_inst, sizeof(gNB_MAC_INST));

LOG_D(MAC,"[MAIN] ALLOCATE %zu Bytes for %d gNB_MAC_INST @ %p\n",sizeof(gNB_MAC_INST), RC.nb_nr_macrlc_inst, RC.mac);

bzero(RC.nrmac[i], sizeof(gNB_MAC_INST));
nr_mac_pcch_queue_init(&RC.nrmac[i]->common_channels[0]);

Expand Down
Loading