Refactor (F1AP/RRC): convert SIB containers to byte_array_t
Unify SIB container handling by introducing a typed SIB enum and storing SIB payloads as byte_array_t across common NR types, F1AP helpers, MAC, and RRC DU setup code. Changes: - Include byte_array support in nr_common.h, add nr_sib_type_t (NR_SIB_1–NR_SIB_21), and change nr_SIBs_t to hold only nr_sib_type_t SIB_type. - Switch f1ap_sib_msg_t in f1ap_messages_types.h to use a byte_array_t SI_container instead of raw pointer and length fields. - Update F1AP encode/decode, equality, copy, and free helpers in f1ap_interface_management.c to work on SI_container.buf / SI_container.len and use eq_byte_array, copy_byte_array, and free_byte_array. - Adapt F1AP tests in f1ap_lib_test.c to build and inspect SIB containers via SI_container.buf and SI_container.len. - Replace magic SIB numbers with nr_sib_type_t values in gnb_config.c (get_sys_info and fill_du_sibs) to validate and configure DU SIBs. - Rework nr_mac_configure_other_sib in NR_MAC_gNB/config.c to decode SIB2 from a byte_array_t container, fix freeing by releasing the decoded sib2 on failure, and use NR_SIB_2 / NR_SIB_19 for CU/DU SIB selection. - Add an add_si_msg helper in rrc_gNB_du.c and refactor the SIB2 branch of rrc_gNB_process_f1_setup_req to populate cell->SI_msg from encoded local byte array while iterating SIBs with FOR_EACH_SEQ_ARR.
This commit is contained in:
@@ -297,6 +297,17 @@ static void cp_f1_served_cell_info_to_cell(nr_rrc_cell_container_t *dst, const f
|
||||
}
|
||||
}
|
||||
|
||||
static void add_si_msg(served_cells_to_activate_t *cell, int sib_type, const byte_array_t *enc)
|
||||
{
|
||||
AssertFatal(cell->num_SI < F1AP_MAX_NO_SIB_TYPES,
|
||||
"Too many SI messages (%u), max supported is %u\n",
|
||||
cell->num_SI,
|
||||
F1AP_MAX_NO_SIB_TYPES);
|
||||
cell->SI_msg[cell->num_SI].SI_container = copy_byte_array(*enc);
|
||||
cell->SI_msg[cell->num_SI].SI_type = sib_type;
|
||||
cell->num_SI++;
|
||||
}
|
||||
|
||||
void rrc_gNB_process_f1_setup_req(f1ap_setup_req_t *req, sctp_assoc_t assoc_id)
|
||||
{
|
||||
AssertFatal(assoc_id != 0, "illegal assoc_id == 0: should be -1 (monolithic) or >0 (split)\n");
|
||||
@@ -425,16 +436,13 @@ void rrc_gNB_process_f1_setup_req(f1ap_setup_req_t *req, sctp_assoc_t assoc_id)
|
||||
// Encode CU SIBs and configure setup response with sysinfo
|
||||
seq_arr_t *sibs = rrc->SIBs;
|
||||
if (sibs) {
|
||||
for (int i = 0; i < sibs->size; i++) {
|
||||
nr_SIBs_t *sib = (nr_SIBs_t *)seq_arr_at(sibs, i);
|
||||
FOR_EACH_SEQ_ARR (nr_SIBs_t *, sib, sibs) {
|
||||
switch (sib->SIB_type) {
|
||||
case 2: {
|
||||
case NR_SIB_2: {
|
||||
NR_SSB_MTC_t *ssbmtc = get_ssb_mtc(new->mtc);
|
||||
sib->SIB_size = do_SIB2_NR(&sib->SIB_buffer, ssbmtc);
|
||||
cell.SI_msg[cell.num_SI].SI_container = sib->SIB_buffer;
|
||||
cell.SI_msg[cell.num_SI].SI_container_length = sib->SIB_size;
|
||||
cell.SI_msg[cell.num_SI].SI_type = sib->SIB_type;
|
||||
cell.num_SI++;
|
||||
byte_array_t ba = {0};
|
||||
ba.len = do_SIB2_NR(&ba.buf, ssbmtc);
|
||||
add_si_msg(&cell, sib->SIB_type, &ba);
|
||||
} break;
|
||||
default:
|
||||
AssertFatal(false, "SIB%d not handled yet\n", sib->SIB_type);
|
||||
|
||||
Reference in New Issue
Block a user