Commit ffc53b4c authored by frtabu's avatar frtabu

Try to fix LTE UE connection problem

parent d0866ddb
...@@ -166,7 +166,7 @@ int pdcp_fifo_read_input_sdus_fromtun (const protocol_ctxt_t *const ctxt_pP) { ...@@ -166,7 +166,7 @@ int pdcp_fifo_read_input_sdus_fromtun (const protocol_ctxt_t *const ctxt_pP) {
ctxt.rnti=pdcp_eNB_UE_instance_to_rnti[0]; ctxt.rnti=pdcp_eNB_UE_instance_to_rnti[0];
ctxt.enb_flag=ENB_FLAG_YES; ctxt.enb_flag=ENB_FLAG_YES;
ctxt.module_id=0; ctxt.module_id=0;
key = PDCP_COLL_KEY_VALUE(ctxt.module_id, ctxt.rnti, ctxt.enb_flag, rab_id, SRB_FLAG_YES); key = PDCP_COLL_KEY_VALUE(ctxt.module_id, ctxt.rnti, ctxt.enb_flag, rab_id, SRB_FLAG_NO);
h_rc = hashtable_get(pdcp_coll_p, key, (void **)&pdcp_p); h_rc = hashtable_get(pdcp_coll_p, key, (void **)&pdcp_p);
} }
...@@ -716,7 +716,7 @@ void pdcp_fifo_read_input_sdus_from_otg (const protocol_ctxt_t *const ctxt_pP) ...@@ -716,7 +716,7 @@ void pdcp_fifo_read_input_sdus_from_otg (const protocol_ctxt_t *const ctxt_pP)
ctxt_pP->subframe, ctxt_pP->subframe,
ctxt_pP->module_id); ctxt_pP->module_id);
for (dst_id = 0; dst_id<MAX_MOBILES_PER_ENB; dst_id++) { for (dst_id = 0; dst_id<NUMBER_OF_UE_MAX; dst_id++) {
ctxt.rnti = oai_emulation.info.eNB_ue_module_id_to_rnti[ctxt.module_id][dst_id]; ctxt.rnti = oai_emulation.info.eNB_ue_module_id_to_rnti[ctxt.module_id][dst_id];
} }
} }
......
...@@ -30,9 +30,9 @@ ...@@ -30,9 +30,9 @@
#include <stdio.h> #include <stdio.h>
#include <uhd/version.hpp> #include <uhd/version.hpp>
#if UHD_VERSION < 3110000 #if UHD_VERSION < 3110000
#include <uhd/utils/thread_priority.hpp> #include <uhd/utils/thread_priority.hpp>
#else #else
#include <uhd/utils/thread.hpp> #include <uhd/utils/thread.hpp>
#endif #endif
#include <uhd/usrp/multi_usrp.hpp> #include <uhd/usrp/multi_usrp.hpp>
#include <uhd/version.hpp> #include <uhd/version.hpp>
...@@ -52,15 +52,15 @@ ...@@ -52,15 +52,15 @@
#include <sys/resource.h> #include <sys/resource.h>
#ifdef __SSE4_1__ #ifdef __SSE4_1__
# include <smmintrin.h> #include <smmintrin.h>
#endif #endif
#ifdef __AVX2__ #ifdef __AVX2__
# include <immintrin.h> #include <immintrin.h>
#endif #endif
#ifdef __arm__ #ifdef __arm__
# include <arm_neon.h> #include <arm_neon.h>
#endif #endif
/** @addtogroup _USRP_PHY_RF_INTERFACE_ /** @addtogroup _USRP_PHY_RF_INTERFACE_
...@@ -140,13 +140,11 @@ int check_ref_locked(usrp_state_t *s,size_t mboard) { ...@@ -140,13 +140,11 @@ int check_ref_locked(usrp_state_t *s,size_t mboard) {
} else { } else {
std::cout << "FAILED" << std::endl; std::cout << "FAILED" << std::endl;
} }
} else { } else {
std::cout << boost::format("ref_locked sensor not present on this board.\n"); std::cout << boost::format("ref_locked sensor not present on this board.\n");
} }
return ref_locked; return ref_locked;
} }
static int sync_to_gps(openair0_device *device) { static int sync_to_gps(openair0_device *device) {
...@@ -179,7 +177,6 @@ static int sync_to_gps(openair0_device *device) { ...@@ -179,7 +177,6 @@ static int sync_to_gps(openair0_device *device) {
for (size_t mboard = 0; mboard < num_mboards; mboard++) { for (size_t mboard = 0; mboard < num_mboards; mboard++) {
std::cout << "Synchronizing mboard " << mboard << ": " << s->usrp->get_mboard_name(mboard) << std::endl; std::cout << "Synchronizing mboard " << mboard << ": " << s->usrp->get_mboard_name(mboard) << std::endl;
bool ref_locked = check_ref_locked(s,mboard); bool ref_locked = check_ref_locked(s,mboard);
if (ref_locked) { if (ref_locked) {
...@@ -266,41 +263,41 @@ static int sync_to_gps(openair0_device *device) { ...@@ -266,41 +263,41 @@ static int sync_to_gps(openair0_device *device) {
} }
#if defined(USRP_REC_PLAY) #if defined(USRP_REC_PLAY)
#include "usrp_lib.h" #include "usrp_lib.h"
static FILE *pFile = NULL; static FILE *pFile = NULL;
int mmapfd = 0; int mmapfd = 0;
int iqfd = 0; int iqfd = 0;
int use_mmap = 1; // default is to use mmap int use_mmap = 1; // default is to use mmap
struct stat sb; struct stat sb;
iqrec_t *ms_sample = NULL; // memory for all subframes iqrec_t *ms_sample = NULL; // memory for all subframes
unsigned int nb_samples = 0; unsigned int nb_samples = 0;
unsigned int cur_samples = 0; unsigned int cur_samples = 0;
int64_t wrap_count = 0; int64_t wrap_count = 0;
int64_t wrap_ts = 0; int64_t wrap_ts = 0;
unsigned int u_sf_mode = 0; // 1=record, 2=replay unsigned int u_sf_mode = 0; // 1=record, 2=replay
unsigned int u_sf_record = 0; // record mode unsigned int u_sf_record = 0; // record mode
unsigned int u_sf_replay = 0; // replay mode unsigned int u_sf_replay = 0; // replay mode
char u_sf_filename[1024] = ""; // subframes file path char u_sf_filename[1024] = ""; // subframes file path
unsigned int u_sf_max = DEF_NB_SF; // max number of recorded subframes unsigned int u_sf_max = DEF_NB_SF; // max number of recorded subframes
unsigned int u_sf_loops = DEF_SF_NB_LOOP; // number of loops in replay mode unsigned int u_sf_loops = DEF_SF_NB_LOOP; // number of loops in replay mode
unsigned int u_sf_read_delay = DEF_SF_DELAY_READ; // read delay in replay mode unsigned int u_sf_read_delay = DEF_SF_DELAY_READ; // read delay in replay mode
unsigned int u_sf_write_delay = DEF_SF_DELAY_WRITE; // write delay in replay mode unsigned int u_sf_write_delay = DEF_SF_DELAY_WRITE; // write delay in replay mode
char config_opt_sf_file[] = CONFIG_OPT_SF_FILE; char config_opt_sf_file[] = CONFIG_OPT_SF_FILE;
char config_def_sf_file[] = DEF_SF_FILE; char config_def_sf_file[] = DEF_SF_FILE;
char config_hlp_sf_file[] = CONFIG_HLP_SF_FILE; char config_hlp_sf_file[] = CONFIG_HLP_SF_FILE;
char config_opt_sf_rec[] = CONFIG_OPT_SF_REC; char config_opt_sf_rec[] = CONFIG_OPT_SF_REC;
char config_hlp_sf_rec[] = CONFIG_HLP_SF_REC; char config_hlp_sf_rec[] = CONFIG_HLP_SF_REC;
char config_opt_sf_rep[] = CONFIG_OPT_SF_REP; char config_opt_sf_rep[] = CONFIG_OPT_SF_REP;
char config_hlp_sf_rep[] = CONFIG_HLP_SF_REP; char config_hlp_sf_rep[] = CONFIG_HLP_SF_REP;
char config_opt_sf_max[] = CONFIG_OPT_SF_MAX; char config_opt_sf_max[] = CONFIG_OPT_SF_MAX;
char config_hlp_sf_max[] = CONFIG_HLP_SF_MAX; char config_hlp_sf_max[] = CONFIG_HLP_SF_MAX;
char config_opt_sf_loops[] = CONFIG_OPT_SF_LOOPS; char config_opt_sf_loops[] = CONFIG_OPT_SF_LOOPS;
char config_hlp_sf_loops[] = CONFIG_HLP_SF_LOOPS; char config_hlp_sf_loops[] = CONFIG_HLP_SF_LOOPS;
char config_opt_sf_rdelay[] = CONFIG_OPT_SF_RDELAY; char config_opt_sf_rdelay[] = CONFIG_OPT_SF_RDELAY;
char config_hlp_sf_rdelay[] = CONFIG_HLP_SF_RDELAY; char config_hlp_sf_rdelay[] = CONFIG_HLP_SF_RDELAY;
char config_opt_sf_wdelay[] = CONFIG_OPT_SF_WDELAY; char config_opt_sf_wdelay[] = CONFIG_OPT_SF_WDELAY;
char config_hlp_sf_wdelay[] = CONFIG_HLP_SF_WDELAY; char config_hlp_sf_wdelay[] = CONFIG_HLP_SF_WDELAY;
#endif #endif
...@@ -360,7 +357,6 @@ static void trx_usrp_end(openair0_device *device) { ...@@ -360,7 +357,6 @@ static void trx_usrp_end(openair0_device *device) {
done = 1; done = 1;
if (u_sf_mode != 2) { // not subframes replay if (u_sf_mode != 2) { // not subframes replay
#endif #endif
usrp_state_t *s = (usrp_state_t *)device->priv; usrp_state_t *s = (usrp_state_t *)device->priv;
...@@ -449,22 +445,20 @@ static int trx_usrp_write(openair0_device *device, openair0_timestamp timestamp, ...@@ -449,22 +445,20 @@ static int trx_usrp_write(openair0_device *device, openair0_timestamp timestamp,
if (u_sf_mode != 2) { // not replay mode if (u_sf_mode != 2) { // not replay mode
#endif #endif
usrp_state_t *s = (usrp_state_t *)device->priv; usrp_state_t *s = (usrp_state_t *)device->priv;
int nsamps2; // aligned to upper 32 or 16 byte boundary int nsamps2; // aligned to upper 32 or 16 byte boundary
#if defined(__x86_64) || defined(__i386__) #if defined(__x86_64) || defined(__i386__)
#ifdef __AVX2__ #ifdef __AVX2__
nsamps2 = (nsamps+7)>>3; nsamps2 = (nsamps+7)>>3;
__m256i buff_tx[2][nsamps2]; __m256i buff_tx[2][nsamps2];
#else #else
nsamps2 = (nsamps+3)>>2; nsamps2 = (nsamps+3)>>2;
__m128i buff_tx[2][nsamps2]; __m128i buff_tx[2][nsamps2];
#endif #endif
#elif defined(__arm__) #elif defined(__arm__)
nsamps2 = (nsamps+3)>>2; nsamps2 = (nsamps+3)>>2;
int16x8_t buff_tx[2][nsamps2]; int16x8_t buff_tx[2][nsamps2];
#else #else
#error Unsupported CPU architecture, USRP device cannot be built #error Unsupported CPU architecture, USRP device cannot be built
#endif #endif
// bring RX data into 12 LSBs for softmodem RX // bring RX data into 12 LSBs for softmodem RX
...@@ -504,8 +498,7 @@ static int trx_usrp_write(openair0_device *device, openair0_timestamp timestamp, ...@@ -504,8 +498,7 @@ static int trx_usrp_write(openair0_device *device, openair0_timestamp timestamp,
// s->tx_md.end_of_burst = false; // s->tx_md.end_of_burst = false;
first_packet_state = false; first_packet_state = false;
last_packet_state = false; last_packet_state = false;
} } else if (flags==10) { // fail safe mode
else if (flags==10) { // fail safe mode
// s->tx_md.has_time_spec = false; // s->tx_md.has_time_spec = false;
// s->tx_md.start_of_burst = false; // s->tx_md.start_of_burst = false;
// s->tx_md.end_of_burst = true; // s->tx_md.end_of_burst = true;
...@@ -517,14 +510,13 @@ static int trx_usrp_write(openair0_device *device, openair0_timestamp timestamp, ...@@ -517,14 +510,13 @@ static int trx_usrp_write(openair0_device *device, openair0_timestamp timestamp,
s->tx_md.start_of_burst = (s->tx_count==0) ? true : first_packet_state; s->tx_md.start_of_burst = (s->tx_count==0) ? true : first_packet_state;
s->tx_md.end_of_burst = last_packet_state; s->tx_md.end_of_burst = last_packet_state;
s->tx_md.time_spec = uhd::time_spec_t::from_ticks(timestamp, s->sample_rate); s->tx_md.time_spec = uhd::time_spec_t::from_ticks(timestamp, s->sample_rate);
s->tx_count++; s->tx_count++;
if (cc>1) { if (cc>1) {
std::vector<void *> buff_ptrs; std::vector<void *> buff_ptrs;
for (int i=0; i<cc; i++) for (int i=0; i<cc; i++)
buff_ptrs.push_back(&(((int16_t*)buff_tx[i])[0])); buff_ptrs.push_back(&(((int16_t *)buff_tx[i])[0]));
ret = (int)s->tx_stream->send(buff_ptrs, nsamps, s->tx_md); ret = (int)s->tx_stream->send(buff_ptrs, nsamps, s->tx_md);
} else ret = (int)s->tx_stream->send(&(((int16_t *)buff_tx[0])[0]), nsamps, s->tx_md); } else ret = (int)s->tx_stream->send(&(((int16_t *)buff_tx[0])[0]), nsamps, s->tx_md);
...@@ -612,11 +604,11 @@ static int trx_usrp_read(openair0_device *device, openair0_timestamp *ptimestamp ...@@ -612,11 +604,11 @@ static int trx_usrp_read(openair0_device *device, openair0_timestamp *ptimestamp
if ((((uintptr_t) buff[i])&0x1F)==0) { if ((((uintptr_t) buff[i])&0x1F)==0) {
((__m256i *)buff[i])[j] = _mm256_srai_epi16(buff_tmp[i][j],4); ((__m256i *)buff[i])[j] = _mm256_srai_epi16(buff_tmp[i][j],4);
} else {
((__m128i *)buff[i])[2*j] = _mm_srai_epi16(((__m128i *)buff_tmp[i])[2*j],4);
((__m128i *)buff[i])[2*j+1] = _mm_srai_epi16(((__m128i *)buff_tmp[i])[2*j+1],4);
} }
else {
((__m128i *)buff[i])[2*j] = _mm_srai_epi16(((__m128i*)buff_tmp[i])[2*j],4);
((__m128i *)buff[i])[2*j+1] = _mm_srai_epi16(((__m128i*)buff_tmp[i])[2*j+1],4);
}
#else #else
((__m128i *)buff[i])[j] = _mm_srai_epi16(buff_tmp[i][j],4); ((__m128i *)buff[i])[j] = _mm_srai_epi16(buff_tmp[i][j],4);
#endif #endif
...@@ -868,7 +860,6 @@ void set_rx_gain_offset(openair0_config_t *openair0_cfg, int chain_index,int bw_ ...@@ -868,7 +860,6 @@ void set_rx_gain_offset(openair0_config_t *openair0_cfg, int chain_index,int bw_
if (bw_gain_adjust==1) { if (bw_gain_adjust==1) {
switch ((int)openair0_cfg[0].sample_rate) { switch ((int)openair0_cfg[0].sample_rate) {
case 46080000: case 46080000:
break; break;
...@@ -1077,7 +1068,6 @@ extern "C" { ...@@ -1077,7 +1068,6 @@ extern "C" {
} else { } else {
#endif #endif
usrp_state_t *s = (usrp_state_t *)calloc(sizeof(usrp_state_t),1); usrp_state_t *s = (usrp_state_t *)calloc(sizeof(usrp_state_t),1);
// Initialize USRP device // Initialize USRP device
device->openair0_cfg = openair0_cfg; device->openair0_cfg = openair0_cfg;
int vers=0,subvers=0,subsubvers=0; int vers=0,subvers=0,subsubvers=0;
...@@ -1092,8 +1082,8 @@ extern "C" { ...@@ -1092,8 +1082,8 @@ extern "C" {
sscanf(uhd::get_version_string().c_str(),"%d.%d.%d",&vers,&subvers,&subsubvers); sscanf(uhd::get_version_string().c_str(),"%d.%d.%d",&vers,&subvers,&subsubvers);
LOG_I(HW,"UHD version %s (%d.%d.%d)\n", LOG_I(HW,"UHD version %s (%d.%d.%d)\n",
uhd::get_version_string().c_str(),vers,subvers,subsubvers); uhd::get_version_string().c_str(),vers,subvers,subsubvers);
std::string args; std::string args;
if (openair0_cfg[0].sdr_addrs == NULL) { if (openair0_cfg[0].sdr_addrs == NULL) {
args = "type=b200"; args = "type=b200";
} else { } else {
...@@ -1123,6 +1113,7 @@ extern "C" { ...@@ -1123,6 +1113,7 @@ extern "C" {
args += boost::str(boost::format(",master_clock_rate=%f") % usrp_master_clock); args += boost::str(boost::format(",master_clock_rate=%f") % usrp_master_clock);
args += ",num_send_frames=256,num_recv_frames=256, send_frame_size=7680, recv_frame_size=7680" ; args += ",num_send_frames=256,num_recv_frames=256, send_frame_size=7680, recv_frame_size=7680" ;
} }
if (device_adds[0].get("type") == "n3xx") { if (device_adds[0].get("type") == "n3xx") {
printf("Found USRP n300\n"); printf("Found USRP n300\n");
device->type=USRP_X300_DEV; //treat it as X300 for now device->type=USRP_X300_DEV; //treat it as X300 for now
...@@ -1136,6 +1127,7 @@ extern "C" { ...@@ -1136,6 +1127,7 @@ extern "C" {
device->type=USRP_X300_DEV; device->type=USRP_X300_DEV;
usrp_master_clock = 184.32e6; usrp_master_clock = 184.32e6;
args += boost::str(boost::format(",master_clock_rate=%f") % usrp_master_clock); args += boost::str(boost::format(",master_clock_rate=%f") % usrp_master_clock);
// USRP recommended: https://files.ettus.com/manual/page_usrp_x3x0_config.html // USRP recommended: https://files.ettus.com/manual/page_usrp_x3x0_config.html
if ( 0 != system("sysctl -w net.core.rmem_max=33554432 net.core.wmem_max=33554432") ) if ( 0 != system("sysctl -w net.core.rmem_max=33554432 net.core.wmem_max=33554432") )
LOG_W(HW,"Can't set kernel parameters for X3xx\n"); LOG_W(HW,"Can't set kernel parameters for X3xx\n");
...@@ -1152,13 +1144,11 @@ extern "C" { ...@@ -1152,13 +1144,11 @@ extern "C" {
//s->usrp->set_sync_source("clock_source=internal","time_source=internal"); //s->usrp->set_sync_source("clock_source=internal","time_source=internal");
s->usrp->set_time_source("internal"); s->usrp->set_time_source("internal");
s->usrp->set_clock_source("internal"); s->usrp->set_clock_source("internal");
} } else if (openair0_cfg[0].clock_source == external ) {
else if (openair0_cfg[0].clock_source == external ) {
//s->usrp->set_sync_source("clock_source=external","time_source=external"); //s->usrp->set_sync_source("clock_source=external","time_source=external");
s->usrp->set_time_source("external"); s->usrp->set_time_source("external");
s->usrp->set_clock_source("external"); s->usrp->set_clock_source("external");
} } else if (openair0_cfg[0].clock_source==gpsdo) {
else if (openair0_cfg[0].clock_source==gpsdo) {
s->usrp->set_clock_source("gpsdo"); s->usrp->set_clock_source("gpsdo");
s->usrp->set_time_source("gpsdo"); s->usrp->set_time_source("gpsdo");
} }
...@@ -1168,10 +1158,10 @@ extern "C" { ...@@ -1168,10 +1158,10 @@ extern "C" {
if (s->usrp->get_clock_source(0) == "gpsdo") { if (s->usrp->get_clock_source(0) == "gpsdo") {
s->use_gps = 1; s->use_gps = 1;
if (sync_to_gps(device)==EXIT_SUCCESS) { if (sync_to_gps(device)==EXIT_SUCCESS) {
LOG_I(HW,"USRP synced with GPS!\n"); LOG_I(HW,"USRP synced with GPS!\n");
} } else {
else {
LOG_I(HW,"USRP fails to sync with GPS. Exiting.\n"); LOG_I(HW,"USRP fails to sync with GPS. Exiting.\n");
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
...@@ -1184,7 +1174,6 @@ extern "C" { ...@@ -1184,7 +1174,6 @@ extern "C" {
} }
} }
if (device->type==USRP_X300_DEV) { if (device->type==USRP_X300_DEV) {
openair0_cfg[0].rx_gain_calib_table = calib_table_x310; openair0_cfg[0].rx_gain_calib_table = calib_table_x310;
#if defined(USRP_REC_PLAY) #if defined(USRP_REC_PLAY)
...@@ -1218,8 +1207,13 @@ extern "C" { ...@@ -1218,8 +1207,13 @@ extern "C" {
break; break;
case 46080000: case 46080000:
<<<<<<< HEAD
//openair0_cfg[0].samples_per_packet = 2048; //openair0_cfg[0].samples_per_packet = 2048;
openair0_cfg[0].tx_sample_advance = 15; openair0_cfg[0].tx_sample_advance = 15;
=======
//openair0_cfg[0].samples_per_packet = 1024;
openair0_cfg[0].tx_sample_advance = 115;
>>>>>>> Try to fix LTE UE connection problem
openair0_cfg[0].tx_bw = 40e6; openair0_cfg[0].tx_bw = 40e6;
openair0_cfg[0].rx_bw = 40e6; openair0_cfg[0].rx_bw = 40e6;
break; break;
...@@ -1373,7 +1367,6 @@ extern "C" { ...@@ -1373,7 +1367,6 @@ extern "C" {
// display USRP settings // display USRP settings
LOG_I(HW,"Actual master clock: %fMHz...\n",s->usrp->get_master_clock_rate()/1e6); LOG_I(HW,"Actual master clock: %fMHz...\n",s->usrp->get_master_clock_rate()/1e6);
sleep(1); sleep(1);
// create tx & rx streamer // create tx & rx streamer
uhd::stream_args_t stream_args_rx("sc16", "sc16"); uhd::stream_args_t stream_args_rx("sc16", "sc16");
int samples=openair0_cfg[0].sample_rate; int samples=openair0_cfg[0].sample_rate;
...@@ -1451,7 +1444,6 @@ extern "C" { ...@@ -1451,7 +1444,6 @@ extern "C" {
if(is_equal(s->sample_rate, (double)7.68e6)) if(is_equal(s->sample_rate, (double)7.68e6))
s->tx_forward_nsamps = 50; s->tx_forward_nsamps = 50;
#if defined(USRP_REC_PLAY) #if defined(USRP_REC_PLAY)
} }
......
...@@ -448,7 +448,6 @@ static int trx_usrp_write(openair0_device *device, openair0_timestamp timestamp, ...@@ -448,7 +448,6 @@ static int trx_usrp_write(openair0_device *device, openair0_timestamp timestamp,
nsamps2 = (nsamps+3)>>2; nsamps2 = (nsamps+3)>>2;
__m128i buff_tx[2][nsamps2]; __m128i buff_tx[2][nsamps2];
#endif #endif
#elif defined(__arm__) #elif defined(__arm__)
nsamps2 = (nsamps+3)>>2; nsamps2 = (nsamps+3)>>2;
int16x8_t buff_tx[2][nsamps2]; int16x8_t buff_tx[2][nsamps2];
......
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