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
23 changes: 23 additions & 0 deletions ci-scripts/conf_files/gnb-du.sa.band78.106prb.rfsim.conf
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,29 @@ gNBs =
msg3_DeltaPreamble = 1;
p0_NominalWithGrant =-90;

# 0=sl1, 1=sl2, 2=sl4, 3=sl8, 4=sl10, 5=sl20, 6=sl40, 7=sl80, 8=sl160, 9=sl320
msgB_ResponseWindow_r16 = 6;
msgA_RSRP_Threshold_r16 = 19;

msgA_CB_PreamblesPerSSB_PerSharedRO_r16 = 1;

msgA_MCS_r16 = 2;
nrofSlotsMsgA_PUSCH_r16 = 1;
# 0=one, 1=two, 2=three, 3=six
nrofMsgA_PO_PerSlot_r16 = 0;
msgA_PUSCH_TimeDomainOffset_r16 = 8;
startSymbolAndLengthMsgA_PO_r16 = 38;
mappingTypeMsgA_PUSCH_r16 = 1;
guardBandMsgA_PUSCH_r16 = 0;
frequencyStartMsgA_PUSCH_r16 = 0;
nrofPRBs_PerMsgA_PO_r16 = 8;
# 0=one, 1=two, 2=four, 3=eight
nrofMsgA_PO_FDM_r16 = 0;
msgA_PUSCH_NrofPorts_r16 = 1;
nrofDMRS_Sequences_r16 = 1;
# 0=enabled, 1=disabled
msgA_TransformPrecoder_r16 = 1;

# pucch-ConfigCommon setup :
# pucchGroupHopping
# 0 = neither, 1= group hopping, 2=sequence hopping
Expand Down
1 change: 1 addition & 0 deletions openair2/GNB_APP/gnb_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ void prepare_msgA_scc(NR_ServingCellConfigCommon_t *scc) {
NR_MsgA_PUSCH_Resource_r16_t *msgA_PUSCH_Resource = msgA_PUSCH_Config_r16->msgA_PUSCH_ResourceGroupA_r16;
msgA_PUSCH_Resource->startSymbolAndLengthMsgA_PO_r16 = calloc(1, sizeof(long));
msgA_PUSCH_Config_r16->msgA_TransformPrecoder_r16 = calloc(1, sizeof(long));
msgA_PUSCH_Resource->mappingTypeMsgA_PUSCH_r16 = calloc(1, sizeof(long));
}

// Section 4.1 in 38.213
Expand Down
10 changes: 7 additions & 3 deletions openair2/LAYER2/NR_MAC_UE/nr_ra_procedures.c
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,8 @@ static void config_preamble_index(NR_UE_MAC_INST_t *mac)
// The field is mandatory present if the 2-step random access type occasions are shared with 4-step random access type,
// otherwise the field is not present
bool sharedROs = twostep->msgA_CB_PreamblesPerSSB_PerSharedRO_r16 != NULL;
AssertFatal(sharedROs == false, "Shared ROs between 2- and 4-step RA not supported\n");
if (!sharedROs)
LOG_E(NR_MAC, "Shared ROs between 2- and 4-step RA not supported\n");

// For Type-2 random access procedure with separate configuration of PRACH occasions with Type-1 random access procedure
// configuration by msgA-SSB-PerRACH-OccasionAndCB-PreamblesPerSSB when provided;
Expand Down Expand Up @@ -679,7 +680,7 @@ static int nr_get_RA_window_2Step_v16(long msgB_ResponseWindow)
return 160;
break;
case NR_RACH_ConfigGenericTwoStepRA_r16__msgB_ResponseWindow_r16_sl320:
return 360;
return 320;
break;
default:
AssertFatal(false, "illegal msgB_responseWindow value %ld\n", msgB_ResponseWindow);
Expand Down Expand Up @@ -1157,12 +1158,15 @@ void nr_ra_contention_resolution_failed(NR_UE_MAC_INST_t *mac)

void nr_rar_not_successful(NR_UE_MAC_INST_t *mac)
{
LOG_W(MAC, "[UE %d] RAR reception failed\n", mac->ue_id);
RA_config_t *ra = &mac->ra;
LOG_W(MAC, "[UE %d] Response window timer expired, %s reception failed\n", mac->ue_id, ra->ra_type == RA_2_STEP ? "MsgB" : "RAR");
NR_PRACH_RESOURCES_t *prach_resources = &ra->prach_resources;
prach_resources->preamble_tx_counter++;
bool ra_completed = false;
if (prach_resources->preamble_tx_counter == ra->preambleTransMax + 1) {
if (ra->ra_type == RA_2_STEP) {
AssertFatal(false, "Fallback to 4-Step RA not implemented\n");
}
// if the Random Access Preamble is transmitted on the SpCell
// TODO to be verified, this means SA if I'm not mistaken
if (IS_SA_MODE(get_softmodem_params())) {
Expand Down
71 changes: 51 additions & 20 deletions openair2/LAYER2/NR_MAC_UE/nr_ue_scheduler.c
Original file line number Diff line number Diff line change
Expand Up @@ -378,29 +378,19 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac,
int dmrslength = 1;
NR_PUSCH_Config_t *pusch_Config = current_UL_BWP->pusch_Config;

AssertFatal(!((mac->ra.ra_state < nrRA_SUCCEEDED && mac->ra.ra_type == RA_2_STEP) && rar_grant), "logic error: Is not possible to have both msgA_pusch_resource and rar_grant\n");
AssertFatal(!((mac->ra.ra_state < nrRA_SUCCEEDED && mac->ra.ra_type == RA_2_STEP) && rar_grant),
"logic error: Is not possible to have both msgA_pusch_resource and rar_grant\n");

if (mac->ra.ra_state < nrRA_SUCCEEDED && mac->ra.ra_type == RA_2_STEP) {
NR_MsgA_PUSCH_Resource_r16_t *msgA_PUSCH_Resource =
current_UL_BWP->msgA_ConfigCommon_r16->msgA_PUSCH_Config_r16->msgA_PUSCH_ResourceGroupA_r16;
int mapping_type = *msgA_PUSCH_Resource->mappingTypeMsgA_PUSCH_r16;
int S = 0;
int L = 0;
SLIV2SL(*msgA_PUSCH_Resource->startSymbolAndLengthMsgA_PO_r16, &S, &L);
tda_info->k2 = msgA_PUSCH_Resource->msgA_PUSCH_TimeDomainOffset_r16;
tda_info->startSymbolIndex = S;
tda_info->nrOfSymbols = L;
l_prime_mask = get_l_prime(tda_info->nrOfSymbols,
tda_info->mapping_type,
add_pos,
dmrslength,
tda_info->startSymbolIndex,
mac->dmrs_TypeA_Position);
LOG_I(NR_MAC,
"MSGA PUSCH start_sym:%d NR Symb:%d mappingtype:%d, DMRS_MASK:%x\n",
pusch_config_pdu->start_symbol_index,
pusch_config_pdu->nr_of_symbols,
tda_info->mapping_type,
l_prime_mask);
l_prime_mask = get_l_prime(L, mapping_type, add_pos, dmrslength, S, 0);
LOG_I(NR_MAC, "MSGA PUSCH start_sym:%d NR Symb:%d mappingtype:%d, DMRS_MASK:%x\n", S, L, mapping_type, l_prime_mask);

LOG_D(NR_MAC,
"sc_info->initial_ul_BWPStart = %d sc_info->initial_ul_BWPSize = %d\n",
Expand All @@ -409,12 +399,12 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac,
pusch_config_pdu->handle = 0;
pusch_config_pdu->rb_size = msgA_PUSCH_Resource->nrofPRBs_PerMsgA_PO_r16;
pusch_config_pdu->mcs_table = 0;
pusch_config_pdu->frequency_hopping = msgA_PUSCH_Resource->msgA_IntraSlotFrequencyHopping_r16 ? *msgA_PUSCH_Resource->msgA_IntraSlotFrequencyHopping_r16 : 0;
pusch_config_pdu->frequency_hopping =
msgA_PUSCH_Resource->msgA_IntraSlotFrequencyHopping_r16 ? *msgA_PUSCH_Resource->msgA_IntraSlotFrequencyHopping_r16 : 0;
pusch_config_pdu->pusch_data.new_data_indicator = 1; // new data
pusch_config_pdu->num_dmrs_cdm_grps_no_data = 2;
pusch_config_pdu->ul_dmrs_symb_pos = get_l_prime(3, 0, pusch_dmrs_pos2, pusch_len1, 10, mac->dmrs_TypeA_Position);
pusch_config_pdu->transform_precoding =
*mac->current_UL_BWP->msgA_ConfigCommon_r16->msgA_PUSCH_Config_r16->msgA_TransformPrecoder_r16;
*mac->current_UL_BWP->msgA_ConfigCommon_r16->msgA_PUSCH_Config_r16->msgA_TransformPrecoder_r16;
pusch_config_pdu->rb_bitmap[0] = 0;
pusch_config_pdu->rb_start = msgA_PUSCH_Resource->frequencyStartMsgA_PUSCH_r16; // rb_start depends on the RO
pusch_config_pdu->bwp_size = sc_info->initial_ul_BWPSize;
Expand All @@ -430,14 +420,38 @@ int nr_config_pusch_pdu(NR_UE_MAC_INST_t *mac,
pusch_config_pdu->resource_alloc = 1;
pusch_config_pdu->tx_direct_current_location = 0;
pusch_config_pdu->mcs_index = msgA_PUSCH_Resource->msgA_MCS_r16;
pusch_config_pdu->qam_mod_order = nr_get_Qm_dl(pusch_config_pdu->mcs_index, 0);
pusch_config_pdu->start_symbol_index = S;
pusch_config_pdu->nr_of_symbols = L;
pusch_config_pdu->pusch_data.rv_index = 0; // 8.3 in 38.213
pusch_config_pdu->pusch_data.harq_process_id = 0;
pusch_config_pdu->pusch_data.num_cb = 0;
pusch_config_pdu->tbslbrm = 0;
pusch_config_pdu->target_code_rate = nr_get_code_rate_ul(pusch_config_pdu->mcs_index, 0);

LOG_D(NR_MAC,
"pdu_bit_map %d rnti %d handle %d rb_size %d mcs_table %d frequency_hopping %d dmrs_ports %d start_symbol_index %d "
"nr_of_symbols %d new_data_indicator %d num_dmrs_cdm_grps_no_data %d ul_dmrs_symb_pos %d transform_precoding %d rb_start "
"%d bwp_size %d bwp_start %d ul_dmrs_scrambling_id %d mcs_index %d qam_mod_order %d target_code_rate %d tb_size %d\n",
pusch_config_pdu->pdu_bit_map,
pusch_config_pdu->rnti,
pusch_config_pdu->handle,
pusch_config_pdu->rb_size,
pusch_config_pdu->mcs_table,
pusch_config_pdu->frequency_hopping,
pusch_config_pdu->dmrs_ports,
pusch_config_pdu->start_symbol_index,
pusch_config_pdu->nr_of_symbols,
pusch_config_pdu->pusch_data.new_data_indicator,
pusch_config_pdu->num_dmrs_cdm_grps_no_data,
pusch_config_pdu->ul_dmrs_symb_pos,
pusch_config_pdu->transform_precoding,
pusch_config_pdu->rb_start,
pusch_config_pdu->bwp_size,
pusch_config_pdu->bwp_start,
pusch_config_pdu->ul_dmrs_scrambling_id,
pusch_config_pdu->mcs_index,
pusch_config_pdu->qam_mod_order,
pusch_config_pdu->target_code_rate,
pusch_config_pdu->pusch_data.tb_size);

} else if (rar_grant) {
// Note: for Msg3 or MsgA PUSCH transmission the N_PRB_oh is always set to 0
Expand Down Expand Up @@ -1677,6 +1691,23 @@ static void nr_ue_prach_scheduler(NR_UE_MAC_INST_t *mac, frame_t frameP, slot_t
ra->t_crnti = 0;
mac->crnti = 0;
ra->ra_rnti = 0;

// start MsgB response window timer
int next_slot = (slotP + 1) % n_slots_frame;
int next_frame = (frameP + (next_slot < slotP)) % MAX_FRAME_NUMBER;
int add_slots = 1;
NR_BWP_PDCCH_t *pdcch_config = &mac->config_BWP_PDCCH[mac->current_DL_BWP->bwp_id];
const NR_SearchSpace_t *ra_SS = get_common_search_space(mac, pdcch_config->ra_SS_id);
while (!is_dl_slot(next_slot, &mac->frame_structure)
|| !is_ss_monitor_occasion(next_frame, next_slot, n_slots_frame, ra_SS)) {
int temp_slot = (next_slot + 1) % n_slots_frame;
next_frame = (next_frame + (temp_slot < next_slot)) % MAX_FRAME_NUMBER;
next_slot = temp_slot;
add_slots++;
}
add_slots += GET_DURATION_RX_TO_TX(&mac->phy_config.config_req.ntn_config, mac->current_DL_BWP->scs);
nr_timer_setup(&ra->response_window_timer, ra->response_window_setup_time + add_slots, 1);
nr_timer_start(&ra->response_window_timer);
} else {
AssertFatal(false, "RA type %d not implemented!\n", ra->ra_type);
}
Expand Down
14 changes: 13 additions & 1 deletion openair2/LAYER2/NR_MAC_gNB/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -941,7 +941,19 @@ void nr_mac_config_scc(gNB_MAC_INST *nrmac, NR_ServingCellConfigCommon_t *scc, c

const int NTN_gNB_Koffset = get_NTN_Koffset(scc);
const int n = get_slots_per_frame_from_scs(*scc->ssbSubcarrierSpacing);
const int size = n << (int)ceil(log2((NTN_gNB_Koffset + 13) / n + 1)); // 13 is upper limit for max_fb_time
int size = n << (int)ceil(log2((NTN_gNB_Koffset + 13) / n + 1)); // 13 is upper limit for max_fb_time

// If the RA is configured as 2-step, the size must be increased to accommodate more frames. This allows MsgA-PUSCH and the
// ACK/NACK to be scheduled within the same slot, as they reside in different frames. Consequently, multiple MsgA-PUSCH
// transmissions can be scheduled without overriding the ACK/NACK.
if (scc->uplinkConfigCommon->initialUplinkBWP->ext1
&& scc->uplinkConfigCommon->initialUplinkBWP->ext1->msgA_ConfigCommon_r16->choice.setup->msgA_PUSCH_Config_r16
->msgA_PUSCH_ResourceGroupA_r16->msgA_PUSCH_TimeDomainOffset_r16) {
NR_MsgA_ConfigCommon_r16_t *msgacc = scc->uplinkConfigCommon->initialUplinkBWP->ext1->msgA_ConfigCommon_r16->choice.setup;
int msgA_PUSCH_TimeDomainOffset = msgacc->msgA_PUSCH_Config_r16->msgA_PUSCH_ResourceGroupA_r16->msgA_PUSCH_TimeDomainOffset_r16;
size *= (n + msgA_PUSCH_TimeDomainOffset + (n - 1)) / n;
}

nrmac->vrb_map_UL_size = size;

int num_beams = 1;
Expand Down
75 changes: 53 additions & 22 deletions openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_RA.c
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,8 @@ static void schedule_nr_MsgA_pusch(NR_UplinkConfigCommon_t *uplinkConfigCommon,
{
NR_SCHED_ENSURE_LOCKED(&nr_mac->sched_lock);

NR_MsgA_PUSCH_Resource_r16_t *msgA_PUSCH_Resource = uplinkConfigCommon->initialUplinkBWP->ext1->msgA_ConfigCommon_r16->choice
.setup->msgA_PUSCH_Config_r16->msgA_PUSCH_ResourceGroupA_r16;
NR_MsgA_ConfigCommon_r16_t *msgacc = uplinkConfigCommon->initialUplinkBWP->ext1->msgA_ConfigCommon_r16->choice.setup;
NR_MsgA_PUSCH_Resource_r16_t *msgA_PUSCH_Resource = msgacc->msgA_PUSCH_Config_r16->msgA_PUSCH_ResourceGroupA_r16;

const int n_slots_frame = nr_mac->frame_structure.numb_slots_frame;
slot_t msgA_pusch_slot = (slotP + msgA_PUSCH_Resource->msgA_PUSCH_TimeDomainOffset_r16) % n_slots_frame;
Expand Down Expand Up @@ -249,8 +249,9 @@ static void schedule_nr_MsgA_pusch(NR_UplinkConfigCommon_t *uplinkConfigCommon,
pusch_pdu->pusch_data.new_data_indicator = 1;
pusch_pdu->nrOfLayers = 1;
pusch_pdu->num_dmrs_cdm_grps_no_data = L <= 2 ? 1 : 2; // no data in dmrs symbols as in 6.2.2 in 38.214
pusch_pdu->ul_dmrs_symb_pos = get_l_prime(3, 0, pusch_dmrs_pos2, pusch_len1, 10, dmrs_TypeA_Position);
pusch_pdu->transform_precoding = *uplinkConfigCommon->initialUplinkBWP->ext1->msgA_ConfigCommon_r16->choice.setup->msgA_PUSCH_Config_r16->msgA_TransformPrecoder_r16;
pusch_pdu->ul_dmrs_symb_pos =
get_l_prime(L, *msgA_PUSCH_Resource->mappingTypeMsgA_PUSCH_r16, pusch_dmrs_pos2, pusch_len1, S, dmrs_TypeA_Position);
pusch_pdu->transform_precoding = *msgacc->msgA_PUSCH_Config_r16->msgA_TransformPrecoder_r16;
pusch_pdu->rb_bitmap[0] = 0;
pusch_pdu->rb_start = msgA_PUSCH_Resource->frequencyStartMsgA_PUSCH_r16; // rb_start depends on the RO
int locationAndBandwidth = uplinkConfigCommon->initialUplinkBWP->genericParameters.locationAndBandwidth;
Expand All @@ -275,25 +276,56 @@ static void schedule_nr_MsgA_pusch(NR_UplinkConfigCommon_t *uplinkConfigCommon,
pusch_pdu->mcs_index = msgA_PUSCH_Resource->msgA_MCS_r16;
pusch_pdu->qam_mod_order = nr_get_Qm_dl(pusch_pdu->mcs_index, pusch_pdu->mcs_table);

int num_dmrs_symb = count_bits64_with_mask(pusch_pdu->ul_dmrs_symb_pos, 10, 3);
int num_dmrs_symb = count_bits64_with_mask(pusch_pdu->ul_dmrs_symb_pos, S, L);
AssertFatal(pusch_pdu->mcs_index <= 28, "Exceeding MCS limit for MsgA PUSCH\n");
int R = nr_get_code_rate_ul(pusch_pdu->mcs_index, pusch_pdu->mcs_table);
pusch_pdu->target_code_rate = R;
int TBS = nr_compute_tbs(pusch_pdu->qam_mod_order,
R,
pusch_pdu->rb_size,
pusch_pdu->nr_of_symbols,
num_dmrs_symb * 12, // nb dmrs set for no data in dmrs symbol
0, // nb_rb_oh
0, // to verify tb scaling
pusch_pdu->nrOfLayers)
>> 3;
R,
pusch_pdu->rb_size,
pusch_pdu->nr_of_symbols,
num_dmrs_symb * 12, // nb dmrs set for no data in dmrs symbol
0, // nb_rb_oh
0, // to verify tb scaling
pusch_pdu->nrOfLayers)
>> 3;

pusch_pdu->pusch_data.tb_size = TBS;
pusch_pdu->maintenance_parms_v3.ldpcBaseGraph = get_BG(TBS << 3, R);

pusch_pdu->param_v4.numSpatialStreamIndices = nr_mac->radio_config.pusch_AntennaPorts;

LOG_D(NR_MAC, "Scheduling MsgA PUSCH in %d.%d\n", msgA_pusch_frame, msgA_pusch_slot);

LOG_D(NR_MAC,
"pdu_bit_map %d rnti %d handle %d rb_size %d mcs_table %d frequency_hopping %d dmrs_ports %d start_symbol_index %d "
"nr_of_symbols %d new_data_indicator %d num_dmrs_cdm_grps_no_data %d ul_dmrs_symb_pos %d transform_precoding %d rb_start "
"%d bwp_size %d bwp_start %d ul_dmrs_scrambling_id %d mcs_index %d qam_mod_order %d target_code_rate %d tb_size %d "
"ldpcBaseGraph %d numSpatialStreamIndices %d\n",
pusch_pdu->pdu_bit_map,
pusch_pdu->rnti,
pusch_pdu->handle,
pusch_pdu->rb_size,
pusch_pdu->mcs_table,
pusch_pdu->frequency_hopping,
pusch_pdu->dmrs_ports,
pusch_pdu->start_symbol_index,
pusch_pdu->nr_of_symbols,
pusch_pdu->pusch_data.new_data_indicator,
pusch_pdu->num_dmrs_cdm_grps_no_data,
pusch_pdu->ul_dmrs_symb_pos,
pusch_pdu->transform_precoding,
pusch_pdu->rb_start,
pusch_pdu->bwp_size,
pusch_pdu->bwp_start,
pusch_pdu->ul_dmrs_scrambling_id,
pusch_pdu->mcs_index,
pusch_pdu->qam_mod_order,
pusch_pdu->target_code_rate,
pusch_pdu->pusch_data.tb_size,
pusch_pdu->maintenance_parms_v3.ldpcBaseGraph,
pusch_pdu->param_v4.numSpatialStreamIndices);

UL_tti_req->n_pdus += 1;
}

Expand Down Expand Up @@ -476,15 +508,14 @@ void schedule_nr_prach(module_id_t module_idP, frame_t frameP, slot_t slotP)
}
}
if (initialUplinkBWP->ext1 && initialUplinkBWP->ext1->msgA_ConfigCommon_r16) {
if (gNB->UE_info.connected_ue_list[0] == NULL)
schedule_nr_MsgA_pusch(scc->uplinkConfigCommon,
gNB,
module_idP,
frameP,
slotP,
prach_pdu,
scc->dmrs_TypeA_Position,
*scc->physCellId);
schedule_nr_MsgA_pusch(scc->uplinkConfigCommon,
gNB,
module_idP,
frameP,
slotP,
prach_pdu,
scc->dmrs_TypeA_Position,
*scc->physCellId);
}
}
prach_pdu->num_prach_ocas = num_td_occ;
Expand Down
8 changes: 6 additions & 2 deletions openair2/LAYER2/NR_MAC_gNB/gNB_scheduler_primitives.c
Original file line number Diff line number Diff line change
Expand Up @@ -2535,9 +2535,13 @@ NR_UE_info_t *find_nr_UE(NR_UEs_t *UEs, rnti_t rntiP)

NR_UE_info_t *find_ra_UE(NR_UEs_t *UEs, rnti_t rntiP)
{
UE_iterator(UEs->access_ue_list, UE) {
UE_iterator (UEs->access_ue_list, UE) {
if (UE->ra->ra_type == RA_2_STEP && UE->ra->RA_rnti == rntiP) {
LOG_D(NR_MAC, "Search and found RA 2-Step RA_rnti: %04x\n", rntiP);
return UE;
}
if (UE->rnti == rntiP) {
LOG_D(NR_MAC,"Search and found rnti: %04x\n", rntiP);
LOG_D(NR_MAC, "Search and found rnti: %04x\n", rntiP);
return UE;
}
}
Expand Down
Loading
Loading