Commit 67d5f56a authored by Robert Schmidt's avatar Robert Schmidt

Read F1 Setup Req at MAC initialization

Previously, filling of F1 Setup Request depended on reading the RRC;
hence, for timing reasons, we only initialized and sent the F1 Setup
Request once the MAC and RRC are ready.

After moving SCC, SCD, MIB, and SIB1 to MAC, the MAC does not depend on
an RRC being present anymore, and hence, the F1 Setup Request does
neither. In this commit, we read the F1 Setup Request after initializing
the MAC.
parent a62857a7
...@@ -52,6 +52,8 @@ ...@@ -52,6 +52,8 @@
#include "openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.h" #include "openair2/LAYER2/nr_pdcp/nr_pdcp_oai_api.h"
#include "openair2/E1AP/e1ap.h" #include "openair2/E1AP/e1ap.h"
#include "gnb_config.h" #include "gnb_config.h"
#include "openair2/LAYER2/NR_MAC_gNB/mac_proto.h"
extern unsigned char NB_gNB_INST; extern unsigned char NB_gNB_INST;
extern RAN_CONTEXT_t RC; extern RAN_CONTEXT_t RC;
...@@ -162,7 +164,8 @@ void *gNB_app_task(void *args_p) ...@@ -162,7 +164,8 @@ void *gNB_app_task(void *args_p)
} }
} }
if (NODE_IS_DU(node_type) || NODE_IS_MONOLITHIC(node_type)) { if (NODE_IS_DU(node_type) || NODE_IS_MONOLITHIC(node_type)) {
RC_config_trigger_F1Setup(); // need to check SA?
nr_mac_send_f1_setup_req();
} }
} }
do { do {
......
...@@ -949,6 +949,8 @@ static NR_ServingCellConfig_t *get_scd_config(void) ...@@ -949,6 +949,8 @@ static NR_ServingCellConfig_t *get_scd_config(void)
// temporary minRXTXTIME, to be taken out once all radio config is read at DU // temporary minRXTXTIME, to be taken out once all radio config is read at DU
static int minRXTXTIME = 6; static int minRXTXTIME = 6;
static f1ap_setup_req_t *RC_read_F1Setup(const NR_ServingCellConfigCommon_t *scc, NR_BCCH_BCH_Message_t *mib, const NR_BCCH_DL_SCH_Message_t *sib1);
void RCconfig_nr_macrlc() { void RCconfig_nr_macrlc() {
int j = 0; int j = 0;
uint16_t prbbl[275] = {0}; uint16_t prbbl[275] = {0};
...@@ -1073,6 +1075,15 @@ void RCconfig_nr_macrlc() { ...@@ -1073,6 +1075,15 @@ void RCconfig_nr_macrlc() {
RC.nrmac[j]->num_ulprbbl = num_prbbl; RC.nrmac[j]->num_ulprbbl = num_prbbl;
memcpy(RC.nrmac[j]->ulprbbl, prbbl, 275 * sizeof(prbbl[0])); memcpy(RC.nrmac[j]->ulprbbl, prbbl, 275 * sizeof(prbbl[0]));
} // for (j=0;j<RC.nb_nr_macrlc_inst;j++) } // for (j=0;j<RC.nb_nr_macrlc_inst;j++)
// read F1 Setup information from config and generated MIB/SIB1
// and store it at MAC for sending later
NR_BCCH_BCH_Message_t *mib = RC.nrmac[0]->common_channels[0].mib;
const NR_BCCH_DL_SCH_Message_t *sib1 = RC.nrmac[0]->common_channels[0].sib1;
f1ap_setup_req_t *req = RC_read_F1Setup(scc, mib, sib1);
AssertFatal(req != NULL, "could not read F1 Setup information\n");
RC.nrmac[0]->f1_config.setup_req = req;
} else { // MacRLC_ParamList.numelt > 0 } else { // MacRLC_ParamList.numelt > 0
LOG_E(PHY, "No %s configuration found\n", CONFIG_STRING_MACRLC_LIST); LOG_E(PHY, "No %s configuration found\n", CONFIG_STRING_MACRLC_LIST);
// AssertFatal (0,"No " CONFIG_STRING_MACRLC_LIST " configuration found"); // AssertFatal (0,"No " CONFIG_STRING_MACRLC_LIST " configuration found");
...@@ -1905,7 +1916,7 @@ int RCconfig_NR_X2(MessageDef *msg_p, uint32_t i) { ...@@ -1905,7 +1916,7 @@ int RCconfig_NR_X2(MessageDef *msg_p, uint32_t i) {
} }
int RC_config_trigger_F1Setup() static f1ap_setup_req_t *RC_read_F1Setup(const NR_ServingCellConfigCommon_t *scc, NR_BCCH_BCH_Message_t *mib, const NR_BCCH_DL_SCH_Message_t *sib1)
{ {
paramdef_t GNBSParams[] = GNBSPARAMS_DESC; paramdef_t GNBSParams[] = GNBSPARAMS_DESC;
paramdef_t GNBParams[] = GNBPARAMS_DESC; paramdef_t GNBParams[] = GNBPARAMS_DESC;
...@@ -1961,10 +1972,6 @@ int RC_config_trigger_F1Setup() ...@@ -1961,10 +1972,6 @@ int RC_config_trigger_F1Setup()
req->cell[0].info.nr_cellid); req->cell[0].info.nr_cellid);
gNB_MAC_INST *mac = RC.nrmac[0];
DevAssert(mac);
const NR_ServingCellConfigCommon_t *scc = mac->common_channels[0].ServingCellConfigCommon;
DevAssert(scc != NULL);
req->cell[0].info.nr_pci = *scc->physCellId; req->cell[0].info.nr_pci = *scc->physCellId;
LOG_W(GNB_APP, "no slices transported via F1 Setup Request!\n"); LOG_W(GNB_APP, "no slices transported via F1 Setup Request!\n");
req->cell[0].info.num_ssi = 0; req->cell[0].info.num_ssi = 0;
...@@ -1993,27 +2000,24 @@ int RC_config_trigger_F1Setup() ...@@ -1993,27 +2000,24 @@ int RC_config_trigger_F1Setup()
req->cell[0].info.measurement_timing_information = "0"; req->cell[0].info.measurement_timing_information = "0";
DevAssert(mac->common_channels[0].mib != NULL);
int buf_len = 3; // this is what we assume in monolithic int buf_len = 3; // this is what we assume in monolithic
req->cell[0].sys_info = calloc(1, sizeof(*req->cell[0].sys_info)); req->cell[0].sys_info = calloc(1, sizeof(*req->cell[0].sys_info));
AssertFatal(req->cell[0].sys_info != NULL, "out of memory\n"); AssertFatal(req->cell[0].sys_info != NULL, "out of memory\n");
f1ap_gnb_du_system_info_t *sys_info = req->cell[0].sys_info; f1ap_gnb_du_system_info_t *sys_info = req->cell[0].sys_info;
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);
sys_info->mib_length = encode_MIB_NR(mac->common_channels[0].mib, 0, sys_info->mib, buf_len); DevAssert(mib != NULL);
sys_info->mib_length = encode_MIB_NR(mib, 0, sys_info->mib, buf_len);
DevAssert(sys_info->mib_length == buf_len); DevAssert(sys_info->mib_length == buf_len);
DevAssert(mac->common_channels[0].sib1 != NULL); DevAssert(sib1 != NULL);
NR_SIB1_t *bcch_SIB1 = mac->common_channels[0].sib1->message.choice.c1->choice.systemInformationBlockType1; NR_SIB1_t *bcch_SIB1 = sib1->message.choice.c1->choice.systemInformationBlockType1;
sys_info->sib1 = calloc(NR_MAX_SIB_LENGTH / 8, sizeof(*sys_info->sib1)); sys_info->sib1 = calloc(NR_MAX_SIB_LENGTH / 8, sizeof(*sys_info->sib1));
asn_enc_rval_t enc_rval = uper_encode_to_buffer(&asn_DEF_NR_SIB1, NULL, (void *)bcch_SIB1, sys_info->sib1, NR_MAX_SIB_LENGTH / 8); asn_enc_rval_t enc_rval = uper_encode_to_buffer(&asn_DEF_NR_SIB1, NULL, (void *)bcch_SIB1, sys_info->sib1, NR_MAX_SIB_LENGTH / 8);
AssertFatal(enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n", enc_rval.failed_type->name, enc_rval.encoded); AssertFatal(enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n", enc_rval.failed_type->name, enc_rval.encoded);
sys_info->sib1_length = (enc_rval.encoded + 7) / 8; sys_info->sib1_length = (enc_rval.encoded + 7) / 8;
mac->mac_rrc.f1_setup_request(req); return req;
mac->f1_config.setup_req = req;
return 0;
} }
void wait_f1_setup_response(void) void wait_f1_setup_response(void)
......
...@@ -103,7 +103,6 @@ extern void NRRCConfig(void); ...@@ -103,7 +103,6 @@ extern void NRRCConfig(void);
void RCconfig_NRRRC(gNB_RRC_INST *rrc); void RCconfig_NRRRC(gNB_RRC_INST *rrc);
int RCconfig_NR_NG(MessageDef *msg_p, uint32_t i); int RCconfig_NR_NG(MessageDef *msg_p, uint32_t i);
int RCconfig_NR_X2(MessageDef *msg_p, uint32_t i); int RCconfig_NR_X2(MessageDef *msg_p, uint32_t i);
int RC_config_trigger_F1Setup(void);
void wait_f1_setup_response(void); void wait_f1_setup_response(void);
int gNB_app_handle_f1ap_gnb_cu_configuration_update(f1ap_gnb_cu_configuration_update_t *gnb_cu_cfg_update); int gNB_app_handle_f1ap_gnb_cu_configuration_update(f1ap_gnb_cu_configuration_update_t *gnb_cu_cfg_update);
MessageDef *RCconfig_NR_CU_E1(bool separate_CUUP_process); MessageDef *RCconfig_NR_CU_E1(bool separate_CUUP_process);
......
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
void set_cset_offset(uint16_t); void set_cset_offset(uint16_t);
void mac_top_init_gNB(ngran_node_t node_type, NR_ServingCellConfigCommon_t *scc, NR_ServingCellConfig_t *scd); void mac_top_init_gNB(ngran_node_t node_type, NR_ServingCellConfigCommon_t *scc, NR_ServingCellConfig_t *scd);
void nr_mac_send_f1_setup_req(void);
int nr_mac_enable_ue_rrc_processing_timer(module_id_t Mod_idP, int nr_mac_enable_ue_rrc_processing_timer(module_id_t Mod_idP,
rnti_t rnti, rnti_t rnti,
......
...@@ -320,3 +320,10 @@ void mac_top_init_gNB(ngran_node_t node_type, NR_ServingCellConfigCommon_t *scc, ...@@ -320,3 +320,10 @@ void mac_top_init_gNB(ngran_node_t node_type, NR_ServingCellConfigCommon_t *scc,
srand48(0); srand48(0);
} }
void nr_mac_send_f1_setup_req(void)
{
gNB_MAC_INST *mac = RC.nrmac[0];
DevAssert(mac);
mac->mac_rrc.f1_setup_request(mac->f1_config.setup_req);
}
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