fix(du/cu/rrc): use the correct MIB data structure
Use the correct MIB data structure, MIB_t. This is required by 38.473, and the LiteOn DU sends only that. So our CU needs to handle it, so align the OAI DU as well.
This commit is contained in:
committed by
Robert Schmidt
parent
1cefbdb87f
commit
ae66ba7a7b
@@ -1181,7 +1181,8 @@ static f1ap_setup_req_t *RC_read_F1Setup(uint64_t id,
|
|||||||
sys_info->mib = calloc(buf_len, sizeof(*sys_info->mib));
|
sys_info->mib = calloc(buf_len, sizeof(*sys_info->mib));
|
||||||
DevAssert(sys_info->mib != NULL);
|
DevAssert(sys_info->mib != NULL);
|
||||||
DevAssert(mib != NULL);
|
DevAssert(mib != NULL);
|
||||||
sys_info->mib_length = encode_MIB_NR(mib, 0, sys_info->mib, buf_len);
|
// encode only the mib message itself
|
||||||
|
sys_info->mib_length = encode_MIB_NR_setup(mib->message.choice.mib, 0, sys_info->mib, buf_len);
|
||||||
DevAssert(sys_info->mib_length == buf_len);
|
DevAssert(sys_info->mib_length == buf_len);
|
||||||
|
|
||||||
DevAssert(sib1 != NULL);
|
DevAssert(sib1 != NULL);
|
||||||
|
|||||||
@@ -1875,6 +1875,18 @@ int encode_MIB_NR(NR_BCCH_BCH_Message_t *mib, int frame, uint8_t *buf, int buf_s
|
|||||||
return (enc_rval.encoded + 7) / 8;
|
return (enc_rval.encoded + 7) / 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int encode_MIB_NR_setup(NR_MIB_t *mib, int frame, uint8_t *buf, int buf_size)
|
||||||
|
{
|
||||||
|
DevAssert(mib != NULL);
|
||||||
|
uint8_t sfn_msb = (uint8_t)((frame >> 4) & 0x3f);
|
||||||
|
*mib->systemFrameNumber.buf = sfn_msb << 2;
|
||||||
|
|
||||||
|
asn_enc_rval_t enc_rval = uper_encode_to_buffer(&asn_DEF_NR_MIB, 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);
|
||||||
|
return (enc_rval.encoded + 7) / 8;
|
||||||
|
}
|
||||||
|
|
||||||
NR_BCCH_DL_SCH_Message_t *get_SIB1_NR(const NR_ServingCellConfigCommon_t *scc, const f1ap_plmn_t *plmn, uint64_t cellID, int tac)
|
NR_BCCH_DL_SCH_Message_t *get_SIB1_NR(const NR_ServingCellConfigCommon_t *scc, const f1ap_plmn_t *plmn, uint64_t cellID, int tac)
|
||||||
{
|
{
|
||||||
AssertFatal(cellID < (1l << 36), "cellID must fit within 36 bits, but is %lu\n", cellID);
|
AssertFatal(cellID < (1l << 36), "cellID must fit within 36 bits, but is %lu\n", cellID);
|
||||||
|
|||||||
@@ -55,6 +55,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);
|
NR_BCCH_BCH_Message_t *get_new_MIB_NR(const NR_ServingCellConfigCommon_t *scc);
|
||||||
void free_MIB_NR(NR_BCCH_BCH_Message_t *mib);
|
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);
|
||||||
|
int encode_MIB_NR_setup(NR_MIB_t *mib, int frame, uint8_t *buf, int buf_size);
|
||||||
|
|
||||||
|
|
||||||
#define NR_MAX_SIB_LENGTH 2976 // 3GPP TS 38.331 section 5.2.1
|
#define NR_MAX_SIB_LENGTH 2976 // 3GPP TS 38.331 section 5.2.1
|
||||||
|
|||||||
@@ -49,35 +49,33 @@ static bool rrc_gNB_plmn_matches(const gNB_RRC_INST *rrc, const f1ap_served_cell
|
|||||||
&& conf->mnc[0] == info->plmn.mnc;
|
&& conf->mnc[0] == info->plmn.mnc;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool extract_sys_info(const f1ap_gnb_du_system_info_t *sys_info, NR_BCCH_BCH_Message_t **mib, NR_SIB1_t **sib1)
|
static bool extract_sys_info(const f1ap_gnb_du_system_info_t *sys_info, NR_MIB_t **mib, NR_SIB1_t **sib1)
|
||||||
{
|
{
|
||||||
DevAssert(sys_info != NULL);
|
DevAssert(sys_info != NULL);
|
||||||
DevAssert(mib != NULL);
|
DevAssert(mib != NULL);
|
||||||
DevAssert(sib1 != NULL);
|
DevAssert(sib1 != NULL);
|
||||||
|
|
||||||
asn_dec_rval_t dec_rval =
|
asn_dec_rval_t dec_rval = uper_decode_complete(NULL, &asn_DEF_NR_MIB, (void **)mib, sys_info->mib, sys_info->mib_length);
|
||||||
uper_decode_complete(NULL, &asn_DEF_NR_BCCH_BCH_Message, (void **)mib, sys_info->mib, sys_info->mib_length);
|
if (dec_rval.code != RC_OK) {
|
||||||
if (dec_rval.code != RC_OK || (*mib)->message.present != NR_BCCH_BCH_MessageType_PR_mib
|
LOG_E(RRC, "Failed to decode NR_MIB (%zu bits) of DU\n", dec_rval.consumed);
|
||||||
|| (*mib)->message.choice.messageClassExtension == NULL) {
|
ASN_STRUCT_FREE(asn_DEF_NR_MIB, *mib);
|
||||||
LOG_E(RRC, "Failed to decode NR_BCCH_BCH_MESSAGE (%zu bits) of DU\n", dec_rval.consumed);
|
|
||||||
ASN_STRUCT_FREE(asn_DEF_NR_BCCH_BCH_Message, *mib);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sys_info->sib1) {
|
if (sys_info->sib1) {
|
||||||
dec_rval = uper_decode_complete(NULL, &asn_DEF_NR_SIB1, (void **)sib1, sys_info->sib1, sys_info->sib1_length);
|
dec_rval = uper_decode_complete(NULL, &asn_DEF_NR_SIB1, (void **)sib1, sys_info->sib1, sys_info->sib1_length);
|
||||||
if (dec_rval.code != RC_OK) {
|
if (dec_rval.code != RC_OK) {
|
||||||
ASN_STRUCT_FREE(asn_DEF_NR_BCCH_BCH_Message, *mib);
|
ASN_STRUCT_FREE(asn_DEF_NR_MIB, *mib);
|
||||||
ASN_STRUCT_FREE(asn_DEF_NR_SIB1, *sib1);
|
ASN_STRUCT_FREE(asn_DEF_NR_SIB1, *sib1);
|
||||||
LOG_E(RRC, "Failed to decode NR_SIB1 (%zu bits), rejecting DU\n", dec_rval.consumed);
|
LOG_E(RRC, "Failed to decode NR_SIB1 (%zu bits), rejecting DU\n", dec_rval.consumed);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (LOG_DEBUGFLAG(DEBUG_ASN1))
|
if (LOG_DEBUGFLAG(DEBUG_ASN1)) {
|
||||||
xer_fprint(stdout, &asn_DEF_NR_BCCH_BCH_Message, *mib);
|
xer_fprint(stdout, &asn_DEF_NR_MIB, *mib);
|
||||||
if (LOG_DEBUGFLAG(DEBUG_ASN1))
|
|
||||||
xer_fprint(stdout, &asn_DEF_NR_SIB1, *sib1);
|
xer_fprint(stdout, &asn_DEF_NR_SIB1, *sib1);
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -145,7 +143,7 @@ void rrc_gNB_process_f1_setup_req(f1ap_setup_req_t *req, sctp_assoc_t assoc_id)
|
|||||||
}
|
}
|
||||||
|
|
||||||
const f1ap_gnb_du_system_info_t *sys_info = req->cell[0].sys_info;
|
const f1ap_gnb_du_system_info_t *sys_info = req->cell[0].sys_info;
|
||||||
NR_BCCH_BCH_Message_t *mib = NULL;
|
NR_MIB_t *mib = NULL;
|
||||||
NR_SIB1_t *sib1 = NULL;
|
NR_SIB1_t *sib1 = NULL;
|
||||||
|
|
||||||
if (sys_info != NULL && sys_info->mib != NULL && !(sys_info->sib1 == NULL && get_softmodem_params()->sa)) {
|
if (sys_info != NULL && sys_info->mib != NULL && !(sys_info->sib1 == NULL && get_softmodem_params()->sa)) {
|
||||||
@@ -170,12 +168,9 @@ void rrc_gNB_process_f1_setup_req(f1ap_setup_req_t *req, sctp_assoc_t assoc_id)
|
|||||||
du->setup_req = calloc(1,sizeof(*du->setup_req));
|
du->setup_req = calloc(1,sizeof(*du->setup_req));
|
||||||
AssertFatal(du->setup_req, "out of memory\n");
|
AssertFatal(du->setup_req, "out of memory\n");
|
||||||
*du->setup_req = *req;
|
*du->setup_req = *req;
|
||||||
if (mib != NULL && sib1 != NULL) {
|
// MIB can be null and configured later via DU Configuration Update
|
||||||
du->mib = mib->message.choice.mib;
|
du->mib = mib;
|
||||||
mib->message.choice.mib = NULL;
|
du->sib1 = sib1;
|
||||||
ASN_STRUCT_FREE(asn_DEF_NR_BCCH_BCH_MessageType, mib);
|
|
||||||
du->sib1 = sib1;
|
|
||||||
}
|
|
||||||
RB_INSERT(rrc_du_tree, &rrc->dus, du);
|
RB_INSERT(rrc_du_tree, &rrc->dus, du);
|
||||||
rrc->num_dus++;
|
rrc->num_dus++;
|
||||||
|
|
||||||
@@ -184,7 +179,7 @@ void rrc_gNB_process_f1_setup_req(f1ap_setup_req_t *req, sctp_assoc_t assoc_id)
|
|||||||
.nr_cellid = cell_info->nr_cellid,
|
.nr_cellid = cell_info->nr_cellid,
|
||||||
.nrpci = cell_info->nr_pci,
|
.nrpci = cell_info->nr_pci,
|
||||||
.num_SI = 0,
|
.num_SI = 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
f1ap_setup_resp_t resp = {.transaction_id = req->transaction_id,
|
f1ap_setup_resp_t resp = {.transaction_id = req->transaction_id,
|
||||||
.num_cells_to_activate = 1,
|
.num_cells_to_activate = 1,
|
||||||
@@ -288,14 +283,12 @@ void rrc_gNB_process_f1_du_configuration_update(f1ap_gnb_du_configuration_update
|
|||||||
if (sys_info->sib1 != NULL)
|
if (sys_info->sib1 != NULL)
|
||||||
ASN_STRUCT_FREE(asn_DEF_NR_SIB1, du->sib1);
|
ASN_STRUCT_FREE(asn_DEF_NR_SIB1, du->sib1);
|
||||||
|
|
||||||
NR_BCCH_BCH_Message_t *mib = NULL;
|
NR_MIB_t *mib = NULL;
|
||||||
if (!extract_sys_info(sys_info, &mib, &du->sib1)) {
|
if (!extract_sys_info(sys_info, &mib, &du->sib1)) {
|
||||||
LOG_W(RRC, "cannot update sys_info for DU %ld\n", du->setup_req->gNB_DU_id);
|
LOG_W(RRC, "cannot update sys_info for DU %ld\n", du->setup_req->gNB_DU_id);
|
||||||
} else {
|
} else {
|
||||||
DevAssert(mib != NULL);
|
DevAssert(mib != NULL);
|
||||||
du->mib = mib->message.choice.mib;
|
du->mib = mib;
|
||||||
mib->message.choice.mib = NULL;
|
|
||||||
ASN_STRUCT_FREE(asn_DEF_NR_BCCH_BCH_MessageType, mib);
|
|
||||||
LOG_I(RRC, "update system information of DU %ld\n", du->setup_req->gNB_DU_id);
|
LOG_I(RRC, "update system information of DU %ld\n", du->setup_req->gNB_DU_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user