Commit 06dd13d3 authored by Victor Souza's avatar Victor Souza

BAP layer init and BAP entity init (needs cleaning)

parent 070ae036
......@@ -748,14 +748,6 @@ 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)){
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)
......
......@@ -36,6 +36,7 @@
#include "f1ap_du_interface_management.h"
#include "openair2/LAYER2/NR_MAC_gNB/mac_rrc_dl_handler.h"
#include "assertions.h"
#include "openair2/LAYER2/BAP/bap_oai_api.h"
#include "GNB_APP/gnb_paramdef.h"
......@@ -387,6 +388,7 @@ int DU_handle_F1_SETUP_RESPONSE(instance_t instance, sctp_assoc_t assoc_id, uint
"ie->value.present != F1AP_F1SetupResponseIEs__value_PR_BAPAddress\n");
BIT_STRING_TO_NR_BAPADDRESS(&ie->value.choice.BAPAddress, resp.bap_address);
LOG_D(F1AP, "F1AP: F1Setup-Resp: BAPAddress %d\n", resp.bap_address);
init_bap_entity(resp.bap_address, true);
break;
case F1AP_ProtocolIE_ID_id_GNB_CU_RRC_Version:
......
......@@ -1149,6 +1149,9 @@ static f1ap_setup_req_t *RC_read_F1Setup(bool is_iab_du,
req->cell[0].info.plmn.mnc,
req->cell[0].info.plmn.mnc_digit_length,
req->cell[0].info.nr_cellid);
LOG_I(GNB_APP, "F1AP: Initializing BAP layer\n");
bool is_du = true;
nr_bap_layer_init(is_du);
}else{
LOG_I(GNB_APP,
"F1AP: gNB idx %d gNB_DU_id %ld, gNB_DU_name %s, TAC %d MCC/MNC/length %d/%d/%d cellID %ld\n",
......
#include "bap_entity.h"
bap_entity_t *new_bap_entity(uint16_t bap_address){
bap_entity_t *new_bap_entity(uint16_t bap_address, bool is_du){
bap_entity_t *ret;
ret = calloc(1, sizeof(bap_entity_t));
if (ret == NULL) {
LOG_E(, "%s:%d:%s: out of memory\n", __FILE__, __LINE__, __FUNCTION__);
// Change to BAP log
LOG_E(RLC, "%s:%d:%s: out of memory\n", __FILE__, __LINE__, __FUNCTION__);
exit(1);
}
if (pthread_mutex_init(&ret->lock, NULL)) abort();
ret->is_du = is_du;
ret->bap_address = bap_address;
return (bap_entity_t *)ret;
}
void bap_add_entity(int rnti, uint16_t bap_address)
{
}
#include <stdint.h>
#include <pthread.h>
typedef struct{
uint16_t bap_address;
uint16_t bap_path_id;
}bap_routing_id_t;
typedef struct{
uint16_t priorHop_bap_address;
uint16_t ingress_bhch_ID;
uint16_t nextHop_bap_address;
uint16_t egress_bhch_ID;
} bap_bhch_mapping_info_t;
typedef struct bap_entity_t{
pthread_mutex_t lock;
bool is_du; // true if DU, false if MT
uint16_t bap_address;
bap_routing_id_t defaultUL_bap_routing_id;
uint16_t befaultUL_bh_rlc_channel_id;
......@@ -16,4 +26,9 @@ typedef struct bap_entity_t{
BOTH
}flow_control_feedback_type;
}bap_entity_t;
\ No newline at end of file
// From BAPlayerBHRLCchannelMappingInfo
// Use mappingInformationIndex to navigate the list
bap_bhch_mapping_info_t *bhch_mapping_info_list;
}bap_entity_t;
bap_entity_t *new_bap_entity(uint16_t bap_address, bool is_du);
\ No newline at end of file
/* from openair */
#include "rlc.h"
#include "LAYER2/nr_pdcp/nr_pdcp_oai_api.h"
/* from nr rlc module */
#include "openair2/LAYER2/nr_rlc/nr_rlc_asn1_utils.h"
......@@ -19,12 +18,15 @@
#include "conversions.h"
#include "bap_oai_api.h"
extern RAN_CONTEXT_t RC;
// Having trouble changing this to .h
#include "bap_entity.c"
#include <stdint.h>
extern RAN_CONTEXT_t RC;
#include <executables/softmodem-common.h>
static bap_entity_t *bap_entity;
// Same as RLC?
static void deliver_bap_sdu(void *_ue, nr_rlc_entity_t *entity, char *buf, int size)
{
......@@ -192,11 +194,13 @@ void nr_bap_layer_init(bool is_du)
if (pthread_mutex_lock(&m) != 0) abort();
if (is_du && inited_DU) {
// Change LOG to BAP
LOG_E(RLC, "%s:%d:%s: fatal, inited_du already 1\n", __FILE__, __LINE__, __FUNCTION__);
exit(1);
}
if (!is_du && inited_MT) {
// Change LOG to BAP
LOG_E(RLC, "%s:%d:%s: fatal, inited_mt already 1\n", __FILE__, __LINE__, __FUNCTION__);
exit(1);
}
......@@ -208,3 +212,12 @@ void nr_bap_layer_init(bool is_du)
if (pthread_mutex_unlock(&m)) abort();
}
void init_bap_entity(uint16_t bap_addr, bool is_du){
bap_entity = new_bap_entity(bap_addr, is_du);
if (is_du)
printf("[BAP] BAP entity initialized as IAB-DU with BAPAddress = %d\n", bap_entity->bap_address);
else
printf("[BAP] BAP entity initialized as IAB-MT with BAPAddress = %d\n", bap_entity->bap_address);
}
void nr_bap_layer_init(bool is_du);
\ No newline at end of file
#include <stdint.h>
void bap_add_bhch(int rnti, int bhch_id, const NR_BH_RLC_ChannelConfig_r16_t *rlc_bhchConfig);
void nr_bap_layer_init(bool is_du);
void init_bap_entity(uint16_t bap_addr, bool is_du);
\ No newline at end of file
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