Merge remote-tracking branch 'eurecom/develop' into episys/master-nsa
This commit is contained in:
@@ -34,6 +34,8 @@
|
||||
#include "assertions.h"
|
||||
#include "nr_common.h"
|
||||
|
||||
const char *duplex_mode[]={"FDD","TDD"};
|
||||
|
||||
// Table 5.2-1 NR operating bands in FR1 & FR2 (3GPP TS 38.101)
|
||||
// Table 5.4.2.3-1 Applicable NR-ARFCN per operating band in FR1 & FR2 (3GPP TS 38.101)
|
||||
// Notes:
|
||||
@@ -249,6 +251,176 @@ int get_dmrs_port(int nl, uint16_t dmrs_ports) {
|
||||
return p;
|
||||
}
|
||||
|
||||
int get_num_dmrs(uint16_t dmrs_mask ) {
|
||||
|
||||
int num_dmrs=0;
|
||||
|
||||
for (int i=0;i<16;i++) num_dmrs+=((dmrs_mask>>i)&1);
|
||||
return(num_dmrs);
|
||||
}
|
||||
|
||||
lte_frame_type_t get_frame_type(uint16_t current_band, uint8_t scs_index)
|
||||
{
|
||||
lte_frame_type_t current_type;
|
||||
int32_t delta_duplex = get_delta_duplex(current_band, scs_index);
|
||||
|
||||
if (delta_duplex == 0)
|
||||
current_type = TDD;
|
||||
else
|
||||
current_type = FDD;
|
||||
|
||||
LOG_I(NR_MAC, "NR band %d, duplex mode %s, duplex spacing = %d KHz\n", current_band, duplex_mode[current_type], delta_duplex);
|
||||
|
||||
return current_type;
|
||||
}
|
||||
|
||||
// Computes the duplex spacing (either positive or negative) in KHz
|
||||
int32_t get_delta_duplex(int nr_bandP, uint8_t scs_index)
|
||||
{
|
||||
int nr_table_idx = get_nr_table_idx(nr_bandP, scs_index);
|
||||
|
||||
int32_t delta_duplex = (nr_bandtable[nr_table_idx].ul_min - nr_bandtable[nr_table_idx].dl_min);
|
||||
|
||||
LOG_I(NR_MAC, "NR band duplex spacing is %d KHz (nr_bandtable[%d].band = %d)\n", delta_duplex, nr_table_idx, nr_bandtable[nr_table_idx].band);
|
||||
|
||||
return delta_duplex;
|
||||
}
|
||||
|
||||
uint16_t config_bandwidth(int mu, int nb_rb, int nr_band)
|
||||
{
|
||||
|
||||
if (nr_band < 100) { //FR1
|
||||
switch(mu) {
|
||||
case 0 :
|
||||
if (nb_rb<=25)
|
||||
return 5;
|
||||
if (nb_rb<=52)
|
||||
return 10;
|
||||
if (nb_rb<=79)
|
||||
return 15;
|
||||
if (nb_rb<=106)
|
||||
return 20;
|
||||
if (nb_rb<=133)
|
||||
return 25;
|
||||
if (nb_rb<=160)
|
||||
return 30;
|
||||
if (nb_rb<=216)
|
||||
return 40;
|
||||
if (nb_rb<=270)
|
||||
return 50;
|
||||
AssertFatal(1==0,"Number of DL resource blocks %d undefined for mu %d and band %d\n", nb_rb, mu, nr_band);
|
||||
break;
|
||||
case 1 :
|
||||
if (nb_rb<=11)
|
||||
return 5;
|
||||
if (nb_rb<=24)
|
||||
return 10;
|
||||
if (nb_rb<=38)
|
||||
return 15;
|
||||
if (nb_rb<=51)
|
||||
return 20;
|
||||
if (nb_rb<=65)
|
||||
return 25;
|
||||
if (nb_rb<=78)
|
||||
return 30;
|
||||
if (nb_rb<=106)
|
||||
return 40;
|
||||
if (nb_rb<=133)
|
||||
return 50;
|
||||
if (nb_rb<=162)
|
||||
return 60;
|
||||
if (nb_rb<=189)
|
||||
return 70;
|
||||
if (nb_rb<=217)
|
||||
return 80;
|
||||
if (nb_rb<=245)
|
||||
return 90;
|
||||
if (nb_rb<=273)
|
||||
return 100;
|
||||
AssertFatal(1==0,"Number of DL resource blocks %d undefined for mu %d and band %d\n", nb_rb, mu, nr_band);
|
||||
break;
|
||||
case 2 :
|
||||
if (nb_rb<=11)
|
||||
return 10;
|
||||
if (nb_rb<=18)
|
||||
return 15;
|
||||
if (nb_rb<=24)
|
||||
return 20;
|
||||
if (nb_rb<=31)
|
||||
return 25;
|
||||
if (nb_rb<=38)
|
||||
return 30;
|
||||
if (nb_rb<=51)
|
||||
return 40;
|
||||
if (nb_rb<=65)
|
||||
return 50;
|
||||
if (nb_rb<=79)
|
||||
return 60;
|
||||
if (nb_rb<=93)
|
||||
return 70;
|
||||
if (nb_rb<=107)
|
||||
return 80;
|
||||
if (nb_rb<=121)
|
||||
return 90;
|
||||
if (nb_rb<=135)
|
||||
return 100;
|
||||
AssertFatal(1==0,"Number of DL resource blocks %d undefined for mu %d and band %d\n", nb_rb, mu, nr_band);
|
||||
break;
|
||||
default:
|
||||
AssertFatal(1==0,"Numerology %d undefined for band %d in FR1\n", mu,nr_band);
|
||||
}
|
||||
}
|
||||
else {
|
||||
switch(mu) {
|
||||
case 2 :
|
||||
if (nb_rb<=66)
|
||||
return 50;
|
||||
if (nb_rb<=132)
|
||||
return 100;
|
||||
if (nb_rb<=264)
|
||||
return 200;
|
||||
AssertFatal(1==0,"Number of DL resource blocks %d undefined for mu %d and band %d\n", nb_rb, mu, nr_band);
|
||||
break;
|
||||
case 3 :
|
||||
if (nb_rb<=32)
|
||||
return 50;
|
||||
if (nb_rb<=66)
|
||||
return 100;
|
||||
if (nb_rb<=132)
|
||||
return 200;
|
||||
if (nb_rb<=264)
|
||||
return 400;
|
||||
AssertFatal(1==0,"Number of DL resource blocks %d undefined for mu %d and band %d\n", nb_rb, mu, nr_band);
|
||||
break;
|
||||
default:
|
||||
AssertFatal(1==0,"Numerology %d undefined for band %d in FR1\n", mu,nr_band);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Returns the corresponding row index of the NR table
|
||||
int get_nr_table_idx(int nr_bandP, uint8_t scs_index) {
|
||||
int i, j;
|
||||
int scs_khz = 15 << scs_index;
|
||||
int supplementary_bands[] = {29,75,76,80,81,82,83,84,86,89,95};
|
||||
size_t s = sizeof(supplementary_bands)/sizeof(supplementary_bands[0]);
|
||||
|
||||
for(j = 0; j < s; j++){
|
||||
if (nr_bandP == supplementary_bands[j])
|
||||
AssertFatal(0 == 1, "Band %d is a supplementary band (%d). This is not supported yet.\n", nr_bandP, supplementary_bands[j]);
|
||||
}
|
||||
|
||||
AssertFatal(nr_bandP <= nr_bandtable[nr_bandtable_size-1].band, "NR band %d exceeds NR bands table maximum limit %d\n", nr_bandP, nr_bandtable[nr_bandtable_size-1].band);
|
||||
for (i = 0; i < nr_bandtable_size && nr_bandtable[i].band != nr_bandP; i++);
|
||||
|
||||
// selection of correct Deltaf raster according to SCS
|
||||
if ((nr_bandtable[i].deltaf_raster != 100) && (nr_bandtable[i].deltaf_raster != scs_khz))
|
||||
i++;
|
||||
|
||||
LOG_D(PHY, "NR band table index %d (Band %d, dl_min %lu, ul_min %lu)\n", i, nr_bandtable[i].band, nr_bandtable[i].dl_min,nr_bandtable[i].ul_min);
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
int get_subband_size(int NPRB,int size) {
|
||||
// implements table 5.2.1.4-2 from 36.214
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
|
||||
#include <stdint.h>
|
||||
#include "assertions.h"
|
||||
#include "PHY/defs_common.h"
|
||||
|
||||
typedef struct nr_bandentry_s {
|
||||
int16_t band;
|
||||
@@ -50,6 +51,11 @@ typedef struct nr_bandentry_s {
|
||||
extern const size_t nr_bandtable_size;
|
||||
extern nr_bandentry_t nr_bandtable[];
|
||||
|
||||
int get_num_dmrs(uint16_t dmrs_mask);
|
||||
uint16_t config_bandwidth(int mu, int nb_rb, int nr_band);
|
||||
int get_nr_table_idx(int nr_bandP, uint8_t scs_index);
|
||||
int32_t get_delta_duplex(int nr_bandP, uint8_t scs_index);
|
||||
lte_frame_type_t get_frame_type(uint16_t nr_bandP, uint8_t scs_index);
|
||||
uint16_t get_band(uint64_t downlink_frequency, int32_t delta_duplex);
|
||||
int NRRIV2BW(int locationAndBandwidth,int N_RB);
|
||||
int NRRIV2PRBOFFSET(int locationAndBandwidth,int N_RB);
|
||||
|
||||
@@ -51,6 +51,7 @@
|
||||
#include <dlfcn.h>
|
||||
#include <sys/time.h>
|
||||
#include <sys/resource.h>
|
||||
#include <form.h>
|
||||
#include "common/utils/load_module_shlib.h"
|
||||
#include "common/config/config_userapi.h"
|
||||
#include "common/utils/threadPool/thread-pool.h"
|
||||
@@ -62,34 +63,27 @@
|
||||
#include "telnetsrv_proccmd.h"
|
||||
static char *telnet_defstatmod[] = {"softmodem","phy","loader","measur"};
|
||||
static telnetsrv_params_t telnetparams;
|
||||
#define TELNETSRV_LISTENADDR 0
|
||||
#define TELNETSRV_LISTENPORT 1
|
||||
#define TELNETSRV_PRIORITY 2
|
||||
#define TELNETSRV_DEBUG 3
|
||||
#define TELNETSRV_LOOPC 4
|
||||
#define TELNETSRV_LOOPD 5
|
||||
#define TELNETSRV_HISFILE 6
|
||||
#define TELNETSRV_HISSIZE 7
|
||||
#define TELNETSRV_PHYBSIZE 8
|
||||
#define TELNETSRV_STATICMOD 9
|
||||
#define TELNETSRV_SHRMOD 10
|
||||
|
||||
#define TELNETSRV_OPTNAME_STATICMOD "staticmod"
|
||||
#define TELNETSRV_OPTNAME_SHRMOD "shrmod"
|
||||
|
||||
paramdef_t telnetoptions[] = {
|
||||
/*--------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
/* configuration parameters for telnet utility */
|
||||
/* optname helpstr paramflags XXXptr defXXXval type numelt */
|
||||
/*--------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
{"listenaddr", "<listen ip address>\n", 0, uptr:&telnetparams.listenaddr, defstrval:"0.0.0.0", TYPE_IPV4ADDR, 0 },
|
||||
{"listenport", "<local port>\n", 0, uptr:&(telnetparams.listenport), defuintval:9090, TYPE_UINT, 0 },
|
||||
{"priority", "<scheduling policy (0-99)\n", 0, iptr:&telnetparams.priority, defuintval:0, TYPE_INT, 0 },
|
||||
{"debug", "<debug level>\n", 0, uptr:NULL, defuintval:0, TYPE_UINT, 0 },
|
||||
{"loopcount", "<loop command iterations>\n", 0, uptr:&(telnetparams.loopcount), defuintval:10, TYPE_UINT, 0 },
|
||||
{"loopdelay", "<loop command delay (ms)>\n", 0, uptr:&(telnetparams.loopdelay), defuintval:5000, TYPE_UINT, 0 },
|
||||
{"histfile", "<history file name>\n", PARAMFLAG_NOFREE, strptr:&(telnetparams.histfile), defstrval:"oaitelnet.history", TYPE_STRING, 0 },
|
||||
{"histsize", "<history sizes>\n", 0, iptr:&(telnetparams.histsize), defuintval:50, TYPE_INT, 0 },
|
||||
{"phypbsize", "<phy dump buff size (bytes)>\n",0, uptr:&(telnetparams.phyprntbuff_size),defuintval:65000, TYPE_UINT, 0 },
|
||||
{"staticmod", "<static modules selection>\n", 0, strlistptr:NULL, defstrlistval:telnet_defstatmod,TYPE_STRINGLIST,(sizeof(telnet_defstatmod)/sizeof(char *))},
|
||||
{"shrmod", "<dynamic modules selection>\n", 0, strlistptr:NULL, defstrlistval:NULL,TYPE_STRINGLIST,0 }
|
||||
/*-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
/* configuration parameters for telnet utility */
|
||||
/* optname helpstr paramflags XXXptr defXXXval type numelt */
|
||||
/*-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/
|
||||
{"listenaddr", "<listen ip address>\n", 0, uptr:&telnetparams.listenaddr, defstrval:"0.0.0.0", TYPE_IPV4ADDR, 0 },
|
||||
{"listenport", "<local port>\n", 0, uptr:&(telnetparams.listenport), defuintval:9090, TYPE_UINT, 0 },
|
||||
{"listenstdin", "enable input from stdin\n", PARAMFLAG_BOOL, uptr:&(telnetparams.listenstdin), defuintval:0, TYPE_UINT, 0 },
|
||||
{"priority", "<scheduling policy (0-99)\n", 0, iptr:&telnetparams.priority, defuintval:0, TYPE_INT, 0 },
|
||||
{"debug", "<debug level>\n", 0, uptr:NULL, defuintval:0, TYPE_UINT, 0 },
|
||||
{"loopcount", "<loop command iterations>\n", 0, uptr:&(telnetparams.loopcount), defuintval:10, TYPE_UINT, 0 },
|
||||
{"loopdelay", "<loop command delay (ms)>\n", 0, uptr:&(telnetparams.loopdelay), defuintval:5000, TYPE_UINT, 0 },
|
||||
{"histfile", "<history file name>\n", PARAMFLAG_NOFREE, strptr:&(telnetparams.histfile), defstrval:"oaitelnet.history", TYPE_STRING, 0 },
|
||||
{"histsize", "<history sizes>\n", 0, iptr:&(telnetparams.histsize), defuintval:50, TYPE_INT, 0 },
|
||||
{"phypbsize", "<phy dump buff size (bytes)>\n",0, uptr:&(telnetparams.phyprntbuff_size),defuintval:65000, TYPE_UINT, 0 },
|
||||
{TELNETSRV_OPTNAME_STATICMOD, "<static modules selection>\n", 0, strlistptr:NULL, defstrlistval:telnet_defstatmod,TYPE_STRINGLIST,(sizeof(telnet_defstatmod)/sizeof(char *))},
|
||||
{TELNETSRV_OPTNAME_SHRMOD, "<dynamic modules selection>\n", 0, strlistptr:NULL, defstrlistval:NULL,TYPE_STRINGLIST,0 }
|
||||
};
|
||||
|
||||
int get_phybsize(void) {
|
||||
@@ -682,6 +676,77 @@ void run_telnetsrv(void) {
|
||||
return;
|
||||
}
|
||||
|
||||
void run_telnetclt(void) {
|
||||
int sock;
|
||||
struct sockaddr_in name;
|
||||
pthread_setname_np(pthread_self(), "telnetclt");
|
||||
set_sched(pthread_self(),0,telnetparams.priority);
|
||||
char prompt[sizeof(TELNET_PROMPT_PREFIX)+10];
|
||||
sprintf(prompt,"%s_%s> ",TELNET_PROMPT_PREFIX,get_softmodem_function(NULL));
|
||||
name.sin_family = AF_INET;
|
||||
struct in_addr addr;
|
||||
inet_aton("127.0.0.1", &addr) ;
|
||||
name.sin_addr.s_addr = addr.s_addr;
|
||||
name.sin_port = htons((unsigned short)(telnetparams.listenport));
|
||||
while (1) {
|
||||
sock = socket(AF_INET, SOCK_STREAM, 0);
|
||||
if (sock < 0)
|
||||
fprintf(stderr,"[TELNETSRV] Error %s on socket call\n",strerror(errno));
|
||||
|
||||
if(connect(sock, (void *) &name, sizeof(name)))
|
||||
fprintf(stderr,"[TELNETSRV] Error %s on connect call\n",strerror(errno));
|
||||
|
||||
struct timeval ts;
|
||||
ts.tv_sec = 1; // 1 second
|
||||
ts.tv_usec = 0;
|
||||
while (1) {
|
||||
fd_set fds;
|
||||
FD_ZERO(&fds);
|
||||
FD_SET(sock, &fds);
|
||||
FD_SET(STDIN_FILENO , &fds);
|
||||
// wait for data
|
||||
int nready = select(sock + 1, &fds, (fd_set *) 0, (fd_set *) 0, &ts);
|
||||
if (nready < 0) {
|
||||
perror("select. Error");
|
||||
break;
|
||||
}
|
||||
else if (nready == 0) {
|
||||
ts.tv_sec = 1; // 1 second
|
||||
ts.tv_usec = 0;
|
||||
}
|
||||
else if ( FD_ISSET(sock, &fds)) {
|
||||
int rv;
|
||||
char inbuf[TELNET_MAX_MSGLENGTH*2];
|
||||
memset(inbuf,0,sizeof(inbuf));
|
||||
rv = recv(sock , inbuf , sizeof(inbuf)-1 , 0);
|
||||
if (rv > 0) {
|
||||
printf("%s",inbuf);
|
||||
}
|
||||
else if (rv == 0) {
|
||||
printf("Connection closed by the remote end\n\r");
|
||||
break;
|
||||
}
|
||||
else {
|
||||
perror("recv error");
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (FD_ISSET(STDIN_FILENO , &fds)) {
|
||||
char *inbuf=NULL;
|
||||
size_t inlen=0;
|
||||
inlen = getline( &inbuf,&inlen, stdin);
|
||||
if ( inlen > 0 ) {
|
||||
if ( send(sock, inbuf,inlen, 0) < 0)
|
||||
break;
|
||||
}
|
||||
free(inbuf);
|
||||
}
|
||||
}
|
||||
close(sock);
|
||||
}
|
||||
return;
|
||||
} /* run_telnetclt */
|
||||
|
||||
void poll_telnetcmdq(void *qid, void *arg) {
|
||||
notifiedFIFO_elt_t *msg = pollNotifiedFIFO((notifiedFIFO_t *)qid);
|
||||
|
||||
@@ -720,10 +785,10 @@ void exec_moduleinit(char *modname) {
|
||||
|
||||
int add_embeddedmodules(void) {
|
||||
int ret=0;
|
||||
|
||||
for(int i=0; i<telnetoptions[TELNETSRV_STATICMOD].numelt; i++) {
|
||||
int pindex = config_paramidx_fromname(telnetoptions,sizeof(telnetoptions)/sizeof(paramdef_t), TELNETSRV_OPTNAME_STATICMOD);
|
||||
for(int i=0; i<telnetoptions[pindex].numelt; i++) {
|
||||
ret++;
|
||||
exec_moduleinit(telnetoptions[TELNETSRV_STATICMOD].strlistptr[i]);
|
||||
exec_moduleinit(telnetoptions[pindex].strlistptr[i]);
|
||||
}
|
||||
|
||||
return ret;
|
||||
@@ -733,16 +798,16 @@ int add_sharedmodules(void) {
|
||||
char initfunc[TELNET_CMD_MAXSIZE+9];
|
||||
void (*fptr)(void);
|
||||
int ret=0;
|
||||
|
||||
for(int i=0; i<telnetoptions[TELNETSRV_SHRMOD].numelt; i++) {
|
||||
sprintf(initfunc,"add_%s_cmds",telnetoptions[TELNETSRV_SHRMOD].strlistptr[i]);
|
||||
int pindex = config_paramidx_fromname(telnetoptions,sizeof(telnetoptions)/sizeof(paramdef_t), TELNETSRV_OPTNAME_SHRMOD);
|
||||
for(int i=0; i<telnetoptions[pindex].numelt; i++) {
|
||||
sprintf(initfunc,"add_%s_cmds",telnetoptions[pindex].strlistptr[i]);
|
||||
fptr = dlsym(RTLD_DEFAULT,initfunc);
|
||||
|
||||
if ( fptr != NULL) {
|
||||
fptr();
|
||||
ret++;
|
||||
} else {
|
||||
fprintf(stderr,"[TELNETSRV] couldn't find %s for module %s \n",initfunc,telnetoptions[TELNETSRV_STATICMOD].strlistptr[i]);
|
||||
fprintf(stderr,"[TELNETSRV] couldn't find %s for module %s \n",initfunc,telnetoptions[pindex].strlistptr[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -767,6 +832,12 @@ int telnetsrv_autoinit(void) {
|
||||
|
||||
add_telnetcmd("telnet", telnet_vardef, telnet_cmdarray);
|
||||
add_embeddedmodules();
|
||||
if ( telnetparams.listenstdin ) {
|
||||
if(pthread_create(&telnetparams.telnetclt_pthread,NULL, (void *(*)(void *))run_telnetclt, NULL) != 0) {
|
||||
fprintf(stderr,"[TELNETSRV] Error %s on pthread_create f() run_telnetclt \n",strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -807,7 +878,7 @@ int add_telnetcmd(char *modulename, telnetshell_vardef_t *var, telnetshell_cmdde
|
||||
|
||||
|
||||
/* 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)
|
||||
against main exec version. version mismatch not considered as fatal (interfaces not supposed to change)
|
||||
*/
|
||||
int telnetsrv_checkbuildver(char *mainexec_buildversion, char **shlib_buildversion) {
|
||||
#ifndef PACKAGE_VERSION
|
||||
|
||||
@@ -108,6 +108,7 @@ typedef struct cmdparser {
|
||||
/* global variables used by the telnet server */
|
||||
typedef struct {
|
||||
pthread_t telnet_pthread; // thread id of the telnet server
|
||||
pthread_t telnetclt_pthread; // thread id of the telnet client (used when listenstdin set to true)
|
||||
int telnetdbg; // debug level of the server
|
||||
int priority; // server running priority
|
||||
char *histfile; // command history
|
||||
@@ -119,6 +120,7 @@ typedef struct {
|
||||
char msgbuff[TELNET_MAX_MSGLENGTH]; // internal buffer of the client_printf function which is used to print to the client terminal */
|
||||
unsigned int listenport; // ip port the telnet server is listening on
|
||||
unsigned int listenaddr; // ip address the telnet server is listening on
|
||||
unsigned int listenstdin; // enable command input from stdin
|
||||
unsigned int loopcount; // loop command param: number of loop iteration
|
||||
unsigned int loopdelay; // loop command param: delay in ms between 2 iterations
|
||||
unsigned int phyprntbuff_size; // for phy module, dump_eNB_stats function buffer size
|
||||
|
||||
@@ -0,0 +1,178 @@
|
||||
/*
|
||||
* 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_nrue_measurements.c
|
||||
* \brief: implementation of telnet commands related to nrUE measurments
|
||||
* \author Francois TABURET
|
||||
* \date 2021
|
||||
* \version 0.1
|
||||
* \company NOKIA BellLabs France
|
||||
* \email: francois.taburet@nokia-bell-labs.com
|
||||
* \note
|
||||
* \warning
|
||||
*/
|
||||
#define _GNU_SOURCE
|
||||
#include <sys/types.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
|
||||
|
||||
|
||||
#define TELNETSERVERCODE
|
||||
#include "telnetsrv.h"
|
||||
|
||||
#include "common/utils/LOG/log.h"
|
||||
#include "common/config/config_userapi.h"
|
||||
#include "telnetsrv_measurements.h"
|
||||
#include "telnetsrv_ltemeasur_def.h"
|
||||
#include "telnetsrv_cpumeasur_def.h"
|
||||
#include "openair2/LAYER2/NR_MAC_UE/mac_defs.h"
|
||||
#include "openair1/PHY/phy_extern_nr_ue.h"
|
||||
|
||||
void measurcmd_display_macstats(telnet_printfunc_t prnt);
|
||||
void measurcmd_display_macstats_ue(telnet_printfunc_t prnt);
|
||||
void measurcmd_display_rlcstats(telnet_printfunc_t prnt);
|
||||
void measurcmd_display_phycpu(telnet_printfunc_t prnt);
|
||||
void measurcmd_display_maccpu(telnet_printfunc_t prnt);
|
||||
void measurcmd_display_pdcpcpu(telnet_printfunc_t prnt);
|
||||
|
||||
|
||||
static telnet_measurgroupdef_t nrUEmeasurgroups[] = {
|
||||
// {"ue", GROUP_LTESTATS,0, measurcmd_display_macstats, {NULL}},
|
||||
// {"rlc", GROUP_LTESTATS,0, measurcmd_display_rlcstats, {NULL}},
|
||||
{"phycpu",GROUP_CPUSTATS,0, measurcmd_display_phycpu, {NULL}},
|
||||
// {"maccpu",GROUP_CPUSTATS,0, measurcmd_display_maccpu, {NULL}},
|
||||
// {"pdcpcpu",GROUP_CPUSTATS,0, measurcmd_display_pdcpcpu, {NULL}},
|
||||
};
|
||||
#define TELNET_NUM_NRUEMEASURGROUPS (sizeof(nrUEmeasurgroups)/sizeof(telnet_measurgroupdef_t))
|
||||
|
||||
|
||||
static double cpufreq;
|
||||
|
||||
|
||||
#define HDR "---------------------------------"
|
||||
|
||||
|
||||
int get_measurgroups(telnet_measurgroupdef_t **measurgroups) {
|
||||
*measurgroups = nrUEmeasurgroups;
|
||||
return TELNET_NUM_NRUEMEASURGROUPS;
|
||||
}
|
||||
|
||||
|
||||
void measurcmd_display_phycpu(telnet_printfunc_t prnt) {
|
||||
PHY_VARS_NR_UE *UE = PHY_vars_UE_g[0][0];
|
||||
telnet_cpumeasurdef_t cpumeasur[]=CPU_PHYNRUE_MEASURE;
|
||||
prnt("%s cpu (%1.1g GHz) measurements: PHY (cpustats %s) %s\n",HDR,cpufreq,
|
||||
PRINT_CPUMEAS_STATE,HDR);
|
||||
measurcmd_display_cpumeasures(prnt, cpumeasur, sizeof(cpumeasur)/sizeof(telnet_cpumeasurdef_t));
|
||||
}
|
||||
/*
|
||||
void measurcmd_display_maccpu(telnet_printfunc_t prnt) {
|
||||
eNB_MAC_INST *macvars = RC.mac[eNB_id];
|
||||
telnet_cpumeasurdef_t cpumeasur[]=CPU_MACENB_MEASURE;
|
||||
prnt("%s cpu (%1.1g GHz) measurements: MAC (cpustats %s) %s\n",HDR,cpufreq,
|
||||
PRINT_CPUMEAS_STATE,HDR);
|
||||
measurcmd_display_cpumeasures(prnt, cpumeasur, sizeof(cpumeasur)/sizeof(telnet_cpumeasurdef_t));
|
||||
}
|
||||
|
||||
void measurcmd_display_pdcpcpu(telnet_printfunc_t prnt) {
|
||||
pdcp_stats_t *pdcpvars = &(eNB_pdcp_stats[eNB_id]);
|
||||
telnet_cpumeasurdef_t cpumeasur[]=CPU_PDCPENB_MEASURE;
|
||||
prnt("%s cpu (%1.1g GHz) measurements: PDCP (cpustats %s) %s \n",HDR,cpufreq,
|
||||
PRINT_CPUMEAS_STATE,HDR);
|
||||
measurcmd_display_cpumeasures(prnt, cpumeasur, sizeof(cpumeasur)/sizeof(telnet_cpumeasurdef_t));
|
||||
}
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
void measurcmd_display_macstats_ue(telnet_printfunc_t prnt) {
|
||||
UE_info_t *UE_info = &(RC.mac[eNB_id]->UE_info);
|
||||
|
||||
for (int UE_id=UE_info->list.head; UE_id>=0; UE_id=UE_info->list.next[UE_id]) {
|
||||
for (int i=0; i<UE_info->numactiveCCs[UE_id]; i++) {
|
||||
int CC_id = UE_info->ordered_CCids[i][UE_id];
|
||||
prnt("%s UE %i Id %i CCid %i %s\n",HDR,i,UE_id,CC_id,HDR);
|
||||
eNB_UE_STATS *macuestatptr = &(UE_info->eNB_UE_stats[CC_id][UE_id]);
|
||||
telnet_ltemeasurdef_t statsptr[]=LTEMAC_UEMEASURE;
|
||||
measurcmd_display_measures(prnt, statsptr, sizeof(statsptr)/sizeof(telnet_ltemeasurdef_t));
|
||||
}
|
||||
}
|
||||
} // measurcmd_display_macstats_ue
|
||||
|
||||
void measurcmd_display_macstats(telnet_printfunc_t prnt) {
|
||||
for (int CC_id=0 ; CC_id < MAX_NUM_CCs; CC_id++) {
|
||||
eNB_STATS *macstatptr=&(RC.mac[eNB_id]->eNB_stats[CC_id]);
|
||||
telnet_ltemeasurdef_t statsptr[]=LTEMAC_MEASURE;
|
||||
prnt("%s eNB %i mac stats CC %i frame %u %s\n",
|
||||
HDR, eNB_id, CC_id, RC.mac[eNB_id]->frame,HDR);
|
||||
measurcmd_display_measures(prnt,statsptr,sizeof(statsptr)/sizeof(telnet_ltemeasurdef_t));
|
||||
}
|
||||
} // measurcmd_display_macstats
|
||||
|
||||
|
||||
void measurcmd_display_one_rlcstat(telnet_printfunc_t prnt, int UE_id, telnet_ltemeasurdef_t *statsptr, int num_rlcmeasure, unsigned int *rlcstats,
|
||||
char *rbid_str, protocol_ctxt_t *ctxt, const srb_flag_t srb_flagP, const rb_id_t rb_idP)
|
||||
|
||||
{
|
||||
int rlc_status = rlc_stat_req(ctxt,srb_flagP,rb_idP,
|
||||
rlcstats, rlcstats+1, rlcstats+2, rlcstats+3, rlcstats+4, rlcstats+5,
|
||||
rlcstats+6, rlcstats+7, rlcstats+8, rlcstats+9, rlcstats+10, rlcstats+11,
|
||||
rlcstats+12, rlcstats+13, rlcstats+14, rlcstats+15, rlcstats+16, rlcstats+17,
|
||||
rlcstats+18, rlcstats+19, rlcstats+20, rlcstats+21, rlcstats+22, rlcstats+23,
|
||||
rlcstats+24, rlcstats+25, rlcstats+26, rlcstats+27);
|
||||
|
||||
if (rlc_status == RLC_OP_STATUS_OK) {
|
||||
prnt("%s UE %i RLC %s mode %s %s\n",HDR,UE_id, rbid_str,
|
||||
(rlcstats[0]==RLC_MODE_AM)? "AM": (rlcstats[0]==RLC_MODE_UM)?"UM":"NONE",HDR);
|
||||
measurcmd_display_measures(prnt, statsptr, num_rlcmeasure);
|
||||
}
|
||||
} // status measurcmd_rlc_stat_req
|
||||
|
||||
|
||||
void measurcmd_display_rlcstats(telnet_printfunc_t prnt) {
|
||||
protocol_ctxt_t ctxt;
|
||||
UE_info_t *UE_info = &(RC.mac[eNB_id]->UE_info);
|
||||
telnet_ltemeasurdef_t statsptr[]=LTE_RLCMEASURE;
|
||||
int num_rlcmeasure = sizeof(statsptr)/sizeof(telnet_ltemeasurdef_t );
|
||||
unsigned int *rlcstats = malloc(num_rlcmeasure*sizeof(unsigned int));
|
||||
eNB_MAC_INST *eNB = RC.mac[eNB_id];
|
||||
|
||||
for(int i=0; i <num_rlcmeasure ; i++) {
|
||||
statsptr[i].vptr = rlcstats + i;
|
||||
}
|
||||
|
||||
for (int UE_id=UE_info->list.head; UE_id>=0; UE_id=UE_info->list.next[UE_id]) {
|
||||
#define NB_eNB_INST 1
|
||||
PROTOCOL_CTXT_SET_BY_MODULE_ID(&ctxt,eNB_id, ENB_FLAG_YES,UE_info->eNB_UE_stats[0][UE_id].crnti,
|
||||
eNB->frame,eNB->subframe,eNB_id);
|
||||
measurcmd_display_one_rlcstat(prnt, UE_id, statsptr, num_rlcmeasure, rlcstats, "DCCH", &ctxt, SRB_FLAG_YES, DCCH);
|
||||
measurcmd_display_one_rlcstat(prnt, UE_id, statsptr, num_rlcmeasure, rlcstats, "DTCH", &ctxt, SRB_FLAG_NO, DTCH-2);
|
||||
}
|
||||
} // measurcmd_display_macstats_ue
|
||||
|
||||
*/
|
||||
|
||||
|
||||
@@ -8,9 +8,9 @@ set(TELNETSRV_SOURCE
|
||||
)
|
||||
|
||||
add_library(telnetsrv MODULE ${TELNETSRV_SOURCE} )
|
||||
target_link_libraries(telnetsrv PRIVATE history)
|
||||
target_link_libraries(telnetsrv PRIVATE history ncurses form )
|
||||
|
||||
foreach(TELNETLIB enb gnb 4gUE 5gUE)
|
||||
foreach(TELNETLIB enb gnb 4Gue 5Gue)
|
||||
set(TELNETLIB_SRCS "")
|
||||
foreach(TELNETLIB_ASRC measurements phycmd)
|
||||
set(TELNETLIB_SRC ${OPENAIR_DIR}/common/utils/telnetsrv/telnetsrv_${TELNETLIB}_${TELNETLIB_ASRC}.c)
|
||||
@@ -32,4 +32,4 @@ install(TARGETS telnetsrv DESTINATION bin)
|
||||
|
||||
if (EXISTS "${OPENAIR_BUILD_DIR}/ran_build/build" AND IS_DIRECTORY "${OPENAIR_BUILD_DIR}/ran_build/build")
|
||||
install(TARGETS telnetsrv DESTINATION ${OPENAIR_BUILD_DIR}/ran_build/build)
|
||||
endif (EXISTS "${OPENAIR_BUILD_DIR}/ran_build/build" AND IS_DIRECTORY "${OPENAIR_BUILD_DIR}/ran_build/build")
|
||||
endif (EXISTS "${OPENAIR_BUILD_DIR}/ran_build/build" AND IS_DIRECTORY "${OPENAIR_BUILD_DIR}/ran_build/build")
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
* \ strucures arrays which are then used by the display functions
|
||||
* \ in telnetsrv_measurements.c.
|
||||
* \author Francois TABURET
|
||||
* \date 2019
|
||||
* \version 0.1
|
||||
* \date 2021
|
||||
* \version 0.2
|
||||
* \company NOKIA BellLabs France
|
||||
* \email: francois.taburet@nokia-bell-labs.com
|
||||
* \note
|
||||
@@ -37,67 +37,119 @@
|
||||
|
||||
#define CPU_PHYENB_MEASURE \
|
||||
{ \
|
||||
{"phy_proc_tx", &(phyvars->phy_proc_tx),0},\
|
||||
{"phy_proc_rx", &(phyvars->phy_proc_rx),0},\
|
||||
{"rx_prach", &(phyvars->rx_prach),0},\
|
||||
{"ofdm_mod", &(phyvars->ofdm_mod_stats),0},\
|
||||
{"dlsch_common_and_dci", &(phyvars->dlsch_common_and_dci),0},\
|
||||
{"dlsch_ue_specific", &(phyvars->dlsch_ue_specific),0},\
|
||||
{"dlsch_encoding", &(phyvars->dlsch_encoding_stats),0},\
|
||||
{"dlsch_modulation", &(phyvars->dlsch_modulation_stats),0},\
|
||||
{"dlsch_scrambling", &(phyvars->dlsch_scrambling_stats),0},\
|
||||
{"dlsch_rate_matching", &(phyvars->dlsch_rate_matching_stats),0},\
|
||||
{"dlsch_turbo_encod_prep", &(phyvars->dlsch_turbo_encoding_preperation_stats),0},\
|
||||
{"dlsch_turbo_encod_segm", &(phyvars->dlsch_turbo_encoding_segmentation_stats),0},\
|
||||
{"dlsch_turbo_encod", &(phyvars->dlsch_turbo_encoding_stats),0},\
|
||||
{"dlsch_turbo_encod_waiting", &(phyvars->dlsch_turbo_encoding_waiting_stats),0},\
|
||||
{"dlsch_turbo_encod_signal", &(phyvars->dlsch_turbo_encoding_signal_stats),0},\
|
||||
{"dlsch_turbo_encod_main", &(phyvars->dlsch_turbo_encoding_main_stats),0},\
|
||||
{"dlsch_turbo_encod_wakeup0", &(phyvars->dlsch_turbo_encoding_wakeup_stats0),0},\
|
||||
{"dlsch_turbo_encod_wakeup1", &(phyvars->dlsch_turbo_encoding_wakeup_stats1),0},\
|
||||
{"dlsch_interleaving", &(phyvars->dlsch_interleaving_stats),0},\
|
||||
{"rx_dft", &(phyvars->rx_dft_stats),0},\
|
||||
{"ulsch_channel_estimation", &(phyvars->ulsch_channel_estimation_stats),0},\
|
||||
{"ulsch_freq_offset_estimation", &(phyvars->ulsch_freq_offset_estimation_stats),0},\
|
||||
{"ulsch_decoding", &(phyvars->ulsch_decoding_stats),0},\
|
||||
{"ulsch_demodulation", &(phyvars->ulsch_demodulation_stats),0},\
|
||||
{"ulsch_rate_unmatching", &(phyvars->ulsch_rate_unmatching_stats),0},\
|
||||
{"ulsch_turbo_decoding", &(phyvars->ulsch_turbo_decoding_stats),0},\
|
||||
{"ulsch_deinterleaving", &(phyvars->ulsch_deinterleaving_stats),0},\
|
||||
{"ulsch_demultiplexing", &(phyvars->ulsch_demultiplexing_stats),0},\
|
||||
{"ulsch_llr", &(phyvars->ulsch_llr_stats),0},\
|
||||
{"ulsch_tc_init", &(phyvars->ulsch_tc_init_stats),0},\
|
||||
{"ulsch_tc_alpha", &(phyvars->ulsch_tc_alpha_stats),0},\
|
||||
{"ulsch_tc_beta", &(phyvars->ulsch_tc_beta_stats),0},\
|
||||
{"ulsch_tc_gamma", &(phyvars->ulsch_tc_gamma_stats),0},\
|
||||
{"ulsch_tc_ext", &(phyvars->ulsch_tc_ext_stats),0},\
|
||||
{"ulsch_tc_intl1", &(phyvars->ulsch_tc_intl1_stats),0},\
|
||||
{"ulsch_tc_intl2", &(phyvars->ulsch_tc_intl2_stats),0},\
|
||||
{"phy_proc_tx", &(phyvars->phy_proc_tx),0,1},\
|
||||
{"phy_proc_rx", &(phyvars->phy_proc_rx),0,1},\
|
||||
{"rx_prach", &(phyvars->rx_prach),0,1},\
|
||||
{"ofdm_mod", &(phyvars->ofdm_mod_stats),0,1},\
|
||||
{"dlsch_common_and_dci", &(phyvars->dlsch_common_and_dci),0,1},\
|
||||
{"dlsch_ue_specific", &(phyvars->dlsch_ue_specific),0,1},\
|
||||
{"dlsch_encoding", &(phyvars->dlsch_encoding_stats),0,1},\
|
||||
{"dlsch_modulation", &(phyvars->dlsch_modulation_stats),0,1},\
|
||||
{"dlsch_scrambling", &(phyvars->dlsch_scrambling_stats),0,1},\
|
||||
{"dlsch_rate_matching", &(phyvars->dlsch_rate_matching_stats),0,1},\
|
||||
{"dlsch_turbo_encod_prep", &(phyvars->dlsch_turbo_encoding_preperation_stats),0,1},\
|
||||
{"dlsch_turbo_encod_segm", &(phyvars->dlsch_turbo_encoding_segmentation_stats),0,1},\
|
||||
{"dlsch_turbo_encod", &(phyvars->dlsch_turbo_encoding_stats),0,1},\
|
||||
{"dlsch_turbo_encod_waiting", &(phyvars->dlsch_turbo_encoding_waiting_stats),0,1},\
|
||||
{"dlsch_turbo_encod_signal", &(phyvars->dlsch_turbo_encoding_signal_stats),0,1},\
|
||||
{"dlsch_turbo_encod_main", &(phyvars->dlsch_turbo_encoding_main_stats),0,1},\
|
||||
{"dlsch_turbo_encod_wakeup0", &(phyvars->dlsch_turbo_encoding_wakeup_stats0),0,1},\
|
||||
{"dlsch_turbo_encod_wakeup1", &(phyvars->dlsch_turbo_encoding_wakeup_stats1),0,1},\
|
||||
{"dlsch_interleaving", &(phyvars->dlsch_interleaving_stats),0,1},\
|
||||
{"rx_dft", &(phyvars->rx_dft_stats),0,1},\
|
||||
{"ulsch_channel_estimation", &(phyvars->ulsch_channel_estimation_stats),0,1},\
|
||||
{"ulsch_freq_offset_estimation", &(phyvars->ulsch_freq_offset_estimation_stats),0,1},\
|
||||
{"ulsch_decoding", &(phyvars->ulsch_decoding_stats),0,1},\
|
||||
{"ulsch_demodulation", &(phyvars->ulsch_demodulation_stats),0,1},\
|
||||
{"ulsch_rate_unmatching", &(phyvars->ulsch_rate_unmatching_stats),0,1},\
|
||||
{"ulsch_turbo_decoding", &(phyvars->ulsch_turbo_decoding_stats),0,1},\
|
||||
{"ulsch_deinterleaving", &(phyvars->ulsch_deinterleaving_stats),0,1},\
|
||||
{"ulsch_demultiplexing", &(phyvars->ulsch_demultiplexing_stats),0,1},\
|
||||
{"ulsch_llr", &(phyvars->ulsch_llr_stats),0,1},\
|
||||
{"ulsch_tc_init", &(phyvars->ulsch_tc_init_stats),0,1},\
|
||||
{"ulsch_tc_alpha", &(phyvars->ulsch_tc_alpha_stats),0,1},\
|
||||
{"ulsch_tc_beta", &(phyvars->ulsch_tc_beta_stats),0,1},\
|
||||
{"ulsch_tc_gamma", &(phyvars->ulsch_tc_gamma_stats),0,1},\
|
||||
{"ulsch_tc_ext", &(phyvars->ulsch_tc_ext_stats),0,1},\
|
||||
{"ulsch_tc_intl1", &(phyvars->ulsch_tc_intl1_stats),0,1},\
|
||||
{"ulsch_tc_intl2", &(phyvars->ulsch_tc_intl2_stats),0,1},\
|
||||
}
|
||||
|
||||
#define CPU_MACENB_MEASURE \
|
||||
{ \
|
||||
{"eNB_scheduler", &(macvars->eNB_scheduler),0},\
|
||||
{"schedule_si", &(macvars->schedule_si),0},\
|
||||
{"schedule_ra", &(macvars->schedule_ra),0},\
|
||||
{"schedule_ulsch", &(macvars->schedule_ulsch),0},\
|
||||
{"fill_DLSCH_dci", &(macvars->fill_DLSCH_dci),0},\
|
||||
{"schedule_dlsch_pre", &(macvars->schedule_dlsch_preprocessor),0},\
|
||||
{"schedule_dlsch", &(macvars->schedule_dlsch),0},\
|
||||
{"schedule_mch", &(macvars->schedule_mch),0},\
|
||||
{"rx_ulsch_sdu", &(macvars->rx_ulsch_sdu),0},\
|
||||
{"schedule_pch", &(macvars->schedule_pch),0},\
|
||||
{"eNB_scheduler", &(macvars->eNB_scheduler),0,1},\
|
||||
{"schedule_si", &(macvars->schedule_si),0,1},\
|
||||
{"schedule_ra", &(macvars->schedule_ra),0,1},\
|
||||
{"schedule_ulsch", &(macvars->schedule_ulsch),0,1},\
|
||||
{"fill_DLSCH_dci", &(macvars->fill_DLSCH_dci),0,1},\
|
||||
{"schedule_dlsch_pre", &(macvars->schedule_dlsch_preprocessor),0,1},\
|
||||
{"schedule_dlsch", &(macvars->schedule_dlsch),0,1},\
|
||||
{"schedule_mch", &(macvars->schedule_mch),0,1},\
|
||||
{"rx_ulsch_sdu", &(macvars->rx_ulsch_sdu),0,1},\
|
||||
{"schedule_pch", &(macvars->schedule_pch),0,1},\
|
||||
}
|
||||
|
||||
#define CPU_PDCPENB_MEASURE \
|
||||
{ \
|
||||
{"pdcp_run", &(pdcpvars->pdcp_run),0},\
|
||||
{"data_req", &(pdcpvars->data_req),0},\
|
||||
{"data_ind", &(pdcpvars->data_ind),0},\
|
||||
{"apply_security", &(pdcpvars->apply_security),0},\
|
||||
{"validate_security", &(pdcpvars->validate_security),0},\
|
||||
{"pdcp_ip", &(pdcpvars->pdcp_ip),0},\
|
||||
{"ip_pdcp", &(pdcpvars->ip_pdcp),0},\
|
||||
{"pdcp_run", &(pdcpvars->pdcp_run),0,1},\
|
||||
{"data_req", &(pdcpvars->data_req),0,1},\
|
||||
{"data_ind", &(pdcpvars->data_ind),0,1},\
|
||||
{"apply_security", &(pdcpvars->apply_security),0,1},\
|
||||
{"validate_security", &(pdcpvars->validate_security),0,1},\
|
||||
{"pdcp_ip", &(pdcpvars->pdcp_ip),0,1},\
|
||||
{"ip_pdcp", &(pdcpvars->ip_pdcp),0,1},\
|
||||
}
|
||||
|
||||
/* from openair1/PHY/defs_nr_UE.h */
|
||||
#define CPU_PHYNRUE_MEASURE \
|
||||
{ \
|
||||
{"phy_proc", &(UE->phy_proc[0]),0,RX_NB_TH},\
|
||||
{"phy_proc_rx", &(UE-> phy_proc_rx[0]),0,RX_NB_TH},\
|
||||
{"phy_proc_tx", &(UE->phy_proc_tx),0,1},\
|
||||
{"ofdm_mod_stats", &(UE->ofdm_mod_stats),0,1},\
|
||||
{"ulsch_encoding_stats", &(UE->ulsch_encoding_stats),0,1},\
|
||||
{"ulsch_modulation_stats", &(UE->ulsch_modulation_stats),0,1},\
|
||||
{"ulsch_segmentation_stats", &(UE->ulsch_segmentation_stats),0,1},\
|
||||
{"ulsch_rate_matching_stats", &(UE->ulsch_rate_matching_stats),0,1},\
|
||||
{"ulsch_turbo_encoding_stats", &(UE->ulsch_turbo_encoding_stats),0,1},\
|
||||
{"ulsch_interleaving_stats", &(UE->ulsch_interleaving_stats),0,1},\
|
||||
{"ulsch_multiplexing_stats", &(UE->ulsch_multiplexing_stats),0,1},\
|
||||
{"generic_stat", &(UE->generic_stat),0,1},\
|
||||
{"generic_stat_bis", &(UE->generic_stat_bis[0][0]),0,RX_NB_TH,LTE_SLOTS_PER_SUBFRAME},\
|
||||
{"ofdm_demod_stats", &(UE->ofdm_demod_stats),0,1},\
|
||||
{"dlsch_rx_pdcch_stats", &(UE->dlsch_rx_pdcch_stats),0,1},\
|
||||
{"rx_dft_stats", &(UE->rx_dft_stats),0,1},\
|
||||
{"dlsch_c...timation_stats", &(UE->dlsch_channel_estimation_stats),0,1},\
|
||||
{"dlsch_f...timation_stats", &(UE->dlsch_freq_offset_estimation_stats),0,1},\
|
||||
{"dlsch_demodulation_stats", &(UE->dlsch_demodulation_stats),0,1},\
|
||||
{"dlsch_rate_unmatching_stats", &(UE->dlsch_rate_unmatching_stats),0,1},\
|
||||
{"dlsch_turbo_decoding_stats", &(UE->dlsch_turbo_decoding_stats),0,1},\
|
||||
{"dlsch_deinterleaving_stats", &(UE->dlsch_deinterleaving_stats),0,1},\
|
||||
{"dlsch_llr_stats", &(UE->dlsch_llr_stats),0,1},\
|
||||
{"dlsch_unscrambling_stats", &(UE->dlsch_unscrambling_stats),0,1},\
|
||||
{"dlsch_rate_matching_stats", &(UE->dlsch_rate_matching_stats),0,1},\
|
||||
{"dlsch_turbo_encoding_stats", &(UE->dlsch_turbo_encoding_stats),0,1},\
|
||||
{"dlsch_interleaving_stats", &(UE->dlsch_interleaving_stats),0,1},\
|
||||
{"dlsch_tc_init_stats", &(UE->dlsch_tc_init_stats),0,1},\
|
||||
{"dlsch_tc_alpha_stats", &(UE->dlsch_tc_alpha_stats),0,1},\
|
||||
{"dlsch_tc_beta_stats", &(UE->dlsch_tc_beta_stats),0,1},\
|
||||
{"dlsch_tc_gamma_stats", &(UE->dlsch_tc_gamma_stats),0,1},\
|
||||
{"dlsch_tc_ext_stats", &(UE->dlsch_tc_ext_stats),0,1},\
|
||||
{"dlsch_tc_intl1_stats", &(UE->dlsch_tc_intl1_stats),0,1},\
|
||||
{"dlsch_tc_intl2_stats", &(UE->dlsch_tc_intl2_stats),0,1},\
|
||||
{"tx_prach", &(UE->tx_prach),0,1},\
|
||||
{"dlsch_encoding_SIC_stats", &(UE->dlsch_encoding_SIC_stats),0,1},\
|
||||
{"dlsch_scrambling_SIC_stats", &(UE->dlsch_scrambling_SIC_stats),0,1},\
|
||||
{"dlsch_modulation_SIC_stats", &(UE->dlsch_modulation_SIC_stats),0,1},\
|
||||
{"dlsch...ping_unit_SIC_stats", &(UE->dlsch_llr_stripping_unit_SIC_stats),0,1},\
|
||||
{"dlsch_unscrambling_SIC_stats", &(UE->dlsch_unscrambling_SIC_stats),0,1},\
|
||||
{"ue_front_end_stat", &(UE->ue_front_end_stat[0]),0,RX_NB_TH},\
|
||||
{"ue_front_end_per_slot_stat", &(UE->ue_front_end_per_slot_stat[0][0]),0,RX_NB_TH,LTE_SLOTS_PER_SUBFRAME},\
|
||||
{"pdcch_procedures_stat", &(UE->pdcch_procedures_stat[0]),0,RX_NB_TH},\
|
||||
{"pdsch_procedures_stat", &(UE->pdsch_procedures_stat[0]),0,RX_NB_TH},\
|
||||
{"pdsch_procedures_per_slot_stat", &(UE->pdsch_procedures_per_slot_stat[0][0]),0,RX_NB_TH,LTE_SLOTS_PER_SUBFRAME},\
|
||||
{"dlsch_procedures_stat", &(UE->dlsch_procedures_stat[0]),0,RX_NB_TH},\
|
||||
{"dlsch_decoding_stats", &(UE->dlsch_decoding_stats[0]),0,RX_NB_TH},\
|
||||
{"dlsch_llr_stats_para", &(UE->dlsch_llr_stats_parallelization[0][0]),0,RX_NB_TH,LTE_SLOTS_PER_SUBFRAME},\
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -64,13 +64,30 @@ void measurcmd_display_groups(telnet_printfunc_t prnt,telnet_measurgroupdef_t *m
|
||||
} /* measurcmd_display_groups */
|
||||
/*----------------------------------------------------------------------------------------------------*/
|
||||
/* cpu measurements functions */
|
||||
void measurcmd_display_cpumeasures(telnet_printfunc_t prnt, telnet_cpumeasurdef_t *cpumeasure, int cpumeasure_size) {
|
||||
for (int i=0; i<cpumeasure_size; i++) {
|
||||
prnt("%02d %*s: %15.3f us; %15d %s",i,TELNET_MAXMEASURNAME_LEN-1,(cpumeasure+i)->statname,
|
||||
((cpumeasure+i)->astatptr->trials!=0)?(((cpumeasure+i)->astatptr->diff)/((cpumeasure+i)->astatptr->trials))/cpufreq/1000:0,
|
||||
(cpumeasure+i)->astatptr->trials, ((i%2)==1)?"|\n":" | " );
|
||||
}
|
||||
|
||||
|
||||
static char *stridx(int max,int i, char *buff) {
|
||||
if (max>1)
|
||||
sprintf(buff,"[%d]",i);
|
||||
else
|
||||
sprintf(buff," ");
|
||||
return buff;
|
||||
|
||||
}
|
||||
void measurcmd_display_cpumeasures(telnet_printfunc_t prnt, telnet_cpumeasurdef_t *cpumeasure, int cpumeasure_size) {
|
||||
int p=0;
|
||||
char stridx1[16];
|
||||
char stridx2[16];
|
||||
for (int i=0; i<cpumeasure_size; i++)
|
||||
for (int o1=0;o1<cpumeasure[i].num_occur1;o1++)
|
||||
for (int o2=0;o2<=cpumeasure[i].num_occur2;o2++)
|
||||
{
|
||||
prnt("%02d %*s%s%s: %15.3f us; %15d %s",p,TELNET_MAXMEASURNAME_LEN+7,(cpumeasure+i)->statname,
|
||||
stridx(cpumeasure[i].num_occur1,o1,stridx1),stridx(cpumeasure[i].num_occur2,o2,stridx2),
|
||||
((cpumeasure+i+o1+o2)->astatptr->trials!=0)?(((cpumeasure+i+o1+o2)->astatptr->diff)/((cpumeasure+i+o1+o2)->astatptr->trials))/cpufreq/1000:0,
|
||||
(cpumeasure+i+o1+o2)->astatptr->trials, ((p%2)==1)?"|\n":" | " );
|
||||
p++;
|
||||
}
|
||||
prnt("\n\n");
|
||||
} /* measurcmd_display_measures */
|
||||
|
||||
@@ -137,11 +154,17 @@ int measurcmd_show(char *buf, int debug, telnet_printfunc_t prnt) {
|
||||
}
|
||||
telnet_measurgroupdef_t *measurgroups;
|
||||
int num_measurgroups = fptr( &measurgroups);
|
||||
|
||||
|
||||
int s = sscanf(buf,"%ms %i-%i\n",&subcmd, &idx1,&idx2);
|
||||
|
||||
if (s>0) {
|
||||
if ( strcmp(subcmd,"groups") == 0) {
|
||||
if ( strcmp(subcmd,"inq") == 0) {
|
||||
notifiedFIFO_elt_t *msg =newNotifiedFIFO_elt(sizeof(time_stats_msg_t),0,NULL,NULL);
|
||||
time_stats_msg_t *msgdata=NotifiedFifoData(msg);
|
||||
msgdata->msgid = TIMESTAT_MSGID_DISPLAY;
|
||||
msgdata->displayFunc = prnt;
|
||||
pushNotifiedFIFO(&measur_fifo, msg);
|
||||
} else if ( strcmp(subcmd,"groups") == 0){
|
||||
measurcmd_display_groups(prnt,measurgroups,num_measurgroups);
|
||||
badcmd=0;
|
||||
} else {
|
||||
@@ -182,13 +205,13 @@ int measurcmd_cpustats(char *buf, int debug, telnet_printfunc_t prnt) {
|
||||
int badcmd=1;
|
||||
|
||||
if (debug > 0)
|
||||
prnt(" measurcmd_show received %s\n",buf);
|
||||
prnt(" measurcmd_cpustats received %s\n",buf);
|
||||
|
||||
int s = sscanf(buf,"%ms %i-%i\n",&subcmd, &idx1,&idx2);
|
||||
|
||||
if (s>0) {
|
||||
if ( strcmp(subcmd,"enable") == 0) {
|
||||
cpumeas(CPUMEAS_ENABLE);
|
||||
|
||||
badcmd=0;
|
||||
} else if ( strcmp(subcmd,"disable") == 0) {
|
||||
cpumeas(CPUMEAS_DISABLE);
|
||||
@@ -203,6 +226,64 @@ int measurcmd_cpustats(char *buf, int debug, telnet_printfunc_t prnt) {
|
||||
free(subcmd);
|
||||
return CMDSTATUS_FOUND;
|
||||
}
|
||||
|
||||
void measurcmd_async_help(telnet_printfunc_t prnt) {
|
||||
}
|
||||
|
||||
int measurcmd_async(char *buf, int debug, telnet_printfunc_t prnt) {
|
||||
char *subcmd=NULL;
|
||||
int idx1, idx2;
|
||||
int okcmd=0;
|
||||
|
||||
if (buf == NULL) {
|
||||
measurcmd_async_help(prnt);
|
||||
return CMDSTATUS_FOUND;
|
||||
}
|
||||
if (debug > 0)
|
||||
prnt(" measurcmd_async received %s\n",buf);
|
||||
|
||||
|
||||
int s = sscanf(buf,"%ms %i-%i\n",&subcmd, &idx1,&idx2);
|
||||
|
||||
if (s==1) {
|
||||
if ( strcmp(subcmd,"enable") == 0) {
|
||||
init_meas();
|
||||
okcmd=1;
|
||||
} else if ( strcmp(subcmd,"disable") == 0) {
|
||||
end_meas();
|
||||
okcmd=1;
|
||||
}
|
||||
} else if ( s == 3 ) {
|
||||
int msgid;
|
||||
if ( strcmp(subcmd,"enable") == 0) {
|
||||
msgid = TIMESTAT_MSGID_ENABLE;
|
||||
okcmd=1;
|
||||
} else if ( strcmp(subcmd,"disable") == 0) {
|
||||
msgid = TIMESTAT_MSGID_DISABLE;
|
||||
okcmd=1;
|
||||
} else if ( strcmp(subcmd,"display") == 0) {
|
||||
msgid = TIMESTAT_MSGID_DISPLAY;
|
||||
okcmd=1;
|
||||
}
|
||||
if (okcmd) {
|
||||
notifiedFIFO_elt_t *nfe = newNotifiedFIFO_elt(sizeof(time_stats_msg_t),0,NULL,NULL);
|
||||
time_stats_msg_t *msg = (time_stats_msg_t *)NotifiedFifoData(nfe);
|
||||
msg->msgid = msgid ;
|
||||
msg->displayFunc = prnt;
|
||||
for(int i=idx1; i<idx2; i++) {
|
||||
msg->timestat_id =i;
|
||||
pushNotifiedFIFO(&measur_fifo, nfe);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!(okcmd)) {
|
||||
prnt("Unknown command: %s\n",buf);
|
||||
}
|
||||
|
||||
free(subcmd);
|
||||
return CMDSTATUS_FOUND;
|
||||
}
|
||||
/*-------------------------------------------------------------------------------------*/
|
||||
|
||||
/* function called at telnet server init to add the measur command */
|
||||
|
||||
@@ -49,6 +49,9 @@ typedef struct cpumeasurdef {
|
||||
char statname[TELNET_MAXMEASURNAME_LEN];
|
||||
time_stats_t *astatptr;
|
||||
unsigned int statemask;
|
||||
uint8_t num_occur1;
|
||||
uint8_t num_occur2;
|
||||
uint8_t num_occur3;
|
||||
} telnet_cpumeasurdef_t;
|
||||
|
||||
typedef struct ltemeasurdef {
|
||||
@@ -60,6 +63,7 @@ typedef struct ltemeasurdef {
|
||||
|
||||
#define GROUP_LTESTATS 0
|
||||
#define GROUP_CPUSTATS 1
|
||||
|
||||
typedef void(*measur_dislayfunc_t)(telnet_printfunc_t prnt);
|
||||
typedef struct mesurgroupdef {
|
||||
char groupname[TELNET_MAXMEASURNAME_LEN];
|
||||
@@ -79,9 +83,11 @@ typedef struct mesurgroupdef {
|
||||
#ifdef TELNETSRV_MEASURMENTS_MAIN
|
||||
int measurcmd_show(char *buf, int debug, telnet_printfunc_t prnt);
|
||||
int measurcmd_cpustats(char *buf, int debug, telnet_printfunc_t prnt);
|
||||
int measurcmd_async(char *buf, int debug, telnet_printfunc_t prnt);
|
||||
telnetshell_cmddef_t measur_cmdarray[] = {
|
||||
{"show", "groups | <group name>" , measurcmd_show},
|
||||
{"show", "groups | <group name> | inq" , measurcmd_show},
|
||||
{"cpustats","[enable | disable]",measurcmd_cpustats},
|
||||
{"async","[enable | disable]",measurcmd_async},
|
||||
{"","",NULL}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user