Commit 44d5b378 authored by Robert Schmidt's avatar Robert Schmidt

Refactor get_initial_cellGroupConfig()

parent 88e6d9df
...@@ -2884,24 +2884,16 @@ void send_initial_ul_rrc_message(gNB_MAC_INST *mac, int rnti, const uint8_t *sdu ...@@ -2884,24 +2884,16 @@ void send_initial_ul_rrc_message(gNB_MAC_INST *mac, int rnti, const uint8_t *sdu
NR_UE_info_t *UE = (NR_UE_info_t *)rawUE; NR_UE_info_t *UE = (NR_UE_info_t *)rawUE;
uint8_t du2cu_rrc_container[1024]; uint8_t du2cu[1024];
asn_enc_rval_t enc_rval = uper_encode_to_buffer(&asn_DEF_NR_CellGroupConfig, int encoded = encode_cellGroupConfig(UE->CellGroup, du2cu, sizeof(du2cu));
NULL,
UE->CellGroup,
du2cu_rrc_container,
sizeof(du2cu_rrc_container));
AssertFatal(enc_rval.encoded > 0,
"Could not encode cellGroupConfig for UE %04x, failed element %s\n",
rnti,
enc_rval.failed_type->name);
const f1ap_initial_ul_rrc_message_t ul_rrc_msg = { const f1ap_initial_ul_rrc_message_t ul_rrc_msg = {
/* TODO: add mcc, mnc, cell_id, ..., is not available at MAC yet */ /* TODO: add mcc, mnc, cell_id, ..., is not available at MAC yet */
.crnti = rnti, .crnti = rnti,
.rrc_container = (uint8_t *) sdu, .rrc_container = (uint8_t *) sdu,
.rrc_container_length = sdu_len, .rrc_container_length = sdu_len,
.du2cu_rrc_container = (uint8_t *) du2cu_rrc_container, .du2cu_rrc_container = (uint8_t *) du2cu,
.du2cu_rrc_container_length = (enc_rval.encoded + 7) / 8 .du2cu_rrc_container_length = encoded
}; };
mac->mac_rrc.initial_ul_rrc_message_transfer(0, &ul_rrc_msg); mac->mac_rrc.initial_ul_rrc_message_transfer(0, &ul_rrc_msg);
} }
...@@ -2915,20 +2907,7 @@ void prepare_initial_ul_rrc_message(gNB_MAC_INST *mac, NR_UE_info_t *UE) ...@@ -2915,20 +2907,7 @@ void prepare_initial_ul_rrc_message(gNB_MAC_INST *mac, NR_UE_info_t *UE)
gNB_RRC_INST *rrc = RC.nrrrc[mod_id]; gNB_RRC_INST *rrc = RC.nrrrc[mod_id];
const NR_ServingCellConfigCommon_t *scc = rrc->carrier.servingcellconfigcommon; const NR_ServingCellConfigCommon_t *scc = rrc->carrier.servingcellconfigcommon;
const NR_ServingCellConfig_t *sccd = rrc->configuration.scd; const NR_ServingCellConfig_t *sccd = rrc->configuration.scd;
NR_CellGroupConfig_t *cellGroupConfig = calloc(1, sizeof(*cellGroupConfig)); NR_CellGroupConfig_t *cellGroupConfig = get_initial_cellGroupConfig(UE->uid, scc, sccd, &rrc->configuration);
AssertFatal(cellGroupConfig != NULL, "out of memory\n");
fill_initial_cellGroupConfig(UE->uid, cellGroupConfig, scc, sccd, &rrc->configuration);
uint8_t du2cu_rrc_container[1024];
asn_enc_rval_t enc_rval = uper_encode_to_buffer(&asn_DEF_NR_CellGroupConfig,
NULL,
cellGroupConfig,
du2cu_rrc_container,
sizeof(du2cu_rrc_container));
AssertFatal(enc_rval.encoded > 0,
"Could not encode cellGroupConfig for UE %04x, failed element %s\n",
UE->rnti,
enc_rval.failed_type->name);
UE->CellGroup = cellGroupConfig; UE->CellGroup = cellGroupConfig;
nr_mac_update_cellgroup(mac, UE->rnti, cellGroupConfig); nr_mac_update_cellgroup(mac, UE->rnti, cellGroupConfig);
......
This diff is collapsed.
...@@ -64,17 +64,10 @@ void do_SpCellConfig(gNB_RRC_INST *rrc, ...@@ -64,17 +64,10 @@ void do_SpCellConfig(gNB_RRC_INST *rrc,
int do_RRCReject(uint8_t Mod_id, int do_RRCReject(uint8_t Mod_id,
uint8_t *const buffer); uint8_t *const buffer);
void fill_initial_SpCellConfig(int uid, NR_RLC_BearerConfig_t *get_SRB_RLC_BearerConfig(
NR_SpCellConfig_t *SpCellConfig, long channelId,
const NR_ServingCellConfigCommon_t *scc, long priority,
const NR_ServingCellConfig_t *servingcellconfigdedicated, e_NR_LogicalChannelConfig__ul_SpecificParameters__bucketSizeDuration bucketSizeDuration);
const gNB_RrcConfigurationReq *configuration);
void fill_initial_cellGroupConfig(int uid,
NR_CellGroupConfig_t *cellGroupConfig,
const NR_ServingCellConfigCommon_t *scc,
const NR_ServingCellConfig_t *servingcellconfigdedicated,
const gNB_RrcConfigurationReq *configuration);
void update_cellGroupConfig(NR_CellGroupConfig_t *cellGroupConfig, void update_cellGroupConfig(NR_CellGroupConfig_t *cellGroupConfig,
const int uid, const int uid,
......
This diff is collapsed.
...@@ -115,4 +115,12 @@ NR_BCCH_DL_SCH_Message_t *get_SIB1_NR(const gNB_RrcConfigurationReq *configurati ...@@ -115,4 +115,12 @@ NR_BCCH_DL_SCH_Message_t *get_SIB1_NR(const gNB_RrcConfigurationReq *configurati
void free_SIB1_NR(NR_BCCH_DL_SCH_Message_t *sib1); void free_SIB1_NR(NR_BCCH_DL_SCH_Message_t *sib1);
int encode_SIB1_NR(NR_BCCH_DL_SCH_Message_t *sib1, uint8_t *buffer, int max_buffer_size); int encode_SIB1_NR(NR_BCCH_DL_SCH_Message_t *sib1, uint8_t *buffer, int max_buffer_size);
NR_CellGroupConfig_t *get_initial_cellGroupConfig(int uid,
const NR_ServingCellConfigCommon_t *scc,
const NR_ServingCellConfig_t *servingcellconfigdedicated,
const gNB_RrcConfigurationReq *configuration);
void free_cellGroupConfig(NR_CellGroupConfig_t *cellGroupConfig);
int encode_cellGroupConfig(NR_CellGroupConfig_t *cellGroupConfig, uint8_t *buffer, int max_buffer_size);
NR_CellGroupConfig_t *decode_cellGroupConfig(const uint8_t *buffer, int max_buffer_size);
#endif #endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment