Commit 45302792 authored by oai's avatar oai

config module fix and extensions for Nb-IoT, shared lib loader and telnet server implementation

parent 307e2f29
......@@ -1042,6 +1042,19 @@ include_directories(${NFAPI_USER_DIR})
# Layer 1
#############################
set(PHY_TURBOSRC
${OPENAIR1_DIR}/PHY/CODING/3gpplte_sse.c
${OPENAIR1_DIR}/PHY/CODING/3gpplte.c
${OPENAIR1_DIR}/PHY/CODING/3gpplte_turbo_decoder_sse_8bit.c
${OPENAIR1_DIR}/PHY/CODING/3gpplte_turbo_decoder_sse_16bit.c
${OPENAIR1_DIR}/PHY/CODING/3gpplte_turbo_decoder_avx2_16bit.c
${OPENAIR1_DIR}/PHY/CODING/3gpplte_turbo_decoder.c
)
set(PHY_TURBOIF
${OPENAIR1_DIR}/PHY/CODING/coding_load.c
)
add_library(coding MODULE ${PHY_TURBOSRC} )
set(PHY_SRC
# depend on code generation from asn1c
${RRC_FULL_DIR}/asn1_constants.h
......@@ -1109,11 +1122,8 @@ set(PHY_SRC
${OPENAIR1_DIR}/PHY/CODING/lte_segmentation.c
${OPENAIR1_DIR}/PHY/CODING/ccoding_byte.c
${OPENAIR1_DIR}/PHY/CODING/ccoding_byte_lte.c
${OPENAIR1_DIR}/PHY/CODING/3gpplte_sse.c
${OPENAIR1_DIR}/PHY/CODING/crc_byte.c
${OPENAIR1_DIR}/PHY/CODING/3gpplte_turbo_decoder_sse_8bit.c
${OPENAIR1_DIR}/PHY/CODING/3gpplte_turbo_decoder_sse_16bit.c
${OPENAIR1_DIR}/PHY/CODING/3gpplte_turbo_decoder_avx2_16bit.c
${PHY_TURBOIF}
${OPENAIR1_DIR}/PHY/CODING/lte_rate_matching.c
${OPENAIR1_DIR}/PHY/CODING/viterbi.c
${OPENAIR1_DIR}/PHY/CODING/viterbi_lte.c
......@@ -1373,6 +1383,7 @@ set (MAC_SRC_UE
set (ENB_APP_SRC
${OPENAIR2_DIR}/ENB_APP/enb_app.c
${OPENAIR2_DIR}/ENB_APP/enb_config.c
${OPENAIR2_DIR}/ENB_APP/RRC_config_tools.c
)
add_library(L2
......@@ -2398,3 +2409,8 @@ ADD_CUSTOM_TARGET(oarf
DEPENDS ${OCT_FILES}
)
include (${OPENAIR_DIR}/common/utils/telnetsrv/telnetsrv_CMakeLists.txt)
......@@ -544,6 +544,9 @@ function main() {
compilations \
$lte_build_dir $config_libconfig_shlib \
lib$config_libconfig_shlib.so $dbin/lib$config_libconfig_shlib.so
compilations \
$lte_build_dir coding \
libcoding.so $dbin/libcoding.so
if [ "$NOS1" = "1" ] ; then
compilations \
......@@ -766,17 +769,10 @@ function main() {
# Telnet server compilation
#####################
if [ "$BUILD_TELNETSRV" = "1" ] ; then
telnetsrv_build_dir=telnetsrv
mkdir -p $DIR/$telnetsrv_build_dir/build
cd $DIR/$telnetsrv_build_dir/build
echo_info "Compiling telnet server library ..."
[ "$CLEAN" = "1" ] && rm -rf $DIR/$telnetsrv_build_dir
cmake_file=$OPENAIR_DIR/common/utils/$telnetsrv_build_dir/CMakeLists.txt
cd $DIR/$telnetsrv_build_dir/build
eval "$CMAKE_CMD $OPENAIR_DIR/common/utils/$telnetsrv_build_dir/"
make
build_dir=$lte_build_dir
compilations \
$build_dir telnetsrv \
libtelnetsrv.so $dbin/libtelnetsrv.so
fi
# build RF device and transport protocol libraries
......
......@@ -197,25 +197,40 @@ int i;
return cfgptr;
}
void end_configmodule()
/* free memory allocated when reading parameters */
/* config module could be initialized again after this call */
void end_configmodule(void)
{
if (cfgptr != NULL) {
if (cfgptr->end != NULL) {
printf ("[CONFIG] calling config module end function...\n");
cfgptr->end();
}
if( cfgptr->cfgmode != NULL) free(cfgptr->cfgmode);
printf ("[CONFIG] free %u config parameter pointers\n",cfgptr->num_cfgP);
for (int i=0; i<cfgptr->num_cfgP; i++) {
if ( cfgptr->cfgP[i] != NULL) free(cfgptr->cfgP[i]);
}
printf ("[CONFIG] free %u config value pointers\n",cfgptr->numptrs);
for(int i=0; i<cfgptr->numptrs ; i++) {
if (cfgptr->ptrs[i] != NULL) {
free(cfgptr->ptrs[i]);
cfgptr->ptrs[i]=NULL;
}
cfgptr->ptrs[i]=NULL;
}
cfgptr->numptrs=0;
}
}
/* free all memory used by config module */
/* should be called only at program exit */
void free_configmodule(void)
{
if (cfgptr != NULL) {
end_configmodule();
if( cfgptr->cfgmode != NULL) free(cfgptr->cfgmode);
printf ("[CONFIG] free %u config parameter pointers\n",cfgptr->num_cfgP);
for (int i=0; i<cfgptr->num_cfgP; i++) {
if ( cfgptr->cfgP[i] != NULL) free(cfgptr->cfgP[i]);
}
free(cfgptr);
cfgptr=NULL;
......
......@@ -3,7 +3,7 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.0 (the "License"); you may not use this file
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
......@@ -40,15 +40,18 @@
#define CONFIG_MAX_OOPT_PARAMS 10 // maximum number of parameters in the -O option (-O <cfgmode>:P1:P2...
#define CONFIG_MAX_ALLOCATEDPTRS 1024 // maximum number of parameters that can be dynamicaly allocated in the config module
/* rtflags bit position definitions */
#define CONFIG_PRINTPARAMS 1 // print parameters values while processing
#define CONFIG_DEBUGPTR 2 // print memory allocation/free debug messages
#define CONFIG_DEBUGCMDLINE 4 // print command line processing messages
#define CONFIG_HELP 8 // print help message
#define CONFIG_ABORT 16 // config failed,abort execution
#define CONFIG_NOOOPT 32 // no -O option found when parsing command line
/* default values for configuration module parameters */
#define DEFAULT_CFGMODE "libconfig" // use libconfig file
#define DEFAULT_CFGFILENAME "oai.conf" // default config file
/* rtflags bit position definitions */
#define CONFIG_PRINTPARAMS 1 // print parameters values while processing
#define CONFIG_DEBUGPTR 1<<1 // print memory allocation/free debug messages
#define CONFIG_DEBUGCMDLINE 1<<2 // print command line processing messages
#define CONFIG_NOABORTONCHKF 1<<3 // disable abort execution when parameter checking function fails
#define CONFIG_HELP 1<<20 // print help message
#define CONFIG_ABORT 1<<21 // config failed,abort execution
#define CONFIG_NOOOPT 1<<22 // no -O option found when parsing command line
typedef int(*configmodule_initfunc_t)(char *cfgP[],int numP);
typedef int(*configmodule_getfunc_t)(paramdef_t *,int numparams, char *prefix);
typedef int(*configmodule_getlistfunc_t)(paramlist_def_t *, paramdef_t *,int numparams, char *prefix);
......
......@@ -3,7 +3,7 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.0 (the "License"); you may not use this file
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
......@@ -55,16 +55,61 @@
#define PARAMFLAG_PARAMSET (1 << 16) // parameter has been explicitely set in get functions
#define PARAMFLAG_PARAMSETDEF (1 << 17) // parameter has been set to default value in get functions
/* checkedparam_t is possibly used in paramdef_t for specific parameter value validation */
#define CONFIG_MAX_NUMCHECKVAL 20
typedef struct paramdef paramdef_t;
typedef union checkedparam {
struct {
int (*f1)(paramdef_t *param); /* check an integer against a list of authorized values */
int okintval[CONFIG_MAX_NUMCHECKVAL]; /* integer array, store possible values */
int num_okintval; /* number of valid values in the checkingval array */
} s1;
struct {
int (*f1a)(paramdef_t *param); /* check an integer against a list of authorized values and set param value */
/* to the corresponding item in setintval array (mainly for RRC params) */
int okintval[CONFIG_MAX_NUMCHECKVAL]; /* integer array, store possible values in config file */
int setintval[CONFIG_MAX_NUMCHECKVAL]; /* integer array, values set in the paramdef structure */
int num_okintval; /* number of valid values in the checkingval array */
} s1a;
struct {
int (*f2)(paramdef_t *param); /* check an integer against an authorized range, defined by its min and max value */
int okintrange[CONFIG_MAX_NUMCHECKVAL]; /* integer array, store min and max values */
} s2;
struct {
int (*f3)(paramdef_t *param); /* check a string against a list of authorized values */
char *okstrval[CONFIG_MAX_NUMCHECKVAL]; /* string array, store possible values */
int num_okstrval; /* number of valid values in the checkingval array */
} s3;
struct {
int (*f3a)(paramdef_t *param); /* check a string against a list of authorized values and set param value */
/* to the corresponding item in setintval array (mainly for RRC params) */
char *okstrval[CONFIG_MAX_NUMCHECKVAL]; /* string array, store possible values */
int setintval[CONFIG_MAX_NUMCHECKVAL]; /* integer array, values set in the paramdef structure */
int num_okstrval; /* number of valid values in the checkingval array */
} s3a;
struct {
int (*f4)(paramdef_t *param); /* generic check function, no arguments but the param description */
} s4;
struct {
void (*checkfunc)(void) ;
} s5;
} checkedparam_t;
/* paramdef is used to describe a parameter, array of paramdef_t strustures is used as the main parameter in */
/* config apis used to retrieve parameters values */
typedef struct paramdef
{
char optname[MAX_OPTNAME_SIZE]; /* parameter name, can be used as long command line option */
char *helpstr; /* help string */
unsigned int paramflags; /* value is a "ored" combination of above PARAMFLAG_XXXX values */
union { /* pointer to the parameter value, completed by the config module */
char optname[MAX_OPTNAME_SIZE]; /* parameter name, can be used as long command line option */
char *helpstr; /* help string */
unsigned int paramflags; /* value is a "ored" combination of above PARAMFLAG_XXXX values */
union { /* pointer to the parameter value, completed by the config module */
char **strptr;
char **strlistptr;
uint8_t *u8ptr;
char *i8ptr;
int8_t *i8ptr;
uint16_t *u16ptr;
int16_t *i16ptr;
uint32_t *uptr;
......@@ -72,18 +117,21 @@ typedef struct paramdef
uint64_t *u64ptr;
int64_t *i64ptr;
double *dblptr;
void *voidptr;
} ;
union { /* default parameter value, to be used when PARAMFLAG_MANDATORY is not specified */
char *defstrval;
char **defstrlistval;
uint32_t defuintval;
int defintval;
uint64_t defint64val;
int *defintarrayval;
double defdblval;
char *defstrval;
char **defstrlistval;
uint32_t defuintval;
int defintval;
uint64_t defint64val;
int *defintarrayval;
double defdblval;
} ;
char type; /* parameter value type, as listed below as TYPE_XXXX macro */
int numelt; /* number of elements in a list or array parameters or max size of string value */
checkedparam_t *chkPptr; /* possible pointer to the structure containing the info used to check parameter values */
int *processedvalue; /* used to store integer values computed from string original value */
} paramdef_t;
#define TYPE_INT TYPE_INT32
......
......@@ -3,7 +3,7 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.0 (the "License"); you may not use this file
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
......@@ -36,6 +36,7 @@
#include <errno.h>
#include <dlfcn.h>
#include "config_userapi.h"
extern void exit_fun(const char* s); // lte-softmodem clean exit function
configmodule_interface_t *config_get_if(void)
......@@ -59,7 +60,7 @@ char * config_check_valptr(paramdef_t *cfgoptions, char **ptr, int length)
*ptr = malloc(length);
if ( *ptr != NULL) {
memset(*ptr,0,length);
if ( (cfgoptions->paramflags & PARAMFLAG_NOFREE) != 0) {
if ( (cfgoptions->paramflags & PARAMFLAG_NOFREE) == 0) {
config_get_if()->ptrs[config_get_if()->numptrs] = *ptr;
config_get_if()->numptrs++;
}
......@@ -111,7 +112,29 @@ int tmpval=val;
break;
}
}
void config_assign_processedint(paramdef_t *cfgoption, int val) {
cfgoption->processedvalue = malloc(sizeof(int));
if ( cfgoption->processedvalue != NULL) {
*(cfgoption->processedvalue) = val;
} else {
fprintf (stderr,"[CONFIG] %s %d malloc error\n",__FILE__, __LINE__);
exit(-1);
}
}
int config_get_processedint(paramdef_t *cfgoption) {
int ret;
if ( cfgoption->processedvalue != NULL) {
ret=*(cfgoption->processedvalue);
free( cfgoption->processedvalue);
cfgoption->processedvalue=NULL;
printf_params("[CONFIG] %s: set from %s to %i\n",cfgoption->optname, *(cfgoption->strptr), ret);
} else {
fprintf (stderr,"[CONFIG] %s %d %s has no processed integer availablle\n",__FILE__, __LINE__, cfgoption->optname);
ret=0;
}
return ret;
}
void config_printhelp(paramdef_t *params,int numparams)
{
for (int i=0 ; i<numparams ; i++) {
......@@ -124,11 +147,31 @@ void config_printhelp(paramdef_t *params,int numparams)
}
}
int config_execcheck(paramdef_t *params,int numparams, char *prefix)
{
int st=0;
for (int i=0 ; i<numparams ; i++) {
if ( params[i].chkPptr == NULL) {
continue;
}
if (params[i].chkPptr->s4.f4 != NULL) {
st += params[i].chkPptr->s4.f4(&(params[i]));
}
}
if (st != 0) {
fprintf(stderr,"[CONFIG] config_execcheck: %i parameters with wrong value\n", -st);
if ( CONFIG_ISFLAGSET(CONFIG_NOABORTONCHKF) == 0) {
exit_fun("exit because configuration failed\n");
}
}
return st;
}
int config_get(paramdef_t *params,int numparams, char *prefix)
{
int ret= -1;
printf("numparams:%d prefix:%s\n", numparams, prefix);
if (CONFIG_ISFLAGSET(CONFIG_ABORT)) {
fprintf(stderr,"[CONFIG] config_get skipped, config module not properly initialized\n");
return ret;
......@@ -138,6 +181,7 @@ configmodule_interface_t *cfgif = config_get_if();
ret = config_get_if()->get(params, numparams,prefix);
if (ret >= 0) {
config_process_cmdline(params,numparams,prefix);
config_execcheck(params,numparams,prefix);
}
return ret;
}
......@@ -153,6 +197,89 @@ int config_isparamset(paramdef_t *params,int paramidx)
}
}
int config_getparamval_fromparamdefidx(paramdef_t *cfgoptions,int paramidx) {
void print_intvalueerror(paramdef_t *param, char *fname, int *okval, int numokval) {
fprintf(stderr,"[CONFIG] %s: %s: %i invalid value, authorized values:\n ",
fname,param->optname, (int)*(param->uptr));
for ( int i=0; i<numokval ; i++) {
fprintf(stderr, " %i",okval[i]);
}
fprintf(stderr, " \n");
}
int config_check_intval(paramdef_t *param)
{
if ( param == NULL ){
fprintf(stderr,"[CONFIG] config_check_intval: NULL param argument\n");
return -1;
}
for ( int i=0; i<param->chkPptr->s1.num_okintval ; i++) {
if( *(param->uptr) == param->chkPptr->s1.okintval[i] ) {
return 0;
}
}
print_intvalueerror(param,"config_check_intval", param->chkPptr->s1.okintval,param->chkPptr->s1.num_okintval);
return -1;
}
int config_check_modify_integer(paramdef_t *param)
{
for (int i=0; i < param->chkPptr->s1a.num_okintval ; i++) {
if (*(param->uptr) == param->chkPptr->s1a.okintval[i] ) {
printf_params("[CONFIG] %s: read value %i, set to %i\n",param->optname,*(param->uptr),param->chkPptr->s1a.setintval [i]);
*(param->uptr) = param->chkPptr->s1a.setintval [i];
return 0;
}
}
print_intvalueerror(param,"config_check_modify_integer", param->chkPptr->s1a.okintval,param->chkPptr->s1a.num_okintval);
return -1;
}
int config_check_intrange(paramdef_t *param)
{
if( *(param->iptr) >= param->chkPptr->s2.okintrange[0] && *(param->iptr) <= param->chkPptr->s2.okintrange[1] ) {
return 0;
}
fprintf(stderr,"[CONFIG] config_check_intrange: %s: %i invalid value, authorized range: %i %i\n",
param->optname, (int)*(param->uptr), param->chkPptr->s2.okintrange[0], param->chkPptr->s2.okintrange[1]);
return -1;
}
void print_strvalueerror(paramdef_t *param, char *fname, char **okval, int numokval) {
fprintf(stderr,"[CONFIG] %s: %s: %s invalid value, authorized values:\n ",
fname,param->optname, *(param->strptr));
for ( int i=0; i<numokval ; i++) {
fprintf(stderr, " %s",okval[i]);
}
fprintf(stderr, " \n");
}
int config_check_strval(paramdef_t *param)
{
if ( param == NULL ){
fprintf(stderr,"[CONFIG] config_check_strval: NULL param argument\n");
return -1;
}
for ( int i=0; i<param->chkPptr->s3.num_okstrval ; i++) {
if( strcasecmp(*(param->strptr),param->chkPptr->s3.okstrval[i] ) == 0) {
return 0;
}
}
print_strvalueerror(param, "config_check_strval", param->chkPptr->s3.okstrval, param->chkPptr->s3.num_okstrval);
return -1;
}
int config_checkstr_assign_integer(paramdef_t *param)
{
for (int i=0; i < param->chkPptr->s3a.num_okstrval ; i++) {
if (strcasecmp(*(param->strptr),param->chkPptr->s3a.okstrval[i] ) == 0) {
config_assign_processedint(param, param->chkPptr->s3a.setintval[i]);
return 0;
}
}
print_strvalueerror(param, "config_check_strval", param->chkPptr->s3a.okstrval, param->chkPptr->s3a.num_okstrval);
return -1;
}
......@@ -3,7 +3,7 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.0 (the "License"); you may not use this file
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
......@@ -38,24 +38,34 @@
extern "C"
{
#endif
#define DEFAULT_CFGFILENAME "oaisoftmodem.conf"
#define DEFAULT_CFGMODE "libconfig"
#define CONFIG_GETSOURCE ( (config_get_if()==NULL) ? NULL : config_get_if()->cfgmode )
#define CONFIG_GETNUMP ( (config_get_if()==NULL) ? 0 : config_get_if()->num_cfgP )
#define CONFIG_GETP(P) ( (config_get_if()==NULL) ? NULL : config_get_if()->cfgP[P] )
#define CONFIG_ISFLAGSET(P) ( (config_get_if()==NULL) ? 0 : !!(config_get_if()->rtflags & P))
#define CONFIG_ISPARAMFLAGSET(P,F) ( !!(P.paramflags & F))
/* utility functions, to be used by configuration module and/or configuration libraries */
extern configmodule_interface_t *config_get_if(void);
extern char * config_check_valptr(paramdef_t *cfgoptions, char **ptr, int length) ;
extern void config_printhelp(paramdef_t *,int numparams);
extern int config_process_cmdline(paramdef_t *params,int numparams, char *prefix);
extern int config_get(paramdef_t *params,int numparams, char *prefix);
extern int config_isparamset(paramdef_t *params,int paramidx);
extern void config_assign_processedint(paramdef_t *cfgoption, int val);
extern void config_assign_int(paramdef_t *cfgoptions, char *fullname, int val);
extern int config_process_cmdline(paramdef_t *cfgoptions,int numoptions, char *prefix);
extern int config_getparamval_fromparamdefidx(paramdef_t *cfgoptions,int paramidx);
/* apis to get parameters, to be used by oai modules, at configuration time */
extern int config_get(paramdef_t *params,int numparams, char *prefix);
#define config_getlist config_get_if()->getlist
/* apis to retrieve parameters info after calling get or getlist functions */
extern int config_isparamset(paramdef_t *params,int paramidx);
extern int config_get_processedint(paramdef_t *cfgoption);
/* functions to be used in parameters definition, to check parameters values */
extern int config_check_intval(paramdef_t *param);
extern int config_check_modify_integer(paramdef_t *param);
extern int config_check_intrange(paramdef_t *param);
extern int config_check_strval(paramdef_t *param);
extern int config_checkstr_assign_integer(paramdef_t *param);
#define CONFIG_GETCONFFILE (config_get_if()->cfgP[0])
#ifdef __cplusplus
......
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file common/config/libconfig/config_libconfig.c
* \brief: implementation libconfig configuration library
* \author Francois TABURET
* \date 2017
* \version 0.1
* \company NOKIA BellLabs France
* \email: francois.taburet@nokia-bell-labs.com
* \note
* \warning
*/
#define _GNU_SOURCE
#include <libconfig.h>
......@@ -21,21 +51,23 @@ int read_strlist(paramdef_t *cfgoptions,config_setting_t *setting, char *cfgpath
{
const char *str;
int st;
int numelt;
cfgoptions->numelt=config_setting_length(setting);
cfgoptions->strlistptr=malloc(sizeof(char *) * (cfgoptions->numelt));
numelt=config_setting_length(setting);
config_check_valptr(cfgoptions,(char **)&(cfgoptions->strlistptr), sizeof(char *) * numelt);
st=0;
for (int i=0; i< cfgoptions->numelt && cfgoptions->strlistptr != NULL; i++) {
for (int i=0; i< numelt ; i++) {
str=config_setting_get_string_elem(setting,i);
if (str==NULL) {
printf("[LIBCONFIG] %s%i not found in config file\n", cfgoptions->optname,i);
} else {
cfgoptions->strlistptr[i]=malloc(strlen(str)+1);
config_check_valptr(cfgoptions,&(cfgoptions->strlistptr[i]),strlen(str)+1);
sprintf(cfgoptions->strlistptr[i],"%s",str);
st++;
printf_params("[LIBCONFIG] %s%i: %s\n", cfgpath,i,cfgoptions->strlistptr[i]);
}
}
cfgoptions->numelt=numelt;
return st;
}
......@@ -108,10 +140,10 @@ int config_libconfig_get(paramdef_t *cfgoptions,int numoptions, char *prefix )
config_check_valptr(&(cfgoptions[i]), (char **)(&(cfgoptions[i].strptr)), sizeof(char *));
config_check_valptr(&(cfgoptions[i]), cfgoptions[i].strptr, strlen(str)+1);
sprintf( *(cfgoptions[i].strptr) , "%s", str);
printf_params("[LIBCONFIG] %s: %s\n", cfgpath,*(cfgoptions[i].strptr) );
printf_params("[LIBCONFIG] %s: \"%s\"\n", cfgpath,*(cfgoptions[i].strptr) );
} else {
sprintf( (char *)(cfgoptions[i].strptr) , "%s", str);
printf_params("[LIBCONFIG] %s: %s\n", cfgpath,(char *)cfgoptions[i].strptr );
printf_params("[LIBCONFIG] %s: \"%s\"\n", cfgpath,(char *)cfgoptions[i].strptr );
}
} else {
if( cfgoptions[i].defstrval != NULL) {
......@@ -121,10 +153,10 @@ int config_libconfig_get(paramdef_t *cfgoptions,int numoptions, char *prefix )
config_check_valptr(&(cfgoptions[i]), (char **)(&(cfgoptions[i].strptr)), sizeof(char *));
config_check_valptr(&(cfgoptions[i]), cfgoptions[i].strptr, strlen(cfgoptions[i].defstrval)+1);
sprintf(*(cfgoptions[i].strptr), "%s",cfgoptions[i].defstrval);
printf_params("[LIBCONFIG] %s set to default value %s\n", cfgpath, *(cfgoptions[i].strptr));
printf_params("[LIBCONFIG] %s set to default value \"%s\"\n", cfgpath, *(cfgoptions[i].strptr));
} else {
sprintf((char *)(cfgoptions[i].strptr), "%s",cfgoptions[i].defstrval);
printf_params("[LIBCONFIG] %s set to default value %s\n", cfgpath, (char *)cfgoptions[i].strptr);
sprintf((char *)*(cfgoptions[i].strptr), "%s",cfgoptions[i].defstrval);
printf_params("[LIBCONFIG] %s set to default value \"%s\"\n", cfgpath, (char *)*(cfgoptions[i].strptr));
}
} else {
notfound=1;
......@@ -374,6 +406,7 @@ void config_libconfig_end(void )
config_destroy(&(libconfig_privdata.cfg));
if ( libconfig_privdata.configfile != NULL ) {
free(libconfig_privdata.configfile);
libconfig_privdata.configfile=NULL;
}
}
......@@ -55,12 +55,18 @@ typedef struct {
int nb_inst;
/// Number of Component Carriers per instance in this node
int *nb_CC;
/// Number of NB_IoT instances in this node
int nb_nb_iot_rrc_inst;
/// Number of MACRLC instances in this node
int nb_macrlc_inst;
/// Number of NB_IoT MACRLC instances in this node
int nb_nb_iot_macrlc_inst;
/// Number of component carriers per instance in this node
int *nb_mac_CC;
/// Number of L1 instances in this node
int nb_L1_inst;
/// Number of NB_IoT L1 instances in this node
int nb_nb_iot_L1_inst;
/// Number of Component Carriers per instance in this node
int *nb_L1_CC;
/// Number of RU instances in this node
......@@ -69,10 +75,16 @@ typedef struct {
flexran_agent_info_t **flexran;
/// eNB context variables
struct PHY_VARS_eNB_s ***eNB;
/// NB_IoT L1 context variables
//struct PHY_VARS_eNB_NB_IoT_s **L1_NB_IoT;
/// RRC context variables
struct eNB_RRC_INST_s **rrc;
/// RRC context variables
/// NB_IoT RRC context variables
//struct eNB_RRC_INST_NB_IoT_s **nb_iot_rrc;
/// MAC context variables
struct eNB_MAC_INST_s **mac;
/// NB_IoT MAC context variables
//struct eNB_MAC_INST_NB_IoT_s **nb_iot_mac;
/// GTPu descriptor
gtpv1u_data_t *gtpv1u_data_g;
/// RU descriptors. These describe what each radio unit is supposed to do and contain the necessary functions for fronthaul interfaces
......
......@@ -34,6 +34,7 @@
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <sys/ioctl.h>
#include <dlfcn.h>
#include "openair1/PHY/defs.h"
......@@ -44,55 +45,114 @@
void loader_init(void) {
paramdef_t LoaderParams[] = LOADER_PARAMS_DESC;
loader_data.mainexec_buildversion = PACKAGE_VERSION;
int ret = config_get( LoaderParams,sizeof(LoaderParams)/sizeof(paramdef_t),LOADER_CONFIG_PREFIX);
if (ret <0) {
fprintf(stderr,"[LOADER] configuration couldn't be performed");
fprintf(stderr,"[LOADER] %s %d configuration couldn't be performed",__FILE__, __LINE__);
if (loader_data.shlibpath == NULL) {
loader_data.shlibpath=DEFAULT_PATH;
}
return;
}
}
loader_data.shlibs = malloc(loader_data.maxshlibs * sizeof(loader_shlibdesc_t));
if(loader_data.shlibs == NULL) {
fprintf(stderr,"[LOADER] %s %d memory allocation error %s\n",__FILE__, __LINE__,strerror(errno));
exit_fun("[LOADER] unrecoverable error");
}
memset(loader_data.shlibs,0,loader_data.maxshlibs * sizeof(loader_shlibdesc_t));
}
/* build the full shared lib name from the module name */
char *loader_format_shlibpath(char *modname)
{
char *tmpstr;
char *shlibpath =NULL;
char *shlibversion=NULL;
char *cfgprefix;
paramdef_t LoaderParams[] ={{"shlibpath", NULL, 0, strptr:&shlibpath, defstrval:NULL, TYPE_STRING, 0},
{"shlibversion", NULL, 0, strptr:&shlibversion, defstrval:"", TYPE_STRING, 0}};
int ret;
/* looks for specific path for this module in the config file */
/* specific value for a module path and version is located in a modname subsection of the loader section */
/* shared lib name is formatted as lib<module name><module version>.so */
cfgprefix = malloc(sizeof(LOADER_CONFIG_PREFIX)+strlen(modname)+16);
if (cfgprefix == NULL) {
fprintf(stderr,"[LOADER] %s %d malloc error loading module %s, %s\n",__FILE__, __LINE__, modname, strerror(errno));
exit_fun("[LOADER] unrecoverable error");
} else {
sprintf(cfgprefix,LOADER_CONFIG_PREFIX ".%s",modname);
int ret = config_get( LoaderParams,sizeof(LoaderParams)/sizeof(paramdef_t),cfgprefix);
if (ret <0) {
fprintf(stderr,"[LOADER] %s %d couldn't retrieve config from section %s\n",__FILE__, __LINE__,cfgprefix);
}
}
/* no specific path, use loader default shared lib path */
if (shlibpath == NULL) {
shlibpath = loader_data.shlibpath ;
}
/* alloc memory for full module shared lib file name */
tmpstr = malloc(strlen(shlibpath)+strlen(modname)+strlen(shlibversion)+16);
if (tmpstr == NULL) {
fprintf(stderr,"[LOADER] %s %d malloc error loading module %s, %s\n",__FILE__, __LINE__, modname, strerror(errno));
exit_fun("[LOADER] unrecoverable error");
}
if(shlibpath[0] != 0) {
ret=sprintf(tmpstr,"%s/",shlibpath);
} else {
ret = 0;
}
sprintf(tmpstr+ret,"lib%s%s.so",modname,shlibversion);
return tmpstr;
}
int load_module_shlib(char *modname,loader_shlibfunc_t *farray, int numf)
{
void *lib_handle;
initfunc_t fpi;
char *tmpstr;
checkverfunc_t fpc;
char *shlib_path;
char *afname=NULL;
int ret=0;
if (loader_data.shlibpath == NULL) {
loader_init();
}
tmpstr = malloc(strlen(loader_data.shlibpath)+strlen(modname)+16);
if (tmpstr == NULL) {
fprintf(stderr,"[LOADER] %s %d malloc error loading module %s, %s\n",__FILE__, __LINE__, modname, strerror(errno));
return -1;
}
if(loader_data.shlibpath[0] != 0) {
ret=sprintf(tmpstr,"%s/",loader_data.shlibpath);
}
if(strstr(modname,".so") == NULL) {
sprintf(tmpstr+ret,"lib%s.so",modname);
} else {
sprintf(tmpstr+ret,"%s",modname);
}
shlib_path = loader_format_shlibpath(modname);
ret = 0;
lib_handle = dlopen(tmpstr, RTLD_LAZY|RTLD_NODELETE|RTLD_GLOBAL);
lib_handle = dlopen(shlib_path, RTLD_LAZY|RTLD_NODELETE|RTLD_GLOBAL);
if (!lib_handle) {
fprintf(stderr,"[LOADER] library %s is not loaded: %s\n", tmpstr,dlerror());
fprintf(stderr,"[LOADER] library %s is not loaded: %s\n", shlib_path,dlerror());
ret = -1;
} else {
printf("[LOADER] library %s uccessfully loaded loaded\n", tmpstr);
sprintf(tmpstr,"%s_autoinit",modname);
fpi = dlsym(lib_handle,tmpstr);
printf("[LOADER] library %s successfully loaded\n", shlib_path);
afname=malloc(strlen(modname)+15);
sprintf(afname,"%s_checkbuildver",modname);
fpc = dlsym(lib_handle,afname);
if (fpc != NULL ){
int chkver_ret = fpc(loader_data.mainexec_buildversion, &(loader_data.shlibs[loader_data.numshlibs].shlib_buildversion));
if (chkver_ret < 0) {
fprintf(stderr,"[LOADER] %s %d lib %s, version mismatch",__FILE__, __LINE__, modname);
exit_fun("[LOADER] unrecoverable error");
}
}
sprintf(afname,"%s_autoinit",modname);
fpi = dlsym(lib_handle,afname);
if (fpi != NULL )
{
if (fpi != NULL ) {
fpi();
}
}
if (farray != NULL) {
for (int i=0; i<numf; i++) {
......@@ -103,9 +163,22 @@ int load_module_shlib(char *modname,loader_shlibfunc_t *farray, int numf)
}
} /* for int i... */
} /* farray ! NULL */
}
loader_data.shlibs[loader_data.numshlibs].name=strdup(modname);
loader_data.shlibs[loader_data.numshlibs].thisshlib_path=strdup(shlib_path);
loader_data.shlibs[loader_data.numshlibs].funcarray=malloc(numf*sizeof(loader_shlibfunc_t));
loader_data.shlibs[loader_data.numshlibs].numfunc=0;
for (int i=0; i<numf;i++) {
if (farray[i].fptr != NULL) {
loader_data.shlibs[loader_data.numshlibs].funcarray[i].fname=strdup(farray[i].fname);
loader_data.shlibs[loader_data.numshlibs].funcarray[i].fptr = farray[i].fptr;
loader_data.shlibs[loader_data.numshlibs].numfunc++;
}
}
(loader_data.numshlibs)++;
} /* lib_handle != NULL */
if (tmpstr != NULL) free(tmpstr);
if ( shlib_path!= NULL) free(shlib_path);
if ( afname!= NULL) free(afname);
if (lib_handle != NULL) dlclose(lib_handle);
return ret;
}
......@@ -34,32 +34,49 @@
typedef int(*initfunc_t)(void);
typedef struct {
char *shlibpath;
}loader_data_t;
typedef int(*checkverfunc_t)(char * mainexec_version, char ** shlib_version);
typedef struct {
char *fname;
int (*fptr)(void);
}loader_shlibfunc_t;
typedef struct {
char *name;
char *shlib_version; //
char *shlib_buildversion;
char *thisshlib_path;
uint32_t numfunc;
loader_shlibfunc_t *funcarray;
}loader_shlibdesc_t;
typedef struct {
char *mainexec_buildversion;
char *shlibpath;
uint32_t maxshlibs;
uint32_t numshlibs;
loader_shlibdesc_t *shlibs;
}loader_data_t;
#ifdef LOAD_MODULE_SHLIB_MAIN
#define LOADER_CONFIG_PREFIX "loader"
#define DEFAULT_PATH ""
loader_data_t loader_data;
/*--------------------------------------------------------------------------------------------------------------------------------------*/
/* LOADER parameters */
/* optname helpstr paramflags XXXptr defXXXval type numelt */
/*--------------------------------------------------------------------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------------------------------------------------------------------------*/
/* LOADER parameters */
/* optname helpstr paramflags XXXptr defXXXval type numelt */
/*----------------------------------------------------------------------------------------------------------------------------------------------*/
#define LOADER_PARAMS_DESC { \
{"shlibpath", NULL, 0, strptr:(char **)&(loader_data.shlibpath), defstrval:DEFAULT_PATH, TYPE_STRING, 0} \
{"shlibpath", NULL, PARAMFLAG_NOFREE, strptr:(char **)&(loader_data.shlibpath), defstrval:DEFAULT_PATH, TYPE_STRING, 0}, \
{"maxshlibs", NULL, 0, uptr:&(loader_data.maxshlibs), defintval:10, TYPE_UINT32, 0}, \
}
/*-------------------------------------------------------------------------------------------------------------*/
#else
#else /* LOAD_MODULE_SHLIB_MAIN */
extern int load_module_shlib(char *modname, loader_shlibfunc_t *farray, int numf);
#endif
extern loader_data_t loader_data;
#endif /* LOAD_MODULE_SHLIB_MAIN */
#endif
cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
IF(DEFINED ENV{OPENAIR_DIR})
message("...using oai source files in $ENV{OPENAIR_DIR}")
ELSE()
message("OPENAIR_DIR is not defined. You must run \"source oaienv\" from the oai root dir")
# exit early
return()
ENDIF()
set(OPENAIR_DIR $ENV{OPENAIR_DIR})
set(APPROOT ${OPENAIR_DIR}/common/utils/telnetsrv )
set(OPENAIR_BUILD_DIR $ENV{OPENAIR_DIR}/cmake_targets)
set(OPENAIR1_DIR $ENV{OPENAIR1_DIR})
set(OPENAIR2_DIR $ENV{OPENAIR2_DIR})
set(OPENAIR3_DIR $ENV{OPENAIR3_DIR})
set(OPENAIR_PHY_DIR $ENV{OPENAIR1_DIR}/PHY)
set(OPENAIR_TARGET_DIR $ENV{OPENAIR_DIR}/targets)
set(OPENAIR_COMMONUTILS_DIR $ENV{OPENAIR_DIR}/common/utils)
set(OPENAIR2_COMMON_DIR $ENV{OPENAIR_DIR}/openair2/COMMON)
set(OPENAIR_ASN1INC ${OPENAIR_BUILD_DIR}/lte_build_oai/build/CMakeFiles/Rel14)
set(OPENAIR_NFAPIINC $ENV{NFAPI_DIR} )
set(CMAKE_INSTALL_PREFIX $ENV{OPENAIR_TARGETS})
add_definitions (-DRel14 -DCMAKER -DENABLE_ITTI -DENABLE_NAS_UE_LOGGING -DENABLE_SECURITY -DENABLE_USE_CPU_EXECUTION_TIME -DENABLE_USE_MME -DENABLE_VCD -DENB_AGENT -DENB_MODE -DETHERNET=1 -DEXMIMO_IOT -DJUMBO_FRAME -DLINK_ENB_PDCP_TO_GTPV1U -DLOG_NO_THREAD -DMAC_CONTEXT -DMAX_NUM_CCs=1 -DNAS_BUILT_IN_UE -DNAS_UE -DNB_ANTENNAS_RX=2 -DNB_ANTENNAS_TX=2 -DNO_RRM -DNone=1 -DOAI_NW_DRIVER_USE_NETLINK -DOPENAIR2 -DOPENAIR_LTE -DPHYSIM -DPHY_CONTEXT -DRel10=1 -DS1AP_VERSION=R10 -DTRACE_RLC_MUTEX -DX2AP_VERSION=R11 -DXFORMS -mavx2 -msse4.1 -mssse3)
add_compile_options( -fPIC -march=native -Ofast)
include_directories( ./ ${OPENAIR_COMMON_DIR} ${OPENAIR_DIR} ${OPENAIR1_DIR} ${OPENAIR2_DIR} ${OPENAIR2_COMMON_DIR} ${OPENAIR2_DIR}/UTIL/LOG
${OPENAIR_COMMONUTILS_DIR}/msc ${OPENAIR_COMMONUTILS_DIR}/itti ${OPENAIR_COMMONUTILS_DIR}/hashtable ${OPENAIR_COMMONUTILS_DIR} ${OPENAIR_ASN1INC}
${OPENAIR2_DIR}/LAYER2/RLC/AM_v9.3.0 ${OPENAIR_COMMONUTILS_DIR}/msc ${OPENAIR_COMMONUTILS_DIR}/itti ${OPENAIR_COMMONUTILS_DIR}/hashtable ${OPENAIR_COMMONUTILS_DIR} ${OPENAIR_ASN1INC}
${OPENAIR2_DIR}/LAYER2/RLC ${OPENAIR2_DIR}/UTIL/LISTS ${OPENAIR2_DIR}/UTIL/MEM ${OPENAIR2_DIR}/LAYER2/RLC/UM_v9.3.0
${OPENAIR2_DIR}/LAYER2/RLC/TM_v9.3.0 ${OPENAIR2_DIR}/RRC/LITE ${OPENAIR_TARGET_DIR}/COMMON ${OPENAIR_TARGET_DIR}/ARCH/COMMON
${OPENAIR3_DIR}/NAS/COMMON/API/NETWORK ${OPENAIR3_DIR}/NAS/COMMON/EMM/MSG/ ${OPENAIR3_DIR}/NAS/COMMON/IES/ ${OPENAIR3_DIR}/NAS/COMMON/UTIL
${OPENAIR3_DIR}/NAS/COMMON/ESM/MSG/ ${OPENAIR3_DIR}/GTPV1-U ${OPENAIR3_DIR}/GTPV1-U/nw-gtpv1u/shared ${OPENAIR3_DIR}/GTPV1-U/nw-gtpv1u/include
${OPENAIR3_DIR}/UTILS ${OPENAIR_NFAPIINC})
set(TELNETSRV_SOURCE
${APPROOT}/telnetsrv.c
${APPROOT}/telnetsrv_phycmd.c
${APPROOT}/telnetsrv_proccmd.c
)
#set(TELNETSRV_ETHDEVCMD_SOURCE
# ${APPROOT}/telnetsrv/telnetsrv_ethdevcmd.c
# )
add_library(telnetsrv MODULE ${TELNETSRV_SOURCE} )
#add_library(telnetsrv_ethdevcmd MODULE ${TELNETSRV_ETHDEVCMD_SOURCE} )
install(TARGETS telnetsrv DESTINATION bin)
if (EXISTS "${OPENAIR_BUILD_DIR}/lte_build_oai/build" AND IS_DIRECTORY "${OPENAIR_BUILD_DIR}/lte_build_oai/build")
install(TARGETS telnetsrv DESTINATION ${OPENAIR_BUILD_DIR}/lte_build_oai/build)
endif (EXISTS "${OPENAIR_BUILD_DIR}/lte_build_oai/build" AND IS_DIRECTORY "${OPENAIR_BUILD_DIR}/lte_build_oai/build")
This diff is collapsed.
......@@ -3,7 +3,7 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.0 (the "License"); you may not use this file
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
......@@ -18,7 +18,6 @@
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file common/utils/telnetsrv/telnetsrv.h
* \brief: include file for telnet server implementation
* \author Francois TABURET
......@@ -38,7 +37,7 @@
#define TELNET_MAX_MSGLENGTH 2048
#define TELNET_PROMPT "softmodem> "
#define TELNET_MAXCMD 20
#define TELNET_CMD_MAXSIZE 10
#define TELNET_CMD_MAXSIZE 20
#define TELNET_HELPSTR_SIZE 80
/* status return by the command parser after it analysed user input */
......@@ -70,7 +69,7 @@ typedef struct cmddef {
#define TELNET_VARTYPE_INT64 3
#define TELNET_VARTYPE_STRING 4
#define TELNET_VARTYPE_DOUBLE 5
#define TELNET_VARTYPE_PTR 6
//#define TELNET_VARTYPE_PTR 6
typedef struct variabledef {
char varname[TELNET_CMD_MAXSIZE];
char vartype;
......@@ -96,6 +95,8 @@ typedef struct {
pthread_t telnet_pthread; // thread id of the telnet server
int telnetdbg; // debug level of the server
int priority; // server running priority
char *histfile; // command history
int histsize; // command history length
int new_socket; // socket of the client connection
int logfilefd; // file id of the log file when log output is redirected to a file
int saved_stdout; // file id of the previous stdout, used to be able to restore original stdout
......@@ -134,6 +135,6 @@ VT escape sequence definition, for smarter display....
int add_telnetcmd(char *modulename, telnetshell_vardef_t *var, telnetshell_cmddef_t *cmd);
void set_sched(pthread_t tid, int pid,int priority);
void set_affinity(pthread_t tid, int pid, int coreid);
extern int get_phybsize();
extern int get_phybsize(void);
#endif
#endif
set(TELNETROOT ${OPENAIR_DIR}/common/utils/telnetsrv )
set(TELNETSRV_SOURCE
${TELNETROOT}/telnetsrv.c
${TELNETROOT}/telnetsrv_phycmd.c
${TELNETROOT}/telnetsrv_proccmd.c
${TELNETROOT}/telnetsrv_loader.c
)
#set(TELNETSRV_ETHDEVCMD_SOURCE
# ${APPROOT}/telnetsrv/telnetsrv_ethdevcmd.c
# )
add_library(telnetsrv MODULE ${TELNETSRV_SOURCE} )
#add_library(telnetsrv_ethdevcmd MODULE ${TELNETSRV_ETHDEVCMD_SOURCE} )
target_link_libraries(telnetsrv PRIVATE history)
install(TARGETS telnetsrv DESTINATION bin)
if (EXISTS "${OPENAIR_BUILD_DIR}/lte_build_oai/build" AND IS_DIRECTORY "${OPENAIR_BUILD_DIR}/lte_build_oai/build")
install(TARGETS telnetsrv DESTINATION ${OPENAIR_BUILD_DIR}/lte_build_oai/build)
endif (EXISTS "${OPENAIR_BUILD_DIR}/lte_build_oai/build" AND IS_DIRECTORY "${OPENAIR_BUILD_DIR}/lte_build_oai/build")
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file common/utils/telnetsrv/telnetsrv_loader.c
* \brief: implementation of telnet commands related to softmodem linux process
* \author Francois TABURET
* \date 2018
* \version 0.1
* \company NOKIA BellLabs France
* \email: francois.taburet@nokia-bell-labs.com
* \note
* \warning
*/
#define _GNU_SOURCE
#include <string.h>
#include <pthread.h>
#define TELNETSERVERCODE
#include "telnetsrv.h"
#define TELNETSRV_LOADER_MAIN
#include "telnetsrv_loader.h"
int loader_show_cmd(char *buff, int debug, telnet_printfunc_t prnt);
telnetshell_cmddef_t loader_cmdarray[] = {
{"show","[params,modules]",loader_show_cmd},
{"","",NULL},
};
/*-------------------------------------------------------------------------------------*/
int loader_show_cmd(char *buff, int debug, telnet_printfunc_t prnt)
{
if (debug > 0)
prnt( "loader_show_cmd received %s\n",buff);
if (strcasestr(buff,"params") != NULL) {
prnt( "loader parameters:\n");
prnt( " Main executable build version: \"%s\"\n", loader_data.mainexec_buildversion);
prnt( " Default shared lib path: \"%s\"\n", loader_data.shlibpath);
prnt( " Max number of shared lib : %i\n", loader_data.maxshlibs);
}
else if (strcasestr(buff,"modules") != NULL) {
prnt( "%i shared lib have been dynamicaly loaded by the oai loader\n", loader_data.numshlibs);
for (int i=0 ; i<loader_data.numshlibs ; i++) {
prnt( " Module %i: %s\n", i,loader_data.shlibs[i].name);
prnt( " Shared library build version: \"%s\"\n",((loader_data.shlibs[i].shlib_buildversion == NULL )?"":loader_data.shlibs[i].shlib_buildversion));
prnt( " Shared library path: \"%s\"\n", loader_data.shlibs[i].thisshlib_path);
prnt( " %i function pointers registered:\n", loader_data.shlibs[i].numfunc);
for(int j=0 ; j<loader_data.shlibs[i].numfunc;j++) {
prnt( " function %i %s at %p\n",j,
loader_data.shlibs[i].funcarray[j].fname, loader_data.shlibs[i].funcarray[j].fptr);
}
}
} else {
prnt("%s: wrong loader command...\n",buff);
}
return 0;
}
void add_loader_cmds(void)
{
add_telnetcmd("loader", loader_globalvardef, loader_cmdarray);
}
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file common/utils/telnetsrv_proccmd.h
* \brief: Include file defining telnet commands related to softmodem linux process
* \author Francois TABURET
* \date 2018
* \version 0.1
* \company NOKIA BellLabs France
* \email: francois.taburet@nokia-bell-labs.com
* \note
* \warning
*/
#ifdef TELNETSRV_LOADER_MAIN
#include "UTIL/LOG/log.h"
#include "common/utils/load_module_shlib.h"
telnetshell_vardef_t loader_globalvardef[] = {
{"mainversion",TELNET_VARTYPE_STRING,&(loader_data.mainexec_buildversion)},
{"defpath",TELNET_VARTYPE_STRING,&(loader_data.shlibpath)},
{"maxshlibs",TELNET_VARTYPE_INT32,&(loader_data.maxshlibs)},
{"numshlibs",TELNET_VARTYPE_INT32,&(loader_data.numshlibs)},
{"",0,NULL}
};
telnetshell_vardef_t *loader_modulesvardef;
extern void add_loader_cmds(void);
#endif
/*-------------------------------------------------------------------------------------*/
......@@ -41,7 +41,7 @@
char *prnbuff;
extern int dump_eNB_stats(PHY_VARS_eNB *eNB, char* buffer, int length);
void init_phytelnet()
void init_phytelnet(void)
{
prnbuff=malloc(get_phybsize() );
if (prnbuff == NULL)
......@@ -134,7 +134,7 @@ telnetshell_cmddef_t phy_cmdarray[] = {
/*-------------------------------------------------------------------------------------*/
void add_phy_cmds()
void add_phy_cmds(void)
{
init_phytelnet();
......
......@@ -42,8 +42,6 @@
#define TELNETVAR_PHYCC1 1
telnetshell_vardef_t phy_vardef[] = {
{"phycc1",TELNET_VARTYPE_PTR,NULL},
{"phycc2",TELNET_VARTYPE_PTR,NULL},
//{"iqmax",TELNET_VARTYPE_INT16,NULL},
//{"iqmin",TELNET_VARTYPE_INT16,NULL},
//{"loglvl",TELNET_VARTYPE_INT32,NULL},
......@@ -57,7 +55,7 @@ telnetshell_vardef_t phy_vardef[] = {
#else
extern void add_phy_cmds();
extern void add_phy_cmds(void);
#endif
......
This diff is collapsed.
......@@ -3,7 +3,7 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.0 (the "License"); you may not use this file
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
......@@ -19,6 +19,7 @@
* contact@openairinterface.org
*/
/*! \file common/utils/telnetsrv/telnetsrv_proccmd.h
* \brief: Include file defining telnet commands related to this linux process
* \author Francois TABURET
......@@ -43,15 +44,33 @@ extern int proccmd_log(char *buf, int debug, telnet_printfunc_t prnt);
telnetshell_vardef_t proc_vardef[] = {
{"",0,NULL}
};
#define PROCCMD_LOG_HELP_STRING " log sub commands: \n\
show: display current log configuration \n\
online, noonline: enable or disable console logs \n\
enable, disable id1-id2: enable or disable logs for components index id1 to id2 \n\
level_<level> id1-id2: set log level to <level> for components index id1 to id2 \n\
level_<verbosity> id1-id2: set log verbosity to <verbosity> for components index id1 to id2 \n\
use the show command to get the values for <level>, <verbosity> and the list of component indexes \
that can be used for id1 and id2 \n"
#define PROCCMD_THREAD_HELP_STRING " thread sub commands: \n\
<thread id> aff <core> : set affinity of thread <thread id> to core <core> \n\
<thread id> prio <prio> : set scheduling parameters for thread <thread id> \n\
if prio < -20: linux scheduling policy set to FIFO, \n\
with priority = -20 - prio \n\
if prio > 19: linux scheduling policy set to OTHER, \n\
with priority (nice value) = prio \n\
use \"softmodem show thread\" to get <thread id> \n"
telnetshell_cmddef_t proc_cmdarray[] = {
{"show","loglvl|thread", proccmd_show},
{"log","[enable,disable]", proccmd_log},
{"thread","<id> aff|prio <aff|prio>", proccmd_thread},
{"show","loglvl|thread|config", proccmd_show},
{"log","(enter help for details)", proccmd_log},
{"thread","(enter help for details)", proccmd_thread},
{"exit","", proccmd_exit},
{"","",NULL},
};
#else
extern void add_proccmd_cmds();
extern void add_proccmd_cmds(void);
#endif /* TELNETSRV_PROCCMD_MAIN */
......@@ -27,7 +27,9 @@
#ifndef TC_MAIN
//#include "defs.h"
#endif
#include <stdint.h>
#include <stdio.h>
#include "PHY/CODING/defs.h"
#include "extern_3GPPinterleaver.h"
//#define DEBUG_TURBO_ENCODER 1
......@@ -35,7 +37,7 @@
uint32_t threegpplte_interleaver_output;
uint32_t threegpplte_interleaver_tmp;
inline void threegpplte_interleaver_reset()
inline void threegpplte_interleaver_reset(void)
{
threegpplte_interleaver_output = 0;
threegpplte_interleaver_tmp = 0;
......@@ -82,7 +84,7 @@ uint8_t output_lut[16],state_lut[16];
inline uint8_t threegpplte_rsc_lut(uint8_t input,uint8_t *state)
{
uint8_t output;
uint8_t off;
off = (*state<<1)|input;
......@@ -146,7 +148,7 @@ void threegpplte_turbo_encoder(uint8_t *input,
for (i=0; f1f2mat[i].nb_bits!= input_length_bits && i <188; i++);
if ( i == 188 ) {
msg("Illegal frame length!\n");
printf("Illegal frame length!\n");
return;
} else {
base_interleaver=il_tb+f1f2mat[i].beg_index;
......
......@@ -96,7 +96,7 @@ static inline void threegpplte_rsc_termination(unsigned char *x,unsigned char *z
*state = (*state)>>1;
}
void treillis_table_init(void)
static void treillis_table_init(void)
{
//struct treillis t[][]=all_treillis;
//t=memalign(16,sizeof(struct treillis)*8*256);
......@@ -536,12 +536,12 @@ char interleave_compact_byte(short * base_interleaver,unsigned char * input, uns
}
*/
void threegpplte_turbo_encoder(unsigned char *input,
unsigned short input_length_bytes,
unsigned char *output,
unsigned char F,
unsigned short interleaver_f1,
unsigned short interleaver_f2)
void threegpplte_turbo_encoder_sse(unsigned char *input,
unsigned short input_length_bytes,
unsigned char *output,
unsigned char F,
unsigned short interleaver_f1,
unsigned short interleaver_f2)
{
int i;
......@@ -641,7 +641,24 @@ void threegpplte_turbo_encoder(unsigned char *input,
#endif
}
void init_encoder_sse (void) {
treillis_table_init();
}
/* function which will be called by the shared lib loader, to check shared lib version
against main exec version. version mismatch no considered as fatal (interfaces not supposed to change)
*/
int coding_checkbuildver(char * mainexec_buildversion, char ** shlib_buildversion)
{
#ifndef PACKAGE_VERSION
#define PACKAGE_VERSION "standalone built: " __DATE__ __TIME__
#endif
*shlib_buildversion = PACKAGE_VERSION;
if (strcmp(mainexec_buildversion, *shlib_buildversion) != 0) {
fprintf(stderr,"[CODING] shared lib version %s, doesn't match main version %s, compatibility should be checked\n",
mainexec_buildversion,*shlib_buildversion);
}
return 0;
}
#ifdef TC_MAIN
#define INPUT_LENGTH 20
......
......@@ -550,7 +550,7 @@ void compute_alpha_s(llr_t* alpha,llr_t* m_11,llr_t* m_10,unsigned short frame_l
void compute_beta_s(llr_t* beta,llr_t *m_11,llr_t* m_10,llr_t* alpha,unsigned short frame_length,unsigned char F)
{
int k,i;
int k;
llr_t old0, old1, old2, old3, old4, old5, old6, old7;
llr_t new0, new1, new2, new3, new4, new5, new6, new7;
llr_t m_b0, m_b1, m_b2, m_b3, m_b4,m_b5, m_b6, m_b7;
......@@ -897,7 +897,7 @@ unsigned char phy_threegpplte_turbo_decoder_scalar(llr_t *y,
unsigned char crc_len,temp;
if (crc_type > 3) {
msg("Illegal crc length!\n");
fprintf(stderr,"Illegal crc length!\n");
return 255;
}
......
......@@ -37,9 +37,9 @@
///
///
#ifdef __AVX2__
#include "PHY/sse_intrin.h"
#ifndef TEST_DEBUG
#include "PHY/defs.h"
......@@ -58,6 +58,8 @@
#include "mex.h"
#endif
#ifdef __AVX2__
#include "PHY/sse_intrin.h"
//#define DEBUG_LOGMAP
......@@ -837,7 +839,7 @@ void free_td16avx2(void)
}
}
void init_td16avx2()
void init_td16avx2(void)
{
int ind,i,i2,i3,j,n,pi,pi2_i,pi2_pi;
......@@ -1408,6 +1410,36 @@ unsigned char phy_threegpplte_turbo_decoder16avx2(int16_t *y,
#endif
return(iteration_cnt);
}
#else //__AVX2__
unsigned char phy_threegpplte_turbo_decoder16avx2(int16_t *y,
int16_t *y2,
uint8_t *decoded_bytes,
uint8_t *decoded_bytes2,
uint16_t n,
uint16_t f1,
uint16_t f2,
uint8_t max_iterations,
uint8_t crc_type,
uint8_t F,
time_stats_t *init_stats,
time_stats_t *alpha_stats,
time_stats_t *beta_stats,
time_stats_t *gamma_stats,
time_stats_t *ext_stats,
time_stats_t *intl1_stats,
time_stats_t *intl2_stats)
{
return 0;
}
void free_td16avx2(void)
{
}
void init_td16avx2(void)
{
}
#endif //__AVX2__
......
......@@ -1124,7 +1124,7 @@ void free_td16(void)
}
}
void init_td16()
void init_td16(void)
{
int ind,i,i2,i3,j,n,pi,pi3;
......
......@@ -849,7 +849,7 @@ void free_td8(void)
extern RAN_CONTEXT_t RC;
void init_td8()
void init_td8(void)
{
int ind,i,j,n,n2,pi,pi3;
......
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.0 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file openair1/PHY/CODING
* \brief: load library implementing coding/decoding algorithms
* \author Francois TABURET
* \date 2017
* \version 0.1
* \company NOKIA BellLabs France
* \email: francois.taburet@nokia-bell-labs.com
* \note
* \warning
*/
#include <sys/types.h>
#include "PHY/defs.h"
#include "common/utils/load_module_shlib.h"
loader_shlibfunc_t shlib_fdesc[DECODE_NUM_FPTR];
decoder_if_t decoder16;
decoder_if_t decoder8;
encoder_if_t encoder;
extern int _may_i_use_cpu_feature(unsigned __int64);
uint8_t nodecod(short *y,
short *y2,
unsigned char *decoded_bytes,
unsigned char *decoded_bytes2,
unsigned short n,
unsigned short f1,
unsigned short f2,
unsigned char max_iterations,
unsigned char crc_type,
unsigned char F,
time_stats_t *init_stats,
time_stats_t *alpha_stats,
time_stats_t *beta_stats,
time_stats_t *gamma_stats,
time_stats_t *ext_stats,
time_stats_t *intl1_stats,
time_stats_t *intl2_stats)
{
printf(".");
return max_iterations+1;
};
void decoding_setmode (int mode) {
switch (mode) {
case MODE_DECODE_NONE:
decoder8=nodecod;
decoder16=nodecod;
encoder=(encoder_if_t)shlib_fdesc[ENCODE_C_FPTRIDX].fptr;
break;
case MODE_DECODE_SSE:
decoder8=(decoder_if_t)shlib_fdesc[DECODE_TD8_SSE_FPTRIDX].fptr;
decoder16=(decoder_if_t)shlib_fdesc[DECODE_TD16_SSE_FPTRIDX].fptr;
encoder=(encoder_if_t)shlib_fdesc[ENCODE_SSE_FPTRIDX].fptr;
break;
case MODE_DECODE_C:
decoder16=(decoder_if_t)shlib_fdesc[DECODE_TD_C_FPTRIDX].fptr;
decoder8=(decoder_if_t)shlib_fdesc[DECODE_TD_C_FPTRIDX].fptr;
encoder=(encoder_if_t)shlib_fdesc[ENCODE_C_FPTRIDX].fptr;
break;
case MODE_DECODE_AVX2:
decoder16=(decoder_if_t)shlib_fdesc[DECODE_TD16_AVX2_FPTRIDX].fptr;
decoder8=(decoder_if_t)shlib_fdesc[DECODE_TD8_SSE_FPTRIDX].fptr;
encoder=(encoder_if_t)shlib_fdesc[ENCODE_SSE_FPTRIDX].fptr;
break;
}
}
int load_codinglib(void) {
int ret;
shlib_fdesc[DECODE_INITTD8_SSE_FPTRIDX].fname = "init_td8";
shlib_fdesc[DECODE_INITTD16_SSE_FPTRIDX].fname= "init_td16";
shlib_fdesc[DECODE_INITTD_AVX2_FPTRIDX].fname="init_td16avx2";
shlib_fdesc[DECODE_TD8_SSE_FPTRIDX].fname= "phy_threegpplte_turbo_decoder8";
shlib_fdesc[DECODE_TD16_SSE_FPTRIDX].fname= "phy_threegpplte_turbo_decoder16";
shlib_fdesc[DECODE_TD_C_FPTRIDX].fname= "phy_threegpplte_turbo_decoder_scalar";
shlib_fdesc[DECODE_TD16_AVX2_FPTRIDX].fname= "phy_threegpplte_turbo_decoder16avx2";
shlib_fdesc[DECODE_FREETD8_FPTRIDX].fname = "free_td8";
shlib_fdesc[DECODE_FREETD16_FPTRIDX].fname= "free_td16";
shlib_fdesc[DECODE_FREETD_AVX2_FPTRIDX].fname= "free_td16avx2";
shlib_fdesc[ENCODE_SSE_FPTRIDX].fname= "threegpplte_turbo_encoder_sse";
shlib_fdesc[ENCODE_C_FPTRIDX].fname= "threegpplte_turbo_encoder";
shlib_fdesc[ENCODE_INIT_SSE_FPTRIDX].fname= "init_encoder_sse";
ret=load_module_shlib("coding",shlib_fdesc,DECODE_NUM_FPTR);
if (ret < 0) exit_fun("Error loading coding library");
/* execute encoder/decoder init functions */
shlib_fdesc[DECODE_INITTD8_SSE_FPTRIDX].fptr();
shlib_fdesc[DECODE_INITTD16_SSE_FPTRIDX].fptr();
shlib_fdesc[DECODE_INITTD_AVX2_FPTRIDX].fptr();
shlib_fdesc[ENCODE_INIT_SSE_FPTRIDX].fptr();
decoding_setmode(MODE_DECODE_SSE);
return 0;
}
void free_codinglib(void) {
shlib_fdesc[DECODE_FREETD8_FPTRIDX].fptr();
shlib_fdesc[DECODE_FREETD16_FPTRIDX].fptr();
shlib_fdesc[DECODE_FREETD_AVX2_FPTRIDX].fptr();
}
......@@ -292,9 +292,7 @@ void ccodedot11_init(void);
\brief This function initializes the trellis structure for decoding an 802.11 convolutional code.*/
void ccodedot11_init_inv(void);
/*!\fn void teillis_table_init(void)
\brief This function initializes the trellis structure for 3GPP LTE Turbo code.*/
void treillis_table_init(void);
/*\fn void threegpplte_turbo_encoder(uint8_t *input,uint16_t input_length_bytes,uint8_t *output,uint8_t F,uint16_t interleaver_f1,uint16_t interleaver_f2)
\brief This function implements a rate 1/3 8-state parralel concatenated turbo code (3GPP-LTE).
......@@ -352,35 +350,7 @@ void ccodedab_init_inv(void);
\brief This function initializes the different crc tables.*/
void crcTableInit (void);
/*!\fn void free_td8(void)
\brief This function frees the tables for 8-bit LLR Turbo decoder.*/
void free_td8(void);
/*!\fn void init_td8(void)
\brief This function initializes the tables for 8-bit LLR Turbo decoder.*/
void init_td8 (void);
/*!\fn void free_td16(void)
\brief This function frees the tables for 16-bit LLR Turbo decoder.*/
void free_td16(void);
/*!\fn void init_td16(void)
\brief This function initializes the tables for 16-bit LLR Turbo decoder.*/
void init_td16 (void);
#ifdef __AVX2__
/*!\fn void init_td8(void)
\brief This function initializes the tables for 8-bit LLR Turbo decoder (AVX2).*/
void init_td8avx2 (void);
/*!\fn void free_td16avx2(void)
\brief This function frees the tables for 16-bit LLR Turbo decoder (AVX2).*/
void free_td16avx2(void);
/*!\fn void init_td16(void)
\brief This function initializes the tables for 16-bit LLR Turbo decoder (AVX2).*/
void init_td16avx2 (void);
#endif
/*!\fn uint32_t crc24a(uint8_t *inPtr, int32_t bitlen)
\brief This computes a 24-bit crc ('a' variant for overall transport block)
......
......@@ -20,5 +20,9 @@
*/
extern unsigned short f1f2mat_old[2*188];
extern double cpuf;
extern decoder_if_t decoder16;
extern decoder_if_t decoder8;
extern encoder_if_t encoder;
extern int load_codinglib(void);
extern int free_codinglib(void);
......@@ -34,15 +34,12 @@ void init_lte_top(LTE_DL_FRAME_PARMS *frame_parms)
ccodelte_init();
ccodelte_init_inv();
treillis_table_init();
phy_generate_viterbi_tables();
phy_generate_viterbi_tables_lte();
init_td8();
init_td16();
#ifdef __AVX2__
init_td16avx2();
#endif
load_codinglib();
lte_sync_time_init(frame_parms);
generate_ul_ref_sigs();
......@@ -61,11 +58,7 @@ void init_lte_top(LTE_DL_FRAME_PARMS *frame_parms)
void free_lte_top(void)
{
free_td8();
free_td16();
#ifdef __AVX2__
free_td16avx2();
#endif
free_codinglib();
lte_sync_time_free();
/* free_ul_ref_sigs() is called in phy_free_lte_eNB() */
......
......@@ -286,13 +286,13 @@ int dlsch_encoding_2threads0(te_params *tep) {
threegpplte_turbo_encoder(dlsch->harq_processes[harq_pid]->c[r],
Kr>>3,
&dlsch->harq_processes[harq_pid]->d[r][96],
(r==0) ? dlsch->harq_processes[harq_pid]->F : 0,
f1f2mat_old[iind*2], // f1 (see 36121-820, page 14)
f1f2mat_old[(iind*2)+1] // f2 (see 36121-820, page 14)
);
encoder(dlsch->harq_processes[harq_pid]->c[r],
Kr>>3,
&dlsch->harq_processes[harq_pid]->d[r][96],
(r==0) ? dlsch->harq_processes[harq_pid]->F : 0,
f1f2mat_old[iind*2], // f1 (see 36121-820, page 14)
f1f2mat_old[(iind*2)+1] // f2 (see 36121-820, page 14)
);
dlsch->harq_processes[harq_pid]->RTC[r] =
sub_block_interleaving_turbo(4+(Kr_bytes*8),
&dlsch->harq_processes[harq_pid]->d[r][96],
......@@ -458,13 +458,13 @@ int dlsch_encoding_2threads(PHY_VARS_eNB *eNB,
start_meas(te_stats);
threegpplte_turbo_encoder(dlsch->harq_processes[harq_pid]->c[r],
Kr>>3,
&dlsch->harq_processes[harq_pid]->d[r][96],
(r==0) ? dlsch->harq_processes[harq_pid]->F : 0,
f1f2mat_old[iind*2], // f1 (see 36121-820, page 14)
f1f2mat_old[(iind*2)+1] // f2 (see 36121-820, page 14)
);
encoder(dlsch->harq_processes[harq_pid]->c[r],
Kr>>3,
&dlsch->harq_processes[harq_pid]->d[r][96],
(r==0) ? dlsch->harq_processes[harq_pid]->F : 0,
f1f2mat_old[iind*2], // f1 (see 36121-820, page 14)
f1f2mat_old[(iind*2)+1] // f2 (see 36121-820, page 14)
);
stop_meas(te_stats);
start_meas(i_stats);
......@@ -651,13 +651,13 @@ int dlsch_encoding(PHY_VARS_eNB *eNB,
printf("Encoding ... iind %d f1 %d, f2 %d\n",iind,f1f2mat_old[iind*2],f1f2mat_old[(iind*2)+1]);
#endif
start_meas(te_stats);
threegpplte_turbo_encoder(dlsch->harq_processes[harq_pid]->c[r],
Kr>>3,
&dlsch->harq_processes[harq_pid]->d[r][96],
(r==0) ? dlsch->harq_processes[harq_pid]->F : 0,
f1f2mat_old[iind*2], // f1 (see 36121-820, page 14)
f1f2mat_old[(iind*2)+1] // f2 (see 36121-820, page 14)
);
encoder(dlsch->harq_processes[harq_pid]->c[r],
Kr>>3,
&dlsch->harq_processes[harq_pid]->d[r][96],
(r==0) ? dlsch->harq_processes[harq_pid]->F : 0,
f1f2mat_old[iind*2], // f1 (see 36121-820, page 14)
f1f2mat_old[(iind*2)+1] // f2 (see 36121-820, page 14)
);
stop_meas(te_stats);
#ifdef DEBUG_DLSCH_CODING
......@@ -833,13 +833,13 @@ int dlsch_encoding_SIC(PHY_VARS_UE *ue,
printf("Encoding ... iind %d f1 %d, f2 %d\n",iind,f1f2mat_old[iind*2],f1f2mat_old[(iind*2)+1]);
#endif
start_meas(te_stats);
threegpplte_turbo_encoder(dlsch->harq_processes[harq_pid]->c[r],
Kr>>3,
&dlsch->harq_processes[harq_pid]->d[r][96],
(r==0) ? dlsch->harq_processes[harq_pid]->F : 0,
f1f2mat_old[iind*2], // f1 (see 36121-820, page 14)
f1f2mat_old[(iind*2)+1] // f2 (see 36121-820, page 14)
);
encoder(dlsch->harq_processes[harq_pid]->c[r],
Kr>>3,
&dlsch->harq_processes[harq_pid]->d[r][96],
(r==0) ? dlsch->harq_processes[harq_pid]->F : 0,
f1f2mat_old[iind*2], // f1 (see 36121-820, page 14)
f1f2mat_old[(iind*2)+1] // f2 (see 36121-820, page 14)
);
stop_meas(te_stats);
#ifdef DEBUG_DLSCH_CODING
......
......@@ -39,7 +39,6 @@
//#define DEBUG_DLSCH_DECODING
//#define UE_DEBUG_TRACE 1
extern double cpuf;
void free_ue_dlsch(LTE_UE_DLSCH_t *dlsch)
{
......@@ -206,21 +205,7 @@ uint32_t dlsch_decoding(PHY_VARS_UE *phy_vars_ue,
time_stats_t *);
#endif
uint8_t (*tc)(int16_t *y,
uint8_t *,
uint16_t,
uint16_t,
uint16_t,
uint8_t,
uint8_t,
uint8_t,
time_stats_t *,
time_stats_t *,
time_stats_t *,
time_stats_t *,
time_stats_t *,
time_stats_t *,
time_stats_t *);
decoder_if_t tc;
......@@ -255,13 +240,13 @@ uint32_t dlsch_decoding(PHY_VARS_UE *phy_vars_ue,
#if 0
tc_2cw = phy_threegpplte_turbo_decoder16avx2;
#endif
tc = phy_threegpplte_turbo_decoder16;
tc = decoder16;
}
else
{
AssertFatal (harq_process->TBS >= 256 , "Mismatch flag nbRB=%d TBS=%d mcs=%d Qm=%d RIV=%d round=%d \n",
harq_process->nb_rb, harq_process->TBS,harq_process->mcs,harq_process->Qm,harq_process->rvidx,harq_process->round);
tc = phy_threegpplte_turbo_decoder8;
tc = decoder8;
}
......@@ -490,7 +475,9 @@ uint32_t dlsch_decoding(PHY_VARS_UE *phy_vars_ue,
LOG_D(PHY,"AbsSubframe %d.%d Start turbo segment %d/%d \n",frame%1024,subframe,r,harq_process->C-1);
ret = tc
(&harq_process->d[r][96],
NULL,
harq_process->c[r],
NULL,
Kr,
f1f2mat_old[iind*2],
f1f2mat_old[(iind*2)+1],
......
......@@ -371,13 +371,13 @@ uint32_t ulsch_encoding(uint8_t *a,
printf("Encoding ... iind %d f1 %d, f2 %d\n",iind,f1f2mat_old[iind*2],f1f2mat_old[(iind*2)+1]);
#endif
start_meas(te_stats);
threegpplte_turbo_encoder(ulsch->harq_processes[harq_pid]->c[r],
Kr>>3,
&ulsch->harq_processes[harq_pid]->d[r][96],
(r==0) ? ulsch->harq_processes[harq_pid]->F : 0,
f1f2mat_old[iind*2], // f1 (see 36212-820, page 14)
f1f2mat_old[(iind*2)+1] // f2 (see 36212-820, page 14)
);
encoder(ulsch->harq_processes[harq_pid]->c[r],
Kr>>3,
&ulsch->harq_processes[harq_pid]->d[r][96],
(r==0) ? ulsch->harq_processes[harq_pid]->F : 0,
f1f2mat_old[iind*2], // f1 (see 36212-820, page 14)
f1f2mat_old[(iind*2)+1] // f2 (see 36212-820, page 14)
);
stop_meas(te_stats);
#ifdef DEBUG_ULSCH_CODING
......
......@@ -242,27 +242,12 @@ int ulsch_decoding_data_2thread0(td_params* tdp) {
uint32_t E=0;
uint32_t Gp,GpmodC,Nl=1;
uint32_t C = ulsch_harq->C;
uint8_t (*tc)(int16_t *y,
uint8_t *,
uint16_t,
uint16_t,
uint16_t,
uint8_t,
uint8_t,
uint8_t,
time_stats_t *,
time_stats_t *,
time_stats_t *,
time_stats_t *,
time_stats_t *,
time_stats_t *,
time_stats_t *);
decoder_if_t tc;
if (llr8_flag == 0)
tc = phy_threegpplte_turbo_decoder16;
tc = decoder16;
else
tc = phy_threegpplte_turbo_decoder8;
tc = decoder8;
......@@ -385,7 +370,9 @@ int ulsch_decoding_data_2thread0(td_params* tdp) {
ret = tc(&ulsch_harq->d[r][96],
NULL,
ulsch_harq->c[r],
NULL,
Kr,
f1f2mat_old[iind*2],
f1f2mat_old[(iind*2)+1],
......@@ -463,22 +450,7 @@ int ulsch_decoding_data_2thread(PHY_VARS_eNB *eNB,int UE_id,int harq_pid,int llr
int G = ulsch_harq->G;
unsigned int E;
int Cby2;
uint8_t (*tc)(int16_t *y,
uint8_t *,
uint16_t,
uint16_t,
uint16_t,
uint8_t,
uint8_t,
uint8_t,
time_stats_t *,
time_stats_t *,
time_stats_t *,
time_stats_t *,
time_stats_t *,
time_stats_t *,
time_stats_t *);
decoder_if_t tc;
struct timespec wait;
......@@ -487,9 +459,9 @@ int ulsch_decoding_data_2thread(PHY_VARS_eNB *eNB,int UE_id,int harq_pid,int llr
if (llr8_flag == 0)
tc = phy_threegpplte_turbo_decoder16;
tc = decoder16;
else
tc = phy_threegpplte_turbo_decoder8;
tc = decoder8;
if (ulsch_harq->C>1) { // wakeup worker if more than 1 segment
if (pthread_mutex_timedlock(&proc->mutex_td,&wait) != 0) {
......@@ -608,7 +580,9 @@ int ulsch_decoding_data_2thread(PHY_VARS_eNB *eNB,int UE_id,int harq_pid,int llr
start_meas(&eNB->ulsch_turbo_decoding_stats);
ret = tc(&ulsch_harq->d[r][96],
NULL,
ulsch_harq->c[r],
NULL,
Kr,
f1f2mat_old[iind*2],
f1f2mat_old[(iind*2)+1],
......@@ -670,27 +644,12 @@ int ulsch_decoding_data(PHY_VARS_eNB *eNB,int UE_id,int harq_pid,int llr8_flag)
int G = ulsch_harq->G;
unsigned int E;
uint8_t (*tc)(int16_t *y,
uint8_t *,
uint16_t,
uint16_t,
uint16_t,
uint8_t,
uint8_t,
uint8_t,
time_stats_t *,
time_stats_t *,
time_stats_t *,
time_stats_t *,
time_stats_t *,
time_stats_t *,
time_stats_t *);
decoder_if_t tc;
if (llr8_flag == 0)
tc = phy_threegpplte_turbo_decoder16;
tc = *decoder16;
else
tc = phy_threegpplte_turbo_decoder8;
tc = *decoder8;
for (r=0; r<ulsch_harq->C; r++) {
......@@ -773,7 +732,9 @@ int ulsch_decoding_data(PHY_VARS_eNB *eNB,int UE_id,int harq_pid,int llr8_flag)
start_meas(&eNB->ulsch_turbo_decoding_stats);
ret = tc(&ulsch_harq->d[r][96],
NULL,
ulsch_harq->c[r],
NULL,
Kr,
f1f2mat_old[iind*2],
f1f2mat_old[(iind*2)+1],
......
......@@ -1461,6 +1461,53 @@ extern pthread_cond_t sync_cond;
extern pthread_mutex_t sync_mutex;
extern int sync_var;
#define MODE_DECODE_NONE 0
#define MODE_DECODE_SSE 1
#define MODE_DECODE_C 2
#define MODE_DECODE_AVX2 3
#define DECODE_INITTD8_SSE_FPTRIDX 0
#define DECODE_INITTD16_SSE_FPTRIDX 1
#define DECODE_INITTD_AVX2_FPTRIDX 2
#define DECODE_TD8_SSE_FPTRIDX 3
#define DECODE_TD16_SSE_FPTRIDX 4
#define DECODE_TD_C_FPTRIDX 5
#define DECODE_TD16_AVX2_FPTRIDX 6
#define DECODE_FREETD8_FPTRIDX 7
#define DECODE_FREETD16_FPTRIDX 8
#define DECODE_FREETD_AVX2_FPTRIDX 9
#define ENCODE_SSE_FPTRIDX 10
#define ENCODE_C_FPTRIDX 11
#define ENCODE_INIT_SSE_FPTRIDX 12
#define DECODE_NUM_FPTR 13
typedef uint8_t(*decoder_if_t)(int16_t *y,
int16_t *y2,
uint8_t *decoded_bytes,
uint8_t *decoded_bytes2,
uint16_t n,
uint16_t f1,
uint16_t f2,
uint8_t max_iterations,
uint8_t crc_type,
uint8_t F,
time_stats_t *init_stats,
time_stats_t *alpha_stats,
time_stats_t *beta_stats,
time_stats_t *gamma_stats,
time_stats_t *ext_stats,
time_stats_t *intl1_stats,
time_stats_t *intl2_stats);
typedef uint8_t(*encoder_if_t)(uint8_t *input,
uint16_t input_length_bytes,
uint8_t *output,
uint8_t F,
uint16_t interleaver_f1,
uint16_t interleaver_f2);
#define MAX_RRU_CONFIG_SIZE 1024
typedef enum {
RAU_tick=0,
......
......@@ -650,7 +650,7 @@ void uci_procedures(PHY_VARS_eNB *eNB,eNB_rxtx_proc_t *proc)
{
LTE_DL_FRAME_PARMS *fp=&eNB->frame_parms;
uint8_t SR_payload = 0,pucch_b0b1[4][2]= {{0,0},{0,0},{0,0},{0,0}},harq_ack[4]={0,0,0,0};
int32_t metric[4]={0,0,0,0},metric_SR=0,max_metric;
int32_t metric[4]={0,0,0,0},metric_SR=0,max_metric=0;
const int subframe = proc->subframe_rx;
const int frame = proc->frame_rx;
int i;
......
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.0 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file openair2/ENB_APP/L1_paramdef.f
* \brief definition of configuration parameters for all eNodeB modules
* \author Francois TABURET
* \date 2017
* \version 0.1
* \company NOKIA BellLabs France
* \email: francois.taburet@nokia-bell-labs.com
* \note
* \warning
*/
/*-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
/* L1 configuration parameters names */
#define CONFIG_STRING_L1_CC "num_cc"
#define CONFIG_STRING_L1_LOCAL_N_IF_NAME "local_n_if_name"
#define CONFIG_STRING_L1_LOCAL_N_ADDRESS "local_n_address"
#define CONFIG_STRING_L1_REMOTE_N_ADDRESS "remote_n_address"
#define CONFIG_STRING_L1_LOCAL_N_PORTC "local_n_portc"
#define CONFIG_STRING_L1_REMOTE_N_PORTC "remote_n_portc"
#define CONFIG_STRING_L1_LOCAL_N_PORTD "local_n_portd"
#define CONFIG_STRING_L1_REMOTE_N_PORTD "remote_n_portd"
#define CONFIG_STRING_L1_TRANSPORT_N_PREFERENCE "tr_n_preference"
/*----------------------------------------------------------------------------------------------------------------------------------------------------*/
/* L1 configuration parameters */
/* optname helpstr paramflags XXXptr defXXXval type numelt */
/*----------------------------------------------------------------------------------------------------------------------------------------------------*/
#define L1PARAMS_DESC { \
{CONFIG_STRING_L1_CC, NULL, 0, uptr:NULL, defintval:1, TYPE_UINT, 0}, \
{CONFIG_STRING_L1_TRANSPORT_N_PREFERENCE, NULL, 0, strptr:NULL, defstrval:"local_mac", TYPE_STRING, 0}, \
{CONFIG_STRING_L1_LOCAL_N_IF_NAME, NULL, 0, strptr:NULL, defstrval:"lo", TYPE_STRING, 0}, \
{CONFIG_STRING_L1_LOCAL_N_ADDRESS, NULL, 0, strptr:NULL, defstrval:"127.0.0.1", TYPE_STRING, 0}, \
{CONFIG_STRING_L1_REMOTE_N_ADDRESS, NULL, 0, strptr:NULL, defstrval:"127.0.0.2", TYPE_STRING, 0}, \
{CONFIG_STRING_L1_LOCAL_N_PORTC, NULL, 0, uptr:NULL, defintval:50030, TYPE_UINT, 0}, \
{CONFIG_STRING_L1_REMOTE_N_PORTC, NULL, 0, uptr:NULL, defintval:50030, TYPE_UINT, 0}, \
{CONFIG_STRING_L1_LOCAL_N_PORTD, NULL, 0, uptr:NULL, defintval:50031, TYPE_UINT, 0}, \
{CONFIG_STRING_L1_REMOTE_N_PORTD, NULL, 0, uptr:NULL, defintval:50031, TYPE_UINT, 0}, \
}
#define L1_CC_IDX 0
#define L1_TRANSPORT_N_PREFERENCE_IDX 1
#define L1_LOCAL_N_IF_NAME_IDX 2
#define L1_LOCAL_N_ADDRESS_IDX 3
#define L1_REMOTE_N_ADDRESS_IDX 4
#define L1_LOCAL_N_PORTC_IDX 5
#define L1_REMOTE_N_PORTC_IDX 6
#define L1_LOCAL_N_PORTD_IDX 7
#define L1_REMOTE_N_PORTD_IDX 8
/*----------------------------------------------------------------------------------------------------------------------------------------------------*/
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.0 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file openair2/ENB_APP/MACRLC_paramdef.f
* \brief definition of configuration parameters for all eNodeB modules
* \author Francois TABURET
* \date 2017
* \version 0.1
* \company NOKIA BellLabs France
* \email: francois.taburet@nokia-bell-labs.com
* \note
* \warning
*/
/*----------------------------------------------------------------------------------------------------------------------------------------------------*/
/* MACRLC configuration parameters names */
#define CONFIG_STRING_MACRLC_CC "num_cc"
#define CONFIG_STRING_MACRLC_TRANSPORT_N_PREFERENCE "tr_n_preference"
#define CONFIG_STRING_MACRLC_LOCAL_N_IF_NAME "local_n_if_name"
#define CONFIG_STRING_MACRLC_LOCAL_N_ADDRESS "local_n_address"
#define CONFIG_STRING_MACRLC_REMOTE_N_ADDRESS "remote_n_address"
#define CONFIG_STRING_MACRLC_LOCAL_N_PORTC "local_n_portc"
#define CONFIG_STRING_MACRLC_REMOTE_N_PORTC "remote_n_portc"
#define CONFIG_STRING_MACRLC_LOCAL_N_PORTD "local_n_portd"
#define CONFIG_STRING_MACRLC_REMOTE_N_PORTD "remote_n_portd"
#define CONFIG_STRING_MACRLC_TRANSPORT_S_PREFERENCE "tr_s_preference"
#define CONFIG_STRING_MACRLC_LOCAL_S_IF_NAME "local_s_if_name"
#define CONFIG_STRING_MACRLC_LOCAL_S_ADDRESS "local_s_address"
#define CONFIG_STRING_MACRLC_REMOTE_S_ADDRESS "remote_s_address"
#define CONFIG_STRING_MACRLC_LOCAL_S_PORTC "local_s_portc"
#define CONFIG_STRING_MACRLC_REMOTE_S_PORTC "remote_s_portc"
#define CONFIG_STRING_MACRLC_LOCAL_S_PORTD "local_s_portd"
#define CONFIG_STRING_MACRLC_REMOTE_S_PORTD "remote_s_portd"
/*-------------------------------------------------------------------------------------------------------------------------------------------------------*/
/* MacRLC configuration parameters */
/* optname helpstr paramflags XXXptr defXXXval type numelt */
/*-------------------------------------------------------------------------------------------------------------------------------------------------------*/
#define MACRLCPARAMS_DESC { \
{CONFIG_STRING_MACRLC_CC, NULL, 0, uptr:NULL, defintval:50011, TYPE_UINT, 0}, \
{CONFIG_STRING_MACRLC_TRANSPORT_N_PREFERENCE, NULL, 0, strptr:NULL, defstrval:"local_L1", TYPE_STRING, 0}, \
{CONFIG_STRING_MACRLC_LOCAL_N_IF_NAME, NULL, 0, strptr:NULL, defstrval:"lo", TYPE_STRING, 0}, \
{CONFIG_STRING_MACRLC_LOCAL_N_ADDRESS, NULL, 0, strptr:NULL, defstrval:"127.0.0.1", TYPE_STRING, 0}, \
{CONFIG_STRING_MACRLC_REMOTE_N_ADDRESS, NULL, 0, uptr:NULL, defstrval:"127.0.0.2", TYPE_STRING, 0}, \
{CONFIG_STRING_MACRLC_LOCAL_N_PORTC, NULL, 0, uptr:NULL, defintval:50010, TYPE_UINT, 0}, \
{CONFIG_STRING_MACRLC_REMOTE_N_PORTC, NULL, 0, uptr:NULL, defintval:50010, TYPE_UINT, 0}, \
{CONFIG_STRING_MACRLC_LOCAL_N_PORTD, NULL, 0, uptr:NULL, defintval:50011, TYPE_UINT, 0}, \
{CONFIG_STRING_MACRLC_REMOTE_N_PORTD, NULL, 0, uptr:NULL, defintval:50011, TYPE_UINT, 0}, \
{CONFIG_STRING_MACRLC_TRANSPORT_S_PREFERENCE, NULL, 0, strptr:NULL, defstrval:"local_RRC", TYPE_STRING, 0}, \
{CONFIG_STRING_MACRLC_LOCAL_S_IF_NAME, NULL, 0, strptr:NULL, defstrval:"lo", TYPE_STRING, 0}, \
{CONFIG_STRING_MACRLC_LOCAL_S_ADDRESS, NULL, 0, uptr:NULL, defstrval:"127.0.0.1", TYPE_STRING, 0}, \
{CONFIG_STRING_MACRLC_REMOTE_S_ADDRESS, NULL, 0, uptr:NULL, defstrval:"127.0.0.2", TYPE_STRING, 0}, \
{CONFIG_STRING_MACRLC_LOCAL_S_PORTC, NULL, 0, uptr:NULL, defintval:50020, TYPE_UINT, 0}, \
{CONFIG_STRING_MACRLC_REMOTE_S_PORTC, NULL, 0, uptr:NULL, defintval:50020, TYPE_UINT, 0}, \
{CONFIG_STRING_MACRLC_LOCAL_S_PORTD, NULL, 0, uptr:NULL, defintval:50021, TYPE_UINT, 0}, \
{CONFIG_STRING_MACRLC_REMOTE_S_PORTD, NULL, 0, uptr:NULL, defintval:50021, TYPE_UINT, 0}, \
}
#define MACRLC_CC_IDX 0
#define MACRLC_TRANSPORT_N_PREFERENCE_IDX 1
#define MACRLC_LOCAL_N_IF_NAME_IDX 2
#define MACRLC_LOCAL_N_ADDRESS_IDX 3
#define MACRLC_REMOTE_N_ADDRESS_IDX 4
#define MACRLC_LOCAL_N_PORTC_IDX 5
#define MACRLC_REMOTE_N_PORTC_IDX 6
#define MACRLC_LOCAL_N_PORTD_IDX 7
#define MACRLC_REMOTE_N_PORTD_IDX 8
#define MACRLC_TRANSPORT_S_PREFERENCE_IDX 9
#define MACRLC_LOCAL_S_IF_NAME_IDX 10
#define MACRLC_LOCAL_S_ADDRESS_IDX 11
#define MACRLC_REMOTE_S_ADDRESS_IDX 12
#define MACRLC_LOCAL_S_PORTC_IDX 13
#define MACRLC_REMOTE_S_PORTC_IDX 14
#define MACRLC_LOCAL_S_PORTD_IDX 15
#define MACRLC_REMOTE_S_PORTD_IDX 16
/*---------------------------------------------------------------------------------------------------------------------------------------------------------*/
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*
RRC_config_tools.c
-------------------
AUTHOR : Francois TABURET
COMPANY : NOKIA BellLabs France
EMAIL : francois.taburet@nokia-bell-labs.com
*/
#include <string.h>
#include <inttypes.h>
#include "log.h"
#include "log_extern.h"
#include "assertions.h"
#if defined(ENABLE_ITTI)
# include "intertask_interface.h"
# if defined(ENABLE_USE_MME)
# include "s1ap_eNB.h"
# include "sctp_eNB_task.h"
# endif
#endif
#include "SystemInformationBlockType2.h"
#include "common/config/config_userapi.h"
#include "RRC_config_tools.h"
#include "DL-GapConfig-NB-r13.h"
#include "NPRACH-Parameters-NB-r13.h"
static const eutra_band_t eutra_bands[] = {
{ 1, 1920 * MHz, 1980 * MHz, 2110 * MHz, 2170 * MHz, FDD},
{ 2, 1850 * MHz, 1910 * MHz, 1930 * MHz, 1990 * MHz, FDD},
{ 3, 1710 * MHz, 1785 * MHz, 1805 * MHz, 1880 * MHz, FDD},
{ 4, 1710 * MHz, 1755 * MHz, 2110 * MHz, 2155 * MHz, FDD},
{ 5, 824 * MHz, 849 * MHz, 869 * MHz, 894 * MHz, FDD},
{ 6, 830 * MHz, 840 * MHz, 875 * MHz, 885 * MHz, FDD},
{ 7, 2500 * MHz, 2570 * MHz, 2620 * MHz, 2690 * MHz, FDD},
{ 8, 880 * MHz, 915 * MHz, 925 * MHz, 960 * MHz, FDD},
{ 9, 1749900 * KHz, 1784900 * KHz, 1844900 * KHz, 1879900 * KHz, FDD},
{10, 1710 * MHz, 1770 * MHz, 2110 * MHz, 2170 * MHz, FDD},
{11, 1427900 * KHz, 1452900 * KHz, 1475900 * KHz, 1500900 * KHz, FDD},
{12, 698 * MHz, 716 * MHz, 728 * MHz, 746 * MHz, FDD},
{13, 777 * MHz, 787 * MHz, 746 * MHz, 756 * MHz, FDD},
{14, 788 * MHz, 798 * MHz, 758 * MHz, 768 * MHz, FDD},
{17, 704 * MHz, 716 * MHz, 734 * MHz, 746 * MHz, FDD},
{20, 832 * MHz, 862 * MHz, 791 * MHz, 821 * MHz, FDD},
{33, 1900 * MHz, 1920 * MHz, 1900 * MHz, 1920 * MHz, TDD},
{33, 1900 * MHz, 1920 * MHz, 1900 * MHz, 1920 * MHz, TDD},
{34, 2010 * MHz, 2025 * MHz, 2010 * MHz, 2025 * MHz, TDD},
{35, 1850 * MHz, 1910 * MHz, 1850 * MHz, 1910 * MHz, TDD},
{36, 1930 * MHz, 1990 * MHz, 1930 * MHz, 1990 * MHz, TDD},
{37, 1910 * MHz, 1930 * MHz, 1910 * MHz, 1930 * MHz, TDD},
{38, 2570 * MHz, 2620 * MHz, 2570 * MHz, 2630 * MHz, TDD},
{39, 1880 * MHz, 1920 * MHz, 1880 * MHz, 1920 * MHz, TDD},
{40, 2300 * MHz, 2400 * MHz, 2300 * MHz, 2400 * MHz, TDD},
{41, 2496 * MHz, 2690 * MHz, 2496 * MHz, 2690 * MHz, TDD},
{42, 3400 * MHz, 3600 * MHz, 3400 * MHz, 3600 * MHz, TDD},
{43, 3600 * MHz, 3800 * MHz, 3600 * MHz, 3800 * MHz, TDD},
{44, 703 * MHz, 803 * MHz, 703 * MHz, 803 * MHz, TDD},
};
int config_check_band_frequencies( int ind,
int16_t band,
uint32_t downlink_frequency,
int32_t uplink_frequency_offset,
uint32_t frame_type)
{
int errors = 0;
if (band > 0) {
int band_index;
for (band_index = 0; band_index < sizeof (eutra_bands) / sizeof (eutra_bands[0]); band_index++) {
if (band == eutra_bands[band_index].band) {
uint32_t uplink_frequency = downlink_frequency + uplink_frequency_offset;
AssertError (eutra_bands[band_index].dl_min < downlink_frequency, errors ++,
"enb %d downlink frequency %u too low (%u) for band %d!",
ind, downlink_frequency, eutra_bands[band_index].dl_min, band);
AssertError (downlink_frequency < eutra_bands[band_index].dl_max, errors ++,
"enb %d downlink frequency %u too high (%u) for band %d!",
ind, downlink_frequency, eutra_bands[band_index].dl_max, band);
AssertError (eutra_bands[band_index].ul_min < uplink_frequency, errors ++,
"enb %d uplink frequency %u too low (%u) for band %d!",
ind, uplink_frequency, eutra_bands[band_index].ul_min, band);
AssertError (uplink_frequency < eutra_bands[band_index].ul_max, errors ++,
"enb %d uplink frequency %u too high (%u) for band %d!",
ind, uplink_frequency, eutra_bands[band_index].ul_max, band);
AssertError (eutra_bands[band_index].frame_type == frame_type, errors ++,
"enb %d invalid frame type (%d/%d) for band %d!",
ind, eutra_bands[band_index].frame_type, frame_type, band);
}
}
}
return errors;
}
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*
RRC_config_tools.h
-------------------
AUTHOR : Francois TABURET
COMPANY : NOKIA BellLabs France
EMAIL : francois.taburet@nokia-bell-labs.com
*/
#ifndef RRC_CONFIG_TOOLS_H_
#define RRC_CONFIG_TOOLS_H_
#define KHz (1000UL)
#define MHz (1000 * KHz)
typedef struct eutra_band_s {
int16_t band;
uint32_t ul_min;
uint32_t ul_max;
uint32_t dl_min;
uint32_t dl_max;
lte_frame_type_t frame_type;
} eutra_band_t;
extern int config_check_band_frequencies(int ind, int16_t band, uint32_t downlink_frequency,
int32_t uplink_frequency_offset, uint32_t frame_type);
extern int config_check_assign_DLGap_NB(paramdef_t *param);
extern int config_check_assign_rach_NB(paramdef_t *param);
#endif
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.0 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*! \file openair2/ENB_APP/RRC_paramsvalues.h
* \brief macro definitions for RRC authorized and asn1 parameters values, to be used in paramdef_t/chechedparam_t structure initializations
* \author Francois TABURET
* \date 2017
* \version 0.1
* \company NOKIA BellLabs France
* \email: francois.taburet@nokia-bell-labs.com
* \note
* \warning
*/
#ifndef __RRC_PARAMSVALUES__H__
#define __RRC_PARAMSVALUES__H__
/* cell configuration section name */
#define ENB_CONFIG_STRING_ENB_LIST "eNBs"
/* component carriers configuration section name */
#define ENB_CONFIG_STRING_COMPONENT_CARRIERS "component_carriers"
#define ENB_CONFIG_STRING_FRAME_TYPE "frame_type"
#define ENB_CONFIG_STRING_PBCH_REPETITION "pbch_repetition"
#define ENB_CONFIG_STRING_TDD_CONFIG "tdd_config"
#define ENB_CONFIG_STRING_TDD_CONFIG_S "tdd_config_s"
#define ENB_CONFIG_STRING_PREFIX_TYPE "prefix_type"
#define ENB_CONFIG_STRING_PREFIX_TYPE_UL "prefix_type_UL"
#define ENB_CONFIG_STRING_EUTRA_BAND "eutra_band"
#define ENB_CONFIG_STRING_DOWNLINK_FREQUENCY "downlink_frequency"
#define ENB_CONFIG_STRING_UPLINK_FREQUENCY_OFFSET "uplink_frequency_offset"
#define ENB_CONFIG_STRING_NID_CELL "Nid_cell"
#define ENB_CONFIG_STRING_N_RB_DL "N_RB_DL"
#define ENB_CONFIG_STRING_CELL_MBSFN "Nid_cell_mbsfn"
#define FRAMETYPE_OKVALUES {"FDD","TDD"}
#define FRAMETYPE_MODVALUES { FDD, TDD}
#define TDDCFG(A) TDD_Config__subframeAssignment_ ## A
#define TDDCONFIG_OKRANGE { TDDCFG(sa0), TDDCFG(sa6)}
#define TDDCFGS(A) TDD_Config__specialSubframePatterns_ ## A
#define TDDCONFIGS_OKRANGE { TDDCFGS(ssp0), TDDCFGS(ssp8)}
#define PREFIX_OKVALUES {"NORMAL","EXTENDED"}
#define PREFIX_MODVALUES { NORMAL, EXTENDED}
#define PREFIXUL_OKVALUES {"NORMAL","EXTENDED"}
#define PREFIXUL_MODVALUES { NORMAL, EXTENDED}
#define NRBDL_OKVALUES {6,15,25,50,75,100}
#define UETIMER_T300_OKVALUES {100,200,300,400,600,1000,1500,2000}
#define UETT300(A) UE_TimersAndConstants__t300_ ## A
#define UETIMER_T300_MODVALUES { UETT300(ms100), UETT300(ms200),UETT300(ms300),UETT300(ms400),UETT300(ms600),UETT300(ms1000),UETT300(ms1500),UETT300(ms2000)}
#define UETIMER_T301_OKVALUES {100,200,300,400,600,1000,1500,2000}
#define UETT301(A) UE_TimersAndConstants__t301_ ## A
#define UETIMER_T301_MODVALUES { UETT301(ms100), UETT301(ms200),UETT301(ms300),UETT301(ms400),UETT301(ms600),UETT301(ms1000),UETT301(ms1500),UETT301(ms2000)}
#define UETIMER_T310_OKVALUES {0,50,100,200,500,1000,2000}
#define UETT310(A) UE_TimersAndConstants__t310_ ## A
#define UETIMER_T310_MODVALUES { UETT310(ms0), UETT310(ms50),UETT310(ms100),UETT310(ms200),UETT310(ms500),UETT310(ms1000),UETT310(ms2000)}
#define UETIMER_T311_OKVALUES {1000,3110,5000,10000,15000,20000,31100}
#define UETT311(A) UE_TimersAndConstants__t311_ ## A
#define UETIMER_T311_MODVALUES { UETT311(ms1000), UETT311(ms3000),UETT311(ms5000),UETT311(ms10000),UETT311(ms15000),UETT311(ms20000),UETT311(ms30000)}
#define UETIMER_N310_OKVALUES {1,2,3,4,6,8,10,20}
#define UETN310(A) UE_TimersAndConstants__n310_ ## A
#define UETIMER_N310_MODVALUES { UETN310(n1), UETN310(n2),UETN310(n3),UETN310(n4),UETN310(n6),UETN310(n8),UETN310(n10),UETN310(n20)}
#define UETIMER_N311_OKVALUES {1,2,3,4,5,6,8,10}
#define UETN311(A) UE_TimersAndConstants__n311_ ## A
#define UETIMER_N311_MODVALUES { UETN311(n1), UETN311(n2),UETN311(n3),UETN311(n4),UETN311(n5),UETN311(n6),UETN311(n8),UETN311(n10)}
#endif
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*
nbiot_config.h
-------------------
AUTHOR : Francois Taburet
COMPANY : NOKIA
EMAIL : francois.taburet@nokia-bell-labs.com
*/
#ifndef INCLUDE_NBIOT_CONFIG_H
#define INCLUDE_NBIOT_CONFIG_H
extern void RCconfig_NbIoTL1(void) ;
extern void RCconfig_NbIoTmacrlc(void);
extern int RCconfig_NbIoTRRC(MessageDef *msg_p, int nbiotrrc_id,eNB_RRC_INST_NB_IoT *nbiotrrc);
extern void RCConfig_NbIoT(RAN_CONTEXT_t *RC);
#endif
This diff is collapsed.
......@@ -34,6 +34,7 @@
#define COMPONENT_LOG
#define COMPONENT_LOG_IF
#include <ctype.h>
#define LOG_MAIN
#include "log.h"
#include "vcd_signal_dumper.h"
#include "assertions.h"
......@@ -46,7 +47,7 @@
# include <string.h>
#include "common/config/config_userapi.h"
// main log variables
log_t *g_log;
mapping log_level_names[] = {
{"emerg", LOG_EMERG},
......@@ -1562,7 +1563,7 @@ int set_log(int component, int level, int interval)
component, MIN_LOG_COMPONENTS, MAX_LOG_COMPONENTS);
DevCheck((level <= LOG_TRACE) && (level >= LOG_EMERG), level, LOG_TRACE,
LOG_EMERG);
DevCheck((interval > 0) && (interval <= 0xFF), interval, 0, 0xFF);
DevCheck((interval >= 0) && (interval <= 0xFF), interval, 0, 0xFF);
g_log->log_component[component].level = level;
......@@ -1596,7 +1597,7 @@ int set_comp_log(int component, int level, int verbosity, int interval)
component, MIN_LOG_COMPONENTS, MAX_LOG_COMPONENTS);
DevCheck((level <= LOG_TRACE) && (level >= LOG_EMERG), level, LOG_TRACE,
LOG_EMERG);
DevCheck((interval > 0) && (interval <= 0xFF), interval, 0, 0xFF);
DevCheck((interval >= 0) && (interval <= 0xFF), interval, 0, 0xFF);
#if 0
if ((verbosity == LOG_NONE) || (verbosity == LOG_LOW) ||
......
......@@ -253,7 +253,17 @@ typedef enum log_instance_type_e {
void log_set_instance_type (log_instance_type_t instance);
#endif
#ifdef LOG_MAIN
log_t *g_log;
#else
#ifdef __cplusplus
extern "C" {
#endif
extern log_t *g_log;
#ifdef __cplusplus
}
#endif
#endif
/*--- INCLUDES ---------------------------------------------------------------*/
# include "log_if.h"
/*----------------------------------------------------------------------------*/
......@@ -279,9 +289,9 @@ void *log_thread_function(void * list);
* @brief Macro used to call tr_log_full_ex with file, function and line information
* @{*/
#ifdef LOG_NO_THREAD
#define logIt(component, level, format, args...) logRecord_mt(__FILE__, __FUNCTION__, __LINE__, component, level, format, ##args)
#define logIt(component, level, format, args...) (g_log->log_component[component].interval?logRecord_mt(__FILE__, __FUNCTION__, __LINE__, component, level, format, ##args):(void)0)
#else //default
#define logIt(component, level, format, args...) logRecord(__FILE__, __FUNCTION__, __LINE__, component, level, format, ##args)
#define logIt(component, level, format, args...) (g_log->log_component[component].interval?logRecord(__FILE__, __FUNCTION__, __LINE__, component, level, format, ##args):(void)0)
#endif
/* @}*/
......
......@@ -36,6 +36,7 @@
#include <string.h>
#include "common_lib.h"
#include "common/utils/load_module_shlib.h"
int set_device(openair0_device *device) {
......@@ -85,52 +86,26 @@ int set_transport(openair0_device *device) {
}
}
typedef int(*devfunc_t)(openair0_device *, openair0_config_t *, eth_params_t *);
/* look for the interface library and load it */
int load_lib(openair0_device *device, openair0_config_t *openair0_cfg, eth_params_t * cfg, uint8_t flag) {
void *lib_handle;
oai_device_initfunc_t dp ;
oai_transport_initfunc_t tp ;
loader_shlibfunc_t shlib_fdesc[1];
int ret=0;
char *libname;
if (flag == RAU_LOCAL_RADIO_HEAD) {
lib_handle = dlopen(OAI_RF_LIBNAME, RTLD_LAZY);
if (!lib_handle) {
fprintf(stderr,"Unable to locate %s: HW device set to NONE_DEV.\n", OAI_RF_LIBNAME);
fprintf(stderr,"%s\n",dlerror());
return -1;
}
dp = dlsym(lib_handle,"device_init");
if (dp != NULL ) {
ret = dp(device,openair0_cfg);
if (ret<0) {
fprintf(stderr, "%s %d:oai device intialization failed %s\n", __FILE__, __LINE__, dlerror());
}
} else {
fprintf(stderr, "%s %d:oai device intializing function not found %s\n", __FILE__, __LINE__, dlerror());
return -1;
}
libname=OAI_RF_LIBNAME;
shlib_fdesc[0].fname="device_init";
} else {
lib_handle = dlopen(OAI_TP_LIBNAME, RTLD_LAZY);
if (!lib_handle) {
printf( "Unable to locate %s: transport protocol set to NONE_TP.\n", OAI_TP_LIBNAME);
printf( "%s\n",dlerror());
return -1;
}
tp = dlsym(lib_handle,"transport_init");
if (tp != NULL ) {
tp(device,openair0_cfg,cfg);
} else {
fprintf(stderr, "%s %d:oai device intializing function not found %s\n", __FILE__, __LINE__, dlerror());
return -1;
}
libname=OAI_TP_LIBNAME;
shlib_fdesc[0].fname="transport_init";
}
ret=load_module_shlib(libname,shlib_fdesc,1);
if (ret < 0) {
fprintf(stderr,"Library %s couldn't be loaded\n",libname);
} else {
ret=((devfunc_t)shlib_fdesc[0].fptr)(device,openair0_cfg,cfg);
}
return ret;
}
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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