Commit e6e9ea28 authored by Haruki NAOI's avatar Haruki NAOI

Merge remote-tracking branch 'remotes/origin/develop_candidate_2020.07' into develop

parents db11d692 faa143d3
...@@ -92,7 +92,11 @@ int write_file_matlab(const char *fname,const char *vname,void *data,int length, ...@@ -92,7 +92,11 @@ int write_file_matlab(const char *fname,const char *vname,void *data,int length,
return -1; return -1;
//printf("Writing %d elements of type %d to %s\n",length,format,fname); //printf("Writing %d elements of type %d to %s\n",length,format,fname);
if(-1 == (access(fname,F_OK))){
creat(fname, 0644);
}else{
chmod(fname, 0644);
}
if (format == 10 || format ==11 || format == 12 || format == 13 || format == 14) { if (format == 10 || format ==11 || format == 12 || format == 13 || format == 14) {
fp = fopen(fname,"a+"); fp = fopen(fname,"a+");
} else if (format != 10 && format !=11 && format != 12 && format != 13 && format != 14) { } else if (format != 10 && format !=11 && format != 12 && format != 13 && format != 14) {
...@@ -569,6 +573,11 @@ void set_glog_filelog(int enable) { ...@@ -569,6 +573,11 @@ void set_glog_filelog(int enable) {
static FILE *fptr; static FILE *fptr;
if ( enable ) { if ( enable ) {
if(-1 == (access(g_log->filelog_name,F_OK))){
creat(g_log->filelog_name, 0644);
}else{
chmod(g_log->filelog_name, 0644);
}
fptr = fopen(g_log->filelog_name,"w"); fptr = fopen(g_log->filelog_name,"w");
for (int c=0; c< MAX_LOG_COMPONENTS; c++ ) { for (int c=0; c< MAX_LOG_COMPONENTS; c++ ) {
...@@ -591,6 +600,11 @@ void set_glog_filelog(int enable) { ...@@ -591,6 +600,11 @@ void set_glog_filelog(int enable) {
void set_component_filelog(int comp) { void set_component_filelog(int comp) {
if (g_log->log_component[comp].stream == NULL || g_log->log_component[comp].stream == stdout) { if (g_log->log_component[comp].stream == NULL || g_log->log_component[comp].stream == stdout) {
if(-1 == (access(g_log->log_component[comp].filelog_name,F_OK))){
creat(g_log->log_component[comp].filelog_name, 0644);
}else{
chmod(g_log->log_component[comp].filelog_name, 0644);
}
g_log->log_component[comp].stream = fopen(g_log->log_component[comp].filelog_name,"w"); g_log->log_component[comp].stream = fopen(g_log->log_component[comp].filelog_name,"w");
} }
...@@ -693,7 +707,7 @@ void flush_mem_to_file(void) ...@@ -693,7 +707,7 @@ void flush_mem_to_file(void)
printf("log over write!!!\n"); printf("log over write!!!\n");
} }
snprintf(f_name,1024, "%s_%d.log",log_mem_filename,log_mem_file_cnt); snprintf(f_name,1024, "%s_%d.log",log_mem_filename,log_mem_file_cnt);
fp=open(f_name, O_WRONLY | O_CREAT, 0666); fp=open(f_name, O_WRONLY | O_CREAT, 0644);
if(fp==-1){ if(fp==-1){
fprintf(stderr,"{LOG} %s %d Couldn't file open in %s \n",__FILE__,__LINE__,f_name); fprintf(stderr,"{LOG} %s %d Couldn't file open in %s \n",__FILE__,__LINE__,f_name);
}else{ }else{
...@@ -902,7 +916,7 @@ void close_log_mem(void){ ...@@ -902,7 +916,7 @@ void close_log_mem(void){
} }
if(log_mem_multi==1){ if(log_mem_multi==1){
snprintf(f_name,1024, "%s_%d.log",log_mem_filename,log_mem_file_cnt); snprintf(f_name,1024, "%s_%d.log",log_mem_filename,log_mem_file_cnt);
fp=open(f_name, O_WRONLY | O_CREAT, 0666); fp=open(f_name, O_WRONLY | O_CREAT, 0644);
int ret = write(fp, log_mem_d[0].buf_p, log_mem_d[0].buf_index); int ret = write(fp, log_mem_d[0].buf_p, log_mem_d[0].buf_index);
if ( ret < 0) { if ( ret < 0) {
fprintf(stderr,"{LOG} %s %d Couldn't write in %s \n",__FILE__,__LINE__,f_name); fprintf(stderr,"{LOG} %s %d Couldn't write in %s \n",__FILE__,__LINE__,f_name);
...@@ -912,7 +926,7 @@ void close_log_mem(void){ ...@@ -912,7 +926,7 @@ void close_log_mem(void){
free(log_mem_d[0].buf_p); free(log_mem_d[0].buf_p);
snprintf(f_name,1024, "%s_%d.log",log_mem_filename,log_mem_file_cnt); snprintf(f_name,1024, "%s_%d.log",log_mem_filename,log_mem_file_cnt);
fp=open(f_name, O_WRONLY | O_CREAT, 0666); fp=open(f_name, O_WRONLY | O_CREAT, 0644);
ret = write(fp, log_mem_d[1].buf_p, log_mem_d[1].buf_index); ret = write(fp, log_mem_d[1].buf_p, log_mem_d[1].buf_index);
if ( ret < 0) { if ( ret < 0) {
fprintf(stderr,"{LOG} %s %d Couldn't write in %s \n",__FILE__,__LINE__,f_name); fprintf(stderr,"{LOG} %s %d Couldn't write in %s \n",__FILE__,__LINE__,f_name);
...@@ -921,7 +935,7 @@ void close_log_mem(void){ ...@@ -921,7 +935,7 @@ void close_log_mem(void){
close(fp); close(fp);
free(log_mem_d[1].buf_p); free(log_mem_d[1].buf_p);
}else{ }else{
fp=open(log_mem_filename, O_WRONLY | O_CREAT, 0666); fp=open(log_mem_filename, O_WRONLY | O_CREAT, 0644);
int ret = write(fp, log_mem_d[0].buf_p, log_mem_d[0].buf_index); int ret = write(fp, log_mem_d[0].buf_p, log_mem_d[0].buf_index);
if ( ret < 0) { if ( ret < 0) {
fprintf(stderr,"{LOG} %s %d Couldn't write in %s \n",__FILE__,__LINE__,log_mem_filename); fprintf(stderr,"{LOG} %s %d Couldn't write in %s \n",__FILE__,__LINE__,log_mem_filename);
......
...@@ -42,6 +42,7 @@ ...@@ -42,6 +42,7 @@
#include <error.h> #include <error.h>
#include <time.h> #include <time.h>
#include <unistd.h> #include <unistd.h>
#include <sys/stat.h>
#include "assertions.h" #include "assertions.h"
...@@ -696,6 +697,11 @@ void vcd_signal_dumper_init(char *filename) ...@@ -696,6 +697,11 @@ void vcd_signal_dumper_init(char *filename)
if (ouput_vcd) { if (ouput_vcd) {
// char filename[] = "/tmp/openair_vcd_dump.vcd"; // char filename[] = "/tmp/openair_vcd_dump.vcd";
if(-1 == (access(filename,F_OK))){
creat(filename, 0644);
}else{
chmod(filename, 0644);
}
if ((vcd_fd = fopen(filename, "w+")) == NULL) { if ((vcd_fd = fopen(filename, "w+")) == NULL) {
perror("vcd_signal_dumper_init: cannot open file"); perror("vcd_signal_dumper_init: cannot open file");
return; return;
......
...@@ -3,6 +3,9 @@ ...@@ -3,6 +3,9 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
char **unique_ids; char **unique_ids;
int unique_ids_size; int unique_ids_size;
...@@ -175,6 +178,11 @@ int main(int n, char **v) { ...@@ -175,6 +178,11 @@ int main(int n, char **v) {
exit(1); exit(1);
} }
if(-1 == (access(out_name,F_OK))){
creat(out_name, 0644);
}else{
chmod(out_name, 0644);
}
out = fopen(out_name, "w"); out = fopen(out_name, "w");
if (out == NULL) { if (out == NULL) {
......
...@@ -30,7 +30,7 @@ int main(int argc, char *argv[]) { ...@@ -30,7 +30,7 @@ int main(int argc, char *argv[]) {
exit(1); exit(1);
} }
mkfifo(argv[1],0666); mkfifo(argv[1],0644);
int fd=open(argv[1], O_RDONLY); int fd=open(argv[1], O_RDONLY);
if ( fd == -1 ) { if ( fd == -1 ) {
......
...@@ -98,7 +98,7 @@ void initTpool(char *params,tpool_t *pool, bool performanceMeas) { ...@@ -98,7 +98,7 @@ void initTpool(char *params,tpool_t *pool, bool performanceMeas) {
pool->measurePerf=measr!=NULL; pool->measurePerf=measr!=NULL;
if (measr) { if (measr) {
mkfifo(measr,0666); mkfifo(measr,0644);
AssertFatal(-1 != (pool->dummyTraceFd= AssertFatal(-1 != (pool->dummyTraceFd=
open(measr, O_RDONLY| O_NONBLOCK)),""); open(measr, O_RDONLY| O_NONBLOCK)),"");
AssertFatal(-1 != (pool->traceFd= AssertFatal(-1 != (pool->traceFd=
......
...@@ -359,12 +359,19 @@ int wake_eNB_rxtx(PHY_VARS_eNB *eNB, uint16_t sfn, uint16_t sf) { ...@@ -359,12 +359,19 @@ int wake_eNB_rxtx(PHY_VARS_eNB *eNB, uint16_t sfn, uint16_t sf) {
exit_fun( "error locking mutex_rxtx" ); exit_fun( "error locking mutex_rxtx" );
return(-1); return(-1);
} }
static int busy_log_cnt=0;
if(L1_proc->instance_cnt < 0){ if(L1_proc->instance_cnt < 0){
++L1_proc->instance_cnt; ++L1_proc->instance_cnt;
if(busy_log_cnt!=0){
LOG_E(MAC,"RCC singal to rxtx frame %d subframe %d busy end %d (frame %d subframe %d)\n",L1_proc->frame_rx,L1_proc->subframe_rx,busy_log_cnt,proc->frame_rx,proc->subframe_rx);
}
busy_log_cnt=0;
}else{ }else{
LOG_E(MAC,"RCC singal to rxtx frame %d subframe %d busy %d (frame %d subframe %d)\n",L1_proc->frame_rx,L1_proc->subframe_rx,L1_proc->instance_cnt,proc->frame_rx,proc->subframe_rx); if(busy_log_cnt==0){
LOG_E(MAC,"RCC singal to rxtx frame %d subframe %d busy %d (frame %d subframe %d)\n",L1_proc->frame_rx,L1_proc->subframe_rx,L1_proc->instance_cnt,proc->frame_rx,proc->subframe_rx);
}
pthread_mutex_unlock( &L1_proc->mutex ); pthread_mutex_unlock( &L1_proc->mutex );
busy_log_cnt++;
return(0); return(0);
} }
......
...@@ -331,6 +331,11 @@ void dump_prach_config(LTE_DL_FRAME_PARMS *frame_parms,uint8_t subframe) ...@@ -331,6 +331,11 @@ void dump_prach_config(LTE_DL_FRAME_PARMS *frame_parms,uint8_t subframe)
FILE *fd; FILE *fd;
if(-1 == (access("prach_config.txt",F_OK))){
creat("prach_config.txt", 0644);
}else{
chmod("prach_config.txt", 0644);
}
fd = fopen("prach_config.txt","w"); fd = fopen("prach_config.txt","w");
fprintf(fd,"prach_config: subframe = %d\n",subframe); fprintf(fd,"prach_config: subframe = %d\n",subframe);
fprintf(fd,"prach_config: N_RB_UL = %d\n",frame_parms->N_RB_UL); fprintf(fd,"prach_config: N_RB_UL = %d\n",frame_parms->N_RB_UL);
......
...@@ -52,8 +52,19 @@ int16_t find_uci(uint16_t rnti, int frame, int subframe, PHY_VARS_eNB *eNB,find_ ...@@ -52,8 +52,19 @@ int16_t find_uci(uint16_t rnti, int frame, int subframe, PHY_VARS_eNB *eNB,find_
(eNB->uci_vars[i].subframe==subframe)) return(i); (eNB->uci_vars[i].subframe==subframe)) return(i);
else if ((eNB->uci_vars[i].active == 0) && (first_free_index==-1)) first_free_index=i; else if ((eNB->uci_vars[i].active == 0) && (first_free_index==-1)) first_free_index=i;
} }
if (type == SEARCH_EXIST) return(-1); if (type == SEARCH_EXIST){
else return(first_free_index); LOG_E(PHY, "find_uci find_type is SEARCH_EXIST , return -1\n");
return(-1);
}
else{
if(first_free_index < 0){
LOG_E(PHY, "find_uci first_free_index = %d,rnti = %d,frame = %d,subframe = %d, last i = %d\n",first_free_index,rnti,frame,subframe, i);
for (i=0; i<NUMBER_OF_UCI_VARS_MAX; i++) {
LOG_T(PHY, "eNB->uci_vars[%d]\tactive = %d\trnti = %x\tframe = %d\tsubframe = %d\t type %d\n",i,eNB->uci_vars[i].active,eNB->uci_vars[i].rnti,eNB->uci_vars[i].frame,eNB->uci_vars[i].subframe,eNB->uci_vars[i].type);
}
}
return(first_free_index);
}
} }
......
...@@ -45,7 +45,6 @@ ...@@ -45,7 +45,6 @@
//extern int **ulchmag_eren; //extern int **ulchmag_eren;
//eren //eren
static short jitter[8] __attribute__ ((aligned(16))) = {1,0,0,1,0,1,1,0};
static short jitterc[8] __attribute__ ((aligned(16))) = {0,1,1,0,1,0,0,1}; static short jitterc[8] __attribute__ ((aligned(16))) = {0,1,1,0,1,0,0,1};
void lte_idft(LTE_DL_FRAME_PARMS *frame_parms,uint32_t *z, uint16_t Msc_PUSCH) void lte_idft(LTE_DL_FRAME_PARMS *frame_parms,uint32_t *z, uint16_t Msc_PUSCH)
...@@ -809,6 +808,8 @@ void ulsch_channel_compensation(int32_t **rxdataF_ext, ...@@ -809,6 +808,8 @@ void ulsch_channel_compensation(int32_t **rxdataF_ext,
uint8_t aarx;//,symbol_mod; uint8_t aarx;//,symbol_mod;
__m128i mmtmpU0,mmtmpU1,mmtmpU2,mmtmpU3; __m128i mmtmpU0,mmtmpU1,mmtmpU2,mmtmpU3;
static short ref_min[8] __attribute__ ((aligned(16))) = {SHRT_MIN ,SHRT_MIN ,SHRT_MIN ,SHRT_MIN ,SHRT_MIN ,SHRT_MIN ,SHRT_MIN ,SHRT_MIN };
#elif defined(__arm__) #elif defined(__arm__)
int16x4_t *ul_ch128,*rxdataF128; int16x4_t *ul_ch128,*rxdataF128;
...@@ -819,7 +820,7 @@ void ulsch_channel_compensation(int32_t **rxdataF_ext, ...@@ -819,7 +820,7 @@ void ulsch_channel_compensation(int32_t **rxdataF_ext,
int16_t conj[4]__attribute__((aligned(16))) = {1,-1,1,-1}; int16_t conj[4]__attribute__((aligned(16))) = {1,-1,1,-1};
int32x4_t output_shift128 = vmovq_n_s32(-(int32_t)output_shift); int32x4_t output_shift128 = vmovq_n_s32(-(int32_t)output_shift);
static short ref_min[8] __attribute__ ((aligned(16))) = {SHRT_MIN ,SHRT_MIN ,SHRT_MIN ,SHRT_MIN ,SHRT_MIN ,SHRT_MIN ,SHRT_MIN ,SHRT_MIN };
#endif #endif
...@@ -952,9 +953,9 @@ void ulsch_channel_compensation(int32_t **rxdataF_ext, ...@@ -952,9 +953,9 @@ void ulsch_channel_compensation(int32_t **rxdataF_ext,
// print_shorts("pack:",rxdataF_comp128[2]); // print_shorts("pack:",rxdataF_comp128[2]);
// Add a jitter to compensate for the saturation in "packs" resulting in a bias on the DC after IDFT // Add a jitter to compensate for the saturation in "packs" resulting in a bias on the DC after IDFT
rxdataF_comp128[0] = _mm_add_epi16(rxdataF_comp128[0],(*(__m128i*)&jitter[0])); rxdataF_comp128[0] = _mm_subs_epi16(rxdataF_comp128[0], _mm_cmpeq_epi16(rxdataF_comp128[0],(*(__m128i*)&ref_min[0])));
rxdataF_comp128[1] = _mm_add_epi16(rxdataF_comp128[1],(*(__m128i*)&jitter[0])); rxdataF_comp128[1] = _mm_subs_epi16(rxdataF_comp128[1], _mm_cmpeq_epi16(rxdataF_comp128[1],(*(__m128i*)&ref_min[0])));
rxdataF_comp128[2] = _mm_add_epi16(rxdataF_comp128[2],(*(__m128i*)&jitter[0])); rxdataF_comp128[2] = _mm_subs_epi16(rxdataF_comp128[2], _mm_cmpeq_epi16(rxdataF_comp128[2],(*(__m128i*)&ref_min[0])));
ul_ch128+=3; ul_ch128+=3;
ul_ch_mag128+=3; ul_ch_mag128+=3;
...@@ -1009,10 +1010,9 @@ void ulsch_channel_compensation(int32_t **rxdataF_ext, ...@@ -1009,10 +1010,9 @@ void ulsch_channel_compensation(int32_t **rxdataF_ext,
rxdataF_comp128[2] = vcombine_s16(vmovn_s32(mmtmpU0),vmovn_s32(mmtmpU1)); rxdataF_comp128[2] = vcombine_s16(vmovn_s32(mmtmpU0),vmovn_s32(mmtmpU1));
// Add a jitter to compensate for the saturation in "packs" resulting in a bias on the DC after IDFT // Add a jitter to compensate for the saturation in "packs" resulting in a bias on the DC after IDFT
rxdataF_comp128[0] = vqaddq_s16(rxdataF_comp128[0],(*(int16x8_t*)&jitter[0])); rxdataF_comp128[0] = vqsubq_s16(rxdataF_comp128[0], vceqq_s16(rxdataF_comp128[0],(*(int16x8_t*)&ref_min[0])));
rxdataF_comp128[1] = vqaddq_s16(rxdataF_comp128[1],(*(int16x8_t*)&jitter[0])); rxdataF_comp128[1] = vqsubq_s16(rxdataF_comp128[1], vceqq_s16(rxdataF_comp128[1],(*(int16x8_t*)&ref_min[0])));
rxdataF_comp128[2] = vqaddq_s16(rxdataF_comp128[2],(*(int16x8_t*)&jitter[0])); rxdataF_comp128[2] = vqsubq_s16(rxdataF_comp128[2], vceqq_s16(rxdataF_comp128[1],(*(int16x8_t*)&ref_min[0])));
ul_ch128+=6; ul_ch128+=6;
ul_ch_mag128+=3; ul_ch_mag128+=3;
...@@ -1152,7 +1152,10 @@ void rx_ulsch(PHY_VARS_eNB *eNB, ...@@ -1152,7 +1152,10 @@ void rx_ulsch(PHY_VARS_eNB *eNB,
LOG_E(PHY, "PUSCH (%d/%x) nb_rb=0!\n", harq_pid,ulsch[UE_id]->rnti); LOG_E(PHY, "PUSCH (%d/%x) nb_rb=0!\n", harq_pid,ulsch[UE_id]->rnti);
return; return;
} }
short *rxF_ext;
int re;
double ave_power=0;
int shift=0;
for (l=0; l<(frame_parms->symbols_per_tti-ulsch[UE_id]->harq_processes[harq_pid]->srs_active); l++) { for (l=0; l<(frame_parms->symbols_per_tti-ulsch[UE_id]->harq_processes[harq_pid]->srs_active); l++) {
if(LOG_DEBUGFLAG(DEBUG_ULSCH)) { if(LOG_DEBUGFLAG(DEBUG_ULSCH)) {
...@@ -1170,6 +1173,28 @@ void rx_ulsch(PHY_VARS_eNB *eNB, ...@@ -1170,6 +1173,28 @@ void rx_ulsch(PHY_VARS_eNB *eNB,
l%(frame_parms->symbols_per_tti/2), l%(frame_parms->symbols_per_tti/2),
l/(frame_parms->symbols_per_tti/2), l/(frame_parms->symbols_per_tti/2),
frame_parms); frame_parms);
for(re=0;re<ulsch[UE_id]->harq_processes[harq_pid]->nb_rb*12;re++){
rxF_ext = (short*)&pusch_vars->rxdataF_ext[0][(l*frame_parms->N_RB_UL*12)+re];
ave_power+=rxF_ext[0]*rxF_ext[0]+rxF_ext[1]*rxF_ext[1];
}
}
ave_power/=(double)(ulsch[UE_id]->harq_processes[harq_pid]->nb_rb*12*(frame_parms->symbols_per_tti-ulsch[UE_id]->harq_processes[harq_pid]->srs_active));
LOG_D(PHY,"rxF_ext ave %lf\n",sqrt(ave_power));
if(ave_power>1.0){
shift = 3 - (int)log2(sqrt((double)ave_power));
}
if(shift>0){
short * temp_iq;
for(i=0;i<frame_parms->symbols_per_tti*frame_parms->ofdm_symbol_size;i++){
temp_iq=(short*)&pusch_vars->rxdataF_ext[0][i];
temp_iq[0]<<=shift;
temp_iq[1]<<=shift;
}
}else{
shift=0;
}
for (l=0; l<(frame_parms->symbols_per_tti-ulsch[UE_id]->harq_processes[harq_pid]->srs_active); l++) {
if (lte_ul_channel_estimation(eNB,proc, if (lte_ul_channel_estimation(eNB,proc,
UE_id, UE_id,
...@@ -1211,6 +1236,8 @@ void rx_ulsch(PHY_VARS_eNB *eNB, ...@@ -1211,6 +1236,8 @@ void rx_ulsch(PHY_VARS_eNB *eNB,
pusch_vars->ulsch_interference_power[i] = pusch_vars->ulsch_interference_power[i]/correction_factor; pusch_vars->ulsch_interference_power[i] = pusch_vars->ulsch_interference_power[i]/correction_factor;
pusch_vars->ulsch_power[i] = pusch_vars->ulsch_power[i]/correction_factor; pusch_vars->ulsch_power[i] = pusch_vars->ulsch_power[i]/correction_factor;
pusch_vars->ulsch_power[i] /= pow(4,shift);
pusch_vars->ulsch_interference_power[i] /= pow(4,shift);
if(pusch_vars->ulsch_power[i]>0x20000000){ if(pusch_vars->ulsch_power[i]>0x20000000){
pusch_vars->ulsch_power[i] = 0x20000000; pusch_vars->ulsch_power[i] = 0x20000000;
pusch_vars->ulsch_interference_power[i] = 1; pusch_vars->ulsch_interference_power[i] = 1;
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#define shift 4 #define shift 4
//#define shift_DC 0 //#define shift_DC 0
#define SHRT_MIN -32768
#if defined(__x86_64__) || defined(__i386__) #if defined(__x86_64__) || defined(__i386__)
#ifdef LOCALIZATION #ifdef LOCALIZATION
...@@ -67,110 +68,171 @@ int32_t subcarrier_energy(int32_t *input,uint32_t length, int32_t *subcarrier_en ...@@ -67,110 +68,171 @@ int32_t subcarrier_energy(int32_t *input,uint32_t length, int32_t *subcarrier_en
} }
#endif #endif
//int32_t signal_energy(int32_t *input,uint32_t length)
//{
//
// int32_t i;
// int32_t temp,temp2;
// register __m64 mm0,mm1,mm2,mm3;
// __m64 *in = (__m64 *)input;
//
//
// mm0 = _mm_setzero_si64();//pxor(mm0,mm0);
// mm3 = _mm_setzero_si64();//pxor(mm3,mm3);
//
// for (i=0; i<length>>1; i++) {
//
// mm1 = in[i];
// mm2 = mm1;
// mm1 = _m_pmaddwd(mm1,mm1);
// mm1 = _m_psradi(mm1,shift);// shift any 32 bits blocs of the word by the value shift
// mm0 = _m_paddd(mm0,mm1);// add the two 64 bits words 4 bytes by 4 bytes
// // mm2 = _m_psrawi(mm2,shift_DC);
// mm3 = _m_paddw(mm3,mm2);// add the two 64 bits words 2 bytes by 2 bytes
// }
//
// mm1 = mm0;
// mm0 = _m_psrlqi(mm0,32);
// mm0 = _m_paddd(mm0,mm1);
// temp = _m_to_int(mm0);
// temp/=length;
// temp<<=shift; // this is the average of x^2
//
// // now remove the DC component
//
//
// mm2 = _m_psrlqi(mm3,32);
// mm2 = _m_paddw(mm2,mm3);
// mm2 = _m_pmaddwd(mm2,mm2);
// temp2 = _m_to_int(mm2);
// temp2/=(length*length);
// // temp2<<=(2*shift_DC);
// temp -= temp2;
//
// _mm_empty();
// _m_empty();
//
// return((temp>0)?temp:1);
//-----------------------------------------------------------------
// Average Power calculation with DC removing
//-----------------------------------------------------------------
int32_t signal_energy(int32_t *input,uint32_t length) int32_t signal_energy(int32_t *input,uint32_t length)
{ {
uint32_t i;
int32_t i; int32_t temp;
int32_t temp,temp2; __m128i in, in_clp, i16_min, coe1;
register __m64 mm0,mm1,mm2,mm3; __m128 num0, num1, num2, num3, recp1;
__m64 *in = (__m64 *)input;
//init
num0 = _mm_setzero_ps();
mm0 = _mm_setzero_si64();//pxor(mm0,mm0); num1 = _mm_setzero_ps();
mm3 = _mm_setzero_si64();//pxor(mm3,mm3); i16_min = _mm_set1_epi16(SHRT_MIN);
coe1 = _mm_set1_epi16(1);
for (i=0; i<length>>1; i++) { recp1 = _mm_rcp_ps(_mm_cvtepi32_ps(_mm_set1_epi32(length)));
mm1 = in[i]; //Acc
mm2 = mm1; for (i = 0; i < (length >> 2); i++) {
mm1 = _m_pmaddwd(mm1,mm1); in = _mm_loadu_si128((__m128i *)input);
mm1 = _m_psradi(mm1,shift);// shift any 32 bits blocs of the word by the value shift in_clp = _mm_subs_epi16(in, _mm_cmpeq_epi16(in, i16_min));//if in=SHRT_MIN in+1, else in
mm0 = _m_paddd(mm0,mm1);// add the two 64 bits words 4 bytes by 4 bytes num0 = _mm_add_ps(num0, _mm_cvtepi32_ps(_mm_madd_epi16(in_clp, in_clp)));
// mm2 = _m_psrawi(mm2,shift_DC); num1 = _mm_add_ps(num1, _mm_cvtepi32_ps(_mm_madd_epi16(in, coe1)));//DC
mm3 = _m_paddw(mm3,mm2);// add the two 64 bits words 2 bytes by 2 bytes input += 4;
} }
//Ave
num2 = _mm_dp_ps(num0, recp1, 0xFF);//AC power
num3 = _mm_dp_ps(num1, recp1, 0xFF);//DC
num3 = _mm_mul_ps(num3, num3); //DC power
//remove DC
temp = _mm_cvtsi128_si32(_mm_cvttps_epi32(_mm_sub_ps(num2, num3)));
mm1 = mm0; return temp;
mm0 = _m_psrlqi(mm0,32);
mm0 = _m_paddd(mm0,mm1);
temp = _m_to_int(mm0);
temp/=length;
temp<<=shift; // this is the average of x^2
// now remove the DC component
mm2 = _m_psrlqi(mm3,32);
mm2 = _m_paddw(mm2,mm3);
mm2 = _m_pmaddwd(mm2,mm2);
temp2 = _m_to_int(mm2);
temp2/=(length*length);
// temp2<<=(2*shift_DC);
temp -= temp2;
_mm_empty();
_m_empty();
return((temp>0)?temp:1);
} }
int32_t signal_energy_nodc(int32_t *input,uint32_t length) int32_t signal_energy_nodc(int32_t *input,uint32_t length)
{ {
int32_t i; // int32_t i;
int32_t temp; // int32_t temp;
register __m64 mm0,mm1;//,mm2,mm3; // register __m64 mm0,mm1;//,mm2,mm3;
__m64 *in = (__m64 *)input; // __m64 *in = (__m64 *)input;
//
//#ifdef MAIN
// int16_t *printb;
//#endif
//
// mm0 = _mm_setzero_si64();//_pxor(mm0,mm0);
// // mm3 = _mm_setzero_si64();//pxor(mm3,mm3);
//
// for (i=0; i<length>>1; i++) {
//
// mm1 = in[i];
// mm1 = _m_pmaddwd(mm1,mm1);// SIMD complex multiplication
// mm1 = _m_psradi(mm1,shift);
// mm0 = _m_paddd(mm0,mm1);
// // temp2 = mm0;
// // printf("%d %d\n",((int *)&in[i])[0],((int *)&in[i])[1]);
//
//
// // printb = (int16_t *)&mm2;
// // printf("mm2 %d : %d %d %d %d\n",i,printb[0],printb[1],printb[2],printb[3]);
//
//
// }
//
// /*
// #ifdef MAIN
// printb = (int16_t *)&mm3;
// printf("%d %d %d %d\n",printb[0],printb[1],printb[2],printb[3]);
// #endif
// */
// mm1 = mm0;
//
// mm0 = _m_psrlqi(mm0,32);
//
// mm0 = _m_paddd(mm0,mm1);
//
// temp = _m_to_int(mm0);
//
// temp/=length;
// temp<<=shift; // this is the average of x^2
//
//#ifdef MAIN
// printf("E x^2 = %d\n",temp);
//#endif
// _mm_empty();
// _m_empty();
//
//
//
// return((temp>0)?temp:1);
#ifdef MAIN
int16_t *printb;
#endif
mm0 = _mm_setzero_si64();//_pxor(mm0,mm0);
// mm3 = _mm_setzero_si64();//pxor(mm3,mm3);
for (i=0; i<length>>1; i++) {
mm1 = in[i]; int32_t i;
mm1 = _m_pmaddwd(mm1,mm1);// SIMD complex multiplication int32_t temp;
mm1 = _m_psradi(mm1,shift);
mm0 = _m_paddd(mm0,mm1);
// temp2 = mm0;
// printf("%d %d\n",((int *)&in[i])[0],((int *)&in[i])[1]);
// printb = (int16_t *)&mm2;
// printf("mm2 %d : %d %d %d %d\n",i,printb[0],printb[1],printb[2],printb[3]);
__m128i in;
__m128 mm0;
//init
mm0 = _mm_setzero_ps();
//Acc
for (i=0; i<(length>>2); i++) {
in = _mm_loadu_si128((__m128i *)input);
mm0 = _mm_add_ps(mm0,_mm_cvtepi32_ps(_mm_madd_epi16(in,in)));
input += 4;
} }
//Ave
temp = (int)((((float*)&mm0)[0] +
((float*)&mm0)[1] +
((float*)&mm0)[2] +
((float*)&mm0)[3])/(float)length);
/* return temp;
#ifdef MAIN
printb = (int16_t *)&mm3;
printf("%d %d %d %d\n",printb[0],printb[1],printb[2],printb[3]);
#endif
*/
mm1 = mm0;
mm0 = _m_psrlqi(mm0,32);
mm0 = _m_paddd(mm0,mm1);
temp = _m_to_int(mm0);
temp/=length;
temp<<=shift; // this is the average of x^2
#ifdef MAIN
printf("E x^2 = %d\n",temp);
#endif
_mm_empty();
_m_empty();
return((temp>0)?temp:1);
} }
#elif defined(__arm__) #elif defined(__arm__)
......
...@@ -1062,11 +1062,25 @@ if (NFAPI_MODE!=NFAPI_MODE_VNF) ...@@ -1062,11 +1062,25 @@ if (NFAPI_MODE!=NFAPI_MODE_VNF)
if (NFAPI_MODE!=NFAPI_MONOLITHIC) { if (NFAPI_MODE!=NFAPI_MONOLITHIC) {
if (number_ul_pdu>0) { if (number_ul_pdu>0) {
uint8_t ulsch_pdu_num = 0;
for (i=0; i<number_ul_pdu; i++) {
if((UL_req->ul_config_request_body.ul_config_pdu_list[i].pdu_type == NFAPI_UL_CONFIG_ULSCH_PDU_TYPE) ||
(UL_req->ul_config_request_body.ul_config_pdu_list[i].pdu_type == NFAPI_UL_CONFIG_ULSCH_CQI_RI_PDU_TYPE) ||
(UL_req->ul_config_request_body.ul_config_pdu_list[i].pdu_type == NFAPI_UL_CONFIG_ULSCH_HARQ_PDU_TYPE) ||
(UL_req->ul_config_request_body.ul_config_pdu_list[i].pdu_type == NFAPI_UL_CONFIG_ULSCH_CQI_HARQ_RI_PDU_TYPE)){
ulsch_pdu_num++;
}
}
if(ulsch_pdu_num <= RC.rrc[Mod_id]->configuration.radioresourceconfig[CC_id].ue_multiple_max){
//LOG_D(PHY, "UL_CONFIG to send to PNF\n"); //LOG_D(PHY, "UL_CONFIG to send to PNF\n");
UL_req->sfn_sf = frame << 4 | subframe; UL_req->sfn_sf = frame << 4 | subframe;
oai_nfapi_ul_config_req(UL_req); oai_nfapi_ul_config_req(UL_req);
UL_req->ul_config_request_body.number_of_pdus=0; UL_req->ul_config_request_body.number_of_pdus=0;
number_ul_pdu=0; number_ul_pdu=0;
}else{
LOG_E(MAC,"NFAPI: frame %d subframe %d ul_req num %d ul pdu %d\n",
frame,subframe,number_ul_pdu,ulsch_pdu_num);
}
} }
} else { } else {
for (i=0; i<number_ul_pdu; i++) { for (i=0; i<number_ul_pdu; i++) {
......
...@@ -297,6 +297,7 @@ bool dlsch_procedures(PHY_VARS_eNB *eNB, ...@@ -297,6 +297,7 @@ bool dlsch_procedures(PHY_VARS_eNB *eNB,
if (dlsch_harq->pdu==NULL) { if (dlsch_harq->pdu==NULL) {
LOG_E(PHY,"dlsch_harq->pdu == NULL SFN/SF:%04d%d dlsch[rnti:%x] dlsch_harq[pdu:%p pdsch_start:%d Qm:%d Nl:%d round:%d nb_rb:%d rb_alloc[0]:%d]\n", frame,subframe,dlsch->rnti, dlsch_harq->pdu, LOG_E(PHY,"dlsch_harq->pdu == NULL SFN/SF:%04d%d dlsch[rnti:%x] dlsch_harq[pdu:%p pdsch_start:%d Qm:%d Nl:%d round:%d nb_rb:%d rb_alloc[0]:%d]\n", frame,subframe,dlsch->rnti, dlsch_harq->pdu,
dlsch_harq->pdsch_start,dlsch_harq->Qm,dlsch_harq->Nl,dlsch_harq->round,dlsch_harq->nb_rb,dlsch_harq->rb_alloc[0]); dlsch_harq->pdsch_start,dlsch_harq->Qm,dlsch_harq->Nl,dlsch_harq->round,dlsch_harq->nb_rb,dlsch_harq->rb_alloc[0]);
dlsch->active[subframe] = 0;
return false; return false;
} }
...@@ -871,6 +872,7 @@ uci_procedures(PHY_VARS_eNB *eNB, ...@@ -871,6 +872,7 @@ uci_procedures(PHY_VARS_eNB *eNB,
#endif #endif
#endif #endif
if (SR_payload == 1) { // this implements Table 7.3.1 from 36.213 if (SR_payload == 1) { // this implements Table 7.3.1 from 36.213
if(uci->pucch_fmt==pucch_format1b){
if (pucch_b0b1[0][0] == 4) { // there isn't a likely transmission if (pucch_b0b1[0][0] == 4) { // there isn't a likely transmission
harq_ack[0] = 4; // DTX harq_ack[0] = 4; // DTX
} else if (pucch_b0b1[0][0] == 1 && pucch_b0b1[0][1] == 1) { // 1/4/7 ACKs } else if (pucch_b0b1[0][0] == 1 && pucch_b0b1[0][1] == 1) { // 1/4/7 ACKs
...@@ -885,6 +887,13 @@ uci_procedures(PHY_VARS_eNB *eNB, ...@@ -885,6 +887,13 @@ uci_procedures(PHY_VARS_eNB *eNB,
uci->stat = metric[0]; uci->stat = metric[0];
fill_uci_harq_indication(eNB,uci,frame,subframe,harq_ack,2,0xffff); // special_bundling mode fill_uci_harq_indication(eNB,uci,frame,subframe,harq_ack,2,0xffff); // special_bundling mode
}else{
harq_ack[0] = pucch_b0b1[0][0];
harq_ack[1] = pucch_b0b1[0][1];
uci->stat = metric[0];
LOG_D(PHY,"bundling with sr: (%d,%d), metric %d\n",harq_ack[0],harq_ack[1],uci->stat);
fill_uci_harq_indication(eNB,uci,frame,subframe,harq_ack,0,0xffff); // special_bundling mode
}
} else if ((uci->tdd_bundling == 0) && (uci->num_pucch_resources==2)) { // multiplexing + no SR, implement Table 10.1.3-5 (Rel14) for multiplexing with M=2 } else if ((uci->tdd_bundling == 0) && (uci->num_pucch_resources==2)) { // multiplexing + no SR, implement Table 10.1.3-5 (Rel14) for multiplexing with M=2
if (pucch_b0b1[0][0] == 4 || if (pucch_b0b1[0][0] == 4 ||
pucch_b0b1[1][0] == 4) { // there isn't a likely transmission pucch_b0b1[1][0] == 4) { // there isn't a likely transmission
......
...@@ -589,7 +589,6 @@ void init_fep_thread(RU_t *ru,pthread_attr_t *attr_fep) { ...@@ -589,7 +589,6 @@ void init_fep_thread(RU_t *ru,pthread_attr_t *attr_fep) {
pthread_create(&proc->pthread_fep, attr_fep, fep_thread, (void*)ru); pthread_create(&proc->pthread_fep, attr_fep, fep_thread, (void*)ru);
} }
extern void kill_fep_thread(RU_t *ru) extern void kill_fep_thread(RU_t *ru)
...@@ -770,10 +769,34 @@ void fep_full(RU_t *ru) { ...@@ -770,10 +769,34 @@ void fep_full(RU_t *ru) {
RU_proc_t *proc = &ru->proc; RU_proc_t *proc = &ru->proc;
int l; int l;
LTE_DL_FRAME_PARMS *fp=&ru->frame_parms; LTE_DL_FRAME_PARMS *fp=&ru->frame_parms;
double recv_pow=0;
int i,idx;
int shift=0;
short * temp_iq;
if ((fp->frame_type == TDD) && if ((fp->frame_type == TDD) &&
(subframe_select(fp,proc->subframe_rx) != SF_UL)) return; (subframe_select(fp,proc->subframe_rx) != SF_UL)) return;
for(i=0;i<fp->samples_per_tti;i++){
idx=i+fp->samples_per_tti*proc->subframe_rx- ru->N_TA_offset;
if(idx<0) idx+=fp->samples_per_tti*10;
temp_iq=(short*)&ru->common.rxdata[0][idx];
recv_pow += (double)temp_iq[0]*(double)temp_iq[0]+(double)temp_iq[1]*(double)temp_iq[1];
}
recv_pow /= (double)fp->samples_per_tti;
if(recv_pow>1.0){
shift = 3 - (int)log2(sqrt((double)recv_pow));
}
if(shift>0){
LOG_D(PHY,"ave pow %lf shift %d\n",sqrt((double)recv_pow),shift);
for(i=0;i<fp->samples_per_tti;i++){
idx=i+fp->samples_per_tti*proc->subframe_rx- ru->N_TA_offset;
if(idx<0) idx+=fp->samples_per_tti*10;
temp_iq=(short*)&ru->common.rxdata[0][idx];
temp_iq[0]<<=shift;
temp_iq[1]<<=shift;
}
}
start_meas(&ru->ofdm_demod_stats); start_meas(&ru->ofdm_demod_stats);
if (ru->idx == 0) VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPRX+ru->idx, 1 ); if (ru->idx == 0) VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPRX+ru->idx, 1 );
...@@ -795,6 +818,14 @@ void fep_full(RU_t *ru) { ...@@ -795,6 +818,14 @@ void fep_full(RU_t *ru) {
if (ru->idx == 0) VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPRX+ru->idx, 0 ); if (ru->idx == 0) VCD_SIGNAL_DUMPER_DUMP_FUNCTION_BY_NAME( VCD_SIGNAL_DUMPER_FUNCTIONS_PHY_PROCEDURES_RU_FEPRX+ru->idx, 0 );
stop_meas(&ru->ofdm_demod_stats); stop_meas(&ru->ofdm_demod_stats);
if(shift>0){
short * temp_iq;
for(i=0;i<fp->ofdm_symbol_size*14;i++){
temp_iq=(short*)&ru->common.rxdataF[0][i];
temp_iq[0]>>=shift;
temp_iq[1]>>=shift;
}
}
} }
......
...@@ -444,6 +444,11 @@ int flexran_agent_control_delegation(mid_t mod_id, const void *params, Protocol_ ...@@ -444,6 +444,11 @@ int flexran_agent_control_delegation(mid_t mod_id, const void *params, Protocol_
strcpy(target, RC.flexran[mod_id]->cache_name); strcpy(target, RC.flexran[mod_id]->cache_name);
strcat(target, lib_name); strcat(target, lib_name);
FILE *f; FILE *f;
if(-1 == (access(target,F_OK))){
creat(target, 0644);
}else{
chmod(target, 0644);
}
f = fopen(target, "wb"); f = fopen(target, "wb");
if (f) { if (f) {
......
...@@ -829,16 +829,16 @@ typedef struct { ...@@ -829,16 +829,16 @@ typedef struct {
uint8_t periodic_ri_received[NFAPI_CC_MAX]; uint8_t periodic_ri_received[NFAPI_CC_MAX];
uint8_t aperiodic_ri_received[NFAPI_CC_MAX]; uint8_t aperiodic_ri_received[NFAPI_CC_MAX];
uint32_t pucch_tpc_accumulated[NFAPI_CC_MAX]; uint32_t pucch_tpc_accumulated[NFAPI_CC_MAX];
uint8_t pucch1_cqi_update[NFAPI_CC_MAX]; int16_t pucch1_cqi_update[NFAPI_CC_MAX];
uint8_t pucch1_snr[NFAPI_CC_MAX]; int16_t pucch1_snr[NFAPI_CC_MAX];
uint8_t pucch2_cqi_update[NFAPI_CC_MAX]; int16_t pucch2_cqi_update[NFAPI_CC_MAX];
uint8_t pucch2_snr[NFAPI_CC_MAX]; int16_t pucch2_snr[NFAPI_CC_MAX];
uint8_t pucch3_cqi_update[NFAPI_CC_MAX]; int16_t pucch3_cqi_update[NFAPI_CC_MAX];
uint8_t pucch3_snr[NFAPI_CC_MAX]; int16_t pucch3_snr[NFAPI_CC_MAX];
double pusch_cqi_f[NFAPI_CC_MAX]; double pusch_cqi_f[NFAPI_CC_MAX];
uint8_t pusch_cqi[NFAPI_CC_MAX]; int16_t pusch_cqi[NFAPI_CC_MAX];
uint8_t pusch_snr[NFAPI_CC_MAX]; int16_t pusch_snr[NFAPI_CC_MAX];
uint8_t pusch_snr_avg[NFAPI_CC_MAX]; int16_t pusch_snr_avg[NFAPI_CC_MAX];
uint64_t pusch_rx_num[NFAPI_CC_MAX]; uint64_t pusch_rx_num[NFAPI_CC_MAX];
uint64_t pusch_rx_num_old[NFAPI_CC_MAX]; uint64_t pusch_rx_num_old[NFAPI_CC_MAX];
uint64_t pusch_rx_error_num[NFAPI_CC_MAX]; uint64_t pusch_rx_error_num[NFAPI_CC_MAX];
......
This diff is collapsed.
...@@ -189,7 +189,7 @@ add_msg3(module_id_t module_idP, int CC_id, RA_t *ra, frame_t frameP, ...@@ -189,7 +189,7 @@ add_msg3(module_id_t module_idP, int CC_id, RA_t *ra, frame_t frameP,
ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.ul_tx_mode = 0; ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.ul_tx_mode = 0;
ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.current_tx_nb = 0; ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.current_tx_nb = 0;
ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.n_srs = 1; ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.n_srs = 1;
ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.size = get_TBS_UL(10, ra->msg3_nb_rb); ul_config_pdu->ulsch_pdu.ulsch_pdu_rel8.size = get_TBS_UL(ra->msg3_mcs, ra->msg3_nb_rb);
ul_req_body->number_of_pdus++; ul_req_body->number_of_pdus++;
ul_req_body->tl.tag = NFAPI_UL_CONFIG_REQUEST_BODY_TAG; ul_req_body->tl.tag = NFAPI_UL_CONFIG_REQUEST_BODY_TAG;
ul_req->sfn_sf = ra->Msg3_frame<<4|ra->Msg3_subframe; ul_req->sfn_sf = ra->Msg3_frame<<4|ra->Msg3_subframe;
...@@ -571,6 +571,11 @@ void generate_Msg2(module_id_t module_idP, ...@@ -571,6 +571,11 @@ void generate_Msg2(module_id_t module_idP,
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.num_bf_prb_per_subband = 1; dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.num_bf_prb_per_subband = 1;
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.num_bf_vector = 1; dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.num_bf_vector = 1;
// dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.bf_vector = ; // dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.bf_vector = ;
// Rel13 fields
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.tl.tag = NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL13_TAG;
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.ue_type = 0;
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.pdsch_payload_type = 2; // not BR
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.initial_transmission_sf_io = 0xFFFF; // absolute SF = 0;
dl_req_body->number_pdu++; dl_req_body->number_pdu++;
mac->DL_req[CC_idP].sfn_sf = frameP<<4 | subframeP; mac->DL_req[CC_idP].sfn_sf = frameP<<4 | subframeP;
// Program UL processing for Msg3 // Program UL processing for Msg3
...@@ -628,6 +633,7 @@ generate_Msg4(module_id_t module_idP, ...@@ -628,6 +633,7 @@ generate_Msg4(module_id_t module_idP,
uint16_t msg4_header = 0; uint16_t msg4_header = 0;
int UE_id = -1; int UE_id = -1;
int first_rb = 0; int first_rb = 0;
int nb_rb = 0;
int N_RB_DL = 0; int N_RB_DL = 0;
int N_RBG; int N_RBG;
uint8_t lcid = 0; uint8_t lcid = 0;
...@@ -1032,10 +1038,11 @@ generate_Msg4(module_id_t module_idP, ...@@ -1032,10 +1038,11 @@ generate_Msg4(module_id_t module_idP,
module_idP, CC_idP, frameP, subframeP, ra->rnti); module_idP, CC_idP, frameP, subframeP, ra->rnti);
/// Choose first 4 RBs for Msg4, should really check that these are free! /// Choose first 4 RBs for Msg4, should really check that these are free!
first_rb = 0; first_rb = 0;
vrb_map[first_rb] = 1; nb_rb = 4;
vrb_map[first_rb + 1] = 1; if(cc[CC_idP].mib->message.dl_Bandwidth == 3) nb_rb=6;
vrb_map[first_rb + 2] = 1; for(int i=0;i<nb_rb;i++){
vrb_map[first_rb + 3] = 1; vrb_map[first_rb+i] = 1;
}
if((cc[CC_idP].mib->message.dl_Bandwidth == 2) || (cc[CC_idP].mib->message.dl_Bandwidth == 3)) if((cc[CC_idP].mib->message.dl_Bandwidth == 2) || (cc[CC_idP].mib->message.dl_Bandwidth == 3))
{ {
rbg_map[0] = 1; rbg_map[0] = 1;
...@@ -1058,32 +1065,24 @@ generate_Msg4(module_id_t module_idP, ...@@ -1058,32 +1065,24 @@ generate_Msg4(module_id_t module_idP,
// Compute MCS/TBS for 4 PRB (coded on 4 vrb) // Compute MCS/TBS for 4 PRB (coded on 4 vrb)
msg4_header = 1 + 6 + 1; // CR header, CR CE, SDU header msg4_header = 1 + 6 + 1; // CR header, CR CE, SDU header
if ((rrc_sdu_length + msg4_header) <= 28) { ra->msg4_mcs = 3;
ra->msg4_mcs = 3; while(1){
ra->msg4_TBsize = 28; if(get_TBS_DL(ra->msg4_mcs,nb_rb)>(rrc_sdu_length + msg4_header)){
} else if ((rrc_sdu_length + msg4_header) <= 32) { ra->msg4_TBsize=get_TBS_DL(ra->msg4_mcs,nb_rb);
ra->msg4_mcs = 4; break;
ra->msg4_TBsize = 32; }
} else if ((rrc_sdu_length + msg4_header) <= 41) { ra->msg4_mcs++;
ra->msg4_mcs = 5;
ra->msg4_TBsize = 41;
} else if ((rrc_sdu_length + msg4_header) <= 49) {
ra->msg4_mcs = 6;
ra->msg4_TBsize = 49;
} else if ((rrc_sdu_length + msg4_header) <= 59) {
ra->msg4_mcs = 7;
ra->msg4_TBsize = 59;
} else if ((rrc_sdu_length + msg4_header) <= 67) {
ra->msg4_mcs = 8;
ra->msg4_TBsize = 67;
} }
LOG_I(MAC,"Frame %d, subframe %d: MSG4 rnti %d, rrc_sdu_length %d, mcs %d, TBsize %d\n",
frameP, subframeP, ra->rnti, rrc_sdu_length,
ra->msg4_mcs, ra->msg4_TBsize);
fill_nfapi_dl_dci_1(dl_config_pdu, 4, // aggregation_level fill_nfapi_dl_dci_1(dl_config_pdu, 4, // aggregation_level
ra->rnti, // rnti ra->rnti, // rnti
1, // rnti_type, CRNTI 1, // rnti_type, CRNTI
ra->harq_pid, // harq_process ra->harq_pid, // harq_process
1, // tpc, none 1, // tpc, none
allocate_prbs_sub(4, N_RB_DL, N_RBG, rbg_map), // resource_block_coding allocate_prbs_sub(nb_rb, N_RB_DL, N_RBG, rbg_map), // resource_block_coding
ra->msg4_mcs, // mcs ra->msg4_mcs, // mcs
1 - UE_list->UE_template[CC_idP][UE_id].oldNDI[ra->harq_pid][TB1], 1 - UE_list->UE_template[CC_idP][UE_id].oldNDI[ra->harq_pid][TB1],
0, // rv 0, // rv
...@@ -1158,7 +1157,7 @@ generate_Msg4(module_id_t module_idP, ...@@ -1158,7 +1157,7 @@ generate_Msg4(module_id_t module_idP,
// DLSCH Config // DLSCH Config
fill_nfapi_dlsch_config(mac, dl_req_body, ra->msg4_TBsize, mac->pdu_index[CC_idP], ra->rnti, 0, // resource_allocation_type : format 1A/1B/1D fill_nfapi_dlsch_config(mac, dl_req_body, ra->msg4_TBsize, mac->pdu_index[CC_idP], ra->rnti, 0, // resource_allocation_type : format 1A/1B/1D
0, // virtual_resource_block_assignment_flag : localized 0, // virtual_resource_block_assignment_flag : localized
allocate_prbs_sub(4, N_RB_DL, N_RBG, rbg_map), // resource_block_coding allocate_prbs_sub(nb_rb, N_RB_DL, N_RBG, rbg_map), // resource_block_coding
2, // modulation: QPSK 2, // modulation: QPSK
0, // redundancy version 0, // redundancy version
1, // transport_blocks 1, // transport_blocks
...@@ -1250,6 +1249,7 @@ check_Msg4_retransmission(module_id_t module_idP, int CC_idP, ...@@ -1250,6 +1249,7 @@ check_Msg4_retransmission(module_id_t module_idP, int CC_idP,
uint8_t rbg_map[25]; uint8_t rbg_map[25];
uint8_t rbg; uint8_t rbg;
int first_rb; int first_rb;
int nb_rb;
int N_RB_DL; int N_RB_DL;
int N_RBG; int N_RBG;
nfapi_dl_config_request_pdu_t *dl_config_pdu; nfapi_dl_config_request_pdu_t *dl_config_pdu;
...@@ -1332,10 +1332,11 @@ check_Msg4_retransmission(module_id_t module_idP, int CC_idP, ...@@ -1332,10 +1332,11 @@ check_Msg4_retransmission(module_id_t module_idP, int CC_idP,
// we have to schedule a retransmission // we have to schedule a retransmission
dl_req->sfn_sf = frameP<<4 | subframeP; dl_req->sfn_sf = frameP<<4 | subframeP;
first_rb = 0; first_rb = 0;
vrb_map[first_rb] = 1; nb_rb=4;
vrb_map[first_rb + 1] = 1; if(cc[CC_idP].mib->message.dl_Bandwidth == 3) nb_rb=6;
vrb_map[first_rb + 2] = 1; for(int i=0;i<nb_rb;i++){
vrb_map[first_rb + 3] = 1; vrb_map[first_rb+i] = 1;
}
rbg_map[0] = 1; rbg_map[0] = 1;
rbg_map[1] = 1; rbg_map[1] = 1;
for(rbg = 2; rbg < N_RBG; rbg++) for(rbg = 2; rbg < N_RBG; rbg++)
...@@ -1347,7 +1348,7 @@ check_Msg4_retransmission(module_id_t module_idP, int CC_idP, ...@@ -1347,7 +1348,7 @@ check_Msg4_retransmission(module_id_t module_idP, int CC_idP,
1, // rnti_type, CRNTI 1, // rnti_type, CRNTI
ra->harq_pid, // harq_process ra->harq_pid, // harq_process
1, // tpc, none 1, // tpc, none
allocate_prbs_sub(4, N_RB_DL, N_RBG, rbg_map), // resource_block_coding allocate_prbs_sub(nb_rb, N_RB_DL, N_RBG, rbg_map), // resource_block_coding
ra->msg4_mcs, // mcs ra->msg4_mcs, // mcs
UE_list->UE_template[CC_idP][UE_id].oldNDI[ra->harq_pid][TB1], UE_list->UE_template[CC_idP][UE_id].oldNDI[ra->harq_pid][TB1],
round & 3, // rv round & 3, // rv
...@@ -1371,7 +1372,7 @@ check_Msg4_retransmission(module_id_t module_idP, int CC_idP, ...@@ -1371,7 +1372,7 @@ check_Msg4_retransmission(module_id_t module_idP, int CC_idP,
/* retransmission, no pdu_index */ /* retransmission, no pdu_index */
, ra->rnti, 0, // resource_allocation_type : format 1A/1B/1D , ra->rnti, 0, // resource_allocation_type : format 1A/1B/1D
0, // virtual_resource_block_assignment_flag : localized 0, // virtual_resource_block_assignment_flag : localized
allocate_prbs_sub(4, N_RB_DL, N_RBG, rbg_map), // resource_block_coding : RIV, 4 PRB allocate_prbs_sub(nb_rb, N_RB_DL, N_RBG, rbg_map), // resource_block_coding : RIV, 4 PRB
2, // modulation: QPSK 2, // modulation: QPSK
round & 3, // redundancy version round & 3, // redundancy version
1, // transport_blocks 1, // transport_blocks
......
This diff is collapsed.
...@@ -122,6 +122,15 @@ void schedule_ulsch_rnti_fairRR(module_id_t module_idP, ...@@ -122,6 +122,15 @@ void schedule_ulsch_rnti_fairRR(module_id_t module_idP,
unsigned char sched_subframeP, unsigned char sched_subframeP,
ULSCH_UE_SELECT ulsch_ue_select[MAX_NUM_CCs]); ULSCH_UE_SELECT ulsch_ue_select[MAX_NUM_CCs]);
void select_dl_ue_candidate(
module_id_t module_idP,
frame_t frameP,
sub_frame_t subframeP);
void select_ul_ue_candidate(
module_id_t module_idP,
frame_t frameP,
sub_frame_t subframeP);
/* extern */ /* extern */
extern DLSCH_UE_SELECT dlsch_ue_select[MAX_NUM_CCs]; extern DLSCH_UE_SELECT dlsch_ue_select[MAX_NUM_CCs];
......
...@@ -1291,7 +1291,6 @@ int getM_mac(COMMON_channels_t *cc,sub_frame_t subframeP){ ...@@ -1291,7 +1291,6 @@ int getM_mac(COMMON_channels_t *cc,sub_frame_t subframeP){
return 1; return 1;
} }
break; break;
case 1: case 1:
switch (subframeP) { switch (subframeP) {
case 2: case 2:
...@@ -1302,7 +1301,6 @@ int getM_mac(COMMON_channels_t *cc,sub_frame_t subframeP){ ...@@ -1302,7 +1301,6 @@ int getM_mac(COMMON_channels_t *cc,sub_frame_t subframeP){
return 1; return 1;
} }
break; break;
case 2: case 2:
switch (subframeP) { switch (subframeP) {
case 2: case 2:
...@@ -1310,7 +1308,6 @@ int getM_mac(COMMON_channels_t *cc,sub_frame_t subframeP){ ...@@ -1310,7 +1308,6 @@ int getM_mac(COMMON_channels_t *cc,sub_frame_t subframeP){
return 4; return 4;
} }
break; break;
case 3: case 3:
switch (subframeP) { switch (subframeP) {
case 2: case 2:
...@@ -1320,7 +1317,6 @@ int getM_mac(COMMON_channels_t *cc,sub_frame_t subframeP){ ...@@ -1320,7 +1317,6 @@ int getM_mac(COMMON_channels_t *cc,sub_frame_t subframeP){
return 2; return 2;
} }
break; break;
case 4: case 4:
switch (subframeP) { switch (subframeP) {
case 2: case 2:
...@@ -1328,14 +1324,12 @@ int getM_mac(COMMON_channels_t *cc,sub_frame_t subframeP){ ...@@ -1328,14 +1324,12 @@ int getM_mac(COMMON_channels_t *cc,sub_frame_t subframeP){
return 4; return 4;
} }
break; break;
case 5: case 5:
switch (subframeP) { switch (subframeP) {
case 2: case 2:
return 9; return 9;
} }
break; break;
case 6: case 6:
switch (subframeP) { switch (subframeP) {
case 2: case 2:
...@@ -2072,6 +2066,18 @@ fill_nfapi_dlsch_config(eNB_MAC_INST *eNB, ...@@ -2072,6 +2066,18 @@ fill_nfapi_dlsch_config(eNB_MAC_INST *eNB,
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.num_bf_prb_per_subband = num_bf_prb_per_subband; dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.num_bf_prb_per_subband = num_bf_prb_per_subband;
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.num_bf_vector = num_bf_vector; dl_config_pdu->dlsch_pdu.dlsch_pdu_rel8.num_bf_vector = num_bf_vector;
dl_req->number_pdu++; dl_req->number_pdu++;
// Rel10 fields
#if (LTE_RRC_VERSION >= MAKE_VERSION(10, 0, 0))
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel10.tl.tag = NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL10_TAG;
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel10.pdsch_start = 3;
#endif
// Rel13 fields
#if (LTE_RRC_VERSION >= MAKE_VERSION(13, 0, 0))
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.tl.tag = NFAPI_DL_CONFIG_REQUEST_DLSCH_PDU_REL13_TAG;
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.ue_type = 0; // regular UE
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.pdsch_payload_type = 2; // not BR
dl_config_pdu->dlsch_pdu.dlsch_pdu_rel13.initial_transmission_sf_io = 0xFFFF; // absolute SF
#endif
return; return;
} }
...@@ -2658,7 +2664,8 @@ add_new_ue(module_id_t mod_idP, ...@@ -2658,7 +2664,8 @@ add_new_ue(module_id_t mod_idP,
UE_list->UE_sched_ctrl[UE_id].pusch_rx_error_num[cc_idP] = 0; UE_list->UE_sched_ctrl[UE_id].pusch_rx_error_num[cc_idP] = 0;
UE_list->UE_sched_ctrl[UE_id].pusch_rx_error_num_old[cc_idP] = 0; UE_list->UE_sched_ctrl[UE_id].pusch_rx_error_num_old[cc_idP] = 0;
UE_list->UE_sched_ctrl[UE_id].pusch_bler[cc_idP] = 0; UE_list->UE_sched_ctrl[UE_id].pusch_bler[cc_idP] = 0;
UE_list->UE_sched_ctrl[UE_id].mcs_offset[cc_idP] = 0; UE_list->UE_sched_ctrl[UE_id].ret_cnt[cc_idP] = 0;
UE_list->UE_sched_ctrl[UE_id].first_cnt[cc_idP] = 0;
UE_list->UE_sched_ctrl[UE_id].volte_configured = FALSE; UE_list->UE_sched_ctrl[UE_id].volte_configured = FALSE;
UE_list->UE_sched_ctrl[UE_id].ul_periodic_timer_exp_flag = FALSE; UE_list->UE_sched_ctrl[UE_id].ul_periodic_timer_exp_flag = FALSE;
...@@ -4643,10 +4650,10 @@ extract_harq(module_id_t mod_idP, ...@@ -4643,10 +4650,10 @@ extract_harq(module_id_t mod_idP,
int spatial_bundling = 0; int spatial_bundling = 0;
int tmode[5]; int tmode[5];
int i, j, m; int i, j, m;
uint8_t *pdu; uint8_t *pdu = NULL;
sub_frame_t subframe_tx; sub_frame_t subframe_tx;
int frame_tx; int frame_tx;
uint8_t harq_pid; uint8_t harq_pid = 0;
uint8_t select_tb; uint8_t select_tb;
uint8_t oppose_tb; uint8_t oppose_tb;
uint8_t swap_flg; uint8_t swap_flg;
......
...@@ -186,7 +186,7 @@ rx_sdu(const module_id_t enb_mod_idP, ...@@ -186,7 +186,7 @@ rx_sdu(const module_id_t enb_mod_idP,
UE_scheduling_control->pusch_snr[CC_idP] = tmp_snr; UE_scheduling_control->pusch_snr[CC_idP] = tmp_snr;
if(tmp_snr > 0 && tmp_snr < 63) { if(tmp_snr > 0 && tmp_snr < 63) {
double snr_filter_tpc=0.7; double snr_filter_tpc=0.9;
int snr_thres_tpc=30; int snr_thres_tpc=30;
int diff = UE_scheduling_control->pusch_snr_avg[CC_idP] - UE_scheduling_control->pusch_snr[CC_idP]; int diff = UE_scheduling_control->pusch_snr_avg[CC_idP] - UE_scheduling_control->pusch_snr[CC_idP];
if(abs(diff) < snr_thres_tpc) { if(abs(diff) < snr_thres_tpc) {
...@@ -217,7 +217,7 @@ rx_sdu(const module_id_t enb_mod_idP, ...@@ -217,7 +217,7 @@ rx_sdu(const module_id_t enb_mod_idP,
} }
} else { // sduP == NULL => error } else { // sduP == NULL => error
UE_scheduling_control->pusch_rx_error_num[CC_idP]++; UE_scheduling_control->pusch_rx_error_num[CC_idP]++;
LOG_I(MAC, "[eNB %d][PUSCH %d] CC_id %d %d.%d ULSCH in error in round %d, ul_cqi %d, UE_id %d, RNTI %x\n", LOG_D(MAC, "[eNB %d][PUSCH %d] CC_id %d %d.%d ULSCH in error in round %d, ul_cqi %d, UE_id %d, RNTI %x\n",
enb_mod_idP, enb_mod_idP,
harq_pid, harq_pid,
CC_idP, CC_idP,
......
...@@ -978,6 +978,8 @@ typedef struct { ...@@ -978,6 +978,8 @@ typedef struct {
/// Current DL harq round per harq_pid on each CC /// Current DL harq round per harq_pid on each CC
uint8_t round[NFAPI_CC_MAX][MAX_HARQ_PID][MAX_NUM_TB]; uint8_t round[NFAPI_CC_MAX][MAX_HARQ_PID][MAX_NUM_TB];
uint32_t ret_cnt[NFAPI_CC_MAX];
uint32_t first_cnt[NFAPI_CC_MAX];
/// Current Active TBs per harq_pid on each CC /// Current Active TBs per harq_pid on each CC
uint8_t tbcnt[NFAPI_CC_MAX][MAX_HARQ_PID]; uint8_t tbcnt[NFAPI_CC_MAX][MAX_HARQ_PID];
/// Current UL harq round per harq_pid on each CC /// Current UL harq round per harq_pid on each CC
...@@ -1004,16 +1006,16 @@ typedef struct { ...@@ -1004,16 +1006,16 @@ typedef struct {
int32_t phr_received; int32_t phr_received;
uint8_t periodic_ri_received[NFAPI_CC_MAX]; uint8_t periodic_ri_received[NFAPI_CC_MAX];
uint8_t aperiodic_ri_received[NFAPI_CC_MAX]; uint8_t aperiodic_ri_received[NFAPI_CC_MAX];
uint8_t pucch1_cqi_update[NFAPI_CC_MAX]; int16_t pucch1_cqi_update[NFAPI_CC_MAX];
uint8_t pucch1_snr[NFAPI_CC_MAX]; int16_t pucch1_snr[NFAPI_CC_MAX];
uint8_t pucch2_cqi_update[NFAPI_CC_MAX]; int16_t pucch2_cqi_update[NFAPI_CC_MAX];
uint8_t pucch2_snr[NFAPI_CC_MAX]; int16_t pucch2_snr[NFAPI_CC_MAX];
uint8_t pucch3_cqi_update[NFAPI_CC_MAX]; int16_t pucch3_cqi_update[NFAPI_CC_MAX];
uint8_t pucch3_snr[NFAPI_CC_MAX]; int16_t pucch3_snr[NFAPI_CC_MAX];
double pusch_cqi_f[NFAPI_CC_MAX]; double pusch_cqi_f[NFAPI_CC_MAX];
uint8_t pusch_cqi[NFAPI_CC_MAX]; int16_t pusch_cqi[NFAPI_CC_MAX];
uint8_t pusch_snr[NFAPI_CC_MAX]; int16_t pusch_snr[NFAPI_CC_MAX];
uint8_t pusch_snr_avg[NFAPI_CC_MAX]; int16_t pusch_snr_avg[NFAPI_CC_MAX];
uint64_t pusch_rx_num[NFAPI_CC_MAX]; uint64_t pusch_rx_num[NFAPI_CC_MAX];
uint64_t pusch_rx_num_old[NFAPI_CC_MAX]; uint64_t pusch_rx_num_old[NFAPI_CC_MAX];
uint64_t pusch_rx_error_num[NFAPI_CC_MAX]; uint64_t pusch_rx_error_num[NFAPI_CC_MAX];
......
...@@ -78,7 +78,7 @@ extern uint8_t rb_table[34]; ...@@ -78,7 +78,7 @@ extern uint8_t rb_table[34];
#if defined(PRE_SCD_THREAD) #if defined(PRE_SCD_THREAD)
extern uint32_t dl_buffer_total[MAX_NUM_CCs][NUMBER_OF_UE_MAX]; extern uint64_t dl_buffer_total[MAX_NUM_CCs][NUMBER_OF_UE_MAX];
extern boolean_t pre_scd_activeUE[NUMBER_OF_UE_MAX]; extern boolean_t pre_scd_activeUE[NUMBER_OF_UE_MAX];
extern eNB_UE_STATS pre_scd_eNB_UE_stats[MAX_NUM_CCs][NUMBER_OF_UE_MAX]; extern eNB_UE_STATS pre_scd_eNB_UE_stats[MAX_NUM_CCs][NUMBER_OF_UE_MAX];
#endif #endif
......
...@@ -299,6 +299,8 @@ void dlsch_scheduler_pre_processor_allocate(module_id_t Mod_id, ...@@ -299,6 +299,8 @@ void dlsch_scheduler_pre_processor_allocate(module_id_t Mod_id,
*/ */
void eNB_dlsch_ulsch_scheduler(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP); //, int calibration_flag); void eNB_dlsch_ulsch_scheduler(module_id_t module_idP, frame_t frameP, sub_frame_t subframeP); //, int calibration_flag);
void update_ue_timers(module_id_t module_idP,frame_t frameP, sub_frame_t subframeP);
/* \brief Function to indicate a received preamble on PRACH. It initiates the RA procedure. /* \brief Function to indicate a received preamble on PRACH. It initiates the RA procedure.
@param Mod_id Instance ID of eNB @param Mod_id Instance ID of eNB
@param preamble_index index of the received RA request @param preamble_index index of the received RA request
......
...@@ -85,11 +85,16 @@ fill_rar(const module_id_t module_idP, ...@@ -85,11 +85,16 @@ fill_rar(const module_id_t module_idP,
ra->msg3_first_rb = 2; ra->msg3_first_rb = 2;
} }
} }
ra->msg3_nb_rb = 1; if(cc->tdd_Config){
if(cc->tdd_Config->subframeAssignment==2){
ra->msg3_first_rb+=1;
}
}
ra->msg3_nb_rb = 3;
uint16_t rballoc = mac_computeRIV(N_RB_UL, ra->msg3_first_rb, ra->msg3_nb_rb); // first PRB only for UL Grant uint16_t rballoc = mac_computeRIV(N_RB_UL, ra->msg3_first_rb, ra->msg3_nb_rb); // first PRB only for UL Grant
rar[1] |= (rballoc >> 7) & 7; // Hopping = 0 (bit 3), 3 MSBs of rballoc rar[1] |= (rballoc >> 7) & 7; // Hopping = 0 (bit 3), 3 MSBs of rballoc
rar[2] = ((uint8_t) (rballoc & 0xff)) << 1; // 7 LSBs of rballoc rar[2] = ((uint8_t) (rballoc & 0xff)) << 1; // 7 LSBs of rballoc
ra->msg3_mcs = 10; ra->msg3_mcs = 1;
ra->msg3_TPC = 3; ra->msg3_TPC = 3;
ra->msg3_ULdelay = 0; ra->msg3_ULdelay = 0;
ra->msg3_cqireq = 0; ra->msg3_cqireq = 0;
......
...@@ -647,6 +647,7 @@ rlc_op_status_t rrc_rlc_remove_rlc ( ...@@ -647,6 +647,7 @@ rlc_op_status_t rrc_rlc_remove_rlc (
rb_idP, lcid, rb_idP, lcid,
(srb_flagP) ? "SRB" : "DRB"); (srb_flagP) ? "SRB" : "DRB");
} }
free(rlc_union_p);
return RLC_OP_STATUS_OK; return RLC_OP_STATUS_OK;
} }
......
...@@ -773,8 +773,8 @@ void UL_indication(UL_IND_t *UL_info) { ...@@ -773,8 +773,8 @@ void UL_indication(UL_IND_t *UL_info) {
sched_info->HI_DCI0_req = &mac->HI_DCI0_req[CC_id][sched_info->subframe]; sched_info->HI_DCI0_req = &mac->HI_DCI0_req[CC_id][sched_info->subframe];
if (is_UL_sf(&mac->common_channels[CC_id],sched_info->subframe) < 0) { if (is_UL_sf(&mac->common_channels[CC_id],sched_info->subframe) < 0) {
return; //return;
} }else{
if ((mac->common_channels[CC_id].tdd_Config==NULL) || if ((mac->common_channels[CC_id].tdd_Config==NULL) ||
(is_UL_sf(&mac->common_channels[CC_id],sched_info->subframe)>0)) (is_UL_sf(&mac->common_channels[CC_id],sched_info->subframe)>0))
sched_info->UL_req = &mac->UL_req[CC_id]; sched_info->UL_req = &mac->UL_req[CC_id];
...@@ -799,6 +799,9 @@ void UL_indication(UL_IND_t *UL_info) { ...@@ -799,6 +799,9 @@ void UL_indication(UL_IND_t *UL_info) {
} }
ifi->schedule_response(sched_info); ifi->schedule_response(sched_info);
} }
}
update_ue_timers(module_id,(UL_info->frame+((UL_info->subframe>(9-sf_ahead-1))?1:0)) % 1024,(UL_info->subframe+sf_ahead+1)%10);
LOG_D(PHY,"Schedule_response: SFN_SF:%d%d dl_pdus:%d\n",sched_info->frame,sched_info->subframe,sched_info->DL_req->dl_config_request_body.number_pdu); LOG_D(PHY,"Schedule_response: SFN_SF:%d%d dl_pdus:%d\n",sched_info->frame,sched_info->subframe,sched_info->DL_req->dl_config_request_body.number_pdu);
} }
......
...@@ -2881,7 +2881,6 @@ do_RRCConnectionSetup( ...@@ -2881,7 +2881,6 @@ do_RRCConnectionSetup(
else else
physicalConfigDedicated2->soundingRS_UL_ConfigDedicated = NULL; physicalConfigDedicated2->soundingRS_UL_ConfigDedicated = NULL;
physicalConfigDedicated2->antennaInfo = CALLOC(1,sizeof(*physicalConfigDedicated2->antennaInfo));
physicalConfigDedicated2->schedulingRequestConfig = CALLOC(1,sizeof(*physicalConfigDedicated2->schedulingRequestConfig)); physicalConfigDedicated2->schedulingRequestConfig = CALLOC(1,sizeof(*physicalConfigDedicated2->schedulingRequestConfig));
// PDSCH // PDSCH
...@@ -3091,15 +3090,15 @@ do_RRCConnectionSetup( ...@@ -3091,15 +3090,15 @@ do_RRCConnectionSetup(
case 2: case 2:
switch(frame_parms->N_RB_UL) { switch(frame_parms->N_RB_UL) {
case 25: case 25:
physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_PUCCH_ResourceIndex = sr_base - ue_context_pP->local_uid/2; physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_PUCCH_ResourceIndex = sr_base - ue_context_pP->local_uid/4;
break; break;
case 50: case 50:
physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_PUCCH_ResourceIndex = sr_base - ue_context_pP->local_uid/2; physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_PUCCH_ResourceIndex = sr_base - ue_context_pP->local_uid/4;
break; break;
case 100: case 100:
physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_PUCCH_ResourceIndex = sr_base - ue_context_pP->local_uid/2; physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_PUCCH_ResourceIndex = sr_base - ue_context_pP->local_uid/4;
break; break;
} }
...@@ -3110,6 +3109,11 @@ do_RRCConnectionSetup( ...@@ -3110,6 +3109,11 @@ do_RRCConnectionSetup(
break; break;
} }
} }
if(!((physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_PUCCH_ResourceIndex >= 0) && (physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_PUCCH_ResourceIndex < carrier->sib2->radioResourceConfigCommon.pucch_ConfigCommon.n1PUCCH_AN))) {
LOG_E(RRC, "illegal sr_PUCCH_ResourceIndex %ld n1PUCCH_AN %ld ue_context_pP->local_uid %d\n",
physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_PUCCH_ResourceIndex, carrier->sib2->radioResourceConfigCommon.pucch_ConfigCommon.n1PUCCH_AN, ue_context_pP->local_uid);
return -1;
}
if (carrier->sib1->tdd_Config == NULL) { // FDD if (carrier->sib1->tdd_Config == NULL) { // FDD
physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_ConfigIndex = 5+(ue_context_pP->local_uid%10); // Isr = 5 (every 10 subframes, offset=2+UE_id mod3) physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_ConfigIndex = 5+(ue_context_pP->local_uid%10); // Isr = 5 (every 10 subframes, offset=2+UE_id mod3)
...@@ -3121,8 +3125,8 @@ do_RRCConnectionSetup( ...@@ -3121,8 +3125,8 @@ do_RRCConnectionSetup(
break; break;
case 2: case 2:
physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_ConfigIndex = 7+ physicalConfigDedicated2->schedulingRequestConfig->choice.setup.sr_ConfigIndex = 17+
(ue_context_pP->local_uid&1)*5; // Isr = 5 (every 10 subframes, offset=2 for UE0, 7 for UE1, 2 for UE2, 7 for UE3 , 2 for UE4 etc..) (ue_context_pP->local_uid&3)*5; // Isr = 15 (every 20 subframes, offset=2 for UE0, UE2, UE4.. offset=7 for UE1, UE3, UE5..)
break; break;
case 3: case 3:
...@@ -3195,13 +3199,18 @@ do_RRCConnectionSetup( ...@@ -3195,13 +3199,18 @@ do_RRCConnectionSetup(
RRC_BUF_SIZE); RRC_BUF_SIZE);
if(enc_rval.encoded == -1) { if(enc_rval.encoded == -1) {
LOG_I(RRC, "[eNB AssertFatal]ASN1 message encoding failed (%s, %lu)!\n", LOG_E(RRC, "[eNB AssertFatal]ASN1 message encoding failed (%s, %lu)!\n",
enc_rval.failed_type->name, enc_rval.encoded); enc_rval.failed_type->name, enc_rval.encoded);
return -1; return -1;
} }
LOG_D(RRC,"RRCConnectionSetup Encoded %zd bits (%zd bytes) \n", LOG_D(RRC,"RRCConnectionSetup Encoded %zd bits (%zd bytes) \n",
enc_rval.encoded,(enc_rval.encoded+7)/8); enc_rval.encoded,(enc_rval.encoded+7)/8);
free(mac_MainConfig->phr_Config);
free(maxHARQ_Tx);
free(periodicBSR_Timer);
free(mac_MainConfig->ul_SCH_Config);
free(rrcConnectionSetup->criticalExtensions.choice.c1.choice.rrcConnectionSetup_r8.radioResourceConfigDedicated.mac_MainConfig);
return((enc_rval.encoded+7)/8); return((enc_rval.encoded+7)/8);
} }
...@@ -4114,6 +4123,25 @@ uint16_t do_RRCConnectionReconfiguration(const protocol_ctxt_t *const ctxt_pP, ...@@ -4114,6 +4123,25 @@ uint16_t do_RRCConnectionReconfiguration(const protocol_ctxt_t *const ctxt_pP,
// for (i=0;i<30;i++) // for (i=0;i<30;i++)
// msg("%x.",buffer[i]); // msg("%x.",buffer[i]);
// msg("\n"); // msg("\n");
if (securityConfigHO != NULL) {
free(rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.securityConfigHO);
}
if (mobilityInfo !=NULL) {
free(rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.mobilityControlInfo);
}
if (MeasId_list != NULL) {
if(speedStatePars != NULL) {
free(rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->speedStatePars);
}
if (quantityConfig!=NULL) {
free(rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig->quantityConfig);
}
free(rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.measConfig);
}
if (mac_MainConfig!=NULL) {
free(rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated->mac_MainConfig);
}
free(rrcConnectionReconfiguration->criticalExtensions.choice.c1.choice.rrcConnectionReconfiguration_r8.radioResourceConfigDedicated);
return((enc_rval.encoded+7)/8); return((enc_rval.encoded+7)/8);
} }
......
This diff is collapsed.
...@@ -506,14 +506,14 @@ int logInit (void) ...@@ -506,14 +506,14 @@ int logInit (void)
} }
log_getconfig(g_log); log_getconfig(g_log);
if (g_log->filelog) { if (g_log->filelog) {
gfd = open(g_log->filelog_name, O_WRONLY | O_CREAT, 0666); gfd = open(g_log->filelog_name, O_WRONLY | O_CREAT, 0644);
} }
// could put a loop here to check for all comps // could put a loop here to check for all comps
for (i=MIN_LOG_COMPONENTS; i < MAX_LOG_COMPONENTS; i++) { for (i=MIN_LOG_COMPONENTS; i < MAX_LOG_COMPONENTS; i++) {
if (g_log->log_component[i].filelog == 1 ) { if (g_log->log_component[i].filelog == 1 ) {
g_log->log_component[i].fd = open(g_log->log_component[i].filelog_name, g_log->log_component[i].fd = open(g_log->log_component[i].filelog_name,
O_WRONLY | O_CREAT | O_APPEND, 0666); O_WRONLY | O_CREAT | O_APPEND, 0644);
} }
} }
...@@ -1667,7 +1667,7 @@ void set_component_filelog(int comp) ...@@ -1667,7 +1667,7 @@ void set_component_filelog(int comp)
if (g_log->log_component[comp].fd == 0) { if (g_log->log_component[comp].fd == 0) {
g_log->log_component[comp].fd = open(g_log->log_component[comp].filelog_name, g_log->log_component[comp].fd = open(g_log->log_component[comp].filelog_name,
O_WRONLY | O_CREAT | O_TRUNC, 0666); O_WRONLY | O_CREAT | O_TRUNC, 0644);
} }
} }
} }
......
...@@ -50,6 +50,11 @@ int call_emu(char dst_dir[DIR_LENGTH_MAX]) ...@@ -50,6 +50,11 @@ int call_emu(char dst_dir[DIR_LENGTH_MAX])
char dst_file[DIR_LENGTH_MAX] = ""; char dst_file[DIR_LENGTH_MAX] = "";
strcat(dst_file, dst_dir); strcat(dst_file, dst_dir);
strcat(dst_file, "emulation_result.txt"); strcat(dst_file, "emulation_result.txt");
if(-1 == (dst_file,F_OK)){
creat(dst_file, 0644);
}else{
chmod(dst_file, 0644);
}
file = fopen(dst_file,"w"); file = fopen(dst_file,"w");
//system("../../../openair1/SIMULATION/LTE_PHY_L2/physim --help"); //system("../../../openair1/SIMULATION/LTE_PHY_L2/physim --help");
......
...@@ -54,6 +54,11 @@ int save_XML(int copy_or_move, char *src_file, char *output_dir, char *filename) ...@@ -54,6 +54,11 @@ int save_XML(int copy_or_move, char *src_file, char *output_dir, char *filename)
XML_saving_dir[sizeof(XML_saving_dir) - 1] = 0; // terminate string XML_saving_dir[sizeof(XML_saving_dir) - 1] = 0; // terminate string
strncat(dst_file, filename, sizeof(dst_file) - strlen(dst_file) - 1); strncat(dst_file, filename, sizeof(dst_file) - strlen(dst_file) - 1);
fs = fopen(src_file, "r"); fs = fopen(src_file, "r");
if(-1 == (dst_file,F_OK)){
creat(dst_file, 0644);
}else{
chmod(dst_file, 0644);
}
ft = fopen(dst_file, "w"); ft = fopen(dst_file, "w");
if ((ft !=NULL)&&(fs!=NULL)) { if ((ft !=NULL)&&(fs!=NULL)) {
......
...@@ -495,6 +495,11 @@ int init_opt(void) { ...@@ -495,6 +495,11 @@ int init_opt(void) {
break; break;
case OPT_PCAP: case OPT_PCAP:
if(-1 == (access(in_path,F_OK))){
creat(in_path, 0644);
}else{
chmod(in_path, 0644);
}
file_fd = fopen(in_path, "w"); file_fd = fopen(in_path, "w");
if (file_fd == NULL) { if (file_fd == NULL) {
......
...@@ -240,9 +240,19 @@ void kpi_gen() { ...@@ -240,9 +240,19 @@ void kpi_gen() {
char traffic[30]; char traffic[30];
#ifdef STANDALONE #ifdef STANDALONE
FILE *file; FILE *file;
if(-1 == ("log_OTG.txt",F_OK)){
creat("log_OTG.txt", 0644);
}else{
chmod("log_OTG.txt", 0644);
}
file = fopen("log_OTG.txt", "w"); file = fopen("log_OTG.txt", "w");
#else // Maybe to do modifo log function in order to clear file before a new write !!!! #else // Maybe to do modifo log function in order to clear file before a new write !!!!
FILE *fc; FILE *fc;
if(-1 == ("/tmp/otg.log",F_OK)){
creat("/tmp/otg.log", 0644);
}else{
chmod("/tmp/otg.log", 0644);
}
fc=fopen("/tmp/otg.log","w");; fc=fopen("/tmp/otg.log","w");;
if(fc!=0) if(fc!=0)
......
...@@ -833,8 +833,8 @@ int x2ap_eNB_generate_x2_handover_request_ack (x2ap_eNB_instance_t *instance_p, ...@@ -833,8 +833,8 @@ int x2ap_eNB_generate_x2_handover_request_ack (x2ap_eNB_instance_t *instance_p,
ie = (X2AP_HandoverRequestAcknowledge_IEs_t *)calloc(1, sizeof(X2AP_HandoverRequestAcknowledge_IEs_t)); ie = (X2AP_HandoverRequestAcknowledge_IEs_t *)calloc(1, sizeof(X2AP_HandoverRequestAcknowledge_IEs_t));
ie->id = X2AP_ProtocolIE_ID_id_New_eNB_UE_X2AP_ID; ie->id = X2AP_ProtocolIE_ID_id_New_eNB_UE_X2AP_ID;
ie->criticality = X2AP_Criticality_ignore; ie->criticality = X2AP_Criticality_ignore;
ie->value.present = X2AP_HandoverRequestAcknowledge_IEs__value_PR_UE_X2AP_ID_1; ie->value.present = X2AP_HandoverRequestAcknowledge_IEs__value_PR_UE_X2AP_ID;
ie->value.choice.UE_X2AP_ID_1 = id_target; ie->value.choice.UE_X2AP_ID = id_target;
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
/* mandatory */ /* mandatory */
...@@ -956,8 +956,8 @@ int x2ap_eNB_generate_x2_ue_context_release (x2ap_eNB_instance_t *instance_p, x2 ...@@ -956,8 +956,8 @@ int x2ap_eNB_generate_x2_ue_context_release (x2ap_eNB_instance_t *instance_p, x2
ie = (X2AP_UEContextRelease_IEs_t *)calloc(1, sizeof(X2AP_UEContextRelease_IEs_t)); ie = (X2AP_UEContextRelease_IEs_t *)calloc(1, sizeof(X2AP_UEContextRelease_IEs_t));
ie->id = X2AP_ProtocolIE_ID_id_New_eNB_UE_X2AP_ID; ie->id = X2AP_ProtocolIE_ID_id_New_eNB_UE_X2AP_ID;
ie->criticality = X2AP_Criticality_reject; ie->criticality = X2AP_Criticality_reject;
ie->value.present = X2AP_UEContextRelease_IEs__value_PR_UE_X2AP_ID_1; ie->value.present = X2AP_UEContextRelease_IEs__value_PR_UE_X2AP_ID;
ie->value.choice.UE_X2AP_ID_1 = id_target; ie->value.choice.UE_X2AP_ID = id_target;
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
if (x2ap_eNB_encode_pdu(&pdu, &buffer, &len) < 0) { if (x2ap_eNB_encode_pdu(&pdu, &buffer, &len) < 0) {
...@@ -1023,8 +1023,8 @@ int x2ap_eNB_generate_x2_handover_cancel (x2ap_eNB_instance_t *instance_p, x2ap_ ...@@ -1023,8 +1023,8 @@ int x2ap_eNB_generate_x2_handover_cancel (x2ap_eNB_instance_t *instance_p, x2ap_
ie = (X2AP_HandoverCancel_IEs_t *)calloc(1, sizeof(X2AP_HandoverCancel_IEs_t)); ie = (X2AP_HandoverCancel_IEs_t *)calloc(1, sizeof(X2AP_HandoverCancel_IEs_t));
ie->id = X2AP_ProtocolIE_ID_id_New_eNB_UE_X2AP_ID; ie->id = X2AP_ProtocolIE_ID_id_New_eNB_UE_X2AP_ID;
ie->criticality = X2AP_Criticality_ignore; ie->criticality = X2AP_Criticality_ignore;
ie->value.present = X2AP_HandoverCancel_IEs__value_PR_UE_X2AP_ID_1; ie->value.present = X2AP_HandoverCancel_IEs__value_PR_UE_X2AP_ID;
ie->value.choice.UE_X2AP_ID_1 = id_target; ie->value.choice.UE_X2AP_ID = id_target;
ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie); ASN_SEQUENCE_ADD(&out->protocolIEs.list, ie);
} }
......
...@@ -863,7 +863,7 @@ int x2ap_eNB_handle_handover_response (instance_t instance, ...@@ -863,7 +863,7 @@ int x2ap_eNB_handle_handover_response (instance_t instance,
return -1; return -1;
} }
id_target = ie->value.choice.UE_X2AP_ID_1; id_target = ie->value.choice.UE_X2AP_ID;
ue_id = id_source; ue_id = id_source;
...@@ -1018,7 +1018,7 @@ int x2ap_eNB_handle_ue_context_release (instance_t instance, ...@@ -1018,7 +1018,7 @@ int x2ap_eNB_handle_ue_context_release (instance_t instance,
return -1; return -1;
} }
id_target = ie->value.choice.UE_X2AP_ID_1; id_target = ie->value.choice.UE_X2AP_ID;
ue_id = id_source; ue_id = id_source;
if (ue_id != x2ap_find_id_from_id_source(&instance_p->id_manager, id_source)) { if (ue_id != x2ap_find_id_from_id_source(&instance_p->id_manager, id_source)) {
...@@ -1106,7 +1106,7 @@ int x2ap_eNB_handle_handover_cancel (instance_t instance, ...@@ -1106,7 +1106,7 @@ int x2ap_eNB_handle_handover_cancel (instance_t instance,
X2AP_INFO("%s %d: ie is a NULL pointer \n",__FILE__,__LINE__); X2AP_INFO("%s %d: ie is a NULL pointer \n",__FILE__,__LINE__);
id_target = -1; id_target = -1;
} else } else
id_target = ie->value.choice.UE_X2AP_ID_1; id_target = ie->value.choice.UE_X2AP_ID;
X2AP_FIND_PROTOCOLIE_BY_ID(X2AP_HandoverCancel_IEs_t, ie, x2HandoverCancel, X2AP_FIND_PROTOCOLIE_BY_ID(X2AP_HandoverCancel_IEs_t, ie, x2HandoverCancel,
X2AP_ProtocolIE_ID_id_Cause, true); X2AP_ProtocolIE_ID_id_Cause, true);
......
...@@ -189,6 +189,11 @@ int memory_write(const char* datafile, const void* data, size_t size) ...@@ -189,6 +189,11 @@ int memory_write(const char* datafile, const void* data, size_t size)
int rc = RETURNerror; int rc = RETURNerror;
/* Open the data file for writing operation */ /* Open the data file for writing operation */
if(-1 == (access(datafile,F_OK))){
creat(datafile, 0644);
}else{
chmod(datafile, 0644);
}
FILE* fp = fopen(datafile, "wb"); FILE* fp = fopen(datafile, "wb");
if (fp != NULL) { if (fp != NULL) {
......
...@@ -273,6 +273,7 @@ int s1ap_eNB_handle_s1_setup_failure(uint32_t assoc_id, ...@@ -273,6 +273,7 @@ int s1ap_eNB_handle_s1_setup_failure(uint32_t assoc_id,
S1AP_ERROR("pdu == NULL\n"); S1AP_ERROR("pdu == NULL\n");
return -1; return -1;
} }
container = &pdu->choice.unsuccessfulOutcome.value.choice.S1SetupFailure; container = &pdu->choice.unsuccessfulOutcome.value.choice.S1SetupFailure;
/* S1 Setup Failure == Non UE-related procedure -> stream 0 */ /* S1 Setup Failure == Non UE-related procedure -> stream 0 */
...@@ -282,8 +283,6 @@ int s1ap_eNB_handle_s1_setup_failure(uint32_t assoc_id, ...@@ -282,8 +283,6 @@ int s1ap_eNB_handle_s1_setup_failure(uint32_t assoc_id,
} }
if ((mme_desc_p = s1ap_eNB_get_MME(NULL, assoc_id, 0)) == NULL) { if ((mme_desc_p = s1ap_eNB_get_MME(NULL, assoc_id, 0)) == NULL) {
// S1AP_ERROR("[SCTP %d] Received S1 setup response for non existing "
// "MME context\n", assoc_id);
S1AP_ERROR("[SCTP %d] Received S1 setup failure for non existing " S1AP_ERROR("[SCTP %d] Received S1 setup failure for non existing "
"MME context\n", assoc_id); "MME context\n", assoc_id);
return -1; return -1;
......
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