Commit 070ae036 authored by Victor Souza's avatar Victor Souza

BAP layer initialization on DU

parent f6b42298
......@@ -60,6 +60,7 @@ unsigned short config_frames[4] = {2,9,11,13};
#include "common/utils/LOG/vcd_signal_dumper.h"
#include "UTIL/OPT/opt.h"
#include "LAYER2/nr_pdcp/nr_pdcp_oai_api.h"
#include "LAYER2/BAP/bap_oai_api.h"
#include "intertask_interface.h"
......@@ -81,6 +82,8 @@ unsigned short config_frames[4] = {2,9,11,13};
#include "gnb_config.h"
#include "openair2/E1AP/e1ap_common.h"
#include "openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h" // need to get info from MAC
#ifdef E2_AGENT
#include "openair2/E2AP/flexric/src/agent/e2_agent_api.h"
#include "openair2/E2AP/RAN_FUNCTION/init_ran_func.h"
......@@ -560,7 +563,6 @@ void init_pdcp(void) {
}
#ifdef E2_AGENT
#include "openair2/LAYER2/NR_MAC_gNB/nr_mac_gNB.h" // need to get info from MAC
static void initialize_agent(ngran_node_t node_type, e2_agent_args_t oai_args)
{
AssertFatal(oai_args.sm_dir != NULL , "Please, specify the directory where the SMs are located in the config file, i.e., add in config file the next line: e2_agent = {near_ric_ip_addr = \"127.0.0.1\"; sm_dir = \"/usr/local/lib/flexric/\");} ");
......@@ -744,9 +746,18 @@ int main( int argc, char **argv ) {
}
// wait for F1 Setup Response before starting L1 for real
if (NODE_IS_DU(node_type) || NODE_IS_MONOLITHIC(node_type) || NODE_IS_DU_IAB(node_type))
if (NODE_IS_DU(node_type) || NODE_IS_MONOLITHIC(node_type) || NODE_IS_DU_IAB(node_type)){
wait_f1_setup_response();
// [IAB] Initialize BAP Layer if BAPAddress is present
if(NODE_IS_DU_IAB(node_type)){
LOG_I(GNB_APP, "Initializing BAP layer\n");
bool is_du = true;
nr_bap_layer_init(is_du);
}
}
if (RC.nb_RU > 0)
start_NR_RU();
......
......@@ -385,7 +385,7 @@ int DU_handle_F1_SETUP_RESPONSE(instance_t instance, sctp_assoc_t assoc_id, uint
"ie->criticality != F1AP_Criticality_ignore\n");
AssertFatal(ie->value.present == F1AP_F1SetupResponseIEs__value_PR_BAPAddress,
"ie->value.present != F1AP_F1SetupResponseIEs__value_PR_BAPAddress\n");
NR_BAPADDRESS_TO_BIT_STRING(resp.bap_address, &ie->value.choice.BAPAddress);
BIT_STRING_TO_NR_BAPADDRESS(&ie->value.choice.BAPAddress, resp.bap_address);
LOG_D(F1AP, "F1AP: F1Setup-Resp: BAPAddress %d\n", resp.bap_address);
break;
......
......@@ -17,6 +17,7 @@
#include "common/ran_context.h"
#include "NR_UL-CCCH-Message.h"
#include "conversions.h"
#include "bap_oai_api.h"
extern RAN_CONTEXT_t RC;
......@@ -25,12 +26,12 @@ extern RAN_CONTEXT_t RC;
#include <executables/softmodem-common.h>
// Same as RLC?
static void deliver_sdu(void *_ue, nr_rlc_entity_t *entity, char *buf, int size)
static void deliver_bap_sdu(void *_ue, nr_rlc_entity_t *entity, char *buf, int size)
{
// TODO
}
static void successful_delivery(void *_ue, nr_rlc_entity_t *entity, int sdu_id)
static void successful_bap_delivery(void *_ue, nr_rlc_entity_t *entity, int sdu_id)
{
// TODO
}
......@@ -85,7 +86,7 @@ static void add_bhch_um(int rnti, int bhch_id, const NR_BH_RLC_ChannelConfig_r16
} else {
nr_rlc_entity_t *nr_rlc_um = new_nr_rlc_entity_um(RLC_RX_MAXSIZE,
RLC_TX_MAXSIZE,
deliver_sdu, ue,
deliver_bap_sdu, ue,
t_reassembly,
sn_field_length);
nr_rlc_ue_add_bhch_rlc_entity(ue, bhch_id, nr_rlc_um);
......@@ -151,8 +152,8 @@ static void add_bhch_am(int rnti, int bhch_id, const NR_BH_RLC_ChannelConfig_r16
} else {
nr_rlc_entity_t *nr_rlc_am = new_nr_rlc_entity_am(RLC_RX_MAXSIZE,
RLC_TX_MAXSIZE,
deliver_sdu, ue,
successful_delivery, ue,
deliver_bap_sdu, ue,
successful_bap_delivery, ue,
max_retx_reached, ue,
t_poll_retransmit,
t_reassembly, t_status_prohibit,
......@@ -180,3 +181,30 @@ void bap_add_bhch(int rnti, int bhch_id, const NR_BH_RLC_ChannelConfig_r16_t *rl
}
LOG_I(RLC, "%s:%s:%d: added BH RLC Channel to IAB-MT with RNTI 0x%x\n", __FILE__, __FUNCTION__, __LINE__, rnti);
}
void nr_bap_layer_init(bool is_du)
{
/* hack: be sure to initialize only once */
static pthread_mutex_t m = PTHREAD_MUTEX_INITIALIZER;
static int inited_DU = 0;
static int inited_MT = 0;
if (pthread_mutex_lock(&m) != 0) abort();
if (is_du && inited_DU) {
LOG_E(RLC, "%s:%d:%s: fatal, inited_du already 1\n", __FILE__, __LINE__, __FUNCTION__);
exit(1);
}
if (!is_du && inited_MT) {
LOG_E(RLC, "%s:%d:%s: fatal, inited_mt already 1\n", __FILE__, __LINE__, __FUNCTION__);
exit(1);
}
if (is_du) inited_DU = 1;
if (!is_du) inited_MT = 1;
// nr_rlc_ue_manager = new_nr_rlc_ue_manager(enb_flag);
if (pthread_mutex_unlock(&m)) abort();
}
void nr_bap_layer_init(bool is_du);
\ No newline at end of file
......@@ -112,8 +112,7 @@ int rlcmac_init_global_param_ue(void) {
return 0;
}
int
l2_init_ue(int eMBMS_active, char *uecap_xer, uint8_t cba_group_active,
int l2_init_ue(int eMBMS_active, char *uecap_xer, uint8_t cba_group_active,
uint8_t HO_active) {
LOG_I(MAC, "[MAIN] MAC_INIT_GLOBAL_PARAM IN...\n");
// NB_NODE=2;
......
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