Commit b5f30017 authored by Laurent Thomas's avatar Laurent Thomas

change instance id to 3GPP length

parent 7b2f3440
......@@ -26,11 +26,10 @@
#include <stdlib.h>
#include <inttypes.h>
#include <platform_types.h>
#include <common/utils/backtrace.h>
#include "backtrace.h"
#define _Assert_Exit_ \
fprintf(stderr, "\nExiting execution\n"); \
display_backtrace(); \
fflush(stdout); \
fflush(stderr); \
abort();
......
......@@ -96,39 +96,6 @@ static void read_pipe(int p, char *b, int size) {
}
}
static int baseRunTimeCommand(char* cmd) {
return system(cmd);
}
int checkIfFedoraDistribution(void) {
char cmd[200];
memset(cmd, 0, 200);
sprintf(cmd, "cat /etc/os-release | grep ID_LIKE | grep -ic fedora");
return baseRunTimeCommand(cmd);
}
int checkIfGenericKernelOnFedora(void) {
char cmd[200];
memset(cmd, 0, 200);
sprintf(cmd, "uname -a | grep -c rt");
return (1 - baseRunTimeCommand(cmd));
}
int checkIfInsideContainer(void) {
char cmd[200];
int res = 0;
memset(cmd, 0, 200);
sprintf(cmd, "cat /proc/self/cgroup | egrep -c 'libpod|podman|kubepods'");
res = baseRunTimeCommand(cmd);
if (res > 0)
return 1;
else
return 0;
}
/********************************************************************/
/* background process */
/********************************************************************/
......@@ -242,16 +209,13 @@ void threadCreate(pthread_t* t, void * (*func)(void*), void * param, char* name,
AssertFatal(ret==0,"ret: %d, errno: %d\n",ret, errno);
ret=pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
AssertFatal(ret==0,"ret: %d, errno: %d\n",ret, errno);
ret=pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED);
AssertFatal(ret==0,"ret: %d, errno: %d\n",ret, errno);
if (checkIfFedoraDistribution())
if (checkIfGenericKernelOnFedora())
if (checkIfInsideContainer())
settingPriority = 0;
/*
if (system("grep -iq 'ID_LIKE.*fedora' /etc/os-release && uname -a | grep -c rt")==0)
if (system("cat /proc/self/cgroup | egrep -c 'libpod|podman|kubepods'")==0)
settingPriority = 0;
if (settingPriority) {
ret=pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED);
AssertFatal(ret==0,"ret: %d, errno: %d\n",ret, errno);
ret=pthread_attr_setschedpolicy(&attr, SCHED_OAI);
AssertFatal(ret==0,"ret: %d, errno: %d\n",ret, errno);
if(priority<sched_get_priority_min(SCHED_OAI) || priority>sched_get_priority_max(SCHED_OAI)) {
......@@ -270,7 +234,7 @@ void threadCreate(pthread_t* t, void * (*func)(void*), void * param, char* name,
ret=pthread_attr_setschedparam(&attr, &sparam);
AssertFatal(ret==0,"ret: %d, errno: %d\n",ret, errno);
}
*/
ret=pthread_create(t, &attr, func, param);
AssertFatal(ret==0,"ret: %d, errno: %d\n",ret, errno);
......
......@@ -328,48 +328,32 @@ int create_gNB_tasks(uint32_t gnb_nb) {
}
}
paramdef_t NETParams[] = GNBNETPARAMS_DESC;
char aprefix[MAX_OPTNAME_SIZE*2 + 8];
sprintf(aprefix,"%s.[%i].%s",GNB_CONFIG_STRING_GNB_LIST,0,GNB_CONFIG_STRING_NETWORK_INTERFACES_CONFIG);
config_get( NETParams,sizeof(NETParams)/sizeof(paramdef_t),aprefix);
for(int i = GNB_INTERFACE_NAME_FOR_NG_AMF_IDX; i <= GNB_IPV4_ADDRESS_FOR_NG_AMF_IDX; i++) {
if( NETParams[i].strptr == NULL) {
LOG_E(NGAP, "No configuration in the file.\n");
NGAP_CONF_MODE = 0;
} else {
LOG_D(NGAP, "Configuration in the file: %s.\n",*NETParams[i].strptr);
if (AMF_MODE_ENABLED) {
paramdef_t NETParams[] = GNBNETPARAMS_DESC;
char aprefix[MAX_OPTNAME_SIZE*2 + 8];
sprintf(aprefix,"%s.[%i].%s",GNB_CONFIG_STRING_GNB_LIST,0,GNB_CONFIG_STRING_NETWORK_INTERFACES_CONFIG);
config_get( NETParams,sizeof(NETParams)/sizeof(paramdef_t),aprefix);
for(int i = GNB_INTERFACE_NAME_FOR_NG_AMF_IDX; i <= GNB_IPV4_ADDRESS_FOR_NG_AMF_IDX; i++) {
if( NETParams[i].strptr == NULL) {
LOG_E(NGAP, "No configuration in the file.\n");
NGAP_CONF_MODE = 0;
} else {
LOG_D(NGAP, "Configuration in the file: %s.\n",*NETParams[i].strptr);
}
}
}
if (AMF_MODE_ENABLED) {
if (gnb_nb > 0) {
/*
if (itti_create_task (TASK_SCTP, sctp_eNB_task, NULL) < 0) {
LOG_E(SCTP, "Create task for SCTP failed\n");
return -1;
}
*/
if(NGAP_CONF_MODE) {
if (itti_create_task (TASK_NGAP, ngap_gNB_task, NULL) < 0) {
LOG_E(NGAP, "Create task for NGAP failed\n");
return -1;
}
} else {
LOG_E(NGAP, "Ngap task not created\n");
LOG_I(NGAP, "Ngap task not created\n");
}
if(!emulate_rf) {
if (itti_create_task (TASK_UDP, udp_eNB_task, NULL) < 0) {
LOG_E(UDP_, "Create task for UDP failed\n");
return -1;
}
}
/*if (itti_create_task (TASK_GTPV1_U, &nr_gtpv1u_gNB_task, NULL) < 0) {
LOG_E(GTPU, "Create task for GTPV1U failed\n");
return -1;
}*/
}
}
......@@ -710,7 +694,8 @@ int main( int argc, char **argv ) {
RCconfig_NR_L1();
// don't create if node doesn't connect to RRC/S1/GTP
AssertFatal(create_gNB_tasks(1) == 0,"cannot create ITTI tasks\n");
int ret=create_gNB_tasks(1);
AssertFatal(ret==0,"cannot create ITTI tasks\n");
/* Start the agent. If it is turned off in the configuration, it won't start */
/*
RCconfig_nr_flexran();
......
......@@ -185,10 +185,12 @@ void signal_handler(int sig) {
if (sig==SIGSEGV) {
// get void*'s for all entries on the stack
/*
size = backtrace(array, 10);
// print out all the frames to stderr
fprintf(stderr, "Error: signal %d:\n", sig);
backtrace_symbols_fd(array, size, 2);
*/
exit(-1);
} else {
if(sig==SIGINT ||sig==SOFTMODEM_RTSIGNAL)
......
......@@ -56,7 +56,7 @@ inline void ASN_DEBUG(const char *fmt, ...) {
}
#endif
uint8_t F1AP_get_next_transaction_identifier(module_id_t enb_mod_idP, module_id_t cu_mod_idP) {
uint8_t F1AP_get_next_transaction_identifier(instance_t enb_mod_idP, instance_t cu_mod_idP) {
static uint8_t transaction_identifier[NUMBER_OF_eNB_MAX];
transaction_identifier[enb_mod_idP+cu_mod_idP] =
(transaction_identifier[enb_mod_idP+cu_mod_idP] + 1) % F1AP_TRANSACTION_IDENTIFIER_NUMBER;
......@@ -64,36 +64,36 @@ uint8_t F1AP_get_next_transaction_identifier(module_id_t enb_mod_idP, module_id_
return transaction_identifier[enb_mod_idP+cu_mod_idP];
}
f1ap_cudu_inst_t *getCxt(bool isCU, module_id_t module_idP) {
f1ap_cudu_inst_t *getCxt(bool isCU, instance_t instanceP) {
static pid_t t=-1;
pid_t tNew=gettid();
AssertFatal ( t==-1 || t==tNew, "This is not thread safe\n");
t=tNew;
AssertFatal( module_idP < sizeofArray(f1_cu_inst), "");
return isCU? f1_cu_inst[ module_idP]: f1_du_inst[ module_idP];
AssertFatal( instanceP < sizeofArray(f1_cu_inst), "");
return isCU? f1_cu_inst[ instanceP]: f1_du_inst[ instanceP];
}
void createF1inst(bool isCU, module_id_t module_idP, f1ap_setup_req_t *req) {
void createF1inst(bool isCU, instance_t instanceP, f1ap_setup_req_t *req) {
if (isCU) {
AssertFatal(f1_cu_inst[module_idP] == NULL, "Double call to F1 CU init\n");
f1_cu_inst[module_idP]=( f1ap_cudu_inst_t *) calloc(1, sizeof( f1ap_cudu_inst_t));
//memcpy(f1_cu_inst[module_idP]->setupReq, req, sizeof(f1ap_setup_req_t) );
AssertFatal(f1_cu_inst[instanceP] == NULL, "Double call to F1 CU init\n");
f1_cu_inst[instanceP]=( f1ap_cudu_inst_t *) calloc(1, sizeof( f1ap_cudu_inst_t));
//memcpy(f1_cu_inst[instanceP]->setupReq, req, sizeof(f1ap_setup_req_t) );
} else {
AssertFatal(f1_du_inst[module_idP] == NULL, "Double call to F1 DU init\n");
f1_du_inst[module_idP]=( f1ap_cudu_inst_t *) calloc(1, sizeof(f1ap_cudu_inst_t));
memcpy(&f1_du_inst[module_idP]->setupReq, req, sizeof(f1ap_setup_req_t) );
AssertFatal(f1_du_inst[instanceP] == NULL, "Double call to F1 DU init\n");
f1_du_inst[instanceP]=( f1ap_cudu_inst_t *) calloc(1, sizeof(f1ap_cudu_inst_t));
memcpy(&f1_du_inst[instanceP]->setupReq, req, sizeof(f1ap_setup_req_t) );
}
}
int f1ap_add_ue(bool isCu,
module_id_t module_idP,
instance_t instanceP,
rnti_t rntiP) {
f1ap_cudu_inst_t *f1_inst=getCxt(isCu, module_idP);
f1ap_cudu_inst_t *f1_inst=getCxt(isCu, instanceP);
for (int i = 0; i < MAX_MOBILES_PER_ENB; i++) {
if (f1_inst->f1ap_ue[i].rnti == rntiP) {
f1_inst->f1ap_ue[i].f1ap_uid = i;
LOG_I(F1AP, "Updating the index of UE with RNTI %x and du_ue_f1ap_id %d\n", f1_inst->f1ap_ue[i].rnti, f1_inst->f1ap_ue[i].du_ue_f1ap_id);
LOG_I(F1AP, "Updating the index of UE with RNTI %x and du_ue_f1ap_id %ld\n", f1_inst->f1ap_ue[i].rnti, f1_inst->f1ap_ue[i].du_ue_f1ap_id);
return i;
}
}
......@@ -105,7 +105,7 @@ int f1ap_add_ue(bool isCu,
f1_inst->f1ap_ue[i].du_ue_f1ap_id = rntiP;
f1_inst->f1ap_ue[i].cu_ue_f1ap_id = rntiP;
f1_inst->num_ues++;
LOG_I(F1AP, "Adding a new UE with RNTI %x and cu/du ue_f1ap_id %d\n", f1_inst->f1ap_ue[i].rnti, f1_inst->f1ap_ue[i].du_ue_f1ap_id);
LOG_I(F1AP, "Adding a new UE with RNTI %x and cu/du ue_f1ap_id %ld\n", f1_inst->f1ap_ue[i].rnti, f1_inst->f1ap_ue[i].du_ue_f1ap_id);
return i;
}
}
......@@ -114,9 +114,9 @@ int f1ap_add_ue(bool isCu,
}
int f1ap_remove_ue(bool isCu, module_id_t module_idP,
int f1ap_remove_ue(bool isCu, instance_t instanceP,
rnti_t rntiP) {
f1ap_cudu_inst_t *f1_inst=getCxt(isCu, module_idP);
f1ap_cudu_inst_t *f1_inst=getCxt(isCu, instanceP);
for (int i = 0; i < MAX_MOBILES_PER_ENB; i++) {
if (f1_inst->f1ap_ue[i].rnti == rntiP) {
......@@ -129,9 +129,9 @@ int f1ap_remove_ue(bool isCu, module_id_t module_idP,
return 0;
}
int f1ap_get_du_ue_f1ap_id(bool isCu, module_id_t module_idP,
int f1ap_get_du_ue_f1ap_id(bool isCu, instance_t instanceP,
rnti_t rntiP) {
f1ap_cudu_inst_t *f1_inst=getCxt(isCu, module_idP);
f1ap_cudu_inst_t *f1_inst=getCxt(isCu, instanceP);
for (int i = 0; i < MAX_MOBILES_PER_ENB; i++) {
if (f1_inst->f1ap_ue[i].rnti == rntiP) {
......@@ -142,9 +142,9 @@ int f1ap_get_du_ue_f1ap_id(bool isCu, module_id_t module_idP,
return -1;
}
int f1ap_get_cu_ue_f1ap_id(bool isCu, module_id_t module_idP,
int f1ap_get_cu_ue_f1ap_id(bool isCu, instance_t instanceP,
rnti_t rntiP) {
f1ap_cudu_inst_t *f1_inst=getCxt(isCu, module_idP);
f1ap_cudu_inst_t *f1_inst=getCxt(isCu, instanceP);
for (int i = 0; i < MAX_MOBILES_PER_ENB; i++) {
if (f1_inst->f1ap_ue[i].rnti == rntiP) {
......@@ -155,9 +155,9 @@ int f1ap_get_cu_ue_f1ap_id(bool isCu, module_id_t module_idP,
return -1;
}
int f1ap_get_rnti_by_du_id(bool isCu, module_id_t module_idP,
module_id_t du_ue_f1ap_id ) {
f1ap_cudu_inst_t *f1_inst=getCxt(isCu, module_idP);
int f1ap_get_rnti_by_du_id(bool isCu, instance_t instanceP,
instance_t du_ue_f1ap_id ) {
f1ap_cudu_inst_t *f1_inst=getCxt(isCu, instanceP);
for (int i = 0; i < MAX_MOBILES_PER_ENB; i++) {
if (f1_inst->f1ap_ue[i].du_ue_f1ap_id == du_ue_f1ap_id) {
......@@ -168,9 +168,9 @@ int f1ap_get_rnti_by_du_id(bool isCu, module_id_t module_idP,
return -1;
}
int f1ap_get_rnti_by_cu_id(bool isCu, module_id_t module_idP,
module_id_t cu_ue_f1ap_id ) {
f1ap_cudu_inst_t *f1_inst=getCxt(isCu, module_idP);
int f1ap_get_rnti_by_cu_id(bool isCu, instance_t instanceP,
instance_t cu_ue_f1ap_id ) {
f1ap_cudu_inst_t *f1_inst=getCxt(isCu, instanceP);
for (int i = 0; i < MAX_MOBILES_PER_ENB; i++) {
if (f1_inst->f1ap_ue[i].cu_ue_f1ap_id == cu_ue_f1ap_id) {
......@@ -181,9 +181,9 @@ int f1ap_get_rnti_by_cu_id(bool isCu, module_id_t module_idP,
return -1;
}
int f1ap_get_du_uid(bool isCu, module_id_t module_idP,
module_id_t du_ue_f1ap_id ) {
f1ap_cudu_inst_t *f1_inst=getCxt(isCu, module_idP);
int f1ap_get_du_uid(bool isCu, instance_t instanceP,
instance_t du_ue_f1ap_id ) {
f1ap_cudu_inst_t *f1_inst=getCxt(isCu, instanceP);
for (int i = 0; i < MAX_MOBILES_PER_ENB; i++) {
if (f1_inst->f1ap_ue[i].du_ue_f1ap_id == du_ue_f1ap_id) {
......@@ -194,9 +194,9 @@ int f1ap_get_du_uid(bool isCu, module_id_t module_idP,
return -1;
}
int f1ap_get_cu_uid(bool isCu, module_id_t module_idP,
module_id_t cu_ue_f1ap_id ) {
f1ap_cudu_inst_t *f1_inst=getCxt(isCu, module_idP);
int f1ap_get_cu_uid(bool isCu, instance_t instanceP,
instance_t cu_ue_f1ap_id ) {
f1ap_cudu_inst_t *f1_inst=getCxt(isCu, instanceP);
for (int i = 0; i < MAX_MOBILES_PER_ENB; i++) {
if (f1_inst->f1ap_ue[i].cu_ue_f1ap_id == cu_ue_f1ap_id) {
......@@ -207,9 +207,9 @@ int f1ap_get_cu_uid(bool isCu, module_id_t module_idP,
return -1;
}
int f1ap_get_uid_by_rnti(bool isCu, module_id_t module_idP,
int f1ap_get_uid_by_rnti(bool isCu, instance_t instanceP,
rnti_t rntiP ) {
f1ap_cudu_inst_t *f1_inst=getCxt(isCu, module_idP);
f1ap_cudu_inst_t *f1_inst=getCxt(isCu, instanceP);
for (int i = 0; i < MAX_MOBILES_PER_ENB; i++) {
if (f1_inst->f1ap_ue[i].rnti == rntiP) {
......@@ -220,35 +220,35 @@ int f1ap_get_uid_by_rnti(bool isCu, module_id_t module_idP,
return -1;
}
int f1ap_du_add_cu_ue_id(bool isCu, module_id_t module_idP,
module_id_t du_ue_f1ap_id,
module_id_t cu_ue_f1ap_id) {
f1ap_cudu_inst_t *f1_inst=getCxt(isCu, module_idP);
module_id_t f1ap_uid = f1ap_get_du_uid(isCu, module_idP,du_ue_f1ap_id);
int f1ap_du_add_cu_ue_id(bool isCu, instance_t instanceP,
instance_t du_ue_f1ap_id,
instance_t cu_ue_f1ap_id) {
f1ap_cudu_inst_t *f1_inst=getCxt(isCu, instanceP);
instance_t f1ap_uid = f1ap_get_du_uid(isCu, instanceP,du_ue_f1ap_id);
if (f1ap_uid < 0 || f1ap_uid >= MAX_MOBILES_PER_ENB)
return -1;
f1_inst->f1ap_ue[f1ap_uid].cu_ue_f1ap_id = cu_ue_f1ap_id;
LOG_I(F1AP, "Adding cu_ue_f1ap_id %d for UE with RNTI %x\n", cu_ue_f1ap_id, f1_inst->f1ap_ue[f1ap_uid].rnti);
LOG_I(F1AP, "Adding cu_ue_f1ap_id %ld for UE with RNTI %x\n", cu_ue_f1ap_id, f1_inst->f1ap_ue[f1ap_uid].rnti);
return 0;
}
int f1ap_cu_add_du_ue_id(bool isCu, module_id_t module_idP,
module_id_t cu_ue_f1ap_id,
module_id_t du_ue_f1ap_id) {
f1ap_cudu_inst_t *f1_inst=getCxt(isCu, module_idP);
module_id_t f1ap_uid = f1ap_get_cu_uid(isCu,module_idP,cu_ue_f1ap_id);
int f1ap_cu_add_du_ue_id(bool isCu, instance_t instanceP,
instance_t cu_ue_f1ap_id,
instance_t du_ue_f1ap_id) {
f1ap_cudu_inst_t *f1_inst=getCxt(isCu, instanceP);
instance_t f1ap_uid = f1ap_get_cu_uid(isCu,instanceP,cu_ue_f1ap_id);
if (f1ap_uid < 0 || f1ap_uid >= MAX_MOBILES_PER_ENB)
return -1;
f1_inst->f1ap_ue[f1ap_uid].du_ue_f1ap_id = du_ue_f1ap_id;
LOG_I(F1AP, "Adding du_ue_f1ap_id %d for UE with RNTI %x\n", du_ue_f1ap_id, f1_inst->f1ap_ue[f1ap_uid].rnti);
LOG_I(F1AP, "Adding du_ue_f1ap_id %ld for UE with RNTI %x\n", du_ue_f1ap_id, f1_inst->f1ap_ue[f1ap_uid].rnti);
return 0;
}
int f1ap_assoc_id(bool isCu, module_id_t module_idP) {
f1ap_setup_req_t *f1_inst=f1ap_req(isCu, module_idP);
int f1ap_assoc_id(bool isCu, instance_t instanceP) {
f1ap_setup_req_t *f1_inst=f1ap_req(isCu, instanceP);
return f1_inst->assoc_id;
}
......@@ -421,9 +421,9 @@ int f1ap_handle_message(instance_t instance, uint32_t assoc_id, int32_t stream,
typedef struct f1ap_cudu_ue_inst_s {
// used for eNB stats generation
rnti_t rnti;
module_id_t f1ap_uid;
module_id_t du_ue_f1ap_id;
module_id_t cu_ue_f1ap_id;
instance_t f1ap_uid;
instance_t du_ue_f1ap_id;
instance_t cu_ue_f1ap_id;
} f1ap_cudu_ue_t;
typedef struct f1ap_cudu_inst_s {
......@@ -438,54 +438,54 @@ typedef struct f1ap_cudu_inst_s {
uint8_t F1AP_get_next_transaction_identifier(module_id_t enb_mod_idP, module_id_t cu_mod_idP);
uint8_t F1AP_get_next_transaction_identifier(instance_t enb_mod_idP, instance_t cu_mod_idP);
f1ap_cudu_inst_t *getCxt(bool isCU, module_id_t module_idP);
f1ap_cudu_inst_t *getCxt(bool isCU, instance_t instanceP);
void createF1inst(bool isCU, module_id_t module_idP, f1ap_setup_req_t *req);
void createF1inst(bool isCU, instance_t instanceP, f1ap_setup_req_t *req);
int f1ap_add_ue(bool isCu,
module_id_t module_idP,
instance_t instanceP,
rnti_t rntiP);
int f1ap_remove_ue(bool isCu, module_id_t module_idP,
int f1ap_remove_ue(bool isCu, instance_t instanceP,
rnti_t rntiP);
int f1ap_get_du_ue_f1ap_id (bool isCu, module_id_t module_idP,
int f1ap_get_du_ue_f1ap_id (bool isCu, instance_t instanceP,
rnti_t rntiP);
int f1ap_get_cu_ue_f1ap_id (bool isCu, module_id_t module_idP,
int f1ap_get_cu_ue_f1ap_id (bool isCu, instance_t instanceP,
rnti_t rntiP);
int f1ap_get_rnti_by_du_id(bool isCu, module_id_t module_idP,
module_id_t du_ue_f1ap_id );
int f1ap_get_rnti_by_du_id(bool isCu, instance_t instanceP,
instance_t du_ue_f1ap_id );
int f1ap_get_rnti_by_cu_id(bool isCu, module_id_t module_idP,
module_id_t cu_ue_f1ap_id );
int f1ap_get_rnti_by_cu_id(bool isCu, instance_t instanceP,
instance_t cu_ue_f1ap_id );
int f1ap_get_du_uid(bool isCu, module_id_t module_idP,
module_id_t du_ue_f1ap_id );
int f1ap_get_du_uid(bool isCu, instance_t instanceP,
instance_t du_ue_f1ap_id );
int f1ap_get_cu_uid(bool isCu, module_id_t module_idP,
module_id_t cu_ue_f1ap_id );
int f1ap_get_cu_uid(bool isCu, instance_t instanceP,
instance_t cu_ue_f1ap_id );
int f1ap_get_uid_by_rnti(bool isCu, module_id_t module_idP,
int f1ap_get_uid_by_rnti(bool isCu, instance_t instanceP,
rnti_t rntiP );
int f1ap_du_add_cu_ue_id(bool isCu, module_id_t module_idP,
module_id_t du_ue_f1ap_id,
module_id_t cu_ue_f1ap_id);
int f1ap_du_add_cu_ue_id(bool isCu, instance_t instanceP,
instance_t du_ue_f1ap_id,
instance_t cu_ue_f1ap_id);
int f1ap_cu_add_du_ue_id(bool isCu, module_id_t module_idP,
module_id_t cu_ue_f1ap_id,
module_id_t du_ue_f1ap_id);
int f1ap_cu_add_du_ue_id(bool isCu, instance_t instanceP,
instance_t cu_ue_f1ap_id,
instance_t du_ue_f1ap_id);
int f1ap_assoc_id(bool isCu, module_id_t module_idP);
int f1ap_assoc_id(bool isCu, instance_t instanceP);
static inline f1ap_setup_req_t *f1ap_req(bool isCu, module_id_t module_idP) {
return &getCxt(isCu, module_idP)->setupReq;
static inline f1ap_setup_req_t *f1ap_req(bool isCu, instance_t instanceP) {
return &getCxt(isCu, instanceP)->setupReq;
}
#define asn1cCalloc(VaR, TyPe, lOcPtr) TyPe *lOcPtr=VaR=(TyPe*) calloc(1,sizeof(TyPe));
......
......@@ -228,11 +228,11 @@ int CU_handle_F1_SETUP_REQUEST(instance_t instance,
int CU_send_F1_SETUP_RESPONSE(instance_t instance,
f1ap_setup_resp_t *f1ap_setup_resp) {
module_id_t enb_mod_idP;
module_id_t cu_mod_idP;
instance_t enb_mod_idP;
instance_t cu_mod_idP;
// This should be fixed
enb_mod_idP = (module_id_t)0;
cu_mod_idP = (module_id_t)0;
enb_mod_idP = (instance_t)0;
cu_mod_idP = (instance_t)0;
F1AP_F1AP_PDU_t pdu= {0};
uint8_t *buffer=NULL;
uint32_t len=0;
......@@ -335,8 +335,8 @@ int CU_send_F1_SETUP_RESPONSE(instance_t instance,
int CU_send_F1_SETUP_FAILURE(instance_t instance) {
LOG_D(F1AP, "CU_send_F1_SETUP_FAILURE\n");
module_id_t enb_mod_idP=0;
module_id_t cu_mod_idP=0;
instance_t enb_mod_idP=0;
instance_t cu_mod_idP=0;
// This should be fixed
F1AP_F1AP_PDU_t pdu= {0};
uint8_t *buffer=NULL;
......
......@@ -68,7 +68,7 @@ int CU_handle_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instance,
/* GNB_DU_UE_F1AP_ID */
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_InitialULRRCMessageTransferIEs_t, ie, container,
F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID, true);
module_id_t du_ue_f1ap_id = ie->value.choice.GNB_DU_UE_F1AP_ID;
instance_t du_ue_f1ap_id = ie->value.choice.GNB_DU_UE_F1AP_ID;
/* NRCGI
* Fixme: process NRCGI
*/
......@@ -308,13 +308,13 @@ int CU_handle_UL_RRC_MESSAGE_TRANSFER(instance_t instance,
RRC_DCCH_DATA_IND (message_p).dcch_index = srb_id;
RRC_DCCH_DATA_IND (message_p).rnti = f1ap_get_rnti_by_cu_id(true, instance, cu_ue_f1ap_id);
RRC_DCCH_DATA_IND (message_p).module_id = instance;
RRC_DCCH_DATA_IND (message_p).instance = instance;
RRC_DCCH_DATA_IND (message_p).eNB_index = instance; // not needed for CU
itti_send_msg_to_task(TASK_RRC_ENB, instance, message_p);
*/
protocol_ctxt_t ctxt;
ctxt.module_id = instance;
ctxt.instance = instance;
ctxt.instance = instance;
ctxt.rnti = f1ap_get_rnti_by_cu_id(true, instance, cu_ue_f1ap_id);
ctxt.enb_flag = 1;
......
......@@ -36,8 +36,9 @@
#include "f1ap_cu_ue_context_management.h"
#include "f1ap_cu_task.h"
#include "proto_agent.h"
#include <openair3/ocp-gtpu/gtp_itf.h>
void cu_task_handle_sctp_association_ind(instance_t instance, sctp_new_association_ind_t *sctp_new_association_ind) {
static void cu_task_handle_sctp_association_ind(instance_t instance,instance_t gtpuInstance, sctp_new_association_ind_t *sctp_new_association_ind) {
createF1inst(true, instance, NULL);
// save the assoc id
f1ap_setup_req_t *f1ap_cu_data=f1ap_req(true, instance);
......@@ -48,7 +49,7 @@ void cu_task_handle_sctp_association_ind(instance_t instance, sctp_new_associati
// Nothing
}
void cu_task_handle_sctp_association_resp(instance_t instance, sctp_new_association_resp_t *sctp_new_association_resp) {
static void cu_task_handle_sctp_association_resp(instance_t instance, sctp_new_association_resp_t *sctp_new_association_resp) {
DevAssert(sctp_new_association_resp != NULL);
if (sctp_new_association_resp->sctp_state != SCTP_STATE_ESTABLISHED) {
......@@ -63,7 +64,7 @@ void cu_task_handle_sctp_association_resp(instance_t instance, sctp_new_associat
}
}
void cu_task_handle_sctp_data_ind(instance_t instance, sctp_data_ind_t *sctp_data_ind) {
static void cu_task_handle_sctp_data_ind(instance_t instance, sctp_data_ind_t *sctp_data_ind) {
int result;
DevAssert(sctp_data_ind != NULL);
f1ap_handle_message(instance, sctp_data_ind->assoc_id, sctp_data_ind->stream,
......@@ -72,7 +73,7 @@ void cu_task_handle_sctp_data_ind(instance_t instance, sctp_data_ind_t *sctp_dat
AssertFatal (result == EXIT_SUCCESS, "Failed to free memory (%d)!\n", result);
}
void cu_task_send_sctp_init_req(instance_t enb_id) {
static void cu_task_send_sctp_init_req(instance_t instance, char * my_addr) {
// 1. get the itti msg, and retrive the enb_id from the message
// 2. use RC.rrc[enb_id] to fill the sctp_init_t with the ip, port
// 3. creat an itti message to init
......@@ -84,12 +85,7 @@ void cu_task_send_sctp_init_req(instance_t enb_id) {
message_p->ittiMsg.sctp_init.ipv4 = 1;
message_p->ittiMsg.sctp_init.ipv6 = 0;
message_p->ittiMsg.sctp_init.nb_ipv4_addr = 1;
if (RC.nrrrc[0]->node_type == ngran_gNB_CU) {
message_p->ittiMsg.sctp_init.ipv4_address[0] = inet_addr(RC.nrrrc[enb_id]->eth_params_s.my_addr);
} else {
message_p->ittiMsg.sctp_init.ipv4_address[0] = inet_addr(RC.rrc[enb_id]->eth_params_s.my_addr);
}
message_p->ittiMsg.sctp_init.ipv4_address[0] = inet_addr(my_addr);
/*
* SR WARNING: ipv6 multi-homing fails sometimes for localhost.
......@@ -97,19 +93,35 @@ void cu_task_send_sctp_init_req(instance_t enb_id) {
*/
message_p->ittiMsg.sctp_init.nb_ipv6_addr = 0;
message_p->ittiMsg.sctp_init.ipv6_address[0] = "0:0:0:0:0:0:0:1";
itti_send_msg_to_task(TASK_SCTP, enb_id, message_p);
itti_send_msg_to_task(TASK_SCTP, instance, message_p);
}
void *
F1AP_CU_task(void *arg) {
instance_t cu_task_create_gtpu_instance_to_du(eth_params_t *IPaddrs) {
openAddr_t tmp={0};
strncpy(tmp.originHost, IPaddrs->my_addr, sizeof(tmp.originHost)-1);
strncpy(tmp.destinationHost, IPaddrs->remote_addr, sizeof(tmp.destinationHost)-1);
sprintf(tmp.originService, "%d", GTPV1U_UDP_PORT);
sprintf(tmp.destinationService, "%d", GTPV1U_UDP_PORT);
return ocp_gtpv1Init(tmp);
}
void * F1AP_CU_task(void *arg) {
MessageDef *received_msg = NULL;
int result;
LOG_I(F1AP, "Starting F1AP at CU\n");
// no RLC in CU, initialize mem pool for PDCP
pool_buffer_init();
itti_mark_task_ready(TASK_CU_F1);
cu_task_send_sctp_init_req(0);
eth_params_t *IPaddrs;
// Hardcoded instance id!
if (RC.nrrrc[0]->node_type == ngran_gNB_CU)
IPaddrs=&RC.nrrrc[0]->eth_params_s;
else
IPaddrs=&RC.rrc[0]->eth_params_s;
cu_task_send_sctp_init_req(0, IPaddrs->my_addr);
instance_t gtpInstance=cu_task_create_gtpu_instance_to_du(IPaddrs);
AssertFatal(gtpInstance>0,"Failed to create CU F1-U UDP listener");
while (1) {
itti_receive_msg(TASK_CU_F1, &received_msg);
......@@ -118,6 +130,7 @@ F1AP_CU_task(void *arg) {
LOG_I(F1AP, "CU Task Received SCTP_NEW_ASSOCIATION_IND for instance %ld\n",
ITTI_MSG_DESTINATION_INSTANCE(received_msg));
cu_task_handle_sctp_association_ind(ITTI_MSG_ORIGIN_INSTANCE(received_msg),
gtpInstance,
&received_msg->ittiMsg.sctp_new_association_ind);
break;
......
......@@ -22,11 +22,6 @@
#ifndef F1AP_CU_TASK_H_
#define F1AP_CU_TASK_H_
void cu_task_handle_sctp_association_ind(instance_t instance, sctp_new_association_ind_t *sctp_new_association_ind);
void cu_task_handle_sctp_association_resp(instance_t instance, sctp_new_association_resp_t *sctp_new_association_resp);
void cu_task_handle_sctp_data_ind(instance_t instance, sctp_data_ind_t *sctp_data_ind);
void cu_task_send_sctp_init_req(instance_t enb_id);
void *F1AP_CU_task(void *arg);
#endif /* F1AP_CU_TASK_H_ */
......@@ -631,7 +631,7 @@ int CU_handle_UE_CONTEXT_SETUP_RESPONSE(instance_t instance,
F1AP_UEContextSetupResponseIEs_t *ie;
DevAssert(pdu);
msg_p = itti_alloc_new_message(TASK_DU_F1, 0, F1AP_UE_CONTEXT_SETUP_RESP);
f1ap_ue_context_setup_resp_t *f1ap_ue_context_setup_resp = &F1AP_UE_CONTEXT_SETUP_RESP(msg_p);
f1ap_ue_context_setup_req_t *f1ap_ue_context_setup_resp = &F1AP_UE_CONTEXT_SETUP_RESP(msg_p);
container = &pdu->choice.successfulOutcome->value.choice.UEContextSetupResponse;
int i;
......
......@@ -93,8 +93,8 @@ int DU_handle_ERROR_INDICATION(instance_t instance,
// SETUP REQUEST
int DU_send_F1_SETUP_REQUEST(instance_t instance) {
module_id_t enb_mod_idP=0;
module_id_t du_mod_idP=0;
instance_t enb_mod_idP=0;
instance_t du_mod_idP=0;
F1AP_F1AP_PDU_t pdu= {0};
uint8_t *buffer;
uint32_t len;
......
......@@ -165,11 +165,11 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance,
AssertFatal(srb_id<3,"illegal srb_id\n");
protocol_ctxt_t ctxt;
ctxt.rnti = f1ap_get_rnti_by_du_id(false, instance, du_ue_f1ap_id);
ctxt.module_id = instance;
ctxt.instance = instance;
ctxt.instance = instance;
ctxt.enb_flag = 1;
struct rrc_eNB_ue_context_s *ue_context_p = rrc_eNB_get_ue_context(
RC.rrc[ctxt.module_id],
RC.rrc[ctxt.instance],
ctxt.rnti);
if (srb_id == 0) {
......@@ -260,7 +260,7 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance,
mac_MainConfig = &radioResourceConfigDedicated->mac_MainConfig->choice.explicitValue;
rrc_mac_config_req_eNB(
ctxt.module_id,
ctxt.instance,
0, //primaryCC_id,
0,0,0,0,0,0,
ctxt.rnti,
......@@ -387,7 +387,7 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance,
message_p = itti_alloc_new_message(TASK_DU_F1, 0, RRC_MAC_DRX_CONFIG_REQ);
RRC_MAC_DRX_CONFIG_REQ(message_p).rnti = ctxt.rnti;
RRC_MAC_DRX_CONFIG_REQ(message_p).drx_Configuration = mac_MainConfig->drx_Config;
itti_send_msg_to_task(TASK_MAC_ENB, ctxt.module_id, message_p);
itti_send_msg_to_task(TASK_MAC_ENB, ctxt.instance, message_p);
LOG_D(F1AP, "DRX configured in MAC Main Configuration for RRC Connection Reconfiguration\n");
}
......@@ -410,9 +410,9 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance,
} else if (SRB_configList->list.array[i]->srb_Identity == 2 ) {
ue_context_p->ue_context.Srb2.Active=1;
ue_context_p->ue_context.Srb2.Srb_info.Srb_id=2;
LOG_I(F1AP, "[DU %d] SRB2 is now active\n",ctxt.module_id);
LOG_I(F1AP, "[DU %ld] SRB2 is now active\n",ctxt.instance);
} else {
LOG_W(F1AP, "[DU %d] invalide SRB identity %ld\n",ctxt.module_id,
LOG_W(F1AP, "[DU %ld] invalide SRB identity %ld\n",ctxt.instance,
SRB_configList->list.array[i]->srb_Identity);
}
}
......@@ -423,8 +423,8 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance,
if (DRB_configList->list.array[i]) {
drb_id = (int)DRB_configList->list.array[i]->drb_Identity;
LOG_I(F1AP,
"[DU %d] Logical Channel UL-DCCH, Received RRCConnectionReconfiguration for UE rnti %x, reconfiguring DRB %d/LCID %d\n",
ctxt.module_id,
"[DU %ld] Logical Channel UL-DCCH, Received RRCConnectionReconfiguration for UE rnti %x, reconfiguring DRB %d/LCID %d\n",
ctxt.instance,
ctxt.rnti,
(int)DRB_configList->list.array[i]->drb_Identity,
(int)*DRB_configList->list.array[i]->logicalChannelIdentity);
......@@ -437,7 +437,7 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance,
}
rrc_mac_config_req_eNB(
ctxt.module_id,
ctxt.instance,
0,0,0,0,0,0,
0,
ue_context_p->ue_context.rnti,
......@@ -746,7 +746,7 @@ int DU_send_UL_RRC_MESSAGE_TRANSFER(instance_t instance,
/* UL RRC Message Transfer */
int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP,
int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instanceP,
int CC_idP,
int UE_id,
rnti_t rntiP,
......@@ -758,7 +758,7 @@ int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP,
F1AP_InitialULRRCMessageTransfer_t *out;
uint8_t *buffer=NULL;
uint32_t len=0;
int f1ap_uid = f1ap_add_ue (false, module_idP, rntiP);
int f1ap_uid = f1ap_add_ue (false, instanceP, rntiP);
if (f1ap_uid < 0 ) {
LOG_E(F1AP, "Failed to add UE \n");
......@@ -779,7 +779,7 @@ int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP,
ie1->id = F1AP_ProtocolIE_ID_id_gNB_DU_UE_F1AP_ID;
ie1->criticality = F1AP_Criticality_reject;
ie1->value.present = F1AP_InitialULRRCMessageTransferIEs__value_PR_GNB_DU_UE_F1AP_ID;
ie1->value.choice.GNB_DU_UE_F1AP_ID = getCxt(false, module_idP)->f1ap_ue[f1ap_uid].du_ue_f1ap_id;
ie1->value.choice.GNB_DU_UE_F1AP_ID = getCxt(false, instanceP)->f1ap_ue[f1ap_uid].du_ue_f1ap_id;
/* mandatory */
/* c2. NRCGI */
asn1cSequenceAdd(out->protocolIEs.list, F1AP_InitialULRRCMessageTransferIEs_t, ie2);
......@@ -787,7 +787,7 @@ int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP,
ie2->criticality = F1AP_Criticality_reject;
ie2->value.present = F1AP_InitialULRRCMessageTransferIEs__value_PR_NRCGI;
//Fixme: takes always the first cell
addnRCGI(ie2->value.choice.NRCGI, getCxt(false, module_idP)->setupReq.cell);
addnRCGI(ie2->value.choice.NRCGI, getCxt(false, instanceP)->setupReq.cell);
/* mandatory */
/* c3. C_RNTI */ // 16
asn1cSequenceAdd(out->protocolIEs.list, F1AP_InitialULRRCMessageTransferIEs_t, ie3);
......@@ -821,7 +821,7 @@ int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP,
return -1;
}
f1ap_itti_send_sctp_data_req(false, module_idP, buffer, len, getCxt(false, module_idP)->default_sctp_stream_id);
f1ap_itti_send_sctp_data_req(false, instanceP, buffer, len, getCxt(false, instanceP)->default_sctp_stream_id);
return 0;
}
......
......@@ -44,7 +44,7 @@ int DU_handle_DL_RRC_MESSAGE_TRANSFER(instance_t instance,
int DU_send_UL_RRC_MESSAGE_TRANSFER(instance_t instance, const f1ap_ul_rrc_message_t *msg);
int DU_send_UL_NR_RRC_MESSAGE_TRANSFER(instance_t instance, const f1ap_ul_rrc_message_t *msg);
int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(module_id_t module_idP,
int DU_send_INITIAL_UL_RRC_MESSAGE_TRANSFER(instance_t instanceP,
int CC_idP,
int UE_id,
rnti_t rntiP,
......
......@@ -43,7 +43,6 @@
#include <openair3/ocp-gtpu/gtp_itf.h>
int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, f1ap_ue_context_setup_req_t *req);
int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance,
uint32_t assoc_id,
uint32_t stream,
......@@ -200,7 +199,7 @@ int DU_handle_UE_CONTEXT_SETUP_REQUEST(instance_t instance,
// decode RRC Container and act on the message type
//FIXME
//rnti_t rnti = f1ap_get_rnti_by_du_id(false, instance, du_ue_f1ap_id);
ctxt.module_id = instance;
ctxt.instance = instance;
ctxt.instance = instance;
ctxt.enb_flag = 1;
mem_block_t *pdcp_pdu_p = get_free_mem_block(ieRRC->value.choice.RRCContainer.size, __func__);
......@@ -648,7 +647,7 @@ int DU_handle_UE_CONTEXT_RELEASE_COMMAND(instance_t instance,
F1AP_FIND_PROTOCOLIE_BY_ID(F1AP_UEContextReleaseCommandIEs_t, ie, container,
F1AP_ProtocolIE_ID_id_gNB_CU_UE_F1AP_ID, true);
ctxt.rnti = f1ap_get_rnti_by_cu_id(false, instance, ie->value.choice.GNB_CU_UE_F1AP_ID);
ctxt.module_id = instance;
ctxt.instance = instance;
ctxt.instance = instance;
ctxt.enb_flag = 1;
/* GNB_DU_UE_F1AP_ID */
......@@ -735,7 +734,7 @@ int DU_handle_UE_CONTEXT_RELEASE_COMMAND(instance_t instance,
struct rrc_eNB_ue_context_s *ue_context_p;
ue_context_p = rrc_eNB_get_ue_context(RC.rrc[ctxt.module_id], ctxt.rnti);
ue_context_p = rrc_eNB_get_ue_context(RC.rrc[ctxt.instance], ctxt.rnti);
if (ue_context_p && !UE_out_of_sync) {
/* UE exists and is in sync so we start a timer before releasing the
......
......@@ -85,6 +85,8 @@ int DU_handle_UE_CONTEXT_MODIFICATION_CONFIRM(instance_t instance,
uint32_t stream,
F1AP_F1AP_PDU_t *pdu);
int DU_send_UE_CONTEXT_SETUP_RESPONSE(instance_t instance, f1ap_ue_context_setup_req_t *req);
/*
* UE Inactivity Notification
*/
......
......@@ -418,7 +418,7 @@ uint8_t do_SIB1_NR(rrc_gNB_carrier_data_t *carrier,
//sib1->ServCellCom->downlinkConfigCommon.frequencyInfoDL.offsetToPointA = configuration->scc->downlinkConfigCommon->frequencyInfoDL->scs_SpecificCarrierList.list.array[0]->offsetToCarrier;
ServCellCom->downlinkConfigCommon.frequencyInfoDL.offsetToPointA = 86;
int ref_scs;
int ref_scs=0;
if (configuration->scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA < 600000)
ref_scs = 0; // 15 khz
if (configuration->scc->downlinkConfigCommon->frequencyInfoDL->absoluteFrequencyPointA > 2016666)
......
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