NR specific rlc_module_init function
This commit is contained in:
@@ -75,7 +75,7 @@ unsigned short config_frames[4] = {2,9,11,13};
|
|||||||
#include <openair2/LAYER2/NR_MAC_UE/mac_proto.h>
|
#include <openair2/LAYER2/NR_MAC_UE/mac_proto.h>
|
||||||
#include <openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.h>
|
#include <openair2/NR_UE_PHY_INTERFACE/NR_IF_Module.h>
|
||||||
#include <openair1/SCHED_NR_UE/fapi_nr_ue_l1.h>
|
#include <openair1/SCHED_NR_UE/fapi_nr_ue_l1.h>
|
||||||
|
#include "nr_rlc/nr_rlc_oai_api.h"
|
||||||
/* Callbacks, globals and object handlers */
|
/* Callbacks, globals and object handlers */
|
||||||
|
|
||||||
//#include "stats.h"
|
//#include "stats.h"
|
||||||
@@ -313,7 +313,7 @@ static void init_pdcp(int ue_id)
|
|||||||
// was always set. further refactoring could take it out
|
// was always set. further refactoring could take it out
|
||||||
pdcp_initmask = pdcp_initmask | UE_NAS_USE_TUN_BIT;
|
pdcp_initmask = pdcp_initmask | UE_NAS_USE_TUN_BIT;
|
||||||
|
|
||||||
if (get_softmodem_params()->nsa && rlc_module_init(0) != 0) {
|
if (get_softmodem_params()->nsa && nr_rlc_module_init(0) != 0) {
|
||||||
LOG_I(RLC, "Problem at RLC initiation \n");
|
LOG_I(RLC, "Problem at RLC initiation \n");
|
||||||
}
|
}
|
||||||
nr_pdcp_layer_init();
|
nr_pdcp_layer_init();
|
||||||
|
|||||||
@@ -38,7 +38,6 @@
|
|||||||
#include "nr_rlc/nr_rlc_oai_api.h"
|
#include "nr_rlc/nr_rlc_oai_api.h"
|
||||||
#include "RRC/NR_UE/rrc_proto.h"
|
#include "RRC/NR_UE/rrc_proto.h"
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#include "openair2/LAYER2/RLC/rlc.h"
|
|
||||||
static NR_UE_MAC_INST_t *nr_ue_mac_inst;
|
static NR_UE_MAC_INST_t *nr_ue_mac_inst;
|
||||||
|
|
||||||
void send_srb0_rrc(int ue_id, const uint8_t *sdu, sdu_size_t sdu_len, void *data)
|
void send_srb0_rrc(int ue_id, const uint8_t *sdu, sdu_size_t sdu_len, void *data)
|
||||||
@@ -141,7 +140,7 @@ NR_UE_MAC_INST_t *nr_l2_init_ue(int nb_inst)
|
|||||||
ue_init_config_request(mac, get_slots_per_frame_from_scs(get_softmodem_params()->numerology));
|
ue_init_config_request(mac, get_slots_per_frame_from_scs(get_softmodem_params()->numerology));
|
||||||
}
|
}
|
||||||
|
|
||||||
int rc = rlc_module_init(0);
|
int rc = nr_rlc_module_init(0);
|
||||||
AssertFatal(rc == 0, "Could not initialize RLC layer\n");
|
AssertFatal(rc == 0, "Could not initialize RLC layer\n");
|
||||||
|
|
||||||
for (int j = 0; j < nb_inst; j++) {
|
for (int j = 0; j < nb_inst; j++) {
|
||||||
|
|||||||
@@ -66,7 +66,6 @@
|
|||||||
#include "nr_pdcp/nr_pdcp_oai_api.h"
|
#include "nr_pdcp/nr_pdcp_oai_api.h"
|
||||||
#include "nr_rlc/nr_rlc_oai_api.h"
|
#include "nr_rlc/nr_rlc_oai_api.h"
|
||||||
#include "openair2/F1AP/f1ap_ids.h"
|
#include "openair2/F1AP/f1ap_ids.h"
|
||||||
#include "rlc.h"
|
|
||||||
#include "seq_arr.h"
|
#include "seq_arr.h"
|
||||||
#include "system.h"
|
#include "system.h"
|
||||||
#include "time_meas.h"
|
#include "time_meas.h"
|
||||||
@@ -304,7 +303,7 @@ void mac_top_init_gNB(ngran_node_t node_type,
|
|||||||
mac_rrc_init(RC.nrmac[i], node_type);
|
mac_rrc_init(RC.nrmac[i], node_type);
|
||||||
}//END for (i = 0; i < RC.nb_nr_macrlc_inst; i++)
|
}//END for (i = 0; i < RC.nb_nr_macrlc_inst; i++)
|
||||||
|
|
||||||
AssertFatal(rlc_module_init(1) == 0,"Could not initialize RLC layer\n");
|
AssertFatal(nr_rlc_module_init(1) == 0,"Could not initialize RLC layer\n");
|
||||||
|
|
||||||
// These should be out of here later
|
// These should be out of here later
|
||||||
if (get_softmodem_params()->usim_test == 0 ) nr_pdcp_layer_init();
|
if (get_softmodem_params()->usim_test == 0 ) nr_pdcp_layer_init();
|
||||||
|
|||||||
@@ -322,7 +322,7 @@ int nr_rlc_get_available_tx_space(const int ue_id, const logical_chan_id_t chann
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int rlc_module_init(int enb_flag)
|
int nr_rlc_module_init(int gnb_flag)
|
||||||
{
|
{
|
||||||
static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
|
static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
|
||||||
static int inited = 0;
|
static int inited = 0;
|
||||||
@@ -330,20 +330,22 @@ int rlc_module_init(int enb_flag)
|
|||||||
|
|
||||||
if (pthread_mutex_lock(&lock)) abort();
|
if (pthread_mutex_lock(&lock)) abort();
|
||||||
|
|
||||||
if (enb_flag == 1 && inited) {
|
if (gnb_flag == 1 && inited) {
|
||||||
LOG_E(RLC, "%s:%d:%s: fatal, inited already 1\n", __FILE__, __LINE__, __FUNCTION__);
|
LOG_E(RLC, "%s:%d:%s: fatal, inited already 1\n", __FILE__, __LINE__, __FUNCTION__);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (enb_flag == 0 && inited_ue) {
|
if (gnb_flag == 0 && inited_ue) {
|
||||||
LOG_E(RLC, "%s:%d:%s: fatal, inited_ue already 1\n", __FILE__, __LINE__, __FUNCTION__);
|
LOG_E(RLC, "%s:%d:%s: fatal, inited_ue already 1\n", __FILE__, __LINE__, __FUNCTION__);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (enb_flag == 1) inited = 1;
|
if (gnb_flag == 1)
|
||||||
if (enb_flag == 0) inited_ue = 1;
|
inited = 1;
|
||||||
|
if (gnb_flag == 0)
|
||||||
|
inited_ue = 1;
|
||||||
|
|
||||||
nr_rlc_ue_manager = new_nr_rlc_ue_manager(enb_flag);
|
nr_rlc_ue_manager = new_nr_rlc_ue_manager(gnb_flag);
|
||||||
|
|
||||||
if (pthread_mutex_unlock(&lock)) abort();
|
if (pthread_mutex_unlock(&lock)) abort();
|
||||||
|
|
||||||
@@ -358,7 +360,6 @@ static void deliver_sdu(void *_ue, nr_rlc_entity_t *entity, char *buf, int size)
|
|||||||
protocol_ctxt_t ctx;
|
protocol_ctxt_t ctx;
|
||||||
uint8_t *memblock;
|
uint8_t *memblock;
|
||||||
int i;
|
int i;
|
||||||
int is_enb;
|
|
||||||
|
|
||||||
/* is it SRB? */
|
/* is it SRB? */
|
||||||
for (i = 0; i < sizeofArray(ue->srb); i++) {
|
for (i = 0; i < sizeofArray(ue->srb); i++) {
|
||||||
@@ -391,21 +392,21 @@ rb_found:
|
|||||||
ctx.eNB_index = 0;
|
ctx.eNB_index = 0;
|
||||||
ctx.brOption = 0;
|
ctx.brOption = 0;
|
||||||
|
|
||||||
is_enb = nr_rlc_manager_get_enb_flag(nr_rlc_ue_manager);
|
int is_gnb = nr_rlc_manager_get_gnb_flag(nr_rlc_ue_manager);
|
||||||
|
|
||||||
/* used fields? */
|
/* used fields? */
|
||||||
ctx.module_id = 0;
|
ctx.module_id = 0;
|
||||||
/* CU (PDCP, RRC, SDAP) use a different ID than RNTI, so below set the CU UE
|
/* CU (PDCP, RRC, SDAP) use a different ID than RNTI, so below set the CU UE
|
||||||
* ID if in gNB, else use RNTI normally */
|
* ID if in gNB, else use RNTI normally */
|
||||||
ctx.rntiMaybeUEid = ue->ue_id;
|
ctx.rntiMaybeUEid = ue->ue_id;
|
||||||
if (is_enb) {
|
if (is_gnb) {
|
||||||
f1_ue_data_t ue_data = du_get_f1_ue_data(ue->ue_id);
|
f1_ue_data_t ue_data = du_get_f1_ue_data(ue->ue_id);
|
||||||
ctx.rntiMaybeUEid = ue_data.secondary_ue;
|
ctx.rntiMaybeUEid = ue_data.secondary_ue;
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.enb_flag = is_enb;
|
ctx.enb_flag = is_gnb;
|
||||||
|
|
||||||
if (is_enb) {
|
if (is_gnb) {
|
||||||
T(T_ENB_RLC_UL,
|
T(T_ENB_RLC_UL,
|
||||||
T_INT(0 /*ctxt_pP->module_id*/),
|
T_INT(0 /*ctxt_pP->module_id*/),
|
||||||
T_INT(ue->ue_id), T_INT(rb_id), T_INT(size));
|
T_INT(ue->ue_id), T_INT(rb_id), T_INT(size));
|
||||||
@@ -465,7 +466,6 @@ static void successful_delivery(void *_ue, nr_rlc_entity_t *entity, int sdu_id)
|
|||||||
#if 0
|
#if 0
|
||||||
MessageDef *msg;
|
MessageDef *msg;
|
||||||
#endif
|
#endif
|
||||||
int is_enb;
|
|
||||||
|
|
||||||
/* is it SRB? */
|
/* is it SRB? */
|
||||||
for (i = 0; i < 2; i++) {
|
for (i = 0; i < 2; i++) {
|
||||||
@@ -498,8 +498,8 @@ rb_found:
|
|||||||
if (is_srb == 0)
|
if (is_srb == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
is_enb = nr_rlc_manager_get_enb_flag(nr_rlc_ue_manager);
|
int is_gnb = nr_rlc_manager_get_gnb_flag(nr_rlc_ue_manager);
|
||||||
if (!is_enb)
|
if (!is_gnb)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
|||||||
@@ -41,6 +41,7 @@
|
|||||||
struct NR_RLC_Config;
|
struct NR_RLC_Config;
|
||||||
struct NR_LogicalChannelConfig;
|
struct NR_LogicalChannelConfig;
|
||||||
|
|
||||||
|
int nr_rlc_module_init(int gnb_flag);
|
||||||
void nr_mac_rlc_data_ind(const module_id_t module_idP,
|
void nr_mac_rlc_data_ind(const module_id_t module_idP,
|
||||||
const uint16_t ue_id,
|
const uint16_t ue_id,
|
||||||
const bool gnb_flagP,
|
const bool gnb_flagP,
|
||||||
|
|||||||
@@ -31,10 +31,10 @@ typedef struct {
|
|||||||
pthread_mutex_t lock;
|
pthread_mutex_t lock;
|
||||||
nr_rlc_ue_t **ue_list;
|
nr_rlc_ue_t **ue_list;
|
||||||
int ue_count;
|
int ue_count;
|
||||||
int enb_flag;
|
int gnb_flag;
|
||||||
} nr_rlc_ue_manager_internal_t;
|
} nr_rlc_ue_manager_internal_t;
|
||||||
|
|
||||||
nr_rlc_ue_manager_t *new_nr_rlc_ue_manager(int enb_flag)
|
nr_rlc_ue_manager_t *new_nr_rlc_ue_manager(int gnb_flag)
|
||||||
{
|
{
|
||||||
nr_rlc_ue_manager_internal_t *ret;
|
nr_rlc_ue_manager_internal_t *ret;
|
||||||
|
|
||||||
@@ -45,15 +45,15 @@ nr_rlc_ue_manager_t *new_nr_rlc_ue_manager(int enb_flag)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (pthread_mutex_init(&ret->lock, NULL)) abort();
|
if (pthread_mutex_init(&ret->lock, NULL)) abort();
|
||||||
ret->enb_flag = enb_flag;
|
ret->gnb_flag = gnb_flag;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int nr_rlc_manager_get_enb_flag(nr_rlc_ue_manager_t *_m)
|
int nr_rlc_manager_get_gnb_flag(nr_rlc_ue_manager_t *_m)
|
||||||
{
|
{
|
||||||
nr_rlc_ue_manager_internal_t *m = _m;
|
nr_rlc_ue_manager_internal_t *m = _m;
|
||||||
return m->enb_flag;
|
return m->gnb_flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
void nr_rlc_manager_lock(nr_rlc_ue_manager_t *_m)
|
void nr_rlc_manager_lock(nr_rlc_ue_manager_t *_m)
|
||||||
|
|||||||
@@ -52,9 +52,9 @@ typedef struct nr_rlc_ue_t {
|
|||||||
/* manager functions */
|
/* manager functions */
|
||||||
/***********************************************************************/
|
/***********************************************************************/
|
||||||
|
|
||||||
nr_rlc_ue_manager_t *new_nr_rlc_ue_manager(int enb_flag);
|
nr_rlc_ue_manager_t *new_nr_rlc_ue_manager(int gnb_flag);
|
||||||
|
|
||||||
int nr_rlc_manager_get_enb_flag(nr_rlc_ue_manager_t *m);
|
int nr_rlc_manager_get_gnb_flag(nr_rlc_ue_manager_t *m);
|
||||||
|
|
||||||
void nr_rlc_manager_lock(nr_rlc_ue_manager_t *m);
|
void nr_rlc_manager_lock(nr_rlc_ue_manager_t *m);
|
||||||
void nr_rlc_manager_unlock(nr_rlc_ue_manager_t *m);
|
void nr_rlc_manager_unlock(nr_rlc_ue_manager_t *m);
|
||||||
|
|||||||
Reference in New Issue
Block a user