Commit 47abf562 authored by laurent's avatar laurent

add FS6 transport time measurement

parent 08ea6180
...@@ -81,7 +81,7 @@ char *config_check_valptr(paramdef_t *cfgoptions, char **ptr, int length) { ...@@ -81,7 +81,7 @@ char *config_check_valptr(paramdef_t *cfgoptions, char **ptr, int length) {
} }
if (*ptr == NULL) { if (*ptr == NULL) {
*ptr = malloc(length); *ptr = malloc(length>40?length:40); // LTS: dummy fix, waiting Francois full fix in 4G branch
if ( *ptr != NULL) { if ( *ptr != NULL) {
memset(*ptr,0,length); memset(*ptr,0,length);
......
...@@ -82,7 +82,34 @@ static inline void updateTimesReset(uint64_t start, Meas *M, int period, bool Ma ...@@ -82,7 +82,34 @@ static inline void updateTimesReset(uint64_t start, Meas *M, int period, bool Ma
} }
} }
static inline void measTransportTime(uint64_t DuSend, uint64_t CuMicroSec, Meas *M, int period, bool MaxMin, char *txt) {
if (DuSend!=0) {
uint64_t end=rdtsc();
long long diff=(end-DuSend)/(cpuf*1000)-CuMicroSec;
LOG_E(HW, "total: %f, cu time %lu\n", (end-DuSend)/(cpuf*1000), CuMicroSec);
M->maxArray[0]=diff;
M->sum+=diff;
M->iterations++;
if ( MaxMin)
qsort(M->maxArray, 11, sizeof(uint64_t), cmpint);
else
qsort(M->maxArray, 11, sizeof(uint64_t), cmpintRev);
printMeas2(txt,M,period, MaxMin);
if (M->iterations%period == 0 ) {
bzero(M,sizeof(*M));
if (!MaxMin)
for (int i=0; i<11; i++)
M->maxArray[i]=INT_MAX;
}
}
}
#define ceil16_bytes(a) ((((a+15)/16)*16)/8) #define ceil16_bytes(a) ((((a+15)/16)*16)/8)
static void fs6Dlunpack(void *out, void *in, int szUnpacked) { static void fs6Dlunpack(void *out, void *in, int szUnpacked) {
static uint64_t *lut=NULL; static uint64_t *lut=NULL;
...@@ -1297,12 +1324,16 @@ void *DL_du_fs6(void *arg) { ...@@ -1297,12 +1324,16 @@ void *DL_du_fs6(void *arg) {
RU_t *ru=(RU_t *)arg; RU_t *ru=(RU_t *)arg;
static uint64_t lastTS; static uint64_t lastTS;
L1_rxtx_proc_t L1_proc= {0}; L1_rxtx_proc_t L1_proc= {0};
initStaticTime(begingWait);
initStaticTime(begingProcessing);
initRefTimes(fullLoop);
initRefTimes(DuHigh);
initRefTimes(DuLow);
initRefTimes(transportTime);
while (1) { while (1) {
for (int i=0; i<ru->num_eNB; i++) { for (int i=0; i<ru->num_eNB; i++) {
initBufferZone(bufferZone); initBufferZone(bufferZone);
initStaticTime(begingWait);
initRefTimes(fullLoop);
pickStaticTime(begingWait); pickStaticTime(begingWait);
int nb_blocks=receiveSubFrame(&sockFS6, bufferZone, sizeof(bufferZone), CTsentCUv0 ); int nb_blocks=receiveSubFrame(&sockFS6, bufferZone, sizeof(bufferZone), CTsentCUv0 );
updateTimesReset(begingWait, &fullLoop, 1000, false, "DU wait CU"); updateTimesReset(begingWait, &fullLoop, 1000, false, "DU wait CU");
...@@ -1313,18 +1344,22 @@ void *DL_du_fs6(void *arg) { ...@@ -1313,18 +1344,22 @@ void *DL_du_fs6(void *arg) {
lastTS+ru->eNB_list[i]->frame_parms.samples_per_tti, lastTS+ru->eNB_list[i]->frame_parms.samples_per_tti,
hUDP(bufferZone)->timestamp); hUDP(bufferZone)->timestamp);
} }
pickStaticTime(begingProcessing);
lastTS=hUDP(bufferZone)->timestamp; lastTS=hUDP(bufferZone)->timestamp;
setAllfromTS(hUDP(bufferZone)->timestamp - sf_ahead*ru->eNB_list[i]->frame_parms.samples_per_tti, &L1_proc); setAllfromTS(hUDP(bufferZone)->timestamp - sf_ahead*ru->eNB_list[i]->frame_parms.samples_per_tti, &L1_proc);
measTransportTime(hDL(bufferZone)->DuClock, hDL(bufferZone)->CuSpentMicroSec,
&transportTime, 1000, false, "Transport time, to CU + from CU for one subframe");
phy_procedures_eNB_TX_fromsplit( bufferZone, nb_blocks, ru->eNB_list[i], &L1_proc, 1); phy_procedures_eNB_TX_fromsplit( bufferZone, nb_blocks, ru->eNB_list[i], &L1_proc, 1);
updateTimesReset(begingProcessing, &DuHigh, 1000, false, "DU high layer1 processing for DL");
} else } else
LOG_E(PHY,"DL not received for subframe\n"); LOG_E(PHY,"DL not received for subframe\n");
} }
pickStaticTime(begingProcessing);
feptx_prec(ru, &L1_proc); feptx_prec(ru, &L1_proc);
feptx_ofdm(ru, &L1_proc); feptx_ofdm(ru, &L1_proc);
tx_rf(ru, &L1_proc); tx_rf(ru, &L1_proc);
updateTimesReset(begingProcessing, &DuLow, 1000, false, "DU low layer1 processing for DL");
if ( IS_SOFTMODEM_RFSIM ) if ( IS_SOFTMODEM_RFSIM )
return NULL; return NULL;
} }
...@@ -1371,7 +1406,7 @@ void UL_du_fs6(RU_t *ru, L1_rxtx_proc_t *proc) { ...@@ -1371,7 +1406,7 @@ void UL_du_fs6(RU_t *ru, L1_rxtx_proc_t *proc) {
} }
} }
void DL_cu_fs6(RU_t *ru, L1_rxtx_proc_t *proc) { void DL_cu_fs6(RU_t *ru, L1_rxtx_proc_t *proc, uint64_t DuClock, uint64_t startCycle) {
// Fixme: datamodel issue // Fixme: datamodel issue
PHY_VARS_eNB *eNB = RC.eNB[0][0]; PHY_VARS_eNB *eNB = RC.eNB[0][0];
pthread_mutex_lock(&eNB->UL_INFO_mutex); pthread_mutex_lock(&eNB->UL_INFO_mutex);
...@@ -1390,17 +1425,21 @@ void DL_cu_fs6(RU_t *ru, L1_rxtx_proc_t *proc) { ...@@ -1390,17 +1425,21 @@ void DL_cu_fs6(RU_t *ru, L1_rxtx_proc_t *proc) {
hUDP(bufferZone)->blockID=0; hUDP(bufferZone)->blockID=0;
hUDP(bufferZone)->contentBytes=sizeof(fs6_dl_t); hUDP(bufferZone)->contentBytes=sizeof(fs6_dl_t);
} }
hDL(bufferZone)->DuClock=DuClock;
hDL(bufferZone)->CuSpentMicroSec=(rdtsc()-startCycle)/(cpuf*1000);
sendSubFrame(&sockFS6, bufferZone, sizeof(fs6_dl_t), CTsentCUv0 ); sendSubFrame(&sockFS6, bufferZone, sizeof(fs6_dl_t), CTsentCUv0 );
return; return;
} }
void UL_cu_fs6(RU_t *ru, L1_rxtx_proc_t *proc, uint64_t *TS) { void UL_cu_fs6(RU_t *ru, L1_rxtx_proc_t *proc, uint64_t *TS, uint64_t * DuClock, uint64_t * startProcessing) {
initBufferZone(bufferZone); initBufferZone(bufferZone);
initStaticTime(begingWait); initStaticTime(begingWait);
initRefTimes(fullLoop); initRefTimes(fullLoop);
pickStaticTime(begingWait); pickStaticTime(begingWait);
int nb_blocks=receiveSubFrame(&sockFS6, bufferZone, sizeof(bufferZone), CTsentDUv0 ); int nb_blocks=receiveSubFrame(&sockFS6, bufferZone, sizeof(bufferZone), CTsentDUv0 );
* DuClock=hUDP(bufferZone)->senderClock;
* startProcessing=rdtsc();
updateTimesReset(begingWait, &fullLoop, 1000, false, "CU wait DU"); updateTimesReset(begingWait, &fullLoop, 1000, false, "CU wait DU");
if (nb_blocks ==0) { if (nb_blocks ==0) {
...@@ -1462,15 +1501,16 @@ void *cu_fs6(void *arg) { ...@@ -1462,15 +1501,16 @@ void *cu_fs6(void *arg) {
initRefTimes(waitDUAndProcessingUL); initRefTimes(waitDUAndProcessingUL);
initRefTimes(makeSendDL); initRefTimes(makeSendDL);
initRefTimes(fullLoop); initRefTimes(fullLoop);
uint64_t DuClock=0, startProcessing=0;
while(1) { while(1) {
timeStamp+=ru->frame_parms.samples_per_tti; timeStamp+=ru->frame_parms.samples_per_tti;
updateTimesReset(begingWait, &fullLoop, 1000, true, "CU for full SubFrame (must be less 1ms)"); updateTimesReset(begingWait, &fullLoop, 1000, true, "CU for full SubFrame (must be less 1ms)");
pickStaticTime(begingWait); pickStaticTime(begingWait);
UL_cu_fs6(ru, &L1proc, &timeStamp, &DuClock, &startProcessing);
updateTimesReset(begingWait, &waitDUAndProcessingUL, 1000, true,"CU Time in wait Rx + Ul processing"); updateTimesReset(begingWait, &waitDUAndProcessingUL, 1000, true,"CU Time in wait Rx + Ul processing");
UL_cu_fs6(ru, &L1proc, &timeStamp);
pickStaticTime(begingWait2); pickStaticTime(begingWait2);
DL_cu_fs6(ru, &L1proc); DL_cu_fs6(ru, &L1proc, DuClock, startProcessing);
updateTimesReset(begingWait2, &makeSendDL, 1000, true,"CU Time in DL build+send"); updateTimesReset(begingWait2, &makeSendDL, 1000, true,"CU Time in DL build+send");
} }
......
...@@ -613,7 +613,7 @@ void rx_rf(RU_t *ru, L1_rxtx_proc_t *proc) { ...@@ -613,7 +613,7 @@ void rx_rf(RU_t *ru, L1_rxtx_proc_t *proc) {
#endif #endif
} }
if (timestamp_rx - old_ts != fp->samples_per_tti) { if (old_ts != 0 && timestamp_rx - old_ts != fp->samples_per_tti) {
LOG_E(HW,"impossible shift in rx stream, rx: %ld, previous rx distance: %ld, should be %d\n", timestamp_rx, proc->timestamp_rx - old_ts, fp->samples_per_tti); LOG_E(HW,"impossible shift in rx stream, rx: %ld, previous rx distance: %ld, should be %d\n", timestamp_rx, proc->timestamp_rx - old_ts, fp->samples_per_tti);
//ru->ts_offset += (proc->timestamp_rx - old_ts - fp->samples_per_tti); //ru->ts_offset += (proc->timestamp_rx - old_ts - fp->samples_per_tti);
//proc->timestamp_rx = ts-ru->ts_offset; //proc->timestamp_rx = ts-ru->ts_offset;
......
...@@ -36,6 +36,7 @@ typedef struct commonUDP_s { ...@@ -36,6 +36,7 @@ typedef struct commonUDP_s {
uint16_t blockID; // id: 0..nbBocks-1 uint16_t blockID; // id: 0..nbBocks-1
uint16_t contentType; // defines the content format uint16_t contentType; // defines the content format
uint16_t contentBytes; // will be sent in a UDP packet, so must be < 2^16 bytes uint16_t contentBytes; // will be sent in a UDP packet, so must be < 2^16 bytes
uint64_t senderClock;
} commonUDP_t; } commonUDP_t;
// FS6 UL common header (DU to CU) // FS6 UL common header (DU to CU)
...@@ -57,6 +58,8 @@ typedef struct { ...@@ -57,6 +58,8 @@ typedef struct {
int num_mdci; int num_mdci;
int amp; int amp;
LTE_eNB_PHICH phich_vars; LTE_eNB_PHICH phich_vars;
uint64_t DuClock;
uint64_t CuSpentMicroSec;
} fs6_dl_t; } fs6_dl_t;
// a value to type all sub packets, // a value to type all sub packets,
......
...@@ -129,6 +129,7 @@ int receiveSubFrame(UDPsock_t *sock, void *bufferZone, int bufferSize, uint16_t ...@@ -129,6 +129,7 @@ int receiveSubFrame(UDPsock_t *sock, void *bufferZone, int bufferSize, uint16_t
int sendSubFrame(UDPsock_t *sock, void *bufferZone, ssize_t secondHeaderSize, uint16_t contentType) { int sendSubFrame(UDPsock_t *sock, void *bufferZone, ssize_t secondHeaderSize, uint16_t contentType) {
commonUDP_t *UDPheader=(commonUDP_t *)bufferZone ; commonUDP_t *UDPheader=(commonUDP_t *)bufferZone ;
UDPheader->contentType=contentType; UDPheader->contentType=contentType;
UDPheader->senderClock=rdtsc();
int nbBlocks=UDPheader->nbBlocks; int nbBlocks=UDPheader->nbBlocks;
int blockId=0; int blockId=0;
......
...@@ -29,7 +29,7 @@ typedef struct { ...@@ -29,7 +29,7 @@ typedef struct {
nfapi_mode_t nfapi_mode; nfapi_mode_t nfapi_mode;
} nfapi_params_t; } nfapi_params_t;
static nfapi_params_t nfapi_params; static nfapi_params_t nfapi_params = {0};
void set_thread_priority(int priority) { void set_thread_priority(int priority) {
//printf("%s(priority:%d)\n", __FUNCTION__, priority); //printf("%s(priority:%d)\n", __FUNCTION__, priority);
......
...@@ -98,8 +98,8 @@ int opt_enabled=0; ...@@ -98,8 +98,8 @@ int opt_enabled=0;
//static unsigned char g_PDUBuffer[1600]; //static unsigned char g_PDUBuffer[1600];
//static unsigned int g_PDUOffset; //static unsigned int g_PDUOffset;
static char *in_ip; static char in_ip[128]={0};
static char *in_path; static char in_path[128]={0};
FILE *file_fd = NULL; FILE *file_fd = NULL;
pcap_hdr_t file_header = { pcap_hdr_t file_header = {
0xa1b2c3d4, /* magic number */ 0xa1b2c3d4, /* magic number */
...@@ -450,7 +450,7 @@ int init_opt(void) { ...@@ -450,7 +450,7 @@ int init_opt(void) {
char *in_type=NULL; char *in_type=NULL;
paramdef_t opt_params[] = OPT_PARAMS_DESC ; paramdef_t opt_params[] = OPT_PARAMS_DESC ;
checkedparam_t opt_checkParams[] = OPTPARAMS_CHECK_DESC; checkedparam_t opt_checkParams[] = OPTPARAMS_CHECK_DESC;
uint16_t in_port; uint16_t in_port=0;
config_set_checkfunctions(opt_params, opt_checkParams, config_set_checkfunctions(opt_params, opt_checkParams,
sizeof(opt_params)/sizeof(paramdef_t)); sizeof(opt_params)/sizeof(paramdef_t));
config_get( opt_params,sizeof(opt_params)/sizeof(paramdef_t),OPT_CONFIGPREFIX); config_get( opt_params,sizeof(opt_params)/sizeof(paramdef_t),OPT_CONFIGPREFIX);
......
...@@ -346,7 +346,8 @@ static int rfsimulator_write_internal(rfsimulator_state_t *t, openair0_timestamp ...@@ -346,7 +346,8 @@ static int rfsimulator_write_internal(rfsimulator_state_t *t, openair0_timestamp
if ( t->lastWroteTS != 0 && abs((double)t->lastWroteTS-timestamp) > (double)CirSize) if ( t->lastWroteTS != 0 && abs((double)t->lastWroteTS-timestamp) > (double)CirSize)
LOG_E(HW,"Discontinuous TX gap too large Tx:%lu, %lu\n", t->lastWroteTS, timestamp); LOG_E(HW,"Discontinuous TX gap too large Tx:%lu, %lu\n", t->lastWroteTS, timestamp);
AssertFatal(t->lastWroteTS <= timestamp+1, " Not supported to send Tx out of order (same in USRP) %lu, %lu\n", if (t->lastWroteTS >= timestamp+1)
LOG_E(HW,"Not supported to send Tx out of order (same in USRP) %lu, %lu\n",
t->lastWroteTS, timestamp); t->lastWroteTS, timestamp);
t->lastWroteTS=timestamp+nsamps; t->lastWroteTS=timestamp+nsamps;
...@@ -420,7 +421,7 @@ static bool flushInput(rfsimulator_state_t *t, int timeout, int nsamps_for_initi ...@@ -420,7 +421,7 @@ static bool flushInput(rfsimulator_state_t *t, int timeout, int nsamps_for_initi
if ( sz < 0 ) { if ( sz < 0 ) {
if ( errno != EAGAIN ) { if ( errno != EAGAIN ) {
LOG_E(HW,"socket failed %s\n", strerror(errno)); LOG_E(HW,"socket failed %s\n", strerror(errno));
abort(); //abort();
} }
} else if ( sz == 0 ) } else if ( sz == 0 )
continue; continue;
...@@ -466,8 +467,9 @@ static bool flushInput(rfsimulator_state_t *t, int timeout, int nsamps_for_initi ...@@ -466,8 +467,9 @@ static bool flushInput(rfsimulator_state_t *t, int timeout, int nsamps_for_initi
} else if ( b->lastReceivedTS == b->th.timestamp ) { } else if ( b->lastReceivedTS == b->th.timestamp ) {
// normal case // normal case
} else { } else {
abort(); LOG_E(HW, "received data in past: current is %lu, new reception: %lu!\n", b->lastReceivedTS, b->th.timestamp);
AssertFatal(false, "received data in past: current is %lu, new reception: %lu!\n", b->lastReceivedTS, b->th.timestamp); } b->trashingPacket=true;
}
pthread_mutex_lock(&Sockmutex); pthread_mutex_lock(&Sockmutex);
......
...@@ -54,16 +54,16 @@ softmodem_params_t *get_softmodem_params(void) { ...@@ -54,16 +54,16 @@ softmodem_params_t *get_softmodem_params(void) {
} }
void get_common_options(void) { void get_common_options(void) {
uint32_t online_log_messages; uint32_t online_log_messages=0;
uint32_t glog_level ; uint32_t glog_level =0;
uint32_t start_telnetsrv; uint32_t start_telnetsrv=0;
uint32_t noS1; uint32_t noS1=0;
uint32_t nokrnmod; uint32_t nokrnmod=0;
uint32_t nonbiot; uint32_t nonbiot=0;
uint32_t rfsim; uint32_t rfsim=0;
uint32_t basicsim; uint32_t basicsim=0;
char *logmem_filename = NULL; char *logmem_filename = NULL;
uint32_t do_forms; uint32_t do_forms=0;
paramdef_t cmdline_params[] =CMDLINE_PARAMS_DESC ; paramdef_t cmdline_params[] =CMDLINE_PARAMS_DESC ;
paramdef_t cmdline_logparams[] =CMDLINE_LOGPARAMS_DESC ; paramdef_t cmdline_logparams[] =CMDLINE_LOGPARAMS_DESC ;
checkedparam_t cmdline_log_CheckParams[] = CMDLINE_LOGPARAMS_CHECK_DESC; checkedparam_t cmdline_log_CheckParams[] = CMDLINE_LOGPARAMS_CHECK_DESC;
......
...@@ -320,13 +320,13 @@ void exit_function(const char *file, const char *function, const int line, const ...@@ -320,13 +320,13 @@ void exit_function(const char *file, const char *function, const int line, const
extern int16_t dlsch_demod_shift; extern int16_t dlsch_demod_shift;
static void get_options(void) { static void get_options(void) {
int CC_id; int CC_id=0;
int tddflag; int tddflag=0;
char *loopfile=NULL; char *loopfile=NULL;
int dumpframe=0; int dumpframe=0;
int timingadv; int timingadv=0;
uint8_t nfapi_mode; uint8_t nfapi_mode=0;
int simL1flag ; int simL1flag =0;
set_default_frame_parms(frame_parms); set_default_frame_parms(frame_parms);
CONFIG_SETRTFLAG(CONFIG_NOEXITONHELP); CONFIG_SETRTFLAG(CONFIG_NOEXITONHELP);
/* unknown parameters on command line will be checked in main /* unknown parameters on command line will be checked in main
......
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