Compare commits

...

1 Commits

Author SHA1 Message Date
Bartosz Podrygajlo
554b77cf4e send cellBarred mib for the first 100 frames. 2025-04-10 10:54:55 +02:00
4 changed files with 20 additions and 8 deletions

View File

@@ -1319,7 +1319,7 @@ f1ap_gnb_du_system_info_t *get_sys_info(NR_BCCH_BCH_Message_t *mib, const NR_BCC
sys_info->mib = calloc_or_fail(buf_len, sizeof(*sys_info->mib));
DevAssert(mib != NULL);
sys_info->mib_length = encode_MIB_NR(mib, 0, sys_info->mib, buf_len);
sys_info->mib_length = encode_MIB_NR(mib, 0, sys_info->mib, buf_len, false);
DevAssert(sys_info->mib_length == buf_len);
DevAssert(sib1 != NULL);

View File

@@ -105,11 +105,11 @@ static void fill_ssb_vrb_map(NR_COMMON_channels_t *cc,
vrb_map[rbStart + rb] = SL_to_bitmap(symStart % NR_NUMBER_OF_SYMBOLS_PER_SLOT, 4);
}
static int encode_mib(NR_BCCH_BCH_Message_t *mib, frame_t frame, uint8_t *buffer, int buf_size)
static int encode_mib(NR_BCCH_BCH_Message_t *mib, frame_t frame, uint8_t *buffer, int buf_size, bool cell_barred)
{
int encode_size = 3;
AssertFatal(buf_size >= encode_size, "buffer of size %d too small, need 3 bytes\n", buf_size);
int encoded = encode_MIB_NR(mib, frame, buffer, encode_size);
int encoded = encode_MIB_NR(mib, frame, buffer, encode_size, cell_barred);
DevAssert(encoded == encode_size);
return encode_size;
}
@@ -130,7 +130,19 @@ void schedule_nr_mib(module_id_t module_idP, frame_t frameP, slot_t slotP, nfapi
// get MIB every 8 frames
if(((slotP == 0) && (frameP & 7) == 0) ||
gNB->first_MIB) {
int mib_sdu_length = encode_mib(cc->mib, frameP, cc->MIB_pdu, sizeof(cc->MIB_pdu));
static int num_cell_barred_mibs = 0;
if (gNB->first_MIB) {
num_cell_barred_mibs = 0;
}
bool cell_barred = true;
int num_frames_cell_barred = num_cell_barred_mibs * 8;
int num_ra_occasions_per_frame = 1;
if (num_frames_cell_barred < 100 * num_ra_occasions_per_frame) {
cell_barred = false;
} else {
num_cell_barred_mibs++;
}
int mib_sdu_length = encode_mib(cc->mib, frameP, cc->MIB_pdu, sizeof(cc->MIB_pdu), cell_barred);
// flag to avoid sending an empty MIB in the first frames of execution since gNB doesn't get at the beginning in frame 0 slot 0
gNB->first_MIB = false;

View File

@@ -2073,7 +2073,7 @@ NR_BCCH_BCH_Message_t *get_new_MIB_NR(const NR_ServingCellConfigCommon_t *scc)
AssertFatal(1 == 0, "Unknown dmrs_TypeA_Position %d\n", (int)scc->dmrs_TypeA_Position);
}
mib->message.choice.mib->cellBarred = NR_MIB__cellBarred_notBarred;
mib->message.choice.mib->cellBarred = NR_MIB__cellBarred_barred;
mib->message.choice.mib->intraFreqReselection = NR_MIB__intraFreqReselection_notAllowed;
return mib;
}
@@ -2083,12 +2083,12 @@ void free_MIB_NR(NR_BCCH_BCH_Message_t *mib)
ASN_STRUCT_FREE(asn_DEF_NR_BCCH_BCH_Message, mib);
}
int encode_MIB_NR(NR_BCCH_BCH_Message_t *mib, int frame, uint8_t *buf, int buf_size)
int encode_MIB_NR(NR_BCCH_BCH_Message_t *mib, int frame, uint8_t *buf, int buf_size, bool cell_barred)
{
DevAssert(mib != NULL && mib->message.choice.mib->systemFrameNumber.buf != NULL);
uint8_t sfn_msb = (uint8_t)((frame >> 4) & 0x3f);
*mib->message.choice.mib->systemFrameNumber.buf = sfn_msb << 2;
mib->message.choice.mib->cellBarred = cell_barred ? NR_MIB__cellBarred_barred : NR_MIB__cellBarred_notBarred;
asn_enc_rval_t enc_rval = uper_encode_to_buffer(&asn_DEF_NR_BCCH_BCH_Message, NULL, mib, buf, buf_size);
AssertFatal(enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n", enc_rval.failed_type->name, enc_rval.encoded);
LOG_D(NR_RRC, "Encoded MIB for frame %d sfn_msb %d, bits %lu\n", frame, sfn_msb, enc_rval.encoded);

View File

@@ -69,7 +69,7 @@ void prepare_sim_uecap(NR_UE_NR_Capability_t *cap,
NR_BCCH_BCH_Message_t *get_new_MIB_NR(const NR_ServingCellConfigCommon_t *scc);
void free_MIB_NR(NR_BCCH_BCH_Message_t *mib);
int encode_MIB_NR(NR_BCCH_BCH_Message_t *mib, int frame, uint8_t *buf, int buf_size);
int encode_MIB_NR(NR_BCCH_BCH_Message_t *mib, int frame, uint8_t *buf, int buf_size, bool cell_barred);
int encode_MIB_NR_setup(NR_MIB_t *mib, int frame, uint8_t *buf, int buf_size);
struct NR_MeasurementTimingConfiguration;